aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h13
-rw-r--r--include/acpi/acdebug.h8
-rw-r--r--include/acpi/acdisasm.h22
-rw-r--r--include/acpi/acdispat.h4
-rw-r--r--include/acpi/acevents.h2
-rw-r--r--include/acpi/acexcep.h10
-rw-r--r--include/acpi/acglobal.h117
-rw-r--r--include/acpi/achware.h6
-rw-r--r--include/acpi/acinterp.h11
-rw-r--r--include/acpi/aclocal.h77
-rw-r--r--include/acpi/acmacros.h71
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acnamesp.h21
-rw-r--r--include/acpi/acobject.h21
-rw-r--r--include/acpi/acopcode.h4
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acparser.h2
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpi_bus.h23
-rw-r--r--include/acpi/acpi_drivers.h55
-rw-r--r--include/acpi/acpiosxf.h14
-rw-r--r--include/acpi/acpixf.h34
-rw-r--r--include/acpi/acresrc.h2
-rw-r--r--include/acpi/acstruct.h5
-rw-r--r--include/acpi/actables.h106
-rw-r--r--include/acpi/actbl.h334
-rw-r--r--include/acpi/actbl1.h568
-rw-r--r--include/acpi/actbl2.h49
-rw-r--r--include/acpi/actbl71.h134
-rw-r--r--include/acpi/actypes.h108
-rw-r--r--include/acpi/acutils.h8
-rw-r--r--include/acpi/amlcode.h4
-rw-r--r--include/acpi/amlresrc.h2
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-alpha/compiler.h47
-rw-r--r--include/asm-alpha/core_mcpcia.h2
-rw-r--r--include/asm-alpha/dma-mapping.h20
-rw-r--r--include/asm-alpha/io.h10
-rw-r--r--include/asm-alpha/mman.h1
-rw-r--r--include/asm-alpha/pci.h2
-rw-r--r--include/asm-alpha/percpu.h14
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-alpha/sockios.h3
-rw-r--r--include/asm-alpha/string.h2
-rw-r--r--include/asm-alpha/termios.h18
-rw-r--r--include/asm-alpha/unistd.h11
-rw-r--r--include/asm-arm/.gitignore2
-rw-r--r--include/asm-arm/arch-aaec2000/entry-macro.S6
-rw-r--r--include/asm-arm/arch-at91/at91_aic.h (renamed from include/asm-arm/arch-at91rm9200/at91_aic.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_dbgu.h (renamed from include/asm-arm/arch-at91rm9200/at91_dbgu.h)16
-rw-r--r--include/asm-arm/arch-at91/at91_ecc.h (renamed from include/asm-arm/arch-at91rm9200/at91_ecc.h)10
-rw-r--r--include/asm-arm/arch-at91/at91_lcdc.h (renamed from include/asm-arm/arch-at91rm9200/at91_lcdc.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_mci.h (renamed from include/asm-arm/arch-at91rm9200/at91_mci.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_pio.h (renamed from include/asm-arm/arch-at91rm9200/at91_pio.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_pit.h (renamed from include/asm-arm/arch-at91rm9200/at91_pit.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_pmc.h (renamed from include/asm-arm/arch-at91rm9200/at91_pmc.h)4
-rw-r--r--include/asm-arm/arch-at91/at91_rstc.h (renamed from include/asm-arm/arch-at91rm9200/at91_rstc.h)5
-rw-r--r--include/asm-arm/arch-at91/at91_rtc.h (renamed from include/asm-arm/arch-at91rm9200/at91_rtc.h)18
-rw-r--r--include/asm-arm/arch-at91/at91_rtt.h (renamed from include/asm-arm/arch-at91rm9200/at91_rtt.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_shdwc.h (renamed from include/asm-arm/arch-at91rm9200/at91_shdwc.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_spi.h (renamed from include/asm-arm/arch-at91rm9200/at91_spi.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_ssc.h (renamed from include/asm-arm/arch-at91rm9200/at91_ssc.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_st.h (renamed from include/asm-arm/arch-at91rm9200/at91_st.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_tc.h (renamed from include/asm-arm/arch-at91rm9200/at91_tc.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_twi.h (renamed from include/asm-arm/arch-at91rm9200/at91_twi.h)2
-rw-r--r--include/asm-arm/arch-at91/at91_wdt.h (renamed from include/asm-arm/arch-at91rm9200/at91_wdt.h)2
-rw-r--r--include/asm-arm/arch-at91/at91rm9200.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200.h)4
-rw-r--r--include/asm-arm/arch-at91/at91rm9200_emac.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_emac.h)2
-rw-r--r--include/asm-arm/arch-at91/at91rm9200_mc.h (renamed from include/asm-arm/arch-at91rm9200/at91rm9200_mc.h)2
-rw-r--r--include/asm-arm/arch-at91/at91sam9260.h (renamed from include/asm-arm/arch-at91rm9200/at91sam9260.h)6
-rw-r--r--include/asm-arm/arch-at91/at91sam9260_matrix.h (renamed from include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h)6
-rw-r--r--include/asm-arm/arch-at91/at91sam9261.h (renamed from include/asm-arm/arch-at91rm9200/at91sam9261.h)2
-rw-r--r--include/asm-arm/arch-at91/at91sam9261_matrix.h (renamed from include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h)8
-rw-r--r--include/asm-arm/arch-at91/at91sam9263.h131
-rw-r--r--include/asm-arm/arch-at91/at91sam9263_matrix.h129
-rw-r--r--include/asm-arm/arch-at91/at91sam926x_mc.h (renamed from include/asm-arm/arch-at91rm9200/at91sam926x_mc.h)25
-rw-r--r--include/asm-arm/arch-at91/board.h (renamed from include/asm-arm/arch-at91rm9200/board.h)9
-rw-r--r--include/asm-arm/arch-at91/cpu.h (renamed from include/asm-arm/arch-at91rm9200/cpu.h)26
-rw-r--r--include/asm-arm/arch-at91/debug-macro.S39
-rw-r--r--include/asm-arm/arch-at91/dma.h (renamed from include/asm-arm/arch-at91rm9200/dma.h)2
-rw-r--r--include/asm-arm/arch-at91/entry-macro.S32
-rw-r--r--include/asm-arm/arch-at91/gpio.h (renamed from include/asm-arm/arch-at91rm9200/gpio.h)109
-rw-r--r--include/asm-arm/arch-at91/hardware.h (renamed from include/asm-arm/arch-at91rm9200/hardware.h)12
-rw-r--r--include/asm-arm/arch-at91/io.h (renamed from include/asm-arm/arch-at91rm9200/io.h)2
-rw-r--r--include/asm-arm/arch-at91/irqs.h (renamed from include/asm-arm/arch-at91rm9200/irqs.h)6
-rw-r--r--include/asm-arm/arch-at91/memory.h (renamed from include/asm-arm/arch-at91rm9200/memory.h)2
-rw-r--r--include/asm-arm/arch-at91/system.h (renamed from include/asm-arm/arch-at91rm9200/system.h)2
-rw-r--r--include/asm-arm/arch-at91/timex.h (renamed from include/asm-arm/arch-at91rm9200/timex.h)7
-rw-r--r--include/asm-arm/arch-at91/uncompress.h (renamed from include/asm-arm/arch-at91rm9200/uncompress.h)2
-rw-r--r--include/asm-arm/arch-at91/vmalloc.h (renamed from include/asm-arm/arch-at91rm9200/vmalloc.h)2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pdc.h36
-rw-r--r--include/asm-arm/arch-at91rm9200/debug-macro.S39
-rw-r--r--include/asm-arm/arch-at91rm9200/entry-macro.S26
-rw-r--r--include/asm-arm/arch-cl7500/entry-macro.S5
-rw-r--r--include/asm-arm/arch-clps711x/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ebsa110/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ebsa285/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ep93xx/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ep93xx/ep93xx-regs.h5
-rw-r--r--include/asm-arm/arch-ep93xx/irqs.h8
-rw-r--r--include/asm-arm/arch-ep93xx/platform.h1
-rw-r--r--include/asm-arm/arch-h720x/entry-macro.S6
-rw-r--r--include/asm-arm/arch-imx/entry-macro.S25
-rw-r--r--include/asm-arm/arch-imx/spi_imx.h72
-rw-r--r--include/asm-arm/arch-integrator/entry-macro.S6
-rw-r--r--include/asm-arm/arch-iop13xx/entry-macro.S18
-rw-r--r--include/asm-arm/arch-iop13xx/iop13xx.h38
-rw-r--r--include/asm-arm/arch-iop13xx/irqs.h17
-rw-r--r--include/asm-arm/arch-iop13xx/system.h2
-rw-r--r--include/asm-arm/arch-iop13xx/time.h51
-rw-r--r--include/asm-arm/arch-iop32x/entry-macro.S33
-rw-r--r--include/asm-arm/arch-iop32x/io.h10
-rw-r--r--include/asm-arm/arch-iop32x/time.h4
-rw-r--r--include/asm-arm/arch-iop33x/entry-macro.S35
-rw-r--r--include/asm-arm/arch-iop33x/io.h9
-rw-r--r--include/asm-arm/arch-iop33x/time.h4
-rw-r--r--include/asm-arm/arch-ixp2000/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ixp23xx/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ixp23xx/ixdp2351.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/avila.h39
-rw-r--r--include/asm-arm/arch-ixp4xx/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ixp4xx/hardware.h1
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h20
-rw-r--r--include/asm-arm/arch-ixp4xx/irqs.h9
-rw-r--r--include/asm-arm/arch-ixp4xx/ixp4xx-regs.h6
-rw-r--r--include/asm-arm/arch-ixp4xx/udc.h22
-rw-r--r--include/asm-arm/arch-l7200/entry-macro.S6
-rw-r--r--include/asm-arm/arch-lh7a40x/entry-macro.S18
-rw-r--r--include/asm-arm/arch-netx/entry-macro.S6
-rw-r--r--include/asm-arm/arch-ns9xxx/board.h18
-rw-r--r--include/asm-arm/arch-ns9xxx/clock.h41
-rw-r--r--include/asm-arm/arch-ns9xxx/debug-macro.S22
-rw-r--r--include/asm-arm/arch-ns9xxx/dma.h14
-rw-r--r--include/asm-arm/arch-ns9xxx/entry-macro.S28
-rw-r--r--include/asm-arm/arch-ns9xxx/hardware.h67
-rw-r--r--include/asm-arm/arch-ns9xxx/io.h20
-rw-r--r--include/asm-arm/arch-ns9xxx/irqs.h85
-rw-r--r--include/asm-arm/arch-ns9xxx/memory.h27
-rw-r--r--include/asm-arm/arch-ns9xxx/processor.h18
-rw-r--r--include/asm-arm/arch-ns9xxx/regs-bbu.h21
-rw-r--r--include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h24
-rw-r--r--include/asm-arm/arch-ns9xxx/regs-mem.h135
-rw-r--r--include/asm-arm/arch-ns9xxx/regs-sys.h157
-rw-r--r--include/asm-arm/arch-ns9xxx/system.h34
-rw-r--r--include/asm-arm/arch-ns9xxx/timex.h20
-rw-r--r--include/asm-arm/arch-ns9xxx/uncompress.h35
-rw-r--r--include/asm-arm/arch-ns9xxx/vmalloc.h16
-rw-r--r--include/asm-arm/arch-omap/entry-macro.S12
-rw-r--r--include/asm-arm/arch-omap/gpio.h67
-rw-r--r--include/asm-arm/arch-omap/memory.h2
-rw-r--r--include/asm-arm/arch-omap/omap-alsa.h12
-rw-r--r--include/asm-arm/arch-pnx4008/entry-macro.S6
-rw-r--r--include/asm-arm/arch-pxa/entry-macro.S6
-rw-r--r--include/asm-arm/arch-pxa/gpio.h80
-rw-r--r--include/asm-arm/arch-pxa/hardware.h12
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h26
-rw-r--r--include/asm-arm/arch-pxa/udc.h30
-rw-r--r--include/asm-arm/arch-realview/entry-macro.S6
-rw-r--r--include/asm-arm/arch-realview/hardware.h2
-rw-r--r--include/asm-arm/arch-realview/irqs.h17
-rw-r--r--include/asm-arm/arch-realview/platform.h18
-rw-r--r--include/asm-arm/arch-realview/scu.h8
-rw-r--r--include/asm-arm/arch-rpc/entry-macro.S5
-rw-r--r--include/asm-arm/arch-s3c2410/audio.h6
-rw-r--r--include/asm-arm/arch-s3c2410/dma.h36
-rw-r--r--include/asm-arm/arch-s3c2410/entry-macro.S6
-rw-r--r--include/asm-arm/arch-s3c2410/gpio.h68
-rw-r--r--include/asm-arm/arch-s3c2410/irqs.h74
-rw-r--r--include/asm-arm/arch-s3c2410/regs-adc.h2
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h36
-rw-r--r--include/asm-arm/arch-s3c2410/regs-mem.h14
-rw-r--r--include/asm-arm/arch-s3c2410/regs-s3c2443-clock.h194
-rw-r--r--include/asm-arm/arch-s3c2410/regs-serial.h13
-rw-r--r--include/asm-arm/arch-s3c2410/reset.h22
-rw-r--r--include/asm-arm/arch-s3c2410/system.h15
-rw-r--r--include/asm-arm/arch-s3c2410/udc.h36
-rw-r--r--include/asm-arm/arch-sa1100/entry-macro.S6
-rw-r--r--include/asm-arm/arch-sa1100/gpio.h75
-rw-r--r--include/asm-arm/arch-shark/entry-macro.S6
-rw-r--r--include/asm-arm/arch-versatile/entry-macro.S6
-rw-r--r--include/asm-arm/atomic.h4
-rw-r--r--include/asm-arm/cacheflush.h49
-rw-r--r--include/asm-arm/checksum.h56
-rw-r--r--include/asm-arm/device.h10
-rw-r--r--include/asm-arm/div64.h3
-rw-r--r--include/asm-arm/dma-mapping.h18
-rw-r--r--include/asm-arm/domain.h1
-rw-r--r--include/asm-arm/fpstate.h3
-rw-r--r--include/asm-arm/gpio.h7
-rw-r--r--include/asm-arm/hardware/arm_scu.h2
-rw-r--r--include/asm-arm/hardware/cache-l2x0.h56
-rw-r--r--include/asm-arm/hardware/gic.h5
-rw-r--r--include/asm-arm/hardware/iop3xx.h87
-rw-r--r--include/asm-arm/hardware/sa1111.h93
-rw-r--r--include/asm-arm/io.h5
-rw-r--r--include/asm-arm/kexec.h30
-rw-r--r--include/asm-arm/pgtable.h54
-rw-r--r--include/asm-arm/plat-s3c24xx/clock.h63
-rw-r--r--include/asm-arm/plat-s3c24xx/common-smdk.h15
-rw-r--r--include/asm-arm/plat-s3c24xx/cpu.h70
-rw-r--r--include/asm-arm/plat-s3c24xx/devs.h51
-rw-r--r--include/asm-arm/plat-s3c24xx/dma.h77
-rw-r--r--include/asm-arm/plat-s3c24xx/irq.h107
-rw-r--r--include/asm-arm/plat-s3c24xx/pm.h73
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2400.h31
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2410.h31
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2412.h29
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2440.h17
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2442.h17
-rw-r--r--include/asm-arm/plat-s3c24xx/s3c2443.h32
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-arm/sockios.h3
-rw-r--r--include/asm-arm/spinlock.h1
-rw-r--r--include/asm-arm/system.h94
-rw-r--r--include/asm-arm/termios.h18
-rw-r--r--include/asm-arm/tlbflush.h50
-rw-r--r--include/asm-arm/uaccess.h10
-rw-r--r--include/asm-arm/unistd.h1
-rw-r--r--include/asm-arm26/socket.h2
-rw-r--r--include/asm-arm26/sockios.h3
-rw-r--r--include/asm-arm26/termios.h18
-rw-r--r--include/asm-arm26/uaccess-asm.h4
-rw-r--r--include/asm-arm26/uaccess.h10
-rw-r--r--include/asm-avr32/Kbuild2
-rw-r--r--include/asm-avr32/arch-at32ap/at32ap7000.h2
-rw-r--r--include/asm-avr32/arch-at32ap/at91_pdc.h36
-rw-r--r--include/asm-avr32/arch-at32ap/board.h4
-rw-r--r--include/asm-avr32/arch-at32ap/gpio.h27
-rw-r--r--include/asm-avr32/arch-at32ap/io.h39
-rw-r--r--include/asm-avr32/arch-at32ap/irq.h14
-rw-r--r--include/asm-avr32/arch-at32ap/portmux.h8
-rw-r--r--include/asm-avr32/arch-at32ap/smc.h22
-rw-r--r--include/asm-avr32/arch-at32ap/time.h112
-rw-r--r--include/asm-avr32/atomic.h2
-rw-r--r--include/asm-avr32/bug.h50
-rw-r--r--include/asm-avr32/checksum.h2
-rw-r--r--include/asm-avr32/dma-mapping.h26
-rw-r--r--include/asm-avr32/gpio.h6
-rw-r--r--include/asm-avr32/io.h349
-rw-r--r--include/asm-avr32/irq.h8
-rw-r--r--include/asm-avr32/posix_types.h2
-rw-r--r--include/asm-avr32/processor.h15
-rw-r--r--include/asm-avr32/setup.h13
-rw-r--r--include/asm-avr32/socket.h2
-rw-r--r--include/asm-avr32/sockios.h3
-rw-r--r--include/asm-avr32/sysreg.h543
-rw-r--r--include/asm-avr32/system.h13
-rw-r--r--include/asm-avr32/termios.h18
-rw-r--r--include/asm-avr32/thread_info.h2
-rw-r--r--include/asm-avr32/uaccess.h19
-rw-r--r--include/asm-avr32/unistd.h17
-rw-r--r--include/asm-cris/io.h5
-rw-r--r--include/asm-cris/semaphore-helper.h9
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-cris/sockios.h3
-rw-r--r--include/asm-cris/system.h3
-rw-r--r--include/asm-cris/termios.h18
-rw-r--r--include/asm-frv/Kbuild6
-rw-r--r--include/asm-frv/page.h4
-rw-r--r--include/asm-frv/pgtable.h6
-rw-r--r--include/asm-frv/ptrace.h4
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-frv/sockios.h3
-rw-r--r--include/asm-frv/termios.h20
-rw-r--r--include/asm-generic/div64.h7
-rw-r--r--include/asm-generic/dma-mapping-broken.h4
-rw-r--r--include/asm-generic/gpio.h25
-rw-r--r--include/asm-generic/memory_model.h2
-rw-r--r--include/asm-generic/mman.h1
-rw-r--r--include/asm-generic/page.h38
-rw-r--r--include/asm-generic/pgtable.h26
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-h8300/sockios.h3
-rw-r--r--include/asm-h8300/termios.h18
-rw-r--r--include/asm-i386/acpi.h25
-rw-r--r--include/asm-i386/apic.h12
-rw-r--r--include/asm-i386/atomic.h4
-rw-r--r--include/asm-i386/bitops.h4
-rw-r--r--include/asm-i386/bugs.h2
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/delay.h8
-rw-r--r--include/asm-i386/desc.h2
-rw-r--r--include/asm-i386/div64.h4
-rw-r--r--include/asm-i386/elf.h12
-rw-r--r--include/asm-i386/hpet.h16
-rw-r--r--include/asm-i386/i8253.h15
-rw-r--r--include/asm-i386/io.h6
-rw-r--r--include/asm-i386/io_apic.h1
-rw-r--r--include/asm-i386/mach-default/do_timer.h78
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h17
-rw-r--r--include/asm-i386/mach-voyager/do_timer.h27
-rw-r--r--include/asm-i386/mce.h2
-rw-r--r--include/asm-i386/mmu_context.h2
-rw-r--r--include/asm-i386/mpspec.h1
-rw-r--r--include/asm-i386/msr.h19
-rw-r--r--include/asm-i386/paravirt.h183
-rw-r--r--include/asm-i386/pda.h12
-rw-r--r--include/asm-i386/pgalloc.h30
-rw-r--r--include/asm-i386/pgtable.h23
-rw-r--r--include/asm-i386/processor.h6
-rw-r--r--include/asm-i386/ptrace.h8
-rw-r--r--include/asm-i386/segment.h19
-rw-r--r--include/asm-i386/setup.h4
-rw-r--r--include/asm-i386/smp.h5
-rw-r--r--include/asm-i386/socket.h2
-rw-r--r--include/asm-i386/sockios.h3
-rw-r--r--include/asm-i386/sync_bitops.h2
-rw-r--r--include/asm-i386/termbits.h2
-rw-r--r--include/asm-i386/termios.h18
-rw-r--r--include/asm-i386/time.h5
-rw-r--r--include/asm-i386/timer.h11
-rw-r--r--include/asm-i386/topology.h1
-rw-r--r--include/asm-i386/tsc.h43
-rw-r--r--include/asm-i386/uaccess.h4
-rw-r--r--include/asm-i386/vmi.h263
-rw-r--r--include/asm-i386/vmi_time.h112
-rw-r--r--include/asm-ia64/acpi.h10
-rw-r--r--include/asm-ia64/dma-mapping.h15
-rw-r--r--include/asm-ia64/dma.h2
-rw-r--r--include/asm-ia64/esi.h1
-rw-r--r--include/asm-ia64/kexec.h3
-rw-r--r--include/asm-ia64/libata-portmap.h12
-rw-r--r--include/asm-ia64/machvec.h5
-rw-r--r--include/asm-ia64/mca.h2
-rw-r--r--include/asm-ia64/meminit.h10
-rw-r--r--include/asm-ia64/pal.h15
-rw-r--r--include/asm-ia64/pci.h7
-rw-r--r--include/asm-ia64/pgalloc.h3
-rw-r--r--include/asm-ia64/processor.h2
-rw-r--r--include/asm-ia64/resource.h1
-rw-r--r--include/asm-ia64/sal.h5
-rw-r--r--include/asm-ia64/setup.h2
-rw-r--r--include/asm-ia64/sn/acpi.h3
-rw-r--r--include/asm-ia64/sn/pcibr_provider.h7
-rw-r--r--include/asm-ia64/sn/pcidev.h8
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-ia64/sockios.h3
-rw-r--r--include/asm-ia64/termios.h18
-rw-r--r--include/asm-ia64/thread_info.h4
-rw-r--r--include/asm-ia64/topology.h2
-rw-r--r--include/asm-ia64/unistd.h4
-rw-r--r--include/asm-ia64/unwind.h2
-rw-r--r--include/asm-m32r/a.out.h2
-rw-r--r--include/asm-m32r/addrspace.h1
-rw-r--r--include/asm-m32r/bugs.h2
-rw-r--r--include/asm-m32r/byteorder.h2
-rw-r--r--include/asm-m32r/cache.h2
-rw-r--r--include/asm-m32r/cacheflush.h1
-rw-r--r--include/asm-m32r/current.h3
-rw-r--r--include/asm-m32r/delay.h2
-rw-r--r--include/asm-m32r/dma-mapping.h19
-rw-r--r--include/asm-m32r/dma.h2
-rw-r--r--include/asm-m32r/errno.h3
-rw-r--r--include/asm-m32r/ide.h6
-rw-r--r--include/asm-m32r/ioctls.h5
-rw-r--r--include/asm-m32r/ipcbuf.h4
-rw-r--r--include/asm-m32r/kmap_types.h4
-rw-r--r--include/asm-m32r/m32104ut/m32104ut_pld.h11
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lan.h13
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_lcd.h13
-rw-r--r--include/asm-m32r/m32700ut/m32700ut_pld.h13
-rw-r--r--include/asm-m32r/mappi2/mappi2_pld.h13
-rw-r--r--include/asm-m32r/mappi3/mappi3_pld.h11
-rw-r--r--include/asm-m32r/mc146818rtc.h3
-rw-r--r--include/asm-m32r/mman.h2
-rw-r--r--include/asm-m32r/mmu.h10
-rw-r--r--include/asm-m32r/mmu_context.h9
-rw-r--r--include/asm-m32r/module.h3
-rw-r--r--include/asm-m32r/msgbuf.h4
-rw-r--r--include/asm-m32r/namei.h4
-rw-r--r--include/asm-m32r/opsput/opsput_lan.h13
-rw-r--r--include/asm-m32r/opsput/opsput_lcd.h13
-rw-r--r--include/asm-m32r/opsput/opsput_pld.h13
-rw-r--r--include/asm-m32r/page.h5
-rw-r--r--include/asm-m32r/param.h4
-rw-r--r--include/asm-m32r/pci.h2
-rw-r--r--include/asm-m32r/pgalloc.h3
-rw-r--r--include/asm-m32r/pgtable-2level.h3
-rw-r--r--include/asm-m32r/posix_types.h4
-rw-r--r--include/asm-m32r/rtc.h4
-rw-r--r--include/asm-m32r/scatterlist.h2
-rw-r--r--include/asm-m32r/sections.h1
-rw-r--r--include/asm-m32r/segment.h4
-rw-r--r--include/asm-m32r/sembuf.h4
-rw-r--r--include/asm-m32r/setup.h4
-rw-r--r--include/asm-m32r/shmbuf.h4
-rw-r--r--include/asm-m32r/shmparam.h2
-rw-r--r--include/asm-m32r/sigcontext.h3
-rw-r--r--include/asm-m32r/siginfo.h2
-rw-r--r--include/asm-m32r/signal.h4
-rw-r--r--include/asm-m32r/smp.h3
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m32r/sockios.h5
-rw-r--r--include/asm-m32r/spinlock_types.h2
-rw-r--r--include/asm-m32r/stat.h4
-rw-r--r--include/asm-m32r/string.h2
-rw-r--r--include/asm-m32r/syscall.h3
-rw-r--r--include/asm-m32r/system.h2
-rw-r--r--include/asm-m32r/termbits.h4
-rw-r--r--include/asm-m32r/termios.h20
-rw-r--r--include/asm-m32r/timex.h3
-rw-r--r--include/asm-m32r/tlbflush.h1
-rw-r--r--include/asm-m32r/types.h6
-rw-r--r--include/asm-m32r/uaccess.h4
-rw-r--r--include/asm-m32r/ucontext.h2
-rw-r--r--include/asm-m32r/unaligned.h8
-rw-r--r--include/asm-m32r/unistd.h2
-rw-r--r--include/asm-m32r/user.h6
-rw-r--r--include/asm-m32r/vga.h4
-rw-r--r--include/asm-m32r/xor.h2
-rw-r--r--include/asm-m68k/div64.h3
-rw-r--r--include/asm-m68k/dma-mapping.h2
-rw-r--r--include/asm-m68k/math-emu.h15
-rw-r--r--include/asm-m68k/mc146818rtc.h1
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68k/sockios.h3
-rw-r--r--include/asm-m68k/termios.h18
-rw-r--r--include/asm-m68k/uaccess.h1
-rw-r--r--include/asm-m68k/user.h2
-rw-r--r--include/asm-m68knommu/bitops.h1
-rw-r--r--include/asm-m68knommu/m528xsim.h3
-rw-r--r--include/asm-mips/abi.h2
-rw-r--r--include/asm-mips/apm.h64
-rw-r--r--include/asm-mips/atomic.h90
-rw-r--r--include/asm-mips/bitops.h155
-rw-r--r--include/asm-mips/bootinfo.h4
-rw-r--r--include/asm-mips/bug.h3
-rw-r--r--include/asm-mips/cacheflush.h12
-rw-r--r--include/asm-mips/checksum.h2
-rw-r--r--include/asm-mips/compat-signal.h57
-rw-r--r--include/asm-mips/cpu-features.h3
-rw-r--r--include/asm-mips/cpu-info.h1
-rw-r--r--include/asm-mips/ddb5xxx/ddb5477.h41
-rw-r--r--include/asm-mips/dec/interrupts.h3
-rw-r--r--include/asm-mips/dec/system.h3
-rw-r--r--include/asm-mips/dec/tc.h41
-rw-r--r--include/asm-mips/dec/tcinfo.h47
-rw-r--r--include/asm-mips/dec/tcmodule.h39
-rw-r--r--include/asm-mips/delay.h2
-rw-r--r--include/asm-mips/div64.h11
-rw-r--r--include/asm-mips/dma-mapping.h2
-rw-r--r--include/asm-mips/dma.h3
-rw-r--r--include/asm-mips/ds1216.h31
-rw-r--r--include/asm-mips/ds1742.h13
-rw-r--r--include/asm-mips/emma2rh/emma2rh.h5
-rw-r--r--include/asm-mips/emma2rh/markeins.h1
-rw-r--r--include/asm-mips/fpu.h43
-rw-r--r--include/asm-mips/hazards.h1
-rw-r--r--include/asm-mips/i8259.h3
-rw-r--r--include/asm-mips/io.h39
-rw-r--r--include/asm-mips/ioctl.h5
-rw-r--r--include/asm-mips/irq.h2
-rw-r--r--include/asm-mips/irq_cpu.h6
-rw-r--r--include/asm-mips/irqflags.h55
-rw-r--r--include/asm-mips/jmr3927/irq.h57
-rw-r--r--include/asm-mips/jmr3927/jmr3927.h136
-rw-r--r--include/asm-mips/jmr3927/tx3927.h8
-rw-r--r--include/asm-mips/jmr3927/txx927.h5
-rw-r--r--include/asm-mips/lasat/lasat.h2
-rw-r--r--include/asm-mips/mach-atlas/mc146818rtc.h2
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h1
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h34
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h4
-rw-r--r--include/asm-mips/mach-emma2rh/irq.h2
-rw-r--r--include/asm-mips/mach-generic/dma-coherence.h45
-rw-r--r--include/asm-mips/mach-generic/irq.h32
-rw-r--r--include/asm-mips/mach-generic/kmalloc.h1
-rw-r--r--include/asm-mips/mach-generic/mc146818rtc.h2
-rw-r--r--include/asm-mips/mach-ip27/dma-coherence.h50
-rw-r--r--include/asm-mips/mach-ip27/topology.h1
-rw-r--r--include/asm-mips/mach-ip32/dma-coherence.h72
-rw-r--r--include/asm-mips/mach-jazz/dma-coherence.h40
-rw-r--r--include/asm-mips/mach-jmr3927/ds1742.h16
-rw-r--r--include/asm-mips/mach-jmr3927/mangle-port.h18
-rw-r--r--include/asm-mips/mach-mips/irq.h2
-rw-r--r--include/asm-mips/mach-mips/mc146818rtc.h2
-rw-r--r--include/asm-mips/mach-rm/cpu-feature-overrides.h5
-rw-r--r--include/asm-mips/mach-rm/mc146818rtc.h10
-rw-r--r--include/asm-mips/mach-vr41xx/irq.h11
-rw-r--r--include/asm-mips/marvell.h1
-rw-r--r--include/asm-mips/mips-boards/atlasint.h4
-rw-r--r--include/asm-mips/mips-boards/maltaint.h4
-rw-r--r--include/asm-mips/mips-boards/prom.h3
-rw-r--r--include/asm-mips/mips-boards/seadint.h4
-rw-r--r--include/asm-mips/mips-boards/simint.h3
-rw-r--r--include/asm-mips/mips_mt.h5
-rw-r--r--include/asm-mips/mipsmtregs.h2
-rw-r--r--include/asm-mips/mman.h1
-rw-r--r--include/asm-mips/paccess.h2
-rw-r--r--include/asm-mips/page.h25
-rw-r--r--include/asm-mips/pci.h1
-rw-r--r--include/asm-mips/pgalloc.h2
-rw-r--r--include/asm-mips/pgtable-64.h2
-rw-r--r--include/asm-mips/pgtable.h12
-rw-r--r--include/asm-mips/ptrace.h4
-rw-r--r--include/asm-mips/rtlx.h7
-rw-r--r--include/asm-mips/sections.h2
-rw-r--r--include/asm-mips/sgi/hpc3.h2
-rw-r--r--include/asm-mips/sgi/ip22.h15
-rw-r--r--include/asm-mips/sgi/mc.h2
-rw-r--r--include/asm-mips/sgialib.h3
-rw-r--r--include/asm-mips/sgiarcs.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_int.h2
-rw-r--r--include/asm-mips/sibyte/bcm1480_mc.h32
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h20
-rw-r--r--include/asm-mips/sibyte/bcm1480_scd.h94
-rw-r--r--include/asm-mips/sibyte/board.h14
-rw-r--r--include/asm-mips/sibyte/carmel.h1
-rw-r--r--include/asm-mips/sibyte/sb1250.h4
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h5
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h24
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h2
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h46
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h31
-rw-r--r--include/asm-mips/sibyte/swarm.h12
-rw-r--r--include/asm-mips/sibyte/trace_prof.h110
-rw-r--r--include/asm-mips/sigcontext.h41
-rw-r--r--include/asm-mips/signal.h17
-rw-r--r--include/asm-mips/smtc.h3
-rw-r--r--include/asm-mips/smtc_ipi.h21
-rw-r--r--include/asm-mips/sni.h131
-rw-r--r--include/asm-mips/socket.h2
-rw-r--r--include/asm-mips/sockios.h3
-rw-r--r--include/asm-mips/spinlock.h60
-rw-r--r--include/asm-mips/stackframe.h30
-rw-r--r--include/asm-mips/system.h36
-rw-r--r--include/asm-mips/termios.h18
-rw-r--r--include/asm-mips/uaccess.h67
-rw-r--r--include/asm-mips/unistd.h18
-rw-r--r--include/asm-mips/vr41xx/cmbvr4133.h5
-rw-r--r--include/asm-parisc/assembly.h20
-rw-r--r--include/asm-parisc/atomic.h12
-rw-r--r--include/asm-parisc/bitops.h24
-rw-r--r--include/asm-parisc/bug.h88
-rw-r--r--include/asm-parisc/cache.h29
-rw-r--r--include/asm-parisc/cacheflush.h179
-rw-r--r--include/asm-parisc/dma-mapping.h2
-rw-r--r--include/asm-parisc/elf.h2
-rw-r--r--include/asm-parisc/hardware.h16
-rw-r--r--include/asm-parisc/io.h13
-rw-r--r--include/asm-parisc/led.h2
-rw-r--r--include/asm-parisc/linkage.h28
-rw-r--r--include/asm-parisc/mman.h1
-rw-r--r--include/asm-parisc/mmzone.h2
-rw-r--r--include/asm-parisc/module.h2
-rw-r--r--include/asm-parisc/msgbuf.h6
-rw-r--r--include/asm-parisc/page.h8
-rw-r--r--include/asm-parisc/parisc-device.h2
-rw-r--r--include/asm-parisc/pdc.h10
-rw-r--r--include/asm-parisc/pdcpat.h31
-rw-r--r--include/asm-parisc/pgalloc.h10
-rw-r--r--include/asm-parisc/pgtable.h1
-rw-r--r--include/asm-parisc/posix_types.h2
-rw-r--r--include/asm-parisc/processor.h10
-rw-r--r--include/asm-parisc/sembuf.h4
-rw-r--r--include/asm-parisc/shmbuf.h10
-rw-r--r--include/asm-parisc/signal.h2
-rw-r--r--include/asm-parisc/smp.h8
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-parisc/sockios.h3
-rw-r--r--include/asm-parisc/spinlock_types.h4
-rw-r--r--include/asm-parisc/statfs.h10
-rw-r--r--include/asm-parisc/system.h2
-rw-r--r--include/asm-parisc/termios.h18
-rw-r--r--include/asm-parisc/thread_info.h4
-rw-r--r--include/asm-parisc/tlbflush.h30
-rw-r--r--include/asm-parisc/types.h2
-rw-r--r--include/asm-parisc/uaccess.h122
-rw-r--r--include/asm-parisc/unistd.h12
-rw-r--r--include/asm-powerpc/Kbuild1
-rw-r--r--include/asm-powerpc/asm-compat.h10
-rw-r--r--include/asm-powerpc/atomic.h40
-rw-r--r--include/asm-powerpc/cacheflush.h6
-rw-r--r--include/asm-powerpc/cell-pmu.h20
-rw-r--r--include/asm-powerpc/cputable.h24
-rw-r--r--include/asm-powerpc/current.h1
-rw-r--r--include/asm-powerpc/dcr-native.h4
-rw-r--r--include/asm-powerpc/dcr.h1
-rw-r--r--include/asm-powerpc/dma-mapping.h12
-rw-r--r--include/asm-powerpc/edac.h40
-rw-r--r--include/asm-powerpc/eeh_event.h6
-rw-r--r--include/asm-powerpc/elf.h2
-rw-r--r--include/asm-powerpc/firmware.h10
-rw-r--r--include/asm-powerpc/floppy.h135
-rw-r--r--include/asm-powerpc/fs_pd.h49
-rw-r--r--include/asm-powerpc/hvcall.h15
-rw-r--r--include/asm-powerpc/ibmebus.h44
-rw-r--r--include/asm-powerpc/immap_86xx.h75
-rw-r--r--include/asm-powerpc/immap_qe.h3
-rw-r--r--include/asm-powerpc/io.h13
-rw-r--r--include/asm-powerpc/iommu.h1
-rw-r--r--include/asm-powerpc/ipic.h2
-rw-r--r--include/asm-powerpc/irq.h3
-rw-r--r--include/asm-powerpc/kprobes.h12
-rw-r--r--include/asm-powerpc/machdep.h3
-rw-r--r--include/asm-powerpc/mmu-hash64.h400
-rw-r--r--include/asm-powerpc/mmu.h404
-rw-r--r--include/asm-powerpc/mpc52xx.h2
-rw-r--r--include/asm-powerpc/mpc8260.h24
-rw-r--r--include/asm-powerpc/mpc8xx.h28
-rw-r--r--include/asm-powerpc/mpic.h36
-rw-r--r--include/asm-powerpc/of_device.h3
-rw-r--r--include/asm-powerpc/oprofile_impl.h89
-rw-r--r--include/asm-powerpc/paca.h4
-rw-r--r--include/asm-powerpc/parport.h6
-rw-r--r--include/asm-powerpc/pci-bridge.h2
-rw-r--r--include/asm-powerpc/pci.h14
-rw-r--r--include/asm-powerpc/pgtable-4k.h3
-rw-r--r--include/asm-powerpc/pgtable-64k.h5
-rw-r--r--include/asm-powerpc/pgtable.h60
-rw-r--r--include/asm-powerpc/pmc.h1
-rw-r--r--include/asm-powerpc/pmi.h67
-rw-r--r--include/asm-powerpc/ppc-pci.h12
-rw-r--r--include/asm-powerpc/processor.h1
-rw-r--r--include/asm-powerpc/prom.h36
-rw-r--r--include/asm-powerpc/ps3.h221
-rw-r--r--include/asm-powerpc/ps3av.h738
-rw-r--r--include/asm-powerpc/ps3fb.h56
-rw-r--r--include/asm-powerpc/reg.h70
-rw-r--r--include/asm-powerpc/smp.h1
-rw-r--r--include/asm-powerpc/socket.h2
-rw-r--r--include/asm-powerpc/sockios.h3
-rw-r--r--include/asm-powerpc/spu.h21
-rw-r--r--include/asm-powerpc/spu_csa.h5
-rw-r--r--include/asm-powerpc/spu_priv1.h2
-rw-r--r--include/asm-powerpc/sstep.h1
-rw-r--r--include/asm-powerpc/string.h2
-rw-r--r--include/asm-powerpc/systbl.h6
-rw-r--r--include/asm-powerpc/system.h1
-rw-r--r--include/asm-powerpc/termios.h18
-rw-r--r--include/asm-powerpc/time.h2
-rw-r--r--include/asm-powerpc/tlb.h1
-rw-r--r--include/asm-powerpc/tlbflush.h172
-rw-r--r--include/asm-powerpc/topology.h1
-rw-r--r--include/asm-powerpc/uaccess.h28
-rw-r--r--include/asm-powerpc/ucc_fast.h3
-rw-r--r--include/asm-powerpc/ucc_slow.h8
-rw-r--r--include/asm-powerpc/udbg.h3
-rw-r--r--include/asm-powerpc/uic.h23
-rw-r--r--include/asm-powerpc/unistd.h4
-rw-r--r--include/asm-powerpc/vdso.h5
-rw-r--r--include/asm-ppc/commproc.h1
-rw-r--r--include/asm-ppc/ibm4xx.h13
-rw-r--r--include/asm-ppc/io.h2
-rw-r--r--include/asm-ppc/m48t35.h77
-rw-r--r--include/asm-ppc/ppc_sys.h2
-rw-r--r--include/asm-ppc/prom.h3
-rw-r--r--include/asm-ppc/reg_booke.h2
-rw-r--r--include/asm-ppc/serial.h2
-rw-r--r--include/asm-s390/atomic.h2
-rw-r--r--include/asm-s390/bug.h69
-rw-r--r--include/asm-s390/bugs.h2
-rw-r--r--include/asm-s390/ccwdev.h2
-rw-r--r--include/asm-s390/ccwgroup.h1
-rw-r--r--include/asm-s390/checksum.h59
-rw-r--r--include/asm-s390/chpid.h53
-rw-r--r--include/asm-s390/cio.h8
-rw-r--r--include/asm-s390/compat.h28
-rw-r--r--include/asm-s390/etr.h219
-rw-r--r--include/asm-s390/hardirq.h2
-rw-r--r--include/asm-s390/io.h75
-rw-r--r--include/asm-s390/ipl.h150
-rw-r--r--include/asm-s390/kdebug.h3
-rw-r--r--include/asm-s390/local.h59
-rw-r--r--include/asm-s390/lowcore.h52
-rw-r--r--include/asm-s390/mmu_context.h50
-rw-r--r--include/asm-s390/pgalloc.h85
-rw-r--r--include/asm-s390/pgtable.h162
-rw-r--r--include/asm-s390/processor.h34
-rw-r--r--include/asm-s390/ptrace.h11
-rw-r--r--include/asm-s390/reset.h3
-rw-r--r--include/asm-s390/sclp.h53
-rw-r--r--include/asm-s390/sections.h2
-rw-r--r--include/asm-s390/setup.h89
-rw-r--r--include/asm-s390/sfp-util.h66
-rw-r--r--include/asm-s390/smp.h12
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-s390/sockios.h3
-rw-r--r--include/asm-s390/system.h4
-rw-r--r--include/asm-s390/tape390.h72
-rw-r--r--include/asm-s390/termios.h18
-rw-r--r--include/asm-s390/timer.h3
-rw-r--r--include/asm-s390/timex.h50
-rw-r--r--include/asm-s390/tlbflush.h9
-rw-r--r--include/asm-s390/uaccess.h2
-rw-r--r--include/asm-s390/unistd.h3
-rw-r--r--include/asm-sh/Kbuild2
-rw-r--r--include/asm-sh/apm.h46
-rw-r--r--include/asm-sh/bigsur/bigsur.h80
-rw-r--r--include/asm-sh/bigsur/io.h35
-rw-r--r--include/asm-sh/bigsur/serial.h24
-rw-r--r--include/asm-sh/bugs.h6
-rw-r--r--include/asm-sh/cache.h3
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h11
-rw-r--r--include/asm-sh/cpu-sh4/dma.h11
-rw-r--r--include/asm-sh/dma-mapping.h4
-rw-r--r--include/asm-sh/ec3104/ec3104.h43
-rw-r--r--include/asm-sh/ec3104/io.h16
-rw-r--r--include/asm-sh/ec3104/keyboard.h15
-rw-r--r--include/asm-sh/ec3104/serial.h20
-rw-r--r--include/asm-sh/hp6xx.h6
-rw-r--r--include/asm-sh/ioctls.h22
-rw-r--r--include/asm-sh/irq.h9
-rw-r--r--include/asm-sh/kgdb.h8
-rw-r--r--include/asm-sh/mmu.h20
-rw-r--r--include/asm-sh/mmu_context.h61
-rw-r--r--include/asm-sh/page.h3
-rw-r--r--include/asm-sh/pgtable.h6
-rw-r--r--include/asm-sh/processor.h6
-rw-r--r--include/asm-sh/rts7751r2d.h4
-rw-r--r--include/asm-sh/serial.h11
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sh/sockios.h3
-rw-r--r--include/asm-sh/string.h3
-rw-r--r--include/asm-sh/system.h1
-rw-r--r--include/asm-sh/termios.h18
-rw-r--r--include/asm-sh/thread_info.h18
-rw-r--r--include/asm-sh/tlbflush.h38
-rw-r--r--include/asm-sh/ubc.h2
-rw-r--r--include/asm-sh/unistd.h21
-rw-r--r--include/asm-sh/voyagergx.h5
-rw-r--r--include/asm-sh64/sockios.h3
-rw-r--r--include/asm-sh64/termios.h18
-rw-r--r--include/asm-sparc/a.out.h2
-rw-r--r--include/asm-sparc/checksum.h2
-rw-r--r--include/asm-sparc/dma-mapping.h15
-rw-r--r--include/asm-sparc/io.h29
-rw-r--r--include/asm-sparc/mostek.h2
-rw-r--r--include/asm-sparc/pci.h3
-rw-r--r--include/asm-sparc/prom.h15
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc/sockios.h3
-rw-r--r--include/asm-sparc/termios.h18
-rw-r--r--include/asm-sparc/unistd.h16
-rw-r--r--include/asm-sparc64/a.out.h2
-rw-r--r--include/asm-sparc64/cpudata.h4
-rw-r--r--include/asm-sparc64/device.h18
-rw-r--r--include/asm-sparc64/dma.h15
-rw-r--r--include/asm-sparc64/ebus.h2
-rw-r--r--include/asm-sparc64/floppy.h15
-rw-r--r--include/asm-sparc64/io.h8
-rw-r--r--include/asm-sparc64/iommu.h51
-rw-r--r--include/asm-sparc64/irq.h4
-rw-r--r--include/asm-sparc64/isa.h2
-rw-r--r--include/asm-sparc64/mostek.h2
-rw-r--r--include/asm-sparc64/parport.h35
-rw-r--r--include/asm-sparc64/pbm.h154
-rw-r--r--include/asm-sparc64/pci.h5
-rw-r--r--include/asm-sparc64/pgtable.h16
-rw-r--r--include/asm-sparc64/prom.h13
-rw-r--r--include/asm-sparc64/setup.h2
-rw-r--r--include/asm-sparc64/smp.h4
-rw-r--r--include/asm-sparc64/socket.h2
-rw-r--r--include/asm-sparc64/sockios.h3
-rw-r--r--include/asm-sparc64/sparsemem.h2
-rw-r--r--include/asm-sparc64/termios.h18
-rw-r--r--include/asm-sparc64/timer.h17
-rw-r--r--include/asm-sparc64/tsb.h2
-rw-r--r--include/asm-sparc64/ttable.h27
-rw-r--r--include/asm-sparc64/unistd.h17
-rw-r--r--include/asm-um/common.lds.S1
-rw-r--r--include/asm-um/delay.h17
-rw-r--r--include/asm-um/div64.h1
-rw-r--r--include/asm-um/elf-ppc.h2
-rw-r--r--include/asm-um/pgtable-2level.h8
-rw-r--r--include/asm-um/pgtable.h11
-rw-r--r--include/asm-um/processor-x86_64.h6
-rw-r--r--include/asm-um/ptrace-x86_64.h9
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-v850/sockios.h3
-rw-r--r--include/asm-v850/termios.h18
-rw-r--r--include/asm-x86_64/acpi.h24
-rw-r--r--include/asm-x86_64/apic.h1
-rw-r--r--include/asm-x86_64/bitops.h2
-rw-r--r--include/asm-x86_64/bootsetup.h2
-rw-r--r--include/asm-x86_64/dma-mapping.h6
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/asm-x86_64/hpet.h7
-rw-r--r--include/asm-x86_64/hw_irq.h29
-rw-r--r--include/asm-x86_64/io.h8
-rw-r--r--include/asm-x86_64/io_apic.h15
-rw-r--r--include/asm-x86_64/mce.h2
-rw-r--r--include/asm-x86_64/mmzone.h18
-rw-r--r--include/asm-x86_64/msr.h13
-rw-r--r--include/asm-x86_64/mutex.h6
-rw-r--r--include/asm-x86_64/pgalloc.h5
-rw-r--r--include/asm-x86_64/pgtable.h9
-rw-r--r--include/asm-x86_64/proto.h9
-rw-r--r--include/asm-x86_64/setup.h2
-rw-r--r--include/asm-x86_64/smp.h3
-rw-r--r--include/asm-x86_64/socket.h2
-rw-r--r--include/asm-x86_64/sockios.h3
-rw-r--r--include/asm-x86_64/swiotlb.h7
-rw-r--r--include/asm-x86_64/termios.h18
-rw-r--r--include/asm-x86_64/timex.h35
-rw-r--r--include/asm-x86_64/topology.h1
-rw-r--r--include/asm-x86_64/tsc.h1
-rw-r--r--include/asm-x86_64/uaccess.h18
-rw-r--r--include/asm-x86_64/vsyscall.h34
-rw-r--r--include/asm-xtensa/div64.h6
-rw-r--r--include/asm-xtensa/mman.h1
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/asm-xtensa/sockios.h3
-rw-r--r--include/asm-xtensa/termios.h19
-rw-r--r--include/crypto/algapi.h24
-rw-r--r--include/keys/rxrpc-type.h22
-rw-r--r--include/linux/Kbuild12
-rw-r--r--include/linux/acpi.h341
-rw-r--r--include/linux/acpi_pmtmr.h38
-rw-r--r--include/linux/agp_backend.h5
-rw-r--r--include/linux/apm-emulation.h (renamed from include/asm-arm/apm.h)8
-rw-r--r--include/linux/ata.h34
-rw-r--r--include/linux/atalk.h6
-rw-r--r--include/linux/atmarp.h2
-rw-r--r--include/linux/atmel_pdc.h36
-rw-r--r--include/linux/audit.h10
-rw-r--r--include/linux/auto_fs4.h16
-rw-r--r--include/linux/backing-dev.h1
-rw-r--r--include/linux/backlight.h50
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/buffer_head.h12
-rw-r--r--include/linux/byteorder/Kbuild2
-rw-r--r--include/linux/byteorder/pdp_endian.h88
-rw-r--r--include/linux/byteorder/swabb.h13
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/cdrom.h2
-rw-r--r--include/linux/cfag12864b.h82
-rw-r--r--include/linux/clockchips.h142
-rw-r--r--include/linux/clocksource.h39
-rw-r--r--include/linux/coda_linux.h6
-rw-r--r--include/linux/compat.h19
-rw-r--r--include/linux/compiler-gcc.h7
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/console_struct.h3
-rw-r--r--include/linux/cpu.h16
-rw-r--r--include/linux/cpufreq.h10
-rw-r--r--include/linux/cpumask.h4
-rw-r--r--include/linux/cpuset.h2
-rw-r--r--include/linux/crypto.h148
-rw-r--r--include/linux/dccp.h46
-rw-r--r--include/linux/debugfs.h19
-rw-r--r--include/linux/device.h121
-rw-r--r--include/linux/dma-mapping.h29
-rw-r--r--include/linux/dmapool.h7
-rw-r--r--include/linux/dn.h2
-rw-r--r--include/linux/ds1742rtc.h53
-rw-r--r--include/linux/dvb/audio.h5
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dvb/video.h62
-rw-r--r--include/linux/efi.h2
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/eisa.h10
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/ext3_fs.h10
-rw-r--r--include/linux/ext4_fs.h10
-rw-r--r--include/linux/ext4_fs_extents.h4
-rw-r--r--include/linux/fb.h51
-rw-r--r--include/linux/fib_rules.h15
-rw-r--r--include/linux/fs.h31
-rw-r--r--include/linux/fsl_devices.h39
-rw-r--r--include/linux/genhd.h10
-rw-r--r--include/linux/gfp.h4
-rw-r--r--include/linux/gigaset_dev.h2
-rw-r--r--include/linux/gpio_keys.h17
-rw-r--r--include/linux/hardirq.h9
-rw-r--r--include/linux/hdlc.h7
-rw-r--r--include/linux/hdreg.h8
-rw-r--r--include/linux/hid-debug.h749
-rw-r--r--include/linux/hid.h37
-rw-r--r--include/linux/hrtimer.h266
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/i2c-id.h7
-rw-r--r--include/linux/i2c.h7
-rw-r--r--include/linux/i2o-dev.h5
-rw-r--r--include/linux/icmp.h9
-rw-r--r--include/linux/icmpv6.h9
-rw-r--r--include/linux/ide.h65
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h9
-rw-r--r--include/linux/if_bridge.h3
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_packet.h11
-rw-r--r--include/linux/if_pppox.h12
-rw-r--r--include/linux/if_tr.h2
-rw-r--r--include/linux/if_vlan.h31
-rw-r--r--include/linux/if_wanpipe_common.h58
-rw-r--r--include/linux/igmp.h23
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h3
-rw-r--r--include/linux/init.h7
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/interrupt.h21
-rw-r--r--include/linux/io.h28
-rw-r--r--include/linux/ioport.h21
-rw-r--r--include/linux/ip.h14
-rw-r--r--include/linux/ipc.h9
-rw-r--r--include/linux/ipv6.h17
-rw-r--r--include/linux/irq.h71
-rw-r--r--include/linux/isdn/capiutil.h21
-rw-r--r--include/linux/jffs.h224
-rw-r--r--include/linux/jhash.h2
-rw-r--r--include/linux/jiffies.h222
-rw-r--r--include/linux/kbd_kern.h2
-rw-r--r--include/linux/kdev_t.h1
-rw-r--r--include/linux/kernel.h13
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/kfifo.h6
-rw-r--r--include/linux/kobject.h16
-rw-r--r--include/linux/ks0108.h49
-rw-r--r--include/linux/ktime.h21
-rw-r--r--include/linux/kvm.h53
-rw-r--r--include/linux/kvm_para.h73
-rw-r--r--include/linux/lcd.h45
-rw-r--r--include/linux/libata.h255
-rw-r--r--include/linux/list.h67
-rw-r--r--include/linux/lockdep.h5
-rw-r--r--include/linux/log2.h13
-rw-r--r--include/linux/magic.h2
-rw-r--r--include/linux/mc146818rtc.h10
-rw-r--r--include/linux/migrate.h8
-rw-r--r--include/linux/minix_fs.h24
-rw-r--r--include/linux/mm.h23
-rw-r--r--include/linux/mm_inline.h13
-rw-r--r--include/linux/mmc/card.h3
-rw-r--r--include/linux/mmc/host.h18
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/mmc/protocol.h13
-rw-r--r--include/linux/mmzone.h42
-rw-r--r--include/linux/mod_devicetable.h12
-rw-r--r--include/linux/module.h56
-rw-r--r--include/linux/moduleparam.h14
-rw-r--r--include/linux/mount.h10
-rw-r--r--include/linux/msdos_fs.h6
-rw-r--r--include/linux/msi.h13
-rw-r--r--include/linux/mtd/bbm.h7
-rw-r--r--include/linux/mtd/iflash.h98
-rw-r--r--include/linux/mtd/map.h2
-rw-r--r--include/linux/mtd/mtd.h18
-rw-r--r--include/linux/mtd/nand.h2
-rw-r--r--include/linux/mtd/onenand.h20
-rw-r--r--include/linux/mtd/onenand_regs.h7
-rw-r--r--include/linux/mtd/physmap.h3
-rw-r--r--include/linux/mtd/ubi.h202
-rw-r--r--include/linux/mv643xx.h3
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/ncp_fs.h4
-rw-r--r--include/linux/ncp_fs_sb.h2
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h23
-rw-r--r--include/linux/netfilter.h16
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_sane.h21
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h19
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter/xt_TCPMSS.h10
-rw-r--r--include/linux/netfilter_bridge.h11
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild14
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h396
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_amanda.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h61
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h44
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h89
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h46
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_icmp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_irc.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h326
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h114
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h98
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sctp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h146
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h78
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h18
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h33
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h74
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h28
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h22
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h2
-rw-r--r--include/linux/netfilter_ipv4/ipt_TCPMSS.h7
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h35
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mh.h15
-rw-r--r--include/linux/netlink.h34
-rw-r--r--include/linux/nfs4.h3
-rw-r--r--include/linux/nfs4_acl.h9
-rw-r--r--include/linux/nfs_fs.h32
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_page.h31
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsd/const.h4
-rw-r--r--include/linux/nfsd/export.h7
-rw-r--r--include/linux/nfsd/nfsd.h12
-rw-r--r--include/linux/nfsd/nfsfh.h99
-rw-r--r--include/linux/nl80211.h38
-rw-r--r--include/linux/nmi.h9
-rw-r--r--include/linux/nodemask.h4
-rw-r--r--include/linux/page-flags.h6
-rw-r--r--include/linux/pagemap.h2
-rw-r--r--include/linux/pci.h53
-rw-r--r--include/linux/pci_ids.h34
-rw-r--r--include/linux/pci_regs.h8
-rw-r--r--include/linux/pfkeyv2.h4
-rw-r--r--include/linux/phonedev.h2
-rw-r--r--include/linux/phy.h1
-rw-r--r--include/linux/pid.h14
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pipe_fs_i.h4
-rw-r--r--include/linux/plist.h54
-rw-r--r--include/linux/pm.h74
-rw-r--r--include/linux/pmu.h12
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/proc_fs.h6
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/raid/bitmap.h1
-rw-r--r--include/linux/raid/md_k.h1
-rw-r--r--include/linux/random.h2
-rw-r--r--include/linux/reiserfs_fs.h8
-rw-r--r--include/linux/reiserfs_xattr.h24
-rw-r--r--include/linux/relay.h9
-rw-r--r--include/linux/rio.h1
-rw-r--r--include/linux/rtnetlink.h13
-rw-r--r--include/linux/rxrpc.h62
-rw-r--r--include/linux/sched.h51
-rw-r--r--include/linux/sctp.h9
-rw-r--r--include/linux/sdla_fr.h638
-rw-r--r--include/linux/security.h12
-rw-r--r--include/linux/seqlock.h10
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/serial_ip3106.h81
-rw-r--r--include/linux/serial_pnx8xxx.h81
-rw-r--r--include/linux/serio.h11
-rw-r--r--include/linux/shm.h5
-rw-r--r--include/linux/skbuff.h412
-rw-r--r--include/linux/slab_def.h30
-rw-r--r--include/linux/sm501-regs.h357
-rw-r--r--include/linux/sm501.h170
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h7
-rw-r--r--include/linux/sony-laptop.h34
-rw-r--r--include/linux/spi/ads7846.h12
-rw-r--r--include/linux/spi/eeprom.h22
-rw-r--r--include/linux/spi/spi.h37
-rw-r--r--include/linux/spi/spi_bitbang.h3
-rw-r--r--include/linux/spinlock.h70
-rw-r--r--include/linux/string.h6
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/debug.h1
-rw-r--r--include/linux/sunrpc/sched.h14
-rw-r--r--include/linux/sunrpc/svc.h43
-rw-r--r--include/linux/sunrpc/svcsock.h14
-rw-r--r--include/linux/svga.h124
-rw-r--r--include/linux/swap.h6
-rw-r--r--include/linux/swapops.h5
-rw-r--r--include/linux/sysctl.h35
-rw-r--r--include/linux/sysdev.h12
-rw-r--r--include/linux/sysfs.h63
-rw-r--r--include/linux/taskstats.h13
-rw-r--r--include/linux/tc.h141
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/tick.h109
-rw-r--r--include/linux/tifm.h35
-rw-r--r--include/linux/time.h7
-rw-r--r--include/linux/timer.h66
-rw-r--r--include/linux/timex.h11
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/toshiba.h2
-rw-r--r--include/linux/tty.h30
-rw-r--r--include/linux/udp.h9
-rw-r--r--include/linux/ufs_fs.h56
-rw-r--r--include/linux/ufs_fs_i.h3
-rw-r--r--include/linux/ufs_fs_sb.h1
-rw-r--r--include/linux/usb.h63
-rw-r--r--include/linux/usb/Kbuild5
-rw-r--r--include/linux/usb/cdc.h18
-rw-r--r--include/linux/usb/ch9.h (renamed from include/linux/usb_ch9.h)58
-rw-r--r--include/linux/usb/iowarrior.h33
-rw-r--r--include/linux/usb/quirks.h11
-rw-r--r--include/linux/usb/serial.h11
-rw-r--r--include/linux/usb_gadgetfs.h2
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/usbdevice_fs.h4
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/video_output.h42
-rw-r--r--include/linux/videodev2.h211
-rw-r--r--include/linux/vmstat.h72
-rw-r--r--include/linux/vt_kern.h1
-rw-r--r--include/linux/wanrouter.h8
-rw-r--r--include/linux/wireless.h27
-rw-r--r--include/linux/workqueue.h7
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xattr.h8
-rw-r--r--include/linux/xfrm.h79
-rw-r--r--include/media/cx2341x.h10
-rw-r--r--include/media/ir-common.h46
-rw-r--r--include/media/ivtv.h65
-rw-r--r--include/media/saa7115.h3
-rw-r--r--include/media/saa7146_vv.h3
-rw-r--r--include/media/tuner.h5
-rw-r--r--include/media/v4l2-chip-ident.h149
-rw-r--r--include/media/v4l2-common.h69
-rw-r--r--include/media/v4l2-dev.h25
-rw-r--r--include/media/video-buf.h3
-rw-r--r--include/mtd/Kbuild2
-rw-r--r--include/mtd/mtd-abi.h9
-rw-r--r--include/mtd/ubi-header.h360
-rw-r--r--include/mtd/ubi-user.h161
-rw-r--r--include/net/addrconf.h4
-rw-r--r--include/net/af_rxrpc.h57
-rw-r--r--include/net/ax25.h6
-rw-r--r--include/net/bluetooth/hci.h18
-rw-r--r--include/net/cfg80211.h40
-rw-r--r--include/net/cipso_ipv4.h2
-rw-r--r--include/net/compat.h1
-rw-r--r--include/net/dn_fib.h9
-rw-r--r--include/net/dn_route.h6
-rw-r--r--include/net/dst.h15
-rw-r--r--include/net/esp.h2
-rw-r--r--include/net/fib_rules.h21
-rw-r--r--include/net/flow.h6
-rw-r--r--include/net/ieee80211.h4
-rw-r--r--include/net/ieee80211_crypt.h4
-rw-r--r--include/net/ieee80211_radiotap.h77
-rw-r--r--include/net/inet6_hashtables.h12
-rw-r--r--include/net/inet_ecn.h8
-rw-r--r--include/net/inet_hashtables.h10
-rw-r--r--include/net/inet_sock.h11
-rw-r--r--include/net/inet_timewait_sock.h2
-rw-r--r--include/net/ip.h11
-rw-r--r--include/net/ip6_fib.h4
-rw-r--r--include/net/ip6_route.h5
-rw-r--r--include/net/ip_fib.h6
-rw-r--r--include/net/ipv6.h19
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/irda/irda.h16
-rw-r--r--include/net/iucv/af_iucv.h106
-rw-r--r--include/net/iucv/iucv.h415
-rw-r--r--include/net/iw_handler.h51
-rw-r--r--include/net/llc_pdu.h15
-rw-r--r--include/net/neighbour.h12
-rw-r--r--include/net/netfilter/nf_conntrack.h13
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h145
-rw-r--r--include/net/netfilter/nf_conntrack_core.h5
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h30
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h9
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h3
-rw-r--r--include/net/netfilter/nf_nat.h1
-rw-r--r--include/net/netfilter/nf_nat_rule.h10
-rw-r--r--include/net/netlink.h18
-rw-r--r--include/net/netrom.h4
-rw-r--r--include/net/pkt_cls.h17
-rw-r--r--include/net/pkt_sched.h182
-rw-r--r--include/net/red.h10
-rw-r--r--include/net/rose.h6
-rw-r--r--include/net/route.h12
-rw-r--r--include/net/rtnetlink.h25
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--include/net/sctp/constants.h2
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sctp/ulpevent.h1
-rw-r--r--include/net/sctp/ulpqueue.h3
-rw-r--r--include/net/sctp/user.h25
-rw-r--r--include/net/sock.h91
-rw-r--r--include/net/tcp.h204
-rw-r--r--include/net/tcp_ecn.h17
-rw-r--r--include/net/udp.h11
-rw-r--r--include/net/udplite.h45
-rw-r--r--include/net/wext.h24
-rw-r--r--include/net/wireless.h139
-rw-r--r--include/net/x25.h18
-rw-r--r--include/net/x25device.h2
-rw-r--r--include/net/xfrm.h93
-rw-r--r--include/pcmcia/ciscode.h1
-rw-r--r--include/pcmcia/ss.h2
-rw-r--r--include/rdma/ib_addr.h6
-rw-r--r--include/rdma/ib_sa.h159
-rw-r--r--include/rdma/ib_user_mad.h2
-rw-r--r--include/rdma/ib_verbs.h3
-rw-r--r--include/rdma/rdma_cm.h21
-rw-r--r--include/rdma/rdma_cm_ib.h4
-rw-r--r--include/rdma/rdma_user_cm.h13
-rw-r--r--include/rxrpc/call.h212
-rw-r--r--include/rxrpc/connection.h83
-rw-r--r--include/rxrpc/krxiod.h27
-rw-r--r--include/rxrpc/krxsecd.h22
-rw-r--r--include/rxrpc/krxtimod.h45
-rw-r--r--include/rxrpc/message.h71
-rw-r--r--include/rxrpc/packet.h119
-rw-r--r--include/rxrpc/peer.h82
-rw-r--r--include/rxrpc/rxrpc.h36
-rw-r--r--include/rxrpc/transport.h106
-rw-r--r--include/scsi/iscsi_proto.h46
-rw-r--r--include/scsi/libsas.h22
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_tgt_if.h3
-rw-r--r--include/scsi/scsi_transport.h1
-rw-r--r--include/scsi/scsi_transport_sas.h3
-rw-r--r--include/scsi/scsi_transport_spi.h1
-rw-r--r--include/sound/ac97_codec.h4
-rw-r--r--include/sound/ad1848.h2
-rw-r--r--include/sound/ak4114.h3
-rw-r--r--include/sound/ak4117.h2
-rw-r--r--include/sound/ak4xxx-adda.h6
-rw-r--r--include/sound/control.h5
-rw-r--r--include/sound/core.h80
-rw-r--r--include/sound/emu10k1.h418
-rw-r--r--include/sound/pcm.h6
-rw-r--r--include/sound/pt2258.h37
-rw-r--r--include/sound/sb16_csp.h14
-rw-r--r--include/sound/snd_wavefront.h2
-rw-r--r--include/sound/soc-dapm.h286
-rw-r--r--include/sound/soc.h461
-rw-r--r--include/sound/typedefs.h173
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/vx_core.h2
-rw-r--r--include/sound/ymfpci.h6
-rw-r--r--include/video/neomagic.h3
-rw-r--r--include/video/s3blit.h79
1233 files changed, 21157 insertions, 14514 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index ebc1f697615a..422f29c06c77 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -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 0x20060707 66#define ACPI_CA_VERSION 0x20070126
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,
@@ -115,6 +115,10 @@
115 115
116#define ACPI_NUM_OWNERID_MASKS 8 116#define ACPI_NUM_OWNERID_MASKS 8
117 117
118/* Size of the root table array is increased by this increment */
119
120#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
121
118/****************************************************************************** 122/******************************************************************************
119 * 123 *
120 * ACPI Specification constants (Do not change unless the specification changes) 124 * ACPI Specification constants (Do not change unless the specification changes)
@@ -152,6 +156,11 @@
152#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ 156#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
153#define ACPI_PATH_SEPARATOR '.' 157#define ACPI_PATH_SEPARATOR '.'
154 158
159/* Sizes for ACPI table headers */
160
161#define ACPI_OEM_ID_SIZE 6
162#define ACPI_OEM_TABLE_ID_SIZE 8
163
155/* Constants used in searching for the RSDP in low memory */ 164/* Constants used in searching for the RSDP in low memory */
156 165
157#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ 166#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index d8167095caf3..d626bb1d2973 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -159,6 +159,10 @@ void
159acpi_db_create_execution_threads(char *num_threads_arg, 159acpi_db_create_execution_threads(char *num_threads_arg,
160 char *num_loops_arg, char *method_name_arg); 160 char *num_loops_arg, char *method_name_arg);
161 161
162#ifdef ACPI_DBG_TRACK_ALLOCATIONS
163u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
164#endif
165
162/* 166/*
163 * dbfileio - Debugger file I/O commands 167 * dbfileio - Debugger file I/O commands
164 */ 168 */
@@ -214,4 +218,6 @@ void acpi_db_prep_namestring(char *name);
214 218
215struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name); 219struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
216 220
221void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
222
217#endif /* __ACDEBUG_H__ */ 223#endif /* __ACDEBUG_H__ */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index 9a7d6921f534..389d772c7d5b 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -97,9 +97,11 @@ typedef const struct acpi_dmtable_info {
97#define ACPI_DMT_CHKSUM 20 97#define ACPI_DMT_CHKSUM 20
98#define ACPI_DMT_SPACEID 21 98#define ACPI_DMT_SPACEID 21
99#define ACPI_DMT_GAS 22 99#define ACPI_DMT_GAS 22
100#define ACPI_DMT_MADT 23 100#define ACPI_DMT_DMAR 23
101#define ACPI_DMT_SRAT 24 101#define ACPI_DMT_MADT 24
102#define ACPI_DMT_EXIT 25 102#define ACPI_DMT_SRAT 25
103#define ACPI_DMT_EXIT 26
104#define ACPI_DMT_SIG 27
103 105
104typedef 106typedef
105void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); 107void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table);
@@ -108,6 +110,7 @@ struct acpi_dmtable_data {
108 char *signature; 110 char *signature;
109 struct acpi_dmtable_info *table_info; 111 struct acpi_dmtable_info *table_info;
110 ACPI_TABLE_HANDLER table_handler; 112 ACPI_TABLE_HANDLER table_handler;
113 char *name;
111}; 114};
112 115
113struct acpi_op_walk_info { 116struct acpi_op_walk_info {
@@ -139,7 +142,9 @@ extern const char *acpi_gbl_match_ops[];
139 142
140extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; 143extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
141extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; 144extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
145extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];
142extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; 146extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
147extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];
143extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; 148extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
144extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; 149extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
145extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; 150extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
@@ -147,6 +152,11 @@ extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
147extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; 152extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
148extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; 153extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
149extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; 154extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
155extern struct acpi_dmtable_info acpi_dm_table_info_dmar[];
156extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[];
157extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[];
158extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[];
159extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];
150extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; 160extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
151extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; 161extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
152extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; 162extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
@@ -201,6 +211,8 @@ void acpi_dm_dump_asf(struct acpi_table_header *table);
201 211
202void acpi_dm_dump_cpep(struct acpi_table_header *table); 212void acpi_dm_dump_cpep(struct acpi_table_header *table);
203 213
214void acpi_dm_dump_dmar(struct acpi_table_header *table);
215
204void acpi_dm_dump_fadt(struct acpi_table_header *table); 216void acpi_dm_dump_fadt(struct acpi_table_header *table);
205 217
206void acpi_dm_dump_srat(struct acpi_table_header *table); 218void acpi_dm_dump_srat(struct acpi_table_header *table);
@@ -314,7 +326,7 @@ acpi_dm_resource_template(struct acpi_op_walk_info *info,
314 union acpi_parse_object *op, 326 union acpi_parse_object *op,
315 u8 * byte_data, u32 byte_count); 327 u8 * byte_data, u32 byte_count);
316 328
317u8 acpi_dm_is_resource_template(union acpi_parse_object *op); 329acpi_status acpi_dm_is_resource_template(union acpi_parse_object *op);
318 330
319void acpi_dm_indent(u32 level); 331void acpi_dm_indent(u32 level);
320 332
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index a22fe9cf8493..cb8d2868c8ac 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -210,7 +210,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
210 * dsinit 210 * dsinit
211 */ 211 */
212acpi_status 212acpi_status
213acpi_ds_initialize_objects(struct acpi_table_desc *table_desc, 213acpi_ds_initialize_objects(acpi_native_uint table_index,
214 struct acpi_namespace_node *start_node); 214 struct acpi_namespace_node *start_node);
215 215
216/* 216/*
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h
index 234142828e1a..d23cdf326808 100644
--- a/include/acpi/acevents.h
+++ b/include/acpi/acevents.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 797ca1ea5214..b73f18a48785 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -178,8 +178,10 @@
178#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL) 178#define AE_CTRL_BREAK (acpi_status) (0x0009 | AE_CODE_CONTROL)
179#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL) 179#define AE_CTRL_CONTINUE (acpi_status) (0x000A | AE_CODE_CONTROL)
180#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL) 180#define AE_CTRL_SKIP (acpi_status) (0x000B | AE_CODE_CONTROL)
181#define AE_CTRL_PARSE_CONTINUE (acpi_status) (0x000C | AE_CODE_CONTROL)
182#define AE_CTRL_PARSE_PENDING (acpi_status) (0x000D | AE_CODE_CONTROL)
181 183
182#define AE_CODE_CTRL_MAX 0x000B 184#define AE_CODE_CTRL_MAX 0x000D
183 185
184#ifdef DEFINE_ACPI_GLOBALS 186#ifdef DEFINE_ACPI_GLOBALS
185 187
@@ -291,7 +293,9 @@ char const *acpi_gbl_exception_names_ctrl[] = {
291 "AE_CTRL_TRANSFER", 293 "AE_CTRL_TRANSFER",
292 "AE_CTRL_BREAK", 294 "AE_CTRL_BREAK",
293 "AE_CTRL_CONTINUE", 295 "AE_CTRL_CONTINUE",
294 "AE_CTRL_SKIP" 296 "AE_CTRL_SKIP",
297 "AE_CTRL_PARSE_CONTINUE",
298 "AE_CTRL_PARSE_PENDING"
295}; 299};
296 300
297#endif /* ACPI GLOBALS */ 301#endif /* ACPI GLOBALS */
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 06972e6637de..24c3f05ab367 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -58,37 +58,6 @@
58#define ACPI_INIT_GLOBAL(a,b) a 58#define ACPI_INIT_GLOBAL(a,b) a
59#endif 59#endif
60 60
61/*
62 * Keep local copies of these FADT-based registers. NOTE: These globals
63 * are first in this file for alignment reasons on 64-bit systems.
64 */
65ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
66ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
67
68/*****************************************************************************
69 *
70 * Debug support
71 *
72 ****************************************************************************/
73
74/* Runtime configuration of debug print levels */
75
76extern u32 acpi_dbg_level;
77extern u32 acpi_dbg_layer;
78
79/* Procedure nesting level for debug output */
80
81extern u32 acpi_gbl_nesting_level;
82
83/* Support for dynamic control method tracing mechanism */
84
85ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
86ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
87ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
88ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
89ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
90ACPI_EXTERN u32 acpi_gbl_trace_flags;
91
92/***************************************************************************** 61/*****************************************************************************
93 * 62 *
94 * Runtime configuration (static defaults that can be overriden at runtime) 63 * Runtime configuration (static defaults that can be overriden at runtime)
@@ -135,52 +104,62 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE);
135 104
136/***************************************************************************** 105/*****************************************************************************
137 * 106 *
107 * Debug support
108 *
109 ****************************************************************************/
110
111/* Runtime configuration of debug print levels */
112
113extern u32 acpi_dbg_level;
114extern u32 acpi_dbg_layer;
115
116/* Procedure nesting level for debug output */
117
118extern u32 acpi_gbl_nesting_level;
119
120/* Event counters */
121
122ACPI_EXTERN u32 acpi_gpe_count;
123
124/* Support for dynamic control method tracing mechanism */
125
126ACPI_EXTERN u32 acpi_gbl_original_dbg_level;
127ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;
128ACPI_EXTERN acpi_name acpi_gbl_trace_method_name;
129ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;
130ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;
131ACPI_EXTERN u32 acpi_gbl_trace_flags;
132
133/*****************************************************************************
134 *
138 * ACPI Table globals 135 * ACPI Table globals
139 * 136 *
140 ****************************************************************************/ 137 ****************************************************************************/
141 138
142/* 139/*
143 * Table pointers. 140 * acpi_gbl_root_table_list is the master list of ACPI tables found in the
144 * Although these pointers are somewhat redundant with the global acpi_table, 141 * RSDT/XSDT.
145 * they are convenient because they are typed pointers.
146 * 142 *
147 * These tables are single-table only; meaning that there can be at most one 143 * acpi_gbl_FADT is a local copy of the FADT, converted to a common format.
148 * of each in the system. Each global points to the actual table.
149 */
150ACPI_EXTERN u32 acpi_gbl_table_flags;
151ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
152ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP;
153ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT;
154ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT;
155ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;
156ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS;
157ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS;
158/*
159 * Since there may be multiple SSDTs and PSDTs, a single pointer is not
160 * sufficient; Therefore, there isn't one!
161 */ 144 */
145ACPI_EXTERN struct acpi_internal_rsdt acpi_gbl_root_table_list;
146ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT;
147extern acpi_native_uint acpi_gbl_permanent_mmap;
162 148
163/* The root table can be either an RSDT or an XSDT */ 149/* These addresses are calculated from FADT address values */
164 150
165ACPI_EXTERN u8 acpi_gbl_root_table_type; 151ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;
166#define ACPI_TABLE_TYPE_RSDT 'R' 152ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;
167#define ACPI_TABLE_TYPE_XSDT 'X'
168 153
169/* 154/*
170 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths: 155 * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
171 * If we are executing a method that exists in a 32-bit ACPI table, 156 * determined by the revision of the DSDT: If the DSDT revision is less than
172 * use only the lower 32 bits of the (internal) 64-bit Integer. 157 * 2, use only the lower 32 bits of the internal 64-bit Integer.
173 */ 158 */
174ACPI_EXTERN u8 acpi_gbl_integer_bit_width; 159ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
175ACPI_EXTERN u8 acpi_gbl_integer_byte_width; 160ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
176ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; 161ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
177 162
178/*
179 * ACPI Table info arrays
180 */
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];
183
184/***************************************************************************** 163/*****************************************************************************
185 * 164 *
186 * Mutual exlusion within ACPICA subsystem 165 * Mutual exlusion within ACPICA subsystem
@@ -188,7 +167,7 @@ extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1];
188 ****************************************************************************/ 167 ****************************************************************************/
189 168
190/* 169/*
191 * Predefined mutex objects. This array contains the 170 * Predefined mutex objects. This array contains the
192 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. 171 * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
193 * (The table maps local handles to the real OS handles) 172 * (The table maps local handles to the real OS handles)
194 */ 173 */
@@ -197,6 +176,7 @@ ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];
197/* 176/*
198 * Global lock semaphore works in conjunction with the actual HW global lock 177 * Global lock semaphore works in conjunction with the actual HW global lock
199 */ 178 */
179ACPI_EXTERN acpi_mutex acpi_gbl_global_lock_mutex;
200ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore; 180ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;
201 181
202/* 182/*
@@ -220,6 +200,7 @@ ACPI_EXTERN spinlock_t _acpi_gbl_hardware_lock; /* For ACPI H/W except GPE regis
220 200
221ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list; 201ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
222ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; 202ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
203ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
223#endif 204#endif
224 205
225/* Object caches */ 206/* Object caches */
@@ -240,7 +221,6 @@ ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
240 221
241/* Misc */ 222/* Misc */
242 223
243ACPI_EXTERN u32 acpi_gbl_global_lock_thread_count;
244ACPI_EXTERN u32 acpi_gbl_original_mode; 224ACPI_EXTERN u32 acpi_gbl_original_mode;
245ACPI_EXTERN u32 acpi_gbl_rsdp_original_location; 225ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;
246ACPI_EXTERN u32 acpi_gbl_ns_lookup_count; 226ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;
@@ -260,12 +240,19 @@ ACPI_EXTERN u8 acpi_gbl_system_awake_and_running;
260 240
261extern u8 acpi_gbl_shutdown; 241extern u8 acpi_gbl_shutdown;
262extern u32 acpi_gbl_startup_flags; 242extern u32 acpi_gbl_startup_flags;
263extern const u8 acpi_gbl_decode_to8bit[8];
264extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; 243extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
265extern const char *acpi_gbl_highest_dstate_names[4]; 244extern const char *acpi_gbl_highest_dstate_names[4];
266extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 245extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
267extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 246extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
268 247
248/* Exception codes */
249
250extern char const *acpi_gbl_exception_names_env[];
251extern char const *acpi_gbl_exception_names_pgm[];
252extern char const *acpi_gbl_exception_names_tbl[];
253extern char const *acpi_gbl_exception_names_aml[];
254extern char const *acpi_gbl_exception_names_ctrl[];
255
269/***************************************************************************** 256/*****************************************************************************
270 * 257 *
271 * Namespace globals 258 * Namespace globals
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 29b60a8c0593..9df275cf7bc1 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -61,8 +61,6 @@
61/* 61/*
62 * hwacpi - high level functions 62 * hwacpi - high level functions
63 */ 63 */
64acpi_status acpi_hw_initialize(void);
65
66acpi_status acpi_hw_set_mode(u32 mode); 64acpi_status acpi_hw_set_mode(u32 mode);
67 65
68u32 acpi_hw_get_mode(void); 66u32 acpi_hw_get_mode(void);
@@ -84,7 +82,7 @@ acpi_hw_low_level_read(u32 width,
84acpi_status 82acpi_status
85acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg); 83acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address *reg);
86 84
87acpi_status acpi_hw_clear_acpi_status(u32 flags); 85acpi_status acpi_hw_clear_acpi_status(void);
88 86
89/* 87/*
90 * hwgpe - GPE support 88 * hwgpe - GPE support
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index 91586d0d5bb5..440983019993 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -253,7 +253,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
253 253
254void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread); 254void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
255 255
256void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc); 256void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc,
257 struct acpi_thread_state *thread);
257 258
258/* 259/*
259 * exprep - ACPI AML execution - prep utilities 260 * exprep - ACPI AML execution - prep utilities
@@ -277,12 +278,6 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer time);
277 278
278acpi_status acpi_ex_system_do_stall(u32 time); 279acpi_status acpi_ex_system_do_stall(u32 time);
279 280
280acpi_status
281acpi_ex_system_acquire_mutex(union acpi_operand_object *time,
282 union acpi_operand_object *obj_desc);
283
284acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc);
285
286acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc); 281acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
287 282
288acpi_status 283acpi_status
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index 063c4b54290f..6f83ddbed3af 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -80,8 +80,8 @@ union acpi_parse_object;
80 * table below also! 80 * table below also!
81 */ 81 */
82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ 82#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
83#define ACPI_MTX_TABLES 1 /* Data for ACPI tables */ 83#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
84#define ACPI_MTX_NAMESPACE 2 /* ACPI Namespace */ 84#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ 85#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ 86#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ 87#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
@@ -162,7 +162,7 @@ struct acpi_mutex_info {
162typedef enum { 162typedef enum {
163 ACPI_IMODE_LOAD_PASS1 = 0x01, 163 ACPI_IMODE_LOAD_PASS1 = 0x01,
164 ACPI_IMODE_LOAD_PASS2 = 0x02, 164 ACPI_IMODE_LOAD_PASS2 = 0x02,
165 ACPI_IMODE_EXECUTE = 0x0E 165 ACPI_IMODE_EXECUTE = 0x03
166} acpi_interpreter_mode; 166} acpi_interpreter_mode;
167 167
168union acpi_name_union { 168union acpi_name_union {
@@ -204,7 +204,7 @@ struct acpi_namespace_node {
204/* Namespace Node flags */ 204/* Namespace Node flags */
205 205
206#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 */
207#define ANOBJ_RESERVED 0x02 /* Available for future use */ 207#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
208#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 208#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
209#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 209#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
210#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ 210#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
@@ -219,25 +219,42 @@ struct acpi_namespace_node {
219 * ACPI Table Descriptor. One per ACPI table 219 * ACPI Table Descriptor. One per ACPI table
220 */ 220 */
221struct acpi_table_desc { 221struct acpi_table_desc {
222 struct acpi_table_desc *prev; 222 acpi_physical_address address;
223 struct acpi_table_desc *next;
224 struct acpi_table_desc *installed_desc;
225 struct acpi_table_header *pointer; 223 struct acpi_table_header *pointer;
226 u8 *aml_start; 224 u32 length; /* Length fixed at 32 bits */
227 u64 physical_address; 225 union acpi_name_union signature;
228 acpi_size length;
229 u32 aml_length;
230 acpi_owner_id owner_id; 226 acpi_owner_id owner_id;
231 u8 type; 227 u8 flags;
232 u8 allocation;
233 u8 loaded_into_namespace;
234}; 228};
235 229
236struct acpi_table_list { 230/* Flags for above */
237 struct acpi_table_desc *next; 231
232#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
233#define ACPI_TABLE_ORIGIN_MAPPED (1)
234#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
235#define ACPI_TABLE_ORIGIN_MASK (3)
236#define ACPI_TABLE_IS_LOADED (4)
237
238/* One internal RSDT for table management */
239
240struct acpi_internal_rsdt {
241 struct acpi_table_desc *tables;
238 u32 count; 242 u32 count;
243 u32 size;
244 u8 flags;
239}; 245};
240 246
247/* Flags for above */
248
249#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
250#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
251#define ACPI_ROOT_ALLOW_RESIZE (2)
252
253/* Predefined (fixed) table indexes */
254
255#define ACPI_TABLE_INDEX_DSDT (0)
256#define ACPI_TABLE_INDEX_FACS (1)
257
241struct acpi_find_context { 258struct acpi_find_context {
242 char *search_for; 259 char *search_for;
243 acpi_handle *list; 260 acpi_handle *list;
@@ -350,7 +367,7 @@ struct acpi_gpe_event_info {
350 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 367 union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */
351 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 368 struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
352 u8 flags; /* Misc info about this GPE */ 369 u8 flags; /* Misc info about this GPE */
353 u8 register_bit; /* This GPE bit within the register */ 370 u8 gpe_number; /* This GPE */
354}; 371};
355 372
356/* Information about a GPE register pair, one per each status/enable pair in an array */ 373/* Information about a GPE register pair, one per each status/enable pair in an array */
@@ -855,12 +872,30 @@ struct acpi_bit_register_info {
855 ****************************************************************************/ 872 ****************************************************************************/
856 873
857struct acpi_db_method_info { 874struct acpi_db_method_info {
858 acpi_handle thread_gate; 875 acpi_handle main_thread_gate;
876 acpi_handle thread_complete_gate;
877 u32 *threads;
878 u32 num_threads;
879 u32 num_created;
880 u32 num_completed;
881
859 char *name; 882 char *name;
860 char **args;
861 u32 flags; 883 u32 flags;
862 u32 num_loops; 884 u32 num_loops;
863 char pathname[128]; 885 char pathname[128];
886 char **args;
887
888 /*
889 * Arguments to be passed to method for the command
890 * Threads -
891 * the Number of threads, ID of current thread and
892 * Index of current thread inside all them created.
893 */
894 char init_args;
895 char *arguments[4];
896 char num_threads_str[11];
897 char id_of_thread_str[11];
898 char index_of_thread_str[11];
864}; 899};
865 900
866struct acpi_integrity_info { 901struct acpi_integrity_info {
@@ -919,6 +954,8 @@ struct acpi_memory_list {
919 954
920 u32 total_allocated; 955 u32 total_allocated;
921 u32 total_freed; 956 u32 total_freed;
957 u32 max_occupied;
958 u32 total_size;
922 u32 current_total_size; 959 u32 current_total_size;
923 u32 requests; 960 u32 requests;
924 u32 hits; 961 u32 hits;
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 192fa095a515..8948a6461834 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -55,25 +55,12 @@
55#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 55#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 56#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) 57#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
58#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
58 59
59/* Size calculation */ 60/* Size calculation */
60 61
61#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) 62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
62 63
63#if ACPI_MACHINE_WIDTH == 16
64
65/*
66 * For 16-bit addresses, we have to assume that the upper 32 bits
67 * (out of 64) are zero.
68 */
69#define ACPI_LODWORD(l) ((u32)(l))
70#define ACPI_HIDWORD(l) ((u32)(0))
71
72#define ACPI_GET_ADDRESS(a) ((a).lo)
73#define ACPI_STORE_ADDRESS(a,b) {(a).hi=0;(a).lo=(u32)(b);}
74#define ACPI_VALID_ADDRESS(a) ((a).hi | (a).lo)
75
76#else
77#ifdef ACPI_NO_INTEGER64_SUPPORT 64#ifdef ACPI_NO_INTEGER64_SUPPORT
78/* 65/*
79 * acpi_integer is 32-bits, no 64-bit support on this platform 66 * acpi_integer is 32-bits, no 64-bit support on this platform
@@ -81,10 +68,6 @@
81#define ACPI_LODWORD(l) ((u32)(l)) 68#define ACPI_LODWORD(l) ((u32)(l))
82#define ACPI_HIDWORD(l) ((u32)(0)) 69#define ACPI_HIDWORD(l) ((u32)(0))
83 70
84#define ACPI_GET_ADDRESS(a) (a)
85#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
86#define ACPI_VALID_ADDRESS(a) (a)
87
88#else 71#else
89 72
90/* 73/*
@@ -92,11 +75,6 @@
92 */ 75 */
93#define ACPI_LODWORD(l) ((u32)(u64)(l)) 76#define ACPI_LODWORD(l) ((u32)(u64)(l))
94#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi)) 77#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi))
95
96#define ACPI_GET_ADDRESS(a) (a)
97#define ACPI_STORE_ADDRESS(a,b) ((a)=(acpi_physical_address)(b))
98#define ACPI_VALID_ADDRESS(a) (a)
99#endif
100#endif 78#endif
101 79
102/* 80/*
@@ -134,15 +112,8 @@
134#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) 112#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i)
135#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 113#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
136#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 114#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
137
138#if ACPI_MACHINE_WIDTH == 16
139#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
140#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
141#define ACPI_PTR_TO_PHYSADDR(i) (u32) ACPI_CAST_PTR (u8,(i))
142#else
143#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 115#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
144#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 116#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
145#endif
146 117
147#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 118#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
148#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) 119#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b)))
@@ -223,28 +194,6 @@
223 194
224/* The hardware supports unaligned transfers, just do the little-endian move */ 195/* The hardware supports unaligned transfers, just do the little-endian move */
225 196
226#if ACPI_MACHINE_WIDTH == 16
227
228/* No 64-bit integers */
229/* 16-bit source, 16/32/64 destination */
230
231#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
232#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
233#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
234
235/* 32-bit source, 16/32/64 destination */
236
237#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
238#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
239#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
240
241/* 64-bit source, 16/32/64 destination */
242
243#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
244#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
245#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
246
247#else
248/* 16-bit source, 16/32/64 destination */ 197/* 16-bit source, 16/32/64 destination */
249 198
250#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) 199#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
@@ -262,7 +211,6 @@
262#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 211#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
263#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 212#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
264#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) 213#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
265#endif
266 214
267#else 215#else
268/* 216/*
@@ -307,10 +255,7 @@
307 255
308/* Macros based on machine integer width */ 256/* Macros based on machine integer width */
309 257
310#if ACPI_MACHINE_WIDTH == 16 258#if ACPI_MACHINE_WIDTH == 32
311#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
312
313#elif ACPI_MACHINE_WIDTH == 32
314#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) 259#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
315 260
316#elif ACPI_MACHINE_WIDTH == 64 261#elif ACPI_MACHINE_WIDTH == 64
@@ -695,16 +640,6 @@
695#define ACPI_DEBUGGER_EXEC(a) 640#define ACPI_DEBUGGER_EXEC(a)
696#endif 641#endif
697 642
698/*
699 * For 16-bit code, we want to shrink some things even though
700 * we are using ACPI_DEBUG_OUTPUT to get the debug output
701 */
702#if ACPI_MACHINE_WIDTH == 16
703#undef ACPI_DEBUG_ONLY_MEMBERS
704#undef _VERBOSE_STRUCTURES
705#define ACPI_DEBUG_ONLY_MEMBERS(a)
706#endif
707
708#ifdef ACPI_DEBUG_OUTPUT 643#ifdef ACPI_DEBUG_OUTPUT
709/* 644/*
710 * 1) Set name to blanks 645 * 1) Set name to blanks
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index b67da3636899..34bfae8a05f3 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index 83b52f9f899a..535b7e1c41bc 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -65,9 +65,13 @@
65#define ACPI_NS_ERROR_IF_FOUND 0x08 65#define ACPI_NS_ERROR_IF_FOUND 0x08
66#define ACPI_NS_PREFIX_IS_SCOPE 0x10 66#define ACPI_NS_PREFIX_IS_SCOPE 0x10
67#define ACPI_NS_EXTERNAL 0x20 67#define ACPI_NS_EXTERNAL 0x20
68#define ACPI_NS_TEMPORARY 0x40
68 69
69#define ACPI_NS_WALK_UNLOCK TRUE 70/* Flags for acpi_ns_walk_namespace */
70#define ACPI_NS_WALK_NO_UNLOCK FALSE 71
72#define ACPI_NS_WALK_NO_UNLOCK 0
73#define ACPI_NS_WALK_UNLOCK 0x01
74#define ACPI_NS_WALK_TEMP_NODES 0x02
71 75
72/* 76/*
73 * nsinit - Namespace initialization 77 * nsinit - Namespace initialization
@@ -82,7 +86,7 @@ acpi_status acpi_ns_initialize_devices(void);
82acpi_status acpi_ns_load_namespace(void); 86acpi_status acpi_ns_load_namespace(void);
83 87
84acpi_status 88acpi_status
85acpi_ns_load_table(struct acpi_table_desc *table_desc, 89acpi_ns_load_table(acpi_native_uint table_index,
86 struct acpi_namespace_node *node); 90 struct acpi_namespace_node *node);
87 91
88/* 92/*
@@ -92,7 +96,7 @@ acpi_status
92acpi_ns_walk_namespace(acpi_object_type type, 96acpi_ns_walk_namespace(acpi_object_type type,
93 acpi_handle start_object, 97 acpi_handle start_object,
94 u32 max_depth, 98 u32 max_depth,
95 u8 unlock_before_callback, 99 u32 flags,
96 acpi_walk_callback user_function, 100 acpi_walk_callback user_function,
97 void *context, void **return_value); 101 void *context, void **return_value);
98 102
@@ -106,11 +110,12 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
106 * nsparse - table parsing 110 * nsparse - table parsing
107 */ 111 */
108acpi_status 112acpi_status
109acpi_ns_parse_table(struct acpi_table_desc *table_desc, 113acpi_ns_parse_table(acpi_native_uint table_index,
110 struct acpi_namespace_node *scope); 114 struct acpi_namespace_node *start_node);
111 115
112acpi_status 116acpi_status
113acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc); 117acpi_ns_one_complete_parse(acpi_native_uint pass_number,
118 acpi_native_uint table_index);
114 119
115/* 120/*
116 * nsaccess - Top-level namespace access 121 * nsaccess - Top-level namespace access
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index 8fdee31119f3..5206d61d74a6 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2006, R. Byron Moore 9 * Copyright (C) 2000 - 2007, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -52,7 +52,15 @@
52 * to the interpreter, and to keep track of the various handlers such as 52 * to the interpreter, and to keep track of the various handlers such as
53 * address space handlers and notify handlers. The object is a constant 53 * address space handlers and notify handlers. The object is a constant
54 * size in order to allow it to be cached and reused. 54 * size in order to allow it to be cached and reused.
55 *
56 * Note: The object is optimized to be aligned and will not work if it is
57 * byte-packed.
55 */ 58 */
59#if ACPI_MACHINE_WIDTH == 64
60#pragma pack(8)
61#else
62#pragma pack(4)
63#endif
56 64
57/******************************************************************************* 65/*******************************************************************************
58 * 66 *
@@ -101,7 +109,8 @@ struct acpi_object_common {
101ACPI_OBJECT_COMMON_HEADER}; 109ACPI_OBJECT_COMMON_HEADER};
102 110
103struct acpi_object_integer { 111struct acpi_object_integer {
104 ACPI_OBJECT_COMMON_HEADER acpi_integer value; 112 ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */
113 acpi_integer value;
105}; 114};
106 115
107/* 116/*
@@ -146,7 +155,7 @@ struct acpi_object_event {
146struct acpi_object_mutex { 155struct acpi_object_mutex {
147 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ 156 ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
148 u16 acquisition_depth; /* Allow multiple Acquires, same thread */ 157 u16 acquisition_depth; /* Allow multiple Acquires, same thread */
149 struct acpi_thread_state *owner_thread; /* Current owner of the mutex */ 158 acpi_thread_id owner_thread_id; /* Current owner of the mutex */
150 acpi_mutex os_mutex; /* Actual OS synchronization object */ 159 acpi_mutex os_mutex; /* Actual OS synchronization object */
151 union acpi_operand_object *prev; /* Link for list of acquired mutexes */ 160 union acpi_operand_object *prev; /* Link for list of acquired mutexes */
152 union acpi_operand_object *next; /* Link for list of acquired mutexes */ 161 union acpi_operand_object *next; /* Link for list of acquired mutexes */
@@ -203,7 +212,9 @@ struct acpi_object_power_resource {
203}; 212};
204 213
205struct acpi_object_processor { 214struct acpi_object_processor {
206 ACPI_OBJECT_COMMON_HEADER u8 proc_id; 215 ACPI_OBJECT_COMMON_HEADER
216 /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
217 u8 proc_id;
207 u8 length; 218 u8 length;
208 ACPI_COMMON_NOTIFY_INFO acpi_io_address address; 219 ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
209}; 220};
@@ -406,4 +417,6 @@ union acpi_descriptor {
406 union acpi_parse_object op; 417 union acpi_parse_object op;
407}; 418};
408 419
420#pragma pack()
421
409#endif /* _ACOBJECT_H */ 422#endif /* _ACOBJECT_H */
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h
index 7659a46bc432..e6f76a280a94 100644
--- a/include/acpi/acopcode.h
+++ b/include/acpi/acopcode.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -257,7 +257,7 @@
257#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE 257#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
258#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) 258#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
259#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE 259#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
260#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF) 260#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)
261#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE) 261#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
262#define ARGI_LOCAL0 ARG_NONE 262#define ARGI_LOCAL0 ARG_NONE
263#define ARGI_LOCAL1 ARG_NONE 263#define ARGI_LOCAL1 ARG_NONE
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 8d5039d0b430..7812267b577f 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h
index 9d49d3c41cd9..85c358e21014 100644
--- a/include/acpi/acparser.h
+++ b/include/acpi/acparser.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index b9a39d1009bd..2e5f00d3ea0d 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index fdd10953b2b6..0d9f984a60a1 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -59,7 +59,6 @@ acpi_evaluate_reference(acpi_handle handle,
59 59
60#define ACPI_BUS_FILE_ROOT "acpi" 60#define ACPI_BUS_FILE_ROOT "acpi"
61extern struct proc_dir_entry *acpi_root_dir; 61extern struct proc_dir_entry *acpi_root_dir;
62extern struct fadt_descriptor acpi_fadt;
63 62
64enum acpi_bus_removal_type { 63enum acpi_bus_removal_type {
65 ACPI_BUS_REMOVAL_NORMAL = 0, 64 ACPI_BUS_REMOVAL_NORMAL = 0,
@@ -92,13 +91,12 @@ typedef int (*acpi_op_remove) (struct acpi_device * device, int type);
92typedef int (*acpi_op_lock) (struct acpi_device * device, int type); 91typedef int (*acpi_op_lock) (struct acpi_device * device, int type);
93typedef int (*acpi_op_start) (struct acpi_device * device); 92typedef int (*acpi_op_start) (struct acpi_device * device);
94typedef int (*acpi_op_stop) (struct acpi_device * device, int type); 93typedef int (*acpi_op_stop) (struct acpi_device * device, int type);
95typedef int (*acpi_op_suspend) (struct acpi_device * device, int state); 94typedef int (*acpi_op_suspend) (struct acpi_device * device, pm_message_t state);
96typedef int (*acpi_op_resume) (struct acpi_device * device, int state); 95typedef int (*acpi_op_resume) (struct acpi_device * device);
97typedef int (*acpi_op_scan) (struct acpi_device * device); 96typedef int (*acpi_op_scan) (struct acpi_device * device);
98typedef int (*acpi_op_bind) (struct acpi_device * device); 97typedef int (*acpi_op_bind) (struct acpi_device * device);
99typedef int (*acpi_op_unbind) (struct acpi_device * device); 98typedef int (*acpi_op_unbind) (struct acpi_device * device);
100typedef int (*acpi_op_match) (struct acpi_device * device, 99typedef int (*acpi_op_shutdown) (struct acpi_device * device);
101 struct acpi_driver * driver);
102 100
103struct acpi_bus_ops { 101struct acpi_bus_ops {
104 u32 acpi_op_add:1; 102 u32 acpi_op_add:1;
@@ -111,7 +109,7 @@ struct acpi_bus_ops {
111 u32 acpi_op_scan:1; 109 u32 acpi_op_scan:1;
112 u32 acpi_op_bind:1; 110 u32 acpi_op_bind:1;
113 u32 acpi_op_unbind:1; 111 u32 acpi_op_unbind:1;
114 u32 acpi_op_match:1; 112 u32 acpi_op_shutdown:1;
115 u32 reserved:21; 113 u32 reserved:21;
116}; 114};
117 115
@@ -126,16 +124,16 @@ struct acpi_device_ops {
126 acpi_op_scan scan; 124 acpi_op_scan scan;
127 acpi_op_bind bind; 125 acpi_op_bind bind;
128 acpi_op_unbind unbind; 126 acpi_op_unbind unbind;
129 acpi_op_match match; 127 acpi_op_shutdown shutdown;
130}; 128};
131 129
132struct acpi_driver { 130struct acpi_driver {
133 struct list_head node;
134 char name[80]; 131 char name[80];
135 char class[80]; 132 char class[80];
136 atomic_t references;
137 char *ids; /* Supported Hardware IDs */ 133 char *ids; /* Supported Hardware IDs */
138 struct acpi_device_ops ops; 134 struct acpi_device_ops ops;
135 struct device_driver drv;
136 struct module *owner;
139}; 137};
140 138
141/* 139/*
@@ -185,7 +183,7 @@ struct acpi_device_dir {
185 183
186typedef char acpi_bus_id[5]; 184typedef char acpi_bus_id[5];
187typedef unsigned long acpi_bus_address; 185typedef unsigned long acpi_bus_address;
188typedef char acpi_hardware_id[9]; 186typedef char acpi_hardware_id[15];
189typedef char acpi_unique_id[9]; 187typedef char acpi_unique_id[9];
190typedef char acpi_device_name[40]; 188typedef char acpi_device_name[40];
191typedef char acpi_device_class[20]; 189typedef char acpi_device_class[20];
@@ -296,11 +294,14 @@ struct acpi_device {
296 struct acpi_device_ops ops; 294 struct acpi_device_ops ops;
297 struct acpi_driver *driver; 295 struct acpi_driver *driver;
298 void *driver_data; 296 void *driver_data;
299 struct kobject kobj;
300 struct device dev; 297 struct device dev;
298 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
299 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
301}; 300};
302 301
303#define acpi_driver_data(d) ((d)->driver_data) 302#define acpi_driver_data(d) ((d)->driver_data)
303#define to_acpi_device(d) container_of(d, struct acpi_device, dev)
304#define to_acpi_driver(d) container_of(d, struct acpi_driver, drv)
304 305
305/* 306/*
306 * Events 307 * Events
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 6a5bdcefec64..f6275b0e66dd 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -36,13 +36,14 @@
36 36
37/* _HID definitions */ 37/* _HID definitions */
38 38
39#define ACPI_POWER_HID "ACPI_PWR" 39#define ACPI_POWER_HID "power_resource"
40#define ACPI_PROCESSOR_HID "ACPI_CPU" 40#define ACPI_PROCESSOR_HID "ACPI0007"
41#define ACPI_SYSTEM_HID "ACPI_SYS" 41#define ACPI_SYSTEM_HID "acpi_system"
42#define ACPI_THERMAL_HID "ACPI_THM" 42#define ACPI_THERMAL_HID "thermal"
43#define ACPI_BUTTON_HID_POWERF "ACPI_FPB" 43#define ACPI_BUTTON_HID_POWERF "button_power"
44#define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" 44#define ACPI_BUTTON_HID_SLEEPF "button_sleep"
45 45#define ACPI_VIDEO_HID "video"
46#define ACPI_BAY_HID "bay"
46/* -------------------------------------------------------------------------- 47/* --------------------------------------------------------------------------
47 PCI 48 PCI
48 -------------------------------------------------------------------------- */ 49 -------------------------------------------------------------------------- */
@@ -104,12 +105,6 @@ int acpi_ec_ecdt_probe(void);
104 105
105int acpi_processor_set_thermal_limit(acpi_handle handle, int type); 106int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
106 107
107/* --------------------------------------------------------------------------
108 Hot Keys
109 -------------------------------------------------------------------------- */
110
111extern int acpi_specific_hotkey_enabled;
112
113/*-------------------------------------------------------------------------- 108/*--------------------------------------------------------------------------
114 Dock Station 109 Dock Station
115 -------------------------------------------------------------------------- */ 110 -------------------------------------------------------------------------- */
@@ -121,10 +116,34 @@ extern int register_hotplug_dock_device(acpi_handle handle,
121 acpi_notify_handler handler, void *context); 116 acpi_notify_handler handler, void *context);
122extern void unregister_hotplug_dock_device(acpi_handle handle); 117extern void unregister_hotplug_dock_device(acpi_handle handle);
123#else 118#else
124#define is_dock_device(h) (0) 119static inline int is_dock_device(acpi_handle handle)
125#define register_dock_notifier(nb) (-ENODEV) 120{
126#define unregister_dock_notifier(nb) do { } while(0) 121 return 0;
127#define register_hotplug_dock_device(h1, h2, c) (-ENODEV) 122}
128#define unregister_hotplug_dock_device(h) do { } while(0) 123static inline int register_dock_notifier(struct notifier_block *nb)
124{
125 return -ENODEV;
126}
127static inline void unregister_dock_notifier(struct notifier_block *nb)
128{
129}
130static inline int register_hotplug_dock_device(acpi_handle handle,
131 acpi_notify_handler handler, void *context)
132{
133 return -ENODEV;
134}
135static inline void unregister_hotplug_dock_device(acpi_handle handle)
136{
137}
129#endif 138#endif
139
140/*--------------------------------------------------------------------------
141 Suspend/Resume
142 -------------------------------------------------------------------------- */
143#ifdef CONFIG_ACPI_SLEEP
144extern int acpi_sleep_init(void);
145#else
146#define acpi_sleep_init() do {} while (0)
147#endif
148
130#endif /*__ACPI_DRIVERS_H__*/ 149#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 0cd63bce0ae4..2785058c82ab 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10/* 10/*
11 * Copyright (C) 2000 - 2006, R. Byron Moore 11 * Copyright (C) 2000 - 2007, R. Byron Moore
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
@@ -85,7 +85,7 @@ acpi_status acpi_os_terminate(void);
85/* 85/*
86 * ACPI Table interfaces 86 * ACPI Table interfaces
87 */ 87 */
88acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *address); 88acpi_physical_address acpi_os_get_root_pointer(void);
89 89
90acpi_status 90acpi_status
91acpi_os_predefined_override(const struct acpi_predefined_names *init_val, 91acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
@@ -143,9 +143,7 @@ void acpi_os_release_mutex(acpi_mutex handle);
143 */ 143 */
144void *acpi_os_allocate(acpi_size size); 144void *acpi_os_allocate(acpi_size size);
145 145
146acpi_status 146void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_native_uint length);
147acpi_os_map_memory(acpi_physical_address physical_address,
148 acpi_size size, void __iomem ** logical_address);
149 147
150void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); 148void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
151 149
@@ -242,12 +240,6 @@ acpi_status
242acpi_os_validate_address(u8 space_id, 240acpi_os_validate_address(u8 space_id,
243 acpi_physical_address address, acpi_size length); 241 acpi_physical_address address, acpi_size length);
244 242
245u8 acpi_os_readable(void *pointer, acpi_size length);
246
247#ifdef ACPI_FUTURE_USAGE
248u8 acpi_os_writable(void *pointer, acpi_size length);
249#endif
250
251u64 acpi_os_get_timer(void); 243u64 acpi_os_get_timer(void);
252 244
253acpi_status acpi_os_signal(u32 function, void *info); 245acpi_status acpi_os_signal(u32 function, void *info);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 81458767a90e..e08f7df85a4f 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2006, R. Byron Moore 9 * Copyright (C) 2000 - 2007, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,10 @@
51/* 51/*
52 * Global interfaces 52 * Global interfaces
53 */ 53 */
54acpi_status
55acpi_initialize_tables(struct acpi_table_desc *initial_storage,
56 u32 initial_table_count, u8 allow_resize);
57
54acpi_status acpi_initialize_subsystem(void); 58acpi_status acpi_initialize_subsystem(void);
55 59
56acpi_status acpi_enable_subsystem(u32 flags); 60acpi_status acpi_enable_subsystem(u32 flags);
@@ -92,30 +96,28 @@ void acpi_free(void *address);
92/* 96/*
93 * ACPI table manipulation interfaces 97 * ACPI table manipulation interfaces
94 */ 98 */
95acpi_status 99acpi_status acpi_reallocate_root_table(void);
96acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address); 100
101acpi_status acpi_find_root_pointer(acpi_native_uint * rsdp_address);
97 102
98acpi_status acpi_load_tables(void); 103acpi_status acpi_load_tables(void);
99 104
100acpi_status acpi_load_table(struct acpi_table_header *table_ptr); 105acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
101 106
102acpi_status acpi_unload_table_id(acpi_table_type table_type, acpi_owner_id id); 107acpi_status acpi_unload_table_id(acpi_owner_id id);
103 108
104#ifdef ACPI_FUTURE_USAGE
105acpi_status acpi_unload_table(acpi_table_type table_type);
106acpi_status 109acpi_status
107acpi_get_table_header(acpi_table_type table_type, 110acpi_get_table_header(acpi_string signature,
108 u32 instance, struct acpi_table_header *out_table_header); 111 acpi_native_uint instance,
109#endif /* ACPI_FUTURE_USAGE */ 112 struct acpi_table_header *out_table_header);
110 113
111acpi_status 114acpi_status
112acpi_get_table(acpi_table_type table_type, 115acpi_get_table(acpi_string signature,
113 u32 instance, struct acpi_buffer *ret_buffer); 116 acpi_native_uint instance, struct acpi_table_header **out_table);
114 117
115acpi_status 118acpi_status
116acpi_get_firmware_table(acpi_string signature, 119acpi_get_table_by_index(acpi_native_uint table_index,
117 u32 instance, 120 struct acpi_table_header **out_table);
118 u32 flags, struct acpi_table_header **table_pointer);
119 121
120/* 122/*
121 * Namespace and name interfaces 123 * Namespace and name interfaces
@@ -310,9 +312,9 @@ acpi_resource_to_address64(struct acpi_resource *resource,
310/* 312/*
311 * Hardware (ACPI device) interfaces 313 * Hardware (ACPI device) interfaces
312 */ 314 */
313acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags); 315acpi_status acpi_get_register(u32 register_id, u32 * return_value);
314 316
315acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags); 317acpi_status acpi_set_register(u32 register_id, u32 value);
316 318
317acpi_status 319acpi_status
318acpi_set_firmware_waking_vector(acpi_physical_address physical_address); 320acpi_set_firmware_waking_vector(acpi_physical_address physical_address);
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index 80a3b33571b4..9486ab266a5e 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h
index 5e8095f0f78f..aeb4498e5e06 100644
--- a/include/acpi/acstruct.h
+++ b/include/acpi/acstruct.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -139,7 +139,8 @@ struct acpi_init_walk_info {
139 u16 buffer_init; 139 u16 buffer_init;
140 u16 package_init; 140 u16 package_init;
141 u16 object_count; 141 u16 object_count;
142 struct acpi_table_desc *table_desc; 142 acpi_owner_id owner_id;
143 acpi_native_uint table_index;
143}; 144};
144 145
145struct acpi_get_devices_info { 146struct acpi_get_devices_info {
diff --git a/include/acpi/actables.h b/include/acpi/actables.h
index 4dbaf02fe526..2b9f46f9da4d 100644
--- a/include/acpi/actables.h
+++ b/include/acpi/actables.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,105 +44,75 @@
44#ifndef __ACTABLES_H__ 44#ifndef __ACTABLES_H__
45#define __ACTABLES_H__ 45#define __ACTABLES_H__
46 46
47/* Used in acpi_tb_map_acpi_table for size parameter if table header is to be used */ 47acpi_status acpi_allocate_root_table(u32 initial_table_count);
48
49#define SIZE_IN_HEADER 0
50 48
51/* 49/*
52 * tbconvrt - Table conversion routines 50 * tbfadt - FADT parse/convert/validate
53 */ 51 */
54acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info); 52void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags);
55
56acpi_status acpi_tb_convert_table_fadt(void);
57 53
58acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info); 54void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
59
60u32
61acpi_tb_get_table_count(struct rsdp_descriptor *RSDP,
62 struct acpi_table_header *RSDT);
63 55
64/* 56/*
65 * tbget - Table "get" routines 57 * tbfind - find ACPI table
66 */ 58 */
67acpi_status 59acpi_status
68acpi_tb_get_table(struct acpi_pointer *address, 60acpi_tb_find_table(char *signature,
69 struct acpi_table_desc *table_info); 61 char *oem_id,
70 62 char *oem_table_id, acpi_native_uint * table_index);
71acpi_status
72acpi_tb_get_table_header(struct acpi_pointer *address,
73 struct acpi_table_header *return_header);
74
75acpi_status
76acpi_tb_get_table_body(struct acpi_pointer *address,
77 struct acpi_table_header *header,
78 struct acpi_table_desc *table_info);
79
80acpi_status
81acpi_tb_get_table_ptr(acpi_table_type table_type,
82 u32 instance, struct acpi_table_header **table_ptr_loc);
83
84acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address);
85
86void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address);
87
88acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr);
89 63
90/* 64/*
91 * tbgetall - get multiple required tables 65 * tbinstal - Table removal and deletion
92 */ 66 */
93acpi_status acpi_tb_get_required_tables(void); 67acpi_status acpi_tb_resize_root_table_list(void);
94 68
95/* 69acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc);
96 * tbinstall - Table installation
97 */
98acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info);
99 70
100acpi_status 71acpi_status
101acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type); 72acpi_tb_add_table(struct acpi_table_desc *table_desc,
73 acpi_native_uint * table_index);
102 74
103acpi_status 75acpi_status
104acpi_tb_init_table_descriptor(acpi_table_type table_type, 76acpi_tb_store_table(acpi_physical_address address,
105 struct acpi_table_desc *table_info); 77 struct acpi_table_header *table,
78 u32 length, u8 flags, acpi_native_uint * table_index);
106 79
107/* 80void acpi_tb_delete_table(struct acpi_table_desc *table_desc);
108 * tbremove - Table removal and deletion
109 */
110void acpi_tb_delete_all_tables(void);
111 81
112void acpi_tb_delete_tables_by_type(acpi_table_type type); 82void acpi_tb_terminate(void);
113 83
114void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc); 84void acpi_tb_delete_namespace_by_owner(acpi_native_uint table_index);
115 85
116struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc 86acpi_status acpi_tb_allocate_owner_id(acpi_native_uint table_index);
117 *table_desc); 87
88acpi_status acpi_tb_release_owner_id(acpi_native_uint table_index);
118 89
119/*
120 * tbxfroot - RSDP, RSDT utilities
121 */
122acpi_status 90acpi_status
123acpi_tb_find_table(char *signature, 91acpi_tb_get_owner_id(acpi_native_uint table_index, acpi_owner_id * owner_id);
124 char *oem_id,
125 char *oem_table_id, struct acpi_table_header **table_ptr);
126 92
127acpi_status acpi_tb_get_table_rsdt(void); 93u8 acpi_tb_is_table_loaded(acpi_native_uint table_index);
128 94
129acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp); 95void acpi_tb_set_table_loaded_flag(acpi_native_uint table_index, u8 is_loaded);
130 96
131/* 97/*
132 * tbutils - common table utilities 98 * tbutils - table manager utilities
133 */ 99 */
134acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); 100u8 acpi_tb_tables_loaded(void);
135 101
136acpi_status 102void
137acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); 103acpi_tb_print_table_header(acpi_physical_address address,
104 struct acpi_table_header *header);
138 105
139u8 acpi_tb_sum_table(void *buffer, u32 length); 106u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length);
140 107
141u8 acpi_tb_generate_checksum(struct acpi_table_header *table); 108acpi_status
109acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
142 110
143void acpi_tb_set_checksum(struct acpi_table_header *table); 111void
112acpi_tb_install_table(acpi_physical_address address,
113 u8 flags, char *signature, acpi_native_uint table_index);
144 114
145acpi_status 115acpi_status
146acpi_tb_validate_table_header(struct acpi_table_header *table_header); 116acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags);
147 117
148#endif /* __ACTABLES_H__ */ 118#endif /* __ACTABLES_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index b125ceed9cb7..955adfb8d64c 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -48,15 +48,15 @@
48 * Values for description table header signatures. Useful because they make 48 * Values for description table header signatures. Useful because they make
49 * it more difficult to inadvertently type in the wrong signature. 49 * it more difficult to inadvertently type in the wrong signature.
50 */ 50 */
51#define DSDT_SIG "DSDT" /* Differentiated System Description Table */ 51#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
52#define FADT_SIG "FACP" /* Fixed ACPI Description Table */ 52#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
53#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ 53#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */
54#define PSDT_SIG "PSDT" /* Persistent System Description Table */ 54#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */
55#define RSDP_SIG "RSD PTR " /* Root System Description Pointer */ 55#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */
56#define RSDT_SIG "RSDT" /* Root System Description Table */ 56#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */
57#define XSDT_SIG "XSDT" /* Extended System Description Table */ 57#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */
58#define SSDT_SIG "SSDT" /* Secondary System Description Table */ 58#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */
59#define RSDP_NAME "RSDP" 59#define ACPI_RSDP_NAME "RSDP" /* Short name for RSDP, not signature */
60 60
61/* 61/*
62 * All tables and structures must be byte-packed to match the ACPI 62 * All tables and structures must be byte-packed to match the ACPI
@@ -83,27 +83,29 @@
83 * 83 *
84 ******************************************************************************/ 84 ******************************************************************************/
85 85
86#define ACPI_TABLE_HEADER_DEF \
87 char signature[4]; /* ASCII table signature */\
88 u32 length; /* Length of table in bytes, including this header */\
89 u8 revision; /* ACPI Specification minor version # */\
90 u8 checksum; /* To make sum of entire table == 0 */\
91 char oem_id[6]; /* ASCII OEM identification */\
92 char oem_table_id[8]; /* ASCII OEM table identification */\
93 u32 oem_revision; /* OEM revision number */\
94 char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\
95 u32 asl_compiler_revision; /* ASL compiler version */
96
97struct acpi_table_header { 86struct acpi_table_header {
98ACPI_TABLE_HEADER_DEF}; 87 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */
88 u32 length; /* Length of table in bytes, including this header */
89 u8 revision; /* ACPI Specification minor version # */
90 u8 checksum; /* To make sum of entire table == 0 */
91 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
92 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
93 u32 oem_revision; /* OEM revision number */
94 char asl_compiler_id[ACPI_NAME_SIZE]; /* ASCII ASL compiler vendor ID */
95 u32 asl_compiler_revision; /* ASL compiler version */
96};
99 97
100/* 98/*
101 * GAS - Generic Address Structure (ACPI 2.0+) 99 * GAS - Generic Address Structure (ACPI 2.0+)
100 *
101 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
102 * If misalignment is not supported, access to the Address field must be
103 * performed with care.
102 */ 104 */
103struct acpi_generic_address { 105struct acpi_generic_address {
104 u8 address_space_id; /* Address space where struct or register exists */ 106 u8 space_id; /* Address space where struct or register exists */
105 u8 register_bit_width; /* Size in bits of given register */ 107 u8 bit_width; /* Size in bits of given register */
106 u8 register_bit_offset; /* Bit offset within the register */ 108 u8 bit_offset; /* Bit offset within the register */
107 u8 access_width; /* Minimum Access size (ACPI 3.0) */ 109 u8 access_width; /* Minimum Access size (ACPI 3.0) */
108 u64 address; /* 64-bit address of struct or register */ 110 u64 address; /* 64-bit address of struct or register */
109}; 111};
@@ -114,10 +116,10 @@ struct acpi_generic_address {
114 * 116 *
115 ******************************************************************************/ 117 ******************************************************************************/
116 118
117struct rsdp_descriptor { 119struct acpi_table_rsdp {
118 char signature[8]; /* ACPI signature, contains "RSD PTR " */ 120 char signature[8]; /* ACPI signature, contains "RSD PTR " */
119 u8 checksum; /* ACPI 1.0 checksum */ 121 u8 checksum; /* ACPI 1.0 checksum */
120 char oem_id[6]; /* OEM identification */ 122 char oem_id[ACPI_OEM_ID_SIZE]; /* OEM identification */
121 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ 123 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
122 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ 124 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
123 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ 125 u32 length; /* Table length in bytes, including header (ACPI 2.0+) */
@@ -134,12 +136,14 @@ struct rsdp_descriptor {
134 * 136 *
135 ******************************************************************************/ 137 ******************************************************************************/
136 138
137struct rsdt_descriptor { 139struct acpi_table_rsdt {
138 ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 140 struct acpi_table_header header; /* Common ACPI table header */
141 u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
139}; 142};
140 143
141struct xsdt_descriptor { 144struct acpi_table_xsdt {
142 ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ 145 struct acpi_table_header header; /* Common ACPI table header */
146 u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
143}; 147};
144 148
145/******************************************************************************* 149/*******************************************************************************
@@ -148,36 +152,27 @@ struct xsdt_descriptor {
148 * 152 *
149 ******************************************************************************/ 153 ******************************************************************************/
150 154
151struct facs_descriptor { 155struct acpi_table_facs {
152 char signature[4]; /* ASCII table signature */ 156 char signature[4]; /* ASCII table signature */
153 u32 length; /* Length of structure, in bytes */ 157 u32 length; /* Length of structure, in bytes */
154 u32 hardware_signature; /* Hardware configuration signature */ 158 u32 hardware_signature; /* Hardware configuration signature */
155 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ 159 u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */
156 u32 global_lock; /* Global Lock for shared hardware resources */ 160 u32 global_lock; /* Global Lock for shared hardware resources */
157 161 u32 flags;
158 /* Flags (32 bits) */
159
160 u8 S4bios_f:1; /* 00: S4BIOS support is present */
161 u8:7; /* 01-07: Reserved, must be zero */
162 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
163
164 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ 162 u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
165 u8 version; /* Version of this table (ACPI 2.0+) */ 163 u8 version; /* Version of this table (ACPI 2.0+) */
166 u8 reserved[31]; /* Reserved, must be zero */ 164 u8 reserved[31]; /* Reserved, must be zero */
167}; 165};
168 166
167/* Flag macros */
168
169#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
170
171/* Global lock flags */
172
169#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ 173#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
170#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ 174#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
171 175
172/*
173 * Common FACS - This is a version-independent FACS structure used for internal use only
174 */
175struct acpi_common_facs {
176 u32 *global_lock;
177 u64 *firmware_waking_vector;
178 u8 vector_width;
179};
180
181/******************************************************************************* 176/*******************************************************************************
182 * 177 *
183 * FADT - Fixed ACPI Description Table (Signature "FACP") 178 * FADT - Fixed ACPI Description Table (Signature "FACP")
@@ -186,124 +181,102 @@ struct acpi_common_facs {
186 181
187/* Fields common to all versions of the FADT */ 182/* Fields common to all versions of the FADT */
188 183
189#define ACPI_FADT_COMMON \ 184struct acpi_table_fadt {
190 ACPI_TABLE_HEADER_DEF \ 185 struct acpi_table_header header; /* Common ACPI table header */
191 u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ 186 u32 facs; /* 32-bit physical address of FACS */
192 u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ 187 u32 dsdt; /* 32-bit physical address of DSDT */
193 u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ 188 u8 model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */
194 u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ 189 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */
195 u16 sci_int; /* System vector of SCI interrupt */ \ 190 u16 sci_interrupt; /* System vector of SCI interrupt */
196 u32 smi_cmd; /* Port address of SMI command port */ \ 191 u32 smi_command; /* 32-bit Port address of SMI command port */
197 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ 192 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */
198 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ 193 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */
199 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ 194 u8 S4bios_request; /* Value to write to SMI CMD to enter S4BIOS state */
200 u8 pstate_cnt; /* Processor performance state control*/ \ 195 u8 pstate_control; /* Processor performance state control */
201 u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \ 196 u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */
202 u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \ 197 u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */
203 u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ 198 u32 pm1a_control_block; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */
204 u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ 199 u32 pm1b_control_block; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */
205 u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ 200 u32 pm2_control_block; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */
206 u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ 201 u32 pm_timer_block; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */
207 u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ 202 u32 gpe0_block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */
208 u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ 203 u32 gpe1_block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */
209 u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \ 204 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */
210 u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \ 205 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */
211 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ 206 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */
212 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ 207 u8 pm_timer_length; /* Byte Length of ports at pm_timer_block */
213 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ 208 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */
214 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ 209 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */
215 u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ 210 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */
216 u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ 211 u8 cst_control; /* Support for the _CST object and C States change notification */
217 u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ 212 u16 C2latency; /* Worst case HW latency to enter/exit C2 state */
218 u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ 213 u16 C3latency; /* Worst case HW latency to enter/exit C3 state */
219 u16 flush_size; /* Processor's memory cache line width, in bytes */ \ 214 u16 flush_size; /* Processor's memory cache line width, in bytes */
220 u16 flush_stride; /* Number of flush strides that need to be read */ \ 215 u16 flush_stride; /* Number of flush strides that need to be read */
221 u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ 216 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */
222 u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ 217 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register. */
223 u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ 218 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
224 u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ 219 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
225 u8 century; /* Index to century in RTC CMOS RAM */ \ 220 u8 century; /* Index to century in RTC CMOS RAM */
226 u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \ 221 u16 boot_flags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */
227 u8 reserved2; /* Reserved, must be zero */ 222 u8 reserved; /* Reserved, must be zero */
228 223 u32 flags; /* Miscellaneous flag bits (see below for individual flags) */
229/* 224 struct acpi_generic_address reset_register; /* 64-bit address of the Reset register */
230 * ACPI 2.0+ FADT
231 */
232struct fadt_descriptor {
233 ACPI_FADT_COMMON
234 /* Flags (32 bits) */
235 u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
236 u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
237 u8 proc_c1:1; /* 02: All processors support C1 state */
238 u8 plvl2_up:1; /* 03: C2 state works on MP system */
239 u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
240 u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
241 u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
242 u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
243 u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
244 u8 dock_cap:1; /* 09: Docking supported */
245 u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
246 u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
247 u8 headless:1; /* 12: No local video capabilities or local input devices */
248 u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
249
250 u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
251 u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
252 u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
253 u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
254 u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
255 u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
256 u8:4; /* 20-23: Reserved, must be zero */
257 u8 reserved3; /* 24-31: Reserved, must be zero */
258
259 struct acpi_generic_address reset_register; /* Reset register address in GAS format */
260 u8 reset_value; /* Value to write to the reset_register port to reset the system */ 225 u8 reset_value; /* Value to write to the reset_register port to reset the system */
261 u8 reserved4[3]; /* These three bytes must be zero */ 226 u8 reserved4[3]; /* Reserved, must be zero */
262 u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ 227 u64 Xfacs; /* 64-bit physical address of FACS */
263 u64 Xdsdt; /* 64-bit physical address of DSDT */ 228 u64 Xdsdt; /* 64-bit physical address of DSDT */
264 struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ 229 struct acpi_generic_address xpm1a_event_block; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
265 struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ 230 struct acpi_generic_address xpm1b_event_block; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
266 struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ 231 struct acpi_generic_address xpm1a_control_block; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
267 struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ 232 struct acpi_generic_address xpm1b_control_block; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
268 struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ 233 struct acpi_generic_address xpm2_control_block; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
269 struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ 234 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
270 struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ 235 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
271 struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ 236 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
272}; 237};
273 238
274/* 239/* FADT flags */
275 * "Down-revved" ACPI 2.0 FADT descriptor 240
276 * Defined here to allow compiler to generate the length of the struct 241#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */
277 */ 242#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */
278struct fadt_descriptor_rev2_minus { 243#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */
279 ACPI_FADT_COMMON u32 flags; 244#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */
280 struct acpi_generic_address reset_register; /* Reset register address in GAS format */ 245#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */
281 u8 reset_value; /* Value to write to the reset_register port to reset the system. */ 246#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */
282 u8 reserved7[3]; /* Reserved, must be zero */ 247#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */
283}; 248#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup stat not possible from S4 */
249#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */
250#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */
251#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */
252#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */
253#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */
254#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */
255#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
256#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
257#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
258#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */
259#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */
260#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
284 261
285/* 262/*
286 * ACPI 1.0 FADT 263 * FADT Prefered Power Management Profiles
287 * Defined here to allow compiler to generate the length of the struct
288 */ 264 */
289struct fadt_descriptor_rev1 { 265enum acpi_prefered_pm_profiles {
290 ACPI_FADT_COMMON u32 flags; 266 PM_UNSPECIFIED = 0,
267 PM_DESKTOP = 1,
268 PM_MOBILE = 2,
269 PM_WORKSTATION = 3,
270 PM_ENTERPRISE_SERVER = 4,
271 PM_SOHO_SERVER = 5,
272 PM_APPLIANCE_PC = 6
291}; 273};
292 274
293/* FADT: Prefered Power Management Profiles */ 275/* FADT Boot Arch Flags */
294
295#define PM_UNSPECIFIED 0
296#define PM_DESKTOP 1
297#define PM_MOBILE 2
298#define PM_WORKSTATION 3
299#define PM_ENTERPRISE_SERVER 4
300#define PM_SOHO_SERVER 5
301#define PM_APPLIANCE_PC 6
302
303/* FADT: Boot Arch Flags */
304 276
305#define BAF_LEGACY_DEVICES 0x0001 277#define BAF_LEGACY_DEVICES 0x0001
306#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
279#define BAF_MSI_NOT_SUPPORTED 0x0008
307 280
308#define FADT2_REVISION_ID 3 281#define FADT2_REVISION_ID 3
309#define FADT2_MINUS_REVISION_ID 2 282#define FADT2_MINUS_REVISION_ID 2
@@ -312,59 +285,12 @@ struct fadt_descriptor_rev1 {
312 285
313#pragma pack() 286#pragma pack()
314 287
315/* 288#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f)
316 * This macro is temporary until the table bitfield flag definitions
317 * are removed and replaced by a Flags field.
318 */
319#define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \
320 sizeof(((d *)0)->f) + o)
321/*
322 * Get the remaining ACPI tables
323 */
324#include "actbl1.h"
325 289
326/* 290/*
327 * ACPI Table information. We save the table address, length, 291 * Get the remaining ACPI tables
328 * and type of memory allocation (mapped or allocated) for each
329 * table for 1) when we exit, and 2) if a new table is installed
330 */ 292 */
331#define ACPI_MEM_NOT_ALLOCATED 0
332#define ACPI_MEM_ALLOCATED 1
333#define ACPI_MEM_MAPPED 2
334
335/* Definitions for the Flags bitfield member of struct acpi_table_support */
336
337#define ACPI_TABLE_SINGLE 0x00
338#define ACPI_TABLE_MULTIPLE 0x01
339#define ACPI_TABLE_EXECUTABLE 0x02
340
341#define ACPI_TABLE_ROOT 0x00
342#define ACPI_TABLE_PRIMARY 0x10
343#define ACPI_TABLE_SECONDARY 0x20
344#define ACPI_TABLE_ALL 0x30
345#define ACPI_TABLE_TYPE_MASK 0x30
346
347/* Data about each known table type */
348
349struct acpi_table_support {
350 char *name;
351 char *signature;
352 void **global_ptr;
353 u8 sig_length;
354 u8 flags;
355};
356
357extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
358 * needed for certain workarounds */
359/* Macros used to generate offsets to specific table fields */
360
361#define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f)
362#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f)
363#define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f)
364#define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f)
365#define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
366 293
367#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o) 294#include <acpi/actbl1.h>
368#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
369 295
370#endif /* __ACTBL_H__ */ 296#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 745a6445a4f9..4e5d3ca53a8e 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -61,6 +61,7 @@
61#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ 61#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
62#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ 62#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
63#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 63#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
64#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
64#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ 65#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
65#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 66#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
66#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ 67#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
@@ -73,12 +74,6 @@
73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 74#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 75#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
75 76
76/* Legacy names */
77
78#define APIC_SIG "APIC" /* Multiple APIC Description Table */
79#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */
80#define SBST_SIG "SBST" /* Smart Battery Specification Table */
81
82/* 77/*
83 * All tables must be byte-packed to match the ACPI specification, since 78 * All tables must be byte-packed to match the ACPI specification, since
84 * the tables are provided by the system BIOS. 79 * the tables are provided by the system BIOS.
@@ -91,31 +86,43 @@
91 * portable, so do not use any other bitfield types. 86 * portable, so do not use any other bitfield types.
92 */ 87 */
93 88
89/* Common Sub-table header (used in MADT, SRAT, etc.) */
90
91struct acpi_subtable_header {
92 u8 type;
93 u8 length;
94};
95
94/******************************************************************************* 96/*******************************************************************************
95 * 97 *
96 * ASF - Alert Standard Format table (Signature "ASF!") 98 * ASF - Alert Standard Format table (Signature "ASF!")
97 * 99 *
100 * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
101 *
98 ******************************************************************************/ 102 ******************************************************************************/
99 103
100struct acpi_table_asf { 104struct acpi_table_asf {
101ACPI_TABLE_HEADER_DEF}; 105 struct acpi_table_header header; /* Common ACPI table header */
106};
102 107
103#define ACPI_ASF_HEADER_DEF \ 108/* ASF subtable header */
104 u8 type; \
105 u8 reserved; \
106 u16 length;
107 109
108struct acpi_asf_header { 110struct acpi_asf_header {
109ACPI_ASF_HEADER_DEF}; 111 u8 type;
112 u8 reserved;
113 u16 length;
114};
110 115
111/* Values for Type field */ 116/* Values for Type field above */
112 117
113#define ASF_INFO 0 118enum acpi_asf_type {
114#define ASF_ALERT 1 119 ACPI_ASF_TYPE_INFO = 0,
115#define ASF_CONTROL 2 120 ACPI_ASF_TYPE_ALERT = 1,
116#define ASF_BOOT 3 121 ACPI_ASF_TYPE_CONTROL = 2,
117#define ASF_ADDRESS 4 122 ACPI_ASF_TYPE_BOOT = 3,
118#define ASF_RESERVED 5 123 ACPI_ASF_TYPE_ADDRESS = 4,
124 ACPI_ASF_TYPE_RESERVED = 5
125};
119 126
120/* 127/*
121 * ASF subtables 128 * ASF subtables
@@ -124,7 +131,8 @@ ACPI_ASF_HEADER_DEF};
124/* 0: ASF Information */ 131/* 0: ASF Information */
125 132
126struct acpi_asf_info { 133struct acpi_asf_info {
127 ACPI_ASF_HEADER_DEF u8 min_reset_value; 134 struct acpi_asf_header header;
135 u8 min_reset_value;
128 u8 min_poll_interval; 136 u8 min_poll_interval;
129 u16 system_id; 137 u16 system_id;
130 u32 mfg_id; 138 u32 mfg_id;
@@ -135,26 +143,49 @@ struct acpi_asf_info {
135/* 1: ASF Alerts */ 143/* 1: ASF Alerts */
136 144
137struct acpi_asf_alert { 145struct acpi_asf_alert {
138 ACPI_ASF_HEADER_DEF u8 assert_mask; 146 struct acpi_asf_header header;
147 u8 assert_mask;
139 u8 deassert_mask; 148 u8 deassert_mask;
140 u8 alerts; 149 u8 alerts;
141 u8 data_length; 150 u8 data_length;
142 u8 array[1]; 151};
152
153struct acpi_asf_alert_data {
154 u8 address;
155 u8 command;
156 u8 mask;
157 u8 value;
158 u8 sensor_type;
159 u8 type;
160 u8 offset;
161 u8 source_type;
162 u8 severity;
163 u8 sensor_number;
164 u8 entity;
165 u8 instance;
143}; 166};
144 167
145/* 2: ASF Remote Control */ 168/* 2: ASF Remote Control */
146 169
147struct acpi_asf_remote { 170struct acpi_asf_remote {
148 ACPI_ASF_HEADER_DEF u8 controls; 171 struct acpi_asf_header header;
172 u8 controls;
149 u8 data_length; 173 u8 data_length;
150 u16 reserved2; 174 u16 reserved2;
151 u8 array[1]; 175};
176
177struct acpi_asf_control_data {
178 u8 function;
179 u8 address;
180 u8 command;
181 u8 value;
152}; 182};
153 183
154/* 3: ASF RMCP Boot Options */ 184/* 3: ASF RMCP Boot Options */
155 185
156struct acpi_asf_rmcp { 186struct acpi_asf_rmcp {
157 ACPI_ASF_HEADER_DEF u8 capabilities[7]; 187 struct acpi_asf_header header;
188 u8 capabilities[7];
158 u8 completion_code; 189 u8 completion_code;
159 u32 enterprise_id; 190 u32 enterprise_id;
160 u8 command; 191 u8 command;
@@ -166,9 +197,9 @@ struct acpi_asf_rmcp {
166/* 4: ASF Address */ 197/* 4: ASF Address */
167 198
168struct acpi_asf_address { 199struct acpi_asf_address {
169 ACPI_ASF_HEADER_DEF u8 eprom_address; 200 struct acpi_asf_header header;
201 u8 eprom_address;
170 u8 devices; 202 u8 devices;
171 u8 smbus_addresses[1];
172}; 203};
173 204
174/******************************************************************************* 205/*******************************************************************************
@@ -178,7 +209,8 @@ struct acpi_asf_address {
178 ******************************************************************************/ 209 ******************************************************************************/
179 210
180struct acpi_table_boot { 211struct acpi_table_boot {
181 ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ 212 struct acpi_table_header header; /* Common ACPI table header */
213 u8 cmos_index; /* Index in CMOS RAM for the boot register */
182 u8 reserved[3]; 214 u8 reserved[3];
183}; 215};
184 216
@@ -189,7 +221,8 @@ struct acpi_table_boot {
189 ******************************************************************************/ 221 ******************************************************************************/
190 222
191struct acpi_table_cpep { 223struct acpi_table_cpep {
192 ACPI_TABLE_HEADER_DEF u64 reserved; 224 struct acpi_table_header header; /* Common ACPI table header */
225 u64 reserved;
193}; 226};
194 227
195/* Subtable */ 228/* Subtable */
@@ -197,9 +230,9 @@ struct acpi_table_cpep {
197struct acpi_cpep_polling { 230struct acpi_cpep_polling {
198 u8 type; 231 u8 type;
199 u8 length; 232 u8 length;
200 u8 processor_id; /* Processor ID */ 233 u8 id; /* Processor ID */
201 u8 processor_eid; /* Processor EID */ 234 u8 eid; /* Processor EID */
202 u32 polling_interval; /* Polling interval (msec) */ 235 u32 interval; /* Polling interval (msec) */
203}; 236};
204 237
205/******************************************************************************* 238/*******************************************************************************
@@ -209,196 +242,281 @@ struct acpi_cpep_polling {
209 ******************************************************************************/ 242 ******************************************************************************/
210 243
211struct acpi_table_dbgp { 244struct acpi_table_dbgp {
212 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 245 struct acpi_table_header header; /* Common ACPI table header */
246 u8 type; /* 0=full 16550, 1=subset of 16550 */
213 u8 reserved[3]; 247 u8 reserved[3];
214 struct acpi_generic_address debug_port; 248 struct acpi_generic_address debug_port;
215}; 249};
216 250
217/******************************************************************************* 251/*******************************************************************************
218 * 252 *
219 * ECDT - Embedded Controller Boot Resources Table 253 * DMAR - DMA Remapping table
220 * 254 *
221 ******************************************************************************/ 255 ******************************************************************************/
222 256
223struct ec_boot_resources { 257struct acpi_table_dmar {
224 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ 258 struct acpi_table_header header; /* Common ACPI table header */
225 struct acpi_generic_address ec_data; /* Address of EC data register */ 259 u8 width; /* Host Address Width */
226 u32 uid; /* Unique ID - must be same as the EC _UID method */ 260 u8 reserved[11];
227 u8 gpe_bit; /* The GPE for the EC */ 261};
228 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ 262
263/* DMAR subtable header */
264
265struct acpi_dmar_header {
266 u16 type;
267 u16 length;
268 u8 flags;
269 u8 reserved[3];
270};
271
272/* Values for subtable type in struct acpi_dmar_header */
273
274enum acpi_dmar_type {
275 ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
276 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
277 ACPI_DMAR_TYPE_RESERVED = 2 /* 2 and greater are reserved */
278};
279
280struct acpi_dmar_device_scope {
281 u8 entry_type;
282 u8 length;
283 u8 segment;
284 u8 bus;
285};
286
287/* Values for entry_type in struct acpi_dmar_device_scope */
288
289enum acpi_dmar_scope_type {
290 ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
291 ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
292 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
293 ACPI_DMAR_SCOPE_TYPE_RESERVED = 3 /* 3 and greater are reserved */
294};
295
296/*
297 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header
298 */
299
300/* 0: Hardware Unit Definition */
301
302struct acpi_dmar_hardware_unit {
303 struct acpi_dmar_header header;
304 u64 address; /* Register Base Address */
305};
306
307/* Flags */
308
309#define ACPI_DMAR_INCLUDE_ALL (1)
310
311/* 1: Reserved Memory Defininition */
312
313struct acpi_dmar_reserved_memory {
314 struct acpi_dmar_header header;
315 u64 address; /* 4_k aligned base address */
316 u64 end_address; /* 4_k aligned limit address */
229}; 317};
230 318
319/* Flags */
320
321#define ACPI_DMAR_ALLOW_ALL (1)
322
231/******************************************************************************* 323/*******************************************************************************
232 * 324 *
233 * HPET - High Precision Event Timer table 325 * ECDT - Embedded Controller Boot Resources Table
234 * 326 *
235 ******************************************************************************/ 327 ******************************************************************************/
236 328
237struct acpi_hpet_table { 329struct acpi_table_ecdt {
238 ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ 330 struct acpi_table_header header; /* Common ACPI table header */
239 struct acpi_generic_address base_address; /* Address of event timer block */ 331 struct acpi_generic_address control; /* Address of EC command/status register */
240 u8 hpet_number; /* HPET sequence number */ 332 struct acpi_generic_address data; /* Address of EC data register */
241 u16 clock_tick; /* Main counter min tick, periodic mode */ 333 u32 uid; /* Unique ID - must be same as the EC _UID method */
242 u8 attributes; 334 u8 gpe; /* The GPE for the EC */
335 u8 id[1]; /* Full namepath of the EC in the ACPI namespace */
243}; 336};
244 337
245#if 0 /* HPET flags to be converted to macros */
246struct { /* Flags (8 bits) */
247 u8 page_protect:1; /* 00: No page protection */
248 u8 page_protect4:1; /* 01: 4_kB page protected */
249 u8 page_protect64:1; /* 02: 64_kB page protected */
250 u8:5; /* 03-07: Reserved, must be zero */
251} flags;
252#endif
253
254/******************************************************************************* 338/*******************************************************************************
255 * 339 *
256 * MADT - Multiple APIC Description Table 340 * HPET - High Precision Event Timer table
257 * 341 *
258 ******************************************************************************/ 342 ******************************************************************************/
259 343
260struct multiple_apic_table { 344struct acpi_table_hpet {
261 ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ 345 struct acpi_table_header header; /* Common ACPI table header */
262 346 u32 id; /* Hardware ID of event timer block */
263 /* Flags (32 bits) */ 347 struct acpi_generic_address address; /* Address of event timer block */
264 348 u8 sequence; /* HPET sequence number */
265 u8 PCATcompat:1; /* 00: System also has dual 8259s */ 349 u16 minimum_tick; /* Main counter min tick, periodic mode */
266 u8:7; /* 01-07: Reserved, must be zero */ 350 u8 flags;
267 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
268}; 351};
269 352
270/* Values for MADT PCATCompat */ 353/*! Flags */
271 354
272#define DUAL_PIC 0 355#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */
273#define MULTIPLE_APIC 1 356#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */
357#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */
274 358
275/* Common MADT Sub-table header */ 359/*! [End] no source code translation !*/
276 360
277#define APIC_HEADER_DEF \ 361/*******************************************************************************
278 u8 type; \ 362 *
279 u8 length; 363 * MADT - Multiple APIC Description Table
280 364 *
281struct apic_header { 365 ******************************************************************************/
282APIC_HEADER_DEF};
283
284/* Values for Type in struct apic_header */
285 366
286#define APIC_PROCESSOR 0 367struct acpi_table_madt {
287#define APIC_IO 1 368 struct acpi_table_header header; /* Common ACPI table header */
288#define APIC_XRUPT_OVERRIDE 2 369 u32 address; /* Physical address of local APIC */
289#define APIC_NMI 3 370 u32 flags;
290#define APIC_LOCAL_NMI 4 371};
291#define APIC_ADDRESS_OVERRIDE 5
292#define APIC_IO_SAPIC 6
293#define APIC_LOCAL_SAPIC 7
294#define APIC_XRUPT_SOURCE 8
295#define APIC_RESERVED 9 /* 9 and greater are reserved */
296 372
297/* Flag definitions for MADT sub-tables */ 373/* Flags */
298 374
299#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ 375#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
300 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
301 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
302 u8 : 4; /* 04-07: Reserved, must be zero */\
303 u8 reserved1; /* 08-15: Reserved, must be zero */
304 376
305#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ 377/* Values for PCATCompat flag */
306 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
307 u8 : 7; /* 01-07: Reserved, must be zero */\
308 u8 reserved2[3]; /* 08-31: Reserved, must be zero */
309 378
310/* Values for MPS INTI flags */ 379#define ACPI_MADT_DUAL_PIC 0
380#define ACPI_MADT_MULTIPLE_APIC 1
311 381
312#define POLARITY_CONFORMS 0 382/* Values for subtable type in struct acpi_subtable_header */
313#define POLARITY_ACTIVE_HIGH 1
314#define POLARITY_RESERVED 2
315#define POLARITY_ACTIVE_LOW 3
316 383
317#define TRIGGER_CONFORMS 0 384enum acpi_madt_type {
318#define TRIGGER_EDGE 1 385 ACPI_MADT_TYPE_LOCAL_APIC = 0,
319#define TRIGGER_RESERVED 2 386 ACPI_MADT_TYPE_IO_APIC = 1,
320#define TRIGGER_LEVEL 3 387 ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
388 ACPI_MADT_TYPE_NMI_SOURCE = 3,
389 ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
390 ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
391 ACPI_MADT_TYPE_IO_SAPIC = 6,
392 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
393 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
394 ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */
395};
321 396
322/* 397/*
323 * MADT Sub-tables, correspond to Type in struct apic_header 398 * MADT Sub-tables, correspond to Type in struct acpi_subtable_header
324 */ 399 */
325 400
326/* 0: processor APIC */ 401/* 0: Processor Local APIC */
327 402
328struct madt_processor_apic { 403struct acpi_madt_local_apic {
329 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 404 struct acpi_subtable_header header;
330 u8 local_apic_id; /* Processor's local APIC id */ 405 u8 processor_id; /* ACPI processor id */
331 ACPI_MADT_LFLAGS}; 406 u8 id; /* Processor's local APIC id */
407 u32 lapic_flags;
408};
332 409
333/* 1: IO APIC */ 410/* 1: IO APIC */
334 411
335struct madt_io_apic { 412struct acpi_madt_io_apic {
336 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ 413 struct acpi_subtable_header header;
414 u8 id; /* I/O APIC ID */
337 u8 reserved; /* Reserved - must be zero */ 415 u8 reserved; /* Reserved - must be zero */
338 u32 address; /* APIC physical address */ 416 u32 address; /* APIC physical address */
339 u32 interrupt; /* Global system interrupt where INTI lines start */ 417 u32 global_irq_base; /* Global system interrupt where INTI lines start */
340}; 418};
341 419
342/* 2: Interrupt Override */ 420/* 2: Interrupt Override */
343 421
344struct madt_interrupt_override { 422struct acpi_madt_interrupt_override {
345 APIC_HEADER_DEF u8 bus; /* 0 - ISA */ 423 struct acpi_subtable_header header;
346 u8 source; /* Interrupt source (IRQ) */ 424 u8 bus; /* 0 - ISA */
347 u32 interrupt; /* Global system interrupt */ 425 u8 source_irq; /* Interrupt source (IRQ) */
348 ACPI_MADT_IFLAGS}; 426 u32 global_irq; /* Global system interrupt */
427 u16 inti_flags;
428};
349 429
350/* 3: NMI Sources */ 430/* 3: NMI Source */
351 431
352struct madt_nmi_source { 432struct acpi_madt_nmi_source {
353 APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ 433 struct acpi_subtable_header header;
434 u16 inti_flags;
435 u32 global_irq; /* Global system interrupt */
354}; 436};
355 437
356/* 4: Local APIC NMI */ 438/* 4: Local APIC NMI */
357 439
358struct madt_local_apic_nmi { 440struct acpi_madt_local_apic_nmi {
359 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 441 struct acpi_subtable_header header;
360 ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ 442 u8 processor_id; /* ACPI processor id */
443 u16 inti_flags;
444 u8 lint; /* LINTn to which NMI is connected */
361}; 445};
362 446
363/* 5: Address Override */ 447/* 5: Address Override */
364 448
365struct madt_address_override { 449struct acpi_madt_local_apic_override {
366 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ 450 struct acpi_subtable_header header;
451 u16 reserved; /* Reserved, must be zero */
367 u64 address; /* APIC physical address */ 452 u64 address; /* APIC physical address */
368}; 453};
369 454
370/* 6: I/O Sapic */ 455/* 6: I/O Sapic */
371 456
372struct madt_io_sapic { 457struct acpi_madt_io_sapic {
373 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ 458 struct acpi_subtable_header header;
459 u8 id; /* I/O SAPIC ID */
374 u8 reserved; /* Reserved, must be zero */ 460 u8 reserved; /* Reserved, must be zero */
375 u32 interrupt_base; /* Glocal interrupt for SAPIC start */ 461 u32 global_irq_base; /* Global interrupt for SAPIC start */
376 u64 address; /* SAPIC physical address */ 462 u64 address; /* SAPIC physical address */
377}; 463};
378 464
379/* 7: Local Sapic */ 465/* 7: Local Sapic */
380 466
381struct madt_local_sapic { 467struct acpi_madt_local_sapic {
382 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 468 struct acpi_subtable_header header;
383 u8 local_sapic_id; /* SAPIC ID */ 469 u8 processor_id; /* ACPI processor id */
384 u8 local_sapic_eid; /* SAPIC EID */ 470 u8 id; /* SAPIC ID */
471 u8 eid; /* SAPIC EID */
385 u8 reserved[3]; /* Reserved, must be zero */ 472 u8 reserved[3]; /* Reserved, must be zero */
386 ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ 473 u32 lapic_flags;
387 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ 474 u32 uid; /* Numeric UID - ACPI 3.0 */
475 char uid_string[1]; /* String UID - ACPI 3.0 */
388}; 476};
389 477
390/* 8: Platform Interrupt Source */ 478/* 8: Platform Interrupt Source */
391 479
392struct madt_interrupt_source { 480struct acpi_madt_interrupt_source {
393 APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ 481 struct acpi_subtable_header header;
394 u8 processor_id; /* Processor ID */ 482 u16 inti_flags;
395 u8 processor_eid; /* Processor EID */ 483 u8 type; /* 1=PMI, 2=INIT, 3=corrected */
484 u8 id; /* Processor ID */
485 u8 eid; /* Processor EID */
396 u8 io_sapic_vector; /* Vector value for PMI interrupts */ 486 u8 io_sapic_vector; /* Vector value for PMI interrupts */
397 u32 interrupt; /* Global system interrupt */ 487 u32 global_irq; /* Global system interrupt */
398 u32 flags; /* Interrupt Source Flags */ 488 u32 flags; /* Interrupt Source Flags */
399}; 489};
400 490
401#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H 491/* Flags field above */
492
493#define ACPI_MADT_CPEI_OVERRIDE (1)
494
495/*
496 * Common flags fields for MADT subtables
497 */
498
499/* MADT Local APIC flags (lapic_flags) */
500
501#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
502
503/* MADT MPS INTI flags (inti_flags) */
504
505#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
506#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
507
508/* Values for MPS INTI flags */
509
510#define ACPI_MADT_POLARITY_CONFORMS 0
511#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
512#define ACPI_MADT_POLARITY_RESERVED 2
513#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
514
515#define ACPI_MADT_TRIGGER_CONFORMS (0)
516#define ACPI_MADT_TRIGGER_EDGE (1<<2)
517#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
518#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
519
402/******************************************************************************* 520/*******************************************************************************
403 * 521 *
404 * MCFG - PCI Memory Mapped Configuration table and sub-table 522 * MCFG - PCI Memory Mapped Configuration table and sub-table
@@ -406,17 +524,19 @@ struct madt_interrupt_source {
406 ******************************************************************************/ 524 ******************************************************************************/
407 525
408struct acpi_table_mcfg { 526struct acpi_table_mcfg {
409 ACPI_TABLE_HEADER_DEF u8 reserved[8]; 527 struct acpi_table_header header; /* Common ACPI table header */
528 u8 reserved[8];
410}; 529};
411 530
531/* Subtable */
532
412struct acpi_mcfg_allocation { 533struct acpi_mcfg_allocation {
413 u64 base_address; /* Base address, processor-relative */ 534 u64 address; /* Base address, processor-relative */
414 u16 pci_segment; /* PCI segment group number */ 535 u16 pci_segment; /* PCI segment group number */
415 u8 start_bus_number; /* Starting PCI Bus number */ 536 u8 start_bus_number; /* Starting PCI Bus number */
416 u8 end_bus_number; /* Final PCI Bus number */ 537 u8 end_bus_number; /* Final PCI Bus number */
417 u32 reserved; 538 u32 reserved;
418}; 539};
419#endif
420 540
421/******************************************************************************* 541/*******************************************************************************
422 * 542 *
@@ -424,8 +544,9 @@ struct acpi_mcfg_allocation {
424 * 544 *
425 ******************************************************************************/ 545 ******************************************************************************/
426 546
427struct smart_battery_table { 547struct acpi_table_sbst {
428 ACPI_TABLE_HEADER_DEF u32 warning_level; 548 struct acpi_table_header header; /* Common ACPI table header */
549 u32 warning_level;
429 u32 low_level; 550 u32 low_level;
430 u32 critical_level; 551 u32 critical_level;
431}; 552};
@@ -436,9 +557,10 @@ struct smart_battery_table {
436 * 557 *
437 ******************************************************************************/ 558 ******************************************************************************/
438 559
439struct system_locality_info { 560struct acpi_table_slit {
440 ACPI_TABLE_HEADER_DEF u64 locality_count; 561 struct acpi_table_header header; /* Common ACPI table header */
441 u8 entry[1][1]; 562 u64 locality_count;
563 u8 entry[1]; /* Real size = localities^2 */
442}; 564};
443 565
444/******************************************************************************* 566/*******************************************************************************
@@ -448,7 +570,8 @@ struct system_locality_info {
448 ******************************************************************************/ 570 ******************************************************************************/
449 571
450struct acpi_table_spcr { 572struct acpi_table_spcr {
451 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 573 struct acpi_table_header header; /* Common ACPI table header */
574 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
452 u8 reserved[3]; 575 u8 reserved[3];
453 struct acpi_generic_address serial_port; 576 struct acpi_generic_address serial_port;
454 u8 interrupt_type; 577 u8 interrupt_type;
@@ -459,7 +582,7 @@ struct acpi_table_spcr {
459 u8 stop_bits; 582 u8 stop_bits;
460 u8 flow_control; 583 u8 flow_control;
461 u8 terminal_type; 584 u8 terminal_type;
462 u8 reserved2; 585 u8 reserved1;
463 u16 pci_device_id; 586 u16 pci_device_id;
464 u16 pci_vendor_id; 587 u16 pci_vendor_id;
465 u8 pci_bus; 588 u8 pci_bus;
@@ -467,7 +590,7 @@ struct acpi_table_spcr {
467 u8 pci_function; 590 u8 pci_function;
468 u32 pci_flags; 591 u32 pci_flags;
469 u8 pci_segment; 592 u8 pci_segment;
470 u32 reserved3; 593 u32 reserved2;
471}; 594};
472 595
473/******************************************************************************* 596/*******************************************************************************
@@ -477,12 +600,13 @@ struct acpi_table_spcr {
477 ******************************************************************************/ 600 ******************************************************************************/
478 601
479struct acpi_table_spmi { 602struct acpi_table_spmi {
480 ACPI_TABLE_HEADER_DEF u8 reserved; 603 struct acpi_table_header header; /* Common ACPI table header */
604 u8 reserved;
481 u8 interface_type; 605 u8 interface_type;
482 u16 spec_revision; /* Version of IPMI */ 606 u16 spec_revision; /* Version of IPMI */
483 u8 interrupt_type; 607 u8 interrupt_type;
484 u8 gpe_number; /* GPE assigned */ 608 u8 gpe_number; /* GPE assigned */
485 u8 reserved2; 609 u8 reserved1;
486 u8 pci_device_flag; 610 u8 pci_device_flag;
487 u32 interrupt; 611 u32 interrupt;
488 struct acpi_generic_address ipmi_register; 612 struct acpi_generic_address ipmi_register;
@@ -498,58 +622,53 @@ struct acpi_table_spmi {
498 * 622 *
499 ******************************************************************************/ 623 ******************************************************************************/
500 624
501struct system_resource_affinity { 625struct acpi_table_srat {
502 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ 626 struct acpi_table_header header; /* Common ACPI table header */
503 u64 reserved2; /* Reserved, must be zero */ 627 u32 table_revision; /* Must be value '1' */
628 u64 reserved; /* Reserved, must be zero */
504}; 629};
505 630
506/* SRAT common sub-table header */ 631/* Values for subtable type in struct acpi_subtable_header */
507 632
508#define SRAT_SUBTABLE_HEADER \ 633enum acpi_srat_type {
509 u8 type; \ 634 ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
510 u8 length; 635 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
511 636 ACPI_SRAT_TYPE_RESERVED = 2
512/* Values for Type above */ 637};
513
514#define SRAT_CPU_AFFINITY 0
515#define SRAT_MEMORY_AFFINITY 1
516#define SRAT_RESERVED 2
517 638
518/* SRAT sub-tables */ 639/* SRAT sub-tables */
519 640
520struct static_resource_alloc { 641struct acpi_srat_cpu_affinity {
521 SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; 642 struct acpi_subtable_header header;
643 u8 proximity_domain_lo;
522 u8 apic_id; 644 u8 apic_id;
523 645 u32 flags;
524 /* Flags (32 bits) */
525
526 u8 enabled:1; /* 00: Use affinity structure */
527 u8:7; /* 01-07: Reserved, must be zero */
528 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
529
530 u8 local_sapic_eid; 646 u8 local_sapic_eid;
531 u8 proximity_domain_hi[3]; 647 u8 proximity_domain_hi[3];
532 u32 reserved4; /* Reserved, must be zero */ 648 u32 reserved; /* Reserved, must be zero */
533}; 649};
534 650
535struct memory_affinity { 651/* Flags */
536 SRAT_SUBTABLE_HEADER u32 proximity_domain;
537 u16 reserved3;
538 u64 base_address;
539 u64 address_length;
540 u32 reserved4;
541
542 /* Flags (32 bits) */
543 652
544 u8 enabled:1; /* 00: Use affinity structure */ 653#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
545 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
546 u8 non_volatile:1; /* 02: Memory is non-volatile */
547 u8:5; /* 03-07: Reserved, must be zero */
548 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
549 654
550 u64 reserved6; /* Reserved, must be zero */ 655struct acpi_srat_mem_affinity {
656 struct acpi_subtable_header header;
657 u32 proximity_domain;
658 u16 reserved; /* Reserved, must be zero */
659 u64 base_address;
660 u64 length;
661 u32 memory_type; /* See acpi_address_range_id */
662 u32 flags;
663 u64 reserved1; /* Reserved, must be zero */
551}; 664};
552 665
666/* Flags */
667
668#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */
669#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
670#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
671
553/******************************************************************************* 672/*******************************************************************************
554 * 673 *
555 * TCPA - Trusted Computing Platform Alliance table 674 * TCPA - Trusted Computing Platform Alliance table
@@ -557,7 +676,8 @@ struct memory_affinity {
557 ******************************************************************************/ 676 ******************************************************************************/
558 677
559struct acpi_table_tcpa { 678struct acpi_table_tcpa {
560 ACPI_TABLE_HEADER_DEF u16 reserved; 679 struct acpi_table_header header; /* Common ACPI table header */
680 u16 reserved;
561 u32 max_log_length; /* Maximum length for the event log area */ 681 u32 max_log_length; /* Maximum length for the event log area */
562 u64 log_address; /* Address of the event log area */ 682 u64 log_address; /* Address of the event log area */
563}; 683};
@@ -569,7 +689,8 @@ struct acpi_table_tcpa {
569 ******************************************************************************/ 689 ******************************************************************************/
570 690
571struct acpi_table_wdrt { 691struct acpi_table_wdrt {
572 ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ 692 struct acpi_table_header header; /* Common ACPI table header */
693 u32 header_length; /* Watchdog Header Length */
573 u8 pci_segment; /* PCI Segment number */ 694 u8 pci_segment; /* PCI Segment number */
574 u8 pci_bus; /* PCI Bus number */ 695 u8 pci_bus; /* PCI Bus number */
575 u8 pci_device; /* PCI Device number */ 696 u8 pci_device; /* PCI Device number */
@@ -582,58 +703,9 @@ struct acpi_table_wdrt {
582 u32 entries; /* Number of watchdog entries that follow */ 703 u32 entries; /* Number of watchdog entries that follow */
583}; 704};
584 705
585#if 0 /* Flags, will be converted to macros */ 706/* Flags */
586u8 enabled:1; /* 00: Timer enabled */ 707
587u8:6; /* 01-06: Reserved */ 708#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
588u8 sleep_stop:1; /* 07: Timer stopped in sleep state */
589#endif
590
591/* Macros used to generate offsets to specific table fields */
592
593#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f)
594#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
595#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
596#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
597#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f)
598#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f)
599#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
600#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
601#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
602#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f)
603#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f)
604#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f)
605#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f)
606#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f)
607#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
608#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f)
609#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
610#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f)
611#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f)
612#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f)
613#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
614#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f)
615#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
616#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
617#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f)
618#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f)
619#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
620#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
621#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f)
622#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f)
623#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f)
624#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
625#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
626
627#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o)
628#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
629#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
630#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
631#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
632#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
633#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
634#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
635#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
636#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
637 709
638/* Reset to default packing */ 710/* Reset to default packing */
639 711
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
deleted file mode 100644
index 67efe6cad27b..000000000000
--- a/include/acpi/actbl2.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/******************************************************************************
2 *
3 * Name: actbl2.h - ACPI Specification Revision 2.0 Tables
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACTBL2_H__
45#define __ACTBL2_H__
46
47/* Code moved to both actbl.h and actbl1.h */
48
49#endif /* __ACTBL2_H__ */
diff --git a/include/acpi/actbl71.h b/include/acpi/actbl71.h
deleted file mode 100644
index 10ac05bb36bc..000000000000
--- a/include/acpi/actbl71.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/******************************************************************************
2 *
3 * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71
4 * This file includes tables specific to this
5 * specification revision.
6 *
7 *****************************************************************************/
8
9/*
10 * Copyright (C) 2000 - 2003, R. Byron Moore
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 of the License, or
15 * (at your option) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#ifndef __ACTBL71_H__
28#define __ACTBL71_H__
29
30/* 0.71 FADT address_space data item bitmasks defines */
31/* If the associated bit is zero then it is in memory space else in io space */
32
33#define SMI_CMD_ADDRESS_SPACE 0x01
34#define PM1_BLK_ADDRESS_SPACE 0x02
35#define PM2_CNT_BLK_ADDRESS_SPACE 0x04
36#define PM_TMR_BLK_ADDRESS_SPACE 0x08
37#define GPE0_BLK_ADDRESS_SPACE 0x10
38#define GPE1_BLK_ADDRESS_SPACE 0x20
39
40/* Only for clarity in declarations */
41
42typedef u64 IO_ADDRESS;
43
44#pragma pack(1)
45struct { /* Root System Descriptor Pointer */
46 NATIVE_CHAR signature[8]; /* contains "RSD PTR " */
47 u8 checksum; /* to make sum of struct == 0 */
48 NATIVE_CHAR oem_id[6]; /* OEM identification */
49 u8 reserved; /* Must be 0 for 1.0, 2 for 2.0 */
50 u64 rsdt_physical_address; /* 64-bit physical address of RSDT */
51};
52
53/*****************************************/
54/* IA64 Extensions to ACPI Spec Rev 0.71 */
55/* for the Root System Description Table */
56/*****************************************/
57struct {
58 struct acpi_table_header header; /* Table header */
59 u32 reserved_pad; /* IA64 alignment, must be 0 */
60 u64 table_offset_entry[1]; /* Array of pointers to other */
61 /* tables' headers */
62};
63
64/*******************************************/
65/* IA64 Extensions to ACPI Spec Rev 0.71 */
66/* for the Firmware ACPI Control Structure */
67/*******************************************/
68struct {
69 NATIVE_CHAR signature[4]; /* signature "FACS" */
70 u32 length; /* length of structure, in bytes */
71 u32 hardware_signature; /* hardware configuration signature */
72 u32 reserved4; /* must be 0 */
73 u64 firmware_waking_vector; /* ACPI OS waking vector */
74 u64 global_lock; /* Global Lock */
75 u32 S4bios_f:1; /* Indicates if S4BIOS support is present */
76 u32 reserved1:31; /* must be 0 */
77 u8 reserved3[28]; /* reserved - must be zero */
78};
79
80/******************************************/
81/* IA64 Extensions to ACPI Spec Rev 0.71 */
82/* for the Fixed ACPI Description Table */
83/******************************************/
84struct {
85 struct acpi_table_header header; /* table header */
86 u32 reserved_pad; /* IA64 alignment, must be 0 */
87 u64 firmware_ctrl; /* 64-bit Physical address of FACS */
88 u64 dsdt; /* 64-bit Physical address of DSDT */
89 u8 model; /* System Interrupt Model */
90 u8 address_space; /* Address Space Bitmask */
91 u16 sci_int; /* System vector of SCI interrupt */
92 u8 acpi_enable; /* value to write to smi_cmd to enable ACPI */
93 u8 acpi_disable; /* value to write to smi_cmd to disable ACPI */
94 u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */
95 u8 reserved2; /* reserved - must be zero */
96 u64 smi_cmd; /* Port address of SMI command port */
97 u64 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */
98 u64 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */
99 u64 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */
100 u64 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */
101 u64 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */
102 u64 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
103 u64 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */
104 u64 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */
105 u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */
106 u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */
107 u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */
108 u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */
109 u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */
110 u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */
111 u8 gpe1_base; /* offset in gpe model where gpe1 events start */
112 u8 reserved3; /* reserved */
113 u16 plvl2_lat; /* worst case HW latency to enter/exit C2 state */
114 u16 plvl3_lat; /* worst case HW latency to enter/exit C3 state */
115 u8 day_alrm; /* index to day-of-month alarm in RTC CMOS RAM */
116 u8 mon_alrm; /* index to month-of-year alarm in RTC CMOS RAM */
117 u8 century; /* index to century in RTC CMOS RAM */
118 u8 reserved4; /* reserved */
119 u32 flush_cash:1; /* PAL_FLUSH_CACHE is correctly supported */
120 u32 reserved5:1; /* reserved - must be zero */
121 u32 proc_c1:1; /* all processors support C1 state */
122 u32 plvl2_up:1; /* C2 state works on MP system */
123 u32 pwr_button:1; /* Power button is handled as a generic feature */
124 u32 sleep_button:1; /* Sleep button is handled as a generic feature, or not present */
125 u32 fixed_rTC:1; /* RTC wakeup stat not in fixed register space */
126 u32 rtcs4:1; /* RTC wakeup stat not possible from S4 */
127 u32 tmr_val_ext:1; /* tmr_val is 32 bits */
128 u32 dock_cap:1; /* Supports Docking */
129 u32 reserved6:22; /* reserved - must be zero */
130};
131
132#pragma pack()
133
134#endif /* __ACTBL71_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 64b603cfe92e..56bf492e7acc 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -48,7 +48,8 @@
48 48
49/* 49/*
50 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header 50 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
51 * and must be either 16, 32, or 64 51 * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
52 * 12/2006.
52 */ 53 */
53#ifndef ACPI_MACHINE_WIDTH 54#ifndef ACPI_MACHINE_WIDTH
54#error ACPI_MACHINE_WIDTH not defined 55#error ACPI_MACHINE_WIDTH not defined
@@ -149,7 +150,6 @@ typedef int INT32;
149typedef u64 acpi_native_uint; 150typedef u64 acpi_native_uint;
150typedef s64 acpi_native_int; 151typedef s64 acpi_native_int;
151 152
152typedef u64 acpi_table_ptr;
153typedef u64 acpi_io_address; 153typedef u64 acpi_io_address;
154typedef u64 acpi_physical_address; 154typedef u64 acpi_physical_address;
155 155
@@ -189,48 +189,15 @@ typedef int INT32;
189typedef u32 acpi_native_uint; 189typedef u32 acpi_native_uint;
190typedef s32 acpi_native_int; 190typedef s32 acpi_native_int;
191 191
192typedef u64 acpi_table_ptr;
193typedef u32 acpi_io_address; 192typedef u32 acpi_io_address;
194typedef u64 acpi_physical_address; 193typedef u32 acpi_physical_address;
195 194
196#define ACPI_MAX_PTR ACPI_UINT32_MAX 195#define ACPI_MAX_PTR ACPI_UINT32_MAX
197#define ACPI_SIZE_MAX ACPI_UINT32_MAX 196#define ACPI_SIZE_MAX ACPI_UINT32_MAX
198 197
199/*******************************************************************************
200 *
201 * Types specific to 16-bit targets
202 *
203 ******************************************************************************/
204
205#elif ACPI_MACHINE_WIDTH == 16
206
207/*! [Begin] no source code translation (keep the typedefs as-is) */
208
209typedef unsigned long UINT32;
210typedef short INT16;
211typedef long INT32;
212
213/*! [End] no source code translation !*/
214
215typedef u16 acpi_native_uint;
216typedef s16 acpi_native_int;
217
218typedef u32 acpi_table_ptr;
219typedef u32 acpi_io_address;
220typedef char *acpi_physical_address;
221
222#define ACPI_MAX_PTR ACPI_UINT16_MAX
223#define ACPI_SIZE_MAX ACPI_UINT16_MAX
224
225#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
226
227/* 64-bit integers cannot be supported */
228
229#define ACPI_NO_INTEGER64_SUPPORT
230
231#else 198#else
232 199
233/* ACPI_MACHINE_WIDTH must be either 64, 32, or 16 */ 200/* ACPI_MACHINE_WIDTH must be either 64 or 32 */
234 201
235#error unknown ACPI_MACHINE_WIDTH 202#error unknown ACPI_MACHINE_WIDTH
236#endif 203#endif
@@ -311,36 +278,6 @@ typedef acpi_native_uint acpi_size;
311 * 278 *
312 ******************************************************************************/ 279 ******************************************************************************/
313 280
314/*
315 * Pointer overlays to avoid lots of typecasting for
316 * code that accepts both physical and logical pointers.
317 */
318union acpi_pointers {
319 acpi_physical_address physical;
320 void *logical;
321 acpi_table_ptr value;
322};
323
324struct acpi_pointer {
325 u32 pointer_type;
326 union acpi_pointers pointer;
327};
328
329/* pointer_types for above */
330
331#define ACPI_PHYSICAL_POINTER 0x01
332#define ACPI_LOGICAL_POINTER 0x02
333
334/* Processor mode */
335
336#define ACPI_PHYSICAL_ADDRESSING 0x04
337#define ACPI_LOGICAL_ADDRESSING 0x08
338#define ACPI_MEMORY_MODE 0x0C
339
340#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
341#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
342#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
343
344/* Logical defines and NULL */ 281/* Logical defines and NULL */
345 282
346#ifdef FALSE 283#ifdef FALSE
@@ -407,7 +344,7 @@ typedef u32 acpi_integer;
407 344
408/* 64-bit integers */ 345/* 64-bit integers */
409 346
410typedef u64 acpi_integer; 347typedef unsigned long long acpi_integer;
411#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 348#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
412#define ACPI_INTEGER_BIT_SIZE 64 349#define ACPI_INTEGER_BIT_SIZE 64
413#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 350#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
@@ -442,7 +379,8 @@ typedef u64 acpi_integer;
442/* 379/*
443 * Initialization state 380 * Initialization state
444 */ 381 */
445#define ACPI_INITIALIZED_OK 0x01 382#define ACPI_SUBSYSTEM_INITIALIZE 0x01
383#define ACPI_INITIALIZED_OK 0x02
446 384
447/* 385/*
448 * Power state values 386 * Power state values
@@ -491,21 +429,6 @@ typedef u64 acpi_integer;
491#define ACPI_NOTIFY_POWER_FAULT (u8) 7 429#define ACPI_NOTIFY_POWER_FAULT (u8) 7
492 430
493/* 431/*
494 * Table types. These values are passed to the table related APIs
495 */
496typedef u32 acpi_table_type;
497
498#define ACPI_TABLE_ID_RSDP (acpi_table_type) 0
499#define ACPI_TABLE_ID_DSDT (acpi_table_type) 1
500#define ACPI_TABLE_ID_FADT (acpi_table_type) 2
501#define ACPI_TABLE_ID_FACS (acpi_table_type) 3
502#define ACPI_TABLE_ID_PSDT (acpi_table_type) 4
503#define ACPI_TABLE_ID_SSDT (acpi_table_type) 5
504#define ACPI_TABLE_ID_XSDT (acpi_table_type) 6
505#define ACPI_TABLE_ID_MAX 6
506#define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1)
507
508/*
509 * Types associated with ACPI names and objects. The first group of 432 * Types associated with ACPI names and objects. The first group of
510 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition 433 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
511 * of the ACPI object_type() operator (See the ACPI Spec). Therefore, 434 * of the ACPI object_type() operator (See the ACPI Spec). Therefore,
@@ -637,7 +560,7 @@ typedef u32 acpi_event_status;
637 * | | | +--- Type of dispatch -- to method, handler, or none 560 * | | | +--- Type of dispatch -- to method, handler, or none
638 * | | +--- Enabled for runtime? 561 * | | +--- Enabled for runtime?
639 * | +--- Enabled for wake? 562 * | +--- Enabled for wake?
640 * +--- System state when GPE ocurred (running/waking) 563 * +--- Unused
641 */ 564 */
642#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 565#define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01
643#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 566#define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01
@@ -663,10 +586,6 @@ typedef u32 acpi_event_status;
663 586
664#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ 587#define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */
665 588
666#define ACPI_GPE_SYSTEM_MASK (u8) 0x80
667#define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80
668#define ACPI_GPE_SYSTEM_WAKING (u8) 0x00
669
670/* 589/*
671 * Flags for GPE and Lock interfaces 590 * Flags for GPE and Lock interfaces
672 */ 591 */
@@ -816,13 +735,6 @@ struct acpi_buffer {
816#define ACPI_SYS_MODES_MASK 0x0003 735#define ACPI_SYS_MODES_MASK 0x0003
817 736
818/* 737/*
819 * ACPI Table Info. One per ACPI table _type_
820 */
821struct acpi_table_info {
822 u32 count;
823};
824
825/*
826 * System info returned by acpi_get_system_info() 738 * System info returned by acpi_get_system_info()
827 */ 739 */
828struct acpi_system_info { 740struct acpi_system_info {
@@ -833,8 +745,6 @@ struct acpi_system_info {
833 u32 reserved2; 745 u32 reserved2;
834 u32 debug_level; 746 u32 debug_level;
835 u32 debug_layer; 747 u32 debug_layer;
836 u32 num_table_types;
837 struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1];
838}; 748};
839 749
840/* 750/*
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index ba039ea1a057..883ffe92148f 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -141,8 +141,6 @@ acpi_status acpi_ut_hardware_initialize(void);
141 141
142void acpi_ut_subsystem_shutdown(void); 142void acpi_ut_subsystem_shutdown(void);
143 143
144acpi_status acpi_ut_validate_fadt(void);
145
146/* 144/*
147 * utclib - Local implementations of C library functions 145 * utclib - Local implementations of C library functions
148 */ 146 */
@@ -453,6 +451,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
453/* 451/*
454 * utmisc 452 * utmisc
455 */ 453 */
454const char *acpi_ut_validate_exception(acpi_status status);
455
456u8 acpi_ut_is_aml_table(struct acpi_table_header *table); 456u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
457 457
458acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 458acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
@@ -470,7 +470,7 @@ void acpi_ut_print_string(char *string, u8 max_length);
470 470
471u8 acpi_ut_valid_acpi_name(u32 name); 471u8 acpi_ut_valid_acpi_name(u32 name);
472 472
473acpi_name acpi_ut_repair_name(acpi_name name); 473acpi_name acpi_ut_repair_name(char *name);
474 474
475u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position); 475u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position);
476 476
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h
index cf18426a87b1..da53a4ef287a 100644
--- a/include/acpi/amlcode.h
+++ b/include/acpi/amlcode.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2006, R. Byron Moore 10 * Copyright (C) 2000 - 2007, R. Byron Moore
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
@@ -273,7 +273,7 @@
273#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */ 273#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by size_of operator */
274#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 274#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
275#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 275#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
276#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */ 276#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
277#define ARGI_DATAREFOBJ 0x16 277#define ARGI_DATAREFOBJ 0x16
278 278
279/* Note: types above can expand to 0x1F maximum */ 279/* Note: types above can expand to 0x1F maximum */
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h
index be03818af9d1..f7d541239da4 100644
--- a/include/acpi/amlresrc.h
+++ b/include/acpi/amlresrc.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2006, R. Byron Moore 9 * Copyright (C) 2000 - 2007, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 453a469fd397..dab2ec59a3b0 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index da80933963db..3bb50494a38a 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 7f1e92930b62..5f532d2ac180 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2006, R. Byron Moore 8 * Copyright (C) 2000 - 2007, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 7798d2a9f793..916c0102db5b 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -79,6 +79,7 @@ struct acpi_processor_power {
79 u32 bm_activity; 79 u32 bm_activity;
80 int count; 80 int count;
81 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; 81 struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
82 int timer_broadcast_on_state;
82}; 83};
83 84
84/* Performance Management */ 85/* Performance Management */
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index d2768cc3d7a4..da6bb199839c 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -17,9 +17,6 @@
17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift) 17# define __kernel_extbl(val, shift) __builtin_alpha_extbl(val, shift)
18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift) 18# define __kernel_extwl(val, shift) __builtin_alpha_extwl(val, shift)
19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b) 19# define __kernel_cmpbge(a, b) __builtin_alpha_cmpbge(a, b)
20# define __kernel_cttz(x) __builtin_ctzl(x)
21# define __kernel_ctlz(x) __builtin_clzl(x)
22# define __kernel_ctpop(x) __builtin_popcountl(x)
23#else 20#else
24# define __kernel_insbl(val, shift) \ 21# define __kernel_insbl(val, shift) \
25 ({ unsigned long __kir; \ 22 ({ unsigned long __kir; \
@@ -49,17 +46,39 @@
49 ({ unsigned long __kir; \ 46 ({ unsigned long __kir; \
50 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \ 47 __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
51 __kir; }) 48 __kir; })
49#endif
50
51#ifdef __alpha_cix__
52# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
53# define __kernel_cttz(x) __builtin_ctzl(x)
54# define __kernel_ctlz(x) __builtin_clzl(x)
55# define __kernel_ctpop(x) __builtin_popcountl(x)
56# else
57# define __kernel_cttz(x) \
58 ({ unsigned long __kir; \
59 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \
60 __kir; })
61# define __kernel_ctlz(x) \
62 ({ unsigned long __kir; \
63 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
64 __kir; })
65# define __kernel_ctpop(x) \
66 ({ unsigned long __kir; \
67 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
68 __kir; })
69# endif
70#else
52# define __kernel_cttz(x) \ 71# define __kernel_cttz(x) \
53 ({ unsigned long __kir; \ 72 ({ unsigned long __kir; \
54 __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x)); \ 73 __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x)); \
55 __kir; }) 74 __kir; })
56# define __kernel_ctlz(x) \ 75# define __kernel_ctlz(x) \
57 ({ unsigned long __kir; \ 76 ({ unsigned long __kir; \
58 __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x)); \ 77 __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x)); \
59 __kir; }) 78 __kir; })
60# define __kernel_ctpop(x) \ 79# define __kernel_ctpop(x) \
61 ({ unsigned long __kir; \ 80 ({ unsigned long __kir; \
62 __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x)); \ 81 __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x)); \
63 __kir; }) 82 __kir; })
64#endif 83#endif
65 84
@@ -78,16 +97,20 @@
78#else 97#else
79#define __kernel_ldbu(mem) \ 98#define __kernel_ldbu(mem) \
80 ({ unsigned char __kir; \ 99 ({ unsigned char __kir; \
81 __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \ 100 __asm__(".arch ev56; \
101 ldbu %0,%1" : "=r"(__kir) : "m"(mem)); \
82 __kir; }) 102 __kir; })
83#define __kernel_ldwu(mem) \ 103#define __kernel_ldwu(mem) \
84 ({ unsigned short __kir; \ 104 ({ unsigned short __kir; \
85 __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \ 105 __asm__(".arch ev56; \
106 ldwu %0,%1" : "=r"(__kir) : "m"(mem)); \
86 __kir; }) 107 __kir; })
87#define __kernel_stb(val,mem) \ 108#define __kernel_stb(val,mem) \
88 __asm__("stb %1,%0" : "=m"(mem) : "r"(val)) 109 __asm__(".arch ev56; \
89#define __kernel_stw(val,mem) \ 110 stb %1,%0" : "=m"(mem) : "r"(val))
90 __asm__("stw %1,%0" : "=m"(mem) : "r"(val)) 111#define __kernel_stw(val,mem) \
112 __asm__(".arch ev56; \
113 stw %1,%0" : "=m"(mem) : "r"(val))
91#endif 114#endif
92 115
93#ifdef __KERNEL__ 116#ifdef __KERNEL__
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
index 980a3c51b18e..525b4f6a7ace 100644
--- a/include/asm-alpha/core_mcpcia.h
+++ b/include/asm-alpha/core_mcpcia.h
@@ -72,6 +72,8 @@
72 * 72 *
73 */ 73 */
74 74
75#define MCPCIA_MAX_HOSES 4
76
75#define MCPCIA_MID(m) ((unsigned long)(m) << 33) 77#define MCPCIA_MID(m) ((unsigned long)(m) << 33)
76 78
77/* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively. 79/* Dodge has PCI0 and PCI1 at MID 4 and 5 respectively.
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index 57e09f5e3424..75a1aff5b57b 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -41,9 +41,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
41#define dma_map_single(dev, va, size, dir) virt_to_phys(va) 41#define dma_map_single(dev, va, size, dir) virt_to_phys(va)
42#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off) 42#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off)
43 43
44#define dma_unmap_single(dev, addr, size, dir) do { } while (0) 44#define dma_unmap_single(dev, addr, size, dir) ((void)0)
45#define dma_unmap_page(dev, addr, size, dir) do { } while (0) 45#define dma_unmap_page(dev, addr, size, dir) ((void)0)
46#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0) 46#define dma_unmap_sg(dev, sg, nents, dir) ((void)0)
47 47
48#define dma_mapping_error(addr) (0) 48#define dma_mapping_error(addr) (0)
49 49
@@ -55,12 +55,14 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
55 55
56int dma_set_mask(struct device *dev, u64 mask); 56int dma_set_mask(struct device *dev, u64 mask);
57 57
58#define dma_sync_single_for_cpu(dev, addr, size, dir) do { } while (0) 58#define dma_sync_single_for_cpu(dev, addr, size, dir) ((void)0)
59#define dma_sync_single_for_device(dev, addr, size, dir) do { } while (0) 59#define dma_sync_single_for_device(dev, addr, size, dir) ((void)0)
60#define dma_sync_single_range(dev, addr, off, size, dir) do { } while (0) 60#define dma_sync_single_range(dev, addr, off, size, dir) ((void)0)
61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) do { } while (0) 61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) ((void)0)
62#define dma_sync_sg_for_device(dev, sg, nents, dir) do { } while (0) 62#define dma_sync_sg_for_device(dev, sg, nents, dir) ((void)0)
63#define dma_cache_sync(dev, va, size, dir) do { } while (0) 63#define dma_cache_sync(dev, va, size, dir) ((void)0)
64#define dma_sync_single_range_for_cpu(dev, addr, offset, size, dir) ((void)0)
65#define dma_sync_single_range_for_device(dev, addr, offset, size, dir) ((void)0)
64 66
65#define dma_get_cache_alignment() L1_CACHE_BYTES 67#define dma_get_cache_alignment() L1_CACHE_BYTES
66 68
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 5d15af24573b..21a86f1a05b3 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -113,6 +113,7 @@ static inline unsigned long virt_to_bus(void *address)
113 unsigned long bus = phys + __direct_map_base; 113 unsigned long bus = phys + __direct_map_base;
114 return phys <= __direct_map_size ? bus : 0; 114 return phys <= __direct_map_size ? bus : 0;
115} 115}
116#define isa_virt_to_bus virt_to_bus
116 117
117static inline void *bus_to_virt(unsigned long address) 118static inline void *bus_to_virt(unsigned long address)
118{ 119{
@@ -525,15 +526,6 @@ extern void outsw (unsigned long port, const void *src, unsigned long count);
525extern void outsl (unsigned long port, const void *src, unsigned long count); 526extern void outsl (unsigned long port, const void *src, unsigned long count);
526 527
527/* 528/*
528 * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and
529 * just copy it. The net code will then do the checksum later. Presently
530 * only used by some shared memory 8390 Ethernet cards anyway.
531 */
532
533#define eth_io_copy_and_sum(skb,src,len,unused) \
534 memcpy_fromio((skb)->data,src,len)
535
536/*
537 * The Alpha Jensen hardware for some rather strange reason puts 529 * The Alpha Jensen hardware for some rather strange reason puts
538 * the RTC clock at 0x170 instead of 0x70. Probably due to some 530 * the RTC clock at 0x170 instead of 0x70. Probably due to some
539 * misguided idea about using 0x70 for NMI stuff. 531 * misguided idea about using 0x70 for NMI stuff.
diff --git a/include/asm-alpha/mman.h b/include/asm-alpha/mman.h
index 5f24c755f577..90d7c35d2867 100644
--- a/include/asm-alpha/mman.h
+++ b/include/asm-alpha/mman.h
@@ -49,7 +49,6 @@
49#define MADV_DOFORK 11 /* do inherit across fork */ 49#define MADV_DOFORK 11 /* do inherit across fork */
50 50
51/* compatibility flags */ 51/* compatibility flags */
52#define MAP_ANON MAP_ANONYMOUS
53#define MAP_FILE 0 52#define MAP_FILE 0
54 53
55#endif /* __ALPHA_MMAN_H__ */ 54#endif /* __ALPHA_MMAN_H__ */
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 4e115f368d5f..85aa1127c903 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -293,4 +293,6 @@ struct pci_dev *alpha_gendev_to_pci(struct device *dev);
293#define IOBASE_ROOT_BUS 5 293#define IOBASE_ROOT_BUS 5
294#define IOBASE_FROM_HOSE 0x10000 294#define IOBASE_FROM_HOSE 0x10000
295 295
296extern struct pci_dev *isa_bridge;
297
296#endif /* __ALPHA_PCI_H */ 298#endif /* __ALPHA_PCI_H */
diff --git a/include/asm-alpha/percpu.h b/include/asm-alpha/percpu.h
index 48348fe34c19..651ebb141b24 100644
--- a/include/asm-alpha/percpu.h
+++ b/include/asm-alpha/percpu.h
@@ -1,6 +1,20 @@
1#ifndef __ALPHA_PERCPU_H 1#ifndef __ALPHA_PERCPU_H
2#define __ALPHA_PERCPU_H 2#define __ALPHA_PERCPU_H
3 3
4/*
5 * Increase the per cpu area for Alpha so that
6 * modules using percpu area can load.
7 */
8#ifdef CONFIG_MODULES
9# define PERCPU_MODULE_RESERVE 8192
10#else
11# define PERCPU_MODULE_RESERVE 0
12#endif
13
14#define PERCPU_ENOUGH_ROOM \
15 (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \
16 PERCPU_MODULE_RESERVE)
17
4#include <asm-generic/percpu.h> 18#include <asm-generic/percpu.h>
5 19
6#endif /* __ALPHA_PERCPU_H */ 20#endif /* __ALPHA_PERCPU_H */
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index d22ab97ea72e..1fede7f92860 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -52,6 +52,8 @@
52 52
53#define SO_PEERSEC 30 53#define SO_PEERSEC 30
54#define SO_PASSSEC 34 54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
55 57
56/* Security levels - as per NRL IPv6 - don't actually do anything */ 58/* Security levels - as per NRL IPv6 - don't actually do anything */
57#define SO_SECURITY_AUTHENTICATION 19 59#define SO_SECURITY_AUTHENTICATION 19
diff --git a/include/asm-alpha/sockios.h b/include/asm-alpha/sockios.h
index e4961a740e5f..7932c7ab4a4d 100644
--- a/include/asm-alpha/sockios.h
+++ b/include/asm-alpha/sockios.h
@@ -10,6 +10,7 @@
10#define SIOCSPGRP _IOW('s', 8, pid_t) 10#define SIOCSPGRP _IOW('s', 8, pid_t)
11#define SIOCGPGRP _IOR('s', 9, pid_t) 11#define SIOCGPGRP _IOR('s', 9, pid_t)
12 12
13#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 13#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
14#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
14 15
15#endif /* _ASM_ALPHA_SOCKIOS_H */ 16#endif /* _ASM_ALPHA_SOCKIOS_H */
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h
index 9e44fea669bf..b02b8a282940 100644
--- a/include/asm-alpha/string.h
+++ b/include/asm-alpha/string.h
@@ -61,8 +61,6 @@ extern void * __memsetw(void *dest, unsigned short, size_t count);
61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \ 61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
62 : __memsetw((s),(c),(n))) 62 : __memsetw((s),(c),(n)))
63 63
64extern int strcasecmp(const char *, const char *);
65
66#endif /* __KERNEL__ */ 64#endif /* __KERNEL__ */
67 65
68#endif /* __ALPHA_STRING_H__ */ 66#endif /* __ALPHA_STRING_H__ */
diff --git a/include/asm-alpha/termios.h b/include/asm-alpha/termios.h
index 1cfd27f0ad73..39e492c3bfa3 100644
--- a/include/asm-alpha/termios.h
+++ b/include/asm-alpha/termios.h
@@ -66,24 +66,6 @@ struct termio {
66#define _VEOL2 6 66#define _VEOL2 6
67#define _VSWTC 7 67#define _VSWTC 7
68 68
69/* line disciplines */
70#define N_TTY 0
71#define N_SLIP 1
72#define N_MOUSE 2
73#define N_PPP 3
74#define N_STRIP 4
75#define N_AX25 5
76#define N_X25 6 /* X.25 async */
77#define N_6PACK 7
78#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
79#define N_R3964 9 /* Reserved for Simatic R3964 module */
80#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
81#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
82#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
83#define N_HDLC 13 /* synchronous HDLC */
84#define N_SYNC_PPP 14
85#define N_HCI 15 /* Bluetooth HCI UART */
86
87#ifdef __KERNEL__ 69#ifdef __KERNEL__
88/* eof=^D eol=\0 eol2=\0 erase=del 70/* eof=^D eol=\0 eol2=\0 erase=del
89 werase=^W kill=^U reprint=^R sxtc=\0 71 werase=^W kill=^U reprint=^R sxtc=\0
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 84313d14e780..e58a427012dd 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -342,9 +342,14 @@
342#define __NR_io_cancel 402 342#define __NR_io_cancel 402
343#define __NR_exit_group 405 343#define __NR_exit_group 405
344#define __NR_lookup_dcookie 406 344#define __NR_lookup_dcookie 406
345#define __NR_sys_epoll_create 407 345#define __NR_epoll_create 407
346#define __NR_sys_epoll_ctl 408 346#define __NR_epoll_ctl 408
347#define __NR_sys_epoll_wait 409 347#define __NR_epoll_wait 409
348/* Feb 2007: These three sys_epoll defines shouldn't be here but culling
349 * them would break userspace apps ... we'll kill them off in 2010 :) */
350#define __NR_sys_epoll_create __NR_epoll_create
351#define __NR_sys_epoll_ctl __NR_epoll_ctl
352#define __NR_sys_epoll_wait __NR_epoll_wait
348#define __NR_remap_file_pages 410 353#define __NR_remap_file_pages 410
349#define __NR_set_tid_address 411 354#define __NR_set_tid_address 411
350#define __NR_restart_syscall 412 355#define __NR_restart_syscall 412
diff --git a/include/asm-arm/.gitignore b/include/asm-arm/.gitignore
new file mode 100644
index 000000000000..e02c15d158fc
--- /dev/null
+++ b/include/asm-arm/.gitignore
@@ -0,0 +1,2 @@
1arch
2mach-types.h
diff --git a/include/asm-arm/arch-aaec2000/entry-macro.S b/include/asm-arm/arch-aaec2000/entry-macro.S
index 1eb3503bd16e..83fdf68f6b7c 100644
--- a/include/asm-arm/arch-aaec2000/entry-macro.S
+++ b/include/asm-arm/arch-aaec2000/entry-macro.S
@@ -15,6 +15,12 @@
15 .macro disable_fiq 15 .macro disable_fiq
16 .endm 16 .endm
17 17
18 .macro get_irqnr_preamble, base, tmp
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
18 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
19 mov r4, #0xf8000000 25 mov r4, #0xf8000000
20 add r4, r4, #0x00000500 26 add r4, r4, #0x00000500
diff --git a/include/asm-arm/arch-at91rm9200/at91_aic.h b/include/asm-arm/arch-at91/at91_aic.h
index 267e69812e26..df44c12a12d4 100644
--- a/include/asm-arm/arch-at91rm9200/at91_aic.h
+++ b/include/asm-arm/arch-at91/at91_aic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_aic.h 2 * include/asm-arm/arch-at91/at91_aic.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_dbgu.h b/include/asm-arm/arch-at91/at91_dbgu.h
index e4b8b27acfca..b0369e176f7b 100644
--- a/include/asm-arm/arch-at91rm9200/at91_dbgu.h
+++ b/include/asm-arm/arch-at91/at91_dbgu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_dbgu.h 2 * include/asm-arm/arch-at91/at91_dbgu.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -35,6 +35,20 @@
35#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */ 35#define AT91_CIDR_NVPSIZ (0xf << 8) /* Nonvolatile Program Memory Size */
36#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */ 36#define AT91_CIDR_NVPSIZ2 (0xf << 12) /* Second Nonvolatile Program Memory Size */
37#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */ 37#define AT91_CIDR_SRAMSIZ (0xf << 16) /* Internal SRAM Size */
38#define AT91_CIDR_SRAMSIZ_1K (1 << 16)
39#define AT91_CIDR_SRAMSIZ_2K (2 << 16)
40#define AT91_CIDR_SRAMSIZ_112K (4 << 16)
41#define AT91_CIDR_SRAMSIZ_4K (5 << 16)
42#define AT91_CIDR_SRAMSIZ_80K (6 << 16)
43#define AT91_CIDR_SRAMSIZ_160K (7 << 16)
44#define AT91_CIDR_SRAMSIZ_8K (8 << 16)
45#define AT91_CIDR_SRAMSIZ_16K (9 << 16)
46#define AT91_CIDR_SRAMSIZ_32K (10 << 16)
47#define AT91_CIDR_SRAMSIZ_64K (11 << 16)
48#define AT91_CIDR_SRAMSIZ_128K (12 << 16)
49#define AT91_CIDR_SRAMSIZ_256K (13 << 16)
50#define AT91_CIDR_SRAMSIZ_96K (14 << 16)
51#define AT91_CIDR_SRAMSIZ_512K (15 << 16)
38#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */ 52#define AT91_CIDR_ARCH (0xff << 20) /* Architecture Identifier */
39#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */ 53#define AT91_CIDR_NVPTYP (7 << 28) /* Nonvolatile Program Memory Type */
40#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */ 54#define AT91_CIDR_EXT (1 << 31) /* Extension Flag */
diff --git a/include/asm-arm/arch-at91rm9200/at91_ecc.h b/include/asm-arm/arch-at91/at91_ecc.h
index fddf256a98d3..ff93df516d6d 100644
--- a/include/asm-arm/arch-at91rm9200/at91_ecc.h
+++ b/include/asm-arm/arch-at91/at91_ecc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_ecc.h 2 * include/asm-arm/arch-at91/at91_ecc.h
3 * 3 *
4 * Error Corrected Code Controller (ECC) - System peripherals regsters. 4 * Error Corrected Code Controller (ECC) - System peripherals regsters.
5 * Based on AT91SAM9260 datasheet revision B. 5 * Based on AT91SAM9260 datasheet revision B.
@@ -14,7 +14,7 @@
14#define AT91_ECC_H 14#define AT91_ECC_H
15 15
16#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */ 16#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */
17#define AT91_ECC_RST (1 << 0) /* Reset parity */ 17#define AT91_ECC_RST (1 << 0) /* Reset parity */
18 18
19#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */ 19#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */
20#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */ 20#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */
@@ -23,16 +23,16 @@
23#define AT91_ECC_PAGESIZE_2112 (2) 23#define AT91_ECC_PAGESIZE_2112 (2)
24#define AT91_ECC_PAGESIZE_4224 (3) 24#define AT91_ECC_PAGESIZE_4224 (3)
25 25
26#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */ 26#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */
27#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */ 27#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */
28#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */ 28#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
29#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */ 29#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */
30 30
31#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */ 31#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */
32#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */ 32#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */
33#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */ 33#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
34 34
35#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */ 35#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */
36#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */ 36#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */
37 37
38#endif 38#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_lcdc.h b/include/asm-arm/arch-at91/at91_lcdc.h
index 9cbfcdd3c471..ab040a40d37b 100644
--- a/include/asm-arm/arch-at91rm9200/at91_lcdc.h
+++ b/include/asm-arm/arch-at91/at91_lcdc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_lcdc.h 2 * include/asm-arm/arch-at91/at91_lcdc.h
3 * 3 *
4 * LCD Controller (LCDC). 4 * LCD Controller (LCDC).
5 * Based on AT91SAM9261 datasheet revision E. 5 * Based on AT91SAM9261 datasheet revision E.
diff --git a/include/asm-arm/arch-at91rm9200/at91_mci.h b/include/asm-arm/arch-at91/at91_mci.h
index 9a552cb743c0..40a9876b661a 100644
--- a/include/asm-arm/arch-at91rm9200/at91_mci.h
+++ b/include/asm-arm/arch-at91/at91_mci.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_mci.h 2 * include/asm-arm/arch-at91/at91_mci.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_pio.h b/include/asm-arm/arch-at91/at91_pio.h
index 680eaa1f5915..84c3866d309f 100644
--- a/include/asm-arm/arch-at91rm9200/at91_pio.h
+++ b/include/asm-arm/arch-at91/at91_pio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_pio.h 2 * include/asm-arm/arch-at91/at91_pio.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_pit.h b/include/asm-arm/arch-at91/at91_pit.h
index 4a30d009c588..5026325a5ae4 100644
--- a/include/asm-arm/arch-at91rm9200/at91_pit.h
+++ b/include/asm-arm/arch-at91/at91_pit.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_pit.h 2 * include/asm-arm/arch-at91/at91_pit.h
3 * 3 *
4 * Periodic Interval Timer (PIT) - System peripherals regsters. 4 * Periodic Interval Timer (PIT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
diff --git a/include/asm-arm/arch-at91rm9200/at91_pmc.h b/include/asm-arm/arch-at91/at91_pmc.h
index de8c3da74a01..33ff5b6798ee 100644
--- a/include/asm-arm/arch-at91rm9200/at91_pmc.h
+++ b/include/asm-arm/arch-at91/at91_pmc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_pmc.h 2 * include/asm-arm/arch-at91/at91_pmc.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -61,7 +61,7 @@
61#define AT91_PMC_CSS_PLLA (2 << 0) 61#define AT91_PMC_CSS_PLLA (2 << 0)
62#define AT91_PMC_CSS_PLLB (3 << 0) 62#define AT91_PMC_CSS_PLLB (3 << 0)
63#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */ 63#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
64#define AT91_PMC_PRES_1 (0 << 2) 64#define AT91_PMC_PRES_1 (0 << 2)
65#define AT91_PMC_PRES_2 (1 << 2) 65#define AT91_PMC_PRES_2 (1 << 2)
66#define AT91_PMC_PRES_4 (2 << 2) 66#define AT91_PMC_PRES_4 (2 << 2)
67#define AT91_PMC_PRES_8 (3 << 2) 67#define AT91_PMC_PRES_8 (3 << 2)
diff --git a/include/asm-arm/arch-at91rm9200/at91_rstc.h b/include/asm-arm/arch-at91/at91_rstc.h
index ccdc52da973d..fb8d1618a231 100644
--- a/include/asm-arm/arch-at91rm9200/at91_rstc.h
+++ b/include/asm-arm/arch-at91/at91_rstc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_rstc.h 2 * include/asm-arm/arch-at91/at91_rstc.h
3 * 3 *
4 * Reset Controller (RSTC) - System peripherals regsters. 4 * Reset Controller (RSTC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
@@ -17,7 +17,7 @@
17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */ 17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */ 18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */ 19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
20#define AT01_RSTC_KEY (0xff << 24) /* KEY Password */ 20#define AT91_RSTC_KEY (0xa5 << 24) /* KEY Password */
21 21
22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */ 22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */
23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */ 23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
@@ -34,6 +34,5 @@
34#define AT91_RSTC_URSTEN (1 << 0) /* User Reset Enable */ 34#define AT91_RSTC_URSTEN (1 << 0) /* User Reset Enable */
35#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */ 35#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */
36#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */ 36#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */
37#define AT91_RSTC_KEY (0xff << 24) /* KEY Password */
38 37
39#endif 38#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_rtc.h b/include/asm-arm/arch-at91/at91_rtc.h
index 6e5065d56260..af9bd28174c0 100644
--- a/include/asm-arm/arch-at91rm9200/at91_rtc.h
+++ b/include/asm-arm/arch-at91/at91_rtc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_rtc.h 2 * include/asm-arm/arch-at91/at91_rtc.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -21,21 +21,21 @@
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ 21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ 22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8) 23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8) 24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8) 25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8) 26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */ 27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16) 28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16) 29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16) 30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31 31
32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */ 32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ 33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34 34
35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */ 35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */ 36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ 37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ 38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ 39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40 40
41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */ 41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
diff --git a/include/asm-arm/arch-at91rm9200/at91_rtt.h b/include/asm-arm/arch-at91/at91_rtt.h
index c6751ba3cccc..bae1103fbbb2 100644
--- a/include/asm-arm/arch-at91rm9200/at91_rtt.h
+++ b/include/asm-arm/arch-at91/at91_rtt.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_rtt.h 2 * include/asm-arm/arch-at91/at91_rtt.h
3 * 3 *
4 * Real-time Timer (RTT) - System peripherals regsters. 4 * Real-time Timer (RTT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
diff --git a/include/asm-arm/arch-at91rm9200/at91_shdwc.h b/include/asm-arm/arch-at91/at91_shdwc.h
index 0439250553c9..795fcc266228 100644
--- a/include/asm-arm/arch-at91rm9200/at91_shdwc.h
+++ b/include/asm-arm/arch-at91/at91_shdwc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_shdwc.h 2 * include/asm-arm/arch-at91/at91_shdwc.h
3 * 3 *
4 * Shutdown Controller (SHDWC) - System peripherals regsters. 4 * Shutdown Controller (SHDWC) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
diff --git a/include/asm-arm/arch-at91rm9200/at91_spi.h b/include/asm-arm/arch-at91/at91_spi.h
index bec48ca89bba..f9b9a8464997 100644
--- a/include/asm-arm/arch-at91rm9200/at91_spi.h
+++ b/include/asm-arm/arch-at91/at91_spi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_spi.h 2 * include/asm-arm/arch-at91/at91_spi.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_ssc.h b/include/asm-arm/arch-at91/at91_ssc.h
index 694bcaa8f7c2..0ecc73460b50 100644
--- a/include/asm-arm/arch-at91rm9200/at91_ssc.h
+++ b/include/asm-arm/arch-at91/at91_ssc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_ssc.h 2 * include/asm-arm/arch-at91/at91_ssc.h
3 * 3 *
4 * Copyright (C) SAN People 4 * Copyright (C) SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/at91_st.h b/include/asm-arm/arch-at91/at91_st.h
index 2432ddfc6c47..30446e2ea772 100644
--- a/include/asm-arm/arch-at91rm9200/at91_st.h
+++ b/include/asm-arm/arch-at91/at91_st.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_st.h 2 * include/asm-arm/arch-at91/at91_st.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_tc.h b/include/asm-arm/arch-at91/at91_tc.h
index 8d06eb078e1d..b85d3faeef5c 100644
--- a/include/asm-arm/arch-at91rm9200/at91_tc.h
+++ b/include/asm-arm/arch-at91/at91_tc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_tc.h 2 * include/asm-arm/arch-at91/at91_tc.h
3 * 3 *
4 * Copyright (C) SAN People 4 * Copyright (C) SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/at91_twi.h b/include/asm-arm/arch-at91/at91_twi.h
index cda914f1e740..ca9a90733456 100644
--- a/include/asm-arm/arch-at91rm9200/at91_twi.h
+++ b/include/asm-arm/arch-at91/at91_twi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_twi.h 2 * include/asm-arm/arch-at91/at91_twi.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91_wdt.h b/include/asm-arm/arch-at91/at91_wdt.h
index ac63e775772c..7251a344c740 100644
--- a/include/asm-arm/arch-at91rm9200/at91_wdt.h
+++ b/include/asm-arm/arch-at91/at91_wdt.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91_wdt.h 2 * include/asm-arm/arch-at91/at91_wdt.h
3 * 3 *
4 * Watchdog Timer (WDT) - System peripherals regsters. 4 * Watchdog Timer (WDT) - System peripherals regsters.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91/at91rm9200.h
index 4d51177efddd..a12ac8ab2ad0 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200.h
+++ b/include/asm-arm/arch-at91/at91rm9200.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200.h 2 * include/asm-arm/arch-at91/at91rm9200.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
@@ -274,7 +274,7 @@
274#define AT91_PD19_TPK7 (1 << 19) /* B: ETM Trace Packet Port 7 */ 274#define AT91_PD19_TPK7 (1 << 19) /* B: ETM Trace Packet Port 7 */
275#define AT91_PD20_NPCS3 (1 << 20) /* A: SPI Peripheral Chip Select 3 */ 275#define AT91_PD20_NPCS3 (1 << 20) /* A: SPI Peripheral Chip Select 3 */
276#define AT91_PD20_TPK8 (1 << 20) /* B: ETM Trace Packet Port 8 */ 276#define AT91_PD20_TPK8 (1 << 20) /* B: ETM Trace Packet Port 8 */
277#define AT91_PD21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */ 277#define AT91_PD21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */
278#define AT91_PD21_TPK9 (1 << 21) /* B: ETM Trace Packet Port 9 */ 278#define AT91_PD21_TPK9 (1 << 21) /* B: ETM Trace Packet Port 9 */
279#define AT91_PD22_RTS1 (1 << 22) /* A: USART Ready To Send 1 */ 279#define AT91_PD22_RTS1 (1 << 22) /* A: USART Ready To Send 1 */
280#define AT91_PD22_TPK10 (1 << 22) /* B: ETM Trace Packet Port 10 */ 280#define AT91_PD22_TPK10 (1 << 22) /* B: ETM Trace Packet Port 10 */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_emac.h b/include/asm-arm/arch-at91/at91rm9200_emac.h
index fbc091e61e2f..0c417af5fe7f 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_emac.h
+++ b/include/asm-arm/arch-at91/at91rm9200_emac.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_emac.h 2 * include/asm-arm/arch-at91/at91rm9200_emac.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200_mc.h b/include/asm-arm/arch-at91/at91rm9200_mc.h
index 0c0d81480b3a..24d012939cc4 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200_mc.h
+++ b/include/asm-arm/arch-at91/at91rm9200_mc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91rm9200_mc.h 2 * include/asm-arm/arch-at91/at91rm9200_mc.h
3 * 3 *
4 * Copyright (C) 2005 Ivan Kokshaysky 4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People 5 * Copyright (C) SAN People
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9260.h b/include/asm-arm/arch-at91/at91sam9260.h
index 46f4dd65c035..2cadebc36af7 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9260.h
+++ b/include/asm-arm/arch-at91/at91sam9260.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9260.h 2 * include/asm-arm/arch-at91/at91sam9260.h
3 * 3 *
4 * (C) 2006 Andrew Victor 4 * (C) 2006 Andrew Victor
5 * 5 *
@@ -113,6 +113,10 @@
113 113
114#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */ 114#define AT91SAM9260_UHP_BASE 0x00500000 /* USB Host controller */
115 115
116#define AT91SAM9XE_FLASH_BASE 0x00200000 /* Internal FLASH base address */
117#define AT91SAM9XE_SRAM_BASE 0x00300000 /* Internal SRAM base address */
118
119
116#if 0 120#if 0
117/* 121/*
118 * PIO pin definitions (peripheral A/B multiplexing). 122 * PIO pin definitions (peripheral A/B multiplexing).
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h b/include/asm-arm/arch-at91/at91sam9260_matrix.h
index 746d973705bf..aacb1e976422 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
+++ b/include/asm-arm/arch-at91/at91sam9260_matrix.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h 2 * include/asm-arm/arch-at91/at91sam9260_matrix.h
3 * 3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers. 4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9260 datasheet revision B. 5 * Based on AT91SAM9260 datasheet revision B.
@@ -18,7 +18,7 @@
18#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */ 18#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
19#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */ 19#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
20#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */ 20#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
21#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x04) /* Master Configuration Register 5 */ 21#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
22#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */ 22#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
23#define AT91_MATRIX_ULBT_INFINITE (0 << 0) 23#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
24#define AT91_MATRIX_ULBT_SINGLE (1 << 0) 24#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
@@ -58,7 +58,7 @@
58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
59 59
60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */ 60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */
61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
62#define AT91_MATRIX_CS1A_SMC (0 << 1) 62#define AT91_MATRIX_CS1A_SMC (0 << 1)
63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9261.h b/include/asm-arm/arch-at91/at91sam9261.h
index 8d39672d5b82..01b58ffe2e27 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9261.h
+++ b/include/asm-arm/arch-at91/at91sam9261.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9261.h 2 * include/asm-arm/arch-at91/at91sam9261.h
3 * 3 *
4 * Copyright (C) SAN People 4 * Copyright (C) SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h b/include/asm-arm/arch-at91/at91sam9261_matrix.h
index 270a5dcdf1cd..6f072421be5b 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
+++ b/include/asm-arm/arch-at91/at91sam9261_matrix.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h 2 * include/asm-arm/arch-at91/at91sam9261_matrix.h
3 * 3 *
4 * Memory Controllers (MATRIX, EBI) - System peripherals registers. 4 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
@@ -15,7 +15,7 @@
15 15
16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */ 16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */
17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
18#define AT01_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 18#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
19 19
20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */ 20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */
21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */ 21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */
@@ -43,8 +43,8 @@
43 43
44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */ 44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */
45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
46#define AT91_MATRIX_CS1A_SMC (0 << 1) 46#define AT91_MATRIX_CS1A_SMC (0 << 1)
47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
49#define AT91_MATRIX_CS3A_SMC (0 << 3) 49#define AT91_MATRIX_CS3A_SMC (0 << 3)
50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3) 50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
diff --git a/include/asm-arm/arch-at91/at91sam9263.h b/include/asm-arm/arch-at91/at91sam9263.h
new file mode 100644
index 000000000000..f4af68ae0ea9
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91sam9263.h
@@ -0,0 +1,131 @@
1/*
2 * include/asm-arm/arch-at91/at91sam9263.h
3 *
4 * (C) 2007 Atmel Corporation.
5 *
6 * Common definitions.
7 * Based on AT91SAM9263 datasheet revision B (Preliminary).
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91SAM9263_H
16#define AT91SAM9263_H
17
18/*
19 * Peripheral identifiers/interrupts.
20 */
21#define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */
22#define AT91_ID_SYS 1 /* System Peripherals */
23#define AT91SAM9263_ID_PIOA 2 /* Parallel IO Controller A */
24#define AT91SAM9263_ID_PIOB 3 /* Parallel IO Controller B */
25#define AT91SAM9263_ID_PIOCDE 4 /* Parallel IO Controller C, D and E */
26#define AT91SAM9263_ID_US0 7 /* USART 0 */
27#define AT91SAM9263_ID_US1 8 /* USART 1 */
28#define AT91SAM9263_ID_US2 9 /* USART 2 */
29#define AT91SAM9263_ID_MCI0 10 /* Multimedia Card Interface 0 */
30#define AT91SAM9263_ID_MCI1 11 /* Multimedia Card Interface 1 */
31#define AT91SAM9263_ID_CAN 12 /* CAN */
32#define AT91SAM9263_ID_TWI 13 /* Two-Wire Interface */
33#define AT91SAM9263_ID_SPI0 14 /* Serial Peripheral Interface 0 */
34#define AT91SAM9263_ID_SPI1 15 /* Serial Peripheral Interface 1 */
35#define AT91SAM9263_ID_SSC0 16 /* Serial Synchronous Controller 0 */
36#define AT91SAM9263_ID_SSC1 17 /* Serial Synchronous Controller 1 */
37#define AT91SAM9263_ID_AC97C 18 /* AC97 Controller */
38#define AT91SAM9263_ID_TCB 19 /* Timer Counter 0, 1 and 2 */
39#define AT91SAM9263_ID_PWMC 20 /* Pulse Width Modulation Controller */
40#define AT91SAM9263_ID_EMAC 21 /* Ethernet */
41#define AT91SAM9263_ID_2DGE 23 /* 2D Graphic Engine */
42#define AT91SAM9263_ID_UDP 24 /* USB Device Port */
43#define AT91SAM9263_ID_ISI 25 /* Image Sensor Interface */
44#define AT91SAM9263_ID_LCDC 26 /* LCD Controller */
45#define AT91SAM9263_ID_DMA 27 /* DMA Controller */
46#define AT91SAM9263_ID_UHP 29 /* USB Host port */
47#define AT91SAM9263_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
48#define AT91SAM9263_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
49
50
51/*
52 * User Peripheral physical base addresses.
53 */
54#define AT91SAM9263_BASE_UDP 0xfff78000
55#define AT91SAM9263_BASE_TCB0 0xfff7c000
56#define AT91SAM9263_BASE_TC0 0xfff7c000
57#define AT91SAM9263_BASE_TC1 0xfff7c040
58#define AT91SAM9263_BASE_TC2 0xfff7c080
59#define AT91SAM9263_BASE_MCI0 0xfff80000
60#define AT91SAM9263_BASE_MCI1 0xfff84000
61#define AT91SAM9263_BASE_TWI 0xfff88000
62#define AT91SAM9263_BASE_US0 0xfff8c000
63#define AT91SAM9263_BASE_US1 0xfff90000
64#define AT91SAM9263_BASE_US2 0xfff94000
65#define AT91SAM9263_BASE_SSC0 0xfff98000
66#define AT91SAM9263_BASE_SSC1 0xfff9c000
67#define AT91SAM9263_BASE_AC97C 0xfffa0000
68#define AT91SAM9263_BASE_SPI0 0xfffa4000
69#define AT91SAM9263_BASE_SPI1 0xfffa8000
70#define AT91SAM9263_BASE_CAN 0xfffac000
71#define AT91SAM9263_BASE_PWMC 0xfffb8000
72#define AT91SAM9263_BASE_EMAC 0xfffbc000
73#define AT91SAM9263_BASE_ISI 0xfffc4000
74#define AT91SAM9263_BASE_2DGE 0xfffc8000
75#define AT91_BASE_SYS 0xffffe000
76
77/*
78 * System Peripherals (offset from AT91_BASE_SYS)
79 */
80#define AT91_ECC0 (0xffffe000 - AT91_BASE_SYS)
81#define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS)
82#define AT91_SMC0 (0xffffe400 - AT91_BASE_SYS)
83#define AT91_ECC1 (0xffffe600 - AT91_BASE_SYS)
84#define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS)
85#define AT91_SMC1 (0xffffea00 - AT91_BASE_SYS)
86#define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS)
87#define AT91_CCFG (0xffffed10 - AT91_BASE_SYS)
88#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS)
89#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
90#define AT91_PIOA (0xfffff200 - AT91_BASE_SYS)
91#define AT91_PIOB (0xfffff400 - AT91_BASE_SYS)
92#define AT91_PIOC (0xfffff600 - AT91_BASE_SYS)
93#define AT91_PIOD (0xfffff800 - AT91_BASE_SYS)
94#define AT91_PIOE (0xfffffa00 - AT91_BASE_SYS)
95#define AT91_PMC (0xfffffc00 - AT91_BASE_SYS)
96#define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS)
97#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS)
98#define AT91_RTT0 (0xfffffd20 - AT91_BASE_SYS)
99#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS)
100#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS)
101#define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS)
102#define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS)
103
104#define AT91_SMC AT91_SMC0
105
106/*
107 * Internal Memory.
108 */
109#define AT91SAM9263_SRAM0_BASE 0x00300000 /* Internal SRAM 0 base address */
110#define AT91SAM9263_SRAM0_SIZE (80 * SZ_1K) /* Internal SRAM 0 size (80Kb) */
111
112#define AT91SAM9263_ROM_BASE 0x00400000 /* Internal ROM base address */
113#define AT91SAM9263_ROM_SIZE SZ_128K /* Internal ROM size (128Kb) */
114
115#define AT91SAM9263_SRAM1_BASE 0x00500000 /* Internal SRAM 1 base address */
116#define AT91SAM9263_SRAM1_SIZE SZ_16K /* Internal SRAM 1 size (16Kb) */
117
118#define AT91SAM9263_LCDC_BASE 0x00700000 /* LCD Controller */
119#define AT91SAM9263_DMAC_BASE 0x00800000 /* DMA Controller */
120#define AT91SAM9263_UHP_BASE 0x00a00000 /* USB Host controller */
121
122#if 0
123/*
124 * PIO pin definitions (peripheral A/B multiplexing).
125 */
126
127// TODO: Add
128
129#endif
130
131#endif
diff --git a/include/asm-arm/arch-at91/at91sam9263_matrix.h b/include/asm-arm/arch-at91/at91sam9263_matrix.h
new file mode 100644
index 000000000000..6fc6e4be624e
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91sam9263_matrix.h
@@ -0,0 +1,129 @@
1/*
2 * include/asm-arm/arch-at91/at91sam9263_matrix.h
3 *
4 * Copyright (C) 2006 Atmel Corporation.
5 *
6 * Memory Controllers (MATRIX, EBI) - System peripherals registers.
7 * Based on AT91SAM9263 datasheet revision B (Preliminary).
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef AT91SAM9263_MATRIX_H
16#define AT91SAM9263_MATRIX_H
17
18#define AT91_MATRIX_MCFG0 (AT91_MATRIX + 0x00) /* Master Configuration Register 0 */
19#define AT91_MATRIX_MCFG1 (AT91_MATRIX + 0x04) /* Master Configuration Register 1 */
20#define AT91_MATRIX_MCFG2 (AT91_MATRIX + 0x08) /* Master Configuration Register 2 */
21#define AT91_MATRIX_MCFG3 (AT91_MATRIX + 0x0C) /* Master Configuration Register 3 */
22#define AT91_MATRIX_MCFG4 (AT91_MATRIX + 0x10) /* Master Configuration Register 4 */
23#define AT91_MATRIX_MCFG5 (AT91_MATRIX + 0x14) /* Master Configuration Register 5 */
24#define AT91_MATRIX_MCFG6 (AT91_MATRIX + 0x18) /* Master Configuration Register 6 */
25#define AT91_MATRIX_MCFG7 (AT91_MATRIX + 0x1C) /* Master Configuration Register 7 */
26#define AT91_MATRIX_MCFG8 (AT91_MATRIX + 0x20) /* Master Configuration Register 8 */
27#define AT91_MATRIX_ULBT (7 << 0) /* Undefined Length Burst Type */
28#define AT91_MATRIX_ULBT_INFINITE (0 << 0)
29#define AT91_MATRIX_ULBT_SINGLE (1 << 0)
30#define AT91_MATRIX_ULBT_FOUR (2 << 0)
31#define AT91_MATRIX_ULBT_EIGHT (3 << 0)
32#define AT91_MATRIX_ULBT_SIXTEEN (4 << 0)
33
34#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x40) /* Slave Configuration Register 0 */
35#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x44) /* Slave Configuration Register 1 */
36#define AT91_MATRIX_SCFG2 (AT91_MATRIX + 0x48) /* Slave Configuration Register 2 */
37#define AT91_MATRIX_SCFG3 (AT91_MATRIX + 0x4C) /* Slave Configuration Register 3 */
38#define AT91_MATRIX_SCFG4 (AT91_MATRIX + 0x50) /* Slave Configuration Register 4 */
39#define AT91_MATRIX_SCFG5 (AT91_MATRIX + 0x54) /* Slave Configuration Register 5 */
40#define AT91_MATRIX_SCFG6 (AT91_MATRIX + 0x58) /* Slave Configuration Register 6 */
41#define AT91_MATRIX_SCFG7 (AT91_MATRIX + 0x5C) /* Slave Configuration Register 7 */
42#define AT91_MATRIX_SLOT_CYCLE (0xff << 0) /* Maximum Number of Allowed Cycles for a Burst */
43#define AT91_MATRIX_DEFMSTR_TYPE (3 << 16) /* Default Master Type */
44#define AT91_MATRIX_DEFMSTR_TYPE_NONE (0 << 16)
45#define AT91_MATRIX_DEFMSTR_TYPE_LAST (1 << 16)
46#define AT91_MATRIX_DEFMSTR_TYPE_FIXED (2 << 16)
47#define AT91_MATRIX_FIXED_DEFMSTR (7 << 18) /* Fixed Index of Default Master */
48#define AT91_MATRIX_ARBT (3 << 24) /* Arbitration Type */
49#define AT91_MATRIX_ARBT_ROUND_ROBIN (0 << 24)
50#define AT91_MATRIX_ARBT_FIXED_PRIORITY (1 << 24)
51
52#define AT91_MATRIX_PRAS0 (AT91_MATRIX + 0x80) /* Priority Register A for Slave 0 */
53#define AT91_MATRIX_PRBS0 (AT91_MATRIX + 0x84) /* Priority Register B for Slave 0 */
54#define AT91_MATRIX_PRAS1 (AT91_MATRIX + 0x88) /* Priority Register A for Slave 1 */
55#define AT91_MATRIX_PRBS1 (AT91_MATRIX + 0x8C) /* Priority Register B for Slave 1 */
56#define AT91_MATRIX_PRAS2 (AT91_MATRIX + 0x90) /* Priority Register A for Slave 2 */
57#define AT91_MATRIX_PRBS2 (AT91_MATRIX + 0x94) /* Priority Register B for Slave 2 */
58#define AT91_MATRIX_PRAS3 (AT91_MATRIX + 0x98) /* Priority Register A for Slave 3 */
59#define AT91_MATRIX_PRBS3 (AT91_MATRIX + 0x9C) /* Priority Register B for Slave 3 */
60#define AT91_MATRIX_PRAS4 (AT91_MATRIX + 0xA0) /* Priority Register A for Slave 4 */
61#define AT91_MATRIX_PRBS4 (AT91_MATRIX + 0xA4) /* Priority Register B for Slave 4 */
62#define AT91_MATRIX_PRAS5 (AT91_MATRIX + 0xA8) /* Priority Register A for Slave 5 */
63#define AT91_MATRIX_PRBS5 (AT91_MATRIX + 0xAC) /* Priority Register B for Slave 5 */
64#define AT91_MATRIX_PRAS6 (AT91_MATRIX + 0xB0) /* Priority Register A for Slave 6 */
65#define AT91_MATRIX_PRBS6 (AT91_MATRIX + 0xB4) /* Priority Register B for Slave 6 */
66#define AT91_MATRIX_PRAS7 (AT91_MATRIX + 0xB8) /* Priority Register A for Slave 7 */
67#define AT91_MATRIX_PRBS7 (AT91_MATRIX + 0xBC) /* Priority Register B for Slave 7 */
68#define AT91_MATRIX_M0PR (3 << 0) /* Master 0 Priority */
69#define AT91_MATRIX_M1PR (3 << 4) /* Master 1 Priority */
70#define AT91_MATRIX_M2PR (3 << 8) /* Master 2 Priority */
71#define AT91_MATRIX_M3PR (3 << 12) /* Master 3 Priority */
72#define AT91_MATRIX_M4PR (3 << 16) /* Master 4 Priority */
73#define AT91_MATRIX_M5PR (3 << 20) /* Master 5 Priority */
74#define AT91_MATRIX_M6PR (3 << 24) /* Master 6 Priority */
75#define AT91_MATRIX_M7PR (3 << 28) /* Master 7 Priority */
76#define AT91_MATRIX_M8PR (3 << 0) /* Master 8 Priority (in Register B) */
77
78#define AT91_MATRIX_MRCR (AT91_MATRIX + 0x100) /* Master Remap Control Register */
79#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
80#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
81#define AT91_MATRIX_RCB2 (1 << 2)
82#define AT91_MATRIX_RCB3 (1 << 3)
83#define AT91_MATRIX_RCB4 (1 << 4)
84#define AT91_MATRIX_RCB5 (1 << 5)
85#define AT91_MATRIX_RCB6 (1 << 6)
86#define AT91_MATRIX_RCB7 (1 << 7)
87#define AT91_MATRIX_RCB8 (1 << 8)
88
89#define AT91_MATRIX_TCMR (AT91_MATRIX + 0x114) /* TCM Configuration Register */
90#define AT91_MATRIX_ITCM_SIZE (0xf << 0) /* Size of ITCM enabled memory block */
91#define AT91_MATRIX_ITCM_0 (0 << 0)
92#define AT91_MATRIX_ITCM_16 (5 << 0)
93#define AT91_MATRIX_ITCM_32 (6 << 0)
94#define AT91_MATRIX_DTCM_SIZE (0xf << 4) /* Size of DTCM enabled memory block */
95#define AT91_MATRIX_DTCM_0 (0 << 4)
96#define AT91_MATRIX_DTCM_16 (5 << 4)
97#define AT91_MATRIX_DTCM_32 (6 << 4)
98
99#define AT91_MATRIX_EBI0CSA (AT91_MATRIX + 0x120) /* EBI0 Chip Select Assignment Register */
100#define AT91_MATRIX_EBI0_CS1A (1 << 1) /* Chip Select 1 Assignment */
101#define AT91_MATRIX_EBI0_CS1A_SMC (0 << 1)
102#define AT91_MATRIX_EBI0_CS1A_SDRAMC (1 << 1)
103#define AT91_MATRIX_EBI0_CS3A (1 << 3) /* Chip Select 3 Assignment */
104#define AT91_MATRIX_EBI0_CS3A_SMC (0 << 3)
105#define AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA (1 << 3)
106#define AT91_MATRIX_EBI0_CS4A (1 << 4) /* Chip Select 4 Assignment */
107#define AT91_MATRIX_EBI0_CS4A_SMC (0 << 4)
108#define AT91_MATRIX_EBI0_CS4A_SMC_CF1 (1 << 4)
109#define AT91_MATRIX_EBI0_CS5A (1 << 5) /* Chip Select 5 Assignment */
110#define AT91_MATRIX_EBI0_CS5A_SMC (0 << 5)
111#define AT91_MATRIX_EBI0_CS5A_SMC_CF2 (1 << 5)
112#define AT91_MATRIX_EBI0_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
113#define AT91_MATRIX_EBI0_VDDIOMSEL (1 << 16) /* Memory voltage selection */
114#define AT91_MATRIX_EBI0_VDDIOMSEL_1_8V (0 << 16)
115#define AT91_MATRIX_EBI0_VDDIOMSEL_3_3V (1 << 16)
116
117#define AT91_MATRIX_EBI1CSA (AT91_MATRIX + 0x124) /* EBI1 Chip Select Assignment Register */
118#define AT91_MATRIX_EBI1_CS1A (1 << 1) /* Chip Select 1 Assignment */
119#define AT91_MATRIX_EBI1_CS1A_SMC (0 << 1)
120#define AT91_MATRIX_EBI1_CS1A_SDRAMC (1 << 1)
121#define AT91_MATRIX_EBI1_CS2A (1 << 3) /* Chip Select 3 Assignment */
122#define AT91_MATRIX_EBI1_CS2A_SMC (0 << 3)
123#define AT91_MATRIX_EBI1_CS2A_SMC_SMARTMEDIA (1 << 3)
124#define AT91_MATRIX_EBI1_DBPUC (1 << 8) /* Data Bus Pull-up Configuration */
125#define AT91_MATRIX_EBI1_VDDIOMSEL (1 << 16) /* Memory voltage selection */
126#define AT91_MATRIX_EBI1_VDDIOMSEL_1_8V (0 << 16)
127#define AT91_MATRIX_EBI1_VDDIOMSEL_3_3V (1 << 16)
128
129#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h b/include/asm-arm/arch-at91/at91sam926x_mc.h
index 7d94968b5d57..d82631c251f1 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
+++ b/include/asm-arm/arch-at91/at91sam926x_mc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/at91sam926x_mc.h 2 * include/asm-arm/arch-at91/at91sam926x_mc.h
3 * 3 *
4 * Memory Controllers (SMC, SDRAMC) - System peripherals registers. 4 * Memory Controllers (SMC, SDRAMC) - System peripherals registers.
5 * Based on AT91SAM9261 datasheet revision D. 5 * Based on AT91SAM9261 datasheet revision D.
@@ -33,14 +33,14 @@
33#define AT91_SDRAMC_NC_9 (1 << 0) 33#define AT91_SDRAMC_NC_9 (1 << 0)
34#define AT91_SDRAMC_NC_10 (2 << 0) 34#define AT91_SDRAMC_NC_10 (2 << 0)
35#define AT91_SDRAMC_NC_11 (3 << 0) 35#define AT91_SDRAMC_NC_11 (3 << 0)
36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */ 36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
37#define AT91_SDRAMC_NR_11 (0 << 2) 37#define AT91_SDRAMC_NR_11 (0 << 2)
38#define AT91_SDRAMC_NR_12 (1 << 2) 38#define AT91_SDRAMC_NR_12 (1 << 2)
39#define AT91_SDRAMC_NR_13 (2 << 2) 39#define AT91_SDRAMC_NR_13 (2 << 2)
40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */ 40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
41#define AT91_SDRAMC_NB_2 (0 << 4) 41#define AT91_SDRAMC_NB_2 (0 << 4)
42#define AT91_SDRAMC_NB_4 (1 << 4) 42#define AT91_SDRAMC_NB_4 (1 << 4)
43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */ 43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
44#define AT91_SDRAMC_CAS_1 (1 << 5) 44#define AT91_SDRAMC_CAS_1 (1 << 5)
45#define AT91_SDRAMC_CAS_2 (2 << 5) 45#define AT91_SDRAMC_CAS_2 (2 << 5)
46#define AT91_SDRAMC_CAS_3 (3 << 5) 46#define AT91_SDRAMC_CAS_3 (3 << 5)
@@ -110,10 +110,10 @@
110#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ 110#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
111#define AT91_SMC_READMODE (1 << 0) /* Read Mode */ 111#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
112#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */ 112#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
113#define AT91_SMC_EXNWMODE (3 << 5) /* NWAIT Mode */ 113#define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */
114#define AT91_SMC_EXNWMODE_DISABLE (0 << 5) 114#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
115#define AT91_SMC_EXNWMODE_FROZEN (2 << 5) 115#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
116#define AT91_SMC_EXNWMODE_READY (3 << 5) 116#define AT91_SMC_EXNWMODE_READY (3 << 4)
117#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */ 117#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
118#define AT91_SMC_BAT_SELECT (0 << 8) 118#define AT91_SMC_BAT_SELECT (0 << 8)
119#define AT91_SMC_BAT_WRITE (1 << 8) 119#define AT91_SMC_BAT_WRITE (1 << 8)
@@ -131,4 +131,11 @@
131#define AT91_SMC_PS_16 (2 << 28) 131#define AT91_SMC_PS_16 (2 << 28)
132#define AT91_SMC_PS_32 (3 << 28) 132#define AT91_SMC_PS_32 (3 << 28)
133 133
134#if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */
135#define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
136#define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */
137#define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */
138#define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
139#endif
140
134#endif 141#endif
diff --git a/include/asm-arm/arch-at91rm9200/board.h b/include/asm-arm/arch-at91/board.h
index 768e0fc6aa2f..7b9903c2c447 100644
--- a/include/asm-arm/arch-at91rm9200/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/board.h 2 * include/asm-arm/arch-at91/board.h
3 * 3 *
4 * Copyright (C) 2005 HP Labs 4 * Copyright (C) 2005 HP Labs
5 * 5 *
@@ -60,7 +60,7 @@ struct at91_mmc_data {
60 u8 wp_pin; /* (SD) writeprotect detect */ 60 u8 wp_pin; /* (SD) writeprotect detect */
61 u8 vcc_pin; /* power switching (high == on) */ 61 u8 vcc_pin; /* power switching (high == on) */
62}; 62};
63extern void __init at91_add_device_mmc(struct at91_mmc_data *data); 63extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
64 64
65 /* Ethernet */ 65 /* Ethernet */
66struct at91_eth_data { 66struct at91_eth_data {
@@ -69,9 +69,14 @@ struct at91_eth_data {
69}; 69};
70extern void __init at91_add_device_eth(struct at91_eth_data *data); 70extern void __init at91_add_device_eth(struct at91_eth_data *data);
71 71
72#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263)
73#define eth_platform_data at91_eth_data
74#endif
75
72 /* USB Host */ 76 /* USB Host */
73struct at91_usbh_data { 77struct at91_usbh_data {
74 u8 ports; /* number of ports on root hub */ 78 u8 ports; /* number of ports on root hub */
79 u8 vbus_pin[]; /* port power-control pin */
75}; 80};
76extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 81extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
77 82
diff --git a/include/asm-arm/arch-at91rm9200/cpu.h b/include/asm-arm/arch-at91/cpu.h
index 6f8d09b08692..d464ca58cdbc 100644
--- a/include/asm-arm/arch-at91rm9200/cpu.h
+++ b/include/asm-arm/arch-at91/cpu.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/cpu.h 2 * include/asm-arm/arch-at91/cpu.h
3 * 3 *
4 * Copyright (C) 2006 SAN People 4 * Copyright (C) 2006 SAN People
5 * 5 *
@@ -20,7 +20,11 @@
20#define ARCH_ID_AT91RM9200 0x09290780 20#define ARCH_ID_AT91RM9200 0x09290780
21#define ARCH_ID_AT91SAM9260 0x019803a0 21#define ARCH_ID_AT91SAM9260 0x019803a0
22#define ARCH_ID_AT91SAM9261 0x019703a0 22#define ARCH_ID_AT91SAM9261 0x019703a0
23#define ARCH_ID_AT91SAM9263 0x019607a0
23 24
25#define ARCH_ID_AT91SAM9XE128 0x329973a0
26#define ARCH_ID_AT91SAM9XE256 0x329a93a0
27#define ARCH_ID_AT91SAM9XE512 0x329aa3a0
24 28
25static inline unsigned long at91_cpu_identify(void) 29static inline unsigned long at91_cpu_identify(void)
26{ 30{
@@ -28,6 +32,16 @@ static inline unsigned long at91_cpu_identify(void)
28} 32}
29 33
30 34
35#define ARCH_FAMILY_AT91X92 0x09200000
36#define ARCH_FAMILY_AT91SAM9 0x01900000
37#define ARCH_FAMILY_AT91SAM9XE 0x02900000
38
39static inline unsigned long at91_arch_identify(void)
40{
41 return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH);
42}
43
44
31#ifdef CONFIG_ARCH_AT91RM9200 45#ifdef CONFIG_ARCH_AT91RM9200
32#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200) 46#define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200)
33#else 47#else
@@ -35,8 +49,10 @@ static inline unsigned long at91_cpu_identify(void)
35#endif 49#endif
36 50
37#ifdef CONFIG_ARCH_AT91SAM9260 51#ifdef CONFIG_ARCH_AT91SAM9260
38#define cpu_is_at91sam9260() (at91_cpu_identify() == ARCH_ID_AT91SAM9260) 52#define cpu_is_at91sam9xe() (at91_arch_identify() == ARCH_FAMILY_AT91SAM9XE)
53#define cpu_is_at91sam9260() ((at91_cpu_identify() == ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe())
39#else 54#else
55#define cpu_is_at91sam9xe() (0)
40#define cpu_is_at91sam9260() (0) 56#define cpu_is_at91sam9260() (0)
41#endif 57#endif
42 58
@@ -46,4 +62,10 @@ static inline unsigned long at91_cpu_identify(void)
46#define cpu_is_at91sam9261() (0) 62#define cpu_is_at91sam9261() (0)
47#endif 63#endif
48 64
65#ifdef CONFIG_ARCH_AT91SAM9263
66#define cpu_is_at91sam9263() (at91_cpu_identify() == ARCH_ID_AT91SAM9263)
67#else
68#define cpu_is_at91sam9263() (0)
69#endif
70
49#endif 71#endif
diff --git a/include/asm-arm/arch-at91/debug-macro.S b/include/asm-arm/arch-at91/debug-macro.S
new file mode 100644
index 000000000000..13e9f5e1d4ff
--- /dev/null
+++ b/include/asm-arm/arch-at91/debug-macro.S
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-at91/debug-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Debugging macro include header
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#include <asm/hardware.h>
15#include <asm/arch/at91_dbgu.h>
16
17 .macro addruart,rx
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 ldreq \rx, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
21 ldrne \rx, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
22 .endm
23
24 .macro senduart,rd,rx
25 strb \rd, [\rx, #(AT91_DBGU_THR - AT91_DBGU)] @ Write to Transmitter Holding Register
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register
30 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
31 beq 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #(AT91_DBGU_SR - AT91_DBGU)] @ Read Status Register
36 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
37 beq 1001b
38 .endm
39
diff --git a/include/asm-arm/arch-at91rm9200/dma.h b/include/asm-arm/arch-at91/dma.h
index 22c1dfdd8da3..774565412beb 100644
--- a/include/asm-arm/arch-at91rm9200/dma.h
+++ b/include/asm-arm/arch-at91/dma.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/dma.h 2 * include/asm-arm/arch-at91/dma.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91/entry-macro.S b/include/asm-arm/arch-at91/entry-macro.S
new file mode 100644
index 000000000000..cc1d850a0788
--- /dev/null
+++ b/include/asm-arm/arch-at91/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * include/asm-arm/arch-at91/entry-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Low-level IRQ helper macros for AT91RM9200 platforms
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <asm/hardware.h>
14#include <asm/arch/at91_aic.h>
15
16 .macro disable_fiq
17 .endm
18
19 .macro get_irqnr_preamble, base, tmp
20 .endm
21
22 .macro arch_ret_to_user, tmp1, tmp2
23 .endm
24
25 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
26 ldr \base, =(AT91_VA_BASE_SYS + AT91_AIC) @ base virtual address of AIC peripheral
27 ldr \irqnr, [\base, #(AT91_AIC_IVR - AT91_AIC)] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt)
28 ldr \irqstat, [\base, #(AT91_AIC_ISR - AT91_AIC)] @ read interrupt source number
29 teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt
30 streq \tmp, [\base, #(AT91_AIC_EOICR - AT91_AIC)] @ not going to be handled further, then ACK it now.
31 .endm
32
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91/gpio.h
index a011d27876a2..0a241e2fb672 100644
--- a/include/asm-arm/arch-at91rm9200/gpio.h
+++ b/include/asm-arm/arch-at91/gpio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/gpio.h 2 * include/asm-arm/arch-at91/gpio.h
3 * 3 *
4 * Copyright (C) 2005 HP Labs 4 * Copyright (C) 2005 HP Labs
5 * 5 *
@@ -17,7 +17,7 @@
17 17
18#define PIN_BASE NR_AIC_IRQS 18#define PIN_BASE NR_AIC_IRQS
19 19
20#define MAX_GPIO_BANKS 4 20#define MAX_GPIO_BANKS 5
21 21
22/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ 22/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
23 23
@@ -26,37 +26,31 @@
26#define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2) 26#define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2)
27#define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3) 27#define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3)
28#define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4) 28#define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4)
29
30#define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5) 29#define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5)
31#define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6) 30#define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6)
32#define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7) 31#define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7)
33#define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8) 32#define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8)
34#define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9) 33#define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9)
35
36#define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10) 34#define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10)
37#define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11) 35#define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11)
38#define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12) 36#define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12)
39#define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13) 37#define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13)
40#define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14) 38#define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14)
41
42#define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15) 39#define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15)
43#define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16) 40#define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16)
44#define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17) 41#define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17)
45#define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18) 42#define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18)
46#define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19) 43#define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19)
47
48#define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20) 44#define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20)
49#define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21) 45#define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21)
50#define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22) 46#define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22)
51#define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23) 47#define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23)
52#define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24) 48#define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24)
53
54#define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25) 49#define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25)
55#define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26) 50#define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26)
56#define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27) 51#define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27)
57#define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28) 52#define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28)
58#define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29) 53#define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29)
59
60#define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30) 54#define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30)
61#define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31) 55#define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31)
62 56
@@ -65,37 +59,31 @@
65#define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2) 59#define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2)
66#define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3) 60#define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3)
67#define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4) 61#define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4)
68
69#define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5) 62#define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5)
70#define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6) 63#define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6)
71#define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7) 64#define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7)
72#define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8) 65#define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8)
73#define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9) 66#define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9)
74
75#define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10) 67#define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10)
76#define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11) 68#define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11)
77#define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12) 69#define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12)
78#define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13) 70#define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13)
79#define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14) 71#define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14)
80
81#define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15) 72#define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15)
82#define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16) 73#define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16)
83#define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17) 74#define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17)
84#define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18) 75#define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18)
85#define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19) 76#define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19)
86
87#define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20) 77#define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20)
88#define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21) 78#define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21)
89#define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22) 79#define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22)
90#define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23) 80#define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23)
91#define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24) 81#define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24)
92
93#define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25) 82#define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25)
94#define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26) 83#define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26)
95#define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27) 84#define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27)
96#define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28) 85#define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28)
97#define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29) 86#define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29)
98
99#define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30) 87#define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30)
100#define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31) 88#define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31)
101 89
@@ -104,37 +92,31 @@
104#define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2) 92#define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2)
105#define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3) 93#define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3)
106#define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4) 94#define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4)
107
108#define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5) 95#define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5)
109#define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6) 96#define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6)
110#define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7) 97#define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7)
111#define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8) 98#define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8)
112#define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9) 99#define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9)
113
114#define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10) 100#define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10)
115#define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11) 101#define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11)
116#define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12) 102#define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12)
117#define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13) 103#define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13)
118#define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14) 104#define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14)
119
120#define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15) 105#define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15)
121#define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16) 106#define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16)
122#define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17) 107#define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17)
123#define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18) 108#define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18)
124#define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19) 109#define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19)
125
126#define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20) 110#define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20)
127#define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21) 111#define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21)
128#define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22) 112#define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22)
129#define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23) 113#define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23)
130#define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24) 114#define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24)
131
132#define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25) 115#define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25)
133#define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26) 116#define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26)
134#define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27) 117#define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27)
135#define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28) 118#define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28)
136#define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29) 119#define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29)
137
138#define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30) 120#define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30)
139#define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31) 121#define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31)
140 122
@@ -143,42 +125,70 @@
143#define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2) 125#define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2)
144#define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3) 126#define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3)
145#define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4) 127#define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4)
146
147#define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5) 128#define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5)
148#define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6) 129#define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6)
149#define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7) 130#define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7)
150#define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8) 131#define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8)
151#define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9) 132#define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9)
152
153#define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10) 133#define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10)
154#define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11) 134#define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11)
155#define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12) 135#define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12)
156#define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13) 136#define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13)
157#define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14) 137#define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14)
158
159#define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15) 138#define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15)
160#define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16) 139#define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16)
161#define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17) 140#define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17)
162#define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18) 141#define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18)
163#define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19) 142#define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19)
164
165#define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20) 143#define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20)
166#define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21) 144#define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21)
167#define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22) 145#define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22)
168#define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23) 146#define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23)
169#define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24) 147#define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24)
170
171#define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25) 148#define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25)
172#define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26) 149#define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26)
173#define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27) 150#define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27)
174#define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28) 151#define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28)
175#define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29) 152#define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29)
176
177#define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30) 153#define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30)
178#define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31) 154#define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31)
179 155
156#define AT91_PIN_PE0 (PIN_BASE + 0x80 + 0)
157#define AT91_PIN_PE1 (PIN_BASE + 0x80 + 1)
158#define AT91_PIN_PE2 (PIN_BASE + 0x80 + 2)
159#define AT91_PIN_PE3 (PIN_BASE + 0x80 + 3)
160#define AT91_PIN_PE4 (PIN_BASE + 0x80 + 4)
161#define AT91_PIN_PE5 (PIN_BASE + 0x80 + 5)
162#define AT91_PIN_PE6 (PIN_BASE + 0x80 + 6)
163#define AT91_PIN_PE7 (PIN_BASE + 0x80 + 7)
164#define AT91_PIN_PE8 (PIN_BASE + 0x80 + 8)
165#define AT91_PIN_PE9 (PIN_BASE + 0x80 + 9)
166#define AT91_PIN_PE10 (PIN_BASE + 0x80 + 10)
167#define AT91_PIN_PE11 (PIN_BASE + 0x80 + 11)
168#define AT91_PIN_PE12 (PIN_BASE + 0x80 + 12)
169#define AT91_PIN_PE13 (PIN_BASE + 0x80 + 13)
170#define AT91_PIN_PE14 (PIN_BASE + 0x80 + 14)
171#define AT91_PIN_PE15 (PIN_BASE + 0x80 + 15)
172#define AT91_PIN_PE16 (PIN_BASE + 0x80 + 16)
173#define AT91_PIN_PE17 (PIN_BASE + 0x80 + 17)
174#define AT91_PIN_PE18 (PIN_BASE + 0x80 + 18)
175#define AT91_PIN_PE19 (PIN_BASE + 0x80 + 19)
176#define AT91_PIN_PE20 (PIN_BASE + 0x80 + 20)
177#define AT91_PIN_PE21 (PIN_BASE + 0x80 + 21)
178#define AT91_PIN_PE22 (PIN_BASE + 0x80 + 22)
179#define AT91_PIN_PE23 (PIN_BASE + 0x80 + 23)
180#define AT91_PIN_PE24 (PIN_BASE + 0x80 + 24)
181#define AT91_PIN_PE25 (PIN_BASE + 0x80 + 25)
182#define AT91_PIN_PE26 (PIN_BASE + 0x80 + 26)
183#define AT91_PIN_PE27 (PIN_BASE + 0x80 + 27)
184#define AT91_PIN_PE28 (PIN_BASE + 0x80 + 28)
185#define AT91_PIN_PE29 (PIN_BASE + 0x80 + 29)
186#define AT91_PIN_PE30 (PIN_BASE + 0x80 + 30)
187#define AT91_PIN_PE31 (PIN_BASE + 0x80 + 31)
188
180#ifndef __ASSEMBLY__ 189#ifndef __ASSEMBLY__
181/* setup setup routines, called from board init or driver probe() */ 190/* setup setup routines, called from board init or driver probe() */
191extern int __init_or_module at91_set_GPIO_periph(unsigned pin, int use_pullup);
182extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup); 192extern int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup);
183extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup); 193extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
184extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup); 194extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
@@ -193,7 +203,50 @@ extern int at91_get_gpio_value(unsigned pin);
193/* callable only from core power-management code */ 203/* callable only from core power-management code */
194extern void at91_gpio_suspend(void); 204extern void at91_gpio_suspend(void);
195extern void at91_gpio_resume(void); 205extern void at91_gpio_resume(void);
196#endif
197 206
198#endif 207/*-------------------------------------------------------------------------*/
208
209/* wrappers for "new style" GPIO calls. the old AT91-specfic ones should
210 * eventually be removed (along with this errno.h inclusion), and the
211 * gpio request/free calls should probably be implemented.
212 */
213
214#include <asm/errno.h>
199 215
216static inline int gpio_request(unsigned gpio, const char *label)
217{
218 return 0;
219}
220
221static inline void gpio_free(unsigned gpio)
222{
223}
224
225extern int gpio_direction_input(unsigned gpio);
226extern int gpio_direction_output(unsigned gpio, int value);
227
228static inline int gpio_get_value(unsigned gpio)
229{
230 return at91_get_gpio_value(gpio);
231}
232
233static inline void gpio_set_value(unsigned gpio, int value)
234{
235 at91_set_gpio_value(gpio, value);
236}
237
238#include <asm-generic/gpio.h> /* cansleep wrappers */
239
240static inline int gpio_to_irq(unsigned gpio)
241{
242 return gpio;
243}
244
245static inline int irq_to_gpio(unsigned irq)
246{
247 return irq;
248}
249
250#endif /* __ASSEMBLY__ */
251
252#endif
diff --git a/include/asm-arm/arch-at91rm9200/hardware.h b/include/asm-arm/arch-at91/hardware.h
index 9ea5bfe06320..28133e0154dd 100644
--- a/include/asm-arm/arch-at91rm9200/hardware.h
+++ b/include/asm-arm/arch-at91/hardware.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/hardware.h 2 * include/asm-arm/arch-at91/hardware.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2003 ATMEL 5 * Copyright (C) 2003 ATMEL
@@ -22,21 +22,23 @@
22#include <asm/arch/at91sam9260.h> 22#include <asm/arch/at91sam9260.h>
23#elif defined(CONFIG_ARCH_AT91SAM9261) 23#elif defined(CONFIG_ARCH_AT91SAM9261)
24#include <asm/arch/at91sam9261.h> 24#include <asm/arch/at91sam9261.h>
25#elif defined(CONFIG_ARCH_AT91SAM9263)
26#include <asm/arch/at91sam9263.h>
25#else 27#else
26#error "Unsupported AT91 processor" 28#error "Unsupported AT91 processor"
27#endif 29#endif
28 30
29 31
30/* 32/*
31 * Remap the peripherals from address 0xFFFA0000 .. 0xFFFFFFFF 33 * Remap the peripherals from address 0xFFF78000 .. 0xFFFFFFFF
32 * to 0xFEFA0000 .. 0xFF000000. (384Kb) 34 * to 0xFEF78000 .. 0xFF000000. (544Kb)
33 */ 35 */
34#define AT91_IO_PHYS_BASE 0xFFFA0000 36#define AT91_IO_PHYS_BASE 0xFFF78000
35#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1) 37#define AT91_IO_SIZE (0xFFFFFFFF - AT91_IO_PHYS_BASE + 1)
36#define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE) 38#define AT91_IO_VIRT_BASE (0xFF000000 - AT91_IO_SIZE)
37 39
38 /* Convert a physical IO address to virtual IO address */ 40 /* Convert a physical IO address to virtual IO address */
39#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE) 41#define AT91_IO_P2V(x) ((x) - AT91_IO_PHYS_BASE + AT91_IO_VIRT_BASE)
40 42
41/* 43/*
42 * Virtual to Physical Address mapping for IO devices. 44 * Virtual to Physical Address mapping for IO devices.
diff --git a/include/asm-arm/arch-at91rm9200/io.h b/include/asm-arm/arch-at91/io.h
index 88fd1bebcef3..401f327ec047 100644
--- a/include/asm-arm/arch-at91rm9200/io.h
+++ b/include/asm-arm/arch-at91/io.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/io.h 2 * include/asm-arm/arch-at91/io.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/irqs.h b/include/asm-arm/arch-at91/irqs.h
index c0679eaefaf2..1ffa3bb9a9c1 100644
--- a/include/asm-arm/arch-at91rm9200/irqs.h
+++ b/include/asm-arm/arch-at91/irqs.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/irqs.h 2 * include/asm-arm/arch-at91/irqs.h
3 * 3 *
4 * Copyright (C) 2004 SAN People 4 * Copyright (C) 2004 SAN People
5 * 5 *
@@ -37,8 +37,8 @@
37 * IRQ interrupt symbols are the AT91xxx_ID_* symbols 37 * IRQ interrupt symbols are the AT91xxx_ID_* symbols
38 * for IRQs handled directly through the AIC, or else the AT91_PIN_* 38 * for IRQs handled directly through the AIC, or else the AT91_PIN_*
39 * symbols in gpio.h for ones handled indirectly as GPIOs. 39 * symbols in gpio.h for ones handled indirectly as GPIOs.
40 * We make provision for 4 banks of GPIO. 40 * We make provision for 5 banks of GPIO.
41 */ 41 */
42#define NR_IRQS (NR_AIC_IRQS + (4 * 32)) 42#define NR_IRQS (NR_AIC_IRQS + (5 * 32))
43 43
44#endif 44#endif
diff --git a/include/asm-arm/arch-at91rm9200/memory.h b/include/asm-arm/arch-at91/memory.h
index f985069e6d01..4835d6784509 100644
--- a/include/asm-arm/arch-at91rm9200/memory.h
+++ b/include/asm-arm/arch-at91/memory.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/memory.h 2 * include/asm-arm/arch-at91/memory.h
3 * 3 *
4 * Copyright (C) 2004 SAN People 4 * Copyright (C) 2004 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/system.h b/include/asm-arm/arch-at91/system.h
index 9c67130603b2..6bf846098ea9 100644
--- a/include/asm-arm/arch-at91rm9200/system.h
+++ b/include/asm-arm/arch-at91/system.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/system.h 2 * include/asm-arm/arch-at91/system.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/timex.h b/include/asm-arm/arch-at91/timex.h
index faeca45a8d44..f41636d607a2 100644
--- a/include/asm-arm/arch-at91rm9200/timex.h
+++ b/include/asm-arm/arch-at91/timex.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/timex.h 2 * include/asm-arm/arch-at91/timex.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
@@ -32,6 +32,11 @@
32#define AT91SAM9_MASTER_CLOCK 99300000 32#define AT91SAM9_MASTER_CLOCK 99300000
33#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) 33#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
34 34
35#elif defined(CONFIG_ARCH_AT91SAM9263)
36
37#define AT91SAM9_MASTER_CLOCK 99959500
38#define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16)
39
35#endif 40#endif
36 41
37#endif 42#endif
diff --git a/include/asm-arm/arch-at91rm9200/uncompress.h b/include/asm-arm/arch-at91/uncompress.h
index 34b4b93fa015..a193d28304b6 100644
--- a/include/asm-arm/arch-at91rm9200/uncompress.h
+++ b/include/asm-arm/arch-at91/uncompress.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/uncompress.h 2 * include/asm-arm/arch-at91/uncompress.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/vmalloc.h b/include/asm-arm/arch-at91/vmalloc.h
index 0a23b8c562b9..bb05e70e932a 100644
--- a/include/asm-arm/arch-at91rm9200/vmalloc.h
+++ b/include/asm-arm/arch-at91/vmalloc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm-arm/arch-at91rm9200/vmalloc.h 2 * include/asm-arm/arch-at91/vmalloc.h
3 * 3 *
4 * Copyright (C) 2003 SAN People 4 * Copyright (C) 2003 SAN People
5 * 5 *
diff --git a/include/asm-arm/arch-at91rm9200/at91_pdc.h b/include/asm-arm/arch-at91rm9200/at91_pdc.h
deleted file mode 100644
index 79d6e02fa45e..000000000000
--- a/include/asm-arm/arch-at91rm9200/at91_pdc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_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 AT91_PDC_H
17#define AT91_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-arm/arch-at91rm9200/debug-macro.S b/include/asm-arm/arch-at91rm9200/debug-macro.S
deleted file mode 100644
index 85cdadf26634..000000000000
--- a/include/asm-arm/arch-at91rm9200/debug-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/debug-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Debugging macro include header
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#include <asm/hardware.h>
15#include <asm/arch/at91_dbgu.h>
16
17 .macro addruart,rx
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 ldreq \rx, =AT91_BASE_SYS @ System peripherals (phys address)
21 ldrne \rx, =AT91_VA_BASE_SYS @ System peripherals (virt address)
22 .endm
23
24 .macro senduart,rd,rx
25 strb \rd, [\rx, #AT91_DBGU_THR] @ Write to Transmitter Holding Register
26 .endm
27
28 .macro waituart,rd,rx
291001: ldr \rd, [\rx, #AT91_DBGU_SR] @ Read Status Register
30 tst \rd, #AT91_DBGU_TXRDY @ DBGU_TXRDY = 1 when ready to transmit
31 beq 1001b
32 .endm
33
34 .macro busyuart,rd,rx
351001: ldr \rd, [\rx, #AT91_DBGU_SR] @ Read Status Register
36 tst \rd, #AT91_DBGU_TXEMPTY @ DBGU_TXEMPTY = 1 when transmission complete
37 beq 1001b
38 .endm
39
diff --git a/include/asm-arm/arch-at91rm9200/entry-macro.S b/include/asm-arm/arch-at91rm9200/entry-macro.S
deleted file mode 100644
index 57248a796472..000000000000
--- a/include/asm-arm/arch-at91rm9200/entry-macro.S
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/entry-macro.S
3 *
4 * Copyright (C) 2003-2005 SAN People
5 *
6 * Low-level IRQ helper macros for AT91RM9200 platforms
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <asm/hardware.h>
14#include <asm/arch/at91_aic.h>
15
16 .macro disable_fiq
17 .endm
18
19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
20 ldr \base, =(AT91_VA_BASE_SYS) @ base virtual address of SYS peripherals
21 ldr \irqnr, [\base, #AT91_AIC_IVR] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt)
22 ldr \irqstat, [\base, #AT91_AIC_ISR] @ read interrupt source number
23 teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt
24 streq \tmp, [\base, #AT91_AIC_EOICR] @ not going to be handled further, then ACK it now.
25 .endm
26
diff --git a/include/asm-arm/arch-cl7500/entry-macro.S b/include/asm-arm/arch-cl7500/entry-macro.S
index c9e5395e5106..0cfb89b229d1 100644
--- a/include/asm-arm/arch-cl7500/entry-macro.S
+++ b/include/asm-arm/arch-cl7500/entry-macro.S
@@ -1,3 +1,8 @@
1#include <asm/hardware.h> 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 .macro get_irqnr_preamble, base, tmp
4 .endm
5
6 .macro arch_ret_to_user, tmp1, tmp2
7 .endm
3 8
diff --git a/include/asm-arm/arch-clps711x/entry-macro.S b/include/asm-arm/arch-clps711x/entry-macro.S
index de4481dd8ba0..cd8c5a0bc7bc 100644
--- a/include/asm-arm/arch-clps711x/entry-macro.S
+++ b/include/asm-arm/arch-clps711x/entry-macro.S
@@ -13,6 +13,12 @@
13 .macro disable_fiq 13 .macro disable_fiq
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
16#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1) 22#if (INTSR2 - INTSR1) != (INTMR2 - INTMR1)
17#error INTSR stride != INTMR stride 23#error INTSR stride != INTMR stride
18#endif 24#endif
diff --git a/include/asm-arm/arch-ebsa110/entry-macro.S b/include/asm-arm/arch-ebsa110/entry-macro.S
index b12ca04f998c..aa23c5d6c69e 100644
--- a/include/asm-arm/arch-ebsa110/entry-macro.S
+++ b/include/asm-arm/arch-ebsa110/entry-macro.S
@@ -15,6 +15,12 @@
15 .macro disable_fiq 15 .macro disable_fiq
16 .endm 16 .endm
17 17
18 .macro get_irqnr_preamble, base, tmp
19 .endm
20
21 .macro arch_ret_to_user, tmp1, tmp2
22 .endm
23
18 .macro get_irqnr_and_base, irqnr, stat, base, tmp 24 .macro get_irqnr_and_base, irqnr, stat, base, tmp
19 mov \base, #IRQ_STAT 25 mov \base, #IRQ_STAT
20 ldrb \stat, [\base] @ get interrupts 26 ldrb \stat, [\base] @ get interrupts
diff --git a/include/asm-arm/arch-ebsa285/entry-macro.S b/include/asm-arm/arch-ebsa285/entry-macro.S
index ce812d4f4a33..4203dbf10662 100644
--- a/include/asm-arm/arch-ebsa285/entry-macro.S
+++ b/include/asm-arm/arch-ebsa285/entry-macro.S
@@ -14,6 +14,12 @@
14 .macro disable_fiq 14 .macro disable_fiq
15 .endm 15 .endm
16 16
17 .macro get_irqnr_preamble, base, tmp
18 .endm
19
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
17 .equ dc21285_high, ARMCSR_BASE & 0xff000000 23 .equ dc21285_high, ARMCSR_BASE & 0xff000000
18 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff 24 .equ dc21285_low, ARMCSR_BASE & 0x00ffffff
19 25
diff --git a/include/asm-arm/arch-ep93xx/entry-macro.S b/include/asm-arm/arch-ep93xx/entry-macro.S
index 84140a28dfcf..241ec221a047 100644
--- a/include/asm-arm/arch-ep93xx/entry-macro.S
+++ b/include/asm-arm/arch-ep93xx/entry-macro.S
@@ -14,6 +14,12 @@
14 .macro disable_fiq 14 .macro disable_fiq
15 .endm 15 .endm
16 16
17 .macro get_irqnr_preamble, base, tmp
18 .endm
19
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18 ldr \base, =(EP93XX_AHB_VIRT_BASE) 24 ldr \base, =(EP93XX_AHB_VIRT_BASE)
19 orr \base, \base, #0x000b0000 25 orr \base, \base, #0x000b0000
diff --git a/include/asm-arm/arch-ep93xx/ep93xx-regs.h b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
index 593f562f85c3..625c6f0abc03 100644
--- a/include/asm-arm/arch-ep93xx/ep93xx-regs.h
+++ b/include/asm-arm/arch-ep93xx/ep93xx-regs.h
@@ -73,6 +73,11 @@
73 73
74#define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000) 74#define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000)
75#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) 75#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x))
76#define EP93XX_GPIO_F_INT_TYPE1 EP93XX_GPIO_REG(0x4c)
77#define EP93XX_GPIO_F_INT_TYPE2 EP93XX_GPIO_REG(0x50)
78#define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54)
79#define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58)
80#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c)
76#define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90) 81#define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90)
77#define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94) 82#define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94)
78#define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98) 83#define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98)
diff --git a/include/asm-arm/arch-ep93xx/irqs.h b/include/asm-arm/arch-ep93xx/irqs.h
index ae532e304bf1..2a8c63638c5e 100644
--- a/include/asm-arm/arch-ep93xx/irqs.h
+++ b/include/asm-arm/arch-ep93xx/irqs.h
@@ -67,9 +67,13 @@
67#define IRQ_EP93XX_SAI 60 67#define IRQ_EP93XX_SAI 60
68#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff 68#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff
69 69
70#define IRQ_EP93XX_GPIO(x) (64 + (x)) 70/*
71 * Map GPIO A0..A7 to irq 64..71, B0..B7 to 72..79, and
72 * F0..F7 to 80..87.
73 */
74#define IRQ_EP93XX_GPIO(x) (64 + (((x) + (((x) >> 2) & 8)) & 0x1f))
71 75
72#define NR_EP93XX_IRQS IRQ_EP93XX_GPIO(16) 76#define NR_EP93XX_IRQS (64 + 24)
73 77
74#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x)) 78#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x))
75#define EP93XX_BOARD_IRQS 32 79#define EP93XX_BOARD_IRQS 32
diff --git a/include/asm-arm/arch-ep93xx/platform.h b/include/asm-arm/arch-ep93xx/platform.h
index b4a8deb8bdef..44eccec2cba4 100644
--- a/include/asm-arm/arch-ep93xx/platform.h
+++ b/include/asm-arm/arch-ep93xx/platform.h
@@ -8,7 +8,6 @@ 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);
12extern struct sys_timer ep93xx_timer; 11extern struct sys_timer ep93xx_timer;
13 12
14struct ep93xx_eth_data 13struct ep93xx_eth_data
diff --git a/include/asm-arm/arch-h720x/entry-macro.S b/include/asm-arm/arch-h720x/entry-macro.S
index 8f165648e2af..38dd63ae104e 100644
--- a/include/asm-arm/arch-h720x/entry-macro.S
+++ b/include/asm-arm/arch-h720x/entry-macro.S
@@ -11,6 +11,12 @@
11 .macro disable_fiq 11 .macro disable_fiq
12 .endm 12 .endm
13 13
14 .macro get_irqnr_preamble, base, tmp
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
15#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202) 21#if defined (CONFIG_CPU_H7201) || defined (CONFIG_CPU_H7202)
16 @ we could use the id register on H7202, but this is not 22 @ we could use the id register on H7202, but this is not
diff --git a/include/asm-arm/arch-imx/entry-macro.S b/include/asm-arm/arch-imx/entry-macro.S
index 3b9ef6914627..0b84e81031c3 100644
--- a/include/asm-arm/arch-imx/entry-macro.S
+++ b/include/asm-arm/arch-imx/entry-macro.S
@@ -11,21 +11,22 @@
11 11
12 .macro disable_fiq 12 .macro disable_fiq
13 .endm 13 .endm
14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
14#define AITC_NIVECSR 0x40 21#define AITC_NIVECSR 0x40
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16 ldr \irqstat, =IO_ADDRESS(IMX_AITC_BASE) 23 ldr \base, =IO_ADDRESS(IMX_AITC_BASE)
17 @ Load offset & priority of the highest priority 24 @ Load offset & priority of the highest priority
18 @ interrupt pending. 25 @ interrupt pending.
19 ldr \irqnr, [\irqstat, #AITC_NIVECSR] 26 ldr \irqstat, [\base, #AITC_NIVECSR]
20 @ Shift off the priority leaving the offset or 27 @ Shift off the priority leaving the offset or
21 @ "interrupt number" 28 @ "interrupt number", use arithmetic shift to
22 mov \irqnr, \irqnr, lsr #16 29 @ transform illegal source (0xffff) as -1
23 ldr \irqstat, =1 @ dummy compare 30 mov \irqnr, \irqstat, asr #16
24 ldr \base, =0xFFFF // invalid interrupt 31 adds \tmp, \irqnr, #1
25 cmp \irqnr, \base
26 bne 1001f
27 ldr \irqstat, =0
281001:
29 tst \irqstat, #1 @ to make the condition code = TRUE
30 .endm 32 .endm
31
diff --git a/include/asm-arm/arch-imx/spi_imx.h b/include/asm-arm/arch-imx/spi_imx.h
new file mode 100644
index 000000000000..2165449e976e
--- /dev/null
+++ b/include/asm-arm/arch-imx/spi_imx.h
@@ -0,0 +1,72 @@
1/*
2 * include/asm-arm/arch-imx/spi_imx.h
3 *
4 * Copyright (C) 2006 SWAPP
5 * Andrea Paterniani <a.paterniani@swapp-eng.it>
6 *
7 * Initial version inspired by:
8 * linux-2.6.17-rc3-mm1/include/asm-arm/arch-pxa/pxa2xx_spi.h
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., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#ifndef SPI_IMX_H_
26#define SPI_IMX_H_
27
28
29/*-------------------------------------------------------------------------*/
30/**
31 * struct spi_imx_master - device.platform_data for SPI controller devices.
32 * @num_chipselect: chipselects are used to distinguish individual
33 * SPI slaves, and are numbered from zero to num_chipselects - 1.
34 * each slave has a chipselect signal, but it's common that not
35 * every chipselect is connected to a slave.
36 * @enable_dma: if true enables DMA driven transfers.
37*/
38struct spi_imx_master {
39 u8 num_chipselect;
40 u8 enable_dma:1;
41};
42/*-------------------------------------------------------------------------*/
43
44
45/*-------------------------------------------------------------------------*/
46/**
47 * struct spi_imx_chip - spi_board_info.controller_data for SPI
48 * slave devices, copied to spi_device.controller_data.
49 * @enable_loopback : used for test purpouse to internally connect RX and TX
50 * sections.
51 * @enable_dma : enables dma transfer (provided that controller driver has
52 * dma enabled too).
53 * @ins_ss_pulse : enable /SS pulse insertion between SPI burst.
54 * @bclk_wait : number of bclk waits between each bits_per_word SPI burst.
55 * @cs_control : function pointer to board-specific function to assert/deassert
56 * I/O port to control HW generation of devices chip-select.
57*/
58struct spi_imx_chip {
59 u8 enable_loopback:1;
60 u8 enable_dma:1;
61 u8 ins_ss_pulse:1;
62 u16 bclk_wait:15;
63 void (*cs_control)(u32 control);
64};
65
66/* Chip-select state */
67#define SPI_CS_ASSERT (1 << 0)
68#define SPI_CS_DEASSERT (1 << 1)
69/*-------------------------------------------------------------------------*/
70
71
72#endif /* SPI_IMX_H_*/
diff --git a/include/asm-arm/arch-integrator/entry-macro.S b/include/asm-arm/arch-integrator/entry-macro.S
index 69838d04f90b..491af1a23de5 100644
--- a/include/asm-arm/arch-integrator/entry-macro.S
+++ b/include/asm-arm/arch-integrator/entry-macro.S
@@ -13,6 +13,12 @@
13 .macro disable_fiq 13 .macro disable_fiq
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
16 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
17/* FIXME: should not be using soo many LDRs here */ 23/* FIXME: should not be using soo many LDRs here */
18 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE) 24 ldr \base, =IO_ADDRESS(INTEGRATOR_IC_BASE)
diff --git a/include/asm-arm/arch-iop13xx/entry-macro.S b/include/asm-arm/arch-iop13xx/entry-macro.S
index 94c50283dc56..a624a7870c64 100644
--- a/include/asm-arm/arch-iop13xx/entry-macro.S
+++ b/include/asm-arm/arch-iop13xx/entry-macro.S
@@ -19,21 +19,27 @@
19 .macro disable_fiq 19 .macro disable_fiq
20 .endm 20 .endm
21 21
22 .macro get_irqnr_preamble, base, tmp
23 mrc p15, 0, \tmp, c15, c1, 0
24 orr \tmp, \tmp, #(1 << 6)
25 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
26 .endm
27
22 /* 28 /*
23 * Note: a 1-cycle window exists where iintvec will return the value 29 * Note: a 1-cycle window exists where iintvec will return the value
24 * of iintbase, so we explicitly check for "bad zeros" 30 * of iintbase, so we explicitly check for "bad zeros"
25 */ 31 */
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 mrc p15, 0, \tmp, c15, c1, 0
28 orr \tmp, \tmp, #(1 << 6)
29 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
30
31 mrc p6, 0, \irqnr, c3, c2, 0 @ Read IINTVEC 33 mrc p6, 0, \irqnr, c3, c2, 0 @ Read IINTVEC
32 cmp \irqnr, #0 34 cmp \irqnr, #0
33 mrceq p6, 0, \irqnr, c3, c2, 0 @ Re-read on potentially bad zero 35 mrceq p6, 0, \irqnr, c3, c2, 0 @ Re-read on potentially bad zero
34 adds \irqstat, \irqnr, #1 @ Check for 0xffffffff 36 adds \irqstat, \irqnr, #1 @ Check for 0xffffffff
35 movne \irqnr, \irqnr, lsr #2 @ Convert to irqnr 37 movne \irqnr, \irqnr, lsr #2 @ Convert to irqnr
38 .endm
36 39
37 biceq \tmp, \tmp, #(1 << 6) 40 .macro arch_ret_to_user, tmp1, tmp2
38 mcreq p15, 0, \tmp, c15, c1, 0 @ Disable cp6 access if no more interrupts 41 mrc p15, 0, \tmp1, c15, c1, 0
42 ands \tmp2, \tmp1, #(1 << 6)
43 bicne \tmp1, \tmp1, #(1 << 6)
44 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
39 .endm 45 .endm
diff --git a/include/asm-arm/arch-iop13xx/iop13xx.h b/include/asm-arm/arch-iop13xx/iop13xx.h
index a88522a0ff8e..d26b755a9879 100644
--- a/include/asm-arm/arch-iop13xx/iop13xx.h
+++ b/include/asm-arm/arch-iop13xx/iop13xx.h
@@ -9,34 +9,6 @@ void iop13xx_init_irq(void);
9void iop13xx_map_io(void); 9void iop13xx_map_io(void);
10void iop13xx_platform_init(void); 10void iop13xx_platform_init(void);
11void iop13xx_init_irq(void); 11void iop13xx_init_irq(void);
12void iop13xx_init_time(unsigned long tickrate);
13unsigned long iop13xx_gettimeoffset(void);
14
15/* handle cp6 access
16 * to do: handle access in entry-armv5.S and unify with
17 * the iop3xx implementation
18 * note: use iop13xx_cp6_enable_irq_save and iop13xx_cp6_irq_restore (irq.h)
19 * when interrupts are enabled
20 */
21static inline unsigned long iop13xx_cp6_save(void)
22{
23 u32 temp, cp_flags;
24
25 asm volatile (
26 "mrc p15, 0, %1, c15, c1, 0\n\t"
27 "orr %0, %1, #(1 << 6)\n\t"
28 "mcr p15, 0, %0, c15, c1, 0\n\t"
29 : "=r" (temp), "=r"(cp_flags));
30
31 return cp_flags;
32}
33
34static inline void iop13xx_cp6_restore(unsigned long cp_flags)
35{
36 asm volatile (
37 "mcr p15, 0, %0, c15, c1, 0\n\t"
38 : : "r" (cp_flags) );
39}
40 12
41/* CPUID CP6 R0 Page 0 */ 13/* CPUID CP6 R0 Page 0 */
42static inline int iop13xx_cpu_id(void) 14static inline int iop13xx_cpu_id(void)
@@ -479,14 +451,4 @@ static inline int iop13xx_cpu_id(void)
479#define IOP13XX_PBI_BAR1 IOP13XX_PBI_OFFSET(0x10) 451#define IOP13XX_PBI_BAR1 IOP13XX_PBI_OFFSET(0x10)
480#define IOP13XX_PBI_LR1 IOP13XX_PBI_OFFSET(0x14) 452#define IOP13XX_PBI_LR1 IOP13XX_PBI_OFFSET(0x14)
481 453
482#define IOP13XX_TMR_TC 0x01
483#define IOP13XX_TMR_EN 0x02
484#define IOP13XX_TMR_RELOAD 0x04
485#define IOP13XX_TMR_PRIVILEGED 0x08
486
487#define IOP13XX_TMR_RATIO_1_1 0x00
488#define IOP13XX_TMR_RATIO_4_1 0x10
489#define IOP13XX_TMR_RATIO_8_1 0x20
490#define IOP13XX_TMR_RATIO_16_1 0x30
491
492#endif /* _IOP13XX_HW_H_ */ 454#endif /* _IOP13XX_HW_H_ */
diff --git a/include/asm-arm/arch-iop13xx/irqs.h b/include/asm-arm/arch-iop13xx/irqs.h
index 442e35a40359..5c6fac2a4004 100644
--- a/include/asm-arm/arch-iop13xx/irqs.h
+++ b/include/asm-arm/arch-iop13xx/irqs.h
@@ -3,8 +3,6 @@
3 3
4#ifndef __ASSEMBLER__ 4#ifndef __ASSEMBLER__
5#include <linux/types.h> 5#include <linux/types.h>
6#include <asm/system.h> /* local_irq_save */
7#include <asm/arch/iop13xx.h> /* iop13xx_cp6_* */
8 6
9/* INTPND0 CP6 R0 Page 3 7/* INTPND0 CP6 R0 Page 3
10 */ 8 */
@@ -41,21 +39,6 @@ static inline u32 read_intpnd_3(void)
41 asm volatile("mrc p6, 0, %0, c3, c3, 0":"=r" (val)); 39 asm volatile("mrc p6, 0, %0, c3, c3, 0":"=r" (val));
42 return val; 40 return val;
43} 41}
44
45static inline void
46iop13xx_cp6_enable_irq_save(unsigned long *cp_flags, unsigned long *irq_flags)
47{
48 local_irq_save(*irq_flags);
49 *cp_flags = iop13xx_cp6_save();
50}
51
52static inline void
53iop13xx_cp6_irq_restore(unsigned long *cp_flags,
54 unsigned long *irq_flags)
55{
56 iop13xx_cp6_restore(*cp_flags);
57 local_irq_restore(*irq_flags);
58}
59#endif 42#endif
60 43
61#define INTBASE 0 44#define INTBASE 0
diff --git a/include/asm-arm/arch-iop13xx/system.h b/include/asm-arm/arch-iop13xx/system.h
index ee3a62530af2..127827058e1f 100644
--- a/include/asm-arm/arch-iop13xx/system.h
+++ b/include/asm-arm/arch-iop13xx/system.h
@@ -48,12 +48,10 @@ static inline void arch_reset(char mode)
48 /* 48 /*
49 * Reset the internal bus (warning both cores are reset) 49 * Reset the internal bus (warning both cores are reset)
50 */ 50 */
51 u32 cp_flags = iop13xx_cp6_save();
52 write_wdtcr(IOP13XX_WDTCR_EN_ARM); 51 write_wdtcr(IOP13XX_WDTCR_EN_ARM);
53 write_wdtcr(IOP13XX_WDTCR_EN); 52 write_wdtcr(IOP13XX_WDTCR_EN);
54 write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET); 53 write_wdtsr(IOP13XX_WDTSR_WRITE_EN | IOP13XX_WDTCR_IB_RESET);
55 write_wdtcr(0x1000); 54 write_wdtcr(0x1000);
56 iop13xx_cp6_restore(cp_flags);
57 55
58 for(;;); 56 for(;;);
59} 57}
diff --git a/include/asm-arm/arch-iop13xx/time.h b/include/asm-arm/arch-iop13xx/time.h
new file mode 100644
index 000000000000..77a837a02dec
--- /dev/null
+++ b/include/asm-arm/arch-iop13xx/time.h
@@ -0,0 +1,51 @@
1#ifndef _IOP13XX_TIME_H_
2#define _IOP13XX_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP13XX_TIMER0
4
5#define IOP_TMR_EN 0x02
6#define IOP_TMR_RELOAD 0x04
7#define IOP_TMR_PRIVILEGED 0x08
8#define IOP_TMR_RATIO_1_1 0x00
9
10void iop_init_time(unsigned long tickrate);
11unsigned long iop_gettimeoffset(void);
12
13static inline void write_tmr0(u32 val)
14{
15 asm volatile("mcr p6, 0, %0, c0, c9, 0" : : "r" (val));
16}
17
18static inline void write_tmr1(u32 val)
19{
20 asm volatile("mcr p6, 0, %0, c1, c9, 0" : : "r" (val));
21}
22
23static inline u32 read_tcr0(void)
24{
25 u32 val;
26 asm volatile("mrc p6, 0, %0, c2, c9, 0" : "=r" (val));
27 return val;
28}
29
30static inline u32 read_tcr1(void)
31{
32 u32 val;
33 asm volatile("mrc p6, 0, %0, c3, c9, 0" : "=r" (val));
34 return val;
35}
36
37static inline void write_trr0(u32 val)
38{
39 asm volatile("mcr p6, 0, %0, c4, c9, 0" : : "r" (val));
40}
41
42static inline void write_trr1(u32 val)
43{
44 asm volatile("mcr p6, 0, %0, c5, c9, 0" : : "r" (val));
45}
46
47static inline void write_tisr(u32 val)
48{
49 asm volatile("mcr p6, 0, %0, c6, c9, 0" : : "r" (val));
50}
51#endif
diff --git a/include/asm-arm/arch-iop32x/entry-macro.S b/include/asm-arm/arch-iop32x/entry-macro.S
index 1500cbbd2295..207db99dfbd2 100644
--- a/include/asm-arm/arch-iop32x/entry-macro.S
+++ b/include/asm-arm/arch-iop32x/entry-macro.S
@@ -9,13 +9,28 @@
9 */ 9 */
10#include <asm/arch/iop32x.h> 10#include <asm/arch/iop32x.h>
11 11
12 .macro disable_fiq 12 .macro disable_fiq
13 .endm 13 .endm
14 14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_preamble, base, tmp
16 ldr \base, =IOP3XX_REG_ADDR(0x07D8) 16 mrc p15, 0, \tmp, c15, c1, 0
17 ldr \irqstat, [\base] @ Read IINTSRC 17 orr \tmp, \tmp, #(1 << 6)
18 cmp \irqstat, #0 18 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
19 clzne \irqnr, \irqstat 19 mrc p15, 0, \tmp, c15, c1, 0
20 rsbne \irqnr, \irqnr, #31 20 mov \tmp, \tmp
21 .endm 21 sub pc, pc, #4 @ cp_wait
22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC
26 cmp \irqstat, #0
27 clzne \irqnr, \irqstat
28 rsbne \irqnr, \irqnr, #31
29 .endm
30
31 .macro arch_ret_to_user, tmp1, tmp2
32 mrc p15, 0, \tmp1, c15, c1, 0
33 ands \tmp2, \tmp1, #(1 << 6)
34 bicne \tmp1, \tmp1, #(1 << 6)
35 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
36 .endm
diff --git a/include/asm-arm/arch-iop32x/io.h b/include/asm-arm/arch-iop32x/io.h
index 12d9ee02cde3..5f570a598a37 100644
--- a/include/asm-arm/arch-iop32x/io.h
+++ b/include/asm-arm/arch-iop32x/io.h
@@ -13,10 +13,16 @@
13 13
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16extern void __iomem * __ioremap(unsigned long, size_t, unsigned long);
17extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
18 unsigned long flags);
19extern void __iop3xx_iounmap(void __iomem *addr);
17 20
18#define __io(p) ((void __iomem *)(p)) 21#define IO_SPACE_LIMIT 0xffffffff
22#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
19#define __mem_pci(a) (a) 23#define __mem_pci(a) (a)
20 24
25#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
26#define __arch_iounmap(a) __iop3xx_iounmap(a)
21 27
22#endif 28#endif
diff --git a/include/asm-arm/arch-iop32x/time.h b/include/asm-arm/arch-iop32x/time.h
new file mode 100644
index 000000000000..0f28c9949623
--- /dev/null
+++ b/include/asm-arm/arch-iop32x/time.h
@@ -0,0 +1,4 @@
1#ifndef _IOP32X_TIME_H_
2#define _IOP32X_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP32X_TIMER0
4#endif
diff --git a/include/asm-arm/arch-iop33x/entry-macro.S b/include/asm-arm/arch-iop33x/entry-macro.S
index 92b791702e34..b8e3d449e882 100644
--- a/include/asm-arm/arch-iop33x/entry-macro.S
+++ b/include/asm-arm/arch-iop33x/entry-macro.S
@@ -9,14 +9,29 @@
9 */ 9 */
10#include <asm/arch/iop33x.h> 10#include <asm/arch/iop33x.h>
11 11
12 .macro disable_fiq 12 .macro disable_fiq
13 .endm 13 .endm
14 14
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 15 .macro get_irqnr_preamble, base, tmp
16 ldr \base, =IOP3XX_REG_ADDR(0x07C8) 16 mrc p15, 0, \tmp, c15, c1, 0
17 ldr \irqstat, [\base] @ Read IINTVEC 17 orr \tmp, \tmp, #(1 << 6)
18 cmp \irqstat, #0 18 mcr p15, 0, \tmp, c15, c1, 0 @ Enable cp6 access
19 ldreq \irqstat, [\base] @ erratum 63 workaround 19 mrc p15, 0, \tmp, c15, c1, 0
20 adds \irqnr, \irqstat, #1 20 mov \tmp, \tmp
21 movne \irqnr, \irqstat, lsr #2 21 sub pc, pc, #4 @ cp_wait
22 .endm 22 .endm
23
24 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
25 mrc p6, 0, \irqstat, c14, c0, 0 @ Read IINTVEC
26 cmp \irqstat, #0
27 mrceq p6, 0, \irqstat, c14, c0, 0 @ erratum 63 workaround
28 adds \irqnr, \irqstat, #1
29 movne \irqnr, \irqstat, lsr #2
30 .endm
31
32 .macro arch_ret_to_user, tmp1, tmp2
33 mrc p15, 0, \tmp1, c15, c1, 0
34 ands \tmp2, \tmp1, #(1 << 6)
35 bicne \tmp1, \tmp1, #(1 << 6)
36 mcrne p15, 0, \tmp1, c15, c1, 0 @ Disable cp6 access
37 .endm
diff --git a/include/asm-arm/arch-iop33x/io.h b/include/asm-arm/arch-iop33x/io.h
index c017402bab96..1bb5071e1fa8 100644
--- a/include/asm-arm/arch-iop33x/io.h
+++ b/include/asm-arm/arch-iop33x/io.h
@@ -13,9 +13,16 @@
13 13
14#include <asm/hardware.h> 14#include <asm/hardware.h>
15 15
16extern void __iomem * __ioremap(unsigned long, size_t, unsigned long);
17extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
18 unsigned long flags);
19extern void __iop3xx_iounmap(void __iomem *addr);
20
16#define IO_SPACE_LIMIT 0xffffffff 21#define IO_SPACE_LIMIT 0xffffffff
17#define __io(p) ((void __iomem *)(p)) 22#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
18#define __mem_pci(a) (a) 23#define __mem_pci(a) (a)
19 24
25#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
26#define __arch_iounmap(a) __iop3xx_iounmap(a)
20 27
21#endif 28#endif
diff --git a/include/asm-arm/arch-iop33x/time.h b/include/asm-arm/arch-iop33x/time.h
new file mode 100644
index 000000000000..4ac4d7664f85
--- /dev/null
+++ b/include/asm-arm/arch-iop33x/time.h
@@ -0,0 +1,4 @@
1#ifndef _IOP33X_TIME_H_
2#define _IOP33X_TIME_H_
3#define IRQ_IOP_TIMER0 IRQ_IOP33X_TIMER0
4#endif
diff --git a/include/asm-arm/arch-ixp2000/entry-macro.S b/include/asm-arm/arch-ixp2000/entry-macro.S
index 16e1e6124b31..11d512ad5945 100644
--- a/include/asm-arm/arch-ixp2000/entry-macro.S
+++ b/include/asm-arm/arch-ixp2000/entry-macro.S
@@ -12,6 +12,12 @@
12 .macro disable_fiq 12 .macro disable_fiq
13 .endm 13 .endm
14 14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16 22
17 mov \irqnr, #0x0 @clear out irqnr as default 23 mov \irqnr, #0x0 @clear out irqnr as default
diff --git a/include/asm-arm/arch-ixp23xx/entry-macro.S b/include/asm-arm/arch-ixp23xx/entry-macro.S
index 867761677b57..ec9dd6fc2d0f 100644
--- a/include/asm-arm/arch-ixp23xx/entry-macro.S
+++ b/include/asm-arm/arch-ixp23xx/entry-macro.S
@@ -5,6 +5,12 @@
5 .macro disable_fiq 5 .macro disable_fiq
6 .endm 6 .endm
7 7
8 .macro get_irqnr_preamble, base, tmp
9 .endm
10
11 .macro arch_ret_to_user, tmp1, tmp2
12 .endm
13
8 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
9 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET) 15 ldr \irqnr, =(IXP23XX_INTC_VIRT + IXP23XX_INTR_IRQ_ENC_ST_OFFSET)
10 ldr \irqnr, [\irqnr] @ get interrupt number 16 ldr \irqnr, [\irqnr] @ get interrupt number
diff --git a/include/asm-arm/arch-ixp23xx/ixdp2351.h b/include/asm-arm/arch-ixp23xx/ixdp2351.h
index 4a24f8f15655..d5e8a43d7bbd 100644
--- a/include/asm-arm/arch-ixp23xx/ixdp2351.h
+++ b/include/asm-arm/arch-ixp23xx/ixdp2351.h
@@ -46,7 +46,7 @@
46#define IXDP2351_VIRT_NVRAM_BASE IXDP2351_BB_AREA_BASE(0x0) 46#define IXDP2351_VIRT_NVRAM_BASE IXDP2351_BB_AREA_BASE(0x0)
47#define IXDP2351_NVRAM_SIZE (0x20000) 47#define IXDP2351_NVRAM_SIZE (0x20000)
48 48
49#define IXDP2351_VIRT_MB_IXF1104_BASE IXDP3251_BB_AREA_BASE(0x00020000) 49#define IXDP2351_VIRT_MB_IXF1104_BASE IXDP2351_BB_AREA_BASE(0x00020000)
50#define IXDP2351_VIRT_ADD_UART_BASE IXDP2351_BB_AREA_BASE(0x000240C0) 50#define IXDP2351_VIRT_ADD_UART_BASE IXDP2351_BB_AREA_BASE(0x000240C0)
51#define IXDP2351_VIRT_FIC_BASE IXDP2351_BB_AREA_BASE(0x00200000) 51#define IXDP2351_VIRT_FIC_BASE IXDP2351_BB_AREA_BASE(0x00200000)
52#define IXDP2351_VIRT_DB0_BASE IXDP2351_BB_AREA_BASE(0x00400000) 52#define IXDP2351_VIRT_DB0_BASE IXDP2351_BB_AREA_BASE(0x00400000)
diff --git a/include/asm-arm/arch-ixp4xx/avila.h b/include/asm-arm/arch-ixp4xx/avila.h
new file mode 100644
index 000000000000..0dfea0ccd6ba
--- /dev/null
+++ b/include/asm-arm/arch-ixp4xx/avila.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-arm/arch-ixp4xx/avila.h
3 *
4 * Gateworks Avila platform specific definitions
5 *
6 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
7 *
8 * Based on ixdp425.h
9 * Author: Deepak Saxena <dsaxena@plexity.net>
10 *
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <asm/hardware.h>"
20#endif
21
22#define AVILA_SDA_PIN 7
23#define AVILA_SCL_PIN 6
24
25/*
26 * AVILA PCI IRQs
27 */
28#define AVILA_PCI_MAX_DEV 4
29#define LOFT_PCI_MAX_DEV 6
30#define AVILA_PCI_IRQ_LINES 4
31
32
33/* PCI controller GPIO to IRQ pin mappings */
34#define AVILA_PCI_INTA_PIN 11
35#define AVILA_PCI_INTB_PIN 10
36#define AVILA_PCI_INTC_PIN 9
37#define AVILA_PCI_INTD_PIN 8
38
39
diff --git a/include/asm-arm/arch-ixp4xx/entry-macro.S b/include/asm-arm/arch-ixp4xx/entry-macro.S
index 27e124132e4c..dadb568b7ef0 100644
--- a/include/asm-arm/arch-ixp4xx/entry-macro.S
+++ b/include/asm-arm/arch-ixp4xx/entry-macro.S
@@ -12,6 +12,12 @@
12 .macro disable_fiq 12 .macro disable_fiq
13 .endm 13 .endm
14 14
15 .macro get_irqnr_preamble, base, tmp
16 .endm
17
18 .macro arch_ret_to_user, tmp1, tmp2
19 .endm
20
15 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 21 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
16 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET) 22 ldr \irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)
17 ldr \irqstat, [\irqstat] @ get interrupts 23 ldr \irqstat, [\irqstat] @ get interrupts
diff --git a/include/asm-arm/arch-ixp4xx/hardware.h b/include/asm-arm/arch-ixp4xx/hardware.h
index 6acb69c95ef9..88fd0877dcc1 100644
--- a/include/asm-arm/arch-ixp4xx/hardware.h
+++ b/include/asm-arm/arch-ixp4xx/hardware.h
@@ -42,6 +42,7 @@ extern unsigned int processor_id;
42 42
43/* Platform specific details */ 43/* Platform specific details */
44#include "ixdp425.h" 44#include "ixdp425.h"
45#include "avila.h"
45#include "coyote.h" 46#include "coyote.h"
46#include "prpmc1100.h" 47#include "prpmc1100.h"
47#include "nslu2.h" 48#include "nslu2.h"
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index 0d517267fb63..a41ba229c564 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -238,26 +238,6 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l)) 238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l)) 239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
240 240
241#define eth_io_copy_and_sum(s,c,l,b) \
242 eth_copy_and_sum((s),__mem_pci(c),(l),(b))
243
244static inline int
245check_signature(const unsigned char __iomem *bus_addr, const unsigned char *signature,
246 int length)
247{
248 int retval = 0;
249 do {
250 if (readb(bus_addr) != *signature)
251 goto out;
252 bus_addr++;
253 signature++;
254 length--;
255 } while (length);
256 retval = 1;
257out:
258 return retval;
259}
260
261#endif 241#endif
262 242
263#ifndef CONFIG_PCI 243#ifndef CONFIG_PCI
diff --git a/include/asm-arm/arch-ixp4xx/irqs.h b/include/asm-arm/arch-ixp4xx/irqs.h
index f24b763ca18e..e44a563d00ff 100644
--- a/include/asm-arm/arch-ixp4xx/irqs.h
+++ b/include/asm-arm/arch-ixp4xx/irqs.h
@@ -79,6 +79,15 @@
79#define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8 79#define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8
80 80
81/* 81/*
82 * Gateworks Avila board IRQs
83 */
84#define IRQ_AVILA_PCI_INTA IRQ_IXP4XX_GPIO11
85#define IRQ_AVILA_PCI_INTB IRQ_IXP4XX_GPIO10
86#define IRQ_AVILA_PCI_INTC IRQ_IXP4XX_GPIO9
87#define IRQ_AVILA_PCI_INTD IRQ_IXP4XX_GPIO8
88
89
90/*
82 * PrPMC1100 Board IRQs 91 * PrPMC1100 Board IRQs
83 */ 92 */
84#define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11 93#define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11
diff --git a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
index 9444958bec1e..ed35e5c94f40 100644
--- a/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
+++ b/include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
@@ -144,9 +144,9 @@
144#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) 144#define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
145#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) 145#define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
146#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) 146#define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
147#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000) 147#define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
148#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000) 148#define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
149#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000) 149#define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
150#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) 150#define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
151#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) 151#define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
152#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) 152#define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
diff --git a/include/asm-arm/arch-ixp4xx/udc.h b/include/asm-arm/arch-ixp4xx/udc.h
index dbdec36ff0d1..79b850a3be47 100644
--- a/include/asm-arm/arch-ixp4xx/udc.h
+++ b/include/asm-arm/arch-ixp4xx/udc.h
@@ -6,3 +6,25 @@
6 6
7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); 7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
8 8
9static inline int udc_gpio_to_irq(unsigned gpio)
10{
11 return 0;
12}
13
14static inline void udc_gpio_init_vbus(unsigned gpio)
15{
16}
17
18static inline void udc_gpio_init_pullup(unsigned gpio)
19{
20}
21
22static inline int udc_gpio_get(unsigned gpio)
23{
24 return 0;
25}
26
27static inline void udc_gpio_set(unsigned gpio, int is_on)
28{
29}
30
diff --git a/include/asm-arm/arch-l7200/entry-macro.S b/include/asm-arm/arch-l7200/entry-macro.S
index 8b6342dc4be2..63411d3e9df4 100644
--- a/include/asm-arm/arch-l7200/entry-macro.S
+++ b/include/asm-arm/arch-l7200/entry-macro.S
@@ -14,6 +14,12 @@
14 .macro disable_fiq 14 .macro disable_fiq
15 .endm 15 .endm
16 16
17 .macro get_irqnr_preamble, base, tmp
18 .endm
19
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
17 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
18 mov \irqstat, #irq_base_addr @ Virt addr IRQ regs 24 mov \irqstat, #irq_base_addr @ Virt addr IRQ regs
19 add \irqstat, \irqstat, #0x00001000 @ Status reg 25 add \irqstat, \irqstat, #0x00001000 @ Status reg
diff --git a/include/asm-arm/arch-lh7a40x/entry-macro.S b/include/asm-arm/arch-lh7a40x/entry-macro.S
index 9fc7f4988124..ffe397250f0c 100644
--- a/include/asm-arm/arch-lh7a40x/entry-macro.S
+++ b/include/asm-arm/arch-lh7a40x/entry-macro.S
@@ -26,6 +26,12 @@
26 .macro disable_fiq 26 .macro disable_fiq
27 .endm 27 .endm
28 28
29 .macro get_irqnr_preamble, base, tmp
30 .endm
31
32 .macro arch_ret_to_user, tmp1, tmp2
33 .endm
34
29 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 35 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30 36
31branch_irq_lh7a400: b 1000f 37branch_irq_lh7a400: b 1000f
@@ -80,6 +86,12 @@ branch_irq_lh7a400: b 1000f
80 .macro disable_fiq 86 .macro disable_fiq
81 .endm 87 .endm
82 88
89 .macro get_irqnr_preamble, base, tmp
90 .endm
91
92 .macro arch_ret_to_user, tmp1, tmp2
93 .endm
94
83 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 95 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
84 mov \irqnr, #0 96 mov \irqnr, #0
85 mov \base, #io_p2v(0x80000000) @ APB registers 97 mov \base, #io_p2v(0x80000000) @ APB registers
@@ -99,6 +111,12 @@ branch_irq_lh7a400: b 1000f
99 .macro disable_fiq 111 .macro disable_fiq
100 .endm 112 .endm
101 113
114 .macro get_irqnr_preamble, base, tmp
115 .endm
116
117 .macro arch_ret_to_user, tmp1, tmp2
118 .endm
119
102 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 120 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
103 mov \irqnr, #0 @ VIC1 irq base 121 mov \irqnr, #0 @ VIC1 irq base
104 mov \base, #io_p2v(0x80000000) @ APB registers 122 mov \base, #io_p2v(0x80000000) @ APB registers
diff --git a/include/asm-arm/arch-netx/entry-macro.S b/include/asm-arm/arch-netx/entry-macro.S
index 658df4d60ff3..83ad188a0847 100644
--- a/include/asm-arm/arch-netx/entry-macro.S
+++ b/include/asm-arm/arch-netx/entry-macro.S
@@ -23,6 +23,12 @@
23 .macro disable_fiq 23 .macro disable_fiq
24 .endm 24 .endm
25 25
26 .macro get_irqnr_preamble, base, tmp
27 .endm
28
29 .macro arch_ret_to_user, tmp1, tmp2
30 .endm
31
26 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
27 mov \base, #io_p2v(0x00100000) 33 mov \base, #io_p2v(0x00100000)
28 add \base, \base, #0x000ff000 34 add \base, \base, #0x000ff000
diff --git a/include/asm-arm/arch-ns9xxx/board.h b/include/asm-arm/arch-ns9xxx/board.h
new file mode 100644
index 000000000000..91dc8fb1027f
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/board.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-arm/arch-ns9xxx/board.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_BOARD_H
12#define __ASM_ARCH_BOARD_H
13
14#include <asm/mach-types.h>
15
16#define board_is_a9m9750dev() (machine_is_cc9p9360dev())
17
18#endif /* ifndef __ASM_ARCH_BOARD_H */
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h
new file mode 100644
index 000000000000..a7c5ab3d9011
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/clock.h
@@ -0,0 +1,41 @@
1/*
2 * include/asm-arm/arch-ns9xxx/clock.h
3 *
4 * Copyright (C) 2007 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_CLOCK_H
12#define __ASM_ARCH_CLOCK_H
13
14static inline u32 ns9xxx_systemclock(void) __attribute__((const));
15static inline u32 ns9xxx_systemclock(void)
16{
17 /*
18 * This should be a multiple of HZ * TIMERCLOCKSELECT (in time.c)
19 */
20 return 353894400;
21}
22
23static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
24static inline u32 ns9xxx_cpuclock(void)
25{
26 return ns9xxx_systemclock() / 2;
27}
28
29static inline u32 ns9xxx_ahbclock(void) __attribute__((const));
30static inline u32 ns9xxx_ahbclock(void)
31{
32 return ns9xxx_systemclock() / 4;
33}
34
35static inline u32 ns9xxx_bbusclock(void) __attribute__((const));
36static inline u32 ns9xxx_bbusclock(void)
37{
38 return ns9xxx_systemclock() / 8;
39}
40
41#endif /* ifndef __ASM_ARCH_CLOCK_H */
diff --git a/include/asm-arm/arch-ns9xxx/debug-macro.S b/include/asm-arm/arch-ns9xxx/debug-macro.S
new file mode 100644
index 000000000000..b21b93eb2dbc
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/debug-macro.S
@@ -0,0 +1,22 @@
1/*
2 * include/asm-arm/arch-ns9xxx/debug-macro.S
3 * Copyright (C) 2006 by Digi International Inc.
4 * All rights reserved.
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 version 2 as published by
8 * the Free Software Foundation.
9 */
10#include <asm/hardware.h>
11
12#include <asm/arch-ns9xxx/regs-board-a9m9750dev.h>
13
14 .macro addruart,rx
15 mrc p15, 0, \rx, c1, c0
16 tst \rx, #1
17 ldreq \rx, =NS9XXX_CSxSTAT_PHYS(0)
18 ldrne \rx, =io_p2v(NS9XXX_CSxSTAT_PHYS(0))
19 .endm
20
21#define UART_SHIFT 2
22#include <asm/hardware/debug-8250.S>
diff --git a/include/asm-arm/arch-ns9xxx/dma.h b/include/asm-arm/arch-ns9xxx/dma.h
new file mode 100644
index 000000000000..a67cbbe009c4
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/dma.h
@@ -0,0 +1,14 @@
1/*
2 * include/asm-arm/arch-ns9xxx/dma.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_DMA_H
12#define __ASM_ARCH_DMA_H
13
14#endif /* ifndef __ASM_ARCH_DMA_H */
diff --git a/include/asm-arm/arch-ns9xxx/entry-macro.S b/include/asm-arm/arch-ns9xxx/entry-macro.S
new file mode 100644
index 000000000000..86aec87303e4
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/entry-macro.S
@@ -0,0 +1,28 @@
1/*
2 * include/asm-arm/arch-ns9xxx/entry-macro.S
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#include <asm/hardware.h>
12#include <asm/arch-ns9xxx/regs-sys.h>
13
14 .macro get_irqnr_preamble, base, tmp
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
21 ldr \base, =SYS_ISRADDR
22 ldr \irqstat, [\base, #(SYS_ISA - SYS_ISRADDR)]
23 cmp \irqstat, #0
24 ldrne \irqnr, [\base]
25 .endm
26
27 .macro disable_fiq
28 .endm
diff --git a/include/asm-arm/arch-ns9xxx/hardware.h b/include/asm-arm/arch-ns9xxx/hardware.h
new file mode 100644
index 000000000000..6819da7c48d4
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/hardware.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-arm/arch-ns9xxx/hardware.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_HARDWARE_H
12#define __ASM_ARCH_HARDWARE_H
13
14#include <asm/memory.h>
15
16/*
17 * NetSilicon NS9xxx internal mapping:
18 *
19 * physical <--> virtual
20 * 0x90000000 - 0x906fffff <--> 0xf9000000 - 0xf96fffff
21 * 0xa0100000 - 0xa0afffff <--> 0xfa100000 - 0xfaafffff
22 */
23#define io_p2v(x) (0xf0000000 \
24 + (((x) & 0xf0000000) >> 4) \
25 + ((x) & 0x00ffffff))
26
27#define io_v2p(x) ((((x) & 0x0f000000) << 4) \
28 + ((x) & 0x00ffffff))
29
30#define __REGBIT(bit) ((u32)1 << (bit))
31#define __REGBITS(hbit, lbit) ((((u32)1 << ((hbit) - (lbit) + 1)) - 1) << (lbit))
32#define __REGVAL(mask, value) (((value) * ((mask) & (-(mask))) & (mask)))
33
34#ifndef __ASSEMBLY__
35
36# define __REG(x) (*((volatile u32 *)io_p2v((x))))
37# define __REG2(x, y) (*((volatile u32 *)io_p2v((x)) + (y)))
38
39# define __REGB(x) (*((volatile u8 *)io_p2v((x))))
40# define __REGB2(x) (*((volatile u8 *)io_p2v((x)) + (y)))
41
42# define REGSET(var, reg, field, value) \
43 ((var) = (((var) \
44 & ~(reg ## _ ## field & \
45 ~ reg ## _ ## field ## _ ## value)) \
46 | (reg ## _ ## field ## _ ## value)))
47
48# define REGSETIM(var, reg, field, value) \
49 ((var) = (((var) \
50 & ~(reg ## _ ## field & \
51 ~(__REGVAL(reg ## _ ## field, value)))) \
52 | (__REGVAL(reg ## _ ## field, value))))
53
54# define REGGET(reg, field) \
55 ((reg & (reg ## _ ## field)) / (field & (-field)))
56
57#else
58
59# define __REG(x) io_p2v(x)
60# define __REG2(x, y) io_p2v((x) + (y))
61
62# define __REGB(x) __REG((x))
63# define __REGB2(x, y) __REG2((x), (y))
64
65#endif
66
67#endif /* ifndef __ASM_ARCH_HARDWARE_H */
diff --git a/include/asm-arm/arch-ns9xxx/io.h b/include/asm-arm/arch-ns9xxx/io.h
new file mode 100644
index 000000000000..6f82d28af120
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/io.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-ns9xxx/io.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff /* XXX */
15
16#define __io(a) ((void __iomem *)(a))
17#define __mem_pci(a) (a)
18#define __mem_isa(a) (IO_BASE + (a))
19
20#endif /* ifndef __ASM_ARCH_IO_H */
diff --git a/include/asm-arm/arch-ns9xxx/irqs.h b/include/asm-arm/arch-ns9xxx/irqs.h
new file mode 100644
index 000000000000..25d8d28b27f3
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/irqs.h
@@ -0,0 +1,85 @@
1/*
2 * include/asm-arm/arch-ns9xxx/irqs.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_IRQS_H
12#define __ASM_ARCH_IRQS_H
13
14#define IRQ_WATCHDOG 0
15#define IRQ_AHBBUSERR 1
16#define IRQ_BBUSAGG 2
17/* irq 3 is reserved for NS9360 */
18#define IRQ_ETHRX 4
19#define IRQ_ETHTX 5
20#define IRQ_ETHPHY 6
21#define IRQ_LCD 7
22#define IRQ_SERBRX 8
23#define IRQ_SERBTX 9
24#define IRQ_SERARX 10
25#define IRQ_SERATX 11
26#define IRQ_SERCRX 12
27#define IRQ_SERCTX 13
28#define IRQ_I2C 14
29#define IRQ_BBUSDMA 15
30#define IRQ_TIMER0 16
31#define IRQ_TIMER1 17
32#define IRQ_TIMER2 18
33#define IRQ_TIMER3 19
34#define IRQ_TIMER4 20
35#define IRQ_TIMER5 21
36#define IRQ_TIMER6 22
37#define IRQ_TIMER7 23
38#define IRQ_RTC 24
39#define IRQ_USBHOST 25
40#define IRQ_USBDEVICE 26
41#define IRQ_IEEE1284 27
42#define IRQ_EXT0 28
43#define IRQ_EXT1 29
44#define IRQ_EXT2 30
45#define IRQ_EXT3 31
46
47#define BBUS_IRQ(irq) (32 + irq)
48
49#define IRQ_BBUS_DMA BBUS_IRQ(0)
50#define IRQ_BBUS_SERBRX BBUS_IRQ(2)
51#define IRQ_BBUS_SERBTX BBUS_IRQ(3)
52#define IRQ_BBUS_SERARX BBUS_IRQ(4)
53#define IRQ_BBUS_SERATX BBUS_IRQ(5)
54#define IRQ_BBUS_SERCRX BBUS_IRQ(6)
55#define IRQ_BBUS_SERCTX BBUS_IRQ(7)
56#define IRQ_BBUS_SERDRX BBUS_IRQ(8)
57#define IRQ_BBUS_SERDTX BBUS_IRQ(9)
58#define IRQ_BBUS_I2C BBUS_IRQ(10)
59#define IRQ_BBUS_1284 BBUS_IRQ(11)
60#define IRQ_BBUS_UTIL BBUS_IRQ(12)
61#define IRQ_BBUS_RTC BBUS_IRQ(13)
62#define IRQ_BBUS_USBHST BBUS_IRQ(14)
63#define IRQ_BBUS_USBDEV BBUS_IRQ(15)
64#define IRQ_BBUS_AHBDMA1 BBUS_IRQ(24)
65#define IRQ_BBUS_AHBDMA2 BBUS_IRQ(25)
66
67/*
68 * these Interrupts are specific for the a9m9750dev board.
69 * They are generated by an FPGA that interrupts the CPU on
70 * IRQ_EXT2
71 */
72#define FPGA_IRQ(irq) (64 + irq)
73
74#define IRQ_FPGA_UARTA FPGA_IRQ(0)
75#define IRQ_FPGA_UARTB FPGA_IRQ(1)
76#define IRQ_FPGA_UARTC FPGA_IRQ(2)
77#define IRQ_FPGA_UARTD FPGA_IRQ(3)
78#define IRQ_FPGA_TOUCH FPGA_IRQ(4)
79#define IRQ_FPGA_CF FPGA_IRQ(5)
80#define IRQ_FPGA_CAN0 FPGA_IRQ(6)
81#define IRQ_FPGA_CAN1 FPGA_IRQ(7)
82
83#define NR_IRQS 72
84
85#endif /* __ASM_ARCH_IRQS_H */
diff --git a/include/asm-arm/arch-ns9xxx/memory.h b/include/asm-arm/arch-ns9xxx/memory.h
new file mode 100644
index 000000000000..ce1343e593e1
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/memory.h
@@ -0,0 +1,27 @@
1/*
2 * include/asm-arm/arch-ns9xxx/memory.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10*/
11#ifndef __ASM_ARCH_MEMORY_H
12#define __ASM_ARCH_MEMORY_H
13
14/* x in [0..3] */
15#define NS9XXX_CSxSTAT_PHYS(x) UL(((x) + 4) << 28)
16
17#define NS9XXX_CS0STAT_LENGTH UL(0x1000)
18#define NS9XXX_CS1STAT_LENGTH UL(0x1000)
19#define NS9XXX_CS2STAT_LENGTH UL(0x1000)
20#define NS9XXX_CS3STAT_LENGTH UL(0x1000)
21
22#define PHYS_OFFSET UL(0x00000000)
23
24#define __virt_to_bus(x) __virt_to_phys(x)
25#define __bus_to_virt(x) __phys_to_virt(x)
26
27#endif
diff --git a/include/asm-arm/arch-ns9xxx/processor.h b/include/asm-arm/arch-ns9xxx/processor.h
new file mode 100644
index 000000000000..716c106ac0bf
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/processor.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-arm/arch-ns9xxx/processor.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_PROCESSOR_H
12#define __ASM_ARCH_PROCESSOR_H
13
14#include <asm/mach-types.h>
15
16#define processor_is_ns9360() (machine_is_cc9p9360dev())
17
18#endif /* ifndef __ASM_ARCH_PROCESSOR_H */
diff --git a/include/asm-arm/arch-ns9xxx/regs-bbu.h b/include/asm-arm/arch-ns9xxx/regs-bbu.h
new file mode 100644
index 000000000000..e26269546240
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/regs-bbu.h
@@ -0,0 +1,21 @@
1/*
2 * include/asm-arm/arch-ns9xxx/regs-bbu.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSBBU_H
12#define __ASM_ARCH_REGSBBU_H
13
14#include <asm/hardware.h>
15
16/* BBus Utility */
17
18/* GPIO Configuration Register */
19#define BBU_GC(x) __REG2(0x9060000c, (x))
20
21#endif /* ifndef __ASM_ARCH_REGSBBU_H */
diff --git a/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h b/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h
new file mode 100644
index 000000000000..c3dc532dd20c
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h
@@ -0,0 +1,24 @@
1/*
2 * include/asm-arm/arch-ns9xxx/regs-board-a9m9750dev.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSBOARDA9M9750_H
12#define __ASM_ARCH_REGSBOARDA9M9750_H
13
14#include <asm/hardware.h>
15
16#define FPGA_UARTA_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0))
17#define FPGA_UARTB_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x08)
18#define FPGA_UARTC_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x10)
19#define FPGA_UARTD_BASE io_p2v(NS9XXX_CSxSTAT_PHYS(0) + 0x18)
20
21#define FPGA_IER __REGB(NS9XXX_CSxSTAT_PHYS(0) + 0x50)
22#define FPGA_ISR __REGB(NS9XXX_CSxSTAT_PHYS(0) + 0x60)
23
24#endif /* ifndef __ASM_ARCH_REGSBOARDA9M9750_H */
diff --git a/include/asm-arm/arch-ns9xxx/regs-mem.h b/include/asm-arm/arch-ns9xxx/regs-mem.h
new file mode 100644
index 000000000000..8ed8448767b9
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/regs-mem.h
@@ -0,0 +1,135 @@
1/*
2 * include/asm-arm/arch-ns9xxx/regs-mem.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSMEM_H
12#define __ASM_ARCH_REGSMEM_H
13
14#include <asm/hardware.h>
15
16/* Memory Module */
17
18/* Control register */
19#define MEM_CTRL __REG(0xa0700000)
20
21/* Status register */
22#define MEM_STAT __REG(0xa0700004)
23
24/* Configuration register */
25#define MEM_CONF __REG(0xa0700008)
26
27/* Dynamic Memory Control register */
28#define MEM_DMCTRL __REG(0xa0700020)
29
30/* Dynamic Memory Refresh Timer */
31#define MEM_DMRT __REG(0xa0700024)
32
33/* Dynamic Memory Read Configuration register */
34#define MEM_DMRC __REG(0xa0700028)
35
36/* Dynamic Memory Precharge Command Period (tRP) */
37#define MEM_DMPCP __REG(0xa0700030)
38
39/* Dynamic Memory Active to Precharge Command Period (tRAS) */
40#define MEM_DMAPCP __REG(0xa0700034)
41
42/* Dynamic Memory Self-Refresh Exit Time (tSREX) */
43#define MEM_DMSRET __REG(0xa0700038)
44
45/* Dynamic Memory Last Data Out to Active Time (tAPR) */
46#define MEM_DMLDOAT __REG(0xa070003c)
47
48/* Dynamic Memory Data-in to Active Command Time (tDAL or TAPW) */
49#define MEM_DMDIACT __REG(0xa0700040)
50
51/* Dynamic Memory Write Recovery Time (tWR, tDPL, tRWL, tRDL) */
52#define MEM_DMWRT __REG(0xa0700044)
53
54/* Dynamic Memory Active to Active Command Period (tRC) */
55#define MEM_DMAACP __REG(0xa0700048)
56
57/* Dynamic Memory Auto Refresh Period, and Auto Refresh to Active Command Period (tRFC) */
58#define MEM_DMARP __REG(0xa070004c)
59
60/* Dynamic Memory Exit Self-Refresh to Active Command (tXSR) */
61#define MEM_DMESRAC __REG(0xa0700050)
62
63/* Dynamic Memory Active Bank A to Active B Time (tRRD) */
64#define MEM_DMABAABT __REG(0xa0700054)
65
66/* Dynamic Memory Load Mode register to Active Command Time (tMRD) */
67#define MEM_DMLMACT __REG(0xa0700058)
68
69/* Static Memory Extended Wait */
70#define MEM_SMEW __REG(0xa0700080)
71
72/* Dynamic Memory Configuration Register x */
73#define MEM_DMCONF(x) __REG2(0xa0700100, (x) << 3)
74
75/* Dynamic Memory RAS and CAS Delay x */
76#define MEM_DMRCD(x) __REG2(0xa0700104, (x) << 3)
77
78/* Static Memory Configuration Register x */
79#define MEM_SMC(x) __REG2(0xa0700200, (x) << 3)
80
81/* Static Memory Configuration Register x: Write protect */
82#define MEM_SMC_WSMC __REGBIT(20)
83#define MEM_SMC_WSMC_OFF __REGVAL(MEM_SMC_WSMC, 0)
84#define MEM_SMC_WSMC_ON __REGVAL(MEM_SMC_WSMC, 1)
85
86/* Static Memory Configuration Register x: Buffer enable */
87#define MEM_SMC_BSMC __REGBIT(19)
88#define MEM_SMC_BSMC_OFF __REGVAL(MEM_SMC_BSMC, 0)
89#define MEM_SMC_BSMC_ON __REGVAL(MEM_SMC_BSMC, 1)
90
91/* Static Memory Configuration Register x: Extended Wait */
92#define MEM_SMC_EW __REGBIT(8)
93#define MEM_SMC_EW_OFF __REGVAL(MEM_SMC_EW, 0)
94#define MEM_SMC_EW_ON __REGVAL(MEM_SMC_EW, 1)
95
96/* Static Memory Configuration Register x: Byte lane state */
97#define MEM_SMC_PB __REGBIT(7)
98#define MEM_SMC_PB_0 __REGVAL(MEM_SMC_PB, 0)
99#define MEM_SMC_PB_1 __REGVAL(MEM_SMC_PB, 1)
100
101/* Static Memory Configuration Register x: Chip select polarity */
102#define MEM_SMC_PC __REGBIT(6)
103#define MEM_SMC_PC_AL __REGVAL(MEM_SMC_PC, 0)
104#define MEM_SMC_PC_AH __REGVAL(MEM_SMC_PC, 1)
105
106/* static memory configuration register x: page mode*/
107#define MEM_SMC_PM __REGBIT(3)
108#define MEM_SMC_PM_DIS __REGVAL(MEM_SMC_PM, 0)
109#define MEM_SMC_PM_ASYNC __REGVAL(MEM_SMC_PM, 1)
110
111/* static memory configuration register x: Memory width */
112#define MEM_SMC_MW __REGBITS(1, 0)
113#define MEM_SMC_MW_8 __REGVAL(MEM_SMC_MW, 0)
114#define MEM_SMC_MW_16 __REGVAL(MEM_SMC_MW, 1)
115#define MEM_SMC_MW_32 __REGVAL(MEM_SMC_MW, 2)
116
117/* Static Memory Write Enable Delay x */
118#define MEM_SMWED(x) __REG2(0xa0700204, (x) << 3)
119
120/* Static Memory Output Enable Delay x */
121#define MEM_SMOED(x) __REG2(0xa0700208, (x) << 3)
122
123/* Static Memory Read Delay x */
124#define MEM_SMRD(x) __REG2(0xa070020c, (x) << 3)
125
126/* Static Memory Page Mode Read Delay 0 */
127#define MEM_SMPMRD(x) __REG2(0xa0700210, (x) << 3)
128
129/* Static Memory Write Delay */
130#define MEM_SMWD(x) __REG2(0xa0700214, (x) << 3)
131
132/* Static Memory Turn Round Delay x */
133#define MEM_SWT(x) __REG2(0xa0700218, (x) << 3)
134
135#endif /* ifndef __ASM_ARCH_REGSMEM_H */
diff --git a/include/asm-arm/arch-ns9xxx/regs-sys.h b/include/asm-arm/arch-ns9xxx/regs-sys.h
new file mode 100644
index 000000000000..8162a50bb273
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/regs-sys.h
@@ -0,0 +1,157 @@
1/*
2 * include/asm-arm/arch-ns9xxx/regs-sys.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_REGSSYS_H
12#define __ASM_ARCH_REGSSYS_H
13
14#include <asm/hardware.h>
15
16/* System Control Module */
17
18/* AHB Arbiter Gen Configuration */
19#define SYS_AHBAGENCONF __REG(0xa0900000)
20
21/* BRC */
22#define SYS_BRC(x) __REG2(0xa0900004, (x))
23
24/* Timer x Reload Count register */
25#define SYS_TRC(x) __REG2(0xa0900044, (x))
26
27/* Timer x Read register */
28#define SYS_TR(x) __REG2(0xa0900084, (x))
29
30/* Interrupt Vector Address Register Level x */
31#define SYS_IVA(x) __REG2(0xa09000c4, (x))
32
33/* Interrupt Configuration registers */
34#define SYS_IC(x) __REG2(0xa0900144, (x))
35
36/* ISRADDR */
37#define SYS_ISRADDR __REG(0xa0900164)
38
39/* Interrupt Status Active */
40#define SYS_ISA __REG(0xa0900168)
41
42/* Interrupt Status Raw */
43#define SYS_ISR __REG(0xa090016c)
44
45/* Timer Interrupt Status register */
46#define SYS_TIS __REG(0xa0900170)
47
48/* PLL Configuration register */
49#define SYS_PLL __REG(0xa0900188)
50
51/* PLL Configuration register: PLL SW change */
52#define SYS_PLL_SWC __REGBIT(15)
53#define SYS_PLL_SWC_NO __REGVAL(SYS_PLL_SWC, 0)
54#define SYS_PLL_SWC_YES __REGVAL(SYS_PLL_SWC, 1)
55
56/* Timer x Control register */
57#define SYS_TC(x) __REG2(0xa0900190, (x))
58
59/* Timer x Control register: Timer enable */
60#define SYS_TCx_TEN __REGBIT(15)
61#define SYS_TCx_TEN_DIS __REGVAL(SYS_TCx_TEN, 1)
62#define SYS_TCx_TEN_EN __REGVAL(SYS_TCx_TEN, 1)
63
64/* Timer x Control register: CPU debug mode */
65#define SYS_TCx_TDBG __REGBIT(10)
66#define SYS_TCx_TDBG_CONT __REGVAL(SYS_TCx_TDBG, 0)
67#define SYS_TCx_TDBG_STOP __REGVAL(SYS_TCx_TDBG, 1)
68
69/* Timer x Control register: Interrupt clear */
70#define SYS_TCx_INTC __REGBIT(9)
71#define SYS_TCx_INTC_UNSET __REGVAL(SYS_TCx_INTC, 0)
72#define SYS_TCx_INTC_SET __REGVAL(SYS_TCx_INTC, 1)
73
74/* Timer x Control register: Timer clock select */
75#define SYS_TCx_TLCS __REGBITS(8, 6)
76#define SYS_TCx_TLCS_CPU __REGVAL(SYS_TCx_TLCS, 0) /* CPU clock */
77#define SYS_TCx_TLCS_DIV2 __REGVAL(SYS_TCx_TLCS, 1) /* CPU clock / 2 */
78#define SYS_TCx_TLCS_DIV4 __REGVAL(SYS_TCx_TLCS, 2) /* CPU clock / 4 */
79#define SYS_TCx_TLCS_DIV8 __REGVAL(SYS_TCx_TLCS, 3) /* CPU clock / 8 */
80#define SYS_TCx_TLCS_DIV16 __REGVAL(SYS_TCx_TLCS, 4) /* CPU clock / 16 */
81#define SYS_TCx_TLCS_DIV32 __REGVAL(SYS_TCx_TLCS, 5) /* CPU clock / 32 */
82#define SYS_TCx_TLCS_DIV64 __REGVAL(SYS_TCx_TLCS, 6) /* CPU clock / 64 */
83#define SYS_TCx_TLCS_EXT __REGVAL(SYS_TCx_TLCS, 7)
84
85/* Timer x Control register: Timer mode */
86#define SYS_TCx_TM __REGBITS(5, 4)
87#define SYS_TCx_TM_IEE __REGVAL(SYS_TCx_TM, 0) /* Internal timer or external event */
88#define SYS_TCx_TM_ELL __REGVAL(SYS_TCx_TM, 1) /* External low-level, gated timer */
89#define SYS_TCx_TM_EHL __REGVAL(SYS_TCx_TM, 2) /* External high-level, gated timer */
90#define SYS_TCx_TM_CONCAT __REGVAL(SYS_TCx_TM, 3) /* Concatenate the lower timer. */
91
92/* Timer x Control register: Interrupt select */
93#define SYS_TCx_INTS __REGBIT(3)
94#define SYS_TCx_INTS_DIS __REGVAL(SYS_TCx_INTS, 0)
95#define SYS_TCx_INTS_EN __REGVAL(SYS_TCx_INTS, 1)
96
97/* Timer x Control register: Up/down select */
98#define SYS_TCx_UDS __REGBIT(2)
99#define SYS_TCx_UDS_UP __REGVAL(SYS_TCx_UDS, 0)
100#define SYS_TCx_UDS_DOWN __REGVAL(SYS_TCx_UDS, 1)
101
102/* Timer x Control register: 32- or 16-bit timer */
103#define SYS_TCx_TSZ __REGBIT(1)
104#define SYS_TCx_TSZ_16 __REGVAL(SYS_TCx_TSZ, 0)
105#define SYS_TCx_TSZ_32 __REGVAL(SYS_TCx_TSZ, 1)
106
107/* Timer x Control register: Reload enable */
108#define SYS_TCx_REN __REGBIT(0)
109#define SYS_TCx_REN_DIS __REGVAL(SYS_TCx_REN, 0)
110#define SYS_TCx_REN_EN __REGVAL(SYS_TCx_REN, 1)
111
112/* System Memory Chip Select x Dynamic Memory Base */
113#define SYS_SMCSDMB(x) __REG2(0xa09001d0, (x) << 1)
114
115/* System Memory Chip Select x Dynamic Memory Mask */
116#define SYS_SMCSDMM(x) __REG2(0xa09001d4, (x) << 1)
117
118/* System Memory Chip Select x Static Memory Base */
119#define SYS_SMCSSMB(x) __REG2(0xa09001f0, (x) << 1)
120
121/* System Memory Chip Select x Static Memory Base: Chip select x base */
122#define SYS_SMCSSMB_CSxB __REGBITS(31, 12)
123
124/* System Memory Chip Select x Static Memory Mask */
125#define SYS_SMCSSMM(x) __REG2(0xa09001f4, (x) << 1)
126
127/* System Memory Chip Select x Static Memory Mask: Chip select x mask */
128#define SYS_SMCSSMM_CSxM __REGBITS(31, 12)
129
130/* System Memory Chip Select x Static Memory Mask: Chip select x enable */
131#define SYS_SMCSSMM_CSEx __REGBIT(0)
132#define SYS_SMCSSMM_CSEx_DIS __REGVAL(SYS_SMCSSMM_CSEx, 0)
133#define SYS_SMCSSMM_CSEx_EN __REGVAL(SYS_SMCSSMM_CSEx, 1)
134
135/* General purpose, user-defined ID register */
136#define SYS_GENID __REG(0xa0900210)
137
138/* External Interrupt x Control register */
139#define SYS_EIC(x) __REG2(0xa0900214, (x))
140
141/* External Interrupt x Control register: Status */
142#define SYS_EIC_STS __REGBIT(3)
143
144/* External Interrupt x Control register: Clear */
145#define SYS_EIC_CLR __REGBIT(2)
146
147/* External Interrupt x Control register: Polarity */
148#define SYS_EIC_PLTY __REGBIT(1)
149#define SYS_EIC_PLTY_AH __REGVAL(SYS_EIC_PLTY, 0)
150#define SYS_EIC_PLTY_AL __REGVAL(SYS_EIC_PLTY, 1)
151
152/* External Interrupt x Control register: Level edge */
153#define SYS_EIC_LVEDG __REGBIT(0)
154#define SYS_EIC_LVEDG_LEVEL __REGVAL(SYS_EIC_LVEDG, 0)
155#define SYS_EIC_LVEDG_EDGE __REGVAL(SYS_EIC_LVEDG, 1)
156
157#endif /* ifndef __ASM_ARCH_REGSSYS_H */
diff --git a/include/asm-arm/arch-ns9xxx/system.h b/include/asm-arm/arch-ns9xxx/system.h
new file mode 100644
index 000000000000..e3cd4d31b3f3
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/system.h
@@ -0,0 +1,34 @@
1/*
2 * include/asm-arm/arch-ns9xxx/system.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H
13
14#include <asm/proc-fns.h>
15#include <asm/arch-ns9xxx/regs-sys.h>
16#include <asm/mach-types.h>
17
18static inline void arch_idle(void)
19{
20 cpu_do_idle();
21}
22
23static inline void arch_reset(char mode)
24{
25 u32 reg;
26
27 reg = SYS_PLL >> 16;
28 REGSET(reg, SYS_PLL, SWC, YES);
29 SYS_PLL = reg;
30
31 BUG();
32}
33
34#endif /* ifndef __ASM_ARCH_SYSTEM_H */
diff --git a/include/asm-arm/arch-ns9xxx/timex.h b/include/asm-arm/arch-ns9xxx/timex.h
new file mode 100644
index 000000000000..f776cbd2622d
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/timex.h
@@ -0,0 +1,20 @@
1/*
2 * include/asm-arm/arch-ns9xxx/timex.h
3 *
4 * Copyright (C) 2005-2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_TIMEX_H
12#define __ASM_ARCH_TIMEX_H
13
14/*
15 * value for CLOCK_TICK_RATE stolen from include/asm-arm/arch-s3c2410/timex.h.
16 * See there for an explanation.
17 */
18#define CLOCK_TICK_RATE 12000000
19
20#endif /* ifndef __ASM_ARCH_TIMEX_H */
diff --git a/include/asm-arm/arch-ns9xxx/uncompress.h b/include/asm-arm/arch-ns9xxx/uncompress.h
new file mode 100644
index 000000000000..961ca7dc9954
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/uncompress.h
@@ -0,0 +1,35 @@
1/*
2 * include/asm-arm/arch-ns9xxx/uncompress.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_UNCOMPRESS_H
12#define __ASM_ARCH_UNCOMPRESS_H
13
14static void putc(char c)
15{
16 volatile u8 *base = (volatile u8 *)0x40000000;
17 int t = 0x10000;
18
19 do {
20 if (base[5] & 0x20) {
21 base[0] = c;
22 break;
23 }
24 } while (--t);
25}
26
27#define arch_decomp_setup()
28#define arch_decomp_wdog()
29
30static void flush(void)
31{
32 /* nothing */
33}
34
35#endif /* ifndef __ASM_ARCH_UNCOMPRESS_H */
diff --git a/include/asm-arm/arch-ns9xxx/vmalloc.h b/include/asm-arm/arch-ns9xxx/vmalloc.h
new file mode 100644
index 000000000000..2f3cb6f6be24
--- /dev/null
+++ b/include/asm-arm/arch-ns9xxx/vmalloc.h
@@ -0,0 +1,16 @@
1/*
2 * include/asm-arm/arch-ns9xxx/vmalloc.h
3 *
4 * Copyright (C) 2006 by Digi International Inc.
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11#ifndef __ASM_ARCH_VMALLOC_H
12#define __ASM_ARCH_VMALLOC_H
13
14#define VMALLOC_END (0xf0000000)
15
16#endif /* ifndef __ASM_ARCH_VMALLOC_H */
diff --git a/include/asm-arm/arch-omap/entry-macro.S b/include/asm-arm/arch-omap/entry-macro.S
index 0ffb1185f1ac..f6967c8df323 100644
--- a/include/asm-arm/arch-omap/entry-macro.S
+++ b/include/asm-arm/arch-omap/entry-macro.S
@@ -29,6 +29,12 @@
29 .macro disable_fiq 29 .macro disable_fiq
30 .endm 30 .endm
31 31
32 .macro get_irqnr_preamble, base, tmp
33 .endm
34
35 .macro arch_ret_to_user, tmp1, tmp2
36 .endm
37
32 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 38 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
33 ldr \base, =IO_ADDRESS(OMAP_IH1_BASE) 39 ldr \base, =IO_ADDRESS(OMAP_IH1_BASE)
34 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET] 40 ldr \irqnr, [\base, #IRQ_ITR_REG_OFFSET]
@@ -55,6 +61,12 @@
55 .macro disable_fiq 61 .macro disable_fiq
56 .endm 62 .endm
57 63
64 .macro get_irqnr_preamble, base, tmp
65 .endm
66
67 .macro arch_ret_to_user, tmp1, tmp2
68 .endm
69
58 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 70 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
59 ldr \base, =VA_IC_BASE 71 ldr \base, =VA_IC_BASE
60 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */ 72 ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
diff --git a/include/asm-arm/arch-omap/gpio.h b/include/asm-arm/arch-omap/gpio.h
index f486b72070ea..590917efc94a 100644
--- a/include/asm-arm/arch-omap/gpio.h
+++ b/include/asm-arm/arch-omap/gpio.h
@@ -76,4 +76,71 @@ extern void omap_set_gpio_direction(int gpio, int is_input);
76extern void omap_set_gpio_dataout(int gpio, int enable); 76extern void omap_set_gpio_dataout(int gpio, int enable);
77extern int omap_get_gpio_datain(int gpio); 77extern int omap_get_gpio_datain(int gpio);
78 78
79/*-------------------------------------------------------------------------*/
80
81/* wrappers for "new style" GPIO calls. the old OMAP-specfic ones should
82 * eventually be removed (along with this errno.h inclusion), and maybe
83 * gpios should put MPUIOs last too.
84 */
85
86#include <asm/errno.h>
87
88static inline int gpio_request(unsigned gpio, const char *label)
89{
90 return omap_request_gpio(gpio);
91}
92
93static inline void gpio_free(unsigned gpio)
94{
95 omap_free_gpio(gpio);
96}
97
98static inline int __gpio_set_direction(unsigned gpio, int is_input)
99{
100 if (cpu_class_is_omap2()) {
101 if (gpio > OMAP_MAX_GPIO_LINES)
102 return -EINVAL;
103 } else {
104 if (gpio > (OMAP_MAX_GPIO_LINES + 16 /* MPUIO */))
105 return -EINVAL;
106 }
107 omap_set_gpio_direction(gpio, is_input);
108 return 0;
109}
110
111static inline int gpio_direction_input(unsigned gpio)
112{
113 return __gpio_set_direction(gpio, 1);
114}
115
116static inline int gpio_direction_output(unsigned gpio, int value)
117{
118 omap_set_gpio_dataout(gpio, value);
119 return __gpio_set_direction(gpio, 0);
120}
121
122static inline int gpio_get_value(unsigned gpio)
123{
124 return omap_get_gpio_datain(gpio);
125}
126
127static inline void gpio_set_value(unsigned gpio, int value)
128{
129 omap_set_gpio_dataout(gpio, value);
130}
131
132#include <asm-generic/gpio.h> /* cansleep wrappers */
133
134static inline int gpio_to_irq(unsigned gpio)
135{
136 return OMAP_GPIO_IRQ(gpio);
137}
138
139static inline int irq_to_gpio(unsigned irq)
140{
141 if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
142 return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
143 return irq - IH_GPIO_BASE;
144}
145
79#endif 146#endif
diff --git a/include/asm-arm/arch-omap/memory.h b/include/asm-arm/arch-omap/memory.h
index df50dd53e1dd..48fabc493163 100644
--- a/include/asm-arm/arch-omap/memory.h
+++ b/include/asm-arm/arch-omap/memory.h
@@ -70,7 +70,7 @@
70 70
71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) 71#define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) 72#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
73#define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0)) 73#define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
74 74
75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \ 75#define __arch_page_to_dma(dev, page) ({is_lbus_device(dev) ? \
76 (dma_addr_t)virt_to_lbus(page_address(page)) : \ 76 (dma_addr_t)virt_to_lbus(page_address(page)) : \
diff --git a/include/asm-arm/arch-omap/omap-alsa.h b/include/asm-arm/arch-omap/omap-alsa.h
index df4695474e3d..fcaf44c14714 100644
--- a/include/asm-arm/arch-omap/omap-alsa.h
+++ b/include/asm-arm/arch-omap/omap-alsa.h
@@ -65,7 +65,7 @@ struct audio_stream {
65 int period; /* current transfer period */ 65 int period; /* current transfer period */
66 int periods; /* current count of periods registerd in the DMA engine */ 66 int periods; /* current count of periods registerd in the DMA engine */
67 spinlock_t dma_lock; /* for locking in DMA operations */ 67 spinlock_t dma_lock; /* for locking in DMA operations */
68 snd_pcm_substream_t *stream; /* the pcm stream */ 68 struct snd_pcm_substream *stream; /* the pcm stream */
69 unsigned linked:1; /* dma channels linked */ 69 unsigned linked:1; /* dma channels linked */
70 int offset; /* store start position of the last period in the alsa buffer */ 70 int offset; /* store start position of the last period in the alsa buffer */
71 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */ 71 int (*hw_start)(void); /* interface to start HW interface, e.g. McBSP */
@@ -76,8 +76,8 @@ struct audio_stream {
76 * Alsa card structure for aic23 76 * Alsa card structure for aic23
77 */ 77 */
78struct snd_card_omap_codec { 78struct snd_card_omap_codec {
79 snd_card_t *card; 79 struct snd_card *card;
80 snd_pcm_t *pcm; 80 struct snd_pcm *pcm;
81 long samplerate; 81 long samplerate;
82 struct audio_stream s[2]; /* playback & capture */ 82 struct audio_stream s[2]; /* playback & capture */
83}; 83};
@@ -89,9 +89,9 @@ struct snd_card_omap_codec {
89struct omap_alsa_codec_config { 89struct omap_alsa_codec_config {
90 char *name; 90 char *name;
91 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa; 91 struct omap_mcbsp_reg_cfg *mcbsp_regs_alsa;
92 snd_pcm_hw_constraint_list_t *hw_constraints_rates; 92 struct snd_pcm_hw_constraint_list *hw_constraints_rates;
93 snd_pcm_hardware_t *snd_omap_alsa_playback; 93 struct snd_pcm_hardware *snd_omap_alsa_playback;
94 snd_pcm_hardware_t *snd_omap_alsa_capture; 94 struct snd_pcm_hardware *snd_omap_alsa_capture;
95 void (*codec_configure_dev)(void); 95 void (*codec_configure_dev)(void);
96 void (*codec_set_samplerate)(long); 96 void (*codec_set_samplerate)(long);
97 void (*codec_clock_setup)(void); 97 void (*codec_clock_setup)(void);
diff --git a/include/asm-arm/arch-pnx4008/entry-macro.S b/include/asm-arm/arch-pnx4008/entry-macro.S
index c1c198e3680b..f11731974e5d 100644
--- a/include/asm-arm/arch-pnx4008/entry-macro.S
+++ b/include/asm-arm/arch-pnx4008/entry-macro.S
@@ -28,6 +28,12 @@
28 .macro disable_fiq 28 .macro disable_fiq
29 .endm 29 .endm
30 30
31 .macro get_irqnr_preamble, base, tmp
32 .endm
33
34 .macro arch_ret_to_user, tmp1, tmp2
35 .endm
36
31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 37 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
32/* decode the MIC interrupt numbers */ 38/* decode the MIC interrupt numbers */
33 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE) 39 ldr \base, =IO_ADDRESS(PNX4008_INTCTRLMIC_BASE)
diff --git a/include/asm-arm/arch-pxa/entry-macro.S b/include/asm-arm/arch-pxa/entry-macro.S
index 4985e33afc12..1d5fbb9b379a 100644
--- a/include/asm-arm/arch-pxa/entry-macro.S
+++ b/include/asm-arm/arch-pxa/entry-macro.S
@@ -13,6 +13,12 @@
13 .macro disable_fiq 13 .macro disable_fiq
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
16 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
17#ifdef CONFIG_PXA27x 23#ifdef CONFIG_PXA27x
18 mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP 24 mrc p6, 0, \irqstat, c0, c0, 0 @ ICIP
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h
new file mode 100644
index 000000000000..aeba24347f8e
--- /dev/null
+++ b/include/asm-arm/arch-pxa/gpio.h
@@ -0,0 +1,80 @@
1/*
2 * linux/include/asm-arm/arch-pxa/gpio.h
3 *
4 * PXA GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H
26
27#include <asm/arch/pxa-regs.h>
28#include <asm/irq.h>
29#include <asm/hardware.h>
30
31static inline int gpio_request(unsigned gpio, const char *label)
32{
33 return 0;
34}
35
36static inline void gpio_free(unsigned gpio)
37{
38 return;
39}
40
41static inline int gpio_direction_input(unsigned gpio)
42{
43 return pxa_gpio_mode(gpio | GPIO_IN);
44}
45
46static inline int gpio_direction_output(unsigned gpio, int value)
47{
48 return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW));
49}
50
51static inline int __gpio_get_value(unsigned gpio)
52{
53 return GPLR(gpio) & GPIO_bit(gpio);
54}
55
56#define gpio_get_value(gpio) \
57 (__builtin_constant_p(gpio) ? \
58 __gpio_get_value(gpio) : \
59 pxa_gpio_get_value(gpio))
60
61static inline void __gpio_set_value(unsigned gpio, int value)
62{
63 if (value)
64 GPSR(gpio) = GPIO_bit(gpio);
65 else
66 GPCR(gpio) = GPIO_bit(gpio);
67}
68
69#define gpio_set_value(gpio,value) \
70 (__builtin_constant_p(gpio) ? \
71 __gpio_set_value(gpio, value) : \
72 pxa_gpio_set_value(gpio, value))
73
74#include <asm-generic/gpio.h> /* cansleep wrappers */
75
76#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
77#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
78
79
80#endif
diff --git a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
index 3e70bd95472c..e2bdc2fbede1 100644
--- a/include/asm-arm/arch-pxa/hardware.h
+++ b/include/asm-arm/arch-pxa/hardware.h
@@ -65,7 +65,17 @@
65/* 65/*
66 * Handy routine to set GPIO alternate functions 66 * Handy routine to set GPIO alternate functions
67 */ 67 */
68extern void pxa_gpio_mode( int gpio_mode ); 68extern int pxa_gpio_mode( int gpio_mode );
69
70/*
71 * Return GPIO level, nonzero means high, zero is low
72 */
73extern int pxa_gpio_get_value(unsigned gpio);
74
75/*
76 * Set output GPIO level
77 */
78extern void pxa_gpio_set_value(unsigned gpio, int value);
69 79
70/* 80/*
71 * Routine to enable or disable CKEN 81 * Routine to enable or disable CKEN
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index e24f6b6c79ae..139c9d954818 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -463,9 +463,6 @@
463 * Serial Audio Controller 463 * Serial Audio Controller
464 */ 464 */
465 465
466/* FIXME: This clash with SA1111 defines */
467#ifndef _ASM_ARCH_SA1111
468
469#define SACR0 __REG(0x40400000) /* Global Control Register */ 466#define SACR0 __REG(0x40400000) /* Global Control Register */
470#define SACR1 __REG(0x40400004) /* Serial Audio I 2 S/MSB-Justified Control Register */ 467#define SACR1 __REG(0x40400004) /* Serial Audio I 2 S/MSB-Justified Control Register */
471#define SASR0 __REG(0x4040000C) /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */ 468#define SASR0 __REG(0x4040000C) /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */
@@ -474,8 +471,8 @@
474#define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */ 471#define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */
475#define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */ 472#define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */
476 473
477#define SACR0_RFTH(x) (x << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */ 474#define SACR0_RFTH(x) ((x) << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */
478#define SACR0_TFTH(x) (x << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */ 475#define SACR0_TFTH(x) ((x) << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */
479#define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */ 476#define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */
480#define SACR0_EFWR (1 << 4) /* Enable EFWR Function */ 477#define SACR0_EFWR (1 << 4) /* Enable EFWR Function */
481#define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */ 478#define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */
@@ -503,8 +500,6 @@
503#define SAIMR_RFS (1 << 4) /* Enable Rx FIFO Service Interrupt */ 500#define SAIMR_RFS (1 << 4) /* Enable Rx FIFO Service Interrupt */
504#define SAIMR_TFS (1 << 3) /* Enable Tx FIFO Service Interrupt */ 501#define SAIMR_TFS (1 << 3) /* Enable Tx FIFO Service Interrupt */
505 502
506#endif
507
508/* 503/*
509 * AC97 Controller registers 504 * AC97 Controller registers
510 */ 505 */
@@ -1481,7 +1476,7 @@
1481#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT) 1476#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT)
1482#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT) 1477#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT)
1483#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT) 1478#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT)
1484#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_OUT) 1479#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
1485#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) 1480#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
1486 1481
1487/* 1482/*
@@ -1682,15 +1677,18 @@
1682#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ 1677#define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */
1683 1678
1684#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */ 1679#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */
1685#define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */ 1680#define SSPSP_DMYSTOP(x) ((x) << 23) /* Dummy Stop */
1686#define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */ 1681#define SSPSP_SFRMWDTH(x) ((x) << 16) /* Serial Frame Width */
1687#define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */ 1682#define SSPSP_SFRMDLY(x) ((x) << 9) /* Serial Frame Delay */
1688#define SSPSP_DMYSTRT(x) (x << 7) /* Dummy Start */ 1683#define SSPSP_DMYSTRT(x) ((x) << 7) /* Dummy Start */
1689#define SSPSP_STRTDLY(x) (x << 4) /* Start Delay */ 1684#define SSPSP_STRTDLY(x) ((x) << 4) /* Start Delay */
1690#define SSPSP_ETDS (1 << 3) /* End of Transfer data State */ 1685#define SSPSP_ETDS (1 << 3) /* End of Transfer data State */
1691#define SSPSP_SFRMP (1 << 2) /* Serial Frame Polarity */ 1686#define SSPSP_SFRMP (1 << 2) /* Serial Frame Polarity */
1692#define SSPSP_SCMODE(x) (x << 0) /* Serial Bit Rate Clock Mode */ 1687#define SSPSP_SCMODE(x) ((x) << 0) /* Serial Bit Rate Clock Mode */
1693 1688
1689#define SSACD_SCDB (1 << 3) /* SSPSYSCLK Divider Bypass */
1690#define SSACD_ACPS(x) ((x) << 4) /* Audio clock PLL select */
1691#define SSACD_ACDS(x) ((x) << 0) /* Audio clock divider select */
1694 1692
1695#define SSCR0_P1 __REG(0x41000000) /* SSP Port 1 Control Register 0 */ 1693#define SSCR0_P1 __REG(0x41000000) /* SSP Port 1 Control Register 0 */
1696#define SSCR1_P1 __REG(0x41000004) /* SSP Port 1 Control Register 1 */ 1694#define SSCR1_P1 __REG(0x41000004) /* SSP Port 1 Control Register 1 */
diff --git a/include/asm-arm/arch-pxa/udc.h b/include/asm-arm/arch-pxa/udc.h
index 646480d37256..8bc6f9c3e3ea 100644
--- a/include/asm-arm/arch-pxa/udc.h
+++ b/include/asm-arm/arch-pxa/udc.h
@@ -9,3 +9,33 @@
9 9
10extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 10extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
11 11
12static inline int udc_gpio_to_irq(unsigned gpio)
13{
14 return IRQ_GPIO(gpio & GPIO_MD_MASK_NR);
15}
16
17static inline void udc_gpio_init_vbus(unsigned gpio)
18{
19 pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_IN);
20}
21
22static inline void udc_gpio_init_pullup(unsigned gpio)
23{
24 pxa_gpio_mode((gpio & GPIO_MD_MASK_NR) | GPIO_OUT | GPIO_DFLT_LOW);
25}
26
27static inline int udc_gpio_get(unsigned gpio)
28{
29 return (GPLR(gpio) & GPIO_bit(gpio)) != 0;
30}
31
32static inline void udc_gpio_set(unsigned gpio, int is_on)
33{
34 int mask = GPIO_bit(gpio);
35
36 if (is_on)
37 GPSR(gpio) = mask;
38 else
39 GPCR(gpio) = mask;
40}
41
diff --git a/include/asm-arm/arch-realview/entry-macro.S b/include/asm-arm/arch-realview/entry-macro.S
index 1a6eec86bd47..138838d4ad75 100644
--- a/include/asm-arm/arch-realview/entry-macro.S
+++ b/include/asm-arm/arch-realview/entry-macro.S
@@ -13,6 +13,12 @@
13 .macro disable_fiq 13 .macro disable_fiq
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
16 /* 22 /*
17 * The interrupt numbering scheme is defined in the 23 * The interrupt numbering scheme is defined in the
18 * interrupt controller spec. To wit: 24 * interrupt controller spec. To wit:
diff --git a/include/asm-arm/arch-realview/hardware.h b/include/asm-arm/arch-realview/hardware.h
index 9ca76dc3a7af..aa78fe087ab2 100644
--- a/include/asm-arm/arch-realview/hardware.h
+++ b/include/asm-arm/arch-realview/hardware.h
@@ -26,7 +26,7 @@
26#include <asm/arch/platform.h> 26#include <asm/arch/platform.h>
27 27
28/* macro to get at IO space when running virtually */ 28/* macro to get at IO space when running virtually */
29#define IO_ADDRESS(x) (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000) 29#define IO_ADDRESS(x) ((((x) & 0x0effffff) | (((x) >> 4) & 0x0f000000)) + 0xf0000000)
30#define __io_address(n) __io(IO_ADDRESS(n)) 30#define __io_address(n) __io(IO_ADDRESS(n))
31 31
32#endif 32#endif
diff --git a/include/asm-arm/arch-realview/irqs.h b/include/asm-arm/arch-realview/irqs.h
index c16223c9588d..5a5db56f86b8 100644
--- a/include/asm-arm/arch-realview/irqs.h
+++ b/include/asm-arm/arch-realview/irqs.h
@@ -65,6 +65,21 @@
65#define IRQ_AACI (IRQ_GIC_START + INT_AACI) 65#define IRQ_AACI (IRQ_GIC_START + INT_AACI)
66#define IRQ_ETH (IRQ_GIC_START + INT_ETH) 66#define IRQ_ETH (IRQ_GIC_START + INT_ETH)
67#define IRQ_USB (IRQ_GIC_START + INT_USB) 67#define IRQ_USB (IRQ_GIC_START + INT_USB)
68#define IRQ_PMU_CPU0 (IRQ_GIC_START + INT_PMU_CPU0)
69#define IRQ_PMU_CPU1 (IRQ_GIC_START + INT_PMU_CPU1)
70#define IRQ_PMU_CPU2 (IRQ_GIC_START + INT_PMU_CPU2)
71#define IRQ_PMU_CPU3 (IRQ_GIC_START + INT_PMU_CPU3)
72#define IRQ_PMU_SCU0 (IRQ_GIC_START + INT_PMU_SCU0)
73#define IRQ_PMU_SCU1 (IRQ_GIC_START + INT_PMU_SCU1)
74#define IRQ_PMU_SCU2 (IRQ_GIC_START + INT_PMU_SCU2)
75#define IRQ_PMU_SCU3 (IRQ_GIC_START + INT_PMU_SCU3)
76#define IRQ_PMU_SCU4 (IRQ_GIC_START + INT_PMU_SCU4)
77#define IRQ_PMU_SCU5 (IRQ_GIC_START + INT_PMU_SCU5)
78#define IRQ_PMU_SCU6 (IRQ_GIC_START + INT_PMU_SCU6)
79#define IRQ_PMU_SCU7 (IRQ_GIC_START + INT_PMU_SCU7)
80
81#define IRQ_EB_IRQ1 (IRQ_GIC_START + INT_EB_IRQ1)
82#define IRQ_EB_IRQ2 (IRQ_GIC_START + INT_EB_IRQ2)
68 83
69#define IRQMASK_WDOGINT INTMASK_WDOGINT 84#define IRQMASK_WDOGINT INTMASK_WDOGINT
70#define IRQMASK_SOFTINT INTMASK_SOFTINT 85#define IRQMASK_SOFTINT INTMASK_SOFTINT
@@ -103,4 +118,4 @@
103#define IRQMASK_ETH INTMASK_ETH 118#define IRQMASK_ETH INTMASK_ETH
104#define IRQMASK_USB INTMASK_USB 119#define IRQMASK_USB INTMASK_USB
105 120
106#define NR_IRQS (IRQ_GIC_START + 64) 121#define NR_IRQS (IRQ_GIC_START + 96)
diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h
index 18d7c18b738c..6e0eab95a3a2 100644
--- a/include/asm-arm/arch-realview/platform.h
+++ b/include/asm-arm/arch-realview/platform.h
@@ -207,11 +207,25 @@
207#define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ 207#define REALVIEW_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */
208#define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ 208#define REALVIEW_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */
209#else 209#else
210#ifdef CONFIG_REALVIEW_MPCORE_REVB
210#define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */ 211#define REALVIEW_MPCORE_SCU_BASE 0x10100000 /* SCU registers */
211#define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ 212#define REALVIEW_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */
212#define REALVIEW_TWD_BASE 0x10100700 213#define REALVIEW_TWD_BASE 0x10100700
213#define REALVIEW_TWD_SIZE 0x00000100 214#define REALVIEW_TWD_SIZE 0x00000100
214#define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */ 215#define REALVIEW_GIC_DIST_BASE 0x10101000 /* Generic interrupt controller distributor */
216#define REALVIEW_MPCORE_L220_BASE 0x10102000 /* L220 registers */
217#define REALVIEW_MPCORE_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */
218#else
219#define REALVIEW_MPCORE_SCU_BASE 0x1F000000 /* SCU registers */
220#define REALVIEW_GIC_CPU_BASE 0x1F000100 /* Generic interrupt controller CPU interface */
221#define REALVIEW_TWD_BASE 0x1F000700
222#define REALVIEW_TWD_SIZE 0x00000100
223#define REALVIEW_GIC_DIST_BASE 0x1F001000 /* Generic interrupt controller distributor */
224#define REALVIEW_MPCORE_L220_BASE 0x1F002000 /* L220 registers */
225#define REALVIEW_MPCORE_SYS_PLD_CTRL1 0x74 /* Register offset for MPCore sysctl */
226#endif
227#define REALVIEW_GIC1_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */
228#define REALVIEW_GIC1_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */
215#endif 229#endif
216#define REALVIEW_SMC_BASE 0x10080000 /* SMC */ 230#define REALVIEW_SMC_BASE 0x10080000 /* SMC */
217 /* Reserved 0x10090000 - 0x100EFFFF */ 231 /* Reserved 0x10090000 - 0x100EFFFF */
@@ -306,7 +320,11 @@
306#define INT_USB 29 /* USB controller */ 320#define INT_USB 29 /* USB controller */
307#define INT_TSPENINT 30 /* Touchscreen pen */ 321#define INT_TSPENINT 30 /* Touchscreen pen */
308#define INT_TSKPADINT 31 /* Touchscreen keypad */ 322#define INT_TSKPADINT 31 /* Touchscreen keypad */
323
309#else 324#else
325
326#define MAX_GIC_NR 2
327
310#define INT_AACI 0 328#define INT_AACI 0
311#define INT_TIMERINT0_1 1 329#define INT_TIMERINT0_1 1
312#define INT_TIMERINT2_3 2 330#define INT_TIMERINT2_3 2
diff --git a/include/asm-arm/arch-realview/scu.h b/include/asm-arm/arch-realview/scu.h
new file mode 100644
index 000000000000..cc293640178e
--- /dev/null
+++ b/include/asm-arm/arch-realview/scu.h
@@ -0,0 +1,8 @@
1#ifndef __ASMARM_ARCH_SCU_H
2#define __ASMARM_ARCH_SCU_H
3
4#include <asm/arch/platform.h>
5
6#define SCU_BASE REALVIEW_MPCORE_SCU_BASE
7
8#endif
diff --git a/include/asm-arm/arch-rpc/entry-macro.S b/include/asm-arm/arch-rpc/entry-macro.S
index c9e5395e5106..0cfb89b229d1 100644
--- a/include/asm-arm/arch-rpc/entry-macro.S
+++ b/include/asm-arm/arch-rpc/entry-macro.S
@@ -1,3 +1,8 @@
1#include <asm/hardware.h> 1#include <asm/hardware.h>
2#include <asm/hardware/entry-macro-iomd.S> 2#include <asm/hardware/entry-macro-iomd.S>
3 .macro get_irqnr_preamble, base, tmp
4 .endm
5
6 .macro arch_ret_to_user, tmp1, tmp2
7 .endm
3 8
diff --git a/include/asm-arm/arch-s3c2410/audio.h b/include/asm-arm/arch-s3c2410/audio.h
index 65e0acffa1ad..0a6977fb5770 100644
--- a/include/asm-arm/arch-s3c2410/audio.h
+++ b/include/asm-arm/arch-s3c2410/audio.h
@@ -31,9 +31,9 @@ struct s3c24xx_iis_ops {
31 int (*suspend)(struct s3c24xx_iis_ops *me); 31 int (*suspend)(struct s3c24xx_iis_ops *me);
32 int (*resume)(struct s3c24xx_iis_ops *me); 32 int (*resume)(struct s3c24xx_iis_ops *me);
33 33
34 int (*open)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm); 34 int (*open)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
35 int (*close)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm); 35 int (*close)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
36 int (*prepare)(struct s3c24xx_iis_ops *me, snd_pcm_substream_t *strm, snd_pcm_runtime_t *rt); 36 int (*prepare)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm, struct snd_pcm_runtime *rt);
37}; 37};
38 38
39struct s3c24xx_platdata_iis { 39struct s3c24xx_platdata_iis {
diff --git a/include/asm-arm/arch-s3c2410/dma.h b/include/asm-arm/arch-s3c2410/dma.h
index 58ffa7ba3c88..c6e8d8f64938 100644
--- a/include/asm-arm/arch-s3c2410/dma.h
+++ b/include/asm-arm/arch-s3c2410/dma.h
@@ -51,13 +51,19 @@ enum dma_ch {
51 DMACH_UART0_SRC2, /* s3c2412 second uart sources */ 51 DMACH_UART0_SRC2, /* s3c2412 second uart sources */
52 DMACH_UART1_SRC2, 52 DMACH_UART1_SRC2,
53 DMACH_UART2_SRC2, 53 DMACH_UART2_SRC2,
54 DMACH_UART3, /* s3c2443 has extra uart */
55 DMACH_UART3_SRC2,
54 DMACH_MAX, /* the end entry */ 56 DMACH_MAX, /* the end entry */
55}; 57};
56 58
57#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */ 59#define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
58 60
59/* we have 4 dma channels */ 61/* we have 4 dma channels */
60#define S3C2410_DMA_CHANNELS (4) 62#ifndef CONFIG_CPU_S3C2443
63#define S3C2410_DMA_CHANNELS (4)
64#else
65#define S3C2410_DMA_CHANNELS (6)
66#endif
61 67
62/* types */ 68/* types */
63 69
@@ -321,6 +327,7 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
321#define S3C2410_DMA_DCDST (0x1C) 327#define S3C2410_DMA_DCDST (0x1C)
322#define S3C2410_DMA_DMASKTRIG (0x20) 328#define S3C2410_DMA_DMASKTRIG (0x20)
323#define S3C2412_DMA_DMAREQSEL (0x24) 329#define S3C2412_DMA_DMAREQSEL (0x24)
330#define S3C2443_DMA_DMAREQSEL (0x24)
324 331
325#define S3C2410_DISRCC_INC (1<<0) 332#define S3C2410_DISRCC_INC (1<<0)
326#define S3C2410_DISRCC_APB (1<<1) 333#define S3C2410_DISRCC_APB (1<<1)
@@ -415,4 +422,31 @@ extern int s3c2410_dma_set_buffdone_fn(dmach_t, s3c2410_dma_cbfn_t rtn);
415#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24) 422#define S3C2412_DMAREQSEL_UART2_1 S3C2412_DMAREQSEL_SRC(24)
416 423
417#endif 424#endif
425
426#define S3C2443_DMAREQSEL_SRC(x) ((x)<<1)
427
428#define S3C2443_DMAREQSEL_HW (1)
429
430#define S3C2443_DMAREQSEL_SPI0TX S3C2443_DMAREQSEL_SRC(0)
431#define S3C2443_DMAREQSEL_SPI0RX S3C2443_DMAREQSEL_SRC(1)
432#define S3C2443_DMAREQSEL_SPI1TX S3C2443_DMAREQSEL_SRC(2)
433#define S3C2443_DMAREQSEL_SPI1RX S3C2443_DMAREQSEL_SRC(3)
434#define S3C2443_DMAREQSEL_I2STX S3C2443_DMAREQSEL_SRC(4)
435#define S3C2443_DMAREQSEL_I2SRX S3C2443_DMAREQSEL_SRC(5)
436#define S3C2443_DMAREQSEL_TIMER S3C2443_DMAREQSEL_SRC(9)
437#define S3C2443_DMAREQSEL_SDI S3C2443_DMAREQSEL_SRC(10)
438#define S3C2443_DMAREQSEL_XDREQ0 S3C2443_DMAREQSEL_SRC(17)
439#define S3C2443_DMAREQSEL_XDREQ1 S3C2443_DMAREQSEL_SRC(18)
440#define S3C2443_DMAREQSEL_UART0_0 S3C2443_DMAREQSEL_SRC(19)
441#define S3C2443_DMAREQSEL_UART0_1 S3C2443_DMAREQSEL_SRC(20)
442#define S3C2443_DMAREQSEL_UART1_0 S3C2443_DMAREQSEL_SRC(21)
443#define S3C2443_DMAREQSEL_UART1_1 S3C2443_DMAREQSEL_SRC(22)
444#define S3C2443_DMAREQSEL_UART2_0 S3C2443_DMAREQSEL_SRC(23)
445#define S3C2443_DMAREQSEL_UART2_1 S3C2443_DMAREQSEL_SRC(24)
446#define S3C2443_DMAREQSEL_UART3_0 S3C2443_DMAREQSEL_SRC(25)
447#define S3C2443_DMAREQSEL_UART3_1 S3C2443_DMAREQSEL_SRC(26)
448#define S3C2443_DMAREQSEL_PCMOUT S3C2443_DMAREQSEL_SRC(27)
449#define S3C2443_DMAREQSEL_PCMIN S3C2443_DMAREQSEL_SRC(28)
450#define S3C2443_DMAREQSEL_MICIN S3C2443_DMAREQSEL_SRC(29)
451
418#endif /* __ASM_ARCH_DMA_H */ 452#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 1eb4e6b8d249..bbec0a8ff158 100644
--- a/include/asm-arm/arch-s3c2410/entry-macro.S
+++ b/include/asm-arm/arch-s3c2410/entry-macro.S
@@ -22,6 +22,12 @@
22#include <asm/hardware.h> 22#include <asm/hardware.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24 24
25 .macro get_irqnr_preamble, base, tmp
26 .endm
27
28 .macro arch_ret_to_user, tmp1, tmp2
29 .endm
30
25 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 31 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
26 32
27 mov \base, #S3C24XX_VA_IRQ 33 mov \base, #S3C24XX_VA_IRQ
diff --git a/include/asm-arm/arch-s3c2410/gpio.h b/include/asm-arm/arch-s3c2410/gpio.h
new file mode 100644
index 000000000000..7583895fd336
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/gpio.h
@@ -0,0 +1,68 @@
1/*
2 * linux/include/asm-arm/arch-s3c2410/gpio.h
3 *
4 * S3C2410 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_S3C2410_GPIO_H
25#define __ASM_ARCH_S3C2410_GPIO_H
26
27#include <asm/irq.h>
28#include <asm/hardware.h>
29#include <asm/arch/regs-gpio.h>
30
31static inline int gpio_request(unsigned gpio, const char *label)
32{
33 return 0;
34}
35
36static inline void gpio_free(unsigned gpio)
37{
38 return;
39}
40
41static inline int gpio_direction_input(unsigned gpio)
42{
43 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_INPUT);
44 return 0;
45}
46
47static inline int gpio_direction_output(unsigned gpio, int value)
48{
49 s3c2410_gpio_cfgpin(gpio, S3C2410_GPIO_OUTPUT);
50 /* REVISIT can we write the value first, to avoid glitching? */
51 s3c2410_gpio_setpin(gpio, value);
52 return 0;
53}
54
55#define gpio_get_value(gpio) s3c2410_gpio_getpin(gpio)
56#define gpio_set_value(gpio,value) s3c2410_gpio_setpin(gpio, value)
57
58#include <asm-generic/gpio.h> /* cansleep wrappers */
59
60#ifdef CONFIG_CPU_S3C2400
61#define gpio_to_irq(gpio) s3c2400_gpio_getirq(gpio)
62#else
63#define gpio_to_irq(gpio) s3c2410_gpio_getirq(gpio)
64#endif
65
66/* FIXME implement irq_to_gpio() */
67
68#endif
diff --git a/include/asm-arm/arch-s3c2410/irqs.h b/include/asm-arm/arch-s3c2410/irqs.h
index 4b7cff456c4e..c79cb1819913 100644
--- a/include/asm-arm/arch-s3c2410/irqs.h
+++ b/include/asm-arm/arch-s3c2410/irqs.h
@@ -34,10 +34,10 @@
34#define IRQ_EINT4t7 S3C2410_IRQ(4) /* 20 */ 34#define IRQ_EINT4t7 S3C2410_IRQ(4) /* 20 */
35#define IRQ_EINT8t23 S3C2410_IRQ(5) 35#define IRQ_EINT8t23 S3C2410_IRQ(5)
36#define IRQ_RESERVED6 S3C2410_IRQ(6) /* for s3c2410 */ 36#define IRQ_RESERVED6 S3C2410_IRQ(6) /* for s3c2410 */
37#define IRQ_CAM S3C2410_IRQ(6) /* for s3c2440 */ 37#define IRQ_CAM S3C2410_IRQ(6) /* for s3c2440,s3c2443 */
38#define IRQ_BATT_FLT S3C2410_IRQ(7) 38#define IRQ_BATT_FLT S3C2410_IRQ(7)
39#define IRQ_TICK S3C2410_IRQ(8) /* 24 */ 39#define IRQ_TICK S3C2410_IRQ(8) /* 24 */
40#define IRQ_WDT S3C2410_IRQ(9) 40#define IRQ_WDT S3C2410_IRQ(9) /* WDT/AC97 for s3c2443 */
41#define IRQ_TIMER0 S3C2410_IRQ(10) 41#define IRQ_TIMER0 S3C2410_IRQ(10)
42#define IRQ_TIMER1 S3C2410_IRQ(11) 42#define IRQ_TIMER1 S3C2410_IRQ(11)
43#define IRQ_TIMER2 S3C2410_IRQ(12) 43#define IRQ_TIMER2 S3C2410_IRQ(12)
@@ -45,7 +45,7 @@
45#define IRQ_TIMER4 S3C2410_IRQ(14) 45#define IRQ_TIMER4 S3C2410_IRQ(14)
46#define IRQ_UART2 S3C2410_IRQ(15) 46#define IRQ_UART2 S3C2410_IRQ(15)
47#define IRQ_LCD S3C2410_IRQ(16) /* 32 */ 47#define IRQ_LCD S3C2410_IRQ(16) /* 32 */
48#define IRQ_DMA0 S3C2410_IRQ(17) 48#define IRQ_DMA0 S3C2410_IRQ(17) /* IRQ_DMA for s3c2443 */
49#define IRQ_DMA1 S3C2410_IRQ(18) 49#define IRQ_DMA1 S3C2410_IRQ(18)
50#define IRQ_DMA2 S3C2410_IRQ(19) 50#define IRQ_DMA2 S3C2410_IRQ(19)
51#define IRQ_DMA3 S3C2410_IRQ(20) 51#define IRQ_DMA3 S3C2410_IRQ(20)
@@ -94,29 +94,63 @@
94 * these need to be ordered in number of appearance in the 94 * these need to be ordered in number of appearance in the
95 * SUBSRC mask register 95 * SUBSRC mask register
96*/ 96*/
97#define IRQ_S3CUART_RX0 S3C2410_IRQ(54) /* 70 */
98#define IRQ_S3CUART_TX0 S3C2410_IRQ(55) /* 71 */
99#define IRQ_S3CUART_ERR0 S3C2410_IRQ(56)
100 97
101#define IRQ_S3CUART_RX1 S3C2410_IRQ(57) 98#define S3C2410_IRQSUB(x) S3C2410_IRQ((x)+54)
102#define IRQ_S3CUART_TX1 S3C2410_IRQ(58)
103#define IRQ_S3CUART_ERR1 S3C2410_IRQ(59)
104 99
105#define IRQ_S3CUART_RX2 S3C2410_IRQ(60) 100#define IRQ_S3CUART_RX0 S3C2410_IRQSUB(0) /* 70 */
106#define IRQ_S3CUART_TX2 S3C2410_IRQ(61) 101#define IRQ_S3CUART_TX0 S3C2410_IRQSUB(1)
107#define IRQ_S3CUART_ERR2 S3C2410_IRQ(62) 102#define IRQ_S3CUART_ERR0 S3C2410_IRQSUB(2)
108 103
109#define IRQ_TC S3C2410_IRQ(63) 104#define IRQ_S3CUART_RX1 S3C2410_IRQSUB(3) /* 73 */
110#define IRQ_ADC S3C2410_IRQ(64) 105#define IRQ_S3CUART_TX1 S3C2410_IRQSUB(4)
106#define IRQ_S3CUART_ERR1 S3C2410_IRQSUB(5)
111 107
112/* extra irqs for s3c2440 */ 108#define IRQ_S3CUART_RX2 S3C2410_IRQSUB(6) /* 76 */
109#define IRQ_S3CUART_TX2 S3C2410_IRQSUB(7)
110#define IRQ_S3CUART_ERR2 S3C2410_IRQSUB(8)
113 111
114#define IRQ_S3C2440_CAM_C S3C2410_IRQ(65) 112#define IRQ_TC S3C2410_IRQSUB(9)
115#define IRQ_S3C2440_CAM_P S3C2410_IRQ(66) 113#define IRQ_ADC S3C2410_IRQSUB(10)
116#define IRQ_S3C2440_WDT S3C2410_IRQ(67)
117#define IRQ_S3C2440_AC97 S3C2410_IRQ(68)
118 114
119#define NR_IRQS (IRQ_S3C2440_AC97+1) 115/* extra irqs for s3c2440 */
120 116
117#define IRQ_S3C2440_CAM_C S3C2410_IRQSUB(11) /* S3C2443 too */
118#define IRQ_S3C2440_CAM_P S3C2410_IRQSUB(12) /* S3C2443 too */
119#define IRQ_S3C2440_WDT S3C2410_IRQSUB(13)
120#define IRQ_S3C2440_AC97 S3C2410_IRQSUB(14)
121
122/* irqs for s3c2443 */
123
124#define IRQ_S3C2443_DMA S3C2410_IRQ(17) /* IRQ_DMA1 */
125#define IRQ_S3C2443_UART3 S3C2410_IRQ(18) /* IRQ_DMA2 */
126#define IRQ_S3C2443_CFCON S3C2410_IRQ(19) /* IRQ_DMA3 */
127#define IRQ_S3C2443_SDI1 S3C2410_IRQ(20) /* IRQ_SDI */
128#define IRQ_S3C2443_NAND S3C2410_IRQ(24) /* reserved */
129
130#define IRQ_S3C2443_LCD1 S3C2410_IRQSUB(14)
131#define IRQ_S3C2443_LCD2 S3C2410_IRQSUB(15)
132#define IRQ_S3C2443_LCD3 S3C2410_IRQSUB(16)
133#define IRQ_S3C2443_LCD4 S3C2410_IRQSUB(17)
134
135#define IRQ_S3C2443_DMA0 S3C2410_IRQSUB(18)
136#define IRQ_S3C2443_DMA1 S3C2410_IRQSUB(19)
137#define IRQ_S3C2443_DMA2 S3C2410_IRQSUB(20)
138#define IRQ_S3C2443_DMA3 S3C2410_IRQSUB(21)
139#define IRQ_S3C2443_DMA4 S3C2410_IRQSUB(22)
140#define IRQ_S3C2443_DMA5 S3C2410_IRQSUB(23)
141
142/* UART3 */
143#define IRQ_S3C2443_RX3 S3C2410_IRQSUB(24)
144#define IRQ_S3C2443_TX3 S3C2410_IRQSUB(25)
145#define IRQ_S3C2443_ERR3 S3C2410_IRQSUB(26)
146
147#define IRQ_S3C2443_WDT S3C2410_IRQSUB(27)
148#define IRQ_S3C2443_AC97 S3C2410_IRQSUB(28)
149
150#ifdef CONFIG_CPU_S3C2443
151#define NR_IRQS (IRQ_S3C2443_AC97+1)
152#else
153#define NR_IRQS (IRQ_S3C2440_AC97+1)
154#endif
121 155
122#endif /* __ASM_ARCH_IRQ_H */ 156#endif /* __ASM_ARCH_IRQ_H */
diff --git a/include/asm-arm/arch-s3c2410/regs-adc.h b/include/asm-arm/arch-s3c2410/regs-adc.h
index 3196a2849e8a..c7f231963e76 100644
--- a/include/asm-arm/arch-s3c2410/regs-adc.h
+++ b/include/asm-arm/arch-s3c2410/regs-adc.h
@@ -41,7 +41,7 @@
41#define S3C2410_ADCTSC_XP_SEN (1<<4) 41#define S3C2410_ADCTSC_XP_SEN (1<<4)
42#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3) 42#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
43#define S3C2410_ADCTSC_AUTO_PST (1<<2) 43#define S3C2410_ADCTSC_AUTO_PST (1<<2)
44#define S3C2410_ADCTSC_XY_PST (0x3<<0) 44#define S3C2410_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
45 45
46/* ADCDAT0 Bits */ 46/* ADCDAT0 Bits */
47#define S3C2410_ADCDAT0_UPDOWN (1<<15) 47#define S3C2410_ADCDAT0_UPDOWN (1<<15)
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index b2893e32a236..dea578b8f7f6 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -52,10 +52,10 @@
52/* general configuration options */ 52/* general configuration options */
53 53
54#define S3C2410_GPIO_LEAVE (0xFFFFFFFF) 54#define S3C2410_GPIO_LEAVE (0xFFFFFFFF)
55#define S3C2410_GPIO_INPUT (0xFFFFFFF0) 55#define S3C2410_GPIO_INPUT (0xFFFFFFF0) /* not available on A */
56#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1) 56#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1)
57#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */ 57#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */
58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */ 58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* bank A => addr/cs/nand */
59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ 59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
60 60
61/* register address for the GPIO registers. 61/* register address for the GPIO registers.
@@ -201,7 +201,7 @@
201#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C) 201#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C)
202#define S3C2400_GPBUP S3C2410_GPIOREG(0x10) 202#define S3C2400_GPBUP S3C2410_GPIOREG(0x10)
203 203
204/* no i/o pin in port b can have value 3! */ 204/* no i/o pin in port b can have value 3 (unless it is a s3c2443) ! */
205 205
206#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0) 206#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0)
207#define S3C2410_GPB0_INP (0x00 << 0) 207#define S3C2410_GPB0_INP (0x00 << 0)
@@ -242,6 +242,7 @@
242#define S3C2410_GPB5_INP (0x00 << 10) 242#define S3C2410_GPB5_INP (0x00 << 10)
243#define S3C2410_GPB5_OUTP (0x01 << 10) 243#define S3C2410_GPB5_OUTP (0x01 << 10)
244#define S3C2410_GPB5_nXBACK (0x02 << 10) 244#define S3C2410_GPB5_nXBACK (0x02 << 10)
245#define S3C2443_GPB5_XBACK (0x03 << 10)
245#define S3C2400_GPB5_DATA21 (0x02 << 10) 246#define S3C2400_GPB5_DATA21 (0x02 << 10)
246#define S3C2400_GPB5_nCTS1 (0x03 << 10) 247#define S3C2400_GPB5_nCTS1 (0x03 << 10)
247 248
@@ -249,6 +250,7 @@
249#define S3C2410_GPB6_INP (0x00 << 12) 250#define S3C2410_GPB6_INP (0x00 << 12)
250#define S3C2410_GPB6_OUTP (0x01 << 12) 251#define S3C2410_GPB6_OUTP (0x01 << 12)
251#define S3C2410_GPB6_nXBREQ (0x02 << 12) 252#define S3C2410_GPB6_nXBREQ (0x02 << 12)
253#define S3C2443_GPB6_XBREQ (0x03 << 12)
252#define S3C2400_GPB6_DATA22 (0x02 << 12) 254#define S3C2400_GPB6_DATA22 (0x02 << 12)
253#define S3C2400_GPB6_nRTS1 (0x03 << 12) 255#define S3C2400_GPB6_nRTS1 (0x03 << 12)
254 256
@@ -256,6 +258,7 @@
256#define S3C2410_GPB7_INP (0x00 << 14) 258#define S3C2410_GPB7_INP (0x00 << 14)
257#define S3C2410_GPB7_OUTP (0x01 << 14) 259#define S3C2410_GPB7_OUTP (0x01 << 14)
258#define S3C2410_GPB7_nXDACK1 (0x02 << 14) 260#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
261#define S3C2443_GPB7_XDACK1 (0x03 << 14)
259#define S3C2400_GPB7_DATA23 (0x02 << 14) 262#define S3C2400_GPB7_DATA23 (0x02 << 14)
260 263
261#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8) 264#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8)
@@ -268,6 +271,7 @@
268#define S3C2410_GPB9_INP (0x00 << 18) 271#define S3C2410_GPB9_INP (0x00 << 18)
269#define S3C2410_GPB9_OUTP (0x01 << 18) 272#define S3C2410_GPB9_OUTP (0x01 << 18)
270#define S3C2410_GPB9_nXDACK0 (0x02 << 18) 273#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
274#define S3C2443_GPB9_XDACK0 (0x03 << 18)
271#define S3C2400_GPB9_DATA25 (0x02 << 18) 275#define S3C2400_GPB9_DATA25 (0x02 << 18)
272#define S3C2400_GPB9_I2SSDI (0x03 << 18) 276#define S3C2400_GPB9_I2SSDI (0x03 << 18)
273 277
@@ -275,6 +279,7 @@
275#define S3C2410_GPB10_INP (0x00 << 20) 279#define S3C2410_GPB10_INP (0x00 << 20)
276#define S3C2410_GPB10_OUTP (0x01 << 20) 280#define S3C2410_GPB10_OUTP (0x01 << 20)
277#define S3C2410_GPB10_nXDRE0 (0x02 << 20) 281#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
282#define S3C2443_GPB10_XDREQ0 (0x03 << 20)
278#define S3C2400_GPB10_DATA26 (0x02 << 20) 283#define S3C2400_GPB10_DATA26 (0x02 << 20)
279#define S3C2400_GPB10_nSS (0x03 << 20) 284#define S3C2400_GPB10_nSS (0x03 << 20)
280 285
@@ -556,6 +561,7 @@
556#define S3C2410_GPE0_INP (0x00 << 0) 561#define S3C2410_GPE0_INP (0x00 << 0)
557#define S3C2410_GPE0_OUTP (0x01 << 0) 562#define S3C2410_GPE0_OUTP (0x01 << 0)
558#define S3C2410_GPE0_I2SLRCK (0x02 << 0) 563#define S3C2410_GPE0_I2SLRCK (0x02 << 0)
564#define S3C2443_GPE0_AC_nRESET (0x03 << 0)
559#define S3C2400_GPE0_EINT0 (0x02 << 0) 565#define S3C2400_GPE0_EINT0 (0x02 << 0)
560#define S3C2410_GPE0_MASK (0x03 << 0) 566#define S3C2410_GPE0_MASK (0x03 << 0)
561 567
@@ -563,6 +569,7 @@
563#define S3C2410_GPE1_INP (0x00 << 2) 569#define S3C2410_GPE1_INP (0x00 << 2)
564#define S3C2410_GPE1_OUTP (0x01 << 2) 570#define S3C2410_GPE1_OUTP (0x01 << 2)
565#define S3C2410_GPE1_I2SSCLK (0x02 << 2) 571#define S3C2410_GPE1_I2SSCLK (0x02 << 2)
572#define S3C2443_GPE1_AC_SYNC (0x03 << 2)
566#define S3C2400_GPE1_EINT1 (0x02 << 2) 573#define S3C2400_GPE1_EINT1 (0x02 << 2)
567#define S3C2400_GPE1_nSS (0x03 << 2) 574#define S3C2400_GPE1_nSS (0x03 << 2)
568#define S3C2410_GPE1_MASK (0x03 << 2) 575#define S3C2410_GPE1_MASK (0x03 << 2)
@@ -571,6 +578,7 @@
571#define S3C2410_GPE2_INP (0x00 << 4) 578#define S3C2410_GPE2_INP (0x00 << 4)
572#define S3C2410_GPE2_OUTP (0x01 << 4) 579#define S3C2410_GPE2_OUTP (0x01 << 4)
573#define S3C2410_GPE2_CDCLK (0x02 << 4) 580#define S3C2410_GPE2_CDCLK (0x02 << 4)
581#define S3C2443_GPE2_AC_BITCLK (0x03 << 4)
574#define S3C2400_GPE2_EINT2 (0x02 << 4) 582#define S3C2400_GPE2_EINT2 (0x02 << 4)
575#define S3C2400_GPE2_I2SSDI (0x03 << 4) 583#define S3C2400_GPE2_I2SSDI (0x03 << 4)
576 584
@@ -578,6 +586,7 @@
578#define S3C2410_GPE3_INP (0x00 << 6) 586#define S3C2410_GPE3_INP (0x00 << 6)
579#define S3C2410_GPE3_OUTP (0x01 << 6) 587#define S3C2410_GPE3_OUTP (0x01 << 6)
580#define S3C2410_GPE3_I2SSDI (0x02 << 6) 588#define S3C2410_GPE3_I2SSDI (0x02 << 6)
589#define S3C2443_GPE3_AC_SDI (0x03 << 6)
581#define S3C2400_GPE3_EINT3 (0x02 << 6) 590#define S3C2400_GPE3_EINT3 (0x02 << 6)
582#define S3C2400_GPE3_nCTS1 (0x03 << 6) 591#define S3C2400_GPE3_nCTS1 (0x03 << 6)
583#define S3C2410_GPE3_nSS0 (0x03 << 6) 592#define S3C2410_GPE3_nSS0 (0x03 << 6)
@@ -587,6 +596,7 @@
587#define S3C2410_GPE4_INP (0x00 << 8) 596#define S3C2410_GPE4_INP (0x00 << 8)
588#define S3C2410_GPE4_OUTP (0x01 << 8) 597#define S3C2410_GPE4_OUTP (0x01 << 8)
589#define S3C2410_GPE4_I2SSDO (0x02 << 8) 598#define S3C2410_GPE4_I2SSDO (0x02 << 8)
599#define S3C2443_GPE4_AC_SDO (0x03 << 8)
590#define S3C2400_GPE4_EINT4 (0x02 << 8) 600#define S3C2400_GPE4_EINT4 (0x02 << 8)
591#define S3C2400_GPE4_nRTS1 (0x03 << 8) 601#define S3C2400_GPE4_nRTS1 (0x03 << 8)
592#define S3C2410_GPE4_I2SSDI (0x03 << 8) 602#define S3C2410_GPE4_I2SSDI (0x03 << 8)
@@ -596,6 +606,7 @@
596#define S3C2410_GPE5_INP (0x00 << 10) 606#define S3C2410_GPE5_INP (0x00 << 10)
597#define S3C2410_GPE5_OUTP (0x01 << 10) 607#define S3C2410_GPE5_OUTP (0x01 << 10)
598#define S3C2410_GPE5_SDCLK (0x02 << 10) 608#define S3C2410_GPE5_SDCLK (0x02 << 10)
609#define S3C2443_GPE5_SD1_CLK (0x02 << 10)
599#define S3C2400_GPE5_EINT5 (0x02 << 10) 610#define S3C2400_GPE5_EINT5 (0x02 << 10)
600#define S3C2400_GPE5_TCLK1 (0x03 << 10) 611#define S3C2400_GPE5_TCLK1 (0x03 << 10)
601 612
@@ -603,24 +614,32 @@
603#define S3C2410_GPE6_INP (0x00 << 12) 614#define S3C2410_GPE6_INP (0x00 << 12)
604#define S3C2410_GPE6_OUTP (0x01 << 12) 615#define S3C2410_GPE6_OUTP (0x01 << 12)
605#define S3C2410_GPE6_SDCMD (0x02 << 12) 616#define S3C2410_GPE6_SDCMD (0x02 << 12)
617#define S3C2443_GPE6_SD1_CMD (0x02 << 12)
618#define S3C2443_GPE6_AC_BITCLK (0x03 << 12)
606#define S3C2400_GPE6_EINT6 (0x02 << 12) 619#define S3C2400_GPE6_EINT6 (0x02 << 12)
607 620
608#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7) 621#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7)
609#define S3C2410_GPE7_INP (0x00 << 14) 622#define S3C2410_GPE7_INP (0x00 << 14)
610#define S3C2410_GPE7_OUTP (0x01 << 14) 623#define S3C2410_GPE7_OUTP (0x01 << 14)
611#define S3C2410_GPE7_SDDAT0 (0x02 << 14) 624#define S3C2410_GPE7_SDDAT0 (0x02 << 14)
625#define S3C2443_GPE5_SD1_DAT0 (0x02 << 14)
626#define S3C2443_GPE7_AC_SDI (0x03 << 14)
612#define S3C2400_GPE7_EINT7 (0x02 << 14) 627#define S3C2400_GPE7_EINT7 (0x02 << 14)
613 628
614#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8) 629#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8)
615#define S3C2410_GPE8_INP (0x00 << 16) 630#define S3C2410_GPE8_INP (0x00 << 16)
616#define S3C2410_GPE8_OUTP (0x01 << 16) 631#define S3C2410_GPE8_OUTP (0x01 << 16)
617#define S3C2410_GPE8_SDDAT1 (0x02 << 16) 632#define S3C2410_GPE8_SDDAT1 (0x02 << 16)
633#define S3C2443_GPE8_SD1_DAT1 (0x02 << 16)
634#define S3C2443_GPE8_AC_SDO (0x03 << 16)
618#define S3C2400_GPE8_nXDACK0 (0x02 << 16) 635#define S3C2400_GPE8_nXDACK0 (0x02 << 16)
619 636
620#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9) 637#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9)
621#define S3C2410_GPE9_INP (0x00 << 18) 638#define S3C2410_GPE9_INP (0x00 << 18)
622#define S3C2410_GPE9_OUTP (0x01 << 18) 639#define S3C2410_GPE9_OUTP (0x01 << 18)
623#define S3C2410_GPE9_SDDAT2 (0x02 << 18) 640#define S3C2410_GPE9_SDDAT2 (0x02 << 18)
641#define S3C2443_GPE9_SD1_DAT2 (0x02 << 18)
642#define S3C2443_GPE9_AC_SYNC (0x03 << 18)
624#define S3C2400_GPE9_nXDACK1 (0x02 << 18) 643#define S3C2400_GPE9_nXDACK1 (0x02 << 18)
625#define S3C2400_GPE9_nXBACK (0x03 << 18) 644#define S3C2400_GPE9_nXBACK (0x03 << 18)
626 645
@@ -628,6 +647,8 @@
628#define S3C2410_GPE10_INP (0x00 << 20) 647#define S3C2410_GPE10_INP (0x00 << 20)
629#define S3C2410_GPE10_OUTP (0x01 << 20) 648#define S3C2410_GPE10_OUTP (0x01 << 20)
630#define S3C2410_GPE10_SDDAT3 (0x02 << 20) 649#define S3C2410_GPE10_SDDAT3 (0x02 << 20)
650#define S3C2443_GPE10_SD1_DAT3 (0x02 << 20)
651#define S3C2443_GPE10_AC_nRESET (0x03 << 20)
631#define S3C2400_GPE10_nXDREQ0 (0x02 << 20) 652#define S3C2400_GPE10_nXDREQ0 (0x02 << 20)
632 653
633#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11) 654#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11)
@@ -796,6 +817,7 @@
796#define S3C2400_GPG4_MMCCLK (0x02 << 8) 817#define S3C2400_GPG4_MMCCLK (0x02 << 8)
797#define S3C2400_GPG4_I2SSDI (0x03 << 8) 818#define S3C2400_GPG4_I2SSDI (0x03 << 8)
798#define S3C2410_GPG4_LCDPWREN (0x03 << 8) 819#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
820#define S3C2443_GPG4_LCDPWRDN (0x03 << 8)
799 821
800#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5) 822#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5)
801#define S3C2410_GPG5_INP (0x00 << 10) 823#define S3C2410_GPG5_INP (0x00 << 10)
@@ -803,7 +825,7 @@
803#define S3C2410_GPG5_EINT13 (0x02 << 10) 825#define S3C2410_GPG5_EINT13 (0x02 << 10)
804#define S3C2400_GPG5_MMCCMD (0x02 << 10) 826#define S3C2400_GPG5_MMCCMD (0x02 << 10)
805#define S3C2400_GPG5_IICSDA (0x03 << 10) 827#define S3C2400_GPG5_IICSDA (0x03 << 10)
806#define S3C2410_GPG5_SPIMISO1 (0x03 << 10) 828#define S3C2410_GPG5_SPIMISO1 (0x03 << 10) /* not s3c2443 */
807 829
808#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6) 830#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6)
809#define S3C2410_GPG6_INP (0x00 << 12) 831#define S3C2410_GPG6_INP (0x00 << 12)
@@ -845,6 +867,7 @@
845#define S3C2410_GPG11_OUTP (0x01 << 22) 867#define S3C2410_GPG11_OUTP (0x01 << 22)
846#define S3C2410_GPG11_EINT19 (0x02 << 22) 868#define S3C2410_GPG11_EINT19 (0x02 << 22)
847#define S3C2410_GPG11_TCLK1 (0x03 << 22) 869#define S3C2410_GPG11_TCLK1 (0x03 << 22)
870#define S3C2443_GPG11_CF_nIREQ (0x03 << 22)
848 871
849#define S3C2410_GPG12 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 12) 872#define S3C2410_GPG12 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 12)
850#define S3C2410_GPG12_INP (0x00 << 24) 873#define S3C2410_GPG12_INP (0x00 << 24)
@@ -852,25 +875,28 @@
852#define S3C2410_GPG12_EINT20 (0x02 << 24) 875#define S3C2410_GPG12_EINT20 (0x02 << 24)
853#define S3C2410_GPG12_XMON (0x03 << 24) 876#define S3C2410_GPG12_XMON (0x03 << 24)
854#define S3C2442_GPG12_nSPICS0 (0x03 << 24) 877#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
878#define S3C2443_GPG12_nINPACK (0x03 << 24)
855 879
856#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13) 880#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13)
857#define S3C2410_GPG13_INP (0x00 << 26) 881#define S3C2410_GPG13_INP (0x00 << 26)
858#define S3C2410_GPG13_OUTP (0x01 << 26) 882#define S3C2410_GPG13_OUTP (0x01 << 26)
859#define S3C2410_GPG13_EINT21 (0x02 << 26) 883#define S3C2410_GPG13_EINT21 (0x02 << 26)
860#define S3C2410_GPG13_nXPON (0x03 << 26) 884#define S3C2410_GPG13_nXPON (0x03 << 26)
885#define S3C2443_GPG13_CF_nREG (0x03 << 26)
861 886
862#define S3C2410_GPG14 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 14) 887#define S3C2410_GPG14 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 14)
863#define S3C2410_GPG14_INP (0x00 << 28) 888#define S3C2410_GPG14_INP (0x00 << 28)
864#define S3C2410_GPG14_OUTP (0x01 << 28) 889#define S3C2410_GPG14_OUTP (0x01 << 28)
865#define S3C2410_GPG14_EINT22 (0x02 << 28) 890#define S3C2410_GPG14_EINT22 (0x02 << 28)
866#define S3C2410_GPG14_YMON (0x03 << 28) 891#define S3C2410_GPG14_YMON (0x03 << 28)
892#define S3C2443_GPG14_CF_RESET (0x03 << 28)
867 893
868#define S3C2410_GPG15 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 15) 894#define S3C2410_GPG15 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 15)
869#define S3C2410_GPG15_INP (0x00 << 30) 895#define S3C2410_GPG15_INP (0x00 << 30)
870#define S3C2410_GPG15_OUTP (0x01 << 30) 896#define S3C2410_GPG15_OUTP (0x01 << 30)
871#define S3C2410_GPG15_EINT23 (0x02 << 30) 897#define S3C2410_GPG15_EINT23 (0x02 << 30)
872#define S3C2410_GPG15_nYPON (0x03 << 30) 898#define S3C2410_GPG15_nYPON (0x03 << 30)
873 899#define S3C2443_GPG15_CF_PWR (0x03 << 30)
874 900
875#define S3C2410_GPG_PUPDIS(x) (1<<(x)) 901#define S3C2410_GPG_PUPDIS(x) (1<<(x))
876 902
diff --git a/include/asm-arm/arch-s3c2410/regs-mem.h b/include/asm-arm/arch-s3c2410/regs-mem.h
index 375dca50364e..e4d82341f7ba 100644
--- a/include/asm-arm/arch-s3c2410/regs-mem.h
+++ b/include/asm-arm/arch-s3c2410/regs-mem.h
@@ -133,10 +133,10 @@
133#define S3C2410_BANKCON_SDRAM (0x3 << 15) 133#define S3C2410_BANKCON_SDRAM (0x3 << 15)
134 134
135/* next bits only for EDO DRAM in 6,7 */ 135/* next bits only for EDO DRAM in 6,7 */
136#define S3C2400_BANKCON_EDO_Trdc1 (0x00 << 4) 136#define S3C2400_BANKCON_EDO_Trcd1 (0x00 << 4)
137#define S3C2400_BANKCON_EDO_Trdc2 (0x01 << 4) 137#define S3C2400_BANKCON_EDO_Trcd2 (0x01 << 4)
138#define S3C2400_BANKCON_EDO_Trdc3 (0x02 << 4) 138#define S3C2400_BANKCON_EDO_Trcd3 (0x02 << 4)
139#define S3C2400_BANKCON_EDO_Trdc4 (0x03 << 4) 139#define S3C2400_BANKCON_EDO_Trcd4 (0x03 << 4)
140 140
141/* CAS pulse width */ 141/* CAS pulse width */
142#define S3C2400_BANKCON_EDO_PULSE1 (0x00 << 3) 142#define S3C2400_BANKCON_EDO_PULSE1 (0x00 << 3)
@@ -153,9 +153,9 @@
153#define S3C2400_BANKCON_EDO_SCANb11 (0x03 << 0) 153#define S3C2400_BANKCON_EDO_SCANb11 (0x03 << 0)
154 154
155/* next bits only for SDRAM in 6,7 */ 155/* next bits only for SDRAM in 6,7 */
156#define S3C2410_BANKCON_Trdc2 (0x00 << 2) 156#define S3C2410_BANKCON_Trcd2 (0x00 << 2)
157#define S3C2410_BANKCON_Trdc3 (0x01 << 2) 157#define S3C2410_BANKCON_Trcd3 (0x01 << 2)
158#define S3C2410_BANKCON_Trdc4 (0x02 << 2) 158#define S3C2410_BANKCON_Trcd4 (0x02 << 2)
159 159
160/* control column address select */ 160/* control column address select */
161#define S3C2410_BANKCON_SCANb8 (0x00 << 0) 161#define S3C2410_BANKCON_SCANb8 (0x00 << 0)
diff --git a/include/asm-arm/arch-s3c2410/regs-s3c2443-clock.h b/include/asm-arm/arch-s3c2410/regs-s3c2443-clock.h
new file mode 100644
index 000000000000..ff0536d2de42
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/regs-s3c2443-clock.h
@@ -0,0 +1,194 @@
1/* linux/include/asm-arm/arch-s3c2410/regs-clock.h
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * S3C2443 clock register definitions
12*/
13
14#ifndef __ASM_ARM_REGS_S3C2443_CLOCK
15#define __ASM_ARM_REGS_S3C2443_CLOCK
16
17#define S3C2443_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
18
19#define S3C2443_PLLCON_MDIVSHIFT 16
20#define S3C2443_PLLCON_PDIVSHIFT 8
21#define S3C2443_PLLCON_SDIVSHIFT 0
22#define S3C2443_PLLCON_MDIVMASK ((1<<(1+(23-16)))-1)
23#define S3C2443_PLLCON_PDIVMASK ((1<<(1+(9-8)))-1)
24#define S3C2443_PLLCON_SDIVMASK (3)
25
26#define S3C2443_MPLLCON S3C2443_CLKREG(0x10)
27#define S3C2443_EPLLCON S3C2443_CLKREG(0x18)
28#define S3C2443_CLKSRC S3C2443_CLKREG(0x20)
29#define S3C2443_CLKDIV0 S3C2443_CLKREG(0x24)
30#define S3C2443_CLKDIV1 S3C2443_CLKREG(0x28)
31#define S3C2443_HCLKCON S3C2443_CLKREG(0x30)
32#define S3C2443_PCLKCON S3C2443_CLKREG(0x34)
33#define S3C2443_SCLKCON S3C2443_CLKREG(0x38)
34#define S3C2443_PWRMODE S3C2443_CLKREG(0x40)
35#define S3C2443_SWRST S3C2443_CLKREG(0x44)
36#define S3C2443_BUSPRI0 S3C2443_CLKREG(0x50)
37#define S3C2443_SYSID S3C2443_CLKREG(0x5C)
38#define S3C2443_PWRCFG S3C2443_CLKREG(0x60)
39#define S3C2443_RSTCON S3C2443_CLKREG(0x64)
40
41#define S3C2443_SWRST_RESET (0x533c2443)
42
43#define S3C2443_PLLCON_OFF (1<<24)
44
45#define S3C2443_CLKSRC_I2S_EXT (1<<14)
46#define S3C2443_CLKSRC_I2S_EPLLDIV (0<<14)
47#define S3C2443_CLKSRC_I2S_EPLLREF (2<<14)
48#define S3C2443_CLKSRC_I2S_EPLLREF3 (3<<14)
49#define S3C2443_CLKSRC_I2S_MASK (3<<14)
50
51#define S3C2443_CLKSRC_EPLLREF_XTAL (2<<8)
52#define S3C2443_CLKSRC_EPLLREF_EXTCLK (3<<8)
53#define S3C2443_CLKSRC_EPLLREF_MPLLREF (0<<8)
54#define S3C2443_CLKSRC_EPLLREF_MPLLREF2 (1<<8)
55#define S3C2443_CLKSRC_EPLLREF_MASK (3<<8)
56
57#define S3C2443_CLKSRC_ESYSCLK_EPLL (1<<6)
58#define S3C2443_CLKSRC_MSYSCLK_MPLL (1<<4)
59#define S3C2443_CLKSRC_EXTCLK_DIV (1<<3)
60
61#define S3C2443_CLKDIV0_DVS (1<<13)
62#define S3C2443_CLKDIV0_HALF_HCLK (1<<3)
63#define S3C2443_CLKDIV0_HALF_PCLK (1<<2)
64
65#define S3C2443_CLKDIV0_HCLKDIV_MASK (3<<0)
66
67#define S3C2443_CLKDIV0_EXTDIV_MASK (3<<6)
68#define S3C2443_CLKDIV0_EXTDIV_SHIFT (6)
69
70#define S3C2443_CLKDIV0_PREDIV_MASK (3<<4)
71#define S3C2443_CLKDIV0_PREDIV_SHIFT (4)
72
73#define S3C2443_CLKDIV0_ARMDIV_MASK (15<<9)
74#define S3C2443_CLKDIV0_ARMDIV_SHIFT (9)
75#define S3C2443_CLKDIV0_ARMDIV_1 (0<<9)
76#define S3C2443_CLKDIV0_ARMDIV_2 (8<<9)
77#define S3C2443_CLKDIV0_ARMDIV_3 (2<<9)
78#define S3C2443_CLKDIV0_ARMDIV_4 (9<<9)
79#define S3C2443_CLKDIV0_ARMDIV_6 (10<<9)
80#define S3C2443_CLKDIV0_ARMDIV_8 (11<<9)
81#define S3C2443_CLKDIV0_ARMDIV_12 (13<<9)
82#define S3C2443_CLKDIV0_ARMDIV_16 (15<<9)
83
84/* S3C2443_CLKDIV1 */
85
86#define S3C2443_CLKDIV1_CAMDIV_MASK (15<<26)
87#define S3C2443_CLKDIV1_CAMDIV_SHIFT (26)
88
89#define S3C2443_CLKDIV1_HSSPIDIV_MASK (3<<24)
90#define S3C2443_CLKDIV1_HSSPIDIV_SHIFT (24)
91
92#define S3C2443_CLKDIV1_DISPDIV_MASK (0xff<<16)
93#define S3C2443_CLKDIV1_DISPDIV_SHIFT (16)
94
95#define S3C2443_CLKDIV1_I2SDIV_MASK (15<<12)
96#define S3C2443_CLKDIV1_I2SDIV_SHIFT (12)
97
98#define S3C2443_CLKDIV1_UARTDIV_MASK (15<<8)
99#define S3C2443_CLKDIV1_UARTDIV_SHIFT (8)
100
101#define S3C2443_CLKDIV1_HSMMCDIV_MASK (3<<6)
102#define S3C2443_CLKDIV1_HSMMCDIV_SHIFT (6)
103
104#define S3C2443_CLKDIV1_USBHOSTDIV_MASK (3<<4)
105#define S3C2443_CLKDIV1_USBHOSTDIV_SHIFT (4)
106
107#define S3C2443_CLKCON_NAND
108
109#define S3C2443_HCLKCON_DMA0 (1<<0)
110#define S3C2443_HCLKCON_DMA1 (1<<1)
111#define S3C2443_HCLKCON_DMA2 (1<<2)
112#define S3C2443_HCLKCON_DMA3 (1<<3)
113#define S3C2443_HCLKCON_DMA4 (1<<4)
114#define S3C2443_HCLKCON_DMA5 (1<<5)
115#define S3C2443_HCLKCON_CAMIF (1<<8)
116#define S3C2443_HCLKCON_DISP (1<<9)
117#define S3C2443_HCLKCON_LCDC (1<<10)
118#define S3C2443_HCLKCON_USBH (1<<11)
119#define S3C2443_HCLKCON_USBD (1<<12)
120#define S3C2443_HCLKCON_HSMMC (1<<16)
121#define S3C2443_HCLKCON_CFC (1<<17)
122#define S3C2443_HCLKCON_SSMC (1<<18)
123#define S3C2443_HCLKCON_DRAMC (1<<19)
124
125#define S3C2443_PCLKCON_UART0 (1<<0)
126#define S3C2443_PCLKCON_UART1 (1<<1)
127#define S3C2443_PCLKCON_UART2 (1<<2)
128#define S3C2443_PCLKCON_UART3 (1<<3)
129#define S3C2443_PCLKCON_IIC (1<<4)
130#define S3C2443_PCLKCON_SDI (1<<5)
131#define S3C2443_PCLKCON_ADC (1<<7)
132#define S3C2443_PCLKCON_IIS (1<<9)
133#define S3C2443_PCLKCON_PWMT (1<<10)
134#define S3C2443_PCLKCON_WDT (1<<11)
135#define S3C2443_PCLKCON_RTC (1<<12)
136#define S3C2443_PCLKCON_GPIO (1<<13)
137#define S3C2443_PCLKCON_SPI0 (1<<14)
138#define S3C2443_PCLKCON_SPI1 (1<<15)
139
140#define S3C2443_SCLKCON_DDRCLK (1<<16)
141#define S3C2443_SCLKCON_SSMCCLK (1<<15)
142#define S3C2443_SCLKCON_HSSPICLK (1<<14)
143#define S3C2443_SCLKCON_HSMMCCLK_EXT (1<<13)
144#define S3C2443_SCLKCON_HSMMCCLK_EPLL (1<<12)
145#define S3C2443_SCLKCON_CAMCLK (1<<11)
146#define S3C2443_SCLKCON_DISPCLK (1<<10)
147#define S3C2443_SCLKCON_I2SCLK (1<<9)
148#define S3C2443_SCLKCON_UARTCLK (1<<8)
149#define S3C2443_SCLKCON_USBHOST (1<<1)
150
151#include <asm/div64.h>
152
153static inline unsigned int
154s3c2443_get_mpll(unsigned int pllval, unsigned int baseclk)
155{
156 unsigned int mdiv, pdiv, sdiv;
157 uint64_t fvco;
158
159 mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
160 pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
161 sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
162
163 mdiv &= S3C2443_PLLCON_MDIVMASK;
164 pdiv &= S3C2443_PLLCON_PDIVMASK;
165 sdiv &= S3C2443_PLLCON_SDIVMASK;
166
167 fvco = (uint64_t)baseclk * (2 * (mdiv + 8));
168 do_div(fvco, pdiv << sdiv);
169
170 return (unsigned int)fvco;
171}
172
173static inline unsigned int
174s3c2443_get_epll(unsigned int pllval, unsigned int baseclk)
175{
176 unsigned int mdiv, pdiv, sdiv;
177 uint64_t fvco;
178
179 mdiv = pllval >> S3C2443_PLLCON_MDIVSHIFT;
180 pdiv = pllval >> S3C2443_PLLCON_PDIVSHIFT;
181 sdiv = pllval >> S3C2443_PLLCON_SDIVSHIFT;
182
183 mdiv &= S3C2443_PLLCON_MDIVMASK;
184 pdiv &= S3C2443_PLLCON_PDIVMASK;
185 sdiv &= S3C2443_PLLCON_SDIVMASK;
186
187 fvco = (uint64_t)baseclk * (mdiv + 8);
188 do_div(fvco, (pdiv + 2) << sdiv);
189
190 return (unsigned int)fvco;
191}
192
193#endif /* __ASM_ARM_REGS_S3C2443_CLOCK */
194
diff --git a/include/asm-arm/arch-s3c2410/regs-serial.h b/include/asm-arm/arch-s3c2410/regs-serial.h
index 46f52401d132..8946702a87f5 100644
--- a/include/asm-arm/arch-s3c2410/regs-serial.h
+++ b/include/asm-arm/arch-s3c2410/regs-serial.h
@@ -35,10 +35,12 @@
35#define S3C24XX_VA_UART0 (S3C24XX_VA_UART) 35#define S3C24XX_VA_UART0 (S3C24XX_VA_UART)
36#define S3C24XX_VA_UART1 (S3C24XX_VA_UART + 0x4000 ) 36#define S3C24XX_VA_UART1 (S3C24XX_VA_UART + 0x4000 )
37#define S3C24XX_VA_UART2 (S3C24XX_VA_UART + 0x8000 ) 37#define S3C24XX_VA_UART2 (S3C24XX_VA_UART + 0x8000 )
38#define S3C24XX_VA_UART3 (S3C24XX_VA_UART + 0xC000 )
38 39
39#define S3C2410_PA_UART0 (S3C24XX_PA_UART) 40#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
40#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 ) 41#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
41#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 ) 42#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
43#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
42 44
43#define S3C2410_URXH (0x24) 45#define S3C2410_URXH (0x24)
44#define S3C2410_UTXH (0x20) 46#define S3C2410_UTXH (0x20)
@@ -73,6 +75,8 @@
73#define S3C2440_UCON_UCLK (1<<10) 75#define S3C2440_UCON_UCLK (1<<10)
74#define S3C2440_UCON_PCLK2 (2<<10) 76#define S3C2440_UCON_PCLK2 (2<<10)
75#define S3C2440_UCON_FCLK (3<<10) 77#define S3C2440_UCON_FCLK (3<<10)
78#define S3C2443_UCON_EPLL (3<<10)
79
76#define S3C2440_UCON2_FCLK_EN (1<<15) 80#define S3C2440_UCON2_FCLK_EN (1<<15)
77#define S3C2440_UCON0_DIVMASK (15 << 12) 81#define S3C2440_UCON0_DIVMASK (15 << 12)
78#define S3C2440_UCON1_DIVMASK (15 << 12) 82#define S3C2440_UCON1_DIVMASK (15 << 12)
@@ -93,6 +97,8 @@
93#define S3C2410_UCON_TXIRQMODE (1<<2) 97#define S3C2410_UCON_TXIRQMODE (1<<2)
94#define S3C2410_UCON_RXIRQMODE (1<<0) 98#define S3C2410_UCON_RXIRQMODE (1<<0)
95#define S3C2410_UCON_RXFIFO_TOI (1<<7) 99#define S3C2410_UCON_RXFIFO_TOI (1<<7)
100#define S3C2443_UCON_RXERR_IRQEN (1<<6)
101#define S3C2443_UCON_LOOPBACK (1<<5)
96 102
97#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 103#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
98 S3C2410_UCON_RXILEVEL | \ 104 S3C2410_UCON_RXILEVEL | \
@@ -127,7 +133,7 @@
127#define S3C2410_UMCOM_AFC (1<<4) 133#define S3C2410_UMCOM_AFC (1<<4)
128#define S3C2410_UMCOM_RTS_LOW (1<<0) 134#define S3C2410_UMCOM_RTS_LOW (1<<0)
129 135
130#define S3C2412_UMCON_AFC_63 (0<<5) 136#define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
131#define S3C2412_UMCON_AFC_56 (1<<5) 137#define S3C2412_UMCON_AFC_56 (1<<5)
132#define S3C2412_UMCON_AFC_48 (2<<5) 138#define S3C2412_UMCON_AFC_48 (2<<5)
133#define S3C2412_UMCON_AFC_40 (3<<5) 139#define S3C2412_UMCON_AFC_40 (3<<5)
@@ -143,6 +149,7 @@
143#define S3C2410_UFSTAT_RXMASK (15<<0) 149#define S3C2410_UFSTAT_RXMASK (15<<0)
144#define S3C2410_UFSTAT_RXSHIFT (0) 150#define S3C2410_UFSTAT_RXSHIFT (0)
145 151
152/* UFSTAT S3C2443 same as S3C2440 */
146#define S3C2440_UFSTAT_TXFULL (1<<14) 153#define S3C2440_UFSTAT_TXFULL (1<<14)
147#define S3C2440_UFSTAT_RXFULL (1<<6) 154#define S3C2440_UFSTAT_RXFULL (1<<6)
148#define S3C2440_UFSTAT_TXSHIFT (8) 155#define S3C2440_UFSTAT_TXSHIFT (8)
@@ -157,6 +164,8 @@
157#define S3C2410_UERSTAT_OVERRUN (1<<0) 164#define S3C2410_UERSTAT_OVERRUN (1<<0)
158#define S3C2410_UERSTAT_FRAME (1<<2) 165#define S3C2410_UERSTAT_FRAME (1<<2)
159#define S3C2410_UERSTAT_BREAK (1<<3) 166#define S3C2410_UERSTAT_BREAK (1<<3)
167#define S3C2443_UERSTAT_PARITY (1<<1)
168
160#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \ 169#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
161 S3C2410_UERSTAT_FRAME | \ 170 S3C2410_UERSTAT_FRAME | \
162 S3C2410_UERSTAT_BREAK) 171 S3C2410_UERSTAT_BREAK)
@@ -164,6 +173,8 @@
164#define S3C2410_UMSTAT_CTS (1<<0) 173#define S3C2410_UMSTAT_CTS (1<<0)
165#define S3C2410_UMSTAT_DeltaCTS (1<<2) 174#define S3C2410_UMSTAT_DeltaCTS (1<<2)
166 175
176#define S3C2443_DIVSLOT (0x2C)
177
167#ifndef __ASSEMBLY__ 178#ifndef __ASSEMBLY__
168 179
169/* struct s3c24xx_uart_clksrc 180/* struct s3c24xx_uart_clksrc
diff --git a/include/asm-arm/arch-s3c2410/reset.h b/include/asm-arm/arch-s3c2410/reset.h
new file mode 100644
index 000000000000..4f866cdecab0
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/reset.h
@@ -0,0 +1,22 @@
1/* linux/include/asm-arm/arch-s3c2410/reset.h
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * S3C2410 CPU reset controls
12*/
13
14#ifndef __ASM_ARCH_RESET_H
15#define __ASM_ARCH_RESET_H __FILE__
16
17/* This allows the over-ride of the default reset code
18*/
19
20extern void (*s3c24xx_reset_hook)(void);
21
22#endif /* __ASM_ARCH_RESET_H */
diff --git a/include/asm-arm/arch-s3c2410/system.h b/include/asm-arm/arch-s3c2410/system.h
index ecf250db45fb..1c74ef17da33 100644
--- a/include/asm-arm/arch-s3c2410/system.h
+++ b/include/asm-arm/arch-s3c2410/system.h
@@ -15,15 +15,16 @@
15 15
16#include <asm/arch/map.h> 16#include <asm/arch/map.h>
17#include <asm/arch/idle.h> 17#include <asm/arch/idle.h>
18#include <asm/arch/reset.h>
18 19
19#include <asm/arch/regs-watchdog.h> 20#include <asm/arch/regs-watchdog.h>
20#include <asm/arch/regs-clock.h> 21#include <asm/arch/regs-clock.h>
21 22
22void (*s3c24xx_idle)(void); 23void (*s3c24xx_idle)(void);
24void (*s3c24xx_reset_hook)(void);
23 25
24void s3c24xx_default_idle(void) 26void s3c24xx_default_idle(void)
25{ 27{
26 void __iomem *reg = S3C2410_CLKCON;
27 unsigned long tmp; 28 unsigned long tmp;
28 int i; 29 int i;
29 30
@@ -33,16 +34,18 @@ void s3c24xx_default_idle(void)
33 34
34 /* Warning: going into idle state upsets jtag scanning */ 35 /* Warning: going into idle state upsets jtag scanning */
35 36
36 __raw_writel(__raw_readl(reg) | (1<<2), reg); 37 __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
38 S3C2410_CLKCON);
37 39
38 /* the samsung port seems to do a loop and then unset idle.. */ 40 /* the samsung port seems to do a loop and then unset idle.. */
39 for (i = 0; i < 50; i++) { 41 for (i = 0; i < 50; i++) {
40 tmp += __raw_readl(reg); /* ensure loop not optimised out */ 42 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
41 } 43 }
42 44
43 /* this bit is not cleared on re-start... */ 45 /* this bit is not cleared on re-start... */
44 46
45 __raw_writel(__raw_readl(reg) & ~(1<<2), reg); 47 __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
48 S3C2410_CLKCON);
46} 49}
47 50
48static void arch_idle(void) 51static void arch_idle(void)
@@ -53,7 +56,6 @@ static void arch_idle(void)
53 s3c24xx_default_idle(); 56 s3c24xx_default_idle();
54} 57}
55 58
56
57static void 59static void
58arch_reset(char mode) 60arch_reset(char mode)
59{ 61{
@@ -61,6 +63,9 @@ arch_reset(char mode)
61 cpu_reset(0); 63 cpu_reset(0);
62 } 64 }
63 65
66 if (s3c24xx_reset_hook)
67 s3c24xx_reset_hook();
68
64 printk("arch_reset: attempting watchdog reset\n"); 69 printk("arch_reset: attempting watchdog reset\n");
65 70
66 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ 71 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
diff --git a/include/asm-arm/arch-s3c2410/udc.h b/include/asm-arm/arch-s3c2410/udc.h
new file mode 100644
index 000000000000..e59ec339d614
--- /dev/null
+++ b/include/asm-arm/arch-s3c2410/udc.h
@@ -0,0 +1,36 @@
1/* linux/include/asm/arch-s3c2410/udc.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
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 * Changelog:
12 * 14-Mar-2005 RTP Created file
13 * 02-Aug-2005 RTP File rename
14 * 07-Sep-2005 BJD Minor cleanups, changed cmd to enum
15 * 18-Jan-2007 HMW Add per-platform vbus_draw function
16*/
17
18#ifndef __ASM_ARM_ARCH_UDC_H
19#define __ASM_ARM_ARCH_UDC_H
20
21enum s3c2410_udc_cmd_e {
22 S3C2410_UDC_P_ENABLE = 1, /* Pull-up enable */
23 S3C2410_UDC_P_DISABLE = 2, /* Pull-up disable */
24 S3C2410_UDC_P_RESET = 3, /* UDC reset, in case of */
25};
26
27struct s3c2410_udc_mach_info {
28 void (*udc_command)(enum s3c2410_udc_cmd_e);
29 void (*vbus_draw)(unsigned int ma);
30 unsigned int vbus_pin;
31 unsigned char vbus_pin_inverted;
32};
33
34extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
35
36#endif /* __ASM_ARM_ARCH_UDC_H */
diff --git a/include/asm-arm/arch-sa1100/entry-macro.S b/include/asm-arm/arch-sa1100/entry-macro.S
index 51fb50ce1169..028967629340 100644
--- a/include/asm-arm/arch-sa1100/entry-macro.S
+++ b/include/asm-arm/arch-sa1100/entry-macro.S
@@ -11,6 +11,12 @@
11 .macro disable_fiq 11 .macro disable_fiq
12 .endm 12 .endm
13 13
14 .macro get_irqnr_preamble, base, tmp
15 .endm
16
17 .macro arch_ret_to_user, tmp1, tmp2
18 .endm
19
14 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 20 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
15 mov r4, #0xfa000000 @ ICIP = 0xfa050000 21 mov r4, #0xfa000000 @ ICIP = 0xfa050000
16 add r4, r4, #0x00050000 22 add r4, r4, #0x00050000
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h
new file mode 100644
index 000000000000..e7a9d26e22a8
--- /dev/null
+++ b/include/asm-arm/arch-sa1100/gpio.h
@@ -0,0 +1,75 @@
1/*
2 * linux/include/asm-arm/arch-sa1100/gpio.h
3 *
4 * SA1100 GPIO wrappers for arch-neutral GPIO calls
5 *
6 * Written by Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (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, MA 02111-1307 USA
21 *
22 */
23
24#ifndef __ASM_ARCH_SA1100_GPIO_H
25#define __ASM_ARCH_SA1100_GPIO_H
26
27#include <asm/hardware.h>
28#include <asm/irq.h>
29
30static inline int gpio_request(unsigned gpio, const char *label)
31{
32 return 0;
33}
34
35static inline void gpio_free(unsigned gpio)
36{
37 return;
38}
39
40extern int gpio_direction_input(unsigned gpio);
41extern int gpio_direction_output(unsigned gpio, int value);
42
43
44static inline int gpio_get_value(unsigned gpio)
45{
46 return GPLR & GPIO_GPIO(gpio);
47}
48
49static inline void gpio_set_value(unsigned gpio, int value)
50{
51 if (value)
52 GPSR = GPIO_GPIO(gpio);
53 else
54 GPCR = GPIO_GPIO(gpio);
55}
56
57#include <asm-generic/gpio.h> /* cansleep wrappers */
58
59static inline unsigned gpio_to_irq(unsigned gpio)
60{
61 if (gpio < 11)
62 return IRQ_GPIO0 + gpio;
63 else
64 return IRQ_GPIO11 - 11 + gpio;
65}
66
67static inline unsigned irq_to_gpio(unsigned irq)
68{
69 if (irq < IRQ_GPIO11_27)
70 return irq - IRQ_GPIO0;
71 else
72 return irq - IRQ_GPIO11 + 11;
73}
74
75#endif
diff --git a/include/asm-arm/arch-shark/entry-macro.S b/include/asm-arm/arch-shark/entry-macro.S
index a924f27fb8d9..82463f30f3df 100644
--- a/include/asm-arm/arch-shark/entry-macro.S
+++ b/include/asm-arm/arch-shark/entry-macro.S
@@ -10,6 +10,12 @@
10 .macro disable_fiq 10 .macro disable_fiq
11 .endm 11 .endm
12 12
13 .macro get_irqnr_preamble, base, tmp
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
13 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
14 mov r4, #0xe0000000 20 mov r4, #0xe0000000
15 21
diff --git a/include/asm-arm/arch-versatile/entry-macro.S b/include/asm-arm/arch-versatile/entry-macro.S
index feff771c0a0a..0fae002637a0 100644
--- a/include/asm-arm/arch-versatile/entry-macro.S
+++ b/include/asm-arm/arch-versatile/entry-macro.S
@@ -13,6 +13,12 @@
13 .macro disable_fiq 13 .macro disable_fiq
14 .endm 14 .endm
15 15
16 .macro get_irqnr_preamble, base, tmp
17 .endm
18
19 .macro arch_ret_to_user, tmp1, tmp2
20 .endm
21
16 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp 22 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
17 ldr \base, =IO_ADDRESS(VERSATILE_VIC_BASE) 23 ldr \base, =IO_ADDRESS(VERSATILE_VIC_BASE)
18 ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get masked status 24 ldr \irqstat, [\base, #VIC_IRQ_STATUS] @ get masked status
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index ea88aa6bfc78..f266c2795124 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -103,9 +103,9 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
103 unsigned long tmp, tmp2; 103 unsigned long tmp, tmp2;
104 104
105 __asm__ __volatile__("@ atomic_clear_mask\n" 105 __asm__ __volatile__("@ atomic_clear_mask\n"
106"1: ldrex %0, %2\n" 106"1: ldrex %0, [%2]\n"
107" bic %0, %0, %3\n" 107" bic %0, %0, %3\n"
108" strex %1, %0, %2\n" 108" strex %1, %0, [%2]\n"
109" teq %1, #0\n" 109" teq %1, #0\n"
110" bne 1b" 110" bne 1b"
111 : "=&r" (tmp), "=&r" (tmp2) 111 : "=&r" (tmp), "=&r" (tmp2)
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index 5f531ea03059..afad32c76e6c 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -185,9 +185,15 @@ struct cpu_cache_fns {
185 void (*coherent_user_range)(unsigned long, unsigned long); 185 void (*coherent_user_range)(unsigned long, unsigned long);
186 void (*flush_kern_dcache_page)(void *); 186 void (*flush_kern_dcache_page)(void *);
187 187
188 void (*dma_inv_range)(unsigned long, unsigned long); 188 void (*dma_inv_range)(const void *, const void *);
189 void (*dma_clean_range)(unsigned long, unsigned long); 189 void (*dma_clean_range)(const void *, const void *);
190 void (*dma_flush_range)(unsigned long, unsigned long); 190 void (*dma_flush_range)(const void *, const void *);
191};
192
193struct outer_cache_fns {
194 void (*inv_range)(unsigned long, unsigned long);
195 void (*clean_range)(unsigned long, unsigned long);
196 void (*flush_range)(unsigned long, unsigned long);
191}; 197};
192 198
193/* 199/*
@@ -240,9 +246,40 @@ extern void __cpuc_flush_dcache_page(void *);
240#define dmac_clean_range __glue(_CACHE,_dma_clean_range) 246#define dmac_clean_range __glue(_CACHE,_dma_clean_range)
241#define dmac_flush_range __glue(_CACHE,_dma_flush_range) 247#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
242 248
243extern void dmac_inv_range(unsigned long, unsigned long); 249extern void dmac_inv_range(const void *, const void *);
244extern void dmac_clean_range(unsigned long, unsigned long); 250extern void dmac_clean_range(const void *, const void *);
245extern void dmac_flush_range(unsigned long, unsigned long); 251extern void dmac_flush_range(const void *, const void *);
252
253#endif
254
255#ifdef CONFIG_OUTER_CACHE
256
257extern struct outer_cache_fns outer_cache;
258
259static inline void outer_inv_range(unsigned long start, unsigned long end)
260{
261 if (outer_cache.inv_range)
262 outer_cache.inv_range(start, end);
263}
264static inline void outer_clean_range(unsigned long start, unsigned long end)
265{
266 if (outer_cache.clean_range)
267 outer_cache.clean_range(start, end);
268}
269static inline void outer_flush_range(unsigned long start, unsigned long end)
270{
271 if (outer_cache.flush_range)
272 outer_cache.flush_range(start, end);
273}
274
275#else
276
277static inline void outer_inv_range(unsigned long start, unsigned long end)
278{ }
279static inline void outer_clean_range(unsigned long start, unsigned long end)
280{ }
281static inline void outer_flush_range(unsigned long start, unsigned long end)
282{ }
246 283
247#endif 284#endif
248 285
diff --git a/include/asm-arm/checksum.h b/include/asm-arm/checksum.h
index 8c0bb5bb14ee..eaa0efd8d0d4 100644
--- a/include/asm-arm/checksum.h
+++ b/include/asm-arm/checksum.h
@@ -40,13 +40,27 @@ __wsum
40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr); 40csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
41 41
42/* 42/*
43 * Fold a partial checksum without adding pseudo headers
44 */
45static inline __sum16 csum_fold(__wsum sum)
46{
47 __asm__(
48 "add %0, %1, %1, ror #16 @ csum_fold"
49 : "=r" (sum)
50 : "r" (sum)
51 : "cc");
52 return (__force __sum16)(~(__force u32)sum >> 16);
53}
54
55/*
43 * This is a version of ip_compute_csum() optimized for IP headers, 56 * This is a version of ip_compute_csum() optimized for IP headers,
44 * which always checksum on 4 octet boundaries. 57 * which always checksum on 4 octet boundaries.
45 */ 58 */
46static inline __sum16 59static inline __sum16
47ip_fast_csum(const void *iph, unsigned int ihl) 60ip_fast_csum(const void *iph, unsigned int ihl)
48{ 61{
49 unsigned int sum, tmp1; 62 unsigned int tmp1;
63 __wsum sum;
50 64
51 __asm__ __volatile__( 65 __asm__ __volatile__(
52 "ldr %0, [%1], #4 @ ip_fast_csum \n\ 66 "ldr %0, [%1], #4 @ ip_fast_csum \n\
@@ -62,29 +76,11 @@ ip_fast_csum(const void *iph, unsigned int ihl)
62 subne %2, %2, #1 @ without destroying \n\ 76 subne %2, %2, #1 @ without destroying \n\
63 bne 1b @ the carry flag \n\ 77 bne 1b @ the carry flag \n\
64 adcs %0, %0, %3 \n\ 78 adcs %0, %0, %3 \n\
65 adc %0, %0, #0 \n\ 79 adc %0, %0, #0"
66 adds %0, %0, %0, lsl #16 \n\
67 addcs %0, %0, #0x10000 \n\
68 mvn %0, %0 \n\
69 mov %0, %0, lsr #16"
70 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1) 80 : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
71 : "1" (iph), "2" (ihl) 81 : "1" (iph), "2" (ihl)
72 : "cc", "memory"); 82 : "cc", "memory");
73 return (__force __sum16)sum; 83 return csum_fold(sum);
74}
75
76/*
77 * Fold a partial checksum without adding pseudo headers
78 */
79static inline __sum16 csum_fold(__wsum sum)
80{
81 __asm__(
82 "adds %0, %1, %1, lsl #16 @ csum_fold \n\
83 addcs %0, %0, #0x10000"
84 : "=r" (sum)
85 : "r" (sum)
86 : "cc");
87 return (__force __sum16)(~(__force u32)sum >> 16);
88} 84}
89 85
90static inline __wsum 86static inline __wsum
@@ -114,23 +110,7 @@ static inline __sum16
114csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 110csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
115 unsigned short proto, __wsum sum) 111 unsigned short proto, __wsum sum)
116{ 112{
117 __asm__( 113 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
118 "adds %0, %1, %2 @ csum_tcpudp_magic \n\
119 adcs %0, %0, %3 \n"
120#ifdef __ARMEB__
121 "adcs %0, %0, %4 \n"
122#else
123 "adcs %0, %0, %4, lsl #8 \n"
124#endif
125 "adcs %0, %0, %5 \n\
126 adc %0, %0, #0 \n\
127 adds %0, %0, %0, lsl #16 \n\
128 addcs %0, %0, #0x10000 \n\
129 mvn %0, %0"
130 : "=&r"(sum)
131 : "r" (sum), "r" (daddr), "r" (saddr), "r" (len), "Ir" (htons(proto))
132 : "cc");
133 return (__force __sum16)((__force u32)sum >> 16);
134} 114}
135 115
136 116
diff --git a/include/asm-arm/device.h b/include/asm-arm/device.h
index d8f9872b0e2d..c61642b40603 100644
--- a/include/asm-arm/device.h
+++ b/include/asm-arm/device.h
@@ -3,5 +3,13 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef ASMARM_DEVICE_H
7#define ASMARM_DEVICE_H
7 8
9struct dev_archdata {
10#ifdef CONFIG_DMABOUNCE
11 struct dmabounce_device_info *dmabounce;
12#endif
13};
14
15#endif
diff --git a/include/asm-arm/div64.h b/include/asm-arm/div64.h
index 37e0a96e8789..0b5f881c3d85 100644
--- a/include/asm-arm/div64.h
+++ b/include/asm-arm/div64.h
@@ -2,6 +2,7 @@
2#define __ASM_ARM_DIV64 2#define __ASM_ARM_DIV64
3 3
4#include <asm/system.h> 4#include <asm/system.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * The semantics of do_div() are: 8 * The semantics of do_div() are:
@@ -223,4 +224,6 @@
223 224
224#endif 225#endif
225 226
227extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
228
226#endif 229#endif
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 9bc46b486afb..abfb75b654c7 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -17,7 +17,7 @@
17 * platforms with CONFIG_DMABOUNCE. 17 * platforms with CONFIG_DMABOUNCE.
18 * Use the driver DMA support - see dma-mapping.h (dma_sync_*) 18 * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
19 */ 19 */
20extern void consistent_sync(void *kaddr, size_t size, int rw); 20extern void consistent_sync(const void *kaddr, size_t size, int rw);
21 21
22/* 22/*
23 * Return whether the given device DMA address mask can be supported 23 * Return whether the given device DMA address mask can be supported
@@ -61,6 +61,22 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
61 return dma_addr == ~0; 61 return dma_addr == ~0;
62} 62}
63 63
64/*
65 * Dummy noncoherent implementation. We don't provide a dma_cache_sync
66 * function so drivers using this API are highlighted with build warnings.
67 */
68static inline void *
69dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
70{
71 return NULL;
72}
73
74static inline void
75dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
76 dma_addr_t handle)
77{
78}
79
64/** 80/**
65 * dma_alloc_coherent - allocate consistent memory for DMA 81 * dma_alloc_coherent - allocate consistent memory for DMA
66 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 82 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
diff --git a/include/asm-arm/domain.h b/include/asm-arm/domain.h
index 4c2885abbe6c..3c12a7625304 100644
--- a/include/asm-arm/domain.h
+++ b/include/asm-arm/domain.h
@@ -57,6 +57,7 @@
57 __asm__ __volatile__( \ 57 __asm__ __volatile__( \
58 "mcr p15, 0, %0, c3, c0 @ set domain" \ 58 "mcr p15, 0, %0, c3, c0 @ set domain" \
59 : : "r" (x)); \ 59 : : "r" (x)); \
60 isb(); \
60 } while (0) 61 } while (0)
61 62
62#define modify_domain(dom,type) \ 63#define modify_domain(dom,type) \
diff --git a/include/asm-arm/fpstate.h b/include/asm-arm/fpstate.h
index 6af4e6bd1290..f31cda5a55ee 100644
--- a/include/asm-arm/fpstate.h
+++ b/include/asm-arm/fpstate.h
@@ -35,6 +35,9 @@ struct vfp_hard_struct {
35 */ 35 */
36 __u32 fpinst; 36 __u32 fpinst;
37 __u32 fpinst2; 37 __u32 fpinst2;
38#ifdef CONFIG_SMP
39 __u32 cpu;
40#endif
38}; 41};
39 42
40union vfp_state { 43union vfp_state {
diff --git a/include/asm-arm/gpio.h b/include/asm-arm/gpio.h
new file mode 100644
index 000000000000..fff4f800ee42
--- /dev/null
+++ b/include/asm-arm/gpio.h
@@ -0,0 +1,7 @@
1#ifndef _ARCH_ARM_GPIO_H
2#define _ARCH_ARM_GPIO_H
3
4/* not all ARM platforms necessarily support this API ... */
5#include <asm/arch/gpio.h>
6
7#endif /* _ARCH_ARM_GPIO_H */
diff --git a/include/asm-arm/hardware/arm_scu.h b/include/asm-arm/hardware/arm_scu.h
index 9903f60c84b7..7d28eb5a1758 100644
--- a/include/asm-arm/hardware/arm_scu.h
+++ b/include/asm-arm/hardware/arm_scu.h
@@ -1,6 +1,8 @@
1#ifndef ASMARM_HARDWARE_ARM_SCU_H 1#ifndef ASMARM_HARDWARE_ARM_SCU_H
2#define ASMARM_HARDWARE_ARM_SCU_H 2#define ASMARM_HARDWARE_ARM_SCU_H
3 3
4#include <asm/arch/scu.h>
5
4/* 6/*
5 * SCU registers 7 * SCU registers
6 */ 8 */
diff --git a/include/asm-arm/hardware/cache-l2x0.h b/include/asm-arm/hardware/cache-l2x0.h
new file mode 100644
index 000000000000..54029a740396
--- /dev/null
+++ b/include/asm-arm/hardware/cache-l2x0.h
@@ -0,0 +1,56 @@
1/*
2 * include/asm-arm/hardware/cache-l2x0.h
3 *
4 * Copyright (C) 2007 ARM Limited
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 * 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#ifndef __ASM_ARM_HARDWARE_L2X0_H
21#define __ASM_ARM_HARDWARE_L2X0_H
22
23#define L2X0_CACHE_ID 0x000
24#define L2X0_CACHE_TYPE 0x004
25#define L2X0_CTRL 0x100
26#define L2X0_AUX_CTRL 0x104
27#define L2X0_EVENT_CNT_CTRL 0x200
28#define L2X0_EVENT_CNT1_CFG 0x204
29#define L2X0_EVENT_CNT0_CFG 0x208
30#define L2X0_EVENT_CNT1_VAL 0x20C
31#define L2X0_EVENT_CNT0_VAL 0x210
32#define L2X0_INTR_MASK 0x214
33#define L2X0_MASKED_INTR_STAT 0x218
34#define L2X0_RAW_INTR_STAT 0x21C
35#define L2X0_INTR_CLEAR 0x220
36#define L2X0_CACHE_SYNC 0x730
37#define L2X0_INV_LINE_PA 0x770
38#define L2X0_INV_WAY 0x77C
39#define L2X0_CLEAN_LINE_PA 0x7B0
40#define L2X0_CLEAN_LINE_IDX 0x7B8
41#define L2X0_CLEAN_WAY 0x7BC
42#define L2X0_CLEAN_INV_LINE_PA 0x7F0
43#define L2X0_CLEAN_INV_LINE_IDX 0x7F8
44#define L2X0_CLEAN_INV_WAY 0x7FC
45#define L2X0_LOCKDOWN_WAY_D 0x900
46#define L2X0_LOCKDOWN_WAY_I 0x904
47#define L2X0_TEST_OPERATION 0xF00
48#define L2X0_LINE_DATA 0xF10
49#define L2X0_LINE_TAG 0xF30
50#define L2X0_DEBUG_CTRL 0xF40
51
52#ifndef __ASSEMBLY__
53extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
54#endif
55
56#endif
diff --git a/include/asm-arm/hardware/gic.h b/include/asm-arm/hardware/gic.h
index 3fa5eb70f64e..966e428ad32c 100644
--- a/include/asm-arm/hardware/gic.h
+++ b/include/asm-arm/hardware/gic.h
@@ -33,8 +33,9 @@
33#define GIC_DIST_SOFTINT 0xf00 33#define GIC_DIST_SOFTINT 0xf00
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36void gic_dist_init(void __iomem *base); 36void gic_dist_init(unsigned int gic_nr, void __iomem *base, unsigned int irq_start);
37void gic_cpu_init(void __iomem *base); 37void gic_cpu_init(unsigned int gic_nr, void __iomem *base);
38void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
38void gic_raise_softirq(cpumask_t cpumask, unsigned int irq); 39void gic_raise_softirq(cpumask_t cpumask, unsigned int irq);
39#endif 40#endif
40 41
diff --git a/include/asm-arm/hardware/iop3xx.h b/include/asm-arm/hardware/iop3xx.h
index 13ac8a4cd01f..15141a9caca8 100644
--- a/include/asm-arm/hardware/iop3xx.h
+++ b/include/asm-arm/hardware/iop3xx.h
@@ -37,6 +37,13 @@ extern void gpio_line_set(int line, int value);
37#define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000 37#define IOP3XX_PERIPHERAL_PHYS_BASE 0xffffe000
38#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000 38#define IOP3XX_PERIPHERAL_VIRT_BASE 0xfeffe000
39#define IOP3XX_PERIPHERAL_SIZE 0x00002000 39#define IOP3XX_PERIPHERAL_SIZE 0x00002000
40#define IOP3XX_PERIPHERAL_UPPER_PA (IOP3XX_PERIPHERAL_PHYS_BASE +\
41 IOP3XX_PERIPHERAL_SIZE - 1)
42#define IOP3XX_PERIPHERAL_UPPER_VA (IOP3XX_PERIPHERAL_VIRT_BASE +\
43 IOP3XX_PERIPHERAL_SIZE - 1)
44#define IOP3XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
45 (IOP3XX_PERIPHERAL_PHYS_BASE\
46 - IOP3XX_PERIPHERAL_VIRT_BASE))
40#define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg)) 47#define IOP3XX_REG_ADDR(reg) (IOP3XX_PERIPHERAL_VIRT_BASE + (reg))
41 48
42/* Address Translation Unit */ 49/* Address Translation Unit */
@@ -181,14 +188,10 @@ extern void gpio_line_set(int line, int value);
181#define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014) 188#define IOP3XX_TU_TRR1 (volatile u32 *)IOP3XX_TIMER_REG(0x0014)
182#define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018) 189#define IOP3XX_TU_TISR (volatile u32 *)IOP3XX_TIMER_REG(0x0018)
183#define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c) 190#define IOP3XX_TU_WDTCR (volatile u32 *)IOP3XX_TIMER_REG(0x001c)
184#define IOP3XX_TMR_TC 0x01 191#define IOP_TMR_EN 0x02
185#define IOP3XX_TMR_EN 0x02 192#define IOP_TMR_RELOAD 0x04
186#define IOP3XX_TMR_RELOAD 0x04 193#define IOP_TMR_PRIVILEGED 0x08
187#define IOP3XX_TMR_PRIVILEGED 0x09 194#define IOP_TMR_RATIO_1_1 0x00
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 195
193/* Application accelerator unit */ 196/* Application accelerator unit */
194#define IOP3XX_AAU_ACR (volatile u32 *)IOP3XX_REG_ADDR(0x0800) 197#define IOP3XX_AAU_ACR (volatile u32 *)IOP3XX_REG_ADDR(0x0800)
@@ -258,43 +261,63 @@ extern void gpio_line_set(int line, int value);
258#define IOP3XX_PCI_LOWER_IO_PA 0x90000000 261#define IOP3XX_PCI_LOWER_IO_PA 0x90000000
259#define IOP3XX_PCI_LOWER_IO_VA 0xfe000000 262#define IOP3XX_PCI_LOWER_IO_VA 0xfe000000
260#define IOP3XX_PCI_LOWER_IO_BA (*IOP3XX_OIOWTVR) 263#define IOP3XX_PCI_LOWER_IO_BA (*IOP3XX_OIOWTVR)
264#define IOP3XX_PCI_UPPER_IO_PA (IOP3XX_PCI_LOWER_IO_PA +\
265 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
266#define IOP3XX_PCI_UPPER_IO_VA (IOP3XX_PCI_LOWER_IO_VA +\
267 IOP3XX_PCI_IO_WINDOW_SIZE - 1)
268#define IOP3XX_PCI_IO_PHYS_TO_VIRT(addr) (((u32) addr -\
269 IOP3XX_PCI_LOWER_IO_PA) +\
270 IOP3XX_PCI_LOWER_IO_VA)
261 271
262 272
263#ifndef __ASSEMBLY__ 273#ifndef __ASSEMBLY__
264void iop3xx_map_io(void); 274void iop3xx_map_io(void);
265void iop3xx_init_time(unsigned long); 275void iop_init_cp6_handler(void);
266unsigned long iop3xx_gettimeoffset(void); 276void iop_init_time(unsigned long tickrate);
277unsigned long iop_gettimeoffset(void);
267 278
268extern struct platform_device iop3xx_i2c0_device; 279static inline void write_tmr0(u32 val)
269extern struct platform_device iop3xx_i2c1_device; 280{
281 asm volatile("mcr p6, 0, %0, c0, c1, 0" : : "r" (val));
282}
283
284static inline void write_tmr1(u32 val)
285{
286 asm volatile("mcr p6, 0, %0, c1, c1, 0" : : "r" (val));
287}
288
289static inline u32 read_tcr0(void)
290{
291 u32 val;
292 asm volatile("mrc p6, 0, %0, c2, c1, 0" : "=r" (val));
293 return val;
294}
270 295
271extern inline void iop3xx_cp6_enable(void) 296static inline u32 read_tcr1(void)
272{ 297{
273 u32 temp; 298 u32 val;
299 asm volatile("mrc p6, 0, %0, c3, c1, 0" : "=r" (val));
300 return val;
301}
274 302
275 asm volatile ( 303static inline void write_trr0(u32 val)
276 "mrc p15, 0, %0, c15, c1, 0\n\t" 304{
277 "orr %0, %0, #(1 << 6)\n\t" 305 asm volatile("mcr p6, 0, %0, c4, c1, 0" : : "r" (val));
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} 306}
284 307
285extern inline void iop3xx_cp6_disable(void) 308static inline void write_trr1(u32 val)
286{ 309{
287 u32 temp; 310 asm volatile("mcr p6, 0, %0, c5, c1, 0" : : "r" (val));
311}
288 312
289 asm volatile ( 313static inline void write_tisr(u32 val)
290 "mrc p15, 0, %0, c15, c1, 0\n\t" 314{
291 "bic %0, %0, #(1 << 6)\n\t" 315 asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (val));
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} 316}
317
318extern struct platform_device iop3xx_i2c0_device;
319extern struct platform_device iop3xx_i2c1_device;
320
298#endif 321#endif
299 322
300 323
diff --git a/include/asm-arm/hardware/sa1111.h b/include/asm-arm/hardware/sa1111.h
index 6aa0a5b75b69..61b1d05c7df7 100644
--- a/include/asm-arm/hardware/sa1111.h
+++ b/include/asm-arm/hardware/sa1111.h
@@ -29,6 +29,9 @@
29#define _SA1111(x) ((x) + sa1111->resource.start) 29#define _SA1111(x) ((x) + sa1111->resource.start)
30#endif 30#endif
31 31
32#define sa1111_writel(val,addr) __raw_writel(val, addr)
33#define sa1111_readl(addr) __raw_readl(addr)
34
32/* 35/*
33 * 26 bits of the SA-1110 address bus are available to the SA-1111. 36 * 26 bits of the SA-1110 address bus are available to the SA-1111.
34 * Use these when feeding target addresses to the DMA engines. 37 * Use these when feeding target addresses to the DMA engines.
@@ -45,14 +48,6 @@
45#define SA1111_SAC_DMA_MIN_XFER (0x800) 48#define SA1111_SAC_DMA_MIN_XFER (0x800)
46 49
47/* 50/*
48 * SA1111 register definitions.
49 */
50#define __CCREG(x) __REGP(SA1111_VBASE + (x))
51
52#define sa1111_writel(val,addr) __raw_writel(val, addr)
53#define sa1111_readl(addr) __raw_readl(addr)
54
55/*
56 * System Bus Interface (SBI) 51 * System Bus Interface (SBI)
57 * 52 *
58 * Registers 53 * Registers
@@ -194,55 +189,37 @@
194 * SADR Serial Audio Data Register (16 x 32-bit) 189 * SADR Serial Audio Data Register (16 x 32-bit)
195 */ 190 */
196 191
197#define _SACR0 _SA1111( 0x0600 ) 192#define SA1111_SERAUDIO 0x0600
198#define _SACR1 _SA1111( 0x0604 ) 193
199#define _SACR2 _SA1111( 0x0608 ) 194/*
200#define _SASR0 _SA1111( 0x060c ) 195 * These are offsets from the above base.
201#define _SASR1 _SA1111( 0x0610 ) 196 */
202#define _SASCR _SA1111( 0x0618 ) 197#define SA1111_SACR0 0x00
203#define _L3_CAR _SA1111( 0x061c ) 198#define SA1111_SACR1 0x04
204#define _L3_CDR _SA1111( 0x0620 ) 199#define SA1111_SACR2 0x08
205#define _ACCAR _SA1111( 0x0624 ) 200#define SA1111_SASR0 0x0c
206#define _ACCDR _SA1111( 0x0628 ) 201#define SA1111_SASR1 0x10
207#define _ACSAR _SA1111( 0x062c ) 202#define SA1111_SASCR 0x18
208#define _ACSDR _SA1111( 0x0630 ) 203#define SA1111_L3_CAR 0x1c
209#define _SADTCS _SA1111( 0x0634 ) 204#define SA1111_L3_CDR 0x20
210#define _SADTSA _SA1111( 0x0638 ) 205#define SA1111_ACCAR 0x24
211#define _SADTCA _SA1111( 0x063c ) 206#define SA1111_ACCDR 0x28
212#define _SADTSB _SA1111( 0x0640 ) 207#define SA1111_ACSAR 0x2c
213#define _SADTCB _SA1111( 0x0644 ) 208#define SA1111_ACSDR 0x30
214#define _SADRCS _SA1111( 0x0648 ) 209#define SA1111_SADTCS 0x34
215#define _SADRSA _SA1111( 0x064c ) 210#define SA1111_SADTSA 0x38
216#define _SADRCA _SA1111( 0x0650 ) 211#define SA1111_SADTCA 0x3c
217#define _SADRSB _SA1111( 0x0654 ) 212#define SA1111_SADTSB 0x40
218#define _SADRCB _SA1111( 0x0658 ) 213#define SA1111_SADTCB 0x44
219#define _SAITR _SA1111( 0x065c ) 214#define SA1111_SADRCS 0x48
220#define _SADR _SA1111( 0x0680 ) 215#define SA1111_SADRSA 0x4c
221 216#define SA1111_SADRCA 0x50
222#define SACR0 __CCREG(0x0600) 217#define SA1111_SADRSB 0x54
223#define SACR1 __CCREG(0x0604) 218#define SA1111_SADRCB 0x58
224#define SACR2 __CCREG(0x0608) 219#define SA1111_SAITR 0x5c
225#define SASR0 __CCREG(0x060c) 220#define SA1111_SADR 0x80
226#define SASR1 __CCREG(0x0610) 221
227#define SASCR __CCREG(0x0618) 222#ifndef CONFIG_ARCH_PXA
228#define L3_CAR __CCREG(0x061c)
229#define L3_CDR __CCREG(0x0620)
230#define ACCAR __CCREG(0x0624)
231#define ACCDR __CCREG(0x0628)
232#define ACSAR __CCREG(0x062c)
233#define ACSDR __CCREG(0x0630)
234#define SADTCS __CCREG(0x0634)
235#define SADTSA __CCREG(0x0638)
236#define SADTCA __CCREG(0x063c)
237#define SADTSB __CCREG(0x0640)
238#define SADTCB __CCREG(0x0644)
239#define SADRCS __CCREG(0x0648)
240#define SADRSA __CCREG(0x064c)
241#define SADRCA __CCREG(0x0650)
242#define SADRSB __CCREG(0x0654)
243#define SADRCB __CCREG(0x0658)
244#define SAITR __CCREG(0x065c)
245#define SADR __CCREG(0x0680)
246 223
247#define SACR0_ENB (1<<0) 224#define SACR0_ENB (1<<0)
248#define SACR0_BCKD (1<<2) 225#define SACR0_BCKD (1<<2)
@@ -330,6 +307,8 @@
330#define SAITR_RDBDA (1<<10) 307#define SAITR_RDBDA (1<<10)
331#define SAITR_RDBDB (1<<11) 308#define SAITR_RDBDB (1<<11)
332 309
310#endif /* !CONFIG_ARCH_PXA */
311
333/* 312/*
334 * General-Purpose I/O Interface 313 * General-Purpose I/O Interface
335 * 314 *
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 288f76b166d0..5f60b4220906 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -182,9 +182,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
182#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l)) 182#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l))
183#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l)) 183#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l))
184 184
185#define eth_io_copy_and_sum(s,c,l,b) \
186 eth_copy_and_sum((s),__mem_pci(c),(l),(b))
187
188#elif !defined(readb) 185#elif !defined(readb)
189 186
190#define readb(c) (__readwrite_bug("readb"),0) 187#define readb(c) (__readwrite_bug("readb"),0)
@@ -194,8 +191,6 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
194#define writew(v,c) __readwrite_bug("writew") 191#define writew(v,c) __readwrite_bug("writew")
195#define writel(v,c) __readwrite_bug("writel") 192#define writel(v,c) __readwrite_bug("writel")
196 193
197#define eth_io_copy_and_sum(s,c,l,b) __readwrite_bug("eth_io_copy_and_sum")
198
199#define check_signature(io,sig,len) (0) 194#define check_signature(io,sig,len) (0)
200 195
201#endif /* __mem_pci */ 196#endif /* __mem_pci */
diff --git a/include/asm-arm/kexec.h b/include/asm-arm/kexec.h
new file mode 100644
index 000000000000..8c1c6162a80c
--- /dev/null
+++ b/include/asm-arm/kexec.h
@@ -0,0 +1,30 @@
1#ifndef _ARM_KEXEC_H
2#define _ARM_KEXEC_H
3
4#ifdef CONFIG_KEXEC
5
6/* Maximum physical address we can use pages from */
7#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
8/* Maximum address we can reach in physical address mode */
9#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
10/* Maximum address we can use for the control code buffer */
11#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
12
13#define KEXEC_CONTROL_CODE_SIZE 4096
14
15#define KEXEC_ARCH KEXEC_ARCH_ARM
16
17#ifndef __ASSEMBLY__
18
19#define MAX_NOTE_BYTES 1024
20
21struct kimage;
22/* Provide a dummy definition to avoid build failures. */
23static inline void crash_setup_regs(struct pt_regs *newregs,
24 struct pt_regs *oldregs) { }
25
26#endif /* __ASSEMBLY__ */
27
28#endif /* CONFIG_KEXEC */
29
30#endif /* _ARM_KEXEC_H */
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index b8cf2d5ec304..7b2bafce21a2 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -175,19 +175,29 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
175#ifndef __ASSEMBLY__ 175#ifndef __ASSEMBLY__
176 176
177/* 177/*
178 * The following macros handle the cache and bufferable bits... 178 * The pgprot_* and protection_map entries will be fixed up in runtime
179 * to include the cachable and bufferable bits based on memory policy,
180 * as well as any architecture dependent bits like global/ASID and SMP
181 * shared mapping bits.
179 */ 182 */
180#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_CACHEABLE | L_PTE_BUFFERABLE 183#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_CACHEABLE | L_PTE_BUFFERABLE
181#define _L_PTE_READ L_PTE_USER | L_PTE_EXEC 184#define _L_PTE_READ L_PTE_USER | L_PTE_EXEC
182 185
186extern pgprot_t pgprot_user;
183extern pgprot_t pgprot_kernel; 187extern pgprot_t pgprot_kernel;
184 188
185#define PAGE_NONE __pgprot(_L_PTE_DEFAULT) 189#define PAGE_NONE pgprot_user
186#define PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) 190#define PAGE_COPY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ)
187#define PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_WRITE) 191#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ | \
188#define PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) 192 L_PTE_WRITE)
193#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ)
189#define PAGE_KERNEL pgprot_kernel 194#define PAGE_KERNEL pgprot_kernel
190 195
196#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT)
197#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ)
198#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_WRITE)
199#define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ)
200
191#endif /* __ASSEMBLY__ */ 201#endif /* __ASSEMBLY__ */
192 202
193/* 203/*
@@ -198,23 +208,23 @@ extern pgprot_t pgprot_kernel;
198 * 2) If we could do execute protection, then read is implied 208 * 2) If we could do execute protection, then read is implied
199 * 3) write implies read permissions 209 * 3) write implies read permissions
200 */ 210 */
201#define __P000 PAGE_NONE 211#define __P000 __PAGE_NONE
202#define __P001 PAGE_READONLY 212#define __P001 __PAGE_READONLY
203#define __P010 PAGE_COPY 213#define __P010 __PAGE_COPY
204#define __P011 PAGE_COPY 214#define __P011 __PAGE_COPY
205#define __P100 PAGE_READONLY 215#define __P100 __PAGE_READONLY
206#define __P101 PAGE_READONLY 216#define __P101 __PAGE_READONLY
207#define __P110 PAGE_COPY 217#define __P110 __PAGE_COPY
208#define __P111 PAGE_COPY 218#define __P111 __PAGE_COPY
209 219
210#define __S000 PAGE_NONE 220#define __S000 __PAGE_NONE
211#define __S001 PAGE_READONLY 221#define __S001 __PAGE_READONLY
212#define __S010 PAGE_SHARED 222#define __S010 __PAGE_SHARED
213#define __S011 PAGE_SHARED 223#define __S011 __PAGE_SHARED
214#define __S100 PAGE_READONLY 224#define __S100 __PAGE_READONLY
215#define __S101 PAGE_READONLY 225#define __S101 __PAGE_READONLY
216#define __S110 PAGE_SHARED 226#define __S110 __PAGE_SHARED
217#define __S111 PAGE_SHARED 227#define __S111 __PAGE_SHARED
218 228
219#ifndef __ASSEMBLY__ 229#ifndef __ASSEMBLY__
220/* 230/*
diff --git a/include/asm-arm/plat-s3c24xx/clock.h b/include/asm-arm/plat-s3c24xx/clock.h
new file mode 100644
index 000000000000..f6135dbb9fa9
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/clock.h
@@ -0,0 +1,63 @@
1/* linux/include/asm-arm/plat-s3c24xx/clock.h
2 * linux/arch/arm/mach-s3c2410/clock.h
3 *
4 * Copyright (c) 2004-2005 Simtec Electronics
5 * http://www.simtec.co.uk/products/SWLINUX/
6 * Written by Ben Dooks, <ben@simtec.co.uk>
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
13struct clk {
14 struct list_head list;
15 struct module *owner;
16 struct clk *parent;
17 const char *name;
18 int id;
19 int usage;
20 unsigned long rate;
21 unsigned long ctrlbit;
22
23 int (*enable)(struct clk *, int enable);
24 int (*set_rate)(struct clk *c, unsigned long rate);
25 unsigned long (*get_rate)(struct clk *c);
26 unsigned long (*round_rate)(struct clk *c, unsigned long rate);
27 int (*set_parent)(struct clk *c, struct clk *parent);
28};
29
30/* other clocks which may be registered by board support */
31
32extern struct clk s3c24xx_dclk0;
33extern struct clk s3c24xx_dclk1;
34extern struct clk s3c24xx_clkout0;
35extern struct clk s3c24xx_clkout1;
36extern struct clk s3c24xx_uclk;
37
38extern struct clk clk_usb_bus;
39
40/* core clock support */
41
42extern struct clk clk_f;
43extern struct clk clk_h;
44extern struct clk clk_p;
45extern struct clk clk_mpll;
46extern struct clk clk_upll;
47extern struct clk clk_xtal;
48
49/* exports for arch/arm/mach-s3c2410
50 *
51 * Please DO NOT use these outside of arch/arm/mach-s3c2410
52*/
53
54extern struct mutex clocks_mutex;
55
56extern int s3c2410_clkcon_enable(struct clk *clk, int enable);
57
58extern int s3c24xx_register_clock(struct clk *clk);
59
60extern int s3c24xx_setup_clocks(unsigned long xtal,
61 unsigned long fclk,
62 unsigned long hclk,
63 unsigned long pclk);
diff --git a/include/asm-arm/plat-s3c24xx/common-smdk.h b/include/asm-arm/plat-s3c24xx/common-smdk.h
new file mode 100644
index 000000000000..58d9094c935c
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/common-smdk.h
@@ -0,0 +1,15 @@
1/* linux/include/asm-arm/plat-s3c24xx/common-smdk.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Common code for SMDK2410 and SMDK2440 boards
7 *
8 * http://www.fluff.org/ben/smdk2440/
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
15extern void smdk_machine_init(void);
diff --git a/include/asm-arm/plat-s3c24xx/cpu.h b/include/asm-arm/plat-s3c24xx/cpu.h
new file mode 100644
index 000000000000..15dd18810905
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/cpu.h
@@ -0,0 +1,70 @@
1/* linux/include/asm-arm/plat-s3c24xx/cpu.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU support
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/* todo - fix when rmk changes iodescs to use `void __iomem *` */
14
15#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
16
17#ifndef MHZ
18#define MHZ (1000*1000)
19#endif
20
21#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000)
22
23/* forward declaration */
24struct s3c24xx_uart_resources;
25struct platform_device;
26struct s3c2410_uartcfg;
27struct map_desc;
28
29/* core initialisation functions */
30
31extern void s3c24xx_init_irq(void);
32
33extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
34
35extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
36
37extern void s3c24xx_init_clocks(int xtal);
38
39extern void s3c24xx_init_uartdevs(char *name,
40 struct s3c24xx_uart_resources *res,
41 struct s3c2410_uartcfg *cfg, int no);
42
43/* the board structure is used at first initialsation time
44 * to get info such as the devices to register for this
45 * board. This is done because platfrom_add_devices() cannot
46 * be called from the map_io entry.
47*/
48
49struct s3c24xx_board {
50 struct platform_device **devices;
51 unsigned int devices_count;
52
53 struct clk **clocks;
54 unsigned int clocks_count;
55};
56
57extern void s3c24xx_set_board(struct s3c24xx_board *board);
58
59/* timer for 2410/2440 */
60
61struct sys_timer;
62extern struct sys_timer s3c24xx_timer;
63
64/* system device classes */
65
66extern struct sysdev_class s3c2410_sysclass;
67extern struct sysdev_class s3c2412_sysclass;
68extern struct sysdev_class s3c2440_sysclass;
69extern struct sysdev_class s3c2442_sysclass;
70extern struct sysdev_class s3c2443_sysclass;
diff --git a/include/asm-arm/plat-s3c24xx/devs.h b/include/asm-arm/plat-s3c24xx/devs.h
new file mode 100644
index 000000000000..dddf485fc067
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/devs.h
@@ -0,0 +1,51 @@
1/* linux/include/asm-arm/plat-s3c24xx/devs.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2410 standard platform devices
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#include <linux/platform_device.h>
13
14struct s3c24xx_uart_resources {
15 struct resource *resources;
16 unsigned long nr_resources;
17};
18
19extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
20
21extern struct platform_device *s3c24xx_uart_devs[];
22extern struct platform_device *s3c24xx_uart_src[];
23
24extern struct platform_device s3c_device_usb;
25extern struct platform_device s3c_device_lcd;
26extern struct platform_device s3c_device_wdt;
27extern struct platform_device s3c_device_i2c;
28extern struct platform_device s3c_device_iis;
29extern struct platform_device s3c_device_rtc;
30extern struct platform_device s3c_device_adc;
31extern struct platform_device s3c_device_sdi;
32
33extern struct platform_device s3c_device_spi0;
34extern struct platform_device s3c_device_spi1;
35
36extern struct platform_device s3c_device_nand;
37
38extern struct platform_device s3c_device_timer0;
39extern struct platform_device s3c_device_timer1;
40extern struct platform_device s3c_device_timer2;
41extern struct platform_device s3c_device_timer3;
42
43extern struct platform_device s3c_device_usbgadget;
44
45/* s3c2440 specific devices */
46
47#ifdef CONFIG_CPU_S3C2440
48
49extern struct platform_device s3c_device_camif;
50
51#endif
diff --git a/include/asm-arm/plat-s3c24xx/dma.h b/include/asm-arm/plat-s3c24xx/dma.h
new file mode 100644
index 000000000000..2c59406435e5
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/dma.h
@@ -0,0 +1,77 @@
1/* linux/include/asm-arm/plat-s3c24xx/dma.h
2 *
3 * Copyright (C) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Samsung S3C24XX DMA support
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
13extern struct sysdev_class dma_sysclass;
14extern struct s3c2410_dma_chan s3c2410_chans[S3C2410_DMA_CHANNELS];
15
16#define DMA_CH_VALID (1<<31)
17#define DMA_CH_NEVER (1<<30)
18
19struct s3c24xx_dma_addr {
20 unsigned long from;
21 unsigned long to;
22};
23
24/* struct s3c24xx_dma_map
25 *
26 * this holds the mapping information for the channel selected
27 * to be connected to the specified device
28*/
29
30struct s3c24xx_dma_map {
31 const char *name;
32 struct s3c24xx_dma_addr hw_addr;
33
34 unsigned long channels[S3C2410_DMA_CHANNELS];
35};
36
37struct s3c24xx_dma_selection {
38 struct s3c24xx_dma_map *map;
39 unsigned long map_size;
40 unsigned long dcon_mask;
41
42 void (*select)(struct s3c2410_dma_chan *chan,
43 struct s3c24xx_dma_map *map);
44};
45
46extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
47
48/* struct s3c24xx_dma_order_ch
49 *
50 * channel map for one of the `enum dma_ch` dma channels. the list
51 * entry contains a set of low-level channel numbers, orred with
52 * DMA_CH_VALID, which are checked in the order in the array.
53*/
54
55struct s3c24xx_dma_order_ch {
56 unsigned int list[S3C2410_DMA_CHANNELS]; /* list of channels */
57 unsigned int flags; /* flags */
58};
59
60/* struct s3c24xx_dma_order
61 *
62 * information provided by either the core or the board to give the
63 * dma system a hint on how to allocate channels
64*/
65
66struct s3c24xx_dma_order {
67 struct s3c24xx_dma_order_ch channels[DMACH_MAX];
68};
69
70extern int s3c24xx_dma_order_set(struct s3c24xx_dma_order *map);
71
72/* DMA init code, called from the cpu support code */
73
74extern int s3c2410_dma_init(void);
75
76extern int s3c24xx_dma_init(unsigned int channels, unsigned int irq,
77 unsigned int stride);
diff --git a/include/asm-arm/plat-s3c24xx/irq.h b/include/asm-arm/plat-s3c24xx/irq.h
new file mode 100644
index 000000000000..8af6d9579b31
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/irq.h
@@ -0,0 +1,107 @@
1/* linux/include/asm-arm/plat-s3c24xx/irq.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU IRQ support
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#define irqdbf(x...)
14#define irqdbf2(x...)
15
16#define EXTINT_OFF (IRQ_EINT4 - 4)
17
18extern struct irq_chip s3c_irq_level_chip;
19
20static inline void
21s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
22 int subcheck)
23{
24 unsigned long mask;
25 unsigned long submask;
26
27 submask = __raw_readl(S3C2410_INTSUBMSK);
28 mask = __raw_readl(S3C2410_INTMSK);
29
30 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
31
32 /* check to see if we need to mask the parent IRQ */
33
34 if ((submask & subcheck) == subcheck) {
35 __raw_writel(mask | parentbit, S3C2410_INTMSK);
36 }
37
38 /* write back masks */
39 __raw_writel(submask, S3C2410_INTSUBMSK);
40
41}
42
43static inline void
44s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
45{
46 unsigned long mask;
47 unsigned long submask;
48
49 submask = __raw_readl(S3C2410_INTSUBMSK);
50 mask = __raw_readl(S3C2410_INTMSK);
51
52 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
53 mask &= ~parentbit;
54
55 /* write back masks */
56 __raw_writel(submask, S3C2410_INTSUBMSK);
57 __raw_writel(mask, S3C2410_INTMSK);
58}
59
60
61static inline void
62s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
63{
64 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
65
66 s3c_irqsub_mask(irqno, parentmask, group);
67
68 __raw_writel(bit, S3C2410_SUBSRCPND);
69
70 /* only ack parent if we've got all the irqs (seems we must
71 * ack, all and hope that the irq system retriggers ok when
72 * the interrupt goes off again)
73 */
74
75 if (1) {
76 __raw_writel(parentmask, S3C2410_SRCPND);
77 __raw_writel(parentmask, S3C2410_INTPND);
78 }
79}
80
81static inline void
82s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
83{
84 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
85
86 __raw_writel(bit, S3C2410_SUBSRCPND);
87
88 /* only ack parent if we've got all the irqs (seems we must
89 * ack, all and hope that the irq system retriggers ok when
90 * the interrupt goes off again)
91 */
92
93 if (1) {
94 __raw_writel(parentmask, S3C2410_SRCPND);
95 __raw_writel(parentmask, S3C2410_INTPND);
96 }
97}
98
99/* exported for use in arch/arm/mach-s3c2410 */
100
101#ifdef CONFIG_PM
102extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
103#else
104#define s3c_irq_wake NULL
105#endif
106
107extern int s3c_irqext_type(unsigned int irq, unsigned int type);
diff --git a/include/asm-arm/plat-s3c24xx/pm.h b/include/asm-arm/plat-s3c24xx/pm.h
new file mode 100644
index 000000000000..cc623667e48a
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/pm.h
@@ -0,0 +1,73 @@
1/* linux/include/asm-arm/plat-s3c24xx/pm.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Written by Ben Dooks, <ben@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
11/* s3c2410_pm_init
12 *
13 * called from board at initialisation time to setup the power
14 * management
15*/
16
17#ifdef CONFIG_PM
18
19extern __init int s3c2410_pm_init(void);
20
21#else
22
23static inline int s3c2410_pm_init(void)
24{
25 return 0;
26}
27#endif
28
29/* configuration for the IRQ mask over sleep */
30extern unsigned long s3c_irqwake_intmask;
31extern unsigned long s3c_irqwake_eintmask;
32
33/* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
34extern unsigned long s3c_irqwake_intallow;
35extern unsigned long s3c_irqwake_eintallow;
36
37/* per-cpu sleep functions */
38
39extern void (*pm_cpu_prep)(void);
40extern void (*pm_cpu_sleep)(void);
41
42/* Flags for PM Control */
43
44extern unsigned long s3c_pm_flags;
45
46/* from sleep.S */
47
48extern int s3c2410_cpu_save(unsigned long *saveblk);
49extern void s3c2410_cpu_suspend(void);
50extern void s3c2410_cpu_resume(void);
51
52extern unsigned long s3c2410_sleep_save_phys;
53
54/* sleep save info */
55
56struct sleep_save {
57 void __iomem *reg;
58 unsigned long val;
59};
60
61#define SAVE_ITEM(x) \
62 { .reg = (x) }
63
64extern void s3c2410_pm_do_save(struct sleep_save *ptr, int count);
65extern void s3c2410_pm_do_restore(struct sleep_save *ptr, int count);
66
67#ifdef CONFIG_PM
68extern int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state);
69extern int s3c24xx_irq_resume(struct sys_device *dev);
70#else
71#define s3c24xx_irq_suspend NULL
72#define s3c24xx_irq_resume NULL
73#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2400.h b/include/asm-arm/plat-s3c24xx/s3c2400.h
new file mode 100644
index 000000000000..3a5a16821af8
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2400.h
@@ -0,0 +1,31 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2400.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C2400 cpu support
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 * Modifications:
13 * 09-Fev-2006 LCVR First version, based on s3c2410.h
14*/
15
16#ifdef CONFIG_CPU_S3C2400
17
18extern int s3c2400_init(void);
19
20extern void s3c2400_map_io(struct map_desc *mach_desc, int size);
21
22extern void s3c2400_init_uarts(struct s3c2410_uartcfg *cfg, int no);
23
24extern void s3c2400_init_clocks(int xtal);
25
26#else
27#define s3c2400_init_clocks NULL
28#define s3c2400_init_uarts NULL
29#define s3c2400_map_io NULL
30#define s3c2400_init NULL
31#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2410.h b/include/asm-arm/plat-s3c24xx/s3c2410.h
new file mode 100644
index 000000000000..36de0b835873
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2410.h
@@ -0,0 +1,31 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2410.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2410 machine directory
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#ifdef CONFIG_CPU_S3C2410
15
16extern int s3c2410_init(void);
17
18extern void s3c2410_map_io(struct map_desc *mach_desc, int size);
19
20extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
21
22extern void s3c2410_init_clocks(int xtal);
23
24extern int s3c2410_baseclk_add(void);
25
26#else
27#define s3c2410_init_clocks NULL
28#define s3c2410_init_uarts NULL
29#define s3c2410_map_io NULL
30#define s3c2410_init NULL
31#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2412.h b/include/asm-arm/plat-s3c24xx/s3c2412.h
new file mode 100644
index 000000000000..3ec97685e781
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2412.h
@@ -0,0 +1,29 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2412.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2412 cpu support
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#ifdef CONFIG_CPU_S3C2412
14
15extern int s3c2412_init(void);
16
17extern void s3c2412_map_io(struct map_desc *mach_desc, int size);
18
19extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
20
21extern void s3c2412_init_clocks(int xtal);
22
23extern int s3c2412_baseclk_add(void);
24#else
25#define s3c2412_init_clocks NULL
26#define s3c2412_init_uarts NULL
27#define s3c2412_map_io NULL
28#define s3c2412_init NULL
29#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2440.h b/include/asm-arm/plat-s3c24xx/s3c2440.h
new file mode 100644
index 000000000000..107853bf9481
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2440.h
@@ -0,0 +1,17 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2440.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2440 cpu support
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#ifdef CONFIG_CPU_S3C2440
14extern int s3c2440_init(void);
15#else
16#define s3c2440_init NULL
17#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2442.h b/include/asm-arm/plat-s3c24xx/s3c2442.h
new file mode 100644
index 000000000000..451a23a2092a
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2442.h
@@ -0,0 +1,17 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2442.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2442 cpu support
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#ifdef CONFIG_CPU_S3C2442
14extern int s3c2442_init(void);
15#else
16#define s3c2442_init NULL
17#endif
diff --git a/include/asm-arm/plat-s3c24xx/s3c2443.h b/include/asm-arm/plat-s3c24xx/s3c2443.h
new file mode 100644
index 000000000000..11d83b5c84e6
--- /dev/null
+++ b/include/asm-arm/plat-s3c24xx/s3c2443.h
@@ -0,0 +1,32 @@
1/* linux/include/asm-arm/plat-s3c24xx/s3c2443.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for s3c2443 cpu support
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#ifdef CONFIG_CPU_S3C2443
14
15struct s3c2410_uartcfg;
16
17extern int s3c2443_init(void);
18
19extern void s3c2443_map_io(struct map_desc *mach_desc, int size);
20
21extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22
23extern void s3c2443_init_clocks(int xtal);
24
25extern int s3c2443_baseclk_add(void);
26
27#else
28#define s3c2443_init_clocks NULL
29#define s3c2443_init_uarts NULL
30#define s3c2443_map_io NULL
31#define s3c2443_init NULL
32#endif
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 19f7df702b06..65a1a64bf934 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/sockios.h b/include/asm-arm/sockios.h
index 77c34087d513..a2588a2512df 100644
--- a/include/asm-arm/sockios.h
+++ b/include/asm-arm/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 861092fbaa53..800ba5254daf 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -85,7 +85,6 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
85 * Write locks are easy - we just set bit 31. When unlocking, we can 85 * Write locks are easy - we just set bit 31. When unlocking, we can
86 * just write zero since the lock is exclusively held. 86 * just write zero since the lock is exclusively held.
87 */ 87 */
88#define rwlock_is_locked(x) (*((volatile unsigned int *)(x)) != 0)
89 88
90static inline void __raw_write_lock(raw_rwlock_t *rw) 89static inline void __raw_write_lock(raw_rwlock_t *rw)
91{ 90{
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index aa223fc546af..69134c7518c1 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/memory.h>
6 7
7#define CPU_ARCH_UNKNOWN 0 8#define CPU_ARCH_UNKNOWN 0
8#define CPU_ARCH_ARMv3 1 9#define CPU_ARCH_ARMv3 1
@@ -140,6 +141,55 @@ static inline int cpu_is_xsc3(void)
140#define cpu_is_xscale() 1 141#define cpu_is_xscale() 1
141#endif 142#endif
142 143
144#define UDBG_UNDEFINED (1 << 0)
145#define UDBG_SYSCALL (1 << 1)
146#define UDBG_BADABORT (1 << 2)
147#define UDBG_SEGV (1 << 3)
148#define UDBG_BUS (1 << 4)
149
150extern unsigned int user_debug;
151
152#if __LINUX_ARM_ARCH__ >= 4
153#define vectors_high() (cr_alignment & CR_V)
154#else
155#define vectors_high() (0)
156#endif
157
158#if defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ >= 6
159#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
160 : : "r" (0) : "memory")
161#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
162 : : "r" (0) : "memory")
163#define dmb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
164 : : "r" (0) : "memory")
165#else
166#define isb() __asm__ __volatile__ ("" : : : "memory")
167#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
168 : : "r" (0) : "memory")
169#define dmb() __asm__ __volatile__ ("" : : : "memory")
170#endif
171
172#ifndef CONFIG_SMP
173#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
174#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
175#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
176#define smp_mb() barrier()
177#define smp_rmb() barrier()
178#define smp_wmb() barrier()
179#else
180#define mb() dmb()
181#define rmb() dmb()
182#define wmb() dmb()
183#define smp_mb() dmb()
184#define smp_rmb() dmb()
185#define smp_wmb() dmb()
186#endif
187#define read_barrier_depends() do { } while(0)
188#define smp_read_barrier_depends() do { } while(0)
189
190#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
191#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
192
143extern unsigned long cr_no_alignment; /* defined in entry-armv.S */ 193extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
144extern unsigned long cr_alignment; /* defined in entry-armv.S */ 194extern unsigned long cr_alignment; /* defined in entry-armv.S */
145 195
@@ -154,6 +204,7 @@ static inline void set_cr(unsigned int val)
154{ 204{
155 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR" 205 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
156 : : "r" (val) : "cc"); 206 : : "r" (val) : "cc");
207 isb();
157} 208}
158 209
159#ifndef CONFIG_SMP 210#ifndef CONFIG_SMP
@@ -176,34 +227,9 @@ static inline void set_copro_access(unsigned int val)
176{ 227{
177 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access" 228 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
178 : : "r" (val) : "cc"); 229 : : "r" (val) : "cc");
230 isb();
179} 231}
180 232
181#define UDBG_UNDEFINED (1 << 0)
182#define UDBG_SYSCALL (1 << 1)
183#define UDBG_BADABORT (1 << 2)
184#define UDBG_SEGV (1 << 3)
185#define UDBG_BUS (1 << 4)
186
187extern unsigned int user_debug;
188
189#if __LINUX_ARM_ARCH__ >= 4
190#define vectors_high() (cr_alignment & CR_V)
191#else
192#define vectors_high() (0)
193#endif
194
195#if __LINUX_ARM_ARCH__ >= 6
196#define mb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
197 : : "r" (0) : "memory")
198#else
199#define mb() __asm__ __volatile__ ("" : : : "memory")
200#endif
201#define rmb() mb()
202#define wmb() mb()
203#define read_barrier_depends() do { } while(0)
204#define set_mb(var, value) do { var = value; mb(); } while (0)
205#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
206
207/* 233/*
208 * switch_mm() may do a full cache flush over the context switch, 234 * switch_mm() may do a full cache flush over the context switch,
209 * so enable interrupts over the context switch to avoid high 235 * so enable interrupts over the context switch to avoid high
@@ -233,22 +259,6 @@ static inline void sched_cacheflush(void)
233{ 259{
234} 260}
235 261
236#ifdef CONFIG_SMP
237
238#define smp_mb() mb()
239#define smp_rmb() rmb()
240#define smp_wmb() wmb()
241#define smp_read_barrier_depends() read_barrier_depends()
242
243#else
244
245#define smp_mb() barrier()
246#define smp_rmb() barrier()
247#define smp_wmb() barrier()
248#define smp_read_barrier_depends() do { } while(0)
249
250#endif /* CONFIG_SMP */
251
252#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) 262#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
253/* 263/*
254 * On the StrongARM, "swp" is terminally broken since it bypasses the 264 * On the StrongARM, "swp" is terminally broken since it bypasses the
diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h
index 7b8f5e8ae063..329c324c4040 100644
--- a/include/asm-arm/termios.h
+++ b/include/asm-arm/termios.h
@@ -49,24 +49,6 @@ struct termio {
49 49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51 51
52/* line disciplines */
53#define N_TTY 0
54#define N_SLIP 1
55#define N_MOUSE 2
56#define N_PPP 3
57#define N_STRIP 4
58#define N_AX25 5
59#define N_X25 6 /* X.25 async */
60#define N_6PACK 7
61#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
62#define N_R3964 9 /* Reserved for Simatic R3964 module */
63#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
64#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
65#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
66#define N_HDLC 13 /* synchronous HDLC */
67#define N_SYNC_PPP 14
68#define N_HCI 15 /* Bluetooth HCI UART */
69
70#ifdef __KERNEL__ 52#ifdef __KERNEL__
71 53
72/* 54/*
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index cd10a0b5f8ae..08c6991dc9c9 100644
--- a/include/asm-arm/tlbflush.h
+++ b/include/asm-arm/tlbflush.h
@@ -247,7 +247,7 @@ 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) : "cc"); 250 dsb();
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) : "cc"); 253 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc");
@@ -257,6 +257,15 @@ static inline void local_flush_tlb_all(void)
257 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); 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) : "cc"); 259 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
260
261 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
262 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
263 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
264 /* flush the branch target cache */
265 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
266 dsb();
267 isb();
268 }
260} 269}
261 270
262static inline void local_flush_tlb_mm(struct mm_struct *mm) 271static inline void local_flush_tlb_mm(struct mm_struct *mm)
@@ -266,7 +275,7 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
266 const unsigned int __tlb_flag = __cpu_tlb_flags; 275 const unsigned int __tlb_flag = __cpu_tlb_flags;
267 276
268 if (tlb_flag(TLB_WB)) 277 if (tlb_flag(TLB_WB))
269 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc"); 278 dsb();
270 279
271 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) { 280 if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) {
272 if (tlb_flag(TLB_V3_FULL)) 281 if (tlb_flag(TLB_V3_FULL))
@@ -285,6 +294,14 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
285 asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc"); 294 asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc");
286 if (tlb_flag(TLB_V6_I_ASID)) 295 if (tlb_flag(TLB_V6_I_ASID))
287 asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc"); 296 asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
297
298 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
299 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
300 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
301 /* flush the branch target cache */
302 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
303 dsb();
304 }
288} 305}
289 306
290static inline void 307static inline void
@@ -296,7 +313,7 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
296 uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm); 313 uaddr = (uaddr & PAGE_MASK) | ASID(vma->vm_mm);
297 314
298 if (tlb_flag(TLB_WB)) 315 if (tlb_flag(TLB_WB))
299 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero)); 316 dsb();
300 317
301 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) { 318 if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
302 if (tlb_flag(TLB_V3_PAGE)) 319 if (tlb_flag(TLB_V3_PAGE))
@@ -317,6 +334,14 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
317 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc"); 334 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
318 if (tlb_flag(TLB_V6_I_PAGE)) 335 if (tlb_flag(TLB_V6_I_PAGE))
319 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc"); 336 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
337
338 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
339 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
340 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
341 /* flush the branch target cache */
342 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
343 dsb();
344 }
320} 345}
321 346
322static inline void local_flush_tlb_kernel_page(unsigned long kaddr) 347static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
@@ -327,7 +352,7 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
327 kaddr &= PAGE_MASK; 352 kaddr &= PAGE_MASK;
328 353
329 if (tlb_flag(TLB_WB)) 354 if (tlb_flag(TLB_WB))
330 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc"); 355 dsb();
331 356
332 if (tlb_flag(TLB_V3_PAGE)) 357 if (tlb_flag(TLB_V3_PAGE))
333 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc"); 358 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc");
@@ -347,11 +372,14 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
347 if (tlb_flag(TLB_V6_I_PAGE)) 372 if (tlb_flag(TLB_V6_I_PAGE))
348 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc"); 373 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
349 374
350 /* The ARM ARM states that the completion of a TLB maintenance 375 if (tlb_flag(TLB_V6_I_FULL | TLB_V6_D_FULL |
351 * operation is only guaranteed by a DSB instruction 376 TLB_V6_I_PAGE | TLB_V6_D_PAGE |
352 */ 377 TLB_V6_I_ASID | TLB_V6_D_ASID)) {
353 if (tlb_flag(TLB_V6_U_PAGE | TLB_V6_D_PAGE | TLB_V6_I_PAGE)) 378 /* flush the branch target cache */
354 asm("mcr p15, 0, %0, c7, c10, 4" : : "r" (zero) : "cc"); 379 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero) : "cc");
380 dsb();
381 isb();
382 }
355} 383}
356 384
357/* 385/*
@@ -369,15 +397,13 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
369 */ 397 */
370static inline void flush_pmd_entry(pmd_t *pmd) 398static inline void flush_pmd_entry(pmd_t *pmd)
371{ 399{
372 const unsigned int zero = 0;
373 const unsigned int __tlb_flag = __cpu_tlb_flags; 400 const unsigned int __tlb_flag = __cpu_tlb_flags;
374 401
375 if (tlb_flag(TLB_DCLEAN)) 402 if (tlb_flag(TLB_DCLEAN))
376 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" 403 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd"
377 : : "r" (pmd) : "cc"); 404 : : "r" (pmd) : "cc");
378 if (tlb_flag(TLB_WB)) 405 if (tlb_flag(TLB_WB))
379 asm("mcr p15, 0, %0, c7, c10, 4 @ flush_pmd" 406 dsb();
380 : : "r" (zero) : "cc");
381} 407}
382 408
383static inline void clean_pmd_entry(pmd_t *pmd) 409static inline void clean_pmd_entry(pmd_t *pmd)
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index 5f420a0149f1..4c1a3fa9f259 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -76,10 +76,10 @@ static inline void set_fs(mm_segment_t fs)
76 76
77/* We use 33-bit arithmetic here... */ 77/* We use 33-bit arithmetic here... */
78#define __range_ok(addr,size) ({ \ 78#define __range_ok(addr,size) ({ \
79 unsigned long flag, sum; \ 79 unsigned long flag, roksum; \
80 __chk_user_ptr(addr); \ 80 __chk_user_ptr(addr); \
81 __asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \ 81 __asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \
82 : "=&r" (flag), "=&r" (sum) \ 82 : "=&r" (flag), "=&r" (roksum) \
83 : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \ 83 : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
84 : "cc"); \ 84 : "cc"); \
85 flag; }) 85 flag; })
@@ -109,7 +109,7 @@ extern int __get_user_4(void *);
109 109
110#define get_user(x,p) \ 110#define get_user(x,p) \
111 ({ \ 111 ({ \
112 const register typeof(*(p)) __user *__p asm("r0") = (p);\ 112 register const typeof(*(p)) __user *__p asm("r0") = (p);\
113 register unsigned long __r2 asm("r2"); \ 113 register unsigned long __r2 asm("r2"); \
114 register int __e asm("r0"); \ 114 register int __e asm("r0"); \
115 switch (sizeof(*(__p))) { \ 115 switch (sizeof(*(__p))) { \
@@ -143,8 +143,8 @@ extern int __put_user_8(void *, unsigned long long);
143 143
144#define put_user(x,p) \ 144#define put_user(x,p) \
145 ({ \ 145 ({ \
146 const register typeof(*(p)) __r2 asm("r2") = (x); \ 146 register const typeof(*(p)) __r2 asm("r2") = (x); \
147 const register typeof(*(p)) __user *__p asm("r0") = (p);\ 147 register const typeof(*(p)) __user *__p asm("r0") = (p);\
148 register int __e asm("r0"); \ 148 register int __e asm("r0"); \
149 switch (sizeof(*(__p))) { \ 149 switch (sizeof(*(__p))) { \
150 case 1: \ 150 case 1: \
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 97e7060000cf..c025ab47e4b9 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -372,6 +372,7 @@
372#define __NR_move_pages (__NR_SYSCALL_BASE+344) 372#define __NR_move_pages (__NR_SYSCALL_BASE+344)
373#define __NR_getcpu (__NR_SYSCALL_BASE+345) 373#define __NR_getcpu (__NR_SYSCALL_BASE+345)
374 /* 346 for epoll_pwait */ 374 /* 346 for epoll_pwait */
375#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
375 376
376/* 377/*
377 * The following SWIs are ARM private. 378 * The following SWIs are ARM private.
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
index 19f7df702b06..65a1a64bf934 100644
--- a/include/asm-arm26/socket.h
+++ b/include/asm-arm26/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm26/sockios.h b/include/asm-arm26/sockios.h
index 77c34087d513..a2588a2512df 100644
--- a/include/asm-arm26/sockios.h
+++ b/include/asm-arm26/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-arm26/termios.h b/include/asm-arm26/termios.h
index 7b8f5e8ae063..329c324c4040 100644
--- a/include/asm-arm26/termios.h
+++ b/include/asm-arm26/termios.h
@@ -49,24 +49,6 @@ struct termio {
49 49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51 51
52/* line disciplines */
53#define N_TTY 0
54#define N_SLIP 1
55#define N_MOUSE 2
56#define N_PPP 3
57#define N_STRIP 4
58#define N_AX25 5
59#define N_X25 6 /* X.25 async */
60#define N_6PACK 7
61#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
62#define N_R3964 9 /* Reserved for Simatic R3964 module */
63#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
64#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
65#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
66#define N_HDLC 13 /* synchronous HDLC */
67#define N_SYNC_PPP 14
68#define N_HCI 15 /* Bluetooth HCI UART */
69
70#ifdef __KERNEL__ 52#ifdef __KERNEL__
71 53
72/* 54/*
diff --git a/include/asm-arm26/uaccess-asm.h b/include/asm-arm26/uaccess-asm.h
index 19f798e338c9..ade76ec02995 100644
--- a/include/asm-arm26/uaccess-asm.h
+++ b/include/asm-arm26/uaccess-asm.h
@@ -34,9 +34,9 @@ static inline void set_fs (mm_segment_t fs)
34} 34}
35 35
36#define __range_ok(addr,size) ({ \ 36#define __range_ok(addr,size) ({ \
37 unsigned long flag, sum; \ 37 unsigned long flag, roksum; \
38 __asm__ __volatile__("subs %1, %0, %3; cmpcs %1, %2; movcs %0, #0" \ 38 __asm__ __volatile__("subs %1, %0, %3; cmpcs %1, %2; movcs %0, #0" \
39 : "=&r" (flag), "=&r" (sum) \ 39 : "=&r" (flag), "=&r" (roksum) \
40 : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \ 40 : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
41 : "cc"); \ 41 : "cc"); \
42 flag; }) 42 flag; })
diff --git a/include/asm-arm26/uaccess.h b/include/asm-arm26/uaccess.h
index 3f2dd1093e58..d64ed84cb2d3 100644
--- a/include/asm-arm26/uaccess.h
+++ b/include/asm-arm26/uaccess.h
@@ -74,7 +74,7 @@ extern int __get_user_bad(void);
74 74
75#define get_user(x,p) \ 75#define get_user(x,p) \
76 ({ \ 76 ({ \
77 const register typeof(*(p)) *__p asm("r0") = (p); \ 77 register const typeof(*(p)) *__p asm("r0") = (p); \
78 register typeof(*(p)) __r1 asm("r1"); \ 78 register typeof(*(p)) __r1 asm("r1"); \
79 register int __e asm("r0"); \ 79 register int __e asm("r0"); \
80 switch (sizeof(*(p))) { \ 80 switch (sizeof(*(p))) { \
@@ -139,8 +139,8 @@ extern int __put_user_bad(void);
139 139
140#define put_user(x,p) \ 140#define put_user(x,p) \
141 ({ \ 141 ({ \
142 const register typeof(*(p)) __r1 asm("r1") = (x); \ 142 register const typeof(*(p)) __r1 asm("r1") = (x); \
143 const register typeof(*(p)) *__p asm("r0") = (p); \ 143 register const typeof(*(p)) *__p asm("r0") = (p); \
144 register int __e asm("r0"); \ 144 register int __e asm("r0"); \
145 switch (sizeof(*(__p))) { \ 145 switch (sizeof(*(__p))) { \
146 case 1: \ 146 case 1: \
@@ -170,8 +170,8 @@ extern int __put_user_bad(void);
170 170
171#define put_user(x,p) \ 171#define put_user(x,p) \
172 ({ \ 172 ({ \
173 const register typeof(*(p)) __r1 asm("r1") = (x); \ 173 register const typeof(*(p)) __r1 asm("r1") = (x); \
174 const register typeof(*(p)) *__p asm("r0") = (p); \ 174 register const typeof(*(p)) *__p asm("r0") = (p); \
175 register int __e asm("r0"); \ 175 register int __e asm("r0"); \
176 switch (sizeof(*(p))) { \ 176 switch (sizeof(*(p))) { \
177 case 1: \ 177 case 1: \
diff --git a/include/asm-avr32/Kbuild b/include/asm-avr32/Kbuild
index 8770e73ce938..3136628ba8d2 100644
--- a/include/asm-avr32/Kbuild
+++ b/include/asm-avr32/Kbuild
@@ -1,3 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3headers-y += cachectl.h 3header-y += cachectl.h
diff --git a/include/asm-avr32/arch-at32ap/at32ap7000.h b/include/asm-avr32/arch-at32ap/at32ap7000.h
index ba85e04553d4..3914d7b94ff4 100644
--- a/include/asm-avr32/arch-at32ap/at32ap7000.h
+++ b/include/asm-avr32/arch-at32ap/at32ap7000.h
@@ -24,10 +24,12 @@
24#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) 24#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32)
25#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) 25#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32)
26#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) 26#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32)
27#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32)
27 28
28#define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N)) 29#define GPIO_PIN_PA(N) (GPIO_PIOA_BASE + (N))
29#define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N)) 30#define GPIO_PIN_PB(N) (GPIO_PIOB_BASE + (N))
30#define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N)) 31#define GPIO_PIN_PC(N) (GPIO_PIOC_BASE + (N))
31#define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N)) 32#define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N))
33#define GPIO_PIN_PE(N) (GPIO_PIOE_BASE + (N))
32 34
33#endif /* __ASM_ARCH_AT32AP7000_H__ */ 35#endif /* __ASM_ARCH_AT32AP7000_H__ */
diff --git a/include/asm-avr32/arch-at32ap/at91_pdc.h b/include/asm-avr32/arch-at32ap/at91_pdc.h
deleted file mode 100644
index 79d6e02fa45e..000000000000
--- a/include/asm-avr32/arch-at32ap/at91_pdc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * include/asm-arm/arch-at91rm9200/at91_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 AT91_PDC_H
17#define AT91_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/board.h b/include/asm-avr32/arch-at32ap/board.h
index b120ee030c86..1a7b07d436ff 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -26,7 +26,9 @@ struct eth_platform_data {
26struct platform_device * 26struct platform_device *
27at32_add_device_eth(unsigned int id, struct eth_platform_data *data); 27at32_add_device_eth(unsigned int id, struct eth_platform_data *data);
28 28
29struct platform_device *at32_add_device_spi(unsigned int id); 29struct spi_board_info;
30struct platform_device *
31at32_add_device_spi(unsigned int id, struct spi_board_info *b, unsigned int n);
30 32
31struct lcdc_platform_data { 33struct lcdc_platform_data {
32 unsigned long fbmem_start; 34 unsigned long fbmem_start;
diff --git a/include/asm-avr32/arch-at32ap/gpio.h b/include/asm-avr32/arch-at32ap/gpio.h
new file mode 100644
index 000000000000..80a21aa9ae77
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/gpio.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_AVR32_ARCH_GPIO_H
2#define __ASM_AVR32_ARCH_GPIO_H
3
4#include <linux/compiler.h>
5#include <asm/irq.h>
6
7
8/* Arch-neutral GPIO API */
9int __must_check gpio_request(unsigned int gpio, const char *label);
10void gpio_free(unsigned int gpio);
11
12int gpio_direction_input(unsigned int gpio);
13int gpio_direction_output(unsigned int gpio, int value);
14int gpio_get_value(unsigned int gpio);
15void gpio_set_value(unsigned int gpio, int value);
16
17static inline int gpio_to_irq(unsigned int gpio)
18{
19 return gpio + GPIO_IRQ_BASE;
20}
21
22static inline int irq_to_gpio(unsigned int irq)
23{
24 return irq - GPIO_IRQ_BASE;
25}
26
27#endif /* __ASM_AVR32_ARCH_GPIO_H */
diff --git a/include/asm-avr32/arch-at32ap/io.h b/include/asm-avr32/arch-at32ap/io.h
new file mode 100644
index 000000000000..ee59e401f041
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/io.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_AVR32_ARCH_AT32AP_IO_H
2#define __ASM_AVR32_ARCH_AT32AP_IO_H
3
4/* For "bizarre" halfword swapping */
5#include <linux/byteorder/swabb.h>
6
7#if defined(CONFIG_AP7000_32_BIT_SMC)
8# define __swizzle_addr_b(addr) (addr ^ 3UL)
9# define __swizzle_addr_w(addr) (addr ^ 2UL)
10# define __swizzle_addr_l(addr) (addr)
11# define ioswabb(a, x) (x)
12# define ioswabw(a, x) (x)
13# define ioswabl(a, x) (x)
14# define __mem_ioswabb(a, x) (x)
15# define __mem_ioswabw(a, x) swab16(x)
16# define __mem_ioswabl(a, x) swab32(x)
17#elif defined(CONFIG_AP7000_16_BIT_SMC)
18# define __swizzle_addr_b(addr) (addr ^ 1UL)
19# define __swizzle_addr_w(addr) (addr)
20# define __swizzle_addr_l(addr) (addr)
21# define ioswabb(a, x) (x)
22# define ioswabw(a, x) (x)
23# define ioswabl(a, x) swahw32(x)
24# define __mem_ioswabb(a, x) (x)
25# define __mem_ioswabw(a, x) swab16(x)
26# define __mem_ioswabl(a, x) swahb32(x)
27#else
28# define __swizzle_addr_b(addr) (addr)
29# define __swizzle_addr_w(addr) (addr)
30# define __swizzle_addr_l(addr) (addr)
31# define ioswabb(a, x) (x)
32# define ioswabw(a, x) swab16(x)
33# define ioswabl(a, x) swab32(x)
34# define __mem_ioswabb(a, x) (x)
35# define __mem_ioswabw(a, x) (x)
36# define __mem_ioswabl(a, x) (x)
37#endif
38
39#endif /* __ASM_AVR32_ARCH_AT32AP_IO_H */
diff --git a/include/asm-avr32/arch-at32ap/irq.h b/include/asm-avr32/arch-at32ap/irq.h
new file mode 100644
index 000000000000..5adffab9a577
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/irq.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_AVR32_ARCH_IRQ_H
2#define __ASM_AVR32_ARCH_IRQ_H
3
4#define EIM_IRQ_BASE NR_INTERNAL_IRQS
5#define NR_EIM_IRQS 32
6
7#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n))
8
9#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS)
10#define NR_GPIO_IRQS (5 * 32)
11
12#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS)
13
14#endif /* __ASM_AVR32_ARCH_IRQ_H */
diff --git a/include/asm-avr32/arch-at32ap/portmux.h b/include/asm-avr32/arch-at32ap/portmux.h
index 83c690571322..9930871decde 100644
--- a/include/asm-avr32/arch-at32ap/portmux.h
+++ b/include/asm-avr32/arch-at32ap/portmux.h
@@ -15,12 +15,14 @@
15 * 15 *
16 * The following flags determine the initial state of the pin. 16 * The following flags determine the initial state of the pin.
17 */ 17 */
18#define AT32_GPIOF_PULLUP 0x00000001 /* Enable pull-up */ 18#define AT32_GPIOF_PULLUP 0x00000001 /* (not-OUT) Enable pull-up */
19#define AT32_GPIOF_OUTPUT 0x00000002 /* Enable output driver */ 19#define AT32_GPIOF_OUTPUT 0x00000002 /* (OUT) Enable output driver */
20#define AT32_GPIOF_HIGH 0x00000004 /* Set output high */ 20#define AT32_GPIOF_HIGH 0x00000004 /* (OUT) Set output high */
21#define AT32_GPIOF_DEGLITCH 0x00000008 /* (IN) Filter glitches */
21 22
22void at32_select_periph(unsigned int pin, unsigned int periph, 23void at32_select_periph(unsigned int pin, unsigned int periph,
23 unsigned long flags); 24 unsigned long flags);
24void at32_select_gpio(unsigned int pin, unsigned long flags); 25void at32_select_gpio(unsigned int pin, unsigned long flags);
26void at32_reserve_pin(unsigned int pin);
25 27
26#endif /* __ASM_ARCH_PORTMUX_H__ */ 28#endif /* __ASM_ARCH_PORTMUX_H__ */
diff --git a/include/asm-avr32/arch-at32ap/smc.h b/include/asm-avr32/arch-at32ap/smc.h
index 3732b328303d..07152b7fd9c9 100644
--- a/include/asm-avr32/arch-at32ap/smc.h
+++ b/include/asm-avr32/arch-at32ap/smc.h
@@ -48,10 +48,32 @@ struct smc_config {
48 unsigned int nwe_controlled:1; 48 unsigned int nwe_controlled:1;
49 49
50 /* 50 /*
51 * 0: NWAIT is disabled
52 * 1: Reserved
53 * 2: NWAIT is frozen mode
54 * 3: NWAIT in ready mode
55 */
56 unsigned int nwait_mode:2;
57
58 /*
51 * 0: Byte select access type 59 * 0: Byte select access type
52 * 1: Byte write access type 60 * 1: Byte write access type
53 */ 61 */
54 unsigned int byte_write:1; 62 unsigned int byte_write:1;
63
64 /*
65 * Number of clock cycles before data is released after
66 * the rising edge of the read controlling signal
67 *
68 * Total cycles from SMC is tdf_cycles + 1
69 */
70 unsigned int tdf_cycles:4;
71
72 /*
73 * 0: TDF optimization disabled
74 * 1: TDF optimization enabled
75 */
76 unsigned int tdf_mode:1;
55}; 77};
56 78
57extern int smc_set_configuration(int cs, const struct smc_config *config); 79extern int smc_set_configuration(int cs, const struct smc_config *config);
diff --git a/include/asm-avr32/arch-at32ap/time.h b/include/asm-avr32/arch-at32ap/time.h
new file mode 100644
index 000000000000..cc8a43418a4d
--- /dev/null
+++ b/include/asm-avr32/arch-at32ap/time.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_AVR32_ARCH_AT32AP_TIME_H
10#define _ASM_AVR32_ARCH_AT32AP_TIME_H
11
12#include <linux/platform_device.h>
13
14extern struct irqaction timer_irqaction;
15extern struct platform_device at32_systc0_device;
16extern void local_timer_interrupt(int irq, void *dev_id);
17
18#define TIMER_BCR 0x000000c0
19#define TIMER_BCR_SYNC 0
20#define TIMER_BMR 0x000000c4
21#define TIMER_BMR_TC0XC0S 0
22#define TIMER_BMR_TC1XC1S 2
23#define TIMER_BMR_TC2XC2S 4
24#define TIMER_CCR 0x00000000
25#define TIMER_CCR_CLKDIS 1
26#define TIMER_CCR_CLKEN 0
27#define TIMER_CCR_SWTRG 2
28#define TIMER_CMR 0x00000004
29#define TIMER_CMR_ABETRG 10
30#define TIMER_CMR_ACPA 16
31#define TIMER_CMR_ACPC 18
32#define TIMER_CMR_AEEVT 20
33#define TIMER_CMR_ASWTRG 22
34#define TIMER_CMR_BCPB 24
35#define TIMER_CMR_BCPC 26
36#define TIMER_CMR_BEEVT 28
37#define TIMER_CMR_BSWTRG 30
38#define TIMER_CMR_BURST 4
39#define TIMER_CMR_CLKI 3
40#define TIMER_CMR_CPCDIS 7
41#define TIMER_CMR_CPCSTOP 6
42#define TIMER_CMR_CPCTRG 14
43#define TIMER_CMR_EEVT 10
44#define TIMER_CMR_EEVTEDG 8
45#define TIMER_CMR_ENETRG 12
46#define TIMER_CMR_ETRGEDG 8
47#define TIMER_CMR_LDBDIS 7
48#define TIMER_CMR_LDBSTOP 6
49#define TIMER_CMR_LDRA 16
50#define TIMER_CMR_LDRB 18
51#define TIMER_CMR_TCCLKS 0
52#define TIMER_CMR_WAVE 15
53#define TIMER_CMR_WAVSEL 13
54#define TIMER_CV 0x00000010
55#define TIMER_CV_CV 0
56#define TIMER_IDR 0x00000028
57#define TIMER_IDR_COVFS 0
58#define TIMER_IDR_CPAS 2
59#define TIMER_IDR_CPBS 3
60#define TIMER_IDR_CPCS 4
61#define TIMER_IDR_ETRGS 7
62#define TIMER_IDR_LDRAS 5
63#define TIMER_IDR_LDRBS 6
64#define TIMER_IDR_LOVRS 1
65#define TIMER_IER 0x00000024
66#define TIMER_IER_COVFS 0
67#define TIMER_IER_CPAS 2
68#define TIMER_IER_CPBS 3
69#define TIMER_IER_CPCS 4
70#define TIMER_IER_ETRGS 7
71#define TIMER_IER_LDRAS 5
72#define TIMER_IER_LDRBS 6
73#define TIMER_IER_LOVRS 1
74#define TIMER_IMR 0x0000002c
75#define TIMER_IMR_COVFS 0
76#define TIMER_IMR_CPAS 2
77#define TIMER_IMR_CPBS 3
78#define TIMER_IMR_CPCS 4
79#define TIMER_IMR_ETRGS 7
80#define TIMER_IMR_LDRAS 5
81#define TIMER_IMR_LDRBS 6
82#define TIMER_IMR_LOVRS 1
83#define TIMER_RA 0x00000014
84#define TIMER_RA_RA 0
85#define TIMER_RB 0x00000018
86#define TIMER_RB_RB 0
87#define TIMER_RC 0x0000001c
88#define TIMER_RC_RC 0
89#define TIMER_SR 0x00000020
90#define TIMER_SR_CLKSTA 16
91#define TIMER_SR_COVFS 0
92#define TIMER_SR_CPAS 2
93#define TIMER_SR_CPBS 3
94#define TIMER_SR_CPCS 4
95#define TIMER_SR_ETRGS 7
96#define TIMER_SR_LDRAS 5
97#define TIMER_SR_LDRBS 6
98#define TIMER_SR_LOVRS 1
99#define TIMER_SR_MTIOA 17
100#define TIMER_SR_MTIOB 18
101
102/* Bit manipulation macros */
103#define TIMER_BIT(name) (1 << TIMER_##name)
104#define TIMER_BF(name,value) ((value) << TIMER_##name)
105
106/* Register access macros */
107#define timer_read(port,instance,reg) \
108 __raw_readl(port + (0x40 * instance) + TIMER_##reg)
109#define timer_write(port,instance,reg,value) \
110 __raw_writel((value), port + (0x40 * instance) + TIMER_##reg)
111
112#endif /* _ASM_AVR32_ARCH_AT32AP_TIME_H */
diff --git a/include/asm-avr32/atomic.h b/include/asm-avr32/atomic.h
index c40b6032c480..b9c2548a52f3 100644
--- a/include/asm-avr32/atomic.h
+++ b/include/asm-avr32/atomic.h
@@ -173,7 +173,7 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
173} 173}
174 174
175#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 175#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
176#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 176#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
177 177
178#define atomic_sub(i, v) (void)atomic_sub_return(i, v) 178#define atomic_sub(i, v) (void)atomic_sub_return(i, v)
179#define atomic_add(i, v) (void)atomic_add_return(i, v) 179#define atomic_add(i, v) (void)atomic_add_return(i, v)
diff --git a/include/asm-avr32/bug.h b/include/asm-avr32/bug.h
index 521766bc9366..afdcd79a2966 100644
--- a/include/asm-avr32/bug.h
+++ b/include/asm-avr32/bug.h
@@ -18,27 +18,53 @@
18 18
19#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
20 20
21#define BUG() \ 21#define _BUG_OR_WARN(flags) \
22 do { \ 22 asm volatile( \
23 asm volatile(".hword %0\n\t" \ 23 "1: .hword %0\n" \
24 ".hword %1\n\t" \ 24 " .section __bug_table,\"a\",@progbits\n" \
25 ".long %2" \ 25 "2: .long 1b\n" \
26 : \ 26 " .long %1\n" \
27 : "n"(AVR32_BUG_OPCODE), \ 27 " .short %2\n" \
28 "i"(__LINE__), "X"(__FILE__)); \ 28 " .short %3\n" \
29 } while (0) 29 " .org 2b + %4\n" \
30 " .previous" \
31 : \
32 : "i"(AVR32_BUG_OPCODE), "i"(__FILE__), \
33 "i"(__LINE__), "i"(flags), \
34 "i"(sizeof(struct bug_entry)))
30 35
31#else 36#else
32 37
38#define _BUG_OR_WARN(flags) \
39 asm volatile( \
40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \
42 "2: .long 1b\n" \
43 " .short %1\n" \
44 " .org 2b + %2\n" \
45 " .previous" \
46 : \
47 : "i"(AVR32_BUG_OPCODE), "i"(flags), \
48 "i"(sizeof(struct bug_entry)))
49
50#endif /* CONFIG_DEBUG_BUGVERBOSE */
51
33#define BUG() \ 52#define BUG() \
34 do { \ 53 do { \
35 asm volatile(".hword %0\n\t" \ 54 _BUG_OR_WARN(0); \
36 : : "n"(AVR32_BUG_OPCODE)); \ 55 for (;;); \
37 } while (0) 56 } while (0)
38 57
39#endif /* CONFIG_DEBUG_BUGVERBOSE */ 58#define WARN_ON(condition) \
59 ({ \
60 typeof(condition) __ret_warn_on = (condition); \
61 if (unlikely(__ret_warn_on)) \
62 _BUG_OR_WARN(BUGFLAG_WARNING); \
63 unlikely(__ret_warn_on); \
64 })
40 65
41#define HAVE_ARCH_BUG 66#define HAVE_ARCH_BUG
67#define HAVE_ARCH_WARN_ON
42 68
43#endif /* CONFIG_BUG */ 69#endif /* CONFIG_BUG */
44 70
diff --git a/include/asm-avr32/checksum.h b/include/asm-avr32/checksum.h
index af9d53f0f5d2..4ddbfd2486af 100644
--- a/include/asm-avr32/checksum.h
+++ b/include/asm-avr32/checksum.h
@@ -38,7 +38,7 @@ __wsum csum_partial_copy_generic(const void *src, void *dst, int len,
38 * passed in an incorrect kernel address to one of these functions. 38 * passed in an incorrect kernel address to one of these functions.
39 * 39 *
40 * If you use these functions directly please don't forget the 40 * If you use these functions directly please don't forget the
41 * verify_area(). 41 * access_ok().
42 */ 42 */
43static inline 43static inline
44__wsum csum_partial_copy_nocheck(const void *src, void *dst, 44__wsum csum_partial_copy_nocheck(const void *src, void *dst,
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 5c01e27f0b41..21bb60bbb9a1 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -32,6 +32,14 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
32 return 0; 32 return 0;
33} 33}
34 34
35/*
36 * dma_map_single can't fail as it is implemented now.
37 */
38static inline int dma_mapping_error(dma_addr_t addr)
39{
40 return 0;
41}
42
35/** 43/**
36 * dma_alloc_coherent - allocate consistent memory for DMA 44 * dma_alloc_coherent - allocate consistent memory for DMA
37 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 45 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
@@ -266,6 +274,24 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
266 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction); 274 dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
267} 275}
268 276
277static inline void
278dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
279 unsigned long offset, size_t size,
280 enum dma_data_direction direction)
281{
282 /* just sync everything, that's all the pci API can do */
283 dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
284}
285
286static inline void
287dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
288 unsigned long offset, size_t size,
289 enum dma_data_direction direction)
290{
291 /* just sync everything, that's all the pci API can do */
292 dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
293}
294
269/** 295/**
270 * dma_sync_sg_for_cpu 296 * dma_sync_sg_for_cpu
271 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices 297 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
diff --git a/include/asm-avr32/gpio.h b/include/asm-avr32/gpio.h
new file mode 100644
index 000000000000..19e8ccc77db3
--- /dev/null
+++ b/include/asm-avr32/gpio.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_AVR32_GPIO_H
2#define __ASM_AVR32_GPIO_H
3
4#include <asm/arch/gpio.h>
5
6#endif /* __ASM_AVR32_GPIO_H */
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index eec47500fa66..e30d4b3bd836 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -1,13 +1,15 @@
1#ifndef __ASM_AVR32_IO_H 1#ifndef __ASM_AVR32_IO_H
2#define __ASM_AVR32_IO_H 2#define __ASM_AVR32_IO_H
3 3
4#include <linux/kernel.h>
4#include <linux/string.h> 5#include <linux/string.h>
5 6#include <linux/types.h>
6#ifdef __KERNEL__
7 7
8#include <asm/addrspace.h> 8#include <asm/addrspace.h>
9#include <asm/byteorder.h> 9#include <asm/byteorder.h>
10 10
11#include <asm/arch/io.h>
12
11/* virt_to_phys will only work when address is in P1 or P2 */ 13/* virt_to_phys will only work when address is in P1 or P2 */
12static __inline__ unsigned long virt_to_phys(volatile void *address) 14static __inline__ unsigned long virt_to_phys(volatile void *address)
13{ 15{
@@ -28,112 +30,223 @@ static __inline__ void * phys_to_virt(unsigned long address)
28 * Generic IO read/write. These perform native-endian accesses. Note 30 * Generic IO read/write. These perform native-endian accesses. Note
29 * that some architectures will want to re-define __raw_{read,write}w. 31 * that some architectures will want to re-define __raw_{read,write}w.
30 */ 32 */
31extern void __raw_writesb(unsigned int addr, const void *data, int bytelen); 33extern void __raw_writesb(void __iomem *addr, const void *data, int bytelen);
32extern void __raw_writesw(unsigned int addr, const void *data, int wordlen); 34extern void __raw_writesw(void __iomem *addr, const void *data, int wordlen);
33extern void __raw_writesl(unsigned int addr, const void *data, int longlen); 35extern void __raw_writesl(void __iomem *addr, const void *data, int longlen);
34 36
35extern void __raw_readsb(unsigned int addr, void *data, int bytelen); 37extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
36extern void __raw_readsw(unsigned int addr, void *data, int wordlen); 38extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
37extern void __raw_readsl(unsigned int addr, void *data, int longlen); 39extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
38 40
39static inline void writeb(unsigned char b, volatile void __iomem *addr) 41static inline void __raw_writeb(u8 v, volatile void __iomem *addr)
40{ 42{
41 *(volatile unsigned char __force *)addr = b; 43 *(volatile u8 __force *)addr = v;
42} 44}
43static inline void writew(unsigned short b, volatile void __iomem *addr) 45static inline void __raw_writew(u16 v, volatile void __iomem *addr)
44{ 46{
45 *(volatile unsigned short __force *)addr = b; 47 *(volatile u16 __force *)addr = v;
46} 48}
47static inline void writel(unsigned int b, volatile void __iomem *addr) 49static inline void __raw_writel(u32 v, volatile void __iomem *addr)
48{ 50{
49 *(volatile unsigned int __force *)addr = b; 51 *(volatile u32 __force *)addr = v;
50} 52}
51#define __raw_writeb writeb
52#define __raw_writew writew
53#define __raw_writel writel
54 53
55static inline unsigned char readb(const volatile void __iomem *addr) 54static inline u8 __raw_readb(const volatile void __iomem *addr)
56{ 55{
57 return *(const volatile unsigned char __force *)addr; 56 return *(const volatile u8 __force *)addr;
58} 57}
59static inline unsigned short readw(const volatile void __iomem *addr) 58static inline u16 __raw_readw(const volatile void __iomem *addr)
60{ 59{
61 return *(const volatile unsigned short __force *)addr; 60 return *(const volatile u16 __force *)addr;
62} 61}
63static inline unsigned int readl(const volatile void __iomem *addr) 62static inline u32 __raw_readl(const volatile void __iomem *addr)
64{ 63{
65 return *(const volatile unsigned int __force *)addr; 64 return *(const volatile u32 __force *)addr;
65}
66
67/* Convert I/O port address to virtual address */
68#ifndef __io
69# define __io(p) ((void *)phys_to_uncached(p))
70#endif
71
72/*
73 * Not really sure about the best way to slow down I/O on
74 * AVR32. Defining it as a no-op until we have an actual test case.
75 */
76#define SLOW_DOWN_IO do { } while (0)
77
78#define __BUILD_MEMORY_SINGLE(pfx, bwl, type) \
79static inline void \
80pfx##write##bwl(type val, volatile void __iomem *addr) \
81{ \
82 volatile type *__addr; \
83 type __val; \
84 \
85 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
86 __val = pfx##ioswab##bwl(__addr, val); \
87 \
88 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
89 \
90 *__addr = __val; \
91} \
92 \
93static inline type pfx##read##bwl(const volatile void __iomem *addr) \
94{ \
95 volatile type *__addr; \
96 type __val; \
97 \
98 __addr = (void *)__swizzle_addr_##bwl((unsigned long)(addr)); \
99 \
100 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
101 \
102 __val = *__addr; \
103 return pfx##ioswab##bwl(__addr, __val); \
104}
105
106#define __BUILD_IOPORT_SINGLE(pfx, bwl, type, p, slow) \
107static inline void pfx##out##bwl##p(type val, unsigned long port) \
108{ \
109 volatile type *__addr; \
110 type __val; \
111 \
112 __addr = __io(__swizzle_addr_##bwl(port)); \
113 __val = pfx##ioswab##bwl(__addr, val); \
114 \
115 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
116 \
117 *__addr = __val; \
118 slow; \
119} \
120 \
121static inline type pfx##in##bwl##p(unsigned long port) \
122{ \
123 volatile type *__addr; \
124 type __val; \
125 \
126 __addr = __io(__swizzle_addr_##bwl(port)); \
127 \
128 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
129 \
130 __val = *__addr; \
131 slow; \
132 \
133 return pfx##ioswab##bwl(__addr, __val); \
66} 134}
67#define __raw_readb readb
68#define __raw_readw readw
69#define __raw_readl readl
70 135
71#define writesb(p, d, l) __raw_writesb((unsigned int)p, d, l) 136#define __BUILD_MEMORY_PFX(bus, bwl, type) \
72#define writesw(p, d, l) __raw_writesw((unsigned int)p, d, l) 137 __BUILD_MEMORY_SINGLE(bus, bwl, type)
73#define writesl(p, d, l) __raw_writesl((unsigned int)p, d, l) 138
139#define BUILDIO_MEM(bwl, type) \
140 __BUILD_MEMORY_PFX(, bwl, type) \
141 __BUILD_MEMORY_PFX(__mem_, bwl, type)
142
143#define __BUILD_IOPORT_PFX(bus, bwl, type) \
144 __BUILD_IOPORT_SINGLE(bus, bwl, type, ,) \
145 __BUILD_IOPORT_SINGLE(bus, bwl, type, _p, SLOW_DOWN_IO)
146
147#define BUILDIO_IOPORT(bwl, type) \
148 __BUILD_IOPORT_PFX(, bwl, type) \
149 __BUILD_IOPORT_PFX(__mem_, bwl, type)
150
151BUILDIO_MEM(b, u8)
152BUILDIO_MEM(w, u16)
153BUILDIO_MEM(l, u32)
154
155BUILDIO_IOPORT(b, u8)
156BUILDIO_IOPORT(w, u16)
157BUILDIO_IOPORT(l, u32)
158
159#define readb_relaxed readb
160#define readw_relaxed readw
161#define readl_relaxed readl
162
163#define __BUILD_MEMORY_STRING(bwl, type) \
164static inline void writes##bwl(volatile void __iomem *addr, \
165 const void *data, unsigned int count) \
166{ \
167 const type *__data = data; \
168 \
169 while (count--) \
170 __mem_write##bwl(*__data++, addr); \
171} \
172 \
173static inline void reads##bwl(const volatile void __iomem *addr, \
174 void *data, unsigned int count) \
175{ \
176 type *__data = data; \
177 \
178 while (count--) \
179 *__data++ = __mem_read##bwl(addr); \
180}
181
182#define __BUILD_IOPORT_STRING(bwl, type) \
183static inline void outs##bwl(unsigned long port, const void *data, \
184 unsigned int count) \
185{ \
186 const type *__data = data; \
187 \
188 while (count--) \
189 __mem_out##bwl(*__data++, port); \
190} \
191 \
192static inline void ins##bwl(unsigned long port, void *data, \
193 unsigned int count) \
194{ \
195 type *__data = data; \
196 \
197 while (count--) \
198 *__data++ = __mem_in##bwl(port); \
199}
74 200
75#define readsb(p, d, l) __raw_readsb((unsigned int)p, d, l) 201#define BUILDSTRING(bwl, type) \
76#define readsw(p, d, l) __raw_readsw((unsigned int)p, d, l) 202 __BUILD_MEMORY_STRING(bwl, type) \
77#define readsl(p, d, l) __raw_readsl((unsigned int)p, d, l) 203 __BUILD_IOPORT_STRING(bwl, type)
78 204
205BUILDSTRING(b, u8)
206BUILDSTRING(w, u16)
207BUILDSTRING(l, u32)
79 208
80/* 209/*
81 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be 210 * io{read,write}{8,16,32} macros in both le (for PCI style consumers) and native be
82 */ 211 */
83#ifndef ioread8 212#ifndef ioread8
84 213
85#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) 214#define ioread8(p) ((unsigned int)readb(p))
86 215
87#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) 216#define ioread16(p) ((unsigned int)readw(p))
88#define ioread16be(p) ({ unsigned int __v = be16_to_cpu(__raw_readw(p)); __v; }) 217#define ioread16be(p) ((unsigned int)__raw_readw(p))
89 218
90#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) 219#define ioread32(p) ((unsigned int)readl(p))
91#define ioread32be(p) ({ unsigned int __v = be32_to_cpu(__raw_readl(p)); __v; }) 220#define ioread32be(p) ((unsigned int)__raw_readl(p))
92 221
93#define iowrite8(v,p) __raw_writeb(v, p) 222#define iowrite8(v,p) writeb(v, p)
94 223
95#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) 224#define iowrite16(v,p) writew(v, p)
96#define iowrite16be(v,p) __raw_writew(cpu_to_be16(v), p) 225#define iowrite16be(v,p) __raw_writew(v, p)
97 226
98#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) 227#define iowrite32(v,p) writel(v, p)
99#define iowrite32be(v,p) __raw_writel(cpu_to_be32(v), p) 228#define iowrite32be(v,p) __raw_writel(v, p)
100 229
101#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 230#define ioread8_rep(p,d,c) readsb(p,d,c)
102#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 231#define ioread16_rep(p,d,c) readsw(p,d,c)
103#define ioread32_rep(p,d,c) __raw_readsl(p,d,c) 232#define ioread32_rep(p,d,c) readsl(p,d,c)
104 233
105#define iowrite8_rep(p,s,c) __raw_writesb(p,s,c) 234#define iowrite8_rep(p,s,c) writesb(p,s,c)
106#define iowrite16_rep(p,s,c) __raw_writesw(p,s,c) 235#define iowrite16_rep(p,s,c) writesw(p,s,c)
107#define iowrite32_rep(p,s,c) __raw_writesl(p,s,c) 236#define iowrite32_rep(p,s,c) writesl(p,s,c)
108 237
109#endif 238#endif
110 239
111
112/*
113 * These two are only here because ALSA _thinks_ it needs them...
114 */
115static inline void memcpy_fromio(void * to, const volatile void __iomem *from, 240static inline void memcpy_fromio(void * to, const volatile void __iomem *from,
116 unsigned long count) 241 unsigned long count)
117{ 242{
118 char *p = to; 243 memcpy(to, (const void __force *)from, count);
119 while (count) {
120 count--;
121 *p = readb(from);
122 p++;
123 from++;
124 }
125} 244}
126 245
127static inline void memcpy_toio(volatile void __iomem *to, const void * from, 246static inline void memcpy_toio(volatile void __iomem *to, const void * from,
128 unsigned long count) 247 unsigned long count)
129{ 248{
130 const char *p = from; 249 memcpy((void __force *)to, from, count);
131 while (count) {
132 count--;
133 writeb(*p, to);
134 p++;
135 to++;
136 }
137} 250}
138 251
139static inline void memset_io(volatile void __iomem *addr, unsigned char val, 252static inline void memset_io(volatile void __iomem *addr, unsigned char val,
@@ -142,99 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val,
142 memset((void __force *)addr, val, count); 255 memset((void __force *)addr, val, count);
143} 256}
144 257
145/*
146 * Bad read/write accesses...
147 */
148extern void __readwrite_bug(const char *fn);
149
150#define IO_SPACE_LIMIT 0xffffffff 258#define IO_SPACE_LIMIT 0xffffffff
151 259
152/* Convert I/O port address to virtual address */
153#define __io(p) ((void __iomem *)phys_to_uncached(p))
154
155/*
156 * IO port access primitives
157 * -------------------------
158 *
159 * The AVR32 doesn't have special IO access instructions; all IO is memory
160 * mapped. Note that these are defined to perform little endian accesses
161 * only. Their primary purpose is to access PCI and ISA peripherals.
162 *
163 * Note that for a big endian machine, this implies that the following
164 * big endian mode connectivity is in place.
165 *
166 * The machine specific io.h include defines __io to translate an "IO"
167 * address to a memory address.
168 *
169 * Note that we prevent GCC re-ordering or caching values in expressions
170 * by introducing sequence points into the in*() definitions. Note that
171 * __raw_* do not guarantee this behaviour.
172 *
173 * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
174 */
175#define outb(v, p) __raw_writeb(v, __io(p))
176#define outw(v, p) __raw_writew(cpu_to_le16(v), __io(p))
177#define outl(v, p) __raw_writel(cpu_to_le32(v), __io(p))
178
179#define inb(p) __raw_readb(__io(p))
180#define inw(p) le16_to_cpu(__raw_readw(__io(p)))
181#define inl(p) le32_to_cpu(__raw_readl(__io(p)))
182
183static inline void __outsb(unsigned long port, void *addr, unsigned int count)
184{
185 while (count--) {
186 outb(*(u8 *)addr, port);
187 addr++;
188 }
189}
190
191static inline void __insb(unsigned long port, void *addr, unsigned int count)
192{
193 while (count--) {
194 *(u8 *)addr = inb(port);
195 addr++;
196 }
197}
198
199static inline void __outsw(unsigned long port, void *addr, unsigned int count)
200{
201 while (count--) {
202 outw(*(u16 *)addr, port);
203 addr += 2;
204 }
205}
206
207static inline void __insw(unsigned long port, void *addr, unsigned int count)
208{
209 while (count--) {
210 *(u16 *)addr = inw(port);
211 addr += 2;
212 }
213}
214
215static inline void __outsl(unsigned long port, void *addr, unsigned int count)
216{
217 while (count--) {
218 outl(*(u32 *)addr, port);
219 addr += 4;
220 }
221}
222
223static inline void __insl(unsigned long port, void *addr, unsigned int count)
224{
225 while (count--) {
226 *(u32 *)addr = inl(port);
227 addr += 4;
228 }
229}
230
231#define outsb(port, addr, count) __outsb(port, addr, count)
232#define insb(port, addr, count) __insb(port, addr, count)
233#define outsw(port, addr, count) __outsw(port, addr, count)
234#define insw(port, addr, count) __insw(port, addr, count)
235#define outsl(port, addr, count) __outsl(port, addr, count)
236#define insl(port, addr, count) __insl(port, addr, count)
237
238extern void __iomem *__ioremap(unsigned long offset, size_t size, 260extern void __iomem *__ioremap(unsigned long offset, size_t size,
239 unsigned long flags); 261 unsigned long flags);
240extern void __iounmap(void __iomem *addr); 262extern void __iounmap(void __iomem *addr);
@@ -252,6 +274,9 @@ extern void __iounmap(void __iomem *addr);
252#define ioremap(offset, size) \ 274#define ioremap(offset, size) \
253 __ioremap((offset), (size), 0) 275 __ioremap((offset), (size), 0)
254 276
277#define ioremap_nocache(offset, size) \
278 __ioremap((offset), (size), 0)
279
255#define iounmap(addr) \ 280#define iounmap(addr) \
256 __iounmap(addr) 281 __iounmap(addr)
257 282
@@ -263,6 +288,14 @@ extern void __iounmap(void __iomem *addr);
263#define page_to_bus page_to_phys 288#define page_to_bus page_to_phys
264#define bus_to_page phys_to_page 289#define bus_to_page phys_to_page
265 290
291/*
292 * Create a virtual mapping cookie for an IO port range. There exists
293 * no such thing as port-based I/O on AVR32, so a regular ioremap()
294 * should do what we need.
295 */
296#define ioport_map(port, nr) ioremap(port, nr)
297#define ioport_unmap(port) iounmap(port)
298
266#define dma_cache_wback_inv(_start, _size) \ 299#define dma_cache_wback_inv(_start, _size) \
267 flush_dcache_region(_start, _size) 300 flush_dcache_region(_start, _size)
268#define dma_cache_inv(_start, _size) \ 301#define dma_cache_inv(_start, _size) \
@@ -281,6 +314,4 @@ extern void __iounmap(void __iomem *addr);
281 */ 314 */
282#define xlate_dev_kmem_ptr(p) p 315#define xlate_dev_kmem_ptr(p) p
283 316
284#endif /* __KERNEL__ */
285
286#endif /* __ASM_AVR32_IO_H */ 317#endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-avr32/irq.h b/include/asm-avr32/irq.h
index f7e725707dd7..83e6549d7783 100644
--- a/include/asm-avr32/irq.h
+++ b/include/asm-avr32/irq.h
@@ -2,8 +2,12 @@
2#define __ASM_AVR32_IRQ_H 2#define __ASM_AVR32_IRQ_H
3 3
4#define NR_INTERNAL_IRQS 64 4#define NR_INTERNAL_IRQS 64
5#define NR_EXTERNAL_IRQS 64 5
6#define NR_IRQS (NR_INTERNAL_IRQS + NR_EXTERNAL_IRQS) 6#include <asm/arch/irq.h>
7
8#ifndef NR_IRQS
9#define NR_IRQS (NR_INTERNAL_IRQS)
10#endif
7 11
8#define irq_canonicalize(i) (i) 12#define irq_canonicalize(i) (i)
9 13
diff --git a/include/asm-avr32/posix_types.h b/include/asm-avr32/posix_types.h
index 2831b039b349..9e255b999639 100644
--- a/include/asm-avr32/posix_types.h
+++ b/include/asm-avr32/posix_types.h
@@ -23,7 +23,7 @@ typedef unsigned short __kernel_ipc_pid_t;
23typedef unsigned int __kernel_uid_t; 23typedef unsigned int __kernel_uid_t;
24typedef unsigned int __kernel_gid_t; 24typedef unsigned int __kernel_gid_t;
25typedef unsigned long __kernel_size_t; 25typedef unsigned long __kernel_size_t;
26typedef int __kernel_ssize_t; 26typedef long __kernel_ssize_t;
27typedef int __kernel_ptrdiff_t; 27typedef int __kernel_ptrdiff_t;
28typedef long __kernel_time_t; 28typedef long __kernel_time_t;
29typedef long __kernel_suseconds_t; 29typedef long __kernel_suseconds_t;
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h
index f6913778a45f..6a64833756a6 100644
--- a/include/asm-avr32/processor.h
+++ b/include/asm-avr32/processor.h
@@ -40,6 +40,14 @@ enum tlb_config {
40 TLB_INVALID 40 TLB_INVALID
41}; 41};
42 42
43#define AVR32_FEATURE_RMW (1 << 0)
44#define AVR32_FEATURE_DSP (1 << 1)
45#define AVR32_FEATURE_SIMD (1 << 2)
46#define AVR32_FEATURE_OCD (1 << 3)
47#define AVR32_FEATURE_PCTR (1 << 4)
48#define AVR32_FEATURE_JAVA (1 << 5)
49#define AVR32_FEATURE_FPU (1 << 6)
50
43struct avr32_cpuinfo { 51struct avr32_cpuinfo {
44 struct clk *clk; 52 struct clk *clk;
45 unsigned long loops_per_jiffy; 53 unsigned long loops_per_jiffy;
@@ -48,6 +56,7 @@ struct avr32_cpuinfo {
48 unsigned short arch_revision; 56 unsigned short arch_revision;
49 unsigned short cpu_revision; 57 unsigned short cpu_revision;
50 enum tlb_config tlb_config; 58 enum tlb_config tlb_config;
59 unsigned long features;
51 60
52 struct cache_info icache; 61 struct cache_info icache;
53 struct cache_info dcache; 62 struct cache_info dcache;
@@ -125,10 +134,10 @@ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
125#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) 134#define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc)
126 135
127struct pt_regs; 136struct pt_regs;
128void show_trace(struct task_struct *task, unsigned long *stack,
129 struct pt_regs *regs);
130
131extern unsigned long get_wchan(struct task_struct *p); 137extern unsigned long get_wchan(struct task_struct *p);
138extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl);
139extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp,
140 struct pt_regs *regs, const char *log_lvl);
132 141
133#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) 142#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
134#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) 143#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
diff --git a/include/asm-avr32/setup.h b/include/asm-avr32/setup.h
index 0a5224245e44..1ff1a217015d 100644
--- a/include/asm-avr32/setup.h
+++ b/include/asm-avr32/setup.h
@@ -124,19 +124,12 @@ struct tagtable {
124#define for_each_tag(t,base) \ 124#define for_each_tag(t,base) \
125 for (t = base; t->hdr.size; t = tag_next(t)) 125 for (t = base; t->hdr.size; t = tag_next(t))
126 126
127extern struct tag_mem_range *mem_phys;
128extern struct tag_mem_range *mem_reserved;
129extern struct tag_mem_range *mem_ramdisk;
130
131extern struct tag *bootloader_tags; 127extern struct tag *bootloader_tags;
132 128
133extern void setup_bootmem(void); 129extern resource_size_t fbmem_start;
134extern void setup_processor(void); 130extern resource_size_t fbmem_size;
135extern void board_setup_fbmem(unsigned long fbmem_start,
136 unsigned long fbmem_size);
137 131
138/* Chip-specific hook to enable the use of SDRAM */ 132void setup_processor(void);
139void chip_enable_sdram(void);
140 133
141#endif /* !__ASSEMBLY__ */ 134#endif /* !__ASSEMBLY__ */
142 135
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index 543229de8173..a0d0507a5034 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_AVR32_SOCKET_H */ 55#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-avr32/sockios.h b/include/asm-avr32/sockios.h
index 84f3d65b3b3b..0802d742f97d 100644
--- a/include/asm-avr32/sockios.h
+++ b/include/asm-avr32/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ASM_AVR32_SOCKIOS_H */ 13#endif /* __ASM_AVR32_SOCKIOS_H */
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index f91975f330f6..c02bc8304b13 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -7,326 +7,281 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#ifndef __ASM_AVR32_SYSREG_H__ 10#ifndef __ASM_AVR32_SYSREG_H
11#define __ASM_AVR32_SYSREG_H__ 11#define __ASM_AVR32_SYSREG_H
12 12
13/* sysreg register offsets */ 13/* sysreg register offsets */
14#define SYSREG_SR 0x0000 14#define SYSREG_SR 0x0000
15#define SYSREG_EVBA 0x0004 15#define SYSREG_EVBA 0x0004
16#define SYSREG_ACBA 0x0008 16#define SYSREG_ACBA 0x0008
17#define SYSREG_CPUCR 0x000c 17#define SYSREG_CPUCR 0x000c
18#define SYSREG_ECR 0x0010 18#define SYSREG_ECR 0x0010
19#define SYSREG_RSR_SUP 0x0014 19#define SYSREG_RSR_SUP 0x0014
20#define SYSREG_RSR_INT0 0x0018 20#define SYSREG_RSR_INT0 0x0018
21#define SYSREG_RSR_INT1 0x001c 21#define SYSREG_RSR_INT1 0x001c
22#define SYSREG_RSR_INT2 0x0020 22#define SYSREG_RSR_INT2 0x0020
23#define SYSREG_RSR_INT3 0x0024 23#define SYSREG_RSR_INT3 0x0024
24#define SYSREG_RSR_EX 0x0028 24#define SYSREG_RSR_EX 0x0028
25#define SYSREG_RSR_NMI 0x002c 25#define SYSREG_RSR_NMI 0x002c
26#define SYSREG_RSR_DBG 0x0030 26#define SYSREG_RSR_DBG 0x0030
27#define SYSREG_RAR_SUP 0x0034 27#define SYSREG_RAR_SUP 0x0034
28#define SYSREG_RAR_INT0 0x0038 28#define SYSREG_RAR_INT0 0x0038
29#define SYSREG_RAR_INT1 0x003c 29#define SYSREG_RAR_INT1 0x003c
30#define SYSREG_RAR_INT2 0x0040 30#define SYSREG_RAR_INT2 0x0040
31#define SYSREG_RAR_INT3 0x0044 31#define SYSREG_RAR_INT3 0x0044
32#define SYSREG_RAR_EX 0x0048 32#define SYSREG_RAR_EX 0x0048
33#define SYSREG_RAR_NMI 0x004c 33#define SYSREG_RAR_NMI 0x004c
34#define SYSREG_RAR_DBG 0x0050 34#define SYSREG_RAR_DBG 0x0050
35#define SYSREG_JECR 0x0054 35#define SYSREG_JECR 0x0054
36#define SYSREG_JOSP 0x0058 36#define SYSREG_JOSP 0x0058
37#define SYSREG_JAVA_LV0 0x005c 37#define SYSREG_JAVA_LV0 0x005c
38#define SYSREG_JAVA_LV1 0x0060 38#define SYSREG_JAVA_LV1 0x0060
39#define SYSREG_JAVA_LV2 0x0064 39#define SYSREG_JAVA_LV2 0x0064
40#define SYSREG_JAVA_LV3 0x0068 40#define SYSREG_JAVA_LV3 0x0068
41#define SYSREG_JAVA_LV4 0x006c 41#define SYSREG_JAVA_LV4 0x006c
42#define SYSREG_JAVA_LV5 0x0070 42#define SYSREG_JAVA_LV5 0x0070
43#define SYSREG_JAVA_LV6 0x0074 43#define SYSREG_JAVA_LV6 0x0074
44#define SYSREG_JAVA_LV7 0x0078 44#define SYSREG_JAVA_LV7 0x0078
45#define SYSREG_JTBA 0x007c 45#define SYSREG_JTBA 0x007c
46#define SYSREG_JBCR 0x0080 46#define SYSREG_JBCR 0x0080
47#define SYSREG_CONFIG0 0x0100 47#define SYSREG_CONFIG0 0x0100
48#define SYSREG_CONFIG1 0x0104 48#define SYSREG_CONFIG1 0x0104
49#define SYSREG_COUNT 0x0108 49#define SYSREG_COUNT 0x0108
50#define SYSREG_COMPARE 0x010c 50#define SYSREG_COMPARE 0x010c
51#define SYSREG_TLBEHI 0x0110 51#define SYSREG_TLBEHI 0x0110
52#define SYSREG_TLBELO 0x0114 52#define SYSREG_TLBELO 0x0114
53#define SYSREG_PTBR 0x0118 53#define SYSREG_PTBR 0x0118
54#define SYSREG_TLBEAR 0x011c 54#define SYSREG_TLBEAR 0x011c
55#define SYSREG_MMUCR 0x0120 55#define SYSREG_MMUCR 0x0120
56#define SYSREG_TLBARLO 0x0124 56#define SYSREG_TLBARLO 0x0124
57#define SYSREG_TLBARHI 0x0128 57#define SYSREG_TLBARHI 0x0128
58#define SYSREG_PCCNT 0x012c 58#define SYSREG_PCCNT 0x012c
59#define SYSREG_PCNT0 0x0130 59#define SYSREG_PCNT0 0x0130
60#define SYSREG_PCNT1 0x0134 60#define SYSREG_PCNT1 0x0134
61#define SYSREG_PCCR 0x0138 61#define SYSREG_PCCR 0x0138
62#define SYSREG_BEAR 0x013c 62#define SYSREG_BEAR 0x013c
63#define SYSREG_SABAL 0x0300
64#define SYSREG_SABAH 0x0304
65#define SYSREG_SABD 0x0308
63 66
64/* Bitfields in SR */ 67/* Bitfields in SR */
65#define SYSREG_SR_C_OFFSET 0 68#define SYSREG_SR_C_OFFSET 0
66#define SYSREG_SR_C_SIZE 1 69#define SYSREG_SR_C_SIZE 1
67#define SYSREG_Z_OFFSET 1 70#define SYSREG_Z_OFFSET 1
68#define SYSREG_Z_SIZE 1 71#define SYSREG_Z_SIZE 1
69#define SYSREG_SR_N_OFFSET 2 72#define SYSREG_SR_N_OFFSET 2
70#define SYSREG_SR_N_SIZE 1 73#define SYSREG_SR_N_SIZE 1
71#define SYSREG_SR_V_OFFSET 3 74#define SYSREG_SR_V_OFFSET 3
72#define SYSREG_SR_V_SIZE 1 75#define SYSREG_SR_V_SIZE 1
73#define SYSREG_Q_OFFSET 4 76#define SYSREG_Q_OFFSET 4
74#define SYSREG_Q_SIZE 1 77#define SYSREG_Q_SIZE 1
75#define SYSREG_GM_OFFSET 16 78#define SYSREG_L_OFFSET 5
76#define SYSREG_GM_SIZE 1 79#define SYSREG_L_SIZE 1
77#define SYSREG_I0M_OFFSET 17 80#define SYSREG_T_OFFSET 14
78#define SYSREG_I0M_SIZE 1 81#define SYSREG_T_SIZE 1
79#define SYSREG_I1M_OFFSET 18 82#define SYSREG_SR_R_OFFSET 15
80#define SYSREG_I1M_SIZE 1 83#define SYSREG_SR_R_SIZE 1
81#define SYSREG_I2M_OFFSET 19 84#define SYSREG_GM_OFFSET 16
82#define SYSREG_I2M_SIZE 1 85#define SYSREG_GM_SIZE 1
83#define SYSREG_I3M_OFFSET 20 86#define SYSREG_I0M_OFFSET 17
84#define SYSREG_I3M_SIZE 1 87#define SYSREG_I0M_SIZE 1
85#define SYSREG_EM_OFFSET 21 88#define SYSREG_I1M_OFFSET 18
86#define SYSREG_EM_SIZE 1 89#define SYSREG_I1M_SIZE 1
87#define SYSREG_M0_OFFSET 22 90#define SYSREG_I2M_OFFSET 19
88#define SYSREG_M0_SIZE 1 91#define SYSREG_I2M_SIZE 1
89#define SYSREG_M1_OFFSET 23 92#define SYSREG_I3M_OFFSET 20
90#define SYSREG_M1_SIZE 1 93#define SYSREG_I3M_SIZE 1
91#define SYSREG_M2_OFFSET 24 94#define SYSREG_EM_OFFSET 21
92#define SYSREG_M2_SIZE 1 95#define SYSREG_EM_SIZE 1
93#define SYSREG_SR_D_OFFSET 26 96#define SYSREG_M0_OFFSET 22
94#define SYSREG_SR_D_SIZE 1 97#define SYSREG_M0_SIZE 1
95#define SYSREG_DM_OFFSET 27 98#define SYSREG_M1_OFFSET 23
96#define SYSREG_DM_SIZE 1 99#define SYSREG_M1_SIZE 1
97#define SYSREG_SR_J_OFFSET 28 100#define SYSREG_M2_OFFSET 24
98#define SYSREG_SR_J_SIZE 1 101#define SYSREG_M2_SIZE 1
99#define SYSREG_R_OFFSET 29 102#define SYSREG_SR_D_OFFSET 26
100#define SYSREG_R_SIZE 1 103#define SYSREG_SR_D_SIZE 1
101#define SYSREG_H_OFFSET 30 104#define SYSREG_DM_OFFSET 27
102#define SYSREG_H_SIZE 1 105#define SYSREG_DM_SIZE 1
103 106#define SYSREG_SR_J_OFFSET 28
104/* Bitfields in EVBA */ 107#define SYSREG_SR_J_SIZE 1
105 108#define SYSREG_H_OFFSET 29
106/* Bitfields in ACBA */ 109#define SYSREG_H_SIZE 1
107 110
108/* Bitfields in CPUCR */ 111/* Bitfields in CPUCR */
109#define SYSREG_BI_OFFSET 0 112#define SYSREG_BI_OFFSET 0
110#define SYSREG_BI_SIZE 1 113#define SYSREG_BI_SIZE 1
111#define SYSREG_BE_OFFSET 1 114#define SYSREG_BE_OFFSET 1
112#define SYSREG_BE_SIZE 1 115#define SYSREG_BE_SIZE 1
113#define SYSREG_FE_OFFSET 2 116#define SYSREG_FE_OFFSET 2
114#define SYSREG_FE_SIZE 1 117#define SYSREG_FE_SIZE 1
115#define SYSREG_RE_OFFSET 3 118#define SYSREG_RE_OFFSET 3
116#define SYSREG_RE_SIZE 1 119#define SYSREG_RE_SIZE 1
117#define SYSREG_IBE_OFFSET 4 120#define SYSREG_IBE_OFFSET 4
118#define SYSREG_IBE_SIZE 1 121#define SYSREG_IBE_SIZE 1
119#define SYSREG_IEE_OFFSET 5 122#define SYSREG_IEE_OFFSET 5
120#define SYSREG_IEE_SIZE 1 123#define SYSREG_IEE_SIZE 1
121
122/* Bitfields in ECR */
123#define SYSREG_ECR_OFFSET 0
124#define SYSREG_ECR_SIZE 32
125
126/* Bitfields in RSR_SUP */
127
128/* Bitfields in RSR_INT0 */
129
130/* Bitfields in RSR_INT1 */
131
132/* Bitfields in RSR_INT2 */
133
134/* Bitfields in RSR_INT3 */
135
136/* Bitfields in RSR_EX */
137
138/* Bitfields in RSR_NMI */
139
140/* Bitfields in RSR_DBG */
141
142/* Bitfields in RAR_SUP */
143
144/* Bitfields in RAR_INT0 */
145
146/* Bitfields in RAR_INT1 */
147
148/* Bitfields in RAR_INT2 */
149
150/* Bitfields in RAR_INT3 */
151
152/* Bitfields in RAR_EX */
153
154/* Bitfields in RAR_NMI */
155
156/* Bitfields in RAR_DBG */
157
158/* Bitfields in JECR */
159
160/* Bitfields in JOSP */
161
162/* Bitfields in JAVA_LV0 */
163
164/* Bitfields in JAVA_LV1 */
165
166/* Bitfields in JAVA_LV2 */
167
168/* Bitfields in JAVA_LV3 */
169
170/* Bitfields in JAVA_LV4 */
171
172/* Bitfields in JAVA_LV5 */
173
174/* Bitfields in JAVA_LV6 */
175
176/* Bitfields in JAVA_LV7 */
177
178/* Bitfields in JTBA */
179
180/* Bitfields in JBCR */
181 124
182/* Bitfields in CONFIG0 */ 125/* Bitfields in CONFIG0 */
183#define SYSREG_CONFIG0_D_OFFSET 1 126#define SYSREG_CONFIG0_R_OFFSET 0
184#define SYSREG_CONFIG0_D_SIZE 1 127#define SYSREG_CONFIG0_R_SIZE 1
185#define SYSREG_CONFIG0_S_OFFSET 2 128#define SYSREG_CONFIG0_D_OFFSET 1
186#define SYSREG_CONFIG0_S_SIZE 1 129#define SYSREG_CONFIG0_D_SIZE 1
187#define SYSREG_O_OFFSET 3 130#define SYSREG_CONFIG0_S_OFFSET 2
188#define SYSREG_O_SIZE 1 131#define SYSREG_CONFIG0_S_SIZE 1
189#define SYSREG_P_OFFSET 4 132#define SYSREG_CONFIG0_O_OFFSET 3
190#define SYSREG_P_SIZE 1 133#define SYSREG_CONFIG0_O_SIZE 1
191#define SYSREG_CONFIG0_J_OFFSET 5 134#define SYSREG_CONFIG0_P_OFFSET 4
192#define SYSREG_CONFIG0_J_SIZE 1 135#define SYSREG_CONFIG0_P_SIZE 1
193#define SYSREG_F_OFFSET 6 136#define SYSREG_CONFIG0_J_OFFSET 5
194#define SYSREG_F_SIZE 1 137#define SYSREG_CONFIG0_J_SIZE 1
195#define SYSREG_MMUT_OFFSET 7 138#define SYSREG_CONFIG0_F_OFFSET 6
196#define SYSREG_MMUT_SIZE 3 139#define SYSREG_CONFIG0_F_SIZE 1
197#define SYSREG_AR_OFFSET 10 140#define SYSREG_MMUT_OFFSET 7
198#define SYSREG_AR_SIZE 3 141#define SYSREG_MMUT_SIZE 3
199#define SYSREG_AT_OFFSET 13 142#define SYSREG_AR_OFFSET 10
200#define SYSREG_AT_SIZE 3 143#define SYSREG_AR_SIZE 3
201#define SYSREG_PROCESSORREVISION_OFFSET 16 144#define SYSREG_AT_OFFSET 13
202#define SYSREG_PROCESSORREVISION_SIZE 8 145#define SYSREG_AT_SIZE 3
203#define SYSREG_PROCESSORID_OFFSET 24 146#define SYSREG_PROCESSORREVISION_OFFSET 16
204#define SYSREG_PROCESSORID_SIZE 8 147#define SYSREG_PROCESSORREVISION_SIZE 8
148#define SYSREG_PROCESSORID_OFFSET 24
149#define SYSREG_PROCESSORID_SIZE 8
205 150
206/* Bitfields in CONFIG1 */ 151/* Bitfields in CONFIG1 */
207#define SYSREG_DASS_OFFSET 0 152#define SYSREG_DASS_OFFSET 0
208#define SYSREG_DASS_SIZE 3 153#define SYSREG_DASS_SIZE 3
209#define SYSREG_DLSZ_OFFSET 3 154#define SYSREG_DLSZ_OFFSET 3
210#define SYSREG_DLSZ_SIZE 3 155#define SYSREG_DLSZ_SIZE 3
211#define SYSREG_DSET_OFFSET 6 156#define SYSREG_DSET_OFFSET 6
212#define SYSREG_DSET_SIZE 4 157#define SYSREG_DSET_SIZE 4
213#define SYSREG_IASS_OFFSET 10 158#define SYSREG_IASS_OFFSET 10
214#define SYSREG_IASS_SIZE 2 159#define SYSREG_IASS_SIZE 3
215#define SYSREG_ILSZ_OFFSET 13 160#define SYSREG_ILSZ_OFFSET 13
216#define SYSREG_ILSZ_SIZE 3 161#define SYSREG_ILSZ_SIZE 3
217#define SYSREG_ISET_OFFSET 16 162#define SYSREG_ISET_OFFSET 16
218#define SYSREG_ISET_SIZE 4 163#define SYSREG_ISET_SIZE 4
219#define SYSREG_DMMUSZ_OFFSET 20 164#define SYSREG_DMMUSZ_OFFSET 20
220#define SYSREG_DMMUSZ_SIZE 6 165#define SYSREG_DMMUSZ_SIZE 6
221#define SYSREG_IMMUSZ_OFFSET 26 166#define SYSREG_IMMUSZ_OFFSET 26
222#define SYSREG_IMMUSZ_SIZE 6 167#define SYSREG_IMMUSZ_SIZE 6
223
224/* Bitfields in COUNT */
225
226/* Bitfields in COMPARE */
227 168
228/* Bitfields in TLBEHI */ 169/* Bitfields in TLBEHI */
229#define SYSREG_ASID_OFFSET 0 170#define SYSREG_ASID_OFFSET 0
230#define SYSREG_ASID_SIZE 8 171#define SYSREG_ASID_SIZE 8
231#define SYSREG_TLBEHI_I_OFFSET 8 172#define SYSREG_TLBEHI_I_OFFSET 8
232#define SYSREG_TLBEHI_I_SIZE 1 173#define SYSREG_TLBEHI_I_SIZE 1
233#define SYSREG_TLBEHI_V_OFFSET 9 174#define SYSREG_TLBEHI_V_OFFSET 9
234#define SYSREG_TLBEHI_V_SIZE 1 175#define SYSREG_TLBEHI_V_SIZE 1
235#define SYSREG_VPN_OFFSET 10 176#define SYSREG_VPN_OFFSET 10
236#define SYSREG_VPN_SIZE 22 177#define SYSREG_VPN_SIZE 22
237 178
238/* Bitfields in TLBELO */ 179/* Bitfields in TLBELO */
239#define SYSREG_W_OFFSET 0 180#define SYSREG_W_OFFSET 0
240#define SYSREG_W_SIZE 1 181#define SYSREG_W_SIZE 1
241#define SYSREG_TLBELO_D_OFFSET 1 182#define SYSREG_TLBELO_D_OFFSET 1
242#define SYSREG_TLBELO_D_SIZE 1 183#define SYSREG_TLBELO_D_SIZE 1
243#define SYSREG_SZ_OFFSET 2 184#define SYSREG_SZ_OFFSET 2
244#define SYSREG_SZ_SIZE 2 185#define SYSREG_SZ_SIZE 2
245#define SYSREG_AP_OFFSET 4 186#define SYSREG_AP_OFFSET 4
246#define SYSREG_AP_SIZE 3 187#define SYSREG_AP_SIZE 3
247#define SYSREG_B_OFFSET 7 188#define SYSREG_B_OFFSET 7
248#define SYSREG_B_SIZE 1 189#define SYSREG_B_SIZE 1
249#define SYSREG_G_OFFSET 8 190#define SYSREG_G_OFFSET 8
250#define SYSREG_G_SIZE 1 191#define SYSREG_G_SIZE 1
251#define SYSREG_TLBELO_C_OFFSET 9 192#define SYSREG_TLBELO_C_OFFSET 9
252#define SYSREG_TLBELO_C_SIZE 1 193#define SYSREG_TLBELO_C_SIZE 1
253#define SYSREG_PFN_OFFSET 10 194#define SYSREG_PFN_OFFSET 10
254#define SYSREG_PFN_SIZE 22 195#define SYSREG_PFN_SIZE 22
255
256/* Bitfields in PTBR */
257
258/* Bitfields in TLBEAR */
259 196
260/* Bitfields in MMUCR */ 197/* Bitfields in MMUCR */
261#define SYSREG_E_OFFSET 0 198#define SYSREG_E_OFFSET 0
262#define SYSREG_E_SIZE 1 199#define SYSREG_E_SIZE 1
263#define SYSREG_M_OFFSET 1 200#define SYSREG_M_OFFSET 1
264#define SYSREG_M_SIZE 1 201#define SYSREG_M_SIZE 1
265#define SYSREG_MMUCR_I_OFFSET 2 202#define SYSREG_MMUCR_I_OFFSET 2
266#define SYSREG_MMUCR_I_SIZE 1 203#define SYSREG_MMUCR_I_SIZE 1
267#define SYSREG_MMUCR_N_OFFSET 3 204#define SYSREG_MMUCR_N_OFFSET 3
268#define SYSREG_MMUCR_N_SIZE 1 205#define SYSREG_MMUCR_N_SIZE 1
269#define SYSREG_MMUCR_S_OFFSET 4 206#define SYSREG_MMUCR_S_OFFSET 4
270#define SYSREG_MMUCR_S_SIZE 1 207#define SYSREG_MMUCR_S_SIZE 1
271#define SYSREG_DLA_OFFSET 8 208#define SYSREG_DLA_OFFSET 8
272#define SYSREG_DLA_SIZE 6 209#define SYSREG_DLA_SIZE 6
273#define SYSREG_DRP_OFFSET 14 210#define SYSREG_DRP_OFFSET 14
274#define SYSREG_DRP_SIZE 6 211#define SYSREG_DRP_SIZE 6
275#define SYSREG_ILA_OFFSET 20 212#define SYSREG_ILA_OFFSET 20
276#define SYSREG_ILA_SIZE 6 213#define SYSREG_ILA_SIZE 6
277#define SYSREG_IRP_OFFSET 26 214#define SYSREG_IRP_OFFSET 26
278#define SYSREG_IRP_SIZE 6 215#define SYSREG_IRP_SIZE 6
279
280/* Bitfields in TLBARLO */
281
282/* Bitfields in TLBARHI */
283
284/* Bitfields in PCCNT */
285
286/* Bitfields in PCNT0 */
287
288/* Bitfields in PCNT1 */
289 216
290/* Bitfields in PCCR */ 217/* Bitfields in PCCR */
291 218#define SYSREG_PCCR_R_OFFSET 1
292/* Bitfields in BEAR */ 219#define SYSREG_PCCR_R_SIZE 1
220#define SYSREG_PCCR_C_OFFSET 2
221#define SYSREG_PCCR_C_SIZE 1
222#define SYSREG_PCCR_S_OFFSET 3
223#define SYSREG_PCCR_S_SIZE 1
224#define SYSREG_IEC_OFFSET 4
225#define SYSREG_IEC_SIZE 1
226#define SYSREG_IE0_OFFSET 5
227#define SYSREG_IE0_SIZE 1
228#define SYSREG_IE1_OFFSET 6
229#define SYSREG_IE1_SIZE 1
230#define SYSREG_FC_OFFSET 8
231#define SYSREG_FC_SIZE 1
232#define SYSREG_F0_OFFSET 9
233#define SYSREG_F0_SIZE 1
234#define SYSREG_F1_OFFSET 10
235#define SYSREG_F1_SIZE 1
236#define SYSREG_CONF0_OFFSET 12
237#define SYSREG_CONF0_SIZE 6
238#define SYSREG_CONF1_OFFSET 18
239#define SYSREG_CONF1_SIZE 6
293 240
294/* Constants for ECR */ 241/* Constants for ECR */
295#define ECR_UNRECOVERABLE 0 242#define ECR_UNRECOVERABLE 0
296#define ECR_TLB_MULTIPLE 1 243#define ECR_TLB_MULTIPLE 1
297#define ECR_BUS_ERROR_WRITE 2 244#define ECR_BUS_ERROR_WRITE 2
298#define ECR_BUS_ERROR_READ 3 245#define ECR_BUS_ERROR_READ 3
299#define ECR_NMI 4 246#define ECR_NMI 4
300#define ECR_ADDR_ALIGN_X 5 247#define ECR_ADDR_ALIGN_X 5
301#define ECR_PROTECTION_X 6 248#define ECR_PROTECTION_X 6
302#define ECR_DEBUG 7 249#define ECR_DEBUG 7
303#define ECR_ILLEGAL_OPCODE 8 250#define ECR_ILLEGAL_OPCODE 8
304#define ECR_UNIMPL_INSTRUCTION 9 251#define ECR_UNIMPL_INSTRUCTION 9
305#define ECR_PRIVILEGE_VIOLATION 10 252#define ECR_PRIVILEGE_VIOLATION 10
306#define ECR_FPE 11 253#define ECR_FPE 11
307#define ECR_COPROC_ABSENT 12 254#define ECR_COPROC_ABSENT 12
308#define ECR_ADDR_ALIGN_R 13 255#define ECR_ADDR_ALIGN_R 13
309#define ECR_ADDR_ALIGN_W 14 256#define ECR_ADDR_ALIGN_W 14
310#define ECR_PROTECTION_R 15 257#define ECR_PROTECTION_R 15
311#define ECR_PROTECTION_W 16 258#define ECR_PROTECTION_W 16
312#define ECR_DTLB_MODIFIED 17 259#define ECR_DTLB_MODIFIED 17
313#define ECR_TLB_MISS_X 20 260#define ECR_TLB_MISS_X 20
314#define ECR_TLB_MISS_R 24 261#define ECR_TLB_MISS_R 24
315#define ECR_TLB_MISS_W 28 262#define ECR_TLB_MISS_W 28
316 263
317/* Bit manipulation macros */ 264/* Bit manipulation macros */
318#define SYSREG_BIT(name) (1 << SYSREG_##name##_OFFSET) 265#define SYSREG_BIT(name) \
319#define SYSREG_BF(name,value) (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) << SYSREG_##name##_OFFSET) 266 (1 << SYSREG_##name##_OFFSET)
320#define SYSREG_BFEXT(name,value) (((value) >> SYSREG_##name##_OFFSET) & ((1 << SYSREG_##name##_SIZE) - 1)) 267#define SYSREG_BF(name,value) \
321#define SYSREG_BFINS(name,value,old) (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) << SYSREG_##name##_OFFSET)) | SYSREG_BF(name,value)) 268 (((value) & ((1 << SYSREG_##name##_SIZE) - 1)) \
269 << SYSREG_##name##_OFFSET)
270#define SYSREG_BFEXT(name,value)\
271 (((value) >> SYSREG_##name##_OFFSET) \
272 & ((1 << SYSREG_##name##_SIZE) - 1))
273#define SYSREG_BFINS(name,value,old) \
274 (((old) & ~(((1 << SYSREG_##name##_SIZE) - 1) \
275 << SYSREG_##name##_OFFSET)) \
276 | SYSREG_BF(name,value))
322 277
278/* Register access macros */
323#ifdef __CHECKER__ 279#ifdef __CHECKER__
324extern unsigned long __builtin_mfsr(unsigned long reg); 280extern unsigned long __builtin_mfsr(unsigned long reg);
325extern void __builtin_mtsr(unsigned long reg, unsigned long value); 281extern void __builtin_mtsr(unsigned long reg, unsigned long value);
326#endif 282#endif
327 283
328/* Register access macros */ 284#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg)
329#define sysreg_read(reg) __builtin_mfsr(SYSREG_##reg) 285#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
330#define sysreg_write(reg, value) __builtin_mtsr(SYSREG_##reg, value)
331 286
332#endif /* __ASM_AVR32_SYSREG_H__ */ 287#endif /* __ASM_AVR32_SYSREG_H */
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index ac596058697d..a8236bacc878 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -9,6 +9,7 @@
9#define __ASM_AVR32_SYSTEM_H 9#define __ASM_AVR32_SYSTEM_H
10 10
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/linkage.h>
12#include <linux/types.h> 13#include <linux/types.h>
13 14
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
@@ -140,15 +141,9 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
140 sizeof(*(ptr)))) 141 sizeof(*(ptr))))
141 142
142struct pt_regs; 143struct pt_regs;
143extern void __die(const char *, struct pt_regs *, unsigned long, 144void NORET_TYPE die(const char *str, struct pt_regs *regs, long err);
144 const char *, const char *, unsigned long); 145void _exception(long signr, struct pt_regs *regs, int code,
145extern void __die_if_kernel(const char *, struct pt_regs *, unsigned long, 146 unsigned long addr);
146 const char *, const char *, unsigned long);
147
148#define die(msg, regs, err) \
149 __die(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
150#define die_if_kernel(msg, regs, err) \
151 __die_if_kernel(msg, regs, err, __FILE__ ":", __FUNCTION__, __LINE__)
152 147
153#define arch_align_stack(x) (x) 148#define arch_align_stack(x) (x)
154 149
diff --git a/include/asm-avr32/termios.h b/include/asm-avr32/termios.h
index 615bc0639e5c..0152aba35154 100644
--- a/include/asm-avr32/termios.h
+++ b/include/asm-avr32/termios.h
@@ -46,24 +46,6 @@ struct termio {
46 46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48 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__ 49#ifdef __KERNEL__
68/* intr=^C quit=^\ erase=del kill=^U 50/* intr=^C quit=^\ erase=del kill=^U
69 eof=^D vtime=\0 vmin=\1 sxtc=\0 51 eof=^D vtime=\0 vmin=\1 sxtc=\0
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
index d1f5b35ebd54..a2e606dd4f4a 100644
--- a/include/asm-avr32/thread_info.h
+++ b/include/asm-avr32/thread_info.h
@@ -83,6 +83,7 @@ static inline struct thread_info *current_thread_info(void)
83#define TIF_SINGLE_STEP 6 /* single step after next break */ 83#define TIF_SINGLE_STEP 6 /* single step after next break */
84#define TIF_MEMDIE 7 84#define TIF_MEMDIE 7
85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */ 85#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal */
86#define TIF_CPU_GOING_TO_SLEEP 9 /* CPU is entering sleep 0 mode */
86#define TIF_USERSPACE 31 /* true if FS sets userspace */ 87#define TIF_USERSPACE 31 /* true if FS sets userspace */
87 88
88#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 89#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
@@ -94,6 +95,7 @@ static inline struct thread_info *current_thread_info(void)
94#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) 95#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
95#define _TIF_MEMDIE (1 << TIF_MEMDIE) 96#define _TIF_MEMDIE (1 << TIF_MEMDIE)
96#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 97#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
98#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
97 99
98/* XXX: These two masks must never span more than 16 bits! */ 100/* XXX: These two masks must never span more than 16 bits! */
99/* work to do on interrupt/exception return */ 101/* work to do on interrupt/exception return */
diff --git a/include/asm-avr32/uaccess.h b/include/asm-avr32/uaccess.h
index 821deb5a9d28..ed092395215e 100644
--- a/include/asm-avr32/uaccess.h
+++ b/include/asm-avr32/uaccess.h
@@ -68,12 +68,6 @@ static inline void set_fs(mm_segment_t s)
68 68
69#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0)) 69#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0))
70 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 */ 71/* Generic arbitrary sized copy. Return the number of bytes NOT copied */
78extern __kernel_size_t __copy_user(void *to, const void *from, 72extern __kernel_size_t __copy_user(void *to, const void *from,
79 __kernel_size_t n); 73 __kernel_size_t n);
@@ -187,24 +181,23 @@ extern int __put_user_bad(void);
187 181
188#define __get_user_nocheck(x, ptr, size) \ 182#define __get_user_nocheck(x, ptr, size) \
189({ \ 183({ \
190 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 184 unsigned long __gu_val = 0; \
191 int __gu_err = 0; \ 185 int __gu_err = 0; \
192 \ 186 \
193 switch (size) { \ 187 switch (size) { \
194 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \ 188 case 1: __get_user_asm("ub", __gu_val, ptr, __gu_err); break; \
195 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \ 189 case 2: __get_user_asm("uh", __gu_val, ptr, __gu_err); break; \
196 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \ 190 case 4: __get_user_asm("w", __gu_val, ptr, __gu_err); break; \
197 case 8: __get_user_asm("d", __gu_val, ptr, __gu_err); break; \
198 default: __gu_err = __get_user_bad(); break; \ 191 default: __gu_err = __get_user_bad(); break; \
199 } \ 192 } \
200 \ 193 \
201 x = __gu_val; \ 194 x = (typeof(*(ptr)))__gu_val; \
202 __gu_err; \ 195 __gu_err; \
203}) 196})
204 197
205#define __get_user_check(x, ptr, size) \ 198#define __get_user_check(x, ptr, size) \
206({ \ 199({ \
207 typeof(*(ptr)) __gu_val = (typeof(*(ptr)) __force)0; \ 200 unsigned long __gu_val = 0; \
208 const typeof(*(ptr)) __user * __gu_addr = (ptr); \ 201 const typeof(*(ptr)) __user * __gu_addr = (ptr); \
209 int __gu_err = 0; \ 202 int __gu_err = 0; \
210 \ 203 \
@@ -222,10 +215,6 @@ extern int __put_user_bad(void);
222 __get_user_asm("w", __gu_val, __gu_addr, \ 215 __get_user_asm("w", __gu_val, __gu_addr, \
223 __gu_err); \ 216 __gu_err); \
224 break; \ 217 break; \
225 case 8: \
226 __get_user_asm("d", __gu_val, __gu_addr, \
227 __gu_err); \
228 break; \
229 default: \ 218 default: \
230 __gu_err = __get_user_bad(); \ 219 __gu_err = __get_user_bad(); \
231 break; \ 220 break; \
@@ -233,7 +222,7 @@ extern int __put_user_bad(void);
233 } else { \ 222 } else { \
234 __gu_err = -EFAULT; \ 223 __gu_err = -EFAULT; \
235 } \ 224 } \
236 x = __gu_val; \ 225 x = (typeof(*(ptr)))__gu_val; \
237 __gu_err; \ 226 __gu_err; \
238}) 227})
239 228
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h
index 56ed1f9d348a..8f5120471819 100644
--- a/include/asm-avr32/unistd.h
+++ b/include/asm-avr32/unistd.h
@@ -120,7 +120,7 @@
120#define __NR_getitimer 105 120#define __NR_getitimer 105
121#define __NR_swapoff 106 121#define __NR_swapoff 106
122#define __NR_sysinfo 107 122#define __NR_sysinfo 107
123#define __NR_ipc 108 123/* 108 was __NR_ipc for a little while */
124#define __NR_sendfile 109 124#define __NR_sendfile 109
125#define __NR_setdomainname 110 125#define __NR_setdomainname 110
126#define __NR_uname 111 126#define __NR_uname 111
@@ -282,8 +282,21 @@
282#define __NR_vmsplice 264 282#define __NR_vmsplice 264
283#define __NR_epoll_pwait 265 283#define __NR_epoll_pwait 265
284 284
285#define __NR_msgget 266
286#define __NR_msgsnd 267
287#define __NR_msgrcv 268
288#define __NR_msgctl 269
289#define __NR_semget 270
290#define __NR_semop 271
291#define __NR_semctl 272
292#define __NR_semtimedop 273
293#define __NR_shmat 274
294#define __NR_shmget 275
295#define __NR_shmdt 276
296#define __NR_shmctl 277
297
285#ifdef __KERNEL__ 298#ifdef __KERNEL__
286#define NR_syscalls 266 299#define NR_syscalls 278
287 300
288 301
289#define __ARCH_WANT_IPC_PARSE_VERSION 302#define __ARCH_WANT_IPC_PARSE_VERSION
diff --git a/include/asm-cris/io.h b/include/asm-cris/io.h
index 716c69bc58f8..d196dd6b2df3 100644
--- a/include/asm-cris/io.h
+++ b/include/asm-cris/io.h
@@ -121,11 +121,6 @@ static inline void writel(unsigned int b, volatile void __iomem *addr)
121#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c)) 121#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
122#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) 122#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
123 123
124/*
125 * Again, CRIS does not require mem IO specific function.
126 */
127
128#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
129 124
130/* The following is junk needed for the arch-independent code but which 125/* The following is junk needed for the arch-independent code but which
131 * we never use in the CRIS port 126 * we never use in the CRIS port
diff --git a/include/asm-cris/semaphore-helper.h b/include/asm-cris/semaphore-helper.h
index a8e1e6cb7cd0..27bfeca1b981 100644
--- a/include/asm-cris/semaphore-helper.h
+++ b/include/asm-cris/semaphore-helper.h
@@ -30,8 +30,7 @@ static inline int waking_non_zero(struct semaphore *sem)
30 unsigned long flags; 30 unsigned long flags;
31 int ret = 0; 31 int ret = 0;
32 32
33 local_save_flags(flags); 33 local_irq_save(flags);
34 local_irq_disable();
35 if (read(&sem->waking) > 0) { 34 if (read(&sem->waking) > 0) {
36 dec(&sem->waking); 35 dec(&sem->waking);
37 ret = 1; 36 ret = 1;
@@ -46,8 +45,7 @@ static inline int waking_non_zero_interruptible(struct semaphore *sem,
46 int ret = 0; 45 int ret = 0;
47 unsigned long flags; 46 unsigned long flags;
48 47
49 local_save_flags(flags); 48 local_irq_save(flags);
50 local_irq_disable();
51 if (read(&sem->waking) > 0) { 49 if (read(&sem->waking) > 0) {
52 dec(&sem->waking); 50 dec(&sem->waking);
53 ret = 1; 51 ret = 1;
@@ -64,8 +62,7 @@ static inline int waking_non_zero_trylock(struct semaphore *sem)
64 int ret = 1; 62 int ret = 1;
65 unsigned long flags; 63 unsigned long flags;
66 64
67 local_save_flags(flags); 65 local_irq_save(flags);
68 local_irq_disable();
69 if (read(&sem->waking) <= 0) 66 if (read(&sem->waking) <= 0)
70 inc(&sem->count); 67 inc(&sem->count);
71 else { 68 else {
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 01cfdf1d6d33..5b18dfdf1748 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -51,6 +51,8 @@
51 51
52#define SO_PEERSEC 31 52#define SO_PEERSEC 31
53#define SO_PASSSEC 34 53#define SO_PASSSEC 34
54#define SO_TIMESTAMPNS 35
55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
56 58
diff --git a/include/asm-cris/sockios.h b/include/asm-cris/sockios.h
index 6c4012f0b29f..cfe7bfecf599 100644
--- a/include/asm-cris/sockios.h
+++ b/include/asm-cris/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index b869f6161aaa..fea0e8d57cb5 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -44,8 +44,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
44 /* since Etrax doesn't have any atomic xchg instructions, we need to disable 44 /* since Etrax doesn't have any atomic xchg instructions, we need to disable
45 irq's (if enabled) and do it with move.d's */ 45 irq's (if enabled) and do it with move.d's */
46 unsigned long flags,temp; 46 unsigned long flags,temp;
47 local_save_flags(flags); /* save flags, including irq enable bit */ 47 local_irq_save(flags); /* save flags, including irq enable bit and shut off irqs */
48 local_irq_disable(); /* shut off irq's */
49 switch (size) { 48 switch (size) {
50 case 1: 49 case 1:
51 *((unsigned char *)&temp) = x; 50 *((unsigned char *)&temp) = x;
diff --git a/include/asm-cris/termios.h b/include/asm-cris/termios.h
index 5ce1023c5d7b..c9dbd4d43368 100644
--- a/include/asm-cris/termios.h
+++ b/include/asm-cris/termios.h
@@ -40,24 +40,6 @@ struct termio {
40 40
41/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 41/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
42 42
43/* line disciplines */
44#define N_TTY 0
45#define N_SLIP 1
46#define N_MOUSE 2
47#define N_PPP 3
48#define N_STRIP 4
49#define N_AX25 5
50#define N_X25 6 /* X.25 async */
51#define N_6PACK 7
52#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
53#define N_R3964 9 /* Reserved for Simatic R3964 module */
54#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
55#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
56#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
57#define N_HDLC 13 /* synchronous HDLC */
58#define N_SYNC_PPP 14 /* synchronous PPP */
59#define N_BT 15 /* bluetooth */
60
61#ifdef __KERNEL__ 43#ifdef __KERNEL__
62 44
63/* intr=^C quit=^\ erase=del kill=^U 45/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index c68e1680da01..966a9836d556 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -1 +1,7 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3header-y += registers.h
4
5unifdef-y += termios.h
6unifdef-y += ptrace.h
7unifdef-y += page.h
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index 134cc0cdf6c2..213d92fd652a 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -76,8 +76,6 @@ extern unsigned long max_pfn;
76 76
77#endif /* __ASSEMBLY__ */ 77#endif /* __ASSEMBLY__ */
78 78
79#endif /* __KERNEL__ */
80
81#ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC 79#ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC
82#define WANT_PAGE_VIRTUAL 1 80#define WANT_PAGE_VIRTUAL 1
83#endif 81#endif
@@ -85,4 +83,6 @@ extern unsigned long max_pfn;
85#include <asm-generic/memory_model.h> 83#include <asm-generic/memory_model.h>
86#include <asm-generic/page.h> 84#include <asm-generic/page.h>
87 85
86#endif /* __KERNEL__ */
87
88#endif /* _ASM_PAGE_H */ 88#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index ba1b37df69d5..8a05aa168616 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -70,7 +70,11 @@ static inline int pte_file(pte_t pte) { return 0; }
70 70
71#define swapper_pg_dir ((pgd_t *) NULL) 71#define swapper_pg_dir ((pgd_t *) NULL)
72 72
73#define pgtable_cache_init() do {} while(0) 73#define pgtable_cache_init() do {} while (0)
74#define arch_enter_lazy_mmu_mode() do {} while (0)
75#define arch_leave_lazy_mmu_mode() do {} while (0)
76#define arch_enter_lazy_cpu_mode() do {} while (0)
77#define arch_leave_lazy_cpu_mode() do {} while (0)
74 78
75#else /* !CONFIG_MMU */ 79#else /* !CONFIG_MMU */
76/*****************************************************************************/ 80/*****************************************************************************/
diff --git a/include/asm-frv/ptrace.h b/include/asm-frv/ptrace.h
index 9a2241b8eb1e..cf6934012b64 100644
--- a/include/asm-frv/ptrace.h
+++ b/include/asm-frv/ptrace.h
@@ -12,9 +12,11 @@
12#define _ASM_PTRACE_H 12#define _ASM_PTRACE_H
13 13
14#include <asm/registers.h> 14#include <asm/registers.h>
15#ifdef __KERNEL__
15#include <asm/irq_regs.h> 16#include <asm/irq_regs.h>
16 17
17#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0) 18#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0)
19#endif
18 20
19 21
20#define PT_PSR 0 22#define PT_PSR 0
@@ -60,6 +62,7 @@
60#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ 62#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
61#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ 63#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
62 64
65#ifdef __KERNEL__
63#ifndef __ASSEMBLY__ 66#ifndef __ASSEMBLY__
64 67
65/* 68/*
@@ -74,6 +77,7 @@ register struct pt_regs *__frame asm("gr28");
74extern unsigned long user_stack(const struct pt_regs *); 77extern unsigned long user_stack(const struct pt_regs *);
75extern void show_regs(struct pt_regs *); 78extern void show_regs(struct pt_regs *);
76#define profile_pc(regs) ((regs)->pc) 79#define profile_pc(regs) ((regs)->pc)
80#endif
77 81
78#endif /* !__ASSEMBLY__ */ 82#endif /* !__ASSEMBLY__ */
79#endif /* _ASM_PTRACE_H */ 83#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index 31db18fc871f..a823befd11dd 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
54 56
diff --git a/include/asm-frv/sockios.h b/include/asm-frv/sockios.h
index 8a6e4b2074b7..5dbdd13e6de3 100644
--- a/include/asm-frv/sockios.h
+++ b/include/asm-frv/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* _ASM_SOCKIOS__ */ 13#endif /* _ASM_SOCKIOS__ */
13 14
diff --git a/include/asm-frv/termios.h b/include/asm-frv/termios.h
index b4a664e7f55c..a62fb5872375 100644
--- a/include/asm-frv/termios.h
+++ b/include/asm-frv/termios.h
@@ -51,24 +51,8 @@ struct termio {
51 51
52/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 52/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
53 53
54/* line disciplines */ 54#ifdef __KERNEL__
55#define N_TTY 0
56#define N_SLIP 1
57#define N_MOUSE 2
58#define N_PPP 3
59#define N_STRIP 4
60#define N_AX25 5
61#define N_X25 6 /* X.25 async */
62#define N_6PACK 7
63#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
64#define N_R3964 9 /* Reserved for Simatic R3964 module */
65#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
66#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
67#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
68#define N_HDLC 13 /* synchronous HDLC */
69#define N_SYNC_PPP 14
70#define N_HCI 15 /* Bluetooth HCI UART */
71
72#include <asm-generic/termios.h> 55#include <asm-generic/termios.h>
56#endif
73 57
74#endif /* _ASM_TERMIOS_H */ 58#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-generic/div64.h b/include/asm-generic/div64.h
index 8f4e3193342e..a4a49370793c 100644
--- a/include/asm-generic/div64.h
+++ b/include/asm-generic/div64.h
@@ -30,6 +30,11 @@
30 __rem; \ 30 __rem; \
31 }) 31 })
32 32
33static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
34{
35 return dividend / divisor;
36}
37
33#elif BITS_PER_LONG == 32 38#elif BITS_PER_LONG == 32
34 39
35extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); 40extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
@@ -49,6 +54,8 @@ extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
49 __rem; \ 54 __rem; \
50 }) 55 })
51 56
57extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
58
52#else /* BITS_PER_LONG == ?? */ 59#else /* BITS_PER_LONG == ?? */
53 60
54# error do_div() does not yet support the C64 61# error do_div() does not yet support the C64
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index a7f1a55ce6b0..29413d3d4605 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -3,7 +3,6 @@
3 3
4/* This is used for archs that do not support DMA */ 4/* This is used for archs that do not support DMA */
5 5
6
7static inline void * 6static inline void *
8dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 7dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
9 gfp_t flag) 8 gfp_t flag)
@@ -19,4 +18,7 @@ dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
19 BUG(); 18 BUG();
20} 19}
21 20
21#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
22#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
23
22#endif /* _ASM_GENERIC_DMA_MAPPING_H */ 24#endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
new file mode 100644
index 000000000000..2d0aab1d8611
--- /dev/null
+++ b/include/asm-generic/gpio.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_GENERIC_GPIO_H
2#define _ASM_GENERIC_GPIO_H
3
4/* platforms that don't directly support access to GPIOs through I2C, SPI,
5 * or other blocking infrastructure can use these wrappers.
6 */
7
8static inline int gpio_cansleep(unsigned gpio)
9{
10 return 0;
11}
12
13static inline int gpio_get_value_cansleep(unsigned gpio)
14{
15 might_sleep();
16 return gpio_get_value(gpio);
17}
18
19static inline void gpio_set_value_cansleep(unsigned gpio, int value)
20{
21 might_sleep();
22 gpio_set_value(gpio, value);
23}
24
25#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index 8078cbd2c016..30d8d33491dd 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -54,7 +54,7 @@
54#define __page_to_pfn(pg) \ 54#define __page_to_pfn(pg) \
55({ struct page *__pg = (pg); \ 55({ struct page *__pg = (pg); \
56 int __sec = page_to_section(__pg); \ 56 int __sec = page_to_section(__pg); \
57 __pg - __section_mem_map_addr(__nr_to_section(__sec)); \ 57 (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
58}) 58})
59 59
60#define __pfn_to_page(pfn) \ 60#define __pfn_to_page(pfn) \
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
index 3b41d2bb70da..5e3dde2ee5ad 100644
--- a/include/asm-generic/mman.h
+++ b/include/asm-generic/mman.h
@@ -36,7 +36,6 @@
36#define MADV_DOFORK 11 /* do inherit across fork */ 36#define MADV_DOFORK 11 /* do inherit across fork */
37 37
38/* compatibility flags */ 38/* compatibility flags */
39#define MAP_ANON MAP_ANONYMOUS
40#define MAP_FILE 0 39#define MAP_FILE 0
41 40
42#endif 41#endif
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index b55052ce2330..a96b5d986b6e 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -4,51 +4,21 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6 6
7#include <linux/log2.h> 7#include <linux/compiler.h>
8 8
9/* 9/* Pure 2^n version of get_order */
10 * non-const pure 2^n version of get_order 10static __inline__ __attribute_const__ int get_order(unsigned long size)
11 * - the arch may override these in asm/bitops.h if they can be implemented
12 * more efficiently than using the arch log2 routines
13 * - we use the non-const log2() instead if the arch has defined one suitable
14 */
15#ifndef ARCH_HAS_GET_ORDER
16static inline __attribute__((const))
17int __get_order(unsigned long size, int page_shift)
18{ 11{
19#if BITS_PER_LONG == 32 && defined(ARCH_HAS_ILOG2_U32)
20 int order = __ilog2_u32(size) - page_shift;
21 return order >= 0 ? order : 0;
22#elif BITS_PER_LONG == 64 && defined(ARCH_HAS_ILOG2_U64)
23 int order = __ilog2_u64(size) - page_shift;
24 return order >= 0 ? order : 0;
25#else
26 int order; 12 int order;
27 13
28 size = (size - 1) >> (page_shift - 1); 14 size = (size - 1) >> (PAGE_SHIFT - 1);
29 order = -1; 15 order = -1;
30 do { 16 do {
31 size >>= 1; 17 size >>= 1;
32 order++; 18 order++;
33 } while (size); 19 } while (size);
34 return order; 20 return order;
35#endif
36} 21}
37#endif
38
39/**
40 * get_order - calculate log2(pages) to hold a block of the specified size
41 * @n - size
42 *
43 * calculate allocation order based on the current page size
44 * - this can be used to initialise global variables from constant data
45 */
46#define get_order(n) \
47( \
48 __builtin_constant_p(n) ? \
49 ((n < (1UL << PAGE_SHIFT)) ? 0 : ilog2(n) - PAGE_SHIFT) : \
50 __get_order(n, PAGE_SHIFT) \
51 )
52 22
53#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
54#endif /* __KERNEL__ */ 24#endif /* __KERNEL__ */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 9d774d07d95b..dc8f99ee305f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -139,8 +139,15 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
139#define pte_same(A,B) (pte_val(A) == pte_val(B)) 139#define pte_same(A,B) (pte_val(A) == pte_val(B))
140#endif 140#endif
141 141
142#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 142#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
143#define page_test_and_clear_dirty(page) (0) 143#define page_test_dirty(page) (0)
144#endif
145
146#ifndef __HAVE_ARCH_PAGE_CLEAR_DIRTY
147#define page_clear_dirty(page) do { } while (0)
148#endif
149
150#ifndef __HAVE_ARCH_PAGE_TEST_DIRTY
144#define pte_maybe_dirty(pte) pte_dirty(pte) 151#define pte_maybe_dirty(pte) pte_dirty(pte)
145#else 152#else
146#define pte_maybe_dirty(pte) (1) 153#define pte_maybe_dirty(pte) (1)
@@ -180,6 +187,21 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE 187#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
181#define arch_enter_lazy_mmu_mode() do {} while (0) 188#define arch_enter_lazy_mmu_mode() do {} while (0)
182#define arch_leave_lazy_mmu_mode() do {} while (0) 189#define arch_leave_lazy_mmu_mode() do {} while (0)
190#define arch_flush_lazy_mmu_mode() do {} while (0)
191#endif
192
193/*
194 * A facility to provide batching of the reload of page tables with the
195 * actual context switch code for paravirtualized guests. By convention,
196 * only one of the lazy modes (CPU, MMU) should be active at any given
197 * time, entry should never be nested, and entry and exits should always
198 * be paired. This is for sanity of maintaining and reasoning about the
199 * kernel code.
200 */
201#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
202#define arch_enter_lazy_cpu_mode() do {} while (0)
203#define arch_leave_lazy_cpu_mode() do {} while (0)
204#define arch_flush_lazy_cpu_mode() do {} while (0)
183#endif 205#endif
184 206
185/* 207/*
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index ebc830fee0d0..39911d8c9684 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-h8300/sockios.h b/include/asm-h8300/sockios.h
index d005d9594cc6..e9c7ec810c23 100644
--- a/include/asm-h8300/sockios.h
+++ b/include/asm-h8300/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_H8300_SOCKIOS__ */ 13#endif /* __ARCH_H8300_SOCKIOS__ */
diff --git a/include/asm-h8300/termios.h b/include/asm-h8300/termios.h
index e2319f992af2..fb2925d08c49 100644
--- a/include/asm-h8300/termios.h
+++ b/include/asm-h8300/termios.h
@@ -49,24 +49,6 @@ struct termio {
49 49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51 51
52/* line disciplines */
53#define N_TTY 0
54#define N_SLIP 1
55#define N_MOUSE 2
56#define N_PPP 3
57#define N_STRIP 4
58#define N_AX25 5
59#define N_X25 6 /* X.25 async */
60#define N_6PACK 7
61#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
62#define N_R3964 9 /* Reserved for Simatic R3964 module */
63#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
64#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
65#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
66#define N_HDLC 13 /* synchronous HDLC */
67#define N_SYNC_PPP 14
68#define N_HCI 15 /* Bluetooth HCI UART */
69
70#ifdef __KERNEL__ 52#ifdef __KERNEL__
71 53
72/* 54/*
diff --git a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h
index 7cfad93edf10..449f3f272e07 100644
--- a/include/asm-i386/acpi.h
+++ b/include/asm-i386/acpi.h
@@ -39,7 +39,7 @@
39 * Calling conventions: 39 * Calling conventions:
40 * 40 *
41 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) 41 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
42 * ACPI_EXTERNAL_XFACE - External ACPI interfaces 42 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
43 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces 43 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
44 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces 44 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
45 */ 45 */
@@ -59,11 +59,11 @@
59int __acpi_acquire_global_lock(unsigned int *lock); 59int __acpi_acquire_global_lock(unsigned int *lock);
60int __acpi_release_global_lock(unsigned int *lock); 60int __acpi_release_global_lock(unsigned int *lock);
61 61
62#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ 62#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
63 ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) 63 ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
64 64
65#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ 65#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
66 ((Acq) = __acpi_release_global_lock((unsigned int *) GLptr)) 66 ((Acq) = __acpi_release_global_lock(&facs->global_lock))
67 67
68/* 68/*
69 * Math helper asm macros 69 * Math helper asm macros
@@ -87,7 +87,7 @@ extern void check_acpi_pci(void);
87static inline void check_acpi_pci(void) { } 87static inline void check_acpi_pci(void) { }
88#endif 88#endif
89 89
90#ifdef CONFIG_ACPI 90#ifdef CONFIG_ACPI
91extern int acpi_lapic; 91extern int acpi_lapic;
92extern int acpi_ioapic; 92extern int acpi_ioapic;
93extern int acpi_noirq; 93extern int acpi_noirq;
@@ -95,9 +95,9 @@ extern int acpi_strict;
95extern int acpi_disabled; 95extern int acpi_disabled;
96extern int acpi_ht; 96extern int acpi_ht;
97extern int acpi_pci_disabled; 97extern int acpi_pci_disabled;
98static inline void disable_acpi(void) 98static inline void disable_acpi(void)
99{ 99{
100 acpi_disabled = 1; 100 acpi_disabled = 1;
101 acpi_ht = 0; 101 acpi_ht = 0;
102 acpi_pci_disabled = 1; 102 acpi_pci_disabled = 1;
103 acpi_noirq = 1; 103 acpi_noirq = 1;
@@ -114,9 +114,9 @@ extern int acpi_use_timer_override;
114#endif 114#endif
115 115
116static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 116static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
117static inline void acpi_disable_pci(void) 117static inline void acpi_disable_pci(void)
118{ 118{
119 acpi_pci_disabled = 1; 119 acpi_pci_disabled = 1;
120 acpi_noirq_set(); 120 acpi_noirq_set();
121} 121}
122extern int acpi_irq_balance_set(char *str); 122extern int acpi_irq_balance_set(char *str);
@@ -127,6 +127,7 @@ extern int acpi_irq_balance_set(char *str);
127#define acpi_ioapic 0 127#define acpi_ioapic 0
128static inline void acpi_noirq_set(void) { } 128static inline void acpi_noirq_set(void) { }
129static inline void acpi_disable_pci(void) { } 129static inline void acpi_disable_pci(void) { }
130static inline void disable_acpi(void) { }
130 131
131#endif /* !CONFIG_ACPI */ 132#endif /* !CONFIG_ACPI */
132 133
@@ -144,8 +145,6 @@ extern void acpi_reserve_bootmem(void);
144 145
145#endif /*CONFIG_ACPI_SLEEP*/ 146#endif /*CONFIG_ACPI_SLEEP*/
146 147
147extern u8 x86_acpiid_to_apicid[];
148
149#define ARCH_HAS_POWER_INIT 1 148#define ARCH_HAS_POWER_INIT 1
150 149
151#endif /*__KERNEL__*/ 150#endif /*__KERNEL__*/
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 41a44319905f..a19810a08ae9 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -43,6 +43,8 @@ extern void generic_apic_probe(void);
43#define apic_write native_apic_write 43#define apic_write native_apic_write
44#define apic_write_atomic native_apic_write_atomic 44#define apic_write_atomic native_apic_write_atomic
45#define apic_read native_apic_read 45#define apic_read native_apic_read
46#define setup_boot_clock setup_boot_APIC_clock
47#define setup_secondary_clock setup_secondary_APIC_clock
46#endif 48#endif
47 49
48static __inline fastcall void native_apic_write(unsigned long reg, 50static __inline fastcall void native_apic_write(unsigned long reg,
@@ -93,9 +95,7 @@ static inline void ack_APIC_irq(void)
93 apic_write_around(APIC_EOI, 0); 95 apic_write_around(APIC_EOI, 0);
94} 96}
95 97
96extern void (*wait_timer_tick)(void); 98extern int lapic_get_maxlvt(void);
97
98extern int get_maxlvt(void);
99extern void clear_local_APIC(void); 99extern void clear_local_APIC(void);
100extern void connect_bsp_APIC (void); 100extern void connect_bsp_APIC (void);
101extern void disconnect_bsp_APIC (int virt_wire_setup); 101extern void disconnect_bsp_APIC (int virt_wire_setup);
@@ -111,17 +111,13 @@ extern void smp_local_timer_interrupt (void);
111extern void setup_boot_APIC_clock (void); 111extern void setup_boot_APIC_clock (void);
112extern void setup_secondary_APIC_clock (void); 112extern void setup_secondary_APIC_clock (void);
113extern int APIC_init_uniprocessor (void); 113extern int APIC_init_uniprocessor (void);
114extern void disable_APIC_timer(void);
115extern void enable_APIC_timer(void);
116 114
117extern void enable_NMI_through_LVT0 (void * dummy); 115extern void enable_NMI_through_LVT0 (void * dummy);
118 116
119void smp_send_timer_broadcast_ipi(void);
120void switch_APIC_timer_to_ipi(void *cpumask);
121void switch_ipi_to_APIC_timer(void *cpumask);
122#define ARCH_APICTIMER_STOPS_ON_C3 1 117#define ARCH_APICTIMER_STOPS_ON_C3 1
123 118
124extern int timer_over_8254; 119extern int timer_over_8254;
120extern int local_apic_timer_c2_ok;
125 121
126#else /* !CONFIG_X86_LOCAL_APIC */ 122#else /* !CONFIG_X86_LOCAL_APIC */
127static inline void lapic_shutdown(void) { } 123static inline void lapic_shutdown(void) { }
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index c57441bb2905..4dd272331361 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -211,12 +211,12 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v)
211#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 211#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
212 212
213/** 213/**
214 * atomic_add_unless - add unless the number is a given value 214 * atomic_add_unless - add unless the number is already a given value
215 * @v: pointer of type atomic_t 215 * @v: pointer of type atomic_t
216 * @a: the amount to add to v... 216 * @a: the amount to add to v...
217 * @u: ...unless v is equal to u. 217 * @u: ...unless v is equal to u.
218 * 218 *
219 * Atomically adds @a to @v, so long as it was not @u. 219 * Atomically adds @a to @v, so long as @v was not already @u.
220 * Returns non-zero if @v was not @u, and zero otherwise. 220 * Returns non-zero if @v was not @u, and zero otherwise.
221 */ 221 */
222#define atomic_add_unless(v, a, u) \ 222#define atomic_add_unless(v, a, u) \
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 1c780fa1e762..273b50629357 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -371,7 +371,7 @@ static inline unsigned long ffz(unsigned long word)
371 * 371 *
372 * This is defined the same way as 372 * This is defined the same way as
373 * the libc and compiler builtin ffs routines, therefore 373 * the libc and compiler builtin ffs routines, therefore
374 * differs in spirit from the above ffz (man ffs). 374 * differs in spirit from the above ffz() (man ffs).
375 */ 375 */
376static inline int ffs(int x) 376static inline int ffs(int x)
377{ 377{
@@ -388,7 +388,7 @@ static inline int ffs(int x)
388 * fls - find last bit set 388 * fls - find last bit set
389 * @x: the word to search 389 * @x: the word to search
390 * 390 *
391 * This is defined the same way as ffs. 391 * This is defined the same way as ffs().
392 */ 392 */
393static inline int fls(int x) 393static inline int fls(int x)
394{ 394{
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 38f1aebbbdb5..c90c7c499302 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -160,7 +160,7 @@ static void __init check_config(void)
160 * If we configured ourselves for a TSC, we'd better have one! 160 * If we configured ourselves for a TSC, we'd better have one!
161 */ 161 */
162#ifdef CONFIG_X86_TSC 162#ifdef CONFIG_X86_TSC
163 if (!cpu_has_tsc) 163 if (!cpu_has_tsc && !tsc_disable)
164 panic("Kernel compiled for Pentium+, requires TSC feature!"); 164 panic("Kernel compiled for Pentium+, requires TSC feature!");
165#endif 165#endif
166 166
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 3f92b94e0d75..d1b8e4ab6c1a 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -75,6 +75,7 @@
75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
78#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
78 79
79/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 80/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
80#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 81#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 32d6678d0bbf..9ae5e3782ed8 100644
--- a/include/asm-i386/delay.h
+++ b/include/asm-i386/delay.h
@@ -16,13 +16,6 @@ extern void __ndelay(unsigned long nsecs);
16extern void __const_udelay(unsigned long usecs); 16extern void __const_udelay(unsigned long usecs);
17extern void __delay(unsigned long loops); 17extern void __delay(unsigned long loops);
18 18
19#if defined(CONFIG_PARAVIRT) && !defined(USE_REAL_TIME_DELAY)
20#define udelay(n) paravirt_ops.const_udelay((n) * 0x10c7ul)
21
22#define ndelay(n) paravirt_ops.const_udelay((n) * 5ul)
23
24#else /* !PARAVIRT || USE_REAL_TIME_DELAY */
25
26/* 0x10c7 is 2**32 / 1000000 (rounded up) */ 19/* 0x10c7 is 2**32 / 1000000 (rounded up) */
27#define udelay(n) (__builtin_constant_p(n) ? \ 20#define udelay(n) (__builtin_constant_p(n) ? \
28 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ 21 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
@@ -32,7 +25,6 @@ extern void __delay(unsigned long loops);
32#define ndelay(n) (__builtin_constant_p(n) ? \ 25#define ndelay(n) (__builtin_constant_p(n) ? \
33 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ 26 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
34 __ndelay(n)) 27 __ndelay(n))
35#endif
36 28
37void use_tsc_delay(void); 29void use_tsc_delay(void);
38 30
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index f398cc456448..050831f34f71 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -22,7 +22,7 @@ struct Xgt_desc_struct {
22 22
23extern struct Xgt_desc_struct idt_descr; 23extern struct Xgt_desc_struct idt_descr;
24DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); 24DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
25 25extern struct Xgt_desc_struct early_gdt_descr;
26 26
27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) 27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
28{ 28{
diff --git a/include/asm-i386/div64.h b/include/asm-i386/div64.h
index 75c67c785bb8..438e980068bd 100644
--- a/include/asm-i386/div64.h
+++ b/include/asm-i386/div64.h
@@ -1,6 +1,8 @@
1#ifndef __I386_DIV64 1#ifndef __I386_DIV64
2#define __I386_DIV64 2#define __I386_DIV64
3 3
4#include <linux/types.h>
5
4/* 6/*
5 * do_div() is NOT a C function. It wants to return 7 * do_div() is NOT a C function. It wants to return
6 * two values (the quotient and the remainder), but 8 * two values (the quotient and the remainder), but
@@ -45,4 +47,6 @@ div_ll_X_l_rem(long long divs, long div, long *rem)
45 return dum2; 47 return dum2;
46 48
47} 49}
50
51extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
48#endif 52#endif
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 369035dfe4b6..952b3ee3c9bb 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -88,16 +88,16 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
88 pr_reg[4] = regs->edi; \ 88 pr_reg[4] = regs->edi; \
89 pr_reg[5] = regs->ebp; \ 89 pr_reg[5] = regs->ebp; \
90 pr_reg[6] = regs->eax; \ 90 pr_reg[6] = regs->eax; \
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds & 0xffff; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes & 0xffff; \
93 savesegment(fs,pr_reg[9]); \ 93 pr_reg[9] = regs->xfs & 0xffff; \
94 pr_reg[10] = regs->xgs; \ 94 savesegment(gs,pr_reg[10]); \
95 pr_reg[11] = regs->orig_eax; \ 95 pr_reg[11] = regs->orig_eax; \
96 pr_reg[12] = regs->eip; \ 96 pr_reg[12] = regs->eip; \
97 pr_reg[13] = regs->xcs; \ 97 pr_reg[13] = regs->xcs & 0xffff; \
98 pr_reg[14] = regs->eflags; \ 98 pr_reg[14] = regs->eflags; \
99 pr_reg[15] = regs->esp; \ 99 pr_reg[15] = regs->esp; \
100 pr_reg[16] = regs->xss; 100 pr_reg[16] = regs->xss & 0xffff;
101 101
102/* This yields a mask that user programs can use to figure out what 102/* This yields a mask that user programs can use to figure out what
103 instruction set this CPU supports. This could be done in user space, 103 instruction set this CPU supports. This could be done in user space,
diff --git a/include/asm-i386/hpet.h b/include/asm-i386/hpet.h
index e47be9a56cc2..fc03cf9de5c4 100644
--- a/include/asm-i386/hpet.h
+++ b/include/asm-i386/hpet.h
@@ -90,16 +90,19 @@
90#define HPET_MIN_PERIOD (100000UL) 90#define HPET_MIN_PERIOD (100000UL)
91#define HPET_TICK_RATE (HZ * 100000UL) 91#define HPET_TICK_RATE (HZ * 100000UL)
92 92
93extern unsigned long hpet_tick; /* hpet clks count per tick */
94extern unsigned long hpet_address; /* hpet memory map physical address */ 93extern unsigned long hpet_address; /* hpet memory map physical address */
95extern int hpet_use_timer; 94extern int is_hpet_enabled(void);
96 95
96#ifdef CONFIG_X86_64
97extern unsigned long hpet_tick; /* hpet clks count per tick */
98extern int hpet_use_timer;
97extern int hpet_rtc_timer_init(void); 99extern int hpet_rtc_timer_init(void);
98extern int hpet_enable(void); 100extern int hpet_enable(void);
99extern int hpet_reenable(void);
100extern int is_hpet_enabled(void);
101extern int is_hpet_capable(void); 101extern int is_hpet_capable(void);
102extern int hpet_readl(unsigned long a); 102extern int hpet_readl(unsigned long a);
103#else
104extern int hpet_enable(void);
105#endif
103 106
104#ifdef CONFIG_HPET_EMULATE_RTC 107#ifdef CONFIG_HPET_EMULATE_RTC
105extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); 108extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
@@ -110,5 +113,10 @@ extern int hpet_rtc_dropped_irq(void);
110extern int hpet_rtc_timer_init(void); 113extern int hpet_rtc_timer_init(void);
111extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); 114extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
112#endif /* CONFIG_HPET_EMULATE_RTC */ 115#endif /* CONFIG_HPET_EMULATE_RTC */
116
117#else
118
119static inline int hpet_enable(void) { return 0; }
120
113#endif /* CONFIG_HPET_TIMER */ 121#endif /* CONFIG_HPET_TIMER */
114#endif /* _I386_HPET_H */ 122#endif /* _I386_HPET_H */
diff --git a/include/asm-i386/i8253.h b/include/asm-i386/i8253.h
index 015d8df07690..6cb0dd4dcdde 100644
--- a/include/asm-i386/i8253.h
+++ b/include/asm-i386/i8253.h
@@ -1,6 +1,21 @@
1#ifndef __ASM_I8253_H__ 1#ifndef __ASM_I8253_H__
2#define __ASM_I8253_H__ 2#define __ASM_I8253_H__
3 3
4#include <linux/clockchips.h>
5
4extern spinlock_t i8253_lock; 6extern spinlock_t i8253_lock;
5 7
8extern struct clock_event_device *global_clock_event;
9
10/**
11 * pit_interrupt_hook - hook into timer tick
12 * @regs: standard registers from interrupt
13 *
14 * Call the global clock event handler.
15 **/
16static inline void pit_interrupt_hook(void)
17{
18 global_clock_event->event_handler(global_clock_event);
19}
20
6#endif /* __ASM_I8253_H__ */ 21#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 86ff5e83be2f..59fe616933c4 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -219,12 +219,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
219#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 219#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
220 220
221/* 221/*
222 * Again, i386 does not require mem IO specific function.
223 */
224
225#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d))
226
227/*
228 * Cache management 222 * Cache management
229 * 223 *
230 * This needed for two cases 224 * This needed for two cases
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 059a9ff28b4d..340764076d5f 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/mpspec.h> 5#include <asm/mpspec.h>
6#include <asm/apicdef.h>
6 7
7/* 8/*
8 * Intel IO-APIC support for SMP and UP systems. 9 * Intel IO-APIC support for SMP and UP systems.
diff --git a/include/asm-i386/mach-default/do_timer.h b/include/asm-i386/mach-default/do_timer.h
index 7d606e3364ae..56e5689863ae 100644
--- a/include/asm-i386/mach-default/do_timer.h
+++ b/include/asm-i386/mach-default/do_timer.h
@@ -1,86 +1,16 @@
1/* defines for inline arch setup functions */ 1/* defines for inline arch setup functions */
2#include <linux/clockchips.h>
2 3
3#include <asm/apic.h>
4#include <asm/i8259.h> 4#include <asm/i8259.h>
5#include <asm/i8253.h>
5 6
6/** 7/**
7 * do_timer_interrupt_hook - hook into timer tick 8 * do_timer_interrupt_hook - hook into timer tick
8 * @regs: standard registers from interrupt
9 * 9 *
10 * Description: 10 * Call the pit clock event handler. see asm/i8253.h
11 * This hook is called immediately after the timer interrupt is ack'd.
12 * It's primary purpose is to allow architectures that don't possess
13 * individual per CPU clocks (like the CPU APICs supply) to broadcast the
14 * timer interrupt as a means of triggering reschedules etc.
15 **/ 11 **/
16 12
17static inline void do_timer_interrupt_hook(void) 13static inline void do_timer_interrupt_hook(void)
18{ 14{
19 do_timer(1); 15 pit_interrupt_hook();
20#ifndef CONFIG_SMP
21 update_process_times(user_mode_vm(get_irq_regs()));
22#endif
23/*
24 * In the SMP case we use the local APIC timer interrupt to do the
25 * profiling, except when we simulate SMP mode on a uniprocessor
26 * system, in that case we have to call the local interrupt handler.
27 */
28#ifndef CONFIG_X86_LOCAL_APIC
29 profile_tick(CPU_PROFILING);
30#else
31 if (!using_apic_timer)
32 smp_local_timer_interrupt();
33#endif
34}
35
36
37/* you can safely undefine this if you don't have the Neptune chipset */
38
39#define BUGGY_NEPTUN_TIMER
40
41/**
42 * do_timer_overflow - process a detected timer overflow condition
43 * @count: hardware timer interrupt count on overflow
44 *
45 * Description:
46 * This call is invoked when the jiffies count has not incremented but
47 * the hardware timer interrupt has. It means that a timer tick interrupt
48 * came along while the previous one was pending, thus a tick was missed
49 **/
50static inline int do_timer_overflow(int count)
51{
52 int i;
53
54 spin_lock(&i8259A_lock);
55 /*
56 * This is tricky when I/O APICs are used;
57 * see do_timer_interrupt().
58 */
59 i = inb(0x20);
60 spin_unlock(&i8259A_lock);
61
62 /* assumption about timer being IRQ0 */
63 if (i & 0x01) {
64 /*
65 * We cannot detect lost timer interrupts ...
66 * well, that's why we call them lost, don't we? :)
67 * [hmm, on the Pentium and Alpha we can ... sort of]
68 */
69 count -= LATCH;
70 } else {
71#ifdef BUGGY_NEPTUN_TIMER
72 /*
73 * for the Neptun bug we know that the 'latch'
74 * command doesn't latch the high and low value
75 * of the counter atomically. Thus we have to
76 * substract 256 from the counter
77 * ... funny, isnt it? :)
78 */
79
80 count -= 256;
81#else
82 printk("do_slow_gettimeoffset(): hardware timer problem?\n");
83#endif
84 }
85 return count;
86} 16}
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
index 99f66be240be..24990e546da3 100644
--- a/include/asm-i386/mach-es7000/mach_mpparse.h
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -3,13 +3,13 @@
3 3
4#include <linux/acpi.h> 4#include <linux/acpi.h>
5 5
6static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name, 6static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
7 struct mpc_config_translation *translation) 7 struct mpc_config_translation *translation)
8{ 8{
9 Dprintk("Bus #%d is %s\n", m->mpc_busid, name); 9 Dprintk("Bus #%d is %s\n", m->mpc_busid, name);
10} 10}
11 11
12static inline void mpc_oem_pci_bus(struct mpc_config_bus *m, 12static inline void mpc_oem_pci_bus(struct mpc_config_bus *m,
13 struct mpc_config_translation *translation) 13 struct mpc_config_translation *translation)
14{ 14{
15} 15}
@@ -22,7 +22,7 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
22 char *productid) 22 char *productid)
23{ 23{
24 if (mpc->mpc_oemptr) { 24 if (mpc->mpc_oemptr) {
25 struct mp_config_oemtable *oem_table = 25 struct mp_config_oemtable *oem_table =
26 (struct mp_config_oemtable *)mpc->mpc_oemptr; 26 (struct mp_config_oemtable *)mpc->mpc_oemptr;
27 if (!strncmp(oem, "UNISYS", 6)) 27 if (!strncmp(oem, "UNISYS", 6))
28 return parse_unisys_oem((char *)oem_table); 28 return parse_unisys_oem((char *)oem_table);
@@ -31,12 +31,13 @@ static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
31} 31}
32 32
33#ifdef CONFIG_ACPI 33#ifdef CONFIG_ACPI
34
34static inline int es7000_check_dsdt(void) 35static inline int es7000_check_dsdt(void)
35{ 36{
36 struct acpi_table_header *header = NULL; 37 struct acpi_table_header header;
37 if(!acpi_get_table_header_early(ACPI_DSDT, &header)) 38 memcpy(&header, 0, sizeof(struct acpi_table_header));
38 acpi_table_print(header, 0); 39 acpi_get_table_header(ACPI_SIG_DSDT, 0, &header);
39 if (!strncmp(header->oem_id, "UNISYS", 6)) 40 if (!strncmp(header.oem_id, "UNISYS", 6))
40 return 1; 41 return 1;
41 return 0; 42 return 0;
42} 43}
@@ -44,7 +45,7 @@ static inline int es7000_check_dsdt(void)
44/* Hook from generic ACPI tables.c */ 45/* Hook from generic ACPI tables.c */
45static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) 46static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
46{ 47{
47 unsigned long oem_addr; 48 unsigned long oem_addr;
48 if (!find_unisys_acpi_oem_table(&oem_addr)) { 49 if (!find_unisys_acpi_oem_table(&oem_addr)) {
49 if (es7000_check_dsdt()) 50 if (es7000_check_dsdt())
50 return parse_unisys_oem((char *)oem_addr); 51 return parse_unisys_oem((char *)oem_addr);
diff --git a/include/asm-i386/mach-voyager/do_timer.h b/include/asm-i386/mach-voyager/do_timer.h
index 04e69c104a74..60f9dcc15d54 100644
--- a/include/asm-i386/mach-voyager/do_timer.h
+++ b/include/asm-i386/mach-voyager/do_timer.h
@@ -1,25 +1,18 @@
1/* defines for inline arch setup functions */ 1/* defines for inline arch setup functions */
2#include <linux/clockchips.h>
3
2#include <asm/voyager.h> 4#include <asm/voyager.h>
5#include <asm/i8253.h>
3 6
7/**
8 * do_timer_interrupt_hook - hook into timer tick
9 * @regs: standard registers from interrupt
10 *
11 * Call the pit clock event handler. see asm/i8253.h
12 **/
4static inline void do_timer_interrupt_hook(void) 13static inline void do_timer_interrupt_hook(void)
5{ 14{
6 do_timer(1); 15 pit_interrupt_hook();
7#ifndef CONFIG_SMP
8 update_process_times(user_mode_vm(irq_regs));
9#endif
10
11 voyager_timer_interrupt(); 16 voyager_timer_interrupt();
12} 17}
13 18
14static inline int do_timer_overflow(int count)
15{
16 /* can't read the ISR, just assume 1 tick
17 overflow */
18 if(count > LATCH || count < 0) {
19 printk(KERN_ERR "VOYAGER PROBLEM: count is %d, latch is %d\n", count, LATCH);
20 count = LATCH;
21 }
22 count -= LATCH;
23
24 return count;
25}
diff --git a/include/asm-i386/mce.h b/include/asm-i386/mce.h
index 7cc1a973bf00..b0a02ee34ffd 100644
--- a/include/asm-i386/mce.h
+++ b/include/asm-i386/mce.h
@@ -3,3 +3,5 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
3#else 3#else
4#define mcheck_init(c) do {} while(0) 4#define mcheck_init(c) do {} while(0)
5#endif 5#endif
6
7extern int mce_disabled;
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 68ff102d6f5e..e6aa30f8de5b 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -63,7 +63,7 @@ static inline void switch_mm(struct mm_struct *prev,
63} 63}
64 64
65#define deactivate_mm(tsk, mm) \ 65#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%fs": :"r" (0)); 66 asm("movl %0,%%gs": :"r" (0));
67 67
68#define activate_mm(prev, next) \ 68#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 69 switch_mm((prev),(next),NULL)
diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h
index 770bf6da8c3d..f21349399d14 100644
--- a/include/asm-i386/mpspec.h
+++ b/include/asm-i386/mpspec.h
@@ -23,7 +23,6 @@ extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
23extern int mpc_default_type; 23extern int mpc_default_type;
24extern unsigned long mp_lapic_addr; 24extern unsigned long mp_lapic_addr;
25extern int pic_mode; 25extern int pic_mode;
26extern int using_apic_timer;
27 26
28#ifdef CONFIG_ACPI 27#ifdef CONFIG_ACPI
29extern void mp_register_lapic (u8 id, u8 enabled); 28extern void mp_register_lapic (u8 id, u8 enabled);
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index 609a3899475c..2ad3f30b1a68 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -83,6 +83,20 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
83 : "c" (counter)) 83 : "c" (counter))
84#endif /* !CONFIG_PARAVIRT */ 84#endif /* !CONFIG_PARAVIRT */
85 85
86#ifdef CONFIG_SMP
87void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
88void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
89#else /* CONFIG_SMP */
90static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
91{
92 rdmsr(msr_no, *l, *h);
93}
94static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
95{
96 wrmsr(msr_no, l, h);
97}
98#endif /* CONFIG_SMP */
99
86/* symbolic names for some interesting MSRs */ 100/* symbolic names for some interesting MSRs */
87/* Intel defined MSRs. */ 101/* Intel defined MSRs. */
88#define MSR_IA32_P5_MC_ADDR 0 102#define MSR_IA32_P5_MC_ADDR 0
@@ -261,6 +275,8 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
261#define MSR_K7_FID_VID_CTL 0xC0010041 275#define MSR_K7_FID_VID_CTL 0xC0010041
262#define MSR_K7_FID_VID_STATUS 0xC0010042 276#define MSR_K7_FID_VID_STATUS 0xC0010042
263 277
278#define MSR_K8_ENABLE_C1E 0xC0010055
279
264/* extended feature register */ 280/* extended feature register */
265#define MSR_EFER 0xc0000080 281#define MSR_EFER 0xc0000080
266 282
@@ -307,4 +323,7 @@ static inline void wrmsrl (unsigned long msr, unsigned long long val)
307#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f 323#define MSR_CORE_PERF_GLOBAL_CTRL 0x38f
308#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390 324#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x390
309 325
326/* Geode defined MSRs */
327#define MSR_GEODE_BUSCONT_CONF0 0x1900
328
310#endif /* __ASM_MSR_H */ 329#endif /* __ASM_MSR_H */
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 9f06265065f4..e63f1e444fcf 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -59,90 +59,105 @@ struct paravirt_ops
59 convention. This makes it easier to implement inline 59 convention. This makes it easier to implement inline
60 assembler replacements. */ 60 assembler replacements. */
61 61
62 void (fastcall *cpuid)(unsigned int *eax, unsigned int *ebx, 62 void (*cpuid)(unsigned int *eax, unsigned int *ebx,
63 unsigned int *ecx, unsigned int *edx); 63 unsigned int *ecx, unsigned int *edx);
64 64
65 unsigned long (fastcall *get_debugreg)(int regno); 65 unsigned long (*get_debugreg)(int regno);
66 void (fastcall *set_debugreg)(int regno, unsigned long value); 66 void (*set_debugreg)(int regno, unsigned long value);
67 67
68 void (fastcall *clts)(void); 68 void (*clts)(void);
69 69
70 unsigned long (fastcall *read_cr0)(void); 70 unsigned long (*read_cr0)(void);
71 void (fastcall *write_cr0)(unsigned long); 71 void (*write_cr0)(unsigned long);
72 72
73 unsigned long (fastcall *read_cr2)(void); 73 unsigned long (*read_cr2)(void);
74 void (fastcall *write_cr2)(unsigned long); 74 void (*write_cr2)(unsigned long);
75 75
76 unsigned long (fastcall *read_cr3)(void); 76 unsigned long (*read_cr3)(void);
77 void (fastcall *write_cr3)(unsigned long); 77 void (*write_cr3)(unsigned long);
78 78
79 unsigned long (fastcall *read_cr4_safe)(void); 79 unsigned long (*read_cr4_safe)(void);
80 unsigned long (fastcall *read_cr4)(void); 80 unsigned long (*read_cr4)(void);
81 void (fastcall *write_cr4)(unsigned long); 81 void (*write_cr4)(unsigned long);
82 82
83 unsigned long (fastcall *save_fl)(void); 83 unsigned long (*save_fl)(void);
84 void (fastcall *restore_fl)(unsigned long); 84 void (*restore_fl)(unsigned long);
85 void (fastcall *irq_disable)(void); 85 void (*irq_disable)(void);
86 void (fastcall *irq_enable)(void); 86 void (*irq_enable)(void);
87 void (fastcall *safe_halt)(void); 87 void (*safe_halt)(void);
88 void (fastcall *halt)(void); 88 void (*halt)(void);
89 void (fastcall *wbinvd)(void); 89 void (*wbinvd)(void);
90 90
91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ 91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
92 u64 (fastcall *read_msr)(unsigned int msr, int *err); 92 u64 (*read_msr)(unsigned int msr, int *err);
93 int (fastcall *write_msr)(unsigned int msr, u64 val); 93 int (*write_msr)(unsigned int msr, u64 val);
94 94
95 u64 (fastcall *read_tsc)(void); 95 u64 (*read_tsc)(void);
96 u64 (fastcall *read_pmc)(void); 96 u64 (*read_pmc)(void);
97 97 u64 (*get_scheduled_cycles)(void);
98 void (fastcall *load_tr_desc)(void); 98 unsigned long (*get_cpu_khz)(void);
99 void (fastcall *load_gdt)(const struct Xgt_desc_struct *); 99
100 void (fastcall *load_idt)(const struct Xgt_desc_struct *); 100 void (*load_tr_desc)(void);
101 void (fastcall *store_gdt)(struct Xgt_desc_struct *); 101 void (*load_gdt)(const struct Xgt_desc_struct *);
102 void (fastcall *store_idt)(struct Xgt_desc_struct *); 102 void (*load_idt)(const struct Xgt_desc_struct *);
103 void (fastcall *set_ldt)(const void *desc, unsigned entries); 103 void (*store_gdt)(struct Xgt_desc_struct *);
104 unsigned long (fastcall *store_tr)(void); 104 void (*store_idt)(struct Xgt_desc_struct *);
105 void (fastcall *load_tls)(struct thread_struct *t, unsigned int cpu); 105 void (*set_ldt)(const void *desc, unsigned entries);
106 void (fastcall *write_ldt_entry)(void *dt, int entrynum, 106 unsigned long (*store_tr)(void);
107 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
108 void (*write_ldt_entry)(void *dt, int entrynum,
107 u32 low, u32 high); 109 u32 low, u32 high);
108 void (fastcall *write_gdt_entry)(void *dt, int entrynum, 110 void (*write_gdt_entry)(void *dt, int entrynum,
109 u32 low, u32 high); 111 u32 low, u32 high);
110 void (fastcall *write_idt_entry)(void *dt, int entrynum, 112 void (*write_idt_entry)(void *dt, int entrynum,
111 u32 low, u32 high); 113 u32 low, u32 high);
112 void (fastcall *load_esp0)(struct tss_struct *tss, 114 void (*load_esp0)(struct tss_struct *tss,
113 struct thread_struct *thread); 115 struct thread_struct *thread);
114 116
115 void (fastcall *set_iopl_mask)(unsigned mask); 117 void (*set_iopl_mask)(unsigned mask);
116 118
117 void (fastcall *io_delay)(void); 119 void (*io_delay)(void);
118 void (*const_udelay)(unsigned long loops);
119 120
120#ifdef CONFIG_X86_LOCAL_APIC 121#ifdef CONFIG_X86_LOCAL_APIC
121 void (fastcall *apic_write)(unsigned long reg, unsigned long v); 122 void (*apic_write)(unsigned long reg, unsigned long v);
122 void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v); 123 void (*apic_write_atomic)(unsigned long reg, unsigned long v);
123 unsigned long (fastcall *apic_read)(unsigned long reg); 124 unsigned long (*apic_read)(unsigned long reg);
125 void (*setup_boot_clock)(void);
126 void (*setup_secondary_clock)(void);
124#endif 127#endif
125 128
126 void (fastcall *flush_tlb_user)(void); 129 void (*flush_tlb_user)(void);
127 void (fastcall *flush_tlb_kernel)(void); 130 void (*flush_tlb_kernel)(void);
128 void (fastcall *flush_tlb_single)(u32 addr); 131 void (*flush_tlb_single)(u32 addr);
129 132
130 void (fastcall *set_pte)(pte_t *ptep, pte_t pteval); 133 void (*map_pt_hook)(int type, pte_t *va, u32 pfn);
131 void (fastcall *set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval); 134
132 void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval); 135 void (*alloc_pt)(u32 pfn);
133 void (fastcall *pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep); 136 void (*alloc_pd)(u32 pfn);
134 void (fastcall *pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep); 137 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
138 void (*release_pt)(u32 pfn);
139 void (*release_pd)(u32 pfn);
140
141 void (*set_pte)(pte_t *ptep, pte_t pteval);
142 void (*set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval);
143 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
144 void (*pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep);
145 void (*pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep);
135#ifdef CONFIG_X86_PAE 146#ifdef CONFIG_X86_PAE
136 void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval); 147 void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
137 void (fastcall *set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); 148 void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
138 void (fastcall *set_pud)(pud_t *pudp, pud_t pudval); 149 void (*set_pud)(pud_t *pudp, pud_t pudval);
139 void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 150 void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
140 void (fastcall *pmd_clear)(pmd_t *pmdp); 151 void (*pmd_clear)(pmd_t *pmdp);
141#endif 152#endif
142 153
154 void (*set_lazy_mode)(int mode);
155
143 /* These two are jmp to, not actually called. */ 156 /* These two are jmp to, not actually called. */
144 void (fastcall *irq_enable_sysexit)(void); 157 void (*irq_enable_sysexit)(void);
145 void (fastcall *iret)(void); 158 void (*iret)(void);
159
160 void (*startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp);
146}; 161};
147 162
148/* Mark a paravirt probe function. */ 163/* Mark a paravirt probe function. */
@@ -171,9 +186,9 @@ static inline int set_wallclock(unsigned long nowtime)
171 return paravirt_ops.set_wallclock(nowtime); 186 return paravirt_ops.set_wallclock(nowtime);
172} 187}
173 188
174static inline void do_time_init(void) 189static inline void (*choose_time_init(void))(void)
175{ 190{
176 return paravirt_ops.time_init(); 191 return paravirt_ops.time_init;
177} 192}
178 193
179/* The paravirtualized CPUID instruction. */ 194/* The paravirtualized CPUID instruction. */
@@ -261,6 +276,9 @@ static inline void halt(void)
261 276
262#define rdtscll(val) (val = paravirt_ops.read_tsc()) 277#define rdtscll(val) (val = paravirt_ops.read_tsc())
263 278
279#define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles())
280#define calculate_cpu_khz() (paravirt_ops.get_cpu_khz())
281
264#define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 282#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)
265 283
266#define rdpmc(counter,low,high) do { \ 284#define rdpmc(counter,low,high) do { \
@@ -313,13 +331,40 @@ static inline unsigned long apic_read(unsigned long reg)
313{ 331{
314 return paravirt_ops.apic_read(reg); 332 return paravirt_ops.apic_read(reg);
315} 333}
334
335static inline void setup_boot_clock(void)
336{
337 paravirt_ops.setup_boot_clock();
338}
339
340static inline void setup_secondary_clock(void)
341{
342 paravirt_ops.setup_secondary_clock();
343}
316#endif 344#endif
317 345
346#ifdef CONFIG_SMP
347static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
348 unsigned long start_esp)
349{
350 return paravirt_ops.startup_ipi_hook(phys_apicid, start_eip, start_esp);
351}
352#endif
318 353
319#define __flush_tlb() paravirt_ops.flush_tlb_user() 354#define __flush_tlb() paravirt_ops.flush_tlb_user()
320#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() 355#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
321#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) 356#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr)
322 357
358#define paravirt_map_pt_hook(type, va, pfn) paravirt_ops.map_pt_hook(type, va, pfn)
359
360#define paravirt_alloc_pt(pfn) paravirt_ops.alloc_pt(pfn)
361#define paravirt_release_pt(pfn) paravirt_ops.release_pt(pfn)
362
363#define paravirt_alloc_pd(pfn) paravirt_ops.alloc_pd(pfn)
364#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) \
365 paravirt_ops.alloc_pd_clone(pfn, clonepfn, start, count)
366#define paravirt_release_pd(pfn) paravirt_ops.release_pd(pfn)
367
323static inline void set_pte(pte_t *ptep, pte_t pteval) 368static inline void set_pte(pte_t *ptep, pte_t pteval)
324{ 369{
325 paravirt_ops.set_pte(ptep, pteval); 370 paravirt_ops.set_pte(ptep, pteval);
@@ -372,6 +417,22 @@ static inline void pmd_clear(pmd_t *pmdp)
372} 417}
373#endif 418#endif
374 419
420/* Lazy mode for batching updates / context switch */
421#define PARAVIRT_LAZY_NONE 0
422#define PARAVIRT_LAZY_MMU 1
423#define PARAVIRT_LAZY_CPU 2
424#define PARAVIRT_LAZY_FLUSH 3
425
426#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
427#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
428#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
429#define arch_flush_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
430
431#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
432#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
433#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
434#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
435
375/* These all sit in the .parainstructions section to tell us what to patch. */ 436/* These all sit in the .parainstructions section to tell us what to patch. */
376struct paravirt_patch { 437struct paravirt_patch {
377 u8 *instr; /* original instructions */ 438 u8 *instr; /* original instructions */
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h
index 2ba2736aa109..b12d59a318b7 100644
--- a/include/asm-i386/pda.h
+++ b/include/asm-i386/pda.h
@@ -39,19 +39,19 @@ extern struct i386_pda _proxy_pda;
39 if (0) { T__ tmp__; tmp__ = (val); } \ 39 if (0) { T__ tmp__; tmp__ = (val); } \
40 switch (sizeof(_proxy_pda.field)) { \ 40 switch (sizeof(_proxy_pda.field)) { \
41 case 1: \ 41 case 1: \
42 asm(op "b %1,%%gs:%c2" \ 42 asm(op "b %1,%%fs:%c2" \
43 : "+m" (_proxy_pda.field) \ 43 : "+m" (_proxy_pda.field) \
44 :"ri" ((T__)val), \ 44 :"ri" ((T__)val), \
45 "i"(pda_offset(field))); \ 45 "i"(pda_offset(field))); \
46 break; \ 46 break; \
47 case 2: \ 47 case 2: \
48 asm(op "w %1,%%gs:%c2" \ 48 asm(op "w %1,%%fs:%c2" \
49 : "+m" (_proxy_pda.field) \ 49 : "+m" (_proxy_pda.field) \
50 :"ri" ((T__)val), \ 50 :"ri" ((T__)val), \
51 "i"(pda_offset(field))); \ 51 "i"(pda_offset(field))); \
52 break; \ 52 break; \
53 case 4: \ 53 case 4: \
54 asm(op "l %1,%%gs:%c2" \ 54 asm(op "l %1,%%fs:%c2" \
55 : "+m" (_proxy_pda.field) \ 55 : "+m" (_proxy_pda.field) \
56 :"ri" ((T__)val), \ 56 :"ri" ((T__)val), \
57 "i"(pda_offset(field))); \ 57 "i"(pda_offset(field))); \
@@ -65,19 +65,19 @@ extern struct i386_pda _proxy_pda;
65 typeof(_proxy_pda.field) ret__; \ 65 typeof(_proxy_pda.field) ret__; \
66 switch (sizeof(_proxy_pda.field)) { \ 66 switch (sizeof(_proxy_pda.field)) { \
67 case 1: \ 67 case 1: \
68 asm(op "b %%gs:%c1,%0" \ 68 asm(op "b %%fs:%c1,%0" \
69 : "=r" (ret__) \ 69 : "=r" (ret__) \
70 : "i" (pda_offset(field)), \ 70 : "i" (pda_offset(field)), \
71 "m" (_proxy_pda.field)); \ 71 "m" (_proxy_pda.field)); \
72 break; \ 72 break; \
73 case 2: \ 73 case 2: \
74 asm(op "w %%gs:%c1,%0" \ 74 asm(op "w %%fs:%c1,%0" \
75 : "=r" (ret__) \ 75 : "=r" (ret__) \
76 : "i" (pda_offset(field)), \ 76 : "i" (pda_offset(field)), \
77 "m" (_proxy_pda.field)); \ 77 "m" (_proxy_pda.field)); \
78 break; \ 78 break; \
79 case 4: \ 79 case 4: \
80 asm(op "l %%gs:%c1,%0" \ 80 asm(op "l %%fs:%c1,%0" \
81 : "=r" (ret__) \ 81 : "=r" (ret__) \
82 : "i" (pda_offset(field)), \ 82 : "i" (pda_offset(field)), \
83 "m" (_proxy_pda.field)); \ 83 "m" (_proxy_pda.field)); \
diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h
index 4b1e61359f89..c8dc2d0141a7 100644
--- a/include/asm-i386/pgalloc.h
+++ b/include/asm-i386/pgalloc.h
@@ -5,13 +5,31 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/mm.h> /* for struct page */ 6#include <linux/mm.h> /* for struct page */
7 7
8#define pmd_populate_kernel(mm, pmd, pte) \ 8#ifdef CONFIG_PARAVIRT
9 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) 9#include <asm/paravirt.h>
10#else
11#define paravirt_alloc_pt(pfn) do { } while (0)
12#define paravirt_alloc_pd(pfn) do { } while (0)
13#define paravirt_alloc_pd(pfn) do { } while (0)
14#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
15#define paravirt_release_pt(pfn) do { } while (0)
16#define paravirt_release_pd(pfn) do { } while (0)
17#endif
18
19#define pmd_populate_kernel(mm, pmd, pte) \
20do { \
21 paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
22 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
23} while (0)
10 24
11#define pmd_populate(mm, pmd, pte) \ 25#define pmd_populate(mm, pmd, pte) \
26do { \
27 paravirt_alloc_pt(page_to_pfn(pte)); \
12 set_pmd(pmd, __pmd(_PAGE_TABLE + \ 28 set_pmd(pmd, __pmd(_PAGE_TABLE + \
13 ((unsigned long long)page_to_pfn(pte) << \ 29 ((unsigned long long)page_to_pfn(pte) << \
14 (unsigned long long) PAGE_SHIFT))) 30 (unsigned long long) PAGE_SHIFT))); \
31} while (0)
32
15/* 33/*
16 * Allocate and free page tables. 34 * Allocate and free page tables.
17 */ 35 */
@@ -32,7 +50,11 @@ static inline void pte_free(struct page *pte)
32} 50}
33 51
34 52
35#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 53#define __pte_free_tlb(tlb,pte) \
54do { \
55 paravirt_release_pt(page_to_pfn(pte)); \
56 tlb_remove_page((tlb),(pte)); \
57} while (0)
36 58
37#ifdef CONFIG_X86_PAE 59#ifdef CONFIG_X86_PAE
38/* 60/*
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index e6a4723f0eb1..c3b58d473a55 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -263,6 +263,7 @@ static inline pte_t pte_mkhuge(pte_t pte) { (pte).pte_low |= _PAGE_PSE; return p
263 */ 263 */
264#define pte_update(mm, addr, ptep) do { } while (0) 264#define pte_update(mm, addr, ptep) do { } while (0)
265#define pte_update_defer(mm, addr, ptep) do { } while (0) 265#define pte_update_defer(mm, addr, ptep) do { } while (0)
266#define paravirt_map_pt_hook(slot, va, pfn) do { } while (0)
266#endif 267#endif
267 268
268/* 269/*
@@ -469,10 +470,24 @@ extern pte_t *lookup_address(unsigned long address);
469#endif 470#endif
470 471
471#if defined(CONFIG_HIGHPTE) 472#if defined(CONFIG_HIGHPTE)
472#define pte_offset_map(dir, address) \ 473#define pte_offset_map(dir, address) \
473 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) 474({ \
474#define pte_offset_map_nested(dir, address) \ 475 pte_t *__ptep; \
475 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address)) 476 unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \
477 __ptep = (pte_t *)kmap_atomic(pfn_to_page(pfn),KM_PTE0);\
478 paravirt_map_pt_hook(KM_PTE0,__ptep, pfn); \
479 __ptep = __ptep + pte_index(address); \
480 __ptep; \
481})
482#define pte_offset_map_nested(dir, address) \
483({ \
484 pte_t *__ptep; \
485 unsigned pfn = pmd_val(*(dir)) >> PAGE_SHIFT; \
486 __ptep = (pte_t *)kmap_atomic(pfn_to_page(pfn),KM_PTE1);\
487 paravirt_map_pt_hook(KM_PTE1,__ptep, pfn); \
488 __ptep = __ptep + pte_index(address); \
489 __ptep; \
490})
476#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0) 491#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
477#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1) 492#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
478#else 493#else
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 359f10b54f59..11bf899de8aa 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -424,7 +424,7 @@ struct thread_struct {
424 .vm86_info = NULL, \ 424 .vm86_info = NULL, \
425 .sysenter_cs = __KERNEL_CS, \ 425 .sysenter_cs = __KERNEL_CS, \
426 .io_bitmap_ptr = NULL, \ 426 .io_bitmap_ptr = NULL, \
427 .gs = __KERNEL_PDA, \ 427 .fs = __KERNEL_PDA, \
428} 428}
429 429
430/* 430/*
@@ -442,8 +442,8 @@ struct thread_struct {
442} 442}
443 443
444#define start_thread(regs, new_eip, new_esp) do { \ 444#define start_thread(regs, new_eip, new_esp) do { \
445 __asm__("movl %0,%%fs": :"r" (0)); \ 445 __asm__("movl %0,%%gs": :"r" (0)); \
446 regs->xgs = 0; \ 446 regs->xfs = 0; \
447 set_fs(USER_DS); \ 447 set_fs(USER_DS); \
448 regs->xds = __USER_DS; \ 448 regs->xds = __USER_DS; \
449 regs->xes = __USER_DS; \ 449 regs->xes = __USER_DS; \
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index bdbc894339b4..6002597b9e12 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -16,8 +16,8 @@ struct pt_regs {
16 long eax; 16 long eax;
17 int xds; 17 int xds;
18 int xes; 18 int xes;
19 /* int xfs; */ 19 int xfs;
20 int xgs; 20 /* int xgs; */
21 long orig_eax; 21 long orig_eax;
22 long eip; 22 long eip;
23 int xcs; 23 int xcs;
@@ -49,6 +49,10 @@ static inline int user_mode_vm(struct pt_regs *regs)
49{ 49{
50 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; 50 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
51} 51}
52static inline int v8086_mode(struct pt_regs *regs)
53{
54 return (regs->eflags & VM_MASK);
55}
52 56
53#define instruction_pointer(regs) ((regs)->eip) 57#define instruction_pointer(regs) ((regs)->eip)
54#define regs_return_value(regs) ((regs)->eax) 58#define regs_return_value(regs) ((regs)->eax)
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index 3c796af33776..065f10bfa487 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -83,14 +83,8 @@
83 * The GDT has 32 entries 83 * The GDT has 32 entries
84 */ 84 */
85#define GDT_ENTRIES 32 85#define GDT_ENTRIES 32
86
87#define GDT_SIZE (GDT_ENTRIES * 8) 86#define GDT_SIZE (GDT_ENTRIES * 8)
88 87
89/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
90#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
91/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
92#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
93
94/* Simple and small GDT entries for booting only */ 88/* Simple and small GDT entries for booting only */
95 89
96#define GDT_ENTRY_BOOT_CS 2 90#define GDT_ENTRY_BOOT_CS 2
@@ -134,4 +128,17 @@
134#ifndef CONFIG_PARAVIRT 128#ifndef CONFIG_PARAVIRT
135#define get_kernel_rpl() 0 129#define get_kernel_rpl() 0
136#endif 130#endif
131/*
132 * Matching rules for certain types of segments.
133 */
134
135/* Matches only __KERNEL_CS, ignoring PnP / USER / APM segments */
136#define SEGMENT_IS_KERNEL_CODE(x) (((x) & 0xfc) == GDT_ENTRY_KERNEL_CS * 8)
137
138/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
139#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
140
141/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
142#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
143
137#endif 144#endif
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 67659dbaf120..0e8077cbfdac 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -6,7 +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#define COMMAND_LINE_SIZE 256 9#define COMMAND_LINE_SIZE 2048
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <linux/pfn.h> 12#include <linux/pfn.h>
@@ -77,6 +77,8 @@ int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
77void __init add_memory_region(unsigned long long start, 77void __init add_memory_region(unsigned long long start,
78 unsigned long long size, int type); 78 unsigned long long size, int type);
79 79
80extern unsigned long init_pg_tables_end;
81
80#endif /* __ASSEMBLY__ */ 82#endif /* __ASSEMBLY__ */
81 83
82#endif /* __KERNEL__ */ 84#endif /* __KERNEL__ */
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 64fe624c02ca..6bf0033a301c 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -52,6 +52,11 @@ extern void cpu_exit_clear(void);
52extern void cpu_uninit(void); 52extern void cpu_uninit(void);
53#endif 53#endif
54 54
55#ifndef CONFIG_PARAVIRT
56#define startup_ipi_hook(phys_apicid, start_eip, start_esp) \
57do { } while (0)
58#endif
59
55/* 60/*
56 * This function is needed by all SMP systems. It must _always_ be valid 61 * This function is needed by all SMP systems. It must _always_ be valid
57 * from the initial startup. We map APIC_BASE very early in page_setup(), 62 * from the initial startup. We map APIC_BASE very early in page_setup(),
diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 5755d57c4e95..99ca648b94c5 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-i386/sockios.h b/include/asm-i386/sockios.h
index 6b747f8e228b..ff528c7d255c 100644
--- a/include/asm-i386/sockios.h
+++ b/include/asm-i386/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-i386/sync_bitops.h b/include/asm-i386/sync_bitops.h
index c94d51c993ee..7d72351bea75 100644
--- a/include/asm-i386/sync_bitops.h
+++ b/include/asm-i386/sync_bitops.h
@@ -130,7 +130,7 @@ static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr)
130 return oldbit; 130 return oldbit;
131} 131}
132 132
133static __always_inline int sync_const_test_bit(int nr, const volatile unsigned long *addr) 133static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr)
134{ 134{
135 return ((1UL << (nr & 31)) & 135 return ((1UL << (nr & 31)) &
136 (((const volatile unsigned int *)addr)[nr >> 5])) != 0; 136 (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
diff --git a/include/asm-i386/termbits.h b/include/asm-i386/termbits.h
index 12baf1d6343f..2e6237693814 100644
--- a/include/asm-i386/termbits.h
+++ b/include/asm-i386/termbits.h
@@ -144,7 +144,7 @@ struct ktermios {
144#define B3000000 0010015 144#define B3000000 0010015
145#define B3500000 0010016 145#define B3500000 0010016
146#define B4000000 0010017 146#define B4000000 0010017
147#define CIBAUD 002003600000 /* input baud rate (not used) */ 147#define CIBAUD 002003600000
148#define CMSPAR 010000000000 /* mark or space (stick) parity */ 148#define CMSPAR 010000000000 /* mark or space (stick) parity */
149#define CRTSCTS 020000000000 /* flow control */ 149#define CRTSCTS 020000000000 /* flow control */
150 150
diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h
index 03f548536d6b..7c99678a8f86 100644
--- a/include/asm-i386/termios.h
+++ b/include/asm-i386/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14 /* synchronous PPP */
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61#include <linux/module.h> 43#include <linux/module.h>
62 44
diff --git a/include/asm-i386/time.h b/include/asm-i386/time.h
index ea8065af825a..eac011366dc2 100644
--- a/include/asm-i386/time.h
+++ b/include/asm-i386/time.h
@@ -28,13 +28,16 @@ static inline int native_set_wallclock(unsigned long nowtime)
28 return retval; 28 return retval;
29} 29}
30 30
31extern void (*late_time_init)(void);
32extern void hpet_time_init(void);
33
31#ifdef CONFIG_PARAVIRT 34#ifdef CONFIG_PARAVIRT
32#include <asm/paravirt.h> 35#include <asm/paravirt.h>
33#else /* !CONFIG_PARAVIRT */ 36#else /* !CONFIG_PARAVIRT */
34 37
35#define get_wallclock() native_get_wallclock() 38#define get_wallclock() native_get_wallclock()
36#define set_wallclock(x) native_set_wallclock(x) 39#define set_wallclock(x) native_set_wallclock(x)
37#define do_time_init() time_init_hook() 40#define choose_time_init() hpet_time_init
38 41
39#endif /* CONFIG_PARAVIRT */ 42#endif /* CONFIG_PARAVIRT */
40 43
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index d0ebd05f8516..12dd67bf760f 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -4,10 +4,21 @@
4#include <linux/pm.h> 4#include <linux/pm.h>
5 5
6#define TICK_SIZE (tick_nsec / 1000) 6#define TICK_SIZE (tick_nsec / 1000)
7
7void setup_pit_timer(void); 8void setup_pit_timer(void);
9unsigned long long native_sched_clock(void);
10unsigned long native_calculate_cpu_khz(void);
11
8/* Modifiers for buggy PIT handling */ 12/* Modifiers for buggy PIT handling */
9extern int pit_latch_buggy; 13extern int pit_latch_buggy;
10extern int timer_ack; 14extern int timer_ack;
15extern int no_timer_check;
16extern int no_sync_cmos_clock;
11extern int recalibrate_cpu_khz(void); 17extern int recalibrate_cpu_khz(void);
12 18
19#ifndef CONFIG_PARAVIRT
20#define get_scheduled_cycles(val) rdtscll(val)
21#define calculate_cpu_khz() native_calculate_cpu_khz()
22#endif
23
13#endif 24#endif
diff --git a/include/asm-i386/topology.h b/include/asm-i386/topology.h
index ac58580ad664..7fc512d90ea8 100644
--- a/include/asm-i386/topology.h
+++ b/include/asm-i386/topology.h
@@ -85,7 +85,6 @@ static inline int node_to_first_cpu(int node)
85 .idle_idx = 1, \ 85 .idle_idx = 1, \
86 .newidle_idx = 2, \ 86 .newidle_idx = 2, \
87 .wake_idx = 1, \ 87 .wake_idx = 1, \
88 .per_cpu_gain = 100, \
89 .flags = SD_LOAD_BALANCE \ 88 .flags = SD_LOAD_BALANCE \
90 | SD_BALANCE_EXEC \ 89 | SD_BALANCE_EXEC \
91 | SD_BALANCE_FORK \ 90 | SD_BALANCE_FORK \
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index c13933185c1c..84016ff481b9 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -9,18 +9,7 @@
9#include <asm/processor.h> 9#include <asm/processor.h>
10 10
11/* 11/*
12 * Standard way to access the cycle counter on i586+ CPUs. 12 * Standard way to access the cycle counter.
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 */ 13 */
25typedef unsigned long long cycles_t; 14typedef unsigned long long cycles_t;
26 15
@@ -42,7 +31,37 @@ static inline cycles_t get_cycles(void)
42 return ret; 31 return ret;
43} 32}
44 33
34/* Like get_cycles, but make sure the CPU is synchronized. */
35static __always_inline cycles_t get_cycles_sync(void)
36{
37 unsigned long long ret;
38#ifdef X86_FEATURE_SYNC_RDTSC
39 unsigned eax;
40
41 /*
42 * Don't do an additional sync on CPUs where we know
43 * RDTSC is already synchronous:
44 */
45 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
46 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
47#else
48 sync_core();
49#endif
50 rdtscll(ret);
51
52 return ret;
53}
54
45extern void tsc_init(void); 55extern void tsc_init(void);
46extern void mark_tsc_unstable(void); 56extern void mark_tsc_unstable(void);
57extern int unsynchronized_tsc(void);
58extern void init_tsc_clocksource(void);
59
60/*
61 * Boot-time check whether the TSCs are synchronized across
62 * all CPUs/cores:
63 */
64extern void check_tsc_sync_source(int cpu);
65extern void check_tsc_sync_target(void);
47 66
48#endif 67#endif
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index eef5133b9ce2..70829ae3ad52 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -54,10 +54,10 @@ extern struct movsl_mask {
54 * This needs 33-bit arithmetic. We have a carry... 54 * This needs 33-bit arithmetic. We have a carry...
55 */ 55 */
56#define __range_ok(addr,size) ({ \ 56#define __range_ok(addr,size) ({ \
57 unsigned long flag,sum; \ 57 unsigned long flag,roksum; \
58 __chk_user_ptr(addr); \ 58 __chk_user_ptr(addr); \
59 asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \ 59 asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
60 :"=&r" (flag), "=r" (sum) \ 60 :"=&r" (flag), "=r" (roksum) \
61 :"1" (addr),"g" ((int)(size)),"rm" (current_thread_info()->addr_limit.seg)); \ 61 :"1" (addr),"g" ((int)(size)),"rm" (current_thread_info()->addr_limit.seg)); \
62 flag; }) 62 flag; })
63 63
diff --git a/include/asm-i386/vmi.h b/include/asm-i386/vmi.h
new file mode 100644
index 000000000000..eb8bd892c01e
--- /dev/null
+++ b/include/asm-i386/vmi.h
@@ -0,0 +1,263 @@
1/*
2 * VMI interface definition
3 *
4 * Copyright (C) 2005, VMware, 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 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, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Maintained by: Zachary Amsden zach@vmware.com
22 *
23 */
24#include <linux/types.h>
25
26/*
27 *---------------------------------------------------------------------
28 *
29 * VMI Option ROM API
30 *
31 *---------------------------------------------------------------------
32 */
33#define VMI_SIGNATURE 0x696d5663 /* "cVmi" */
34
35#define PCI_VENDOR_ID_VMWARE 0x15AD
36#define PCI_DEVICE_ID_VMWARE_VMI 0x0801
37
38/*
39 * We use two version numbers for compatibility, with the major
40 * number signifying interface breakages, and the minor number
41 * interface extensions.
42 */
43#define VMI_API_REV_MAJOR 3
44#define VMI_API_REV_MINOR 0
45
46#define VMI_CALL_CPUID 0
47#define VMI_CALL_WRMSR 1
48#define VMI_CALL_RDMSR 2
49#define VMI_CALL_SetGDT 3
50#define VMI_CALL_SetLDT 4
51#define VMI_CALL_SetIDT 5
52#define VMI_CALL_SetTR 6
53#define VMI_CALL_GetGDT 7
54#define VMI_CALL_GetLDT 8
55#define VMI_CALL_GetIDT 9
56#define VMI_CALL_GetTR 10
57#define VMI_CALL_WriteGDTEntry 11
58#define VMI_CALL_WriteLDTEntry 12
59#define VMI_CALL_WriteIDTEntry 13
60#define VMI_CALL_UpdateKernelStack 14
61#define VMI_CALL_SetCR0 15
62#define VMI_CALL_SetCR2 16
63#define VMI_CALL_SetCR3 17
64#define VMI_CALL_SetCR4 18
65#define VMI_CALL_GetCR0 19
66#define VMI_CALL_GetCR2 20
67#define VMI_CALL_GetCR3 21
68#define VMI_CALL_GetCR4 22
69#define VMI_CALL_WBINVD 23
70#define VMI_CALL_SetDR 24
71#define VMI_CALL_GetDR 25
72#define VMI_CALL_RDPMC 26
73#define VMI_CALL_RDTSC 27
74#define VMI_CALL_CLTS 28
75#define VMI_CALL_EnableInterrupts 29
76#define VMI_CALL_DisableInterrupts 30
77#define VMI_CALL_GetInterruptMask 31
78#define VMI_CALL_SetInterruptMask 32
79#define VMI_CALL_IRET 33
80#define VMI_CALL_SYSEXIT 34
81#define VMI_CALL_Halt 35
82#define VMI_CALL_Reboot 36
83#define VMI_CALL_Shutdown 37
84#define VMI_CALL_SetPxE 38
85#define VMI_CALL_SetPxELong 39
86#define VMI_CALL_UpdatePxE 40
87#define VMI_CALL_UpdatePxELong 41
88#define VMI_CALL_MachineToPhysical 42
89#define VMI_CALL_PhysicalToMachine 43
90#define VMI_CALL_AllocatePage 44
91#define VMI_CALL_ReleasePage 45
92#define VMI_CALL_InvalPage 46
93#define VMI_CALL_FlushTLB 47
94#define VMI_CALL_SetLinearMapping 48
95
96#define VMI_CALL_SetIOPLMask 61
97#define VMI_CALL_SetInitialAPState 62
98#define VMI_CALL_APICWrite 63
99#define VMI_CALL_APICRead 64
100#define VMI_CALL_IODelay 65
101#define VMI_CALL_SetLazyMode 73
102
103/*
104 *---------------------------------------------------------------------
105 *
106 * MMU operation flags
107 *
108 *---------------------------------------------------------------------
109 */
110
111/* Flags used by VMI_{Allocate|Release}Page call */
112#define VMI_PAGE_PAE 0x10 /* Allocate PAE shadow */
113#define VMI_PAGE_CLONE 0x20 /* Clone from another shadow */
114#define VMI_PAGE_ZEROED 0x40 /* Page is pre-zeroed */
115
116
117/* Flags shared by Allocate|Release Page and PTE updates */
118#define VMI_PAGE_PT 0x01
119#define VMI_PAGE_PD 0x02
120#define VMI_PAGE_PDP 0x04
121#define VMI_PAGE_PML4 0x08
122
123#define VMI_PAGE_NORMAL 0x00 /* for debugging */
124
125/* Flags used by PTE updates */
126#define VMI_PAGE_CURRENT_AS 0x10 /* implies VMI_PAGE_VA_MASK is valid */
127#define VMI_PAGE_DEFER 0x20 /* may queue update until TLB inval */
128#define VMI_PAGE_VA_MASK 0xfffff000
129
130#ifdef CONFIG_X86_PAE
131#define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
132#define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
133#else
134#define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_ZEROED)
135#define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_ZEROED)
136#endif
137
138/* Flags used by VMI_FlushTLB call */
139#define VMI_FLUSH_TLB 0x01
140#define VMI_FLUSH_GLOBAL 0x02
141
142/*
143 *---------------------------------------------------------------------
144 *
145 * VMI relocation definitions for ROM call get_reloc
146 *
147 *---------------------------------------------------------------------
148 */
149
150/* VMI Relocation types */
151#define VMI_RELOCATION_NONE 0
152#define VMI_RELOCATION_CALL_REL 1
153#define VMI_RELOCATION_JUMP_REL 2
154#define VMI_RELOCATION_NOP 3
155
156#ifndef __ASSEMBLY__
157struct vmi_relocation_info {
158 unsigned char *eip;
159 unsigned char type;
160 unsigned char reserved[3];
161};
162#endif
163
164
165/*
166 *---------------------------------------------------------------------
167 *
168 * Generic ROM structures and definitions
169 *
170 *---------------------------------------------------------------------
171 */
172
173#ifndef __ASSEMBLY__
174
175struct vrom_header {
176 u16 rom_signature; // option ROM signature
177 u8 rom_length; // ROM length in 512 byte chunks
178 u8 rom_entry[4]; // 16-bit code entry point
179 u8 rom_pad0; // 4-byte align pad
180 u32 vrom_signature; // VROM identification signature
181 u8 api_version_min;// Minor version of API
182 u8 api_version_maj;// Major version of API
183 u8 jump_slots; // Number of jump slots
184 u8 reserved1; // Reserved for expansion
185 u32 virtual_top; // Hypervisor virtual address start
186 u16 reserved2; // Reserved for expansion
187 u16 license_offs; // Offset to License string
188 u16 pci_header_offs;// Offset to PCI OPROM header
189 u16 pnp_header_offs;// Offset to PnP OPROM header
190 u32 rom_pad3; // PnP reserverd / VMI reserved
191 u8 reserved[96]; // Reserved for headers
192 char vmi_init[8]; // VMI_Init jump point
193 char get_reloc[8]; // VMI_GetRelocationInfo jump point
194} __attribute__((packed));
195
196struct pnp_header {
197 char sig[4];
198 char rev;
199 char size;
200 short next;
201 short res;
202 long devID;
203 unsigned short manufacturer_offset;
204 unsigned short product_offset;
205} __attribute__((packed));
206
207struct pci_header {
208 char sig[4];
209 short vendorID;
210 short deviceID;
211 short vpdData;
212 short size;
213 char rev;
214 char class;
215 char subclass;
216 char interface;
217 short chunks;
218 char rom_version_min;
219 char rom_version_maj;
220 char codetype;
221 char lastRom;
222 short reserved;
223} __attribute__((packed));
224
225/* Function prototypes for bootstrapping */
226extern void vmi_init(void);
227extern void vmi_bringup(void);
228extern void vmi_apply_boot_page_allocations(void);
229
230/* State needed to start an application processor in an SMP system. */
231struct vmi_ap_state {
232 u32 cr0;
233 u32 cr2;
234 u32 cr3;
235 u32 cr4;
236
237 u64 efer;
238
239 u32 eip;
240 u32 eflags;
241 u32 eax;
242 u32 ebx;
243 u32 ecx;
244 u32 edx;
245 u32 esp;
246 u32 ebp;
247 u32 esi;
248 u32 edi;
249 u16 cs;
250 u16 ss;
251 u16 ds;
252 u16 es;
253 u16 fs;
254 u16 gs;
255 u16 ldtr;
256
257 u16 gdtr_limit;
258 u32 gdtr_base;
259 u32 idtr_base;
260 u16 idtr_limit;
261};
262
263#endif
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h
new file mode 100644
index 000000000000..c3a1fcf66c96
--- /dev/null
+++ b/include/asm-i386/vmi_time.h
@@ -0,0 +1,112 @@
1/*
2 * VMI Time wrappers
3 *
4 * Copyright (C) 2006, VMware, 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 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, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Send feedback to dhecht@vmware.com
22 *
23 */
24
25#ifndef __VMI_TIME_H
26#define __VMI_TIME_H
27
28/*
29 * Raw VMI call indices for timer functions
30 */
31#define VMI_CALL_GetCycleFrequency 66
32#define VMI_CALL_GetCycleCounter 67
33#define VMI_CALL_SetAlarm 68
34#define VMI_CALL_CancelAlarm 69
35#define VMI_CALL_GetWallclockTime 70
36#define VMI_CALL_WallclockUpdated 71
37
38/* Cached VMI timer operations */
39extern struct vmi_timer_ops {
40 u64 (*get_cycle_frequency)(void);
41 u64 (*get_cycle_counter)(int);
42 u64 (*get_wallclock)(void);
43 int (*wallclock_updated)(void);
44 void (*set_alarm)(u32 flags, u64 expiry, u64 period);
45 void (*cancel_alarm)(u32 flags);
46} vmi_timer_ops;
47
48/* Prototypes */
49extern void __init vmi_time_init(void);
50extern unsigned long vmi_get_wallclock(void);
51extern int vmi_set_wallclock(unsigned long now);
52extern unsigned long long vmi_get_sched_cycles(void);
53extern unsigned long vmi_cpu_khz(void);
54
55#ifdef CONFIG_X86_LOCAL_APIC
56extern void __init vmi_timer_setup_boot_alarm(void);
57extern void __devinit vmi_timer_setup_secondary_alarm(void);
58extern void apic_vmi_timer_interrupt(void);
59#endif
60
61#ifdef CONFIG_NO_IDLE_HZ
62extern int vmi_stop_hz_timer(void);
63extern void vmi_account_time_restart_hz_timer(void);
64#else
65static inline int vmi_stop_hz_timer(void)
66{
67 return 0;
68}
69static inline void vmi_account_time_restart_hz_timer(void)
70{
71}
72#endif
73
74/*
75 * When run under a hypervisor, a vcpu is always in one of three states:
76 * running, halted, or ready. The vcpu is in the 'running' state if it
77 * is executing. When the vcpu executes the halt interface, the vcpu
78 * enters the 'halted' state and remains halted until there is some work
79 * pending for the vcpu (e.g. an alarm expires, host I/O completes on
80 * behalf of virtual I/O). At this point, the vcpu enters the 'ready'
81 * state (waiting for the hypervisor to reschedule it). Finally, at any
82 * time when the vcpu is not in the 'running' state nor the 'halted'
83 * state, it is in the 'ready' state.
84 *
85 * Real time is advances while the vcpu is 'running', 'ready', or
86 * 'halted'. Stolen time is the time in which the vcpu is in the
87 * 'ready' state. Available time is the remaining time -- the vcpu is
88 * either 'running' or 'halted'.
89 *
90 * All three views of time are accessible through the VMI cycle
91 * counters.
92 */
93
94/* The cycle counters. */
95#define VMI_CYCLES_REAL 0
96#define VMI_CYCLES_AVAILABLE 1
97#define VMI_CYCLES_STOLEN 2
98
99/* The alarm interface 'flags' bits */
100#define VMI_ALARM_COUNTERS 2
101
102#define VMI_ALARM_COUNTER_MASK 0x000000ff
103
104#define VMI_ALARM_WIRED_IRQ0 0x00000000
105#define VMI_ALARM_WIRED_LVTT 0x00010000
106
107#define VMI_ALARM_IS_ONESHOT 0x00000000
108#define VMI_ALARM_IS_PERIODIC 0x00000100
109
110#define CONFIG_VMI_ALARM_HZ 100
111
112#endif
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index 09a5dd0e44a8..5d03792d4f65 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -82,11 +82,11 @@ ia64_acpi_release_global_lock (unsigned int *lock)
82 return old & 0x1; 82 return old & 0x1;
83} 83}
84 84
85#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ 85#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
86 ((Acq) = ia64_acpi_acquire_global_lock((unsigned int *) GLptr)) 86 ((Acq) = ia64_acpi_acquire_global_lock(&facs->global_lock))
87 87
88#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ 88#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
89 ((Acq) = ia64_acpi_release_global_lock((unsigned int *) GLptr)) 89 ((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
90 90
91#define acpi_disabled 0 /* ACPI always enabled on IA64 */ 91#define acpi_disabled 0 /* ACPI always enabled on IA64 */
92#define acpi_noirq 0 /* ACPI always enabled on IA64 */ 92#define acpi_noirq 0 /* ACPI always enabled on IA64 */
@@ -119,8 +119,6 @@ extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
119extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 119extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
120#endif 120#endif
121 121
122extern u16 ia64_acpiid_to_sapicid[];
123
124/* 122/*
125 * Refer Intel ACPI _PDC support document for bit definitions 123 * Refer Intel ACPI _PDC support document for bit definitions
126 */ 124 */
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index ebd5887f4b1a..6299b51575bb 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -8,9 +8,20 @@
8#include <asm/machvec.h> 8#include <asm/machvec.h>
9 9
10#define dma_alloc_coherent platform_dma_alloc_coherent 10#define dma_alloc_coherent platform_dma_alloc_coherent
11#define dma_alloc_noncoherent platform_dma_alloc_coherent /* coherent mem. is cheap */ 11/* coherent mem. is cheap */
12static inline void *
13dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
14 gfp_t flag)
15{
16 return dma_alloc_coherent(dev, size, dma_handle, flag);
17}
12#define dma_free_coherent platform_dma_free_coherent 18#define dma_free_coherent platform_dma_free_coherent
13#define dma_free_noncoherent platform_dma_free_coherent 19static inline void
20dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
21 dma_addr_t dma_handle)
22{
23 dma_free_coherent(dev, size, cpu_addr, dma_handle);
24}
14#define dma_map_single platform_dma_map_single 25#define dma_map_single platform_dma_map_single
15#define dma_map_sg platform_dma_map_sg 26#define dma_map_sg platform_dma_map_sg
16#define dma_unmap_single platform_dma_unmap_single 27#define dma_unmap_single platform_dma_unmap_single
diff --git a/include/asm-ia64/dma.h b/include/asm-ia64/dma.h
index dad3a735df8b..4d97f60f1ef5 100644
--- a/include/asm-ia64/dma.h
+++ b/include/asm-ia64/dma.h
@@ -19,4 +19,6 @@ extern unsigned long MAX_DMA_ADDRESS;
19 19
20#define free_dma(x) 20#define free_dma(x)
21 21
22void dma_mark_clean(void *addr, size_t size);
23
22#endif /* _ASM_IA64_DMA_H */ 24#endif /* _ASM_IA64_DMA_H */
diff --git a/include/asm-ia64/esi.h b/include/asm-ia64/esi.h
index 84aac0e0b583..40991c6ba647 100644
--- a/include/asm-ia64/esi.h
+++ b/include/asm-ia64/esi.h
@@ -19,7 +19,6 @@ enum esi_proc_type {
19 ESI_PROC_REENTRANT /* MP-safe and reentrant */ 19 ESI_PROC_REENTRANT /* MP-safe and reentrant */
20}; 20};
21 21
22extern int ia64_esi_init (void);
23extern struct ia64_sal_retval esi_call_phys (void *, u64 *); 22extern struct ia64_sal_retval esi_call_phys (void *, u64 *);
24extern int ia64_esi_call(efi_guid_t, struct ia64_sal_retval *, 23extern int ia64_esi_call(efi_guid_t, struct ia64_sal_retval *,
25 enum esi_proc_type, 24 enum esi_proc_type,
diff --git a/include/asm-ia64/kexec.h b/include/asm-ia64/kexec.h
index 01c36b004747..41299ddfee30 100644
--- a/include/asm-ia64/kexec.h
+++ b/include/asm-ia64/kexec.h
@@ -22,8 +22,7 @@
22 } while(0) 22 } while(0)
23 23
24extern struct kimage *ia64_kimage; 24extern struct kimage *ia64_kimage;
25DECLARE_PER_CPU(u64, ia64_mca_pal_base); 25extern const unsigned int relocate_new_kernel_size;
26const extern unsigned int relocate_new_kernel_size;
27extern void relocate_new_kernel(unsigned long, unsigned long, 26extern void relocate_new_kernel(unsigned long, unsigned long,
28 struct ia64_boot_param *, unsigned long); 27 struct ia64_boot_param *, unsigned long);
29static inline void 28static inline void
diff --git a/include/asm-ia64/libata-portmap.h b/include/asm-ia64/libata-portmap.h
new file mode 100644
index 000000000000..0e00c9a9f410
--- /dev/null
+++ b/include/asm-ia64/libata-portmap.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_IA64_LIBATA_PORTMAP_H
2#define __ASM_IA64_LIBATA_PORTMAP_H
3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ(dev) isa_irq_to_vector(14)
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ(dev) isa_irq_to_vector(15)
11
12#endif
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index a3891eb3f217..ca33eb181ff2 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -21,6 +21,7 @@ struct mm_struct;
21struct pci_bus; 21struct pci_bus;
22struct task_struct; 22struct task_struct;
23struct pci_dev; 23struct pci_dev;
24struct msi_desc;
24 25
25typedef void ia64_mv_setup_t (char **); 26typedef void ia64_mv_setup_t (char **);
26typedef void ia64_mv_cpu_init_t (void); 27typedef void ia64_mv_cpu_init_t (void);
@@ -79,7 +80,7 @@ typedef unsigned short ia64_mv_readw_relaxed_t (const volatile void __iomem *);
79typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *); 80typedef unsigned int ia64_mv_readl_relaxed_t (const volatile void __iomem *);
80typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *); 81typedef unsigned long ia64_mv_readq_relaxed_t (const volatile void __iomem *);
81 82
82typedef int ia64_mv_setup_msi_irq_t (unsigned int irq, struct pci_dev *pdev); 83typedef int ia64_mv_setup_msi_irq_t (struct pci_dev *pdev, struct msi_desc *);
83typedef void ia64_mv_teardown_msi_irq_t (unsigned int irq); 84typedef void ia64_mv_teardown_msi_irq_t (unsigned int irq);
84 85
85static inline void 86static inline void
@@ -167,6 +168,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
167# define platform_setup_msi_irq ia64_mv.setup_msi_irq 168# define platform_setup_msi_irq ia64_mv.setup_msi_irq
168# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq 169# define platform_teardown_msi_irq ia64_mv.teardown_msi_irq
169# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus 170# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus
171# define platform_kernel_launch_event ia64_mv.kernel_launch_event
170# endif 172# endif
171 173
172/* __attribute__((__aligned__(16))) is required to make size of the 174/* __attribute__((__aligned__(16))) is required to make size of the
@@ -268,6 +270,7 @@ struct ia64_machine_vector {
268 platform_setup_msi_irq, \ 270 platform_setup_msi_irq, \
269 platform_teardown_msi_irq, \ 271 platform_teardown_msi_irq, \
270 platform_pci_fixup_bus, \ 272 platform_pci_fixup_bus, \
273 platform_kernel_launch_event \
271} 274}
272 275
273extern struct ia64_machine_vector ia64_mv; 276extern struct ia64_machine_vector ia64_mv;
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index ee97f7c2d462..41098f459684 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -156,6 +156,8 @@ struct ia64_mca_notify_die {
156 int *monarch_cpu; 156 int *monarch_cpu;
157}; 157};
158 158
159DECLARE_PER_CPU(u64, ia64_mca_pal_base);
160
159#else /* __ASSEMBLY__ */ 161#else /* __ASSEMBLY__ */
160 162
161#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */ 163#define IA64_MCA_CORRECTED 0x0 /* Error has been corrected by OS_MCA */
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index c8df75901083..3a62878e84f3 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -17,10 +17,11 @@
17 * - kernel code & data 17 * - kernel code & data
18 * - crash dumping code reserved region 18 * - crash dumping code reserved region
19 * - Kernel memory map built from EFI memory map 19 * - Kernel memory map built from EFI memory map
20 * - ELF core header
20 * 21 *
21 * More could be added if necessary 22 * More could be added if necessary
22 */ 23 */
23#define IA64_MAX_RSVD_REGIONS 7 24#define IA64_MAX_RSVD_REGIONS 8
24 25
25struct rsvd_region { 26struct rsvd_region {
26 unsigned long start; /* virtual address of beginning of element */ 27 unsigned long start; /* virtual address of beginning of element */
@@ -35,6 +36,10 @@ extern void reserve_memory (void);
35extern void find_initrd (void); 36extern void find_initrd (void);
36extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); 37extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
37extern void efi_memmap_init(unsigned long *, unsigned long *); 38extern void efi_memmap_init(unsigned long *, unsigned long *);
39extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
40
41extern unsigned long vmcore_find_descriptor_size(unsigned long address);
42extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
38 43
39/* 44/*
40 * For rounding an address to the next IA64_GRANULE_SIZE or order 45 * For rounding an address to the next IA64_GRANULE_SIZE or order
@@ -51,12 +56,13 @@ extern void efi_memmap_init(unsigned long *, unsigned long *);
51 56
52#define IGNORE_PFN0 1 /* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */ 57#define IGNORE_PFN0 1 /* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */
53 58
59extern int register_active_ranges(u64 start, u64 end, void *arg);
60
54#ifdef CONFIG_VIRTUAL_MEM_MAP 61#ifdef CONFIG_VIRTUAL_MEM_MAP
55# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */ 62# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */
56 extern unsigned long vmalloc_end; 63 extern unsigned long vmalloc_end;
57 extern struct page *vmem_map; 64 extern struct page *vmem_map;
58 extern int find_largest_hole (u64 start, u64 end, void *arg); 65 extern int find_largest_hole (u64 start, u64 end, void *arg);
59 extern int register_active_ranges (u64 start, u64 end, void *arg);
60 extern int create_mem_map_page_table (u64 start, u64 end, void *arg); 66 extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
61 extern int vmemmap_find_next_valid_pfn(int, int); 67 extern int vmemmap_find_next_valid_pfn(int, int);
62#else 68#else
diff --git a/include/asm-ia64/pal.h b/include/asm-ia64/pal.h
index 56e9210733d6..abfcb3a2588f 100644
--- a/include/asm-ia64/pal.h
+++ b/include/asm-ia64/pal.h
@@ -32,7 +32,7 @@
32#define PAL_CACHE_FLUSH 1 /* flush i/d cache */ 32#define PAL_CACHE_FLUSH 1 /* flush i/d cache */
33#define PAL_CACHE_INFO 2 /* get detailed i/d cache info */ 33#define PAL_CACHE_INFO 2 /* get detailed i/d cache info */
34#define PAL_CACHE_INIT 3 /* initialize i/d cache */ 34#define PAL_CACHE_INIT 3 /* initialize i/d cache */
35#define PAL_CACHE_SUMMARY 4 /* get summary of cache heirarchy */ 35#define PAL_CACHE_SUMMARY 4 /* get summary of cache hierarchy */
36#define PAL_MEM_ATTRIB 5 /* list supported memory attributes */ 36#define PAL_MEM_ATTRIB 5 /* list supported memory attributes */
37#define PAL_PTCE_INFO 6 /* purge TLB info */ 37#define PAL_PTCE_INFO 6 /* purge TLB info */
38#define PAL_VM_INFO 7 /* return supported virtual memory features */ 38#define PAL_VM_INFO 7 /* return supported virtual memory features */
@@ -115,14 +115,14 @@ typedef s64 pal_status_t;
115 */ 115 */
116#define PAL_STATUS_REQUIRES_MEMORY (-9) /* Call requires PAL memory buffer */ 116#define PAL_STATUS_REQUIRES_MEMORY (-9) /* Call requires PAL memory buffer */
117 117
118/* Processor cache level in the heirarchy */ 118/* Processor cache level in the hierarchy */
119typedef u64 pal_cache_level_t; 119typedef u64 pal_cache_level_t;
120#define PAL_CACHE_LEVEL_L0 0 /* L0 */ 120#define PAL_CACHE_LEVEL_L0 0 /* L0 */
121#define PAL_CACHE_LEVEL_L1 1 /* L1 */ 121#define PAL_CACHE_LEVEL_L1 1 /* L1 */
122#define PAL_CACHE_LEVEL_L2 2 /* L2 */ 122#define PAL_CACHE_LEVEL_L2 2 /* L2 */
123 123
124 124
125/* Processor cache type at a particular level in the heirarchy */ 125/* Processor cache type at a particular level in the hierarchy */
126 126
127typedef u64 pal_cache_type_t; 127typedef u64 pal_cache_type_t;
128#define PAL_CACHE_TYPE_INSTRUCTION 1 /* Instruction cache */ 128#define PAL_CACHE_TYPE_INSTRUCTION 1 /* Instruction cache */
@@ -274,14 +274,14 @@ typedef struct pal_cache_protection_info_s {
274#define PAL_CACHE_PROT_METHOD_ECC 3 /* ECC protection */ 274#define PAL_CACHE_PROT_METHOD_ECC 3 /* ECC protection */
275 275
276 276
277/* Processor cache line identification in the heirarchy */ 277/* Processor cache line identification in the hierarchy */
278typedef union pal_cache_line_id_u { 278typedef union pal_cache_line_id_u {
279 u64 pclid_data; 279 u64 pclid_data;
280 struct { 280 struct {
281 u64 cache_type : 8, /* 7-0 cache type */ 281 u64 cache_type : 8, /* 7-0 cache type */
282 level : 8, /* 15-8 level of the 282 level : 8, /* 15-8 level of the
283 * cache in the 283 * cache in the
284 * heirarchy. 284 * hierarchy.
285 */ 285 */
286 way : 8, /* 23-16 way in the set 286 way : 8, /* 23-16 way in the set
287 */ 287 */
@@ -294,7 +294,7 @@ typedef union pal_cache_line_id_u {
294 u64 cache_type : 8, /* 7-0 cache type */ 294 u64 cache_type : 8, /* 7-0 cache type */
295 level : 8, /* 15-8 level of the 295 level : 8, /* 15-8 level of the
296 * cache in the 296 * cache in the
297 * heirarchy. 297 * hierarchy.
298 */ 298 */
299 way : 8, /* 23-16 way in the set 299 way : 8, /* 23-16 way in the set
300 */ 300 */
@@ -373,6 +373,7 @@ typedef u64 pal_mc_info_index_t;
373 * dependent 373 * dependent
374 */ 374 */
375 375
376#define PAL_TLB_CHECK_OP_PURGE 8
376 377
377typedef struct pal_process_state_info_s { 378typedef struct pal_process_state_info_s {
378 u64 reserved1 : 2, 379 u64 reserved1 : 2,
@@ -980,7 +981,7 @@ ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
980 return iprv.status; 981 return iprv.status;
981} 982}
982 983
983/* Return summary information about the heirarchy of caches controlled by the processor */ 984/* Return summary information about the hierarchy of caches controlled by the processor */
984static inline s64 985static inline s64
985ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches) 986ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches)
986{ 987{
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 556f53fa44cb..5a5d1c2ce39d 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -9,6 +9,7 @@
9 9
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/scatterlist.h> 11#include <asm/scatterlist.h>
12#include <asm/hw_irq.h>
12 13
13/* 14/*
14 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus 15 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
@@ -167,4 +168,10 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
167 168
168#define pcibios_scan_all_fns(a, b) 0 169#define pcibios_scan_all_fns(a, b) 0
169 170
171#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
172static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
173{
174 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
175}
176
170#endif /* _ASM_IA64_PCI_H */ 177#endif /* _ASM_IA64_PCI_H */
diff --git a/include/asm-ia64/pgalloc.h b/include/asm-ia64/pgalloc.h
index 393e04c42a2c..560c287b1233 100644
--- a/include/asm-ia64/pgalloc.h
+++ b/include/asm-ia64/pgalloc.h
@@ -137,7 +137,8 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
137static inline struct page *pte_alloc_one(struct mm_struct *mm, 137static inline struct page *pte_alloc_one(struct mm_struct *mm,
138 unsigned long addr) 138 unsigned long addr)
139{ 139{
140 return virt_to_page(pgtable_quicklist_alloc()); 140 void *pg = pgtable_quicklist_alloc();
141 return pg ? virt_to_page(pg) : NULL;
141} 142}
142 143
143static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 144static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 5830d36fd8e6..4f4ee1c2db2f 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -210,7 +210,7 @@ struct desc_struct {
210 unsigned int a, b; 210 unsigned int a, b;
211}; 211};
212 212
213#define desc_empty(desc) (!((desc)->a + (desc)->b)) 213#define desc_empty(desc) (!((desc)->a | (desc)->b))
214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b)) 214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
215 215
216#define GDT_ENTRY_TLS_ENTRIES 3 216#define GDT_ENTRY_TLS_ENTRIES 3
diff --git a/include/asm-ia64/resource.h b/include/asm-ia64/resource.h
index 77b1eee01f30..ba2272a87fc7 100644
--- a/include/asm-ia64/resource.h
+++ b/include/asm-ia64/resource.h
@@ -2,7 +2,6 @@
2#define _ASM_IA64_RESOURCE_H 2#define _ASM_IA64_RESOURCE_H
3 3
4#include <asm/ustack.h> 4#include <asm/ustack.h>
5#define _STK_LIM_MAX DEFAULT_USER_STACK_SIZE
6#include <asm-generic/resource.h> 5#include <asm-generic/resource.h>
7 6
8#endif /* _ASM_IA64_RESOURCE_H */ 7#endif /* _ASM_IA64_RESOURCE_H */
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index d000689d9142..46cadf5aaac5 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -847,12 +847,13 @@ extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64,
847 */ 847 */
848struct sal_to_os_boot { 848struct sal_to_os_boot {
849 u64 rr[8]; /* Region Registers */ 849 u64 rr[8]; /* Region Registers */
850 u64 br[6]; /* br0: return addr into SAL boot rendez routine */ 850 u64 br[6]; /* br0:
851 * return addr into SAL boot rendez routine */
851 u64 gr1; /* SAL:GP */ 852 u64 gr1; /* SAL:GP */
852 u64 gr12; /* SAL:SP */ 853 u64 gr12; /* SAL:SP */
853 u64 gr13; /* SAL: Task Pointer */ 854 u64 gr13; /* SAL: Task Pointer */
854 u64 fpsr; 855 u64 fpsr;
855 u64 pfs; 856 u64 pfs;
856 u64 rnat; 857 u64 rnat;
857 u64 unat; 858 u64 unat;
858 u64 bspstore; 859 u64 bspstore;
diff --git a/include/asm-ia64/setup.h b/include/asm-ia64/setup.h
index ea29b57affcb..4399a44355b3 100644
--- a/include/asm-ia64/setup.h
+++ b/include/asm-ia64/setup.h
@@ -1,6 +1,6 @@
1#ifndef __IA64_SETUP_H 1#ifndef __IA64_SETUP_H
2#define __IA64_SETUP_H 2#define __IA64_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 512 4#define COMMAND_LINE_SIZE 2048
5 5
6#endif 6#endif
diff --git a/include/asm-ia64/sn/acpi.h b/include/asm-ia64/sn/acpi.h
index 2850a7ef5e71..9ce2801cbd57 100644
--- a/include/asm-ia64/sn/acpi.h
+++ b/include/asm-ia64/sn/acpi.h
@@ -11,6 +11,7 @@
11 11
12#include "acpi/acglobal.h" 12#include "acpi/acglobal.h"
13 13
14#define SN_ACPI_BASE_SUPPORT() (acpi_gbl_DSDT->oem_revision >= 0x20101) 14extern int sn_acpi_rev;
15#define SN_ACPI_BASE_SUPPORT() (sn_acpi_rev >= 0x20101)
15 16
16#endif /* _ASM_IA64_SN_ACPI_H */ 17#endif /* _ASM_IA64_SN_ACPI_H */
diff --git a/include/asm-ia64/sn/pcibr_provider.h b/include/asm-ia64/sn/pcibr_provider.h
index da3eade0cae2..da205b7cdaac 100644
--- a/include/asm-ia64/sn/pcibr_provider.h
+++ b/include/asm-ia64/sn/pcibr_provider.h
@@ -21,6 +21,7 @@
21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \ 21#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \
22 asic == PCIIO_ASIC_TYPE_TIOCP) 22 asic == PCIIO_ASIC_TYPE_TIOCP)
23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC) 23#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC)
24#define IS_TIOCP_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_TIOCP)
24 25
25 26
26/* 27/*
@@ -53,8 +54,8 @@
53 * Bridge PMU Address Transaltion Entry Attibutes 54 * Bridge PMU Address Transaltion Entry Attibutes
54 */ 55 */
55#define PCI32_ATE_V (0x1 << 0) 56#define PCI32_ATE_V (0x1 << 0)
56#define PCI32_ATE_CO (0x1 << 1) 57#define PCI32_ATE_CO (0x1 << 1) /* PIC ASIC ONLY */
57#define PCI32_ATE_PREC (0x1 << 2) 58#define PCI32_ATE_PIO (0x1 << 1) /* TIOCP ASIC ONLY */
58#define PCI32_ATE_MSI (0x1 << 2) 59#define PCI32_ATE_MSI (0x1 << 2)
59#define PCI32_ATE_PREF (0x1 << 3) 60#define PCI32_ATE_PREF (0x1 << 3)
60#define PCI32_ATE_BAR (0x1 << 4) 61#define PCI32_ATE_BAR (0x1 << 4)
@@ -142,7 +143,7 @@ extern int pcibr_ate_alloc(struct pcibus_info *, int);
142extern void pcibr_ate_free(struct pcibus_info *, int); 143extern void pcibr_ate_free(struct pcibus_info *, int);
143extern void ate_write(struct pcibus_info *, int, int, u64); 144extern void ate_write(struct pcibus_info *, int, int, u64);
144extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device, 145extern int sal_pcibr_slot_enable(struct pcibus_info *soft, int device,
145 void *resp); 146 void *resp, char **ssdt);
146extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device, 147extern int sal_pcibr_slot_disable(struct pcibus_info *soft, int device,
147 int action, void *resp); 148 int action, void *resp);
148extern u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus); 149extern u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus);
diff --git a/include/asm-ia64/sn/pcidev.h b/include/asm-ia64/sn/pcidev.h
index 9fe89a93d880..1c2382cea807 100644
--- a/include/asm-ia64/sn/pcidev.h
+++ b/include/asm-ia64/sn/pcidev.h
@@ -70,10 +70,16 @@ extern void sn_irq_fixup(struct pci_dev *pci_dev,
70 struct sn_irq_info *sn_irq_info); 70 struct sn_irq_info *sn_irq_info);
71extern void sn_irq_unfixup(struct pci_dev *pci_dev); 71extern void sn_irq_unfixup(struct pci_dev *pci_dev);
72extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *); 72extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *);
73extern void sn_bus_fixup(struct pci_bus *);
74extern void sn_acpi_bus_fixup(struct pci_bus *);
75extern void sn_common_bus_fixup(struct pci_bus *, struct pcibus_bussoft *);
73extern void sn_bus_store_sysdata(struct pci_dev *dev); 76extern void sn_bus_store_sysdata(struct pci_dev *dev);
74extern void sn_bus_free_sysdata(void); 77extern void sn_bus_free_sysdata(void);
75extern void sn_generate_path(struct pci_bus *pci_bus, char *address); 78extern void sn_generate_path(struct pci_bus *pci_bus, char *address);
76extern void sn_pci_fixup_slot(struct pci_dev *dev); 79extern void sn_io_slot_fixup(struct pci_dev *);
80extern void sn_acpi_slot_fixup(struct pci_dev *);
81extern void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *,
82 struct sn_irq_info *);
77extern void sn_pci_unfixup_slot(struct pci_dev *dev); 83extern void sn_pci_unfixup_slot(struct pci_dev *dev);
78extern void sn_irq_lh_init(void); 84extern void sn_irq_lh_init(void);
79#endif /* _ASM_IA64_SN_PCI_PCIDEV_H */ 85#endif /* _ASM_IA64_SN_PCI_PCIDEV_H */
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index d638ef3d50c3..9e42ce43cfbe 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -58,5 +58,7 @@
58 58
59#define SO_PEERSEC 31 59#define SO_PEERSEC 31
60#define SO_PASSSEC 34 60#define SO_PASSSEC 34
61#define SO_TIMESTAMPNS 35
62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61 63
62#endif /* _ASM_IA64_SOCKET_H */ 64#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-ia64/sockios.h b/include/asm-ia64/sockios.h
index cf94857c8a54..15c92468ad38 100644
--- a/include/asm-ia64/sockios.h
+++ b/include/asm-ia64/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_IA64_SOCKIOS_H */ 20#endif /* _ASM_IA64_SOCKIOS_H */
diff --git a/include/asm-ia64/termios.h b/include/asm-ia64/termios.h
index 42c95693240c..08750c2d3607 100644
--- a/include/asm-ia64/termios.h
+++ b/include/asm-ia64/termios.h
@@ -46,24 +46,6 @@ struct termio {
46 46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48 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 msgs */
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__ 49# ifdef __KERNEL__
68 50
69/* intr=^C quit=^\ erase=del kill=^U 51/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 9b505b25544f..91698599f918 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -84,6 +84,7 @@ struct thread_info {
84#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 84#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
85#define TIF_SYSCALL_TRACE 3 /* syscall trace active */ 85#define TIF_SYSCALL_TRACE 3 /* syscall trace active */
86#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ 86#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
87#define TIF_SINGLESTEP 5 /* restore singlestep on return to user mode */
87#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 88#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
88#define TIF_MEMDIE 17 89#define TIF_MEMDIE 17
89#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 90#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
@@ -92,7 +93,8 @@ struct thread_info {
92 93
93#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 94#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
94#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 95#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
95#define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT) 96#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
97#define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
96#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 98#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
97#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 99#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
98#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 100#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index 22ed6749557e..233f1caae048 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -65,7 +65,6 @@ void build_cpu_to_node_map(void);
65 .max_interval = 4, \ 65 .max_interval = 4, \
66 .busy_factor = 64, \ 66 .busy_factor = 64, \
67 .imbalance_pct = 125, \ 67 .imbalance_pct = 125, \
68 .per_cpu_gain = 100, \
69 .cache_nice_tries = 2, \ 68 .cache_nice_tries = 2, \
70 .busy_idx = 2, \ 69 .busy_idx = 2, \
71 .idle_idx = 1, \ 70 .idle_idx = 1, \
@@ -97,7 +96,6 @@ void build_cpu_to_node_map(void);
97 .newidle_idx = 0, /* unused */ \ 96 .newidle_idx = 0, /* unused */ \
98 .wake_idx = 1, \ 97 .wake_idx = 1, \
99 .forkexec_idx = 1, \ 98 .forkexec_idx = 1, \
100 .per_cpu_gain = 100, \
101 .flags = SD_LOAD_BALANCE \ 99 .flags = SD_LOAD_BALANCE \
102 | SD_BALANCE_EXEC \ 100 | SD_BALANCE_EXEC \
103 | SD_BALANCE_FORK \ 101 | SD_BALANCE_FORK \
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index 53c5c0ee122c..a9e1fa4cac4d 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -291,11 +291,13 @@
291#define __NR_sync_file_range 1300 291#define __NR_sync_file_range 1300
292#define __NR_tee 1301 292#define __NR_tee 1301
293#define __NR_vmsplice 1302 293#define __NR_vmsplice 1302
294/* 1303 reserved for move_pages */
295#define __NR_getcpu 1304
294 296
295#ifdef __KERNEL__ 297#ifdef __KERNEL__
296 298
297 299
298#define NR_syscalls 279 /* length of syscall table */ 300#define NR_syscalls 281 /* length of syscall table */
299 301
300#define __ARCH_WANT_SYS_RT_SIGACTION 302#define __ARCH_WANT_SYS_RT_SIGACTION
301 303
diff --git a/include/asm-ia64/unwind.h b/include/asm-ia64/unwind.h
index 5df0276b0493..1af3875f1a57 100644
--- a/include/asm-ia64/unwind.h
+++ b/include/asm-ia64/unwind.h
@@ -81,7 +81,7 @@ struct unw_frame_info {
81 struct unw_ireg { 81 struct unw_ireg {
82 unsigned long *loc; 82 unsigned long *loc;
83 struct unw_ireg_nat { 83 struct unw_ireg_nat {
84 long type : 3; /* enum unw_nat_type */ 84 unsigned long type : 3; /* enum unw_nat_type */
85 signed long off : 61; /* NaT word is at loc+nat.off */ 85 signed long off : 61; /* NaT word is at loc+nat.off */
86 } nat; 86 } nat;
87 } r4, r5, r6, r7; 87 } r4, r5, r6, r7;
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h
index 4619ba5c372e..9a4a5d20160a 100644
--- a/include/asm-m32r/a.out.h
+++ b/include/asm-m32r/a.out.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_A_OUT_H 1#ifndef _ASM_M32R_A_OUT_H
2#define _ASM_M32R_A_OUT_H 2#define _ASM_M32R_A_OUT_H
3 3
4/* orig : i386 2.4.18 */
5
6struct exec 4struct exec
7{ 5{
8 unsigned long a_info; /* Use macros N_MAGIC, etc for access */ 6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
diff --git a/include/asm-m32r/addrspace.h b/include/asm-m32r/addrspace.h
index 06a83dc94648..81782c122da4 100644
--- a/include/asm-m32r/addrspace.h
+++ b/include/asm-m32r/addrspace.h
@@ -1,4 +1,3 @@
1/* $Id$ */
2/* 1/*
3 * This file is subject to the terms and conditions of the GNU General Public 2 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
diff --git a/include/asm-m32r/bugs.h b/include/asm-m32r/bugs.h
index 9a56f661bdb3..f77214eff136 100644
--- a/include/asm-m32r/bugs.h
+++ b/include/asm-m32r/bugs.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_BUGS_H 1#ifndef _ASM_M32R_BUGS_H
2#define _ASM_M32R_BUGS_H 2#define _ASM_M32R_BUGS_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * This is included by init/main.c to check for architecture-dependent bugs. 5 * This is included by init/main.c to check for architecture-dependent bugs.
8 * 6 *
diff --git a/include/asm-m32r/byteorder.h b/include/asm-m32r/byteorder.h
index 3c0b9a2e03bc..10b2c1d11614 100644
--- a/include/asm-m32r/byteorder.h
+++ b/include/asm-m32r/byteorder.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_BYTEORDER_H 1#ifndef _ASM_M32R_BYTEORDER_H
2#define _ASM_M32R_BYTEORDER_H 2#define _ASM_M32R_BYTEORDER_H
3 3
4/* $Id$ */
5
6#include <asm/types.h> 4#include <asm/types.h>
7 5
8#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) 6#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
diff --git a/include/asm-m32r/cache.h b/include/asm-m32r/cache.h
index 9c2b2d9998bc..40b3ee98193d 100644
--- a/include/asm-m32r/cache.h
+++ b/include/asm-m32r/cache.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_CACHE_H 1#ifndef _ASM_M32R_CACHE_H
2#define _ASM_M32R_CACHE_H 2#define _ASM_M32R_CACHE_H
3 3
4/* $Id$ */
5
6/* L1 cache line size */ 4/* L1 cache line size */
7#define L1_CACHE_SHIFT 4 5#define L1_CACHE_SHIFT 4
8#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 6#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
diff --git a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
index 56961a9511b2..78587c958146 100644
--- a/include/asm-m32r/cacheflush.h
+++ b/include/asm-m32r/cacheflush.h
@@ -67,4 +67,3 @@ do { \
67 memcpy(dst, src, len) 67 memcpy(dst, src, len)
68 68
69#endif /* _ASM_M32R_CACHEFLUSH_H */ 69#endif /* _ASM_M32R_CACHEFLUSH_H */
70
diff --git a/include/asm-m32r/current.h b/include/asm-m32r/current.h
index c19d927ff22d..7859d864f2c2 100644
--- a/include/asm-m32r/current.h
+++ b/include/asm-m32r/current.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_CURRENT_H 1#ifndef _ASM_M32R_CURRENT_H
2#define _ASM_M32R_CURRENT_H 2#define _ASM_M32R_CURRENT_H
3 3
4/* $Id$ */
5
6#include <linux/thread_info.h> 4#include <linux/thread_info.h>
7 5
8struct task_struct; 6struct task_struct;
@@ -15,4 +13,3 @@ static __inline__ struct task_struct *get_current(void)
15#define current (get_current()) 13#define current (get_current())
16 14
17#endif /* _ASM_M32R_CURRENT_H */ 15#endif /* _ASM_M32R_CURRENT_H */
18
diff --git a/include/asm-m32r/delay.h b/include/asm-m32r/delay.h
index f285eaee7d27..164448d23850 100644
--- a/include/asm-m32r/delay.h
+++ b/include/asm-m32r/delay.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_DELAY_H 1#ifndef _ASM_M32R_DELAY_H
2#define _ASM_M32R_DELAY_H 2#define _ASM_M32R_DELAY_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * Copyright (C) 1993 Linus Torvalds 5 * Copyright (C) 1993 Linus Torvalds
8 * 6 *
diff --git a/include/asm-m32r/dma-mapping.h b/include/asm-m32r/dma-mapping.h
index a7fa0302bda7..f9b58ebba361 100644
--- a/include/asm-m32r/dma-mapping.h
+++ b/include/asm-m32r/dma-mapping.h
@@ -1,23 +1,6 @@
1#ifndef _ASM_M32R_DMA_MAPPING_H 1#ifndef _ASM_M32R_DMA_MAPPING_H
2#define _ASM_M32R_DMA_MAPPING_H 2#define _ASM_M32R_DMA_MAPPING_H
3 3
4/* 4#include <asm-generic/dma-mapping-broken.h>
5 * NOTE: Do not include <asm-generic/dma-mapping.h>
6 * Because it requires PCI stuffs, but current M32R don't provide these.
7 */
8
9static inline void *
10dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
11 gfp_t flag)
12{
13 return (void *)NULL;
14}
15
16static inline void
17dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
18 dma_addr_t dma_handle)
19{
20 return;
21}
22 5
23#endif /* _ASM_M32R_DMA_MAPPING_H */ 6#endif /* _ASM_M32R_DMA_MAPPING_H */
diff --git a/include/asm-m32r/dma.h b/include/asm-m32r/dma.h
index 7263b013b67e..52f6a22dd232 100644
--- a/include/asm-m32r/dma.h
+++ b/include/asm-m32r/dma.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_DMA_H 1#ifndef _ASM_M32R_DMA_H
2#define _ASM_M32R_DMA_H 2#define _ASM_M32R_DMA_H
3 3
4/* $Id$ */
5
6#include <asm/io.h> 4#include <asm/io.h>
7 5
8/* 6/*
diff --git a/include/asm-m32r/errno.h b/include/asm-m32r/errno.h
index 7a98520194a7..777149262aad 100644
--- a/include/asm-m32r/errno.h
+++ b/include/asm-m32r/errno.h
@@ -1,9 +1,6 @@
1#ifndef _ASM_M32R_ERRNO_H 1#ifndef _ASM_M32R_ERRNO_H
2#define _ASM_M32R_ERRNO_H 2#define _ASM_M32R_ERRNO_H
3 3
4/* $Id$ */
5
6#include <asm-generic/errno.h> 4#include <asm-generic/errno.h>
7 5
8#endif /* _ASM_M32R_ERRNO_H */ 6#endif /* _ASM_M32R_ERRNO_H */
9
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index c82ebe8f250d..4672a49e8760 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_IDE_H 1#ifndef _ASM_M32R_IDE_H
2#define _ASM_M32R_IDE_H 2#define _ASM_M32R_IDE_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * linux/include/asm-m32r/ide.h 5 * linux/include/asm-m32r/ide.h
8 * 6 *
@@ -15,6 +13,7 @@
15 13
16#ifdef __KERNEL__ 14#ifdef __KERNEL__
17 15
16#include <asm/m32r.h>
18 17
19#ifndef MAX_HWIFS 18#ifndef MAX_HWIFS
20# ifdef CONFIG_BLK_DEV_IDEPCI 19# ifdef CONFIG_BLK_DEV_IDEPCI
@@ -24,9 +23,6 @@
24# endif 23# endif
25#endif 24#endif
26 25
27#include <asm/m32r.h>
28
29
30#define IDE_ARCH_OBSOLETE_DEFAULTS 26#define IDE_ARCH_OBSOLETE_DEFAULTS
31 27
32static __inline__ int ide_default_irq(unsigned long base) 28static __inline__ int ide_default_irq(unsigned long base)
diff --git a/include/asm-m32r/ioctls.h b/include/asm-m32r/ioctls.h
index b3508292246a..d23cfc45738a 100644
--- a/include/asm-m32r/ioctls.h
+++ b/include/asm-m32r/ioctls.h
@@ -1,10 +1,6 @@
1#ifndef __ARCH_M32R_IOCTLS_H__ 1#ifndef __ARCH_M32R_IOCTLS_H__
2#define __ARCH_M32R_IOCTLS_H__ 2#define __ARCH_M32R_IOCTLS_H__
3 3
4/* $Id$ */
5
6/* orig : i386 2.5.67 */
7
8#include <asm/ioctl.h> 4#include <asm/ioctl.h>
9 5
10/* 0x54 is just a magic number to make these relatively unique ('T') */ 6/* 0x54 is just a magic number to make these relatively unique ('T') */
@@ -85,4 +81,3 @@
85#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 81#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
86 82
87#endif /* __ARCH_M32R_IOCTLS_H__ */ 83#endif /* __ARCH_M32R_IOCTLS_H__ */
88
diff --git a/include/asm-m32r/ipcbuf.h b/include/asm-m32r/ipcbuf.h
index 7c77fb0b1467..8d2d7c8ffdb0 100644
--- a/include/asm-m32r/ipcbuf.h
+++ b/include/asm-m32r/ipcbuf.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_IPCBUF_H 1#ifndef _ASM_M32R_IPCBUF_H
2#define _ASM_M32R_IPCBUF_H 2#define _ASM_M32R_IPCBUF_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* 4/*
9 * The ipc64_perm structure for m32r architecture. 5 * The ipc64_perm structure for m32r architecture.
10 * Note extra padding because this structure is passed back and forth 6 * Note extra padding because this structure is passed back and forth
diff --git a/include/asm-m32r/kmap_types.h b/include/asm-m32r/kmap_types.h
index 0524d89edb0f..fa94dc6410ea 100644
--- a/include/asm-m32r/kmap_types.h
+++ b/include/asm-m32r/kmap_types.h
@@ -1,9 +1,6 @@
1#ifndef __M32R_KMAP_TYPES_H 1#ifndef __M32R_KMAP_TYPES_H
2#define __M32R_KMAP_TYPES_H 2#define __M32R_KMAP_TYPES_H
3 3
4/* Dummy header just to define km_type. */
5
6
7#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
8# define D(n) __KM_FENCE_##n , 5# define D(n) __KM_FENCE_##n ,
9#else 6#else
@@ -30,4 +27,3 @@ D(13) KM_TYPE_NR
30#undef D 27#undef D
31 28
32#endif /* __M32R_KMAP_TYPES_H */ 29#endif /* __M32R_KMAP_TYPES_H */
33
diff --git a/include/asm-m32r/m32104ut/m32104ut_pld.h b/include/asm-m32r/m32104ut/m32104ut_pld.h
index cbdbc5891445..2dc89d68b6d9 100644
--- a/include/asm-m32r/m32104ut/m32104ut_pld.h
+++ b/include/asm-m32r/m32104ut/m32104ut_pld.h
@@ -1,3 +1,6 @@
1#ifndef _M32104UT_M32104UT_PLD_H
2#define _M32104UT_M32104UT_PLD_H
3
1/* 4/*
2 * include/asm-m32r/m32104ut/m32104ut_pld.h 5 * include/asm-m32r/m32104ut/m32104ut_pld.h
3 * 6 *
@@ -12,10 +15,6 @@
12 * this archive for more details. 15 * this archive for more details.
13 */ 16 */
14 17
15#ifndef _M32104UT_M32104UT_PLD_H
16#define _M32104UT_M32104UT_PLD_H
17
18
19#if defined(CONFIG_PLAT_M32104UT) 18#if defined(CONFIG_PLAT_M32104UT)
20#define PLD_PLAT_BASE 0x02c00000 19#define PLD_PLAT_BASE 0x02c00000
21#else 20#else
@@ -35,7 +34,7 @@
35#define __reg8 34#define __reg8
36#define __reg16 35#define __reg16
37#define __reg32 36#define __reg32
38#endif /* __ASSEMBLY__ */ 37#endif /* __ASSEMBLY__ */
39 38
40/* CFC */ 39/* CFC */
41#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) 40#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
@@ -159,4 +158,4 @@
159#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) 158#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
160#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) 159#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
161 160
162#endif /* _M32104UT_M32104UT_PLD_H */ 161#endif /* _M32104UT_M32104UT_PLD_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_lan.h b/include/asm-m32r/m32700ut/m32700ut_lan.h
index f1e47ae1f891..aae810a4fb2c 100644
--- a/include/asm-m32r/m32700ut/m32700ut_lan.h
+++ b/include/asm-m32r/m32700ut/m32700ut_lan.h
@@ -1,3 +1,6 @@
1#ifndef _M32700UT_M32700UT_LAN_H
2#define _M32700UT_M32700UT_LAN_H
3
1/* 4/*
2 * include/asm-m32r/m32700ut/m32700ut_lan.h 5 * include/asm-m32r/m32700ut/m32700ut_lan.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id$
13 */ 14 */
14 15
15#ifndef _M32700UT_M32700UT_LAN_H
16#define _M32700UT_M32700UT_LAN_H
17
18
19#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
20/* 17/*
21 * C functions use non-cache address. 18 * C functions use non-cache address.
@@ -23,7 +20,7 @@
23#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) 20#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */)
24#else 21#else
25#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) 22#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET)
26#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
27 24
28/* ICU 25/* ICU
29 * ICUISTS: status register 26 * ICUISTS: status register
@@ -103,4 +100,4 @@
103#define PLDI2CSTS_BB 0x00000010 100#define PLDI2CSTS_BB 0x00000010
104#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */ 101#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */
105 102
106#endif /* _M32700UT_M32700UT_LAN_H */ 103#endif /* _M32700UT_M32700UT_LAN_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_lcd.h b/include/asm-m32r/m32700ut/m32700ut_lcd.h
index e41c4aa48b4c..4c2489079788 100644
--- a/include/asm-m32r/m32700ut/m32700ut_lcd.h
+++ b/include/asm-m32r/m32700ut/m32700ut_lcd.h
@@ -1,3 +1,6 @@
1#ifndef _M32700UT_M32700UT_LCD_H
2#define _M32700UT_M32700UT_LCD_H
3
1/* 4/*
2 * include/asm-m32r/m32700ut/m32700ut_lcd.h 5 * include/asm-m32r/m32700ut/m32700ut_lcd.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id$
13 */ 14 */
14 15
15#ifndef _M32700UT_M32700UT_LCD_H
16#define _M32700UT_M32700UT_LCD_H
17
18
19#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
20/* 17/*
21 * C functions use non-cache address. 18 * C functions use non-cache address.
@@ -23,7 +20,7 @@
23#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) 20#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */)
24#else 21#else
25#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) 22#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET)
26#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
27 24
28/* 25/*
29 * ICU 26 * ICU
@@ -55,4 +52,4 @@
55#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036) 52#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036)
56#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a) 53#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a)
57 54
58#endif /* _M32700UT_M32700UT_LCD_H */ 55#endif /* _M32700UT_M32700UT_LCD_H */
diff --git a/include/asm-m32r/m32700ut/m32700ut_pld.h b/include/asm-m32r/m32700ut/m32700ut_pld.h
index a48c22c978ca..d39121279a1a 100644
--- a/include/asm-m32r/m32700ut/m32700ut_pld.h
+++ b/include/asm-m32r/m32700ut/m32700ut_pld.h
@@ -1,3 +1,6 @@
1#ifndef _M32700UT_M32700UT_PLD_H
2#define _M32700UT_M32700UT_PLD_H
3
1/* 4/*
2 * include/asm-m32r/m32700ut/m32700ut_pld.h 5 * include/asm-m32r/m32700ut/m32700ut_pld.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id$
13 */ 14 */
14 15
15#ifndef _M32700UT_M32700UT_PLD_H
16#define _M32700UT_M32700UT_PLD_H
17
18
19#if defined(CONFIG_PLAT_M32700UT_Alpha) 16#if defined(CONFIG_PLAT_M32700UT_Alpha)
20#define PLD_PLAT_BASE 0x08c00000 17#define PLD_PLAT_BASE 0x08c00000
21#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) 18#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV)
@@ -37,7 +34,7 @@
37#define __reg8 34#define __reg8
38#define __reg16 35#define __reg16
39#define __reg32 36#define __reg32
40#endif /* __ASSEMBLY__ */ 37#endif /* __ASSEMBLY__ */
41 38
42/* CFC */ 39/* CFC */
43#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) 40#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
@@ -261,4 +258,4 @@
261#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) 258#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
262#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) 259#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
263 260
264#endif /* _M32700UT_M32700UT_PLD.H */ 261#endif /* _M32700UT_M32700UT_PLD.H */
diff --git a/include/asm-m32r/mappi2/mappi2_pld.h b/include/asm-m32r/mappi2/mappi2_pld.h
index 56a2b12f2bfc..2624c9db7255 100644
--- a/include/asm-m32r/mappi2/mappi2_pld.h
+++ b/include/asm-m32r/mappi2/mappi2_pld.h
@@ -1,18 +1,17 @@
1#ifndef _MAPPI2_PLD_H
2#define _MAPPI2_PLD_H
3
1/* 4/*
2 * include/asm-m32r/mappi2/mappi2_pld.h 5 * include/asm-m32r/mappi2/mappi2_pld.h
3 * 6 *
4 * Definitions for Extended IO Logic on MAPPI2 board. 7 * Definitions for Extended IO Logic on MAPPI2 board.
5 * based on m32700ut_pld.h by 8 * based on m32700ut_pld.h
6 * 9 *
7 * This file is subject to the terms and conditions of the GNU General 10 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of 11 * Public License. See the file "COPYING" in the main directory of
9 * this archive for more details. 12 * this archive for more details.
10 *
11 */ 13 */
12 14
13#ifndef _MAPPI2_PLD_H
14#define _MAPPI2_PLD_H
15
16#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
17/* FIXME: 16/* FIXME:
18 * Some C functions use non-cache address, so can't define non-cache address. 17 * Some C functions use non-cache address, so can't define non-cache address.
@@ -26,7 +25,7 @@
26#define __reg8 25#define __reg8
27#define __reg16 26#define __reg16
28#define __reg32 27#define __reg32
29#endif /* __ASSEMBLY__ */ 28#endif /* __ASSEMBLY__ */
30 29
31/* CFC */ 30/* CFC */
32#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) 31#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
@@ -148,4 +147,4 @@
148 147
149#endif 148#endif
150 149
151#endif /* _MAPPI2_PLD.H */ 150#endif /* _MAPPI2_PLD.H */
diff --git a/include/asm-m32r/mappi3/mappi3_pld.h b/include/asm-m32r/mappi3/mappi3_pld.h
index 92f10defaef8..451c40ee70af 100644
--- a/include/asm-m32r/mappi3/mappi3_pld.h
+++ b/include/asm-m32r/mappi3/mappi3_pld.h
@@ -1,3 +1,6 @@
1#ifndef _MAPPI3_PLD_H
2#define _MAPPI3_PLD_H
3
1/* 4/*
2 * include/asm-m32r/mappi3/mappi3_pld.h 5 * include/asm-m32r/mappi3/mappi3_pld.h
3 * 6 *
@@ -7,12 +10,8 @@
7 * This file is subject to the terms and conditions of the GNU General 10 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file "COPYING" in the main directory of 11 * Public License. See the file "COPYING" in the main directory of
9 * this archive for more details. 12 * this archive for more details.
10 *
11 */ 13 */
12 14
13#ifndef _MAPPI3_PLD_H
14#define _MAPPI3_PLD_H
15
16#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
17/* FIXME: 16/* FIXME:
18 * Some C functions use non-cache address, so can't define non-cache address. 17 * Some C functions use non-cache address, so can't define non-cache address.
@@ -26,7 +25,7 @@
26#define __reg8 25#define __reg8
27#define __reg16 26#define __reg16
28#define __reg32 27#define __reg32
29#endif /* __ASSEMBLY__ */ 28#endif /* __ASSEMBLY__ */
30 29
31/* CFC */ 30/* CFC */
32#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) 31#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
@@ -140,4 +139,4 @@
140/* Reset Control */ 139/* Reset Control */
141#define PLD_REBOOT __reg16(PLD_BASE + 0x38000) 140#define PLD_REBOOT __reg16(PLD_BASE + 0x38000)
142 141
143#endif /* _MAPPI3_PLD.H */ 142#endif /* _MAPPI3_PLD.H */
diff --git a/include/asm-m32r/mc146818rtc.h b/include/asm-m32r/mc146818rtc.h
index 755601d053cc..aa1b7bf84f51 100644
--- a/include/asm-m32r/mc146818rtc.h
+++ b/include/asm-m32r/mc146818rtc.h
@@ -7,7 +7,6 @@
7#include <asm/io.h> 7#include <asm/io.h>
8 8
9#ifndef RTC_PORT 9#ifndef RTC_PORT
10// #define RTC_PORT(x) (0x70 + (x))
11#define RTC_PORT(x) ((x)) 10#define RTC_PORT(x) ((x))
12#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ 11#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
13#endif 12#endif
@@ -26,7 +25,5 @@ outb_p((val),RTC_PORT(1)); \
26}) 25})
27 26
28#define RTC_IRQ 8 27#define RTC_IRQ 8
29#if 0
30#endif
31 28
32#endif /* _ASM_MC146818RTC_H */ 29#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-m32r/mman.h b/include/asm-m32r/mman.h
index 695a860c024f..516a8973b130 100644
--- a/include/asm-m32r/mman.h
+++ b/include/asm-m32r/mman.h
@@ -3,8 +3,6 @@
3 3
4#include <asm-generic/mman.h> 4#include <asm-generic/mman.h>
5 5
6/* orig : i386 2.6.0-test6 */
7
8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
10#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ 8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
diff --git a/include/asm-m32r/mmu.h b/include/asm-m32r/mmu.h
index cf3f6d78ac66..d9bd724479cf 100644
--- a/include/asm-m32r/mmu.h
+++ b/include/asm-m32r/mmu.h
@@ -1,13 +1,14 @@
1#ifndef _ASM_M32R_MMU_H 1#ifndef _ASM_M32R_MMU_H
2#define _ASM_M32R_MMU_H 2#define _ASM_M32R_MMU_H
3 3
4
5#if !defined(CONFIG_MMU) 4#if !defined(CONFIG_MMU)
5
6typedef struct { 6typedef struct {
7 struct vm_list_struct *vmlist; 7 struct vm_list_struct *vmlist;
8 unsigned long end_brk; 8 unsigned long end_brk;
9} mm_context_t; 9} mm_context_t;
10#else 10
11#else /* CONFIG_MMU */
11 12
12/* Default "unsigned long" context */ 13/* Default "unsigned long" context */
13#ifndef CONFIG_SMP 14#ifndef CONFIG_SMP
@@ -16,5 +17,6 @@ typedef unsigned long mm_context_t;
16typedef unsigned long mm_context_t[NR_CPUS]; 17typedef unsigned long mm_context_t[NR_CPUS];
17#endif 18#endif
18 19
19#endif /* CONFIG_MMU */ 20#endif /* CONFIG_MMU */
20#endif /* _ASM_M32R_MMU_H */ 21
22#endif /* _ASM_M32R_MMU_H */
diff --git a/include/asm-m32r/mmu_context.h b/include/asm-m32r/mmu_context.h
index 542302eb6bcb..1f40d4a0acf1 100644
--- a/include/asm-m32r/mmu_context.h
+++ b/include/asm-m32r/mmu_context.h
@@ -1,9 +1,7 @@
1#ifndef _ASM_M32R_MMU_CONTEXT_H 1#ifndef _ASM_M32R_MMU_CONTEXT_H
2#define _ASM_M32R_MMU_CONTEXT_H 2#define _ASM_M32R_MMU_CONTEXT_H
3
4#ifdef __KERNEL__ 3#ifdef __KERNEL__
5 4
6
7#include <asm/m32r.h> 5#include <asm/m32r.h>
8 6
9#define MMU_CONTEXT_ASID_MASK (0x000000FF) 7#define MMU_CONTEXT_ASID_MASK (0x000000FF)
@@ -11,7 +9,6 @@
11#define MMU_CONTEXT_FIRST_VERSION (0x00000100) 9#define MMU_CONTEXT_FIRST_VERSION (0x00000100)
12#define NO_CONTEXT (0x00000000) 10#define NO_CONTEXT (0x00000000)
13 11
14
15#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
16 13
17#include <asm/atomic.h> 14#include <asm/atomic.h>
@@ -147,7 +144,7 @@ static inline void switch_mm(struct mm_struct *prev,
147#define activate_mm(prev, next) \ 144#define activate_mm(prev, next) \
148 switch_mm((prev), (next), NULL) 145 switch_mm((prev), (next), NULL)
149 146
150#else 147#else /* not CONFIG_MMU */
151#define get_mmu_context(mm) do { } while (0) 148#define get_mmu_context(mm) do { } while (0)
152#define init_new_context(tsk,mm) (0) 149#define init_new_context(tsk,mm) (0)
153#define destroy_context(mm) do { } while (0) 150#define destroy_context(mm) do { } while (0)
@@ -158,11 +155,9 @@ static inline void switch_mm(struct mm_struct *prev,
158#define deactivate_mm(mm,tsk) do { } while (0) 155#define deactivate_mm(mm,tsk) do { } while (0)
159#define activate_mm(prev,next) do { } while (0) 156#define activate_mm(prev,next) do { } while (0)
160#define enter_lazy_tlb(mm,tsk) do { } while (0) 157#define enter_lazy_tlb(mm,tsk) do { } while (0)
161#endif /* CONFIG_MMU */ 158#endif /* not CONFIG_MMU */
162
163 159
164#endif /* not __ASSEMBLY__ */ 160#endif /* not __ASSEMBLY__ */
165 161
166#endif /* __KERNEL__ */ 162#endif /* __KERNEL__ */
167
168#endif /* _ASM_M32R_MMU_CONTEXT_H */ 163#endif /* _ASM_M32R_MMU_CONTEXT_H */
diff --git a/include/asm-m32r/module.h b/include/asm-m32r/module.h
index 3f2541c92a7b..eb73ee011215 100644
--- a/include/asm-m32r/module.h
+++ b/include/asm-m32r/module.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_MODULE_H 1#ifndef _ASM_M32R_MODULE_H
2#define _ASM_M32R_MODULE_H 2#define _ASM_M32R_MODULE_H
3 3
4/* $Id$ */
5
6struct mod_arch_specific { }; 4struct mod_arch_specific { };
7 5
8#define Elf_Shdr Elf32_Shdr 6#define Elf_Shdr Elf32_Shdr
@@ -10,4 +8,3 @@ struct mod_arch_specific { };
10#define Elf_Ehdr Elf32_Ehdr 8#define Elf_Ehdr Elf32_Ehdr
11 9
12#endif /* _ASM_M32R_MODULE_H */ 10#endif /* _ASM_M32R_MODULE_H */
13
diff --git a/include/asm-m32r/msgbuf.h b/include/asm-m32r/msgbuf.h
index 852ff52af4c2..0d5a877b813e 100644
--- a/include/asm-m32r/msgbuf.h
+++ b/include/asm-m32r/msgbuf.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_MSGBUF_H 1#ifndef _ASM_M32R_MSGBUF_H
2#define _ASM_M32R_MSGBUF_H 2#define _ASM_M32R_MSGBUF_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* 4/*
9 * The msqid64_ds structure for m32r architecture. 5 * The msqid64_ds structure for m32r architecture.
10 * Note extra padding because this structure is passed back and forth 6 * Note extra padding because this structure is passed back and forth
diff --git a/include/asm-m32r/namei.h b/include/asm-m32r/namei.h
index 7172d3d2e260..210f8056b805 100644
--- a/include/asm-m32r/namei.h
+++ b/include/asm-m32r/namei.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_NAMEI_H 1#ifndef _ASM_M32R_NAMEI_H
2#define _ASM_M32R_NAMEI_H 2#define _ASM_M32R_NAMEI_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* 4/*
9 * linux/include/asm-m32r/namei.h 5 * linux/include/asm-m32r/namei.h
10 * 6 *
diff --git a/include/asm-m32r/opsput/opsput_lan.h b/include/asm-m32r/opsput/opsput_lan.h
index f53e10187c03..a5f18dd1ab20 100644
--- a/include/asm-m32r/opsput/opsput_lan.h
+++ b/include/asm-m32r/opsput/opsput_lan.h
@@ -1,3 +1,6 @@
1#ifndef _OPSPUT_OPSPUT_LAN_H
2#define _OPSPUT_OPSPUT_LAN_H
3
1/* 4/*
2 * include/asm-m32r/opsput/opsput_lan.h 5 * include/asm-m32r/opsput/opsput_lan.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id: opsput_lan.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $
13 */ 14 */
14 15
15#ifndef _OPSPUT_OPSPUT_LAN_H
16#define _OPSPUT_OPSPUT_LAN_H
17
18
19#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
20/* 17/*
21 * C functions use non-cache address. 18 * C functions use non-cache address.
@@ -23,7 +20,7 @@
23#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) 20#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */)
24#else 21#else
25#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) 22#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET)
26#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
27 24
28/* ICU 25/* ICU
29 * ICUISTS: status register 26 * ICUISTS: status register
@@ -52,4 +49,4 @@
52#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010) 49#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010)
53#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014) 50#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014)
54 51
55#endif /* _OPSPUT_OPSPUT_LAN_H */ 52#endif /* _OPSPUT_OPSPUT_LAN_H */
diff --git a/include/asm-m32r/opsput/opsput_lcd.h b/include/asm-m32r/opsput/opsput_lcd.h
index 99f296e1b61b..369c9f0832a6 100644
--- a/include/asm-m32r/opsput/opsput_lcd.h
+++ b/include/asm-m32r/opsput/opsput_lcd.h
@@ -1,3 +1,6 @@
1#ifndef _OPSPUT_OPSPUT_LCD_H
2#define _OPSPUT_OPSPUT_LCD_H
3
1/* 4/*
2 * include/asm-m32r/opsput/opsput_lcd.h 5 * include/asm-m32r/opsput/opsput_lcd.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id: opsput_lcd.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $
13 */ 14 */
14 15
15#ifndef _OPSPUT_OPSPUT_LCD_H
16#define _OPSPUT_OPSPUT_LCD_H
17
18
19#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
20/* 17/*
21 * C functions use non-cache address. 18 * C functions use non-cache address.
@@ -23,7 +20,7 @@
23#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) 20#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */)
24#else 21#else
25#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) 22#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET)
26#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
27 24
28/* 25/*
29 * ICU 26 * ICU
@@ -55,4 +52,4 @@
55#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036) 52#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036)
56#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a) 53#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a)
57 54
58#endif /* _OPSPUT_OPSPUT_LCD_H */ 55#endif /* _OPSPUT_OPSPUT_LCD_H */
diff --git a/include/asm-m32r/opsput/opsput_pld.h b/include/asm-m32r/opsput/opsput_pld.h
index a8d6452076f1..3f11ea1aac2d 100644
--- a/include/asm-m32r/opsput/opsput_pld.h
+++ b/include/asm-m32r/opsput/opsput_pld.h
@@ -1,3 +1,6 @@
1#ifndef _OPSPUT_OPSPUT_PLD_H
2#define _OPSPUT_OPSPUT_PLD_H
3
1/* 4/*
2 * include/asm-m32r/opsput/opsput_pld.h 5 * include/asm-m32r/opsput/opsput_pld.h
3 * 6 *
@@ -8,14 +11,8 @@
8 * This file is subject to the terms and conditions of the GNU General 11 * 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 12 * Public License. See the file "COPYING" in the main directory of
10 * this archive for more details. 13 * this archive for more details.
11 *
12 * $Id: opsput_pld.h,v 1.1 2004/07/27 06:54:20 sakugawa Exp $
13 */ 14 */
14 15
15#ifndef _OPSPUT_OPSPUT_PLD_H
16#define _OPSPUT_OPSPUT_PLD_H
17
18
19#define PLD_PLAT_BASE 0x1cc00000 16#define PLD_PLAT_BASE 0x1cc00000
20 17
21#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
@@ -31,7 +28,7 @@
31#define __reg8 28#define __reg8
32#define __reg16 29#define __reg16
33#define __reg32 30#define __reg32
34#endif /* __ASSEMBLY__ */ 31#endif /* __ASSEMBLY__ */
35 32
36/* CFC */ 33/* CFC */
37#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) 34#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000)
@@ -255,4 +252,4 @@
255#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) 252#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c)
256#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) 253#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e)
257 254
258#endif /* _OPSPUT_OPSPUT_PLD.H */ 255#endif /* _OPSPUT_OPSPUT_PLD.H */
diff --git a/include/asm-m32r/page.h b/include/asm-m32r/page.h
index 404a4c24007b..6f6ecf7d14a3 100644
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_M32R_PAGE_H 1#ifndef _ASM_M32R_PAGE_H
2#define _ASM_M32R_PAGE_H 2#define _ASM_M32R_PAGE_H
3 3
4
5/* PAGE_SHIFT determines the page size */ 4/* PAGE_SHIFT determines the page size */
6#define PAGE_SHIFT 12 5#define PAGE_SHIFT 12
7#define PAGE_SIZE (1UL << PAGE_SHIFT) 6#define PAGE_SIZE (1UL << PAGE_SHIFT)
@@ -57,9 +56,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
57 * and CONFIG_HIGHMEM64G options in the kernel configuration. 56 * and CONFIG_HIGHMEM64G options in the kernel configuration.
58 */ 57 */
59 58
60
61/* This handles the memory map.. */
62
63#define __MEMORY_START CONFIG_MEMORY_START 59#define __MEMORY_START CONFIG_MEMORY_START
64#define __MEMORY_SIZE CONFIG_MEMORY_SIZE 60#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
65 61
@@ -92,4 +88,3 @@ typedef struct { unsigned long pgprot; } pgprot_t;
92 88
93#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
94#endif /* _ASM_M32R_PAGE_H */ 90#endif /* _ASM_M32R_PAGE_H */
95
diff --git a/include/asm-m32r/param.h b/include/asm-m32r/param.h
index 750b938ccb52..3e14026e39cd 100644
--- a/include/asm-m32r/param.h
+++ b/include/asm-m32r/param.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_PARAM_H 1#ifndef _ASM_M32R_PARAM_H
2#define _ASM_M32R_PARAM_H 2#define _ASM_M32R_PARAM_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.5.67 */
7
8#ifdef __KERNEL__ 4#ifdef __KERNEL__
9# define HZ 100 /* Internal kernel timer frequency */ 5# define HZ 100 /* Internal kernel timer frequency */
10# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ 6# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
diff --git a/include/asm-m32r/pci.h b/include/asm-m32r/pci.h
index 00d7b6f39a33..fe785d167db6 100644
--- a/include/asm-m32r/pci.h
+++ b/include/asm-m32r/pci.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_PCI_H 1#ifndef _ASM_M32R_PCI_H
2#define _ASM_M32R_PCI_H 2#define _ASM_M32R_PCI_H
3 3
4/* $Id$ */
5
6#include <asm-generic/pci.h> 4#include <asm-generic/pci.h>
7 5
8#define PCI_DMA_BUS_IS_PHYS (1) 6#define PCI_DMA_BUS_IS_PHYS (1)
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h
index e09a86c3cadf..943ba63c1ebc 100644
--- a/include/asm-m32r/pgalloc.h
+++ b/include/asm-m32r/pgalloc.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_PGALLOC_H 1#ifndef _ASM_M32R_PGALLOC_H
2#define _ASM_M32R_PGALLOC_H 2#define _ASM_M32R_PGALLOC_H
3 3
4/* $Id$ */
5
6#include <linux/mm.h> 4#include <linux/mm.h>
7 5
8#include <asm/io.h> 6#include <asm/io.h>
@@ -74,4 +72,3 @@ static __inline__ void pte_free(struct page *pte)
74#define check_pgt_cache() do { } while (0) 72#define check_pgt_cache() do { } while (0)
75 73
76#endif /* _ASM_M32R_PGALLOC_H */ 74#endif /* _ASM_M32R_PGALLOC_H */
77
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
index 84152760e0b5..750925726a10 100644
--- a/include/asm-m32r/pgtable-2level.h
+++ b/include/asm-m32r/pgtable-2level.h
@@ -1,9 +1,7 @@
1#ifndef _ASM_M32R_PGTABLE_2LEVEL_H 1#ifndef _ASM_M32R_PGTABLE_2LEVEL_H
2#define _ASM_M32R_PGTABLE_2LEVEL_H 2#define _ASM_M32R_PGTABLE_2LEVEL_H
3
4#ifdef __KERNEL__ 3#ifdef __KERNEL__
5 4
6
7/* 5/*
8 * traditional M32R two-level paging structure: 6 * traditional M32R two-level paging structure:
9 */ 7 */
@@ -77,5 +75,4 @@ static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address)
77#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xef) << 2) | (((off) >> 7) << 10) | _PAGE_FILE }) 75#define pgoff_to_pte(off) ((pte_t) { (((off) & 0xef) << 2) | (((off) >> 7) << 10) | _PAGE_FILE })
78 76
79#endif /* __KERNEL__ */ 77#endif /* __KERNEL__ */
80
81#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ 78#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */
diff --git a/include/asm-m32r/posix_types.h b/include/asm-m32r/posix_types.h
index 47e7e85a3dc3..1caac65d208f 100644
--- a/include/asm-m32r/posix_types.h
+++ b/include/asm-m32r/posix_types.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_POSIX_TYPES_H 1#ifndef _ASM_M32R_POSIX_TYPES_H
2#define _ASM_M32R_POSIX_TYPES_H 2#define _ASM_M32R_POSIX_TYPES_H
3 3
4/* $Id$ */
5
6/* orig : i386, sh 2.4.18 */
7
8/* 4/*
9 * This file is generally used by user-level software, so you need to 5 * This file is generally used by user-level software, so you need to
10 * be a little careful about namespace pollution etc. Also, we cannot 6 * be a little careful about namespace pollution etc. Also, we cannot
diff --git a/include/asm-m32r/rtc.h b/include/asm-m32r/rtc.h
index 6b2b837c5978..0340633f3f4d 100644
--- a/include/asm-m32r/rtc.h
+++ b/include/asm-m32r/rtc.h
@@ -1,10 +1,6 @@
1/* $Id: rtc.h,v 1.1.1.1 2004/03/25 04:29:22 hitoshiy Exp $ */
2
3#ifndef __RTC_H__ 1#ifndef __RTC_H__
4#define __RTC_H__ 2#define __RTC_H__
5 3
6
7
8 /* Dallas DS1302 clock/calendar register numbers. */ 4 /* Dallas DS1302 clock/calendar register numbers. */
9# define RTC_SECONDS 0 5# define RTC_SECONDS 0
10# define RTC_MINUTES 1 6# define RTC_MINUTES 1
diff --git a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h
index 09a10e43bf0f..c2de96cb69ed 100644
--- a/include/asm-m32r/scatterlist.h
+++ b/include/asm-m32r/scatterlist.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_SCATTERLIST_H 1#ifndef _ASM_M32R_SCATTERLIST_H
2#define _ASM_M32R_SCATTERLIST_H 2#define _ASM_M32R_SCATTERLIST_H
3 3
4/* $Id$ */
5
6struct scatterlist { 4struct scatterlist {
7 char * address; /* Location data is to be transferred to, NULL for 5 char * address; /* Location data is to be transferred to, NULL for
8 * highmem page */ 6 * highmem page */
diff --git a/include/asm-m32r/sections.h b/include/asm-m32r/sections.h
index 6b969e53b806..5e5d21c4908a 100644
--- a/include/asm-m32r/sections.h
+++ b/include/asm-m32r/sections.h
@@ -5,4 +5,3 @@
5#include <asm-generic/sections.h> 5#include <asm-generic/sections.h>
6 6
7#endif /* _M32R_SECTIONS_H */ 7#endif /* _M32R_SECTIONS_H */
8
diff --git a/include/asm-m32r/segment.h b/include/asm-m32r/segment.h
index e45db68e6c2d..42b11aeb3249 100644
--- a/include/asm-m32r/segment.h
+++ b/include/asm-m32r/segment.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_SEGMENT_H 1#ifndef _ASM_M32R_SEGMENT_H
2#define _ASM_M32R_SEGMENT_H 2#define _ASM_M32R_SEGMENT_H
3 3
4/* $Id$ */
5
6/* orig : i386 (2.4.18) */
7
8#define __KERNEL_CS 0x10 4#define __KERNEL_CS 0x10
9#define __KERNEL_DS 0x18 5#define __KERNEL_DS 0x18
10 6
diff --git a/include/asm-m32r/sembuf.h b/include/asm-m32r/sembuf.h
index e69018e6ff71..c9873d6890e2 100644
--- a/include/asm-m32r/sembuf.h
+++ b/include/asm-m32r/sembuf.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_SEMBUF_H 1#ifndef _ASM_M32R_SEMBUF_H
2#define _ASM_M32R_SEMBUF_H 2#define _ASM_M32R_SEMBUF_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* 4/*
9 * The semid64_ds structure for m32r architecture. 5 * The semid64_ds structure for m32r architecture.
10 * Note extra padding because this structure is passed back and forth 6 * Note extra padding because this structure is passed back and forth
diff --git a/include/asm-m32r/setup.h b/include/asm-m32r/setup.h
index 6a0b32202d4e..c637ab992394 100644
--- a/include/asm-m32r/setup.h
+++ b/include/asm-m32r/setup.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_M32R_SETUP_H
2#define _ASM_M32R_SETUP_H
3
1/* 4/*
2 * This is set up by the setup-routine at boot-time 5 * This is set up by the setup-routine at boot-time
3 */ 6 */
@@ -32,3 +35,4 @@ extern unsigned long memory_end;
32 35
33#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
34 37
38#endif /* _ASM_M32R_SETUP_H */
diff --git a/include/asm-m32r/shmbuf.h b/include/asm-m32r/shmbuf.h
index b84e897fa87b..b0cdf0aa7d65 100644
--- a/include/asm-m32r/shmbuf.h
+++ b/include/asm-m32r/shmbuf.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_SHMBUF_H 1#ifndef _ASM_M32R_SHMBUF_H
2#define _ASM_M32R_SHMBUF_H 2#define _ASM_M32R_SHMBUF_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8/* 4/*
9 * The shmid64_ds structure for M32R architecture. 5 * The shmid64_ds structure for M32R architecture.
10 * Note extra padding because this structure is passed back and forth 6 * Note extra padding because this structure is passed back and forth
diff --git a/include/asm-m32r/shmparam.h b/include/asm-m32r/shmparam.h
index db0019ba955d..35986d81a528 100644
--- a/include/asm-m32r/shmparam.h
+++ b/include/asm-m32r/shmparam.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_SHMPARAM_H 1#ifndef _ASM_M32R_SHMPARAM_H
2#define _ASM_M32R_SHMPARAM_H 2#define _ASM_M32R_SHMPARAM_H
3 3
4/* $Id$ */
5
6#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ 4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
7 5
8#endif /* _ASM_M32R_SHMPARAM_H */ 6#endif /* _ASM_M32R_SHMPARAM_H */
diff --git a/include/asm-m32r/sigcontext.h b/include/asm-m32r/sigcontext.h
index 62537dc4dec9..da4a9c36d09b 100644
--- a/include/asm-m32r/sigcontext.h
+++ b/include/asm-m32r/sigcontext.h
@@ -1,9 +1,6 @@
1#ifndef _ASM_M32R_SIGCONTEXT_H 1#ifndef _ASM_M32R_SIGCONTEXT_H
2#define _ASM_M32R_SIGCONTEXT_H 2#define _ASM_M32R_SIGCONTEXT_H
3 3
4/* $Id$ */
5
6
7struct sigcontext { 4struct sigcontext {
8 /* CPU registers */ 5 /* CPU registers */
9 /* Saved main processor registers. */ 6 /* Saved main processor registers. */
diff --git a/include/asm-m32r/siginfo.h b/include/asm-m32r/siginfo.h
index 482202f2e77f..7d9cd9ebfd0e 100644
--- a/include/asm-m32r/siginfo.h
+++ b/include/asm-m32r/siginfo.h
@@ -1,8 +1,6 @@
1#ifndef _M32R_SIGINFO_H 1#ifndef _M32R_SIGINFO_H
2#define _M32R_SIGINFO_H 2#define _M32R_SIGINFO_H
3 3
4/* $Id$ */
5
6#include <asm-generic/siginfo.h> 4#include <asm-generic/siginfo.h>
7 5
8#endif /* _M32R_SIGINFO_H */ 6#endif /* _M32R_SIGINFO_H */
diff --git a/include/asm-m32r/signal.h b/include/asm-m32r/signal.h
index 65423bed32b1..937258686ba5 100644
--- a/include/asm-m32r/signal.h
+++ b/include/asm-m32r/signal.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_SIGNAL_H 1#ifndef _ASM_M32R_SIGNAL_H
2#define _ASM_M32R_SIGNAL_H 2#define _ASM_M32R_SIGNAL_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8#include <linux/types.h> 4#include <linux/types.h>
9#include <linux/time.h> 5#include <linux/time.h>
10#include <linux/compiler.h> 6#include <linux/compiler.h>
diff --git a/include/asm-m32r/smp.h b/include/asm-m32r/smp.h
index 650d2558c304..abd937ac5239 100644
--- a/include/asm-m32r/smp.h
+++ b/include/asm-m32r/smp.h
@@ -1,9 +1,6 @@
1#ifndef _ASM_M32R_SMP_H 1#ifndef _ASM_M32R_SMP_H
2#define _ASM_M32R_SMP_H 2#define _ASM_M32R_SMP_H
3 3
4/* $Id$ */
5
6
7#ifdef CONFIG_SMP 4#ifdef CONFIG_SMP
8#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
9 6
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index acdf748fcdc8..793d5d30c850 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_M32R_SOCKET_H */ 55#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m32r/sockios.h b/include/asm-m32r/sockios.h
index 147a118442ac..6c1fb9b43bdb 100644
--- a/include/asm-m32r/sockios.h
+++ b/include/asm-m32r/sockios.h
@@ -1,14 +1,13 @@
1#ifndef _ASM_M32R_SOCKIOS_H 1#ifndef _ASM_M32R_SOCKIOS_H
2#define _ASM_M32R_SOCKIOS_H 2#define _ASM_M32R_SOCKIOS_H
3 3
4/* $Id$ */
5
6/* Socket-level I/O control calls. */ 4/* Socket-level I/O control calls. */
7#define FIOSETOWN 0x8901 5#define FIOSETOWN 0x8901
8#define SIOCSPGRP 0x8902 6#define SIOCSPGRP 0x8902
9#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
10#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
11#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
12#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
13 12
14#endif /* _ASM_M32R_SOCKIOS_H */ 13#endif /* _ASM_M32R_SOCKIOS_H */
diff --git a/include/asm-m32r/spinlock_types.h b/include/asm-m32r/spinlock_types.h
index 7e9941c45f40..83f52105c0e4 100644
--- a/include/asm-m32r/spinlock_types.h
+++ b/include/asm-m32r/spinlock_types.h
@@ -20,4 +20,4 @@ typedef struct {
20 20
21#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } 21#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
22 22
23#endif 23#endif /* _ASM_M32R_SPINLOCK_TYPES_H */
diff --git a/include/asm-m32r/stat.h b/include/asm-m32r/stat.h
index 05748fef4c8e..da4518f82d6d 100644
--- a/include/asm-m32r/stat.h
+++ b/include/asm-m32r/stat.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_STAT_H 1#ifndef _ASM_M32R_STAT_H
2#define _ASM_M32R_STAT_H 2#define _ASM_M32R_STAT_H
3 3
4/* $Id$ */
5
6/* orig : i386 2.4.18 */
7
8#include <asm/byteorder.h> 4#include <asm/byteorder.h>
9 5
10struct __old_kernel_stat { 6struct __old_kernel_stat {
diff --git a/include/asm-m32r/string.h b/include/asm-m32r/string.h
index cb54bcc2e677..e61e2b0bfc1f 100644
--- a/include/asm-m32r/string.h
+++ b/include/asm-m32r/string.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_STRING_H 1#ifndef _ASM_M32R_STRING_H
2#define _ASM_M32R_STRING_H 2#define _ASM_M32R_STRING_H
3 3
4/* $Id$ */
5
6#define __HAVE_ARCH_STRLEN 4#define __HAVE_ARCH_STRLEN
7extern size_t strlen(const char * s); 5extern size_t strlen(const char * s);
8 6
diff --git a/include/asm-m32r/syscall.h b/include/asm-m32r/syscall.h
index d8d4b2c7a7d4..25f316f2b78d 100644
--- a/include/asm-m32r/syscall.h
+++ b/include/asm-m32r/syscall.h
@@ -1,11 +1,8 @@
1#ifndef _ASM_M32R_SYSCALL_H 1#ifndef _ASM_M32R_SYSCALL_H
2#define _ASM_M32R_SYSCALL_H 2#define _ASM_M32R_SYSCALL_H
3 3
4/* $Id$ */
5
6/* Definitions for the system call vector. */ 4/* Definitions for the system call vector. */
7#define SYSCALL_VECTOR "2" 5#define SYSCALL_VECTOR "2"
8#define SYSCALL_VECTOR_ADDRESS "0xa0" 6#define SYSCALL_VECTOR_ADDRESS "0xa0"
9 7
10#endif /* _ASM_M32R_SYSCALL_H */ 8#endif /* _ASM_M32R_SYSCALL_H */
11
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index 4ce0619f6989..99ee09889ff7 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -339,4 +339,4 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
339 339
340#define arch_align_stack(x) (x) 340#define arch_align_stack(x) (x)
341 341
342#endif /* _ASM_M32R_SYSTEM_H */ 342#endif /* _ASM_M32R_SYSTEM_H */
diff --git a/include/asm-m32r/termbits.h b/include/asm-m32r/termbits.h
index faf2bd0504c1..e402641dfbad 100644
--- a/include/asm-m32r/termbits.h
+++ b/include/asm-m32r/termbits.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_TERMBITS_H 1#ifndef _ASM_M32R_TERMBITS_H
2#define _ASM_M32R_TERMBITS_H 2#define _ASM_M32R_TERMBITS_H
3 3
4/* $Id$ */
5
6#include <linux/posix_types.h> 4#include <linux/posix_types.h>
7 5
8typedef unsigned char cc_t; 6typedef unsigned char cc_t;
@@ -184,4 +182,4 @@ struct ktermios {
184#define TCSADRAIN 1 182#define TCSADRAIN 1
185#define TCSAFLUSH 2 183#define TCSAFLUSH 2
186 184
187#endif /* _ASM_M32R_TERMBITS_H */ 185#endif /* _ASM_M32R_TERMBITS_H */
diff --git a/include/asm-m32r/termios.h b/include/asm-m32r/termios.h
index fc99d2e178d8..4943dd8db44d 100644
--- a/include/asm-m32r/termios.h
+++ b/include/asm-m32r/termios.h
@@ -1,8 +1,6 @@
1#ifndef _M32R_TERMIOS_H 1#ifndef _M32R_TERMIOS_H
2#define _M32R_TERMIOS_H 2#define _M32R_TERMIOS_H
3 3
4/* orig : i386 2.6.0-test5 */
5
6#include <asm/termbits.h> 4#include <asm/termbits.h>
7#include <asm/ioctls.h> 5#include <asm/ioctls.h>
8 6
@@ -41,24 +39,6 @@ struct termio {
41 39
42/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
43 41
44/* line disciplines */
45#define N_TTY 0
46#define N_SLIP 1
47#define N_MOUSE 2
48#define N_PPP 3
49#define N_STRIP 4
50#define N_AX25 5
51#define N_X25 6 /* X.25 async */
52#define N_6PACK 7
53#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
54#define N_R3964 9 /* Reserved for Simatic R3964 module */
55#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
56#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
57#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
58#define N_HDLC 13 /* synchronous HDLC */
59#define N_SYNC_PPP 14 /* synchronous PPP */
60#define N_HCI 15 /* Bluetooth HCI UART */
61
62#ifdef __KERNEL__ 42#ifdef __KERNEL__
63#include <linux/module.h> 43#include <linux/module.h>
64 44
diff --git a/include/asm-m32r/timex.h b/include/asm-m32r/timex.h
index 019441c1d7a0..bb9fe4feb12d 100644
--- a/include/asm-m32r/timex.h
+++ b/include/asm-m32r/timex.h
@@ -1,15 +1,12 @@
1#ifndef _ASM_M32R_TIMEX_H 1#ifndef _ASM_M32R_TIMEX_H
2#define _ASM_M32R_TIMEX_H 2#define _ASM_M32R_TIMEX_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * linux/include/asm-m32r/timex.h 5 * linux/include/asm-m32r/timex.h
8 * 6 *
9 * m32r architecture timex specifications 7 * m32r architecture timex specifications
10 */ 8 */
11 9
12
13#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE) 10#define CLOCK_TICK_RATE (CONFIG_BUS_CLOCK / CONFIG_TIMER_DIVIDE)
14#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ 11#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
15 12
diff --git a/include/asm-m32r/tlbflush.h b/include/asm-m32r/tlbflush.h
index ae4494960593..3d37ac002bcc 100644
--- a/include/asm-m32r/tlbflush.h
+++ b/include/asm-m32r/tlbflush.h
@@ -98,4 +98,3 @@ static __inline__ void __flush_tlb_all(void)
98extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 98extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
99 99
100#endif /* _ASM_M32R_TLBFLUSH_H */ 100#endif /* _ASM_M32R_TLBFLUSH_H */
101
diff --git a/include/asm-m32r/types.h b/include/asm-m32r/types.h
index fcf24c64c3ba..27d3eb539c50 100644
--- a/include/asm-m32r/types.h
+++ b/include/asm-m32r/types.h
@@ -3,10 +3,6 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6/* $Id$ */
7
8/* orig : i386 2.4.18 */
9
10typedef unsigned short umode_t; 6typedef unsigned short umode_t;
11 7
12/* 8/*
@@ -59,4 +55,4 @@ typedef u64 dma64_addr_t;
59 55
60#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
61 57
62#endif /* _ASM_M32R_TYPES_H */ 58#endif /* _ASM_M32R_TYPES_H */
diff --git a/include/asm-m32r/uaccess.h b/include/asm-m32r/uaccess.h
index 26e978c7e3b4..bd8c83765a5c 100644
--- a/include/asm-m32r/uaccess.h
+++ b/include/asm-m32r/uaccess.h
@@ -68,7 +68,7 @@ static inline void set_fs(mm_segment_t s)
68 * This needs 33-bit arithmetic. We have a carry... 68 * This needs 33-bit arithmetic. We have a carry...
69 */ 69 */
70#define __range_ok(addr,size) ({ \ 70#define __range_ok(addr,size) ({ \
71 unsigned long flag, sum; \ 71 unsigned long flag, roksum; \
72 __chk_user_ptr(addr); \ 72 __chk_user_ptr(addr); \
73 asm ( \ 73 asm ( \
74 " cmpu %1, %1 ; clear cbit\n" \ 74 " cmpu %1, %1 ; clear cbit\n" \
@@ -76,7 +76,7 @@ static inline void set_fs(mm_segment_t s)
76 " subx %0, %0\n" \ 76 " subx %0, %0\n" \
77 " cmpu %4, %1\n" \ 77 " cmpu %4, %1\n" \
78 " subx %0, %5\n" \ 78 " subx %0, %5\n" \
79 : "=&r" (flag), "=r" (sum) \ 79 : "=&r" (flag), "=r" (roksum) \
80 : "1" (addr), "r" ((int)(size)), \ 80 : "1" (addr), "r" ((int)(size)), \
81 "r" (current_thread_info()->addr_limit.seg), "r" (0) \ 81 "r" (current_thread_info()->addr_limit.seg), "r" (0) \
82 : "cbit" ); \ 82 : "cbit" ); \
diff --git a/include/asm-m32r/ucontext.h b/include/asm-m32r/ucontext.h
index 2de709a5c53c..09324741eec3 100644
--- a/include/asm-m32r/ucontext.h
+++ b/include/asm-m32r/ucontext.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_UCONTEXT_H 1#ifndef _ASM_M32R_UCONTEXT_H
2#define _ASM_M32R_UCONTEXT_H 2#define _ASM_M32R_UCONTEXT_H
3 3
4/* orig : i386 2.4.18 */
5
6struct ucontext { 4struct ucontext {
7 unsigned long uc_flags; 5 unsigned long uc_flags;
8 struct ucontext *uc_link; 6 struct ucontext *uc_link;
diff --git a/include/asm-m32r/unaligned.h b/include/asm-m32r/unaligned.h
index 3aef9ac8d3aa..fccc180c3913 100644
--- a/include/asm-m32r/unaligned.h
+++ b/include/asm-m32r/unaligned.h
@@ -1,10 +1,6 @@
1#ifndef _ASM_M32R_UNALIGNED_H 1#ifndef _ASM_M32R_UNALIGNED_H
2#define _ASM_M32R_UNALIGNED_H 2#define _ASM_M32R_UNALIGNED_H
3 3
4/* $Id$ */
5
6/* orig : generic 2.4.18 */
7
8/* 4/*
9 * For the benefit of those who are trying to port Linux to another 5 * For the benefit of those who are trying to port Linux to another
10 * architecture, here are some C-language equivalents. 6 * architecture, here are some C-language equivalents.
@@ -12,7 +8,6 @@
12 8
13#include <asm/string.h> 9#include <asm/string.h>
14 10
15
16#define get_unaligned(ptr) \ 11#define get_unaligned(ptr) \
17 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; }) 12 ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
18 13
@@ -21,5 +16,4 @@
21 memmove((ptr), &__tmp, sizeof(*(ptr))); \ 16 memmove((ptr), &__tmp, sizeof(*(ptr))); \
22 (void)0; }) 17 (void)0; })
23 18
24 19#endif /* _ASM_M32R_UNALIGNED_H */
25#endif /* _ASM_M32R_UNALIGNED_H */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index 5b66bd3c6ed6..cbbd53762ea6 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_UNISTD_H 1#ifndef _ASM_M32R_UNISTD_H
2#define _ASM_M32R_UNISTD_H 2#define _ASM_M32R_UNISTD_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * This file contains the system call numbers. 5 * This file contains the system call numbers.
8 */ 6 */
diff --git a/include/asm-m32r/user.h b/include/asm-m32r/user.h
index 1ad4ded8483b..035258d713d0 100644
--- a/include/asm-m32r/user.h
+++ b/include/asm-m32r/user.h
@@ -1,12 +1,6 @@
1#ifndef _ASM_M32R_USER_H 1#ifndef _ASM_M32R_USER_H
2#define _ASM_M32R_USER_H 2#define _ASM_M32R_USER_H
3 3
4/* $Id$ */
5
6/* orig : sh 2.4.18
7 * mod : remove fpu registers
8 */
9
10#include <linux/types.h> 4#include <linux/types.h>
11#include <asm/ptrace.h> 5#include <asm/ptrace.h>
12#include <asm/page.h> 6#include <asm/page.h>
diff --git a/include/asm-m32r/vga.h b/include/asm-m32r/vga.h
index 533163447cc9..a1b63061c06f 100644
--- a/include/asm-m32r/vga.h
+++ b/include/asm-m32r/vga.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_VGA_H 1#ifndef _ASM_M32R_VGA_H
2#define _ASM_M32R_VGA_H 2#define _ASM_M32R_VGA_H
3 3
4/* $Id$ */
5
6/* 4/*
7 * Access to VGA videoram 5 * Access to VGA videoram
8 * 6 *
@@ -19,4 +17,4 @@
19#define vga_readb(x) (*(x)) 17#define vga_readb(x) (*(x))
20#define vga_writeb(x,y) (*(y) = (x)) 18#define vga_writeb(x,y) (*(y) = (x))
21 19
22#endif /* _ASM_M32R_VGA_H */ 20#endif /* _ASM_M32R_VGA_H */
diff --git a/include/asm-m32r/xor.h b/include/asm-m32r/xor.h
index fd960dc9bf76..6d525259df3e 100644
--- a/include/asm-m32r/xor.h
+++ b/include/asm-m32r/xor.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_M32R_XOR_H 1#ifndef _ASM_M32R_XOR_H
2#define _ASM_M32R_XOR_H 2#define _ASM_M32R_XOR_H
3 3
4/* $Id$ */
5
6#include <asm-generic/xor.h> 4#include <asm-generic/xor.h>
7 5
8#endif /* _ASM_M32R_XOR_H */ 6#endif /* _ASM_M32R_XOR_H */
diff --git a/include/asm-m68k/div64.h b/include/asm-m68k/div64.h
index 9f65de1a2480..33caad1628d4 100644
--- a/include/asm-m68k/div64.h
+++ b/include/asm-m68k/div64.h
@@ -1,6 +1,8 @@
1#ifndef _M68K_DIV64_H 1#ifndef _M68K_DIV64_H
2#define _M68K_DIV64_H 2#define _M68K_DIV64_H
3 3
4#include <linux/types.h>
5
4/* n = n / base; return rem; */ 6/* n = n / base; return rem; */
5 7
6#define do_div(n, base) ({ \ 8#define do_div(n, base) ({ \
@@ -23,4 +25,5 @@
23 __rem; \ 25 __rem; \
24}) 26})
25 27
28extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
26#endif /* _M68K_DIV64_H */ 29#endif /* _M68K_DIV64_H */
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index 00259ed6fc95..a26cdeb46a57 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -32,7 +32,7 @@ extern void dma_free_coherent(struct device *, size_t,
32 void *, dma_addr_t); 32 void *, dma_addr_t);
33 33
34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, 34static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
35 dma_addr_t *handle, int flag) 35 dma_addr_t *handle, gfp_t flag)
36{ 36{
37 return dma_alloc_coherent(dev, size, handle, flag); 37 return dma_alloc_coherent(dev, size, handle, flag);
38} 38}
diff --git a/include/asm-m68k/math-emu.h b/include/asm-m68k/math-emu.h
index 7ac6259b68df..ddfab96403cb 100644
--- a/include/asm-m68k/math-emu.h
+++ b/include/asm-m68k/math-emu.h
@@ -226,6 +226,21 @@ extern unsigned int fp_debugprint;
226 .previous 226 .previous
227.endm 227.endm
228 228
229/* work around binutils idiocy */
230old_gas=-1
231.irp gas_ident.x .x
232old_gas=old_gas+1
233.endr
234.if !old_gas
235.irp m b,w,l
236.macro getuser.\m src,dest,label,addr
237 getuser .\m,\src,\dest,\label,\addr
238.endm
239.macro putuser.\m src,dest,label,addr
240 putuser .\m,\src,\dest,\label,\addr
241.endm
242.endr
243.endif
229 244
230.macro movestack nr,arg1,arg2,arg3,arg4,arg5 245.macro movestack nr,arg1,arg2,arg3,arg4,arg5
231 .if \nr 246 .if \nr
diff --git a/include/asm-m68k/mc146818rtc.h b/include/asm-m68k/mc146818rtc.h
index 11fe12ddb913..9f70a01f73dc 100644
--- a/include/asm-m68k/mc146818rtc.h
+++ b/include/asm-m68k/mc146818rtc.h
@@ -11,6 +11,7 @@
11#include <asm/atarihw.h> 11#include <asm/atarihw.h>
12 12
13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x)) 13#define RTC_PORT(x) (TT_RTC_BAS + 2*(x))
14#define RTC_ALWAYS_BCD 0
14 15
15#define CMOS_READ(addr) ({ \ 16#define CMOS_READ(addr) ({ \
16atari_outb_p((addr),RTC_PORT(0)); \ 17atari_outb_p((addr),RTC_PORT(0)); \
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index a5966ec005ae..6d21b90863ad 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68k/sockios.h b/include/asm-m68k/sockios.h
index 9b9ed973c24e..c04a23943cb7 100644
--- a/include/asm-m68k/sockios.h
+++ b/include/asm-m68k/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __ARCH_M68K_SOCKIOS__ */ 13#endif /* __ARCH_M68K_SOCKIOS__ */
diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h
index 857f0c9a9120..00edabd76168 100644
--- a/include/asm-m68k/termios.h
+++ b/include/asm-m68k/termios.h
@@ -49,24 +49,6 @@ struct termio {
49 49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51 51
52/* line disciplines */
53#define N_TTY 0
54#define N_SLIP 1
55#define N_MOUSE 2
56#define N_PPP 3
57#define N_STRIP 4
58#define N_AX25 5
59#define N_X25 6 /* X.25 async */
60#define N_6PACK 7
61#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
62#define N_R3964 9 /* Reserved for Simatic R3964 module */
63#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
64#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
65#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
66#define N_HDLC 13 /* synchronous HDLC */
67#define N_SYNC_PPP 14
68#define N_HCI 15 /* Bluetooth HCI UART */
69
70#ifdef __KERNEL__ 52#ifdef __KERNEL__
71 53
72/* 54/*
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index e4c9f080ff20..6a4cf2081512 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -7,6 +7,7 @@
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/sched.h>
10#include <asm/segment.h> 11#include <asm/segment.h>
11 12
12#define VERIFY_READ 0 13#define VERIFY_READ 0
diff --git a/include/asm-m68k/user.h b/include/asm-m68k/user.h
index d7c0b109bd45..8c56ccab4849 100644
--- a/include/asm-m68k/user.h
+++ b/include/asm-m68k/user.h
@@ -1,8 +1,6 @@
1#ifndef _M68K_USER_H 1#ifndef _M68K_USER_H
2#define _M68K_USER_H 2#define _M68K_USER_H
3 3
4#include <asm/page.h>
5
6/* Core file format: The core file is written in such a way that gdb 4/* Core file format: The core file is written in such a way that gdb
7 can understand it and provide useful information to the user (under 5 can understand it and provide useful information to the user (under
8 linux we use the 'trad-core' bfd). There are quite a number of 6 linux we use the 'trad-core' bfd). There are quite a number of
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index d7fa7d9c0e0f..7d6075d9b5cb 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -7,7 +7,6 @@
7 7
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <asm/byteorder.h> /* swab32 */ 9#include <asm/byteorder.h> /* swab32 */
10#include <asm/system.h> /* save_flags */
11 10
12#ifdef __KERNEL__ 11#ifdef __KERNEL__
13 12
diff --git a/include/asm-m68knommu/m528xsim.h b/include/asm-m68knommu/m528xsim.h
index 1a3b1ae06b1e..28bf783a5d6d 100644
--- a/include/asm-m68knommu/m528xsim.h
+++ b/include/asm-m68knommu/m528xsim.h
@@ -47,6 +47,9 @@
47/* set Port AS pin for I2C or UART */ 47/* set Port AS pin for I2C or UART */
48#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056) 48#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056)
49 49
50/* Port UA Pin Assignment Register (8 Bit) */
51#define MCF5282_GPIO_PUAPAR 0x10005C
52
50/* Interrupt Mask Register Register Low */ 53/* Interrupt Mask Register Register Low */
51#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C) 54#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
52/* Interrupt Control Register 7 */ 55/* Interrupt Control Register 7 */
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
index 1ce0518ace2e..1dd74fbdc09b 100644
--- a/include/asm-mips/abi.h
+++ b/include/asm-mips/abi.h
@@ -13,13 +13,13 @@
13#include <asm/siginfo.h> 13#include <asm/siginfo.h>
14 14
15struct mips_abi { 15struct mips_abi {
16 void (* const do_signal)(struct pt_regs *regs);
17 int (* const setup_frame)(struct k_sigaction * ka, 16 int (* const setup_frame)(struct k_sigaction * ka,
18 struct pt_regs *regs, int signr, 17 struct pt_regs *regs, int signr,
19 sigset_t *set); 18 sigset_t *set);
20 int (* const setup_rt_frame)(struct k_sigaction * ka, 19 int (* const setup_rt_frame)(struct k_sigaction * ka,
21 struct pt_regs *regs, int signr, 20 struct pt_regs *regs, int signr,
22 sigset_t *set, siginfo_t *info); 21 sigset_t *set, siginfo_t *info);
22 const unsigned long restart;
23}; 23};
24 24
25#endif /* _ASM_ABI_H */ 25#endif /* _ASM_ABI_H */
diff --git a/include/asm-mips/apm.h b/include/asm-mips/apm.h
deleted file mode 100644
index 4b99ffc11529..000000000000
--- a/include/asm-mips/apm.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/* -*- linux-c -*-
2 *
3 * (C) 2003 zecke@handhelds.org
4 *
5 * GPL version 2
6 *
7 * based on arch/arm/kernel/apm.c
8 * factor out the information needed by architectures to provide
9 * apm status
10 *
11 *
12 */
13#ifndef MIPS_ASM_SA1100_APM_H
14#define MIPS_ASM_SA1100_APM_H
15
16#include <linux/apm_bios.h>
17
18/*
19 * This structure gets filled in by the machine specific 'get_power_status'
20 * implementation. Any fields which are not set default to a safe value.
21 */
22struct apm_power_info {
23 unsigned char ac_line_status;
24#define APM_AC_OFFLINE 0
25#define APM_AC_ONLINE 1
26#define APM_AC_BACKUP 2
27#define APM_AC_UNKNOWN 0xff
28
29 unsigned char battery_status;
30#define APM_BATTERY_STATUS_HIGH 0
31#define APM_BATTERY_STATUS_LOW 1
32#define APM_BATTERY_STATUS_CRITICAL 2
33#define APM_BATTERY_STATUS_CHARGING 3
34#define APM_BATTERY_STATUS_NOT_PRESENT 4
35#define APM_BATTERY_STATUS_UNKNOWN 0xff
36
37 unsigned char battery_flag;
38#define APM_BATTERY_FLAG_HIGH (1 << 0)
39#define APM_BATTERY_FLAG_LOW (1 << 1)
40#define APM_BATTERY_FLAG_CRITICAL (1 << 2)
41#define APM_BATTERY_FLAG_CHARGING (1 << 3)
42#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
43#define APM_BATTERY_FLAG_UNKNOWN 0xff
44
45 int battery_life;
46 int time;
47 int units;
48#define APM_UNITS_MINS 0
49#define APM_UNITS_SECS 1
50#define APM_UNITS_UNKNOWN -1
51
52};
53
54/*
55 * This allows machines to provide their own "apm get power status" function.
56 */
57extern void (*apm_get_power_status)(struct apm_power_info *);
58
59/*
60 * Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
61 */
62void apm_queue_event(apm_event_t event);
63
64#endif
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
index c1a2409bb52a..1ac50b6c47ad 100644
--- a/include/asm-mips/atomic.h
+++ b/include/asm-mips/atomic.h
@@ -69,16 +69,19 @@ static __inline__ void atomic_add(int i, atomic_t * v)
69 "1: ll %0, %1 # atomic_add \n" 69 "1: ll %0, %1 # atomic_add \n"
70 " addu %0, %2 \n" 70 " addu %0, %2 \n"
71 " sc %0, %1 \n" 71 " sc %0, %1 \n"
72 " beqz %0, 1b \n" 72 " beqz %0, 2f \n"
73 " .subsection 2 \n"
74 "2: b 1b \n"
75 " .previous \n"
73 " .set mips0 \n" 76 " .set mips0 \n"
74 : "=&r" (temp), "=m" (v->counter) 77 : "=&r" (temp), "=m" (v->counter)
75 : "Ir" (i), "m" (v->counter)); 78 : "Ir" (i), "m" (v->counter));
76 } else { 79 } else {
77 unsigned long flags; 80 unsigned long flags;
78 81
79 local_irq_save(flags); 82 raw_local_irq_save(flags);
80 v->counter += i; 83 v->counter += i;
81 local_irq_restore(flags); 84 raw_local_irq_restore(flags);
82 } 85 }
83} 86}
84 87
@@ -111,16 +114,19 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
111 "1: ll %0, %1 # atomic_sub \n" 114 "1: ll %0, %1 # atomic_sub \n"
112 " subu %0, %2 \n" 115 " subu %0, %2 \n"
113 " sc %0, %1 \n" 116 " sc %0, %1 \n"
114 " beqz %0, 1b \n" 117 " beqz %0, 2f \n"
118 " .subsection 2 \n"
119 "2: b 1b \n"
120 " .previous \n"
115 " .set mips0 \n" 121 " .set mips0 \n"
116 : "=&r" (temp), "=m" (v->counter) 122 : "=&r" (temp), "=m" (v->counter)
117 : "Ir" (i), "m" (v->counter)); 123 : "Ir" (i), "m" (v->counter));
118 } else { 124 } else {
119 unsigned long flags; 125 unsigned long flags;
120 126
121 local_irq_save(flags); 127 raw_local_irq_save(flags);
122 v->counter -= i; 128 v->counter -= i;
123 local_irq_restore(flags); 129 raw_local_irq_restore(flags);
124 } 130 }
125} 131}
126 132
@@ -155,8 +161,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
155 "1: ll %1, %2 # atomic_add_return \n" 161 "1: ll %1, %2 # atomic_add_return \n"
156 " addu %0, %1, %3 \n" 162 " addu %0, %1, %3 \n"
157 " sc %0, %2 \n" 163 " sc %0, %2 \n"
158 " beqz %0, 1b \n" 164 " beqz %0, 2f \n"
159 " addu %0, %1, %3 \n" 165 " addu %0, %1, %3 \n"
166 " .subsection 2 \n"
167 "2: b 1b \n"
168 " .previous \n"
160 " .set mips0 \n" 169 " .set mips0 \n"
161 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 170 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
162 : "Ir" (i), "m" (v->counter) 171 : "Ir" (i), "m" (v->counter)
@@ -164,11 +173,11 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
164 } else { 173 } else {
165 unsigned long flags; 174 unsigned long flags;
166 175
167 local_irq_save(flags); 176 raw_local_irq_save(flags);
168 result = v->counter; 177 result = v->counter;
169 result += i; 178 result += i;
170 v->counter = result; 179 v->counter = result;
171 local_irq_restore(flags); 180 raw_local_irq_restore(flags);
172 } 181 }
173 182
174 smp_mb(); 183 smp_mb();
@@ -204,8 +213,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
204 "1: ll %1, %2 # atomic_sub_return \n" 213 "1: ll %1, %2 # atomic_sub_return \n"
205 " subu %0, %1, %3 \n" 214 " subu %0, %1, %3 \n"
206 " sc %0, %2 \n" 215 " sc %0, %2 \n"
207 " beqz %0, 1b \n" 216 " beqz %0, 2f \n"
208 " subu %0, %1, %3 \n" 217 " subu %0, %1, %3 \n"
218 " .subsection 2 \n"
219 "2: b 1b \n"
220 " .previous \n"
209 " .set mips0 \n" 221 " .set mips0 \n"
210 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 222 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
211 : "Ir" (i), "m" (v->counter) 223 : "Ir" (i), "m" (v->counter)
@@ -213,11 +225,11 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
213 } else { 225 } else {
214 unsigned long flags; 226 unsigned long flags;
215 227
216 local_irq_save(flags); 228 raw_local_irq_save(flags);
217 result = v->counter; 229 result = v->counter;
218 result -= i; 230 result -= i;
219 v->counter = result; 231 v->counter = result;
220 local_irq_restore(flags); 232 raw_local_irq_restore(flags);
221 } 233 }
222 234
223 smp_mb(); 235 smp_mb();
@@ -267,10 +279,13 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
267 " bltz %0, 1f \n" 279 " bltz %0, 1f \n"
268 " sc %0, %2 \n" 280 " sc %0, %2 \n"
269 " .set noreorder \n" 281 " .set noreorder \n"
270 " beqz %0, 1b \n" 282 " beqz %0, 2f \n"
271 " subu %0, %1, %3 \n" 283 " subu %0, %1, %3 \n"
272 " .set reorder \n" 284 " .set reorder \n"
273 "1: \n" 285 "1: \n"
286 " .subsection 2 \n"
287 "2: b 1b \n"
288 " .previous \n"
274 " .set mips0 \n" 289 " .set mips0 \n"
275 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 290 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
276 : "Ir" (i), "m" (v->counter) 291 : "Ir" (i), "m" (v->counter)
@@ -278,12 +293,12 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
278 } else { 293 } else {
279 unsigned long flags; 294 unsigned long flags;
280 295
281 local_irq_save(flags); 296 raw_local_irq_save(flags);
282 result = v->counter; 297 result = v->counter;
283 result -= i; 298 result -= i;
284 if (result >= 0) 299 if (result >= 0)
285 v->counter = result; 300 v->counter = result;
286 local_irq_restore(flags); 301 raw_local_irq_restore(flags);
287 } 302 }
288 303
289 smp_mb(); 304 smp_mb();
@@ -429,16 +444,19 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
429 "1: lld %0, %1 # atomic64_add \n" 444 "1: lld %0, %1 # atomic64_add \n"
430 " addu %0, %2 \n" 445 " addu %0, %2 \n"
431 " scd %0, %1 \n" 446 " scd %0, %1 \n"
432 " beqz %0, 1b \n" 447 " beqz %0, 2f \n"
448 " .subsection 2 \n"
449 "2: b 1b \n"
450 " .previous \n"
433 " .set mips0 \n" 451 " .set mips0 \n"
434 : "=&r" (temp), "=m" (v->counter) 452 : "=&r" (temp), "=m" (v->counter)
435 : "Ir" (i), "m" (v->counter)); 453 : "Ir" (i), "m" (v->counter));
436 } else { 454 } else {
437 unsigned long flags; 455 unsigned long flags;
438 456
439 local_irq_save(flags); 457 raw_local_irq_save(flags);
440 v->counter += i; 458 v->counter += i;
441 local_irq_restore(flags); 459 raw_local_irq_restore(flags);
442 } 460 }
443} 461}
444 462
@@ -471,16 +489,19 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
471 "1: lld %0, %1 # atomic64_sub \n" 489 "1: lld %0, %1 # atomic64_sub \n"
472 " subu %0, %2 \n" 490 " subu %0, %2 \n"
473 " scd %0, %1 \n" 491 " scd %0, %1 \n"
474 " beqz %0, 1b \n" 492 " beqz %0, 2f \n"
493 " .subsection 2 \n"
494 "2: b 1b \n"
495 " .previous \n"
475 " .set mips0 \n" 496 " .set mips0 \n"
476 : "=&r" (temp), "=m" (v->counter) 497 : "=&r" (temp), "=m" (v->counter)
477 : "Ir" (i), "m" (v->counter)); 498 : "Ir" (i), "m" (v->counter));
478 } else { 499 } else {
479 unsigned long flags; 500 unsigned long flags;
480 501
481 local_irq_save(flags); 502 raw_local_irq_save(flags);
482 v->counter -= i; 503 v->counter -= i;
483 local_irq_restore(flags); 504 raw_local_irq_restore(flags);
484 } 505 }
485} 506}
486 507
@@ -515,8 +536,11 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
515 "1: lld %1, %2 # atomic64_add_return \n" 536 "1: lld %1, %2 # atomic64_add_return \n"
516 " addu %0, %1, %3 \n" 537 " addu %0, %1, %3 \n"
517 " scd %0, %2 \n" 538 " scd %0, %2 \n"
518 " beqz %0, 1b \n" 539 " beqz %0, 2f \n"
519 " addu %0, %1, %3 \n" 540 " addu %0, %1, %3 \n"
541 " .subsection 2 \n"
542 "2: b 1b \n"
543 " .previous \n"
520 " .set mips0 \n" 544 " .set mips0 \n"
521 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 545 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
522 : "Ir" (i), "m" (v->counter) 546 : "Ir" (i), "m" (v->counter)
@@ -524,11 +548,11 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
524 } else { 548 } else {
525 unsigned long flags; 549 unsigned long flags;
526 550
527 local_irq_save(flags); 551 raw_local_irq_save(flags);
528 result = v->counter; 552 result = v->counter;
529 result += i; 553 result += i;
530 v->counter = result; 554 v->counter = result;
531 local_irq_restore(flags); 555 raw_local_irq_restore(flags);
532 } 556 }
533 557
534 smp_mb(); 558 smp_mb();
@@ -564,8 +588,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
564 "1: lld %1, %2 # atomic64_sub_return \n" 588 "1: lld %1, %2 # atomic64_sub_return \n"
565 " subu %0, %1, %3 \n" 589 " subu %0, %1, %3 \n"
566 " scd %0, %2 \n" 590 " scd %0, %2 \n"
567 " beqz %0, 1b \n" 591 " beqz %0, 2f \n"
568 " subu %0, %1, %3 \n" 592 " subu %0, %1, %3 \n"
593 " .subsection 2 \n"
594 "2: b 1b \n"
595 " .previous \n"
569 " .set mips0 \n" 596 " .set mips0 \n"
570 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 597 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
571 : "Ir" (i), "m" (v->counter) 598 : "Ir" (i), "m" (v->counter)
@@ -573,11 +600,11 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
573 } else { 600 } else {
574 unsigned long flags; 601 unsigned long flags;
575 602
576 local_irq_save(flags); 603 raw_local_irq_save(flags);
577 result = v->counter; 604 result = v->counter;
578 result -= i; 605 result -= i;
579 v->counter = result; 606 v->counter = result;
580 local_irq_restore(flags); 607 raw_local_irq_restore(flags);
581 } 608 }
582 609
583 smp_mb(); 610 smp_mb();
@@ -627,10 +654,13 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
627 " bltz %0, 1f \n" 654 " bltz %0, 1f \n"
628 " scd %0, %2 \n" 655 " scd %0, %2 \n"
629 " .set noreorder \n" 656 " .set noreorder \n"
630 " beqz %0, 1b \n" 657 " beqz %0, 2f \n"
631 " dsubu %0, %1, %3 \n" 658 " dsubu %0, %1, %3 \n"
632 " .set reorder \n" 659 " .set reorder \n"
633 "1: \n" 660 "1: \n"
661 " .subsection 2 \n"
662 "2: b 1b \n"
663 " .previous \n"
634 " .set mips0 \n" 664 " .set mips0 \n"
635 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 665 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
636 : "Ir" (i), "m" (v->counter) 666 : "Ir" (i), "m" (v->counter)
@@ -638,12 +668,12 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
638 } else { 668 } else {
639 unsigned long flags; 669 unsigned long flags;
640 670
641 local_irq_save(flags); 671 raw_local_irq_save(flags);
642 result = v->counter; 672 result = v->counter;
643 result -= i; 673 result -= i;
644 if (result >= 0) 674 if (result >= 0)
645 v->counter = result; 675 v->counter = result;
646 local_irq_restore(flags); 676 raw_local_irq_restore(flags);
647 } 677 }
648 678
649 smp_mb(); 679 smp_mb();
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 06445de1324b..d995413e11fd 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 1994 - 1997, 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (c) 1994 - 1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#ifndef _ASM_BITOPS_H 9#ifndef _ASM_BITOPS_H
@@ -24,11 +24,15 @@
24#define SZLONG_MASK 31UL 24#define SZLONG_MASK 31UL
25#define __LL "ll " 25#define __LL "ll "
26#define __SC "sc " 26#define __SC "sc "
27#define __INS "ins "
28#define __EXT "ext "
27#elif (_MIPS_SZLONG == 64) 29#elif (_MIPS_SZLONG == 64)
28#define SZLONG_LOG 6 30#define SZLONG_LOG 6
29#define SZLONG_MASK 63UL 31#define SZLONG_MASK 63UL
30#define __LL "lld " 32#define __LL "lld "
31#define __SC "scd " 33#define __SC "scd "
34#define __INS "dins "
35#define __EXT "dext "
32#endif 36#endif
33 37
34/* 38/*
@@ -50,6 +54,7 @@
50static inline void set_bit(unsigned long nr, volatile unsigned long *addr) 54static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
51{ 55{
52 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 56 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
57 unsigned short bit = nr & SZLONG_MASK;
53 unsigned long temp; 58 unsigned long temp;
54 59
55 if (cpu_has_llsc && R10000_LLSC_WAR) { 60 if (cpu_has_llsc && R10000_LLSC_WAR) {
@@ -61,27 +66,43 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
61 " beqzl %0, 1b \n" 66 " beqzl %0, 1b \n"
62 " .set mips0 \n" 67 " .set mips0 \n"
63 : "=&r" (temp), "=m" (*m) 68 : "=&r" (temp), "=m" (*m)
64 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 69 : "ir" (1UL << bit), "m" (*m));
70#ifdef CONFIG_CPU_MIPSR2
71 } else if (__builtin_constant_p(bit)) {
72 __asm__ __volatile__(
73 "1: " __LL "%0, %1 # set_bit \n"
74 " " __INS "%0, %4, %2, 1 \n"
75 " " __SC "%0, %1 \n"
76 " beqz %0, 2f \n"
77 " .subsection 2 \n"
78 "2: b 1b \n"
79 " .previous \n"
80 : "=&r" (temp), "=m" (*m)
81 : "ir" (bit), "m" (*m), "r" (~0));
82#endif /* CONFIG_CPU_MIPSR2 */
65 } else if (cpu_has_llsc) { 83 } else if (cpu_has_llsc) {
66 __asm__ __volatile__( 84 __asm__ __volatile__(
67 " .set mips3 \n" 85 " .set mips3 \n"
68 "1: " __LL "%0, %1 # set_bit \n" 86 "1: " __LL "%0, %1 # set_bit \n"
69 " or %0, %2 \n" 87 " or %0, %2 \n"
70 " " __SC "%0, %1 \n" 88 " " __SC "%0, %1 \n"
71 " beqz %0, 1b \n" 89 " beqz %0, 2f \n"
90 " .subsection 2 \n"
91 "2: b 1b \n"
92 " .previous \n"
72 " .set mips0 \n" 93 " .set mips0 \n"
73 : "=&r" (temp), "=m" (*m) 94 : "=&r" (temp), "=m" (*m)
74 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 95 : "ir" (1UL << bit), "m" (*m));
75 } else { 96 } else {
76 volatile unsigned long *a = addr; 97 volatile unsigned long *a = addr;
77 unsigned long mask; 98 unsigned long mask;
78 unsigned long flags; 99 unsigned long flags;
79 100
80 a += nr >> SZLONG_LOG; 101 a += nr >> SZLONG_LOG;
81 mask = 1UL << (nr & SZLONG_MASK); 102 mask = 1UL << bit;
82 local_irq_save(flags); 103 raw_local_irq_save(flags);
83 *a |= mask; 104 *a |= mask;
84 local_irq_restore(flags); 105 raw_local_irq_restore(flags);
85 } 106 }
86} 107}
87 108
@@ -98,6 +119,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
98static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) 119static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
99{ 120{
100 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 121 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
122 unsigned short bit = nr & SZLONG_MASK;
101 unsigned long temp; 123 unsigned long temp;
102 124
103 if (cpu_has_llsc && R10000_LLSC_WAR) { 125 if (cpu_has_llsc && R10000_LLSC_WAR) {
@@ -109,27 +131,43 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
109 " beqzl %0, 1b \n" 131 " beqzl %0, 1b \n"
110 " .set mips0 \n" 132 " .set mips0 \n"
111 : "=&r" (temp), "=m" (*m) 133 : "=&r" (temp), "=m" (*m)
112 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m)); 134 : "ir" (~(1UL << bit)), "m" (*m));
135#ifdef CONFIG_CPU_MIPSR2
136 } else if (__builtin_constant_p(bit)) {
137 __asm__ __volatile__(
138 "1: " __LL "%0, %1 # clear_bit \n"
139 " " __INS "%0, $0, %2, 1 \n"
140 " " __SC "%0, %1 \n"
141 " beqz %0, 2f \n"
142 " .subsection 2 \n"
143 "2: b 1b \n"
144 " .previous \n"
145 : "=&r" (temp), "=m" (*m)
146 : "ir" (bit), "m" (*m));
147#endif /* CONFIG_CPU_MIPSR2 */
113 } else if (cpu_has_llsc) { 148 } else if (cpu_has_llsc) {
114 __asm__ __volatile__( 149 __asm__ __volatile__(
115 " .set mips3 \n" 150 " .set mips3 \n"
116 "1: " __LL "%0, %1 # clear_bit \n" 151 "1: " __LL "%0, %1 # clear_bit \n"
117 " and %0, %2 \n" 152 " and %0, %2 \n"
118 " " __SC "%0, %1 \n" 153 " " __SC "%0, %1 \n"
119 " beqz %0, 1b \n" 154 " beqz %0, 2f \n"
155 " .subsection 2 \n"
156 "2: b 1b \n"
157 " .previous \n"
120 " .set mips0 \n" 158 " .set mips0 \n"
121 : "=&r" (temp), "=m" (*m) 159 : "=&r" (temp), "=m" (*m)
122 : "ir" (~(1UL << (nr & SZLONG_MASK))), "m" (*m)); 160 : "ir" (~(1UL << bit)), "m" (*m));
123 } else { 161 } else {
124 volatile unsigned long *a = addr; 162 volatile unsigned long *a = addr;
125 unsigned long mask; 163 unsigned long mask;
126 unsigned long flags; 164 unsigned long flags;
127 165
128 a += nr >> SZLONG_LOG; 166 a += nr >> SZLONG_LOG;
129 mask = 1UL << (nr & SZLONG_MASK); 167 mask = 1UL << bit;
130 local_irq_save(flags); 168 raw_local_irq_save(flags);
131 *a &= ~mask; 169 *a &= ~mask;
132 local_irq_restore(flags); 170 raw_local_irq_restore(flags);
133 } 171 }
134} 172}
135 173
@@ -144,6 +182,8 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
144 */ 182 */
145static inline void change_bit(unsigned long nr, volatile unsigned long *addr) 183static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
146{ 184{
185 unsigned short bit = nr & SZLONG_MASK;
186
147 if (cpu_has_llsc && R10000_LLSC_WAR) { 187 if (cpu_has_llsc && R10000_LLSC_WAR) {
148 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 188 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
149 unsigned long temp; 189 unsigned long temp;
@@ -156,7 +196,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
156 " beqzl %0, 1b \n" 196 " beqzl %0, 1b \n"
157 " .set mips0 \n" 197 " .set mips0 \n"
158 : "=&r" (temp), "=m" (*m) 198 : "=&r" (temp), "=m" (*m)
159 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 199 : "ir" (1UL << bit), "m" (*m));
160 } else if (cpu_has_llsc) { 200 } else if (cpu_has_llsc) {
161 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 201 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
162 unsigned long temp; 202 unsigned long temp;
@@ -166,20 +206,23 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
166 "1: " __LL "%0, %1 # change_bit \n" 206 "1: " __LL "%0, %1 # change_bit \n"
167 " xor %0, %2 \n" 207 " xor %0, %2 \n"
168 " " __SC "%0, %1 \n" 208 " " __SC "%0, %1 \n"
169 " beqz %0, 1b \n" 209 " beqz %0, 2f \n"
210 " .subsection 2 \n"
211 "2: b 1b \n"
212 " .previous \n"
170 " .set mips0 \n" 213 " .set mips0 \n"
171 : "=&r" (temp), "=m" (*m) 214 : "=&r" (temp), "=m" (*m)
172 : "ir" (1UL << (nr & SZLONG_MASK)), "m" (*m)); 215 : "ir" (1UL << bit), "m" (*m));
173 } else { 216 } else {
174 volatile unsigned long *a = addr; 217 volatile unsigned long *a = addr;
175 unsigned long mask; 218 unsigned long mask;
176 unsigned long flags; 219 unsigned long flags;
177 220
178 a += nr >> SZLONG_LOG; 221 a += nr >> SZLONG_LOG;
179 mask = 1UL << (nr & SZLONG_MASK); 222 mask = 1UL << bit;
180 local_irq_save(flags); 223 raw_local_irq_save(flags);
181 *a ^= mask; 224 *a ^= mask;
182 local_irq_restore(flags); 225 raw_local_irq_restore(flags);
183 } 226 }
184} 227}
185 228
@@ -194,6 +237,8 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
194static inline int test_and_set_bit(unsigned long nr, 237static inline int test_and_set_bit(unsigned long nr,
195 volatile unsigned long *addr) 238 volatile unsigned long *addr)
196{ 239{
240 unsigned short bit = nr & SZLONG_MASK;
241
197 if (cpu_has_llsc && R10000_LLSC_WAR) { 242 if (cpu_has_llsc && R10000_LLSC_WAR) {
198 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 243 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
199 unsigned long temp, res; 244 unsigned long temp, res;
@@ -207,7 +252,7 @@ static inline int test_and_set_bit(unsigned long nr,
207 " and %2, %0, %3 \n" 252 " and %2, %0, %3 \n"
208 " .set mips0 \n" 253 " .set mips0 \n"
209 : "=&r" (temp), "=m" (*m), "=&r" (res) 254 : "=&r" (temp), "=m" (*m), "=&r" (res)
210 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 255 : "r" (1UL << bit), "m" (*m)
211 : "memory"); 256 : "memory");
212 257
213 return res != 0; 258 return res != 0;
@@ -222,11 +267,15 @@ static inline int test_and_set_bit(unsigned long nr,
222 "1: " __LL "%0, %1 # test_and_set_bit \n" 267 "1: " __LL "%0, %1 # test_and_set_bit \n"
223 " or %2, %0, %3 \n" 268 " or %2, %0, %3 \n"
224 " " __SC "%2, %1 \n" 269 " " __SC "%2, %1 \n"
225 " beqz %2, 1b \n" 270 " beqz %2, 2f \n"
226 " and %2, %0, %3 \n" 271 " and %2, %0, %3 \n"
272 " .subsection 2 \n"
273 "2: b 1b \n"
274 " nop \n"
275 " .previous \n"
227 " .set pop \n" 276 " .set pop \n"
228 : "=&r" (temp), "=m" (*m), "=&r" (res) 277 : "=&r" (temp), "=m" (*m), "=&r" (res)
229 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 278 : "r" (1UL << bit), "m" (*m)
230 : "memory"); 279 : "memory");
231 280
232 return res != 0; 281 return res != 0;
@@ -237,11 +286,11 @@ static inline int test_and_set_bit(unsigned long nr,
237 unsigned long flags; 286 unsigned long flags;
238 287
239 a += nr >> SZLONG_LOG; 288 a += nr >> SZLONG_LOG;
240 mask = 1UL << (nr & SZLONG_MASK); 289 mask = 1UL << bit;
241 local_irq_save(flags); 290 raw_local_irq_save(flags);
242 retval = (mask & *a) != 0; 291 retval = (mask & *a) != 0;
243 *a |= mask; 292 *a |= mask;
244 local_irq_restore(flags); 293 raw_local_irq_restore(flags);
245 294
246 return retval; 295 return retval;
247 } 296 }
@@ -260,6 +309,8 @@ static inline int test_and_set_bit(unsigned long nr,
260static inline int test_and_clear_bit(unsigned long nr, 309static inline int test_and_clear_bit(unsigned long nr,
261 volatile unsigned long *addr) 310 volatile unsigned long *addr)
262{ 311{
312 unsigned short bit = nr & SZLONG_MASK;
313
263 if (cpu_has_llsc && R10000_LLSC_WAR) { 314 if (cpu_has_llsc && R10000_LLSC_WAR) {
264 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 315 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
265 unsigned long temp, res; 316 unsigned long temp, res;
@@ -274,10 +325,30 @@ static inline int test_and_clear_bit(unsigned long nr,
274 " and %2, %0, %3 \n" 325 " and %2, %0, %3 \n"
275 " .set mips0 \n" 326 " .set mips0 \n"
276 : "=&r" (temp), "=m" (*m), "=&r" (res) 327 : "=&r" (temp), "=m" (*m), "=&r" (res)
277 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 328 : "r" (1UL << bit), "m" (*m)
278 : "memory"); 329 : "memory");
279 330
280 return res != 0; 331 return res != 0;
332#ifdef CONFIG_CPU_MIPSR2
333 } else if (__builtin_constant_p(nr)) {
334 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
335 unsigned long temp, res;
336
337 __asm__ __volatile__(
338 "1: " __LL "%0, %1 # test_and_clear_bit \n"
339 " " __EXT "%2, %0, %3, 1 \n"
340 " " __INS "%0, $0, %3, 1 \n"
341 " " __SC "%0, %1 \n"
342 " beqz %0, 2f \n"
343 " .subsection 2 \n"
344 "2: b 1b \n"
345 " .previous \n"
346 : "=&r" (temp), "=m" (*m), "=&r" (res)
347 : "ri" (bit), "m" (*m)
348 : "memory");
349
350 return res;
351#endif
281 } else if (cpu_has_llsc) { 352 } else if (cpu_has_llsc) {
282 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 353 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
283 unsigned long temp, res; 354 unsigned long temp, res;
@@ -290,11 +361,15 @@ static inline int test_and_clear_bit(unsigned long nr,
290 " or %2, %0, %3 \n" 361 " or %2, %0, %3 \n"
291 " xor %2, %3 \n" 362 " xor %2, %3 \n"
292 " " __SC "%2, %1 \n" 363 " " __SC "%2, %1 \n"
293 " beqz %2, 1b \n" 364 " beqz %2, 2f \n"
294 " and %2, %0, %3 \n" 365 " and %2, %0, %3 \n"
366 " .subsection 2 \n"
367 "2: b 1b \n"
368 " nop \n"
369 " .previous \n"
295 " .set pop \n" 370 " .set pop \n"
296 : "=&r" (temp), "=m" (*m), "=&r" (res) 371 : "=&r" (temp), "=m" (*m), "=&r" (res)
297 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 372 : "r" (1UL << bit), "m" (*m)
298 : "memory"); 373 : "memory");
299 374
300 return res != 0; 375 return res != 0;
@@ -305,11 +380,11 @@ static inline int test_and_clear_bit(unsigned long nr,
305 unsigned long flags; 380 unsigned long flags;
306 381
307 a += nr >> SZLONG_LOG; 382 a += nr >> SZLONG_LOG;
308 mask = 1UL << (nr & SZLONG_MASK); 383 mask = 1UL << bit;
309 local_irq_save(flags); 384 raw_local_irq_save(flags);
310 retval = (mask & *a) != 0; 385 retval = (mask & *a) != 0;
311 *a &= ~mask; 386 *a &= ~mask;
312 local_irq_restore(flags); 387 raw_local_irq_restore(flags);
313 388
314 return retval; 389 return retval;
315 } 390 }
@@ -328,6 +403,8 @@ static inline int test_and_clear_bit(unsigned long nr,
328static inline int test_and_change_bit(unsigned long nr, 403static inline int test_and_change_bit(unsigned long nr,
329 volatile unsigned long *addr) 404 volatile unsigned long *addr)
330{ 405{
406 unsigned short bit = nr & SZLONG_MASK;
407
331 if (cpu_has_llsc && R10000_LLSC_WAR) { 408 if (cpu_has_llsc && R10000_LLSC_WAR) {
332 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 409 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
333 unsigned long temp, res; 410 unsigned long temp, res;
@@ -341,7 +418,7 @@ static inline int test_and_change_bit(unsigned long nr,
341 " and %2, %0, %3 \n" 418 " and %2, %0, %3 \n"
342 " .set mips0 \n" 419 " .set mips0 \n"
343 : "=&r" (temp), "=m" (*m), "=&r" (res) 420 : "=&r" (temp), "=m" (*m), "=&r" (res)
344 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 421 : "r" (1UL << bit), "m" (*m)
345 : "memory"); 422 : "memory");
346 423
347 return res != 0; 424 return res != 0;
@@ -356,11 +433,15 @@ static inline int test_and_change_bit(unsigned long nr,
356 "1: " __LL "%0, %1 # test_and_change_bit \n" 433 "1: " __LL "%0, %1 # test_and_change_bit \n"
357 " xor %2, %0, %3 \n" 434 " xor %2, %0, %3 \n"
358 " " __SC "\t%2, %1 \n" 435 " " __SC "\t%2, %1 \n"
359 " beqz %2, 1b \n" 436 " beqz %2, 2f \n"
360 " and %2, %0, %3 \n" 437 " and %2, %0, %3 \n"
438 " .subsection 2 \n"
439 "2: b 1b \n"
440 " nop \n"
441 " .previous \n"
361 " .set pop \n" 442 " .set pop \n"
362 : "=&r" (temp), "=m" (*m), "=&r" (res) 443 : "=&r" (temp), "=m" (*m), "=&r" (res)
363 : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) 444 : "r" (1UL << bit), "m" (*m)
364 : "memory"); 445 : "memory");
365 446
366 return res != 0; 447 return res != 0;
@@ -370,11 +451,11 @@ static inline int test_and_change_bit(unsigned long nr,
370 unsigned long flags; 451 unsigned long flags;
371 452
372 a += nr >> SZLONG_LOG; 453 a += nr >> SZLONG_LOG;
373 mask = 1UL << (nr & SZLONG_MASK); 454 mask = 1UL << bit;
374 local_irq_save(flags); 455 raw_local_irq_save(flags);
375 retval = (mask & *a) != 0; 456 retval = (mask & *a) != 0;
376 *a ^= mask; 457 *a ^= mask;
377 local_irq_restore(flags); 458 raw_local_irq_restore(flags);
378 459
379 return retval; 460 return retval;
380 } 461 }
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 8e321f53a382..c7c945baf1ee 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -243,6 +243,10 @@ extern struct boot_mem_map boot_mem_map;
243extern void add_memory_region(phys_t start, phys_t size, long type); 243extern void add_memory_region(phys_t start, phys_t size, long type);
244 244
245extern void prom_init(void); 245extern void prom_init(void);
246extern void prom_free_prom_memory(void);
247
248extern void free_init_pages(const char *what,
249 unsigned long begin, unsigned long end);
246 250
247/* 251/*
248 * Initial kernel command line, usually setup by prom_init() 252 * Initial kernel command line, usually setup by prom_init()
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index 4d560a533940..7eb63de808bc 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -18,7 +18,8 @@ do { \
18 18
19#define BUG_ON(condition) \ 19#define BUG_ON(condition) \
20do { \ 20do { \
21 __asm__ __volatile__("tne $0, %0" : : "r" (condition)); \ 21 __asm__ __volatile__("tne $0, %0, %1" \
22 : : "r" (condition), "i" (BRK_BUG)); \
22} while (0) 23} while (0)
23 24
24#define HAVE_ARCH_BUG_ON 25#define HAVE_ARCH_BUG_ON
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 0ddada3bb0b6..4933b4947ed0 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -48,6 +48,15 @@ static inline void flush_dcache_page(struct page *page)
48#define flush_dcache_mmap_lock(mapping) do { } while (0) 48#define flush_dcache_mmap_lock(mapping) do { } while (0)
49#define flush_dcache_mmap_unlock(mapping) do { } while (0) 49#define flush_dcache_mmap_unlock(mapping) do { } while (0)
50 50
51#define ARCH_HAS_FLUSH_ANON_PAGE
52extern void __flush_anon_page(struct page *, unsigned long);
53static inline void flush_anon_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vmaddr)
55{
56 if (cpu_has_dc_aliases && PageAnon(page))
57 __flush_anon_page(page, vmaddr);
58}
59
51static inline void flush_icache_page(struct vm_area_struct *vma, 60static inline void flush_icache_page(struct vm_area_struct *vma,
52 struct page *page) 61 struct page *page)
53{ 62{
@@ -86,4 +95,7 @@ extern void (*flush_data_cache_page)(unsigned long addr);
86/* Run kernel code uncached, useful for cache probing functions. */ 95/* Run kernel code uncached, useful for cache probing functions. */
87unsigned long __init run_uncached(void *func); 96unsigned long __init run_uncached(void *func);
88 97
98extern void *kmap_coherent(struct page *page, unsigned long addr);
99extern void kunmap_coherent(void);
100
89#endif /* _ASM_CACHEFLUSH_H */ 101#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 20a81e1548f5..290485ac5407 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -166,7 +166,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
166#else 166#else
167 "r" (proto + len), 167 "r" (proto + len),
168#endif 168#endif
169 "r" (sum)); 169 "r" ((__force unsigned long)sum));
170 170
171 return sum; 171 return sum;
172} 172}
diff --git a/include/asm-mips/compat-signal.h b/include/asm-mips/compat-signal.h
new file mode 100644
index 000000000000..6599a901b63e
--- /dev/null
+++ b/include/asm-mips/compat-signal.h
@@ -0,0 +1,57 @@
1#ifndef __ASM_COMPAT_SIGNAL_H
2#define __ASM_COMPAT_SIGNAL_H
3
4#include <linux/bug.h>
5#include <linux/compat.h>
6#include <linux/compiler.h>
7
8#include <asm/signal.h>
9#include <asm/siginfo.h>
10
11#include <asm/uaccess.h>
12
13static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
14 const sigset_t *s)
15{
16 int err;
17
18 BUG_ON(sizeof(*d) != sizeof(*s));
19 BUG_ON(_NSIG_WORDS != 2);
20
21 err = __put_user(s->sig[0], &d->sig[0]);
22 err |= __put_user(s->sig[0] >> 32, &d->sig[1]);
23 err |= __put_user(s->sig[1], &d->sig[2]);
24 err |= __put_user(s->sig[1] >> 32, &d->sig[3]);
25
26 return err;
27}
28
29static inline int __copy_conv_sigset_from_user(sigset_t *d,
30 const compat_sigset_t __user *s)
31{
32 int err;
33 union sigset_u {
34 sigset_t s;
35 compat_sigset_t c;
36 } *u = (union sigset_u *) d;
37
38 BUG_ON(sizeof(*d) != sizeof(*s));
39 BUG_ON(_NSIG_WORDS != 2);
40
41#ifdef CONFIG_CPU_BIG_ENDIAN
42 err = __get_user(u->c.sig[1], &s->sig[0]);
43 err |= __get_user(u->c.sig[0], &s->sig[1]);
44 err |= __get_user(u->c.sig[3], &s->sig[2]);
45 err |= __get_user(u->c.sig[2], &s->sig[3]);
46#endif
47#ifdef CONFIG_CPU_LITTLE_ENDIAN
48 err = __get_user(u->c.sig[0], &s->sig[0]);
49 err |= __get_user(u->c.sig[1], &s->sig[1]);
50 err |= __get_user(u->c.sig[2], &s->sig[2]);
51 err |= __get_user(u->c.sig[3], &s->sig[3]);
52#endif
53
54 return err;
55}
56
57#endif /* __ASM_COMPAT_SIGNAL_H */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index eadca266f159..5e4bed123b48 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -40,6 +40,9 @@
40#endif 40#endif
41#ifndef cpu_has_fpu 41#ifndef cpu_has_fpu
42#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU) 42#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)
43#define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU)
44#else
45#define raw_cpu_has_fpu cpu_has_fpu
43#endif 46#endif
44#ifndef cpu_has_32fpr 47#ifndef cpu_has_32fpr
45#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR) 48#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
index 610d0cdeaa9e..22fe8453fcc7 100644
--- a/include/asm-mips/cpu-info.h
+++ b/include/asm-mips/cpu-info.h
@@ -87,6 +87,7 @@ struct cpuinfo_mips {
87 87
88extern struct cpuinfo_mips cpu_data[]; 88extern struct cpuinfo_mips cpu_data[];
89#define current_cpu_data cpu_data[smp_processor_id()] 89#define current_cpu_data cpu_data[smp_processor_id()]
90#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
90 91
91extern void cpu_probe(void); 92extern void cpu_probe(void);
92extern void cpu_report(void); 93extern void cpu_report(void);
diff --git a/include/asm-mips/ddb5xxx/ddb5477.h b/include/asm-mips/ddb5xxx/ddb5477.h
index c5af4b73fdd7..6cf177caf6d5 100644
--- a/include/asm-mips/ddb5xxx/ddb5477.h
+++ b/include/asm-mips/ddb5xxx/ddb5477.h
@@ -17,6 +17,7 @@
17#ifndef __ASM_DDB5XXX_DDB5477_H 17#ifndef __ASM_DDB5XXX_DDB5477_H
18#define __ASM_DDB5XXX_DDB5477_H 18#define __ASM_DDB5XXX_DDB5477_H
19 19
20#include <irq.h>
20 21
21/* 22/*
22 * This contains macros that are specific to DDB5477 or renamed from 23 * This contains macros that are specific to DDB5477 or renamed from
@@ -251,14 +252,10 @@ extern void ll_vrc5477_irq_disable(int vrc5477_irq);
251 */ 252 */
252 253
253#define NUM_CPU_IRQ 8 254#define NUM_CPU_IRQ 8
254#define NUM_I8259_IRQ 16
255#define NUM_VRC5477_IRQ 32 255#define NUM_VRC5477_IRQ 32
256 256
257#define DDB_IRQ_BASE 0 257#define CPU_IRQ_BASE MIPS_CPU_IRQ_BASE
258 258#define VRC5477_IRQ_BASE (CPU_IRQ_BASE + NUM_CPU_IRQ)
259#define I8259_IRQ_BASE DDB_IRQ_BASE
260#define VRC5477_IRQ_BASE (I8259_IRQ_BASE + NUM_I8259_IRQ)
261#define CPU_IRQ_BASE (VRC5477_IRQ_BASE + NUM_VRC5477_IRQ)
262 259
263/* 260/*
264 * vrc5477 irq defs 261 * vrc5477 irq defs
@@ -300,22 +297,22 @@ extern void ll_vrc5477_irq_disable(int vrc5477_irq);
300/* 297/*
301 * i2859 irq assignment 298 * i2859 irq assignment
302 */ 299 */
303#define I8259_IRQ_RESERVED_0 (0 + I8259_IRQ_BASE) 300#define I8259_IRQ_RESERVED_0 (0 + I8259A_IRQ_BASE)
304#define I8259_IRQ_KEYBOARD (1 + I8259_IRQ_BASE) /* M1543 default */ 301#define I8259_IRQ_KEYBOARD (1 + I8259A_IRQ_BASE) /* M1543 default */
305#define I8259_IRQ_CASCADE (2 + I8259_IRQ_BASE) 302#define I8259_IRQ_CASCADE (2 + I8259A_IRQ_BASE)
306#define I8259_IRQ_UART_B (3 + I8259_IRQ_BASE) /* M1543 default, may conflict with RTC according to schematic diagram */ 303#define I8259_IRQ_UART_B (3 + I8259A_IRQ_BASE) /* M1543 default, may conflict with RTC according to schematic diagram */
307#define I8259_IRQ_UART_A (4 + I8259_IRQ_BASE) /* M1543 default */ 304#define I8259_IRQ_UART_A (4 + I8259A_IRQ_BASE) /* M1543 default */
308#define I8259_IRQ_PARALLEL (5 + I8259_IRQ_BASE) /* M1543 default */ 305#define I8259_IRQ_PARALLEL (5 + I8259A_IRQ_BASE) /* M1543 default */
309#define I8259_IRQ_RESERVED_6 (6 + I8259_IRQ_BASE) 306#define I8259_IRQ_RESERVED_6 (6 + I8259A_IRQ_BASE)
310#define I8259_IRQ_RESERVED_7 (7 + I8259_IRQ_BASE) 307#define I8259_IRQ_RESERVED_7 (7 + I8259A_IRQ_BASE)
311#define I8259_IRQ_RTC (8 + I8259_IRQ_BASE) /* who set this? */ 308#define I8259_IRQ_RTC (8 + I8259A_IRQ_BASE) /* who set this? */
312#define I8259_IRQ_USB (9 + I8259_IRQ_BASE) /* ddb_setup */ 309#define I8259_IRQ_USB (9 + I8259A_IRQ_BASE) /* ddb_setup */
313#define I8259_IRQ_PMU (10 + I8259_IRQ_BASE) /* ddb_setup */ 310#define I8259_IRQ_PMU (10 + I8259A_IRQ_BASE) /* ddb_setup */
314#define I8259_IRQ_RESERVED_11 (11 + I8259_IRQ_BASE) 311#define I8259_IRQ_RESERVED_11 (11 + I8259A_IRQ_BASE)
315#define I8259_IRQ_RESERVED_12 (12 + I8259_IRQ_BASE) /* m1543_irq_setup */ 312#define I8259_IRQ_RESERVED_12 (12 + I8259A_IRQ_BASE) /* m1543_irq_setup */
316#define I8259_IRQ_RESERVED_13 (13 + I8259_IRQ_BASE) 313#define I8259_IRQ_RESERVED_13 (13 + I8259A_IRQ_BASE)
317#define I8259_IRQ_HDC1 (14 + I8259_IRQ_BASE) /* default and ddb_setup */ 314#define I8259_IRQ_HDC1 (14 + I8259A_IRQ_BASE) /* default and ddb_setup */
318#define I8259_IRQ_HDC2 (15 + I8259_IRQ_BASE) /* default */ 315#define I8259_IRQ_HDC2 (15 + I8259A_IRQ_BASE) /* default */
319 316
320 317
321/* 318/*
diff --git a/include/asm-mips/dec/interrupts.h b/include/asm-mips/dec/interrupts.h
index 273e4d65bfe6..e10d341067c8 100644
--- a/include/asm-mips/dec/interrupts.h
+++ b/include/asm-mips/dec/interrupts.h
@@ -14,6 +14,7 @@
14#ifndef __ASM_DEC_INTERRUPTS_H 14#ifndef __ASM_DEC_INTERRUPTS_H
15#define __ASM_DEC_INTERRUPTS_H 15#define __ASM_DEC_INTERRUPTS_H
16 16
17#include <irq.h>
17#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
18 19
19 20
@@ -87,7 +88,7 @@
87#define DEC_CPU_INR_SW1 1 /* software #1 */ 88#define DEC_CPU_INR_SW1 1 /* software #1 */
88#define DEC_CPU_INR_SW0 0 /* software #0 */ 89#define DEC_CPU_INR_SW0 0 /* software #0 */
89 90
90#define DEC_CPU_IRQ_BASE 0 /* first IRQ assigned to CPU */ 91#define DEC_CPU_IRQ_BASE MIPS_CPU_IRQ_BASE /* first IRQ assigned to CPU */
91 92
92#define DEC_CPU_IRQ_NR(n) ((n) + DEC_CPU_IRQ_BASE) 93#define DEC_CPU_IRQ_NR(n) ((n) + DEC_CPU_IRQ_BASE)
93#define DEC_CPU_IRQ_MASK(n) (1 << ((n) + CAUSEB_IP)) 94#define DEC_CPU_IRQ_MASK(n) (1 << ((n) + CAUSEB_IP))
diff --git a/include/asm-mips/dec/system.h b/include/asm-mips/dec/system.h
index 78af51fbc797..b2afaccd6831 100644
--- a/include/asm-mips/dec/system.h
+++ b/include/asm-mips/dec/system.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Generic DECstation/DECsystem bits. 4 * Generic DECstation/DECsystem bits.
5 * 5 *
6 * Copyright (C) 2005 Maciej W. Rozycki 6 * Copyright (C) 2005, 2006 Maciej W. Rozycki
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
@@ -14,5 +14,6 @@
14#define __ASM_DEC_SYSTEM_H 14#define __ASM_DEC_SYSTEM_H
15 15
16extern unsigned long dec_kn_slot_base, dec_kn_slot_size; 16extern unsigned long dec_kn_slot_base, dec_kn_slot_size;
17extern int dec_tc_bus;
17 18
18#endif /* __ASM_DEC_SYSTEM_H */ 19#endif /* __ASM_DEC_SYSTEM_H */
diff --git a/include/asm-mips/dec/tc.h b/include/asm-mips/dec/tc.h
deleted file mode 100644
index 9cb51f24d42c..000000000000
--- a/include/asm-mips/dec/tc.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Interface to the TURBOchannel related routines
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) 1998 Harald Koerfgen
9 */
10#ifndef __ASM_DEC_TC_H
11#define __ASM_DEC_TC_H
12
13/*
14 * Search for a TURBOchannel Option Module
15 * with a certain name. Returns slot number
16 * of the first card not in use or -ENODEV
17 * if none found.
18 */
19extern int search_tc_card(const char *);
20/*
21 * Marks the card in slot as used
22 */
23extern void claim_tc_card(int);
24/*
25 * Marks the card in slot as free
26 */
27extern void release_tc_card(int);
28/*
29 * Return base address of card in slot
30 */
31extern unsigned long get_tc_base_addr(int);
32/*
33 * Return interrupt number of slot
34 */
35extern unsigned long get_tc_irq_nr(int);
36/*
37 * Return TURBOchannel clock frequency in Hz
38 */
39extern unsigned long get_tc_speed(void);
40
41#endif /* __ASM_DEC_TC_H */
diff --git a/include/asm-mips/dec/tcinfo.h b/include/asm-mips/dec/tcinfo.h
deleted file mode 100644
index cc23509ee77a..000000000000
--- a/include/asm-mips/dec/tcinfo.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Various TURBOchannel related stuff
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 * Information obtained through the get_tcinfo prom call
9 * created from:
10 *
11 * TURBOchannel Firmware Specification
12 *
13 * EK-TCAAD-FS-004
14 * from Digital Equipment Corporation
15 *
16 * Copyright (c) 1998 Harald Koerfgen
17 */
18
19typedef struct {
20 int revision;
21 int clk_period;
22 int slot_size;
23 int io_timeout;
24 int dma_range;
25 int max_dma_burst;
26 int parity;
27 int reserved[4];
28} tcinfo;
29
30#define MAX_SLOT 7
31
32typedef struct {
33 unsigned long base_addr;
34 unsigned char name[9];
35 unsigned char vendor[9];
36 unsigned char firmware[9];
37 int interrupt;
38 int flags;
39} slot_info;
40
41/*
42 * Values for flags
43 */
44#define FREE 1<<0
45#define IN_USE 1<<1
46
47
diff --git a/include/asm-mips/dec/tcmodule.h b/include/asm-mips/dec/tcmodule.h
deleted file mode 100644
index 6268e8915d87..000000000000
--- a/include/asm-mips/dec/tcmodule.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Offsets for the ROM header locations for
7 * TURBOchannel cards
8 *
9 * created from:
10 *
11 * TURBOchannel Firmware Specification
12 *
13 * EK-TCAAD-FS-004
14 * from Digital Equipment Corporation
15 *
16 * Jan.1998 Harald Koerfgen
17 */
18#ifndef __ASM_DEC_TCMODULE_H
19#define __ASM_DEC_TCMODULE_H
20
21#define OLDCARD 0x3c0000
22#define NEWCARD 0x000000
23
24#define TC_ROM_WIDTH 0x3e0
25#define TC_ROM_STRIDE 0x3e4
26#define TC_ROM_SIZE 0x3e8
27#define TC_SLOT_SIZE 0x3ec
28#define TC_PATTERN0 0x3f0
29#define TC_PATTERN1 0x3f4
30#define TC_PATTERN2 0x3f8
31#define TC_PATTERN3 0x3fc
32#define TC_FIRM_VER 0x400
33#define TC_VENDOR 0x420
34#define TC_MODULE 0x440
35#define TC_FIRM_TYPE 0x460
36#define TC_FLAGS 0x470
37#define TC_ROM_OBJECTS 0x480
38
39#endif /* __ASM_DEC_TCMODULE_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index ea77050f8e3a..223d156efb9f 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -79,7 +79,7 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
79 __delay(usecs); 79 __delay(usecs);
80} 80}
81 81
82#define __udelay_val cpu_data[smp_processor_id()].udelay_val 82#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
83 83
84#define udelay(usecs) __udelay((usecs),__udelay_val) 84#define udelay(usecs) __udelay((usecs),__udelay_val)
85 85
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
index d107832de1b6..66189f5f6399 100644
--- a/include/asm-mips/div64.h
+++ b/include/asm-mips/div64.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2000, 2004 Maciej W. Rozycki 2 * Copyright (C) 2000, 2004 Maciej W. Rozycki
3 * Copyright (C) 2003 Ralf Baechle 3 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
4 * 4 *
5 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive 6 * License. See the file "COPYING" in the main directory of this archive
@@ -9,6 +9,8 @@
9#ifndef _ASM_DIV64_H 9#ifndef _ASM_DIV64_H
10#define _ASM_DIV64_H 10#define _ASM_DIV64_H
11 11
12#include <linux/types.h>
13
12#if (_MIPS_SZLONG == 32) 14#if (_MIPS_SZLONG == 32)
13 15
14#include <asm/compiler.h> 16#include <asm/compiler.h>
@@ -78,6 +80,8 @@
78 __quot = __quot << 32 | __low; \ 80 __quot = __quot << 32 | __low; \
79 (n) = __quot; \ 81 (n) = __quot; \
80 __mod; }) 82 __mod; })
83
84extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
81#endif /* (_MIPS_SZLONG == 32) */ 85#endif /* (_MIPS_SZLONG == 32) */
82 86
83#if (_MIPS_SZLONG == 64) 87#if (_MIPS_SZLONG == 64)
@@ -101,6 +105,11 @@
101 (n) = __quot; \ 105 (n) = __quot; \
102 __mod; }) 106 __mod; })
103 107
108static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
109{
110 return dividend / divisor;
111}
112
104#endif /* (_MIPS_SZLONG == 64) */ 113#endif /* (_MIPS_SZLONG == 64) */
105 114
106#endif /* _ASM_DIV64_H */ 115#endif /* _ASM_DIV64_H */
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
index 236d1a467cc7..230b3f1b69b1 100644
--- a/include/asm-mips/dma-mapping.h
+++ b/include/asm-mips/dma-mapping.h
@@ -68,6 +68,7 @@ extern int dma_is_consistent(struct device *dev, dma_addr_t dma_addr);
68extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 68extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
69 enum dma_data_direction direction); 69 enum dma_data_direction direction);
70 70
71#if 0
71#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 72#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
72 73
73extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 74extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
@@ -75,5 +76,6 @@ extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
75extern void dma_release_declared_memory(struct device *dev); 76extern void dma_release_declared_memory(struct device *dev);
76extern void * dma_mark_declared_memory_occupied(struct device *dev, 77extern void * dma_mark_declared_memory_occupied(struct device *dev,
77 dma_addr_t device_addr, size_t size); 78 dma_addr_t device_addr, size_t size);
79#endif
78 80
79#endif /* _ASM_DMA_MAPPING_H */ 81#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index 23f789c80845..833437d31ef1 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -74,7 +74,7 @@
74 * 74 *
75 */ 75 */
76 76
77#ifndef GENERIC_ISA_DMA_SUPPORT_BROKEN 77#ifndef CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN
78#define MAX_DMA_CHANNELS 8 78#define MAX_DMA_CHANNELS 8
79#endif 79#endif
80 80
@@ -91,6 +91,7 @@
91#else 91#else
92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) 92#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
93#endif 93#endif
94#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
94 95
95/* 8237 DMA controllers */ 96/* 8237 DMA controllers */
96#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
diff --git a/include/asm-mips/ds1216.h b/include/asm-mips/ds1216.h
new file mode 100644
index 000000000000..1ff8b73f7a6a
--- /dev/null
+++ b/include/asm-mips/ds1216.h
@@ -0,0 +1,31 @@
1#ifndef _DS1216_H
2#define _DS1216_H
3
4extern volatile unsigned char *ds1216_base;
5unsigned long ds1216_get_cmos_time(void);
6int ds1216_set_rtc_mmss(unsigned long nowtime);
7
8#define DS1216_SEC_BYTE 1
9#define DS1216_MIN_BYTE 2
10#define DS1216_HOUR_BYTE 3
11#define DS1216_HOUR_MASK (0x1f)
12#define DS1216_AMPM_MASK (1<<5)
13#define DS1216_1224_MASK (1<<7)
14#define DS1216_DAY_BYTE 4
15#define DS1216_DAY_MASK (0x7)
16#define DS1216_DATE_BYTE 5
17#define DS1216_DATE_MASK (0x3f)
18#define DS1216_MONTH_BYTE 6
19#define DS1216_MONTH_MASK (0x1f)
20#define DS1216_YEAR_BYTE 7
21
22#define DS1216_SEC(buf) (buf[DS1216_SEC_BYTE])
23#define DS1216_MIN(buf) (buf[DS1216_MIN_BYTE])
24#define DS1216_HOUR(buf) (buf[DS1216_HOUR_BYTE] & DS1216_HOUR_MASK)
25#define DS1216_AMPM(buf) (buf[DS1216_HOUR_BYTE] & DS1216_AMPM_MASK)
26#define DS1216_1224(buf) (buf[DS1216_HOUR_BYTE] & DS1216_1224_MASK)
27#define DS1216_DATE(buf) (buf[DS1216_DATE_BYTE] & DS1216_DATE_MASK)
28#define DS1216_MONTH(buf) (buf[DS1216_MONTH_BYTE] & DS1216_MONTH_MASK)
29#define DS1216_YEAR(buf) (buf[DS1216_YEAR_BYTE])
30
31#endif
diff --git a/include/asm-mips/ds1742.h b/include/asm-mips/ds1742.h
deleted file mode 100644
index c2f2c32da637..000000000000
--- a/include/asm-mips/ds1742.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef _ASM_DS1742_H
9#define _ASM_DS1742_H
10
11#include <ds1742.h>
12
13#endif /* _ASM_DS1742_H */
diff --git a/include/asm-mips/emma2rh/emma2rh.h b/include/asm-mips/emma2rh/emma2rh.h
index 4fb8df71caa9..6a1af0af51e3 100644
--- a/include/asm-mips/emma2rh/emma2rh.h
+++ b/include/asm-mips/emma2rh/emma2rh.h
@@ -24,6 +24,8 @@
24#ifndef __ASM_EMMA2RH_EMMA2RH_H 24#ifndef __ASM_EMMA2RH_EMMA2RH_H
25#define __ASM_EMMA2RH_EMMA2RH_H 25#define __ASM_EMMA2RH_EMMA2RH_H
26 26
27#include <irq.h>
28
27/* 29/*
28 * EMMA2RH registers 30 * EMMA2RH registers
29 */ 31 */
@@ -104,7 +106,8 @@
104#define NUM_EMMA2RH_IRQ 96 106#define NUM_EMMA2RH_IRQ 96
105 107
106#define CPU_EMMA2RH_CASCADE 2 108#define CPU_EMMA2RH_CASCADE 2
107#define EMMA2RH_IRQ_BASE 0 109#define CPU_IRQ_BASE MIPS_CPU_IRQ_BASE
110#define EMMA2RH_IRQ_BASE (CPU_IRQ_BASE + NUM_CPU_IRQ)
108 111
109/* 112/*
110 * emma2rh irq defs 113 * emma2rh irq defs
diff --git a/include/asm-mips/emma2rh/markeins.h b/include/asm-mips/emma2rh/markeins.h
index 8fa766795078..973b0628490d 100644
--- a/include/asm-mips/emma2rh/markeins.h
+++ b/include/asm-mips/emma2rh/markeins.h
@@ -33,7 +33,6 @@
33 33
34#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ) 34#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ)
35#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW) 35#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW)
36#define CPU_IRQ_BASE (EMMA2RH_GPIO_IRQ_BASE + NUM_EMMA2RH_IRQ_GPIO)
37 36
38#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE) 37#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE) 38#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index efef843b93f0..b414a7d9db43 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -27,11 +27,11 @@
27struct sigcontext; 27struct sigcontext;
28struct sigcontext32; 28struct sigcontext32;
29 29
30extern asmlinkage int (*save_fp_context)(struct sigcontext *sc); 30extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
31extern asmlinkage int (*restore_fp_context)(struct sigcontext *sc); 31extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
32 32
33extern asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc); 33extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
34extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc); 34extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
35 35
36extern void fpu_emulator_init_fpu(void); 36extern void fpu_emulator_init_fpu(void);
37extern void _init_fpu(void); 37extern void _init_fpu(void);
@@ -93,31 +93,52 @@ static inline int is_fpu_owner(void)
93 return cpu_has_fpu && __is_fpu_owner(); 93 return cpu_has_fpu && __is_fpu_owner();
94} 94}
95 95
96static inline void own_fpu(void) 96static inline void __own_fpu(void)
97{ 97{
98 if (cpu_has_fpu) { 98 __enable_fpu();
99 __enable_fpu(); 99 KSTK_STATUS(current) |= ST0_CU1;
100 KSTK_STATUS(current) |= ST0_CU1; 100 set_thread_flag(TIF_USEDFPU);
101 set_thread_flag(TIF_USEDFPU); 101}
102
103static inline void own_fpu_inatomic(int restore)
104{
105 if (cpu_has_fpu && !__is_fpu_owner()) {
106 __own_fpu();
107 if (restore)
108 _restore_fp(current);
102 } 109 }
103} 110}
104 111
105static inline void lose_fpu(void) 112static inline void own_fpu(int restore)
106{ 113{
107 if (cpu_has_fpu) { 114 preempt_disable();
115 own_fpu_inatomic(restore);
116 preempt_enable();
117}
118
119static inline void lose_fpu(int save)
120{
121 preempt_disable();
122 if (is_fpu_owner()) {
123 if (save)
124 _save_fp(current);
108 KSTK_STATUS(current) &= ~ST0_CU1; 125 KSTK_STATUS(current) &= ~ST0_CU1;
109 clear_thread_flag(TIF_USEDFPU); 126 clear_thread_flag(TIF_USEDFPU);
110 __disable_fpu(); 127 __disable_fpu();
111 } 128 }
129 preempt_enable();
112} 130}
113 131
114static inline void init_fpu(void) 132static inline void init_fpu(void)
115{ 133{
134 preempt_disable();
116 if (cpu_has_fpu) { 135 if (cpu_has_fpu) {
136 __own_fpu();
117 _init_fpu(); 137 _init_fpu();
118 } else { 138 } else {
119 fpu_emulator_init_fpu(); 139 fpu_emulator_init_fpu();
120 } 140 }
141 preempt_enable();
121} 142}
122 143
123static inline void save_fp(struct task_struct *tsk) 144static inline void save_fp(struct task_struct *tsk)
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 50073157a617..e50c77e69cb5 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -52,6 +52,7 @@ ASMMACRO(tlb_probe_hazard,
52 _ehb 52 _ehb
53 ) 53 )
54ASMMACRO(irq_enable_hazard, 54ASMMACRO(irq_enable_hazard,
55 _ehb
55 ) 56 )
56ASMMACRO(irq_disable_hazard, 57ASMMACRO(irq_disable_hazard,
57 _ehb 58 _ehb
diff --git a/include/asm-mips/i8259.h b/include/asm-mips/i8259.h
index 4df8d8b118c0..e88a01607fea 100644
--- a/include/asm-mips/i8259.h
+++ b/include/asm-mips/i8259.h
@@ -18,6 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include <asm/io.h> 20#include <asm/io.h>
21#include <irq.h>
21 22
22/* i8259A PIC registers */ 23/* i8259A PIC registers */
23#define PIC_MASTER_CMD 0x20 24#define PIC_MASTER_CMD 0x20
@@ -42,8 +43,6 @@ extern void disable_8259A_irq(unsigned int irq);
42 43
43extern void init_i8259_irqs(void); 44extern void init_i8259_irqs(void);
44 45
45#define I8259A_IRQ_BASE 0
46
47/* 46/*
48 * Do the traditional i8259 interrupt polling thing. This is for the few 47 * Do the traditional i8259 interrupt polling thing. This is for the few
49 * cases where no better interrupt acknowledge method is available and we 48 * cases where no better interrupt acknowledge method is available and we
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d77b657c09c7..92ec2618560c 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -20,6 +20,7 @@
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21#include <asm/cpu.h> 21#include <asm/cpu.h>
22#include <asm/cpu-features.h> 22#include <asm/cpu-features.h>
23#include <asm-generic/iomap.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/pgtable-bits.h> 25#include <asm/pgtable-bits.h>
25#include <asm/processor.h> 26#include <asm/processor.h>
@@ -115,7 +116,7 @@ static inline void set_io_port_base(unsigned long base)
115 */ 116 */
116static inline unsigned long virt_to_phys(volatile const void *address) 117static inline unsigned long virt_to_phys(volatile const void *address)
117{ 118{
118 return (unsigned long)address - PAGE_OFFSET; 119 return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET;
119} 120}
120 121
121/* 122/*
@@ -132,7 +133,7 @@ static inline unsigned long virt_to_phys(volatile const void *address)
132 */ 133 */
133static inline void * phys_to_virt(unsigned long address) 134static inline void * phys_to_virt(unsigned long address)
134{ 135{
135 return (void *)(address + PAGE_OFFSET); 136 return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
136} 137}
137 138
138/* 139/*
@@ -518,34 +519,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
518} 519}
519 520
520/* 521/*
521 * Memory Mapped I/O
522 */
523#define ioread8(addr) readb(addr)
524#define ioread16(addr) readw(addr)
525#define ioread32(addr) readl(addr)
526
527#define iowrite8(b,addr) writeb(b,addr)
528#define iowrite16(w,addr) writew(w,addr)
529#define iowrite32(l,addr) writel(l,addr)
530
531#define ioread8_rep(a,b,c) readsb(a,b,c)
532#define ioread16_rep(a,b,c) readsw(a,b,c)
533#define ioread32_rep(a,b,c) readsl(a,b,c)
534
535#define iowrite8_rep(a,b,c) writesb(a,b,c)
536#define iowrite16_rep(a,b,c) writesw(a,b,c)
537#define iowrite32_rep(a,b,c) writesl(a,b,c)
538
539/* Create a virtual mapping cookie for an IO port range */
540extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
541extern void ioport_unmap(void __iomem *);
542
543/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
544struct pci_dev;
545extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
546extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
547
548/*
549 * ISA space is 'always mapped' on currently supported MIPS systems, no need 522 * ISA space is 'always mapped' on currently supported MIPS systems, no need
550 * to explicitly ioremap() it. The fact that the ISA IO space is mapped 523 * to explicitly ioremap() it. The fact that the ISA IO space is mapped
551 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values 524 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
@@ -556,12 +529,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
556#define __ISA_IO_base ((char *)(isa_slot_offset)) 529#define __ISA_IO_base ((char *)(isa_slot_offset))
557 530
558/* 531/*
559 * We don't have csum_partial_copy_fromio() yet, so we cheat here and
560 * just copy it. The net code will then do the checksum later.
561 */
562#define eth_io_copy_and_sum(skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len))
563
564/*
565 * The caches on some architectures aren't dma-coherent and have need to 532 * The caches on some architectures aren't dma-coherent and have need to
566 * handle this in software. There are three types of operations that 533 * handle this in software. There are three types of operations that
567 * can be applied to dma buffers. 534 * can be applied to dma buffers.
diff --git a/include/asm-mips/ioctl.h b/include/asm-mips/ioctl.h
index cba641a6ce09..2036fcb9f117 100644
--- a/include/asm-mips/ioctl.h
+++ b/include/asm-mips/ioctl.h
@@ -38,11 +38,6 @@
38#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) 38#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
39 39
40/* 40/*
41 * We to additionally limit parameters to a maximum 255 bytes.
42 */
43#define _IOC_SLMASK 0xff
44
45/*
46 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. 41 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
47 * And this turns out useful to catch old ioctl numbers in header 42 * And this turns out useful to catch old ioctl numbers in header
48 * files for us. 43 * files for us.
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
index 386da82e5774..91803ba30ff2 100644
--- a/include/asm-mips/irq.h
+++ b/include/asm-mips/irq.h
@@ -18,7 +18,7 @@
18#ifdef CONFIG_I8259 18#ifdef CONFIG_I8259
19static inline int irq_canonicalize(int irq) 19static inline int irq_canonicalize(int irq)
20{ 20{
21 return ((irq == 2) ? 9 : irq); 21 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
22} 22}
23#else 23#else
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
diff --git a/include/asm-mips/irq_cpu.h b/include/asm-mips/irq_cpu.h
index ed3d1e3d09ec..ef6a07cddb23 100644
--- a/include/asm-mips/irq_cpu.h
+++ b/include/asm-mips/irq_cpu.h
@@ -13,8 +13,8 @@
13#ifndef _ASM_IRQ_CPU_H 13#ifndef _ASM_IRQ_CPU_H
14#define _ASM_IRQ_CPU_H 14#define _ASM_IRQ_CPU_H
15 15
16extern void mips_cpu_irq_init(int irq_base); 16extern void mips_cpu_irq_init(void);
17extern void rm7k_cpu_irq_init(int irq_base); 17extern void rm7k_cpu_irq_init(void);
18extern void rm9k_cpu_irq_init(int irq_base); 18extern void rm9k_cpu_irq_init(void);
19 19
20#endif /* _ASM_IRQ_CPU_H */ 20#endif /* _ASM_IRQ_CPU_H */
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index af3b07dfad4b..e459fa05db83 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -13,29 +13,9 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/compiler.h>
16#include <asm/hazards.h> 17#include <asm/hazards.h>
17 18
18/*
19 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred IPIs,
20 * at the cost of branch and call overhead on each local_irq_restore()
21 */
22
23#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
24
25extern void smtc_ipi_replay(void);
26
27#define irq_restore_epilog(flags) \
28do { \
29 if (!(flags & 0x0400)) \
30 smtc_ipi_replay(); \
31} while (0)
32
33#else
34
35#define irq_restore_epilog(ignore) do { } while (0)
36
37#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
38
39__asm__ ( 19__asm__ (
40 " .macro raw_local_irq_enable \n" 20 " .macro raw_local_irq_enable \n"
41 " .set push \n" 21 " .set push \n"
@@ -205,17 +185,28 @@ __asm__ (
205 " .set pop \n" 185 " .set pop \n"
206 " .endm \n"); 186 " .endm \n");
207 187
208#define raw_local_irq_restore(flags) \ 188extern void smtc_ipi_replay(void);
209do { \ 189
210 unsigned long __tmp1; \ 190static inline void raw_local_irq_restore(unsigned long flags)
211 \ 191{
212 __asm__ __volatile__( \ 192 unsigned long __tmp1;
213 "raw_local_irq_restore\t%0" \ 193
214 : "=r" (__tmp1) \ 194#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
215 : "0" (flags) \ 195 /*
216 : "memory"); \ 196 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
217 irq_restore_epilog(flags); \ 197 * IPIs, at the cost of branch and call overhead on each
218} while(0) 198 * local_irq_restore()
199 */
200 if (unlikely(!(flags & 0x0400)))
201 smtc_ipi_replay();
202#endif
203
204 __asm__ __volatile__(
205 "raw_local_irq_restore\t%0"
206 : "=r" (__tmp1)
207 : "0" (flags)
208 : "memory");
209}
219 210
220static inline int raw_irqs_disabled_flags(unsigned long flags) 211static inline int raw_irqs_disabled_flags(unsigned long flags)
221{ 212{
diff --git a/include/asm-mips/jmr3927/irq.h b/include/asm-mips/jmr3927/irq.h
deleted file mode 100644
index e3e7ed38da6c..000000000000
--- a/include/asm-mips/jmr3927/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/include/asm-mips/tx3927/irq.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 Toshiba Corporation
9 */
10#ifndef __ASM_TX3927_IRQ_H
11#define __ASM_TX3927_IRQ_H
12
13#ifndef __ASSEMBLY__
14
15#include <asm/irq.h>
16
17struct tb_irq_space {
18 struct tb_irq_space* next;
19 int start_irqno;
20 int nr_irqs;
21 void (*mask_func)(int irq_nr, int space_id);
22 void (*unmask_func)(int irq_no, int space_id);
23 const char *name;
24 int space_id;
25 int can_share;
26};
27extern struct tb_irq_space* tb_irq_spaces;
28
29static __inline__ void add_tb_irq_space(struct tb_irq_space* sp)
30{
31 sp->next = tb_irq_spaces;
32 tb_irq_spaces = sp;
33}
34
35
36struct pt_regs;
37extern void
38toshibaboards_spurious(struct pt_regs *regs, int irq);
39extern void
40toshibaboards_irqdispatch(struct pt_regs *regs, int irq);
41
42extern struct irqaction *
43toshibaboards_get_irq_action(int irq);
44extern int
45toshibaboards_setup_irq(int irq, struct irqaction * new);
46
47
48extern int (*toshibaboards_gen_iack)(void);
49
50#endif /* !__ASSEMBLY__ */
51
52#define NR_ISA_IRQS 16
53#define TB_IRQ_IS_ISA(irq) \
54 (0 <= (irq) && (irq) < NR_ISA_IRQS)
55#define TB_IRQ_TO_ISA_IRQ(irq) (irq)
56
57#endif /* __ASM_TX3927_IRQ_H */
diff --git a/include/asm-mips/jmr3927/jmr3927.h b/include/asm-mips/jmr3927/jmr3927.h
index baf412967afa..958e29706e2d 100644
--- a/include/asm-mips/jmr3927/jmr3927.h
+++ b/include/asm-mips/jmr3927/jmr3927.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Defines for the TJSYS JMR-TX3927/JMI-3927IO2/JMY-1394IF. 2 * Defines for the TJSYS JMR-TX3927
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
@@ -12,10 +12,7 @@
12 12
13#include <asm/jmr3927/tx3927.h> 13#include <asm/jmr3927/tx3927.h>
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/jmr3927/irq.h>
16#ifndef __ASSEMBLY__
17#include <asm/system.h> 15#include <asm/system.h>
18#endif
19 16
20/* CS */ 17/* CS */
21#define JMR3927_ROMCE0 0x1fc00000 /* 4M */ 18#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
@@ -35,28 +32,10 @@
35#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */ 32#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
36#define JMR3927_PORT_BASE KSEG1 33#define JMR3927_PORT_BASE KSEG1
37 34
38/* select indirect initiator access per errata */
39#define JMR3927_INIT_INDIRECT_PCI
40#define PCI_ISTAT_IDICC 0x1000
41#define PCI_IPCIBE_IBE_LONG 0
42#define PCI_IPCIBE_ICMD_IOREAD 2
43#define PCI_IPCIBE_ICMD_IOWRITE 3
44#define PCI_IPCIBE_ICMD_MEMREAD 6
45#define PCI_IPCIBE_ICMD_MEMWRITE 7
46#define PCI_IPCIBE_ICMD_SHIFT 4
47
48/* Address map (virtual address) */ 35/* Address map (virtual address) */
49#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0) 36#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
50#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1) 37#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
51#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2) 38#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
52#define JMR3927_IOB_BASE (KSEG1 + JMR3927_ROMCE3)
53#define JMR3927_ISAMEM_BASE (JMR3927_IOB_BASE)
54#define JMR3927_ISAIO_BASE (JMR3927_IOB_BASE + 0x01000000)
55#define JMR3927_ISAC_BASE (JMR3927_IOB_BASE + 0x02000000)
56#define JMR3927_LCDVGA_REG_BASE (JMR3927_IOB_BASE + 0x03000000)
57#define JMR3927_LCDVGA_MEM_BASE (JMR3927_IOB_BASE + 0x03800000)
58#define JMR3927_JMY1394_BASE (KSEG1 + JMR3927_ROMCE5)
59#define JMR3927_PREMIER3_BASE (JMR3927_JMY1394_BASE + 0x00100000)
60#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM) 39#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
61#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO) 40#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
62 41
@@ -72,25 +51,14 @@
72#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000) 51#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
73#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000) 52#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
74 53
75#define JMR3927_ISAC_REV_ADDR (JMR3927_ISAC_BASE + 0x00000000)
76#define JMR3927_ISAC_EINTS_ADDR (JMR3927_ISAC_BASE + 0x00200000)
77#define JMR3927_ISAC_EINTM_ADDR (JMR3927_ISAC_BASE + 0x00300000)
78#define JMR3927_ISAC_NMI_ADDR (JMR3927_ISAC_BASE + 0x00400000)
79#define JMR3927_ISAC_LED_ADDR (JMR3927_ISAC_BASE + 0x00500000)
80#define JMR3927_ISAC_INTP_ADDR (JMR3927_ISAC_BASE + 0x00800000)
81#define JMR3927_ISAC_INTS1_ADDR (JMR3927_ISAC_BASE + 0x00900000)
82#define JMR3927_ISAC_INTS2_ADDR (JMR3927_ISAC_BASE + 0x00a00000)
83#define JMR3927_ISAC_INTM_ADDR (JMR3927_ISAC_BASE + 0x00b00000)
84
85/* Flash ROM */ 54/* Flash ROM */
86#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE) 55#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
87#define JMR3927_FLASH_SIZE 0x00400000 56#define JMR3927_FLASH_SIZE 0x00400000
88 57
89/* bits for IOC_REV/IOC_BREV/ISAC_REV (high byte) */ 58/* bits for IOC_REV/IOC_BREV (high byte) */
90#define JMR3927_IDT_MASK 0xfc 59#define JMR3927_IDT_MASK 0xfc
91#define JMR3927_REV_MASK 0x03 60#define JMR3927_REV_MASK 0x03
92#define JMR3927_IOC_IDT 0xe0 61#define JMR3927_IOC_IDT 0xe0
93#define JMR3927_ISAC_IDT 0x20
94 62
95/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */ 63/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
96#define JMR3927_IOC_INTB_PCIA 0 64#define JMR3927_IOC_INTB_PCIA 0
@@ -114,40 +82,6 @@
114#define JMR3927_IOC_RESET_CPU 1 82#define JMR3927_IOC_RESET_CPU 1
115#define JMR3927_IOC_RESET_PCI 2 83#define JMR3927_IOC_RESET_PCI 2
116 84
117/* bits for ISAC_EINTS/ISAC_EINTM (high byte) */
118#define JMR3927_ISAC_EINTB_IOCHK 2
119#define JMR3927_ISAC_EINTB_BWTH 4
120#define JMR3927_ISAC_EINTF_IOCHK (1 << JMR3927_ISAC_EINTB_IOCHK)
121#define JMR3927_ISAC_EINTF_BWTH (1 << JMR3927_ISAC_EINTB_BWTH)
122
123/* bits for ISAC_LED (high byte) */
124#define JMR3927_ISAC_LED_ISALED 0x01
125#define JMR3927_ISAC_LED_USRLED 0x02
126
127/* bits for ISAC_INTS/ISAC_INTM/ISAC_INTP (high byte) */
128#define JMR3927_ISAC_INTB_IRQ5 0
129#define JMR3927_ISAC_INTB_IRQKB 1
130#define JMR3927_ISAC_INTB_IRQMOUSE 2
131#define JMR3927_ISAC_INTB_IRQ4 3
132#define JMR3927_ISAC_INTB_IRQ12 4
133#define JMR3927_ISAC_INTB_IRQ3 5
134#define JMR3927_ISAC_INTB_IRQ10 6
135#define JMR3927_ISAC_INTB_ISAER 7
136#define JMR3927_ISAC_INTF_IRQ5 (1 << JMR3927_ISAC_INTB_IRQ5)
137#define JMR3927_ISAC_INTF_IRQKB (1 << JMR3927_ISAC_INTB_IRQKB)
138#define JMR3927_ISAC_INTF_IRQMOUSE (1 << JMR3927_ISAC_INTB_IRQMOUSE)
139#define JMR3927_ISAC_INTF_IRQ4 (1 << JMR3927_ISAC_INTB_IRQ4)
140#define JMR3927_ISAC_INTF_IRQ12 (1 << JMR3927_ISAC_INTB_IRQ12)
141#define JMR3927_ISAC_INTF_IRQ3 (1 << JMR3927_ISAC_INTB_IRQ3)
142#define JMR3927_ISAC_INTF_IRQ10 (1 << JMR3927_ISAC_INTB_IRQ10)
143#define JMR3927_ISAC_INTF_ISAER (1 << JMR3927_ISAC_INTB_ISAER)
144
145#ifndef __ASSEMBLY__
146
147#if 0
148#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned short *)(a)) = (d) << 8)
149#define jmr3927_ioc_reg_in(a) (((*(volatile unsigned short *)(a)) >> 8) & 0xff)
150#else
151#if defined(__BIG_ENDIAN) 85#if defined(__BIG_ENDIAN)
152#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d)) 86#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
153#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a)) 87#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
@@ -157,37 +91,9 @@
157#else 91#else
158#error "No Endian" 92#error "No Endian"
159#endif 93#endif
160#endif
161#define jmr3927_isac_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
162#define jmr3927_isac_reg_in(a) (*(volatile unsigned char *)(a))
163
164static inline int jmr3927_have_isac(void)
165{
166 unsigned char idt;
167 unsigned long flags;
168 unsigned long romcr3;
169
170 local_irq_save(flags);
171 romcr3 = tx3927_romcptr->cr[3];
172 tx3927_romcptr->cr[3] &= 0xffffefff; /* do not wait infinitely */
173 idt = jmr3927_isac_reg_in(JMR3927_ISAC_REV_ADDR) & JMR3927_IDT_MASK;
174 tx3927_romcptr->cr[3] = romcr3;
175 local_irq_restore(flags);
176
177 return idt == JMR3927_ISAC_IDT;
178}
179#define jmr3927_have_nvram() \
180 ((jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_IDT_MASK) == JMR3927_IOC_IDT)
181
182/* NVRAM macro */
183#define jmr3927_nvram_in(ofs) \
184 jmr3927_ioc_reg_in(JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1))
185#define jmr3927_nvram_out(d, ofs) \
186 jmr3927_ioc_reg_out(d, JMR3927_IOC_NVRAMB_ADDR + ((ofs) << 1))
187 94
188/* LED macro */ 95/* LED macro */
189#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR) 96#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
190#define jmr3927_io_led_set(n/*0-3*/) jmr3927_isac_reg_out((n), JMR3927_ISAC_LED_ADDR)
191 97
192#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR) 98#define jmr3927_led_and_set(n/*0-16*/) jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR)
193 99
@@ -196,10 +102,6 @@ static inline int jmr3927_have_isac(void)
196#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0) 102#define jmr3927_dipsw2() ((tx3927_pioptr->din & (1 << 10)) == 0)
197#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0) 103#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
198#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0) 104#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
199#define jmr3927_io_dipsw() (jmr3927_isac_reg_in(JMR3927_ISAC_LED_ADDR) >> 4)
200
201
202#endif /* !__ASSEMBLY__ */
203 105
204/* 106/*
205 * IRQ mappings 107 * IRQ mappings
@@ -212,16 +114,10 @@ static inline int jmr3927_have_isac(void)
212 */ 114 */
213#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */ 115#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
214#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */ 116#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
215#define JMR3927_NR_IRQ_ISAC 8 /* ISA */
216 117
217 118#define JMR3927_IRQ_IRC 16
218#define JMR3927_IRQ_IRC NR_ISA_IRQS
219#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC) 119#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
220#define JMR3927_IRQ_ISAC (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC) 120#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
221#define JMR3927_IRQ_END (JMR3927_IRQ_ISAC + JMR3927_NR_IRQ_ISAC)
222#define JMR3927_IRQ_IS_IRC(irq) (JMR3927_IRQ_IRC <= (irq) && (irq) < JMR3927_IRQ_IOC)
223#define JMR3927_IRQ_IS_IOC(irq) (JMR3927_IRQ_IOC <= (irq) && (irq) < JMR3927_IRQ_ISAC)
224#define JMR3927_IRQ_IS_ISAC(irq) (JMR3927_IRQ_ISAC <= (irq) && (irq) < JMR3927_IRQ_END)
225 121
226#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0) 122#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
227#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1) 123#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
@@ -246,37 +142,13 @@ static inline int jmr3927_have_isac(void)
246#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6) 142#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
247#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7) 143#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
248#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT) 144#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
249#define JMR3927_IRQ_ISAC_IRQ5 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ5)
250#define JMR3927_IRQ_ISAC_IRQKB (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQKB)
251#define JMR3927_IRQ_ISAC_IRQMOUSE (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQMOUSE)
252#define JMR3927_IRQ_ISAC_IRQ4 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ4)
253#define JMR3927_IRQ_ISAC_IRQ12 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ12)
254#define JMR3927_IRQ_ISAC_IRQ3 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ3)
255#define JMR3927_IRQ_ISAC_IRQ10 (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_IRQ10)
256#define JMR3927_IRQ_ISAC_ISAER (JMR3927_IRQ_ISAC + JMR3927_ISAC_INTB_ISAER)
257 145
258#if 0 /* auto detect */
259/* RTL8019AS 10M Ether (JMI-3927IO2:JPW2:1-2 Short) */
260#define JMR3927_IRQ_ETHER1 JMR3927_IRQ_IRC_INT0
261#endif
262/* IOC (PCI, MODEM) */ 146/* IOC (PCI, MODEM) */
263#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1 147#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
264/* ISAC (ISA, PCMCIA, KEYBOARD, MOUSE) */
265#define JMR3927_IRQ_ISACINT JMR3927_IRQ_IRC_INT2
266/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */ 148/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
267#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3 149#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
268/* Clock Tick (10ms) */ 150/* Clock Tick (10ms) */
269#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0 151#define JMR3927_IRQ_TICK JMR3927_IRQ_IRC_TMR0
270#define JMR3927_IRQ_IDE JMR3927_IRQ_ISAC_IRQ12
271
272/* IEEE1394 (Note that this may conflicts with RTL8019AS 10M Ether...) */
273#define JMR3927_IRQ_PREMIER3 JMR3927_IRQ_IRC_INT0
274
275/* I/O Ports */
276/* RTL8019AS 10M Ether */
277#define JMR3927_ETHER1_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x280)
278#define JMR3927_KBD_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x00800060)
279#define JMR3927_IDE_PORT (JMR3927_ISAIO_BASE - JMR3927_PORT_BASE + 0x001001f0)
280 152
281/* Clocks */ 153/* Clocks */
282#define JMR3927_CORECLK 132710400 /* 132.7MHz */ 154#define JMR3927_CORECLK 132710400 /* 132.7MHz */
diff --git a/include/asm-mips/jmr3927/tx3927.h b/include/asm-mips/jmr3927/tx3927.h
index b3d67c75d9ac..0b9073bfb759 100644
--- a/include/asm-mips/jmr3927/tx3927.h
+++ b/include/asm-mips/jmr3927/tx3927.h
@@ -22,8 +22,6 @@
22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100) 22#define TX3927_SIO_REG(ch) (0xfffef300 + (ch) * 0x100)
23#define TX3927_PIO_REG 0xfffef500 23#define TX3927_PIO_REG 0xfffef500
24 24
25#ifndef __ASSEMBLY__
26
27struct tx3927_sdramc_reg { 25struct tx3927_sdramc_reg {
28 volatile unsigned long cr[8]; 26 volatile unsigned long cr[8];
29 volatile unsigned long tr[3]; 27 volatile unsigned long tr[3];
@@ -164,8 +162,6 @@ struct tx3927_ccfg_reg {
164 volatile unsigned long pdcr; 162 volatile unsigned long pdcr;
165}; 163};
166 164
167#endif /* !__ASSEMBLY__ */
168
169/* 165/*
170 * SDRAMC 166 * SDRAMC
171 */ 167 */
@@ -348,8 +344,6 @@ struct tx3927_ccfg_reg {
348#define TX3927_PCFG_SELDMA_ALL 0x0000000f 344#define TX3927_PCFG_SELDMA_ALL 0x0000000f
349#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch)) 345#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
350 346
351#ifndef __ASSEMBLY__
352
353#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG) 347#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
354#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG) 348#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
355#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) 349#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
@@ -360,6 +354,4 @@ struct tx3927_ccfg_reg {
360#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) 354#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
361#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG) 355#define tx3927_pioptr ((struct txx927_pio_reg *)TX3927_PIO_REG)
362 356
363#endif /* !__ASSEMBLY__ */
364
365#endif /* __ASM_TX3927_H */ 357#endif /* __ASM_TX3927_H */
diff --git a/include/asm-mips/jmr3927/txx927.h b/include/asm-mips/jmr3927/txx927.h
index 9d5792eab452..58a8ff6be815 100644
--- a/include/asm-mips/jmr3927/txx927.h
+++ b/include/asm-mips/jmr3927/txx927.h
@@ -10,8 +10,6 @@
10#ifndef __ASM_TXX927_H 10#ifndef __ASM_TXX927_H
11#define __ASM_TXX927_H 11#define __ASM_TXX927_H
12 12
13#ifndef __ASSEMBLY__
14
15struct txx927_tmr_reg { 13struct txx927_tmr_reg {
16 volatile unsigned long tcr; 14 volatile unsigned long tcr;
17 volatile unsigned long tisr; 15 volatile unsigned long tisr;
@@ -52,9 +50,6 @@ struct txx927_pio_reg {
52 volatile unsigned long maskext; 50 volatile unsigned long maskext;
53}; 51};
54 52
55#endif /* !__ASSEMBLY__ */
56
57
58/* 53/*
59 * TMR 54 * TMR
60 */ 55 */
diff --git a/include/asm-mips/lasat/lasat.h b/include/asm-mips/lasat/lasat.h
index 181afc5c0f1d..42077e367a5b 100644
--- a/include/asm-mips/lasat/lasat.h
+++ b/include/asm-mips/lasat/lasat.h
@@ -237,8 +237,6 @@ static inline void lasat_ndelay(unsigned int ns)
237 __delay(ns / lasat_ndelay_divider); 237 __delay(ns / lasat_ndelay_divider);
238} 238}
239 239
240extern void (* prom_printf)(const char *fmt, ...);
241
242#endif /* !defined (_LANGUAGE_ASSEMBLY) */ 240#endif /* !defined (_LANGUAGE_ASSEMBLY) */
243 241
244#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef 242#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef
diff --git a/include/asm-mips/mach-atlas/mc146818rtc.h b/include/asm-mips/mach-atlas/mc146818rtc.h
index a73a5698420c..51d337e1bbd1 100644
--- a/include/asm-mips/mach-atlas/mc146818rtc.h
+++ b/include/asm-mips/mach-atlas/mc146818rtc.h
@@ -55,6 +55,6 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
55 55
56#define RTC_ALWAYS_BCD 0 56#define RTC_ALWAYS_BCD 0
57 57
58#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) 58#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
59 59
60#endif /* __ASM_MACH_ATLAS_MC146818RTC_H */ 60#endif /* __ASM_MACH_ATLAS_MC146818RTC_H */
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index 582acd8adb81..58fca8a5a9a6 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -39,6 +39,7 @@
39#ifndef _LANGUAGE_ASSEMBLY 39#ifndef _LANGUAGE_ASSEMBLY
40 40
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <linux/types.h>
42#include <asm/io.h> 43#include <asm/io.h>
43 44
44/* cpu pipeline flush */ 45/* cpu pipeline flush */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index e9fa252f8a3f..8fcae21adbd5 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -141,40 +141,6 @@ static int auide_ddma_init( _auide_hwif *auide );
141static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif); 141static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif);
142int __init auide_probe(void); 142int __init auide_probe(void);
143 143
144#ifdef CONFIG_PM
145 int au1200ide_pm_callback( au1xxx_power_dev_t *dev,
146 au1xxx_request_t request, void *data);
147 static int au1xxxide_pm_standby( au1xxx_power_dev_t *dev );
148 static int au1xxxide_pm_sleep( au1xxx_power_dev_t *dev );
149 static int au1xxxide_pm_resume( au1xxx_power_dev_t *dev );
150 static int au1xxxide_pm_getstatus( au1xxx_power_dev_t *dev );
151 static int au1xxxide_pm_access( au1xxx_power_dev_t *dev );
152 static int au1xxxide_pm_idle( au1xxx_power_dev_t *dev );
153 static int au1xxxide_pm_cleanup( au1xxx_power_dev_t *dev );
154#endif
155
156
157/*
158 * Multi-Word DMA + DbDMA functions
159 */
160#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
161 static int auide_build_sglist(ide_drive_t *drive, struct request *rq);
162 static int auide_build_dmatable(ide_drive_t *drive);
163 static int auide_dma_end(ide_drive_t *drive);
164 ide_startstop_t auide_dma_intr (ide_drive_t *drive);
165 static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command);
166 static int auide_dma_setup(ide_drive_t *drive);
167 static int auide_dma_check(ide_drive_t *drive);
168 static int auide_dma_test_irq(ide_drive_t *drive);
169 static int auide_dma_host_off(ide_drive_t *drive);
170 static int auide_dma_host_on(ide_drive_t *drive);
171 static int auide_dma_lostirq(ide_drive_t *drive);
172 static int auide_dma_on(ide_drive_t *drive);
173 static void auide_ddma_tx_callback(int irq, void *param);
174 static void auide_ddma_rx_callback(int irq, void *param);
175 static int auide_dma_off_quietly(ide_drive_t *drive);
176#endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
177
178/******************************************************************************* 144/*******************************************************************************
179* PIO Mode timing calculation : * 145* PIO Mode timing calculation : *
180* * 146* *
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
index 00b0fc68d5cb..24a8d51a55a3 100644
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ b/include/asm-mips/mach-cobalt/cobalt.h
@@ -12,6 +12,8 @@
12#ifndef __ASM_COBALT_H 12#ifndef __ASM_COBALT_H
13#define __ASM_COBALT_H 13#define __ASM_COBALT_H
14 14
15#include <irq.h>
16
15/* 17/*
16 * i8259 legacy interrupts used on Cobalt: 18 * i8259 legacy interrupts used on Cobalt:
17 * 19 *
@@ -25,7 +27,7 @@
25/* 27/*
26 * CPU IRQs are 16 ... 23 28 * CPU IRQs are 16 ... 23
27 */ 29 */
28#define COBALT_CPU_IRQ 16 30#define COBALT_CPU_IRQ MIPS_CPU_IRQ_BASE
29 31
30#define COBALT_GALILEO_IRQ (COBALT_CPU_IRQ + 2) 32#define COBALT_GALILEO_IRQ (COBALT_CPU_IRQ + 2)
31#define COBALT_SCC_IRQ (COBALT_CPU_IRQ + 3) /* pre-production has 85C30 */ 33#define COBALT_SCC_IRQ (COBALT_CPU_IRQ + 3) /* pre-production has 85C30 */
diff --git a/include/asm-mips/mach-emma2rh/irq.h b/include/asm-mips/mach-emma2rh/irq.h
index bce64244b800..5439eb856461 100644
--- a/include/asm-mips/mach-emma2rh/irq.h
+++ b/include/asm-mips/mach-emma2rh/irq.h
@@ -10,4 +10,6 @@
10 10
11#define NR_IRQS 256 11#define NR_IRQS 256
12 12
13#include_next <irq.h>
14
13#endif /* __ASM_MACH_EMMA2RH_IRQ_H */ 15#endif /* __ASM_MACH_EMMA2RH_IRQ_H */
diff --git a/include/asm-mips/mach-generic/dma-coherence.h b/include/asm-mips/mach-generic/dma-coherence.h
new file mode 100644
index 000000000000..76e04e7feb84
--- /dev/null
+++ b/include/asm-mips/mach-generic/dma-coherence.h
@@ -0,0 +1,45 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
7 *
8 */
9#ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H
10#define __ASM_MACH_GENERIC_DMA_COHERENCE_H
11
12struct device;
13
14static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
15 size_t size)
16{
17 return virt_to_phys(addr);
18}
19
20static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
21 struct page *page)
22{
23 return page_to_phys(page);
24}
25
26static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
27{
28 return dma_addr;
29}
30
31static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
32{
33}
34
35static inline int plat_device_is_coherent(struct device *dev)
36{
37#ifdef CONFIG_DMA_COHERENT
38 return 1;
39#endif
40#ifdef CONFIG_DMA_NONCOHERENT
41 return 0;
42#endif
43}
44
45#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-generic/irq.h b/include/asm-mips/mach-generic/irq.h
index 500e10ff24de..70d9a25132c5 100644
--- a/include/asm-mips/mach-generic/irq.h
+++ b/include/asm-mips/mach-generic/irq.h
@@ -8,6 +8,38 @@
8#ifndef __ASM_MACH_GENERIC_IRQ_H 8#ifndef __ASM_MACH_GENERIC_IRQ_H
9#define __ASM_MACH_GENERIC_IRQ_H 9#define __ASM_MACH_GENERIC_IRQ_H
10 10
11#ifndef NR_IRQS
11#define NR_IRQS 128 12#define NR_IRQS 128
13#endif
14
15#ifdef CONFIG_I8259
16#ifndef I8259A_IRQ_BASE
17#define I8259A_IRQ_BASE 0
18#endif
19#endif
20
21#ifdef CONFIG_IRQ_CPU
22
23#ifndef MIPS_CPU_IRQ_BASE
24#ifdef CONFIG_I8259
25#define MIPS_CPU_IRQ_BASE 16
26#else
27#define MIPS_CPU_IRQ_BASE 0
28#endif /* CONFIG_I8259 */
29#endif
30
31#ifdef CONFIG_IRQ_CPU_RM7K
32#ifndef RM7K_CPU_IRQ_BASE
33#define RM7K_CPU_IRQ_BASE (MIPS_CPU_IRQ_BASE+8)
34#endif
35#endif
36
37#ifdef CONFIG_IRQ_CPU_RM9K
38#ifndef RM9K_CPU_IRQ_BASE
39#define RM9K_CPU_IRQ_BASE (MIPS_CPU_IRQ_BASE+12)
40#endif
41#endif
42
43#endif /* CONFIG_IRQ_CPU */
12 44
13#endif /* __ASM_MACH_GENERIC_IRQ_H */ 45#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/include/asm-mips/mach-generic/kmalloc.h b/include/asm-mips/mach-generic/kmalloc.h
index 410ab5f6c563..b8e6deba352f 100644
--- a/include/asm-mips/mach-generic/kmalloc.h
+++ b/include/asm-mips/mach-generic/kmalloc.h
@@ -5,6 +5,7 @@
5#ifndef CONFIG_DMA_COHERENT 5#ifndef CONFIG_DMA_COHERENT
6/* 6/*
7 * Total overkill for most systems but need as a safe default. 7 * Total overkill for most systems but need as a safe default.
8 * Set this one if any device in the system might do non-coherent DMA.
8 */ 9 */
9#define ARCH_KMALLOC_MINALIGN 128 10#define ARCH_KMALLOC_MINALIGN 128
10#endif 11#endif
diff --git a/include/asm-mips/mach-generic/mc146818rtc.h b/include/asm-mips/mach-generic/mc146818rtc.h
index 90c2e6f77faa..0b9a942f079d 100644
--- a/include/asm-mips/mach-generic/mc146818rtc.h
+++ b/include/asm-mips/mach-generic/mc146818rtc.h
@@ -30,7 +30,7 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
30#define RTC_ALWAYS_BCD 1 30#define RTC_ALWAYS_BCD 1
31 31
32#ifndef mc146818_decode_year 32#ifndef mc146818_decode_year
33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) 33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
34#endif 34#endif
35 35
36#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */ 36#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h
new file mode 100644
index 000000000000..3fdbbf68e952
--- /dev/null
+++ b/include/asm-mips/mach-ip27/dma-coherence.h
@@ -0,0 +1,50 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
7 *
8 */
9#ifndef __ASM_MACH_IP27_DMA_COHERENCE_H
10#define __ASM_MACH_IP27_DMA_COHERENCE_H
11
12#include <asm/pci/bridge.h>
13
14#define pdev_to_baddr(pdev, addr) \
15 (BRIDGE_CONTROLLER(pdev->bus)->baddr + (addr))
16#define dev_to_baddr(dev, addr) \
17 pdev_to_baddr(to_pci_dev(dev), (addr))
18
19struct device;
20
21static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
22 size_t size)
23{
24 dma_addr_t pa = dev_to_baddr(dev, virt_to_phys(addr));
25
26 return pa;
27}
28
29static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
30{
31 dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page));
32
33 return pa;
34}
35
36static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
37{
38 return dma_addr & (0xffUL << 56);
39}
40
41static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
42{
43}
44
45static inline int plat_device_is_coherent(struct device *dev)
46{
47 return 1; /* IP27 non-cohernet mode is unsupported */
48}
49
50#endif /* __ASM_MACH_IP27_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
index 44790fdc5d00..61d9be3f3175 100644
--- a/include/asm-mips/mach-ip27/topology.h
+++ b/include/asm-mips/mach-ip27/topology.h
@@ -28,7 +28,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
28 .busy_factor = 32, \ 28 .busy_factor = 32, \
29 .imbalance_pct = 125, \ 29 .imbalance_pct = 125, \
30 .cache_nice_tries = 1, \ 30 .cache_nice_tries = 1, \
31 .per_cpu_gain = 100, \
32 .flags = SD_LOAD_BALANCE \ 31 .flags = SD_LOAD_BALANCE \
33 | SD_BALANCE_EXEC \ 32 | SD_BALANCE_EXEC \
34 | SD_WAKE_BALANCE, \ 33 | SD_WAKE_BALANCE, \
diff --git a/include/asm-mips/mach-ip32/dma-coherence.h b/include/asm-mips/mach-ip32/dma-coherence.h
new file mode 100644
index 000000000000..c3f9a6a20eb0
--- /dev/null
+++ b/include/asm-mips/mach-ip32/dma-coherence.h
@@ -0,0 +1,72 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
7 *
8 */
9#ifndef __ASM_MACH_IP35_DMA_COHERENCE_H
10#define __ASM_MACH_IP35_DMA_COHERENCE_H
11
12#include <asm/ip32/crime.h>
13
14struct device;
15
16/*
17 * Few notes.
18 * 1. CPU sees memory as two chunks: 0-256M@0x0, and the rest @0x40000000+256M
19 * 2. PCI sees memory as one big chunk @0x0 (or we could use 0x40000000 for
20 * native-endian)
21 * 3. All other devices see memory as one big chunk at 0x40000000
22 * 4. Non-PCI devices will pass NULL as struct device*
23 *
24 * Thus we translate differently, depending on device.
25 */
26
27#define RAM_OFFSET_MASK 0x3fffffffUL
28
29static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
30 size_t size)
31{
32 dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK;
33
34 if (dev == NULL)
35 pa += CRIME_HI_MEM_BASE;
36
37 return pa;
38}
39
40static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
41{
42 dma_addr_t pa;
43
44 pa = page_to_phys(page) & RAM_OFFSET_MASK;
45
46 if (dev == NULL)
47 pa += CRIME_HI_MEM_BASE;
48
49 return pa;
50}
51
52/* This is almost certainly wrong but it's what dma-ip32.c used to use */
53static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
54{
55 unsigned long addr = dma_addr & RAM_OFFSET_MASK;
56
57 if (dma_addr >= 256*1024*1024)
58 addr += CRIME_HI_MEM_BASE;
59
60 return addr;
61}
62
63static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
64{
65}
66
67static inline int plat_device_is_coherent(struct device *dev)
68{
69 return 0; /* IP32 is non-cohernet */
70}
71
72#endif /* __ASM_MACH_IP35_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-jazz/dma-coherence.h b/include/asm-mips/mach-jazz/dma-coherence.h
new file mode 100644
index 000000000000..d66979a124a8
--- /dev/null
+++ b/include/asm-mips/mach-jazz/dma-coherence.h
@@ -0,0 +1,40 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MACH_JAZZ_DMA_COHERENCE_H
9#define __ASM_MACH_JAZZ_DMA_COHERENCE_H
10
11#include <asm/jazzdma.h>
12
13struct device;
14
15static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
16{
17 return vdma_alloc(virt_to_phys(addr), size);
18}
19
20static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
21{
22 return vdma_alloc(page_to_phys(page), PAGE_SIZE);
23}
24
25static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
26{
27 return vdma_log2phys(dma_addr);
28}
29
30static void plat_unmap_dma_mem(dma_addr_t dma_addr)
31{
32 vdma_free(dma_addr);
33}
34
35static inline int plat_device_is_coherent(struct device *dev)
36{
37 return 0;
38}
39
40#endif /* __ASM_MACH_JAZZ_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-jmr3927/ds1742.h b/include/asm-mips/mach-jmr3927/ds1742.h
deleted file mode 100644
index 8a8fef6d07fa..000000000000
--- a/include/asm-mips/mach-jmr3927/ds1742.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003, 06 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JMR3927_DS1742_H
9#define __ASM_MACH_JMR3927_DS1742_H
10
11#include <asm/jmr3927/jmr3927.h>
12
13#define rtc_read(reg) (jmr3927_nvram_in(reg))
14#define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg)))
15
16#endif /* __ASM_MACH_JMR3927_DS1742_H */
diff --git a/include/asm-mips/mach-jmr3927/mangle-port.h b/include/asm-mips/mach-jmr3927/mangle-port.h
new file mode 100644
index 000000000000..501a202631b5
--- /dev/null
+++ b/include/asm-mips/mach-jmr3927/mangle-port.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_MACH_JMR3927_MANGLE_PORT_H
2#define __ASM_MACH_JMR3927_MANGLE_PORT_H
3
4extern unsigned long __swizzle_addr_b(unsigned long port);
5#define __swizzle_addr_w(port) (port)
6#define __swizzle_addr_l(port) (port)
7#define __swizzle_addr_q(port) (port)
8
9#define ioswabb(a,x) (x)
10#define __mem_ioswabb(a,x) (x)
11#define ioswabw(a,x) le16_to_cpu(x)
12#define __mem_ioswabw(a,x) (x)
13#define ioswabl(a,x) le32_to_cpu(x)
14#define __mem_ioswabl(a,x) (x)
15#define ioswabq(a,x) le64_to_cpu(x)
16#define __mem_ioswabq(a,x) (x)
17
18#endif /* __ASM_MACH_JMR3927_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-mips/irq.h b/include/asm-mips/mach-mips/irq.h
index e994b0c01227..9b9da26683c2 100644
--- a/include/asm-mips/mach-mips/irq.h
+++ b/include/asm-mips/mach-mips/irq.h
@@ -4,4 +4,6 @@
4 4
5#define NR_IRQS 256 5#define NR_IRQS 256
6 6
7#include_next <irq.h>
8
7#endif /* __ASM_MACH_MIPS_IRQ_H */ 9#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/include/asm-mips/mach-mips/mc146818rtc.h b/include/asm-mips/mach-mips/mc146818rtc.h
index 6730ba066576..ea612f37f614 100644
--- a/include/asm-mips/mach-mips/mc146818rtc.h
+++ b/include/asm-mips/mach-mips/mc146818rtc.h
@@ -43,6 +43,6 @@ static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
43 43
44#define RTC_ALWAYS_BCD 0 44#define RTC_ALWAYS_BCD 0
45 45
46#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970) 46#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
47 47
48#endif /* __ASM_MACH_MALTA_MC146818RTC_H */ 48#endif /* __ASM_MACH_MALTA_MC146818RTC_H */
diff --git a/include/asm-mips/mach-rm/cpu-feature-overrides.h b/include/asm-mips/mach-rm/cpu-feature-overrides.h
index 11410ae10d36..7e07283140a3 100644
--- a/include/asm-mips/mach-rm/cpu-feature-overrides.h
+++ b/include/asm-mips/mach-rm/cpu-feature-overrides.h
@@ -21,9 +21,7 @@
21#define cpu_has_watch 0 21#define cpu_has_watch 0
22#define cpu_has_mips16 0 22#define cpu_has_mips16 0
23#define cpu_has_divec 0 23#define cpu_has_divec 0
24#define cpu_has_vce 0
25#define cpu_has_cache_cdex_p 1 24#define cpu_has_cache_cdex_p 1
26#define cpu_has_cache_cdex_s 0
27#define cpu_has_prefetch 0 25#define cpu_has_prefetch 0
28#define cpu_has_mcheck 0 26#define cpu_has_mcheck 0
29#define cpu_has_ejtag 0 27#define cpu_has_ejtag 0
@@ -35,9 +33,6 @@
35#define cpu_has_nofpuex 0 33#define cpu_has_nofpuex 0
36#define cpu_has_64bits 1 34#define cpu_has_64bits 1
37 35
38#define cpu_dcache_line_size() 32
39#define cpu_icache_line_size() 32
40
41#define cpu_has_mips32r1 0 36#define cpu_has_mips32r1 0
42#define cpu_has_mips32r2 0 37#define cpu_has_mips32r2 0
43#define cpu_has_mips64r1 0 38#define cpu_has_mips64r1 0
diff --git a/include/asm-mips/mach-rm/mc146818rtc.h b/include/asm-mips/mach-rm/mc146818rtc.h
index d37ae68dc6a3..145bce096fe9 100644
--- a/include/asm-mips/mach-rm/mc146818rtc.h
+++ b/include/asm-mips/mach-rm/mc146818rtc.h
@@ -7,11 +7,15 @@
7 * 7 *
8 * RTC routines for PC style attached Dallas chip with ARC epoch. 8 * RTC routines for PC style attached Dallas chip with ARC epoch.
9 */ 9 */
10#ifndef __ASM_MACH_RM200_MC146818RTC_H 10#ifndef __ASM_MACH_RM_MC146818RTC_H
11#define __ASM_MACH_RM200_MC146818RTC_H 11#define __ASM_MACH_RM_MC146818RTC_H
12 12
13#ifdef CONFIG_CPU_BIG_ENDIAN
14#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
15#else
13#define mc146818_decode_year(year) ((year) + 1980) 16#define mc146818_decode_year(year) ((year) + 1980)
17#endif
14 18
15#include_next <mc146818rtc.h> 19#include_next <mc146818rtc.h>
16 20
17#endif /* __ASM_MACH_RM200_MC146818RTC_H */ 21#endif /* __ASM_MACH_RM_MC146818RTC_H */
diff --git a/include/asm-mips/mach-vr41xx/irq.h b/include/asm-mips/mach-vr41xx/irq.h
new file mode 100644
index 000000000000..848812296052
--- /dev/null
+++ b/include/asm-mips/mach-vr41xx/irq.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_MACH_VR41XX_IRQ_H
2#define __ASM_MACH_VR41XX_IRQ_H
3
4#include <asm/vr41xx/irq.h> /* for MIPS_CPU_IRQ_BASE */
5#ifdef CONFIG_NEC_CMBVR4133
6#include <asm/vr41xx/cmbvr4133.h> /* for I8259A_IRQ_BASE */
7#endif
8
9#include_next <irq.h>
10
11#endif /* __ASM_MACH_VR41XX_IRQ_H */
diff --git a/include/asm-mips/marvell.h b/include/asm-mips/marvell.h
index df94955b098a..b6144bafc565 100644
--- a/include/asm-mips/marvell.h
+++ b/include/asm-mips/marvell.h
@@ -54,5 +54,6 @@ struct mv_pci_controller {
54}; 54};
55 55
56extern void ll_mv64340_irq(void); 56extern void ll_mv64340_irq(void);
57extern void mv64340_irq_init(unsigned int base);
57 58
58#endif /* __ASM_MIPS_MARVELL_H */ 59#endif /* __ASM_MIPS_MARVELL_H */
diff --git a/include/asm-mips/mips-boards/atlasint.h b/include/asm-mips/mips-boards/atlasint.h
index b15e4ea0b091..76add42e486e 100644
--- a/include/asm-mips/mips-boards/atlasint.h
+++ b/include/asm-mips/mips-boards/atlasint.h
@@ -26,10 +26,12 @@
26#ifndef _MIPS_ATLASINT_H 26#ifndef _MIPS_ATLASINT_H
27#define _MIPS_ATLASINT_H 27#define _MIPS_ATLASINT_H
28 28
29#include <irq.h>
30
29/* 31/*
30 * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode) 32 * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode)
31 */ 33 */
32#define MIPSCPU_INT_BASE 0 34#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
33 35
34/* CPU interrupt offsets */ 36/* CPU interrupt offsets */
35#define MIPSCPU_INT_SW0 0 37#define MIPSCPU_INT_SW0 0
diff --git a/include/asm-mips/mips-boards/maltaint.h b/include/asm-mips/mips-boards/maltaint.h
index da6cc2fbbc78..9180d6466113 100644
--- a/include/asm-mips/mips-boards/maltaint.h
+++ b/include/asm-mips/mips-boards/maltaint.h
@@ -25,6 +25,8 @@
25#ifndef _MIPS_MALTAINT_H 25#ifndef _MIPS_MALTAINT_H
26#define _MIPS_MALTAINT_H 26#define _MIPS_MALTAINT_H
27 27
28#include <irq.h>
29
28/* 30/*
29 * Interrupts 0..15 are used for Malta ISA compatible interrupts 31 * Interrupts 0..15 are used for Malta ISA compatible interrupts
30 */ 32 */
@@ -33,7 +35,7 @@
33/* 35/*
34 * Interrupts 16..23 are used for Malta CPU interrupts (nonEIC mode) 36 * Interrupts 16..23 are used for Malta CPU interrupts (nonEIC mode)
35 */ 37 */
36#define MIPSCPU_INT_BASE 16 38#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
37 39
38/* CPU interrupt offsets */ 40/* CPU interrupt offsets */
39#define MIPSCPU_INT_SW0 0 41#define MIPSCPU_INT_SW0 0
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h
index 4168c7fcd43e..daaf9f98fc63 100644
--- a/include/asm-mips/mips-boards/prom.h
+++ b/include/asm-mips/mips-boards/prom.h
@@ -28,12 +28,9 @@
28 28
29extern char *prom_getcmdline(void); 29extern char *prom_getcmdline(void);
30extern char *prom_getenv(char *name); 30extern char *prom_getenv(char *name);
31extern void setup_prom_printf(int tty_no);
32extern void prom_printf(char *fmt, ...);
33extern void prom_init_cmdline(void); 31extern void prom_init_cmdline(void);
34extern void prom_meminit(void); 32extern void prom_meminit(void);
35extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); 33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
36extern unsigned long prom_free_prom_memory (void);
37extern void mips_display_message(const char *str); 34extern void mips_display_message(const char *str);
38extern void mips_display_word(unsigned int num); 35extern void mips_display_word(unsigned int num);
39extern int get_ethernet_addr(char *ethernet_addr); 36extern int get_ethernet_addr(char *ethernet_addr);
diff --git a/include/asm-mips/mips-boards/seadint.h b/include/asm-mips/mips-boards/seadint.h
index 365c2a3c64f5..4f6a3933699d 100644
--- a/include/asm-mips/mips-boards/seadint.h
+++ b/include/asm-mips/mips-boards/seadint.h
@@ -20,10 +20,12 @@
20#ifndef _MIPS_SEADINT_H 20#ifndef _MIPS_SEADINT_H
21#define _MIPS_SEADINT_H 21#define _MIPS_SEADINT_H
22 22
23#include <irq.h>
24
23/* 25/*
24 * Interrupts 0..7 are used for SEAD CPU interrupts 26 * Interrupts 0..7 are used for SEAD CPU interrupts
25 */ 27 */
26#define MIPSCPU_INT_BASE 0 28#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
27 29
28#define MIPSCPU_INT_UART0 2 30#define MIPSCPU_INT_UART0 2
29#define MIPSCPU_INT_UART1 3 31#define MIPSCPU_INT_UART1 3
diff --git a/include/asm-mips/mips-boards/simint.h b/include/asm-mips/mips-boards/simint.h
index 4952e0b3bf11..54f2fe621d69 100644
--- a/include/asm-mips/mips-boards/simint.h
+++ b/include/asm-mips/mips-boards/simint.h
@@ -17,10 +17,11 @@
17#ifndef _MIPS_SIMINT_H 17#ifndef _MIPS_SIMINT_H
18#define _MIPS_SIMINT_H 18#define _MIPS_SIMINT_H
19 19
20#include <irq.h>
20 21
21#define SIM_INT_BASE 0 22#define SIM_INT_BASE 0
22#define MIPSCPU_INT_MB0 2 23#define MIPSCPU_INT_MB0 2
23#define MIPSCPU_INT_BASE 16 24#define MIPSCPU_INT_BASE MIPS_CPU_IRQ_BASE
24#define MIPS_CPU_TIMER_IRQ 7 25#define MIPS_CPU_TIMER_IRQ 7
25 26
26 27
diff --git a/include/asm-mips/mips_mt.h b/include/asm-mips/mips_mt.h
index c31a312b9783..8045abc78d0f 100644
--- a/include/asm-mips/mips_mt.h
+++ b/include/asm-mips/mips_mt.h
@@ -6,10 +6,15 @@
6#ifndef __ASM_MIPS_MT_H 6#ifndef __ASM_MIPS_MT_H
7#define __ASM_MIPS_MT_H 7#define __ASM_MIPS_MT_H
8 8
9#include <linux/cpumask.h>
10
9extern cpumask_t mt_fpu_cpumask; 11extern cpumask_t mt_fpu_cpumask;
10extern unsigned long mt_fpemul_threshold; 12extern unsigned long mt_fpemul_threshold;
11 13
12extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value); 14extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
13extern void mips_mt_set_cpuoptions(void); 15extern void mips_mt_set_cpuoptions(void);
14 16
17struct class;
18extern struct class *mt_class;
19
15#endif /* __ASM_MIPS_MT_H */ 20#endif /* __ASM_MIPS_MT_H */
diff --git a/include/asm-mips/mipsmtregs.h b/include/asm-mips/mipsmtregs.h
index 3e9468f424f4..294bca12cd3f 100644
--- a/include/asm-mips/mipsmtregs.h
+++ b/include/asm-mips/mipsmtregs.h
@@ -165,8 +165,6 @@
165 165
166#ifndef __ASSEMBLY__ 166#ifndef __ASSEMBLY__
167 167
168extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
169
170static inline unsigned int dvpe(void) 168static inline unsigned int dvpe(void)
171{ 169{
172 int res = 0; 170 int res = 0;
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
index 046cf686bee7..e4d6f1fb1cf7 100644
--- a/include/asm-mips/mman.h
+++ b/include/asm-mips/mman.h
@@ -72,7 +72,6 @@
72#define MADV_DOFORK 11 /* do inherit across fork */ 72#define MADV_DOFORK 11 /* do inherit across fork */
73 73
74/* compatibility flags */ 74/* compatibility flags */
75#define MAP_ANON MAP_ANONYMOUS
76#define MAP_FILE 0 75#define MAP_FILE 0
77 76
78#endif /* _ASM_MMAN_H */ 77#endif /* _ASM_MMAN_H */
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
index 147844ef103b..8c08fa904b2c 100644
--- a/include/asm-mips/paccess.h
+++ b/include/asm-mips/paccess.h
@@ -34,7 +34,7 @@ struct __large_pstruct { unsigned long buf[100]; };
34#define __get_dbe(x,ptr,size) \ 34#define __get_dbe(x,ptr,size) \
35({ \ 35({ \
36 long __gu_err; \ 36 long __gu_err; \
37 __typeof(*(ptr)) __gu_val; \ 37 __typeof__(*(ptr)) __gu_val; \
38 unsigned long __gu_addr; \ 38 unsigned long __gu_addr; \
39 __asm__("":"=r" (__gu_val)); \ 39 __asm__("":"=r" (__gu_val)); \
40 __gu_addr = (unsigned long) (ptr); \ 40 __gu_addr = (unsigned long) (ptr); \
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index 2f9e1a9ec51f..d3fbd83ff545 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -34,6 +34,20 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36 36
37/*
38 * This gives the physical RAM offset.
39 */
40#ifndef PHYS_OFFSET
41#define PHYS_OFFSET 0UL
42#endif
43
44/*
45 * It's normally defined only for FLATMEM config but it's
46 * used in our early mem init code for all memory models.
47 * So always define it.
48 */
49#define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)
50
37#include <linux/pfn.h> 51#include <linux/pfn.h>
38#include <asm/io.h> 52#include <asm/io.h>
39 53
@@ -132,20 +146,23 @@ typedef struct { unsigned long pgprot; } pgprot_t;
132/* to align the pointer to the (next) page boundary */ 146/* to align the pointer to the (next) page boundary */
133#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) 147#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
134 148
149/*
150 * __pa()/__va() should be used only during mem init.
151 */
135#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64) 152#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
136#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0) 153#define __pa_page_offset(x) ((unsigned long)(x) < CKSEG0 ? PAGE_OFFSET : CKSEG0)
137#else 154#else
138#define __pa_page_offset(x) PAGE_OFFSET 155#define __pa_page_offset(x) PAGE_OFFSET
139#endif 156#endif
140#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x)) 157#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x) + PHYS_OFFSET)
141#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0)) 158#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
142#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 159#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
143 160
144#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 161#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
145 162
146#ifdef CONFIG_FLATMEM 163#ifdef CONFIG_FLATMEM
147 164
148#define pfn_valid(pfn) ((pfn) < max_mapnr) 165#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
149 166
150#elif defined(CONFIG_SPARSEMEM) 167#elif defined(CONFIG_SPARSEMEM)
151 168
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index 7f0f120ca07c..3eea3ba0fca5 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -32,6 +32,7 @@ struct pci_controller {
32 unsigned long mem_offset; 32 unsigned long mem_offset;
33 struct resource *io_resource; 33 struct resource *io_resource;
34 unsigned long io_offset; 34 unsigned long io_offset;
35 unsigned long io_map_base;
35 36
36 unsigned int index; 37 unsigned int index;
37 /* For compatibility with current (as of July 2003) pciutils 38 /* For compatibility with current (as of July 2003) pciutils
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
index af121c67dc71..5685d4fc7881 100644
--- a/include/asm-mips/pgalloc.h
+++ b/include/asm-mips/pgalloc.h
@@ -130,4 +130,6 @@ static inline void pmd_free(pmd_t *pmd)
130 130
131#define check_pgt_cache() do { } while (0) 131#define check_pgt_cache() do { } while (0)
132 132
133extern void pagetable_init(void);
134
133#endif /* _ASM_PGALLOC_H */ 135#endif /* _ASM_PGALLOC_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index a5b18710b6a4..49f5a1a2dfcd 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -199,7 +199,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
199{ 199{
200 return pud_val(pud); 200 return pud_val(pud);
201} 201}
202#define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET) 202#define pud_phys(pud) virt_to_phys((void *)pud_val(pud))
203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) 203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
204 204
205/* Find an entry in the second-level page table.. */ 205/* Find an entry in the second-level page table.. */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index f2e1325fec6c..0d3295f57a95 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -69,23 +69,13 @@ extern unsigned long zero_page_mask;
69#define ZERO_PAGE(vaddr) \ 69#define ZERO_PAGE(vaddr) \
70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))) 70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
71 71
72#define __HAVE_ARCH_MOVE_PTE
73#define move_pte(pte, prot, old_addr, new_addr) \
74({ \
75 pte_t newpte = (pte); \
76 if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \
77 pte_page(pte) == ZERO_PAGE(old_addr)) \
78 newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \
79 newpte; \
80})
81
82extern void paging_init(void); 72extern void paging_init(void);
83 73
84/* 74/*
85 * Conversion functions: convert a page and protection to a page entry, 75 * Conversion functions: convert a page and protection to a page entry,
86 * and a page entry and page directory to the page they refer to. 76 * and a page entry and page directory to the page they refer to.
87 */ 77 */
88#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 78#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
89#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
90#define pmd_page_vaddr(pmd) pmd_val(pmd) 80#define pmd_page_vaddr(pmd) pmd_val(pmd)
91 81
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 8a1f2b6f04ac..1906938285c0 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -21,6 +21,7 @@
21#define FPC_EIR 70 21#define FPC_EIR 70
22#define DSP_BASE 71 /* 3 more hi / lo register pairs */ 22#define DSP_BASE 71 /* 3 more hi / lo register pairs */
23#define DSP_CONTROL 77 23#define DSP_CONTROL 77
24#define ACX 78
24 25
25/* 26/*
26 * This struct defines the way the registers are stored on the stack during a 27 * This struct defines the way the registers are stored on the stack during a
@@ -39,6 +40,9 @@ struct pt_regs {
39 unsigned long cp0_status; 40 unsigned long cp0_status;
40 unsigned long hi; 41 unsigned long hi;
41 unsigned long lo; 42 unsigned long lo;
43#ifdef CONFIG_CPU_HAS_SMARTMIPS
44 unsigned long acx;
45#endif
42 unsigned long cp0_badvaddr; 46 unsigned long cp0_badvaddr;
43 unsigned long cp0_cause; 47 unsigned long cp0_cause;
44 unsigned long cp0_epc; 48 unsigned long cp0_epc;
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 76cd51c6be39..65778c890a62 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -6,9 +6,10 @@
6#ifndef __ASM_RTLX_H 6#ifndef __ASM_RTLX_H
7#define __ASM_RTLX_H_ 7#define __ASM_RTLX_H_
8 8
9#include <irq.h>
10
9#define LX_NODE_BASE 10 11#define LX_NODE_BASE 10
10 12
11#define MIPSCPU_INT_BASE 16
12#define MIPS_CPU_RTLX_IRQ 0 13#define MIPS_CPU_RTLX_IRQ 0
13 14
14#define RTLX_VERSION 2 15#define RTLX_VERSION 2
@@ -22,8 +23,8 @@
22 23
23extern int rtlx_open(int index, int can_sleep); 24extern int rtlx_open(int index, int can_sleep);
24extern int rtlx_release(int index); 25extern int rtlx_release(int index);
25extern ssize_t rtlx_read(int index, void *buff, size_t count, int user); 26extern ssize_t rtlx_read(int index, void __user *buff, size_t count);
26extern ssize_t rtlx_write(int index, void *buffer, size_t count, int user); 27extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
27extern unsigned int rtlx_read_poll(int index, int can_sleep); 28extern unsigned int rtlx_read_poll(int index, int can_sleep);
28extern unsigned int rtlx_write_poll(int index); 29extern unsigned int rtlx_write_poll(int index);
29 30
diff --git a/include/asm-mips/sections.h b/include/asm-mips/sections.h
index f7016278b266..b7e37262c246 100644
--- a/include/asm-mips/sections.h
+++ b/include/asm-mips/sections.h
@@ -3,6 +3,4 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern char _fdata;
7
8#endif /* _ASM_SECTIONS_H */ 6#endif /* _ASM_SECTIONS_H */
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
index fcec52bafb25..c4729f531919 100644
--- a/include/asm-mips/sgi/hpc3.h
+++ b/include/asm-mips/sgi/hpc3.h
@@ -206,7 +206,7 @@ struct hpc3_regs {
206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */ 206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */
207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */ 207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */
208 208
209 volatile u32 eeprom; /* EEPROM data reg. */ 209 u32 eeprom; /* EEPROM data reg. */
210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */ 210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */
211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */ 211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */
212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */ 212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
index bbfc05c3cab9..f4981c4f16bb 100644
--- a/include/asm-mips/sgi/ip22.h
+++ b/include/asm-mips/sgi/ip22.h
@@ -21,15 +21,16 @@
21 * HAL2 driver). This will prevent many complications, trust me ;-) 21 * HAL2 driver). This will prevent many complications, trust me ;-)
22 */ 22 */
23 23
24#include <irq.h>
24#include <asm/sgi/ioc.h> 25#include <asm/sgi/ioc.h>
25 26
26#define SGINT_EISA 0 /* 16 EISA irq levels (Indigo2) */ 27#define SGINT_EISA 0 /* 16 EISA irq levels (Indigo2) */
27#define SGINT_CPU 16 /* MIPS CPU define 8 interrupt sources */ 28#define SGINT_CPU MIPS_CPU_IRQ_BASE /* MIPS CPU define 8 interrupt sources */
28#define SGINT_LOCAL0 24 /* 8 local0 irq levels */ 29#define SGINT_LOCAL0 (SGINT_CPU+8) /* 8 local0 irq levels */
29#define SGINT_LOCAL1 32 /* 8 local1 irq levels */ 30#define SGINT_LOCAL1 (SGINT_CPU+16) /* 8 local1 irq levels */
30#define SGINT_LOCAL2 40 /* 8 local2 vectored irq levels */ 31#define SGINT_LOCAL2 (SGINT_CPU+24) /* 8 local2 vectored irq levels */
31#define SGINT_LOCAL3 48 /* 8 local3 vectored irq levels */ 32#define SGINT_LOCAL3 (SGINT_CPU+32) /* 8 local3 vectored irq levels */
32#define SGINT_END 56 /* End of 'spaces' */ 33#define SGINT_END (SGINT_CPU+40) /* End of 'spaces' */
33 34
34/* 35/*
35 * Individual interrupt definitions for the Indy and Indigo2 36 * Individual interrupt definitions for the Indy and Indigo2
@@ -71,7 +72,7 @@
71 72
72#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) 73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
73 74
74extern unsigned short ip22_eeprom_read(volatile unsigned int *ctrl, int reg); 75extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg);
75extern unsigned short ip22_nvram_read(int reg); 76extern unsigned short ip22_nvram_read(int reg);
76 77
77#endif 78#endif
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
index c52f7834c7c8..1576c2394de8 100644
--- a/include/asm-mips/sgi/mc.h
+++ b/include/asm-mips/sgi/mc.h
@@ -57,7 +57,7 @@ struct sgimc_regs {
57 volatile u32 divider; /* Divider reg for RPSS */ 57 volatile u32 divider; /* Divider reg for RPSS */
58 58
59 u32 _unused5; 59 u32 _unused5;
60 volatile u32 eeprom; /* EEPROM byte reg for r4k */ 60 u32 eeprom; /* EEPROM byte reg for r4k */
61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ 61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */
62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ 62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */
63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ 63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */
diff --git a/include/asm-mips/sgialib.h b/include/asm-mips/sgialib.h
index 73f097315502..bfce5c786f1c 100644
--- a/include/asm-mips/sgialib.h
+++ b/include/asm-mips/sgialib.h
@@ -33,9 +33,6 @@ extern int prom_flags;
33extern void prom_putchar(char c); 33extern void prom_putchar(char c);
34extern char prom_getchar(void); 34extern char prom_getchar(void);
35 35
36/* Generic printf() using ARCS console I/O. */
37extern void prom_printf(char *fmt, ...);
38
39/* Memory descriptor management. */ 36/* Memory descriptor management. */
40#define PROM_MAX_PMEMBLOCKS 32 37#define PROM_MAX_PMEMBLOCKS 32
41struct prom_pmemblock { 38struct prom_pmemblock {
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
index ddb859d05257..439bce7daa3a 100644
--- a/include/asm-mips/sgiarcs.h
+++ b/include/asm-mips/sgiarcs.h
@@ -459,7 +459,7 @@ struct linux_smonblock {
459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \ 459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \ 460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \ 461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
462 register signed int __a5 = (a5); \ 462 register signed int __a5 = (int) (long) (a5); \
463 long __vec = (long) romvec->dest; \ 463 long __vec = (long) romvec->dest; \
464 __asm__ __volatile__( \ 464 __asm__ __volatile__( \
465 "dsubu\t$29, 32\n\t" \ 465 "dsubu\t$29, 32\n\t" \
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h
index 42d4cf00efd3..c0d5206020fd 100644
--- a/include/asm-mips/sibyte/bcm1480_int.h
+++ b/include/asm-mips/sibyte/bcm1480_int.h
@@ -157,6 +157,7 @@
157 * Mask values for each interrupt 157 * Mask values for each interrupt
158 */ 158 */
159 159
160#define _BCM1480_INT_MASK(w,n) _SB_MAKEMASK(w,((n) & 0x3F))
160#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F)) 161#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
161#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6) 162#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
162 163
@@ -195,6 +196,7 @@
195#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH) 196#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
196#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW) 197#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
197#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH) 198#define M_BCM1480_INT_PMO_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_HIGH)
199#define M_BCM1480_INT_MBOX_ALL _BCM1480_INT_MASK(8,K_BCM1480_INT_MBOX_0_0)
198#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0) 200#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
199#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1) 201#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
200#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2) 202#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
index 6bdc941afc91..a6a437451da4 100644
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ b/include/asm-mips/sibyte/bcm1480_mc.h
@@ -382,6 +382,10 @@
382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10) 382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11) 383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
384 384
385#define M_BCM1480_MC_CS _SB_MAKEMASK(8,S_BCM1480_MC_CS0)
386#define V_BCM1480_MC_CS(x) _SB_MAKEVALUE(x,S_BCM1480_MC_CS0)
387#define G_BCM1480_MC_CS(x) _SB_GETVALUE(x,S_BCM1480_MC_CS0,M_BCM1480_MC_CS0)
388
385#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16) 389#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
386 390
387/* 391/*
@@ -412,6 +416,8 @@
412#define K_BCM1480_MC_DRAM_TYPE_DDR2 2 416#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
413#endif 417#endif
414 418
419#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0
420
415#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC) 421#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
416#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM) 422#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
417 423
@@ -511,6 +517,22 @@
511#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31) 517#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
512 518
513#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32) 519#define M_BCM1480_MC_CS_ODD_ODT_EN _SB_MAKEMASK1(32)
520
521#define S_BCM1480_MC_ODT0 0
522#define M_BCM1480_MC_ODT0 _SB_MAKEMASK(8,S_BCM1480_MC_ODT0)
523#define V_BCM1480_MC_ODT0(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT0)
524
525#define S_BCM1480_MC_ODT2 8
526#define M_BCM1480_MC_ODT2 _SB_MAKEMASK(8,S_BCM1480_MC_ODT2)
527#define V_BCM1480_MC_ODT2(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT2)
528
529#define S_BCM1480_MC_ODT4 16
530#define M_BCM1480_MC_ODT4 _SB_MAKEMASK(8,S_BCM1480_MC_ODT4)
531#define V_BCM1480_MC_ODT4(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT4)
532
533#define S_BCM1480_MC_ODT6 24
534#define M_BCM1480_MC_ODT6 _SB_MAKEMASK(8,S_BCM1480_MC_ODT6)
535#define V_BCM1480_MC_ODT6(x) _SB_MAKEVALUE(x,S_BCM1480_MC_ODT6)
514#endif 536#endif
515 537
516/* 538/*
@@ -588,11 +610,11 @@
588#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47) 610#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
589#endif 611#endif
590 612
591#define S_BCM1480_MC_DLL_DEFAULT 48 613#define S_BCM1480_MC_DLL_DEFAULT 48
592#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT) 614#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6,S_BCM1480_MC_DLL_DEFAULT)
593#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT) 615#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x,S_BCM1480_MC_DLL_DEFAULT)
594#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT) 616#define G_BCM1480_MC_DLL_DEFAULT(x) _SB_GETVALUE(x,S_BCM1480_MC_DLL_DEFAULT,M_BCM1480_MC_DLL_DEFAULT)
595#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10) 617#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
596 618
597#if SIBYTE_HDR_FEATURE(1480, PASS2) 619#if SIBYTE_HDR_FEATURE(1480, PASS2)
598#define S_BCM1480_MC_DLL_REGCTRL 54 620#define S_BCM1480_MC_DLL_REGCTRL 54
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
index c2dd2fe3047c..bda391d3af85 100644
--- a/include/asm-mips/sibyte/bcm1480_regs.h
+++ b/include/asm-mips/sibyte/bcm1480_regs.h
@@ -230,6 +230,7 @@
230 230
231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan)) 231#define A_BCM1480_DUART_IMRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_IMRREG(chan))
232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan)) 232#define A_BCM1480_DUART_ISRREG(chan) (A_BCM1480_DUART(chan) + R_BCM1480_DUART_ISRREG(chan))
233#define A_BCM1480_DUART_IN_PORT(chan) (A_BCM1480_DUART(chan) + R_DUART_INP_ORT)
233 234
234/* 235/*
235 * These constants are the absolute addresses. 236 * These constants are the absolute addresses.
@@ -404,6 +405,21 @@
404#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */ 405#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */
405#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */ 406#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */
406 407
408/*
409 * these macros work together to build the address of a mailbox
410 * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2)
411 * for mbox_0_set_cpu2 returns 0x00100240C8
412 */
413#define R_BCM1480_IMR_MAILBOX_CPU 0x00
414#define R_BCM1480_IMR_MAILBOX_SET 0x08
415#define R_BCM1480_IMR_MAILBOX_CLR 0x10
416#define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20
417#define A_BCM1480_MAILBOX_REGISTER(num,reg,cpu) \
418 (A_BCM1480_IMR_CPU0_BASE + \
419 (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \
420 (cpu * BCM1480_IMR_REGISTER_SPACING) + \
421 (R_BCM1480_IMR_MAILBOX_0_CPU + reg))
422
407/* ********************************************************************* 423/* *********************************************************************
408 * System Performance Counter Registers (Section 4.7) 424 * System Performance Counter Registers (Section 4.7)
409 ********************************************************************* */ 425 ********************************************************************* */
@@ -428,6 +444,10 @@
428#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500 444#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
429#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508 445#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
430 446
447#define BCM1480_SCD_NUM_PERF_CNT 8
448#define BCM1480_SCD_PERF_CNT_SPACING 8
449#define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING))
450
431/* ********************************************************************* 451/* *********************************************************************
432 * System Bus Watcher Registers (Section 4.8) 452 * System Bus Watcher Registers (Section 4.8)
433 ********************************************************************* */ 453 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h
index 648bed96780f..6111d6dcf117 100644
--- a/include/asm-mips/sibyte/bcm1480_scd.h
+++ b/include/asm-mips/sibyte/bcm1480_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -78,6 +78,7 @@
78#define K_SYS_PART_BCM1280 0x1206 78#define K_SYS_PART_BCM1280 0x1206
79#define K_SYS_PART_BCM1455 0x1407 79#define K_SYS_PART_BCM1455 0x1407
80#define K_SYS_PART_BCM1255 0x1257 80#define K_SYS_PART_BCM1255 0x1257
81#define K_SYS_PART_BCM1158 0x1156
81 82
82/* 83/*
83 * Manufacturing Information Register (Table 14) 84 * Manufacturing Information Register (Table 14)
@@ -237,58 +238,42 @@
237 * System Performance Counter Configuration Register (Table 31) 238 * System Performance Counter Configuration Register (Table 31)
238 * Register: PERF_CNT_CFG_0 239 * Register: PERF_CNT_CFG_0
239 * 240 *
240 * Since the clear/enable bits are moved compared to the 241 * SPC_CFG_SRC[0-3] is the same as the 1250.
241 * 1250 and there are more fields, this register will be BCM1480 specific. 242 * SPC_CFG_SRC[4-7] only exist on the 1480
243 * The clear/enable bits are in different locations on the 1250 and 1480.
242 */ 244 */
243 245
244#define S_BCM1480_SPC_CFG_SRC0 0 246#define S_SPC_CFG_SRC4 32
245#define M_BCM1480_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC0) 247#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_SPC_CFG_SRC4)
246#define V_BCM1480_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC0) 248#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC4)
247#define G_BCM1480_SPC_CFG_SRC0(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC0,M_BCM1480_SPC_CFG_SRC0) 249#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_SPC_CFG_SRC4,M_SPC_CFG_SRC4)
248 250
249#define S_BCM1480_SPC_CFG_SRC1 8 251#define S_SPC_CFG_SRC5 40
250#define M_BCM1480_SPC_CFG_SRC1 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC1) 252#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_SPC_CFG_SRC5)
251#define V_BCM1480_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC1) 253#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC5)
252#define G_BCM1480_SPC_CFG_SRC1(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC1,M_BCM1480_SPC_CFG_SRC1) 254#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_SPC_CFG_SRC5,M_SPC_CFG_SRC5)
253 255
254#define S_BCM1480_SPC_CFG_SRC2 16 256#define S_SPC_CFG_SRC6 48
255#define M_BCM1480_SPC_CFG_SRC2 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC2) 257#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_SPC_CFG_SRC6)
256#define V_BCM1480_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC2) 258#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC6)
257#define G_BCM1480_SPC_CFG_SRC2(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC2,M_BCM1480_SPC_CFG_SRC2) 259#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_SPC_CFG_SRC6,M_SPC_CFG_SRC6)
258 260
259#define S_BCM1480_SPC_CFG_SRC3 24 261#define S_SPC_CFG_SRC7 56
260#define M_BCM1480_SPC_CFG_SRC3 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC3) 262#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_SPC_CFG_SRC7)
261#define V_BCM1480_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC3) 263#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC7)
262#define G_BCM1480_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC3,M_BCM1480_SPC_CFG_SRC3) 264#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_SPC_CFG_SRC7,M_SPC_CFG_SRC7)
263
264#define S_BCM1480_SPC_CFG_SRC4 32
265#define M_BCM1480_SPC_CFG_SRC4 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC4)
266#define V_BCM1480_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC4)
267#define G_BCM1480_SPC_CFG_SRC4(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC4,M_BCM1480_SPC_CFG_SRC4)
268
269#define S_BCM1480_SPC_CFG_SRC5 40
270#define M_BCM1480_SPC_CFG_SRC5 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC5)
271#define V_BCM1480_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC5)
272#define G_BCM1480_SPC_CFG_SRC5(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC5,M_BCM1480_SPC_CFG_SRC5)
273
274#define S_BCM1480_SPC_CFG_SRC6 48
275#define M_BCM1480_SPC_CFG_SRC6 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC6)
276#define V_BCM1480_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC6)
277#define G_BCM1480_SPC_CFG_SRC6(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC6,M_BCM1480_SPC_CFG_SRC6)
278
279#define S_BCM1480_SPC_CFG_SRC7 56
280#define M_BCM1480_SPC_CFG_SRC7 _SB_MAKEMASK(8,S_BCM1480_SPC_CFG_SRC7)
281#define V_BCM1480_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x,S_BCM1480_SPC_CFG_SRC7)
282#define G_BCM1480_SPC_CFG_SRC7(x) _SB_GETVALUE(x,S_BCM1480_SPC_CFG_SRC7,M_BCM1480_SPC_CFG_SRC7)
283 265
284/* 266/*
285 * System Performance Counter Control Register (Table 32) 267 * System Performance Counter Control Register (Table 32)
286 * Register: PERF_CNT_CFG_1 268 * Register: PERF_CNT_CFG_1
287 * BCM1480 specific 269 * BCM1480 specific
288 */ 270 */
289 271#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
290#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0) 272#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1)
291#define M_BCM1480_SPC_CFG_ENABLE _SB_MAKEMASK1(1) 273#if SIBYTE_HDR_FEATURE_CHIP(1480)
274#define M_SPC_CFG_CLEAR M_BCM1480_SPC_CFG_CLEAR
275#define M_SPC_CFG_ENABLE M_BCM1480_SPC_CFG_ENABLE
276#endif
292 277
293/* 278/*
294 * System Performance Counters (Table 33) 279 * System Performance Counters (Table 33)
@@ -405,20 +390,10 @@
405 * Trace Control Register (Table 49) 390 * Trace Control Register (Table 49)
406 * Register: TRACE_CFG 391 * Register: TRACE_CFG
407 * 392 *
408 * Bits 0..8 are the same as the BCM1250, rest are different. 393 * BCM1480 changes to this register (other than location of the CUR_ADDR field)
409 * Entire register is redefined below. 394 * are defined below.
410 */ 395 */
411 396
412#define M_BCM1480_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
413#define M_BCM1480_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
414#define M_BCM1480_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
415#define M_BCM1480_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
416#define M_BCM1480_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
417#define M_BCM1480_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
418#define M_BCM1480_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
419#define M_BCM1480_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
420#define M_BCM1480_SCD_TRACE_CFG_FORCE_CNT _SB_MAKEMASK1(8)
421
422#define S_BCM1480_SCD_TRACE_CFG_MODE 16 397#define S_BCM1480_SCD_TRACE_CFG_MODE 16
423#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE) 398#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2,S_BCM1480_SCD_TRACE_CFG_MODE)
424#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE) 399#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_MODE)
@@ -428,9 +403,4 @@
428#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1 403#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
429#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2 404#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
430 405
431#define S_BCM1480_SCD_TRACE_CFG_CUR_ADDR 24
432#define M_BCM1480_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
433#define V_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
434#define G_BCM1480_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_BCM1480_SCD_TRACE_CFG_CUR_ADDR,M_BCM1480_SCD_TRACE_CFG_CUR_ADDR)
435
436#endif /* _BCM1480_SCD_H */ 406#endif /* _BCM1480_SCD_H */
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
index 3dfe29ed42a8..73bce901a378 100644
--- a/include/asm-mips/sibyte/board.h
+++ b/include/asm-mips/sibyte/board.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation 2 * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -19,8 +19,8 @@
19#ifndef _SIBYTE_BOARD_H 19#ifndef _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H 20#define _SIBYTE_BOARD_H
21 21
22
23#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \ 22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_PTSWARM) || \
23 defined(CONFIG_SIBYTE_PT1120) || defined(CONFIG_SIBYTE_PT1125) || \
24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \ 24 defined(CONFIG_SIBYTE_CRHONE) || defined(CONFIG_SIBYTE_CRHINE) || \
25 defined(CONFIG_SIBYTE_LITTLESUR) 25 defined(CONFIG_SIBYTE_LITTLESUR)
26#include <asm/sibyte/swarm.h> 26#include <asm/sibyte/swarm.h>
@@ -55,6 +55,16 @@
55#define setleds(t0,t1,c0,c1,c2,c3) 55#define setleds(t0,t1,c0,c1,c2,c3)
56#endif /* LEDS_PHYS */ 56#endif /* LEDS_PHYS */
57 57
58#else
59
60void swarm_setup(void);
61
62#ifdef LEDS_PHYS
63extern void setleds(char *str);
64#else
65#define setleds(s) do { } while (0)
66#endif /* LEDS_PHYS */
67
58#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
59 69
60#endif /* _SIBYTE_BOARD_H */ 70#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
index 57c53e62a37a..11cad71323e8 100644
--- a/include/asm-mips/sibyte/carmel.h
+++ b/include/asm-mips/sibyte/carmel.h
@@ -18,7 +18,6 @@
18#ifndef __ASM_SIBYTE_CARMEL_H 18#ifndef __ASM_SIBYTE_CARMEL_H
19#define __ASM_SIBYTE_CARMEL_H 19#define __ASM_SIBYTE_CARMEL_H
20 20
21
22#include <asm/sibyte/sb1250.h> 21#include <asm/sibyte/sb1250.h>
23#include <asm/sibyte/sb1250_int.h> 22#include <asm/sibyte/sb1250_int.h>
24 23
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index 2ba6988ddc8e..494aa65dcfbd 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -57,8 +57,6 @@ extern void bcm1480_mask_irq(int cpu, int irq);
57extern void bcm1480_unmask_irq(int cpu, int irq); 57extern void bcm1480_unmask_irq(int cpu, int irq);
58extern void bcm1480_smp_finish(void); 58extern void bcm1480_smp_finish(void);
59 59
60extern void prom_printf(char *fmt, ...);
61
62#define AT_spin \ 60#define AT_spin \
63 __asm__ __volatile__ ( \ 61 __asm__ __volatile__ ( \
64 ".set noat\n" \ 62 ".set noat\n" \
@@ -69,6 +67,6 @@ extern void prom_printf(char *fmt, ...);
69 67
70#endif 68#endif
71 69
72#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a))) 70#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
73 71
74#endif 72#endif
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
index 05c7b39f1b02..94e8299b0a2a 100644
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ b/include/asm-mips/sibyte/sb1250_int.h
@@ -45,8 +45,6 @@
45 * First, the interrupt numbers. 45 * First, the interrupt numbers.
46 */ 46 */
47 47
48#if SIBYTE_HDR_FEATURE_1250_112x
49
50#define K_INT_SOURCES 64 48#define K_INT_SOURCES 64
51 49
52#define K_INT_WATCHDOG_TIMER_0 0 50#define K_INT_WATCHDOG_TIMER_0 0
@@ -152,6 +150,7 @@
152#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1) 150#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
153#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2) 151#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
154#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3) 152#define M_INT_MBOX_3 _SB_MAKEMASK1(K_INT_MBOX_3)
153#define M_INT_MBOX_ALL _SB_MAKEMASK(4,K_INT_MBOX_0)
155#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
156#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT) 155#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
157#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT) 156#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
@@ -247,5 +246,3 @@
247 246
248 247
249#endif /* 1250/112x */ 248#endif /* 1250/112x */
250
251#endif
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
index adfc688fa559..833c8b59d687 100644
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ b/include/asm-mips/sibyte/sb1250_mac.h
@@ -129,9 +129,9 @@
129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42) 129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43) 130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
131 131
132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 132#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44) 133#define M_MAC_RX_CH_SEL_MSB _SB_MAKEMASK1(44)
134#endif /* 1250 PASS2 || 112x PASS1 */ 134#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
135 135
136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480) 136#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45) 137#define M_MAC_SPLIT_CH_SEL _SB_MAKEMASK1(45)
@@ -223,9 +223,9 @@
223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 223/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */ 224/* #define M_MAC_TX_WR_THRSH _SB_MAKEMASK(6,S_MAC_TX_WR_THRSH) */
225#endif /* up to 1250 PASS1 */ 225#endif /* up to 1250 PASS1 */
226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 226#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH) 227#define M_MAC_TX_WR_THRSH _SB_MAKEMASK(7,S_MAC_TX_WR_THRSH)
228#endif /* 1250 PASS2 || 112x PASS1 */ 228#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH) 229#define V_MAC_TX_WR_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_WR_THRSH)
230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH) 230#define G_MAC_TX_WR_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_WR_THRSH,M_MAC_TX_WR_THRSH)
231 231
@@ -234,9 +234,9 @@
234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */ 234/* XXX: Can't enable, as it has the same name as a pass2+ define below. */
235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */ 235/* #define M_MAC_TX_RD_THRSH _SB_MAKEMASK(6,S_MAC_TX_RD_THRSH) */
236#endif /* up to 1250 PASS1 */ 236#endif /* up to 1250 PASS1 */
237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 237#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH) 238#define M_MAC_TX_RD_THRSH _SB_MAKEMASK(7,S_MAC_TX_RD_THRSH)
239#endif /* 1250 PASS2 || 112x PASS1 */ 239#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH) 240#define V_MAC_TX_RD_THRSH(x) _SB_MAKEVALUE(x,S_MAC_TX_RD_THRSH)
241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH) 241#define G_MAC_TX_RD_THRSH(x) _SB_GETVALUE(x,S_MAC_TX_RD_THRSH,M_MAC_TX_RD_THRSH)
242 242
@@ -260,12 +260,12 @@
260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH) 260#define V_MAC_RX_RL_THRSH(x) _SB_MAKEVALUE(x,S_MAC_RX_RL_THRSH)
261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH) 261#define G_MAC_RX_RL_THRSH(x) _SB_GETVALUE(x,S_MAC_RX_RL_THRSH,M_MAC_RX_RL_THRSH)
262 262
263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 263#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56) 264#define S_MAC_ENC_FC_THRSH _SB_MAKE64(56)
265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH) 265#define M_MAC_ENC_FC_THRSH _SB_MAKEMASK(6,S_MAC_ENC_FC_THRSH)
266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH) 266#define V_MAC_ENC_FC_THRSH(x) _SB_MAKEVALUE(x,S_MAC_ENC_FC_THRSH)
267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH) 267#define G_MAC_ENC_FC_THRSH(x) _SB_GETVALUE(x,S_MAC_ENC_FC_THRSH,M_MAC_ENC_FC_THRSH)
268#endif /* 1250 PASS2 || 112x PASS1 */ 268#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
269 269
270/* 270/*
271 * MAC Frame Configuration Registers (Table 9-15) 271 * MAC Frame Configuration Registers (Table 9-15)
@@ -462,9 +462,9 @@
462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44) 462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44)
463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45) 463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45)
464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46) 464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46)
465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 465#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */ 466#define M_MAC_SPLIT_EN _SB_MAKEMASK1(47) /* interrupt mask only */
467#endif /* 1250 PASS2 || 112x PASS1 */ 467#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
468 468
469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47) 469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47)
470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR) 470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5,S_MAC_COUNTER_ADDR)
@@ -598,9 +598,9 @@
598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4) 598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4)
599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5) 599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5)
600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6) 600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6)
601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 601#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7) 602#define M_MAC_ALLMCAST_EN _SB_MAKEMASK1(7)
603#endif /* 1250 PASS2 || 112x PASS1 */ 603#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
604 604
605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8) 605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8)
606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET) 606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8,S_MAC_IPHDR_OFFSET)
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
index 26e421498c97..4fe848ffbc31 100644
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ b/include/asm-mips/sibyte/sb1250_mc.h
@@ -295,7 +295,7 @@
295 295
296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36) 297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(38) 298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37)
299#endif /* 1250 PASS3 || 112x PASS1 */ 299#endif /* 1250 PASS3 || 112x PASS1 */
300 300
301 301
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
index bab3a4580a36..da7c188993c9 100644
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ b/include/asm-mips/sibyte/sb1250_regs.h
@@ -131,6 +131,7 @@
131 131
132#endif 132#endif
133 133
134
134/* ********************************************************************* 135/* *********************************************************************
135 * PCI Interface Registers 136 * PCI Interface Registers
136 ********************************************************************* */ 137 ********************************************************************* */
@@ -239,14 +240,14 @@
239#define R_MAC_VLANTAG 0x00000110 240#define R_MAC_VLANTAG 0x00000110
240#define R_MAC_FRAMECFG 0x00000118 241#define R_MAC_FRAMECFG 0x00000118
241#define R_MAC_EOPCNT 0x00000120 242#define R_MAC_EOPCNT 0x00000120
242#define R_MAC_FIFO_PTRS 0x00000130 243#define R_MAC_FIFO_PTRS 0x00000128
243#define R_MAC_ADFILTER_CFG 0x00000200 244#define R_MAC_ADFILTER_CFG 0x00000200
244#define R_MAC_ETHERNET_ADDR 0x00000208 245#define R_MAC_ETHERNET_ADDR 0x00000208
245#define R_MAC_PKT_TYPE 0x00000210 246#define R_MAC_PKT_TYPE 0x00000210
246#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) 247#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
247#define R_MAC_ADMASK0 0x00000218 248#define R_MAC_ADMASK0 0x00000218
248#define R_MAC_ADMASK1 0x00000220 249#define R_MAC_ADMASK1 0x00000220
249#endif /* 1250 PASS3 || 112x PASS1 */ 250#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
250#define R_MAC_HASH_BASE 0x00000240 251#define R_MAC_HASH_BASE 0x00000240
251#define R_MAC_ADDR_BASE 0x00000280 252#define R_MAC_ADDR_BASE 0x00000280
252#define R_MAC_CHLO0_BASE 0x00000300 253#define R_MAC_CHLO0_BASE 0x00000300
@@ -256,9 +257,9 @@
256#define R_MAC_INT_MASK 0x00000410 257#define R_MAC_INT_MASK 0x00000410
257#define R_MAC_TXD_CTL 0x00000420 258#define R_MAC_TXD_CTL 0x00000420
258#define R_MAC_MDIO 0x00000428 259#define R_MAC_MDIO 0x00000428
259#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 260#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
260#define R_MAC_STATUS1 0x00000430 261#define R_MAC_STATUS1 0x00000430
261#endif /* 1250 PASS2 || 112x PASS1 */ 262#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
262#define R_MAC_DEBUG_STATUS 0x00000448 263#define R_MAC_DEBUG_STATUS 0x00000448
263 264
264#define MAC_HASH_COUNT 8 265#define MAC_HASH_COUNT 8
@@ -289,11 +290,11 @@
289#define R_DUART_RX_HOLD 0x160 290#define R_DUART_RX_HOLD 0x160
290#define R_DUART_TX_HOLD 0x170 291#define R_DUART_TX_HOLD 0x170
291 292
292#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 293#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
293#define R_DUART_FULL_CTL 0x140 294#define R_DUART_FULL_CTL 0x140
294#define R_DUART_OPCR_X 0x180 295#define R_DUART_OPCR_X 0x180
295#define R_DUART_AUXCTL_X 0x190 296#define R_DUART_AUXCTL_X 0x190
296#endif /* 1250 PASS2 || 112x PASS1 */ 297#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
297 298
298 299
299/* 300/*
@@ -308,6 +309,7 @@
308#define R_DUART_IMR_B 0x350 309#define R_DUART_IMR_B 0x350
309#define R_DUART_OUT_PORT 0x360 310#define R_DUART_OUT_PORT 0x360
310#define R_DUART_OPCR 0x370 311#define R_DUART_OPCR 0x370
312#define R_DUART_IN_PORT 0x380
311 313
312#define R_DUART_SET_OPR 0x3B0 314#define R_DUART_SET_OPR 0x3B0
313#define R_DUART_CLEAR_OPR 0x3C0 315#define R_DUART_CLEAR_OPR 0x3C0
@@ -685,12 +687,17 @@
685#define A_ADDR_TRAP_REG_DEBUG 0x0010020460 687#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
686#endif /* 1250 PASS2 || 112x PASS1 || 1480 */ 688#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
687 689
690#define ADDR_TRAP_SPACING 8
691#define NUM_ADDR_TRAP 4
692#define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING))
693#define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING))
694#define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING))
695
688 696
689/* ********************************************************************* 697/* *********************************************************************
690 * System Interrupt Mapper Registers 698 * System Interrupt Mapper Registers
691 ********************************************************************* */ 699 ********************************************************************* */
692 700
693#if SIBYTE_HDR_FEATURE_1250_112x
694#define A_IMR_CPU0_BASE 0x0010020000 701#define A_IMR_CPU0_BASE 0x0010020000
695#define A_IMR_CPU1_BASE 0x0010022000 702#define A_IMR_CPU1_BASE 0x0010022000
696#define IMR_REGISTER_SPACING 0x2000 703#define IMR_REGISTER_SPACING 0x2000
@@ -700,6 +707,7 @@
700#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg)) 707#define A_IMR_REGISTER(cpu,reg) (A_IMR_MAPPER(cpu)+(reg))
701 708
702#define R_IMR_INTERRUPT_DIAG 0x0010 709#define R_IMR_INTERRUPT_DIAG 0x0010
710#define R_IMR_INTERRUPT_LDT 0x0018
703#define R_IMR_INTERRUPT_MASK 0x0028 711#define R_IMR_INTERRUPT_MASK 0x0028
704#define R_IMR_INTERRUPT_TRACE 0x0038 712#define R_IMR_INTERRUPT_TRACE 0x0038
705#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040 713#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
@@ -715,7 +723,14 @@
715#define R_IMR_INTERRUPT_STATUS_COUNT 7 723#define R_IMR_INTERRUPT_STATUS_COUNT 7
716#define R_IMR_INTERRUPT_MAP_BASE 0x0200 724#define R_IMR_INTERRUPT_MAP_BASE 0x0200
717#define R_IMR_INTERRUPT_MAP_COUNT 64 725#define R_IMR_INTERRUPT_MAP_COUNT 64
718#endif /* 1250/112x */ 726
727/*
728 * these macros work together to build the address of a mailbox
729 * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1)
730 * for mbox_0_set_cpu2 returns 0x00100240C8
731 */
732#define A_MAILBOX_REGISTER(reg,cpu) \
733 (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg)
719 734
720/* ********************************************************************* 735/* *********************************************************************
721 * System Performance Counter Registers 736 * System Performance Counter Registers
@@ -727,6 +742,10 @@
727#define A_SCD_PERF_CNT_2 0x00100204E0 742#define A_SCD_PERF_CNT_2 0x00100204E0
728#define A_SCD_PERF_CNT_3 0x00100204E8 743#define A_SCD_PERF_CNT_3 0x00100204E8
729 744
745#define SCD_NUM_PERF_CNT 4
746#define SCD_PERF_CNT_SPACING 8
747#define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING))
748
730/* ********************************************************************* 749/* *********************************************************************
731 * System Bus Watcher Registers 750 * System Bus Watcher Registers
732 ********************************************************************* */ 751 ********************************************************************* */
@@ -772,6 +791,15 @@
772#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90 791#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
773#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98 792#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
774 793
794#define TRACE_REGISTER_SPACING 8
795#define TRACE_NUM_REGISTERS 8
796#define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \
797 (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
798 (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING)))
799#define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \
800 (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
801 (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING)))
802
775/* ********************************************************************* 803/* *********************************************************************
776 * System Generic DMA Registers 804 * System Generic DMA Registers
777 ********************************************************************* */ 805 ********************************************************************* */
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
index 7ed0bb611e56..9ea3da367ab6 100644
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ b/include/asm-mips/sibyte/sb1250_scd.h
@@ -10,7 +10,7 @@
10 * 10 *
11 ********************************************************************* 11 *********************************************************************
12 * 12 *
13 * Copyright 2000,2001,2002,2003 13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved. 14 * Broadcom Corporation. All rights reserved.
15 * 15 *
16 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
@@ -84,6 +84,7 @@
84#define K_SYS_REVISION_BCM112x_A2 0x21 84#define K_SYS_REVISION_BCM112x_A2 0x21
85#define K_SYS_REVISION_BCM112x_A3 0x22 85#define K_SYS_REVISION_BCM112x_A3 0x22
86#define K_SYS_REVISION_BCM112x_A4 0x23 86#define K_SYS_REVISION_BCM112x_A4 0x23
87#define K_SYS_REVISION_BCM112x_B0 0x30
87 88
88#define K_SYS_REVISION_BCM1480_S0 0x01 89#define K_SYS_REVISION_BCM1480_S0 0x01
89#define K_SYS_REVISION_BCM1480_A1 0x02 90#define K_SYS_REVISION_BCM1480_A1 0x02
@@ -149,7 +150,7 @@
149 * (For the assembler version, sysrev and dest may be the same register. 150 * (For the assembler version, sysrev and dest may be the same register.
150 * Also, it clobbers AT.) 151 * Also, it clobbers AT.)
151 */ 152 */
152#ifdef __ASSEMBLY__ 153#ifdef __ASSEMBLER__
153#define SYS_SOC_TYPE(dest, sysrev) \ 154#define SYS_SOC_TYPE(dest, sysrev) \
154 .set push ; \ 155 .set push ; \
155 .set reorder ; \ 156 .set reorder ; \
@@ -213,6 +214,7 @@
213#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS) 214#define G_SYS_YPOS(x) _SB_GETVALUE(x,S_SYS_YPOS,M_SYS_YPOS)
214#endif 215#endif
215 216
217
216/* 218/*
217 * System Config Register (Table 4-2) 219 * System Config Register (Table 4-2)
218 * Register: SCD_SYSTEM_CFG 220 * Register: SCD_SYSTEM_CFG
@@ -359,13 +361,13 @@
359 */ 361 */
360 362
361#define V_SCD_TIMER_FREQ 1000000 363#define V_SCD_TIMER_FREQ 1000000
362#define V_SCD_TIMER_WIDTH 23
363 364
364#define S_SCD_TIMER_INIT 0 365#define S_SCD_TIMER_INIT 0
365#define M_SCD_TIMER_INIT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_INIT) 366#define M_SCD_TIMER_INIT _SB_MAKEMASK(23,S_SCD_TIMER_INIT)
366#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT) 367#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_INIT)
367#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT) 368#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x,S_SCD_TIMER_INIT,M_SCD_TIMER_INIT)
368 369
370#define V_SCD_TIMER_WIDTH 23
369#define S_SCD_TIMER_CNT 0 371#define S_SCD_TIMER_CNT 0
370#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT) 372#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH,S_SCD_TIMER_CNT)
371#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT) 373#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x,S_SCD_TIMER_CNT)
@@ -379,7 +381,6 @@
379 * System Performance Counters 381 * System Performance Counters
380 */ 382 */
381 383
382#if SIBYTE_HDR_FEATURE_1250_112x
383#define S_SPC_CFG_SRC0 0 384#define S_SPC_CFG_SRC0 0
384#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0) 385#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8,S_SPC_CFG_SRC0)
385#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0) 386#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC0)
@@ -400,6 +401,7 @@
400#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3) 401#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x,S_SPC_CFG_SRC3)
401#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3) 402#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x,S_SPC_CFG_SRC3,M_SPC_CFG_SRC3)
402 403
404#if SIBYTE_HDR_FEATURE_1250_112x
403#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32) 405#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
404#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33) 406#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
405#endif 407#endif
@@ -515,8 +517,6 @@
515 * Trace Buffer Config register 517 * Trace Buffer Config register
516 */ 518 */
517 519
518#if SIBYTE_HDR_FEATURE_1250_112x
519
520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0) 520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1) 521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2) 522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
@@ -525,17 +525,26 @@
525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5) 525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6) 526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7) 527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
528#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) 528#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
529#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8) 529#define M_SCD_TRACE_CFG_FORCECNT _SB_MAKEMASK1(8)
530#endif /* 1250 PASS2 || 112x PASS1 */ 530#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
531 531
532/*
533 * This field is the same on the 1250/112x and 1480, just located in
534 * a slightly different place in the register.
535 */
536#if SIBYTE_HDR_FEATURE_1250_112x
532#define S_SCD_TRACE_CFG_CUR_ADDR 10 537#define S_SCD_TRACE_CFG_CUR_ADDR 10
538#else
539#if SIBYTE_HDR_FEATURE_CHIP(1480)
540#define S_SCD_TRACE_CFG_CUR_ADDR 24
541#endif /* 1480 */
542#endif /* 1250/112x */
543
533#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR) 544#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8,S_SCD_TRACE_CFG_CUR_ADDR)
534#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR) 545#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR)
535#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR) 546#define G_SCD_TRACE_CFG_CUR_ADDR(x) _SB_GETVALUE(x,S_SCD_TRACE_CFG_CUR_ADDR,M_SCD_TRACE_CFG_CUR_ADDR)
536 547
537#endif /* 1250/112x */
538
539/* 548/*
540 * Trace Event registers 549 * Trace Event registers
541 */ 550 */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
index 86db37e5ad85..540865fa7ec3 100644
--- a/include/asm-mips/sibyte/swarm.h
+++ b/include/asm-mips/sibyte/swarm.h
@@ -32,6 +32,18 @@
32#define SIBYTE_HAVE_IDE 1 32#define SIBYTE_HAVE_IDE 1
33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200" 33#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
34#endif 34#endif
35#ifdef CONFIG_SIBYTE_PT1120
36#define SIBYTE_BOARD_NAME "PT1120"
37#define SIBYTE_HAVE_PCMCIA 1
38#define SIBYTE_HAVE_IDE 1
39#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
40#endif
41#ifdef CONFIG_SIBYTE_PT1125
42#define SIBYTE_BOARD_NAME "PT1125"
43#define SIBYTE_HAVE_PCMCIA 1
44#define SIBYTE_HAVE_IDE 1
45#define SIBYTE_DEFAULT_CONSOLE "ttyS0,115200"
46#endif
35#ifdef CONFIG_SIBYTE_LITTLESUR 47#ifdef CONFIG_SIBYTE_LITTLESUR
36#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)" 48#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
37#define SIBYTE_HAVE_PCMCIA 0 49#define SIBYTE_HAVE_PCMCIA 0
diff --git a/include/asm-mips/sibyte/trace_prof.h b/include/asm-mips/sibyte/trace_prof.h
deleted file mode 100644
index 557792075e9a..000000000000
--- a/include/asm-mips/sibyte/trace_prof.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * Copyright (C) 2001 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 __ASM_SIBYTE_TRACE_PROF_H
20#define __ASM_SIBYTE_TRACE_PROF_H
21
22#undef DBG
23#if SBPROF_TB_DEBUG
24#define DBG(a) a
25#else
26#define DBG(a)
27#endif
28
29#define SBPROF_TB_MAJOR 240
30#define DEVNAME "bcm1250_tbprof"
31
32typedef u_int64_t tb_sample_t[6*256];
33
34struct sbprof_tb {
35 int open;
36 tb_sample_t *sbprof_tbbuf;
37 int next_tb_sample;
38
39 volatile int tb_enable;
40 volatile int tb_armed;
41
42 wait_queue_head_t tb_sync;
43 wait_queue_head_t tb_read;
44};
45
46#define MAX_SAMPLE_BYTES (24*1024*1024)
47#define MAX_TBSAMPLE_BYTES (12*1024*1024)
48
49#define MAX_SAMPLES (MAX_SAMPLE_BYTES/sizeof(u_int32_t))
50#define TB_SAMPLE_SIZE (sizeof(tb_sample_t))
51#define MAX_TB_SAMPLES (MAX_TBSAMPLE_BYTES/TB_SAMPLE_SIZE)
52
53/* IOCTLs */
54#define SBPROF_ZBSTART _IOW('s', 0, int)
55#define SBPROF_ZBSTOP _IOW('s', 1, int)
56#define SBPROF_ZBWAITFULL _IOW('s', 2, int)
57
58/***************************************************************************
59 * Routines for gathering ZBbus profiles using trace buffer
60 ***************************************************************************/
61
62/* Requires: Already called zclk_timer_init with a value that won't
63 saturate 40 bits. No subsequent use of SCD performance counters
64 or trace buffer.
65 Effect: Starts gathering random ZBbus profiles using trace buffer. */
66extern int sbprof_zbprof_start(struct file *filp);
67
68/* Effect: Stops collection of ZBbus profiles */
69extern int sbprof_zbprof_stop(void);
70
71
72/***************************************************************************
73 * Routines for using 40-bit SCD cycle counter
74 *
75 * Client responsible for either handling interrupts or making sure
76 * the cycles counter never saturates, e.g., by doing
77 * zclk_timer_init(0) at least every 2^40 - 1 ZCLKs.
78 ***************************************************************************/
79
80/* Configures SCD counter 0 to count ZCLKs starting from val;
81 Configures SCD counters1,2,3 to count nothing.
82 Must not be called while gathering ZBbus profiles.
83
84unsigned long long val; */
85#define zclk_timer_init(val) \
86 __asm__ __volatile__ (".set push;" \
87 ".set mips64;" \
88 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
89 "sd %0, 0x10($8);" /* write val to counter0 */ \
90 "sd %1, 0($8);" /* config counter0 for zclks*/ \
91 ".set pop" \
92 : /* no outputs */ \
93 /* enable, counter0 */ \
94 : /* inputs */ "r"(val), "r" ((1ULL << 33) | 1ULL) \
95 : /* modifies */ "$8" )
96
97
98/* Reads SCD counter 0 and puts result in value
99 unsigned long long val; */
100#define zclk_get(val) \
101 __asm__ __volatile__ (".set push;" \
102 ".set mips64;" \
103 "la $8, 0xb00204c0;" /* SCD perf_cnt_cfg */ \
104 "ld %0, 0x10($8);" /* write val to counter0 */ \
105 ".set pop" \
106 : /* outputs */ "=r"(val) \
107 : /* inputs */ \
108 : /* modifies */ "$8" )
109
110#endif /* __ASM_SIBYTE_TRACE_PROF_H */
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
index cefa657dd04a..9ce0607d7a4e 100644
--- a/include/asm-mips/sigcontext.h
+++ b/include/asm-mips/sigcontext.h
@@ -19,11 +19,11 @@
19 */ 19 */
20struct sigcontext { 20struct sigcontext {
21 unsigned int sc_regmask; /* Unused */ 21 unsigned int sc_regmask; /* Unused */
22 unsigned int sc_status; 22 unsigned int sc_status; /* Unused */
23 unsigned long long sc_pc; 23 unsigned long long sc_pc;
24 unsigned long long sc_regs[32]; 24 unsigned long long sc_regs[32];
25 unsigned long long sc_fpregs[32]; 25 unsigned long long sc_fpregs[32];
26 unsigned int sc_ownedfp; /* Unused */ 26 unsigned int sc_acx; /* Was sc_ownedfp */
27 unsigned int sc_fpc_csr; 27 unsigned int sc_fpc_csr;
28 unsigned int sc_fpc_eir; /* Unused */ 28 unsigned int sc_fpc_eir; /* Unused */
29 unsigned int sc_used_math; 29 unsigned int sc_used_math;
@@ -42,6 +42,7 @@ struct sigcontext {
42 42
43#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 43#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
44 44
45#include <linux/posix_types.h>
45/* 46/*
46 * Keep this struct definition in sync with the sigcontext fragment 47 * Keep this struct definition in sync with the sigcontext fragment
47 * in arch/mips/tools/offset.c 48 * in arch/mips/tools/offset.c
@@ -53,34 +54,32 @@ struct sigcontext {
53 * entries, add sc_dsp and sc_reserved for padding. No prisoners. 54 * entries, add sc_dsp and sc_reserved for padding. No prisoners.
54 */ 55 */
55struct sigcontext { 56struct sigcontext {
56 unsigned long sc_regs[32]; 57 __u64 sc_regs[32];
57 unsigned long sc_fpregs[32]; 58 __u64 sc_fpregs[32];
58 unsigned long sc_mdhi; 59 __u64 sc_mdhi;
59 unsigned long sc_hi1; 60 __u64 sc_hi1;
60 unsigned long sc_hi2; 61 __u64 sc_hi2;
61 unsigned long sc_hi3; 62 __u64 sc_hi3;
62 unsigned long sc_mdlo; 63 __u64 sc_mdlo;
63 unsigned long sc_lo1; 64 __u64 sc_lo1;
64 unsigned long sc_lo2; 65 __u64 sc_lo2;
65 unsigned long sc_lo3; 66 __u64 sc_lo3;
66 unsigned long sc_pc; 67 __u64 sc_pc;
67 unsigned int sc_fpc_csr; 68 __u32 sc_fpc_csr;
68 unsigned int sc_used_math; 69 __u32 sc_used_math;
69 unsigned int sc_dsp; 70 __u32 sc_dsp;
70 unsigned int sc_reserved; 71 __u32 sc_reserved;
71}; 72};
72 73
73#ifdef __KERNEL__ 74#ifdef __KERNEL__
74 75
75#include <linux/posix_types.h>
76
77struct sigcontext32 { 76struct sigcontext32 {
78 __u32 sc_regmask; /* Unused */ 77 __u32 sc_regmask; /* Unused */
79 __u32 sc_status; 78 __u32 sc_status; /* Unused */
80 __u64 sc_pc; 79 __u64 sc_pc;
81 __u64 sc_regs[32]; 80 __u64 sc_regs[32];
82 __u64 sc_fpregs[32]; 81 __u64 sc_fpregs[32];
83 __u32 sc_ownedfp; /* Unused */ 82 __u32 sc_acx; /* Only MIPS32; was sc_ownedfp */
84 __u32 sc_fpc_csr; 83 __u32 sc_fpc_csr;
85 __u32 sc_fpc_eir; /* Unused */ 84 __u32 sc_fpc_eir; /* Unused */
86 __u32 sc_used_math; 85 __u32 sc_used_math;
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
index 8b391a2f0814..7a28989f7ee3 100644
--- a/include/asm-mips/signal.h
+++ b/include/asm-mips/signal.h
@@ -137,23 +137,6 @@ typedef struct sigaltstack {
137 137
138#define ptrace_signal_deliver(regs, cookie) do { } while (0) 138#define ptrace_signal_deliver(regs, cookie) do { } while (0)
139 139
140struct pt_regs;
141extern void do_signal(struct pt_regs *regs);
142extern void do_signal32(struct pt_regs *regs);
143
144extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
145 int signr, sigset_t *set);
146extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
147 int signr, sigset_t *set, siginfo_t *info);
148
149extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
150 int signr, sigset_t *set);
151extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
152 int signr, sigset_t *set, siginfo_t *info);
153
154extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
155 int signr, sigset_t *set, siginfo_t *info);
156
157#endif /* __KERNEL__ */ 140#endif /* __KERNEL__ */
158 141
159#endif /* _ASM_SIGNAL_H */ 142#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mips/smtc.h b/include/asm-mips/smtc.h
index e1941d1b8726..44dfa4adecf3 100644
--- a/include/asm-mips/smtc.h
+++ b/include/asm-mips/smtc.h
@@ -34,6 +34,9 @@ typedef long asiduse;
34 34
35extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; 35extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
36 36
37struct mm_struct;
38struct task_struct;
39
37void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu); 40void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
38 41
39void smtc_flush_tlb_asid(unsigned long asid); 42void smtc_flush_tlb_asid(unsigned long asid);
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
index f22c3e2f993a..a52a4a7a36e0 100644
--- a/include/asm-mips/smtc_ipi.h
+++ b/include/asm-mips/smtc_ipi.h
@@ -4,6 +4,8 @@
4#ifndef __ASM_SMTC_IPI_H 4#ifndef __ASM_SMTC_IPI_H
5#define __ASM_SMTC_IPI_H 5#define __ASM_SMTC_IPI_H
6 6
7#include <linux/spinlock.h>
8
7//#define SMTC_IPI_DEBUG 9//#define SMTC_IPI_DEBUG
8 10
9#ifdef SMTC_IPI_DEBUG 11#ifdef SMTC_IPI_DEBUG
@@ -44,9 +46,6 @@ struct smtc_ipi_q {
44 int depth; 46 int depth;
45}; 47};
46 48
47extern struct smtc_ipi_q IPIQ[NR_CPUS];
48extern struct smtc_ipi_q freeIPIq;
49
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p) 49static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51{ 50{
52 long flags; 51 long flags;
@@ -66,12 +65,10 @@ static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
66 spin_unlock_irqrestore(&q->lock, flags); 65 spin_unlock_irqrestore(&q->lock, flags);
67} 66}
68 67
69static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q) 68static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
70{ 69{
71 struct smtc_ipi *p; 70 struct smtc_ipi *p;
72 long flags;
73 71
74 spin_lock_irqsave(&q->lock, flags);
75 if (q->head == NULL) 72 if (q->head == NULL)
76 p = NULL; 73 p = NULL;
77 else { 74 else {
@@ -82,7 +79,19 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
82 if (q->head == NULL) 79 if (q->head == NULL)
83 q->tail = NULL; 80 q->tail = NULL;
84 } 81 }
82
83 return p;
84}
85
86static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
87{
88 unsigned long flags;
89 struct smtc_ipi *p;
90
91 spin_lock_irqsave(&q->lock, flags);
92 p = __smtc_ipi_dq(q);
85 spin_unlock_irqrestore(&q->lock, flags); 93 spin_unlock_irqrestore(&q->lock, flags);
94
86 return p; 95 return p;
87} 96}
88 97
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index b9ba54d0dd35..f257509b914f 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -6,12 +6,72 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1997, 1998 by Ralf Baechle 8 * Copyright (C) 1997, 1998 by Ralf Baechle
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
9 */ 10 */
10#ifndef __ASM_SNI_H 11#ifndef __ASM_SNI_H
11#define __ASM_SNI_H 12#define __ASM_SNI_H
12 13
14extern unsigned int sni_brd_type;
15
16#define SNI_BRD_10 2
17#define SNI_BRD_10NEW 3
18#define SNI_BRD_TOWER_OASIC 4
19#define SNI_BRD_MINITOWER 5
20#define SNI_BRD_PCI_TOWER 6
21#define SNI_BRD_RM200 7
22#define SNI_BRD_PCI_MTOWER 8
23#define SNI_BRD_PCI_DESKTOP 9
24#define SNI_BRD_PCI_TOWER_CPLUS 10
25#define SNI_BRD_PCI_MTOWER_CPLUS 11
26
27/* RM400 cpu types */
28#define SNI_CPU_M8021 0x01
29#define SNI_CPU_M8030 0x04
30#define SNI_CPU_M8031 0x06
31#define SNI_CPU_M8034 0x0f
32#define SNI_CPU_M8037 0x07
33#define SNI_CPU_M8040 0x05
34#define SNI_CPU_M8043 0x09
35#define SNI_CPU_M8050 0x0b
36#define SNI_CPU_M8053 0x0d
37
13#define SNI_PORT_BASE 0xb4000000 38#define SNI_PORT_BASE 0xb4000000
14 39
40#ifndef __MIPSEL__
41/*
42 * ASIC PCI registers for big endian configuration.
43 */
44#define PCIMT_UCONF 0xbfff0004
45#define PCIMT_IOADTIMEOUT2 0xbfff000c
46#define PCIMT_IOMEMCONF 0xbfff0014
47#define PCIMT_IOMMU 0xbfff001c
48#define PCIMT_IOADTIMEOUT1 0xbfff0024
49#define PCIMT_DMAACCESS 0xbfff002c
50#define PCIMT_DMAHIT 0xbfff0034
51#define PCIMT_ERRSTATUS 0xbfff003c
52#define PCIMT_ERRADDR 0xbfff0044
53#define PCIMT_SYNDROME 0xbfff004c
54#define PCIMT_ITPEND 0xbfff0054
55#define IT_INT2 0x01
56#define IT_INTD 0x02
57#define IT_INTC 0x04
58#define IT_INTB 0x08
59#define IT_INTA 0x10
60#define IT_EISA 0x20
61#define IT_SCSI 0x40
62#define IT_ETH 0x80
63#define PCIMT_IRQSEL 0xbfff005c
64#define PCIMT_TESTMEM 0xbfff0064
65#define PCIMT_ECCREG 0xbfff006c
66#define PCIMT_CONFIG_ADDRESS 0xbfff0074
67#define PCIMT_ASIC_ID 0xbfff007c /* read */
68#define PCIMT_SOFT_RESET 0xbfff007c /* write */
69#define PCIMT_PIA_OE 0xbfff0084
70#define PCIMT_PIA_DATAOUT 0xbfff008c
71#define PCIMT_PIA_DATAIN 0xbfff0094
72#define PCIMT_CACHECONF 0xbfff009c
73#define PCIMT_INVSPACE 0xbfff00a4
74#else
15/* 75/*
16 * ASIC PCI registers for little endian configuration. 76 * ASIC PCI registers for little endian configuration.
17 */ 77 */
@@ -45,6 +105,8 @@
45#define PCIMT_PIA_DATAIN 0xbfff0090 105#define PCIMT_PIA_DATAIN 0xbfff0090
46#define PCIMT_CACHECONF 0xbfff0098 106#define PCIMT_CACHECONF 0xbfff0098
47#define PCIMT_INVSPACE 0xbfff00a0 107#define PCIMT_INVSPACE 0xbfff00a0
108#endif
109
48#define PCIMT_PCI_CONF 0xbfff0100 110#define PCIMT_PCI_CONF 0xbfff0100
49 111
50/* 112/*
@@ -73,6 +135,35 @@
73#define PCIMT_PWDN 0xbfdf0000 135#define PCIMT_PWDN 0xbfdf0000
74 136
75/* 137/*
138 * A20R based boards
139 */
140#define A20R_PT_CLOCK_BASE 0xbc040000
141#define A20R_PT_TIM0_ACK 0xbc050000
142#define A20R_PT_TIM1_ACK 0xbc060000
143
144#define SNI_MIPS_IRQ_CPU_TIMER (MIPS_CPU_IRQ_BASE+7)
145
146#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
147#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
148
149#define SNI_DS1216_A20R_BASE 0xbc081ffc
150#define SNI_DS1216_RM200_BASE 0xbcd41ffc
151
152#define SNI_PCIT_INT_REG 0xbfff000c
153
154#define SNI_PCIT_INT_START 24
155#define SNI_PCIT_INT_END 30
156
157#define PCIT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE + 5)
158#define PCIT_IRQ_INTA (SNI_PCIT_INT_START + 0)
159#define PCIT_IRQ_INTB (SNI_PCIT_INT_START + 1)
160#define PCIT_IRQ_INTC (SNI_PCIT_INT_START + 2)
161#define PCIT_IRQ_INTD (SNI_PCIT_INT_START + 3)
162#define PCIT_IRQ_SCSI0 (SNI_PCIT_INT_START + 4)
163#define PCIT_IRQ_SCSI1 (SNI_PCIT_INT_START + 5)
164
165
166/*
76 * Interrupt 0-16 are EISA interrupts. Interrupts from 16 on are assigned 167 * Interrupt 0-16 are EISA interrupts. Interrupts from 16 on are assigned
77 * to the other interrupts generated by ASIC PCI. 168 * to the other interrupts generated by ASIC PCI.
78 * 169 *
@@ -80,18 +171,22 @@
80 * ASIC PCI interrupt. 171 * ASIC PCI interrupt.
81 */ 172 */
82#define PCIMT_KEYBOARD_IRQ 1 173#define PCIMT_KEYBOARD_IRQ 1
83#define PCIMT_IRQ_INT2 16 174#define PCIMT_IRQ_INT2 24
84#define PCIMT_IRQ_INTD 17 175#define PCIMT_IRQ_INTD 25
85#define PCIMT_IRQ_INTC 18 176#define PCIMT_IRQ_INTC 26
86#define PCIMT_IRQ_INTB 19 177#define PCIMT_IRQ_INTB 27
87#define PCIMT_IRQ_INTA 20 178#define PCIMT_IRQ_INTA 28
88#define PCIMT_IRQ_EISA 21 179#define PCIMT_IRQ_EISA 29
89#define PCIMT_IRQ_SCSI 22 180#define PCIMT_IRQ_SCSI 30
90#define PCIMT_IRQ_ETHERNET 23 181
182#define PCIMT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE+6)
183
184#if 0
91#define PCIMT_IRQ_TEMPERATURE 24 185#define PCIMT_IRQ_TEMPERATURE 24
92#define PCIMT_IRQ_EISA_NMI 25 186#define PCIMT_IRQ_EISA_NMI 25
93#define PCIMT_IRQ_POWER_OFF 26 187#define PCIMT_IRQ_POWER_OFF 26
94#define PCIMT_IRQ_BUTTON 27 188#define PCIMT_IRQ_BUTTON 27
189#endif
95 190
96/* 191/*
97 * Base address for the mapped 16mb EISA bus segment. 192 * Base address for the mapped 16mb EISA bus segment.
@@ -101,4 +196,24 @@
101/* PCI EISA Interrupt acknowledge */ 196/* PCI EISA Interrupt acknowledge */
102#define PCIMT_INT_ACKNOWLEDGE 0xba000000 197#define PCIMT_INT_ACKNOWLEDGE 0xba000000
103 198
199/* board specific init functions */
200extern void sni_a20r_init (void);
201extern void sni_pcit_init (void);
202extern void sni_rm200_init (void);
203extern void sni_pcimt_init (void);
204
205/* board specific irq init functions */
206extern void sni_a20r_irq_init (void);
207extern void sni_pcit_irq_init (void);
208extern void sni_pcit_cplus_irq_init (void);
209extern void sni_rm200_irq_init (void);
210extern void sni_pcimt_irq_init (void);
211
212/* timer inits */
213extern void sni_cpu_time_init(void);
214
215/* common irq stuff */
216extern void (*sni_hwint)(void);
217extern struct irqaction sni_isa_irq;
218
104#endif /* __ASM_SNI_H */ 219#endif /* __ASM_SNI_H */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 36ebe4e186a7..95945689b1c6 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -70,6 +70,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
70#define SO_SNDBUFFORCE 31 70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33 71#define SO_RCVBUFFORCE 33
72#define SO_PASSSEC 34 72#define SO_PASSSEC 34
73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
73 75
74#ifdef __KERNEL__ 76#ifdef __KERNEL__
75 77
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h
index 87a50bf039ed..ed1a5f78d22f 100644
--- a/include/asm-mips/sockios.h
+++ b/include/asm-mips/sockios.h
@@ -20,6 +20,7 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 23#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
24#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
24 25
25#endif /* _ASM_SOCKIOS_H */ 26#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index fc3217fc1118..35e431cd796b 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1999, 2000, 06 by Ralf Baechle 6 * Copyright (C) 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */ 8 */
9#ifndef _ASM_SPINLOCK_H 9#ifndef _ASM_SPINLOCK_H
@@ -49,11 +49,18 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
49 __asm__ __volatile__( 49 __asm__ __volatile__(
50 " .set noreorder # __raw_spin_lock \n" 50 " .set noreorder # __raw_spin_lock \n"
51 "1: ll %1, %2 \n" 51 "1: ll %1, %2 \n"
52 " bnez %1, 1b \n" 52 " bnez %1, 2f \n"
53 " li %1, 1 \n" 53 " li %1, 1 \n"
54 " sc %1, %0 \n" 54 " sc %1, %0 \n"
55 " beqz %1, 1b \n" 55 " beqz %1, 2f \n"
56 " nop \n" 56 " nop \n"
57 " .subsection 2 \n"
58 "2: ll %1, %2 \n"
59 " bnez %1, 2b \n"
60 " li %1, 1 \n"
61 " b 1b \n"
62 " nop \n"
63 " .previous \n"
57 " .set reorder \n" 64 " .set reorder \n"
58 : "=m" (lock->lock), "=&r" (tmp) 65 : "=m" (lock->lock), "=&r" (tmp)
59 : "m" (lock->lock) 66 : "m" (lock->lock)
@@ -99,8 +106,12 @@ static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
99 "1: ll %0, %3 \n" 106 "1: ll %0, %3 \n"
100 " ori %2, %0, 1 \n" 107 " ori %2, %0, 1 \n"
101 " sc %2, %1 \n" 108 " sc %2, %1 \n"
102 " beqz %2, 1b \n" 109 " beqz %2, 2f \n"
103 " andi %2, %0, 1 \n" 110 " andi %2, %0, 1 \n"
111 " .subsection 2 \n"
112 "2: b 1b \n"
113 " nop \n"
114 " .previous \n"
104 " .set reorder" 115 " .set reorder"
105 : "=&r" (temp), "=m" (lock->lock), "=&r" (res) 116 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
106 : "m" (lock->lock) 117 : "m" (lock->lock)
@@ -154,11 +165,18 @@ static inline void __raw_read_lock(raw_rwlock_t *rw)
154 __asm__ __volatile__( 165 __asm__ __volatile__(
155 " .set noreorder # __raw_read_lock \n" 166 " .set noreorder # __raw_read_lock \n"
156 "1: ll %1, %2 \n" 167 "1: ll %1, %2 \n"
157 " bltz %1, 1b \n" 168 " bltz %1, 2f \n"
158 " addu %1, 1 \n" 169 " addu %1, 1 \n"
159 " sc %1, %0 \n" 170 " sc %1, %0 \n"
160 " beqz %1, 1b \n" 171 " beqz %1, 1b \n"
161 " nop \n" 172 " nop \n"
173 " .subsection 2 \n"
174 "2: ll %1, %2 \n"
175 " bltz %1, 2b \n"
176 " addu %1, 1 \n"
177 " b 1b \n"
178 " nop \n"
179 " .previous \n"
162 " .set reorder \n" 180 " .set reorder \n"
163 : "=m" (rw->lock), "=&r" (tmp) 181 : "=m" (rw->lock), "=&r" (tmp)
164 : "m" (rw->lock) 182 : "m" (rw->lock)
@@ -192,8 +210,12 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
192 "1: ll %1, %2 \n" 210 "1: ll %1, %2 \n"
193 " sub %1, 1 \n" 211 " sub %1, 1 \n"
194 " sc %1, %0 \n" 212 " sc %1, %0 \n"
195 " beqz %1, 1b \n" 213 " beqz %1, 2f \n"
214 " nop \n"
215 " .subsection 2 \n"
216 "2: b 1b \n"
196 " nop \n" 217 " nop \n"
218 " .previous \n"
197 " .set reorder \n" 219 " .set reorder \n"
198 : "=m" (rw->lock), "=&r" (tmp) 220 : "=m" (rw->lock), "=&r" (tmp)
199 : "m" (rw->lock) 221 : "m" (rw->lock)
@@ -222,11 +244,18 @@ static inline void __raw_write_lock(raw_rwlock_t *rw)
222 __asm__ __volatile__( 244 __asm__ __volatile__(
223 " .set noreorder # __raw_write_lock \n" 245 " .set noreorder # __raw_write_lock \n"
224 "1: ll %1, %2 \n" 246 "1: ll %1, %2 \n"
225 " bnez %1, 1b \n" 247 " bnez %1, 2f \n"
226 " lui %1, 0x8000 \n" 248 " lui %1, 0x8000 \n"
227 " sc %1, %0 \n" 249 " sc %1, %0 \n"
228 " beqz %1, 1b \n" 250 " beqz %1, 2f \n"
251 " nop \n"
252 " .subsection 2 \n"
253 "2: ll %1, %2 \n"
254 " bnez %1, 2b \n"
255 " lui %1, 0x8000 \n"
256 " b 1b \n"
229 " nop \n" 257 " nop \n"
258 " .previous \n"
230 " .set reorder \n" 259 " .set reorder \n"
231 : "=m" (rw->lock), "=&r" (tmp) 260 : "=m" (rw->lock), "=&r" (tmp)
232 : "m" (rw->lock) 261 : "m" (rw->lock)
@@ -258,7 +287,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
258 " .set noreorder # __raw_read_trylock \n" 287 " .set noreorder # __raw_read_trylock \n"
259 " li %2, 0 \n" 288 " li %2, 0 \n"
260 "1: ll %1, %3 \n" 289 "1: ll %1, %3 \n"
261 " bnez %1, 2f \n" 290 " bltz %1, 2f \n"
262 " addu %1, 1 \n" 291 " addu %1, 1 \n"
263 " sc %1, %0 \n" 292 " sc %1, %0 \n"
264 " .set reorder \n" 293 " .set reorder \n"
@@ -275,7 +304,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
275 " .set noreorder # __raw_read_trylock \n" 304 " .set noreorder # __raw_read_trylock \n"
276 " li %2, 0 \n" 305 " li %2, 0 \n"
277 "1: ll %1, %3 \n" 306 "1: ll %1, %3 \n"
278 " bnez %1, 2f \n" 307 " bltz %1, 2f \n"
279 " addu %1, 1 \n" 308 " addu %1, 1 \n"
280 " sc %1, %0 \n" 309 " sc %1, %0 \n"
281 " beqz %1, 1b \n" 310 " beqz %1, 1b \n"
@@ -322,12 +351,15 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
322 " bnez %1, 2f \n" 351 " bnez %1, 2f \n"
323 " lui %1, 0x8000 \n" 352 " lui %1, 0x8000 \n"
324 " sc %1, %0 \n" 353 " sc %1, %0 \n"
325 " beqz %1, 1b \n" 354 " beqz %1, 3f \n"
326 " nop \n" 355 " li %2, 1 \n"
356 "2: \n"
327 __WEAK_ORDERING_MB 357 __WEAK_ORDERING_MB
328 " li %2, 1 \n" 358 " .subsection 2 \n"
359 "3: b 1b \n"
360 " li %2, 0 \n"
361 " .previous \n"
329 " .set reorder \n" 362 " .set reorder \n"
330 "2: \n"
331 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret) 363 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
332 : "m" (rw->lock) 364 : "m" (rw->lock)
333 : "memory"); 365 : "memory");
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 1fae5dc58138..7afa1fdf70ca 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -29,16 +29,25 @@
29 .endm 29 .endm
30 30
31 .macro SAVE_TEMP 31 .macro SAVE_TEMP
32#ifdef CONFIG_CPU_HAS_SMARTMIPS
33 mflhxu v1
34 LONG_S v1, PT_LO(sp)
35 mflhxu v1
36 LONG_S v1, PT_HI(sp)
37 mflhxu v1
38 LONG_S v1, PT_ACX(sp)
39#else
32 mfhi v1 40 mfhi v1
41 LONG_S v1, PT_HI(sp)
42 mflo v1
43 LONG_S v1, PT_LO(sp)
44#endif
33#ifdef CONFIG_32BIT 45#ifdef CONFIG_32BIT
34 LONG_S $8, PT_R8(sp) 46 LONG_S $8, PT_R8(sp)
35 LONG_S $9, PT_R9(sp) 47 LONG_S $9, PT_R9(sp)
36#endif 48#endif
37 LONG_S v1, PT_HI(sp)
38 mflo v1
39 LONG_S $10, PT_R10(sp) 49 LONG_S $10, PT_R10(sp)
40 LONG_S $11, PT_R11(sp) 50 LONG_S $11, PT_R11(sp)
41 LONG_S v1, PT_LO(sp)
42 LONG_S $12, PT_R12(sp) 51 LONG_S $12, PT_R12(sp)
43 LONG_S $13, PT_R13(sp) 52 LONG_S $13, PT_R13(sp)
44 LONG_S $14, PT_R14(sp) 53 LONG_S $14, PT_R14(sp)
@@ -182,16 +191,25 @@
182 .endm 191 .endm
183 192
184 .macro RESTORE_TEMP 193 .macro RESTORE_TEMP
194#ifdef CONFIG_CPU_HAS_SMARTMIPS
195 LONG_L $24, PT_ACX(sp)
196 mtlhx $24
197 LONG_L $24, PT_HI(sp)
198 mtlhx $24
185 LONG_L $24, PT_LO(sp) 199 LONG_L $24, PT_LO(sp)
200 mtlhx $24
201#else
202 LONG_L $24, PT_LO(sp)
203 mtlo $24
204 LONG_L $24, PT_HI(sp)
205 mthi $24
206#endif
186#ifdef CONFIG_32BIT 207#ifdef CONFIG_32BIT
187 LONG_L $8, PT_R8(sp) 208 LONG_L $8, PT_R8(sp)
188 LONG_L $9, PT_R9(sp) 209 LONG_L $9, PT_R9(sp)
189#endif 210#endif
190 mtlo $24
191 LONG_L $24, PT_HI(sp)
192 LONG_L $10, PT_R10(sp) 211 LONG_L $10, PT_R10(sp)
193 LONG_L $11, PT_R11(sp) 212 LONG_L $11, PT_R11(sp)
194 mthi $24
195 LONG_L $12, PT_R12(sp) 213 LONG_L $12, PT_R12(sp)
196 LONG_L $13, PT_R13(sp) 214 LONG_L $13, PT_R13(sp)
197 LONG_L $14, PT_R14(sp) 215 LONG_L $14, PT_R14(sp)
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 5e1289c85ed9..290887077e44 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -110,7 +110,10 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
110 " move %2, %z4 \n" 110 " move %2, %z4 \n"
111 " .set mips3 \n" 111 " .set mips3 \n"
112 " sc %2, %1 \n" 112 " sc %2, %1 \n"
113 " beqz %2, 1b \n" 113 " beqz %2, 2f \n"
114 " .subsection 2 \n"
115 "2: b 1b \n"
116 " .previous \n"
114 " .set mips0 \n" 117 " .set mips0 \n"
115 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 118 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
116 : "R" (*m), "Jr" (val) 119 : "R" (*m), "Jr" (val)
@@ -118,10 +121,10 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
118 } else { 121 } else {
119 unsigned long flags; 122 unsigned long flags;
120 123
121 local_irq_save(flags); 124 raw_local_irq_save(flags);
122 retval = *m; 125 retval = *m;
123 *m = val; 126 *m = val;
124 local_irq_restore(flags); /* implies memory barrier */ 127 raw_local_irq_restore(flags); /* implies memory barrier */
125 } 128 }
126 129
127 smp_mb(); 130 smp_mb();
@@ -155,7 +158,10 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
155 "1: lld %0, %3 # xchg_u64 \n" 158 "1: lld %0, %3 # xchg_u64 \n"
156 " move %2, %z4 \n" 159 " move %2, %z4 \n"
157 " scd %2, %1 \n" 160 " scd %2, %1 \n"
158 " beqz %2, 1b \n" 161 " beqz %2, 2f \n"
162 " .subsection 2 \n"
163 "2: b 1b \n"
164 " .previous \n"
159 " .set mips0 \n" 165 " .set mips0 \n"
160 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 166 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
161 : "R" (*m), "Jr" (val) 167 : "R" (*m), "Jr" (val)
@@ -163,10 +169,10 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
163 } else { 169 } else {
164 unsigned long flags; 170 unsigned long flags;
165 171
166 local_irq_save(flags); 172 raw_local_irq_save(flags);
167 retval = *m; 173 retval = *m;
168 *m = val; 174 *m = val;
169 local_irq_restore(flags); /* implies memory barrier */ 175 raw_local_irq_restore(flags); /* implies memory barrier */
170 } 176 }
171 177
172 smp_mb(); 178 smp_mb();
@@ -232,8 +238,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
232 " move $1, %z4 \n" 238 " move $1, %z4 \n"
233 " .set mips3 \n" 239 " .set mips3 \n"
234 " sc $1, %1 \n" 240 " sc $1, %1 \n"
235 " beqz $1, 1b \n" 241 " beqz $1, 3f \n"
236 "2: \n" 242 "2: \n"
243 " .subsection 2 \n"
244 "3: b 1b \n"
245 " .previous \n"
237 " .set pop \n" 246 " .set pop \n"
238 : "=&r" (retval), "=R" (*m) 247 : "=&r" (retval), "=R" (*m)
239 : "R" (*m), "Jr" (old), "Jr" (new) 248 : "R" (*m), "Jr" (old), "Jr" (new)
@@ -241,11 +250,11 @@ static inline unsigned long __cmpxchg_u32(volatile int * m, unsigned long old,
241 } else { 250 } else {
242 unsigned long flags; 251 unsigned long flags;
243 252
244 local_irq_save(flags); 253 raw_local_irq_save(flags);
245 retval = *m; 254 retval = *m;
246 if (retval == old) 255 if (retval == old)
247 *m = new; 256 *m = new;
248 local_irq_restore(flags); /* implies memory barrier */ 257 raw_local_irq_restore(flags); /* implies memory barrier */
249 } 258 }
250 259
251 smp_mb(); 260 smp_mb();
@@ -283,8 +292,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
283 " bne %0, %z3, 2f \n" 292 " bne %0, %z3, 2f \n"
284 " move $1, %z4 \n" 293 " move $1, %z4 \n"
285 " scd $1, %1 \n" 294 " scd $1, %1 \n"
286 " beqz $1, 1b \n" 295 " beqz $1, 3f \n"
287 "2: \n" 296 "2: \n"
297 " .subsection 2 \n"
298 "3: b 1b \n"
299 " .previous \n"
288 " .set pop \n" 300 " .set pop \n"
289 : "=&r" (retval), "=R" (*m) 301 : "=&r" (retval), "=R" (*m)
290 : "R" (*m), "Jr" (old), "Jr" (new) 302 : "R" (*m), "Jr" (old), "Jr" (new)
@@ -292,11 +304,11 @@ static inline unsigned long __cmpxchg_u64(volatile int * m, unsigned long old,
292 } else { 304 } else {
293 unsigned long flags; 305 unsigned long flags;
294 306
295 local_irq_save(flags); 307 raw_local_irq_save(flags);
296 retval = *m; 308 retval = *m;
297 if (retval == old) 309 if (retval == old)
298 *m = new; 310 *m = new;
299 local_irq_restore(flags); /* implies memory barrier */ 311 raw_local_irq_restore(flags); /* implies memory barrier */
300 } 312 }
301 313
302 smp_mb(); 314 smp_mb();
diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h
index 4906204d34fe..2ce07f4be369 100644
--- a/include/asm-mips/termios.h
+++ b/include/asm-mips/termios.h
@@ -87,24 +87,6 @@ struct termio {
87#define TIOCM_OUT2 0x4000 87#define TIOCM_OUT2 0x4000
88#define TIOCM_LOOP 0x8000 88#define TIOCM_LOOP 0x8000
89 89
90/* line disciplines */
91#define N_TTY 0
92#define N_SLIP 1
93#define N_MOUSE 2
94#define N_PPP 3
95#define N_STRIP 4
96#define N_AX25 5
97#define N_X25 6 /* X.25 async */
98#define N_6PACK 7
99#define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */
100#define N_R3964 9 /* Reserved for Simatic R3964 module */
101#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
102#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
103#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
104#define N_HDLC 13 /* synchronous HDLC */
105#define N_SYNC_PPP 14 /* synchronous PPP */
106#define N_HCI 15 /* Bluetooth HCI UART */
107
108#ifdef __KERNEL__ 90#ifdef __KERNEL__
109 91
110#include <linux/string.h> 92#include <linux/string.h>
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index 1cdd4eeb2f73..b25511787ee0 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -265,12 +265,14 @@ do { \
265 */ 265 */
266#define __get_user_asm_ll32(val, addr) \ 266#define __get_user_asm_ll32(val, addr) \
267{ \ 267{ \
268 unsigned long long __gu_tmp; \ 268 union { \
269 unsigned long long l; \
270 __typeof__(*(addr)) t; \
271 } __gu_tmp; \
269 \ 272 \
270 __asm__ __volatile__( \ 273 __asm__ __volatile__( \
271 "1: lw %1, (%3) \n" \ 274 "1: lw %1, (%3) \n" \
272 "2: lw %D1, 4(%3) \n" \ 275 "2: lw %D1, 4(%3) \n" \
273 " move %0, $0 \n" \
274 "3: .section .fixup,\"ax\" \n" \ 276 "3: .section .fixup,\"ax\" \n" \
275 "4: li %0, %4 \n" \ 277 "4: li %0, %4 \n" \
276 " move %1, $0 \n" \ 278 " move %1, $0 \n" \
@@ -281,9 +283,10 @@ do { \
281 " " __UA_ADDR " 1b, 4b \n" \ 283 " " __UA_ADDR " 1b, 4b \n" \
282 " " __UA_ADDR " 2b, 4b \n" \ 284 " " __UA_ADDR " 2b, 4b \n" \
283 " .previous \n" \ 285 " .previous \n" \
284 : "=r" (__gu_err), "=&r" (__gu_tmp) \ 286 : "=r" (__gu_err), "=&r" (__gu_tmp.l) \
285 : "0" (0), "r" (addr), "i" (-EFAULT)); \ 287 : "0" (0), "r" (addr), "i" (-EFAULT)); \
286 (val) = (__typeof__(*(addr))) __gu_tmp; \ 288 \
289 (val) = __gu_tmp.t; \
287} 290}
288 291
289/* 292/*
@@ -432,8 +435,34 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
432 __cu_len; \ 435 __cu_len; \
433}) 436})
434 437
435#define __copy_to_user_inatomic __copy_to_user 438extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
436#define __copy_from_user_inatomic __copy_from_user 439
440#define __copy_to_user_inatomic(to,from,n) \
441({ \
442 void __user *__cu_to; \
443 const void *__cu_from; \
444 long __cu_len; \
445 \
446 __cu_to = (to); \
447 __cu_from = (from); \
448 __cu_len = (n); \
449 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
450 __cu_len; \
451})
452
453#define __copy_from_user_inatomic(to,from,n) \
454({ \
455 void *__cu_to; \
456 const void __user *__cu_from; \
457 long __cu_len; \
458 \
459 __cu_to = (to); \
460 __cu_from = (from); \
461 __cu_len = (n); \
462 __cu_len = __invoke_copy_from_user_inatomic(__cu_to, __cu_from, \
463 __cu_len); \
464 __cu_len; \
465})
437 466
438/* 467/*
439 * copy_to_user: - Copy a block of data into user space. 468 * copy_to_user: - Copy a block of data into user space.
@@ -487,8 +516,32 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
487 __cu_len_r; \ 516 __cu_len_r; \
488}) 517})
489 518
519#define __invoke_copy_from_user_inatomic(to,from,n) \
520({ \
521 register void *__cu_to_r __asm__ ("$4"); \
522 register const void __user *__cu_from_r __asm__ ("$5"); \
523 register long __cu_len_r __asm__ ("$6"); \
524 \
525 __cu_to_r = (to); \
526 __cu_from_r = (from); \
527 __cu_len_r = (n); \
528 __asm__ __volatile__( \
529 ".set\tnoreorder\n\t" \
530 __MODULE_JAL(__copy_user_inatomic) \
531 ".set\tnoat\n\t" \
532 __UA_ADDU "\t$1, %1, %2\n\t" \
533 ".set\tat\n\t" \
534 ".set\treorder" \
535 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
536 : \
537 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
538 "memory"); \
539 __cu_len_r; \
540})
541
490/* 542/*
491 * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space. 543 * __copy_from_user: - Copy a block of data from user space, with less checking.
544 * @to: Destination address, in kernel space.
492 * @from: Source address, in user space. 545 * @from: Source address, in user space.
493 * @n: Number of bytes to copy. 546 * @n: Number of bytes to copy.
494 * 547 *
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 696cff39a1d3..2f1087b3a202 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -334,16 +334,18 @@
334#define __NR_kexec_load (__NR_Linux + 311) 334#define __NR_kexec_load (__NR_Linux + 311)
335#define __NR_getcpu (__NR_Linux + 312) 335#define __NR_getcpu (__NR_Linux + 312)
336#define __NR_epoll_pwait (__NR_Linux + 313) 336#define __NR_epoll_pwait (__NR_Linux + 313)
337#define __NR_ioprio_set (__NR_Linux + 314)
338#define __NR_ioprio_get (__NR_Linux + 315)
337 339
338/* 340/*
339 * Offset of the last Linux o32 flavoured syscall 341 * Offset of the last Linux o32 flavoured syscall
340 */ 342 */
341#define __NR_Linux_syscalls 313 343#define __NR_Linux_syscalls 315
342 344
343#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 345#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
344 346
345#define __NR_O32_Linux 4000 347#define __NR_O32_Linux 4000
346#define __NR_O32_Linux_syscalls 313 348#define __NR_O32_Linux_syscalls 315
347 349
348#if _MIPS_SIM == _MIPS_SIM_ABI64 350#if _MIPS_SIM == _MIPS_SIM_ABI64
349 351
@@ -624,16 +626,18 @@
624#define __NR_kexec_load (__NR_Linux + 270) 626#define __NR_kexec_load (__NR_Linux + 270)
625#define __NR_getcpu (__NR_Linux + 271) 627#define __NR_getcpu (__NR_Linux + 271)
626#define __NR_epoll_pwait (__NR_Linux + 272) 628#define __NR_epoll_pwait (__NR_Linux + 272)
629#define __NR_ioprio_set (__NR_Linux + 273)
630#define __NR_ioprio_get (__NR_Linux + 274)
627 631
628/* 632/*
629 * Offset of the last Linux 64-bit flavoured syscall 633 * Offset of the last Linux 64-bit flavoured syscall
630 */ 634 */
631#define __NR_Linux_syscalls 272 635#define __NR_Linux_syscalls 274
632 636
633#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 637#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
634 638
635#define __NR_64_Linux 5000 639#define __NR_64_Linux 5000
636#define __NR_64_Linux_syscalls 272 640#define __NR_64_Linux_syscalls 274
637 641
638#if _MIPS_SIM == _MIPS_SIM_NABI32 642#if _MIPS_SIM == _MIPS_SIM_NABI32
639 643
@@ -918,16 +922,18 @@
918#define __NR_kexec_load (__NR_Linux + 274) 922#define __NR_kexec_load (__NR_Linux + 274)
919#define __NR_getcpu (__NR_Linux + 275) 923#define __NR_getcpu (__NR_Linux + 275)
920#define __NR_epoll_pwait (__NR_Linux + 276) 924#define __NR_epoll_pwait (__NR_Linux + 276)
925#define __NR_ioprio_set (__NR_Linux + 277)
926#define __NR_ioprio_get (__NR_Linux + 278)
921 927
922/* 928/*
923 * Offset of the last N32 flavoured syscall 929 * Offset of the last N32 flavoured syscall
924 */ 930 */
925#define __NR_Linux_syscalls 276 931#define __NR_Linux_syscalls 278
926 932
927#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 933#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
928 934
929#define __NR_N32_Linux 6000 935#define __NR_N32_Linux 6000
930#define __NR_N32_Linux_syscalls 276 936#define __NR_N32_Linux_syscalls 278
931 937
932#ifdef __KERNEL__ 938#ifdef __KERNEL__
933 939
diff --git a/include/asm-mips/vr41xx/cmbvr4133.h b/include/asm-mips/vr41xx/cmbvr4133.h
index 9490ade58b46..42300037d593 100644
--- a/include/asm-mips/vr41xx/cmbvr4133.h
+++ b/include/asm-mips/vr41xx/cmbvr4133.h
@@ -35,8 +35,8 @@
35#define CMBVR41XX_INTD_IRQ GIU_IRQ(CMBVR41XX_INTD_PIN) 35#define CMBVR41XX_INTD_IRQ GIU_IRQ(CMBVR41XX_INTD_PIN)
36#define CMBVR41XX_INTE_IRQ GIU_IRQ(CMBVR41XX_INTE_PIN) 36#define CMBVR41XX_INTE_IRQ GIU_IRQ(CMBVR41XX_INTE_PIN)
37 37
38#define I8259_IRQ_BASE 72 38#define I8259A_IRQ_BASE 72
39#define I8259_IRQ(x) (I8259_IRQ_BASE + (x)) 39#define I8259_IRQ(x) (I8259A_IRQ_BASE + (x))
40#define TIMER_IRQ I8259_IRQ(0) 40#define TIMER_IRQ I8259_IRQ(0)
41#define KEYBOARD_IRQ I8259_IRQ(1) 41#define KEYBOARD_IRQ I8259_IRQ(1)
42#define I8259_SLAVE_IRQ I8259_IRQ(2) 42#define I8259_SLAVE_IRQ I8259_IRQ(2)
@@ -52,6 +52,5 @@
52#define AUX_IRQ I8259_IRQ(12) 52#define AUX_IRQ I8259_IRQ(12)
53#define IDE_PRIMARY_IRQ I8259_IRQ(14) 53#define IDE_PRIMARY_IRQ I8259_IRQ(14)
54#define IDE_SECONDARY_IRQ I8259_IRQ(15) 54#define IDE_SECONDARY_IRQ I8259_IRQ(15)
55#define I8259_IRQ_LAST IDE_SECONDARY_IRQ
56 55
57#endif /* __NEC_CMBVR4133_H */ 56#endif /* __NEC_CMBVR4133_H */
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
index 5a1e0e8b1c32..5587f0023881 100644
--- a/include/asm-parisc/assembly.h
+++ b/include/asm-parisc/assembly.h
@@ -31,9 +31,13 @@
31#define STREGM std,ma 31#define STREGM std,ma
32#define SHRREG shrd 32#define SHRREG shrd
33#define SHLREG shld 33#define SHLREG shld
34#define ADDIB addib,*
35#define CMPB cmpb,*
36#define ANDCM andcm,*
34#define RP_OFFSET 16 37#define RP_OFFSET 16
35#define FRAME_SIZE 128 38#define FRAME_SIZE 128
36#define CALLEE_REG_FRAME_SIZE 144 39#define CALLEE_REG_FRAME_SIZE 144
40#define ASM_ULONG_INSN .dword
37#else /* CONFIG_64BIT */ 41#else /* CONFIG_64BIT */
38#define LDREG ldw 42#define LDREG ldw
39#define STREG stw 43#define STREG stw
@@ -42,9 +46,13 @@
42#define STREGM stwm 46#define STREGM stwm
43#define SHRREG shr 47#define SHRREG shr
44#define SHLREG shlw 48#define SHLREG shlw
49#define ADDIB addib,
50#define CMPB cmpb,
51#define ANDCM andcm
45#define RP_OFFSET 20 52#define RP_OFFSET 20
46#define FRAME_SIZE 64 53#define FRAME_SIZE 64
47#define CALLEE_REG_FRAME_SIZE 128 54#define CALLEE_REG_FRAME_SIZE 128
55#define ASM_ULONG_INSN .word
48#endif 56#endif
49 57
50#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE) 58#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)
@@ -65,7 +73,7 @@
65 73
66#ifdef __ASSEMBLY__ 74#ifdef __ASSEMBLY__
67 75
68#ifdef __LP64__ 76#ifdef CONFIG_64BIT
69/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so 77/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so
70 * work around that for now... */ 78 * work around that for now... */
71 .level 2.0w 79 .level 2.0w
@@ -156,7 +164,7 @@
156 .endm 164 .endm
157 165
158 .macro loadgp 166 .macro loadgp
159#ifdef __LP64__ 167#ifdef CONFIG_64BIT
160 ldil L%__gp, %r27 168 ldil L%__gp, %r27
161 ldo R%__gp(%r27), %r27 169 ldo R%__gp(%r27), %r27
162#else 170#else
@@ -334,7 +342,7 @@
334 fldd,mb -8(%r30), %fr12 342 fldd,mb -8(%r30), %fr12
335 .endm 343 .endm
336 344
337#ifdef __LP64__ 345#ifdef CONFIG_64BIT
338 .macro callee_save 346 .macro callee_save
339 std,ma %r3, CALLEE_REG_FRAME_SIZE(%r30) 347 std,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
340 mfctl %cr27, %r3 348 mfctl %cr27, %r3
@@ -377,7 +385,7 @@
377 ldd,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3 385 ldd,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
378 .endm 386 .endm
379 387
380#else /* ! __LP64__ */ 388#else /* ! CONFIG_64BIT */
381 389
382 .macro callee_save 390 .macro callee_save
383 stw,ma %r3, CALLEE_REG_FRAME_SIZE(%r30) 391 stw,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
@@ -420,7 +428,7 @@
420 mtctl %r3, %cr27 428 mtctl %r3, %cr27
421 ldw,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3 429 ldw,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
422 .endm 430 .endm
423#endif /* ! __LP64__ */ 431#endif /* ! CONFIG_64BIT */
424 432
425 .macro save_specials regs 433 .macro save_specials regs
426 434
@@ -441,7 +449,7 @@
441 mtctl %r0, %cr18 449 mtctl %r0, %cr18
442 SAVE_CR (%cr18, PT_IAOQ1(\regs)) 450 SAVE_CR (%cr18, PT_IAOQ1(\regs))
443 451
444#ifdef __LP64__ 452#ifdef CONFIG_64BIT
445 /* cr11 (sar) is a funny one. 5 bits on PA1.1 and 6 bit on PA2.0 453 /* cr11 (sar) is a funny one. 5 bits on PA1.1 and 6 bit on PA2.0
446 * For PA2.0 mtsar or mtctl always write 6 bits, but mfctl only 454 * For PA2.0 mtsar or mtctl always write 6 bits, but mfctl only
447 * reads 5 bits. Use mfctl,w to read all six bits. Otherwise 455 * reads 5 bits. Use mfctl,w to read all six bits. Otherwise
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
index 48bf9b8ab8ff..7d57d34fcca8 100644
--- a/include/asm-parisc/atomic.h
+++ b/include/asm-parisc/atomic.h
@@ -58,7 +58,7 @@ extern void __xchg_called_with_bad_pointer(void);
58/* __xchg32/64 defined in arch/parisc/lib/bitops.c */ 58/* __xchg32/64 defined in arch/parisc/lib/bitops.c */
59extern unsigned long __xchg8(char, char *); 59extern unsigned long __xchg8(char, char *);
60extern unsigned long __xchg32(int, int *); 60extern unsigned long __xchg32(int, int *);
61#ifdef __LP64__ 61#ifdef CONFIG_64BIT
62extern unsigned long __xchg64(unsigned long, unsigned long *); 62extern unsigned long __xchg64(unsigned long, unsigned long *);
63#endif 63#endif
64 64
@@ -67,7 +67,7 @@ static __inline__ unsigned long
67__xchg(unsigned long x, __volatile__ void * ptr, int size) 67__xchg(unsigned long x, __volatile__ void * ptr, int size)
68{ 68{
69 switch(size) { 69 switch(size) {
70#ifdef __LP64__ 70#ifdef CONFIG_64BIT
71 case 8: return __xchg64(x,(unsigned long *) ptr); 71 case 8: return __xchg64(x,(unsigned long *) ptr);
72#endif 72#endif
73 case 4: return __xchg32((int) x, (int *) ptr); 73 case 4: return __xchg32((int) x, (int *) ptr);
@@ -81,7 +81,7 @@ __xchg(unsigned long x, __volatile__ void * ptr, int size)
81/* 81/*
82** REVISIT - Abandoned use of LDCW in xchg() for now: 82** REVISIT - Abandoned use of LDCW in xchg() for now:
83** o need to test sizeof(*ptr) to avoid clearing adjacent bytes 83** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
84** o and while we are at it, could __LP64__ code use LDCD too? 84** o and while we are at it, could CONFIG_64BIT code use LDCD too?
85** 85**
86** if (__builtin_constant_p(x) && (x == NULL)) 86** if (__builtin_constant_p(x) && (x == NULL))
87** if (((unsigned long)p & 0xf) == 0) 87** if (((unsigned long)p & 0xf) == 0)
@@ -105,7 +105,7 @@ static __inline__ unsigned long
105__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size) 105__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
106{ 106{
107 switch(size) { 107 switch(size) {
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); 109 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
110#endif 110#endif
111 case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_); 111 case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_);
@@ -218,7 +218,7 @@ static __inline__ int atomic_read(const atomic_t *v)
218#define smp_mb__before_atomic_inc() smp_mb() 218#define smp_mb__before_atomic_inc() smp_mb()
219#define smp_mb__after_atomic_inc() smp_mb() 219#define smp_mb__after_atomic_inc() smp_mb()
220 220
221#ifdef __LP64__ 221#ifdef CONFIG_64BIT
222 222
223typedef struct { volatile s64 counter; } atomic64_t; 223typedef struct { volatile s64 counter; } atomic64_t;
224 224
@@ -270,7 +270,7 @@ atomic64_read(const atomic64_t *v)
270#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0) 270#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0)
271#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0) 271#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0)
272 272
273#endif /* __LP64__ */ 273#endif /* CONFIG_64BIT */
274 274
275#include <asm-generic/atomic.h> 275#include <asm-generic/atomic.h>
276 276
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 900561922c4c..015cb0d379bd 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -60,31 +60,37 @@ static __inline__ void change_bit(int nr, volatile unsigned long * addr)
60static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr) 60static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
61{ 61{
62 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 62 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
63 unsigned long oldbit; 63 unsigned long old;
64 unsigned long flags; 64 unsigned long flags;
65 int set;
65 66
66 addr += (nr >> SHIFT_PER_LONG); 67 addr += (nr >> SHIFT_PER_LONG);
67 _atomic_spin_lock_irqsave(addr, flags); 68 _atomic_spin_lock_irqsave(addr, flags);
68 oldbit = *addr; 69 old = *addr;
69 *addr = oldbit | mask; 70 set = (old & mask) ? 1 : 0;
71 if (!set)
72 *addr = old | mask;
70 _atomic_spin_unlock_irqrestore(addr, flags); 73 _atomic_spin_unlock_irqrestore(addr, flags);
71 74
72 return (oldbit & mask) ? 1 : 0; 75 return set;
73} 76}
74 77
75static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr) 78static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
76{ 79{
77 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr); 80 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
78 unsigned long oldbit; 81 unsigned long old;
79 unsigned long flags; 82 unsigned long flags;
83 int set;
80 84
81 addr += (nr >> SHIFT_PER_LONG); 85 addr += (nr >> SHIFT_PER_LONG);
82 _atomic_spin_lock_irqsave(addr, flags); 86 _atomic_spin_lock_irqsave(addr, flags);
83 oldbit = *addr; 87 old = *addr;
84 *addr = oldbit & ~mask; 88 set = (old & mask) ? 1 : 0;
89 if (set)
90 *addr = old & ~mask;
85 _atomic_spin_unlock_irqrestore(addr, flags); 91 _atomic_spin_unlock_irqrestore(addr, flags);
86 92
87 return (oldbit & mask) ? 1 : 0; 93 return set;
88} 94}
89 95
90static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr) 96static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
@@ -130,7 +136,7 @@ static __inline__ unsigned long __ffs(unsigned long x)
130 unsigned long ret; 136 unsigned long ret;
131 137
132 __asm__( 138 __asm__(
133#ifdef __LP64__ 139#ifdef CONFIG_64BIT
134 " ldi 63,%1\n" 140 " ldi 63,%1\n"
135 " extrd,u,*<> %0,63,32,%%r0\n" 141 " extrd,u,*<> %0,63,32,%%r0\n"
136 " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */ 142 " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h
index 695588da41f8..83ba510ed5d8 100644
--- a/include/asm-parisc/bug.h
+++ b/include/asm-parisc/bug.h
@@ -1,14 +1,92 @@
1#ifndef _PARISC_BUG_H 1#ifndef _PARISC_BUG_H
2#define _PARISC_BUG_H 2#define _PARISC_BUG_H
3 3
4/*
5 * Tell the user there is some problem.
6 * The offending file and line are encoded in the __bug_table section.
7 */
8
4#ifdef CONFIG_BUG 9#ifdef CONFIG_BUG
5#define HAVE_ARCH_BUG 10#define HAVE_ARCH_BUG
6#define BUG() do { \ 11#define HAVE_ARCH_WARN_ON
7 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 12
8 dump_stack(); \ 13/* the break instruction is used as BUG() marker. */
9 panic("BUG!"); \ 14#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
10} while (0) 15#define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
16
17#if defined(CONFIG_64BIT)
18#define ASM_WORD_INSN ".dword\t"
19#else
20#define ASM_WORD_INSN ".word\t"
21#endif
22
23#ifdef CONFIG_DEBUG_BUGVERBOSE
24#define BUG() \
25 do { \
26 asm volatile("\n" \
27 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
28 "\t.pushsection __bug_table,\"a\"\n" \
29 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
30 "\t.short %c1, %c2\n" \
31 "\t.org 2b+%c3\n" \
32 "\t.popsection" \
33 : : "i" (__FILE__), "i" (__LINE__), \
34 "i" (0), "i" (sizeof(struct bug_entry)) ); \
35 for(;;) ; \
36 } while(0)
37
38#else
39#define BUG() \
40 do { \
41 asm volatile(PARISC_BUG_BREAK_ASM : : ); \
42 for(;;) ; \
43 } while(0)
44#endif
45
46#ifdef CONFIG_DEBUG_BUGVERBOSE
47#define __WARN() \
48 do { \
49 asm volatile("\n" \
50 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
51 "\t.pushsection __bug_table,\"a\"\n" \
52 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
53 "\t.short %c1, %c2\n" \
54 "\t.org 2b+%c3\n" \
55 "\t.popsection" \
56 : : "i" (__FILE__), "i" (__LINE__), \
57 "i" (BUGFLAG_WARNING), \
58 "i" (sizeof(struct bug_entry)) ); \
59 } while(0)
60#else
61#define __WARN() \
62 do { \
63 asm volatile("\n" \
64 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
65 "\t.pushsection __bug_table,\"a\"\n" \
66 "2:\t" ASM_WORD_INSN "1b\n" \
67 "\t.short %c0\n" \
68 "\t.org 2b+%c1\n" \
69 "\t.popsection" \
70 : : "i" (BUGFLAG_WARNING), \
71 "i" (sizeof(struct bug_entry)) ); \
72 } while(0)
73#endif
74
75
76#define WARN_ON(x) ({ \
77 typeof(x) __ret_warn_on = (x); \
78 if (__builtin_constant_p(__ret_warn_on)) { \
79 if (__ret_warn_on) \
80 __WARN(); \
81 } else { \
82 if (unlikely(__ret_warn_on)) \
83 __WARN(); \
84 } \
85 unlikely(__ret_warn_on); \
86})
87
11#endif 88#endif
12 89
13#include <asm-generic/bug.h> 90#include <asm-generic/bug.h>
14#endif 91#endif
92
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
index 7d22fa206fc4..32c2cca74345 100644
--- a/include/asm-parisc/cache.h
+++ b/include/asm-parisc/cache.h
@@ -30,31 +30,11 @@
30 30
31#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 31#define __read_mostly __attribute__((__section__(".data.read_mostly")))
32 32
33extern void flush_data_cache_local(void *); /* flushes local data-cache only */ 33void parisc_cache_init(void); /* initializes cache-flushing */
34extern void flush_instruction_cache_local(void *); /* flushes local code-cache only */ 34void disable_sr_hashing_asm(int); /* low level support for above */
35#ifdef CONFIG_SMP 35void disable_sr_hashing(void); /* turns off space register hashing */
36extern void flush_data_cache(void); /* flushes data-cache only (all processors) */ 36void free_sid(unsigned long);
37extern void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
38#else
39#define flush_data_cache() flush_data_cache_local(NULL)
40#define flush_instruction_cache() flush_instruction_cache_local(NULL)
41#endif
42
43extern void parisc_cache_init(void); /* initializes cache-flushing */
44extern void flush_all_caches(void); /* flush everything (tlb & cache) */
45extern int get_cache_info(char *);
46extern void flush_user_icache_range_asm(unsigned long, unsigned long);
47extern void flush_kernel_icache_range_asm(unsigned long, unsigned long);
48extern void flush_user_dcache_range_asm(unsigned long, unsigned long);
49extern void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
50extern void flush_kernel_dcache_page_asm(void *);
51extern void flush_kernel_icache_page(void *);
52extern void disable_sr_hashing(void); /* turns off space register hashing */
53extern void disable_sr_hashing_asm(int); /* low level support for above */
54extern void free_sid(unsigned long);
55unsigned long alloc_sid(void); 37unsigned long alloc_sid(void);
56extern void flush_user_dcache_page(unsigned long);
57extern void flush_user_icache_page(unsigned long);
58 38
59struct seq_file; 39struct seq_file;
60extern void show_cache_info(struct seq_file *m); 40extern void show_cache_info(struct seq_file *m);
@@ -63,6 +43,7 @@ extern int split_tlb;
63extern int dcache_stride; 43extern int dcache_stride;
64extern int icache_stride; 44extern int icache_stride;
65extern struct pdc_cache_info cache_info; 45extern struct pdc_cache_info cache_info;
46void parisc_setup_cache_timing(void);
66 47
67#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr)); 48#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr));
68#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr)); 49#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr));
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index a799dd8ef395..2f1e1b05440a 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -2,60 +2,46 @@
2#define _PARISC_CACHEFLUSH_H 2#define _PARISC_CACHEFLUSH_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/cache.h> /* for flush_user_dcache_range_asm() proto */
6 5
7/* The usual comment is "Caches aren't brain-dead on the <architecture>". 6/* The usual comment is "Caches aren't brain-dead on the <architecture>".
8 * Unfortunately, that doesn't apply to PA-RISC. */ 7 * Unfortunately, that doesn't apply to PA-RISC. */
9 8
10/* Cache flush operations */ 9/* Internal implementation */
11 10void flush_data_cache_local(void *); /* flushes local data-cache only */
11void flush_instruction_cache_local(void *); /* flushes local code-cache only */
12#ifdef CONFIG_SMP 12#ifdef CONFIG_SMP
13#define flush_cache_mm(mm) flush_cache_all() 13void flush_data_cache(void); /* flushes data-cache only (all processors) */
14void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
14#else 15#else
15#define flush_cache_mm(mm) flush_cache_all_local() 16#define flush_data_cache() flush_data_cache_local(NULL)
17#define flush_instruction_cache() flush_instruction_cache_local(NULL)
16#endif 18#endif
17 19
18#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 20#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
19 21
20#define flush_kernel_dcache_range(start,size) \ 22void flush_user_icache_range_asm(unsigned long, unsigned long);
21 flush_kernel_dcache_range_asm((start), (start)+(size)); 23void flush_kernel_icache_range_asm(unsigned long, unsigned long);
24void flush_user_dcache_range_asm(unsigned long, unsigned long);
25void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
26void flush_kernel_dcache_page_asm(void *);
27void flush_kernel_icache_page(void *);
28void flush_user_dcache_page(unsigned long);
29void flush_user_icache_page(unsigned long);
30void flush_user_dcache_range(unsigned long, unsigned long);
31void flush_user_icache_range(unsigned long, unsigned long);
22 32
23extern void flush_cache_all_local(void); 33/* Cache flush operations */
24 34
25static inline void cacheflush_h_tmp_function(void *dummy) 35void flush_cache_all_local(void);
26{ 36void flush_cache_all(void);
27 flush_cache_all_local(); 37void flush_cache_mm(struct mm_struct *mm);
28}
29 38
30static inline void flush_cache_all(void) 39#define flush_kernel_dcache_range(start,size) \
31{ 40 flush_kernel_dcache_range_asm((start), (start)+(size));
32 on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1);
33}
34 41
35#define flush_cache_vmap(start, end) flush_cache_all() 42#define flush_cache_vmap(start, end) flush_cache_all()
36#define flush_cache_vunmap(start, end) flush_cache_all() 43#define flush_cache_vunmap(start, end) flush_cache_all()
37 44
38extern int parisc_cache_flush_threshold;
39void parisc_setup_cache_timing(void);
40
41static inline void
42flush_user_dcache_range(unsigned long start, unsigned long end)
43{
44 if ((end - start) < parisc_cache_flush_threshold)
45 flush_user_dcache_range_asm(start,end);
46 else
47 flush_data_cache();
48}
49
50static inline void
51flush_user_icache_range(unsigned long start, unsigned long end)
52{
53 if ((end - start) < parisc_cache_flush_threshold)
54 flush_user_icache_range_asm(start,end);
55 else
56 flush_instruction_cache();
57}
58
59extern void flush_dcache_page(struct page *page); 45extern void flush_dcache_page(struct page *page);
60 46
61#define flush_dcache_mmap_lock(mapping) \ 47#define flush_dcache_mmap_lock(mapping) \
@@ -63,9 +49,15 @@ extern void flush_dcache_page(struct page *page);
63#define flush_dcache_mmap_unlock(mapping) \ 49#define flush_dcache_mmap_unlock(mapping) \
64 write_unlock_irq(&(mapping)->tree_lock) 50 write_unlock_irq(&(mapping)->tree_lock)
65 51
66#define flush_icache_page(vma,page) do { flush_kernel_dcache_page(page); flush_kernel_icache_page(page_address(page)); } while (0) 52#define flush_icache_page(vma,page) do { \
53 flush_kernel_dcache_page(page); \
54 flush_kernel_icache_page(page_address(page)); \
55} while (0)
67 56
68#define flush_icache_range(s,e) do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0) 57#define flush_icache_range(s,e) do { \
58 flush_kernel_dcache_range_asm(s,e); \
59 flush_kernel_icache_range_asm(s,e); \
60} while (0)
69 61
70#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 62#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
71do { \ 63do { \
@@ -80,118 +72,17 @@ do { \
80 memcpy(dst, src, len); \ 72 memcpy(dst, src, len); \
81} while (0) 73} while (0)
82 74
83static inline void flush_cache_range(struct vm_area_struct *vma, 75void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn);
84 unsigned long start, unsigned long end) 76void flush_cache_range(struct vm_area_struct *vma,
85{ 77 unsigned long start, unsigned long end);
86 int sr3;
87
88 if (!vma->vm_mm->context) {
89 BUG();
90 return;
91 }
92
93 sr3 = mfsp(3);
94 if (vma->vm_mm->context == sr3) {
95 flush_user_dcache_range(start,end);
96 flush_user_icache_range(start,end);
97 } else {
98 flush_cache_all();
99 }
100}
101
102/* Simple function to work out if we have an existing address translation
103 * for a user space vma. */
104static inline int translation_exists(struct vm_area_struct *vma,
105 unsigned long addr, unsigned long pfn)
106{
107 pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
108 pmd_t *pmd;
109 pte_t pte;
110
111 if(pgd_none(*pgd))
112 return 0;
113
114 pmd = pmd_offset(pgd, addr);
115 if(pmd_none(*pmd) || pmd_bad(*pmd))
116 return 0;
117
118 /* We cannot take the pte lock here: flush_cache_page is usually
119 * called with pte lock already held. Whereas flush_dcache_page
120 * takes flush_dcache_mmap_lock, which is lower in the hierarchy:
121 * the vma itself is secure, but the pte might come or go racily.
122 */
123 pte = *pte_offset_map(pmd, addr);
124 /* But pte_unmap() does nothing on this architecture */
125
126 /* Filter out coincidental file entries and swap entries */
127 if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
128 return 0;
129
130 return pte_pfn(pte) == pfn;
131}
132
133/* Private function to flush a page from the cache of a non-current
134 * process. cr25 contains the Page Directory of the current user
135 * process; we're going to hijack both it and the user space %sr3 to
136 * temporarily make the non-current process current. We have to do
137 * this because cache flushing may cause a non-access tlb miss which
138 * the handlers have to fill in from the pgd of the non-current
139 * process. */
140static inline void
141flush_user_cache_page_non_current(struct vm_area_struct *vma,
142 unsigned long vmaddr)
143{
144 /* save the current process space and pgd */
145 unsigned long space = mfsp(3), pgd = mfctl(25);
146
147 /* we don't mind taking interrups since they may not
148 * do anything with user space, but we can't
149 * be preempted here */
150 preempt_disable();
151
152 /* make us current */
153 mtctl(__pa(vma->vm_mm->pgd), 25);
154 mtsp(vma->vm_mm->context, 3);
155
156 flush_user_dcache_page(vmaddr);
157 if(vma->vm_flags & VM_EXEC)
158 flush_user_icache_page(vmaddr);
159
160 /* put the old current process back */
161 mtsp(space, 3);
162 mtctl(pgd, 25);
163 preempt_enable();
164}
165
166static inline void
167__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
168{
169 if (likely(vma->vm_mm->context == mfsp(3))) {
170 flush_user_dcache_page(vmaddr);
171 if (vma->vm_flags & VM_EXEC)
172 flush_user_icache_page(vmaddr);
173 } else {
174 flush_user_cache_page_non_current(vma, vmaddr);
175 }
176}
177
178static inline void
179flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)
180{
181 BUG_ON(!vma->vm_mm->context);
182
183 if (likely(translation_exists(vma, vmaddr, pfn)))
184 __flush_cache_page(vma, vmaddr);
185
186}
187 78
79#define ARCH_HAS_FLUSH_ANON_PAGE
188static inline void 80static inline void
189flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr) 81flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
190{ 82{
191 if (PageAnon(page)) 83 if (PageAnon(page))
192 flush_user_dcache_page(vmaddr); 84 flush_user_dcache_page(vmaddr);
193} 85}
194#define ARCH_HAS_FLUSH_ANON_PAGE
195 86
196#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE 87#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
197void flush_kernel_dcache_page_addr(void *addr); 88void flush_kernel_dcache_page_addr(void *addr);
diff --git a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
index 66f0b408c669..c6c0e9ff6bde 100644
--- a/include/asm-parisc/dma-mapping.h
+++ b/include/asm-parisc/dma-mapping.h
@@ -236,7 +236,7 @@ int ccio_allocate_resource(const struct parisc_device *dev,
236 unsigned long min, unsigned long max, unsigned long align); 236 unsigned long min, unsigned long max, unsigned long align);
237#else /* !CONFIG_IOMMU_CCIO */ 237#else /* !CONFIG_IOMMU_CCIO */
238#define ccio_get_iommu(dev) NULL 238#define ccio_get_iommu(dev) NULL
239#define ccio_request_resource(dev, res) request_resource(&iomem_resource, res) 239#define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
240#define ccio_allocate_resource(dev, res, size, min, max, align) \ 240#define ccio_allocate_resource(dev, res, size, min, max, align) \
241 allocate_resource(&iomem_resource, res, size, min, max, \ 241 allocate_resource(&iomem_resource, res, size, min, max, \
242 align, NULL, NULL) 242 align, NULL, NULL)
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
index adea65fc43c9..f628ac7de83d 100644
--- a/include/asm-parisc/elf.h
+++ b/include/asm-parisc/elf.h
@@ -220,7 +220,7 @@ typedef struct elf64_fdesc {
220 * macros, and then it includes fs/binfmt_elf.c to provide an alternate 220 * macros, and then it includes fs/binfmt_elf.c to provide an alternate
221 * elf binary handler for 32 bit binaries (on the 64 bit kernel). 221 * elf binary handler for 32 bit binaries (on the 64 bit kernel).
222 */ 222 */
223#ifdef __LP64__ 223#ifdef CONFIG_64BIT
224#define ELF_CLASS ELFCLASS64 224#define ELF_CLASS ELFCLASS64
225#else 225#else
226#define ELF_CLASS ELFCLASS32 226#define ELF_CLASS ELFCLASS32
diff --git a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
index 106d3f7cd882..76d880dc4bae 100644
--- a/include/asm-parisc/hardware.h
+++ b/include/asm-parisc/hardware.h
@@ -1,19 +1,13 @@
1#ifndef _PARISC_HARDWARE_H 1#ifndef _PARISC_HARDWARE_H
2#define _PARISC_HARDWARE_H 2#define _PARISC_HARDWARE_H
3 3
4#include <linux/mod_devicetable.h>
4#include <asm/pdc.h> 5#include <asm/pdc.h>
5 6
6struct parisc_device_id { 7#define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID
7 unsigned char hw_type; /* 5 bits used */ 8#define HVERSION_ANY_ID PA_HVERSION_ANY_ID
8 unsigned char hversion_rev; /* 4 bits */ 9#define HVERSION_REV_ANY_ID PA_HVERSION_REV_ANY_ID
9 unsigned short hversion; /* 12 bits */ 10#define SVERSION_ANY_ID PA_SVERSION_ANY_ID
10 unsigned int sversion; /* 20 bits */
11};
12
13#define HWTYPE_ANY_ID 0xff
14#define HVERSION_REV_ANY_ID 0xff
15#define HVERSION_ANY_ID 0xffff
16#define SVERSION_ANY_ID 0xffffffffU
17 11
18struct hp_hardware { 12struct hp_hardware {
19 unsigned short hw_type:5; /* HPHW_xxx */ 13 unsigned short hw_type:5; /* HPHW_xxx */
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
index c1963ce19dd2..c0fed91da3a2 100644
--- a/include/asm-parisc/io.h
+++ b/include/asm-parisc/io.h
@@ -67,7 +67,7 @@ static inline unsigned long long gsc_readq(unsigned long addr)
67{ 67{
68 unsigned long long ret; 68 unsigned long long ret;
69 69
70#ifdef __LP64__ 70#ifdef CONFIG_64BIT
71 __asm__ __volatile__( 71 __asm__ __volatile__(
72 " ldda 0(%1),%0\n" 72 " ldda 0(%1),%0\n"
73 : "=r" (ret) : "r" (addr) ); 73 : "=r" (ret) : "r" (addr) );
@@ -108,7 +108,7 @@ static inline void gsc_writel(unsigned int val, unsigned long addr)
108 108
109static inline void gsc_writeq(unsigned long long val, unsigned long addr) 109static inline void gsc_writeq(unsigned long long val, unsigned long addr)
110{ 110{
111#ifdef __LP64__ 111#ifdef CONFIG_64BIT
112 __asm__ __volatile__( 112 __asm__ __volatile__(
113 " stda %0,0(%1)\n" 113 " stda %0,0(%1)\n"
114 : : "r" (val), "r" (addr) ); 114 : : "r" (val), "r" (addr) );
@@ -191,15 +191,6 @@ void memset_io(volatile void __iomem *addr, unsigned char val, int count);
191void memcpy_fromio(void *dst, const volatile void __iomem *src, int count); 191void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
192void memcpy_toio(volatile void __iomem *dst, const void *src, int count); 192void memcpy_toio(volatile void __iomem *dst, const void *src, int count);
193 193
194/*
195 * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and
196 * just copy it. The net code will then do the checksum later. Presently
197 * only used by some shared memory 8390 Ethernet cards anyway.
198 */
199
200#define eth_io_copy_and_sum(skb,src,len,unused) \
201 memcpy_fromio((skb)->data,(src),(len))
202
203/* Port-space IO */ 194/* Port-space IO */
204 195
205#define inb_p inb 196#define inb_p inb
diff --git a/include/asm-parisc/led.h b/include/asm-parisc/led.h
index efadfd543ec6..c3405ab9d60a 100644
--- a/include/asm-parisc/led.h
+++ b/include/asm-parisc/led.h
@@ -31,7 +31,7 @@ void __init register_led_regions(void);
31 31
32#ifdef CONFIG_CHASSIS_LCD_LED 32#ifdef CONFIG_CHASSIS_LCD_LED
33/* writes a string to the LCD display (if possible on this h/w) */ 33/* writes a string to the LCD display (if possible on this h/w) */
34int lcd_print(char *str); 34int lcd_print(const char *str);
35#else 35#else
36#define lcd_print(str) 36#define lcd_print(str)
37#endif 37#endif
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h
index 291c2d01c44f..7a09d911b538 100644
--- a/include/asm-parisc/linkage.h
+++ b/include/asm-parisc/linkage.h
@@ -1,6 +1,28 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef __ASM_PARISC_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define __ASM_PARISC_LINKAGE_H
3 3
4/* Nothing to see here... */ 4#ifndef __ALIGN
5#define __ALIGN .align 4
6#define __ALIGN_STR ".align 4"
7#endif
8
9/*
10 * In parisc assembly a semicolon marks a comment while a
11 * exclamation mark is used to seperate independend lines.
12 */
13#define ENTRY(name) \
14 .export name !\
15 ALIGN !\
16name:
5 17
18#ifdef CONFIG_64BIT
19#define ENDPROC(name) \
20 END(name)
21#else
22#define ENDPROC(name) \
23 .type name, @function !\
24 END(name)
6#endif 25#endif
26
27
28#endif /* __ASM_PARISC_LINKAGE_H */
diff --git a/include/asm-parisc/mman.h b/include/asm-parisc/mman.h
index 0ef15ee0f17e..defe752cc996 100644
--- a/include/asm-parisc/mman.h
+++ b/include/asm-parisc/mman.h
@@ -55,7 +55,6 @@
55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ 55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */
56 56
57/* compatibility flags */ 57/* compatibility flags */
58#define MAP_ANON MAP_ANONYMOUS
59#define MAP_FILE 0 58#define MAP_FILE 0
60#define MAP_VARIABLE 0 59#define MAP_VARIABLE 0
61 60
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h
index c87813662d4d..9608d2cf214a 100644
--- a/include/asm-parisc/mmzone.h
+++ b/include/asm-parisc/mmzone.h
@@ -35,7 +35,7 @@ extern struct node_map_data node_data[];
35#define PFNNID_MAP_MAX 512 /* support 512GB */ 35#define PFNNID_MAP_MAX 512 /* support 512GB */
36extern unsigned char pfnnid_map[PFNNID_MAP_MAX]; 36extern unsigned char pfnnid_map[PFNNID_MAP_MAX];
37 37
38#ifndef __LP64__ 38#ifndef CONFIG_64BIT
39#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT)) 39#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT))
40#else 40#else
41/* io can be 0xf0f0f0f0f0xxxxxx or 0xfffffffff0000000 */ 41/* io can be 0xf0f0f0f0f0xxxxxx or 0xfffffffff0000000 */
diff --git a/include/asm-parisc/module.h b/include/asm-parisc/module.h
index 00f06885f843..c2cb49e934c1 100644
--- a/include/asm-parisc/module.h
+++ b/include/asm-parisc/module.h
@@ -3,7 +3,7 @@
3/* 3/*
4 * This file contains the parisc architecture specific module code. 4 * This file contains the parisc architecture specific module code.
5 */ 5 */
6#ifdef __LP64__ 6#ifdef CONFIG_64BIT
7#define Elf_Shdr Elf64_Shdr 7#define Elf_Shdr Elf64_Shdr
8#define Elf_Sym Elf64_Sym 8#define Elf_Sym Elf64_Sym
9#define Elf_Ehdr Elf64_Ehdr 9#define Elf_Ehdr Elf64_Ehdr
diff --git a/include/asm-parisc/msgbuf.h b/include/asm-parisc/msgbuf.h
index 14ffc2782f1e..fe88f2649418 100644
--- a/include/asm-parisc/msgbuf.h
+++ b/include/asm-parisc/msgbuf.h
@@ -13,15 +13,15 @@
13 13
14struct msqid64_ds { 14struct msqid64_ds {
15 struct ipc64_perm msg_perm; 15 struct ipc64_perm msg_perm;
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t msg_stime; /* last msgsnd time */ 19 __kernel_time_t msg_stime; /* last msgsnd time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t msg_rtime; /* last msgrcv time */ 23 __kernel_time_t msg_rtime; /* last msgrcv time */
24#ifndef __LP64__ 24#ifndef CONFIG_64BIT
25 unsigned int __pad3; 25 unsigned int __pad3;
26#endif 26#endif
27 __kernel_time_t msg_ctime; /* last change time */ 27 __kernel_time_t msg_ctime; /* last change time */
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
index 3567208191e3..f6bba4c13664 100644
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -105,7 +105,7 @@ extern int npmem_ranges;
105/* WARNING: The definitions below must match exactly to sizeof(pte_t) 105/* WARNING: The definitions below must match exactly to sizeof(pte_t)
106 * etc 106 * etc
107 */ 107 */
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109#define BITS_PER_PTE_ENTRY 3 109#define BITS_PER_PTE_ENTRY 3
110#define BITS_PER_PMD_ENTRY 2 110#define BITS_PER_PMD_ENTRY 2
111#define BITS_PER_PGD_ENTRY 2 111#define BITS_PER_PGD_ENTRY 2
@@ -127,7 +127,11 @@ extern int npmem_ranges;
127/* This governs the relationship between virtual and physical addresses. 127/* This governs the relationship between virtual and physical addresses.
128 * If you alter it, make sure to take care of our various fixed mapping 128 * If you alter it, make sure to take care of our various fixed mapping
129 * segments in fixmap.h */ 129 * segments in fixmap.h */
130#define __PAGE_OFFSET (0x10000000) 130#ifdef CONFIG_64BIT
131#define __PAGE_OFFSET (0x40000000) /* 1GB */
132#else
133#define __PAGE_OFFSET (0x10000000) /* 256MB */
134#endif
131 135
132#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 136#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
133 137
diff --git a/include/asm-parisc/parisc-device.h b/include/asm-parisc/parisc-device.h
index e12624d8941d..7aa13f2add7a 100644
--- a/include/asm-parisc/parisc-device.h
+++ b/include/asm-parisc/parisc-device.h
@@ -15,7 +15,7 @@ struct parisc_device {
15 unsigned int num_addrs; /* some devices have additional address ranges. */ 15 unsigned int num_addrs; /* some devices have additional address ranges. */
16 unsigned long *addr; /* which will be stored here */ 16 unsigned long *addr; /* which will be stored here */
17 17
18#ifdef __LP64__ 18#ifdef CONFIG_64BIT
19 /* parms for pdc_pat_cell_module() call */ 19 /* parms for pdc_pat_cell_module() call */
20 unsigned long pcell_loc; /* Physical Cell location */ 20 unsigned long pcell_loc; /* Physical Cell location */
21 unsigned long mod_index; /* PAT specific - Misc Module info */ 21 unsigned long mod_index; /* PAT specific - Misc Module info */
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
index 423c2b84b4a0..876fd8116d4a 100644
--- a/include/asm-parisc/pdc.h
+++ b/include/asm-parisc/pdc.h
@@ -341,7 +341,7 @@ struct pdc_model { /* for PDC_MODEL */
341 341
342struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ 342struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
343 unsigned long 343 unsigned long
344#ifdef __LP64__ 344#ifdef CONFIG_64BIT
345 cc_padW:32, 345 cc_padW:32,
346#endif 346#endif
347 cc_alias: 4, /* alias boundaries for virtual addresses */ 347 cc_alias: 4, /* alias boundaries for virtual addresses */
@@ -357,7 +357,7 @@ struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
357 357
358struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ 358struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */
359 unsigned long tc_pad0:12, /* reserved */ 359 unsigned long tc_pad0:12, /* reserved */
360#ifdef __LP64__ 360#ifdef CONFIG_64BIT
361 tc_padW:32, 361 tc_padW:32,
362#endif 362#endif
363 tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */ 363 tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */
@@ -445,7 +445,7 @@ struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */
445 445
446#endif /* !CONFIG_PA20 */ 446#endif /* !CONFIG_PA20 */
447 447
448#ifdef __LP64__ 448#ifdef CONFIG_64BIT
449struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */ 449struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */
450 unsigned long entries_returned; 450 unsigned long entries_returned;
451 unsigned long entries_total; 451 unsigned long entries_total;
@@ -456,7 +456,7 @@ struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */
456 unsigned int pages; 456 unsigned int pages;
457 unsigned int reserved; 457 unsigned int reserved;
458}; 458};
459#endif /* __LP64__ */ 459#endif /* CONFIG_64BIT */
460 460
461struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */ 461struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
462 unsigned long mod_addr; 462 unsigned long mod_addr;
@@ -752,7 +752,7 @@ int pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
752int pdc_tod_read(struct pdc_tod *tod); 752int pdc_tod_read(struct pdc_tod *tod);
753int pdc_tod_set(unsigned long sec, unsigned long usec); 753int pdc_tod_set(unsigned long sec, unsigned long usec);
754 754
755#ifdef __LP64__ 755#ifdef CONFIG_64BIT
756int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr, 756int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
757 struct pdc_memory_table *tbl, unsigned long entries); 757 struct pdc_memory_table *tbl, unsigned long entries);
758#endif 758#endif
diff --git a/include/asm-parisc/pdcpat.h b/include/asm-parisc/pdcpat.h
index b4b34c0e8c1a..47539f117958 100644
--- a/include/asm-parisc/pdcpat.h
+++ b/include/asm-parisc/pdcpat.h
@@ -250,7 +250,7 @@ struct pdc_pat_pd_addr_map_entry {
250#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL) 250#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
251#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL) 251#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
252#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL) 252#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
253#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL) 253#define PAT_GET_MOD_PAGES(value) ((value) & 0xffffffUL)
254 254
255 255
256/* 256/*
@@ -303,35 +303,6 @@ extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 va
303*/ 303*/
304extern int pdc_pat; /* arch/parisc/kernel/inventory.c */ 304extern int pdc_pat; /* arch/parisc/kernel/inventory.c */
305 305
306/********************************************************************
307* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
308* ----------------------------------------------------------
309* Bit 0 to 51 - conf_base_addr
310* Bit 52 to 62 - reserved
311* Bit 63 - endianess bit
312********************************************************************/
313#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
314
315/********************************************************************
316* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
317* ----------------------------------------------------
318* Bit 0 to 7 - entity type
319* 0 = central agent, 1 = processor,
320* 2 = memory controller, 3 = system bus adapter,
321* 4 = local bus adapter, 5 = processor bus converter,
322* 6 = crossbar fabric connect, 7 = fabric interconnect,
323* 8 to 254 reserved, 255 = unknown.
324* Bit 8 to 15 - DVI
325* Bit 16 to 23 - IOC functions
326* Bit 24 to 39 - reserved
327* Bit 40 to 63 - mod_pages
328* number of 4K pages a module occupies starting at conf_base_addr
329********************************************************************/
330#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
331#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
332#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
333#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL)
334
335#endif /* __ASSEMBLY__ */ 306#endif /* __ASSEMBLY__ */
336 307
337#endif /* ! __PARISC_PATPDC_H */ 308#endif /* ! __PARISC_PATPDC_H */
diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h
index 3122fad38a1b..1af1a41e0723 100644
--- a/include/asm-parisc/pgalloc.h
+++ b/include/asm-parisc/pgalloc.h
@@ -14,7 +14,7 @@
14 * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we 14 * Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we
15 * allocate the first pmd adjacent to the pgd. This means that we can 15 * allocate the first pmd adjacent to the pgd. This means that we can
16 * subtract a constant offset to get to it. The pmd and pgd sizes are 16 * subtract a constant offset to get to it. The pmd and pgd sizes are
17 * arranged so that a single pmd covers 4GB (giving a full LP64 17 * arranged so that a single pmd covers 4GB (giving a full 64-bit
18 * process access to 8TB) so our lookups are effectively L2 for the 18 * process access to 8TB) so our lookups are effectively L2 for the
19 * first 4GB of the kernel (i.e. for all ILP32 processes and all the 19 * first 4GB of the kernel (i.e. for all ILP32 processes and all the
20 * kernel for machines with under 4GB of memory) */ 20 * kernel for machines with under 4GB of memory) */
@@ -26,7 +26,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
26 26
27 if (likely(pgd != NULL)) { 27 if (likely(pgd != NULL)) {
28 memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER); 28 memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
29#ifdef __LP64__ 29#ifdef CONFIG_64BIT
30 actual_pgd += PTRS_PER_PGD; 30 actual_pgd += PTRS_PER_PGD;
31 /* Populate first pmd with allocated memory. We mark it 31 /* Populate first pmd with allocated memory. We mark it
32 * with PxD_FLAG_ATTACHED as a signal to the system that this 32 * with PxD_FLAG_ATTACHED as a signal to the system that this
@@ -45,7 +45,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
45 45
46static inline void pgd_free(pgd_t *pgd) 46static inline void pgd_free(pgd_t *pgd)
47{ 47{
48#ifdef __LP64__ 48#ifdef CONFIG_64BIT
49 pgd -= PTRS_PER_PGD; 49 pgd -= PTRS_PER_PGD;
50#endif 50#endif
51 free_pages((unsigned long)pgd, PGD_ALLOC_ORDER); 51 free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
72 72
73static inline void pmd_free(pmd_t *pmd) 73static inline void pmd_free(pmd_t *pmd)
74{ 74{
75#ifdef __LP64__ 75#ifdef CONFIG_64BIT
76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
77 /* This is the permanent pmd attached to the pgd; 77 /* This is the permanent pmd attached to the pgd;
78 * cannot free it */ 78 * cannot free it */
@@ -99,7 +99,7 @@ static inline void pmd_free(pmd_t *pmd)
99static inline void 99static inline void
100pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) 100pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
101{ 101{
102#ifdef __LP64__ 102#ifdef CONFIG_64BIT
103 /* preserve the gateway marker if this is the beginning of 103 /* preserve the gateway marker if this is the beginning of
104 * the permanent pmd */ 104 * the permanent pmd */
105 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 105 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index c0b61e0d1497..d7e1b10da5c6 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -10,7 +10,6 @@
10 * we simulate an x86-style page table for the linux mm code 10 * we simulate an x86-style page table for the linux mm code
11 */ 11 */
12 12
13#include <linux/spinlock.h>
14#include <linux/mm.h> /* for vm_area_struct */ 13#include <linux/mm.h> /* for vm_area_struct */
15#include <asm/processor.h> 14#include <asm/processor.h>
16#include <asm/cache.h> 15#include <asm/cache.h>
diff --git a/include/asm-parisc/posix_types.h b/include/asm-parisc/posix_types.h
index 9b19970de619..b634e3c47fdc 100644
--- a/include/asm-parisc/posix_types.h
+++ b/include/asm-parisc/posix_types.h
@@ -20,7 +20,7 @@ typedef int __kernel_timer_t;
20typedef int __kernel_clockid_t; 20typedef int __kernel_clockid_t;
21typedef int __kernel_daddr_t; 21typedef int __kernel_daddr_t;
22/* Note these change from narrow to wide kernels */ 22/* Note these change from narrow to wide kernels */
23#ifdef __LP64__ 23#ifdef CONFIG_64BIT
24typedef unsigned long __kernel_size_t; 24typedef unsigned long __kernel_size_t;
25typedef long __kernel_ssize_t; 25typedef long __kernel_ssize_t;
26typedef long __kernel_ptrdiff_t; 26typedef long __kernel_ptrdiff_t;
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
index fd7866dc8c83..d2f396721d3e 100644
--- a/include/asm-parisc/processor.h
+++ b/include/asm-parisc/processor.h
@@ -9,13 +9,10 @@
9#define __ASM_PARISC_PROCESSOR_H 9#define __ASM_PARISC_PROCESSOR_H
10 10
11#ifndef __ASSEMBLY__ 11#ifndef __ASSEMBLY__
12#include <asm/prefetch.h> /* lockdep.h needs <linux/prefetch.h> */
13
14#include <linux/threads.h> 12#include <linux/threads.h>
15#include <linux/spinlock_types.h>
16 13
14#include <asm/prefetch.h>
17#include <asm/hardware.h> 15#include <asm/hardware.h>
18#include <asm/page.h>
19#include <asm/pdc.h> 16#include <asm/pdc.h>
20#include <asm/ptrace.h> 17#include <asm/ptrace.h>
21#include <asm/types.h> 18#include <asm/types.h>
@@ -41,7 +38,7 @@
41#define DEFAULT_TASK_SIZE32 (0xFFF00000UL) 38#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
42#define DEFAULT_MAP_BASE32 (0x40000000UL) 39#define DEFAULT_MAP_BASE32 (0x40000000UL)
43 40
44#ifdef __LP64__ 41#ifdef CONFIG_64BIT
45#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000) 42#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
46#define DEFAULT_MAP_BASE (0x200000000UL) 43#define DEFAULT_MAP_BASE (0x200000000UL)
47#else 44#else
@@ -87,7 +84,6 @@ struct cpuinfo_parisc {
87 unsigned long hpa; /* Host Physical address */ 84 unsigned long hpa; /* Host Physical address */
88 unsigned long txn_addr; /* MMIO addr of EIR or id_eid */ 85 unsigned long txn_addr; /* MMIO addr of EIR or id_eid */
89#ifdef CONFIG_SMP 86#ifdef CONFIG_SMP
90 spinlock_t lock; /* synchronization for ipi's */
91 unsigned long pending_ipi; /* bitmap of type ipi_message_type */ 87 unsigned long pending_ipi; /* bitmap of type ipi_message_type */
92 unsigned long ipi_count; /* number ipi Interrupts */ 88 unsigned long ipi_count; /* number ipi Interrupts */
93#endif 89#endif
@@ -277,7 +273,7 @@ on downward growing arches, it looks like this:
277 * it in here from the current->personality 273 * it in here from the current->personality
278 */ 274 */
279 275
280#ifdef __LP64__ 276#ifdef CONFIG_64BIT
281#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT)) 277#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
282#else 278#else
283#define USER_WIDE_MODE 0 279#define USER_WIDE_MODE 0
diff --git a/include/asm-parisc/sembuf.h b/include/asm-parisc/sembuf.h
index 1083368ef8db..1e59ffd3bd1e 100644
--- a/include/asm-parisc/sembuf.h
+++ b/include/asm-parisc/sembuf.h
@@ -13,11 +13,11 @@
13 13
14struct semid64_ds { 14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ 15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t sem_otime; /* last semop time */ 19 __kernel_time_t sem_otime; /* last semop time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t sem_ctime; /* last change time */ 23 __kernel_time_t sem_ctime; /* last change time */
diff --git a/include/asm-parisc/shmbuf.h b/include/asm-parisc/shmbuf.h
index 623b6c0c49e6..0a3eada1863b 100644
--- a/include/asm-parisc/shmbuf.h
+++ b/include/asm-parisc/shmbuf.h
@@ -13,19 +13,19 @@
13 13
14struct shmid64_ds { 14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */ 15 struct ipc64_perm shm_perm; /* operation perms */
16#ifndef __LP64__ 16#ifndef CONFIG_64BIT
17 unsigned int __pad1; 17 unsigned int __pad1;
18#endif 18#endif
19 __kernel_time_t shm_atime; /* last attach time */ 19 __kernel_time_t shm_atime; /* last attach time */
20#ifndef __LP64__ 20#ifndef CONFIG_64BIT
21 unsigned int __pad2; 21 unsigned int __pad2;
22#endif 22#endif
23 __kernel_time_t shm_dtime; /* last detach time */ 23 __kernel_time_t shm_dtime; /* last detach time */
24#ifndef __LP64__ 24#ifndef CONFIG_64BIT
25 unsigned int __pad3; 25 unsigned int __pad3;
26#endif 26#endif
27 __kernel_time_t shm_ctime; /* last change time */ 27 __kernel_time_t shm_ctime; /* last change time */
28#ifndef __LP64__ 28#ifndef CONFIG_64BIT
29 unsigned int __pad4; 29 unsigned int __pad4;
30#endif 30#endif
31 size_t shm_segsz; /* size of segment (bytes) */ 31 size_t shm_segsz; /* size of segment (bytes) */
@@ -36,7 +36,7 @@ struct shmid64_ds {
36 unsigned int __unused2; 36 unsigned int __unused2;
37}; 37};
38 38
39#ifdef __LP64__ 39#ifdef CONFIG_64BIT
40/* The 'unsigned int' (formerly 'unsigned long') data types below will 40/* The 'unsigned int' (formerly 'unsigned long') data types below will
41 * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on 41 * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on
42 * a wide kernel, but if some of these values are meant to contain pointers 42 * a wide kernel, but if some of these values are meant to contain pointers
diff --git a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h
index 98a82fa0cfdb..c20356375d1d 100644
--- a/include/asm-parisc/signal.h
+++ b/include/asm-parisc/signal.h
@@ -105,7 +105,7 @@
105struct siginfo; 105struct siginfo;
106 106
107/* Type of a signal handler. */ 107/* Type of a signal handler. */
108#ifdef __LP64__ 108#ifdef CONFIG_64BIT
109/* function pointers on 64-bit parisc are pointers to little structs and the 109/* function pointers on 64-bit parisc are pointers to little structs and the
110 * compiler doesn't support code which changes or tests the address of 110 * compiler doesn't support code which changes or tests the address of
111 * the function in the little struct. This is really ugly -PB 111 * the function in the little struct. This is really ugly -PB
diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
index d4c0e26afcd1..306f4950e32e 100644
--- a/include/asm-parisc/smp.h
+++ b/include/asm-parisc/smp.h
@@ -41,14 +41,6 @@ extern void smp_send_all_nop(void);
41 41
42#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */ 42#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */
43 43
44#undef ENTRY_SYS_CPUS
45#ifdef ENTRY_SYS_CPUS
46#define STATE_RENDEZVOUS 0
47#define STATE_STOPPED 1
48#define STATE_RUNNING 2
49#define STATE_HALTED 3
50#endif
51
52extern unsigned long cpu_present_mask; 44extern unsigned long cpu_present_mask;
53 45
54#define raw_smp_processor_id() (current_thread_info()->cpu) 46#define raw_smp_processor_id() (current_thread_info()->cpu)
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index ce2eae1708b5..99e868f6a8f5 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -33,6 +33,8 @@
33#define SO_PEERCRED 0x4011 33#define SO_PEERCRED 0x4011
34#define SO_TIMESTAMP 0x4012 34#define SO_TIMESTAMP 0x4012
35#define SCM_TIMESTAMP SO_TIMESTAMP 35#define SCM_TIMESTAMP SO_TIMESTAMP
36#define SO_TIMESTAMPNS 0x4013
37#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
36 38
37/* Security levels - as per NRL IPv6 - don't actually do anything */ 39/* Security levels - as per NRL IPv6 - don't actually do anything */
38#define SO_SECURITY_AUTHENTICATION 0x4016 40#define SO_SECURITY_AUTHENTICATION 0x4016
diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h
index aace49629949..dabfbc7483f6 100644
--- a/include/asm-parisc/sockios.h
+++ b/include/asm-parisc/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h
index d6b479bdb886..3f72f47cf4b2 100644
--- a/include/asm-parisc/spinlock_types.h
+++ b/include/asm-parisc/spinlock_types.h
@@ -1,10 +1,6 @@
1#ifndef __ASM_SPINLOCK_TYPES_H 1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H 2#define __ASM_SPINLOCK_TYPES_H
3 3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct { 4typedef struct {
9#ifdef CONFIG_PA20 5#ifdef CONFIG_PA20
10 volatile unsigned int slock; 6 volatile unsigned int slock;
diff --git a/include/asm-parisc/statfs.h b/include/asm-parisc/statfs.h
index a52d8f93f05c..1d2b8130b23d 100644
--- a/include/asm-parisc/statfs.h
+++ b/include/asm-parisc/statfs.h
@@ -30,11 +30,11 @@ struct statfs {
30struct statfs64 { 30struct statfs64 {
31 long f_type; 31 long f_type;
32 long f_bsize; 32 long f_bsize;
33 u64 f_blocks; 33 __u64 f_blocks;
34 u64 f_bfree; 34 __u64 f_bfree;
35 u64 f_bavail; 35 __u64 f_bavail;
36 u64 f_files; 36 __u64 f_files;
37 u64 f_ffree; 37 __u64 f_ffree;
38 __kernel_fsid_t f_fsid; 38 __kernel_fsid_t f_fsid;
39 long f_namelen; 39 long f_namelen;
40 long f_frsize; 40 long f_frsize;
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
index 74f037a39e6f..7e9afa720d43 100644
--- a/include/asm-parisc/system.h
+++ b/include/asm-parisc/system.h
@@ -34,7 +34,7 @@ struct pa_psw {
34 unsigned int i:1; 34 unsigned int i:1;
35}; 35};
36 36
37#ifdef __LP64__ 37#ifdef CONFIG_64BIT
38#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4)) 38#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4))
39#else 39#else
40#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW)) 40#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW))
diff --git a/include/asm-parisc/termios.h b/include/asm-parisc/termios.h
index 6965e8f6c3e1..5345b3420475 100644
--- a/include/asm-parisc/termios.h
+++ b/include/asm-parisc/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61 43
62/* intr=^C quit=^\ erase=del kill=^U 44/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h
index f2f83b04cd8b..949314cf6188 100644
--- a/include/asm-parisc/thread_info.h
+++ b/include/asm-parisc/thread_info.h
@@ -62,6 +62,7 @@ struct thread_info {
62#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 62#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling TIF_NEED_RESCHED */
63#define TIF_32BIT 5 /* 32 bit binary */ 63#define TIF_32BIT 5 /* 32 bit binary */
64#define TIF_MEMDIE 6 64#define TIF_MEMDIE 6
65#define TIF_RESTORE_SIGMASK 7 /* restore saved signal mask */
65 66
66#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 67#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
67#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 68#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
@@ -69,9 +70,10 @@ struct thread_info {
69#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 70#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
70#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 71#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
71#define _TIF_32BIT (1 << TIF_32BIT) 72#define _TIF_32BIT (1 << TIF_32BIT)
73#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
72 74
73#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \ 75#define _TIF_USER_WORK_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
74 _TIF_NEED_RESCHED) 76 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
75 77
76#endif /* __KERNEL__ */ 78#endif /* __KERNEL__ */
77 79
diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h
index f662e837dea1..3313da9ea00f 100644
--- a/include/asm-parisc/tlbflush.h
+++ b/include/asm-parisc/tlbflush.h
@@ -73,33 +73,11 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
73 purge_tlb_end(); 73 purge_tlb_end();
74} 74}
75 75
76static inline void flush_tlb_range(struct vm_area_struct *vma, 76void __flush_tlb_range(unsigned long sid,
77 unsigned long start, unsigned long end) 77 unsigned long start, unsigned long end);
78{
79 unsigned long npages;
80 78
81 npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT; 79#define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end)
82 if (npages >= 512) /* 2MB of space: arbitrary, should be tuned */
83 flush_tlb_all();
84 else {
85 mtsp(vma->vm_mm->context,1);
86 purge_tlb_start();
87 if (split_tlb) {
88 while (npages--) {
89 pdtlb(start);
90 pitlb(start);
91 start += PAGE_SIZE;
92 }
93 } else {
94 while (npages--) {
95 pdtlb(start);
96 start += PAGE_SIZE;
97 }
98 }
99 purge_tlb_end();
100 }
101}
102 80
103#define flush_tlb_kernel_range(start, end) flush_tlb_all() 81#define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end)
104 82
105#endif 83#endif
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
index 34fdce361a5a..d4aa33033d98 100644
--- a/include/asm-parisc/types.h
+++ b/include/asm-parisc/types.h
@@ -31,7 +31,7 @@ typedef unsigned long long __u64;
31 */ 31 */
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33 33
34#ifdef __LP64__ 34#ifdef CONFIG_64BIT
35#define BITS_PER_LONG 64 35#define BITS_PER_LONG 64
36#define SHIFT_PER_LONG 6 36#define SHIFT_PER_LONG 6
37#else 37#else
diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
index d973e8b3466c..4878b9501f24 100644
--- a/include/asm-parisc/uaccess.h
+++ b/include/asm-parisc/uaccess.h
@@ -4,7 +4,6 @@
4/* 4/*
5 * User space memory access functions 5 * User space memory access functions
6 */ 6 */
7#include <linux/sched.h>
8#include <asm/page.h> 7#include <asm/page.h>
9#include <asm/system.h> 8#include <asm/system.h>
10#include <asm/cache.h> 9#include <asm/cache.h>
@@ -43,16 +42,18 @@ static inline long access_ok(int type, const void __user * addr,
43#define put_user __put_user 42#define put_user __put_user
44#define get_user __get_user 43#define get_user __get_user
45 44
46#if BITS_PER_LONG == 32 45#if !defined(CONFIG_64BIT)
47#define LDD_KERNEL(ptr) __get_kernel_bad(); 46#define LDD_KERNEL(ptr) __get_kernel_bad();
48#define LDD_USER(ptr) __get_user_bad(); 47#define LDD_USER(ptr) __get_user_bad();
49#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) 48#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr)
50#define STD_USER(x, ptr) __put_user_asm64(x,ptr) 49#define STD_USER(x, ptr) __put_user_asm64(x,ptr)
50#define ASM_WORD_INSN ".word\t"
51#else 51#else
52#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr) 52#define LDD_KERNEL(ptr) __get_kernel_asm("ldd",ptr)
53#define LDD_USER(ptr) __get_user_asm("ldd",ptr) 53#define LDD_USER(ptr) __get_user_asm("ldd",ptr)
54#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr) 54#define STD_KERNEL(x, ptr) __put_kernel_asm("std",x,ptr)
55#define STD_USER(x, ptr) __put_user_asm("std",x,ptr) 55#define STD_USER(x, ptr) __put_user_asm("std",x,ptr)
56#define ASM_WORD_INSN ".dword\t"
56#endif 57#endif
57 58
58/* 59/*
@@ -66,6 +67,11 @@ struct exception_table_entry {
66 long fixup; /* fixup routine */ 67 long fixup; /* fixup routine */
67}; 68};
68 69
70#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
71 ".section __ex_table,\"aw\"\n" \
72 ASM_WORD_INSN #fault_addr ", " #except_addr "\n\t" \
73 ".previous\n"
74
69/* 75/*
70 * The page fault handler stores, in a per-cpu area, the following information 76 * The page fault handler stores, in a per-cpu area, the following information
71 * if a fixup routine is available. 77 * if a fixup routine is available.
@@ -104,43 +110,19 @@ struct exception_data {
104 __gu_err; \ 110 __gu_err; \
105}) 111})
106 112
107#ifdef __LP64__
108#define __get_kernel_asm(ldx,ptr) \
109 __asm__("\n1:\t" ldx "\t0(%2),%0\n" \
110 "\t.section __ex_table,\"aw\"\n" \
111 "\t.dword\t1b,fixup_get_user_skip_1\n" \
112 "\t.previous" \
113 : "=r"(__gu_val), "=r"(__gu_err) \
114 : "r"(ptr), "1"(__gu_err) \
115 : "r1");
116
117#define __get_user_asm(ldx,ptr) \
118 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \
119 "\t.section __ex_table,\"aw\"\n" \
120 "\t.dword\t1b,fixup_get_user_skip_1\n" \
121 "\t.previous" \
122 : "=r"(__gu_val), "=r"(__gu_err) \
123 : "r"(ptr), "1"(__gu_err) \
124 : "r1");
125#else
126#define __get_kernel_asm(ldx,ptr) \ 113#define __get_kernel_asm(ldx,ptr) \
127 __asm__("\n1:\t" ldx "\t0(%2),%0\n" \ 114 __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \
128 "\t.section __ex_table,\"aw\"\n" \ 115 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
129 "\t.word\t1b,fixup_get_user_skip_1\n" \
130 "\t.previous" \
131 : "=r"(__gu_val), "=r"(__gu_err) \ 116 : "=r"(__gu_val), "=r"(__gu_err) \
132 : "r"(ptr), "1"(__gu_err) \ 117 : "r"(ptr), "1"(__gu_err) \
133 : "r1"); 118 : "r1");
134 119
135#define __get_user_asm(ldx,ptr) \ 120#define __get_user_asm(ldx,ptr) \
136 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n" \ 121 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \
137 "\t.section __ex_table,\"aw\"\n" \ 122 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\
138 "\t.word\t1b,fixup_get_user_skip_1\n" \
139 "\t.previous" \
140 : "=r"(__gu_val), "=r"(__gu_err) \ 123 : "=r"(__gu_val), "=r"(__gu_err) \
141 : "r"(ptr), "1"(__gu_err) \ 124 : "r"(ptr), "1"(__gu_err) \
142 : "r1"); 125 : "r1");
143#endif /* !__LP64__ */
144 126
145#define __put_user(x,ptr) \ 127#define __put_user(x,ptr) \
146({ \ 128({ \
@@ -179,80 +161,54 @@ struct exception_data {
179 * r8/r9 are already listed as err/val. 161 * r8/r9 are already listed as err/val.
180 */ 162 */
181 163
182#ifdef __LP64__
183#define __put_kernel_asm(stx,x,ptr) \ 164#define __put_kernel_asm(stx,x,ptr) \
184 __asm__ __volatile__ ( \ 165 __asm__ __volatile__ ( \
185 "\n1:\t" stx "\t%2,0(%1)\n" \ 166 "\n1:\t" stx "\t%2,0(%1)\n\t" \
186 "\t.section __ex_table,\"aw\"\n" \ 167 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
187 "\t.dword\t1b,fixup_put_user_skip_1\n" \
188 "\t.previous" \
189 : "=r"(__pu_err) \ 168 : "=r"(__pu_err) \
190 : "r"(ptr), "r"(x), "0"(__pu_err) \ 169 : "r"(ptr), "r"(x), "0"(__pu_err) \
191 : "r1") 170 : "r1")
192 171
193#define __put_user_asm(stx,x,ptr) \ 172#define __put_user_asm(stx,x,ptr) \
194 __asm__ __volatile__ ( \ 173 __asm__ __volatile__ ( \
195 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \ 174 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \
196 "\t.section __ex_table,\"aw\"\n" \ 175 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
197 "\t.dword\t1b,fixup_put_user_skip_1\n" \
198 "\t.previous" \
199 : "=r"(__pu_err) \
200 : "r"(ptr), "r"(x), "0"(__pu_err) \
201 : "r1")
202#else
203#define __put_kernel_asm(stx,x,ptr) \
204 __asm__ __volatile__ ( \
205 "\n1:\t" stx "\t%2,0(%1)\n" \
206 "\t.section __ex_table,\"aw\"\n" \
207 "\t.word\t1b,fixup_put_user_skip_1\n" \
208 "\t.previous" \
209 : "=r"(__pu_err) \ 176 : "=r"(__pu_err) \
210 : "r"(ptr), "r"(x), "0"(__pu_err) \ 177 : "r"(ptr), "r"(x), "0"(__pu_err) \
211 : "r1") 178 : "r1")
212 179
213#define __put_user_asm(stx,x,ptr) \
214 __asm__ __volatile__ ( \
215 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n" \
216 "\t.section __ex_table,\"aw\"\n" \
217 "\t.word\t1b,fixup_put_user_skip_1\n" \
218 "\t.previous" \
219 : "=r"(__pu_err) \
220 : "r"(ptr), "r"(x), "0"(__pu_err) \
221 : "r1")
222 180
223#define __put_kernel_asm64(__val,ptr) do { \ 181#if !defined(CONFIG_64BIT)
224 u64 __val64 = (u64)(__val); \ 182
225 u32 hi = (__val64) >> 32; \ 183#define __put_kernel_asm64(__val,ptr) do { \
226 u32 lo = (__val64) & 0xffffffff; \ 184 u64 __val64 = (u64)(__val); \
185 u32 hi = (__val64) >> 32; \
186 u32 lo = (__val64) & 0xffffffff; \
227 __asm__ __volatile__ ( \ 187 __asm__ __volatile__ ( \
228 "\n1:\tstw %2,0(%1)\n" \ 188 "\n1:\tstw %2,0(%1)" \
229 "\n2:\tstw %3,4(%1)\n" \ 189 "\n2:\tstw %3,4(%1)\n\t" \
230 "\t.section __ex_table,\"aw\"\n" \ 190 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
231 "\t.word\t1b,fixup_put_user_skip_2\n" \ 191 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
232 "\t.word\t2b,fixup_put_user_skip_1\n" \
233 "\t.previous" \
234 : "=r"(__pu_err) \ 192 : "=r"(__pu_err) \
235 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 193 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
236 : "r1"); \ 194 : "r1"); \
237} while (0) 195} while (0)
238 196
239#define __put_user_asm64(__val,ptr) do { \ 197#define __put_user_asm64(__val,ptr) do { \
240 u64 __val64 = (u64)__val; \ 198 u64 __val64 = (u64)(__val); \
241 u32 hi = (__val64) >> 32; \ 199 u32 hi = (__val64) >> 32; \
242 u32 lo = (__val64) & 0xffffffff; \ 200 u32 lo = (__val64) & 0xffffffff; \
243 __asm__ __volatile__ ( \ 201 __asm__ __volatile__ ( \
244 "\n1:\tstw %2,0(%%sr3,%1)\n" \ 202 "\n1:\tstw %2,0(%%sr3,%1)" \
245 "\n2:\tstw %3,4(%%sr3,%1)\n" \ 203 "\n2:\tstw %3,4(%%sr3,%1)\n\t" \
246 "\t.section __ex_table,\"aw\"\n" \ 204 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
247 "\t.word\t1b,fixup_get_user_skip_2\n" \ 205 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
248 "\t.word\t2b,fixup_get_user_skip_1\n" \
249 "\t.previous" \
250 : "=r"(__pu_err) \ 206 : "=r"(__pu_err) \
251 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \ 207 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
252 : "r1"); \ 208 : "r1"); \
253} while (0) 209} while (0)
254 210
255#endif /* !__LP64__ */ 211#endif /* !defined(CONFIG_64BIT) */
256 212
257 213
258/* 214/*
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
index 53b0f5d290e4..2f7c40861c91 100644
--- a/include/asm-parisc/unistd.h
+++ b/include/asm-parisc/unistd.h
@@ -772,7 +772,7 @@
772#define __NR_mknodat (__NR_Linux + 277) 772#define __NR_mknodat (__NR_Linux + 277)
773#define __NR_fchownat (__NR_Linux + 278) 773#define __NR_fchownat (__NR_Linux + 278)
774#define __NR_futimesat (__NR_Linux + 279) 774#define __NR_futimesat (__NR_Linux + 279)
775#define __NR_newfstatat (__NR_Linux + 280) 775#define __NR_fstatat64 (__NR_Linux + 280)
776#define __NR_unlinkat (__NR_Linux + 281) 776#define __NR_unlinkat (__NR_Linux + 281)
777#define __NR_renameat (__NR_Linux + 282) 777#define __NR_renameat (__NR_Linux + 282)
778#define __NR_linkat (__NR_Linux + 283) 778#define __NR_linkat (__NR_Linux + 283)
@@ -786,8 +786,14 @@
786#define __NR_splice (__NR_Linux + 291) 786#define __NR_splice (__NR_Linux + 291)
787#define __NR_sync_file_range (__NR_Linux + 292) 787#define __NR_sync_file_range (__NR_Linux + 292)
788#define __NR_tee (__NR_Linux + 293) 788#define __NR_tee (__NR_Linux + 293)
789#define __NR_vmsplice (__NR_Linux + 294)
790#define __NR_move_pages (__NR_Linux + 295)
791#define __NR_getcpu (__NR_Linux + 296)
792#define __NR_epoll_pwait (__NR_Linux + 297)
793#define __NR_statfs64 (__NR_Linux + 298)
794#define __NR_fstatfs64 (__NR_Linux + 299)
789 795
790#define __NR_Linux_syscalls 294 796#define __NR_Linux_syscalls (__NR_fstatfs64 + 1)
791 797
792#define HPUX_GATEWAY_ADDR 0xC0000004 798#define HPUX_GATEWAY_ADDR 0xC0000004
793#define LINUX_GATEWAY_ADDR 0x100 799#define LINUX_GATEWAY_ADDR 0x100
@@ -951,6 +957,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
951#define __ARCH_WANT_SYS_SIGPENDING 957#define __ARCH_WANT_SYS_SIGPENDING
952#define __ARCH_WANT_SYS_SIGPROCMASK 958#define __ARCH_WANT_SYS_SIGPROCMASK
953#define __ARCH_WANT_SYS_RT_SIGACTION 959#define __ARCH_WANT_SYS_RT_SIGACTION
960#define __ARCH_WANT_SYS_RT_SIGSUSPEND
961#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
954 962
955#endif /* __ASSEMBLY__ */ 963#endif /* __ASSEMBLY__ */
956 964
diff --git a/include/asm-powerpc/Kbuild b/include/asm-powerpc/Kbuild
index 703970fb0ec0..4869513b872f 100644
--- a/include/asm-powerpc/Kbuild
+++ b/include/asm-powerpc/Kbuild
@@ -23,6 +23,7 @@ header-y += linkage.h
23header-y += resource.h 23header-y += resource.h
24header-y += sigcontext.h 24header-y += sigcontext.h
25header-y += statfs.h 25header-y += statfs.h
26header-y += ps3fb.h
26 27
27unifdef-y += a.out.h 28unifdef-y += a.out.h
28unifdef-y += asm-compat.h 29unifdef-y += asm-compat.h
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index c89bd58ee283..c19e7367fce6 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -78,6 +78,15 @@
78#define PPC_STLCX stringify_in_c(stdcx.) 78#define PPC_STLCX stringify_in_c(stdcx.)
79#define PPC_CNTLZL stringify_in_c(cntlzd) 79#define PPC_CNTLZL stringify_in_c(cntlzd)
80 80
81/* Move to CR, single-entry optimized version. Only available
82 * on POWER4 and later.
83 */
84#ifdef CONFIG_POWER4_ONLY
85#define PPC_MTOCRF stringify_in_c(mtocrf)
86#else
87#define PPC_MTOCRF stringify_in_c(mtcrf)
88#endif
89
81#else /* 32-bit */ 90#else /* 32-bit */
82 91
83/* operations for longs and pointers */ 92/* operations for longs and pointers */
@@ -89,6 +98,7 @@
89#define PPC_LLARX stringify_in_c(lwarx) 98#define PPC_LLARX stringify_in_c(lwarx)
90#define PPC_STLCX stringify_in_c(stwcx.) 99#define PPC_STLCX stringify_in_c(stwcx.)
91#define PPC_CNTLZL stringify_in_c(cntlzw) 100#define PPC_CNTLZL stringify_in_c(cntlzw)
101#define PPC_MTOCRF stringify_in_c(mtcrf)
92 102
93#endif 103#endif
94 104
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index f038e33e6d48..2ce4b6b7b348 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -165,7 +165,8 @@ static __inline__ int atomic_dec_return(atomic_t *v)
165 return t; 165 return t;
166} 166}
167 167
168#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) 168#define atomic_cmpxchg(v, o, n) \
169 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
169#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) 170#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
170 171
171/** 172/**
@@ -413,6 +414,43 @@ static __inline__ long atomic64_dec_if_positive(atomic64_t *v)
413 return t; 414 return t;
414} 415}
415 416
417#define atomic64_cmpxchg(v, o, n) \
418 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
419#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
420
421/**
422 * atomic64_add_unless - add unless the number is a given value
423 * @v: pointer of type atomic64_t
424 * @a: the amount to add to v...
425 * @u: ...unless v is equal to u.
426 *
427 * Atomically adds @a to @v, so long as it was not @u.
428 * Returns non-zero if @v was not @u, and zero otherwise.
429 */
430static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
431{
432 long t;
433
434 __asm__ __volatile__ (
435 LWSYNC_ON_SMP
436"1: ldarx %0,0,%1 # atomic_add_unless\n\
437 cmpd 0,%0,%3 \n\
438 beq- 2f \n\
439 add %0,%2,%0 \n"
440" stdcx. %0,0,%1 \n\
441 bne- 1b \n"
442 ISYNC_ON_SMP
443" subf %0,%2,%0 \n\
4442:"
445 : "=&r" (t)
446 : "r" (&v->counter), "r" (a), "r" (u)
447 : "cc", "memory");
448
449 return t != u;
450}
451
452#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
453
416#endif /* __powerpc64__ */ 454#endif /* __powerpc64__ */
417 455
418#include <asm-generic/atomic.h> 456#include <asm-generic/atomic.h>
diff --git a/include/asm-powerpc/cacheflush.h b/include/asm-powerpc/cacheflush.h
index 08e93e789219..ba667a383b8c 100644
--- a/include/asm-powerpc/cacheflush.h
+++ b/include/asm-powerpc/cacheflush.h
@@ -64,6 +64,12 @@ extern void flush_dcache_phys_range(unsigned long start, unsigned long stop);
64 memcpy(dst, src, len) 64 memcpy(dst, src, len)
65 65
66 66
67
68#ifdef CONFIG_DEBUG_PAGEALLOC
69/* internal debugging function */
70void kernel_map_pages(struct page *page, int numpages, int enable);
71#endif
72
67#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
68 74
69#endif /* _ASM_POWERPC_CACHEFLUSH_H */ 75#endif /* _ASM_POWERPC_CACHEFLUSH_H */
diff --git a/include/asm-powerpc/cell-pmu.h b/include/asm-powerpc/cell-pmu.h
index e8c2ebd3ddda..8066eede3a0c 100644
--- a/include/asm-powerpc/cell-pmu.h
+++ b/include/asm-powerpc/cell-pmu.h
@@ -53,6 +53,11 @@
53#define CBE_PM_CTR_POLARITY 0x01000000 53#define CBE_PM_CTR_POLARITY 0x01000000
54#define CBE_PM_CTR_COUNT_CYCLES 0x00800000 54#define CBE_PM_CTR_COUNT_CYCLES 0x00800000
55#define CBE_PM_CTR_ENABLE 0x00400000 55#define CBE_PM_CTR_ENABLE 0x00400000
56#define PM07_CTR_INPUT_MUX(x) (((x) & 0x3F) << 26)
57#define PM07_CTR_INPUT_CONTROL(x) (((x) & 1) << 25)
58#define PM07_CTR_POLARITY(x) (((x) & 1) << 24)
59#define PM07_CTR_COUNT_CYCLES(x) (((x) & 1) << 23)
60#define PM07_CTR_ENABLE(x) (((x) & 1) << 22)
56 61
57/* Macros for the pm_status register. */ 62/* Macros for the pm_status register. */
58#define CBE_PM_CTR_OVERFLOW_INTR(ctr) (1 << (31 - ((ctr) & 7))) 63#define CBE_PM_CTR_OVERFLOW_INTR(ctr) (1 << (31 - ((ctr) & 7)))
@@ -89,25 +94,12 @@ extern void cbe_read_trace_buffer(u32 cpu, u64 *buf);
89 94
90extern void cbe_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask); 95extern void cbe_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask);
91extern void cbe_disable_pm_interrupts(u32 cpu); 96extern void cbe_disable_pm_interrupts(u32 cpu);
92extern u32 cbe_query_pm_interrupts(u32 cpu); 97extern u32 cbe_get_and_clear_pm_interrupts(u32 cpu);
93extern u32 cbe_clear_pm_interrupts(u32 cpu);
94extern void cbe_sync_irq(int node); 98extern void cbe_sync_irq(int node);
95 99
96/* Utility functions, macros */
97extern u32 cbe_get_hw_thread_id(int cpu);
98
99#define cbe_cpu_to_node(cpu) ((cpu) >> 1)
100
101#define CBE_COUNT_SUPERVISOR_MODE 0 100#define CBE_COUNT_SUPERVISOR_MODE 0
102#define CBE_COUNT_HYPERVISOR_MODE 1 101#define CBE_COUNT_HYPERVISOR_MODE 1
103#define CBE_COUNT_PROBLEM_MODE 2 102#define CBE_COUNT_PROBLEM_MODE 2
104#define CBE_COUNT_ALL_MODES 3 103#define CBE_COUNT_ALL_MODES 3
105 104
106/* Macros for the pm07_control registers. */
107#define PM07_CTR_INPUT_MUX(x) (((x) & 0x3F) << 26)
108#define PM07_CTR_INPUT_CONTROL(x) (((x) & 1) << 25)
109#define PM07_CTR_POLARITY(x) (((x) & 1) << 24)
110#define PM07_CTR_COUNT_CYCLES(x) (((x) & 1) << 23)
111#define PM07_CTR_ENABLE(x) (((x) & 1) << 22)
112
113#endif /* __ASM_CELL_PMU_H__ */ 105#endif /* __ASM_CELL_PMU_H__ */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 7384b8086b75..434524931ef3 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -48,6 +48,13 @@ enum powerpc_oprofile_type {
48 PPC_OPROFILE_G4 = 3, 48 PPC_OPROFILE_G4 = 3,
49 PPC_OPROFILE_BOOKE = 4, 49 PPC_OPROFILE_BOOKE = 4,
50 PPC_OPROFILE_CELL = 5, 50 PPC_OPROFILE_CELL = 5,
51 PPC_OPROFILE_PA6T = 6,
52};
53
54enum powerpc_pmc_type {
55 PPC_PMC_DEFAULT = 0,
56 PPC_PMC_IBM = 1,
57 PPC_PMC_PA6T = 2,
51}; 58};
52 59
53struct cpu_spec { 60struct cpu_spec {
@@ -65,6 +72,7 @@ struct cpu_spec {
65 72
66 /* number of performance monitor counters */ 73 /* number of performance monitor counters */
67 unsigned int num_pmcs; 74 unsigned int num_pmcs;
75 enum powerpc_pmc_type pmc_type;
68 76
69 /* this is called to initialize various CPU bits like L1 cache, 77 /* this is called to initialize various CPU bits like L1 cache,
70 * BHT, SPD, etc... from head.S before branching to identify_machine 78 * BHT, SPD, etc... from head.S before branching to identify_machine
@@ -216,6 +224,10 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
216 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 224 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
217 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 225 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
218 CPU_FTR_PPC_LE) 226 CPU_FTR_PPC_LE)
227#define CPU_FTRS_750CL (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
228 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
229 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
230 CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
219#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 231#define CPU_FTRS_750FX1 (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
220 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 232 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
221 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 233 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
@@ -228,9 +240,9 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
228 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 240 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
229 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 241 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
230 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 242 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
231#define CPU_FTRS_750GX (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_MAYBE_CAN_DOZE | \ 243#define CPU_FTRS_750GX (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
232 CPU_FTR_USE_TB | CPU_FTR_L2CR | CPU_FTR_TAU | \ 244 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
233 CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \ 245 CPU_FTR_TAU | CPU_FTR_HPTE_TABLE | CPU_FTR_MAYBE_CAN_NAP | \
234 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE) 246 CPU_FTR_DUAL_PLL_750FX | CPU_FTR_HAS_HIGH_BATS | CPU_FTR_PPC_LE)
235#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \ 247#define CPU_FTRS_7400_NOTAU (CPU_FTR_COMMON | CPU_FTR_SPLIT_ID_CACHE | \
236 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \ 248 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB | CPU_FTR_L2CR | \
@@ -337,12 +349,6 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
337 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 349 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
338 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 350 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
339 CPU_FTR_DSCR) 351 CPU_FTR_DSCR)
340#define CPU_FTRS_POWER6X (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
342 CPU_FTR_MMCRA | CPU_FTR_SMT | \
343 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
344 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | \
345 CPU_FTR_SPURR | CPU_FTR_REAL_LE | CPU_FTR_DSCR)
346#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 352#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
347 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 353 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
348 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 354 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
diff --git a/include/asm-powerpc/current.h b/include/asm-powerpc/current.h
index b8708aedf925..e2c7f06931e7 100644
--- a/include/asm-powerpc/current.h
+++ b/include/asm-powerpc/current.h
@@ -12,6 +12,7 @@
12struct task_struct; 12struct task_struct;
13 13
14#ifdef __powerpc64__ 14#ifdef __powerpc64__
15#include <linux/stddef.h>
15#include <asm/paca.h> 16#include <asm/paca.h>
16 17
17static inline struct task_struct *get_current(void) 18static inline struct task_struct *get_current(void)
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index d7a1bc1551c6..05af081222f6 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -26,8 +26,8 @@ typedef struct {} dcr_host_t;
26 26
27#define DCR_MAP_OK(host) (1) 27#define DCR_MAP_OK(host) (1)
28 28
29#define dcr_map(dev, dcr_n, dcr_c) {} 29#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){})
30#define dcr_unmap(host, dcr_n, dcr_c) {} 30#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0)
31#define dcr_read(host, dcr_n) mfdcr(dcr_n) 31#define dcr_read(host, dcr_n) mfdcr(dcr_n)
32#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) 32#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)
33 33
diff --git a/include/asm-powerpc/dcr.h b/include/asm-powerpc/dcr.h
index b66c5e6941f0..9338d50538f1 100644
--- a/include/asm-powerpc/dcr.h
+++ b/include/asm-powerpc/dcr.h
@@ -33,6 +33,7 @@
33 * base from the device-tree 33 * base from the device-tree
34 */ 34 */
35#ifdef CONFIG_PPC_MERGE 35#ifdef CONFIG_PPC_MERGE
36struct device_node;
36extern unsigned int dcr_resource_start(struct device_node *np, 37extern unsigned int dcr_resource_start(struct device_node *np,
37 unsigned int index); 38 unsigned int index);
38extern unsigned int dcr_resource_len(struct device_node *np, 39extern unsigned int dcr_resource_len(struct device_node *np,
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 7c7de87bd8ae..a19a6f1a1cf1 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -37,9 +37,9 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
37 */ 37 */
38 38
39#define __dma_alloc_coherent(gfp, size, handle) NULL 39#define __dma_alloc_coherent(gfp, size, handle) NULL
40#define __dma_free_coherent(size, addr) do { } while (0) 40#define __dma_free_coherent(size, addr) ((void)0)
41#define __dma_sync(addr, size, rw) do { } while (0) 41#define __dma_sync(addr, size, rw) ((void)0)
42#define __dma_sync_page(pg, off, sz, rw) do { } while (0) 42#define __dma_sync_page(pg, off, sz, rw) ((void)0)
43 43
44#endif /* ! CONFIG_NOT_COHERENT_CACHE */ 44#endif /* ! CONFIG_NOT_COHERENT_CACHE */
45 45
@@ -251,7 +251,7 @@ dma_map_single(struct device *dev, void *ptr, size_t size,
251} 251}
252 252
253/* We do nothing. */ 253/* We do nothing. */
254#define dma_unmap_single(dev, addr, size, dir) do { } while (0) 254#define dma_unmap_single(dev, addr, size, dir) ((void)0)
255 255
256static inline dma_addr_t 256static inline dma_addr_t
257dma_map_page(struct device *dev, struct page *page, 257dma_map_page(struct device *dev, struct page *page,
@@ -266,7 +266,7 @@ dma_map_page(struct device *dev, struct page *page,
266} 266}
267 267
268/* We do nothing. */ 268/* We do nothing. */
269#define dma_unmap_page(dev, handle, size, dir) do { } while (0) 269#define dma_unmap_page(dev, handle, size, dir) ((void)0)
270 270
271static inline int 271static inline int
272dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 272dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
@@ -286,7 +286,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
286} 286}
287 287
288/* We don't do anything here. */ 288/* We don't do anything here. */
289#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0) 289#define dma_unmap_sg(dev, sg, nents, dir) ((void)0)
290 290
291#endif /* CONFIG_PPC64 */ 291#endif /* CONFIG_PPC64 */
292 292
diff --git a/include/asm-powerpc/edac.h b/include/asm-powerpc/edac.h
new file mode 100644
index 000000000000..6ead88bbfbb8
--- /dev/null
+++ b/include/asm-powerpc/edac.h
@@ -0,0 +1,40 @@
1/*
2 * PPC EDAC common defs
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef ASM_EDAC_H
12#define ASM_EDAC_H
13/*
14 * ECC atomic, DMA, SMP and interrupt safe scrub function.
15 * Implements the per arch atomic_scrub() that EDAC use for software
16 * ECC scrubbing. It reads memory and then writes back the original
17 * value, allowing the hardware to detect and correct memory errors.
18 */
19static __inline__ void atomic_scrub(void *va, u32 size)
20{
21 unsigned int *virt_addr = va;
22 unsigned int temp;
23 unsigned int i;
24
25 for (i = 0; i < size / sizeof(*virt_addr); i++, virt_addr++) {
26 /* Very carefully read and write to memory atomically
27 * so we are interrupt, DMA and SMP safe.
28 */
29 __asm__ __volatile__ ("\n\
30 1: lwarx %0,0,%1\n\
31 stwcx. %0,0,%1\n\
32 bne- 1b\n\
33 isync"
34 : "=&r"(temp)
35 : "r"(virt_addr)
36 : "cr0", "memory");
37 }
38}
39
40#endif
diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h
index dc6bf0ffb796..cc3cb04539ac 100644
--- a/include/asm-powerpc/eeh_event.h
+++ b/include/asm-powerpc/eeh_event.h
@@ -30,8 +30,6 @@ struct eeh_event {
30 struct list_head list; 30 struct list_head list;
31 struct device_node *dn; /* struct device node */ 31 struct device_node *dn; /* struct device node */
32 struct pci_dev *dev; /* affected device */ 32 struct pci_dev *dev; /* affected device */
33 enum pci_channel_state state; /* PCI bus state for the affected device */
34 int time_unavail; /* milliseconds until device might be available */
35}; 33};
36 34
37/** 35/**
@@ -46,9 +44,7 @@ struct eeh_event {
46 * (from a workqueue). 44 * (from a workqueue).
47 */ 45 */
48int eeh_send_failure_event (struct device_node *dn, 46int eeh_send_failure_event (struct device_node *dn,
49 struct pci_dev *dev, 47 struct pci_dev *dev);
50 enum pci_channel_state state,
51 int time_unavail);
52 48
53/* Main recovery function */ 49/* Main recovery function */
54struct pci_dn * handle_eeh_events (struct eeh_event *); 50struct pci_dn * handle_eeh_events (struct eeh_event *);
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index d36426c01b6b..de507995c7b1 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -173,7 +173,7 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
173 the loader. We need to make sure that it is out of the way of the program 173 the loader. We need to make sure that it is out of the way of the program
174 that it will "exec", and that there is sufficient room for the brk. */ 174 that it will "exec", and that there is sufficient room for the brk. */
175 175
176#define ELF_ET_DYN_BASE (0x08000000) 176#define ELF_ET_DYN_BASE (0x20000000)
177 177
178/* Common routine for both 32-bit and 64-bit processes */ 178/* Common routine for both 32-bit and 64-bit processes */
179static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs, 179static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 98f7b62422c9..3671c128f271 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -43,6 +43,8 @@
43#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000) 43#define FW_FEATURE_ISERIES ASM_CONST(0x0000000000200000)
44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000) 44#define FW_FEATURE_LPAR ASM_CONST(0x0000000000400000)
45#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000) 45#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)
46#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)
47#define FW_FEATURE_BULK_REMOVE ASM_CONST(0x0000000002000000)
46 48
47#ifndef __ASSEMBLY__ 49#ifndef __ASSEMBLY__
48 50
@@ -61,6 +63,8 @@ enum {
61 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, 63 FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
62 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 64 FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
63 FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1, 65 FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
66 FW_FEATURE_CELLEB_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_BEAT,
67 FW_FEATURE_CELLEB_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_BEAT,
64 FW_FEATURE_NATIVE_POSSIBLE = 0, 68 FW_FEATURE_NATIVE_POSSIBLE = 0,
65 FW_FEATURE_NATIVE_ALWAYS = 0, 69 FW_FEATURE_NATIVE_ALWAYS = 0,
66 FW_FEATURE_POSSIBLE = 70 FW_FEATURE_POSSIBLE =
@@ -73,6 +77,9 @@ enum {
73#ifdef CONFIG_PPC_PS3 77#ifdef CONFIG_PPC_PS3
74 FW_FEATURE_PS3_POSSIBLE | 78 FW_FEATURE_PS3_POSSIBLE |
75#endif 79#endif
80#ifdef CONFIG_PPC_CELLEB
81 FW_FEATURE_CELLEB_POSSIBLE |
82#endif
76#ifdef CONFIG_PPC_NATIVE 83#ifdef CONFIG_PPC_NATIVE
77 FW_FEATURE_NATIVE_ALWAYS | 84 FW_FEATURE_NATIVE_ALWAYS |
78#endif 85#endif
@@ -87,6 +94,9 @@ enum {
87#ifdef CONFIG_PPC_PS3 94#ifdef CONFIG_PPC_PS3
88 FW_FEATURE_PS3_ALWAYS & 95 FW_FEATURE_PS3_ALWAYS &
89#endif 96#endif
97#ifdef CONFIG_PPC_CELLEB
98 FW_FEATURE_CELLEB_ALWAYS &
99#endif
90#ifdef CONFIG_PPC_NATIVE 100#ifdef CONFIG_PPC_NATIVE
91 FW_FEATURE_NATIVE_ALWAYS & 101 FW_FEATURE_NATIVE_ALWAYS &
92#endif 102#endif
diff --git a/include/asm-powerpc/floppy.h b/include/asm-powerpc/floppy.h
index fd242a22331c..afa700ded877 100644
--- a/include/asm-powerpc/floppy.h
+++ b/include/asm-powerpc/floppy.h
@@ -17,28 +17,115 @@
17#define fd_outb(value,port) outb_p(value,port) 17#define fd_outb(value,port) outb_p(value,port)
18 18
19#define fd_enable_dma() enable_dma(FLOPPY_DMA) 19#define fd_enable_dma() enable_dma(FLOPPY_DMA)
20#define fd_disable_dma() disable_dma(FLOPPY_DMA) 20#define fd_disable_dma() fd_ops->_disable_dma(FLOPPY_DMA)
21#define fd_request_dma() request_dma(FLOPPY_DMA, "floppy") 21#define fd_free_dma() fd_ops->_free_dma(FLOPPY_DMA)
22#define fd_free_dma() free_dma(FLOPPY_DMA)
23#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA) 22#define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
24#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, mode) 23#define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA, mode)
25#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count) 24#define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA, count)
25#define fd_get_dma_residue() fd_ops->_get_dma_residue(FLOPPY_DMA)
26#define fd_enable_irq() enable_irq(FLOPPY_IRQ) 26#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
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, \
30 IRQF_DISABLED, "floppy", NULL)
31#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); 29#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
32 30
33#ifdef CONFIG_PCI
34
35#include <linux/pci.h> 31#include <linux/pci.h>
36#include <asm/ppc-pci.h> /* for ppc64_isabridge_dev */ 32#include <asm/ppc-pci.h> /* for ppc64_isabridge_dev */
37 33
38#define fd_dma_setup(addr,size,mode,io) powerpc_fd_dma_setup(addr,size,mode,io) 34#define fd_dma_setup(addr,size,mode,io) fd_ops->_dma_setup(addr,size,mode,io)
35
36static int fd_request_dma(void);
37
38struct fd_dma_ops {
39 void (*_disable_dma)(unsigned int dmanr);
40 void (*_free_dma)(unsigned int dmanr);
41 int (*_get_dma_residue)(unsigned int dummy);
42 int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
43};
44
45static int virtual_dma_count;
46static int virtual_dma_residue;
47static char *virtual_dma_addr;
48static int virtual_dma_mode;
49static int doing_vdma;
50static struct fd_dma_ops *fd_ops;
51
52static irqreturn_t floppy_hardint(int irq, void *dev_id)
53{
54 unsigned char st;
55 int lcount;
56 char *lptr;
57
58 if (!doing_vdma)
59 return floppy_interrupt(irq, dev_id);
60
61
62 st = 1;
63 for (lcount=virtual_dma_count, lptr=virtual_dma_addr;
64 lcount; lcount--, lptr++) {
65 st=inb(virtual_dma_port+4) & 0xa0 ;
66 if (st != 0xa0)
67 break;
68 if (virtual_dma_mode)
69 outb_p(*lptr, virtual_dma_port+5);
70 else
71 *lptr = inb_p(virtual_dma_port+5);
72 }
73 virtual_dma_count = lcount;
74 virtual_dma_addr = lptr;
75 st = inb(virtual_dma_port+4);
76
77 if (st == 0x20)
78 return IRQ_HANDLED;
79 if (!(st & 0x20)) {
80 virtual_dma_residue += virtual_dma_count;
81 virtual_dma_count=0;
82 doing_vdma = 0;
83 floppy_interrupt(irq, dev_id);
84 return IRQ_HANDLED;
85 }
86 return IRQ_HANDLED;
87}
39 88
40static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size, 89static void vdma_disable_dma(unsigned int dummy)
41 int mode, int io) 90{
91 doing_vdma = 0;
92 virtual_dma_residue += virtual_dma_count;
93 virtual_dma_count=0;
94}
95
96static void vdma_nop(unsigned int dummy)
97{
98}
99
100
101static int vdma_get_dma_residue(unsigned int dummy)
102{
103 return virtual_dma_count + virtual_dma_residue;
104}
105
106
107static int fd_request_irq(void)
108{
109 if (can_use_virtual_dma)
110 return request_irq(FLOPPY_IRQ, floppy_hardint,
111 IRQF_DISABLED, "floppy", NULL);
112 else
113 return request_irq(FLOPPY_IRQ, floppy_interrupt,
114 IRQF_DISABLED, "floppy", NULL);
115}
116
117static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
118{
119 doing_vdma = 1;
120 virtual_dma_port = io;
121 virtual_dma_mode = (mode == DMA_MODE_WRITE);
122 virtual_dma_addr = addr;
123 virtual_dma_count = size;
124 virtual_dma_residue = 0;
125 return 0;
126}
127
128static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
42{ 129{
43 static unsigned long prev_size; 130 static unsigned long prev_size;
44 static dma_addr_t bus_addr = 0; 131 static dma_addr_t bus_addr = 0;
@@ -46,6 +133,7 @@ static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size,
46 static int prev_dir; 133 static int prev_dir;
47 int dir; 134 int dir;
48 135
136 doing_vdma = 0;
49 dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; 137 dir = (mode == DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
50 138
51 if (bus_addr 139 if (bus_addr
@@ -74,11 +162,32 @@ static __inline__ int powerpc_fd_dma_setup(char *addr, unsigned long size,
74 return 0; 162 return 0;
75} 163}
76 164
77#endif /* CONFIG_PCI */ 165static struct fd_dma_ops real_dma_ops =
166{
167 ._disable_dma = disable_dma,
168 ._free_dma = free_dma,
169 ._get_dma_residue = get_dma_residue,
170 ._dma_setup = hard_dma_setup
171};
172
173static struct fd_dma_ops virt_dma_ops =
174{
175 ._disable_dma = vdma_disable_dma,
176 ._free_dma = vdma_nop,
177 ._get_dma_residue = vdma_get_dma_residue,
178 ._dma_setup = vdma_dma_setup
179};
78 180
79__inline__ void virtual_dma_init(void) 181static int fd_request_dma(void)
80{ 182{
81 /* Nothing to do on PowerPC */ 183 if (can_use_virtual_dma & 1) {
184 fd_ops = &virt_dma_ops;
185 return 0;
186 }
187 else {
188 fd_ops = &real_dma_ops;
189 return request_dma(FLOPPY_DMA, "floppy");
190 }
82} 191}
83 192
84static int FDC1 = 0x3f0; 193static int FDC1 = 0x3f0;
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
index 3d0e819d37f1..c624915b757e 100644
--- a/include/asm-powerpc/fs_pd.h
+++ b/include/asm-powerpc/fs_pd.h
@@ -11,19 +11,17 @@
11 11
12#ifndef FS_PD_H 12#ifndef FS_PD_H
13#define FS_PD_H 13#define FS_PD_H
14#include <asm/cpm2.h>
15#include <sysdev/fsl_soc.h> 14#include <sysdev/fsl_soc.h>
16#include <asm/time.h> 15#include <asm/time.h>
17 16
18static inline int uart_baudrate(void) 17#ifdef CONFIG_CPM2
19{ 18#include <asm/cpm2.h>
20 return get_baudrate();
21}
22 19
23static inline int uart_clock(void) 20#if defined(CONFIG_8260)
24{ 21#include <asm/mpc8260.h>
25 return ppc_proc_freq; 22#elif defined(CONFIG_85xx)
26} 23#include <asm/mpc85xx.h>
24#endif
27 25
28#define cpm2_map(member) \ 26#define cpm2_map(member) \
29({ \ 27({ \
@@ -41,5 +39,38 @@ static inline int uart_clock(void)
41}) 39})
42 40
43#define cpm2_unmap(addr) iounmap(addr) 41#define cpm2_unmap(addr) iounmap(addr)
42#endif
43
44#ifdef CONFIG_8xx
45#include <asm/8xx_immap.h>
46#include <asm/mpc8xx.h>
47
48#define immr_map(member) \
49({ \
50 u32 offset = offsetof(immap_t, member); \
51 void *addr = ioremap (IMAP_ADDR + offset, \
52 sizeof( ((immap_t*)0)->member)); \
53 addr; \
54})
55
56#define immr_map_size(member, size) \
57({ \
58 u32 offset = offsetof(immap_t, member); \
59 void *addr = ioremap (IMAP_ADDR + offset, size); \
60 addr; \
61})
62
63#define immr_unmap(addr) iounmap(addr)
64#endif
65
66static inline int uart_baudrate(void)
67{
68 return get_baudrate();
69}
70
71static inline int uart_clock(void)
72{
73 return ppc_proc_freq;
74}
44 75
45#endif 76#endif
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 7a500732b671..62efd9d7a43d 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -168,6 +168,7 @@
168#define H_FREE_LOGICAL_LAN 0x118 168#define H_FREE_LOGICAL_LAN 0x118
169#define H_ADD_LOGICAL_LAN_BUFFER 0x11C 169#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
170#define H_SEND_LOGICAL_LAN 0x120 170#define H_SEND_LOGICAL_LAN 0x120
171#define H_BULK_REMOVE 0x124
171#define H_MULTICAST_CTRL 0x130 172#define H_MULTICAST_CTRL 0x130
172#define H_SET_XDABR 0x134 173#define H_SET_XDABR 0x134
173#define H_STUFF_TCE 0x138 174#define H_STUFF_TCE 0x138
@@ -236,6 +237,20 @@ long plpar_hcall_norets(unsigned long opcode, ...);
236long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 237long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
237 238
238/** 239/**
240 * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
241 * @opcode: The hypervisor call to make.
242 * @retbuf: Buffer to store up to 4 return arguments in.
243 *
244 * This call supports up to 6 arguments and 4 return arguments. Use
245 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
246 *
247 * Used when phyp interface needs to be called in real mode. Similar to
248 * plpar_hcall, but plpar_hcall_raw works in real mode and does not
249 * calculate hypervisor call statistics.
250 */
251long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
252
253/**
239 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 254 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
240 * @opcode: The hypervisor call to make. 255 * @opcode: The hypervisor call to make.
241 * @retbuf: Buffer to store up to 9 return arguments in. 256 * @retbuf: Buffer to store up to 9 return arguments in.
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 66112114b8c5..87d396e28db2 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -2,36 +2,37 @@
2 * IBM PowerPC eBus Infrastructure Support. 2 * IBM PowerPC eBus Infrastructure Support.
3 * 3 *
4 * Copyright (c) 2005 IBM Corporation 4 * Copyright (c) 2005 IBM Corporation
5 * Joachim Fenkes <fenkes@de.ibm.com>
5 * Heiko J Schick <schickhj@de.ibm.com> 6 * Heiko J Schick <schickhj@de.ibm.com>
6 * 7 *
7 * All rights reserved. 8 * All rights reserved.
8 * 9 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB 10 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD. 11 * BSD.
11 * 12 *
12 * OpenIB BSD License 13 * OpenIB BSD License
13 * 14 *
14 * Redistribution and use in source and binary forms, with or without 15 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met: 16 * modification, are permitted provided that the following conditions are met:
16 * 17 *
17 * Redistributions of source code must retain the above copyright notice, this 18 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer. 19 * list of conditions and the following disclaimer.
19 * 20 *
20 * Redistributions in binary form must reproduce the above copyright notice, 21 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation 22 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials 23 * and/or other materials
23 * provided with the distribution. 24 * provided with the distribution.
24 * 25 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 33 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 36 * POSSIBILITY OF SUCH DAMAGE.
36 */ 37 */
37 38
@@ -46,12 +47,11 @@
46 47
47extern struct bus_type ibmebus_bus_type; 48extern struct bus_type ibmebus_bus_type;
48 49
49struct ibmebus_dev { 50struct ibmebus_dev {
50 const char *name;
51 struct of_device ofdev; 51 struct of_device ofdev;
52}; 52};
53 53
54struct ibmebus_driver { 54struct ibmebus_driver {
55 char *name; 55 char *name;
56 struct of_device_id *id_table; 56 struct of_device_id *id_table;
57 int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id); 57 int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
@@ -63,7 +63,7 @@ int ibmebus_register_driver(struct ibmebus_driver *drv);
63void ibmebus_unregister_driver(struct ibmebus_driver *drv); 63void ibmebus_unregister_driver(struct ibmebus_driver *drv);
64 64
65int ibmebus_request_irq(struct ibmebus_dev *dev, 65int ibmebus_request_irq(struct ibmebus_dev *dev,
66 u32 ist, 66 u32 ist,
67 irq_handler_t handler, 67 irq_handler_t handler,
68 unsigned long irq_flags, const char * devname, 68 unsigned long irq_flags, const char * devname,
69 void *dev_id); 69 void *dev_id);
diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
index d905b6622268..59b9e07b8e99 100644
--- a/include/asm-powerpc/immap_86xx.h
+++ b/include/asm-powerpc/immap_86xx.h
@@ -85,81 +85,6 @@ typedef struct ccsr_pci {
85 char res19[472]; 85 char res19[472];
86} ccsr_pci_t; 86} ccsr_pci_t;
87 87
88/* PCI Express Registers */
89typedef struct ccsr_pex {
90 uint pex_config_addr; /* 0x.000 - PCI Express Configuration Address Register */
91 uint pex_config_data; /* 0x.004 - PCI Express Configuration Data Register */
92 char res1[4];
93 uint pex_otb_cpl_tor; /* 0x.00c - PCI Express Outbound completion timeout register */
94 uint pex_conf_tor; /* 0x.010 - PCI Express configuration timeout register */
95 char res2[12];
96 uint pex_pme_mes_dr; /* 0x.020 - PCI Express PME and message detect register */
97 uint pex_pme_mes_disr; /* 0x.024 - PCI Express PME and message disable register */
98 uint pex_pme_mes_ier; /* 0x.028 - PCI Express PME and message interrupt enable register */
99 uint pex_pmcr; /* 0x.02c - PCI Express power management command register */
100 char res3[3024];
101 uint pexotar0; /* 0x.c00 - PCI Express outbound translation address register 0 */
102 uint pexotear0; /* 0x.c04 - PCI Express outbound translation extended address register 0*/
103 char res4[8];
104 uint pexowar0; /* 0x.c10 - PCI Express outbound window attributes register 0*/
105 char res5[12];
106 uint pexotar1; /* 0x.c20 - PCI Express outbound translation address register 1 */
107 uint pexotear1; /* 0x.c24 - PCI Express outbound translation extended address register 1*/
108 uint pexowbar1; /* 0x.c28 - PCI Express outbound window base address register 1*/
109 char res6[4];
110 uint pexowar1; /* 0x.c30 - PCI Express outbound window attributes register 1*/
111 char res7[12];
112 uint pexotar2; /* 0x.c40 - PCI Express outbound translation address register 2 */
113 uint pexotear2; /* 0x.c44 - PCI Express outbound translation extended address register 2*/
114 uint pexowbar2; /* 0x.c48 - PCI Express outbound window base address register 2*/
115 char res8[4];
116 uint pexowar2; /* 0x.c50 - PCI Express outbound window attributes register 2*/
117 char res9[12];
118 uint pexotar3; /* 0x.c60 - PCI Express outbound translation address register 3 */
119 uint pexotear3; /* 0x.c64 - PCI Express outbound translation extended address register 3*/
120 uint pexowbar3; /* 0x.c68 - PCI Express outbound window base address register 3*/
121 char res10[4];
122 uint pexowar3; /* 0x.c70 - PCI Express outbound window attributes register 3*/
123 char res11[12];
124 uint pexotar4; /* 0x.c80 - PCI Express outbound translation address register 4 */
125 uint pexotear4; /* 0x.c84 - PCI Express outbound translation extended address register 4*/
126 uint pexowbar4; /* 0x.c88 - PCI Express outbound window base address register 4*/
127 char res12[4];
128 uint pexowar4; /* 0x.c90 - PCI Express outbound window attributes register 4*/
129 char res13[12];
130 char res14[256];
131 uint pexitar3; /* 0x.da0 - PCI Express inbound translation address register 3 */
132 char res15[4];
133 uint pexiwbar3; /* 0x.da8 - PCI Express inbound window base address register 3 */
134 uint pexiwbear3; /* 0x.dac - PCI Express inbound window base extended address register 3 */
135 uint pexiwar3; /* 0x.db0 - PCI Express inbound window attributes register 3 */
136 char res16[12];
137 uint pexitar2; /* 0x.dc0 - PCI Express inbound translation address register 2 */
138 char res17[4];
139 uint pexiwbar2; /* 0x.dc8 - PCI Express inbound window base address register 2 */
140 uint pexiwbear2; /* 0x.dcc - PCI Express inbound window base extended address register 2 */
141 uint pexiwar2; /* 0x.dd0 - PCI Express inbound window attributes register 2 */
142 char res18[12];
143 uint pexitar1; /* 0x.de0 - PCI Express inbound translation address register 2 */
144 char res19[4];
145 uint pexiwbar1; /* 0x.de8 - PCI Express inbound window base address register 2 */
146 uint pexiwbear1; /* 0x.dec - PCI Express inbound window base extended address register 2 */
147 uint pexiwar1; /* 0x.df0 - PCI Express inbound window attributes register 2 */
148 char res20[12];
149 uint pex_err_dr; /* 0x.e00 - PCI Express error detect register */
150 char res21[4];
151 uint pex_err_en; /* 0x.e08 - PCI Express error interrupt enable register */
152 char res22[4];
153 uint pex_err_disr; /* 0x.e10 - PCI Express error disable register */
154 char res23[12];
155 uint pex_err_cap_stat; /* 0x.e20 - PCI Express error capture status register */
156 char res24[4];
157 uint pex_err_cap_r0; /* 0x.e28 - PCI Express error capture register 0 */
158 uint pex_err_cap_r1; /* 0x.e2c - PCI Express error capture register 0 */
159 uint pex_err_cap_r2; /* 0x.e30 - PCI Express error capture register 0 */
160 uint pex_err_cap_r3; /* 0x.e34 - PCI Express error capture register 0 */
161} ccsr_pex_t;
162
163/* Global Utility Registers */ 88/* Global Utility Registers */
164typedef struct ccsr_guts { 89typedef struct ccsr_guts {
165 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */ 90 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index 9fdd0491f6a3..1020b7fc0129 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -258,8 +258,9 @@ struct ucc_slow {
258 u8 uccs; /* UCCx status register */ 258 u8 uccs; /* UCCx status register */
259 u8 res3[0x24]; 259 u8 res3[0x24];
260 __be16 utpt; 260 __be16 utpt;
261 u8 res4[0x52];
261 u8 guemr; /* UCC general extended mode register */ 262 u8 guemr; /* UCC general extended mode register */
262 u8 res4[0x200 - 0x091]; 263 u8 res5[0x200 - 0x091];
263} __attribute__ ((packed)); 264} __attribute__ ((packed));
264 265
265/* QE UCC Fast */ 266/* QE UCC Fast */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index 1cd532379c30..350c9bdb31dc 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -11,7 +11,12 @@
11 11
12/* Check of existence of legacy devices */ 12/* Check of existence of legacy devices */
13extern int check_legacy_ioport(unsigned long base_port); 13extern int check_legacy_ioport(unsigned long base_port);
14#define PNPBIOS_BASE 0xf000 /* only relevant for PReP */ 14#define I8042_DATA_REG 0x60
15#define FDC_BASE 0x3f0
16/* only relevant for PReP */
17#define _PIDXR 0x279
18#define _PNPWRP 0xa79
19#define PNPBIOS_BASE 0xf000
15 20
16#include <linux/compiler.h> 21#include <linux/compiler.h>
17#include <asm/page.h> 22#include <asm/page.h>
@@ -732,6 +737,12 @@ static inline void * bus_to_virt(unsigned long address)
732 737
733#endif /* CONFIG_PPC32 */ 738#endif /* CONFIG_PPC32 */
734 739
740/* access ports */
741#define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) | (_v))
742#define clrbits32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v))
743
744#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v))
745#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
735 746
736#endif /* __KERNEL__ */ 747#endif /* __KERNEL__ */
737 748
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index f85dbd305558..b2e56b30306a 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -99,6 +99,7 @@ extern void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
99extern void iommu_init_early_pSeries(void); 99extern void iommu_init_early_pSeries(void);
100extern void iommu_init_early_iSeries(void); 100extern void iommu_init_early_iSeries(void);
101extern void iommu_init_early_dart(void); 101extern void iommu_init_early_dart(void);
102extern void iommu_init_early_pasemi(void);
102 103
103#ifdef CONFIG_PCI 104#ifdef CONFIG_PCI
104extern void pci_iommu_init(void); 105extern void pci_iommu_init(void);
diff --git a/include/asm-powerpc/ipic.h b/include/asm-powerpc/ipic.h
index 9fbb03415860..edec79dcb7c1 100644
--- a/include/asm-powerpc/ipic.h
+++ b/include/asm-powerpc/ipic.h
@@ -78,7 +78,7 @@ extern u32 ipic_get_mcp_status(void);
78extern void ipic_clear_mcp_status(u32 mask); 78extern void ipic_clear_mcp_status(u32 mask);
79 79
80#ifdef CONFIG_PPC_MERGE 80#ifdef CONFIG_PPC_MERGE
81extern void ipic_init(struct device_node *node, unsigned int flags); 81extern struct ipic * ipic_init(struct device_node *node, unsigned int flags);
82extern unsigned int ipic_get_irq(void); 82extern unsigned int ipic_get_irq(void);
83#else 83#else
84extern void ipic_init(phys_addr_t phys_addr, unsigned int flags, 84extern void ipic_init(phys_addr_t phys_addr, unsigned int flags,
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 46476e9a494a..4734cc178db5 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -89,6 +89,9 @@ struct irq_host_ops {
89 /* Dispose of such a mapping */ 89 /* Dispose of such a mapping */
90 void (*unmap)(struct irq_host *h, unsigned int virq); 90 void (*unmap)(struct irq_host *h, unsigned int virq);
91 91
92 /* Update of such a mapping */
93 void (*remap)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw);
94
92 /* Translate device-tree interrupt specifier from raw format coming 95 /* Translate device-tree interrupt specifier from raw format coming
93 * from the firmware to a irq_hw_number_t (interrupt line number) and 96 * from the firmware to a irq_hw_number_t (interrupt line number) and
94 * type (sense) that can be passed to set_irq_type(). In the absence 97 * type (sense) that can be passed to set_irq_type(). In the absence
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 2dafa376a63f..f850ca7020ed 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -44,6 +44,7 @@ typedef unsigned int kprobe_opcode_t;
44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) 44#define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000)
45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) 45#define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000)
46 46
47#ifdef CONFIG_PPC64
47/* 48/*
48 * 64bit powerpc uses function descriptors. 49 * 64bit powerpc uses function descriptors.
49 * Handle cases where: 50 * Handle cases where:
@@ -67,9 +68,13 @@ typedef unsigned int kprobe_opcode_t;
67} 68}
68 69
69#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry) 70#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)((func_descr_t *)pentry)
70
71#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ 71#define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \
72 IS_TWI(instr) || IS_TDI(instr)) 72 IS_TWI(instr) || IS_TDI(instr))
73#else
74/* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */
75#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)(pentry)
76#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
77#endif
73 78
74#define ARCH_SUPPORTS_KRETPROBES 79#define ARCH_SUPPORTS_KRETPROBES
75#define ARCH_INACTIVE_KPROBE_COUNT 1 80#define ARCH_INACTIVE_KPROBE_COUNT 1
@@ -82,6 +87,11 @@ extern void arch_remove_kprobe(struct kprobe *p);
82struct arch_specific_insn { 87struct arch_specific_insn {
83 /* copy of original instruction */ 88 /* copy of original instruction */
84 kprobe_opcode_t *insn; 89 kprobe_opcode_t *insn;
90 /*
91 * Set in kprobes code, initially to 0. If the instruction can be
92 * eumulated, this is set to 1, if not, to -1.
93 */
94 int boostable;
85}; 95};
86 96
87struct prev_kprobe { 97struct prev_kprobe {
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 1b04e5723548..b204926ce913 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -153,9 +153,6 @@ struct machdep_calls {
153 */ 153 */
154 long (*feature_call)(unsigned int feature, ...); 154 long (*feature_call)(unsigned int feature, ...);
155 155
156 /* Check availability of legacy devices like i8042 */
157 int (*check_legacy_ioport)(unsigned int baseport);
158
159 /* Get legacy PCI/IDE interrupt mapping */ 156 /* Get legacy PCI/IDE interrupt mapping */
160 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel); 157 int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
161 158
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
new file mode 100644
index 000000000000..6739457d8bc0
--- /dev/null
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -0,0 +1,400 @@
1#ifndef _ASM_POWERPC_MMU_HASH64_H_
2#define _ASM_POWERPC_MMU_HASH64_H_
3/*
4 * PowerPC64 memory management structures
5 *
6 * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com>
7 * PPC64 rework.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <asm/asm-compat.h>
16#include <asm/page.h>
17
18/*
19 * Segment table
20 */
21
22#define STE_ESID_V 0x80
23#define STE_ESID_KS 0x20
24#define STE_ESID_KP 0x10
25#define STE_ESID_N 0x08
26
27#define STE_VSID_SHIFT 12
28
29/* Location of cpu0's segment table */
30#define STAB0_PAGE 0x6
31#define STAB0_OFFSET (STAB0_PAGE << 12)
32#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
33
34#ifndef __ASSEMBLY__
35extern char initial_stab[];
36#endif /* ! __ASSEMBLY */
37
38/*
39 * SLB
40 */
41
42#define SLB_NUM_BOLTED 3
43#define SLB_CACHE_ENTRIES 8
44
45/* Bits in the SLB ESID word */
46#define SLB_ESID_V ASM_CONST(0x0000000008000000) /* valid */
47
48/* Bits in the SLB VSID word */
49#define SLB_VSID_SHIFT 12
50#define SLB_VSID_B ASM_CONST(0xc000000000000000)
51#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
52#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
53#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
54#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
55#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
56#define SLB_VSID_L ASM_CONST(0x0000000000000100)
57#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
58#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
59#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
60#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
61#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
62#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
63#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
64
65#define SLB_VSID_KERNEL (SLB_VSID_KP)
66#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
67
68#define SLBIE_C (0x08000000)
69
70/*
71 * Hash table
72 */
73
74#define HPTES_PER_GROUP 8
75
76#define HPTE_V_AVPN_SHIFT 7
77#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
78#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
79#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN))
80#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
81#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
82#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
83#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
84#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
85
86#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
87#define HPTE_R_TS ASM_CONST(0x4000000000000000)
88#define HPTE_R_RPN_SHIFT 12
89#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
90#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
91#define HPTE_R_PP ASM_CONST(0x0000000000000003)
92#define HPTE_R_N ASM_CONST(0x0000000000000004)
93#define HPTE_R_C ASM_CONST(0x0000000000000080)
94#define HPTE_R_R ASM_CONST(0x0000000000000100)
95
96/* Values for PP (assumes Ks=0, Kp=1) */
97/* pp0 will always be 0 for linux */
98#define PP_RWXX 0 /* Supervisor read/write, User none */
99#define PP_RWRX 1 /* Supervisor read/write, User read */
100#define PP_RWRW 2 /* Supervisor read/write, User read/write */
101#define PP_RXRX 3 /* Supervisor read, User read */
102
103#ifndef __ASSEMBLY__
104
105typedef struct {
106 unsigned long v;
107 unsigned long r;
108} hpte_t;
109
110extern hpte_t *htab_address;
111extern unsigned long htab_size_bytes;
112extern unsigned long htab_hash_mask;
113
114/*
115 * Page size definition
116 *
117 * shift : is the "PAGE_SHIFT" value for that page size
118 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
119 * directly to a slbmte "vsid" value
120 * penc : is the HPTE encoding mask for the "LP" field:
121 *
122 */
123struct mmu_psize_def
124{
125 unsigned int shift; /* number of bits */
126 unsigned int penc; /* HPTE encoding */
127 unsigned int tlbiel; /* tlbiel supported for that page size */
128 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
129 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
130};
131
132#endif /* __ASSEMBLY__ */
133
134/*
135 * The kernel use the constants below to index in the page sizes array.
136 * The use of fixed constants for this purpose is better for performances
137 * of the low level hash refill handlers.
138 *
139 * A non supported page size has a "shift" field set to 0
140 *
141 * Any new page size being implemented can get a new entry in here. Whether
142 * the kernel will use it or not is a different matter though. The actual page
143 * size used by hugetlbfs is not defined here and may be made variable
144 */
145
146#define MMU_PAGE_4K 0 /* 4K */
147#define MMU_PAGE_64K 1 /* 64K */
148#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
149#define MMU_PAGE_1M 3 /* 1M */
150#define MMU_PAGE_16M 4 /* 16M */
151#define MMU_PAGE_16G 5 /* 16G */
152#define MMU_PAGE_COUNT 6
153
154#ifndef __ASSEMBLY__
155
156/*
157 * The current system page sizes
158 */
159extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
160extern int mmu_linear_psize;
161extern int mmu_virtual_psize;
162extern int mmu_vmalloc_psize;
163extern int mmu_io_psize;
164
165/*
166 * If the processor supports 64k normal pages but not 64k cache
167 * inhibited pages, we have to be prepared to switch processes
168 * to use 4k pages when they create cache-inhibited mappings.
169 * If this is the case, mmu_ci_restrictions will be set to 1.
170 */
171extern int mmu_ci_restrictions;
172
173#ifdef CONFIG_HUGETLB_PAGE
174/*
175 * The page size index of the huge pages for use by hugetlbfs
176 */
177extern int mmu_huge_psize;
178
179#endif /* CONFIG_HUGETLB_PAGE */
180
181/*
182 * This function sets the AVPN and L fields of the HPTE appropriately
183 * for the page size
184 */
185static inline unsigned long hpte_encode_v(unsigned long va, int psize)
186{
187 unsigned long v =
188 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
189 v <<= HPTE_V_AVPN_SHIFT;
190 if (psize != MMU_PAGE_4K)
191 v |= HPTE_V_LARGE;
192 return v;
193}
194
195/*
196 * This function sets the ARPN, and LP fields of the HPTE appropriately
197 * for the page size. We assume the pa is already "clean" that is properly
198 * aligned for the requested page size
199 */
200static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
201{
202 unsigned long r;
203
204 /* A 4K page needs no special encoding */
205 if (psize == MMU_PAGE_4K)
206 return pa & HPTE_R_RPN;
207 else {
208 unsigned int penc = mmu_psize_defs[psize].penc;
209 unsigned int shift = mmu_psize_defs[psize].shift;
210 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
211 }
212 return r;
213}
214
215/*
216 * This hashes a virtual address for a 256Mb segment only for now
217 */
218
219static inline unsigned long hpt_hash(unsigned long va, unsigned int shift)
220{
221 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift);
222}
223
224extern int __hash_page_4K(unsigned long ea, unsigned long access,
225 unsigned long vsid, pte_t *ptep, unsigned long trap,
226 unsigned int local);
227extern int __hash_page_64K(unsigned long ea, unsigned long access,
228 unsigned long vsid, pte_t *ptep, unsigned long trap,
229 unsigned int local);
230struct mm_struct;
231extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
232extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
233 unsigned long ea, unsigned long vsid, int local,
234 unsigned long trap);
235
236extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
237 unsigned long pstart, unsigned long mode,
238 int psize);
239
240extern void htab_initialize(void);
241extern void htab_initialize_secondary(void);
242extern void hpte_init_native(void);
243extern void hpte_init_lpar(void);
244extern void hpte_init_iSeries(void);
245extern void hpte_init_beat(void);
246
247extern void stabs_alloc(void);
248extern void slb_initialize(void);
249extern void slb_flush_and_rebolt(void);
250extern void stab_initialize(unsigned long stab);
251
252#endif /* __ASSEMBLY__ */
253
254/*
255 * VSID allocation
256 *
257 * We first generate a 36-bit "proto-VSID". For kernel addresses this
258 * is equal to the ESID, for user addresses it is:
259 * (context << 15) | (esid & 0x7fff)
260 *
261 * The two forms are distinguishable because the top bit is 0 for user
262 * addresses, whereas the top two bits are 1 for kernel addresses.
263 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
264 * now.
265 *
266 * The proto-VSIDs are then scrambled into real VSIDs with the
267 * multiplicative hash:
268 *
269 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
270 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
271 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
272 *
273 * This scramble is only well defined for proto-VSIDs below
274 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
275 * reserved. VSID_MULTIPLIER is prime, so in particular it is
276 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
277 * Because the modulus is 2^n-1 we can compute it efficiently without
278 * a divide or extra multiply (see below).
279 *
280 * This scheme has several advantages over older methods:
281 *
282 * - We have VSIDs allocated for every kernel address
283 * (i.e. everything above 0xC000000000000000), except the very top
284 * segment, which simplifies several things.
285 *
286 * - We allow for 15 significant bits of ESID and 20 bits of
287 * context for user addresses. i.e. 8T (43 bits) of address space for
288 * up to 1M contexts (although the page table structure and context
289 * allocation will need changes to take advantage of this).
290 *
291 * - The scramble function gives robust scattering in the hash
292 * table (at least based on some initial results). The previous
293 * method was more susceptible to pathological cases giving excessive
294 * hash collisions.
295 */
296/*
297 * WARNING - If you change these you must make sure the asm
298 * implementations in slb_allocate (slb_low.S), do_stab_bolted
299 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
300 *
301 * You'll also need to change the precomputed VSID values in head.S
302 * which are used by the iSeries firmware.
303 */
304
305#define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */
306#define VSID_BITS 36
307#define VSID_MODULUS ((1UL<<VSID_BITS)-1)
308
309#define CONTEXT_BITS 19
310#define USER_ESID_BITS 16
311
312#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
313
314/*
315 * This macro generates asm code to compute the VSID scramble
316 * function. Used in slb_allocate() and do_stab_bolted. The function
317 * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS
318 *
319 * rt = register continaing the proto-VSID and into which the
320 * VSID will be stored
321 * rx = scratch register (clobbered)
322 *
323 * - rt and rx must be different registers
324 * - The answer will end up in the low 36 bits of rt. The higher
325 * bits may contain other garbage, so you may need to mask the
326 * result.
327 */
328#define ASM_VSID_SCRAMBLE(rt, rx) \
329 lis rx,VSID_MULTIPLIER@h; \
330 ori rx,rx,VSID_MULTIPLIER@l; \
331 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
332 \
333 srdi rx,rt,VSID_BITS; \
334 clrldi rt,rt,(64-VSID_BITS); \
335 add rt,rt,rx; /* add high and low bits */ \
336 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
337 * 2^36-1+2^28-1. That in particular means that if r3 >= \
338 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
339 * the bit clear, r3 already has the answer we want, if it \
340 * doesn't, the answer is the low 36 bits of r3+1. So in all \
341 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
342 addi rx,rt,1; \
343 srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \
344 add rt,rt,rx
345
346
347#ifndef __ASSEMBLY__
348
349typedef unsigned long mm_context_id_t;
350
351typedef struct {
352 mm_context_id_t id;
353 u16 user_psize; /* page size index */
354 u16 sllp; /* SLB entry page size encoding */
355#ifdef CONFIG_HUGETLB_PAGE
356 u16 low_htlb_areas, high_htlb_areas;
357#endif
358 unsigned long vdso_base;
359} mm_context_t;
360
361
362static inline unsigned long vsid_scramble(unsigned long protovsid)
363{
364#if 0
365 /* The code below is equivalent to this function for arguments
366 * < 2^VSID_BITS, which is all this should ever be called
367 * with. However gcc is not clever enough to compute the
368 * modulus (2^n-1) without a second multiply. */
369 return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS);
370#else /* 1 */
371 unsigned long x;
372
373 x = protovsid * VSID_MULTIPLIER;
374 x = (x >> VSID_BITS) + (x & VSID_MODULUS);
375 return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS;
376#endif /* 1 */
377}
378
379/* This is only valid for addresses >= KERNELBASE */
380static inline unsigned long get_kernel_vsid(unsigned long ea)
381{
382 return vsid_scramble(ea >> SID_SHIFT);
383}
384
385/* This is only valid for user addresses (which are below 2^41) */
386static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
387{
388 return vsid_scramble((context << USER_ESID_BITS)
389 | (ea >> SID_SHIFT));
390}
391
392#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
393#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
394
395/* Physical address used by some IO functions */
396typedef unsigned long phys_addr_t;
397
398#endif /* __ASSEMBLY__ */
399
400#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index 41c8c9c5a254..06b3e6d336cb 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -2,406 +2,14 @@
2#define _ASM_POWERPC_MMU_H_ 2#define _ASM_POWERPC_MMU_H_
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#ifndef CONFIG_PPC64 5#ifdef CONFIG_PPC64
6#include <asm-ppc/mmu.h> 6/* 64-bit classic hash table MMU */
7# include <asm/mmu-hash64.h>
7#else 8#else
8 9/* 32-bit. FIXME: split up the 32-bit MMU types, and revise for
9/* 10 * arch/powerpc */
10 * PowerPC memory management structures 11# include <asm-ppc/mmu.h>
11 *
12 * Dave Engebretsen & Mike Corrigan <{engebret|mikejc}@us.ibm.com>
13 * PPC64 rework.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#include <asm/asm-compat.h>
22#include <asm/page.h>
23
24/*
25 * Segment table
26 */
27
28#define STE_ESID_V 0x80
29#define STE_ESID_KS 0x20
30#define STE_ESID_KP 0x10
31#define STE_ESID_N 0x08
32
33#define STE_VSID_SHIFT 12
34
35/* Location of cpu0's segment table */
36#define STAB0_PAGE 0x6
37#define STAB0_OFFSET (STAB0_PAGE << 12)
38#define STAB0_PHYS_ADDR (STAB0_OFFSET + PHYSICAL_START)
39
40#ifndef __ASSEMBLY__
41extern char initial_stab[];
42#endif /* ! __ASSEMBLY */
43
44/*
45 * SLB
46 */
47
48#define SLB_NUM_BOLTED 3
49#define SLB_CACHE_ENTRIES 8
50
51/* Bits in the SLB ESID word */
52#define SLB_ESID_V ASM_CONST(0x0000000008000000) /* valid */
53
54/* Bits in the SLB VSID word */
55#define SLB_VSID_SHIFT 12
56#define SLB_VSID_B ASM_CONST(0xc000000000000000)
57#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
58#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
59#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
60#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
61#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
62#define SLB_VSID_L ASM_CONST(0x0000000000000100)
63#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
64#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
65#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
66#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
67#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
68#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
69#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
70
71#define SLB_VSID_KERNEL (SLB_VSID_KP)
72#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
73
74#define SLBIE_C (0x08000000)
75
76/*
77 * Hash table
78 */
79
80#define HPTES_PER_GROUP 8
81
82#define HPTE_V_AVPN_SHIFT 7
83#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
84#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
85#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN))
86#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
87#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
88#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
89#define HPTE_V_SECONDARY ASM_CONST(0x0000000000000002)
90#define HPTE_V_VALID ASM_CONST(0x0000000000000001)
91
92#define HPTE_R_PP0 ASM_CONST(0x8000000000000000)
93#define HPTE_R_TS ASM_CONST(0x4000000000000000)
94#define HPTE_R_RPN_SHIFT 12
95#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
96#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
97#define HPTE_R_PP ASM_CONST(0x0000000000000003)
98#define HPTE_R_N ASM_CONST(0x0000000000000004)
99#define HPTE_R_C ASM_CONST(0x0000000000000080)
100#define HPTE_R_R ASM_CONST(0x0000000000000100)
101
102/* Values for PP (assumes Ks=0, Kp=1) */
103/* pp0 will always be 0 for linux */
104#define PP_RWXX 0 /* Supervisor read/write, User none */
105#define PP_RWRX 1 /* Supervisor read/write, User read */
106#define PP_RWRW 2 /* Supervisor read/write, User read/write */
107#define PP_RXRX 3 /* Supervisor read, User read */
108
109#ifndef __ASSEMBLY__
110
111typedef struct {
112 unsigned long v;
113 unsigned long r;
114} hpte_t;
115
116extern hpte_t *htab_address;
117extern unsigned long htab_size_bytes;
118extern unsigned long htab_hash_mask;
119
120/*
121 * Page size definition
122 *
123 * shift : is the "PAGE_SHIFT" value for that page size
124 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
125 * directly to a slbmte "vsid" value
126 * penc : is the HPTE encoding mask for the "LP" field:
127 *
128 */
129struct mmu_psize_def
130{
131 unsigned int shift; /* number of bits */
132 unsigned int penc; /* HPTE encoding */
133 unsigned int tlbiel; /* tlbiel supported for that page size */
134 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
135 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
136};
137
138#endif /* __ASSEMBLY__ */
139
140/*
141 * The kernel use the constants below to index in the page sizes array.
142 * The use of fixed constants for this purpose is better for performances
143 * of the low level hash refill handlers.
144 *
145 * A non supported page size has a "shift" field set to 0
146 *
147 * Any new page size being implemented can get a new entry in here. Whether
148 * the kernel will use it or not is a different matter though. The actual page
149 * size used by hugetlbfs is not defined here and may be made variable
150 */
151
152#define MMU_PAGE_4K 0 /* 4K */
153#define MMU_PAGE_64K 1 /* 64K */
154#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
155#define MMU_PAGE_1M 3 /* 1M */
156#define MMU_PAGE_16M 4 /* 16M */
157#define MMU_PAGE_16G 5 /* 16G */
158#define MMU_PAGE_COUNT 6
159
160#ifndef __ASSEMBLY__
161
162/*
163 * The current system page sizes
164 */
165extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
166extern int mmu_linear_psize;
167extern int mmu_virtual_psize;
168extern int mmu_vmalloc_psize;
169extern int mmu_io_psize;
170
171/*
172 * If the processor supports 64k normal pages but not 64k cache
173 * inhibited pages, we have to be prepared to switch processes
174 * to use 4k pages when they create cache-inhibited mappings.
175 * If this is the case, mmu_ci_restrictions will be set to 1.
176 */
177extern int mmu_ci_restrictions;
178
179#ifdef CONFIG_HUGETLB_PAGE
180/*
181 * The page size index of the huge pages for use by hugetlbfs
182 */
183extern int mmu_huge_psize;
184
185#endif /* CONFIG_HUGETLB_PAGE */
186
187/*
188 * This function sets the AVPN and L fields of the HPTE appropriately
189 * for the page size
190 */
191static inline unsigned long hpte_encode_v(unsigned long va, int psize)
192{
193 unsigned long v =
194 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
195 v <<= HPTE_V_AVPN_SHIFT;
196 if (psize != MMU_PAGE_4K)
197 v |= HPTE_V_LARGE;
198 return v;
199}
200
201/*
202 * This function sets the ARPN, and LP fields of the HPTE appropriately
203 * for the page size. We assume the pa is already "clean" that is properly
204 * aligned for the requested page size
205 */
206static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
207{
208 unsigned long r;
209
210 /* A 4K page needs no special encoding */
211 if (psize == MMU_PAGE_4K)
212 return pa & HPTE_R_RPN;
213 else {
214 unsigned int penc = mmu_psize_defs[psize].penc;
215 unsigned int shift = mmu_psize_defs[psize].shift;
216 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
217 }
218 return r;
219}
220
221/*
222 * This hashes a virtual address for a 256Mb segment only for now
223 */
224
225static inline unsigned long hpt_hash(unsigned long va, unsigned int shift)
226{
227 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift);
228}
229
230extern int __hash_page_4K(unsigned long ea, unsigned long access,
231 unsigned long vsid, pte_t *ptep, unsigned long trap,
232 unsigned int local);
233extern int __hash_page_64K(unsigned long ea, unsigned long access,
234 unsigned long vsid, pte_t *ptep, unsigned long trap,
235 unsigned int local);
236struct mm_struct;
237extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
238 unsigned long ea, unsigned long vsid, int local,
239 unsigned long trap);
240
241extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
242 unsigned long pstart, unsigned long mode,
243 int psize);
244
245extern void htab_initialize(void);
246extern void htab_initialize_secondary(void);
247extern void hpte_init_native(void);
248extern void hpte_init_lpar(void);
249extern void hpte_init_iSeries(void);
250
251extern void stabs_alloc(void);
252extern void slb_initialize(void);
253extern void slb_flush_and_rebolt(void);
254extern void stab_initialize(unsigned long stab);
255
256#endif /* __ASSEMBLY__ */
257
258/*
259 * VSID allocation
260 *
261 * We first generate a 36-bit "proto-VSID". For kernel addresses this
262 * is equal to the ESID, for user addresses it is:
263 * (context << 15) | (esid & 0x7fff)
264 *
265 * The two forms are distinguishable because the top bit is 0 for user
266 * addresses, whereas the top two bits are 1 for kernel addresses.
267 * Proto-VSIDs with the top two bits equal to 0b10 are reserved for
268 * now.
269 *
270 * The proto-VSIDs are then scrambled into real VSIDs with the
271 * multiplicative hash:
272 *
273 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS
274 * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7
275 * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF
276 *
277 * This scramble is only well defined for proto-VSIDs below
278 * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are
279 * reserved. VSID_MULTIPLIER is prime, so in particular it is
280 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
281 * Because the modulus is 2^n-1 we can compute it efficiently without
282 * a divide or extra multiply (see below).
283 *
284 * This scheme has several advantages over older methods:
285 *
286 * - We have VSIDs allocated for every kernel address
287 * (i.e. everything above 0xC000000000000000), except the very top
288 * segment, which simplifies several things.
289 *
290 * - We allow for 15 significant bits of ESID and 20 bits of
291 * context for user addresses. i.e. 8T (43 bits) of address space for
292 * up to 1M contexts (although the page table structure and context
293 * allocation will need changes to take advantage of this).
294 *
295 * - The scramble function gives robust scattering in the hash
296 * table (at least based on some initial results). The previous
297 * method was more susceptible to pathological cases giving excessive
298 * hash collisions.
299 */
300/*
301 * WARNING - If you change these you must make sure the asm
302 * implementations in slb_allocate (slb_low.S), do_stab_bolted
303 * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly.
304 *
305 * You'll also need to change the precomputed VSID values in head.S
306 * which are used by the iSeries firmware.
307 */
308
309#define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */
310#define VSID_BITS 36
311#define VSID_MODULUS ((1UL<<VSID_BITS)-1)
312
313#define CONTEXT_BITS 19
314#define USER_ESID_BITS 16
315
316#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
317
318/*
319 * This macro generates asm code to compute the VSID scramble
320 * function. Used in slb_allocate() and do_stab_bolted. The function
321 * computed is: (protovsid*VSID_MULTIPLIER) % VSID_MODULUS
322 *
323 * rt = register continaing the proto-VSID and into which the
324 * VSID will be stored
325 * rx = scratch register (clobbered)
326 *
327 * - rt and rx must be different registers
328 * - The answer will end up in the low 36 bits of rt. The higher
329 * bits may contain other garbage, so you may need to mask the
330 * result.
331 */
332#define ASM_VSID_SCRAMBLE(rt, rx) \
333 lis rx,VSID_MULTIPLIER@h; \
334 ori rx,rx,VSID_MULTIPLIER@l; \
335 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
336 \
337 srdi rx,rt,VSID_BITS; \
338 clrldi rt,rt,(64-VSID_BITS); \
339 add rt,rt,rx; /* add high and low bits */ \
340 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
341 * 2^36-1+2^28-1. That in particular means that if r3 >= \
342 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
343 * the bit clear, r3 already has the answer we want, if it \
344 * doesn't, the answer is the low 36 bits of r3+1. So in all \
345 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
346 addi rx,rt,1; \
347 srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \
348 add rt,rt,rx
349
350
351#ifndef __ASSEMBLY__
352
353typedef unsigned long mm_context_id_t;
354
355typedef struct {
356 mm_context_id_t id;
357 u16 user_psize; /* page size index */
358 u16 sllp; /* SLB entry page size encoding */
359#ifdef CONFIG_HUGETLB_PAGE
360 u16 low_htlb_areas, high_htlb_areas;
361#endif 12#endif
362 unsigned long vdso_base;
363} mm_context_t;
364
365
366static inline unsigned long vsid_scramble(unsigned long protovsid)
367{
368#if 0
369 /* The code below is equivalent to this function for arguments
370 * < 2^VSID_BITS, which is all this should ever be called
371 * with. However gcc is not clever enough to compute the
372 * modulus (2^n-1) without a second multiply. */
373 return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS);
374#else /* 1 */
375 unsigned long x;
376
377 x = protovsid * VSID_MULTIPLIER;
378 x = (x >> VSID_BITS) + (x & VSID_MODULUS);
379 return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS;
380#endif /* 1 */
381}
382
383/* This is only valid for addresses >= KERNELBASE */
384static inline unsigned long get_kernel_vsid(unsigned long ea)
385{
386 return vsid_scramble(ea >> SID_SHIFT);
387}
388
389/* This is only valid for user addresses (which are below 2^41) */
390static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
391{
392 return vsid_scramble((context << USER_ESID_BITS)
393 | (ea >> SID_SHIFT));
394}
395
396#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS)
397#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
398
399/* Physical address used by some IO functions */
400typedef unsigned long phys_addr_t;
401
402
403#endif /* __ASSEMBLY */
404 13
405#endif /* CONFIG_PPC64 */
406#endif /* __KERNEL__ */ 14#endif /* __KERNEL__ */
407#endif /* _ASM_POWERPC_MMU_H_ */ 15#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 4560d72fc758..7afd5bf94528 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -249,6 +249,8 @@ extern void mpc52xx_declare_of_platform_devices(void);
249extern void mpc52xx_init_irq(void); 249extern void mpc52xx_init_irq(void);
250extern unsigned int mpc52xx_get_irq(void); 250extern unsigned int mpc52xx_get_irq(void);
251 251
252extern int __init mpc52xx_add_bridge(struct device_node *node);
253
252#endif /* __ASSEMBLY__ */ 254#endif /* __ASSEMBLY__ */
253 255
254#endif /* __ASM_POWERPC_MPC52xx_H__ */ 256#endif /* __ASM_POWERPC_MPC52xx_H__ */
diff --git a/include/asm-powerpc/mpc8260.h b/include/asm-powerpc/mpc8260.h
new file mode 100644
index 000000000000..f1b83b09ab2e
--- /dev/null
+++ b/include/asm-powerpc/mpc8260.h
@@ -0,0 +1,24 @@
1/*
2 * Since there are many different boards and no standard configuration,
3 * we have a unique include file for each. Rather than change every
4 * file that has to include MPC8260 configuration, they all include
5 * this one and the configuration switching is done here.
6 */
7#ifdef __KERNEL__
8#ifndef __ASM_PPC_MPC8260_H__
9#define __ASM_PPC_MPC8260_H__
10
11
12#ifdef CONFIG_8260
13
14#if defined(CONFIG_PQ2ADS) || defined (CONFIG_PQ2FADS)
15#include <platforms/82xx/pq2ads.h>
16#endif
17
18#ifdef CONFIG_PCI_8260
19#include <platforms/82xx/m82xx_pci.h>
20#endif
21
22#endif /* CONFIG_8260 */
23#endif /* !__ASM_PPC_MPC8260_H__ */
24#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mpc8xx.h b/include/asm-powerpc/mpc8xx.h
new file mode 100644
index 000000000000..580371120e1a
--- /dev/null
+++ b/include/asm-powerpc/mpc8xx.h
@@ -0,0 +1,28 @@
1/* This is the single file included by all MPC8xx build options.
2 * Since there are many different boards and no standard configuration,
3 * we have a unique include file for each. Rather than change every
4 * file that has to include MPC8xx configuration, they all include
5 * this one and the configuration switching is done here.
6 */
7#ifdef __KERNEL__
8#ifndef __CONFIG_8xx_DEFS
9#define __CONFIG_8xx_DEFS
10
11
12#ifdef CONFIG_8xx
13
14#ifdef CONFIG_FADS
15#include <platforms/fads.h>
16#endif
17
18#if defined(CONFIG_MPC86XADS)
19#include <platforms/8xx/mpc86xads.h>
20#endif
21
22#if defined(CONFIG_MPC885ADS)
23#include <platforms/8xx/mpc885ads.h>
24#endif
25
26#endif /* CONFIG_8xx */
27#endif /* __CONFIG_8xx_DEFS */
28#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index b71e7b32a555..e4d5fc5362a0 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -103,21 +103,6 @@
103#define MPIC_MAX_ISU 32 103#define MPIC_MAX_ISU 32
104 104
105/* 105/*
106 * Special vector numbers (internal use only)
107 */
108#define MPIC_VEC_SPURRIOUS 255
109#define MPIC_VEC_IPI_3 254
110#define MPIC_VEC_IPI_2 253
111#define MPIC_VEC_IPI_1 252
112#define MPIC_VEC_IPI_0 251
113
114/* unused */
115#define MPIC_VEC_TIMER_3 250
116#define MPIC_VEC_TIMER_2 249
117#define MPIC_VEC_TIMER_1 248
118#define MPIC_VEC_TIMER_0 247
119
120/*
121 * Tsi108 implementation of MPIC has many differences from the original one 106 * Tsi108 implementation of MPIC has many differences from the original one
122 */ 107 */
123 108
@@ -214,7 +199,7 @@ enum {
214}; 199};
215 200
216 201
217#ifdef CONFIG_MPIC_BROKEN_U3 202#ifdef CONFIG_MPIC_U3_HT_IRQS
218/* Fixup table entry */ 203/* Fixup table entry */
219struct mpic_irq_fixup 204struct mpic_irq_fixup
220{ 205{
@@ -223,7 +208,7 @@ struct mpic_irq_fixup
223 u32 data; 208 u32 data;
224 unsigned int index; 209 unsigned int index;
225}; 210};
226#endif /* CONFIG_MPIC_BROKEN_U3 */ 211#endif /* CONFIG_MPIC_U3_HT_IRQS */
227 212
228 213
229enum mpic_reg_type { 214enum mpic_reg_type {
@@ -254,7 +239,7 @@ struct mpic
254 239
255 /* The "linux" controller struct */ 240 /* The "linux" controller struct */
256 struct irq_chip hc_irq; 241 struct irq_chip hc_irq;
257#ifdef CONFIG_MPIC_BROKEN_U3 242#ifdef CONFIG_MPIC_U3_HT_IRQS
258 struct irq_chip hc_ht_irq; 243 struct irq_chip hc_ht_irq;
259#endif 244#endif
260#ifdef CONFIG_SMP 245#ifdef CONFIG_SMP
@@ -276,7 +261,14 @@ struct mpic
276 unsigned char *senses; 261 unsigned char *senses;
277 unsigned int senses_count; 262 unsigned int senses_count;
278 263
279#ifdef CONFIG_MPIC_BROKEN_U3 264 /* vector numbers used for internal sources (ipi/timers) */
265 unsigned int ipi_vecs[4];
266 unsigned int timer_vecs[4];
267
268 /* Spurious vector to program into unused sources */
269 unsigned int spurious_vec;
270
271#ifdef CONFIG_MPIC_U3_HT_IRQS
280 /* The fixup table */ 272 /* The fixup table */
281 struct mpic_irq_fixup *fixups; 273 struct mpic_irq_fixup *fixups;
282 spinlock_t fixup_lock; 274 spinlock_t fixup_lock;
@@ -321,7 +313,7 @@ struct mpic
321/* Set this for a big-endian MPIC */ 313/* Set this for a big-endian MPIC */
322#define MPIC_BIG_ENDIAN 0x00000002 314#define MPIC_BIG_ENDIAN 0x00000002
323/* Broken U3 MPIC */ 315/* Broken U3 MPIC */
324#define MPIC_BROKEN_U3 0x00000004 316#define MPIC_U3_HT_IRQS 0x00000004
325/* Broken IPI registers (autodetected) */ 317/* Broken IPI registers (autodetected) */
326#define MPIC_BROKEN_IPI 0x00000008 318#define MPIC_BROKEN_IPI 0x00000008
327/* MPIC wants a reset */ 319/* MPIC wants a reset */
@@ -332,6 +324,8 @@ struct mpic
332#define MPIC_NO_PTHROU_DIS 0x00000040 324#define MPIC_NO_PTHROU_DIS 0x00000040
333/* DCR based MPIC */ 325/* DCR based MPIC */
334#define MPIC_USES_DCR 0x00000080 326#define MPIC_USES_DCR 0x00000080
327/* MPIC has 11-bit vector fields (or larger) */
328#define MPIC_LARGE_VECTORS 0x00000100
335 329
336/* MPIC HW modification ID */ 330/* MPIC HW modification ID */
337#define MPIC_REGSET_MASK 0xf0000000 331#define MPIC_REGSET_MASK 0xf0000000
@@ -358,7 +352,7 @@ struct mpic
358 * @senses_num: number of entries in the array 352 * @senses_num: number of entries in the array
359 * 353 *
360 * Note about the sense array. If none is passed, all interrupts are 354 * Note about the sense array. If none is passed, all interrupts are
361 * setup to be level negative unless MPIC_BROKEN_U3 is set in which 355 * setup to be level negative unless MPIC_U3_HT_IRQS is set in which
362 * case they are edge positive (and the array is ignored anyway). 356 * case they are edge positive (and the array is ignored anyway).
363 * The values in the array start at the first source of the MPIC, 357 * The values in the array start at the first source of the MPIC,
364 * that is senses[0] correspond to linux irq "irq_offset". 358 * that is senses[0] correspond to linux irq "irq_offset".
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index a889b2005bf5..4f1aabe0ce73 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -32,5 +32,8 @@ extern int of_device_register(struct of_device *ofdev);
32extern void of_device_unregister(struct of_device *ofdev); 32extern void of_device_unregister(struct of_device *ofdev);
33extern void of_release_dev(struct device *dev); 33extern void of_release_dev(struct device *dev);
34 34
35extern int of_device_uevent(struct device *dev,
36 char **envp, int num_envp, char *buffer, int buffer_size);
37
35#endif /* __KERNEL__ */ 38#endif /* __KERNEL__ */
36#endif /* _ASM_POWERPC_OF_DEVICE_H */ 39#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 71043bf3641f..8d6b47f7b300 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -57,11 +57,11 @@ extern struct op_powerpc_model op_model_rs64;
57extern struct op_powerpc_model op_model_power4; 57extern struct op_powerpc_model op_model_power4;
58extern struct op_powerpc_model op_model_7450; 58extern struct op_powerpc_model op_model_7450;
59extern struct op_powerpc_model op_model_cell; 59extern struct op_powerpc_model op_model_cell;
60extern struct op_powerpc_model op_model_pa6t;
60 61
61#ifndef CONFIG_FSL_BOOKE
62 62
63/* All the classic PPC parts use these */ 63/* All the classic PPC parts use these */
64static inline unsigned int ctr_read(unsigned int i) 64static inline unsigned int classic_ctr_read(unsigned int i)
65{ 65{
66 switch(i) { 66 switch(i) {
67 case 0: 67 case 0:
@@ -89,7 +89,7 @@ static inline unsigned int ctr_read(unsigned int i)
89 } 89 }
90} 90}
91 91
92static inline void ctr_write(unsigned int i, unsigned int val) 92static inline void classic_ctr_write(unsigned int i, unsigned int val)
93{ 93{
94 switch(i) { 94 switch(i) {
95 case 0: 95 case 0:
@@ -124,89 +124,6 @@ static inline void ctr_write(unsigned int i, unsigned int val)
124 break; 124 break;
125 } 125 }
126} 126}
127#else /* CONFIG_FSL_BOOKE */
128static inline u32 get_pmlca(int ctr)
129{
130 u32 pmlca;
131
132 switch (ctr) {
133 case 0:
134 pmlca = mfpmr(PMRN_PMLCA0);
135 break;
136 case 1:
137 pmlca = mfpmr(PMRN_PMLCA1);
138 break;
139 case 2:
140 pmlca = mfpmr(PMRN_PMLCA2);
141 break;
142 case 3:
143 pmlca = mfpmr(PMRN_PMLCA3);
144 break;
145 default:
146 panic("Bad ctr number\n");
147 }
148
149 return pmlca;
150}
151
152static inline void set_pmlca(int ctr, u32 pmlca)
153{
154 switch (ctr) {
155 case 0:
156 mtpmr(PMRN_PMLCA0, pmlca);
157 break;
158 case 1:
159 mtpmr(PMRN_PMLCA1, pmlca);
160 break;
161 case 2:
162 mtpmr(PMRN_PMLCA2, pmlca);
163 break;
164 case 3:
165 mtpmr(PMRN_PMLCA3, pmlca);
166 break;
167 default:
168 panic("Bad ctr number\n");
169 }
170}
171
172static inline unsigned int ctr_read(unsigned int i)
173{
174 switch(i) {
175 case 0:
176 return mfpmr(PMRN_PMC0);
177 case 1:
178 return mfpmr(PMRN_PMC1);
179 case 2:
180 return mfpmr(PMRN_PMC2);
181 case 3:
182 return mfpmr(PMRN_PMC3);
183 default:
184 return 0;
185 }
186}
187
188static inline void ctr_write(unsigned int i, unsigned int val)
189{
190 switch(i) {
191 case 0:
192 mtpmr(PMRN_PMC0, val);
193 break;
194 case 1:
195 mtpmr(PMRN_PMC1, val);
196 break;
197 case 2:
198 mtpmr(PMRN_PMC2, val);
199 break;
200 case 3:
201 mtpmr(PMRN_PMC3, val);
202 break;
203 default:
204 break;
205 }
206}
207
208
209#endif /* CONFIG_FSL_BOOKE */
210 127
211 128
212extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth); 129extern void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth);
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index 0d3adc09c847..cf95274f735e 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -70,6 +70,7 @@ struct paca_struct {
70 s16 hw_cpu_id; /* Physical processor number */ 70 s16 hw_cpu_id; /* Physical processor number */
71 u8 cpu_start; /* At startup, processor spins until */ 71 u8 cpu_start; /* At startup, processor spins until */
72 /* this becomes non-zero. */ 72 /* this becomes non-zero. */
73 struct slb_shadow *slb_shadow_ptr;
73 74
74 /* 75 /*
75 * Now, starting in cacheline 2, the exception save areas 76 * Now, starting in cacheline 2, the exception save areas
@@ -93,6 +94,7 @@ struct paca_struct {
93 u64 stab_rr; /* stab/slb round-robin counter */ 94 u64 stab_rr; /* stab/slb round-robin counter */
94 u64 saved_r1; /* r1 save for RTAS calls */ 95 u64 saved_r1; /* r1 save for RTAS calls */
95 u64 saved_msr; /* MSR saved here by enter_rtas */ 96 u64 saved_msr; /* MSR saved here by enter_rtas */
97 u16 trap_save; /* Used when bad stack is encountered */
96 u8 soft_enabled; /* irq soft-enable flag */ 98 u8 soft_enabled; /* irq soft-enable flag */
97 u8 hard_enabled; /* set if irqs are enabled in MSR */ 99 u8 hard_enabled; /* set if irqs are enabled in MSR */
98 u8 io_sync; /* writel() needs spin_unlock sync */ 100 u8 io_sync; /* writel() needs spin_unlock sync */
@@ -101,8 +103,6 @@ struct paca_struct {
101 u64 user_time; /* accumulated usermode TB ticks */ 103 u64 user_time; /* accumulated usermode TB ticks */
102 u64 system_time; /* accumulated system TB ticks */ 104 u64 system_time; /* accumulated system TB ticks */
103 u64 startpurr; /* PURR/TB value snapshot */ 105 u64 startpurr; /* PURR/TB value snapshot */
104
105 struct slb_shadow *slb_shadow_ptr;
106}; 106};
107 107
108extern struct paca_struct paca[]; 108extern struct paca_struct paca[];
diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h
index 3fca21ddf546..b37b81e37278 100644
--- a/include/asm-powerpc/parport.h
+++ b/include/asm-powerpc/parport.h
@@ -20,18 +20,18 @@ extern struct parport *parport_pc_probe_port (unsigned long int base,
20static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 20static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
21{ 21{
22 struct device_node *np; 22 struct device_node *np;
23 u32 *prop; 23 const u32 *prop;
24 u32 io1, io2; 24 u32 io1, io2;
25 int propsize; 25 int propsize;
26 int count = 0; 26 int count = 0;
27 for (np = NULL; (np = of_find_compatible_node(np, 27 for (np = NULL; (np = of_find_compatible_node(np,
28 "parallel", 28 "parallel",
29 "pnpPNP,400")) != NULL;) { 29 "pnpPNP,400")) != NULL;) {
30 prop = (u32 *)get_property(np, "reg", &propsize); 30 prop = of_get_property(np, "reg", &propsize);
31 if (!prop || propsize > 6*sizeof(u32)) 31 if (!prop || propsize > 6*sizeof(u32))
32 continue; 32 continue;
33 io1 = prop[1]; io2 = prop[2]; 33 io1 = prop[1]; io2 = prop[2];
34 prop = (u32 *)get_property(np, "interrupts", NULL); 34 prop = of_get_property(np, "interrupts", NULL);
35 if (!prop) 35 if (!prop)
36 continue; 36 continue;
37 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL) 37 if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL)
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index cb02c9d1ef93..d9bf5aba96cb 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -53,6 +53,8 @@ struct pci_controller {
53 unsigned long buid; 53 unsigned long buid;
54 unsigned long dma_window_base_cur; 54 unsigned long dma_window_base_cur;
55 unsigned long dma_window_size; 55 unsigned long dma_window_size;
56
57 void *private_data;
56}; 58};
57 59
58/* 60/*
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index ac656ee6bb19..ce0f13e8eb14 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -70,19 +70,22 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
70 */ 70 */
71#define PCI_DISABLE_MWI 71#define PCI_DISABLE_MWI
72 72
73extern struct dma_mapping_ops *pci_dma_ops; 73#ifdef CONFIG_PCI
74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
75extern struct dma_mapping_ops *get_pci_dma_ops(void);
74 76
75/* For DAC DMA, we currently don't support it by default, but 77/* For DAC DMA, we currently don't support it by default, but
76 * we let 64-bit platforms override this. 78 * we let 64-bit platforms override this.
77 */ 79 */
78static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) 80static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
79{ 81{
80 if (pci_dma_ops && pci_dma_ops->dac_dma_supported) 82 struct dma_mapping_ops *d = get_pci_dma_ops();
81 return pci_dma_ops->dac_dma_supported(&hwdev->dev, mask); 83
84 if (d && d->dac_dma_supported)
85 return d->dac_dma_supported(&hwdev->dev, mask);
82 return 0; 86 return 0;
83} 87}
84 88
85#ifdef CONFIG_PCI
86static inline void pci_dma_burst_advice(struct pci_dev *pdev, 89static inline void pci_dma_burst_advice(struct pci_dev *pdev,
87 enum pci_dma_burst_strategy *strat, 90 enum pci_dma_burst_strategy *strat,
88 unsigned long *strategy_parameter) 91 unsigned long *strategy_parameter)
@@ -99,6 +102,9 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
99 *strat = PCI_DMA_BURST_MULTIPLE; 102 *strat = PCI_DMA_BURST_MULTIPLE;
100 *strategy_parameter = cacheline_size; 103 *strategy_parameter = cacheline_size;
101} 104}
105#else /* CONFIG_PCI */
106#define set_pci_dma_ops(d)
107#define get_pci_dma_ops() NULL
102#endif 108#endif
103 109
104extern int pci_domain_nr(struct pci_bus *bus); 110extern int pci_domain_nr(struct pci_bus *bus);
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index 345d9b07b3e2..a28fa8bc01da 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -97,3 +97,6 @@
97 97
98#define pud_ERROR(e) \ 98#define pud_ERROR(e) \
99 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e)) 99 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
100
101#define remap_4k_pfn(vma, addr, pfn, prot) \
102 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot))
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 4b7126c53f37..5e84f070eaf7 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -35,6 +35,7 @@
35#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */ 35#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */
36#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */ 36#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */
37#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */ 37#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
38#define _PAGE_4K_PFN 0x20000000 /* PFN is for a single 4k page */
38#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */ 39#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */
39#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */ 40#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */
40 41
@@ -93,6 +94,10 @@
93#define pte_pagesize_index(pte) \ 94#define pte_pagesize_index(pte) \
94 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K) 95 (((pte) & _PAGE_COMBO)? MMU_PAGE_4K: MMU_PAGE_64K)
95 96
97#define remap_4k_pfn(vma, addr, pfn, prot) \
98 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \
99 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN))
100
96#endif /* __ASSEMBLY__ */ 101#endif /* __ASSEMBLY__ */
97#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
98#endif /* _ASM_POWERPC_PGTABLE_64K_H */ 103#endif /* _ASM_POWERPC_PGTABLE_64K_H */
diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
index 10f52743f4ff..19edb6982b81 100644
--- a/include/asm-powerpc/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -272,7 +272,10 @@ static inline pte_t pte_mkhuge(pte_t pte) {
272 return pte; } 272 return pte; }
273 273
274/* Atomic PTE updates */ 274/* Atomic PTE updates */
275static inline unsigned long pte_update(pte_t *p, unsigned long clr) 275static inline unsigned long pte_update(struct mm_struct *mm,
276 unsigned long addr,
277 pte_t *ptep, unsigned long clr,
278 int huge)
276{ 279{
277 unsigned long old, tmp; 280 unsigned long old, tmp;
278 281
@@ -283,20 +286,15 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr)
283 andc %1,%0,%4 \n\ 286 andc %1,%0,%4 \n\
284 stdcx. %1,0,%3 \n\ 287 stdcx. %1,0,%3 \n\
285 bne- 1b" 288 bne- 1b"
286 : "=&r" (old), "=&r" (tmp), "=m" (*p) 289 : "=&r" (old), "=&r" (tmp), "=m" (*ptep)
287 : "r" (p), "r" (clr), "m" (*p), "i" (_PAGE_BUSY) 290 : "r" (ptep), "r" (clr), "m" (*ptep), "i" (_PAGE_BUSY)
288 : "cc" ); 291 : "cc" );
292
293 if (old & _PAGE_HASHPTE)
294 hpte_need_flush(mm, addr, ptep, old, huge);
289 return old; 295 return old;
290} 296}
291 297
292/* PTE updating functions, this function puts the PTE in the
293 * batch, doesn't actually triggers the hash flush immediately,
294 * you need to call flush_tlb_pending() to do that.
295 * Pass -1 for "normal" size (4K or 64K)
296 */
297extern void hpte_update(struct mm_struct *mm, unsigned long addr,
298 pte_t *ptep, unsigned long pte, int huge);
299
300static inline int __ptep_test_and_clear_young(struct mm_struct *mm, 298static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
301 unsigned long addr, pte_t *ptep) 299 unsigned long addr, pte_t *ptep)
302{ 300{
@@ -304,11 +302,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
304 302
305 if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0) 303 if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
306 return 0; 304 return 0;
307 old = pte_update(ptep, _PAGE_ACCESSED); 305 old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0);
308 if (old & _PAGE_HASHPTE) {
309 hpte_update(mm, addr, ptep, old, 0);
310 flush_tlb_pending();
311 }
312 return (old & _PAGE_ACCESSED) != 0; 306 return (old & _PAGE_ACCESSED) != 0;
313} 307}
314#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 308#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
@@ -331,9 +325,7 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm,
331 325
332 if ((pte_val(*ptep) & _PAGE_DIRTY) == 0) 326 if ((pte_val(*ptep) & _PAGE_DIRTY) == 0)
333 return 0; 327 return 0;
334 old = pte_update(ptep, _PAGE_DIRTY); 328 old = pte_update(mm, addr, ptep, _PAGE_DIRTY, 0);
335 if (old & _PAGE_HASHPTE)
336 hpte_update(mm, addr, ptep, old, 0);
337 return (old & _PAGE_DIRTY) != 0; 329 return (old & _PAGE_DIRTY) != 0;
338} 330}
339#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 331#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
@@ -352,9 +344,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
352 344
353 if ((pte_val(*ptep) & _PAGE_RW) == 0) 345 if ((pte_val(*ptep) & _PAGE_RW) == 0)
354 return; 346 return;
355 old = pte_update(ptep, _PAGE_RW); 347 old = pte_update(mm, addr, ptep, _PAGE_RW, 0);
356 if (old & _PAGE_HASHPTE)
357 hpte_update(mm, addr, ptep, old, 0);
358} 348}
359 349
360/* 350/*
@@ -378,7 +368,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
378({ \ 368({ \
379 int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \ 369 int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \
380 __ptep); \ 370 __ptep); \
381 flush_tlb_page(__vma, __address); \
382 __dirty; \ 371 __dirty; \
383}) 372})
384 373
@@ -386,20 +375,14 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
386static inline pte_t ptep_get_and_clear(struct mm_struct *mm, 375static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
387 unsigned long addr, pte_t *ptep) 376 unsigned long addr, pte_t *ptep)
388{ 377{
389 unsigned long old = pte_update(ptep, ~0UL); 378 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 0);
390
391 if (old & _PAGE_HASHPTE)
392 hpte_update(mm, addr, ptep, old, 0);
393 return __pte(old); 379 return __pte(old);
394} 380}
395 381
396static inline void pte_clear(struct mm_struct *mm, unsigned long addr, 382static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
397 pte_t * ptep) 383 pte_t * ptep)
398{ 384{
399 unsigned long old = pte_update(ptep, ~0UL); 385 pte_update(mm, addr, ptep, ~0UL, 0);
400
401 if (old & _PAGE_HASHPTE)
402 hpte_update(mm, addr, ptep, old, 0);
403} 386}
404 387
405/* 388/*
@@ -408,10 +391,8 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
408static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 391static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
409 pte_t *ptep, pte_t pte) 392 pte_t *ptep, pte_t pte)
410{ 393{
411 if (pte_present(*ptep)) { 394 if (pte_present(*ptep))
412 pte_clear(mm, addr, ptep); 395 pte_clear(mm, addr, ptep);
413 flush_tlb_pending();
414 }
415 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 396 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
416 *ptep = pte; 397 *ptep = pte;
417} 398}
@@ -467,16 +448,6 @@ extern pgd_t swapper_pg_dir[];
467 448
468extern void paging_init(void); 449extern void paging_init(void);
469 450
470/*
471 * This gets called at the end of handling a page fault, when
472 * the kernel has put a new PTE into the page table for the process.
473 * We use it to put a corresponding HPTE into the hash table
474 * ahead of time, instead of waiting for the inevitable extra
475 * hash-table miss exception.
476 */
477struct vm_area_struct;
478extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
479
480/* Encode and de-code a swap entry */ 451/* Encode and de-code a swap entry */
481#define __swp_type(entry) (((entry).val >> 1) & 0x3f) 452#define __swp_type(entry) (((entry).val >> 1) & 0x3f)
482#define __swp_offset(entry) ((entry).val >> 8) 453#define __swp_offset(entry) ((entry).val >> 8)
@@ -522,6 +493,7 @@ void pgtable_cache_init(void);
522 return pt; 493 return pt;
523} 494}
524 495
496
525#include <asm-generic/pgtable.h> 497#include <asm-generic/pgtable.h>
526 498
527#endif /* __ASSEMBLY__ */ 499#endif /* __ASSEMBLY__ */
diff --git a/include/asm-powerpc/pmc.h b/include/asm-powerpc/pmc.h
index 8588be68e0ad..d6a616a1b3ea 100644
--- a/include/asm-powerpc/pmc.h
+++ b/include/asm-powerpc/pmc.h
@@ -30,6 +30,7 @@ void release_pmc_hardware(void);
30 30
31#ifdef CONFIG_PPC64 31#ifdef CONFIG_PPC64
32void power4_enable_pmcs(void); 32void power4_enable_pmcs(void);
33void pasemi_enable_pmcs(void);
33#endif 34#endif
34 35
35#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/pmi.h b/include/asm-powerpc/pmi.h
new file mode 100644
index 000000000000..cb0f8aa43088
--- /dev/null
+++ b/include/asm-powerpc/pmi.h
@@ -0,0 +1,67 @@
1#ifndef _POWERPC_PMI_H
2#define _POWERPC_PMI_H
3
4/*
5 * Definitions for talking with PMI device on PowerPC
6 *
7 * PMI (Platform Management Interrupt) is a way to communicate
8 * with the BMC (Baseboard Management Controller) via interrupts.
9 * Unlike IPMI it is bidirectional and has a low latency.
10 *
11 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
12 *
13 * Author: Christian Krafft <krafft@de.ibm.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
18 * any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#ifdef __KERNEL__
31
32#include <asm/of_device.h>
33
34#define PMI_TYPE_FREQ_CHANGE 0x01
35#define PMI_READ_TYPE 0
36#define PMI_READ_DATA0 1
37#define PMI_READ_DATA1 2
38#define PMI_READ_DATA2 3
39#define PMI_WRITE_TYPE 4
40#define PMI_WRITE_DATA0 5
41#define PMI_WRITE_DATA1 6
42#define PMI_WRITE_DATA2 7
43
44#define PMI_ACK 0x80
45
46#define PMI_TIMEOUT 100
47
48typedef struct {
49 u8 type;
50 u8 data0;
51 u8 data1;
52 u8 data2;
53} pmi_message_t;
54
55struct pmi_handler {
56 struct list_head node;
57 u8 type;
58 void (*handle_pmi_message) (struct of_device *, pmi_message_t);
59};
60
61void pmi_register_handler(struct of_device *, struct pmi_handler *);
62void pmi_unregister_handler(struct of_device *, struct pmi_handler *);
63
64void pmi_send_message(struct of_device *, pmi_message_t);
65
66#endif /* __KERNEL__ */
67#endif /* _POWERPC_PMI_H */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index ab6eddb518c7..d74b2965bb82 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -10,6 +10,8 @@
10#define _ASM_POWERPC_PPC_PCI_H 10#define _ASM_POWERPC_PPC_PCI_H
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#ifdef CONFIG_PCI
14
13#include <linux/pci.h> 15#include <linux/pci.h>
14#include <asm/pci-bridge.h> 16#include <asm/pci-bridge.h>
15 17
@@ -22,7 +24,7 @@ extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
22extern struct list_head hose_list; 24extern struct list_head hose_list;
23extern int global_phb_number; 25extern int global_phb_number;
24 26
25extern unsigned long find_and_init_phbs(void); 27extern void find_and_init_phbs(void);
26 28
27extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */ 29extern struct pci_dev *ppc64_isabridge_dev; /* may be NULL if no ISA bus */
28 30
@@ -68,7 +70,7 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr);
68void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 70void eeh_slot_error_detail (struct pci_dn *pdn, int severity);
69 71
70/** 72/**
71 * rtas_pci_enableo - enable IO transfers for this slot 73 * rtas_pci_enable - enable IO transfers for this slot
72 * @pdn: pci device node 74 * @pdn: pci device node
73 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA 75 * @function: either EEH_THAW_MMIO or EEH_THAW_DMA
74 * 76 *
@@ -89,6 +91,7 @@ int rtas_pci_enable(struct pci_dn *pdn, int function);
89 * Returns a non-zero value if the reset failed. 91 * Returns a non-zero value if the reset failed.
90 */ 92 */
91int rtas_set_slot_reset (struct pci_dn *); 93int rtas_set_slot_reset (struct pci_dn *);
94int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs);
92 95
93/** 96/**
94 * eeh_restore_bars - Restore device configuration info. 97 * eeh_restore_bars - Restore device configuration info.
@@ -126,5 +129,10 @@ struct device_node * find_device_pe(struct device_node *dn);
126 129
127#endif 130#endif
128 131
132#else /* CONFIG_PCI */
133static inline void find_and_init_phbs(void) { }
134static inline void init_pci_config_tokens(void) { }
135#endif /* !CONFIG_PCI */
136
129#endif /* __KERNEL__ */ 137#endif /* __KERNEL__ */
130#endif /* _ASM_POWERPC_PPC_PCI_H */ 138#endif /* _ASM_POWERPC_PPC_PCI_H */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index a26c32ee5527..d947b1609491 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -133,7 +133,6 @@ struct thread_struct {
133 mm_segment_t fs; /* for get_fs() validation */ 133 mm_segment_t fs; /* for get_fs() validation */
134#ifdef CONFIG_PPC32 134#ifdef CONFIG_PPC32
135 void *pgdir; /* root of page-table tree */ 135 void *pgdir; /* root of page-table tree */
136 signed long last_syscall;
137#endif 136#endif
138#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE) 137#if defined(CONFIG_4xx) || defined (CONFIG_BOOKE)
139 unsigned long dbcr0; /* debug control register values */ 138 unsigned long dbcr0; /* debug control register values */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 0afee17f33b4..ec400f608e16 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -18,7 +18,9 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <asm/irq.h>
21#include <asm/atomic.h> 22#include <asm/atomic.h>
23#include <asm/io.h>
22 24
23/* Definitions used by the flattened device tree */ 25/* Definitions used by the flattened device tree */
24#define OF_DT_HEADER 0xd00dfeed /* marker */ 26#define OF_DT_HEADER 0xd00dfeed /* marker */
@@ -58,6 +60,8 @@ struct boot_param_header
58 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 60 u32 boot_cpuid_phys; /* Physical CPU id we're booting on */
59 /* version 3 fields below */ 61 /* version 3 fields below */
60 u32 dt_strings_size; /* size of the DT strings block */ 62 u32 dt_strings_size; /* size of the DT strings block */
63 /* version 17 fields below */
64 u32 dt_struct_size; /* size of the DT structure block */
61}; 65};
62 66
63 67
@@ -68,7 +72,7 @@ typedef u32 ihandle;
68struct property { 72struct property {
69 char *name; 73 char *name;
70 int length; 74 int length;
71 unsigned char *value; 75 void *value;
72 struct property *next; 76 struct property *next;
73}; 77};
74 78
@@ -108,14 +112,6 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
108} 112}
109 113
110 114
111/* OBSOLETE: Old style node lookup */
112extern struct device_node *find_devices(const char *name);
113extern struct device_node *find_type_devices(const char *type);
114extern struct device_node *find_path_device(const char *path);
115extern struct device_node *find_compatible_devices(const char *type,
116 const char *compat);
117extern struct device_node *find_all_nodes(void);
118
119/* New style node lookup */ 115/* New style node lookup */
120extern struct device_node *of_find_node_by_name(struct device_node *from, 116extern struct device_node *of_find_node_by_name(struct device_node *from,
121 const char *name); 117 const char *name);
@@ -159,15 +155,17 @@ extern void of_detach_node(const struct device_node *);
159extern void finish_device_tree(void); 155extern void finish_device_tree(void);
160extern void unflatten_device_tree(void); 156extern void unflatten_device_tree(void);
161extern void early_init_devtree(void *); 157extern void early_init_devtree(void *);
162extern int device_is_compatible(const struct device_node *device, 158extern int of_device_is_compatible(const struct device_node *device,
163 const char *); 159 const char *);
160#define device_is_compatible(d, c) of_device_is_compatible((d), (c))
164extern int machine_is_compatible(const char *compat); 161extern int machine_is_compatible(const char *compat);
165extern const void *get_property(const struct device_node *node, 162extern const void *of_get_property(const struct device_node *node,
166 const char *name, 163 const char *name,
167 int *lenp); 164 int *lenp);
165#define get_property(a, b, c) of_get_property((a), (b), (c))
168extern void print_properties(struct device_node *node); 166extern void print_properties(struct device_node *node);
169extern int prom_n_addr_cells(struct device_node* np); 167extern int of_n_addr_cells(struct device_node* np);
170extern int prom_n_size_cells(struct device_node* np); 168extern int of_n_size_cells(struct device_node* np);
171extern int prom_n_intr_cells(struct device_node* np); 169extern int prom_n_intr_cells(struct device_node* np);
172extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 170extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
173extern int prom_add_property(struct device_node* np, struct property* prop); 171extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -255,6 +253,8 @@ extern void kdump_move_device_tree(void);
255/* CPU OF node matching */ 253/* CPU OF node matching */
256struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); 254struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
257 255
256/* Get the MAC address */
257extern const void *of_get_mac_address(struct device_node *np);
258 258
259/* 259/*
260 * OF interrupt mapping 260 * OF interrupt mapping
@@ -348,6 +348,16 @@ static inline int of_irq_to_resource(struct device_node *dev, int index, struct
348 return irq; 348 return irq;
349} 349}
350 350
351static inline void __iomem *of_iomap(struct device_node *np, int index)
352{
353 struct resource res;
354
355 if (of_address_to_resource(np, index, &res))
356 return NULL;
357
358 return ioremap(res.start, 1 + res.end - res.start);
359}
360
351 361
352#endif /* __KERNEL__ */ 362#endif /* __KERNEL__ */
353#endif /* _POWERPC_PROM_H */ 363#endif /* _POWERPC_PROM_H */
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index 52a69ed0d90a..821581a8b643 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -21,11 +21,33 @@
21#if !defined(_ASM_POWERPC_PS3_H) 21#if !defined(_ASM_POWERPC_PS3_H)
22#define _ASM_POWERPC_PS3_H 22#define _ASM_POWERPC_PS3_H
23 23
24#include <linux/compiler.h> /* for __deprecated */
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/types.h> 25#include <linux/types.h>
27#include <linux/device.h> 26#include <linux/device.h>
28 27
28union ps3_firmware_version {
29 u64 raw;
30 struct {
31 u16 pad;
32 u16 major;
33 u16 minor;
34 u16 rev;
35 };
36};
37
38int ps3_get_firmware_version(union ps3_firmware_version *v);
39
40/* 'Other OS' area */
41
42enum ps3_param_av_multi_out {
43 PS3_PARAM_AV_MULTI_OUT_NTSC = 0,
44 PS3_PARAM_AV_MULTI_OUT_PAL_RGB = 1,
45 PS3_PARAM_AV_MULTI_OUT_PAL_YCBCR = 2,
46 PS3_PARAM_AV_MULTI_OUT_SECAM = 3,
47};
48
49enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);
50
29/** 51/**
30 * struct ps3_device_id - HV bus device identifier from the system repository 52 * struct ps3_device_id - HV bus device identifier from the system repository
31 * @bus_id: HV bus id, {1..} (zero invalid) 53 * @bus_id: HV bus id, {1..} (zero invalid)
@@ -139,20 +161,32 @@ unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr);
139 161
140/* inrerrupt routines */ 162/* inrerrupt routines */
141 163
142int ps3_alloc_io_irq(unsigned int interrupt_id, unsigned int *virq); 164enum ps3_cpu_binding {
165 PS3_BINDING_CPU_ANY = -1,
166 PS3_BINDING_CPU_0 = 0,
167 PS3_BINDING_CPU_1 = 1,
168};
169
170int ps3_alloc_io_irq(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
171 unsigned int *virq);
143int ps3_free_io_irq(unsigned int virq); 172int ps3_free_io_irq(unsigned int virq);
144int ps3_alloc_event_irq(unsigned int *virq); 173int ps3_alloc_event_irq(enum ps3_cpu_binding cpu, unsigned int *virq);
145int ps3_free_event_irq(unsigned int virq); 174int ps3_free_event_irq(unsigned int virq);
146int ps3_send_event_locally(unsigned int virq); 175int ps3_send_event_locally(unsigned int virq);
147int ps3_connect_event_irq(const struct ps3_device_id *did, 176int ps3_connect_event_irq(enum ps3_cpu_binding cpu,
148 unsigned int interrupt_id, unsigned int *virq); 177 const struct ps3_device_id *did, unsigned int interrupt_id,
178 unsigned int *virq);
149int ps3_disconnect_event_irq(const struct ps3_device_id *did, 179int ps3_disconnect_event_irq(const struct ps3_device_id *did,
150 unsigned int interrupt_id, unsigned int virq); 180 unsigned int interrupt_id, unsigned int virq);
151int ps3_alloc_vuart_irq(void* virt_addr_bmp, unsigned int *virq); 181int ps3_alloc_vuart_irq(enum ps3_cpu_binding cpu, void* virt_addr_bmp,
152int ps3_free_vuart_irq(unsigned int virq);
153int ps3_alloc_spe_irq(unsigned long spe_id, unsigned int class,
154 unsigned int *virq); 182 unsigned int *virq);
183int ps3_free_vuart_irq(unsigned int virq);
184int ps3_alloc_spe_irq(enum ps3_cpu_binding cpu, unsigned long spe_id,
185 unsigned int class, unsigned int *virq);
155int ps3_free_spe_irq(unsigned int virq); 186int ps3_free_spe_irq(unsigned int virq);
187int ps3_alloc_irq(enum ps3_cpu_binding cpu, unsigned long outlet,
188 unsigned int *virq);
189int ps3_free_irq(unsigned int virq);
156 190
157/* lv1 result codes */ 191/* lv1 result codes */
158 192
@@ -247,146 +281,6 @@ static inline const char* ps3_result(int result)
247#endif 281#endif
248} 282}
249 283
250/* repository bus info */
251
252enum ps3_bus_type {
253 PS3_BUS_TYPE_SB = 4,
254 PS3_BUS_TYPE_STORAGE = 5,
255};
256
257enum ps3_dev_type {
258 PS3_DEV_TYPE_SB_GELIC = 3,
259 PS3_DEV_TYPE_SB_USB = 4,
260 PS3_DEV_TYPE_SB_GPIO = 6,
261};
262
263int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
264 u64 *value);
265int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id);
266int ps3_repository_read_bus_type(unsigned int bus_index,
267 enum ps3_bus_type *bus_type);
268int ps3_repository_read_bus_num_dev(unsigned int bus_index,
269 unsigned int *num_dev);
270
271/* repository bus device info */
272
273enum ps3_interrupt_type {
274 PS3_INTERRUPT_TYPE_EVENT_PORT = 2,
275 PS3_INTERRUPT_TYPE_SB_OHCI = 3,
276 PS3_INTERRUPT_TYPE_SB_EHCI = 4,
277 PS3_INTERRUPT_TYPE_OTHER = 5,
278};
279
280enum ps3_region_type {
281 PS3_REGION_TYPE_SB_OHCI = 3,
282 PS3_REGION_TYPE_SB_EHCI = 4,
283 PS3_REGION_TYPE_SB_GPIO = 5,
284};
285
286int ps3_repository_read_dev_str(unsigned int bus_index,
287 unsigned int dev_index, const char *dev_str, u64 *value);
288int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,
289 unsigned int *dev_id);
290int ps3_repository_read_dev_type(unsigned int bus_index,
291 unsigned int dev_index, enum ps3_dev_type *dev_type);
292int ps3_repository_read_dev_intr(unsigned int bus_index,
293 unsigned int dev_index, unsigned int intr_index,
294 enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
295int ps3_repository_read_dev_reg_type(unsigned int bus_index,
296 unsigned int dev_index, unsigned int reg_index,
297 enum ps3_region_type *reg_type);
298int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
299 unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
300 u64 *len);
301int ps3_repository_read_dev_reg(unsigned int bus_index,
302 unsigned int dev_index, unsigned int reg_index,
303 enum ps3_region_type *reg_type, u64 *bus_addr, u64 *len);
304
305/* repository bus enumerators */
306
307struct ps3_repository_device {
308 unsigned int bus_index;
309 unsigned int dev_index;
310 struct ps3_device_id did;
311};
312
313int ps3_repository_find_device(enum ps3_bus_type bus_type,
314 enum ps3_dev_type dev_type,
315 const struct ps3_repository_device *start_dev,
316 struct ps3_repository_device *dev);
317static inline int ps3_repository_find_first_device(
318 enum ps3_bus_type bus_type, enum ps3_dev_type dev_type,
319 struct ps3_repository_device *dev)
320{
321 return ps3_repository_find_device(bus_type, dev_type, NULL, dev);
322}
323int ps3_repository_find_interrupt(const struct ps3_repository_device *dev,
324 enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
325int ps3_repository_find_region(const struct ps3_repository_device *dev,
326 enum ps3_region_type reg_type, u64 *bus_addr, u64 *len);
327
328/* repository block device info */
329
330int ps3_repository_read_dev_port(unsigned int bus_index,
331 unsigned int dev_index, u64 *port);
332int ps3_repository_read_dev_blk_size(unsigned int bus_index,
333 unsigned int dev_index, u64 *blk_size);
334int ps3_repository_read_dev_num_blocks(unsigned int bus_index,
335 unsigned int dev_index, u64 *num_blocks);
336int ps3_repository_read_dev_num_regions(unsigned int bus_index,
337 unsigned int dev_index, unsigned int *num_regions);
338int ps3_repository_read_dev_region_id(unsigned int bus_index,
339 unsigned int dev_index, unsigned int region_index,
340 unsigned int *region_id);
341int ps3_repository_read_dev_region_size(unsigned int bus_index,
342 unsigned int dev_index, unsigned int region_index, u64 *region_size);
343int ps3_repository_read_dev_region_start(unsigned int bus_index,
344 unsigned int dev_index, unsigned int region_index, u64 *region_start);
345
346/* repository pu and memory info */
347
348int ps3_repository_read_num_pu(unsigned int *num_pu);
349int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id);
350int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);
351int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
352int ps3_repository_read_region_total(u64 *region_total);
353int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
354 u64 *region_total);
355
356/* repository pme info */
357
358int ps3_repository_read_num_be(unsigned int *num_be);
359int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);
360int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);
361int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);
362
363/* repository 'Other OS' area */
364
365int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);
366int ps3_repository_read_boot_dat_size(unsigned int *size);
367int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);
368
369/* repository spu info */
370
371/**
372 * enum spu_resource_type - Type of spu resource.
373 * @spu_resource_type_shared: Logical spu is shared with other partions.
374 * @spu_resource_type_exclusive: Logical spu is not shared with other partions.
375 *
376 * Returned by ps3_repository_read_spu_resource_id().
377 */
378
379enum ps3_spu_resource_type {
380 PS3_SPU_RESOURCE_TYPE_SHARED = 0,
381 PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,
382};
383
384int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);
385int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);
386int ps3_repository_read_spu_resource_id(unsigned int res_index,
387 enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
388
389
390/* system bus routines */ 284/* system bus routines */
391 285
392enum ps3_match_id { 286enum ps3_match_id {
@@ -459,4 +353,35 @@ static inline void *ps3_system_bus_get_driver_data(
459 353
460extern struct bus_type ps3_system_bus_type; 354extern struct bus_type ps3_system_bus_type;
461 355
356/* vuart routines */
357
358struct ps3_vuart_port_priv;
359
360/**
361 * struct ps3_vuart_port_device - a device on a vuart port
362 */
363
364struct ps3_vuart_port_device {
365 enum ps3_match_id match_id;
366 struct device core;
367 struct ps3_vuart_port_priv* priv; /* private driver variables */
368
369};
370
371int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
372
373/* system manager */
374
375void ps3_sys_manager_restart(void);
376void ps3_sys_manager_power_off(void);
377
378struct ps3_prealloc {
379 const char *name;
380 void *address;
381 unsigned long size;
382 unsigned long align;
383};
384
385extern struct ps3_prealloc ps3fb_videomemory;
386
462#endif 387#endif
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h
new file mode 100644
index 000000000000..43e90ea96136
--- /dev/null
+++ b/include/asm-powerpc/ps3av.h
@@ -0,0 +1,738 @@
1/*
2 * Copyright (C) 2006 Sony Computer Entertainment Inc.
3 * Copyright 2006, 2007 Sony Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18#ifndef _ASM_POWERPC_PS3AV_H_
19#define _ASM_POWERPC_PS3AV_H_
20
21#include <linux/mutex.h>
22
23/** command for ioctl() **/
24#define PS3AV_VERSION 0x205 /* version of ps3av command */
25
26#define PS3AV_CID_AV_INIT 0x00000001
27#define PS3AV_CID_AV_FIN 0x00000002
28#define PS3AV_CID_AV_GET_HW_CONF 0x00000003
29#define PS3AV_CID_AV_GET_MONITOR_INFO 0x00000004
30#define PS3AV_CID_AV_ENABLE_EVENT 0x00000006
31#define PS3AV_CID_AV_DISABLE_EVENT 0x00000007
32#define PS3AV_CID_AV_TV_MUTE 0x0000000a
33
34#define PS3AV_CID_AV_VIDEO_CS 0x00010001
35#define PS3AV_CID_AV_VIDEO_MUTE 0x00010002
36#define PS3AV_CID_AV_VIDEO_DISABLE_SIG 0x00010003
37#define PS3AV_CID_AV_AUDIO_PARAM 0x00020001
38#define PS3AV_CID_AV_AUDIO_MUTE 0x00020002
39#define PS3AV_CID_AV_HDMI_MODE 0x00040001
40
41#define PS3AV_CID_VIDEO_INIT 0x01000001
42#define PS3AV_CID_VIDEO_MODE 0x01000002
43#define PS3AV_CID_VIDEO_FORMAT 0x01000004
44#define PS3AV_CID_VIDEO_PITCH 0x01000005
45
46#define PS3AV_CID_AUDIO_INIT 0x02000001
47#define PS3AV_CID_AUDIO_MODE 0x02000002
48#define PS3AV_CID_AUDIO_MUTE 0x02000003
49#define PS3AV_CID_AUDIO_ACTIVE 0x02000004
50#define PS3AV_CID_AUDIO_INACTIVE 0x02000005
51#define PS3AV_CID_AUDIO_SPDIF_BIT 0x02000006
52#define PS3AV_CID_AUDIO_CTRL 0x02000007
53
54#define PS3AV_CID_EVENT_UNPLUGGED 0x10000001
55#define PS3AV_CID_EVENT_PLUGGED 0x10000002
56#define PS3AV_CID_EVENT_HDCP_DONE 0x10000003
57#define PS3AV_CID_EVENT_HDCP_FAIL 0x10000004
58#define PS3AV_CID_EVENT_HDCP_AUTH 0x10000005
59#define PS3AV_CID_EVENT_HDCP_ERROR 0x10000006
60
61#define PS3AV_CID_AVB_PARAM 0x04000001
62
63/* max backend ports */
64#define PS3AV_HDMI_MAX 2 /* HDMI_0 HDMI_1 */
65#define PS3AV_AVMULTI_MAX 1 /* AVMULTI_0 */
66#define PS3AV_AV_PORT_MAX (PS3AV_HDMI_MAX + PS3AV_AVMULTI_MAX)
67#define PS3AV_OPT_PORT_MAX 1 /* SPDIF0 */
68#define PS3AV_HEAD_MAX 2 /* HEAD_A HEAD_B */
69
70/* num of pkt for PS3AV_CID_AVB_PARAM */
71#define PS3AV_AVB_NUM_VIDEO PS3AV_HEAD_MAX
72#define PS3AV_AVB_NUM_AUDIO 0 /* not supported */
73#define PS3AV_AVB_NUM_AV_VIDEO PS3AV_AV_PORT_MAX
74#define PS3AV_AVB_NUM_AV_AUDIO PS3AV_HDMI_MAX
75
76#define PS3AV_MUTE_PORT_MAX 1 /* num of ports in mute pkt */
77
78/* event_bit */
79#define PS3AV_CMD_EVENT_BIT_UNPLUGGED (1 << 0)
80#define PS3AV_CMD_EVENT_BIT_PLUGGED (1 << 1)
81#define PS3AV_CMD_EVENT_BIT_HDCP_DONE (1 << 2)
82#define PS3AV_CMD_EVENT_BIT_HDCP_FAIL (1 << 3)
83#define PS3AV_CMD_EVENT_BIT_HDCP_REAUTH (1 << 4)
84#define PS3AV_CMD_EVENT_BIT_HDCP_TOPOLOGY (1 << 5)
85
86/* common params */
87/* mute */
88#define PS3AV_CMD_MUTE_OFF 0x0000
89#define PS3AV_CMD_MUTE_ON 0x0001
90/* avport */
91#define PS3AV_CMD_AVPORT_HDMI_0 0x0000
92#define PS3AV_CMD_AVPORT_HDMI_1 0x0001
93#define PS3AV_CMD_AVPORT_AVMULTI_0 0x0010
94#define PS3AV_CMD_AVPORT_SPDIF_0 0x0020
95#define PS3AV_CMD_AVPORT_SPDIF_1 0x0021
96
97/* for av backend */
98/* av_mclk */
99#define PS3AV_CMD_AV_MCLK_128 0x0000
100#define PS3AV_CMD_AV_MCLK_256 0x0001
101#define PS3AV_CMD_AV_MCLK_512 0x0003
102/* av_inputlen */
103#define PS3AV_CMD_AV_INPUTLEN_16 0x02
104#define PS3AV_CMD_AV_INPUTLEN_20 0x0a
105#define PS3AV_CMD_AV_INPUTLEN_24 0x0b
106/* alayout */
107#define PS3AV_CMD_AV_LAYOUT_32 (1 << 0)
108#define PS3AV_CMD_AV_LAYOUT_44 (1 << 1)
109#define PS3AV_CMD_AV_LAYOUT_48 (1 << 2)
110#define PS3AV_CMD_AV_LAYOUT_88 (1 << 3)
111#define PS3AV_CMD_AV_LAYOUT_96 (1 << 4)
112#define PS3AV_CMD_AV_LAYOUT_176 (1 << 5)
113#define PS3AV_CMD_AV_LAYOUT_192 (1 << 6)
114/* hdmi_mode */
115#define PS3AV_CMD_AV_HDMI_MODE_NORMAL 0xff
116#define PS3AV_CMD_AV_HDMI_HDCP_OFF 0x01
117#define PS3AV_CMD_AV_HDMI_EDID_PASS 0x80
118#define PS3AV_CMD_AV_HDMI_DVI 0x40
119
120/* for video module */
121/* video_head */
122#define PS3AV_CMD_VIDEO_HEAD_A 0x0000
123#define PS3AV_CMD_VIDEO_HEAD_B 0x0001
124/* video_cs_out video_cs_in */
125#define PS3AV_CMD_VIDEO_CS_NONE 0x0000
126#define PS3AV_CMD_VIDEO_CS_RGB_8 0x0001
127#define PS3AV_CMD_VIDEO_CS_YUV444_8 0x0002
128#define PS3AV_CMD_VIDEO_CS_YUV422_8 0x0003
129#define PS3AV_CMD_VIDEO_CS_XVYCC_8 0x0004
130#define PS3AV_CMD_VIDEO_CS_RGB_10 0x0005
131#define PS3AV_CMD_VIDEO_CS_YUV444_10 0x0006
132#define PS3AV_CMD_VIDEO_CS_YUV422_10 0x0007
133#define PS3AV_CMD_VIDEO_CS_XVYCC_10 0x0008
134#define PS3AV_CMD_VIDEO_CS_RGB_12 0x0009
135#define PS3AV_CMD_VIDEO_CS_YUV444_12 0x000a
136#define PS3AV_CMD_VIDEO_CS_YUV422_12 0x000b
137#define PS3AV_CMD_VIDEO_CS_XVYCC_12 0x000c
138/* video_vid */
139#define PS3AV_CMD_VIDEO_VID_NONE 0x0000
140#define PS3AV_CMD_VIDEO_VID_480I 0x0001
141#define PS3AV_CMD_VIDEO_VID_576I 0x0003
142#define PS3AV_CMD_VIDEO_VID_480P 0x0005
143#define PS3AV_CMD_VIDEO_VID_576P 0x0006
144#define PS3AV_CMD_VIDEO_VID_1080I_60HZ 0x0007
145#define PS3AV_CMD_VIDEO_VID_1080I_50HZ 0x0008
146#define PS3AV_CMD_VIDEO_VID_720P_60HZ 0x0009
147#define PS3AV_CMD_VIDEO_VID_720P_50HZ 0x000a
148#define PS3AV_CMD_VIDEO_VID_1080P_60HZ 0x000b
149#define PS3AV_CMD_VIDEO_VID_1080P_50HZ 0x000c
150#define PS3AV_CMD_VIDEO_VID_WXGA 0x000d
151#define PS3AV_CMD_VIDEO_VID_SXGA 0x000e
152#define PS3AV_CMD_VIDEO_VID_WUXGA 0x000f
153#define PS3AV_CMD_VIDEO_VID_480I_A 0x0010
154/* video_format */
155#define PS3AV_CMD_VIDEO_FORMAT_BLACK 0x0000
156#define PS3AV_CMD_VIDEO_FORMAT_ARGB_8BIT 0x0007
157/* video_order */
158#define PS3AV_CMD_VIDEO_ORDER_RGB 0x0000
159#define PS3AV_CMD_VIDEO_ORDER_BGR 0x0001
160/* video_fmt */
161#define PS3AV_CMD_VIDEO_FMT_X8R8G8B8 0x0000
162/* video_out_format */
163#define PS3AV_CMD_VIDEO_OUT_FORMAT_RGB_12BIT 0x0000
164/* video_sync */
165#define PS3AV_CMD_VIDEO_SYNC_VSYNC 0x0001
166#define PS3AV_CMD_VIDEO_SYNC_CSYNC 0x0004
167#define PS3AV_CMD_VIDEO_SYNC_HSYNC 0x0010
168
169/* for audio module */
170/* num_of_ch */
171#define PS3AV_CMD_AUDIO_NUM_OF_CH_2 0x0000
172#define PS3AV_CMD_AUDIO_NUM_OF_CH_3 0x0001
173#define PS3AV_CMD_AUDIO_NUM_OF_CH_4 0x0002
174#define PS3AV_CMD_AUDIO_NUM_OF_CH_5 0x0003
175#define PS3AV_CMD_AUDIO_NUM_OF_CH_6 0x0004
176#define PS3AV_CMD_AUDIO_NUM_OF_CH_7 0x0005
177#define PS3AV_CMD_AUDIO_NUM_OF_CH_8 0x0006
178/* audio_fs */
179#define PS3AV_CMD_AUDIO_FS_32K 0x0001
180#define PS3AV_CMD_AUDIO_FS_44K 0x0002
181#define PS3AV_CMD_AUDIO_FS_48K 0x0003
182#define PS3AV_CMD_AUDIO_FS_88K 0x0004
183#define PS3AV_CMD_AUDIO_FS_96K 0x0005
184#define PS3AV_CMD_AUDIO_FS_176K 0x0006
185#define PS3AV_CMD_AUDIO_FS_192K 0x0007
186/* audio_word_bits */
187#define PS3AV_CMD_AUDIO_WORD_BITS_16 0x0001
188#define PS3AV_CMD_AUDIO_WORD_BITS_20 0x0002
189#define PS3AV_CMD_AUDIO_WORD_BITS_24 0x0003
190/* audio_format */
191#define PS3AV_CMD_AUDIO_FORMAT_PCM 0x0001
192#define PS3AV_CMD_AUDIO_FORMAT_BITSTREAM 0x00ff
193/* audio_source */
194#define PS3AV_CMD_AUDIO_SOURCE_SERIAL 0x0000
195#define PS3AV_CMD_AUDIO_SOURCE_SPDIF 0x0001
196/* audio_swap */
197#define PS3AV_CMD_AUDIO_SWAP_0 0x0000
198#define PS3AV_CMD_AUDIO_SWAP_1 0x0000
199/* audio_map */
200#define PS3AV_CMD_AUDIO_MAP_OUTPUT_0 0x0000
201#define PS3AV_CMD_AUDIO_MAP_OUTPUT_1 0x0001
202#define PS3AV_CMD_AUDIO_MAP_OUTPUT_2 0x0002
203#define PS3AV_CMD_AUDIO_MAP_OUTPUT_3 0x0003
204/* audio_layout */
205#define PS3AV_CMD_AUDIO_LAYOUT_2CH 0x0000
206#define PS3AV_CMD_AUDIO_LAYOUT_6CH 0x000b /* LREClr */
207#define PS3AV_CMD_AUDIO_LAYOUT_8CH 0x001f /* LREClrXY */
208/* audio_downmix */
209#define PS3AV_CMD_AUDIO_DOWNMIX_PERMITTED 0x0000
210#define PS3AV_CMD_AUDIO_DOWNMIX_PROHIBITED 0x0001
211
212/* audio_port */
213#define PS3AV_CMD_AUDIO_PORT_HDMI_0 ( 1 << 0 )
214#define PS3AV_CMD_AUDIO_PORT_HDMI_1 ( 1 << 1 )
215#define PS3AV_CMD_AUDIO_PORT_AVMULTI_0 ( 1 << 10 )
216#define PS3AV_CMD_AUDIO_PORT_SPDIF_0 ( 1 << 20 )
217#define PS3AV_CMD_AUDIO_PORT_SPDIF_1 ( 1 << 21 )
218
219/* audio_ctrl_id */
220#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_RESET 0x0000
221#define PS3AV_CMD_AUDIO_CTRL_ID_DAC_DE_EMPHASIS 0x0001
222#define PS3AV_CMD_AUDIO_CTRL_ID_AVCLK 0x0002
223/* audio_ctrl_data[0] reset */
224#define PS3AV_CMD_AUDIO_CTRL_RESET_NEGATE 0x0000
225#define PS3AV_CMD_AUDIO_CTRL_RESET_ASSERT 0x0001
226/* audio_ctrl_data[0] de-emphasis */
227#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_OFF 0x0000
228#define PS3AV_CMD_AUDIO_CTRL_DE_EMPHASIS_ON 0x0001
229/* audio_ctrl_data[0] avclk */
230#define PS3AV_CMD_AUDIO_CTRL_AVCLK_22 0x0000
231#define PS3AV_CMD_AUDIO_CTRL_AVCLK_18 0x0001
232
233/* av_vid */
234/* do not use these params directly, use vid_video2av */
235#define PS3AV_CMD_AV_VID_480I 0x0000
236#define PS3AV_CMD_AV_VID_480P 0x0001
237#define PS3AV_CMD_AV_VID_720P_60HZ 0x0002
238#define PS3AV_CMD_AV_VID_1080I_60HZ 0x0003
239#define PS3AV_CMD_AV_VID_1080P_60HZ 0x0004
240#define PS3AV_CMD_AV_VID_576I 0x0005
241#define PS3AV_CMD_AV_VID_576P 0x0006
242#define PS3AV_CMD_AV_VID_720P_50HZ 0x0007
243#define PS3AV_CMD_AV_VID_1080I_50HZ 0x0008
244#define PS3AV_CMD_AV_VID_1080P_50HZ 0x0009
245#define PS3AV_CMD_AV_VID_WXGA 0x000a
246#define PS3AV_CMD_AV_VID_SXGA 0x000b
247#define PS3AV_CMD_AV_VID_WUXGA 0x000c
248/* av_cs_out av_cs_in */
249/* use cs_video2av() */
250#define PS3AV_CMD_AV_CS_RGB_8 0x0000
251#define PS3AV_CMD_AV_CS_YUV444_8 0x0001
252#define PS3AV_CMD_AV_CS_YUV422_8 0x0002
253#define PS3AV_CMD_AV_CS_XVYCC_8 0x0003
254#define PS3AV_CMD_AV_CS_RGB_10 0x0004
255#define PS3AV_CMD_AV_CS_YUV444_10 0x0005
256#define PS3AV_CMD_AV_CS_YUV422_10 0x0006
257#define PS3AV_CMD_AV_CS_XVYCC_10 0x0007
258#define PS3AV_CMD_AV_CS_RGB_12 0x0008
259#define PS3AV_CMD_AV_CS_YUV444_12 0x0009
260#define PS3AV_CMD_AV_CS_YUV422_12 0x000a
261#define PS3AV_CMD_AV_CS_XVYCC_12 0x000b
262#define PS3AV_CMD_AV_CS_8 0x0000
263#define PS3AV_CMD_AV_CS_10 0x0001
264#define PS3AV_CMD_AV_CS_12 0x0002
265/* dither */
266#define PS3AV_CMD_AV_DITHER_OFF 0x0000
267#define PS3AV_CMD_AV_DITHER_ON 0x0001
268#define PS3AV_CMD_AV_DITHER_8BIT 0x0000
269#define PS3AV_CMD_AV_DITHER_10BIT 0x0002
270#define PS3AV_CMD_AV_DITHER_12BIT 0x0004
271/* super_white */
272#define PS3AV_CMD_AV_SUPER_WHITE_OFF 0x0000
273#define PS3AV_CMD_AV_SUPER_WHITE_ON 0x0001
274/* aspect */
275#define PS3AV_CMD_AV_ASPECT_16_9 0x0000
276#define PS3AV_CMD_AV_ASPECT_4_3 0x0001
277/* video_cs_cnv() */
278#define PS3AV_CMD_VIDEO_CS_RGB 0x0001
279#define PS3AV_CMD_VIDEO_CS_YUV422 0x0002
280#define PS3AV_CMD_VIDEO_CS_YUV444 0x0003
281
282/* for automode */
283#define PS3AV_RESBIT_720x480P 0x0003 /* 0x0001 | 0x0002 */
284#define PS3AV_RESBIT_720x576P 0x0003 /* 0x0001 | 0x0002 */
285#define PS3AV_RESBIT_1280x720P 0x0004
286#define PS3AV_RESBIT_1920x1080I 0x0008
287#define PS3AV_RESBIT_1920x1080P 0x4000
288#define PS3AV_RES_MASK_60 (PS3AV_RESBIT_720x480P \
289 | PS3AV_RESBIT_1280x720P \
290 | PS3AV_RESBIT_1920x1080I \
291 | PS3AV_RESBIT_1920x1080P)
292#define PS3AV_RES_MASK_50 (PS3AV_RESBIT_720x576P \
293 | PS3AV_RESBIT_1280x720P \
294 | PS3AV_RESBIT_1920x1080I \
295 | PS3AV_RESBIT_1920x1080P)
296
297#define PS3AV_MONITOR_TYPE_HDMI 1 /* HDMI */
298#define PS3AV_MONITOR_TYPE_DVI 2 /* DVI */
299#define PS3AV_DEFAULT_HDMI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480P
300#define PS3AV_DEFAULT_AVMULTI_VID_REG_60 PS3AV_CMD_VIDEO_VID_480I
301#define PS3AV_DEFAULT_HDMI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576P
302#define PS3AV_DEFAULT_AVMULTI_VID_REG_50 PS3AV_CMD_VIDEO_VID_576I
303#define PS3AV_DEFAULT_DVI_VID PS3AV_CMD_VIDEO_VID_480P
304
305#define PS3AV_REGION_60 0x01
306#define PS3AV_REGION_50 0x02
307#define PS3AV_REGION_RGB 0x10
308
309#define get_status(buf) (((__u32 *)buf)[2])
310#define PS3AV_HDR_SIZE 4 /* version + size */
311
312/* for video mode */
313#define PS3AV_MODE_MASK 0x000F
314#define PS3AV_MODE_HDCP_OFF 0x1000 /* Retail PS3 product doesn't support this */
315#define PS3AV_MODE_DITHER 0x0800
316#define PS3AV_MODE_FULL 0x0080
317#define PS3AV_MODE_DVI 0x0040
318#define PS3AV_MODE_RGB 0x0020
319
320
321/** command packet structure **/
322struct ps3av_send_hdr {
323 u16 version;
324 u16 size; /* size of command packet */
325 u32 cid; /* command id */
326};
327
328struct ps3av_reply_hdr {
329 u16 version;
330 u16 size;
331 u32 cid;
332 u32 status;
333};
334
335/* backend: initialization */
336struct ps3av_pkt_av_init {
337 struct ps3av_send_hdr send_hdr;
338 u32 event_bit;
339};
340
341/* backend: finalize */
342struct ps3av_pkt_av_fin {
343 struct ps3av_send_hdr send_hdr;
344 /* recv */
345 u32 reserved;
346};
347
348/* backend: get port */
349struct ps3av_pkt_av_get_hw_conf {
350 struct ps3av_send_hdr send_hdr;
351 /* recv */
352 u32 status;
353 u16 num_of_hdmi; /* out: number of hdmi */
354 u16 num_of_avmulti; /* out: number of avmulti */
355 u16 num_of_spdif; /* out: number of hdmi */
356 u16 reserved;
357};
358
359/* backend: get monitor info */
360struct ps3av_info_resolution {
361 u32 res_bits;
362 u32 native;
363};
364
365struct ps3av_info_cs {
366 u8 rgb;
367 u8 yuv444;
368 u8 yuv422;
369 u8 reserved;
370};
371
372struct ps3av_info_color {
373 u16 red_x;
374 u16 red_y;
375 u16 green_x;
376 u16 green_y;
377 u16 blue_x;
378 u16 blue_y;
379 u16 white_x;
380 u16 white_y;
381 u32 gamma;
382};
383
384struct ps3av_info_audio {
385 u8 type;
386 u8 max_num_of_ch;
387 u8 fs;
388 u8 sbit;
389};
390
391struct ps3av_info_monitor {
392 u8 avport;
393 u8 monitor_id[10];
394 u8 monitor_type;
395 u8 monitor_name[16];
396 struct ps3av_info_resolution res_60;
397 struct ps3av_info_resolution res_50;
398 struct ps3av_info_resolution res_other;
399 struct ps3av_info_resolution res_vesa;
400 struct ps3av_info_cs cs;
401 struct ps3av_info_color color;
402 u8 supported_ai;
403 u8 speaker_info;
404 u8 num_of_audio_block;
405 struct ps3av_info_audio audio[0]; /* 0 or more audio blocks */
406 u8 reserved[169];
407} __attribute__ ((packed));
408
409struct ps3av_pkt_av_get_monitor_info {
410 struct ps3av_send_hdr send_hdr;
411 u16 avport; /* in: avport */
412 u16 reserved;
413 /* recv */
414 struct ps3av_info_monitor info; /* out: monitor info */
415};
416
417/* backend: enable/disable event */
418struct ps3av_pkt_av_event {
419 struct ps3av_send_hdr send_hdr;
420 u32 event_bit; /* in */
421};
422
423/* backend: video cs param */
424struct ps3av_pkt_av_video_cs {
425 struct ps3av_send_hdr send_hdr;
426 u16 avport; /* in: avport */
427 u16 av_vid; /* in: video resolution */
428 u16 av_cs_out; /* in: output color space */
429 u16 av_cs_in; /* in: input color space */
430 u8 dither; /* in: dither bit length */
431 u8 bitlen_out; /* in: bit length */
432 u8 super_white; /* in: super white */
433 u8 aspect; /* in: aspect ratio */
434};
435
436/* backend: video mute */
437struct ps3av_av_mute {
438 u16 avport; /* in: avport */
439 u16 mute; /* in: mute on/off */
440};
441
442struct ps3av_pkt_av_video_mute {
443 struct ps3av_send_hdr send_hdr;
444 struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
445};
446
447/* backend: video disable signal */
448struct ps3av_pkt_av_video_disable_sig {
449 struct ps3av_send_hdr send_hdr;
450 u16 avport; /* in: avport */
451 u16 reserved;
452};
453
454/* backend: audio param */
455struct ps3av_audio_info_frame {
456 struct pb1_bit {
457 u8 ct:4;
458 u8 rsv:1;
459 u8 cc:3;
460 } pb1;
461 struct pb2_bit {
462 u8 rsv:3;
463 u8 sf:3;
464 u8 ss:2;
465 } pb2;
466 u8 pb3;
467 u8 pb4;
468 struct pb5_bit {
469 u8 dm:1;
470 u8 lsv:4;
471 u8 rsv:3;
472 } pb5;
473};
474
475struct ps3av_pkt_av_audio_param {
476 struct ps3av_send_hdr send_hdr;
477 u16 avport; /* in: avport */
478 u16 reserved;
479 u8 mclk; /* in: audio mclk */
480 u8 ns[3]; /* in: audio ns val */
481 u8 enable; /* in: audio enable */
482 u8 swaplr; /* in: audio swap */
483 u8 fifomap; /* in: audio fifomap */
484 u8 inputctrl; /* in: audio input ctrl */
485 u8 inputlen; /* in: sample bit size */
486 u8 layout; /* in: speaker layout param */
487 struct ps3av_audio_info_frame info; /* in: info */
488 u8 chstat[5]; /* in: ch stat */
489};
490
491/* backend: audio_mute */
492struct ps3av_pkt_av_audio_mute {
493 struct ps3av_send_hdr send_hdr;
494 struct ps3av_av_mute mute[PS3AV_MUTE_PORT_MAX];
495};
496
497/* backend: hdmi_mode */
498struct ps3av_pkt_av_hdmi_mode {
499 struct ps3av_send_hdr send_hdr;
500 u8 mode; /* in: hdmi_mode */
501 u8 reserved0;
502 u8 reserved1;
503 u8 reserved2;
504};
505
506/* backend: tv_mute */
507struct ps3av_pkt_av_tv_mute {
508 struct ps3av_send_hdr send_hdr;
509 u16 avport; /* in: avport HDMI only */
510 u16 mute; /* in: mute */
511};
512
513/* video: initialize */
514struct ps3av_pkt_video_init {
515 struct ps3av_send_hdr send_hdr;
516 /* recv */
517 u32 reserved;
518};
519
520/* video: mode setting */
521struct ps3av_pkt_video_mode {
522 struct ps3av_send_hdr send_hdr;
523 u32 video_head; /* in: head */
524 u32 reserved;
525 u32 video_vid; /* in: video resolution */
526 u16 reserved1;
527 u16 width; /* in: width in pixel */
528 u16 reserved2;
529 u16 height; /* in: height in pixel */
530 u32 pitch; /* in: line size in byte */
531 u32 video_out_format; /* in: out format */
532 u32 video_format; /* in: input frame buffer format */
533 u8 reserved3;
534 u8 reserved4;
535 u16 video_order; /* in: input RGB order */
536 u32 reserved5;
537};
538
539/* video: format */
540struct ps3av_pkt_video_format {
541 struct ps3av_send_hdr send_hdr;
542 u32 video_head; /* in: head */
543 u32 video_format; /* in: frame buffer format */
544 u16 reserved;
545 u16 video_order; /* in: input RGB order */
546};
547
548/* video: pitch */
549struct ps3av_pkt_video_pitch {
550 u16 version;
551 u16 size; /* size of command packet */
552 u32 cid; /* command id */
553 u32 video_head; /* in: head */
554 u32 pitch; /* in: line size in byte */
555};
556
557/* audio: initialize */
558struct ps3av_pkt_audio_init {
559 struct ps3av_send_hdr send_hdr;
560 /* recv */
561 u32 reserved;
562};
563
564/* audio: mode setting */
565struct ps3av_pkt_audio_mode {
566 struct ps3av_send_hdr send_hdr;
567 u8 avport; /* in: avport */
568 u8 reserved0[3];
569 u32 mask; /* in: mask */
570 u32 audio_num_of_ch; /* in: number of ch */
571 u32 audio_fs; /* in: sampling freq */
572 u32 audio_word_bits; /* in: sample bit size */
573 u32 audio_format; /* in: audio output format */
574 u32 audio_source; /* in: audio source */
575 u8 audio_enable[4]; /* in: audio enable */
576 u8 audio_swap[4]; /* in: audio swap */
577 u8 audio_map[4]; /* in: audio map */
578 u32 audio_layout; /* in: speaker layout */
579 u32 audio_downmix; /* in: audio downmix permission */
580 u32 audio_downmix_level;
581 u8 audio_cs_info[8]; /* in: IEC channel status */
582};
583
584/* audio: mute */
585struct ps3av_audio_mute {
586 u8 avport; /* in: opt_port optical */
587 u8 reserved[3];
588 u32 mute; /* in: mute */
589};
590
591struct ps3av_pkt_audio_mute {
592 struct ps3av_send_hdr send_hdr;
593 struct ps3av_audio_mute mute[PS3AV_OPT_PORT_MAX];
594};
595
596/* audio: active/inactive */
597struct ps3av_pkt_audio_active {
598 struct ps3av_send_hdr send_hdr;
599 u32 audio_port; /* in: audio active/inactive port */
600};
601
602/* audio: SPDIF user bit */
603struct ps3av_pkt_audio_spdif_bit {
604 u16 version;
605 u16 size; /* size of command packet */
606 u32 cid; /* command id */
607 u8 avport; /* in: avport SPDIF only */
608 u8 reserved[3];
609 u32 audio_port; /* in: SPDIF only */
610 u32 spdif_bit_data[12]; /* in: user bit data */
611};
612
613/* audio: audio control */
614struct ps3av_pkt_audio_ctrl {
615 u16 version;
616 u16 size; /* size of command packet */
617 u32 cid; /* command id */
618 u32 audio_ctrl_id; /* in: control id */
619 u32 audio_ctrl_data[4]; /* in: control data */
620};
621
622/* avb:param */
623#define PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE \
624 (PS3AV_AVB_NUM_VIDEO*sizeof(struct ps3av_pkt_video_mode) + \
625 PS3AV_AVB_NUM_AUDIO*sizeof(struct ps3av_pkt_audio_mode) + \
626 PS3AV_AVB_NUM_AV_VIDEO*sizeof(struct ps3av_pkt_av_video_cs) + \
627 PS3AV_AVB_NUM_AV_AUDIO*sizeof(struct ps3av_pkt_av_audio_param))
628
629struct ps3av_pkt_avb_param {
630 struct ps3av_send_hdr send_hdr;
631 u16 num_of_video_pkt;
632 u16 num_of_audio_pkt;
633 u16 num_of_av_video_pkt;
634 u16 num_of_av_audio_pkt;
635 /*
636 * The actual buffer layout depends on the fields above:
637 *
638 * struct ps3av_pkt_video_mode video[num_of_video_pkt];
639 * struct ps3av_pkt_audio_mode audio[num_of_audio_pkt];
640 * struct ps3av_pkt_av_video_cs av_video[num_of_av_video_pkt];
641 * struct ps3av_pkt_av_audio_param av_audio[num_of_av_audio_pkt];
642 */
643 u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE];
644};
645
646struct ps3av {
647 int available;
648 struct semaphore sem;
649 struct semaphore ping;
650 struct semaphore pong;
651 struct mutex mutex;
652 int open_count;
653 struct ps3_vuart_port_device *dev;
654
655 int region;
656 struct ps3av_pkt_av_get_hw_conf av_hw_conf;
657 u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX];
658 u32 opt_port[PS3AV_OPT_PORT_MAX];
659 u32 head[PS3AV_HEAD_MAX];
660 u32 audio_port;
661 int ps3av_mode;
662 int ps3av_mode_old;
663};
664
665/** command status **/
666#define PS3AV_STATUS_SUCCESS 0x0000 /* success */
667#define PS3AV_STATUS_RECEIVE_VUART_ERROR 0x0001 /* receive vuart error */
668#define PS3AV_STATUS_SYSCON_COMMUNICATE_FAIL 0x0002 /* syscon communication error */
669#define PS3AV_STATUS_INVALID_COMMAND 0x0003 /* obsolete invalid CID */
670#define PS3AV_STATUS_INVALID_PORT 0x0004 /* invalid port number */
671#define PS3AV_STATUS_INVALID_VID 0x0005 /* invalid video format */
672#define PS3AV_STATUS_INVALID_COLOR_SPACE 0x0006 /* invalid video colose space */
673#define PS3AV_STATUS_INVALID_FS 0x0007 /* invalid audio sampling freq */
674#define PS3AV_STATUS_INVALID_AUDIO_CH 0x0008 /* invalid audio channel number */
675#define PS3AV_STATUS_UNSUPPORTED_VERSION 0x0009 /* version mismatch */
676#define PS3AV_STATUS_INVALID_SAMPLE_SIZE 0x000a /* invalid audio sample bit size */
677#define PS3AV_STATUS_FAILURE 0x000b /* other failures */
678#define PS3AV_STATUS_UNSUPPORTED_COMMAND 0x000c /* unsupported cid */
679#define PS3AV_STATUS_BUFFER_OVERFLOW 0x000d /* write buffer overflow */
680#define PS3AV_STATUS_INVALID_VIDEO_PARAM 0x000e /* invalid video param */
681#define PS3AV_STATUS_NO_SEL 0x000f /* not exist selector */
682#define PS3AV_STATUS_INVALID_AV_PARAM 0x0010 /* invalid backend param */
683#define PS3AV_STATUS_INVALID_AUDIO_PARAM 0x0011 /* invalid audio param */
684#define PS3AV_STATUS_UNSUPPORTED_HDMI_MODE 0x0012 /* unsupported hdmi mode */
685#define PS3AV_STATUS_NO_SYNC_HEAD 0x0013 /* sync head failed */
686
687extern void ps3av_set_hdr(u32, u16, struct ps3av_send_hdr *);
688extern int ps3av_do_pkt(u32, u16, size_t, struct ps3av_send_hdr *);
689
690extern int ps3av_cmd_init(void);
691extern int ps3av_cmd_fin(void);
692extern int ps3av_cmd_av_video_mute(int, u32 *, u32);
693extern int ps3av_cmd_av_video_disable_sig(u32);
694extern int ps3av_cmd_av_tv_mute(u32, u32);
695extern int ps3av_cmd_enable_event(void);
696extern int ps3av_cmd_av_hdmi_mode(u8);
697extern u32 ps3av_cmd_set_av_video_cs(void *, u32, int, int, int, u32);
698extern u32 ps3av_cmd_set_video_mode(void *, u32, int, int, u32);
699extern int ps3av_cmd_video_format_black(u32, u32, u32);
700extern int ps3av_cmd_av_audio_mute(int, u32 *, u32);
701extern u32 ps3av_cmd_set_av_audio_param(void *, u32,
702 const struct ps3av_pkt_audio_mode *,
703 u32);
704extern void ps3av_cmd_set_audio_mode(struct ps3av_pkt_audio_mode *, u32, u32,
705 u32, u32, u32, u32);
706extern int ps3av_cmd_audio_mode(struct ps3av_pkt_audio_mode *);
707extern int ps3av_cmd_audio_mute(int, u32 *, u32);
708extern int ps3av_cmd_audio_active(int, u32);
709extern int ps3av_cmd_avb_param(struct ps3av_pkt_avb_param *, u32);
710extern int ps3av_cmd_av_get_hw_conf(struct ps3av_pkt_av_get_hw_conf *);
711#ifdef PS3AV_DEBUG
712extern void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *);
713extern void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *);
714#else
715static inline void ps3av_cmd_av_hw_conf_dump(const struct ps3av_pkt_av_get_hw_conf *hw_conf) {}
716static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *monitor_info) {}
717#endif
718extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *,
719 u32);
720
721extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev,
722 const void *buf, unsigned long size);
723extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf,
724 unsigned long size, int timeout);
725
726extern int ps3av_set_video_mode(u32, int);
727extern int ps3av_set_audio_mode(u32, u32, u32, u32, u32);
728extern int ps3av_set_mode(u32, int);
729extern int ps3av_get_mode(void);
730extern int ps3av_get_scanmode(int);
731extern int ps3av_get_refresh_rate(int);
732extern int ps3av_video_mode2res(u32, u32 *, u32 *);
733extern int ps3av_video_mute(int);
734extern int ps3av_audio_mute(int);
735extern int ps3av_dev_open(void);
736extern int ps3av_dev_close(void);
737
738#endif /* _ASM_POWERPC_PS3AV_H_ */
diff --git a/include/asm-powerpc/ps3fb.h b/include/asm-powerpc/ps3fb.h
new file mode 100644
index 000000000000..ad81cf431964
--- /dev/null
+++ b/include/asm-powerpc/ps3fb.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2006 Sony Computer Entertainment Inc.
3 * Copyright 2006, 2007 Sony Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _ASM_POWERPC_PS3FB_H_
20#define _ASM_POWERPC_PS3FB_H_
21
22#include <linux/ioctl.h>
23
24/* ioctl */
25#define PS3FB_IOCTL_SETMODE _IOW('r', 1, int) /* set video mode */
26#define PS3FB_IOCTL_GETMODE _IOR('r', 2, int) /* get video mode */
27#define PS3FB_IOCTL_SCREENINFO _IOR('r', 3, int) /* get screen info */
28#define PS3FB_IOCTL_ON _IO('r', 4) /* use IOCTL_FSEL */
29#define PS3FB_IOCTL_OFF _IO('r', 5) /* return to normal-flip */
30#define PS3FB_IOCTL_FSEL _IOW('r', 6, int) /* blit and flip request */
31
32#ifndef FBIO_WAITFORVSYNC
33#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) /* wait for vsync */
34#endif
35
36struct ps3fb_ioctl_res {
37 __u32 xres; /* frame buffer x_size */
38 __u32 yres; /* frame buffer y_size */
39 __u32 xoff; /* margine x */
40 __u32 yoff; /* margine y */
41 __u32 num_frames; /* num of frame buffers */
42};
43
44#ifdef __KERNEL__
45
46#ifdef CONFIG_FB_PS3
47extern void ps3fb_flip_ctl(int on);
48extern void ps3fb_cleanup(void);
49#else
50static inline void ps3fb_flip_ctl(int on) {}
51static inline void ps3fb_cleanup(void) {}
52#endif
53
54#endif /* __KERNEL__ */
55
56#endif /* _ASM_POWERPC_PS3FB_H_ */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index a3631b15754c..749c7f953b58 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -166,6 +166,7 @@
166#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */ 166#define SPRN_TBWU 0x11D /* Time Base Upper Register (super, R/W) */
167#define SPRN_SPURR 0x134 /* Scaled PURR */ 167#define SPRN_SPURR 0x134 /* Scaled PURR */
168#define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */ 168#define SPRN_HIOR 0x137 /* 970 Hypervisor interrupt offset */
169#define SPRN_LPCR 0x13E /* LPAR Control Register */
169#define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */ 170#define SPRN_DBAT0L 0x219 /* Data BAT 0 Lower Register */
170#define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */ 171#define SPRN_DBAT0U 0x218 /* Data BAT 0 Upper Register */
171#define SPRN_DBAT1L 0x21B /* Data BAT 1 Lower Register */ 172#define SPRN_DBAT1L 0x21B /* Data BAT 1 Lower Register */
@@ -391,6 +392,12 @@
391#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */ 392#define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */
392#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */ 393#define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */
393 394
395#define SPRN_TBCTL 0x35f /* PA6T Timebase control register */
396#define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */
397#define TBCTL_RESTART 0x0000000100000000ull /* Restart all tbs */
398#define TBCTL_UPDATE_UPPER 0x0000000200000000ull /* Set upper 32 bits */
399#define TBCTL_UPDATE_LOWER 0x0000000300000000ull /* Set lower 32 bits */
400
394#ifndef SPRN_SVR 401#ifndef SPRN_SVR
395#define SPRN_SVR 0x11E /* System Version Register */ 402#define SPRN_SVR 0x11E /* System Version Register */
396#endif 403#endif
@@ -462,6 +469,69 @@
462#define SPRN_SIAR 780 469#define SPRN_SIAR 780
463#define SPRN_SDAR 781 470#define SPRN_SDAR 781
464 471
472#define SPRN_PA6T_MMCR0 795
473#define PA6T_MMCR0_EN0 0x0000000000000001UL
474#define PA6T_MMCR0_EN1 0x0000000000000002UL
475#define PA6T_MMCR0_EN2 0x0000000000000004UL
476#define PA6T_MMCR0_EN3 0x0000000000000008UL
477#define PA6T_MMCR0_EN4 0x0000000000000010UL
478#define PA6T_MMCR0_EN5 0x0000000000000020UL
479#define PA6T_MMCR0_SUPEN 0x0000000000000040UL
480#define PA6T_MMCR0_PREN 0x0000000000000080UL
481#define PA6T_MMCR0_HYPEN 0x0000000000000100UL
482#define PA6T_MMCR0_FCM0 0x0000000000000200UL
483#define PA6T_MMCR0_FCM1 0x0000000000000400UL
484#define PA6T_MMCR0_INTGEN 0x0000000000000800UL
485#define PA6T_MMCR0_INTEN0 0x0000000000001000UL
486#define PA6T_MMCR0_INTEN1 0x0000000000002000UL
487#define PA6T_MMCR0_INTEN2 0x0000000000004000UL
488#define PA6T_MMCR0_INTEN3 0x0000000000008000UL
489#define PA6T_MMCR0_INTEN4 0x0000000000010000UL
490#define PA6T_MMCR0_INTEN5 0x0000000000020000UL
491#define PA6T_MMCR0_DISCNT 0x0000000000040000UL
492#define PA6T_MMCR0_UOP 0x0000000000080000UL
493#define PA6T_MMCR0_TRG 0x0000000000100000UL
494#define PA6T_MMCR0_TRGEN 0x0000000000200000UL
495#define PA6T_MMCR0_TRGREG 0x0000000001600000UL
496#define PA6T_MMCR0_SIARLOG 0x0000000002000000UL
497#define PA6T_MMCR0_SDARLOG 0x0000000004000000UL
498#define PA6T_MMCR0_PROEN 0x0000000008000000UL
499#define PA6T_MMCR0_PROLOG 0x0000000010000000UL
500#define PA6T_MMCR0_DAMEN2 0x0000000020000000UL
501#define PA6T_MMCR0_DAMEN3 0x0000000040000000UL
502#define PA6T_MMCR0_DAMEN4 0x0000000080000000UL
503#define PA6T_MMCR0_DAMEN5 0x0000000100000000UL
504#define PA6T_MMCR0_DAMSEL2 0x0000000200000000UL
505#define PA6T_MMCR0_DAMSEL3 0x0000000400000000UL
506#define PA6T_MMCR0_DAMSEL4 0x0000000800000000UL
507#define PA6T_MMCR0_DAMSEL5 0x0000001000000000UL
508#define PA6T_MMCR0_HANDDIS 0x0000002000000000UL
509#define PA6T_MMCR0_PCTEN 0x0000004000000000UL
510#define PA6T_MMCR0_SOCEN 0x0000008000000000UL
511#define PA6T_MMCR0_SOCMOD 0x0000010000000000UL
512
513#define SPRN_PA6T_MMCR1 798
514#define PA6T_MMCR1_ES2 0x00000000000000ffUL
515#define PA6T_MMCR1_ES3 0x000000000000ff00UL
516#define PA6T_MMCR1_ES4 0x0000000000ff0000UL
517#define PA6T_MMCR1_ES5 0x00000000ff000000UL
518
519#define SPRN_PA6T_SIAR 780
520#define SPRN_PA6T_UPMC0 771
521#define SPRN_PA6T_UPMC1 772
522#define SPRN_PA6T_UPMC2 773
523#define SPRN_PA6T_UPMC3 774
524#define SPRN_PA6T_UPMC4 775
525#define SPRN_PA6T_UPMC5 776
526#define SPRN_PA6T_UMMCR0 779
527#define SPRN_PA6T_UMMCR1 782
528#define SPRN_PA6T_PMC0 787
529#define SPRN_PA6T_PMC1 788
530#define SPRN_PA6T_PMC2 789
531#define SPRN_PA6T_PMC3 790
532#define SPRN_PA6T_PMC4 791
533#define SPRN_PA6T_PMC5 792
534
465#else /* 32-bit */ 535#else /* 32-bit */
466#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */ 536#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
467#define MMCR0_FC 0x80000000UL /* freeze counters */ 537#define MMCR0_FC 0x80000000UL /* freeze counters */
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h
index 20ea7c70bc38..01717f266dc9 100644
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -75,6 +75,7 @@ extern cpumask_t cpu_sibling_map[NR_CPUS];
75void smp_init_iSeries(void); 75void smp_init_iSeries(void);
76void smp_init_pSeries(void); 76void smp_init_pSeries(void);
77void smp_init_cell(void); 77void smp_init_cell(void);
78void smp_init_celleb(void);
78void smp_setup_cpu_maps(void); 79void smp_setup_cpu_maps(void);
79 80
80extern int __cpu_disable(void); 81extern int __cpu_disable(void);
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index c8b1da50e72d..403e9fde2eb5 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -56,5 +56,7 @@
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58#define SO_PASSSEC 34 58#define SO_PASSSEC 34
59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
59 61
60#endif /* _ASM_POWERPC_SOCKET_H */ 62#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
index 590078d8ed28..55cef7675a31 100644
--- a/include/asm-powerpc/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -14,6 +14,7 @@
14#define FIOGETOWN 0x8903 14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904 15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
18 19
19#endif /* _ASM_POWERPC_SOCKIOS_H */ 20#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 3d90264e9d36..31d5054be20f 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -104,6 +104,7 @@
104 104
105struct spu_context; 105struct spu_context;
106struct spu_runqueue; 106struct spu_runqueue;
107struct device_node;
107 108
108struct spu { 109struct spu {
109 const char *name; 110 const char *name;
@@ -128,7 +129,6 @@ struct spu {
128 struct spu_runqueue *rq; 129 struct spu_runqueue *rq;
129 unsigned long long timestamp; 130 unsigned long long timestamp;
130 pid_t pid; 131 pid_t pid;
131 int prio;
132 int class_0_pending; 132 int class_0_pending;
133 spinlock_t register_lock; 133 spinlock_t register_lock;
134 134
@@ -142,7 +142,19 @@ struct spu {
142 char irq_c1[8]; 142 char irq_c1[8];
143 char irq_c2[8]; 143 char irq_c2[8];
144 144
145 u64 spe_id;
146
145 void* pdata; /* platform private data */ 147 void* pdata; /* platform private data */
148
149 /* of based platforms only */
150 struct device_node *devnode;
151
152 /* native only */
153 struct spu_priv1 __iomem *priv1;
154
155 /* beat only */
156 u64 shadow_int_mask_RW[3];
157
146 struct sys_device sysdev; 158 struct sys_device sysdev;
147}; 159};
148 160
@@ -153,6 +165,13 @@ int spu_irq_class_0_bottom(struct spu *spu);
153int spu_irq_class_1_bottom(struct spu *spu); 165int spu_irq_class_1_bottom(struct spu *spu);
154void spu_irq_setaffinity(struct spu *spu, int cpu); 166void spu_irq_setaffinity(struct spu *spu, int cpu);
155 167
168extern void spu_invalidate_slbs(struct spu *spu);
169extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
170
171/* Calls from the memory management to the SPU */
172struct mm_struct;
173extern void spu_flush_all_slbs(struct mm_struct *mm);
174
156/* system callbacks from the SPU */ 175/* system callbacks from the SPU */
157struct spu_syscall_block { 176struct spu_syscall_block {
158 u64 nr_ret; 177 u64 nr_ret;
diff --git a/include/asm-powerpc/spu_csa.h b/include/asm-powerpc/spu_csa.h
index bdbf906a767f..02e56a6685a2 100644
--- a/include/asm-powerpc/spu_csa.h
+++ b/include/asm-powerpc/spu_csa.h
@@ -221,8 +221,6 @@ struct spu_priv2_collapsed {
221 * @spu_chnlcnt_RW: Array of saved channel counts. 221 * @spu_chnlcnt_RW: Array of saved channel counts.
222 * @spu_chnldata_RW: Array of saved channel data. 222 * @spu_chnldata_RW: Array of saved channel data.
223 * @suspend_time: Time stamp when decrementer disabled. 223 * @suspend_time: Time stamp when decrementer disabled.
224 * @slb_esid_RW: Array of saved SLB esid entries.
225 * @slb_vsid_RW: Array of saved SLB vsid entries.
226 * 224 *
227 * Structure representing the whole of the SPU 225 * Structure representing the whole of the SPU
228 * context save area (CSA). This struct contains 226 * context save area (CSA). This struct contains
@@ -244,9 +242,8 @@ struct spu_state {
244 u64 spu_chnldata_RW[32]; 242 u64 spu_chnldata_RW[32];
245 u32 spu_mailbox_data[4]; 243 u32 spu_mailbox_data[4];
246 u32 pu_mailbox_data[1]; 244 u32 pu_mailbox_data[1];
245 u64 dar, dsisr;
247 unsigned long suspend_time; 246 unsigned long suspend_time;
248 u64 slb_esid_RW[8];
249 u64 slb_vsid_RW[8];
250 spinlock_t register_lock; 247 spinlock_t register_lock;
251}; 248};
252 249
diff --git a/include/asm-powerpc/spu_priv1.h b/include/asm-powerpc/spu_priv1.h
index 69dcb0c53884..7e78f6a1ab8b 100644
--- a/include/asm-powerpc/spu_priv1.h
+++ b/include/asm-powerpc/spu_priv1.h
@@ -206,6 +206,8 @@ spu_destroy_spu (struct spu *spu)
206 */ 206 */
207 207
208extern const struct spu_priv1_ops spu_priv1_mmio_ops; 208extern const struct spu_priv1_ops spu_priv1_mmio_ops;
209extern const struct spu_priv1_ops spu_priv1_beat_ops;
210
209extern const struct spu_management_ops spu_management_of_ops; 211extern const struct spu_management_ops spu_management_of_ops;
210 212
211#endif /* __KERNEL__ */ 213#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/sstep.h b/include/asm-powerpc/sstep.h
index 630a9889c07c..f593b0f9b627 100644
--- a/include/asm-powerpc/sstep.h
+++ b/include/asm-powerpc/sstep.h
@@ -21,6 +21,7 @@ struct pt_regs;
21 */ 21 */
22#define IS_MTMSRD(instr) (((instr) & 0xfc0007be) == 0x7c000124) 22#define IS_MTMSRD(instr) (((instr) & 0xfc0007be) == 0x7c000124)
23#define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024) 23#define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024)
24#define IS_RFI(instr) (((instr) & 0xfc0007fe) == 0x4c000064)
24 25
25/* Emulate instructions that cause a transfer of control. */ 26/* Emulate instructions that cause a transfer of control. */
26extern int emulate_step(struct pt_regs *regs, unsigned int instr); 27extern int emulate_step(struct pt_regs *regs, unsigned int instr);
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index faa407f33c6b..aa40f92c298d 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -14,8 +14,6 @@
14#define __HAVE_ARCH_MEMCMP 14#define __HAVE_ARCH_MEMCMP
15#define __HAVE_ARCH_MEMCHR 15#define __HAVE_ARCH_MEMCHR
16 16
17extern int strcasecmp(const char *, const char *);
18extern int strncasecmp(const char *, const char *, __kernel_size_t);
19extern char * strcpy(char *,const char *); 17extern char * strcpy(char *,const char *);
20extern char * strncpy(char *,const char *, __kernel_size_t); 18extern char * strncpy(char *,const char *, __kernel_size_t);
21extern __kernel_size_t strlen(const char *); 19extern __kernel_size_t strlen(const char *);
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 97b435484177..0b00068313f9 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -288,7 +288,7 @@ COMPAT_SYS(ppoll)
288SYSCALL_SPU(unshare) 288SYSCALL_SPU(unshare)
289SYSCALL_SPU(splice) 289SYSCALL_SPU(splice)
290SYSCALL_SPU(tee) 290SYSCALL_SPU(tee)
291SYSCALL_SPU(vmsplice) 291COMPAT_SYS_SPU(vmsplice)
292COMPAT_SYS_SPU(openat) 292COMPAT_SYS_SPU(openat)
293SYSCALL_SPU(mkdirat) 293SYSCALL_SPU(mkdirat)
294SYSCALL_SPU(mknodat) 294SYSCALL_SPU(mknodat)
@@ -304,4 +304,6 @@ SYSCALL_SPU(fchmodat)
304SYSCALL_SPU(faccessat) 304SYSCALL_SPU(faccessat)
305COMPAT_SYS_SPU(get_robust_list) 305COMPAT_SYS_SPU(get_robust_list)
306COMPAT_SYS_SPU(set_robust_list) 306COMPAT_SYS_SPU(set_robust_list)
307COMPAT_SYS(move_pages) 307COMPAT_SYS_SPU(move_pages)
308SYSCALL_SPU(getcpu)
309COMPAT_SYS(epoll_pwait)
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index f7b1227d6454..d3e0906ff2bc 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -131,6 +131,7 @@ extern void enable_kernel_altivec(void);
131extern void giveup_altivec(struct task_struct *); 131extern void giveup_altivec(struct task_struct *);
132extern void load_up_altivec(struct task_struct *); 132extern void load_up_altivec(struct task_struct *);
133extern int emulate_altivec(struct pt_regs *); 133extern int emulate_altivec(struct pt_regs *);
134extern void enable_kernel_spe(void);
134extern void giveup_spe(struct task_struct *); 135extern void giveup_spe(struct task_struct *);
135extern void load_up_spe(struct task_struct *); 136extern void load_up_spe(struct task_struct *);
136extern int fix_alignment(struct pt_regs *); 137extern int fix_alignment(struct pt_regs *);
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
index 7f80a019b6a0..2c14fea07c8a 100644
--- a/include/asm-powerpc/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -71,24 +71,6 @@ struct termio {
71#define _VEOL2 8 71#define _VEOL2 8
72#define _VSWTC 9 72#define _VSWTC 9
73 73
74/* line disciplines */
75#define N_TTY 0
76#define N_SLIP 1
77#define N_MOUSE 2
78#define N_PPP 3
79#define N_STRIP 4
80#define N_AX25 5
81#define N_X25 6 /* X.25 async */
82#define N_6PACK 7
83#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
84#define N_R3964 9 /* Reserved for Simatic R3964 module */
85#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
86#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
88#define N_HDLC 13 /* synchronous HDLC */
89#define N_SYNC_PPP 14
90#define N_HCI 15 /* Bluetooth HCI UART */
91
92#ifdef __KERNEL__ 74#ifdef __KERNEL__
93/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ 75/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
94#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 76#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 4cff977ad526..3fd57c048f59 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,6 +39,8 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42extern void set_dec_cpu6(unsigned int val);
43
42/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 44/* Some sane defaults: 125 MHz timebase, 1GHz processor */
43extern unsigned long ppc_proc_freq; 45extern unsigned long ppc_proc_freq;
44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 46#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 4e2a834683fb..0a17682663d8 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -38,7 +38,6 @@ extern void pte_free_finish(void);
38 38
39static inline void tlb_flush(struct mmu_gather *tlb) 39static inline void tlb_flush(struct mmu_gather *tlb)
40{ 40{
41 flush_tlb_pending();
42 pte_free_finish(); 41 pte_free_finish();
43} 42}
44 43
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index 93c7d0c7230f..86e6266a028b 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -17,10 +17,73 @@
17 */ 17 */
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20
21struct mm_struct; 20struct mm_struct;
21struct vm_area_struct;
22
23#if defined(CONFIG_4xx) || defined(CONFIG_8xx) || defined(CONFIG_FSL_BOOKE)
24/*
25 * TLB flushing for software loaded TLB chips
26 *
27 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
28 * flush_tlb_kernel_range are best implemented as tlbia vs
29 * specific tlbie's
30 */
31
32extern void _tlbie(unsigned long address);
33
34#if defined(CONFIG_40x) || defined(CONFIG_8xx)
35#define _tlbia() asm volatile ("tlbia; sync" : : : "memory")
36#else /* CONFIG_44x || CONFIG_FSL_BOOKE */
37extern void _tlbia(void);
38#endif
39
40static inline void flush_tlb_mm(struct mm_struct *mm)
41{
42 _tlbia();
43}
44
45static inline void flush_tlb_page(struct vm_area_struct *vma,
46 unsigned long vmaddr)
47{
48 _tlbie(vmaddr);
49}
50
51static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
52 unsigned long vmaddr)
53{
54 _tlbie(vmaddr);
55}
56
57static inline void flush_tlb_range(struct vm_area_struct *vma,
58 unsigned long start, unsigned long end)
59{
60 _tlbia();
61}
62
63static inline void flush_tlb_kernel_range(unsigned long start,
64 unsigned long end)
65{
66 _tlbia();
67}
22 68
23#ifdef CONFIG_PPC64 69#elif defined(CONFIG_PPC32)
70/*
71 * TLB flushing for "classic" hash-MMMU 32-bit CPUs, 6xx, 7xx, 7xxx
72 */
73extern void _tlbie(unsigned long address);
74extern void _tlbia(void);
75
76extern void flush_tlb_mm(struct mm_struct *mm);
77extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
78extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
79extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
80 unsigned long end);
81extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
82
83#else
84/*
85 * TLB flushing for 64-bit has-MMU CPUs
86 */
24 87
25#include <linux/percpu.h> 88#include <linux/percpu.h>
26#include <asm/page.h> 89#include <asm/page.h>
@@ -28,117 +91,90 @@ struct mm_struct;
28#define PPC64_TLB_BATCH_NR 192 91#define PPC64_TLB_BATCH_NR 192
29 92
30struct ppc64_tlb_batch { 93struct ppc64_tlb_batch {
31 unsigned long index; 94 int active;
32 struct mm_struct *mm; 95 unsigned long index;
33 real_pte_t pte[PPC64_TLB_BATCH_NR]; 96 struct mm_struct *mm;
34 unsigned long vaddr[PPC64_TLB_BATCH_NR]; 97 real_pte_t pte[PPC64_TLB_BATCH_NR];
35 unsigned int psize; 98 unsigned long vaddr[PPC64_TLB_BATCH_NR];
99 unsigned int psize;
36}; 100};
37DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 101DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
38 102
39extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 103extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
40 104
41static inline void flush_tlb_pending(void) 105extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
106 pte_t *ptep, unsigned long pte, int huge);
107
108#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
109
110static inline void arch_enter_lazy_mmu_mode(void)
111{
112 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
113
114 batch->active = 1;
115}
116
117static inline void arch_leave_lazy_mmu_mode(void)
42{ 118{
43 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); 119 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
44 120
45 if (batch->index) 121 if (batch->index)
46 __flush_tlb_pending(batch); 122 __flush_tlb_pending(batch);
47 put_cpu_var(ppc64_tlb_batch); 123 batch->active = 0;
48} 124}
49 125
126#define arch_flush_lazy_mmu_mode() do {} while (0)
127
128
50extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 129extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
51 int local); 130 int local);
52extern void flush_hash_range(unsigned long number, int local); 131extern void flush_hash_range(unsigned long number, int local);
53 132
54#else /* CONFIG_PPC64 */
55
56#include <linux/mm.h>
57
58extern void _tlbie(unsigned long address);
59extern void _tlbia(void);
60
61/*
62 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
63 * flush_tlb_kernel_range are best implemented as tlbia vs
64 * specific tlbie's
65 */
66
67#if (defined(CONFIG_4xx) && !defined(CONFIG_44x)) || defined(CONFIG_8xx)
68#define flush_tlb_pending() asm volatile ("tlbia; sync" : : : "memory")
69#elif defined(CONFIG_4xx) || defined(CONFIG_FSL_BOOKE)
70#define flush_tlb_pending() _tlbia()
71#endif
72
73/*
74 * This gets called at the end of handling a page fault, when
75 * the kernel has put a new PTE into the page table for the process.
76 * We use it to ensure coherency between the i-cache and d-cache
77 * for the page which has just been mapped in.
78 * On machines which use an MMU hash table, we use this to put a
79 * corresponding HPTE into the hash table ahead of time, instead of
80 * waiting for the inevitable extra hash-table miss exception.
81 */
82extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
83
84#endif /* CONFIG_PPC64 */
85
86#if defined(CONFIG_PPC64) || defined(CONFIG_4xx) || \
87 defined(CONFIG_FSL_BOOKE) || defined(CONFIG_8xx)
88 133
89static inline void flush_tlb_mm(struct mm_struct *mm) 134static inline void flush_tlb_mm(struct mm_struct *mm)
90{ 135{
91 flush_tlb_pending();
92} 136}
93 137
94static inline void flush_tlb_page(struct vm_area_struct *vma, 138static inline void flush_tlb_page(struct vm_area_struct *vma,
95 unsigned long vmaddr) 139 unsigned long vmaddr)
96{ 140{
97#ifdef CONFIG_PPC64
98 flush_tlb_pending();
99#else
100 _tlbie(vmaddr);
101#endif
102} 141}
103 142
104static inline void flush_tlb_page_nohash(struct vm_area_struct *vma, 143static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
105 unsigned long vmaddr) 144 unsigned long vmaddr)
106{ 145{
107#ifndef CONFIG_PPC64
108 _tlbie(vmaddr);
109#endif
110} 146}
111 147
112static inline void flush_tlb_range(struct vm_area_struct *vma, 148static inline void flush_tlb_range(struct vm_area_struct *vma,
113 unsigned long start, unsigned long end) 149 unsigned long start, unsigned long end)
114{ 150{
115 flush_tlb_pending();
116} 151}
117 152
118static inline void flush_tlb_kernel_range(unsigned long start, 153static inline void flush_tlb_kernel_range(unsigned long start,
119 unsigned long end) 154 unsigned long end)
120{ 155{
121 flush_tlb_pending();
122} 156}
123 157
124#else /* 6xx, 7xx, 7xxx cpus */
125
126extern void flush_tlb_mm(struct mm_struct *mm);
127extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
128extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
129extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
130 unsigned long end);
131extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
132
133#endif 158#endif
134 159
135/* 160/*
161 * This gets called at the end of handling a page fault, when
162 * the kernel has put a new PTE into the page table for the process.
163 * We use it to ensure coherency between the i-cache and d-cache
164 * for the page which has just been mapped in.
165 * On machines which use an MMU hash table, we use this to put a
166 * corresponding HPTE into the hash table ahead of time, instead of
167 * waiting for the inevitable extra hash-table miss exception.
168 */
169extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
170
171/*
136 * This is called in munmap when we have freed up some page-table 172 * This is called in munmap when we have freed up some page-table
137 * pages. We don't need to do anything here, there's nothing special 173 * pages. We don't need to do anything here, there's nothing special
138 * about our page-table pages. -- paulus 174 * about our page-table pages. -- paulus
139 */ 175 */
140static inline void flush_tlb_pgtables(struct mm_struct *mm, 176static inline void flush_tlb_pgtables(struct mm_struct *mm,
141 unsigned long start, unsigned long end) 177 unsigned long start, unsigned long end)
142{ 178{
143} 179}
144 180
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 6610495f5f16..0ad21a849b5f 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -57,7 +57,6 @@ static inline int pcibus_to_node(struct pci_bus *bus)
57 .busy_factor = 32, \ 57 .busy_factor = 32, \
58 .imbalance_pct = 125, \ 58 .imbalance_pct = 125, \
59 .cache_nice_tries = 1, \ 59 .cache_nice_tries = 1, \
60 .per_cpu_gain = 100, \
61 .busy_idx = 3, \ 60 .busy_idx = 3, \
62 .idle_idx = 1, \ 61 .idle_idx = 1, \
63 .newidle_idx = 2, \ 62 .newidle_idx = 2, \
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index adbf16b8cfbb..8e798e3758bc 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -110,12 +110,18 @@ struct exception_table_entry {
110 __get_user_nocheck((x), (ptr), sizeof(*(ptr))) 110 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
111#define __put_user(x, ptr) \ 111#define __put_user(x, ptr) \
112 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 112 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
113
113#ifndef __powerpc64__ 114#ifndef __powerpc64__
114#define __get_user64(x, ptr) \ 115#define __get_user64(x, ptr) \
115 __get_user64_nocheck((x), (ptr), sizeof(*(ptr))) 116 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
116#define __put_user64(x, ptr) __put_user(x, ptr) 117#define __put_user64(x, ptr) __put_user(x, ptr)
117#endif 118#endif
118 119
120#define __get_user_inatomic(x, ptr) \
121 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
122#define __put_user_inatomic(x, ptr) \
123 __put_user_nosleep((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
124
119#define __get_user_unaligned __get_user 125#define __get_user_unaligned __get_user
120#define __put_user_unaligned __put_user 126#define __put_user_unaligned __put_user
121 127
@@ -198,6 +204,16 @@ do { \
198 __pu_err; \ 204 __pu_err; \
199}) 205})
200 206
207#define __put_user_nosleep(x, ptr, size) \
208({ \
209 long __pu_err; \
210 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
211 __chk_user_ptr(ptr); \
212 __put_user_size((x), __pu_addr, (size), __pu_err); \
213 __pu_err; \
214})
215
216
201extern long __get_user_bad(void); 217extern long __get_user_bad(void);
202 218
203#define __get_user_asm(x, addr, err, op) \ 219#define __get_user_asm(x, addr, err, op) \
@@ -297,6 +313,18 @@ do { \
297 __gu_err; \ 313 __gu_err; \
298}) 314})
299 315
316#define __get_user_nosleep(x, ptr, size) \
317({ \
318 long __gu_err; \
319 unsigned long __gu_val; \
320 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
321 __chk_user_ptr(ptr); \
322 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
323 (x) = (__typeof__(*(ptr)))__gu_val; \
324 __gu_err; \
325})
326
327
300/* more complex routines */ 328/* more complex routines */
301 329
302extern unsigned long __copy_tofrom_user(void __user *to, 330extern unsigned long __copy_tofrom_user(void __user *to,
diff --git a/include/asm-powerpc/ucc_fast.h b/include/asm-powerpc/ucc_fast.h
index 39d1c90fd2ca..f529f70b1d82 100644
--- a/include/asm-powerpc/ucc_fast.h
+++ b/include/asm-powerpc/ucc_fast.h
@@ -159,6 +159,9 @@ struct ucc_fast_private {
159 struct ucc_fast *uf_regs; /* a pointer to memory map of UCC regs. */ 159 struct ucc_fast *uf_regs; /* a pointer to memory map of UCC regs. */
160 u32 *p_ucce; /* a pointer to the event register in memory. */ 160 u32 *p_ucce; /* a pointer to the event register in memory. */
161 u32 *p_uccm; /* a pointer to the mask register in memory. */ 161 u32 *p_uccm; /* a pointer to the mask register in memory. */
162#ifdef CONFIG_UGETH_TX_ON_DEMAND
163 u16 *p_utodr; /* pointer to the transmit on demand register */
164#endif
162 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */ 165 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
163 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */ 166 int enabled_rx; /* Whether channel is enabled for Rx (ENR) */
164 int stopped_tx; /* Whether channel has been stopped for Tx 167 int stopped_tx; /* Whether channel has been stopped for Tx
diff --git a/include/asm-powerpc/ucc_slow.h b/include/asm-powerpc/ucc_slow.h
index ca93bc99237e..fdaac9d762bb 100644
--- a/include/asm-powerpc/ucc_slow.h
+++ b/include/asm-powerpc/ucc_slow.h
@@ -150,7 +150,7 @@ struct ucc_slow_info {
150 int ucc_num; 150 int ucc_num;
151 enum qe_clock rx_clock; 151 enum qe_clock rx_clock;
152 enum qe_clock tx_clock; 152 enum qe_clock tx_clock;
153 struct ucc_slow *us_regs; 153 u32 regs;
154 int irq; 154 int irq;
155 u16 uccm_mask; 155 u16 uccm_mask;
156 int data_mem_part; 156 int data_mem_part;
@@ -199,9 +199,9 @@ struct ucc_slow_private {
199 and length for first BD in a frame */ 199 and length for first BD in a frame */
200 u32 tx_base_offset; /* first BD in Tx BD table offset (In MURAM) */ 200 u32 tx_base_offset; /* first BD in Tx BD table offset (In MURAM) */
201 u32 rx_base_offset; /* first BD in Rx BD table offset (In MURAM) */ 201 u32 rx_base_offset; /* first BD in Rx BD table offset (In MURAM) */
202 u8 *confBd; /* next BD for confirm after Tx */ 202 struct qe_bd *confBd; /* next BD for confirm after Tx */
203 u8 *tx_bd; /* next BD for new Tx request */ 203 struct qe_bd *tx_bd; /* next BD for new Tx request */
204 u8 *rx_bd; /* next BD to collect after Rx */ 204 struct qe_bd *rx_bd; /* next BD to collect after Rx */
205 void *p_rx_frame; /* accumulating receive frame */ 205 void *p_rx_frame; /* accumulating receive frame */
206 u16 *p_ucce; /* a pointer to the event register in memory. 206 u16 *p_ucce; /* a pointer to the event register in memory.
207 */ 207 */
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index 55e57844fa78..d03d8557f706 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -41,9 +41,12 @@ extern void __init udbg_early_init(void);
41extern void __init udbg_init_debug_lpar(void); 41extern 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_pas_realmode(void);
44extern void __init udbg_init_iseries(void); 45extern void __init udbg_init_iseries(void);
45extern void __init udbg_init_rtas_panel(void); 46extern void __init udbg_init_rtas_panel(void);
46extern void __init udbg_init_rtas_console(void); 47extern void __init udbg_init_rtas_console(void);
48extern void __init udbg_init_debug_beat(void);
49extern void __init udbg_init_btext(void);
47 50
48#endif /* __KERNEL__ */ 51#endif /* __KERNEL__ */
49#endif /* _ASM_POWERPC_UDBG_H */ 52#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/include/asm-powerpc/uic.h b/include/asm-powerpc/uic.h
new file mode 100644
index 000000000000..970eb7e2186a
--- /dev/null
+++ b/include/asm-powerpc/uic.h
@@ -0,0 +1,23 @@
1/*
2 * include/asm-powerpc/uic.h
3 *
4 * IBM PPC4xx UIC external definitions and structure.
5 *
6 * Maintainer: David Gibson <dwg@au1.ibm.com>
7 * Copyright 2007 IBM Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#ifndef _ASM_POWERPC_UIC_H
15#define _ASM_POWERPC_UIC_H
16
17#ifdef __KERNEL__
18
19extern void __init uic_init_tree(void);
20extern unsigned int uic_get_irq(void);
21
22#endif /* __KERNEL__ */
23#endif /* _ASM_POWERPC_UIC_H */
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 0ae954e3d258..2baedbe54e13 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -324,10 +324,12 @@
324#define __NR_get_robust_list 299 324#define __NR_get_robust_list 299
325#define __NR_set_robust_list 300 325#define __NR_set_robust_list 300
326#define __NR_move_pages 301 326#define __NR_move_pages 301
327#define __NR_getcpu 302
328#define __NR_epoll_pwait 303
327 329
328#ifdef __KERNEL__ 330#ifdef __KERNEL__
329 331
330#define __NR_syscalls 302 332#define __NR_syscalls 304
331 333
332#define __NR__exit __NR_exit 334#define __NR__exit __NR_exit
333#define NR_syscalls __NR_syscalls 335#define NR_syscalls __NR_syscalls
diff --git a/include/asm-powerpc/vdso.h b/include/asm-powerpc/vdso.h
index b9f9118b1607..26fc449bd989 100644
--- a/include/asm-powerpc/vdso.h
+++ b/include/asm-powerpc/vdso.h
@@ -18,16 +18,11 @@
18 18
19#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
20 20
21extern unsigned int vdso64_pages;
22extern unsigned int vdso32_pages;
23
24/* Offsets relative to thread->vdso_base */ 21/* Offsets relative to thread->vdso_base */
25extern unsigned long vdso64_rt_sigtramp; 22extern unsigned long vdso64_rt_sigtramp;
26extern unsigned long vdso32_sigtramp; 23extern unsigned long vdso32_sigtramp;
27extern unsigned long vdso32_rt_sigtramp; 24extern unsigned long vdso32_rt_sigtramp;
28 25
29extern void vdso_init(void);
30
31#else /* __ASSEMBLY__ */ 26#else /* __ASSEMBLY__ */
32 27
33#ifdef __VDSO64__ 28#ifdef __VDSO64__
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h
index 7b06b4e6bf30..4f99df1bafd7 100644
--- a/include/asm-ppc/commproc.h
+++ b/include/asm-ppc/commproc.h
@@ -77,6 +77,7 @@ extern int cpm_dpfree(uint offset);
77extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align); 77extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align);
78extern void cpm_dpdump(void); 78extern void cpm_dpdump(void);
79extern void *cpm_dpram_addr(uint offset); 79extern void *cpm_dpram_addr(uint offset);
80extern uint cpm_dpram_phys(u8* addr);
80extern void cpm_setbrg(uint brg, uint rate); 81extern void cpm_setbrg(uint brg, uint rate);
81 82
82extern uint m8xx_cpm_hostalloc(uint size); 83extern uint m8xx_cpm_hostalloc(uint size);
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index 499c14691c71..ed6891af05d3 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -15,6 +15,7 @@
15#define __ASM_IBM4XX_H__ 15#define __ASM_IBM4XX_H__
16 16
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/dcr.h>
18 19
19#ifdef CONFIG_40x 20#ifdef CONFIG_40x
20 21
@@ -46,12 +47,8 @@
46#include <platforms/4xx/walnut.h> 47#include <platforms/4xx/walnut.h>
47#endif 48#endif
48 49
49#if defined(CONFIG_XILINX_ML300) 50#if defined(CONFIG_XILINX_VIRTEX)
50#include <platforms/4xx/xilinx_ml300.h> 51#include <platforms/4xx/virtex.h>
51#endif
52
53#if defined(CONFIG_XILINX_ML403)
54#include <platforms/4xx/xilinx_ml403.h>
55#endif 52#endif
56 53
57#ifndef __ASSEMBLY__ 54#ifndef __ASSEMBLY__
@@ -108,6 +105,10 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
108#include <platforms/4xx/ocotea.h> 105#include <platforms/4xx/ocotea.h>
109#endif 106#endif
110 107
108#if defined(CONFIG_TAISHAN)
109#include <platforms/4xx/taishan.h>
110#endif
111
111#ifndef __ASSEMBLY__ 112#ifndef __ASSEMBLY__
112#ifdef CONFIG_40x 113#ifdef CONFIG_40x
113/* 114/*
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index ccf1a9bb2e43..95d590423cf2 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -358,8 +358,6 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
358} 358}
359#endif 359#endif
360 360
361#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void __force *)(void __iomem *)(b),(c),(d))
362
363/* 361/*
364 * Map in an area of physical address space, for accessing 362 * Map in an area of physical address space, for accessing
365 * I/O devices etc. 363 * I/O devices etc.
diff --git a/include/asm-ppc/m48t35.h b/include/asm-ppc/m48t35.h
deleted file mode 100644
index a5277ea4b194..000000000000
--- a/include/asm-ppc/m48t35.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
3 * and
4 * Registers for the SGS-Thomson M48T37 Timekeeper RAM chip
5 * The 37 is the 35 plus alarm and century thus the offsets
6 * are shifted by the extra registers.
7 */
8
9#ifndef __PPC_M48T35_H
10#define __PPC_M48T35_H
11
12/* RTC offsets */
13#define M48T35_RTC_FLAGS (-8) /* the negative regs are really T37 only */
14#define M48T35_RTC_CENTURY (-7)
15#define M48T35_RTC_AL_SEC (-6)
16#define M48T35_RTC_AL_MIN (-5)
17#define M48T35_RTC_AL_HRS (-4)
18#define M48T35_RTC_AL_DOM (-3)
19#define M48T35_RTC_INTERRUPT (-2)
20#define M48T35_RTC_WATCHDOG (-1)
21#define M48T35_RTC_CONTROL 0 /* T35 starts here */
22#define M48T35_RTC_SECONDS 1
23#define M48T35_RTC_MINUTES 2
24#define M48T35_RTC_HOURS 3
25#define M48T35_RTC_DAY 4
26#define M48T35_RTC_DOM 5
27#define M48T35_RTC_MONTH 6
28#define M48T35_RTC_YEAR 7
29
30/* this way help us know which bits go with which regs */
31#define M48T35_RTC_FLAGS_BL 0x10
32#define M48T35_RTC_FLAGS_AF 0x40
33#define M48T35_RTC_FLAGS_WDF 0x80
34
35#define M48T35_RTC_INTERRUPT_AFE 0x80
36#define M48T35_RTC_INTERRUPT_ABE 0x20
37#define M48T35_RTC_INTERRUPT_ALL (M48T35_RTC_INTERRUPT_AFE|M48T35_RTC_INTERRUPT_ABE)
38
39#define M48T35_RTC_WATCHDOG_RB 0x03
40#define M48T35_RTC_WATCHDOG_BMB 0x7c
41#define M48T35_RTC_WATCHDOG_WDS 0x80
42#define M48T35_RTC_WATCHDOG_ALL (M48T35_RTC_WATCHDOG_RB|M48T35_RTC_WATCHDOG_BMB|M48T35_RTC_W)
43
44#define M48T35_RTC_CONTROL_WRITE 0x80
45#define M48T35_RTC_CONTROL_READ 0x40
46#define M48T35_RTC_CONTROL_CAL_SIGN 0x20
47#define M48T35_RTC_CONTROL_CAL_VALUE 0x1f
48#define M48T35_RTC_CONTROL_LOCKED (M48T35_RTC_WRITE|M48T35_RTC_READ)
49#define M48T35_RTC_CONTROL_CALIBRATION (M48T35_RTC_CONTROL_CAL_SIGN|M48T35_RTC_CONTROL_CAL_VALUE)
50
51#define M48T35_RTC_SECONDS_SEC_1 0x0f
52#define M48T35_RTC_SECONDS_SEC_10 0x70
53#define M48T35_RTC_SECONDS_ST 0x80
54#define M48T35_RTC_SECONDS_SEC_ALL (M48T35_RTC_SECONDS_SEC_1|M48T35_RTC_SECONDS_SEC_10)
55
56#define M48T35_RTC_MINUTES_MIN_1 0x0f
57#define M48T35_RTC_MINUTES_MIN_10 0x70
58#define M48T35_RTC_MINUTES_MIN_ALL (M48T35_RTC_MINUTES_MIN_1|M48T35_RTC_MINUTES_MIN_10)
59
60#define M48T35_RTC_HOURS_HRS_1 0x0f
61#define M48T35_RTC_HOURS_HRS_10 0x30
62#define M48T35_RTC_HOURS_HRS_ALL (M48T35_RTC_HOURS_HRS_1|M48T35_RTC_HOURS_HRS_10)
63
64#define M48T35_RTC_DAY_DAY_1 0x03
65#define M48T35_RTC_DAY_FT 0x40
66
67#define M48T35_RTC_ALARM_OFF 0x00
68#define M48T35_RTC_WATCHDOG_OFF 0x00
69
70
71/* legacy */
72#define M48T35_RTC_SET 0x80
73#define M48T35_RTC_STOPPED 0x80
74#define M48T35_RTC_READ 0x40
75
76
77#endif
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
index 40f197af6508..de99e92d627b 100644
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -33,8 +33,6 @@
33#include <asm/mpc52xx.h> 33#include <asm/mpc52xx.h>
34#elif defined(CONFIG_MPC10X_BRIDGE) 34#elif defined(CONFIG_MPC10X_BRIDGE)
35#include <asm/mpc10x.h> 35#include <asm/mpc10x.h>
36#elif defined(CONFIG_XILINX_VIRTEX)
37#include <platforms/4xx/virtex.h>
38#else 36#else
39#error "need definition of ppc_sys_devices" 37#error "need definition of ppc_sys_devices"
40#endif 38#endif
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index adc5ae784924..901f7fa8b2d7 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -34,7 +34,8 @@ extern unsigned long sub_reloc_offset(unsigned long);
34 */ 34 */
35#define machine_is_compatible(x) 0 35#define machine_is_compatible(x) 0
36#define of_find_compatible_node(f, t, c) NULL 36#define of_find_compatible_node(f, t, c) NULL
37#define get_property(p, n, l) NULL 37#define of_get_property(p, n, l) NULL
38#define get_property(a, b, c) of_get_property((a), (b), (c))
38 39
39#endif /* _PPC_PROM_H */ 40#endif /* _PPC_PROM_H */
40#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/reg_booke.h b/include/asm-ppc/reg_booke.h
index a263fc1e65c4..82948ed2744a 100644
--- a/include/asm-ppc/reg_booke.h
+++ b/include/asm-ppc/reg_booke.h
@@ -9,8 +9,6 @@
9#ifndef __ASM_PPC_REG_BOOKE_H__ 9#ifndef __ASM_PPC_REG_BOOKE_H__
10#define __ASM_PPC_REG_BOOKE_H__ 10#define __ASM_PPC_REG_BOOKE_H__
11 11
12#include <asm/dcr.h>
13
14#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
15/* Performance Monitor Registers */ 13/* Performance Monitor Registers */
16#define mfpmr(rn) ({unsigned int rval; \ 14#define mfpmr(rn) ({unsigned int rval; \
diff --git a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h
index 8a59f8871f32..8fc1b546613d 100644
--- a/include/asm-ppc/serial.h
+++ b/include/asm-ppc/serial.h
@@ -11,8 +11,6 @@
11#include <platforms/ev64260.h> 11#include <platforms/ev64260.h>
12#elif defined(CONFIG_CHESTNUT) 12#elif defined(CONFIG_CHESTNUT)
13#include <platforms/chestnut.h> 13#include <platforms/chestnut.h>
14#elif defined(CONFIG_GEMINI)
15#include <platforms/gemini_serial.h>
16#elif defined(CONFIG_POWERPMC250) 14#elif defined(CONFIG_POWERPMC250)
17#include <platforms/powerpmc250.h> 15#include <platforms/powerpmc250.h>
18#elif defined(CONFIG_LOPEC) 16#elif defined(CONFIG_LOPEC)
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index af20c7462485..c17bdbf22067 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -215,6 +215,8 @@ static __inline__ void atomic64_set_mask(unsigned long mask, atomic64_t * v)
215 __CSG_LOOP(v, mask, "ogr"); 215 __CSG_LOOP(v, mask, "ogr");
216} 216}
217 217
218#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
219
218static __inline__ long long atomic64_cmpxchg(atomic64_t *v, 220static __inline__ long long atomic64_cmpxchg(atomic64_t *v,
219 long long old, long long new) 221 long long old, long long new)
220{ 222{
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index 876898363944..838684dc6d35 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -1,27 +1,70 @@
1#ifndef _S390_BUG_H 1#ifndef _ASM_S390_BUG_H
2#define _S390_BUG_H 2#define _ASM_S390_BUG_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
7 7
8static inline __attribute__((noreturn)) void __do_illegal_op(void) 8#ifdef CONFIG_64BIT
9{ 9#define S390_LONG ".quad"
10#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
11 __builtin_trap();
12#else 10#else
13 asm volatile(".long 0"); 11#define S390_LONG ".long"
14#endif 12#endif
15}
16 13
17#define BUG() do { \ 14#ifdef CONFIG_DEBUG_BUGVERBOSE
18 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 15
19 __do_illegal_op(); \ 16#define __EMIT_BUG(x) do { \
17 asm volatile( \
18 "0: j 0b+2\n" \
19 "1:\n" \
20 ".section .rodata.str,\"aMS\",@progbits,1\n" \
21 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \
25 " .short %0,%1\n" \
26 " .org 3b+%2\n" \
27 ".previous\n" \
28 : : "i" (__LINE__), \
29 "i" (x), \
30 "i" (sizeof(struct bug_entry))); \
20} while (0) 31} while (0)
21 32
33#else /* CONFIG_DEBUG_BUGVERBOSE */
34
35#define __EMIT_BUG(x) do { \
36 asm volatile( \
37 "0: j 0b+2\n" \
38 "1:\n" \
39 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \
41 " .short %0\n" \
42 " .org 2b+%1\n" \
43 ".previous\n" \
44 : : "i" (x), \
45 "i" (sizeof(struct bug_entry))); \
46} while (0)
47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49
50#define BUG() __EMIT_BUG(0)
51
52#define WARN_ON(x) ({ \
53 typeof(x) __ret_warn_on = (x); \
54 if (__builtin_constant_p(__ret_warn_on)) { \
55 if (__ret_warn_on) \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57 } else { \
58 if (unlikely(__ret_warn_on)) \
59 __EMIT_BUG(BUGFLAG_WARNING); \
60 } \
61 unlikely(__ret_warn_on); \
62})
63
22#define HAVE_ARCH_BUG 64#define HAVE_ARCH_BUG
23#endif 65#define HAVE_ARCH_WARN_ON
66#endif /* CONFIG_BUG */
24 67
25#include <asm-generic/bug.h> 68#include <asm-generic/bug.h>
26 69
27#endif 70#endif /* _ASM_S390_BUG_H */
diff --git a/include/asm-s390/bugs.h b/include/asm-s390/bugs.h
index 2c3659621314..011f1e6a2a6c 100644
--- a/include/asm-s390/bugs.h
+++ b/include/asm-s390/bugs.h
@@ -16,7 +16,7 @@
16 * void check_bugs(void); 16 * void check_bugs(void);
17 */ 17 */
18 18
19static void __init check_bugs(void) 19static inline void check_bugs(void)
20{ 20{
21 /* s390 has no bugs ... */ 21 /* s390 has no bugs ... */
22} 22}
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index 58c70acffc73..cfc81533b9ba 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -110,7 +110,9 @@ extern void ccw_driver_unregister (struct ccw_driver *driver);
110 110
111struct ccw1; 111struct ccw1;
112 112
113extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long);
113extern int ccw_device_set_options(struct ccw_device *, unsigned long); 114extern int ccw_device_set_options(struct ccw_device *, unsigned long);
115extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
114 116
115/* Allow for i/o completion notification after primary interrupt status. */ 117/* Allow for i/o completion notification after primary interrupt status. */
116#define CCWDEV_EARLY_NOTIFICATION 0x0001 118#define CCWDEV_EARLY_NOTIFICATION 0x0001
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index d2f9c0d53a97..925b3ddfa141 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -11,6 +11,7 @@ struct ccwgroup_device {
11 CCWGROUP_ONLINE, 11 CCWGROUP_ONLINE,
12 } state; 12 } state;
13 atomic_t onoff; 13 atomic_t onoff;
14 struct mutex reg_mutex;
14 unsigned int count; /* number of attached slave devices */ 15 unsigned int count; /* number of attached slave devices */
15 struct device dev; /* master device */ 16 struct device dev; /* master device */
16 struct ccw_device *cdev[0]; /* variable number, allocate as needed */ 17 struct ccw_device *cdev[0]; /* variable number, allocate as needed */
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 0a3cd7ec8451..d5a8e7c1477c 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -121,50 +121,21 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
121 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
122 __wsum sum) 122 __wsum sum)
123{ 123{
124#ifndef __s390x__ 124 __u32 csum = (__force __u32)sum;
125 asm volatile( 125
126 " alr %0,%1\n" /* sum += saddr */ 126 csum += (__force __u32)saddr;
127 " brc 12,0f\n" 127 if (csum < (__force __u32)saddr)
128 " ahi %0,1\n" /* add carry */ 128 csum++;
129 "0:" 129
130 : "+&d" (sum) : "d" (saddr) : "cc"); 130 csum += (__force __u32)daddr;
131 asm volatile( 131 if (csum < (__force __u32)daddr)
132 " alr %0,%1\n" /* sum += daddr */ 132 csum++;
133 " brc 12,1f\n" 133
134 " ahi %0,1\n" /* add carry */ 134 csum += len + proto;
135 "1:" 135 if (csum < len + proto)
136 : "+&d" (sum) : "d" (daddr) : "cc"); 136 csum++;
137 asm volatile( 137
138 " alr %0,%1\n" /* sum += len + proto */ 138 return (__force __wsum)csum;
139 " brc 12,2f\n"
140 " ahi %0,1\n" /* add carry */
141 "2:"
142 : "+&d" (sum)
143 : "d" (len + proto)
144 : "cc");
145#else /* __s390x__ */
146 asm volatile(
147 " lgfr %0,%0\n"
148 " algr %0,%1\n" /* sum += saddr */
149 " brc 12,0f\n"
150 " aghi %0,1\n" /* add carry */
151 "0: algr %0,%2\n" /* sum += daddr */
152 " brc 12,1f\n"
153 " aghi %0,1\n" /* add carry */
154 "1: algfr %0,%3\n" /* sum += len + proto */
155 " brc 12,2f\n"
156 " aghi %0,1\n" /* add carry */
157 "2: srlg 0,%0,32\n"
158 " alr %0,0\n" /* fold to 32 bits */
159 " brc 12,3f\n"
160 " ahi %0,1\n" /* add carry */
161 "3: llgfr %0,%0"
162 : "+&d" (sum)
163 : "d" (saddr), "d" (daddr),
164 "d" (len + proto)
165 : "cc", "0");
166#endif /* __s390x__ */
167 return sum;
168} 139}
169 140
170/* 141/*
diff --git a/include/asm-s390/chpid.h b/include/asm-s390/chpid.h
new file mode 100644
index 000000000000..b203336fd892
--- /dev/null
+++ b/include/asm-s390/chpid.h
@@ -0,0 +1,53 @@
1/*
2 * drivers/s390/cio/chpid.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_CHPID_H
9#define _ASM_S390_CHPID_H _ASM_S390_CHPID_H
10
11#include <linux/string.h>
12#include <asm/types.h>
13#include <asm/cio.h>
14
15#define __MAX_CHPID 255
16
17struct chp_id {
18 u8 reserved1;
19 u8 cssid;
20 u8 reserved2;
21 u8 id;
22} __attribute__((packed));
23
24static inline void chp_id_init(struct chp_id *chpid)
25{
26 memset(chpid, 0, sizeof(struct chp_id));
27}
28
29static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
30{
31 return (a->id == b->id) && (a->cssid == b->cssid);
32}
33
34static inline void chp_id_next(struct chp_id *chpid)
35{
36 if (chpid->id < __MAX_CHPID)
37 chpid->id++;
38 else {
39 chpid->id = 0;
40 chpid->cssid++;
41 }
42}
43
44static inline int chp_id_is_valid(struct chp_id *chpid)
45{
46 return (chpid->cssid <= __MAX_CSSID);
47}
48
49
50#define chp_id_for_each(c) \
51 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
52
53#endif /* _ASM_S390_CHPID_H */
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index d92785030980..f738d2827582 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -13,6 +13,7 @@
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#define LPM_ANYPATH 0xff 15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0
16 17
17/* 18/*
18 * subchannel status word 19 * subchannel status word
@@ -292,6 +293,13 @@ extern void css_schedule_reprobe(void);
292 293
293extern void reipl_ccw_dev(struct ccw_dev_id *id); 294extern void reipl_ccw_dev(struct ccw_dev_id *id);
294 295
296struct cio_iplinfo {
297 u16 devno;
298 int is_qdio;
299};
300
301extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
302
295#endif 303#endif
296 304
297#endif 305#endif
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index 356a0b183539..296f4f1a20e1 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -6,6 +6,34 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8 8
9#define PSW32_MASK_PER 0x40000000UL
10#define PSW32_MASK_DAT 0x04000000UL
11#define PSW32_MASK_IO 0x02000000UL
12#define PSW32_MASK_EXT 0x01000000UL
13#define PSW32_MASK_KEY 0x00F00000UL
14#define PSW32_MASK_MCHECK 0x00040000UL
15#define PSW32_MASK_WAIT 0x00020000UL
16#define PSW32_MASK_PSTATE 0x00010000UL
17#define PSW32_MASK_ASC 0x0000C000UL
18#define PSW32_MASK_CC 0x00003000UL
19#define PSW32_MASK_PM 0x00000f00UL
20
21#define PSW32_ADDR_AMODE31 0x80000000UL
22#define PSW32_ADDR_INSN 0x7FFFFFFFUL
23
24#define PSW32_BASE_BITS 0x00080000UL
25
26#define PSW32_ASC_PRIMARY 0x00000000UL
27#define PSW32_ASC_ACCREG 0x00004000UL
28#define PSW32_ASC_SECONDARY 0x00008000UL
29#define PSW32_ASC_HOME 0x0000C000UL
30
31#define PSW32_MASK_MERGE(CURRENT,NEW) \
32 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
33 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
34
35extern long psw32_user_bits;
36
9#define COMPAT_USER_HZ 100 37#define COMPAT_USER_HZ 100
10 38
11typedef u32 compat_size_t; 39typedef u32 compat_size_t;
diff --git a/include/asm-s390/etr.h b/include/asm-s390/etr.h
new file mode 100644
index 000000000000..b498f19bb9a7
--- /dev/null
+++ b/include/asm-s390/etr.h
@@ -0,0 +1,219 @@
1/*
2 * include/asm-s390/etr.h
3 *
4 * Copyright IBM Corp. 2006
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
6 */
7#ifndef __S390_ETR_H
8#define __S390_ETR_H
9
10/* ETR attachment control register */
11struct etr_eacr {
12 unsigned int e0 : 1; /* port 0 stepping control */
13 unsigned int e1 : 1; /* port 1 stepping control */
14 unsigned int _pad0 : 5; /* must be 00100 */
15 unsigned int dp : 1; /* data port control */
16 unsigned int p0 : 1; /* port 0 change recognition control */
17 unsigned int p1 : 1; /* port 1 change recognition control */
18 unsigned int _pad1 : 3; /* must be 000 */
19 unsigned int ea : 1; /* ETR alert control */
20 unsigned int es : 1; /* ETR sync check control */
21 unsigned int sl : 1; /* switch to local control */
22} __attribute__ ((packed));
23
24/* Port state returned by steai */
25enum etr_psc {
26 etr_psc_operational = 0,
27 etr_psc_semi_operational = 1,
28 etr_psc_protocol_error = 4,
29 etr_psc_no_symbols = 8,
30 etr_psc_no_signal = 12,
31 etr_psc_pps_mode = 13
32};
33
34/* Logical port state returned by stetr */
35enum etr_lpsc {
36 etr_lpsc_operational_step = 0,
37 etr_lpsc_operational_alt = 1,
38 etr_lpsc_semi_operational = 2,
39 etr_lpsc_protocol_error = 4,
40 etr_lpsc_no_symbol_sync = 8,
41 etr_lpsc_no_signal = 12,
42 etr_lpsc_pps_mode = 13
43};
44
45/* ETR status words */
46struct etr_esw {
47 struct etr_eacr eacr; /* attachment control register */
48 unsigned int y : 1; /* stepping mode */
49 unsigned int _pad0 : 5; /* must be 00000 */
50 unsigned int p : 1; /* stepping port number */
51 unsigned int q : 1; /* data port number */
52 unsigned int psc0 : 4; /* port 0 state code */
53 unsigned int psc1 : 4; /* port 1 state code */
54} __attribute__ ((packed));
55
56/* Second level data register status word */
57struct etr_slsw {
58 unsigned int vv1 : 1; /* copy of validity bit data frame 1 */
59 unsigned int vv2 : 1; /* copy of validity bit data frame 2 */
60 unsigned int vv3 : 1; /* copy of validity bit data frame 3 */
61 unsigned int vv4 : 1; /* copy of validity bit data frame 4 */
62 unsigned int _pad0 : 19; /* must by all zeroes */
63 unsigned int n : 1; /* EAF port number */
64 unsigned int v1 : 1; /* validity bit ETR data frame 1 */
65 unsigned int v2 : 1; /* validity bit ETR data frame 2 */
66 unsigned int v3 : 1; /* validity bit ETR data frame 3 */
67 unsigned int v4 : 1; /* validity bit ETR data frame 4 */
68 unsigned int _pad1 : 4; /* must be 0000 */
69} __attribute__ ((packed));
70
71/* ETR data frames */
72struct etr_edf1 {
73 unsigned int u : 1; /* untuned bit */
74 unsigned int _pad0 : 1; /* must be 0 */
75 unsigned int r : 1; /* service request bit */
76 unsigned int _pad1 : 4; /* must be 0000 */
77 unsigned int a : 1; /* time adjustment bit */
78 unsigned int net_id : 8; /* ETR network id */
79 unsigned int etr_id : 8; /* id of ETR which sends data frames */
80 unsigned int etr_pn : 8; /* port number of ETR output port */
81} __attribute__ ((packed));
82
83struct etr_edf2 {
84 unsigned int etv : 32; /* Upper 32 bits of TOD. */
85} __attribute__ ((packed));
86
87struct etr_edf3 {
88 unsigned int rc : 8; /* failure reason code */
89 unsigned int _pad0 : 3; /* must be 000 */
90 unsigned int c : 1; /* ETR coupled bit */
91 unsigned int tc : 4; /* ETR type code */
92 unsigned int blto : 8; /* biased local time offset */
93 /* (blto - 128) * 15 = minutes */
94 unsigned int buo : 8; /* biased utc offset */
95 /* (buo - 128) = leap seconds */
96} __attribute__ ((packed));
97
98struct etr_edf4 {
99 unsigned int ed : 8; /* ETS device dependent data */
100 unsigned int _pad0 : 1; /* must be 0 */
101 unsigned int buc : 5; /* biased ut1 correction */
102 /* (buc - 16) * 0.1 seconds */
103 unsigned int em : 6; /* ETS error magnitude */
104 unsigned int dc : 6; /* ETS drift code */
105 unsigned int sc : 6; /* ETS steering code */
106} __attribute__ ((packed));
107
108/*
109 * ETR attachment information block, two formats
110 * format 1 has 4 reserved words with a size of 64 bytes
111 * format 2 has 16 reserved words with a size of 96 bytes
112 */
113struct etr_aib {
114 struct etr_esw esw;
115 struct etr_slsw slsw;
116 unsigned long long tsp;
117 struct etr_edf1 edf1;
118 struct etr_edf2 edf2;
119 struct etr_edf3 edf3;
120 struct etr_edf4 edf4;
121 unsigned int reserved[16];
122} __attribute__ ((packed,aligned(8)));
123
124/* ETR interruption parameter */
125struct etr_interruption_parameter {
126 unsigned int _pad0 : 8;
127 unsigned int pc0 : 1; /* port 0 state change */
128 unsigned int pc1 : 1; /* port 1 state change */
129 unsigned int _pad1 : 3;
130 unsigned int eai : 1; /* ETR alert indication */
131 unsigned int _pad2 : 18;
132} __attribute__ ((packed));
133
134/* Query TOD offset result */
135struct etr_ptff_qto {
136 unsigned long long physical_clock;
137 unsigned long long tod_offset;
138 unsigned long long logical_tod_offset;
139 unsigned long long tod_epoch_difference;
140} __attribute__ ((packed));
141
142/* Inline assembly helper functions */
143static inline int etr_setr(struct etr_eacr *ctrl)
144{
145 int rc = -ENOSYS;
146
147 asm volatile(
148 " .insn s,0xb2160000,0(%2)\n"
149 "0: la %0,0\n"
150 "1:\n"
151 EX_TABLE(0b,1b)
152 : "+d" (rc) : "m" (*ctrl), "a" (ctrl));
153 return rc;
154}
155
156/* Stores a format 1 aib with 64 bytes */
157static inline int etr_stetr(struct etr_aib *aib)
158{
159 int rc = -ENOSYS;
160
161 asm volatile(
162 " .insn s,0xb2170000,0(%2)\n"
163 "0: la %0,0\n"
164 "1:\n"
165 EX_TABLE(0b,1b)
166 : "+d" (rc) : "m" (*aib), "a" (aib));
167 return rc;
168}
169
170/* Stores a format 2 aib with 96 bytes for specified port */
171static inline int etr_steai(struct etr_aib *aib, unsigned int func)
172{
173 register unsigned int reg0 asm("0") = func;
174 int rc = -ENOSYS;
175
176 asm volatile(
177 " .insn s,0xb2b30000,0(%2)\n"
178 "0: la %0,0\n"
179 "1:\n"
180 EX_TABLE(0b,1b)
181 : "+d" (rc) : "m" (*aib), "a" (aib), "d" (reg0));
182 return rc;
183}
184
185/* Function codes for the steai instruction. */
186#define ETR_STEAI_STEPPING_PORT 0x10
187#define ETR_STEAI_ALTERNATE_PORT 0x11
188#define ETR_STEAI_PORT_0 0x12
189#define ETR_STEAI_PORT_1 0x13
190
191static inline int etr_ptff(void *ptff_block, unsigned int func)
192{
193 register unsigned int reg0 asm("0") = func;
194 register unsigned long reg1 asm("1") = (unsigned long) ptff_block;
195 int rc = -ENOSYS;
196
197 asm volatile(
198 " .word 0x0104\n"
199 " ipm %0\n"
200 " srl %0,28\n"
201 : "=d" (rc), "=m" (ptff_block)
202 : "d" (reg0), "d" (reg1), "m" (ptff_block) : "cc");
203 return rc;
204}
205
206/* Function codes for the ptff instruction. */
207#define ETR_PTFF_QAF 0x00 /* query available functions */
208#define ETR_PTFF_QTO 0x01 /* query tod offset */
209#define ETR_PTFF_QSI 0x02 /* query steering information */
210#define ETR_PTFF_ATO 0x40 /* adjust tod offset */
211#define ETR_PTFF_STO 0x41 /* set tod offset */
212#define ETR_PTFF_SFS 0x42 /* set fine steering rate */
213#define ETR_PTFF_SGS 0x43 /* set gross steering rate */
214
215/* Functions needed by the machine check handler */
216extern void etr_switch_to_local(void);
217extern void etr_sync_check(void);
218
219#endif /* __S390_ETR_H */
diff --git a/include/asm-s390/hardirq.h b/include/asm-s390/hardirq.h
index c2f6a8782d31..31beb18cb3d1 100644
--- a/include/asm-s390/hardirq.h
+++ b/include/asm-s390/hardirq.h
@@ -32,6 +32,6 @@ typedef struct {
32 32
33#define HARDIRQ_BITS 8 33#define HARDIRQ_BITS 8
34 34
35extern void account_ticks(void); 35extern void account_ticks(u64 time);
36 36
37#endif /* __ASM_HARDIRQ_H */ 37#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-s390/io.h b/include/asm-s390/io.h
index efb7de9c1c6b..b7ff6afc3caa 100644
--- a/include/asm-s390/io.h
+++ b/include/asm-s390/io.h
@@ -13,13 +13,10 @@
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16#include <linux/vmalloc.h>
17#include <asm/page.h> 16#include <asm/page.h>
18 17
19#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffffffff
20 19
21#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
22
23/* 20/*
24 * Change virtual addresses to physical addresses and vv. 21 * Change virtual addresses to physical addresses and vv.
25 * These are pretty trivial 22 * These are pretty trivial
@@ -28,11 +25,7 @@ static inline unsigned long virt_to_phys(volatile void * address)
28{ 25{
29 unsigned long real_address; 26 unsigned long real_address;
30 asm volatile( 27 asm volatile(
31#ifndef __s390x__
32 " lra %0,0(%1)\n" 28 " lra %0,0(%1)\n"
33#else /* __s390x__ */
34 " lrag %0,0(%1)\n"
35#endif /* __s390x__ */
36 " jz 0f\n" 29 " jz 0f\n"
37 " la %0,0\n" 30 " la %0,0\n"
38 "0:" 31 "0:"
@@ -42,75 +35,9 @@ static inline unsigned long virt_to_phys(volatile void * address)
42 35
43static inline void * phys_to_virt(unsigned long address) 36static inline void * phys_to_virt(unsigned long address)
44{ 37{
45 return __io_virt(address); 38 return (void *) address;
46}
47
48extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
49
50static inline void * ioremap (unsigned long offset, unsigned long size)
51{
52 return __ioremap(offset, size, 0);
53}
54
55/*
56 * This one maps high address device memory and turns off caching for that area.
57 * it's useful if some control registers are in such an area and write combining
58 * or read caching is not desirable:
59 */
60static inline void * ioremap_nocache (unsigned long offset, unsigned long size)
61{
62 return __ioremap(offset, size, 0);
63} 39}
64 40
65extern void iounmap(void *addr);
66
67/*
68 * IO bus memory addresses are also 1:1 with the physical address
69 */
70#define virt_to_bus virt_to_phys
71#define bus_to_virt phys_to_virt
72
73/*
74 * readX/writeX() are used to access memory mapped devices. On some
75 * architectures the memory mapped IO stuff needs to be accessed
76 * differently.
77 */
78
79#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
80#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
81#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
82#define readq(addr) (*(volatile unsigned long long *) __io_virt(addr))
83
84#define readb_relaxed(addr) readb(addr)
85#define readw_relaxed(addr) readw(addr)
86#define readl_relaxed(addr) readl(addr)
87#define readq_relaxed(addr) readq(addr)
88#define __raw_readb readb
89#define __raw_readw readw
90#define __raw_readl readl
91#define __raw_readq readq
92
93#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
94#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
95#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
96#define writeq(b,addr) (*(volatile unsigned long long *) __io_virt(addr) = (b))
97#define __raw_writeb writeb
98#define __raw_writew writew
99#define __raw_writel writel
100#define __raw_writeq writeq
101
102#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
103#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
104#define memcpy_toio(a,b,c) memcpy(__io_virt(a),(b),(c))
105
106#define inb_p(addr) readb(addr)
107#define inb(addr) readb(addr)
108
109#define outb(x,addr) ((void) writeb(x,addr))
110#define outb_p(x,addr) outb(x,addr)
111
112#define mmiowb() do { } while (0)
113
114/* 41/*
115 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 42 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
116 * access 43 * access
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h
new file mode 100644
index 000000000000..bdcd448d43fb
--- /dev/null
+++ b/include/asm-s390/ipl.h
@@ -0,0 +1,150 @@
1/*
2 * s390 (re)ipl support
3 *
4 * Copyright IBM Corp. 2007
5 */
6
7#ifndef _ASM_S390_IPL_H
8#define _ASM_S390_IPL_H
9
10#include <asm/types.h>
11#include <asm/cio.h>
12#include <asm/setup.h>
13
14#define IPL_PARMBLOCK_ORIGIN 0x2000
15
16#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
17 sizeof(struct ipl_block_fcp))
18
19#define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8)
20
21#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
22 sizeof(struct ipl_block_ccw))
23
24#define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8)
25
26#define IPL_MAX_SUPPORTED_VERSION (0)
27
28#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
29 IPL_PARMBLOCK_ORIGIN)
30#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
31
32struct ipl_list_hdr {
33 u32 len;
34 u8 reserved1[3];
35 u8 version;
36 u32 blk0_len;
37 u8 pbt;
38 u8 flags;
39 u16 reserved2;
40} __attribute__((packed));
41
42struct ipl_block_fcp {
43 u8 reserved1[313-1];
44 u8 opt;
45 u8 reserved2[3];
46 u16 reserved3;
47 u16 devno;
48 u8 reserved4[4];
49 u64 wwpn;
50 u64 lun;
51 u32 bootprog;
52 u8 reserved5[12];
53 u64 br_lba;
54 u32 scp_data_len;
55 u8 reserved6[260];
56 u8 scp_data[];
57} __attribute__((packed));
58
59struct ipl_block_ccw {
60 u8 load_param[8];
61 u8 reserved1[84];
62 u8 reserved2[2];
63 u16 devno;
64 u8 vm_flags;
65 u8 reserved3[3];
66 u32 vm_parm_len;
67 u8 reserved4[80];
68} __attribute__((packed));
69
70struct ipl_parameter_block {
71 struct ipl_list_hdr hdr;
72 union {
73 struct ipl_block_fcp fcp;
74 struct ipl_block_ccw ccw;
75 } ipl_info;
76} __attribute__((packed));
77
78/*
79 * IPL validity flags
80 */
81extern u32 ipl_flags;
82
83extern u32 dump_prefix_page;
84
85extern void do_reipl(void);
86extern void ipl_save_parameters(void);
87
88enum {
89 IPL_DEVNO_VALID = 1,
90 IPL_PARMBLOCK_VALID = 2,
91 IPL_NSS_VALID = 4,
92};
93
94enum ipl_type {
95 IPL_TYPE_UNKNOWN = 1,
96 IPL_TYPE_CCW = 2,
97 IPL_TYPE_FCP = 4,
98 IPL_TYPE_FCP_DUMP = 8,
99 IPL_TYPE_NSS = 16,
100};
101
102struct ipl_info
103{
104 enum ipl_type type;
105 union {
106 struct {
107 struct ccw_dev_id dev_id;
108 } ccw;
109 struct {
110 struct ccw_dev_id dev_id;
111 u64 wwpn;
112 u64 lun;
113 } fcp;
114 struct {
115 char name[NSS_NAME_SIZE + 1];
116 } nss;
117 } data;
118};
119
120extern struct ipl_info ipl_info;
121extern void setup_ipl_info(void);
122
123/*
124 * DIAG 308 support
125 */
126enum diag308_subcode {
127 DIAG308_REL_HSA = 2,
128 DIAG308_IPL = 3,
129 DIAG308_DUMP = 4,
130 DIAG308_SET = 5,
131 DIAG308_STORE = 6,
132};
133
134enum diag308_ipl_type {
135 DIAG308_IPL_TYPE_FCP = 0,
136 DIAG308_IPL_TYPE_CCW = 2,
137};
138
139enum diag308_opt {
140 DIAG308_IPL_OPT_IPL = 0x10,
141 DIAG308_IPL_OPT_DUMP = 0x20,
142};
143
144enum diag308_rc {
145 DIAG308_RC_OK = 1,
146};
147
148extern int diag308(unsigned long subcode, void *addr);
149
150#endif /* _ASM_S390_IPL_H */
diff --git a/include/asm-s390/kdebug.h b/include/asm-s390/kdebug.h
index 40cc68025e01..1b50f89819a4 100644
--- a/include/asm-s390/kdebug.h
+++ b/include/asm-s390/kdebug.h
@@ -26,7 +26,6 @@ extern int register_page_fault_notifier(struct notifier_block *);
26extern int unregister_page_fault_notifier(struct notifier_block *); 26extern int unregister_page_fault_notifier(struct notifier_block *);
27extern struct atomic_notifier_head s390die_chain; 27extern struct atomic_notifier_head s390die_chain;
28 28
29
30enum die_val { 29enum die_val {
31 DIE_OOPS = 1, 30 DIE_OOPS = 1,
32 DIE_BPT, 31 DIE_BPT,
@@ -56,4 +55,6 @@ static inline int notify_die(enum die_val val, const char *str,
56 return atomic_notifier_call_chain(&s390die_chain, val, &args); 55 return atomic_notifier_call_chain(&s390die_chain, val, &args);
57} 56}
58 57
58extern void die(const char *, struct pt_regs *, long);
59
59#endif 60#endif
diff --git a/include/asm-s390/local.h b/include/asm-s390/local.h
index 86745a1b29bb..c11c530f74d0 100644
--- a/include/asm-s390/local.h
+++ b/include/asm-s390/local.h
@@ -1,58 +1 @@
1#ifndef _ASM_LOCAL_H #include <asm-generic/local.h>
2#define _ASM_LOCAL_H
3
4#include <linux/percpu.h>
5#include <asm/atomic.h>
6
7#ifndef __s390x__
8
9typedef atomic_t local_t;
10
11#define LOCAL_INIT(i) ATOMIC_INIT(i)
12#define local_read(v) atomic_read(v)
13#define local_set(v,i) atomic_set(v,i)
14
15#define local_inc(v) atomic_inc(v)
16#define local_dec(v) atomic_dec(v)
17#define local_add(i, v) atomic_add(i, v)
18#define local_sub(i, v) atomic_sub(i, v)
19
20#else
21
22typedef atomic64_t local_t;
23
24#define LOCAL_INIT(i) ATOMIC64_INIT(i)
25#define local_read(v) atomic64_read(v)
26#define local_set(v,i) atomic64_set(v,i)
27
28#define local_inc(v) atomic64_inc(v)
29#define local_dec(v) atomic64_dec(v)
30#define local_add(i, v) atomic64_add(i, v)
31#define local_sub(i, v) atomic64_sub(i, v)
32
33#endif
34
35#define __local_inc(v) ((v)->counter++)
36#define __local_dec(v) ((v)->counter--)
37#define __local_add(i,v) ((v)->counter+=(i))
38#define __local_sub(i,v) ((v)->counter-=(i))
39
40/*
41 * Use these for per-cpu local_t variables: on some archs they are
42 * much more efficient than these naive implementations. Note they take
43 * a variable, not an address.
44 */
45#define cpu_local_read(v) local_read(&__get_cpu_var(v))
46#define cpu_local_set(v, i) local_set(&__get_cpu_var(v), (i))
47
48#define cpu_local_inc(v) local_inc(&__get_cpu_var(v))
49#define cpu_local_dec(v) local_dec(&__get_cpu_var(v))
50#define cpu_local_add(i, v) local_add((i), &__get_cpu_var(v))
51#define cpu_local_sub(i, v) local_sub((i), &__get_cpu_var(v))
52
53#define __cpu_local_inc(v) __local_inc(&__get_cpu_var(v))
54#define __cpu_local_dec(v) __local_dec(&__get_cpu_var(v))
55#define __cpu_local_add(i, v) __local_add((i), &__get_cpu_var(v))
56#define __cpu_local_sub(i, v) __local_sub((i), &__get_cpu_var(v))
57
58#endif /* _ASM_LOCAL_H */
diff --git a/include/asm-s390/lowcore.h b/include/asm-s390/lowcore.h
index 74f7389bd3ee..ffc9788a21a7 100644
--- a/include/asm-s390/lowcore.h
+++ b/include/asm-s390/lowcore.h
@@ -147,6 +147,52 @@ void pgm_check_handler(void);
147void mcck_int_handler(void); 147void mcck_int_handler(void);
148void io_int_handler(void); 148void io_int_handler(void);
149 149
150struct save_area_s390 {
151 u32 ext_save;
152 u64 timer;
153 u64 clk_cmp;
154 u8 pad1[24];
155 u8 psw[8];
156 u32 pref_reg;
157 u8 pad2[20];
158 u32 acc_regs[16];
159 u64 fp_regs[4];
160 u32 gp_regs[16];
161 u32 ctrl_regs[16];
162} __attribute__((packed));
163
164struct save_area_s390x {
165 u64 fp_regs[16];
166 u64 gp_regs[16];
167 u8 psw[16];
168 u8 pad1[8];
169 u32 pref_reg;
170 u32 fp_ctrl_reg;
171 u8 pad2[4];
172 u32 tod_reg;
173 u64 timer;
174 u64 clk_cmp;
175 u8 pad3[8];
176 u32 acc_regs[16];
177 u64 ctrl_regs[16];
178} __attribute__((packed));
179
180union save_area {
181 struct save_area_s390 s390;
182 struct save_area_s390x s390x;
183};
184
185#define SAVE_AREA_BASE_S390 0xd4
186#define SAVE_AREA_BASE_S390X 0x1200
187
188#ifndef __s390x__
189#define SAVE_AREA_SIZE sizeof(struct save_area_s390)
190#define SAVE_AREA_BASE SAVE_AREA_BASE_S390
191#else
192#define SAVE_AREA_SIZE sizeof(struct save_area_s390x)
193#define SAVE_AREA_BASE SAVE_AREA_BASE_S390X
194#endif
195
150struct _lowcore 196struct _lowcore
151{ 197{
152#ifndef __s390x__ 198#ifndef __s390x__
@@ -220,7 +266,8 @@ struct _lowcore
220 __u32 kernel_asce; /* 0xc4c */ 266 __u32 kernel_asce; /* 0xc4c */
221 __u32 user_asce; /* 0xc50 */ 267 __u32 user_asce; /* 0xc50 */
222 __u32 panic_stack; /* 0xc54 */ 268 __u32 panic_stack; /* 0xc54 */
223 __u8 pad10[0xc60-0xc58]; /* 0xc58 */ 269 __u32 user_exec_asce; /* 0xc58 */
270 __u8 pad10[0xc60-0xc5c]; /* 0xc5c */
224 /* entry.S sensitive area start */ 271 /* entry.S sensitive area start */
225 struct cpuinfo_S390 cpu_data; /* 0xc60 */ 272 struct cpuinfo_S390 cpu_data; /* 0xc60 */
226 __u32 ipl_device; /* 0xc7c */ 273 __u32 ipl_device; /* 0xc7c */
@@ -310,7 +357,8 @@ struct _lowcore
310 __u64 kernel_asce; /* 0xd58 */ 357 __u64 kernel_asce; /* 0xd58 */
311 __u64 user_asce; /* 0xd60 */ 358 __u64 user_asce; /* 0xd60 */
312 __u64 panic_stack; /* 0xd68 */ 359 __u64 panic_stack; /* 0xd68 */
313 __u8 pad10[0xd80-0xd70]; /* 0xd70 */ 360 __u64 user_exec_asce; /* 0xd70 */
361 __u8 pad10[0xd80-0xd78]; /* 0xd78 */
314 /* entry.S sensitive area start */ 362 /* entry.S sensitive area start */
315 struct cpuinfo_S390 cpu_data; /* 0xd80 */ 363 struct cpuinfo_S390 cpu_data; /* 0xd80 */
316 __u32 ipl_device; /* 0xdb8 */ 364 __u32 ipl_device; /* 0xdb8 */
diff --git a/include/asm-s390/mmu_context.h b/include/asm-s390/mmu_context.h
index bcf24a873874..1d21da220d49 100644
--- a/include/asm-s390/mmu_context.h
+++ b/include/asm-s390/mmu_context.h
@@ -9,6 +9,7 @@
9#ifndef __S390_MMU_CONTEXT_H 9#ifndef __S390_MMU_CONTEXT_H
10#define __S390_MMU_CONTEXT_H 10#define __S390_MMU_CONTEXT_H
11 11
12#include <asm/pgalloc.h>
12/* 13/*
13 * get a new mmu context.. S390 don't know about contexts. 14 * get a new mmu context.. S390 don't know about contexts.
14 */ 15 */
@@ -16,29 +17,44 @@
16 17
17#define destroy_context(mm) do { } while (0) 18#define destroy_context(mm) do { } while (0)
18 19
20#ifndef __s390x__
21#define LCTL_OPCODE "lctl"
22#define PGTABLE_BITS (_SEGMENT_TABLE|USER_STD_MASK)
23#else
24#define LCTL_OPCODE "lctlg"
25#define PGTABLE_BITS (_REGION_TABLE|USER_STD_MASK)
26#endif
27
19static inline void enter_lazy_tlb(struct mm_struct *mm, 28static inline void enter_lazy_tlb(struct mm_struct *mm,
20 struct task_struct *tsk) 29 struct task_struct *tsk)
21{ 30{
22} 31}
23 32
24static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 33static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
25 struct task_struct *tsk) 34 struct task_struct *tsk)
26{ 35{
27 if (prev != next) { 36 pgd_t *shadow_pgd = get_shadow_pgd(next->pgd);
28#ifndef __s390x__ 37
29 S390_lowcore.user_asce = (__pa(next->pgd)&PAGE_MASK) | 38 if (prev != next) {
30 (_SEGMENT_TABLE|USER_STD_MASK); 39 S390_lowcore.user_asce = (__pa(next->pgd) & PAGE_MASK) |
31 /* Load home space page table origin. */ 40 PGTABLE_BITS;
32 asm volatile("lctl 13,13,%0" 41 if (shadow_pgd) {
33 : : "m" (S390_lowcore.user_asce) ); 42 /* Load primary/secondary space page table origin. */
34#else /* __s390x__ */ 43 S390_lowcore.user_exec_asce =
35 S390_lowcore.user_asce = (__pa(next->pgd) & PAGE_MASK) | 44 (__pa(shadow_pgd) & PAGE_MASK) | PGTABLE_BITS;
36 (_REGION_TABLE|USER_STD_MASK); 45 asm volatile(LCTL_OPCODE" 1,1,%0\n"
37 /* Load home space page table origin. */ 46 LCTL_OPCODE" 7,7,%1"
38 asm volatile("lctlg 13,13,%0" 47 : : "m" (S390_lowcore.user_exec_asce),
39 : : "m" (S390_lowcore.user_asce) ); 48 "m" (S390_lowcore.user_asce) );
40#endif /* __s390x__ */ 49 } else if (switch_amode) {
41 } 50 /* Load primary space page table origin. */
51 asm volatile(LCTL_OPCODE" 1,1,%0"
52 : : "m" (S390_lowcore.user_asce) );
53 } else
54 /* Load home space page table origin. */
55 asm volatile(LCTL_OPCODE" 13,13,%0"
56 : : "m" (S390_lowcore.user_asce) );
57 }
42 cpu_set(smp_processor_id(), next->cpu_vm_mask); 58 cpu_set(smp_processor_id(), next->cpu_vm_mask);
43} 59}
44 60
@@ -51,4 +67,4 @@ static inline void activate_mm(struct mm_struct *prev,
51 set_fs(current->thread.mm_segment); 67 set_fs(current->thread.mm_segment);
52} 68}
53 69
54#endif 70#endif /* __S390_MMU_CONTEXT_H */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 0707a7e2fc16..56c8a6c80e2e 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -47,6 +47,17 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
47 47
48 if (!pgd) 48 if (!pgd)
49 return NULL; 49 return NULL;
50 if (s390_noexec) {
51 pgd_t *shadow_pgd = (pgd_t *)
52 __get_free_pages(GFP_KERNEL, PGD_ALLOC_ORDER);
53 struct page *page = virt_to_page(pgd);
54
55 if (!shadow_pgd) {
56 free_pages((unsigned long) pgd, PGD_ALLOC_ORDER);
57 return NULL;
58 }
59 page->lru.next = (void *) shadow_pgd;
60 }
50 for (i = 0; i < PTRS_PER_PGD; i++) 61 for (i = 0; i < PTRS_PER_PGD; i++)
51#ifndef __s390x__ 62#ifndef __s390x__
52 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE)); 63 pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
@@ -58,6 +69,10 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
58 69
59static inline void pgd_free(pgd_t *pgd) 70static inline void pgd_free(pgd_t *pgd)
60{ 71{
72 pgd_t *shadow_pgd = get_shadow_pgd(pgd);
73
74 if (shadow_pgd)
75 free_pages((unsigned long) shadow_pgd, PGD_ALLOC_ORDER);
61 free_pages((unsigned long) pgd, PGD_ALLOC_ORDER); 76 free_pages((unsigned long) pgd, PGD_ALLOC_ORDER);
62} 77}
63 78
@@ -71,6 +86,7 @@ static inline void pgd_free(pgd_t *pgd)
71#define pmd_free(x) do { } while (0) 86#define pmd_free(x) do { } while (0)
72#define __pmd_free_tlb(tlb,x) do { } while (0) 87#define __pmd_free_tlb(tlb,x) do { } while (0)
73#define pgd_populate(mm, pmd, pte) BUG() 88#define pgd_populate(mm, pmd, pte) BUG()
89#define pgd_populate_kernel(mm, pmd, pte) BUG()
74#else /* __s390x__ */ 90#else /* __s390x__ */
75static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) 91static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
76{ 92{
@@ -79,6 +95,17 @@ static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
79 95
80 if (!pmd) 96 if (!pmd)
81 return NULL; 97 return NULL;
98 if (s390_noexec) {
99 pmd_t *shadow_pmd = (pmd_t *)
100 __get_free_pages(GFP_KERNEL, PMD_ALLOC_ORDER);
101 struct page *page = virt_to_page(pmd);
102
103 if (!shadow_pmd) {
104 free_pages((unsigned long) pmd, PMD_ALLOC_ORDER);
105 return NULL;
106 }
107 page->lru.next = (void *) shadow_pmd;
108 }
82 for (i=0; i < PTRS_PER_PMD; i++) 109 for (i=0; i < PTRS_PER_PMD; i++)
83 pmd_clear(pmd + i); 110 pmd_clear(pmd + i);
84 return pmd; 111 return pmd;
@@ -86,6 +113,10 @@ static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
86 113
87static inline void pmd_free (pmd_t *pmd) 114static inline void pmd_free (pmd_t *pmd)
88{ 115{
116 pmd_t *shadow_pmd = get_shadow_pmd(pmd);
117
118 if (shadow_pmd)
119 free_pages((unsigned long) shadow_pmd, PMD_ALLOC_ORDER);
89 free_pages((unsigned long) pmd, PMD_ALLOC_ORDER); 120 free_pages((unsigned long) pmd, PMD_ALLOC_ORDER);
90} 121}
91 122
@@ -95,11 +126,22 @@ static inline void pmd_free (pmd_t *pmd)
95 pmd_free(pmd); \ 126 pmd_free(pmd); \
96 } while (0) 127 } while (0)
97 128
98static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd) 129static inline void
130pgd_populate_kernel(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
99{ 131{
100 pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd); 132 pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd);
101} 133}
102 134
135static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
136{
137 pgd_t *shadow_pgd = get_shadow_pgd(pgd);
138 pmd_t *shadow_pmd = get_shadow_pmd(pmd);
139
140 if (shadow_pgd && shadow_pmd)
141 pgd_populate_kernel(mm, shadow_pgd, shadow_pmd);
142 pgd_populate_kernel(mm, pgd, pmd);
143}
144
103#endif /* __s390x__ */ 145#endif /* __s390x__ */
104 146
105static inline void 147static inline void
@@ -119,7 +161,13 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
119static inline void 161static inline void
120pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page) 162pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
121{ 163{
122 pmd_populate_kernel(mm, pmd, (pte_t *)page_to_phys(page)); 164 pte_t *pte = (pte_t *)page_to_phys(page);
165 pmd_t *shadow_pmd = get_shadow_pmd(pmd);
166 pte_t *shadow_pte = get_shadow_pte(pte);
167
168 pmd_populate_kernel(mm, pmd, pte);
169 if (shadow_pmd && shadow_pte)
170 pmd_populate_kernel(mm, shadow_pmd, shadow_pte);
123} 171}
124 172
125/* 173/*
@@ -133,6 +181,17 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
133 181
134 if (!pte) 182 if (!pte)
135 return NULL; 183 return NULL;
184 if (s390_noexec) {
185 pte_t *shadow_pte = (pte_t *)
186 __get_free_page(GFP_KERNEL|__GFP_REPEAT);
187 struct page *page = virt_to_page(pte);
188
189 if (!shadow_pte) {
190 free_page((unsigned long) pte);
191 return NULL;
192 }
193 page->lru.next = (void *) shadow_pte;
194 }
136 for (i=0; i < PTRS_PER_PTE; i++) { 195 for (i=0; i < PTRS_PER_PTE; i++) {
137 pte_clear(mm, vmaddr, pte + i); 196 pte_clear(mm, vmaddr, pte + i);
138 vmaddr += PAGE_SIZE; 197 vmaddr += PAGE_SIZE;
@@ -151,14 +210,30 @@ pte_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
151 210
152static inline void pte_free_kernel(pte_t *pte) 211static inline void pte_free_kernel(pte_t *pte)
153{ 212{
154 free_page((unsigned long) pte); 213 pte_t *shadow_pte = get_shadow_pte(pte);
214
215 if (shadow_pte)
216 free_page((unsigned long) shadow_pte);
217 free_page((unsigned long) pte);
155} 218}
156 219
157static inline void pte_free(struct page *pte) 220static inline void pte_free(struct page *pte)
158{ 221{
159 __free_page(pte); 222 struct page *shadow_page = get_shadow_page(pte);
223
224 if (shadow_page)
225 __free_page(shadow_page);
226 __free_page(pte);
160} 227}
161 228
162#define __pte_free_tlb(tlb,pte) tlb_remove_page(tlb,pte) 229#define __pte_free_tlb(tlb, pte) \
230({ \
231 struct mmu_gather *__tlb = (tlb); \
232 struct page *__pte = (pte); \
233 struct page *shadow_page = get_shadow_page(__pte); \
234 if (shadow_page) \
235 tlb_remove_page(__tlb, shadow_page); \
236 tlb_remove_page(__tlb, __pte); \
237})
163 238
164#endif /* _S390_PGALLOC_H */ 239#endif /* _S390_PGALLOC_H */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index ae61aca5d483..8fe8d42e64c3 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -40,6 +40,7 @@ struct mm_struct;
40 40
41extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); 41extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
42extern void paging_init(void); 42extern void paging_init(void);
43extern void vmem_map_init(void);
43 44
44/* 45/*
45 * The S390 doesn't have any external MMU info: the kernel page 46 * The S390 doesn't have any external MMU info: the kernel page
@@ -223,6 +224,8 @@ extern unsigned long vmalloc_end;
223#define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */ 224#define _PAGE_TYPE_FILE 0x601 /* bit 0x002 is used for offset !! */
224#define _PAGE_TYPE_RO 0x200 225#define _PAGE_TYPE_RO 0x200
225#define _PAGE_TYPE_RW 0x000 226#define _PAGE_TYPE_RW 0x000
227#define _PAGE_TYPE_EX_RO 0x202
228#define _PAGE_TYPE_EX_RW 0x002
226 229
227/* 230/*
228 * PTE type bits are rather complicated. handle_pte_fault uses pte_present, 231 * PTE type bits are rather complicated. handle_pte_fault uses pte_present,
@@ -243,11 +246,13 @@ extern unsigned long vmalloc_end;
243 * _PAGE_TYPE_FILE 11?1 -> 11?1 246 * _PAGE_TYPE_FILE 11?1 -> 11?1
244 * _PAGE_TYPE_RO 0100 -> 1100 247 * _PAGE_TYPE_RO 0100 -> 1100
245 * _PAGE_TYPE_RW 0000 -> 1000 248 * _PAGE_TYPE_RW 0000 -> 1000
249 * _PAGE_TYPE_EX_RO 0110 -> 1110
250 * _PAGE_TYPE_EX_RW 0010 -> 1010
246 * 251 *
247 * pte_none is true for bits combinations 1000, 1100 252 * pte_none is true for bits combinations 1000, 1010, 1100, 1110
248 * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001 253 * pte_present is true for bits combinations 0000, 0010, 0100, 0110, 1001
249 * pte_file is true for bits combinations 1101, 1111 254 * pte_file is true for bits combinations 1101, 1111
250 * swap pte is 1011 and 0001, 0011, 0101, 0111, 1010 and 1110 are invalid. 255 * swap pte is 1011 and 0001, 0011, 0101, 0111 are invalid.
251 */ 256 */
252 257
253#ifndef __s390x__ 258#ifndef __s390x__
@@ -312,33 +317,100 @@ extern unsigned long vmalloc_end;
312#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE) 317#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
313#define PAGE_RO __pgprot(_PAGE_TYPE_RO) 318#define PAGE_RO __pgprot(_PAGE_TYPE_RO)
314#define PAGE_RW __pgprot(_PAGE_TYPE_RW) 319#define PAGE_RW __pgprot(_PAGE_TYPE_RW)
320#define PAGE_EX_RO __pgprot(_PAGE_TYPE_EX_RO)
321#define PAGE_EX_RW __pgprot(_PAGE_TYPE_EX_RW)
315 322
316#define PAGE_KERNEL PAGE_RW 323#define PAGE_KERNEL PAGE_RW
317#define PAGE_COPY PAGE_RO 324#define PAGE_COPY PAGE_RO
318 325
319/* 326/*
320 * The S390 can't do page protection for execute, and considers that the 327 * Dependent on the EXEC_PROTECT option s390 can do execute protection.
321 * same are read. Also, write permissions imply read permissions. This is 328 * Write permission always implies read permission. In theory with a
322 * the closest we can get.. 329 * primary/secondary page table execute only can be implemented but
330 * it would cost an additional bit in the pte to distinguish all the
331 * different pte types. To avoid that execute permission currently
332 * implies read permission as well.
323 */ 333 */
324 /*xwr*/ 334 /*xwr*/
325#define __P000 PAGE_NONE 335#define __P000 PAGE_NONE
326#define __P001 PAGE_RO 336#define __P001 PAGE_RO
327#define __P010 PAGE_RO 337#define __P010 PAGE_RO
328#define __P011 PAGE_RO 338#define __P011 PAGE_RO
329#define __P100 PAGE_RO 339#define __P100 PAGE_EX_RO
330#define __P101 PAGE_RO 340#define __P101 PAGE_EX_RO
331#define __P110 PAGE_RO 341#define __P110 PAGE_EX_RO
332#define __P111 PAGE_RO 342#define __P111 PAGE_EX_RO
333 343
334#define __S000 PAGE_NONE 344#define __S000 PAGE_NONE
335#define __S001 PAGE_RO 345#define __S001 PAGE_RO
336#define __S010 PAGE_RW 346#define __S010 PAGE_RW
337#define __S011 PAGE_RW 347#define __S011 PAGE_RW
338#define __S100 PAGE_RO 348#define __S100 PAGE_EX_RO
339#define __S101 PAGE_RO 349#define __S101 PAGE_EX_RO
340#define __S110 PAGE_RW 350#define __S110 PAGE_EX_RW
341#define __S111 PAGE_RW 351#define __S111 PAGE_EX_RW
352
353#ifndef __s390x__
354# define PMD_SHADOW_SHIFT 1
355# define PGD_SHADOW_SHIFT 1
356#else /* __s390x__ */
357# define PMD_SHADOW_SHIFT 2
358# define PGD_SHADOW_SHIFT 2
359#endif /* __s390x__ */
360
361static inline struct page *get_shadow_page(struct page *page)
362{
363 if (s390_noexec && !list_empty(&page->lru))
364 return virt_to_page(page->lru.next);
365 return NULL;
366}
367
368static inline pte_t *get_shadow_pte(pte_t *ptep)
369{
370 unsigned long pteptr = (unsigned long) (ptep);
371
372 if (s390_noexec) {
373 unsigned long offset = pteptr & (PAGE_SIZE - 1);
374 void *addr = (void *) (pteptr ^ offset);
375 struct page *page = virt_to_page(addr);
376 if (!list_empty(&page->lru))
377 return (pte_t *) ((unsigned long) page->lru.next |
378 offset);
379 }
380 return NULL;
381}
382
383static inline pmd_t *get_shadow_pmd(pmd_t *pmdp)
384{
385 unsigned long pmdptr = (unsigned long) (pmdp);
386
387 if (s390_noexec) {
388 unsigned long offset = pmdptr &
389 ((PAGE_SIZE << PMD_SHADOW_SHIFT) - 1);
390 void *addr = (void *) (pmdptr ^ offset);
391 struct page *page = virt_to_page(addr);
392 if (!list_empty(&page->lru))
393 return (pmd_t *) ((unsigned long) page->lru.next |
394 offset);
395 }
396 return NULL;
397}
398
399static inline pgd_t *get_shadow_pgd(pgd_t *pgdp)
400{
401 unsigned long pgdptr = (unsigned long) (pgdp);
402
403 if (s390_noexec) {
404 unsigned long offset = pgdptr &
405 ((PAGE_SIZE << PGD_SHADOW_SHIFT) - 1);
406 void *addr = (void *) (pgdptr ^ offset);
407 struct page *page = virt_to_page(addr);
408 if (!list_empty(&page->lru))
409 return (pgd_t *) ((unsigned long) page->lru.next |
410 offset);
411 }
412 return NULL;
413}
342 414
343/* 415/*
344 * Certain architectures need to do special things when PTEs 416 * Certain architectures need to do special things when PTEs
@@ -347,7 +419,16 @@ extern unsigned long vmalloc_end;
347 */ 419 */
348static inline void set_pte(pte_t *pteptr, pte_t pteval) 420static inline void set_pte(pte_t *pteptr, pte_t pteval)
349{ 421{
422 pte_t *shadow_pte = get_shadow_pte(pteptr);
423
350 *pteptr = pteval; 424 *pteptr = pteval;
425 if (shadow_pte) {
426 if (!(pte_val(pteval) & _PAGE_INVALID) &&
427 (pte_val(pteval) & _PAGE_SWX))
428 pte_val(*shadow_pte) = pte_val(pteval) | _PAGE_RO;
429 else
430 pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY;
431 }
351} 432}
352#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) 433#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
353 434
@@ -465,7 +546,7 @@ static inline int pte_read(pte_t pte)
465 546
466static inline void pgd_clear(pgd_t * pgdp) { } 547static inline void pgd_clear(pgd_t * pgdp) { }
467 548
468static inline void pmd_clear(pmd_t * pmdp) 549static inline void pmd_clear_kernel(pmd_t * pmdp)
469{ 550{
470 pmd_val(pmdp[0]) = _PAGE_TABLE_INV; 551 pmd_val(pmdp[0]) = _PAGE_TABLE_INV;
471 pmd_val(pmdp[1]) = _PAGE_TABLE_INV; 552 pmd_val(pmdp[1]) = _PAGE_TABLE_INV;
@@ -473,24 +554,55 @@ static inline void pmd_clear(pmd_t * pmdp)
473 pmd_val(pmdp[3]) = _PAGE_TABLE_INV; 554 pmd_val(pmdp[3]) = _PAGE_TABLE_INV;
474} 555}
475 556
557static inline void pmd_clear(pmd_t * pmdp)
558{
559 pmd_t *shadow_pmd = get_shadow_pmd(pmdp);
560
561 pmd_clear_kernel(pmdp);
562 if (shadow_pmd)
563 pmd_clear_kernel(shadow_pmd);
564}
565
476#else /* __s390x__ */ 566#else /* __s390x__ */
477 567
478static inline void pgd_clear(pgd_t * pgdp) 568static inline void pgd_clear_kernel(pgd_t * pgdp)
479{ 569{
480 pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; 570 pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY;
481} 571}
482 572
483static inline void pmd_clear(pmd_t * pmdp) 573static inline void pgd_clear(pgd_t * pgdp)
574{
575 pgd_t *shadow_pgd = get_shadow_pgd(pgdp);
576
577 pgd_clear_kernel(pgdp);
578 if (shadow_pgd)
579 pgd_clear_kernel(shadow_pgd);
580}
581
582static inline void pmd_clear_kernel(pmd_t * pmdp)
484{ 583{
485 pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; 584 pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
486 pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; 585 pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
487} 586}
488 587
588static inline void pmd_clear(pmd_t * pmdp)
589{
590 pmd_t *shadow_pmd = get_shadow_pmd(pmdp);
591
592 pmd_clear_kernel(pmdp);
593 if (shadow_pmd)
594 pmd_clear_kernel(shadow_pmd);
595}
596
489#endif /* __s390x__ */ 597#endif /* __s390x__ */
490 598
491static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 599static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
492{ 600{
601 pte_t *shadow_pte = get_shadow_pte(ptep);
602
493 pte_val(*ptep) = _PAGE_TYPE_EMPTY; 603 pte_val(*ptep) = _PAGE_TYPE_EMPTY;
604 if (shadow_pte)
605 pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY;
494} 606}
495 607
496/* 608/*
@@ -608,8 +720,11 @@ ptep_clear_flush(struct vm_area_struct *vma,
608 unsigned long address, pte_t *ptep) 720 unsigned long address, pte_t *ptep)
609{ 721{
610 pte_t pte = *ptep; 722 pte_t pte = *ptep;
723 pte_t *shadow_pte = get_shadow_pte(ptep);
611 724
612 __ptep_ipte(address, ptep); 725 __ptep_ipte(address, ptep);
726 if (shadow_pte)
727 __ptep_ipte(address, shadow_pte);
613 return pte; 728 return pte;
614} 729}
615 730
@@ -638,14 +753,14 @@ ptep_establish(struct vm_area_struct *vma,
638 * should therefore only be called if it is not mapped in any 753 * should therefore only be called if it is not mapped in any
639 * address space. 754 * address space.
640 */ 755 */
641static inline int page_test_and_clear_dirty(struct page *page) 756static inline int page_test_dirty(struct page *page)
642{ 757{
643 unsigned long physpage = page_to_phys(page); 758 return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0;
644 int skey = page_get_storage_key(physpage); 759}
645 760
646 if (skey & _PAGE_CHANGED) 761static inline void page_clear_dirty(struct page *page)
647 page_set_storage_key(physpage, skey & ~_PAGE_CHANGED); 762{
648 return skey & _PAGE_CHANGED; 763 page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY);
649} 764}
650 765
651/* 766/*
@@ -838,7 +953,8 @@ extern void memmap_init(unsigned long, int, unsigned long, unsigned long);
838#define __HAVE_ARCH_PTEP_CLEAR_FLUSH 953#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
839#define __HAVE_ARCH_PTEP_SET_WRPROTECT 954#define __HAVE_ARCH_PTEP_SET_WRPROTECT
840#define __HAVE_ARCH_PTE_SAME 955#define __HAVE_ARCH_PTE_SAME
841#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY 956#define __HAVE_ARCH_PAGE_TEST_DIRTY
957#define __HAVE_ARCH_PAGE_CLEAR_DIRTY
842#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 958#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
843#include <asm-generic/pgtable.h> 959#include <asm-generic/pgtable.h>
844 960
diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h
index cbbedc63ba25..e0fcea8c64c3 100644
--- a/include/asm-s390/processor.h
+++ b/include/asm-s390/processor.h
@@ -36,6 +36,11 @@ typedef struct
36 unsigned int unused : 16; 36 unsigned int unused : 16;
37} __attribute__ ((packed)) cpuid_t; 37} __attribute__ ((packed)) cpuid_t;
38 38
39static inline void get_cpu_id(cpuid_t *ptr)
40{
41 asm volatile("stidp 0(%1)" : "=m" (*ptr) : "a" (ptr));
42}
43
39struct cpuinfo_S390 44struct cpuinfo_S390
40{ 45{
41 cpuid_t cpu_id; 46 cpuid_t cpu_id;
@@ -50,7 +55,9 @@ struct cpuinfo_S390
50 unsigned long pgtable_cache_sz; 55 unsigned long pgtable_cache_sz;
51}; 56};
52 57
58extern void s390_adjust_jiffies(void);
53extern void print_cpu_info(struct cpuinfo_S390 *); 59extern void print_cpu_info(struct cpuinfo_S390 *);
60extern int get_cpu_capability(unsigned int *);
54 61
55/* Lazy FPU handling on uni-processor */ 62/* Lazy FPU handling on uni-processor */
56extern struct task_struct *last_task_used_math; 63extern struct task_struct *last_task_used_math;
@@ -144,7 +151,8 @@ struct stack_frame {
144#ifndef __s390x__ 151#ifndef __s390x__
145 152
146#define start_thread(regs, new_psw, new_stackp) do { \ 153#define start_thread(regs, new_psw, new_stackp) do { \
147 regs->psw.mask = PSW_USER_BITS; \ 154 set_fs(USER_DS); \
155 regs->psw.mask = psw_user_bits; \
148 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \ 156 regs->psw.addr = new_psw | PSW_ADDR_AMODE; \
149 regs->gprs[15] = new_stackp ; \ 157 regs->gprs[15] = new_stackp ; \
150} while (0) 158} while (0)
@@ -152,13 +160,15 @@ struct stack_frame {
152#else /* __s390x__ */ 160#else /* __s390x__ */
153 161
154#define start_thread(regs, new_psw, new_stackp) do { \ 162#define start_thread(regs, new_psw, new_stackp) do { \
155 regs->psw.mask = PSW_USER_BITS; \ 163 set_fs(USER_DS); \
164 regs->psw.mask = psw_user_bits; \
156 regs->psw.addr = new_psw; \ 165 regs->psw.addr = new_psw; \
157 regs->gprs[15] = new_stackp; \ 166 regs->gprs[15] = new_stackp; \
158} while (0) 167} while (0)
159 168
160#define start_thread31(regs, new_psw, new_stackp) do { \ 169#define start_thread31(regs, new_psw, new_stackp) do { \
161 regs->psw.mask = PSW_USER32_BITS; \ 170 set_fs(USER_DS); \
171 regs->psw.mask = psw_user32_bits; \
162 regs->psw.addr = new_psw; \ 172 regs->psw.addr = new_psw; \
163 regs->gprs[15] = new_stackp; \ 173 regs->gprs[15] = new_stackp; \
164} while (0) 174} while (0)
@@ -187,6 +197,7 @@ extern unsigned long thread_saved_pc(struct task_struct *t);
187extern char *task_show_regs(struct task_struct *task, char *buffer); 197extern char *task_show_regs(struct task_struct *task, char *buffer);
188 198
189extern void show_registers(struct pt_regs *regs); 199extern void show_registers(struct pt_regs *regs);
200extern void show_code(struct pt_regs *regs);
190extern void show_trace(struct task_struct *task, unsigned long *sp); 201extern void show_trace(struct task_struct *task, unsigned long *sp);
191 202
192unsigned long get_wchan(struct task_struct *p); 203unsigned long get_wchan(struct task_struct *p);
@@ -201,9 +212,8 @@ unsigned long get_wchan(struct task_struct *p);
201static inline void cpu_relax(void) 212static inline void cpu_relax(void)
202{ 213{
203 if (MACHINE_HAS_DIAG44) 214 if (MACHINE_HAS_DIAG44)
204 asm volatile("diag 0,0,68" : : : "memory"); 215 asm volatile("diag 0,0,68");
205 else 216 barrier();
206 barrier();
207} 217}
208 218
209/* 219/*
@@ -328,6 +338,18 @@ static inline void disabled_wait(unsigned long code)
328} 338}
329 339
330/* 340/*
341 * Basic Machine Check/Program Check Handler.
342 */
343
344extern void s390_base_mcck_handler(void);
345extern void s390_base_pgm_handler(void);
346extern void s390_base_ext_handler(void);
347
348extern void (*s390_base_mcck_handler_fn)(void);
349extern void (*s390_base_pgm_handler_fn)(void);
350extern void (*s390_base_ext_handler_fn)(void);
351
352/*
331 * CPU idle notifier chain. 353 * CPU idle notifier chain.
332 */ 354 */
333#define CPU_IDLE 0 355#define CPU_IDLE 0
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index 7b768c5c68a8..fa6ca87080e8 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -266,17 +266,12 @@ typedef struct
266#define PSW_ASC_SECONDARY 0x0000800000000000UL 266#define PSW_ASC_SECONDARY 0x0000800000000000UL
267#define PSW_ASC_HOME 0x0000C00000000000UL 267#define PSW_ASC_HOME 0x0000C00000000000UL
268 268
269#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \ 269extern long psw_user32_bits;
270 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
271 PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
272 270
273#endif /* __s390x__ */ 271#endif /* __s390x__ */
274 272
275#define PSW_KERNEL_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | \ 273extern long psw_kernel_bits;
276 PSW_MASK_MCHECK | PSW_DEFAULT_KEY) 274extern long psw_user_bits;
277#define PSW_USER_BITS (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
278 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
279 PSW_MASK_PSTATE | PSW_DEFAULT_KEY)
280 275
281/* This macro merges a NEW PSW mask specified by the user into 276/* This macro merges a NEW PSW mask specified by the user into
282 the currently active PSW mask CURRENT, modifying only those 277 the currently active PSW mask CURRENT, modifying only those
diff --git a/include/asm-s390/reset.h b/include/asm-s390/reset.h
index 532e65a2aafc..f584f4a52581 100644
--- a/include/asm-s390/reset.h
+++ b/include/asm-s390/reset.h
@@ -18,7 +18,4 @@ struct reset_call {
18extern void register_reset_call(struct reset_call *reset); 18extern void register_reset_call(struct reset_call *reset);
19extern void unregister_reset_call(struct reset_call *reset); 19extern void unregister_reset_call(struct reset_call *reset);
20extern void s390_reset_system(void); 20extern void s390_reset_system(void);
21extern void (*s390_reset_mcck_handler)(void);
22extern void (*s390_reset_pgm_handler)(void);
23
24#endif /* _ASM_S390_RESET_H */ 21#endif /* _ASM_S390_RESET_H */
diff --git a/include/asm-s390/sclp.h b/include/asm-s390/sclp.h
new file mode 100644
index 000000000000..21ed64773210
--- /dev/null
+++ b/include/asm-s390/sclp.h
@@ -0,0 +1,53 @@
1/*
2 * include/asm-s390/sclp.h
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_SCLP_H
9#define _ASM_S390_SCLP_H
10
11#include <linux/types.h>
12#include <asm/chpid.h>
13
14struct sccb_header {
15 u16 length;
16 u8 function_code;
17 u8 control_mask[3];
18 u16 response_code;
19} __attribute__((packed));
20
21#define LOADPARM_LEN 8
22
23struct sclp_readinfo_sccb {
24 struct sccb_header header; /* 0-7 */
25 u16 rnmax; /* 8-9 */
26 u8 rnsize; /* 10 */
27 u8 _reserved0[24 - 11]; /* 11-23 */
28 u8 loadparm[LOADPARM_LEN]; /* 24-31 */
29 u8 _reserved1[91 - 32]; /* 32-90 */
30 u8 flags; /* 91 */
31 u8 _reserved2[100 - 92]; /* 92-99 */
32 u32 rnsize2; /* 100-103 */
33 u64 rnmax2; /* 104-111 */
34 u8 _reserved3[4096 - 112]; /* 112-4095 */
35} __attribute__((packed, aligned(4096)));
36
37#define SCLP_CHP_INFO_MASK_SIZE 32
38
39struct sclp_chp_info {
40 u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
41 u8 standby[SCLP_CHP_INFO_MASK_SIZE];
42 u8 configured[SCLP_CHP_INFO_MASK_SIZE];
43};
44
45extern struct sclp_readinfo_sccb s390_readinfo_sccb;
46extern void sclp_readinfo_early(void);
47extern int sclp_sdias_blk_count(void);
48extern int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
49extern int sclp_chp_configure(struct chp_id chpid);
50extern int sclp_chp_deconfigure(struct chp_id chpid);
51extern int sclp_chp_read_info(struct sclp_chp_info *info);
52
53#endif /* _ASM_S390_SCLP_H */
diff --git a/include/asm-s390/sections.h b/include/asm-s390/sections.h
index 3a0b8ffeab7a..fbd9116eb17b 100644
--- a/include/asm-s390/sections.h
+++ b/include/asm-s390/sections.h
@@ -3,4 +3,6 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern char _eshared[], _ehead[];
7
6#endif 8#endif
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 9574fe80a046..a76a6b8fd887 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -16,7 +16,6 @@
16 16
17#define PARMAREA 0x10400 17#define PARMAREA 0x10400
18#define MEMORY_CHUNKS 16 /* max 0x7fff */ 18#define MEMORY_CHUNKS 16 /* max 0x7fff */
19#define IPL_PARMBLOCK_ORIGIN 0x2000
20 19
21#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
22 21
@@ -41,6 +40,19 @@ struct mem_chunk {
41}; 40};
42 41
43extern struct mem_chunk memory_chunk[]; 42extern struct mem_chunk memory_chunk[];
43extern unsigned long real_memory_size;
44
45#ifdef CONFIG_S390_SWITCH_AMODE
46extern unsigned int switch_amode;
47#else
48#define switch_amode (0)
49#endif
50
51#ifdef CONFIG_S390_EXEC_PROTECT
52extern unsigned int s390_noexec;
53#else
54#define s390_noexec (0)
55#endif
44 56
45/* 57/*
46 * Machine features detected in head.S 58 * Machine features detected in head.S
@@ -66,6 +78,7 @@ extern unsigned long machine_flags;
66#endif /* __s390x__ */ 78#endif /* __s390x__ */
67 79
68#define MACHINE_HAS_SCLP (!MACHINE_IS_P390) 80#define MACHINE_HAS_SCLP (!MACHINE_IS_P390)
81#define ZFCPDUMP_HSA_SIZE (32UL<<20)
69 82
70/* 83/*
71 * Console mode. Override with conmode= 84 * Console mode. Override with conmode=
@@ -74,6 +87,9 @@ extern unsigned int console_mode;
74extern unsigned int console_devno; 87extern unsigned int console_devno;
75extern unsigned int console_irq; 88extern unsigned int console_irq;
76 89
90extern char vmhalt_cmd[];
91extern char vmpoff_cmd[];
92
77#define CONSOLE_IS_UNDEFINED (console_mode == 0) 93#define CONSOLE_IS_UNDEFINED (console_mode == 0)
78#define CONSOLE_IS_SCLP (console_mode == 1) 94#define CONSOLE_IS_SCLP (console_mode == 1)
79#define CONSOLE_IS_3215 (console_mode == 2) 95#define CONSOLE_IS_3215 (console_mode == 2)
@@ -82,75 +98,8 @@ extern unsigned int console_irq;
82#define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 98#define SET_CONSOLE_3215 do { console_mode = 2; } while (0)
83#define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 99#define SET_CONSOLE_3270 do { console_mode = 3; } while (0)
84 100
85struct ipl_list_hdr { 101#define NSS_NAME_SIZE 8
86 u32 len; 102extern char kernel_nss_name[];
87 u8 reserved1[3];
88 u8 version;
89 u32 blk0_len;
90 u8 pbt;
91 u8 flags;
92 u16 reserved2;
93} __attribute__((packed));
94
95struct ipl_block_fcp {
96 u8 reserved1[313-1];
97 u8 opt;
98 u8 reserved2[3];
99 u16 reserved3;
100 u16 devno;
101 u8 reserved4[4];
102 u64 wwpn;
103 u64 lun;
104 u32 bootprog;
105 u8 reserved5[12];
106 u64 br_lba;
107 u32 scp_data_len;
108 u8 reserved6[260];
109 u8 scp_data[];
110} __attribute__((packed));
111
112struct ipl_block_ccw {
113 u8 load_param[8];
114 u8 reserved1[84];
115 u8 reserved2[2];
116 u16 devno;
117 u8 vm_flags;
118 u8 reserved3[3];
119 u32 vm_parm_len;
120} __attribute__((packed));
121
122struct ipl_parameter_block {
123 struct ipl_list_hdr hdr;
124 union {
125 struct ipl_block_fcp fcp;
126 struct ipl_block_ccw ccw;
127 } ipl_info;
128} __attribute__((packed));
129
130#define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
131 sizeof(struct ipl_block_fcp))
132
133#define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
134 sizeof(struct ipl_block_ccw))
135
136#define IPL_MAX_SUPPORTED_VERSION (0)
137
138/*
139 * IPL validity flags and parameters as detected in head.S
140 */
141extern u32 ipl_flags;
142extern u16 ipl_devno;
143
144void do_reipl(void);
145
146enum {
147 IPL_DEVNO_VALID = 1,
148 IPL_PARMBLOCK_VALID = 2,
149};
150
151#define IPL_PARMBLOCK_START ((struct ipl_parameter_block *) \
152 IPL_PARMBLOCK_ORIGIN)
153#define IPL_PARMBLOCK_SIZE (IPL_PARMBLOCK_START->hdr.len)
154 103
155#else /* __ASSEMBLY__ */ 104#else /* __ASSEMBLY__ */
156 105
diff --git a/include/asm-s390/sfp-util.h b/include/asm-s390/sfp-util.h
new file mode 100644
index 000000000000..8cabcd23d976
--- /dev/null
+++ b/include/asm-s390/sfp-util.h
@@ -0,0 +1,66 @@
1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/types.h>
4#include <asm/byteorder.h>
5
6#define add_ssaaaa(sh, sl, ah, al, bh, bl) ({ \
7 unsigned int __sh = (ah); \
8 unsigned int __sl = (al); \
9 asm volatile( \
10 " alr %1,%3\n" \
11 " brc 12,0f\n" \
12 " ahi %0,1\n" \
13 "0: alr %0,%2" \
14 : "+&d" (__sh), "+d" (__sl) \
15 : "d" (bh), "d" (bl) : "cc"); \
16 (sh) = __sh; \
17 (sl) = __sl; \
18})
19
20#define sub_ddmmss(sh, sl, ah, al, bh, bl) ({ \
21 unsigned int __sh = (ah); \
22 unsigned int __sl = (al); \
23 asm volatile( \
24 " slr %1,%3\n" \
25 " brc 3,0f\n" \
26 " ahi %0,-1\n" \
27 "0: slr %0,%2" \
28 : "+&d" (__sh), "+d" (__sl) \
29 : "d" (bh), "d" (bl) : "cc"); \
30 (sh) = __sh; \
31 (sl) = __sl; \
32})
33
34/* a umul b = a mul b + (a>=2<<31) ? b<<32:0 + (b>=2<<31) ? a<<32:0 */
35#define umul_ppmm(wh, wl, u, v) ({ \
36 unsigned int __wh = u; \
37 unsigned int __wl = v; \
38 asm volatile( \
39 " ltr 1,%0\n" \
40 " mr 0,%1\n" \
41 " jnm 0f\n" \
42 " alr 0,%1\n" \
43 "0: ltr %1,%1\n" \
44 " jnm 1f\n" \
45 " alr 0,%0\n" \
46 "1: lr %0,0\n" \
47 " lr %1,1\n" \
48 : "+d" (__wh), "+d" (__wl) \
49 : : "0", "1", "cc"); \
50 wh = __wh; \
51 wl = __wl; \
52})
53
54#define udiv_qrnnd(q, r, n1, n0, d) \
55 do { unsigned int __r; \
56 (q) = __udiv_qrnnd (&__r, (n1), (n0), (d)); \
57 (r) = __r; \
58 } while (0)
59extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int,
60 unsigned int , unsigned int);
61
62#define UDIV_NEEDS_NORMALIZATION 0
63
64#define abort() return 0
65
66#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/include/asm-s390/smp.h b/include/asm-s390/smp.h
index 7097c96ed026..0a28e6d6ef40 100644
--- a/include/asm-s390/smp.h
+++ b/include/asm-s390/smp.h
@@ -31,6 +31,10 @@ typedef struct
31 __u16 cpu; 31 __u16 cpu;
32} sigp_info; 32} sigp_info;
33 33
34extern void machine_restart_smp(char *);
35extern void machine_halt_smp(void);
36extern void machine_power_off_smp(void);
37
34extern void smp_setup_cpu_possible_map(void); 38extern void smp_setup_cpu_possible_map(void);
35extern int smp_call_function_on(void (*func) (void *info), void *info, 39extern int smp_call_function_on(void (*func) (void *info), void *info,
36 int nonatomic, int wait, int cpu); 40 int nonatomic, int wait, int cpu);
@@ -50,9 +54,6 @@ extern int smp_call_function_on(void (*func) (void *info), void *info,
50 54
51#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr) 55#define raw_smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
52 56
53extern int smp_get_cpu(cpumask_t cpu_map);
54extern void smp_put_cpu(int cpu);
55
56static inline __u16 hard_smp_processor_id(void) 57static inline __u16 hard_smp_processor_id(void)
57{ 58{
58 __u16 cpu_address; 59 __u16 cpu_address;
@@ -106,13 +107,12 @@ smp_call_function_on(void (*func) (void *info), void *info,
106static inline void smp_send_stop(void) 107static inline void smp_send_stop(void)
107{ 108{
108 /* Disable all interrupts/machine checks */ 109 /* Disable all interrupts/machine checks */
109 __load_psw_mask(PSW_KERNEL_BITS & ~PSW_MASK_MCHECK); 110 __load_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK);
110} 111}
111 112
112#define smp_cpu_not_running(cpu) 1 113#define smp_cpu_not_running(cpu) 1
113#define smp_get_cpu(cpu) ({ 0; })
114#define smp_put_cpu(cpu) ({ 0; })
115#define smp_setup_cpu_possible_map() do { } while (0) 114#define smp_setup_cpu_possible_map() do { } while (0)
116#endif 115#endif
117 116
117extern union save_area *zfcpdump_save_areas[NR_CPUS + 1];
118#endif 118#endif
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 1778a49a74c5..1161ebe3dec9 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -57,5 +57,7 @@
57 57
58#define SO_PEERSEC 31 58#define SO_PEERSEC 31
59#define SO_PASSSEC 34 59#define SO_PASSSEC 34
60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
60 62
61#endif /* _ASM_SOCKET_H */ 63#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-s390/sockios.h b/include/asm-s390/sockios.h
index 412aeb4dd6ce..f4fc16c7da59 100644
--- a/include/asm-s390/sockios.h
+++ b/include/asm-s390/sockios.h
@@ -15,6 +15,7 @@
15#define FIOGETOWN 0x8903 15#define FIOGETOWN 0x8903
16#define SIOCGPGRP 0x8904 16#define SIOCGPGRP 0x8904
17#define SIOCATMARK 0x8905 17#define SIOCATMARK 0x8905
18#define SIOCGSTAMP 0x8906 /* Get stamp */ 18#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
19#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19 20
20#endif 21#endif
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index bd0b05ae87d2..bbe137c3ed69 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -373,8 +373,8 @@ __set_psw_mask(unsigned long mask)
373 __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8))); 373 __load_psw_mask(mask | (__raw_local_irq_stosm(0x00) & ~(-1UL >> 8)));
374} 374}
375 375
376#define local_mcck_enable() __set_psw_mask(PSW_KERNEL_BITS) 376#define local_mcck_enable() __set_psw_mask(psw_kernel_bits)
377#define local_mcck_disable() __set_psw_mask(PSW_KERNEL_BITS & ~PSW_MASK_MCHECK) 377#define local_mcck_disable() __set_psw_mask(psw_kernel_bits & ~PSW_MASK_MCHECK)
378 378
379#ifdef CONFIG_SMP 379#ifdef CONFIG_SMP
380 380
diff --git a/include/asm-s390/tape390.h b/include/asm-s390/tape390.h
index f1d66ba0deef..884fba48f1ff 100644
--- a/include/asm-s390/tape390.h
+++ b/include/asm-s390/tape390.h
@@ -1,11 +1,11 @@
1/************************************************************************* 1/*************************************************************************
2 * 2 *
3 * tape390.h 3 * tape390.h
4 * enables user programs to display messages on the tape device 4 * enables user programs to display messages and control encryption
5 * on s390 tape devices
5 * 6 *
6 * S390 and zSeries version 7 * Copyright IBM Corp. 2001,2006
7 * Copyright (C) 2001 IBM Corporation 8 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
8 * Author(s): Despina Papadopoulou <despina_p@de.ibm.com>
9 * 9 *
10 *************************************************************************/ 10 *************************************************************************/
11 11
@@ -36,4 +36,68 @@ typedef struct display_struct {
36 char message2[8]; 36 char message2[8];
37} display_struct; 37} display_struct;
38 38
39/*
40 * Tape encryption support
41 */
42
43struct tape390_crypt_info {
44 char capability;
45 char status;
46 char medium_status;
47} __attribute__ ((packed));
48
49
50/* Macros for "capable" field */
51#define TAPE390_CRYPT_SUPPORTED_MASK 0x01
52#define TAPE390_CRYPT_SUPPORTED(x) \
53 ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK))
54
55/* Macros for "status" field */
56#define TAPE390_CRYPT_ON_MASK 0x01
57#define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK))
58
59/* Macros for "medium status" field */
60#define TAPE390_MEDIUM_LOADED_MASK 0x01
61#define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02
62#define TAPE390_MEDIUM_ENCRYPTED(x) \
63 (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK))
64#define TAPE390_MEDIUM_LOADED(x) \
65 (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK))
66
67/*
68 * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption.
69 * The "encryption_capable" and "tape_status" fields are ignored for this ioctl!
70 */
71#define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info)
72
73/*
74 * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state.
75 */
76#define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info)
77
78/* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */
79#define TAPE390_KEKL_TYPE_NONE 0
80#define TAPE390_KEKL_TYPE_LABEL 1
81#define TAPE390_KEKL_TYPE_HASH 2
82
83struct tape390_kekl {
84 unsigned char type;
85 unsigned char type_on_tape;
86 char label[65];
87} __attribute__ ((packed));
88
89struct tape390_kekl_pair {
90 struct tape390_kekl kekl[2];
91} __attribute__ ((packed));
92
93/*
94 * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels.
95 */
96#define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair)
97
98/*
99 * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels.
100 */
101#define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair)
102
39#endif 103#endif
diff --git a/include/asm-s390/termios.h b/include/asm-s390/termios.h
index 62b23caf370e..a3480e25eb4b 100644
--- a/include/asm-s390/termios.h
+++ b/include/asm-s390/termios.h
@@ -47,24 +47,6 @@ struct termio {
47 47
48/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 48/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
49 49
50/* line disciplines */
51#define N_TTY 0
52#define N_SLIP 1
53#define N_MOUSE 2
54#define N_PPP 3
55#define N_STRIP 4
56#define N_AX25 5
57#define N_X25 6 /* X.25 async */
58#define N_6PACK 7
59#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
60#define N_R3964 9 /* Reserved for Simatic R3964 module */
61#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
62#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
63#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
64#define N_HDLC 13 /* synchronous HDLC */
65#define N_SYNC_PPP 14 /* synchronous PPP */
66#define N_HCI 15 /* Bluetooth HCI UART */
67
68#ifdef __KERNEL__ 50#ifdef __KERNEL__
69 51
70/* intr=^C quit=^\ erase=del kill=^U 52/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-s390/timer.h b/include/asm-s390/timer.h
index 30e5cbe570f2..adb34860a543 100644
--- a/include/asm-s390/timer.h
+++ b/include/asm-s390/timer.h
@@ -45,6 +45,9 @@ extern void add_virt_timer_periodic(void *new);
45extern int mod_virt_timer(struct vtimer_list *timer, __u64 expires); 45extern int mod_virt_timer(struct vtimer_list *timer, __u64 expires);
46extern int del_virt_timer(struct vtimer_list *timer); 46extern int del_virt_timer(struct vtimer_list *timer);
47 47
48extern void init_cpu_vtimer(void);
49extern void vtime_init(void);
50
48#endif /* __KERNEL__ */ 51#endif /* __KERNEL__ */
49 52
50#endif /* _ASM_S390_TIMER_H */ 53#endif /* _ASM_S390_TIMER_H */
diff --git a/include/asm-s390/timex.h b/include/asm-s390/timex.h
index 4df4a41029a3..98229db24314 100644
--- a/include/asm-s390/timex.h
+++ b/include/asm-s390/timex.h
@@ -11,6 +11,41 @@
11#ifndef _ASM_S390_TIMEX_H 11#ifndef _ASM_S390_TIMEX_H
12#define _ASM_S390_TIMEX_H 12#define _ASM_S390_TIMEX_H
13 13
14/* Inline functions for clock register access. */
15static inline int set_clock(__u64 time)
16{
17 int cc;
18
19 asm volatile(
20 " sck 0(%2)\n"
21 " ipm %0\n"
22 " srl %0,28\n"
23 : "=d" (cc) : "m" (time), "a" (&time) : "cc");
24 return cc;
25}
26
27static inline int store_clock(__u64 *time)
28{
29 int cc;
30
31 asm volatile(
32 " stck 0(%2)\n"
33 " ipm %0\n"
34 " srl %0,28\n"
35 : "=d" (cc), "=m" (*time) : "a" (time) : "cc");
36 return cc;
37}
38
39static inline void set_clock_comparator(__u64 time)
40{
41 asm volatile("sckc 0(%1)" : : "m" (time), "a" (&time));
42}
43
44static inline void store_clock_comparator(__u64 *time)
45{
46 asm volatile("stckc 0(%1)" : "=m" (*time) : "a" (time));
47}
48
14#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ 49#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
15 50
16typedef unsigned long long cycles_t; 51typedef unsigned long long cycles_t;
@@ -27,9 +62,24 @@ static inline unsigned long long get_clock (void)
27 return clk; 62 return clk;
28} 63}
29 64
65static inline void get_clock_extended(void *dest)
66{
67 typedef struct { unsigned long long clk[2]; } __clock_t;
68
69#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
70 asm volatile("stcke %0" : "=Q" (*((__clock_t *)dest)) : : "cc");
71#else /* __GNUC__ */
72 asm volatile("stcke 0(%1)" : "=m" (*((__clock_t *)dest))
73 : "a" ((__clock_t *)dest) : "cc");
74#endif /* __GNUC__ */
75}
76
30static inline cycles_t get_cycles(void) 77static inline cycles_t get_cycles(void)
31{ 78{
32 return (cycles_t) get_clock() >> 2; 79 return (cycles_t) get_clock() >> 2;
33} 80}
34 81
82int get_sync_clock(unsigned long long *clock);
83void init_cpu_timer(void);
84
35#endif 85#endif
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h
index fa4dc916a9bf..66793f55c8b2 100644
--- a/include/asm-s390/tlbflush.h
+++ b/include/asm-s390/tlbflush.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/processor.h> 5#include <asm/processor.h>
6#include <asm/pgalloc.h>
6 7
7/* 8/*
8 * TLB flushing: 9 * TLB flushing:
@@ -102,6 +103,14 @@ static inline void __flush_tlb_mm(struct mm_struct * mm)
102 if (unlikely(cpus_empty(mm->cpu_vm_mask))) 103 if (unlikely(cpus_empty(mm->cpu_vm_mask)))
103 return; 104 return;
104 if (MACHINE_HAS_IDTE) { 105 if (MACHINE_HAS_IDTE) {
106 pgd_t *shadow_pgd = get_shadow_pgd(mm->pgd);
107
108 if (shadow_pgd) {
109 asm volatile(
110 " .insn rrf,0xb98e0000,0,%0,%1,0"
111 : : "a" (2048),
112 "a" (__pa(shadow_pgd) & PAGE_MASK) : "cc" );
113 }
105 asm volatile( 114 asm volatile(
106 " .insn rrf,0xb98e0000,0,%0,%1,0" 115 " .insn rrf,0xb98e0000,0,%0,%1,0"
107 : : "a" (2048), "a" (__pa(mm->pgd)&PAGE_MASK) : "cc"); 116 : : "a" (2048), "a" (__pa(mm->pgd)&PAGE_MASK) : "cc");
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 73ac4e82217b..0235970278f0 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -90,6 +90,8 @@ struct uaccess_ops {
90extern struct uaccess_ops uaccess; 90extern struct uaccess_ops uaccess;
91extern struct uaccess_ops uaccess_std; 91extern struct uaccess_ops uaccess_std;
92extern struct uaccess_ops uaccess_mvcos; 92extern struct uaccess_ops uaccess_mvcos;
93extern struct uaccess_ops uaccess_mvcos_switch;
94extern struct uaccess_ops uaccess_pt;
93 95
94static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 96static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
95{ 97{
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index fb6fef97d739..5c6f00d62df8 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -250,8 +250,9 @@
250/* Number 310 is reserved for new sys_move_pages */ 250/* Number 310 is reserved for new sys_move_pages */
251#define __NR_getcpu 311 251#define __NR_getcpu 311
252#define __NR_epoll_pwait 312 252#define __NR_epoll_pwait 312
253#define __NR_utimes 313
253 254
254#define NR_syscalls 313 255#define NR_syscalls 314
255 256
256/* 257/*
257 * There are some system calls that are not present on 64 bit, some 258 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sh/Kbuild b/include/asm-sh/Kbuild
index c68e1680da01..76a8ccf254a5 100644
--- a/include/asm-sh/Kbuild
+++ b/include/asm-sh/Kbuild
@@ -1 +1,3 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3header-y += cpu-features.h
diff --git a/include/asm-sh/apm.h b/include/asm-sh/apm.h
deleted file mode 100644
index 8b091e93651f..000000000000
--- a/include/asm-sh/apm.h
+++ /dev/null
@@ -1,46 +0,0 @@
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/bigsur/bigsur.h b/include/asm-sh/bigsur/bigsur.h
deleted file mode 100644
index 427245f93589..000000000000
--- a/include/asm-sh/bigsur/bigsur.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 *
3 * Hitachi Big Sur Eval Board support
4 *
5 * Dustin McIntire (dustin@sensoria.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 * Derived from Hitachi SH7751 reference manual
11 *
12 */
13
14#ifndef _ASM_BIGSUR_H_
15#define _ASM_BIGSUR_H_
16
17#include <asm/irq.h>
18#include <asm/hd64465/hd64465.h>
19
20/* 7751 Internal IRQ's used by external CPLD controller */
21#define BIGSUR_IRQ_LOW 0
22#define BIGSUR_IRQ_NUM 14 /* External CPLD level 1 IRQs */
23#define BIGSUR_IRQ_HIGH (BIGSUR_IRQ_LOW + BIGSUR_IRQ_NUM)
24#define BIGSUR_2NDLVL_IRQ_LOW (HD64465_IRQ_BASE+HD64465_IRQ_NUM)
25#define BIGSUR_2NDLVL_IRQ_NUM 32 /* Level 2 IRQs = 4 regs * 8 bits */
26#define BIGSUR_2NDLVL_IRQ_HIGH (BIGSUR_2NDLVL_IRQ_LOW + \
27 BIGSUR_2NDLVL_IRQ_NUM)
28
29/* PCI interrupt base number (A_INTA-A_INTD) */
30#define BIGSUR_SH7751_PCI_IRQ_BASE (BIGSUR_2NDLVL_IRQ_LOW+10)
31
32/* CPLD registers and external chip addresses */
33#define BIGSUR_HD64464_ADDR 0xB2000000
34#define BIGSUR_DGDR 0xB1FFFE00
35#define BIGSUR_BIDR 0xB1FFFD00
36#define BIGSUR_CSLR 0xB1FFFC00
37#define BIGSUR_SW1R 0xB1FFFB00
38#define BIGSUR_DBGR 0xB1FFFA00
39#define BIGSUR_BDTR 0xB1FFF900
40#define BIGSUR_BDRR 0xB1FFF800
41#define BIGSUR_PPR1 0xB1FFF700
42#define BIGSUR_PPR2 0xB1FFF600
43#define BIGSUR_IDE2 0xB1FFF500
44#define BIGSUR_IDE3 0xB1FFF400
45#define BIGSUR_SPCR 0xB1FFF300
46#define BIGSUR_ETHR 0xB1FE0000
47#define BIGSUR_PPDR 0xB1FDFF00
48#define BIGSUR_ICTL 0xB1FDFE00
49#define BIGSUR_ICMD 0xB1FDFD00
50#define BIGSUR_DMA0 0xB1FDFC00
51#define BIGSUR_DMA1 0xB1FDFB00
52#define BIGSUR_IRQ0 0xB1FDFA00
53#define BIGSUR_IRQ1 0xB1FDF900
54#define BIGSUR_IRQ2 0xB1FDF800
55#define BIGSUR_IRQ3 0xB1FDF700
56#define BIGSUR_IMR0 0xB1FDF600
57#define BIGSUR_IMR1 0xB1FDF500
58#define BIGSUR_IMR2 0xB1FDF400
59#define BIGSUR_IMR3 0xB1FDF300
60#define BIGSUR_IRLMR0 0xB1FDF200
61#define BIGSUR_IRLMR1 0xB1FDF100
62#define BIGSUR_V320USC_ADDR 0xB1000000
63#define BIGSUR_HD64465_ADDR 0xB0000000
64#define BIGSUR_INTERNAL_BASE 0xB0000000
65
66/* SMC ethernet card parameters */
67#define BIGSUR_ETHER_IOPORT 0x220
68
69/* IDE register paramters */
70#define BIGSUR_IDECMD_IOPORT 0x1f0
71#define BIGSUR_IDECTL_IOPORT 0x1f8
72
73/* LED bit position in BIGSUR_CSLR */
74#define BIGSUR_LED (1<<4)
75
76/* PCI: default LOCAL memory window sizes (seen from PCI bus) */
77#define BIGSUR_LSR0_SIZE (64*(1<<20)) //64MB
78#define BIGSUR_LSR1_SIZE (64*(1<<20)) //64MB
79
80#endif /* _ASM_BIGSUR_H_ */
diff --git a/include/asm-sh/bigsur/io.h b/include/asm-sh/bigsur/io.h
deleted file mode 100644
index 1470ac8d4a39..000000000000
--- a/include/asm-sh/bigsur/io.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * include/asm-sh/bigsur/io.h
3 *
4 * By Dustin McIntire (dustin@sensoria.com) (c)2001
5 * Derived from io_hd64465.h, which bore the message:
6 * By Greg Banks <gbanks@pocketpenguins.com>
7 * (c) 2000 PocketPenguins Inc.
8 * and from io_hd64461.h, which bore the message:
9 * Copyright 2000 Stuart Menefy (stuart.menefy@st.com)
10 *
11 * May be copied or modified under the terms of the GNU General Public
12 * License. See linux/COPYING for more information.
13 *
14 * IO functions for a Hitachi Big Sur Evaluation Board.
15 */
16
17#ifndef _ASM_SH_IO_BIGSUR_H
18#define _ASM_SH_IO_BIGSUR_H
19
20#include <linux/types.h>
21
22extern unsigned long bigsur_isa_port2addr(unsigned long offset);
23extern int bigsur_irq_demux(int irq);
24/* Provision for generic secondary demux step -- used by PCMCIA code */
25extern void bigsur_register_irq_demux(int irq,
26 int (*demux)(int irq, void *dev), void *dev);
27extern void bigsur_unregister_irq_demux(int irq);
28/* Set this variable to 1 to see port traffic */
29extern int bigsur_io_debug;
30/* Map a range of ports to a range of kernel virtual memory. */
31extern void bigsur_port_map(u32 baseport, u32 nports, u32 addr, u8 shift);
32extern void bigsur_port_unmap(u32 baseport, u32 nports);
33
34#endif /* _ASM_SH_IO_BIGSUR_H */
35
diff --git a/include/asm-sh/bigsur/serial.h b/include/asm-sh/bigsur/serial.h
deleted file mode 100644
index a08fa82fe45a..000000000000
--- a/include/asm-sh/bigsur/serial.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * include/asm-sh/bigsur/serial.h
3 *
4 * Configuration details for Big Sur 16550 based serial ports
5 * i.e. HD64465, PCMCIA, etc.
6 */
7
8#ifndef _ASM_SERIAL_BIGSUR_H
9#define _ASM_SERIAL_BIGSUR_H
10#include <asm/hd64465.h>
11
12#define BASE_BAUD (3379200 / 16)
13
14#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
15
16
17#define SERIAL_PORT_DFNS \
18 /* UART CLK PORT IRQ FLAGS */ \
19 { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */
20
21/* XXX: This should be moved ino irq.h */
22#define irq_cannonicalize(x) (x)
23
24#endif /* _ASM_SERIAL_BIGSUR_H */
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
index a294997a8412..5a117ec43c77 100644
--- a/include/asm-sh/bugs.h
+++ b/include/asm-sh/bugs.h
@@ -19,9 +19,9 @@ static void __init check_bugs(void)
19 extern unsigned long loops_per_jiffy; 19 extern unsigned long loops_per_jiffy;
20 char *p = &init_utsname()->machine[2]; /* "sh" */ 20 char *p = &init_utsname()->machine[2]; /* "sh" */
21 21
22 cpu_data->loops_per_jiffy = loops_per_jiffy; 22 current_cpu_data.loops_per_jiffy = loops_per_jiffy;
23 23
24 switch (cpu_data->type) { 24 switch (current_cpu_data.type) {
25 case CPU_SH7604 ... CPU_SH7619: 25 case CPU_SH7604 ... CPU_SH7619:
26 *p++ = '2'; 26 *p++ = '2';
27 break; 27 break;
@@ -54,7 +54,7 @@ static void __init check_bugs(void)
54 break; 54 break;
55 } 55 }
56 56
57 printk("CPU: %s\n", get_cpu_subtype()); 57 printk("CPU: %s\n", get_cpu_subtype(&current_cpu_data));
58 58
59#ifndef __LITTLE_ENDIAN__ 59#ifndef __LITTLE_ENDIAN__
60 /* 'eb' means 'Endian Big' */ 60 /* 'eb' means 'Endian Big' */
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
index e3a180cf5062..9a3cb6ba9d15 100644
--- a/include/asm-sh/cache.h
+++ b/include/asm-sh/cache.h
@@ -21,6 +21,7 @@
21 21
22#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))
23 23
24#ifndef __ASSEMBLY__
24struct cache_info { 25struct cache_info {
25 unsigned int ways; /* Number of cache ways */ 26 unsigned int ways; /* Number of cache ways */
26 unsigned int sets; /* Number of cache sets */ 27 unsigned int sets; /* Number of cache sets */
@@ -47,6 +48,6 @@ struct cache_info {
47 48
48 unsigned long flags; 49 unsigned long flags;
49}; 50};
50 51#endif /* __ASSEMBLY__ */
51#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
52#endif /* __ASM_SH_CACHE_H */ 53#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
index b01a10f31225..5fd5c89ef86a 100644
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ b/include/asm-sh/cpu-sh4/cacheflush.h
@@ -17,6 +17,7 @@
17 * so we need them. 17 * so we need them.
18 */ 18 */
19void flush_cache_all(void); 19void flush_cache_all(void);
20void flush_dcache_all(void);
20void flush_cache_mm(struct mm_struct *mm); 21void flush_cache_mm(struct mm_struct *mm);
21#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 22#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
22void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 23void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
@@ -40,14 +41,4 @@ void p3_cache_init(void);
40 41
41#define PG_mapped PG_arch_1 42#define PG_mapped PG_arch_1
42 43
43#ifdef CONFIG_MMU
44extern int remap_area_pages(unsigned long addr, unsigned long phys_addr,
45 unsigned long size, unsigned long flags);
46#else /* CONFIG_MMU */
47static inline int remap_area_pages(unsigned long addr, unsigned long phys_addr,
48 unsigned long size, unsigned long flags)
49{
50 return 0;
51}
52#endif /* CONFIG_MMU */
53#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */ 44#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h
index 3e4b3e6d80c0..c135e9cebd9c 100644
--- a/include/asm-sh/cpu-sh4/dma.h
+++ b/include/asm-sh/cpu-sh4/dma.h
@@ -3,6 +3,17 @@
3 3
4#define DMAOR_INIT ( 0x8000 | DMAOR_DME ) 4#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
5 5
6/* SH7751/7760/7780 DMA IRQ sources */
7#define DMTE0_IRQ 34
8#define DMTE1_IRQ 35
9#define DMTE2_IRQ 36
10#define DMTE3_IRQ 37
11#define DMTE4_IRQ 44
12#define DMTE5_IRQ 45
13#define DMTE6_IRQ 46
14#define DMTE7_IRQ 47
15#define DMAE_IRQ 38
16
6#ifdef CONFIG_CPU_SH4A 17#ifdef CONFIG_CPU_SH4A
7#define SH_DMAC_BASE 0xfc808020 18#define SH_DMAC_BASE 0xfc808020
8 19
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 8d0867b98e05..d3bc7818bbbe 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -53,6 +53,10 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
53 consistent_free(vaddr, size); 53 consistent_free(vaddr, size);
54} 54}
55 55
56#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
57#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
58#define dma_is_consistent(d, h) (1)
59
56static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 60static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
57 enum dma_data_direction dir) 61 enum dma_data_direction dir)
58{ 62{
diff --git a/include/asm-sh/ec3104/ec3104.h b/include/asm-sh/ec3104/ec3104.h
deleted file mode 100644
index 639cfa489c8f..000000000000
--- a/include/asm-sh/ec3104/ec3104.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef __ASM_EC3104_H
2#define __ASM_EC3104_H
3
4
5/*
6 * Most of the register set is at 0xb0ec0000 - 0xb0ecffff.
7 *
8 * as far as I've figured it out the register map is:
9 * 0xb0ec0000 - id string
10 * 0xb0ec0XXX - power management
11 * 0xb0ec1XXX - interrupt control
12 * 0xb0ec3XXX - ps2 port (touch pad on aero 8000)
13 * 0xb0ec6XXX - i2c
14 * 0xb0ec7000 - first serial port (proprietary connector on aero 8000)
15 * 0xb0ec8000 - second serial port
16 * 0xb0ec9000 - third serial port
17 * 0xb0eca000 - fourth serial port (keyboard controller on aero 8000)
18 * 0xb0eccXXX - GPIO
19 * 0xb0ecdXXX - GPIO
20 */
21
22#define EC3104_BASE 0xb0ec0000
23
24#define EC3104_SER4_DATA (EC3104_BASE+0xa000)
25#define EC3104_SER4_IIR (EC3104_BASE+0xa008)
26#define EC3104_SER4_MCR (EC3104_BASE+0xa010)
27#define EC3104_SER4_LSR (EC3104_BASE+0xa014)
28#define EC3104_SER4_MSR (EC3104_BASE+0xa018)
29
30/*
31 * our ISA bus. this seems to be real ISA.
32 */
33#define EC3104_ISA_BASE 0xa5000000
34
35#define EC3104_IRQ 11
36#define EC3104_IRQBASE 64
37
38#define EC3104_IRQ_SER1 EC3104_IRQBASE + 7
39#define EC3104_IRQ_SER2 EC3104_IRQBASE + 8
40#define EC3104_IRQ_SER3 EC3104_IRQBASE + 9
41#define EC3104_IRQ_SER4 EC3104_IRQBASE + 10
42
43#endif /* __ASM_EC3104_H */
diff --git a/include/asm-sh/ec3104/io.h b/include/asm-sh/ec3104/io.h
deleted file mode 100644
index ea5c8e65ac11..000000000000
--- a/include/asm-sh/ec3104/io.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_SH_IO_EC3104_H
2#define _ASM_SH_IO_EC3104_H
3
4#include <linux/types.h>
5
6extern unsigned char ec3104_inb(unsigned long port);
7extern unsigned short ec3104_inw(unsigned long port);
8extern unsigned long ec3104_inl(unsigned long port);
9
10extern void ec3104_outb(unsigned char value, unsigned long port);
11extern void ec3104_outw(unsigned short value, unsigned long port);
12extern void ec3104_outl(unsigned long value, unsigned long port);
13
14extern int ec3104_irq_demux(int irq);
15
16#endif /* _ASM_SH_IO_EC3104_H */
diff --git a/include/asm-sh/ec3104/keyboard.h b/include/asm-sh/ec3104/keyboard.h
deleted file mode 100644
index c1253a683197..000000000000
--- a/include/asm-sh/ec3104/keyboard.h
+++ /dev/null
@@ -1,15 +0,0 @@
1extern unsigned char ec3104_kbd_sysrq_xlate[];
2extern int ec3104_kbd_setkeycode(unsigned int scancode, unsigned int keycode);
3extern int ec3104_kbd_getkeycode(unsigned int scancode);
4extern int ec3104_kbd_translate(unsigned char, unsigned char *, char);
5extern char ec3104_kbd_unexpected_up(unsigned char);
6extern void ec3104_kbd_leds(unsigned char);
7extern void ec3104_kbd_init_hw(void);
8
9#define kbd_sysrq_xlate ec3104_kbd_sysrq_xlate
10#define kbd_setkeycode ec3104_kbd_setkeycode
11#define kbd_getkeycode ec3104_kbd_getkeycode
12#define kbd_translate ec3104_kbd_translate
13#define kbd_unexpected_up ec3104_kbd_unexpected_up
14#define kbd_leds ec3104_kbd_leds
15#define kbd_init_hw ec3104_kbd_init_hw
diff --git a/include/asm-sh/ec3104/serial.h b/include/asm-sh/ec3104/serial.h
deleted file mode 100644
index cfe4d78ec1ee..000000000000
--- a/include/asm-sh/ec3104/serial.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#include <asm/ec3104.h>
2/* Naturally we don't know the exact value but 115200 baud has a divisor
3 * of 9 and 19200 baud has a divisor of 52, so this seems like a good
4 * guess. */
5#define BASE_BAUD (16800000 / 16)
6
7#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
8
9/* there is a fourth serial port with the expected values as well, but
10 * it's got the keyboard controller behind it so we can't really use it
11 * (without moving the keyboard driver to userspace, which doesn't sound
12 * like a very good idea) */
13#define SERIAL_PORT_DFNS \
14 /* UART CLK PORT IRQ FLAGS */ \
15 { 0, BASE_BAUD, 0x11C00, EC3104_IRQBASE+7, STD_COM_FLAGS }, /* ttyS0 */ \
16 { 0, BASE_BAUD, 0x12000, EC3104_IRQBASE+8, STD_COM_FLAGS }, /* ttyS1 */ \
17 { 0, BASE_BAUD, 0x12400, EC3104_IRQBASE+9, STD_COM_FLAGS }, /* ttyS2 */
18
19/* XXX: This should be moved ino irq.h */
20#define irq_cannonicalize(x) (x)
diff --git a/include/asm-sh/hp6xx.h b/include/asm-sh/hp6xx.h
index f35134c159dd..53ca5643d9c7 100644
--- a/include/asm-sh/hp6xx.h
+++ b/include/asm-sh/hp6xx.h
@@ -10,9 +10,9 @@
10 * 10 *
11 */ 11 */
12 12
13#define HP680_BTN_IRQ IRQ0_IRQ 13#define HP680_BTN_IRQ 32 /* IRQ0_IRQ */
14#define HP680_TS_IRQ IRQ3_IRQ 14#define HP680_TS_IRQ 35 /* IRQ3_IRQ */
15#define HP680_HD64461_IRQ IRQ4_IRQ 15#define HP680_HD64461_IRQ 36 /* IRQ4_IRQ */
16 16
17#define DAC_LCD_BRIGHTNESS 0 17#define DAC_LCD_BRIGHTNESS 0
18#define DAC_SPEAKER_VOLUME 1 18#define DAC_SPEAKER_VOLUME 1
diff --git a/include/asm-sh/ioctls.h b/include/asm-sh/ioctls.h
index 9d84a2d445a2..35805df010a0 100644
--- a/include/asm-sh/ioctls.h
+++ b/include/asm-sh/ioctls.h
@@ -16,17 +16,17 @@
16#define TCSETSW 0x5403 16#define TCSETSW 0x5403
17#define TCSETSF 0x5404 17#define TCSETSF 0x5404
18 18
19#define TCGETA _IOR('t', 23, struct termio) 19#define TCGETA 0x80127417 /* _IOR('t', 23, struct termio) */
20#define TCSETA _IOW('t', 24, struct termio) 20#define TCSETA 0x40127418 /* _IOW('t', 24, struct termio) */
21#define TCSETAW _IOW('t', 25, struct termio) 21#define TCSETAW 0x40127419 /* _IOW('t', 25, struct termio) */
22#define TCSETAF _IOW('t', 28, struct termio) 22#define TCSETAF 0x4012741C /* _IOW('t', 28, struct termio) */
23 23
24#define TCSBRK _IO('t', 29) 24#define TCSBRK _IO('t', 29)
25#define TCXONC _IO('t', 30) 25#define TCXONC _IO('t', 30)
26#define TCFLSH _IO('t', 31) 26#define TCFLSH _IO('t', 31)
27 27
28#define TIOCSWINSZ _IOW('t', 103, struct winsize) 28#define TIOCSWINSZ 0x40087467 /* _IOW('t', 103, struct winsize) */
29#define TIOCGWINSZ _IOR('t', 104, struct winsize) 29#define TIOCGWINSZ 0x80087468 /* _IOR('t', 104, struct winsize) */
30#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ 30#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
31#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ 31#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
32#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ 32#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
@@ -59,8 +59,8 @@
59#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */ 59#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */
60#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */ 60#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */
61#define TIOCCONS _IO('T', 29) /* 0x541D */ 61#define TIOCCONS _IO('T', 29) /* 0x541D */
62#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */ 62#define TIOCGSERIAL 0x803C541E /* _IOR('T', 30, struct serial_struct) 0x541E */
63#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */ 63#define TIOCSSERIAL 0x403C541F /* _IOW('T', 31, struct serial_struct) 0x541F */
64#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */ 64#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */
65# define TIOCPKT_DATA 0 65# define TIOCPKT_DATA 0
66# define TIOCPKT_FLUSHREAD 1 66# define TIOCPKT_FLUSHREAD 1
@@ -86,12 +86,12 @@
86#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */ 86#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
87#define TIOCGLCKTRMIOS 0x5456 87#define TIOCGLCKTRMIOS 0x5456
88#define TIOCSLCKTRMIOS 0x5457 88#define TIOCSLCKTRMIOS 0x5457
89#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */ 89#define TIOCSERGSTRUCT 0x80d85458 /* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */
90#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */ 90#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
91 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 91 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
92# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 92# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
93#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */ 93#define TIOCSERGETMULTI 0x80A8545A /* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config */
94#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */ 94#define TIOCSERSETMULTI 0x40A8545B /* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */
95 95
96#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */ 96#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
97#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 97#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
index bff965ef4b95..afe188f0ad5f 100644
--- a/include/asm-sh/irq.h
+++ b/include/asm-sh/irq.h
@@ -66,12 +66,8 @@
66/* 3. OFFCHIP_NR_IRQS */ 66/* 3. OFFCHIP_NR_IRQS */
67#if defined(CONFIG_HD64461) 67#if defined(CONFIG_HD64461)
68# define OFFCHIP_NR_IRQS 18 68# define OFFCHIP_NR_IRQS 18
69#elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
70# define OFFCHIP_NR_IRQS 48
71#elif defined(CONFIG_HD64465) 69#elif defined(CONFIG_HD64465)
72# define OFFCHIP_NR_IRQS 16 70# define OFFCHIP_NR_IRQS 16
73#elif defined (CONFIG_SH_EC3104)
74# define OFFCHIP_NR_IRQS 16
75#elif defined (CONFIG_SH_DREAMCAST) 71#elif defined (CONFIG_SH_DREAMCAST)
76# define OFFCHIP_NR_IRQS 96 72# define OFFCHIP_NR_IRQS 96
77#elif defined (CONFIG_SH_TITAN) 73#elif defined (CONFIG_SH_TITAN)
@@ -98,8 +94,13 @@
98/* 94/*
99 * Convert back and forth between INTEVT and IRQ values. 95 * Convert back and forth between INTEVT and IRQ values.
100 */ 96 */
97#ifdef CONFIG_CPU_HAS_INTEVT
101#define evt2irq(evt) (((evt) >> 5) - 16) 98#define evt2irq(evt) (((evt) >> 5) - 16)
102#define irq2evt(irq) (((irq) + 16) << 5) 99#define irq2evt(irq) (((irq) + 16) << 5)
100#else
101#define evt2irq(evt) (evt)
102#define irq2evt(irq) (irq)
103#endif
103 104
104/* 105/*
105 * Simple Mask Register Support 106 * Simple Mask Register Support
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 7b26f53fe343..0095c665d272 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -85,10 +85,10 @@ extern int setjmp(jmp_buf __jmpb);
85#define KGDB_PRINTK(...) printk("KGDB: " __VA_ARGS__) 85#define KGDB_PRINTK(...) printk("KGDB: " __VA_ARGS__)
86 86
87/* Forced breakpoint */ 87/* Forced breakpoint */
88#define BREAKPOINT() do { \ 88#define BREAKPOINT() \
89 if (kgdb_enabled) { \ 89do { \
90 asm volatile("trapa #0xff"); \ 90 if (kgdb_enabled) \
91 } \ 91 __asm__ __volatile__("trapa #0x3c"); \
92} while (0) 92} while (0)
93 93
94/* KGDB should be able to flush all kernel text space */ 94/* KGDB should be able to flush all kernel text space */
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h
index cf47df79bb94..eb0358c097d0 100644
--- a/include/asm-sh/mmu.h
+++ b/include/asm-sh/mmu.h
@@ -1,25 +1,19 @@
1#ifndef __MMU_H 1#ifndef __MMU_H
2#define __MMU_H 2#define __MMU_H
3 3
4#if !defined(CONFIG_MMU) 4/* Default "unsigned long" context */
5typedef unsigned long mm_context_id_t[NR_CPUS];
5 6
6typedef struct { 7typedef struct {
8#ifdef CONFIG_MMU
9 mm_context_id_t id;
10 void *vdso;
11#else
7 struct vm_list_struct *vmlist; 12 struct vm_list_struct *vmlist;
8 unsigned long end_brk; 13 unsigned long end_brk;
14#endif
9} mm_context_t; 15} mm_context_t;
10 16
11#else
12
13/* Default "unsigned long" context */
14typedef unsigned long mm_context_id_t;
15
16typedef struct {
17 mm_context_id_t id;
18 void *vdso;
19} mm_context_t;
20
21#endif /* CONFIG_MMU */
22
23/* 17/*
24 * Privileged Space Mapping Buffer (PMB) definitions 18 * Privileged Space Mapping Buffer (PMB) definitions
25 */ 19 */
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
index 46f04e23bd45..342024425b7d 100644
--- a/include/asm-sh/mmu_context.h
+++ b/include/asm-sh/mmu_context.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 1999 Niibe Yutaka 2 * Copyright (C) 1999 Niibe Yutaka
3 * Copyright (C) 2003 Paul Mundt 3 * Copyright (C) 2003 - 2006 Paul Mundt
4 * 4 *
5 * ASID handling idea taken from MIPS implementation. 5 * ASID handling idea taken from MIPS implementation.
6 */ 6 */
@@ -19,11 +19,6 @@
19 * (b) ASID (Address Space IDentifier) 19 * (b) ASID (Address Space IDentifier)
20 */ 20 */
21 21
22/*
23 * Cache of MMU context last used.
24 */
25extern unsigned long mmu_context_cache;
26
27#define MMU_CONTEXT_ASID_MASK 0x000000ff 22#define MMU_CONTEXT_ASID_MASK 0x000000ff
28#define MMU_CONTEXT_VERSION_MASK 0xffffff00 23#define MMU_CONTEXT_VERSION_MASK 0xffffff00
29#define MMU_CONTEXT_FIRST_VERSION 0x00000100 24#define MMU_CONTEXT_FIRST_VERSION 0x00000100
@@ -32,6 +27,11 @@ extern unsigned long mmu_context_cache;
32/* ASID is 8-bit value, so it can't be 0x100 */ 27/* ASID is 8-bit value, so it can't be 0x100 */
33#define MMU_NO_ASID 0x100 28#define MMU_NO_ASID 0x100
34 29
30#define cpu_context(cpu, mm) ((mm)->context.id[cpu])
31#define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & \
32 MMU_CONTEXT_ASID_MASK)
33#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
34
35/* 35/*
36 * Virtual Page Number mask 36 * Virtual Page Number mask
37 */ 37 */
@@ -41,18 +41,17 @@ extern unsigned long mmu_context_cache;
41/* 41/*
42 * Get MMU context if needed. 42 * Get MMU context if needed.
43 */ 43 */
44static inline void get_mmu_context(struct mm_struct *mm) 44static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
45{ 45{
46 unsigned long mc = mmu_context_cache; 46 unsigned long asid = asid_cache(cpu);
47 47
48 /* Check if we have old version of context. */ 48 /* Check if we have old version of context. */
49 if (((mm->context.id ^ mc) & MMU_CONTEXT_VERSION_MASK) == 0) 49 if (((cpu_context(cpu, mm) ^ asid) & MMU_CONTEXT_VERSION_MASK) == 0)
50 /* It's up to date, do nothing */ 50 /* It's up to date, do nothing */
51 return; 51 return;
52 52
53 /* It's old, we need to get new context with new version. */ 53 /* It's old, we need to get new context with new version. */
54 mc = ++mmu_context_cache; 54 if (!(++asid & MMU_CONTEXT_ASID_MASK)) {
55 if (!(mc & MMU_CONTEXT_ASID_MASK)) {
56 /* 55 /*
57 * We exhaust ASID of this version. 56 * We exhaust ASID of this version.
58 * Flush all TLB and start new cycle. 57 * Flush all TLB and start new cycle.
@@ -63,10 +62,11 @@ static inline void get_mmu_context(struct mm_struct *mm)
63 * Fix version; Note that we avoid version #0 62 * Fix version; Note that we avoid version #0
64 * to distingush NO_CONTEXT. 63 * to distingush NO_CONTEXT.
65 */ 64 */
66 if (!mc) 65 if (!asid)
67 mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; 66 asid = MMU_CONTEXT_FIRST_VERSION;
68 } 67 }
69 mm->context.id = mc; 68
69 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
70} 70}
71 71
72/* 72/*
@@ -74,9 +74,13 @@ static inline void get_mmu_context(struct mm_struct *mm)
74 * instance. 74 * instance.
75 */ 75 */
76static inline int init_new_context(struct task_struct *tsk, 76static inline int init_new_context(struct task_struct *tsk,
77 struct mm_struct *mm) 77 struct mm_struct *mm)
78{ 78{
79 mm->context.id = NO_CONTEXT; 79 int i;
80
81 for (i = 0; i < num_online_cpus(); i++)
82 cpu_context(i, mm) = NO_CONTEXT;
83
80 return 0; 84 return 0;
81} 85}
82 86
@@ -117,10 +121,10 @@ static inline unsigned long get_asid(void)
117 * After we have set current->mm to a new value, this activates 121 * After we have set current->mm to a new value, this activates
118 * the context for the new mm so we see the new mappings. 122 * the context for the new mm so we see the new mappings.
119 */ 123 */
120static inline void activate_context(struct mm_struct *mm) 124static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
121{ 125{
122 get_mmu_context(mm); 126 get_mmu_context(mm, cpu);
123 set_asid(mm->context.id & MMU_CONTEXT_ASID_MASK); 127 set_asid(cpu_asid(cpu, mm));
124} 128}
125 129
126/* MMU_TTB is used for optimizing the fault handling. */ 130/* MMU_TTB is used for optimizing the fault handling. */
@@ -138,10 +142,15 @@ static inline void switch_mm(struct mm_struct *prev,
138 struct mm_struct *next, 142 struct mm_struct *next,
139 struct task_struct *tsk) 143 struct task_struct *tsk)
140{ 144{
145 unsigned int cpu = smp_processor_id();
146
141 if (likely(prev != next)) { 147 if (likely(prev != next)) {
148 cpu_set(cpu, next->cpu_vm_mask);
142 set_TTB(next->pgd); 149 set_TTB(next->pgd);
143 activate_context(next); 150 activate_context(next, cpu);
144 } 151 } else
152 if (!cpu_test_and_set(cpu, next->cpu_vm_mask))
153 activate_context(next, cpu);
145} 154}
146 155
147#define deactivate_mm(tsk,mm) do { } while (0) 156#define deactivate_mm(tsk,mm) do { } while (0)
@@ -159,7 +168,7 @@ enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
159#define destroy_context(mm) do { } while (0) 168#define destroy_context(mm) do { } while (0)
160#define set_asid(asid) do { } while (0) 169#define set_asid(asid) do { } while (0)
161#define get_asid() (0) 170#define get_asid() (0)
162#define activate_context(mm) do { } while (0) 171#define activate_context(mm,cpu) do { } while (0)
163#define switch_mm(prev,next,tsk) do { } while (0) 172#define switch_mm(prev,next,tsk) do { } while (0)
164#define deactivate_mm(tsk,mm) do { } while (0) 173#define deactivate_mm(tsk,mm) do { } while (0)
165#define activate_mm(prev,next) do { } while (0) 174#define activate_mm(prev,next) do { } while (0)
@@ -174,14 +183,16 @@ enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
174 */ 183 */
175static inline void enable_mmu(void) 184static inline void enable_mmu(void)
176{ 185{
186 unsigned int cpu = smp_processor_id();
187
177 /* Enable MMU */ 188 /* Enable MMU */
178 ctrl_outl(MMU_CONTROL_INIT, MMUCR); 189 ctrl_outl(MMU_CONTROL_INIT, MMUCR);
179 ctrl_barrier(); 190 ctrl_barrier();
180 191
181 if (mmu_context_cache == NO_CONTEXT) 192 if (asid_cache(cpu) == NO_CONTEXT)
182 mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; 193 asid_cache(cpu) = MMU_CONTEXT_FIRST_VERSION;
183 194
184 set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK); 195 set_asid(asid_cache(cpu) & MMU_CONTEXT_ASID_MASK);
185} 196}
186 197
187static inline void disable_mmu(void) 198static inline void disable_mmu(void)
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 380fd62dd05a..ac4b4677f28c 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -13,6 +13,8 @@
13 [ P4 control ] 0xE0000000 13 [ P4 control ] 0xE0000000
14 */ 14 */
15 15
16#ifdef __KERNEL__
17
16/* PAGE_SHIFT determines the page size */ 18/* PAGE_SHIFT determines the page size */
17#if defined(CONFIG_PAGE_SIZE_4KB) 19#if defined(CONFIG_PAGE_SIZE_4KB)
18# define PAGE_SHIFT 12 20# define PAGE_SHIFT 12
@@ -51,7 +53,6 @@
51#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) 53#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
52#endif 54#endif
53 55
54#ifdef __KERNEL__
55#ifndef __ASSEMBLY__ 56#ifndef __ASSEMBLY__
56 57
57extern void (*clear_page)(void *to); 58extern void (*clear_page)(void *to);
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index 036ca2843866..184d7fcaaf10 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -43,17 +43,17 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
43/* PGD bits */ 43/* PGD bits */
44#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS) 44#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS)
45#define PGDIR_BITS (32 - PGDIR_SHIFT) 45#define PGDIR_BITS (32 - PGDIR_SHIFT)
46#define PGDIR_SIZE (1 << PGDIR_SHIFT) 46#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
47#define PGDIR_MASK (~(PGDIR_SIZE-1)) 47#define PGDIR_MASK (~(PGDIR_SIZE-1))
48 48
49/* Entries per level */ 49/* Entries per level */
50#define PTRS_PER_PTE (PAGE_SIZE / 4) 50#define PTRS_PER_PTE (PAGE_SIZE / (1 << PTE_MAGNITUDE))
51#define PTRS_PER_PGD (PAGE_SIZE / 4) 51#define PTRS_PER_PGD (PAGE_SIZE / 4)
52 52
53#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) 53#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
54#define FIRST_USER_ADDRESS 0 54#define FIRST_USER_ADDRESS 0
55 55
56#define PTE_PHYS_MASK 0x1ffff000 56#define PTE_PHYS_MASK (0x20000000 - PAGE_SIZE)
57 57
58/* 58/*
59 * First 1MB map is used by fixed purpose. 59 * First 1MB map is used by fixed purpose.
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index e29f2abb92de..3e46a7afe764 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -27,8 +27,6 @@
27#define CCN_CVR 0xff000040 27#define CCN_CVR 0xff000040
28#define CCN_PRR 0xff000044 28#define CCN_PRR 0xff000044
29 29
30const char *get_cpu_subtype(void);
31
32/* 30/*
33 * CPU type and hardware bug flags. Kept separately for each CPU. 31 * CPU type and hardware bug flags. Kept separately for each CPU.
34 * 32 *
@@ -66,6 +64,7 @@ enum cpu_type {
66struct sh_cpuinfo { 64struct sh_cpuinfo {
67 unsigned int type; 65 unsigned int type;
68 unsigned long loops_per_jiffy; 66 unsigned long loops_per_jiffy;
67 unsigned long asid_cache;
69 68
70 struct cache_info icache; /* Primary I-cache */ 69 struct cache_info icache; /* Primary I-cache */
71 struct cache_info dcache; /* Primary D-cache */ 70 struct cache_info dcache; /* Primary D-cache */
@@ -288,5 +287,8 @@ extern int vsyscall_init(void);
288#define vsyscall_init() do { } while (0) 287#define vsyscall_init() do { } while (0)
289#endif 288#endif
290 289
290/* arch/sh/kernel/setup.c */
291const char *get_cpu_subtype(struct sh_cpuinfo *c);
292
291#endif /* __KERNEL__ */ 293#endif /* __KERNEL__ */
292#endif /* __ASM_SH_PROCESSOR_H */ 294#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/include/asm-sh/rts7751r2d.h b/include/asm-sh/rts7751r2d.h
index 796b8fcb81a8..10565ac7966a 100644
--- a/include/asm-sh/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d.h
@@ -68,6 +68,10 @@
68#define IRQ_PCISLOT2 10 /* PCI Slot #2 IRQ */ 68#define IRQ_PCISLOT2 10 /* PCI Slot #2 IRQ */
69#define IRQ_EXTENTION 11 /* EXTn IRQ */ 69#define IRQ_EXTENTION 11 /* EXTn IRQ */
70 70
71/* arch/sh/boards/renesas/rts7751r2d/irq.c */
72void init_rts7751r2d_IRQ(void);
73int rts7751r2d_irq_demux(int);
74
71#define __IO_PREFIX rts7751r2d 75#define __IO_PREFIX rts7751r2d
72#include <asm/io_generic.h> 76#include <asm/io_generic.h>
73 77
diff --git a/include/asm-sh/serial.h b/include/asm-sh/serial.h
index 8734590d27e8..21f6d330f189 100644
--- a/include/asm-sh/serial.h
+++ b/include/asm-sh/serial.h
@@ -9,11 +9,6 @@
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11 11
12#ifdef CONFIG_SH_EC3104
13#include <asm/serial-ec3104.h>
14#elif defined (CONFIG_SH_BIGSUR)
15#include <asm/serial-bigsur.h>
16#else
17/* 12/*
18 * This assumes you have a 1.8432 MHz clock for your UART. 13 * This assumes you have a 1.8432 MHz clock for your UART.
19 * 14 *
@@ -34,12 +29,8 @@
34 29
35#else 30#else
36 31
37#define SERIAL_PORT_DFNS \ 32#define SERIAL_PORT_DFNS
38 /* UART CLK PORT IRQ FLAGS */ \
39 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
40 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS } /* ttyS1 */
41 33
42#endif 34#endif
43 35
44#endif
45#endif /* _ASM_SERIAL_H */ 36#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index ca70362eb563..c48d6fc9da38 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __ASM_SH_SOCKET_H */ 55#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/sockios.h b/include/asm-sh/sockios.h
index 08a71df8a8be..cf8b96b1f9ab 100644
--- a/include/asm-sh/sockios.h
+++ b/include/asm-sh/sockios.h
@@ -9,5 +9,6 @@
9#define SIOCSPGRP _IOW('s', 8, pid_t) 9#define SIOCSPGRP _IOW('s', 8, pid_t)
10#define SIOCGPGRP _IOR('s', 9, pid_t) 10#define SIOCGPGRP _IOR('s', 9, pid_t)
11 11
12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 12#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
13#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
13#endif /* __ASM_SH_SOCKIOS_H */ 14#endif /* __ASM_SH_SOCKIOS_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
index 95bc7db006b0..55f8db6bc1d7 100644
--- a/include/asm-sh/string.h
+++ b/include/asm-sh/string.h
@@ -126,9 +126,6 @@ extern void *memchr(const void *__s, int __c, size_t __n);
126#define __HAVE_ARCH_STRLEN 126#define __HAVE_ARCH_STRLEN
127extern size_t strlen(const char *); 127extern size_t strlen(const char *);
128 128
129/* arch/sh/lib/strcasecmp.c */
130extern int strcasecmp(const char *, const char *);
131
132#endif /* __KERNEL__ */ 129#endif /* __KERNEL__ */
133 130
134#endif /* __ASM_SH_STRING_H */ 131#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index b1e42e7f998b..4a6a19f4f8a4 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/irqflags.h> 9#include <linux/irqflags.h>
10#include <linux/compiler.h>
10#include <asm/types.h> 11#include <asm/types.h>
11 12
12/* 13/*
diff --git a/include/asm-sh/termios.h b/include/asm-sh/termios.h
index 44edfd471443..e7c8f86ef890 100644
--- a/include/asm-sh/termios.h
+++ b/include/asm-sh/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61 43
62/* intr=^C quit=^\ erase=del kill=^U 44/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 879f741105db..31d55e3782d5 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -32,12 +32,20 @@ struct thread_info {
32 32
33#define PREEMPT_ACTIVE 0x10000000 33#define PREEMPT_ACTIVE 0x10000000
34 34
35#ifdef CONFIG_4KSTACKS 35#if defined(CONFIG_4KSTACKS)
36#define THREAD_SIZE (PAGE_SIZE) 36#define THREAD_SIZE_ORDER (0)
37#elif defined(CONFIG_PAGE_SIZE_4KB)
38#define THREAD_SIZE_ORDER (1)
39#elif defined(CONFIG_PAGE_SIZE_8KB)
40#define THREAD_SIZE_ORDER (1)
41#elif defined(CONFIG_PAGE_SIZE_64KB)
42#define THREAD_SIZE_ORDER (0)
37#else 43#else
38#define THREAD_SIZE (PAGE_SIZE * 2) 44#error "Unknown thread size"
39#endif 45#endif
40#define STACK_WARN (THREAD_SIZE / 8) 46
47#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
48#define STACK_WARN (THREAD_SIZE >> 3)
41 49
42/* 50/*
43 * macros/functions for gaining access to the thread information structure 51 * macros/functions for gaining access to the thread information structure
@@ -103,6 +111,7 @@ static inline struct thread_info *current_thread_info(void)
103#define TIF_SIGPENDING 2 /* signal pending */ 111#define TIF_SIGPENDING 2 /* signal pending */
104#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 112#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
105#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ 113#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
114#define TIF_SINGLESTEP 5 /* singlestepping active */
106#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 115#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
107#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 116#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
108#define TIF_MEMDIE 18 117#define TIF_MEMDIE 18
@@ -113,6 +122,7 @@ static inline struct thread_info *current_thread_info(void)
113#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 122#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
114#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 123#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
115#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 124#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
125#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
116#define _TIF_USEDFPU (1<<TIF_USEDFPU) 126#define _TIF_USEDFPU (1<<TIF_USEDFPU)
117#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 127#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
118#define _TIF_FREEZE (1<<TIF_FREEZE) 128#define _TIF_FREEZE (1<<TIF_FREEZE)
diff --git a/include/asm-sh/tlbflush.h b/include/asm-sh/tlbflush.h
index 28c073b0fbab..455fb8da441e 100644
--- a/include/asm-sh/tlbflush.h
+++ b/include/asm-sh/tlbflush.h
@@ -4,7 +4,6 @@
4/* 4/*
5 * TLB flushing: 5 * TLB flushing:
6 * 6 *
7 * - flush_tlb() flushes the current mm struct TLBs
8 * - flush_tlb_all() flushes all processes TLBs 7 * - flush_tlb_all() flushes all processes TLBs
9 * - flush_tlb_mm(mm) flushes the specified mm context TLB's 8 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
10 * - flush_tlb_page(vma, vmaddr) flushes one page 9 * - flush_tlb_page(vma, vmaddr) flushes one page
@@ -12,20 +11,45 @@
12 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
13 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables 12 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
14 */ 13 */
14extern void local_flush_tlb_all(void);
15extern void local_flush_tlb_mm(struct mm_struct *mm);
16extern void local_flush_tlb_range(struct vm_area_struct *vma,
17 unsigned long start,
18 unsigned long end);
19extern void local_flush_tlb_page(struct vm_area_struct *vma,
20 unsigned long page);
21extern void local_flush_tlb_kernel_range(unsigned long start,
22 unsigned long end);
23extern void local_flush_tlb_one(unsigned long asid, unsigned long page);
24
25#ifdef CONFIG_SMP
15 26
16extern void flush_tlb(void);
17extern void flush_tlb_all(void); 27extern void flush_tlb_all(void);
18extern void flush_tlb_mm(struct mm_struct *mm); 28extern void flush_tlb_mm(struct mm_struct *mm);
19extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 29extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
20 unsigned long end); 30 unsigned long end);
21extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); 31extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
22extern void __flush_tlb_page(unsigned long asid, unsigned long page); 32extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
33extern void flush_tlb_one(unsigned long asid, unsigned long page);
34
35#else
36
37#define flush_tlb_all() local_flush_tlb_all()
38#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
39#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
40#define flush_tlb_one(asid, page) local_flush_tlb_one(asid, page)
41
42#define flush_tlb_range(vma, start, end) \
43 local_flush_tlb_range(vma, start, end)
44
45#define flush_tlb_kernel_range(start, end) \
46 local_flush_tlb_kernel_range(start, end)
47
48#endif /* CONFIG_SMP */
23 49
24static inline void flush_tlb_pgtables(struct mm_struct *mm, 50static inline void flush_tlb_pgtables(struct mm_struct *mm,
25 unsigned long start, unsigned long end) 51 unsigned long start, unsigned long end)
26{ /* Nothing to do */ 52{
53 /* Nothing to do */
27} 54}
28
29extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
30
31#endif /* __ASM_SH_TLBFLUSH_H */ 55#endif /* __ASM_SH_TLBFLUSH_H */
diff --git a/include/asm-sh/ubc.h b/include/asm-sh/ubc.h
index 694f51f47941..ae9bbdeefbe1 100644
--- a/include/asm-sh/ubc.h
+++ b/include/asm-sh/ubc.h
@@ -17,7 +17,7 @@
17/* User Break Controller */ 17/* User Break Controller */
18#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \ 18#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \
19 defined(CONFIG_CPU_SUBTYPE_SH7300) 19 defined(CONFIG_CPU_SUBTYPE_SH7300)
20#define UBC_TYPE_SH7729 (cpu_data->type == CPU_SH7729) 20#define UBC_TYPE_SH7729 (current_cpu_data.type == CPU_SH7729)
21#else 21#else
22#define UBC_TYPE_SH7729 0 22#define UBC_TYPE_SH7729 0
23#endif 23#endif
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index f982073dc6c6..49be50a36b77 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -233,6 +233,7 @@
233#define __NR_fcntl64 221 233#define __NR_fcntl64 221
234/* 223 is unused */ 234/* 223 is unused */
235#define __NR_gettid 224 235#define __NR_gettid 224
236#define __NR_readahead 225
236#define __NR_setxattr 226 237#define __NR_setxattr 226
237#define __NR_lsetxattr 227 238#define __NR_lsetxattr 227
238#define __NR_fsetxattr 228 239#define __NR_fsetxattr 228
@@ -292,22 +293,22 @@
292#define __NR_mq_getsetattr (__NR_mq_open+5) 293#define __NR_mq_getsetattr (__NR_mq_open+5)
293#define __NR_kexec_load 283 294#define __NR_kexec_load 283
294#define __NR_waitid 284 295#define __NR_waitid 284
295/* #define __NR_sys_setaltroot 285 */ 296#define __NR_add_key 285
296#define __NR_add_key 286 297#define __NR_request_key 286
297#define __NR_request_key 287 298#define __NR_keyctl 287
298#define __NR_keyctl 288 299#define __NR_ioprio_set 288
299#define __NR_ioprio_set 289 300#define __NR_ioprio_get 289
300#define __NR_ioprio_get 290 301#define __NR_inotify_init 290
301#define __NR_inotify_init 291 302#define __NR_inotify_add_watch 291
302#define __NR_inotify_add_watch 292 303#define __NR_inotify_rm_watch 292
303#define __NR_inotify_rm_watch 293 304/* 293 is unused */
304#define __NR_migrate_pages 294 305#define __NR_migrate_pages 294
305#define __NR_openat 295 306#define __NR_openat 295
306#define __NR_mkdirat 296 307#define __NR_mkdirat 296
307#define __NR_mknodat 297 308#define __NR_mknodat 297
308#define __NR_fchownat 298 309#define __NR_fchownat 298
309#define __NR_futimesat 299 310#define __NR_futimesat 299
310#define __NR_newfstatat 300 311#define __NR_fstatat64 300
311#define __NR_unlinkat 301 312#define __NR_unlinkat 301
312#define __NR_renameat 302 313#define __NR_renameat 302
313#define __NR_linkat 303 314#define __NR_linkat 303
diff --git a/include/asm-sh/voyagergx.h b/include/asm-sh/voyagergx.h
index 99b0807d1c9f..64c936b22715 100644
--- a/include/asm-sh/voyagergx.h
+++ b/include/asm-sh/voyagergx.h
@@ -308,6 +308,9 @@
308#define AC97C_READ (1 << 19) 308#define AC97C_READ (1 << 19)
309#define AC97C_WD_BIT (1 << 2) 309#define AC97C_WD_BIT (1 << 2)
310#define AC97C_INDEX_MASK 0x7f 310#define AC97C_INDEX_MASK 0x7f
311/* -------------------------------------------------------------------- */ 311
312/* arch/sh/cchips/voyagergx/consistent.c */
313void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
314int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t);
312 315
313#endif /* _VOYAGER_GX_REG_H */ 316#endif /* _VOYAGER_GX_REG_H */
diff --git a/include/asm-sh64/sockios.h b/include/asm-sh64/sockios.h
index 1ae23ae82977..419e76f12f41 100644
--- a/include/asm-sh64/sockios.h
+++ b/include/asm-sh64/sockios.h
@@ -20,5 +20,6 @@
20#define SIOCSPGRP _IOW('s', 8, pid_t) 20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t) 21#define SIOCGPGRP _IOR('s', 9, pid_t)
22 22
23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */ 23#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp (timeval) */
24#define SIOCGSTAMPNS _IOR('s', 101, struct timespec) /* Get stamp (timespec) */
24#endif /* __ASM_SH64_SOCKIOS_H */ 25#endif /* __ASM_SH64_SOCKIOS_H */
diff --git a/include/asm-sh64/termios.h b/include/asm-sh64/termios.h
index 4a9c7fb411bc..dc44e6ed3a7c 100644
--- a/include/asm-sh64/termios.h
+++ b/include/asm-sh64/termios.h
@@ -50,24 +50,6 @@ struct termio {
50 50
51/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 51/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
52 52
53/* line disciplines */
54#define N_TTY 0
55#define N_SLIP 1
56#define N_MOUSE 2
57#define N_PPP 3
58#define N_STRIP 4
59#define N_AX25 5
60#define N_X25 6 /* X.25 async */
61#define N_6PACK 7
62#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
63#define N_R3964 9 /* Reserved for Simatic R3964 module */
64#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
65#define N_IRDA 11 /* Linux IR - http://www.cs.uit.no/~dagb/irda/irda.html */
66#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
67#define N_HDLC 13 /* synchronous HDLC */
68#define N_SYNC_PPP 14
69#define N_HCI 15 /* Bluetooth HCI UART */
70
71#ifdef __KERNEL__ 53#ifdef __KERNEL__
72 54
73/* intr=^C quit=^\ erase=del kill=^U 55/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h
index e4e83eb0161e..9090060a23e6 100644
--- a/include/asm-sparc/a.out.h
+++ b/include/asm-sparc/a.out.h
@@ -80,7 +80,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
80 unsigned long r_address; /* relocation addr */ 80 unsigned long r_address; /* relocation addr */
81 unsigned int r_index:24; /* segment index or symbol index */ 81 unsigned int r_index:24; /* segment index or symbol index */
82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
83 int r_pad:2; /* <unused> */ 83 unsigned int r_pad:2; /* <unused> */
84 enum reloc_type r_type:5; /* type of relocation to perform */ 84 enum reloc_type r_type:5; /* type of relocation to perform */
85 long r_addend; /* addend for relocation value */ 85 long r_addend; /* addend for relocation value */
86}; 86};
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 267e631e9bbc..34518ea7bf1b 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -151,7 +151,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
151 "xnor\t%%g0, %0, %0" 151 "xnor\t%%g0, %0, %0"
152 : "=r" (sum), "=&r" (iph) 152 : "=r" (sum), "=&r" (iph)
153 : "r" (ihl), "1" (iph) 153 : "r" (ihl), "1" (iph)
154 : "g2", "g3", "g4", "cc"); 154 : "g2", "g3", "g4", "cc", "memory");
155 return sum; 155 return sum;
156} 156}
157 157
diff --git a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h
index 6db83dc93cb7..f3a641e6b2c8 100644
--- a/include/asm-sparc/dma-mapping.h
+++ b/include/asm-sparc/dma-mapping.h
@@ -5,20 +5,7 @@
5#ifdef CONFIG_PCI 5#ifdef CONFIG_PCI
6#include <asm-generic/dma-mapping.h> 6#include <asm-generic/dma-mapping.h>
7#else 7#else
8 8#include <asm-generic/dma-mapping-broken.h>
9static inline void *dma_alloc_coherent(struct device *dev, size_t size,
10 dma_addr_t *dma_handle, gfp_t flag)
11{
12 BUG();
13 return NULL;
14}
15
16static inline void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle)
18{
19 BUG();
20}
21
22#endif /* PCI */ 9#endif /* PCI */
23 10
24#endif /* _ASM_SPARC_DMA_MAPPING_H */ 11#endif /* _ASM_SPARC_DMA_MAPPING_H */
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index cab0b851b8b1..c23e74a0eaa8 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -256,6 +256,35 @@ extern void iounmap(volatile void __iomem *addr);
256#define iowrite16(val,X) writew(val,X) 256#define iowrite16(val,X) writew(val,X)
257#define iowrite32(val,X) writel(val,X) 257#define iowrite32(val,X) writel(val,X)
258 258
259static inline void ioread8_rep(void __iomem *port, void *buf, unsigned long count)
260{
261 insb((unsigned long __force)port, buf, count);
262}
263static inline void ioread16_rep(void __iomem *port, void *buf, unsigned long count)
264{
265 insw((unsigned long __force)port, buf, count);
266}
267
268static inline void ioread32_rep(void __iomem *port, void *buf, unsigned long count)
269{
270 insl((unsigned long __force)port, buf, count);
271}
272
273static inline void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count)
274{
275 outsb((unsigned long __force)port, buf, count);
276}
277
278static inline void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count)
279{
280 outsw((unsigned long __force)port, buf, count);
281}
282
283static inline void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count)
284{
285 outsl((unsigned long __force)port, buf, count);
286}
287
259/* Create a virtual mapping cookie for an IO port range */ 288/* Create a virtual mapping cookie for an IO port range */
260extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 289extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
261extern void ioport_unmap(void __iomem *); 290extern void ioport_unmap(void __iomem *);
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
index bd92a78f4937..958d0513a6d4 100644
--- a/include/asm-sparc/mostek.h
+++ b/include/asm-sparc/mostek.h
@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs;
87#define MSTK_DOW_MASK 0x07 87#define MSTK_DOW_MASK 0x07
88#define MSTK_DOM_MASK 0x3f 88#define MSTK_DOM_MASK 0x3f
89#define MSTK_MONTH_MASK 0x1f 89#define MSTK_MONTH_MASK 0x1f
90#define MSTK_YEAR_MASK 0xff 90#define MSTK_YEAR_MASK 0xffU
91 91
92/* Binary coded decimal conversion macros. */ 92/* Binary coded decimal conversion macros. */
93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index 38644742f011..a750c688408b 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -165,6 +165,9 @@ static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
165 return (dma_addr == PCI_DMA_ERROR_CODE); 165 return (dma_addr == PCI_DMA_ERROR_CODE);
166} 166}
167 167
168struct device_node;
169extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
170
168#endif /* __KERNEL__ */ 171#endif /* __KERNEL__ */
169 172
170/* generic pci stuff */ 173/* generic pci stuff */
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index 86c13dccea3d..9ea105ebe2ff 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -35,8 +35,8 @@ struct property {
35}; 35};
36 36
37struct device_node { 37struct device_node {
38 char *name; 38 const char *name;
39 char *type; 39 const char *type;
40 phandle node; 40 phandle node;
41 char *path_component_name; 41 char *path_component_name;
42 char *full_name; 42 char *full_name;
@@ -85,12 +85,15 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node); 85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node, 86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev); 87 struct device_node *prev);
88extern struct property *of_find_property(struct device_node *np, 88extern struct property *of_find_property(const struct device_node *np,
89 const char *name, 89 const char *name,
90 int *lenp); 90 int *lenp);
91extern int of_device_is_compatible(struct device_node *device, const char *); 91extern int of_device_is_compatible(const struct device_node *device,
92extern void *of_get_property(struct device_node *node, const char *name, 92 const char *);
93 int *lenp); 93extern const void *of_get_property(const struct device_node *node,
94 const char *name,
95 int *lenp);
96#define get_property(node,name,lenp) of_get_property(node,name,lenp)
94extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 97extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
95extern int of_getintprop_default(struct device_node *np, 98extern int of_getintprop_default(struct device_node *np,
96 const char *name, 99 const char *name,
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index f6c4e5baf3f7..7c1423997cf0 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc/sockios.h b/include/asm-sparc/sockios.h
index 0c01b597b06f..990ea746486b 100644
--- a/include/asm-sparc/sockios.h
+++ b/include/asm-sparc/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h
index d05f83c80989..d767f206ab33 100644
--- a/include/asm-sparc/termios.h
+++ b/include/asm-sparc/termios.h
@@ -45,24 +45,6 @@ struct winsize {
45 unsigned short ws_ypixel; 45 unsigned short ws_ypixel;
46}; 46};
47 47
48/* line disciplines */
49#define N_TTY 0
50#define N_SLIP 1
51#define N_MOUSE 2
52#define N_PPP 3
53#define N_STRIP 4
54#define N_AX25 5
55#define N_X25 6
56#define N_6PACK 7
57#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
58#define N_R3964 9 /* Reserved for Simatic R3964 module */
59#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
60#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
61#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
62#define N_HDLC 13 /* synchronous HDLC */
63#define N_SYNC_PPP 14 /* synchronous PPP */
64#define N_HCI 15 /* Bluetooth HCI UART */
65
66#ifdef __KERNEL__ 48#ifdef __KERNEL__
67#include <linux/module.h> 49#include <linux/module.h>
68 50
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index d5b2f8053b3b..e43ed1d63a9d 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -319,16 +319,17 @@
319#define __NR_set_robust_list 300 319#define __NR_set_robust_list 300
320#define __NR_get_robust_list 301 320#define __NR_get_robust_list 301
321#define __NR_migrate_pages 302 321#define __NR_migrate_pages 302
322#define __NR_mbind 303
323#define __NR_get_mempolicy 304
324#define __NR_set_mempolicy 305
325#define __NR_kexec_load 306
326#define __NR_move_pages 307
327#define __NR_getcpu 308
328#define __NR_epoll_pwait 309
322 329
323#define NR_SYSCALLS 303 330#define NR_SYSCALLS 310
324 331
325#ifdef __KERNEL__ 332#ifdef __KERNEL__
326/* WARNING: You MAY NOT add syscall numbers larger than 302, since
327 * all of the syscall tables in the Sparc kernel are
328 * sized to have 302 entries (starting at zero). Therefore
329 * find a free slot in the 0-302 range.
330 */
331
332#define __ARCH_WANT_IPC_PARSE_VERSION 333#define __ARCH_WANT_IPC_PARSE_VERSION
333#define __ARCH_WANT_OLD_READDIR 334#define __ARCH_WANT_OLD_READDIR
334#define __ARCH_WANT_STAT64 335#define __ARCH_WANT_STAT64
@@ -345,7 +346,6 @@
345#define __ARCH_WANT_SYS_GETPGRP 346#define __ARCH_WANT_SYS_GETPGRP
346#define __ARCH_WANT_SYS_LLSEEK 347#define __ARCH_WANT_SYS_LLSEEK
347#define __ARCH_WANT_SYS_NICE 348#define __ARCH_WANT_SYS_NICE
348#define __ARCH_WANT_SYS_OLD_GETRLIMIT
349#define __ARCH_WANT_SYS_OLDUMOUNT 349#define __ARCH_WANT_SYS_OLDUMOUNT
350#define __ARCH_WANT_SYS_SIGPENDING 350#define __ARCH_WANT_SYS_SIGPENDING
351#define __ARCH_WANT_SYS_SIGPROCMASK 351#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index 35cb5c9e0c92..eb3b8e90b279 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -86,7 +86,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
86 unsigned int r_address; /* relocation addr */ 86 unsigned int r_address; /* relocation addr */
87 unsigned int r_index:24; /* segment index or symbol index */ 87 unsigned int r_index:24; /* segment index or symbol index */
88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
89 int r_pad:2; /* <unused> */ 89 unsigned int r_pad:2; /* <unused> */
90 enum reloc_type r_type:5; /* type of relocation to perform */ 90 enum reloc_type r_type:5; /* type of relocation to perform */
91 int r_addend; /* addend for relocation value */ 91 int r_addend; /* addend for relocation value */
92}; 92};
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index f2cc9411b4c7..e89922d6718c 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -17,8 +17,8 @@
17typedef struct { 17typedef struct {
18 /* Dcache line 1 */ 18 /* Dcache line 1 */
19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ 19 unsigned int __softirq_pending; /* must be 1st, see rtrap.S */
20 unsigned int multiplier; 20 unsigned int __pad0_1;
21 unsigned int counter; 21 unsigned int __pad0_2;
22 unsigned int __pad1; 22 unsigned int __pad1;
23 unsigned long clock_tick; /* %tick's per second */ 23 unsigned long clock_tick; /* %tick's per second */
24 unsigned long udelay_val; 24 unsigned long udelay_val;
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
index d8f9872b0e2d..d5a4559b9555 100644
--- a/include/asm-sparc64/device.h
+++ b/include/asm-sparc64/device.h
@@ -3,5 +3,21 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef _ASM_SPARC64_DEVICE_H
7#define _ASM_SPARC64_DEVICE_H
7 8
9struct device_node;
10struct of_device;
11
12struct dev_archdata {
13 void *iommu;
14 void *stc;
15 void *host_controller;
16
17 struct device_node *prom_node;
18 struct of_device *op;
19
20 unsigned int msi_num;
21};
22
23#endif /* _ASM_SPARC64_DEVICE_H */
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
index 93e5a062df88..a9fd06183972 100644
--- a/include/asm-sparc64/dma.h
+++ b/include/asm-sparc64/dma.h
@@ -15,17 +15,6 @@
15#include <asm/delay.h> 15#include <asm/delay.h>
16#include <asm/oplib.h> 16#include <asm/oplib.h>
17 17
18extern spinlock_t dma_spin_lock;
19
20#define claim_dma_lock() \
21({ unsigned long flags; \
22 spin_lock_irqsave(&dma_spin_lock, flags); \
23 flags; \
24})
25
26#define release_dma_lock(__flags) \
27 spin_unlock_irqrestore(&dma_spin_lock, __flags);
28
29/* These are irrelevant for Sparc DMA, but we leave it in so that 18/* These are irrelevant for Sparc DMA, but we leave it in so that
30 * things can compile. 19 * things can compile.
31 */ 20 */
@@ -205,10 +194,6 @@ do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
205#define for_each_dvma(dma) \ 194#define for_each_dvma(dma) \
206 for((dma) = dma_chain; (dma); (dma) = (dma)->next) 195 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
207 196
208extern int get_dma_list(char *);
209extern int request_dma(unsigned int, __const__ char *);
210extern void free_dma(unsigned int);
211
212/* From PCI */ 197/* From PCI */
213 198
214#ifdef CONFIG_PCI 199#ifdef CONFIG_PCI
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index a4afe9d5703a..9c1c6db2a790 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -8,7 +8,6 @@
8#ifndef __SPARC64_EBUS_H 8#ifndef __SPARC64_EBUS_H
9#define __SPARC64_EBUS_H 9#define __SPARC64_EBUS_H
10 10
11#include <asm/pbm.h>
12#include <asm/oplib.h> 11#include <asm/oplib.h>
13#include <asm/prom.h> 12#include <asm/prom.h>
14#include <asm/of_device.h> 13#include <asm/of_device.h>
@@ -41,7 +40,6 @@ struct linux_ebus {
41 struct of_device ofdev; 40 struct of_device ofdev;
42 struct linux_ebus *next; 41 struct linux_ebus *next;
43 struct linux_ebus_device *devices; 42 struct linux_ebus_device *devices;
44 struct pci_pbm_info *parent;
45 struct pci_dev *self; 43 struct pci_dev *self;
46 int index; 44 int index;
47 int is_rio; 45 int is_rio;
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index dbe033e494db..4aa0925e1b1b 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -549,7 +549,7 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
549 if (!strcmp(edev->prom_node->name, "fdthree")) 549 if (!strcmp(edev->prom_node->name, "fdthree"))
550 return 1; 550 return 1;
551 if (!strcmp(edev->prom_node->name, "floppy")) { 551 if (!strcmp(edev->prom_node->name, "floppy")) {
552 char *compat; 552 const char *compat;
553 553
554 compat = of_get_property(edev->prom_node, 554 compat = of_get_property(edev->prom_node,
555 "compatible", NULL); 555 "compatible", NULL);
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 struct linux_ebus_device *edev = NULL; 661 struct linux_ebus_device *edev = NULL;
662 unsigned long config = 0; 662 unsigned long config = 0;
663 void __iomem *auxio_reg; 663 void __iomem *auxio_reg;
664 char *state_prop; 664 const char *state_prop;
665 665
666 for_each_ebus(ebus) { 666 for_each_ebus(ebus) {
667 for_each_ebusdev(edev, ebus) { 667 for_each_ebusdev(edev, ebus) {
@@ -854,4 +854,15 @@ static unsigned long __init sun_floppy_init(void)
854 854
855#define EXTRA_FLOPPY_PARAMS 855#define EXTRA_FLOPPY_PARAMS
856 856
857static DEFINE_SPINLOCK(dma_spin_lock);
858
859#define claim_dma_lock() \
860({ unsigned long flags; \
861 spin_lock_irqsave(&dma_spin_lock, flags); \
862 flags; \
863})
864
865#define release_dma_lock(__flags) \
866 spin_unlock_irqrestore(&dma_spin_lock, __flags);
867
857#endif /* !(__ASM_SPARC64_FLOPPY_H) */ 868#endif /* !(__ASM_SPARC64_FLOPPY_H) */
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 30b912d8e8bc..ad595b679842 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -24,14 +24,6 @@ extern unsigned long kern_base, kern_size;
24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 24#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
25#define BIO_VMERGE_BOUNDARY 8192 25#define BIO_VMERGE_BOUNDARY 8192
26 26
27/* Different PCI controllers we support have their PCI MEM space
28 * mapped to an either 2GB (Psycho) or 4GB (Sabre) aligned area,
29 * so need to chop off the top 33 or 32 bits.
30 */
31extern unsigned long pci_memspace_mask;
32
33#define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask)
34
35static __inline__ u8 _inb(unsigned long addr) 27static __inline__ u8 _inb(unsigned long addr)
36{ 28{
37 u8 ret; 29 u8 ret;
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index 0de7a3da79cd..e199594a1e9b 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -7,15 +7,50 @@
7#define _SPARC64_IOMMU_H 7#define _SPARC64_IOMMU_H
8 8
9/* The format of an iopte in the page tables. */ 9/* The format of an iopte in the page tables. */
10#define IOPTE_VALID 0x8000000000000000UL /* IOPTE is valid */ 10#define IOPTE_VALID 0x8000000000000000UL
11#define IOPTE_64K 0x2000000000000000UL /* IOPTE is for 64k page */ 11#define IOPTE_64K 0x2000000000000000UL
12#define IOPTE_STBUF 0x1000000000000000UL /* DVMA can use streaming buffer */ 12#define IOPTE_STBUF 0x1000000000000000UL
13#define IOPTE_INTRA 0x0800000000000000UL /* SBUS slot-->slot direct transfer*/ 13#define IOPTE_INTRA 0x0800000000000000UL
14#define IOPTE_CONTEXT 0x07ff800000000000UL /* Context number */ 14#define IOPTE_CONTEXT 0x07ff800000000000UL
15#define IOPTE_PAGE 0x00007fffffffe000UL /* Physical page number (PA[42:13])*/ 15#define IOPTE_PAGE 0x00007fffffffe000UL
16#define IOPTE_CACHE 0x0000000000000010UL /* Cached (in UPA E-cache) */ 16#define IOPTE_CACHE 0x0000000000000010UL
17#define IOPTE_WRITE 0x0000000000000002UL /* Writeable */ 17#define IOPTE_WRITE 0x0000000000000002UL
18 18
19#define IOMMU_NUM_CTXS 4096 19#define IOMMU_NUM_CTXS 4096
20 20
21struct iommu_arena {
22 unsigned long *map;
23 unsigned int hint;
24 unsigned int limit;
25};
26
27struct iommu {
28 spinlock_t lock;
29 struct iommu_arena arena;
30 iopte_t *page_table;
31 u32 page_table_map_base;
32 unsigned long iommu_control;
33 unsigned long iommu_tsbbase;
34 unsigned long iommu_flush;
35 unsigned long iommu_ctxflush;
36 unsigned long write_complete_reg;
37 unsigned long dummy_page;
38 unsigned long dummy_page_pa;
39 unsigned long ctx_lowest_free;
40 DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS);
41 u32 dma_addr_mask;
42};
43
44struct strbuf {
45 int strbuf_enabled;
46 unsigned long strbuf_control;
47 unsigned long strbuf_pflush;
48 unsigned long strbuf_fsync;
49 unsigned long strbuf_ctxflush;
50 unsigned long strbuf_ctxmatch_base;
51 unsigned long strbuf_flushflag_pa;
52 volatile unsigned long *strbuf_flushflag;
53 volatile unsigned long __flushflag_buf[(64+(64-1)) / sizeof(long)];
54};
55
21#endif /* !(_SPARC_IOMMU_H) */ 56#endif /* !(_SPARC_IOMMU_H) */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index 905e59b4a737..5d233b42fe13 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -46,6 +46,10 @@ extern void irq_install_pre_handler(int virt_irq,
46#define irq_canonicalize(irq) (irq) 46#define irq_canonicalize(irq) (irq)
47extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap); 47extern unsigned int build_irq(int inofixup, unsigned long iclr, unsigned long imap);
48extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino); 48extern unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino);
49extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
50 unsigned int msi_devino_start,
51 unsigned int msi_devino_end);
52extern void sun4v_destroy_msi(unsigned int virt_irq);
49extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 53extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
50 54
51static __inline__ void set_softint(unsigned long bits) 55static __inline__ void set_softint(unsigned long bits)
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index d9728b9031fc..ecd9290f78d4 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -7,7 +7,6 @@
7#ifndef __SPARC64_ISA_H 7#ifndef __SPARC64_ISA_H
8#define __SPARC64_ISA_H 8#define __SPARC64_ISA_H
9 9
10#include <asm/pbm.h>
11#include <asm/oplib.h> 10#include <asm/oplib.h>
12#include <asm/prom.h> 11#include <asm/prom.h>
13#include <asm/of_device.h> 12#include <asm/of_device.h>
@@ -29,7 +28,6 @@ struct sparc_isa_bridge {
29 struct of_device ofdev; 28 struct of_device ofdev;
30 struct sparc_isa_bridge *next; 29 struct sparc_isa_bridge *next;
31 struct sparc_isa_device *devices; 30 struct sparc_isa_device *devices;
32 struct pci_pbm_info *parent;
33 struct pci_dev *self; 31 struct pci_dev *self;
34 int index; 32 int index;
35 struct device_node *prom_node; 33 struct device_node *prom_node;
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
index 09b5aba6678a..d14dd8988161 100644
--- a/include/asm-sparc64/mostek.h
+++ b/include/asm-sparc64/mostek.h
@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs;
89#define MSTK_DOW_MASK 0x07 89#define MSTK_DOW_MASK 0x07
90#define MSTK_DOM_MASK 0x3f 90#define MSTK_DOM_MASK 0x3f
91#define MSTK_MONTH_MASK 0x1f 91#define MSTK_MONTH_MASK 0x1f
92#define MSTK_YEAR_MASK 0xff 92#define MSTK_YEAR_MASK 0xffU
93 93
94/* Binary coded decimal conversion macros. */ 94/* Binary coded decimal conversion macros. */
95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index d3895873e4c7..6340a5253a34 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -19,12 +19,45 @@
19 */ 19 */
20#define HAS_DMA 20#define HAS_DMA
21 21
22static DEFINE_SPINLOCK(dma_spin_lock);
23
24#define claim_dma_lock() \
25({ unsigned long flags; \
26 spin_lock_irqsave(&dma_spin_lock, flags); \
27 flags; \
28})
29
30#define release_dma_lock(__flags) \
31 spin_unlock_irqrestore(&dma_spin_lock, __flags);
32
22static struct sparc_ebus_info { 33static struct sparc_ebus_info {
23 struct ebus_dma_info info; 34 struct ebus_dma_info info;
24 unsigned int addr; 35 unsigned int addr;
25 unsigned int count; 36 unsigned int count;
37 int lock;
26} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 38} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
27 39
40static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
41{
42 if (dmanr >= PARPORT_PC_MAX_PORTS)
43 return -EINVAL;
44 if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
45 return -EBUSY;
46 return 0;
47}
48
49static __inline__ void free_dma(unsigned int dmanr)
50{
51 if (dmanr >= PARPORT_PC_MAX_PORTS) {
52 printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
53 return;
54 }
55 if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
56 printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
57 return;
58 }
59}
60
28static __inline__ void enable_dma(unsigned int dmanr) 61static __inline__ void enable_dma(unsigned int dmanr)
29{ 62{
30 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); 63 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
@@ -70,7 +103,7 @@ static int ebus_ecpp_p(struct linux_ebus_device *edev)
70 if (!strcmp(edev->prom_node->name, "ecpp")) 103 if (!strcmp(edev->prom_node->name, "ecpp"))
71 return 1; 104 return 1;
72 if (!strcmp(edev->prom_node->name, "parallel")) { 105 if (!strcmp(edev->prom_node->name, "parallel")) {
73 char *compat; 106 const char *compat;
74 107
75 compat = of_get_property(edev->prom_node, 108 compat = of_get_property(edev->prom_node,
76 "compatible", NULL); 109 "compatible", NULL);
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index dcfa7629358c..c008cecca149 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -1,7 +1,6 @@
1/* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ 1/* pbm.h: UltraSparc PCI controller software state.
2 * pbm.h: UltraSparc PCI controller software state.
3 * 2 *
4 * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef __SPARC64_PBM_H 6#ifndef __SPARC64_PBM_H
@@ -11,6 +10,7 @@
11#include <linux/pci.h> 10#include <linux/pci.h>
12#include <linux/ioport.h> 11#include <linux/ioport.h>
13#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/msi.h>
14 14
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/page.h> 16#include <asm/page.h>
@@ -29,90 +29,7 @@
29 * PCI bus. 29 * PCI bus.
30 */ 30 */
31 31
32struct pci_controller_info; 32extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
33
34/* This contains the software state necessary to drive a PCI
35 * controller's IOMMU.
36 */
37struct pci_iommu_arena {
38 unsigned long *map;
39 unsigned int hint;
40 unsigned int limit;
41};
42
43struct pci_iommu {
44 /* This protects the controller's IOMMU and all
45 * streaming buffers underneath.
46 */
47 spinlock_t lock;
48
49 struct pci_iommu_arena arena;
50
51 /* IOMMU page table, a linear array of ioptes. */
52 iopte_t *page_table; /* The page table itself. */
53
54 /* Base PCI memory space address where IOMMU mappings
55 * begin.
56 */
57 u32 page_table_map_base;
58
59 /* IOMMU Controller Registers */
60 unsigned long iommu_control; /* IOMMU control register */
61 unsigned long iommu_tsbbase; /* IOMMU page table base register */
62 unsigned long iommu_flush; /* IOMMU page flush register */
63 unsigned long iommu_ctxflush; /* IOMMU context flush register */
64
65 /* This is a register in the PCI controller, which if
66 * read will have no side-effects but will guarantee
67 * completion of all previous writes into IOMMU/STC.
68 */
69 unsigned long write_complete_reg;
70
71 /* In order to deal with some buggy third-party PCI bridges that
72 * do wrong prefetching, we never mark valid mappings as invalid.
73 * Instead we point them at this dummy page.
74 */
75 unsigned long dummy_page;
76 unsigned long dummy_page_pa;
77
78 /* CTX allocation. */
79 unsigned long ctx_lowest_free;
80 unsigned long ctx_bitmap[IOMMU_NUM_CTXS / (sizeof(unsigned long) * 8)];
81
82 /* Here a PCI controller driver describes the areas of
83 * PCI memory space where DMA to/from physical memory
84 * are addressed. Drivers interrogate the PCI layer
85 * if their device has addressing limitations. They
86 * do so via pci_dma_supported, and pass in a mask of
87 * DMA address bits their device can actually drive.
88 *
89 * The test for being usable is:
90 * (device_mask & dma_addr_mask) == dma_addr_mask
91 */
92 u32 dma_addr_mask;
93};
94
95extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
96
97/* This describes a PCI bus module's streaming buffer. */
98struct pci_strbuf {
99 int strbuf_enabled; /* Present and using it? */
100
101 /* Streaming Buffer Control Registers */
102 unsigned long strbuf_control; /* STC control register */
103 unsigned long strbuf_pflush; /* STC page flush register */
104 unsigned long strbuf_fsync; /* STC flush synchronization reg */
105 unsigned long strbuf_ctxflush; /* STC context flush register */
106 unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */
107 unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */
108 volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
109
110 /* And this is the actual flush flag area.
111 * We allocate extra because the chips require
112 * a 64-byte aligned area.
113 */
114 volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
115};
116 33
117#define PCI_STC_FLUSHFLAG_INIT(STC) \ 34#define PCI_STC_FLUSHFLAG_INIT(STC) \
118 (*((STC)->strbuf_flushflag) = 0UL) 35 (*((STC)->strbuf_flushflag) = 0UL)
@@ -125,6 +42,8 @@ struct pci_strbuf {
125#define PROM_PCIRNG_MAX 64 42#define PROM_PCIRNG_MAX 64
126#define PROM_PCIIMAP_MAX 64 43#define PROM_PCIIMAP_MAX 64
127 44
45struct pci_controller_info;
46
128struct pci_pbm_info { 47struct pci_pbm_info {
129 /* PCI controller we sit under. */ 48 /* PCI controller we sit under. */
130 struct pci_controller_info *parent; 49 struct pci_controller_info *parent;
@@ -159,11 +78,6 @@ struct pci_pbm_info {
159 78
160 /* OBP specific information. */ 79 /* OBP specific information. */
161 struct device_node *prom_node; 80 struct device_node *prom_node;
162 struct linux_prom_pci_ranges *pbm_ranges;
163 int num_pbm_ranges;
164 struct linux_prom_pci_intmap *pbm_intmap;
165 int num_pbm_intmap;
166 struct linux_prom_pci_intmask *pbm_intmask;
167 u64 ino_bitmap; 81 u64 ino_bitmap;
168 82
169 /* PBM I/O and Memory space resources. */ 83 /* PBM I/O and Memory space resources. */
@@ -177,14 +91,29 @@ struct pci_pbm_info {
177 int is_66mhz_capable; 91 int is_66mhz_capable;
178 int all_devs_66mhz; 92 int all_devs_66mhz;
179 93
94#ifdef CONFIG_PCI_MSI
95 /* MSI info. */
96 u32 msiq_num;
97 u32 msiq_ent_count;
98 u32 msiq_first;
99 u32 msiq_first_devino;
100 u32 msi_num;
101 u32 msi_first;
102 u32 msi_data_mask;
103 u32 msix_data_width;
104 u64 msi32_start;
105 u64 msi64_start;
106 u32 msi32_len;
107 u32 msi64_len;
108 void *msi_queues;
109 unsigned long *msi_bitmap;
110#endif /* !(CONFIG_PCI_MSI) */
111
180 /* This PBM's streaming buffer. */ 112 /* This PBM's streaming buffer. */
181 struct pci_strbuf stc; 113 struct strbuf stc;
182 114
183 /* IOMMU state, potentially shared by both PBM segments. */ 115 /* IOMMU state, potentially shared by both PBM segments. */
184 struct pci_iommu *iommu; 116 struct iommu *iommu;
185
186 /* PCI slot mapping. */
187 unsigned int pci_first_slot;
188 117
189 /* Now things for the actual PCI bus probes. */ 118 /* Now things for the actual PCI bus probes. */
190 unsigned int pci_first_busno; 119 unsigned int pci_first_busno;
@@ -201,17 +130,18 @@ struct pci_controller_info {
201 */ 130 */
202 int index; 131 int index;
203 132
204 /* Do the PBMs both exist in the same PCI domain? */
205 int pbms_same_domain;
206
207 /* The PCI bus modules controlled by us. */ 133 /* The PCI bus modules controlled by us. */
208 struct pci_pbm_info pbm_A; 134 struct pci_pbm_info pbm_A;
209 struct pci_pbm_info pbm_B; 135 struct pci_pbm_info pbm_B;
210 136
211 /* Operations which are controller specific. */ 137 /* Operations which are controller specific. */
212 void (*scan_bus)(struct pci_controller_info *); 138 void (*scan_bus)(struct pci_controller_info *);
213 void (*base_address_update)(struct pci_dev *, int); 139
214 void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *); 140#ifdef CONFIG_PCI_MSI
141 int (*setup_msi_irq)(unsigned int *virt_irq_p, struct pci_dev *pdev,
142 struct msi_desc *entry);
143 void (*teardown_msi_irq)(unsigned int virt_irq, struct pci_dev *pdev);
144#endif
215 145
216 /* Now things for the actual PCI bus probes. */ 146 /* Now things for the actual PCI bus probes. */
217 struct pci_ops *pci_ops; 147 struct pci_ops *pci_ops;
@@ -219,24 +149,4 @@ struct pci_controller_info {
219 unsigned int pci_last_busno; 149 unsigned int pci_last_busno;
220}; 150};
221 151
222/* PCI devices which are not bridges have this placed in their pci_dev
223 * sysdata member. This makes OBP aware PCI device drivers easier to
224 * code.
225 */
226struct pcidev_cookie {
227 struct pci_pbm_info *pbm;
228 struct device_node *prom_node;
229 struct of_device *op;
230 struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
231 int num_prom_regs;
232 struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
233 int num_prom_assignments;
234};
235
236/* Currently these are the same across all PCI controllers
237 * we support. Someday they may not be...
238 */
239#define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */
240#define PCI_IRQ_INO 0x0000003f /* Interrupt Number */
241
242#endif /* !(__SPARC64_PBM_H) */ 152#endif /* !(__SPARC64_PBM_H) */
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index ca6560288ae8..47cea16e1bad 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -54,7 +54,7 @@ struct pci_iommu_ops {
54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int); 54 void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int);
55}; 55};
56 56
57extern struct pci_iommu_ops *pci_iommu_ops; 57extern const struct pci_iommu_ops *pci_iommu_ops;
58 58
59/* Allocate and map kernel buffer using consistent mode DMA for a device. 59/* Allocate and map kernel buffer using consistent mode DMA for a device.
60 * hwdev should be valid struct pci_dev pointer for PCI devices. 60 * hwdev should be valid struct pci_dev pointer for PCI devices.
@@ -312,6 +312,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
312 return PCI_IRQ_NONE; 312 return PCI_IRQ_NONE;
313} 313}
314 314
315struct device_node;
316extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
317
315#endif /* __KERNEL__ */ 318#endif /* __KERNEL__ */
316 319
317#endif /* __SPARC64_PCI_H */ 320#endif /* __SPARC64_PCI_H */
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index b12be7a869f6..46705ef47d27 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -737,20 +737,6 @@ extern unsigned long pte_file(pte_t);
737extern pte_t pgoff_to_pte(unsigned long); 737extern pte_t pgoff_to_pte(unsigned long);
738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL) 738#define PTE_FILE_MAX_BITS (64UL - PAGE_SHIFT - 1UL)
739 739
740extern unsigned long prom_virt_to_phys(unsigned long, int *);
741
742extern unsigned long sun4u_get_pte(unsigned long);
743
744static inline unsigned long __get_phys(unsigned long addr)
745{
746 return sun4u_get_pte(addr);
747}
748
749static inline int __get_iospace(unsigned long addr)
750{
751 return ((sun4u_get_pte(addr) & 0xf0000000) >> 28);
752}
753
754extern unsigned long *sparc64_valid_addr_bitmap; 740extern unsigned long *sparc64_valid_addr_bitmap;
755 741
756/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 742/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
@@ -791,6 +777,8 @@ extern void pgtable_cache_init(void);
791extern void sun4v_register_fault_status(void); 777extern void sun4v_register_fault_status(void);
792extern void sun4v_ktsb_register(void); 778extern void sun4v_ktsb_register(void);
793 779
780extern unsigned long cmdline_memory_size;
781
794#endif /* !(__ASSEMBLY__) */ 782#endif /* !(__ASSEMBLY__) */
795 783
796#endif /* !(_SPARC64_PGTABLE_H) */ 784#endif /* !(_SPARC64_PGTABLE_H) */
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 99671ed6625d..ddad5f99ac7f 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -36,8 +36,8 @@ struct property {
36 36
37struct of_irq_controller; 37struct of_irq_controller;
38struct device_node { 38struct device_node {
39 char *name; 39 const char *name;
40 char *type; 40 const char *type;
41 phandle node; 41 phandle node;
42 char *path_component_name; 42 char *path_component_name;
43 char *full_name; 43 char *full_name;
@@ -93,12 +93,15 @@ extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_get_parent(const struct device_node *node); 93extern struct device_node *of_get_parent(const struct device_node *node);
94extern struct device_node *of_get_next_child(const struct device_node *node, 94extern struct device_node *of_get_next_child(const struct device_node *node,
95 struct device_node *prev); 95 struct device_node *prev);
96extern struct property *of_find_property(struct device_node *np, 96extern struct property *of_find_property(const struct device_node *np,
97 const char *name, 97 const char *name,
98 int *lenp); 98 int *lenp);
99extern int of_device_is_compatible(struct device_node *device, const char *); 99extern int of_device_is_compatible(const struct device_node *device,
100extern void *of_get_property(struct device_node *node, const char *name, 100 const char *);
101extern const void *of_get_property(const struct device_node *node,
102 const char *name,
101 int *lenp); 103 int *lenp);
104#define get_property(node,name,lenp) of_get_property(node,name,lenp)
102extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 105extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
103extern int of_getintprop_default(struct device_node *np, 106extern int of_getintprop_default(struct device_node *np,
104 const char *name, 107 const char *name,
diff --git a/include/asm-sparc64/setup.h b/include/asm-sparc64/setup.h
index b356ee2cda92..5053df3cec40 100644
--- a/include/asm-sparc64/setup.h
+++ b/include/asm-sparc64/setup.h
@@ -5,6 +5,6 @@
5#ifndef _SPARC64_SETUP_H 5#ifndef _SPARC64_SETUP_H
6#define _SPARC64_SETUP_H 6#define _SPARC64_SETUP_H
7 7
8#define COMMAND_LINE_SIZE 256 8#define COMMAND_LINE_SIZE 2048
9 9
10#endif /* _SPARC64_SETUP_H */ 10#endif /* _SPARC64_SETUP_H */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 388249b751c3..cca54804b722 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -42,15 +42,15 @@ extern int hard_smp_processor_id(void);
42#define raw_smp_processor_id() (current_thread_info()->cpu) 42#define raw_smp_processor_id() (current_thread_info()->cpu)
43 43
44extern void smp_setup_cpu_possible_map(void); 44extern void smp_setup_cpu_possible_map(void);
45extern unsigned char boot_cpu_id;
45 46
46#endif /* !(__ASSEMBLY__) */ 47#endif /* !(__ASSEMBLY__) */
47 48
48#else 49#else
49 50
50#define smp_setup_cpu_possible_map() do { } while (0) 51#define smp_setup_cpu_possible_map() do { } while (0)
52#define boot_cpu_id (0)
51 53
52#endif /* !(CONFIG_SMP) */ 54#endif /* !(CONFIG_SMP) */
53 55
54#define NO_PROC_ID 0xFF
55
56#endif /* !(_SPARC64_SMP_H) */ 56#endif /* !(_SPARC64_SMP_H) */
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 754d46a50af3..986441dcb8f0 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -49,6 +49,8 @@
49 49
50#define SO_PEERSEC 0x001e 50#define SO_PEERSEC 0x001e
51#define SO_PASSSEC 0x001f 51#define SO_PASSSEC 0x001f
52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53/* Security levels - as per NRL IPv6 - don't actually do anything */ 55/* Security levels - as per NRL IPv6 - don't actually do anything */
54#define SO_SECURITY_AUTHENTICATION 0x5001 56#define SO_SECURITY_AUTHENTICATION 0x5001
diff --git a/include/asm-sparc64/sockios.h b/include/asm-sparc64/sockios.h
index 6735bab4f39d..c7d9900638d0 100644
--- a/include/asm-sparc64/sockios.h
+++ b/include/asm-sparc64/sockios.h
@@ -7,7 +7,8 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* !(_ASM_SPARC64_SOCKIOS_H) */ 13#endif /* !(_ASM_SPARC64_SOCKIOS_H) */
13 14
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h
index ed5c9d8541e2..77bcd2bfa53c 100644
--- a/include/asm-sparc64/sparsemem.h
+++ b/include/asm-sparc64/sparsemem.h
@@ -3,7 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#define SECTION_SIZE_BITS 26 6#define SECTION_SIZE_BITS 31
7#define MAX_PHYSADDR_BITS 42 7#define MAX_PHYSADDR_BITS 42
8#define MAX_PHYSMEM_BITS 42 8#define MAX_PHYSMEM_BITS 42
9 9
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index ee26a071c677..f05d390993d5 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -45,24 +45,6 @@ struct winsize {
45 unsigned short ws_ypixel; 45 unsigned short ws_ypixel;
46}; 46};
47 47
48/* line disciplines */
49#define N_TTY 0
50#define N_SLIP 1
51#define N_MOUSE 2
52#define N_PPP 3
53#define N_STRIP 4
54#define N_AX25 5
55#define N_X25 6
56#define N_6PACK 7
57#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
58#define N_R3964 9 /* Reserved for Simatic R3964 module */
59#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
60#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
61#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
62#define N_HDLC 13 /* synchronous HDLC */
63#define N_SYNC_PPP 14 /* synchronous PPP */
64#define N_HCI 15 /* Bluetooth HCI UART */
65
66#ifdef __KERNEL__ 48#ifdef __KERNEL__
67#include <linux/module.h> 49#include <linux/module.h>
68 50
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h
index d435594df786..ccbd69448866 100644
--- a/include/asm-sparc64/timer.h
+++ b/include/asm-sparc64/timer.h
@@ -11,22 +11,19 @@
11 11
12 12
13struct sparc64_tick_ops { 13struct sparc64_tick_ops {
14 void (*init_tick)(unsigned long);
15 unsigned long (*get_tick)(void); 14 unsigned long (*get_tick)(void);
16 unsigned long (*get_compare)(void); 15 int (*add_compare)(unsigned long);
17 unsigned long (*add_tick)(unsigned long, unsigned long);
18 unsigned long (*add_compare)(unsigned long);
19 unsigned long softint_mask; 16 unsigned long softint_mask;
17 void (*disable_irq)(void);
18
19 void (*init_tick)(void);
20 unsigned long (*add_tick)(unsigned long);
21
22 char *name;
20}; 23};
21 24
22extern struct sparc64_tick_ops *tick_ops; 25extern struct sparc64_tick_ops *tick_ops;
23 26
24#ifdef CONFIG_SMP
25extern unsigned long timer_tick_offset;
26struct pt_regs;
27extern void timer_tick_interrupt(struct pt_regs *);
28#endif
29
30extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 27extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
31 28
32#endif /* _SPARC64_TIMER_H */ 29#endif /* _SPARC64_TIMER_H */
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h
index e82612cd9f33..ab55ffcb7bf4 100644
--- a/include/asm-sparc64/tsb.h
+++ b/include/asm-sparc64/tsb.h
@@ -264,6 +264,7 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
264 be,a,pt %xcc, OK_LABEL; \ 264 be,a,pt %xcc, OK_LABEL; \
265 mov REG4, REG1; 265 mov REG4, REG1;
266 266
267#ifndef CONFIG_DEBUG_PAGEALLOC
267 /* This version uses a trick, the TAG is already (VADDR >> 22) so 268 /* This version uses a trick, the TAG is already (VADDR >> 22) so
268 * we can make use of that for the index computation. 269 * we can make use of that for the index computation.
269 */ 270 */
@@ -277,5 +278,6 @@ extern struct tsb_phys_patch_entry __tsb_phys_patch, __tsb_phys_patch_end;
277 cmp REG3, TAG; \ 278 cmp REG3, TAG; \
278 be,a,pt %xcc, OK_LABEL; \ 279 be,a,pt %xcc, OK_LABEL; \
279 mov REG4, REG1; 280 mov REG4, REG1;
281#endif
280 282
281#endif /* !(_SPARC64_TSB_H) */ 283#endif /* !(_SPARC64_TSB_H) */
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index c2a16e188499..bbb9c8f13d61 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -157,23 +157,6 @@
157 ba,a,pt %xcc, rtrap_irq; \ 157 ba,a,pt %xcc, rtrap_irq; \
158 .previous; 158 .previous;
159 159
160#define TICK_SMP_IRQ \
161 rdpr %pil, %g2; \
162 wrpr %g0, 15, %pil; \
163 sethi %hi(1f-4), %g7; \
164 ba,pt %xcc, etrap_irq; \
165 or %g7, %lo(1f-4), %g7; \
166 nop; \
167 nop; \
168 nop; \
169 .subsection 2; \
1701: call trace_hardirqs_off; \
171 nop; \
172 call smp_percpu_timer_interrupt; \
173 add %sp, PTREGS_OFF, %o0; \
174 ba,a,pt %xcc, rtrap_irq; \
175 .previous;
176
177#else 160#else
178 161
179#define TRAP_IRQ(routine, level) \ 162#define TRAP_IRQ(routine, level) \
@@ -186,16 +169,6 @@
186 add %sp, PTREGS_OFF, %o1; \ 169 add %sp, PTREGS_OFF, %o1; \
187 ba,a,pt %xcc, rtrap_irq; 170 ba,a,pt %xcc, rtrap_irq;
188 171
189#define TICK_SMP_IRQ \
190 rdpr %pil, %g2; \
191 wrpr %g0, 15, %pil; \
192 sethi %hi(109f), %g7; \
193 ba,pt %xcc, etrap_irq; \
194109: or %g7, %lo(109b), %g7; \
195 call smp_percpu_timer_interrupt; \
196 add %sp, PTREGS_OFF, %o0; \
197 ba,a,pt %xcc, rtrap_irq;
198
199#endif 172#endif
200 173
201#define TRAP_IVEC TRAP_NOSAVE(do_ivec) 174#define TRAP_IVEC TRAP_NOSAVE(do_ivec)
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 47047536f261..e2dcb87e0c62 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -321,17 +321,17 @@
321#define __NR_set_robust_list 300 321#define __NR_set_robust_list 300
322#define __NR_get_robust_list 301 322#define __NR_get_robust_list 301
323#define __NR_migrate_pages 302 323#define __NR_migrate_pages 302
324#define __NR_mbind 303
325#define __NR_get_mempolicy 304
326#define __NR_set_mempolicy 305
327#define __NR_kexec_load 306
328#define __NR_move_pages 307
329#define __NR_getcpu 308
330#define __NR_epoll_pwait 309
324 331
325#define NR_SYSCALLS 303 332#define NR_SYSCALLS 310
326 333
327#ifdef __KERNEL__ 334#ifdef __KERNEL__
328
329/* WARNING: You MAY NOT add syscall numbers larger than 302, since
330 * all of the syscall tables in the Sparc kernel are
331 * sized to have 302 entries (starting at zero). Therefore
332 * find a free slot in the 0-302 range.
333 */
334
335/* sysconf options, for SunOS compatibility */ 335/* sysconf options, for SunOS compatibility */
336#define _SC_ARG_MAX 1 336#define _SC_ARG_MAX 1
337#define _SC_CHILD_MAX 2 337#define _SC_CHILD_MAX 2
@@ -359,7 +359,6 @@
359#define __ARCH_WANT_SYS_GETPGRP 359#define __ARCH_WANT_SYS_GETPGRP
360#define __ARCH_WANT_SYS_LLSEEK 360#define __ARCH_WANT_SYS_LLSEEK
361#define __ARCH_WANT_SYS_NICE 361#define __ARCH_WANT_SYS_NICE
362#define __ARCH_WANT_SYS_OLD_GETRLIMIT
363#define __ARCH_WANT_SYS_OLDUMOUNT 362#define __ARCH_WANT_SYS_OLDUMOUNT
364#define __ARCH_WANT_SYS_SIGPENDING 363#define __ARCH_WANT_SYS_SIGPENDING
365#define __ARCH_WANT_SYS_SIGPROCMASK 364#define __ARCH_WANT_SYS_SIGPROCMASK
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S
index f0454516dd31..f5de80c31e88 100644
--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -15,6 +15,7 @@
15 PROVIDE (_unprotected_end = .); 15 PROVIDE (_unprotected_end = .);
16 16
17 . = ALIGN(4096); 17 . = ALIGN(4096);
18 .note : { *(.note.*) }
18 __start___ex_table = .; 19 __start___ex_table = .;
19 __ex_table : { *(__ex_table) } 20 __ex_table : { *(__ex_table) }
20 __stop___ex_table = .; 21 __stop___ex_table = .;
diff --git a/include/asm-um/delay.h b/include/asm-um/delay.h
index 0985bda66750..c71e32b6741e 100644
--- a/include/asm-um/delay.h
+++ b/include/asm-um/delay.h
@@ -1,9 +1,20 @@
1#ifndef __UM_DELAY_H 1#ifndef __UM_DELAY_H
2#define __UM_DELAY_H 2#define __UM_DELAY_H
3 3
4#include "asm/arch/delay.h"
5#include "asm/archparam.h"
6
7#define MILLION 1000000 4#define MILLION 1000000
8 5
6/* Undefined on purpose */
7extern void __bad_udelay(void);
8
9extern void __udelay(unsigned long usecs);
10extern void __delay(unsigned long loops);
11
12#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
13 __bad_udelay() : __udelay(n))
14
15/* It appears that ndelay is not used at all for UML, and has never been
16 * implemented. */
17extern void __unimplemented_ndelay(void);
18#define ndelay(n) __unimplemented_ndelay()
19
9#endif 20#endif
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h
index 1e17f7409cab..7b73b2cd5b34 100644
--- a/include/asm-um/div64.h
+++ b/include/asm-um/div64.h
@@ -3,4 +3,5 @@
3 3
4#include "asm/arch/div64.h" 4#include "asm/arch/div64.h"
5 5
6extern uint64_t div64_64(uint64_t dividend, uint64_t divisor);
6#endif 7#endif
diff --git a/include/asm-um/elf-ppc.h b/include/asm-um/elf-ppc.h
index 99711134e477..d3b90b7ac3e9 100644
--- a/include/asm-um/elf-ppc.h
+++ b/include/asm-um/elf-ppc.h
@@ -11,7 +11,7 @@ extern long elf_aux_hwcap;
11 11
12#define elf_check_arch(x) (1) 12#define elf_check_arch(x) (1)
13 13
14#ifdef CONFIG_64_BIT 14#ifdef CONFIG_64BIT
15#define ELF_CLASS ELFCLASS64 15#define ELF_CLASS ELFCLASS64
16#else 16#else
17#define ELF_CLASS ELFCLASS32 17#define ELF_CLASS ELFCLASS32
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index 6050e0eb257e..172a75fde512 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -45,12 +45,12 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
46 46
47/* 47/*
48 * Bits 0 through 3 are taken 48 * Bits 0 through 4 are taken
49 */ 49 */
50#define PTE_FILE_MAX_BITS 28 50#define PTE_FILE_MAX_BITS 27
51 51
52#define pte_to_pgoff(pte) (pte_val(pte) >> 4) 52#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
53 53
54#define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE }) 54#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
55 55
56#endif 56#endif
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 188f72621776..1b1090a91a58 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -270,7 +270,7 @@ static inline pte_t pte_wrprotect(pte_t pte)
270 270
271static inline pte_t pte_mkread(pte_t pte) 271static inline pte_t pte_mkread(pte_t pte)
272{ 272{
273 pte_set_bits(pte, _PAGE_RW); 273 pte_set_bits(pte, _PAGE_USER);
274 return(pte_mknewprot(pte)); 274 return(pte_mknewprot(pte));
275} 275}
276 276
@@ -408,6 +408,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
408 408
409#include <asm-generic/pgtable-nopud.h> 409#include <asm-generic/pgtable-nopud.h>
410 410
411#ifdef CONFIG_HIGHMEM
412/* Clear a kernel PTE and flush it from the TLB */
413#define kpte_clear_flush(ptep, vaddr) \
414do { \
415 pte_clear(&init_mm, vaddr, ptep); \
416 __flush_tlb_one(vaddr); \
417} while (0)
418#endif
419
411#endif 420#endif
412#endif 421#endif
413 422
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h
index 10609af376c0..31c2d4d685bd 100644
--- a/include/asm-um/processor-x86_64.h
+++ b/include/asm-um/processor-x86_64.h
@@ -13,6 +13,7 @@
13struct arch_thread { 13struct arch_thread {
14 unsigned long debugregs[8]; 14 unsigned long debugregs[8];
15 int debugregs_seq; 15 int debugregs_seq;
16 unsigned long fs;
16 struct faultinfo faultinfo; 17 struct faultinfo faultinfo;
17}; 18};
18 19
@@ -25,8 +26,9 @@ extern inline void rep_nop(void)
25#define cpu_relax() rep_nop() 26#define cpu_relax() rep_nop()
26 27
27#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ 28#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \
28 .debugregs_seq = 0, \ 29 .debugregs_seq = 0, \
29 .faultinfo = { 0, 0, 0 } } 30 .fs = 0, \
31 .faultinfo = { 0, 0, 0 } }
30 32
31static inline void arch_flush_thread(struct arch_thread *thread) 33static inline void arch_flush_thread(struct arch_thread *thread)
32{ 34{
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h
index 03b4af4ac09a..bf61d17de3f7 100644
--- a/include/asm-um/ptrace-x86_64.h
+++ b/include/asm-um/ptrace-x86_64.h
@@ -81,9 +81,10 @@ static inline void arch_switch_to_tt(struct task_struct *from,
81{ 81{
82} 82}
83 83
84static inline void arch_switch_to_skas(struct task_struct *from, 84extern void arch_switch_to_skas(struct task_struct *from,
85 struct task_struct *to) 85 struct task_struct *to);
86{ 86
87} 87extern long arch_prctl_skas(struct task_struct *task, int code,
88 unsigned long __user *addr);
88 89
89#endif 90#endif
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index 0dfe55ac2ef2..a4c2493b025f 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* __V850_SOCKET_H__ */ 55#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-v850/sockios.h b/include/asm-v850/sockios.h
index cf4874c2fd8a..823e106e6cd0 100644
--- a/include/asm-v850/sockios.h
+++ b/include/asm-v850/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif /* __V850_SOCKIOS_H__ */ 13#endif /* __V850_SOCKIOS_H__ */
diff --git a/include/asm-v850/termios.h b/include/asm-v850/termios.h
index 79e97b59806e..c2c2b1d58776 100644
--- a/include/asm-v850/termios.h
+++ b/include/asm-v850/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14 /* synchronous PPP */
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61 43
62/* intr=^C quit=^\ erase=del kill=^U 44/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h
index 6b6fc6f8be7e..a29f05087a31 100644
--- a/include/asm-x86_64/acpi.h
+++ b/include/asm-x86_64/acpi.h
@@ -37,7 +37,7 @@
37 * Calling conventions: 37 * Calling conventions:
38 * 38 *
39 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) 39 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
40 * ACPI_EXTERNAL_XFACE - External ACPI interfaces 40 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
41 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces 41 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
42 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces 42 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
43 */ 43 */
@@ -57,11 +57,11 @@
57int __acpi_acquire_global_lock(unsigned int *lock); 57int __acpi_acquire_global_lock(unsigned int *lock);
58int __acpi_release_global_lock(unsigned int *lock); 58int __acpi_release_global_lock(unsigned int *lock);
59 59
60#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ 60#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
61 ((Acq) = __acpi_acquire_global_lock((unsigned int *) GLptr)) 61 ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
62 62
63#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ 63#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
64 ((Acq) = __acpi_release_global_lock((unsigned int *) GLptr)) 64 ((Acq) = __acpi_release_global_lock(&facs->global_lock))
65 65
66/* 66/*
67 * Math helper asm macros 67 * Math helper asm macros
@@ -87,10 +87,10 @@ extern int acpi_strict;
87extern int acpi_disabled; 87extern int acpi_disabled;
88extern int acpi_pci_disabled; 88extern int acpi_pci_disabled;
89extern int acpi_ht; 89extern int acpi_ht;
90static inline void disable_acpi(void) 90static inline void disable_acpi(void)
91{ 91{
92 acpi_disabled = 1; 92 acpi_disabled = 1;
93 acpi_ht = 0; 93 acpi_ht = 0;
94 acpi_pci_disabled = 1; 94 acpi_pci_disabled = 1;
95 acpi_noirq = 1; 95 acpi_noirq = 1;
96} 96}
@@ -100,9 +100,9 @@ static inline void disable_acpi(void)
100 100
101extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); 101extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
102static inline void acpi_noirq_set(void) { acpi_noirq = 1; } 102static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
103static inline void acpi_disable_pci(void) 103static inline void acpi_disable_pci(void)
104{ 104{
105 acpi_pci_disabled = 1; 105 acpi_pci_disabled = 1;
106 acpi_noirq_set(); 106 acpi_noirq_set();
107} 107}
108extern int acpi_irq_balance_set(char *str); 108extern int acpi_irq_balance_set(char *str);
@@ -136,8 +136,6 @@ extern void acpi_reserve_bootmem(void);
136extern int acpi_disabled; 136extern int acpi_disabled;
137extern int acpi_pci_disabled; 137extern int acpi_pci_disabled;
138 138
139extern u8 x86_acpiid_to_apicid[];
140
141#define ARCH_HAS_POWER_INIT 1 139#define ARCH_HAS_POWER_INIT 1
142 140
143extern int acpi_skip_timer_override; 141extern int acpi_skip_timer_override;
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index e81d0f289f0b..7cfb39cbd918 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -102,5 +102,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
102#define ARCH_APICTIMER_STOPS_ON_C3 1 102#define ARCH_APICTIMER_STOPS_ON_C3 1
103 103
104extern unsigned boot_cpu_id; 104extern unsigned boot_cpu_id;
105extern int local_apic_timer_c2_ok;
105 106
106#endif /* __ASM_APIC_H */ 107#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 8da9609070f4..d4dbbe5f7bd9 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -7,7 +7,7 @@
7 7
8#include <asm/alternative.h> 8#include <asm/alternative.h>
9 9
10#if __GNUC__ < 4 || __GNUC_MINOR__ < 1 10#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
11/* Technically wrong, but this avoids compilation errors on some gcc 11/* Technically wrong, but this avoids compilation errors on some gcc
12 versions. */ 12 versions. */
13#define ADDR "=m" (*(volatile long *) addr) 13#define ADDR "=m" (*(volatile long *) addr)
diff --git a/include/asm-x86_64/bootsetup.h b/include/asm-x86_64/bootsetup.h
index b829f7b534be..7b1c3ad155fd 100644
--- a/include/asm-x86_64/bootsetup.h
+++ b/include/asm-x86_64/bootsetup.h
@@ -31,7 +31,7 @@ extern char x86_boot_params[BOOT_PARAM_SIZE];
31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF)) 31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) 32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) 33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
34#define COMMAND_LINE saved_command_line 34#define COMMAND_LINE boot_command_line
35 35
36#define RAMDISK_IMAGE_START_MASK 0x07FF 36#define RAMDISK_IMAGE_START_MASK 0x07FF
37#define RAMDISK_PROMPT_FLAG 0x8000 37#define RAMDISK_PROMPT_FLAG 0x8000
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index be9ec6890723..d2af227f06d0 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -63,6 +63,12 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
63 return (dma_addr == bad_dma_address); 63 return (dma_addr == bad_dma_address);
64} 64}
65 65
66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
68
69#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
70#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
71
66extern void *dma_alloc_coherent(struct device *dev, size_t size, 72extern void *dma_alloc_coherent(struct device *dev, size_t size,
67 dma_addr_t *dma_handle, gfp_t gfp); 73 dma_addr_t *dma_handle, gfp_t gfp);
68extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 74extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index fa2086774105..6216fa3f2802 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -46,6 +46,7 @@ extern void e820_mark_nosave_regions(void);
46extern void e820_print_map(char *who); 46extern void e820_print_map(char *who);
47extern 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);
48extern 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);
49extern unsigned long e820_hole_size(unsigned long start, unsigned long end);
49 50
50extern void e820_setup_gap(void); 51extern void e820_setup_gap(void);
51extern void e820_register_active_regions(int nid, 52extern void e820_register_active_regions(int nid,
@@ -56,6 +57,7 @@ extern void finish_e820_parsing(void);
56extern struct e820map e820; 57extern struct e820map e820;
57 58
58extern unsigned ebda_addr, ebda_size; 59extern unsigned ebda_addr, ebda_size;
60extern unsigned long nodemap_addr, nodemap_size;
59#endif/*!__ASSEMBLY__*/ 61#endif/*!__ASSEMBLY__*/
60 62
61#endif/*__E820_HEADER*/ 63#endif/*__E820_HEADER*/
diff --git a/include/asm-x86_64/hpet.h b/include/asm-x86_64/hpet.h
index b39098408b69..59a66f084611 100644
--- a/include/asm-x86_64/hpet.h
+++ b/include/asm-x86_64/hpet.h
@@ -56,8 +56,15 @@
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 apic_is_clustered_box(void); 58extern int apic_is_clustered_box(void);
59extern int hpet_arch_init(void);
60extern int hpet_timer_stop_set_go(unsigned long tick);
61extern int hpet_reenable(void);
62extern unsigned int hpet_calibrate_tsc(void);
59 63
60extern int hpet_use_timer; 64extern int hpet_use_timer;
65extern unsigned long hpet_address;
66extern unsigned long hpet_period;
67extern unsigned long hpet_tick;
61 68
62#ifdef CONFIG_HPET_EMULATE_RTC 69#ifdef CONFIG_HPET_EMULATE_RTC
63extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask); 70extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 179cce755aa7..6153ae5df2e8 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -32,9 +32,30 @@
32#define IA32_SYSCALL_VECTOR 0x80 32#define IA32_SYSCALL_VECTOR 0x80
33 33
34 34
35/* Reserve the lowest usable priority level 0x20 - 0x2f for triggering
36 * cleanup after irq migration.
37 */
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39
35/* 40/*
36 * Vectors 0x20-0x2f are used for ISA interrupts. 41 * Vectors 0x30-0x3f are used for ISA interrupts.
37 */ 42 */
43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
44#define IRQ1_VECTOR IRQ0_VECTOR + 1
45#define IRQ2_VECTOR IRQ0_VECTOR + 2
46#define IRQ3_VECTOR IRQ0_VECTOR + 3
47#define IRQ4_VECTOR IRQ0_VECTOR + 4
48#define IRQ5_VECTOR IRQ0_VECTOR + 5
49#define IRQ6_VECTOR IRQ0_VECTOR + 6
50#define IRQ7_VECTOR IRQ0_VECTOR + 7
51#define IRQ8_VECTOR IRQ0_VECTOR + 8
52#define IRQ9_VECTOR IRQ0_VECTOR + 9
53#define IRQ10_VECTOR IRQ0_VECTOR + 10
54#define IRQ11_VECTOR IRQ0_VECTOR + 11
55#define IRQ12_VECTOR IRQ0_VECTOR + 12
56#define IRQ13_VECTOR IRQ0_VECTOR + 13
57#define IRQ14_VECTOR IRQ0_VECTOR + 14
58#define IRQ15_VECTOR IRQ0_VECTOR + 15
38 59
39/* 60/*
40 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff 61 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
@@ -66,10 +87,10 @@
66 87
67/* 88/*
68 * First APIC vector available to drivers: (vectors 0x30-0xee) 89 * First APIC vector available to drivers: (vectors 0x30-0xee)
69 * we start at 0x31 to spread out vectors evenly between priority 90 * we start at 0x41 to spread out vectors evenly between priority
70 * levels. (0x80 is the syscall vector) 91 * levels. (0x80 is the syscall vector)
71 */ 92 */
72#define FIRST_DEVICE_VECTOR 0x31 93#define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
73#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */ 94#define FIRST_SYSTEM_VECTOR 0xef /* duplicated in irq.h */
74 95
75 96
@@ -91,7 +112,7 @@ extern void enable_8259A_irq(unsigned int irq);
91extern int i8259A_irq_pending(unsigned int irq); 112extern int i8259A_irq_pending(unsigned int irq);
92extern void make_8259A_irq(unsigned int irq); 113extern void make_8259A_irq(unsigned int irq);
93extern void init_8259A(int aeoi); 114extern void init_8259A(int aeoi);
94extern void FASTCALL(send_IPI_self(int vector)); 115extern void send_IPI_self(int vector);
95extern void init_VISWS_APIC_irqs(void); 116extern void init_VISWS_APIC_irqs(void);
96extern void setup_IO_APIC(void); 117extern void setup_IO_APIC(void);
97extern void disable_IO_APIC(void); 118extern void disable_IO_APIC(void);
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 6ee9fadaaacb..de2cd9a2303a 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -100,7 +100,7 @@ __OUTS(l)
100 100
101#define IO_SPACE_LIMIT 0xffff 101#define IO_SPACE_LIMIT 0xffff
102 102
103#if defined(__KERNEL__) && __x86_64__ 103#if defined(__KERNEL__) && defined(__x86_64__)
104 104
105#include <linux/vmalloc.h> 105#include <linux/vmalloc.h>
106 106
@@ -248,12 +248,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
248 */ 248 */
249#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) 249#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
250 250
251/*
252 * Again, x86-64 does not require mem IO specific function.
253 */
254
255#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d))
256
257/* Nothing to do */ 251/* Nothing to do */
258 252
259#define dma_cache_inv(_start,_size) do { } while (0) 253#define dma_cache_inv(_start,_size) do { } while (0)
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 561ecbfd4cb5..969d225a9350 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/mpspec.h> 5#include <asm/mpspec.h>
6#include <asm/apicdef.h>
6 7
7/* 8/*
8 * Intel IO-APIC support for SMP and UP systems. 9 * Intel IO-APIC support for SMP and UP systems.
@@ -85,18 +86,8 @@ struct IO_APIC_route_entry {
85 mask : 1, /* 0: enabled, 1: disabled */ 86 mask : 1, /* 0: enabled, 1: disabled */
86 __reserved_2 : 15; 87 __reserved_2 : 15;
87 88
88 union { struct { __u32 89 __u32 __reserved_3 : 24,
89 __reserved_1 : 24, 90 dest : 8;
90 physical_dest : 4,
91 __reserved_2 : 4;
92 } physical;
93
94 struct { __u32
95 __reserved_1 : 24,
96 logical_dest : 8;
97 } logical;
98 } dest;
99
100} __attribute__ ((packed)); 91} __attribute__ ((packed));
101 92
102/* 93/*
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 5a11146d6d9c..177e92b4019b 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -103,6 +103,8 @@ void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
103 103
104extern atomic_t mce_entry; 104extern atomic_t mce_entry;
105 105
106extern void do_machine_check(struct pt_regs *, long);
107
106#endif 108#endif
107 109
108#endif 110#endif
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index c38ebdf6f426..fb558fb1d211 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -11,24 +11,25 @@
11 11
12#include <asm/smp.h> 12#include <asm/smp.h>
13 13
14/* Should really switch to dynamic allocation at some point */
15#define NODEMAPSIZE 0x4fff
16
17/* Simple perfect hash to map physical addresses to node numbers */ 14/* Simple perfect hash to map physical addresses to node numbers */
18struct memnode { 15struct memnode {
19 int shift; 16 int shift;
20 u8 map[NODEMAPSIZE]; 17 unsigned int mapsize;
21} ____cacheline_aligned; 18 u8 *map;
19 u8 embedded_map[64-16];
20} ____cacheline_aligned; /* total size = 64 bytes */
22extern struct memnode memnode; 21extern struct memnode memnode;
23#define memnode_shift memnode.shift 22#define memnode_shift memnode.shift
24#define memnodemap memnode.map 23#define memnodemap memnode.map
24#define memnodemapsize memnode.mapsize
25 25
26extern struct pglist_data *node_data[]; 26extern struct pglist_data *node_data[];
27 27
28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
29{ 29{
30 unsigned nid; 30 unsigned nid;
31 VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE); 31 VIRTUAL_BUG_ON(!memnodemap);
32 VIRTUAL_BUG_ON((addr >> memnode_shift) >= memnodemapsize);
32 nid = memnodemap[addr >> memnode_shift]; 33 nid = memnodemap[addr >> memnode_shift];
33 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); 34 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
34 return nid; 35 return nid;
@@ -46,5 +47,10 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
46extern int pfn_valid(unsigned long pfn); 47extern int pfn_valid(unsigned long pfn);
47#endif 48#endif
48 49
50#ifdef CONFIG_NUMA_EMU
51#define FAKE_NODE_MIN_SIZE (64*1024*1024)
52#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1ul))
53#endif
54
49#endif 55#endif
50#endif 56#endif
diff --git a/include/asm-x86_64/msr.h b/include/asm-x86_64/msr.h
index 3227bc93d69b..902f9a58617e 100644
--- a/include/asm-x86_64/msr.h
+++ b/include/asm-x86_64/msr.h
@@ -160,6 +160,19 @@ static inline unsigned int cpuid_edx(unsigned int op)
160#define MSR_IA32_UCODE_WRITE 0x79 160#define MSR_IA32_UCODE_WRITE 0x79
161#define MSR_IA32_UCODE_REV 0x8b 161#define MSR_IA32_UCODE_REV 0x8b
162 162
163#ifdef CONFIG_SMP
164void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
165void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
166#else /* CONFIG_SMP */
167static inline void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
168{
169 rdmsr(msr_no, *l, *h);
170}
171static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
172{
173 wrmsr(msr_no, l, h);
174}
175#endif /* CONFIG_SMP */
163 176
164#endif 177#endif
165 178
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h
index 16396b1de3e4..6c2949a3c677 100644
--- a/include/asm-x86_64/mutex.h
+++ b/include/asm-x86_64/mutex.h
@@ -21,7 +21,7 @@ do { \
21 unsigned long dummy; \ 21 unsigned long dummy; \
22 \ 22 \
23 typecheck(atomic_t *, v); \ 23 typecheck(atomic_t *, v); \
24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 24 typecheck_fn(void (*)(atomic_t *), fail_fn); \
25 \ 25 \
26 __asm__ __volatile__( \ 26 __asm__ __volatile__( \
27 LOCK_PREFIX " decl (%%rdi) \n" \ 27 LOCK_PREFIX " decl (%%rdi) \n" \
@@ -47,7 +47,7 @@ do { \
47 */ 47 */
48static inline int 48static inline int
49__mutex_fastpath_lock_retval(atomic_t *count, 49__mutex_fastpath_lock_retval(atomic_t *count,
50 int fastcall (*fail_fn)(atomic_t *)) 50 int (*fail_fn)(atomic_t *))
51{ 51{
52 if (unlikely(atomic_dec_return(count) < 0)) 52 if (unlikely(atomic_dec_return(count) < 0))
53 return fail_fn(count); 53 return fail_fn(count);
@@ -67,7 +67,7 @@ do { \
67 unsigned long dummy; \ 67 unsigned long dummy; \
68 \ 68 \
69 typecheck(atomic_t *, v); \ 69 typecheck(atomic_t *, v); \
70 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 70 typecheck_fn(void (*)(atomic_t *), fail_fn); \
71 \ 71 \
72 __asm__ __volatile__( \ 72 __asm__ __volatile__( \
73 LOCK_PREFIX " incl (%%rdi) \n" \ 73 LOCK_PREFIX " incl (%%rdi) \n" \
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 43d4c333a8b1..4e28b6060a5e 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -18,11 +18,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); 18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
19} 19}
20 20
21static inline pmd_t *get_pmd(void)
22{
23 return (pmd_t *)get_zeroed_page(GFP_KERNEL);
24}
25
26static inline void pmd_free(pmd_t *pmd) 21static inline void pmd_free(pmd_t *pmd)
27{ 22{
28 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 23 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 59901c690a0d..730bd6028416 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -359,15 +359,6 @@ static inline int pmd_large(pmd_t pte) {
359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE) 360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
361 361
362/* physical address -> PTE */
363static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
364{
365 pte_t pte;
366 pte_val(pte) = physpage | pgprot_val(pgprot);
367 pte_val(pte) &= __supported_pte_mask;
368 return pte;
369}
370
371/* Change flags of a PTE */ 362/* Change flags of a PTE */
372static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 363static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
373{ 364{
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index 6d324b838972..b6e65a699f2a 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -45,11 +45,7 @@ extern u32 pmtmr_ioport;
45#else 45#else
46#define pmtmr_ioport 0 46#define pmtmr_ioport 0
47#endif 47#endif
48extern unsigned long long monotonic_base;
49extern int sysctl_vsyscall;
50extern int nohpet; 48extern int nohpet;
51extern unsigned long vxtime_hz;
52extern void time_init_gtod(void);
53 49
54extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); 50extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2)));
55 51
@@ -81,7 +77,6 @@ extern void swap_low_mappings(void);
81extern void __show_regs(struct pt_regs * regs); 77extern void __show_regs(struct pt_regs * regs);
82extern void show_regs(struct pt_regs * regs); 78extern void show_regs(struct pt_regs * regs);
83 79
84extern char *syscall32_page;
85extern void syscall32_cpu_init(void); 80extern void syscall32_cpu_init(void);
86 81
87extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); 82extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end);
@@ -92,8 +87,6 @@ extern void check_efer(void);
92 87
93extern int unhandled_signal(struct task_struct *tsk, int sig); 88extern int unhandled_signal(struct task_struct *tsk, int sig);
94 89
95extern int unsynchronized_tsc(void);
96
97extern void select_idle_routine(const struct cpuinfo_x86 *c); 90extern void select_idle_routine(const struct cpuinfo_x86 *c);
98 91
99extern unsigned long table_start, table_end; 92extern unsigned long table_start, table_end;
@@ -106,7 +99,7 @@ extern int force_iommu, no_iommu;
106extern int iommu_detected; 99extern int iommu_detected;
107#ifdef CONFIG_IOMMU 100#ifdef CONFIG_IOMMU
108extern void gart_iommu_init(void); 101extern void gart_iommu_init(void);
109extern void gart_parse_options(char *); 102extern void __init gart_parse_options(char *);
110extern void iommu_hole_init(void); 103extern void iommu_hole_init(void);
111extern int fallback_aper_order; 104extern int fallback_aper_order;
112extern int fallback_aper_force; 105extern int fallback_aper_force;
diff --git a/include/asm-x86_64/setup.h b/include/asm-x86_64/setup.h
index 985d4e3c79da..eaeff73d6c10 100644
--- a/include/asm-x86_64/setup.h
+++ b/include/asm-x86_64/setup.h
@@ -1,6 +1,6 @@
1#ifndef _x8664_SETUP_H 1#ifndef _x8664_SETUP_H
2#define _x8664_SETUP_H 2#define _x8664_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256 4#define COMMAND_LINE_SIZE 2048
5 5
6#endif 6#endif
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index e17b9ec42e98..de592a408c07 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -7,6 +7,7 @@
7#include <linux/threads.h> 7#include <linux/threads.h>
8#include <linux/cpumask.h> 8#include <linux/cpumask.h>
9#include <linux/bitops.h> 9#include <linux/bitops.h>
10#include <linux/init.h>
10extern int disable_apic; 11extern int disable_apic;
11 12
12#include <asm/fixmap.h> 13#include <asm/fixmap.h>
@@ -68,7 +69,7 @@ extern int __cpu_disable(void);
68extern void __cpu_die(unsigned int cpu); 69extern void __cpu_die(unsigned int cpu);
69extern void prefill_possible_map(void); 70extern void prefill_possible_map(void);
70extern unsigned num_processors; 71extern unsigned num_processors;
71extern unsigned disabled_cpus; 72extern unsigned __cpuinitdata disabled_cpus;
72 73
73#define NO_PROC_ID 0xFF /* No processor magic marker */ 74#define NO_PROC_ID 0xFF /* No processor magic marker */
74 75
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index b46702607933..90af60cf3c0e 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -49,5 +49,7 @@
49 49
50#define SO_PEERSEC 31 50#define SO_PEERSEC 31
51#define SO_PASSSEC 34 51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
52 54
53#endif /* _ASM_SOCKET_H */ 55#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86_64/sockios.h b/include/asm-x86_64/sockios.h
index 2eefd10d4f48..d726ba2513e3 100644
--- a/include/asm-x86_64/sockios.h
+++ b/include/asm-x86_64/sockios.h
@@ -7,6 +7,7 @@
7#define FIOGETOWN 0x8903 7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904 8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905 9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp */ 10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
11 12
12#endif 13#endif
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h
index ba94ab3d2673..f9c589539a82 100644
--- a/include/asm-x86_64/swiotlb.h
+++ b/include/asm-x86_64/swiotlb.h
@@ -1,6 +1,5 @@
1#ifndef _ASM_SWIOTLB_H 1#ifndef _ASM_SWIOTLB_H
2#define _ASM_SWTIOLB_H 1 2#define _ASM_SWIOTLB_H 1
3
4 3
5#include <asm/dma-mapping.h> 4#include <asm/dma-mapping.h>
6 5
@@ -52,4 +51,6 @@ extern int swiotlb;
52 51
53extern void pci_swiotlb_init(void); 52extern void pci_swiotlb_init(void);
54 53
55#endif /* _ASM_SWTIOLB_H */ 54static inline void dma_mark_clean(void *addr, size_t size) {}
55
56#endif /* _ASM_SWIOTLB_H */
diff --git a/include/asm-x86_64/termios.h b/include/asm-x86_64/termios.h
index 443b225537f0..35ee59b78329 100644
--- a/include/asm-x86_64/termios.h
+++ b/include/asm-x86_64/termios.h
@@ -39,24 +39,6 @@ struct termio {
39 39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41 41
42/* line disciplines */
43#define N_TTY 0
44#define N_SLIP 1
45#define N_MOUSE 2
46#define N_PPP 3
47#define N_STRIP 4
48#define N_AX25 5
49#define N_X25 6 /* X.25 async */
50#define N_6PACK 7
51#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
52#define N_R3964 9 /* Reserved for Simatic R3964 module */
53#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
54#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
55#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
56#define N_HDLC 13 /* synchronous HDLC */
57#define N_SYNC_PPP 14 /* synchronous PPP */
58#define N_HCI 15 /* Bluetooth HCI UART */
59
60#ifdef __KERNEL__ 42#ifdef __KERNEL__
61 43
62/* intr=^C quit=^\ erase=del kill=^U 44/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/asm-x86_64/timex.h b/include/asm-x86_64/timex.h
index b9e5320b7625..8c6808a3fba4 100644
--- a/include/asm-x86_64/timex.h
+++ b/include/asm-x86_64/timex.h
@@ -12,38 +12,21 @@
12#include <asm/hpet.h> 12#include <asm/hpet.h>
13#include <asm/system.h> 13#include <asm/system.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/tsc.h>
15#include <linux/compiler.h> 16#include <linux/compiler.h>
16 17
17#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */ 18#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
18 19
19typedef unsigned long long cycles_t;
20
21static inline cycles_t get_cycles (void)
22{
23 unsigned long long ret;
24
25 rdtscll(ret);
26 return ret;
27}
28
29/* Like get_cycles, but make sure the CPU is synchronized. */
30static __always_inline cycles_t get_cycles_sync(void)
31{
32 unsigned long long ret;
33 unsigned eax;
34 /* Don't do an additional sync on CPUs where we know
35 RDTSC is already synchronous. */
36 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
37 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
38 rdtscll(ret);
39 return ret;
40}
41
42extern unsigned int cpu_khz;
43
44extern int read_current_timer(unsigned long *timer_value); 20extern int read_current_timer(unsigned long *timer_value);
45#define ARCH_HAS_READ_CURRENT_TIMER 1 21#define ARCH_HAS_READ_CURRENT_TIMER 1
46 22
47extern struct vxtime_data vxtime; 23#define USEC_PER_TICK (USEC_PER_SEC / HZ)
24#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
25#define FSEC_PER_TICK (FSEC_PER_SEC / HZ)
26
27#define NS_SCALE 10 /* 2^10, carefully chosen */
28#define US_SCALE 32 /* 2^32, arbitralrily chosen */
48 29
30extern void mark_tsc_unstable(void);
31extern void set_cyc2ns_scale(unsigned long khz);
49#endif 32#endif
diff --git a/include/asm-x86_64/topology.h b/include/asm-x86_64/topology.h
index 2facec5914d2..4fd6fb23953e 100644
--- a/include/asm-x86_64/topology.h
+++ b/include/asm-x86_64/topology.h
@@ -43,7 +43,6 @@ extern int __node_distance(int, int);
43 .newidle_idx = 0, \ 43 .newidle_idx = 0, \
44 .wake_idx = 1, \ 44 .wake_idx = 1, \
45 .forkexec_idx = 1, \ 45 .forkexec_idx = 1, \
46 .per_cpu_gain = 100, \
47 .flags = SD_LOAD_BALANCE \ 46 .flags = SD_LOAD_BALANCE \
48 | SD_BALANCE_FORK \ 47 | SD_BALANCE_FORK \
49 | SD_BALANCE_EXEC \ 48 | SD_BALANCE_EXEC \
diff --git a/include/asm-x86_64/tsc.h b/include/asm-x86_64/tsc.h
new file mode 100644
index 000000000000..d66ba6ef25f6
--- /dev/null
+++ b/include/asm-x86_64/tsc.h
@@ -0,0 +1 @@
#include <asm-i386/tsc.h>
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index c0eac519840b..9df30b939c4e 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -37,11 +37,11 @@
37 * Uhhuh, this needs 65-bit arithmetic. We have a carry.. 37 * Uhhuh, this needs 65-bit arithmetic. We have a carry..
38 */ 38 */
39#define __range_not_ok(addr,size) ({ \ 39#define __range_not_ok(addr,size) ({ \
40 unsigned long flag,sum; \ 40 unsigned long flag,roksum; \
41 __chk_user_ptr(addr); \ 41 __chk_user_ptr(addr); \
42 asm("# range_ok\n\r" \ 42 asm("# range_ok\n\r" \
43 "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0" \ 43 "addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0" \
44 :"=&r" (flag), "=r" (sum) \ 44 :"=&r" (flag), "=r" (roksum) \
45 :"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \ 45 :"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \
46 flag; }) 46 flag; })
47 47
@@ -367,4 +367,18 @@ __copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
367 return copy_user_generic((__force void *)dst, src, size); 367 return copy_user_generic((__force void *)dst, src, size);
368} 368}
369 369
370#define ARCH_HAS_NOCACHE_UACCESS 1
371extern long __copy_user_nocache(void *dst, const void __user *src, unsigned size, int zerorest);
372
373static inline int __copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
374{
375 might_sleep();
376 return __copy_user_nocache(dst, src, size, 1);
377}
378
379static inline int __copy_from_user_inatomic_nocache(void *dst, const void __user *src, unsigned size)
380{
381 return __copy_user_nocache(dst, src, size, 0);
382}
383
370#endif /* __X86_64_UACCESS_H */ 384#endif /* __X86_64_UACCESS_H */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 05cb8dd200de..82b4afe65c91 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -16,51 +16,27 @@ enum vsyscall_num {
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17#include <linux/seqlock.h> 17#include <linux/seqlock.h>
18 18
19#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))
20#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16))) 19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
21#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) 20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
22#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16)))
23#define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16)))
24#define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16)))
25#define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16)))
26 21
27#define VXTIME_TSC 1 22/* Definitions for CONFIG_GENERIC_TIME definitions */
28#define VXTIME_HPET 2 23#define __section_vsyscall_gtod_data __attribute__ \
29#define VXTIME_PMTMR 3 24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16)))
25#define __vsyscall_fn __attribute__ ((unused,__section__(".vsyscall_fn")))
30 26
31#define VGETCPU_RDTSCP 1 27#define VGETCPU_RDTSCP 1
32#define VGETCPU_LSL 2 28#define VGETCPU_LSL 2
33 29
34struct vxtime_data {
35 long hpet_address; /* HPET base address */
36 int last;
37 unsigned long last_tsc;
38 long quot;
39 long tsc_quot;
40 int mode;
41};
42
43#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) 30#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
44#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) 31#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
45 32
46/* vsyscall space (readonly) */
47extern struct vxtime_data __vxtime;
48extern int __vgetcpu_mode; 33extern int __vgetcpu_mode;
49extern struct timespec __xtime;
50extern volatile unsigned long __jiffies; 34extern volatile unsigned long __jiffies;
51extern struct timezone __sys_tz;
52extern seqlock_t __xtime_lock;
53 35
54/* kernel space (writeable) */ 36/* kernel space (writeable) */
55extern struct vxtime_data vxtime;
56extern int vgetcpu_mode; 37extern int vgetcpu_mode;
57extern struct timezone sys_tz; 38extern struct timezone sys_tz;
58extern int sysctl_vsyscall; 39extern struct vsyscall_gtod_data_t vsyscall_gtod_data;
59extern seqlock_t xtime_lock;
60
61extern int sysctl_vsyscall;
62
63#define ARCH_HAVE_XTIME_LOCK 1
64 40
65#endif /* __KERNEL__ */ 41#endif /* __KERNEL__ */
66 42
diff --git a/include/asm-xtensa/div64.h b/include/asm-xtensa/div64.h
index c4a105776383..20965e3af1dd 100644
--- a/include/asm-xtensa/div64.h
+++ b/include/asm-xtensa/div64.h
@@ -11,9 +11,15 @@
11#ifndef _XTENSA_DIV64_H 11#ifndef _XTENSA_DIV64_H
12#define _XTENSA_DIV64_H 12#define _XTENSA_DIV64_H
13 13
14#include <linux/types.h>
15
14#define do_div(n,base) ({ \ 16#define do_div(n,base) ({ \
15 int __res = n % ((unsigned int) base); \ 17 int __res = n % ((unsigned int) base); \
16 n /= (unsigned int) base; \ 18 n /= (unsigned int) base; \
17 __res; }) 19 __res; })
18 20
21static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor)
22{
23 return dividend / divisor;
24}
19#endif 25#endif
diff --git a/include/asm-xtensa/mman.h b/include/asm-xtensa/mman.h
index ba394cbb4807..9b92620c8a1e 100644
--- a/include/asm-xtensa/mman.h
+++ b/include/asm-xtensa/mman.h
@@ -79,7 +79,6 @@
79#define MADV_DOFORK 11 /* do inherit across fork */ 79#define MADV_DOFORK 11 /* do inherit across fork */
80 80
81/* compatibility flags */ 81/* compatibility flags */
82#define MAP_ANON MAP_ANONYMOUS
83#define MAP_FILE 0 82#define MAP_FILE 0
84 83
85#endif /* _XTENSA_MMAN_H */ 84#endif /* _XTENSA_MMAN_H */
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 971d231be60e..1f5aeacb9da2 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -60,5 +60,7 @@
60#define SO_ACCEPTCONN 30 60#define SO_ACCEPTCONN 30
61#define SO_PEERSEC 31 61#define SO_PEERSEC 31
62#define SO_PASSSEC 34 62#define SO_PASSSEC 34
63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
63 65
64#endif /* _XTENSA_SOCKET_H */ 66#endif /* _XTENSA_SOCKET_H */
diff --git a/include/asm-xtensa/sockios.h b/include/asm-xtensa/sockios.h
index 20d2ba10ecd1..efe0af379f01 100644
--- a/include/asm-xtensa/sockios.h
+++ b/include/asm-xtensa/sockios.h
@@ -25,6 +25,7 @@
25#define SIOCSPGRP _IOW('s', 8, pid_t) 25#define SIOCSPGRP _IOW('s', 8, pid_t)
26#define SIOCGPGRP _IOR('s', 9, pid_t) 26#define SIOCGPGRP _IOR('s', 9, pid_t)
27 27
28#define SIOCGSTAMP 0x8906 /* Get stamp - linux-specific */ 28#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
29#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
29 30
30#endif /* _XTENSA_SOCKIOS_H */ 31#endif /* _XTENSA_SOCKIOS_H */
diff --git a/include/asm-xtensa/termios.h b/include/asm-xtensa/termios.h
index 83c6aed1d115..f14b42c8dac0 100644
--- a/include/asm-xtensa/termios.h
+++ b/include/asm-xtensa/termios.h
@@ -52,25 +52,6 @@ struct termio {
52 52
53/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ 53/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
54 54
55/* Line disciplines */
56
57#define N_TTY 0
58#define N_SLIP 1
59#define N_MOUSE 2
60#define N_PPP 3
61#define N_STRIP 4
62#define N_AX25 5
63#define N_X25 6 /* X.25 async */
64#define N_6PACK 7
65#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
66#define N_R3964 9 /* Reserved for Simatic R3964 module */
67#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
68#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
69#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
70#define N_HDLC 13 /* synchronous HDLC */
71#define N_SYNC_PPP 14
72#define N_HCI 15 /* Bluetooth HCI UART */
73
74#ifdef __KERNEL__ 55#ifdef __KERNEL__
75 56
76/* intr=^C quit=^\ erase=del kill=^U 57/* intr=^C quit=^\ erase=del kill=^U
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 5748aecdb414..4e05e93ff681 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -18,8 +18,8 @@ struct module;
18struct seq_file; 18struct seq_file;
19 19
20struct crypto_type { 20struct crypto_type {
21 unsigned int (*ctxsize)(struct crypto_alg *alg); 21 unsigned int (*ctxsize)(struct crypto_alg *alg, u32 type, u32 mask);
22 int (*init)(struct crypto_tfm *tfm); 22 int (*init)(struct crypto_tfm *tfm, u32 type, u32 mask);
23 void (*exit)(struct crypto_tfm *tfm); 23 void (*exit)(struct crypto_tfm *tfm);
24 void (*show)(struct seq_file *m, struct crypto_alg *alg); 24 void (*show)(struct seq_file *m, struct crypto_alg *alg);
25}; 25};
@@ -93,7 +93,8 @@ struct crypto_template *crypto_lookup_template(const char *name);
93int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 93int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
94 struct crypto_instance *inst); 94 struct crypto_instance *inst);
95void crypto_drop_spawn(struct crypto_spawn *spawn); 95void crypto_drop_spawn(struct crypto_spawn *spawn);
96struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn); 96struct crypto_tfm *crypto_spawn_tfm(struct crypto_spawn *spawn, u32 type,
97 u32 mask);
97 98
98struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len, 99struct crypto_alg *crypto_get_attr_alg(void *param, unsigned int len,
99 u32 type, u32 mask); 100 u32 type, u32 mask);
@@ -132,11 +133,28 @@ static inline void *crypto_blkcipher_ctx_aligned(struct crypto_blkcipher *tfm)
132 return crypto_tfm_ctx_aligned(&tfm->base); 133 return crypto_tfm_ctx_aligned(&tfm->base);
133} 134}
134 135
136static inline struct crypto_cipher *crypto_spawn_cipher(
137 struct crypto_spawn *spawn)
138{
139 u32 type = CRYPTO_ALG_TYPE_CIPHER;
140 u32 mask = CRYPTO_ALG_TYPE_MASK;
141
142 return __crypto_cipher_cast(crypto_spawn_tfm(spawn, type, mask));
143}
144
135static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm) 145static inline struct cipher_alg *crypto_cipher_alg(struct crypto_cipher *tfm)
136{ 146{
137 return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher; 147 return &crypto_cipher_tfm(tfm)->__crt_alg->cra_cipher;
138} 148}
139 149
150static inline struct crypto_hash *crypto_spawn_hash(struct crypto_spawn *spawn)
151{
152 u32 type = CRYPTO_ALG_TYPE_HASH;
153 u32 mask = CRYPTO_ALG_TYPE_HASH_MASK;
154
155 return __crypto_hash_cast(crypto_spawn_tfm(spawn, type, mask));
156}
157
140static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm) 158static inline void *crypto_hash_ctx_aligned(struct crypto_hash *tfm)
141{ 159{
142 return crypto_tfm_ctx_aligned(&tfm->base); 160 return crypto_tfm_ctx_aligned(&tfm->base);
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
new file mode 100644
index 000000000000..e2ee73aef0ee
--- /dev/null
+++ b/include/keys/rxrpc-type.h
@@ -0,0 +1,22 @@
1/* RxRPC key type
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _KEYS_RXRPC_TYPE_H
13#define _KEYS_RXRPC_TYPE_H
14
15#include <linux/key.h>
16
17/*
18 * key type for AF_RXRPC keys
19 */
20extern struct key_type key_type_rxrpc;
21
22#endif /* _KEYS_USER_TYPE_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 157db77a7170..4ff0f57d0add 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -11,6 +11,7 @@ header-y += netfilter_arp/
11header-y += netfilter_bridge/ 11header-y += netfilter_bridge/
12header-y += netfilter_ipv4/ 12header-y += netfilter_ipv4/
13header-y += netfilter_ipv6/ 13header-y += netfilter_ipv6/
14header-y += usb/
14 15
15header-y += affs_hardblocks.h 16header-y += affs_hardblocks.h
16header-y += aio_abi.h 17header-y += aio_abi.h
@@ -68,9 +69,7 @@ header-y += hdsmart.h
68header-y += hysdn_if.h 69header-y += hysdn_if.h
69header-y += i2c-dev.h 70header-y += i2c-dev.h
70header-y += i8k.h 71header-y += i8k.h
71header-y += icmp.h
72header-y += if_arcnet.h 72header-y += if_arcnet.h
73header-y += if_arp.h
74header-y += if_bonding.h 73header-y += if_bonding.h
75header-y += if_cablemodem.h 74header-y += if_cablemodem.h
76header-y += if_fc.h 75header-y += if_fc.h
@@ -87,7 +86,6 @@ header-y += if_tunnel.h
87header-y += in6.h 86header-y += in6.h
88header-y += in_route.h 87header-y += in_route.h
89header-y += ioctl.h 88header-y += ioctl.h
90header-y += ip.h
91header-y += ipmi_msgdefs.h 89header-y += ipmi_msgdefs.h
92header-y += ip_mp_alg.h 90header-y += ip_mp_alg.h
93header-y += ipsec.h 91header-y += ipsec.h
@@ -115,6 +113,7 @@ header-y += netrom.h
115header-y += nfs2.h 113header-y += nfs2.h
116header-y += nfs4_mount.h 114header-y += nfs4_mount.h
117header-y += nfs_mount.h 115header-y += nfs_mount.h
116header-y += nl80211.h
118header-y += oom.h 117header-y += oom.h
119header-y += param.h 118header-y += param.h
120header-y += pci_regs.h 119header-y += pci_regs.h
@@ -155,7 +154,6 @@ header-y += video_encoder.h
155header-y += videotext.h 154header-y += videotext.h
156header-y += vt.h 155header-y += vt.h
157header-y += wireless.h 156header-y += wireless.h
158header-y += xattr.h
159header-y += x25.h 157header-y += x25.h
160 158
161unifdef-y += acct.h 159unifdef-y += acct.h
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h
210unifdef-y += hpet.h 208unifdef-y += hpet.h
211unifdef-y += i2c.h 209unifdef-y += i2c.h
212unifdef-y += i2o-dev.h 210unifdef-y += i2o-dev.h
211unifdef-y += icmp.h
213unifdef-y += icmpv6.h 212unifdef-y += icmpv6.h
214unifdef-y += if_addr.h 213unifdef-y += if_addr.h
214unifdef-y += if_arp.h
215unifdef-y += if_bridge.h 215unifdef-y += if_bridge.h
216unifdef-y += if_ec.h 216unifdef-y += if_ec.h
217unifdef-y += if_eql.h 217unifdef-y += if_eql.h
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h
231unifdef-y += in.h 231unifdef-y += in.h
232unifdef-y += inotify.h 232unifdef-y += inotify.h
233unifdef-y += input.h 233unifdef-y += input.h
234unifdef-y += ip.h
234unifdef-y += ipc.h 235unifdef-y += ipc.h
235unifdef-y += ipmi.h 236unifdef-y += ipmi.h
236unifdef-y += ipv6.h 237unifdef-y += ipv6.h
@@ -323,10 +324,10 @@ unifdef-y += tty.h
323unifdef-y += types.h 324unifdef-y += types.h
324unifdef-y += udf_fs_i.h 325unifdef-y += udf_fs_i.h
325unifdef-y += udp.h 326unifdef-y += udp.h
327unifdef-y += ufs_fs.h
326unifdef-y += uinput.h 328unifdef-y += uinput.h
327unifdef-y += uio.h 329unifdef-y += uio.h
328unifdef-y += unistd.h 330unifdef-y += unistd.h
329unifdef-y += usb_ch9.h
330unifdef-y += usbdevice_fs.h 331unifdef-y += usbdevice_fs.h
331unifdef-y += user.h 332unifdef-y += user.h
332unifdef-y += utsname.h 333unifdef-y += utsname.h
@@ -336,6 +337,7 @@ unifdef-y += wait.h
336unifdef-y += wanrouter.h 337unifdef-y += wanrouter.h
337unifdef-y += watchdog.h 338unifdef-y += watchdog.h
338unifdef-y += wireless.h 339unifdef-y += wireless.h
340unifdef-y += xattr.h
339unifdef-y += xfrm.h 341unifdef-y += xfrm.h
340 342
341objhdr-y += version.h 343objhdr-y += version.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 91f1f2363870..8bcfaa4c66ae 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -53,166 +53,6 @@ enum acpi_irq_model_id {
53 53
54extern enum acpi_irq_model_id acpi_irq_model; 54extern enum acpi_irq_model_id acpi_irq_model;
55 55
56
57/* Root System Description Pointer (RSDP) */
58
59struct acpi_table_rsdp {
60 char signature[8];
61 u8 checksum;
62 char oem_id[6];
63 u8 revision;
64 u32 rsdt_address;
65} __attribute__ ((packed));
66
67struct acpi20_table_rsdp {
68 char signature[8];
69 u8 checksum;
70 char oem_id[6];
71 u8 revision;
72 u32 rsdt_address;
73 u32 length;
74 u64 xsdt_address;
75 u8 ext_checksum;
76 u8 reserved[3];
77} __attribute__ ((packed));
78
79typedef struct {
80 u8 type;
81 u8 length;
82} __attribute__ ((packed)) acpi_table_entry_header;
83
84/* Root System Description Table (RSDT) */
85
86struct acpi_table_rsdt {
87 struct acpi_table_header header;
88 u32 entry[8];
89} __attribute__ ((packed));
90
91/* Extended System Description Table (XSDT) */
92
93struct acpi_table_xsdt {
94 struct acpi_table_header header;
95 u64 entry[1];
96} __attribute__ ((packed));
97
98/* Fixed ACPI Description Table (FADT) */
99
100struct acpi_table_fadt {
101 struct acpi_table_header header;
102 u32 facs_addr;
103 u32 dsdt_addr;
104 /* ... */
105} __attribute__ ((packed));
106
107/* Multiple APIC Description Table (MADT) */
108
109struct acpi_table_madt {
110 struct acpi_table_header header;
111 u32 lapic_address;
112 struct {
113 u32 pcat_compat:1;
114 u32 reserved:31;
115 } flags;
116} __attribute__ ((packed));
117
118enum acpi_madt_entry_id {
119 ACPI_MADT_LAPIC = 0,
120 ACPI_MADT_IOAPIC,
121 ACPI_MADT_INT_SRC_OVR,
122 ACPI_MADT_NMI_SRC,
123 ACPI_MADT_LAPIC_NMI,
124 ACPI_MADT_LAPIC_ADDR_OVR,
125 ACPI_MADT_IOSAPIC,
126 ACPI_MADT_LSAPIC,
127 ACPI_MADT_PLAT_INT_SRC,
128 ACPI_MADT_ENTRY_COUNT
129};
130
131typedef struct {
132 u16 polarity:2;
133 u16 trigger:2;
134 u16 reserved:12;
135} __attribute__ ((packed)) acpi_interrupt_flags;
136
137struct acpi_table_lapic {
138 acpi_table_entry_header header;
139 u8 acpi_id;
140 u8 id;
141 struct {
142 u32 enabled:1;
143 u32 reserved:31;
144 } flags;
145} __attribute__ ((packed));
146
147struct acpi_table_ioapic {
148 acpi_table_entry_header header;
149 u8 id;
150 u8 reserved;
151 u32 address;
152 u32 global_irq_base;
153} __attribute__ ((packed));
154
155struct acpi_table_int_src_ovr {
156 acpi_table_entry_header header;
157 u8 bus;
158 u8 bus_irq;
159 u32 global_irq;
160 acpi_interrupt_flags flags;
161} __attribute__ ((packed));
162
163struct acpi_table_nmi_src {
164 acpi_table_entry_header header;
165 acpi_interrupt_flags flags;
166 u32 global_irq;
167} __attribute__ ((packed));
168
169struct acpi_table_lapic_nmi {
170 acpi_table_entry_header header;
171 u8 acpi_id;
172 acpi_interrupt_flags flags;
173 u8 lint;
174} __attribute__ ((packed));
175
176struct acpi_table_lapic_addr_ovr {
177 acpi_table_entry_header header;
178 u8 reserved[2];
179 u64 address;
180} __attribute__ ((packed));
181
182struct acpi_table_iosapic {
183 acpi_table_entry_header header;
184 u8 id;
185 u8 reserved;
186 u32 global_irq_base;
187 u64 address;
188} __attribute__ ((packed));
189
190struct acpi_table_lsapic {
191 acpi_table_entry_header header;
192 u8 acpi_id;
193 u8 id;
194 u8 eid;
195 u8 reserved[3];
196 struct {
197 u32 enabled:1;
198 u32 reserved:31;
199 } flags;
200} __attribute__ ((packed));
201
202struct acpi_table_plat_int_src {
203 acpi_table_entry_header header;
204 acpi_interrupt_flags flags;
205 u8 type; /* See acpi_interrupt_type */
206 u8 id;
207 u8 eid;
208 u8 iosapic_vector;
209 u32 global_irq;
210 struct {
211 u32 cpei_override_flag:1;
212 u32 reserved:31;
213 } plint_flags;
214} __attribute__ ((packed));
215
216enum acpi_interrupt_id { 56enum acpi_interrupt_id {
217 ACPI_INTERRUPT_PMI = 1, 57 ACPI_INTERRUPT_PMI = 1,
218 ACPI_INTERRUPT_INIT, 58 ACPI_INTERRUPT_INIT,
@@ -222,89 +62,6 @@ enum acpi_interrupt_id {
222 62
223#define ACPI_SPACE_MEM 0 63#define ACPI_SPACE_MEM 0
224 64
225struct acpi_gen_regaddr {
226 u8 space_id;
227 u8 bit_width;
228 u8 bit_offset;
229 u8 resv;
230 u32 addrl;
231 u32 addrh;
232} __attribute__ ((packed));
233
234struct acpi_table_hpet {
235 struct acpi_table_header header;
236 u32 id;
237 struct acpi_gen_regaddr addr;
238 u8 number;
239 u16 min_tick;
240 u8 page_protect;
241} __attribute__ ((packed));
242
243/*
244 * Simple Boot Flags
245 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
246 */
247struct acpi_table_sbf
248{
249 u8 sbf_signature[4];
250 u32 sbf_len;
251 u8 sbf_revision;
252 u8 sbf_csum;
253 u8 sbf_oemid[6];
254 u8 sbf_oemtable[8];
255 u8 sbf_revdata[4];
256 u8 sbf_creator[4];
257 u8 sbf_crearev[4];
258 u8 sbf_cmos;
259 u8 sbf_spare[3];
260} __attribute__ ((packed));
261
262/*
263 * System Resource Affinity Table (SRAT)
264 * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
265 */
266
267struct acpi_table_srat {
268 struct acpi_table_header header;
269 u32 table_revision;
270 u64 reserved;
271} __attribute__ ((packed));
272
273enum acpi_srat_entry_id {
274 ACPI_SRAT_PROCESSOR_AFFINITY = 0,
275 ACPI_SRAT_MEMORY_AFFINITY,
276 ACPI_SRAT_ENTRY_COUNT
277};
278
279struct acpi_table_processor_affinity {
280 acpi_table_entry_header header;
281 u8 proximity_domain;
282 u8 apic_id;
283 struct {
284 u32 enabled:1;
285 u32 reserved:31;
286 } flags;
287 u8 lsapic_eid;
288 u8 reserved[7];
289} __attribute__ ((packed));
290
291struct acpi_table_memory_affinity {
292 acpi_table_entry_header header;
293 u8 proximity_domain;
294 u8 reserved1[5];
295 u32 base_addr_lo;
296 u32 base_addr_hi;
297 u32 length_lo;
298 u32 length_hi;
299 u32 memory_type; /* See acpi_address_range_id */
300 struct {
301 u32 enabled:1;
302 u32 hot_pluggable:1;
303 u32 reserved:30;
304 } flags;
305 u64 reserved2;
306} __attribute__ ((packed));
307
308enum acpi_address_range_id { 65enum acpi_address_range_id {
309 ACPI_ADDRESS_RANGE_MEMORY = 1, 66 ACPI_ADDRESS_RANGE_MEMORY = 1,
310 ACPI_ADDRESS_RANGE_RESERVED = 2, 67 ACPI_ADDRESS_RANGE_RESERVED = 2,
@@ -313,84 +70,12 @@ enum acpi_address_range_id {
313 ACPI_ADDRESS_RANGE_COUNT 70 ACPI_ADDRESS_RANGE_COUNT
314}; 71};
315 72
316/*
317 * System Locality Information Table (SLIT)
318 * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
319 */
320
321struct acpi_table_slit {
322 struct acpi_table_header header;
323 u64 localities;
324 u8 entry[1]; /* real size = localities^2 */
325} __attribute__ ((packed));
326
327/* Smart Battery Description Table (SBST) */
328
329struct acpi_table_sbst {
330 struct acpi_table_header header;
331 u32 warning; /* Warn user */
332 u32 low; /* Critical sleep */
333 u32 critical; /* Critical shutdown */
334} __attribute__ ((packed));
335
336/* Embedded Controller Boot Resources Table (ECDT) */
337
338struct acpi_table_ecdt {
339 struct acpi_table_header header;
340 struct acpi_generic_address ec_control;
341 struct acpi_generic_address ec_data;
342 u32 uid;
343 u8 gpe_bit;
344 char ec_id[0];
345} __attribute__ ((packed));
346
347/* PCI MMCONFIG */
348
349/* Defined in PCI Firmware Specification 3.0 */
350struct acpi_table_mcfg_config {
351 u32 base_address;
352 u32 base_reserved;
353 u16 pci_segment_group_number;
354 u8 start_bus_number;
355 u8 end_bus_number;
356 u8 reserved[4];
357} __attribute__ ((packed));
358struct acpi_table_mcfg {
359 struct acpi_table_header header;
360 u8 reserved[8];
361 struct acpi_table_mcfg_config config[0];
362} __attribute__ ((packed));
363 73
364/* Table Handlers */ 74/* Table Handlers */
365 75
366enum acpi_table_id { 76typedef int (*acpi_table_handler) (struct acpi_table_header *table);
367 ACPI_TABLE_UNKNOWN = 0,
368 ACPI_APIC,
369 ACPI_BOOT,
370 ACPI_DBGP,
371 ACPI_DSDT,
372 ACPI_ECDT,
373 ACPI_ETDT,
374 ACPI_FADT,
375 ACPI_FACS,
376 ACPI_OEMX,
377 ACPI_PSDT,
378 ACPI_SBST,
379 ACPI_SLIT,
380 ACPI_SPCR,
381 ACPI_SRAT,
382 ACPI_SSDT,
383 ACPI_SPMI,
384 ACPI_HPET,
385 ACPI_MCFG,
386 ACPI_TABLE_COUNT
387};
388
389typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size);
390
391extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
392 77
393typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end); 78typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
394 79
395char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 80char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
396unsigned long acpi_find_rsdp (void); 81unsigned long acpi_find_rsdp (void);
@@ -399,14 +84,14 @@ int acpi_boot_table_init (void);
399int acpi_numa_init (void); 84int acpi_numa_init (void);
400 85
401int acpi_table_init (void); 86int acpi_table_init (void);
402int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler); 87int acpi_table_parse (char *id, acpi_table_handler handler);
403int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); 88int __init acpi_table_parse_entries(char *id, unsigned long table_size,
404int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); 89 int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
405int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); 90int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
406int acpi_parse_mcfg (unsigned long phys_addr, unsigned long size); 91int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
407void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); 92int acpi_parse_mcfg (struct acpi_table_header *header);
408void acpi_table_print_madt_entry (acpi_table_entry_header *madt); 93void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
409void acpi_table_print_srat_entry (acpi_table_entry_header *srat); 94void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
410 95
411/* the following four functions are architecture-dependent */ 96/* the following four functions are architecture-dependent */
412#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT 97#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
@@ -417,8 +102,8 @@ void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
417#define acpi_numa_arch_fixup() do {} while (0) 102#define acpi_numa_arch_fixup() do {} while (0)
418#else 103#else
419void acpi_numa_slit_init (struct acpi_table_slit *slit); 104void acpi_numa_slit_init (struct acpi_table_slit *slit);
420void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); 105void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
421void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); 106void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
422void acpi_numa_arch_fixup(void); 107void acpi_numa_arch_fixup(void);
423#endif 108#endif
424 109
@@ -433,7 +118,7 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
433 118
434extern int acpi_mp_config; 119extern int acpi_mp_config;
435 120
436extern struct acpi_table_mcfg_config *pci_mmcfg_config; 121extern struct acpi_mcfg_allocation *pci_mmcfg_config;
437extern int pci_mmcfg_config_num; 122extern int pci_mmcfg_config_num;
438 123
439extern int sbf_port; 124extern int sbf_port;
diff --git a/include/linux/acpi_pmtmr.h b/include/linux/acpi_pmtmr.h
new file mode 100644
index 000000000000..1d0ef1ae8036
--- /dev/null
+++ b/include/linux/acpi_pmtmr.h
@@ -0,0 +1,38 @@
1#ifndef _ACPI_PMTMR_H_
2#define _ACPI_PMTMR_H_
3
4#include <linux/clocksource.h>
5
6/* Number of PMTMR ticks expected during calibration run */
7#define PMTMR_TICKS_PER_SEC 3579545
8
9/* limit it to 24 bits */
10#define ACPI_PM_MASK CLOCKSOURCE_MASK(24)
11
12/* Overrun value */
13#define ACPI_PM_OVRRUN (1<<24)
14
15#ifdef CONFIG_X86_PM_TIMER
16
17extern u32 acpi_pm_read_verified(void);
18extern u32 pmtmr_ioport;
19
20static inline u32 acpi_pm_read_early(void)
21{
22 if (!pmtmr_ioport)
23 return 0;
24 /* mask the output to 24 bits */
25 return acpi_pm_read_verified() & ACPI_PM_MASK;
26}
27
28#else
29
30static inline u32 acpi_pm_read_early(void)
31{
32 return 0;
33}
34
35#endif
36
37#endif
38
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index a5c8bb5d80ba..abc521cfb084 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -87,10 +87,15 @@ struct agp_memory {
87 u32 physical; 87 u32 physical;
88 u8 is_bound; 88 u8 is_bound;
89 u8 is_flushed; 89 u8 is_flushed;
90 u8 vmalloc_flag;
90}; 91};
91 92
92#define AGP_NORMAL_MEMORY 0 93#define AGP_NORMAL_MEMORY 0
93 94
95#define AGP_USER_TYPES (1 << 16)
96#define AGP_USER_MEMORY (AGP_USER_TYPES)
97#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
98
94extern struct agp_bridge_data *agp_bridge; 99extern struct agp_bridge_data *agp_bridge;
95extern struct list_head agp_bridges; 100extern struct list_head agp_bridges;
96 101
diff --git a/include/asm-arm/apm.h b/include/linux/apm-emulation.h
index d09113b37e4a..e6d800358dd6 100644
--- a/include/asm-arm/apm.h
+++ b/include/linux/apm-emulation.h
@@ -7,11 +7,9 @@
7 * based on arch/arm/kernel/apm.c 7 * based on arch/arm/kernel/apm.c
8 * factor out the information needed by architectures to provide 8 * factor out the information needed by architectures to provide
9 * apm status 9 * apm status
10 *
11 *
12 */ 10 */
13#ifndef ARM_ASM_SA1100_APM_H 11#ifndef __LINUX_APM_EMULATION_H
14#define ARM_ASM_SA1100_APM_H 12#define __LINUX_APM_EMULATION_H
15 13
16#include <linux/apm_bios.h> 14#include <linux/apm_bios.h>
17 15
@@ -61,4 +59,4 @@ extern void (*apm_get_power_status)(struct apm_power_info *);
61 */ 59 */
62void apm_queue_event(apm_event_t event); 60void apm_queue_event(apm_event_t event);
63 61
64#endif 62#endif /* __LINUX_APM_EMULATION_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1df941648a57..edb31bfff68f 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,13 +40,14 @@ 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_128 = 128,
43 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
45 46
46 ATA_ID_WORDS = 256, 47 ATA_ID_WORDS = 256,
47 ATA_ID_SERNO_OFS = 10, 48 ATA_ID_SERNO = 10,
48 ATA_ID_FW_REV_OFS = 23, 49 ATA_ID_FW_REV = 23,
49 ATA_ID_PROD_OFS = 27, 50 ATA_ID_PROD = 27,
50 ATA_ID_OLD_PIO_MODES = 51, 51 ATA_ID_OLD_PIO_MODES = 51,
51 ATA_ID_FIELD_VALID = 53, 52 ATA_ID_FIELD_VALID = 53,
52 ATA_ID_MWDMA_MODES = 63, 53 ATA_ID_MWDMA_MODES = 63,
@@ -58,8 +59,11 @@ enum {
58 ATA_ID_MAJOR_VER = 80, 59 ATA_ID_MAJOR_VER = 80,
59 ATA_ID_PIO4 = (1 << 1), 60 ATA_ID_PIO4 = (1 << 1),
60 61
62 ATA_ID_SERNO_LEN = 20,
63 ATA_ID_FW_REV_LEN = 8,
64 ATA_ID_PROD_LEN = 40,
65
61 ATA_PCI_CTL_OFS = 2, 66 ATA_PCI_CTL_OFS = 2,
62 ATA_SERNO_LEN = 20,
63 ATA_UDMA0 = (1 << 0), 67 ATA_UDMA0 = (1 << 0),
64 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 68 ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
65 ATA_UDMA2 = ATA_UDMA1 | (1 << 2), 69 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
@@ -155,11 +159,19 @@ enum {
155 ATA_CMD_INIT_DEV_PARAMS = 0x91, 159 ATA_CMD_INIT_DEV_PARAMS = 0x91,
156 ATA_CMD_READ_NATIVE_MAX = 0xF8, 160 ATA_CMD_READ_NATIVE_MAX = 0xF8,
157 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 161 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
162 ATA_CMD_SET_MAX = 0xF9,
163 ATA_CMD_SET_MAX_EXT = 0x37,
158 ATA_CMD_READ_LOG_EXT = 0x2f, 164 ATA_CMD_READ_LOG_EXT = 0x2f,
159 165
160 /* READ_LOG_EXT pages */ 166 /* READ_LOG_EXT pages */
161 ATA_LOG_SATA_NCQ = 0x10, 167 ATA_LOG_SATA_NCQ = 0x10,
162 168
169 /* READ/WRITE LONG (obsolete) */
170 ATA_CMD_READ_LONG = 0x22,
171 ATA_CMD_READ_LONG_ONCE = 0x23,
172 ATA_CMD_WRITE_LONG = 0x32,
173 ATA_CMD_WRITE_LONG_ONCE = 0x33,
174
163 /* SETFEATURES stuff */ 175 /* SETFEATURES stuff */
164 SETFEATURES_XFER = 0x03, 176 SETFEATURES_XFER = 0x03,
165 XFER_UDMA_7 = 0x47, 177 XFER_UDMA_7 = 0x47,
@@ -190,6 +202,8 @@ enum {
190 SETFEATURES_WC_ON = 0x02, /* Enable write cache */ 202 SETFEATURES_WC_ON = 0x02, /* Enable write cache */
191 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ 203 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
192 204
205 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
206
193 /* ATAPI stuff */ 207 /* ATAPI stuff */
194 ATAPI_PKT_DMA = (1 << 0), 208 ATAPI_PKT_DMA = (1 << 0),
195 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 209 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -279,7 +293,6 @@ struct ata_taskfile {
279}; 293};
280 294
281#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 295#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
282#define ata_id_is_sata(id) ((id)[93] == 0)
283#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) 296#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
284#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) 297#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
285#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10)) 298#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
@@ -296,6 +309,8 @@ struct ata_taskfile {
296#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 309#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
297#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 310#define ata_id_removeable(id) ((id)[0] & (1 << 7))
298#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) 311#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0))
312#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
313#define ata_id_has_iordy(id) ((id)[49] & (1 << 9))
299#define ata_id_u32(id,n) \ 314#define ata_id_u32(id,n) \
300 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 315 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
301#define ata_id_u64(id,n) \ 316#define ata_id_u64(id,n) \
@@ -319,6 +334,11 @@ static inline unsigned int ata_id_major_version(const u16 *id)
319 return mver; 334 return mver;
320} 335}
321 336
337static inline int ata_id_is_sata(const u16 *id)
338{
339 return ata_id_major_version(id) >= 5 && id[93] == 0;
340}
341
322static inline int ata_id_current_chs_valid(const u16 *id) 342static inline int ata_id_current_chs_valid(const u16 *id)
323{ 343{
324 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 344 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -345,9 +365,9 @@ static inline int ata_id_is_cfa(const u16 *id)
345 365
346static inline int ata_drive_40wire(const u16 *dev_id) 366static inline int ata_drive_40wire(const u16 *dev_id)
347{ 367{
348 if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id)) 368 if (ata_id_is_sata(dev_id))
349 return 0; /* SATA */ 369 return 0; /* SATA */
350 if (dev_id[93] & 0x4000) 370 if ((dev_id[93] & 0xE000) == 0x6000)
351 return 0; /* 80 wire */ 371 return 0; /* 80 wire */
352 return 1; 372 return 1;
353} 373}
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index 75b8baca08f3..ced8a1ed080c 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -101,7 +101,7 @@ struct ddpehdr {
101 101
102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) 102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
103{ 103{
104 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb_transport_header(skb);
105} 105}
106 106
107/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
@@ -129,7 +129,7 @@ struct elapaarp {
129 129
130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
131{ 131{
132 return (struct elapaarp *)skb->h.raw; 132 return (struct elapaarp *)skb_transport_header(skb);
133} 133}
134 134
135/* Not specified - how long till we drop a resolved entry */ 135/* Not specified - how long till we drop a resolved entry */
@@ -182,7 +182,7 @@ extern rwlock_t atalk_interfaces_lock;
182 182
183extern struct atalk_route atrtr_default; 183extern struct atalk_route atrtr_default;
184 184
185extern struct file_operations atalk_seq_arp_fops; 185extern const struct file_operations atalk_seq_arp_fops;
186 186
187extern int sysctl_aarp_expiry_time; 187extern int sysctl_aarp_expiry_time;
188extern int sysctl_aarp_tick_time; 188extern int sysctl_aarp_tick_time;
diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h
index ee108f9e9cb7..231f4bdec730 100644
--- a/include/linux/atmarp.h
+++ b/include/linux/atmarp.h
@@ -6,9 +6,7 @@
6#ifndef _LINUX_ATMARP_H 6#ifndef _LINUX_ATMARP_H
7#define _LINUX_ATMARP_H 7#define _LINUX_ATMARP_H
8 8
9#ifdef __KERNEL__
10#include <linux/types.h> 9#include <linux/types.h>
11#endif
12#include <linux/atmapi.h> 10#include <linux/atmapi.h>
13#include <linux/atmioc.h> 11#include <linux/atmioc.h>
14 12
diff --git a/include/linux/atmel_pdc.h b/include/linux/atmel_pdc.h
new file mode 100644
index 000000000000..5058a31d2ce8
--- /dev/null
+++ b/include/linux/atmel_pdc.h
@@ -0,0 +1,36 @@
1/*
2 * include/linux/atmel_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 ATMEL_PDC_H
17#define ATMEL_PDC_H
18
19#define ATMEL_PDC_RPR 0x100 /* Receive Pointer Register */
20#define ATMEL_PDC_RCR 0x104 /* Receive Counter Register */
21#define ATMEL_PDC_TPR 0x108 /* Transmit Pointer Register */
22#define ATMEL_PDC_TCR 0x10c /* Transmit Counter Register */
23#define ATMEL_PDC_RNPR 0x110 /* Receive Next Pointer Register */
24#define ATMEL_PDC_RNCR 0x114 /* Receive Next Counter Register */
25#define ATMEL_PDC_TNPR 0x118 /* Transmit Next Pointer Register */
26#define ATMEL_PDC_TNCR 0x11c /* Transmit Next Counter Register */
27
28#define ATMEL_PDC_PTCR 0x120 /* Transfer Control Register */
29#define ATMEL_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */
30#define ATMEL_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */
31#define ATMEL_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */
32#define ATMEL_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */
33
34#define ATMEL_PDC_PTSR 0x124 /* Transfer Status Register */
35
36#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 0e07db6cc0d0..773e30df11ee 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -24,6 +24,7 @@
24#ifndef _LINUX_AUDIT_H_ 24#ifndef _LINUX_AUDIT_H_
25#define _LINUX_AUDIT_H_ 25#define _LINUX_AUDIT_H_
26 26
27#include <linux/types.h>
27#include <linux/elf-em.h> 28#include <linux/elf-em.h>
28 29
29/* The netlink messages for the audit system is divided into blocks: 30/* The netlink messages for the audit system is divided into blocks:
@@ -89,6 +90,7 @@
89#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */ 90#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
90#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */ 91#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
91#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */ 92#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
93#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
92 94
93#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 95#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
94#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 96#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -387,6 +389,7 @@ extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode
387extern int audit_bprm(struct linux_binprm *bprm); 389extern int audit_bprm(struct linux_binprm *bprm);
388extern int audit_socketcall(int nargs, unsigned long *args); 390extern int audit_socketcall(int nargs, unsigned long *args);
389extern int audit_sockaddr(int len, void *addr); 391extern int audit_sockaddr(int len, void *addr);
392extern int __audit_fd_pair(int fd1, int fd2);
390extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt); 393extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
391extern int audit_set_macxattr(const char *name); 394extern int audit_set_macxattr(const char *name);
392extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 395extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
@@ -401,6 +404,12 @@ static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
401 return __audit_ipc_obj(ipcp); 404 return __audit_ipc_obj(ipcp);
402 return 0; 405 return 0;
403} 406}
407static inline int audit_fd_pair(int fd1, int fd2)
408{
409 if (unlikely(!audit_dummy_context()))
410 return __audit_fd_pair(fd1, fd2);
411 return 0;
412}
404static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 413static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
405{ 414{
406 if (unlikely(!audit_dummy_context())) 415 if (unlikely(!audit_dummy_context()))
@@ -459,6 +468,7 @@ extern int audit_n_rules;
459#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 468#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
460#define audit_bprm(p) ({ 0; }) 469#define audit_bprm(p) ({ 0; })
461#define audit_socketcall(n,a) ({ 0; }) 470#define audit_socketcall(n,a) ({ 0; })
471#define audit_fd_pair(n,a) ({ 0; })
462#define audit_sockaddr(len, addr) ({ 0; }) 472#define audit_sockaddr(len, addr) ({ 0; })
463#define audit_avc_path(dentry, mnt) ({ 0; }) 473#define audit_avc_path(dentry, mnt) ({ 0; })
464#define audit_set_macxattr(n) do { ; } while (0) 474#define audit_set_macxattr(n) do { ; } while (0)
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 0a6bc52ffe88..31a29541b504 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -59,6 +59,13 @@ struct autofs_packet_expire_multi {
59 char name[NAME_MAX+1]; 59 char name[NAME_MAX+1];
60}; 60};
61 61
62union autofs_packet_union {
63 struct autofs_packet_hdr hdr;
64 struct autofs_packet_missing missing;
65 struct autofs_packet_expire expire;
66 struct autofs_packet_expire_multi expire_multi;
67};
68
62/* autofs v5 common packet struct */ 69/* autofs v5 common packet struct */
63struct autofs_v5_packet { 70struct autofs_v5_packet {
64 struct autofs_packet_hdr hdr; 71 struct autofs_packet_hdr hdr;
@@ -78,12 +85,13 @@ typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
78typedef struct autofs_v5_packet autofs_packet_missing_direct_t; 85typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
79typedef struct autofs_v5_packet autofs_packet_expire_direct_t; 86typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
80 87
81union autofs_packet_union { 88union autofs_v5_packet_union {
82 struct autofs_packet_hdr hdr; 89 struct autofs_packet_hdr hdr;
83 struct autofs_packet_missing missing;
84 struct autofs_packet_expire expire;
85 struct autofs_packet_expire_multi expire_multi;
86 struct autofs_v5_packet v5_packet; 90 struct autofs_v5_packet v5_packet;
91 autofs_packet_missing_indirect_t missing_indirect;
92 autofs_packet_expire_indirect_t expire_indirect;
93 autofs_packet_missing_direct_t missing_direct;
94 autofs_packet_expire_direct_t expire_direct;
87}; 95};
88 96
89#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int) 97#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 7011d6255593..f2542c24b328 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -93,6 +93,7 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi)
93void clear_bdi_congested(struct backing_dev_info *bdi, int rw); 93void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
94void set_bdi_congested(struct backing_dev_info *bdi, int rw); 94void set_bdi_congested(struct backing_dev_info *bdi, int rw);
95long congestion_wait(int rw, long timeout); 95long congestion_wait(int rw, long timeout);
96long congestion_wait_interruptible(int rw, long timeout);
96void congestion_end(int rw); 97void congestion_end(int rw);
97 98
98#define bdi_cap_writeback_dirty(bdi) \ 99#define bdi_cap_writeback_dirty(bdi) \
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index a5cf1beacb44..1023ba0d6e55 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -9,17 +9,28 @@
9#define _LINUX_BACKLIGHT_H 9#define _LINUX_BACKLIGHT_H
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mutex.h>
12#include <linux/notifier.h> 13#include <linux/notifier.h>
13 14
15/* Notes on locking:
16 *
17 * backlight_device->ops_lock is an internal backlight lock protecting the
18 * ops pointer and no code outside the core should need to touch it.
19 *
20 * Access to update_status() is serialised by the update_lock mutex since
21 * most drivers seem to need this and historically get it wrong.
22 *
23 * Most drivers don't need locking on their get_brightness() method.
24 * If yours does, you need to implement it in the driver. You can use the
25 * update_lock mutex if appropriate.
26 *
27 * Any other use of the locks below is probably wrong.
28 */
29
14struct backlight_device; 30struct backlight_device;
15struct fb_info; 31struct fb_info;
16 32
17/* This structure defines all the properties of a backlight 33struct backlight_ops {
18 (usually attached to a LCD). */
19struct backlight_properties {
20 /* Owner module */
21 struct module *owner;
22
23 /* Notify the backlight driver some property has changed */ 34 /* Notify the backlight driver some property has changed */
24 int (*update_status)(struct backlight_device *); 35 int (*update_status)(struct backlight_device *);
25 /* Return the current backlight brightness (accounting for power, 36 /* Return the current backlight brightness (accounting for power,
@@ -28,7 +39,10 @@ struct backlight_properties {
28 /* Check if given framebuffer device is the one bound to this backlight; 39 /* Check if given framebuffer device is the one bound to this backlight;
29 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ 40 return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
30 int (*check_fb)(struct fb_info *); 41 int (*check_fb)(struct fb_info *);
42};
31 43
44/* This structure defines all the properties of a backlight */
45struct backlight_properties {
32 /* Current User requested brightness (0 - max_brightness) */ 46 /* Current User requested brightness (0 - max_brightness) */
33 int brightness; 47 int brightness;
34 /* Maximal value for brightness (read-only) */ 48 /* Maximal value for brightness (read-only) */
@@ -41,20 +55,34 @@ struct backlight_properties {
41}; 55};
42 56
43struct backlight_device { 57struct backlight_device {
44 /* This protects the 'props' field. If 'props' is NULL, the driver that 58 /* Backlight properties */
59 struct backlight_properties props;
60
61 /* Serialise access to update_status method */
62 struct mutex update_lock;
63
64 /* This protects the 'ops' field. If 'ops' is NULL, the driver that
45 registered this device has been unloaded, and if class_get_devdata() 65 registered this device has been unloaded, and if class_get_devdata()
46 points to something in the body of that driver, it is also invalid. */ 66 points to something in the body of that driver, it is also invalid. */
47 struct semaphore sem; 67 struct mutex ops_lock;
48 /* If this is NULL, the backing module is unloaded */ 68 struct backlight_ops *ops;
49 struct backlight_properties *props; 69
50 /* The framebuffer notifier block */ 70 /* The framebuffer notifier block */
51 struct notifier_block fb_notif; 71 struct notifier_block fb_notif;
52 /* The class device structure */ 72 /* The class device structure */
53 struct class_device class_dev; 73 struct class_device class_dev;
54}; 74};
55 75
76static inline void backlight_update_status(struct backlight_device *bd)
77{
78 mutex_lock(&bd->update_lock);
79 if (bd->ops && bd->ops->update_status)
80 bd->ops->update_status(bd);
81 mutex_unlock(&bd->update_lock);
82}
83
56extern struct backlight_device *backlight_device_register(const char *name, 84extern struct backlight_device *backlight_device_register(const char *name,
57 struct device *dev,void *devdata,struct backlight_properties *bp); 85 struct device *dev, void *devdata, struct backlight_ops *ops);
58extern void backlight_device_unregister(struct backlight_device *bd); 86extern void backlight_device_unregister(struct backlight_device *bd);
59 87
60#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) 88#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c1e82c514443..2d956cd566ae 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -59,6 +59,7 @@ struct linux_binfmt {
59 int (*load_shlib)(struct file *); 59 int (*load_shlib)(struct file *);
60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); 60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
61 unsigned long min_coredump; /* minimal dump size */ 61 unsigned long min_coredump; /* minimal dump size */
62 int hasvdso;
62}; 63};
63 64
64extern int register_binfmt(struct linux_binfmt *); 65extern int register_binfmt(struct linux_binfmt *);
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 08daf3272c02..4d85262b4fa4 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -276,7 +276,7 @@ extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
276extern mempool_t *bio_split_pool; 276extern mempool_t *bio_split_pool;
277extern void bio_pair_release(struct bio_pair *dbio); 277extern void bio_pair_release(struct bio_pair *dbio);
278 278
279extern struct bio_set *bioset_create(int, int, int); 279extern struct bio_set *bioset_create(int, int);
280extern void bioset_free(struct bio_set *); 280extern void bioset_free(struct bio_set *);
281 281
282extern struct bio *bio_alloc(gfp_t, int); 282extern struct bio *bio_alloc(gfp_t, int);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 36a6eacefe20..a686eabe22d6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -82,7 +82,6 @@ struct cfq_io_context {
82 82
83 unsigned long last_end_request; 83 unsigned long last_end_request;
84 sector_t last_request_pos; 84 sector_t last_request_pos;
85 unsigned long last_queue;
86 85
87 unsigned long ttime_total; 86 unsigned long ttime_total;
88 unsigned long ttime_samples; 87 unsigned long ttime_samples;
@@ -117,6 +116,7 @@ struct io_context {
117 116
118 struct as_io_context *aic; 117 struct as_io_context *aic;
119 struct rb_root cic_root; 118 struct rb_root cic_root;
119 void *ioc_data;
120}; 120};
121 121
122void put_io_context(struct io_context *ioc); 122void put_io_context(struct io_context *ioc);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 2275f2748708..81c07cd18643 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -108,7 +108,7 @@ static inline void *alloc_remap(int nid, unsigned long size)
108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
109 109
110extern unsigned long __meminitdata nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
111extern unsigned long nr_all_pages; 111extern unsigned long __meminitdata nr_all_pages;
112 112
113extern void *alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
114 unsigned long bucketsize, 114 unsigned long bucketsize,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 5d9fb0e94156..dd27b1c7227f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -34,6 +34,7 @@ enum bh_state_bits {
34 BH_Write_EIO, /* I/O error on write */ 34 BH_Write_EIO, /* I/O error on write */
35 BH_Ordered, /* ordered write */ 35 BH_Ordered, /* ordered write */
36 BH_Eopnotsupp, /* operation not supported (barrier) */ 36 BH_Eopnotsupp, /* operation not supported (barrier) */
37 BH_Unwritten, /* Buffer is allocated on disk but not written */
37 38
38 BH_PrivateStart,/* not a state bit, but the first bit available 39 BH_PrivateStart,/* not a state bit, but the first bit available
39 * for private allocation by other entities 40 * for private allocation by other entities
@@ -126,6 +127,7 @@ BUFFER_FNS(Boundary, boundary)
126BUFFER_FNS(Write_EIO, write_io_error) 127BUFFER_FNS(Write_EIO, write_io_error)
127BUFFER_FNS(Ordered, ordered) 128BUFFER_FNS(Ordered, ordered)
128BUFFER_FNS(Eopnotsupp, eopnotsupp) 129BUFFER_FNS(Eopnotsupp, eopnotsupp)
130BUFFER_FNS(Unwritten, unwritten)
129 131
130#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) 132#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
131#define touch_buffer(bh) mark_page_accessed(bh->b_page) 133#define touch_buffer(bh) mark_page_accessed(bh->b_page)
@@ -172,12 +174,14 @@ struct super_block *freeze_bdev(struct block_device *);
172void thaw_bdev(struct block_device *, struct super_block *); 174void thaw_bdev(struct block_device *, struct super_block *);
173int fsync_super(struct super_block *); 175int fsync_super(struct super_block *);
174int fsync_no_super(struct block_device *); 176int fsync_no_super(struct block_device *);
175struct buffer_head *__find_get_block(struct block_device *, sector_t, int); 177struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
176struct buffer_head * __getblk(struct block_device *, sector_t, int); 178 unsigned size);
179struct buffer_head *__getblk(struct block_device *bdev, sector_t block,
180 unsigned size);
177void __brelse(struct buffer_head *); 181void __brelse(struct buffer_head *);
178void __bforget(struct buffer_head *); 182void __bforget(struct buffer_head *);
179void __breadahead(struct block_device *, sector_t block, int size); 183void __breadahead(struct block_device *, sector_t block, unsigned int size);
180struct buffer_head *__bread(struct block_device *, sector_t block, int size); 184struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size);
181struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); 185struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
182void free_buffer_head(struct buffer_head * bh); 186void free_buffer_head(struct buffer_head * bh);
183void FASTCALL(unlock_buffer(struct buffer_head *bh)); 187void FASTCALL(unlock_buffer(struct buffer_head *bh));
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 56499ab9e32e..79bedddfd9ca 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,7 +1,5 @@
1header-y += big_endian.h 1header-y += big_endian.h
2header-y += little_endian.h 2header-y += little_endian.h
3header-y += pdp_endian.h
4 3
5unifdef-y += generic.h 4unifdef-y += generic.h
6unifdef-y += swabb.h
7unifdef-y += swab.h 5unifdef-y += swab.h
diff --git a/include/linux/byteorder/pdp_endian.h b/include/linux/byteorder/pdp_endian.h
deleted file mode 100644
index 618631cbc6e3..000000000000
--- a/include/linux/byteorder/pdp_endian.h
+++ /dev/null
@@ -1,88 +0,0 @@
1#ifndef _LINUX_BYTEORDER_PDP_ENDIAN_H
2#define _LINUX_BYTEORDER_PDP_ENDIAN_H
3
4/*
5 * Could have been named NUXI-endian, but we use the same name as in glibc.
6 * hopefully only the PDP and its evolutions (old VAXen in compatibility mode)
7 * should ever use this braindead byteorder.
8 * This file *should* work, but has not been tested.
9 *
10 * little-endian is 1234; big-endian is 4321; nuxi/pdp-endian is 3412
11 *
12 * I thought vaxen were NUXI-endian, but was told they were correct-endian
13 * (little-endian), though indeed there existed NUXI-endian machines
14 * (DEC PDP-11 and old VAXen in compatibility mode).
15 * This makes this file a bit useless, but as a proof-of-concept.
16 *
17 * But what does a __u64 look like: is it 34127856 or 78563412 ???
18 * I don't dare imagine! Hence, no 64-bit byteorder support yet.
19 * Hopefully, there 64-bit pdp-endian support shouldn't ever be required.
20 *
21 */
22
23#ifndef __PDP_ENDIAN
24#define __PDP_ENDIAN 3412
25#endif
26#ifndef __PDP_ENDIAN_BITFIELD
27#define __PDP_ENDIAN_BITFIELD
28#endif
29
30#include <linux/byteorder/swab.h>
31#include <linux/byteorder/swabb.h>
32
33#define __constant_htonl(x) ___constant_swahb32((x))
34#define __constant_ntohl(x) ___constant_swahb32((x))
35#define __constant_htons(x) ___constant_swab16((x))
36#define __constant_ntohs(x) ___constant_swab16((x))
37#define __constant_cpu_to_le64(x) I DON'T KNOW
38#define __constant_le64_to_cpu(x) I DON'T KNOW
39#define __constant_cpu_to_le32(x) ___constant_swahw32((x))
40#define __constant_le32_to_cpu(x) ___constant_swahw32((x))
41#define __constant_cpu_to_le16(x) ((__u16)(x)
42#define __constant_le16_to_cpu(x) ((__u16)(x)
43#define __constant_cpu_to_be64(x) I DON'T KNOW
44#define __constant_be64_to_cpu(x) I DON'T KNOW
45#define __constant_cpu_to_be32(x) ___constant_swahb32((x))
46#define __constant_be32_to_cpu(x) ___constant_swahb32((x))
47#define __constant_cpu_to_be16(x) ___constant_swab16((x))
48#define __constant_be16_to_cpu(x) ___constant_swab16((x))
49#define __cpu_to_le64(x) I DON'T KNOW
50#define __le64_to_cpu(x) I DON'T KNOW
51#define __cpu_to_le32(x) ___swahw32((x))
52#define __le32_to_cpu(x) ___swahw32((x))
53#define __cpu_to_le16(x) ((__u16)(x)
54#define __le16_to_cpu(x) ((__u16)(x)
55#define __cpu_to_be64(x) I DON'T KNOW
56#define __be64_to_cpu(x) I DON'T KNOW
57#define __cpu_to_be32(x) __swahb32((x))
58#define __be32_to_cpu(x) __swahb32((x))
59#define __cpu_to_be16(x) __swab16((x))
60#define __be16_to_cpu(x) __swab16((x))
61#define __cpu_to_le64p(x) I DON'T KNOW
62#define __le64_to_cpup(x) I DON'T KNOW
63#define __cpu_to_le32p(x) ___swahw32p((x))
64#define __le32_to_cpup(x) ___swahw32p((x))
65#define __cpu_to_le16p(x) (*(__u16*)(x))
66#define __le16_to_cpup(x) (*(__u16*)(x))
67#define __cpu_to_be64p(x) I DON'T KNOW
68#define __be64_to_cpup(x) I DON'T KNOW
69#define __cpu_to_be32p(x) __swahb32p((x))
70#define __be32_to_cpup(x) __swahb32p((x))
71#define __cpu_to_be16p(x) __swab16p((x))
72#define __be16_to_cpup(x) __swab16p((x))
73#define __cpu_to_le64s(x) I DON'T KNOW
74#define __le64_to_cpus(x) I DON'T KNOW
75#define __cpu_to_le32s(x) ___swahw32s((x))
76#define __le32_to_cpus(x) ___swahw32s((x))
77#define __cpu_to_le16s(x) do {} while (0)
78#define __le16_to_cpus(x) do {} while (0)
79#define __cpu_to_be64s(x) I DON'T KNOW
80#define __be64_to_cpus(x) I DON'T KNOW
81#define __cpu_to_be32s(x) __swahb32s((x))
82#define __be32_to_cpus(x) __swahb32s((x))
83#define __cpu_to_be16s(x) __swab16s((x))
84#define __be16_to_cpus(x) __swab16s((x))
85
86#include <linux/byteorder/generic.h>
87
88#endif /* _LINUX_BYTEORDER_PDP_ENDIAN_H */
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
index ae5e5f914bf4..8c780c7d779e 100644
--- a/include/linux/byteorder/swabb.h
+++ b/include/linux/byteorder/swabb.h
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#include <linux/types.h>
29
28#define ___swahw32(x) \ 30#define ___swahw32(x) \
29({ \ 31({ \
30 __u32 __x = (x); \ 32 __u32 __x = (x); \
@@ -77,19 +79,14 @@
77/* 79/*
78 * Allow constant folding 80 * Allow constant folding
79 */ 81 */
80#if defined(__GNUC__) && defined(__OPTIMIZE__) 82#define __swahw32(x) \
81# define __swahw32(x) \
82(__builtin_constant_p((__u32)(x)) ? \ 83(__builtin_constant_p((__u32)(x)) ? \
83 ___swahw32((x)) : \ 84 ___swahw32((x)) : \
84 __fswahw32((x))) 85 __fswahw32((x)))
85# define __swahb32(x) \ 86#define __swahb32(x) \
86(__builtin_constant_p((__u32)(x)) ? \ 87(__builtin_constant_p((__u32)(x)) ? \
87 ___swahb32((x)) : \ 88 ___swahb32((x)) : \
88 __fswahb32((x))) 89 __fswahb32((x)))
89#else
90# define __swahw32(x) __fswahw32(x)
91# define __swahb32(x) __fswahb32(x)
92#endif /* OPTIMIZE */
93 90
94 91
95static inline __u32 __fswahw32(__u32 x) 92static inline __u32 __fswahw32(__u32 x)
@@ -128,13 +125,11 @@ static inline void __swahb32s(__u32 *addr)
128 */ 125 */
129#endif /* __BYTEORDER_HAS_U64__ */ 126#endif /* __BYTEORDER_HAS_U64__ */
130 127
131#if defined(__KERNEL__)
132#define swahw32 __swahw32 128#define swahw32 __swahw32
133#define swahb32 __swahb32 129#define swahb32 __swahb32
134#define swahw32p __swahw32p 130#define swahw32p __swahw32p
135#define swahb32p __swahb32p 131#define swahb32p __swahb32p
136#define swahw32s __swahw32s 132#define swahw32s __swahw32s
137#define swahb32s __swahb32s 133#define swahb32s __swahb32s
138#endif
139 134
140#endif /* _LINUX_BYTEORDER_SWABB_H */ 135#endif /* _LINUX_BYTEORDER_SWABB_H */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index f309b00e986e..1e29b13d0062 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -6,6 +6,10 @@
6#include <linux/kdev_t.h> 6#include <linux/kdev_t.h>
7#include <linux/list.h> 7#include <linux/list.h>
8 8
9struct file_operations;
10struct inode;
11struct module;
12
9struct cdev { 13struct cdev {
10 struct kobject kobj; 14 struct kobject kobj;
11 struct module *owner; 15 struct module *owner;
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index bbbe7b4da0bb..f50f04bdbc16 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -939,7 +939,7 @@ struct cdrom_device_info {
939 int speed; /* maximum speed for reading data */ 939 int speed; /* maximum speed for reading data */
940 int capacity; /* number of discs in jukebox */ 940 int capacity; /* number of discs in jukebox */
941/* device-related storage */ 941/* device-related storage */
942 int options : 30; /* options flags */ 942 unsigned int options : 30; /* options flags */
943 unsigned mc_flags : 2; /* media change buffer flags */ 943 unsigned mc_flags : 2; /* media change buffer flags */
944 int use_count; /* number of times device opened */ 944 int use_count; /* number of times device opened */
945 char name[20]; /* name of the device type */ 945 char name[20]; /* name of the device type */
diff --git a/include/linux/cfag12864b.h b/include/linux/cfag12864b.h
new file mode 100644
index 000000000000..1605dd8aa646
--- /dev/null
+++ b/include/linux/cfag12864b.h
@@ -0,0 +1,82 @@
1/*
2 * Filename: cfag12864b.h
3 * Version: 0.1.0
4 * Description: cfag12864b LCD driver header
5 * License: GPLv2
6 *
7 * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com>
8 * Date: 2006-10-12
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 * 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#ifndef _CFAG12864B_H_
26#define _CFAG12864B_H_
27
28#define CFAG12864B_WIDTH (128)
29#define CFAG12864B_HEIGHT (64)
30#define CFAG12864B_CONTROLLERS (2)
31#define CFAG12864B_PAGES (8)
32#define CFAG12864B_ADDRESSES (64)
33#define CFAG12864B_SIZE ((CFAG12864B_CONTROLLERS) * \
34 (CFAG12864B_PAGES) * \
35 (CFAG12864B_ADDRESSES))
36
37/*
38 * The driver will blit this buffer to the LCD
39 *
40 * Its size is CFAG12864B_SIZE.
41 */
42extern unsigned char * cfag12864b_buffer;
43
44/*
45 * Get the refresh rate of the LCD
46 *
47 * Returns the refresh rate (hertzs).
48 */
49extern unsigned int cfag12864b_getrate(void);
50
51/*
52 * Enable refreshing
53 *
54 * Returns 0 if successful (anyone was using it),
55 * or != 0 if failed (someone is using it).
56 */
57extern unsigned char cfag12864b_enable(void);
58
59/*
60 * Disable refreshing
61 *
62 * You should call this only when you finish using the LCD.
63 */
64extern void cfag12864b_disable(void);
65
66/*
67 * Is enabled refreshing? (is anyone using the module?)
68 *
69 * Returns 0 if refreshing is not enabled (anyone is using it),
70 * or != 0 if refreshing is enabled (someone is using it).
71 *
72 * Useful for buffer read-only modules.
73 */
74extern unsigned char cfag12864b_isenabled(void);
75
76/*
77 * Is the module inited?
78 */
79extern unsigned char cfag12864b_isinited(void);
80
81#endif /* _CFAG12864B_H_ */
82
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
new file mode 100644
index 000000000000..4ea7e7bcfafe
--- /dev/null
+++ b/include/linux/clockchips.h
@@ -0,0 +1,142 @@
1/* linux/include/linux/clockchips.h
2 *
3 * This file contains the structure definitions for clockchips.
4 *
5 * If you are not a clockchip, or the time of day code, you should
6 * not be including this file!
7 */
8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H
10
11#ifdef CONFIG_GENERIC_CLOCKEVENTS
12
13#include <linux/clocksource.h>
14#include <linux/cpumask.h>
15#include <linux/ktime.h>
16#include <linux/notifier.h>
17
18struct clock_event_device;
19
20/* Clock event mode commands */
21enum clock_event_mode {
22 CLOCK_EVT_MODE_UNUSED = 0,
23 CLOCK_EVT_MODE_SHUTDOWN,
24 CLOCK_EVT_MODE_PERIODIC,
25 CLOCK_EVT_MODE_ONESHOT,
26};
27
28/* Clock event notification values */
29enum clock_event_nofitiers {
30 CLOCK_EVT_NOTIFY_ADD,
31 CLOCK_EVT_NOTIFY_BROADCAST_ON,
32 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
33 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
34 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
35 CLOCK_EVT_NOTIFY_SUSPEND,
36 CLOCK_EVT_NOTIFY_RESUME,
37 CLOCK_EVT_NOTIFY_CPU_DEAD,
38};
39
40/*
41 * Clock event features
42 */
43#define CLOCK_EVT_FEAT_PERIODIC 0x000001
44#define CLOCK_EVT_FEAT_ONESHOT 0x000002
45/*
46 * x86(64) specific misfeatures:
47 *
48 * - Clockevent source stops in C3 State and needs broadcast support.
49 * - Local APIC timer is used as a dummy device.
50 */
51#define CLOCK_EVT_FEAT_C3STOP 0x000004
52#define CLOCK_EVT_FEAT_DUMMY 0x000008
53
54/**
55 * struct clock_event_device - clock event device descriptor
56 * @name: ptr to clock event name
57 * @hints: usage hints
58 * @max_delta_ns: maximum delta value in ns
59 * @min_delta_ns: minimum delta value in ns
60 * @mult: nanosecond to cycles multiplier
61 * @shift: nanoseconds to cycles divisor (power of two)
62 * @rating: variable to rate clock event devices
63 * @irq: irq number (only for non cpu local devices)
64 * @cpumask: cpumask to indicate for which cpus this device works
65 * @set_next_event: set next event
66 * @set_mode: set mode function
67 * @evthandler: Assigned by the framework to be called by the low
68 * level handler of the event source
69 * @broadcast: function to broadcast events
70 * @list: list head for the management code
71 * @mode: operating mode assigned by the management code
72 * @next_event: local storage for the next event in oneshot mode
73 */
74struct clock_event_device {
75 const char *name;
76 unsigned int features;
77 unsigned long max_delta_ns;
78 unsigned long min_delta_ns;
79 unsigned long mult;
80 int shift;
81 int rating;
82 int irq;
83 cpumask_t cpumask;
84 int (*set_next_event)(unsigned long evt,
85 struct clock_event_device *);
86 void (*set_mode)(enum clock_event_mode mode,
87 struct clock_event_device *);
88 void (*event_handler)(struct clock_event_device *);
89 void (*broadcast)(cpumask_t mask);
90 struct list_head list;
91 enum clock_event_mode mode;
92 ktime_t next_event;
93};
94
95/*
96 * Calculate a multiplication factor for scaled math, which is used to convert
97 * nanoseconds based values to clock ticks:
98 *
99 * clock_ticks = (nanoseconds * factor) >> shift.
100 *
101 * div_sc is the rearranged equation to calculate a factor from a given clock
102 * ticks / nanoseconds ratio:
103 *
104 * factor = (clock_ticks << shift) / nanoseconds
105 */
106static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
107 int shift)
108{
109 uint64_t tmp = ((uint64_t)ticks) << shift;
110
111 do_div(tmp, nsec);
112 return (unsigned long) tmp;
113}
114
115/* Clock event layer functions */
116extern unsigned long clockevent_delta2ns(unsigned long latch,
117 struct clock_event_device *evt);
118extern void clockevents_register_device(struct clock_event_device *dev);
119
120extern void clockevents_exchange_device(struct clock_event_device *old,
121 struct clock_event_device *new);
122extern
123struct clock_event_device *clockevents_request_device(unsigned int features,
124 cpumask_t cpumask);
125extern void clockevents_release_device(struct clock_event_device *dev);
126extern void clockevents_set_mode(struct clock_event_device *dev,
127 enum clock_event_mode mode);
128extern int clockevents_register_notifier(struct notifier_block *nb);
129extern void clockevents_unregister_notifier(struct notifier_block *nb);
130extern int clockevents_program_event(struct clock_event_device *dev,
131 ktime_t expires, ktime_t now);
132
133extern void clockevents_notify(unsigned long reason, void *arg);
134
135#else
136
137static inline void clockevents_resume_events(void) { }
138#define clockevents_notify(reason, arg) do { } while (0)
139
140#endif
141
142#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 1622d23a8dc3..daa4940cc0f1 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -12,11 +12,13 @@
12#include <linux/timex.h> 12#include <linux/timex.h>
13#include <linux/time.h> 13#include <linux/time.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/timer.h>
15#include <asm/div64.h> 16#include <asm/div64.h>
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18/* clocksource cycle base type */ 19/* clocksource cycle base type */
19typedef u64 cycle_t; 20typedef u64 cycle_t;
21struct clocksource;
20 22
21/** 23/**
22 * struct clocksource - hardware abstraction for a free running counter 24 * struct clocksource - hardware abstraction for a free running counter
@@ -44,8 +46,8 @@ typedef u64 cycle_t;
44 * subtraction of non 64 bit counters 46 * subtraction of non 64 bit counters
45 * @mult: cycle to nanosecond multiplier 47 * @mult: cycle to nanosecond multiplier
46 * @shift: cycle to nanosecond divisor (power of two) 48 * @shift: cycle to nanosecond divisor (power of two)
47 * @update_callback: called when safe to alter clocksource values 49 * @flags: flags describing special properties
48 * @is_continuous: defines if clocksource is free-running. 50 * @vread: vsyscall based read
49 * @cycle_interval: Used internally by timekeeping core, please ignore. 51 * @cycle_interval: Used internally by timekeeping core, please ignore.
50 * @xtime_interval: Used internally by timekeeping core, please ignore. 52 * @xtime_interval: Used internally by timekeeping core, please ignore.
51 */ 53 */
@@ -57,15 +59,30 @@ struct clocksource {
57 cycle_t mask; 59 cycle_t mask;
58 u32 mult; 60 u32 mult;
59 u32 shift; 61 u32 shift;
60 int (*update_callback)(void); 62 unsigned long flags;
61 int is_continuous; 63 cycle_t (*vread)(void);
62 64
63 /* timekeeping specific data, ignore */ 65 /* timekeeping specific data, ignore */
64 cycle_t cycle_last, cycle_interval; 66 cycle_t cycle_last, cycle_interval;
65 u64 xtime_nsec, xtime_interval; 67 u64 xtime_nsec, xtime_interval;
66 s64 error; 68 s64 error;
69
70#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
71 /* Watchdog related data, used by the framework */
72 struct list_head wd_list;
73 cycle_t wd_last;
74#endif
67}; 75};
68 76
77/*
78 * Clock source flags bits::
79 */
80#define CLOCK_SOURCE_IS_CONTINUOUS 0x01
81#define CLOCK_SOURCE_MUST_VERIFY 0x02
82
83#define CLOCK_SOURCE_WATCHDOG 0x10
84#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
85
69/* simplify initialization of mask field */ 86/* simplify initialization of mask field */
70#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1) 87#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
71 88
@@ -178,8 +195,16 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
178 195
179 196
180/* used to install a new clocksource */ 197/* used to install a new clocksource */
181int clocksource_register(struct clocksource*); 198extern int clocksource_register(struct clocksource*);
182void clocksource_reselect(void); 199extern struct clocksource* clocksource_get_next(void);
183struct clocksource* clocksource_get_next(void); 200extern void clocksource_change_rating(struct clocksource *cs, int rating);
201
202#ifdef CONFIG_GENERIC_TIME_VSYSCALL
203extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
204#else
205static inline void update_vsyscall(struct timespec *ts, struct clocksource *c)
206{
207}
208#endif
184 209
185#endif /* _LINUX_CLOCKSOURCE_H */ 210#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 4c2632a8d31b..e4ac016ad272 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -23,9 +23,9 @@
23#include <linux/coda_fs_i.h> 23#include <linux/coda_fs_i.h>
24 24
25/* operations */ 25/* operations */
26extern struct inode_operations coda_dir_inode_operations; 26extern const struct inode_operations coda_dir_inode_operations;
27extern struct inode_operations coda_file_inode_operations; 27extern const struct inode_operations coda_file_inode_operations;
28extern struct inode_operations coda_ioctl_inode_operations; 28extern const struct inode_operations coda_ioctl_inode_operations;
29 29
30extern const struct address_space_operations coda_file_aops; 30extern const struct address_space_operations coda_file_aops;
31extern const struct address_space_operations coda_symlink_aops; 31extern const struct address_space_operations coda_symlink_aops;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 80b17f440ec1..ccd863dd77fa 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -234,5 +234,24 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 234 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
235 const compat_ulong_t __user *new_nodes); 235 const compat_ulong_t __user *new_nodes);
236 236
237/*
238 * epoll (fs/eventpoll.c) compat bits follow ...
239 */
240#ifndef CONFIG_HAS_COMPAT_EPOLL_EVENT
241struct epoll_event;
242#define compat_epoll_event epoll_event
243#else
244asmlinkage long compat_sys_epoll_ctl(int epfd, int op, int fd,
245 struct compat_epoll_event __user *event);
246asmlinkage long compat_sys_epoll_wait(int epfd,
247 struct compat_epoll_event __user *events,
248 int maxevents, int timeout);
249#endif
250asmlinkage long compat_sys_epoll_pwait(int epfd,
251 struct compat_epoll_event __user *events,
252 int maxevents, int timeout,
253 const compat_sigset_t __user *sigmask,
254 compat_size_t sigsetsize);
255
237#endif /* CONFIG_COMPAT */ 256#endif /* CONFIG_COMPAT */
238#endif /* _LINUX_COMPAT_H */ 257#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 6e1c44a935d4..9008eabb9c3d 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -27,6 +27,13 @@
27#define __inline__ __inline__ __attribute__((always_inline)) 27#define __inline__ __inline__ __attribute__((always_inline))
28#define __inline __inline __attribute__((always_inline)) 28#define __inline __inline __attribute__((always_inline))
29#define __deprecated __attribute__((deprecated)) 29#define __deprecated __attribute__((deprecated))
30#define __packed __attribute__((packed))
31#define __weak __attribute__((weak))
32#define __naked __attribute__((naked))
33#define __noreturn __attribute__((noreturn))
34#define __pure __attribute__((pure))
35#define __aligned(x) __attribute__((aligned(x)))
36#define __printf(a,b) __attribute__((format(printf,a,b)))
30#define noinline __attribute__((noinline)) 37#define noinline __attribute__((noinline))
31#define __attribute_pure__ __attribute__((pure)) 38#define __attribute_pure__ __attribute__((pure))
32#define __attribute_const__ __attribute__((__const__)) 39#define __attribute_const__ __attribute__((__const__))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index aca66984aafd..3b6949b41745 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -15,8 +15,8 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 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(const void __user *);
19extern void __chk_io_ptr(void __iomem *); 19extern void __chk_io_ptr(const void __iomem *);
20#else 20#else
21# define __user 21# define __user
22# define __kernel 22# define __kernel
diff --git a/include/linux/console.h b/include/linux/console.h
index 7d0420274de0..de25ee3b7919 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -21,6 +21,7 @@ struct vc_data;
21struct console_font_op; 21struct console_font_op;
22struct console_font; 22struct console_font;
23struct module; 23struct module;
24struct tty_struct;
24 25
25/* 26/*
26 * this is what the terminal answers to a ESC-Z or csi0c query. 27 * this is what the terminal answers to a ESC-Z or csi0c query.
@@ -132,6 +133,9 @@ static inline void resume_console(void) {}
132int mda_console_init(void); 133int mda_console_init(void);
133void prom_con_init(void); 134void prom_con_init(void);
134 135
136void vcs_make_sysfs(struct tty_struct *tty);
137void vcs_remove_sysfs(struct tty_struct *tty);
138
135/* Some debug stub to catch some of the obvious races in the VT code */ 139/* Some debug stub to catch some of the obvious races in the VT code */
136#if 1 140#if 1
137#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress) 141#define WARN_CONSOLE_UNLOCKED() WARN_ON(!is_console_locked() && !oops_in_progress)
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index ed6c0fee1ac7..a86162b26c0d 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/wait.h> 12#include <linux/wait.h>
13#include <linux/vt.h> 13#include <linux/vt.h>
14#include <linux/workqueue.h>
14 15
15struct vt_struct; 16struct vt_struct;
16 17
@@ -103,6 +104,7 @@ struct vc_data {
103 104
104struct vc { 105struct vc {
105 struct vc_data *d; 106 struct vc_data *d;
107 struct work_struct SAK_work;
106 108
107 /* might add scrmem, vt_struct, kbd at some time, 109 /* might add scrmem, vt_struct, kbd at some time,
108 to have everything in one place - the disadvantage 110 to have everything in one place - the disadvantage
@@ -110,6 +112,7 @@ struct vc {
110}; 112};
111 113
112extern struct vc vc_cons [MAX_NR_CONSOLES]; 114extern struct vc vc_cons [MAX_NR_CONSOLES];
115extern void vc_SAK(struct work_struct *work);
113 116
114#define CUR_DEF 0 117#define CUR_DEF 0
115#define CUR_NONE 1 118#define CUR_NONE 1
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index bfb520212d71..c22b0dfcbcd2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -49,10 +49,20 @@ struct notifier_block;
49 49
50#ifdef CONFIG_SMP 50#ifdef CONFIG_SMP
51/* Need to know about CPUs going up/down? */ 51/* Need to know about CPUs going up/down? */
52extern int register_cpu_notifier(struct notifier_block *nb);
53#ifdef CONFIG_HOTPLUG_CPU 52#ifdef CONFIG_HOTPLUG_CPU
53extern int register_cpu_notifier(struct notifier_block *nb);
54extern void unregister_cpu_notifier(struct notifier_block *nb); 54extern void unregister_cpu_notifier(struct notifier_block *nb);
55#else 55#else
56
57#ifndef MODULE
58extern int register_cpu_notifier(struct notifier_block *nb);
59#else
60static inline int register_cpu_notifier(struct notifier_block *nb)
61{
62 return 0;
63}
64#endif
65
56static inline void unregister_cpu_notifier(struct notifier_block *nb) 66static inline void unregister_cpu_notifier(struct notifier_block *nb)
57{ 67{
58} 68}
@@ -117,9 +127,13 @@ static inline int cpu_is_offline(int cpu) { return 0; }
117#endif /* CONFIG_HOTPLUG_CPU */ 127#endif /* CONFIG_HOTPLUG_CPU */
118 128
119#ifdef CONFIG_SUSPEND_SMP 129#ifdef CONFIG_SUSPEND_SMP
130extern int suspend_cpu_hotplug;
131
120extern int disable_nonboot_cpus(void); 132extern int disable_nonboot_cpus(void);
121extern void enable_nonboot_cpus(void); 133extern void enable_nonboot_cpus(void);
122#else 134#else
135#define suspend_cpu_hotplug 0
136
123static inline int disable_nonboot_cpus(void) { return 0; } 137static inline int disable_nonboot_cpus(void) { return 0; }
124static inline void enable_nonboot_cpus(void) {} 138static inline void enable_nonboot_cpus(void) {}
125#endif 139#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 7f008f6bfdc3..0899e2cdcdd1 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -84,9 +84,6 @@ struct cpufreq_policy {
84 unsigned int policy; /* see above */ 84 unsigned int policy; /* see above */
85 struct cpufreq_governor *governor; /* see below */ 85 struct cpufreq_governor *governor; /* see below */
86 86
87 struct mutex lock; /* CPU ->setpolicy or ->target may
88 only be called once a time */
89
90 struct work_struct update; /* if update_policy() needs to be 87 struct work_struct update; /* if update_policy() needs to be
91 * called, but you're in IRQ context */ 88 * called, but you're in IRQ context */
92 89
@@ -172,11 +169,16 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
172 unsigned int relation); 169 unsigned int relation);
173 170
174 171
175extern int cpufreq_driver_getavg(struct cpufreq_policy *policy); 172extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy);
176 173
177int cpufreq_register_governor(struct cpufreq_governor *governor); 174int cpufreq_register_governor(struct cpufreq_governor *governor);
178void cpufreq_unregister_governor(struct cpufreq_governor *governor); 175void cpufreq_unregister_governor(struct cpufreq_governor *governor);
179 176
177int lock_policy_rwsem_read(int cpu);
178int lock_policy_rwsem_write(int cpu);
179void unlock_policy_rwsem_read(int cpu);
180void unlock_policy_rwsem_write(int cpu);
181
180 182
181/********************************************************************* 183/*********************************************************************
182 * CPUFREQ DRIVER INTERFACE * 184 * CPUFREQ DRIVER INTERFACE *
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d0e8c8b0e34d..23f55140ccd5 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -398,11 +398,11 @@ extern cpumask_t cpu_present_map;
398#endif 398#endif
399 399
400#ifdef CONFIG_SMP 400#ifdef CONFIG_SMP
401int highest_possible_processor_id(void); 401extern int nr_cpu_ids;
402#define any_online_cpu(mask) __any_online_cpu(&(mask)) 402#define any_online_cpu(mask) __any_online_cpu(&(mask))
403int __any_online_cpu(const cpumask_t *mask); 403int __any_online_cpu(const cpumask_t *mask);
404#else 404#else
405#define highest_possible_processor_id() 0 405#define nr_cpu_ids 1
406#define any_online_cpu(mask) 0 406#define any_online_cpu(mask) 0
407#endif 407#endif
408 408
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index fd404416f31c..826b15e914e2 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -55,7 +55,7 @@ extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
55extern int cpuset_memory_pressure_enabled; 55extern int cpuset_memory_pressure_enabled;
56extern void __cpuset_memory_pressure_bump(void); 56extern void __cpuset_memory_pressure_bump(void);
57 57
58extern struct file_operations proc_cpuset_operations; 58extern const struct file_operations proc_cpuset_operations;
59extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer); 59extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
60 60
61extern void cpuset_lock(void); 61extern void cpuset_lock(void);
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 4aa9046601da..779aa78ee643 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -51,15 +51,9 @@
51/* 51/*
52 * Transform masks and values (for crt_flags). 52 * Transform masks and values (for crt_flags).
53 */ 53 */
54#define CRYPTO_TFM_MODE_MASK 0x000000ff
55#define CRYPTO_TFM_REQ_MASK 0x000fff00 54#define CRYPTO_TFM_REQ_MASK 0x000fff00
56#define CRYPTO_TFM_RES_MASK 0xfff00000 55#define CRYPTO_TFM_RES_MASK 0xfff00000
57 56
58#define CRYPTO_TFM_MODE_ECB 0x00000001
59#define CRYPTO_TFM_MODE_CBC 0x00000002
60#define CRYPTO_TFM_MODE_CFB 0x00000004
61#define CRYPTO_TFM_MODE_CTR 0x00000008
62
63#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 57#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100
64#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200 58#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
65#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 59#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
@@ -71,12 +65,8 @@
71/* 65/*
72 * Miscellaneous stuff. 66 * Miscellaneous stuff.
73 */ 67 */
74#define CRYPTO_UNSPEC 0
75#define CRYPTO_MAX_ALG_NAME 64 68#define CRYPTO_MAX_ALG_NAME 64
76 69
77#define CRYPTO_DIR_ENCRYPT 1
78#define CRYPTO_DIR_DECRYPT 0
79
80/* 70/*
81 * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual 71 * 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 72 * declaration) is used to ensure that the crypto_tfm context structure is
@@ -148,19 +138,6 @@ struct cipher_alg {
148 unsigned int keylen); 138 unsigned int keylen);
149 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 139 void (*cia_encrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
150 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src); 140 void (*cia_decrypt)(struct crypto_tfm *tfm, u8 *dst, const u8 *src);
151
152 unsigned int (*cia_encrypt_ecb)(const struct cipher_desc *desc,
153 u8 *dst, const u8 *src,
154 unsigned int nbytes) __deprecated;
155 unsigned int (*cia_decrypt_ecb)(const struct cipher_desc *desc,
156 u8 *dst, const u8 *src,
157 unsigned int nbytes) __deprecated;
158 unsigned int (*cia_encrypt_cbc)(const struct cipher_desc *desc,
159 u8 *dst, const u8 *src,
160 unsigned int nbytes) __deprecated;
161 unsigned int (*cia_decrypt_cbc)(const struct cipher_desc *desc,
162 u8 *dst, const u8 *src,
163 unsigned int nbytes) __deprecated;
164}; 141};
165 142
166struct digest_alg { 143struct digest_alg {
@@ -243,11 +220,6 @@ int crypto_unregister_alg(struct crypto_alg *alg);
243#ifdef CONFIG_CRYPTO 220#ifdef CONFIG_CRYPTO
244int crypto_has_alg(const char *name, u32 type, u32 mask); 221int crypto_has_alg(const char *name, u32 type, u32 mask);
245#else 222#else
246static inline int crypto_alg_available(const char *name, u32 flags)
247{
248 return 0;
249}
250
251static inline int crypto_has_alg(const char *name, u32 type, u32 mask) 223static inline int crypto_has_alg(const char *name, u32 type, u32 mask)
252{ 224{
253 return 0; 225 return 0;
@@ -339,13 +311,18 @@ struct crypto_tfm {
339 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; 311 void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
340}; 312};
341 313
342#define crypto_cipher crypto_tfm
343#define crypto_comp crypto_tfm
344
345struct crypto_blkcipher { 314struct crypto_blkcipher {
346 struct crypto_tfm base; 315 struct crypto_tfm base;
347}; 316};
348 317
318struct crypto_cipher {
319 struct crypto_tfm base;
320};
321
322struct crypto_comp {
323 struct crypto_tfm base;
324};
325
349struct crypto_hash { 326struct crypto_hash {
350 struct crypto_tfm base; 327 struct crypto_tfm base;
351}; 328};
@@ -395,40 +372,11 @@ static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
395 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 372 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
396} 373}
397 374
398static unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
399 __deprecated;
400static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm)
401{
402 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
403 return tfm->__crt_alg->cra_cipher.cia_min_keysize;
404}
405
406static unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
407 __deprecated;
408static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm)
409{
410 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
411 return tfm->__crt_alg->cra_cipher.cia_max_keysize;
412}
413
414static unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) __deprecated;
415static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm)
416{
417 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
418 return tfm->crt_cipher.cit_ivsize;
419}
420
421static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) 375static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm)
422{ 376{
423 return tfm->__crt_alg->cra_blocksize; 377 return tfm->__crt_alg->cra_blocksize;
424} 378}
425 379
426static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm)
427{
428 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
429 return tfm->__crt_alg->cra_digest.dia_digestsize;
430}
431
432static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm) 380static inline unsigned int crypto_tfm_alg_alignmask(struct crypto_tfm *tfm)
433{ 381{
434 return tfm->__crt_alg->cra_alignmask; 382 return tfm->__crt_alg->cra_alignmask;
@@ -633,7 +581,7 @@ static inline struct crypto_cipher *crypto_alloc_cipher(const char *alg_name,
633 581
634static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm) 582static inline struct crypto_tfm *crypto_cipher_tfm(struct crypto_cipher *tfm)
635{ 583{
636 return tfm; 584 return &tfm->base;
637} 585}
638 586
639static inline void crypto_free_cipher(struct crypto_cipher *tfm) 587static inline void crypto_free_cipher(struct crypto_cipher *tfm)
@@ -809,76 +757,6 @@ static inline int crypto_hash_setkey(struct crypto_hash *hash,
809 return crypto_hash_crt(hash)->setkey(hash, key, keylen); 757 return crypto_hash_crt(hash)->setkey(hash, key, keylen);
810} 758}
811 759
812static int crypto_cipher_encrypt(struct crypto_tfm *tfm,
813 struct scatterlist *dst,
814 struct scatterlist *src,
815 unsigned int nbytes) __deprecated;
816static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
817 struct scatterlist *dst,
818 struct scatterlist *src,
819 unsigned int nbytes)
820{
821 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
822 return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
823}
824
825static int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
826 struct scatterlist *dst,
827 struct scatterlist *src,
828 unsigned int nbytes, u8 *iv) __deprecated;
829static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
830 struct scatterlist *dst,
831 struct scatterlist *src,
832 unsigned int nbytes, u8 *iv)
833{
834 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
835 return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
836}
837
838static int crypto_cipher_decrypt(struct crypto_tfm *tfm,
839 struct scatterlist *dst,
840 struct scatterlist *src,
841 unsigned int nbytes) __deprecated;
842static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
843 struct scatterlist *dst,
844 struct scatterlist *src,
845 unsigned int nbytes)
846{
847 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
848 return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
849}
850
851static int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
852 struct scatterlist *dst,
853 struct scatterlist *src,
854 unsigned int nbytes, u8 *iv) __deprecated;
855static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
856 struct scatterlist *dst,
857 struct scatterlist *src,
858 unsigned int nbytes, u8 *iv)
859{
860 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
861 return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv);
862}
863
864static void crypto_cipher_set_iv(struct crypto_tfm *tfm,
865 const u8 *src, unsigned int len) __deprecated;
866static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
867 const u8 *src, unsigned int len)
868{
869 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
870 memcpy(tfm->crt_cipher.cit_iv, src, len);
871}
872
873static void crypto_cipher_get_iv(struct crypto_tfm *tfm,
874 u8 *dst, unsigned int len) __deprecated;
875static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
876 u8 *dst, unsigned int len)
877{
878 BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
879 memcpy(dst, tfm->crt_cipher.cit_iv, len);
880}
881
882static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm) 760static inline struct crypto_comp *__crypto_comp_cast(struct crypto_tfm *tfm)
883{ 761{
884 return (struct crypto_comp *)tfm; 762 return (struct crypto_comp *)tfm;
@@ -903,7 +781,7 @@ static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,
903 781
904static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm) 782static inline struct crypto_tfm *crypto_comp_tfm(struct crypto_comp *tfm)
905{ 783{
906 return tfm; 784 return &tfm->base;
907} 785}
908 786
909static inline void crypto_free_comp(struct crypto_comp *tfm) 787static inline void crypto_free_comp(struct crypto_comp *tfm)
@@ -934,14 +812,16 @@ static inline int crypto_comp_compress(struct crypto_comp *tfm,
934 const u8 *src, unsigned int slen, 812 const u8 *src, unsigned int slen,
935 u8 *dst, unsigned int *dlen) 813 u8 *dst, unsigned int *dlen)
936{ 814{
937 return crypto_comp_crt(tfm)->cot_compress(tfm, src, slen, dst, dlen); 815 return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm),
816 src, slen, dst, dlen);
938} 817}
939 818
940static inline int crypto_comp_decompress(struct crypto_comp *tfm, 819static inline int crypto_comp_decompress(struct crypto_comp *tfm,
941 const u8 *src, unsigned int slen, 820 const u8 *src, unsigned int slen,
942 u8 *dst, unsigned int *dlen) 821 u8 *dst, unsigned int *dlen)
943{ 822{
944 return crypto_comp_crt(tfm)->cot_decompress(tfm, src, slen, dst, dlen); 823 return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm),
824 src, slen, dst, dlen);
945} 825}
946 826
947#endif /* _LINUX_CRYPTO_H */ 827#endif /* _LINUX_CRYPTO_H */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 1cb054bd93f2..fda2148d8c85 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -260,19 +260,20 @@ enum {
260 260
261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
262{ 262{
263 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb_transport_header(skb);
264} 264}
265 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) 266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{ 267{
268 skb->h.raw = skb_push(skb, headlen); 268 skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen); 269 skb_reset_transport_header(skb);
270 return dccp_hdr(skb); 270 return memset(skb_transport_header(skb), 0, headlen);
271} 271}
272 272
273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
274{ 274{
275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
276 sizeof(struct dccp_hdr));
276} 277}
277 278
278static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) 279static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
301 302
302static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) 303static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
303{ 304{
304 return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); 305 return (struct dccp_hdr_request *)(skb_transport_header(skb) +
306 dccp_basic_hdr_len(skb));
305} 307}
306 308
307static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) 309static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
308{ 310{
309 return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); 311 return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
312 dccp_basic_hdr_len(skb));
310} 313}
311 314
312static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 315static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
317 320
318static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 321static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
319{ 322{
320 return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); 323 return (struct dccp_hdr_response *)(skb_transport_header(skb) +
324 dccp_basic_hdr_len(skb));
321} 325}
322 326
323static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) 327static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
324{ 328{
325 return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); 329 return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
330 dccp_basic_hdr_len(skb));
326} 331}
327 332
328static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) 333static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
@@ -460,26 +465,27 @@ struct dccp_ackvec;
460 * @dccps_service_list - second .. last service code on passive socket 465 * @dccps_service_list - second .. last service code on passive socket
461 * @dccps_timestamp_time - time of latest TIMESTAMP option 466 * @dccps_timestamp_time - time of latest TIMESTAMP option
462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 467 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
463 * @dccps_l_ack_ratio - 468 * @dccps_l_ack_ratio - feature-local Ack Ratio
464 * @dccps_r_ack_ratio - 469 * @dccps_r_ack_ratio - feature-remote Ack Ratio
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 470 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 471 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
467 * @dccps_ndp_count - number of Non Data Packets since last data packet 472 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache - 473 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
469 * @dccps_minisock - 474 * @dccps_minisock - associated minisock (accessed via dccp_msk)
470 * @dccps_hc_rx_ackvec - rx half connection ack vector 475 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid - 476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
472 * @dccps_hc_tx_ccid - 477 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
473 * @dccps_options_received - 478 * @dccps_options_received - parsed set of retrieved options
474 * @dccps_epoch - 479 * @dccps_role - role of this sock, one of %dccp_role
475 * @dccps_role - Role of this sock, one of %dccp_role 480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
476 * @dccps_hc_rx_insert_options - 481 * @dccps_hc_tx_insert_options - sender wants to add options when sending
477 * @dccps_hc_tx_insert_options -
478 * @dccps_xmit_timer - timer for when CCID is not ready to send 482 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
479 */ 484 */
480struct dccp_sock { 485struct dccp_sock {
481 /* inet_connection_sock has to be the first member of dccp_sock */ 486 /* inet_connection_sock has to be the first member of dccp_sock */
482 struct inet_connection_sock dccps_inet_connection; 487 struct inet_connection_sock dccps_inet_connection;
488#define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
483 __u64 dccps_swl; 489 __u64 dccps_swl;
484 __u64 dccps_swh; 490 __u64 dccps_swh;
485 __u64 dccps_awl; 491 __u64 dccps_awl;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 047567d34ca7..5a9c49534d08 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -33,6 +33,9 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
33 33
34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); 34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
35 35
36struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
37 const char *dest);
38
36void debugfs_remove(struct dentry *dentry); 39void debugfs_remove(struct dentry *dentry);
37 40
38struct dentry *debugfs_create_u8(const char *name, mode_t mode, 41struct dentry *debugfs_create_u8(const char *name, mode_t mode,
@@ -41,6 +44,8 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode,
41 struct dentry *parent, u16 *value); 44 struct dentry *parent, u16 *value);
42struct dentry *debugfs_create_u32(const char *name, mode_t mode, 45struct dentry *debugfs_create_u32(const char *name, mode_t mode,
43 struct dentry *parent, u32 *value); 46 struct dentry *parent, u32 *value);
47struct dentry *debugfs_create_u64(const char *name, mode_t mode,
48 struct dentry *parent, u64 *value);
44struct dentry *debugfs_create_bool(const char *name, mode_t mode, 49struct dentry *debugfs_create_bool(const char *name, mode_t mode,
45 struct dentry *parent, u32 *value); 50 struct dentry *parent, u32 *value);
46 51
@@ -70,6 +75,13 @@ static inline struct dentry *debugfs_create_dir(const char *name,
70 return ERR_PTR(-ENODEV); 75 return ERR_PTR(-ENODEV);
71} 76}
72 77
78static inline struct dentry *debugfs_create_symlink(const char *name,
79 struct dentry *parent,
80 const char *dest)
81{
82 return ERR_PTR(-ENODEV);
83}
84
73static inline void debugfs_remove(struct dentry *dentry) 85static inline void debugfs_remove(struct dentry *dentry)
74{ } 86{ }
75 87
@@ -94,6 +106,13 @@ static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode,
94 return ERR_PTR(-ENODEV); 106 return ERR_PTR(-ENODEV);
95} 107}
96 108
109static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode,
110 struct dentry *parent,
111 u64 *value)
112{
113 return ERR_PTR(-ENODEV);
114}
115
97static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 116static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
98 struct dentry *parent, 117 struct dentry *parent,
99 u32 *value) 118 u32 *value)
diff --git a/include/linux/device.h b/include/linux/device.h
index f44247fe8135..a0cd2ced31a9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -2,6 +2,7 @@
2 * device.h - generic, centralized driver model 2 * device.h - generic, centralized driver model
3 * 3 *
4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> 4 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
5 * Copyright (c) 2004-2007 Greg Kroah-Hartman <gregkh@suse.de>
5 * 6 *
6 * This file is released under the GPLv2 7 * This file is released under the GPLv2
7 * 8 *
@@ -33,9 +34,24 @@ struct device;
33struct device_driver; 34struct device_driver;
34struct class; 35struct class;
35struct class_device; 36struct class_device;
37struct bus_type;
38
39struct bus_attribute {
40 struct attribute attr;
41 ssize_t (*show)(struct bus_type *, char * buf);
42 ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
43};
44
45#define BUS_ATTR(_name,_mode,_show,_store) \
46struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
47
48extern int __must_check bus_create_file(struct bus_type *,
49 struct bus_attribute *);
50extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
36 51
37struct bus_type { 52struct bus_type {
38 const char * name; 53 const char * name;
54 struct module * owner;
39 55
40 struct subsystem subsys; 56 struct subsystem subsys;
41 struct kset drivers; 57 struct kset drivers;
@@ -48,6 +64,8 @@ struct bus_type {
48 struct bus_attribute * bus_attrs; 64 struct bus_attribute * bus_attrs;
49 struct device_attribute * dev_attrs; 65 struct device_attribute * dev_attrs;
50 struct driver_attribute * drv_attrs; 66 struct driver_attribute * drv_attrs;
67 struct bus_attribute drivers_autoprobe_attr;
68 struct bus_attribute drivers_probe_attr;
51 69
52 int (*match)(struct device * dev, struct device_driver * drv); 70 int (*match)(struct device * dev, struct device_driver * drv);
53 int (*uevent)(struct device *dev, char **envp, 71 int (*uevent)(struct device *dev, char **envp,
@@ -60,6 +78,9 @@ struct bus_type {
60 int (*suspend_late)(struct device * dev, pm_message_t state); 78 int (*suspend_late)(struct device * dev, pm_message_t state);
61 int (*resume_early)(struct device * dev); 79 int (*resume_early)(struct device * dev);
62 int (*resume)(struct device * dev); 80 int (*resume)(struct device * dev);
81
82 unsigned int drivers_autoprobe:1;
83 unsigned int multithread_probe:1;
63}; 84};
64 85
65extern int __must_check bus_register(struct bus_type * bus); 86extern int __must_check bus_register(struct bus_type * bus);
@@ -101,39 +122,23 @@ extern int bus_unregister_notifier(struct bus_type *bus,
101#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 122#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
102 unbound */ 123 unbound */
103 124
104/* driverfs interface for exporting bus attributes */
105
106struct bus_attribute {
107 struct attribute attr;
108 ssize_t (*show)(struct bus_type *, char * buf);
109 ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
110};
111
112#define BUS_ATTR(_name,_mode,_show,_store) \
113struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store)
114
115extern int __must_check bus_create_file(struct bus_type *,
116 struct bus_attribute *);
117extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
118
119struct device_driver { 125struct device_driver {
120 const char * name; 126 const char * name;
121 struct bus_type * bus; 127 struct bus_type * bus;
122 128
123 struct completion unloaded;
124 struct kobject kobj; 129 struct kobject kobj;
125 struct klist klist_devices; 130 struct klist klist_devices;
126 struct klist_node knode_bus; 131 struct klist_node knode_bus;
127 132
128 struct module * owner; 133 struct module * owner;
134 const char * mod_name; /* used for built-in modules */
135 struct module_kobject * mkobj;
129 136
130 int (*probe) (struct device * dev); 137 int (*probe) (struct device * dev);
131 int (*remove) (struct device * dev); 138 int (*remove) (struct device * dev);
132 void (*shutdown) (struct device * dev); 139 void (*shutdown) (struct device * dev);
133 int (*suspend) (struct device * dev, pm_message_t state); 140 int (*suspend) (struct device * dev, pm_message_t state);
134 int (*resume) (struct device * dev); 141 int (*resume) (struct device * dev);
135
136 unsigned int multithread_probe:1;
137}; 142};
138 143
139 144
@@ -145,7 +150,7 @@ extern void put_driver(struct device_driver * drv);
145extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 150extern struct device_driver *driver_find(const char *name, struct bus_type *bus);
146extern int driver_probe_done(void); 151extern int driver_probe_done(void);
147 152
148/* driverfs interface for exporting driver attributes */ 153/* sysfs interface for exporting driver attributes */
149 154
150struct driver_attribute { 155struct driver_attribute {
151 struct attribute attr; 156 struct attribute attr;
@@ -178,10 +183,9 @@ struct class {
178 struct list_head children; 183 struct list_head children;
179 struct list_head devices; 184 struct list_head devices;
180 struct list_head interfaces; 185 struct list_head interfaces;
186 struct kset class_dirs;
181 struct semaphore sem; /* locks both the children and interfaces lists */ 187 struct semaphore sem; /* locks both the children and interfaces lists */
182 188
183 struct kobject *virtual_dir;
184
185 struct class_attribute * class_attrs; 189 struct class_attribute * class_attrs;
186 struct class_device_attribute * class_dev_attrs; 190 struct class_device_attribute * class_dev_attrs;
187 struct device_attribute * dev_attrs; 191 struct device_attribute * dev_attrs;
@@ -292,8 +296,6 @@ extern void class_device_initialize(struct class_device *);
292extern int __must_check class_device_add(struct class_device *); 296extern int __must_check class_device_add(struct class_device *);
293extern void class_device_del(struct class_device *); 297extern void class_device_del(struct class_device *);
294 298
295extern int class_device_rename(struct class_device *, char *);
296
297extern struct class_device * class_device_get(struct class_device *); 299extern struct class_device * class_device_get(struct class_device *);
298extern void class_device_put(struct class_device *); 300extern void class_device_put(struct class_device *);
299 301
@@ -327,6 +329,25 @@ extern struct class_device *class_device_create(struct class *cls,
327 __attribute__((format(printf,5,6))); 329 __attribute__((format(printf,5,6)));
328extern void class_device_destroy(struct class *cls, dev_t devt); 330extern void class_device_destroy(struct class *cls, dev_t devt);
329 331
332/*
333 * The type of device, "struct device" is embedded in. A class
334 * or bus can contain devices of different types
335 * like "partitions" and "disks", "mouse" and "event".
336 * This identifies the device type and carries type-specific
337 * information, equivalent to the kobj_type of a kobject.
338 * If "name" is specified, the uevent will contain it in
339 * the DEVTYPE variable.
340 */
341struct device_type {
342 const char *name;
343 struct attribute_group **groups;
344 int (*uevent)(struct device *dev, char **envp, int num_envp,
345 char *buffer, int buffer_size);
346 void (*release)(struct device *dev);
347 int (*suspend)(struct device * dev, pm_message_t state);
348 int (*resume)(struct device * dev);
349};
350
330/* interface for exporting device attributes */ 351/* interface for exporting device attributes */
331struct device_attribute { 352struct device_attribute {
332 struct attribute attr; 353 struct attribute attr;
@@ -346,6 +367,47 @@ extern int __must_check device_create_bin_file(struct device *dev,
346 struct bin_attribute *attr); 367 struct bin_attribute *attr);
347extern void device_remove_bin_file(struct device *dev, 368extern void device_remove_bin_file(struct device *dev,
348 struct bin_attribute *attr); 369 struct bin_attribute *attr);
370extern int device_schedule_callback_owner(struct device *dev,
371 void (*func)(struct device *), struct module *owner);
372
373/* This is a macro to avoid include problems with THIS_MODULE */
374#define device_schedule_callback(dev, func) \
375 device_schedule_callback_owner(dev, func, THIS_MODULE)
376
377/* device resource management */
378typedef void (*dr_release_t)(struct device *dev, void *res);
379typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
380
381#ifdef CONFIG_DEBUG_DEVRES
382extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
383 const char *name);
384#define devres_alloc(release, size, gfp) \
385 __devres_alloc(release, size, gfp, #release)
386#else
387extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
388#endif
389extern void devres_free(void *res);
390extern void devres_add(struct device *dev, void *res);
391extern void * devres_find(struct device *dev, dr_release_t release,
392 dr_match_t match, void *match_data);
393extern void * devres_get(struct device *dev, void *new_res,
394 dr_match_t match, void *match_data);
395extern void * devres_remove(struct device *dev, dr_release_t release,
396 dr_match_t match, void *match_data);
397extern int devres_destroy(struct device *dev, dr_release_t release,
398 dr_match_t match, void *match_data);
399
400/* devres group */
401extern void * __must_check devres_open_group(struct device *dev, void *id,
402 gfp_t gfp);
403extern void devres_close_group(struct device *dev, void *id);
404extern void devres_remove_group(struct device *dev, void *id);
405extern int devres_release_group(struct device *dev, void *id);
406
407/* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */
408extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
409extern void devm_kfree(struct device *dev, void *p);
410
349struct device { 411struct device {
350 struct klist klist_children; 412 struct klist klist_children;
351 struct klist_node knode_parent; /* node in sibling list */ 413 struct klist_node knode_parent; /* node in sibling list */
@@ -355,6 +417,7 @@ struct device {
355 417
356 struct kobject kobj; 418 struct kobject kobj;
357 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 419 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
420 struct device_type *type;
358 unsigned is_registered:1; 421 unsigned is_registered:1;
359 struct device_attribute uevent_attr; 422 struct device_attribute uevent_attr;
360 struct device_attribute *devt_attr; 423 struct device_attribute *devt_attr;
@@ -388,11 +451,15 @@ struct device {
388 /* arch specific additions */ 451 /* arch specific additions */
389 struct dev_archdata archdata; 452 struct dev_archdata archdata;
390 453
454 spinlock_t devres_lock;
455 struct list_head devres_head;
456
391 /* class_device migration path */ 457 /* class_device migration path */
392 struct list_head node; 458 struct list_head node;
393 struct class *class; /* optional*/ 459 struct class *class;
394 dev_t devt; /* dev_t, creates the sysfs "dev" */ 460 dev_t devt; /* dev_t, creates the sysfs "dev" */
395 struct attribute_group **groups; /* optional groups */ 461 struct attribute_group **groups; /* optional groups */
462 int uevent_suppress;
396 463
397 void (*release)(struct device * dev); 464 void (*release)(struct device * dev);
398}; 465};
@@ -504,7 +571,11 @@ extern const char *dev_driver_string(struct device *dev);
504#define dev_dbg(dev, format, arg...) \ 571#define dev_dbg(dev, format, arg...) \
505 dev_printk(KERN_DEBUG , dev , format , ## arg) 572 dev_printk(KERN_DEBUG , dev , format , ## arg)
506#else 573#else
507#define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0) 574static inline int __attribute__ ((format (printf, 2, 3)))
575dev_dbg(struct device * dev, const char * fmt, ...)
576{
577 return 0;
578}
508#endif 579#endif
509 580
510#define dev_err(dev, format, arg...) \ 581#define dev_err(dev, format, arg...) \
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ff203c465fed..9a663c6db16a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -66,6 +66,33 @@ dma_mark_declared_memory_occupied(struct device *dev,
66} 66}
67#endif 67#endif
68 68
69#endif 69/*
70 * Managed DMA API
71 */
72extern void *dmam_alloc_coherent(struct device *dev, size_t size,
73 dma_addr_t *dma_handle, gfp_t gfp);
74extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
75 dma_addr_t dma_handle);
76extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
77 dma_addr_t *dma_handle, gfp_t gfp);
78extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
79 dma_addr_t dma_handle);
80#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
81extern int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
82 dma_addr_t device_addr, size_t size,
83 int flags);
84extern void dmam_release_declared_memory(struct device *dev);
85#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
86static inline int dmam_declare_coherent_memory(struct device *dev,
87 dma_addr_t bus_addr, dma_addr_t device_addr,
88 size_t size, gfp_t gfp)
89{
90 return 0;
91}
70 92
93static inline void dmam_release_declared_memory(struct device *dev)
94{
95}
96#endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
71 97
98#endif
diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h
index 76f12f46db7f..022e34fcbd1b 100644
--- a/include/linux/dmapool.h
+++ b/include/linux/dmapool.h
@@ -24,5 +24,12 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
24 24
25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); 25void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
26 26
27/*
28 * Managed DMA pool
29 */
30struct dma_pool *dmam_pool_create(const char *name, struct device *dev,
31 size_t size, size_t align, size_t allocation);
32void dmam_pool_destroy(struct dma_pool *pool);
33
27#endif 34#endif
28 35
diff --git a/include/linux/dn.h b/include/linux/dn.h
index 10b6a6fd5837..02bba040fcfb 100644
--- a/include/linux/dn.h
+++ b/include/linux/dn.h
@@ -113,7 +113,7 @@ struct accessdata_dn
113 * DECnet logical link information structure 113 * DECnet logical link information structure
114 */ 114 */
115struct linkinfo_dn { 115struct linkinfo_dn {
116 __le16 idn_segsize; /* Segment size for link */ 116 __u16 idn_segsize; /* Segment size for link */
117 __u8 idn_linkstate; /* Logical link state */ 117 __u8 idn_linkstate; /* Logical link state */
118}; 118};
119 119
diff --git a/include/linux/ds1742rtc.h b/include/linux/ds1742rtc.h
deleted file mode 100644
index a83cdd1cafc9..000000000000
--- a/include/linux/ds1742rtc.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * ds1742rtc.h - register definitions for the Real-Time-Clock / CMOS RAM
3 *
4 * Copyright (C) 1999-2001 Toshiba Corporation
5 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
6 *
7 * Permission is hereby granted to copy, modify and redistribute this code
8 * in terms of the GNU Library General Public License, Version 2 or later,
9 * at your option.
10 */
11#ifndef __LINUX_DS1742RTC_H
12#define __LINUX_DS1742RTC_H
13
14#include <asm/ds1742.h>
15
16#define RTC_BRAM_SIZE 0x800
17#define RTC_OFFSET 0x7f8
18
19/*
20 * Register summary
21 */
22#define RTC_CONTROL (RTC_OFFSET + 0)
23#define RTC_CENTURY (RTC_OFFSET + 0)
24#define RTC_SECONDS (RTC_OFFSET + 1)
25#define RTC_MINUTES (RTC_OFFSET + 2)
26#define RTC_HOURS (RTC_OFFSET + 3)
27#define RTC_DAY (RTC_OFFSET + 4)
28#define RTC_DATE (RTC_OFFSET + 5)
29#define RTC_MONTH (RTC_OFFSET + 6)
30#define RTC_YEAR (RTC_OFFSET + 7)
31
32#define RTC_CENTURY_MASK 0x3f
33#define RTC_SECONDS_MASK 0x7f
34#define RTC_DAY_MASK 0x07
35
36/*
37 * Bits in the Control/Century register
38 */
39#define RTC_WRITE 0x80
40#define RTC_READ 0x40
41
42/*
43 * Bits in the Seconds register
44 */
45#define RTC_STOP 0x80
46
47/*
48 * Bits in the Day register
49 */
50#define RTC_BATT_FLAG 0x80
51#define RTC_FREQ_TEST 0x40
52
53#endif /* __LINUX_DS1742RTC_H */
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index 0874a67c6b92..89412e18f571 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -47,7 +47,9 @@ typedef enum {
47typedef enum { 47typedef enum {
48 AUDIO_STEREO, 48 AUDIO_STEREO,
49 AUDIO_MONO_LEFT, 49 AUDIO_MONO_LEFT,
50 AUDIO_MONO_RIGHT 50 AUDIO_MONO_RIGHT,
51 AUDIO_MONO,
52 AUDIO_STEREO_SWAPPED
51} audio_channel_select_t; 53} audio_channel_select_t;
52 54
53 55
@@ -133,5 +135,6 @@ typedef uint16_t audio_attributes_t;
133 * extracted by the PES parser. 135 * extracted by the PES parser.
134 */ 136 */
135#define AUDIO_GET_PTS _IOR('o', 19, __u64) 137#define AUDIO_GET_PTS _IOR('o', 19, __u64)
138#define AUDIO_BILINGUAL_CHANNEL_SELECT _IO('o', 20)
136 139
137#endif /* _DVBAUDIO_H_ */ 140#endif /* _DVBAUDIO_H_ */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 6183c9c4849e..126e0c26cb09 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 3 26#define DVB_API_VERSION 3
27#define DVB_API_VERSION_MINOR 1 27#define DVB_API_VERSION_MINOR 2
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index faebfda397ff..93e4c3a6d190 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -80,14 +80,70 @@ typedef enum {
80} video_play_state_t; 80} video_play_state_t;
81 81
82 82
83/* Decoder commands */
84#define VIDEO_CMD_PLAY (0)
85#define VIDEO_CMD_STOP (1)
86#define VIDEO_CMD_FREEZE (2)
87#define VIDEO_CMD_CONTINUE (3)
88
89/* Flags for VIDEO_CMD_FREEZE */
90#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
91
92/* Flags for VIDEO_CMD_STOP */
93#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
94#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
95
96/* Play input formats: */
97/* The decoder has no special format requirements */
98#define VIDEO_PLAY_FMT_NONE (0)
99/* The decoder requires full GOPs */
100#define VIDEO_PLAY_FMT_GOP (1)
101
102/* The structure must be zeroed before use by the application
103 This ensures it can be extended safely in the future. */
104struct video_command {
105 __u32 cmd;
106 __u32 flags;
107 union {
108 struct {
109 __u64 pts;
110 } stop;
111
112 struct {
113 /* 0 or 1000 specifies normal speed,
114 1 specifies forward single stepping,
115 -1 specifies backward single stepping,
116 >1: playback at speed/1000 of the normal speed,
117 <-1: reverse playback at (-speed/1000) of the normal speed. */
118 __s32 speed;
119 __u32 format;
120 } play;
121
122 struct {
123 __u32 data[16];
124 } raw;
125 };
126};
127
128/* FIELD_UNKNOWN can be used if the hardware does not know whether
129 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
130 field. */
131#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
132#define VIDEO_VSYNC_FIELD_ODD (1)
133#define VIDEO_VSYNC_FIELD_EVEN (2)
134#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
135
83struct video_event { 136struct video_event {
84 int32_t type; 137 int32_t type;
85#define VIDEO_EVENT_SIZE_CHANGED 1 138#define VIDEO_EVENT_SIZE_CHANGED 1
86#define VIDEO_EVENT_FRAME_RATE_CHANGED 2 139#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
140#define VIDEO_EVENT_DECODER_STOPPED 3
141#define VIDEO_EVENT_VSYNC 4
87 time_t timestamp; 142 time_t timestamp;
88 union { 143 union {
89 video_size_t size; 144 video_size_t size;
90 unsigned int frame_rate; /* in frames per 1000sec */ 145 unsigned int frame_rate; /* in frames per 1000sec */
146 unsigned char vsync_field; /* unknown/odd/even/progressive */
91 } u; 147 } u;
92}; 148};
93 149
@@ -213,4 +269,10 @@ typedef uint16_t video_attributes_t;
213 */ 269 */
214#define VIDEO_GET_PTS _IOR('o', 57, __u64) 270#define VIDEO_GET_PTS _IOR('o', 57, __u64)
215 271
272/* Read the number of displayed frames since the decoder was started */
273#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
274
275#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
276#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
277
216#endif /*_DVBVIDEO_H_*/ 278#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/efi.h b/include/linux/efi.h
index df1c91855f0e..f8ebd7c1ddb3 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -301,7 +301,7 @@ extern int __init efi_uart_console_only (void);
301extern void efi_initialize_iomem_resources(struct resource *code_resource, 301extern void efi_initialize_iomem_resources(struct resource *code_resource,
302 struct resource *data_resource); 302 struct resource *data_resource);
303extern unsigned long efi_get_time(void); 303extern unsigned long efi_get_time(void);
304extern int __init efi_set_rtc_mmss(unsigned long nowtime); 304extern int efi_set_rtc_mmss(unsigned long nowtime);
305extern int is_available_memory(efi_memory_desc_t * md); 305extern int is_available_memory(efi_memory_desc_t * md);
306extern struct efi_memory_map memmap; 306extern struct efi_memory_map memmap;
307 307
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index 278ef4495819..dfed8009ebff 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -36,7 +36,7 @@ static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
36 36
37struct statfs; 37struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern const struct inode_operations efs_dir_inode_operations;
40extern const struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern const struct address_space_operations efs_symlink_aops; 41extern const struct address_space_operations efs_symlink_aops;
42 42
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index 1ff7c1392525..fe806b6f030d 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -61,10 +61,20 @@ struct eisa_driver {
61 61
62#define to_eisa_driver(drv) container_of(drv,struct eisa_driver, driver) 62#define to_eisa_driver(drv) container_of(drv,struct eisa_driver, driver)
63 63
64/* These external functions are only available when EISA support is enabled. */
65#ifdef CONFIG_EISA
66
64extern struct bus_type eisa_bus_type; 67extern struct bus_type eisa_bus_type;
65int eisa_driver_register (struct eisa_driver *edrv); 68int eisa_driver_register (struct eisa_driver *edrv);
66void eisa_driver_unregister (struct eisa_driver *edrv); 69void eisa_driver_unregister (struct eisa_driver *edrv);
67 70
71#else /* !CONFIG_EISA */
72
73static inline int eisa_driver_register (struct eisa_driver *edrv) { return 0; }
74static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
75
76#endif /* !CONFIG_EISA */
77
68/* Mimics pci.h... */ 78/* Mimics pci.h... */
69static inline void *eisa_get_drvdata (struct eisa_device *edev) 79static inline void *eisa_get_drvdata (struct eisa_device *edev)
70{ 80{
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 84cfa8bbdc36..d2a96cbf4f0e 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -31,12 +31,19 @@
31/* 31/*
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
36 * 64_BIT adds up to UML/x86_64.
34 */ 37 */
35#ifdef __x86_64__ 38#ifdef __x86_64__
36#define EPOLL_PACKED __attribute__((packed)) 39#define EPOLL_PACKED __attribute__((packed))
37#else 40#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
38#define EPOLL_PACKED 44#define EPOLL_PACKED
39#endif 45#endif
46#endif
40 47
41struct epoll_event { 48struct epoll_event {
42 __u32 events; 49 __u32 events;
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 11cca1bdc0c7..4eb18ac510ae 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -868,16 +868,16 @@ do { \
868extern const struct file_operations ext3_dir_operations; 868extern const struct file_operations ext3_dir_operations;
869 869
870/* file.c */ 870/* file.c */
871extern struct inode_operations ext3_file_inode_operations; 871extern const struct inode_operations ext3_file_inode_operations;
872extern const struct file_operations ext3_file_operations; 872extern const struct file_operations ext3_file_operations;
873 873
874/* namei.c */ 874/* namei.c */
875extern struct inode_operations ext3_dir_inode_operations; 875extern const struct inode_operations ext3_dir_inode_operations;
876extern struct inode_operations ext3_special_inode_operations; 876extern const struct inode_operations ext3_special_inode_operations;
877 877
878/* symlink.c */ 878/* symlink.c */
879extern struct inode_operations ext3_symlink_inode_operations; 879extern const struct inode_operations ext3_symlink_inode_operations;
880extern struct inode_operations ext3_fast_symlink_inode_operations; 880extern const struct inode_operations ext3_fast_symlink_inode_operations;
881 881
882 882
883#endif /* __KERNEL__ */ 883#endif /* __KERNEL__ */
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 498503ee613d..54c576d414c3 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -955,16 +955,16 @@ do { \
955extern const struct file_operations ext4_dir_operations; 955extern const struct file_operations ext4_dir_operations;
956 956
957/* file.c */ 957/* file.c */
958extern struct inode_operations ext4_file_inode_operations; 958extern const struct inode_operations ext4_file_inode_operations;
959extern const struct file_operations ext4_file_operations; 959extern const struct file_operations ext4_file_operations;
960 960
961/* namei.c */ 961/* namei.c */
962extern struct inode_operations ext4_dir_inode_operations; 962extern const struct inode_operations ext4_dir_inode_operations;
963extern struct inode_operations ext4_special_inode_operations; 963extern const struct inode_operations ext4_special_inode_operations;
964 964
965/* symlink.c */ 965/* symlink.c */
966extern struct inode_operations ext4_symlink_inode_operations; 966extern const struct inode_operations ext4_symlink_inode_operations;
967extern struct inode_operations ext4_fast_symlink_inode_operations; 967extern const struct inode_operations ext4_fast_symlink_inode_operations;
968 968
969/* extents.c */ 969/* extents.c */
970extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 970extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index a41cc24568ca..7eb1d73fc5d1 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -22,12 +22,12 @@
22#include <linux/ext4_fs.h> 22#include <linux/ext4_fs.h>
23 23
24/* 24/*
25 * With AGRESSIVE_TEST defined, the capacity of index/leaf blocks 25 * With AGGRESSIVE_TEST defined, the capacity of index/leaf blocks
26 * becomes very small, so index split, in-depth growing and 26 * becomes very small, so index split, in-depth growing and
27 * other hard changes happen much more often. 27 * other hard changes happen much more often.
28 * This is for debug purposes only. 28 * This is for debug purposes only.
29 */ 29 */
30#define AGRESSIVE_TEST_ 30#define AGGRESSIVE_TEST_
31 31
32/* 32/*
33 * With EXTENTS_STATS defined, the number of blocks and extents 33 * With EXTENTS_STATS defined, the number of blocks and extents
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 64177ec9a019..be913ec87169 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -49,6 +49,13 @@
49#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */ 49#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
50#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */ 50#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
51#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */ 51#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
52#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */
53#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */
54#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */
55#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */
56#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */
57#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */
58#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */
52 59
53#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */ 60#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
54#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */ 61#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
@@ -509,13 +516,15 @@ struct fb_cursor_user {
509#define FB_EVENT_GET_CONSOLE_MAP 0x07 516#define FB_EVENT_GET_CONSOLE_MAP 0x07
510/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 517/* CONSOLE-SPECIFIC: set console to framebuffer mapping */
511#define FB_EVENT_SET_CONSOLE_MAP 0x08 518#define FB_EVENT_SET_CONSOLE_MAP 0x08
512/* A display blank is requested */ 519/* A hardware display blank change occured */
513#define FB_EVENT_BLANK 0x09 520#define FB_EVENT_BLANK 0x09
514/* Private modelist is to be replaced */ 521/* Private modelist is to be replaced */
515#define FB_EVENT_NEW_MODELIST 0x0A 522#define FB_EVENT_NEW_MODELIST 0x0A
516/* The resolution of the passed in fb_info about to change and 523/* The resolution of the passed in fb_info about to change and
517 all vc's should be changed */ 524 all vc's should be changed */
518#define FB_EVENT_MODE_CHANGE_ALL 0x0B 525#define FB_EVENT_MODE_CHANGE_ALL 0x0B
526/* A software display blank change occured */
527#define FB_EVENT_CONBLANK 0x0C
519 528
520struct fb_event { 529struct fb_event {
521 struct fb_info *info; 530 struct fb_info *info;
@@ -760,16 +769,13 @@ struct fb_info {
760 struct fb_videomode *mode; /* current mode */ 769 struct fb_videomode *mode; /* current mode */
761 770
762#ifdef CONFIG_FB_BACKLIGHT 771#ifdef CONFIG_FB_BACKLIGHT
763 /* Lock ordering:
764 * bl_mutex (protects bl_dev and bl_curve)
765 * bl_dev->sem (backlight class)
766 */
767 struct mutex bl_mutex;
768
769 /* assigned backlight device */ 772 /* assigned backlight device */
773 /* set before framebuffer registration,
774 remove after unregister */
770 struct backlight_device *bl_dev; 775 struct backlight_device *bl_dev;
771 776
772 /* Backlight level curve */ 777 /* Backlight level curve */
778 struct mutex bl_curve_mutex;
773 u8 bl_curve[FB_BACKLIGHT_LEVELS]; 779 u8 bl_curve[FB_BACKLIGHT_LEVELS];
774#endif 780#endif
775 781
@@ -945,25 +951,26 @@ extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
945/* drivers/video/modedb.c */ 951/* drivers/video/modedb.c */
946#define VESA_MODEDB_SIZE 34 952#define VESA_MODEDB_SIZE 34
947extern void fb_var_to_videomode(struct fb_videomode *mode, 953extern void fb_var_to_videomode(struct fb_videomode *mode,
948 struct fb_var_screeninfo *var); 954 const struct fb_var_screeninfo *var);
949extern void fb_videomode_to_var(struct fb_var_screeninfo *var, 955extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
950 struct fb_videomode *mode); 956 const struct fb_videomode *mode);
951extern int fb_mode_is_equal(struct fb_videomode *mode1, 957extern int fb_mode_is_equal(const struct fb_videomode *mode1,
952 struct fb_videomode *mode2); 958 const struct fb_videomode *mode2);
953extern int fb_add_videomode(struct fb_videomode *mode, struct list_head *head); 959extern int fb_add_videomode(const struct fb_videomode *mode,
954extern void fb_delete_videomode(struct fb_videomode *mode, 960 struct list_head *head);
961extern void fb_delete_videomode(const struct fb_videomode *mode,
955 struct list_head *head); 962 struct list_head *head);
956extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var, 963extern const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
957 struct list_head *head); 964 struct list_head *head);
958extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, 965extern const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
959 struct list_head *head); 966 struct list_head *head);
960extern struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode, 967extern const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
961 struct list_head *head); 968 struct list_head *head);
962extern void fb_destroy_modelist(struct list_head *head); 969extern void fb_destroy_modelist(struct list_head *head);
963extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, 970extern void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
964 struct list_head *head); 971 struct list_head *head);
965extern struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs, 972extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
966 struct list_head *head); 973 struct list_head *head);
967 974
968/* drivers/video/fbcmap.c */ 975/* drivers/video/fbcmap.c */
969extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); 976extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 8270aac2aa5d..87b606b63f1e 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,8 +5,13 @@
5#include <linux/rtnetlink.h> 5#include <linux/rtnetlink.h>
6 6
7/* rule is permanent, and cannot be deleted */ 7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1 8#define FIB_RULE_PERMANENT 0x00000001
9#define FIB_RULE_INVERT 2 9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004
11#define FIB_RULE_DEV_DETACHED 0x00000008
12
13/* try to find source address in routing lookups */
14#define FIB_RULE_FIND_SADDR 0x00010000
10 15
11struct fib_rule_hdr 16struct fib_rule_hdr
12{ 17{
@@ -29,7 +34,7 @@ enum
29 FRA_DST, /* destination address */ 34 FRA_DST, /* destination address */
30 FRA_SRC, /* source address */ 35 FRA_SRC, /* source address */
31 FRA_IFNAME, /* interface name */ 36 FRA_IFNAME, /* interface name */
32 FRA_UNUSED1, 37 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
33 FRA_UNUSED2, 38 FRA_UNUSED2,
34 FRA_PRIORITY, /* priority/preference */ 39 FRA_PRIORITY, /* priority/preference */
35 FRA_UNUSED3, 40 FRA_UNUSED3,
@@ -51,8 +56,8 @@ enum
51{ 56{
52 FR_ACT_UNSPEC, 57 FR_ACT_UNSPEC,
53 FR_ACT_TO_TBL, /* Pass to fixed table */ 58 FR_ACT_TO_TBL, /* Pass to fixed table */
54 FR_ACT_RES1, 59 FR_ACT_GOTO, /* Jump to another rule */
55 FR_ACT_RES2, 60 FR_ACT_NOP, /* No operation */
56 FR_ACT_RES3, 61 FR_ACT_RES3,
57 FR_ACT_RES4, 62 FR_ACT_RES4,
58 FR_ACT_BLACKHOLE, /* Drop without notification */ 63 FR_ACT_BLACKHOLE, /* Drop without notification */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1410e5330c8d..095a9c9a64fb 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -169,6 +169,7 @@ extern int dir_notify_enable;
169#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ 169#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
170 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 170 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
171#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 171#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
172#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
172 173
173#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 174#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
174#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 175#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
@@ -550,7 +551,7 @@ struct inode {
550 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 551 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
551 struct mutex i_mutex; 552 struct mutex i_mutex;
552 struct rw_semaphore i_alloc_sem; 553 struct rw_semaphore i_alloc_sem;
553 struct inode_operations *i_op; 554 const struct inode_operations *i_op;
554 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 555 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
555 struct super_block *i_sb; 556 struct super_block *i_sb;
556 struct file_lock *i_flock; 557 struct file_lock *i_flock;
@@ -842,8 +843,13 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
842extern int fcntl_getlease(struct file *filp); 843extern int fcntl_getlease(struct file *filp);
843 844
844/* fs/sync.c */ 845/* fs/sync.c */
845extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte, 846extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
846 unsigned int flags); 847 loff_t endbyte, unsigned int flags);
848static inline int do_sync_file_range(struct file *file, loff_t offset,
849 loff_t endbyte, unsigned int flags)
850{
851 return do_sync_mapping_range(file->f_mapping, offset, endbyte, flags);
852}
847 853
848/* fs/locks.c */ 854/* fs/locks.c */
849extern void locks_init_lock(struct file_lock *); 855extern void locks_init_lock(struct file_lock *);
@@ -906,7 +912,7 @@ struct super_block {
906 unsigned char s_dirt; 912 unsigned char s_dirt;
907 unsigned long long s_maxbytes; /* Max file size */ 913 unsigned long long s_maxbytes; /* Max file size */
908 struct file_system_type *s_type; 914 struct file_system_type *s_type;
909 struct super_operations *s_op; 915 const struct super_operations *s_op;
910 struct dquot_operations *dq_op; 916 struct dquot_operations *dq_op;
911 struct quotactl_ops *s_qcop; 917 struct quotactl_ops *s_qcop;
912 struct export_operations *s_export_op; 918 struct export_operations *s_export_op;
@@ -1382,7 +1388,7 @@ struct super_block *sget(struct file_system_type *type,
1382 int (*set)(struct super_block *,void *), 1388 int (*set)(struct super_block *,void *),
1383 void *data); 1389 void *data);
1384extern int get_sb_pseudo(struct file_system_type *, char *, 1390extern int get_sb_pseudo(struct file_system_type *, char *,
1385 struct super_operations *ops, unsigned long, 1391 const struct super_operations *ops, unsigned long,
1386 struct vfsmount *mnt); 1392 struct vfsmount *mnt);
1387extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1393extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1388int __put_super(struct super_block *sb); 1394int __put_super(struct super_block *sb);
@@ -1572,12 +1578,18 @@ extern int invalidate_partition(struct gendisk *, int);
1572extern int invalidate_inodes(struct super_block *); 1578extern int invalidate_inodes(struct super_block *);
1573unsigned long invalidate_mapping_pages(struct address_space *mapping, 1579unsigned long invalidate_mapping_pages(struct address_space *mapping,
1574 pgoff_t start, pgoff_t end); 1580 pgoff_t start, pgoff_t end);
1575unsigned long invalidate_inode_pages(struct address_space *mapping); 1581
1582static inline unsigned long __deprecated
1583invalidate_inode_pages(struct address_space *mapping)
1584{
1585 return invalidate_mapping_pages(mapping, 0, ~0UL);
1586}
1587
1576static inline void invalidate_remote_inode(struct inode *inode) 1588static inline void invalidate_remote_inode(struct inode *inode)
1577{ 1589{
1578 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 1590 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1579 S_ISLNK(inode->i_mode)) 1591 S_ISLNK(inode->i_mode))
1580 invalidate_inode_pages(inode->i_mapping); 1592 invalidate_mapping_pages(inode->i_mapping, 0, -1);
1581} 1593}
1582extern int invalidate_inode_pages2(struct address_space *mapping); 1594extern int invalidate_inode_pages2(struct address_space *mapping);
1583extern int invalidate_inode_pages2_range(struct address_space *mapping, 1595extern int invalidate_inode_pages2_range(struct address_space *mapping,
@@ -1681,7 +1693,6 @@ extern struct inode *new_inode(struct super_block *);
1681extern int __remove_suid(struct dentry *, int); 1693extern int __remove_suid(struct dentry *, int);
1682extern int should_remove_suid(struct dentry *); 1694extern int should_remove_suid(struct dentry *);
1683extern int remove_suid(struct dentry *); 1695extern int remove_suid(struct dentry *);
1684extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1685 1696
1686extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1697extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1687extern void remove_inode_hash(struct inode *); 1698extern void remove_inode_hash(struct inode *);
@@ -1822,7 +1833,7 @@ extern void page_put_link(struct dentry *, struct nameidata *, void *);
1822extern int __page_symlink(struct inode *inode, const char *symname, int len, 1833extern int __page_symlink(struct inode *inode, const char *symname, int len,
1823 gfp_t gfp_mask); 1834 gfp_t gfp_mask);
1824extern int page_symlink(struct inode *inode, const char *symname, int len); 1835extern int page_symlink(struct inode *inode, const char *symname, int len);
1825extern struct inode_operations page_symlink_inode_operations; 1836extern const struct inode_operations page_symlink_inode_operations;
1826extern int generic_readlink(struct dentry *, char __user *, int); 1837extern int generic_readlink(struct dentry *, char __user *, int);
1827extern void generic_fillattr(struct inode *, struct kstat *); 1838extern void generic_fillattr(struct inode *, struct kstat *);
1828extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 1839extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
@@ -1867,7 +1878,7 @@ extern int simple_commit_write(struct file *file, struct page *page,
1867extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); 1878extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
1868extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 1879extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
1869extern const struct file_operations simple_dir_operations; 1880extern const struct file_operations simple_dir_operations;
1870extern struct inode_operations simple_dir_inode_operations; 1881extern const struct inode_operations simple_dir_inode_operations;
1871struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 1882struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1872struct dentry *d_alloc_name(struct dentry *, const char *); 1883struct dentry *d_alloc_name(struct dentry *, const char *);
1873extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1884extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index abb64c437f6f..73710d617775 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -120,44 +120,5 @@ struct fsl_spi_platform_data {
120 u32 sysclk; 120 u32 sysclk;
121}; 121};
122 122
123/* Ethernet interface (phy management and speed)
124*/
125enum enet_interface {
126 ENET_10_MII, /* 10 Base T, MII interface */
127 ENET_10_RMII, /* 10 Base T, RMII interface */
128 ENET_10_RGMII, /* 10 Base T, RGMII interface */
129 ENET_100_MII, /* 100 Base T, MII interface */
130 ENET_100_RMII, /* 100 Base T, RMII interface */
131 ENET_100_RGMII, /* 100 Base T, RGMII interface */
132 ENET_1000_GMII, /* 1000 Base T, GMII interface */
133 ENET_1000_RGMII, /* 1000 Base T, RGMII interface */
134 ENET_1000_TBI, /* 1000 Base T, TBI interface */
135 ENET_1000_RTBI /* 1000 Base T, RTBI interface */
136};
137
138struct ucc_geth_platform_data {
139 /* device specific information */
140 u32 device_flags;
141 u32 phy_reg_addr;
142
143 /* board specific information */
144 u32 board_flags;
145 u8 rx_clock;
146 u8 tx_clock;
147 u32 phy_id;
148 enum enet_interface phy_interface;
149 u32 phy_interrupt;
150 u8 mac_addr[6];
151};
152
153/* Flags related to UCC Gigabit Ethernet device features */
154#define FSL_UGETH_DEV_HAS_GIGABIT 0x00000001
155#define FSL_UGETH_DEV_HAS_COALESCE 0x00000002
156#define FSL_UGETH_DEV_HAS_RMON 0x00000004
157
158/* Flags in ucc_geth_platform_data */
159#define FSL_UGETH_BRD_HAS_PHY_INTR 0x00000001
160 /* if not set use a timer */
161
162#endif /* _FSL_DEVICE_H_ */ 123#endif /* _FSL_DEVICE_H_ */
163#endif /* __KERNEL__ */ 124#endif /* __KERNEL__ */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 0a022b2f63fc..2c65da7cabb2 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -20,7 +20,11 @@ enum {
20 LINUX_EXTENDED_PARTITION = 0x85, 20 LINUX_EXTENDED_PARTITION = 0x85,
21 WIN98_EXTENDED_PARTITION = 0x0f, 21 WIN98_EXTENDED_PARTITION = 0x0f,
22 22
23 SUN_WHOLE_DISK = DOS_EXTENDED_PARTITION,
24
23 LINUX_SWAP_PARTITION = 0x82, 25 LINUX_SWAP_PARTITION = 0x82,
26 LINUX_DATA_PARTITION = 0x83,
27 LINUX_LVM_PARTITION = 0x8e,
24 LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */ 28 LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
25 29
26 SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION, 30 SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
@@ -400,10 +404,14 @@ struct unixware_disklabel {
400 404
401#ifdef __KERNEL__ 405#ifdef __KERNEL__
402 406
407#define ADDPART_FLAG_NONE 0
408#define ADDPART_FLAG_RAID 1
409#define ADDPART_FLAG_WHOLEDISK 2
410
403char *disk_name (struct gendisk *hd, int part, char *buf); 411char *disk_name (struct gendisk *hd, int part, char *buf);
404 412
405extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 413extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
406extern void add_partition(struct gendisk *, int, sector_t, sector_t); 414extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
407extern void delete_partition(struct gendisk *, int); 415extern void delete_partition(struct gendisk *, int);
408 416
409extern struct gendisk *alloc_disk_node(int minors, int node_id); 417extern struct gendisk *alloc_disk_node(int minors, int node_id);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 00c314aedab7..2a7d15bcde46 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -70,7 +70,7 @@ struct vm_area_struct;
70#ifdef CONFIG_NUMA 70#ifdef CONFIG_NUMA
71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 71#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
72#else 72#else
73#define GFP_THISNODE 0 73#define GFP_THISNODE ((__force gfp_t)0)
74#endif 74#endif
75 75
76 76
@@ -85,8 +85,10 @@ struct vm_area_struct;
85 85
86static inline enum zone_type gfp_zone(gfp_t flags) 86static inline enum zone_type gfp_zone(gfp_t flags)
87{ 87{
88#ifdef CONFIG_ZONE_DMA
88 if (flags & __GFP_DMA) 89 if (flags & __GFP_DMA)
89 return ZONE_DMA; 90 return ZONE_DMA;
91#endif
90#ifdef CONFIG_ZONE_DMA32 92#ifdef CONFIG_ZONE_DMA32
91 if (flags & __GFP_DMA32) 93 if (flags & __GFP_DMA32)
92 return ZONE_DMA32; 94 return ZONE_DMA32;
diff --git a/include/linux/gigaset_dev.h b/include/linux/gigaset_dev.h
index 70ad09c8ad1e..5dc4a316ca37 100644
--- a/include/linux/gigaset_dev.h
+++ b/include/linux/gigaset_dev.h
@@ -9,8 +9,6 @@
9 * published by the Free Software Foundation; either version 2 of 9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
11 * ===================================================================== 11 * =====================================================================
12 * Version: $Id: gigaset_dev.h,v 1.4.4.4 2005/11/21 22:28:09 hjlipp Exp $
13 * =====================================================================
14 */ 12 */
15 13
16#ifndef GIGASET_INTERFACE_H 14#ifndef GIGASET_INTERFACE_H
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
new file mode 100644
index 000000000000..2b217c7b9312
--- /dev/null
+++ b/include/linux/gpio_keys.h
@@ -0,0 +1,17 @@
1#ifndef _GPIO_KEYS_H
2#define _GPIO_KEYS_H
3
4struct gpio_keys_button {
5 /* Configuration parameters */
6 int keycode;
7 int gpio;
8 int active_low;
9 char *desc;
10};
11
12struct gpio_keys_platform_data {
13 struct gpio_keys_button *buttons;
14 int nbuttons;
15};
16
17#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 612472aaa79c..7803014f3a11 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -106,7 +106,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
106 * always balanced, so the interrupted value of ->hardirq_context 106 * always balanced, so the interrupted value of ->hardirq_context
107 * will always be restored. 107 * will always be restored.
108 */ 108 */
109#define irq_enter() \ 109#define __irq_enter() \
110 do { \ 110 do { \
111 account_system_vtime(current); \ 111 account_system_vtime(current); \
112 add_preempt_count(HARDIRQ_OFFSET); \ 112 add_preempt_count(HARDIRQ_OFFSET); \
@@ -114,6 +114,11 @@ static inline void account_system_vtime(struct task_struct *tsk)
114 } while (0) 114 } while (0)
115 115
116/* 116/*
117 * Enter irq context (on NO_HZ, update jiffies):
118 */
119extern void irq_enter(void);
120
121/*
117 * Exit irq context without processing softirqs: 122 * Exit irq context without processing softirqs:
118 */ 123 */
119#define __irq_exit() \ 124#define __irq_exit() \
@@ -128,7 +133,7 @@ static inline void account_system_vtime(struct task_struct *tsk)
128 */ 133 */
129extern void irq_exit(void); 134extern void irq_exit(void);
130 135
131#define nmi_enter() do { lockdep_off(); irq_enter(); } while (0) 136#define nmi_enter() do { lockdep_off(); __irq_enter(); } while (0)
132#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0) 137#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0)
133 138
134#endif /* LINUX_HARDIRQ_H */ 139#endif /* LINUX_HARDIRQ_H */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d4b333938f73..db390c511ada 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,8 +43,7 @@ struct hdlc_proto {
43 void (*stop)(struct net_device *dev); /* if open & !DCD */ 43 void (*stop)(struct net_device *dev); /* if open & !DCD */
44 void (*detach)(struct net_device *dev); 44 void (*detach)(struct net_device *dev);
45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr); 45 int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
46 unsigned short (*type_trans)(struct sk_buff *skb, 46 __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
47 struct net_device *dev);
48 struct module *module; 47 struct module *module;
49 struct hdlc_proto *next; /* next protocol in the list */ 48 struct hdlc_proto *next; /* next protocol in the list */
50}; 49};
@@ -132,8 +131,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
132{ 131{
133 hdlc_device *hdlc = dev_to_hdlc(dev); 132 hdlc_device *hdlc = dev_to_hdlc(dev);
134 133
135 skb->mac.raw = skb->data; 134 skb->dev = dev;
136 skb->dev = dev; 135 skb_reset_mac_header(skb);
137 136
138 if (hdlc->proto->type_trans) 137 if (hdlc->proto->type_trans)
139 return hdlc->proto->type_trans(skb, dev); 138 return hdlc->proto->type_trans(skb, dev);
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 2b54eac738ea..818c6afc1091 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -60,13 +60,15 @@
60#define TAG_MASK 0xf8 60#define TAG_MASK 0xf8
61#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
62 62
63#include <linux/types.h>
64
63/* 65/*
64 * Command Header sizes for IOCTL commands 66 * Command Header sizes for IOCTL commands
65 */ 67 */
66 68
67#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(u8)) 69#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
68#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(u8)) 70#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
69#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(u8)) 71#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
70 72
71#define IDE_DRIVE_TASK_INVALID -1 73#define IDE_DRIVE_TASK_INVALID -1
72#define IDE_DRIVE_TASK_NO_DATA 0 74#define IDE_DRIVE_TASK_NO_DATA 0
diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h
index 8e4dbb51fc70..50d568ec178a 100644
--- a/include/linux/hid-debug.h
+++ b/include/linux/hid-debug.h
@@ -1,10 +1,8 @@
1#ifndef __HID_DEBUG_H
2#define __HID_DEBUG_H
3
1/* 4/*
2 * $Id: hid-debug.h,v 1.8 2001/09/25 09:37:57 vojtech Exp $ 5 * Copyright (c) 2007 Jiri Kosina
3 *
4 * (c) 1999 Andreas Gal <gal@cs.uni-magdeburg.de>
5 * (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
6 *
7 * Some debug stuff for the HID parser.
8 */ 6 */
9 7
10/* 8/*
@@ -22,737 +20,26 @@
22 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
23 * 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
24 * 22 *
25 * Should you need to contact me, the author, you can do so either by
26 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
28 */ 23 */
29 24
30#include <linux/input.h> 25#ifdef CONFIG_HID_DEBUG
31
32struct hid_usage_entry {
33 unsigned page;
34 unsigned usage;
35 char *description;
36};
37
38static const struct hid_usage_entry hid_usage_table[] = {
39 { 0, 0, "Undefined" },
40 { 1, 0, "GenericDesktop" },
41 {0, 0x01, "Pointer"},
42 {0, 0x02, "Mouse"},
43 {0, 0x04, "Joystick"},
44 {0, 0x05, "GamePad"},
45 {0, 0x06, "Keyboard"},
46 {0, 0x07, "Keypad"},
47 {0, 0x08, "MultiAxis"},
48 {0, 0x30, "X"},
49 {0, 0x31, "Y"},
50 {0, 0x32, "Z"},
51 {0, 0x33, "Rx"},
52 {0, 0x34, "Ry"},
53 {0, 0x35, "Rz"},
54 {0, 0x36, "Slider"},
55 {0, 0x37, "Dial"},
56 {0, 0x38, "Wheel"},
57 {0, 0x39, "HatSwitch"},
58 {0, 0x3a, "CountedBuffer"},
59 {0, 0x3b, "ByteCount"},
60 {0, 0x3c, "MotionWakeup"},
61 {0, 0x3d, "Start"},
62 {0, 0x3e, "Select"},
63 {0, 0x40, "Vx"},
64 {0, 0x41, "Vy"},
65 {0, 0x42, "Vz"},
66 {0, 0x43, "Vbrx"},
67 {0, 0x44, "Vbry"},
68 {0, 0x45, "Vbrz"},
69 {0, 0x46, "Vno"},
70 {0, 0x80, "SystemControl"},
71 {0, 0x81, "SystemPowerDown"},
72 {0, 0x82, "SystemSleep"},
73 {0, 0x83, "SystemWakeUp"},
74 {0, 0x84, "SystemContextMenu"},
75 {0, 0x85, "SystemMainMenu"},
76 {0, 0x86, "SystemAppMenu"},
77 {0, 0x87, "SystemMenuHelp"},
78 {0, 0x88, "SystemMenuExit"},
79 {0, 0x89, "SystemMenuSelect"},
80 {0, 0x8a, "SystemMenuRight"},
81 {0, 0x8b, "SystemMenuLeft"},
82 {0, 0x8c, "SystemMenuUp"},
83 {0, 0x8d, "SystemMenuDown"},
84 {0, 0x90, "D-PadUp"},
85 {0, 0x91, "D-PadDown"},
86 {0, 0x92, "D-PadRight"},
87 {0, 0x93, "D-PadLeft"},
88 { 2, 0, "Simulation" },
89 {0, 0xb0, "Aileron"},
90 {0, 0xb1, "AileronTrim"},
91 {0, 0xb2, "Anti-Torque"},
92 {0, 0xb3, "Autopilot"},
93 {0, 0xb4, "Chaff"},
94 {0, 0xb5, "Collective"},
95 {0, 0xb6, "DiveBrake"},
96 {0, 0xb7, "ElectronicCountermeasures"},
97 {0, 0xb8, "Elevator"},
98 {0, 0xb9, "ElevatorTrim"},
99 {0, 0xba, "Rudder"},
100 {0, 0xbb, "Throttle"},
101 {0, 0xbc, "FlightCommunications"},
102 {0, 0xbd, "FlareRelease"},
103 {0, 0xbe, "LandingGear"},
104 {0, 0xbf, "ToeBrake"},
105 { 7, 0, "Keyboard" },
106 { 8, 0, "LED" },
107 {0, 0x01, "NumLock"},
108 {0, 0x02, "CapsLock"},
109 {0, 0x03, "ScrollLock"},
110 {0, 0x04, "Compose"},
111 {0, 0x05, "Kana"},
112 {0, 0x4b, "GenericIndicator"},
113 { 9, 0, "Button" },
114 { 10, 0, "Ordinal" },
115 { 12, 0, "Consumer" },
116 {0, 0x238, "HorizontalWheel"},
117 { 13, 0, "Digitizers" },
118 {0, 0x01, "Digitizer"},
119 {0, 0x02, "Pen"},
120 {0, 0x03, "LightPen"},
121 {0, 0x04, "TouchScreen"},
122 {0, 0x05, "TouchPad"},
123 {0, 0x20, "Stylus"},
124 {0, 0x21, "Puck"},
125 {0, 0x22, "Finger"},
126 {0, 0x30, "TipPressure"},
127 {0, 0x31, "BarrelPressure"},
128 {0, 0x32, "InRange"},
129 {0, 0x33, "Touch"},
130 {0, 0x34, "UnTouch"},
131 {0, 0x35, "Tap"},
132 {0, 0x39, "TabletFunctionKey"},
133 {0, 0x3a, "ProgramChangeKey"},
134 {0, 0x3c, "Invert"},
135 {0, 0x42, "TipSwitch"},
136 {0, 0x43, "SecondaryTipSwitch"},
137 {0, 0x44, "BarrelSwitch"},
138 {0, 0x45, "Eraser"},
139 {0, 0x46, "TabletPick"},
140 { 15, 0, "PhysicalInterfaceDevice" },
141 {0, 0x00, "Undefined"},
142 {0, 0x01, "Physical_Interface_Device"},
143 {0, 0x20, "Normal"},
144 {0, 0x21, "Set_Effect_Report"},
145 {0, 0x22, "Effect_Block_Index"},
146 {0, 0x23, "Parameter_Block_Offset"},
147 {0, 0x24, "ROM_Flag"},
148 {0, 0x25, "Effect_Type"},
149 {0, 0x26, "ET_Constant_Force"},
150 {0, 0x27, "ET_Ramp"},
151 {0, 0x28, "ET_Custom_Force_Data"},
152 {0, 0x30, "ET_Square"},
153 {0, 0x31, "ET_Sine"},
154 {0, 0x32, "ET_Triangle"},
155 {0, 0x33, "ET_Sawtooth_Up"},
156 {0, 0x34, "ET_Sawtooth_Down"},
157 {0, 0x40, "ET_Spring"},
158 {0, 0x41, "ET_Damper"},
159 {0, 0x42, "ET_Inertia"},
160 {0, 0x43, "ET_Friction"},
161 {0, 0x50, "Duration"},
162 {0, 0x51, "Sample_Period"},
163 {0, 0x52, "Gain"},
164 {0, 0x53, "Trigger_Button"},
165 {0, 0x54, "Trigger_Repeat_Interval"},
166 {0, 0x55, "Axes_Enable"},
167 {0, 0x56, "Direction_Enable"},
168 {0, 0x57, "Direction"},
169 {0, 0x58, "Type_Specific_Block_Offset"},
170 {0, 0x59, "Block_Type"},
171 {0, 0x5A, "Set_Envelope_Report"},
172 {0, 0x5B, "Attack_Level"},
173 {0, 0x5C, "Attack_Time"},
174 {0, 0x5D, "Fade_Level"},
175 {0, 0x5E, "Fade_Time"},
176 {0, 0x5F, "Set_Condition_Report"},
177 {0, 0x60, "CP_Offset"},
178 {0, 0x61, "Positive_Coefficient"},
179 {0, 0x62, "Negative_Coefficient"},
180 {0, 0x63, "Positive_Saturation"},
181 {0, 0x64, "Negative_Saturation"},
182 {0, 0x65, "Dead_Band"},
183 {0, 0x66, "Download_Force_Sample"},
184 {0, 0x67, "Isoch_Custom_Force_Enable"},
185 {0, 0x68, "Custom_Force_Data_Report"},
186 {0, 0x69, "Custom_Force_Data"},
187 {0, 0x6A, "Custom_Force_Vendor_Defined_Data"},
188 {0, 0x6B, "Set_Custom_Force_Report"},
189 {0, 0x6C, "Custom_Force_Data_Offset"},
190 {0, 0x6D, "Sample_Count"},
191 {0, 0x6E, "Set_Periodic_Report"},
192 {0, 0x6F, "Offset"},
193 {0, 0x70, "Magnitude"},
194 {0, 0x71, "Phase"},
195 {0, 0x72, "Period"},
196 {0, 0x73, "Set_Constant_Force_Report"},
197 {0, 0x74, "Set_Ramp_Force_Report"},
198 {0, 0x75, "Ramp_Start"},
199 {0, 0x76, "Ramp_End"},
200 {0, 0x77, "Effect_Operation_Report"},
201 {0, 0x78, "Effect_Operation"},
202 {0, 0x79, "Op_Effect_Start"},
203 {0, 0x7A, "Op_Effect_Start_Solo"},
204 {0, 0x7B, "Op_Effect_Stop"},
205 {0, 0x7C, "Loop_Count"},
206 {0, 0x7D, "Device_Gain_Report"},
207 {0, 0x7E, "Device_Gain"},
208 {0, 0x7F, "PID_Pool_Report"},
209 {0, 0x80, "RAM_Pool_Size"},
210 {0, 0x81, "ROM_Pool_Size"},
211 {0, 0x82, "ROM_Effect_Block_Count"},
212 {0, 0x83, "Simultaneous_Effects_Max"},
213 {0, 0x84, "Pool_Alignment"},
214 {0, 0x85, "PID_Pool_Move_Report"},
215 {0, 0x86, "Move_Source"},
216 {0, 0x87, "Move_Destination"},
217 {0, 0x88, "Move_Length"},
218 {0, 0x89, "PID_Block_Load_Report"},
219 {0, 0x8B, "Block_Load_Status"},
220 {0, 0x8C, "Block_Load_Success"},
221 {0, 0x8D, "Block_Load_Full"},
222 {0, 0x8E, "Block_Load_Error"},
223 {0, 0x8F, "Block_Handle"},
224 {0, 0x90, "PID_Block_Free_Report"},
225 {0, 0x91, "Type_Specific_Block_Handle"},
226 {0, 0x92, "PID_State_Report"},
227 {0, 0x94, "Effect_Playing"},
228 {0, 0x95, "PID_Device_Control_Report"},
229 {0, 0x96, "PID_Device_Control"},
230 {0, 0x97, "DC_Enable_Actuators"},
231 {0, 0x98, "DC_Disable_Actuators"},
232 {0, 0x99, "DC_Stop_All_Effects"},
233 {0, 0x9A, "DC_Device_Reset"},
234 {0, 0x9B, "DC_Device_Pause"},
235 {0, 0x9C, "DC_Device_Continue"},
236 {0, 0x9F, "Device_Paused"},
237 {0, 0xA0, "Actuators_Enabled"},
238 {0, 0xA4, "Safety_Switch"},
239 {0, 0xA5, "Actuator_Override_Switch"},
240 {0, 0xA6, "Actuator_Power"},
241 {0, 0xA7, "Start_Delay"},
242 {0, 0xA8, "Parameter_Block_Size"},
243 {0, 0xA9, "Device_Managed_Pool"},
244 {0, 0xAA, "Shared_Parameter_Blocks"},
245 {0, 0xAB, "Create_New_Effect_Report"},
246 {0, 0xAC, "RAM_Pool_Available"},
247 { 0x84, 0, "Power Device" },
248 { 0x84, 0x02, "PresentStatus" },
249 { 0x84, 0x03, "ChangeStatus" },
250 { 0x84, 0x04, "UPS" },
251 { 0x84, 0x05, "PowerSupply" },
252 { 0x84, 0x10, "BatterySystem" },
253 { 0x84, 0x11, "BatterySystemID" },
254 { 0x84, 0x12, "Battery" },
255 { 0x84, 0x13, "BatteryID" },
256 { 0x84, 0x14, "Charger" },
257 { 0x84, 0x15, "ChargerID" },
258 { 0x84, 0x16, "PowerConverter" },
259 { 0x84, 0x17, "PowerConverterID" },
260 { 0x84, 0x18, "OutletSystem" },
261 { 0x84, 0x19, "OutletSystemID" },
262 { 0x84, 0x1a, "Input" },
263 { 0x84, 0x1b, "InputID" },
264 { 0x84, 0x1c, "Output" },
265 { 0x84, 0x1d, "OutputID" },
266 { 0x84, 0x1e, "Flow" },
267 { 0x84, 0x1f, "FlowID" },
268 { 0x84, 0x20, "Outlet" },
269 { 0x84, 0x21, "OutletID" },
270 { 0x84, 0x22, "Gang" },
271 { 0x84, 0x24, "PowerSummary" },
272 { 0x84, 0x25, "PowerSummaryID" },
273 { 0x84, 0x30, "Voltage" },
274 { 0x84, 0x31, "Current" },
275 { 0x84, 0x32, "Frequency" },
276 { 0x84, 0x33, "ApparentPower" },
277 { 0x84, 0x35, "PercentLoad" },
278 { 0x84, 0x40, "ConfigVoltage" },
279 { 0x84, 0x41, "ConfigCurrent" },
280 { 0x84, 0x43, "ConfigApparentPower" },
281 { 0x84, 0x53, "LowVoltageTransfer" },
282 { 0x84, 0x54, "HighVoltageTransfer" },
283 { 0x84, 0x56, "DelayBeforeStartup" },
284 { 0x84, 0x57, "DelayBeforeShutdown" },
285 { 0x84, 0x58, "Test" },
286 { 0x84, 0x5a, "AudibleAlarmControl" },
287 { 0x84, 0x60, "Present" },
288 { 0x84, 0x61, "Good" },
289 { 0x84, 0x62, "InternalFailure" },
290 { 0x84, 0x65, "Overload" },
291 { 0x84, 0x66, "OverCharged" },
292 { 0x84, 0x67, "OverTemperature" },
293 { 0x84, 0x68, "ShutdownRequested" },
294 { 0x84, 0x69, "ShutdownImminent" },
295 { 0x84, 0x6b, "SwitchOn/Off" },
296 { 0x84, 0x6c, "Switchable" },
297 { 0x84, 0x6d, "Used" },
298 { 0x84, 0x6e, "Boost" },
299 { 0x84, 0x73, "CommunicationLost" },
300 { 0x84, 0xfd, "iManufacturer" },
301 { 0x84, 0xfe, "iProduct" },
302 { 0x84, 0xff, "iSerialNumber" },
303 { 0x85, 0, "Battery System" },
304 { 0x85, 0x01, "SMBBatteryMode" },
305 { 0x85, 0x02, "SMBBatteryStatus" },
306 { 0x85, 0x03, "SMBAlarmWarning" },
307 { 0x85, 0x04, "SMBChargerMode" },
308 { 0x85, 0x05, "SMBChargerStatus" },
309 { 0x85, 0x06, "SMBChargerSpecInfo" },
310 { 0x85, 0x07, "SMBSelectorState" },
311 { 0x85, 0x08, "SMBSelectorPresets" },
312 { 0x85, 0x09, "SMBSelectorInfo" },
313 { 0x85, 0x29, "RemainingCapacityLimit" },
314 { 0x85, 0x2c, "CapacityMode" },
315 { 0x85, 0x42, "BelowRemainingCapacityLimit" },
316 { 0x85, 0x44, "Charging" },
317 { 0x85, 0x45, "Discharging" },
318 { 0x85, 0x4b, "NeedReplacement" },
319 { 0x85, 0x66, "RemainingCapacity" },
320 { 0x85, 0x68, "RunTimeToEmpty" },
321 { 0x85, 0x6a, "AverageTimeToFull" },
322 { 0x85, 0x83, "DesignCapacity" },
323 { 0x85, 0x85, "ManufacturerDate" },
324 { 0x85, 0x89, "iDeviceChemistry" },
325 { 0x85, 0x8b, "Rechargable" },
326 { 0x85, 0x8f, "iOEMInformation" },
327 { 0x85, 0x8d, "CapacityGranularity1" },
328 { 0x85, 0xd0, "ACPresent" },
329 /* pages 0xff00 to 0xffff are vendor-specific */
330 { 0xffff, 0, "Vendor-specific-FF" },
331 { 0, 0, NULL }
332};
333
334static void resolv_usage_page(unsigned page) {
335 const struct hid_usage_entry *p;
336
337 for (p = hid_usage_table; p->description; p++)
338 if (p->page == page) {
339 printk("%s", p->description);
340 return;
341 }
342 printk("%04x", page);
343}
344
345static void resolv_usage(unsigned usage) {
346 const struct hid_usage_entry *p;
347
348 resolv_usage_page(usage >> 16);
349 printk(".");
350 for (p = hid_usage_table; p->description; p++)
351 if (p->page == (usage >> 16)) {
352 for(++p; p->description && p->usage != 0; p++)
353 if (p->usage == (usage & 0xffff)) {
354 printk("%s", p->description);
355 return;
356 }
357 break;
358 }
359 printk("%04x", usage & 0xffff);
360}
361
362__inline__ static void tab(int n) {
363 while (n--) printk(" ");
364}
365
366static void hid_dump_field(struct hid_field *field, int n) {
367 int j;
368
369 if (field->physical) {
370 tab(n);
371 printk("Physical(");
372 resolv_usage(field->physical); printk(")\n");
373 }
374 if (field->logical) {
375 tab(n);
376 printk("Logical(");
377 resolv_usage(field->logical); printk(")\n");
378 }
379 tab(n); printk("Usage(%d)\n", field->maxusage);
380 for (j = 0; j < field->maxusage; j++) {
381 tab(n+2);resolv_usage(field->usage[j].hid); printk("\n");
382 }
383 if (field->logical_minimum != field->logical_maximum) {
384 tab(n); printk("Logical Minimum(%d)\n", field->logical_minimum);
385 tab(n); printk("Logical Maximum(%d)\n", field->logical_maximum);
386 }
387 if (field->physical_minimum != field->physical_maximum) {
388 tab(n); printk("Physical Minimum(%d)\n", field->physical_minimum);
389 tab(n); printk("Physical Maximum(%d)\n", field->physical_maximum);
390 }
391 if (field->unit_exponent) {
392 tab(n); printk("Unit Exponent(%d)\n", field->unit_exponent);
393 }
394 if (field->unit) {
395 char *systems[5] = { "None", "SI Linear", "SI Rotation", "English Linear", "English Rotation" };
396 char *units[5][8] = {
397 { "None", "None", "None", "None", "None", "None", "None", "None" },
398 { "None", "Centimeter", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" },
399 { "None", "Radians", "Gram", "Seconds", "Kelvin", "Ampere", "Candela", "None" },
400 { "None", "Inch", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" },
401 { "None", "Degrees", "Slug", "Seconds", "Fahrenheit", "Ampere", "Candela", "None" }
402 };
403
404 int i;
405 int sys;
406 __u32 data = field->unit;
407
408 /* First nibble tells us which system we're in. */
409 sys = data & 0xf;
410 data >>= 4;
411
412 if(sys > 4) {
413 tab(n); printk("Unit(Invalid)\n");
414 }
415 else {
416 int earlier_unit = 0;
417
418 tab(n); printk("Unit(%s : ", systems[sys]);
419
420 for (i=1 ; i<sizeof(__u32)*2 ; i++) {
421 char nibble = data & 0xf;
422 data >>= 4;
423 if (nibble != 0) {
424 if(earlier_unit++ > 0)
425 printk("*");
426 printk("%s", units[sys][i]);
427 if(nibble != 1) {
428 /* This is a _signed_ nibble(!) */
429
430 int val = nibble & 0x7;
431 if(nibble & 0x08)
432 val = -((0x7 & ~val) +1);
433 printk("^%d", val);
434 }
435 }
436 }
437 printk(")\n");
438 }
439 }
440 tab(n); printk("Report Size(%u)\n", field->report_size);
441 tab(n); printk("Report Count(%u)\n", field->report_count);
442 tab(n); printk("Report Offset(%u)\n", field->report_offset);
443
444 tab(n); printk("Flags( ");
445 j = field->flags;
446 printk("%s", HID_MAIN_ITEM_CONSTANT & j ? "Constant " : "");
447 printk("%s", HID_MAIN_ITEM_VARIABLE & j ? "Variable " : "Array ");
448 printk("%s", HID_MAIN_ITEM_RELATIVE & j ? "Relative " : "Absolute ");
449 printk("%s", HID_MAIN_ITEM_WRAP & j ? "Wrap " : "");
450 printk("%s", HID_MAIN_ITEM_NONLINEAR & j ? "NonLinear " : "");
451 printk("%s", HID_MAIN_ITEM_NO_PREFERRED & j ? "NoPrefferedState " : "");
452 printk("%s", HID_MAIN_ITEM_NULL_STATE & j ? "NullState " : "");
453 printk("%s", HID_MAIN_ITEM_VOLATILE & j ? "Volatile " : "");
454 printk("%s", HID_MAIN_ITEM_BUFFERED_BYTE & j ? "BufferedByte " : "");
455 printk(")\n");
456}
457
458static void __attribute__((unused)) hid_dump_device(struct hid_device *device) {
459 struct hid_report_enum *report_enum;
460 struct hid_report *report;
461 struct list_head *list;
462 unsigned i,k;
463 static char *table[] = {"INPUT", "OUTPUT", "FEATURE"};
464
465 for (i = 0; i < HID_REPORT_TYPES; i++) {
466 report_enum = device->report_enum + i;
467 list = report_enum->report_list.next;
468 while (list != &report_enum->report_list) {
469 report = (struct hid_report *) list;
470 tab(2);
471 printk("%s", table[i]);
472 if (report->id)
473 printk("(%d)", report->id);
474 printk("[%s]", table[report->type]);
475 printk("\n");
476 for (k = 0; k < report->maxfield; k++) {
477 tab(4);
478 printk("Field(%d)\n", k);
479 hid_dump_field(report->field[k], 6);
480 }
481 list = list->next;
482 }
483 }
484}
485
486static void __attribute__((unused)) hid_dump_input(struct hid_usage *usage, __s32 value) {
487 printk("hid-debug: input ");
488 resolv_usage(usage->hid);
489 printk(" = %d\n", value);
490}
491
492
493static char *events[EV_MAX + 1] = {
494 [EV_SYN] = "Sync", [EV_KEY] = "Key",
495 [EV_REL] = "Relative", [EV_ABS] = "Absolute",
496 [EV_MSC] = "Misc", [EV_LED] = "LED",
497 [EV_SND] = "Sound", [EV_REP] = "Repeat",
498 [EV_FF] = "ForceFeedback", [EV_PWR] = "Power",
499 [EV_FF_STATUS] = "ForceFeedbackStatus",
500};
501
502static char *syncs[2] = {
503 [SYN_REPORT] = "Report", [SYN_CONFIG] = "Config",
504};
505static char *keys[KEY_MAX + 1] = {
506 [KEY_RESERVED] = "Reserved", [KEY_ESC] = "Esc",
507 [KEY_1] = "1", [KEY_2] = "2",
508 [KEY_3] = "3", [KEY_4] = "4",
509 [KEY_5] = "5", [KEY_6] = "6",
510 [KEY_7] = "7", [KEY_8] = "8",
511 [KEY_9] = "9", [KEY_0] = "0",
512 [KEY_MINUS] = "Minus", [KEY_EQUAL] = "Equal",
513 [KEY_BACKSPACE] = "Backspace", [KEY_TAB] = "Tab",
514 [KEY_Q] = "Q", [KEY_W] = "W",
515 [KEY_E] = "E", [KEY_R] = "R",
516 [KEY_T] = "T", [KEY_Y] = "Y",
517 [KEY_U] = "U", [KEY_I] = "I",
518 [KEY_O] = "O", [KEY_P] = "P",
519 [KEY_LEFTBRACE] = "LeftBrace", [KEY_RIGHTBRACE] = "RightBrace",
520 [KEY_ENTER] = "Enter", [KEY_LEFTCTRL] = "LeftControl",
521 [KEY_A] = "A", [KEY_S] = "S",
522 [KEY_D] = "D", [KEY_F] = "F",
523 [KEY_G] = "G", [KEY_H] = "H",
524 [KEY_J] = "J", [KEY_K] = "K",
525 [KEY_L] = "L", [KEY_SEMICOLON] = "Semicolon",
526 [KEY_APOSTROPHE] = "Apostrophe", [KEY_GRAVE] = "Grave",
527 [KEY_LEFTSHIFT] = "LeftShift", [KEY_BACKSLASH] = "BackSlash",
528 [KEY_Z] = "Z", [KEY_X] = "X",
529 [KEY_C] = "C", [KEY_V] = "V",
530 [KEY_B] = "B", [KEY_N] = "N",
531 [KEY_M] = "M", [KEY_COMMA] = "Comma",
532 [KEY_DOT] = "Dot", [KEY_SLASH] = "Slash",
533 [KEY_RIGHTSHIFT] = "RightShift", [KEY_KPASTERISK] = "KPAsterisk",
534 [KEY_LEFTALT] = "LeftAlt", [KEY_SPACE] = "Space",
535 [KEY_CAPSLOCK] = "CapsLock", [KEY_F1] = "F1",
536 [KEY_F2] = "F2", [KEY_F3] = "F3",
537 [KEY_F4] = "F4", [KEY_F5] = "F5",
538 [KEY_F6] = "F6", [KEY_F7] = "F7",
539 [KEY_F8] = "F8", [KEY_F9] = "F9",
540 [KEY_F10] = "F10", [KEY_NUMLOCK] = "NumLock",
541 [KEY_SCROLLLOCK] = "ScrollLock", [KEY_KP7] = "KP7",
542 [KEY_KP8] = "KP8", [KEY_KP9] = "KP9",
543 [KEY_KPMINUS] = "KPMinus", [KEY_KP4] = "KP4",
544 [KEY_KP5] = "KP5", [KEY_KP6] = "KP6",
545 [KEY_KPPLUS] = "KPPlus", [KEY_KP1] = "KP1",
546 [KEY_KP2] = "KP2", [KEY_KP3] = "KP3",
547 [KEY_KP0] = "KP0", [KEY_KPDOT] = "KPDot",
548 [KEY_ZENKAKUHANKAKU] = "Zenkaku/Hankaku", [KEY_102ND] = "102nd",
549 [KEY_F11] = "F11", [KEY_F12] = "F12",
550 [KEY_RO] = "RO", [KEY_KATAKANA] = "Katakana",
551 [KEY_HIRAGANA] = "HIRAGANA", [KEY_HENKAN] = "Henkan",
552 [KEY_KATAKANAHIRAGANA] = "Katakana/Hiragana", [KEY_MUHENKAN] = "Muhenkan",
553 [KEY_KPJPCOMMA] = "KPJpComma", [KEY_KPENTER] = "KPEnter",
554 [KEY_RIGHTCTRL] = "RightCtrl", [KEY_KPSLASH] = "KPSlash",
555 [KEY_SYSRQ] = "SysRq", [KEY_RIGHTALT] = "RightAlt",
556 [KEY_LINEFEED] = "LineFeed", [KEY_HOME] = "Home",
557 [KEY_UP] = "Up", [KEY_PAGEUP] = "PageUp",
558 [KEY_LEFT] = "Left", [KEY_RIGHT] = "Right",
559 [KEY_END] = "End", [KEY_DOWN] = "Down",
560 [KEY_PAGEDOWN] = "PageDown", [KEY_INSERT] = "Insert",
561 [KEY_DELETE] = "Delete", [KEY_MACRO] = "Macro",
562 [KEY_MUTE] = "Mute", [KEY_VOLUMEDOWN] = "VolumeDown",
563 [KEY_VOLUMEUP] = "VolumeUp", [KEY_POWER] = "Power",
564 [KEY_KPEQUAL] = "KPEqual", [KEY_KPPLUSMINUS] = "KPPlusMinus",
565 [KEY_PAUSE] = "Pause", [KEY_KPCOMMA] = "KPComma",
566 [KEY_HANGUEL] = "Hangeul", [KEY_HANJA] = "Hanja",
567 [KEY_YEN] = "Yen", [KEY_LEFTMETA] = "LeftMeta",
568 [KEY_RIGHTMETA] = "RightMeta", [KEY_COMPOSE] = "Compose",
569 [KEY_STOP] = "Stop", [KEY_AGAIN] = "Again",
570 [KEY_PROPS] = "Props", [KEY_UNDO] = "Undo",
571 [KEY_FRONT] = "Front", [KEY_COPY] = "Copy",
572 [KEY_OPEN] = "Open", [KEY_PASTE] = "Paste",
573 [KEY_FIND] = "Find", [KEY_CUT] = "Cut",
574 [KEY_HELP] = "Help", [KEY_MENU] = "Menu",
575 [KEY_CALC] = "Calc", [KEY_SETUP] = "Setup",
576 [KEY_SLEEP] = "Sleep", [KEY_WAKEUP] = "WakeUp",
577 [KEY_FILE] = "File", [KEY_SENDFILE] = "SendFile",
578 [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer",
579 [KEY_PROG1] = "Prog1", [KEY_PROG2] = "Prog2",
580 [KEY_WWW] = "WWW", [KEY_MSDOS] = "MSDOS",
581 [KEY_COFFEE] = "Coffee", [KEY_DIRECTION] = "Direction",
582 [KEY_CYCLEWINDOWS] = "CycleWindows", [KEY_MAIL] = "Mail",
583 [KEY_BOOKMARKS] = "Bookmarks", [KEY_COMPUTER] = "Computer",
584 [KEY_BACK] = "Back", [KEY_FORWARD] = "Forward",
585 [KEY_CLOSECD] = "CloseCD", [KEY_EJECTCD] = "EjectCD",
586 [KEY_EJECTCLOSECD] = "EjectCloseCD", [KEY_NEXTSONG] = "NextSong",
587 [KEY_PLAYPAUSE] = "PlayPause", [KEY_PREVIOUSSONG] = "PreviousSong",
588 [KEY_STOPCD] = "StopCD", [KEY_RECORD] = "Record",
589 [KEY_REWIND] = "Rewind", [KEY_PHONE] = "Phone",
590 [KEY_ISO] = "ISOKey", [KEY_CONFIG] = "Config",
591 [KEY_HOMEPAGE] = "HomePage", [KEY_REFRESH] = "Refresh",
592 [KEY_EXIT] = "Exit", [KEY_MOVE] = "Move",
593 [KEY_EDIT] = "Edit", [KEY_SCROLLUP] = "ScrollUp",
594 [KEY_SCROLLDOWN] = "ScrollDown", [KEY_KPLEFTPAREN] = "KPLeftParenthesis",
595 [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_NEW] = "New",
596 [KEY_REDO] = "Redo", [KEY_F13] = "F13",
597 [KEY_F14] = "F14", [KEY_F15] = "F15",
598 [KEY_F16] = "F16", [KEY_F17] = "F17",
599 [KEY_F18] = "F18", [KEY_F19] = "F19",
600 [KEY_F20] = "F20", [KEY_F21] = "F21",
601 [KEY_F22] = "F22", [KEY_F23] = "F23",
602 [KEY_F24] = "F24", [KEY_PLAYCD] = "PlayCD",
603 [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3",
604 [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend",
605 [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play",
606 [KEY_FASTFORWARD] = "FastForward", [KEY_BASSBOOST] = "BassBoost",
607 [KEY_PRINT] = "Print", [KEY_HP] = "HP",
608 [KEY_CAMERA] = "Camera", [KEY_SOUND] = "Sound",
609 [KEY_QUESTION] = "Question", [KEY_EMAIL] = "Email",
610 [KEY_CHAT] = "Chat", [KEY_SEARCH] = "Search",
611 [KEY_CONNECT] = "Connect", [KEY_FINANCE] = "Finance",
612 [KEY_SPORT] = "Sport", [KEY_SHOP] = "Shop",
613 [KEY_ALTERASE] = "AlternateErase", [KEY_CANCEL] = "Cancel",
614 [KEY_BRIGHTNESSDOWN] = "BrightnessDown", [KEY_BRIGHTNESSUP] = "BrightnessUp",
615 [KEY_MEDIA] = "Media", [KEY_UNKNOWN] = "Unknown",
616 [BTN_0] = "Btn0", [BTN_1] = "Btn1",
617 [BTN_2] = "Btn2", [BTN_3] = "Btn3",
618 [BTN_4] = "Btn4", [BTN_5] = "Btn5",
619 [BTN_6] = "Btn6", [BTN_7] = "Btn7",
620 [BTN_8] = "Btn8", [BTN_9] = "Btn9",
621 [BTN_LEFT] = "LeftBtn", [BTN_RIGHT] = "RightBtn",
622 [BTN_MIDDLE] = "MiddleBtn", [BTN_SIDE] = "SideBtn",
623 [BTN_EXTRA] = "ExtraBtn", [BTN_FORWARD] = "ForwardBtn",
624 [BTN_BACK] = "BackBtn", [BTN_TASK] = "TaskBtn",
625 [BTN_TRIGGER] = "Trigger", [BTN_THUMB] = "ThumbBtn",
626 [BTN_THUMB2] = "ThumbBtn2", [BTN_TOP] = "TopBtn",
627 [BTN_TOP2] = "TopBtn2", [BTN_PINKIE] = "PinkieBtn",
628 [BTN_BASE] = "BaseBtn", [BTN_BASE2] = "BaseBtn2",
629 [BTN_BASE3] = "BaseBtn3", [BTN_BASE4] = "BaseBtn4",
630 [BTN_BASE5] = "BaseBtn5", [BTN_BASE6] = "BaseBtn6",
631 [BTN_DEAD] = "BtnDead", [BTN_A] = "BtnA",
632 [BTN_B] = "BtnB", [BTN_C] = "BtnC",
633 [BTN_X] = "BtnX", [BTN_Y] = "BtnY",
634 [BTN_Z] = "BtnZ", [BTN_TL] = "BtnTL",
635 [BTN_TR] = "BtnTR", [BTN_TL2] = "BtnTL2",
636 [BTN_TR2] = "BtnTR2", [BTN_SELECT] = "BtnSelect",
637 [BTN_START] = "BtnStart", [BTN_MODE] = "BtnMode",
638 [BTN_THUMBL] = "BtnThumbL", [BTN_THUMBR] = "BtnThumbR",
639 [BTN_TOOL_PEN] = "ToolPen", [BTN_TOOL_RUBBER] = "ToolRubber",
640 [BTN_TOOL_BRUSH] = "ToolBrush", [BTN_TOOL_PENCIL] = "ToolPencil",
641 [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger",
642 [BTN_TOOL_MOUSE] = "ToolMouse", [BTN_TOOL_LENS] = "ToolLens",
643 [BTN_TOUCH] = "Touch", [BTN_STYLUS] = "Stylus",
644 [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "ToolDoubleTap",
645 [BTN_TOOL_TRIPLETAP] = "ToolTripleTap", [BTN_GEAR_DOWN] = "WheelBtn",
646 [BTN_GEAR_UP] = "Gear up", [KEY_OK] = "Ok",
647 [KEY_SELECT] = "Select", [KEY_GOTO] = "Goto",
648 [KEY_CLEAR] = "Clear", [KEY_POWER2] = "Power2",
649 [KEY_OPTION] = "Option", [KEY_INFO] = "Info",
650 [KEY_TIME] = "Time", [KEY_VENDOR] = "Vendor",
651 [KEY_ARCHIVE] = "Archive", [KEY_PROGRAM] = "Program",
652 [KEY_CHANNEL] = "Channel", [KEY_FAVORITES] = "Favorites",
653 [KEY_EPG] = "EPG", [KEY_PVR] = "PVR",
654 [KEY_MHP] = "MHP", [KEY_LANGUAGE] = "Language",
655 [KEY_TITLE] = "Title", [KEY_SUBTITLE] = "Subtitle",
656 [KEY_ANGLE] = "Angle", [KEY_ZOOM] = "Zoom",
657 [KEY_MODE] = "Mode", [KEY_KEYBOARD] = "Keyboard",
658 [KEY_SCREEN] = "Screen", [KEY_PC] = "PC",
659 [KEY_TV] = "TV", [KEY_TV2] = "TV2",
660 [KEY_VCR] = "VCR", [KEY_VCR2] = "VCR2",
661 [KEY_SAT] = "Sat", [KEY_SAT2] = "Sat2",
662 [KEY_CD] = "CD", [KEY_TAPE] = "Tape",
663 [KEY_RADIO] = "Radio", [KEY_TUNER] = "Tuner",
664 [KEY_PLAYER] = "Player", [KEY_TEXT] = "Text",
665 [KEY_DVD] = "DVD", [KEY_AUX] = "Aux",
666 [KEY_MP3] = "MP3", [KEY_AUDIO] = "Audio",
667 [KEY_VIDEO] = "Video", [KEY_DIRECTORY] = "Directory",
668 [KEY_LIST] = "List", [KEY_MEMO] = "Memo",
669 [KEY_CALENDAR] = "Calendar", [KEY_RED] = "Red",
670 [KEY_GREEN] = "Green", [KEY_YELLOW] = "Yellow",
671 [KEY_BLUE] = "Blue", [KEY_CHANNELUP] = "ChannelUp",
672 [KEY_CHANNELDOWN] = "ChannelDown", [KEY_FIRST] = "First",
673 [KEY_LAST] = "Last", [KEY_AB] = "AB",
674 [KEY_NEXT] = "Next", [KEY_RESTART] = "Restart",
675 [KEY_SLOW] = "Slow", [KEY_SHUFFLE] = "Shuffle",
676 [KEY_BREAK] = "Break", [KEY_PREVIOUS] = "Previous",
677 [KEY_DIGITS] = "Digits", [KEY_TEEN] = "TEEN",
678 [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "DeleteEOL",
679 [KEY_DEL_EOS] = "DeleteEOS", [KEY_INS_LINE] = "InsertLine",
680 [KEY_DEL_LINE] = "DeleteLine",
681 [KEY_SEND] = "Send", [KEY_REPLY] = "Reply",
682 [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save",
683 [KEY_DOCUMENTS] = "Documents",
684 [KEY_FN] = "Fn", [KEY_FN_ESC] = "Fn+ESC",
685 [KEY_FN_1] = "Fn+1", [KEY_FN_2] = "Fn+2",
686 [KEY_FN_B] = "Fn+B", [KEY_FN_D] = "Fn+D",
687 [KEY_FN_E] = "Fn+E", [KEY_FN_F] = "Fn+F",
688 [KEY_FN_S] = "Fn+S",
689 [KEY_FN_F1] = "Fn+F1", [KEY_FN_F2] = "Fn+F2",
690 [KEY_FN_F3] = "Fn+F3", [KEY_FN_F4] = "Fn+F4",
691 [KEY_FN_F5] = "Fn+F5", [KEY_FN_F6] = "Fn+F6",
692 [KEY_FN_F7] = "Fn+F7", [KEY_FN_F8] = "Fn+F8",
693 [KEY_FN_F9] = "Fn+F9", [KEY_FN_F10] = "Fn+F10",
694 [KEY_FN_F11] = "Fn+F11", [KEY_FN_F12] = "Fn+F12",
695 [KEY_KBDILLUMTOGGLE] = "KbdIlluminationToggle",
696 [KEY_KBDILLUMDOWN] = "KbdIlluminationDown",
697 [KEY_KBDILLUMUP] = "KbdIlluminationUp",
698 [KEY_SWITCHVIDEOMODE] = "SwitchVideoMode",
699};
700
701static char *relatives[REL_MAX + 1] = {
702 [REL_X] = "X", [REL_Y] = "Y",
703 [REL_Z] = "Z", [REL_RX] = "Rx",
704 [REL_RY] = "Ry", [REL_RZ] = "Rz",
705 [REL_HWHEEL] = "HWheel", [REL_DIAL] = "Dial",
706 [REL_WHEEL] = "Wheel", [REL_MISC] = "Misc",
707};
708
709static char *absolutes[ABS_MAX + 1] = {
710 [ABS_X] = "X", [ABS_Y] = "Y",
711 [ABS_Z] = "Z", [ABS_RX] = "Rx",
712 [ABS_RY] = "Ry", [ABS_RZ] = "Rz",
713 [ABS_THROTTLE] = "Throttle", [ABS_RUDDER] = "Rudder",
714 [ABS_WHEEL] = "Wheel", [ABS_GAS] = "Gas",
715 [ABS_BRAKE] = "Brake", [ABS_HAT0X] = "Hat0X",
716 [ABS_HAT0Y] = "Hat0Y", [ABS_HAT1X] = "Hat1X",
717 [ABS_HAT1Y] = "Hat1Y", [ABS_HAT2X] = "Hat2X",
718 [ABS_HAT2Y] = "Hat2Y", [ABS_HAT3X] = "Hat3X",
719 [ABS_HAT3Y] = "Hat 3Y", [ABS_PRESSURE] = "Pressure",
720 [ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt",
721 [ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "Tool Width",
722 [ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc",
723};
724 26
725static char *misc[MSC_MAX + 1] = { 27void hid_dump_input(struct hid_usage *, __s32);
726 [MSC_SERIAL] = "Serial", [MSC_PULSELED] = "Pulseled", 28void hid_dump_device(struct hid_device *);
727 [MSC_GESTURE] = "Gesture", [MSC_RAW] = "RawData" 29void hid_dump_field(struct hid_field *, int);
728}; 30void hid_resolv_usage(unsigned);
31void hid_resolv_event(__u8, __u16);
729 32
730static char *leds[LED_MAX + 1] = { 33#else
731 [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock",
732 [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose",
733 [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep",
734 [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute",
735 [LED_MISC] = "Misc",
736};
737 34
738static char *repeats[REP_MAX + 1] = { 35#define hid_dump_input(a,b) do { } while (0)
739 [REP_DELAY] = "Delay", [REP_PERIOD] = "Period" 36#define hid_dump_device(c) do { } while (0)
740}; 37#define hid_dump_field(a,b) do { } while (0)
38#define hid_resolv_usage(a) do { } while (0)
39#define hid_resolv_event(a,b) do { } while (0)
741 40
742static char *sounds[SND_MAX + 1] = { 41#endif /* CONFIG_HID_DEBUG */
743 [SND_CLICK] = "Click", [SND_BELL] = "Bell",
744 [SND_TONE] = "Tone"
745};
746 42
747static char **names[EV_MAX + 1] = {
748 [EV_SYN] = syncs, [EV_KEY] = keys,
749 [EV_REL] = relatives, [EV_ABS] = absolutes,
750 [EV_MSC] = misc, [EV_LED] = leds,
751 [EV_SND] = sounds, [EV_REP] = repeats,
752};
753 43
754static void __attribute__((unused)) resolv_event(__u8 type, __u16 code) { 44#endif
755 45
756 printk("%s.%s", events[type] ? events[type] : "?",
757 names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
758}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 770120add15a..37076b116ed0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright (c) 1999 Andreas Gal 7 * Copyright (c) 1999 Andreas Gal
8 * Copyright (c) 2000-2001 Vojtech Pavlik 8 * Copyright (c) 2000-2001 Vojtech Pavlik
9 * Copyright (c) 2006 Jiri Kosina 9 * Copyright (c) 2006-2007 Jiri Kosina
10 */ 10 */
11 11
12/* 12/*
@@ -247,6 +247,11 @@ struct hid_item {
247 * HID device quirks. 247 * HID device quirks.
248 */ 248 */
249 249
250/*
251 * Increase this if you need to configure more HID quirks at module load time
252 */
253#define MAX_USBHID_BOOT_QUIRKS 4
254
250#define HID_QUIRK_INVERT 0x00000001 255#define HID_QUIRK_INVERT 0x00000001
251#define HID_QUIRK_NOTOUCH 0x00000002 256#define HID_QUIRK_NOTOUCH 0x00000002
252#define HID_QUIRK_IGNORE 0x00000004 257#define HID_QUIRK_IGNORE 0x00000004
@@ -264,6 +269,12 @@ struct hid_item {
264#define HID_QUIRK_INVERT_HWHEEL 0x00004000 269#define HID_QUIRK_INVERT_HWHEEL 0x00004000
265#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000 270#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000
266#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00010000 271#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00010000
272#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00020000
273#define HID_QUIRK_IGNORE_MOUSE 0x00040000
274#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00080000
275#define HID_QUIRK_LOGITECH_DESCRIPTOR 0x00100000
276#define HID_QUIRK_DUPLICATE_USAGES 0x00200000
277#define HID_QUIRK_RESET_LEDS 0x00400000
267 278
268/* 279/*
269 * This is the global environment of the parser. This information is 280 * This is the global environment of the parser. This information is
@@ -289,7 +300,7 @@ struct hid_global {
289 */ 300 */
290 301
291#define HID_MAX_DESCRIPTOR_SIZE 4096 302#define HID_MAX_DESCRIPTOR_SIZE 4096
292#define HID_MAX_USAGES 1024 303#define HID_MAX_USAGES 8192
293#define HID_DEFAULT_NUM_COLLECTIONS 16 304#define HID_DEFAULT_NUM_COLLECTIONS 16
294 305
295struct hid_local { 306struct hid_local {
@@ -430,15 +441,14 @@ struct hid_device { /* device report descriptor */
430 441
431 /* device-specific function pointers */ 442 /* device-specific function pointers */
432 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); 443 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
433 int (*hidinput_open) (struct input_dev *); 444 int (*hid_open) (struct hid_device *);
434 void (*hidinput_close) (struct input_dev *); 445 void (*hid_close) (struct hid_device *);
435 446
436 /* hiddev event handler */ 447 /* hiddev event handler */
437 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 448 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
438 struct hid_usage *, __s32); 449 struct hid_usage *, __s32);
439 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 450 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
440#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 451#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
441 unsigned int pb_fnmode;
442 unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; 452 unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
443 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; 453 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
444#endif 454#endif
@@ -472,16 +482,6 @@ struct hid_descriptor {
472 struct hid_class_descriptor desc[1]; 482 struct hid_class_descriptor desc[1];
473} __attribute__ ((packed)); 483} __attribute__ ((packed));
474 484
475#ifdef DEBUG
476#include "hid-debug.h"
477#else
478#define hid_dump_input(a,b) do { } while (0)
479#define hid_dump_device(c) do { } while (0)
480#define hid_dump_field(a,b) do { } while (0)
481#define resolv_usage(a) do { } while (0)
482#define resolv_event(a,b) do { } while (0)
483#endif
484
485/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 485/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
486/* We ignore a few input applications that are not widely used */ 486/* We ignore a few input applications that are not widely used */
487#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001)) 487#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001))
@@ -500,10 +500,17 @@ void hid_output_report(struct hid_report *report, __u8 *data);
500void hid_free_device(struct hid_device *device); 500void hid_free_device(struct hid_device *device);
501struct hid_device *hid_parse_report(__u8 *start, unsigned size); 501struct hid_device *hid_parse_report(__u8 *start, unsigned size);
502 502
503/* HID quirks API */
504u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
505int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, const u32 quirks);
506int usbhid_quirks_init(char **quirks_param);
507void usbhid_quirks_exit(void);
508
503#ifdef CONFIG_HID_FF 509#ifdef CONFIG_HID_FF
504int hid_ff_init(struct hid_device *hid); 510int hid_ff_init(struct hid_device *hid);
505 511
506int hid_lgff_init(struct hid_device *hid); 512int hid_lgff_init(struct hid_device *hid);
513int hid_plff_init(struct hid_device *hid);
507int hid_tmff_init(struct hid_device *hid); 514int hid_tmff_init(struct hid_device *hid);
508int hid_zpff_init(struct hid_device *hid); 515int hid_zpff_init(struct hid_device *hid);
509#ifdef CONFIG_HID_PID 516#ifdef CONFIG_HID_PID
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index fca93025ab51..17c29dca8354 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -21,22 +21,72 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23 23
24struct hrtimer_clock_base;
25struct hrtimer_cpu_base;
26
24/* 27/*
25 * Mode arguments of xxx_hrtimer functions: 28 * Mode arguments of xxx_hrtimer functions:
26 */ 29 */
27enum hrtimer_mode { 30enum hrtimer_mode {
28 HRTIMER_ABS, /* Time value is absolute */ 31 HRTIMER_MODE_ABS, /* Time value is absolute */
29 HRTIMER_REL, /* Time value is relative to now */ 32 HRTIMER_MODE_REL, /* Time value is relative to now */
30}; 33};
31 34
35/*
36 * Return values for the callback function
37 */
32enum hrtimer_restart { 38enum hrtimer_restart {
33 HRTIMER_NORESTART, 39 HRTIMER_NORESTART, /* Timer is not restarted */
34 HRTIMER_RESTART, 40 HRTIMER_RESTART, /* Timer must be restarted */
35}; 41};
36 42
37#define HRTIMER_INACTIVE ((void *)1UL) 43/*
44 * hrtimer callback modes:
45 *
46 * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context
47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context
48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and
49 * does not restart the timer
50 * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context
51 * Special mode for tick emultation
52 */
53enum hrtimer_cb_mode {
54 HRTIMER_CB_SOFTIRQ,
55 HRTIMER_CB_IRQSAFE,
56 HRTIMER_CB_IRQSAFE_NO_RESTART,
57 HRTIMER_CB_IRQSAFE_NO_SOFTIRQ,
58};
38 59
39struct hrtimer_base; 60/*
61 * Values to track state of the timer
62 *
63 * Possible states:
64 *
65 * 0x00 inactive
66 * 0x01 enqueued into rbtree
67 * 0x02 callback function running
68 * 0x04 callback pending (high resolution mode)
69 *
70 * Special case:
71 * 0x03 callback function running and enqueued
72 * (was requeued on another CPU)
73 * The "callback function running and enqueued" status is only possible on
74 * SMP. It happens for example when a posix timer expired and the callback
75 * queued a signal. Between dropping the lock which protects the posix timer
76 * and reacquiring the base lock of the hrtimer, another CPU can deliver the
77 * signal and rearm the timer. We have to preserve the callback running state,
78 * as otherwise the timer could be removed before the softirq code finishes the
79 * the handling of the timer.
80 *
81 * The HRTIMER_STATE_ENQUEUE bit is always or'ed to the current state to
82 * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario.
83 *
84 * All state transitions are protected by cpu_base->lock.
85 */
86#define HRTIMER_STATE_INACTIVE 0x00
87#define HRTIMER_STATE_ENQUEUED 0x01
88#define HRTIMER_STATE_CALLBACK 0x02
89#define HRTIMER_STATE_PENDING 0x04
40 90
41/** 91/**
42 * struct hrtimer - the basic hrtimer structure 92 * struct hrtimer - the basic hrtimer structure
@@ -46,14 +96,34 @@ struct hrtimer_base;
46 * which the timer is based. 96 * which the timer is based.
47 * @function: timer expiry callback function 97 * @function: timer expiry callback function
48 * @base: pointer to the timer base (per cpu and per clock) 98 * @base: pointer to the timer base (per cpu and per clock)
99 * @state: state information (See bit values above)
100 * @cb_mode: high resolution timer feature to select the callback execution
101 * mode
102 * @cb_entry: list head to enqueue an expired timer into the callback list
103 * @start_site: timer statistics field to store the site where the timer
104 * was started
105 * @start_comm: timer statistics field to store the name of the process which
106 * started the timer
107 * @start_pid: timer statistics field to store the pid of the task which
108 * started the timer
49 * 109 *
50 * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() 110 * The hrtimer structure must be initialized by hrtimer_init()
51 */ 111 */
52struct hrtimer { 112struct hrtimer {
53 struct rb_node node; 113 struct rb_node node;
54 ktime_t expires; 114 ktime_t expires;
55 int (*function)(struct hrtimer *); 115 enum hrtimer_restart (*function)(struct hrtimer *);
56 struct hrtimer_base *base; 116 struct hrtimer_clock_base *base;
117 unsigned long state;
118#ifdef CONFIG_HIGH_RES_TIMERS
119 enum hrtimer_cb_mode cb_mode;
120 struct list_head cb_entry;
121#endif
122#ifdef CONFIG_TIMER_STATS
123 void *start_site;
124 char start_comm[16];
125 int start_pid;
126#endif
57}; 127};
58 128
59/** 129/**
@@ -69,38 +139,119 @@ struct hrtimer_sleeper {
69}; 139};
70 140
71/** 141/**
72 * struct hrtimer_base - the timer base for a specific clock 142 * struct hrtimer_clock_base - the timer base for a specific clock
73 * @index: clock type index for per_cpu support when moving a timer 143 * @cpu_base: per cpu clock base
74 * to a base on another cpu. 144 * @index: clock type index for per_cpu support when moving a
75 * @lock: lock protecting the base and associated timers 145 * timer to a base on another cpu.
76 * @active: red black tree root node for the active timers 146 * @active: red black tree root node for the active timers
77 * @first: pointer to the timer node which expires first 147 * @first: pointer to the timer node which expires first
78 * @resolution: the resolution of the clock, in nanoseconds 148 * @resolution: the resolution of the clock, in nanoseconds
79 * @get_time: function to retrieve the current time of the clock 149 * @get_time: function to retrieve the current time of the clock
80 * @get_softirq_time: function to retrieve the current time from the softirq 150 * @get_softirq_time: function to retrieve the current time from the softirq
81 * @curr_timer: the timer which is executing a callback right now
82 * @softirq_time: the time when running the hrtimer queue in the softirq 151 * @softirq_time: the time when running the hrtimer queue in the softirq
83 * @lock_key: the lock_class_key for use with lockdep 152 * @cb_pending: list of timers where the callback is pending
153 * @offset: offset of this clock to the monotonic base
154 * @reprogram: function to reprogram the timer event
84 */ 155 */
85struct hrtimer_base { 156struct hrtimer_clock_base {
157 struct hrtimer_cpu_base *cpu_base;
86 clockid_t index; 158 clockid_t index;
87 spinlock_t lock;
88 struct rb_root active; 159 struct rb_root active;
89 struct rb_node *first; 160 struct rb_node *first;
90 ktime_t resolution; 161 ktime_t resolution;
91 ktime_t (*get_time)(void); 162 ktime_t (*get_time)(void);
92 ktime_t (*get_softirq_time)(void); 163 ktime_t (*get_softirq_time)(void);
93 struct hrtimer *curr_timer;
94 ktime_t softirq_time; 164 ktime_t softirq_time;
95 struct lock_class_key lock_key; 165#ifdef CONFIG_HIGH_RES_TIMERS
166 ktime_t offset;
167 int (*reprogram)(struct hrtimer *t,
168 struct hrtimer_clock_base *b,
169 ktime_t n);
170#endif
171};
172
173#define HRTIMER_MAX_CLOCK_BASES 2
174
175/*
176 * struct hrtimer_cpu_base - the per cpu clock bases
177 * @lock: lock protecting the base and associated clock bases
178 * and timers
179 * @lock_key: the lock_class_key for use with lockdep
180 * @clock_base: array of clock bases for this cpu
181 * @curr_timer: the timer which is executing a callback right now
182 * @expires_next: absolute time of the next event which was scheduled
183 * via clock_set_next_event()
184 * @hres_active: State of high resolution mode
185 * @check_clocks: Indictator, when set evaluate time source and clock
186 * event devices whether high resolution mode can be
187 * activated.
188 * @cb_pending: Expired timers are moved from the rbtree to this
189 * list in the timer interrupt. The list is processed
190 * in the softirq.
191 * @nr_events: Total number of timer interrupt events
192 */
193struct hrtimer_cpu_base {
194 spinlock_t lock;
195 struct lock_class_key lock_key;
196 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
197#ifdef CONFIG_HIGH_RES_TIMERS
198 ktime_t expires_next;
199 int hres_active;
200 struct list_head cb_pending;
201 unsigned long nr_events;
202#endif
96}; 203};
97 204
205#ifdef CONFIG_HIGH_RES_TIMERS
206struct clock_event_device;
207
208extern void clock_was_set(void);
209extern void hres_timers_resume(void);
210extern void hrtimer_interrupt(struct clock_event_device *dev);
211
212/*
213 * In high resolution mode the time reference must be read accurate
214 */
215static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
216{
217 return timer->base->get_time();
218}
219
220/*
221 * The resolution of the clocks. The resolution value is returned in
222 * the clock_getres() system call to give application programmers an
223 * idea of the (in)accuracy of timers. Timer values are rounded up to
224 * this resolution values.
225 */
226# define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 }
227# define KTIME_MONOTONIC_RES KTIME_HIGH_RES
228
229#else
230
231# define KTIME_MONOTONIC_RES KTIME_LOW_RES
232
98/* 233/*
99 * clock_was_set() is a NOP for non- high-resolution systems. The 234 * clock_was_set() is a NOP for non- high-resolution systems. The
100 * time-sorted order guarantees that a timer does not expire early and 235 * time-sorted order guarantees that a timer does not expire early and
101 * is expired in the next softirq when the clock was advanced. 236 * is expired in the next softirq when the clock was advanced.
102 */ 237 */
103#define clock_was_set() do { } while (0) 238static inline void clock_was_set(void) { }
239
240static inline void hres_timers_resume(void) { }
241
242/*
243 * In non high resolution mode the time reference is taken from
244 * the base softirq time variable.
245 */
246static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
247{
248 return timer->base->softirq_time;
249}
250
251#endif
252
253extern ktime_t ktime_get(void);
254extern ktime_t ktime_get_real(void);
104 255
105/* Exported timer functions: */ 256/* Exported timer functions: */
106 257
@@ -114,19 +265,33 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
114extern int hrtimer_cancel(struct hrtimer *timer); 265extern int hrtimer_cancel(struct hrtimer *timer);
115extern int hrtimer_try_to_cancel(struct hrtimer *timer); 266extern int hrtimer_try_to_cancel(struct hrtimer *timer);
116 267
117#define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS) 268static inline int hrtimer_restart(struct hrtimer *timer)
269{
270 return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS);
271}
118 272
119/* Query timers: */ 273/* Query timers: */
120extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); 274extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
121extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp); 275extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
122 276
123#ifdef CONFIG_NO_IDLE_HZ
124extern ktime_t hrtimer_get_next_event(void); 277extern ktime_t hrtimer_get_next_event(void);
125#endif
126 278
279/*
280 * A timer is active, when it is enqueued into the rbtree or the callback
281 * function is running.
282 */
127static inline int hrtimer_active(const struct hrtimer *timer) 283static inline int hrtimer_active(const struct hrtimer *timer)
128{ 284{
129 return rb_parent(&timer->node) != &timer->node; 285 return timer->state != HRTIMER_STATE_INACTIVE;
286}
287
288/*
289 * Helper function to check, whether the timer is on one of the queues
290 */
291static inline int hrtimer_is_queued(struct hrtimer *timer)
292{
293 return timer->state &
294 (HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
130} 295}
131 296
132/* Forward a hrtimer so it expires after now: */ 297/* Forward a hrtimer so it expires after now: */
@@ -149,4 +314,53 @@ extern void hrtimer_run_queues(void);
149/* Bootup initialization: */ 314/* Bootup initialization: */
150extern void __init hrtimers_init(void); 315extern void __init hrtimers_init(void);
151 316
317#if BITS_PER_LONG < 64
318extern unsigned long ktime_divns(const ktime_t kt, s64 div);
319#else /* BITS_PER_LONG < 64 */
320# define ktime_divns(kt, div) (unsigned long)((kt).tv64 / (div))
321#endif
322
323/* Show pending timers: */
324extern void sysrq_timer_list_show(void);
325
326/*
327 * Timer-statistics info:
328 */
329#ifdef CONFIG_TIMER_STATS
330
331extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
332 void *timerf, char * comm);
333
334static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
335{
336 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
337 timer->function, timer->start_comm);
338}
339
340extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
341 void *addr);
342
343static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
344{
345 __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
346}
347
348static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
349{
350 timer->start_site = NULL;
351}
352#else
353static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
354{
355}
356
357static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
358{
359}
360
361static inline void timer_stats_hrtimer_clear_start_info(struct hrtimer *timer)
362{
363}
364#endif
365
152#endif 366#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a60995afe334..3f3e7a648da3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -4,6 +4,7 @@
4#ifdef CONFIG_HUGETLB_PAGE 4#ifdef CONFIG_HUGETLB_PAGE
5 5
6#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
7#include <linux/shm.h>
7#include <asm/tlbflush.h> 8#include <asm/tlbflush.h>
8 9
9struct ctl_table; 10struct ctl_table;
@@ -168,7 +169,12 @@ void hugetlb_put_quota(struct address_space *mapping);
168 169
169static inline int is_file_hugepages(struct file *file) 170static inline int is_file_hugepages(struct file *file)
170{ 171{
171 return file->f_op == &hugetlbfs_file_operations; 172 if (file->f_op == &hugetlbfs_file_operations)
173 return 1;
174 if (is_file_shm_hugepages(file))
175 return 1;
176
177 return 0;
172} 178}
173 179
174static inline void set_file_hugepages(struct file *file) 180static inline void set_file_hugepages(struct file *file)
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index d38778f2fbec..9c21dc793d7b 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -115,6 +115,8 @@
115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */ 117#define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */
118#define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */
119#define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */
118 120
119#define I2C_DRIVERID_I2CDEV 900 121#define I2C_DRIVERID_I2CDEV 900
120#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 122#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
@@ -230,7 +232,6 @@
230#define I2C_HW_SMBUS_PIIX4 0x040000 232#define I2C_HW_SMBUS_PIIX4 0x040000
231#define I2C_HW_SMBUS_ALI15X3 0x040001 233#define I2C_HW_SMBUS_ALI15X3 0x040001
232#define I2C_HW_SMBUS_VIA2 0x040002 234#define I2C_HW_SMBUS_VIA2 0x040002
233#define I2C_HW_SMBUS_VOODOO3 0x040003
234#define I2C_HW_SMBUS_I801 0x040004 235#define I2C_HW_SMBUS_I801 0x040004
235#define I2C_HW_SMBUS_AMD756 0x040005 236#define I2C_HW_SMBUS_AMD756 0x040005
236#define I2C_HW_SMBUS_SIS5595 0x040006 237#define I2C_HW_SMBUS_SIS5595 0x040006
@@ -246,13 +247,11 @@
246#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */ 247#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */
247#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */ 248#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
248#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ 249#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
250#define I2C_HW_SMBUS_ALI1563 0x040013
249 251
250/* --- ISA pseudo-adapter */ 252/* --- ISA pseudo-adapter */
251#define I2C_HW_ISA 0x050000 253#define I2C_HW_ISA 0x050000
252 254
253/* --- IPMI pseudo-adapter */
254#define I2C_HW_IPMI 0x0b0000
255
256/* --- IPMB adapter */ 255/* --- IPMB adapter */
257#define I2C_HW_IPMB 0x0c0000 256#define I2C_HW_IPMB 0x0c0000
258 257
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 71e50d3e492f..9428092017e3 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -125,7 +125,12 @@ struct i2c_driver {
125 * it must be freed here. 125 * it must be freed here.
126 */ 126 */
127 int (*detach_client)(struct i2c_client *); 127 int (*detach_client)(struct i2c_client *);
128 128
129 /* driver model interfaces that don't relate to enumeration */
130 void (*shutdown)(struct i2c_client *);
131 int (*suspend)(struct i2c_client *, pm_message_t mesg);
132 int (*resume)(struct i2c_client *);
133
129 /* a ioctl like command that can be used to perform specific functions 134 /* a ioctl like command that can be used to perform specific functions
130 * with the device. 135 * with the device.
131 */ 136 */
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index c2519df1b6dc..a0b23dd45239 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -24,12 +24,13 @@
24#define MAX_I2O_CONTROLLERS 32 24#define MAX_I2O_CONTROLLERS 32
25 25
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/types.h>
27 28
28/* 29/*
29 * I2O Control IOCTLs and structures 30 * I2O Control IOCTLs and structures
30 */ 31 */
31#define I2O_MAGIC_NUMBER 'i' 32#define I2O_MAGIC_NUMBER 'i'
32#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS]) 33#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS])
33#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) 34#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct)
34#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) 35#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct)
35#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) 36#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget)
@@ -37,7 +38,7 @@
37#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) 38#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer)
38#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) 39#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer)
39#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) 40#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer)
40#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32) 41#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32)
41#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) 42#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
42#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) 43#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id)
43#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) 44#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info)
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 24da4fbc1a2f..474f2a51cf0a 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -82,6 +82,15 @@ struct icmphdr {
82 } un; 82 } un;
83}; 83};
84 84
85#ifdef __KERNEL__
86#include <linux/skbuff.h>
87
88static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
89{
90 return (struct icmphdr *)skb_transport_header(skb);
91}
92#endif
93
85/* 94/*
86 * constants for (set|get)sockopt 95 * constants for (set|get)sockopt
87 */ 96 */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 68d3526c3a05..7c5e9817e998 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -75,6 +75,15 @@ struct icmp6hdr {
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref 75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
76}; 76};
77 77
78#ifdef __KERNEL__
79#include <linux/skbuff.h>
80
81static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
82{
83 return (struct icmp6hdr *)skb_transport_header(skb);
84}
85#endif
86
78#define ICMPV6_ROUTER_PREF_LOW 0x3 87#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 88#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1 89#define ICMPV6_ROUTER_PREF_HIGH 0x1
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e26a03981a94..d3bbc7188b6a 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -18,6 +18,9 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/completion.h> 20#include <linux/completion.h>
21#ifdef CONFIG_BLK_DEV_IDEACPI
22#include <acpi/acpi.h>
23#endif
21#include <asm/byteorder.h> 24#include <asm/byteorder.h>
22#include <asm/system.h> 25#include <asm/system.h>
23#include <asm/io.h> 26#include <asm/io.h>
@@ -541,6 +544,11 @@ typedef enum {
541struct ide_driver_s; 544struct ide_driver_s;
542struct ide_settings_s; 545struct ide_settings_s;
543 546
547#ifdef CONFIG_BLK_DEV_IDEACPI
548struct ide_acpi_drive_link;
549struct ide_acpi_hwif_link;
550#endif
551
544typedef struct ide_drive_s { 552typedef struct ide_drive_s {
545 char name[4]; /* drive name, such as "hda" */ 553 char name[4]; /* drive name, such as "hda" */
546 char driver_req[10]; /* requests specific driver */ 554 char driver_req[10]; /* requests specific driver */
@@ -607,6 +615,7 @@ typedef struct ide_drive_s {
607 u8 init_speed; /* transfer rate set at boot */ 615 u8 init_speed; /* transfer rate set at boot */
608 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ 616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
609 u8 current_speed; /* current transfer rate set */ 617 u8 current_speed; /* current transfer rate set */
618 u8 desired_speed; /* desired transfer rate set */
610 u8 dn; /* now wide spread use */ 619 u8 dn; /* now wide spread use */
611 u8 wcache; /* status of write cache */ 620 u8 wcache; /* status of write cache */
612 u8 acoustic; /* acoustic management */ 621 u8 acoustic; /* acoustic management */
@@ -628,7 +637,6 @@ typedef struct ide_drive_s {
628 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 637 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
629 unsigned int cyl; /* "real" number of cyls */ 638 unsigned int cyl; /* "real" number of cyls */
630 unsigned int drive_data; /* use by tuneproc/selectproc */ 639 unsigned int drive_data; /* use by tuneproc/selectproc */
631 unsigned int usage; /* current "open()" count for drive */
632 unsigned int failures; /* current failure count */ 640 unsigned int failures; /* current failure count */
633 unsigned int max_failures; /* maximum allowed failure count */ 641 unsigned int max_failures; /* maximum allowed failure count */
634 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 642 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
@@ -637,6 +645,9 @@ typedef struct ide_drive_s {
637 645
638 int lun; /* logical unit */ 646 int lun; /* logical unit */
639 int crc_count; /* crc counter to reduce drive speed */ 647 int crc_count; /* crc counter to reduce drive speed */
648#ifdef CONFIG_BLK_DEV_IDEACPI
649 struct ide_acpi_drive_link *acpidata;
650#endif
640 struct list_head list; 651 struct list_head list;
641 struct device gendev; 652 struct device gendev;
642 struct completion gendev_rel_comp; /* to deal with device release() */ 653 struct completion gendev_rel_comp; /* to deal with device release() */
@@ -725,23 +736,22 @@ typedef struct hwif_s {
725 int (*ide_dma_end)(ide_drive_t *drive); 736 int (*ide_dma_end)(ide_drive_t *drive);
726 int (*ide_dma_check)(ide_drive_t *drive); 737 int (*ide_dma_check)(ide_drive_t *drive);
727 int (*ide_dma_on)(ide_drive_t *drive); 738 int (*ide_dma_on)(ide_drive_t *drive);
728 int (*ide_dma_off_quietly)(ide_drive_t *drive); 739 void (*dma_off_quietly)(ide_drive_t *drive);
729 int (*ide_dma_test_irq)(ide_drive_t *drive); 740 int (*ide_dma_test_irq)(ide_drive_t *drive);
730 int (*ide_dma_host_on)(ide_drive_t *drive); 741 void (*ide_dma_clear_irq)(ide_drive_t *drive);
731 int (*ide_dma_host_off)(ide_drive_t *drive); 742 void (*dma_host_on)(ide_drive_t *drive);
743 void (*dma_host_off)(ide_drive_t *drive);
732 int (*ide_dma_lostirq)(ide_drive_t *drive); 744 int (*ide_dma_lostirq)(ide_drive_t *drive);
733 int (*ide_dma_timeout)(ide_drive_t *drive); 745 int (*ide_dma_timeout)(ide_drive_t *drive);
734 746
735 void (*OUTB)(u8 addr, unsigned long port); 747 void (*OUTB)(u8 addr, unsigned long port);
736 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port); 748 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
737 void (*OUTW)(u16 addr, unsigned long port); 749 void (*OUTW)(u16 addr, unsigned long port);
738 void (*OUTL)(u32 addr, unsigned long port);
739 void (*OUTSW)(unsigned long port, void *addr, u32 count); 750 void (*OUTSW)(unsigned long port, void *addr, u32 count);
740 void (*OUTSL)(unsigned long port, void *addr, u32 count); 751 void (*OUTSL)(unsigned long port, void *addr, u32 count);
741 752
742 u8 (*INB)(unsigned long port); 753 u8 (*INB)(unsigned long port);
743 u16 (*INW)(unsigned long port); 754 u16 (*INW)(unsigned long port);
744 u32 (*INL)(unsigned long port);
745 void (*INSW)(unsigned long port, void *addr, u32 count); 755 void (*INSW)(unsigned long port, void *addr, u32 count);
746 void (*INSL)(unsigned long port, void *addr, u32 count); 756 void (*INSL)(unsigned long port, void *addr, u32 count);
747 757
@@ -763,7 +773,6 @@ typedef struct hwif_s {
763 unsigned int cursg; 773 unsigned int cursg;
764 unsigned int cursg_ofs; 774 unsigned int cursg_ofs;
765 775
766 int mmio; /* hosts iomio (0) or custom (2) select */
767 int rqsize; /* max sectors per request */ 776 int rqsize; /* max sectors per request */
768 int irq; /* our irq number */ 777 int irq; /* our irq number */
769 778
@@ -791,12 +800,11 @@ typedef struct hwif_s {
791 unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */ 800 unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */
792 unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */ 801 unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */
793 unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */ 802 unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */
794 unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */
795 unsigned auto_poll : 1; /* supports nop auto-poll */ 803 unsigned auto_poll : 1; /* supports nop auto-poll */
796 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 804 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
797 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ 805 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
798 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */ 806 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */
799 unsigned atapi_irq_bogon : 1; /* Generates spurious DMA interrupts in PIO mode */ 807 unsigned mmio : 1; /* host uses MMIO */
800 808
801 struct device gendev; 809 struct device gendev;
802 struct completion gendev_rel_comp; /* To deal with device release() */ 810 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -804,6 +812,10 @@ typedef struct hwif_s {
804 void *hwif_data; /* extra hwif data */ 812 void *hwif_data; /* extra hwif data */
805 813
806 unsigned dma; 814 unsigned dma;
815
816#ifdef CONFIG_BLK_DEV_IDEACPI
817 struct ide_acpi_hwif_link *acpidata;
818#endif
807} ____cacheline_internodealigned_in_smp ide_hwif_t; 819} ____cacheline_internodealigned_in_smp ide_hwif_t;
808 820
809/* 821/*
@@ -849,6 +861,8 @@ typedef struct hwgroup_s {
849 int (*expiry)(ide_drive_t *); 861 int (*expiry)(ide_drive_t *);
850 /* ide_system_bus_speed */ 862 /* ide_system_bus_speed */
851 int pio_clock; 863 int pio_clock;
864 int req_gen;
865 int req_gen_timer;
852 866
853 unsigned char cmd_buf[4]; 867 unsigned char cmd_buf[4];
854} ide_hwgroup_t; 868} ide_hwgroup_t;
@@ -1192,8 +1206,8 @@ void ide_init_disk(struct gendisk *, ide_drive_t *);
1192extern int ideprobe_init(void); 1206extern int ideprobe_init(void);
1193 1207
1194extern void ide_scan_pcibus(int scan_direction) __init; 1208extern void ide_scan_pcibus(int scan_direction) __init;
1195extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner); 1209extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1196#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE) 1210#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1197void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1211void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *);
1198extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1212extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d);
1199 1213
@@ -1265,8 +1279,9 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1265int __ide_dma_bad_drive(ide_drive_t *); 1279int __ide_dma_bad_drive(ide_drive_t *);
1266int __ide_dma_good_drive(ide_drive_t *); 1280int __ide_dma_good_drive(ide_drive_t *);
1267int ide_use_dma(ide_drive_t *); 1281int ide_use_dma(ide_drive_t *);
1268int __ide_dma_off(ide_drive_t *); 1282void ide_dma_off(ide_drive_t *);
1269void ide_dma_verbose(ide_drive_t *); 1283void ide_dma_verbose(ide_drive_t *);
1284int ide_set_dma(ide_drive_t *);
1270ide_startstop_t ide_dma_intr(ide_drive_t *); 1285ide_startstop_t ide_dma_intr(ide_drive_t *);
1271 1286
1272#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1287#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1276,9 +1291,9 @@ extern void ide_destroy_dmatable(ide_drive_t *);
1276extern int ide_release_dma(ide_hwif_t *); 1291extern int ide_release_dma(ide_hwif_t *);
1277extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); 1292extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int);
1278 1293
1279extern int __ide_dma_host_off(ide_drive_t *); 1294void ide_dma_host_off(ide_drive_t *);
1280extern int __ide_dma_off_quietly(ide_drive_t *); 1295void ide_dma_off_quietly(ide_drive_t *);
1281extern int __ide_dma_host_on(ide_drive_t *); 1296void ide_dma_host_on(ide_drive_t *);
1282extern int __ide_dma_on(ide_drive_t *); 1297extern int __ide_dma_on(ide_drive_t *);
1283extern int __ide_dma_check(ide_drive_t *); 1298extern int __ide_dma_check(ide_drive_t *);
1284extern int ide_dma_setup(ide_drive_t *); 1299extern int ide_dma_setup(ide_drive_t *);
@@ -1290,14 +1305,27 @@ extern int __ide_dma_timeout(ide_drive_t *);
1290 1305
1291#else 1306#else
1292static inline int ide_use_dma(ide_drive_t *drive) { return 0; } 1307static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
1293static inline int __ide_dma_off(ide_drive_t *drive) { return 0; } 1308static inline void ide_dma_off(ide_drive_t *drive) { ; }
1294static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1309static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1310static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1295#endif /* CONFIG_BLK_DEV_IDEDMA */ 1311#endif /* CONFIG_BLK_DEV_IDEDMA */
1296 1312
1297#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 1313#ifndef CONFIG_BLK_DEV_IDEDMA_PCI
1298static inline void ide_release_dma(ide_hwif_t *drive) {;} 1314static inline void ide_release_dma(ide_hwif_t *drive) {;}
1299#endif 1315#endif
1300 1316
1317#ifdef CONFIG_BLK_DEV_IDEACPI
1318extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1319extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1320extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1321extern void ide_acpi_init(ide_hwif_t *hwif);
1322#else
1323static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1324static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1325static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1326static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1327#endif
1328
1301extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1329extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1302extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1330extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1303extern void ide_unregister (unsigned int index); 1331extern void ide_unregister (unsigned int index);
@@ -1327,20 +1355,21 @@ extern int ide_dma_enable(ide_drive_t *drive);
1327extern char *ide_xfer_verbose(u8 xfer_rate); 1355extern char *ide_xfer_verbose(u8 xfer_rate);
1328extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1356extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1329extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1357extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1358int ide_use_fast_pio(ide_drive_t *);
1330 1359
1331u8 ide_dump_status(ide_drive_t *, const char *, u8); 1360u8 ide_dump_status(ide_drive_t *, const char *, u8);
1332 1361
1333typedef struct ide_pio_timings_s { 1362typedef struct ide_pio_timings_s {
1334 int setup_time; /* Address setup (ns) minimum */ 1363 int setup_time; /* Address setup (ns) minimum */
1335 int active_time; /* Active pulse (ns) minimum */ 1364 int active_time; /* Active pulse (ns) minimum */
1336 int cycle_time; /* Cycle time (ns) minimum = (setup + active + recovery) */ 1365 int cycle_time; /* Cycle time (ns) minimum = */
1366 /* active + recovery (+ setup for some chips) */
1337} ide_pio_timings_t; 1367} ide_pio_timings_t;
1338 1368
1339typedef struct ide_pio_data_s { 1369typedef struct ide_pio_data_s {
1340 u8 pio_mode; 1370 u8 pio_mode;
1341 u8 use_iordy; 1371 u8 use_iordy;
1342 u8 overridden; 1372 u8 overridden;
1343 u8 blacklisted;
1344 unsigned int cycle_time; 1373 unsigned int cycle_time;
1345} ide_pio_data_t; 1374} ide_pio_data_t;
1346 1375
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index d557e4ce9b6b..43f3bedaafd3 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -39,6 +39,7 @@ enum
39#define IFA_F_TEMPORARY IFA_F_SECONDARY 39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40 40
41#define IFA_F_NODAD 0x02 41#define IFA_F_NODAD 0x02
42#define IFA_F_OPTIMISTIC 0x04
42#define IFA_F_HOMEADDRESS 0x10 43#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20 44#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40 45#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 7f5714214ee3..ed7b93c3083a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -148,4 +148,13 @@ struct arphdr
148 148
149}; 149};
150 150
151#ifdef __KERNEL__
152#include <linux/skbuff.h>
153
154static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
155{
156 return (struct arphdr *)skb_network_header(skb);
157}
158#endif
159
151#endif /* _LINUX_IF_ARP_H */ 160#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd1b6eb94a5f..4ff211d98769 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -105,7 +105,8 @@ struct __fdb_entry
105#include <linux/netdevice.h> 105#include <linux/netdevice.h>
106 106
107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *));
108extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb);
109extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff **pskb);
110 111
111#endif 112#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index ab08f35cbc35..1db774cf9dc2 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 65#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 66#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
66 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 67 * defined in draft-wilson-wrec-wccp-v2-00.txt */
@@ -112,7 +113,7 @@ struct ethhdr {
112 113
113static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 114static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
114{ 115{
115 return (struct ethhdr *)skb->mac.raw; 116 return (struct ethhdr *)skb_mac_header(skb);
116} 117}
117 118
118#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5467f3..604c2434f71c 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
126 IFLA_INET6_STATS, /* statistics */ 126 IFLA_INET6_STATS, /* statistics */
127 IFLA_INET6_MCAST, /* MC things. What of them? */ 127 IFLA_INET6_MCAST, /* MC things. What of them? */
128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
129 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
129 __IFLA_INET6_MAX 130 __IFLA_INET6_MAX
130}; 131};
131 132
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 99393ef3af39..ad09609227ff 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -41,6 +41,8 @@ struct sockaddr_ll
41#define PACKET_RX_RING 5 41#define PACKET_RX_RING 5
42#define PACKET_STATISTICS 6 42#define PACKET_STATISTICS 6
43#define PACKET_COPY_THRESH 7 43#define PACKET_COPY_THRESH 7
44#define PACKET_AUXDATA 8
45#define PACKET_ORIGDEV 9
44 46
45struct tpacket_stats 47struct tpacket_stats
46{ 48{
@@ -48,6 +50,15 @@ struct tpacket_stats
48 unsigned int tp_drops; 50 unsigned int tp_drops;
49}; 51};
50 52
53struct tpacket_auxdata
54{
55 __u32 tp_status;
56 __u32 tp_len;
57 __u32 tp_snaplen;
58 __u16 tp_mac;
59 __u16 tp_net;
60};
61
51struct tpacket_hdr 62struct tpacket_hdr
52{ 63{
53 unsigned long tp_status; 64 unsigned long tp_status;
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 4fab3d0a4bce..6f987be60fe2 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -111,9 +111,20 @@ struct pppoe_hdr {
111 struct pppoe_tag tag[0]; 111 struct pppoe_tag tag[0];
112} __attribute__ ((packed)); 112} __attribute__ ((packed));
113 113
114/* Length of entire PPPoE + PPP header */
115#define PPPOE_SES_HLEN 8
116
114#ifdef __KERNEL__ 117#ifdef __KERNEL__
118#include <linux/skbuff.h>
119
120static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
121{
122 return (struct pppoe_hdr *)skb_network_header(skb);
123}
124
115struct pppoe_opt { 125struct pppoe_opt {
116 struct net_device *dev; /* device associated with socket*/ 126 struct net_device *dev; /* device associated with socket*/
127 int ifindex; /* ifindex of device associated with socket */
117 struct pppoe_addr pa; /* what this socket is bound to*/ 128 struct pppoe_addr pa; /* what this socket is bound to*/
118 struct sockaddr_pppox relay; /* what socket data will be 129 struct sockaddr_pppox relay; /* what socket data will be
119 relayed to (PPPoE relaying) */ 130 relayed to (PPPoE relaying) */
@@ -132,6 +143,7 @@ struct pppox_sock {
132 unsigned short num; 143 unsigned short num;
133}; 144};
134#define pppoe_dev proto.pppoe.dev 145#define pppoe_dev proto.pppoe.dev
146#define pppoe_ifindex proto.pppoe.ifindex
135#define pppoe_pa proto.pppoe.pa 147#define pppoe_pa proto.pppoe.pa
136#define pppoe_relay proto.pppoe.relay 148#define pppoe_relay proto.pppoe.relay
137 149
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 2f94cf2c7abb..046e9d95ba9a 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -47,7 +47,7 @@ struct trh_hdr {
47 47
48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) 48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb->mac.raw; 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL 52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[]; 53extern struct ctl_table tr_table[];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 35cb38573583..81e9bc93569b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -51,7 +51,7 @@ struct vlan_ethhdr {
51 51
52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) 52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
53{ 53{
54 return (struct vlan_ethhdr *)skb->mac.raw; 54 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 55}
56 56
57struct vlan_hdr { 57struct vlan_hdr {
@@ -70,15 +70,34 @@ extern void vlan_ioctl_set(int (*hook)(void __user *));
70 * depends on completely exhausting the VLAN identifier space. Thus 70 * depends on completely exhausting the VLAN identifier space. Thus
71 * it gives constant time look-up, but in many cases it wastes memory. 71 * it gives constant time look-up, but in many cases it wastes memory.
72 */ 72 */
73#define VLAN_GROUP_ARRAY_LEN 4096 73#define VLAN_GROUP_ARRAY_LEN 4096
74#define VLAN_GROUP_ARRAY_SPLIT_PARTS 8
75#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
74 76
75struct vlan_group { 77struct vlan_group {
76 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 78 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
77 struct hlist_node hlist; /* linked list */ 79 struct hlist_node hlist; /* linked list */
78 struct net_device *vlan_devices[VLAN_GROUP_ARRAY_LEN]; 80 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
79 struct rcu_head rcu; 81 struct rcu_head rcu;
80}; 82};
81 83
84static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id)
85{
86 struct net_device **array;
87 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
88 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
89}
90
91static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id,
92 struct net_device *dev)
93{
94 struct net_device **array;
95 if (!vg)
96 return;
97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
98 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
99}
100
82struct vlan_priority_tci_mapping { 101struct vlan_priority_tci_mapping {
83 unsigned long priority; 102 unsigned long priority;
84 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it 103 unsigned short vlan_qos; /* This should be shifted when first set, so we only do it
@@ -160,7 +179,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
160 return NET_RX_DROP; 179 return NET_RX_DROP;
161 } 180 }
162 181
163 skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK]; 182 skb->dev = vlan_group_get_device(grp, vlan_tag & VLAN_VID_MASK);
164 if (skb->dev == NULL) { 183 if (skb->dev == NULL) {
165 dev_kfree_skb_any(skb); 184 dev_kfree_skb_any(skb);
166 185
@@ -256,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
256 veth->h_vlan_TCI = htons(tag); 275 veth->h_vlan_TCI = htons(tag);
257 276
258 skb->protocol = __constant_htons(ETH_P_8021Q); 277 skb->protocol = __constant_htons(ETH_P_8021Q);
259 skb->mac.raw -= VLAN_HLEN; 278 skb->mac_header -= VLAN_HLEN;
260 skb->nh.raw -= VLAN_HLEN; 279 skb->network_header -= VLAN_HLEN;
261 280
262 return skb; 281 return skb;
263} 282}
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h
deleted file mode 100644
index 6e5461d69fdd..000000000000
--- a/include/linux/if_wanpipe_common.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*****************************************************************************
2* if_wanipe_common.h Sangoma Driver/Socket common area definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Jan 13, 2000 Nenad Corbic Initial version
14*****************************************************************************/
15
16
17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
18#define _WANPIPE_SOCK_DRIVER_COMMON_H
19
20typedef struct {
21 struct net_device *slave;
22 atomic_t packet_sent;
23 atomic_t receive_block;
24 atomic_t command;
25 atomic_t disconnect;
26 atomic_t driver_busy;
27 long common_critical;
28 struct timer_list *tx_timer;
29 struct sock *sk; /* Wanpipe Sock bind's here */
30 int (*func)(struct sk_buff *skb, struct net_device *dev,
31 struct sock *sk);
32
33 struct work_struct wanpipe_work; /* deferred keventd work */
34 unsigned char rw_bind; /* Sock bind state */
35 unsigned char usedby;
36 unsigned char state;
37 unsigned char svc;
38 unsigned short lcn;
39 void *mbox;
40} wanpipe_common_t;
41
42
43enum {
44 WANSOCK_UNCONFIGURED, /* link/channel is not configured */
45 WANSOCK_DISCONNECTED, /* link/channel is disconnected */
46 WANSOCK_CONNECTING, /* connection is in progress */
47 WANSOCK_CONNECTED, /* link/channel is operational */
48 WANSOCK_LIMIT, /* for verification only */
49 WANSOCK_DUALPORT, /* for Dual Port cards */
50 WANSOCK_DISCONNECTING,
51 WANSOCK_BINDED,
52 WANSOCK_BIND_LISTEN,
53 WANSOCK_LISTEN
54};
55
56#endif
57
58
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 9dbb525c5178..f510e7e382a8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,6 +80,27 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */ 106#define IGMP_DVMRP 0x13 /* DVMRP routing */
@@ -218,5 +239,7 @@ extern void ip_mc_up(struct in_device *);
218extern void ip_mc_down(struct in_device *); 239extern void ip_mc_down(struct in_device *);
219extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr); 240extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
220extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr); 241extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
242extern void ip_mc_rejoin_group(struct ip_mc_list *im);
243
221#endif 244#endif
222#endif 245#endif
diff --git a/include/linux/in.h b/include/linux/in.h
index 1912e7c0bc26..3975cbf52f20 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -83,6 +83,7 @@ struct in_addr {
83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
84#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 84#define IP_PMTUDISC_WANT 1 /* Use per route hints */
85#define IP_PMTUDISC_DO 2 /* Always DF */ 85#define IP_PMTUDISC_DO 2 /* Always DF */
86#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
86 87
87#define IP_MULTICAST_IF 32 88#define IP_MULTICAST_IF 32
88#define IP_MULTICAST_TTL 33 89#define IP_MULTICAST_TTL 33
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 4e8350ae8869..2a61c82af115 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined 44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
45 * in network byte order, not in host byte order as are the IPv4 equivalents 45 * in network byte order, not in host byte order as are the IPv4 equivalents
46 */ 46 */
47#if 0
48extern const struct in6_addr in6addr_any; 47extern const struct in6_addr in6addr_any;
49#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
50#endif
51extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
52#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
53 51
@@ -179,6 +177,7 @@ struct in6_flowlabel_req
179#define IPV6_PMTUDISC_DONT 0 177#define IPV6_PMTUDISC_DONT 0
180#define IPV6_PMTUDISC_WANT 1 178#define IPV6_PMTUDISC_WANT 1
181#define IPV6_PMTUDISC_DO 2 179#define IPV6_PMTUDISC_DO 2
180#define IPV6_PMTUDISC_PROBE 3
182 181
183/* Flowlabel */ 182/* Flowlabel */
184#define IPV6_FLOWLABEL_MGR 32 183#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/linux/init.h b/include/linux/init.h
index 5a593a1dec1e..e290a010e3f2 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -67,7 +67,8 @@ extern initcall_t __con_initcall_start[], __con_initcall_end[];
67extern initcall_t __security_initcall_start[], __security_initcall_end[]; 67extern 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 __initdata boot_command_line[];
71extern char *saved_command_line;
71extern unsigned int reset_devices; 72extern unsigned int reset_devices;
72 73
73/* used by init/main.c */ 74/* used by init/main.c */
@@ -164,7 +165,7 @@ struct obs_kernel_param {
164#define early_param(str, fn) \ 165#define early_param(str, fn) \
165 __setup_param(str, fn, fn, 1) 166 __setup_param(str, fn, fn, 1)
166 167
167/* Relies on saved_command_line being set */ 168/* Relies on boot_command_line being set */
168void __init parse_early_param(void); 169void __init parse_early_param(void);
169#endif /* __ASSEMBLY__ */ 170#endif /* __ASSEMBLY__ */
170 171
@@ -172,7 +173,7 @@ void __init parse_early_param(void);
172 * module_init() - driver initialization entry point 173 * module_init() - driver initialization entry point
173 * @x: function to be run at kernel boot time or module insertion 174 * @x: function to be run at kernel boot time or module insertion
174 * 175 *
175 * module_init() will either be called during do_initcalls (if 176 * module_init() will either be called during do_initcalls() (if
176 * builtin) or at module insertion time (if a module). There can only 177 * builtin) or at module insertion time (if a module). There can only
177 * be one per module. 178 * be one per module.
178 */ 179 */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6383d2d83bb0..a2d95ff50e9b 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -66,7 +66,7 @@
66 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ 66 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
67 .rlim = INIT_RLIMITS, \ 67 .rlim = INIT_RLIMITS, \
68 .pgrp = 1, \ 68 .pgrp = 1, \
69 .tty_old_pgrp = 0, \ 69 .tty_old_pgrp = NULL, \
70 { .__session = 1}, \ 70 { .__session = 1}, \
71} 71}
72 72
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index e36e86c869fb..838cf5a5bd7f 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -12,6 +12,7 @@
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/irqflags.h> 13#include <linux/irqflags.h>
14#include <linux/bottom_half.h> 14#include <linux/bottom_half.h>
15#include <linux/device.h>
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
17#include <asm/system.h> 18#include <asm/system.h>
@@ -41,6 +42,8 @@
41 * IRQF_SHARED - allow sharing the irq among several devices 42 * IRQF_SHARED - allow sharing the irq among several devices
42 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 43 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
43 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt 44 * IRQF_TIMER - Flag to mark this interrupt as timer interrupt
45 * IRQF_PERCPU - Interrupt is per cpu
46 * IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
44 */ 47 */
45#define IRQF_DISABLED 0x00000020 48#define IRQF_DISABLED 0x00000020
46#define IRQF_SAMPLE_RANDOM 0x00000040 49#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -48,6 +51,7 @@
48#define IRQF_PROBE_SHARED 0x00000100 51#define IRQF_PROBE_SHARED 0x00000100
49#define IRQF_TIMER 0x00000200 52#define IRQF_TIMER 0x00000200
50#define IRQF_PERCPU 0x00000400 53#define IRQF_PERCPU 0x00000400
54#define IRQF_NOBALANCING 0x00000800
51 55
52/* 56/*
53 * Migration helpers. Scheduled for removal in 1/2007 57 * Migration helpers. Scheduled for removal in 1/2007
@@ -83,6 +87,11 @@ extern int request_irq(unsigned int, irq_handler_t handler,
83 unsigned long, const char *, void *); 87 unsigned long, const char *, void *);
84extern void free_irq(unsigned int, void *); 88extern void free_irq(unsigned int, void *);
85 89
90extern int devm_request_irq(struct device *dev, unsigned int irq,
91 irq_handler_t handler, unsigned long irqflags,
92 const char *devname, void *dev_id);
93extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
94
86/* 95/*
87 * On lockdep we dont want to enable hardirqs in hardirq 96 * On lockdep we dont want to enable hardirqs in hardirq
88 * context. Use local_irq_enable_in_hardirq() to annotate 97 * context. Use local_irq_enable_in_hardirq() to annotate
@@ -233,6 +242,9 @@ enum
233 BLOCK_SOFTIRQ, 242 BLOCK_SOFTIRQ,
234 TASKLET_SOFTIRQ, 243 TASKLET_SOFTIRQ,
235 SCHED_SOFTIRQ, 244 SCHED_SOFTIRQ,
245#ifdef CONFIG_HIGH_RES_TIMERS
246 HRTIMER_SOFTIRQ,
247#endif
236}; 248};
237 249
238/* softirq mask and active fields moved to irq_cpustat_t in 250/* softirq mask and active fields moved to irq_cpustat_t in
@@ -411,4 +423,13 @@ extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
411extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */ 423extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */
412#endif 424#endif
413 425
426#ifdef CONFIG_PROC_FS
427/* Initialize /proc/irq/ */
428extern void init_irq_proc(void);
429#else
430static inline void init_irq_proc(void)
431{
432}
433#endif
434
414#endif 435#endif
diff --git a/include/linux/io.h b/include/linux/io.h
index 81877ea39309..09d351236379 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -22,12 +22,40 @@
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/page.h> 23#include <asm/page.h>
24 24
25struct device;
26
25void __iowrite32_copy(void __iomem *to, const void *from, size_t count); 27void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
26void __iowrite64_copy(void __iomem *to, const void *from, size_t count); 28void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
27 29
28int ioremap_page_range(unsigned long addr, unsigned long end, 30int ioremap_page_range(unsigned long addr, unsigned long end,
29 unsigned long phys_addr, pgprot_t prot); 31 unsigned long phys_addr, pgprot_t prot);
30 32
33/*
34 * Managed iomap interface
35 */
36#ifdef CONFIG_HAS_IOPORT
37void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
38 unsigned int nr);
39void devm_ioport_unmap(struct device *dev, void __iomem *addr);
40#else
41static inline void __iomem *devm_ioport_map(struct device *dev,
42 unsigned long port,
43 unsigned int nr)
44{
45 return NULL;
46}
47
48static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
49{
50}
51#endif
52
53void __iomem * devm_ioremap(struct device *dev, unsigned long offset,
54 unsigned long size);
55void __iomem * devm_ioremap_nocache(struct device *dev, unsigned long offset,
56 unsigned long size);
57void devm_iounmap(struct device *dev, void __iomem *addr);
58
31/** 59/**
32 * check_signature - find BIOS signatures 60 * check_signature - find BIOS signatures
33 * @io_addr: mmio address to check 61 * @io_addr: mmio address to check
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 15228d79c5bc..71ea92319241 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -99,7 +99,6 @@ extern struct resource ioport_resource;
99extern struct resource iomem_resource; 99extern struct resource iomem_resource;
100 100
101extern int request_resource(struct resource *root, struct resource *new); 101extern int request_resource(struct resource *root, struct resource *new);
102extern struct resource * ____request_resource(struct resource *root, struct resource *new);
103extern int release_resource(struct resource *new); 102extern int release_resource(struct resource *new);
104extern int insert_resource(struct resource *parent, struct resource *new); 103extern int insert_resource(struct resource *parent, struct resource *new);
105extern int allocate_resource(struct resource *root, struct resource *new, 104extern int allocate_resource(struct resource *root, struct resource *new,
@@ -137,4 +136,24 @@ static inline int __deprecated check_region(resource_size_t s,
137{ 136{
138 return __check_region(&ioport_resource, s, n); 137 return __check_region(&ioport_resource, s, n);
139} 138}
139
140/* Wrappers for managed devices */
141struct device;
142#define devm_request_region(dev,start,n,name) \
143 __devm_request_region(dev, &ioport_resource, (start), (n), (name))
144#define devm_request_mem_region(dev,start,n,name) \
145 __devm_request_region(dev, &iomem_resource, (start), (n), (name))
146
147extern struct resource * __devm_request_region(struct device *dev,
148 struct resource *parent, resource_size_t start,
149 resource_size_t n, const char *name);
150
151#define devm_release_region(start,n) \
152 __devm_release_region(dev, &ioport_resource, (start), (n))
153#define devm_release_mem_region(start,n) \
154 __devm_release_region(dev, &iomem_resource, (start), (n))
155
156extern void __devm_release_region(struct device *dev, struct resource *parent,
157 resource_size_t start, resource_size_t n);
158
140#endif /* _LINUX_IOPORT_H */ 159#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 1d36b971a8b5..bd0a2a8631c6 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -104,6 +104,20 @@ struct iphdr {
104 /*The options start here. */ 104 /*The options start here. */
105}; 105};
106 106
107#ifdef __KERNEL__
108#include <linux/skbuff.h>
109
110static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
111{
112 return (struct iphdr *)skb_network_header(skb);
113}
114
115static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
116{
117 return (struct iphdr *)skb_transport_header(skb);
118}
119#endif
120
107struct ip_auth_hdr { 121struct ip_auth_hdr {
108 __u8 nexthdr; 122 __u8 nexthdr;
109 __u8 hdrlen; /* This one is measured in 32 bit units! */ 123 __u8 hdrlen; /* This one is measured in 32 bit units! */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 636094c29b16..6da6772c19ff 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -92,19 +92,16 @@ extern struct ipc_namespace init_ipc_ns;
92 92
93#ifdef CONFIG_SYSVIPC 93#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
95extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
95#else 96#else
96#define INIT_IPC_NS(ns) 97#define INIT_IPC_NS(ns)
98static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
99{ return 0; }
97#endif 100#endif
98 101
99#ifdef CONFIG_IPC_NS 102#ifdef CONFIG_IPC_NS
100extern void free_ipc_ns(struct kref *kref); 103extern void free_ipc_ns(struct kref *kref);
101extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
102extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns); 104extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
103#else
104static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
105{
106 return 0;
107}
108#endif 105#endif
109 106
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 107static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index f8241130f5ea..09ea01a8a99c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -177,6 +177,10 @@ struct ipv6_devconf {
177#endif 177#endif
178#endif 178#endif
179 __s32 proxy_ndp; 179 __s32 proxy_ndp;
180 __s32 accept_source_route;
181#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
182 __s32 optimistic_dad;
183#endif
180 void *sysctl; 184 void *sysctl;
181}; 185};
182 186
@@ -205,6 +209,9 @@ enum {
205 DEVCONF_RTR_PROBE_INTERVAL, 209 DEVCONF_RTR_PROBE_INTERVAL,
206 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 210 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
207 DEVCONF_PROXY_NDP, 211 DEVCONF_PROXY_NDP,
212 __DEVCONF_OPTIMISTIC_DAD,
213 DEVCONF_ACCEPT_SOURCE_ROUTE,
214 DEVCONF_OPTIMISTIC_DAD,
208 DEVCONF_MAX 215 DEVCONF_MAX
209}; 216};
210 217
@@ -216,6 +223,16 @@ enum {
216#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ 223#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
217#include <net/inet_sock.h> 224#include <net/inet_sock.h>
218 225
226static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
227{
228 return (struct ipv6hdr *)skb_network_header(skb);
229}
230
231static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
232{
233 return (struct ipv6hdr *)skb_transport_header(skb);
234}
235
219/* 236/*
220 This structure contains results of exthdrs parsing 237 This structure contains results of exthdrs parsing
221 as offsets from skb->nh. 238 as offsets from skb->nh.
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 52fc4052a0ae..a6899402b522 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -18,6 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/irqreturn.h> 20#include <linux/irqreturn.h>
21#include <linux/errno.h>
21 22
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
@@ -31,7 +32,7 @@ typedef void fastcall (*irq_flow_handler_t)(unsigned int irq,
31/* 32/*
32 * IRQ line status. 33 * IRQ line status.
33 * 34 *
34 * Bits 0-16 are reserved for the IRQF_* bits in linux/interrupt.h 35 * Bits 0-7 are reserved for the IRQF_* bits in linux/interrupt.h
35 * 36 *
36 * IRQ types 37 * IRQ types
37 */ 38 */
@@ -45,29 +46,32 @@ typedef void fastcall (*irq_flow_handler_t)(unsigned int irq,
45#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */ 46#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */
46 47
47/* Internal flags */ 48/* Internal flags */
48#define IRQ_INPROGRESS 0x00010000 /* IRQ handler active - do not enter! */ 49#define IRQ_INPROGRESS 0x00000100 /* IRQ handler active - do not enter! */
49#define IRQ_DISABLED 0x00020000 /* IRQ disabled - do not enter! */ 50#define IRQ_DISABLED 0x00000200 /* IRQ disabled - do not enter! */
50#define IRQ_PENDING 0x00040000 /* IRQ pending - replay on enable */ 51#define IRQ_PENDING 0x00000400 /* IRQ pending - replay on enable */
51#define IRQ_REPLAY 0x00080000 /* IRQ has been replayed but not acked yet */ 52#define IRQ_REPLAY 0x00000800 /* IRQ has been replayed but not acked yet */
52#define IRQ_AUTODETECT 0x00100000 /* IRQ is being autodetected */ 53#define IRQ_AUTODETECT 0x00001000 /* IRQ is being autodetected */
53#define IRQ_WAITING 0x00200000 /* IRQ not yet seen - for autodetection */ 54#define IRQ_WAITING 0x00002000 /* IRQ not yet seen - for autodetection */
54#define IRQ_LEVEL 0x00400000 /* IRQ level triggered */ 55#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */
55#define IRQ_MASKED 0x00800000 /* IRQ masked - shouldn't be seen again */ 56#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */
56#define IRQ_PER_CPU 0x01000000 /* IRQ is per CPU */ 57#define IRQ_PER_CPU 0x00010000 /* IRQ is per CPU */
58#define IRQ_NOPROBE 0x00020000 /* IRQ is not valid for probing */
59#define IRQ_NOREQUEST 0x00040000 /* IRQ cannot be requested */
60#define IRQ_NOAUTOEN 0x00080000 /* IRQ will not be enabled on request irq */
61#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */
62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
64
57#ifdef CONFIG_IRQ_PER_CPU 65#ifdef CONFIG_IRQ_PER_CPU
58# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 66# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
67# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
59#else 68#else
60# define CHECK_IRQ_PER_CPU(var) 0 69# define CHECK_IRQ_PER_CPU(var) 0
70# define IRQ_NO_BALANCING_MASK IRQ_NO_BALANCING
61#endif 71#endif
62 72
63#define IRQ_NOPROBE 0x02000000 /* IRQ is not valid for probing */
64#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */
65#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
66#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
67#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */
68#define IRQ_MOVE_PENDING 0x40000000 /* need to re-target IRQ destination */
69
70struct proc_dir_entry; 73struct proc_dir_entry;
74struct msi_desc;
71 75
72/** 76/**
73 * struct irq_chip - hardware interrupt chip descriptor 77 * struct irq_chip - hardware interrupt chip descriptor
@@ -126,6 +130,7 @@ struct irq_chip {
126 * 130 *
127 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 131 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
128 * @chip: low level interrupt hardware access 132 * @chip: low level interrupt hardware access
133 * @msi_desc: MSI descriptor
129 * @handler_data: per-IRQ data for the irq_chip methods 134 * @handler_data: per-IRQ data for the irq_chip methods
130 * @chip_data: platform-specific per-chip private data for the chip 135 * @chip_data: platform-specific per-chip private data for the chip
131 * methods, to allow shared chip implementations 136 * methods, to allow shared chip implementations
@@ -148,6 +153,7 @@ struct irq_chip {
148struct irq_desc { 153struct irq_desc {
149 irq_flow_handler_t handle_irq; 154 irq_flow_handler_t handle_irq;
150 struct irq_chip *chip; 155 struct irq_chip *chip;
156 struct msi_desc *msi_desc;
151 void *handler_data; 157 void *handler_data;
152 void *chip_data; 158 void *chip_data;
153 struct irqaction *action; /* IRQ action list */ 159 struct irqaction *action; /* IRQ action list */
@@ -195,17 +201,6 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
195#endif 201#endif
196 202
197#ifdef CONFIG_SMP 203#ifdef CONFIG_SMP
198static inline void set_native_irq_info(int irq, cpumask_t mask)
199{
200 irq_desc[irq].affinity = mask;
201}
202#else
203static inline void set_native_irq_info(int irq, cpumask_t mask)
204{
205}
206#endif
207
208#ifdef CONFIG_SMP
209 204
210#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 205#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE)
211 206
@@ -233,11 +228,21 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
233 228
234#endif /* CONFIG_GENERIC_PENDING_IRQ */ 229#endif /* CONFIG_GENERIC_PENDING_IRQ */
235 230
231extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
232extern int irq_can_set_affinity(unsigned int irq);
233
236#else /* CONFIG_SMP */ 234#else /* CONFIG_SMP */
237 235
238#define move_native_irq(x) 236#define move_native_irq(x)
239#define move_masked_irq(x) 237#define move_masked_irq(x)
240 238
239static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
240{
241 return -EINVAL;
242}
243
244static inline int irq_can_set_affinity(unsigned int irq) { return 0; }
245
241#endif /* CONFIG_SMP */ 246#endif /* CONFIG_SMP */
242 247
243#ifdef CONFIG_IRQBALANCE 248#ifdef CONFIG_IRQBALANCE
@@ -259,6 +264,11 @@ static inline int select_smp_affinity(unsigned int irq)
259 264
260extern int no_irq_affinity; 265extern int no_irq_affinity;
261 266
267static inline int irq_balancing_disabled(unsigned int irq)
268{
269 return irq_desc[irq].status & IRQ_NO_BALANCING_MASK;
270}
271
262/* Handle irq action chains: */ 272/* Handle irq action chains: */
263extern int handle_IRQ_event(unsigned int irq, struct irqaction *action); 273extern int handle_IRQ_event(unsigned int irq, struct irqaction *action);
264 274
@@ -308,9 +318,6 @@ extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
308/* Resending of interrupts :*/ 318/* Resending of interrupts :*/
309void check_irq_resend(struct irq_desc *desc, unsigned int irq); 319void check_irq_resend(struct irq_desc *desc, unsigned int irq);
310 320
311/* Initialize /proc/irq/ */
312extern void init_irq_proc(void);
313
314/* Enable/disable irq debugging output: */ 321/* Enable/disable irq debugging output: */
315extern int noirqdebug_setup(char *str); 322extern int noirqdebug_setup(char *str);
316 323
@@ -373,10 +380,12 @@ extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
373extern int set_irq_data(unsigned int irq, void *data); 380extern int set_irq_data(unsigned int irq, void *data);
374extern int set_irq_chip_data(unsigned int irq, void *data); 381extern int set_irq_chip_data(unsigned int irq, void *data);
375extern int set_irq_type(unsigned int irq, unsigned int type); 382extern int set_irq_type(unsigned int irq, unsigned int type);
383extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
376 384
377#define get_irq_chip(irq) (irq_desc[irq].chip) 385#define get_irq_chip(irq) (irq_desc[irq].chip)
378#define get_irq_chip_data(irq) (irq_desc[irq].chip_data) 386#define get_irq_chip_data(irq) (irq_desc[irq].chip_data)
379#define get_irq_data(irq) (irq_desc[irq].handler_data) 387#define get_irq_data(irq) (irq_desc[irq].handler_data)
388#define get_irq_msi(irq) (irq_desc[irq].msi_desc)
380 389
381#endif /* CONFIG_GENERIC_HARDIRQS */ 390#endif /* CONFIG_GENERIC_HARDIRQS */
382 391
diff --git a/include/linux/isdn/capiutil.h b/include/linux/isdn/capiutil.h
index 2e79f816703b..63bd9cf821a7 100644
--- a/include/linux/isdn/capiutil.h
+++ b/include/linux/isdn/capiutil.h
@@ -174,9 +174,26 @@ char *capi_info2str(__u16 reason);
174/* 174/*
175 * Debugging / Tracing functions 175 * Debugging / Tracing functions
176 */ 176 */
177
177char *capi_cmd2str(__u8 cmd, __u8 subcmd); 178char *capi_cmd2str(__u8 cmd, __u8 subcmd);
178char *capi_cmsg2str(_cmsg * cmsg); 179
179char *capi_message2str(__u8 * msg); 180typedef struct {
181 u_char *buf;
182 u_char *p;
183 size_t size;
184 size_t pos;
185} _cdebbuf;
186
187#define CDEBUG_SIZE 1024
188#define CDEBUG_GSIZE 4096
189
190_cdebbuf *cdebbuf_alloc(void);
191void cdebbuf_free(_cdebbuf *cdb);
192int cdebug_init(void);
193void cdebug_exit(void);
194
195_cdebbuf *capi_cmsg2str(_cmsg *cmsg);
196_cdebbuf *capi_message2str(__u8 *msg);
180 197
181/*-----------------------------------------------------------------------*/ 198/*-----------------------------------------------------------------------*/
182 199
diff --git a/include/linux/jffs.h b/include/linux/jffs.h
deleted file mode 100644
index 92213215277f..000000000000
--- a/include/linux/jffs.h
+++ /dev/null
@@ -1,224 +0,0 @@
1/*
2 * JFFS -- Journalling Flash File System, Linux implementation.
3 *
4 * Copyright (C) 1999, 2000 Axis Communications AB.
5 *
6 * Created by Finn Hakansson <finn@axis.com>.
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * $Id: jffs.h,v 1.20 2001/09/18 21:33:37 dwmw2 Exp $
14 *
15 * Ported to Linux 2.3.x and MTD:
16 * Copyright (C) 2000 Alexander Larsson (alex@cendio.se), Cendio Systems AB
17 *
18 */
19
20#ifndef __LINUX_JFFS_H__
21#define __LINUX_JFFS_H__
22
23#include <linux/types.h>
24#include <linux/completion.h>
25
26#define JFFS_VERSION_STRING "1.0"
27
28/* This is a magic number that is used as an identification number for
29 this file system. It is written to the super_block structure. */
30#define JFFS_MAGIC_SB_BITMASK 0x07c0 /* 1984 */
31
32/* This is a magic number that every on-flash raw inode begins with. */
33#define JFFS_MAGIC_BITMASK 0x34383931 /* "1984" */
34
35/* These two bitmasks are the valid ones for the flash memories we have
36 for the moment. */
37#define JFFS_EMPTY_BITMASK 0xffffffff
38#define JFFS_DIRTY_BITMASK 0x00000000
39
40/* This is the inode number of the root node. */
41#define JFFS_MIN_INO 1
42
43/* How many slots in the file hash table should we have? */
44#define JFFS_HASH_SIZE 40
45
46/* Don't use more than 254 bytes as the maximum allowed length of a file's
47 name due to errors that could occur during the scanning of the flash
48 memory. In fact, a name length of 255 or 0xff, could be the result of
49 an uncompleted write. For instance, if a raw inode is written to the
50 flash memory and there is a power lossage just before the length of
51 the name is written, the length 255 would be interpreted as an illegal
52 value. */
53#define JFFS_MAX_NAME_LEN 254
54
55/* Commands for ioctl(). */
56#define JFFS_IOCTL_MAGIC 't'
57#define JFFS_PRINT_HASH _IO(JFFS_IOCTL_MAGIC, 90)
58#define JFFS_PRINT_TREE _IO(JFFS_IOCTL_MAGIC, 91)
59#define JFFS_GET_STATUS _IO(JFFS_IOCTL_MAGIC, 92)
60
61/* XXX: This is something that we should try to get rid of in the future. */
62#define JFFS_MODIFY_INODE 0x01
63#define JFFS_MODIFY_NAME 0x02
64#define JFFS_MODIFY_DATA 0x04
65#define JFFS_MODIFY_EXIST 0x08
66
67struct jffs_control;
68
69/* The JFFS raw inode structure: Used for storage on physical media. */
70/* Perhaps the uid, gid, atime, mtime and ctime members should have
71 more space due to future changes in the Linux kernel. Anyhow, since
72 a user of this filesystem probably have to fix a large number of
73 other things, we have decided to not be forward compatible. */
74struct jffs_raw_inode
75{
76 __u32 magic; /* A constant magic number. */
77 __u32 ino; /* Inode number. */
78 __u32 pino; /* Parent's inode number. */
79 __u32 version; /* Version number. */
80 __u32 mode; /* The file's type or mode. */
81 __u16 uid; /* The file's owner. */
82 __u16 gid; /* The file's group. */
83 __u32 atime; /* Last access time. */
84 __u32 mtime; /* Last modification time. */
85 __u32 ctime; /* Creation time. */
86 __u32 offset; /* Where to begin to write. */
87 __u32 dsize; /* Size of the node's data. */
88 __u32 rsize; /* How much are going to be replaced? */
89 __u8 nsize; /* Name length. */
90 __u8 nlink; /* Number of links. */
91 __u8 spare : 6; /* For future use. */
92 __u8 rename : 1; /* Rename to a name of an already existing file? */
93 __u8 deleted : 1; /* Has this file been deleted? */
94 __u8 accurate; /* The inode is obsolete if accurate == 0. */
95 __u32 dchksum; /* Checksum for the data. */
96 __u16 nchksum; /* Checksum for the name. */
97 __u16 chksum; /* Checksum for the raw inode. */
98};
99
100/* Define the offset of the accurate byte in struct jffs_raw_inode. */
101#define JFFS_RAW_INODE_ACCURATE_OFFSET (sizeof(struct jffs_raw_inode) \
102 - 2 * sizeof(__u32) - sizeof(__u8))
103
104/* Define the offset of the chksum member in struct jffs_raw_inode. */
105#define JFFS_RAW_INODE_CHKSUM_OFFSET (sizeof(struct jffs_raw_inode) \
106 - sizeof(__u16))
107
108/* Define the offset of the dchksum member in struct jffs_raw_inode. */
109#define JFFS_RAW_INODE_DCHKSUM_OFFSET (sizeof(struct jffs_raw_inode) \
110 - sizeof(__u16) - sizeof(__u16) \
111 - sizeof(__u32))
112
113
114/* The RAM representation of the node. The names of pointers to
115 jffs_nodes are very often just called `n' in the source code. */
116struct jffs_node
117{
118 __u32 ino; /* Inode number. */
119 __u32 version; /* Version number. */
120 __u32 data_offset; /* Logic location of the data to insert. */
121 __u32 data_size; /* The amount of data this node inserts. */
122 __u32 removed_size; /* The amount of data that this node removes. */
123 __u32 fm_offset; /* Physical location of the data in the actual
124 flash memory data chunk. */
125 __u8 name_size; /* Size of the name. */
126 struct jffs_fm *fm; /* Physical memory information. */
127 struct jffs_node *version_prev;
128 struct jffs_node *version_next;
129 struct jffs_node *range_prev;
130 struct jffs_node *range_next;
131};
132
133
134/* The RAM representation of a file (plain files, directories,
135 links, etc.). Pointers to jffs_files are normally named `f'
136 in the JFFS source code. */
137struct jffs_file
138{
139 __u32 ino; /* Inode number. */
140 __u32 pino; /* Parent's inode number. */
141 __u32 mode; /* file_type, mode */
142 __u16 uid; /* owner */
143 __u16 gid; /* group */
144 __u32 atime; /* Last access time. */
145 __u32 mtime; /* Last modification time. */
146 __u32 ctime; /* Creation time. */
147 __u8 nsize; /* Name length. */
148 __u8 nlink; /* Number of links. */
149 __u8 deleted; /* Has this file been deleted? */
150 char *name; /* The name of this file; NULL-terminated. */
151 __u32 size; /* The total size of the file's data. */
152 __u32 highest_version; /* The highest version number of this file. */
153 struct jffs_control *c;
154 struct jffs_file *parent; /* Reference to the parent directory. */
155 struct jffs_file *children; /* Always NULL for plain files. */
156 struct jffs_file *sibling_prev; /* Siblings in the same directory. */
157 struct jffs_file *sibling_next;
158 struct list_head hash; /* hash list. */
159 struct jffs_node *range_head; /* The final data. */
160 struct jffs_node *range_tail; /* The first data. */
161 struct jffs_node *version_head; /* The youngest node. */
162 struct jffs_node *version_tail; /* The oldest node. */
163};
164
165
166/* This is just a definition of a simple list used for keeping track of
167 files deleted due to a rename. This list is only used during the
168 mounting of the file system and only if there have been rename operations
169 earlier. */
170struct jffs_delete_list
171{
172 __u32 ino;
173 struct jffs_delete_list *next;
174};
175
176
177/* A struct for the overall file system control. Pointers to
178 jffs_control structs are named `c' in the source code. */
179struct jffs_control
180{
181 struct super_block *sb; /* Reference to the VFS super block. */
182 struct jffs_file *root; /* The root directory file. */
183 struct list_head *hash; /* Hash table for finding files by ino. */
184 struct jffs_fmcontrol *fmc; /* Flash memory control structure. */
185 __u32 hash_len; /* The size of the hash table. */
186 __u32 next_ino; /* Next inode number to use for new files. */
187 __u16 building_fs; /* Is the file system being built right now? */
188 struct jffs_delete_list *delete_list; /* Track deleted files. */
189 pid_t thread_pid; /* GC thread's PID */
190 struct task_struct *gc_task; /* GC task struct */
191 struct completion gc_thread_comp; /* GC thread exit mutex */
192 __u32 gc_minfree_threshold; /* GC trigger thresholds */
193 __u32 gc_maxdirty_threshold;
194};
195
196
197/* Used to inform about flash status. */
198struct jffs_flash_status
199{
200 __u32 size;
201 __u32 used;
202 __u32 dirty;
203 __u32 begin;
204 __u32 end;
205};
206
207/* This stuff could be used for finding memory leaks. */
208#define JFFS_MEMORY_DEBUG 0
209
210extern long no_jffs_node;
211#if defined(JFFS_MEMORY_DEBUG) && JFFS_MEMORY_DEBUG
212extern long no_jffs_control;
213extern long no_jffs_raw_inode;
214extern long no_jffs_node_ref;
215extern long no_jffs_fm;
216extern long no_jffs_fmcontrol;
217extern long no_hash;
218extern long no_name;
219#define DJM(x) x
220#else
221#define DJM(x)
222#endif
223
224#endif /* __LINUX_JFFS_H__ */
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 82c7ae412eec..2a2f99fbcb16 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
84/* A special optimized version that handles 1 or more of u32s. 84/* A special optimized version that handles 1 or more of u32s.
85 * The length parameter here is the number of u32s in the key. 85 * The length parameter here is the number of u32s in the key.
86 */ 86 */
87static inline u32 jhash2(u32 *k, u32 length, u32 initval) 87static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
88{ 88{
89 u32 a, b, c, len; 89 u32 a, b, c, len;
90 90
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 0ec6e28bccd2..c080f61fb024 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -142,13 +142,13 @@ static inline u64 get_jiffies_64(void)
142 * 142 *
143 * And some not so obvious. 143 * And some not so obvious.
144 * 144 *
145 * Note that we don't want to return MAX_LONG, because 145 * Note that we don't want to return LONG_MAX, because
146 * for various timeout reasons we often end up having 146 * for various timeout reasons we often end up having
147 * to wait "jiffies+1" in order to guarantee that we wait 147 * to wait "jiffies+1" in order to guarantee that we wait
148 * at _least_ "jiffies" - so "jiffies+1" had better still 148 * at _least_ "jiffies" - so "jiffies+1" had better still
149 * be positive. 149 * be positive.
150 */ 150 */
151#define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) 151#define MAX_JIFFY_OFFSET ((LONG_MAX >> 1)-1)
152 152
153/* 153/*
154 * We want to do realistic conversions of time so we need to use the same 154 * We want to do realistic conversions of time so we need to use the same
@@ -259,207 +259,23 @@ static inline u64 get_jiffies_64(void)
259#endif 259#endif
260 260
261/* 261/*
262 * Convert jiffies to milliseconds and back. 262 * Convert various time units to each other:
263 *
264 * Avoid unnecessary multiplications/divisions in the
265 * two most common HZ cases:
266 */
267static inline unsigned int jiffies_to_msecs(const unsigned long j)
268{
269#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
270 return (MSEC_PER_SEC / HZ) * j;
271#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
272 return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
273#else
274 return (j * MSEC_PER_SEC) / HZ;
275#endif
276}
277
278static inline unsigned int jiffies_to_usecs(const unsigned long j)
279{
280#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
281 return (USEC_PER_SEC / HZ) * j;
282#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
283 return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);
284#else
285 return (j * USEC_PER_SEC) / HZ;
286#endif
287}
288
289static inline unsigned long msecs_to_jiffies(const unsigned int m)
290{
291 if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
292 return MAX_JIFFY_OFFSET;
293#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
294 return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
295#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
296 return m * (HZ / MSEC_PER_SEC);
297#else
298 return (m * HZ + MSEC_PER_SEC - 1) / MSEC_PER_SEC;
299#endif
300}
301
302static inline unsigned long usecs_to_jiffies(const unsigned int u)
303{
304 if (u > jiffies_to_usecs(MAX_JIFFY_OFFSET))
305 return MAX_JIFFY_OFFSET;
306#if HZ <= USEC_PER_SEC && !(USEC_PER_SEC % HZ)
307 return (u + (USEC_PER_SEC / HZ) - 1) / (USEC_PER_SEC / HZ);
308#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
309 return u * (HZ / USEC_PER_SEC);
310#else
311 return (u * HZ + USEC_PER_SEC - 1) / USEC_PER_SEC;
312#endif
313}
314
315/*
316 * The TICK_NSEC - 1 rounds up the value to the next resolution. Note
317 * that a remainder subtract here would not do the right thing as the
318 * resolution values don't fall on second boundries. I.e. the line:
319 * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding.
320 *
321 * Rather, we just shift the bits off the right.
322 *
323 * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec
324 * value to a scaled second value.
325 */
326static __inline__ unsigned long
327timespec_to_jiffies(const struct timespec *value)
328{
329 unsigned long sec = value->tv_sec;
330 long nsec = value->tv_nsec + TICK_NSEC - 1;
331
332 if (sec >= MAX_SEC_IN_JIFFIES){
333 sec = MAX_SEC_IN_JIFFIES;
334 nsec = 0;
335 }
336 return (((u64)sec * SEC_CONVERSION) +
337 (((u64)nsec * NSEC_CONVERSION) >>
338 (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
339
340}
341
342static __inline__ void
343jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
344{
345 /*
346 * Convert jiffies to nanoseconds and separate with
347 * one divide.
348 */
349 u64 nsec = (u64)jiffies * TICK_NSEC;
350 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_nsec);
351}
352
353/* Same for "timeval"
354 *
355 * Well, almost. The problem here is that the real system resolution is
356 * in nanoseconds and the value being converted is in micro seconds.
357 * Also for some machines (those that use HZ = 1024, in-particular),
358 * there is a LARGE error in the tick size in microseconds.
359
360 * The solution we use is to do the rounding AFTER we convert the
361 * microsecond part. Thus the USEC_ROUND, the bits to be shifted off.
362 * Instruction wise, this should cost only an additional add with carry
363 * instruction above the way it was done above.
364 */
365static __inline__ unsigned long
366timeval_to_jiffies(const struct timeval *value)
367{
368 unsigned long sec = value->tv_sec;
369 long usec = value->tv_usec;
370
371 if (sec >= MAX_SEC_IN_JIFFIES){
372 sec = MAX_SEC_IN_JIFFIES;
373 usec = 0;
374 }
375 return (((u64)sec * SEC_CONVERSION) +
376 (((u64)usec * USEC_CONVERSION + USEC_ROUND) >>
377 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
378}
379
380static __inline__ void
381jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
382{
383 /*
384 * Convert jiffies to nanoseconds and separate with
385 * one divide.
386 */
387 u64 nsec = (u64)jiffies * TICK_NSEC;
388 long tv_usec;
389
390 value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec);
391 tv_usec /= NSEC_PER_USEC;
392 value->tv_usec = tv_usec;
393}
394
395/*
396 * Convert jiffies/jiffies_64 to clock_t and back.
397 */ 263 */
398static inline clock_t jiffies_to_clock_t(long x) 264extern unsigned int jiffies_to_msecs(const unsigned long j);
399{ 265extern unsigned int jiffies_to_usecs(const unsigned long j);
400#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0 266extern unsigned long msecs_to_jiffies(const unsigned int m);
401 return x / (HZ / USER_HZ); 267extern unsigned long usecs_to_jiffies(const unsigned int u);
402#else 268extern unsigned long timespec_to_jiffies(const struct timespec *value);
403 u64 tmp = (u64)x * TICK_NSEC; 269extern void jiffies_to_timespec(const unsigned long jiffies,
404 do_div(tmp, (NSEC_PER_SEC / USER_HZ)); 270 struct timespec *value);
405 return (long)tmp; 271extern unsigned long timeval_to_jiffies(const struct timeval *value);
406#endif 272extern void jiffies_to_timeval(const unsigned long jiffies,
407} 273 struct timeval *value);
408 274extern clock_t jiffies_to_clock_t(long x);
409static inline unsigned long clock_t_to_jiffies(unsigned long x) 275extern unsigned long clock_t_to_jiffies(unsigned long x);
410{ 276extern u64 jiffies_64_to_clock_t(u64 x);
411#if (HZ % USER_HZ)==0 277extern u64 nsec_to_clock_t(u64 x);
412 if (x >= ~0UL / (HZ / USER_HZ)) 278
413 return ~0UL; 279#define TIMESTAMP_SIZE 30
414 return x * (HZ / USER_HZ);
415#else
416 u64 jif;
417
418 /* Don't worry about loss of precision here .. */
419 if (x >= ~0UL / HZ * USER_HZ)
420 return ~0UL;
421
422 /* .. but do try to contain it here */
423 jif = x * (u64) HZ;
424 do_div(jif, USER_HZ);
425 return jif;
426#endif
427}
428
429static inline u64 jiffies_64_to_clock_t(u64 x)
430{
431#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
432 do_div(x, HZ / USER_HZ);
433#else
434 /*
435 * There are better ways that don't overflow early,
436 * but even this doesn't overflow in hundreds of years
437 * in 64 bits, so..
438 */
439 x *= TICK_NSEC;
440 do_div(x, (NSEC_PER_SEC / USER_HZ));
441#endif
442 return x;
443}
444
445static inline u64 nsec_to_clock_t(u64 x)
446{
447#if (NSEC_PER_SEC % USER_HZ) == 0
448 do_div(x, (NSEC_PER_SEC / USER_HZ));
449#elif (USER_HZ % 512) == 0
450 x *= USER_HZ/512;
451 do_div(x, (NSEC_PER_SEC / 512));
452#else
453 /*
454 * max relative error 5.7e-8 (1.8s per year) for USER_HZ <= 1024,
455 * overflow after 64.99 years.
456 * exact for HZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
457 */
458 x *= 9;
459 do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (USER_HZ/2))
460 / USER_HZ));
461#endif
462 return x;
463}
464 280
465#endif 281#endif
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 06c58c423fe1..506ad20c18f8 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -75,7 +75,7 @@ extern int do_poke_blanked_console;
75 75
76extern void (*kbd_ledfunc)(unsigned int led); 76extern void (*kbd_ledfunc)(unsigned int led);
77 77
78extern void set_console(int nr); 78extern int set_console(int nr);
79extern void schedule_console_callback(void); 79extern void schedule_console_callback(void);
80 80
81static inline void set_leds(void) 81static inline void set_leds(void)
diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index bceea527dd37..2dacab8beccb 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -87,7 +87,6 @@ static inline unsigned sysv_minor(u32 dev)
87 return dev & 0x3ffff; 87 return dev & 0x3ffff;
88} 88}
89 89
90
91#else /* __KERNEL__ */ 90#else /* __KERNEL__ */
92 91
93/* 92/*
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 63fb18dcac30..9ddf25c21538 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -92,11 +92,6 @@ extern int cond_resched(void);
92 (__x < 0) ? -__x : __x; \ 92 (__x < 0) ? -__x : __x; \
93 }) 93 })
94 94
95#define labs(x) ({ \
96 long __x = (x); \
97 (__x < 0) ? -__x : __x; \
98 })
99
100extern struct atomic_notifier_head panic_notifier_list; 95extern struct atomic_notifier_head panic_notifier_list;
101extern long (*panic_blink)(long time); 96extern long (*panic_blink)(long time);
102NORET_TYPE void panic(const char * fmt, ...) 97NORET_TYPE void panic(const char * fmt, ...)
@@ -139,7 +134,8 @@ extern unsigned long long memparse(char *ptr, char **retptr);
139extern int core_kernel_text(unsigned long addr); 134extern int core_kernel_text(unsigned long addr);
140extern int __kernel_text_address(unsigned long addr); 135extern int __kernel_text_address(unsigned long addr);
141extern int kernel_text_address(unsigned long addr); 136extern int kernel_text_address(unsigned long addr);
142extern int session_of_pgrp(int pgrp); 137struct pid;
138extern struct pid *session_of_pgrp(struct pid *pgrp);
143 139
144extern void dump_thread(struct pt_regs *regs, struct user *dump); 140extern void dump_thread(struct pt_regs *regs, struct user *dump);
145 141
@@ -176,6 +172,7 @@ static inline void console_verbose(void)
176} 172}
177 173
178extern void bust_spinlocks(int yes); 174extern void bust_spinlocks(int yes);
175extern void wake_up_klogd(void);
179extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 176extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
180extern int panic_timeout; 177extern int panic_timeout;
181extern int panic_on_oops; 178extern int panic_on_oops;
@@ -200,6 +197,7 @@ extern enum system_states {
200#define TAINT_FORCED_RMMOD (1<<3) 197#define TAINT_FORCED_RMMOD (1<<3)
201#define TAINT_MACHINE_CHECK (1<<4) 198#define TAINT_MACHINE_CHECK (1<<4)
202#define TAINT_BAD_PAGE (1<<5) 199#define TAINT_BAD_PAGE (1<<5)
200#define TAINT_USER (1<<6)
203 201
204extern void dump_stack(void); 202extern void dump_stack(void);
205 203
@@ -312,6 +310,9 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
312 (void)__tmp; \ 310 (void)__tmp; \
313}) 311})
314 312
313struct sysinfo;
314extern int do_sysinfo(struct sysinfo *info);
315
315#endif /* __KERNEL__ */ 316#endif /* __KERNEL__ */
316 317
317#define SI_LOAD_SHIFT 16 318#define SI_LOAD_SHIFT 16
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d02425cdd801..696e5ec63f77 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -125,6 +125,7 @@ extern struct kimage *kexec_crash_image;
125#define KEXEC_ARCH_PPC (20 << 16) 125#define KEXEC_ARCH_PPC (20 << 16)
126#define KEXEC_ARCH_PPC64 (21 << 16) 126#define KEXEC_ARCH_PPC64 (21 << 16)
127#define KEXEC_ARCH_IA_64 (50 << 16) 127#define KEXEC_ARCH_IA_64 (50 << 16)
128#define KEXEC_ARCH_ARM (40 << 16)
128#define KEXEC_ARCH_S390 (22 << 16) 129#define KEXEC_ARCH_S390 (22 << 16)
129#define KEXEC_ARCH_SH (42 << 16) 130#define KEXEC_ARCH_SH (42 << 16)
130#define KEXEC_ARCH_MIPS_LE (10 << 16) 131#define KEXEC_ARCH_MIPS_LE (10 << 16)
diff --git a/include/linux/key.h b/include/linux/key.h
index 169f05e4863e..a9220e75782e 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -160,6 +160,8 @@ struct key {
160 */ 160 */
161 union { 161 union {
162 struct list_head link; 162 struct list_head link;
163 unsigned long x[2];
164 void *p[2];
163 } type_data; 165 } type_data;
164 166
165 /* key data 167 /* key data
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 48eccd865bd8..404f4464cb1a 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -74,7 +74,7 @@ static inline void kfifo_reset(struct kfifo *fifo)
74 * @buffer: the data to be added. 74 * @buffer: the data to be added.
75 * @len: the length of the data to be added. 75 * @len: the length of the data to be added.
76 * 76 *
77 * This function copies at most 'len' bytes from the 'buffer' into 77 * This function copies at most @len bytes from the @buffer into
78 * the FIFO depending on the free space, and returns the number of 78 * the FIFO depending on the free space, and returns the number of
79 * bytes copied. 79 * bytes copied.
80 */ 80 */
@@ -99,8 +99,8 @@ static inline unsigned int kfifo_put(struct kfifo *fifo,
99 * @buffer: where the data must be copied. 99 * @buffer: where the data must be copied.
100 * @len: the size of the destination buffer. 100 * @len: the size of the destination buffer.
101 * 101 *
102 * This function copies at most 'len' bytes from the FIFO into the 102 * This function copies at most @len bytes from the FIFO into the
103 * 'buffer' and returns the number of copied bytes. 103 * @buffer and returns the number of copied bytes.
104 */ 104 */
105static inline unsigned int kfifo_get(struct kfifo *fifo, 105static inline unsigned int kfifo_get(struct kfifo *fifo,
106 unsigned char *buffer, unsigned int len) 106 unsigned char *buffer, unsigned int len)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 76538fcf2c4e..eb0e63ef297f 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -22,7 +22,6 @@
22#include <linux/sysfs.h> 22#include <linux/sysfs.h>
23#include <linux/compiler.h> 23#include <linux/compiler.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/rwsem.h>
26#include <linux/kref.h> 25#include <linux/kref.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/wait.h> 27#include <linux/wait.h>
@@ -43,11 +42,9 @@ enum kobject_action {
43 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */ 42 KOBJ_ADD = (__force kobject_action_t) 0x01, /* exclusive to core */
44 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */ 43 KOBJ_REMOVE = (__force kobject_action_t) 0x02, /* exclusive to core */
45 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */ 44 KOBJ_CHANGE = (__force kobject_action_t) 0x03, /* device state change */
46 KOBJ_MOUNT = (__force kobject_action_t) 0x04, /* mount event for block devices (broken) */ 45 KOBJ_OFFLINE = (__force kobject_action_t) 0x04, /* device offline */
47 KOBJ_UMOUNT = (__force kobject_action_t) 0x05, /* umount event for block devices (broken) */ 46 KOBJ_ONLINE = (__force kobject_action_t) 0x05, /* device online */
48 KOBJ_OFFLINE = (__force kobject_action_t) 0x06, /* device offline */ 47 KOBJ_MOVE = (__force kobject_action_t) 0x06, /* device move */
49 KOBJ_ONLINE = (__force kobject_action_t) 0x07, /* device online */
50 KOBJ_MOVE = (__force kobject_action_t) 0x08, /* device move */
51}; 48};
52 49
53struct kobject { 50struct kobject {
@@ -74,9 +71,13 @@ extern void kobject_init(struct kobject *);
74extern void kobject_cleanup(struct kobject *); 71extern void kobject_cleanup(struct kobject *);
75 72
76extern int __must_check kobject_add(struct kobject *); 73extern int __must_check kobject_add(struct kobject *);
74extern int __must_check kobject_shadow_add(struct kobject *, struct dentry *);
77extern void kobject_del(struct kobject *); 75extern void kobject_del(struct kobject *);
78 76
79extern int __must_check kobject_rename(struct kobject *, const char *new_name); 77extern int __must_check kobject_rename(struct kobject *, const char *new_name);
78extern int __must_check kobject_shadow_rename(struct kobject *kobj,
79 struct dentry *new_parent,
80 const char *new_name);
80extern int __must_check kobject_move(struct kobject *, struct kobject *); 81extern int __must_check kobject_move(struct kobject *, struct kobject *);
81 82
82extern int __must_check kobject_register(struct kobject *); 83extern int __must_check kobject_register(struct kobject *);
@@ -85,6 +86,8 @@ extern void kobject_unregister(struct kobject *);
85extern struct kobject * kobject_get(struct kobject *); 86extern struct kobject * kobject_get(struct kobject *);
86extern void kobject_put(struct kobject *); 87extern void kobject_put(struct kobject *);
87 88
89extern struct kobject *kobject_kset_add_dir(struct kset *kset,
90 struct kobject *, const char *);
88extern struct kobject *kobject_add_dir(struct kobject *, const char *); 91extern struct kobject *kobject_add_dir(struct kobject *, const char *);
89 92
90extern char * kobject_get_path(struct kobject *, gfp_t); 93extern char * kobject_get_path(struct kobject *, gfp_t);
@@ -171,7 +174,6 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
171 174
172struct subsystem { 175struct subsystem {
173 struct kset kset; 176 struct kset kset;
174 struct rw_semaphore rwsem;
175}; 177};
176 178
177#define decl_subsys(_name,_type,_uevent_ops) \ 179#define decl_subsys(_name,_type,_uevent_ops) \
diff --git a/include/linux/ks0108.h b/include/linux/ks0108.h
new file mode 100644
index 000000000000..a2c54acceb4e
--- /dev/null
+++ b/include/linux/ks0108.h
@@ -0,0 +1,49 @@
1/*
2 * Filename: ks0108.h
3 * Version: 0.1.0
4 * Description: ks0108 LCD Controller driver header
5 * License: GPLv2
6 *
7 * Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com>
8 * Date: 2006-10-31
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 * 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#ifndef _KS0108_H_
26#define _KS0108_H_
27
28/* Write a byte to the data port */
29extern void ks0108_writedata(unsigned char byte);
30
31/* Write a byte to the control port */
32extern void ks0108_writecontrol(unsigned char byte);
33
34/* Set the controller's current display state (0..1) */
35extern void ks0108_displaystate(unsigned char state);
36
37/* Set the controller's current startline (0..63) */
38extern void ks0108_startline(unsigned char startline);
39
40/* Set the controller's current address (0..63) */
41extern void ks0108_address(unsigned char address);
42
43/* Set the controller's current page (0..7) */
44extern void ks0108_page(unsigned char page);
45
46/* Is the module inited? */
47extern unsigned char ks0108_isinited(void);
48
49#endif /* _KS0108_H_ */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 611f17f79eef..81bb9c7a4eb3 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -57,7 +57,11 @@ typedef union {
57} ktime_t; 57} ktime_t;
58 58
59#define KTIME_MAX ((s64)~((u64)1 << 63)) 59#define KTIME_MAX ((s64)~((u64)1 << 63))
60#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) 60#if (BITS_PER_LONG == 64)
61# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
62#else
63# define KTIME_SEC_MAX LONG_MAX
64#endif
61 65
62/* 66/*
63 * ktime_t definitions when using the 64-bit scalar representation: 67 * ktime_t definitions when using the 64-bit scalar representation:
@@ -163,7 +167,7 @@ static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs)
163 * @add1: addend1 167 * @add1: addend1
164 * @add2: addend2 168 * @add2: addend2
165 * 169 *
166 * Returns the sum of addend1 and addend2 170 * Returns the sum of @add1 and @add2.
167 */ 171 */
168static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) 172static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
169{ 173{
@@ -189,7 +193,7 @@ static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2)
189 * @kt: addend 193 * @kt: addend
190 * @nsec: the scalar nsec value to add 194 * @nsec: the scalar nsec value to add
191 * 195 *
192 * Returns the sum of kt and nsec in ktime_t format 196 * Returns the sum of @kt and @nsec in ktime_t format
193 */ 197 */
194extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); 198extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec);
195 199
@@ -246,7 +250,7 @@ static inline struct timeval ktime_to_timeval(const ktime_t kt)
246 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds 250 * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds
247 * @kt: the ktime_t variable to convert 251 * @kt: the ktime_t variable to convert
248 * 252 *
249 * Returns the scalar nanoseconds representation of kt 253 * Returns the scalar nanoseconds representation of @kt
250 */ 254 */
251static inline s64 ktime_to_ns(const ktime_t kt) 255static inline s64 ktime_to_ns(const ktime_t kt)
252{ 256{
@@ -255,14 +259,19 @@ static inline s64 ktime_to_ns(const ktime_t kt)
255 259
256#endif 260#endif
257 261
262static inline s64 ktime_to_us(const ktime_t kt)
263{
264 struct timeval tv = ktime_to_timeval(kt);
265 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
266}
267
258/* 268/*
259 * The resolution of the clocks. The resolution value is returned in 269 * The resolution of the clocks. The resolution value is returned in
260 * the clock_getres() system call to give application programmers an 270 * the clock_getres() system call to give application programmers an
261 * idea of the (in)accuracy of timers. Timer values are rounded up to 271 * idea of the (in)accuracy of timers. Timer values are rounded up to
262 * this resolution values. 272 * this resolution values.
263 */ 273 */
264#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC } 274#define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC }
265#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC }
266 275
267/* Get the monotonic time in timespec format: */ 276/* Get the monotonic time in timespec format: */
268extern void ktime_get_ts(struct timespec *ts); 277extern void ktime_get_ts(struct timespec *ts);
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 1be148f0fce4..275354ffa1cb 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -11,7 +11,7 @@
11#include <asm/types.h> 11#include <asm/types.h>
12#include <linux/ioctl.h> 12#include <linux/ioctl.h>
13 13
14#define KVM_API_VERSION 2 14#define KVM_API_VERSION 4
15 15
16/* 16/*
17 * Architectural interrupt line count, and the size of the bitmap needed 17 * Architectural interrupt line count, and the size of the bitmap needed
@@ -52,11 +52,10 @@ enum kvm_exit_reason {
52/* for KVM_RUN */ 52/* for KVM_RUN */
53struct kvm_run { 53struct kvm_run {
54 /* in */ 54 /* in */
55 __u32 vcpu;
56 __u32 emulated; /* skip current instruction */ 55 __u32 emulated; /* skip current instruction */
57 __u32 mmio_completed; /* mmio request completed */ 56 __u32 mmio_completed; /* mmio request completed */
58 __u8 request_interrupt_window; 57 __u8 request_interrupt_window;
59 __u8 padding1[3]; 58 __u8 padding1[7];
60 59
61 /* out */ 60 /* out */
62 __u32 exit_type; 61 __u32 exit_type;
@@ -65,6 +64,8 @@ struct kvm_run {
65 __u8 ready_for_interrupt_injection; 64 __u8 ready_for_interrupt_injection;
66 __u8 if_flag; 65 __u8 if_flag;
67 __u16 padding2; 66 __u16 padding2;
67
68 /* in (pre_kvm_run), out (post_kvm_run) */
68 __u64 cr8; 69 __u64 cr8;
69 __u64 apic_base; 70 __u64 apic_base;
70 71
@@ -109,10 +110,6 @@ struct kvm_run {
109 110
110/* for KVM_GET_REGS and KVM_SET_REGS */ 111/* for KVM_GET_REGS and KVM_SET_REGS */
111struct kvm_regs { 112struct kvm_regs {
112 /* in */
113 __u32 vcpu;
114 __u32 padding;
115
116 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */ 113 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
117 __u64 rax, rbx, rcx, rdx; 114 __u64 rax, rbx, rcx, rdx;
118 __u64 rsi, rdi, rsp, rbp; 115 __u64 rsi, rdi, rsp, rbp;
@@ -139,10 +136,6 @@ struct kvm_dtable {
139 136
140/* for KVM_GET_SREGS and KVM_SET_SREGS */ 137/* for KVM_GET_SREGS and KVM_SET_SREGS */
141struct kvm_sregs { 138struct kvm_sregs {
142 /* in */
143 __u32 vcpu;
144 __u32 padding;
145
146 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */ 139 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
147 struct kvm_segment cs, ds, es, fs, gs, ss; 140 struct kvm_segment cs, ds, es, fs, gs, ss;
148 struct kvm_segment tr, ldt; 141 struct kvm_segment tr, ldt;
@@ -161,8 +154,8 @@ struct kvm_msr_entry {
161 154
162/* for KVM_GET_MSRS and KVM_SET_MSRS */ 155/* for KVM_GET_MSRS and KVM_SET_MSRS */
163struct kvm_msrs { 156struct kvm_msrs {
164 __u32 vcpu;
165 __u32 nmsrs; /* number of msrs in entries */ 157 __u32 nmsrs; /* number of msrs in entries */
158 __u32 pad;
166 159
167 struct kvm_msr_entry entries[0]; 160 struct kvm_msr_entry entries[0];
168}; 161};
@@ -177,20 +170,18 @@ struct kvm_msr_list {
177struct kvm_translation { 170struct kvm_translation {
178 /* in */ 171 /* in */
179 __u64 linear_address; 172 __u64 linear_address;
180 __u32 vcpu;
181 __u32 padding;
182 173
183 /* out */ 174 /* out */
184 __u64 physical_address; 175 __u64 physical_address;
185 __u8 valid; 176 __u8 valid;
186 __u8 writeable; 177 __u8 writeable;
187 __u8 usermode; 178 __u8 usermode;
179 __u8 pad[5];
188}; 180};
189 181
190/* for KVM_INTERRUPT */ 182/* for KVM_INTERRUPT */
191struct kvm_interrupt { 183struct kvm_interrupt {
192 /* in */ 184 /* in */
193 __u32 vcpu;
194 __u32 irq; 185 __u32 irq;
195}; 186};
196 187
@@ -203,8 +194,8 @@ struct kvm_breakpoint {
203/* for KVM_DEBUG_GUEST */ 194/* for KVM_DEBUG_GUEST */
204struct kvm_debug_guest { 195struct kvm_debug_guest {
205 /* int */ 196 /* int */
206 __u32 vcpu;
207 __u32 enabled; 197 __u32 enabled;
198 __u32 pad;
208 struct kvm_breakpoint breakpoints[4]; 199 struct kvm_breakpoint breakpoints[4];
209 __u32 singlestep; 200 __u32 singlestep;
210}; 201};
@@ -221,20 +212,36 @@ struct kvm_dirty_log {
221 212
222#define KVMIO 0xAE 213#define KVMIO 0xAE
223 214
215/*
216 * ioctls for /dev/kvm fds:
217 */
224#define KVM_GET_API_VERSION _IO(KVMIO, 1) 218#define KVM_GET_API_VERSION _IO(KVMIO, 1)
219#define KVM_CREATE_VM _IO(KVMIO, 2) /* returns a VM fd */
220#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list)
221
222/*
223 * ioctls for VM fds
224 */
225#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region)
226/*
227 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
228 * a vcpu fd.
229 */
230#define KVM_CREATE_VCPU _IOW(KVMIO, 11, int)
231#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log)
232
233/*
234 * ioctls for vcpu fds
235 */
225#define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run) 236#define KVM_RUN _IOWR(KVMIO, 2, struct kvm_run)
226#define KVM_GET_REGS _IOWR(KVMIO, 3, struct kvm_regs) 237#define KVM_GET_REGS _IOR(KVMIO, 3, struct kvm_regs)
227#define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs) 238#define KVM_SET_REGS _IOW(KVMIO, 4, struct kvm_regs)
228#define KVM_GET_SREGS _IOWR(KVMIO, 5, struct kvm_sregs) 239#define KVM_GET_SREGS _IOR(KVMIO, 5, struct kvm_sregs)
229#define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs) 240#define KVM_SET_SREGS _IOW(KVMIO, 6, struct kvm_sregs)
230#define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation) 241#define KVM_TRANSLATE _IOWR(KVMIO, 7, struct kvm_translation)
231#define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt) 242#define KVM_INTERRUPT _IOW(KVMIO, 8, struct kvm_interrupt)
232#define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) 243#define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest)
233#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 10, struct kvm_memory_region)
234#define KVM_CREATE_VCPU _IOW(KVMIO, 11, int /* vcpu_slot */)
235#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 12, struct kvm_dirty_log)
236#define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) 244#define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs)
237#define KVM_SET_MSRS _IOWR(KVMIO, 14, struct kvm_msrs) 245#define KVM_SET_MSRS _IOW(KVMIO, 14, struct kvm_msrs)
238#define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 15, struct kvm_msr_list)
239 246
240#endif 247#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
new file mode 100644
index 000000000000..3b292565a693
--- /dev/null
+++ b/include/linux/kvm_para.h
@@ -0,0 +1,73 @@
1#ifndef __LINUX_KVM_PARA_H
2#define __LINUX_KVM_PARA_H
3
4/*
5 * Guest OS interface for KVM paravirtualization
6 *
7 * Note: this interface is totally experimental, and is certain to change
8 * as we make progress.
9 */
10
11/*
12 * Per-VCPU descriptor area shared between guest and host. Writable to
13 * both guest and host. Registered with the host by the guest when
14 * a guest acknowledges paravirtual mode.
15 *
16 * NOTE: all addresses are guest-physical addresses (gpa), to make it
17 * easier for the hypervisor to map between the various addresses.
18 */
19struct kvm_vcpu_para_state {
20 /*
21 * API version information for compatibility. If there's any support
22 * mismatch (too old host trying to execute too new guest) then
23 * the host will deny entry into paravirtual mode. Any other
24 * combination (new host + old guest and new host + new guest)
25 * is supposed to work - new host versions will support all old
26 * guest API versions.
27 */
28 u32 guest_version;
29 u32 host_version;
30 u32 size;
31 u32 ret;
32
33 /*
34 * The address of the vm exit instruction (VMCALL or VMMCALL),
35 * which the host will patch according to the CPU model the
36 * VM runs on:
37 */
38 u64 hypercall_gpa;
39
40} __attribute__ ((aligned(PAGE_SIZE)));
41
42#define KVM_PARA_API_VERSION 1
43
44/*
45 * This is used for an RDMSR's ECX parameter to probe for a KVM host.
46 * Hopefully no CPU vendor will use up this number. This is placed well
47 * out of way of the typical space occupied by CPU vendors' MSR indices,
48 * and we think (or at least hope) it wont be occupied in the future
49 * either.
50 */
51#define MSR_KVM_API_MAGIC 0x87655678
52
53#define KVM_EINVAL 1
54
55/*
56 * Hypercall calling convention:
57 *
58 * Each hypercall may have 0-6 parameters.
59 *
60 * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1
61 *
62 * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention
63 * order: RDI, RSI, RDX, RCX, R8, R9.
64 *
65 * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP.
66 * (the first 3 are according to the gcc regparm calling convention)
67 *
68 * No registers are clobbered by the hypercall, except that the
69 * return value is in RAX.
70 */
71#define __NR_hypercalls 0
72
73#endif
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index d739b2e7eac2..598793c0745b 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -9,22 +9,38 @@
9#define _LINUX_LCD_H 9#define _LINUX_LCD_H
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mutex.h>
12#include <linux/notifier.h> 13#include <linux/notifier.h>
13 14
15/* Notes on locking:
16 *
17 * lcd_device->ops_lock is an internal backlight lock protecting the ops
18 * field and no code outside the core should need to touch it.
19 *
20 * Access to set_power() is serialised by the update_lock mutex since
21 * most drivers seem to need this and historically get it wrong.
22 *
23 * Most drivers don't need locking on their get_power() method.
24 * If yours does, you need to implement it in the driver. You can use the
25 * update_lock mutex if appropriate.
26 *
27 * Any other use of the locks below is probably wrong.
28 */
29
14struct lcd_device; 30struct lcd_device;
15struct fb_info; 31struct fb_info;
16 32
17/* This structure defines all the properties of a LCD flat panel. */
18struct lcd_properties { 33struct lcd_properties {
19 /* Owner module */ 34 /* The maximum value for contrast (read-only) */
20 struct module *owner; 35 int max_contrast;
36};
37
38struct lcd_ops {
21 /* Get the LCD panel power status (0: full on, 1..3: controller 39 /* Get the LCD panel power status (0: full on, 1..3: controller
22 power on, flat panel power off, 4: full off), see FB_BLANK_XXX */ 40 power on, flat panel power off, 4: full off), see FB_BLANK_XXX */
23 int (*get_power)(struct lcd_device *); 41 int (*get_power)(struct lcd_device *);
24 /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */ 42 /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */
25 int (*set_power)(struct lcd_device *, int power); 43 int (*set_power)(struct lcd_device *, int power);
26 /* The maximum value for contrast (read-only) */
27 int max_contrast;
28 /* Get the current contrast setting (0-max_contrast) */ 44 /* Get the current contrast setting (0-max_contrast) */
29 int (*get_contrast)(struct lcd_device *); 45 int (*get_contrast)(struct lcd_device *);
30 /* Set LCD panel contrast */ 46 /* Set LCD panel contrast */
@@ -35,20 +51,31 @@ struct lcd_properties {
35}; 51};
36 52
37struct lcd_device { 53struct lcd_device {
38 /* This protects the 'props' field. If 'props' is NULL, the driver that 54 struct lcd_properties props;
55 /* This protects the 'ops' field. If 'ops' is NULL, the driver that
39 registered this device has been unloaded, and if class_get_devdata() 56 registered this device has been unloaded, and if class_get_devdata()
40 points to something in the body of that driver, it is also invalid. */ 57 points to something in the body of that driver, it is also invalid. */
41 struct semaphore sem; 58 struct mutex ops_lock;
42 /* If this is NULL, the backing module is unloaded */ 59 /* If this is NULL, the backing module is unloaded */
43 struct lcd_properties *props; 60 struct lcd_ops *ops;
61 /* Serialise access to set_power method */
62 struct mutex update_lock;
44 /* The framebuffer notifier block */ 63 /* The framebuffer notifier block */
45 struct notifier_block fb_notif; 64 struct notifier_block fb_notif;
46 /* The class device structure */ 65 /* The class device structure */
47 struct class_device class_dev; 66 struct class_device class_dev;
48}; 67};
49 68
69static inline void lcd_set_power(struct lcd_device *ld, int power)
70{
71 mutex_lock(&ld->update_lock);
72 if (ld->ops && ld->ops->set_power)
73 ld->ops->set_power(ld, power);
74 mutex_unlock(&ld->update_lock);
75}
76
50extern struct lcd_device *lcd_device_register(const char *name, 77extern struct lcd_device *lcd_device_register(const char *name,
51 void *devdata, struct lcd_properties *lp); 78 void *devdata, struct lcd_ops *ops);
52extern void lcd_device_unregister(struct lcd_device *ld); 79extern void lcd_device_unregister(struct lcd_device *ld);
53 80
54#define to_lcd_device(obj) container_of(obj, struct lcd_device, class_dev) 81#define to_lcd_device(obj) container_of(obj, struct lcd_device, class_dev)
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 22aa69e20905..d8cfc72ea9c1 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -31,10 +31,11 @@
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/scatterlist.h>
34#include <asm/io.h> 34#include <linux/io.h>
35#include <linux/ata.h> 35#include <linux/ata.h>
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
38#include <linux/acpi.h>
38 39
39/* 40/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard 41 * Define if arch has non-standard setup. This is a _PCI_ standard
@@ -54,8 +55,6 @@
54#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ 55#undef ATA_VERBOSE_DEBUG /* yet more debugging output */
55#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ 56#undef ATA_IRQ_TRAP /* define to ack screaming irqs */
56#undef ATA_NDEBUG /* define to disable quick runtime checks */ 57#undef ATA_NDEBUG /* define to disable quick runtime checks */
57#define ATA_ENABLE_PATA /* define to enable PATA support in some
58 * low-level drivers */
59 58
60 59
61/* note: prints function name for you */ 60/* note: prints function name for you */
@@ -109,10 +108,6 @@ static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
109#define ATA_TAG_POISON 0xfafbfcfdU 108#define ATA_TAG_POISON 0xfafbfcfdU
110 109
111/* move to PCI layer? */ 110/* move to PCI layer? */
112#define PCI_VDEVICE(vendor, device) \
113 PCI_VENDOR_ID_##vendor, (device), \
114 PCI_ANY_ID, PCI_ANY_ID, 0, 0
115
116static inline struct device *pci_dev_to_dev(struct pci_dev *pdev) 111static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
117{ 112{
118 return &pdev->dev; 113 return &pdev->dev;
@@ -178,6 +173,7 @@ enum {
178 ATA_FLAG_DEBUGMSG = (1 << 13), 173 ATA_FLAG_DEBUGMSG = (1 << 13),
179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */ 174 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
180 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 175 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
176 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
181 177
182 /* The following flag belongs to ap->pflags but is kept in 178 /* The following flag belongs to ap->pflags but is kept in
183 * ap->flags because it's referenced in many LLDs and will be 179 * ap->flags because it's referenced in many LLDs and will be
@@ -214,6 +210,7 @@ enum {
214 210
215 /* host set flags */ 211 /* host set flags */
216 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 212 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
213 ATA_HOST_STARTED = (1 << 1), /* Host started */
217 214
218 /* various lengths of time */ 215 /* various lengths of time */
219 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 216 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */
@@ -285,11 +282,13 @@ enum {
285 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 282 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
286 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 283 ATA_EHI_QUIET = (1 << 3), /* be quiet */
287 284
288 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 285 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
289 ATA_EHI_PRINTINFO = (1 << 17), /* print configuration info */ 286 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
290 ATA_EHI_SETMODE = (1 << 18), /* configure transfer mode */ 287 ATA_EHI_PRINTINFO = (1 << 18), /* print configuration info */
291 ATA_EHI_POST_SETMODE = (1 << 19), /* revaildating after setmode */ 288 ATA_EHI_SETMODE = (1 << 19), /* configure transfer mode */
289 ATA_EHI_POST_SETMODE = (1 << 20), /* revaildating after setmode */
292 290
291 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
293 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 292 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
294 293
295 /* max repeat if error condition is still set after ->error_handler */ 294 /* max repeat if error condition is still set after ->error_handler */
@@ -308,22 +307,24 @@ enum {
308 * most devices. 307 * most devices.
309 */ 308 */
310 ATA_SPINUP_WAIT = 8000, 309 ATA_SPINUP_WAIT = 8000,
311 310
312 /* Horkage types. May be set by libata or controller on drives 311 /* Horkage types. May be set by libata or controller on drives
313 (some horkage may be drive/controller pair dependant */ 312 (some horkage may be drive/controller pair dependant */
314 313
315 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 314 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
316 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 315 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
317 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 316 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
317 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
318 ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */
318}; 319};
319 320
320enum hsm_task_states { 321enum hsm_task_states {
321 HSM_ST_IDLE, /* no command on going */ 322 HSM_ST_IDLE, /* no command on going */
323 HSM_ST_FIRST, /* (waiting the device to)
324 write CDB or first data block */
322 HSM_ST, /* (waiting the device to) transfer data */ 325 HSM_ST, /* (waiting the device to) transfer data */
323 HSM_ST_LAST, /* (waiting the device to) complete command */ 326 HSM_ST_LAST, /* (waiting the device to) complete command */
324 HSM_ST_ERR, /* error */ 327 HSM_ST_ERR, /* error */
325 HSM_ST_FIRST, /* (waiting the device to)
326 write CDB or first data block */
327}; 328};
328 329
329enum ata_completion_errors { 330enum ata_completion_errors {
@@ -352,49 +353,21 @@ typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes);
352typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes); 353typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes);
353 354
354struct ata_ioports { 355struct ata_ioports {
355 unsigned long cmd_addr; 356 void __iomem *cmd_addr;
356 unsigned long data_addr; 357 void __iomem *data_addr;
357 unsigned long error_addr; 358 void __iomem *error_addr;
358 unsigned long feature_addr; 359 void __iomem *feature_addr;
359 unsigned long nsect_addr; 360 void __iomem *nsect_addr;
360 unsigned long lbal_addr; 361 void __iomem *lbal_addr;
361 unsigned long lbam_addr; 362 void __iomem *lbam_addr;
362 unsigned long lbah_addr; 363 void __iomem *lbah_addr;
363 unsigned long device_addr; 364 void __iomem *device_addr;
364 unsigned long status_addr; 365 void __iomem *status_addr;
365 unsigned long command_addr; 366 void __iomem *command_addr;
366 unsigned long altstatus_addr; 367 void __iomem *altstatus_addr;
367 unsigned long ctl_addr; 368 void __iomem *ctl_addr;
368 unsigned long bmdma_addr; 369 void __iomem *bmdma_addr;
369 unsigned long scr_addr; 370 void __iomem *scr_addr;
370};
371
372struct ata_probe_ent {
373 struct list_head node;
374 struct device *dev;
375 const struct ata_port_operations *port_ops;
376 struct scsi_host_template *sht;
377 struct ata_ioports port[ATA_MAX_PORTS];
378 unsigned int n_ports;
379 unsigned int dummy_port_mask;
380 unsigned int pio_mask;
381 unsigned int mwdma_mask;
382 unsigned int udma_mask;
383 unsigned long irq;
384 unsigned long irq2;
385 unsigned int irq_flags;
386 unsigned long port_flags;
387 unsigned long _host_flags;
388 void __iomem *mmio_base;
389 void *private_data;
390
391 /* port_info for the secondary port. Together with irq2, it's
392 * used to implement non-uniform secondary port. Currently,
393 * the only user is ata_piix combined mode. This workaround
394 * will be removed together with ata_probe_ent when init model
395 * is updated.
396 */
397 const struct ata_port_info *pinfo2;
398}; 371};
399 372
400struct ata_host { 373struct ata_host {
@@ -402,13 +375,12 @@ struct ata_host {
402 struct device *dev; 375 struct device *dev;
403 unsigned long irq; 376 unsigned long irq;
404 unsigned long irq2; 377 unsigned long irq2;
405 void __iomem *mmio_base; 378 void __iomem * const *iomap;
406 unsigned int n_ports; 379 unsigned int n_ports;
407 void *private_data; 380 void *private_data;
408 const struct ata_port_operations *ops; 381 const struct ata_port_operations *ops;
409 unsigned long flags; 382 unsigned long flags;
410 int simplex_claimed; /* Keep seperate in case we 383 struct ata_port *simplex_claimed; /* channel owning the DMA */
411 ever need to do this locked */
412 struct ata_port *ports[0]; 384 struct ata_port *ports[0];
413}; 385};
414 386
@@ -430,9 +402,7 @@ struct ata_queued_cmd {
430 int dma_dir; 402 int dma_dir;
431 403
432 unsigned int pad_len; 404 unsigned int pad_len;
433 405 unsigned int sect_size;
434 unsigned int nsect;
435 unsigned int cursect;
436 406
437 unsigned int nbytes; 407 unsigned int nbytes;
438 unsigned int curbytes; 408 unsigned int curbytes;
@@ -478,6 +448,7 @@ struct ata_device {
478 struct scsi_device *sdev; /* attached SCSI device */ 448 struct scsi_device *sdev; /* attached SCSI device */
479 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 449 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
480 u64 n_sectors; /* size of device, if ATA */ 450 u64 n_sectors; /* size of device, if ATA */
451 u64 n_sectors_boot; /* size of ATA device at startup */
481 unsigned int class; /* ATA_DEV_xxx */ 452 unsigned int class; /* ATA_DEV_xxx */
482 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 453 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
483 u8 pio_mode; 454 u8 pio_mode;
@@ -502,7 +473,12 @@ struct ata_device {
502 473
503 /* error history */ 474 /* error history */
504 struct ata_ering ering; 475 struct ata_ering ering;
476 int spdn_cnt;
505 unsigned int horkage; /* List of broken features */ 477 unsigned int horkage; /* List of broken features */
478#ifdef CONFIG_SATA_ACPI
479 /* ACPI objects info */
480 acpi_handle obj_handle;
481#endif
506}; 482};
507 483
508/* Offset into struct ata_device. Fields above it are maintained 484/* Offset into struct ata_device. Fields above it are maintained
@@ -538,8 +514,8 @@ struct ata_port {
538 spinlock_t *lock; 514 spinlock_t *lock;
539 unsigned long flags; /* ATA_FLAG_xxx */ 515 unsigned long flags; /* ATA_FLAG_xxx */
540 unsigned int pflags; /* ATA_PFLAG_xxx */ 516 unsigned int pflags; /* ATA_PFLAG_xxx */
541 unsigned int id; /* unique id req'd by scsi midlyr */ 517 unsigned int print_id; /* user visible unique port ID */
542 unsigned int port_no; /* unique port #; from zero */ 518 unsigned int port_no; /* 0 based port no. inside the host */
543 519
544 struct ata_prd *prd; /* our SG list */ 520 struct ata_prd *prd; /* our SG list */
545 dma_addr_t prd_dma; /* and its DMA mapping */ 521 dma_addr_t prd_dma; /* and its DMA mapping */
@@ -598,11 +574,11 @@ struct ata_port {
598struct ata_port_operations { 574struct ata_port_operations {
599 void (*port_disable) (struct ata_port *); 575 void (*port_disable) (struct ata_port *);
600 576
601 void (*dev_config) (struct ata_port *, struct ata_device *); 577 void (*dev_config) (struct ata_device *);
602 578
603 void (*set_piomode) (struct ata_port *, struct ata_device *); 579 void (*set_piomode) (struct ata_port *, struct ata_device *);
604 void (*set_dmamode) (struct ata_port *, struct ata_device *); 580 void (*set_dmamode) (struct ata_port *, struct ata_device *);
605 unsigned long (*mode_filter) (const struct ata_port *, struct ata_device *, unsigned long); 581 unsigned long (*mode_filter) (struct ata_device *, unsigned long);
606 582
607 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf); 583 void (*tf_load) (struct ata_port *ap, const struct ata_taskfile *tf);
608 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf); 584 void (*tf_read) (struct ata_port *ap, struct ata_taskfile *tf);
@@ -617,6 +593,8 @@ struct ata_port_operations {
617 593
618 void (*post_set_mode) (struct ata_port *ap); 594 void (*post_set_mode) (struct ata_port *ap);
619 595
596 int (*cable_detect) (struct ata_port *ap);
597
620 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 598 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
621 599
622 void (*bmdma_setup) (struct ata_queued_cmd *qc); 600 void (*bmdma_setup) (struct ata_queued_cmd *qc);
@@ -639,6 +617,8 @@ struct ata_port_operations {
639 617
640 irq_handler_t irq_handler; 618 irq_handler_t irq_handler;
641 void (*irq_clear) (struct ata_port *); 619 void (*irq_clear) (struct ata_port *);
620 u8 (*irq_on) (struct ata_port *);
621 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
642 622
643 u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); 623 u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
644 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, 624 void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
@@ -663,6 +643,7 @@ struct ata_port_info {
663 unsigned long mwdma_mask; 643 unsigned long mwdma_mask;
664 unsigned long udma_mask; 644 unsigned long udma_mask;
665 const struct ata_port_operations *port_ops; 645 const struct ata_port_operations *port_ops;
646 irq_handler_t irq_handler;
666 void *private_data; 647 void *private_data;
667}; 648};
668 649
@@ -685,6 +666,7 @@ extern const unsigned long sata_deb_timing_hotplug[];
685extern const unsigned long sata_deb_timing_long[]; 666extern const unsigned long sata_deb_timing_long[];
686 667
687extern const struct ata_port_operations ata_dummy_port_ops; 668extern const struct ata_port_operations ata_dummy_port_ops;
669extern const struct ata_port_info ata_dummy_port_info;
688 670
689static inline const unsigned long * 671static inline const unsigned long *
690sata_ehc_deb_timing(struct ata_eh_context *ehc) 672sata_ehc_deb_timing(struct ata_eh_context *ehc)
@@ -700,6 +682,7 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
700 return ap->ops == &ata_dummy_port_ops; 682 return ap->ops == &ata_dummy_port_ops;
701} 683}
702 684
685extern void sata_print_link_status(struct ata_port *ap);
703extern void ata_port_probe(struct ata_port *); 686extern void ata_port_probe(struct ata_port *);
704extern void __sata_phy_reset(struct ata_port *ap); 687extern void __sata_phy_reset(struct ata_port *ap);
705extern void sata_phy_reset(struct ata_port *ap); 688extern void sata_phy_reset(struct ata_port *ap);
@@ -719,21 +702,29 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
719extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, 702extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
720 unsigned int n_ports); 703 unsigned int n_ports);
721extern void ata_pci_remove_one (struct pci_dev *pdev); 704extern void ata_pci_remove_one (struct pci_dev *pdev);
705#ifdef CONFIG_PM
722extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg); 706extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
723extern void ata_pci_device_do_resume(struct pci_dev *pdev); 707extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
724extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 708extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
725extern int ata_pci_device_resume(struct pci_dev *pdev); 709extern int ata_pci_device_resume(struct pci_dev *pdev);
710#endif
726extern int ata_pci_clear_simplex(struct pci_dev *pdev); 711extern int ata_pci_clear_simplex(struct pci_dev *pdev);
727#endif /* CONFIG_PCI */ 712#endif /* CONFIG_PCI */
728extern int ata_device_add(const struct ata_probe_ent *ent); 713extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
729extern void ata_port_detach(struct ata_port *ap); 714extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
715 const struct ata_port_info * const * ppi, int n_ports);
716extern int ata_host_start(struct ata_host *host);
717extern int ata_host_register(struct ata_host *host,
718 struct scsi_host_template *sht);
719extern int ata_host_activate(struct ata_host *host, int irq,
720 irq_handler_t irq_handler, unsigned long irq_flags,
721 struct scsi_host_template *sht);
722extern void ata_host_detach(struct ata_host *host);
730extern void ata_host_init(struct ata_host *, struct device *, 723extern void ata_host_init(struct ata_host *, struct device *,
731 unsigned long, const struct ata_port_operations *); 724 unsigned long, const struct ata_port_operations *);
732extern void ata_host_remove(struct ata_host *host);
733extern int ata_scsi_detect(struct scsi_host_template *sht); 725extern int ata_scsi_detect(struct scsi_host_template *sht);
734extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 726extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
735extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 727extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
736extern int ata_scsi_release(struct Scsi_Host *host);
737extern void ata_sas_port_destroy(struct ata_port *); 728extern void ata_sas_port_destroy(struct ata_port *);
738extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 729extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
739 struct ata_port_info *, struct Scsi_Host *); 730 struct ata_port_info *, struct Scsi_Host *);
@@ -750,10 +741,12 @@ extern int sata_scr_write(struct ata_port *ap, int reg, u32 val);
750extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); 741extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val);
751extern int ata_port_online(struct ata_port *ap); 742extern int ata_port_online(struct ata_port *ap);
752extern int ata_port_offline(struct ata_port *ap); 743extern int ata_port_offline(struct ata_port *ap);
744#ifdef CONFIG_PM
753extern int ata_scsi_device_resume(struct scsi_device *); 745extern int ata_scsi_device_resume(struct scsi_device *);
754extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg); 746extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
755extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 747extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
756extern void ata_host_resume(struct ata_host *host); 748extern void ata_host_resume(struct ata_host *host);
749#endif
757extern int ata_ratelimit(void); 750extern int ata_ratelimit(void);
758extern int ata_busy_sleep(struct ata_port *ap, 751extern int ata_busy_sleep(struct ata_port *ap,
759 unsigned long timeout_pat, unsigned long timeout); 752 unsigned long timeout_pat, unsigned long timeout);
@@ -762,6 +755,7 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
762extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 755extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
763 unsigned long interval_msec, 756 unsigned long interval_msec,
764 unsigned long timeout_msec); 757 unsigned long timeout_msec);
758extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);
765 759
766/* 760/*
767 * Default driver ops implementations 761 * Default driver ops implementations
@@ -776,15 +770,11 @@ extern u8 ata_check_status(struct ata_port *ap);
776extern u8 ata_altstatus(struct ata_port *ap); 770extern u8 ata_altstatus(struct ata_port *ap);
777extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 771extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf);
778extern int ata_port_start (struct ata_port *ap); 772extern int ata_port_start (struct ata_port *ap);
779extern void ata_port_stop (struct ata_port *ap);
780extern void ata_host_stop (struct ata_host *host);
781extern irqreturn_t ata_interrupt (int irq, void *dev_instance); 773extern irqreturn_t ata_interrupt (int irq, void *dev_instance);
782extern void ata_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, 774extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
783 unsigned int buflen, int write_data); 775 unsigned int buflen, int write_data);
784extern void ata_pio_data_xfer(struct ata_device *adev, unsigned char *buf, 776extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
785 unsigned int buflen, int write_data); 777 unsigned int buflen, int write_data);
786extern void ata_pio_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
787 unsigned int buflen, int write_data);
788extern void ata_qc_prep(struct ata_queued_cmd *qc); 778extern void ata_qc_prep(struct ata_queued_cmd *qc);
789extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 779extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
790extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 780extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
@@ -793,10 +783,12 @@ extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
793extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 783extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
794 unsigned int n_elem); 784 unsigned int n_elem);
795extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 785extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
786extern void ata_dev_disable(struct ata_device *adev);
796extern void ata_id_string(const u16 *id, unsigned char *s, 787extern void ata_id_string(const u16 *id, unsigned char *s,
797 unsigned int ofs, unsigned int len); 788 unsigned int ofs, unsigned int len);
798extern void ata_id_c_string(const u16 *id, unsigned char *s, 789extern void ata_id_c_string(const u16 *id, unsigned char *s,
799 unsigned int ofs, unsigned int len); 790 unsigned int ofs, unsigned int len);
791extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
800extern unsigned long ata_device_blacklisted(const struct ata_device *dev); 792extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
801extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 793extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
802extern void ata_bmdma_start (struct ata_queued_cmd *qc); 794extern void ata_bmdma_start (struct ata_queued_cmd *qc);
@@ -826,6 +818,16 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
826extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 818extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
827 int queue_depth); 819 int queue_depth);
828extern struct ata_device *ata_dev_pair(struct ata_device *adev); 820extern struct ata_device *ata_dev_pair(struct ata_device *adev);
821extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev);
822extern u8 ata_irq_on(struct ata_port *ap);
823extern u8 ata_dummy_irq_on(struct ata_port *ap);
824extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
825extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
826
827extern int ata_cable_40wire(struct ata_port *ap);
828extern int ata_cable_80wire(struct ata_port *ap);
829extern int ata_cable_sata(struct ata_port *ap);
830extern int ata_cable_unknown(struct ata_port *ap);
829 831
830/* 832/*
831 * Timing helpers 833 * Timing helpers
@@ -864,11 +866,13 @@ struct pci_bits {
864 unsigned long val; 866 unsigned long val;
865}; 867};
866 868
867extern void ata_pci_host_stop (struct ata_host *host); 869extern int ata_pci_init_native_host(struct ata_host *host,
868extern struct ata_probe_ent * 870 unsigned int port_mask);
869ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask); 871extern int ata_pci_prepare_native_host(struct pci_dev *pdev,
872 const struct ata_port_info * const * ppi,
873 int n_ports, struct ata_host **r_host);
870extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 874extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
871extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long); 875extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
872#endif /* CONFIG_PCI */ 876#endif /* CONFIG_PCI */
873 877
874/* 878/*
@@ -894,10 +898,10 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
894 * printk helpers 898 * printk helpers
895 */ 899 */
896#define ata_port_printk(ap, lv, fmt, args...) \ 900#define ata_port_printk(ap, lv, fmt, args...) \
897 printk(lv"ata%u: "fmt, (ap)->id , ##args) 901 printk(lv"ata%u: "fmt, (ap)->print_id , ##args)
898 902
899#define ata_dev_printk(dev, lv, fmt, args...) \ 903#define ata_dev_printk(dev, lv, fmt, args...) \
900 printk(lv"ata%u.%02u: "fmt, (dev)->ap->id, (dev)->devno , ##args) 904 printk(lv"ata%u.%02u: "fmt, (dev)->ap->print_id, (dev)->devno , ##args)
901 905
902/* 906/*
903 * ata_eh_info helpers 907 * ata_eh_info helpers
@@ -1035,6 +1039,21 @@ static inline u8 ata_chk_status(struct ata_port *ap)
1035 return ap->ops->check_status(ap); 1039 return ap->ops->check_status(ap);
1036} 1040}
1037 1041
1042/**
1043 * ata_ncq_enabled - Test whether NCQ is enabled
1044 * @dev: ATA device to test for
1045 *
1046 * LOCKING:
1047 * spin_lock_irqsave(host lock)
1048 *
1049 * RETURNS:
1050 * 1 if NCQ is enabled for @dev, 0 otherwise.
1051 */
1052static inline int ata_ncq_enabled(struct ata_device *dev)
1053{
1054 return (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ_OFF |
1055 ATA_DFLAG_NCQ)) == ATA_DFLAG_NCQ;
1056}
1038 1057
1039/** 1058/**
1040 * ata_pause - Flush writes and pause 400 nanoseconds. 1059 * ata_pause - Flush writes and pause 400 nanoseconds.
@@ -1054,6 +1073,8 @@ static inline void ata_pause(struct ata_port *ap)
1054/** 1073/**
1055 * ata_busy_wait - Wait for a port status register 1074 * ata_busy_wait - Wait for a port status register
1056 * @ap: Port to wait for. 1075 * @ap: Port to wait for.
1076 * @bits: bits that must be clear
1077 * @max: number of 10uS waits to perform
1057 * 1078 *
1058 * Waits up to max*10 microseconds for the selected bits in the port's 1079 * Waits up to max*10 microseconds for the selected bits in the port's
1059 * status register to be cleared. 1080 * status register to be cleared.
@@ -1094,10 +1115,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1094 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1115 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1095 1116
1096 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) { 1117 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
1097 unsigned long l = ap->ioaddr.status_addr;
1098 if (ata_msg_warn(ap)) 1118 if (ata_msg_warn(ap))
1099 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n", 1119 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%p\n",
1100 status, l); 1120 status, ap->ioaddr.status_addr);
1101 } 1121 }
1102 1122
1103 return status; 1123 return status;
@@ -1147,12 +1167,12 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1147 qc->dma_dir = DMA_NONE; 1167 qc->dma_dir = DMA_NONE;
1148 qc->__sg = NULL; 1168 qc->__sg = NULL;
1149 qc->flags = 0; 1169 qc->flags = 0;
1150 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 1170 qc->cursg = qc->cursg_ofs = 0;
1151 qc->nsect = 0;
1152 qc->nbytes = qc->curbytes = 0; 1171 qc->nbytes = qc->curbytes = 0;
1153 qc->n_elem = 0; 1172 qc->n_elem = 0;
1154 qc->err_mask = 0; 1173 qc->err_mask = 0;
1155 qc->pad_len = 0; 1174 qc->pad_len = 0;
1175 qc->sect_size = ATA_SECT_SIZE;
1156 1176
1157 ata_tf_init(qc->dev, &qc->tf); 1177 ata_tf_init(qc->dev, &qc->tf);
1158 1178
@@ -1161,51 +1181,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1161 qc->result_tf.feature = 0; 1181 qc->result_tf.feature = 0;
1162} 1182}
1163 1183
1164/**
1165 * ata_irq_ack - Acknowledge a device interrupt.
1166 * @ap: Port on which interrupts are enabled.
1167 *
1168 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
1169 * or BUSY+DRQ clear). Obtain dma status and port status from
1170 * device. Clear the interrupt. Return port status.
1171 *
1172 * LOCKING:
1173 */
1174
1175static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
1176{
1177 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
1178 u8 host_stat, post_stat, status;
1179
1180 status = ata_busy_wait(ap, bits, 1000);
1181 if (status & bits)
1182 if (ata_msg_err(ap))
1183 printk(KERN_ERR "abnormal status 0x%X\n", status);
1184
1185 /* get controller status; clear intr, err bits */
1186 if (ap->flags & ATA_FLAG_MMIO) {
1187 void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
1188 host_stat = readb(mmio + ATA_DMA_STATUS);
1189 writeb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
1190 mmio + ATA_DMA_STATUS);
1191
1192 post_stat = readb(mmio + ATA_DMA_STATUS);
1193 } else {
1194 host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
1195 outb(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
1196 ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
1197
1198 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
1199 }
1200
1201 if (ata_msg_intr(ap))
1202 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
1203 __FUNCTION__,
1204 host_stat, post_stat, status);
1205
1206 return status;
1207}
1208
1209static inline int ata_try_flush_cache(const struct ata_device *dev) 1184static inline int ata_try_flush_cache(const struct ata_device *dev)
1210{ 1185{
1211 return ata_id_wcache_enabled(dev->id) || 1186 return ata_id_wcache_enabled(dev->id) ||
@@ -1233,19 +1208,19 @@ static inline unsigned int __ac_err_mask(u8 status)
1233static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev) 1208static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev)
1234{ 1209{
1235 ap->pad_dma = 0; 1210 ap->pad_dma = 0;
1236 ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, 1211 ap->pad = dmam_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ,
1237 &ap->pad_dma, GFP_KERNEL); 1212 &ap->pad_dma, GFP_KERNEL);
1238 return (ap->pad == NULL) ? -ENOMEM : 0; 1213 return (ap->pad == NULL) ? -ENOMEM : 0;
1239} 1214}
1240 1215
1241static inline void ata_pad_free(struct ata_port *ap, struct device *dev) 1216static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
1242{ 1217{
1243 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); 1218 dmam_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
1244} 1219}
1245 1220
1246static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host) 1221static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
1247{ 1222{
1248 return (struct ata_port *) &host->hostdata[0]; 1223 return *(struct ata_port **)&host->hostdata[0];
1249} 1224}
1250 1225
1251#endif /* __LINUX_LIBATA_H__ */ 1226#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 611059d633f4..f9d71eab05ee 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -161,7 +161,7 @@ static inline void __list_del(struct list_head * prev, struct list_head * next)
161/** 161/**
162 * list_del - deletes entry from list. 162 * list_del - deletes entry from list.
163 * @entry: the element to delete from the list. 163 * @entry: the element to delete from the list.
164 * 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
165 * in an undefined state. 165 * in an undefined state.
166 */ 166 */
167#ifndef CONFIG_DEBUG_LIST 167#ifndef CONFIG_DEBUG_LIST
@@ -179,7 +179,7 @@ extern void list_del(struct list_head *entry);
179 * list_del_rcu - deletes entry from list without re-initialization 179 * list_del_rcu - deletes entry from list without re-initialization
180 * @entry: the element to delete from the list. 180 * @entry: the element to delete from the list.
181 * 181 *
182 * Note: list_empty on entry does not return true after this, 182 * Note: list_empty() on entry does not return true after this,
183 * the entry is in an undefined state. It is useful for RCU based 183 * the entry is in an undefined state. It is useful for RCU based
184 * lockfree traversal. 184 * lockfree traversal.
185 * 185 *
@@ -209,7 +209,8 @@ static inline void list_del_rcu(struct list_head *entry)
209 * list_replace - replace old entry by new one 209 * list_replace - replace old entry by new one
210 * @old : the element to be replaced 210 * @old : the element to be replaced
211 * @new : the new element to insert 211 * @new : the new element to insert
212 * Note: if 'old' was empty, it will be overwritten. 212 *
213 * If @old was empty, it will be overwritten.
213 */ 214 */
214static inline void list_replace(struct list_head *old, 215static inline void list_replace(struct list_head *old,
215 struct list_head *new) 216 struct list_head *new)
@@ -360,6 +361,62 @@ static inline void list_splice_init(struct list_head *list,
360} 361}
361 362
362/** 363/**
364 * list_splice_init_rcu - splice an RCU-protected list into an existing list.
365 * @list: the RCU-protected list to splice
366 * @head: the place in the list to splice the first list into
367 * @sync: function to sync: synchronize_rcu(), synchronize_sched(), ...
368 *
369 * @head can be RCU-read traversed concurrently with this function.
370 *
371 * Note that this function blocks.
372 *
373 * Important note: the caller must take whatever action is necessary to
374 * prevent any other updates to @head. In principle, it is possible
375 * to modify the list as soon as sync() begins execution.
376 * If this sort of thing becomes necessary, an alternative version
377 * based on call_rcu() could be created. But only if -really-
378 * needed -- there is no shortage of RCU API members.
379 */
380static inline void list_splice_init_rcu(struct list_head *list,
381 struct list_head *head,
382 void (*sync)(void))
383{
384 struct list_head *first = list->next;
385 struct list_head *last = list->prev;
386 struct list_head *at = head->next;
387
388 if (list_empty(head))
389 return;
390
391 /* "first" and "last" tracking list, so initialize it. */
392
393 INIT_LIST_HEAD(list);
394
395 /*
396 * At this point, the list body still points to the source list.
397 * Wait for any readers to finish using the list before splicing
398 * the list body into the new list. Any new readers will see
399 * an empty list.
400 */
401
402 sync();
403
404 /*
405 * Readers are finished with the source list, so perform splice.
406 * The order is important if the new list is global and accessible
407 * to concurrent RCU readers. Note that RCU readers are not
408 * permitted to traverse the prev pointers without excluding
409 * this function.
410 */
411
412 last->next = at;
413 smp_wmb();
414 head->next = first;
415 first->prev = head;
416 at->prev = last;
417}
418
419/**
363 * list_entry - get the struct for this entry 420 * list_entry - get the struct for this entry
364 * @ptr: the &struct list_head pointer. 421 * @ptr: the &struct list_head pointer.
365 * @type: the type of the struct this is embedded in. 422 * @type: the type of the struct this is embedded in.
@@ -432,12 +489,12 @@ static inline void list_splice_init(struct list_head *list,
432 pos = list_entry(pos->member.prev, typeof(*pos), member)) 489 pos = list_entry(pos->member.prev, typeof(*pos), member))
433 490
434/** 491/**
435 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue 492 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
436 * @pos: the type * to use as a start point 493 * @pos: the type * to use as a start point
437 * @head: the head of the list 494 * @head: the head of the list
438 * @member: the name of the list_struct within the struct. 495 * @member: the name of the list_struct within the struct.
439 * 496 *
440 * Prepares a pos entry for use as a start point in list_for_each_entry_continue. 497 * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
441 */ 498 */
442#define list_prepare_entry(pos, head, member) \ 499#define list_prepare_entry(pos, head, member) \
443 ((pos) ? : list_entry(head, typeof(*pos), member)) 500 ((pos) ? : list_entry(head, typeof(*pos), member))
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index ea097dddc44f..14c937d345cb 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -8,6 +8,8 @@
8#ifndef __LINUX_LOCKDEP_H 8#ifndef __LINUX_LOCKDEP_H
9#define __LINUX_LOCKDEP_H 9#define __LINUX_LOCKDEP_H
10 10
11struct task_struct;
12
11#ifdef CONFIG_LOCKDEP 13#ifdef CONFIG_LOCKDEP
12 14
13#include <linux/linkage.h> 15#include <linux/linkage.h>
@@ -132,6 +134,7 @@ struct lock_list {
132 struct list_head entry; 134 struct list_head entry;
133 struct lock_class *class; 135 struct lock_class *class;
134 struct stack_trace trace; 136 struct stack_trace trace;
137 int distance;
135}; 138};
136 139
137/* 140/*
@@ -242,7 +245,7 @@ extern void lock_release(struct lockdep_map *lock, int nested,
242 245
243# define INIT_LOCKDEP .lockdep_recursion = 0, 246# define INIT_LOCKDEP .lockdep_recursion = 0,
244 247
245#define lockdep_depth(tsk) ((tsk)->lockdep_depth) 248#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
246 249
247#else /* !LOCKDEP */ 250#else /* !LOCKDEP */
248 251
diff --git a/include/linux/log2.h b/include/linux/log2.h
index d02e1a547a7e..57e641e19a81 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -44,6 +44,17 @@ int __ilog2_u64(u64 n)
44#endif 44#endif
45 45
46/* 46/*
47 * Determine whether some value is a power of two, where zero is
48 * *not* considered a power of two.
49 */
50
51static inline __attribute__((const))
52bool is_power_of_2(unsigned long n)
53{
54 return (n != 0 && ((n & (n - 1)) == 0));
55}
56
57/*
47 * round up to nearest power of two 58 * round up to nearest power of two
48 */ 59 */
49static inline __attribute__((const)) 60static inline __attribute__((const))
@@ -141,7 +152,7 @@ unsigned long __roundup_pow_of_two(unsigned long n)
141 * roundup_pow_of_two - round the given value up to nearest power of two 152 * roundup_pow_of_two - round the given value up to nearest power of two
142 * @n - parameter 153 * @n - parameter
143 * 154 *
144 * round the given balue up to the nearest power of two 155 * round the given value up to the nearest power of two
145 * - the result is undefined when n == 0 156 * - the result is undefined when n == 0
146 * - this can be used to initialise global variables from constant data 157 * - this can be used to initialise global variables from constant data
147 */ 158 */
diff --git a/include/linux/magic.h b/include/linux/magic.h
index b78bbf42135a..a9c6567fe70c 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -13,11 +13,13 @@
13#define HPFS_SUPER_MAGIC 0xf995e849 13#define HPFS_SUPER_MAGIC 0xf995e849
14#define ISOFS_SUPER_MAGIC 0x9660 14#define ISOFS_SUPER_MAGIC 0x9660
15#define JFFS2_SUPER_MAGIC 0x72b6 15#define JFFS2_SUPER_MAGIC 0x72b6
16#define KVMFS_SUPER_MAGIC 0x19700426
16 17
17#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 18#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
18#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ 19#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
19#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ 20#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
20#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ 21#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
22#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */
21 23
22#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ 24#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
23#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ 25#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 432b2fa24929..bdc01127dced 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -18,6 +18,16 @@
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19#include <linux/spinlock.h> /* spinlock_t */ 19#include <linux/spinlock.h> /* spinlock_t */
20extern spinlock_t rtc_lock; /* serialize CMOS RAM access */ 20extern spinlock_t rtc_lock; /* serialize CMOS RAM access */
21
22/* Some RTCs extend the mc146818 register set to support alarms of more
23 * than 24 hours in the future; or dates that include a century code.
24 * This platform_data structure can pass this information to the driver.
25 */
26struct cmos_rtc_board_info {
27 u8 rtc_day_alarm; /* zero, or register index */
28 u8 rtc_mon_alarm; /* zero, or register index */
29 u8 rtc_century; /* zero, or register index */
30};
21#endif 31#endif
22 32
23/********************************************************************** 33/**********************************************************************
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 48148e0cdbd1..75e55dcdeb18 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -5,6 +5,14 @@
5 5
6typedef struct page *new_page_t(struct page *, unsigned long private, int **); 6typedef struct page *new_page_t(struct page *, unsigned long private, int **);
7 7
8/* Check if a vma is migratable */
9static inline int vma_migratable(struct vm_area_struct *vma)
10{
11 if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED))
12 return 0;
13 return 1;
14}
15
8#ifdef CONFIG_MIGRATION 16#ifdef CONFIG_MIGRATION
9extern int isolate_lru_page(struct page *p, struct list_head *pagelist); 17extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
10extern int putback_lru_pages(struct list_head *l); 18extern int putback_lru_pages(struct list_head *l);
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h
index 916e8f72c63d..0e39745f5111 100644
--- a/include/linux/minix_fs.h
+++ b/include/linux/minix_fs.h
@@ -25,7 +25,6 @@
25#define MINIX_ERROR_FS 0x0002 /* fs has errors. */ 25#define MINIX_ERROR_FS 0x0002 /* fs has errors. */
26 26
27#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode))) 27#define MINIX_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix_inode)))
28#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
29 28
30/* 29/*
31 * This is the original minix inode layout on disk. 30 * This is the original minix inode layout on disk.
@@ -75,9 +74,32 @@ struct minix_super_block {
75 __u32 s_zones; 74 __u32 s_zones;
76}; 75};
77 76
77/*
78 * V3 minix super-block data on disk
79 */
80struct minix3_super_block {
81 __u32 s_ninodes;
82 __u16 s_pad0;
83 __u16 s_imap_blocks;
84 __u16 s_zmap_blocks;
85 __u16 s_firstdatazone;
86 __u16 s_log_zone_size;
87 __u16 s_pad1;
88 __u32 s_max_size;
89 __u32 s_zones;
90 __u16 s_magic;
91 __u16 s_pad2;
92 __u16 s_blocksize;
93 __u8 s_disk_version;
94};
95
78struct minix_dir_entry { 96struct minix_dir_entry {
79 __u16 inode; 97 __u16 inode;
80 char name[0]; 98 char name[0];
81}; 99};
82 100
101struct minix3_dir_entry {
102 __u32 inode;
103 char name[0];
104};
83#endif 105#endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2d2c08d5f473..60e0e4a592d2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -437,15 +437,15 @@ static inline compound_page_dtor *get_compound_page_dtor(struct page *page)
437/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */ 437/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allcator */
438#ifdef NODE_NOT_IN_PAGEFLAGS 438#ifdef NODE_NOT_IN_PAGEFLAGS
439#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT) 439#define ZONEID_SHIFT (SECTIONS_SHIFT + ZONES_SHIFT)
440#define ZONEID_PGOFF ((SECTIONS_PGOFF < ZONES_PGOFF)? \
441 SECTIONS_PGOFF : ZONES_PGOFF)
440#else 442#else
441#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT) 443#define ZONEID_SHIFT (NODES_SHIFT + ZONES_SHIFT)
444#define ZONEID_PGOFF ((NODES_PGOFF < ZONES_PGOFF)? \
445 NODES_PGOFF : ZONES_PGOFF)
442#endif 446#endif
443 447
444#if ZONES_WIDTH > 0 448#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
445#define ZONEID_PGSHIFT ZONES_PGSHIFT
446#else
447#define ZONEID_PGSHIFT NODES_PGOFF
448#endif
449 449
450#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 450#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
451#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 451#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED
@@ -471,7 +471,6 @@ static inline enum zone_type page_zonenum(struct page *page)
471 */ 471 */
472static inline int page_zone_id(struct page *page) 472static inline int page_zone_id(struct page *page)
473{ 473{
474 BUILD_BUG_ON(ZONEID_PGSHIFT == 0 && ZONEID_MASK);
475 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; 474 return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK;
476} 475}
477 476
@@ -638,6 +637,7 @@ static inline int page_mapped(struct page *page)
638 */ 637 */
639#define NOPFN_SIGBUS ((unsigned long) -1) 638#define NOPFN_SIGBUS ((unsigned long) -1)
640#define NOPFN_OOM ((unsigned long) -2) 639#define NOPFN_OOM ((unsigned long) -2)
640#define NOPFN_REFAULT ((unsigned long) -3)
641 641
642/* 642/*
643 * Different kinds of faults, as returned by handle_mm_fault(). 643 * Different kinds of faults, as returned by handle_mm_fault().
@@ -660,15 +660,11 @@ static inline int page_mapped(struct page *page)
660extern void show_free_areas(void); 660extern void show_free_areas(void);
661 661
662#ifdef CONFIG_SHMEM 662#ifdef CONFIG_SHMEM
663struct page *shmem_nopage(struct vm_area_struct *vma,
664 unsigned long address, int *type);
665int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new); 663int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new);
666struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, 664struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
667 unsigned long addr); 665 unsigned long addr);
668int shmem_lock(struct file *file, int lock, struct user_struct *user); 666int shmem_lock(struct file *file, int lock, struct user_struct *user);
669#else 667#else
670#define shmem_nopage filemap_nopage
671
672static inline int shmem_lock(struct file *file, int lock, 668static inline int shmem_lock(struct file *file, int lock,
673 struct user_struct *user) 669 struct user_struct *user)
674{ 670{
@@ -688,7 +684,6 @@ static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
688} 684}
689#endif 685#endif
690struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 686struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
691extern int shmem_mmap(struct file *file, struct vm_area_struct *vma);
692 687
693int shmem_zero_setup(struct vm_area_struct *); 688int shmem_zero_setup(struct vm_area_struct *);
694 689
@@ -786,6 +781,7 @@ extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
786extern void do_invalidatepage(struct page *page, unsigned long offset); 781extern void do_invalidatepage(struct page *page, unsigned long offset);
787 782
788int __set_page_dirty_nobuffers(struct page *page); 783int __set_page_dirty_nobuffers(struct page *page);
784int __set_page_dirty_no_writeback(struct page *page);
789int redirty_page_for_writepage(struct writeback_control *wbc, 785int redirty_page_for_writepage(struct writeback_control *wbc,
790 struct page *page); 786 struct page *page);
791int FASTCALL(set_page_dirty(struct page *page)); 787int FASTCALL(set_page_dirty(struct page *page));
@@ -1030,6 +1026,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1030 unsigned long addr, unsigned long len, pgoff_t pgoff); 1026 unsigned long addr, unsigned long len, pgoff_t pgoff);
1031extern void exit_mmap(struct mm_struct *); 1027extern void exit_mmap(struct mm_struct *);
1032extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1028extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1029extern int install_special_mapping(struct mm_struct *mm,
1030 unsigned long addr, unsigned long len,
1031 unsigned long flags, struct page **pages);
1033 1032
1034extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1033extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1035 1034
@@ -1121,6 +1120,8 @@ unsigned long vmalloc_to_pfn(void *addr);
1121int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 1120int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1122 unsigned long pfn, unsigned long size, pgprot_t); 1121 unsigned long pfn, unsigned long size, pgprot_t);
1123int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 1122int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
1123int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1124 unsigned long pfn);
1124 1125
1125struct page *follow_page(struct vm_area_struct *, unsigned long address, 1126struct page *follow_page(struct vm_area_struct *, unsigned long address,
1126 unsigned int foll_flags); 1127 unsigned int foll_flags);
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 3b6723dfaff3..895bc4e93039 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -1,30 +1,29 @@
1
2static inline void 1static inline void
3add_page_to_active_list(struct zone *zone, struct page *page) 2add_page_to_active_list(struct zone *zone, struct page *page)
4{ 3{
5 list_add(&page->lru, &zone->active_list); 4 list_add(&page->lru, &zone->active_list);
6 zone->nr_active++; 5 __inc_zone_state(zone, NR_ACTIVE);
7} 6}
8 7
9static inline void 8static inline void
10add_page_to_inactive_list(struct zone *zone, struct page *page) 9add_page_to_inactive_list(struct zone *zone, struct page *page)
11{ 10{
12 list_add(&page->lru, &zone->inactive_list); 11 list_add(&page->lru, &zone->inactive_list);
13 zone->nr_inactive++; 12 __inc_zone_state(zone, NR_INACTIVE);
14} 13}
15 14
16static inline void 15static inline void
17del_page_from_active_list(struct zone *zone, struct page *page) 16del_page_from_active_list(struct zone *zone, struct page *page)
18{ 17{
19 list_del(&page->lru); 18 list_del(&page->lru);
20 zone->nr_active--; 19 __dec_zone_state(zone, NR_ACTIVE);
21} 20}
22 21
23static inline void 22static inline void
24del_page_from_inactive_list(struct zone *zone, struct page *page) 23del_page_from_inactive_list(struct zone *zone, struct page *page)
25{ 24{
26 list_del(&page->lru); 25 list_del(&page->lru);
27 zone->nr_inactive--; 26 __dec_zone_state(zone, NR_INACTIVE);
28} 27}
29 28
30static inline void 29static inline void
@@ -33,9 +32,9 @@ del_page_from_lru(struct zone *zone, struct page *page)
33 list_del(&page->lru); 32 list_del(&page->lru);
34 if (PageActive(page)) { 33 if (PageActive(page)) {
35 __ClearPageActive(page); 34 __ClearPageActive(page);
36 zone->nr_active--; 35 __dec_zone_state(zone, NR_ACTIVE);
37 } else { 36 } else {
38 zone->nr_inactive--; 37 __dec_zone_state(zone, NR_INACTIVE);
39 } 38 }
40} 39}
41 40
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d0e6a5497614..e45712acfac5 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -71,6 +71,7 @@ struct mmc_card {
71#define MMC_STATE_SDCARD (1<<3) /* is an SD card */ 71#define MMC_STATE_SDCARD (1<<3) /* is an SD card */
72#define MMC_STATE_READONLY (1<<4) /* card is read-only */ 72#define MMC_STATE_READONLY (1<<4) /* card is read-only */
73#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */ 73#define MMC_STATE_HIGHSPEED (1<<5) /* card is in high speed mode */
74#define MMC_STATE_BLOCKADDR (1<<6) /* card uses block-addressing */
74 u32 raw_cid[4]; /* raw card CID */ 75 u32 raw_cid[4]; /* raw card CID */
75 u32 raw_csd[4]; /* raw card CSD */ 76 u32 raw_csd[4]; /* raw card CSD */
76 u32 raw_scr[2]; /* raw card SCR */ 77 u32 raw_scr[2]; /* raw card SCR */
@@ -87,6 +88,7 @@ struct mmc_card {
87#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) 88#define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
88#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 89#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
89#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 90#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
91#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
90 92
91#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 93#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
92#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) 94#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
@@ -94,6 +96,7 @@ struct mmc_card {
94#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) 96#define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
95#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 97#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
96#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 98#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
99#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
97 100
98#define mmc_card_name(c) ((c)->cid.prod_name) 101#define mmc_card_name(c) ((c)->cid.prod_name)
99#define mmc_card_id(c) ((c)->dev.bus_id) 102#define mmc_card_id(c) ((c)->dev.bus_id)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index c15ae1986b98..bfcef8a1ad8b 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -62,6 +62,12 @@ struct mmc_ios {
62 62
63#define MMC_BUS_WIDTH_1 0 63#define MMC_BUS_WIDTH_1 0
64#define MMC_BUS_WIDTH_4 2 64#define MMC_BUS_WIDTH_4 2
65
66 unsigned char timing; /* timing specification used */
67
68#define MMC_TIMING_LEGACY 0
69#define MMC_TIMING_MMC_HS 1
70#define MMC_TIMING_SD_HS 2
65}; 71};
66 72
67struct mmc_host_ops { 73struct mmc_host_ops {
@@ -87,13 +93,17 @@ struct mmc_host {
87#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ 93#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 */ 94#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 */ 95#define MMC_CAP_BYTEBLOCK (1 << 2) /* Can do non-log2 block sizes */
96#define MMC_CAP_MMC_HIGHSPEED (1 << 3) /* Can do MMC high-speed timing */
97#define MMC_CAP_SD_HIGHSPEED (1 << 4) /* Can do SD high-speed timing */
90 98
91 /* host specific block data */ 99 /* host specific block data */
92 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 100 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
93 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ 101 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
94 unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */ 102 unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
95 unsigned short max_sectors; /* see blk_queue_max_sectors */
96 unsigned short unused; 103 unsigned short unused;
104 unsigned int max_req_size; /* maximum number of bytes in one req */
105 unsigned int max_blk_size; /* maximum size of one mmc block */
106 unsigned int max_blk_count; /* maximum number of blocks in one req */
97 107
98 /* private data */ 108 /* private data */
99 struct mmc_ios ios; /* current io bus settings */ 109 struct mmc_ios ios; /* current io bus settings */
@@ -106,8 +116,9 @@ struct mmc_host {
106 struct list_head cards; /* devices attached to this host */ 116 struct list_head cards; /* devices attached to this host */
107 117
108 wait_queue_head_t wq; 118 wait_queue_head_t wq;
109 spinlock_t lock; /* card_busy lock */ 119 spinlock_t lock; /* claimed lock */
110 struct mmc_card *card_busy; /* the MMC card claiming host */ 120 unsigned int claimed:1; /* host exclusively claimed */
121
111 struct mmc_card *card_selected; /* the selected MMC card */ 122 struct mmc_card *card_selected; /* the selected MMC card */
112 123
113 struct delayed_work detect; 124 struct delayed_work detect;
@@ -126,6 +137,7 @@ static inline void *mmc_priv(struct mmc_host *host)
126} 137}
127 138
128#define mmc_dev(x) ((x)->parent) 139#define mmc_dev(x) ((x)->parent)
140#define mmc_classdev(x) (&(x)->class_dev)
129#define mmc_hostname(x) ((x)->class_dev.bus_id) 141#define mmc_hostname(x) ((x)->class_dev.bus_id)
130 142
131extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 143extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index bcf24909d677..cdc54be804f1 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -43,6 +43,7 @@ struct mmc_command {
43#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC) 43#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
44#define MMC_RSP_R3 (MMC_RSP_PRESENT) 44#define MMC_RSP_R3 (MMC_RSP_PRESENT)
45#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) 45#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
46#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
46 47
47#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE)) 48#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
48 49
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index 2dce60c43f4b..c90b6768329d 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -79,9 +79,12 @@
79#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */ 79#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1 */
80 80
81/* SD commands type argument response */ 81/* SD commands type argument response */
82 /* class 8 */ 82 /* class 0 */
83/* This is basically the same command as for MMC with some quirks. */ 83/* This is basically the same command as for MMC with some quirks. */
84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */ 84#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
85#define SD_SEND_IF_COND 8 /* bcr [11:0] See below R7 */
86
87 /* class 10 */
85#define SD_SWITCH 6 /* adtc [31:0] See below R1 */ 88#define SD_SWITCH 6 /* adtc [31:0] See below R1 */
86 89
87 /* Application commands */ 90 /* Application commands */
@@ -115,6 +118,14 @@
115 */ 118 */
116 119
117/* 120/*
121 * SD_SEND_IF_COND argument format:
122 *
123 * [31:12] Reserved (0)
124 * [11:8] Host Voltage Supply Flags
125 * [7:0] Check Pattern (0xAA)
126 */
127
128/*
118 MMC status in R1 129 MMC status in R1
119 Type 130 Type
120 e : error bit 131 e : error bit
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index b262f47961fb..ee9e3143df4f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -47,15 +47,20 @@ struct zone_padding {
47#endif 47#endif
48 48
49enum zone_stat_item { 49enum zone_stat_item {
50 /* First 128 byte cacheline (assuming 64 bit words) */
51 NR_FREE_PAGES,
52 NR_INACTIVE,
53 NR_ACTIVE,
50 NR_ANON_PAGES, /* Mapped anonymous pages */ 54 NR_ANON_PAGES, /* Mapped anonymous pages */
51 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 55 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
52 only modified from process context */ 56 only modified from process context */
53 NR_FILE_PAGES, 57 NR_FILE_PAGES,
54 NR_SLAB_RECLAIMABLE,
55 NR_SLAB_UNRECLAIMABLE,
56 NR_PAGETABLE, /* used for pagetables */
57 NR_FILE_DIRTY, 58 NR_FILE_DIRTY,
58 NR_WRITEBACK, 59 NR_WRITEBACK,
60 /* Second 128 byte cacheline */
61 NR_SLAB_RECLAIMABLE,
62 NR_SLAB_UNRECLAIMABLE,
63 NR_PAGETABLE, /* used for pagetables */
59 NR_UNSTABLE_NFS, /* NFS unstable pages */ 64 NR_UNSTABLE_NFS, /* NFS unstable pages */
60 NR_BOUNCE, 65 NR_BOUNCE,
61 NR_VMSCAN_WRITE, 66 NR_VMSCAN_WRITE,
@@ -91,6 +96,7 @@ struct per_cpu_pageset {
91#endif 96#endif
92 97
93enum zone_type { 98enum zone_type {
99#ifdef CONFIG_ZONE_DMA
94 /* 100 /*
95 * ZONE_DMA is used when there are devices that are not able 101 * ZONE_DMA is used when there are devices that are not able
96 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we 102 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
@@ -111,6 +117,7 @@ enum zone_type {
111 * <16M. 117 * <16M.
112 */ 118 */
113 ZONE_DMA, 119 ZONE_DMA,
120#endif
114#ifdef CONFIG_ZONE_DMA32 121#ifdef CONFIG_ZONE_DMA32
115 /* 122 /*
116 * x86_64 needs two ZONE_DMAs because it supports devices that are 123 * x86_64 needs two ZONE_DMAs because it supports devices that are
@@ -147,15 +154,30 @@ enum zone_type {
147 * match the requested limits. See gfp_zone() in include/linux/gfp.h 154 * match the requested limits. See gfp_zone() in include/linux/gfp.h
148 */ 155 */
149 156
150#if !defined(CONFIG_ZONE_DMA32) && !defined(CONFIG_HIGHMEM) 157/*
158 * Count the active zones. Note that the use of defined(X) outside
159 * #if and family is not necessarily defined so ensure we cannot use
160 * it later. Use __ZONE_COUNT to work out how many shift bits we need.
161 */
162#define __ZONE_COUNT ( \
163 defined(CONFIG_ZONE_DMA) \
164 + defined(CONFIG_ZONE_DMA32) \
165 + 1 \
166 + defined(CONFIG_HIGHMEM) \
167)
168#if __ZONE_COUNT < 2
169#define ZONES_SHIFT 0
170#elif __ZONE_COUNT <= 2
151#define ZONES_SHIFT 1 171#define ZONES_SHIFT 1
152#else 172#elif __ZONE_COUNT <= 4
153#define ZONES_SHIFT 2 173#define ZONES_SHIFT 2
174#else
175#error ZONES_SHIFT -- too many zones configured adjust calculation
154#endif 176#endif
177#undef __ZONE_COUNT
155 178
156struct zone { 179struct zone {
157 /* Fields commonly accessed by the page allocator */ 180 /* Fields commonly accessed by the page allocator */
158 unsigned long free_pages;
159 unsigned long pages_min, pages_low, pages_high; 181 unsigned long pages_min, pages_low, pages_high;
160 /* 182 /*
161 * We don't know if the memory that we're going to allocate will be freeable 183 * We don't know if the memory that we're going to allocate will be freeable
@@ -197,8 +219,6 @@ struct zone {
197 struct list_head inactive_list; 219 struct list_head inactive_list;
198 unsigned long nr_scan_active; 220 unsigned long nr_scan_active;
199 unsigned long nr_scan_inactive; 221 unsigned long nr_scan_inactive;
200 unsigned long nr_active;
201 unsigned long nr_inactive;
202 unsigned long pages_scanned; /* since last reclaim */ 222 unsigned long pages_scanned; /* since last reclaim */
203 int all_unreclaimable; /* All pages pinned */ 223 int all_unreclaimable; /* All pages pinned */
204 224
@@ -442,8 +462,6 @@ typedef struct pglist_data {
442 462
443#include <linux/memory_hotplug.h> 463#include <linux/memory_hotplug.h>
444 464
445void __get_zone_counts(unsigned long *active, unsigned long *inactive,
446 unsigned long *free, struct pglist_data *pgdat);
447void get_zone_counts(unsigned long *active, unsigned long *inactive, 465void get_zone_counts(unsigned long *active, unsigned long *inactive,
448 unsigned long *free); 466 unsigned long *free);
449void build_all_zonelists(void); 467void build_all_zonelists(void);
@@ -523,7 +541,11 @@ static inline int is_dma32(struct zone *zone)
523 541
524static inline int is_dma(struct zone *zone) 542static inline int is_dma(struct zone *zone)
525{ 543{
544#ifdef CONFIG_ZONE_DMA
526 return zone == zone->zone_pgdat->node_zones + ZONE_DMA; 545 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
546#else
547 return 0;
548#endif
527} 549}
528 550
529/* These two functions are used to setup the per zone pages min values */ 551/* These two functions are used to setup the per zone pages min values */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index e0c393cc7240..e96b2dee10bb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -320,4 +320,16 @@ struct eisa_device_id {
320 320
321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s" 321#define EISA_DEVICE_MODALIAS_FMT "eisa:s%s"
322 322
323struct parisc_device_id {
324 __u8 hw_type; /* 5 bits used */
325 __u8 hversion_rev; /* 4 bits */
326 __u16 hversion; /* 12 bits */
327 __u32 sversion; /* 20 bits */
328};
329
330#define PA_HWTYPE_ANY_ID 0xff
331#define PA_HVERSION_REV_ANY_ID 0xff
332#define PA_HVERSION_ANY_ID 0xffff
333#define PA_SVERSION_ANY_ID 0xffffffff
334
323#endif /* LINUX_MOD_DEVICETABLE_H */ 335#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 10f771a49997..95679eb8571e 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -58,6 +58,7 @@ struct module_kobject
58{ 58{
59 struct kobject kobj; 59 struct kobject kobj;
60 struct module *mod; 60 struct module *mod;
61 struct kobject *drivers_dir;
61}; 62};
62 63
63/* These are either module local, or the kernel's dummy ones. */ 64/* These are either module local, or the kernel's dummy ones. */
@@ -75,8 +76,6 @@ void sort_extable(struct exception_table_entry *start,
75 struct exception_table_entry *finish); 76 struct exception_table_entry *finish);
76void sort_main_extable(void); 77void sort_main_extable(void);
77 78
78extern struct subsystem module_subsys;
79
80#ifdef MODULE 79#ifdef MODULE
81#define MODULE_GENERIC_TABLE(gtype,name) \ 80#define MODULE_GENERIC_TABLE(gtype,name) \
82extern const struct gtype##_id __mod_##gtype##_table \ 81extern const struct gtype##_id __mod_##gtype##_table \
@@ -263,7 +262,7 @@ struct module
263 struct module_attribute *modinfo_attrs; 262 struct module_attribute *modinfo_attrs;
264 const char *version; 263 const char *version;
265 const char *srcversion; 264 const char *srcversion;
266 struct kobject *drivers_dir; 265 struct kobject *holders_dir;
267 266
268 /* Exported symbols */ 267 /* Exported symbols */
269 const struct kernel_symbol *syms; 268 const struct kernel_symbol *syms;
@@ -466,10 +465,6 @@ int unregister_module_notifier(struct notifier_block * nb);
466 465
467extern void print_modules(void); 466extern void print_modules(void);
468 467
469struct device_driver;
470void module_add_driver(struct module *, struct device_driver *);
471void module_remove_driver(struct device_driver *);
472
473#else /* !CONFIG_MODULES... */ 468#else /* !CONFIG_MODULES... */
474#define EXPORT_SYMBOL(sym) 469#define EXPORT_SYMBOL(sym)
475#define EXPORT_SYMBOL_GPL(sym) 470#define EXPORT_SYMBOL_GPL(sym)
@@ -567,18 +562,59 @@ static inline void print_modules(void)
567{ 562{
568} 563}
569 564
565#endif /* CONFIG_MODULES */
566
570struct device_driver; 567struct device_driver;
568#ifdef CONFIG_SYSFS
571struct module; 569struct module;
572 570
573static inline void module_add_driver(struct module *module, struct device_driver *driver) 571extern struct subsystem module_subsys;
572
573int mod_sysfs_init(struct module *mod);
574int mod_sysfs_setup(struct module *mod,
575 struct kernel_param *kparam,
576 unsigned int num_params);
577int module_add_modinfo_attrs(struct module *mod);
578void module_remove_modinfo_attrs(struct module *mod);
579
580#else /* !CONFIG_SYSFS */
581
582static inline int mod_sysfs_init(struct module *mod)
574{ 583{
584 return 0;
575} 585}
576 586
577static inline void module_remove_driver(struct device_driver *driver) 587static inline int mod_sysfs_setup(struct module *mod,
588 struct kernel_param *kparam,
589 unsigned int num_params)
578{ 590{
591 return 0;
579} 592}
580 593
581#endif /* CONFIG_MODULES */ 594static inline int module_add_modinfo_attrs(struct module *mod)
595{
596 return 0;
597}
598
599static inline void module_remove_modinfo_attrs(struct module *mod)
600{ }
601
602#endif /* CONFIG_SYSFS */
603
604#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
605
606void module_add_driver(struct module *mod, struct device_driver *drv);
607void module_remove_driver(struct device_driver *drv);
608
609#else /* not both CONFIG_SYSFS && CONFIG_MODULES */
610
611static inline void module_add_driver(struct module *mod, struct device_driver *drv)
612{ }
613
614static inline void module_remove_driver(struct device_driver *drv)
615{ }
616
617#endif
582 618
583#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 619#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
584 620
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 4a189dadb160..c83588c8d08b 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -59,7 +59,7 @@ struct kparam_array
59}; 59};
60 60
61/* This is the fundamental function for registering boot/module 61/* This is the fundamental function for registering boot/module
62 parameters. perm sets the visibility in driverfs: 000 means it's 62 parameters. perm sets the visibility in sysfs: 000 means it's
63 not there, read bits mean it's readable, write bits mean it's 63 not there, read bits mean it's readable, write bits mean it's
64 writable. */ 64 writable. */
65#define __module_param_call(prefix, name, set, get, arg, perm) \ 65#define __module_param_call(prefix, name, set, get, arg, perm) \
@@ -169,10 +169,22 @@ extern int param_get_string(char *buffer, struct kernel_param *kp);
169 169
170struct module; 170struct module;
171 171
172#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
172extern int module_param_sysfs_setup(struct module *mod, 173extern int module_param_sysfs_setup(struct module *mod,
173 struct kernel_param *kparam, 174 struct kernel_param *kparam,
174 unsigned int num_params); 175 unsigned int num_params);
175 176
176extern void module_param_sysfs_remove(struct module *mod); 177extern void module_param_sysfs_remove(struct module *mod);
178#else
179static inline int module_param_sysfs_setup(struct module *mod,
180 struct kernel_param *kparam,
181 unsigned int num_params)
182{
183 return 0;
184}
185
186static inline void module_param_sysfs_remove(struct module *mod)
187{ }
188#endif
177 189
178#endif /* _LINUX_MODULE_PARAMS_H */ 190#endif /* _LINUX_MODULE_PARAMS_H */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 1b7e178b0d84..dab69afee2fa 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -43,9 +43,8 @@ struct vfsmount {
43 struct super_block *mnt_sb; /* pointer to superblock */ 43 struct super_block *mnt_sb; /* pointer to superblock */
44 struct list_head mnt_mounts; /* list of children, anchored here */ 44 struct list_head mnt_mounts; /* list of children, anchored here */
45 struct list_head mnt_child; /* and going through their mnt_child */ 45 struct list_head mnt_child; /* and going through their mnt_child */
46 atomic_t mnt_count;
47 int mnt_flags; 46 int mnt_flags;
48 int mnt_expiry_mark; /* true if marked for expiry */ 47 /* 4 bytes hole on 64bits arches */
49 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 48 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
50 struct list_head mnt_list; 49 struct list_head mnt_list;
51 struct list_head mnt_expire; /* link in fs-specific expiry list */ 50 struct list_head mnt_expire; /* link in fs-specific expiry list */
@@ -54,6 +53,13 @@ struct vfsmount {
54 struct list_head mnt_slave; /* slave list entry */ 53 struct list_head mnt_slave; /* slave list entry */
55 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */ 54 struct vfsmount *mnt_master; /* slave is on master->mnt_slave_list */
56 struct mnt_namespace *mnt_ns; /* containing namespace */ 55 struct mnt_namespace *mnt_ns; /* containing namespace */
56 /*
57 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
58 * to let these frequently modified fields in a separate cache line
59 * (so that reads of mnt_flags wont ping-pong on SMP machines)
60 */
61 atomic_t mnt_count;
62 int mnt_expiry_mark; /* true if marked for expiry */
57 int mnt_pinned; 63 int mnt_pinned;
58}; 64};
59 65
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 24a9ef1506b6..fa253fa73aa3 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -234,7 +234,7 @@ struct msdos_sb_info {
234 struct fat_mount_options options; 234 struct fat_mount_options options;
235 struct nls_table *nls_disk; /* Codepage used on disk */ 235 struct nls_table *nls_disk; /* Codepage used on disk */
236 struct nls_table *nls_io; /* Charset used for input and display */ 236 struct nls_table *nls_io; /* Charset used for input and display */
237 void *dir_ops; /* Opaque; default directory operations */ 237 const void *dir_ops; /* Opaque; default directory operations */
238 int dir_per_block; /* dir entries per block */ 238 int dir_per_block; /* dir entries per block */
239 int dir_per_block_bits; /* log2(dir_per_block) */ 239 int dir_per_block_bits; /* log2(dir_per_block) */
240 240
@@ -399,7 +399,7 @@ extern int fat_count_free_clusters(struct super_block *sb);
399extern int fat_generic_ioctl(struct inode *inode, struct file *filp, 399extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
400 unsigned int cmd, unsigned long arg); 400 unsigned int cmd, unsigned long arg);
401extern const struct file_operations fat_file_operations; 401extern const struct file_operations fat_file_operations;
402extern struct inode_operations fat_file_inode_operations; 402extern const struct inode_operations fat_file_inode_operations;
403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 403extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
404extern void fat_truncate(struct inode *inode); 404extern void fat_truncate(struct inode *inode);
405extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, 405extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
@@ -413,7 +413,7 @@ extern struct inode *fat_build_inode(struct super_block *sb,
413 struct msdos_dir_entry *de, loff_t i_pos); 413 struct msdos_dir_entry *de, loff_t i_pos);
414extern int fat_sync_inode(struct inode *inode); 414extern int fat_sync_inode(struct inode *inode);
415extern int fat_fill_super(struct super_block *sb, void *data, int silent, 415extern int fat_fill_super(struct super_block *sb, void *data, int silent,
416 struct inode_operations *fs_dir_inode_ops, int isvfat); 416 const struct inode_operations *fs_dir_inode_ops, int isvfat);
417 417
418extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, 418extern int fat_flush_inodes(struct super_block *sb, struct inode *i1,
419 struct inode *i2); 419 struct inode *i2);
diff --git a/include/linux/msi.h b/include/linux/msi.h
index c7ef94343673..e38fe6822cb4 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -7,18 +7,17 @@ struct msi_msg {
7 u32 data; /* 16 bits of msi message data */ 7 u32 data; /* 16 bits of msi message data */
8}; 8};
9 9
10/* Heper functions */ 10/* Helper functions */
11extern void mask_msi_irq(unsigned int irq); 11extern void mask_msi_irq(unsigned int irq);
12extern void unmask_msi_irq(unsigned int irq); 12extern void unmask_msi_irq(unsigned int irq);
13extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 13extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
14
15extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); 14extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
16 15
17struct msi_desc { 16struct msi_desc {
18 struct { 17 struct {
19 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ 18 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */
20 __u8 maskbit : 1; /* mask-pending bit supported ? */ 19 __u8 maskbit : 1; /* mask-pending bit supported ? */
21 __u8 unused : 1; 20 __u8 masked : 1;
22 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 21 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
23 __u8 pos; /* Location of the msi capability */ 22 __u8 pos; /* Location of the msi capability */
24 __u16 entry_nr; /* specific enabled entry */ 23 __u16 entry_nr; /* specific enabled entry */
@@ -33,16 +32,14 @@ struct msi_desc {
33 void __iomem *mask_base; 32 void __iomem *mask_base;
34 struct pci_dev *dev; 33 struct pci_dev *dev;
35 34
36#ifdef CONFIG_PM 35 /* Last set MSI message */
37 /* PM save area for MSIX address/data */ 36 struct msi_msg msg;
38 struct msi_msg msg_save;
39#endif
40}; 37};
41 38
42/* 39/*
43 * The arch hook for setup up msi irqs 40 * The arch hook for setup up msi irqs
44 */ 41 */
45int arch_setup_msi_irq(unsigned int irq, struct pci_dev *dev); 42int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
46void arch_teardown_msi_irq(unsigned int irq); 43void arch_teardown_msi_irq(unsigned int irq);
47 44
48 45
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 1221b7c44158..fff8c53e5434 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -92,6 +92,13 @@ struct nand_bbt_descr {
92 */ 92 */
93#define ONENAND_BADBLOCK_POS 0 93#define ONENAND_BADBLOCK_POS 0
94 94
95/*
96 * Bad block scanning errors
97 */
98#define ONENAND_BBT_READ_ERROR 1
99#define ONENAND_BBT_READ_ECC_ERROR 2
100#define ONENAND_BBT_READ_FATAL_ERROR 4
101
95/** 102/**
96 * struct bbm_info - [GENERIC] Bad Block Table data structure 103 * struct bbm_info - [GENERIC] Bad Block Table data structure
97 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 104 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
diff --git a/include/linux/mtd/iflash.h b/include/linux/mtd/iflash.h
deleted file mode 100644
index 9aa5b4f02666..000000000000
--- a/include/linux/mtd/iflash.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* $Id: iflash.h,v 1.2 2000/11/13 18:01:54 dwmw2 Exp $ */
2
3#ifndef __MTD_IFLASH_H__
4#define __MTD_IFLASH_H__
5
6/* Extended CIS registers for Series 2 and 2+ cards */
7/* The registers are all offsets from 0x4000 */
8#define CISREG_CSR 0x0100
9#define CISREG_WP 0x0104
10#define CISREG_RDYBSY 0x0140
11
12/* Extended CIS registers for Series 2 cards */
13#define CISREG_SLEEP 0x0118
14#define CISREG_RDY_MASK 0x0120
15#define CISREG_RDY_STATUS 0x0130
16
17/* Extended CIS registers for Series 2+ cards */
18#define CISREG_VCR 0x010c
19
20/* Card Status Register */
21#define CSR_SRESET 0x20 /* Soft reset */
22#define CSR_CMWP 0x10 /* Common memory write protect */
23#define CSR_PWRDOWN 0x08 /* Power down status */
24#define CSR_CISWP 0x04 /* Common memory CIS WP */
25#define CSR_WP 0x02 /* Mechanical write protect */
26#define CSR_READY 0x01 /* Ready/busy status */
27
28/* Write Protection Register */
29#define WP_BLKEN 0x04 /* Enable block locking */
30#define WP_CMWP 0x02 /* Common memory write protect */
31#define WP_CISWP 0x01 /* Common memory CIS WP */
32
33/* Voltage Control Register */
34#define VCR_VCC_LEVEL 0x80 /* 0 = 5V, 1 = 3.3V */
35#define VCR_VPP_VALID 0x02 /* Vpp Valid */
36#define VCR_VPP_GEN 0x01 /* Integrated Vpp generator */
37
38/* Ready/Busy Mode Register */
39#define RDYBSY_RACK 0x02 /* Ready acknowledge */
40#define RDYBSY_MODE 0x01 /* 1 = high performance */
41
42#define LOW(x) ((x) & 0xff)
43
44/* 28F008SA-Compatible Command Set */
45#define IF_READ_ARRAY 0xffff
46#define IF_INTEL_ID 0x9090
47#define IF_READ_CSR 0x7070
48#define IF_CLEAR_CSR 0x5050
49#define IF_WRITE 0x4040
50#define IF_BLOCK_ERASE 0x2020
51#define IF_ERASE_SUSPEND 0xb0b0
52#define IF_CONFIRM 0xd0d0
53
54/* 28F016SA Performance Enhancement Commands */
55#define IF_READ_PAGE 0x7575
56#define IF_PAGE_SWAP 0x7272
57#define IF_SINGLE_LOAD 0x7474
58#define IF_SEQ_LOAD 0xe0e0
59#define IF_PAGE_WRITE 0x0c0c
60#define IF_RDY_MODE 0x9696
61#define IF_RDY_LEVEL 0x0101
62#define IF_RDY_PULSE_WRITE 0x0202
63#define IF_RDY_PULSE_ERASE 0x0303
64#define IF_RDY_DISABLE 0x0404
65#define IF_LOCK_BLOCK 0x7777
66#define IF_UPLOAD_STATUS 0x9797
67#define IF_READ_ESR 0x7171
68#define IF_ERASE_UNLOCKED 0xa7a7
69#define IF_SLEEP 0xf0f0
70#define IF_ABORT 0x8080
71#define IF_UPLOAD_DEVINFO 0x9999
72
73/* Definitions for Compatible Status Register */
74#define CSR_WR_READY 0x8080 /* Write state machine status */
75#define CSR_ERA_SUSPEND 0x4040 /* Erase suspend status */
76#define CSR_ERA_ERR 0x2020 /* Erase status */
77#define CSR_WR_ERR 0x1010 /* Data write status */
78#define CSR_VPP_LOW 0x0808 /* Vpp status */
79
80/* Definitions for Global Status Register */
81#define GSR_WR_READY 0x8080 /* Write state machine status */
82#define GSR_OP_SUSPEND 0x4040 /* Operation suspend status */
83#define GSR_OP_ERR 0x2020 /* Device operation status */
84#define GSR_SLEEP 0x1010 /* Device sleep status */
85#define GSR_QUEUE_FULL 0x0808 /* Queue status */
86#define GSR_PAGE_AVAIL 0x0404 /* Page buffer available status */
87#define GSR_PAGE_READY 0x0202 /* Page buffer status */
88#define GSR_PAGE_SELECT 0x0101 /* Page buffer select status */
89
90/* Definitions for Block Status Register */
91#define BSR_READY 0x8080 /* Block status */
92#define BSR_UNLOCK 0x4040 /* Block lock status */
93#define BSR_FAILED 0x2020 /* Block operation status */
94#define BSR_ABORTED 0x1010 /* Operation abort status */
95#define BSR_QUEUE_FULL 0x0808 /* Queue status */
96#define BSR_VPP_LOW 0x0404 /* Vpp status */
97
98#endif /* __MTD_IFLASH_H__ */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 28d461d862bd..81f3a314dd76 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -183,7 +183,7 @@ typedef union {
183struct map_info { 183struct map_info {
184 char *name; 184 char *name;
185 unsigned long size; 185 unsigned long size;
186 unsigned long phys; 186 resource_size_t phys;
187#define NO_XIP (-1UL) 187#define NO_XIP (-1UL)
188 188
189 void __iomem *virt; 189 void __iomem *virt;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index d644e57703ad..45d482ce8397 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -53,6 +53,7 @@ struct mtd_erase_region_info {
53 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ 53 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */
54 u_int32_t erasesize; /* For this region */ 54 u_int32_t erasesize; /* For this region */
55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 55 u_int32_t numblocks; /* Number of blocks of erasesize in this region */
56 unsigned long *lockmap; /* If keeping bitmap of locks */
56}; 57};
57 58
58/* 59/*
@@ -85,6 +86,10 @@ typedef enum {
85 * mode = MTD_OOB_PLACE) 86 * mode = MTD_OOB_PLACE)
86 * @datbuf: data buffer - if NULL only oob data are read/written 87 * @datbuf: data buffer - if NULL only oob data are read/written
87 * @oobbuf: oob data buffer 88 * @oobbuf: oob data buffer
89 *
90 * Note, it is allowed to read more then one OOB area at one go, but not write.
91 * The interface assumes that the OOB write requests program only one page's
92 * OOB area.
88 */ 93 */
89struct mtd_oob_ops { 94struct mtd_oob_ops {
90 mtd_oob_mode_t mode; 95 mtd_oob_mode_t mode;
@@ -117,18 +122,7 @@ struct mtd_info {
117 u_int32_t writesize; 122 u_int32_t writesize;
118 123
119 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 124 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
120 u_int32_t ecctype; 125 u_int32_t oobavail; // Available OOB bytes per block
121 u_int32_t eccsize;
122
123 /*
124 * Reuse some of the above unused fields in the case of NOR flash
125 * with configurable programming regions to avoid modifying the
126 * user visible structure layout/size. Only valid when the
127 * MTD_PROGRAM_REGIONS flag is set.
128 * (Maybe we should have an union for those?)
129 */
130#define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize
131#define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype
132 126
133 // Kernel-only stuff starts here. 127 // Kernel-only stuff starts here.
134 char *name; 128 char *name;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2071b02f0526..cf197ad62da6 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -343,6 +343,7 @@ struct nand_buffers {
343 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 343 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
344 * special functionality. See the defines for further explanation 344 * special functionality. See the defines for further explanation
345 * @badblockpos: [INTERN] position of the bad block marker in the oob area 345 * @badblockpos: [INTERN] position of the bad block marker in the oob area
346 * @cellinfo: [INTERN] MLC/multichip data from chip ident
346 * @numchips: [INTERN] number of physical chips 347 * @numchips: [INTERN] number of physical chips
347 * @chipsize: [INTERN] the size of one chip for multichip arrays 348 * @chipsize: [INTERN] the size of one chip for multichip arrays
348 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 349 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -430,6 +431,7 @@ struct nand_chip {
430#define NAND_MFR_RENESAS 0x07 431#define NAND_MFR_RENESAS 0x07
431#define NAND_MFR_STMICRO 0x20 432#define NAND_MFR_STMICRO 0x20
432#define NAND_MFR_HYNIX 0xad 433#define NAND_MFR_HYNIX 0xad
434#define NAND_MFR_MICRON 0x2c
433 435
434/** 436/**
435 * struct nand_flash_dev - NAND Flash Device ID Structure 437 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index f775a7af3890..a56d24ada505 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/include/linux/mtd/onenand.h 2 * linux/include/linux/mtd/onenand.h
3 * 3 *
4 * Copyright (C) 2005-2006 Samsung Electronics 4 * Copyright (C) 2005-2007 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -42,14 +42,10 @@ typedef enum {
42 42
43/** 43/**
44 * struct onenand_bufferram - OneNAND BufferRAM Data 44 * struct onenand_bufferram - OneNAND BufferRAM Data
45 * @block: block address in BufferRAM 45 * @blockpage: block & page address in BufferRAM
46 * @page: page address in BufferRAM
47 * @valid: valid flag
48 */ 46 */
49struct onenand_bufferram { 47struct onenand_bufferram {
50 int block; 48 int blockpage;
51 int page;
52 int valid;
53}; 49};
54 50
55/** 51/**
@@ -63,7 +59,6 @@ struct onenand_bufferram {
63 * partly be set to inform onenand_scan about 59 * partly be set to inform onenand_scan about
64 * @erase_shift: [INTERN] number of address bits in a block 60 * @erase_shift: [INTERN] number of address bits in a block
65 * @page_shift: [INTERN] number of address bits in a page 61 * @page_shift: [INTERN] number of address bits in a page
66 * @ppb_shift: [INTERN] number of address bits in a pages per block
67 * @page_mask: [INTERN] a page per block mask 62 * @page_mask: [INTERN] a page per block mask
68 * @bufferram_index: [INTERN] BufferRAM index 63 * @bufferram_index: [INTERN] BufferRAM index
69 * @bufferram: [INTERN] BufferRAM info 64 * @bufferram: [INTERN] BufferRAM info
@@ -87,7 +82,8 @@ struct onenand_bufferram {
87 * @wq: [INTERN] wait queue to sleep on if a OneNAND 82 * @wq: [INTERN] wait queue to sleep on if a OneNAND
88 * operation is in progress 83 * operation is in progress
89 * @state: [INTERN] the current state of the OneNAND device 84 * @state: [INTERN] the current state of the OneNAND device
90 * @page_buf: data buffer 85 * @page_buf: [INTERN] page main data buffer
86 * @oob_buf: [INTERN] page oob data buffer
91 * @subpagesize: [INTERN] holds the subpagesize 87 * @subpagesize: [INTERN] holds the subpagesize
92 * @ecclayout: [REPLACEABLE] the default ecc placement scheme 88 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
93 * @bbm: [REPLACEABLE] pointer to Bad Block Management 89 * @bbm: [REPLACEABLE] pointer to Bad Block Management
@@ -103,7 +99,6 @@ struct onenand_chip {
103 99
104 unsigned int erase_shift; 100 unsigned int erase_shift;
105 unsigned int page_shift; 101 unsigned int page_shift;
106 unsigned int ppb_shift; /* Pages per block shift */
107 unsigned int page_mask; 102 unsigned int page_mask;
108 103
109 unsigned int bufferram_index; 104 unsigned int bufferram_index;
@@ -128,6 +123,7 @@ struct onenand_chip {
128 wait_queue_head_t wq; 123 wait_queue_head_t wq;
129 onenand_state_t state; 124 onenand_state_t state;
130 unsigned char *page_buf; 125 unsigned char *page_buf;
126 unsigned char *oob_buf;
131 127
132 int subpagesize; 128 int subpagesize;
133 struct nand_ecclayout *ecclayout; 129 struct nand_ecclayout *ecclayout;
@@ -150,6 +146,9 @@ struct onenand_chip {
150#define ONENAND_SET_SYS_CFG1(v, this) \ 146#define ONENAND_SET_SYS_CFG1(v, this) \
151 (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1)) 147 (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1))
152 148
149#define ONENAND_IS_DDP(this) \
150 (this->device_id & ONENAND_DEVICE_IS_DDP)
151
153/* Check byte access in OneNAND */ 152/* Check byte access in OneNAND */
154#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) 153#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
155 154
@@ -159,6 +158,7 @@ struct onenand_chip {
159#define ONENAND_HAS_CONT_LOCK (0x0001) 158#define ONENAND_HAS_CONT_LOCK (0x0001)
160#define ONENAND_HAS_UNLOCK_ALL (0x0002) 159#define ONENAND_HAS_UNLOCK_ALL (0x0002)
161#define ONENAND_PAGEBUF_ALLOC (0x1000) 160#define ONENAND_PAGEBUF_ALLOC (0x1000)
161#define ONENAND_OOBBUF_ALLOC (0x2000)
162 162
163/* 163/*
164 * OneNAND Flash Manufacturer ID Codes 164 * OneNAND Flash Manufacturer ID Codes
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index e31c8f5d4271..af94719890e7 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -3,7 +3,8 @@
3 * 3 *
4 * OneNAND Register header file 4 * OneNAND Register header file
5 * 5 *
6 * Copyright (C) 2005-2006 Samsung Electronics 6 * Copyright (C) 2005-2007 Samsung Electronics
7 * Kyungmin Park <kyungmin.park@samsung.com>
7 * 8 *
8 * 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
9 * 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
@@ -80,9 +81,11 @@
80#define ONENAND_VERSION_PROCESS_SHIFT (8) 81#define ONENAND_VERSION_PROCESS_SHIFT (8)
81 82
82/* 83/*
83 * Start Address 1 F100h (R/W) 84 * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W)
84 */ 85 */
85#define ONENAND_DDP_SHIFT (15) 86#define ONENAND_DDP_SHIFT (15)
87#define ONENAND_DDP_CHIP0 (0)
88#define ONENAND_DDP_CHIP1 (1 << ONENAND_DDP_SHIFT)
86 89
87/* 90/*
88 * Start Address 8 F107h (R/W) 91 * Start Address 8 F107h (R/W)
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 86831e3594f6..0dc07d5f3354 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -18,9 +18,10 @@
18#define __LINUX_MTD_PHYSMAP__ 18#define __LINUX_MTD_PHYSMAP__
19 19
20#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
23 22
23struct map_info;
24
24struct physmap_flash_data { 25struct physmap_flash_data {
25 unsigned int width; 26 unsigned int width;
26 void (*set_vpp)(struct map_info *, int); 27 void (*set_vpp)(struct map_info *, int);
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
new file mode 100644
index 000000000000..3d967b6b120a
--- /dev/null
+++ b/include/linux/mtd/ubi.h
@@ -0,0 +1,202 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __LINUX_UBI_H__
22#define __LINUX_UBI_H__
23
24#include <asm/ioctl.h>
25#include <linux/types.h>
26#include <mtd/ubi-user.h>
27
28/*
29 * UBI data type hint constants.
30 *
31 * UBI_LONGTERM: long-term data
32 * UBI_SHORTTERM: short-term data
33 * UBI_UNKNOWN: data persistence is unknown
34 *
35 * These constants are used when data is written to UBI volumes in order to
36 * help the UBI wear-leveling unit to find more appropriate physical
37 * eraseblocks.
38 */
39enum {
40 UBI_LONGTERM = 1,
41 UBI_SHORTTERM,
42 UBI_UNKNOWN
43};
44
45/*
46 * enum ubi_open_mode - UBI volume open mode constants.
47 *
48 * UBI_READONLY: read-only mode
49 * UBI_READWRITE: read-write mode
50 * UBI_EXCLUSIVE: exclusive mode
51 */
52enum {
53 UBI_READONLY = 1,
54 UBI_READWRITE,
55 UBI_EXCLUSIVE
56};
57
58/**
59 * struct ubi_volume_info - UBI volume description data structure.
60 * @vol_id: volume ID
61 * @ubi_num: UBI device number this volume belongs to
62 * @size: how many physical eraseblocks are reserved for this volume
63 * @used_bytes: how many bytes of data this volume contains
64 * @used_ebs: how many physical eraseblocks of this volume actually contain any
65 * data
66 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
67 * @corrupted: non-zero if the volume is corrupted (static volumes only)
68 * @upd_marker: non-zero if the volume has update marker set
69 * @alignment: volume alignment
70 * @usable_leb_size: how many bytes are available in logical eraseblocks of
71 * this volume
72 * @name_len: volume name length
73 * @name: volume name
74 * @cdev: UBI volume character device major and minor numbers
75 *
76 * The @corrupted flag is only relevant to static volumes and is always zero
77 * for dynamic ones. This is because UBI does not care about dynamic volume
78 * data protection and only cares about protecting static volume data.
79 *
80 * The @upd_marker flag is set if the volume update operation was interrupted.
81 * Before touching the volume data during the update operation, UBI first sets
82 * the update marker flag for this volume. If the volume update operation was
83 * further interrupted, the update marker indicates this. If the update marker
84 * is set, the contents of the volume is certainly damaged and a new volume
85 * update operation has to be started.
86 *
87 * To put it differently, @corrupted and @upd_marker fields have different
88 * semantics:
89 * o the @corrupted flag means that this static volume is corrupted for some
90 * reasons, but not because an interrupted volume update
91 * o the @upd_marker field means that the volume is damaged because of an
92 * interrupted update operation.
93 *
94 * I.e., the @corrupted flag is never set if the @upd_marker flag is set.
95 *
96 * The @used_bytes and @used_ebs fields are only really needed for static
97 * volumes and contain the number of bytes stored in this static volume and how
98 * many eraseblock this data occupies. In case of dynamic volumes, the
99 * @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs
100 * field is equivalent to @size.
101 *
102 * In general, logical eraseblock size is a property of the UBI device, not
103 * of the UBI volume. Indeed, the logical eraseblock size depends on the
104 * physical eraseblock size and on how much bytes UBI headers consume. But
105 * because of the volume alignment (@alignment), the usable size of logical
106 * eraseblocks if a volume may be less. The following equation is true:
107 * @usable_leb_size = LEB size - (LEB size mod @alignment),
108 * where LEB size is the logical eraseblock size defined by the UBI device.
109 *
110 * The alignment is multiple to the minimal flash input/output unit size or %1
111 * if all the available space is used.
112 *
113 * To put this differently, alignment may be considered is a way to change
114 * volume logical eraseblock sizes.
115 */
116struct ubi_volume_info {
117 int ubi_num;
118 int vol_id;
119 int size;
120 long long used_bytes;
121 int used_ebs;
122 int vol_type;
123 int corrupted;
124 int upd_marker;
125 int alignment;
126 int usable_leb_size;
127 int name_len;
128 const char *name;
129 dev_t cdev;
130};
131
132/**
133 * struct ubi_device_info - UBI device description data structure.
134 * @ubi_num: ubi device number
135 * @leb_size: logical eraseblock size on this UBI device
136 * @min_io_size: minimal I/O unit size
137 * @ro_mode: if this device is in read-only mode
138 * @cdev: UBI character device major and minor numbers
139 *
140 * Note, @leb_size is the logical eraseblock size offered by the UBI device.
141 * Volumes of this UBI device may have smaller logical eraseblock size if their
142 * alignment is not equivalent to %1.
143 */
144struct ubi_device_info {
145 int ubi_num;
146 int leb_size;
147 int min_io_size;
148 int ro_mode;
149 dev_t cdev;
150};
151
152/* UBI descriptor given to users when they open UBI volumes */
153struct ubi_volume_desc;
154
155int ubi_get_device_info(int ubi_num, struct ubi_device_info *di);
156void ubi_get_volume_info(struct ubi_volume_desc *desc,
157 struct ubi_volume_info *vi);
158struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
159struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
160 int mode);
161void ubi_close_volume(struct ubi_volume_desc *desc);
162int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
163 int len, int check);
164int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
165 int offset, int len, int dtype);
166int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
167 int len, int dtype);
168int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
169int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
170int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
171
172/*
173 * This function is the same as the 'ubi_leb_read()' function, but it does not
174 * provide the checking capability.
175 */
176static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
177 int offset, int len)
178{
179 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
180}
181
182/*
183 * This function is the same as the 'ubi_leb_write()' functions, but it does
184 * not have the data type argument.
185 */
186static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
187 const void *buf, int offset, int len)
188{
189 return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
190}
191
192/*
193 * This function is the same as the 'ubi_leb_change()' functions, but it does
194 * not have the data type argument.
195 */
196static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
197 const void *buf, int len)
198{
199 return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
200}
201
202#endif /* !__LINUX_UBI_H__ */
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index aff25c000abf..c6d4ab86b83c 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -1288,7 +1288,7 @@ struct mv64xxx_i2c_pdata {
1288#define MV643XX_ETH_NAME "mv643xx_eth" 1288#define MV643XX_ETH_NAME "mv643xx_eth"
1289 1289
1290struct mv643xx_eth_platform_data { 1290struct mv643xx_eth_platform_data {
1291 char *mac_addr; /* pointer to mac address */ 1291 int port_number;
1292 u16 force_phy_addr; /* force override if phy_addr == 0 */ 1292 u16 force_phy_addr; /* force override if phy_addr == 0 */
1293 u16 phy_addr; 1293 u16 phy_addr;
1294 1294
@@ -1303,6 +1303,7 @@ struct mv643xx_eth_platform_data {
1303 u32 tx_sram_size; 1303 u32 tx_sram_size;
1304 u32 rx_sram_addr; 1304 u32 rx_sram_addr;
1305 u32 rx_sram_size; 1305 u32 rx_sram_size;
1306 u8 mac_addr[6]; /* mac address if non-zero*/
1306}; 1307};
1307 1308
1308#endif /* __ASM_MV643XX_H */ 1309#endif /* __ASM_MV643XX_H */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index d39a5a67e979..b7dd24917f0d 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -82,6 +82,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
82extern void release_open_intent(struct nameidata *); 82extern void release_open_intent(struct nameidata *);
83 83
84extern struct dentry * lookup_one_len(const char *, struct dentry *, int); 84extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
85extern struct dentry *lookup_one_len_kern(const char *, struct dentry *, int);
85 86
86extern int follow_down(struct vfsmount **, struct dentry **); 87extern int follow_down(struct vfsmount **, struct dentry **);
87extern int follow_up(struct vfsmount **, struct dentry **); 88extern int follow_up(struct vfsmount **, struct dentry **);
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 0ea7f89e613c..83e39eb054d3 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,7 +204,7 @@ void ncp_update_inode(struct inode *, struct ncp_entry_info *);
204void ncp_update_inode2(struct inode *, struct ncp_entry_info *); 204void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
205 205
206/* linux/fs/ncpfs/dir.c */ 206/* linux/fs/ncpfs/dir.c */
207extern struct inode_operations ncp_dir_inode_operations; 207extern const struct inode_operations ncp_dir_inode_operations;
208extern const struct file_operations ncp_dir_operations; 208extern const struct file_operations ncp_dir_operations;
209int ncp_conn_logged_in(struct super_block *); 209int ncp_conn_logged_in(struct super_block *);
210int ncp_date_dos2unix(__le16 time, __le16 date); 210int ncp_date_dos2unix(__le16 time, __le16 date);
@@ -226,7 +226,7 @@ void ncp_lock_server(struct ncp_server *server);
226void ncp_unlock_server(struct ncp_server *server); 226void ncp_unlock_server(struct ncp_server *server);
227 227
228/* linux/fs/ncpfs/file.c */ 228/* linux/fs/ncpfs/file.c */
229extern struct inode_operations ncp_file_inode_operations; 229extern const struct inode_operations ncp_file_inode_operations;
230extern const struct file_operations ncp_file_operations; 230extern const struct file_operations ncp_file_operations;
231int ncp_make_open(struct inode *, int); 231int ncp_make_open(struct inode *, int);
232 232
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index a503052138bd..6330fc76b00f 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -50,6 +50,8 @@ struct ncp_server {
50 int packet_size; 50 int packet_size;
51 unsigned char *packet; /* Here we prepare requests and 51 unsigned char *packet; /* Here we prepare requests and
52 receive replies */ 52 receive replies */
53 unsigned char *txbuf; /* Storage for current request */
54 unsigned char *rxbuf; /* Storage for reply to current request */
53 55
54 int lock; /* To prevent mismatch in protocols. */ 56 int lock; /* To prevent mismatch in protocols. */
55 struct mutex mutex; 57 struct mutex mutex;
diff --git a/include/linux/net.h b/include/linux/net.h
index f28d8a2e2c91..efc45177b503 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -24,7 +24,7 @@
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26 26
27#define NPROTO 32 /* should be enough for now.. */ 27#define NPROTO 34 /* should be enough for now.. */
28 28
29#define SYS_SOCKET 1 /* sys_socket(2) */ 29#define SYS_SOCKET 1 /* sys_socket(2) */
30#define SYS_BIND 2 /* sys_bind(2) */ 30#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index fea0d9db6846..ac0c92b1e002 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,8 @@
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
45/* 802.11 specific */
46struct wireless_dev;
45 /* source back-compat hooks */ 47 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 48#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 49 ( (netdev)->ethtool_ops = (ops) )
@@ -347,13 +349,15 @@ struct net_device
347 349
348 350
349 struct net_device_stats* (*get_stats)(struct net_device *dev); 351 struct net_device_stats* (*get_stats)(struct net_device *dev);
352 struct net_device_stats stats;
350 353
354#ifdef CONFIG_WIRELESS_EXT
351 /* List of functions to handle Wireless Extensions (instead of ioctl). 355 /* List of functions to handle Wireless Extensions (instead of ioctl).
352 * See <net/iw_handler.h> for details. Jean II */ 356 * See <net/iw_handler.h> for details. Jean II */
353 const struct iw_handler_def * wireless_handlers; 357 const struct iw_handler_def * wireless_handlers;
354 /* Instance data managed by the core of Wireless Extensions. */ 358 /* Instance data managed by the core of Wireless Extensions. */
355 struct iw_public_data * wireless_data; 359 struct iw_public_data * wireless_data;
356 360#endif
357 const struct ethtool_ops *ethtool_ops; 361 const struct ethtool_ops *ethtool_ops;
358 362
359 /* 363 /*
@@ -398,6 +402,8 @@ struct net_device
398 void *ip6_ptr; /* IPv6 specific data */ 402 void *ip6_ptr; /* IPv6 specific data */
399 void *ec_ptr; /* Econet specific data */ 403 void *ec_ptr; /* Econet specific data */
400 void *ax25_ptr; /* AX.25 specific data */ 404 void *ax25_ptr; /* AX.25 specific data */
405 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
406 assign before registering */
401 407
402/* 408/*
403 * Cache line mostly used on receive path (including eth_type_trans()) 409 * Cache line mostly used on receive path (including eth_type_trans())
@@ -529,10 +535,11 @@ struct net_device
529 struct net_bridge_port *br_port; 535 struct net_bridge_port *br_port;
530 536
531 /* class/net/name entry */ 537 /* class/net/name entry */
532 struct class_device class_dev; 538 struct device dev;
533 /* space for optional statistics and wireless sysfs groups */ 539 /* space for optional statistics and wireless sysfs groups */
534 struct attribute_group *sysfs_groups[3]; 540 struct attribute_group *sysfs_groups[3];
535}; 541};
542#define to_net_dev(d) container_of(d, struct net_device, dev)
536 543
537#define NETDEV_ALIGN 32 544#define NETDEV_ALIGN 32
538#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 545#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
@@ -548,7 +555,7 @@ static inline void *netdev_priv(struct net_device *dev)
548/* Set the sysfs physical device reference for the network logical device 555/* Set the sysfs physical device reference for the network logical device
549 * if set prior to registration will cause a symlink during initialization. 556 * if set prior to registration will cause a symlink during initialization.
550 */ 557 */
551#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev)) 558#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
552 559
553struct packet_type { 560struct packet_type {
554 __be16 type; /* This is really htons(ether_type). */ 561 __be16 type; /* This is really htons(ether_type). */
@@ -588,7 +595,7 @@ extern int dev_open(struct net_device *dev);
588extern int dev_close(struct net_device *dev); 595extern int dev_close(struct net_device *dev);
589extern int dev_queue_xmit(struct sk_buff *skb); 596extern int dev_queue_xmit(struct sk_buff *skb);
590extern int register_netdevice(struct net_device *dev); 597extern int register_netdevice(struct net_device *dev);
591extern int unregister_netdevice(struct net_device *dev); 598extern void unregister_netdevice(struct net_device *dev);
592extern void free_netdev(struct net_device *dev); 599extern void free_netdev(struct net_device *dev);
593extern void synchronize_net(void); 600extern void synchronize_net(void);
594extern int register_netdevice_notifier(struct notifier_block *nb); 601extern int register_netdevice_notifier(struct notifier_block *nb);
@@ -646,8 +653,10 @@ static inline void netif_start_queue(struct net_device *dev)
646static inline void netif_wake_queue(struct net_device *dev) 653static inline void netif_wake_queue(struct net_device *dev)
647{ 654{
648#ifdef CONFIG_NETPOLL_TRAP 655#ifdef CONFIG_NETPOLL_TRAP
649 if (netpoll_trap()) 656 if (netpoll_trap()) {
657 clear_bit(__LINK_STATE_XOFF, &dev->state);
650 return; 658 return;
659 }
651#endif 660#endif
652 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state)) 661 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
653 __netif_schedule(dev); 662 __netif_schedule(dev);
@@ -655,10 +664,6 @@ static inline void netif_wake_queue(struct net_device *dev)
655 664
656static inline void netif_stop_queue(struct net_device *dev) 665static inline void netif_stop_queue(struct net_device *dev)
657{ 666{
658#ifdef CONFIG_NETPOLL_TRAP
659 if (netpoll_trap())
660 return;
661#endif
662 set_bit(__LINK_STATE_XOFF, &dev->state); 667 set_bit(__LINK_STATE_XOFF, &dev->state);
663} 668}
664 669
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index d4c4c5120bc0..10b5c6275706 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -172,8 +172,8 @@ struct nf_logger {
172 172
173/* Function to register/unregister log function. */ 173/* Function to register/unregister log function. */
174int nf_log_register(int pf, struct nf_logger *logger); 174int nf_log_register(int pf, struct nf_logger *logger);
175int nf_log_unregister_pf(int pf); 175void nf_log_unregister(struct nf_logger *logger);
176void nf_log_unregister_logger(struct nf_logger *logger); 176void nf_log_unregister_pf(int pf);
177 177
178/* Calls the registered backend logging function */ 178/* Calls the registered backend logging function */
179void nf_log_packet(int pf, 179void nf_log_packet(int pf,
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info, 281 struct nf_info *info,
282 unsigned int verdict); 282 unsigned int verdict);
283 283
284extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
285extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
286
287/* FIXME: Before cache is ever used, this must be implemented for real. */ 284/* FIXME: Before cache is ever used, this must be implemented for real. */
288extern void nf_invalidate_cache(int pf); 285extern void nf_invalidate_cache(int pf);
289 286
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
388{ 385{
389 return 1; 386 return 1;
390} 387}
391static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
392struct flowi; 388struct flowi;
393static inline void 389static inline void
394nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 390nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
395#endif /*CONFIG_NETFILTER*/ 391#endif /*CONFIG_NETFILTER*/
396 392
393#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
394extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
395extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
396extern void (*nf_ct_destroy)(struct nf_conntrack *);
397#else
398static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
399#endif
400
397#endif /*__KERNEL__*/ 401#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 402#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 6328175a1c3a..43397a414cd6 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -33,6 +33,7 @@ header-y += xt_tcpmss.h
33header-y += xt_tcpudp.h 33header-y += xt_tcpudp.h
34header-y += xt_SECMARK.h 34header-y += xt_SECMARK.h
35header-y += xt_CONNSECMARK.h 35header-y += xt_CONNSECMARK.h
36header-y += xt_TCPMSS.h
36 37
37unifdef-y += nf_conntrack_common.h 38unifdef-y += nf_conntrack_common.h
38unifdef-y += nf_conntrack_ftp.h 39unifdef-y += nf_conntrack_ftp.h
diff --git a/include/linux/netfilter/nf_conntrack_sane.h b/include/linux/netfilter/nf_conntrack_sane.h
new file mode 100644
index 000000000000..4767d6e23e97
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_sane.h
@@ -0,0 +1,21 @@
1#ifndef _NF_CONNTRACK_SANE_H
2#define _NF_CONNTRACK_SANE_H
3/* SANE tracking. */
4
5#ifdef __KERNEL__
6
7#define SANE_PORT 6566
8
9enum sane_state {
10 SANE_STATE_NORMAL,
11 SANE_STATE_START_REQUESTED,
12};
13
14/* This structure exists only once per master */
15struct nf_ct_sane_master {
16 enum sane_state state;
17};
18
19#endif /* __KERNEL__ */
20
21#endif /* _NF_CONNTRACK_SANE_H */
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 2f4e98b90cc0..22ce29995f13 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -27,6 +27,14 @@ enum tcp_conntrack {
27/* This sender sent FIN first */ 27/* This sender sent FIN first */
28#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04 28#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04
29 29
30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32
33struct nf_ct_tcp_flags {
34 u_int8_t flags;
35 u_int8_t mask;
36};
37
30#ifdef __KERNEL__ 38#ifdef __KERNEL__
31 39
32struct ip_ct_tcp_state { 40struct ip_ct_tcp_state {
@@ -34,7 +42,6 @@ struct ip_ct_tcp_state {
34 u_int32_t td_maxend; /* max of ack + max(win, 1) */ 42 u_int32_t td_maxend; /* max of ack + max(win, 1) */
35 u_int32_t td_maxwin; /* max(win) */ 43 u_int32_t td_maxwin; /* max(win) */
36 u_int8_t td_scale; /* window scale factor */ 44 u_int8_t td_scale; /* window scale factor */
37 u_int8_t loose; /* used when connection picked up from the middle */
38 u_int8_t flags; /* per direction options */ 45 u_int8_t flags; /* per direction options */
39}; 46};
40 47
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1e9c821f152d..0f9311df1559 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -62,11 +62,11 @@ struct nfattr
62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) 62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) 63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
64#define NFA_NEST(skb, type) \ 64#define NFA_NEST(skb, type) \
65({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ 65({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ 66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
67 __start; }) 67 __start; })
68#define NFA_NEST_END(skb, start) \ 68#define NFA_NEST_END(skb, start) \
69({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ 69({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
70 (skb)->len; }) 70 (skb)->len; })
71#define NFA_NEST_CANCEL(skb, start) \ 71#define NFA_NEST_CANCEL(skb, start) \
72({ if (start) \ 72({ if (start) \
@@ -111,7 +111,7 @@ struct nfgenmsg {
111struct nfnl_callback 111struct nfnl_callback
112{ 112{
113 int (*call)(struct sock *nl, struct sk_buff *skb, 113 int (*call)(struct sock *nl, struct sk_buff *skb,
114 struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); 114 struct nlmsghdr *nlh, struct nfattr *cda[]);
115 u_int16_t attr_count; /* number of nfattr's */ 115 u_int16_t attr_count; /* number of nfattr's */
116}; 116};
117 117
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ 129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); }) 130 __nfa_fill(skb, attrtype, attrlen, data); })
131 131
132extern struct semaphore nfnl_sem;
133
134#define nfnl_shlock() down(&nfnl_sem)
135#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
136
137#define nfnl_shunlock() do { up(&nfnl_sem); \
138 if(nfnl && nfnl->sk_receive_queue.qlen) \
139 nfnl->sk_data_ready(nfnl, 0); \
140 } while(0)
141
142extern void nfnl_lock(void);
143extern void nfnl_unlock(void);
144
145extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
146extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
147 134
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index b5883ccee295..d7c35039721e 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -83,6 +83,10 @@ enum ctattr_protoinfo {
83enum ctattr_protoinfo_tcp { 83enum ctattr_protoinfo_tcp {
84 CTA_PROTOINFO_TCP_UNSPEC, 84 CTA_PROTOINFO_TCP_UNSPEC,
85 CTA_PROTOINFO_TCP_STATE, 85 CTA_PROTOINFO_TCP_STATE,
86 CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
87 CTA_PROTOINFO_TCP_WSCALE_REPLY,
88 CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
89 CTA_PROTOINFO_TCP_FLAGS_REPLY,
86 __CTA_PROTOINFO_TCP_MAX 90 __CTA_PROTOINFO_TCP_MAX
87}; 91};
88#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 92#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
diff --git a/include/linux/netfilter/xt_TCPMSS.h b/include/linux/netfilter/xt_TCPMSS.h
new file mode 100644
index 000000000000..53a292cd47f3
--- /dev/null
+++ b/include/linux/netfilter/xt_TCPMSS.h
@@ -0,0 +1,10 @@
1#ifndef _XT_TCPMSS_H
2#define _XT_TCPMSS_H
3
4struct xt_tcpmss_info {
5 u_int16_t mss;
6};
7
8#define XT_TCPMSS_CLAMP_PMTU 0xffff
9
10#endif /* _XT_TCPMSS_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 55689f39f77a..19060030bac9 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -7,6 +7,7 @@
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#include <linux/if_ether.h> 8#include <linux/if_ether.h>
9#include <linux/if_vlan.h> 9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
10 11
11/* Bridge Hooks */ 12/* Bridge Hooks */
12/* After promisc drops, checksum checks. */ 13/* After promisc drops, checksum checks. */
@@ -58,8 +59,14 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
58 * enough room for the encapsulating header (if there is one). */ 59 * enough room for the encapsulating header (if there is one). */
59static inline int nf_bridge_pad(const struct sk_buff *skb) 60static inline int nf_bridge_pad(const struct sk_buff *skb)
60{ 61{
61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) 62 int padding = 0;
62 ? VLAN_HLEN : 0; 63
64 if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
65 padding = VLAN_HLEN;
66 else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES))
67 padding = PPPOE_SES_HLEN;
68
69 return padding;
63} 70}
64 71
65struct bridge_skb_cb { 72struct bridge_skb_cb {
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index 07f044ff1a6b..a11b0c2017fd 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr {
54 54
55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) 55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
56{ 56{
57 return (struct ebt_802_3_hdr *)skb->mac.raw; 57 return (struct ebt_802_3_hdr *)skb_mac_header(skb);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 97e4dbde1f89..cbf4843b6b0f 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -8,8 +8,10 @@
8#define EBT_ARP_DST_IP 0x10 8#define EBT_ARP_DST_IP 0x10
9#define EBT_ARP_SRC_MAC 0x20 9#define EBT_ARP_SRC_MAC 0x20
10#define EBT_ARP_DST_MAC 0x40 10#define EBT_ARP_DST_MAC 0x40
11#define EBT_ARP_GRAT 0x80
11#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ 12#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
12 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) 13 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
14 EBT_ARP_GRAT)
13#define EBT_ARP_MATCH "arp" 15#define EBT_ARP_MATCH "arp"
14 16
15struct ebt_arp_info 17struct ebt_arp_info
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 180337801a86..7185792b900f 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,9 +1,3 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_protocol.h
3header-y += ip_conntrack_sctp.h
4header-y += ip_conntrack_tcp.h
5header-y += ip_conntrack_tftp.h
6header-y += ip_nat_pptp.h
7header-y += ipt_addrtype.h 1header-y += ipt_addrtype.h
8header-y += ipt_ah.h 2header-y += ipt_ah.h
9header-y += ipt_CLASSIFY.h 3header-y += ipt_CLASSIFY.h
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h
49header-y += ipt_TTL.h 43header-y += ipt_TTL.h
50header-y += ipt_ULOG.h 44header-y += ipt_ULOG.h
51 45
52unifdef-y += ip_conntrack.h
53unifdef-y += ip_conntrack_h323.h
54unifdef-y += ip_conntrack_irc.h
55unifdef-y += ip_conntrack_pptp.h
56unifdef-y += ip_conntrack_proto_gre.h
57unifdef-y += ip_conntrack_tuple.h
58unifdef-y += ip_nat.h
59unifdef-y += ip_nat_rule.h
60unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
61unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 100644
index 33581c13d947..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1,396 +0,0 @@
1#ifndef _IP_CONNTRACK_H
2#define _IP_CONNTRACK_H
3
4#include <linux/netfilter/nf_conntrack_common.h>
5
6#ifdef __KERNEL__
7#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
8#include <linux/bitops.h>
9#include <linux/compiler.h>
10#include <asm/atomic.h>
11
12#include <linux/timer.h>
13#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
14#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
15#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
16#include <linux/netfilter_ipv4/ip_conntrack_sctp.h>
17
18/* per conntrack: protocol private data */
19union ip_conntrack_proto {
20 /* insert conntrack proto private data here */
21 struct ip_ct_gre gre;
22 struct ip_ct_sctp sctp;
23 struct ip_ct_tcp tcp;
24 struct ip_ct_icmp icmp;
25};
26
27union ip_conntrack_expect_proto {
28 /* insert expect proto private data here */
29};
30
31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
36#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
37
38/* per conntrack: application helper private data */
39union ip_conntrack_help {
40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
42 struct ip_ct_pptp_master ct_pptp_info;
43 struct ip_ct_ftp_master ct_ftp_info;
44 struct ip_ct_irc_master ct_irc_info;
45};
46
47#ifdef CONFIG_IP_NF_NAT_NEEDED
48#include <linux/netfilter_ipv4/ip_nat.h>
49#include <linux/netfilter_ipv4/ip_nat_pptp.h>
50
51/* per conntrack: nat application helper private data */
52union ip_conntrack_nat_help {
53 /* insert nat helper private data here */
54 struct ip_nat_pptp nat_pptp_info;
55};
56#endif
57
58#include <linux/types.h>
59#include <linux/skbuff.h>
60
61#ifdef CONFIG_NETFILTER_DEBUG
62#define IP_NF_ASSERT(x) \
63do { \
64 if (!(x)) \
65 /* Wooah! I'm tripping my conntrack in a frenzy of \
66 netplay... */ \
67 printk("NF_IP_ASSERT: %s:%i(%s)\n", \
68 __FILE__, __LINE__, __FUNCTION__); \
69} while(0)
70#else
71#define IP_NF_ASSERT(x)
72#endif
73
74struct ip_conntrack_helper;
75
76struct ip_conntrack
77{
78 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
79 plus 1 for any connection(s) we are `master' for */
80 struct nf_conntrack ct_general;
81
82 /* Have we seen traffic both ways yet? (bitset) */
83 unsigned long status;
84
85 /* Timer function; drops refcnt when it goes off. */
86 struct timer_list timeout;
87
88#ifdef CONFIG_IP_NF_CT_ACCT
89 /* Accounting Information (same cache line as other written members) */
90 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
91#endif
92 /* If we were expected by an expectation, this will be it */
93 struct ip_conntrack *master;
94
95 /* Current number of expected connections */
96 unsigned int expecting;
97
98 /* Unique ID that identifies this conntrack*/
99 unsigned int id;
100
101 /* Helper, if any. */
102 struct ip_conntrack_helper *helper;
103
104 /* Storage reserved for other modules: */
105 union ip_conntrack_proto proto;
106
107 union ip_conntrack_help help;
108
109#ifdef CONFIG_IP_NF_NAT_NEEDED
110 struct {
111 struct ip_nat_info info;
112 union ip_conntrack_nat_help help;
113#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
114 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
115 int masq_index;
116#endif
117 } nat;
118#endif /* CONFIG_IP_NF_NAT_NEEDED */
119
120#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
121 u_int32_t mark;
122#endif
123
124#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
125 u_int32_t secmark;
126#endif
127
128 /* Traversed often, so hopefully in different cacheline to top */
129 /* These are my tuples; original and reply */
130 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
131};
132
133struct ip_conntrack_expect
134{
135 /* Internal linked list (global expectation list) */
136 struct list_head list;
137
138 /* We expect this tuple, with the following mask */
139 struct ip_conntrack_tuple tuple, mask;
140
141 /* Function to call after setup and insertion */
142 void (*expectfn)(struct ip_conntrack *new,
143 struct ip_conntrack_expect *this);
144
145 /* The conntrack of the master connection */
146 struct ip_conntrack *master;
147
148 /* Timer function; deletes the expectation. */
149 struct timer_list timeout;
150
151 /* Usage count. */
152 atomic_t use;
153
154 /* Unique ID */
155 unsigned int id;
156
157 /* Flags */
158 unsigned int flags;
159
160#ifdef CONFIG_IP_NF_NAT_NEEDED
161 __be32 saved_ip;
162 /* This is the original per-proto part, used to map the
163 * expected connection the way the recipient expects. */
164 union ip_conntrack_manip_proto saved_proto;
165 /* Direction relative to the master connection. */
166 enum ip_conntrack_dir dir;
167#endif
168};
169
170#define IP_CT_EXPECT_PERMANENT 0x1
171
172static inline struct ip_conntrack *
173tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
174{
175 return container_of(hash, struct ip_conntrack,
176 tuplehash[hash->tuple.dst.dir]);
177}
178
179/* get master conntrack via master expectation */
180#define master_ct(conntr) (conntr->master)
181
182/* Alter reply tuple (maybe alter helper). */
183extern void
184ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
185 const struct ip_conntrack_tuple *newreply);
186
187/* Is this tuple taken? (ignoring any belonging to the given
188 conntrack). */
189extern int
190ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
191 const struct ip_conntrack *ignored_conntrack);
192
193/* Return conntrack_info and tuple hash for given skb. */
194static inline struct ip_conntrack *
195ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
196{
197 *ctinfo = skb->nfctinfo;
198 return (struct ip_conntrack *)skb->nfct;
199}
200
201/* decrement reference count on a conntrack */
202static inline void
203ip_conntrack_put(struct ip_conntrack *ct)
204{
205 IP_NF_ASSERT(ct);
206 nf_conntrack_put(&ct->ct_general);
207}
208
209extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
210 const struct ip_conntrack_tuple *orig);
211
212extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
213 enum ip_conntrack_info ctinfo,
214 const struct sk_buff *skb,
215 unsigned long extra_jiffies,
216 int do_acct);
217
218/* Refresh conntrack for this many jiffies and do accounting */
219static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
220 enum ip_conntrack_info ctinfo,
221 const struct sk_buff *skb,
222 unsigned long extra_jiffies)
223{
224 __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
225}
226
227/* Refresh conntrack for this many jiffies */
228static inline void ip_ct_refresh(struct ip_conntrack *ct,
229 const struct sk_buff *skb,
230 unsigned long extra_jiffies)
231{
232 __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
233}
234
235/* These are for NAT. Icky. */
236/* Update TCP window tracking data when NAT mangles the packet */
237extern void ip_conntrack_tcp_update(struct sk_buff *skb,
238 struct ip_conntrack *conntrack,
239 enum ip_conntrack_dir dir);
240
241/* Call me when a conntrack is destroyed. */
242extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
243
244/* Fake conntrack entry for untracked connections */
245extern struct ip_conntrack ip_conntrack_untracked;
246
247/* Returns new sk_buff, or NULL */
248struct sk_buff *
249ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
250
251/* Iterate over all conntracks: if iter returns true, it's deleted. */
252extern void
253ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
254 void *data);
255
256extern struct ip_conntrack_helper *
257__ip_conntrack_helper_find_byname(const char *);
258extern struct ip_conntrack_helper *
259ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
260extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
261
262extern struct ip_conntrack_protocol *
263__ip_conntrack_proto_find(u_int8_t protocol);
264extern struct ip_conntrack_protocol *
265ip_conntrack_proto_find_get(u_int8_t protocol);
266extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
267
268extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
269
270extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
271 struct ip_conntrack_tuple *);
272
273extern void ip_conntrack_free(struct ip_conntrack *ct);
274
275extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
276
277extern struct ip_conntrack_expect *
278__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
279
280extern struct ip_conntrack_expect *
281ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
282
283extern struct ip_conntrack_tuple_hash *
284__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
285 const struct ip_conntrack *ignored_conntrack);
286
287extern void ip_conntrack_flush(void);
288
289/* It's confirmed if it is, or has been in the hash table. */
290static inline int is_confirmed(struct ip_conntrack *ct)
291{
292 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
293}
294
295static inline int is_dying(struct ip_conntrack *ct)
296{
297 return test_bit(IPS_DYING_BIT, &ct->status);
298}
299
300extern unsigned int ip_conntrack_htable_size;
301extern int ip_conntrack_checksum;
302
303#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
304
305#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
306#include <linux/notifier.h>
307#include <linux/interrupt.h>
308
309struct ip_conntrack_ecache {
310 struct ip_conntrack *ct;
311 unsigned int events;
312};
313DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
314
315#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
316
317extern struct atomic_notifier_head ip_conntrack_chain;
318extern struct atomic_notifier_head ip_conntrack_expect_chain;
319
320static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
321{
322 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
323}
324
325static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
326{
327 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
328}
329
330static inline int
331ip_conntrack_expect_register_notifier(struct notifier_block *nb)
332{
333 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
334}
335
336static inline int
337ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
338{
339 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
340 nb);
341}
342
343extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
344extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
345
346static inline void
347ip_conntrack_event_cache(enum ip_conntrack_events event,
348 const struct sk_buff *skb)
349{
350 struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
351 struct ip_conntrack_ecache *ecache;
352
353 local_bh_disable();
354 ecache = &__get_cpu_var(ip_conntrack_ecache);
355 if (ct != ecache->ct)
356 __ip_ct_event_cache_init(ct);
357 ecache->events |= event;
358 local_bh_enable();
359}
360
361static inline void ip_conntrack_event(enum ip_conntrack_events event,
362 struct ip_conntrack *ct)
363{
364 if (is_confirmed(ct) && !is_dying(ct))
365 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
366}
367
368static inline void
369ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
370 struct ip_conntrack_expect *exp)
371{
372 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
373}
374#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
375static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
376 const struct sk_buff *skb) {}
377static inline void ip_conntrack_event(enum ip_conntrack_events event,
378 struct ip_conntrack *ct) {}
379static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
380static inline void
381ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
382 struct ip_conntrack_expect *exp) {}
383#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
384
385#ifdef CONFIG_IP_NF_NAT_NEEDED
386static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
387 enum ip_nat_manip_type manip)
388{
389 if (manip == IP_NAT_MANIP_SRC)
390 return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status);
391 return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status);
392}
393#endif /* CONFIG_IP_NF_NAT_NEEDED */
394
395#endif /* __KERNEL__ */
396#endif /* _IP_CONNTRACK_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
deleted file mode 100644
index de3e41f51aec..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _IP_CONNTRACK_AMANDA_H
2#define _IP_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5struct ip_conntrack_expect;
6extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
7 enum ip_conntrack_info ctinfo,
8 unsigned int matchoff,
9 unsigned int matchlen,
10 struct ip_conntrack_expect *exp);
11#endif /* _IP_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
deleted file mode 100644
index 907d4f5ca5dc..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h>
4
5#define MAX_IP_CT_PROTO 256
6extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
7
8/* This header is used to share core functionality between the
9 standalone connection tracking module, and the compatibility layer's use
10 of connection tracking. */
11extern unsigned int ip_conntrack_in(unsigned int hooknum,
12 struct sk_buff **pskb,
13 const struct net_device *in,
14 const struct net_device *out,
15 int (*okfn)(struct sk_buff *));
16
17extern int ip_conntrack_init(void);
18extern void ip_conntrack_cleanup(void);
19
20struct ip_conntrack_protocol;
21
22extern int
23ip_ct_get_tuple(const struct iphdr *iph,
24 const struct sk_buff *skb,
25 unsigned int dataoff,
26 struct ip_conntrack_tuple *tuple,
27 const struct ip_conntrack_protocol *protocol);
28
29extern int
30ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
31 const struct ip_conntrack_tuple *orig,
32 const struct ip_conntrack_protocol *protocol);
33
34/* Find a connection corresponding to a tuple. */
35struct ip_conntrack_tuple_hash *
36ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
37 const struct ip_conntrack *ignored_conntrack);
38
39extern int __ip_conntrack_confirm(struct sk_buff **pskb);
40
41/* Confirm a connection: returns NF_DROP if packet must be dropped. */
42static inline int ip_conntrack_confirm(struct sk_buff **pskb)
43{
44 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
45 int ret = NF_ACCEPT;
46
47 if (ct) {
48 if (!is_confirmed(ct))
49 ret = __ip_conntrack_confirm(pskb);
50 ip_ct_deliver_cached_events(ct);
51 }
52 return ret;
53}
54
55extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
56
57extern struct list_head *ip_conntrack_hash;
58extern struct list_head ip_conntrack_expect_list;
59extern rwlock_t ip_conntrack_lock;
60#endif /* _IP_CONNTRACK_CORE_H */
61
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
deleted file mode 100644
index 2129fc3972ac..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
4
5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type
7{
8 /* PORT command from client */
9 IP_CT_FTP_PORT,
10 /* PASV response from server */
11 IP_CT_FTP_PASV,
12 /* EPRT command from client */
13 IP_CT_FTP_EPRT,
14 /* EPSV response from server */
15 IP_CT_FTP_EPSV,
16};
17
18#ifdef __KERNEL__
19
20#define FTP_PORT 21
21
22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */
24struct ip_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29};
30
31struct ip_conntrack_expect;
32
33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type,
38 unsigned int matchoff,
39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp,
41 u32 *seq);
42#endif /* __KERNEL__ */
43
44#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
deleted file mode 100644
index 18f769818f4e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7
8#define RAS_PORT 1719
9#define Q931_PORT 1720
10#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
11
12/* This structure exists only once per master */
13struct ip_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 u_int16_t sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
20
21 union {
22 /* RAS connection timeout */
23 u_int32_t timeout;
24
25 /* Next TPKT length (for separate TPKT header and data) */
26 u_int16_t tpkt_len[IP_CT_DIR_MAX];
27 };
28};
29
30struct ip_conntrack_expect;
31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
37 struct ip_conntrack_expect *this);
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr,
41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff,
44 TransportAddress * addr,
45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned char **data,
50 TransportAddress * addr, int count);
51extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
52 struct ip_conntrack * ct,
53 enum ip_conntrack_info ctinfo,
54 unsigned char **data,
55 TransportAddress * addr, int count);
56extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
57 struct ip_conntrack * ct,
58 enum ip_conntrack_info ctinfo,
59 unsigned char **data, int dataoff,
60 H245_TransportAddress * addr,
61 u_int16_t port, u_int16_t rtp_port,
62 struct ip_conntrack_expect * rtp_exp,
63 struct ip_conntrack_expect * rtcp_exp);
64extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
65 enum ip_conntrack_info ctinfo,
66 unsigned char **data, int dataoff,
67 H245_TransportAddress * addr, u_int16_t port,
68 struct ip_conntrack_expect * exp);
69extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
82 enum ip_conntrack_info ctinfo,
83 unsigned char **data, TransportAddress * addr,
84 int idx, u_int16_t port,
85 struct ip_conntrack_expect * exp);
86
87#endif
88
89#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
deleted file mode 100644
index 77fe868d36ff..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* IP connection tracking helpers. */
2#ifndef _IP_CONNTRACK_HELPER_H
3#define _IP_CONNTRACK_HELPER_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6struct module;
7
8struct ip_conntrack_helper
9{
10 struct list_head list; /* Internal use. */
11
12 const char *name; /* name of the module */
13 struct module *me; /* pointer to self */
14 unsigned int max_expected; /* Maximum number of concurrent
15 * expected connections */
16 unsigned int timeout; /* timeout for expecteds */
17
18 /* Mask of things we will help (compared against server response) */
19 struct ip_conntrack_tuple tuple;
20 struct ip_conntrack_tuple mask;
21
22 /* Function to call when data passes; return verdict, or -1 to
23 invalidate. */
24 int (*help)(struct sk_buff **pskb,
25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo);
27
28 void (*destroy)(struct ip_conntrack *ct);
29
30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
31};
32
33extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
34extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
35
36/* Allocate space for an expectation: this is mandatory before calling
37 ip_conntrack_expect_related. You will have to call put afterwards. */
38extern struct ip_conntrack_expect *
39ip_conntrack_expect_alloc(struct ip_conntrack *master);
40extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
41
42/* Add an expected connection: can have more than one per connection */
43extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
44extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
45
46#endif /*_IP_CONNTRACK_HELPER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
deleted file mode 100644
index eed5ee3e4744..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_ICMP_H
2#define _IP_CONNTRACK_ICMP_H
3
4#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
5
6#endif /* _IP_CONNTRACK_ICMP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_irc.h b/include/linux/netfilter_ipv4/ip_conntrack_irc.h
deleted file mode 100644
index 16601e0d5626..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_irc.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* IRC extension for IP connection tracking.
2 * (C) 2000 by Harald Welte <laforge@gnumonks.org>
3 * based on RR's ip_conntrack_ftp.h
4 *
5 * ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 *
13 */
14#ifndef _IP_CONNTRACK_IRC_H
15#define _IP_CONNTRACK_IRC_H
16
17/* This structure exists only once per master */
18struct ip_ct_irc_master {
19};
20
21#ifdef __KERNEL__
22extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 unsigned int matchoff,
25 unsigned int matchlen,
26 struct ip_conntrack_expect *exp);
27
28#define IRC_PORT 6667
29
30#endif /* __KERNEL__ */
31
32#endif /* _IP_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
deleted file mode 100644
index 2644b1faddd6..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ /dev/null
@@ -1,326 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _CONNTRACK_PPTP_H
3#define _CONNTRACK_PPTP_H
4
5/* state of the control session */
6enum pptp_ctrlsess_state {
7 PPTP_SESSION_NONE, /* no session present */
8 PPTP_SESSION_ERROR, /* some session error */
9 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
10 PPTP_SESSION_REQUESTED, /* start_sess request seen */
11 PPTP_SESSION_CONFIRMED, /* session established */
12};
13
14/* state of the call inside the control session */
15enum pptp_ctrlcall_state {
16 PPTP_CALL_NONE,
17 PPTP_CALL_ERROR,
18 PPTP_CALL_OUT_REQ,
19 PPTP_CALL_OUT_CONF,
20 PPTP_CALL_IN_REQ,
21 PPTP_CALL_IN_REP,
22 PPTP_CALL_IN_CONF,
23 PPTP_CALL_CLEAR_REQ,
24};
25
26
27/* conntrack private data */
28struct ip_ct_pptp_master {
29 enum pptp_ctrlsess_state sstate; /* session state */
30
31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */
34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 __be16 pns_call_id; /* call id of PNS, host byte order */
36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */
39 struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
40};
41
42/* conntrack_expect private member */
43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */
45 __be16 pac_call_id; /* call id of PAC */
46 __be16 pns_call_id; /* call id of PNS */
47};
48
49
50#ifdef __KERNEL__
51
52#define IP_CONNTR_PPTP PPTP_CONTROL_PORT
53
54#define PPTP_CONTROL_PORT 1723
55
56#define PPTP_PACKET_CONTROL 1
57#define PPTP_PACKET_MGMT 2
58
59#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
60
61struct pptp_pkt_hdr {
62 __u16 packetLength;
63 __be16 packetType;
64 __be32 magicCookie;
65};
66
67/* PptpControlMessageType values */
68#define PPTP_START_SESSION_REQUEST 1
69#define PPTP_START_SESSION_REPLY 2
70#define PPTP_STOP_SESSION_REQUEST 3
71#define PPTP_STOP_SESSION_REPLY 4
72#define PPTP_ECHO_REQUEST 5
73#define PPTP_ECHO_REPLY 6
74#define PPTP_OUT_CALL_REQUEST 7
75#define PPTP_OUT_CALL_REPLY 8
76#define PPTP_IN_CALL_REQUEST 9
77#define PPTP_IN_CALL_REPLY 10
78#define PPTP_IN_CALL_CONNECT 11
79#define PPTP_CALL_CLEAR_REQUEST 12
80#define PPTP_CALL_DISCONNECT_NOTIFY 13
81#define PPTP_WAN_ERROR_NOTIFY 14
82#define PPTP_SET_LINK_INFO 15
83
84#define PPTP_MSG_MAX 15
85
86/* PptpGeneralError values */
87#define PPTP_ERROR_CODE_NONE 0
88#define PPTP_NOT_CONNECTED 1
89#define PPTP_BAD_FORMAT 2
90#define PPTP_BAD_VALUE 3
91#define PPTP_NO_RESOURCE 4
92#define PPTP_BAD_CALLID 5
93#define PPTP_REMOVE_DEVICE_ERROR 6
94
95struct PptpControlHeader {
96 __be16 messageType;
97 __u16 reserved;
98};
99
100/* FramingCapability Bitmap Values */
101#define PPTP_FRAME_CAP_ASYNC 0x1
102#define PPTP_FRAME_CAP_SYNC 0x2
103
104/* BearerCapability Bitmap Values */
105#define PPTP_BEARER_CAP_ANALOG 0x1
106#define PPTP_BEARER_CAP_DIGITAL 0x2
107
108struct PptpStartSessionRequest {
109 __be16 protocolVersion;
110 __u16 reserved1;
111 __be32 framingCapability;
112 __be32 bearerCapability;
113 __be16 maxChannels;
114 __be16 firmwareRevision;
115 __u8 hostName[64];
116 __u8 vendorString[64];
117};
118
119/* PptpStartSessionResultCode Values */
120#define PPTP_START_OK 1
121#define PPTP_START_GENERAL_ERROR 2
122#define PPTP_START_ALREADY_CONNECTED 3
123#define PPTP_START_NOT_AUTHORIZED 4
124#define PPTP_START_UNKNOWN_PROTOCOL 5
125
126struct PptpStartSessionReply {
127 __be16 protocolVersion;
128 __u8 resultCode;
129 __u8 generalErrorCode;
130 __be32 framingCapability;
131 __be32 bearerCapability;
132 __be16 maxChannels;
133 __be16 firmwareRevision;
134 __u8 hostName[64];
135 __u8 vendorString[64];
136};
137
138/* PptpStopReasons */
139#define PPTP_STOP_NONE 1
140#define PPTP_STOP_PROTOCOL 2
141#define PPTP_STOP_LOCAL_SHUTDOWN 3
142
143struct PptpStopSessionRequest {
144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
147};
148
149/* PptpStopSessionResultCode */
150#define PPTP_STOP_OK 1
151#define PPTP_STOP_GENERAL_ERROR 2
152
153struct PptpStopSessionReply {
154 __u8 resultCode;
155 __u8 generalErrorCode;
156 __u16 reserved1;
157};
158
159struct PptpEchoRequest {
160 __be32 identNumber;
161};
162
163/* PptpEchoReplyResultCode */
164#define PPTP_ECHO_OK 1
165#define PPTP_ECHO_GENERAL_ERROR 2
166
167struct PptpEchoReply {
168 __be32 identNumber;
169 __u8 resultCode;
170 __u8 generalErrorCode;
171 __u16 reserved;
172};
173
174/* PptpFramingType */
175#define PPTP_ASYNC_FRAMING 1
176#define PPTP_SYNC_FRAMING 2
177#define PPTP_DONT_CARE_FRAMING 3
178
179/* PptpCallBearerType */
180#define PPTP_ANALOG_TYPE 1
181#define PPTP_DIGITAL_TYPE 2
182#define PPTP_DONT_CARE_BEARER_TYPE 3
183
184struct PptpOutCallRequest {
185 __be16 callID;
186 __be16 callSerialNumber;
187 __be32 minBPS;
188 __be32 maxBPS;
189 __be32 bearerType;
190 __be32 framingType;
191 __be16 packetWindow;
192 __be16 packetProcDelay;
193 __be16 phoneNumberLength;
194 __u16 reserved1;
195 __u8 phoneNumber[64];
196 __u8 subAddress[64];
197};
198
199/* PptpCallResultCode */
200#define PPTP_OUTCALL_CONNECT 1
201#define PPTP_OUTCALL_GENERAL_ERROR 2
202#define PPTP_OUTCALL_NO_CARRIER 3
203#define PPTP_OUTCALL_BUSY 4
204#define PPTP_OUTCALL_NO_DIAL_TONE 5
205#define PPTP_OUTCALL_TIMEOUT 6
206#define PPTP_OUTCALL_DONT_ACCEPT 7
207
208struct PptpOutCallReply {
209 __be16 callID;
210 __be16 peersCallID;
211 __u8 resultCode;
212 __u8 generalErrorCode;
213 __be16 causeCode;
214 __be32 connectSpeed;
215 __be16 packetWindow;
216 __be16 packetProcDelay;
217 __be32 physChannelID;
218};
219
220struct PptpInCallRequest {
221 __be16 callID;
222 __be16 callSerialNumber;
223 __be32 callBearerType;
224 __be32 physChannelID;
225 __be16 dialedNumberLength;
226 __be16 dialingNumberLength;
227 __u8 dialedNumber[64];
228 __u8 dialingNumber[64];
229 __u8 subAddress[64];
230};
231
232/* PptpInCallResultCode */
233#define PPTP_INCALL_ACCEPT 1
234#define PPTP_INCALL_GENERAL_ERROR 2
235#define PPTP_INCALL_DONT_ACCEPT 3
236
237struct PptpInCallReply {
238 __be16 callID;
239 __be16 peersCallID;
240 __u8 resultCode;
241 __u8 generalErrorCode;
242 __be16 packetWindow;
243 __be16 packetProcDelay;
244 __u16 reserved;
245};
246
247struct PptpInCallConnected {
248 __be16 peersCallID;
249 __u16 reserved;
250 __be32 connectSpeed;
251 __be16 packetWindow;
252 __be16 packetProcDelay;
253 __be32 callFramingType;
254};
255
256struct PptpClearCallRequest {
257 __be16 callID;
258 __u16 reserved;
259};
260
261struct PptpCallDisconnectNotify {
262 __be16 callID;
263 __u8 resultCode;
264 __u8 generalErrorCode;
265 __be16 causeCode;
266 __u16 reserved;
267 __u8 callStatistics[128];
268};
269
270struct PptpWanErrorNotify {
271 __be16 peersCallID;
272 __u16 reserved;
273 __be32 crcErrors;
274 __be32 framingErrors;
275 __be32 hardwareOverRuns;
276 __be32 bufferOverRuns;
277 __be32 timeoutErrors;
278 __be32 alignmentErrors;
279};
280
281struct PptpSetLinkInfo {
282 __be16 peersCallID;
283 __u16 reserved;
284 __be32 sendAccm;
285 __be32 recvAccm;
286};
287
288union pptp_ctrl_union {
289 struct PptpStartSessionRequest sreq;
290 struct PptpStartSessionReply srep;
291 struct PptpStopSessionRequest streq;
292 struct PptpStopSessionReply strep;
293 struct PptpOutCallRequest ocreq;
294 struct PptpOutCallReply ocack;
295 struct PptpInCallRequest icreq;
296 struct PptpInCallReply icack;
297 struct PptpInCallConnected iccon;
298 struct PptpClearCallRequest clrreq;
299 struct PptpCallDisconnectNotify disc;
300 struct PptpWanErrorNotify wanerr;
301 struct PptpSetLinkInfo setlink;
302};
303
304extern int
305(*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
306 struct ip_conntrack *ct,
307 enum ip_conntrack_info ctinfo,
308 struct PptpControlHeader *ctlh,
309 union pptp_ctrl_union *pptpReq);
310
311extern int
312(*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
313 struct ip_conntrack *ct,
314 enum ip_conntrack_info ctinfo,
315 struct PptpControlHeader *ctlh,
316 union pptp_ctrl_union *pptpReq);
317
318extern void
319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
320 struct ip_conntrack_expect *exp_reply);
321
322extern void
323(*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
324 struct ip_conntrack_expect *exp);
325#endif /* __KERNEL__ */
326#endif /* _CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
deleted file mode 100644
index e371e0fc1672..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _CONNTRACK_PROTO_GRE_H
2#define _CONNTRACK_PROTO_GRE_H
3#include <asm/byteorder.h>
4
5/* GRE PROTOCOL HEADER */
6
7/* GRE Version field */
8#define GRE_VERSION_1701 0x0
9#define GRE_VERSION_PPTP 0x1
10
11/* GRE Protocol field */
12#define GRE_PROTOCOL_PPTP 0x880B
13
14/* GRE Flags */
15#define GRE_FLAG_C 0x80
16#define GRE_FLAG_R 0x40
17#define GRE_FLAG_K 0x20
18#define GRE_FLAG_S 0x10
19#define GRE_FLAG_A 0x80
20
21#define GRE_IS_C(f) ((f)&GRE_FLAG_C)
22#define GRE_IS_R(f) ((f)&GRE_FLAG_R)
23#define GRE_IS_K(f) ((f)&GRE_FLAG_K)
24#define GRE_IS_S(f) ((f)&GRE_FLAG_S)
25#define GRE_IS_A(f) ((f)&GRE_FLAG_A)
26
27/* GRE is a mess: Four different standards */
28struct gre_hdr {
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 rec:3,
31 srr:1,
32 seq:1,
33 key:1,
34 routing:1,
35 csum:1,
36 version:3,
37 reserved:4,
38 ack:1;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u16 csum:1,
41 routing:1,
42 key:1,
43 seq:1,
44 srr:1,
45 rec:3,
46 ack:1,
47 reserved:4,
48 version:3;
49#else
50#error "Adjust your <asm/byteorder.h> defines"
51#endif
52 __be16 protocol;
53};
54
55/* modified GRE header for PPTP */
56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __be16 call_id; /* peer's call_id for this session */
62 __be32 seq; /* sequence number. Present if S==1 */
63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */
65};
66
67
68/* this is part of ip_conntrack */
69struct ip_ct_gre {
70 unsigned int stream_timeout;
71 unsigned int timeout;
72};
73
74#ifdef __KERNEL__
75struct ip_conntrack_expect;
76struct ip_conntrack;
77
78/* structure for original <-> reply keymap */
79struct ip_ct_gre_keymap {
80 struct list_head list;
81
82 struct ip_conntrack_tuple tuple;
83};
84
85/* add new tuple->key_reply pair to keymap */
86int ip_ct_gre_keymap_add(struct ip_conntrack *ct,
87 struct ip_conntrack_tuple *t,
88 int reply);
89
90/* delete keymap entries */
91void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92
93
94/* get pointer to gre key, if present */
95static inline __be32 *gre_key(struct gre_hdr *greh)
96{
97 if (!greh->key)
98 return NULL;
99 if (greh->csum || greh->routing)
100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (__be32 *) (greh+sizeof(*greh));
102}
103
104/* get pointer ot gre csum, if present */
105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{
107 if (!greh->csum)
108 return NULL;
109 return (__sum16 *) (greh+sizeof(*greh));
110}
111
112#endif /* __KERNEL__ */
113
114#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
deleted file mode 100644
index 2c76b879e3dc..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* Header for use in defining a given protocol for connection tracking. */
2#ifndef _IP_CONNTRACK_PROTOCOL_H
3#define _IP_CONNTRACK_PROTOCOL_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct seq_file;
8
9struct ip_conntrack_protocol
10{
11 /* Protocol number. */
12 u_int8_t proto;
13
14 /* Protocol name */
15 const char *name;
16
17 /* Try to fill in the third arg: dataoff is offset past IP
18 hdr. Return true if possible. */
19 int (*pkt_to_tuple)(const struct sk_buff *skb,
20 unsigned int dataoff,
21 struct ip_conntrack_tuple *tuple);
22
23 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
24 * Some packets can't be inverted: return 0 in that case.
25 */
26 int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
27 const struct ip_conntrack_tuple *orig);
28
29 /* Print out the per-protocol part of the tuple. Return like seq_* */
30 int (*print_tuple)(struct seq_file *,
31 const struct ip_conntrack_tuple *);
32
33 /* Print out the private part of the conntrack. */
34 int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
35
36 /* Returns verdict for packet, or -1 for invalid. */
37 int (*packet)(struct ip_conntrack *conntrack,
38 const struct sk_buff *skb,
39 enum ip_conntrack_info ctinfo);
40
41 /* Called when a new connection for this protocol found;
42 * returns TRUE if it's OK. If so, packet() called next. */
43 int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
44
45 /* Called when a conntrack entry is destroyed */
46 void (*destroy)(struct ip_conntrack *conntrack);
47
48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
49 unsigned int hooknum);
50
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
54
55 /* convert nfnetlink attributes to protoinfo */
56 int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
57
58 int (*tuple_to_nfattr)(struct sk_buff *skb,
59 const struct ip_conntrack_tuple *t);
60 int (*nfattr_to_tuple)(struct nfattr *tb[],
61 struct ip_conntrack_tuple *t);
62
63 /* Module (if any) which this is connected to. */
64 struct module *me;
65};
66
67/* Protocol registration. */
68extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
69extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
70/* Existing built-in protocols */
71extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
72extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
73extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
74extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
75extern int ip_conntrack_protocol_tcp_init(void);
76
77/* Log invalid packets */
78extern unsigned int ip_ct_log_invalid;
79
80extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
81 const struct ip_conntrack_tuple *);
82extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
83 struct ip_conntrack_tuple *);
84
85#ifdef CONFIG_SYSCTL
86#ifdef DEBUG_INVALID_PACKETS
87#define LOG_INVALID(proto) \
88 (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
89#else
90#define LOG_INVALID(proto) \
91 ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
92 && net_ratelimit())
93#endif
94#else
95#define LOG_INVALID(proto) 0
96#endif /* CONFIG_SYSCTL */
97
98#endif /*_IP_CONNTRACK_PROTOCOL_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
deleted file mode 100644
index 4099a041a32a..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_SCTP_H
2#define _IP_CONNTRACK_SCTP_H
3
4#include <linux/netfilter/nf_conntrack_sctp.h>
5
6#endif /* _IP_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
deleted file mode 100644
index bef6c646defa..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8enum sip_header_pos {
9 POS_REG_REQ_URI,
10 POS_REQ_URI,
11 POS_FROM,
12 POS_TO,
13 POS_VIA,
14 POS_CONTACT,
15 POS_CONTENT,
16 POS_MEDIA,
17 POS_OWNER,
18 POS_CONNECTION,
19 POS_SDP_HEADER,
20};
21
22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 struct ip_conntrack *ct,
25 const char **dptr);
26extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
27 enum ip_conntrack_info ctinfo,
28 struct ip_conntrack_expect *exp,
29 const char *dptr);
30
31extern int ct_sip_get_info(const char *dptr, size_t dlen,
32 unsigned int *matchoff,
33 unsigned int *matchlen,
34 enum sip_header_pos pos);
35extern int ct_sip_lnlen(const char *line, const char *limit);
36extern const char *ct_sip_search(const char *needle, const char *haystack,
37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
39#endif /* __KERNEL__ */
40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
deleted file mode 100644
index 876b8fb17e68..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_TCP_H
2#define _IP_CONNTRACK_TCP_H
3
4#include <linux/netfilter/nf_conntrack_tcp.h>
5
6#endif /* _IP_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
deleted file mode 100644
index a404fc0abf0e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IP_CT_TFTP
2#define _IP_CT_TFTP
3
4#define TFTP_PORT 69
5
6struct tftphdr {
7 __be16 opcode;
8};
9
10#define TFTP_OPCODE_READ 1
11#define TFTP_OPCODE_WRITE 2
12#define TFTP_OPCODE_DATA 3
13#define TFTP_OPCODE_ACK 4
14#define TFTP_OPCODE_ERROR 5
15
16extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct ip_conntrack_expect *exp);
19
20#endif /* _IP_CT_TFTP */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 100644
index c228bde74c33..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1,146 +0,0 @@
1#ifndef _IP_CONNTRACK_TUPLE_H
2#define _IP_CONNTRACK_TUPLE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7/* A `tuple' is a structure containing the information to uniquely
8 identify a connection. ie. if two packets have the same tuple, they
9 are in the same connection; if not, they are not.
10
11 We divide the structure along "manipulatable" and
12 "non-manipulatable" lines, for the benefit of the NAT code.
13*/
14
15/* The protocol-specific manipulable parts of the tuple: always in
16 network order! */
17union ip_conntrack_manip_proto
18{
19 /* Add other protocols here. */
20 u_int16_t all;
21
22 struct {
23 __be16 port;
24 } tcp;
25 struct {
26 __be16 port;
27 } udp;
28 struct {
29 __be16 id;
30 } icmp;
31 struct {
32 __be16 port;
33 } sctp;
34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */
36 } gre;
37};
38
39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip
41{
42 __be32 ip;
43 union ip_conntrack_manip_proto u;
44};
45
46/* This contains the information to distinguish a connection. */
47struct ip_conntrack_tuple
48{
49 struct ip_conntrack_manip src;
50
51 /* These are the parts of the tuple which are fixed. */
52 struct {
53 __be32 ip;
54 union {
55 /* Add other protocols here. */
56 u_int16_t all;
57
58 struct {
59 __be16 port;
60 } tcp;
61 struct {
62 __be16 port;
63 } udp;
64 struct {
65 u_int8_t type, code;
66 } icmp;
67 struct {
68 __be16 port;
69 } sctp;
70 struct {
71 __be16 key; /* key is 32bit,
72 * pptp only uses 16 */
73 } gre;
74 } u;
75
76 /* The protocol. */
77 u_int8_t protonum;
78
79 /* The direction (for tuplehash) */
80 u_int8_t dir;
81 } dst;
82};
83
84/* This is optimized opposed to a memset of the whole structure. Everything we
85 * really care about is the source/destination unions */
86#define IP_CT_TUPLE_U_BLANK(tuple) \
87 do { \
88 (tuple)->src.u.all = 0; \
89 (tuple)->dst.u.all = 0; \
90 } while (0)
91
92#ifdef __KERNEL__
93
94#define DUMP_TUPLE(tp) \
95DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
96 (tp), (tp)->dst.protonum, \
97 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
98 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
99
100/* If we're the first tuple, it's the original dir. */
101#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
102
103/* Connections have two entries in the hash table: one for each way */
104struct ip_conntrack_tuple_hash
105{
106 struct list_head list;
107
108 struct ip_conntrack_tuple tuple;
109};
110
111#endif /* __KERNEL__ */
112
113static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1,
114 const struct ip_conntrack_tuple *t2)
115{
116 return t1->src.ip == t2->src.ip
117 && t1->src.u.all == t2->src.u.all;
118}
119
120static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1,
121 const struct ip_conntrack_tuple *t2)
122{
123 return t1->dst.ip == t2->dst.ip
124 && t1->dst.u.all == t2->dst.u.all
125 && t1->dst.protonum == t2->dst.protonum;
126}
127
128static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1,
129 const struct ip_conntrack_tuple *t2)
130{
131 return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2);
132}
133
134static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t,
135 const struct ip_conntrack_tuple *tuple,
136 const struct ip_conntrack_tuple *mask)
137{
138 return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip)
139 || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip)
140 || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all)
141 || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all)
142 || ((t->dst.protonum ^ tuple->dst.protonum)
143 & mask->dst.protonum));
144}
145
146#endif /* _IP_CONNTRACK_TUPLE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 100644
index bdf553620ca1..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef _IP_NAT_H
2#define _IP_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
5
6#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum ip_nat_manip_type
9{
10 IP_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST
12};
13
14/* SRC manip occurs POST_ROUTING or LOCAL_IN */
15#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
16
17#define IP_NAT_RANGE_MAP_IPS 1
18#define IP_NAT_RANGE_PROTO_SPECIFIED 2
19
20/* NAT sequence number modifications */
21struct ip_nat_seq {
22 /* position of the last TCP sequence number
23 * modification (if any) */
24 u_int32_t correction_pos;
25 /* sequence number offset before and after last modification */
26 int16_t offset_before, offset_after;
27};
28
29/* Single range specification. */
30struct ip_nat_range
31{
32 /* Set to OR of flags above. */
33 unsigned int flags;
34
35 /* Inclusive: network order. */
36 __be32 min_ip, max_ip;
37
38 /* Inclusive: network order */
39 union ip_conntrack_manip_proto min, max;
40};
41
42/* For backwards compat: don't use in modern code. */
43struct ip_nat_multi_range_compat
44{
45 unsigned int rangesize; /* Must be 1. */
46
47 /* hangs off end. */
48 struct ip_nat_range range[1];
49};
50
51#ifdef __KERNEL__
52#include <linux/list.h>
53
54/* Protects NAT hash tables, and NAT-private part of conntracks. */
55extern rwlock_t ip_nat_lock;
56
57/* The structure embedded in the conntrack structure. */
58struct ip_nat_info
59{
60 struct list_head bysource;
61 struct ip_nat_seq seq[IP_CT_DIR_MAX];
62};
63
64struct ip_conntrack;
65
66/* Set up the info structure to map into this range. */
67extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
68 const struct ip_nat_range *range,
69 unsigned int hooknum);
70
71/* Is this tuple already taken? (not by us)*/
72extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
73 const struct ip_conntrack *ignored_conntrack);
74
75#else /* !__KERNEL__: iptables wants this to compile. */
76#define ip_nat_multi_range ip_nat_multi_range_compat
77#endif /*__KERNEL__*/
78#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
deleted file mode 100644
index 60566f9fd7b3..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP_NAT_CORE_H
2#define _IP_NAT_CORE_H
3#include <linux/list.h>
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6/* This header used to share core functionality between the standalone
7 NAT module, and the compatibility layer's use of NAT for masquerading. */
8
9extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
10 enum ip_conntrack_info conntrackinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
deleted file mode 100644
index bf9cb105c885..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_helper.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _IP_NAT_HELPER_H
2#define _IP_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <linux/netfilter_ipv4/ip_conntrack.h>
6#include <linux/module.h>
7
8struct sk_buff;
9
10/* These return true or false. */
11extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
12 struct ip_conntrack *ct,
13 enum ip_conntrack_info ctinfo,
14 unsigned int match_offset,
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len);
18extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
19 struct ip_conntrack *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len);
25extern int ip_nat_seq_adjust(struct sk_buff **pskb,
26 struct ip_conntrack *ct,
27 enum ip_conntrack_info ctinfo);
28
29/* Setup NAT on this expected conntrack so it follows master, but goes
30 * to port ct->master->saved_proto. */
31extern void ip_nat_follow_master(struct ip_conntrack *ct,
32 struct ip_conntrack_expect *this);
33#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
deleted file mode 100644
index 36668bf0f373..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _NAT_PPTP_H
3#define _NAT_PPTP_H
4
5/* conntrack private data */
6struct ip_nat_pptp {
7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 __be16 pac_call_id; /* NAT'ed PAC call id */
9};
10
11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
deleted file mode 100644
index 612a43614e7b..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _IP_NAT_PROTOCOL_H
3#define _IP_NAT_PROTOCOL_H
4#include <linux/init.h>
5#include <linux/list.h>
6
7#include <linux/netfilter_ipv4/ip_nat.h>
8#include <linux/netfilter/nfnetlink_conntrack.h>
9
10struct iphdr;
11struct ip_nat_range;
12
13struct ip_nat_protocol
14{
15 /* Protocol name */
16 const char *name;
17
18 /* Protocol number. */
19 unsigned int protonum;
20
21 struct module *me;
22
23 /* Translate a packet to the target according to manip type.
24 Return true if succeeded. */
25 int (*manip_pkt)(struct sk_buff **pskb,
26 unsigned int iphdroff,
27 const struct ip_conntrack_tuple *tuple,
28 enum ip_nat_manip_type maniptype);
29
30 /* Is the manipable part of the tuple between min and max incl? */
31 int (*in_range)(const struct ip_conntrack_tuple *tuple,
32 enum ip_nat_manip_type maniptype,
33 const union ip_conntrack_manip_proto *min,
34 const union ip_conntrack_manip_proto *max);
35
36 /* Alter the per-proto part of the tuple (depending on
37 maniptype), to give a unique tuple in the given range if
38 possible; return false if not. Per-protocol part of tuple
39 is initialized to the incoming packet. */
40 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
41 const struct ip_nat_range *range,
42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack);
44
45 int (*range_to_nfattr)(struct sk_buff *skb,
46 const struct ip_nat_range *range);
47
48 int (*nfattr_to_range)(struct nfattr *tb[],
49 struct ip_nat_range *range);
50};
51
52/* Protocol registration. */
53extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
54extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
55
56extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
57extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
58
59/* Built-in protocols. */
60extern struct ip_nat_protocol ip_nat_protocol_tcp;
61extern struct ip_nat_protocol ip_nat_protocol_udp;
62extern struct ip_nat_protocol ip_nat_protocol_icmp;
63extern struct ip_nat_protocol ip_nat_unknown_protocol;
64
65extern int init_protocols(void) __init;
66extern void cleanup_protocols(void);
67extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
68
69extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
70 const struct ip_nat_range *range);
71extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
72 struct ip_nat_range *range);
73
74#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 100644
index 73b9552e6a89..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _IP_NAT_RULE_H
2#define _IP_NAT_RULE_H
3#include <linux/netfilter_ipv4/ip_conntrack.h>
4#include <linux/netfilter_ipv4/ip_tables.h>
5#include <linux/netfilter_ipv4/ip_nat.h>
6
7#ifdef __KERNEL__
8
9extern int ip_nat_rule_init(void) __init;
10extern void ip_nat_rule_cleanup(void);
11extern int ip_nat_rule_find(struct sk_buff **pskb,
12 unsigned int hooknum,
13 const struct net_device *in,
14 const struct net_device *out,
15 struct ip_conntrack *ct,
16 struct ip_nat_info *info);
17
18extern unsigned int
19alloc_null_binding(struct ip_conntrack *conntrack,
20 struct ip_nat_info *info,
21 unsigned int hooknum);
22
23extern unsigned int
24alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
25 struct ip_nat_info *info,
26 unsigned int hooknum);
27#endif
28#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 98d566c5e32a..9527296595cd 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -272,25 +272,9 @@ ipt_get_target(struct ipt_entry *e)
272#include <linux/init.h> 272#include <linux/init.h>
273extern void ipt_init(void) __init; 273extern void ipt_init(void) __init;
274 274
275#define ipt_register_target(tgt) \ 275extern int ipt_register_table(struct xt_table *table,
276({ (tgt)->family = AF_INET; \
277 xt_register_target(tgt); })
278#define ipt_unregister_target(tgt) xt_unregister_target(tgt)
279
280#define ipt_register_match(mtch) \
281({ (mtch)->family = AF_INET; \
282 xt_register_match(mtch); })
283#define ipt_unregister_match(mtch) xt_unregister_match(mtch)
284
285//#define ipt_register_table(tbl, repl) xt_register_table(AF_INET, tbl, repl)
286//#define ipt_unregister_table(tbl) xt_unregister_table(AF_INET, tbl)
287
288extern int ipt_register_table(struct ipt_table *table,
289 const struct ipt_replace *repl); 276 const struct ipt_replace *repl);
290extern void ipt_unregister_table(struct ipt_table *table); 277extern void ipt_unregister_table(struct xt_table *table);
291
292/* net/sched/ipt.c: Gimme access to your targets! Gets target->me. */
293extern struct ipt_target *ipt_find_target(const char *name, u8 revision);
294 278
295/* Standard entry. */ 279/* Standard entry. */
296struct ipt_standard 280struct ipt_standard
@@ -315,7 +299,7 @@ extern unsigned int ipt_do_table(struct sk_buff **pskb,
315 unsigned int hook, 299 unsigned int hook,
316 const struct net_device *in, 300 const struct net_device *in,
317 const struct net_device *out, 301 const struct net_device *out,
318 struct ipt_table *table); 302 struct xt_table *table);
319 303
320#define IPT_ALIGN(s) XT_ALIGN(s) 304#define IPT_ALIGN(s) XT_ALIGN(s)
321 305
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index cc4c0b2269af..be6e682a85ec 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -13,7 +13,7 @@ struct ipt_same_info
13 u_int32_t *iparray; 13 u_int32_t *iparray;
14 14
15 /* hangs off end. */ 15 /* hangs off end. */
16 struct ip_nat_range range[IPT_SAME_MAX_RANGE]; 16 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
17}; 17};
18 18
19#endif /*_IPT_SAME_H*/ 19#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/include/linux/netfilter_ipv4/ipt_TCPMSS.h
index aadb39580cd3..7a850f945824 100644
--- a/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ b/include/linux/netfilter_ipv4/ipt_TCPMSS.h
@@ -1,10 +1,9 @@
1#ifndef _IPT_TCPMSS_H 1#ifndef _IPT_TCPMSS_H
2#define _IPT_TCPMSS_H 2#define _IPT_TCPMSS_H
3 3
4struct ipt_tcpmss_info { 4#include <linux/netfilter/xt_TCPMSS.h>
5 u_int16_t mss;
6};
7 5
8#define IPT_TCPMSS_CLAMP_PMTU 0xffff 6#define ipt_tcpmss_info xt_tcpmss_info
7#define IPT_TCPMSS_CLAMP_PMTU XT_TCPMSS_CLAMP_PMTU
9 8
10#endif /*_IPT_TCPMSS_H*/ 9#endif /*_IPT_TCPMSS_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 4aed340401db..61aa10412fc8 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -104,6 +104,25 @@ struct ip6t_entry
104 unsigned char elems[0]; 104 unsigned char elems[0];
105}; 105};
106 106
107/* Standard entry */
108struct ip6t_standard
109{
110 struct ip6t_entry entry;
111 struct ip6t_standard_target target;
112};
113
114struct ip6t_error_target
115{
116 struct ip6t_entry_target target;
117 char errorname[IP6T_FUNCTION_MAXNAMELEN];
118};
119
120struct ip6t_error
121{
122 struct ip6t_entry entry;
123 struct ip6t_error_target target;
124};
125
107/* 126/*
108 * New IP firewall options for [gs]etsockopt at the RAW IP level. 127 * New IP firewall options for [gs]etsockopt at the RAW IP level.
109 * Unlike BSD Linux inherits IP options so you don't have to use 128 * Unlike BSD Linux inherits IP options so you don't have to use
@@ -286,24 +305,14 @@ ip6t_get_target(struct ip6t_entry *e)
286#include <linux/init.h> 305#include <linux/init.h>
287extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
288 307
289#define ip6t_register_target(tgt) \ 308extern int ip6t_register_table(struct xt_table *table,
290({ (tgt)->family = AF_INET6; \
291 xt_register_target(tgt); })
292#define ip6t_unregister_target(tgt) xt_unregister_target(tgt)
293
294#define ip6t_register_match(match) \
295({ (match)->family = AF_INET6; \
296 xt_register_match(match); })
297#define ip6t_unregister_match(match) xt_unregister_match(match)
298
299extern int ip6t_register_table(struct ip6t_table *table,
300 const struct ip6t_replace *repl); 309 const struct ip6t_replace *repl);
301extern void ip6t_unregister_table(struct ip6t_table *table); 310extern void ip6t_unregister_table(struct xt_table *table);
302extern unsigned int ip6t_do_table(struct sk_buff **pskb, 311extern unsigned int ip6t_do_table(struct sk_buff **pskb,
303 unsigned int hook, 312 unsigned int hook,
304 const struct net_device *in, 313 const struct net_device *in,
305 const struct net_device *out, 314 const struct net_device *out,
306 struct ip6t_table *table); 315 struct xt_table *table);
307 316
308/* Check for an extension */ 317/* Check for an extension */
309extern int ip6t_ext_hdr(u8 nexthdr); 318extern int ip6t_ext_hdr(u8 nexthdr);
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h
new file mode 100644
index 000000000000..b9ca9a5f74d0
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_mh.h
@@ -0,0 +1,15 @@
1#ifndef _IP6T_MH_H
2#define _IP6T_MH_H
3
4/* MH matching stuff */
5struct ip6t_mh
6{
7 u_int8_t types[2]; /* MH type range */
8 u_int8_t invflags; /* Inverse flags */
9};
10
11/* Values for "invflags" field in struct ip6t_mh. */
12#define IP6T_MH_INV_TYPE 0x01 /* Invert the sense of type. */
13#define IP6T_MH_INV_MASK 0x01 /* All possible flags. */
14
15#endif /*_IP6T_MH_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index b3b9b609ee89..f41688f56632 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -23,6 +23,7 @@
23#define NETLINK_GENERIC 16 23#define NETLINK_GENERIC 16
24/* leave room for NETLINK_DM (DM Events) */ 24/* leave room for NETLINK_DM (DM Events) */
25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ 25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
26#define NETLINK_ECRYPTFS 19
26 27
27#define MAX_LINKS 32 28#define MAX_LINKS 32
28 29
@@ -137,6 +138,11 @@ struct nlattr
137#include <linux/capability.h> 138#include <linux/capability.h>
138#include <linux/skbuff.h> 139#include <linux/skbuff.h>
139 140
141static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
142{
143 return (struct nlmsghdr *)skb->data;
144}
145
140struct netlink_skb_parms 146struct netlink_skb_parms
141{ 147{
142 struct ucred creds; /* Skb credentials */ 148 struct ucred creds; /* Skb credentials */
@@ -151,7 +157,10 @@ struct netlink_skb_parms
151#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 157#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
152 158
153 159
154extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 160extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex,
163 struct module *module);
155extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
156extern int netlink_has_listeners(struct sock *sk, unsigned int group); 165extern int netlink_has_listeners(struct sock *sk, unsigned int group);
157extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
@@ -170,9 +179,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
170 179
171/* 180/*
172 * skb should fit one page. This choice is good for headerless malloc. 181 * skb should fit one page. This choice is good for headerless malloc.
182 * But we should limit to 8K so that userspace does not have to
183 * use enormous buffer sizes on recvmsg() calls just to avoid
184 * MSG_TRUNC when PAGE_SIZE is very large.
173 */ 185 */
174#define NLMSG_GOODORDER 0 186#if PAGE_SIZE < 8192UL
175#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 187#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
188#else
189#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
190#endif
191
176#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) 192#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
177 193
178 194
@@ -216,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
216#define NLMSG_PUT(skb, pid, seq, type, len) \ 232#define NLMSG_PUT(skb, pid, seq, type, len) \
217 NLMSG_NEW(skb, pid, seq, type, len, 0) 233 NLMSG_NEW(skb, pid, seq, type, len, 0)
218 234
219#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
220 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
221 (cb)->nlh->nlmsg_seq, type, len, flags)
222
223#define NLMSG_END(skb, nlh) \
224({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
225 (skb)->len; })
226
227#define NLMSG_CANCEL(skb, nlh) \
228({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
229 -1; })
230
231extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 235extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
232 struct nlmsghdr *nlh, 236 struct nlmsghdr *nlh,
233 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 237 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index db05182ca0e8..1be5be88debe 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -105,12 +105,11 @@ struct nfs4_ace {
105 uint32_t access_mask; 105 uint32_t access_mask;
106 int whotype; 106 int whotype;
107 uid_t who; 107 uid_t who;
108 struct list_head l_ace;
109}; 108};
110 109
111struct nfs4_acl { 110struct nfs4_acl {
112 uint32_t naces; 111 uint32_t naces;
113 struct list_head ace_head; 112 struct nfs4_ace aces[0];
114}; 113};
115 114
116typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 115typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
diff --git a/include/linux/nfs4_acl.h b/include/linux/nfs4_acl.h
index 22aff4d01f20..409b6e02f337 100644
--- a/include/linux/nfs4_acl.h
+++ b/include/linux/nfs4_acl.h
@@ -39,9 +39,12 @@
39 39
40#include <linux/posix_acl.h> 40#include <linux/posix_acl.h>
41 41
42struct nfs4_acl *nfs4_acl_new(void); 42/* Maximum ACL we'll accept from client; chosen (somewhat arbitrarily) to
43void nfs4_acl_free(struct nfs4_acl *); 43 * fit in a page: */
44int nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t); 44#define NFS4_ACL_MAX 170
45
46struct nfs4_acl *nfs4_acl_new(int);
47void nfs4_acl_add_ace(struct nfs4_acl *, u32, u32, u32, int, uid_t);
45int nfs4_acl_get_whotype(char *, u32); 48int nfs4_acl_get_whotype(char *, u32);
46int nfs4_acl_write_who(int who, char *p); 49int nfs4_acl_write_who(int who, char *p);
47int nfs4_acl_permission(struct nfs4_acl *acl, uid_t owner, gid_t group, 50int nfs4_acl_permission(struct nfs4_acl *acl, uid_t owner, gid_t group,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c5d4084773e8..e9ae0c6e2c62 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -11,14 +11,6 @@
11 11
12#include <linux/magic.h> 12#include <linux/magic.h>
13 13
14/*
15 * Enable debugging support for nfs client.
16 * Requires RPC_DEBUG.
17 */
18#ifdef RPC_DEBUG
19# define NFS_DEBUG
20#endif
21
22/* Default timeout values */ 14/* Default timeout values */
23#define NFS_MAX_UDP_TIMEOUT (60*HZ) 15#define NFS_MAX_UDP_TIMEOUT (60*HZ)
24#define NFS_MAX_TCP_TIMEOUT (600*HZ) 16#define NFS_MAX_TCP_TIMEOUT (600*HZ)
@@ -331,9 +323,9 @@ static inline void nfs_fattr_init(struct nfs_fattr *fattr)
331/* 323/*
332 * linux/fs/nfs/file.c 324 * linux/fs/nfs/file.c
333 */ 325 */
334extern struct inode_operations nfs_file_inode_operations; 326extern const struct inode_operations nfs_file_inode_operations;
335#ifdef CONFIG_NFS_V3 327#ifdef CONFIG_NFS_V3
336extern struct inode_operations nfs3_file_inode_operations; 328extern const struct inode_operations nfs3_file_inode_operations;
337#endif /* CONFIG_NFS_V3 */ 329#endif /* CONFIG_NFS_V3 */
338extern const struct file_operations nfs_file_operations; 330extern const struct file_operations nfs_file_operations;
339extern const struct address_space_operations nfs_file_aops; 331extern const struct address_space_operations nfs_file_aops;
@@ -380,9 +372,9 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
380/* 372/*
381 * linux/fs/nfs/dir.c 373 * linux/fs/nfs/dir.c
382 */ 374 */
383extern struct inode_operations nfs_dir_inode_operations; 375extern const struct inode_operations nfs_dir_inode_operations;
384#ifdef CONFIG_NFS_V3 376#ifdef CONFIG_NFS_V3
385extern struct inode_operations nfs3_dir_inode_operations; 377extern const struct inode_operations nfs3_dir_inode_operations;
386#endif /* CONFIG_NFS_V3 */ 378#endif /* CONFIG_NFS_V3 */
387extern const struct file_operations nfs_dir_operations; 379extern const struct file_operations nfs_dir_operations;
388extern struct dentry_operations nfs_dentry_operations; 380extern struct dentry_operations nfs_dentry_operations;
@@ -392,7 +384,7 @@ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_
392/* 384/*
393 * linux/fs/nfs/symlink.c 385 * linux/fs/nfs/symlink.c
394 */ 386 */
395extern struct inode_operations nfs_symlink_inode_operations; 387extern const struct inode_operations nfs_symlink_inode_operations;
396 388
397/* 389/*
398 * linux/fs/nfs/sysctl.c 390 * linux/fs/nfs/sysctl.c
@@ -409,8 +401,8 @@ extern void nfs_unregister_sysctl(void);
409 * linux/fs/nfs/namespace.c 401 * linux/fs/nfs/namespace.c
410 */ 402 */
411extern struct list_head nfs_automount_list; 403extern struct list_head nfs_automount_list;
412extern struct inode_operations nfs_mountpoint_inode_operations; 404extern const struct inode_operations nfs_mountpoint_inode_operations;
413extern struct inode_operations nfs_referral_inode_operations; 405extern const struct inode_operations nfs_referral_inode_operations;
414extern int nfs_mountpoint_expiry_timeout; 406extern int nfs_mountpoint_expiry_timeout;
415extern void nfs_release_automount_timer(void); 407extern void nfs_release_automount_timer(void);
416 408
@@ -423,6 +415,7 @@ extern void nfs_complete_unlink(struct dentry *);
423/* 415/*
424 * linux/fs/nfs/write.c 416 * linux/fs/nfs/write.c
425 */ 417 */
418extern int nfs_congestion_kb;
426extern int nfs_writepage(struct page *page, struct writeback_control *wbc); 419extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
427extern int nfs_writepages(struct address_space *, struct writeback_control *); 420extern int nfs_writepages(struct address_space *, struct writeback_control *);
428extern int nfs_flush_incompatible(struct file *file, struct page *page); 421extern int nfs_flush_incompatible(struct file *file, struct page *page);
@@ -567,6 +560,15 @@ extern void * nfs_root_data(void);
567#define NFSDBG_ALL 0xFFFF 560#define NFSDBG_ALL 0xFFFF
568 561
569#ifdef __KERNEL__ 562#ifdef __KERNEL__
563
564/*
565 * Enable debugging support for nfs client.
566 * Requires RPC_DEBUG.
567 */
568#ifdef RPC_DEBUG
569# define NFS_DEBUG
570#endif
571
570# undef ifdebug 572# undef ifdebug
571# ifdef NFS_DEBUG 573# ifdef NFS_DEBUG
572# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 574# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 95796e6924f1..c95d5e642548 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -82,6 +82,7 @@ struct nfs_server {
82 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 82 struct rpc_clnt * client_acl; /* ACL RPC client handle */
83 struct nfs_iostats * io_stats; /* I/O statistics */ 83 struct nfs_iostats * io_stats; /* I/O statistics */
84 struct backing_dev_info backing_dev_info; 84 struct backing_dev_info backing_dev_info;
85 atomic_t writeback; /* number of writeback pages */
85 int flags; /* various flags */ 86 int flags; /* various flags */
86 unsigned int caps; /* server capabilities */ 87 unsigned int caps; /* server capabilities */
87 unsigned int rsize; /* read size */ 88 unsigned int rsize; /* read size */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 2e555d49c9b7..16b0266b14fd 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -31,7 +31,6 @@
31#define PG_NEED_COMMIT 1 31#define PG_NEED_COMMIT 1
32#define PG_NEED_RESCHED 2 32#define PG_NEED_RESCHED 2
33#define PG_NEED_FLUSH 3 33#define PG_NEED_FLUSH 3
34#define PG_FLUSHING 4
35 34
36struct nfs_inode; 35struct nfs_inode;
37struct nfs_page { 36struct nfs_page {
@@ -50,8 +49,6 @@ struct nfs_page {
50}; 49};
51 50
52#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 51#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
53#define NFS_NEED_COMMIT(req) (test_bit(PG_NEED_COMMIT,&(req)->wb_flags))
54#define NFS_NEED_RESCHED(req) (test_bit(PG_NEED_RESCHED,&(req)->wb_flags))
55 52
56extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, 53extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
57 struct inode *inode, 54 struct inode *inode,
@@ -122,34 +119,6 @@ nfs_list_remove_request(struct nfs_page *req)
122 req->wb_list_head = NULL; 119 req->wb_list_head = NULL;
123} 120}
124 121
125static inline int
126nfs_defer_commit(struct nfs_page *req)
127{
128 return !test_and_set_bit(PG_NEED_COMMIT, &req->wb_flags);
129}
130
131static inline void
132nfs_clear_commit(struct nfs_page *req)
133{
134 smp_mb__before_clear_bit();
135 clear_bit(PG_NEED_COMMIT, &req->wb_flags);
136 smp_mb__after_clear_bit();
137}
138
139static inline int
140nfs_defer_reschedule(struct nfs_page *req)
141{
142 return !test_and_set_bit(PG_NEED_RESCHED, &req->wb_flags);
143}
144
145static inline void
146nfs_clear_reschedule(struct nfs_page *req)
147{
148 smp_mb__before_clear_bit();
149 clear_bit(PG_NEED_RESCHED, &req->wb_flags);
150 smp_mb__after_clear_bit();
151}
152
153static inline struct nfs_page * 122static inline struct nfs_page *
154nfs_list_entry(struct list_head *head) 123nfs_list_entry(struct list_head *head)
155{ 124{
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9ee9da5e1cc9..10c26ed0db71 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -767,8 +767,8 @@ struct nfs_access_entry;
767struct nfs_rpc_ops { 767struct nfs_rpc_ops {
768 int version; /* Protocol version */ 768 int version; /* Protocol version */
769 struct dentry_operations *dentry_ops; 769 struct dentry_operations *dentry_ops;
770 struct inode_operations *dir_inode_ops; 770 const struct inode_operations *dir_inode_ops;
771 struct inode_operations *file_inode_ops; 771 const struct inode_operations *file_inode_ops;
772 772
773 int (*getroot) (struct nfs_server *, struct nfs_fh *, 773 int (*getroot) (struct nfs_server *, struct nfs_fh *,
774 struct nfs_fsinfo *); 774 struct nfs_fsinfo *);
@@ -784,7 +784,6 @@ struct nfs_rpc_ops {
784 int (*access) (struct inode *, struct nfs_access_entry *); 784 int (*access) (struct inode *, struct nfs_access_entry *);
785 int (*readlink)(struct inode *, struct page *, unsigned int, 785 int (*readlink)(struct inode *, struct page *, unsigned int,
786 unsigned int); 786 unsigned int);
787 int (*read) (struct nfs_read_data *);
788 int (*create) (struct inode *, struct dentry *, 787 int (*create) (struct inode *, struct dentry *,
789 struct iattr *, int, struct nameidata *); 788 struct iattr *, int, struct nameidata *);
790 int (*remove) (struct inode *, struct qstr *); 789 int (*remove) (struct inode *, struct qstr *);
diff --git a/include/linux/nfsd/const.h b/include/linux/nfsd/const.h
index f0cc77790527..323f8cfa060a 100644
--- a/include/linux/nfsd/const.h
+++ b/include/linux/nfsd/const.h
@@ -30,10 +30,6 @@
30 30
31#include <linux/sunrpc/msg_prot.h> 31#include <linux/sunrpc/msg_prot.h>
32 32
33#ifndef NFS_SUPER_MAGIC
34# define NFS_SUPER_MAGIC 0x6969
35#endif
36
37/* 33/*
38 * Largest number of bytes we need to allocate for an NFS 34 * Largest number of bytes we need to allocate for an NFS
39 * call or reply. Used to control buffer sizes. We use 35 * call or reply. Used to control buffer sizes. We use
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 045e38cdbe64..9f62d6182d32 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -74,19 +74,20 @@ struct svc_export {
74 uid_t ex_anon_uid; 74 uid_t ex_anon_uid;
75 gid_t ex_anon_gid; 75 gid_t ex_anon_gid;
76 int ex_fsid; 76 int ex_fsid;
77 unsigned char * ex_uuid; /* 16 byte fsid */
77 struct nfsd4_fs_locations ex_fslocs; 78 struct nfsd4_fs_locations ex_fslocs;
78}; 79};
79 80
80/* an "export key" (expkey) maps a filehandlefragement to an 81/* an "export key" (expkey) maps a filehandlefragement to an
81 * svc_export for a given client. There can be two per export, one 82 * svc_export for a given client. There can be several per export,
82 * for type 0 (dev/ino), one for type 1 (fsid) 83 * for the different fsid types.
83 */ 84 */
84struct svc_expkey { 85struct svc_expkey {
85 struct cache_head h; 86 struct cache_head h;
86 87
87 struct auth_domain * ek_client; 88 struct auth_domain * ek_client;
88 int ek_fsidtype; 89 int ek_fsidtype;
89 u32 ek_fsid[3]; 90 u32 ek_fsid[6];
90 91
91 struct vfsmount * ek_mnt; 92 struct vfsmount * ek_mnt;
92 struct dentry * ek_dentry; 93 struct dentry * ek_dentry;
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 4b7c4b568f6d..72feac581aa3 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -254,18 +254,6 @@ void nfsd_lockd_shutdown(void);
254 */ 254 */
255extern struct timeval nfssvc_boot; 255extern struct timeval nfssvc_boot;
256 256
257static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
258{
259 if (fh->fh_export->ex_flags & NFSEXP_FSID) {
260 struct vfsmount *mnt = fh->fh_export->ex_mnt;
261 if (!old_valid_dev(mnt->mnt_sb->s_dev) ||
262 (reffh->fh_version == 1 && reffh->fh_fsid_type == 1))
263 return 1;
264 }
265 return 0;
266}
267
268
269#ifdef CONFIG_NFSD_V4 257#ifdef CONFIG_NFSD_V4
270 258
271/* before processing a COMPOUND operation, we have to check that there 259/* before processing a COMPOUND operation, we have to check that there
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index d9c6c382165d..11e568ee0eeb 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -165,38 +165,91 @@ typedef struct svc_fh {
165 165
166} svc_fh; 166} svc_fh;
167 167
168static inline void mk_fsid_v0(u32 *fsidv, dev_t dev, ino_t ino) 168enum nfsd_fsid {
169{ 169 FSID_DEV = 0,
170 fsidv[0] = htonl((MAJOR(dev)<<16) | 170 FSID_NUM,
171 MINOR(dev)); 171 FSID_MAJOR_MINOR,
172 fsidv[1] = ino_t_to_u32(ino); 172 FSID_ENCODE_DEV,
173} 173 FSID_UUID4_INUM,
174 FSID_UUID8,
175 FSID_UUID16,
176 FSID_UUID16_INUM,
177};
174 178
175static inline void mk_fsid_v1(u32 *fsidv, u32 fsid) 179enum fsid_source {
176{ 180 FSIDSOURCE_DEV,
177 fsidv[0] = fsid; 181 FSIDSOURCE_FSID,
178} 182 FSIDSOURCE_UUID,
183};
184extern enum fsid_source fsid_source(struct svc_fh *fhp);
179 185
180static inline void mk_fsid_v2(u32 *fsidv, dev_t dev, ino_t ino)
181{
182 fsidv[0] = htonl(MAJOR(dev));
183 fsidv[1] = htonl(MINOR(dev));
184 fsidv[2] = ino_t_to_u32(ino);
185}
186 186
187static inline void mk_fsid_v3(u32 *fsidv, dev_t dev, ino_t ino) 187/* This might look a little large to "inline" but in all calls except
188 * one, 'vers' is constant so moste of the function disappears.
189 */
190static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino,
191 u32 fsid, unsigned char *uuid)
188{ 192{
189 fsidv[0] = new_encode_dev(dev); 193 u32 *up;
190 fsidv[1] = ino_t_to_u32(ino); 194 switch(vers) {
195 case FSID_DEV:
196 fsidv[0] = htonl((MAJOR(dev)<<16) |
197 MINOR(dev));
198 fsidv[1] = ino_t_to_u32(ino);
199 break;
200 case FSID_NUM:
201 fsidv[0] = fsid;
202 break;
203 case FSID_MAJOR_MINOR:
204 fsidv[0] = htonl(MAJOR(dev));
205 fsidv[1] = htonl(MINOR(dev));
206 fsidv[2] = ino_t_to_u32(ino);
207 break;
208
209 case FSID_ENCODE_DEV:
210 fsidv[0] = new_encode_dev(dev);
211 fsidv[1] = ino_t_to_u32(ino);
212 break;
213
214 case FSID_UUID4_INUM:
215 /* 4 byte fsid and inode number */
216 up = (u32*)uuid;
217 fsidv[0] = ino_t_to_u32(ino);
218 fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3];
219 break;
220
221 case FSID_UUID8:
222 /* 8 byte fsid */
223 up = (u32*)uuid;
224 fsidv[0] = up[0] ^ up[2];
225 fsidv[1] = up[1] ^ up[3];
226 break;
227
228 case FSID_UUID16:
229 /* 16 byte fsid - NFSv3+ only */
230 memcpy(fsidv, uuid, 16);
231 break;
232
233 case FSID_UUID16_INUM:
234 /* 8 byte inode and 16 byte fsid */
235 *(u64*)fsidv = (u64)ino;
236 memcpy(fsidv+2, uuid, 16);
237 break;
238 default: BUG();
239 }
191} 240}
192 241
193static inline int key_len(int type) 242static inline int key_len(int type)
194{ 243{
195 switch(type) { 244 switch(type) {
196 case 0: return 8; 245 case FSID_DEV: return 8;
197 case 1: return 4; 246 case FSID_NUM: return 4;
198 case 2: return 12; 247 case FSID_MAJOR_MINOR: return 12;
199 case 3: return 8; 248 case FSID_ENCODE_DEV: return 8;
249 case FSID_UUID4_INUM: return 8;
250 case FSID_UUID8: return 8;
251 case FSID_UUID16: return 16;
252 case FSID_UUID16_INUM: return 24;
200 default: return 0; 253 default: return 0;
201 } 254 }
202} 255}
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
new file mode 100644
index 000000000000..9a30ba2ca75e
--- /dev/null
+++ b/include/linux/nl80211.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_NL80211_H
2#define __LINUX_NL80211_H
3/*
4 * 802.11 netlink interface public header
5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
7 */
8
9/**
10 * enum nl80211_iftype - (virtual) interface types
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member
14 * @NL80211_IFTYPE_AP: access point
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 *
20 * These values are used with the NL80211_ATTR_IFTYPE
21 * to set the type of an interface.
22 *
23 */
24enum nl80211_iftype {
25 NL80211_IFTYPE_UNSPECIFIED,
26 NL80211_IFTYPE_ADHOC,
27 NL80211_IFTYPE_STATION,
28 NL80211_IFTYPE_AP,
29 NL80211_IFTYPE_AP_VLAN,
30 NL80211_IFTYPE_WDS,
31 NL80211_IFTYPE_MONITOR,
32
33 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST
35};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37
38#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index acb4ed130247..29af2d5df097 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -17,8 +17,15 @@
17#ifdef ARCH_HAS_NMI_WATCHDOG 17#ifdef ARCH_HAS_NMI_WATCHDOG
18#include <asm/nmi.h> 18#include <asm/nmi.h>
19extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
20extern void acpi_nmi_disable(void);
21extern void acpi_nmi_enable(void);
20#else 22#else
21# define touch_nmi_watchdog() touch_softlockup_watchdog() 23static inline void touch_nmi_watchdog(void)
24{
25 touch_softlockup_watchdog();
26}
27static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { }
22#endif 29#endif
23 30
24#ifndef trigger_all_cpu_backtrace 31#ifndef trigger_all_cpu_backtrace
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index b1063e9cdb1b..52c54a5720f3 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -352,7 +352,7 @@ extern nodemask_t node_possible_map;
352#define node_possible(node) node_isset((node), node_possible_map) 352#define node_possible(node) node_isset((node), node_possible_map)
353#define first_online_node first_node(node_online_map) 353#define first_online_node first_node(node_online_map)
354#define next_online_node(nid) next_node((nid), node_online_map) 354#define next_online_node(nid) next_node((nid), node_online_map)
355int highest_possible_node_id(void); 355extern int nr_node_ids;
356#else 356#else
357#define num_online_nodes() 1 357#define num_online_nodes() 1
358#define num_possible_nodes() 1 358#define num_possible_nodes() 1
@@ -360,7 +360,7 @@ int highest_possible_node_id(void);
360#define node_possible(node) ((node) == 0) 360#define node_possible(node) ((node) == 0)
361#define first_online_node 0 361#define first_online_node 0
362#define next_online_node(nid) (MAX_NUMNODES) 362#define next_online_node(nid) (MAX_NUMNODES)
363#define highest_possible_node_id() 0 363#define nr_node_ids 1
364#endif 364#endif
365 365
366#define any_online_node(mask) \ 366#define any_online_node(mask) \
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 350878a2d848..96326594e55d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -76,7 +76,7 @@
76#define PG_active 6 76#define PG_active 6
77#define PG_slab 7 /* slab debug (Suparna wants this) */ 77#define PG_slab 7 /* slab debug (Suparna wants this) */
78 78
79#define PG_checked 8 /* kill me in 2.5.<early>. */ 79#define PG_owner_priv_1 8 /* Owner use. If pagecache, fs may use*/
80#define PG_arch_1 9 80#define PG_arch_1 9
81#define PG_reserved 10 81#define PG_reserved 10
82#define PG_private 11 /* If pagecache, has fs-private data */ 82#define PG_private 11 /* If pagecache, has fs-private data */
@@ -91,6 +91,8 @@
91#define PG_nosave_free 18 /* Used for system suspend/resume */ 91#define PG_nosave_free 18 /* Used for system suspend/resume */
92#define PG_buddy 19 /* Page is free, on buddy lists */ 92#define PG_buddy 19 /* Page is free, on buddy lists */
93 93
94/* PG_owner_priv_1 users should have descriptive aliases */
95#define PG_checked PG_owner_priv_1 /* Used by some filesystems */
94 96
95#if (BITS_PER_LONG > 32) 97#if (BITS_PER_LONG > 32)
96/* 98/*
@@ -131,7 +133,7 @@
131static inline void SetPageUptodate(struct page *page) 133static inline void SetPageUptodate(struct page *page)
132{ 134{
133 if (!test_and_set_bit(PG_uptodate, &page->flags)) 135 if (!test_and_set_bit(PG_uptodate, &page->flags))
134 page_test_and_clear_dirty(page); 136 page_clear_dirty(page);
135} 137}
136#else 138#else
137#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags) 139#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index c3e255bf8594..7a8dcb82a699 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -76,8 +76,6 @@ extern struct page * find_get_page(struct address_space *mapping,
76 unsigned long index); 76 unsigned long index);
77extern struct page * find_lock_page(struct address_space *mapping, 77extern struct page * find_lock_page(struct address_space *mapping,
78 unsigned long index); 78 unsigned long index);
79extern __deprecated_for_modules struct page * find_trylock_page(
80 struct address_space *mapping, unsigned long index);
81extern struct page * find_or_create_page(struct address_space *mapping, 79extern struct page * find_or_create_page(struct address_space *mapping,
82 unsigned long index, gfp_t gfp_mask); 80 unsigned long index, gfp_t gfp_mask);
83unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 81unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f3c617eabd8d..972491089ac9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -167,6 +167,7 @@ struct pci_dev {
167 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 167 unsigned int broken_parity_status:1; /* Device generates false positive parity */
168 unsigned int msi_enabled:1; 168 unsigned int msi_enabled:1;
169 unsigned int msix_enabled:1; 169 unsigned int msix_enabled:1;
170 unsigned int is_managed:1;
170 atomic_t enable_cnt; /* pci_enable_device has been called */ 171 atomic_t enable_cnt; /* pci_enable_device has been called */
171 172
172 u32 saved_config_space[16]; /* config space saved at suspend time */ 173 u32 saved_config_space[16]; /* config space saved at suspend time */
@@ -174,6 +175,9 @@ struct pci_dev {
174 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */ 175 struct bin_attribute *rom_attr; /* attribute descriptor for sysfs ROM entry */
175 int rom_attr_enabled; /* has display of the rom attribute been enabled? */ 176 int rom_attr_enabled; /* has display of the rom attribute been enabled? */
176 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */ 177 struct bin_attribute *res_attr[DEVICE_COUNT_RESOURCE]; /* sysfs file for resources */
178#ifdef CONFIG_PCI_MSI
179 unsigned int first_msi_irq;
180#endif
177}; 181};
178 182
179#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) 183#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
@@ -181,6 +185,11 @@ struct pci_dev {
181#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 185#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
182#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 186#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
183 187
188static inline int pci_channel_offline(struct pci_dev *pdev)
189{
190 return (pdev->error_state != pci_channel_io_normal);
191}
192
184static inline struct pci_cap_saved_state *pci_find_saved_cap( 193static inline struct pci_cap_saved_state *pci_find_saved_cap(
185 struct pci_dev *pci_dev,char cap) 194 struct pci_dev *pci_dev,char cap)
186{ 195{
@@ -200,11 +209,6 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
200 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 209 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
201} 210}
202 211
203static inline void pci_remove_saved_cap(struct pci_cap_saved_state *cap)
204{
205 hlist_del(&cap->next);
206}
207
208/* 212/*
209 * For PCI devices, the region numbers are assigned this way: 213 * For PCI devices, the region numbers are assigned this way:
210 * 214 *
@@ -357,8 +361,6 @@ struct pci_driver {
357 struct pci_error_handlers *err_handler; 361 struct pci_error_handlers *err_handler;
358 struct device_driver driver; 362 struct device_driver driver;
359 struct pci_dynids dynids; 363 struct pci_dynids dynids;
360
361 int multithread_probe;
362}; 364};
363 365
364#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 366#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver)
@@ -463,8 +465,7 @@ extern void pci_sort_breadthfirst(void);
463 465
464/* Generic PCI functions exported to card drivers */ 466/* Generic PCI functions exported to card drivers */
465 467
466struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 468struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from);
467struct pci_dev *pci_find_device_reverse (unsigned int vendor, unsigned int device, const struct pci_dev *from);
468struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); 469struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
469int pci_find_capability (struct pci_dev *dev, int cap); 470int pci_find_capability (struct pci_dev *dev, int cap);
470int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 471int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
@@ -521,18 +522,28 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
521 522
522int __must_check pci_enable_device(struct pci_dev *dev); 523int __must_check pci_enable_device(struct pci_dev *dev);
523int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 524int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
525int __must_check pcim_enable_device(struct pci_dev *pdev);
526void pcim_pin_device(struct pci_dev *pdev);
527
528static inline int pci_is_managed(struct pci_dev *pdev)
529{
530 return pdev->is_managed;
531}
532
524void pci_disable_device(struct pci_dev *dev); 533void pci_disable_device(struct pci_dev *dev);
525void pci_set_master(struct pci_dev *dev); 534void pci_set_master(struct pci_dev *dev);
526#define HAVE_PCI_SET_MWI 535#define HAVE_PCI_SET_MWI
527int __must_check pci_set_mwi(struct pci_dev *dev); 536int __must_check pci_set_mwi(struct pci_dev *dev);
528void pci_clear_mwi(struct pci_dev *dev); 537void pci_clear_mwi(struct pci_dev *dev);
529void pci_intx(struct pci_dev *dev, int enable); 538void pci_intx(struct pci_dev *dev, int enable);
539void pci_msi_off(struct pci_dev *dev);
530int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 540int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
531int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 541int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
532void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 542void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
533int __must_check pci_assign_resource(struct pci_dev *dev, int i); 543int __must_check pci_assign_resource(struct pci_dev *dev, int i);
534int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); 544int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
535void pci_restore_bars(struct pci_dev *dev); 545void pci_restore_bars(struct pci_dev *dev);
546int pci_select_bars(struct pci_dev *dev, unsigned long flags);
536 547
537/* ROM control related routines */ 548/* ROM control related routines */
538void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 549void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
@@ -561,6 +572,8 @@ int __must_check pci_request_regions(struct pci_dev *, const char *);
561void pci_release_regions(struct pci_dev *); 572void pci_release_regions(struct pci_dev *);
562int __must_check pci_request_region(struct pci_dev *, int, const char *); 573int __must_check pci_request_region(struct pci_dev *, int, const char *);
563void pci_release_region(struct pci_dev *, int); 574void pci_release_region(struct pci_dev *, int);
575int pci_request_selected_regions(struct pci_dev *, int, const char *);
576void pci_release_selected_regions(struct pci_dev *, int);
564 577
565/* drivers/pci/bus.c */ 578/* drivers/pci/bus.c */
566int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 579int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
@@ -573,10 +586,11 @@ int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
573void pci_enable_bridges(struct pci_bus *bus); 586void pci_enable_bridges(struct pci_bus *bus);
574 587
575/* Proper probing supporting hot-pluggable devices */ 588/* Proper probing supporting hot-pluggable devices */
576int __must_check __pci_register_driver(struct pci_driver *, struct module *); 589int __must_check __pci_register_driver(struct pci_driver *, struct module *,
590 const char *mod_name);
577static inline int __must_check pci_register_driver(struct pci_driver *driver) 591static inline int __must_check pci_register_driver(struct pci_driver *driver)
578{ 592{
579 return __pci_register_driver(driver, THIS_MODULE); 593 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
580} 594}
581 595
582void pci_unregister_driver(struct pci_driver *); 596void pci_unregister_driver(struct pci_driver *);
@@ -611,10 +625,6 @@ enum pci_dma_burst_strategy {
611 strategy_parameter byte boundaries */ 625 strategy_parameter byte boundaries */
612}; 626};
613 627
614#if defined(CONFIG_ISA) || defined(CONFIG_EISA)
615extern struct pci_dev *isa_bridge;
616#endif
617
618struct msix_entry { 628struct msix_entry {
619 u16 vector; /* kernel uses to write allocated vector */ 629 u16 vector; /* kernel uses to write allocated vector */
620 u16 entry; /* driver uses to specify entry, OS writes */ 630 u16 entry; /* driver uses to specify entry, OS writes */
@@ -622,7 +632,6 @@ struct msix_entry {
622 632
623 633
624#ifndef CONFIG_PCI_MSI 634#ifndef CONFIG_PCI_MSI
625static inline void pci_scan_msi_device(struct pci_dev *dev) {}
626static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} 635static inline int pci_enable_msi(struct pci_dev *dev) {return -1;}
627static inline void pci_disable_msi(struct pci_dev *dev) {} 636static inline void pci_disable_msi(struct pci_dev *dev) {}
628static inline int pci_enable_msix(struct pci_dev* dev, 637static inline int pci_enable_msix(struct pci_dev* dev,
@@ -630,7 +639,6 @@ static inline int pci_enable_msix(struct pci_dev* dev,
630static inline void pci_disable_msix(struct pci_dev *dev) {} 639static inline void pci_disable_msix(struct pci_dev *dev) {}
631static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 640static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
632#else 641#else
633extern void pci_scan_msi_device(struct pci_dev *dev);
634extern int pci_enable_msi(struct pci_dev *dev); 642extern int pci_enable_msi(struct pci_dev *dev);
635extern void pci_disable_msi(struct pci_dev *dev); 643extern void pci_disable_msi(struct pci_dev *dev);
636extern int pci_enable_msix(struct pci_dev* dev, 644extern int pci_enable_msix(struct pci_dev* dev,
@@ -722,8 +730,6 @@ static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) {
722static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 730static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; }
723static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } 731static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; }
724 732
725#define isa_bridge ((struct pci_dev *)NULL)
726
727#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 733#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
728 734
729static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 735static inline void pci_block_user_cfg_access(struct pci_dev *dev) { }
@@ -828,6 +834,12 @@ enum pci_fixup_pass {
828 834
829void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 835void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
830 836
837void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
838void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
839void __iomem * const * pcim_iomap_table(struct pci_dev *pdev);
840int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
841void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
842
831extern int pci_pci_problems; 843extern int pci_pci_problems;
832#define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 844#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
833#define PCIPCI_TRITON 2 845#define PCIPCI_TRITON 2
@@ -837,5 +849,8 @@ extern int pci_pci_problems;
837#define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ 849#define PCIPCI_ALIMAGIK 32 /* Need low latency setting */
838#define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ 850#define PCIAGP_FAIL 64 /* No PCI to AGP DMA */
839 851
852extern unsigned long pci_cardbus_io_size;
853extern unsigned long pci_cardbus_mem_size;
854
840#endif /* __KERNEL__ */ 855#endif /* __KERNEL__ */
841#endif /* LINUX_PCI_H */ 856#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f7a416c52edc..1b0ddbb8a804 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -15,6 +15,8 @@
15#define PCI_CLASS_STORAGE_FLOPPY 0x0102 15#define PCI_CLASS_STORAGE_FLOPPY 0x0102
16#define PCI_CLASS_STORAGE_IPI 0x0103 16#define PCI_CLASS_STORAGE_IPI 0x0103
17#define PCI_CLASS_STORAGE_RAID 0x0104 17#define PCI_CLASS_STORAGE_RAID 0x0104
18#define PCI_CLASS_STORAGE_SATA 0x0106
19#define PCI_CLASS_STORAGE_SATA_AHCI 0x010601
18#define PCI_CLASS_STORAGE_SAS 0x0107 20#define PCI_CLASS_STORAGE_SAS 0x0107
19#define PCI_CLASS_STORAGE_OTHER 0x0180 21#define PCI_CLASS_STORAGE_OTHER 0x0180
20 22
@@ -95,6 +97,7 @@
95 97
96#define PCI_BASE_CLASS_SERIAL 0x0c 98#define PCI_BASE_CLASS_SERIAL 0x0c
97#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 99#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00
100#define PCI_CLASS_SERIAL_FIREWIRE_OHCI 0x0c0010
98#define PCI_CLASS_SERIAL_ACCESS 0x0c01 101#define PCI_CLASS_SERIAL_ACCESS 0x0c01
99#define PCI_CLASS_SERIAL_SSA 0x0c02 102#define PCI_CLASS_SERIAL_SSA 0x0c02
100#define PCI_CLASS_SERIAL_USB 0x0c03 103#define PCI_CLASS_SERIAL_USB 0x0c03
@@ -365,7 +368,7 @@
365#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 368#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379
366#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a 369#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a
367#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 370#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380
368#define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381 371#define PCI_DEVICE_ID_ATI_IXP600_SMBUS 0x4385
369#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c 372#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c
370 373
371#define PCI_VENDOR_ID_VLSI 0x1004 374#define PCI_VENDOR_ID_VLSI 0x1004
@@ -735,9 +738,11 @@
735#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 738#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
736#define PCI_DEVICE_ID_TI_4450 0x8011 739#define PCI_DEVICE_ID_TI_4450 0x8011
737#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 740#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
741#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033
738#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 742#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
739#define PCI_DEVICE_ID_TI_X515 0x8036 743#define PCI_DEVICE_ID_TI_X515 0x8036
740#define PCI_DEVICE_ID_TI_XX12 0x8039 744#define PCI_DEVICE_ID_TI_XX12 0x8039
745#define PCI_DEVICE_ID_TI_XX12_FM 0x803b
741#define PCI_DEVICE_ID_TI_1130 0xac12 746#define PCI_DEVICE_ID_TI_1130 0xac12
742#define PCI_DEVICE_ID_TI_1031 0xac13 747#define PCI_DEVICE_ID_TI_1031 0xac13
743#define PCI_DEVICE_ID_TI_1131 0xac15 748#define PCI_DEVICE_ID_TI_1131 0xac15
@@ -765,6 +770,7 @@
765#define PCI_DEVICE_ID_TI_1510 0xac56 770#define PCI_DEVICE_ID_TI_1510 0xac56
766#define PCI_DEVICE_ID_TI_X620 0xac8d 771#define PCI_DEVICE_ID_TI_X620 0xac8d
767#define PCI_DEVICE_ID_TI_X420 0xac8e 772#define PCI_DEVICE_ID_TI_X420 0xac8e
773#define PCI_DEVICE_ID_TI_XX20_FM 0xac8f
768 774
769#define PCI_VENDOR_ID_SONY 0x104d 775#define PCI_VENDOR_ID_SONY 0x104d
770 776
@@ -953,6 +959,7 @@
953#define PCI_DEVICE_ID_PLX_R753 0x1152 959#define PCI_DEVICE_ID_PLX_R753 0x1152
954#define PCI_DEVICE_ID_PLX_OLITEC 0x1187 960#define PCI_DEVICE_ID_PLX_OLITEC 0x1187
955#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 961#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196
962#define PCI_DEVICE_ID_PLX_9030 0x9030
956#define PCI_DEVICE_ID_PLX_9050 0x9050 963#define PCI_DEVICE_ID_PLX_9050 0x9050
957#define PCI_DEVICE_ID_PLX_9080 0x9080 964#define PCI_DEVICE_ID_PLX_9080 0x9080
958#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 965#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
@@ -1277,13 +1284,13 @@
1277#define PCI_DEVICE_ID_VIA_3296_0 0x0296 1284#define PCI_DEVICE_ID_VIA_3296_0 0x0296
1278#define PCI_DEVICE_ID_VIA_8363_0 0x0305 1285#define PCI_DEVICE_ID_VIA_8363_0 0x0305
1279#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 1286#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
1280#define PCI_DEVICE_ID_VIA_K8M890CE 0x0336 1287#define PCI_DEVICE_ID_VIA_P4M890 0x0327
1288#define PCI_DEVICE_ID_VIA_VT3336 0x0336
1281#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1289#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1282#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1290#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1283#define PCI_DEVICE_ID_VIA_82C561 0x0561 1291#define PCI_DEVICE_ID_VIA_82C561 0x0561
1284#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 1292#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
1285#define PCI_DEVICE_ID_VIA_82C576 0x0576 1293#define PCI_DEVICE_ID_VIA_82C576 0x0576
1286#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x0581
1287#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 1294#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
1288#define PCI_DEVICE_ID_VIA_82C596 0x0596 1295#define PCI_DEVICE_ID_VIA_82C596 0x0596
1289#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 1296#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
@@ -1326,6 +1333,8 @@
1326#define PCI_DEVICE_ID_VIA_8237 0x3227 1333#define PCI_DEVICE_ID_VIA_8237 0x3227
1327#define PCI_DEVICE_ID_VIA_8251 0x3287 1334#define PCI_DEVICE_ID_VIA_8251 0x3287
1328#define PCI_DEVICE_ID_VIA_8237A 0x3337 1335#define PCI_DEVICE_ID_VIA_8237A 0x3337
1336#define PCI_DEVICE_ID_VIA_8237S 0x3372
1337#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x5324
1329#define PCI_DEVICE_ID_VIA_8231 0x8231 1338#define PCI_DEVICE_ID_VIA_8231 0x8231
1330#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1339#define PCI_DEVICE_ID_VIA_8231_4 0x8235
1331#define PCI_DEVICE_ID_VIA_8365_1 0x8305 1340#define PCI_DEVICE_ID_VIA_8365_1 0x8305
@@ -1449,6 +1458,9 @@
1449 1458
1450#define PCI_VENDOR_ID_TOSHIBA_2 0x102f 1459#define PCI_VENDOR_ID_TOSHIBA_2 0x102f
1451#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 1460#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030
1461#define PCI_DEVICE_ID_TOSHIBA_TC35815_NWU 0x0031
1462#define PCI_DEVICE_ID_TOSHIBA_TC35815_TX4939 0x0032
1463#define PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE 0x0105
1452#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 1464#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
1453#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 1465#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
1454 1466
@@ -1626,6 +1638,7 @@
1626#define PCI_VENDOR_ID_ITE 0x1283 1638#define PCI_VENDOR_ID_ITE 0x1283
1627#define PCI_DEVICE_ID_ITE_8211 0x8211 1639#define PCI_DEVICE_ID_ITE_8211 0x8211
1628#define PCI_DEVICE_ID_ITE_8212 0x8212 1640#define PCI_DEVICE_ID_ITE_8212 0x8212
1641#define PCI_DEVICE_ID_ITE_8213 0x8213
1629#define PCI_DEVICE_ID_ITE_8872 0x8872 1642#define PCI_DEVICE_ID_ITE_8872 0x8872
1630#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 1643#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
1631 1644
@@ -1686,6 +1699,8 @@
1686#define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8 1699#define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8
1687#define PCI_DEVICE_ID_LML_33R10 0x8a02 1700#define PCI_DEVICE_ID_LML_33R10 0x8a02
1688 1701
1702#define PCI_VENDOR_ID_ESDGMBH 0x12fe
1703#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111
1689 1704
1690#define PCI_VENDOR_ID_SIIG 0x131f 1705#define PCI_VENDOR_ID_SIIG 0x131f
1691#define PCI_SUBVENDOR_ID_SIIG 0x131f 1706#define PCI_SUBVENDOR_ID_SIIG 0x131f
@@ -1801,6 +1816,9 @@
1801#define PCI_DEVICE_ID_MOXA_C168 0x1680 1816#define PCI_DEVICE_ID_MOXA_C168 0x1680
1802#define PCI_DEVICE_ID_MOXA_CP168U 0x1681 1817#define PCI_DEVICE_ID_MOXA_CP168U 0x1681
1803#define PCI_DEVICE_ID_MOXA_CP168EL 0x1682 1818#define PCI_DEVICE_ID_MOXA_CP168EL 0x1682
1819#define PCI_DEVICE_ID_MOXA_CP204J 0x2040
1820#define PCI_DEVICE_ID_MOXA_C218 0x2180
1821#define PCI_DEVICE_ID_MOXA_C320 0x3200
1804 1822
1805#define PCI_VENDOR_ID_CCD 0x1397 1823#define PCI_VENDOR_ID_CCD 0x1397
1806#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 1824#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
@@ -1969,6 +1987,7 @@
1969#define PCI_DEVICE_ID_TOPIC_TP560 0x0000 1987#define PCI_DEVICE_ID_TOPIC_TP560 0x0000
1970 1988
1971#define PCI_VENDOR_ID_ENE 0x1524 1989#define PCI_VENDOR_ID_ENE 0x1524
1990#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
1972#define PCI_DEVICE_ID_ENE_1211 0x1211 1991#define PCI_DEVICE_ID_ENE_1211 0x1211
1973#define PCI_DEVICE_ID_ENE_1225 0x1225 1992#define PCI_DEVICE_ID_ENE_1225 0x1225
1974#define PCI_DEVICE_ID_ENE_1410 0x1410 1993#define PCI_DEVICE_ID_ENE_1410 0x1410
@@ -1980,6 +1999,10 @@
1980 1999
1981#define PCI_VENDOR_ID_CHELSIO 0x1425 2000#define PCI_VENDOR_ID_CHELSIO 0x1425
1982 2001
2002#define PCI_SUBVENDOR_ID_PERLE 0x155f
2003#define PCI_SUBDEVICE_ID_PCI_RAS4 0xf001
2004#define PCI_SUBDEVICE_ID_PCI_RAS8 0xf010
2005
1983 2006
1984#define PCI_VENDOR_ID_SYBA 0x1592 2007#define PCI_VENDOR_ID_SYBA 0x1592
1985#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 2008#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782
@@ -2064,6 +2087,11 @@
2064#define PCI_VENDOR_ID_TDI 0x192E 2087#define PCI_VENDOR_ID_TDI 0x192E
2065#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2088#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2066 2089
2090#define PCI_VENDOR_ID_PASEMI 0x1959
2091
2092#define PCI_VENDOR_ID_ATTANSIC 0x1969
2093#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048
2094
2067#define PCI_VENDOR_ID_JMICRON 0x197B 2095#define PCI_VENDOR_ID_JMICRON 0x197B
2068#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 2096#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
2069#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 2097#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 7a6d34ee5ab1..495d368390e0 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -292,9 +292,11 @@
292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ 292#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ 293#define PCI_MSI_MASK_BIT 16 /* Mask bits register */
294 294
295/* MSI-X registers (these are at offset PCI_MSI_FLAGS) */ 295/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */
296#define PCI_MSIX_FLAGS_QSIZE 0x7FF 296#define PCI_MSIX_FLAGS 2
297#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 297#define PCI_MSIX_FLAGS_QSIZE 0x7FF
298#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
299#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
298#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 300#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
299#define PCI_MSIX_FLAGS_BITMASK (1 << 0) 301#define PCI_MSIX_FLAGS_BITMASK (1 << 0)
300 302
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 265bafab6494..d9db5f62ee48 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -251,7 +251,8 @@ struct sadb_x_sec_ctx {
251#define SADB_X_SPDEXPIRE 21 251#define SADB_X_SPDEXPIRE 21
252#define SADB_X_SPDDELETE2 22 252#define SADB_X_SPDDELETE2 22
253#define SADB_X_NAT_T_NEW_MAPPING 23 253#define SADB_X_NAT_T_NEW_MAPPING 23
254#define SADB_MAX 23 254#define SADB_X_MIGRATE 24
255#define SADB_MAX 24
255 256
256/* Security Association flags */ 257/* Security Association flags */
257#define SADB_SAFLAGS_PFS 1 258#define SADB_SAFLAGS_PFS 1
@@ -297,6 +298,7 @@ struct sadb_x_sec_ctx {
297#define SADB_X_EALG_BLOWFISHCBC 7 298#define SADB_X_EALG_BLOWFISHCBC 7
298#define SADB_EALG_NULL 11 299#define SADB_EALG_NULL 11
299#define SADB_X_EALG_AESCBC 12 300#define SADB_X_EALG_AESCBC 12
301#define SADB_X_EALG_CAMELLIACBC 22
300#define SADB_EALG_MAX 253 /* last EALG */ 302#define SADB_EALG_MAX 253 /* last EALG */
301/* private allocations should use 249-255 (RFC2407) */ 303/* private allocations should use 249-255 (RFC2407) */
302#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ 304#define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */
diff --git a/include/linux/phonedev.h b/include/linux/phonedev.h
index a0e31adf3abe..4269de99e320 100644
--- a/include/linux/phonedev.h
+++ b/include/linux/phonedev.h
@@ -9,7 +9,7 @@
9 9
10struct phone_device { 10struct phone_device {
11 struct phone_device *next; 11 struct phone_device *next;
12 struct file_operations *f_op; 12 const struct file_operations *f_op;
13 int (*open) (struct phone_device *, struct file *); 13 int (*open) (struct phone_device *, struct file *);
14 int board; /* Device private index */ 14 int board; /* Device private index */
15 int minor; 15 int minor;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index edd4c88ca7d8..2a659789f9ca 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -55,6 +55,7 @@ typedef enum {
55 PHY_INTERFACE_MODE_TBI, 55 PHY_INTERFACE_MODE_TBI,
56 PHY_INTERFACE_MODE_RMII, 56 PHY_INTERFACE_MODE_RMII,
57 PHY_INTERFACE_MODE_RGMII, 57 PHY_INTERFACE_MODE_RGMII,
58 PHY_INTERFACE_MODE_RGMII_ID,
58 PHY_INTERFACE_MODE_RTBI 59 PHY_INTERFACE_MODE_RTBI
59} phy_interface_t; 60} phy_interface_t;
60 61
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 4dec047b1837..2ac27f9997dd 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -105,20 +105,6 @@ static inline pid_t pid_nr(struct pid *pid)
105 return nr; 105 return nr;
106} 106}
107 107
108
109#define do_each_task_pid(who, type, task) \
110 do { \
111 struct hlist_node *pos___; \
112 struct pid *pid___ = find_pid(who); \
113 if (pid___ != NULL) \
114 hlist_for_each_entry_rcu((task), pos___, \
115 &pid___->tasks[type], pids[type].node) {
116
117#define while_each_task_pid(who, type, task) \
118 } \
119 } while (0)
120
121
122#define do_each_pid_task(pid, type, task) \ 108#define do_each_pid_task(pid, type, task) \
123 do { \ 109 do { \
124 struct hlist_node *pos___; \ 110 struct hlist_node *pos___; \
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index d2a9d419f01f..2833806d42c6 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -39,7 +39,7 @@ static inline void put_pid_ns(struct pid_namespace *ns)
39 39
40static inline struct task_struct *child_reaper(struct task_struct *tsk) 40static inline struct task_struct *child_reaper(struct task_struct *tsk)
41{ 41{
42 return tsk->nsproxy->pid_ns->child_reaper; 42 return init_pid_ns.child_reaper;
43} 43}
44 44
45#endif /* _LINUX_PID_NS_H */ 45#endif /* _LINUX_PID_NS_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 2e19478e9e84..8bcbc54e1b48 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -99,4 +99,8 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
99 loff_t *, size_t, unsigned int, 99 loff_t *, size_t, unsigned int,
100 splice_actor *); 100 splice_actor *);
101 101
102extern ssize_t __splice_from_pipe(struct pipe_inode_info *, struct file *,
103 loff_t *, size_t, unsigned int,
104 splice_actor *);
105
102#endif 106#endif
diff --git a/include/linux/plist.h b/include/linux/plist.h
index b95818a037ad..85de2f055874 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -97,9 +97,9 @@ struct plist_node {
97#endif 97#endif
98 98
99/** 99/**
100 * #PLIST_HEAD_INIT - static struct plist_head initializer 100 * PLIST_HEAD_INIT - static struct plist_head initializer
101 *
102 * @head: struct plist_head variable name 101 * @head: struct plist_head variable name
102 * @_lock: lock to initialize for this list
103 */ 103 */
104#define PLIST_HEAD_INIT(head, _lock) \ 104#define PLIST_HEAD_INIT(head, _lock) \
105{ \ 105{ \
@@ -109,8 +109,7 @@ struct plist_node {
109} 109}
110 110
111/** 111/**
112 * #PLIST_NODE_INIT - static struct plist_node initializer 112 * PLIST_NODE_INIT - static struct plist_node initializer
113 *
114 * @node: struct plist_node variable name 113 * @node: struct plist_node variable name
115 * @__prio: initial node priority 114 * @__prio: initial node priority
116 */ 115 */
@@ -122,8 +121,8 @@ struct plist_node {
122 121
123/** 122/**
124 * plist_head_init - dynamic struct plist_head initializer 123 * plist_head_init - dynamic struct plist_head initializer
125 *
126 * @head: &struct plist_head pointer 124 * @head: &struct plist_head pointer
125 * @lock: list spinlock, remembered for debugging
127 */ 126 */
128static inline void 127static inline void
129plist_head_init(struct plist_head *head, spinlock_t *lock) 128plist_head_init(struct plist_head *head, spinlock_t *lock)
@@ -137,7 +136,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
137 136
138/** 137/**
139 * plist_node_init - Dynamic struct plist_node initializer 138 * plist_node_init - Dynamic struct plist_node initializer
140 *
141 * @node: &struct plist_node pointer 139 * @node: &struct plist_node pointer
142 * @prio: initial node priority 140 * @prio: initial node priority
143 */ 141 */
@@ -152,49 +150,46 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
152 150
153/** 151/**
154 * plist_for_each - iterate over the plist 152 * plist_for_each - iterate over the plist
155 * 153 * @pos: the type * to use as a loop counter
156 * @pos1: the type * to use as a loop counter. 154 * @head: the head for your list
157 * @head: the head for your list.
158 */ 155 */
159#define plist_for_each(pos, head) \ 156#define plist_for_each(pos, head) \
160 list_for_each_entry(pos, &(head)->node_list, plist.node_list) 157 list_for_each_entry(pos, &(head)->node_list, plist.node_list)
161 158
162/** 159/**
163 * plist_for_each_entry_safe - iterate over a plist of given type safe 160 * plist_for_each_safe - iterate safely over a plist of given type
164 * against removal of list entry 161 * @pos: the type * to use as a loop counter
162 * @n: another type * to use as temporary storage
163 * @head: the head for your list
165 * 164 *
166 * @pos1: the type * to use as a loop counter. 165 * Iterate over a plist of given type, safe against removal of list entry.
167 * @n1: another type * to use as temporary storage
168 * @head: the head for your list.
169 */ 166 */
170#define plist_for_each_safe(pos, n, head) \ 167#define plist_for_each_safe(pos, n, head) \
171 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) 168 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list)
172 169
173/** 170/**
174 * plist_for_each_entry - iterate over list of given type 171 * plist_for_each_entry - iterate over list of given type
175 * 172 * @pos: the type * to use as a loop counter
176 * @pos: the type * to use as a loop counter. 173 * @head: the head for your list
177 * @head: the head for your list. 174 * @mem: the name of the list_struct within the struct
178 * @member: the name of the list_struct within the struct.
179 */ 175 */
180#define plist_for_each_entry(pos, head, mem) \ 176#define plist_for_each_entry(pos, head, mem) \
181 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) 177 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list)
182 178
183/** 179/**
184 * plist_for_each_entry_safe - iterate over list of given type safe against 180 * plist_for_each_entry_safe - iterate safely over list of given type
185 * removal of list entry 181 * @pos: the type * to use as a loop counter
186 *
187 * @pos: the type * to use as a loop counter.
188 * @n: another type * to use as temporary storage 182 * @n: another type * to use as temporary storage
189 * @head: the head for your list. 183 * @head: the head for your list
190 * @m: the name of the list_struct within the struct. 184 * @m: the name of the list_struct within the struct
185 *
186 * Iterate over list of given type, safe against removal of list entry.
191 */ 187 */
192#define plist_for_each_entry_safe(pos, n, head, m) \ 188#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) 189 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list)
194 190
195/** 191/**
196 * plist_head_empty - return !0 if a plist_head is empty 192 * plist_head_empty - return !0 if a plist_head is empty
197 *
198 * @head: &struct plist_head pointer 193 * @head: &struct plist_head pointer
199 */ 194 */
200static inline int plist_head_empty(const struct plist_head *head) 195static inline int plist_head_empty(const struct plist_head *head)
@@ -204,7 +199,6 @@ static inline int plist_head_empty(const struct plist_head *head)
204 199
205/** 200/**
206 * plist_node_empty - return !0 if plist_node is not on a list 201 * plist_node_empty - return !0 if plist_node is not on a list
207 *
208 * @node: &struct plist_node pointer 202 * @node: &struct plist_node pointer
209 */ 203 */
210static inline int plist_node_empty(const struct plist_node *node) 204static inline int plist_node_empty(const struct plist_node *node)
@@ -216,10 +210,9 @@ static inline int plist_node_empty(const struct plist_node *node)
216 210
217/** 211/**
218 * plist_first_entry - get the struct for the first entry 212 * plist_first_entry - get the struct for the first entry
219 * 213 * @head: the &struct plist_head pointer
220 * @ptr: the &struct plist_head pointer. 214 * @type: the type of the struct this is embedded in
221 * @type: the type of the struct this is embedded in. 215 * @member: the name of the list_struct within the struct
222 * @member: the name of the list_struct within the struct.
223 */ 216 */
224#ifdef CONFIG_DEBUG_PI_LIST 217#ifdef CONFIG_DEBUG_PI_LIST
225# define plist_first_entry(head, type, member) \ 218# define plist_first_entry(head, type, member) \
@@ -234,7 +227,6 @@ static inline int plist_node_empty(const struct plist_node *node)
234 227
235/** 228/**
236 * plist_first - return the first node (and thus, highest priority) 229 * plist_first - return the first node (and thus, highest priority)
237 *
238 * @head: the &struct plist_head pointer 230 * @head: the &struct plist_head pointer
239 * 231 *
240 * Assumes the plist is _not_ empty. 232 * Assumes the plist is _not_ empty.
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 070394e846d0..9bd86db4d395 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -120,19 +120,70 @@ typedef int __bitwise suspend_disk_method_t;
120#define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6) 120#define PM_DISK_TESTPROC ((__force suspend_disk_method_t) 6)
121#define PM_DISK_MAX ((__force suspend_disk_method_t) 7) 121#define PM_DISK_MAX ((__force suspend_disk_method_t) 7)
122 122
123/**
124 * struct pm_ops - Callbacks for managing platform dependent suspend states.
125 * @valid: Callback to determine whether the given state can be entered.
126 * If %CONFIG_SOFTWARE_SUSPEND is set then %PM_SUSPEND_DISK is
127 * always valid and never passed to this call.
128 * If not assigned, all suspend states are advertised as valid
129 * in /sys/power/state (but can still be rejected by prepare or enter.)
130 *
131 * @prepare: Prepare the platform for the given suspend state. Can return a
132 * negative error code if necessary.
133 *
134 * @enter: Enter the given suspend state, must be assigned. Can return a
135 * negative error code if necessary.
136 *
137 * @finish: Called when the system has left the given state and all devices
138 * are resumed. The return value is ignored.
139 *
140 * @pm_disk_mode: Set to the disk method that the user should be able to
141 * configure for suspend-to-disk. Since %PM_DISK_SHUTDOWN,
142 * %PM_DISK_REBOOT, %PM_DISK_TEST and %PM_DISK_TESTPROC
143 * are always allowed, currently only %PM_DISK_PLATFORM
144 * makes sense. If the user then choses %PM_DISK_PLATFORM,
145 * the @prepare call will be called before suspending to disk
146 * (if present), the @enter call should be present and will
147 * be called after all state has been saved and the machine
148 * is ready to be shut down/suspended/..., and the @finish
149 * callback is called after state has been restored. All
150 * these calls are called with %PM_SUSPEND_DISK as the state.
151 */
123struct pm_ops { 152struct pm_ops {
124 suspend_disk_method_t pm_disk_mode;
125 int (*valid)(suspend_state_t state); 153 int (*valid)(suspend_state_t state);
126 int (*prepare)(suspend_state_t state); 154 int (*prepare)(suspend_state_t state);
127 int (*enter)(suspend_state_t state); 155 int (*enter)(suspend_state_t state);
128 int (*finish)(suspend_state_t state); 156 int (*finish)(suspend_state_t state);
157 suspend_disk_method_t pm_disk_mode;
129}; 158};
130 159
131extern void pm_set_ops(struct pm_ops *); 160/**
161 * pm_set_ops - set platform dependent power management ops
162 * @pm_ops: The new power management operations to set.
163 */
164extern void pm_set_ops(struct pm_ops *pm_ops);
132extern struct pm_ops *pm_ops; 165extern struct pm_ops *pm_ops;
133extern int pm_suspend(suspend_state_t state); 166extern int pm_suspend(suspend_state_t state);
134 167
135 168
169/**
170 * arch_suspend_disable_irqs - disable IRQs for suspend
171 *
172 * Disables IRQs (in the default case). This is a weak symbol in the common
173 * code and thus allows architectures to override it if more needs to be
174 * done. Not called for suspend to disk.
175 */
176extern void arch_suspend_disable_irqs(void);
177
178/**
179 * arch_suspend_enable_irqs - enable IRQs after suspend
180 *
181 * Enables IRQs (in the default case). This is a weak symbol in the common
182 * code and thus allows architectures to override it if more needs to be
183 * done. Not called for suspend to disk.
184 */
185extern void arch_suspend_enable_irqs(void);
186
136/* 187/*
137 * Device power management 188 * Device power management
138 */ 189 */
@@ -240,6 +291,20 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
240 __suspend_report_result(__FUNCTION__, fn, ret); \ 291 __suspend_report_result(__FUNCTION__, fn, ret); \
241 } while (0) 292 } while (0)
242 293
294/*
295 * Platform hook to activate device wakeup capability, if that's not already
296 * handled by enable_irq_wake() etc.
297 * Returns zero on success, else negative errno
298 */
299extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
300
301static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
302{
303 if (platform_enable_wakeup)
304 return (*platform_enable_wakeup)(dev, is_on);
305 return 0;
306}
307
243#else /* !CONFIG_PM */ 308#else /* !CONFIG_PM */
244 309
245static inline int device_suspend(pm_message_t state) 310static inline int device_suspend(pm_message_t state)
@@ -261,6 +326,11 @@ static inline void dpm_runtime_resume(struct device * dev)
261 326
262#define suspend_report_result(fn, ret) do { } while (0) 327#define suspend_report_result(fn, ret) do { } while (0)
263 328
329static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
330{
331 return -EIO;
332}
333
264#endif 334#endif
265 335
266/* changes to device_may_wakeup take effect on the next pm state change. 336/* changes to device_may_wakeup take effect on the next pm state change.
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 783177387ac6..b0952e532ed5 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -168,24 +168,16 @@ extern int pmu_get_model(void);
168 168
169struct pmu_sleep_notifier 169struct pmu_sleep_notifier
170{ 170{
171 int (*notifier_call)(struct pmu_sleep_notifier *self, int when); 171 void (*notifier_call)(struct pmu_sleep_notifier *self, int when);
172 int priority; 172 int priority;
173 struct list_head list; 173 struct list_head list;
174}; 174};
175 175
176/* Code values for calling sleep/wakeup handlers 176/* Code values for calling sleep/wakeup handlers
177 *
178 * Note: If a sleep request got cancelled, all drivers will get
179 * the PBOOK_SLEEP_REJECT, even those who didn't get the PBOOK_SLEEP_REQUEST.
180 */ 177 */
181#define PBOOK_SLEEP_REQUEST 1 178#define PBOOK_SLEEP_REQUEST 1
182#define PBOOK_SLEEP_NOW 2 179#define PBOOK_SLEEP_NOW 2
183#define PBOOK_SLEEP_REJECT 3 180#define PBOOK_WAKE 3
184#define PBOOK_WAKE 4
185
186/* Result codes returned by the notifiers */
187#define PBOOK_SLEEP_OK 0
188#define PBOOK_SLEEP_REFUSE -1
189 181
190/* priority levels in notifiers */ 182/* priority levels in notifiers */
191#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */ 183#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index ab8a8dd8d64c..9a5226f0f169 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -352,6 +352,8 @@ struct pnp_protocol {
352 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next)) 352 (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
353 353
354 354
355extern struct bus_type pnp_bus_type;
356
355#if defined(CONFIG_PNP) 357#if defined(CONFIG_PNP)
356 358
357/* device management */ 359/* device management */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 87dec8fe6de9..be4652a0545a 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -55,8 +55,8 @@ struct proc_dir_entry {
55 uid_t uid; 55 uid_t uid;
56 gid_t gid; 56 gid_t gid;
57 loff_t size; 57 loff_t size;
58 struct inode_operations * proc_iops; 58 const struct inode_operations *proc_iops;
59 const struct file_operations * proc_fops; 59 const struct file_operations *proc_fops;
60 get_info_t *get_info; 60 get_info_t *get_info;
61 struct module *owner; 61 struct module *owner;
62 struct proc_dir_entry *next, *parent, *subdir; 62 struct proc_dir_entry *next, *parent, *subdir;
@@ -113,8 +113,6 @@ extern struct vfsmount *proc_mnt;
113extern int proc_fill_super(struct super_block *,void *,int); 113extern int proc_fill_super(struct super_block *,void *,int);
114extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); 114extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *);
115 115
116extern int proc_match(int, const char *,struct proc_dir_entry *);
117
118/* 116/*
119 * These are generic /proc routines that use the internal 117 * These are generic /proc routines that use the internal
120 * "struct proc_dir_entry" tree to traverse the filesystem. 118 * "struct proc_dir_entry" tree to traverse the filesystem.
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 0c7ac444fd35..19bc9b8b6191 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -116,8 +116,8 @@ extern unsigned long qnx4_block_map(struct inode *inode, long iblock);
116 116
117extern struct buffer_head *qnx4_bread(struct inode *, int, int); 117extern struct buffer_head *qnx4_bread(struct inode *, int, int);
118 118
119extern struct inode_operations qnx4_file_inode_operations; 119extern const struct inode_operations qnx4_file_inode_operations;
120extern struct inode_operations qnx4_dir_inode_operations; 120extern const struct inode_operations qnx4_dir_inode_operations;
121extern const struct file_operations qnx4_file_operations; 121extern const struct file_operations qnx4_file_operations;
122extern const struct file_operations qnx4_dir_operations; 122extern const struct file_operations qnx4_dir_operations;
123extern int qnx4_is_free(struct super_block *sb, long block); 123extern int qnx4_is_free(struct super_block *sb, long block);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index b8fbf26eb885..77db80a953d6 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -132,6 +132,7 @@ struct if_dqinfo {
132 132
133#ifdef __KERNEL__ 133#ifdef __KERNEL__
134#include <linux/spinlock.h> 134#include <linux/spinlock.h>
135#include <linux/rwsem.h>
135#include <linux/mutex.h> 136#include <linux/mutex.h>
136 137
137#include <linux/dqblk_xfs.h> 138#include <linux/dqblk_xfs.h>
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h
index ebd42a3710b4..6db9a4c15355 100644
--- a/include/linux/raid/bitmap.h
+++ b/include/linux/raid/bitmap.h
@@ -247,6 +247,7 @@ struct bitmap {
247 247
248 atomic_t pending_writes; /* pending writes to the bitmap file */ 248 atomic_t pending_writes; /* pending writes to the bitmap file */
249 wait_queue_head_t write_wait; 249 wait_queue_head_t write_wait;
250 wait_queue_head_t overflow_wait;
250 251
251}; 252};
252 253
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8245c282168b..de72c49747c8 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -104,6 +104,7 @@ struct mdk_rdev_s
104 * for reporting to userspace and storing 104 * for reporting to userspace and storing
105 * in superblock. 105 * in superblock.
106 */ 106 */
107 struct work_struct del_work; /* used for delayed sysfs removal */
107}; 108};
108 109
109struct mddev_s 110struct mddev_s
diff --git a/include/linux/random.h b/include/linux/random.h
index 01ad71033d65..36f125c0c603 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -63,7 +63,7 @@ extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
63 __be16 sport, __be16 dport); 63 __be16 sport, __be16 dport);
64 64
65#ifndef MODULE 65#ifndef MODULE
66extern struct file_operations random_fops, urandom_fops; 66extern const struct file_operations random_fops, urandom_fops;
67#endif 67#endif
68 68
69unsigned int get_random_int(void); 69unsigned int get_random_int(void);
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index c3fc6caaad3f..965d5b3ea9eb 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1949,9 +1949,9 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1949#endif 1949#endif
1950 1950
1951/* dir.c */ 1951/* dir.c */
1952extern struct inode_operations reiserfs_dir_inode_operations; 1952extern const struct inode_operations reiserfs_dir_inode_operations;
1953extern struct inode_operations reiserfs_symlink_inode_operations; 1953extern const struct inode_operations reiserfs_symlink_inode_operations;
1954extern struct inode_operations reiserfs_special_inode_operations; 1954extern const struct inode_operations reiserfs_special_inode_operations;
1955extern const struct file_operations reiserfs_dir_operations; 1955extern const struct file_operations reiserfs_dir_operations;
1956 1956
1957/* tail_conversion.c */ 1957/* tail_conversion.c */
@@ -1963,7 +1963,7 @@ int indirect2direct(struct reiserfs_transaction_handle *, struct inode *,
1963void reiserfs_unmap_buffer(struct buffer_head *); 1963void reiserfs_unmap_buffer(struct buffer_head *);
1964 1964
1965/* file.c */ 1965/* file.c */
1966extern struct inode_operations reiserfs_file_inode_operations; 1966extern const struct inode_operations reiserfs_file_inode_operations;
1967extern const struct file_operations reiserfs_file_operations; 1967extern const struct file_operations reiserfs_file_operations;
1968extern const struct address_space_operations reiserfs_address_space_operations; 1968extern const struct address_space_operations reiserfs_address_space_operations;
1969 1969
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 966c35851b2e..66a96814d614 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -2,7 +2,10 @@
2 File: linux/reiserfs_xattr.h 2 File: linux/reiserfs_xattr.h
3*/ 3*/
4 4
5#include <linux/xattr.h> 5#ifndef _LINUX_REISERFS_XATTR_H
6#define _LINUX_REISERFS_XATTR_H
7
8#include <linux/types.h>
6 9
7/* Magic value in header */ 10/* Magic value in header */
8#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ 11#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
@@ -13,7 +16,18 @@ struct reiserfs_xattr_header {
13}; 16};
14 17
15#ifdef __KERNEL__ 18#ifdef __KERNEL__
19
16#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h>
22#include <linux/rwsem.h>
23#include <linux/reiserfs_fs_i.h>
24#include <linux/reiserfs_fs.h>
25
26struct inode;
27struct dentry;
28struct iattr;
29struct super_block;
30struct nameidata;
17 31
18struct reiserfs_xattr_handler { 32struct reiserfs_xattr_handler {
19 char *prefix; 33 char *prefix;
@@ -49,9 +63,7 @@ int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
49 63
50extern struct reiserfs_xattr_handler user_handler; 64extern struct reiserfs_xattr_handler user_handler;
51extern struct reiserfs_xattr_handler trusted_handler; 65extern struct reiserfs_xattr_handler trusted_handler;
52#ifdef CONFIG_REISERFS_FS_SECURITY
53extern struct reiserfs_xattr_handler security_handler; 66extern struct reiserfs_xattr_handler security_handler;
54#endif
55 67
56int reiserfs_xattr_register_handlers(void) __init; 68int reiserfs_xattr_register_handlers(void) __init;
57void reiserfs_xattr_unregister_handlers(void); 69void reiserfs_xattr_unregister_handlers(void);
@@ -137,6 +149,8 @@ static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
137static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 149static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
138{ 150{
139} 151}
140#endif 152#endif /* CONFIG_REISERFS_FS_XATTR */
153
154#endif /* __KERNEL__ */
141 155
142#endif /* __KERNEL__ */ 156#endif /* _LINUX_REISERFS_XATTR_H */
diff --git a/include/linux/relay.h b/include/linux/relay.h
index c6a48bfc8b14..759a0f97bec2 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -24,7 +24,7 @@
24/* 24/*
25 * Tracks changes to rchan/rchan_buf structs 25 * Tracks changes to rchan/rchan_buf structs
26 */ 26 */
27#define RELAYFS_CHANNEL_VERSION 6 27#define RELAYFS_CHANNEL_VERSION 7
28 28
29/* 29/*
30 * Per-cpu relay channel buffer 30 * Per-cpu relay channel buffer
@@ -64,6 +64,10 @@ struct rchan
64 void *private_data; /* for user-defined data */ 64 void *private_data; /* for user-defined data */
65 size_t last_toobig; /* tried to log event > subbuf size */ 65 size_t last_toobig; /* tried to log event > subbuf size */
66 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */ 66 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */
67 int is_global; /* One global buffer ? */
68 struct list_head list; /* for channel list */
69 struct dentry *parent; /* parent dentry passed to open */
70 char base_filename[NAME_MAX]; /* saved base filename */
67}; 71};
68 72
69/* 73/*
@@ -162,7 +166,8 @@ struct rchan *relay_open(const char *base_filename,
162 struct dentry *parent, 166 struct dentry *parent,
163 size_t subbuf_size, 167 size_t subbuf_size,
164 size_t n_subbufs, 168 size_t n_subbufs,
165 struct rchan_callbacks *cb); 169 struct rchan_callbacks *cb,
170 void *private_data);
166extern void relay_close(struct rchan *chan); 171extern void relay_close(struct rchan *chan);
167extern void relay_flush(struct rchan *chan); 172extern void relay_flush(struct rchan *chan);
168extern void relay_subbufs_consumed(struct rchan *chan, 173extern void relay_subbufs_consumed(struct rchan *chan,
diff --git a/include/linux/rio.h b/include/linux/rio.h
index d93857056cb9..68e3f6853fa6 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -25,6 +25,7 @@
25 25
26#define RIO_ANY_DESTID 0xff 26#define RIO_ANY_DESTID 0xff
27#define RIO_NO_HOPCOUNT -1 27#define RIO_NO_HOPCOUNT -1
28#define RIO_INVALID_DESTID 0xffff
28 29
29#define RIO_MAX_MPORT_RESOURCES 16 30#define RIO_MAX_MPORT_RESOURCES 16
30#define RIO_MAX_DEV_RESOURCES 16 31#define RIO_MAX_DEV_RESOURCES 16
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4a629ea70cc4..1fae30af91f3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
574#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
576 576
577struct rtnetlink_link
578{
579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
580 int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
581};
582
583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 577extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 578extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 579extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
@@ -605,7 +598,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
605 598
606#define RTA_PUT_NOHDR(skb, attrlen, data) \ 599#define RTA_PUT_NOHDR(skb, attrlen, data) \
607({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ 600({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
608 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ 601 memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
609 RTA_ALIGN(attrlen) - attrlen); }) 602 RTA_ALIGN(attrlen) - attrlen); })
610 603
611#define RTA_PUT_U8(skb, attrtype, value) \ 604#define RTA_PUT_U8(skb, attrtype, value) \
@@ -637,12 +630,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
637 RTA_PUT(skb, attrtype, 0, NULL); 630 RTA_PUT(skb, attrtype, 0, NULL);
638 631
639#define RTA_NEST(skb, type) \ 632#define RTA_NEST(skb, type) \
640({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ 633({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
641 RTA_PUT(skb, type, 0, NULL); \ 634 RTA_PUT(skb, type, 0, NULL); \
642 __start; }) 635 __start; })
643 636
644#define RTA_NEST_END(skb, start) \ 637#define RTA_NEST_END(skb, start) \
645({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ 638({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
646 (skb)->len; }) 639 (skb)->len; })
647 640
648#define RTA_NEST_CANCEL(skb, start) \ 641#define RTA_NEST_CANCEL(skb, start) \
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
new file mode 100644
index 000000000000..f7b826b565c7
--- /dev/null
+++ b/include/linux/rxrpc.h
@@ -0,0 +1,62 @@
1/* AF_RXRPC parameters
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_H
13#define _LINUX_RXRPC_H
14
15#include <linux/in.h>
16#include <linux/in6.h>
17
18/*
19 * RxRPC socket address
20 */
21struct sockaddr_rxrpc {
22 sa_family_t srx_family; /* address family */
23 u16 srx_service; /* service desired */
24 u16 transport_type; /* type of transport socket (SOCK_DGRAM) */
25 u16 transport_len; /* length of transport address */
26 union {
27 sa_family_t family; /* transport address family */
28 struct sockaddr_in sin; /* IPv4 transport address */
29 struct sockaddr_in6 sin6; /* IPv6 transport address */
30 } transport;
31};
32
33/*
34 * RxRPC socket options
35 */
36#define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */
37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */
39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
40
41/*
42 * RxRPC control messages
43 * - terminal messages mean that a user call ID tag can be recycled
44 */
45#define RXRPC_USER_CALL_ID 1 /* user call ID specifier */
46#define RXRPC_ABORT 2 /* abort request / notification [terminal] */
47#define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */
48#define RXRPC_NET_ERROR 5 /* network error received [terminal] */
49#define RXRPC_BUSY 6 /* server busy received [terminal] */
50#define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */
51#define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */
52#define RXRPC_ACCEPT 9 /* [Server] accept request */
53
54/*
55 * RxRPC security levels
56 */
57#define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60
61
62#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 446373535190..a1707583de49 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -196,13 +196,13 @@ extern void init_idle(struct task_struct *idle, int cpu);
196extern cpumask_t nohz_cpu_mask; 196extern cpumask_t nohz_cpu_mask;
197 197
198/* 198/*
199 * Only dump TASK_* tasks. (-1 for all tasks) 199 * Only dump TASK_* tasks. (0 for all tasks)
200 */ 200 */
201extern void show_state_filter(unsigned long state_filter); 201extern void show_state_filter(unsigned long state_filter);
202 202
203static inline void show_state(void) 203static inline void show_state(void)
204{ 204{
205 show_state_filter(-1); 205 show_state_filter(0);
206} 206}
207 207
208extern void show_regs(struct pt_regs *); 208extern void show_regs(struct pt_regs *);
@@ -436,7 +436,7 @@ struct signal_struct {
436 436
437 /* job control IDs */ 437 /* job control IDs */
438 pid_t pgrp; 438 pid_t pgrp;
439 pid_t tty_old_pgrp; 439 struct pid *tty_old_pgrp;
440 440
441 union { 441 union {
442 pid_t session __deprecated; 442 pid_t session __deprecated;
@@ -684,7 +684,6 @@ struct sched_domain {
684 unsigned int imbalance_pct; /* No balance until over watermark */ 684 unsigned int imbalance_pct; /* No balance until over watermark */
685 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */ 685 unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
686 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */ 686 unsigned int cache_nice_tries; /* Leave cache hot tasks for # tries */
687 unsigned int per_cpu_gain; /* CPU % gained by adding domain cpus */
688 unsigned int busy_idx; 687 unsigned int busy_idx;
689 unsigned int idle_idx; 688 unsigned int idle_idx;
690 unsigned int newidle_idx; 689 unsigned int newidle_idx;
@@ -1013,8 +1012,10 @@ struct task_struct {
1013 * to a stack based synchronous wait) if its doing sync IO. 1012 * to a stack based synchronous wait) if its doing sync IO.
1014 */ 1013 */
1015 wait_queue_t *io_wait; 1014 wait_queue_t *io_wait;
1015#ifdef CONFIG_TASK_XACCT
1016/* i/o counters(bytes read/written, #syscalls */ 1016/* i/o counters(bytes read/written, #syscalls */
1017 u64 rchar, wchar, syscr, syscw; 1017 u64 rchar, wchar, syscr, syscw;
1018#endif
1018 struct task_io_accounting ioac; 1019 struct task_io_accounting ioac;
1019#if defined(CONFIG_TASK_XACCT) 1020#if defined(CONFIG_TASK_XACCT)
1020 u64 acct_rss_mem1; /* accumulated rss usage */ 1021 u64 acct_rss_mem1; /* accumulated rss usage */
@@ -1327,14 +1328,12 @@ extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid);
1327extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32); 1328extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_t, u32);
1328extern int kill_pgrp(struct pid *pid, int sig, int priv); 1329extern int kill_pgrp(struct pid *pid, int sig, int priv);
1329extern int kill_pid(struct pid *pid, int sig, int priv); 1330extern int kill_pid(struct pid *pid, int sig, int priv);
1330extern int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp); 1331extern int kill_proc_info(int, struct siginfo *, pid_t);
1331extern int kill_pg_info(int, struct siginfo *, pid_t);
1332extern void do_notify_parent(struct task_struct *, int); 1332extern void do_notify_parent(struct task_struct *, int);
1333extern void force_sig(int, struct task_struct *); 1333extern void force_sig(int, struct task_struct *);
1334extern void force_sig_specific(int, struct task_struct *); 1334extern void force_sig_specific(int, struct task_struct *);
1335extern int send_sig(int, struct task_struct *, int); 1335extern int send_sig(int, struct task_struct *, int);
1336extern void zap_other_threads(struct task_struct *p); 1336extern void zap_other_threads(struct task_struct *p);
1337extern int kill_pg(pid_t, int, int);
1338extern int kill_proc(pid_t, int, int); 1337extern int kill_proc(pid_t, int, int);
1339extern struct sigqueue *sigqueue_alloc(void); 1338extern struct sigqueue *sigqueue_alloc(void);
1340extern void sigqueue_free(struct sigqueue *); 1339extern void sigqueue_free(struct sigqueue *);
@@ -1649,6 +1648,44 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
1649 1648
1650extern void normalize_rt_tasks(void); 1649extern void normalize_rt_tasks(void);
1651 1650
1651#ifdef CONFIG_TASK_XACCT
1652static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
1653{
1654 tsk->rchar += amt;
1655}
1656
1657static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
1658{
1659 tsk->wchar += amt;
1660}
1661
1662static inline void inc_syscr(struct task_struct *tsk)
1663{
1664 tsk->syscr++;
1665}
1666
1667static inline void inc_syscw(struct task_struct *tsk)
1668{
1669 tsk->syscw++;
1670}
1671#else
1672static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
1673{
1674}
1675
1676static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
1677{
1678}
1679
1680static inline void inc_syscr(struct task_struct *tsk)
1681{
1682}
1683
1684static inline void inc_syscw(struct task_struct *tsk)
1685{
1686}
1687#endif
1688
1652#endif /* __KERNEL__ */ 1689#endif /* __KERNEL__ */
1653 1690
1654#endif 1691#endif
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d4f86560bfff..d70df61a029f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -63,6 +63,15 @@ typedef struct sctphdr {
63 __be32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__
67#include <linux/skbuff.h>
68
69static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70{
71 return (struct sctphdr *)skb_transport_header(skb);
72}
73#endif
74
66/* Section 3.2. Chunk Field Descriptions. */ 75/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 76typedef struct sctp_chunkhdr {
68 __u8 type; 77 __u8 type;
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h
deleted file mode 100644
index cdfa77fcb06b..000000000000
--- a/include/linux/sdla_fr.h
+++ /dev/null
@@ -1,638 +0,0 @@
1/*****************************************************************************
2* sdla_fr.h Sangoma frame relay firmware API definitions.
3*
4* Author: Gideon Hack
5* Nenad Corbic <ncorbic@sangoma.com>
6*
7* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Oct 04, 1999 Gideon Hack Updated API structures
15* Jun 02, 1999 Gideon Hack Modifications for S514 support
16* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
17* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
18* 0x05 and 0x06 respectively.
19* Dec 23, 1996 Gene Kozin v2.0
20* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
21* Sep 26, 1995 Gene Kozin Initial version.
22*****************************************************************************/
23#ifndef _SDLA_FR_H
24#define _SDLA_FR_H
25
26/*----------------------------------------------------------------------------
27 * Notes:
28 * ------
29 * 1. All structures defined in this file are byte-alined.
30 *
31 * Compiler Platform
32 * -------- --------
33 * GNU C Linux
34 */
35
36#ifndef PACKED
37# define PACKED __attribute__((packed))
38#endif /* PACKED */
39
40/* Adapter memory layout */
41#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
42#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
43#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
44#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
45#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
46#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
47#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
48#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
49#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
50
51/* Important constants */
52#define FR502_MAX_DATA 4096 /* maximum data buffer length */
53#define FR508_MAX_DATA 4080 /* maximum data buffer length */
54#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
55(for configuration purposes) */
56#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
57
58#define HIGHEST_VALID_DLCI 991
59
60/****** Data Structures *****************************************************/
61
62/*----------------------------------------------------------------------------
63 * Frame relay command block.
64 */
65typedef struct fr_cmd
66{
67 unsigned char command PACKED; /* command code */
68 unsigned short length PACKED; /* length of data buffer */
69 unsigned char result PACKED; /* return code */
70 unsigned short dlci PACKED; /* DLCI number */
71 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
72 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
73 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
74 unsigned char rsrv[2] PACKED; /* reserved for future use */
75} fr_cmd_t;
76
77/* 'command' field defines */
78#define FR_WRITE 0x01
79#define FR_READ 0x02
80#define FR_ISSUE_IS_FRAME 0x03
81#define FR_SET_CONFIG 0x10
82#define FR_READ_CONFIG 0x11
83#define FR_COMM_DISABLE 0x12
84#define FR_COMM_ENABLE 0x13
85#define FR_READ_STATUS 0x14
86#define FR_READ_STATISTICS 0x15
87#define FR_FLUSH_STATISTICS 0x16
88#define FR_LIST_ACTIVE_DLCI 0x17
89#define FR_FLUSH_DATA_BUFFERS 0x18
90#define FR_READ_ADD_DLC_STATS 0x19
91#define FR_ADD_DLCI 0x20
92#define FR_DELETE_DLCI 0x21
93#define FR_ACTIVATE_DLCI 0x22
94#define FR_DEACTIVATE_DLCI 0x22
95#define FR_READ_MODEM_STATUS 0x30
96#define FR_SET_MODEM_STATUS 0x31
97#define FR_READ_ERROR_STATS 0x32
98#define FR_FLUSH_ERROR_STATS 0x33
99#define FR_READ_DLCI_IB_MAPPING 0x34
100#define FR_READ_CODE_VERSION 0x40
101#define FR_SET_INTR_MODE 0x50
102#define FR_READ_INTR_MODE 0x51
103#define FR_SET_TRACE_CONFIG 0x60
104#define FR_FT1_STATUS_CTRL 0x80
105#define FR_SET_FT1_MODE 0x81
106
107/* Special UDP drivers management commands */
108#define FPIPE_ENABLE_TRACING 0x41
109#define FPIPE_DISABLE_TRACING 0x42
110#define FPIPE_GET_TRACE_INFO 0x43
111#define FPIPE_FT1_READ_STATUS 0x44
112#define FPIPE_DRIVER_STAT_IFSEND 0x45
113#define FPIPE_DRIVER_STAT_INTR 0x46
114#define FPIPE_DRIVER_STAT_GEN 0x47
115#define FPIPE_FLUSH_DRIVER_STATS 0x48
116#define FPIPE_ROUTER_UP_TIME 0x49
117
118/* 'result' field defines */
119#define FRRES_OK 0x00 /* command executed successfully */
120#define FRRES_DISABLED 0x01 /* communications not enabled */
121#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
122#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
123#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
124#define FRRES_TOO_LONG 0x05
125#define FRRES_TOO_MANY 0x06
126#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
127#define FRRES_BUFFER_OVERFLOW 0x08
128#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
129#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
130#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
131#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
132#define FRRES_DLCI_MISMATCH 0x14
133#define FRRES_INVALID_CMD 0x1F /* invalid command */
134
135/* 'attr' field defines */
136#define FRATTR_
137
138/*----------------------------------------------------------------------------
139 * Frame relay mailbox.
140 * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
141 * For S502 it is also located at offset FR502_RXMB_OFFS into
142 * FR502_RX_VECTOR.
143 */
144typedef struct fr_mbox
145{
146 unsigned char opflag PACKED; /* 00h: execution flag */
147 fr_cmd_t cmd PACKED; /* 01h: command block */
148 unsigned char data[1] PACKED; /* 10h: variable length data buffer */
149} fr_mbox_t;
150
151/*----------------------------------------------------------------------------
152 * S502 frame relay status flags.
153 * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
154 */
155typedef struct fr502_flags
156{
157 unsigned char rsrv1[1] PACKED; /* 00h: */
158 unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
159 unsigned char rx_ready PACKED; /* 02h: Rx frame available */
160 unsigned char event PACKED; /* 03h: asynchronous event */
161 unsigned char mstatus PACKED; /* 04h: modem status */
162 unsigned char rsrv2[8] PACKED; /* 05h: */
163 unsigned char iflag PACKED; /* 0Dh: interrupt flag */
164 unsigned char imask PACKED; /* 0Eh: interrupt mask */
165} fr502_flags_t;
166
167/*----------------------------------------------------------------------------
168 * S508 frame relay status flags.
169 * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
170 */
171typedef struct fr508_flags
172{
173 unsigned char rsrv1[3] PACKED; /* 00h: reserved */
174 unsigned char event PACKED; /* 03h: asynchronous event */
175 unsigned char mstatus PACKED; /* 04h: modem status */
176 unsigned char rsrv2[11] PACKED; /* 05h: reserved */
177 unsigned char iflag PACKED; /* 10h: interrupt flag */
178 unsigned char imask PACKED; /* 11h: interrupt mask */
179 unsigned long tse_offs PACKED; /* 12h: Tx status element */
180 unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
181} fr508_flags_t;
182
183/* 'event' field defines */
184#define FR_EVENT_STATUS 0x01 /* channel status change */
185#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
186#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
187#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
188
189/* 'mstatus' field defines */
190#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
191#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
192
193/* 'iflag' & 'imask' fields defines */
194#define FR_INTR_RXRDY 0x01 /* Rx ready */
195#define FR_INTR_TXRDY 0x02 /* Tx ready */
196#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
197#define FR_INTR_READY 0x08 /* interface command completed */
198#define FR_INTR_DLC 0x10 /* DLC status change */
199#define FR_INTR_TIMER 0x20 /* millisecond timer */
200#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
201
202
203/*----------------------------------------------------------------------------
204 * Receive Buffer Configuration Info. S508 only!
205 * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
206 */
207typedef struct fr_buf_info
208{
209 unsigned short rse_num PACKED; /* 00h: number of status elements */
210 unsigned long rse_base PACKED; /* 02h: receive status array base */
211 unsigned long rse_next PACKED; /* 06h: next status element */
212 unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */
213 unsigned short reserved PACKED; /* 0Eh: */
214 unsigned long buf_top PACKED; /* 10h: rotational buffer top */
215} fr_buf_info_t;
216
217/*----------------------------------------------------------------------------
218 * Buffer Status Element. S508 only!
219 * Array of structures of this type is located at offset defined by the
220 * 'rse_base' field of the frBufInfo_t structure into absolute adapter
221 * memory address space.
222 */
223typedef struct fr_rx_buf_ctl
224{
225 unsigned char flag PACKED; /* 00h: ready flag */
226 unsigned short length PACKED; /* 01h: frame length */
227 unsigned short dlci PACKED; /* 03h: DLCI */
228 unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
229 unsigned short tmstamp PACKED; /* 06h: time stamp */
230 unsigned short rsrv[2] PACKED; /* 08h: */
231 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
232} fr_rx_buf_ctl_t;
233
234typedef struct fr_tx_buf_ctl
235{
236 unsigned char flag PACKED; /* 00h: ready flag */
237 unsigned short rsrv0[2] PACKED; /* 01h: */
238 unsigned short length PACKED; /* 05h: frame length */
239 unsigned short dlci PACKED; /* 07h: DLCI */
240 unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
241 unsigned short rsrv1 PACKED; /* 0Ah: */
242 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
243} fr_tx_buf_ctl_t;
244
245/*----------------------------------------------------------------------------
246 * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
247 */
248typedef struct fr_conf
249{
250 unsigned short station PACKED; /* 00h: CPE/Node */
251 unsigned short options PACKED; /* 02h: configuration options */
252 unsigned short kbps PACKED; /* 04h: baud rate in kbps */
253 unsigned short port PACKED; /* 06h: RS-232/V.35 */
254 unsigned short mtu PACKED; /* 08h: max. transmit length */
255 unsigned short t391 PACKED; /* 0Ah: */
256 unsigned short t392 PACKED; /* 0Ch: */
257 unsigned short n391 PACKED; /* 0Eh: */
258 unsigned short n392 PACKED; /* 10h: */
259 unsigned short n393 PACKED; /* 12h: */
260 unsigned short cir_fwd PACKED; /* 14h: */
261 unsigned short bc_fwd PACKED; /* 16h: */
262 unsigned short be_fwd PACKED; /* 18h: */
263 unsigned short cir_bwd PACKED; /* 1Ah: */
264 unsigned short bc_bwd PACKED; /* 1Ch: */
265 unsigned short be_bwd PACKED; /* 1Eh: */
266 unsigned short dlci[0] PACKED; /* 20h: */
267} fr_conf_t;
268
269/* 'station_type' defines */
270#define FRCFG_STATION_CPE 0
271#define FRCFG_STATION_NODE 1
272
273/* 'conf_flags' defines */
274#define FRCFG_IGNORE_TX_CIR 0x0001
275#define FRCFG_IGNORE_RX_CIR 0x0002
276#define FRCFG_DONT_RETRANSMIT 0x0004
277#define FRCFG_IGNORE_CBS 0x0008
278#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
279#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
280#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
281
282/* 'baud_rate' defines */
283#define FRCFG_BAUD_1200 12
284#define FRCFG_BAUD_2400 24
285#define FRCFG_BAUD_4800 48
286#define FRCFG_BAUD_9600 96
287#define FRCFG_BAUD_19200 19
288#define FRCFG_BAUD_38400 38
289#define FRCFG_BAUD_56000 56
290#define FRCFG_BAUD_64000 64
291#define FRCFG_BAUD_128000 128
292
293/* 'port_mode' defines */
294#define FRCFG_MODE_EXT_CLK 0x0000
295#define FRCFG_MODE_INT_CLK 0x0001
296#define FRCFG_MODE_V35 0x0000 /* S508 only */
297#define FRCFG_MODE_RS232 0x0002 /* S508 only */
298
299/* defines for line tracing */
300
301/* the line trace status element presented by the frame relay code */
302typedef struct {
303 unsigned char flag PACKED; /* ready flag */
304 unsigned short length PACKED; /* trace length */
305 unsigned char rsrv0[2] PACKED; /* reserved */
306 unsigned char attr PACKED; /* trace attributes */
307 unsigned short tmstamp PACKED; /* time stamp */
308 unsigned char rsrv1[4] PACKED; /* reserved */
309 unsigned long offset PACKED; /* buffer absolute address */
310} fr_trc_el_t;
311
312typedef struct {
313 unsigned char status PACKED; /* status flag */
314 unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
315 /* data passed */
316 unsigned short length PACKED; /* frame length */
317 unsigned short tmstamp PACKED; /* time stamp */
318} fpipemon_trc_hdr_t;
319
320typedef struct {
321 fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
322 unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
323} fpipemon_trc_t;
324
325/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
326/* for returning the number of frames being passed to fpipemon */
327#define TRC_OUTGOING_FRM 0x01
328#define TRC_ABORT_ERROR 0x10
329#define TRC_CRC_ERROR 0x20
330#define TRC_OVERRUN_ERROR 0x40
331#define MORE_TRC_DATA 0x80
332
333#define MAX_FRMS_TRACED 0x07
334
335#define NO_TRC_ELEMENTS_OFF 0x9000
336#define BASE_TRC_ELEMENTS_OFF 0x9002
337#define TRC_ACTIVE 0x01
338#define FLUSH_TRC_BUFFERS 0x02
339#define FLUSH_TRC_STATISTICS 0x04
340#define TRC_SIGNALLING_FRMS 0x10
341#define TRC_INFO_FRMS 0x20
342#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
343#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
344
345/*----------------------------------------------------------------------------
346 * Channel configuration.
347 * This structure is passed to the FR_SET_CONFIG command when dlci != 0.
348 */
349typedef struct fr_dlc_conf
350{
351 unsigned short conf_flags PACKED; /* 00h: configuration bits */
352 unsigned short cir_fwd PACKED; /* 02h: */
353 unsigned short bc_fwd PACKED; /* 04h: */
354 unsigned short be_fwd PACKED; /* 06h: */
355 unsigned short cir_bwd PACKED; /* 08h: */
356 unsigned short bc_bwd PACKED; /* 0Ah: */
357 unsigned short be_bwd PACKED; /* 0Ch: */
358} fr_dlc_conf_t;
359
360/*----------------------------------------------------------------------------
361 * S502 interrupt mode control block.
362 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
363 * FR_READ_INTR_FLAGS commands.
364 */
365typedef struct fr502_intr_ctl
366{
367 unsigned char mode PACKED; /* 00h: interrupt enable flags */
368 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
369} fr502_intr_ctl_t;
370
371/*----------------------------------------------------------------------------
372 * S508 interrupt mode control block.
373 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
374 * FR_READ_INTR_FLAGS commands.
375 */
376typedef struct fr508_intr_ctl
377{
378 unsigned char mode PACKED; /* 00h: interrupt enable flags */
379 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
380 unsigned char irq PACKED; /* 03h: IRQ level to activate */
381 unsigned char flags PACKED; /* 04h: ?? */
382 unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
383} fr508_intr_ctl_t;
384
385/*----------------------------------------------------------------------------
386 * Channel status.
387 * This structure is returned by the FR_READ_STATUS command.
388 */
389typedef struct fr_dlc_Status
390{
391 unsigned char status PACKED; /* 00h: link/DLCI status */
392 struct
393 {
394 unsigned short dlci PACKED; /* 01h: DLCI number */
395 unsigned char status PACKED; /* 03h: DLCI status */
396 } circuit[1] PACKED;
397} fr_dlc_status_t;
398
399/* 'status' defines */
400#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
401#define FR_LINK_OPER 0x01
402#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
403#define FR_DLCI_ACTIVE 0x02
404#define FR_DLCI_WAITING 0x04
405#define FR_DLCI_NEW 0x08
406#define FR_DLCI_REPORT 0x40
407
408/*----------------------------------------------------------------------------
409 * Global Statistics Block.
410 * This structure is returned by the FR_READ_STATISTICS command when
411 * dcli == 0.
412 */
413typedef struct fr_link_stat
414{
415 unsigned short rx_too_long PACKED; /* 00h: */
416 unsigned short rx_dropped PACKED; /* 02h: */
417 unsigned short rx_dropped2 PACKED; /* 04h: */
418 unsigned short rx_bad_dlci PACKED; /* 06h: */
419 unsigned short rx_bad_format PACKED; /* 08h: */
420 unsigned short retransmitted PACKED; /* 0Ah: */
421 unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
422 unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
423 unsigned short cpe_rx_FSR PACKED; /* 10h: */
424 unsigned short cpe_rx_LIV PACKED; /* 12h: */
425 unsigned short node_rx_FSE PACKED; /* 14h: */
426 unsigned short node_rx_LIV PACKED; /* 16h: */
427 unsigned short node_tx_FSR PACKED; /* 18h: */
428 unsigned short node_tx_LIV PACKED; /* 1Ah: */
429 unsigned short rx_ISF_err PACKED; /* 1Ch: */
430 unsigned short rx_unsolicited PACKED; /* 1Eh: */
431 unsigned short rx_SSN_err PACKED; /* 20h: */
432 unsigned short rx_RSN_err PACKED; /* 22h: */
433 unsigned short T391_timeouts PACKED; /* 24h: */
434 unsigned short T392_timeouts PACKED; /* 26h: */
435 unsigned short N392_reached PACKED; /* 28h: */
436 unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
437 unsigned short current_SSN PACKED; /* 2Ch: */
438 unsigned short current_RSN PACKED; /* 2Eh: */
439 unsigned short curreny_T391 PACKED; /* 30h: */
440 unsigned short current_T392 PACKED; /* 32h: */
441 unsigned short current_N392 PACKED; /* 34h: */
442 unsigned short current_N393 PACKED; /* 36h: */
443} fr_link_stat_t;
444
445/*----------------------------------------------------------------------------
446 * DLCI statistics.
447 * This structure is returned by the FR_READ_STATISTICS command when
448 * dlci != 0.
449 */
450typedef struct fr_dlci_stat
451{
452 unsigned long tx_frames PACKED; /* 00h: */
453 unsigned long tx_bytes PACKED; /* 04h: */
454 unsigned long rx_frames PACKED; /* 08h: */
455 unsigned long rx_bytes PACKED; /* 0Ch: */
456 unsigned long rx_dropped PACKED; /* 10h: */
457 unsigned long rx_inactive PACKED; /* 14h: */
458 unsigned long rx_exceed_CIR PACKED; /* 18h: */
459 unsigned long rx_DE_set PACKED; /* 1Ch: */
460 unsigned long tx_throughput PACKED; /* 20h: */
461 unsigned long tx_calc_timer PACKED; /* 24h: */
462 unsigned long rx_throughput PACKED; /* 28h: */
463 unsigned long rx_calc_timer PACKED; /* 2Ch: */
464} fr_dlci_stat_t;
465
466/*----------------------------------------------------------------------------
467 * Communications error statistics.
468 * This structure is returned by the FR_READ_ERROR_STATS command.
469 */
470typedef struct fr_comm_stat
471{
472 unsigned char rx_overruns PACKED; /* 00h: */
473 unsigned char rx_bad_crc PACKED; /* 01h: */
474 unsigned char rx_aborts PACKED; /* 02h: */
475 unsigned char rx_too_long PACKED; /* 03h: */
476 unsigned char tx_aborts PACKED; /* 04h: */
477 unsigned char tx_underruns PACKED; /* 05h: */
478 unsigned char tx_missed_undr PACKED; /* 06h: */
479 unsigned char dcd_dropped PACKED; /* 07h: */
480 unsigned char cts_dropped PACKED; /* 08h: */
481} fr_comm_stat_t;
482
483/*----------------------------------------------------------------------------
484 * Defines for the FR_ISSUE_IS_FRAME command.
485 */
486#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
487#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
488
489/*----------------------------------------------------------------------------
490 * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
491 */
492
493typedef struct arphdr_fr
494 {
495 unsigned short ar_hrd PACKED; /* format of hardware addr */
496 unsigned short ar_pro PACKED; /* format of protocol addr */
497 unsigned char ar_hln PACKED; /* length of hardware addr */
498 unsigned char ar_pln PACKED; /* length of protocol addr */
499 unsigned short ar_op PACKED; /* ARP opcode */
500 unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
501 unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
502 unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
503 unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
504 } arphdr_fr_t;
505
506/*----------------------------------------------------------------------------
507 * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
508 */
509typedef struct arphdr_1490
510 {
511 unsigned char control PACKED; /* UI, etc... */
512 unsigned char pad PACKED; /* Pad */
513 unsigned char NLPID PACKED; /* SNAP */
514 unsigned char OUI[3] PACKED; /* Ethertype, etc... */
515 unsigned short PID PACKED; /* ARP, IP, etc... */
516 } arphdr_1490_t;
517
518/* UDP/IP packet (for UDP management) layout */
519
520/* The embedded control block for UDP mgmt
521 This is essentially a mailbox structure, without the large data field */
522
523typedef struct {
524 unsigned char opp_flag PACKED; /* the opp flag */
525 unsigned char command PACKED; /* command code */
526 unsigned short length PACKED; /* length of data buffer */
527 unsigned char result PACKED; /* return code */
528 unsigned short dlci PACKED; /* DLCI number */
529 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
530 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
531 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
532 unsigned char rsrv[2] PACKED; /* reserved for future use */
533} cblock_t;
534
535
536/* UDP management packet layout (data area of ip packet) */
537
538typedef struct {
539 unsigned char control PACKED;
540 unsigned char NLPID PACKED;
541} fr_encap_hdr_t;
542
543typedef struct {
544// fr_encap_hdr_t fr_encap_hdr PACKED;
545 ip_pkt_t ip_pkt PACKED;
546 udp_pkt_t udp_pkt PACKED;
547 wp_mgmt_t wp_mgmt PACKED;
548 cblock_t cblock PACKED;
549 unsigned char data[4080] PACKED;
550} fr_udp_pkt_t;
551
552
553/* valid ip_protocol for UDP management */
554#define UDPMGMT_UDP_PROTOCOL 0x11
555
556#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
557#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
558
559/* values for request/reply byte */
560#define UDPMGMT_REQUEST 0x01
561#define UDPMGMT_REPLY 0x02
562#define UDP_OFFSET 12
563
564typedef struct {
565 unsigned long if_send_entry;
566 unsigned long if_send_skb_null;
567 unsigned long if_send_broadcast;
568 unsigned long if_send_multicast;
569 unsigned long if_send_critical_ISR;
570 unsigned long if_send_critical_non_ISR;
571 unsigned long if_send_busy;
572 unsigned long if_send_busy_timeout;
573 unsigned long if_send_DRVSTATS_request;
574 unsigned long if_send_FPIPE_request;
575 unsigned long if_send_wan_disconnected;
576 unsigned long if_send_dlci_disconnected;
577 unsigned long if_send_no_bfrs;
578 unsigned long if_send_adptr_bfrs_full;
579 unsigned long if_send_bfrs_passed_to_adptr;
580 unsigned long if_send_consec_send_fail;
581} drvstats_if_send_t;
582
583typedef struct {
584 unsigned long rx_intr_no_socket;
585 unsigned long rx_intr_dev_not_started;
586 unsigned long rx_intr_DRVSTATS_request;
587 unsigned long rx_intr_FPIPE_request;
588 unsigned long rx_intr_bfr_not_passed_to_stack;
589 unsigned long rx_intr_bfr_passed_to_stack;
590 } drvstats_rx_intr_t;
591
592typedef struct {
593 unsigned long UDP_FPIPE_mgmt_kmalloc_err;
594 unsigned long UDP_FPIPE_mgmt_direction_err;
595 unsigned long UDP_FPIPE_mgmt_adptr_type_err;
596 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
597 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
598 unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
599 unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
600 unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
601 unsigned long UDP_FPIPE_mgmt_passed_to_stack;
602 unsigned long UDP_FPIPE_mgmt_no_socket;
603 unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
604 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
605 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
606 unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
607 unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
608 unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
609 unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
610 unsigned long UDP_DRVSTATS_mgmt_no_socket;
611} drvstats_gen_t;
612
613typedef struct {
614 unsigned char attr PACKED;
615 unsigned short time_stamp PACKED;
616 unsigned char reserved[13] PACKED;
617} api_rx_hdr_t;
618
619typedef struct {
620 api_rx_hdr_t api_rx_hdr PACKED;
621 void * data PACKED;
622} api_rx_element_t;
623
624typedef struct {
625 unsigned char attr PACKED;
626 unsigned char reserved[15] PACKED;
627} api_tx_hdr_t;
628
629typedef struct {
630 api_tx_hdr_t api_tx_hdr PACKED;
631 void * data PACKED;
632} api_tx_element_t;
633
634#ifdef _MSC_
635# pragma pack()
636#endif
637#endif /* _SDLA_FR_H */
638
diff --git a/include/linux/security.h b/include/linux/security.h
index 83cdefae9931..47e82c120f9a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -492,7 +492,7 @@ struct request_sock;
492 * Note that the fown_struct, @fown, is never outside the context of a 492 * Note that the fown_struct, @fown, is never outside the context of a
493 * struct file, so the file structure (and associated security information) 493 * struct file, so the file structure (and associated security information)
494 * can always be obtained: 494 * can always be obtained:
495 * (struct file *)((long)fown - offsetof(struct file,f_owner)); 495 * container_of(fown, struct file, f_owner)
496 * @tsk contains the structure of task receiving signal. 496 * @tsk contains the structure of task receiving signal.
497 * @fown contains the file owner information. 497 * @fown contains the file owner information.
498 * @sig is the signal that will be sent. When 0, kernel sends SIGIO. 498 * @sig is the signal that will be sent. When 0, kernel sends SIGIO.
@@ -1324,7 +1324,7 @@ struct security_operations {
1324 1324
1325 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1325 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1326 1326
1327 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1327 int (*getprocattr)(struct task_struct *p, char *name, char **value);
1328 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1328 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1329 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1329 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1330 void (*release_secctx)(char *secdata, u32 seclen); 1330 void (*release_secctx)(char *secdata, u32 seclen);
@@ -2092,9 +2092,9 @@ static inline void security_d_instantiate (struct dentry *dentry, struct inode *
2092 security_ops->d_instantiate (dentry, inode); 2092 security_ops->d_instantiate (dentry, inode);
2093} 2093}
2094 2094
2095static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 2095static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
2096{ 2096{
2097 return security_ops->getprocattr(p, name, value, size); 2097 return security_ops->getprocattr(p, name, value);
2098} 2098}
2099 2099
2100static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size) 2100static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
@@ -2130,7 +2130,7 @@ extern int mod_reg_security (const char *name, struct security_operations *ops);
2130extern int mod_unreg_security (const char *name, struct security_operations *ops); 2130extern int mod_unreg_security (const char *name, struct security_operations *ops);
2131extern struct dentry *securityfs_create_file(const char *name, mode_t mode, 2131extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
2132 struct dentry *parent, void *data, 2132 struct dentry *parent, void *data,
2133 struct file_operations *fops); 2133 const struct file_operations *fops);
2134extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent); 2134extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
2135extern void securityfs_remove(struct dentry *dentry); 2135extern void securityfs_remove(struct dentry *dentry);
2136 2136
@@ -2749,7 +2749,7 @@ static inline int security_sem_semop (struct sem_array * sma,
2749static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode) 2749static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
2750{ } 2750{ }
2751 2751
2752static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size) 2752static inline int security_getprocattr(struct task_struct *p, char *name, char **value)
2753{ 2753{
2754 return -EINVAL; 2754 return -EINVAL;
2755} 2755}
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 6b0648cfdffc..26e4925bc35b 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -2,7 +2,7 @@
2#define __LINUX_SEQLOCK_H 2#define __LINUX_SEQLOCK_H
3/* 3/*
4 * Reader/writer consistent mechanism without starving writers. This type of 4 * Reader/writer consistent mechanism without starving writers. This type of
5 * lock for data where the reader wants a consitent set of information 5 * lock for data where the reader wants a consistent set of information
6 * and is willing to retry if the information changes. Readers never 6 * and is willing to retry if the information changes. Readers never
7 * block but they may have to retry if a writer is in 7 * block but they may have to retry if a writer is in
8 * progress. Writers do not wait for readers. 8 * progress. Writers do not wait for readers.
@@ -61,10 +61,10 @@ static inline void write_seqlock(seqlock_t *sl)
61{ 61{
62 spin_lock(&sl->lock); 62 spin_lock(&sl->lock);
63 ++sl->sequence; 63 ++sl->sequence;
64 smp_wmb(); 64 smp_wmb();
65} 65}
66 66
67static inline void write_sequnlock(seqlock_t *sl) 67static inline void write_sequnlock(seqlock_t *sl)
68{ 68{
69 smp_wmb(); 69 smp_wmb();
70 sl->sequence++; 70 sl->sequence++;
@@ -77,7 +77,7 @@ static inline int write_tryseqlock(seqlock_t *sl)
77 77
78 if (ret) { 78 if (ret) {
79 ++sl->sequence; 79 ++sl->sequence;
80 smp_wmb(); 80 smp_wmb();
81 } 81 }
82 return ret; 82 return ret;
83} 83}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index cf23813cbec2..586aaba91720 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -122,7 +122,7 @@
122/*Digi jsm */ 122/*Digi jsm */
123#define PORT_JSM 69 123#define PORT_JSM 69
124 124
125#define PORT_IP3106 70 125#define PORT_PNX8XXX 70
126 126
127/* Hilscher netx */ 127/* Hilscher netx */
128#define PORT_NETX 71 128#define PORT_NETX 71
diff --git a/include/linux/serial_ip3106.h b/include/linux/serial_ip3106.h
deleted file mode 100644
index f500ac602c5c..000000000000
--- a/include/linux/serial_ip3106.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Embedded Alley Solutions, source@embeddedalley.com.
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 _LINUX_SERIAL_IP3106_H
20#define _LINUX_SERIAL_IP3106_H
21
22#include <linux/serial_core.h>
23#include <linux/device.h>
24
25#define IP3106_NR_PORTS 2
26
27struct ip3106_port {
28 struct uart_port port;
29 struct timer_list timer;
30 unsigned int old_status;
31};
32
33/* register offsets */
34#define IP3106_LCR 0
35#define IP3106_MCR 0x004
36#define IP3106_BAUD 0x008
37#define IP3106_CFG 0x00c
38#define IP3106_FIFO 0x028
39#define IP3106_ISTAT 0xfe0
40#define IP3106_IEN 0xfe4
41#define IP3106_ICLR 0xfe8
42#define IP3106_ISET 0xfec
43#define IP3106_PD 0xff4
44#define IP3106_MID 0xffc
45
46#define IP3106_UART_LCR_TXBREAK (1<<30)
47#define IP3106_UART_LCR_PAREVN 0x10000000
48#define IP3106_UART_LCR_PAREN 0x08000000
49#define IP3106_UART_LCR_2STOPB 0x04000000
50#define IP3106_UART_LCR_8BIT 0x01000000
51#define IP3106_UART_LCR_TX_RST 0x00040000
52#define IP3106_UART_LCR_RX_RST 0x00020000
53#define IP3106_UART_LCR_RX_NEXT 0x00010000
54
55#define IP3106_UART_MCR_SCR 0xFF000000
56#define IP3106_UART_MCR_DCD 0x00800000
57#define IP3106_UART_MCR_CTS 0x00100000
58#define IP3106_UART_MCR_LOOP 0x00000010
59#define IP3106_UART_MCR_RTS 0x00000002
60#define IP3106_UART_MCR_DTR 0x00000001
61
62#define IP3106_UART_INT_TX 0x00000080
63#define IP3106_UART_INT_EMPTY 0x00000040
64#define IP3106_UART_INT_RCVTO 0x00000020
65#define IP3106_UART_INT_RX 0x00000010
66#define IP3106_UART_INT_RXOVRN 0x00000008
67#define IP3106_UART_INT_FRERR 0x00000004
68#define IP3106_UART_INT_BREAK 0x00000002
69#define IP3106_UART_INT_PARITY 0x00000001
70#define IP3106_UART_INT_ALLRX 0x0000003F
71#define IP3106_UART_INT_ALLTX 0x000000C0
72
73#define IP3106_UART_FIFO_TXFIFO 0x001F0000
74#define IP3106_UART_FIFO_TXFIFO_STA (0x1f<<16)
75#define IP3106_UART_FIFO_RXBRK 0x00008000
76#define IP3106_UART_FIFO_RXFE 0x00004000
77#define IP3106_UART_FIFO_RXPAR 0x00002000
78#define IP3106_UART_FIFO_RXFIFO 0x00001F00
79#define IP3106_UART_FIFO_RBRTHR 0x000000FF
80
81#endif
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h
new file mode 100644
index 000000000000..de6c19c7f340
--- /dev/null
+++ b/include/linux/serial_pnx8xxx.h
@@ -0,0 +1,81 @@
1/*
2 * Embedded Alley Solutions, source@embeddedalley.com.
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 _LINUX_SERIAL_PNX8XXX_H
20#define _LINUX_SERIAL_PNX8XXX_H
21
22#include <linux/serial_core.h>
23#include <linux/device.h>
24
25#define PNX8XXX_NR_PORTS 2
26
27struct pnx8xxx_port {
28 struct uart_port port;
29 struct timer_list timer;
30 unsigned int old_status;
31};
32
33/* register offsets */
34#define PNX8XXX_LCR 0
35#define PNX8XXX_MCR 0x004
36#define PNX8XXX_BAUD 0x008
37#define PNX8XXX_CFG 0x00c
38#define PNX8XXX_FIFO 0x028
39#define PNX8XXX_ISTAT 0xfe0
40#define PNX8XXX_IEN 0xfe4
41#define PNX8XXX_ICLR 0xfe8
42#define PNX8XXX_ISET 0xfec
43#define PNX8XXX_PD 0xff4
44#define PNX8XXX_MID 0xffc
45
46#define PNX8XXX_UART_LCR_TXBREAK (1<<30)
47#define PNX8XXX_UART_LCR_PAREVN 0x10000000
48#define PNX8XXX_UART_LCR_PAREN 0x08000000
49#define PNX8XXX_UART_LCR_2STOPB 0x04000000
50#define PNX8XXX_UART_LCR_8BIT 0x01000000
51#define PNX8XXX_UART_LCR_TX_RST 0x00040000
52#define PNX8XXX_UART_LCR_RX_RST 0x00020000
53#define PNX8XXX_UART_LCR_RX_NEXT 0x00010000
54
55#define PNX8XXX_UART_MCR_SCR 0xFF000000
56#define PNX8XXX_UART_MCR_DCD 0x00800000
57#define PNX8XXX_UART_MCR_CTS 0x00100000
58#define PNX8XXX_UART_MCR_LOOP 0x00000010
59#define PNX8XXX_UART_MCR_RTS 0x00000002
60#define PNX8XXX_UART_MCR_DTR 0x00000001
61
62#define PNX8XXX_UART_INT_TX 0x00000080
63#define PNX8XXX_UART_INT_EMPTY 0x00000040
64#define PNX8XXX_UART_INT_RCVTO 0x00000020
65#define PNX8XXX_UART_INT_RX 0x00000010
66#define PNX8XXX_UART_INT_RXOVRN 0x00000008
67#define PNX8XXX_UART_INT_FRERR 0x00000004
68#define PNX8XXX_UART_INT_BREAK 0x00000002
69#define PNX8XXX_UART_INT_PARITY 0x00000001
70#define PNX8XXX_UART_INT_ALLRX 0x0000003F
71#define PNX8XXX_UART_INT_ALLTX 0x000000C0
72
73#define PNX8XXX_UART_FIFO_TXFIFO 0x001F0000
74#define PNX8XXX_UART_FIFO_TXFIFO_STA (0x1f<<16)
75#define PNX8XXX_UART_FIFO_RXBRK 0x00008000
76#define PNX8XXX_UART_FIFO_RXFE 0x00004000
77#define PNX8XXX_UART_FIFO_RXPAR 0x00002000
78#define PNX8XXX_UART_FIFO_RXFIFO 0x00001F00
79#define PNX8XXX_UART_FIFO_RBRTHR 0x000000FF
80
81#endif
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 0f478a8791a2..1ebf0455e224 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -86,6 +86,11 @@ static inline void serio_register_port(struct serio *serio)
86void serio_unregister_port(struct serio *serio); 86void serio_unregister_port(struct serio *serio);
87void serio_unregister_child_port(struct serio *serio); 87void serio_unregister_child_port(struct serio *serio);
88 88
89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
90static inline int serio_register_driver(struct serio_driver *drv)
91{
92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
93}
89int serio_register_driver(struct serio_driver *drv); 94int serio_register_driver(struct serio_driver *drv);
90void serio_unregister_driver(struct serio_driver *drv); 95void serio_unregister_driver(struct serio_driver *drv);
91 96
@@ -103,12 +108,6 @@ static inline void serio_drv_write_wakeup(struct serio *serio)
103 serio->drv->write_wakeup(serio); 108 serio->drv->write_wakeup(serio);
104} 109}
105 110
106static inline void serio_cleanup(struct serio *serio)
107{
108 if (serio->drv && serio->drv->cleanup)
109 serio->drv->cleanup(serio);
110}
111
112/* 111/*
113 * Use the following functions to manipulate serio's per-port 112 * Use the following functions to manipulate serio's per-port
114 * driver-specific data. 113 * driver-specific data.
diff --git a/include/linux/shm.h b/include/linux/shm.h
index a2c896ad0bef..ad2e3af65997 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -96,12 +96,17 @@ struct shmid_kernel /* private to the kernel */
96 96
97#ifdef CONFIG_SYSVIPC 97#ifdef CONFIG_SYSVIPC
98long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); 98long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
99extern int is_file_shm_hugepages(struct file *file);
99#else 100#else
100static inline long do_shmat(int shmid, char __user *shmaddr, 101static inline long do_shmat(int shmid, char __user *shmaddr,
101 int shmflg, unsigned long *addr) 102 int shmflg, unsigned long *addr)
102{ 103{
103 return -ENOSYS; 104 return -ENOSYS;
104} 105}
106static inline int is_file_shm_hugepages(struct file *file)
107{
108 return 0;
109}
105#endif 110#endif
106 111
107#endif /* __KERNEL__ */ 112#endif /* __KERNEL__ */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4ff3940210d8..253a2b9be9d6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,20 +27,24 @@
27#include <net/checksum.h> 27#include <net/checksum.h>
28#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h>
30 31
31#define HAVE_ALLOC_SKB /* For the drivers to know */ 32#define HAVE_ALLOC_SKB /* For the drivers to know */
32#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
33 34
35/* Don't change this without changing skb_csum_unnecessary! */
34#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
35#define CHECKSUM_PARTIAL 1 37#define CHECKSUM_UNNECESSARY 1
36#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_COMPLETE 2
37#define CHECKSUM_COMPLETE 3 39#define CHECKSUM_PARTIAL 3
38 40
39#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
40 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
41#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \ 43#define SKB_WITH_OVERHEAD(X) \
42 sizeof(struct skb_shared_info)) & \ 44 (((X) - sizeof(struct skb_shared_info)) & \
43 ~(SMP_CACHE_BYTES - 1)) 45 ~(SMP_CACHE_BYTES - 1))
46#define SKB_MAX_ORDER(X, ORDER) \
47 SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
44#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) 48#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
45#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) 49#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
46 50
@@ -66,8 +70,8 @@
66 * NONE: skb is checksummed by protocol or csum is not required. 70 * NONE: skb is checksummed by protocol or csum is not required.
67 * 71 *
68 * PARTIAL: device is required to csum packet as seen by hard_start_xmit 72 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
69 * from skb->h.raw to the end and to record the checksum 73 * from skb->transport_header to the end and to record the checksum
70 * at skb->h.raw+skb->csum. 74 * at skb->transport_header + skb->csum.
71 * 75 *
72 * Device must show its capabilities in dev->features, set 76 * Device must show its capabilities in dev->features, set
73 * at device setup time. 77 * at device setup time.
@@ -83,12 +87,13 @@
83 */ 87 */
84 88
85struct net_device; 89struct net_device;
90struct scatterlist;
86 91
87#ifdef CONFIG_NETFILTER 92#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
88struct nf_conntrack { 93struct nf_conntrack {
89 atomic_t use; 94 atomic_t use;
90 void (*destroy)(struct nf_conntrack *);
91}; 95};
96#endif
92 97
93#ifdef CONFIG_BRIDGE_NETFILTER 98#ifdef CONFIG_BRIDGE_NETFILTER
94struct nf_bridge_info { 99struct nf_bridge_info {
@@ -103,8 +108,6 @@ struct nf_bridge_info {
103}; 108};
104#endif 109#endif
105 110
106#endif
107
108struct sk_buff_head { 111struct sk_buff_head {
109 /* These two members must be first. */ 112 /* These two members must be first. */
110 struct sk_buff *next; 113 struct sk_buff *next;
@@ -156,11 +159,6 @@ struct skb_shared_info {
156#define SKB_DATAREF_SHIFT 16 159#define SKB_DATAREF_SHIFT 16
157#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 160#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
158 161
159struct skb_timeval {
160 u32 off_sec;
161 u32 off_usec;
162};
163
164 162
165enum { 163enum {
166 SKB_FCLONE_UNAVAILABLE, 164 SKB_FCLONE_UNAVAILABLE,
@@ -181,6 +179,16 @@ enum {
181 SKB_GSO_TCPV6 = 1 << 4, 179 SKB_GSO_TCPV6 = 1 << 4,
182}; 180};
183 181
182#if BITS_PER_LONG > 32
183#define NET_SKBUFF_DATA_USES_OFFSET 1
184#endif
185
186#ifdef NET_SKBUFF_DATA_USES_OFFSET
187typedef unsigned int sk_buff_data_t;
188#else
189typedef unsigned char *sk_buff_data_t;
190#endif
191
184/** 192/**
185 * struct sk_buff - socket buffer 193 * struct sk_buff - socket buffer
186 * @next: Next buffer in list 194 * @next: Next buffer in list
@@ -188,17 +196,19 @@ enum {
188 * @sk: Socket we are owned by 196 * @sk: Socket we are owned by
189 * @tstamp: Time we arrived 197 * @tstamp: Time we arrived
190 * @dev: Device we arrived on/are leaving by 198 * @dev: Device we arrived on/are leaving by
191 * @input_dev: Device we arrived on 199 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 200 * @h: Transport layer header
193 * @nh: Network layer header 201 * @network_header: Network layer header
194 * @mac: Link layer header 202 * @mac_header: Link layer header
195 * @dst: destination entry 203 * @dst: destination entry
196 * @sp: the security path, used for xfrm 204 * @sp: the security path, used for xfrm
197 * @cb: Control buffer. Free for use by every layer. Put private vars here 205 * @cb: Control buffer. Free for use by every layer. Put private vars here
198 * @len: Length of actual data 206 * @len: Length of actual data
199 * @data_len: Data length 207 * @data_len: Data length
200 * @mac_len: Length of link layer header 208 * @mac_len: Length of link layer header
201 * @csum: Checksum 209 * @csum: Checksum (must include start/offset pair)
210 * @csum_start: Offset from skb->head where checksumming should start
211 * @csum_offset: Offset from csum_start where checksum should be stored
202 * @local_df: allow local fragmentation 212 * @local_df: allow local fragmentation
203 * @cloned: Head may be cloned (check refcnt to be sure) 213 * @cloned: Head may be cloned (check refcnt to be sure)
204 * @nohdr: Payload reference only, must not modify header 214 * @nohdr: Payload reference only, must not modify header
@@ -233,30 +243,10 @@ struct sk_buff {
233 struct sk_buff *prev; 243 struct sk_buff *prev;
234 244
235 struct sock *sk; 245 struct sock *sk;
236 struct skb_timeval tstamp; 246 ktime_t tstamp;
237 struct net_device *dev; 247 struct net_device *dev;
238 struct net_device *input_dev; 248 int iif;
239 249 /* 4 byte hole on 64 bit*/
240 union {
241 struct tcphdr *th;
242 struct udphdr *uh;
243 struct icmphdr *icmph;
244 struct igmphdr *igmph;
245 struct iphdr *ipiph;
246 struct ipv6hdr *ipv6h;
247 unsigned char *raw;
248 } h;
249
250 union {
251 struct iphdr *iph;
252 struct ipv6hdr *ipv6h;
253 struct arphdr *arph;
254 unsigned char *raw;
255 } nh;
256
257 union {
258 unsigned char *raw;
259 } mac;
260 250
261 struct dst_entry *dst; 251 struct dst_entry *dst;
262 struct sec_path *sp; 252 struct sec_path *sp;
@@ -274,7 +264,10 @@ struct sk_buff {
274 mac_len; 264 mac_len;
275 union { 265 union {
276 __wsum csum; 266 __wsum csum;
277 __u32 csum_offset; 267 struct {
268 __u16 csum_start;
269 __u16 csum_offset;
270 };
278 }; 271 };
279 __u32 priority; 272 __u32 priority;
280 __u8 local_df:1, 273 __u8 local_df:1,
@@ -288,15 +281,13 @@ struct sk_buff {
288 __be16 protocol; 281 __be16 protocol;
289 282
290 void (*destructor)(struct sk_buff *skb); 283 void (*destructor)(struct sk_buff *skb);
291#ifdef CONFIG_NETFILTER
292 struct nf_conntrack *nfct;
293#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 284#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
285 struct nf_conntrack *nfct;
294 struct sk_buff *nfct_reasm; 286 struct sk_buff *nfct_reasm;
295#endif 287#endif
296#ifdef CONFIG_BRIDGE_NETFILTER 288#ifdef CONFIG_BRIDGE_NETFILTER
297 struct nf_bridge_info *nf_bridge; 289 struct nf_bridge_info *nf_bridge;
298#endif 290#endif
299#endif /* CONFIG_NETFILTER */
300#ifdef CONFIG_NET_SCHED 291#ifdef CONFIG_NET_SCHED
301 __u16 tc_index; /* traffic control index */ 292 __u16 tc_index; /* traffic control index */
302#ifdef CONFIG_NET_CLS_ACT 293#ifdef CONFIG_NET_CLS_ACT
@@ -312,13 +303,16 @@ struct sk_buff {
312 303
313 __u32 mark; 304 __u32 mark;
314 305
306 sk_buff_data_t transport_header;
307 sk_buff_data_t network_header;
308 sk_buff_data_t mac_header;
315 /* These elements must be at the end, see alloc_skb() for details. */ 309 /* These elements must be at the end, see alloc_skb() for details. */
310 sk_buff_data_t tail;
311 sk_buff_data_t end;
312 unsigned char *head,
313 *data;
316 unsigned int truesize; 314 unsigned int truesize;
317 atomic_t users; 315 atomic_t users;
318 unsigned char *head,
319 *data,
320 *tail,
321 *end;
322}; 316};
323 317
324#ifdef __KERNEL__ 318#ifdef __KERNEL__
@@ -345,9 +339,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
345 return __alloc_skb(size, priority, 1, -1); 339 return __alloc_skb(size, priority, 1, -1);
346} 340}
347 341
348extern struct sk_buff *alloc_skb_from_cache(struct kmem_cache *cp,
349 unsigned int size,
350 gfp_t priority);
351extern void kfree_skbmem(struct sk_buff *skb); 342extern void kfree_skbmem(struct sk_buff *skb);
352extern struct sk_buff *skb_clone(struct sk_buff *skb, 343extern struct sk_buff *skb_clone(struct sk_buff *skb,
353 gfp_t priority); 344 gfp_t priority);
@@ -363,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
363extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 354extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
364 int newheadroom, int newtailroom, 355 int newheadroom, int newtailroom,
365 gfp_t priority); 356 gfp_t priority);
357extern int skb_to_sgvec(struct sk_buff *skb,
358 struct scatterlist *sg, int offset,
359 int len);
360extern int skb_cow_data(struct sk_buff *skb, int tailbits,
361 struct sk_buff **trailer);
366extern int skb_pad(struct sk_buff *skb, int pad); 362extern int skb_pad(struct sk_buff *skb, int pad);
367#define dev_kfree_skb(a) kfree_skb(a) 363#define dev_kfree_skb(a) kfree_skb(a)
368extern void skb_over_panic(struct sk_buff *skb, int len, 364extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -404,8 +400,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
404 unsigned int to, struct ts_config *config, 400 unsigned int to, struct ts_config *config,
405 struct ts_state *state); 401 struct ts_state *state);
406 402
403#ifdef NET_SKBUFF_DATA_USES_OFFSET
404static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
405{
406 return skb->head + skb->end;
407}
408#else
409static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
410{
411 return skb->end;
412}
413#endif
414
407/* Internal */ 415/* Internal */
408#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 416#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
409 417
410/** 418/**
411 * skb_queue_empty - check if a queue is empty 419 * skb_queue_empty - check if a queue is empty
@@ -621,6 +629,13 @@ static inline void skb_queue_head_init(struct sk_buff_head *list)
621 list->qlen = 0; 629 list->qlen = 0;
622} 630}
623 631
632static inline void skb_queue_head_init_class(struct sk_buff_head *list,
633 struct lock_class_key *class)
634{
635 skb_queue_head_init(list);
636 lockdep_set_class(&list->lock, class);
637}
638
624/* 639/*
625 * Insert an sk_buff at the start of a list. 640 * Insert an sk_buff at the start of a list.
626 * 641 *
@@ -817,12 +832,46 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
817#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 832#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
818#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 833#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
819 834
835#ifdef NET_SKBUFF_DATA_USES_OFFSET
836static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
837{
838 return skb->head + skb->tail;
839}
840
841static inline void skb_reset_tail_pointer(struct sk_buff *skb)
842{
843 skb->tail = skb->data - skb->head;
844}
845
846static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
847{
848 skb_reset_tail_pointer(skb);
849 skb->tail += offset;
850}
851#else /* NET_SKBUFF_DATA_USES_OFFSET */
852static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
853{
854 return skb->tail;
855}
856
857static inline void skb_reset_tail_pointer(struct sk_buff *skb)
858{
859 skb->tail = skb->data;
860}
861
862static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
863{
864 skb->tail = skb->data + offset;
865}
866
867#endif /* NET_SKBUFF_DATA_USES_OFFSET */
868
820/* 869/*
821 * Add data to an sk_buff 870 * Add data to an sk_buff
822 */ 871 */
823static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 872static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
824{ 873{
825 unsigned char *tmp = skb->tail; 874 unsigned char *tmp = skb_tail_pointer(skb);
826 SKB_LINEAR_ASSERT(skb); 875 SKB_LINEAR_ASSERT(skb);
827 skb->tail += len; 876 skb->tail += len;
828 skb->len += len; 877 skb->len += len;
@@ -840,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
840 */ 889 */
841static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) 890static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
842{ 891{
843 unsigned char *tmp = skb->tail; 892 unsigned char *tmp = skb_tail_pointer(skb);
844 SKB_LINEAR_ASSERT(skb); 893 SKB_LINEAR_ASSERT(skb);
845 skb->tail += len; 894 skb->tail += len;
846 skb->len += len; 895 skb->len += len;
847 if (unlikely(skb->tail>skb->end)) 896 if (unlikely(skb->tail > skb->end))
848 skb_over_panic(skb, len, current_text_addr()); 897 skb_over_panic(skb, len, current_text_addr());
849 return tmp; 898 return tmp;
850} 899}
@@ -957,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
957 skb->tail += len; 1006 skb->tail += len;
958} 1007}
959 1008
1009#ifdef NET_SKBUFF_DATA_USES_OFFSET
1010static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1011{
1012 return skb->head + skb->transport_header;
1013}
1014
1015static inline void skb_reset_transport_header(struct sk_buff *skb)
1016{
1017 skb->transport_header = skb->data - skb->head;
1018}
1019
1020static inline void skb_set_transport_header(struct sk_buff *skb,
1021 const int offset)
1022{
1023 skb_reset_transport_header(skb);
1024 skb->transport_header += offset;
1025}
1026
1027static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1028{
1029 return skb->head + skb->network_header;
1030}
1031
1032static inline void skb_reset_network_header(struct sk_buff *skb)
1033{
1034 skb->network_header = skb->data - skb->head;
1035}
1036
1037static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1038{
1039 skb_reset_network_header(skb);
1040 skb->network_header += offset;
1041}
1042
1043static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1044{
1045 return skb->head + skb->mac_header;
1046}
1047
1048static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1049{
1050 return skb->mac_header != ~0U;
1051}
1052
1053static inline void skb_reset_mac_header(struct sk_buff *skb)
1054{
1055 skb->mac_header = skb->data - skb->head;
1056}
1057
1058static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1059{
1060 skb_reset_mac_header(skb);
1061 skb->mac_header += offset;
1062}
1063
1064#else /* NET_SKBUFF_DATA_USES_OFFSET */
1065
1066static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1067{
1068 return skb->transport_header;
1069}
1070
1071static inline void skb_reset_transport_header(struct sk_buff *skb)
1072{
1073 skb->transport_header = skb->data;
1074}
1075
1076static inline void skb_set_transport_header(struct sk_buff *skb,
1077 const int offset)
1078{
1079 skb->transport_header = skb->data + offset;
1080}
1081
1082static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1083{
1084 return skb->network_header;
1085}
1086
1087static inline void skb_reset_network_header(struct sk_buff *skb)
1088{
1089 skb->network_header = skb->data;
1090}
1091
1092static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1093{
1094 skb->network_header = skb->data + offset;
1095}
1096
1097static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1098{
1099 return skb->mac_header;
1100}
1101
1102static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1103{
1104 return skb->mac_header != NULL;
1105}
1106
1107static inline void skb_reset_mac_header(struct sk_buff *skb)
1108{
1109 skb->mac_header = skb->data;
1110}
1111
1112static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1113{
1114 skb->mac_header = skb->data + offset;
1115}
1116#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1117
1118static inline int skb_transport_offset(const struct sk_buff *skb)
1119{
1120 return skb_transport_header(skb) - skb->data;
1121}
1122
1123static inline u32 skb_network_header_len(const struct sk_buff *skb)
1124{
1125 return skb->transport_header - skb->network_header;
1126}
1127
1128static inline int skb_network_offset(const struct sk_buff *skb)
1129{
1130 return skb_network_header(skb) - skb->data;
1131}
1132
960/* 1133/*
961 * CPUs often take a performance hit when accessing unaligned memory 1134 * CPUs often take a performance hit when accessing unaligned memory
962 * locations. The actual performance hit varies, it can be small if the 1135 * locations. The actual performance hit varies, it can be small if the
@@ -1008,8 +1181,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1008 WARN_ON(1); 1181 WARN_ON(1);
1009 return; 1182 return;
1010 } 1183 }
1011 skb->len = len; 1184 skb->len = len;
1012 skb->tail = skb->data + len; 1185 skb_set_tail_pointer(skb, len);
1013} 1186}
1014 1187
1015/** 1188/**
@@ -1298,6 +1471,11 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1298 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1471 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1299 skb = skb->next) 1472 skb = skb->next)
1300 1473
1474#define skb_queue_walk_safe(queue, skb, tmp) \
1475 for (skb = (queue)->next, tmp = skb->next; \
1476 skb != (struct sk_buff *)(queue); \
1477 skb = tmp, tmp = skb->next)
1478
1301#define skb_queue_reverse_walk(queue, skb) \ 1479#define skb_queue_reverse_walk(queue, skb) \
1302 for (skb = (queue)->prev; \ 1480 for (skb = (queue)->prev; \
1303 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1481 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
@@ -1321,8 +1499,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1321 int len, __wsum csum); 1499 int len, __wsum csum);
1322extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1500extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1323 void *to, int len); 1501 void *to, int len);
1324extern int skb_store_bits(const struct sk_buff *skb, int offset, 1502extern int skb_store_bits(struct sk_buff *skb, int offset,
1325 void *from, int len); 1503 const void *from, int len);
1326extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1504extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1327 int offset, u8 *to, int len, 1505 int offset, u8 *to, int len,
1328 __wsum csum); 1506 __wsum csum);
@@ -1346,8 +1524,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1346 return buffer; 1524 return buffer;
1347} 1525}
1348 1526
1527static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
1528 void *to,
1529 const unsigned int len)
1530{
1531 memcpy(to, skb->data, len);
1532}
1533
1534static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
1535 const int offset, void *to,
1536 const unsigned int len)
1537{
1538 memcpy(to, skb->data + offset, len);
1539}
1540
1541static inline void skb_copy_to_linear_data(struct sk_buff *skb,
1542 const void *from,
1543 const unsigned int len)
1544{
1545 memcpy(skb->data, from, len);
1546}
1547
1548static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1549 const int offset,
1550 const void *from,
1551 const unsigned int len)
1552{
1553 memcpy(skb->data + offset, from, len);
1554}
1555
1349extern void skb_init(void); 1556extern void skb_init(void);
1350extern void skb_add_mtu(int mtu);
1351 1557
1352/** 1558/**
1353 * skb_get_timestamp - get timestamp from a skb 1559 * skb_get_timestamp - get timestamp from a skb
@@ -1360,29 +1566,28 @@ extern void skb_add_mtu(int mtu);
1360 */ 1566 */
1361static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1567static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
1362{ 1568{
1363 stamp->tv_sec = skb->tstamp.off_sec; 1569 *stamp = ktime_to_timeval(skb->tstamp);
1364 stamp->tv_usec = skb->tstamp.off_usec;
1365} 1570}
1366 1571
1367/** 1572static inline void __net_timestamp(struct sk_buff *skb)
1368 * skb_set_timestamp - set timestamp of a skb 1573{
1369 * @skb: skb to set stamp of 1574 skb->tstamp = ktime_get_real();
1370 * @stamp: pointer to struct timeval to get stamp from 1575}
1371 * 1576
1372 * Timestamps are stored in the skb as offsets to a base timestamp. 1577static inline ktime_t net_timedelta(ktime_t t)
1373 * This function converts a struct timeval to an offset and stores
1374 * it in the skb.
1375 */
1376static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1377{ 1578{
1378 skb->tstamp.off_sec = stamp->tv_sec; 1579 return ktime_sub(ktime_get_real(), t);
1379 skb->tstamp.off_usec = stamp->tv_usec;
1380} 1580}
1381 1581
1382extern void __net_timestamp(struct sk_buff *skb);
1383 1582
1583extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1384extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1584extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1385 1585
1586static inline int skb_csum_unnecessary(const struct sk_buff *skb)
1587{
1588 return skb->ip_summed & CHECKSUM_UNNECESSARY;
1589}
1590
1386/** 1591/**
1387 * skb_checksum_complete - Calculate checksum of an entire packet 1592 * skb_checksum_complete - Calculate checksum of an entire packet
1388 * @skb: packet to process 1593 * @skb: packet to process
@@ -1401,22 +1606,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1401 */ 1606 */
1402static inline unsigned int skb_checksum_complete(struct sk_buff *skb) 1607static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
1403{ 1608{
1404 return skb->ip_summed != CHECKSUM_UNNECESSARY && 1609 return skb_csum_unnecessary(skb) ?
1405 __skb_checksum_complete(skb); 1610 0 : __skb_checksum_complete(skb);
1406} 1611}
1407 1612
1408#ifdef CONFIG_NETFILTER 1613#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1614extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
1409static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1615static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1410{ 1616{
1411 if (nfct && atomic_dec_and_test(&nfct->use)) 1617 if (nfct && atomic_dec_and_test(&nfct->use))
1412 nfct->destroy(nfct); 1618 nf_conntrack_destroy(nfct);
1413} 1619}
1414static inline void nf_conntrack_get(struct nf_conntrack *nfct) 1620static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1415{ 1621{
1416 if (nfct) 1622 if (nfct)
1417 atomic_inc(&nfct->use); 1623 atomic_inc(&nfct->use);
1418} 1624}
1419#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1420static inline void nf_conntrack_get_reasm(struct sk_buff *skb) 1625static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1421{ 1626{
1422 if (skb) 1627 if (skb)
@@ -1442,9 +1647,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1442#endif /* CONFIG_BRIDGE_NETFILTER */ 1647#endif /* CONFIG_BRIDGE_NETFILTER */
1443static inline void nf_reset(struct sk_buff *skb) 1648static inline void nf_reset(struct sk_buff *skb)
1444{ 1649{
1650#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1445 nf_conntrack_put(skb->nfct); 1651 nf_conntrack_put(skb->nfct);
1446 skb->nfct = NULL; 1652 skb->nfct = NULL;
1447#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1448 nf_conntrack_put_reasm(skb->nfct_reasm); 1653 nf_conntrack_put_reasm(skb->nfct_reasm);
1449 skb->nfct_reasm = NULL; 1654 skb->nfct_reasm = NULL;
1450#endif 1655#endif
@@ -1454,9 +1659,33 @@ static inline void nf_reset(struct sk_buff *skb)
1454#endif 1659#endif
1455} 1660}
1456 1661
1457#else /* CONFIG_NETFILTER */ 1662/* Note: This doesn't put any conntrack and bridge info in dst. */
1458static inline void nf_reset(struct sk_buff *skb) {} 1663static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1459#endif /* CONFIG_NETFILTER */ 1664{
1665#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1666 dst->nfct = src->nfct;
1667 nf_conntrack_get(src->nfct);
1668 dst->nfctinfo = src->nfctinfo;
1669 dst->nfct_reasm = src->nfct_reasm;
1670 nf_conntrack_get_reasm(src->nfct_reasm);
1671#endif
1672#ifdef CONFIG_BRIDGE_NETFILTER
1673 dst->nf_bridge = src->nf_bridge;
1674 nf_bridge_get(src->nf_bridge);
1675#endif
1676}
1677
1678static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1679{
1680#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1681 nf_conntrack_put(dst->nfct);
1682 nf_conntrack_put_reasm(dst->nfct_reasm);
1683#endif
1684#ifdef CONFIG_BRIDGE_NETFILTER
1685 nf_bridge_put(dst->nf_bridge);
1686#endif
1687 __nf_copy(dst, src);
1688}
1460 1689
1461#ifdef CONFIG_NETWORK_SECMARK 1690#ifdef CONFIG_NETWORK_SECMARK
1462static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) 1691static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
@@ -1481,5 +1710,12 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1481 return skb_shinfo(skb)->gso_size; 1710 return skb_shinfo(skb)->gso_size;
1482} 1711}
1483 1712
1713static inline void skb_forward_csum(struct sk_buff *skb)
1714{
1715 /* Unfortunately we don't support this one. Any brave souls? */
1716 if (skb->ip_summed == CHECKSUM_COMPLETE)
1717 skb->ip_summed = CHECKSUM_NONE;
1718}
1719
1484#endif /* __KERNEL__ */ 1720#endif /* __KERNEL__ */
1485#endif /* _LINUX_SKBUFF_H */ 1721#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 4b463e66ddea..5e4364644ed1 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -19,7 +19,9 @@
19struct cache_sizes { 19struct cache_sizes {
20 size_t cs_size; 20 size_t cs_size;
21 struct kmem_cache *cs_cachep; 21 struct kmem_cache *cs_cachep;
22#ifdef CONFIG_ZONE_DMA
22 struct kmem_cache *cs_dmacachep; 23 struct kmem_cache *cs_dmacachep;
24#endif
23}; 25};
24extern struct cache_sizes malloc_sizes[]; 26extern struct cache_sizes malloc_sizes[];
25 27
@@ -39,9 +41,12 @@ static inline void *kmalloc(size_t size, gfp_t flags)
39 __you_cannot_kmalloc_that_much(); 41 __you_cannot_kmalloc_that_much();
40 } 42 }
41found: 43found:
42 return kmem_cache_alloc((flags & GFP_DMA) ? 44#ifdef CONFIG_ZONE_DMA
43 malloc_sizes[i].cs_dmacachep : 45 if (flags & GFP_DMA)
44 malloc_sizes[i].cs_cachep, flags); 46 return kmem_cache_alloc(malloc_sizes[i].cs_dmacachep,
47 flags);
48#endif
49 return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags);
45 } 50 }
46 return __kmalloc(size, flags); 51 return __kmalloc(size, flags);
47} 52}
@@ -62,9 +67,12 @@ static inline void *kzalloc(size_t size, gfp_t flags)
62 __you_cannot_kzalloc_that_much(); 67 __you_cannot_kzalloc_that_much();
63 } 68 }
64found: 69found:
65 return kmem_cache_zalloc((flags & GFP_DMA) ? 70#ifdef CONFIG_ZONE_DMA
66 malloc_sizes[i].cs_dmacachep : 71 if (flags & GFP_DMA)
67 malloc_sizes[i].cs_cachep, flags); 72 return kmem_cache_zalloc(malloc_sizes[i].cs_dmacachep,
73 flags);
74#endif
75 return kmem_cache_zalloc(malloc_sizes[i].cs_cachep, flags);
68 } 76 }
69 return __kzalloc(size, flags); 77 return __kzalloc(size, flags);
70} 78}
@@ -88,9 +96,13 @@ static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
88 __you_cannot_kmalloc_that_much(); 96 __you_cannot_kmalloc_that_much();
89 } 97 }
90found: 98found:
91 return kmem_cache_alloc_node((flags & GFP_DMA) ? 99#ifdef CONFIG_ZONE_DMA
92 malloc_sizes[i].cs_dmacachep : 100 if (flags & GFP_DMA)
93 malloc_sizes[i].cs_cachep, flags, node); 101 return kmem_cache_alloc_node(malloc_sizes[i].cs_dmacachep,
102 flags, node);
103#endif
104 return kmem_cache_alloc_node(malloc_sizes[i].cs_cachep,
105 flags, node);
94 } 106 }
95 return __kmalloc_node(size, flags, node); 107 return __kmalloc_node(size, flags, node);
96} 108}
diff --git a/include/linux/sm501-regs.h b/include/linux/sm501-regs.h
new file mode 100644
index 000000000000..cc9be4a11861
--- /dev/null
+++ b/include/linux/sm501-regs.h
@@ -0,0 +1,357 @@
1/* sm501-regs.h
2 *
3 * Copyright 2006 Simtec Electronics
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 version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Silicon Motion SM501 register definitions
10*/
11
12/* System Configuration area */
13/* System config base */
14#define SM501_SYS_CONFIG (0x000000)
15
16/* config 1 */
17#define SM501_SYSTEM_CONTROL (0x000000)
18#define SM501_MISC_CONTROL (0x000004)
19
20#define SM501_MISC_BUS_SH (0x0)
21#define SM501_MISC_BUS_PCI (0x1)
22#define SM501_MISC_BUS_XSCALE (0x2)
23#define SM501_MISC_BUS_NEC (0x6)
24#define SM501_MISC_BUS_MASK (0x7)
25
26#define SM501_MISC_VR_62MB (1<<3)
27#define SM501_MISC_CDR_RESET (1<<7)
28#define SM501_MISC_USB_LB (1<<8)
29#define SM501_MISC_USB_SLAVE (1<<9)
30#define SM501_MISC_BL_1 (1<<10)
31#define SM501_MISC_MC (1<<11)
32#define SM501_MISC_DAC_POWER (1<<12)
33#define SM501_MISC_IRQ_INVERT (1<<16)
34#define SM501_MISC_SH (1<<17)
35
36#define SM501_MISC_HOLD_EMPTY (0<<18)
37#define SM501_MISC_HOLD_8 (1<<18)
38#define SM501_MISC_HOLD_16 (2<<18)
39#define SM501_MISC_HOLD_24 (3<<18)
40#define SM501_MISC_HOLD_32 (4<<18)
41#define SM501_MISC_HOLD_MASK (7<<18)
42
43#define SM501_MISC_FREQ_12 (1<<24)
44#define SM501_MISC_PNL_24BIT (1<<25)
45#define SM501_MISC_8051_LE (1<<26)
46
47
48
49#define SM501_GPIO31_0_CONTROL (0x000008)
50#define SM501_GPIO63_32_CONTROL (0x00000C)
51#define SM501_DRAM_CONTROL (0x000010)
52
53/* command list */
54#define SM501_ARBTRTN_CONTROL (0x000014)
55
56/* command list */
57#define SM501_COMMAND_LIST_STATUS (0x000024)
58
59/* interrupt debug */
60#define SM501_RAW_IRQ_STATUS (0x000028)
61#define SM501_RAW_IRQ_CLEAR (0x000028)
62#define SM501_IRQ_STATUS (0x00002C)
63#define SM501_IRQ_MASK (0x000030)
64#define SM501_DEBUG_CONTROL (0x000034)
65
66/* power management */
67#define SM501_CURRENT_GATE (0x000038)
68#define SM501_CURRENT_CLOCK (0x00003C)
69#define SM501_POWER_MODE_0_GATE (0x000040)
70#define SM501_POWER_MODE_0_CLOCK (0x000044)
71#define SM501_POWER_MODE_1_GATE (0x000048)
72#define SM501_POWER_MODE_1_CLOCK (0x00004C)
73#define SM501_SLEEP_MODE_GATE (0x000050)
74#define SM501_POWER_MODE_CONTROL (0x000054)
75
76/* power gates for units within the 501 */
77#define SM501_GATE_HOST (0)
78#define SM501_GATE_MEMORY (1)
79#define SM501_GATE_DISPLAY (2)
80#define SM501_GATE_2D_ENGINE (3)
81#define SM501_GATE_CSC (4)
82#define SM501_GATE_ZVPORT (5)
83#define SM501_GATE_GPIO (6)
84#define SM501_GATE_UART0 (7)
85#define SM501_GATE_UART1 (8)
86#define SM501_GATE_SSP (10)
87#define SM501_GATE_USB_HOST (11)
88#define SM501_GATE_USB_GADGET (12)
89#define SM501_GATE_UCONTROLLER (17)
90#define SM501_GATE_AC97 (18)
91
92/* panel clock */
93#define SM501_CLOCK_P2XCLK (24)
94/* crt clock */
95#define SM501_CLOCK_V2XCLK (16)
96/* main clock */
97#define SM501_CLOCK_MCLK (8)
98/* SDRAM controller clock */
99#define SM501_CLOCK_M1XCLK (0)
100
101/* config 2 */
102#define SM501_PCI_MASTER_BASE (0x000058)
103#define SM501_ENDIAN_CONTROL (0x00005C)
104#define SM501_DEVICEID (0x000060)
105/* 0x050100A0 */
106
107#define SM501_PLLCLOCK_COUNT (0x000064)
108#define SM501_MISC_TIMING (0x000068)
109#define SM501_CURRENT_SDRAM_CLOCK (0x00006C)
110
111/* GPIO base */
112#define SM501_GPIO (0x010000)
113#define SM501_GPIO_DATA_LOW (0x00)
114#define SM501_GPIO_DATA_HIGH (0x04)
115#define SM501_GPIO_DDR_LOW (0x08)
116#define SM501_GPIO_DDR_HIGH (0x0C)
117#define SM501_GPIO_IRQ_SETUP (0x10)
118#define SM501_GPIO_IRQ_STATUS (0x14)
119#define SM501_GPIO_IRQ_RESET (0x14)
120
121/* I2C controller base */
122#define SM501_I2C (0x010040)
123#define SM501_I2C_BYTE_COUNT (0x00)
124#define SM501_I2C_CONTROL (0x01)
125#define SM501_I2C_STATUS (0x02)
126#define SM501_I2C_RESET (0x02)
127#define SM501_I2C_SLAVE_ADDRESS (0x03)
128#define SM501_I2C_DATA (0x04)
129
130/* SSP base */
131#define SM501_SSP (0x020000)
132
133/* Uart 0 base */
134#define SM501_UART0 (0x030000)
135
136/* Uart 1 base */
137#define SM501_UART1 (0x030020)
138
139/* USB host port base */
140#define SM501_USB_HOST (0x040000)
141
142/* USB slave/gadget base */
143#define SM501_USB_GADGET (0x060000)
144
145/* USB slave/gadget data port base */
146#define SM501_USB_GADGET_DATA (0x070000)
147
148/* Display contoller/video engine base */
149#define SM501_DC (0x080000)
150
151/* common defines for the SM501 address registers */
152#define SM501_ADDR_FLIP (1<<31)
153#define SM501_ADDR_EXT (1<<27)
154#define SM501_ADDR_CS1 (1<<26)
155#define SM501_ADDR_MASK (0x3f << 26)
156
157#define SM501_FIFO_MASK (0x3 << 16)
158#define SM501_FIFO_1 (0x0 << 16)
159#define SM501_FIFO_3 (0x1 << 16)
160#define SM501_FIFO_7 (0x2 << 16)
161#define SM501_FIFO_11 (0x3 << 16)
162
163/* common registers for panel and the crt */
164#define SM501_OFF_DC_H_TOT (0x000)
165#define SM501_OFF_DC_V_TOT (0x008)
166#define SM501_OFF_DC_H_SYNC (0x004)
167#define SM501_OFF_DC_V_SYNC (0x00C)
168
169#define SM501_DC_PANEL_CONTROL (0x000)
170
171#define SM501_DC_PANEL_CONTROL_FPEN (1<<27)
172#define SM501_DC_PANEL_CONTROL_BIAS (1<<26)
173#define SM501_DC_PANEL_CONTROL_DATA (1<<25)
174#define SM501_DC_PANEL_CONTROL_VDD (1<<24)
175#define SM501_DC_PANEL_CONTROL_DP (1<<23)
176
177#define SM501_DC_PANEL_CONTROL_TFT_888 (0<<21)
178#define SM501_DC_PANEL_CONTROL_TFT_333 (1<<21)
179#define SM501_DC_PANEL_CONTROL_TFT_444 (2<<21)
180
181#define SM501_DC_PANEL_CONTROL_DE (1<<20)
182
183#define SM501_DC_PANEL_CONTROL_LCD_TFT (0<<18)
184#define SM501_DC_PANEL_CONTROL_LCD_STN8 (1<<18)
185#define SM501_DC_PANEL_CONTROL_LCD_STN12 (2<<18)
186
187#define SM501_DC_PANEL_CONTROL_CP (1<<14)
188#define SM501_DC_PANEL_CONTROL_VSP (1<<13)
189#define SM501_DC_PANEL_CONTROL_HSP (1<<12)
190#define SM501_DC_PANEL_CONTROL_CK (1<<9)
191#define SM501_DC_PANEL_CONTROL_TE (1<<8)
192#define SM501_DC_PANEL_CONTROL_VPD (1<<7)
193#define SM501_DC_PANEL_CONTROL_VP (1<<6)
194#define SM501_DC_PANEL_CONTROL_HPD (1<<5)
195#define SM501_DC_PANEL_CONTROL_HP (1<<4)
196#define SM501_DC_PANEL_CONTROL_GAMMA (1<<3)
197#define SM501_DC_PANEL_CONTROL_EN (1<<2)
198
199#define SM501_DC_PANEL_CONTROL_8BPP (0<<0)
200#define SM501_DC_PANEL_CONTROL_16BPP (1<<0)
201#define SM501_DC_PANEL_CONTROL_32BPP (2<<0)
202
203
204#define SM501_DC_PANEL_PANNING_CONTROL (0x004)
205#define SM501_DC_PANEL_COLOR_KEY (0x008)
206#define SM501_DC_PANEL_FB_ADDR (0x00C)
207#define SM501_DC_PANEL_FB_OFFSET (0x010)
208#define SM501_DC_PANEL_FB_WIDTH (0x014)
209#define SM501_DC_PANEL_FB_HEIGHT (0x018)
210#define SM501_DC_PANEL_TL_LOC (0x01C)
211#define SM501_DC_PANEL_BR_LOC (0x020)
212#define SM501_DC_PANEL_H_TOT (0x024)
213#define SM501_DC_PANEL_H_SYNC (0x028)
214#define SM501_DC_PANEL_V_TOT (0x02C)
215#define SM501_DC_PANEL_V_SYNC (0x030)
216#define SM501_DC_PANEL_CUR_LINE (0x034)
217
218#define SM501_DC_VIDEO_CONTROL (0x040)
219#define SM501_DC_VIDEO_FB0_ADDR (0x044)
220#define SM501_DC_VIDEO_FB_WIDTH (0x048)
221#define SM501_DC_VIDEO_FB0_LAST_ADDR (0x04C)
222#define SM501_DC_VIDEO_TL_LOC (0x050)
223#define SM501_DC_VIDEO_BR_LOC (0x054)
224#define SM501_DC_VIDEO_SCALE (0x058)
225#define SM501_DC_VIDEO_INIT_SCALE (0x05C)
226#define SM501_DC_VIDEO_YUV_CONSTANTS (0x060)
227#define SM501_DC_VIDEO_FB1_ADDR (0x064)
228#define SM501_DC_VIDEO_FB1_LAST_ADDR (0x068)
229
230#define SM501_DC_VIDEO_ALPHA_CONTROL (0x080)
231#define SM501_DC_VIDEO_ALPHA_FB_ADDR (0x084)
232#define SM501_DC_VIDEO_ALPHA_FB_OFFSET (0x088)
233#define SM501_DC_VIDEO_ALPHA_FB_LAST_ADDR (0x08C)
234#define SM501_DC_VIDEO_ALPHA_TL_LOC (0x090)
235#define SM501_DC_VIDEO_ALPHA_BR_LOC (0x094)
236#define SM501_DC_VIDEO_ALPHA_SCALE (0x098)
237#define SM501_DC_VIDEO_ALPHA_INIT_SCALE (0x09C)
238#define SM501_DC_VIDEO_ALPHA_CHROMA_KEY (0x0A0)
239#define SM501_DC_VIDEO_ALPHA_COLOR_LOOKUP (0x0A4)
240
241#define SM501_DC_PANEL_HWC_BASE (0x0F0)
242#define SM501_DC_PANEL_HWC_ADDR (0x0F0)
243#define SM501_DC_PANEL_HWC_LOC (0x0F4)
244#define SM501_DC_PANEL_HWC_COLOR_1_2 (0x0F8)
245#define SM501_DC_PANEL_HWC_COLOR_3 (0x0FC)
246
247#define SM501_HWC_EN (1<<31)
248
249#define SM501_OFF_HWC_ADDR (0x00)
250#define SM501_OFF_HWC_LOC (0x04)
251#define SM501_OFF_HWC_COLOR_1_2 (0x08)
252#define SM501_OFF_HWC_COLOR_3 (0x0C)
253
254#define SM501_DC_ALPHA_CONTROL (0x100)
255#define SM501_DC_ALPHA_FB_ADDR (0x104)
256#define SM501_DC_ALPHA_FB_OFFSET (0x108)
257#define SM501_DC_ALPHA_TL_LOC (0x10C)
258#define SM501_DC_ALPHA_BR_LOC (0x110)
259#define SM501_DC_ALPHA_CHROMA_KEY (0x114)
260#define SM501_DC_ALPHA_COLOR_LOOKUP (0x118)
261
262#define SM501_DC_CRT_CONTROL (0x200)
263
264#define SM501_DC_CRT_CONTROL_TVP (1<<15)
265#define SM501_DC_CRT_CONTROL_CP (1<<14)
266#define SM501_DC_CRT_CONTROL_VSP (1<<13)
267#define SM501_DC_CRT_CONTROL_HSP (1<<12)
268#define SM501_DC_CRT_CONTROL_VS (1<<11)
269#define SM501_DC_CRT_CONTROL_BLANK (1<<10)
270#define SM501_DC_CRT_CONTROL_SEL (1<<9)
271#define SM501_DC_CRT_CONTROL_TE (1<<8)
272#define SM501_DC_CRT_CONTROL_PIXEL_MASK (0xF << 4)
273#define SM501_DC_CRT_CONTROL_GAMMA (1<<3)
274#define SM501_DC_CRT_CONTROL_ENABLE (1<<2)
275
276#define SM501_DC_CRT_CONTROL_8BPP (0<<0)
277#define SM501_DC_CRT_CONTROL_16BPP (1<<0)
278#define SM501_DC_CRT_CONTROL_32BPP (2<<0)
279
280#define SM501_DC_CRT_FB_ADDR (0x204)
281#define SM501_DC_CRT_FB_OFFSET (0x208)
282#define SM501_DC_CRT_H_TOT (0x20C)
283#define SM501_DC_CRT_H_SYNC (0x210)
284#define SM501_DC_CRT_V_TOT (0x214)
285#define SM501_DC_CRT_V_SYNC (0x218)
286#define SM501_DC_CRT_SIGNATURE_ANALYZER (0x21C)
287#define SM501_DC_CRT_CUR_LINE (0x220)
288#define SM501_DC_CRT_MONITOR_DETECT (0x224)
289
290#define SM501_DC_CRT_HWC_BASE (0x230)
291#define SM501_DC_CRT_HWC_ADDR (0x230)
292#define SM501_DC_CRT_HWC_LOC (0x234)
293#define SM501_DC_CRT_HWC_COLOR_1_2 (0x238)
294#define SM501_DC_CRT_HWC_COLOR_3 (0x23C)
295
296#define SM501_DC_PANEL_PALETTE (0x400)
297
298#define SM501_DC_VIDEO_PALETTE (0x800)
299
300#define SM501_DC_CRT_PALETTE (0xC00)
301
302/* Zoom Video port base */
303#define SM501_ZVPORT (0x090000)
304
305/* AC97/I2S base */
306#define SM501_AC97 (0x0A0000)
307
308/* 8051 micro controller base */
309#define SM501_UCONTROLLER (0x0B0000)
310
311/* 8051 micro controller SRAM base */
312#define SM501_UCONTROLLER_SRAM (0x0C0000)
313
314/* DMA base */
315#define SM501_DMA (0x0D0000)
316
317/* 2d engine base */
318#define SM501_2D_ENGINE (0x100000)
319#define SM501_2D_SOURCE (0x00)
320#define SM501_2D_DESTINATION (0x04)
321#define SM501_2D_DIMENSION (0x08)
322#define SM501_2D_CONTROL (0x0C)
323#define SM501_2D_PITCH (0x10)
324#define SM501_2D_FOREGROUND (0x14)
325#define SM501_2D_BACKGROUND (0x18)
326#define SM501_2D_STRETCH (0x1C)
327#define SM501_2D_COLOR_COMPARE (0x20)
328#define SM501_2D_COLOR_COMPARE_MASK (0x24)
329#define SM501_2D_MASK (0x28)
330#define SM501_2D_CLIP_TL (0x2C)
331#define SM501_2D_CLIP_BR (0x30)
332#define SM501_2D_MONO_PATTERN_LOW (0x34)
333#define SM501_2D_MONO_PATTERN_HIGH (0x38)
334#define SM501_2D_WINDOW_WIDTH (0x3C)
335#define SM501_2D_SOURCE_BASE (0x40)
336#define SM501_2D_DESTINATION_BASE (0x44)
337#define SM501_2D_ALPHA (0x48)
338#define SM501_2D_WRAP (0x4C)
339#define SM501_2D_STATUS (0x50)
340
341#define SM501_CSC_Y_SOURCE_BASE (0xC8)
342#define SM501_CSC_CONSTANTS (0xCC)
343#define SM501_CSC_Y_SOURCE_X (0xD0)
344#define SM501_CSC_Y_SOURCE_Y (0xD4)
345#define SM501_CSC_U_SOURCE_BASE (0xD8)
346#define SM501_CSC_V_SOURCE_BASE (0xDC)
347#define SM501_CSC_SOURCE_DIMENSION (0xE0)
348#define SM501_CSC_SOURCE_PITCH (0xE4)
349#define SM501_CSC_DESTINATION (0xE8)
350#define SM501_CSC_DESTINATION_DIMENSION (0xEC)
351#define SM501_CSC_DESTINATION_PITCH (0xF0)
352#define SM501_CSC_SCALE_FACTOR (0xF4)
353#define SM501_CSC_DESTINATION_BASE (0xF8)
354#define SM501_CSC_CONTROL (0xFC)
355
356/* 2d engine data port base */
357#define SM501_2D_ENGINE_DATA (0x110000)
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
new file mode 100644
index 000000000000..9e3aaad6fe4d
--- /dev/null
+++ b/include/linux/sm501.h
@@ -0,0 +1,170 @@
1/* include/linux/sm501.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * Vincent Sanders <vince@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21extern int sm501_unit_power(struct device *dev,
22 unsigned int unit, unsigned int to);
23
24extern unsigned long sm501_set_clock(struct device *dev,
25 int clksrc, unsigned long freq);
26
27extern unsigned long sm501_find_clock(int clksrc, unsigned long req_freq);
28
29/* sm501_misc_control
30 *
31 * Modify the SM501's MISC_CONTROL register
32*/
33
34extern int sm501_misc_control(struct device *dev,
35 unsigned long set, unsigned long clear);
36
37/* sm501_modify_reg
38 *
39 * Modify a register in the SM501 which may be shared with other
40 * drivers.
41*/
42
43extern unsigned long sm501_modify_reg(struct device *dev,
44 unsigned long reg,
45 unsigned long set,
46 unsigned long clear);
47
48/* sm501_gpio_set
49 *
50 * set the state of the given GPIO line
51*/
52
53extern void sm501_gpio_set(struct device *dev,
54 unsigned long gpio,
55 unsigned int to,
56 unsigned int dir);
57
58/* sm501_gpio_get
59 *
60 * get the state of the given GPIO line
61*/
62
63extern unsigned long sm501_gpio_get(struct device *dev,
64 unsigned long gpio);
65
66
67/* Platform data definitions */
68
69#define SM501FB_FLAG_USE_INIT_MODE (1<<0)
70#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
71#define SM501FB_FLAG_USE_HWCURSOR (1<<2)
72#define SM501FB_FLAG_USE_HWACCEL (1<<3)
73
74struct sm501_platdata_fbsub {
75 struct fb_videomode *def_mode;
76 unsigned int def_bpp;
77 unsigned long max_mem;
78 unsigned int flags;
79};
80
81enum sm501_fb_routing {
82 SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
83 SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
84};
85
86/* sm501_platdata_fb flag field bit definitions */
87
88#define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
89
90/* sm501_platdata_fb
91 *
92 * configuration data for the framebuffer driver
93*/
94
95struct sm501_platdata_fb {
96 enum sm501_fb_routing fb_route;
97 unsigned int flags;
98 struct sm501_platdata_fbsub *fb_crt;
99 struct sm501_platdata_fbsub *fb_pnl;
100};
101
102/* gpio i2c */
103
104struct sm501_platdata_gpio_i2c {
105 unsigned int pin_sda;
106 unsigned int pin_scl;
107};
108
109/* sm501_initdata
110 *
111 * use for initialising values that may not have been setup
112 * before the driver is loaded.
113*/
114
115struct sm501_reg_init {
116 unsigned long set;
117 unsigned long mask;
118};
119
120#define SM501_USE_USB_HOST (1<<0)
121#define SM501_USE_USB_SLAVE (1<<1)
122#define SM501_USE_SSP0 (1<<2)
123#define SM501_USE_SSP1 (1<<3)
124#define SM501_USE_UART0 (1<<4)
125#define SM501_USE_UART1 (1<<5)
126#define SM501_USE_FBACCEL (1<<6)
127#define SM501_USE_AC97 (1<<7)
128#define SM501_USE_I2S (1<<8)
129
130#define SM501_USE_ALL (0xffffffff)
131
132struct sm501_initdata {
133 struct sm501_reg_init gpio_low;
134 struct sm501_reg_init gpio_high;
135 struct sm501_reg_init misc_timing;
136 struct sm501_reg_init misc_control;
137
138 unsigned long devices;
139 unsigned long mclk; /* non-zero to modify */
140 unsigned long m1xclk; /* non-zero to modify */
141};
142
143/* sm501_init_gpio
144 *
145 * default gpio settings
146*/
147
148struct sm501_init_gpio {
149 struct sm501_reg_init gpio_data_low;
150 struct sm501_reg_init gpio_data_high;
151 struct sm501_reg_init gpio_ddr_low;
152 struct sm501_reg_init gpio_ddr_high;
153};
154
155/* sm501_platdata
156 *
157 * This is passed with the platform device to allow the board
158 * to control the behaviour of the SM501 driver(s) which attach
159 * to the device.
160 *
161*/
162
163struct sm501_platdata {
164 struct sm501_initdata *init;
165 struct sm501_init_gpio *init_gpiop;
166 struct sm501_platdata_fb *fb;
167
168 struct sm501_platdata_gpio_i2c *gpio_i2c;
169 unsigned int gpio_i2c_nr;
170};
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 854aa6b543f1..802b3a38b041 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -40,6 +40,8 @@ enum
40 IPSTATS_MIB_FRAGCREATES, /* FragCreates */ 40 IPSTATS_MIB_FRAGCREATES, /* FragCreates */
41 IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */ 41 IPSTATS_MIB_INMCASTPKTS, /* InMcastPkts */
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
43 __IPSTATS_MIB_MAX 45 __IPSTATS_MIB_MAX
44}; 46};
45 47
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 92cd38efad7f..6e7c9483a6a6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -187,7 +187,9 @@ struct ucred {
187#define AF_LLC 26 /* Linux LLC */ 187#define AF_LLC 26 /* Linux LLC */
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_MAX 32 /* For now.. */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */
191 193
192/* Protocol families, same as address families. */ 194/* Protocol families, same as address families. */
193#define PF_UNSPEC AF_UNSPEC 195#define PF_UNSPEC AF_UNSPEC
@@ -220,6 +222,8 @@ struct ucred {
220#define PF_LLC AF_LLC 222#define PF_LLC AF_LLC
221#define PF_TIPC AF_TIPC 223#define PF_TIPC AF_TIPC
222#define PF_BLUETOOTH AF_BLUETOOTH 224#define PF_BLUETOOTH AF_BLUETOOTH
225#define PF_IUCV AF_IUCV
226#define PF_RXRPC AF_RXRPC
223#define PF_MAX AF_MAX 227#define PF_MAX AF_MAX
224 228
225/* Maximum queue length specifiable by listen. */ 229/* Maximum queue length specifiable by listen. */
@@ -282,6 +286,7 @@ struct ucred {
282#define SOL_DCCP 269 286#define SOL_DCCP 269
283#define SOL_NETLINK 270 287#define SOL_NETLINK 270
284#define SOL_TIPC 271 288#define SOL_TIPC 271
289#define SOL_RXRPC 272
285 290
286/* IPX options */ 291/* IPX options */
287#define IPX_TYPE 1 292#define IPX_TYPE 1
diff --git a/include/linux/sony-laptop.h b/include/linux/sony-laptop.h
new file mode 100644
index 000000000000..e2e036d94e4a
--- /dev/null
+++ b/include/linux/sony-laptop.h
@@ -0,0 +1,34 @@
1#ifndef _SONYLAPTOP_H_
2#define _SONYLAPTOP_H_
3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7
8/* used only for communication between v4l and sony-laptop */
9
10#define SONY_PIC_COMMAND_GETCAMERA 1 /* obsolete */
11#define SONY_PIC_COMMAND_SETCAMERA 2
12#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3 /* obsolete */
13#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4
14#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5 /* obsolete */
15#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6
16#define SONY_PIC_COMMAND_GETCAMERAHUE 7 /* obsolete */
17#define SONY_PIC_COMMAND_SETCAMERAHUE 8
18#define SONY_PIC_COMMAND_GETCAMERACOLOR 9 /* obsolete */
19#define SONY_PIC_COMMAND_SETCAMERACOLOR 10
20#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11 /* obsolete */
21#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12
22#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13 /* obsolete */
23#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14
24#define SONY_PIC_COMMAND_GETCAMERAAGC 15 /* obsolete */
25#define SONY_PIC_COMMAND_SETCAMERAAGC 16
26#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17 /* obsolete */
27#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
28#define SONY_PIC_COMMAND_GETCAMERAREVISION 19 /* obsolete */
29
30int sony_pic_camera_command(int command, u8 value);
31
32#endif /* __KERNEL__ */
33
34#endif /* _SONYLAPTOP_H_ */
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index adb3dafd33e9..3387e44dfd13 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -5,9 +5,17 @@
5 * 5 *
6 * It's OK if the min/max values are zero. 6 * It's OK if the min/max values are zero.
7 */ 7 */
8enum ads7846_filter {
9 ADS7846_FILTER_OK,
10 ADS7846_FILTER_REPEAT,
11 ADS7846_FILTER_IGNORE,
12};
13
8struct ads7846_platform_data { 14struct ads7846_platform_data {
9 u16 model; /* 7843, 7845, 7846. */ 15 u16 model; /* 7843, 7845, 7846. */
10 u16 vref_delay_usecs; /* 0 for external vref; etc */ 16 u16 vref_delay_usecs; /* 0 for external vref; etc */
17 int keep_vref_on:1; /* set to keep vref on for differential
18 * measurements as well */
11 u16 x_plate_ohms; 19 u16 x_plate_ohms;
12 u16 y_plate_ohms; 20 u16 y_plate_ohms;
13 21
@@ -21,5 +29,9 @@ struct ads7846_platform_data {
21 u16 debounce_rep; /* additional consecutive good readings 29 u16 debounce_rep; /* additional consecutive good readings
22 * required after the first two */ 30 * required after the first two */
23 int (*get_pendown_state)(void); 31 int (*get_pendown_state)(void);
32 int (*filter_init) (struct ads7846_platform_data *pdata,
33 void **filter_data);
34 int (*filter) (void *filter_data, int data_idx, int *val);
35 void (*filter_cleanup)(void *filter_data);
24}; 36};
25 37
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
new file mode 100644
index 000000000000..1085212c446e
--- /dev/null
+++ b/include/linux/spi/eeprom.h
@@ -0,0 +1,22 @@
1#ifndef __LINUX_SPI_EEPROM_H
2#define __LINUX_SPI_EEPROM_H
3
4/*
5 * Put one of these structures in platform_data for SPI EEPROMS handled
6 * by the "at25" driver. On SPI, most EEPROMS understand the same core
7 * command set. If you need to support EEPROMs that don't yet fit, add
8 * flags to support those protocol options. These values all come from
9 * the chip datasheets.
10 */
11struct spi_eeprom {
12 u32 byte_len;
13 char name[10];
14 u16 page_size; /* for writes */
15 u16 flags;
16#define EE_ADDR1 0x0001 /* 8 bit addrs */
17#define EE_ADDR2 0x0002 /* 16 bit addrs */
18#define EE_ADDR3 0x0004 /* 24 bit addrs */
19#define EE_READONLY 0x0008 /* disallow writes */
20};
21
22#endif /* __LINUX_SPI_EEPROM_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 176f6e36dbfa..4f0f8c2e58a5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -114,6 +114,17 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
114 spi->controller_state = state; 114 spi->controller_state = state;
115} 115}
116 116
117/* device driver data */
118
119static inline void spi_set_drvdata(struct spi_device *spi, void *data)
120{
121 dev_set_drvdata(&spi->dev, data);
122}
123
124static inline void *spi_get_drvdata(struct spi_device *spi)
125{
126 return dev_get_drvdata(&spi->dev);
127}
117 128
118struct spi_message; 129struct spi_message;
119 130
@@ -137,13 +148,11 @@ extern int spi_register_driver(struct spi_driver *sdrv);
137 148
138static inline void spi_unregister_driver(struct spi_driver *sdrv) 149static inline void spi_unregister_driver(struct spi_driver *sdrv)
139{ 150{
140 if (!sdrv) 151 if (sdrv)
141 return; 152 driver_unregister(&sdrv->driver);
142 driver_unregister(&sdrv->driver);
143} 153}
144 154
145 155
146
147/** 156/**
148 * struct spi_master - interface to SPI master controller 157 * struct spi_master - interface to SPI master controller
149 * @cdev: class interface to this driver 158 * @cdev: class interface to this driver
@@ -154,7 +163,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
154 * each slave has a chipselect signal, but it's common that not 163 * each slave has a chipselect signal, but it's common that not
155 * every chipselect is connected to a slave. 164 * every chipselect is connected to a slave.
156 * @setup: updates the device mode and clocking records used by a 165 * @setup: updates the device mode and clocking records used by a
157 * device's SPI controller; protocol code may call this. 166 * device's SPI controller; protocol code may call this. This
167 * must fail if an unrecognized or unsupported mode is requested.
158 * @transfer: adds a message to the controller's transfer queue. 168 * @transfer: adds a message to the controller's transfer queue.
159 * @cleanup: frees controller-specific state 169 * @cleanup: frees controller-specific state
160 * 170 *
@@ -211,7 +221,7 @@ struct spi_master {
211 struct spi_message *mesg); 221 struct spi_message *mesg);
212 222
213 /* called on release() to free memory provided by spi_master */ 223 /* called on release() to free memory provided by spi_master */
214 void (*cleanup)(const struct spi_device *spi); 224 void (*cleanup)(struct spi_device *spi);
215}; 225};
216 226
217static inline void *spi_master_get_devdata(struct spi_master *master) 227static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -296,6 +306,16 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
296 * shifting out three bytes with word size of sixteen or twenty bits; 306 * shifting out three bytes with word size of sixteen or twenty bits;
297 * the former uses two bytes per word, the latter uses four bytes.) 307 * the former uses two bytes per word, the latter uses four bytes.)
298 * 308 *
309 * In-memory data values are always in native CPU byte order, translated
310 * from the wire byte order (big-endian except with SPI_LSB_FIRST). So
311 * for example when bits_per_word is sixteen, buffers are 2N bytes long
312 * and hold N sixteen bit words in CPU byte order.
313 *
314 * When the word size of the SPI transfer is not a power-of-two multiple
315 * of eight bits, those in-memory words include extra bits. In-memory
316 * words are always seen by protocol drivers as right-justified, so the
317 * undefined (rx) or unused (tx) bits are always the most significant bits.
318 *
299 * All SPI transfers start with the relevant chipselect active. Normally 319 * All SPI transfers start with the relevant chipselect active. Normally
300 * it stays selected until after the last transfer in a message. Drivers 320 * it stays selected until after the last transfer in a message. Drivers
301 * can affect the chipselect signal using cs_change: 321 * can affect the chipselect signal using cs_change:
@@ -453,6 +473,11 @@ static inline void spi_message_free(struct spi_message *m)
453 * changes those settings, and must be called from a context that can sleep. 473 * changes those settings, and must be called from a context that can sleep.
454 * The changes take effect the next time the device is selected and data 474 * The changes take effect the next time the device is selected and data
455 * is transferred to or from it. 475 * is transferred to or from it.
476 *
477 * Note that this call wil fail if the protocol driver specifies an option
478 * that the underlying controller or its driver does not support. For
479 * example, not all hardware supports wire transfers using nine bit words,
480 * LSB-first wire encoding, or active-high chipselects.
456 */ 481 */
457static inline int 482static inline int
458spi_setup(struct spi_device *spi) 483spi_setup(struct spi_device *spi)
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 16ce178f54d7..9dbca629dcfb 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -25,7 +25,6 @@ struct spi_bitbang {
25 spinlock_t lock; 25 spinlock_t lock;
26 struct list_head queue; 26 struct list_head queue;
27 u8 busy; 27 u8 busy;
28 u8 shutdown;
29 u8 use_dma; 28 u8 use_dma;
30 29
31 struct spi_master *master; 30 struct spi_master *master;
@@ -55,7 +54,7 @@ struct spi_bitbang {
55 * methods, if you like. 54 * methods, if you like.
56 */ 55 */
57extern int spi_bitbang_setup(struct spi_device *spi); 56extern int spi_bitbang_setup(struct spi_device *spi);
58extern void spi_bitbang_cleanup(const struct spi_device *spi); 57extern void spi_bitbang_cleanup(struct spi_device *spi);
59extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m); 58extern int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m);
60extern int spi_bitbang_setup_transfer(struct spi_device *spi, 59extern int spi_bitbang_setup_transfer(struct spi_device *spi,
61 struct spi_transfer *t); 60 struct spi_transfer *t);
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 94b767d64275..a946176db638 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -228,15 +228,30 @@ do { \
228# define read_unlock_irq(lock) _read_unlock_irq(lock) 228# define read_unlock_irq(lock) _read_unlock_irq(lock)
229# define write_unlock_irq(lock) _write_unlock_irq(lock) 229# define write_unlock_irq(lock) _write_unlock_irq(lock)
230#else 230#else
231# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) 231# define spin_unlock(lock) \
232# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock) 232 do {__raw_spin_unlock(&(lock)->raw_lock); __release(lock); } while (0)
233# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock) 233# define read_unlock(lock) \
234# define spin_unlock_irq(lock) \ 234 do {__raw_read_unlock(&(lock)->raw_lock); __release(lock); } while (0)
235 do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0) 235# define write_unlock(lock) \
236# define read_unlock_irq(lock) \ 236 do {__raw_write_unlock(&(lock)->raw_lock); __release(lock); } while (0)
237 do { __raw_read_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0) 237# define spin_unlock_irq(lock) \
238# define write_unlock_irq(lock) \ 238do { \
239 do { __raw_write_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0) 239 __raw_spin_unlock(&(lock)->raw_lock); \
240 __release(lock); \
241 local_irq_enable(); \
242} while (0)
243# define read_unlock_irq(lock) \
244do { \
245 __raw_read_unlock(&(lock)->raw_lock); \
246 __release(lock); \
247 local_irq_enable(); \
248} while (0)
249# define write_unlock_irq(lock) \
250do { \
251 __raw_write_unlock(&(lock)->raw_lock); \
252 __release(lock); \
253 local_irq_enable(); \
254} while (0)
240#endif 255#endif
241 256
242#define spin_unlock_irqrestore(lock, flags) \ 257#define spin_unlock_irqrestore(lock, flags) \
@@ -268,6 +283,43 @@ do { \
268}) 283})
269 284
270/* 285/*
286 * Locks two spinlocks l1 and l2.
287 * l1_first indicates if spinlock l1 should be taken first.
288 */
289static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
290 bool l1_first)
291 __acquires(l1)
292 __acquires(l2)
293{
294 if (l1_first) {
295 spin_lock(l1);
296 spin_lock(l2);
297 } else {
298 spin_lock(l2);
299 spin_lock(l1);
300 }
301}
302
303/*
304 * Unlocks two spinlocks l1 and l2.
305 * l1_taken_first indicates if spinlock l1 was taken first and therefore
306 * should be released after spinlock l2.
307 */
308static inline void double_spin_unlock(spinlock_t *l1, spinlock_t *l2,
309 bool l1_taken_first)
310 __releases(l1)
311 __releases(l2)
312{
313 if (l1_taken_first) {
314 spin_unlock(l2);
315 spin_unlock(l1);
316 } else {
317 spin_unlock(l1);
318 spin_unlock(l2);
319 }
320}
321
322/*
271 * Pull the atomic_t declaration: 323 * Pull the atomic_t declaration:
272 * (asm-mips/atomic.h needs above definitions) 324 * (asm-mips/atomic.h needs above definitions)
273 */ 325 */
diff --git a/include/linux/string.h b/include/linux/string.h
index 4f69ef9e6eb5..7f2eb6a477f9 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t);
47#ifndef __HAVE_ARCH_STRNICMP 47#ifndef __HAVE_ARCH_STRNICMP
48extern int strnicmp(const char *, const char *, __kernel_size_t); 48extern int strnicmp(const char *, const char *, __kernel_size_t);
49#endif 49#endif
50#ifndef __HAVE_ARCH_STRCASECMP
51extern int strcasecmp(const char *s1, const char *s2);
52#endif
53#ifndef __HAVE_ARCH_STRNCASECMP
54extern int strncasecmp(const char *s1, const char *s2, size_t n);
55#endif
50#ifndef __HAVE_ARCH_STRCHR 56#ifndef __HAVE_ARCH_STRCHR
51extern char * strchr(const char *,int); 57extern char * strchr(const char *,int);
52#endif 58#endif
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index a1be89deb3af..c7a78eef2b4f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -40,6 +40,7 @@ struct rpc_clnt {
40 40
41 unsigned int cl_softrtry : 1,/* soft timeouts */ 41 unsigned int cl_softrtry : 1,/* soft timeouts */
42 cl_intr : 1,/* interruptible */ 42 cl_intr : 1,/* interruptible */
43 cl_discrtry : 1,/* disconnect before retry */
43 cl_autobind : 1,/* use getport() */ 44 cl_autobind : 1,/* use getport() */
44 cl_oneshot : 1,/* dispose after use */ 45 cl_oneshot : 1,/* dispose after use */
45 cl_dead : 1;/* abandoned */ 46 cl_dead : 1;/* abandoned */
@@ -111,6 +112,7 @@ struct rpc_create_args {
111#define RPC_CLNT_CREATE_ONESHOT (1UL << 3) 112#define RPC_CLNT_CREATE_ONESHOT (1UL << 3)
112#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4) 113#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 4)
113#define RPC_CLNT_CREATE_NOPING (1UL << 5) 114#define RPC_CLNT_CREATE_NOPING (1UL << 5)
115#define RPC_CLNT_CREATE_DISCRTRY (1UL << 6)
114 116
115struct rpc_clnt *rpc_create(struct rpc_create_args *args); 117struct rpc_clnt *rpc_create(struct rpc_create_args *args);
116struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 118struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 60fce3c92857..b7c7307ceec6 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -78,7 +78,6 @@ void rpc_unregister_sysctl(void);
78 * module currently registers its sysctl table dynamically, the sysctl path 78 * module currently registers its sysctl table dynamically, the sysctl path
79 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. 79 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>.
80 */ 80 */
81#define CTL_SUNRPC 7249 /* arbitrary and hopefully unused */
82 81
83enum { 82enum {
84 CTL_RPCDEBUG = 1, 83 CTL_RPCDEBUG = 1,
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8b6ce60ea057..3069ecca0129 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -150,10 +150,10 @@ struct rpc_call_ops {
150#define RPC_TASK_HAS_TIMER 3 150#define RPC_TASK_HAS_TIMER 3
151#define RPC_TASK_ACTIVE 4 151#define RPC_TASK_ACTIVE 4
152 152
153#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 153#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
154#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 154#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
155#define rpc_test_and_set_running(t) \ 155#define rpc_test_and_set_running(t) \
156 (test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) 156 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
157#define rpc_clear_running(t) \ 157#define rpc_clear_running(t) \
158 do { \ 158 do { \
159 smp_mb__before_clear_bit(); \ 159 smp_mb__before_clear_bit(); \
@@ -161,8 +161,8 @@ struct rpc_call_ops {
161 smp_mb__after_clear_bit(); \ 161 smp_mb__after_clear_bit(); \
162 } while (0) 162 } while (0)
163 163
164#define RPC_IS_QUEUED(t) (test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)) 164#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
165#define rpc_set_queued(t) (set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)) 165#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
166#define rpc_clear_queued(t) \ 166#define rpc_clear_queued(t) \
167 do { \ 167 do { \
168 smp_mb__before_clear_bit(); \ 168 smp_mb__before_clear_bit(); \
@@ -179,7 +179,7 @@ struct rpc_call_ops {
179 smp_mb__after_clear_bit(); \ 179 smp_mb__after_clear_bit(); \
180 } while (0) 180 } while (0)
181 181
182#define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) 182#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
183 183
184/* 184/*
185 * Task priorities. 185 * Task priorities.
@@ -253,7 +253,7 @@ void rpc_put_task(struct rpc_task *);
253void rpc_exit_task(struct rpc_task *); 253void rpc_exit_task(struct rpc_task *);
254void rpc_release_calldata(const struct rpc_call_ops *, void *); 254void rpc_release_calldata(const struct rpc_call_ops *, void *);
255void rpc_killall_tasks(struct rpc_clnt *); 255void rpc_killall_tasks(struct rpc_clnt *);
256int rpc_execute(struct rpc_task *); 256void rpc_execute(struct rpc_task *);
257void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 257void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
258void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 258void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
259void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 259void 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 64f3d60c72af..35fa4d5aadd0 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -11,6 +11,7 @@
11#define SUNRPC_SVC_H 11#define SUNRPC_SVC_H
12 12
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h>
14#include <linux/sunrpc/types.h> 15#include <linux/sunrpc/types.h>
15#include <linux/sunrpc/xdr.h> 16#include <linux/sunrpc/xdr.h>
16#include <linux/sunrpc/auth.h> 17#include <linux/sunrpc/auth.h>
@@ -191,7 +192,11 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
191 iov->iov_len += sizeof(__be32); 192 iov->iov_len += sizeof(__be32);
192} 193}
193 194
194 195union svc_addr_u {
196 struct in_addr addr;
197 struct in6_addr addr6;
198};
199
195/* 200/*
196 * The context of a single thread, including the request currently being 201 * The context of a single thread, including the request currently being
197 * processed. 202 * processed.
@@ -200,8 +205,8 @@ struct svc_rqst {
200 struct list_head rq_list; /* idle list */ 205 struct list_head rq_list; /* idle list */
201 struct list_head rq_all; /* all threads list */ 206 struct list_head rq_all; /* all threads list */
202 struct svc_sock * rq_sock; /* socket */ 207 struct svc_sock * rq_sock; /* socket */
203 struct sockaddr_in rq_addr; /* peer address */ 208 struct sockaddr_storage rq_addr; /* peer address */
204 int rq_addrlen; 209 size_t rq_addrlen;
205 210
206 struct svc_serv * rq_server; /* RPC service definition */ 211 struct svc_serv * rq_server; /* RPC service definition */
207 struct svc_pool * rq_pool; /* thread pool */ 212 struct svc_pool * rq_pool; /* thread pool */
@@ -227,8 +232,8 @@ struct svc_rqst {
227 unsigned short 232 unsigned short
228 rq_secure : 1; /* secure port */ 233 rq_secure : 1; /* secure port */
229 234
230 235 union svc_addr_u rq_daddr; /* dest addr of request
231 __be32 rq_daddr; /* dest addr of request - reply from here */ 236 * - reply from here */
232 237
233 void * rq_argp; /* decoded arguments */ 238 void * rq_argp; /* decoded arguments */
234 void * rq_resp; /* xdr'd results */ 239 void * rq_resp; /* xdr'd results */
@@ -256,6 +261,24 @@ struct svc_rqst {
256}; 261};
257 262
258/* 263/*
264 * Rigorous type checking on sockaddr type conversions
265 */
266static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst)
267{
268 return (struct sockaddr_in *) &rqst->rq_addr;
269}
270
271static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst)
272{
273 return (struct sockaddr_in6 *) &rqst->rq_addr;
274}
275
276static inline struct sockaddr *svc_addr(struct svc_rqst *rqst)
277{
278 return (struct sockaddr *) &rqst->rq_addr;
279}
280
281/*
259 * Check buffer bounds after decoding arguments 282 * Check buffer bounds after decoding arguments
260 */ 283 */
261static inline int 284static inline int
@@ -292,9 +315,10 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp)
292 315
293struct svc_deferred_req { 316struct svc_deferred_req {
294 u32 prot; /* protocol (UDP or TCP) */ 317 u32 prot; /* protocol (UDP or TCP) */
295 struct sockaddr_in addr; 318 struct svc_sock *svsk;
296 struct svc_sock *svsk; /* where reply must go */ 319 struct sockaddr_storage addr; /* where reply must go */
297 __be32 daddr; /* where reply must come from */ 320 size_t addrlen;
321 union svc_addr_u daddr; /* where reply must come from */
298 struct cache_deferred_req handle; 322 struct cache_deferred_req handle;
299 int argslen; 323 int argslen;
300 __be32 args[0]; 324 __be32 args[0];
@@ -368,5 +392,8 @@ int svc_register(struct svc_serv *, int, unsigned short);
368void svc_wake_up(struct svc_serv *); 392void svc_wake_up(struct svc_serv *);
369void svc_reserve(struct svc_rqst *rqstp, int space); 393void svc_reserve(struct svc_rqst *rqstp, int space);
370struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); 394struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
395char * svc_print_addr(struct svc_rqst *, char *, size_t);
396
397#define RPC_MAX_ADDRBUFLEN (63U)
371 398
372#endif /* SUNRPC_SVC_H */ 399#endif /* SUNRPC_SVC_H */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 98b21ad370fd..7909687557bf 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -57,13 +57,16 @@ struct svc_sock {
57 57
58 /* cache of various info for TCP sockets */ 58 /* cache of various info for TCP sockets */
59 void *sk_info_authunix; 59 void *sk_info_authunix;
60
61 struct sockaddr_storage sk_remote; /* remote peer's address */
62 int sk_remotelen; /* length of address */
60}; 63};
61 64
62/* 65/*
63 * Function prototypes. 66 * Function prototypes.
64 */ 67 */
65int svc_makesock(struct svc_serv *, int, unsigned short); 68int svc_makesock(struct svc_serv *, int, unsigned short, int flags);
66void svc_delete_socket(struct svc_sock *); 69void svc_force_close_socket(struct svc_sock *);
67int svc_recv(struct svc_rqst *, long); 70int svc_recv(struct svc_rqst *, long);
68int svc_send(struct svc_rqst *); 71int svc_send(struct svc_rqst *);
69void svc_drop(struct svc_rqst *); 72void svc_drop(struct svc_rqst *);
@@ -74,4 +77,11 @@ int svc_addsock(struct svc_serv *serv,
74 char *name_return, 77 char *name_return,
75 int *proto); 78 int *proto);
76 79
80/*
81 * svc_makesock socket characteristics
82 */
83#define SVC_SOCK_DEFAULTS (0U)
84#define SVC_SOCK_ANONYMOUS (1U << 0) /* don't register with pmap */
85#define SVC_SOCK_TEMPORARY (1U << 1) /* flag socket as temporary */
86
77#endif /* SUNRPC_SVCSOCK_H */ 87#endif /* SUNRPC_SVCSOCK_H */
diff --git a/include/linux/svga.h b/include/linux/svga.h
new file mode 100644
index 000000000000..eadb981bb37c
--- /dev/null
+++ b/include/linux/svga.h
@@ -0,0 +1,124 @@
1#ifndef _LINUX_SVGA_H
2#define _LINUX_SVGA_H
3
4#ifdef __KERNEL__
5
6#include <linux/pci.h>
7#include <video/vga.h>
8
9/* Terminator for register set */
10
11#define VGA_REGSET_END_VAL 0xFF
12#define VGA_REGSET_END {VGA_REGSET_END_VAL, 0, 0}
13
14struct vga_regset {
15 u8 regnum;
16 u8 lowbit;
17 u8 highbit;
18};
19
20/* ------------------------------------------------------------------------- */
21
22#define SVGA_FORMAT_END_VAL 0xFFFF
23#define SVGA_FORMAT_END {SVGA_FORMAT_END_VAL, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, 0, 0, 0, 0, 0, 0}
24
25struct svga_fb_format {
26 /* var part */
27 u32 bits_per_pixel;
28 struct fb_bitfield red;
29 struct fb_bitfield green;
30 struct fb_bitfield blue;
31 struct fb_bitfield transp;
32 u32 nonstd;
33 /* fix part */
34 u32 type;
35 u32 type_aux;
36 u32 visual;
37 u32 xpanstep;
38 u32 xresstep;
39};
40
41struct svga_timing_regs {
42 const struct vga_regset *h_total_regs;
43 const struct vga_regset *h_display_regs;
44 const struct vga_regset *h_blank_start_regs;
45 const struct vga_regset *h_blank_end_regs;
46 const struct vga_regset *h_sync_start_regs;
47 const struct vga_regset *h_sync_end_regs;
48
49 const struct vga_regset *v_total_regs;
50 const struct vga_regset *v_display_regs;
51 const struct vga_regset *v_blank_start_regs;
52 const struct vga_regset *v_blank_end_regs;
53 const struct vga_regset *v_sync_start_regs;
54 const struct vga_regset *v_sync_end_regs;
55};
56
57struct svga_pll {
58 u16 m_min;
59 u16 m_max;
60 u16 n_min;
61 u16 n_max;
62 u16 r_min;
63 u16 r_max; /* r_max < 32 */
64 u32 f_vco_min;
65 u32 f_vco_max;
66 u32 f_base;
67};
68
69
70/* Write a value to the attribute register */
71
72static inline void svga_wattr(u8 index, u8 data)
73{
74 inb(0x3DA);
75 outb(index, 0x3C0);
76 outb(data, 0x3C0);
77}
78
79/* Write a value to a sequence register with a mask */
80
81static inline void svga_wseq_mask(u8 index, u8 data, u8 mask)
82{
83 vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask));
84}
85
86/* Write a value to a CRT register with a mask */
87
88static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask)
89{
90 vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask));
91}
92
93static inline int svga_primary_device(struct pci_dev *dev)
94{
95 u16 flags;
96 pci_read_config_word(dev, PCI_COMMAND, &flags);
97 return (flags & PCI_COMMAND_IO);
98}
99
100
101void svga_wcrt_multi(const struct vga_regset *regset, u32 value);
102void svga_wseq_multi(const struct vga_regset *regset, u32 value);
103
104void svga_set_default_gfx_regs(void);
105void svga_set_default_atc_regs(void);
106void svga_set_default_seq_regs(void);
107void svga_set_default_crt_regs(void);
108void svga_set_textmode_vga_regs(void);
109
110void svga_settile(struct fb_info *info, struct fb_tilemap *map);
111void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
112void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
113void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
114void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor);
115
116int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
117int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
118void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
119
120int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
121
122#endif /* __KERNEL__ */
123#endif /* _LINUX_SVGA_H */
124
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 5423559a44a6..006868881346 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -170,11 +170,13 @@ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *
170extern unsigned long totalram_pages; 170extern unsigned long totalram_pages;
171extern unsigned long totalreserve_pages; 171extern unsigned long totalreserve_pages;
172extern long nr_swap_pages; 172extern long nr_swap_pages;
173extern unsigned int nr_free_pages(void);
174extern unsigned int nr_free_pages_pgdat(pg_data_t *pgdat);
175extern unsigned int nr_free_buffer_pages(void); 173extern unsigned int nr_free_buffer_pages(void);
176extern unsigned int nr_free_pagecache_pages(void); 174extern unsigned int nr_free_pagecache_pages(void);
177 175
176/* Definition of global_page_state not available yet */
177#define nr_free_pages() global_page_state(NR_FREE_PAGES)
178
179
178/* linux/mm/swap.c */ 180/* linux/mm/swap.c */
179extern void FASTCALL(lru_cache_add(struct page *)); 181extern void FASTCALL(lru_cache_add(struct page *));
180extern void FASTCALL(lru_cache_add_active(struct page *)); 182extern void FASTCALL(lru_cache_add_active(struct page *));
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index ec639aa3a1d3..ceb6cc5ceebb 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -108,7 +108,10 @@ extern void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
108#else 108#else
109 109
110#define make_migration_entry(page, write) swp_entry(0, 0) 110#define make_migration_entry(page, write) swp_entry(0, 0)
111#define is_migration_entry(swp) 0 111static inline int is_migration_entry(swp_entry_t swp)
112{
113 return 0;
114}
112#define migration_entry_to_page(swp) NULL 115#define migration_entry_to_page(swp) NULL
113static inline void make_migration_entry_read(swp_entry_t *entryp) { } 116static inline void make_migration_entry_read(swp_entry_t *entryp) { }
114static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, 117static inline void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 81480e613467..47f1c53332ce 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -53,7 +53,6 @@ struct __sysctl_args {
53 53
54/* For internal pattern-matching use only: */ 54/* For internal pattern-matching use only: */
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56#define CTL_ANY -1 /* Matches any name */
57#define CTL_NONE 0 56#define CTL_NONE 0
58#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */ 57#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */
59#endif 58#endif
@@ -69,7 +68,13 @@ enum
69 CTL_DEV=7, /* Devices */ 68 CTL_DEV=7, /* Devices */
70 CTL_BUS=8, /* Busses */ 69 CTL_BUS=8, /* Busses */
71 CTL_ABI=9, /* Binary emulation */ 70 CTL_ABI=9, /* Binary emulation */
72 CTL_CPU=10 /* CPU stuff (speed scaling, etc) */ 71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
72 CTL_ARLAN=254, /* arlan wireless driver */
73 CTL_APPLDATA=2120, /* s390 appldata */
74 CTL_S390DBF=5677, /* s390 debug */
75 CTL_SUNRPC=7249, /* sunrpc debug */
76 CTL_PM=9899, /* frv power management */
77 CTL_FRV=9898, /* frv specific sysctls */
73}; 78};
74 79
75/* CTL_BUS names: */ 80/* CTL_BUS names: */
@@ -202,6 +207,11 @@ enum
202 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 207 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
203 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 208 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
204 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ 209 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
210
211 /* s390 vm cmm sysctls */
212 VM_CMM_PAGES=1111,
213 VM_CMM_TIMED_PAGES=1112,
214 VM_CMM_TIMEOUT=1113,
205}; 215};
206 216
207 217
@@ -280,6 +290,7 @@ enum
280 NET_CORE_BUDGET=19, 290 NET_CORE_BUDGET=19,
281 NET_CORE_AEVENT_ETIME=20, 291 NET_CORE_AEVENT_ETIME=20,
282 NET_CORE_AEVENT_RSEQTH=21, 292 NET_CORE_AEVENT_RSEQTH=21,
293 NET_CORE_WARNINGS=22,
283}; 294};
284 295
285/* /proc/sys/net/ethernet */ 296/* /proc/sys/net/ethernet */
@@ -428,6 +439,8 @@ enum
428 NET_CIPSOV4_RBM_STRICTVALID=121, 439 NET_CIPSOV4_RBM_STRICTVALID=121,
429 NET_TCP_AVAIL_CONG_CONTROL=122, 440 NET_TCP_AVAIL_CONG_CONTROL=122,
430 NET_TCP_ALLOWED_CONG_CONTROL=123, 441 NET_TCP_ALLOWED_CONG_CONTROL=123,
442 NET_TCP_MAX_SSTHRESH=124,
443 NET_TCP_FRTO_RESPONSE=125,
431}; 444};
432 445
433enum { 446enum {
@@ -570,6 +583,7 @@ enum {
570 NET_IPV6_RTR_PROBE_INTERVAL=21, 583 NET_IPV6_RTR_PROBE_INTERVAL=21,
571 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, 584 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
572 NET_IPV6_PROXY_NDP=23, 585 NET_IPV6_PROXY_NDP=23,
586 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
573 __NET_IPV6_MAX 587 __NET_IPV6_MAX
574}; 588};
575 589
@@ -699,7 +713,8 @@ enum {
699 NET_X25_CALL_REQUEST_TIMEOUT=2, 713 NET_X25_CALL_REQUEST_TIMEOUT=2,
700 NET_X25_RESET_REQUEST_TIMEOUT=3, 714 NET_X25_RESET_REQUEST_TIMEOUT=3,
701 NET_X25_CLEAR_REQUEST_TIMEOUT=4, 715 NET_X25_CLEAR_REQUEST_TIMEOUT=4,
702 NET_X25_ACK_HOLD_BACK_TIMEOUT=5 716 NET_X25_ACK_HOLD_BACK_TIMEOUT=5,
717 NET_X25_FORWARD=6
703}; 718};
704 719
705/* /proc/sys/net/token-ring */ 720/* /proc/sys/net/token-ring */
@@ -777,6 +792,7 @@ enum {
777 NET_BRIDGE_NF_CALL_IPTABLES = 2, 792 NET_BRIDGE_NF_CALL_IPTABLES = 2,
778 NET_BRIDGE_NF_CALL_IP6TABLES = 3, 793 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
779 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 794 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
795 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
780}; 796};
781 797
782/* CTL_FS names: */ 798/* CTL_FS names: */
@@ -802,6 +818,7 @@ enum
802 FS_AIO_NR=18, /* current system-wide number of aio requests */ 818 FS_AIO_NR=18, /* current system-wide number of aio requests */
803 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ 819 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
804 FS_INOTIFY=20, /* inotify submenu */ 820 FS_INOTIFY=20, /* inotify submenu */
821 FS_OCFS2=988, /* ocfs2 */
805}; 822};
806 823
807/* /proc/sys/fs/quota/ */ 824/* /proc/sys/fs/quota/ */
@@ -912,7 +929,11 @@ enum
912#ifdef __KERNEL__ 929#ifdef __KERNEL__
913#include <linux/list.h> 930#include <linux/list.h>
914 931
915extern void sysctl_init(void); 932/* For the /proc/sys support */
933struct ctl_table;
934extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
935extern void sysctl_head_finish(struct ctl_table_header *prev);
936extern int sysctl_perm(struct ctl_table *table, int op);
916 937
917typedef struct ctl_table ctl_table; 938typedef struct ctl_table ctl_table;
918 939
@@ -1006,9 +1027,9 @@ struct ctl_table
1006 int maxlen; 1027 int maxlen;
1007 mode_t mode; 1028 mode_t mode;
1008 ctl_table *child; 1029 ctl_table *child;
1030 ctl_table *parent; /* Automatically set */
1009 proc_handler *proc_handler; /* Callback for text formatting */ 1031 proc_handler *proc_handler; /* Callback for text formatting */
1010 ctl_handler *strategy; /* Callback function for all r/w */ 1032 ctl_handler *strategy; /* Callback function for all r/w */
1011 struct proc_dir_entry *de; /* /proc control block */
1012 void *extra1; 1033 void *extra1;
1013 void *extra2; 1034 void *extra2;
1014}; 1035};
@@ -1023,8 +1044,8 @@ struct ctl_table_header
1023 struct completion *unregistering; 1044 struct completion *unregistering;
1024}; 1045};
1025 1046
1026struct ctl_table_header * register_sysctl_table(ctl_table * table, 1047struct ctl_table_header * register_sysctl_table(ctl_table * table);
1027 int insert_at_head); 1048
1028void unregister_sysctl_table(struct ctl_table_header * table); 1049void unregister_sysctl_table(struct ctl_table_header * table);
1029 1050
1030#else /* __KERNEL__ */ 1051#else /* __KERNEL__ */
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 166a2e58c287..389ccf858d37 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -98,12 +98,16 @@ struct sysdev_attribute {
98}; 98};
99 99
100 100
101#define SYSDEV_ATTR(_name,_mode,_show,_store) \ 101#define _SYSDEV_ATTR(_name,_mode,_show,_store) \
102struct sysdev_attribute attr_##_name = { \ 102{ \
103 .attr = {.name = __stringify(_name), .mode = _mode }, \ 103 .attr = { .name = __stringify(_name), .mode = _mode, \
104 .owner = THIS_MODULE }, \
104 .show = _show, \ 105 .show = _show, \
105 .store = _store, \ 106 .store = _store, \
106}; 107}
108
109#define SYSDEV_ATTR(_name,_mode,_show,_store) \
110struct sysdev_attribute attr_##_name = _SYSDEV_ATTR(_name,_mode,_show,_store);
107 111
108extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 112extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
109extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 113extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 2129d1b6c874..7d5d1ec95c2e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -11,10 +11,14 @@
11#define _SYSFS_H_ 11#define _SYSFS_H_
12 12
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/errno.h>
15#include <linux/list.h>
14#include <asm/atomic.h> 16#include <asm/atomic.h>
15 17
16struct kobject; 18struct kobject;
17struct module; 19struct module;
20struct nameidata;
21struct dentry;
18 22
19struct attribute { 23struct attribute {
20 const char * name; 24 const char * name;
@@ -66,18 +70,6 @@ struct sysfs_ops {
66 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 70 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
67}; 71};
68 72
69struct sysfs_dirent {
70 atomic_t s_count;
71 struct list_head s_sibling;
72 struct list_head s_children;
73 void * s_element;
74 int s_type;
75 umode_t s_mode;
76 struct dentry * s_dentry;
77 struct iattr * s_iattr;
78 atomic_t s_event;
79};
80
81#define SYSFS_ROOT 0x0001 73#define SYSFS_ROOT 0x0001
82#define SYSFS_DIR 0x0002 74#define SYSFS_DIR 0x0002
83#define SYSFS_KOBJ_ATTR 0x0004 75#define SYSFS_KOBJ_ATTR 0x0004
@@ -87,14 +79,17 @@ struct sysfs_dirent {
87 79
88#ifdef CONFIG_SYSFS 80#ifdef CONFIG_SYSFS
89 81
82extern int sysfs_schedule_callback(struct kobject *kobj,
83 void (*func)(void *), void *data, struct module *owner);
84
90extern int __must_check 85extern int __must_check
91sysfs_create_dir(struct kobject *); 86sysfs_create_dir(struct kobject *, struct dentry *);
92 87
93extern void 88extern void
94sysfs_remove_dir(struct kobject *); 89sysfs_remove_dir(struct kobject *);
95 90
96extern int __must_check 91extern int __must_check
97sysfs_rename_dir(struct kobject *, const char *new_name); 92sysfs_rename_dir(struct kobject *, struct dentry *, const char *new_name);
98 93
99extern int __must_check 94extern int __must_check
100sysfs_move_dir(struct kobject *, struct kobject *); 95sysfs_move_dir(struct kobject *, struct kobject *);
@@ -124,13 +119,30 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
124int __must_check sysfs_create_group(struct kobject *, 119int __must_check sysfs_create_group(struct kobject *,
125 const struct attribute_group *); 120 const struct attribute_group *);
126void sysfs_remove_group(struct kobject *, const struct attribute_group *); 121void sysfs_remove_group(struct kobject *, const struct attribute_group *);
122int sysfs_add_file_to_group(struct kobject *kobj,
123 const struct attribute *attr, const char *group);
124void sysfs_remove_file_from_group(struct kobject *kobj,
125 const struct attribute *attr, const char *group);
126
127void sysfs_notify(struct kobject * k, char *dir, char *attr); 127void sysfs_notify(struct kobject * k, char *dir, char *attr);
128 128
129
130extern int sysfs_make_shadowed_dir(struct kobject *kobj,
131 void * (*follow_link)(struct dentry *, struct nameidata *));
132extern struct dentry *sysfs_create_shadow_dir(struct kobject *kobj);
133extern void sysfs_remove_shadow_dir(struct dentry *dir);
134
129extern int __must_check sysfs_init(void); 135extern int __must_check sysfs_init(void);
130 136
131#else /* CONFIG_SYSFS */ 137#else /* CONFIG_SYSFS */
132 138
133static inline int sysfs_create_dir(struct kobject * k) 139static inline int sysfs_schedule_callback(struct kobject *kobj,
140 void (*func)(void *), void *data, struct module *owner)
141{
142 return -ENOSYS;
143}
144
145static inline int sysfs_create_dir(struct kobject * k, struct dentry *shadow)
134{ 146{
135 return 0; 147 return 0;
136} 148}
@@ -140,7 +152,9 @@ static inline void sysfs_remove_dir(struct kobject * k)
140 ; 152 ;
141} 153}
142 154
143static inline int sysfs_rename_dir(struct kobject * k, const char *new_name) 155static inline int sysfs_rename_dir(struct kobject * k,
156 struct dentry *new_parent,
157 const char *new_name)
144{ 158{
145 return 0; 159 return 0;
146} 160}
@@ -200,10 +214,27 @@ static inline void sysfs_remove_group(struct kobject * k, const struct attribute
200 ; 214 ;
201} 215}
202 216
217static inline int sysfs_add_file_to_group(struct kobject *kobj,
218 const struct attribute *attr, const char *group)
219{
220 return 0;
221}
222
223static inline void sysfs_remove_file_from_group(struct kobject *kobj,
224 const struct attribute *attr, const char *group)
225{
226}
227
203static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) 228static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
204{ 229{
205} 230}
206 231
232static inline int sysfs_make_shadowed_dir(struct kobject *kobj,
233 void * (*follow_link)(struct dentry *, struct nameidata *))
234{
235 return 0;
236}
237
207static inline int __must_check sysfs_init(void) 238static inline int __must_check sysfs_init(void)
208{ 239{
209 return 0; 240 return 0;
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index 3fced4798255..a46104a28f66 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33 33
34#define TASKSTATS_VERSION 3 34#define TASKSTATS_VERSION 4
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */ 36 * in linux/sched.h */
37 37
@@ -66,7 +66,7 @@ struct taskstats {
66 /* Delay waiting for cpu, while runnable 66 /* Delay waiting for cpu, while runnable
67 * count, delay_total NOT updated atomically 67 * count, delay_total NOT updated atomically
68 */ 68 */
69 __u64 cpu_count; 69 __u64 cpu_count __attribute__((aligned(8)));
70 __u64 cpu_delay_total; 70 __u64 cpu_delay_total;
71 71
72 /* Following four fields atomically updated using task->delays->lock */ 72 /* Following four fields atomically updated using task->delays->lock */
@@ -101,14 +101,17 @@ struct taskstats {
101 101
102 /* Basic Accounting Fields start */ 102 /* Basic Accounting Fields start */
103 char ac_comm[TS_COMM_LEN]; /* Command name */ 103 char ac_comm[TS_COMM_LEN]; /* Command name */
104 __u8 ac_sched; /* Scheduling discipline */ 104 __u8 ac_sched __attribute__((aligned(8)));
105 /* Scheduling discipline */
105 __u8 ac_pad[3]; 106 __u8 ac_pad[3];
106 __u32 ac_uid; /* User ID */ 107 __u32 ac_uid __attribute__((aligned(8)));
108 /* User ID */
107 __u32 ac_gid; /* Group ID */ 109 __u32 ac_gid; /* Group ID */
108 __u32 ac_pid; /* Process ID */ 110 __u32 ac_pid; /* Process ID */
109 __u32 ac_ppid; /* Parent process ID */ 111 __u32 ac_ppid; /* Parent process ID */
110 __u32 ac_btime; /* Begin time [sec since 1970] */ 112 __u32 ac_btime; /* Begin time [sec since 1970] */
111 __u64 ac_etime; /* Elapsed time [usec] */ 113 __u64 ac_etime __attribute__((aligned(8)));
114 /* Elapsed time [usec] */
112 __u64 ac_utime; /* User CPU time [usec] */ 115 __u64 ac_utime; /* User CPU time [usec] */
113 __u64 ac_stime; /* SYstem CPU time [usec] */ 116 __u64 ac_stime; /* SYstem CPU time [usec] */
114 __u64 ac_minflt; /* Minor Page Fault Count */ 117 __u64 ac_minflt; /* Minor Page Fault Count */
diff --git a/include/linux/tc.h b/include/linux/tc.h
new file mode 100644
index 000000000000..f92511e57cdb
--- /dev/null
+++ b/include/linux/tc.h
@@ -0,0 +1,141 @@
1/*
2 * Interface to the TURBOchannel related routines.
3 *
4 * Copyright (c) 1998 Harald Koerfgen
5 * Copyright (c) 2005 James Simmons
6 * Copyright (c) 2006 Maciej W. Rozycki
7 *
8 * Based on:
9 *
10 * "TURBOchannel Firmware Specification", EK-TCAAD-FS-004
11 *
12 * from Digital Equipment Corporation.
13 *
14 * This file is subject to the terms and conditions of the GNU
15 * General Public License. See the file "COPYING" in the main
16 * directory of this archive for more details.
17 */
18#ifndef _LINUX_TC_H
19#define _LINUX_TC_H
20
21#include <linux/compiler.h>
22#include <linux/device.h>
23#include <linux/ioport.h>
24#include <linux/types.h>
25
26/*
27 * Offsets for the ROM header locations for TURBOchannel cards.
28 */
29#define TC_OLDCARD 0x3c0000
30#define TC_NEWCARD 0x000000
31
32#define TC_ROM_WIDTH 0x3e0
33#define TC_ROM_STRIDE 0x3e4
34#define TC_ROM_SIZE 0x3e8
35#define TC_SLOT_SIZE 0x3ec
36#define TC_PATTERN0 0x3f0
37#define TC_PATTERN1 0x3f4
38#define TC_PATTERN2 0x3f8
39#define TC_PATTERN3 0x3fc
40#define TC_FIRM_VER 0x400
41#define TC_VENDOR 0x420
42#define TC_MODULE 0x440
43#define TC_FIRM_TYPE 0x460
44#define TC_FLAGS 0x470
45#define TC_ROM_OBJECTS 0x480
46
47/*
48 * Information obtained through the get_tcinfo() PROM call.
49 */
50struct tcinfo {
51 s32 revision; /* Hardware revision level. */
52 s32 clk_period; /* Clock period in nanoseconds. */
53 s32 slot_size; /* Slot size in megabytes. */
54 s32 io_timeout; /* I/O timeout in cycles. */
55 s32 dma_range; /* DMA address range in megabytes. */
56 s32 max_dma_burst; /* Maximum DMA burst length. */
57 s32 parity; /* System module supports TC parity. */
58 s32 reserved[4];
59};
60
61/*
62 * TURBOchannel bus.
63 */
64struct tc_bus {
65 struct list_head devices; /* List of devices on this bus. */
66 struct resource resource[2]; /* Address space routed to this bus. */
67
68 struct device dev;
69 char name[13];
70 resource_size_t slot_base;
71 resource_size_t ext_slot_base;
72 resource_size_t ext_slot_size;
73 int num_tcslots;
74 struct tcinfo info;
75};
76
77/*
78 * TURBOchannel device.
79 */
80struct tc_dev {
81 struct list_head node; /* Node in list of all TC devices. */
82 struct tc_bus *bus; /* Bus this device is on. */
83 struct tc_driver *driver; /* Which driver has allocated this
84 device. */
85 struct device dev; /* Generic device interface. */
86 struct resource resource; /* Address space of this device. */
87 char vendor[9];
88 char name[9];
89 char firmware[9];
90 int interrupt;
91 int slot;
92};
93
94#define to_tc_dev(n) container_of(n, struct tc_dev, dev)
95
96struct tc_device_id {
97 char vendor[9];
98 char name[9];
99};
100
101/*
102 * TURBOchannel driver.
103 */
104struct tc_driver {
105 struct list_head node;
106 const struct tc_device_id *id_table;
107 struct device_driver driver;
108};
109
110#define to_tc_driver(drv) container_of(drv, struct tc_driver, driver)
111
112/*
113 * Return TURBOchannel clock frequency in Hz.
114 */
115static inline unsigned long tc_get_speed(struct tc_bus *tbus)
116{
117 return 100000 * (10000 / (unsigned long)tbus->info.clk_period);
118}
119
120#ifdef CONFIG_TC
121
122extern struct bus_type tc_bus_type;
123
124extern int tc_register_driver(struct tc_driver *tdrv);
125extern void tc_unregister_driver(struct tc_driver *tdrv);
126
127#else /* !CONFIG_TC */
128
129static inline int tc_register_driver(struct tc_driver *tdrv) { return 0; }
130static inline void tc_unregister_driver(struct tc_driver *tdrv) { }
131
132#endif /* CONFIG_TC */
133
134/*
135 * These have to be provided by the architecture.
136 */
137extern int tc_preadb(u8 *valp, void __iomem *addr);
138extern int tc_bus_get_info(struct tc_bus *tbus);
139extern void tc_device_get_irq(struct tc_dev *tdev);
140
141#endif /* _LINUX_TC_H */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 3cc70d1a3504..c6b9f92e8289 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -178,6 +178,21 @@ struct tcp_md5sig {
178#include <net/inet_connection_sock.h> 178#include <net/inet_connection_sock.h>
179#include <net/inet_timewait_sock.h> 179#include <net/inet_timewait_sock.h>
180 180
181static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
182{
183 return (struct tcphdr *)skb_transport_header(skb);
184}
185
186static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
187{
188 return tcp_hdr(skb)->doff * 4;
189}
190
191static inline unsigned int tcp_optlen(const struct sk_buff *skb)
192{
193 return (tcp_hdr(skb)->doff - 5) * 4;
194}
195
181/* This defines a selective acknowledgement block. */ 196/* This defines a selective acknowledgement block. */
182struct tcp_sack_block_wire { 197struct tcp_sack_block_wire {
183 __be32 start_seq; 198 __be32 start_seq;
@@ -242,6 +257,8 @@ struct tcp_sock {
242 * See RFC793 and RFC1122. The RFC writes these in capitals. 257 * See RFC793 and RFC1122. The RFC writes these in capitals.
243 */ 258 */
244 u32 rcv_nxt; /* What we want to receive next */ 259 u32 rcv_nxt; /* What we want to receive next */
260 u32 copied_seq; /* Head of yet unread data */
261 u32 rcv_wup; /* rcv_nxt on last window update sent */
245 u32 snd_nxt; /* Next sequence we send */ 262 u32 snd_nxt; /* Next sequence we send */
246 263
247 u32 snd_una; /* First byte we want an ack for */ 264 u32 snd_una; /* First byte we want an ack for */
@@ -300,23 +317,21 @@ struct tcp_sock {
300 u32 snd_ssthresh; /* Slow start size threshold */ 317 u32 snd_ssthresh; /* Slow start size threshold */
301 u32 snd_cwnd; /* Sending congestion window */ 318 u32 snd_cwnd; /* Sending congestion window */
302 u16 snd_cwnd_cnt; /* Linear increase counter */ 319 u16 snd_cwnd_cnt; /* Linear increase counter */
303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 320 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
304 u32 snd_cwnd_used; 321 u32 snd_cwnd_used;
305 u32 snd_cwnd_stamp; 322 u32 snd_cwnd_stamp;
306 323
307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 324 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
308 325
309 u32 rcv_wnd; /* Current receiver window */ 326 u32 rcv_wnd; /* Current receiver window */
310 u32 rcv_wup; /* rcv_nxt on last window update sent */
311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 327 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 328 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
313 u32 copied_seq; /* Head of yet unread data */
314 329
315/* SACKs data */ 330/* SACKs data */
316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 331 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
317 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 332 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
318 333
319 struct tcp_sack_block recv_sack_cache[4]; 334 struct tcp_sack_block_wire recv_sack_cache[4];
320 335
321 /* from STCP, retrans queue hinting */ 336 /* from STCP, retrans queue hinting */
322 struct sk_buff* lost_skb_hint; 337 struct sk_buff* lost_skb_hint;
diff --git a/include/linux/tick.h b/include/linux/tick.h
new file mode 100644
index 000000000000..9a7252e089b9
--- /dev/null
+++ b/include/linux/tick.h
@@ -0,0 +1,109 @@
1/* linux/include/linux/tick.h
2 *
3 * This file contains the structure definitions for tick related functions
4 *
5 */
6#ifndef _LINUX_TICK_H
7#define _LINUX_TICK_H
8
9#include <linux/clockchips.h>
10
11#ifdef CONFIG_GENERIC_CLOCKEVENTS
12
13enum tick_device_mode {
14 TICKDEV_MODE_PERIODIC,
15 TICKDEV_MODE_ONESHOT,
16};
17
18struct tick_device {
19 struct clock_event_device *evtdev;
20 enum tick_device_mode mode;
21};
22
23enum tick_nohz_mode {
24 NOHZ_MODE_INACTIVE,
25 NOHZ_MODE_LOWRES,
26 NOHZ_MODE_HIGHRES,
27};
28
29/**
30 * struct tick_sched - sched tick emulation and no idle tick control/stats
31 * @sched_timer: hrtimer to schedule the periodic tick in high
32 * resolution mode
33 * @idle_tick: Store the last idle tick expiry time when the tick
34 * timer is modified for idle sleeps. This is necessary
35 * to resume the tick timer operation in the timeline
36 * when the CPU returns from idle
37 * @tick_stopped: Indicator that the idle tick has been stopped
38 * @idle_jiffies: jiffies at the entry to idle for idle time accounting
39 * @idle_calls: Total number of idle calls
40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
41 * @idle_entrytime: Time when the idle call was entered
42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
43 */
44struct tick_sched {
45 struct hrtimer sched_timer;
46 unsigned long check_clocks;
47 enum tick_nohz_mode nohz_mode;
48 ktime_t idle_tick;
49 int tick_stopped;
50 unsigned long idle_jiffies;
51 unsigned long idle_calls;
52 unsigned long idle_sleeps;
53 ktime_t idle_entrytime;
54 ktime_t idle_sleeptime;
55 unsigned long last_jiffies;
56 unsigned long next_jiffies;
57 ktime_t idle_expires;
58};
59
60extern void __init tick_init(void);
61extern int tick_is_oneshot_available(void);
62extern struct tick_device *tick_get_device(int cpu);
63
64# ifdef CONFIG_HIGH_RES_TIMERS
65extern int tick_init_highres(void);
66extern int tick_program_event(ktime_t expires, int force);
67extern void tick_setup_sched_timer(void);
68extern void tick_cancel_sched_timer(int cpu);
69# else
70static inline void tick_cancel_sched_timer(int cpu) { }
71# endif /* HIGHRES */
72
73# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
74extern struct tick_device *tick_get_broadcast_device(void);
75extern cpumask_t *tick_get_broadcast_mask(void);
76
77# ifdef CONFIG_TICK_ONESHOT
78extern cpumask_t *tick_get_broadcast_oneshot_mask(void);
79# endif
80
81# endif /* BROADCAST */
82
83# ifdef CONFIG_TICK_ONESHOT
84extern void tick_clock_notify(void);
85extern int tick_check_oneshot_change(int allow_nohz);
86extern struct tick_sched *tick_get_tick_sched(int cpu);
87# else
88static inline void tick_clock_notify(void) { }
89static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
90# endif
91
92#else /* CONFIG_GENERIC_CLOCKEVENTS */
93static inline void tick_init(void) { }
94static inline void tick_cancel_sched_timer(int cpu) { }
95static inline void tick_clock_notify(void) { }
96static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
97#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
98
99# ifdef CONFIG_NO_HZ
100extern void tick_nohz_stop_sched_tick(void);
101extern void tick_nohz_restart_sched_tick(void);
102extern void tick_nohz_update_jiffies(void);
103# else
104static inline void tick_nohz_stop_sched_tick(void) { }
105static inline void tick_nohz_restart_sched_tick(void) { }
106static inline void tick_nohz_update_jiffies(void) { }
107# endif /* !NO_HZ */
108
109#endif
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index dfb8052eee5e..3deb0a6c1370 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -17,7 +17,7 @@
17#include <linux/wait.h> 17#include <linux/wait.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/scatterlist.h> 20#include <linux/kthread.h>
21 21
22/* Host registers (relative to pci base address): */ 22/* Host registers (relative to pci base address): */
23enum { 23enum {
@@ -62,11 +62,10 @@ enum {
62 62
63 63
64#define TIFM_IRQ_ENABLE 0x80000000 64#define TIFM_IRQ_ENABLE 0x80000000
65#define TIFM_IRQ_SOCKMASK 0x00000001 65#define TIFM_IRQ_SOCKMASK(x) (x)
66#define TIFM_IRQ_CARDMASK 0x00000100 66#define TIFM_IRQ_CARDMASK(x) ((x) << 8)
67#define TIFM_IRQ_FIFOMASK 0x00010000 67#define TIFM_IRQ_FIFOMASK(x) ((x) << 16)
68#define TIFM_IRQ_SETALL 0xffffffff 68#define TIFM_IRQ_SETALL 0xffffffff
69#define TIFM_IRQ_SETALLSOCK 0x0000000f
70 69
71#define TIFM_CTRL_LED 0x00000040 70#define TIFM_CTRL_LED 0x00000040
72#define TIFM_CTRL_FAST_CLK 0x00000100 71#define TIFM_CTRL_FAST_CLK 0x00000100
@@ -89,10 +88,9 @@ struct tifm_dev {
89 char __iomem *addr; 88 char __iomem *addr;
90 spinlock_t lock; 89 spinlock_t lock;
91 tifm_media_id media_id; 90 tifm_media_id media_id;
92 char wq_name[KOBJ_NAME_LEN]; 91 unsigned int socket_id;
93 struct workqueue_struct *wq;
94 92
95 unsigned int (*signal_irq)(struct tifm_dev *sock, 93 void (*signal_irq)(struct tifm_dev *sock,
96 unsigned int sock_irq_status); 94 unsigned int sock_irq_status);
97 95
98 struct tifm_driver *drv; 96 struct tifm_driver *drv;
@@ -103,24 +101,23 @@ struct tifm_driver {
103 tifm_media_id *id_table; 101 tifm_media_id *id_table;
104 int (*probe)(struct tifm_dev *dev); 102 int (*probe)(struct tifm_dev *dev);
105 void (*remove)(struct tifm_dev *dev); 103 void (*remove)(struct tifm_dev *dev);
104 int (*suspend)(struct tifm_dev *dev,
105 pm_message_t state);
106 int (*resume)(struct tifm_dev *dev);
106 107
107 struct device_driver driver; 108 struct device_driver driver;
108}; 109};
109 110
110struct tifm_adapter { 111struct tifm_adapter {
111 char __iomem *addr; 112 char __iomem *addr;
112 unsigned int irq_status;
113 unsigned int insert_mask;
114 unsigned int remove_mask;
115 spinlock_t lock; 113 spinlock_t lock;
114 unsigned int irq_status;
115 unsigned int socket_change_set;
116 wait_queue_head_t change_set_notify;
116 unsigned int id; 117 unsigned int id;
117 unsigned int max_sockets; 118 unsigned int num_sockets;
118 char wq_name[KOBJ_NAME_LEN];
119 unsigned int inhibit_new_cards;
120 struct workqueue_struct *wq;
121 struct work_struct media_inserter;
122 struct work_struct media_remover;
123 struct tifm_dev **sockets; 119 struct tifm_dev **sockets;
120 struct task_struct *media_switcher;
124 struct class_device cdev; 121 struct class_device cdev;
125 struct device *dev; 122 struct device *dev;
126 123
@@ -130,9 +127,9 @@ struct tifm_adapter {
130struct tifm_adapter *tifm_alloc_adapter(void); 127struct tifm_adapter *tifm_alloc_adapter(void);
131void tifm_free_device(struct device *dev); 128void tifm_free_device(struct device *dev);
132void tifm_free_adapter(struct tifm_adapter *fm); 129void tifm_free_adapter(struct tifm_adapter *fm);
133int tifm_add_adapter(struct tifm_adapter *fm); 130int tifm_add_adapter(struct tifm_adapter *fm, int (*mediathreadfn)(void *data));
134void tifm_remove_adapter(struct tifm_adapter *fm); 131void tifm_remove_adapter(struct tifm_adapter *fm);
135struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id); 132struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm);
136int tifm_register_driver(struct tifm_driver *drv); 133int tifm_register_driver(struct tifm_driver *drv);
137void tifm_unregister_driver(struct tifm_driver *drv); 134void tifm_unregister_driver(struct tifm_driver *drv);
138void tifm_eject(struct tifm_dev *sock); 135void tifm_eject(struct tifm_dev *sock);
diff --git a/include/linux/time.h b/include/linux/time.h
index a5b739967b74..8ea8dea713c7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -46,7 +46,7 @@ static inline int timespec_equal(struct timespec *a, struct timespec *b)
46 * lhs == rhs: return 0 46 * lhs == rhs: return 0
47 * lhs > rhs: return >0 47 * lhs > rhs: return >0
48 */ 48 */
49static inline int timespec_compare(struct timespec *lhs, struct timespec *rhs) 49static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs)
50{ 50{
51 if (lhs->tv_sec < rhs->tv_sec) 51 if (lhs->tv_sec < rhs->tv_sec)
52 return -1; 52 return -1;
@@ -55,7 +55,7 @@ static inline int timespec_compare(struct timespec *lhs, struct timespec *rhs)
55 return lhs->tv_nsec - rhs->tv_nsec; 55 return lhs->tv_nsec - rhs->tv_nsec;
56} 56}
57 57
58static inline int timeval_compare(struct timeval *lhs, struct timeval *rhs) 58static inline int timeval_compare(const struct timeval *lhs, const struct timeval *rhs)
59{ 59{
60 if (lhs->tv_sec < rhs->tv_sec) 60 if (lhs->tv_sec < rhs->tv_sec)
61 return -1; 61 return -1;
@@ -90,8 +90,9 @@ static inline struct timespec timespec_sub(struct timespec lhs,
90 90
91extern struct timespec xtime; 91extern struct timespec xtime;
92extern struct timespec wall_to_monotonic; 92extern struct timespec wall_to_monotonic;
93extern seqlock_t xtime_lock; 93extern seqlock_t xtime_lock __attribute__((weak));
94 94
95extern unsigned long read_persistent_clock(void);
95void timekeeping_init(void); 96void timekeeping_init(void);
96 97
97static inline unsigned long get_seconds(void) 98static inline unsigned long get_seconds(void)
diff --git a/include/linux/timer.h b/include/linux/timer.h
index fb5edaaf0ebd..719113b652dd 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -2,6 +2,7 @@
2#define _LINUX_TIMER_H 2#define _LINUX_TIMER_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/ktime.h>
5#include <linux/spinlock.h> 6#include <linux/spinlock.h>
6#include <linux/stddef.h> 7#include <linux/stddef.h>
7 8
@@ -15,6 +16,11 @@ struct timer_list {
15 unsigned long data; 16 unsigned long data;
16 17
17 struct tvec_t_base_s *base; 18 struct tvec_t_base_s *base;
19#ifdef CONFIG_TIMER_STATS
20 void *start_site;
21 char start_comm[16];
22 int start_pid;
23#endif
18}; 24};
19 25
20extern struct tvec_t_base_s boot_tvec_bases; 26extern struct tvec_t_base_s boot_tvec_bases;
@@ -61,7 +67,65 @@ extern int del_timer(struct timer_list * timer);
61extern int __mod_timer(struct timer_list *timer, unsigned long expires); 67extern int __mod_timer(struct timer_list *timer, unsigned long expires);
62extern int mod_timer(struct timer_list *timer, unsigned long expires); 68extern int mod_timer(struct timer_list *timer, unsigned long expires);
63 69
70/*
71 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
72 * locks the timer base:
73 */
64extern unsigned long next_timer_interrupt(void); 74extern unsigned long next_timer_interrupt(void);
75/*
76 * Return when the next timer-wheel timeout occurs (in absolute jiffies),
77 * locks the timer base and does the comparison against the given
78 * jiffie.
79 */
80extern unsigned long get_next_timer_interrupt(unsigned long now);
81
82/*
83 * Timer-statistics info:
84 */
85#ifdef CONFIG_TIMER_STATS
86
87extern void init_timer_stats(void);
88
89extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
90 void *timerf, char * comm);
91
92static inline void timer_stats_account_timer(struct timer_list *timer)
93{
94 timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
95 timer->function, timer->start_comm);
96}
97
98extern void __timer_stats_timer_set_start_info(struct timer_list *timer,
99 void *addr);
100
101static inline void timer_stats_timer_set_start_info(struct timer_list *timer)
102{
103 __timer_stats_timer_set_start_info(timer, __builtin_return_address(0));
104}
105
106static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
107{
108 timer->start_site = NULL;
109}
110#else
111static inline void init_timer_stats(void)
112{
113}
114
115static inline void timer_stats_account_timer(struct timer_list *timer)
116{
117}
118
119static inline void timer_stats_timer_set_start_info(struct timer_list *timer)
120{
121}
122
123static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
124{
125}
126#endif
127
128extern void delayed_work_timer_fn(unsigned long __data);
65 129
66/** 130/**
67 * add_timer - start a timer 131 * add_timer - start a timer
@@ -96,7 +160,7 @@ static inline void add_timer(struct timer_list *timer)
96extern void init_timers(void); 160extern void init_timers(void);
97extern void run_local_timers(void); 161extern void run_local_timers(void);
98struct hrtimer; 162struct hrtimer;
99extern int it_real_fn(struct hrtimer *); 163extern enum hrtimer_restart it_real_fn(struct hrtimer *);
100 164
101unsigned long __round_jiffies(unsigned long j, int cpu); 165unsigned long __round_jiffies(unsigned long j, int cpu);
102unsigned long __round_jiffies_relative(unsigned long j, int cpu); 166unsigned long __round_jiffies_relative(unsigned long j, int cpu);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index db501dc23c29..da929dbbea2a 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -255,10 +255,10 @@ struct time_interpolator {
255 u8 jitter; /* if set compensate for fluctuations */ 255 u8 jitter; /* if set compensate for fluctuations */
256 u32 nsec_per_cyc; /* set by register_time_interpolator() */ 256 u32 nsec_per_cyc; /* set by register_time_interpolator() */
257 void *addr; /* address of counter or function */ 257 void *addr; /* address of counter or function */
258 u64 mask; /* mask the valid bits of the counter */ 258 cycles_t mask; /* mask the valid bits of the counter */
259 unsigned long offset; /* nsec offset at last update of interpolator */ 259 unsigned long offset; /* nsec offset at last update of interpolator */
260 u64 last_counter; /* counter value in units of the counter at last update */ 260 u64 last_counter; /* counter value in units of the counter at last update */
261 u64 last_cycle; /* Last timer value if TIME_SOURCE_JITTER is set */ 261 cycles_t last_cycle; /* Last timer value if TIME_SOURCE_JITTER is set */
262 u64 frequency; /* frequency in counts/second */ 262 u64 frequency; /* frequency in counts/second */
263 long drift; /* drift in parts-per-million (or -1) */ 263 long drift; /* drift in parts-per-million (or -1) */
264 unsigned long skips; /* skips forward */ 264 unsigned long skips; /* skips forward */
@@ -286,6 +286,13 @@ static inline void time_interpolator_update(long delta_nsec)
286 286
287#define TICK_LENGTH_SHIFT 32 287#define TICK_LENGTH_SHIFT 32
288 288
289#ifdef CONFIG_NO_HZ
290#define NTP_INTERVAL_FREQ (2)
291#else
292#define NTP_INTERVAL_FREQ (HZ)
293#endif
294#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
295
289/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 296/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
290extern u64 current_tick_length(void); 297extern u64 current_tick_length(void);
291 298
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 6c5a6e6e813b..a9d1f049cc15 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -96,7 +96,6 @@
96 .busy_factor = 64, \ 96 .busy_factor = 64, \
97 .imbalance_pct = 110, \ 97 .imbalance_pct = 110, \
98 .cache_nice_tries = 0, \ 98 .cache_nice_tries = 0, \
99 .per_cpu_gain = 25, \
100 .busy_idx = 0, \ 99 .busy_idx = 0, \
101 .idle_idx = 0, \ 100 .idle_idx = 0, \
102 .newidle_idx = 1, \ 101 .newidle_idx = 1, \
@@ -128,7 +127,6 @@
128 .busy_factor = 64, \ 127 .busy_factor = 64, \
129 .imbalance_pct = 125, \ 128 .imbalance_pct = 125, \
130 .cache_nice_tries = 1, \ 129 .cache_nice_tries = 1, \
131 .per_cpu_gain = 100, \
132 .busy_idx = 2, \ 130 .busy_idx = 2, \
133 .idle_idx = 1, \ 131 .idle_idx = 1, \
134 .newidle_idx = 2, \ 132 .newidle_idx = 2, \
@@ -159,7 +157,6 @@
159 .busy_factor = 64, \ 157 .busy_factor = 64, \
160 .imbalance_pct = 125, \ 158 .imbalance_pct = 125, \
161 .cache_nice_tries = 1, \ 159 .cache_nice_tries = 1, \
162 .per_cpu_gain = 100, \
163 .busy_idx = 2, \ 160 .busy_idx = 2, \
164 .idle_idx = 1, \ 161 .idle_idx = 1, \
165 .newidle_idx = 2, \ 162 .newidle_idx = 2, \
@@ -193,7 +190,6 @@
193 .newidle_idx = 0, /* unused */ \ 190 .newidle_idx = 0, /* unused */ \
194 .wake_idx = 0, /* unused */ \ 191 .wake_idx = 0, /* unused */ \
195 .forkexec_idx = 0, /* unused */ \ 192 .forkexec_idx = 0, /* unused */ \
196 .per_cpu_gain = 100, \
197 .flags = SD_LOAD_BALANCE \ 193 .flags = SD_LOAD_BALANCE \
198 | SD_SERIALIZE, \ 194 | SD_SERIALIZE, \
199 .last_balance = jiffies, \ 195 .last_balance = jiffies, \
diff --git a/include/linux/toshiba.h b/include/linux/toshiba.h
index 916e5e3a699b..6a7c4edf0e13 100644
--- a/include/linux/toshiba.h
+++ b/include/linux/toshiba.h
@@ -33,4 +33,6 @@ typedef struct {
33 unsigned int edi __attribute__ ((packed)); 33 unsigned int edi __attribute__ ((packed));
34} SMMRegisters; 34} SMMRegisters;
35 35
36int tosh_smm(SMMRegisters *regs);
37
36#endif 38#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 65cbcf22c31e..dee72b9a20fb 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -24,7 +24,27 @@
24#define NR_PTYS CONFIG_LEGACY_PTY_COUNT /* Number of legacy ptys */ 24#define NR_PTYS CONFIG_LEGACY_PTY_COUNT /* Number of legacy ptys */
25#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 25#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
26#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 26#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
27#define NR_LDISCS 16 27#define NR_LDISCS 17
28
29/* line disciplines */
30#define N_TTY 0
31#define N_SLIP 1
32#define N_MOUSE 2
33#define N_PPP 3
34#define N_STRIP 4
35#define N_AX25 5
36#define N_X25 6 /* X.25 async */
37#define N_6PACK 7
38#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
39#define N_R3964 9 /* Reserved for Simatic R3964 module */
40#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
41#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
42#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */
43 /* cards about SMS messages */
44#define N_HDLC 13 /* synchronous HDLC */
45#define N_SYNC_PPP 14 /* synchronous PPP */
46#define N_HCI 15 /* Bluetooth HCI UART */
47#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
28 48
29/* 49/*
30 * This character is the same as _POSIX_VDISABLE: it cannot be used as 50 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -177,8 +197,8 @@ struct tty_struct {
177 struct mutex termios_mutex; 197 struct mutex termios_mutex;
178 struct ktermios *termios, *termios_locked; 198 struct ktermios *termios, *termios_locked;
179 char name[64]; 199 char name[64];
180 int pgrp; 200 struct pid *pgrp;
181 int session; 201 struct pid *session;
182 unsigned long flags; 202 unsigned long flags;
183 int count; 203 int count;
184 struct winsize winsize; 204 struct winsize winsize;
@@ -283,7 +303,7 @@ extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
283 int buflen); 303 int buflen);
284extern void tty_write_message(struct tty_struct *tty, char *msg); 304extern void tty_write_message(struct tty_struct *tty, char *msg);
285 305
286extern int is_orphaned_pgrp(int pgrp); 306extern int is_current_pgrp_orphaned(void);
287extern int is_ignored(int sig); 307extern int is_ignored(int sig);
288extern int tty_signal(int sig, struct tty_struct *tty); 308extern int tty_signal(int sig, struct tty_struct *tty);
289extern void tty_hangup(struct tty_struct * tty); 309extern void tty_hangup(struct tty_struct * tty);
@@ -291,6 +311,7 @@ extern void tty_vhangup(struct tty_struct * tty);
291extern void tty_unhangup(struct file *filp); 311extern void tty_unhangup(struct file *filp);
292extern int tty_hung_up_p(struct file * filp); 312extern int tty_hung_up_p(struct file * filp);
293extern void do_SAK(struct tty_struct *tty); 313extern void do_SAK(struct tty_struct *tty);
314extern void __do_SAK(struct tty_struct *tty);
294extern void disassociate_ctty(int priv); 315extern void disassociate_ctty(int priv);
295extern void tty_flip_buffer_push(struct tty_struct *tty); 316extern void tty_flip_buffer_push(struct tty_struct *tty);
296extern speed_t tty_get_baud_rate(struct tty_struct *tty); 317extern speed_t tty_get_baud_rate(struct tty_struct *tty);
@@ -312,7 +333,6 @@ extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
312 333
313extern dev_t tty_devnum(struct tty_struct *tty); 334extern dev_t tty_devnum(struct tty_struct *tty);
314extern void proc_clear_tty(struct task_struct *p); 335extern void proc_clear_tty(struct task_struct *p);
315extern void __proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
316extern void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty); 336extern void proc_set_tty(struct task_struct *tsk, struct tty_struct *tty);
317extern struct tty_struct *get_current_tty(void); 337extern struct tty_struct *get_current_tty(void);
318 338
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 7e08c07efe0f..6de445c31a64 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,6 +26,15 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
29/* UDP socket options */ 38/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 39#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index 28967eda9d7b..daeba22b7656 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -40,13 +40,16 @@ typedef __u64 __fs64;
40typedef __u32 __fs32; 40typedef __u32 __fs32;
41typedef __u16 __fs16; 41typedef __u16 __fs16;
42#else 42#else
43#include <asm/div64.h>
43typedef __u64 __bitwise __fs64; 44typedef __u64 __bitwise __fs64;
44typedef __u32 __bitwise __fs32; 45typedef __u32 __bitwise __fs32;
45typedef __u16 __bitwise __fs16; 46typedef __u16 __bitwise __fs16;
46#endif 47#endif
47 48
49#ifdef __KERNEL__
48#include <linux/ufs_fs_i.h> 50#include <linux/ufs_fs_i.h>
49#include <linux/ufs_fs_sb.h> 51#include <linux/ufs_fs_sb.h>
52#endif
50 53
51#define UFS_BBLOCK 0 54#define UFS_BBLOCK 0
52#define UFS_BBSIZE 8192 55#define UFS_BBSIZE 8192
@@ -261,17 +264,10 @@ typedef __u16 __bitwise __fs16;
261 */ 264 */
262#define ufs_inotocg(x) ((x) / uspi->s_ipg) 265#define ufs_inotocg(x) ((x) / uspi->s_ipg)
263#define ufs_inotocgoff(x) ((x) % uspi->s_ipg) 266#define ufs_inotocgoff(x) ((x) % uspi->s_ipg)
264#define ufs_inotofsba(x) (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf) 267#define ufs_inotofsba(x) (((u64)ufs_cgimin(ufs_inotocg(x))) + ufs_inotocgoff(x) / uspi->s_inopf)
265#define ufs_inotofsbo(x) ((x) % uspi->s_inopf) 268#define ufs_inotofsbo(x) ((x) % uspi->s_inopf)
266 269
267/* 270/*
268 * Give cylinder group number for a file system block.
269 * Give cylinder group block number for a file system block.
270 */
271#define ufs_dtog(d) ((d) / uspi->s_fpg)
272#define ufs_dtogd(d) ((d) % uspi->s_fpg)
273
274/*
275 * Compute the cylinder and rotational position of a cyl block addr. 271 * Compute the cylinder and rotational position of a cyl block addr.
276 */ 272 */
277#define ufs_cbtocylno(bno) \ 273#define ufs_cbtocylno(bno) \
@@ -303,7 +299,7 @@ typedef __u16 __bitwise __fs16;
303#define UFS_MAXMNTLEN 512 299#define UFS_MAXMNTLEN 512
304#define UFS2_MAXMNTLEN 468 300#define UFS2_MAXMNTLEN 468
305#define UFS2_MAXVOLLEN 32 301#define UFS2_MAXVOLLEN 32
306/* #define UFS_MAXCSBUFS 31 */ 302#define UFS_MAXCSBUFS 31
307#define UFS_LINK_MAX 32000 303#define UFS_LINK_MAX 32000
308/* 304/*
309#define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4) 305#define UFS2_NOCSPTRS ((128 / sizeof(void *)) - 4)
@@ -653,10 +649,10 @@ struct ufs2_inode {
653 __fs32 ui_blksize; /* 12: Inode blocksize. */ 649 __fs32 ui_blksize; /* 12: Inode blocksize. */
654 __fs64 ui_size; /* 16: File byte count. */ 650 __fs64 ui_size; /* 16: File byte count. */
655 __fs64 ui_blocks; /* 24: Bytes actually held. */ 651 __fs64 ui_blocks; /* 24: Bytes actually held. */
656 struct ufs_timeval ui_atime; /* 32: Last access time. */ 652 __fs64 ui_atime; /* 32: Last access time. */
657 struct ufs_timeval ui_mtime; /* 40: Last modified time. */ 653 __fs64 ui_mtime; /* 40: Last modified time. */
658 struct ufs_timeval ui_ctime; /* 48: Last inode change time. */ 654 __fs64 ui_ctime; /* 48: Last inode change time. */
659 struct ufs_timeval ui_birthtime; /* 56: Inode creation time. */ 655 __fs64 ui_birthtime; /* 56: Inode creation time. */
660 __fs32 ui_mtimensec; /* 64: Last modified time. */ 656 __fs32 ui_mtimensec; /* 64: Last modified time. */
661 __fs32 ui_atimensec; /* 68: Last access time. */ 657 __fs32 ui_atimensec; /* 68: Last access time. */
662 __fs32 ui_ctimensec; /* 72: Last inode change time. */ 658 __fs32 ui_ctimensec; /* 72: Last inode change time. */
@@ -721,6 +717,7 @@ struct ufs_cg_private_info {
721 __u32 c_nclusterblks; /* number of clusters this cg */ 717 __u32 c_nclusterblks; /* number of clusters this cg */
722}; 718};
723 719
720
724struct ufs_sb_private_info { 721struct ufs_sb_private_info {
725 struct ufs_buffer_head s_ubh; /* buffer containing super block */ 722 struct ufs_buffer_head s_ubh; /* buffer containing super block */
726 struct ufs_csum_core cs_total; 723 struct ufs_csum_core cs_total;
@@ -754,7 +751,7 @@ struct ufs_sb_private_info {
754 __u32 s_npsect; /* # sectors/track including spares */ 751 __u32 s_npsect; /* # sectors/track including spares */
755 __u32 s_interleave; /* hardware sector interleave */ 752 __u32 s_interleave; /* hardware sector interleave */
756 __u32 s_trackskew; /* sector 0 skew, per track */ 753 __u32 s_trackskew; /* sector 0 skew, per track */
757 __u32 s_csaddr; /* blk addr of cyl grp summary area */ 754 __u64 s_csaddr; /* blk addr of cyl grp summary area */
758 __u32 s_cssize; /* size of cyl grp summary area */ 755 __u32 s_cssize; /* size of cyl grp summary area */
759 __u32 s_cgsize; /* cylinder group size */ 756 __u32 s_cgsize; /* cylinder group size */
760 __u32 s_ntrak; /* tracks per cylinder */ 757 __u32 s_ntrak; /* tracks per cylinder */
@@ -789,6 +786,7 @@ struct ufs_sb_private_info {
789 786
790 __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */ 787 __u32 s_maxsymlinklen;/* upper limit on fast symlinks' size */
791 __s32 fs_magic; /* filesystem magic */ 788 __s32 fs_magic; /* filesystem magic */
789 unsigned int s_dirblksize;
792}; 790};
793 791
794/* 792/*
@@ -949,17 +947,17 @@ struct ufs_super_block_third {
949#ifdef __KERNEL__ 947#ifdef __KERNEL__
950 948
951/* balloc.c */ 949/* balloc.c */
952extern void ufs_free_fragments (struct inode *, unsigned, unsigned); 950extern void ufs_free_fragments (struct inode *, u64, unsigned);
953extern void ufs_free_blocks (struct inode *, unsigned, unsigned); 951extern void ufs_free_blocks (struct inode *, u64, unsigned);
954extern unsigned ufs_new_fragments(struct inode *, __fs32 *, unsigned, unsigned, 952extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
955 unsigned, int *, struct page *); 953 unsigned, int *, struct page *);
956 954
957/* cylinder.c */ 955/* cylinder.c */
958extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); 956extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
959extern void ufs_put_cylinder (struct super_block *, unsigned); 957extern void ufs_put_cylinder (struct super_block *, unsigned);
960 958
961/* dir.c */ 959/* dir.c */
962extern struct inode_operations ufs_dir_inode_operations; 960extern const struct inode_operations ufs_dir_inode_operations;
963extern int ufs_add_link (struct dentry *, struct inode *); 961extern int ufs_add_link (struct dentry *, struct inode *);
964extern ino_t ufs_inode_by_name(struct inode *, struct dentry *); 962extern ino_t ufs_inode_by_name(struct inode *, struct dentry *);
965extern int ufs_make_empty(struct inode *, struct inode *); 963extern int ufs_make_empty(struct inode *, struct inode *);
@@ -971,7 +969,7 @@ extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
971 struct page *page, struct inode *inode); 969 struct page *page, struct inode *inode);
972 970
973/* file.c */ 971/* file.c */
974extern struct inode_operations ufs_file_inode_operations; 972extern const struct inode_operations ufs_file_inode_operations;
975extern const struct file_operations ufs_file_operations; 973extern const struct file_operations ufs_file_operations;
976 974
977extern const struct address_space_operations ufs_aops; 975extern const struct address_space_operations ufs_aops;
@@ -998,7 +996,7 @@ extern void ufs_error (struct super_block *, const char *, const char *, ...) __
998extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); 996extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
999 997
1000/* symlink.c */ 998/* symlink.c */
1001extern struct inode_operations ufs_fast_symlink_inode_operations; 999extern const struct inode_operations ufs_fast_symlink_inode_operations;
1002 1000
1003/* truncate.c */ 1001/* truncate.c */
1004extern int ufs_truncate (struct inode *, loff_t); 1002extern int ufs_truncate (struct inode *, loff_t);
@@ -1013,6 +1011,22 @@ static inline struct ufs_inode_info *UFS_I(struct inode *inode)
1013 return container_of(inode, struct ufs_inode_info, vfs_inode); 1011 return container_of(inode, struct ufs_inode_info, vfs_inode);
1014} 1012}
1015 1013
1014/*
1015 * Give cylinder group number for a file system block.
1016 * Give cylinder group block number for a file system block.
1017 */
1018/* #define ufs_dtog(d) ((d) / uspi->s_fpg) */
1019static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b)
1020{
1021 do_div(b, uspi->s_fpg);
1022 return b;
1023}
1024/* #define ufs_dtogd(d) ((d) % uspi->s_fpg) */
1025static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
1026{
1027 return do_div(b, uspi->s_fpg);
1028}
1029
1016#endif /* __KERNEL__ */ 1030#endif /* __KERNEL__ */
1017 1031
1018#endif /* __LINUX_UFS_FS_H */ 1032#endif /* __LINUX_UFS_FS_H */
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
index f50ce3b0cd52..6496caa82f9e 100644
--- a/include/linux/ufs_fs_i.h
+++ b/include/linux/ufs_fs_i.h
@@ -20,13 +20,12 @@ struct ufs_inode_info {
20 __fs64 u2_i_data[15]; 20 __fs64 u2_i_data[15];
21 } i_u1; 21 } i_u1;
22 __u32 i_flags; 22 __u32 i_flags;
23 __u32 i_gen;
24 __u32 i_shadow; 23 __u32 i_shadow;
25 __u32 i_unused1; 24 __u32 i_unused1;
26 __u32 i_unused2; 25 __u32 i_unused2;
27 __u32 i_oeftflag; 26 __u32 i_oeftflag;
28 __u16 i_osync; 27 __u16 i_osync;
29 __u32 i_lastfrag; 28 __u64 i_lastfrag;
30 __u32 i_dir_start_lookup; 29 __u32 i_dir_start_lookup;
31 struct inode vfs_inode; 30 struct inode vfs_inode;
32}; 31};
diff --git a/include/linux/ufs_fs_sb.h b/include/linux/ufs_fs_sb.h
index 8ff13c160f3d..e114c93fc578 100644
--- a/include/linux/ufs_fs_sb.h
+++ b/include/linux/ufs_fs_sb.h
@@ -21,7 +21,6 @@
21struct ufs_sb_private_info; 21struct ufs_sb_private_info;
22struct ufs_cg_private_info; 22struct ufs_cg_private_info;
23struct ufs_csum; 23struct ufs_csum;
24#define UFS_MAXCSBUFS 31
25 24
26struct ufs_sb_info { 25struct ufs_sb_info {
27 struct ufs_sb_private_info * s_uspi; 26 struct ufs_sb_private_info * s_uspi;
diff --git a/include/linux/usb.h b/include/linux/usb.h
index aab5b1b72021..cfbd2bb8fa2c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -2,7 +2,7 @@
2#define __LINUX_USB_H 2#define __LINUX_USB_H
3 3
4#include <linux/mod_devicetable.h> 4#include <linux/mod_devicetable.h>
5#include <linux/usb_ch9.h> 5#include <linux/usb/ch9.h>
6 6
7#define USB_MAJOR 180 7#define USB_MAJOR 180
8#define USB_DEVICE_MAJOR 189 8#define USB_DEVICE_MAJOR 189
@@ -107,7 +107,8 @@ enum usb_interface_condition {
107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 107 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
108 * capability during autosuspend. 108 * capability during autosuspend.
109 * @dev: driver model's view of this device 109 * @dev: driver model's view of this device
110 * @class_dev: driver model's class view of this device. 110 * @usb_dev: if an interface is bound to the USB major, this will point
111 * to the sysfs representation for that device.
111 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 112 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
112 * allowed unless the counter is 0. 113 * allowed unless the counter is 0.
113 * 114 *
@@ -152,7 +153,7 @@ struct usb_interface {
152 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 153 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
153 154
154 struct device dev; /* interface specific device info */ 155 struct device dev; /* interface specific device info */
155 struct class_device *class_dev; 156 struct device *usb_dev; /* pointer to the usb class's device, if any */
156 int pm_usage_cnt; /* usage counter for autosuspend */ 157 int pm_usage_cnt; /* usage counter for autosuspend */
157}; 158};
158#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 159#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
@@ -298,8 +299,9 @@ struct usb_bus {
298 int bandwidth_int_reqs; /* number of Interrupt requests */ 299 int bandwidth_int_reqs; /* number of Interrupt requests */
299 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 300 int bandwidth_isoc_reqs; /* number of Isoc. requests */
300 301
302#ifdef CONFIG_USB_DEVICEFS
301 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 303 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
302 304#endif
303 struct class_device *class_dev; /* class device for this bus */ 305 struct class_device *class_dev; /* class device for this bus */
304 306
305#if defined(CONFIG_USB_MON) 307#if defined(CONFIG_USB_MON)
@@ -372,9 +374,12 @@ struct usb_device {
372 char *serial; /* iSerialNumber string, if present */ 374 char *serial; /* iSerialNumber string, if present */
373 375
374 struct list_head filelist; 376 struct list_head filelist;
375 struct class_device *class_dev; 377#ifdef CONFIG_USB_DEVICE_CLASS
378 struct device *usb_classdev;
379#endif
380#ifdef CONFIG_USB_DEVICEFS
376 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 381 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
377 382#endif
378 /* 383 /*
379 * Child devices - these can be either new devices 384 * Child devices - these can be either new devices
380 * (if this is a hub device), or different instances 385 * (if this is a hub device), or different instances
@@ -387,12 +392,19 @@ struct usb_device {
387 struct usb_device *children[USB_MAXCHILDREN]; 392 struct usb_device *children[USB_MAXCHILDREN];
388 393
389 int pm_usage_cnt; /* usage counter for autosuspend */ 394 int pm_usage_cnt; /* usage counter for autosuspend */
395 u32 quirks; /* quirks of the whole device */
396
390#ifdef CONFIG_PM 397#ifdef CONFIG_PM
391 struct delayed_work autosuspend; /* for delayed autosuspends */ 398 struct delayed_work autosuspend; /* for delayed autosuspends */
392 struct mutex pm_mutex; /* protects PM operations */ 399 struct mutex pm_mutex; /* protects PM operations */
393 400
401 unsigned long last_busy; /* time of last use */
402 int autosuspend_delay; /* in jiffies */
403
394 unsigned auto_pm:1; /* autosuspend/resume in progress */ 404 unsigned auto_pm:1; /* autosuspend/resume in progress */
395 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 405 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
406 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
407 unsigned autoresume_disabled:1; /* disabled by the user */
396#endif 408#endif
397}; 409};
398#define to_usb_device(d) container_of(d, struct usb_device, dev) 410#define to_usb_device(d) container_of(d, struct usb_device, dev)
@@ -432,6 +444,11 @@ static inline void usb_autopm_disable(struct usb_interface *intf)
432 usb_autopm_set_interface(intf); 444 usb_autopm_set_interface(intf);
433} 445}
434 446
447static inline void usb_mark_last_busy(struct usb_device *udev)
448{
449 udev->last_busy = jiffies;
450}
451
435#else 452#else
436 453
437static inline int usb_autopm_set_interface(struct usb_interface *intf) 454static inline int usb_autopm_set_interface(struct usb_interface *intf)
@@ -446,6 +463,8 @@ static inline void usb_autopm_enable(struct usb_interface *intf)
446{ } 463{ }
447static inline void usb_autopm_disable(struct usb_interface *intf) 464static inline void usb_autopm_disable(struct usb_interface *intf)
448{ } 465{ }
466static inline void usb_mark_last_busy(struct usb_device *udev)
467{ }
449#endif 468#endif
450 469
451/*-------------------------------------------------------------------------*/ 470/*-------------------------------------------------------------------------*/
@@ -475,6 +494,8 @@ extern void usb_driver_release_interface(struct usb_driver *driver,
475 struct usb_interface *iface); 494 struct usb_interface *iface);
476const struct usb_device_id *usb_match_id(struct usb_interface *interface, 495const struct usb_device_id *usb_match_id(struct usb_interface *interface,
477 const struct usb_device_id *id); 496 const struct usb_device_id *id);
497extern int usb_match_one_id(struct usb_interface *interface,
498 const struct usb_device_id *id);
478 499
479extern struct usb_interface *usb_find_interface(struct usb_driver *drv, 500extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
480 int minor); 501 int minor);
@@ -554,6 +575,18 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e
554} 575}
555 576
556/** 577/**
578 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
579 * @epd: endpoint to be checked
580 *
581 * Returns true if the endpoint is of type control, otherwise it returns false.
582 */
583static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd)
584{
585 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
586 USB_ENDPOINT_XFER_CONTROL);
587}
588
589/**
557 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type 590 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
558 * @epd: endpoint to be checked 591 * @epd: endpoint to be checked
559 * 592 *
@@ -723,11 +756,21 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
723 756
724/* ----------------------------------------------------------------------- */ 757/* ----------------------------------------------------------------------- */
725 758
759/* Stuff for dynamic usb ids */
726struct usb_dynids { 760struct usb_dynids {
727 spinlock_t lock; 761 spinlock_t lock;
728 struct list_head list; 762 struct list_head list;
729}; 763};
730 764
765struct usb_dynid {
766 struct list_head node;
767 struct usb_device_id id;
768};
769
770extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
771 struct device_driver *driver,
772 const char *buf, size_t count);
773
731/** 774/**
732 * struct usbdrv_wrap - wrapper for driver-model structure 775 * struct usbdrv_wrap - wrapper for driver-model structure
733 * @driver: The driver-model core driver structure. 776 * @driver: The driver-model core driver structure.
@@ -868,10 +911,11 @@ struct usb_class_driver {
868 * use these in module_init()/module_exit() 911 * use these in module_init()/module_exit()
869 * and don't forget MODULE_DEVICE_TABLE(usb, ...) 912 * and don't forget MODULE_DEVICE_TABLE(usb, ...)
870 */ 913 */
871extern int usb_register_driver(struct usb_driver *, struct module *); 914extern int usb_register_driver(struct usb_driver *, struct module *,
915 const char *);
872static inline int usb_register(struct usb_driver *driver) 916static inline int usb_register(struct usb_driver *driver)
873{ 917{
874 return usb_register_driver(driver, THIS_MODULE); 918 return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
875} 919}
876extern void usb_deregister(struct usb_driver *); 920extern void usb_deregister(struct usb_driver *);
877 921
@@ -909,7 +953,7 @@ struct usb_iso_packet_descriptor {
909 unsigned int offset; 953 unsigned int offset;
910 unsigned int length; /* expected length */ 954 unsigned int length; /* expected length */
911 unsigned int actual_length; 955 unsigned int actual_length;
912 unsigned int status; 956 int status;
913}; 957};
914 958
915struct urb; 959struct urb;
@@ -1085,7 +1129,6 @@ struct urb
1085 struct kref kref; /* reference count of the URB */ 1129 struct kref kref; /* reference count of the URB */
1086 spinlock_t lock; /* lock for the URB */ 1130 spinlock_t lock; /* lock for the URB */
1087 void *hcpriv; /* private data for host controller */ 1131 void *hcpriv; /* private data for host controller */
1088 int bandwidth; /* bandwidth for INT/ISO request */
1089 atomic_t use_count; /* concurrent submissions counter */ 1132 atomic_t use_count; /* concurrent submissions counter */
1090 u8 reject; /* submissions will fail */ 1133 u8 reject; /* submissions will fail */
1091 1134
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
new file mode 100644
index 000000000000..43f160cfe003
--- /dev/null
+++ b/include/linux/usb/Kbuild
@@ -0,0 +1,5 @@
1unifdef-y += audio.h
2unifdef-y += cdc.h
3unifdef-y += ch9.h
4unifdef-y += midi.h
5
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index ba617c372455..2204ae22c381 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -73,6 +73,13 @@ struct usb_cdc_acm_descriptor {
73 __u8 bmCapabilities; 73 __u8 bmCapabilities;
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
76/* capabilities from 5.2.3.3 */
77
78#define USB_CDC_COMM_FEATURE 0x01
79#define USB_CDC_CAP_LINE 0x02
80#define USB_CDC_CAP_BRK 0x04
81#define USB_CDC_CAP_NOTIFY 0x08
82
76/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 83/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
77struct usb_cdc_union_desc { 84struct usb_cdc_union_desc {
78 __u8 bLength; 85 __u8 bLength;
@@ -84,6 +91,17 @@ struct usb_cdc_union_desc {
84 /* ... and there could be other slave interfaces */ 91 /* ... and there could be other slave interfaces */
85} __attribute__ ((packed)); 92} __attribute__ ((packed));
86 93
94/* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */
95struct usb_cdc_country_functional_desc {
96 __u8 bLength;
97 __u8 bDescriptorType;
98 __u8 bDescriptorSubType;
99
100 __u8 iCountryCodeRelDate;
101 __le16 wCountyCode0;
102 /* ... and there can be a lot of country codes */
103} __attribute__ ((packed));
104
87/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ 105/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
88struct usb_cdc_network_terminal_desc { 106struct usb_cdc_network_terminal_desc {
89 __u8 bLength; 107 __u8 bLength;
diff --git a/include/linux/usb_ch9.h b/include/linux/usb/ch9.h
index c720d107ff29..6169438ec5a2 100644
--- a/include/linux/usb_ch9.h
+++ b/include/linux/usb/ch9.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * This file holds USB constants and structures that are needed for USB 2 * This file holds USB constants and structures that are needed for
3 * device APIs. These are used by the USB device model, which is defined 3 * USB device APIs. These are used by the USB device model, which is
4 * in chapter 9 of the USB 2.0 specification. Linux has several APIs in C 4 * defined in chapter 9 of the USB 2.0 specification and in the
5 * that need these: 5 * Wireless USB 1.0 (spread around). Linux has several APIs in C that
6 * need these:
6 * 7 *
7 * - the master/host side Linux-USB kernel driver API; 8 * - the master/host side Linux-USB kernel driver API;
8 * - the "usbfs" user space API; and 9 * - the "usbfs" user space API; and
@@ -14,6 +15,19 @@
14 * 15 *
15 * There's also "Wireless USB", using low power short range radios for 16 * There's also "Wireless USB", using low power short range radios for
16 * peripheral interconnection but otherwise building on the USB framework. 17 * peripheral interconnection but otherwise building on the USB framework.
18 *
19 * Note all descriptors are declared '__attribute__((packed))' so that:
20 *
21 * [a] they never get padded, either internally (USB spec writers
22 * probably handled that) or externally;
23 *
24 * [b] so that accessing bigger-than-a-bytes fields will never
25 * generate bus errors on any platform, even when the location of
26 * its descriptor inside a bundle isn't "naturally aligned", and
27 *
28 * [c] for consistency, removing all doubt even when it appears to
29 * someone that the two other points are non-issues for that
30 * particular descriptor type.
17 */ 31 */
18 32
19#ifndef __LINUX_USB_CH9_H 33#ifndef __LINUX_USB_CH9_H
@@ -167,12 +181,15 @@ struct usb_ctrlrequest {
167#define USB_DT_WIRE_ADAPTER 0x21 181#define USB_DT_WIRE_ADAPTER 0x21
168#define USB_DT_RPIPE 0x22 182#define USB_DT_RPIPE 0x22
169 183
170/* conventional codes for class-specific descriptors */ 184/* Conventional codes for class-specific descriptors. The convention is
171#define USB_DT_CS_DEVICE 0x21 185 * defined in the USB "Common Class" Spec (3.11). Individual class specs
172#define USB_DT_CS_CONFIG 0x22 186 * are authoritative for their usage, not the "common class" writeup.
173#define USB_DT_CS_STRING 0x23 187 */
174#define USB_DT_CS_INTERFACE 0x24 188#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
175#define USB_DT_CS_ENDPOINT 0x25 189#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
190#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
191#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
192#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
176 193
177/* All standard descriptors have these 2 fields at the beginning */ 194/* All standard descriptors have these 2 fields at the beginning */
178struct usb_descriptor_header { 195struct usb_descriptor_header {
@@ -224,6 +241,7 @@ struct usb_device_descriptor {
224#define USB_CLASS_CONTENT_SEC 0x0d /* content security */ 241#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
225#define USB_CLASS_VIDEO 0x0e 242#define USB_CLASS_VIDEO 0x0e
226#define USB_CLASS_WIRELESS_CONTROLLER 0xe0 243#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
244#define USB_CLASS_MISC 0xef
227#define USB_CLASS_APP_SPEC 0xfe 245#define USB_CLASS_APP_SPEC 0xfe
228#define USB_CLASS_VENDOR_SPEC 0xff 246#define USB_CLASS_VENDOR_SPEC 0xff
229 247
@@ -366,7 +384,7 @@ struct usb_debug_descriptor {
366 /* bulk endpoints with 8 byte maxpacket */ 384 /* bulk endpoints with 8 byte maxpacket */
367 __u8 bDebugInEndpoint; 385 __u8 bDebugInEndpoint;
368 __u8 bDebugOutEndpoint; 386 __u8 bDebugOutEndpoint;
369}; 387} __attribute__((packed));
370 388
371/*-------------------------------------------------------------------------*/ 389/*-------------------------------------------------------------------------*/
372 390
@@ -395,7 +413,7 @@ struct usb_security_descriptor {
395 413
396 __le16 wTotalLength; 414 __le16 wTotalLength;
397 __u8 bNumEncryptionTypes; 415 __u8 bNumEncryptionTypes;
398}; 416} __attribute__((packed));
399 417
400/*-------------------------------------------------------------------------*/ 418/*-------------------------------------------------------------------------*/
401 419
@@ -409,7 +427,7 @@ struct usb_key_descriptor {
409 __u8 tTKID[3]; 427 __u8 tTKID[3];
410 __u8 bReserved; 428 __u8 bReserved;
411 __u8 bKeyData[0]; 429 __u8 bKeyData[0];
412}; 430} __attribute__((packed));
413 431
414/*-------------------------------------------------------------------------*/ 432/*-------------------------------------------------------------------------*/
415 433
@@ -425,7 +443,7 @@ struct usb_encryption_descriptor {
425#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ 443#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
426 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ 444 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
427 __u8 bAuthKeyIndex; 445 __u8 bAuthKeyIndex;
428}; 446} __attribute__((packed));
429 447
430 448
431/*-------------------------------------------------------------------------*/ 449/*-------------------------------------------------------------------------*/
@@ -437,7 +455,7 @@ struct usb_bos_descriptor {
437 455
438 __le16 wTotalLength; 456 __le16 wTotalLength;
439 __u8 bNumDeviceCaps; 457 __u8 bNumDeviceCaps;
440}; 458} __attribute__((packed));
441 459
442/*-------------------------------------------------------------------------*/ 460/*-------------------------------------------------------------------------*/
443 461
@@ -446,7 +464,7 @@ struct usb_dev_cap_header {
446 __u8 bLength; 464 __u8 bLength;
447 __u8 bDescriptorType; 465 __u8 bDescriptorType;
448 __u8 bDevCapabilityType; 466 __u8 bDevCapabilityType;
449}; 467} __attribute__((packed));
450 468
451#define USB_CAP_TYPE_WIRELESS_USB 1 469#define USB_CAP_TYPE_WIRELESS_USB 1
452 470
@@ -474,7 +492,7 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
474 __u8 bmFFITXPowerInfo; /* FFI power levels */ 492 __u8 bmFFITXPowerInfo; /* FFI power levels */
475 __le16 bmBandGroup; 493 __le16 bmBandGroup;
476 __u8 bReserved; 494 __u8 bReserved;
477}; 495} __attribute__((packed));
478 496
479/*-------------------------------------------------------------------------*/ 497/*-------------------------------------------------------------------------*/
480 498
@@ -495,7 +513,7 @@ struct usb_wireless_ep_comp_descriptor {
495#define USB_ENDPOINT_SWITCH_NO 0 513#define USB_ENDPOINT_SWITCH_NO 0
496#define USB_ENDPOINT_SWITCH_SWITCH 1 514#define USB_ENDPOINT_SWITCH_SWITCH 1
497#define USB_ENDPOINT_SWITCH_SCALE 2 515#define USB_ENDPOINT_SWITCH_SCALE 2
498}; 516} __attribute__((packed));
499 517
500/*-------------------------------------------------------------------------*/ 518/*-------------------------------------------------------------------------*/
501 519
@@ -511,7 +529,7 @@ struct usb_handshake {
511 __u8 CDID[16]; 529 __u8 CDID[16];
512 __u8 nonce[16]; 530 __u8 nonce[16];
513 __u8 MIC[8]; 531 __u8 MIC[8];
514}; 532} __attribute__((packed));
515 533
516/*-------------------------------------------------------------------------*/ 534/*-------------------------------------------------------------------------*/
517 535
@@ -523,7 +541,7 @@ struct usb_connection_context {
523 __u8 CHID[16]; /* persistent host id */ 541 __u8 CHID[16]; /* persistent host id */
524 __u8 CDID[16]; /* device id (unique w/in host context) */ 542 __u8 CDID[16]; /* device id (unique w/in host context) */
525 __u8 CK[16]; /* connection key */ 543 __u8 CK[16]; /* connection key */
526}; 544} __attribute__((packed));
527 545
528/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
529 547
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
new file mode 100644
index 000000000000..cbbe020a4f5c
--- /dev/null
+++ b/include/linux/usb/iowarrior.h
@@ -0,0 +1,33 @@
1#ifndef _IOWARRIOR_H_
2#define _IOWARRIOR_H_
3
4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
5
6/* Define the ioctl commands for reading and writing data */
7#define IOW_WRITE _IOW(CODEMERCS_MAGIC_NUMBER, 1, __u8 *)
8#define IOW_READ _IOW(CODEMERCS_MAGIC_NUMBER, 2, __u8 *)
9
10/*
11 A struct for available device info which is read
12 with the ioctl IOW_GETINFO.
13 To be compatible with 2.4 userspace which didn't have an easy way to get
14 this information.
15*/
16struct iowarrior_info {
17 __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18 __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
19 __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
20 __u32 revision; /* revision number of the chip */
21 __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
22 __u32 power; /* power consumption of the device in mA */
23 __u32 if_num; /* the number of the endpoint */
24 __u32 report_size; /* size of the data-packets on this interface */
25};
26
27/*
28 Get some device-information (product-id , serial-number etc.)
29 in order to identify a chip.
30*/
31#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
32
33#endif /* _IOWARRIOR_H_ */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
new file mode 100644
index 000000000000..6bac8faacbc6
--- /dev/null
+++ b/include/linux/usb/quirks.h
@@ -0,0 +1,11 @@
1/*
2 * This file holds the definitions of quirks found in USB devices.
3 * Only quirks that affect the whole device, not an interface,
4 * belong here.
5 */
6
7/* device must not be autosuspended */
8#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
9
10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000002
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 10f99e5f1a97..32acbae28d24 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -54,6 +54,8 @@
54 * @write_wait: a wait_queue_head_t used by the port. 54 * @write_wait: a wait_queue_head_t used by the port.
55 * @work: work queue entry for the line discipline waking up. 55 * @work: work queue entry for the line discipline waking up.
56 * @open_count: number of times this port has been opened. 56 * @open_count: number of times this port has been opened.
57 * @throttled: nonzero if the read urb is inactive to throttle the device
58 * @throttle_req: nonzero if the tty wants to throttle us
57 * 59 *
58 * This structure is used by the usb-serial core and drivers for the specific 60 * This structure is used by the usb-serial core and drivers for the specific
59 * ports of a device. 61 * ports of a device.
@@ -88,6 +90,8 @@ struct usb_serial_port {
88 wait_queue_head_t write_wait; 90 wait_queue_head_t write_wait;
89 struct work_struct work; 91 struct work_struct work;
90 int open_count; 92 int open_count;
93 char throttled;
94 char throttle_req;
91 struct device dev; 95 struct device dev;
92}; 96};
93#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 97#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
@@ -179,6 +183,9 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
179 * memory structure allocation at this point in time. 183 * memory structure allocation at this point in time.
180 * @shutdown: pointer to the driver's shutdown function. This will be 184 * @shutdown: pointer to the driver's shutdown function. This will be
181 * called when the device is removed from the system. 185 * called when the device is removed from the system.
186 * @usb_driver: pointer to the struct usb_driver that controls this
187 * device. This is necessary to allow dynamic ids to be added to
188 * the driver from sysfs.
182 * 189 *
183 * This structure is defines a USB Serial driver. It provides all of 190 * 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 191 * the information that the USB serial core code needs. If the function
@@ -202,6 +209,8 @@ struct usb_serial_driver {
202 209
203 struct list_head driver_list; 210 struct list_head driver_list;
204 struct device_driver driver; 211 struct device_driver driver;
212 struct usb_driver *usb_driver;
213 struct usb_dynids dynids;
205 214
206 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); 215 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id);
207 int (*attach) (struct usb_serial *serial); 216 int (*attach) (struct usb_serial *serial);
@@ -264,6 +273,8 @@ extern int usb_serial_generic_write_room (struct usb_serial_port *port);
264extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); 273extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
265extern void usb_serial_generic_read_bulk_callback (struct urb *urb); 274extern void usb_serial_generic_read_bulk_callback (struct urb *urb);
266extern void usb_serial_generic_write_bulk_callback (struct urb *urb); 275extern void usb_serial_generic_write_bulk_callback (struct urb *urb);
276extern void usb_serial_generic_throttle (struct usb_serial_port *port);
277extern void usb_serial_generic_unthrottle (struct usb_serial_port *port);
267extern void usb_serial_generic_shutdown (struct usb_serial *serial); 278extern void usb_serial_generic_shutdown (struct usb_serial *serial);
268extern int usb_serial_generic_register (int debug); 279extern int usb_serial_generic_register (int debug);
269extern void usb_serial_generic_deregister (void); 280extern void usb_serial_generic_deregister (void);
diff --git a/include/linux/usb_gadgetfs.h b/include/linux/usb_gadgetfs.h
index b53d6ae8e55e..8086d5a9b94e 100644
--- a/include/linux/usb_gadgetfs.h
+++ b/include/linux/usb_gadgetfs.h
@@ -2,7 +2,7 @@
2#include <asm/types.h> 2#include <asm/types.h>
3#include <asm/ioctl.h> 3#include <asm/ioctl.h>
4 4
5#include <linux/usb_ch9.h> 5#include <linux/usb/ch9.h>
6 6
7/* 7/*
8 * Filesystem based user-mode API to USB Gadget controller hardware 8 * Filesystem based user-mode API to USB Gadget controller hardware
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 2ae76fe52ff7..1b792b9286ba 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -46,7 +46,9 @@
46 US_FLAG(MAX_SECTORS_64, 0x00000400) \ 46 US_FLAG(MAX_SECTORS_64, 0x00000400) \
47 /* Sets max_sectors to 64 */ \ 47 /* Sets max_sectors to 64 */ \
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \ 48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */ 49 /* Don't claim device */ \
50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
51 /* sometimes sizes is too big */
50 52
51#define US_FLAG(name, value) US_FL_##name = value , 53#define US_FLAG(name, value) US_FL_##name = value ,
52enum { US_DO_ALL_FLAGS }; 54enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 617d8a1c59ae..342dd5a7e8bb 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -159,9 +159,9 @@ struct usbdevfs_ioctl32 {
159#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) 159#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
160#define USBDEVFS_DISCARDURB _IO('U', 11) 160#define USBDEVFS_DISCARDURB _IO('U', 11)
161#define USBDEVFS_REAPURB _IOW('U', 12, void *) 161#define USBDEVFS_REAPURB _IOW('U', 12, void *)
162#define USBDEVFS_REAPURB32 _IOW('U', 12, u32) 162#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
163#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) 163#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
164#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, u32) 164#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
165#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) 165#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
166#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) 166#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
167#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) 167#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index a4555fe3754c..e10267d402c5 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsigned long unshare_flags,
70 70
71static inline int copy_utsname(int flags, struct task_struct *tsk) 71static inline int copy_utsname(int flags, struct task_struct *tsk)
72{ 72{
73 if (flags & CLONE_NEWUTS)
74 return -EINVAL;
73 return 0; 75 return 0;
74} 76}
75static inline void put_uts_ns(struct uts_namespace *ns) 77static inline void put_uts_ns(struct uts_namespace *ns)
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
new file mode 100644
index 000000000000..e63e0c03ee0d
--- /dev/null
+++ b/include/linux/video_output.h
@@ -0,0 +1,42 @@
1/*
2 *
3 * Copyright (C) 2006 Luming Yu <luming.yu@intel.com>
4 *
5 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 (at
10 * your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23#ifndef _LINUX_VIDEO_OUTPUT_H
24#define _LINUX_VIDEO_OUTPUT_H
25#include <linux/device.h>
26struct output_device;
27struct output_properties {
28 int (*set_state)(struct output_device *);
29 int (*get_status)(struct output_device *);
30};
31struct output_device {
32 int request_state;
33 struct output_properties *props;
34 struct class_device class_dev;
35};
36#define to_output_device(obj) container_of(obj, struct output_device, class_dev)
37struct output_device *video_output_register(const char *name,
38 struct device *dev,
39 void *devdata,
40 struct output_properties *op);
41void video_output_unregister(struct output_device *dev);
42#endif
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index d94e2683be52..a25c2afa67e1 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,5 +1,45 @@
1/* 1/*
2 * Video for Linux Two 2 * Video for Linux Two header file
3 *
4 * Copyright (C) 1999-2007 the contributors
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 * Alternatively you can redistribute this file under the terms of the
17 * BSD license as stated below:
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in
26 * the documentation and/or other materials provided with the
27 * distribution.
28 * 3. The names of its contributors may not be used to endorse or promote
29 * products derived from this software without specific prior written
30 * permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 * 43 *
4 * Header file for v4l or V4L2 drivers and applications 44 * Header file for v4l or V4L2 drivers and applications
5 * with public API. 45 * with public API.
@@ -8,8 +48,9 @@
8 * 48 *
9 * See http://linuxtv.org for more info 49 * See http://linuxtv.org for more info
10 * 50 *
11 * Author: Bill Dirks <bdirks@pacbell.net> 51 * Author: Bill Dirks <bill@thedirks.org>
12 * Justin Schoeman 52 * Justin Schoeman
53 * Hans Verkuil <hverkuil@xs4all.nl>
13 * et al. 54 * et al.
14 */ 55 */
15#ifndef __LINUX_VIDEODEV2_H 56#ifndef __LINUX_VIDEODEV2_H
@@ -55,47 +96,60 @@
55 * E N U M S 96 * E N U M S
56 */ 97 */
57enum v4l2_field { 98enum v4l2_field {
58 V4L2_FIELD_ANY = 0, /* driver can choose from none, 99 V4L2_FIELD_ANY = 0, /* driver can choose from none,
59 top, bottom, interlaced 100 top, bottom, interlaced
60 depending on whatever it thinks 101 depending on whatever it thinks
61 is approximate ... */ 102 is approximate ... */
62 V4L2_FIELD_NONE = 1, /* this device has no fields ... */ 103 V4L2_FIELD_NONE = 1, /* this device has no fields ... */
63 V4L2_FIELD_TOP = 2, /* top field only */ 104 V4L2_FIELD_TOP = 2, /* top field only */
64 V4L2_FIELD_BOTTOM = 3, /* bottom field only */ 105 V4L2_FIELD_BOTTOM = 3, /* bottom field only */
65 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ 106 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
66 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one 107 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
67 buffer, top-bottom order */ 108 buffer, top-bottom order */
68 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ 109 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
69 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into 110 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
70 separate buffers */ 111 separate buffers */
112 V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
113 first and the top field is
114 transmitted first */
115 V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
116 first and the bottom field is
117 transmitted first */
71}; 118};
72#define V4L2_FIELD_HAS_TOP(field) \ 119#define V4L2_FIELD_HAS_TOP(field) \
73 ((field) == V4L2_FIELD_TOP ||\ 120 ((field) == V4L2_FIELD_TOP ||\
74 (field) == V4L2_FIELD_INTERLACED ||\ 121 (field) == V4L2_FIELD_INTERLACED ||\
122 (field) == V4L2_FIELD_INTERLACED_TB ||\
123 (field) == V4L2_FIELD_INTERLACED_BT ||\
75 (field) == V4L2_FIELD_SEQ_TB ||\ 124 (field) == V4L2_FIELD_SEQ_TB ||\
76 (field) == V4L2_FIELD_SEQ_BT) 125 (field) == V4L2_FIELD_SEQ_BT)
77#define V4L2_FIELD_HAS_BOTTOM(field) \ 126#define V4L2_FIELD_HAS_BOTTOM(field) \
78 ((field) == V4L2_FIELD_BOTTOM ||\ 127 ((field) == V4L2_FIELD_BOTTOM ||\
79 (field) == V4L2_FIELD_INTERLACED ||\ 128 (field) == V4L2_FIELD_INTERLACED ||\
129 (field) == V4L2_FIELD_INTERLACED_TB ||\
130 (field) == V4L2_FIELD_INTERLACED_BT ||\
80 (field) == V4L2_FIELD_SEQ_TB ||\ 131 (field) == V4L2_FIELD_SEQ_TB ||\
81 (field) == V4L2_FIELD_SEQ_BT) 132 (field) == V4L2_FIELD_SEQ_BT)
82#define V4L2_FIELD_HAS_BOTH(field) \ 133#define V4L2_FIELD_HAS_BOTH(field) \
83 ((field) == V4L2_FIELD_INTERLACED ||\ 134 ((field) == V4L2_FIELD_INTERLACED ||\
84 (field) == V4L2_FIELD_SEQ_TB ||\ 135 (field) == V4L2_FIELD_INTERLACED_TB ||\
136 (field) == V4L2_FIELD_INTERLACED_BT ||\
137 (field) == V4L2_FIELD_SEQ_TB ||\
85 (field) == V4L2_FIELD_SEQ_BT) 138 (field) == V4L2_FIELD_SEQ_BT)
86 139
87enum v4l2_buf_type { 140enum v4l2_buf_type {
88 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, 141 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
89 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, 142 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
90 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, 143 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
91 V4L2_BUF_TYPE_VBI_CAPTURE = 4, 144 V4L2_BUF_TYPE_VBI_CAPTURE = 4,
92 V4L2_BUF_TYPE_VBI_OUTPUT = 5, 145 V4L2_BUF_TYPE_VBI_OUTPUT = 5,
146 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
147 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
93#if 1 148#if 1
94 /* Experimental Sliced VBI */ 149 /* Experimental */
95 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, 150 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
96 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
97#endif 151#endif
98 V4L2_BUF_TYPE_PRIVATE = 0x80, 152 V4L2_BUF_TYPE_PRIVATE = 0x80,
99}; 153};
100 154
101enum v4l2_ctrl_type { 155enum v4l2_ctrl_type {
@@ -186,11 +240,11 @@ struct v4l2_capability
186#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ 240#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
187#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ 241#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
188#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ 242#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
189#if 1
190#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ 243#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
191#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ 244#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
192#endif
193#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ 245#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
246#define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */
247#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */
194 248
195#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 249#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
196#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 250#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
@@ -213,6 +267,8 @@ struct v4l2_pix_format
213 __u32 sizeimage; 267 __u32 sizeimage;
214 enum v4l2_colorspace colorspace; 268 enum v4l2_colorspace colorspace;
215 __u32 priv; /* private data, depends on pixelformat */ 269 __u32 priv; /* private data, depends on pixelformat */
270 __u32 left; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
271 __u32 top; /* only valid if V4L2_CAP_VIDEO_OUTPUT_POS is set */
216}; 272};
217 273
218/* Pixel format FOURCC depth Description */ 274/* Pixel format FOURCC depth Description */
@@ -560,10 +616,14 @@ struct v4l2_framebuffer
560#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 616#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
561#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 617#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
562#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 618#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
619#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
620#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
563/* Flags for the 'flags' field. */ 621/* Flags for the 'flags' field. */
564#define V4L2_FBUF_FLAG_PRIMARY 0x0001 622#define V4L2_FBUF_FLAG_PRIMARY 0x0001
565#define V4L2_FBUF_FLAG_OVERLAY 0x0002 623#define V4L2_FBUF_FLAG_OVERLAY 0x0002
566#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 624#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
625#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
626#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
567 627
568struct v4l2_clip 628struct v4l2_clip
569{ 629{
@@ -579,6 +639,7 @@ struct v4l2_window
579 struct v4l2_clip __user *clips; 639 struct v4l2_clip __user *clips;
580 __u32 clipcount; 640 __u32 clipcount;
581 void __user *bitmap; 641 void __user *bitmap;
642 __u8 global_alpha;
582}; 643};
583 644
584/* 645/*
@@ -1001,6 +1062,7 @@ enum v4l2_mpeg_audio_crc {
1001 V4L2_MPEG_AUDIO_CRC_NONE = 0, 1062 V4L2_MPEG_AUDIO_CRC_NONE = 0,
1002 V4L2_MPEG_AUDIO_CRC_CRC16 = 1, 1063 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
1003}; 1064};
1065#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
1004 1066
1005/* MPEG video */ 1067/* MPEG video */
1006#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1068#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
@@ -1027,6 +1089,8 @@ enum v4l2_mpeg_video_bitrate_mode {
1027#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) 1089#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
1028#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) 1090#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
1029#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) 1091#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1092#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1093#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1030 1094
1031/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ 1095/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */
1032#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 1096#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -1067,6 +1131,7 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
1067#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) 1131#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
1068#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) 1132#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
1069#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) 1133#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1134#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1070 1135
1071/* 1136/*
1072 * T U N I N G 1137 * T U N I N G
@@ -1157,6 +1222,55 @@ struct v4l2_audioout
1157}; 1222};
1158 1223
1159/* 1224/*
1225 * M P E G S E R V I C E S
1226 *
1227 * NOTE: EXPERIMENTAL API
1228 */
1229#if 1
1230#define V4L2_ENC_IDX_FRAME_I (0)
1231#define V4L2_ENC_IDX_FRAME_P (1)
1232#define V4L2_ENC_IDX_FRAME_B (2)
1233#define V4L2_ENC_IDX_FRAME_MASK (0xf)
1234
1235struct v4l2_enc_idx_entry {
1236 __u64 offset;
1237 __u64 pts;
1238 __u32 length;
1239 __u32 flags;
1240 __u32 reserved[2];
1241};
1242
1243#define V4L2_ENC_IDX_ENTRIES (64)
1244struct v4l2_enc_idx {
1245 __u32 entries;
1246 __u32 entries_cap;
1247 __u32 reserved[4];
1248 struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
1249};
1250
1251
1252#define V4L2_ENC_CMD_START (0)
1253#define V4L2_ENC_CMD_STOP (1)
1254#define V4L2_ENC_CMD_PAUSE (2)
1255#define V4L2_ENC_CMD_RESUME (3)
1256
1257/* Flags for V4L2_ENC_CMD_STOP */
1258#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
1259
1260struct v4l2_encoder_cmd {
1261 __u32 cmd;
1262 __u32 flags;
1263 union {
1264 struct {
1265 __u32 data[8];
1266 } raw;
1267 };
1268};
1269
1270#endif
1271
1272
1273/*
1160 * D A T A S E R V I C E S ( V B I ) 1274 * D A T A S E R V I C E S ( V B I )
1161 * 1275 *
1162 * Data services API by Michael Schimek 1276 * Data services API by Michael Schimek
@@ -1179,7 +1293,6 @@ struct v4l2_vbi_format
1179#define V4L2_VBI_UNSYNC (1<< 0) 1293#define V4L2_VBI_UNSYNC (1<< 0)
1180#define V4L2_VBI_INTERLACED (1<< 1) 1294#define V4L2_VBI_INTERLACED (1<< 1)
1181 1295
1182#if 1
1183/* Sliced VBI 1296/* Sliced VBI
1184 * 1297 *
1185 * This implements is a proposal V4L2 API to allow SLICED VBI 1298 * This implements is a proposal V4L2 API to allow SLICED VBI
@@ -1212,7 +1325,6 @@ struct v4l2_sliced_vbi_format
1212#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 1325#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
1213#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 1326#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1214 1327
1215
1216struct v4l2_sliced_vbi_cap 1328struct v4l2_sliced_vbi_cap
1217{ 1329{
1218 __u16 service_set; 1330 __u16 service_set;
@@ -1233,7 +1345,6 @@ struct v4l2_sliced_vbi_data
1233 __u32 reserved; /* must be 0 */ 1345 __u32 reserved; /* must be 0 */
1234 __u8 data[48]; 1346 __u8 data[48];
1235}; 1347};
1236#endif
1237 1348
1238/* 1349/*
1239 * A G G R E G A T E S T R U C T U R E S 1350 * A G G R E G A T E S T R U C T U R E S
@@ -1249,9 +1360,7 @@ struct v4l2_format
1249 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 1360 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE
1250 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 1361 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY
1251 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 1362 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE
1252#if 1
1253 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 1363 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
1254#endif
1255 __u8 raw_data[200]; // user-defined 1364 __u8 raw_data[200]; // user-defined
1256 } fmt; 1365 } fmt;
1257}; 1366};
@@ -1271,6 +1380,33 @@ struct v4l2_streamparm
1271}; 1380};
1272 1381
1273/* 1382/*
1383 * A D V A N C E D D E B U G G I N G
1384 *
1385 * NOTE: EXPERIMENTAL API
1386 */
1387
1388/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1389
1390#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
1391#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */
1392#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1393
1394struct v4l2_register {
1395 __u32 match_type; /* Match type */
1396 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1397 __u64 reg;
1398 __u64 val;
1399};
1400
1401/* VIDIOC_G_CHIP_IDENT */
1402struct v4l2_chip_ident {
1403 __u32 match_type; /* Match type */
1404 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1405 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1406 __u32 revision; /* chip revision, chip specific */
1407};
1408
1409/*
1274 * I O C T L C O D E S F O R V I D E O D E V I C E S 1410 * I O C T L C O D E S F O R V I D E O D E V I C E S
1275 * 1411 *
1276 */ 1412 */
@@ -1328,9 +1464,7 @@ struct v4l2_streamparm
1328#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) 1464#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout)
1329#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1465#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority)
1330#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1466#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority)
1331#if 1
1332#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) 1467#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap)
1333#endif
1334#define VIDIOC_LOG_STATUS _IO ('V', 70) 1468#define VIDIOC_LOG_STATUS _IO ('V', 70)
1335#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1469#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
1336#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1470#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls)
@@ -1338,6 +1472,15 @@ struct v4l2_streamparm
1338#if 1 1472#if 1
1339#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1473#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
1340#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1474#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
1475#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx)
1476#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd)
1477#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd)
1478
1479/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1480#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register)
1481#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register)
1482
1483#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident)
1341#endif 1484#endif
1342 1485
1343#ifdef __OLD_VIDIOC_ 1486#ifdef __OLD_VIDIOC_
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 5e9803ed17fc..acb1f105870c 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -3,20 +3,15 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <linux/mm.h>
6#include <linux/mmzone.h> 7#include <linux/mmzone.h>
7#include <asm/atomic.h> 8#include <asm/atomic.h>
8 9
9#ifdef CONFIG_VM_EVENT_COUNTERS 10#ifdef CONFIG_ZONE_DMA
10/* 11#define DMA_ZONE(xx) xx##_DMA,
11 * Light weight per cpu counter implementation. 12#else
12 * 13#define DMA_ZONE(xx)
13 * Counters should only be incremented. You need to set EMBEDDED 14#endif
14 * to disable VM_EVENT_COUNTERS. Things like procps (vmstat,
15 * top, etc) use /proc/vmstat and depend on these counters.
16 *
17 * Counters are handled completely inline. On many platforms the code
18 * generated will simply be the increment of a global address.
19 */
20 15
21#ifdef CONFIG_ZONE_DMA32 16#ifdef CONFIG_ZONE_DMA32
22#define DMA32_ZONE(xx) xx##_DMA32, 17#define DMA32_ZONE(xx) xx##_DMA32,
@@ -30,7 +25,7 @@
30#define HIGHMEM_ZONE(xx) 25#define HIGHMEM_ZONE(xx)
31#endif 26#endif
32 27
33#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) 28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
34 29
35enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36 FOR_ALL_ZONES(PGALLOC), 31 FOR_ALL_ZONES(PGALLOC),
@@ -45,6 +40,17 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
45 NR_VM_EVENT_ITEMS 40 NR_VM_EVENT_ITEMS
46}; 41};
47 42
43#ifdef CONFIG_VM_EVENT_COUNTERS
44/*
45 * Light weight per cpu counter implementation.
46 *
47 * Counters should only be incremented and no critical kernel component
48 * should rely on the counter values.
49 *
50 * Counters are handled completely inline. On many platforms the code
51 * generated will simply be the increment of a global address.
52 */
53
48struct vm_event_state { 54struct vm_event_state {
49 unsigned long event[NR_VM_EVENT_ITEMS]; 55 unsigned long event[NR_VM_EVENT_ITEMS];
50}; 56};
@@ -85,17 +91,30 @@ static inline void vm_events_fold_cpu(int cpu)
85#else 91#else
86 92
87/* Disable counters */ 93/* Disable counters */
88#define get_cpu_vm_events(e) 0L 94static inline void count_vm_event(enum vm_event_item item)
89#define count_vm_event(e) do { } while (0) 95{
90#define count_vm_events(e,d) do { } while (0) 96}
91#define __count_vm_event(e) do { } while (0) 97static inline void count_vm_events(enum vm_event_item item, long delta)
92#define __count_vm_events(e,d) do { } while (0) 98{
93#define vm_events_fold_cpu(x) do { } while (0) 99}
100static inline void __count_vm_event(enum vm_event_item item)
101{
102}
103static inline void __count_vm_events(enum vm_event_item item, long delta)
104{
105}
106static inline void all_vm_events(unsigned long *ret)
107{
108}
109static inline void vm_events_fold_cpu(int cpu)
110{
111}
94 112
95#endif /* CONFIG_VM_EVENT_COUNTERS */ 113#endif /* CONFIG_VM_EVENT_COUNTERS */
96 114
97#define __count_zone_vm_events(item, zone, delta) \ 115#define __count_zone_vm_events(item, zone, delta) \
98 __count_vm_events(item##_DMA + zone_idx(zone), delta) 116 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
117 zone_idx(zone), delta)
99 118
100/* 119/*
101 * Zone based page accounting with per cpu differentials. 120 * Zone based page accounting with per cpu differentials.
@@ -142,14 +161,16 @@ static inline unsigned long node_page_state(int node,
142 struct zone *zones = NODE_DATA(node)->node_zones; 161 struct zone *zones = NODE_DATA(node)->node_zones;
143 162
144 return 163 return
164#ifdef CONFIG_ZONE_DMA
165 zone_page_state(&zones[ZONE_DMA], item) +
166#endif
145#ifdef CONFIG_ZONE_DMA32 167#ifdef CONFIG_ZONE_DMA32
146 zone_page_state(&zones[ZONE_DMA32], item) + 168 zone_page_state(&zones[ZONE_DMA32], item) +
147#endif 169#endif
148 zone_page_state(&zones[ZONE_NORMAL], item) +
149#ifdef CONFIG_HIGHMEM 170#ifdef CONFIG_HIGHMEM
150 zone_page_state(&zones[ZONE_HIGHMEM], item) + 171 zone_page_state(&zones[ZONE_HIGHMEM], item) +
151#endif 172#endif
152 zone_page_state(&zones[ZONE_DMA], item); 173 zone_page_state(&zones[ZONE_NORMAL], item);
153} 174}
154 175
155extern void zone_statistics(struct zonelist *, struct zone *); 176extern void zone_statistics(struct zonelist *, struct zone *);
@@ -186,6 +207,9 @@ void inc_zone_page_state(struct page *, enum zone_stat_item);
186void dec_zone_page_state(struct page *, enum zone_stat_item); 207void dec_zone_page_state(struct page *, enum zone_stat_item);
187 208
188extern void inc_zone_state(struct zone *, enum zone_stat_item); 209extern void inc_zone_state(struct zone *, enum zone_stat_item);
210extern void __inc_zone_state(struct zone *, enum zone_stat_item);
211extern void dec_zone_state(struct zone *, enum zone_stat_item);
212extern void __dec_zone_state(struct zone *, enum zone_stat_item);
189 213
190void refresh_cpu_vm_stats(int); 214void refresh_cpu_vm_stats(int);
191void refresh_vm_stats(void); 215void refresh_vm_stats(void);
@@ -214,6 +238,12 @@ static inline void __inc_zone_page_state(struct page *page,
214 __inc_zone_state(page_zone(page), item); 238 __inc_zone_state(page_zone(page), item);
215} 239}
216 240
241static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
242{
243 atomic_long_dec(&zone->vm_stat[item]);
244 atomic_long_dec(&vm_stat[item]);
245}
246
217static inline void __dec_zone_page_state(struct page *page, 247static inline void __dec_zone_page_state(struct page *page,
218 enum zone_stat_item item) 248 enum zone_stat_item item)
219{ 249{
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 37a1a41f5b65..e0db669998f3 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -83,6 +83,7 @@ void reset_vc(struct vc_data *vc);
83#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE) 83#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
84extern char con_buf[CON_BUF_SIZE]; 84extern char con_buf[CON_BUF_SIZE];
85extern struct semaphore con_buf_sem; 85extern struct semaphore con_buf_sem;
86extern char vt_dont_switch;
86 87
87struct vt_spawn_console { 88struct vt_spawn_console {
88 spinlock_t lock; 89 spinlock_t lock;
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index 2cd05013edfc..3add87465b1f 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -516,9 +516,6 @@ struct wan_device {
516/* Public functions available for device drivers */ 516/* Public functions available for device drivers */
517extern int register_wan_device(struct wan_device *wandev); 517extern int register_wan_device(struct wan_device *wandev);
518extern int unregister_wan_device(char *name); 518extern int unregister_wan_device(char *name);
519__be16 wanrouter_type_trans(struct sk_buff *skb, struct net_device *dev);
520int wanrouter_encapsulate(struct sk_buff *skb, struct net_device *dev,
521 unsigned short type);
522 519
523/* Proc interface functions. These must not be called by the drivers! */ 520/* Proc interface functions. These must not be called by the drivers! */
524extern int wanrouter_proc_init(void); 521extern int wanrouter_proc_init(void);
@@ -527,11 +524,6 @@ extern int wanrouter_proc_add(struct wan_device *wandev);
527extern int wanrouter_proc_delete(struct wan_device *wandev); 524extern int wanrouter_proc_delete(struct wan_device *wandev);
528extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); 525extern int wanrouter_ioctl( struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
529 526
530extern void lock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
531extern void unlock_adapter_irq(spinlock_t *lock, unsigned long *smp_flags);
532
533
534
535/* Public Data */ 527/* Public Data */
536/* list of registered devices */ 528/* list of registered devices */
537extern struct wan_device *wanrouter_router_devlist; 529extern struct wan_device *wanrouter_router_devlist;
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 7c269f4992eb..0987aa7a6cf5 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
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 : 21 14.3.06 4 * Version : 22 16.3.07
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-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -85,7 +85,7 @@
85 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
86 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
87 */ 87 */
88#define WIRELESS_EXT 21 88#define WIRELESS_EXT 22
89 89
90/* 90/*
91 * Changes : 91 * Changes :
@@ -186,7 +186,7 @@
186 * - Wireless Event capability in struct iw_range 186 * - Wireless Event capability in struct iw_range
187 * - Add support for relative TxPower (yick !) 187 * - Add support for relative TxPower (yick !)
188 * 188 *
189 * V17 to V18 (From Jouni Malinen <jkmaline@cc.hut.fi>) 189 * V17 to V18 (From Jouni Malinen <j@w1.fi>)
190 * ---------- 190 * ----------
191 * - Add support for WPA/WPA2 191 * - Add support for WPA/WPA2
192 * - Add extended encoding configuration (SIOCSIWENCODEEXT and 192 * - Add extended encoding configuration (SIOCSIWENCODEEXT and
@@ -221,6 +221,10 @@
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers 221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000 222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI 223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
224 *
225 * V21 to V22
226 * ----------
227 * - Prevent leaking of kernel space in stream on 64 bits.
224 */ 228 */
225 229
226/**************************** CONSTANTS ****************************/ 230/**************************** CONSTANTS ****************************/
@@ -334,7 +338,7 @@
334 * separate range because of collisions with other tools such as 338 * separate range because of collisions with other tools such as
335 * 'mii-tool'. 339 * 'mii-tool'.
336 * We now have 32 commands, so a bit more space ;-). 340 * We now have 32 commands, so a bit more space ;-).
337 * Also, all 'odd' commands are only usable by root and don't return the 341 * Also, all 'even' commands are only usable by root and don't return the
338 * content of ifr/iwr to user (but you are not obliged to use the set/get 342 * content of ifr/iwr to user (but you are not obliged to use the set/get
339 * convention, just use every other two command). More details in iwpriv.c. 343 * convention, just use every other two command). More details in iwpriv.c.
340 * And I repeat : you are not forced to use them with iwpriv, but you 344 * And I repeat : you are not forced to use them with iwpriv, but you
@@ -348,7 +352,7 @@
348#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ 352#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
349#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) 353#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
350 354
351/* Even : get (world access), odd : set (root access) */ 355/* Odd : get (world access), even : set (root access) */
352#define IW_IS_SET(cmd) (!((cmd) & 0x1)) 356#define IW_IS_SET(cmd) (!((cmd) & 0x1))
353#define IW_IS_GET(cmd) ((cmd) & 0x1) 357#define IW_IS_GET(cmd) ((cmd) & 0x1)
354 358
@@ -1085,4 +1089,15 @@ struct iw_event
1085#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ 1089#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1086 IW_EV_POINT_OFF) 1090 IW_EV_POINT_OFF)
1087 1091
1092/* Size of the Event prefix when packed in stream */
1093#define IW_EV_LCP_PK_LEN (4)
1094/* Size of the various events when packed in stream */
1095#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1096#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32))
1097#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1098#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1099#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1100#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1101#define IW_EV_POINT_PK_LEN (IW_EV_LCP_LEN + 4)
1102
1088#endif /* _LINUX_WIRELESS_H */ 1103#endif /* _LINUX_WIRELESS_H */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2a7b38d87018..b8abfc74d038 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *);
191 191
192/* 192/*
193 * Kill off a pending schedule_delayed_work(). Note that the work callback 193 * Kill off a pending schedule_delayed_work(). Note that the work callback
194 * function may still be running on return from cancel_delayed_work(). Run 194 * function may still be running on return from cancel_delayed_work(), unless
195 * flush_scheduled_work() to wait on it. 195 * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
196 * cancel_work_sync() to wait on it.
196 */ 197 */
197static inline int cancel_delayed_work(struct delayed_work *work) 198static inline int cancel_delayed_work(struct delayed_work *work)
198{ 199{
199 int ret; 200 int ret;
200 201
201 ret = del_timer_sync(&work->timer); 202 ret = del_timer(&work->timer);
202 if (ret) 203 if (ret)
203 work_release(&work->work); 204 work_release(&work->work);
204 return ret; 205 return ret;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index fc35e6bdfb93..0c78f7f4a976 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -84,7 +84,7 @@ static inline void wait_on_inode(struct inode *inode)
84int wakeup_pdflush(long nr_pages); 84int 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(gfp_t gfp_mask);
88 88
89/* These are exported to sysctl. */ 89/* These are exported to sysctl. */
90extern int dirty_background_ratio; 90extern int dirty_background_ratio;
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 0e7f1e20ea45..def131a5ac70 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -13,6 +13,10 @@
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ 14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15 15
16#ifdef __KERNEL__
17
18#include <linux/types.h>
19
16/* Namespaces */ 20/* Namespaces */
17#define XATTR_OS2_PREFIX "os2." 21#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1) 22#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
@@ -29,6 +33,8 @@
29#define XATTR_USER_PREFIX "user." 33#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) 34#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31 35
36struct inode;
37struct dentry;
32 38
33struct xattr_handler { 39struct xattr_handler {
34 char *prefix; 40 char *prefix;
@@ -50,4 +56,6 @@ ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_siz
50int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); 56int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
51int generic_removexattr(struct dentry *dentry, const char *name); 57int generic_removexattr(struct dentry *dentry, const char *name);
52 58
59#endif /* __KERNEL__ */
60
53#endif /* _LINUX_XATTR_H */ 61#endif /* _LINUX_XATTR_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 9529ea1ae392..a5d53e0fe152 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -178,6 +178,18 @@ enum {
178 XFRM_MSG_REPORT, 178 XFRM_MSG_REPORT,
179#define XFRM_MSG_REPORT XFRM_MSG_REPORT 179#define XFRM_MSG_REPORT XFRM_MSG_REPORT
180 180
181 XFRM_MSG_MIGRATE,
182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
183
184 XFRM_MSG_NEWSADINFO,
185#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
186 XFRM_MSG_GETSADINFO,
187#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
188
189 XFRM_MSG_NEWSPDINFO,
190#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
191 XFRM_MSG_GETSPDINFO,
192#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
181 __XFRM_MSG_MAX 193 __XFRM_MSG_MAX
182}; 194};
183#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 195#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -231,6 +243,17 @@ enum xfrm_ae_ftype_t {
231#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 243#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
232}; 244};
233 245
246/* SAD Table filter flags */
247enum xfrm_sad_ftype_t {
248 XFRM_SAD_UNSPEC,
249 XFRM_SAD_HMASK=1,
250 XFRM_SAD_HMAX=2,
251 XFRM_SAD_CNT=4,
252 __XFRM_SAD_MAX
253
254#define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1)
255};
256
234struct xfrm_userpolicy_type { 257struct xfrm_userpolicy_type {
235 __u8 type; 258 __u8 type;
236 __u16 reserved1; 259 __u16 reserved1;
@@ -256,11 +279,52 @@ enum xfrm_attr_type_t {
256 XFRMA_COADDR, /* xfrm_address_t */ 279 XFRMA_COADDR, /* xfrm_address_t */
257 XFRMA_LASTUSED, 280 XFRMA_LASTUSED,
258 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 281 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
282 XFRMA_MIGRATE,
259 __XFRMA_MAX 283 __XFRMA_MAX
260 284
261#define XFRMA_MAX (__XFRMA_MAX - 1) 285#define XFRMA_MAX (__XFRMA_MAX - 1)
262}; 286};
263 287
288enum xfrm_sadattr_type_t {
289 XFRMA_SAD_UNSPEC,
290 XFRMA_SADHMASK,
291 XFRMA_SADHMAX,
292 XFRMA_SADCNT,
293 __XFRMA_SAD_MAX
294
295#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
296};
297
298/* SPD Table filter flags */
299enum xfrm_spd_ftype_t {
300 XFRM_SPD_UNSPEC,
301 XFRM_SPD_HMASK=1,
302 XFRM_SPD_HMAX=2,
303 XFRM_SPD_ICNT=4,
304 XFRM_SPD_OCNT=8,
305 XFRM_SPD_FCNT=16,
306 XFRM_SPD_ISCNT=32,
307 XFRM_SPD_OSCNT=64,
308 XFRM_SPD_FSCNT=128,
309 __XFRM_SPD_MAX
310
311#define XFRM_SPD_MAX (__XFRM_SPD_MAX - 1)
312};
313enum xfrm_spdattr_type_t {
314 XFRMA_SPD_UNSPEC,
315 XFRMA_SPDHMASK,
316 XFRMA_SPDHMAX,
317 XFRMA_SPDICNT,
318 XFRMA_SPDOCNT,
319 XFRMA_SPDFCNT,
320 XFRMA_SPDISCNT,
321 XFRMA_SPDOSCNT,
322 XFRMA_SPDFSCNT,
323 __XFRMA_SPD_MAX
324
325#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
326};
327
264struct xfrm_usersa_info { 328struct xfrm_usersa_info {
265 struct xfrm_selector sel; 329 struct xfrm_selector sel;
266 struct xfrm_id id; 330 struct xfrm_id id;
@@ -351,6 +415,19 @@ struct xfrm_user_report {
351 struct xfrm_selector sel; 415 struct xfrm_selector sel;
352}; 416};
353 417
418struct xfrm_user_migrate {
419 xfrm_address_t old_daddr;
420 xfrm_address_t old_saddr;
421 xfrm_address_t new_daddr;
422 xfrm_address_t new_saddr;
423 __u8 proto;
424 __u8 mode;
425 __u16 reserved;
426 __u32 reqid;
427 __u16 old_family;
428 __u16 new_family;
429};
430
354#ifndef __KERNEL__ 431#ifndef __KERNEL__
355/* backwards compatibility for userspace */ 432/* backwards compatibility for userspace */
356#define XFRMGRP_ACQUIRE 1 433#define XFRMGRP_ACQUIRE 1
@@ -375,6 +452,8 @@ enum xfrm_nlgroups {
375#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS 452#define XFRMNLGRP_AEVENTS XFRMNLGRP_AEVENTS
376 XFRMNLGRP_REPORT, 453 XFRMNLGRP_REPORT,
377#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 454#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
455 XFRMNLGRP_MIGRATE,
456#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
378 __XFRMNLGRP_MAX 457 __XFRMNLGRP_MAX
379}; 458};
380#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 459#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index ecad55bf0162..38c12fed7535 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -40,6 +40,7 @@ struct cx2341x_mpeg_params {
40 /* stream */ 40 /* stream */
41 enum v4l2_mpeg_stream_type stream_type; 41 enum v4l2_mpeg_stream_type stream_type;
42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt; 42 enum v4l2_mpeg_stream_vbi_fmt stream_vbi_fmt;
43 u16 stream_insert_nav_packets;
43 44
44 /* audio */ 45 /* audio */
45 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq; 46 enum v4l2_mpeg_audio_sampling_freq audio_sampling_freq;
@@ -50,6 +51,7 @@ struct cx2341x_mpeg_params {
50 enum v4l2_mpeg_audio_emphasis audio_emphasis; 51 enum v4l2_mpeg_audio_emphasis audio_emphasis;
51 enum v4l2_mpeg_audio_crc audio_crc; 52 enum v4l2_mpeg_audio_crc audio_crc;
52 u16 audio_properties; 53 u16 audio_properties;
54 u16 audio_mute;
53 55
54 /* video */ 56 /* video */
55 enum v4l2_mpeg_video_encoding video_encoding; 57 enum v4l2_mpeg_video_encoding video_encoding;
@@ -57,11 +59,12 @@ struct cx2341x_mpeg_params {
57 u16 video_b_frames; 59 u16 video_b_frames;
58 u16 video_gop_size; 60 u16 video_gop_size;
59 u16 video_gop_closure; 61 u16 video_gop_closure;
60 u16 video_pulldown;
61 enum v4l2_mpeg_video_bitrate_mode video_bitrate_mode; 62 enum v4l2_mpeg_video_bitrate_mode video_bitrate_mode;
62 u32 video_bitrate; 63 u32 video_bitrate;
63 u32 video_bitrate_peak; 64 u32 video_bitrate_peak;
64 u16 video_temporal_decimation; 65 u16 video_temporal_decimation;
66 u16 video_mute;
67 u32 video_mute_yuv;
65 68
66 /* encoding filters */ 69 /* encoding filters */
67 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode; 70 enum v4l2_mpeg_cx2341x_video_spatial_filter_mode video_spatial_filter_mode;
@@ -121,8 +124,6 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
121#define CX2341X_DEC_SET_DISPLAY_BUFFERS 0x18 124#define CX2341X_DEC_SET_DISPLAY_BUFFERS 0x18
122#define CX2341X_DEC_EXTRACT_VBI 0x19 125#define CX2341X_DEC_EXTRACT_VBI 0x19
123#define CX2341X_DEC_SET_DECODER_SOURCE 0x1a 126#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#define CX2341X_DEC_SET_PREBUFFERING 0x1e
127 128
128/* MPEG encoder API */ 129/* MPEG encoder API */
@@ -141,7 +142,6 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
141#define CX2341X_ENC_SET_DNR_FILTER_PROPS 0x9d 142#define CX2341X_ENC_SET_DNR_FILTER_PROPS 0x9d
142#define CX2341X_ENC_SET_CORING_LEVELS 0x9f 143#define CX2341X_ENC_SET_CORING_LEVELS 0x9f
143#define CX2341X_ENC_SET_SPATIAL_FILTER_TYPE 0xa1 144#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 145#define CX2341X_ENC_SET_VBI_LINE 0xb7
146#define CX2341X_ENC_SET_STREAM_TYPE 0xb9 146#define CX2341X_ENC_SET_STREAM_TYPE 0xb9
147#define CX2341X_ENC_SET_OUTPUT_PORT 0xbb 147#define CX2341X_ENC_SET_OUTPUT_PORT 0xbb
@@ -166,7 +166,7 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix);
166#define CX2341X_ENC_SET_PLACEHOLDER 0xd7 166#define CX2341X_ENC_SET_PLACEHOLDER 0xd7
167#define CX2341X_ENC_MUTE_VIDEO 0xd9 167#define CX2341X_ENC_MUTE_VIDEO 0xd9
168#define CX2341X_ENC_MUTE_AUDIO 0xda 168#define CX2341X_ENC_MUTE_AUDIO 0xda
169#define CX2341X_ENC_UNKNOWN 0xdb 169#define CX2341X_ENC_SET_VERT_CROP_LINE 0xdb
170#define CX2341X_ENC_MISC 0xdc 170#define CX2341X_ENC_MISC 0xdc
171 171
172/* OSD API, specific to the cx23415 */ 172/* OSD API, specific to the cx23415 */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 4bb0ad810179..9807a7c15830 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -36,6 +36,11 @@
36#define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ 36#define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \
37 ? tab[code] : KEY_RESERVED) 37 ? tab[code] : KEY_RESERVED)
38 38
39#define RC5_START(x) (((x)>>12)&3)
40#define RC5_TOGGLE(x) (((x)>>11)&1)
41#define RC5_ADDR(x) (((x)>>6)&31)
42#define RC5_INSTR(x) ((x)&63)
43
39struct ir_input_state { 44struct ir_input_state {
40 /* configuration */ 45 /* configuration */
41 int ir_type; 46 int ir_type;
@@ -48,6 +53,40 @@ struct ir_input_state {
48 int keypressed; /* current state */ 53 int keypressed; /* current state */
49}; 54};
50 55
56/* this was saa7134_ir and bttv_ir, moved here for
57 * rc5 decoding. */
58struct card_ir {
59 struct input_dev *dev;
60 struct ir_input_state ir;
61 char name[32];
62 char phys[32];
63
64 /* Usual gpio signalling */
65
66 u32 mask_keycode;
67 u32 mask_keydown;
68 u32 mask_keyup;
69 u32 polling;
70 u32 last_gpio;
71 int shift_by;
72 int start; // What should RC5_START() be
73 int addr; // What RC5_ADDR() should be.
74 int rc5_key_timeout;
75 int rc5_remote_gap;
76 struct work_struct work;
77 struct timer_list timer;
78
79 /* RC5 gpio */
80 u32 rc5_gpio;
81 struct timer_list timer_end; /* timer_end for code completion */
82 struct timer_list timer_keyup; /* timer_end for key release */
83 u32 last_rc5; /* last good rc5 code */
84 u32 last_bit; /* last raw bit seen */
85 u32 code; /* raw code under construction */
86 struct timeval base_time; /* time of last seen code */
87 int active; /* building raw code */
88};
89
51void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 90void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
52 int ir_type, IR_KEYTAB_TYPE *ir_codes); 91 int ir_type, IR_KEYTAB_TYPE *ir_codes);
53void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 92void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
@@ -58,6 +97,10 @@ int ir_dump_samples(u32 *samples, int count);
58int ir_decode_biphase(u32 *samples, int count, int low, int high); 97int ir_decode_biphase(u32 *samples, int count, int low, int high);
59int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 98int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
60 99
100u32 ir_rc5_decode(unsigned int code);
101void ir_rc5_timer_end(unsigned long data);
102void ir_rc5_timer_keyup(unsigned long data);
103
61/* Keymaps to be used by other modules */ 104/* Keymaps to be used by other modules */
62 105
63extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; 106extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
@@ -94,6 +137,9 @@ extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE];
94extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE]; 137extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE];
95extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE]; 138extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE];
96extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE]; 139extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE];
140extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
141extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
142extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
97 143
98#endif 144#endif
99 145
diff --git a/include/media/ivtv.h b/include/media/ivtv.h
new file mode 100644
index 000000000000..412b48ea8eda
--- /dev/null
+++ b/include/media/ivtv.h
@@ -0,0 +1,65 @@
1/*
2 Public ivtv API header
3 Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
4 Copyright (C) 2004-2007 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_IVTV_H
22#define _LINUX_IVTV_H
23
24/* ivtv knows several distinct output modes: MPEG streaming,
25 YUV streaming, YUV updates through user DMA and the passthrough
26 mode.
27
28 In order to clearly tell the driver that we are in user DMA
29 YUV mode you need to call IVTV_IOC_DMA_FRAME with y_source == NULL
30 first (althrough if you don't then the first time
31 DMA_FRAME is called the mode switch is done automatically).
32
33 When you close the file handle the user DMA mode is exited again.
34
35 While in one mode, you cannot use another mode (EBUSY is returned).
36
37 All this means that if you want to change the YUV interlacing
38 for the user DMA YUV mode you first need to do call IVTV_IOC_DMA_FRAME
39 with y_source == NULL before you can set the correct format using
40 VIDIOC_S_FMT.
41
42 Eventually all this should be replaced with a proper V4L2 API,
43 but for now we have to do it this way. */
44
45struct ivtv_dma_frame {
46 enum v4l2_buf_type type; /* V4L2_BUF_TYPE_VIDEO_OUTPUT */
47 __u32 pixelformat; /* 0 == same as destination */
48 void __user *y_source; /* if NULL and type == V4L2_BUF_TYPE_VIDEO_OUTPUT,
49 then just switch to user DMA YUV output mode */
50 void __user *uv_source; /* Unused for RGB pixelformats */
51 struct v4l2_rect src;
52 struct v4l2_rect dst;
53 __u32 src_width;
54 __u32 src_height;
55};
56
57#define IVTV_IOC_DMA_FRAME _IOW ('V', BASE_VIDIOC_PRIVATE+0, struct ivtv_dma_frame)
58
59/* These are the VBI types as they appear in the embedded VBI private packets. */
60#define IVTV_SLICED_TYPE_TELETEXT_B (1)
61#define IVTV_SLICED_TYPE_CAPTION_525 (4)
62#define IVTV_SLICED_TYPE_WSS_625 (5)
63#define IVTV_SLICED_TYPE_VPS (7)
64
65#endif /* _LINUX_IVTV_H */
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index 9f0e2285a099..f677dfb9d373 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -42,5 +42,8 @@
42#define SAA7115_FREQ_FL_CGCDIV (1 << 1) /* SA 3A[6], CGCDIV, 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 */ 43#define SAA7115_FREQ_FL_APLL (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */
44 44
45#define SAA7115_IPORT_ON 1
46#define SAA7115_IPORT_OFF 0
47
45#endif 48#endif
46 49
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 83fe2e3d1e25..50e33b0e9349 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -239,7 +239,8 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits);
239#define SAA7146_HPS_SYNC_PORT_B 0x01 239#define SAA7146_HPS_SYNC_PORT_B 0x01
240 240
241/* some memory sizes */ 241/* some memory sizes */
242#define SAA7146_CLIPPING_MEM (14*PAGE_SIZE) 242/* max. 16 clipping rectangles */
243#define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32))
243 244
244/* some defines for the various clipping-modes */ 245/* some defines for the various clipping-modes */
245#define SAA7146_CLIPPING_RECT 0x4 246#define SAA7146_CLIPPING_RECT 0x4
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 99acf847365c..a41ac41113ac 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -177,6 +177,8 @@ struct tuner_setup {
177 unsigned short addr; /* I2C address */ 177 unsigned short addr; /* I2C address */
178 unsigned int type; /* Tuner type */ 178 unsigned int type; /* Tuner type */
179 unsigned int mode_mask; /* Allowed tuner modes */ 179 unsigned int mode_mask; /* Allowed tuner modes */
180 unsigned int config; /* configuraion for more complex tuners */
181 int (*tuner_callback) (void *dev, int command,int arg);
180}; 182};
181 183
182struct tuner { 184struct tuner {
@@ -211,6 +213,9 @@ struct tuner {
211 unsigned char tda827x_ver; 213 unsigned char tda827x_ver;
212 unsigned int sgIF; 214 unsigned int sgIF;
213 215
216 unsigned int config;
217 int (*tuner_callback) (void *dev, int command,int arg);
218
214 /* function ptrs */ 219 /* function ptrs */
215 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq); 220 void (*set_tv_freq)(struct i2c_client *c, unsigned int freq);
216 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq); 221 void (*set_radio_freq)(struct i2c_client *c, unsigned int freq);
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
new file mode 100644
index 000000000000..09d16c4f00f7
--- /dev/null
+++ b/include/media/v4l2-chip-ident.h
@@ -0,0 +1,149 @@
1/*
2 v4l2 chip identifiers header
3
4 This header provides a list of chip identifiers that can be returned
5 through the VIDIOC_G_CHIP_IDENT ioctl.
6
7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef V4L2_CHIP_IDENT_H_
25#define V4L2_CHIP_IDENT_H_
26
27/* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */
28enum {
29 /* general idents: reserved range 0-49 */
30 V4L2_IDENT_NONE = 0, /* No chip matched */
31 V4L2_IDENT_AMBIGUOUS = 1, /* Match too general, multiple chips matched */
32 V4L2_IDENT_UNKNOWN = 2, /* Chip found, but cannot identify */
33
34 /* module tvaudio: reserved range 50-99 */
35 V4L2_IDENT_TVAUDIO = 50, /* A tvaudio chip, unknown which it is exactly */
36
37 /* module saa7110: just ident 100 */
38 V4L2_IDENT_SAA7110 = 100,
39
40 /* module saa7111: just ident 101 */
41 V4L2_IDENT_SAA7111 = 101,
42
43 /* module saa7115: reserved range 102-149 */
44 V4L2_IDENT_SAA7113 = 103,
45 V4L2_IDENT_SAA7114 = 104,
46 V4L2_IDENT_SAA7115 = 105,
47 V4L2_IDENT_SAA7118 = 108,
48
49 /* module saa7127: reserved range 150-199 */
50 V4L2_IDENT_SAA7127 = 157,
51 V4L2_IDENT_SAA7129 = 159,
52
53 /* module cx25840: reserved range 200-249 */
54 V4L2_IDENT_CX25836 = 236,
55 V4L2_IDENT_CX25837 = 237,
56 V4L2_IDENT_CX25840 = 240,
57 V4L2_IDENT_CX25841 = 241,
58 V4L2_IDENT_CX25842 = 242,
59 V4L2_IDENT_CX25843 = 243,
60
61 /* OmniVision sensors: reserved range 250-299 */
62 V4L2_IDENT_OV7670 = 250,
63
64 /* Conexant MPEG encoder/decoders: reserved range 410-420 */
65 V4L2_IDENT_CX23415 = 415,
66 V4L2_IDENT_CX23416 = 416,
67
68 /* module wm8739: just ident 8739 */
69 V4L2_IDENT_WM8739 = 8739,
70
71 /* module wm8775: just ident 8775 */
72 V4L2_IDENT_WM8775 = 8775,
73
74 /* module cs53132a: just ident 53132 */
75 V4L2_IDENT_CS53l32A = 53132,
76
77 /* module upd64031a: just ident 64031 */
78 V4L2_IDENT_UPD64031A = 64031,
79
80 /* module upd64083: just ident 64083 */
81 V4L2_IDENT_UPD64083 = 64083,
82
83 /* module msp34xx: reserved range 34000-34999 */
84 V4L2_IDENT_MSP3400B = 34002,
85 V4L2_IDENT_MSP3410B = 34102,
86
87 V4L2_IDENT_MSP3400C = 34003,
88 V4L2_IDENT_MSP3410C = 34103,
89
90 V4L2_IDENT_MSP3400D = 34004,
91 V4L2_IDENT_MSP3410D = 34104,
92 V4L2_IDENT_MSP3405D = 34054,
93 V4L2_IDENT_MSP3415D = 34154,
94 V4L2_IDENT_MSP3407D = 34074,
95 V4L2_IDENT_MSP3417D = 34174,
96
97 V4L2_IDENT_MSP3400G = 34007,
98 V4L2_IDENT_MSP3410G = 34107,
99 V4L2_IDENT_MSP3420G = 34207,
100 V4L2_IDENT_MSP3430G = 34307,
101 V4L2_IDENT_MSP3440G = 34407,
102 V4L2_IDENT_MSP3450G = 34507,
103 V4L2_IDENT_MSP3460G = 34607,
104
105 V4L2_IDENT_MSP3401G = 34017,
106 V4L2_IDENT_MSP3411G = 34117,
107 V4L2_IDENT_MSP3421G = 34217,
108 V4L2_IDENT_MSP3431G = 34317,
109 V4L2_IDENT_MSP3441G = 34417,
110 V4L2_IDENT_MSP3451G = 34517,
111 V4L2_IDENT_MSP3461G = 34617,
112
113 V4L2_IDENT_MSP3402G = 34027,
114 V4L2_IDENT_MSP3412G = 34127,
115 V4L2_IDENT_MSP3422G = 34227,
116 V4L2_IDENT_MSP3442G = 34427,
117 V4L2_IDENT_MSP3452G = 34527,
118
119 V4L2_IDENT_MSP3405G = 34057,
120 V4L2_IDENT_MSP3415G = 34157,
121 V4L2_IDENT_MSP3425G = 34257,
122 V4L2_IDENT_MSP3435G = 34357,
123 V4L2_IDENT_MSP3445G = 34457,
124 V4L2_IDENT_MSP3455G = 34557,
125 V4L2_IDENT_MSP3465G = 34657,
126
127 V4L2_IDENT_MSP3407G = 34077,
128 V4L2_IDENT_MSP3417G = 34177,
129 V4L2_IDENT_MSP3427G = 34277,
130 V4L2_IDENT_MSP3437G = 34377,
131 V4L2_IDENT_MSP3447G = 34477,
132 V4L2_IDENT_MSP3457G = 34577,
133 V4L2_IDENT_MSP3467G = 34677,
134
135 /* module msp44xx: reserved range 44000-44999 */
136 V4L2_IDENT_MSP4400G = 44007,
137 V4L2_IDENT_MSP4410G = 44107,
138 V4L2_IDENT_MSP4420G = 44207,
139 V4L2_IDENT_MSP4440G = 44407,
140 V4L2_IDENT_MSP4450G = 44507,
141
142 V4L2_IDENT_MSP4408G = 44087,
143 V4L2_IDENT_MSP4418G = 44187,
144 V4L2_IDENT_MSP4428G = 44287,
145 V4L2_IDENT_MSP4448G = 44487,
146 V4L2_IDENT_MSP4458G = 44587,
147};
148
149#endif
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 91b19921f958..181a40c46a52 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -64,9 +64,6 @@
64/* Prints the ioctl in a human-readable format */ 64/* Prints the ioctl in a human-readable format */
65extern void v4l_printk_ioctl(unsigned int cmd); 65extern void v4l_printk_ioctl(unsigned int cmd);
66 66
67/* Prints the ioctl and arg in a human-readable format */
68extern void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg);
69
70/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ 67/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
71#define v4l_print_ioctl(name, cmd) \ 68#define v4l_print_ioctl(name, cmd) \
72 do { \ 69 do { \
@@ -97,14 +94,17 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
97 94
98/* ------------------------------------------------------------------------- */ 95/* ------------------------------------------------------------------------- */
99 96
100/* Internal ioctls */ 97/* Register/chip ident helper function */
101 98
102/* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ 99struct i2c_client; /* forward reference */
103struct v4l2_register { 100int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id);
104 u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */ 101int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
105 unsigned long reg; 102 u32 ident, u32 revision);
106 u32 val; 103int v4l2_chip_match_host(u32 id_type, u32 chip_id);
107}; 104
105/* ------------------------------------------------------------------------- */
106
107/* Internal ioctls */
108 108
109/* VIDIOC_INT_DECODE_VBI_LINE */ 109/* VIDIOC_INT_DECODE_VBI_LINE */
110struct v4l2_decode_vbi_line { 110struct v4l2_decode_vbi_line {
@@ -116,39 +116,6 @@ struct v4l2_decode_vbi_line {
116 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ 116 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
117}; 117};
118 118
119/* VIDIOC_INT_G_CHIP_IDENT: identifies the actual chip installed on the board */
120enum v4l2_chip_ident {
121 /* general idents: reserved range 0-49 */
122 V4L2_IDENT_UNKNOWN = 0,
123
124 /* module saa7110: just ident= 100 */
125 V4L2_IDENT_SAA7110 = 100,
126
127 /* module saa7111: just ident= 101 */
128 V4L2_IDENT_SAA7111 = 101,
129
130 /* module saa7115: reserved range 102-149 */
131 V4L2_IDENT_SAA7113 = 103,
132 V4L2_IDENT_SAA7114 = 104,
133 V4L2_IDENT_SAA7115 = 105,
134 V4L2_IDENT_SAA7118 = 108,
135
136 /* module saa7127: reserved range 150-199 */
137 V4L2_IDENT_SAA7127 = 157,
138 V4L2_IDENT_SAA7129 = 159,
139
140 /* module cx25840: reserved range 200-249 */
141 V4L2_IDENT_CX25836 = 236,
142 V4L2_IDENT_CX25837 = 237,
143 V4L2_IDENT_CX25840 = 240,
144 V4L2_IDENT_CX25841 = 241,
145 V4L2_IDENT_CX25842 = 242,
146 V4L2_IDENT_CX25843 = 243,
147
148 /* OmniVision sensors - range 250-299 */
149 V4L2_IDENT_OV7670 = 250,
150};
151
152/* audio ioctls */ 119/* audio ioctls */
153 120
154/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ 121/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
@@ -175,9 +142,7 @@ enum v4l2_chip_ident {
175 Replacement of TUNER_SET_STANDBY. */ 142 Replacement of TUNER_SET_STANDBY. */
176#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32) 143#define VIDIOC_INT_S_STANDBY _IOW('d', 94, u32)
177 144
178/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 145/* 100, 101 used by VIDIOC_DBG_[SG]_REGISTER */
179#define VIDIOC_INT_S_REGISTER _IOW ('d', 100, struct v4l2_register)
180#define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register)
181 146
182/* Generic reset command. The argument selects which subsystems to reset. 147/* Generic reset command. The argument selects which subsystems to reset.
183 Passing 0 will always reset the whole chip. */ 148 Passing 0 will always reset the whole chip. */
@@ -212,10 +177,6 @@ enum v4l2_chip_ident {
212 whether CC data from the first or second field should be obtained). */ 177 whether CC data from the first or second field should be obtained). */
213#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data) 178#define VIDIOC_INT_G_VBI_DATA _IOWR('d', 106, struct v4l2_sliced_vbi_data)
214 179
215/* Returns the chip identifier or V4L2_IDENT_UNKNOWN if no identification can
216 be made. */
217#define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident)
218
219/* Sets I2S speed in bps. This is used to provide a standard way to select I2S 180/* Sets I2S speed in bps. This is used to provide a standard way to select I2S
220 clock used by driving digital audio streams at some board designs. 181 clock used by driving digital audio streams at some board designs.
221 Usual values for the frequency are 1024000 and 2048000. 182 Usual values for the frequency are 1024000 and 2048000.
@@ -258,4 +219,12 @@ struct v4l2_crystal_freq {
258 default values. */ 219 default values. */
259#define VIDIOC_INT_INIT _IOW ('d', 114, u32) 220#define VIDIOC_INT_INIT _IOW ('d', 114, u32)
260 221
222/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
223 video input devices. */
224#define VIDIOC_INT_S_STD_OUTPUT _IOW ('d', 115, v4l2_std_id)
225
226/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
227 video input devices. */
228#define VIDIOC_INT_G_STD_OUTPUT _IOW ('d', 116, v4l2_std_id)
229
261#endif /* V4L2_COMMON_H_ */ 230#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index fb96472a1bd3..d62847f846c2 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -127,6 +127,8 @@ struct video_device
127 struct v4l2_fmtdesc *f); 127 struct v4l2_fmtdesc *f);
128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh, 128 int (*vidioc_enum_fmt_video_output)(struct file *file, void *fh,
129 struct v4l2_fmtdesc *f); 129 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_output_overlay) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f);
130 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh, 132 int (*vidioc_enum_fmt_vbi_output) (struct file *file, void *fh,
131 struct v4l2_fmtdesc *f); 133 struct v4l2_fmtdesc *f);
132 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 134 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
@@ -145,6 +147,8 @@ struct video_device
145 struct v4l2_format *f); 147 struct v4l2_format *f);
146 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh, 148 int (*vidioc_g_fmt_video_output)(struct file *file, void *fh,
147 struct v4l2_format *f); 149 struct v4l2_format *f);
150 int (*vidioc_g_fmt_output_overlay) (struct file *file, void *fh,
151 struct v4l2_format *f);
148 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, 152 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
149 struct v4l2_format *f); 153 struct v4l2_format *f);
150 154
@@ -162,6 +166,8 @@ struct video_device
162 struct v4l2_format *f); 166 struct v4l2_format *f);
163 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh, 167 int (*vidioc_s_fmt_video_output)(struct file *file, void *fh,
164 struct v4l2_format *f); 168 struct v4l2_format *f);
169 int (*vidioc_s_fmt_output_overlay) (struct file *file, void *fh,
170 struct v4l2_format *f);
165 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, 171 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
166 struct v4l2_format *f); 172 struct v4l2_format *f);
167 173
@@ -178,6 +184,8 @@ struct video_device
178 struct v4l2_format *f); 184 struct v4l2_format *f);
179 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh, 185 int (*vidioc_try_fmt_video_output)(struct file *file, void *fh,
180 struct v4l2_format *f); 186 struct v4l2_format *f);
187 int (*vidioc_try_fmt_output_overlay)(struct file *file, void *fh,
188 struct v4l2_format *f);
181 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, 189 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
182 struct v4l2_format *f); 190 struct v4l2_format *f);
183 191
@@ -271,6 +279,12 @@ struct video_device
271 struct v4l2_jpegcompression *a); 279 struct v4l2_jpegcompression *a);
272 int (*vidioc_s_jpegcomp) (struct file *file, void *fh, 280 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
273 struct v4l2_jpegcompression *a); 281 struct v4l2_jpegcompression *a);
282 int (*vidioc_g_enc_index) (struct file *file, void *fh,
283 struct v4l2_enc_idx *a);
284 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
285 struct v4l2_encoder_cmd *a);
286 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
287 struct v4l2_encoder_cmd *a);
274 288
275 /* Stream type-dependent parameter ioctls */ 289 /* Stream type-dependent parameter ioctls */
276 int (*vidioc_g_parm) (struct file *file, void *fh, 290 int (*vidioc_g_parm) (struct file *file, void *fh,
@@ -296,6 +310,17 @@ struct video_device
296 int (*vidioc_log_status) (struct file *file, void *fh); 310 int (*vidioc_log_status) (struct file *file, void *fh);
297 311
298 312
313 /* Debugging ioctls */
314#ifdef CONFIG_VIDEO_ADV_DEBUG
315 int (*vidioc_g_register) (struct file *file, void *fh,
316 struct v4l2_register *reg);
317 int (*vidioc_s_register) (struct file *file, void *fh,
318 struct v4l2_register *reg);
319#endif
320 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
321 struct v4l2_chip_ident *chip);
322
323
299#ifdef OBSOLETE_OWNER /* to be removed soon */ 324#ifdef OBSOLETE_OWNER /* to be removed soon */
300/* obsolete -- fops->owner is used instead */ 325/* obsolete -- fops->owner is used instead */
301struct module *owner; 326struct module *owner;
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index 1115a256969f..d6f079476db3 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -78,6 +78,9 @@ struct videobuf_dmabuf {
78 /* for kernel buffers */ 78 /* for kernel buffers */
79 void *vmalloc; 79 void *vmalloc;
80 80
81 /* Stores the userspace pointer to vmalloc area */
82 void *varea;
83
81 /* for overlay buffers (pci-pci dma) */ 84 /* for overlay buffers (pci-pci dma) */
82 dma_addr_t bus_addr; 85 dma_addr_t bus_addr;
83 86
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index e0fe92b03a4e..4d46b3bdebd8 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -3,3 +3,5 @@ header-y += jffs2-user.h
3header-y += mtd-abi.h 3header-y += mtd-abi.h
4header-y += mtd-user.h 4header-y += mtd-user.h
5header-y += nftl-user.h 5header-y += nftl-user.h
6header-y += ubi-header.h
7header-y += ubi-user.h
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index f913c30d7b89..f71dac420394 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -24,6 +24,7 @@ struct mtd_oob_buf {
24#define MTD_NORFLASH 3 24#define MTD_NORFLASH 3
25#define MTD_NANDFLASH 4 25#define MTD_NANDFLASH 4
26#define MTD_DATAFLASH 6 26#define MTD_DATAFLASH 6
27#define MTD_UBIVOLUME 7
27 28
28#define MTD_WRITEABLE 0x400 /* Device is writeable */ 29#define MTD_WRITEABLE 0x400 /* Device is writeable */
29#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ 30#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */
@@ -36,12 +37,6 @@ struct mtd_oob_buf {
36#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) 37#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
37#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) 38#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
38 39
39
40// Types of automatic ECC/Checksum available
41#define MTD_ECC_NONE 0 // No automatic ECC available
42#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip
43#define MTD_ECC_SW 2 // SW ECC for Toshiba & Samsung devices
44
45/* ECC byte placement */ 40/* ECC byte placement */
46#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) 41#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended)
47#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) 42#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode)
@@ -61,6 +56,8 @@ struct mtd_info_user {
61 uint32_t erasesize; 56 uint32_t erasesize;
62 uint32_t writesize; 57 uint32_t writesize;
63 uint32_t oobsize; // Amount of OOB data per block (e.g. 16) 58 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
59 /* The below two fields are obsolete and broken, do not use them
60 * (TODO: remove at some point) */
64 uint32_t ecctype; 61 uint32_t ecctype;
65 uint32_t eccsize; 62 uint32_t eccsize;
66}; 63};
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h
new file mode 100644
index 000000000000..fa479c71aa34
--- /dev/null
+++ b/include/mtd/ubi-header.h
@@ -0,0 +1,360 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Artem Bityutskiy (Битюцкий Артём)
19 * Thomas Gleixner
20 * Frank Haverkamp
21 * Oliver Lohmann
22 * Andreas Arnez
23 */
24
25/*
26 * This file defines the layout of UBI headers and all the other UBI on-flash
27 * data structures. May be included by user-space.
28 */
29
30#ifndef __UBI_HEADER_H__
31#define __UBI_HEADER_H__
32
33#include <asm/byteorder.h>
34
35/* The version of UBI images supported by this implementation */
36#define UBI_VERSION 1
37
38/* The highest erase counter value supported by this implementation */
39#define UBI_MAX_ERASECOUNTER 0x7FFFFFFF
40
41/* The initial CRC32 value used when calculating CRC checksums */
42#define UBI_CRC32_INIT 0xFFFFFFFFU
43
44/* Erase counter header magic number (ASCII "UBI#") */
45#define UBI_EC_HDR_MAGIC 0x55424923
46/* Volume identifier header magic number (ASCII "UBI!") */
47#define UBI_VID_HDR_MAGIC 0x55424921
48
49/*
50 * Volume type constants used in the volume identifier header.
51 *
52 * @UBI_VID_DYNAMIC: dynamic volume
53 * @UBI_VID_STATIC: static volume
54 */
55enum {
56 UBI_VID_DYNAMIC = 1,
57 UBI_VID_STATIC = 2
58};
59
60/*
61 * Compatibility constants used by internal volumes.
62 *
63 * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
64 * to the flash
65 * @UBI_COMPAT_RO: attach this device in read-only mode
66 * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
67 * physical eraseblocks, don't allow the wear-leveling unit to move them
68 * @UBI_COMPAT_REJECT: reject this UBI image
69 */
70enum {
71 UBI_COMPAT_DELETE = 1,
72 UBI_COMPAT_RO = 2,
73 UBI_COMPAT_PRESERVE = 4,
74 UBI_COMPAT_REJECT = 5
75};
76
77/*
78 * ubi16_t/ubi32_t/ubi64_t - 16, 32, and 64-bit integers used in UBI on-flash
79 * data structures.
80 */
81typedef struct {
82 uint16_t int16;
83} __attribute__ ((packed)) ubi16_t;
84
85typedef struct {
86 uint32_t int32;
87} __attribute__ ((packed)) ubi32_t;
88
89typedef struct {
90 uint64_t int64;
91} __attribute__ ((packed)) ubi64_t;
92
93/*
94 * In this implementation of UBI uses the big-endian format for on-flash
95 * integers. The below are the corresponding conversion macros.
96 */
97#define cpu_to_ubi16(x) ((ubi16_t){__cpu_to_be16(x)})
98#define ubi16_to_cpu(x) ((uint16_t)__be16_to_cpu((x).int16))
99
100#define cpu_to_ubi32(x) ((ubi32_t){__cpu_to_be32(x)})
101#define ubi32_to_cpu(x) ((uint32_t)__be32_to_cpu((x).int32))
102
103#define cpu_to_ubi64(x) ((ubi64_t){__cpu_to_be64(x)})
104#define ubi64_to_cpu(x) ((uint64_t)__be64_to_cpu((x).int64))
105
106/* Sizes of UBI headers */
107#define UBI_EC_HDR_SIZE sizeof(struct ubi_ec_hdr)
108#define UBI_VID_HDR_SIZE sizeof(struct ubi_vid_hdr)
109
110/* Sizes of UBI headers without the ending CRC */
111#define UBI_EC_HDR_SIZE_CRC (UBI_EC_HDR_SIZE - sizeof(ubi32_t))
112#define UBI_VID_HDR_SIZE_CRC (UBI_VID_HDR_SIZE - sizeof(ubi32_t))
113
114/**
115 * struct ubi_ec_hdr - UBI erase counter header.
116 * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
117 * @version: version of UBI implementation which is supposed to accept this
118 * UBI image
119 * @padding1: reserved for future, zeroes
120 * @ec: the erase counter
121 * @vid_hdr_offset: where the VID header starts
122 * @data_offset: where the user data start
123 * @padding2: reserved for future, zeroes
124 * @hdr_crc: erase counter header CRC checksum
125 *
126 * The erase counter header takes 64 bytes and has a plenty of unused space for
127 * future usage. The unused fields are zeroed. The @version field is used to
128 * indicate the version of UBI implementation which is supposed to be able to
129 * work with this UBI image. If @version is greater then the current UBI
130 * version, the image is rejected. This may be useful in future if something
131 * is changed radically. This field is duplicated in the volume identifier
132 * header.
133 *
134 * The @vid_hdr_offset and @data_offset fields contain the offset of the the
135 * volume identifier header and user data, relative to the beginning of the
136 * physical eraseblock. These values have to be the same for all physical
137 * eraseblocks.
138 */
139struct ubi_ec_hdr {
140 ubi32_t magic;
141 uint8_t version;
142 uint8_t padding1[3];
143 ubi64_t ec; /* Warning: the current limit is 31-bit anyway! */
144 ubi32_t vid_hdr_offset;
145 ubi32_t data_offset;
146 uint8_t padding2[36];
147 ubi32_t hdr_crc;
148} __attribute__ ((packed));
149
150/**
151 * struct ubi_vid_hdr - on-flash UBI volume identifier header.
152 * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
153 * @version: UBI implementation version which is supposed to accept this UBI
154 * image (%UBI_VERSION)
155 * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
156 * @copy_flag: if this logical eraseblock was copied from another physical
157 * eraseblock (for wear-leveling reasons)
158 * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
159 * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
160 * @vol_id: ID of this volume
161 * @lnum: logical eraseblock number
162 * @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be
163 * removed, kept only for not breaking older UBI users)
164 * @data_size: how many bytes of data this logical eraseblock contains
165 * @used_ebs: total number of used logical eraseblocks in this volume
166 * @data_pad: how many bytes at the end of this physical eraseblock are not
167 * used
168 * @data_crc: CRC checksum of the data stored in this logical eraseblock
169 * @padding1: reserved for future, zeroes
170 * @sqnum: sequence number
171 * @padding2: reserved for future, zeroes
172 * @hdr_crc: volume identifier header CRC checksum
173 *
174 * The @sqnum is the value of the global sequence counter at the time when this
175 * VID header was created. The global sequence counter is incremented each time
176 * UBI writes a new VID header to the flash, i.e. when it maps a logical
177 * eraseblock to a new physical eraseblock. The global sequence counter is an
178 * unsigned 64-bit integer and we assume it never overflows. The @sqnum
179 * (sequence number) is used to distinguish between older and newer versions of
180 * logical eraseblocks.
181 *
182 * There are 2 situations when there may be more then one physical eraseblock
183 * corresponding to the same logical eraseblock, i.e., having the same @vol_id
184 * and @lnum values in the volume identifier header. Suppose we have a logical
185 * eraseblock L and it is mapped to the physical eraseblock P.
186 *
187 * 1. Because UBI may erase physical eraseblocks asynchronously, the following
188 * situation is possible: L is asynchronously erased, so P is scheduled for
189 * erasure, then L is written to,i.e. mapped to another physical eraseblock P1,
190 * so P1 is written to, then an unclean reboot happens. Result - there are 2
191 * physical eraseblocks P and P1 corresponding to the same logical eraseblock
192 * L. But P1 has greater sequence number, so UBI picks P1 when it attaches the
193 * flash.
194 *
195 * 2. From time to time UBI moves logical eraseblocks to other physical
196 * eraseblocks for wear-leveling reasons. If, for example, UBI moves L from P
197 * to P1, and an unclean reboot happens before P is physically erased, there
198 * are two physical eraseblocks P and P1 corresponding to L and UBI has to
199 * select one of them when the flash is attached. The @sqnum field says which
200 * PEB is the original (obviously P will have lower @sqnum) and the copy. But
201 * it is not enough to select the physical eraseblock with the higher sequence
202 * number, because the unclean reboot could have happen in the middle of the
203 * copying process, so the data in P is corrupted. It is also not enough to
204 * just select the physical eraseblock with lower sequence number, because the
205 * data there may be old (consider a case if more data was added to P1 after
206 * the copying). Moreover, the unclean reboot may happen when the erasure of P
207 * was just started, so it result in unstable P, which is "mostly" OK, but
208 * still has unstable bits.
209 *
210 * UBI uses the @copy_flag field to indicate that this logical eraseblock is a
211 * copy. UBI also calculates data CRC when the data is moved and stores it at
212 * the @data_crc field of the copy (P1). So when UBI needs to pick one physical
213 * eraseblock of two (P or P1), the @copy_flag of the newer one (P1) is
214 * examined. If it is cleared, the situation* is simple and the newer one is
215 * picked. If it is set, the data CRC of the copy (P1) is examined. If the CRC
216 * checksum is correct, this physical eraseblock is selected (P1). Otherwise
217 * the older one (P) is selected.
218 *
219 * Note, there is an obsolete @leb_ver field which was used instead of @sqnum
220 * in the past. But it is not used anymore and we keep it in order to be able
221 * to deal with old UBI images. It will be removed at some point.
222 *
223 * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
224 * Internal volumes are not seen from outside and are used for various internal
225 * UBI purposes. In this implementation there is only one internal volume - the
226 * layout volume. Internal volumes are the main mechanism of UBI extensions.
227 * For example, in future one may introduce a journal internal volume. Internal
228 * volumes have their own reserved range of IDs.
229 *
230 * The @compat field is only used for internal volumes and contains the "degree
231 * of their compatibility". It is always zero for user volumes. This field
232 * provides a mechanism to introduce UBI extensions and to be still compatible
233 * with older UBI binaries. For example, if someone introduced a journal in
234 * future, he would probably use %UBI_COMPAT_DELETE compatibility for the
235 * journal volume. And in this case, older UBI binaries, which know nothing
236 * about the journal volume, would just delete this volume and work perfectly
237 * fine. This is similar to what Ext2fs does when it is fed by an Ext3fs image
238 * - it just ignores the Ext3fs journal.
239 *
240 * The @data_crc field contains the CRC checksum of the contents of the logical
241 * eraseblock if this is a static volume. In case of dynamic volumes, it does
242 * not contain the CRC checksum as a rule. The only exception is when the
243 * data of the physical eraseblock was moved by the wear-leveling unit, then
244 * the wear-leveling unit calculates the data CRC and stores it in the
245 * @data_crc field. And of course, the @copy_flag is %in this case.
246 *
247 * The @data_size field is used only for static volumes because UBI has to know
248 * how many bytes of data are stored in this eraseblock. For dynamic volumes,
249 * this field usually contains zero. The only exception is when the data of the
250 * physical eraseblock was moved to another physical eraseblock for
251 * wear-leveling reasons. In this case, UBI calculates CRC checksum of the
252 * contents and uses both @data_crc and @data_size fields. In this case, the
253 * @data_size field contains data size.
254 *
255 * The @used_ebs field is used only for static volumes and indicates how many
256 * eraseblocks the data of the volume takes. For dynamic volumes this field is
257 * not used and always contains zero.
258 *
259 * The @data_pad is calculated when volumes are created using the alignment
260 * parameter. So, effectively, the @data_pad field reduces the size of logical
261 * eraseblocks of this volume. This is very handy when one uses block-oriented
262 * software (say, cramfs) on top of the UBI volume.
263 */
264struct ubi_vid_hdr {
265 ubi32_t magic;
266 uint8_t version;
267 uint8_t vol_type;
268 uint8_t copy_flag;
269 uint8_t compat;
270 ubi32_t vol_id;
271 ubi32_t lnum;
272 ubi32_t leb_ver; /* obsolete, to be removed, don't use */
273 ubi32_t data_size;
274 ubi32_t used_ebs;
275 ubi32_t data_pad;
276 ubi32_t data_crc;
277 uint8_t padding1[4];
278 ubi64_t sqnum;
279 uint8_t padding2[12];
280 ubi32_t hdr_crc;
281} __attribute__ ((packed));
282
283/* Internal UBI volumes count */
284#define UBI_INT_VOL_COUNT 1
285
286/*
287 * Starting ID of internal volumes. There is reserved room for 4096 internal
288 * volumes.
289 */
290#define UBI_INTERNAL_VOL_START (0x7FFFFFFF - 4096)
291
292/* The layout volume contains the volume table */
293
294#define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START
295#define UBI_LAYOUT_VOLUME_EBS 2
296#define UBI_LAYOUT_VOLUME_NAME "layout volume"
297#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
298
299/* The maximum number of volumes per one UBI device */
300#define UBI_MAX_VOLUMES 128
301
302/* The maximum volume name length */
303#define UBI_VOL_NAME_MAX 127
304
305/* Size of the volume table record */
306#define UBI_VTBL_RECORD_SIZE sizeof(struct ubi_vtbl_record)
307
308/* Size of the volume table record without the ending CRC */
309#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(ubi32_t))
310
311/**
312 * struct ubi_vtbl_record - a record in the volume table.
313 * @reserved_pebs: how many physical eraseblocks are reserved for this volume
314 * @alignment: volume alignment
315 * @data_pad: how many bytes are unused at the end of the each physical
316 * eraseblock to satisfy the requested alignment
317 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
318 * @upd_marker: if volume update was started but not finished
319 * @name_len: volume name length
320 * @name: the volume name
321 * @padding2: reserved, zeroes
322 * @crc: a CRC32 checksum of the record
323 *
324 * The volume table records are stored in the volume table, which is stored in
325 * the layout volume. The layout volume consists of 2 logical eraseblock, each
326 * of which contains a copy of the volume table (i.e., the volume table is
327 * duplicated). The volume table is an array of &struct ubi_vtbl_record
328 * objects indexed by the volume ID.
329 *
330 * If the size of the logical eraseblock is large enough to fit
331 * %UBI_MAX_VOLUMES records, the volume table contains %UBI_MAX_VOLUMES
332 * records. Otherwise, it contains as many records as it can fit (i.e., size of
333 * logical eraseblock divided by sizeof(struct ubi_vtbl_record)).
334 *
335 * The @upd_marker flag is used to implement volume update. It is set to %1
336 * before update and set to %0 after the update. So if the update operation was
337 * interrupted, UBI knows that the volume is corrupted.
338 *
339 * The @alignment field is specified when the volume is created and cannot be
340 * later changed. It may be useful, for example, when a block-oriented file
341 * system works on top of UBI. The @data_pad field is calculated using the
342 * logical eraseblock size and @alignment. The alignment must be multiple to the
343 * minimal flash I/O unit. If @alignment is 1, all the available space of
344 * the physical eraseblocks is used.
345 *
346 * Empty records contain all zeroes and the CRC checksum of those zeroes.
347 */
348struct ubi_vtbl_record {
349 ubi32_t reserved_pebs;
350 ubi32_t alignment;
351 ubi32_t data_pad;
352 uint8_t vol_type;
353 uint8_t upd_marker;
354 ubi16_t name_len;
355 uint8_t name[UBI_VOL_NAME_MAX+1];
356 uint8_t padding2[24];
357 ubi32_t crc;
358} __attribute__ ((packed));
359
360#endif /* !__UBI_HEADER_H__ */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
new file mode 100644
index 000000000000..fe06ded0e6b8
--- /dev/null
+++ b/include/mtd/ubi-user.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (c) International Business Machines Corp., 2006
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Artem Bityutskiy (Битюцкий Артём)
19 */
20
21#ifndef __UBI_USER_H__
22#define __UBI_USER_H__
23
24/*
25 * UBI volume creation
26 * ~~~~~~~~~~~~~~~~~~~
27 *
28 * UBI volumes are created via the %UBI_IOCMKVOL IOCTL command of UBI character
29 * device. A &struct ubi_mkvol_req object has to be properly filled and a
30 * pointer to it has to be passed to the IOCTL.
31 *
32 * UBI volume deletion
33 * ~~~~~~~~~~~~~~~~~~~
34 *
35 * To delete a volume, the %UBI_IOCRMVOL IOCTL command of the UBI character
36 * device should be used. A pointer to the 32-bit volume ID hast to be passed
37 * to the IOCTL.
38 *
39 * UBI volume re-size
40 * ~~~~~~~~~~~~~~~~~~
41 *
42 * To re-size a volume, the %UBI_IOCRSVOL IOCTL command of the UBI character
43 * device should be used. A &struct ubi_rsvol_req object has to be properly
44 * filled and a pointer to it has to be passed to the IOCTL.
45 *
46 * UBI volume update
47 * ~~~~~~~~~~~~~~~~~
48 *
49 * Volume update should be done via the %UBI_IOCVOLUP IOCTL command of the
50 * corresponding UBI volume character device. A pointer to a 64-bit update
51 * size should be passed to the IOCTL. After then, UBI expects user to write
52 * this number of bytes to the volume character device. The update is finished
53 * when the claimed number of bytes is passed. So, the volume update sequence
54 * is something like:
55 *
56 * fd = open("/dev/my_volume");
57 * ioctl(fd, UBI_IOCVOLUP, &image_size);
58 * write(fd, buf, image_size);
59 * close(fd);
60 */
61
62/*
63 * When a new volume is created, users may either specify the volume number they
64 * want to create or to let UBI automatically assign a volume number using this
65 * constant.
66 */
67#define UBI_VOL_NUM_AUTO (-1)
68
69/* Maximum volume name length */
70#define UBI_MAX_VOLUME_NAME 127
71
72/* IOCTL commands of UBI character devices */
73
74#define UBI_IOC_MAGIC 'o'
75
76/* Create an UBI volume */
77#define UBI_IOCMKVOL _IOW(UBI_IOC_MAGIC, 0, struct ubi_mkvol_req)
78/* Remove an UBI volume */
79#define UBI_IOCRMVOL _IOW(UBI_IOC_MAGIC, 1, int32_t)
80/* Re-size an UBI volume */
81#define UBI_IOCRSVOL _IOW(UBI_IOC_MAGIC, 2, struct ubi_rsvol_req)
82
83/* IOCTL commands of UBI volume character devices */
84
85#define UBI_VOL_IOC_MAGIC 'O'
86
87/* Start UBI volume update */
88#define UBI_IOCVOLUP _IOW(UBI_VOL_IOC_MAGIC, 0, int64_t)
89/* An eraseblock erasure command, used for debugging, disabled by default */
90#define UBI_IOCEBER _IOW(UBI_VOL_IOC_MAGIC, 1, int32_t)
91
92/*
93 * UBI volume type constants.
94 *
95 * @UBI_DYNAMIC_VOLUME: dynamic volume
96 * @UBI_STATIC_VOLUME: static volume
97 */
98enum {
99 UBI_DYNAMIC_VOLUME = 3,
100 UBI_STATIC_VOLUME = 4
101};
102
103/**
104 * struct ubi_mkvol_req - volume description data structure used in
105 * volume creation requests.
106 * @vol_id: volume number
107 * @alignment: volume alignment
108 * @bytes: volume size in bytes
109 * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
110 * @padding1: reserved for future, not used
111 * @name_len: volume name length
112 * @padding2: reserved for future, not used
113 * @name: volume name
114 *
115 * This structure is used by userspace programs when creating new volumes. The
116 * @used_bytes field is only necessary when creating static volumes.
117 *
118 * The @alignment field specifies the required alignment of the volume logical
119 * eraseblock. This means, that the size of logical eraseblocks will be aligned
120 * to this number, i.e.,
121 * (UBI device logical eraseblock size) mod (@alignment) = 0.
122 *
123 * To put it differently, the logical eraseblock of this volume may be slightly
124 * shortened in order to make it properly aligned. The alignment has to be
125 * multiple of the flash minimal input/output unit, or %1 to utilize the entire
126 * available space of logical eraseblocks.
127 *
128 * The @alignment field may be useful, for example, when one wants to maintain
129 * a block device on top of an UBI volume. In this case, it is desirable to fit
130 * an integer number of blocks in logical eraseblocks of this UBI volume. With
131 * alignment it is possible to update this volume using plane UBI volume image
132 * BLOBs, without caring about how to properly align them.
133 */
134struct ubi_mkvol_req {
135 int32_t vol_id;
136 int32_t alignment;
137 int64_t bytes;
138 int8_t vol_type;
139 int8_t padding1;
140 int16_t name_len;
141 int8_t padding2[4];
142 char name[UBI_MAX_VOLUME_NAME+1];
143} __attribute__ ((packed));
144
145/**
146 * struct ubi_rsvol_req - a data structure used in volume re-size requests.
147 * @vol_id: ID of the volume to re-size
148 * @bytes: new size of the volume in bytes
149 *
150 * Re-sizing is possible for both dynamic and static volumes. But while dynamic
151 * volumes may be re-sized arbitrarily, static volumes cannot be made to be
152 * smaller then the number of bytes they bear. To arbitrarily shrink a static
153 * volume, it must be wiped out first (by means of volume update operation with
154 * zero number of bytes).
155 */
156struct ubi_rsvol_req {
157 int64_t bytes;
158 int32_t vol_id;
159} __attribute__ ((packed));
160
161#endif /* __UBI_USER_H__ */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 88df8fc814e4..f3531d0bcd05 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -73,7 +73,9 @@ extern int ipv6_get_saddr(struct dst_entry *dst,
73extern int ipv6_dev_get_saddr(struct net_device *dev, 73extern int ipv6_dev_get_saddr(struct net_device *dev,
74 struct in6_addr *daddr, 74 struct in6_addr *daddr,
75 struct in6_addr *saddr); 75 struct in6_addr *saddr);
76extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *); 76extern int ipv6_get_lladdr(struct net_device *dev,
77 struct in6_addr *addr,
78 unsigned char banned_flags);
77extern int ipv6_rcv_saddr_equal(const struct sock *sk, 79extern int ipv6_rcv_saddr_equal(const struct sock *sk,
78 const struct sock *sk2); 80 const struct sock *sk2);
79extern void addrconf_join_solict(struct net_device *dev, 81extern void addrconf_join_solict(struct net_device *dev,
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h
new file mode 100644
index 000000000000..00c2eaa07c25
--- /dev/null
+++ b/include/net/af_rxrpc.h
@@ -0,0 +1,57 @@
1/* RxRPC kernel service interface definitions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _NET_RXRPC_H
13#define _NET_RXRPC_H
14
15#ifdef __KERNEL__
16
17#include <linux/rxrpc.h>
18
19struct rxrpc_call;
20
21/*
22 * the mark applied to socket buffers that may be intercepted
23 */
24enum {
25 RXRPC_SKB_MARK_DATA, /* data message */
26 RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */
27 RXRPC_SKB_MARK_BUSY, /* server busy message */
28 RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */
29 RXRPC_SKB_MARK_NET_ERROR, /* network error message */
30 RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */
31 RXRPC_SKB_MARK_NEW_CALL, /* local error message */
32};
33
34typedef void (*rxrpc_interceptor_t)(struct sock *, unsigned long,
35 struct sk_buff *);
36extern void rxrpc_kernel_intercept_rx_messages(struct socket *,
37 rxrpc_interceptor_t);
38extern struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
39 struct sockaddr_rxrpc *,
40 struct key *,
41 unsigned long,
42 gfp_t);
43extern int rxrpc_kernel_send_data(struct rxrpc_call *, struct msghdr *,
44 size_t);
45extern void rxrpc_kernel_abort_call(struct rxrpc_call *, u32);
46extern void rxrpc_kernel_end_call(struct rxrpc_call *);
47extern bool rxrpc_kernel_is_data_last(struct sk_buff *);
48extern u32 rxrpc_kernel_get_abort_code(struct sk_buff *);
49extern int rxrpc_kernel_get_error_number(struct sk_buff *);
50extern void rxrpc_kernel_data_delivered(struct sk_buff *);
51extern void rxrpc_kernel_free_skb(struct sk_buff *);
52extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *,
53 unsigned long);
54extern int rxrpc_kernel_reject_call(struct socket *);
55
56#endif /* __KERNEL__ */
57#endif /* _NET_RXRPC_H */
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 5ae10dd2e32e..99a4e364c74a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -263,8 +263,8 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25)
263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) 263static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
264{ 264{
265 skb->dev = dev; 265 skb->dev = dev;
266 skb_reset_mac_header(skb);
266 skb->pkt_type = PACKET_HOST; 267 skb->pkt_type = PACKET_HOST;
267 skb->mac.raw = skb->data;
268 return htons(ETH_P_AX25); 268 return htons(ETH_P_AX25);
269} 269}
270 270
@@ -377,7 +377,7 @@ extern int ax25_check_iframes_acked(ax25_cb *, unsigned short);
377/* ax25_route.c */ 377/* ax25_route.c */
378extern void ax25_rt_device_down(struct net_device *); 378extern void ax25_rt_device_down(struct net_device *);
379extern int ax25_rt_ioctl(unsigned int, void __user *); 379extern int ax25_rt_ioctl(unsigned int, void __user *);
380extern struct file_operations ax25_route_fops; 380extern const struct file_operations ax25_route_fops;
381extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); 381extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev);
382extern int ax25_rt_autobind(ax25_cb *, ax25_address *); 382extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
383extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); 383extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
@@ -430,7 +430,7 @@ extern unsigned long ax25_display_timer(struct timer_list *);
430extern int ax25_uid_policy; 430extern int ax25_uid_policy;
431extern ax25_uid_assoc *ax25_findbyuid(uid_t); 431extern ax25_uid_assoc *ax25_findbyuid(uid_t);
432extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); 432extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
433extern struct file_operations ax25_uid_fops; 433extern const struct file_operations ax25_uid_fops;
434extern void ax25_uid_free(void); 434extern void ax25_uid_free(void);
435 435
436/* sysctl_net_ax25.c */ 436/* sysctl_net_ax25.c */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 41456c148842..93ce272a5d27 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -709,6 +709,24 @@ struct hci_sco_hdr {
709 __u8 dlen; 709 __u8 dlen;
710} __attribute__ ((packed)); 710} __attribute__ ((packed));
711 711
712#ifdef __KERNEL__
713#include <linux/skbuff.h>
714static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb)
715{
716 return (struct hci_event_hdr *)skb->data;
717}
718
719static inline struct hci_acl_hdr *hci_acl_hdr(const struct sk_buff *skb)
720{
721 return (struct hci_acl_hdr *)skb->data;
722}
723
724static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb)
725{
726 return (struct hci_sco_hdr *)skb->data;
727}
728#endif
729
712/* Command opcode pack/unpack */ 730/* Command opcode pack/unpack */
713#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) 731#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
714#define hci_opcode_ogf(op) (op >> 10) 732#define hci_opcode_ogf(op) (op >> 10)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
new file mode 100644
index 000000000000..88171f8ce58a
--- /dev/null
+++ b/include/net/cfg80211.h
@@ -0,0 +1,40 @@
1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
3
4#include <linux/netlink.h>
5#include <linux/skbuff.h>
6#include <net/genetlink.h>
7
8/*
9 * 802.11 configuration in-kernel interface
10 *
11 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
12 */
13
14/* from net/wireless.h */
15struct wiphy;
16
17/**
18 * struct cfg80211_ops - backend description for wireless configuration
19 *
20 * This struct is registered by fullmac card drivers and/or wireless stacks
21 * in order to handle configuration requests on their interfaces.
22 *
23 * All callbacks except where otherwise noted should return 0
24 * on success or a negative error code.
25 *
26 * All operations are currently invoked under rtnl for consistency with the
27 * wireless extensions but this is subject to reevaluation as soon as this
28 * code is used more widely and we have a first user without wext.
29 *
30 * @add_virtual_intf: create a new virtual interface with the given name
31 *
32 * @del_virtual_intf: remove the virtual interface determined by ifindex.
33 */
34struct cfg80211_ops {
35 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
36 unsigned int type);
37 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
38};
39
40#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index 4c9522c5178f..4f90f5554fac 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -120,7 +120,7 @@ extern int cipso_v4_rbm_strictvalid;
120 */ 120 */
121 121
122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0) 122#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0)
123#define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso) 123#define CIPSO_V4_OPTPTR(x) (skb_network_header(x) + IPCB(x)->opt.cipso)
124 124
125/* 125/*
126 * DOI List Functions 126 * DOI List Functions
diff --git a/include/net/compat.h b/include/net/compat.h
index 9859b60280d5..406db242f73a 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -25,6 +25,7 @@ struct compat_cmsghdr {
25}; 25};
26 26
27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 27extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
28extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
28 29
29#else /* defined(CONFIG_COMPAT) */ 30#else /* defined(CONFIG_COMPAT) */
30#define compat_msghdr msghdr /* to avoid compiler warnings */ 31#define compat_msghdr msghdr /* to avoid compiler warnings */
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index f01626cbbed6..30125119c950 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -148,17 +148,8 @@ extern void dn_fib_rules_cleanup(void);
148extern unsigned dnet_addr_type(__le16 addr); 148extern unsigned dnet_addr_type(__le16 addr);
149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); 149extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res);
150 150
151/*
152 * rtnetlink interface
153 */
154extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
155extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
156extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 151extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
157 152
158extern int dn_fib_rtm_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
159extern int dn_fib_rtm_newrule(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
160extern int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb);
161
162extern void dn_fib_free_info(struct dn_fib_info *fi); 153extern void dn_fib_free_info(struct dn_fib_info *fi);
163 154
164static inline void dn_fib_info_put(struct dn_fib_info *fi) 155static inline void dn_fib_info_put(struct dn_fib_info *fi)
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 76f957e258b0..c10e8e7e59a7 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -18,7 +18,6 @@
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
22extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
23 22
24/* Masks for flags field */ 23/* Masks for flags field */
@@ -68,9 +67,10 @@ extern void dn_rt_cache_flush(int delay);
68struct dn_route { 67struct dn_route {
69 union { 68 union {
70 struct dst_entry dst; 69 struct dst_entry dst;
71 struct dn_route *rt_next;
72 } u; 70 } u;
73 71
72 struct flowi fl;
73
74 __le16 rt_saddr; 74 __le16 rt_saddr;
75 __le16 rt_daddr; 75 __le16 rt_daddr;
76 __le16 rt_gateway; 76 __le16 rt_gateway;
@@ -80,8 +80,6 @@ struct dn_route {
80 80
81 unsigned rt_flags; 81 unsigned rt_flags;
82 unsigned rt_type; 82 unsigned rt_type;
83
84 struct flowi fl;
85}; 83};
86 84
87extern void dn_route_init(void); 85extern void dn_route_init(void);
diff --git a/include/net/dst.h b/include/net/dst.h
index 62b7e7598e9a..e12a8ce0b9b3 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -37,9 +37,7 @@ struct sk_buff;
37 37
38struct dst_entry 38struct dst_entry
39{ 39{
40 struct dst_entry *next; 40 struct rcu_head rcu_head;
41 atomic_t __refcnt; /* client references */
42 int __use;
43 struct dst_entry *child; 41 struct dst_entry *child;
44 struct net_device *dev; 42 struct net_device *dev;
45 short error; 43 short error;
@@ -50,7 +48,6 @@ struct dst_entry
50#define DST_NOPOLICY 4 48#define DST_NOPOLICY 4
51#define DST_NOHASH 8 49#define DST_NOHASH 8
52#define DST_BALANCED 0x10 50#define DST_BALANCED 0x10
53 unsigned long lastuse;
54 unsigned long expires; 51 unsigned long expires;
55 52
56 unsigned short header_len; /* more space at head required */ 53 unsigned short header_len; /* more space at head required */
@@ -75,8 +72,16 @@ struct dst_entry
75#endif 72#endif
76 73
77 struct dst_ops *ops; 74 struct dst_ops *ops;
78 struct rcu_head rcu_head;
79 75
76 unsigned long lastuse;
77 atomic_t __refcnt; /* client references */
78 int __use;
79 union {
80 struct dst_entry *next;
81 struct rtable *rt_next;
82 struct rt6_info *rt6_next;
83 struct dn_route *dn_next;
84 };
80 char info[0]; 85 char info[0];
81}; 86};
82 87
diff --git a/include/net/esp.h b/include/net/esp.h
index 713d039f4af7..d05d8d2c78f4 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -40,8 +40,6 @@ struct esp_data
40 } auth; 40 } auth;
41}; 41};
42 42
43extern int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len);
44extern int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
45extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 43extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
46 44
47static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb, 45static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index bc3c26494c3d..ed3a8872c6ca 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -5,7 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 6#include <linux/fib_rules.h>
7#include <net/flow.h> 7#include <net/flow.h>
8#include <net/netlink.h> 8#include <net/rtnetlink.h>
9 9
10struct fib_rule 10struct fib_rule
11{ 11{
@@ -19,6 +19,8 @@ struct fib_rule
19 u32 flags; 19 u32 flags;
20 u32 table; 20 u32 table;
21 u8 action; 21 u8 action;
22 u32 target;
23 struct fib_rule * ctarget;
22 struct rcu_head rcu; 24 struct rcu_head rcu;
23}; 25};
24 26
@@ -34,6 +36,9 @@ struct fib_rules_ops
34 int family; 36 int family;
35 struct list_head list; 37 struct list_head list;
36 int rule_size; 38 int rule_size;
39 int addr_size;
40 int unresolved_rules;
41 int nr_goto_rules;
37 42
38 int (*action)(struct fib_rule *, 43 int (*action)(struct fib_rule *,
39 struct flowi *, int, 44 struct flowi *, int,
@@ -54,6 +59,10 @@ struct fib_rules_ops
54 u32 (*default_pref)(void); 59 u32 (*default_pref)(void);
55 size_t (*nlmsg_payload)(struct fib_rule *); 60 size_t (*nlmsg_payload)(struct fib_rule *);
56 61
62 /* Called after modifications to the rules set, must flush
63 * the route cache if one exists. */
64 void (*flush_cache)(void);
65
57 int nlgroup; 66 int nlgroup;
58 struct nla_policy *policy; 67 struct nla_policy *policy;
59 struct list_head *rules_list; 68 struct list_head *rules_list;
@@ -65,7 +74,8 @@ struct fib_rules_ops
65 [FRA_PRIORITY] = { .type = NLA_U32 }, \ 74 [FRA_PRIORITY] = { .type = NLA_U32 }, \
66 [FRA_FWMARK] = { .type = NLA_U32 }, \ 75 [FRA_FWMARK] = { .type = NLA_U32 }, \
67 [FRA_FWMASK] = { .type = NLA_U32 }, \ 76 [FRA_FWMASK] = { .type = NLA_U32 }, \
68 [FRA_TABLE] = { .type = NLA_U32 } 77 [FRA_TABLE] = { .type = NLA_U32 }, \
78 [FRA_GOTO] = { .type = NLA_U32 }
69 79
70static inline void fib_rule_get(struct fib_rule *rule) 80static inline void fib_rule_get(struct fib_rule *rule)
71{ 81{
@@ -97,11 +107,4 @@ extern int fib_rules_unregister(struct fib_rules_ops *);
97extern int fib_rules_lookup(struct fib_rules_ops *, 107extern int fib_rules_lookup(struct fib_rules_ops *,
98 struct flowi *, int flags, 108 struct flowi *, int flags,
99 struct fib_lookup_arg *); 109 struct fib_lookup_arg *);
100
101extern int fib_nl_newrule(struct sk_buff *,
102 struct nlmsghdr *, void *);
103extern int fib_nl_delrule(struct sk_buff *,
104 struct nlmsghdr *, void *);
105extern int fib_rules_dump(struct sk_buff *,
106 struct netlink_callback *, int);
107#endif 110#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index ce4b10d8b412..f3cc1f812619 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -97,4 +97,10 @@ extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir,
97extern void flow_cache_flush(void); 97extern void flow_cache_flush(void);
98extern atomic_t flow_cache_genid; 98extern atomic_t flow_cache_genid;
99 99
100static inline int flow_cache_uli_match(struct flowi *fl1, struct flowi *fl2)
101{
102 return (fl1->proto == fl2->proto &&
103 !memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
104}
105
100#endif 106#endif
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index e02d85f56e60..d56b2923d61a 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -6,8 +6,8 @@
6 * LAN access point) driver for Intersil Prism2/2.5/3. 6 * LAN access point) driver for Intersil Prism2/2.5/3.
7 * 7 *
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9 * <jkmaline@cc.hut.fi> 9 * <j@w1.fi>
10 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 10 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
11 * 11 *
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos 12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com> 13 * <jketreno@linux.intel.com>
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h
index eb476414fd72..b3d65e0bedd3 100644
--- a/include/net/ieee80211_crypt.h
+++ b/include/net/ieee80211_crypt.h
@@ -3,8 +3,8 @@
3 * for Intersil Prism2/2.5/3. 3 * for Intersil Prism2/2.5/3.
4 * 4 *
5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen 5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * <jkmaline@cc.hut.fi> 6 * <j@w1.fi>
7 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> 7 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
8 * 8 *
9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos 9 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
10 * <jketreno@linux.intel.com> 10 * <jketreno@linux.intel.com>
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 429b73892a5f..a0c2b41a24d7 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -66,7 +66,9 @@
66 */ 66 */
67#define IEEE80211_RADIOTAP_HDRLEN 64 67#define IEEE80211_RADIOTAP_HDRLEN 64
68 68
69/* The radio capture header precedes the 802.11 header. */ 69/* The radio capture header precedes the 802.11 header.
70 * All data in the header is little endian on all platforms.
71 */
70struct ieee80211_radiotap_header { 72struct ieee80211_radiotap_header {
71 u8 it_version; /* Version 0. Only increases 73 u8 it_version; /* Version 0. Only increases
72 * for drastic changes, 74 * for drastic changes,
@@ -74,12 +76,12 @@ struct ieee80211_radiotap_header {
74 * new fields does not count. 76 * new fields does not count.
75 */ 77 */
76 u8 it_pad; 78 u8 it_pad;
77 u16 it_len; /* length of the whole 79 __le16 it_len; /* length of the whole
78 * header in bytes, including 80 * header in bytes, including
79 * it_version, it_pad, 81 * it_version, it_pad,
80 * it_len, and data fields. 82 * it_len, and data fields.
81 */ 83 */
82 u32 it_present; /* A bitmap telling which 84 __le32 it_present; /* A bitmap telling which
83 * fields are present. Set bit 31 85 * fields are present. Set bit 31
84 * (0x80000000) to extend the 86 * (0x80000000) to extend the
85 * bitmap by another 32 bits. 87 * bitmap by another 32 bits.
@@ -88,89 +90,102 @@ struct ieee80211_radiotap_header {
88 */ 90 */
89}; 91};
90 92
91/* Name Data type Units 93/* Name Data type Units
92 * ---- --------- ----- 94 * ---- --------- -----
93 * 95 *
94 * IEEE80211_RADIOTAP_TSFT u64 microseconds 96 * IEEE80211_RADIOTAP_TSFT __le64 microseconds
95 * 97 *
96 * Value in microseconds of the MAC's 64-bit 802.11 Time 98 * Value in microseconds of the MAC's 64-bit 802.11 Time
97 * Synchronization Function timer when the first bit of the 99 * Synchronization Function timer when the first bit of the
98 * MPDU arrived at the MAC. For received frames, only. 100 * MPDU arrived at the MAC. For received frames, only.
99 * 101 *
100 * IEEE80211_RADIOTAP_CHANNEL 2 x u16 MHz, bitmap 102 * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap
101 * 103 *
102 * Tx/Rx frequency in MHz, followed by flags (see below). 104 * Tx/Rx frequency in MHz, followed by flags (see below).
103 * 105 *
104 * IEEE80211_RADIOTAP_FHSS u16 see below 106 * IEEE80211_RADIOTAP_FHSS __le16 see below
105 * 107 *
106 * For frequency-hopping radios, the hop set (first byte) 108 * For frequency-hopping radios, the hop set (first byte)
107 * and pattern (second byte). 109 * and pattern (second byte).
108 * 110 *
109 * IEEE80211_RADIOTAP_RATE u8 500kb/s 111 * IEEE80211_RADIOTAP_RATE u8 500kb/s
110 * 112 *
111 * Tx/Rx data rate 113 * Tx/Rx data rate
112 * 114 *
113 * IEEE80211_RADIOTAP_DBM_ANTSIGNAL int8_t decibels from 115 * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from
114 * one milliwatt (dBm) 116 * one milliwatt (dBm)
115 * 117 *
116 * RF signal power at the antenna, decibel difference from 118 * RF signal power at the antenna, decibel difference from
117 * one milliwatt. 119 * one milliwatt.
118 * 120 *
119 * IEEE80211_RADIOTAP_DBM_ANTNOISE int8_t decibels from 121 * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from
120 * one milliwatt (dBm) 122 * one milliwatt (dBm)
121 * 123 *
122 * RF noise power at the antenna, decibel difference from one 124 * RF noise power at the antenna, decibel difference from one
123 * milliwatt. 125 * milliwatt.
124 * 126 *
125 * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) 127 * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB)
126 * 128 *
127 * RF signal power at the antenna, decibel difference from an 129 * RF signal power at the antenna, decibel difference from an
128 * arbitrary, fixed reference. 130 * arbitrary, fixed reference.
129 * 131 *
130 * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) 132 * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB)
131 * 133 *
132 * RF noise power at the antenna, decibel difference from an 134 * RF noise power at the antenna, decibel difference from an
133 * arbitrary, fixed reference point. 135 * arbitrary, fixed reference point.
134 * 136 *
135 * IEEE80211_RADIOTAP_LOCK_QUALITY u16 unitless 137 * IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless
136 * 138 *
137 * Quality of Barker code lock. Unitless. Monotonically 139 * Quality of Barker code lock. Unitless. Monotonically
138 * nondecreasing with "better" lock strength. Called "Signal 140 * nondecreasing with "better" lock strength. Called "Signal
139 * Quality" in datasheets. (Is there a standard way to measure 141 * Quality" in datasheets. (Is there a standard way to measure
140 * this?) 142 * this?)
141 * 143 *
142 * IEEE80211_RADIOTAP_TX_ATTENUATION u16 unitless 144 * IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless
143 * 145 *
144 * Transmit power expressed as unitless distance from max 146 * Transmit power expressed as unitless distance from max
145 * power set at factory calibration. 0 is max power. 147 * power set at factory calibration. 0 is max power.
146 * Monotonically nondecreasing with lower power levels. 148 * Monotonically nondecreasing with lower power levels.
147 * 149 *
148 * IEEE80211_RADIOTAP_DB_TX_ATTENUATION u16 decibels (dB) 150 * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB)
149 * 151 *
150 * Transmit power expressed as decibel distance from max power 152 * Transmit power expressed as decibel distance from max power
151 * set at factory calibration. 0 is max power. Monotonically 153 * set at factory calibration. 0 is max power. Monotonically
152 * nondecreasing with lower power levels. 154 * nondecreasing with lower power levels.
153 * 155 *
154 * IEEE80211_RADIOTAP_DBM_TX_POWER int8_t decibels from 156 * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from
155 * one milliwatt (dBm) 157 * one milliwatt (dBm)
156 * 158 *
157 * Transmit power expressed as dBm (decibels from a 1 milliwatt 159 * Transmit power expressed as dBm (decibels from a 1 milliwatt
158 * reference). This is the absolute power level measured at 160 * reference). This is the absolute power level measured at
159 * the antenna port. 161 * the antenna port.
160 * 162 *
161 * IEEE80211_RADIOTAP_FLAGS u8 bitmap 163 * IEEE80211_RADIOTAP_FLAGS u8 bitmap
162 * 164 *
163 * Properties of transmitted and received frames. See flags 165 * Properties of transmitted and received frames. See flags
164 * defined below. 166 * defined below.
165 * 167 *
166 * IEEE80211_RADIOTAP_ANTENNA u8 antenna index 168 * IEEE80211_RADIOTAP_ANTENNA u8 antenna index
167 * 169 *
168 * Unitless indication of the Rx/Tx antenna for this packet. 170 * Unitless indication of the Rx/Tx antenna for this packet.
169 * The first antenna is antenna 0. 171 * The first antenna is antenna 0.
170 * 172 *
171 * IEEE80211_RADIOTAP_FCS u32 data 173 * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap
174 *
175 * Properties of received frames. See flags defined below.
176 *
177 * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap
178 *
179 * Properties of transmitted frames. See flags defined below.
180 *
181 * IEEE80211_RADIOTAP_RTS_RETRIES u8 data
182 *
183 * Number of rts retries a transmitted frame used.
184 *
185 * IEEE80211_RADIOTAP_DATA_RETRIES u8 data
186 *
187 * Number of unicast retries a transmitted frame used.
172 * 188 *
173 * FCS from frame in network byte order.
174 */ 189 */
175enum ieee80211_radiotap_type { 190enum ieee80211_radiotap_type {
176 IEEE80211_RADIOTAP_TSFT = 0, 191 IEEE80211_RADIOTAP_TSFT = 0,
@@ -187,7 +202,11 @@ enum ieee80211_radiotap_type {
187 IEEE80211_RADIOTAP_ANTENNA = 11, 202 IEEE80211_RADIOTAP_ANTENNA = 11,
188 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, 203 IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
189 IEEE80211_RADIOTAP_DB_ANTNOISE = 13, 204 IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
190 IEEE80211_RADIOTAP_EXT = 31, 205 IEEE80211_RADIOTAP_RX_FLAGS = 14,
206 IEEE80211_RADIOTAP_TX_FLAGS = 15,
207 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
208 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
209 IEEE80211_RADIOTAP_EXT = 31
191}; 210};
192 211
193/* Channel flags. */ 212/* Channel flags. */
@@ -219,6 +238,14 @@ enum ieee80211_radiotap_type {
219 * 802.11 header and payload 238 * 802.11 header and payload
220 * (to 32-bit boundary) 239 * (to 32-bit boundary)
221 */ 240 */
241/* For IEEE80211_RADIOTAP_RX_FLAGS */
242#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
243
244/* For IEEE80211_RADIOTAP_TX_FLAGS */
245#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive
246 * retries */
247#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
248#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
222 249
223/* Ugly macro to convert literal channel numbers into their mhz equivalents 250/* Ugly macro to convert literal channel numbers into their mhz equivalents
224 * There are certianly some conditions that will break this (like feeding it '30') 251 * There are certianly some conditions that will break this (like feeding it '30')
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index c28e424f53d9..668056b4bb0b 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -19,6 +19,9 @@
19#include <linux/in6.h> 19#include <linux/in6.h>
20#include <linux/ipv6.h> 20#include <linux/ipv6.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
23
24#include <net/inet_sock.h>
22 25
23#include <net/ipv6.h> 26#include <net/ipv6.h>
24 27
@@ -28,12 +31,11 @@ struct inet_hashinfo;
28static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, 31static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport,
29 const struct in6_addr *faddr, const __be16 fport) 32 const struct in6_addr *faddr, const __be16 fport)
30{ 33{
31 unsigned int hashent = (lport ^ (__force u16)fport); 34 u32 ports = (lport ^ (__force u16)fport);
32 35
33 hashent ^= (__force u32)(laddr->s6_addr32[3] ^ faddr->s6_addr32[3]); 36 return jhash_3words((__force u32)laddr->s6_addr32[3],
34 hashent ^= hashent >> 16; 37 (__force u32)faddr->s6_addr32[3],
35 hashent ^= hashent >> 8; 38 ports, inet_ehash_secret);
36 return hashent;
37} 39}
38 40
39static inline int inet6_sk_ehashfn(const struct sock *sk) 41static inline int inet6_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 10117c8503e8..de8399a79774 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -114,13 +114,13 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
114{ 114{
115 switch (skb->protocol) { 115 switch (skb->protocol) {
116 case __constant_htons(ETH_P_IP): 116 case __constant_htons(ETH_P_IP):
117 if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail) 117 if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
118 return IP_ECN_set_ce(skb->nh.iph); 118 return IP_ECN_set_ce(ip_hdr(skb));
119 break; 119 break;
120 120
121 case __constant_htons(ETH_P_IPV6): 121 case __constant_htons(ETH_P_IPV6):
122 if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail) 122 if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
123 return IP6_ECN_set_ce(skb->nh.ipv6h); 123 return IP6_ECN_set_ce(ipv6_hdr(skb));
124 break; 124 break;
125 } 125 }
126 126
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 34cc76e3ddb4..d27ee8c0da3f 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -34,12 +34,13 @@
34#include <asm/byteorder.h> 34#include <asm/byteorder.h>
35 35
36/* This is for all connections with a full identity, no wildcards. 36/* This is for all connections with a full identity, no wildcards.
37 * New scheme, half the table is for TIME_WAIT, the other half is 37 * One chain is dedicated to TIME_WAIT sockets.
38 * for the rest. I'll experiment with dynamic table growth later. 38 * I'll experiment with dynamic table growth later.
39 */ 39 */
40struct inet_ehash_bucket { 40struct inet_ehash_bucket {
41 rwlock_t lock; 41 rwlock_t lock;
42 struct hlist_head chain; 42 struct hlist_head chain;
43 struct hlist_head twchain;
43}; 44};
44 45
45/* There are a few simple rules, which allow for local port reuse by 46/* There are a few simple rules, which allow for local port reuse by
@@ -97,8 +98,7 @@ struct inet_hashinfo {
97 * 98 *
98 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE 99 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
99 * 100 *
100 * First half of the table is for sockets not in TIME_WAIT, second half 101 * TIME_WAIT sockets use a separate chain (twchain).
101 * is for TIME_WAIT sockets only.
102 */ 102 */
103 struct inet_ehash_bucket *ehash; 103 struct inet_ehash_bucket *ehash;
104 104
@@ -369,7 +369,7 @@ static inline struct sock *
369 } 369 }
370 370
371 /* Must check for a TIME_WAIT'er before going to listener hash. */ 371 /* Must check for a TIME_WAIT'er before going to listener hash. */
372 sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { 372 sk_for_each(sk, node, &head->twchain) {
373 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) 373 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif))
374 goto hit; 374 goto hit;
375 } 375 }
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index ce6da97bc848..62daf214931f 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/jhash.h>
22 23
23#include <net/flow.h> 24#include <net/flow.h>
24#include <net/sock.h> 25#include <net/sock.h>
@@ -167,13 +168,15 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
167 168
168extern int inet_sk_rebuild_header(struct sock *sk); 169extern int inet_sk_rebuild_header(struct sock *sk);
169 170
171extern u32 inet_ehash_secret;
172extern void build_ehash_secret(void);
173
170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, 174static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
171 const __be32 faddr, const __be16 fport) 175 const __be32 faddr, const __be16 fport)
172{ 176{
173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport); 177 return jhash_2words((__force __u32) laddr ^ (__force __u32) faddr,
174 h ^= h >> 16; 178 ((__u32) lport) << 16 | (__force __u32)fport,
175 h ^= h >> 8; 179 inet_ehash_secret);
176 return h;
177} 180}
178 181
179static inline int inet_sk_ehashfn(const struct sock *sk) 182static inline int inet_sk_ehashfn(const struct sock *sk)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f7be1ac73601..09a2532699b2 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -66,7 +66,7 @@ struct inet_hashinfo;
66struct inet_timewait_death_row { 66struct inet_timewait_death_row {
67 /* Short-time timewait calendar */ 67 /* Short-time timewait calendar */
68 int twcal_hand; 68 int twcal_hand;
69 int twcal_jiffie; 69 unsigned long twcal_jiffie;
70 struct timer_list twcal_timer; 70 struct timer_list twcal_timer;
71 struct hlist_head twcal_row[INET_TWDR_RECYCLE_SLOTS]; 71 struct hlist_head twcal_row[INET_TWDR_RECYCLE_SLOTS];
72 72
diff --git a/include/net/ip.h b/include/net/ip.h
index e79c3e3aa4f6..bb207db03675 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/ip.h> 26#include <linux/ip.h>
27#include <linux/in.h> 27#include <linux/in.h>
28#include <linux/skbuff.h>
28 29
29#include <net/inet_sock.h> 30#include <net/inet_sock.h>
30#include <net/snmp.h> 31#include <net/snmp.h>
@@ -43,6 +44,11 @@ struct inet_skb_parm
43#define IPSKB_REROUTED 16 44#define IPSKB_REROUTED 16
44}; 45};
45 46
47static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
48{
49 return ip_hdr(skb)->ihl * 4;
50}
51
46struct ipcm_cookie 52struct ipcm_cookie
47{ 53{
48 __be32 addr; 54 __be32 addr;
@@ -74,7 +80,6 @@ struct msghdr;
74struct net_device; 80struct net_device;
75struct packet_type; 81struct packet_type;
76struct rtable; 82struct rtable;
77struct sk_buff;
78struct sockaddr; 83struct sockaddr;
79 84
80extern void ip_mc_dropsocket(struct sock *); 85extern void ip_mc_dropsocket(struct sock *);
@@ -161,6 +166,10 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
161#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd) 166#define NET_ADD_STATS_BH(field, adnd) SNMP_ADD_STATS_BH(net_statistics, field, adnd)
162#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) 167#define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd)
163 168
169extern unsigned long snmp_fold_field(void *mib[], int offt);
170extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
171extern void snmp_mib_free(void *ptr[2]);
172
164extern int sysctl_local_port_range[2]; 173extern int sysctl_local_port_range[2];
165extern int sysctl_ip_default_ttl; 174extern int sysctl_ip_default_ttl;
166extern int sysctl_ip_nonlocal_bind; 175extern int sysctl_ip_nonlocal_bind;
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 7be4f4e3a0f2..c48ea873f1e0 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -58,6 +58,7 @@ struct fib6_node
58 __u16 fn_bit; /* bit key */ 58 __u16 fn_bit; /* bit key */
59 __u16 fn_flags; 59 __u16 fn_flags;
60 __u32 fn_sernum; 60 __u32 fn_sernum;
61 struct rt6_info *rr_ptr;
61}; 62};
62 63
63#ifndef CONFIG_IPV6_SUBTREES 64#ifndef CONFIG_IPV6_SUBTREES
@@ -83,7 +84,6 @@ struct rt6_info
83{ 84{
84 union { 85 union {
85 struct dst_entry dst; 86 struct dst_entry dst;
86 struct rt6_info *next;
87 } u; 87 } u;
88 88
89 struct inet6_dev *rt6i_idev; 89 struct inet6_dev *rt6i_idev;
@@ -219,8 +219,6 @@ extern void fib6_init(void);
219 219
220extern void fib6_rules_init(void); 220extern void fib6_rules_init(void);
221extern void fib6_rules_cleanup(void); 221extern void fib6_rules_cleanup(void);
222extern int fib6_rules_dump(struct sk_buff *,
223 struct netlink_callback *);
224 222
225#endif 223#endif
226#endif 224#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 4e927ebd1cb3..5456fdd6d047 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -116,12 +116,7 @@ extern void rt6_pmtu_discovery(struct in6_addr *daddr,
116 struct net_device *dev, 116 struct net_device *dev,
117 u32 pmtu); 117 u32 pmtu);
118 118
119struct nlmsghdr;
120struct netlink_callback; 119struct netlink_callback;
121extern int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
122extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
123extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
124extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
125 120
126struct rt6_rtnl_dump_arg 121struct rt6_rtnl_dump_arg
127{ 122{
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 36c635ca1aa6..5a4a0366c24f 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -215,10 +215,6 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
215/* Exported by fib_frontend.c */ 215/* Exported by fib_frontend.c */
216extern struct nla_policy rtm_ipv4_policy[]; 216extern struct nla_policy rtm_ipv4_policy[];
217extern void ip_fib_init(void); 217extern void ip_fib_init(void);
218extern int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
219extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
220extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
221extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
222extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
223 struct net_device *dev, __be32 *spec_dst, u32 *itag); 219 struct net_device *dev, __be32 *spec_dst, u32 *itag);
224extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 220extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
@@ -235,8 +231,6 @@ extern __be32 __fib_res_prefsrc(struct fib_result *res);
235extern struct fib_table *fib_hash_init(u32 id); 231extern struct fib_table *fib_hash_init(u32 id);
236 232
237#ifdef CONFIG_IP_MULTIPLE_TABLES 233#ifdef CONFIG_IP_MULTIPLE_TABLES
238extern int fib4_rules_dump(struct sk_buff *skb, struct netlink_callback *cb);
239
240extern void __init fib4_rules_init(void); 234extern void __init fib4_rules_init(void);
241 235
242#ifdef CONFIG_NET_CLS_ROUTE 236#ifdef CONFIG_NET_CLS_ROUTE
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 00328b71a08c..f70afef9c3cc 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -166,13 +166,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ 166 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \
167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) 167 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0)
168 168
169int snmp6_register_dev(struct inet6_dev *idev);
170int snmp6_unregister_dev(struct inet6_dev *idev);
171int snmp6_alloc_dev(struct inet6_dev *idev);
172int snmp6_free_dev(struct inet6_dev *idev);
173int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign);
174void snmp6_mib_free(void *ptr[2]);
175
176struct ip6_ra_chain 169struct ip6_ra_chain
177{ 170{
178 struct ip6_ra_chain *next; 171 struct ip6_ra_chain *next;
@@ -605,8 +598,20 @@ extern int udplite6_proc_init(void);
605extern void udplite6_proc_exit(void); 598extern void udplite6_proc_exit(void);
606extern int ipv6_misc_proc_init(void); 599extern int ipv6_misc_proc_init(void);
607extern void ipv6_misc_proc_exit(void); 600extern void ipv6_misc_proc_exit(void);
601extern int snmp6_register_dev(struct inet6_dev *idev);
602extern int snmp6_unregister_dev(struct inet6_dev *idev);
608 603
609extern struct rt6_statistics rt6_stats; 604extern struct rt6_statistics rt6_stats;
605#else
606static inline int snmp6_register_dev(struct inet6_dev *idev)
607{
608 return 0;
609}
610
611static inline int snmp6_unregister_dev(struct inet6_dev *idev)
612{
613 return 0;
614}
610#endif 615#endif
611 616
612#ifdef CONFIG_SYSCTL 617#ifdef CONFIG_SYSCTL
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c6b2ee610866..4cc0b4eca948 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -43,7 +43,7 @@ struct ipxhdr {
43 43
44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb) 44static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
45{ 45{
46 return (struct ipxhdr *)skb->h.raw; 46 return (struct ipxhdr *)skb_transport_header(skb);
47} 47}
48 48
49struct ipx_interface { 49struct ipx_interface {
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 1cb0607fcbb9..89fe534045f1 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -113,4 +113,20 @@ do { if(!(expr)) { \
113#define IAS_IRCOMM_ID 0x2343 113#define IAS_IRCOMM_ID 0x2343
114#define IAS_IRLPT_ID 0x9876 114#define IAS_IRLPT_ID 0x9876
115 115
116struct net_device;
117struct packet_type;
118
119extern void irda_proc_register(void);
120extern void irda_proc_unregister(void);
121
122extern int irda_sysctl_register(void);
123extern void irda_sysctl_unregister(void);
124
125extern int irsock_init(void);
126extern void irsock_cleanup(void);
127
128extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
129 struct packet_type *ptype,
130 struct net_device *orig_dev);
131
116#endif /* NET_IRDA_H */ 132#endif /* NET_IRDA_H */
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
new file mode 100644
index 000000000000..04d1abb72d25
--- /dev/null
+++ b/include/net/iucv/af_iucv.h
@@ -0,0 +1,106 @@
1/*
2 * Copyright 2006 IBM Corporation
3 * IUCV protocol stack for Linux on zSeries
4 * Version 1.0
5 * Author(s): Jennifer Hunt <jenhunt@us.ibm.com>
6 *
7 */
8
9#ifndef __AFIUCV_H
10#define __AFIUCV_H
11
12#include <asm/types.h>
13#include <asm/byteorder.h>
14#include <linux/list.h>
15#include <linux/poll.h>
16#include <linux/socket.h>
17
18#ifndef AF_IUCV
19#define AF_IUCV 32
20#define PF_IUCV AF_IUCV
21#endif
22
23/* Connection and socket states */
24enum {
25 IUCV_CONNECTED = 1,
26 IUCV_OPEN,
27 IUCV_BOUND,
28 IUCV_LISTEN,
29 IUCV_SEVERED,
30 IUCV_DISCONN,
31 IUCV_CLOSED
32};
33
34#define IUCV_QUEUELEN_DEFAULT 65535
35#define IUCV_CONN_TIMEOUT (HZ * 40)
36#define IUCV_DISCONN_TIMEOUT (HZ * 2)
37#define IUCV_CONN_IDLE_TIMEOUT (HZ * 60)
38#define IUCV_BUFSIZE_DEFAULT 32768
39
40/* IUCV socket address */
41struct sockaddr_iucv {
42 sa_family_t siucv_family;
43 unsigned short siucv_port; /* Reserved */
44 unsigned int siucv_addr; /* Reserved */
45 char siucv_nodeid[8]; /* Reserved */
46 char siucv_user_id[8]; /* Guest User Id */
47 char siucv_name[8]; /* Application Name */
48};
49
50
51/* Common socket structures and functions */
52
53#define iucv_sk(__sk) ((struct iucv_sock *) __sk)
54
55struct iucv_sock {
56 struct sock sk;
57 char src_user_id[8];
58 char src_name[8];
59 char dst_user_id[8];
60 char dst_name[8];
61 struct list_head accept_q;
62 struct sock *parent;
63 struct iucv_path *path;
64 struct sk_buff_head send_skb_q;
65 unsigned int send_tag;
66};
67
68struct iucv_sock_list {
69 struct hlist_head head;
70 rwlock_t lock;
71 atomic_t autobind_name;
72};
73
74static void iucv_sock_destruct(struct sock *sk);
75static void iucv_sock_cleanup_listen(struct sock *parent);
76static void iucv_sock_kill(struct sock *sk);
77static void iucv_sock_close(struct sock *sk);
78static int iucv_sock_create(struct socket *sock, int proto);
79static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
80 int addr_len);
81static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
82 int alen, int flags);
83static int iucv_sock_listen(struct socket *sock, int backlog);
84static int iucv_sock_accept(struct socket *sock, struct socket *newsock,
85 int flags);
86static int iucv_sock_getname(struct socket *sock, struct sockaddr *addr,
87 int *len, int peer);
88static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
89 struct msghdr *msg, size_t len);
90static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
91 struct msghdr *msg, size_t len, int flags);
92unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
93 poll_table *wait);
94static int iucv_sock_release(struct socket *sock);
95static int iucv_sock_shutdown(struct socket *sock, int how);
96
97void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
98void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
99int iucv_sock_wait_state(struct sock *sk, int state, int state2,
100 unsigned long timeo);
101int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
102void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
103void iucv_accept_unlink(struct sock *sk);
104struct sock *iucv_accept_dequeue(struct sock *parent, struct socket *newsock);
105
106#endif /* __IUCV_H */
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
new file mode 100644
index 000000000000..fd70adbb3566
--- /dev/null
+++ b/include/net/iucv/iucv.h
@@ -0,0 +1,415 @@
1/*
2 * drivers/s390/net/iucv.h
3 * IUCV base support.
4 *
5 * S390 version
6 * Copyright 2000, 2006 IBM Corporation
7 * Author(s):Alan Altmark (Alan_Altmark@us.ibm.com)
8 * Xenia Tkatschow (xenia@us.ibm.com)
9 * Rewritten for af_iucv:
10 * Martin Schwidefsky <schwidefsky@de.ibm.com>
11 *
12 *
13 * Functionality:
14 * To explore any of the IUCV functions, one must first register their
15 * program using iucv_register(). Once your program has successfully
16 * completed a register, it can exploit the other functions.
17 * For furthur reference on all IUCV functionality, refer to the
18 * CP Programming Services book, also available on the web thru
19 * www.vm.ibm.com/pubs, manual # SC24-6084
20 *
21 * Definition of Return Codes
22 * - All positive return codes including zero are reflected back
23 * from CP. The definition of each return code can be found in
24 * CP Programming Services book.
25 * - Return Code of:
26 * -EINVAL: Invalid value
27 * -ENOMEM: storage allocation failed
28 */
29
30#include <linux/types.h>
31#include <asm/debug.h>
32
33/*
34 * IUCV option flags usable by device drivers:
35 *
36 * IUCV_IPRMDATA Indicates that your program can handle a message in the
37 * parameter list / a message is sent in the parameter list.
38 * Used for iucv_path_accept, iucv_path_connect,
39 * iucv_message_reply, iucv_message_send, iucv_message_send2way.
40 * IUCV_IPQUSCE Indicates that you do not want to receive messages on this
41 * path until an iucv_path_resume is issued.
42 * Used for iucv_path_accept, iucv_path_connect.
43 * IUCV_IPBUFLST Indicates that an address list is used for the message data.
44 * Used for iucv_message_receive, iucv_message_send,
45 * iucv_message_send2way.
46 * IUCV_IPPRTY Specifies that you want to send priority messages.
47 * Used for iucv_path_accept, iucv_path_connect,
48 * iucv_message_reply, iucv_message_send, iucv_message_send2way.
49 * IUCV_IPSYNC Indicates a synchronous send request.
50 * Used for iucv_message_send, iucv_message_send2way.
51 * IUCV_IPANSLST Indicates that an address list is used for the reply data.
52 * Used for iucv_message_reply, iucv_message_send2way.
53 * IUCV_IPLOCAL Specifies that the communication partner has to be on the
54 * local system. If local is specified no target class can be
55 * specified.
56 * Used for iucv_path_connect.
57 *
58 * All flags are defined in the input field IPFLAGS1 of each function
59 * and can be found in CP Programming Services.
60 */
61#define IUCV_IPRMDATA 0x80
62#define IUCV_IPQUSCE 0x40
63#define IUCV_IPBUFLST 0x40
64#define IUCV_IPPRTY 0x20
65#define IUCV_IPANSLST 0x08
66#define IUCV_IPSYNC 0x04
67#define IUCV_IPLOCAL 0x01
68
69/*
70 * iucv_array : Defines buffer array.
71 * Inside the array may be 31- bit addresses and 31-bit lengths.
72 * Use a pointer to an iucv_array as the buffer, reply or answer
73 * parameter on iucv_message_send, iucv_message_send2way, iucv_message_receive
74 * and iucv_message_reply if IUCV_IPBUFLST or IUCV_IPANSLST are used.
75 */
76struct iucv_array {
77 u32 address;
78 u32 length;
79} __attribute__ ((aligned (8)));
80
81extern struct bus_type iucv_bus;
82extern struct device *iucv_root;
83
84/*
85 * struct iucv_path
86 * pathid: 16 bit path identification
87 * msglim: 16 bit message limit
88 * flags: properties of the path: IPRMDATA, IPQUSCE, IPPRTY
89 * handler: address of iucv handler structure
90 * private: private information of the handler associated with the path
91 * list: list_head for the iucv_handler path list.
92 */
93struct iucv_path {
94 u16 pathid;
95 u16 msglim;
96 u8 flags;
97 void *private;
98 struct iucv_handler *handler;
99 struct list_head list;
100};
101
102/*
103 * struct iucv_message
104 * id: 32 bit message id
105 * audit: 32 bit error information of purged or replied messages
106 * class: 32 bit target class of a message (source class for replies)
107 * tag: 32 bit tag to be associated with the message
108 * length: 32 bit length of the message / reply
109 * reply_size: 32 bit maximum allowed length of the reply
110 * rmmsg: 8 byte inline message
111 * flags: message properties (IUCV_IPPRTY)
112 */
113struct iucv_message {
114 u32 id;
115 u32 audit;
116 u32 class;
117 u32 tag;
118 u32 length;
119 u32 reply_size;
120 u8 rmmsg[8];
121 u8 flags;
122};
123
124/*
125 * struct iucv_handler
126 *
127 * A vector of functions that handle IUCV interrupts. Each functions gets
128 * a parameter area as defined by the CP Programming Services and private
129 * pointer that is provided by the user of the interface.
130 */
131struct iucv_handler {
132 /*
133 * The path_pending function is called after an iucv interrupt
134 * type 0x01 has been received. The base code allocates a path
135 * structure and "asks" the handler if this path belongs to the
136 * handler. To accept the path the path_pending function needs
137 * to call iucv_path_accept and return 0. If the callback returns
138 * a value != 0 the iucv base code will continue with the next
139 * handler. The order in which the path_pending functions are
140 * called is the order of the registration of the iucv handlers
141 * to the base code.
142 */
143 int (*path_pending)(struct iucv_path *, u8 ipvmid[8], u8 ipuser[16]);
144 /*
145 * The path_complete function is called after an iucv interrupt
146 * type 0x02 has been received for a path that has been established
147 * for this handler with iucv_path_connect and got accepted by the
148 * peer with iucv_path_accept.
149 */
150 void (*path_complete)(struct iucv_path *, u8 ipuser[16]);
151 /*
152 * The path_severed function is called after an iucv interrupt
153 * type 0x03 has been received. The communication peer shutdown
154 * his end of the communication path. The path still exists and
155 * remaining messages can be received until a iucv_path_sever
156 * shuts down the other end of the path as well.
157 */
158 void (*path_severed)(struct iucv_path *, u8 ipuser[16]);
159 /*
160 * The path_quiesced function is called after an icuv interrupt
161 * type 0x04 has been received. The communication peer has quiesced
162 * the path. Delivery of messages is stopped until iucv_path_resume
163 * has been called.
164 */
165 void (*path_quiesced)(struct iucv_path *, u8 ipuser[16]);
166 /*
167 * The path_resumed function is called after an icuv interrupt
168 * type 0x05 has been received. The communication peer has resumed
169 * the path.
170 */
171 void (*path_resumed)(struct iucv_path *, u8 ipuser[16]);
172 /*
173 * The message_pending function is called after an icuv interrupt
174 * type 0x06 or type 0x07 has been received. A new message is
175 * availabe and can be received with iucv_message_receive.
176 */
177 void (*message_pending)(struct iucv_path *, struct iucv_message *);
178 /*
179 * The message_complete function is called after an icuv interrupt
180 * type 0x08 or type 0x09 has been received. A message send with
181 * iucv_message_send2way has been replied to. The reply can be
182 * received with iucv_message_receive.
183 */
184 void (*message_complete)(struct iucv_path *, struct iucv_message *);
185
186 struct list_head list;
187 struct list_head paths;
188};
189
190/**
191 * iucv_register:
192 * @handler: address of iucv handler structure
193 * @smp: != 0 indicates that the handler can deal with out of order messages
194 *
195 * Registers a driver with IUCV.
196 *
197 * Returns 0 on success, -ENOMEM if the memory allocation for the pathid
198 * table failed, or -EIO if IUCV_DECLARE_BUFFER failed on all cpus.
199 */
200int iucv_register(struct iucv_handler *handler, int smp);
201
202/**
203 * iucv_unregister
204 * @handler: address of iucv handler structure
205 * @smp: != 0 indicates that the handler can deal with out of order messages
206 *
207 * Unregister driver from IUCV.
208 */
209void iucv_unregister(struct iucv_handler *handle, int smp);
210
211/**
212 * iucv_path_alloc
213 * @msglim: initial message limit
214 * @flags: initial flags
215 * @gfp: kmalloc allocation flag
216 *
217 * Allocate a new path structure for use with iucv_connect.
218 *
219 * Returns NULL if the memory allocation failed or a pointer to the
220 * path structure.
221 */
222static inline struct iucv_path *iucv_path_alloc(u16 msglim, u8 flags, gfp_t gfp)
223{
224 struct iucv_path *path;
225
226 path = kzalloc(sizeof(struct iucv_path), gfp);
227 if (path) {
228 path->msglim = msglim;
229 path->flags = flags;
230 }
231 return path;
232}
233
234/**
235 * iucv_path_free
236 * @path: address of iucv path structure
237 *
238 * Frees a path structure.
239 */
240static inline void iucv_path_free(struct iucv_path *path)
241{
242 kfree(path);
243}
244
245/**
246 * iucv_path_accept
247 * @path: address of iucv path structure
248 * @handler: address of iucv handler structure
249 * @userdata: 16 bytes of data reflected to the communication partner
250 * @private: private data passed to interrupt handlers for this path
251 *
252 * This function is issued after the user received a connection pending
253 * external interrupt and now wishes to complete the IUCV communication path.
254 *
255 * Returns the result of the CP IUCV call.
256 */
257int iucv_path_accept(struct iucv_path *path, struct iucv_handler *handler,
258 u8 userdata[16], void *private);
259
260/**
261 * iucv_path_connect
262 * @path: address of iucv path structure
263 * @handler: address of iucv handler structure
264 * @userid: 8-byte user identification
265 * @system: 8-byte target system identification
266 * @userdata: 16 bytes of data reflected to the communication partner
267 * @private: private data passed to interrupt handlers for this path
268 *
269 * This function establishes an IUCV path. Although the connect may complete
270 * successfully, you are not able to use the path until you receive an IUCV
271 * Connection Complete external interrupt.
272 *
273 * Returns the result of the CP IUCV call.
274 */
275int iucv_path_connect(struct iucv_path *path, struct iucv_handler *handler,
276 u8 userid[8], u8 system[8], u8 userdata[16],
277 void *private);
278
279/**
280 * iucv_path_quiesce:
281 * @path: address of iucv path structure
282 * @userdata: 16 bytes of data reflected to the communication partner
283 *
284 * This function temporarily suspends incoming messages on an IUCV path.
285 * You can later reactivate the path by invoking the iucv_resume function.
286 *
287 * Returns the result from the CP IUCV call.
288 */
289int iucv_path_quiesce(struct iucv_path *path, u8 userdata[16]);
290
291/**
292 * iucv_path_resume:
293 * @path: address of iucv path structure
294 * @userdata: 16 bytes of data reflected to the communication partner
295 *
296 * This function resumes incoming messages on an IUCV path that has
297 * been stopped with iucv_path_quiesce.
298 *
299 * Returns the result from the CP IUCV call.
300 */
301int iucv_path_resume(struct iucv_path *path, u8 userdata[16]);
302
303/**
304 * iucv_path_sever
305 * @path: address of iucv path structure
306 * @userdata: 16 bytes of data reflected to the communication partner
307 *
308 * This function terminates an IUCV path.
309 *
310 * Returns the result from the CP IUCV call.
311 */
312int iucv_path_sever(struct iucv_path *path, u8 userdata[16]);
313
314/**
315 * iucv_message_purge
316 * @path: address of iucv path structure
317 * @msg: address of iucv msg structure
318 * @srccls: source class of message
319 *
320 * Cancels a message you have sent.
321 *
322 * Returns the result from the CP IUCV call.
323 */
324int iucv_message_purge(struct iucv_path *path, struct iucv_message *msg,
325 u32 srccls);
326
327/**
328 * iucv_message_receive
329 * @path: address of iucv path structure
330 * @msg: address of iucv msg structure
331 * @flags: flags that affect how the message is received (IUCV_IPBUFLST)
332 * @buffer: address of data buffer or address of struct iucv_array
333 * @size: length of data buffer
334 * @residual:
335 *
336 * This function receives messages that are being sent to you over
337 * established paths. This function will deal with RMDATA messages
338 * embedded in struct iucv_message as well.
339 *
340 * Returns the result from the CP IUCV call.
341 */
342int iucv_message_receive(struct iucv_path *path, struct iucv_message *msg,
343 u8 flags, void *buffer, size_t size, size_t *residual);
344
345/**
346 * iucv_message_reject
347 * @path: address of iucv path structure
348 * @msg: address of iucv msg structure
349 *
350 * The reject function refuses a specified message. Between the time you
351 * are notified of a message and the time that you complete the message,
352 * the message may be rejected.
353 *
354 * Returns the result from the CP IUCV call.
355 */
356int iucv_message_reject(struct iucv_path *path, struct iucv_message *msg);
357
358/**
359 * iucv_message_reply
360 * @path: address of iucv path structure
361 * @msg: address of iucv msg structure
362 * @flags: how the reply is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
363 * @reply: address of data buffer or address of struct iucv_array
364 * @size: length of reply data buffer
365 *
366 * This function responds to the two-way messages that you receive. You
367 * must identify completely the message to which you wish to reply. ie,
368 * pathid, msgid, and trgcls. Prmmsg signifies the data is moved into
369 * the parameter list.
370 *
371 * Returns the result from the CP IUCV call.
372 */
373int iucv_message_reply(struct iucv_path *path, struct iucv_message *msg,
374 u8 flags, void *reply, size_t size);
375
376/**
377 * iucv_message_send
378 * @path: address of iucv path structure
379 * @msg: address of iucv msg structure
380 * @flags: how the message is sent (IUCV_IPRMDATA, IUCV_IPPRTY, IUCV_IPBUFLST)
381 * @srccls: source class of message
382 * @buffer: address of data buffer or address of struct iucv_array
383 * @size: length of send buffer
384 *
385 * This function transmits data to another application. Data to be
386 * transmitted is in a buffer and this is a one-way message and the
387 * receiver will not reply to the message.
388 *
389 * Returns the result from the CP IUCV call.
390 */
391int iucv_message_send(struct iucv_path *path, struct iucv_message *msg,
392 u8 flags, u32 srccls, void *buffer, size_t size);
393
394/**
395 * iucv_message_send2way
396 * @path: address of iucv path structure
397 * @msg: address of iucv msg structure
398 * @flags: how the message is sent and the reply is received
399 * (IUCV_IPRMDATA, IUCV_IPBUFLST, IUCV_IPPRTY, IUCV_ANSLST)
400 * @srccls: source class of message
401 * @buffer: address of data buffer or address of struct iucv_array
402 * @size: length of send buffer
403 * @ansbuf: address of answer buffer or address of struct iucv_array
404 * @asize: size of reply buffer
405 *
406 * This function transmits data to another application. Data to be
407 * transmitted is in a buffer. The receiver of the send is expected to
408 * reply to the message and a buffer is provided into which IUCV moves
409 * the reply to this message.
410 *
411 * Returns the result from the CP IUCV call.
412 */
413int iucv_message_send2way(struct iucv_path *path, struct iucv_message *msg,
414 u8 flags, u32 srccls, void *buffer, size_t size,
415 void *answer, size_t asize, size_t *residual);
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 10559e937d27..f23d07ca7c59 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define the new driver API for Wireless Extensions 2 * This file define the new driver API for Wireless Extensions
3 * 3 *
4 * Version : 7 18.3.05 4 * Version : 8 16.3.07
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 2001-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 2001-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _IW_HANDLER_H 10#ifndef _IW_HANDLER_H
@@ -207,7 +207,7 @@
207 * will be needed... 207 * will be needed...
208 * I just plan to increment with each new version. 208 * I just plan to increment with each new version.
209 */ 209 */
210#define IW_HANDLER_VERSION 7 210#define IW_HANDLER_VERSION 8
211 211
212/* 212/*
213 * Changes : 213 * Changes :
@@ -239,6 +239,10 @@
239 * - Remove (struct iw_point *)->pointer from events and streams 239 * - Remove (struct iw_point *)->pointer from events and streams
240 * - Remove spy_offset from struct iw_handler_def 240 * - Remove spy_offset from struct iw_handler_def
241 * - Add "check" version of event macros for ieee802.11 stack 241 * - Add "check" version of event macros for ieee802.11 stack
242 *
243 * V7 to V8
244 * ----------
245 * - Prevent leaking of kernel space in stream on 64 bits.
242 */ 246 */
243 247
244/**************************** CONSTANTS ****************************/ 248/**************************** CONSTANTS ****************************/
@@ -427,26 +431,7 @@ struct iw_public_data {
427 * Those may be called only within the kernel. 431 * Those may be called only within the kernel.
428 */ 432 */
429 433
430/* First : function strictly used inside the kernel */ 434/* functions that may be called by driver modules */
431
432/* Handle /proc/net/wireless, called in net/code/dev.c */
433extern int dev_get_wireless_info(char * buffer, char **start, off_t offset,
434 int length);
435
436/* Handle IOCTLs, called in net/core/dev.c */
437extern int wireless_process_ioctl(struct ifreq *ifr, unsigned int cmd);
438
439/* Handle RtNetlink requests, called in net/core/rtnetlink.c */
440extern int wireless_rtnetlink_set(struct net_device * dev,
441 char * data,
442 int len);
443extern int wireless_rtnetlink_get(struct net_device * dev,
444 char * data,
445 int len,
446 char ** p_buf,
447 int * p_len);
448
449/* Second : functions that may be called by driver modules */
450 435
451/* Send a single event to user space */ 436/* Send a single event to user space */
452extern void wireless_send_event(struct net_device * dev, 437extern void wireless_send_event(struct net_device * dev,
@@ -500,7 +485,11 @@ iwe_stream_add_event(char * stream, /* Stream of events */
500 /* Check if it's possible */ 485 /* Check if it's possible */
501 if(likely((stream + event_len) < ends)) { 486 if(likely((stream + event_len) < ends)) {
502 iwe->len = event_len; 487 iwe->len = event_len;
503 memcpy(stream, (char *) iwe, event_len); 488 /* Beware of alignement issues on 64 bits */
489 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
490 memcpy(stream + IW_EV_LCP_LEN,
491 ((char *) iwe) + IW_EV_LCP_LEN,
492 event_len - IW_EV_LCP_LEN);
504 stream += event_len; 493 stream += event_len;
505 } 494 }
506 return stream; 495 return stream;
@@ -521,10 +510,10 @@ iwe_stream_add_point(char * stream, /* Stream of events */
521 /* Check if it's possible */ 510 /* Check if it's possible */
522 if(likely((stream + event_len) < ends)) { 511 if(likely((stream + event_len) < ends)) {
523 iwe->len = event_len; 512 iwe->len = event_len;
524 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 513 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
525 memcpy(stream + IW_EV_LCP_LEN, 514 memcpy(stream + IW_EV_LCP_LEN,
526 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 515 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
527 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 516 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
528 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 517 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
529 stream += event_len; 518 stream += event_len;
530 } 519 }
@@ -574,7 +563,11 @@ iwe_stream_check_add_event(char * stream, /* Stream of events */
574 /* Check if it's possible, set error if not */ 563 /* Check if it's possible, set error if not */
575 if(likely((stream + event_len) < ends)) { 564 if(likely((stream + event_len) < ends)) {
576 iwe->len = event_len; 565 iwe->len = event_len;
577 memcpy(stream, (char *) iwe, event_len); 566 /* Beware of alignement issues on 64 bits */
567 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
568 memcpy(stream + IW_EV_LCP_LEN,
569 ((char *) iwe) + IW_EV_LCP_LEN,
570 event_len - IW_EV_LCP_LEN);
578 stream += event_len; 571 stream += event_len;
579 } else 572 } else
580 *perr = -E2BIG; 573 *perr = -E2BIG;
@@ -598,10 +591,10 @@ iwe_stream_check_add_point(char * stream, /* Stream of events */
598 /* Check if it's possible */ 591 /* Check if it's possible */
599 if(likely((stream + event_len) < ends)) { 592 if(likely((stream + event_len) < ends)) {
600 iwe->len = event_len; 593 iwe->len = event_len;
601 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 594 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
602 memcpy(stream + IW_EV_LCP_LEN, 595 memcpy(stream + IW_EV_LCP_LEN,
603 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 596 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
604 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 597 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
605 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 598 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
606 stream += event_len; 599 stream += event_len;
607 } else 600 } else
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index aa33a477c3fb..4a8f58b17e43 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -203,7 +203,7 @@ struct llc_pdu_sn {
203 203
204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb) 204static inline struct llc_pdu_sn *llc_pdu_sn_hdr(struct sk_buff *skb)
205{ 205{
206 return (struct llc_pdu_sn *)skb->nh.raw; 206 return (struct llc_pdu_sn *)skb_network_header(skb);
207} 207}
208 208
209/* Un-numbered PDU format (3 bytes in length) */ 209/* Un-numbered PDU format (3 bytes in length) */
@@ -215,12 +215,7 @@ struct llc_pdu_un {
215 215
216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb) 216static inline struct llc_pdu_un *llc_pdu_un_hdr(struct sk_buff *skb)
217{ 217{
218 return (struct llc_pdu_un *)skb->nh.raw; 218 return (struct llc_pdu_un *)skb_network_header(skb);
219}
220
221static inline void *llc_set_pdu_hdr(struct sk_buff *skb, void *ptr)
222{
223 return skb->nh.raw = ptr;
224} 219}
225 220
226/** 221/**
@@ -237,7 +232,11 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
237 u8 ssap, u8 dsap, u8 cr) 232 u8 ssap, u8 dsap, u8 cr)
238{ 233{
239 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4; 234 const int hlen = type == LLC_PDU_TYPE_U ? 3 : 4;
240 struct llc_pdu_un *pdu = llc_set_pdu_hdr(skb, skb_push(skb, hlen)); 235 struct llc_pdu_un *pdu;
236
237 skb_push(skb, hlen);
238 skb_reset_network_header(skb);
239 pdu = llc_pdu_un_hdr(skb);
241 pdu->dsap = dsap; 240 pdu->dsap = dsap;
242 pdu->ssap = ssap; 241 pdu->ssap = ssap;
243 pdu->ssap |= cr; 242 pdu->ssap |= cr;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 3725b93c52f3..a4f26187fc1a 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -24,6 +24,7 @@
24 24
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/sysctl.h> 26#include <linux/sysctl.h>
27#include <net/rtnetlink.h>
27 28
28#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) 29#define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE)
29#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) 30#define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY)
@@ -36,7 +37,7 @@ struct neigh_parms
36 struct net_device *dev; 37 struct net_device *dev;
37 struct neigh_parms *next; 38 struct neigh_parms *next;
38 int (*neigh_setup)(struct neighbour *); 39 int (*neigh_setup)(struct neighbour *);
39 void (*neigh_destructor)(struct neighbour *); 40 void (*neigh_cleanup)(struct neighbour *);
40 struct neigh_table *tbl; 41 struct neigh_table *tbl;
41 42
42 void *sysctl_table; 43 void *sysctl_table;
@@ -213,16 +214,7 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
213extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); 214extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat);
214extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); 215extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev);
215 216
216struct netlink_callback;
217struct nlmsghdr;
218extern int neigh_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
219extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
220extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
221extern void neigh_app_ns(struct neighbour *n); 217extern void neigh_app_ns(struct neighbour *n);
222
223extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
224extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
225
226extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 218extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
227extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 219extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
228extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); 220extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index bd01b4633ee2..1c6b8bd09b9a 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -45,6 +45,7 @@ union nf_conntrack_expect_proto {
45#include <linux/netfilter/nf_conntrack_ftp.h> 45#include <linux/netfilter/nf_conntrack_ftp.h>
46#include <linux/netfilter/nf_conntrack_pptp.h> 46#include <linux/netfilter/nf_conntrack_pptp.h>
47#include <linux/netfilter/nf_conntrack_h323.h> 47#include <linux/netfilter/nf_conntrack_h323.h>
48#include <linux/netfilter/nf_conntrack_sane.h>
48 49
49/* per conntrack: application helper private data */ 50/* per conntrack: application helper private data */
50union nf_conntrack_help { 51union nf_conntrack_help {
@@ -52,6 +53,7 @@ union nf_conntrack_help {
52 struct nf_ct_ftp_master ct_ftp_info; 53 struct nf_ct_ftp_master ct_ftp_info;
53 struct nf_ct_pptp_master ct_pptp_info; 54 struct nf_ct_pptp_master ct_pptp_info;
54 struct nf_ct_h323_master ct_h323_info; 55 struct nf_ct_h323_master ct_h323_info;
56 struct nf_ct_sane_master ct_sane_info;
55}; 57};
56 58
57#include <linux/types.h> 59#include <linux/types.h>
@@ -248,6 +250,11 @@ static inline int nf_ct_is_dying(struct nf_conn *ct)
248 return test_bit(IPS_DYING_BIT, &ct->status); 250 return test_bit(IPS_DYING_BIT, &ct->status);
249} 251}
250 252
253static inline int nf_ct_is_untracked(const struct sk_buff *skb)
254{
255 return (skb->nfct == &nf_conntrack_untracked.ct_general);
256}
257
251extern unsigned int nf_conntrack_htable_size; 258extern unsigned int nf_conntrack_htable_size;
252extern int nf_conntrack_checksum; 259extern int nf_conntrack_checksum;
253extern atomic_t nf_conntrack_count; 260extern atomic_t nf_conntrack_count;
@@ -255,6 +262,12 @@ extern int nf_conntrack_max;
255 262
256DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat); 263DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat);
257#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 264#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++)
265#define NF_CT_STAT_INC_ATOMIC(count) \
266do { \
267 local_bh_disable(); \
268 __get_cpu_var(nf_conntrack_stat).count++; \
269 local_bh_enable(); \
270} while (0)
258 271
259/* no helper, no nat */ 272/* no helper, no nat */
260#define NF_CT_F_BASIC 0 273#define NF_CT_F_BASIC 0
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
deleted file mode 100644
index 6f84c1f7fcd4..000000000000
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ /dev/null
@@ -1,145 +0,0 @@
1#ifndef _NF_CONNTRACK_COMPAT_H
2#define _NF_CONNTRACK_COMPAT_H
3
4#ifdef __KERNEL__
5
6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7
8#include <linux/netfilter_ipv4/ip_conntrack.h>
9#include <linux/socket.h>
10
11#ifdef CONFIG_IP_NF_CONNTRACK_MARK
12static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
13 u_int32_t *ctinfo)
14{
15 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
16
17 if (ct)
18 return &ct->mark;
19 else
20 return NULL;
21}
22#endif /* CONFIG_IP_NF_CONNTRACK_MARK */
23
24#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
25static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
26 u_int32_t *ctinfo)
27{
28 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
29
30 if (ct)
31 return &ct->secmark;
32 else
33 return NULL;
34}
35#endif /* CONFIG_IP_NF_CONNTRACK_SECMARK */
36
37#ifdef CONFIG_IP_NF_CT_ACCT
38static inline struct ip_conntrack_counter *
39nf_ct_get_counters(const struct sk_buff *skb)
40{
41 enum ip_conntrack_info ctinfo;
42 struct ip_conntrack *ct = ip_conntrack_get(skb, &ctinfo);
43
44 if (ct)
45 return ct->counters;
46 else
47 return NULL;
48}
49#endif /* CONFIG_IP_NF_CT_ACCT */
50
51static inline int nf_ct_is_untracked(const struct sk_buff *skb)
52{
53 return (skb->nfct == &ip_conntrack_untracked.ct_general);
54}
55
56static inline void nf_ct_untrack(struct sk_buff *skb)
57{
58 skb->nfct = &ip_conntrack_untracked.ct_general;
59}
60
61static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
62 enum ip_conntrack_info *ctinfo)
63{
64 struct ip_conntrack *ct = ip_conntrack_get(skb, ctinfo);
65 return (ct != NULL);
66}
67
68static inline int nf_ct_l3proto_try_module_get(unsigned short l3proto)
69{
70 need_conntrack();
71 return l3proto == PF_INET ? 0 : -1;
72}
73
74static inline void nf_ct_l3proto_module_put(unsigned short l3proto)
75{
76}
77
78#else /* CONFIG_IP_NF_CONNTRACK */
79
80#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
81#include <net/netfilter/nf_conntrack.h>
82
83#ifdef CONFIG_NF_CONNTRACK_MARK
84
85static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
86 u_int32_t *ctinfo)
87{
88 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
89
90 if (ct)
91 return &ct->mark;
92 else
93 return NULL;
94}
95#endif /* CONFIG_NF_CONNTRACK_MARK */
96
97#ifdef CONFIG_NF_CONNTRACK_SECMARK
98static inline u_int32_t *nf_ct_get_secmark(const struct sk_buff *skb,
99 u_int32_t *ctinfo)
100{
101 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
102
103 if (ct)
104 return &ct->secmark;
105 else
106 return NULL;
107}
108#endif /* CONFIG_NF_CONNTRACK_MARK */
109
110#ifdef CONFIG_NF_CT_ACCT
111static inline struct ip_conntrack_counter *
112nf_ct_get_counters(const struct sk_buff *skb)
113{
114 enum ip_conntrack_info ctinfo;
115 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
116
117 if (ct)
118 return ct->counters;
119 else
120 return NULL;
121}
122#endif /* CONFIG_NF_CT_ACCT */
123
124static inline int nf_ct_is_untracked(const struct sk_buff *skb)
125{
126 return (skb->nfct == &nf_conntrack_untracked.ct_general);
127}
128
129static inline void nf_ct_untrack(struct sk_buff *skb)
130{
131 skb->nfct = &nf_conntrack_untracked.ct_general;
132}
133
134static inline int nf_ct_get_ctinfo(const struct sk_buff *skb,
135 enum ip_conntrack_info *ctinfo)
136{
137 struct nf_conn *ct = nf_ct_get(skb, ctinfo);
138 return (ct != NULL);
139}
140
141#endif /* CONFIG_IP_NF_CONNTRACK */
142
143#endif /* __KERNEL__ */
144
145#endif /* _NF_CONNTRACK_COMPAT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 7fdc72c01356..9fb906688ffa 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -27,6 +27,9 @@ extern unsigned int nf_conntrack_in(int pf,
27extern int nf_conntrack_init(void); 27extern int nf_conntrack_init(void);
28extern void nf_conntrack_cleanup(void); 28extern void nf_conntrack_cleanup(void);
29 29
30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void);
32
30struct nf_conntrack_l3proto; 33struct nf_conntrack_l3proto;
31extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); 34extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf);
32/* Like above, but you already have conntrack read lock. */ 35/* Like above, but you already have conntrack read lock. */
@@ -64,7 +67,7 @@ static inline int nf_conntrack_confirm(struct sk_buff **pskb)
64 int ret = NF_ACCEPT; 67 int ret = NF_ACCEPT;
65 68
66 if (ct) { 69 if (ct) {
67 if (!nf_ct_is_confirmed(ct)) 70 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
68 ret = __nf_conntrack_confirm(pskb); 71 ret = __nf_conntrack_confirm(pskb);
69 nf_ct_deliver_cached_events(ct); 72 nf_ct_deliver_cached_events(ct);
70 } 73 }
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index b62a8a9ec9d8..811c9073c532 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -20,30 +20,8 @@ DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x) 20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21 21
22extern struct atomic_notifier_head nf_conntrack_chain; 22extern struct atomic_notifier_head nf_conntrack_chain;
23extern struct atomic_notifier_head nf_conntrack_expect_chain; 23extern int nf_conntrack_register_notifier(struct notifier_block *nb);
24 24extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
25static inline int nf_conntrack_register_notifier(struct notifier_block *nb)
26{
27 return atomic_notifier_chain_register(&nf_conntrack_chain, nb);
28}
29
30static inline int nf_conntrack_unregister_notifier(struct notifier_block *nb)
31{
32 return atomic_notifier_chain_unregister(&nf_conntrack_chain, nb);
33}
34
35static inline int
36nf_conntrack_expect_register_notifier(struct notifier_block *nb)
37{
38 return atomic_notifier_chain_register(&nf_conntrack_expect_chain, nb);
39}
40
41static inline int
42nf_conntrack_expect_unregister_notifier(struct notifier_block *nb)
43{
44 return atomic_notifier_chain_unregister(&nf_conntrack_expect_chain,
45 nb);
46}
47 25
48extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 26extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
49extern void __nf_ct_event_cache_init(struct nf_conn *ct); 27extern void __nf_ct_event_cache_init(struct nf_conn *ct);
@@ -71,6 +49,10 @@ static inline void nf_conntrack_event(enum ip_conntrack_events event,
71 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct); 49 atomic_notifier_call_chain(&nf_conntrack_chain, event, ct);
72} 50}
73 51
52extern struct atomic_notifier_head nf_conntrack_expect_chain;
53extern int nf_conntrack_expect_register_notifier(struct notifier_block *nb);
54extern int nf_conntrack_expect_unregister_notifier(struct notifier_block *nb);
55
74static inline void 56static inline void
75nf_conntrack_expect_event(enum ip_conntrack_expect_events event, 57nf_conntrack_expect_event(enum ip_conntrack_expect_events event,
76 struct nf_conntrack_expect *exp) 58 struct nf_conntrack_expect *exp)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 41bcc9eb4206..173c7c1eff23 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -8,7 +8,7 @@
8 8
9extern struct list_head nf_conntrack_expect_list; 9extern struct list_head nf_conntrack_expect_list;
10extern struct kmem_cache *nf_conntrack_expect_cachep; 10extern struct kmem_cache *nf_conntrack_expect_cachep;
11extern struct file_operations exp_file_ops; 11extern const struct file_operations exp_file_ops;
12 12
13struct nf_conntrack_expect 13struct nf_conntrack_expect
14{ 14{
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 664ddcffe00d..f32f714e5d92 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -89,11 +89,8 @@ extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX];
89 89
90/* Protocol registration. */ 90/* Protocol registration. */
91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 91extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
92extern int nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto); 92extern void nf_conntrack_l3proto_unregister(struct nf_conntrack_l3proto *proto);
93 93extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
94extern struct nf_conntrack_l3proto *
95nf_ct_l3proto_find_get(u_int16_t l3proto);
96
97extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 94extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
98 95
99/* Existing built-in protocols */ 96/* Existing built-in protocols */
@@ -106,7 +103,7 @@ __nf_ct_l3proto_find(u_int16_t l3proto)
106{ 103{
107 if (unlikely(l3proto >= AF_MAX)) 104 if (unlikely(l3proto >= AF_MAX))
108 return &nf_conntrack_l3proto_generic; 105 return &nf_conntrack_l3proto_generic;
109 return nf_ct_l3protos[l3proto]; 106 return rcu_dereference(nf_ct_l3protos[l3proto]);
110} 107}
111 108
112#endif /*_NF_CONNTRACK_L3PROTO_H*/ 109#endif /*_NF_CONNTRACK_L3PROTO_H*/
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index fc8af08ff542..f46cb930414c 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -97,7 +97,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic; 97extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
98 98
99#define MAX_NF_CT_PROTO 256 99#define MAX_NF_CT_PROTO 256
100extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
101 100
102extern struct nf_conntrack_l4proto * 101extern struct nf_conntrack_l4proto *
103__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 102__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto);
@@ -109,7 +108,7 @@ extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
109 108
110/* Protocol registration. */ 109/* Protocol registration. */
111extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto); 110extern int nf_conntrack_l4proto_register(struct nf_conntrack_l4proto *proto);
112extern int nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto); 111extern void nf_conntrack_l4proto_unregister(struct nf_conntrack_l4proto *proto);
113 112
114/* Generic netlink helpers */ 113/* Generic netlink helpers */
115extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb, 114extern int nf_ct_port_tuple_to_nfattr(struct sk_buff *skb,
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 61c62068ca6b..bc57dd7b9b5c 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -16,6 +16,7 @@ enum nf_nat_manip_type
16 16
17#define IP_NAT_RANGE_MAP_IPS 1 17#define IP_NAT_RANGE_MAP_IPS 1
18#define IP_NAT_RANGE_PROTO_SPECIFIED 2 18#define IP_NAT_RANGE_PROTO_SPECIFIED 2
19#define IP_NAT_RANGE_PROTO_RANDOM 4
19 20
20/* NAT sequence number modifications */ 21/* NAT sequence number modifications */
21struct nf_nat_seq { 22struct nf_nat_seq {
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index f191c672bcc6..e76565459ad9 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -4,16 +4,6 @@
4#include <net/netfilter/nf_nat.h> 4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h> 5#include <linux/netfilter_ipv4/ip_tables.h>
6 6
7/* Compatibility definitions for ipt_FOO modules */
8#define ip_nat_range nf_nat_range
9#define ip_conntrack_tuple nf_conntrack_tuple
10#define ip_conntrack_get nf_ct_get
11#define ip_conntrack nf_conn
12#define ip_nat_setup_info nf_nat_setup_info
13#define ip_nat_multi_range_compat nf_nat_multi_range_compat
14#define ip_ct_iterate_cleanup nf_ct_iterate_cleanup
15#define IP_NF_ASSERT NF_CT_ASSERT
16
17extern int nf_nat_rule_init(void) __init; 7extern int nf_nat_rule_init(void) __init;
18extern void nf_nat_rule_cleanup(void); 8extern void nf_nat_rule_cleanup(void);
19extern int nf_nat_rule_find(struct sk_buff **pskb, 9extern int nf_nat_rule_find(struct sk_buff **pskb,
diff --git a/include/net/netlink.h b/include/net/netlink.h
index bcaf67b7a19d..0bf325c29aff 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -171,6 +171,7 @@ enum {
171 NLA_MSECS, 171 NLA_MSECS,
172 NLA_NESTED, 172 NLA_NESTED,
173 NLA_NUL_STRING, 173 NLA_NUL_STRING,
174 NLA_BINARY,
174 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
175}; 176};
176 177
@@ -188,12 +189,13 @@ enum {
188 * NLA_STRING Maximum length of string 189 * NLA_STRING Maximum length of string
189 * NLA_NUL_STRING Maximum length of string (excluding NUL) 190 * NLA_NUL_STRING Maximum length of string (excluding NUL)
190 * NLA_FLAG Unused 191 * NLA_FLAG Unused
192 * NLA_BINARY Maximum length of attribute payload
191 * All other Exact length of attribute payload 193 * All other Exact length of attribute payload
192 * 194 *
193 * Example: 195 * Example:
194 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = { 196 * static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
195 * [ATTR_FOO] = { .type = NLA_U16 }, 197 * [ATTR_FOO] = { .type = NLA_U16 },
196 * [ATTR_BAR] = { .type = NLA_STRING, len = BARSIZ }, 198 * [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
197 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) }, 199 * [ATTR_BAZ] = { .len = sizeof(struct mystruct) },
198 * }; 200 * };
199 */ 201 */
@@ -214,9 +216,7 @@ struct nl_info {
214 216
215extern void netlink_run_queue(struct sock *sk, unsigned int *qlen, 217extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
216 int (*cb)(struct sk_buff *, 218 int (*cb)(struct sk_buff *,
217 struct nlmsghdr *, int *)); 219 struct nlmsghdr *));
218extern void netlink_queue_skip(struct nlmsghdr *nlh,
219 struct sk_buff *skb);
220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 220extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
221 u32 pid, unsigned int group, int report, 221 u32 pid, unsigned int group, int report,
222 gfp_t flags); 222 gfp_t flags);
@@ -525,7 +525,7 @@ static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
525 */ 525 */
526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh) 526static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
527{ 527{
528 nlh->nlmsg_len = skb->tail - (unsigned char *) nlh; 528 nlh->nlmsg_len = skb_tail_pointer(skb) - (unsigned char *)nlh;
529 529
530 return skb->len; 530 return skb->len;
531} 531}
@@ -538,7 +538,7 @@ static inline int nlmsg_end(struct sk_buff *skb, struct nlmsghdr *nlh)
538 */ 538 */
539static inline void *nlmsg_get_pos(struct sk_buff *skb) 539static inline void *nlmsg_get_pos(struct sk_buff *skb)
540{ 540{
541 return skb->tail; 541 return skb_tail_pointer(skb);
542} 542}
543 543
544/** 544/**
@@ -548,7 +548,7 @@ static inline void *nlmsg_get_pos(struct sk_buff *skb)
548 * 548 *
549 * Trims the message to the provided mark. Returns -1. 549 * Trims the message to the provided mark. Returns -1.
550 */ 550 */
551static inline int nlmsg_trim(struct sk_buff *skb, void *mark) 551static inline int nlmsg_trim(struct sk_buff *skb, const void *mark)
552{ 552{
553 if (mark) 553 if (mark)
554 skb_trim(skb, (unsigned char *) mark - skb->data); 554 skb_trim(skb, (unsigned char *) mark - skb->data);
@@ -940,7 +940,7 @@ static inline unsigned long nla_get_msecs(struct nlattr *nla)
940 */ 940 */
941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype) 941static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
942{ 942{
943 struct nlattr *start = (struct nlattr *) skb->tail; 943 struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
944 944
945 if (nla_put(skb, attrtype, 0, NULL) < 0) 945 if (nla_put(skb, attrtype, 0, NULL) < 0)
946 return NULL; 946 return NULL;
@@ -960,7 +960,7 @@ static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
960 */ 960 */
961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start) 961static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
962{ 962{
963 start->nla_len = skb->tail - (unsigned char *) start; 963 start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
964 return skb->len; 964 return skb->len;
965} 965}
966 966
diff --git a/include/net/netrom.h b/include/net/netrom.h
index e0ca112024a3..f06852bba62a 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -215,8 +215,8 @@ extern struct net_device *nr_dev_get(ax25_address *);
215extern int nr_rt_ioctl(unsigned int, void __user *); 215extern int nr_rt_ioctl(unsigned int, void __user *);
216extern void nr_link_failed(ax25_cb *, int); 216extern void nr_link_failed(ax25_cb *, int);
217extern int nr_route_frame(struct sk_buff *, ax25_cb *); 217extern int nr_route_frame(struct sk_buff *, ax25_cb *);
218extern struct file_operations nr_nodes_fops; 218extern const struct file_operations nr_nodes_fops;
219extern struct file_operations nr_neigh_fops; 219extern const struct file_operations nr_neigh_fops;
220extern void nr_rt_free(void); 220extern void nr_rt_free(void);
221 221
222/* nr_subr.c */ 222/* nr_subr.c */
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index b902d24a3256..4129df708079 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -326,18 +326,18 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
326 case TCF_LAYER_LINK: 326 case TCF_LAYER_LINK:
327 return skb->data; 327 return skb->data;
328 case TCF_LAYER_NETWORK: 328 case TCF_LAYER_NETWORK:
329 return skb->nh.raw; 329 return skb_network_header(skb);
330 case TCF_LAYER_TRANSPORT: 330 case TCF_LAYER_TRANSPORT:
331 return skb->h.raw; 331 return skb_transport_header(skb);
332 } 332 }
333 333
334 return NULL; 334 return NULL;
335} 335}
336 336
337static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr, 337static inline int tcf_valid_offset(const struct sk_buff *skb,
338 int len) 338 const unsigned char *ptr, const int len)
339{ 339{
340 return unlikely((ptr + len) < skb->tail && ptr > skb->head); 340 return unlikely((ptr + len) < skb_tail_pointer(skb) && ptr > skb->head);
341} 341}
342 342
343#ifdef CONFIG_NET_CLS_IND 343#ifdef CONFIG_NET_CLS_IND
@@ -352,10 +352,13 @@ tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
352static inline int 352static inline int
353tcf_match_indev(struct sk_buff *skb, char *indev) 353tcf_match_indev(struct sk_buff *skb, char *indev)
354{ 354{
355 struct net_device *dev;
356
355 if (indev[0]) { 357 if (indev[0]) {
356 if (!skb->input_dev) 358 if (!skb->iif)
357 return 0; 359 return 0;
358 if (strcmp(indev, skb->input_dev->name)) 360 dev = __dev_get_by_index(skb->iif);
361 if (!dev || strcmp(indev, dev->name))
359 return 0; 362 return 0;
360 } 363 }
361 364
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index f6afee73235d..5754d53d9efc 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -2,6 +2,7 @@
2#define __NET_PKT_SCHED_H 2#define __NET_PKT_SCHED_H
3 3
4#include <linux/jiffies.h> 4#include <linux/jiffies.h>
5#include <linux/ktime.h>
5#include <net/sch_generic.h> 6#include <net/sch_generic.h>
6 7
7struct qdisc_walker 8struct qdisc_walker
@@ -12,8 +13,6 @@ struct qdisc_walker
12 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *); 13 int (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
13}; 14};
14 15
15extern rwlock_t qdisc_tree_lock;
16
17#define QDISC_ALIGNTO 32 16#define QDISC_ALIGNTO 32
18#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1)) 17#define QDISC_ALIGN(len) (((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))
19 18
@@ -37,175 +36,38 @@ static inline void *qdisc_priv(struct Qdisc *q)
37 The things are not so bad, because we may use artifical 36 The things are not so bad, because we may use artifical
38 clock evaluated by integration of network data flow 37 clock evaluated by integration of network data flow
39 in the most critical places. 38 in the most critical places.
40
41 Note: we do not use fastgettimeofday.
42 The reason is that, when it is not the same thing as
43 gettimeofday, it returns invalid timestamp, which is
44 not updated, when net_bh is active.
45 */
46
47/* General note about internal clock.
48
49 Any clock source returns time intervals, measured in units
50 close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely
51 microseconds, otherwise something close but different chosen to minimize
52 arithmetic cost. Ratio usec/internal untis in form nominator/denominator
53 may be read from /proc/net/psched.
54 */ 39 */
55 40
56
57#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
58
59typedef struct timeval psched_time_t;
60typedef long psched_tdiff_t;
61
62#define PSCHED_GET_TIME(stamp) do_gettimeofday(&(stamp))
63#define PSCHED_US2JIFFIE(usecs) usecs_to_jiffies(usecs)
64#define PSCHED_JIFFIE2US(delay) jiffies_to_usecs(delay)
65
66#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
67
68typedef u64 psched_time_t; 41typedef u64 psched_time_t;
69typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
70 43
71#ifdef CONFIG_NET_SCH_CLK_JIFFIES 44/* Avoid doing 64 bit divide by 1000 */
72 45#define PSCHED_US2NS(x) ((s64)(x) << 10)
73#if HZ < 96 46#define PSCHED_NS2US(x) ((x) >> 10)
74#define PSCHED_JSCALE 14
75#elif HZ >= 96 && HZ < 192
76#define PSCHED_JSCALE 13
77#elif HZ >= 192 && HZ < 384
78#define PSCHED_JSCALE 12
79#elif HZ >= 384 && HZ < 768
80#define PSCHED_JSCALE 11
81#elif HZ >= 768
82#define PSCHED_JSCALE 10
83#endif
84 47
85#define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<<PSCHED_JSCALE)) 48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC)
86#define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE) 49#define PSCHED_PASTPERFECT 0
87#define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE) 50
88 51static inline psched_time_t psched_get_time(void)
89#endif /* CONFIG_NET_SCH_CLK_JIFFIES */
90#ifdef CONFIG_NET_SCH_CLK_CPU
91#include <asm/timex.h>
92
93extern psched_tdiff_t psched_clock_per_hz;
94extern int psched_clock_scale;
95extern psched_time_t psched_time_base;
96extern cycles_t psched_time_mark;
97
98#define PSCHED_GET_TIME(stamp) \
99do { \
100 cycles_t cur = get_cycles(); \
101 if (sizeof(cycles_t) == sizeof(u32)) { \
102 if (cur <= psched_time_mark) \
103 psched_time_base += 0x100000000ULL; \
104 psched_time_mark = cur; \
105 (stamp) = (psched_time_base + cur)>>psched_clock_scale; \
106 } else { \
107 (stamp) = cur>>psched_clock_scale; \
108 } \
109} while (0)
110#define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
111#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
112
113#endif /* CONFIG_NET_SCH_CLK_CPU */
114
115#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
116
117#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
118#define PSCHED_TDIFF(tv1, tv2) \
119({ \
120 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \
121 int __delta = (tv1).tv_usec - (tv2).tv_usec; \
122 if (__delta_sec) { \
123 switch (__delta_sec) { \
124 default: \
125 __delta = 0; \
126 case 2: \
127 __delta += USEC_PER_SEC; \
128 case 1: \
129 __delta += USEC_PER_SEC; \
130 } \
131 } \
132 __delta; \
133})
134
135static inline int
136psched_tod_diff(int delta_sec, int bound)
137{ 52{
138 int delta; 53 return PSCHED_NS2US(ktime_to_ns(ktime_get()));
139
140 if (bound <= USEC_PER_SEC || delta_sec > (0x7FFFFFFF/USEC_PER_SEC)-1)
141 return bound;
142 delta = delta_sec * USEC_PER_SEC;
143 if (delta > bound || delta < 0)
144 delta = bound;
145 return delta;
146} 54}
147 55
148#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \ 56static inline psched_tdiff_t
149({ \ 57psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
150 int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \ 58{
151 int __delta = (tv1).tv_usec - (tv2).tv_usec; \ 59 return min(tv1 - tv2, bound);
152 switch (__delta_sec) { \ 60}
153 default: \
154 __delta = psched_tod_diff(__delta_sec, bound); break; \
155 case 2: \
156 __delta += USEC_PER_SEC; \
157 case 1: \
158 __delta += USEC_PER_SEC; \
159 case 0: \
160 if (__delta > bound || __delta < 0) \
161 __delta = bound; \
162 } \
163 __delta; \
164})
165
166#define PSCHED_TLESS(tv1, tv2) (((tv1).tv_usec < (tv2).tv_usec && \
167 (tv1).tv_sec <= (tv2).tv_sec) || \
168 (tv1).tv_sec < (tv2).tv_sec)
169
170#define PSCHED_TADD2(tv, delta, tv_res) \
171({ \
172 int __delta = (tv).tv_usec + (delta); \
173 (tv_res).tv_sec = (tv).tv_sec; \
174 while (__delta >= USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
175 (tv_res).tv_usec = __delta; \
176})
177
178#define PSCHED_TADD(tv, delta) \
179({ \
180 (tv).tv_usec += (delta); \
181 while ((tv).tv_usec >= USEC_PER_SEC) { (tv).tv_sec++; \
182 (tv).tv_usec -= USEC_PER_SEC; } \
183})
184
185/* Set/check that time is in the "past perfect";
186 it depends on concrete representation of system time
187 */
188
189#define PSCHED_SET_PASTPERFECT(t) ((t).tv_sec = 0)
190#define PSCHED_IS_PASTPERFECT(t) ((t).tv_sec == 0)
191
192#define PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; })
193
194#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
195
196#define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
197#define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
198 min_t(long long, (tv1) - (tv2), bound)
199
200 61
201#define PSCHED_TLESS(tv1, tv2) ((tv1) < (tv2)) 62struct qdisc_watchdog {
202#define PSCHED_TADD2(tv, delta, tv_res) ((tv_res) = (tv) + (delta)) 63 struct hrtimer timer;
203#define PSCHED_TADD(tv, delta) ((tv) += (delta)) 64 struct Qdisc *qdisc;
204#define PSCHED_SET_PASTPERFECT(t) ((t) = 0) 65};
205#define PSCHED_IS_PASTPERFECT(t) ((t) == 0)
206#define PSCHED_AUDIT_TDIFF(t)
207 66
208#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */ 67extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
68extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
69 psched_time_t expires);
70extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
209 71
210extern struct Qdisc_ops pfifo_qdisc_ops; 72extern struct Qdisc_ops pfifo_qdisc_ops;
211extern struct Qdisc_ops bfifo_qdisc_ops; 73extern struct Qdisc_ops bfifo_qdisc_ops;
diff --git a/include/net/red.h b/include/net/red.h
index a4eb37946f2c..3cf31d466a81 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -151,17 +151,17 @@ static inline void red_set_parms(struct red_parms *p,
151 151
152static inline int red_is_idling(struct red_parms *p) 152static inline int red_is_idling(struct red_parms *p)
153{ 153{
154 return !PSCHED_IS_PASTPERFECT(p->qidlestart); 154 return p->qidlestart != PSCHED_PASTPERFECT;
155} 155}
156 156
157static inline void red_start_of_idle_period(struct red_parms *p) 157static inline void red_start_of_idle_period(struct red_parms *p)
158{ 158{
159 PSCHED_GET_TIME(p->qidlestart); 159 p->qidlestart = psched_get_time();
160} 160}
161 161
162static inline void red_end_of_idle_period(struct red_parms *p) 162static inline void red_end_of_idle_period(struct red_parms *p)
163{ 163{
164 PSCHED_SET_PASTPERFECT(p->qidlestart); 164 p->qidlestart = PSCHED_PASTPERFECT;
165} 165}
166 166
167static inline void red_restart(struct red_parms *p) 167static inline void red_restart(struct red_parms *p)
@@ -177,8 +177,8 @@ static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
177 long us_idle; 177 long us_idle;
178 int shift; 178 int shift;
179 179
180 PSCHED_GET_TIME(now); 180 now = psched_get_time();
181 us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max); 181 us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max);
182 182
183 /* 183 /*
184 * The problem: ideally, average length queue recalcultion should 184 * The problem: ideally, average length queue recalcultion should
diff --git a/include/net/rose.h b/include/net/rose.h
index 4c05a88b921b..a4047d3cf5dd 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -189,9 +189,9 @@ extern void rose_enquiry_response(struct sock *);
189 189
190/* rose_route.c */ 190/* rose_route.c */
191extern struct rose_neigh rose_loopback_neigh; 191extern struct rose_neigh rose_loopback_neigh;
192extern struct file_operations rose_neigh_fops; 192extern const struct file_operations rose_neigh_fops;
193extern struct file_operations rose_nodes_fops; 193extern const struct file_operations rose_nodes_fops;
194extern struct file_operations rose_routes_fops; 194extern const struct file_operations rose_routes_fops;
195 195
196extern void rose_add_loopback_neigh(void); 196extern void rose_add_loopback_neigh(void);
197extern int __must_check rose_add_loopback_node(rose_address *); 197extern int __must_check rose_add_loopback_node(rose_address *);
diff --git a/include/net/route.h b/include/net/route.h
index 486e37aff06c..749e4dfe5ff3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -53,9 +53,11 @@ struct rtable
53 union 53 union
54 { 54 {
55 struct dst_entry dst; 55 struct dst_entry dst;
56 struct rtable *rt_next;
57 } u; 56 } u;
58 57
58 /* Cache lookup keys */
59 struct flowi fl;
60
59 struct in_device *idev; 61 struct in_device *idev;
60 62
61 unsigned rt_flags; 63 unsigned rt_flags;
@@ -69,9 +71,6 @@ struct rtable
69 /* Info on neighbour */ 71 /* Info on neighbour */
70 __be32 rt_gateway; 72 __be32 rt_gateway;
71 73
72 /* Cache lookup keys */
73 struct flowi fl;
74
75 /* Miscellaneous cached information */ 74 /* Miscellaneous cached information */
76 __be32 rt_spec_dst; /* RFC1122 specific destination */ 75 __be32 rt_spec_dst; /* RFC1122 specific destination */
77 struct inet_peer *peer; /* long-living peer info */ 76 struct inet_peer *peer; /* long-living peer info */
@@ -146,7 +145,8 @@ static inline char rt_tos2priority(u8 tos)
146 145
147static inline int ip_route_connect(struct rtable **rp, __be32 dst, 146static inline int ip_route_connect(struct rtable **rp, __be32 dst,
148 __be32 src, u32 tos, int oif, u8 protocol, 147 __be32 src, u32 tos, int oif, u8 protocol,
149 __be16 sport, __be16 dport, struct sock *sk) 148 __be16 sport, __be16 dport, struct sock *sk,
149 int flags)
150{ 150{
151 struct flowi fl = { .oif = oif, 151 struct flowi fl = { .oif = oif,
152 .nl_u = { .ip4_u = { .daddr = dst, 152 .nl_u = { .ip4_u = { .daddr = dst,
@@ -168,7 +168,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
168 *rp = NULL; 168 *rp = NULL;
169 } 169 }
170 security_sk_classify_flow(sk, &fl); 170 security_sk_classify_flow(sk, &fl);
171 return ip_route_output_flow(rp, &fl, sk, 0); 171 return ip_route_output_flow(rp, &fl, sk, flags);
172} 172}
173 173
174static inline int ip_route_newports(struct rtable **rp, u8 protocol, 174static inline int ip_route_newports(struct rtable **rp, u8 protocol,
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
new file mode 100644
index 000000000000..3b3d4745618d
--- /dev/null
+++ b/include/net/rtnetlink.h
@@ -0,0 +1,25 @@
1#ifndef __NET_RTNETLINK_H
2#define __NET_RTNETLINK_H
3
4#include <linux/rtnetlink.h>
5#include <net/netlink.h>
6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9
10extern int __rtnl_register(int protocol, int msgtype,
11 rtnl_doit_func, rtnl_dumpit_func);
12extern void rtnl_register(int protocol, int msgtype,
13 rtnl_doit_func, rtnl_dumpit_func);
14extern int rtnl_unregister(int protocol, int msgtype);
15extern void rtnl_unregister_all(int protocol);
16
17static inline int rtnl_msg_family(struct nlmsghdr *nlh)
18{
19 if (nlmsg_len(nlh) >= sizeof(struct rtgenmsg))
20 return ((struct rtgenmsg *) nlmsg_data(nlh))->rtgen_family;
21 else
22 return AF_UNSPEC;
23}
24
25#endif
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 82086392735a..1b8e35197ebe 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -5,10 +5,10 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/rtnetlink.h>
9#include <linux/pkt_sched.h> 8#include <linux/pkt_sched.h>
10#include <linux/pkt_cls.h> 9#include <linux/pkt_cls.h>
11#include <net/gen_stats.h> 10#include <net/gen_stats.h>
11#include <net/rtnetlink.h>
12 12
13struct Qdisc_ops; 13struct Qdisc_ops;
14struct qdisc_walker; 14struct qdisc_walker;
@@ -177,14 +177,8 @@ extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n);
177extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops); 177extern struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops);
178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, 178extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
179 struct Qdisc_ops *ops, u32 parentid); 179 struct Qdisc_ops *ops, u32 parentid);
180 180extern void tcf_destroy(struct tcf_proto *tp);
181static inline void 181extern void tcf_destroy_chain(struct tcf_proto *fl);
182tcf_destroy(struct tcf_proto *tp)
183{
184 tp->ops->destroy(tp);
185 module_put(tp->ops->owner);
186 kfree(tp);
187}
188 182
189static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, 183static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
190 struct sk_buff_head *list) 184 struct sk_buff_head *list)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 5ddb85599863..bb37724495a5 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -283,7 +283,7 @@ enum { SCTP_MAX_GABS = 16 };
283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ 283#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */
284 284
285/* Maximum number of new data packets that can be sent in a burst. */ 285/* Maximum number of new data packets that can be sent in a burst. */
286#define SCTP_MAX_BURST 4 286#define SCTP_DEFAULT_MAX_BURST 4
287 287
288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ 288#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */
289 289
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 31a8e88f1a74..7b4fff93ba7f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -276,6 +276,7 @@ struct sctp_sock {
276 __u32 default_context; 276 __u32 default_context;
277 __u32 default_timetolive; 277 __u32 default_timetolive;
278 __u32 default_rcv_context; 278 __u32 default_rcv_context;
279 int max_burst;
279 280
280 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to 281 /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to
281 * the destination address every heartbeat interval. This value 282 * the destination address every heartbeat interval. This value
@@ -304,10 +305,12 @@ struct sctp_sock {
304 __u32 autoclose; 305 __u32 autoclose;
305 __u8 nodelay; 306 __u8 nodelay;
306 __u8 disable_fragments; 307 __u8 disable_fragments;
307 __u8 pd_mode;
308 __u8 v4mapped; 308 __u8 v4mapped;
309 __u8 frag_interleave;
309 __u32 adaptation_ind; 310 __u32 adaptation_ind;
311 __u32 pd_point;
310 312
313 atomic_t pd_mode;
311 /* Receive to here while partial delivery is in effect. */ 314 /* Receive to here while partial delivery is in effect. */
312 struct sk_buff_head pd_lobby; 315 struct sk_buff_head pd_lobby;
313}; 316};
@@ -1002,6 +1005,7 @@ void sctp_transport_update_rto(struct sctp_transport *, __u32);
1002void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); 1005void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1003void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1006void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1004unsigned long sctp_transport_timeout(struct sctp_transport *); 1007unsigned long sctp_transport_timeout(struct sctp_transport *);
1008void sctp_transport_reset(struct sctp_transport *);
1005 1009
1006 1010
1007/* This is the structure we use to queue packets as they come into 1011/* This is the structure we use to queue packets as they come into
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 2923e3d31a08..de88ed5b0ba6 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -89,6 +89,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
89 __u16 error, 89 __u16 error,
90 __u16 outbound, 90 __u16 outbound,
91 __u16 inbound, 91 __u16 inbound,
92 struct sctp_chunk *chunk,
92 gfp_t gfp); 93 gfp_t gfp);
93 94
94struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change( 95struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index a43c8788b650..39ea3f442b47 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -59,6 +59,7 @@ struct sctp_ulpq {
59/* Prototypes. */ 59/* Prototypes. */
60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, 60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
61 struct sctp_association *); 61 struct sctp_association *);
62void sctp_ulpq_flush(struct sctp_ulpq *ulpq);
62void sctp_ulpq_free(struct sctp_ulpq *); 63void sctp_ulpq_free(struct sctp_ulpq *);
63 64
64/* Add a new DATA chunk for processing. */ 65/* Add a new DATA chunk for processing. */
@@ -77,7 +78,7 @@ void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t);
77void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); 78void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t);
78 79
79/* Clear the partial data delivery condition on this socket. */ 80/* Clear the partial data delivery condition on this socket. */
80int sctp_clear_pd(struct sock *sk); 81int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc);
81 82
82/* Skip over an SSN. */ 83/* Skip over an SSN. */
83void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); 84void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 67a30eb2b3a4..6d2b57758cca 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -97,6 +97,12 @@ enum sctp_optname {
97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME 97#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME
98 SCTP_CONTEXT, /* Receive Context */ 98 SCTP_CONTEXT, /* Receive Context */
99#define SCTP_CONTEXT SCTP_CONTEXT 99#define SCTP_CONTEXT SCTP_CONTEXT
100 SCTP_FRAGMENT_INTERLEAVE,
101#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE
102 SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */
103#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT
104 SCTP_MAX_BURST, /* Set/Get max burst */
105#define SCTP_MAX_BURST SCTP_MAX_BURST
100 106
101 /* Internal Socket Options. Some of the sctp library functions are 107 /* Internal Socket Options. Some of the sctp library functions are
102 * implemented using these socket options. 108 * implemented using these socket options.
@@ -213,6 +219,7 @@ struct sctp_assoc_change {
213 __u16 sac_outbound_streams; 219 __u16 sac_outbound_streams;
214 __u16 sac_inbound_streams; 220 __u16 sac_inbound_streams;
215 sctp_assoc_t sac_assoc_id; 221 sctp_assoc_t sac_assoc_id;
222 __u8 sac_info[0];
216}; 223};
217 224
218/* 225/*
@@ -261,6 +268,7 @@ enum sctp_spc_state {
261 SCTP_ADDR_REMOVED, 268 SCTP_ADDR_REMOVED,
262 SCTP_ADDR_ADDED, 269 SCTP_ADDR_ADDED,
263 SCTP_ADDR_MADE_PRIM, 270 SCTP_ADDR_MADE_PRIM,
271 SCTP_ADDR_CONFIRMED,
264}; 272};
265 273
266 274
@@ -508,16 +516,17 @@ struct sctp_setadaptation {
508 * address's parameters: 516 * address's parameters:
509 */ 517 */
510enum sctp_spp_flags { 518enum sctp_spp_flags {
511 SPP_HB_ENABLE = 1, /*Enable heartbeats*/ 519 SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/
512 SPP_HB_DISABLE = 2, /*Disable heartbeats*/ 520 SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/
513 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, 521 SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
514 SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ 522 SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/
515 SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ 523 SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/
516 SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ 524 SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/
517 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, 525 SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
518 SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ 526 SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/
519 SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ 527 SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/
520 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, 528 SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
529 SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */
521}; 530};
522 531
523struct sctp_paddrparams { 532struct sctp_paddrparams {
@@ -530,7 +539,7 @@ struct sctp_paddrparams {
530 __u32 spp_flags; 539 __u32 spp_flags;
531} __attribute__((packed, aligned(4))); 540} __attribute__((packed, aligned(4)));
532 541
533/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) 542/* 7.1.23. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME)
534 * 543 *
535 * This options will get or set the delayed ack timer. The time is set 544 * This options will get or set the delayed ack timer. The time is set
536 * in milliseconds. If the assoc_id is 0, then this sets or gets the 545 * in milliseconds. If the assoc_id is 0, then this sets or gets the
diff --git a/include/net/sock.h b/include/net/sock.h
index 03684e702d13..25c37e34bfdc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -202,6 +202,15 @@ struct sock {
202 unsigned short sk_type; 202 unsigned short sk_type;
203 int sk_rcvbuf; 203 int sk_rcvbuf;
204 socket_lock_t sk_lock; 204 socket_lock_t sk_lock;
205 /*
206 * The backlog queue is special, it is always used with
207 * the per-socket spinlock held and requires low latency
208 * access. Therefore we special case it's implementation.
209 */
210 struct {
211 struct sk_buff *head;
212 struct sk_buff *tail;
213 } sk_backlog;
205 wait_queue_head_t *sk_sleep; 214 wait_queue_head_t *sk_sleep;
206 struct dst_entry *sk_dst_cache; 215 struct dst_entry *sk_dst_cache;
207 struct xfrm_policy *sk_policy[2]; 216 struct xfrm_policy *sk_policy[2];
@@ -221,15 +230,6 @@ struct sock {
221 int sk_rcvlowat; 230 int sk_rcvlowat;
222 unsigned long sk_flags; 231 unsigned long sk_flags;
223 unsigned long sk_lingertime; 232 unsigned long sk_lingertime;
224 /*
225 * The backlog queue is special, it is always used with
226 * the per-socket spinlock held and requires low latency
227 * access. Therefore we special case it's implementation.
228 */
229 struct {
230 struct sk_buff *head;
231 struct sk_buff *tail;
232 } sk_backlog;
233 struct sk_buff_head sk_error_queue; 233 struct sk_buff_head sk_error_queue;
234 struct proto *sk_prot_creator; 234 struct proto *sk_prot_creator;
235 rwlock_t sk_callback_lock; 235 rwlock_t sk_callback_lock;
@@ -244,7 +244,7 @@ struct sock {
244 struct sk_filter *sk_filter; 244 struct sk_filter *sk_filter;
245 void *sk_protinfo; 245 void *sk_protinfo;
246 struct timer_list sk_timer; 246 struct timer_list sk_timer;
247 struct timeval sk_stamp; 247 ktime_t sk_stamp;
248 struct socket *sk_socket; 248 struct socket *sk_socket;
249 void *sk_user_data; 249 void *sk_user_data;
250 struct page *sk_sndmsg_page; 250 struct page *sk_sndmsg_page;
@@ -390,6 +390,7 @@ enum sock_flags {
390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */ 390 SOCK_USE_WRITE_QUEUE, /* whether to call sk->sk_write_space in sock_wfree */
391 SOCK_DBG, /* %SO_DEBUG setting */ 391 SOCK_DBG, /* %SO_DEBUG setting */
392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */ 392 SOCK_RCVTSTAMP, /* %SO_TIMESTAMP setting */
393 SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
393 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */ 394 SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
394 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */ 395 SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
395}; 396};
@@ -710,15 +711,6 @@ static inline void sk_stream_mem_reclaim(struct sock *sk)
710 __sk_stream_mem_reclaim(sk); 711 __sk_stream_mem_reclaim(sk);
711} 712}
712 713
713static inline void sk_stream_writequeue_purge(struct sock *sk)
714{
715 struct sk_buff *skb;
716
717 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
718 sk_stream_free_skb(sk, skb);
719 sk_stream_mem_reclaim(sk);
720}
721
722static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) 714static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb)
723{ 715{
724 return (int)skb->truesize <= sk->sk_forward_alloc || 716 return (int)skb->truesize <= sk->sk_forward_alloc ||
@@ -1083,19 +1075,7 @@ static inline int sk_can_gso(const struct sock *sk)
1083 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1075 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1084} 1076}
1085 1077
1086static inline void sk_setup_caps(struct sock *sk, struct dst_entry *dst) 1078extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1087{
1088 __sk_dst_set(sk, dst);
1089 sk->sk_route_caps = dst->dev->features;
1090 if (sk->sk_route_caps & NETIF_F_GSO)
1091 sk->sk_route_caps |= NETIF_F_GSO_MASK;
1092 if (sk_can_gso(sk)) {
1093 if (dst->header_len)
1094 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
1095 else
1096 sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
1097 }
1098}
1099 1079
1100static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) 1080static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb)
1101{ 1081{
@@ -1256,18 +1236,6 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1256 return page; 1236 return page;
1257} 1237}
1258 1238
1259#define sk_stream_for_retrans_queue(skb, sk) \
1260 for (skb = (sk)->sk_write_queue.next; \
1261 (skb != (sk)->sk_send_head) && \
1262 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1263 skb = skb->next)
1264
1265/*from STCP for fast SACK Process*/
1266#define sk_stream_for_retrans_queue_from(skb, sk) \
1267 for (; (skb != (sk)->sk_send_head) && \
1268 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1269 skb = skb->next)
1270
1271/* 1239/*
1272 * Default write policy as shown to user space via poll/select/SIGIO 1240 * Default write policy as shown to user space via poll/select/SIGIO
1273 */ 1241 */
@@ -1278,7 +1246,7 @@ static inline int sock_writeable(const struct sock *sk)
1278 1246
1279static inline gfp_t gfp_any(void) 1247static inline gfp_t gfp_any(void)
1280{ 1248{
1281 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1249 return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
1282} 1250}
1283 1251
1284static inline long sock_rcvtimeo(const struct sock *sk, int noblock) 1252static inline long sock_rcvtimeo(const struct sock *sk, int noblock)
@@ -1304,22 +1272,18 @@ static inline int sock_intr_errno(long timeo)
1304 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 1272 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
1305} 1273}
1306 1274
1275extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
1276 struct sk_buff *skb);
1277
1307static __inline__ void 1278static __inline__ void
1308sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 1279sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
1309{ 1280{
1310 struct timeval stamp; 1281 ktime_t kt = skb->tstamp;
1311 1282
1312 skb_get_timestamp(skb, &stamp); 1283 if (sock_flag(sk, SOCK_RCVTSTAMP))
1313 if (sock_flag(sk, SOCK_RCVTSTAMP)) { 1284 __sock_recv_timestamp(msg, sk, skb);
1314 /* Race occurred between timestamp enabling and packet 1285 else
1315 receiving. Fill in the current time for now. */ 1286 sk->sk_stamp = kt;
1316 if (stamp.tv_sec == 0)
1317 do_gettimeofday(&stamp);
1318 skb_set_timestamp(skb, &stamp);
1319 put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(struct timeval),
1320 &stamp);
1321 } else
1322 sk->sk_stamp = stamp;
1323} 1287}
1324 1288
1325/** 1289/**
@@ -1350,18 +1314,17 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1350 1314
1351extern void sock_enable_timestamp(struct sock *sk); 1315extern void sock_enable_timestamp(struct sock *sk);
1352extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1316extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1317extern int sock_get_timestampns(struct sock *, struct timespec __user *);
1353 1318
1354/* 1319/*
1355 * Enable debug/info messages 1320 * Enable debug/info messages
1356 */ 1321 */
1322extern int net_msg_warn;
1323#define NETDEBUG(fmt, args...) \
1324 do { if (net_msg_warn) printk(fmt,##args); } while (0)
1357 1325
1358#ifdef CONFIG_NETDEBUG 1326#define LIMIT_NETDEBUG(fmt, args...) \
1359#define NETDEBUG(fmt, args...) printk(fmt,##args) 1327 do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
1360#define LIMIT_NETDEBUG(fmt, args...) do { if (net_ratelimit()) printk(fmt,##args); } while(0)
1361#else
1362#define NETDEBUG(fmt, args...) do { } while (0)
1363#define LIMIT_NETDEBUG(fmt, args...) do { } while(0)
1364#endif
1365 1328
1366/* 1329/*
1367 * Macros for sleeping on a socket. Use them like this: 1330 * Macros for sleeping on a socket. Use them like this:
diff --git a/include/net/tcp.h b/include/net/tcp.h
index cd8fa0c858ae..ef8f9d4dae85 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -220,6 +220,7 @@ extern int sysctl_tcp_app_win;
220extern int sysctl_tcp_adv_win_scale; 220extern int sysctl_tcp_adv_win_scale;
221extern int sysctl_tcp_tw_reuse; 221extern int sysctl_tcp_tw_reuse;
222extern int sysctl_tcp_frto; 222extern int sysctl_tcp_frto;
223extern int sysctl_tcp_frto_response;
223extern int sysctl_tcp_low_latency; 224extern int sysctl_tcp_low_latency;
224extern int sysctl_tcp_dma_copybreak; 225extern int sysctl_tcp_dma_copybreak;
225extern int sysctl_tcp_nometrics_save; 226extern int sysctl_tcp_nometrics_save;
@@ -230,6 +231,7 @@ extern int sysctl_tcp_mtu_probing;
230extern int sysctl_tcp_base_mss; 231extern int sysctl_tcp_base_mss;
231extern int sysctl_tcp_workaround_signed_windows; 232extern int sysctl_tcp_workaround_signed_windows;
232extern int sysctl_tcp_slow_start_after_idle; 233extern int sysctl_tcp_slow_start_after_idle;
234extern int sysctl_tcp_max_ssthresh;
233 235
234extern atomic_t tcp_memory_allocated; 236extern atomic_t tcp_memory_allocated;
235extern atomic_t tcp_sockets_allocated; 237extern atomic_t tcp_sockets_allocated;
@@ -341,6 +343,7 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
341extern int tcp_child_process(struct sock *parent, 343extern int tcp_child_process(struct sock *parent,
342 struct sock *child, 344 struct sock *child,
343 struct sk_buff *skb); 345 struct sk_buff *skb);
346extern int tcp_use_frto(struct sock *sk);
344extern void tcp_enter_frto(struct sock *sk); 347extern void tcp_enter_frto(struct sock *sk);
345extern void tcp_enter_loss(struct sock *sk, int how); 348extern void tcp_enter_loss(struct sock *sk, int how);
346extern void tcp_clear_retrans(struct tcp_sock *tp); 349extern void tcp_clear_retrans(struct tcp_sock *tp);
@@ -417,9 +420,9 @@ extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
417 420
418/* tcp_output.c */ 421/* tcp_output.c */
419 422
420extern void __tcp_push_pending_frames(struct sock *sk, struct tcp_sock *tp, 423extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
421 unsigned int cur_mss, int nonagle); 424 int nonagle);
422extern int tcp_may_send_now(struct sock *sk, struct tcp_sock *tp); 425extern int tcp_may_send_now(struct sock *sk);
423extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 426extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
424extern void tcp_xmit_retransmit_queue(struct sock *); 427extern void tcp_xmit_retransmit_queue(struct sock *);
425extern void tcp_simple_retransmit(struct sock *); 428extern void tcp_simple_retransmit(struct sock *);
@@ -476,8 +479,10 @@ static inline void tcp_fast_path_on(struct tcp_sock *tp)
476 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); 479 __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale);
477} 480}
478 481
479static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) 482static inline void tcp_fast_path_check(struct sock *sk)
480{ 483{
484 struct tcp_sock *tp = tcp_sk(sk);
485
481 if (skb_queue_empty(&tp->out_of_order_queue) && 486 if (skb_queue_empty(&tp->out_of_order_queue) &&
482 tp->rcv_wnd && 487 tp->rcv_wnd &&
483 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf && 488 atomic_read(&sk->sk_rmem_alloc) < sk->sk_rcvbuf &&
@@ -588,10 +593,10 @@ static inline void tcp_dec_pcount_approx(__u32 *count,
588 } 593 }
589} 594}
590 595
591static inline void tcp_packets_out_inc(struct sock *sk, 596static inline void tcp_packets_out_inc(struct sock *sk,
592 struct tcp_sock *tp,
593 const struct sk_buff *skb) 597 const struct sk_buff *skb)
594{ 598{
599 struct tcp_sock *tp = tcp_sk(sk);
595 int orig = tp->packets_out; 600 int orig = tp->packets_out;
596 601
597 tp->packets_out += tcp_skb_pcount(skb); 602 tp->packets_out += tcp_skb_pcount(skb);
@@ -624,9 +629,12 @@ enum tcp_ca_event {
624#define TCP_CA_MAX 128 629#define TCP_CA_MAX 128
625#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 630#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
626 631
632#define TCP_CONG_NON_RESTRICTED 0x1
633#define TCP_CONG_RTT_STAMP 0x2
634
627struct tcp_congestion_ops { 635struct tcp_congestion_ops {
628 struct list_head list; 636 struct list_head list;
629 int non_restricted; 637 unsigned long flags;
630 638
631 /* initialize private data (optional) */ 639 /* initialize private data (optional) */
632 void (*init)(struct sock *sk); 640 void (*init)(struct sock *sk);
@@ -640,8 +648,6 @@ struct tcp_congestion_ops {
640 /* do new cwnd calculation (required) */ 648 /* do new cwnd calculation (required) */
641 void (*cong_avoid)(struct sock *sk, u32 ack, 649 void (*cong_avoid)(struct sock *sk, u32 ack,
642 u32 rtt, u32 in_flight, int good_ack); 650 u32 rtt, u32 in_flight, int good_ack);
643 /* round trip time sample per acked packet (optional) */
644 void (*rtt_sample)(struct sock *sk, u32 usrtt);
645 /* call before changing ca_state (optional) */ 651 /* call before changing ca_state (optional) */
646 void (*set_state)(struct sock *sk, u8 new_state); 652 void (*set_state)(struct sock *sk, u8 new_state);
647 /* call when cwnd event occurs (optional) */ 653 /* call when cwnd event occurs (optional) */
@@ -649,7 +655,7 @@ struct tcp_congestion_ops {
649 /* new value of cwnd after loss (optional) */ 655 /* new value of cwnd after loss (optional) */
650 u32 (*undo_cwnd)(struct sock *sk); 656 u32 (*undo_cwnd)(struct sock *sk);
651 /* hook for packet ack accounting (optional) */ 657 /* hook for packet ack accounting (optional) */
652 void (*pkts_acked)(struct sock *sk, u32 num_acked); 658 void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last);
653 /* get info for inet_diag (optional) */ 659 /* get info for inet_diag (optional) */
654 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb); 660 void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
655 661
@@ -730,13 +736,11 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
730 736
731static inline void tcp_sync_left_out(struct tcp_sock *tp) 737static inline void tcp_sync_left_out(struct tcp_sock *tp)
732{ 738{
733 if (tp->rx_opt.sack_ok && 739 BUG_ON(tp->sacked_out + tp->lost_out > tp->packets_out);
734 (tp->sacked_out >= tp->packets_out - tp->lost_out))
735 tp->sacked_out = tp->packets_out - tp->lost_out;
736 tp->left_out = tp->sacked_out + tp->lost_out; 740 tp->left_out = tp->sacked_out + tp->lost_out;
737} 741}
738 742
739extern void tcp_enter_cwr(struct sock *sk); 743extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
740extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 744extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
741 745
742/* Slow start with delack produces 3 packets of burst, so that 746/* Slow start with delack produces 3 packets of burst, so that
@@ -775,18 +779,21 @@ static inline void tcp_minshall_update(struct tcp_sock *tp, int mss,
775 tp->snd_sml = TCP_SKB_CB(skb)->end_seq; 779 tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
776} 780}
777 781
778static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) 782static inline void tcp_check_probe_timer(struct sock *sk)
779{ 783{
784 struct tcp_sock *tp = tcp_sk(sk);
780 const struct inet_connection_sock *icsk = inet_csk(sk); 785 const struct inet_connection_sock *icsk = inet_csk(sk);
786
781 if (!tp->packets_out && !icsk->icsk_pending) 787 if (!tp->packets_out && !icsk->icsk_pending)
782 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0, 788 inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
783 icsk->icsk_rto, TCP_RTO_MAX); 789 icsk->icsk_rto, TCP_RTO_MAX);
784} 790}
785 791
786static inline void tcp_push_pending_frames(struct sock *sk, 792static inline void tcp_push_pending_frames(struct sock *sk)
787 struct tcp_sock *tp)
788{ 793{
789 __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); 794 struct tcp_sock *tp = tcp_sk(sk);
795
796 __tcp_push_pending_frames(sk, tcp_current_mss(sk, 1), tp->nonagle);
790} 797}
791 798
792static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) 799static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq)
@@ -802,9 +809,8 @@ static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq)
802/* 809/*
803 * Calculate(/check) TCP checksum 810 * Calculate(/check) TCP checksum
804 */ 811 */
805static inline __sum16 tcp_v4_check(struct tcphdr *th, int len, 812static inline __sum16 tcp_v4_check(int len, __be32 saddr,
806 __be32 saddr, __be32 daddr, 813 __be32 daddr, __wsum base)
807 __wsum base)
808{ 814{
809 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); 815 return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
810} 816}
@@ -816,7 +822,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
816 822
817static inline int tcp_checksum_complete(struct sk_buff *skb) 823static inline int tcp_checksum_complete(struct sk_buff *skb)
818{ 824{
819 return skb->ip_summed != CHECKSUM_UNNECESSARY && 825 return !skb_csum_unnecessary(skb) &&
820 __tcp_checksum_complete(skb); 826 __tcp_checksum_complete(skb);
821} 827}
822 828
@@ -919,21 +925,7 @@ static inline void tcp_set_state(struct sock *sk, int state)
919#endif 925#endif
920} 926}
921 927
922static inline void tcp_done(struct sock *sk) 928extern void tcp_done(struct sock *sk);
923{
924 if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
925 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
926
927 tcp_set_state(sk, TCP_CLOSE);
928 tcp_clear_xmit_timers(sk);
929
930 sk->sk_shutdown = SHUTDOWN_MASK;
931
932 if (!sock_flag(sk, SOCK_DEAD))
933 sk->sk_state_change(sk);
934 else
935 inet_csk_destroy_sock(sk);
936}
937 929
938static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 930static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
939{ 931{
@@ -982,7 +974,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
982 ireq->wscale_ok = rx_opt->wscale_ok; 974 ireq->wscale_ok = rx_opt->wscale_ok;
983 ireq->acked = 0; 975 ireq->acked = 0;
984 ireq->ecn_ok = 0; 976 ireq->ecn_ok = 0;
985 ireq->rmt_port = skb->h.th->source; 977 ireq->rmt_port = tcp_hdr(skb)->source;
986} 978}
987 979
988extern void tcp_enter_memory_pressure(void); 980extern void tcp_enter_memory_pressure(void);
@@ -1012,7 +1004,7 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1012{ 1004{
1013 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1005 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0)
1014 return 0; 1006 return 0;
1015 if (xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1007 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)
1016 return 0; 1008 return 0;
1017 1009
1018 /* RST segments are not recommended to carry timestamp, 1010 /* RST segments are not recommended to carry timestamp,
@@ -1027,26 +1019,13 @@ static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int
1027 1019
1028 However, we can relax time bounds for RST segments to MSL. 1020 However, we can relax time bounds for RST segments to MSL.
1029 */ 1021 */
1030 if (rst && xtime.tv_sec >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1022 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1031 return 0; 1023 return 0;
1032 return 1; 1024 return 1;
1033} 1025}
1034 1026
1035#define TCP_CHECK_TIMER(sk) do { } while (0) 1027#define TCP_CHECK_TIMER(sk) do { } while (0)
1036 1028
1037static inline int tcp_use_frto(const struct sock *sk)
1038{
1039 const struct tcp_sock *tp = tcp_sk(sk);
1040
1041 /* F-RTO must be activated in sysctl and there must be some
1042 * unsent new data, and the advertised window should allow
1043 * sending it.
1044 */
1045 return (sysctl_tcp_frto && sk->sk_send_head &&
1046 !after(TCP_SKB_CB(sk->sk_send_head)->end_seq,
1047 tp->snd_una + tp->snd_wnd));
1048}
1049
1050static inline void tcp_mib_init(void) 1029static inline void tcp_mib_init(void)
1051{ 1030{
1052 /* See RFC 2012 */ 1031 /* See RFC 2012 */
@@ -1173,6 +1152,125 @@ static inline void tcp_put_md5sig_pool(void)
1173 put_cpu(); 1152 put_cpu();
1174} 1153}
1175 1154
1155/* write queue abstraction */
1156static inline void tcp_write_queue_purge(struct sock *sk)
1157{
1158 struct sk_buff *skb;
1159
1160 while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
1161 sk_stream_free_skb(sk, skb);
1162 sk_stream_mem_reclaim(sk);
1163}
1164
1165static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
1166{
1167 struct sk_buff *skb = sk->sk_write_queue.next;
1168 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1169 return NULL;
1170 return skb;
1171}
1172
1173static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk)
1174{
1175 struct sk_buff *skb = sk->sk_write_queue.prev;
1176 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1177 return NULL;
1178 return skb;
1179}
1180
1181static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb)
1182{
1183 return skb->next;
1184}
1185
1186#define tcp_for_write_queue(skb, sk) \
1187 for (skb = (sk)->sk_write_queue.next; \
1188 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1189 skb = skb->next)
1190
1191#define tcp_for_write_queue_from(skb, sk) \
1192 for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\
1193 skb = skb->next)
1194
1195static inline struct sk_buff *tcp_send_head(struct sock *sk)
1196{
1197 return sk->sk_send_head;
1198}
1199
1200static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
1201{
1202 struct tcp_sock *tp = tcp_sk(sk);
1203
1204 sk->sk_send_head = skb->next;
1205 if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
1206 sk->sk_send_head = NULL;
1207 /* Don't override Nagle indefinately with F-RTO */
1208 if (tp->frto_counter == 2)
1209 tp->frto_counter = 3;
1210}
1211
1212static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
1213{
1214 if (sk->sk_send_head == skb_unlinked)
1215 sk->sk_send_head = NULL;
1216}
1217
1218static inline void tcp_init_send_head(struct sock *sk)
1219{
1220 sk->sk_send_head = NULL;
1221}
1222
1223static inline void __tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1224{
1225 __skb_queue_tail(&sk->sk_write_queue, skb);
1226}
1227
1228static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb)
1229{
1230 __tcp_add_write_queue_tail(sk, skb);
1231
1232 /* Queue it, remembering where we must start sending. */
1233 if (sk->sk_send_head == NULL)
1234 sk->sk_send_head = skb;
1235}
1236
1237static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb)
1238{
1239 __skb_queue_head(&sk->sk_write_queue, skb);
1240}
1241
1242/* Insert buff after skb on the write queue of sk. */
1243static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1244 struct sk_buff *buff,
1245 struct sock *sk)
1246{
1247 __skb_append(skb, buff, &sk->sk_write_queue);
1248}
1249
1250/* Insert skb between prev and next on the write queue of sk. */
1251static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1252 struct sk_buff *skb,
1253 struct sock *sk)
1254{
1255 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue);
1256}
1257
1258static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1259{
1260 __skb_unlink(skb, &sk->sk_write_queue);
1261}
1262
1263static inline int tcp_skb_is_last(const struct sock *sk,
1264 const struct sk_buff *skb)
1265{
1266 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1267}
1268
1269static inline int tcp_write_queue_empty(struct sock *sk)
1270{
1271 return skb_queue_empty(&sk->sk_write_queue);
1272}
1273
1176/* /proc */ 1274/* /proc */
1177enum tcp_seq_states { 1275enum tcp_seq_states {
1178 TCP_SEQ_STATE_LISTENING, 1276 TCP_SEQ_STATE_LISTENING,
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index 4629d77173f2..89eb3e05116d 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -27,9 +27,10 @@ static inline void TCP_ECN_send_synack(struct tcp_sock *tp,
27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE; 27 TCP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_ECE;
28} 28}
29 29
30static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp, 30static inline void TCP_ECN_send_syn(struct sock *sk, struct sk_buff *skb)
31 struct sk_buff *skb)
32{ 31{
32 struct tcp_sock *tp = tcp_sk(sk);
33
33 tp->ecn_flags = 0; 34 tp->ecn_flags = 0;
34 if (sysctl_tcp_ecn) { 35 if (sysctl_tcp_ecn) {
35 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR; 36 TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
@@ -44,9 +45,11 @@ TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th)
44 th->ece = 1; 45 th->ece = 1;
45} 46}
46 47
47static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp, 48static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb,
48 struct sk_buff *skb, int tcp_header_len) 49 int tcp_header_len)
49{ 50{
51 struct tcp_sock *tp = tcp_sk(sk);
52
50 if (tp->ecn_flags & TCP_ECN_OK) { 53 if (tp->ecn_flags & TCP_ECN_OK) {
51 /* Not-retransmitted data segment: set ECT and inject CWR. */ 54 /* Not-retransmitted data segment: set ECT and inject CWR. */
52 if (skb->len != tcp_header_len && 55 if (skb->len != tcp_header_len &&
@@ -54,7 +57,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
54 INET_ECN_xmit(sk); 57 INET_ECN_xmit(sk);
55 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) { 58 if (tp->ecn_flags&TCP_ECN_QUEUE_CWR) {
56 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR; 59 tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
57 skb->h.th->cwr = 1; 60 tcp_hdr(skb)->cwr = 1;
58 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; 61 skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
59 } 62 }
60 } else { 63 } else {
@@ -62,7 +65,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
62 INET_ECN_dontxmit(sk); 65 INET_ECN_dontxmit(sk);
63 } 66 }
64 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR) 67 if (tp->ecn_flags & TCP_ECN_DEMAND_CWR)
65 skb->h.th->ece = 1; 68 tcp_hdr(skb)->ece = 1;
66 } 69 }
67} 70}
68 71
@@ -70,7 +73,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct tcp_sock *tp,
70 73
71static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb) 74static inline void TCP_ECN_accept_cwr(struct tcp_sock *tp, struct sk_buff *skb)
72{ 75{
73 if (skb->h.th->cwr) 76 if (tcp_hdr(skb)->cwr)
74 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR; 77 tp->ecn_flags &= ~TCP_ECN_DEMAND_CWR;
75} 78}
76 79
diff --git a/include/net/udp.h b/include/net/udp.h
index 1b921fa81474..98755ebaf163 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -72,15 +72,12 @@ struct sk_buff;
72 */ 72 */
73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) 73static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
74{ 74{
75 if (! UDP_SKB_CB(skb)->partial_cov) 75 return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov);
76 return __skb_checksum_complete(skb);
77 return csum_fold(skb_checksum(skb, 0, UDP_SKB_CB(skb)->cscov,
78 skb->csum));
79} 76}
80 77
81static inline int udp_lib_checksum_complete(struct sk_buff *skb) 78static inline int udp_lib_checksum_complete(struct sk_buff *skb)
82{ 79{
83 return skb->ip_summed != CHECKSUM_UNNECESSARY && 80 return !skb_csum_unnecessary(skb) &&
84 __udp_lib_checksum_complete(skb); 81 __udp_lib_checksum_complete(skb);
85} 82}
86 83
@@ -92,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb)
92 */ 89 */
93static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb) 90static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
94{ 91{
95 __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0); 92 __wsum csum = csum_partial(skb_transport_header(skb),
96 93 sizeof(struct udphdr), 0);
97 skb_queue_walk(&sk->sk_write_queue, skb) { 94 skb_queue_walk(&sk->sk_write_queue, skb) {
98 csum = csum_add(csum, skb->csum); 95 csum = csum_add(csum, skb->csum);
99 } 96 }
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 67ac51424307..635b0eafca95 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -47,11 +47,10 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
47 return 1; 47 return 1;
48 } 48 }
49 49
50 UDP_SKB_CB(skb)->partial_cov = 0;
51 cscov = ntohs(uh->len); 50 cscov = ntohs(uh->len);
52 51
53 if (cscov == 0) /* Indicates that full coverage is required. */ 52 if (cscov == 0) /* Indicates that full coverage is required. */
54 cscov = skb->len; 53 ;
55 else if (cscov < 8 || cscov > skb->len) { 54 else if (cscov < 8 || cscov > skb->len) {
56 /* 55 /*
57 * Coverage length violates RFC 3828: log and discard silently. 56 * Coverage length violates RFC 3828: log and discard silently.
@@ -60,42 +59,16 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
60 cscov, skb->len); 59 cscov, skb->len);
61 return 1; 60 return 1;
62 61
63 } else if (cscov < skb->len) 62 } else if (cscov < skb->len) {
64 UDP_SKB_CB(skb)->partial_cov = 1; 63 UDP_SKB_CB(skb)->partial_cov = 1;
65 64 UDP_SKB_CB(skb)->cscov = cscov;
66 UDP_SKB_CB(skb)->cscov = cscov; 65 if (skb->ip_summed == CHECKSUM_COMPLETE)
67 66 skb->ip_summed = CHECKSUM_NONE;
68 /* 67 }
69 * There is no known NIC manufacturer supporting UDP-Lite yet,
70 * hence ip_summed is always (re-)set to CHECKSUM_NONE.
71 */
72 skb->ip_summed = CHECKSUM_NONE;
73 68
74 return 0; 69 return 0;
75} 70}
76 71
77static __inline__ int udplite4_csum_init(struct sk_buff *skb, struct udphdr *uh)
78{
79 int rc = udplite_checksum_init(skb, uh);
80
81 if (!rc)
82 skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr,
83 skb->nh.iph->daddr,
84 skb->len, IPPROTO_UDPLITE, 0);
85 return rc;
86}
87
88static __inline__ int udplite6_csum_init(struct sk_buff *skb, struct udphdr *uh)
89{
90 int rc = udplite_checksum_init(skb, uh);
91
92 if (!rc)
93 skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
94 &skb->nh.ipv6h->daddr,
95 skb->len, IPPROTO_UDPLITE, 0));
96 return rc;
97}
98
99static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) 72static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
100{ 73{
101 int cscov = up->len; 74 int cscov = up->len;
@@ -128,14 +101,14 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh)
128 101
129static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) 102static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
130{ 103{
131 int off, len, cscov = udplite_sender_cscov(udp_sk(sk), skb->h.uh); 104 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
132 __wsum csum = 0; 105 __wsum csum = 0;
133 106
134 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ 107 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
135 108
136 skb_queue_walk(&sk->sk_write_queue, skb) { 109 skb_queue_walk(&sk->sk_write_queue, skb) {
137 off = skb->h.raw - skb->data; 110 const int off = skb_transport_offset(skb);
138 len = skb->len - off; 111 const int len = skb->len - off;
139 112
140 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum); 113 csum = skb_checksum(skb, off, (cscov > len)? len : cscov, csum);
141 114
diff --git a/include/net/wext.h b/include/net/wext.h
new file mode 100644
index 000000000000..c02b8decf3af
--- /dev/null
+++ b/include/net/wext.h
@@ -0,0 +1,24 @@
1#ifndef __NET_WEXT_H
2#define __NET_WEXT_H
3
4/*
5 * wireless extensions interface to the core code
6 */
7
8#ifdef CONFIG_WIRELESS_EXT
9extern int wext_proc_init(void);
10extern int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
11 void __user *arg);
12#else
13static inline int wext_proc_init(void)
14{
15 return 0;
16}
17static inline int wext_handle_ioctl(struct ifreq *ifr, unsigned int cmd,
18 void __user *arg)
19{
20 return -EINVAL;
21}
22#endif
23
24#endif /* __NET_WEXT_H */
diff --git a/include/net/wireless.h b/include/net/wireless.h
new file mode 100644
index 000000000000..d30c4ba8fd99
--- /dev/null
+++ b/include/net/wireless.h
@@ -0,0 +1,139 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <net/cfg80211.h>
14
15/**
16 * struct wiphy - wireless hardware description
17 * @idx: the wiphy index assigned to this item
18 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
19 */
20struct wiphy {
21 /* assign these fields before you register the wiphy */
22
23 /* permanent MAC address */
24 u8 perm_addr[ETH_ALEN];
25
26 /* If multiple wiphys are registered and you're handed e.g.
27 * a regular netdev with assigned ieee80211_ptr, you won't
28 * know whether it points to a wiphy your driver has registered
29 * or not. Assign this to something global to your driver to
30 * help determine whether you own this wiphy or not. */
31 void *privid;
32
33 /* fields below are read-only, assigned by cfg80211 */
34
35 /* the item in /sys/class/ieee80211/ points to this,
36 * you need use set_wiphy_dev() (see below) */
37 struct device dev;
38
39 /* dir in debugfs: ieee80211/<wiphyname> */
40 struct dentry *debugfsdir;
41
42 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
43};
44
45/** struct wireless_dev - wireless per-netdev state
46 *
47 * This structure must be allocated by the driver/stack
48 * that uses the ieee80211_ptr field in struct net_device
49 * (this is intentional so it can be allocated along with
50 * the netdev.)
51 *
52 * @wiphy: pointer to hardware description
53 */
54struct wireless_dev {
55 struct wiphy *wiphy;
56
57 /* private to the generic wireless code */
58 struct list_head list;
59 struct net_device *netdev;
60};
61
62/**
63 * wiphy_priv - return priv from wiphy
64 */
65static inline void *wiphy_priv(struct wiphy *wiphy)
66{
67 BUG_ON(!wiphy);
68 return &wiphy->priv;
69}
70
71/**
72 * set_wiphy_dev - set device pointer for wiphy
73 */
74static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
75{
76 wiphy->dev.parent = dev;
77}
78
79/**
80 * wiphy_dev - get wiphy dev pointer
81 */
82static inline struct device *wiphy_dev(struct wiphy *wiphy)
83{
84 return wiphy->dev.parent;
85}
86
87/**
88 * wiphy_name - get wiphy name
89 */
90static inline char *wiphy_name(struct wiphy *wiphy)
91{
92 return wiphy->dev.bus_id;
93}
94
95/**
96 * wdev_priv - return wiphy priv from wireless_dev
97 */
98static inline void *wdev_priv(struct wireless_dev *wdev)
99{
100 BUG_ON(!wdev);
101 return wiphy_priv(wdev->wiphy);
102}
103
104/**
105 * wiphy_new - create a new wiphy for use with cfg80211
106 *
107 * create a new wiphy and associate the given operations with it.
108 * @sizeof_priv bytes are allocated for private use.
109 *
110 * the returned pointer must be assigned to each netdev's
111 * ieee80211_ptr for proper operation.
112 */
113struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
114
115/**
116 * wiphy_register - register a wiphy with cfg80211
117 *
118 * register the given wiphy
119 *
120 * Returns a non-negative wiphy index or a negative error code.
121 */
122extern int wiphy_register(struct wiphy *wiphy);
123
124/**
125 * wiphy_unregister - deregister a wiphy from cfg80211
126 *
127 * unregister a device with the given priv pointer.
128 * After this call, no more requests can be made with this priv
129 * pointer, but the call may sleep to wait for an outstanding
130 * request that is being handled.
131 */
132extern void wiphy_unregister(struct wiphy *wiphy);
133
134/**
135 * wiphy_free - free wiphy
136 */
137extern void wiphy_free(struct wiphy *wiphy);
138
139#endif /* __NET_WIRELESS_H */
diff --git a/include/net/x25.h b/include/net/x25.h
index e47fe440d9d7..fc3f03d976f8 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -161,6 +161,14 @@ struct x25_sock {
161 unsigned long vc_facil_mask; /* inc_call facilities mask */ 161 unsigned long vc_facil_mask; /* inc_call facilities mask */
162}; 162};
163 163
164struct x25_forward {
165 struct list_head node;
166 unsigned int lci;
167 struct net_device *dev1;
168 struct net_device *dev2;
169 atomic_t refcnt;
170};
171
164static inline struct x25_sock *x25_sk(const struct sock *sk) 172static inline struct x25_sock *x25_sk(const struct sock *sk)
165{ 173{
166 return (struct x25_sock *)sk; 174 return (struct x25_sock *)sk;
@@ -172,6 +180,7 @@ extern int sysctl_x25_call_request_timeout;
172extern int sysctl_x25_reset_request_timeout; 180extern int sysctl_x25_reset_request_timeout;
173extern int sysctl_x25_clear_request_timeout; 181extern int sysctl_x25_clear_request_timeout;
174extern int sysctl_x25_ack_holdback_timeout; 182extern int sysctl_x25_ack_holdback_timeout;
183extern int sysctl_x25_forward;
175 184
176extern int x25_addr_ntoa(unsigned char *, struct x25_address *, 185extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
177 struct x25_address *); 186 struct x25_address *);
@@ -198,6 +207,13 @@ extern int x25_negotiate_facilities(struct sk_buff *, struct sock *,
198 struct x25_dte_facilities *); 207 struct x25_dte_facilities *);
199extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); 208extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
200 209
210/* x25_forward.c */
211extern void x25_clear_forward_by_lci(unsigned int lci);
212extern void x25_clear_forward_by_dev(struct net_device *);
213extern int x25_forward_data(int, struct x25_neigh *, struct sk_buff *);
214extern int x25_forward_call(struct x25_address *, struct x25_neigh *,
215 struct sk_buff *, int);
216
201/* x25_in.c */ 217/* x25_in.c */
202extern int x25_process_rx_frame(struct sock *, struct sk_buff *); 218extern int x25_process_rx_frame(struct sock *, struct sk_buff *);
203extern int x25_backlog_rcv(struct sock *, struct sk_buff *); 219extern int x25_backlog_rcv(struct sock *, struct sk_buff *);
@@ -282,6 +298,8 @@ extern struct hlist_head x25_list;
282extern rwlock_t x25_list_lock; 298extern rwlock_t x25_list_lock;
283extern struct list_head x25_route_list; 299extern struct list_head x25_route_list;
284extern rwlock_t x25_route_list_lock; 300extern rwlock_t x25_route_list_lock;
301extern struct list_head x25_forward_list;
302extern rwlock_t x25_forward_list_lock;
285 303
286extern int x25_proc_init(void); 304extern int x25_proc_init(void);
287extern void x25_proc_exit(void); 305extern void x25_proc_exit(void);
diff --git a/include/net/x25device.h b/include/net/x25device.h
index 1d10c879f7e2..1415bcf93980 100644
--- a/include/net/x25device.h
+++ b/include/net/x25device.h
@@ -7,8 +7,8 @@
7 7
8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev) 8static inline __be16 x25_type_trans(struct sk_buff *skb, struct net_device *dev)
9{ 9{
10 skb->mac.raw = skb->data;
11 skb->dev = dev; 10 skb->dev = dev;
11 skb_reset_mac_header(skb);
12 skb->pkt_type = PACKET_HOST; 12 skb->pkt_type = PACKET_HOST;
13 13
14 return htons(ETH_P_X25); 14 return htons(ETH_P_X25);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e4765413cf80..66c2d3eec03c 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -252,10 +252,13 @@ struct xfrm_state_afinfo {
252 xfrm_address_t *daddr, xfrm_address_t *saddr); 252 xfrm_address_t *daddr, xfrm_address_t *saddr);
253 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 253 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
254 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 254 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
255 int (*output)(struct sk_buff *skb);
255}; 256};
256 257
257extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 258extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
258extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); 259extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
260extern struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family);
261extern void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
259 262
260extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 263extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
261 264
@@ -276,7 +279,7 @@ struct xfrm_type
276 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); 279 xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *);
277 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); 280 xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *);
278 /* Estimate maximal size of result of transformation of a dgram */ 281 /* Estimate maximal size of result of transformation of a dgram */
279 u32 (*get_max_size)(struct xfrm_state *, int size); 282 u32 (*get_mtu)(struct xfrm_state *, int size);
280}; 283};
281 284
282extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 285extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
@@ -359,6 +362,19 @@ struct xfrm_policy
359 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 362 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
360}; 363};
361 364
365struct xfrm_migrate {
366 xfrm_address_t old_daddr;
367 xfrm_address_t old_saddr;
368 xfrm_address_t new_daddr;
369 xfrm_address_t new_saddr;
370 u8 proto;
371 u8 mode;
372 u16 reserved;
373 u32 reqid;
374 u16 old_family;
375 u16 new_family;
376};
377
362#define XFRM_KM_TIMEOUT 30 378#define XFRM_KM_TIMEOUT 30
363/* which seqno */ 379/* which seqno */
364#define XFRM_REPLAY_SEQ 1 380#define XFRM_REPLAY_SEQ 1
@@ -385,6 +401,7 @@ struct xfrm_mgr
385 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 401 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
386 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 402 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
387 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 403 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
404 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles);
388}; 405};
389 406
390extern int xfrm_register_km(struct xfrm_mgr *km); 407extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -399,6 +416,25 @@ struct xfrm_audit
399 u32 secid; 416 u32 secid;
400}; 417};
401 418
419/* SAD metadata, add more later */
420struct xfrm_sadinfo
421{
422 u32 sadhcnt; /* current hash bkts */
423 u32 sadhmcnt; /* max allowed hash bkts */
424 u32 sadcnt; /* current running count */
425};
426
427struct xfrm_spdinfo
428{
429 u32 incnt;
430 u32 outcnt;
431 u32 fwdcnt;
432 u32 inscnt;
433 u32 outscnt;
434 u32 fwdscnt;
435 u32 spdhcnt;
436 u32 spdhmcnt;
437};
402#ifdef CONFIG_AUDITSYSCALL 438#ifdef CONFIG_AUDITSYSCALL
403extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, 439extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
404 struct xfrm_policy *xp, struct xfrm_state *x); 440 struct xfrm_policy *xp, struct xfrm_state *x);
@@ -567,6 +603,10 @@ struct xfrm_dst
567 struct rt6_info rt6; 603 struct rt6_info rt6;
568 } u; 604 } u;
569 struct dst_entry *route; 605 struct dst_entry *route;
606#ifdef CONFIG_XFRM_SUB_POLICY
607 struct flowi *origin;
608 struct xfrm_selector *partner;
609#endif
570 u32 genid; 610 u32 genid;
571 u32 route_mtu_cached; 611 u32 route_mtu_cached;
572 u32 child_mtu_cached; 612 u32 child_mtu_cached;
@@ -579,6 +619,12 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
579 dst_release(xdst->route); 619 dst_release(xdst->route);
580 if (likely(xdst->u.dst.xfrm)) 620 if (likely(xdst->u.dst.xfrm))
581 xfrm_state_put(xdst->u.dst.xfrm); 621 xfrm_state_put(xdst->u.dst.xfrm);
622#ifdef CONFIG_XFRM_SUB_POLICY
623 kfree(xdst->origin);
624 xdst->origin = NULL;
625 kfree(xdst->partner);
626 xdst->partner = NULL;
627#endif
582} 628}
583 629
584extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 630extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
@@ -921,6 +967,8 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s
921extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 967extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
922extern int xfrm_state_delete(struct xfrm_state *x); 968extern int xfrm_state_delete(struct xfrm_state *x);
923extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 969extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
970extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si);
971extern void xfrm_spd_getinfo(struct xfrm_spdinfo *si);
924extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 972extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
925extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 973extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
926extern void xfrm_replay_notify(struct xfrm_state *x, int event); 974extern void xfrm_replay_notify(struct xfrm_state *x, int event);
@@ -929,14 +977,14 @@ extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
929extern int xfrm_init_state(struct xfrm_state *x); 977extern int xfrm_init_state(struct xfrm_state *x);
930extern int xfrm4_rcv(struct sk_buff *skb); 978extern int xfrm4_rcv(struct sk_buff *skb);
931extern int xfrm4_output(struct sk_buff *skb); 979extern int xfrm4_output(struct sk_buff *skb);
932extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 980extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
933extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler); 981extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
934extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); 982extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
935extern int xfrm6_rcv(struct sk_buff **pskb); 983extern int xfrm6_rcv(struct sk_buff **pskb);
936extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 984extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
937 xfrm_address_t *saddr, u8 proto); 985 xfrm_address_t *saddr, u8 proto);
938extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler); 986extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
939extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler); 987extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
940extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); 988extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
941extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); 989extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
942extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); 990extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
@@ -971,8 +1019,9 @@ extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int,
971int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1019int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
972struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1020struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
973 struct xfrm_selector *sel, 1021 struct xfrm_selector *sel,
974 struct xfrm_sec_ctx *ctx, int delete); 1022 struct xfrm_sec_ctx *ctx, int delete,
975struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete); 1023 int *err);
1024struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
976void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1025void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
977u32 xfrm_get_acqseq(void); 1026u32 xfrm_get_acqseq(void);
978void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); 1027void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
@@ -985,6 +1034,16 @@ extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
985 struct flowi *fl, int family, int strict); 1034 struct flowi *fl, int family, int strict);
986extern void xfrm_init_pmtu(struct dst_entry *dst); 1035extern void xfrm_init_pmtu(struct dst_entry *dst);
987 1036
1037#ifdef CONFIG_XFRM_MIGRATE
1038extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1039 struct xfrm_migrate *m, int num_bundles);
1040extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m);
1041extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x,
1042 struct xfrm_migrate *m);
1043extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1044 struct xfrm_migrate *m, int num_bundles);
1045#endif
1046
988extern wait_queue_head_t km_waitq; 1047extern wait_queue_head_t km_waitq;
989extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1048extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
990extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1049extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
@@ -1050,5 +1109,25 @@ static inline void xfrm_aevent_doreplay(struct xfrm_state *x)
1050 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); 1109 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
1051} 1110}
1052 1111
1112#ifdef CONFIG_XFRM_MIGRATE
1113static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1114{
1115 return (struct xfrm_algo *)kmemdup(orig, sizeof(*orig) + orig->alg_key_len, GFP_KERNEL);
1116}
1117
1118static inline void xfrm_states_put(struct xfrm_state **states, int n)
1119{
1120 int i;
1121 for (i = 0; i < n; i++)
1122 xfrm_state_put(*(states + i));
1123}
1124
1125static inline void xfrm_states_delete(struct xfrm_state **states, int n)
1126{
1127 int i;
1128 for (i = 0; i < n; i++)
1129 xfrm_state_delete(*(states + i));
1130}
1131#endif
1053 1132
1054#endif /* _NET_XFRM_H */ 1133#endif /* _NET_XFRM_H */
diff --git a/include/pcmcia/ciscode.h b/include/pcmcia/ciscode.h
index c1da8558339a..eae7e2e84497 100644
--- a/include/pcmcia/ciscode.h
+++ b/include/pcmcia/ciscode.h
@@ -95,6 +95,7 @@
95#define PRODID_QUATECH_DUAL_RS232 0x0012 95#define PRODID_QUATECH_DUAL_RS232 0x0012
96#define PRODID_QUATECH_DUAL_RS232_D1 0x0007 96#define PRODID_QUATECH_DUAL_RS232_D1 0x0007
97#define PRODID_QUATECH_DUAL_RS232_D2 0x0052 97#define PRODID_QUATECH_DUAL_RS232_D2 0x0052
98#define PRODID_QUATECH_DUAL_RS232_G 0x004d
98#define PRODID_QUATECH_QUAD_RS232 0x001b 99#define PRODID_QUATECH_QUAD_RS232 0x001b
99#define PRODID_QUATECH_DUAL_RS422 0x000e 100#define PRODID_QUATECH_DUAL_RS422 0x000e
100#define PRODID_QUATECH_QUAD_RS422 0x0045 101#define PRODID_QUATECH_QUAD_RS422 0x0045
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 623a0fc0dae1..6e84258b94de 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -284,7 +284,7 @@ struct pcmcia_socket {
284#endif 284#endif
285 285
286 /* socket device */ 286 /* socket device */
287 struct class_device dev; 287 struct device dev;
288 void *driver_data; /* data internal to the socket driver */ 288 void *driver_data; /* data internal to the socket driver */
289 289
290}; 290};
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index c094e5012862..c36750ff6ae8 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -110,6 +110,12 @@ static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
110 dev_addr->broadcast[9] = (unsigned char) pkey; 110 dev_addr->broadcast[9] = (unsigned char) pkey;
111} 111}
112 112
113static inline void ib_addr_get_mgid(struct rdma_dev_addr *dev_addr,
114 union ib_gid *gid)
115{
116 memcpy(gid, dev_addr->broadcast + 4, sizeof *gid);
117}
118
113static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr, 119static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr,
114 union ib_gid *gid) 120 union ib_gid *gid)
115{ 121{
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index 97715b0c20b6..5e26b2f53f86 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -285,18 +285,6 @@ int ib_sa_path_rec_get(struct ib_sa_client *client,
285 void *context, 285 void *context,
286 struct ib_sa_query **query); 286 struct ib_sa_query **query);
287 287
288int ib_sa_mcmember_rec_query(struct ib_sa_client *client,
289 struct ib_device *device, u8 port_num,
290 u8 method,
291 struct ib_sa_mcmember_rec *rec,
292 ib_sa_comp_mask comp_mask,
293 int timeout_ms, gfp_t gfp_mask,
294 void (*callback)(int status,
295 struct ib_sa_mcmember_rec *resp,
296 void *context),
297 void *context,
298 struct ib_sa_query **query);
299
300int ib_sa_service_rec_query(struct ib_sa_client *client, 288int ib_sa_service_rec_query(struct ib_sa_client *client,
301 struct ib_device *device, u8 port_num, 289 struct ib_device *device, u8 port_num,
302 u8 method, 290 u8 method,
@@ -309,93 +297,82 @@ int ib_sa_service_rec_query(struct ib_sa_client *client,
309 void *context, 297 void *context,
310 struct ib_sa_query **sa_query); 298 struct ib_sa_query **sa_query);
311 299
300struct ib_sa_multicast {
301 struct ib_sa_mcmember_rec rec;
302 ib_sa_comp_mask comp_mask;
303 int (*callback)(int status,
304 struct ib_sa_multicast *multicast);
305 void *context;
306};
307
312/** 308/**
313 * ib_sa_mcmember_rec_set - Start an MCMember set query 309 * ib_sa_join_multicast - Initiates a join request to the specified multicast
314 * @client:SA client 310 * group.
315 * @device:device to send query on 311 * @client: SA client
316 * @port_num: port number to send query on 312 * @device: Device associated with the multicast group.
317 * @rec:MCMember Record to send in query 313 * @port_num: Port on the specified device to associate with the multicast
318 * @comp_mask:component mask to send in query 314 * group.
319 * @timeout_ms:time to wait for response 315 * @rec: SA multicast member record specifying group attributes.
320 * @gfp_mask:GFP mask to use for internal allocations 316 * @comp_mask: Component mask indicating which group attributes of %rec are
321 * @callback:function called when query completes, times out or is 317 * valid.
322 * canceled 318 * @gfp_mask: GFP mask for memory allocations.
323 * @context:opaque user context passed to callback 319 * @callback: User callback invoked once the join operation completes.
324 * @sa_query:query context, used to cancel query 320 * @context: User specified context stored with the ib_sa_multicast structure.
325 * 321 *
326 * Send an MCMember Set query to the SA (eg to join a multicast 322 * This call initiates a multicast join request with the SA for the specified
327 * group). The callback function will be called when the query 323 * multicast group. If the join operation is started successfully, it returns
328 * completes (or fails); status is 0 for a successful response, -EINTR 324 * an ib_sa_multicast structure that is used to track the multicast operation.
329 * if the query is canceled, -ETIMEDOUT is the query timed out, or 325 * Users must free this structure by calling ib_free_multicast, even if the
330 * -EIO if an error occurred sending the query. The resp parameter of 326 * join operation later fails. (The callback status is non-zero.)
331 * the callback is only valid if status is 0.
332 * 327 *
333 * If the return value of ib_sa_mcmember_rec_set() is negative, it is 328 * If the join operation fails; status will be non-zero, with the following
334 * an error code. Otherwise it is a query ID that can be used to 329 * failures possible:
335 * cancel the query. 330 * -ETIMEDOUT: The request timed out.
331 * -EIO: An error occurred sending the query.
332 * -EINVAL: The MCMemberRecord values differed from the existing group's.
333 * -ENETRESET: Indicates that an fatal error has occurred on the multicast
334 * group, and the user must rejoin the group to continue using it.
336 */ 335 */
337static inline int 336struct ib_sa_multicast *ib_sa_join_multicast(struct ib_sa_client *client,
338ib_sa_mcmember_rec_set(struct ib_sa_client *client, 337 struct ib_device *device, u8 port_num,
339 struct ib_device *device, u8 port_num, 338 struct ib_sa_mcmember_rec *rec,
340 struct ib_sa_mcmember_rec *rec, 339 ib_sa_comp_mask comp_mask, gfp_t gfp_mask,
341 ib_sa_comp_mask comp_mask, 340 int (*callback)(int status,
342 int timeout_ms, gfp_t gfp_mask, 341 struct ib_sa_multicast
343 void (*callback)(int status, 342 *multicast),
344 struct ib_sa_mcmember_rec *resp, 343 void *context);
345 void *context),
346 void *context,
347 struct ib_sa_query **query)
348{
349 return ib_sa_mcmember_rec_query(client, device, port_num,
350 IB_MGMT_METHOD_SET,
351 rec, comp_mask,
352 timeout_ms, gfp_mask, callback,
353 context, query);
354}
355 344
356/** 345/**
357 * ib_sa_mcmember_rec_delete - Start an MCMember delete query 346 * ib_free_multicast - Frees the multicast tracking structure, and releases
358 * @client:SA client 347 * any reference on the multicast group.
359 * @device:device to send query on 348 * @multicast: Multicast tracking structure allocated by ib_join_multicast.
360 * @port_num: port number to send query on
361 * @rec:MCMember Record to send in query
362 * @comp_mask:component mask to send in query
363 * @timeout_ms:time to wait for response
364 * @gfp_mask:GFP mask to use for internal allocations
365 * @callback:function called when query completes, times out or is
366 * canceled
367 * @context:opaque user context passed to callback
368 * @sa_query:query context, used to cancel query
369 *
370 * Send an MCMember Delete query to the SA (eg to leave a multicast
371 * group). The callback function will be called when the query
372 * completes (or fails); status is 0 for a successful response, -EINTR
373 * if the query is canceled, -ETIMEDOUT is the query timed out, or
374 * -EIO if an error occurred sending the query. The resp parameter of
375 * the callback is only valid if status is 0.
376 * 349 *
377 * If the return value of ib_sa_mcmember_rec_delete() is negative, it 350 * This call blocks until the multicast identifier is destroyed. It may
378 * is an error code. Otherwise it is a query ID that can be used to 351 * not be called from within the multicast callback; however, returning a non-
379 * cancel the query. 352 * zero value from the callback will result in destroying the multicast
353 * tracking structure.
354 */
355void ib_sa_free_multicast(struct ib_sa_multicast *multicast);
356
357/**
358 * ib_get_mcmember_rec - Looks up a multicast member record by its MGID and
359 * returns it if found.
360 * @device: Device associated with the multicast group.
361 * @port_num: Port on the specified device to associate with the multicast
362 * group.
363 * @mgid: MGID of multicast group.
364 * @rec: Location to copy SA multicast member record.
380 */ 365 */
381static inline int 366int ib_sa_get_mcmember_rec(struct ib_device *device, u8 port_num,
382ib_sa_mcmember_rec_delete(struct ib_sa_client *client, 367 union ib_gid *mgid, struct ib_sa_mcmember_rec *rec);
383 struct ib_device *device, u8 port_num, 368
384 struct ib_sa_mcmember_rec *rec, 369/**
385 ib_sa_comp_mask comp_mask, 370 * ib_init_ah_from_mcmember - Initialize address handle attributes based on
386 int timeout_ms, gfp_t gfp_mask, 371 * an SA multicast member record.
387 void (*callback)(int status, 372 */
388 struct ib_sa_mcmember_rec *resp, 373int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
389 void *context), 374 struct ib_sa_mcmember_rec *rec,
390 void *context, 375 struct ib_ah_attr *ah_attr);
391 struct ib_sa_query **query)
392{
393 return ib_sa_mcmember_rec_query(client, device, port_num,
394 IB_SA_METHOD_DELETE,
395 rec, comp_mask,
396 timeout_ms, gfp_mask, callback,
397 context, query);
398}
399 376
400/** 377/**
401 * ib_init_ah_from_path - Initialize address handle attributes based on an SA 378 * ib_init_ah_from_path - Initialize address handle attributes based on an SA
diff --git a/include/rdma/ib_user_mad.h b/include/rdma/ib_user_mad.h
index 44537aa32e62..d66b15ea82c4 100644
--- a/include/rdma/ib_user_mad.h
+++ b/include/rdma/ib_user_mad.h
@@ -98,7 +98,7 @@ struct ib_user_mad_hdr {
98 */ 98 */
99struct ib_user_mad { 99struct ib_user_mad {
100 struct ib_user_mad_hdr hdr; 100 struct ib_user_mad_hdr hdr;
101 __u8 data[0]; 101 __u64 data[0];
102}; 102};
103 103
104/** 104/**
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0bfa3328d686..765589f4d166 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -45,6 +45,7 @@
45#include <linux/device.h> 45#include <linux/device.h>
46#include <linux/mm.h> 46#include <linux/mm.h>
47#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
48#include <linux/kref.h>
48 49
49#include <asm/atomic.h> 50#include <asm/atomic.h>
50#include <asm/scatterlist.h> 51#include <asm/scatterlist.h>
@@ -419,8 +420,8 @@ struct ib_wc {
419 enum ib_wc_opcode opcode; 420 enum ib_wc_opcode opcode;
420 u32 vendor_err; 421 u32 vendor_err;
421 u32 byte_len; 422 u32 byte_len;
423 struct ib_qp *qp;
422 __be32 imm_data; 424 __be32 imm_data;
423 u32 qp_num;
424 u32 src_qp; 425 u32 src_qp;
425 int wc_flags; 426 int wc_flags;
426 u16 pkey_index; 427 u16 pkey_index;
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 36cd8a8526a0..2d6a7705eae7 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -52,10 +52,13 @@ enum rdma_cm_event_type {
52 RDMA_CM_EVENT_ESTABLISHED, 52 RDMA_CM_EVENT_ESTABLISHED,
53 RDMA_CM_EVENT_DISCONNECTED, 53 RDMA_CM_EVENT_DISCONNECTED,
54 RDMA_CM_EVENT_DEVICE_REMOVAL, 54 RDMA_CM_EVENT_DEVICE_REMOVAL,
55 RDMA_CM_EVENT_MULTICAST_JOIN,
56 RDMA_CM_EVENT_MULTICAST_ERROR
55}; 57};
56 58
57enum rdma_port_space { 59enum rdma_port_space {
58 RDMA_PS_SDP = 0x0001, 60 RDMA_PS_SDP = 0x0001,
61 RDMA_PS_IPOIB= 0x0002,
59 RDMA_PS_TCP = 0x0106, 62 RDMA_PS_TCP = 0x0106,
60 RDMA_PS_UDP = 0x0111, 63 RDMA_PS_UDP = 0x0111,
61 RDMA_PS_SCTP = 0x0183 64 RDMA_PS_SCTP = 0x0183
@@ -294,5 +297,21 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
294 */ 297 */
295int rdma_disconnect(struct rdma_cm_id *id); 298int rdma_disconnect(struct rdma_cm_id *id);
296 299
297#endif /* RDMA_CM_H */ 300/**
301 * rdma_join_multicast - Join the multicast group specified by the given
302 * address.
303 * @id: Communication identifier associated with the request.
304 * @addr: Multicast address identifying the group to join.
305 * @context: User-defined context associated with the join request, returned
306 * to the user through the private_data pointer in multicast events.
307 */
308int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,
309 void *context);
298 310
311/**
312 * rdma_leave_multicast - Leave the multicast group specified by the given
313 * address.
314 */
315void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr);
316
317#endif /* RDMA_CM_H */
diff --git a/include/rdma/rdma_cm_ib.h b/include/rdma/rdma_cm_ib.h
index 9b176df1d667..950424b38f16 100644
--- a/include/rdma/rdma_cm_ib.h
+++ b/include/rdma/rdma_cm_ib.h
@@ -44,7 +44,7 @@
44int rdma_set_ib_paths(struct rdma_cm_id *id, 44int rdma_set_ib_paths(struct rdma_cm_id *id,
45 struct ib_sa_path_rec *path_rec, int num_paths); 45 struct ib_sa_path_rec *path_rec, int num_paths);
46 46
47/* Global qkey for UD QPs and multicast groups. */ 47/* Global qkey for UDP QPs and multicast groups. */
48#define RDMA_UD_QKEY 0x01234567 48#define RDMA_UDP_QKEY 0x01234567
49 49
50#endif /* RDMA_CM_IB_H */ 50#endif /* RDMA_CM_IB_H */
diff --git a/include/rdma/rdma_user_cm.h b/include/rdma/rdma_user_cm.h
index 9572ab8eeac1..f632b0c007c9 100644
--- a/include/rdma/rdma_user_cm.h
+++ b/include/rdma/rdma_user_cm.h
@@ -38,7 +38,7 @@
38#include <rdma/ib_user_verbs.h> 38#include <rdma/ib_user_verbs.h>
39#include <rdma/ib_user_sa.h> 39#include <rdma/ib_user_sa.h>
40 40
41#define RDMA_USER_CM_ABI_VERSION 3 41#define RDMA_USER_CM_ABI_VERSION 4
42 42
43#define RDMA_MAX_PRIVATE_DATA 256 43#define RDMA_MAX_PRIVATE_DATA 256
44 44
@@ -58,7 +58,9 @@ enum {
58 RDMA_USER_CM_CMD_GET_EVENT, 58 RDMA_USER_CM_CMD_GET_EVENT,
59 RDMA_USER_CM_CMD_GET_OPTION, 59 RDMA_USER_CM_CMD_GET_OPTION,
60 RDMA_USER_CM_CMD_SET_OPTION, 60 RDMA_USER_CM_CMD_SET_OPTION,
61 RDMA_USER_CM_CMD_NOTIFY 61 RDMA_USER_CM_CMD_NOTIFY,
62 RDMA_USER_CM_CMD_JOIN_MCAST,
63 RDMA_USER_CM_CMD_LEAVE_MCAST
62}; 64};
63 65
64/* 66/*
@@ -188,6 +190,13 @@ struct rdma_ucm_notify {
188 __u32 event; 190 __u32 event;
189}; 191};
190 192
193struct rdma_ucm_join_mcast {
194 __u64 response; /* rdma_ucm_create_id_resp */
195 __u64 uid;
196 struct sockaddr_in6 addr;
197 __u32 id;
198};
199
191struct rdma_ucm_get_event { 200struct rdma_ucm_get_event {
192 __u64 response; 201 __u64 response;
193}; 202};
diff --git a/include/rxrpc/call.h b/include/rxrpc/call.h
deleted file mode 100644
index b86f83743510..000000000000
--- a/include/rxrpc/call.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/* call.h: Rx call record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CALL_H
13#define _LINUX_RXRPC_CALL_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/rxrpc.h>
17#include <rxrpc/packet.h>
18#include <linux/timer.h>
19
20#define RXRPC_CALL_ACK_WINDOW_SIZE 16
21
22extern unsigned rxrpc_call_rcv_timeout; /* receive activity timeout (secs) */
23
24/* application call state
25 * - only state 0 and ffff are reserved, the state is set to 1 after an opid is received
26 */
27enum rxrpc_app_cstate {
28 RXRPC_CSTATE_COMPLETE = 0, /* operation complete */
29 RXRPC_CSTATE_ERROR, /* operation ICMP error or aborted */
30 RXRPC_CSTATE_SRVR_RCV_OPID, /* [SERVER] receiving operation ID */
31 RXRPC_CSTATE_SRVR_RCV_ARGS, /* [SERVER] receiving operation data */
32 RXRPC_CSTATE_SRVR_GOT_ARGS, /* [SERVER] completely received operation data */
33 RXRPC_CSTATE_SRVR_SND_REPLY, /* [SERVER] sending operation reply */
34 RXRPC_CSTATE_SRVR_RCV_FINAL_ACK, /* [SERVER] receiving final ACK */
35 RXRPC_CSTATE_CLNT_SND_ARGS, /* [CLIENT] sending operation args */
36 RXRPC_CSTATE_CLNT_RCV_REPLY, /* [CLIENT] receiving operation reply */
37 RXRPC_CSTATE_CLNT_GOT_REPLY, /* [CLIENT] completely received operation reply */
38} __attribute__((packed));
39
40extern const char *rxrpc_call_states[];
41
42enum rxrpc_app_estate {
43 RXRPC_ESTATE_NO_ERROR = 0, /* no error */
44 RXRPC_ESTATE_LOCAL_ABORT, /* aborted locally by application layer */
45 RXRPC_ESTATE_PEER_ABORT, /* aborted remotely by peer */
46 RXRPC_ESTATE_LOCAL_ERROR, /* local ICMP network error */
47 RXRPC_ESTATE_REMOTE_ERROR, /* remote ICMP network error */
48} __attribute__((packed));
49
50extern const char *rxrpc_call_error_states[];
51
52/*****************************************************************************/
53/*
54 * Rx call record and application scratch buffer
55 * - the call record occupies the bottom of a complete page
56 * - the application scratch buffer occupies the rest
57 */
58struct rxrpc_call
59{
60 atomic_t usage;
61 struct rxrpc_connection *conn; /* connection upon which active */
62 spinlock_t lock; /* access lock */
63 struct module *owner; /* owner module */
64 wait_queue_head_t waitq; /* wait queue for events to happen */
65 struct list_head link; /* general internal list link */
66 struct list_head call_link; /* master call list link */
67 __be32 chan_ix; /* connection channel index */
68 __be32 call_id; /* call ID on connection */
69 unsigned long cjif; /* jiffies at call creation */
70 unsigned long flags; /* control flags */
71#define RXRPC_CALL_ACKS_TIMO 0x00000001 /* ACKS timeout reached */
72#define RXRPC_CALL_ACKR_TIMO 0x00000002 /* ACKR timeout reached */
73#define RXRPC_CALL_RCV_TIMO 0x00000004 /* RCV timeout reached */
74#define RXRPC_CALL_RCV_PKT 0x00000008 /* received packet */
75
76 /* transmission */
77 rxrpc_seq_t snd_seq_count; /* outgoing packet sequence number counter */
78 struct rxrpc_message *snd_nextmsg; /* next message being constructed for sending */
79 struct rxrpc_message *snd_ping; /* last ping message sent */
80 unsigned short snd_resend_cnt; /* count of resends since last ACK */
81
82 /* transmission ACK tracking */
83 struct list_head acks_pendq; /* messages pending ACK (ordered by seq) */
84 unsigned acks_pend_cnt; /* number of un-ACK'd packets */
85 rxrpc_seq_t acks_dftv_seq; /* highest definitively ACK'd msg seq */
86 struct timer_list acks_timeout; /* timeout on expected ACK */
87
88 /* reception */
89 struct list_head rcv_receiveq; /* messages pending reception (ordered by seq) */
90 struct list_head rcv_krxiodq_lk; /* krxiod queue for new inbound packets */
91 struct timer_list rcv_timeout; /* call receive activity timeout */
92
93 /* reception ACK'ing */
94 rxrpc_seq_t ackr_win_bot; /* bottom of ACK window */
95 rxrpc_seq_t ackr_win_top; /* top of ACK window */
96 rxrpc_seq_t ackr_high_seq; /* highest seqno yet received */
97 rxrpc_seq_net_t ackr_prev_seq; /* previous seqno received */
98 unsigned ackr_pend_cnt; /* number of pending ACKs */
99 struct timer_list ackr_dfr_timo; /* timeout on deferred ACK */
100 char ackr_dfr_perm; /* request for deferred ACKs permitted */
101 rxrpc_seq_t ackr_dfr_seq; /* seqno for deferred ACK */
102 struct rxrpc_ackpacket ackr; /* pending normal ACK packet */
103 uint8_t ackr_array[RXRPC_CALL_ACK_WINDOW_SIZE]; /* ACK records */
104
105 /* presentation layer */
106 char app_last_rcv; /* T if received last packet from remote end */
107 enum rxrpc_app_cstate app_call_state; /* call state */
108 enum rxrpc_app_estate app_err_state; /* abort/error state */
109 struct list_head app_readyq; /* ordered ready received packet queue */
110 struct list_head app_unreadyq; /* ordered post-hole recv'd packet queue */
111 rxrpc_seq_t app_ready_seq; /* last seq number dropped into readyq */
112 size_t app_ready_qty; /* amount of data ready in readyq */
113 unsigned app_opcode; /* operation ID */
114 unsigned app_abort_code; /* abort code (when aborted) */
115 int app_errno; /* error number (when ICMP error received) */
116
117 /* statisics */
118 unsigned pkt_rcv_count; /* count of received packets on this call */
119 unsigned pkt_snd_count; /* count of sent packets on this call */
120 unsigned app_read_count; /* number of reads issued */
121
122 /* bits for the application to use */
123 rxrpc_call_attn_func_t app_attn_func; /* callback when attention required */
124 rxrpc_call_error_func_t app_error_func; /* callback when abort sent (cleanup and put) */
125 rxrpc_call_aemap_func_t app_aemap_func; /* callback to map abort code to/from errno */
126 void *app_user; /* application data */
127 struct list_head app_link; /* application list linkage */
128 struct list_head app_attn_link; /* application attention list linkage */
129 size_t app_mark; /* trigger callback when app_ready_qty>=app_mark */
130 char app_async_read; /* T if in async-read mode */
131 uint8_t *app_read_buf; /* application async read buffer (app_mark size) */
132 uint8_t *app_scr_alloc; /* application scratch allocation pointer */
133 void *app_scr_ptr; /* application pointer into scratch buffer */
134
135#define RXRPC_APP_MARK_EOF 0xFFFFFFFFU /* mark at end of input */
136
137 /* application scratch buffer */
138 uint8_t app_scratch[0] __attribute__((aligned(sizeof(long))));
139};
140
141#define RXRPC_CALL_SCRATCH_SIZE (PAGE_SIZE - sizeof(struct rxrpc_call))
142
143#define rxrpc_call_reset_scratch(CALL) \
144do { (CALL)->app_scr_alloc = (CALL)->app_scratch; } while(0)
145
146#define rxrpc_call_alloc_scratch(CALL,SIZE) \
147({ \
148 void *ptr; \
149 ptr = (CALL)->app_scr_alloc; \
150 (CALL)->app_scr_alloc += (SIZE); \
151 if ((SIZE)>RXRPC_CALL_SCRATCH_SIZE || \
152 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
153 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),(size_t)(SIZE)); \
154 BUG(); \
155 } \
156 ptr; \
157})
158
159#define rxrpc_call_alloc_scratch_s(CALL,TYPE) \
160({ \
161 size_t size = sizeof(TYPE); \
162 TYPE *ptr; \
163 ptr = (TYPE*)(CALL)->app_scr_alloc; \
164 (CALL)->app_scr_alloc += size; \
165 if (size>RXRPC_CALL_SCRATCH_SIZE || \
166 (size_t)((CALL)->app_scr_alloc - (u8*)(CALL)) > RXRPC_CALL_SCRATCH_SIZE) { \
167 printk("rxrpc_call_alloc_scratch(%p,%Zu)\n",(CALL),size); \
168 BUG(); \
169 } \
170 ptr; \
171})
172
173#define rxrpc_call_is_ack_pending(CALL) ((CALL)->ackr.reason != 0)
174
175extern int rxrpc_create_call(struct rxrpc_connection *conn,
176 rxrpc_call_attn_func_t attn,
177 rxrpc_call_error_func_t error,
178 rxrpc_call_aemap_func_t aemap,
179 struct rxrpc_call **_call);
180
181extern int rxrpc_incoming_call(struct rxrpc_connection *conn,
182 struct rxrpc_message *msg,
183 struct rxrpc_call **_call);
184
185static inline void rxrpc_get_call(struct rxrpc_call *call)
186{
187 BUG_ON(atomic_read(&call->usage)<=0);
188 atomic_inc(&call->usage);
189 /*printk("rxrpc_get_call(%p{u=%d})\n",(C),atomic_read(&(C)->usage));*/
190}
191
192extern void rxrpc_put_call(struct rxrpc_call *call);
193
194extern void rxrpc_call_do_stuff(struct rxrpc_call *call);
195
196extern int rxrpc_call_abort(struct rxrpc_call *call, int error);
197
198#define RXRPC_CALL_READ_BLOCK 0x0001 /* block if not enough data and not yet EOF */
199#define RXRPC_CALL_READ_ALL 0x0002 /* error if insufficient data received */
200extern int rxrpc_call_read_data(struct rxrpc_call *call, void *buffer, size_t size, int flags);
201
202extern int rxrpc_call_write_data(struct rxrpc_call *call,
203 size_t sioc,
204 struct kvec *siov,
205 uint8_t rxhdr_flags,
206 gfp_t alloc_flags,
207 int dup_data,
208 size_t *size_sent);
209
210extern void rxrpc_call_handle_error(struct rxrpc_call *conn, int local, int errno);
211
212#endif /* _LINUX_RXRPC_CALL_H */
diff --git a/include/rxrpc/connection.h b/include/rxrpc/connection.h
deleted file mode 100644
index 41e6781ad067..000000000000
--- a/include/rxrpc/connection.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/* connection.h: Rx connection record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_CONNECTION_H
13#define _LINUX_RXRPC_CONNECTION_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxtimod.h>
17
18struct sk_buff;
19
20/*****************************************************************************/
21/*
22 * Rx connection
23 * - connections are matched by (rmt_port,rmt_addr,service_id,conn_id,clientflag)
24 * - connections only retain a refcount on the peer when they are active
25 * - connections with refcount==0 are inactive and reside in the peer's graveyard
26 */
27struct rxrpc_connection
28{
29 atomic_t usage;
30 struct rxrpc_transport *trans; /* transport endpoint */
31 struct rxrpc_peer *peer; /* peer from/to which connected */
32 struct rxrpc_service *service; /* responsible service (inbound conns) */
33 struct rxrpc_timer timeout; /* decaching timer */
34 struct list_head link; /* link in peer's list */
35 struct list_head proc_link; /* link in proc list */
36 struct list_head err_link; /* link in ICMP error processing list */
37 struct list_head id_link; /* link in ID grant list */
38 struct sockaddr_in addr; /* remote address */
39 struct rxrpc_call *channels[4]; /* channels (active calls) */
40 wait_queue_head_t chanwait; /* wait for channel to become available */
41 spinlock_t lock; /* access lock */
42 struct timeval atime; /* last access time */
43 size_t mtu_size; /* MTU size for outbound messages */
44 unsigned call_counter; /* call ID counter */
45 rxrpc_serial_t serial_counter; /* packet serial number counter */
46
47 /* the following should all be in net order */
48 __be32 in_epoch; /* peer's epoch */
49 __be32 out_epoch; /* my epoch */
50 __be32 conn_id; /* connection ID, appropriately shifted */
51 __be16 service_id; /* service ID */
52 uint8_t security_ix; /* security ID */
53 uint8_t in_clientflag; /* RXRPC_CLIENT_INITIATED if we are server */
54 uint8_t out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */
55};
56
57extern int rxrpc_create_connection(struct rxrpc_transport *trans,
58 __be16 port,
59 __be32 addr,
60 uint16_t service_id,
61 void *security,
62 struct rxrpc_connection **_conn);
63
64extern int rxrpc_connection_lookup(struct rxrpc_peer *peer,
65 struct rxrpc_message *msg,
66 struct rxrpc_connection **_conn);
67
68static inline void rxrpc_get_connection(struct rxrpc_connection *conn)
69{
70 BUG_ON(atomic_read(&conn->usage)<0);
71 atomic_inc(&conn->usage);
72 //printk("rxrpc_get_conn(%p{u=%d})\n",conn,atomic_read(&conn->usage));
73}
74
75extern void rxrpc_put_connection(struct rxrpc_connection *conn);
76
77extern int rxrpc_conn_receive_call_packet(struct rxrpc_connection *conn,
78 struct rxrpc_call *call,
79 struct rxrpc_message *msg);
80
81extern void rxrpc_conn_handle_error(struct rxrpc_connection *conn, int local, int errno);
82
83#endif /* _LINUX_RXRPC_CONNECTION_H */
diff --git a/include/rxrpc/krxiod.h b/include/rxrpc/krxiod.h
deleted file mode 100644
index c0e0e82e4df2..000000000000
--- a/include/rxrpc/krxiod.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* krxiod.h: Rx RPC I/O kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXIOD_H
13#define _LINUX_RXRPC_KRXIOD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxiod_init(void);
18extern void rxrpc_krxiod_kill(void);
19extern void rxrpc_krxiod_queue_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxiod_dequeue_transport(struct rxrpc_transport *trans);
21extern void rxrpc_krxiod_queue_peer(struct rxrpc_peer *peer);
22extern void rxrpc_krxiod_dequeue_peer(struct rxrpc_peer *peer);
23extern void rxrpc_krxiod_clear_peers(struct rxrpc_transport *trans);
24extern void rxrpc_krxiod_queue_call(struct rxrpc_call *call);
25extern void rxrpc_krxiod_dequeue_call(struct rxrpc_call *call);
26
27#endif /* _LINUX_RXRPC_KRXIOD_H */
diff --git a/include/rxrpc/krxsecd.h b/include/rxrpc/krxsecd.h
deleted file mode 100644
index 55ce43a25b38..000000000000
--- a/include/rxrpc/krxsecd.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* krxsecd.h: Rx RPC security kernel thread interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXSECD_H
13#define _LINUX_RXRPC_KRXSECD_H
14
15#include <rxrpc/types.h>
16
17extern int rxrpc_krxsecd_init(void);
18extern void rxrpc_krxsecd_kill(void);
19extern void rxrpc_krxsecd_clear_transport(struct rxrpc_transport *trans);
20extern void rxrpc_krxsecd_queue_incoming_call(struct rxrpc_message *msg);
21
22#endif /* _LINUX_RXRPC_KRXSECD_H */
diff --git a/include/rxrpc/krxtimod.h b/include/rxrpc/krxtimod.h
deleted file mode 100644
index b3d298b612f2..000000000000
--- a/include/rxrpc/krxtimod.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/* krxtimod.h: RxRPC timeout daemon
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_KRXTIMOD_H
13#define _LINUX_RXRPC_KRXTIMOD_H
14
15#include <rxrpc/types.h>
16
17struct rxrpc_timer_ops {
18 /* called when the front of the timer queue has timed out */
19 void (*timed_out)(struct rxrpc_timer *timer);
20};
21
22/*****************************************************************************/
23/*
24 * RXRPC timer/timeout record
25 */
26struct rxrpc_timer
27{
28 struct list_head link; /* link in timer queue */
29 unsigned long timo_jif; /* timeout time */
30 const struct rxrpc_timer_ops *ops; /* timeout expiry function */
31};
32
33static inline void rxrpc_timer_init(rxrpc_timer_t *timer, const struct rxrpc_timer_ops *ops)
34{
35 INIT_LIST_HEAD(&timer->link);
36 timer->ops = ops;
37}
38
39extern int rxrpc_krxtimod_start(void);
40extern void rxrpc_krxtimod_kill(void);
41
42extern void rxrpc_krxtimod_add_timer(rxrpc_timer_t *timer, unsigned long timeout);
43extern int rxrpc_krxtimod_del_timer(rxrpc_timer_t *timer);
44
45#endif /* _LINUX_RXRPC_KRXTIMOD_H */
diff --git a/include/rxrpc/message.h b/include/rxrpc/message.h
deleted file mode 100644
index b318f273d4f2..000000000000
--- a/include/rxrpc/message.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* message.h: Rx message caching
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_MESSAGE_H
13#define _LINUX_RXRPC_MESSAGE_H
14
15#include <rxrpc/packet.h>
16
17/*****************************************************************************/
18/*
19 * Rx message record
20 */
21struct rxrpc_message
22{
23 atomic_t usage;
24 struct list_head link; /* list link */
25 struct timeval stamp; /* time received or last sent */
26 rxrpc_seq_t seq; /* message sequence number */
27
28 int state; /* the state the message is currently in */
29#define RXRPC_MSG_PREPARED 0
30#define RXRPC_MSG_SENT 1
31#define RXRPC_MSG_ACKED 2 /* provisionally ACK'd */
32#define RXRPC_MSG_DONE 3 /* definitively ACK'd (msg->seq<ack.firstPacket) */
33#define RXRPC_MSG_RECEIVED 4
34#define RXRPC_MSG_ERROR -1
35 char rttdone; /* used for RTT */
36
37 struct rxrpc_transport *trans; /* transport received through */
38 struct rxrpc_connection *conn; /* connection received over */
39 struct sk_buff *pkt; /* received packet */
40 off_t offset; /* offset into pkt of next byte of data */
41
42 struct rxrpc_header hdr; /* message header */
43
44 int dcount; /* data part count */
45 size_t dsize; /* data size */
46#define RXRPC_MSG_MAX_IOCS 8
47 struct kvec data[RXRPC_MSG_MAX_IOCS]; /* message data */
48 unsigned long dfree; /* bit mask indicating kfree(data[x]) if T */
49};
50
51#define rxrpc_get_message(M) do { atomic_inc(&(M)->usage); } while(0)
52
53extern void __rxrpc_put_message(struct rxrpc_message *msg);
54static inline void rxrpc_put_message(struct rxrpc_message *msg)
55{
56 BUG_ON(atomic_read(&msg->usage)<=0);
57 if (atomic_dec_and_test(&msg->usage))
58 __rxrpc_put_message(msg);
59}
60
61extern int rxrpc_conn_newmsg(struct rxrpc_connection *conn,
62 struct rxrpc_call *call,
63 uint8_t type,
64 int count,
65 struct kvec *diov,
66 gfp_t alloc_flags,
67 struct rxrpc_message **_msg);
68
69extern int rxrpc_conn_sendmsg(struct rxrpc_connection *conn, struct rxrpc_message *msg);
70
71#endif /* _LINUX_RXRPC_MESSAGE_H */
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index 1447f0aaa0eb..b69e6e173ea1 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -1,6 +1,6 @@
1/* packet.h: Rx packet layout and definitions 1/* packet.h: Rx packet layout and definitions
2 * 2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -12,28 +12,25 @@
12#ifndef _LINUX_RXRPC_PACKET_H 12#ifndef _LINUX_RXRPC_PACKET_H
13#define _LINUX_RXRPC_PACKET_H 13#define _LINUX_RXRPC_PACKET_H
14 14
15#include <rxrpc/types.h> 15typedef u32 rxrpc_seq_t; /* Rx message sequence number */
16 16typedef u32 rxrpc_serial_t; /* Rx message serial number */
17#define RXRPC_IPUDP_SIZE 28 17typedef __be32 rxrpc_seq_net_t; /* on-the-wire Rx message sequence number */
18extern size_t RXRPC_MAX_PACKET_SIZE; 18typedef __be32 rxrpc_serial_net_t; /* on-the-wire Rx message serial number */
19#define RXRPC_MAX_PACKET_DATA_SIZE (RXRPC_MAX_PACKET_SIZE - sizeof(struct rxrpc_header))
20#define RXRPC_LOCAL_PACKET_SIZE RXRPC_MAX_PACKET_SIZE
21#define RXRPC_REMOTE_PACKET_SIZE (576 - RXRPC_IPUDP_SIZE)
22 19
23/*****************************************************************************/ 20/*****************************************************************************/
24/* 21/*
25 * on-the-wire Rx packet header 22 * on-the-wire Rx packet header
26 * - all multibyte fields should be in network byte order 23 * - all multibyte fields should be in network byte order
27 */ 24 */
28struct rxrpc_header 25struct rxrpc_header {
29{
30 __be32 epoch; /* client boot timestamp */ 26 __be32 epoch; /* client boot timestamp */
31 27
32 __be32 cid; /* connection and channel ID */ 28 __be32 cid; /* connection and channel ID */
33#define RXRPC_MAXCALLS 4 /* max active calls per conn */ 29#define RXRPC_MAXCALLS 4 /* max active calls per conn */
34#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */ 30#define RXRPC_CHANNELMASK (RXRPC_MAXCALLS-1) /* mask for channel ID */
35#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */ 31#define RXRPC_CIDMASK (~RXRPC_CHANNELMASK) /* mask for connection ID */
36#define RXRPC_CIDSHIFT 2 /* shift for connection ID */ 32#define RXRPC_CIDSHIFT ilog2(RXRPC_MAXCALLS) /* shift for connection ID */
33#define RXRPC_CID_INC (1 << RXRPC_CIDSHIFT) /* connection ID increment */
37 34
38 __be32 callNumber; /* call ID (0 for connection-level packets) */ 35 __be32 callNumber; /* call ID (0 for connection-level packets) */
39#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */ 36#define RXRPC_PROCESS_MAXCALLS (1<<2) /* maximum number of active calls per conn (power of 2) */
@@ -62,7 +59,10 @@ struct rxrpc_header
62 59
63 uint8_t userStatus; /* app-layer defined status */ 60 uint8_t userStatus; /* app-layer defined status */
64 uint8_t securityIndex; /* security protocol ID */ 61 uint8_t securityIndex; /* security protocol ID */
65 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 62 union {
63 __be16 _rsvd; /* reserved */
64 __be16 cksum; /* kerberos security checksum */
65 };
66 __be16 serviceId; /* service ID */ 66 __be16 serviceId; /* service ID */
67 67
68} __attribute__((packed)); 68} __attribute__((packed));
@@ -81,8 +81,7 @@ extern const char *rxrpc_pkts[];
81 * - new__rsvd = j__rsvd 81 * - new__rsvd = j__rsvd
82 * - duplicating all other fields 82 * - duplicating all other fields
83 */ 83 */
84struct rxrpc_jumbo_header 84struct rxrpc_jumbo_header {
85{
86 uint8_t flags; /* packet flags (as per rxrpc_header) */ 85 uint8_t flags; /* packet flags (as per rxrpc_header) */
87 uint8_t pad; 86 uint8_t pad;
88 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */ 87 __be16 _rsvd; /* reserved (used by kerberos security as cksum) */
@@ -95,8 +94,7 @@ struct rxrpc_jumbo_header
95 * on-the-wire Rx ACK packet data payload 94 * on-the-wire Rx ACK packet data payload
96 * - all multibyte fields should be in network byte order 95 * - all multibyte fields should be in network byte order
97 */ 96 */
98struct rxrpc_ackpacket 97struct rxrpc_ackpacket {
99{
100 __be16 bufferSpace; /* number of packet buffers available */ 98 __be16 bufferSpace; /* number of packet buffers available */
101 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no 99 __be16 maxSkew; /* diff between serno being ACK'd and highest serial no
102 * received */ 100 * received */
@@ -124,4 +122,93 @@ struct rxrpc_ackpacket
124 122
125} __attribute__((packed)); 123} __attribute__((packed));
126 124
125/*
126 * ACK packets can have a further piece of information tagged on the end
127 */
128struct rxrpc_ackinfo {
129 __be32 rxMTU; /* maximum Rx MTU size (bytes) [AFS 3.3] */
130 __be32 maxMTU; /* maximum interface MTU size (bytes) [AFS 3.3] */
131 __be32 rwind; /* Rx window size (packets) [AFS 3.4] */
132 __be32 jumbo_max; /* max packets to stick into a jumbo packet [AFS 3.5] */
133};
134
135/*****************************************************************************/
136/*
137 * Kerberos security type-2 challenge packet
138 */
139struct rxkad_challenge {
140 __be32 version; /* version of this challenge type */
141 __be32 nonce; /* encrypted random number */
142 __be32 min_level; /* minimum security level */
143 __be32 __padding; /* padding to 8-byte boundary */
144} __attribute__((packed));
145
146/*****************************************************************************/
147/*
148 * Kerberos security type-2 response packet
149 */
150struct rxkad_response {
151 __be32 version; /* version of this reponse type */
152 __be32 __pad;
153
154 /* encrypted bit of the response */
155 struct {
156 __be32 epoch; /* current epoch */
157 __be32 cid; /* parent connection ID */
158 __be32 checksum; /* checksum */
159 __be32 securityIndex; /* security type */
160 __be32 call_id[4]; /* encrypted call IDs */
161 __be32 inc_nonce; /* challenge nonce + 1 */
162 __be32 level; /* desired level */
163 } encrypted;
164
165 __be32 kvno; /* Kerberos key version number */
166 __be32 ticket_len; /* Kerberos ticket length */
167} __attribute__((packed));
168
169/*****************************************************************************/
170/*
171 * RxRPC-level abort codes
172 */
173#define RX_CALL_DEAD -1 /* call/conn has been inactive and is shut down */
174#define RX_INVALID_OPERATION -2 /* invalid operation requested / attempted */
175#define RX_CALL_TIMEOUT -3 /* call timeout exceeded */
176#define RX_EOF -4 /* unexpected end of data on read op */
177#define RX_PROTOCOL_ERROR -5 /* low-level protocol error */
178#define RX_USER_ABORT -6 /* generic user abort */
179#define RX_ADDRINUSE -7 /* UDP port in use */
180#define RX_DEBUGI_BADTYPE -8 /* bad debugging packet type */
181
182/*
183 * (un)marshalling abort codes (rxgen)
184 */
185#define RXGEN_CC_MARSHAL -450
186#define RXGEN_CC_UNMARSHAL -451
187#define RXGEN_SS_MARSHAL -452
188#define RXGEN_SS_UNMARSHAL -453
189#define RXGEN_DECODE -454
190#define RXGEN_OPCODE -455
191#define RXGEN_SS_XDRFREE -456
192#define RXGEN_CC_XDRFREE -457
193
194/*
195 * Rx kerberos security abort codes
196 * - unfortunately we have no generalised security abort codes to say things
197 * like "unsupported security", so we have to use these instead and hope the
198 * other side understands
199 */
200#define RXKADINCONSISTENCY 19270400 /* security module structure inconsistent */
201#define RXKADPACKETSHORT 19270401 /* packet too short for security challenge */
202#define RXKADLEVELFAIL 19270402 /* security level negotiation failed */
203#define RXKADTICKETLEN 19270403 /* ticket length too short or too long */
204#define RXKADOUTOFSEQUENCE 19270404 /* packet had bad sequence number */
205#define RXKADNOAUTH 19270405 /* caller not authorised */
206#define RXKADBADKEY 19270406 /* illegal key: bad parity or weak */
207#define RXKADBADTICKET 19270407 /* security object was passed a bad ticket */
208#define RXKADUNKNOWNKEY 19270408 /* ticket contained unknown key version number */
209#define RXKADEXPIRED 19270409 /* authentication expired */
210#define RXKADSEALEDINCON 19270410 /* sealed data inconsistent */
211#define RXKADDATALEN 19270411 /* user data too long */
212#define RXKADILLEGALLEVEL 19270412 /* caller not authorised to use encrypted conns */
213
127#endif /* _LINUX_RXRPC_PACKET_H */ 214#endif /* _LINUX_RXRPC_PACKET_H */
diff --git a/include/rxrpc/peer.h b/include/rxrpc/peer.h
deleted file mode 100644
index 8b8fe97cbbcc..000000000000
--- a/include/rxrpc/peer.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* peer.h: Rx RPC per-transport peer record
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_PEER_H
13#define _LINUX_RXRPC_PEER_H
14
15#include <linux/wait.h>
16#include <rxrpc/types.h>
17#include <rxrpc/krxtimod.h>
18
19struct rxrpc_peer_ops
20{
21 /* peer record being added */
22 int (*adding)(struct rxrpc_peer *peer);
23
24 /* peer record being discarded from graveyard */
25 void (*discarding)(struct rxrpc_peer *peer);
26
27 /* change of epoch detected on connection */
28 void (*change_of_epoch)(struct rxrpc_connection *conn);
29};
30
31/*****************************************************************************/
32/*
33 * Rx RPC per-transport peer record
34 * - peers only retain a refcount on the transport when they are active
35 * - peers with refcount==0 are inactive and reside in the transport's graveyard
36 */
37struct rxrpc_peer
38{
39 atomic_t usage;
40 struct rxrpc_peer_ops *ops; /* operations on this peer */
41 struct rxrpc_transport *trans; /* owner transport */
42 struct rxrpc_timer timeout; /* timeout for grave destruction */
43 struct list_head link; /* link in transport's peer list */
44 struct list_head proc_link; /* link in /proc list */
45 rwlock_t conn_idlock; /* lock for connection IDs */
46 struct list_head conn_idlist; /* list of connections granted IDs */
47 uint32_t conn_idcounter; /* connection ID counter */
48 rwlock_t conn_lock; /* lock for active/dead connections */
49 struct list_head conn_active; /* active connections to/from this peer */
50 struct list_head conn_graveyard; /* graveyard for inactive connections */
51 spinlock_t conn_gylock; /* lock for conn_graveyard */
52 wait_queue_head_t conn_gy_waitq; /* wait queue hit when graveyard is empty */
53 atomic_t conn_count; /* number of attached connections */
54 struct in_addr addr; /* remote address */
55 size_t if_mtu; /* interface MTU for this peer */
56 spinlock_t lock; /* access lock */
57
58 void *user; /* application layer data */
59
60 /* calculated RTT cache */
61#define RXRPC_RTT_CACHE_SIZE 32
62 suseconds_t rtt; /* current RTT estimate (in uS) */
63 unsigned rtt_point; /* next entry at which to insert */
64 unsigned rtt_usage; /* amount of cache actually used */
65 suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated RTT cache */
66};
67
68
69extern int rxrpc_peer_lookup(struct rxrpc_transport *trans,
70 __be32 addr,
71 struct rxrpc_peer **_peer);
72
73static inline void rxrpc_get_peer(struct rxrpc_peer *peer)
74{
75 BUG_ON(atomic_read(&peer->usage)<0);
76 atomic_inc(&peer->usage);
77 //printk("rxrpc_get_peer(%p{u=%d})\n",peer,atomic_read(&peer->usage));
78}
79
80extern void rxrpc_put_peer(struct rxrpc_peer *peer);
81
82#endif /* _LINUX_RXRPC_PEER_H */
diff --git a/include/rxrpc/rxrpc.h b/include/rxrpc/rxrpc.h
deleted file mode 100644
index 8d9874cef991..000000000000
--- a/include/rxrpc/rxrpc.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* rx.h: Rx RPC interface
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_RXRPC_H
13#define _LINUX_RXRPC_RXRPC_H
14
15#ifdef __KERNEL__
16
17extern __be32 rxrpc_epoch;
18
19#ifdef CONFIG_SYSCTL
20extern int rxrpc_ktrace;
21extern int rxrpc_kdebug;
22extern int rxrpc_kproto;
23extern int rxrpc_knet;
24#else
25#define rxrpc_ktrace 0
26#define rxrpc_kdebug 0
27#define rxrpc_kproto 0
28#define rxrpc_knet 0
29#endif
30
31extern int rxrpc_sysctl_init(void);
32extern void rxrpc_sysctl_cleanup(void);
33
34#endif /* __KERNEL__ */
35
36#endif /* _LINUX_RXRPC_RXRPC_H */
diff --git a/include/rxrpc/transport.h b/include/rxrpc/transport.h
deleted file mode 100644
index 7c7b9683fa39..000000000000
--- a/include/rxrpc/transport.h
+++ /dev/null
@@ -1,106 +0,0 @@
1/* transport.h: Rx transport management
2 *
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_TRANSPORT_H
13#define _LINUX_RXRPC_TRANSPORT_H
14
15#include <rxrpc/types.h>
16#include <rxrpc/krxiod.h>
17#include <rxrpc/rxrpc.h>
18#include <linux/skbuff.h>
19#include <linux/rwsem.h>
20
21typedef int (*rxrpc_newcall_fnx_t)(struct rxrpc_call *call);
22
23extern wait_queue_head_t rxrpc_krxiod_wq;
24
25/*****************************************************************************/
26/*
27 * Rx operation specification
28 * - tables of these must be sorted by op ID so that they can be binary-chop searched
29 */
30struct rxrpc_operation
31{
32 unsigned id; /* operation ID */
33 size_t asize; /* minimum size of argument block */
34 const char *name; /* name of operation */
35 void *user; /* initial user data */
36};
37
38/*****************************************************************************/
39/*
40 * Rx transport service record
41 */
42struct rxrpc_service
43{
44 struct list_head link; /* link in services list on transport */
45 struct module *owner; /* owner module */
46 rxrpc_newcall_fnx_t new_call; /* new call handler function */
47 const char *name; /* name of service */
48 unsigned short service_id; /* Rx service ID */
49 rxrpc_call_attn_func_t attn_func; /* call requires attention callback */
50 rxrpc_call_error_func_t error_func; /* call error callback */
51 rxrpc_call_aemap_func_t aemap_func; /* abort -> errno mapping callback */
52
53 const struct rxrpc_operation *ops_begin; /* beginning of operations table */
54 const struct rxrpc_operation *ops_end; /* end of operations table */
55};
56
57/*****************************************************************************/
58/*
59 * Rx transport endpoint record
60 */
61struct rxrpc_transport
62{
63 atomic_t usage;
64 struct socket *socket; /* my UDP socket */
65 struct list_head services; /* services listening on this socket */
66 struct list_head link; /* link in transport list */
67 struct list_head proc_link; /* link in transport proc list */
68 struct list_head krxiodq_link; /* krxiod attention queue link */
69 spinlock_t lock; /* access lock */
70 struct list_head peer_active; /* active peers connected to over this socket */
71 struct list_head peer_graveyard; /* inactive peer list */
72 spinlock_t peer_gylock; /* peer graveyard lock */
73 wait_queue_head_t peer_gy_waitq; /* wait queue hit when peer graveyard is empty */
74 rwlock_t peer_lock; /* peer list access lock */
75 atomic_t peer_count; /* number of peers */
76 struct rxrpc_peer_ops *peer_ops; /* default peer operations */
77 unsigned short port; /* port upon which listening */
78 volatile char error_rcvd; /* T if received ICMP error outstanding */
79};
80
81extern int rxrpc_create_transport(unsigned short port,
82 struct rxrpc_transport **_trans);
83
84static inline void rxrpc_get_transport(struct rxrpc_transport *trans)
85{
86 BUG_ON(atomic_read(&trans->usage) <= 0);
87 atomic_inc(&trans->usage);
88 //printk("rxrpc_get_transport(%p{u=%d})\n",
89 // trans, atomic_read(&trans->usage));
90}
91
92extern void rxrpc_put_transport(struct rxrpc_transport *trans);
93
94extern int rxrpc_add_service(struct rxrpc_transport *trans,
95 struct rxrpc_service *srv);
96
97extern void rxrpc_del_service(struct rxrpc_transport *trans,
98 struct rxrpc_service *srv);
99
100extern void rxrpc_trans_receive_packet(struct rxrpc_transport *trans);
101
102extern int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
103 struct rxrpc_message *msg,
104 int error);
105
106#endif /* _LINUX_RXRPC_TRANSPORT_H */
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 02f6e4b9e693..4a44278ed768 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -40,6 +40,14 @@
40} 40}
41#define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;} 41#define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;}
42 42
43/* initiator tags; opaque for target */
44typedef uint32_t __bitwise__ itt_t;
45/* below makes sense only for initiator that created this tag */
46#define build_itt(itt, id, age) ((__force itt_t)\
47 ((itt) | ((id) << ISCSI_CID_SHIFT) | ((age) << ISCSI_AGE_SHIFT)))
48#define get_itt(itt) ((__force uint32_t)(itt_t)(itt) & ISCSI_ITT_MASK)
49#define RESERVED_ITT ((__force itt_t)0xffffffff)
50
43/* 51/*
44 * iSCSI Template Message Header 52 * iSCSI Template Message Header
45 */ 53 */
@@ -50,7 +58,7 @@ struct iscsi_hdr {
50 uint8_t hlength; /* AHSs total length */ 58 uint8_t hlength; /* AHSs total length */
51 uint8_t dlength[3]; /* Data length */ 59 uint8_t dlength[3]; /* Data length */
52 uint8_t lun[8]; 60 uint8_t lun[8];
53 __be32 itt; /* Initiator Task Tag */ 61 itt_t itt; /* Initiator Task Tag, opaque for target */
54 __be32 ttt; /* Target Task Tag */ 62 __be32 ttt; /* Target Task Tag */
55 __be32 statsn; 63 __be32 statsn;
56 __be32 exp_statsn; 64 __be32 exp_statsn;
@@ -111,7 +119,7 @@ struct iscsi_cmd {
111 uint8_t hlength; 119 uint8_t hlength;
112 uint8_t dlength[3]; 120 uint8_t dlength[3];
113 uint8_t lun[8]; 121 uint8_t lun[8];
114 __be32 itt; /* Initiator Task Tag */ 122 itt_t itt; /* Initiator Task Tag */
115 __be32 data_length; 123 __be32 data_length;
116 __be32 cmdsn; 124 __be32 cmdsn;
117 __be32 exp_statsn; 125 __be32 exp_statsn;
@@ -148,7 +156,7 @@ struct iscsi_cmd_rsp {
148 uint8_t hlength; 156 uint8_t hlength;
149 uint8_t dlength[3]; 157 uint8_t dlength[3];
150 uint8_t rsvd[8]; 158 uint8_t rsvd[8];
151 __be32 itt; /* Initiator Task Tag */ 159 itt_t itt; /* Initiator Task Tag */
152 __be32 rsvd1; 160 __be32 rsvd1;
153 __be32 statsn; 161 __be32 statsn;
154 __be32 exp_cmdsn; 162 __be32 exp_cmdsn;
@@ -206,7 +214,7 @@ struct iscsi_nopout {
206 uint8_t rsvd3; 214 uint8_t rsvd3;
207 uint8_t dlength[3]; 215 uint8_t dlength[3];
208 uint8_t lun[8]; 216 uint8_t lun[8];
209 __be32 itt; /* Initiator Task Tag */ 217 itt_t itt; /* Initiator Task Tag */
210 __be32 ttt; /* Target Transfer Tag */ 218 __be32 ttt; /* Target Transfer Tag */
211 __be32 cmdsn; 219 __be32 cmdsn;
212 __be32 exp_statsn; 220 __be32 exp_statsn;
@@ -221,7 +229,7 @@ struct iscsi_nopin {
221 uint8_t rsvd3; 229 uint8_t rsvd3;
222 uint8_t dlength[3]; 230 uint8_t dlength[3];
223 uint8_t lun[8]; 231 uint8_t lun[8];
224 __be32 itt; /* Initiator Task Tag */ 232 itt_t itt; /* Initiator Task Tag */
225 __be32 ttt; /* Target Transfer Tag */ 233 __be32 ttt; /* Target Transfer Tag */
226 __be32 statsn; 234 __be32 statsn;
227 __be32 exp_cmdsn; 235 __be32 exp_cmdsn;
@@ -237,8 +245,8 @@ struct iscsi_tm {
237 uint8_t hlength; 245 uint8_t hlength;
238 uint8_t dlength[3]; 246 uint8_t dlength[3];
239 uint8_t lun[8]; 247 uint8_t lun[8];
240 __be32 itt; /* Initiator Task Tag */ 248 itt_t itt; /* Initiator Task Tag */
241 __be32 rtt; /* Reference Task Tag */ 249 itt_t rtt; /* Reference Task Tag */
242 __be32 cmdsn; 250 __be32 cmdsn;
243 __be32 exp_statsn; 251 __be32 exp_statsn;
244 __be32 refcmdsn; 252 __be32 refcmdsn;
@@ -267,8 +275,8 @@ struct iscsi_tm_rsp {
267 uint8_t hlength; 275 uint8_t hlength;
268 uint8_t dlength[3]; 276 uint8_t dlength[3];
269 uint8_t rsvd2[8]; 277 uint8_t rsvd2[8];
270 __be32 itt; /* Initiator Task Tag */ 278 itt_t itt; /* Initiator Task Tag */
271 __be32 rtt; /* Reference Task Tag */ 279 itt_t rtt; /* Reference Task Tag */
272 __be32 statsn; 280 __be32 statsn;
273 __be32 exp_cmdsn; 281 __be32 exp_cmdsn;
274 __be32 max_cmdsn; 282 __be32 max_cmdsn;
@@ -293,7 +301,7 @@ struct iscsi_r2t_rsp {
293 uint8_t hlength; 301 uint8_t hlength;
294 uint8_t dlength[3]; 302 uint8_t dlength[3];
295 uint8_t lun[8]; 303 uint8_t lun[8];
296 __be32 itt; /* Initiator Task Tag */ 304 itt_t itt; /* Initiator Task Tag */
297 __be32 ttt; /* Target Transfer Tag */ 305 __be32 ttt; /* Target Transfer Tag */
298 __be32 statsn; 306 __be32 statsn;
299 __be32 exp_cmdsn; 307 __be32 exp_cmdsn;
@@ -311,7 +319,7 @@ struct iscsi_data {
311 uint8_t rsvd3; 319 uint8_t rsvd3;
312 uint8_t dlength[3]; 320 uint8_t dlength[3];
313 uint8_t lun[8]; 321 uint8_t lun[8];
314 __be32 itt; 322 itt_t itt;
315 __be32 ttt; 323 __be32 ttt;
316 __be32 rsvd4; 324 __be32 rsvd4;
317 __be32 exp_statsn; 325 __be32 exp_statsn;
@@ -331,7 +339,7 @@ struct iscsi_data_rsp {
331 uint8_t hlength; 339 uint8_t hlength;
332 uint8_t dlength[3]; 340 uint8_t dlength[3];
333 uint8_t lun[8]; 341 uint8_t lun[8];
334 __be32 itt; 342 itt_t itt;
335 __be32 ttt; 343 __be32 ttt;
336 __be32 statsn; 344 __be32 statsn;
337 __be32 exp_cmdsn; 345 __be32 exp_cmdsn;
@@ -355,7 +363,7 @@ struct iscsi_text {
355 uint8_t hlength; 363 uint8_t hlength;
356 uint8_t dlength[3]; 364 uint8_t dlength[3];
357 uint8_t rsvd4[8]; 365 uint8_t rsvd4[8];
358 __be32 itt; 366 itt_t itt;
359 __be32 ttt; 367 __be32 ttt;
360 __be32 cmdsn; 368 __be32 cmdsn;
361 __be32 exp_statsn; 369 __be32 exp_statsn;
@@ -373,7 +381,7 @@ struct iscsi_text_rsp {
373 uint8_t hlength; 381 uint8_t hlength;
374 uint8_t dlength[3]; 382 uint8_t dlength[3];
375 uint8_t rsvd4[8]; 383 uint8_t rsvd4[8];
376 __be32 itt; 384 itt_t itt;
377 __be32 ttt; 385 __be32 ttt;
378 __be32 statsn; 386 __be32 statsn;
379 __be32 exp_cmdsn; 387 __be32 exp_cmdsn;
@@ -392,7 +400,7 @@ struct iscsi_login {
392 uint8_t dlength[3]; 400 uint8_t dlength[3];
393 uint8_t isid[6]; /* Initiator Session ID */ 401 uint8_t isid[6]; /* Initiator Session ID */
394 __be16 tsih; /* Target Session Handle */ 402 __be16 tsih; /* Target Session Handle */
395 __be32 itt; /* Initiator Task Tag */ 403 itt_t itt; /* Initiator Task Tag */
396 __be16 cid; 404 __be16 cid;
397 __be16 rsvd3; 405 __be16 rsvd3;
398 __be32 cmdsn; 406 __be32 cmdsn;
@@ -421,7 +429,7 @@ struct iscsi_login_rsp {
421 uint8_t dlength[3]; 429 uint8_t dlength[3];
422 uint8_t isid[6]; /* Initiator Session ID */ 430 uint8_t isid[6]; /* Initiator Session ID */
423 __be16 tsih; /* Target Session Handle */ 431 __be16 tsih; /* Target Session Handle */
424 __be32 itt; /* Initiator Task Tag */ 432 itt_t itt; /* Initiator Task Tag */
425 __be32 rsvd3; 433 __be32 rsvd3;
426 __be32 statsn; 434 __be32 statsn;
427 __be32 exp_cmdsn; 435 __be32 exp_cmdsn;
@@ -478,7 +486,7 @@ struct iscsi_logout {
478 uint8_t hlength; 486 uint8_t hlength;
479 uint8_t dlength[3]; 487 uint8_t dlength[3];
480 uint8_t rsvd2[8]; 488 uint8_t rsvd2[8];
481 __be32 itt; /* Initiator Task Tag */ 489 itt_t itt; /* Initiator Task Tag */
482 __be16 cid; 490 __be16 cid;
483 uint8_t rsvd3[2]; 491 uint8_t rsvd3[2];
484 __be32 cmdsn; 492 __be32 cmdsn;
@@ -505,7 +513,7 @@ struct iscsi_logout_rsp {
505 uint8_t hlength; 513 uint8_t hlength;
506 uint8_t dlength[3]; 514 uint8_t dlength[3];
507 uint8_t rsvd3[8]; 515 uint8_t rsvd3[8];
508 __be32 itt; /* Initiator Task Tag */ 516 itt_t itt; /* Initiator Task Tag */
509 __be32 rsvd4; 517 __be32 rsvd4;
510 __be32 statsn; 518 __be32 statsn;
511 __be32 exp_cmdsn; 519 __be32 exp_cmdsn;
@@ -528,7 +536,7 @@ struct iscsi_snack {
528 uint8_t opcode; 536 uint8_t opcode;
529 uint8_t flags; 537 uint8_t flags;
530 uint8_t rsvd2[14]; 538 uint8_t rsvd2[14];
531 __be32 itt; 539 itt_t itt;
532 __be32 begrun; 540 __be32 begrun;
533 __be32 runlength; 541 __be32 runlength;
534 __be32 exp_statsn; 542 __be32 exp_statsn;
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 0c775fceb675..ad0182ef7809 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -323,12 +323,20 @@ struct sas_ha_event {
323 struct sas_ha_struct *ha; 323 struct sas_ha_struct *ha;
324}; 324};
325 325
326enum sas_ha_state {
327 SAS_HA_REGISTERED,
328 SAS_HA_UNREGISTERED
329};
330
326struct sas_ha_struct { 331struct sas_ha_struct {
327/* private: */ 332/* private: */
328 spinlock_t event_lock; 333 spinlock_t event_lock;
329 struct sas_ha_event ha_events[HA_NUM_EVENTS]; 334 struct sas_ha_event ha_events[HA_NUM_EVENTS];
330 unsigned long pending; 335 unsigned long pending;
331 336
337 enum sas_ha_state state;
338 spinlock_t state_lock;
339
332 struct scsi_core core; 340 struct scsi_core core;
333 341
334/* public: */ 342/* public: */
@@ -553,15 +561,15 @@ struct sas_task {
553#define SAS_TASK_STATE_PENDING 1 561#define SAS_TASK_STATE_PENDING 1
554#define SAS_TASK_STATE_DONE 2 562#define SAS_TASK_STATE_DONE 2
555#define SAS_TASK_STATE_ABORTED 4 563#define SAS_TASK_STATE_ABORTED 4
556#define SAS_TASK_INITIATOR_ABORTED 8 564#define SAS_TASK_NEED_DEV_RESET 8
565#define SAS_TASK_AT_INITIATOR 16
557 566
558static inline struct sas_task *sas_alloc_task(gfp_t flags) 567static inline struct sas_task *sas_alloc_task(gfp_t flags)
559{ 568{
560 extern struct kmem_cache *sas_task_cache; 569 extern struct kmem_cache *sas_task_cache;
561 struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags); 570 struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags);
562 571
563 if (task) { 572 if (task) {
564 memset(task, 0, sizeof(*task));
565 INIT_LIST_HEAD(&task->list); 573 INIT_LIST_HEAD(&task->list);
566 spin_lock_init(&task->task_state_lock); 574 spin_lock_init(&task->task_state_lock);
567 task->task_state_flags = SAS_TASK_STATE_PENDING; 575 task->task_state_flags = SAS_TASK_STATE_PENDING;
@@ -613,6 +621,9 @@ struct sas_domain_function_template {
613extern int sas_register_ha(struct sas_ha_struct *); 621extern int sas_register_ha(struct sas_ha_struct *);
614extern int sas_unregister_ha(struct sas_ha_struct *); 622extern int sas_unregister_ha(struct sas_ha_struct *);
615 623
624int sas_set_phy_speed(struct sas_phy *phy,
625 struct sas_phy_linkrates *rates);
626int sas_phy_enable(struct sas_phy *phy, int enabled);
616int sas_phy_reset(struct sas_phy *phy, int hard_reset); 627int sas_phy_reset(struct sas_phy *phy, int hard_reset);
617extern int sas_queuecommand(struct scsi_cmnd *, 628extern int sas_queuecommand(struct scsi_cmnd *,
618 void (*scsi_done)(struct scsi_cmnd *)); 629 void (*scsi_done)(struct scsi_cmnd *));
@@ -646,6 +657,9 @@ void sas_unregister_dev(struct domain_device *);
646 657
647void sas_init_dev(struct domain_device *); 658void sas_init_dev(struct domain_device *);
648 659
649void sas_task_abort(struct work_struct *); 660void sas_task_abort(struct sas_task *);
661int __sas_task_abort(struct sas_task *);
662int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
663int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd);
650 664
651#endif /* _SASLIB_H_ */ 665#endif /* _SASLIB_H_ */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index ebf31b16dc49..9dd37e2f5a84 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -122,6 +122,7 @@ struct scsi_device {
122 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */ 122 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
123 unsigned select_no_atn:1; 123 unsigned select_no_atn:1;
124 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ 124 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */
125 unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */
125 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ 126 unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */
126 127
127 unsigned int device_blocked; /* Device returned QUEUE_FULL. */ 128 unsigned int device_blocked; /* Device returned QUEUE_FULL. */
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h
index 46d5e70d7215..07d6e77ae895 100644
--- a/include/scsi/scsi_tgt_if.h
+++ b/include/scsi/scsi_tgt_if.h
@@ -83,8 +83,5 @@ struct tgt_event {
83} __attribute__ ((aligned (sizeof(uint64_t)))); 83} __attribute__ ((aligned (sizeof(uint64_t))));
84 84
85#define TGT_RING_SIZE (1UL << 16) 85#define TGT_RING_SIZE (1UL << 16)
86#define TGT_RING_PAGES (TGT_RING_SIZE >> PAGE_SHIFT)
87#define TGT_EVENT_PER_PAGE (PAGE_SIZE / sizeof(struct tgt_event))
88#define TGT_MAX_EVENTS (TGT_EVENT_PER_PAGE * TGT_RING_PAGES)
89 86
90#endif 87#endif
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index cca1d4926d2a..3c18baa65a72 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -22,6 +22,7 @@
22 22
23#include <linux/transport_class.h> 23#include <linux/transport_class.h>
24#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
25#include <scsi/scsi_device.h>
25 26
26struct scsi_transport_template { 27struct scsi_transport_template {
27 /* the attribute containers */ 28 /* the attribute containers */
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index 59633a82de47..9aedc19820b0 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -54,6 +54,7 @@ struct sas_identify {
54struct sas_phy { 54struct sas_phy {
55 struct device dev; 55 struct device dev;
56 int number; 56 int number;
57 int enabled;
57 58
58 /* phy identification */ 59 /* phy identification */
59 struct sas_identify identify; 60 struct sas_identify identify;
@@ -163,6 +164,7 @@ struct sas_function_template {
163 int (*get_enclosure_identifier)(struct sas_rphy *, u64 *); 164 int (*get_enclosure_identifier)(struct sas_rphy *, u64 *);
164 int (*get_bay_identifier)(struct sas_rphy *); 165 int (*get_bay_identifier)(struct sas_rphy *);
165 int (*phy_reset)(struct sas_phy *, int); 166 int (*phy_reset)(struct sas_phy *, int);
167 int (*phy_enable)(struct sas_phy *, int);
166 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *); 168 int (*set_phy_speed)(struct sas_phy *, struct sas_phy_linkrates *);
167}; 169};
168 170
@@ -180,6 +182,7 @@ extern struct sas_rphy *sas_end_device_alloc(struct sas_port *);
180extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type); 182extern struct sas_rphy *sas_expander_alloc(struct sas_port *, enum sas_device_type);
181void sas_rphy_free(struct sas_rphy *); 183void sas_rphy_free(struct sas_rphy *);
182extern int sas_rphy_add(struct sas_rphy *); 184extern int sas_rphy_add(struct sas_rphy *);
185extern void sas_rphy_remove(struct sas_rphy *);
183extern void sas_rphy_delete(struct sas_rphy *); 186extern void sas_rphy_delete(struct sas_rphy *);
184extern int scsi_is_sas_rphy(const struct device *); 187extern int scsi_is_sas_rphy(const struct device *);
185 188
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index da180f738477..286e9628ed8b 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -85,6 +85,7 @@ struct spi_host_attrs {
85#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en) 85#define spi_pcomp_en(x) (((struct spi_transport_attrs *)&(x)->starget_data)->pcomp_en)
86#define spi_hold_mcs(x) (((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs) 86#define spi_hold_mcs(x) (((struct spi_transport_attrs *)&(x)->starget_data)->hold_mcs)
87#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv) 87#define spi_initial_dv(x) (((struct spi_transport_attrs *)&(x)->starget_data)->initial_dv)
88#define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_pending)
88 89
89#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync) 90#define spi_support_sync(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_sync)
90#define spi_support_wide(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_wide) 91#define spi_support_wide(x) (((struct spi_transport_attrs *)&(x)->starget_data)->support_wide)
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 33720397a904..246ac23534bd 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -375,6 +375,7 @@
375#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 */
376#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 */ 377#define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */
378#define AC97_SCAP_POWER_SAVE (1<<11) /* capable for aggresive power-saving */
378 379
379/* ac97->flags */ 380/* ac97->flags */
380#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */ 381#define AC97_HAS_PC_BEEP (1<<0) /* force PC Speaker usage */
@@ -425,6 +426,7 @@ struct snd_ac97_build_ops {
425 426
426struct snd_ac97_bus_ops { 427struct snd_ac97_bus_ops {
427 void (*reset) (struct snd_ac97 *ac97); 428 void (*reset) (struct snd_ac97 *ac97);
429 void (*warm_reset)(struct snd_ac97 *ac97);
428 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val); 430 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
429 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg); 431 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg);
430 void (*wait) (struct snd_ac97 *ac97); 432 void (*wait) (struct snd_ac97 *ac97);
@@ -501,6 +503,7 @@ struct snd_ac97 {
501 unsigned short id[3]; // codec IDs (lower 16-bit word) 503 unsigned short id[3]; // codec IDs (lower 16-bit word)
502 unsigned short pcmreg[3]; // PCM registers 504 unsigned short pcmreg[3]; // PCM registers
503 unsigned short codec_cfg[3]; // CODEC_CFG bits 505 unsigned short codec_cfg[3]; // CODEC_CFG bits
506 unsigned char swap_mic_linein; // AD1986/AD1986A only
504 } ad18xx; 507 } ad18xx;
505 unsigned int dev_flags; /* device specific */ 508 unsigned int dev_flags; /* device specific */
506 } spec; 509 } spec;
@@ -510,7 +513,6 @@ struct snd_ac97 {
510 513
511#ifdef CONFIG_SND_AC97_POWER_SAVE 514#ifdef CONFIG_SND_AC97_POWER_SAVE
512 unsigned int power_up; /* power states */ 515 unsigned int power_up; /* power states */
513 struct workqueue_struct *power_workq;
514 struct delayed_work power_work; 516 struct delayed_work power_work;
515#endif 517#endif
516 struct device dev; 518 struct device dev;
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
index c8de6f83338f..b2c3f00a9b35 100644
--- a/include/sound/ad1848.h
+++ b/include/sound/ad1848.h
@@ -185,7 +185,7 @@ struct ad1848_mix_elem {
185 int index; 185 int index;
186 int type; 186 int type;
187 unsigned long private_value; 187 unsigned long private_value;
188 unsigned int *tlv; 188 const unsigned int *tlv;
189}; 189};
190 190
191#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \ 191#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
diff --git a/include/sound/ak4114.h b/include/sound/ak4114.h
index 2ee061625fd0..c149d3b2558b 100644
--- a/include/sound/ak4114.h
+++ b/include/sound/ak4114.h
@@ -181,7 +181,6 @@ struct ak4114 {
181 unsigned long ccrc_errors; 181 unsigned long ccrc_errors;
182 unsigned char rcs0; 182 unsigned char rcs0;
183 unsigned char rcs1; 183 unsigned char rcs1;
184 struct workqueue_struct *workqueue;
185 struct delayed_work work; 184 struct delayed_work work;
186 void *change_callback_private; 185 void *change_callback_private;
187 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1); 186 void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
@@ -189,7 +188,7 @@ struct ak4114 {
189 188
190int snd_ak4114_create(struct snd_card *card, 189int snd_ak4114_create(struct snd_card *card,
191 ak4114_read_t *read, ak4114_write_t *write, 190 ak4114_read_t *read, ak4114_write_t *write,
192 unsigned char pgm[7], unsigned char txcsb[5], 191 const unsigned char pgm[7], const unsigned char txcsb[5],
193 void *private_data, struct ak4114 **r_ak4114); 192 void *private_data, struct ak4114 **r_ak4114);
194void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val); 193void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
195void snd_ak4114_reinit(struct ak4114 *ak4114); 194void snd_ak4114_reinit(struct ak4114 *ak4114);
diff --git a/include/sound/ak4117.h b/include/sound/ak4117.h
index 2b96c32f06fd..d650d52e3d29 100644
--- a/include/sound/ak4117.h
+++ b/include/sound/ak4117.h
@@ -178,7 +178,7 @@ struct ak4117 {
178}; 178};
179 179
180int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write, 180int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
181 unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117); 181 const unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117);
182void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val); 182void snd_ak4117_reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char mask, unsigned char val);
183void snd_ak4117_reinit(struct ak4117 *ak4117); 183void snd_ak4117_reinit(struct ak4117 *ak4117);
184int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream); 184int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *capture_substream);
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index d0deca669b92..aa49dda4f410 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -50,6 +50,8 @@ struct snd_akm4xxx_adc_channel {
50 char *name; /* capture gain volume label */ 50 char *name; /* capture gain volume label */
51 char *switch_name; /* capture switch */ 51 char *switch_name; /* capture switch */
52 unsigned int num_channels; 52 unsigned int num_channels;
53 char *selector_name; /* capture source select label */
54 const char **input_names; /* capture source names (NULL terminated) */
53}; 55};
54 56
55struct snd_akm4xxx { 57struct snd_akm4xxx {
@@ -69,8 +71,8 @@ struct snd_akm4xxx {
69 } type; 71 } type;
70 72
71 /* (array) information of combined codecs */ 73 /* (array) information of combined codecs */
72 struct snd_akm4xxx_dac_channel *dac_info; 74 const struct snd_akm4xxx_dac_channel *dac_info;
73 struct snd_akm4xxx_adc_channel *adc_info; 75 const struct snd_akm4xxx_adc_channel *adc_info;
74 76
75 struct snd_ak4xxx_ops ops; 77 struct snd_ak4xxx_ops ops;
76}; 78};
diff --git a/include/sound/control.h b/include/sound/control.h
index 1de148b0fd94..72e759f619b1 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -49,7 +49,7 @@ struct snd_kcontrol_new {
49 snd_kcontrol_put_t *put; 49 snd_kcontrol_put_t *put;
50 union { 50 union {
51 snd_kcontrol_tlv_rw_t *c; 51 snd_kcontrol_tlv_rw_t *c;
52 unsigned int *p; 52 const unsigned int *p;
53 } tlv; 53 } tlv;
54 unsigned long private_value; 54 unsigned long private_value;
55}; 55};
@@ -69,7 +69,7 @@ struct snd_kcontrol {
69 snd_kcontrol_put_t *put; 69 snd_kcontrol_put_t *put;
70 union { 70 union {
71 snd_kcontrol_tlv_rw_t *c; 71 snd_kcontrol_tlv_rw_t *c;
72 unsigned int *p; 72 const unsigned int *p;
73 } tlv; 73 } tlv;
74 unsigned long private_value; 74 unsigned long private_value;
75 void *private_data; 75 void *private_data;
@@ -108,7 +108,6 @@ typedef int (*snd_kctl_ioctl_func_t) (struct snd_card * card,
108 108
109void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id); 109void snd_ctl_notify(struct snd_card * card, unsigned int mask, struct snd_ctl_elem_id * id);
110 110
111struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol * kcontrol, unsigned int access);
112struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data); 111struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new * kcontrolnew, void * private_data);
113void snd_ctl_free_one(struct snd_kcontrol * kcontrol); 112void snd_ctl_free_one(struct snd_kcontrol * kcontrol);
114int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); 113int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
diff --git a/include/sound/core.h b/include/sound/core.h
index a994bea09cd6..4b9e609975ab 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -132,8 +132,10 @@ struct snd_card {
132 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */ 133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct device *parent; 135 struct device *dev; /* device assigned to this card */
136 struct device *dev; 136#ifndef CONFIG_SYSFS_DEPRECATED
137 struct device *card_dev; /* cardX object for sysfs */
138#endif
137 139
138#ifdef CONFIG_PM 140#ifdef CONFIG_PM
139 unsigned int power_state; /* power state */ 141 unsigned int power_state; /* power state */
@@ -191,6 +193,16 @@ struct snd_minor {
191 struct device *dev; /* device for sysfs */ 193 struct device *dev; /* device for sysfs */
192}; 194};
193 195
196/* return a device pointer linked to each sound device as a parent */
197static inline struct device *snd_card_get_device_link(struct snd_card *card)
198{
199#ifdef CONFIG_SYSFS_DEPRECATED
200 return card ? card->dev : NULL;
201#else
202 return card ? card->card_dev : NULL;
203#endif
204}
205
194/* sound.c */ 206/* sound.c */
195 207
196extern int snd_major; 208extern int snd_major;
@@ -199,9 +211,40 @@ extern struct class *sound_class;
199 211
200void snd_request_card(int card); 212void snd_request_card(int card);
201 213
202int snd_register_device(int type, struct snd_card *card, int dev, 214int snd_register_device_for_dev(int type, struct snd_card *card,
203 const struct file_operations *f_ops, void *private_data, 215 int dev,
204 const char *name); 216 const struct file_operations *f_ops,
217 void *private_data,
218 const char *name,
219 struct device *device);
220
221/**
222 * snd_register_device - Register the ALSA device file for the card
223 * @type: the device type, SNDRV_DEVICE_TYPE_XXX
224 * @card: the card instance
225 * @dev: the device index
226 * @f_ops: the file operations
227 * @private_data: user pointer for f_ops->open()
228 * @name: the device file name
229 *
230 * Registers an ALSA device file for the given card.
231 * The operators have to be set in reg parameter.
232 *
233 * This function uses the card's device pointer to link to the
234 * correct &struct device.
235 *
236 * Returns zero if successful, or a negative error code on failure.
237 */
238static inline int snd_register_device(int type, struct snd_card *card, int dev,
239 const struct file_operations *f_ops,
240 void *private_data,
241 const char *name)
242{
243 return snd_register_device_for_dev(type, card, dev, f_ops,
244 private_data, name,
245 snd_card_get_device_link(card));
246}
247
205int snd_unregister_device(int type, struct snd_card *card, int dev); 248int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type); 249void *snd_lookup_minor_data(unsigned int minor, int type);
207int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, 250int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
@@ -257,7 +300,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file);
257int snd_card_file_remove(struct snd_card *card, struct file *file); 300int snd_card_file_remove(struct snd_card *card, struct file *file);
258 301
259#ifndef snd_card_set_dev 302#ifndef snd_card_set_dev
260#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr)) 303#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
261#endif 304#endif
262 305
263/* device.c */ 306/* device.c */
@@ -384,6 +427,29 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
384#endif 427#endif
385#endif 428#endif
386 429
387#include "typedefs.h" 430/* PCI quirk list helper */
431struct snd_pci_quirk {
432 unsigned short subvendor; /* PCI subvendor ID */
433 unsigned short subdevice; /* PCI subdevice ID */
434 int value; /* value */
435#ifdef CONFIG_SND_DEBUG_DETECT
436 const char *name; /* name of the device (optional) */
437#endif
438};
439
440#define _SND_PCI_QUIRK_ID(vend,dev) \
441 .subvendor = (vend), .subdevice = (dev)
442#define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
443#ifdef CONFIG_SND_DEBUG_DETECT
444#define SND_PCI_QUIRK(vend,dev,xname,val) \
445 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
446#else
447#define SND_PCI_QUIRK(vend,dev,xname,val) \
448 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
449#endif
450
451const struct snd_pci_quirk *
452snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
453
388 454
389#endif /* __SOUND_CORE_H */ 455#endif /* __SOUND_CORE_H */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 3d3c1514cf71..23e45a4cf0e4 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -188,7 +188,35 @@
188#define HCFG_LEGACYINT 0x00200000 /* 1 = legacy event captured. Write 1 to clear. */ 188#define HCFG_LEGACYINT 0x00200000 /* 1 = legacy event captured. Write 1 to clear. */
189 /* NOTE: The rest of the bits in this register */ 189 /* NOTE: The rest of the bits in this register */
190 /* _are_ relevant under Linux. */ 190 /* _are_ relevant under Linux. */
191#define HCFG_CODECFORMAT_MASK 0x00070000 /* CODEC format */ 191#define HCFG_PUSH_BUTTON_ENABLE 0x00100000 /* Enables Volume Inc/Dec and Mute functions */
192#define HCFG_BAUD_RATE 0x00080000 /* 0 = 48kHz, 1 = 44.1kHz */
193#define HCFG_EXPANDED_MEM 0x00040000 /* 1 = any 16M of 4G addr, 0 = 32M of 2G addr */
194#define HCFG_CODECFORMAT_MASK 0x00030000 /* CODEC format */
195
196/* Specific to Alice2, CA0102 */
197#define HCFG_CODECFORMAT_AC97_1 0x00000000 /* AC97 CODEC format -- Ver 1.03 */
198#define HCFG_CODECFORMAT_AC97_2 0x00010000 /* AC97 CODEC format -- Ver 2.1 */
199#define HCFG_AUTOMUTE_ASYNC 0x00008000 /* When set, the async sample rate convertors */
200 /* will automatically mute their output when */
201 /* they are not rate-locked to the external */
202 /* async audio source */
203#define HCFG_AUTOMUTE_SPDIF 0x00004000 /* When set, the async sample rate convertors */
204 /* will automatically mute their output when */
205 /* the SPDIF V-bit indicates invalid audio */
206#define HCFG_EMU32_SLAVE 0x00002000 /* 0 = Master, 1 = Slave. Slave for EMU1010 */
207#define HCFG_SLOW_RAMP 0x00001000 /* Increases Send Smoothing time constant */
208/* 0x00000800 not used on Alice2 */
209#define HCFG_PHASE_TRACK_MASK 0x00000700 /* When set, forces corresponding input to */
210 /* phase track the previous input. */
211 /* I2S0 can phase track the last S/PDIF input */
212#define HCFG_I2S_ASRC_ENABLE 0x00000070 /* When set, enables asynchronous sample rate */
213 /* conversion for the corresponding */
214 /* I2S format input */
215/* Rest of HCFG 0x0000000f same as below. LOCKSOUNDCACHE etc. */
216
217
218
219/* Older chips */
192#define HCFG_CODECFORMAT_AC97 0x00000000 /* AC97 CODEC format -- Primary Output */ 220#define HCFG_CODECFORMAT_AC97 0x00000000 /* AC97 CODEC format -- Primary Output */
193#define HCFG_CODECFORMAT_I2S 0x00010000 /* I2S CODEC format -- Secondary (Rear) Output */ 221#define HCFG_CODECFORMAT_I2S 0x00010000 /* I2S CODEC format -- Secondary (Rear) Output */
194#define HCFG_GPINPUT0 0x00004000 /* External pin112 */ 222#define HCFG_GPINPUT0 0x00004000 /* External pin112 */
@@ -432,6 +460,7 @@
432#define FXRT_CHANNELC 0x0f000000 /* Effects send bus number for channel's effects send C */ 460#define FXRT_CHANNELC 0x0f000000 /* Effects send bus number for channel's effects send C */
433#define FXRT_CHANNELD 0xf0000000 /* Effects send bus number for channel's effects send D */ 461#define FXRT_CHANNELD 0xf0000000 /* Effects send bus number for channel's effects send D */
434 462
463#define A_HR 0x0b /* High Resolution. 24bit playback from host to DSP. */
435#define MAPA 0x0c /* Cache map A */ 464#define MAPA 0x0c /* Cache map A */
436 465
437#define MAPB 0x0d /* Cache map B */ 466#define MAPB 0x0d /* Cache map B */
@@ -439,6 +468,8 @@
439#define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ 468#define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */
440#define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ 469#define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */
441 470
471/* 0x0e, 0x0f: Not used */
472
442#define ENVVOL 0x10 /* Volume envelope register */ 473#define ENVVOL 0x10 /* Volume envelope register */
443#define ENVVOL_MASK 0x0000ffff /* Current value of volume envelope state variable */ 474#define ENVVOL_MASK 0x0000ffff /* Current value of volume envelope state variable */
444 /* 0x8000-n == 666*n usec delay */ 475 /* 0x8000-n == 666*n usec delay */
@@ -527,7 +558,7 @@
527 /* NOTE: All channels contain internal variables; do */ 558 /* NOTE: All channels contain internal variables; do */
528 /* not write to these locations. */ 559 /* not write to these locations. */
529 560
530/* 1f something */ 561/* 0x1f: not used */
531 562
532#define CD0 0x20 /* Cache data 0 register */ 563#define CD0 0x20 /* Cache data 0 register */
533#define CD1 0x21 /* Cache data 1 register */ 564#define CD1 0x21 /* Cache data 1 register */
@@ -597,6 +628,8 @@
597#define FXWC_SPDIFLEFT (1<<22) /* 0x00400000 */ 628#define FXWC_SPDIFLEFT (1<<22) /* 0x00400000 */
598#define FXWC_SPDIFRIGHT (1<<23) /* 0x00800000 */ 629#define FXWC_SPDIFRIGHT (1<<23) /* 0x00800000 */
599 630
631#define A_TBLSZ 0x43 /* Effects Tank Internal Table Size. Only low byte or register used */
632
600#define TCBS 0x44 /* Tank cache buffer size register */ 633#define TCBS 0x44 /* Tank cache buffer size register */
601#define TCBS_MASK 0x00000007 /* Tank cache buffer size field */ 634#define TCBS_MASK 0x00000007 /* Tank cache buffer size field */
602#define TCBS_BUFFSIZE_16K 0x00000000 635#define TCBS_BUFFSIZE_16K 0x00000000
@@ -617,7 +650,7 @@
617#define FXBA 0x47 /* FX Buffer Address */ 650#define FXBA 0x47 /* FX Buffer Address */
618#define FXBA_MASK 0xfffff000 /* 20 bit base address */ 651#define FXBA_MASK 0xfffff000 /* 20 bit base address */
619 652
620/* 0x48 something - word access, defaults to 3f */ 653#define A_HWM 0x48 /* High PCI Water Mark - word access, defaults to 3f */
621 654
622#define MICBS 0x49 /* Microphone buffer size register */ 655#define MICBS 0x49 /* Microphone buffer size register */
623 656
@@ -661,6 +694,18 @@
661#define ADCBS_BUFSIZE_57344 0x0000001e 694#define ADCBS_BUFSIZE_57344 0x0000001e
662#define ADCBS_BUFSIZE_65536 0x0000001f 695#define ADCBS_BUFSIZE_65536 0x0000001f
663 696
697/* Current Send B, A Amounts */
698#define A_CSBA 0x4c
699
700/* Current Send D, C Amounts */
701#define A_CSDC 0x4d
702
703/* Current Send F, E Amounts */
704#define A_CSFE 0x4e
705
706/* Current Send H, G Amounts */
707#define A_CSHG 0x4f
708
664 709
665#define CDCS 0x50 /* CD-ROM digital channel status register */ 710#define CDCS 0x50 /* CD-ROM digital channel status register */
666 711
@@ -668,6 +713,9 @@
668 713
669#define DBG 0x52 /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */ 714#define DBG 0x52 /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */
670 715
716/* S/PDIF Input C Channel Status */
717#define A_SPSC 0x52
718
671#define REG53 0x53 /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */ 719#define REG53 0x53 /* DO NOT PROGRAM THIS REGISTER!!! MAY DESTROY CHIP */
672 720
673#define A_DBG 0x53 721#define A_DBG 0x53
@@ -708,6 +756,8 @@
708#define SPCS_NOTAUDIODATA 0x00000002 /* 0 = Digital audio, 1 = not audio */ 756#define SPCS_NOTAUDIODATA 0x00000002 /* 0 = Digital audio, 1 = not audio */
709#define SPCS_PROFESSIONAL 0x00000001 /* 0 = Consumer (IEC-958), 1 = pro (AES3-1992) */ 757#define SPCS_PROFESSIONAL 0x00000001 /* 0 = Consumer (IEC-958), 1 = pro (AES3-1992) */
710 758
759/* 0x57: Not used */
760
711/* The 32-bit CLIx and SOLx registers all have one bit per channel control/status */ 761/* The 32-bit CLIx and SOLx registers all have one bit per channel control/status */
712#define CLIEL 0x58 /* Channel loop interrupt enable low register */ 762#define CLIEL 0x58 /* Channel loop interrupt enable low register */
713 763
@@ -733,6 +783,9 @@
733#define AC97SLOT_CNTR 0x10 /* Center enable */ 783#define AC97SLOT_CNTR 0x10 /* Center enable */
734#define AC97SLOT_LFE 0x20 /* LFE enable */ 784#define AC97SLOT_LFE 0x20 /* LFE enable */
735 785
786/* PCB Revision */
787#define A_PCB 0x5f
788
736// NOTE: 0x60,61,62: 64-bit 789// NOTE: 0x60,61,62: 64-bit
737#define CDSRCS 0x60 /* CD-ROM Sample Rate Converter status register */ 790#define CDSRCS 0x60 /* CD-ROM Sample Rate Converter status register */
738 791
@@ -780,9 +833,18 @@
780 833
781#define HLIPH 0x69 /* Channel half loop interrupt pending high register */ 834#define HLIPH 0x69 /* Channel half loop interrupt pending high register */
782 835
783// 0x6a,6b,6c used for some recording 836/* S/PDIF Host Record Index (bypasses SRC) */
784// 0x6d unused 837#define A_SPRI 0x6a
785// 0x6e,6f - tanktable base / offset 838/* S/PDIF Host Record Address */
839#define A_SPRA 0x6b
840/* S/PDIF Host Record Control */
841#define A_SPRC 0x6c
842/* Delayed Interrupt Counter & Enable */
843#define A_DICE 0x6d
844/* Tank Table Base */
845#define A_TTB 0x6e
846/* Tank Delay Offset */
847#define A_TDOF 0x6f
786 848
787/* This is the MPU port on the card (via the game port) */ 849/* This is the MPU port on the card (via the game port) */
788#define A_MUDATA1 0x70 850#define A_MUDATA1 0x70
@@ -800,6 +862,7 @@
800#define A_FXWC1 0x74 /* Selects 0x7f-0x60 for FX recording */ 862#define A_FXWC1 0x74 /* Selects 0x7f-0x60 for FX recording */
801#define A_FXWC2 0x75 /* Selects 0x9f-0x80 for FX recording */ 863#define A_FXWC2 0x75 /* Selects 0x9f-0x80 for FX recording */
802 864
865/* Extended Hardware Control */
803#define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */ 866#define A_SPDIF_SAMPLERATE 0x76 /* Set the sample rate of SPDIF output */
804#define A_SAMPLE_RATE 0x76 /* Various sample rate settings. */ 867#define A_SAMPLE_RATE 0x76 /* Various sample rate settings. */
805#define A_SAMPLE_RATE_NOT_USED 0x0ffc111e /* Bits that are not used and cannot be set. */ 868#define A_SAMPLE_RATE_NOT_USED 0x0ffc111e /* Bits that are not used and cannot be set. */
@@ -822,8 +885,20 @@
822#define A_PCM_96000 0x00004000 885#define A_PCM_96000 0x00004000
823#define A_PCM_44100 0x00008000 886#define A_PCM_44100 0x00008000
824 887
825/* 0x77,0x78,0x79 "something i2s-related" - default to 0x01080000 on my audigy 2 ZS --rlrevell */ 888/* I2S0 Sample Rate Tracker Status */
826/* 0x7a, 0x7b - lookup tables */ 889#define A_SRT3 0x77
890
891/* I2S1 Sample Rate Tracker Status */
892#define A_SRT4 0x78
893
894/* I2S2 Sample Rate Tracker Status */
895#define A_SRT5 0x79
896/* - default to 0x01080000 on my audigy 2 ZS --rlrevell */
897
898/* Tank Table DMA Address */
899#define A_TTDA 0x7a
900/* Tank Table DMA Data */
901#define A_TTDD 0x7b
827 902
828#define A_FXRT2 0x7c 903#define A_FXRT2 0x7c
829#define A_FXRT_CHANNELE 0x0000003f /* Effects send bus number for channel's effects send E */ 904#define A_FXRT_CHANNELE 0x0000003f /* Effects send bus number for channel's effects send E */
@@ -845,7 +920,7 @@
845#define A_FXRT_CHANNELC 0x003f0000 920#define A_FXRT_CHANNELC 0x003f0000
846#define A_FXRT_CHANNELD 0x3f000000 921#define A_FXRT_CHANNELD 0x3f000000
847 922
848 923/* 0x7f: Not used */
849/* Each FX general purpose register is 32 bits in length, all bits are used */ 924/* Each FX general purpose register is 32 bits in length, all bits are used */
850#define FXGPREGBASE 0x100 /* FX general purpose registers base */ 925#define FXGPREGBASE 0x100 /* FX general purpose registers base */
851#define A_FXGPREGBASE 0x400 /* Audigy GPRs, 0x400 to 0x5ff */ 926#define A_FXGPREGBASE 0x400 /* Audigy GPRs, 0x400 to 0x5ff */
@@ -886,6 +961,293 @@
886#define A_HIWORD_RESULT_MASK 0x007ff000 961#define A_HIWORD_RESULT_MASK 0x007ff000
887#define A_HIWORD_OPA_MASK 0x000007ff 962#define A_HIWORD_OPA_MASK 0x000007ff
888 963
964/************************************************************************************************/
965/* EMU1010m HANA FPGA registers */
966/************************************************************************************************/
967#define EMU_HANA_DESTHI 0x00 /* 0000xxx 3 bits Link Destination */
968#define EMU_HANA_DESTLO 0x01 /* 00xxxxx 5 bits */
969#define EMU_HANA_SRCHI 0x02 /* 0000xxx 3 bits Link Source */
970#define EMU_HANA_SRCLO 0x03 /* 00xxxxx 5 bits */
971#define EMU_HANA_DOCK_PWR 0x04 /* 000000x 1 bits Audio Dock power */
972#define EMU_HANA_DOCK_PWR_ON 0x01 /* Audio Dock power on */
973#define EMU_HANA_WCLOCK 0x05 /* 0000xxx 3 bits Word Clock source select */
974 /* Must be written after power on to reset DLL */
975 /* One is unable to detect the Audio dock without this */
976#define EMU_HANA_WCLOCK_SRC_MASK 0x07
977#define EMU_HANA_WCLOCK_INT_48K 0x00
978#define EMU_HANA_WCLOCK_INT_44_1K 0x01
979#define EMU_HANA_WCLOCK_HANA_SPDIF_IN 0x02
980#define EMU_HANA_WCLOCK_HANA_ADAT_IN 0x03
981#define EMU_HANA_WCLOCK_SYNC_BNCN 0x04
982#define EMU_HANA_WCLOCK_2ND_HANA 0x05
983#define EMU_HANA_WCLOCK_SRC_RESERVED 0x06
984#define EMU_HANA_WCLOCK_OFF 0x07 /* For testing, forces fallback to DEFCLOCK */
985#define EMU_HANA_WCLOCK_MULT_MASK 0x18
986#define EMU_HANA_WCLOCK_1X 0x00
987#define EMU_HANA_WCLOCK_2X 0x08
988#define EMU_HANA_WCLOCK_4X 0x10
989#define EMU_HANA_WCLOCK_MULT_RESERVED 0x18
990
991#define EMU_HANA_DEFCLOCK 0x06 /* 000000x 1 bits Default Word Clock */
992#define EMU_HANA_DEFCLOCK_48K 0x00
993#define EMU_HANA_DEFCLOCK_44_1K 0x01
994
995#define EMU_HANA_UNMUTE 0x07 /* 000000x 1 bits Mute all audio outputs */
996#define EMU_MUTE 0x00
997#define EMU_UNMUTE 0x01
998
999#define EMU_HANA_FPGA_CONFIG 0x08 /* 00000xx 2 bits Config control of FPGAs */
1000#define EMU_HANA_FPGA_CONFIG_AUDIODOCK 0x01 /* Set in order to program FPGA on Audio Dock */
1001#define EMU_HANA_FPGA_CONFIG_HANA 0x02 /* Set in order to program FPGA on Hana */
1002
1003#define EMU_HANA_IRQ_ENABLE 0x09 /* 000xxxx 4 bits IRQ Enable */
1004#define EMU_HANA_IRQ_WCLK_CHANGED 0x01
1005#define EMU_HANA_IRQ_ADAT 0x02
1006#define EMU_HANA_IRQ_DOCK 0x04
1007#define EMU_HANA_IRQ_DOCK_LOST 0x08
1008
1009#define EMU_HANA_SPDIF_MODE 0x0a /* 00xxxxx 5 bits SPDIF MODE */
1010#define EMU_HANA_SPDIF_MODE_TX_COMSUMER 0x00
1011#define EMU_HANA_SPDIF_MODE_TX_PRO 0x01
1012#define EMU_HANA_SPDIF_MODE_TX_NOCOPY 0x02
1013#define EMU_HANA_SPDIF_MODE_RX_COMSUMER 0x00
1014#define EMU_HANA_SPDIF_MODE_RX_PRO 0x04
1015#define EMU_HANA_SPDIF_MODE_RX_NOCOPY 0x08
1016#define EMU_HANA_SPDIF_MODE_RX_INVALID 0x10
1017
1018#define EMU_HANA_OPTICAL_TYPE 0x0b /* 00000xx 2 bits ADAT or SPDIF in/out */
1019#define EMU_HANA_OPTICAL_IN_SPDIF 0x00
1020#define EMU_HANA_OPTICAL_IN_ADAT 0x01
1021#define EMU_HANA_OPTICAL_OUT_SPDIF 0x00
1022#define EMU_HANA_OPTICAL_OUT_ADAT 0x02
1023
1024#define EMU_HANA_MIDI_IN 0x0c /* 000000x 1 bit Control MIDI */
1025#define EMU_HANA_MIDI_IN_FROM_HAMOA 0x00 /* HAMOA MIDI in to Alice 2 MIDI B */
1026#define EMU_HANA_MIDI_IN_FROM_DOCK 0x01 /* Audio Dock MIDI in to Alice 2 MIDI B */
1027
1028#define EMU_HANA_DOCK_LEDS_1 0x0d /* 000xxxx 4 bit Audio Dock LEDs */
1029#define EMU_HANA_DOCK_LEDS_1_MIDI1 0x01 /* MIDI 1 LED on */
1030#define EMU_HANA_DOCK_LEDS_1_MIDI2 0x02 /* MIDI 2 LED on */
1031#define EMU_HANA_DOCK_LEDS_1_SMPTE_IN 0x04 /* SMPTE IN LED on */
1032#define EMU_HANA_DOCK_LEDS_1_SMPTE_OUT 0x08 /* SMPTE OUT LED on */
1033
1034#define EMU_HANA_DOCK_LEDS_2 0x0e /* 0xxxxxx 6 bit Audio Dock LEDs */
1035#define EMU_HANA_DOCK_LEDS_2_44K 0x01 /* 44.1 kHz LED on */
1036#define EMU_HANA_DOCK_LEDS_2_48K 0x02 /* 48 kHz LED on */
1037#define EMU_HANA_DOCK_LEDS_2_96K 0x04 /* 96 kHz LED on */
1038#define EMU_HANA_DOCK_LEDS_2_192K 0x08 /* 192 kHz LED on */
1039#define EMU_HANA_DOCK_LEDS_2_LOCK 0x10 /* LOCK LED on */
1040#define EMU_HANA_DOCK_LEDS_2_EXT 0x20 /* EXT LED on */
1041
1042#define EMU_HANA_DOCK_LEDS_3 0x0f /* 0xxxxxx 6 bit Audio Dock LEDs */
1043#define EMU_HANA_DOCK_LEDS_3_CLIP_A 0x01 /* Mic A Clip LED on */
1044#define EMU_HANA_DOCK_LEDS_3_CLIP_B 0x02 /* Mic B Clip LED on */
1045#define EMU_HANA_DOCK_LEDS_3_SIGNAL_A 0x04 /* Signal A Clip LED on */
1046#define EMU_HANA_DOCK_LEDS_3_SIGNAL_B 0x08 /* Signal B Clip LED on */
1047#define EMU_HANA_DOCK_LEDS_3_MANUAL_CLIP 0x10 /* Manual Clip detection */
1048#define EMU_HANA_DOCK_LEDS_3_MANUAL_SIGNAL 0x20 /* Manual Signal detection */
1049
1050#define EMU_HANA_ADC_PADS 0x10 /* 0000xxx 3 bit Audio Dock ADC 14dB pads */
1051#define EMU_HANA_DOCK_ADC_PAD1 0x01 /* 14dB Attenuation on Audio Dock ADC 1 */
1052#define EMU_HANA_DOCK_ADC_PAD2 0x02 /* 14dB Attenuation on Audio Dock ADC 2 */
1053#define EMU_HANA_DOCK_ADC_PAD3 0x04 /* 14dB Attenuation on Audio Dock ADC 3 */
1054#define EMU_HANA_0202_ADC_PAD1 0x08 /* 14dB Attenuation on 0202 ADC 1 */
1055
1056#define EMU_HANA_DOCK_MISC 0x11 /* 0xxxxxx 6 bit Audio Dock misc bits */
1057#define EMU_HANA_DOCK_DAC1_MUTE 0x01 /* DAC 1 Mute */
1058#define EMU_HANA_DOCK_DAC2_MUTE 0x02 /* DAC 2 Mute */
1059#define EMU_HANA_DOCK_DAC3_MUTE 0x04 /* DAC 3 Mute */
1060#define EMU_HANA_DOCK_DAC4_MUTE 0x08 /* DAC 4 Mute */
1061#define EMU_HANA_DOCK_PHONES_192_DAC1 0x00 /* DAC 1 Headphones source at 192kHz */
1062#define EMU_HANA_DOCK_PHONES_192_DAC2 0x10 /* DAC 2 Headphones source at 192kHz */
1063#define EMU_HANA_DOCK_PHONES_192_DAC3 0x20 /* DAC 3 Headphones source at 192kHz */
1064#define EMU_HANA_DOCK_PHONES_192_DAC4 0x30 /* DAC 4 Headphones source at 192kHz */
1065
1066#define EMU_HANA_MIDI_OUT 0x12 /* 00xxxxx 5 bit Source for each MIDI out port */
1067#define EMU_HANA_MIDI_OUT_0202 0x01 /* 0202 MIDI from Alice 2. 0 = A, 1 = B */
1068#define EMU_HANA_MIDI_OUT_DOCK1 0x02 /* Audio Dock MIDI1 front, from Alice 2. 0 = A, 1 = B */
1069#define EMU_HANA_MIDI_OUT_DOCK2 0x04 /* Audio Dock MIDI2 rear, from Alice 2. 0 = A, 1 = B */
1070#define EMU_HANA_MIDI_OUT_SYNC2 0x08 /* Sync card. Not the actual MIDI out jack. 0 = A, 1 = B */
1071#define EMU_HANA_MIDI_OUT_LOOP 0x10 /* 0 = bits (3:0) normal. 1 = MIDI loopback enabled. */
1072
1073#define EMU_HANA_DAC_PADS 0x13 /* 00xxxxx 5 bit DAC 14dB attenuation pads */
1074#define EMU_HANA_DOCK_DAC_PAD1 0x01 /* 14dB Attenuation on AudioDock DAC 1. Left and Right */
1075#define EMU_HANA_DOCK_DAC_PAD2 0x02 /* 14dB Attenuation on AudioDock DAC 2. Left and Right */
1076#define EMU_HANA_DOCK_DAC_PAD3 0x04 /* 14dB Attenuation on AudioDock DAC 3. Left and Right */
1077#define EMU_HANA_DOCK_DAC_PAD4 0x08 /* 14dB Attenuation on AudioDock DAC 4. Left and Right */
1078#define EMU_HANA_0202_DAC_PAD1 0x10 /* 14dB Attenuation on 0202 DAC 1. Left and Right */
1079
1080/* 0x14 - 0x1f Unused R/W registers */
1081#define EMU_HANA_IRQ_STATUS 0x20 /* 000xxxx 4 bits IRQ Status */
1082#if 0 /* Already defined for reg 0x09 IRQ_ENABLE */
1083#define EMU_HANA_IRQ_WCLK_CHANGED 0x01
1084#define EMU_HANA_IRQ_ADAT 0x02
1085#define EMU_HANA_IRQ_DOCK 0x04
1086#define EMU_HANA_IRQ_DOCK_LOST 0x08
1087#endif
1088
1089#define EMU_HANA_OPTION_CARDS 0x21 /* 000xxxx 4 bits Presence of option cards */
1090#define EMU_HANA_OPTION_HAMOA 0x01 /* HAMOA card present */
1091#define EMU_HANA_OPTION_SYNC 0x02 /* Sync card present */
1092#define EMU_HANA_OPTION_DOCK_ONLINE 0x04 /* Audio Dock online and FPGA configured */
1093#define EMU_HANA_OPTION_DOCK_OFFLINE 0x08 /* Audio Dock online and FPGA not configured */
1094
1095#define EMU_HANA_ID 0x22 /* 1010101 7 bits ID byte & 0x7f = 0x55 */
1096
1097#define EMU_HANA_MAJOR_REV 0x23 /* 0000xxx 3 bit Hana FPGA Major rev */
1098#define EMU_HANA_MINOR_REV 0x24 /* 0000xxx 3 bit Hana FPGA Minor rev */
1099
1100#define EMU_DOCK_MAJOR_REV 0x25 /* 0000xxx 3 bit Audio Dock FPGA Major rev */
1101#define EMU_DOCK_MINOR_REV 0x26 /* 0000xxx 3 bit Audio Dock FPGA Minor rev */
1102
1103#define EMU_DOCK_BOARD_ID 0x27 /* 00000xx 2 bits Audio Dock ID pins */
1104#define EMU_DOCK_BOARD_ID0 0x00 /* ID bit 0 */
1105#define EMU_DOCK_BOARD_ID1 0x03 /* ID bit 1 */
1106
1107#define EMU_HANA_WC_SPDIF_HI 0x28 /* 0xxxxxx 6 bit SPDIF IN Word clock, upper 6 bits */
1108#define EMU_HANA_WC_SPDIF_LO 0x29 /* 0xxxxxx 6 bit SPDIF IN Word clock, lower 6 bits */
1109
1110#define EMU_HANA_WC_ADAT_HI 0x2a /* 0xxxxxx 6 bit ADAT IN Word clock, upper 6 bits */
1111#define EMU_HANA_WC_ADAT_LO 0x2b /* 0xxxxxx 6 bit ADAT IN Word clock, lower 6 bits */
1112
1113#define EMU_HANA_WC_BNC_LO 0x2c /* 0xxxxxx 6 bit BNC IN Word clock, lower 6 bits */
1114#define EMU_HANA_WC_BNC_HI 0x2d /* 0xxxxxx 6 bit BNC IN Word clock, upper 6 bits */
1115
1116#define EMU_HANA2_WC_SPDIF_HI 0x2e /* 0xxxxxx 6 bit HANA2 SPDIF IN Word clock, upper 6 bits */
1117#define EMU_HANA2_WC_SPDIF_LO 0x2f /* 0xxxxxx 6 bit HANA2 SPDIF IN Word clock, lower 6 bits */
1118/* 0x30 - 0x3f Unused Read only registers */
1119
1120/************************************************************************************************/
1121/* EMU1010m HANA Destinations */
1122/************************************************************************************************/
1123#define EMU_DST_ALICE2_EMU32_0 0x000f /* 16 EMU32 channels to Alice2 +0 to +0xf */
1124#define EMU_DST_ALICE2_EMU32_1 0x0000 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1125#define EMU_DST_ALICE2_EMU32_2 0x0001 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1126#define EMU_DST_ALICE2_EMU32_3 0x0002 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1127#define EMU_DST_ALICE2_EMU32_4 0x0003 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1128#define EMU_DST_ALICE2_EMU32_5 0x0004 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1129#define EMU_DST_ALICE2_EMU32_6 0x0005 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1130#define EMU_DST_ALICE2_EMU32_7 0x0006 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1131#define EMU_DST_ALICE2_EMU32_8 0x0007 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1132#define EMU_DST_ALICE2_EMU32_9 0x0008 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1133#define EMU_DST_ALICE2_EMU32_A 0x0009 /* 16 EMU32 channels to Alice2 +0 to +0xf */
1134#define EMU_DST_ALICE2_EMU32_B 0x000a /* 16 EMU32 channels to Alice2 +0 to +0xf */
1135#define EMU_DST_ALICE2_EMU32_C 0x000b /* 16 EMU32 channels to Alice2 +0 to +0xf */
1136#define EMU_DST_ALICE2_EMU32_D 0x000c /* 16 EMU32 channels to Alice2 +0 to +0xf */
1137#define EMU_DST_ALICE2_EMU32_E 0x000d /* 16 EMU32 channels to Alice2 +0 to +0xf */
1138#define EMU_DST_ALICE2_EMU32_F 0x000e /* 16 EMU32 channels to Alice2 +0 to +0xf */
1139#define EMU_DST_DOCK_DAC1_LEFT1 0x0100 /* Audio Dock DAC1 Left, 1st or 48kHz only */
1140#define EMU_DST_DOCK_DAC1_LEFT2 0x0101 /* Audio Dock DAC1 Left, 2nd or 96kHz */
1141#define EMU_DST_DOCK_DAC1_LEFT3 0x0102 /* Audio Dock DAC1 Left, 3rd or 192kHz */
1142#define EMU_DST_DOCK_DAC1_LEFT4 0x0103 /* Audio Dock DAC1 Left, 4th or 192kHz */
1143#define EMU_DST_DOCK_DAC1_RIGHT1 0x0104 /* Audio Dock DAC1 Right, 1st or 48kHz only */
1144#define EMU_DST_DOCK_DAC1_RIGHT2 0x0105 /* Audio Dock DAC1 Right, 2nd or 96kHz */
1145#define EMU_DST_DOCK_DAC1_RIGHT3 0x0106 /* Audio Dock DAC1 Right, 3rd or 192kHz */
1146#define EMU_DST_DOCK_DAC1_RIGHT4 0x0107 /* Audio Dock DAC1 Right, 4th or 192kHz */
1147#define EMU_DST_DOCK_DAC2_LEFT1 0x0108 /* Audio Dock DAC2 Left, 1st or 48kHz only */
1148#define EMU_DST_DOCK_DAC2_LEFT2 0x0109 /* Audio Dock DAC2 Left, 2nd or 96kHz */
1149#define EMU_DST_DOCK_DAC2_LEFT3 0x010a /* Audio Dock DAC2 Left, 3rd or 192kHz */
1150#define EMU_DST_DOCK_DAC2_LEFT4 0x010b /* Audio Dock DAC2 Left, 4th or 192kHz */
1151#define EMU_DST_DOCK_DAC2_RIGHT1 0x010c /* Audio Dock DAC2 Right, 1st or 48kHz only */
1152#define EMU_DST_DOCK_DAC2_RIGHT2 0x010d /* Audio Dock DAC2 Right, 2nd or 96kHz */
1153#define EMU_DST_DOCK_DAC2_RIGHT3 0x010e /* Audio Dock DAC2 Right, 3rd or 192kHz */
1154#define EMU_DST_DOCK_DAC2_RIGHT4 0x010f /* Audio Dock DAC2 Right, 4th or 192kHz */
1155#define EMU_DST_DOCK_DAC3_LEFT1 0x0110 /* Audio Dock DAC1 Left, 1st or 48kHz only */
1156#define EMU_DST_DOCK_DAC3_LEFT2 0x0111 /* Audio Dock DAC1 Left, 2nd or 96kHz */
1157#define EMU_DST_DOCK_DAC3_LEFT3 0x0112 /* Audio Dock DAC1 Left, 3rd or 192kHz */
1158#define EMU_DST_DOCK_DAC3_LEFT4 0x0113 /* Audio Dock DAC1 Left, 4th or 192kHz */
1159#define EMU_DST_DOCK_PHONES_LEFT1 0x0112 /* Audio Dock PHONES Left, 1st or 48kHz only */
1160#define EMU_DST_DOCK_PHONES_LEFT2 0x0113 /* Audio Dock PHONES Left, 2nd or 96kHz */
1161#define EMU_DST_DOCK_DAC3_RIGHT1 0x0114 /* Audio Dock DAC1 Right, 1st or 48kHz only */
1162#define EMU_DST_DOCK_DAC3_RIGHT2 0x0115 /* Audio Dock DAC1 Right, 2nd or 96kHz */
1163#define EMU_DST_DOCK_DAC3_RIGHT3 0x0116 /* Audio Dock DAC1 Right, 3rd or 192kHz */
1164#define EMU_DST_DOCK_DAC3_RIGHT4 0x0117 /* Audio Dock DAC1 Right, 4th or 192kHz */
1165#define EMU_DST_DOCK_PHONES_RIGHT1 0x0116 /* Audio Dock PHONES Right, 1st or 48kHz only */
1166#define EMU_DST_DOCK_PHONES_RIGHT2 0x0117 /* Audio Dock PHONES Right, 2nd or 96kHz */
1167#define EMU_DST_DOCK_DAC4_LEFT1 0x0118 /* Audio Dock DAC2 Left, 1st or 48kHz only */
1168#define EMU_DST_DOCK_DAC4_LEFT2 0x0119 /* Audio Dock DAC2 Left, 2nd or 96kHz */
1169#define EMU_DST_DOCK_DAC4_LEFT3 0x011a /* Audio Dock DAC2 Left, 3rd or 192kHz */
1170#define EMU_DST_DOCK_DAC4_LEFT4 0x011b /* Audio Dock DAC2 Left, 4th or 192kHz */
1171#define EMU_DST_DOCK_SPDIF_LEFT1 0x011a /* Audio Dock SPDIF Left, 1st or 48kHz only */
1172#define EMU_DST_DOCK_SPDIF_LEFT2 0x011b /* Audio Dock SPDIF Left, 2nd or 96kHz */
1173#define EMU_DST_DOCK_DAC4_RIGHT1 0x011c /* Audio Dock DAC2 Right, 1st or 48kHz only */
1174#define EMU_DST_DOCK_DAC4_RIGHT2 0x011d /* Audio Dock DAC2 Right, 2nd or 96kHz */
1175#define EMU_DST_DOCK_DAC4_RIGHT3 0x011e /* Audio Dock DAC2 Right, 3rd or 192kHz */
1176#define EMU_DST_DOCK_DAC4_RIGHT4 0x011f /* Audio Dock DAC2 Right, 4th or 192kHz */
1177#define EMU_DST_DOCK_SPDIF_RIGHT1 0x011e /* Audio Dock SPDIF Right, 1st or 48kHz only */
1178#define EMU_DST_DOCK_SPDIF_RIGHT2 0x011f /* Audio Dock SPDIF Right, 2nd or 96kHz */
1179#define EMU_DST_HANA_SPDIF_LEFT1 0x0200 /* Hana SPDIF Left, 1st or 48kHz only */
1180#define EMU_DST_HANA_SPDIF_LEFT2 0x0202 /* Hana SPDIF Left, 2nd or 96kHz */
1181#define EMU_DST_HANA_SPDIF_RIGHT1 0x0201 /* Hana SPDIF Right, 1st or 48kHz only */
1182#define EMU_DST_HANA_SPDIF_RIGHT2 0x0203 /* Hana SPDIF Right, 2nd or 96kHz */
1183#define EMU_DST_HAMOA_DAC_LEFT1 0x0300 /* Hamoa DAC Left, 1st or 48kHz only */
1184#define EMU_DST_HAMOA_DAC_LEFT2 0x0302 /* Hamoa DAC Left, 2nd or 96kHz */
1185#define EMU_DST_HAMOA_DAC_LEFT3 0x0304 /* Hamoa DAC Left, 3rd or 192kHz */
1186#define EMU_DST_HAMOA_DAC_LEFT4 0x0306 /* Hamoa DAC Left, 4th or 192kHz */
1187#define EMU_DST_HAMOA_DAC_RIGHT1 0x0301 /* Hamoa DAC Right, 1st or 48kHz only */
1188#define EMU_DST_HAMOA_DAC_RIGHT2 0x0303 /* Hamoa DAC Right, 2nd or 96kHz */
1189#define EMU_DST_HAMOA_DAC_RIGHT3 0x0305 /* Hamoa DAC Right, 3rd or 192kHz */
1190#define EMU_DST_HAMOA_DAC_RIGHT4 0x0307 /* Hamoa DAC Right, 4th or 192kHz */
1191#define EMU_DST_HANA_ADAT 0x0400 /* Hana ADAT 8 channel out +0 to +7 */
1192#define EMU_DST_ALICE_I2S0_LEFT 0x0500 /* Alice2 I2S0 Left */
1193#define EMU_DST_ALICE_I2S0_RIGHT 0x0501 /* Alice2 I2S0 Right */
1194#define EMU_DST_ALICE_I2S1_LEFT 0x0600 /* Alice2 I2S1 Left */
1195#define EMU_DST_ALICE_I2S1_RIGHT 0x0601 /* Alice2 I2S1 Right */
1196#define EMU_DST_ALICE_I2S2_LEFT 0x0700 /* Alice2 I2S2 Left */
1197#define EMU_DST_ALICE_I2S2_RIGHT 0x0701 /* Alice2 I2S2 Right */
1198
1199/************************************************************************************************/
1200/* EMU1010m HANA Sources */
1201/************************************************************************************************/
1202#define EMU_SRC_SILENCE 0x0000 /* Silence */
1203#define EMU_SRC_DOCK_MIC_A1 0x0100 /* Audio Dock Mic A, 1st or 48kHz only */
1204#define EMU_SRC_DOCK_MIC_A2 0x0101 /* Audio Dock Mic A, 2nd or 96kHz */
1205#define EMU_SRC_DOCK_MIC_A3 0x0102 /* Audio Dock Mic A, 3rd or 192kHz */
1206#define EMU_SRC_DOCK_MIC_A4 0x0103 /* Audio Dock Mic A, 4th or 192kHz */
1207#define EMU_SRC_DOCK_MIC_B1 0x0104 /* Audio Dock Mic B, 1st or 48kHz only */
1208#define EMU_SRC_DOCK_MIC_B2 0x0105 /* Audio Dock Mic B, 2nd or 96kHz */
1209#define EMU_SRC_DOCK_MIC_B3 0x0106 /* Audio Dock Mic B, 3rd or 192kHz */
1210#define EMU_SRC_DOCK_MIC_B4 0x0107 /* Audio Dock Mic B, 4th or 192kHz */
1211#define EMU_SRC_DOCK_ADC1_LEFT1 0x0108 /* Audio Dock ADC1 Left, 1st or 48kHz only */
1212#define EMU_SRC_DOCK_ADC1_LEFT2 0x0109 /* Audio Dock ADC1 Left, 2nd or 96kHz */
1213#define EMU_SRC_DOCK_ADC1_LEFT3 0x010a /* Audio Dock ADC1 Left, 3rd or 192kHz */
1214#define EMU_SRC_DOCK_ADC1_LEFT4 0x010b /* Audio Dock ADC1 Left, 4th or 192kHz */
1215#define EMU_SRC_DOCK_ADC1_RIGHT1 0x010c /* Audio Dock ADC1 Right, 1st or 48kHz only */
1216#define EMU_SRC_DOCK_ADC1_RIGHT2 0x010d /* Audio Dock ADC1 Right, 2nd or 96kHz */
1217#define EMU_SRC_DOCK_ADC1_RIGHT3 0x010e /* Audio Dock ADC1 Right, 3rd or 192kHz */
1218#define EMU_SRC_DOCK_ADC1_RIGHT4 0x010f /* Audio Dock ADC1 Right, 4th or 192kHz */
1219#define EMU_SRC_DOCK_ADC2_LEFT1 0x0110 /* Audio Dock ADC2 Left, 1st or 48kHz only */
1220#define EMU_SRC_DOCK_ADC2_LEFT2 0x0111 /* Audio Dock ADC2 Left, 2nd or 96kHz */
1221#define EMU_SRC_DOCK_ADC2_LEFT3 0x0112 /* Audio Dock ADC2 Left, 3rd or 192kHz */
1222#define EMU_SRC_DOCK_ADC2_LEFT4 0x0113 /* Audio Dock ADC2 Left, 4th or 192kHz */
1223#define EMU_SRC_DOCK_ADC2_RIGHT1 0x0114 /* Audio Dock ADC2 Right, 1st or 48kHz only */
1224#define EMU_SRC_DOCK_ADC2_RIGHT2 0x0115 /* Audio Dock ADC2 Right, 2nd or 96kHz */
1225#define EMU_SRC_DOCK_ADC2_RIGHT3 0x0116 /* Audio Dock ADC2 Right, 3rd or 192kHz */
1226#define EMU_SRC_DOCK_ADC2_RIGHT4 0x0117 /* Audio Dock ADC2 Right, 4th or 192kHz */
1227#define EMU_SRC_DOCK_ADC3_LEFT1 0x0118 /* Audio Dock ADC3 Left, 1st or 48kHz only */
1228#define EMU_SRC_DOCK_ADC3_LEFT2 0x0119 /* Audio Dock ADC3 Left, 2nd or 96kHz */
1229#define EMU_SRC_DOCK_ADC3_LEFT3 0x011a /* Audio Dock ADC3 Left, 3rd or 192kHz */
1230#define EMU_SRC_DOCK_ADC3_LEFT4 0x011b /* Audio Dock ADC3 Left, 4th or 192kHz */
1231#define EMU_SRC_DOCK_ADC3_RIGHT1 0x011c /* Audio Dock ADC3 Right, 1st or 48kHz only */
1232#define EMU_SRC_DOCK_ADC3_RIGHT2 0x011d /* Audio Dock ADC3 Right, 2nd or 96kHz */
1233#define EMU_SRC_DOCK_ADC3_RIGHT3 0x011e /* Audio Dock ADC3 Right, 3rd or 192kHz */
1234#define EMU_SRC_DOCK_ADC3_RIGHT4 0x011f /* Audio Dock ADC3 Right, 4th or 192kHz */
1235#define EMU_SRC_HAMOA_ADC_LEFT1 0x0200 /* Hamoa ADC Left, 1st or 48kHz only */
1236#define EMU_SRC_HAMOA_ADC_LEFT2 0x0202 /* Hamoa ADC Left, 2nd or 96kHz */
1237#define EMU_SRC_HAMOA_ADC_LEFT3 0x0204 /* Hamoa ADC Left, 3rd or 192kHz */
1238#define EMU_SRC_HAMOA_ADC_LEFT4 0x0206 /* Hamoa ADC Left, 4th or 192kHz */
1239#define EMU_SRC_HAMOA_ADC_RIGHT1 0x0201 /* Hamoa ADC Right, 1st or 48kHz only */
1240#define EMU_SRC_HAMOA_ADC_RIGHT2 0x0203 /* Hamoa ADC Right, 2nd or 96kHz */
1241#define EMU_SRC_HAMOA_ADC_RIGHT3 0x0205 /* Hamoa ADC Right, 3rd or 192kHz */
1242#define EMU_SRC_HAMOA_ADC_RIGHT4 0x0207 /* Hamoa ADC Right, 4th or 192kHz */
1243#define EMU_SRC_ALICE_EMU32A 0x0300 /* Alice2 EMU32a 16 outputs. +0 to +0xf */
1244#define EMU_SRC_ALICE_EMU32B 0x0310 /* Alice2 EMU32b 16 outputs. +0 to +0xf */
1245#define EMU_SRC_HANA_ADAT 0x0400 /* Hana ADAT 8 channel in +0 to +7 */
1246#define EMU_SRC_HANA_SPDIF_LEFT1 0x0500 /* Hana SPDIF Left, 1st or 48kHz only */
1247#define EMU_SRC_HANA_SPDIF_LEFT2 0x0502 /* Hana SPDIF Left, 2nd or 96kHz */
1248#define EMU_SRC_HANA_SPDIF_RIGHT1 0x0501 /* Hana SPDIF Right, 1st or 48kHz only */
1249#define EMU_SRC_HANA_SPDIF_RIGHT2 0x0503 /* Hana SPDIF Right, 2nd or 96kHz */
1250/* 0x600 and 0x700 no used */
889 1251
890/* ------------------- STRUCTURES -------------------- */ 1252/* ------------------- STRUCTURES -------------------- */
891 1253
@@ -1063,7 +1425,7 @@ struct snd_emu_chip_details {
1063 unsigned char spdif_bug; /* Has Spdif phasing bug */ 1425 unsigned char spdif_bug; /* Has Spdif phasing bug */
1064 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */ 1426 unsigned char ac97_chip; /* Has an AC97 chip: 1 = mandatory, 2 = optional */
1065 unsigned char ecard; /* APS EEPROM */ 1427 unsigned char ecard; /* APS EEPROM */
1066 unsigned char emu1212m; /* EMU 1212m card */ 1428 unsigned char emu1010; /* EMU 1010m card */
1067 unsigned char spi_dac; /* SPI interface for DAC */ 1429 unsigned char spi_dac; /* SPI interface for DAC */
1068 unsigned char i2c_adc; /* I2C interface for ADC */ 1430 unsigned char i2c_adc; /* I2C interface for ADC */
1069 unsigned char adc_1361t; /* Use Philips 1361T ADC */ 1431 unsigned char adc_1361t; /* Use Philips 1361T ADC */
@@ -1072,6 +1434,14 @@ struct snd_emu_chip_details {
1072 const char *id; /* for backward compatibility - can be NULL if not needed */ 1434 const char *id; /* for backward compatibility - can be NULL if not needed */
1073}; 1435};
1074 1436
1437struct snd_emu1010 {
1438 unsigned int output_source[64];
1439 unsigned int input_source[64];
1440 unsigned int adc_pads; /* bit mask */
1441 unsigned int dac_pads; /* bit mask */
1442 unsigned int internal_clock; /* 44100 or 48000 */
1443};
1444
1075struct snd_emu10k1 { 1445struct snd_emu10k1 {
1076 int irq; 1446 int irq;
1077 1447
@@ -1079,6 +1449,7 @@ struct snd_emu10k1 {
1079 unsigned int tos_link: 1, /* tos link detected */ 1449 unsigned int tos_link: 1, /* tos link detected */
1080 rear_ac97: 1, /* rear channels are on AC'97 */ 1450 rear_ac97: 1, /* rear channels are on AC'97 */
1081 enable_ir: 1; 1451 enable_ir: 1;
1452 unsigned int support_tlv :1;
1082 /* Contains profile of card capabilities */ 1453 /* Contains profile of card capabilities */
1083 const struct snd_emu_chip_details *card_capabilities; 1454 const struct snd_emu_chip_details *card_capabilities;
1084 unsigned int audigy; /* is Audigy? */ 1455 unsigned int audigy; /* is Audigy? */
@@ -1104,6 +1475,8 @@ struct snd_emu10k1 {
1104 spinlock_t memblk_lock; 1475 spinlock_t memblk_lock;
1105 1476
1106 unsigned int spdif_bits[3]; /* s/pdif out setup */ 1477 unsigned int spdif_bits[3]; /* s/pdif out setup */
1478 unsigned int i2c_capture_source;
1479 u8 i2c_capture_volume[4][2];
1107 1480
1108 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */ 1481 struct snd_emu10k1_fx8010 fx8010; /* FX8010 info */
1109 int gpr_base; 1482 int gpr_base;
@@ -1132,6 +1505,7 @@ struct snd_emu10k1 {
1132 int p16v_device_offset; 1505 int p16v_device_offset;
1133 u32 p16v_capture_source; 1506 u32 p16v_capture_source;
1134 u32 p16v_capture_channel; 1507 u32 p16v_capture_channel;
1508 struct snd_emu1010 emu1010;
1135 struct snd_emu10k1_pcm_mixer pcm_mixer[32]; 1509 struct snd_emu10k1_pcm_mixer pcm_mixer[32];
1136 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK]; 1510 struct snd_emu10k1_pcm_mixer efx_pcm_mixer[NUM_EFX_PLAYBACK];
1137 struct snd_kcontrol *ctl_send_routing; 1511 struct snd_kcontrol *ctl_send_routing;
@@ -1208,6 +1582,10 @@ void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned i
1208unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn); 1582unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn);
1209void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); 1583void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data);
1210int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data); 1584int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data);
1585int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value);
1586int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, int reg, int value);
1587int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, int reg, int *value);
1588int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, int dst, int src);
1211unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc); 1589unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc);
1212void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb); 1590void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb);
1213void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb); 1591void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb);
@@ -1524,11 +1902,20 @@ struct snd_emu10k1_fx8010_control_gpr {
1524 unsigned int value[32]; /* initial values */ 1902 unsigned int value[32]; /* initial values */
1525 unsigned int min; /* minimum range */ 1903 unsigned int min; /* minimum range */
1526 unsigned int max; /* maximum range */ 1904 unsigned int max; /* maximum range */
1527 union {
1528 snd_kcontrol_tlv_rw_t *c;
1529 unsigned int *p;
1530 } tlv;
1531 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */ 1905 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
1906 const unsigned int *tlv;
1907};
1908
1909/* old ABI without TLV support */
1910struct snd_emu10k1_fx8010_control_old_gpr {
1911 struct snd_ctl_elem_id id;
1912 unsigned int vcount;
1913 unsigned int count;
1914 unsigned short gpr[32];
1915 unsigned int value[32];
1916 unsigned int min;
1917 unsigned int max;
1918 unsigned int translation;
1532}; 1919};
1533 1920
1534struct snd_emu10k1_fx8010_code { 1921struct snd_emu10k1_fx8010_code {
@@ -1579,6 +1966,8 @@ struct snd_emu10k1_fx8010_pcm_rec {
1579 unsigned int res2; /* reserved */ 1966 unsigned int res2; /* reserved */
1580}; 1967};
1581 1968
1969#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
1970
1582#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info) 1971#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
1583#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code) 1972#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
1584#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code) 1973#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
@@ -1587,6 +1976,7 @@ struct snd_emu10k1_fx8010_pcm_rec {
1587#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram) 1976#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
1588#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec) 1977#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
1589#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec) 1978#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
1979#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
1590#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80) 1980#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
1591#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81) 1981#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
1592#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82) 1982#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 2f645dfd7f70..deff5a92efa6 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -56,6 +56,8 @@ struct snd_pcm_hardware {
56 size_t fifo_size; /* fifo size in bytes */ 56 size_t fifo_size; /* fifo size in bytes */
57}; 57};
58 58
59struct snd_pcm_substream;
60
59struct snd_pcm_ops { 61struct snd_pcm_ops {
60 int (*open)(struct snd_pcm_substream *substream); 62 int (*open)(struct snd_pcm_substream *substream);
61 int (*close)(struct snd_pcm_substream *substream); 63 int (*close)(struct snd_pcm_substream *substream);
@@ -384,6 +386,7 @@ struct snd_pcm_substream {
384 struct snd_info_entry *proc_sw_params_entry; 386 struct snd_info_entry *proc_sw_params_entry;
385 struct snd_info_entry *proc_status_entry; 387 struct snd_info_entry *proc_status_entry;
386 struct snd_info_entry *proc_prealloc_entry; 388 struct snd_info_entry *proc_prealloc_entry;
389 struct snd_info_entry *proc_prealloc_max_entry;
387#endif 390#endif
388 /* misc flags */ 391 /* misc flags */
389 unsigned int hw_opened: 1; 392 unsigned int hw_opened: 1;
@@ -427,6 +430,7 @@ struct snd_pcm {
427 wait_queue_head_t open_wait; 430 wait_queue_head_t open_wait;
428 void *private_data; 431 void *private_data;
429 void (*private_free) (struct snd_pcm *pcm); 432 void (*private_free) (struct snd_pcm *pcm);
433 struct device *dev; /* actual hw device this belongs to */
430#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 434#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
431 struct snd_pcm_oss oss; 435 struct snd_pcm_oss oss;
432#endif 436#endif
@@ -443,7 +447,7 @@ struct snd_pcm_notify {
443 * Registering 447 * Registering
444 */ 448 */
445 449
446extern struct file_operations snd_pcm_f_ops[2]; 450extern const struct file_operations snd_pcm_f_ops[2];
447 451
448int snd_pcm_new(struct snd_card *card, char *id, int device, 452int snd_pcm_new(struct snd_card *card, char *id, int device,
449 int playback_count, int capture_count, 453 int playback_count, int capture_count,
diff --git a/include/sound/pt2258.h b/include/sound/pt2258.h
new file mode 100644
index 000000000000..160f812faa42
--- /dev/null
+++ b/include/sound/pt2258.h
@@ -0,0 +1,37 @@
1/*
2 * ALSA Driver for the PT2258 volume controller.
3 *
4 * Copyright (c) 2006 Jochen Voss <voss@seehuhn.de>
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
22#ifndef __SOUND_PT2258_H
23#define __SOUND_PT2258_H
24
25struct snd_pt2258 {
26 struct snd_card *card;
27 struct snd_i2c_bus *i2c_bus;
28 struct snd_i2c_device *i2c_dev;
29
30 unsigned char volume[6];
31 int mute;
32};
33
34extern int snd_pt2258_reset(struct snd_pt2258 *pt);
35extern int snd_pt2258_build_controls(struct snd_pt2258 *pt);
36
37#endif /* __SOUND_PT2258_H */
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index caf6fe21514d..736eac71d053 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -114,9 +114,21 @@ struct snd_sb_csp_info {
114#ifdef __KERNEL__ 114#ifdef __KERNEL__
115#include "sb.h" 115#include "sb.h"
116#include "hwdep.h" 116#include "hwdep.h"
117#include <linux/firmware.h>
117 118
118struct snd_sb_csp; 119struct snd_sb_csp;
119 120
121/* indices for the known CSP programs */
122enum {
123 CSP_PROGRAM_MULAW,
124 CSP_PROGRAM_ALAW,
125 CSP_PROGRAM_ADPCM_INIT,
126 CSP_PROGRAM_ADPCM_PLAYBACK,
127 CSP_PROGRAM_ADPCM_CAPTURE,
128
129 CSP_PROGRAM_COUNT
130};
131
120/* 132/*
121 * CSP operators 133 * CSP operators
122 */ 134 */
@@ -159,6 +171,8 @@ struct snd_sb_csp {
159 struct snd_kcontrol *qsound_space; 171 struct snd_kcontrol *qsound_space;
160 172
161 struct mutex access_mutex; /* locking */ 173 struct mutex access_mutex; /* locking */
174
175 const struct firmware *csp_programs[CSP_PROGRAM_COUNT];
162}; 176};
163 177
164int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); 178int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 0b9e5de94ff1..9688d4be918e 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -85,6 +85,7 @@ struct _snd_wavefront {
85 char hw_version[2]; /* major = [0], minor = [1] */ 85 char hw_version[2]; /* major = [0], minor = [1] */
86 char israw; /* needs Motorola microcode */ 86 char israw; /* needs Motorola microcode */
87 char has_fx; /* has FX processor (Tropez+) */ 87 char has_fx; /* has FX processor (Tropez+) */
88 char fx_initialized; /* FX's register pages initialized */
88 char prog_status[WF_MAX_PROGRAM]; /* WF_SLOT_* */ 89 char prog_status[WF_MAX_PROGRAM]; /* WF_SLOT_* */
89 char patch_status[WF_MAX_PATCH]; /* WF_SLOT_* */ 90 char patch_status[WF_MAX_PATCH]; /* WF_SLOT_* */
90 char sample_status[WF_MAX_SAMPLE]; /* WF_ST_* | WF_SLOT_* */ 91 char sample_status[WF_MAX_SAMPLE]; /* WF_ST_* | WF_SLOT_* */
@@ -94,6 +95,7 @@ struct _snd_wavefront {
94 spinlock_t irq_lock; 95 spinlock_t irq_lock;
95 wait_queue_head_t interrupt_sleeper; 96 wait_queue_head_t interrupt_sleeper;
96 snd_wavefront_midi_t midi; /* ICS2115 MIDI interface */ 97 snd_wavefront_midi_t midi; /* ICS2115 MIDI interface */
98 struct snd_card *card;
97}; 99};
98 100
99struct _snd_wavefront_card { 101struct _snd_wavefront_card {
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
new file mode 100644
index 000000000000..2b1ae8edc43c
--- /dev/null
+++ b/include/sound/soc-dapm.h
@@ -0,0 +1,286 @@
1/*
2 * linux/sound/soc-dapm.h -- ALSA SoC Dynamic Audio Power Management
3 *
4 * Author: Liam Girdwood
5 * Created: Aug 11th 2005
6 * Copyright: Wolfson Microelectronics. PLC.
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#ifndef __LINUX_SND_SOC_DAPM_H
14#define __LINUX_SND_SOC_DAPM_H
15
16#include <linux/device.h>
17#include <linux/types.h>
18#include <sound/control.h>
19#include <sound/soc.h>
20
21/* widget has no PM register bit */
22#define SND_SOC_NOPM -1
23
24/*
25 * SoC dynamic audio power managment
26 *
27 * We can have upto 4 power domains
28 * 1. Codec domain - VREF, VMID
29 * Usually controlled at codec probe/remove, although can be set
30 * at stream time if power is not needed for sidetone, etc.
31 * 2. Platform/Machine domain - physically connected inputs and outputs
32 * Is platform/machine and user action specific, is set in the machine
33 * driver and by userspace e.g when HP are inserted
34 * 3. Path domain - Internal codec path mixers
35 * Are automatically set when mixer and mux settings are
36 * changed by the user.
37 * 4. Stream domain - DAC's and ADC's.
38 * Enabled when stream playback/capture is started.
39 */
40
41/* codec domain */
42#define SND_SOC_DAPM_VMID(wname) \
43{ .id = snd_soc_dapm_vmid, .name = wname, .kcontrols = NULL, \
44 .num_kcontrols = 0}
45
46/* platform domain */
47#define SND_SOC_DAPM_INPUT(wname) \
48{ .id = snd_soc_dapm_input, .name = wname, .kcontrols = NULL, \
49 .num_kcontrols = 0}
50#define SND_SOC_DAPM_OUTPUT(wname) \
51{ .id = snd_soc_dapm_output, .name = wname, .kcontrols = NULL, \
52 .num_kcontrols = 0}
53#define SND_SOC_DAPM_MIC(wname, wevent) \
54{ .id = snd_soc_dapm_mic, .name = wname, .kcontrols = NULL, \
55 .num_kcontrols = 0, .event = wevent, \
56 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
57#define SND_SOC_DAPM_HP(wname, wevent) \
58{ .id = snd_soc_dapm_hp, .name = wname, .kcontrols = NULL, \
59 .num_kcontrols = 0, .event = wevent, \
60 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
61#define SND_SOC_DAPM_SPK(wname, wevent) \
62{ .id = snd_soc_dapm_spk, .name = wname, .kcontrols = NULL, \
63 .num_kcontrols = 0, .event = wevent, \
64 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
65#define SND_SOC_DAPM_LINE(wname, wevent) \
66{ .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \
67 .num_kcontrols = 0, .event = wevent, \
68 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
69
70/* path domain */
71#define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\
72 wcontrols, wncontrols) \
73{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
74 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
75#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
76 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
78 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
79#define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
80{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
81 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
82#define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \
83{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
84 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
85#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
86{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
87 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
88
89/* path domain with event - event handler must return 0 for success */
90#define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \
91 wncontrols, wevent, wflags) \
92{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
93 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
94 .event = wevent, .event_flags = wflags}
95#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
96 wncontrols, wevent, wflags) \
97{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
98 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
99 .event = wevent, .event_flags = wflags}
100#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
101{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
102 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \
103 .event = wevent, .event_flags = wflags}
104#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
105 wevent, wflags) \
106{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
107 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1 \
108 .event = wevent, .event_flags = wflags}
109#define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
110 wevent, wflags) \
111{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
112 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
113 .event = wevent, .event_flags = wflags}
114
115/* events that are pre and post DAPM */
116#define SND_SOC_DAPM_PRE(wname, wevent) \
117{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \
118 .num_kcontrols = 0, .event = wevent, \
119 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD}
120#define SND_SOC_DAPM_POST(wname, wevent) \
121{ .id = snd_soc_dapm_post, .name = wname, .kcontrols = NULL, \
122 .num_kcontrols = 0, .event = wevent, \
123 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
124
125/* stream domain */
126#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
127{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
128 .shift = wshift, .invert = winvert}
129#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
130{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
131 .shift = wshift, .invert = winvert}
132
133/* dapm kcontrol types */
134#define SOC_DAPM_SINGLE(xname, reg, shift, mask, invert) \
135{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
136 .info = snd_soc_info_volsw, \
137 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
138 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) }
139#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, mask, invert, \
140 power) \
141{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
142 .info = snd_soc_info_volsw, \
143 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
144 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
145 ((mask) << 16) | ((invert) << 24) }
146#define SOC_DAPM_ENUM(xname, xenum) \
147{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
148 .info = snd_soc_info_enum_double, \
149 .get = snd_soc_dapm_get_enum_double, \
150 .put = snd_soc_dapm_put_enum_double, \
151 .private_value = (unsigned long)&xenum }
152
153/* dapm stream operations */
154#define SND_SOC_DAPM_STREAM_NOP 0x0
155#define SND_SOC_DAPM_STREAM_START 0x1
156#define SND_SOC_DAPM_STREAM_STOP 0x2
157#define SND_SOC_DAPM_STREAM_SUSPEND 0x4
158#define SND_SOC_DAPM_STREAM_RESUME 0x8
159#define SND_SOC_DAPM_STREAM_PAUSE_PUSH 0x10
160#define SND_SOC_DAPM_STREAM_PAUSE_RELEASE 0x20
161
162/* dapm event types */
163#define SND_SOC_DAPM_PRE_PMU 0x1 /* before widget power up */
164#define SND_SOC_DAPM_POST_PMU 0x2 /* after widget power up */
165#define SND_SOC_DAPM_PRE_PMD 0x4 /* before widget power down */
166#define SND_SOC_DAPM_POST_PMD 0x8 /* after widget power down */
167#define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */
168#define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */
169
170/* convenience event type detection */
171#define SND_SOC_DAPM_EVENT_ON(e) \
172 (e & (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU))
173#define SND_SOC_DAPM_EVENT_OFF(e) \
174 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
175
176struct snd_soc_dapm_widget;
177enum snd_soc_dapm_type;
178struct snd_soc_dapm_path;
179struct snd_soc_dapm_pin;
180
181/* dapm controls */
182int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
183 struct snd_ctl_elem_value *ucontrol);
184int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
185 struct snd_ctl_elem_value *ucontrol);
186int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
187 struct snd_ctl_elem_value *ucontrol);
188int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
189 struct snd_ctl_elem_value *ucontrol);
190int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
191 const struct snd_soc_dapm_widget *widget);
192
193/* dapm path setup */
194int snd_soc_dapm_connect_input(struct snd_soc_codec *codec,
195 const char *sink_name, const char *control_name, const char *src_name);
196int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
197void snd_soc_dapm_free(struct snd_soc_device *socdev);
198
199/* dapm events */
200int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
201 int event);
202
203/* dapm sys fs - used by the core */
204int snd_soc_dapm_sys_add(struct device *dev);
205
206/* dapm audio endpoint control */
207int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
208 char *pin, int status);
209int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec);
210
211/* dapm widget types */
212enum snd_soc_dapm_type {
213 snd_soc_dapm_input = 0, /* input pin */
214 snd_soc_dapm_output, /* output pin */
215 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
216 snd_soc_dapm_mixer, /* mixes several analog signals together */
217 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
218 snd_soc_dapm_adc, /* analog to digital converter */
219 snd_soc_dapm_dac, /* digital to analog converter */
220 snd_soc_dapm_micbias, /* microphone bias (power) */
221 snd_soc_dapm_mic, /* microphone */
222 snd_soc_dapm_hp, /* headphones */
223 snd_soc_dapm_spk, /* speaker */
224 snd_soc_dapm_line, /* line input/output */
225 snd_soc_dapm_switch, /* analog switch */
226 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */
227 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
228 snd_soc_dapm_post, /* machine specific post widget - exec last */
229};
230
231/* dapm audio path between two widgets */
232struct snd_soc_dapm_path {
233 char *name;
234 char *long_name;
235
236 /* source (input) and sink (output) widgets */
237 struct snd_soc_dapm_widget *source;
238 struct snd_soc_dapm_widget *sink;
239 struct snd_kcontrol *kcontrol;
240
241 /* status */
242 u32 connect:1; /* source and sink widgets are connected */
243 u32 walked:1; /* path has been walked */
244
245 struct list_head list_source;
246 struct list_head list_sink;
247 struct list_head list;
248};
249
250/* dapm widget */
251struct snd_soc_dapm_widget {
252 enum snd_soc_dapm_type id;
253 char *name; /* widget name */
254 char *sname; /* stream name */
255 struct snd_soc_codec *codec;
256 struct list_head list;
257
258 /* dapm control */
259 short reg; /* negative reg = no direct dapm */
260 unsigned char shift; /* bits to shift */
261 unsigned int saved_value; /* widget saved value */
262 unsigned int value; /* widget current value */
263 unsigned char power:1; /* block power status */
264 unsigned char invert:1; /* invert the power bit */
265 unsigned char active:1; /* active stream on DAC, ADC's */
266 unsigned char connected:1; /* connected codec pin */
267 unsigned char new:1; /* cnew complete */
268 unsigned char ext:1; /* has external widgets */
269 unsigned char muted:1; /* muted for pop reduction */
270 unsigned char suspend:1; /* was active before suspend */
271 unsigned char pmdown:1; /* waiting for timeout */
272
273 /* external events */
274 unsigned short event_flags; /* flags to specify event types */
275 int (*event)(struct snd_soc_dapm_widget*, int);
276
277 /* kcontrols that relate to this widget */
278 int num_kcontrols;
279 const struct snd_kcontrol_new *kcontrols;
280
281 /* widget input and outputs */
282 struct list_head sources;
283 struct list_head sinks;
284};
285
286#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
new file mode 100644
index 000000000000..b1dc364b8f74
--- /dev/null
+++ b/include/sound/soc.h
@@ -0,0 +1,461 @@
1/*
2 * linux/sound/soc.h -- ALSA SoC Layer
3 *
4 * Author: Liam Girdwood
5 * Created: Aug 11th 2005
6 * Copyright: Wolfson Microelectronics. PLC.
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#ifndef __LINUX_SND_SOC_H
14#define __LINUX_SND_SOC_H
15
16#include <linux/platform_device.h>
17#include <linux/types.h>
18#include <linux/workqueue.h>
19#include <sound/driver.h>
20#include <sound/core.h>
21#include <sound/pcm.h>
22#include <sound/control.h>
23#include <sound/ac97_codec.h>
24
25#define SND_SOC_VERSION "0.13.0"
26
27/*
28 * Convenience kcontrol builders
29 */
30#define SOC_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) |\
31 ((shift) << 12) | ((mask) << 16) | ((invert) << 24))
32#define SOC_SINGLE_VALUE_EXT(reg,mask,invert) ((reg) | ((mask) << 16) |\
33 ((invert) << 31))
34#define SOC_SINGLE(xname, reg, shift, mask, invert) \
35{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
36 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
37 .put = snd_soc_put_volsw, \
38 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) }
39#define SOC_DOUBLE(xname, reg, shift_left, shift_right, mask, invert) \
40{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
41 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
42 .put = snd_soc_put_volsw, \
43 .private_value = (reg) | ((shift_left) << 8) | \
44 ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) }
45#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, mask, invert) \
46{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
47 .info = snd_soc_info_volsw_2r, \
48 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
49 .private_value = (reg_left) | ((shift) << 8) | \
50 ((mask) << 12) | ((invert) << 20) | ((reg_right) << 24) }
51#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
52{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
53 .mask = xmask, .texts = xtexts }
54#define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \
55 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts)
56#define SOC_ENUM_SINGLE_EXT(xmask, xtexts) \
57{ .mask = xmask, .texts = xtexts }
58#define SOC_ENUM(xname, xenum) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
60 .info = snd_soc_info_enum_double, \
61 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
62 .private_value = (unsigned long)&xenum }
63#define SOC_SINGLE_EXT(xname, xreg, xshift, xmask, xinvert,\
64 xhandler_get, xhandler_put) \
65{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
66 .info = snd_soc_info_volsw, \
67 .get = xhandler_get, .put = xhandler_put, \
68 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) }
69#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
70{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
71 .info = snd_soc_info_bool_ext, \
72 .get = xhandler_get, .put = xhandler_put, \
73 .private_value = xdata }
74#define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
75{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
76 .info = snd_soc_info_enum_ext, \
77 .get = xhandler_get, .put = xhandler_put, \
78 .private_value = (unsigned long)&xenum }
79
80/*
81 * Digital Audio Interface (DAI) types
82 */
83#define SND_SOC_DAI_AC97 0x1
84#define SND_SOC_DAI_I2S 0x2
85#define SND_SOC_DAI_PCM 0x4
86
87/*
88 * DAI hardware audio formats
89 */
90#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */
91#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right justified mode */
92#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */
93#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM or LRC */
94#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM or LRC */
95#define SND_SOC_DAIFMT_AC97 5 /* AC97 */
96
97#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J
98#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J
99
100/*
101 * DAI Gating
102 */
103#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */
104#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
105
106/*
107 * DAI hardware signal inversions
108 */
109#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */
110#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
111#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
112#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
113
114/*
115 * DAI hardware clock masters
116 * This is wrt the codec, the inverse is true for the interface
117 * i.e. if the codec is clk and frm master then the interface is
118 * clk and frame slave.
119 */
120#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */
121#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */
122#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */
123#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */
124
125#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f
126#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0
127#define SND_SOC_DAIFMT_INV_MASK 0x0f00
128#define SND_SOC_DAIFMT_MASTER_MASK 0xf000
129
130
131/*
132 * Master Clock Directions
133 */
134#define SND_SOC_CLOCK_IN 0
135#define SND_SOC_CLOCK_OUT 1
136
137/*
138 * AC97 codec ID's bitmask
139 */
140#define SND_SOC_DAI_AC97_ID0 (1 << 0)
141#define SND_SOC_DAI_AC97_ID1 (1 << 1)
142#define SND_SOC_DAI_AC97_ID2 (1 << 2)
143#define SND_SOC_DAI_AC97_ID3 (1 << 3)
144
145struct snd_soc_device;
146struct snd_soc_pcm_stream;
147struct snd_soc_ops;
148struct snd_soc_dai_mode;
149struct snd_soc_pcm_runtime;
150struct snd_soc_codec_dai;
151struct snd_soc_cpu_dai;
152struct snd_soc_codec;
153struct snd_soc_machine_config;
154struct soc_enum;
155struct snd_soc_ac97_ops;
156struct snd_soc_clock_info;
157
158typedef int (*hw_write_t)(void *,const char* ,int);
159typedef int (*hw_read_t)(void *,char* ,int);
160
161extern struct snd_ac97_bus_ops soc_ac97_ops;
162
163/* pcm <-> DAI connect */
164void snd_soc_free_pcms(struct snd_soc_device *socdev);
165int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
166int snd_soc_register_card(struct snd_soc_device *socdev);
167
168/* set runtime hw params */
169int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
170 const struct snd_pcm_hardware *hw);
171
172/* codec IO */
173#define snd_soc_read(codec, reg) codec->read(codec, reg)
174#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
175
176/* codec register bit access */
177int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
178 unsigned short mask, unsigned short value);
179int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
180 unsigned short mask, unsigned short value);
181
182int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
183 struct snd_ac97_bus_ops *ops, int num);
184void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
185
186/*
187 *Controls
188 */
189struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
190 void *data, char *long_name);
191int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
192 struct snd_ctl_elem_info *uinfo);
193int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
194 struct snd_ctl_elem_info *uinfo);
195int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
196 struct snd_ctl_elem_value *ucontrol);
197int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
198 struct snd_ctl_elem_value *ucontrol);
199int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
200 struct snd_ctl_elem_info *uinfo);
201int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
202 struct snd_ctl_elem_info *uinfo);
203int snd_soc_info_bool_ext(struct snd_kcontrol *kcontrol,
204 struct snd_ctl_elem_info *uinfo);
205int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
206 struct snd_ctl_elem_value *ucontrol);
207int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
208 struct snd_ctl_elem_value *ucontrol);
209int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
210 struct snd_ctl_elem_info *uinfo);
211int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
212 struct snd_ctl_elem_value *ucontrol);
213int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
214 struct snd_ctl_elem_value *ucontrol);
215
216/* SoC PCM stream information */
217struct snd_soc_pcm_stream {
218 char *stream_name;
219 u64 formats; /* SNDRV_PCM_FMTBIT_* */
220 unsigned int rates; /* SNDRV_PCM_RATE_* */
221 unsigned int rate_min; /* min rate */
222 unsigned int rate_max; /* max rate */
223 unsigned int channels_min; /* min channels */
224 unsigned int channels_max; /* max channels */
225 unsigned int active:1; /* stream is in use */
226};
227
228/* SoC audio ops */
229struct snd_soc_ops {
230 int (*startup)(struct snd_pcm_substream *);
231 void (*shutdown)(struct snd_pcm_substream *);
232 int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
233 int (*hw_free)(struct snd_pcm_substream *);
234 int (*prepare)(struct snd_pcm_substream *);
235 int (*trigger)(struct snd_pcm_substream *, int);
236};
237
238/* ASoC codec DAI ops */
239struct snd_soc_codec_ops {
240 /* codec DAI clocking configuration */
241 int (*set_sysclk)(struct snd_soc_codec_dai *codec_dai,
242 int clk_id, unsigned int freq, int dir);
243 int (*set_pll)(struct snd_soc_codec_dai *codec_dai,
244 int pll_id, unsigned int freq_in, unsigned int freq_out);
245 int (*set_clkdiv)(struct snd_soc_codec_dai *codec_dai,
246 int div_id, int div);
247
248 /* CPU DAI format configuration */
249 int (*set_fmt)(struct snd_soc_codec_dai *codec_dai,
250 unsigned int fmt);
251 int (*set_tdm_slot)(struct snd_soc_codec_dai *codec_dai,
252 unsigned int mask, int slots);
253 int (*set_tristate)(struct snd_soc_codec_dai *, int tristate);
254
255 /* digital mute */
256 int (*digital_mute)(struct snd_soc_codec_dai *, int mute);
257};
258
259/* ASoC cpu DAI ops */
260struct snd_soc_cpu_ops {
261 /* CPU DAI clocking configuration */
262 int (*set_sysclk)(struct snd_soc_cpu_dai *cpu_dai,
263 int clk_id, unsigned int freq, int dir);
264 int (*set_clkdiv)(struct snd_soc_cpu_dai *cpu_dai,
265 int div_id, int div);
266 int (*set_pll)(struct snd_soc_cpu_dai *cpu_dai,
267 int pll_id, unsigned int freq_in, unsigned int freq_out);
268
269 /* CPU DAI format configuration */
270 int (*set_fmt)(struct snd_soc_cpu_dai *cpu_dai,
271 unsigned int fmt);
272 int (*set_tdm_slot)(struct snd_soc_cpu_dai *cpu_dai,
273 unsigned int mask, int slots);
274 int (*set_tristate)(struct snd_soc_cpu_dai *, int tristate);
275};
276
277/* SoC Codec DAI */
278struct snd_soc_codec_dai {
279 char *name;
280 int id;
281
282 /* DAI capabilities */
283 struct snd_soc_pcm_stream playback;
284 struct snd_soc_pcm_stream capture;
285
286 /* DAI runtime info */
287 struct snd_soc_codec *codec;
288 unsigned int active;
289 unsigned char pop_wait:1;
290
291 /* ops */
292 struct snd_soc_ops ops;
293 struct snd_soc_codec_ops dai_ops;
294
295 /* DAI private data */
296 void *private_data;
297};
298
299/* SoC CPU DAI */
300struct snd_soc_cpu_dai {
301
302 /* DAI description */
303 char *name;
304 unsigned int id;
305 unsigned char type;
306
307 /* DAI callbacks */
308 int (*probe)(struct platform_device *pdev);
309 void (*remove)(struct platform_device *pdev);
310 int (*suspend)(struct platform_device *pdev,
311 struct snd_soc_cpu_dai *cpu_dai);
312 int (*resume)(struct platform_device *pdev,
313 struct snd_soc_cpu_dai *cpu_dai);
314
315 /* ops */
316 struct snd_soc_ops ops;
317 struct snd_soc_cpu_ops dai_ops;
318
319 /* DAI capabilities */
320 struct snd_soc_pcm_stream capture;
321 struct snd_soc_pcm_stream playback;
322
323 /* DAI runtime info */
324 struct snd_pcm_runtime *runtime;
325 unsigned char active:1;
326 void *dma_data;
327
328 /* DAI private data */
329 void *private_data;
330};
331
332/* SoC Audio Codec */
333struct snd_soc_codec {
334 char *name;
335 struct module *owner;
336 struct mutex mutex;
337
338 /* callbacks */
339 int (*dapm_event)(struct snd_soc_codec *codec, int event);
340
341 /* runtime */
342 struct snd_card *card;
343 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
344 unsigned int active;
345 unsigned int pcm_devs;
346 void *private_data;
347
348 /* codec IO */
349 void *control_data; /* codec control (i2c/3wire) data */
350 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
351 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
352 hw_write_t hw_write;
353 hw_read_t hw_read;
354 void *reg_cache;
355 short reg_cache_size;
356 short reg_cache_step;
357
358 /* dapm */
359 struct list_head dapm_widgets;
360 struct list_head dapm_paths;
361 unsigned int dapm_state;
362 unsigned int suspend_dapm_state;
363 struct delayed_work delayed_work;
364
365 /* codec DAI's */
366 struct snd_soc_codec_dai *dai;
367 unsigned int num_dai;
368};
369
370/* codec device */
371struct snd_soc_codec_device {
372 int (*probe)(struct platform_device *pdev);
373 int (*remove)(struct platform_device *pdev);
374 int (*suspend)(struct platform_device *pdev, pm_message_t state);
375 int (*resume)(struct platform_device *pdev);
376};
377
378/* SoC platform interface */
379struct snd_soc_platform {
380 char *name;
381
382 int (*probe)(struct platform_device *pdev);
383 int (*remove)(struct platform_device *pdev);
384 int (*suspend)(struct platform_device *pdev,
385 struct snd_soc_cpu_dai *cpu_dai);
386 int (*resume)(struct platform_device *pdev,
387 struct snd_soc_cpu_dai *cpu_dai);
388
389 /* pcm creation and destruction */
390 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *,
391 struct snd_pcm *);
392 void (*pcm_free)(struct snd_pcm *);
393
394 /* platform stream ops */
395 struct snd_pcm_ops *pcm_ops;
396};
397
398/* SoC machine DAI configuration, glues a codec and cpu DAI together */
399struct snd_soc_dai_link {
400 char *name; /* Codec name */
401 char *stream_name; /* Stream name */
402
403 /* DAI */
404 struct snd_soc_codec_dai *codec_dai;
405 struct snd_soc_cpu_dai *cpu_dai;
406
407 /* machine stream operations */
408 struct snd_soc_ops *ops;
409
410 /* codec/machine specific init - e.g. add machine controls */
411 int (*init)(struct snd_soc_codec *codec);
412};
413
414/* SoC machine */
415struct snd_soc_machine {
416 char *name;
417
418 int (*probe)(struct platform_device *pdev);
419 int (*remove)(struct platform_device *pdev);
420
421 /* the pre and post PM functions are used to do any PM work before and
422 * after the codec and DAI's do any PM work. */
423 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
424 int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
425 int (*resume_pre)(struct platform_device *pdev);
426 int (*resume_post)(struct platform_device *pdev);
427
428 /* CPU <--> Codec DAI links */
429 struct snd_soc_dai_link *dai_link;
430 int num_links;
431};
432
433/* SoC Device - the audio subsystem */
434struct snd_soc_device {
435 struct device *dev;
436 struct snd_soc_machine *machine;
437 struct snd_soc_platform *platform;
438 struct snd_soc_codec *codec;
439 struct snd_soc_codec_device *codec_dev;
440 struct delayed_work delayed_work;
441 void *codec_data;
442};
443
444/* runtime channel data */
445struct snd_soc_pcm_runtime {
446 struct snd_soc_dai_link *dai;
447 struct snd_soc_device *socdev;
448};
449
450/* enumerated kcontrol */
451struct soc_enum {
452 unsigned short reg;
453 unsigned short reg2;
454 unsigned char shift_l;
455 unsigned char shift_r;
456 unsigned int mask;
457 const char **texts;
458 void *dapm;
459};
460
461#endif
diff --git a/include/sound/typedefs.h b/include/sound/typedefs.h
deleted file mode 100644
index f454b0206b93..000000000000
--- a/include/sound/typedefs.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * Typedef's for backward compatibility (for out-of-kernel drivers)
3 *
4 * This file will be removed soon in future
5 */
6
7/* core stuff */
8typedef struct snd_card snd_card_t;
9typedef struct snd_device snd_device_t;
10typedef struct snd_device_ops snd_device_ops_t;
11typedef enum snd_card_type snd_card_type_t;
12typedef struct snd_minor snd_minor_t;
13
14/* info */
15typedef struct snd_info_entry snd_info_entry_t;
16typedef struct snd_info_buffer snd_info_buffer_t;
17
18/* control */
19typedef struct snd_ctl_file snd_ctl_file_t;
20typedef struct snd_kcontrol snd_kcontrol_t;
21typedef struct snd_kcontrol_new snd_kcontrol_new_t;
22typedef struct snd_kcontrol_volatile snd_kcontrol_volatile_t;
23typedef struct snd_kctl_event snd_kctl_event_t;
24typedef struct snd_aes_iec958 snd_aes_iec958_t;
25typedef struct snd_ctl_card_info snd_ctl_card_info_t;
26typedef struct snd_ctl_elem_id snd_ctl_elem_id_t;
27typedef struct snd_ctl_elem_list snd_ctl_elem_list_t;
28typedef struct snd_ctl_elem_info snd_ctl_elem_info_t;
29typedef struct snd_ctl_elem_value snd_ctl_elem_value_t;
30typedef struct snd_ctl_event snd_ctl_event_t;
31#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
32typedef struct snd_mixer_oss snd_mixer_oss_t;
33#endif
34
35/* timer */
36typedef struct snd_timer snd_timer_t;
37typedef struct snd_timer_instance snd_timer_instance_t;
38typedef struct snd_timer_id snd_timer_id_t;
39typedef struct snd_timer_ginfo snd_timer_ginfo_t;
40typedef struct snd_timer_gparams snd_timer_gparams_t;
41typedef struct snd_timer_gstatus snd_timer_gstatus_t;
42typedef struct snd_timer_select snd_timer_select_t;
43typedef struct snd_timer_info snd_timer_info_t;
44typedef struct snd_timer_params snd_timer_params_t;
45typedef struct snd_timer_status snd_timer_status_t;
46typedef struct snd_timer_read snd_timer_read_t;
47typedef struct snd_timer_tread snd_timer_tread_t;
48
49/* PCM */
50typedef struct snd_pcm snd_pcm_t;
51typedef struct snd_pcm_str snd_pcm_str_t;
52typedef struct snd_pcm_substream snd_pcm_substream_t;
53typedef struct snd_pcm_info snd_pcm_info_t;
54typedef struct snd_pcm_hw_params snd_pcm_hw_params_t;
55typedef struct snd_pcm_sw_params snd_pcm_sw_params_t;
56typedef struct snd_pcm_channel_info snd_pcm_channel_info_t;
57typedef struct snd_pcm_status snd_pcm_status_t;
58typedef struct snd_pcm_mmap_status snd_pcm_mmap_status_t;
59typedef struct snd_pcm_mmap_control snd_pcm_mmap_control_t;
60typedef struct snd_mask snd_mask_t;
61typedef struct snd_sg_buf snd_pcm_sgbuf_t;
62
63typedef struct snd_interval snd_interval_t;
64typedef struct snd_xferi snd_xferi_t;
65typedef struct snd_xfern snd_xfern_t;
66typedef struct snd_xferv snd_xferv_t;
67
68typedef struct snd_pcm_file snd_pcm_file_t;
69typedef struct snd_pcm_runtime snd_pcm_runtime_t;
70typedef struct snd_pcm_hardware snd_pcm_hardware_t;
71typedef struct snd_pcm_ops snd_pcm_ops_t;
72typedef struct snd_pcm_hw_rule snd_pcm_hw_rule_t;
73typedef struct snd_pcm_hw_constraints snd_pcm_hw_constraints_t;
74typedef struct snd_ratnum ratnum_t;
75typedef struct snd_ratden ratden_t;
76typedef struct snd_pcm_hw_constraint_ratnums snd_pcm_hw_constraint_ratnums_t;
77typedef struct snd_pcm_hw_constraint_ratdens snd_pcm_hw_constraint_ratdens_t;
78typedef struct snd_pcm_hw_constraint_list snd_pcm_hw_constraint_list_t;
79typedef struct snd_pcm_group snd_pcm_group_t;
80typedef struct snd_pcm_notify snd_pcm_notify_t;
81
82/* rawmidi */
83typedef struct snd_rawmidi snd_rawmidi_t;
84typedef struct snd_rawmidi_info snd_rawmidi_info_t;
85typedef struct snd_rawmidi_params snd_rawmidi_params_t;
86typedef struct snd_rawmidi_status snd_rawmidi_status_t;
87typedef struct snd_rawmidi_runtime snd_rawmidi_runtime_t;
88typedef struct snd_rawmidi_substream snd_rawmidi_substream_t;
89typedef struct snd_rawmidi_str snd_rawmidi_str_t;
90typedef struct snd_rawmidi_ops snd_rawmidi_ops_t;
91typedef struct snd_rawmidi_global_ops snd_rawmidi_global_ops_t;
92typedef struct snd_rawmidi_file snd_rawmidi_file_t;
93
94/* hwdep */
95typedef struct snd_hwdep snd_hwdep_t;
96typedef struct snd_hwdep_info snd_hwdep_info_t;
97typedef struct snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
98typedef struct snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
99typedef struct snd_hwdep_ops snd_hwdep_ops_t;
100
101/* sequencer */
102typedef struct snd_seq_port_info snd_seq_port_info_t;
103typedef struct snd_seq_port_subscribe snd_seq_port_subscribe_t;
104typedef struct snd_seq_event snd_seq_event_t;
105typedef struct snd_seq_addr snd_seq_addr_t;
106typedef struct snd_seq_ev_volume snd_seq_ev_volume_t;
107typedef struct snd_seq_ev_loop snd_seq_ev_loop_t;
108typedef struct snd_seq_remove_events snd_seq_remove_events_t;
109typedef struct snd_seq_query_subs snd_seq_query_subs_t;
110typedef struct snd_seq_system_info snd_seq_system_info_t;
111typedef struct snd_seq_client_info snd_seq_client_info_t;
112typedef struct snd_seq_queue_info snd_seq_queue_info_t;
113typedef struct snd_seq_queue_status snd_seq_queue_status_t;
114typedef struct snd_seq_queue_tempo snd_seq_queue_tempo_t;
115typedef struct snd_seq_queue_owner snd_seq_queue_owner_t;
116typedef struct snd_seq_queue_timer snd_seq_queue_timer_t;
117typedef struct snd_seq_queue_client snd_seq_queue_client_t;
118typedef struct snd_seq_client_pool snd_seq_client_pool_t;
119typedef struct snd_seq_instr snd_seq_instr_t;
120typedef struct snd_seq_instr_data snd_seq_instr_data_t;
121typedef struct snd_seq_instr_header snd_seq_instr_header_t;
122
123typedef struct snd_seq_user_client user_client_t;
124typedef struct snd_seq_kernel_client kernel_client_t;
125typedef struct snd_seq_client client_t;
126typedef struct snd_seq_queue queue_t;
127
128/* seq_device */
129typedef struct snd_seq_device snd_seq_device_t;
130typedef struct snd_seq_dev_ops snd_seq_dev_ops_t;
131
132/* seq_midi */
133typedef struct snd_midi_event snd_midi_event_t;
134
135/* seq_midi_emul */
136typedef struct snd_midi_channel snd_midi_channel_t;
137typedef struct snd_midi_channel_set snd_midi_channel_set_t;
138typedef struct snd_midi_op snd_midi_op_t;
139
140/* seq_oss */
141typedef struct snd_seq_oss_arg snd_seq_oss_arg_t;
142typedef struct snd_seq_oss_callback snd_seq_oss_callback_t;
143typedef struct snd_seq_oss_reg snd_seq_oss_reg_t;
144
145/* virmidi */
146typedef struct snd_virmidi_dev snd_virmidi_dev_t;
147typedef struct snd_virmidi snd_virmidi_t;
148
149/* seq_instr */
150typedef struct snd_seq_kcluster snd_seq_kcluster_t;
151typedef struct snd_seq_kinstr_ops snd_seq_kinstr_ops_t;
152typedef struct snd_seq_kinstr snd_seq_kinstr_t;
153typedef struct snd_seq_kinstr_list snd_seq_kinstr_list_t;
154
155/* ac97 */
156typedef struct snd_ac97_bus ac97_bus_t;
157typedef struct snd_ac97_bus_ops ac97_bus_ops_t;
158typedef struct snd_ac97_template ac97_template_t;
159typedef struct snd_ac97 ac97_t;
160
161/* opl3/4 */
162typedef struct snd_opl3 opl3_t;
163typedef struct snd_opl4 opl4_t;
164
165/* mpu401 */
166typedef struct snd_mpu401 mpu401_t;
167
168/* i2c */
169typedef struct snd_i2c_device snd_i2c_device_t;
170typedef struct snd_i2c_bus snd_i2c_bus_t;
171
172typedef struct snd_ak4531 ak4531_t;
173
diff --git a/include/sound/version.h b/include/sound/version.h
index 20f7babad514..42a18cc95f38 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.14rc1" 2#define CONFIG_SND_VERSION "1.0.14rc3"
3#define CONFIG_SND_DATE " (Tue Jan 09 09:56:17 2007 UTC)" 3#define CONFIG_SND_DATE " (Wed Mar 14 07:25:50 2007 UTC)"
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 217394652090..4830651cc4cf 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -128,7 +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 const unsigned int *output_level_db_scale;
132}; 132};
133 133
134/* hwdep id string */ 134/* hwdep id string */
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index f3514ee96bd9..203d2b45b788 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -270,6 +270,7 @@ struct snd_ymfpci_pcm {
270 struct snd_pcm_substream *substream; 270 struct snd_pcm_substream *substream;
271 struct snd_ymfpci_voice *voices[2]; /* playback only */ 271 struct snd_ymfpci_voice *voices[2]; /* playback only */
272 unsigned int running: 1, 272 unsigned int running: 1,
273 use_441_slot: 1,
273 output_front: 1, 274 output_front: 1,
274 output_rear: 1, 275 output_rear: 1,
275 swap_rear: 1; 276 swap_rear: 1;
@@ -324,6 +325,7 @@ struct snd_ymfpci {
324 325
325 u32 active_bank; 326 u32 active_bank;
326 struct snd_ymfpci_voice voices[64]; 327 struct snd_ymfpci_voice voices[64];
328 int src441_used;
327 329
328 struct snd_ac97_bus *ac97_bus; 330 struct snd_ac97_bus *ac97_bus;
329 struct snd_ac97 *ac97; 331 struct snd_ac97 *ac97;
@@ -346,7 +348,7 @@ struct snd_ymfpci {
346 int mode_dup4ch; 348 int mode_dup4ch;
347 int rear_opened; 349 int rear_opened;
348 int spdif_opened; 350 int spdif_opened;
349 struct { 351 struct snd_ymfpci_pcm_mixer {
350 u16 left; 352 u16 left;
351 u16 right; 353 u16 right;
352 struct snd_kcontrol *ctl; 354 struct snd_kcontrol *ctl;
@@ -357,6 +359,8 @@ struct snd_ymfpci {
357 wait_queue_head_t interrupt_sleep; 359 wait_queue_head_t interrupt_sleep;
358 atomic_t interrupt_sleep_count; 360 atomic_t interrupt_sleep_count;
359 struct snd_info_entry *proc_entry; 361 struct snd_info_entry *proc_entry;
362 const struct firmware *dsp_microcode;
363 const struct firmware *controller_microcode;
360 364
361#ifdef CONFIG_PM 365#ifdef CONFIG_PM
362 u32 *saved_regs; 366 u32 *saved_regs;
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index 78b1f15a538f..a9e118a1cd16 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -140,7 +140,8 @@ typedef volatile struct {
140 140
141struct neofb_par { 141struct neofb_par {
142 struct vgastate state; 142 struct vgastate state;
143 atomic_t ref_count; 143 struct mutex open_lock;
144 unsigned int ref_count;
144 145
145 unsigned char MiscOutReg; /* Misc */ 146 unsigned char MiscOutReg; /* Misc */
146 unsigned char CRTC[25]; /* Crtc Controller */ 147 unsigned char CRTC[25]; /* Crtc Controller */
diff --git a/include/video/s3blit.h b/include/video/s3blit.h
deleted file mode 100644
index b1db63187b4e..000000000000
--- a/include/video/s3blit.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _VIDEO_S3BLIT_H
2#define _VIDEO_S3BLIT_H
3
4/* s3 commands */
5#define S3_BITBLT 0xc011
6#define S3_TWOPOINTLINE 0x2811
7#define S3_FILLEDRECT 0x40b1
8
9#define S3_FIFO_EMPTY 0x0400
10#define S3_HDW_BUSY 0x0200
11
12/* Enhanced register mapping (MMIO mode) */
13
14#define S3_READ_SEL 0xbee8 /* offset f */
15#define S3_MULT_MISC 0xbee8 /* offset e */
16#define S3_ERR_TERM 0x92e8
17#define S3_FRGD_COLOR 0xa6e8
18#define S3_BKGD_COLOR 0xa2e8
19#define S3_PIXEL_CNTL 0xbee8 /* offset a */
20#define S3_FRGD_MIX 0xbae8
21#define S3_BKGD_MIX 0xb6e8
22#define S3_CUR_Y 0x82e8
23#define S3_CUR_X 0x86e8
24#define S3_DESTY_AXSTP 0x8ae8
25#define S3_DESTX_DIASTP 0x8ee8
26#define S3_MIN_AXIS_PCNT 0xbee8 /* offset 0 */
27#define S3_MAJ_AXIS_PCNT 0x96e8
28#define S3_CMD 0x9ae8
29#define S3_GP_STAT 0x9ae8
30#define S3_ADVFUNC_CNTL 0x4ae8
31#define S3_WRT_MASK 0xaae8
32#define S3_RD_MASK 0xaee8
33
34/* Enhanced register mapping (Packed MMIO mode, write only) */
35#define S3_ALT_CURXY 0x8100
36#define S3_ALT_CURXY2 0x8104
37#define S3_ALT_STEP 0x8108
38#define S3_ALT_STEP2 0x810c
39#define S3_ALT_ERR 0x8110
40#define S3_ALT_CMD 0x8118
41#define S3_ALT_MIX 0x8134
42#define S3_ALT_PCNT 0x8148
43#define S3_ALT_PAT 0x8168
44
45/* Drawing modes */
46#define S3_NOTCUR 0x0000
47#define S3_LOGICALZERO 0x0001
48#define S3_LOGICALONE 0x0002
49#define S3_LEAVEASIS 0x0003
50#define S3_NOTNEW 0x0004
51#define S3_CURXORNEW 0x0005
52#define S3_NOT_CURXORNEW 0x0006
53#define S3_NEW 0x0007
54#define S3_NOTCURORNOTNEW 0x0008
55#define S3_CURORNOTNEW 0x0009
56#define S3_NOTCURORNEW 0x000a
57#define S3_CURORNEW 0x000b
58#define S3_CURANDNEW 0x000c
59#define S3_NOTCURANDNEW 0x000d
60#define S3_CURANDNOTNEW 0x000e
61#define S3_NOTCURANDNOTNEW 0x000f
62
63#define S3_CRTC_ADR 0x03d4
64#define S3_CRTC_DATA 0x03d5
65
66#define S3_REG_LOCK2 0x39
67#define S3_HGC_MODE 0x45
68
69#define S3_HWGC_ORGX_H 0x46
70#define S3_HWGC_ORGX_L 0x47
71#define S3_HWGC_ORGY_H 0x48
72#define S3_HWGC_ORGY_L 0x49
73#define S3_HWGC_DX 0x4e
74#define S3_HWGC_DY 0x4f
75
76
77#define S3_LAW_CTL 0x58
78
79#endif /* _VIDEO_S3BLIT_H */