aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acdebug.h8
-rw-r--r--include/acpi/acdisasm.h4
-rw-r--r--include/acpi/acdispat.h6
-rw-r--r--include/acpi/acexcep.h128
-rw-r--r--include/acpi/aclocal.h77
-rw-r--r--include/acpi/acmacros.h259
-rw-r--r--include/acpi/acnamesp.h16
-rw-r--r--include/acpi/acobject.h37
-rw-r--r--include/acpi/acoutput.h32
-rw-r--r--include/acpi/acpi_bus.h11
-rw-r--r--include/acpi/acpi_drivers.h11
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpredef.h371
-rw-r--r--include/acpi/actbl1.h51
-rw-r--r--include/acpi/actypes.h37
-rw-r--r--include/acpi/acutils.h4
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h6
-rw-r--r--include/asm-arm/plat-s3c/debug-macro.S75
-rw-r--r--include/asm-arm/plat-s3c/map.h40
-rw-r--r--include/asm-arm/plat-s3c/regs-adc.h60
-rw-r--r--include/asm-arm/plat-s3c/regs-serial.h232
-rw-r--r--include/asm-arm/plat-s3c/regs-timer.h115
-rw-r--r--include/asm-arm/plat-s3c/uncompress.h155
-rw-r--r--include/asm-arm/plat-s3c24xx/clock.h64
-rw-r--r--include/asm-arm/plat-s3c24xx/common-smdk.h15
-rw-r--r--include/asm-arm/plat-s3c24xx/cpu.h54
-rw-r--r--include/asm-arm/plat-s3c24xx/devs.h49
-rw-r--r--include/asm-arm/plat-s3c24xx/dma.h82
-rw-r--r--include/asm-arm/plat-s3c24xx/irq.h109
-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-cris/a.out.h26
-rw-r--r--include/asm-cris/elf.h2
-rw-r--r--include/asm-cris/thread_info.h2
-rw-r--r--include/asm-frv/elf.h2
-rw-r--r--include/asm-frv/ide.h10
-rw-r--r--include/asm-frv/unaligned.h2
-rw-r--r--include/asm-generic/bug.h4
-rw-r--r--include/asm-generic/gpio.h18
-rw-r--r--include/asm-generic/mutex-dec.h26
-rw-r--r--include/asm-generic/mutex-xchg.h9
-rw-r--r--include/asm-generic/rtc.h24
-rw-r--r--include/asm-generic/siginfo.h2
-rw-r--r--include/asm-generic/statfs.h65
-rw-r--r--include/asm-generic/vmlinux.lds.h25
-rw-r--r--include/asm-h8300/timer.h25
-rw-r--r--include/asm-m32r/a.out.h20
-rw-r--r--include/asm-m32r/elf.h2
-rw-r--r--include/asm-m68k/atarihw.h1
-rw-r--r--include/asm-m68k/dma-mapping.h16
-rw-r--r--include/asm-m68k/dma.h4
-rw-r--r--include/asm-m68k/elf.h2
-rw-r--r--include/asm-m68k/entry.h2
-rw-r--r--include/asm-m68k/ide.h9
-rw-r--r--include/asm-m68k/io.h66
-rw-r--r--include/asm-m68k/machdep.h2
-rw-r--r--include/asm-m68k/pci.h47
-rw-r--r--include/asm-m68k/thread_info.h1
-rw-r--r--include/asm-m68k/virtconvert.h6
-rw-r--r--include/asm-mips/Kbuild3
-rw-r--r--include/asm-mips/a.out.h35
-rw-r--r--include/asm-mips/abi.h25
-rw-r--r--include/asm-mips/addrspace.h154
-rw-r--r--include/asm-mips/asm.h409
-rw-r--r--include/asm-mips/asmmacro-32.h158
-rw-r--r--include/asm-mips/asmmacro-64.h139
-rw-r--r--include/asm-mips/asmmacro.h82
-rw-r--r--include/asm-mips/atomic.h801
-rw-r--r--include/asm-mips/auxvec.h4
-rw-r--r--include/asm-mips/barrier.h155
-rw-r--r--include/asm-mips/bcache.h60
-rw-r--r--include/asm-mips/bitops.h672
-rw-r--r--include/asm-mips/bootinfo.h110
-rw-r--r--include/asm-mips/branch.h38
-rw-r--r--include/asm-mips/break.h34
-rw-r--r--include/asm-mips/bug.h33
-rw-r--r--include/asm-mips/bugs.h53
-rw-r--r--include/asm-mips/byteorder.h76
-rw-r--r--include/asm-mips/cache.h20
-rw-r--r--include/asm-mips/cachectl.h26
-rw-r--r--include/asm-mips/cacheflush.h116
-rw-r--r--include/asm-mips/cacheops.h85
-rw-r--r--include/asm-mips/cevt-r4k.h46
-rw-r--r--include/asm-mips/checksum.h260
-rw-r--r--include/asm-mips/cmp.h18
-rw-r--r--include/asm-mips/cmpxchg.h124
-rw-r--r--include/asm-mips/compat-signal.h119
-rw-r--r--include/asm-mips/compat.h221
-rw-r--r--include/asm-mips/compiler.h19
-rw-r--r--include/asm-mips/cpu-features.h219
-rw-r--r--include/asm-mips/cpu-info.h84
-rw-r--r--include/asm-mips/cpu.h267
-rw-r--r--include/asm-mips/cputime.h6
-rw-r--r--include/asm-mips/current.h23
-rw-r--r--include/asm-mips/debug.h48
-rw-r--r--include/asm-mips/dec/ecc.h55
-rw-r--r--include/asm-mips/dec/interrupts.h126
-rw-r--r--include/asm-mips/dec/ioasic.h38
-rw-r--r--include/asm-mips/dec/ioasic_addrs.h152
-rw-r--r--include/asm-mips/dec/ioasic_ints.h74
-rw-r--r--include/asm-mips/dec/kn01.h90
-rw-r--r--include/asm-mips/dec/kn02.h91
-rw-r--r--include/asm-mips/dec/kn02ba.h67
-rw-r--r--include/asm-mips/dec/kn02ca.h79
-rw-r--r--include/asm-mips/dec/kn02xa.h84
-rw-r--r--include/asm-mips/dec/kn03.h74
-rw-r--r--include/asm-mips/dec/kn05.h76
-rw-r--r--include/asm-mips/dec/kn230.h26
-rw-r--r--include/asm-mips/dec/machtype.h27
-rw-r--r--include/asm-mips/dec/prom.h174
-rw-r--r--include/asm-mips/dec/system.h19
-rw-r--r--include/asm-mips/delay.h112
-rw-r--r--include/asm-mips/device.h7
-rw-r--r--include/asm-mips/div64.h110
-rw-r--r--include/asm-mips/dma-mapping.h81
-rw-r--r--include/asm-mips/dma.h315
-rw-r--r--include/asm-mips/ds1286.h15
-rw-r--r--include/asm-mips/ds1287.h27
-rw-r--r--include/asm-mips/dsp.h85
-rw-r--r--include/asm-mips/edac.h34
-rw-r--r--include/asm-mips/elf.h371
-rw-r--r--include/asm-mips/emergency-restart.h6
-rw-r--r--include/asm-mips/emma2rh/emma2rh.h333
-rw-r--r--include/asm-mips/emma2rh/markeins.h75
-rw-r--r--include/asm-mips/errno.h131
-rw-r--r--include/asm-mips/fb.h19
-rw-r--r--include/asm-mips/fcntl.h61
-rw-r--r--include/asm-mips/fixmap.h118
-rw-r--r--include/asm-mips/floppy.h56
-rw-r--r--include/asm-mips/fpregdef.h99
-rw-r--r--include/asm-mips/fpu.h153
-rw-r--r--include/asm-mips/fpu_emulator.h37
-rw-r--r--include/asm-mips/futex.h203
-rw-r--r--include/asm-mips/fw/arc/hinv.h175
-rw-r--r--include/asm-mips/fw/arc/types.h86
-rw-r--r--include/asm-mips/fw/cfe/cfe_api.h122
-rw-r--r--include/asm-mips/fw/cfe/cfe_error.h80
-rw-r--r--include/asm-mips/gcmpregs.h117
-rw-r--r--include/asm-mips/gic.h487
-rw-r--r--include/asm-mips/gpio.h6
-rw-r--r--include/asm-mips/gt64120.h580
-rw-r--r--include/asm-mips/hardirq.h24
-rw-r--r--include/asm-mips/hazards.h271
-rw-r--r--include/asm-mips/highmem.h67
-rw-r--r--include/asm-mips/hw_irq.h20
-rw-r--r--include/asm-mips/i8253.h21
-rw-r--r--include/asm-mips/i8259.h86
-rw-r--r--include/asm-mips/ide.h13
-rw-r--r--include/asm-mips/inst.h394
-rw-r--r--include/asm-mips/io.h589
-rw-r--r--include/asm-mips/ioctl.h94
-rw-r--r--include/asm-mips/ioctls.h109
-rw-r--r--include/asm-mips/ip32/crime.h158
-rw-r--r--include/asm-mips/ip32/ip32_ints.h114
-rw-r--r--include/asm-mips/ip32/mace.h365
-rw-r--r--include/asm-mips/ipcbuf.h28
-rw-r--r--include/asm-mips/irq.h163
-rw-r--r--include/asm-mips/irq_cpu.h20
-rw-r--r--include/asm-mips/irq_gt641xx.h60
-rw-r--r--include/asm-mips/irq_regs.h21
-rw-r--r--include/asm-mips/irqflags.h283
-rw-r--r--include/asm-mips/isadep.h34
-rw-r--r--include/asm-mips/jazz.h310
-rw-r--r--include/asm-mips/jazzdma.h95
-rw-r--r--include/asm-mips/kdebug.h13
-rw-r--r--include/asm-mips/kexec.h30
-rw-r--r--include/asm-mips/kgdb.h44
-rw-r--r--include/asm-mips/kmap_types.h30
-rw-r--r--include/asm-mips/kspd.h36
-rw-r--r--include/asm-mips/lasat/ds1603.h18
-rw-r--r--include/asm-mips/lasat/eeprom.h17
-rw-r--r--include/asm-mips/lasat/head.h22
-rw-r--r--include/asm-mips/lasat/lasat.h258
-rw-r--r--include/asm-mips/lasat/lasatint.h14
-rw-r--r--include/asm-mips/lasat/picvue.h15
-rw-r--r--include/asm-mips/lasat/serial.h13
-rw-r--r--include/asm-mips/linkage.h10
-rw-r--r--include/asm-mips/local.h221
-rw-r--r--include/asm-mips/m48t35.h27
-rw-r--r--include/asm-mips/m48t37.h35
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h1772
-rw-r--r--include/asm-mips/mach-au1x00/au1000_dma.h458
-rw-r--r--include/asm-mips/mach-au1x00/au1000_gpio.h56
-rw-r--r--include/asm-mips/mach-au1x00/au1100_mmc.h208
-rw-r--r--include/asm-mips/mach-au1x00/au1550_spi.h15
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx.h43
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_dbdma.h386
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h194
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_psc.h505
-rw-r--r--include/asm-mips/mach-au1x00/gpio.h69
-rw-r--r--include/asm-mips/mach-au1x00/ioremap.h42
-rw-r--r--include/asm-mips/mach-au1x00/prom.h13
-rw-r--r--include/asm-mips/mach-au1x00/war.h25
-rw-r--r--include/asm-mips/mach-bcm47xx/bcm47xx.h25
-rw-r--r--include/asm-mips/mach-bcm47xx/gpio.h59
-rw-r--r--include/asm-mips/mach-bcm47xx/war.h25
-rw-r--r--include/asm-mips/mach-cobalt/cobalt.h22
-rw-r--r--include/asm-mips/mach-cobalt/cpu-feature-overrides.h56
-rw-r--r--include/asm-mips/mach-cobalt/irq.h57
-rw-r--r--include/asm-mips/mach-cobalt/mach-gt64120.h27
-rw-r--r--include/asm-mips/mach-cobalt/war.h25
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h230
-rw-r--r--include/asm-mips/mach-db1x00/db1x00.h179
-rw-r--r--include/asm-mips/mach-dec/mc146818rtc.h43
-rw-r--r--include/asm-mips/mach-dec/war.h25
-rw-r--r--include/asm-mips/mach-emma2rh/irq.h15
-rw-r--r--include/asm-mips/mach-emma2rh/war.h25
-rw-r--r--include/asm-mips/mach-excite/cpu-feature-overrides.h48
-rw-r--r--include/asm-mips/mach-excite/excite.h154
-rw-r--r--include/asm-mips/mach-excite/excite_fpga.h80
-rw-r--r--include/asm-mips/mach-excite/excite_nandflash.h7
-rw-r--r--include/asm-mips/mach-excite/rm9k_eth.h23
-rw-r--r--include/asm-mips/mach-excite/rm9k_wdt.h12
-rw-r--r--include/asm-mips/mach-excite/rm9k_xicap.h16
-rw-r--r--include/asm-mips/mach-excite/war.h25
-rw-r--r--include/asm-mips/mach-generic/cpu-feature-overrides.h13
-rw-r--r--include/asm-mips/mach-generic/dma-coherence.h45
-rw-r--r--include/asm-mips/mach-generic/floppy.h139
-rw-r--r--include/asm-mips/mach-generic/gpio.h21
-rw-r--r--include/asm-mips/mach-generic/ide.h167
-rw-r--r--include/asm-mips/mach-generic/ioremap.h34
-rw-r--r--include/asm-mips/mach-generic/irq.h45
-rw-r--r--include/asm-mips/mach-generic/kernel-entry-init.h25
-rw-r--r--include/asm-mips/mach-generic/kmalloc.h13
-rw-r--r--include/asm-mips/mach-generic/mangle-port.h52
-rw-r--r--include/asm-mips/mach-generic/mc146818rtc.h36
-rw-r--r--include/asm-mips/mach-generic/spaces.h85
-rw-r--r--include/asm-mips/mach-generic/topology.h1
-rw-r--r--include/asm-mips/mach-ip22/cpu-feature-overrides.h44
-rw-r--r--include/asm-mips/mach-ip22/ds1286.h18
-rw-r--r--include/asm-mips/mach-ip22/spaces.h27
-rw-r--r--include/asm-mips/mach-ip22/war.h29
-rw-r--r--include/asm-mips/mach-ip27/cpu-feature-overrides.h54
-rw-r--r--include/asm-mips/mach-ip27/dma-coherence.h50
-rw-r--r--include/asm-mips/mach-ip27/irq.h22
-rw-r--r--include/asm-mips/mach-ip27/kernel-entry-init.h59
-rw-r--r--include/asm-mips/mach-ip27/kmalloc.h8
-rw-r--r--include/asm-mips/mach-ip27/mangle-port.h25
-rw-r--r--include/asm-mips/mach-ip27/mmzone.h36
-rw-r--r--include/asm-mips/mach-ip27/spaces.h30
-rw-r--r--include/asm-mips/mach-ip27/topology.h59
-rw-r--r--include/asm-mips/mach-ip27/war.h25
-rw-r--r--include/asm-mips/mach-ip28/cpu-feature-overrides.h50
-rw-r--r--include/asm-mips/mach-ip28/ds1286.h4
-rw-r--r--include/asm-mips/mach-ip28/spaces.h22
-rw-r--r--include/asm-mips/mach-ip28/war.h25
-rw-r--r--include/asm-mips/mach-ip32/cpu-feature-overrides.h50
-rw-r--r--include/asm-mips/mach-ip32/dma-coherence.h72
-rw-r--r--include/asm-mips/mach-ip32/kmalloc.h11
-rw-r--r--include/asm-mips/mach-ip32/mangle-port.h26
-rw-r--r--include/asm-mips/mach-ip32/mc146818rtc.h36
-rw-r--r--include/asm-mips/mach-ip32/war.h25
-rw-r--r--include/asm-mips/mach-jazz/dma-coherence.h40
-rw-r--r--include/asm-mips/mach-jazz/floppy.h135
-rw-r--r--include/asm-mips/mach-jazz/mc146818rtc.h38
-rw-r--r--include/asm-mips/mach-jazz/war.h25
-rw-r--r--include/asm-mips/mach-lasat/irq.h13
-rw-r--r--include/asm-mips/mach-lasat/mach-gt64120.h27
-rw-r--r--include/asm-mips/mach-lasat/war.h25
-rw-r--r--include/asm-mips/mach-lemote/dma-coherence.h42
-rw-r--r--include/asm-mips/mach-lemote/mc146818rtc.h36
-rw-r--r--include/asm-mips/mach-lemote/war.h25
-rw-r--r--include/asm-mips/mach-malta/cpu-feature-overrides.h72
-rw-r--r--include/asm-mips/mach-malta/irq.h9
-rw-r--r--include/asm-mips/mach-malta/kernel-entry-init.h52
-rw-r--r--include/asm-mips/mach-malta/mach-gt64120.h19
-rw-r--r--include/asm-mips/mach-malta/mc146818rtc.h48
-rw-r--r--include/asm-mips/mach-malta/war.h25
-rw-r--r--include/asm-mips/mach-mipssim/cpu-feature-overrides.h65
-rw-r--r--include/asm-mips/mach-mipssim/war.h25
-rw-r--r--include/asm-mips/mach-pb1x00/mc146818rtc.h34
-rw-r--r--include/asm-mips/mach-pb1x00/pb1000.h87
-rw-r--r--include/asm-mips/mach-pb1x00/pb1100.h85
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h259
-rw-r--r--include/asm-mips/mach-pb1x00/pb1500.h49
-rw-r--r--include/asm-mips/mach-pb1x00/pb1550.h177
-rw-r--r--include/asm-mips/mach-pnx8550/cm.h43
-rw-r--r--include/asm-mips/mach-pnx8550/glb.h86
-rw-r--r--include/asm-mips/mach-pnx8550/int.h140
-rw-r--r--include/asm-mips/mach-pnx8550/kernel-entry-init.h262
-rw-r--r--include/asm-mips/mach-pnx8550/nand.h121
-rw-r--r--include/asm-mips/mach-pnx8550/pci.h185
-rw-r--r--include/asm-mips/mach-pnx8550/uart.h30
-rw-r--r--include/asm-mips/mach-pnx8550/usb.h32
-rw-r--r--include/asm-mips/mach-pnx8550/war.h25
-rw-r--r--include/asm-mips/mach-rc32434/cpu-feature-overrides.h81
-rw-r--r--include/asm-mips/mach-rc32434/ddr.h141
-rw-r--r--include/asm-mips/mach-rc32434/dma.h103
-rw-r--r--include/asm-mips/mach-rc32434/dma_v.h52
-rw-r--r--include/asm-mips/mach-rc32434/eth.h220
-rw-r--r--include/asm-mips/mach-rc32434/gpio.h126
-rw-r--r--include/asm-mips/mach-rc32434/integ.h59
-rw-r--r--include/asm-mips/mach-rc32434/irq.h8
-rw-r--r--include/asm-mips/mach-rc32434/pci.h481
-rw-r--r--include/asm-mips/mach-rc32434/prom.h44
-rw-r--r--include/asm-mips/mach-rc32434/rb.h81
-rw-r--r--include/asm-mips/mach-rc32434/rc32434.h61
-rw-r--r--include/asm-mips/mach-rc32434/timer.h65
-rw-r--r--include/asm-mips/mach-rc32434/war.h25
-rw-r--r--include/asm-mips/mach-rm/cpu-feature-overrides.h43
-rw-r--r--include/asm-mips/mach-rm/mc146818rtc.h21
-rw-r--r--include/asm-mips/mach-rm/war.h29
-rw-r--r--include/asm-mips/mach-sibyte/cpu-feature-overrides.h47
-rw-r--r--include/asm-mips/mach-sibyte/war.h37
-rw-r--r--include/asm-mips/mach-tx39xx/ioremap.h38
-rw-r--r--include/asm-mips/mach-tx39xx/mangle-port.h23
-rw-r--r--include/asm-mips/mach-tx39xx/war.h25
-rw-r--r--include/asm-mips/mach-tx49xx/cpu-feature-overrides.h23
-rw-r--r--include/asm-mips/mach-tx49xx/ioremap.h43
-rw-r--r--include/asm-mips/mach-tx49xx/kmalloc.h8
-rw-r--r--include/asm-mips/mach-tx49xx/war.h25
-rw-r--r--include/asm-mips/mach-vr41xx/irq.h8
-rw-r--r--include/asm-mips/mach-vr41xx/war.h25
-rw-r--r--include/asm-mips/mach-wrppmc/mach-gt64120.h83
-rw-r--r--include/asm-mips/mach-wrppmc/war.h25
-rw-r--r--include/asm-mips/mach-yosemite/cpu-feature-overrides.h47
-rw-r--r--include/asm-mips/mach-yosemite/war.h25
-rw-r--r--include/asm-mips/mc146818-time.h119
-rw-r--r--include/asm-mips/mc146818rtc.h16
-rw-r--r--include/asm-mips/mips-boards/bonito64.h436
-rw-r--r--include/asm-mips/mips-boards/generic.h104
-rw-r--r--include/asm-mips/mips-boards/launch.h35
-rw-r--r--include/asm-mips/mips-boards/malta.h102
-rw-r--r--include/asm-mips/mips-boards/maltaint.h110
-rw-r--r--include/asm-mips/mips-boards/msc01_pci.h258
-rw-r--r--include/asm-mips/mips-boards/piix4.h80
-rw-r--r--include/asm-mips/mips-boards/prom.h47
-rw-r--r--include/asm-mips/mips-boards/sim.h40
-rw-r--r--include/asm-mips/mips-boards/simint.h31
-rw-r--r--include/asm-mips/mips_mt.h26
-rw-r--r--include/asm-mips/mipsmtregs.h395
-rw-r--r--include/asm-mips/mipsprom.h76
-rw-r--r--include/asm-mips/mipsregs.h1526
-rw-r--r--include/asm-mips/mman.h77
-rw-r--r--include/asm-mips/mmu.h6
-rw-r--r--include/asm-mips/mmu_context.h297
-rw-r--r--include/asm-mips/mmzone.h17
-rw-r--r--include/asm-mips/module.h136
-rw-r--r--include/asm-mips/msc01_ic.h148
-rw-r--r--include/asm-mips/msgbuf.h47
-rw-r--r--include/asm-mips/mutex.h9
-rw-r--r--include/asm-mips/nile4.h310
-rw-r--r--include/asm-mips/paccess.h112
-rw-r--r--include/asm-mips/page.h191
-rw-r--r--include/asm-mips/param.h31
-rw-r--r--include/asm-mips/parport.h15
-rw-r--r--include/asm-mips/pci.h179
-rw-r--r--include/asm-mips/pci/bridge.h854
-rw-r--r--include/asm-mips/percpu.h6
-rw-r--r--include/asm-mips/pgalloc.h143
-rw-r--r--include/asm-mips/pgtable-32.h234
-rw-r--r--include/asm-mips/pgtable-64.h253
-rw-r--r--include/asm-mips/pgtable-bits.h137
-rw-r--r--include/asm-mips/pgtable.h383
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_cic_int.h151
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_int.h43
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_pci.h205
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_prom.h176
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_regops.h236
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_regs.h663
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/msp_slp_int.h141
-rw-r--r--include/asm-mips/pmc-sierra/msp71xx/war.h28
-rw-r--r--include/asm-mips/pmon.h46
-rw-r--r--include/asm-mips/poll.h9
-rw-r--r--include/asm-mips/posix_types.h144
-rw-r--r--include/asm-mips/prefetch.h87
-rw-r--r--include/asm-mips/processor.h263
-rw-r--r--include/asm-mips/ptrace.h99
-rw-r--r--include/asm-mips/r4k-timer.h30
-rw-r--r--include/asm-mips/r4kcache.h443
-rw-r--r--include/asm-mips/reboot.h15
-rw-r--r--include/asm-mips/reg.h128
-rw-r--r--include/asm-mips/regdef.h100
-rw-r--r--include/asm-mips/resource.h35
-rw-r--r--include/asm-mips/rm9k-ocd.h56
-rw-r--r--include/asm-mips/rtlx.h65
-rw-r--r--include/asm-mips/scatterlist.h28
-rw-r--r--include/asm-mips/seccomp.h37
-rw-r--r--include/asm-mips/sections.h6
-rw-r--r--include/asm-mips/segment.h6
-rw-r--r--include/asm-mips/sembuf.h22
-rw-r--r--include/asm-mips/serial.h22
-rw-r--r--include/asm-mips/setup.h10
-rw-r--r--include/asm-mips/sgi/gio.h86
-rw-r--r--include/asm-mips/sgi/hpc3.h317
-rw-r--r--include/asm-mips/sgi/ioc.h200
-rw-r--r--include/asm-mips/sgi/ip22.h78
-rw-r--r--include/asm-mips/sgi/mc.h231
-rw-r--r--include/asm-mips/sgi/pi1.h71
-rw-r--r--include/asm-mips/sgi/seeq.h21
-rw-r--r--include/asm-mips/sgi/sgi.h47
-rw-r--r--include/asm-mips/sgi/wd.h20
-rw-r--r--include/asm-mips/sgialib.h124
-rw-r--r--include/asm-mips/sgiarcs.h548
-rw-r--r--include/asm-mips/sgidefs.h44
-rw-r--r--include/asm-mips/shmbuf.h38
-rw-r--r--include/asm-mips/shmparam.h13
-rw-r--r--include/asm-mips/sibyte/bcm1480_int.h312
-rw-r--r--include/asm-mips/sibyte/bcm1480_l2c.h176
-rw-r--r--include/asm-mips/sibyte/bcm1480_mc.h984
-rw-r--r--include/asm-mips/sibyte/bcm1480_regs.h902
-rw-r--r--include/asm-mips/sibyte/bcm1480_scd.h406
-rw-r--r--include/asm-mips/sibyte/bigsur.h49
-rw-r--r--include/asm-mips/sibyte/board.h68
-rw-r--r--include/asm-mips/sibyte/carmel.h58
-rw-r--r--include/asm-mips/sibyte/sb1250.h68
-rw-r--r--include/asm-mips/sibyte/sb1250_defs.h259
-rw-r--r--include/asm-mips/sibyte/sb1250_dma.h594
-rw-r--r--include/asm-mips/sibyte/sb1250_genbus.h474
-rw-r--r--include/asm-mips/sibyte/sb1250_int.h248
-rw-r--r--include/asm-mips/sibyte/sb1250_l2c.h131
-rw-r--r--include/asm-mips/sibyte/sb1250_ldt.h423
-rw-r--r--include/asm-mips/sibyte/sb1250_mac.h656
-rw-r--r--include/asm-mips/sibyte/sb1250_mc.h550
-rw-r--r--include/asm-mips/sibyte/sb1250_regs.h893
-rw-r--r--include/asm-mips/sibyte/sb1250_scd.h654
-rw-r--r--include/asm-mips/sibyte/sb1250_smbus.h204
-rw-r--r--include/asm-mips/sibyte/sb1250_syncser.h146
-rw-r--r--include/asm-mips/sibyte/sb1250_uart.h362
-rw-r--r--include/asm-mips/sibyte/sentosa.h40
-rw-r--r--include/asm-mips/sibyte/swarm.h64
-rw-r--r--include/asm-mips/sigcontext.h100
-rw-r--r--include/asm-mips/siginfo.h130
-rw-r--r--include/asm-mips/signal.h139
-rw-r--r--include/asm-mips/sim.h82
-rw-r--r--include/asm-mips/smp-ops.h57
-rw-r--r--include/asm-mips/smp.h63
-rw-r--r--include/asm-mips/smtc.h71
-rw-r--r--include/asm-mips/smtc_ipi.h128
-rw-r--r--include/asm-mips/smtc_proc.h23
-rw-r--r--include/asm-mips/smvp.h19
-rw-r--r--include/asm-mips/sn/addrs.h430
-rw-r--r--include/asm-mips/sn/agent.h46
-rw-r--r--include/asm-mips/sn/arch.h64
-rw-r--r--include/asm-mips/sn/fru.h44
-rw-r--r--include/asm-mips/sn/gda.h107
-rw-r--r--include/asm-mips/sn/hub.h16
-rw-r--r--include/asm-mips/sn/intr.h129
-rw-r--r--include/asm-mips/sn/io.h59
-rw-r--r--include/asm-mips/sn/ioc3.h663
-rw-r--r--include/asm-mips/sn/klconfig.h898
-rw-r--r--include/asm-mips/sn/kldir.h217
-rw-r--r--include/asm-mips/sn/klkernvars.h29
-rw-r--r--include/asm-mips/sn/launch.h106
-rw-r--r--include/asm-mips/sn/mapped_kernel.h54
-rw-r--r--include/asm-mips/sn/nmi.h125
-rw-r--r--include/asm-mips/sn/sn0/addrs.h288
-rw-r--r--include/asm-mips/sn/sn0/arch.h72
-rw-r--r--include/asm-mips/sn/sn0/hub.h40
-rw-r--r--include/asm-mips/sn/sn0/hubio.h972
-rw-r--r--include/asm-mips/sn/sn0/hubmd.h789
-rw-r--r--include/asm-mips/sn/sn0/hubni.h255
-rw-r--r--include/asm-mips/sn/sn0/hubpi.h409
-rw-r--r--include/asm-mips/sn/sn0/ip27.h85
-rw-r--r--include/asm-mips/sn/sn_private.h19
-rw-r--r--include/asm-mips/sn/types.h26
-rw-r--r--include/asm-mips/sni.h244
-rw-r--r--include/asm-mips/socket.h117
-rw-r--r--include/asm-mips/sockios.h26
-rw-r--r--include/asm-mips/sparsemem.h14
-rw-r--r--include/asm-mips/spinlock.h376
-rw-r--r--include/asm-mips/spinlock_types.h20
-rw-r--r--include/asm-mips/stackframe.h574
-rw-r--r--include/asm-mips/stacktrace.h48
-rw-r--r--include/asm-mips/stat.h132
-rw-r--r--include/asm-mips/statfs.h96
-rw-r--r--include/asm-mips/string.h143
-rw-r--r--include/asm-mips/suspend.h6
-rw-r--r--include/asm-mips/sysmips.h25
-rw-r--r--include/asm-mips/system.h220
-rw-r--r--include/asm-mips/termbits.h226
-rw-r--r--include/asm-mips/termios.h132
-rw-r--r--include/asm-mips/thread_info.h151
-rw-r--r--include/asm-mips/time.h79
-rw-r--r--include/asm-mips/timex.h43
-rw-r--r--include/asm-mips/titan_dep.h231
-rw-r--r--include/asm-mips/tlb.h23
-rw-r--r--include/asm-mips/tlbdebug.h16
-rw-r--r--include/asm-mips/tlbflush.h47
-rw-r--r--include/asm-mips/topology.h17
-rw-r--r--include/asm-mips/traps.h28
-rw-r--r--include/asm-mips/txx9/generic.h62
-rw-r--r--include/asm-mips/txx9/jmr3927.h180
-rw-r--r--include/asm-mips/txx9/pci.h39
-rw-r--r--include/asm-mips/txx9/rbtx4927.h89
-rw-r--r--include/asm-mips/txx9/rbtx4938.h145
-rw-r--r--include/asm-mips/txx9/smsc_fdc37m81x.h67
-rw-r--r--include/asm-mips/txx9/spi.h19
-rw-r--r--include/asm-mips/txx9/tx3927.h339
-rw-r--r--include/asm-mips/txx9/tx4927.h255
-rw-r--r--include/asm-mips/txx9/tx4927pcic.h203
-rw-r--r--include/asm-mips/txx9/tx4938.h293
-rw-r--r--include/asm-mips/txx9irq.h34
-rw-r--r--include/asm-mips/txx9pio.h29
-rw-r--r--include/asm-mips/txx9tmr.h67
-rw-r--r--include/asm-mips/types.h54
-rw-r--r--include/asm-mips/uaccess.h852
-rw-r--r--include/asm-mips/ucontext.h21
-rw-r--r--include/asm-mips/unaligned.h28
-rw-r--r--include/asm-mips/unistd.h1037
-rw-r--r--include/asm-mips/user.h58
-rw-r--r--include/asm-mips/vga.h47
-rw-r--r--include/asm-mips/vpe.h37
-rw-r--r--include/asm-mips/vr41xx/capcella.h43
-rw-r--r--include/asm-mips/vr41xx/giu.h78
-rw-r--r--include/asm-mips/vr41xx/irq.h101
-rw-r--r--include/asm-mips/vr41xx/mpc30x.h37
-rw-r--r--include/asm-mips/vr41xx/pci.h90
-rw-r--r--include/asm-mips/vr41xx/siu.h58
-rw-r--r--include/asm-mips/vr41xx/tb0219.h42
-rw-r--r--include/asm-mips/vr41xx/tb0226.h43
-rw-r--r--include/asm-mips/vr41xx/tb0287.h43
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h152
-rw-r--r--include/asm-mips/war.h244
-rw-r--r--include/asm-mips/wbflush.h34
-rw-r--r--include/asm-mips/xor.h1
-rw-r--r--include/asm-mips/xtalk/xtalk.h52
-rw-r--r--include/asm-mips/xtalk/xwidget.h167
-rw-r--r--include/asm-mn10300/elf.h2
-rw-r--r--include/asm-parisc/Kbuild3
-rw-r--r--include/asm-parisc/a.out.h20
-rw-r--r--include/asm-parisc/agp.h24
-rw-r--r--include/asm-parisc/asmregs.h183
-rw-r--r--include/asm-parisc/assembly.h519
-rw-r--r--include/asm-parisc/atomic.h348
-rw-r--r--include/asm-parisc/auxvec.h4
-rw-r--r--include/asm-parisc/bitops.h239
-rw-r--r--include/asm-parisc/bug.h92
-rw-r--r--include/asm-parisc/bugs.h19
-rw-r--r--include/asm-parisc/byteorder.h82
-rw-r--r--include/asm-parisc/cache.h60
-rw-r--r--include/asm-parisc/cacheflush.h121
-rw-r--r--include/asm-parisc/checksum.h210
-rw-r--r--include/asm-parisc/compat.h165
-rw-r--r--include/asm-parisc/compat_rt_sigframe.h50
-rw-r--r--include/asm-parisc/compat_signal.h2
-rw-r--r--include/asm-parisc/compat_ucontext.h17
-rw-r--r--include/asm-parisc/cputime.h6
-rw-r--r--include/asm-parisc/current.h15
-rw-r--r--include/asm-parisc/delay.h43
-rw-r--r--include/asm-parisc/device.h7
-rw-r--r--include/asm-parisc/div64.h1
-rw-r--r--include/asm-parisc/dma-mapping.h253
-rw-r--r--include/asm-parisc/dma.h186
-rw-r--r--include/asm-parisc/eisa_bus.h23
-rw-r--r--include/asm-parisc/eisa_eeprom.h153
-rw-r--r--include/asm-parisc/elf.h342
-rw-r--r--include/asm-parisc/emergency-restart.h6
-rw-r--r--include/asm-parisc/errno.h124
-rw-r--r--include/asm-parisc/fb.h19
-rw-r--r--include/asm-parisc/fcntl.h39
-rw-r--r--include/asm-parisc/fixmap.h30
-rw-r--r--include/asm-parisc/floppy.h271
-rw-r--r--include/asm-parisc/futex.h77
-rw-r--r--include/asm-parisc/grfioctl.h113
-rw-r--r--include/asm-parisc/hardirq.h29
-rw-r--r--include/asm-parisc/hardware.h127
-rw-r--r--include/asm-parisc/hw_irq.h8
-rw-r--r--include/asm-parisc/ide.h61
-rw-r--r--include/asm-parisc/io.h293
-rw-r--r--include/asm-parisc/ioctl.h44
-rw-r--r--include/asm-parisc/ioctls.h90
-rw-r--r--include/asm-parisc/ipcbuf.h27
-rw-r--r--include/asm-parisc/irq.h57
-rw-r--r--include/asm-parisc/irq_regs.h1
-rw-r--r--include/asm-parisc/kdebug.h1
-rw-r--r--include/asm-parisc/kmap_types.h30
-rw-r--r--include/asm-parisc/led.h42
-rw-r--r--include/asm-parisc/linkage.h31
-rw-r--r--include/asm-parisc/local.h1
-rw-r--r--include/asm-parisc/machdep.h16
-rw-r--r--include/asm-parisc/mc146818rtc.h9
-rw-r--r--include/asm-parisc/mckinley.h9
-rw-r--r--include/asm-parisc/mman.h61
-rw-r--r--include/asm-parisc/mmu.h7
-rw-r--r--include/asm-parisc/mmu_context.h75
-rw-r--r--include/asm-parisc/mmzone.h73
-rw-r--r--include/asm-parisc/module.h32
-rw-r--r--include/asm-parisc/msgbuf.h37
-rw-r--r--include/asm-parisc/mutex.h9
-rw-r--r--include/asm-parisc/page.h173
-rw-r--r--include/asm-parisc/param.h22
-rw-r--r--include/asm-parisc/parisc-device.h64
-rw-r--r--include/asm-parisc/parport.h18
-rw-r--r--include/asm-parisc/pci.h294
-rw-r--r--include/asm-parisc/pdc.h757
-rw-r--r--include/asm-parisc/pdc_chassis.h381
-rw-r--r--include/asm-parisc/pdcpat.h308
-rw-r--r--include/asm-parisc/percpu.h7
-rw-r--r--include/asm-parisc/perf.h74
-rw-r--r--include/asm-parisc/pgalloc.h149
-rw-r--r--include/asm-parisc/pgtable.h508
-rw-r--r--include/asm-parisc/poll.h1
-rw-r--r--include/asm-parisc/posix_types.h129
-rw-r--r--include/asm-parisc/prefetch.h39
-rw-r--r--include/asm-parisc/processor.h357
-rw-r--r--include/asm-parisc/psw.h62
-rw-r--r--include/asm-parisc/ptrace.h58
-rw-r--r--include/asm-parisc/real.h5
-rw-r--r--include/asm-parisc/resource.h7
-rw-r--r--include/asm-parisc/ropes.h322
-rw-r--r--include/asm-parisc/rt_sigframe.h23
-rw-r--r--include/asm-parisc/rtc.h131
-rw-r--r--include/asm-parisc/runway.h12
-rw-r--r--include/asm-parisc/scatterlist.h27
-rw-r--r--include/asm-parisc/sections.h12
-rw-r--r--include/asm-parisc/segment.h6
-rw-r--r--include/asm-parisc/sembuf.h29
-rw-r--r--include/asm-parisc/serial.h10
-rw-r--r--include/asm-parisc/setup.h6
-rw-r--r--include/asm-parisc/shmbuf.h58
-rw-r--r--include/asm-parisc/shmparam.h8
-rw-r--r--include/asm-parisc/sigcontext.h20
-rw-r--r--include/asm-parisc/siginfo.h14
-rw-r--r--include/asm-parisc/signal.h153
-rw-r--r--include/asm-parisc/smp.h68
-rw-r--r--include/asm-parisc/socket.h62
-rw-r--r--include/asm-parisc/sockios.h13
-rw-r--r--include/asm-parisc/spinlock.h194
-rw-r--r--include/asm-parisc/spinlock_types.h21
-rw-r--r--include/asm-parisc/stat.h100
-rw-r--r--include/asm-parisc/statfs.h58
-rw-r--r--include/asm-parisc/string.h10
-rw-r--r--include/asm-parisc/superio.h85
-rw-r--r--include/asm-parisc/system.h182
-rw-r--r--include/asm-parisc/termbits.h200
-rw-r--r--include/asm-parisc/termios.h90
-rw-r--r--include/asm-parisc/thread_info.h74
-rw-r--r--include/asm-parisc/timex.h20
-rw-r--r--include/asm-parisc/tlb.h27
-rw-r--r--include/asm-parisc/tlbflush.h80
-rw-r--r--include/asm-parisc/topology.h6
-rw-r--r--include/asm-parisc/traps.h16
-rw-r--r--include/asm-parisc/types.h36
-rw-r--r--include/asm-parisc/uaccess.h244
-rw-r--r--include/asm-parisc/ucontext.h12
-rw-r--r--include/asm-parisc/unaligned.h16
-rw-r--r--include/asm-parisc/unistd.h991
-rw-r--r--include/asm-parisc/unwind.h77
-rw-r--r--include/asm-parisc/user.h5
-rw-r--r--include/asm-parisc/vga.h6
-rw-r--r--include/asm-parisc/xor.h1
-rw-r--r--include/asm-um/a.out-core.h27
-rw-r--r--include/asm-um/a.out.h11
-rw-r--r--include/asm-um/alternative-asm.h6
-rw-r--r--include/asm-um/alternative.h6
-rw-r--r--include/asm-um/apic.h4
-rw-r--r--include/asm-um/archparam-i386.h26
-rw-r--r--include/asm-um/archparam-ppc.h8
-rw-r--r--include/asm-um/archparam-x86_64.h26
-rw-r--r--include/asm-um/asm.h6
-rw-r--r--include/asm-um/atomic.h11
-rw-r--r--include/asm-um/auxvec.h4
-rw-r--r--include/asm-um/bitops.h10
-rw-r--r--include/asm-um/boot.h6
-rw-r--r--include/asm-um/bug.h6
-rw-r--r--include/asm-um/bugs.h6
-rw-r--r--include/asm-um/byteorder.h6
-rw-r--r--include/asm-um/cache.h17
-rw-r--r--include/asm-um/cacheflush.h6
-rw-r--r--include/asm-um/calling.h9
-rw-r--r--include/asm-um/checksum.h6
-rw-r--r--include/asm-um/cmpxchg.h6
-rw-r--r--include/asm-um/cobalt.h6
-rw-r--r--include/asm-um/common.lds.S130
-rw-r--r--include/asm-um/cpufeature.h6
-rw-r--r--include/asm-um/cputime.h6
-rw-r--r--include/asm-um/current.h13
-rw-r--r--include/asm-um/delay.h20
-rw-r--r--include/asm-um/desc.h16
-rw-r--r--include/asm-um/device.h7
-rw-r--r--include/asm-um/div64.h6
-rw-r--r--include/asm-um/dma-mapping.h121
-rw-r--r--include/asm-um/dma.h10
-rw-r--r--include/asm-um/dwarf2.h11
-rw-r--r--include/asm-um/elf-i386.h163
-rw-r--r--include/asm-um/elf-ppc.h53
-rw-r--r--include/asm-um/elf-x86_64.h119
-rw-r--r--include/asm-um/emergency-restart.h6
-rw-r--r--include/asm-um/errno.h6
-rw-r--r--include/asm-um/fcntl.h6
-rw-r--r--include/asm-um/fixmap.h98
-rw-r--r--include/asm-um/floppy.h6
-rw-r--r--include/asm-um/frame.h6
-rw-r--r--include/asm-um/futex.h6
-rw-r--r--include/asm-um/hardirq.h25
-rw-r--r--include/asm-um/highmem.h12
-rw-r--r--include/asm-um/host_ldt-i386.h34
-rw-r--r--include/asm-um/host_ldt-x86_64.h38
-rw-r--r--include/asm-um/hw_irq.h7
-rw-r--r--include/asm-um/ide.h6
-rw-r--r--include/asm-um/io.h57
-rw-r--r--include/asm-um/ioctl.h6
-rw-r--r--include/asm-um/ioctls.h6
-rw-r--r--include/asm-um/ipcbuf.h6
-rw-r--r--include/asm-um/irq.h23
-rw-r--r--include/asm-um/irq_regs.h1
-rw-r--r--include/asm-um/irq_vectors.h20
-rw-r--r--include/asm-um/irqflags.h6
-rw-r--r--include/asm-um/kdebug.h1
-rw-r--r--include/asm-um/kmap_types.h29
-rw-r--r--include/asm-um/ldt.h37
-rw-r--r--include/asm-um/linkage.h6
-rw-r--r--include/asm-um/local.h6
-rw-r--r--include/asm-um/locks.h6
-rw-r--r--include/asm-um/mca_dma.h6
-rw-r--r--include/asm-um/mman.h6
-rw-r--r--include/asm-um/mmu.h22
-rw-r--r--include/asm-um/mmu_context.h54
-rw-r--r--include/asm-um/module-generic.h6
-rw-r--r--include/asm-um/module-i386.h13
-rw-r--r--include/asm-um/module-x86_64.h30
-rw-r--r--include/asm-um/msgbuf.h6
-rw-r--r--include/asm-um/mtrr.h6
-rw-r--r--include/asm-um/mutex.h9
-rw-r--r--include/asm-um/nops.h6
-rw-r--r--include/asm-um/page.h122
-rw-r--r--include/asm-um/page_offset.h1
-rw-r--r--include/asm-um/param.h20
-rw-r--r--include/asm-um/paravirt.h6
-rw-r--r--include/asm-um/pci.h7
-rw-r--r--include/asm-um/pda.h31
-rw-r--r--include/asm-um/percpu.h6
-rw-r--r--include/asm-um/pgalloc.h72
-rw-r--r--include/asm-um/pgtable-2level.h53
-rw-r--r--include/asm-um/pgtable-3level.h146
-rw-r--r--include/asm-um/pgtable.h358
-rw-r--r--include/asm-um/poll.h6
-rw-r--r--include/asm-um/posix_types.h6
-rw-r--r--include/asm-um/prctl.h6
-rw-r--r--include/asm-um/processor-generic.h136
-rw-r--r--include/asm-um/processor-i386.h78
-rw-r--r--include/asm-um/processor-ppc.h15
-rw-r--r--include/asm-um/processor-x86_64.h56
-rw-r--r--include/asm-um/ptrace-generic.h55
-rw-r--r--include/asm-um/ptrace-i386.h60
-rw-r--r--include/asm-um/ptrace-x86_64.h81
-rw-r--r--include/asm-um/required-features.h9
-rw-r--r--include/asm-um/resource.h6
-rw-r--r--include/asm-um/rwlock.h6
-rw-r--r--include/asm-um/rwsem.h6
-rw-r--r--include/asm-um/scatterlist.h6
-rw-r--r--include/asm-um/sections.h7
-rw-r--r--include/asm-um/segment.h10
-rw-r--r--include/asm-um/sembuf.h6
-rw-r--r--include/asm-um/serial.h6
-rw-r--r--include/asm-um/setup.h10
-rw-r--r--include/asm-um/shmbuf.h6
-rw-r--r--include/asm-um/shmparam.h6
-rw-r--r--include/asm-um/sigcontext-generic.h6
-rw-r--r--include/asm-um/sigcontext-i386.h6
-rw-r--r--include/asm-um/sigcontext-ppc.h10
-rw-r--r--include/asm-um/sigcontext-x86_64.h22
-rw-r--r--include/asm-um/siginfo.h6
-rw-r--r--include/asm-um/signal.h29
-rw-r--r--include/asm-um/smp.h33
-rw-r--r--include/asm-um/socket.h6
-rw-r--r--include/asm-um/sockios.h6
-rw-r--r--include/asm-um/spinlock.h6
-rw-r--r--include/asm-um/spinlock_types.h6
-rw-r--r--include/asm-um/stat.h6
-rw-r--r--include/asm-um/statfs.h6
-rw-r--r--include/asm-um/string.h7
-rw-r--r--include/asm-um/suspend.h4
-rw-r--r--include/asm-um/system-generic.h47
-rw-r--r--include/asm-um/system-i386.h6
-rw-r--r--include/asm-um/system-ppc.h12
-rw-r--r--include/asm-um/system-x86_64.h23
-rw-r--r--include/asm-um/termbits.h6
-rw-r--r--include/asm-um/termios.h6
-rw-r--r--include/asm-um/thread_info.h81
-rw-r--r--include/asm-um/timex.h13
-rw-r--r--include/asm-um/tlb.h127
-rw-r--r--include/asm-um/tlbflush.h31
-rw-r--r--include/asm-um/topology.h6
-rw-r--r--include/asm-um/types.h6
-rw-r--r--include/asm-um/uaccess.h99
-rw-r--r--include/asm-um/ucontext.h6
-rw-r--r--include/asm-um/unaligned.h6
-rw-r--r--include/asm-um/unistd.h41
-rw-r--r--include/asm-um/user.h6
-rw-r--r--include/asm-um/vga.h6
-rw-r--r--include/asm-um/vm-flags-i386.h14
-rw-r--r--include/asm-um/vm-flags-x86_64.h33
-rw-r--r--include/asm-um/vm86.h6
-rw-r--r--include/asm-um/xor.h6
-rw-r--r--include/asm-x86/Kbuild24
-rw-r--r--include/asm-x86/a.out-core.h73
-rw-r--r--include/asm-x86/a.out.h20
-rw-r--r--include/asm-x86/acpi.h178
-rw-r--r--include/asm-x86/agp.h35
-rw-r--r--include/asm-x86/alternative-asm.h22
-rw-r--r--include/asm-x86/alternative.h183
-rw-r--r--include/asm-x86/amd_iommu.h32
-rw-r--r--include/asm-x86/amd_iommu_types.h344
-rw-r--r--include/asm-x86/apic.h131
-rw-r--r--include/asm-x86/apicdef.h414
-rw-r--r--include/asm-x86/arch_hooks.h28
-rw-r--r--include/asm-x86/asm.h42
-rw-r--r--include/asm-x86/atomic.h5
-rw-r--r--include/asm-x86/atomic_32.h259
-rw-r--r--include/asm-x86/atomic_64.h473
-rw-r--r--include/asm-x86/auxvec.h12
-rw-r--r--include/asm-x86/bios_ebda.h19
-rw-r--r--include/asm-x86/bitops.h461
-rw-r--r--include/asm-x86/boot.h28
-rw-r--r--include/asm-x86/bootparam.h111
-rw-r--r--include/asm-x86/bug.h39
-rw-r--r--include/asm-x86/bugs.h7
-rw-r--r--include/asm-x86/byteorder.h81
-rw-r--r--include/asm-x86/cache.h20
-rw-r--r--include/asm-x86/cacheflush.h115
-rw-r--r--include/asm-x86/calgary.h72
-rw-r--r--include/asm-x86/calling.h170
-rw-r--r--include/asm-x86/checksum.h5
-rw-r--r--include/asm-x86/checksum_32.h189
-rw-r--r--include/asm-x86/checksum_64.h191
-rw-r--r--include/asm-x86/cmpxchg.h5
-rw-r--r--include/asm-x86/cmpxchg_32.h344
-rw-r--r--include/asm-x86/cmpxchg_64.h185
-rw-r--r--include/asm-x86/compat.h218
-rw-r--r--include/asm-x86/cpu.h20
-rw-r--r--include/asm-x86/cpufeature.h227
-rw-r--r--include/asm-x86/cputime.h1
-rw-r--r--include/asm-x86/current.h39
-rw-r--r--include/asm-x86/debugreg.h70
-rw-r--r--include/asm-x86/delay.h31
-rw-r--r--include/asm-x86/desc.h400
-rw-r--r--include/asm-x86/desc_defs.h95
-rw-r--r--include/asm-x86/device.h16
-rw-r--r--include/asm-x86/div64.h60
-rw-r--r--include/asm-x86/dma-mapping.h253
-rw-r--r--include/asm-x86/dma.h318
-rw-r--r--include/asm-x86/dmi.h26
-rw-r--r--include/asm-x86/ds.h72
-rw-r--r--include/asm-x86/dwarf2.h61
-rw-r--r--include/asm-x86/e820.h143
-rw-r--r--include/asm-x86/edac.h18
-rw-r--r--include/asm-x86/efi.h97
-rw-r--r--include/asm-x86/elf.h335
-rw-r--r--include/asm-x86/emergency-restart.h18
-rw-r--r--include/asm-x86/errno.h1
-rw-r--r--include/asm-x86/fb.h21
-rw-r--r--include/asm-x86/fcntl.h1
-rw-r--r--include/asm-x86/fixmap.h68
-rw-r--r--include/asm-x86/fixmap_32.h123
-rw-r--r--include/asm-x86/fixmap_64.h83
-rw-r--r--include/asm-x86/floppy.h281
-rw-r--r--include/asm-x86/frame.h27
-rw-r--r--include/asm-x86/ftrace.h14
-rw-r--r--include/asm-x86/futex.h140
-rw-r--r--include/asm-x86/gart.h71
-rw-r--r--include/asm-x86/genapic.h5
-rw-r--r--include/asm-x86/genapic_32.h124
-rw-r--r--include/asm-x86/genapic_64.h50
-rw-r--r--include/asm-x86/geode.h253
-rw-r--r--include/asm-x86/gpio.h56
-rw-r--r--include/asm-x86/hardirq.h11
-rw-r--r--include/asm-x86/hardirq_32.h28
-rw-r--r--include/asm-x86/hardirq_64.h23
-rw-r--r--include/asm-x86/highmem.h82
-rw-r--r--include/asm-x86/hpet.h93
-rw-r--r--include/asm-x86/hugetlb.h93
-rw-r--r--include/asm-x86/hw_irq.h115
-rw-r--r--include/asm-x86/hypertransport.h45
-rw-r--r--include/asm-x86/i387.h339
-rw-r--r--include/asm-x86/i8253.h18
-rw-r--r--include/asm-x86/i8259.h60
-rw-r--r--include/asm-x86/ia32.h170
-rw-r--r--include/asm-x86/ia32_unistd.h18
-rw-r--r--include/asm-x86/idle.h15
-rw-r--r--include/asm-x86/intel_arch_perfmon.h31
-rw-r--r--include/asm-x86/io.h102
-rw-r--r--include/asm-x86/io_32.h284
-rw-r--r--include/asm-x86/io_64.h248
-rw-r--r--include/asm-x86/io_apic.h192
-rw-r--r--include/asm-x86/ioctl.h1
-rw-r--r--include/asm-x86/ioctls.h88
-rw-r--r--include/asm-x86/iommu.h45
-rw-r--r--include/asm-x86/ipcbuf.h28
-rw-r--r--include/asm-x86/ipi.h132
-rw-r--r--include/asm-x86/irq.h50
-rw-r--r--include/asm-x86/irq_regs.h5
-rw-r--r--include/asm-x86/irq_regs_32.h29
-rw-r--r--include/asm-x86/irq_regs_64.h1
-rw-r--r--include/asm-x86/irq_vectors.h182
-rw-r--r--include/asm-x86/irqflags.h232
-rw-r--r--include/asm-x86/ist.h34
-rw-r--r--include/asm-x86/k8.h15
-rw-r--r--include/asm-x86/kdebug.h38
-rw-r--r--include/asm-x86/kexec.h175
-rw-r--r--include/asm-x86/kgdb.h79
-rw-r--r--include/asm-x86/kmap_types.h29
-rw-r--r--include/asm-x86/kprobes.h97
-rw-r--r--include/asm-x86/kvm.h233
-rw-r--r--include/asm-x86/kvm_host.h738
-rw-r--r--include/asm-x86/kvm_para.h147
-rw-r--r--include/asm-x86/kvm_x86_emulate.h184
-rw-r--r--include/asm-x86/ldt.h40
-rw-r--r--include/asm-x86/lguest.h94
-rw-r--r--include/asm-x86/lguest_hcall.h71
-rw-r--r--include/asm-x86/linkage.h61
-rw-r--r--include/asm-x86/local.h235
-rw-r--r--include/asm-x86/mach-bigsmp/mach_apic.h144
-rw-r--r--include/asm-x86/mach-bigsmp/mach_apicdef.h13
-rw-r--r--include/asm-x86/mach-bigsmp/mach_ipi.h25
-rw-r--r--include/asm-x86/mach-default/apm.h73
-rw-r--r--include/asm-x86/mach-default/do_timer.h16
-rw-r--r--include/asm-x86/mach-default/entry_arch.h35
-rw-r--r--include/asm-x86/mach-default/mach_apic.h141
-rw-r--r--include/asm-x86/mach-default/mach_apicdef.h24
-rw-r--r--include/asm-x86/mach-default/mach_ipi.h64
-rw-r--r--include/asm-x86/mach-default/mach_mpparse.h17
-rw-r--r--include/asm-x86/mach-default/mach_mpspec.h12
-rw-r--r--include/asm-x86/mach-default/mach_timer.h48
-rw-r--r--include/asm-x86/mach-default/mach_traps.h39
-rw-r--r--include/asm-x86/mach-default/mach_wakecpu.h42
-rw-r--r--include/asm-x86/mach-default/pci-functions.h19
-rw-r--r--include/asm-x86/mach-default/setup_arch.h3
-rw-r--r--include/asm-x86/mach-default/smpboot_hooks.h59
-rw-r--r--include/asm-x86/mach-es7000/mach_apic.h194
-rw-r--r--include/asm-x86/mach-es7000/mach_apicdef.h13
-rw-r--r--include/asm-x86/mach-es7000/mach_ipi.h24
-rw-r--r--include/asm-x86/mach-es7000/mach_mpparse.h29
-rw-r--r--include/asm-x86/mach-es7000/mach_wakecpu.h59
-rw-r--r--include/asm-x86/mach-generic/gpio.h15
-rw-r--r--include/asm-x86/mach-generic/irq_vectors_limits.h14
-rw-r--r--include/asm-x86/mach-generic/mach_apic.h32
-rw-r--r--include/asm-x86/mach-generic/mach_apicdef.h11
-rw-r--r--include/asm-x86/mach-generic/mach_ipi.h10
-rw-r--r--include/asm-x86/mach-generic/mach_mpparse.h10
-rw-r--r--include/asm-x86/mach-generic/mach_mpspec.h12
-rw-r--r--include/asm-x86/mach-numaq/mach_apic.h138
-rw-r--r--include/asm-x86/mach-numaq/mach_apicdef.h14
-rw-r--r--include/asm-x86/mach-numaq/mach_ipi.h25
-rw-r--r--include/asm-x86/mach-numaq/mach_mpparse.h7
-rw-r--r--include/asm-x86/mach-numaq/mach_wakecpu.h43
-rw-r--r--include/asm-x86/mach-rdc321x/gpio.h57
-rw-r--r--include/asm-x86/mach-rdc321x/rdc321x_defs.h12
-rw-r--r--include/asm-x86/mach-summit/irq_vectors_limits.h14
-rw-r--r--include/asm-x86/mach-summit/mach_apic.h185
-rw-r--r--include/asm-x86/mach-summit/mach_apicdef.h13
-rw-r--r--include/asm-x86/mach-summit/mach_ipi.h25
-rw-r--r--include/asm-x86/mach-summit/mach_mpparse.h110
-rw-r--r--include/asm-x86/mach-voyager/do_timer.h17
-rw-r--r--include/asm-x86/mach-voyager/entry_arch.h26
-rw-r--r--include/asm-x86/mach-voyager/setup_arch.h12
-rw-r--r--include/asm-x86/math_emu.h31
-rw-r--r--include/asm-x86/mc146818rtc.h104
-rw-r--r--include/asm-x86/mca.h43
-rw-r--r--include/asm-x86/mca_dma.h201
-rw-r--r--include/asm-x86/mce.h130
-rw-r--r--include/asm-x86/mman.h20
-rw-r--r--include/asm-x86/mmconfig.h12
-rw-r--r--include/asm-x86/mmu.h31
-rw-r--r--include/asm-x86/mmu_context.h37
-rw-r--r--include/asm-x86/mmu_context_32.h56
-rw-r--r--include/asm-x86/mmu_context_64.h54
-rw-r--r--include/asm-x86/mmx.h14
-rw-r--r--include/asm-x86/mmzone.h5
-rw-r--r--include/asm-x86/mmzone_32.h134
-rw-r--r--include/asm-x86/mmzone_64.h52
-rw-r--r--include/asm-x86/module.h82
-rw-r--r--include/asm-x86/mpspec.h144
-rw-r--r--include/asm-x86/mpspec_def.h180
-rw-r--r--include/asm-x86/msgbuf.h39
-rw-r--r--include/asm-x86/msidef.h51
-rw-r--r--include/asm-x86/msr-index.h313
-rw-r--r--include/asm-x86/msr.h224
-rw-r--r--include/asm-x86/mtrr.h173
-rw-r--r--include/asm-x86/mutex.h5
-rw-r--r--include/asm-x86/mutex_32.h125
-rw-r--r--include/asm-x86/mutex_64.h100
-rw-r--r--include/asm-x86/nmi.h84
-rw-r--r--include/asm-x86/nops.h118
-rw-r--r--include/asm-x86/numa.h5
-rw-r--r--include/asm-x86/numa_32.h11
-rw-r--r--include/asm-x86/numa_64.h43
-rw-r--r--include/asm-x86/numaq.h169
-rw-r--r--include/asm-x86/olpc.h132
-rw-r--r--include/asm-x86/page.h202
-rw-r--r--include/asm-x86/page_32.h129
-rw-r--r--include/asm-x86/page_64.h105
-rw-r--r--include/asm-x86/param.h22
-rw-r--r--include/asm-x86/paravirt.h1637
-rw-r--r--include/asm-x86/parport.h10
-rw-r--r--include/asm-x86/pat.h22
-rw-r--r--include/asm-x86/pci-direct.h21
-rw-r--r--include/asm-x86/pci.h114
-rw-r--r--include/asm-x86/pci_32.h34
-rw-r--r--include/asm-x86/pci_64.h66
-rw-r--r--include/asm-x86/pda.h137
-rw-r--r--include/asm-x86/percpu.h218
-rw-r--r--include/asm-x86/pgalloc.h114
-rw-r--r--include/asm-x86/pgtable-2level-defs.h20
-rw-r--r--include/asm-x86/pgtable-2level.h81
-rw-r--r--include/asm-x86/pgtable-3level-defs.h28
-rw-r--r--include/asm-x86/pgtable-3level.h182
-rw-r--r--include/asm-x86/pgtable.h524
-rw-r--r--include/asm-x86/pgtable_32.h189
-rw-r--r--include/asm-x86/pgtable_64.h287
-rw-r--r--include/asm-x86/poll.h1
-rw-r--r--include/asm-x86/posix_types.h13
-rw-r--r--include/asm-x86/posix_types_32.h85
-rw-r--r--include/asm-x86/posix_types_64.h119
-rw-r--r--include/asm-x86/prctl.h10
-rw-r--r--include/asm-x86/processor-cyrix.h30
-rw-r--r--include/asm-x86/processor-flags.h99
-rw-r--r--include/asm-x86/processor.h946
-rw-r--r--include/asm-x86/proto.h32
-rw-r--r--include/asm-x86/ptrace-abi.h143
-rw-r--r--include/asm-x86/ptrace.h242
-rw-r--r--include/asm-x86/pvclock-abi.h42
-rw-r--r--include/asm-x86/pvclock.h13
-rw-r--r--include/asm-x86/reboot.h21
-rw-r--r--include/asm-x86/reboot_fixups.h6
-rw-r--r--include/asm-x86/required-features.h82
-rw-r--r--include/asm-x86/resource.h1
-rw-r--r--include/asm-x86/resume-trace.h21
-rw-r--r--include/asm-x86/rio.h63
-rw-r--r--include/asm-x86/rtc.h1
-rw-r--r--include/asm-x86/rwlock.h8
-rw-r--r--include/asm-x86/rwsem.h265
-rw-r--r--include/asm-x86/scatterlist.h33
-rw-r--r--include/asm-x86/seccomp.h5
-rw-r--r--include/asm-x86/seccomp_32.h17
-rw-r--r--include/asm-x86/seccomp_64.h25
-rw-r--r--include/asm-x86/sections.h1
-rw-r--r--include/asm-x86/segment.h215
-rw-r--r--include/asm-x86/sembuf.h24
-rw-r--r--include/asm-x86/serial.h29
-rw-r--r--include/asm-x86/setup.h103
-rw-r--r--include/asm-x86/shmbuf.h51
-rw-r--r--include/asm-x86/shmparam.h6
-rw-r--r--include/asm-x86/sigcontext.h205
-rw-r--r--include/asm-x86/sigcontext32.h71
-rw-r--r--include/asm-x86/siginfo.h10
-rw-r--r--include/asm-x86/signal.h259
-rw-r--r--include/asm-x86/smp.h208
-rw-r--r--include/asm-x86/socket.h57
-rw-r--r--include/asm-x86/sockios.h13
-rw-r--r--include/asm-x86/sparsemem.h34
-rw-r--r--include/asm-x86/spinlock.h369
-rw-r--r--include/asm-x86/spinlock_types.h20
-rw-r--r--include/asm-x86/srat.h39
-rw-r--r--include/asm-x86/stacktrace.h21
-rw-r--r--include/asm-x86/stat.h114
-rw-r--r--include/asm-x86/statfs.h63
-rw-r--r--include/asm-x86/string.h5
-rw-r--r--include/asm-x86/string_32.h326
-rw-r--r--include/asm-x86/string_64.h60
-rw-r--r--include/asm-x86/suspend.h5
-rw-r--r--include/asm-x86/suspend_32.h51
-rw-r--r--include/asm-x86/suspend_64.h52
-rw-r--r--include/asm-x86/swiotlb.h58
-rw-r--r--include/asm-x86/sync_bitops.h130
-rw-r--r--include/asm-x86/system.h422
-rw-r--r--include/asm-x86/system_64.h22
-rw-r--r--include/asm-x86/tce.h48
-rw-r--r--include/asm-x86/termbits.h198
-rw-r--r--include/asm-x86/termios.h113
-rw-r--r--include/asm-x86/therm_throt.h9
-rw-r--r--include/asm-x86/thread_info.h261
-rw-r--r--include/asm-x86/time.h61
-rw-r--r--include/asm-x86/timer.h63
-rw-r--r--include/asm-x86/timex.h19
-rw-r--r--include/asm-x86/tlb.h11
-rw-r--r--include/asm-x86/tlbflush.h168
-rw-r--r--include/asm-x86/topology.h258
-rw-r--r--include/asm-x86/trampoline.h21
-rw-r--r--include/asm-x86/traps.h66
-rw-r--r--include/asm-x86/tsc.h62
-rw-r--r--include/asm-x86/types.h36
-rw-r--r--include/asm-x86/uaccess.h454
-rw-r--r--include/asm-x86/uaccess_32.h218
-rw-r--r--include/asm-x86/uaccess_64.h202
-rw-r--r--include/asm-x86/ucontext.h12
-rw-r--r--include/asm-x86/unaligned.h14
-rw-r--r--include/asm-x86/unistd.h13
-rw-r--r--include/asm-x86/unistd_32.h379
-rw-r--r--include/asm-x86/unistd_64.h693
-rw-r--r--include/asm-x86/unwind.h13
-rw-r--r--include/asm-x86/user.h5
-rw-r--r--include/asm-x86/user32.h70
-rw-r--r--include/asm-x86/user_32.h131
-rw-r--r--include/asm-x86/user_64.h137
-rw-r--r--include/asm-x86/uv/bios.h68
-rw-r--r--include/asm-x86/uv/uv_bau.h332
-rw-r--r--include/asm-x86/uv/uv_hub.h354
-rw-r--r--include/asm-x86/uv/uv_mmrs.h1295
-rw-r--r--include/asm-x86/vdso.h47
-rw-r--r--include/asm-x86/vga.h20
-rw-r--r--include/asm-x86/vgtod.h29
-rw-r--r--include/asm-x86/vic.h61
-rw-r--r--include/asm-x86/visws/cobalt.h125
-rw-r--r--include/asm-x86/visws/lithium.h53
-rw-r--r--include/asm-x86/visws/piix4.h107
-rw-r--r--include/asm-x86/visws/sgivw.h5
-rw-r--r--include/asm-x86/vm86.h208
-rw-r--r--include/asm-x86/vmi.h263
-rw-r--r--include/asm-x86/vmi_time.h98
-rw-r--r--include/asm-x86/voyager.h528
-rw-r--r--include/asm-x86/vsyscall.h44
-rw-r--r--include/asm-x86/xen/events.h24
-rw-r--r--include/asm-x86/xen/grant_table.h7
-rw-r--r--include/asm-x86/xen/hypercall.h527
-rw-r--r--include/asm-x86/xen/hypervisor.h72
-rw-r--r--include/asm-x86/xen/interface.h175
-rw-r--r--include/asm-x86/xen/interface_32.h97
-rw-r--r--include/asm-x86/xen/interface_64.h159
-rw-r--r--include/asm-x86/xen/page.h165
-rw-r--r--include/asm-x86/xor.h5
-rw-r--r--include/asm-x86/xor_32.h888
-rw-r--r--include/asm-x86/xor_64.h361
-rw-r--r--include/asm-xtensa/a.out.h29
-rw-r--r--include/asm-xtensa/elf.h2
-rw-r--r--include/asm-xtensa/io.h8
-rw-r--r--include/asm-xtensa/rwsem.h4
-rw-r--r--include/asm-xtensa/thread_info.h2
-rw-r--r--include/asm-xtensa/variant-dc232b/core.h424
-rw-r--r--include/asm-xtensa/variant-dc232b/tie-asm.h122
-rw-r--r--include/asm-xtensa/variant-dc232b/tie.h131
-rw-r--r--include/crypto/internal/rng.h26
-rw-r--r--include/crypto/internal/skcipher.h6
-rw-r--r--include/crypto/rng.h75
-rw-r--r--include/drm/drm.h63
-rw-r--r--include/drm/drmP.h249
-rw-r--r--include/drm/drm_pciids.h54
-rw-r--r--include/drm/i915_drm.h333
-rw-r--r--include/linux/Kbuild6
-rw-r--r--include/linux/acpi.h8
-rw-r--r--include/linux/aer.h5
-rw-r--r--include/linux/aio.h9
-rw-r--r--include/linux/ata.h127
-rw-r--r--include/linux/auto_dev-ioctl.h157
-rw-r--r--include/linux/auto_fs4.h7
-rw-r--r--include/linux/backing-dev.h13
-rw-r--r--include/linux/bcd.h16
-rw-r--r--include/linux/binfmts.h5
-rw-r--r--include/linux/bio.h129
-rw-r--r--include/linux/bitmap.h2
-rw-r--r--include/linux/blkdev.h194
-rw-r--r--include/linux/blktrace_api.h94
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/byteorder/Kbuild1
-rw-r--r--include/linux/byteorder/big_endian.h1
-rw-r--r--include/linux/byteorder/little_endian.h1
-rw-r--r--include/linux/cdrom.h10
-rw-r--r--include/linux/cgroup.h31
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/clk.h4
-rw-r--r--include/linux/clocksource.h14
-rw-r--r--include/linux/compat.h6
-rw-r--r--include/linux/compiler.h6
-rw-r--r--include/linux/completion.h41
-rw-r--r--include/linux/console_struct.h1
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h7
-rw-r--r--include/linux/crash_dump.h40
-rw-r--r--include/linux/crypto.h35
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/device-mapper.h30
-rw-r--r--include/linux/device.h34
-rw-r--r--include/linux/devpts_fs.h31
-rw-r--r--include/linux/dlm.h5
-rw-r--r--include/linux/dlm_device.h2
-rw-r--r--include/linux/dm-region-hash.h104
-rw-r--r--include/linux/dma-mapping.h12
-rw-r--r--include/linux/dma_remapping.h156
-rw-r--r--include/linux/dmar.h126
-rw-r--r--include/linux/dmi.h41
-rw-r--r--include/linux/ds1286.h2
-rw-r--r--include/linux/dvb/frontend.h112
-rw-r--r--include/linux/dvb/version.h4
-rw-r--r--include/linux/dynamic_printk.h93
-rw-r--r--include/linux/efi.h4
-rw-r--r--include/linux/elevator.h9
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/ext2_fs.h2
-rw-r--r--include/linux/ext3_fs.h8
-rw-r--r--include/linux/ext3_jbd.h14
-rw-r--r--include/linux/fb.h1
-rw-r--r--include/linux/fd.h8
-rw-r--r--include/linux/fiemap.h64
-rw-r--r--include/linux/file.h4
-rw-r--r--include/linux/freezer.h43
-rw-r--r--include/linux/fs.h153
-rw-r--r--include/linux/fsnotify.h2
-rw-r--r--include/linux/ftrace.h84
-rw-r--r--include/linux/fuse.h12
-rw-r--r--include/linux/gameport.h7
-rw-r--r--include/linux/genhd.h366
-rw-r--r--include/linux/gfs2_ondisk.h6
-rw-r--r--include/linux/gpio.h3
-rw-r--r--include/linux/hid.h379
-rw-r--r--include/linux/hiddev.h46
-rw-r--r--include/linux/hpet.h14
-rw-r--r--include/linux/hrtimer.h115
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/i2c-algo-pcf.h5
-rw-r--r--include/linux/i2c-id.h3
-rw-r--r--include/linux/i2c.h163
-rw-r--r--include/linux/i2c/twl4030.h343
-rw-r--r--include/linux/i2o.h292
-rw-r--r--include/linux/i7300_idle.h83
-rw-r--r--include/linux/icmpv6.h6
-rw-r--r--include/linux/ide.h922
-rw-r--r--include/linux/ieee80211.h36
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_ether.h8
-rw-r--r--include/linux/if_fddi.h2
-rw-r--r--include/linux/if_hippi.h2
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_phonet.h19
-rw-r--r--include/linux/if_tunnel.h19
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h6
-rw-r--r--include/linux/init_task.h1
-rw-r--r--include/linux/input.h15
-rw-r--r--include/linux/intel-iommu.h363
-rw-r--r--include/linux/interrupt.h24
-rw-r--r--include/linux/iommu-helper.h19
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/iova.h52
-rw-r--r--include/linux/ip_vs.h160
-rw-r--r--include/linux/irq.h57
-rw-r--r--include/linux/irqnr.h24
-rw-r--r--include/linux/isdn_ppp.h2
-rw-r--r--include/linux/ivtv.h1
-rw-r--r--include/linux/jbd.h9
-rw-r--r--include/linux/jbd2.h21
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/kallsyms.h8
-rw-r--r--include/linux/kernel.h67
-rw-r--r--include/linux/kernel_stat.h21
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/klist.h3
-rw-r--r--include/linux/kmod.h3
-rw-r--r--include/linux/kprobes.h5
-rw-r--r--include/linux/kvm.h72
-rw-r--r--include/linux/kvm_host.h82
-rw-r--r--include/linux/lcd.h3
-rw-r--r--include/linux/leds.h4
-rw-r--r--include/linux/libata.h70
-rw-r--r--include/linux/linkage.h2
-rw-r--r--include/linux/lockd/bind.h11
-rw-r--r--include/linux/lockd/lockd.h137
-rw-r--r--include/linux/lockd/xdr.h2
-rw-r--r--include/linux/magic.h4
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/map_to_7segment.h187
-rw-r--r--include/linux/marker.h7
-rw-r--r--include/linux/memcontrol.h34
-rw-r--r--include/linux/mfd/da903x.h201
-rw-r--r--include/linux/mfd/t7l66xb.h2
-rw-r--r--include/linux/mfd/tc6387xb.h3
-rw-r--r--include/linux/mfd/tc6393xb.h17
-rw-r--r--include/linux/mfd/tmio.h19
-rw-r--r--include/linux/mfd/wm8350/audio.h598
-rw-r--r--include/linux/mfd/wm8350/comparator.h167
-rw-r--r--include/linux/mfd/wm8350/core.h631
-rw-r--r--include/linux/mfd/wm8350/gpio.h342
-rw-r--r--include/linux/mfd/wm8350/pmic.h741
-rw-r--r--include/linux/mfd/wm8350/rtc.h266
-rw-r--r--include/linux/mfd/wm8350/supply.h111
-rw-r--r--include/linux/mfd/wm8350/wdt.h28
-rw-r--r--include/linux/mfd/wm8400-audio.h1186
-rw-r--r--include/linux/mfd/wm8400-private.h936
-rw-r--r--include/linux/mfd/wm8400.h40
-rw-r--r--include/linux/migrate.h3
-rw-r--r--include/linux/mlx4/cmd.h9
-rw-r--r--include/linux/mlx4/device.h54
-rw-r--r--include/linux/mm.h22
-rw-r--r--include/linux/mm_inline.h98
-rw-r--r--include/linux/mm_types.h13
-rw-r--r--include/linux/mmc/host.h2
-rw-r--r--include/linux/mmdebug.h18
-rw-r--r--include/linux/mmiotrace.h20
-rw-r--r--include/linux/mmzone.h105
-rw-r--r--include/linux/mod_devicetable.h59
-rw-r--r--include/linux/module.h24
-rw-r--r--include/linux/moduleparam.h25
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/mtd/blktrans.h2
-rw-r--r--include/linux/mtd/cfi.h9
-rw-r--r--include/linux/mtd/flashchip.h4
-rw-r--r--include/linux/mtd/mtd.h4
-rw-r--r--include/linux/mtd/nand-gpio.h19
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/onenand_regs.h2
-rw-r--r--include/linux/mtd/partitions.h1
-rw-r--r--include/linux/mtd/sh_flctl.h125
-rw-r--r--include/linux/mv643xx_eth.h13
-rw-r--r--include/linux/namei.h8
-rw-r--r--include/linux/netdevice.h45
-rw-r--r--include/linux/netfilter.h97
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h2
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/x_tables.h161
-rw-r--r--include/linux/netfilter/xt_TPROXY.h14
-rw-r--r--include/linux/netfilter/xt_recent.h26
-rw-r--r--include/linux/netfilter_bridge/ebtables.h76
-rw-r--r--include/linux/netfilter_ipv4/ipt_recent.h28
-rw-r--r--include/linux/nfs_fs.h27
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_mount.h4
-rw-r--r--include/linux/nfs_xdr.h11
-rw-r--r--include/linux/nfsd/nfsd.h3
-rw-r--r--include/linux/nl80211.h133
-rw-r--r--include/linux/notifier.h10
-rw-r--r--include/linux/of.h3
-rw-r--r--include/linux/oprofile.h18
-rw-r--r--include/linux/page-flags.h55
-rw-r--r--include/linux/page_cgroup.h108
-rw-r--r--include/linux/pagemap.h44
-rw-r--r--include/linux/pagevec.h34
-rw-r--r--include/linux/parport.h2
-rw-r--r--include/linux/parser.h2
-rw-r--r--include/linux/pci.h46
-rw-r--r--include/linux/pci_hotplug.h11
-rw-r--r--include/linux/pci_ids.h43
-rw-r--r--include/linux/pci_regs.h16
-rw-r--r--include/linux/percpu.h7
-rw-r--r--include/linux/percpu_counter.h12
-rw-r--r--include/linux/pfkeyv2.h13
-rw-r--r--include/linux/pfn.h6
-rw-r--r--include/linux/phonet.h171
-rw-r--r--include/linux/phy.h52
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pnp.h16
-rw-r--r--include/linux/poll.h8
-rw-r--r--include/linux/posix-timers.h4
-rw-r--r--include/linux/power_supply.h6
-rw-r--r--include/linux/prctl.h7
-rw-r--r--include/linux/proc_fs.h6
-rw-r--r--include/linux/profile.h13
-rw-r--r--include/linux/proportions.h2
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/quota.h2
-rw-r--r--include/linux/quotaops.h3
-rw-r--r--include/linux/raid/linear.h10
-rw-r--r--include/linux/raid/md.h32
-rw-r--r--include/linux/raid/md_k.h8
-rw-r--r--include/linux/rcuclassic.h37
-rw-r--r--include/linux/rculist.h14
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/rcupreempt.h11
-rw-r--r--include/linux/regulator/driver.h10
-rw-r--r--include/linux/regulator/machine.h30
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_fs_sb.h1
-rw-r--r--include/linux/rfkill.h7
-rw-r--r--include/linux/ring_buffer.h127
-rw-r--r--include/linux/rmap.h29
-rw-r--r--include/linux/rtc/m48t59.h47
-rw-r--r--include/linux/rtmutex.h2
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/sched.h124
-rw-r--r--include/linux/security.h54
-rw-r--r--include/linux/seq_file.h13
-rw-r--r--include/linux/serial.h16
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/sh_intc.h91
-rw-r--r--include/linux/skbuff.h175
-rw-r--r--include/linux/slab.h5
-rw-r--r--include/linux/smc911x.h1
-rw-r--r--include/linux/smc91x.h11
-rw-r--r--include/linux/smp.h4
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spi/corgi_lcd.h20
-rw-r--r--include/linux/spi/orion_spi.h1
-rw-r--r--include/linux/ssb/ssb_regs.h19
-rw-r--r--include/linux/string_helpers.h16
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/svc.h19
-rw-r--r--include/linux/sunrpc/svc_rdma.h27
-rw-r--r--include/linux/sunrpc/svcsock.h5
-rw-r--r--include/linux/sunrpc/xprtrdma.h4
-rw-r--r--include/linux/swab.h10
-rw-r--r--include/linux/swap.h69
-rw-r--r--include/linux/swiotlb.h83
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h41
-rw-r--r--include/linux/task_io_accounting.h2
-rw-r--r--include/linux/tc_act/Kbuild1
-rw-r--r--include/linux/tc_act/tc_skbedit.h44
-rw-r--r--include/linux/tcp.h12
-rw-r--r--include/linux/telephony.h4
-rw-r--r--include/linux/termios.h15
-rw-r--r--include/linux/thread_info.h8
-rw-r--r--include/linux/tick.h9
-rw-r--r--include/linux/time.h11
-rw-r--r--include/linux/timex.h11
-rw-r--r--include/linux/tracepoint.h137
-rw-r--r--include/linux/tty.h45
-rw-r--r--include/linux/tty_driver.h56
-rw-r--r--include/linux/types.h9
-rw-r--r--include/linux/ucb1400.h161
-rw-r--r--include/linux/usb.h7
-rw-r--r--include/linux/usb/Kbuild3
-rw-r--r--include/linux/usb/cdc.h9
-rw-r--r--include/linux/usb/composite.h11
-rw-r--r--include/linux/usb/ehci_def.h160
-rw-r--r--include/linux/usb/serial.h2
-rw-r--r--include/linux/usb/tmc.h43
-rw-r--r--include/linux/usb/vstusb.h71
-rw-r--r--include/linux/usb/wusb-wa.h271
-rw-r--r--include/linux/usb/wusb.h376
-rw-r--r--include/linux/uwb.h765
-rw-r--r--include/linux/uwb/debug-cmd.h57
-rw-r--r--include/linux/uwb/debug.h82
-rw-r--r--include/linux/uwb/spec.h727
-rw-r--r--include/linux/uwb/umc.h194
-rw-r--r--include/linux/uwb/whci.h117
-rw-r--r--include/linux/videodev2.h37
-rw-r--r--include/linux/vmalloc.h17
-rw-r--r--include/linux/vmstat.h24
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/wait.h9
-rw-r--r--include/linux/wlp.h735
-rw-r--r--include/linux/wm97xx_batt.h26
-rw-r--r--include/linux/workqueue.h18
-rw-r--r--include/linux/writeback.h10
-rw-r--r--include/linux/xfrm.h10
-rw-r--r--include/math-emu/op-2.h2
-rw-r--r--include/math-emu/op-common.h31
-rw-r--r--include/math-emu/soft-fp.h19
-rw-r--r--include/media/ir-common.h11
-rw-r--r--include/media/saa7115.h19
-rw-r--r--include/media/saa7146.h4
-rw-r--r--include/media/sh_mobile_ceu.h2
-rw-r--r--include/media/soc_camera.h3
-rw-r--r--include/media/soc_camera_platform.h11
-rw-r--r--include/media/tuner.h4
-rw-r--r--include/media/v4l2-chip-ident.h5
-rw-r--r--include/media/v4l2-common.h15
-rw-r--r--include/media/v4l2-dev.h75
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h11
-rw-r--r--include/media/v4l2-i2c-drv.h11
-rw-r--r--include/media/v4l2-int-device.h28
-rw-r--r--include/media/v4l2-ioctl.h29
-rw-r--r--include/media/videobuf-dvb.h30
-rw-r--r--include/net/9p/9p.h121
-rw-r--r--include/net/9p/client.h126
-rw-r--r--include/net/9p/transport.h55
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--include/net/cfg80211.h89
-rw-r--r--include/net/cipso_ipv4.h55
-rw-r--r--include/net/dsa.h37
-rw-r--r--include/net/flow.h2
-rw-r--r--include/net/ieee80211.h6
-rw-r--r--include/net/inet6_hashtables.h15
-rw-r--r--include/net/inet_connection_sock.h2
-rw-r--r--include/net/inet_hashtables.h18
-rw-r--r--include/net/inet_sock.h20
-rw-r--r--include/net/inet_timewait_sock.h3
-rw-r--r--include/net/ip.h15
-rw-r--r--include/net/ip_vs.h315
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h47
-rw-r--r--include/net/irda/irda.h2
-rw-r--r--include/net/mac80211.h242
-rw-r--r--include/net/ndisc.h5
-rw-r--r--include/net/net_namespace.h6
-rw-r--r--include/net/netfilter/ipv4/nf_defrag_ipv4.h6
-rw-r--r--include/net/netfilter/nf_conntrack.h34
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h10
-rw-r--r--include/net/netfilter/nf_conntrack_core.h11
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h29
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h22
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h21
-rw-r--r--include/net/netfilter/nf_log.h8
-rw-r--r--include/net/netfilter/nf_nat_core.h8
-rw-r--r--include/net/netfilter/nf_queue.h6
-rw-r--r--include/net/netfilter/nf_tproxy_core.h32
-rw-r--r--include/net/netlabel.h51
-rw-r--r--include/net/netlink.h82
-rw-r--r--include/net/netns/conntrack.h30
-rw-r--r--include/net/netns/ipv4.h3
-rw-r--r--include/net/netns/mib.h9
-rw-r--r--include/net/netns/x_tables.h4
-rw-r--r--include/net/phonet/gprs.h38
-rw-r--r--include/net/phonet/pep.h160
-rw-r--r--include/net/phonet/phonet.h112
-rw-r--r--include/net/phonet/pn_dev.h50
-rw-r--r--include/net/pkt_sched.h5
-rw-r--r--include/net/route.h11
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/constants.h4
-rw-r--r--include/net/sctp/sctp.h12
-rw-r--r--include/net/sctp/sm.h1
-rw-r--r--include/net/sctp/structs.h34
-rw-r--r--include/net/sctp/tsnmap.h53
-rw-r--r--include/net/sock.h19
-rw-r--r--include/net/tc_act/tc_skbedit.h34
-rw-r--r--include/net/tcp.h52
-rw-r--r--include/net/udp.h21
-rw-r--r--include/net/wireless.h65
-rw-r--r--include/net/xfrm.h104
-rw-r--r--include/pcmcia/ciscode.h2
-rw-r--r--include/pcmcia/cistpl.h38
-rw-r--r--include/pcmcia/cs.h165
-rw-r--r--include/pcmcia/cs_types.h8
-rw-r--r--include/pcmcia/device_id.h18
-rw-r--r--include/pcmcia/ds.h411
-rw-r--r--include/pcmcia/ss.h202
-rw-r--r--include/scsi/iscsi_if.h2
-rw-r--r--include/scsi/libiscsi.h15
-rw-r--r--include/scsi/scsi.h6
-rw-r--r--include/scsi/scsi_cmnd.h3
-rw-r--r--include/scsi/scsi_device.h31
-rw-r--r--include/scsi/scsi_host.h9
-rw-r--r--include/scsi/scsi_ioctl.h2
-rw-r--r--include/scsi/scsi_netlink.h62
-rw-r--r--include/scsi/scsi_transport.h3
-rw-r--r--include/scsi/scsi_transport_fc.h31
-rw-r--r--include/scsi/scsi_transport_iscsi.h5
-rw-r--r--include/sound/ad1848.h218
-rw-r--r--include/sound/asound.h52
-rw-r--r--include/sound/asoundef.h89
-rw-r--r--include/sound/core.h35
-rw-r--r--include/sound/cs4231.h175
-rw-r--r--include/sound/jack.h75
-rw-r--r--include/sound/memalloc.h18
-rw-r--r--include/sound/minors.h2
-rw-r--r--include/sound/pcm.h39
-rw-r--r--include/sound/pxa2xx-lib.h45
-rw-r--r--include/sound/sb.h5
-rw-r--r--include/sound/snd_wavefront.h1
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--include/sound/soc-of-simple.h25
-rw-r--r--include/sound/soc.h74
-rw-r--r--include/sound/tea575x-tuner.h1
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/vx_core.h9
-rw-r--r--include/sound/wss.h235
-rw-r--r--include/trace/sched.h56
-rw-r--r--include/video/atmel_lcdc.h1
-rw-r--r--include/video/cyblafb.h2
-rw-r--r--include/video/metronomefb.h31
-rw-r--r--include/video/neomagic.h1
-rw-r--r--include/video/radeon.h23
-rw-r--r--include/video/s1d13xxxfb.h3
-rw-r--r--include/video/sh_mobile_lcdc.h78
-rw-r--r--include/xen/balloon.h61
-rw-r--r--include/xen/events.h2
1560 files changed, 22661 insertions, 119879 deletions
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 4eb75a88795a..29feee27f0ea 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -63,7 +63,7 @@
63 63
64/* Current ACPICA subsystem version in YYYYMMDD format */ 64/* Current ACPICA subsystem version in YYYYMMDD format */
65 65
66#define ACPI_CA_VERSION 0x20080609 66#define ACPI_CA_VERSION 0x20080926
67 67
68/* 68/*
69 * OS name, used for the _OS object. The _OS object is essentially obsolete, 69 * OS name, used for the _OS object. The _OS object is essentially obsolete,
diff --git a/include/acpi/acdebug.h b/include/acpi/acdebug.h
index c5a1b50d8d94..62c59df3b86c 100644
--- a/include/acpi/acdebug.h
+++ b/include/acpi/acdebug.h
@@ -123,6 +123,10 @@ void acpi_db_check_integrity(void);
123 123
124void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); 124void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
125 125
126void acpi_db_check_predefined_names(void);
127
128void acpi_db_batch_execute(void);
129
126/* 130/*
127 * dbdisply - debug display commands 131 * dbdisply - debug display commands
128 */ 132 */
@@ -150,6 +154,10 @@ void
150acpi_db_display_argument_object(union acpi_operand_object *obj_desc, 154acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
151 struct acpi_walk_state *walk_state); 155 struct acpi_walk_state *walk_state);
152 156
157void acpi_db_check_predefined_names(void);
158
159void acpi_db_batch_execute(void);
160
153/* 161/*
154 * dbexec - debugger control method execution 162 * dbexec - debugger control method execution
155 */ 163 */
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h
index f53faca8ec80..0c1ed387073c 100644
--- a/include/acpi/acdisasm.h
+++ b/include/acpi/acdisasm.h
@@ -186,6 +186,8 @@ extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
186extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; 186extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
187extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; 187extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
188extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; 188extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
189extern struct acpi_dmtable_info acpi_dm_table_info_madt9[];
190extern struct acpi_dmtable_info acpi_dm_table_info_madt10[];
189extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; 191extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
190extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; 192extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
191extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; 193extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
@@ -197,8 +199,10 @@ extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
197extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; 199extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
198extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; 200extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
199extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; 201extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
202extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[];
200extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; 203extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
201extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; 204extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
205extern struct acpi_dmtable_info acpi_dm_table_info_srat2[];
202extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; 206extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
203extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; 207extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
204 208
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h
index 21a73a105d0a..6291904be01e 100644
--- a/include/acpi/acdispat.h
+++ b/include/acpi/acdispat.h
@@ -157,7 +157,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
157 * dsmthdat - method data (locals/args) 157 * dsmthdat - method data (locals/args)
158 */ 158 */
159acpi_status 159acpi_status
160acpi_ds_store_object_to_local(u16 opcode, 160acpi_ds_store_object_to_local(u8 type,
161 u32 index, 161 u32 index,
162 union acpi_operand_object *src_desc, 162 union acpi_operand_object *src_desc,
163 struct acpi_walk_state *walk_state); 163 struct acpi_walk_state *walk_state);
@@ -173,7 +173,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
173u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); 173u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
174 174
175acpi_status 175acpi_status
176acpi_ds_method_data_get_value(u16 opcode, 176acpi_ds_method_data_get_value(u8 type,
177 u32 index, 177 u32 index,
178 struct acpi_walk_state *walk_state, 178 struct acpi_walk_state *walk_state,
179 union acpi_operand_object **dest_desc); 179 union acpi_operand_object **dest_desc);
@@ -184,7 +184,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
184 struct acpi_walk_state *walk_state); 184 struct acpi_walk_state *walk_state);
185 185
186acpi_status 186acpi_status
187acpi_ds_method_data_get_node(u16 opcode, 187acpi_ds_method_data_get_node(u8 type,
188 u32 index, 188 u32 index,
189 struct acpi_walk_state *walk_state, 189 struct acpi_walk_state *walk_state,
190 struct acpi_namespace_node **node); 190 struct acpi_namespace_node **node);
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index e5a890ffeb02..84f5cb242863 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -76,25 +76,21 @@
76#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) 76#define AE_STACK_OVERFLOW (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL)
77#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) 77#define AE_STACK_UNDERFLOW (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL)
78#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) 78#define AE_NOT_IMPLEMENTED (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL)
79#define AE_VERSION_MISMATCH (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) 79#define AE_SUPPORT (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL)
80#define AE_SUPPORT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) 80#define AE_LIMIT (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL)
81#define AE_SHARE (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) 81#define AE_TIME (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL)
82#define AE_LIMIT (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) 82#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL)
83#define AE_TIME (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) 83#define AE_RELEASE_DEADLOCK (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL)
84#define AE_UNKNOWN_STATUS (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) 84#define AE_NOT_ACQUIRED (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL)
85#define AE_ACQUIRE_DEADLOCK (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) 85#define AE_ALREADY_ACQUIRED (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL)
86#define AE_RELEASE_DEADLOCK (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) 86#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL)
87#define AE_NOT_ACQUIRED (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) 87#define AE_NO_GLOBAL_LOCK (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL)
88#define AE_ALREADY_ACQUIRED (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) 88#define AE_ABORT_METHOD (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL)
89#define AE_NO_HARDWARE_RESPONSE (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) 89#define AE_SAME_HANDLER (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL)
90#define AE_NO_GLOBAL_LOCK (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) 90#define AE_WAKE_ONLY_GPE (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL)
91#define AE_LOGICAL_ADDRESS (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) 91#define AE_OWNER_ID_LIMIT (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL)
92#define AE_ABORT_METHOD (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL)
93#define AE_SAME_HANDLER (acpi_status) (0x001D | AE_CODE_ENVIRONMENTAL)
94#define AE_WAKE_ONLY_GPE (acpi_status) (0x001E | AE_CODE_ENVIRONMENTAL)
95#define AE_OWNER_ID_LIMIT (acpi_status) (0x001F | AE_CODE_ENVIRONMENTAL)
96 92
97#define AE_CODE_ENV_MAX 0x001F 93#define AE_CODE_ENV_MAX 0x001B
98 94
99/* 95/*
100 * Programmer exceptions 96 * Programmer exceptions
@@ -103,14 +99,12 @@
103#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) 99#define AE_BAD_CHARACTER (acpi_status) (0x0002 | AE_CODE_PROGRAMMER)
104#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) 100#define AE_BAD_PATHNAME (acpi_status) (0x0003 | AE_CODE_PROGRAMMER)
105#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) 101#define AE_BAD_DATA (acpi_status) (0x0004 | AE_CODE_PROGRAMMER)
106#define AE_BAD_ADDRESS (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) 102#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0005 | AE_CODE_PROGRAMMER)
107#define AE_ALIGNMENT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) 103#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0006 | AE_CODE_PROGRAMMER)
108#define AE_BAD_HEX_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) 104#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0007 | AE_CODE_PROGRAMMER)
109#define AE_BAD_OCTAL_CONSTANT (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) 105#define AE_MISSING_ARGUMENTS (acpi_status) (0x0008 | AE_CODE_PROGRAMMER)
110#define AE_BAD_DECIMAL_CONSTANT (acpi_status) (0x0009 | AE_CODE_PROGRAMMER)
111#define AE_MISSING_ARGUMENTS (acpi_status) (0x000A | AE_CODE_PROGRAMMER)
112 106
113#define AE_CODE_PGM_MAX 0x000A 107#define AE_CODE_PGM_MAX 0x0008
114 108
115/* 109/*
116 * Acpi table exceptions 110 * Acpi table exceptions
@@ -119,51 +113,48 @@
119#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) 113#define AE_BAD_HEADER (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES)
120#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) 114#define AE_BAD_CHECKSUM (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES)
121#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) 115#define AE_BAD_VALUE (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES)
122#define AE_TABLE_NOT_SUPPORTED (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) 116#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES)
123#define AE_INVALID_TABLE_LENGTH (acpi_status) (0x0006 | AE_CODE_ACPI_TABLES)
124 117
125#define AE_CODE_TBL_MAX 0x0006 118#define AE_CODE_TBL_MAX 0x0005
126 119
127/* 120/*
128 * AML exceptions. These are caused by problems with 121 * AML exceptions. These are caused by problems with
129 * the actual AML byte stream 122 * the actual AML byte stream
130 */ 123 */
131#define AE_AML_ERROR (acpi_status) (0x0001 | AE_CODE_AML) 124#define AE_AML_BAD_OPCODE (acpi_status) (0x0001 | AE_CODE_AML)
132#define AE_AML_PARSE (acpi_status) (0x0002 | AE_CODE_AML) 125#define AE_AML_NO_OPERAND (acpi_status) (0x0002 | AE_CODE_AML)
133#define AE_AML_BAD_OPCODE (acpi_status) (0x0003 | AE_CODE_AML) 126#define AE_AML_OPERAND_TYPE (acpi_status) (0x0003 | AE_CODE_AML)
134#define AE_AML_NO_OPERAND (acpi_status) (0x0004 | AE_CODE_AML) 127#define AE_AML_OPERAND_VALUE (acpi_status) (0x0004 | AE_CODE_AML)
135#define AE_AML_OPERAND_TYPE (acpi_status) (0x0005 | AE_CODE_AML) 128#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0005 | AE_CODE_AML)
136#define AE_AML_OPERAND_VALUE (acpi_status) (0x0006 | AE_CODE_AML) 129#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0006 | AE_CODE_AML)
137#define AE_AML_UNINITIALIZED_LOCAL (acpi_status) (0x0007 | AE_CODE_AML) 130#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0007 | AE_CODE_AML)
138#define AE_AML_UNINITIALIZED_ARG (acpi_status) (0x0008 | AE_CODE_AML) 131#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x0008 | AE_CODE_AML)
139#define AE_AML_UNINITIALIZED_ELEMENT (acpi_status) (0x0009 | AE_CODE_AML) 132#define AE_AML_REGION_LIMIT (acpi_status) (0x0009 | AE_CODE_AML)
140#define AE_AML_NUMERIC_OVERFLOW (acpi_status) (0x000A | AE_CODE_AML) 133#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000A | AE_CODE_AML)
141#define AE_AML_REGION_LIMIT (acpi_status) (0x000B | AE_CODE_AML) 134#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000B | AE_CODE_AML)
142#define AE_AML_BUFFER_LIMIT (acpi_status) (0x000C | AE_CODE_AML) 135#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000C | AE_CODE_AML)
143#define AE_AML_PACKAGE_LIMIT (acpi_status) (0x000D | AE_CODE_AML) 136#define AE_AML_BAD_NAME (acpi_status) (0x000D | AE_CODE_AML)
144#define AE_AML_DIVIDE_BY_ZERO (acpi_status) (0x000E | AE_CODE_AML) 137#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x000E | AE_CODE_AML)
145#define AE_AML_BAD_NAME (acpi_status) (0x000F | AE_CODE_AML) 138#define AE_AML_INTERNAL (acpi_status) (0x000F | AE_CODE_AML)
146#define AE_AML_NAME_NOT_FOUND (acpi_status) (0x0010 | AE_CODE_AML) 139#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0010 | AE_CODE_AML)
147#define AE_AML_INTERNAL (acpi_status) (0x0011 | AE_CODE_AML) 140#define AE_AML_STRING_LIMIT (acpi_status) (0x0011 | AE_CODE_AML)
148#define AE_AML_INVALID_SPACE_ID (acpi_status) (0x0012 | AE_CODE_AML) 141#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0012 | AE_CODE_AML)
149#define AE_AML_STRING_LIMIT (acpi_status) (0x0013 | AE_CODE_AML) 142#define AE_AML_METHOD_LIMIT (acpi_status) (0x0013 | AE_CODE_AML)
150#define AE_AML_NO_RETURN_VALUE (acpi_status) (0x0014 | AE_CODE_AML) 143#define AE_AML_NOT_OWNER (acpi_status) (0x0014 | AE_CODE_AML)
151#define AE_AML_METHOD_LIMIT (acpi_status) (0x0015 | AE_CODE_AML) 144#define AE_AML_MUTEX_ORDER (acpi_status) (0x0015 | AE_CODE_AML)
152#define AE_AML_NOT_OWNER (acpi_status) (0x0016 | AE_CODE_AML) 145#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0016 | AE_CODE_AML)
153#define AE_AML_MUTEX_ORDER (acpi_status) (0x0017 | AE_CODE_AML) 146#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0017 | AE_CODE_AML)
154#define AE_AML_MUTEX_NOT_ACQUIRED (acpi_status) (0x0018 | AE_CODE_AML) 147#define AE_AML_INVALID_INDEX (acpi_status) (0x0018 | AE_CODE_AML)
155#define AE_AML_INVALID_RESOURCE_TYPE (acpi_status) (0x0019 | AE_CODE_AML) 148#define AE_AML_REGISTER_LIMIT (acpi_status) (0x0019 | AE_CODE_AML)
156#define AE_AML_INVALID_INDEX (acpi_status) (0x001A | AE_CODE_AML) 149#define AE_AML_NO_WHILE (acpi_status) (0x001A | AE_CODE_AML)
157#define AE_AML_REGISTER_LIMIT (acpi_status) (0x001B | AE_CODE_AML) 150#define AE_AML_ALIGNMENT (acpi_status) (0x001B | AE_CODE_AML)
158#define AE_AML_NO_WHILE (acpi_status) (0x001C | AE_CODE_AML) 151#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001C | AE_CODE_AML)
159#define AE_AML_ALIGNMENT (acpi_status) (0x001D | AE_CODE_AML) 152#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001D | AE_CODE_AML)
160#define AE_AML_NO_RESOURCE_END_TAG (acpi_status) (0x001E | AE_CODE_AML) 153#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x001E | AE_CODE_AML)
161#define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) 154#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x001F | AE_CODE_AML)
162#define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) 155#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0020 | AE_CODE_AML)
163#define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML)
164#define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML)
165 156
166#define AE_CODE_AML_MAX 0x0022 157#define AE_CODE_AML_MAX 0x0020
167 158
168/* 159/*
169 * Internal exceptions used for control 160 * Internal exceptions used for control
@@ -206,19 +197,15 @@ char const *acpi_gbl_exception_names_env[] = {
206 "AE_STACK_OVERFLOW", 197 "AE_STACK_OVERFLOW",
207 "AE_STACK_UNDERFLOW", 198 "AE_STACK_UNDERFLOW",
208 "AE_NOT_IMPLEMENTED", 199 "AE_NOT_IMPLEMENTED",
209 "AE_VERSION_MISMATCH",
210 "AE_SUPPORT", 200 "AE_SUPPORT",
211 "AE_SHARE",
212 "AE_LIMIT", 201 "AE_LIMIT",
213 "AE_TIME", 202 "AE_TIME",
214 "AE_UNKNOWN_STATUS",
215 "AE_ACQUIRE_DEADLOCK", 203 "AE_ACQUIRE_DEADLOCK",
216 "AE_RELEASE_DEADLOCK", 204 "AE_RELEASE_DEADLOCK",
217 "AE_NOT_ACQUIRED", 205 "AE_NOT_ACQUIRED",
218 "AE_ALREADY_ACQUIRED", 206 "AE_ALREADY_ACQUIRED",
219 "AE_NO_HARDWARE_RESPONSE", 207 "AE_NO_HARDWARE_RESPONSE",
220 "AE_NO_GLOBAL_LOCK", 208 "AE_NO_GLOBAL_LOCK",
221 "AE_LOGICAL_ADDRESS",
222 "AE_ABORT_METHOD", 209 "AE_ABORT_METHOD",
223 "AE_SAME_HANDLER", 210 "AE_SAME_HANDLER",
224 "AE_WAKE_ONLY_GPE", 211 "AE_WAKE_ONLY_GPE",
@@ -231,8 +218,6 @@ char const *acpi_gbl_exception_names_pgm[] = {
231 "AE_BAD_CHARACTER", 218 "AE_BAD_CHARACTER",
232 "AE_BAD_PATHNAME", 219 "AE_BAD_PATHNAME",
233 "AE_BAD_DATA", 220 "AE_BAD_DATA",
234 "AE_BAD_ADDRESS",
235 "AE_ALIGNMENT",
236 "AE_BAD_HEX_CONSTANT", 221 "AE_BAD_HEX_CONSTANT",
237 "AE_BAD_OCTAL_CONSTANT", 222 "AE_BAD_OCTAL_CONSTANT",
238 "AE_BAD_DECIMAL_CONSTANT", 223 "AE_BAD_DECIMAL_CONSTANT",
@@ -245,14 +230,11 @@ char const *acpi_gbl_exception_names_tbl[] = {
245 "AE_BAD_HEADER", 230 "AE_BAD_HEADER",
246 "AE_BAD_CHECKSUM", 231 "AE_BAD_CHECKSUM",
247 "AE_BAD_VALUE", 232 "AE_BAD_VALUE",
248 "AE_TABLE_NOT_SUPPORTED",
249 "AE_INVALID_TABLE_LENGTH" 233 "AE_INVALID_TABLE_LENGTH"
250}; 234};
251 235
252char const *acpi_gbl_exception_names_aml[] = { 236char const *acpi_gbl_exception_names_aml[] = {
253 NULL, 237 NULL,
254 "AE_AML_ERROR",
255 "AE_AML_PARSE",
256 "AE_AML_BAD_OPCODE", 238 "AE_AML_BAD_OPCODE",
257 "AE_AML_NO_OPERAND", 239 "AE_AML_NO_OPERAND",
258 "AE_AML_OPERAND_TYPE", 240 "AE_AML_OPERAND_TYPE",
@@ -284,7 +266,7 @@ char const *acpi_gbl_exception_names_aml[] = {
284 "AE_AML_BAD_RESOURCE_VALUE", 266 "AE_AML_BAD_RESOURCE_VALUE",
285 "AE_AML_CIRCULAR_REFERENCE", 267 "AE_AML_CIRCULAR_REFERENCE",
286 "AE_AML_BAD_RESOURCE_LENGTH", 268 "AE_AML_BAD_RESOURCE_LENGTH",
287 "AE_AML_ILLEGAL_ADDRESS" 269 "AE_AML_ILLEGAL_ADDRESS",
288}; 270};
289 271
290char const *acpi_gbl_exception_names_ctrl[] = { 272char const *acpi_gbl_exception_names_ctrl[] = {
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h
index b221c8583ddd..ecab527cf78e 100644
--- a/include/acpi/aclocal.h
+++ b/include/acpi/aclocal.h
@@ -208,6 +208,7 @@ struct acpi_namespace_node {
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 */
211#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
211 212
212#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ 213#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */
213#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ 214#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */
@@ -340,6 +341,82 @@ acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);
340#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 341#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
341#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 342#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
342 343
344/*
345 * Information structure for ACPI predefined names.
346 * Each entry in the table contains the following items:
347 *
348 * Name - The ACPI reserved name
349 * param_count - Number of arguments to the method
350 * expected_return_btypes - Allowed type(s) for the return value
351 */
352struct acpi_name_info {
353 char name[ACPI_NAME_SIZE];
354 u8 param_count;
355 u8 expected_btypes;
356};
357
358/*
359 * Secondary information structures for ACPI predefined objects that return
360 * package objects. This structure appears as the next entry in the table
361 * after the NAME_INFO structure above.
362 *
363 * The reason for this is to minimize the size of the predefined name table.
364 */
365
366/*
367 * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
368 * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
369 */
370struct acpi_package_info {
371 u8 type;
372 u8 object_type1;
373 u8 count1;
374 u8 object_type2;
375 u8 count2;
376 u8 reserved;
377};
378
379/* Used for ACPI_PTYPE2_FIXED */
380
381struct acpi_package_info2 {
382 u8 type;
383 u8 count;
384 u8 object_type[4];
385};
386
387/* Used for ACPI_PTYPE1_OPTION */
388
389struct acpi_package_info3 {
390 u8 type;
391 u8 count;
392 u8 object_type[2];
393 u8 tail_object_type;
394 u8 reserved;
395};
396
397union acpi_predefined_info {
398 struct acpi_name_info info;
399 struct acpi_package_info ret_info;
400 struct acpi_package_info2 ret_info2;
401 struct acpi_package_info3 ret_info3;
402};
403
404/*
405 * Bitmapped return value types
406 * Note: the actual data types must be contiguous, a loop in nspredef.c
407 * depends on this.
408 */
409#define ACPI_RTYPE_ANY 0x00
410#define ACPI_RTYPE_NONE 0x01
411#define ACPI_RTYPE_INTEGER 0x02
412#define ACPI_RTYPE_STRING 0x04
413#define ACPI_RTYPE_BUFFER 0x08
414#define ACPI_RTYPE_PACKAGE 0x10
415#define ACPI_RTYPE_REFERENCE 0x20
416#define ACPI_RTYPE_ALL 0x3F
417
418#define ACPI_NUM_RTYPES 5 /* Number of actual object types */
419
343/***************************************************************************** 420/*****************************************************************************
344 * 421 *
345 * Event typedefs and structs 422 * Event typedefs and structs
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index 57ab9e9d7593..a597207e2835 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -62,7 +62,7 @@
62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) 62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
63 63
64/* 64/*
65 * Extract data using a pointer. Any more than a byte and we 65 * Extract data using a pointer. Any more than a byte and we
66 * get into potential aligment issues -- see the STORE macros below. 66 * get into potential aligment issues -- see the STORE macros below.
67 * Use with care. 67 * Use with care.
68 */ 68 */
@@ -80,21 +80,21 @@
80 */ 80 */
81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p)) 81#define ACPI_CAST_PTR(t, p) ((t *) (acpi_uintptr_t) (p))
82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p)) 82#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (acpi_uintptr_t) (p))
83#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8,(a)) + (acpi_size)(b))) 83#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (u8, (a)) + (acpi_size)(b)))
84#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8,(a)) - ACPI_CAST_PTR (u8,(b))) 84#define ACPI_PTR_DIFF(a, b) (acpi_size) (ACPI_CAST_PTR (u8, (a)) - ACPI_CAST_PTR (u8, (b)))
85 85
86/* Pointer/Integer type conversions */ 86/* Pointer/Integer type conversions */
87 87
88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i) 88#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL, (acpi_size) i)
89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) 89#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL)
90#define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) 90#define ACPI_OFFSET(d, f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) 91#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
92#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) 92#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
93 93
94#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 94#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
95#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) 95#define ACPI_COMPARE_NAME(a, b) (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
96#else 96#else
97#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) 97#define ACPI_COMPARE_NAME(a, b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
98#endif 98#endif
99 99
100/* 100/*
@@ -114,7 +114,7 @@ struct acpi_integer_overlay {
114 114
115/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ 115/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
116 116
117#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) 117#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
118 118
119#if ACPI_MACHINE_WIDTH == 64 119#if ACPI_MACHINE_WIDTH == 64
120#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) 120#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
@@ -132,37 +132,33 @@ struct acpi_integer_overlay {
132 * Macros for big-endian machines 132 * Macros for big-endian machines
133 */ 133 */
134 134
135/* This macro sets a buffer index, starting from the end of the buffer */
136
137#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) ((buf_len) - (((buf_offset)+1) * (byte_gran)))
138
139/* These macros reverse the bytes during the move, converting little-endian to big endian */ 135/* These macros reverse the bytes during the move, converting little-endian to big endian */
140 136
141 /* Big Endian <== Little Endian */ 137 /* Big Endian <== Little Endian */
142 /* Hi...Lo Lo...Hi */ 138 /* Hi...Lo Lo...Hi */
143/* 16-bit source, 16/32/64 destination */ 139/* 16-bit source, 16/32/64 destination */
144 140
145#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ 141#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
146 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} 142 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
147 143
148#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ 144#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
149 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 145 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
150 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 146 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
151 147
152#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ 148#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
153 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ 149 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
154 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} 150 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
155 151
156/* 32-bit source, 16/32/64 destination */ 152/* 32-bit source, 16/32/64 destination */
157 153
158#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 154#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
159 155
160#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ 156#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
161 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ 157 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
162 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 158 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
163 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 159 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
164 160
165#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ 161#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
166 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ 162 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
167 ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\ 163 ((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
168 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ 164 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
@@ -170,11 +166,11 @@ struct acpi_integer_overlay {
170 166
171/* 64-bit source, 16/32/64 destination */ 167/* 64-bit source, 16/32/64 destination */
172 168
173#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 169#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
174 170
175#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 171#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
176 172
177#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\ 173#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
178 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\ 174 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
179 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\ 175 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
180 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\ 176 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
@@ -187,63 +183,59 @@ struct acpi_integer_overlay {
187 * Macros for little-endian machines 183 * Macros for little-endian machines
188 */ 184 */
189 185
190/* This macro sets a buffer index, starting from the beginning of the buffer */
191
192#define ACPI_BUFFER_INDEX(buf_len,buf_offset,byte_gran) (buf_offset)
193
194#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED 186#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
195 187
196/* The hardware supports unaligned transfers, just do the little-endian move */ 188/* The hardware supports unaligned transfers, just do the little-endian move */
197 189
198/* 16-bit source, 16/32/64 destination */ 190/* 16-bit source, 16/32/64 destination */
199 191
200#define ACPI_MOVE_16_TO_16(d,s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s) 192#define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
201#define ACPI_MOVE_16_TO_32(d,s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s) 193#define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
202#define ACPI_MOVE_16_TO_64(d,s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s) 194#define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
203 195
204/* 32-bit source, 16/32/64 destination */ 196/* 32-bit source, 16/32/64 destination */
205 197
206#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 198#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
207#define ACPI_MOVE_32_TO_32(d,s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s) 199#define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
208#define ACPI_MOVE_32_TO_64(d,s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s) 200#define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
209 201
210/* 64-bit source, 16/32/64 destination */ 202/* 64-bit source, 16/32/64 destination */
211 203
212#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 204#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
213#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 205#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
214#define ACPI_MOVE_64_TO_64(d,s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s) 206#define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
215 207
216#else 208#else
217/* 209/*
218 * The hardware does not support unaligned transfers. We must move the 210 * The hardware does not support unaligned transfers. We must move the
219 * data one byte at a time. These macros work whether the source or 211 * data one byte at a time. These macros work whether the source or
220 * the destination (or both) is/are unaligned. (Little-endian move) 212 * the destination (or both) is/are unaligned. (Little-endian move)
221 */ 213 */
222 214
223/* 16-bit source, 16/32/64 destination */ 215/* 16-bit source, 16/32/64 destination */
224 216
225#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ 217#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
226 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];} 218 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
227 219
228#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} 220#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
229#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} 221#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
230 222
231/* 32-bit source, 16/32/64 destination */ 223/* 32-bit source, 16/32/64 destination */
232 224
233#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 225#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
234 226
235#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ 227#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
236 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ 228 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
237 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ 229 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
238 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];} 230 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
239 231
240#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} 232#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
241 233
242/* 64-bit source, 16/32/64 destination */ 234/* 64-bit source, 16/32/64 destination */
243 235
244#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 236#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
245#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ 237#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
246#define ACPI_MOVE_64_TO_64(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\ 238#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
247 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\ 239 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
248 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\ 240 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
249 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\ 241 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
@@ -257,10 +249,10 @@ struct acpi_integer_overlay {
257/* Macros based on machine integer width */ 249/* Macros based on machine integer width */
258 250
259#if ACPI_MACHINE_WIDTH == 32 251#if ACPI_MACHINE_WIDTH == 32
260#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) 252#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_32_TO_16(d, s)
261 253
262#elif ACPI_MACHINE_WIDTH == 64 254#elif ACPI_MACHINE_WIDTH == 64
263#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) 255#define ACPI_MOVE_SIZE_TO_16(d, s) ACPI_MOVE_64_TO_16(d, s)
264 256
265#else 257#else
266#error unknown ACPI_MACHINE_WIDTH 258#error unknown ACPI_MACHINE_WIDTH
@@ -269,29 +261,29 @@ struct acpi_integer_overlay {
269/* 261/*
270 * Fast power-of-two math macros for non-optimized compilers 262 * Fast power-of-two math macros for non-optimized compilers
271 */ 263 */
272#define _ACPI_DIV(value,power_of2) ((u32) ((value) >> (power_of2))) 264#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
273#define _ACPI_MUL(value,power_of2) ((u32) ((value) << (power_of2))) 265#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
274#define _ACPI_MOD(value,divisor) ((u32) ((value) & ((divisor) -1))) 266#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
275 267
276#define ACPI_DIV_2(a) _ACPI_DIV(a,1) 268#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
277#define ACPI_MUL_2(a) _ACPI_MUL(a,1) 269#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
278#define ACPI_MOD_2(a) _ACPI_MOD(a,2) 270#define ACPI_MOD_2(a) _ACPI_MOD(a, 2)
279 271
280#define ACPI_DIV_4(a) _ACPI_DIV(a,2) 272#define ACPI_DIV_4(a) _ACPI_DIV(a, 2)
281#define ACPI_MUL_4(a) _ACPI_MUL(a,2) 273#define ACPI_MUL_4(a) _ACPI_MUL(a, 2)
282#define ACPI_MOD_4(a) _ACPI_MOD(a,4) 274#define ACPI_MOD_4(a) _ACPI_MOD(a, 4)
283 275
284#define ACPI_DIV_8(a) _ACPI_DIV(a,3) 276#define ACPI_DIV_8(a) _ACPI_DIV(a, 3)
285#define ACPI_MUL_8(a) _ACPI_MUL(a,3) 277#define ACPI_MUL_8(a) _ACPI_MUL(a, 3)
286#define ACPI_MOD_8(a) _ACPI_MOD(a,8) 278#define ACPI_MOD_8(a) _ACPI_MOD(a, 8)
287 279
288#define ACPI_DIV_16(a) _ACPI_DIV(a,4) 280#define ACPI_DIV_16(a) _ACPI_DIV(a, 4)
289#define ACPI_MUL_16(a) _ACPI_MUL(a,4) 281#define ACPI_MUL_16(a) _ACPI_MUL(a, 4)
290#define ACPI_MOD_16(a) _ACPI_MOD(a,16) 282#define ACPI_MOD_16(a) _ACPI_MOD(a, 16)
291 283
292#define ACPI_DIV_32(a) _ACPI_DIV(a,5) 284#define ACPI_DIV_32(a) _ACPI_DIV(a, 5)
293#define ACPI_MUL_32(a) _ACPI_MUL(a,5) 285#define ACPI_MUL_32(a) _ACPI_MUL(a, 5)
294#define ACPI_MOD_32(a) _ACPI_MOD(a,32) 286#define ACPI_MOD_32(a) _ACPI_MOD(a, 32)
295 287
296/* 288/*
297 * Rounding macros (Power of two boundaries only) 289 * Rounding macros (Power of two boundaries only)
@@ -305,13 +297,13 @@ struct acpi_integer_overlay {
305 297
306/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */ 298/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
307 299
308#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) 300#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4)
309#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) 301#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8)
310#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_size)) 302#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size))
311 303
312#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) 304#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4)
313#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) 305#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8)
314#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_size)) 306#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size))
315 307
316#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) 308#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
317#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) 309#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
@@ -320,9 +312,9 @@ struct acpi_integer_overlay {
320 312
321/* Generic (non-power-of-two) rounding */ 313/* Generic (non-power-of-two) rounding */
322 314
323#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) 315#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
324 316
325#define ACPI_IS_MISALIGNED(value) (((acpi_size)value) & (sizeof(acpi_size)-1)) 317#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
326 318
327/* 319/*
328 * Bitmask creation 320 * Bitmask creation
@@ -333,8 +325,6 @@ struct acpi_integer_overlay {
333#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) 325#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position))))
334#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) 326#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position)))
335 327
336#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
337
338/* Bitfields within ACPI registers */ 328/* Bitfields within ACPI registers */
339 329
340#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask) 330#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) ((val << pos) & mask)
@@ -342,39 +332,29 @@ struct acpi_integer_overlay {
342 332
343#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask)) 333#define ACPI_INSERT_BITS(target, mask, source) target = ((target & (~(mask))) | (source & mask))
344 334
345/* Generate a UUID */
346
347#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
348 (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
349 (b) & 0xFF, ((b) >> 8) & 0xFF, \
350 (c) & 0xFF, ((c) >> 8) & 0xFF, \
351 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
352
353/* 335/*
354 * An struct acpi_namespace_node * can appear in some contexts, 336 * An struct acpi_namespace_node can appear in some contexts
355 * where a pointer to an union acpi_operand_object can also 337 * where a pointer to an union acpi_operand_object can also
356 * appear. This macro is used to distinguish them. 338 * appear. This macro is used to distinguish them.
357 * 339 *
358 * The "Descriptor" field is the first field in both structures. 340 * The "Descriptor" field is the first field in both structures.
359 */ 341 */
360#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) 342#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
361#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) 343#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)
362 344
363/* Macro to test the object type */ 345/* Macro to test the object type */
364 346
365#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type) 347#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)
366 348
367/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */
368
369#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0)
370
371/* 349/*
372 * Macros for the master AML opcode table 350 * Macros for the master AML opcode table
373 */ 351 */
374#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) 352#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
375#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {name,(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} 353#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
354 {name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
376#else 355#else
377#define ACPI_OP(name,Pargs,Iargs,obj_type,class,type,flags) {(u32)(Pargs),(u32)(Iargs),(u32)(flags),obj_type,class,type} 356#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
357 {(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
378#endif 358#endif
379 359
380#ifdef ACPI_DISASSEMBLER 360#ifdef ACPI_DISASSEMBLER
@@ -392,18 +372,18 @@ struct acpi_integer_overlay {
392#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH)) 372#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
393 373
394#define ARGI_LIST1(a) (ARG_1(a)) 374#define ARGI_LIST1(a) (ARG_1(a))
395#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) 375#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a))
396#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) 376#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
397#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) 377#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
398#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) 378#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
399#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) 379#define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
400 380
401#define ARGP_LIST1(a) (ARG_1(a)) 381#define ARGP_LIST1(a) (ARG_1(a))
402#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) 382#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b))
403#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) 383#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
404#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) 384#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
405#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) 385#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
406#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) 386#define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
407 387
408#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F)) 388#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))
409#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH)) 389#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
@@ -434,8 +414,8 @@ struct acpi_integer_overlay {
434#define ACPI_WARNING(plist) acpi_ut_warning plist 414#define ACPI_WARNING(plist) acpi_ut_warning plist
435#define ACPI_EXCEPTION(plist) acpi_ut_exception plist 415#define ACPI_EXCEPTION(plist) acpi_ut_exception plist
436#define ACPI_ERROR(plist) acpi_ut_error plist 416#define ACPI_ERROR(plist) acpi_ut_error plist
437#define ACPI_ERROR_NAMESPACE(s,e) acpi_ns_report_error (AE_INFO, s, e); 417#define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e);
438#define ACPI_ERROR_METHOD(s,n,p,e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); 418#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e);
439 419
440#else 420#else
441 421
@@ -445,8 +425,8 @@ struct acpi_integer_overlay {
445#define ACPI_WARNING(plist) 425#define ACPI_WARNING(plist)
446#define ACPI_EXCEPTION(plist) 426#define ACPI_EXCEPTION(plist)
447#define ACPI_ERROR(plist) 427#define ACPI_ERROR(plist)
448#define ACPI_ERROR_NAMESPACE(s,e) 428#define ACPI_ERROR_NAMESPACE(s, e)
449#define ACPI_ERROR_METHOD(s,n,p,e) 429#define ACPI_ERROR_METHOD(s, n, p, e)
450#endif 430#endif
451 431
452/* 432/*
@@ -467,7 +447,7 @@ struct acpi_integer_overlay {
467/* 447/*
468 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, 448 * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
469 * define it now. This is the case where there the compiler does not support 449 * define it now. This is the case where there the compiler does not support
470 * a __FUNCTION__ macro or equivalent. 450 * a __func__ macro or equivalent.
471 */ 451 */
472#ifndef ACPI_GET_FUNCTION_NAME 452#ifndef ACPI_GET_FUNCTION_NAME
473#define ACPI_GET_FUNCTION_NAME _acpi_function_name 453#define ACPI_GET_FUNCTION_NAME _acpi_function_name
@@ -475,12 +455,12 @@ struct acpi_integer_overlay {
475 * The Name parameter should be the procedure name as a quoted string. 455 * The Name parameter should be the procedure name as a quoted string.
476 * The function name is also used by the function exit macros below. 456 * The function name is also used by the function exit macros below.
477 * Note: (const char) is used to be compatible with the debug interfaces 457 * Note: (const char) is used to be compatible with the debug interfaces
478 * and macros such as __FUNCTION__. 458 * and macros such as __func__.
479 */ 459 */
480#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name; 460#define ACPI_FUNCTION_NAME(name) static const char _acpi_function_name[] = #name;
481 461
482#else 462#else
483/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ 463/* Compiler supports __func__ (or equivalent) -- Ignore this macro */
484 464
485#define ACPI_FUNCTION_NAME(name) 465#define ACPI_FUNCTION_NAME(name)
486#endif 466#endif
@@ -489,18 +469,18 @@ struct acpi_integer_overlay {
489 469
490#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ 470#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
491 acpi_ut_trace(ACPI_DEBUG_PARAMETERS) 471 acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
492#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ 472#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \
493 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) 473 acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
494#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ 474#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \
495 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) 475 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
496#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ 476#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \
497 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) 477 acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
498 478
499#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() 479#define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr()
500 480
501/* 481/*
502 * Function exit tracing. 482 * Function exit tracing.
503 * WARNING: These macros include a return statement. This is usually considered 483 * WARNING: These macros include a return statement. This is usually considered
504 * bad form, but having a separate exit macro is very ugly and difficult to maintain. 484 * bad form, but having a separate exit macro is very ugly and difficult to maintain.
505 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros 485 * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
506 * so that "_AcpiFunctionName" is defined. 486 * so that "_AcpiFunctionName" is defined.
@@ -596,13 +576,13 @@ struct acpi_integer_overlay {
596 576
597/* Stack and buffer dumping */ 577/* Stack and buffer dumping */
598 578
599#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a),0) 579#define ACPI_DUMP_STACK_ENTRY(a) acpi_ex_dump_operand((a), 0)
600#define ACPI_DUMP_OPERANDS(a,b,c) acpi_ex_dump_operands(a,b,c) 580#define ACPI_DUMP_OPERANDS(a, b, c) acpi_ex_dump_operands(a, b, c)
601 581
602#define ACPI_DUMP_ENTRY(a,b) acpi_ns_dump_entry (a,b) 582#define ACPI_DUMP_ENTRY(a, b) acpi_ns_dump_entry (a, b)
603#define ACPI_DUMP_PATHNAME(a,b,c,d) acpi_ns_dump_pathname(a,b,c,d) 583#define ACPI_DUMP_PATHNAME(a, b, c, d) acpi_ns_dump_pathname(a, b, c, d)
604#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a) 584#define ACPI_DUMP_RESOURCE_LIST(a) acpi_rs_dump_resource_list(a)
605#define ACPI_DUMP_BUFFER(a,b) acpi_ut_dump_buffer((u8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) 585#define ACPI_DUMP_BUFFER(a, b) acpi_ut_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
606 586
607/* 587/*
608 * Master debug print macros 588 * Master debug print macros
@@ -625,20 +605,20 @@ struct acpi_integer_overlay {
625#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0) 605#define ACPI_DEBUG_ONLY_MEMBERS(a) do { } while(0)
626#define ACPI_FUNCTION_NAME(a) do { } while(0) 606#define ACPI_FUNCTION_NAME(a) do { } while(0)
627#define ACPI_FUNCTION_TRACE(a) do { } while(0) 607#define ACPI_FUNCTION_TRACE(a) do { } while(0)
628#define ACPI_FUNCTION_TRACE_PTR(a,b) do { } while(0) 608#define ACPI_FUNCTION_TRACE_PTR(a, b) do { } while(0)
629#define ACPI_FUNCTION_TRACE_U32(a,b) do { } while(0) 609#define ACPI_FUNCTION_TRACE_U32(a, b) do { } while(0)
630#define ACPI_FUNCTION_TRACE_STR(a,b) do { } while(0) 610#define ACPI_FUNCTION_TRACE_STR(a, b) do { } while(0)
631#define ACPI_FUNCTION_EXIT do { } while(0) 611#define ACPI_FUNCTION_EXIT do { } while(0)
632#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0) 612#define ACPI_FUNCTION_STATUS_EXIT(s) do { } while(0)
633#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0) 613#define ACPI_FUNCTION_VALUE_EXIT(s) do { } while(0)
634#define ACPI_FUNCTION_ENTRY() do { } while(0) 614#define ACPI_FUNCTION_ENTRY() do { } while(0)
635#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0) 615#define ACPI_DUMP_STACK_ENTRY(a) do { } while(0)
636#define ACPI_DUMP_OPERANDS(a,b,c) do { } while(0) 616#define ACPI_DUMP_OPERANDS(a, b, c) do { } while(0)
637#define ACPI_DUMP_ENTRY(a,b) do { } while(0) 617#define ACPI_DUMP_ENTRY(a, b) do { } while(0)
638#define ACPI_DUMP_TABLES(a,b) do { } while(0) 618#define ACPI_DUMP_TABLES(a, b) do { } while(0)
639#define ACPI_DUMP_PATHNAME(a,b,c,d) do { } while(0) 619#define ACPI_DUMP_PATHNAME(a, b, c, d) do { } while(0)
640#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0) 620#define ACPI_DUMP_RESOURCE_LIST(a) do { } while(0)
641#define ACPI_DUMP_BUFFER(a,b) do { } while(0) 621#define ACPI_DUMP_BUFFER(a, b) do { } while(0)
642#define ACPI_DEBUG_PRINT(pl) do { } while(0) 622#define ACPI_DEBUG_PRINT(pl) do { } while(0)
643#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0) 623#define ACPI_DEBUG_PRINT_RAW(pl) do { } while(0)
644 624
@@ -677,15 +657,17 @@ struct acpi_integer_overlay {
677/* 657/*
678 * Memory allocation tracking (DEBUG ONLY) 658 * Memory allocation tracking (DEBUG ONLY)
679 */ 659 */
660#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__
661
680#ifndef ACPI_DBG_TRACK_ALLOCATIONS 662#ifndef ACPI_DBG_TRACK_ALLOCATIONS
681 663
682/* Memory allocation */ 664/* Memory allocation */
683 665
684#ifndef ACPI_ALLOCATE 666#ifndef ACPI_ALLOCATE
685#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 667#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a), ACPI_MEM_PARAMETERS)
686#endif 668#endif
687#ifndef ACPI_ALLOCATE_ZEROED 669#ifndef ACPI_ALLOCATE_ZEROED
688#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 670#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), ACPI_MEM_PARAMETERS)
689#endif 671#endif
690#ifndef ACPI_FREE 672#ifndef ACPI_FREE
691#define ACPI_FREE(a) acpio_os_free(a) 673#define ACPI_FREE(a) acpio_os_free(a)
@@ -696,11 +678,16 @@ struct acpi_integer_overlay {
696 678
697/* Memory allocation */ 679/* Memory allocation */
698 680
699#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) 681#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
700#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) 682#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), ACPI_MEM_PARAMETERS)
701#define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) 683#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS)
702#define ACPI_MEM_TRACKING(a) a 684#define ACPI_MEM_TRACKING(a) a
703 685
704#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 686#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
705 687
688/* Preemption point */
689#ifndef ACPI_PREEMPTION_POINT
690#define ACPI_PREEMPTION_POINT() /* no preemption */
691#endif
692
706#endif /* ACMACROS_H */ 693#endif /* ACMACROS_H */
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h
index c34008507b69..db4e6f677855 100644
--- a/include/acpi/acnamesp.h
+++ b/include/acpi/acnamesp.h
@@ -178,6 +178,22 @@ acpi_ns_dump_objects(acpi_object_type type,
178acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); 178acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
179 179
180/* 180/*
181 * nspredef - Support for predefined/reserved names
182 */
183acpi_status
184acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
185 union acpi_operand_object *return_object);
186
187const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
188 acpi_namespace_node
189 *node);
190
191void
192acpi_ns_check_parameter_count(char *pathname,
193 struct acpi_namespace_node *node,
194 const union acpi_predefined_info *info);
195
196/*
181 * nsnames - Name and Scope manipulation 197 * nsnames - Name and Scope manipulation
182 */ 198 */
183u32 acpi_ns_opens_scope(acpi_object_type type); 199u32 acpi_ns_opens_scope(acpi_object_type type);
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h
index e9657dac69b7..eb6f038b03d9 100644
--- a/include/acpi/acobject.h
+++ b/include/acpi/acobject.h
@@ -308,18 +308,34 @@ struct acpi_object_addr_handler {
308 *****************************************************************************/ 308 *****************************************************************************/
309 309
310/* 310/*
311 * The Reference object type is used for these opcodes: 311 * The Reference object is used for these opcodes:
312 * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op 312 * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
313 * The Reference.Class differentiates these types.
313 */ 314 */
314struct acpi_object_reference { 315struct acpi_object_reference {
315 ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ 316 ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */
316 u16 opcode; 317 u8 target_type; /* Used for Index Op */
318 u8 reserved;
317 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ 319 void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
318 struct acpi_namespace_node *node; 320 struct acpi_namespace_node *node; /* ref_of or Namepath */
319 union acpi_operand_object **where; 321 union acpi_operand_object **where; /* Target of Index */
320 u32 offset; /* Used for arg_op, local_op, and index_op */ 322 u32 value; /* Used for Local/Arg/Index/ddb_handle */
321}; 323};
322 324
325/* Values for Reference.Class above */
326
327typedef enum {
328 ACPI_REFCLASS_LOCAL = 0, /* Method local */
329 ACPI_REFCLASS_ARG = 1, /* Method argument */
330 ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
331 ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
332 ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */
333 ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
334 ACPI_REFCLASS_DEBUG = 6, /* Debug object */
335
336 ACPI_REFCLASS_MAX = 6
337} ACPI_REFERENCE_CLASSES;
338
323/* 339/*
324 * Extra object is used as additional storage for types that 340 * Extra object is used as additional storage for types that
325 * have AML code in their declarations (term_args) that must be 341 * have AML code in their declarations (term_args) that must be
@@ -379,6 +395,13 @@ union acpi_operand_object {
379 struct acpi_object_extra extra; 395 struct acpi_object_extra extra;
380 struct acpi_object_data data; 396 struct acpi_object_data data;
381 struct acpi_object_cache_list cache; 397 struct acpi_object_cache_list cache;
398
399 /*
400 * Add namespace node to union in order to simplify code that accepts both
401 * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
402 * a common descriptor_type field in order to differentiate them.
403 */
404 struct acpi_namespace_node node;
382}; 405};
383 406
384/****************************************************************************** 407/******************************************************************************
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index e17873defcec..09d33c7740f0 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -80,12 +80,10 @@
80/* 80/*
81 * Raw debug output levels, do not use these in the DEBUG_PRINT macros 81 * Raw debug output levels, do not use these in the DEBUG_PRINT macros
82 */ 82 */
83#define ACPI_LV_ERROR 0x00000001 83#define ACPI_LV_INIT 0x00000001
84#define ACPI_LV_WARN 0x00000002 84#define ACPI_LV_DEBUG_OBJECT 0x00000002
85#define ACPI_LV_INIT 0x00000004 85#define ACPI_LV_INFO 0x00000004
86#define ACPI_LV_DEBUG_OBJECT 0x00000008 86#define ACPI_LV_ALL_EXCEPTIONS 0x00000007
87#define ACPI_LV_INFO 0x00000010
88#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F
89 87
90/* Trace verbosity level 1 [Standard Trace Level] */ 88/* Trace verbosity level 1 [Standard Trace Level] */
91 89
@@ -127,7 +125,6 @@
127#define ACPI_LV_VERBOSE_INFO 0x20000000 125#define ACPI_LV_VERBOSE_INFO 0x20000000
128#define ACPI_LV_FULL_TABLES 0x40000000 126#define ACPI_LV_FULL_TABLES 0x40000000
129#define ACPI_LV_EVENTS 0x80000000 127#define ACPI_LV_EVENTS 0x80000000
130
131#define ACPI_LV_VERBOSE 0xF0000000 128#define ACPI_LV_VERBOSE 0xF0000000
132 129
133/* 130/*
@@ -135,21 +132,17 @@
135 */ 132 */
136#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS 133#define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS
137 134
138/* Exception level -- used in the global "DebugLevel" */ 135/*
139 136 * Exception level -- used in the global "DebugLevel"
137 *
138 * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces.
139 * For warnings, use ACPI_WARNING.
140 */
140#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) 141#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
141#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) 142#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
142#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) 143#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
143#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) 144#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
144 145
145/*
146 * These two levels are essentially obsolete, all instances in the
147 * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
148 * (Kept here because some drivers may still use them)
149 */
150#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
151#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
152
153/* Trace level -- also used in the global "DebugLevel" */ 146/* Trace level -- also used in the global "DebugLevel" */
154 147
155#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) 148#define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES)
@@ -173,13 +166,14 @@
173#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) 166#define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS)
174#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) 167#define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE)
175#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) 168#define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX)
169#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS)
176 170
177#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) 171#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL)
178 172
179/* Defaults for debug_level, debug and normal */ 173/* Defaults for debug_level, debug and normal */
180 174
181#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR) 175#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
182#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR) 176#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT)
183#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 177#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
184 178
185#endif /* __ACOUTPUT_H__ */ 179#endif /* __ACOUTPUT_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a5ac0bc7f52e..54a279e44c9a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -46,7 +46,7 @@ acpi_extract_package(union acpi_object *package,
46acpi_status 46acpi_status
47acpi_evaluate_integer(acpi_handle handle, 47acpi_evaluate_integer(acpi_handle handle,
48 acpi_string pathname, 48 acpi_string pathname,
49 struct acpi_object_list *arguments, unsigned long *data); 49 struct acpi_object_list *arguments, unsigned long long *data);
50acpi_status 50acpi_status
51acpi_evaluate_reference(acpi_handle handle, 51acpi_evaluate_reference(acpi_handle handle,
52 acpi_string pathname, 52 acpi_string pathname,
@@ -300,7 +300,11 @@ struct acpi_device {
300 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 300 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
301}; 301};
302 302
303#define acpi_driver_data(d) ((d)->driver_data) 303static inline void *acpi_driver_data(struct acpi_device *d)
304{
305 return d->driver_data;
306}
307
304#define to_acpi_device(d) container_of(d, struct acpi_device, dev) 308#define to_acpi_device(d) container_of(d, struct acpi_device, dev)
305#define to_acpi_driver(d) container_of(d, struct acpi_driver, drv) 309#define to_acpi_driver(d) container_of(d, struct acpi_driver, drv)
306 310
@@ -327,6 +331,9 @@ int acpi_bus_get_private_data(acpi_handle, void **);
327extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 331extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
328extern int register_acpi_notifier(struct notifier_block *); 332extern int register_acpi_notifier(struct notifier_block *);
329extern int unregister_acpi_notifier(struct notifier_block *); 333extern int unregister_acpi_notifier(struct notifier_block *);
334
335extern int register_acpi_bus_notifier(struct notifier_block *nb);
336extern void unregister_acpi_bus_notifier(struct notifier_block *nb);
330/* 337/*
331 * External Functions 338 * External Functions
332 */ 339 */
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index e5f38e5ce86f..cf04c6011c2a 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -93,6 +93,7 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int sleep_state);
93int acpi_disable_wakeup_device_power(struct acpi_device *dev); 93int acpi_disable_wakeup_device_power(struct acpi_device *dev);
94int acpi_power_get_inferred_state(struct acpi_device *device); 94int acpi_power_get_inferred_state(struct acpi_device *device);
95int acpi_power_transition(struct acpi_device *device, int state); 95int acpi_power_transition(struct acpi_device *device, int state);
96extern int acpi_power_nocheck;
96#endif 97#endif
97 98
98/* -------------------------------------------------------------------------- 99/* --------------------------------------------------------------------------
@@ -100,6 +101,7 @@ int acpi_power_transition(struct acpi_device *device, int state);
100 -------------------------------------------------------------------------- */ 101 -------------------------------------------------------------------------- */
101#ifdef CONFIG_ACPI_EC 102#ifdef CONFIG_ACPI_EC
102int acpi_ec_ecdt_probe(void); 103int acpi_ec_ecdt_probe(void);
104int acpi_boot_ec_enable(void);
103#endif 105#endif
104 106
105/* -------------------------------------------------------------------------- 107/* --------------------------------------------------------------------------
@@ -115,12 +117,17 @@ int acpi_processor_set_thermal_limit(acpi_handle handle, int type);
115/*-------------------------------------------------------------------------- 117/*--------------------------------------------------------------------------
116 Dock Station 118 Dock Station
117 -------------------------------------------------------------------------- */ 119 -------------------------------------------------------------------------- */
120struct acpi_dock_ops {
121 acpi_notify_handler handler;
122 acpi_notify_handler uevent;
123};
124
118#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) 125#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
119extern int is_dock_device(acpi_handle handle); 126extern int is_dock_device(acpi_handle handle);
120extern int register_dock_notifier(struct notifier_block *nb); 127extern int register_dock_notifier(struct notifier_block *nb);
121extern void unregister_dock_notifier(struct notifier_block *nb); 128extern void unregister_dock_notifier(struct notifier_block *nb);
122extern int register_hotplug_dock_device(acpi_handle handle, 129extern int register_hotplug_dock_device(acpi_handle handle,
123 acpi_notify_handler handler, 130 struct acpi_dock_ops *ops,
124 void *context); 131 void *context);
125extern void unregister_hotplug_dock_device(acpi_handle handle); 132extern void unregister_hotplug_dock_device(acpi_handle handle);
126#else 133#else
@@ -136,7 +143,7 @@ static inline void unregister_dock_notifier(struct notifier_block *nb)
136{ 143{
137} 144}
138static inline int register_hotplug_dock_device(acpi_handle handle, 145static inline int register_hotplug_dock_device(acpi_handle handle,
139 acpi_notify_handler handler, 146 struct acpi_dock_ops *ops,
140 void *context) 147 void *context)
141{ 148{
142 return -ENODEV; 149 return -ENODEV;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 3f93a6b4e17f..b91440ac0d16 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -193,6 +193,9 @@ acpi_status
193acpi_os_execute(acpi_execute_type type, 193acpi_os_execute(acpi_execute_type type,
194 acpi_osd_exec_callback function, void *context); 194 acpi_osd_exec_callback function, void *context);
195 195
196acpi_status
197acpi_os_hotplug_execute(acpi_osd_exec_callback function, void *context);
198
196void acpi_os_wait_events_complete(void *context); 199void acpi_os_wait_events_complete(void *context);
197 200
198void acpi_os_sleep(acpi_integer milliseconds); 201void acpi_os_sleep(acpi_integer milliseconds);
diff --git a/include/acpi/acpredef.h b/include/acpi/acpredef.h
new file mode 100644
index 000000000000..619fb75f8861
--- /dev/null
+++ b/include/acpi/acpredef.h
@@ -0,0 +1,371 @@
1/******************************************************************************
2 *
3 * Name: acpredef - Information table for ACPI predefined methods and objects
4 * $Revision: 1.1 $
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2008, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
30 *
31 * NO WARRANTY
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 MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
43 */
44
45#ifndef __ACPREDEF_H__
46#define __ACPREDEF_H__
47
48/******************************************************************************
49 *
50 * Return Package types
51 *
52 * 1) PTYPE1 packages do not contain sub-packages.
53 *
54 * ACPI_PTYPE1_FIXED: Fixed length, 1 or 2 object types:
55 * object type
56 * count
57 * object type
58 * count
59 *
60 * ACPI_PTYPE1_VAR: Variable length:
61 * object type (Int/Buf/Ref)
62 *
63 * ACPI_PTYPE1_OPTION: Package has some required and some optional elements:
64 * Used for _PRW
65 *
66 *
67 * 2) PTYPE2 packages contain a variable number of sub-packages. Each of the
68 * different types describe the contents of each of the sub-packages.
69 *
70 * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types:
71 * object type
72 * count
73 * object type
74 * count
75 *
76 * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element:
77 * object type
78 *
79 * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
80 * object type
81 * count
82 * object type
83 * count
84 *
85 * ACPI_PTYPE2_FIXED: Each subpackage is of fixed length:
86 * Used for _PRT
87 *
88 * ACPI_PTYPE2_MIN: Each subpackage has a variable but minimum length
89 * Used for _HPX
90 *
91 *****************************************************************************/
92
93enum acpi_return_package_types {
94 ACPI_PTYPE1_FIXED = 1,
95 ACPI_PTYPE1_VAR = 2,
96 ACPI_PTYPE1_OPTION = 3,
97 ACPI_PTYPE2 = 4,
98 ACPI_PTYPE2_COUNT = 5,
99 ACPI_PTYPE2_PKG_COUNT = 6,
100 ACPI_PTYPE2_FIXED = 7,
101 ACPI_PTYPE2_MIN = 8
102};
103
104/*
105 * Predefined method/object information table.
106 *
107 * These are the names that can actually be evaluated via acpi_evaluate_object.
108 * Not present in this table are the following:
109 *
110 * 1) Predefined/Reserved names that are never evaluated via acpi_evaluate_object:
111 * _Lxx and _Exx GPE methods
112 * _Qxx EC methods
113 * _T_x compiler temporary variables
114 *
115 * 2) Predefined names that never actually exist within the AML code:
116 * Predefined resource descriptor field names
117 *
118 * 3) Predefined names that are implemented within ACPICA:
119 * _OSI
120 *
121 * 4) Some predefined names that are not documented within the ACPI spec.
122 * _WDG, _WED
123 *
124 * The main entries in the table each contain the following items:
125 *
126 * Name - The ACPI reserved name
127 * param_count - Number of arguments to the method
128 * expected_btypes - Allowed type(s) for the return value.
129 * 0 means that no return value is expected.
130 *
131 * For methods that return packages, the next entry in the table contains
132 * information about the expected structure of the package. This information
133 * is saved here (rather than in a separate table) in order to minimize the
134 * overall size of the stored data.
135 */
136static const union acpi_predefined_info predefined_names[] = {
137 {.info = {"_AC0", 0, ACPI_RTYPE_INTEGER}},
138 {.info = {"_AC1", 0, ACPI_RTYPE_INTEGER}},
139 {.info = {"_AC2", 0, ACPI_RTYPE_INTEGER}},
140 {.info = {"_AC3", 0, ACPI_RTYPE_INTEGER}},
141 {.info = {"_AC4", 0, ACPI_RTYPE_INTEGER}},
142 {.info = {"_AC5", 0, ACPI_RTYPE_INTEGER}},
143 {.info = {"_AC6", 0, ACPI_RTYPE_INTEGER}},
144 {.info = {"_AC7", 0, ACPI_RTYPE_INTEGER}},
145 {.info = {"_AC8", 0, ACPI_RTYPE_INTEGER}},
146 {.info = {"_AC9", 0, ACPI_RTYPE_INTEGER}},
147 {.info = {"_ADR", 0, ACPI_RTYPE_INTEGER}},
148 {.info = {"_AL0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
149 {.info = {"_AL1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
150 {.info = {"_AL2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
151 {.info = {"_AL3", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
152 {.info = {"_AL4", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
153 {.info = {"_AL5", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
154 {.info = {"_AL6", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
155 {.info = {"_AL7", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
156 {.info = {"_AL8", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
157 {.info = {"_AL9", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
158 {.info = {"_ALC", 0, ACPI_RTYPE_INTEGER}},
159 {.info = {"_ALI", 0, ACPI_RTYPE_INTEGER}},
160 {.info = {"_ALP", 0, ACPI_RTYPE_INTEGER}},
161 {.info = {"_ALR", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* variable (Pkgs) each 2 (Ints) */
162 {.info = {"_ALT", 0, ACPI_RTYPE_INTEGER}},
163 {.info = {"_BBN", 0, ACPI_RTYPE_INTEGER}},
164 {.info = {"_BCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
165 {.info = {"_BCM", 1, 0}},
166 {.info = {"_BDN", 0, ACPI_RTYPE_INTEGER}},
167 {.info = {"_BFS", 1, 0}},
168 {.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
169 9,
170 ACPI_RTYPE_STRING, 4, 0}}, /* fixed (9 Int),(4 Str) */
171 {.info = {"_BLT", 3, 0}},
172 {.info = {"_BMC", 1, 0}},
173 {.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */
174 {.info = {"_BQC", 0, ACPI_RTYPE_INTEGER}},
175 {.info = {"_BST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
176 {.info = {"_BTM", 1, ACPI_RTYPE_INTEGER}},
177 {.info = {"_BTP", 1, 0}},
178 {.info = {"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* see PCI firmware spec 3.0 */
179 {.info = {"_CID", 0,
180 ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}},
181 {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0, 0, 0, 0}}, /* variable (Ints/Strs) */
182 {.info = {"_CRS", 0, ACPI_RTYPE_BUFFER}},
183 {.info = {"_CRT", 0, ACPI_RTYPE_INTEGER}},
184 {.info = {"_CSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (1 Int(n), n-1 Int) */
185 {.info = {"_CST", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_PKG_COUNT,
186 ACPI_RTYPE_BUFFER, 1,
187 ACPI_RTYPE_INTEGER, 3, 0}}, /* variable (1 Int(n), n Pkg (1 Buf/3 Int) */
188 {.info = {"_DCK", 1, ACPI_RTYPE_INTEGER}},
189 {.info = {"_DCS", 0, ACPI_RTYPE_INTEGER}},
190 {.info = {"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}},
191 {.info = {"_DDN", 0, ACPI_RTYPE_STRING}},
192 {.info = {"_DGS", 0, ACPI_RTYPE_INTEGER}},
193 {.info = {"_DIS", 0, 0}},
194 {.info = {"_DMA", 0, ACPI_RTYPE_BUFFER}},
195 {.info = {"_DOD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
196 {.info = {"_DOS", 1, 0}},
197 {.info = {"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */
198 {.info = {"_DSS", 1, 0}},
199 {.info = {"_DSW", 3, 0}},
200 {.info = {"_EC_", 0, ACPI_RTYPE_INTEGER}},
201 {.info = {"_EDL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
202 {.info = {"_EJ0", 1, 0}},
203 {.info = {"_EJ1", 1, 0}},
204 {.info = {"_EJ2", 1, 0}},
205 {.info = {"_EJ3", 1, 0}},
206 {.info = {"_EJ4", 1, 0}},
207 {.info = {"_EJD", 0, ACPI_RTYPE_STRING}},
208 {.info = {"_FDE", 0, ACPI_RTYPE_BUFFER}},
209 {.info = {"_FDI", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0}}, /* fixed (16 Int) */
210 {.info = {"_FDM", 1, 0}},
211 {.info = {"_FIX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Ints) */
212 {.info = {"_GLK", 0, ACPI_RTYPE_INTEGER}},
213 {.info = {"_GPD", 0, ACPI_RTYPE_INTEGER}},
214 {.info = {"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */
215 {.info = {"_GSB", 0, ACPI_RTYPE_INTEGER}},
216 {.info = {"_GTF", 0, ACPI_RTYPE_BUFFER}},
217 {.info = {"_GTM", 0, ACPI_RTYPE_BUFFER}},
218 {.info = {"_GTS", 1, 0}},
219 {.info = {"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
220 {.info = {"_HOT", 0, ACPI_RTYPE_INTEGER}},
221 {.info = {"_HPP", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
222
223 /*
224 * For _HPX, a single package is returned, containing a variable number of sub-packages.
225 * Each sub-package contains a PCI record setting. There are several different type of
226 * record settings, of different lengths, but all elements of all settings are Integers.
227 */
228 {.info = {"_HPX", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each (var Ints) */
229 {.info = {"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
230 {.info = {"_INI", 0, 0}},
231 {.info = {"_IRC", 0, 0}},
232 {.info = {"_LCK", 1, 0}},
233 {.info = {"_LID", 0, ACPI_RTYPE_INTEGER}},
234 {.info = {"_MAT", 0, ACPI_RTYPE_BUFFER}},
235 {.info = {"_MLS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_STRING, 2, 0, 0, 0}}, /* variable (Pkgs) each (2 Str) */
236 {.info = {"_MSG", 1, 0}},
237 {.info = {"_OFF", 0, 0}},
238 {.info = {"_ON_", 0, 0}},
239 {.info = {"_OS_", 0, ACPI_RTYPE_STRING}},
240 {.info = {"_OSC", 4, ACPI_RTYPE_BUFFER}},
241 {.info = {"_OST", 3, 0}},
242 {.info = {"_PCL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
243 {.info = {"_PCT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
244 {.info = {"_PDC", 1, 0}},
245 {.info = {"_PIC", 1, 0}},
246 {.info = {"_PLD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0}}, /* variable (Bufs) */
247 {.info = {"_PPC", 0, ACPI_RTYPE_INTEGER}},
248 {.info = {"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* see dig64 spec */
249 {.info = {"_PR0", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
250 {.info = {"_PR1", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
251 {.info = {"_PR2", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
252 {.info = {"_PRS", 0, ACPI_RTYPE_BUFFER}},
253
254 /*
255 * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there
256 * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow
257 * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE
258 * type to the 2nd element (index 1) in the statement below.
259 */
260 {.info = {"_PRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_FIXED, 4,
261 ACPI_RTYPE_INTEGER,
262 ACPI_RTYPE_INTEGER,
263 ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, ACPI_RTYPE_INTEGER}}, /* variable (Pkgs) each (4): Int,Int,Int/Ref,Int */
264
265 {.info = {"_PRW", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_OPTION, 2,
266 ACPI_RTYPE_INTEGER |
267 ACPI_RTYPE_PACKAGE,
268 ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0}}, /* variable (Pkgs) each: Pkg/Int,Int,[variable Refs] (Pkg is Ref/Int) */
269
270 {.info = {"_PS0", 0, 0}},
271 {.info = {"_PS1", 0, 0}},
272 {.info = {"_PS2", 0, 0}},
273 {.info = {"_PS3", 0, 0}},
274 {.info = {"_PSC", 0, ACPI_RTYPE_INTEGER}},
275 {.info = {"_PSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0}}, /* variable (Pkgs) each (5 Int) with count */
276 {.info = {"_PSL", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
277 {.info = {"_PSR", 0, ACPI_RTYPE_INTEGER}},
278 {.info = {"_PSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0}}, /* variable (Pkgs) each (6 Int) */
279 {.info = {"_PSV", 0, ACPI_RTYPE_INTEGER}},
280 {.info = {"_PSW", 1, 0}},
281 {.info = {"_PTC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0}}, /* fixed (2 Buf) */
282 {.info = {"_PTS", 1, 0}},
283 {.info = {"_PXM", 0, ACPI_RTYPE_INTEGER}},
284 {.info = {"_REG", 2, 0}},
285 {.info = {"_REV", 0, ACPI_RTYPE_INTEGER}},
286 {.info = {"_RMV", 0, ACPI_RTYPE_INTEGER}},
287 {.info = {"_ROM", 2, ACPI_RTYPE_BUFFER}},
288 {.info = {"_RTV", 0, ACPI_RTYPE_INTEGER}},
289
290 /*
291 * For _S0_ through _S5_, the ACPI spec defines a return Package containing 1 Integer,
292 * but most DSDTs have it wrong - 2,3, or 4 integers. Allow this by making the objects "variable length",
293 * but all elements must be Integers.
294 */
295 {.info = {"_S0_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
296 {.info = {"_S1_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
297 {.info = {"_S2_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
298 {.info = {"_S3_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
299 {.info = {"_S4_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
300 {.info = {"_S5_", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0}}, /* fixed (1 Int) */
301
302 {.info = {"_S1D", 0, ACPI_RTYPE_INTEGER}},
303 {.info = {"_S2D", 0, ACPI_RTYPE_INTEGER}},
304 {.info = {"_S3D", 0, ACPI_RTYPE_INTEGER}},
305 {.info = {"_S4D", 0, ACPI_RTYPE_INTEGER}},
306 {.info = {"_S0W", 0, ACPI_RTYPE_INTEGER}},
307 {.info = {"_S1W", 0, ACPI_RTYPE_INTEGER}},
308 {.info = {"_S2W", 0, ACPI_RTYPE_INTEGER}},
309 {.info = {"_S3W", 0, ACPI_RTYPE_INTEGER}},
310 {.info = {"_S4W", 0, ACPI_RTYPE_INTEGER}},
311 {.info = {"_SBS", 0, ACPI_RTYPE_INTEGER}},
312 {.info = {"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */
313 /* Note: the 3-arg definition may be removed for ACPI 4.0 */
314 {.info = {"_SDD", 1, 0}},
315 {.info = {"_SEG", 0, ACPI_RTYPE_INTEGER}},
316 {.info = {"_SLI", 0, ACPI_RTYPE_BUFFER}},
317 {.info = {"_SPD", 1, ACPI_RTYPE_INTEGER}},
318 {.info = {"_SRS", 1, 0}},
319 {.info = {"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* see IPMI spec */
320 {.info = {"_SST", 1, 0}},
321 {.info = {"_STA", 0, ACPI_RTYPE_INTEGER}},
322 {.info = {"_STM", 3, 0}},
323 {.info = {"_STR", 0, ACPI_RTYPE_BUFFER}},
324 {.info = {"_SUN", 0, ACPI_RTYPE_INTEGER}},
325 {.info = {"_SWS", 0, ACPI_RTYPE_INTEGER}},
326 {.info = {"_TC1", 0, ACPI_RTYPE_INTEGER}},
327 {.info = {"_TC2", 0, ACPI_RTYPE_INTEGER}},
328 {.info = {"_TMP", 0, ACPI_RTYPE_INTEGER}},
329 {.info = {"_TPC", 0, ACPI_RTYPE_INTEGER}},
330 {.info = {"_TPT", 1, 0}},
331 {.info = {"_TRT", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2,
332 ACPI_RTYPE_INTEGER, 6, 0}}, /* variable (Pkgs) each 2_ref/6_int */
333 {.info = {"_TSD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int with count */
334 {.info = {"_TSP", 0, ACPI_RTYPE_INTEGER}},
335 {.info = {"_TSS", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* variable (Pkgs) each 5_int */
336 {.info = {"_TST", 0, ACPI_RTYPE_INTEGER}},
337 {.info = {"_TTS", 1, 0}},
338 {.info = {"_TZD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0}}, /* variable (Refs) */
339 {.info = {"_TZM", 0, ACPI_RTYPE_REFERENCE}},
340 {.info = {"_TZP", 0, ACPI_RTYPE_INTEGER}},
341 {.info = {"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}},
342 {.info = {"_UPC", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0}}, /* fixed (4 Int) */
343 {.info = {"_UPD", 0, ACPI_RTYPE_INTEGER}},
344 {.info = {"_UPP", 0, ACPI_RTYPE_INTEGER}},
345 {.info = {"_VPO", 0, ACPI_RTYPE_INTEGER}},
346
347 /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
348
349 {.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_PACKAGE}},
350 {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */
351 {.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */
352};
353
354#if 0
355 /* Not implemented */
356
357{
358"_WDG", 0, ACPI_RTYPE_BUFFER}, /* MS Extension */
359
360{
361"_WED", 1, ACPI_RTYPE_PACKAGE}, /* MS Extension */
362
363 /* This is an internally implemented control method, no need to check */
364{
365"_OSI", 1, ACPI_RTYPE_INTEGER},
366
367 /* TBD: */
368 _PRT - currently ignore reversed entries.attempt to fix here ?
369 think about code that attempts to fix package elements like _BIF, etc.
370#endif
371#endif
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index d38f9be2f6ee..63f5b4cf4de1 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -908,7 +908,9 @@ enum acpi_madt_type {
908 ACPI_MADT_TYPE_IO_SAPIC = 6, 908 ACPI_MADT_TYPE_IO_SAPIC = 6,
909 ACPI_MADT_TYPE_LOCAL_SAPIC = 7, 909 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
910 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, 910 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
911 ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */ 911 ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
912 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
913 ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */
912}; 914};
913 915
914/* 916/*
@@ -1009,6 +1011,26 @@ struct acpi_madt_interrupt_source {
1009 1011
1010#define ACPI_MADT_CPEI_OVERRIDE (1) 1012#define ACPI_MADT_CPEI_OVERRIDE (1)
1011 1013
1014/* 9: Processor Local X2_APIC (07/2008) */
1015
1016struct acpi_madt_local_x2apic {
1017 struct acpi_subtable_header header;
1018 u16 reserved; /* Reserved - must be zero */
1019 u32 local_apic_id; /* Processor X2_APIC ID */
1020 u32 lapic_flags;
1021 u32 uid; /* Extended X2_APIC processor ID */
1022};
1023
1024/* 10: Local X2APIC NMI (07/2008) */
1025
1026struct acpi_madt_local_x2apic_nmi {
1027 struct acpi_subtable_header header;
1028 u16 inti_flags;
1029 u32 uid; /* Processor X2_APIC ID */
1030 u8 lint; /* LINTn to which NMI is connected */
1031 u8 reserved[3];
1032};
1033
1012/* 1034/*
1013 * Common flags fields for MADT subtables 1035 * Common flags fields for MADT subtables
1014 */ 1036 */
@@ -1150,10 +1172,15 @@ struct acpi_table_srat {
1150enum acpi_srat_type { 1172enum acpi_srat_type {
1151 ACPI_SRAT_TYPE_CPU_AFFINITY = 0, 1173 ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
1152 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, 1174 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
1153 ACPI_SRAT_TYPE_RESERVED = 2 1175 ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2,
1176 ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */
1154}; 1177};
1155 1178
1156/* SRAT sub-tables */ 1179/*
1180 * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header
1181 */
1182
1183/* 0: Processor Local APIC/SAPIC Affinity */
1157 1184
1158struct acpi_srat_cpu_affinity { 1185struct acpi_srat_cpu_affinity {
1159 struct acpi_subtable_header header; 1186 struct acpi_subtable_header header;
@@ -1165,9 +1192,7 @@ struct acpi_srat_cpu_affinity {
1165 u32 reserved; /* Reserved, must be zero */ 1192 u32 reserved; /* Reserved, must be zero */
1166}; 1193};
1167 1194
1168/* Flags */ 1195/* 1: Memory Affinity */
1169
1170#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
1171 1196
1172struct acpi_srat_mem_affinity { 1197struct acpi_srat_mem_affinity {
1173 struct acpi_subtable_header header; 1198 struct acpi_subtable_header header;
@@ -1186,6 +1211,20 @@ struct acpi_srat_mem_affinity {
1186#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ 1211#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
1187#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ 1212#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
1188 1213
1214/* 2: Processor Local X2_APIC Affinity (07/2008) */
1215
1216struct acpi_srat_x2apic_cpu_affinity {
1217 struct acpi_subtable_header header;
1218 u16 reserved; /* Reserved, must be zero */
1219 u32 proximity_domain;
1220 u32 apic_id;
1221 u32 flags;
1222};
1223
1224/* Flags for struct acpi_srat_cpu_affinity and struct acpi_srat_x2apic_cpu_affinity */
1225
1226#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
1227
1189/******************************************************************************* 1228/*******************************************************************************
1190 * 1229 *
1191 * TCPA - Trusted Computing Platform Alliance table 1230 * TCPA - Trusted Computing Platform Alliance table
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 4ea4f40bf894..e8936ab59627 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -607,8 +607,15 @@ typedef u8 acpi_adr_space_type;
607 607
608/* 608/*
609 * bit_register IDs 609 * bit_register IDs
610 * These are bitfields defined within the full ACPI registers 610 *
611 * These values are intended to be used by the hardware interfaces
612 * and are mapped to individual bitfields defined within the ACPI
613 * registers. See the acpi_gbl_bit_register_info global table in utglobal.c
614 * for this mapping.
611 */ 615 */
616
617/* PM1 Status register */
618
612#define ACPI_BITREG_TIMER_STATUS 0x00 619#define ACPI_BITREG_TIMER_STATUS 0x00
613#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 620#define ACPI_BITREG_BUS_MASTER_STATUS 0x01
614#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 621#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
@@ -618,24 +625,29 @@ typedef u8 acpi_adr_space_type;
618#define ACPI_BITREG_WAKE_STATUS 0x06 625#define ACPI_BITREG_WAKE_STATUS 0x06
619#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 626#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
620 627
628/* PM1 Enable register */
629
621#define ACPI_BITREG_TIMER_ENABLE 0x08 630#define ACPI_BITREG_TIMER_ENABLE 0x08
622#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 631#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
623#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A 632#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
624#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B 633#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
625#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C 634#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
626#define ACPI_BITREG_WAKE_ENABLE 0x0D 635#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D
627#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E 636
637/* PM1 Control register */
638
639#define ACPI_BITREG_SCI_ENABLE 0x0E
640#define ACPI_BITREG_BUS_MASTER_RLD 0x0F
641#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10
642#define ACPI_BITREG_SLEEP_TYPE_A 0x11
643#define ACPI_BITREG_SLEEP_TYPE_B 0x12
644#define ACPI_BITREG_SLEEP_ENABLE 0x13
628 645
629#define ACPI_BITREG_SCI_ENABLE 0x0F 646/* PM2 Control register */
630#define ACPI_BITREG_BUS_MASTER_RLD 0x10
631#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
632#define ACPI_BITREG_SLEEP_TYPE_A 0x12
633#define ACPI_BITREG_SLEEP_TYPE_B 0x13
634#define ACPI_BITREG_SLEEP_ENABLE 0x14
635 647
636#define ACPI_BITREG_ARB_DISABLE 0x15 648#define ACPI_BITREG_ARB_DISABLE 0x14
637 649
638#define ACPI_BITREG_MAX 0x15 650#define ACPI_BITREG_MAX 0x14
639#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 651#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
640 652
641/* 653/*
@@ -859,6 +871,7 @@ struct acpi_obj_info_header {
859struct acpi_device_info { 871struct acpi_device_info {
860 ACPI_COMMON_OBJ_INFO; 872 ACPI_COMMON_OBJ_INFO;
861 873
874 u32 param_count; /* If a method, required parameter count */
862 u32 valid; /* Indicates which fields below are valid */ 875 u32 valid; /* Indicates which fields below are valid */
863 u32 current_status; /* _STA value */ 876 u32 current_status; /* _STA value */
864 acpi_integer address; /* _ADR value if any */ 877 acpi_integer address; /* _ADR value if any */
@@ -1225,8 +1238,8 @@ struct acpi_resource {
1225 1238
1226#pragma pack() 1239#pragma pack()
1227 1240
1228#define ACPI_RS_SIZE_MIN 12
1229#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ 1241#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
1242#define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
1230#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type)) 1243#define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
1231 1244
1232#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) 1245#define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 69f8888771ff..d8307b2987e3 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -110,7 +110,7 @@ struct acpi_pkg_info {
110/* 110/*
111 * utglobal - Global data structures and procedures 111 * utglobal - Global data structures and procedures
112 */ 112 */
113void acpi_ut_init_globals(void); 113acpi_status acpi_ut_init_globals(void);
114 114
115#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 115#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
116 116
@@ -126,6 +126,8 @@ char *acpi_ut_get_node_name(void *object);
126 126
127char *acpi_ut_get_descriptor_name(void *object); 127char *acpi_ut_get_descriptor_name(void *object);
128 128
129const char *acpi_ut_get_reference_name(union acpi_operand_object *object);
130
129char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); 131char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc);
130 132
131char *acpi_ut_get_region_name(u8 space_id); 133char *acpi_ut_get_region_name(u8 space_id);
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 8996dba90cd9..8e2cdc57b197 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -46,7 +46,7 @@
46 46
47/* Function name is used for debug output. Non-ANSI, compiler-dependent */ 47/* Function name is used for debug output. Non-ANSI, compiler-dependent */
48 48
49#define ACPI_GET_FUNCTION_NAME __FUNCTION__ 49#define ACPI_GET_FUNCTION_NAME __func__
50 50
51/* 51/*
52 * This macro is used to tag functions as "printf-like" because 52 * This macro is used to tag functions as "printf-like" because
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 9af464598682..029c8c06c151 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -53,6 +53,7 @@
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/ctype.h> 55#include <linux/ctype.h>
56#include <linux/sched.h>
56#include <asm/system.h> 57#include <asm/system.h>
57#include <asm/atomic.h> 58#include <asm/atomic.h>
58#include <asm/div64.h> 59#include <asm/div64.h>
@@ -137,4 +138,9 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
137#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 138#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
138#define ACPI_FREE(a) kfree(a) 139#define ACPI_FREE(a) kfree(a)
139 140
141/*
142 * We need to show where it is safe to preempt execution of ACPICA
143 */
144#define ACPI_PREEMPTION_POINT() cond_resched()
145
140#endif /* __ACLINUX_H__ */ 146#endif /* __ACLINUX_H__ */
diff --git a/include/asm-arm/plat-s3c/debug-macro.S b/include/asm-arm/plat-s3c/debug-macro.S
deleted file mode 100644
index 84c40b847da8..000000000000
--- a/include/asm-arm/plat-s3c/debug-macro.S
+++ /dev/null
@@ -1,75 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/debug-macro.S
2 *
3 * Copyright 2005, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <asm/plat-s3c/regs-serial.h>
13
14/* The S3C2440 implementations are used by default as they are the
15 * most widely re-used */
16
17 .macro fifo_level_s3c2440 rd, rx
18 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
19 and \rd, \rd, #S3C2440_UFSTAT_TXMASK
20 .endm
21
22#ifndef fifo_level
23#define fifo_level fifo_level_s3c2410
24#endif
25
26 .macro fifo_full_s3c2440 rd, rx
27 ldr \rd, [ \rx, # S3C2410_UFSTAT ]
28 tst \rd, #S3C2440_UFSTAT_TXFULL
29 .endm
30
31#ifndef fifo_full
32#define fifo_full fifo_full_s3c2440
33#endif
34
35 .macro senduart,rd,rx
36 strb \rd, [\rx, # S3C2410_UTXH ]
37 .endm
38
39 .macro busyuart, rd, rx
40 ldr \rd, [ \rx, # S3C2410_UFCON ]
41 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
42 beq 1001f @
43 @ FIFO enabled...
441003:
45 fifo_full \rd, \rx
46 bne 1003b
47 b 1002f
48
491001:
50 @ busy waiting for non fifo
51 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
52 tst \rd, #S3C2410_UTRSTAT_TXFE
53 beq 1001b
54
551002: @ exit busyuart
56 .endm
57
58 .macro waituart,rd,rx
59 ldr \rd, [ \rx, # S3C2410_UFCON ]
60 tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
61 beq 1001f @
62 @ FIFO enabled...
631003:
64 fifo_level \rd, \rx
65 teq \rd, #0
66 bne 1003b
67 b 1002f
681001:
69 @ idle waiting for non fifo
70 ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
71 tst \rd, #S3C2410_UTRSTAT_TXFE
72 beq 1001b
73
741002: @ exit busyuart
75 .endm
diff --git a/include/asm-arm/plat-s3c/map.h b/include/asm-arm/plat-s3c/map.h
deleted file mode 100644
index b84289d32a54..000000000000
--- a/include/asm-arm/plat-s3c/map.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/map.h
2 *
3 * Copyright 2003, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C - Memory map definitions (virtual addresses)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_PLAT_MAP_H
15#define __ASM_PLAT_MAP_H __FILE__
16
17/* Fit all our registers in at 0xF4000000 upwards, trying to use as
18 * little of the VA space as possible so vmalloc and friends have a
19 * better chance of getting memory.
20 *
21 * we try to ensure stuff like the IRQ registers are available for
22 * an single MOVS instruction (ie, only 8 bits of set data)
23 */
24
25#define S3C_ADDR_BASE (0xF4000000)
26
27#ifndef __ASSEMBLY__
28#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
29#else
30#define S3C_ADDR(x) (S3C_ADDR_BASE + (x))
31#endif
32
33#define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */
34#define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */
35#define S3C_VA_MEM S3C_ADDR(0x00200000) /* system control */
36#define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
37#define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
38#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
39
40#endif /* __ASM_PLAT_MAP_H */
diff --git a/include/asm-arm/plat-s3c/regs-adc.h b/include/asm-arm/plat-s3c/regs-adc.h
deleted file mode 100644
index 4323cccc86cd..000000000000
--- a/include/asm-arm/plat-s3c/regs-adc.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-adc.h
2 *
3 * Copyright (c) 2004 Shannon Holland <holland@loser.net>
4 *
5 * This program is free software; yosu 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 * S3C2410 ADC registers
10*/
11
12#ifndef __ASM_ARCH_REGS_ADC_H
13#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
14
15#define S3C2410_ADCREG(x) (x)
16
17#define S3C2410_ADCCON S3C2410_ADCREG(0x00)
18#define S3C2410_ADCTSC S3C2410_ADCREG(0x04)
19#define S3C2410_ADCDLY S3C2410_ADCREG(0x08)
20#define S3C2410_ADCDAT0 S3C2410_ADCREG(0x0C)
21#define S3C2410_ADCDAT1 S3C2410_ADCREG(0x10)
22
23
24/* ADCCON Register Bits */
25#define S3C2410_ADCCON_ECFLG (1<<15)
26#define S3C2410_ADCCON_PRSCEN (1<<14)
27#define S3C2410_ADCCON_PRSCVL(x) (((x)&0xFF)<<6)
28#define S3C2410_ADCCON_PRSCVLMASK (0xFF<<6)
29#define S3C2410_ADCCON_SELMUX(x) (((x)&0x7)<<3)
30#define S3C2410_ADCCON_MUXMASK (0x7<<3)
31#define S3C2410_ADCCON_STDBM (1<<2)
32#define S3C2410_ADCCON_READ_START (1<<1)
33#define S3C2410_ADCCON_ENABLE_START (1<<0)
34#define S3C2410_ADCCON_STARTMASK (0x3<<0)
35
36
37/* ADCTSC Register Bits */
38#define S3C2410_ADCTSC_YM_SEN (1<<7)
39#define S3C2410_ADCTSC_YP_SEN (1<<6)
40#define S3C2410_ADCTSC_XM_SEN (1<<5)
41#define S3C2410_ADCTSC_XP_SEN (1<<4)
42#define S3C2410_ADCTSC_PULL_UP_DISABLE (1<<3)
43#define S3C2410_ADCTSC_AUTO_PST (1<<2)
44#define S3C2410_ADCTSC_XY_PST(x) (((x)&0x3)<<0)
45
46/* ADCDAT0 Bits */
47#define S3C2410_ADCDAT0_UPDOWN (1<<15)
48#define S3C2410_ADCDAT0_AUTO_PST (1<<14)
49#define S3C2410_ADCDAT0_XY_PST (0x3<<12)
50#define S3C2410_ADCDAT0_XPDATA_MASK (0x03FF)
51
52/* ADCDAT1 Bits */
53#define S3C2410_ADCDAT1_UPDOWN (1<<15)
54#define S3C2410_ADCDAT1_AUTO_PST (1<<14)
55#define S3C2410_ADCDAT1_XY_PST (0x3<<12)
56#define S3C2410_ADCDAT1_YPDATA_MASK (0x03FF)
57
58#endif /* __ASM_ARCH_REGS_ADC_H */
59
60
diff --git a/include/asm-arm/plat-s3c/regs-serial.h b/include/asm-arm/plat-s3c/regs-serial.h
deleted file mode 100644
index a0daa647b92c..000000000000
--- a/include/asm-arm/plat-s3c/regs-serial.h
+++ /dev/null
@@ -1,232 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-serial.h
2 *
3 * From linux/include/asm-arm/hardware/serial_s3c2410.h
4 *
5 * Internal header file for Samsung S3C2410 serial ports (UART0-2)
6 *
7 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
8 *
9 * Additional defines, (c) 2003 Simtec Electronics (linux@simtec.co.uk)
10 *
11 * Adapted from:
12 *
13 * Internal header file for MX1ADS serial ports (UART1 & 2)
14 *
15 * Copyright (C) 2002 Shane Nay (shane@minirl.com)
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30*/
31
32#ifndef __ASM_ARM_REGS_SERIAL_H
33#define __ASM_ARM_REGS_SERIAL_H
34
35#define S3C24XX_VA_UART0 (S3C_VA_UART)
36#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
37#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
38#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
39
40#define S3C2410_PA_UART0 (S3C24XX_PA_UART)
41#define S3C2410_PA_UART1 (S3C24XX_PA_UART + 0x4000 )
42#define S3C2410_PA_UART2 (S3C24XX_PA_UART + 0x8000 )
43#define S3C2443_PA_UART3 (S3C24XX_PA_UART + 0xC000 )
44
45#define S3C2410_URXH (0x24)
46#define S3C2410_UTXH (0x20)
47#define S3C2410_ULCON (0x00)
48#define S3C2410_UCON (0x04)
49#define S3C2410_UFCON (0x08)
50#define S3C2410_UMCON (0x0C)
51#define S3C2410_UBRDIV (0x28)
52#define S3C2410_UTRSTAT (0x10)
53#define S3C2410_UERSTAT (0x14)
54#define S3C2410_UFSTAT (0x18)
55#define S3C2410_UMSTAT (0x1C)
56
57#define S3C2410_LCON_CFGMASK ((0xF<<3)|(0x3))
58
59#define S3C2410_LCON_CS5 (0x0)
60#define S3C2410_LCON_CS6 (0x1)
61#define S3C2410_LCON_CS7 (0x2)
62#define S3C2410_LCON_CS8 (0x3)
63#define S3C2410_LCON_CSMASK (0x3)
64
65#define S3C2410_LCON_PNONE (0x0)
66#define S3C2410_LCON_PEVEN (0x5 << 3)
67#define S3C2410_LCON_PODD (0x4 << 3)
68#define S3C2410_LCON_PMASK (0x7 << 3)
69
70#define S3C2410_LCON_STOPB (1<<2)
71#define S3C2410_LCON_IRM (1<<6)
72
73#define S3C2440_UCON_CLKMASK (3<<10)
74#define S3C2440_UCON_PCLK (0<<10)
75#define S3C2440_UCON_UCLK (1<<10)
76#define S3C2440_UCON_PCLK2 (2<<10)
77#define S3C2440_UCON_FCLK (3<<10)
78#define S3C2443_UCON_EPLL (3<<10)
79
80#define S3C2440_UCON2_FCLK_EN (1<<15)
81#define S3C2440_UCON0_DIVMASK (15 << 12)
82#define S3C2440_UCON1_DIVMASK (15 << 12)
83#define S3C2440_UCON2_DIVMASK (7 << 12)
84#define S3C2440_UCON_DIVSHIFT (12)
85
86#define S3C2412_UCON_CLKMASK (3<<10)
87#define S3C2412_UCON_UCLK (1<<10)
88#define S3C2412_UCON_USYSCLK (3<<10)
89#define S3C2412_UCON_PCLK (0<<10)
90#define S3C2412_UCON_PCLK2 (2<<10)
91
92#define S3C2410_UCON_UCLK (1<<10)
93#define S3C2410_UCON_SBREAK (1<<4)
94
95#define S3C2410_UCON_TXILEVEL (1<<9)
96#define S3C2410_UCON_RXILEVEL (1<<8)
97#define S3C2410_UCON_TXIRQMODE (1<<2)
98#define S3C2410_UCON_RXIRQMODE (1<<0)
99#define S3C2410_UCON_RXFIFO_TOI (1<<7)
100#define S3C2443_UCON_RXERR_IRQEN (1<<6)
101#define S3C2443_UCON_LOOPBACK (1<<5)
102
103#define S3C2410_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
104 S3C2410_UCON_RXILEVEL | \
105 S3C2410_UCON_TXIRQMODE | \
106 S3C2410_UCON_RXIRQMODE | \
107 S3C2410_UCON_RXFIFO_TOI)
108
109#define S3C2410_UFCON_FIFOMODE (1<<0)
110#define S3C2410_UFCON_TXTRIG0 (0<<6)
111#define S3C2410_UFCON_RXTRIG8 (1<<4)
112#define S3C2410_UFCON_RXTRIG12 (2<<4)
113
114/* S3C2440 FIFO trigger levels */
115#define S3C2440_UFCON_RXTRIG1 (0<<4)
116#define S3C2440_UFCON_RXTRIG8 (1<<4)
117#define S3C2440_UFCON_RXTRIG16 (2<<4)
118#define S3C2440_UFCON_RXTRIG32 (3<<4)
119
120#define S3C2440_UFCON_TXTRIG0 (0<<6)
121#define S3C2440_UFCON_TXTRIG16 (1<<6)
122#define S3C2440_UFCON_TXTRIG32 (2<<6)
123#define S3C2440_UFCON_TXTRIG48 (3<<6)
124
125#define S3C2410_UFCON_RESETBOTH (3<<1)
126#define S3C2410_UFCON_RESETTX (1<<2)
127#define S3C2410_UFCON_RESETRX (1<<1)
128
129#define S3C2410_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
130 S3C2410_UFCON_TXTRIG0 | \
131 S3C2410_UFCON_RXTRIG8 )
132
133#define S3C2410_UMCOM_AFC (1<<4)
134#define S3C2410_UMCOM_RTS_LOW (1<<0)
135
136#define S3C2412_UMCON_AFC_63 (0<<5) /* same as s3c2443 */
137#define S3C2412_UMCON_AFC_56 (1<<5)
138#define S3C2412_UMCON_AFC_48 (2<<5)
139#define S3C2412_UMCON_AFC_40 (3<<5)
140#define S3C2412_UMCON_AFC_32 (4<<5)
141#define S3C2412_UMCON_AFC_24 (5<<5)
142#define S3C2412_UMCON_AFC_16 (6<<5)
143#define S3C2412_UMCON_AFC_8 (7<<5)
144
145#define S3C2410_UFSTAT_TXFULL (1<<9)
146#define S3C2410_UFSTAT_RXFULL (1<<8)
147#define S3C2410_UFSTAT_TXMASK (15<<4)
148#define S3C2410_UFSTAT_TXSHIFT (4)
149#define S3C2410_UFSTAT_RXMASK (15<<0)
150#define S3C2410_UFSTAT_RXSHIFT (0)
151
152/* UFSTAT S3C2443 same as S3C2440 */
153#define S3C2440_UFSTAT_TXFULL (1<<14)
154#define S3C2440_UFSTAT_RXFULL (1<<6)
155#define S3C2440_UFSTAT_TXSHIFT (8)
156#define S3C2440_UFSTAT_RXSHIFT (0)
157#define S3C2440_UFSTAT_TXMASK (63<<8)
158#define S3C2440_UFSTAT_RXMASK (63)
159
160#define S3C2410_UTRSTAT_TXE (1<<2)
161#define S3C2410_UTRSTAT_TXFE (1<<1)
162#define S3C2410_UTRSTAT_RXDR (1<<0)
163
164#define S3C2410_UERSTAT_OVERRUN (1<<0)
165#define S3C2410_UERSTAT_FRAME (1<<2)
166#define S3C2410_UERSTAT_BREAK (1<<3)
167#define S3C2443_UERSTAT_PARITY (1<<1)
168
169#define S3C2410_UERSTAT_ANY (S3C2410_UERSTAT_OVERRUN | \
170 S3C2410_UERSTAT_FRAME | \
171 S3C2410_UERSTAT_BREAK)
172
173#define S3C2410_UMSTAT_CTS (1<<0)
174#define S3C2410_UMSTAT_DeltaCTS (1<<2)
175
176#define S3C2443_DIVSLOT (0x2C)
177
178#ifndef __ASSEMBLY__
179
180/* struct s3c24xx_uart_clksrc
181 *
182 * this structure defines a named clock source that can be used for the
183 * uart, so that the best clock can be selected for the requested baud
184 * rate.
185 *
186 * min_baud and max_baud define the range of baud-rates this clock is
187 * acceptable for, if they are both zero, it is assumed any baud rate that
188 * can be generated from this clock will be used.
189 *
190 * divisor gives the divisor from the clock to the one seen by the uart
191*/
192
193struct s3c24xx_uart_clksrc {
194 const char *name;
195 unsigned int divisor;
196 unsigned int min_baud;
197 unsigned int max_baud;
198};
199
200/* configuration structure for per-machine configurations for the
201 * serial port
202 *
203 * the pointer is setup by the machine specific initialisation from the
204 * arch/arm/mach-s3c2410/ directory.
205*/
206
207struct s3c2410_uartcfg {
208 unsigned char hwport; /* hardware port number */
209 unsigned char unused;
210 unsigned short flags;
211 upf_t uart_flags; /* default uart flags */
212
213 unsigned long ucon; /* value of ucon for port */
214 unsigned long ulcon; /* value of ulcon for port */
215 unsigned long ufcon; /* value of ufcon for port */
216
217 struct s3c24xx_uart_clksrc *clocks;
218 unsigned int clocks_size;
219};
220
221/* s3c24xx_uart_devs
222 *
223 * this is exported from the core as we cannot use driver_register(),
224 * or platform_add_device() before the console_initcall()
225*/
226
227extern struct platform_device *s3c24xx_uart_devs[3];
228
229#endif /* __ASSEMBLY__ */
230
231#endif /* __ASM_ARM_REGS_SERIAL_H */
232
diff --git a/include/asm-arm/plat-s3c/regs-timer.h b/include/asm-arm/plat-s3c/regs-timer.h
deleted file mode 100644
index cc0eedd53e38..000000000000
--- a/include/asm-arm/plat-s3c/regs-timer.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-timer.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 Timer configuration
11*/
12
13
14#ifndef __ASM_ARCH_REGS_TIMER_H
15#define __ASM_ARCH_REGS_TIMER_H
16
17#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
18#define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
19
20#define S3C2410_TCFG0 S3C_TIMERREG(0x00)
21#define S3C2410_TCFG1 S3C_TIMERREG(0x04)
22#define S3C2410_TCON S3C_TIMERREG(0x08)
23
24#define S3C2410_TCFG_PRESCALER0_MASK (255<<0)
25#define S3C2410_TCFG_PRESCALER1_MASK (255<<8)
26#define S3C2410_TCFG_PRESCALER1_SHIFT (8)
27#define S3C2410_TCFG_DEADZONE_MASK (255<<16)
28#define S3C2410_TCFG_DEADZONE_SHIFT (16)
29
30#define S3C2410_TCFG1_MUX4_DIV2 (0<<16)
31#define S3C2410_TCFG1_MUX4_DIV4 (1<<16)
32#define S3C2410_TCFG1_MUX4_DIV8 (2<<16)
33#define S3C2410_TCFG1_MUX4_DIV16 (3<<16)
34#define S3C2410_TCFG1_MUX4_TCLK1 (4<<16)
35#define S3C2410_TCFG1_MUX4_MASK (15<<16)
36#define S3C2410_TCFG1_MUX4_SHIFT (16)
37
38#define S3C2410_TCFG1_MUX3_DIV2 (0<<12)
39#define S3C2410_TCFG1_MUX3_DIV4 (1<<12)
40#define S3C2410_TCFG1_MUX3_DIV8 (2<<12)
41#define S3C2410_TCFG1_MUX3_DIV16 (3<<12)
42#define S3C2410_TCFG1_MUX3_TCLK1 (4<<12)
43#define S3C2410_TCFG1_MUX3_MASK (15<<12)
44
45
46#define S3C2410_TCFG1_MUX2_DIV2 (0<<8)
47#define S3C2410_TCFG1_MUX2_DIV4 (1<<8)
48#define S3C2410_TCFG1_MUX2_DIV8 (2<<8)
49#define S3C2410_TCFG1_MUX2_DIV16 (3<<8)
50#define S3C2410_TCFG1_MUX2_TCLK1 (4<<8)
51#define S3C2410_TCFG1_MUX2_MASK (15<<8)
52
53
54#define S3C2410_TCFG1_MUX1_DIV2 (0<<4)
55#define S3C2410_TCFG1_MUX1_DIV4 (1<<4)
56#define S3C2410_TCFG1_MUX1_DIV8 (2<<4)
57#define S3C2410_TCFG1_MUX1_DIV16 (3<<4)
58#define S3C2410_TCFG1_MUX1_TCLK0 (4<<4)
59#define S3C2410_TCFG1_MUX1_MASK (15<<4)
60
61#define S3C2410_TCFG1_MUX0_DIV2 (0<<0)
62#define S3C2410_TCFG1_MUX0_DIV4 (1<<0)
63#define S3C2410_TCFG1_MUX0_DIV8 (2<<0)
64#define S3C2410_TCFG1_MUX0_DIV16 (3<<0)
65#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0)
66#define S3C2410_TCFG1_MUX0_MASK (15<<0)
67
68#define S3C2410_TCFG1_MUX_DIV2 (0<<0)
69#define S3C2410_TCFG1_MUX_DIV4 (1<<0)
70#define S3C2410_TCFG1_MUX_DIV8 (2<<0)
71#define S3C2410_TCFG1_MUX_DIV16 (3<<0)
72#define S3C2410_TCFG1_MUX_TCLK (4<<0)
73#define S3C2410_TCFG1_MUX_MASK (15<<0)
74
75#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
76
77/* for each timer, we have an count buffer, an compare buffer and
78 * an observation buffer
79*/
80
81/* WARNING - timer 4 has no buffer reg, and it's observation is at +4 */
82
83#define S3C2410_TCNTB(tmr) S3C_TIMERREG2(tmr, 0x00)
84#define S3C2410_TCMPB(tmr) S3C_TIMERREG2(tmr, 0x04)
85#define S3C2410_TCNTO(tmr) S3C_TIMERREG2(tmr, (((tmr) == 4) ? 0x04 : 0x08))
86
87#define S3C2410_TCON_T4RELOAD (1<<22)
88#define S3C2410_TCON_T4MANUALUPD (1<<21)
89#define S3C2410_TCON_T4START (1<<20)
90
91#define S3C2410_TCON_T3RELOAD (1<<19)
92#define S3C2410_TCON_T3INVERT (1<<18)
93#define S3C2410_TCON_T3MANUALUPD (1<<17)
94#define S3C2410_TCON_T3START (1<<16)
95
96#define S3C2410_TCON_T2RELOAD (1<<15)
97#define S3C2410_TCON_T2INVERT (1<<14)
98#define S3C2410_TCON_T2MANUALUPD (1<<13)
99#define S3C2410_TCON_T2START (1<<12)
100
101#define S3C2410_TCON_T1RELOAD (1<<11)
102#define S3C2410_TCON_T1INVERT (1<<10)
103#define S3C2410_TCON_T1MANUALUPD (1<<9)
104#define S3C2410_TCON_T1START (1<<8)
105
106#define S3C2410_TCON_T0DEADZONE (1<<4)
107#define S3C2410_TCON_T0RELOAD (1<<3)
108#define S3C2410_TCON_T0INVERT (1<<2)
109#define S3C2410_TCON_T0MANUALUPD (1<<1)
110#define S3C2410_TCON_T0START (1<<0)
111
112#endif /* __ASM_ARCH_REGS_TIMER_H */
113
114
115
diff --git a/include/asm-arm/plat-s3c/uncompress.h b/include/asm-arm/plat-s3c/uncompress.h
deleted file mode 100644
index 19b9eda39485..000000000000
--- a/include/asm-arm/plat-s3c/uncompress.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/* linux/include/asm-arm/plat-s3c/uncompress.h
2 *
3 * Copyright 2003, 2007 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C - uncompress code
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#ifndef __ASM_PLAT_UNCOMPRESS_H
15#define __ASM_PLAT_UNCOMPRESS_H
16
17typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
18
19/* uart setup */
20
21static unsigned int fifo_mask;
22static unsigned int fifo_max;
23
24/* forward declerations */
25
26static void arch_detect_cpu(void);
27
28/* defines for UART registers */
29
30#include <asm/plat-s3c/regs-serial.h>
31#include <asm/plat-s3c/regs-watchdog.h>
32
33/* working in physical space... */
34#undef S3C2410_WDOGREG
35#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x)))
36
37/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14)
39
40#define uart_base S3C24XX_PA_UART + (0x4000*CONFIG_S3C_LOWLEVEL_UART_PORT)
41
42static __inline__ void
43uart_wr(unsigned int reg, unsigned int val)
44{
45 volatile unsigned int *ptr;
46
47 ptr = (volatile unsigned int *)(reg + uart_base);
48 *ptr = val;
49}
50
51static __inline__ unsigned int
52uart_rd(unsigned int reg)
53{
54 volatile unsigned int *ptr;
55
56 ptr = (volatile unsigned int *)(reg + uart_base);
57 return *ptr;
58}
59
60/* we can deal with the case the UARTs are being run
61 * in FIFO mode, so that we don't hold up our execution
62 * waiting for tx to happen...
63*/
64
65static void putc(int ch)
66{
67 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
68 int level;
69
70 while (1) {
71 level = uart_rd(S3C2410_UFSTAT);
72 level &= fifo_mask;
73
74 if (level < fifo_max)
75 break;
76 }
77
78 } else {
79 /* not using fifos */
80
81 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
82 barrier();
83 }
84
85 /* write byte to transmission register */
86 uart_wr(S3C2410_UTXH, ch);
87}
88
89static inline void flush(void)
90{
91}
92
93#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
94
95/* CONFIG_S3C_BOOT_WATCHDOG
96 *
97 * Simple boot-time watchdog setup, to reboot the system if there is
98 * any problem with the boot process
99*/
100
101#ifdef CONFIG_S3C_BOOT_WATCHDOG
102
103#define WDOG_COUNT (0xff00)
104
105static inline void arch_decomp_wdog(void)
106{
107 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
108}
109
110static void arch_decomp_wdog_start(void)
111{
112 __raw_writel(WDOG_COUNT, S3C2410_WTDAT);
113 __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
114 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x80), S3C2410_WTCON);
115}
116
117#else
118#define arch_decomp_wdog_start()
119#define arch_decomp_wdog()
120#endif
121
122#ifdef CONFIG_S3C_BOOT_ERROR_RESET
123
124static void arch_decomp_error(const char *x)
125{
126 putstr("\n\n");
127 putstr(x);
128 putstr("\n\n -- System resetting\n");
129
130 __raw_writel(0x4000, S3C2410_WTDAT);
131 __raw_writel(0x4000, S3C2410_WTCNT);
132 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
133
134 while(1);
135}
136
137#define arch_error arch_decomp_error
138#endif
139
140static void error(char *err);
141
142static void
143arch_decomp_setup(void)
144{
145 /* we may need to setup the uart(s) here if we are not running
146 * on an BAST... the BAST will have left the uarts configured
147 * after calling linux.
148 */
149
150 arch_detect_cpu();
151 arch_decomp_wdog_start();
152}
153
154
155#endif /* __ASM_PLAT_UNCOMPRESS_H */
diff --git a/include/asm-arm/plat-s3c24xx/clock.h b/include/asm-arm/plat-s3c24xx/clock.h
deleted file mode 100644
index 235b753cd877..000000000000
--- a/include/asm-arm/plat-s3c24xx/clock.h
+++ /dev/null
@@ -1,64 +0,0 @@
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);
59extern int s3c24xx_register_clocks(struct clk **clk, int nr_clks);
60
61extern int s3c24xx_setup_clocks(unsigned long xtal,
62 unsigned long fclk,
63 unsigned long hclk,
64 unsigned long pclk);
diff --git a/include/asm-arm/plat-s3c24xx/common-smdk.h b/include/asm-arm/plat-s3c24xx/common-smdk.h
deleted file mode 100644
index 58d9094c935c..000000000000
--- a/include/asm-arm/plat-s3c24xx/common-smdk.h
+++ /dev/null
@@ -1,15 +0,0 @@
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
deleted file mode 100644
index 23e420e8bd5b..000000000000
--- a/include/asm-arm/plat-s3c24xx/cpu.h
+++ /dev/null
@@ -1,54 +0,0 @@
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/* timer for 2410/2440 */
44
45struct sys_timer;
46extern struct sys_timer s3c24xx_timer;
47
48/* system device classes */
49
50extern struct sysdev_class s3c2410_sysclass;
51extern struct sysdev_class s3c2412_sysclass;
52extern struct sysdev_class s3c2440_sysclass;
53extern struct sysdev_class s3c2442_sysclass;
54extern struct sysdev_class s3c2443_sysclass;
diff --git a/include/asm-arm/plat-s3c24xx/devs.h b/include/asm-arm/plat-s3c24xx/devs.h
deleted file mode 100644
index badaac9d64a8..000000000000
--- a/include/asm-arm/plat-s3c24xx/devs.h
+++ /dev/null
@@ -1,49 +0,0 @@
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_timer[];
25
26extern struct platform_device s3c_device_usb;
27extern struct platform_device s3c_device_lcd;
28extern struct platform_device s3c_device_wdt;
29extern struct platform_device s3c_device_i2c;
30extern struct platform_device s3c_device_iis;
31extern struct platform_device s3c_device_rtc;
32extern struct platform_device s3c_device_adc;
33extern struct platform_device s3c_device_sdi;
34extern struct platform_device s3c_device_hsmmc;
35
36extern struct platform_device s3c_device_spi0;
37extern struct platform_device s3c_device_spi1;
38
39extern struct platform_device s3c_device_nand;
40
41extern struct platform_device s3c_device_usbgadget;
42
43/* s3c2440 specific devices */
44
45#ifdef CONFIG_CPU_S3C2440
46
47extern struct platform_device s3c_device_camif;
48
49#endif
diff --git a/include/asm-arm/plat-s3c24xx/dma.h b/include/asm-arm/plat-s3c24xx/dma.h
deleted file mode 100644
index c78efe316fc8..000000000000
--- a/include/asm-arm/plat-s3c24xx/dma.h
+++ /dev/null
@@ -1,82 +0,0 @@
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 unsigned long channels_rx[S3C2410_DMA_CHANNELS];
36};
37
38struct s3c24xx_dma_selection {
39 struct s3c24xx_dma_map *map;
40 unsigned long map_size;
41 unsigned long dcon_mask;
42
43 void (*select)(struct s3c2410_dma_chan *chan,
44 struct s3c24xx_dma_map *map);
45
46 void (*direction)(struct s3c2410_dma_chan *chan,
47 struct s3c24xx_dma_map *map,
48 enum s3c2410_dmasrc dir);
49};
50
51extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
52
53/* struct s3c24xx_dma_order_ch
54 *
55 * channel map for one of the `enum dma_ch` dma channels. the list
56 * entry contains a set of low-level channel numbers, orred with
57 * DMA_CH_VALID, which are checked in the order in the array.
58*/
59
60struct s3c24xx_dma_order_ch {
61 unsigned int list[S3C2410_DMA_CHANNELS]; /* list of channels */
62 unsigned int flags; /* flags */
63};
64
65/* struct s3c24xx_dma_order
66 *
67 * information provided by either the core or the board to give the
68 * dma system a hint on how to allocate channels
69*/
70
71struct s3c24xx_dma_order {
72 struct s3c24xx_dma_order_ch channels[DMACH_MAX];
73};
74
75extern int s3c24xx_dma_order_set(struct s3c24xx_dma_order *map);
76
77/* DMA init code, called from the cpu support code */
78
79extern int s3c2410_dma_init(void);
80
81extern int s3c24xx_dma_init(unsigned int channels, unsigned int irq,
82 unsigned int stride);
diff --git a/include/asm-arm/plat-s3c24xx/irq.h b/include/asm-arm/plat-s3c24xx/irq.h
deleted file mode 100644
index 45746a995343..000000000000
--- a/include/asm-arm/plat-s3c24xx/irq.h
+++ /dev/null
@@ -1,109 +0,0 @@
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
18/* these are exported for arch/arm/mach-* usage */
19extern struct irq_chip s3c_irq_level_chip;
20extern struct irq_chip s3c_irq_chip;
21
22static inline void
23s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
24 int subcheck)
25{
26 unsigned long mask;
27 unsigned long submask;
28
29 submask = __raw_readl(S3C2410_INTSUBMSK);
30 mask = __raw_readl(S3C2410_INTMSK);
31
32 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
33
34 /* check to see if we need to mask the parent IRQ */
35
36 if ((submask & subcheck) == subcheck) {
37 __raw_writel(mask | parentbit, S3C2410_INTMSK);
38 }
39
40 /* write back masks */
41 __raw_writel(submask, S3C2410_INTSUBMSK);
42
43}
44
45static inline void
46s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
47{
48 unsigned long mask;
49 unsigned long submask;
50
51 submask = __raw_readl(S3C2410_INTSUBMSK);
52 mask = __raw_readl(S3C2410_INTMSK);
53
54 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
55 mask &= ~parentbit;
56
57 /* write back masks */
58 __raw_writel(submask, S3C2410_INTSUBMSK);
59 __raw_writel(mask, S3C2410_INTMSK);
60}
61
62
63static inline void
64s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
65{
66 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
67
68 s3c_irqsub_mask(irqno, parentmask, group);
69
70 __raw_writel(bit, S3C2410_SUBSRCPND);
71
72 /* only ack parent if we've got all the irqs (seems we must
73 * ack, all and hope that the irq system retriggers ok when
74 * the interrupt goes off again)
75 */
76
77 if (1) {
78 __raw_writel(parentmask, S3C2410_SRCPND);
79 __raw_writel(parentmask, S3C2410_INTPND);
80 }
81}
82
83static inline void
84s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
85{
86 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
87
88 __raw_writel(bit, S3C2410_SUBSRCPND);
89
90 /* only ack parent if we've got all the irqs (seems we must
91 * ack, all and hope that the irq system retriggers ok when
92 * the interrupt goes off again)
93 */
94
95 if (1) {
96 __raw_writel(parentmask, S3C2410_SRCPND);
97 __raw_writel(parentmask, S3C2410_INTPND);
98 }
99}
100
101/* exported for use in arch/arm/mach-s3c2410 */
102
103#ifdef CONFIG_PM
104extern int s3c_irq_wake(unsigned int irqno, unsigned int state);
105#else
106#define s3c_irq_wake NULL
107#endif
108
109extern 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
deleted file mode 100644
index cc623667e48a..000000000000
--- a/include/asm-arm/plat-s3c24xx/pm.h
+++ /dev/null
@@ -1,73 +0,0 @@
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
deleted file mode 100644
index 3a5a16821af8..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2400.h
+++ /dev/null
@@ -1,31 +0,0 @@
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
deleted file mode 100644
index 3cd1ec677b3f..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2410.h
+++ /dev/null
@@ -1,31 +0,0 @@
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
24#else
25#define s3c2410_init_clocks NULL
26#define s3c2410_init_uarts NULL
27#define s3c2410_map_io NULL
28#define s3c2410_init NULL
29#endif
30
31extern int s3c2410_baseclk_add(void);
diff --git a/include/asm-arm/plat-s3c24xx/s3c2412.h b/include/asm-arm/plat-s3c24xx/s3c2412.h
deleted file mode 100644
index 3ec97685e781..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2412.h
+++ /dev/null
@@ -1,29 +0,0 @@
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
deleted file mode 100644
index 107853bf9481..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2440.h
+++ /dev/null
@@ -1,17 +0,0 @@
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
deleted file mode 100644
index 451a23a2092a..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2442.h
+++ /dev/null
@@ -1,17 +0,0 @@
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
deleted file mode 100644
index 11d83b5c84e6..000000000000
--- a/include/asm-arm/plat-s3c24xx/s3c2443.h
+++ /dev/null
@@ -1,32 +0,0 @@
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-cris/a.out.h b/include/asm-cris/a.out.h
deleted file mode 100644
index c82e9f9b75f6..000000000000
--- a/include/asm-cris/a.out.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef __CRIS_A_OUT_H__
2#define __CRIS_A_OUT_H__
3
4/* we don't support a.out binaries on Linux/CRIS anyway, so this is
5 * not really used but still needed because binfmt_elf.c for some reason
6 * wants to know about a.out even if there is no interpreter available...
7 */
8
9struct exec
10{
11 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
12 unsigned a_text; /* length of text, in bytes */
13 unsigned a_data; /* length of data, in bytes */
14 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
15 unsigned a_syms; /* length of symbol table data in file, in bytes */
16 unsigned a_entry; /* start address */
17 unsigned a_trsize; /* length of relocation info for text, in bytes */
18 unsigned a_drsize; /* length of relocation info for data, in bytes */
19};
20
21
22#define N_TRSIZE(a) ((a).a_trsize)
23#define N_DRSIZE(a) ((a).a_drsize)
24#define N_SYMSIZE(a) ((a).a_syms)
25
26#endif
diff --git a/include/asm-cris/elf.h b/include/asm-cris/elf.h
index 001f64ad11e8..f0d17fbc81ba 100644
--- a/include/asm-cris/elf.h
+++ b/include/asm-cris/elf.h
@@ -88,6 +88,6 @@ typedef unsigned long elf_fpregset_t;
88 88
89#define ELF_PLATFORM (NULL) 89#define ELF_PLATFORM (NULL)
90 90
91#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 91#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
92 92
93#endif 93#endif
diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h
index 7efe1000f99d..cee97f14af3b 100644
--- a/include/asm-cris/thread_info.h
+++ b/include/asm-cris/thread_info.h
@@ -88,6 +88,7 @@ struct thread_info {
88#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ 88#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
89#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 89#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
90#define TIF_MEMDIE 17 90#define TIF_MEMDIE 17
91#define TIF_FREEZE 18 /* is freezing for suspend */
91 92
92#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 93#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
93#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 94#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -95,6 +96,7 @@ struct thread_info {
95#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 96#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
96#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 97#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
97#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 98#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
99#define _TIF_FREEZE (1<<TIF_FREEZE)
98 100
99#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 101#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
100#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 102#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
diff --git a/include/asm-frv/elf.h b/include/asm-frv/elf.h
index 9fb946bb7dc9..7279ec07d62e 100644
--- a/include/asm-frv/elf.h
+++ b/include/asm-frv/elf.h
@@ -137,6 +137,6 @@ do { \
137 137
138#define ELF_PLATFORM (NULL) 138#define ELF_PLATFORM (NULL)
139 139
140#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 140#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
141 141
142#endif 142#endif
diff --git a/include/asm-frv/ide.h b/include/asm-frv/ide.h
index 7ebcc56a2229..361076611855 100644
--- a/include/asm-frv/ide.h
+++ b/include/asm-frv/ide.h
@@ -18,15 +18,7 @@
18#include <asm/io.h> 18#include <asm/io.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20 20
21/****************************************************************************/ 21#include <asm-generic/ide_iops.h>
22/*
23 * some bits needed for parts of the IDE subsystem to compile
24 */
25#define __ide_mm_insw(port, addr, n) insw((unsigned long) (port), addr, n)
26#define __ide_mm_insl(port, addr, n) insl((unsigned long) (port), addr, n)
27#define __ide_mm_outsw(port, addr, n) outsw((unsigned long) (port), addr, n)
28#define __ide_mm_outsl(port, addr, n) outsl((unsigned long) (port), addr, n)
29
30 22
31#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
32#endif /* _ASM_IDE_H */ 24#endif /* _ASM_IDE_H */
diff --git a/include/asm-frv/unaligned.h b/include/asm-frv/unaligned.h
index 839a2fbffa0f..6c61c05b2e0c 100644
--- a/include/asm-frv/unaligned.h
+++ b/include/asm-frv/unaligned.h
@@ -13,7 +13,7 @@
13#define _ASM_UNALIGNED_H 13#define _ASM_UNALIGNED_H
14 14
15#include <linux/unaligned/le_byteshift.h> 15#include <linux/unaligned/le_byteshift.h>
16#include <linux/unaligned/be_byteshift.h> 16#include <linux/unaligned/be_struct.h>
17#include <linux/unaligned/generic.h> 17#include <linux/unaligned/generic.h>
18 18
19#define get_unaligned __get_unaligned_be 19#define get_unaligned __get_unaligned_be
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index edc6ba82e090..12c07c1866b2 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -22,7 +22,7 @@ struct bug_entry {
22 22
23#ifndef HAVE_ARCH_BUG 23#ifndef HAVE_ARCH_BUG
24#define BUG() do { \ 24#define BUG() do { \
25 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ 25 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
26 panic("BUG!"); \ 26 panic("BUG!"); \
27} while (0) 27} while (0)
28#endif 28#endif
@@ -41,7 +41,7 @@ extern void warn_slowpath(const char *file, const int line,
41#define __WARN() warn_on_slowpath(__FILE__, __LINE__) 41#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
42#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg) 42#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg)
43#else 43#else
44#define __WARN_printf(arg...) __WARN() 44#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0)
45#endif 45#endif
46 46
47#ifndef WARN_ON 47#ifndef WARN_ON
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 0f99ad38b012..81797ec9ab29 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -35,11 +35,17 @@ struct module;
35 * @label: for diagnostics 35 * @label: for diagnostics
36 * @dev: optional device providing the GPIOs 36 * @dev: optional device providing the GPIOs
37 * @owner: helps prevent removal of modules exporting active GPIOs 37 * @owner: helps prevent removal of modules exporting active GPIOs
38 * @request: optional hook for chip-specific activation, such as
39 * enabling module power and clock; may sleep
40 * @free: optional hook for chip-specific deactivation, such as
41 * disabling module power and clock; may sleep
38 * @direction_input: configures signal "offset" as input, or returns error 42 * @direction_input: configures signal "offset" as input, or returns error
39 * @get: returns value for signal "offset"; for output signals this 43 * @get: returns value for signal "offset"; for output signals this
40 * returns either the value actually sensed, or zero 44 * returns either the value actually sensed, or zero
41 * @direction_output: configures signal "offset" as output, or returns error 45 * @direction_output: configures signal "offset" as output, or returns error
42 * @set: assigns output value for signal "offset" 46 * @set: assigns output value for signal "offset"
47 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
48 * implementation may not sleep
43 * @dbg_show: optional routine to show contents in debugfs; default code 49 * @dbg_show: optional routine to show contents in debugfs; default code
44 * will be used when this is omitted, but custom code can show extra 50 * will be used when this is omitted, but custom code can show extra
45 * state (such as pullup/pulldown configuration). 51 * state (such as pullup/pulldown configuration).
@@ -61,10 +67,15 @@ struct module;
61 * is calculated by subtracting @base from the gpio number. 67 * is calculated by subtracting @base from the gpio number.
62 */ 68 */
63struct gpio_chip { 69struct gpio_chip {
64 char *label; 70 const char *label;
65 struct device *dev; 71 struct device *dev;
66 struct module *owner; 72 struct module *owner;
67 73
74 int (*request)(struct gpio_chip *chip,
75 unsigned offset);
76 void (*free)(struct gpio_chip *chip,
77 unsigned offset);
78
68 int (*direction_input)(struct gpio_chip *chip, 79 int (*direction_input)(struct gpio_chip *chip,
69 unsigned offset); 80 unsigned offset);
70 int (*get)(struct gpio_chip *chip, 81 int (*get)(struct gpio_chip *chip,
@@ -73,6 +84,10 @@ struct gpio_chip {
73 unsigned offset, int value); 84 unsigned offset, int value);
74 void (*set)(struct gpio_chip *chip, 85 void (*set)(struct gpio_chip *chip,
75 unsigned offset, int value); 86 unsigned offset, int value);
87
88 int (*to_irq)(struct gpio_chip *chip,
89 unsigned offset);
90
76 void (*dbg_show)(struct seq_file *s, 91 void (*dbg_show)(struct seq_file *s,
77 struct gpio_chip *chip); 92 struct gpio_chip *chip);
78 int base; 93 int base;
@@ -112,6 +127,7 @@ extern void __gpio_set_value(unsigned gpio, int value);
112 127
113extern int __gpio_cansleep(unsigned gpio); 128extern int __gpio_cansleep(unsigned gpio);
114 129
130extern int __gpio_to_irq(unsigned gpio);
115 131
116#ifdef CONFIG_GPIO_SYSFS 132#ifdef CONFIG_GPIO_SYSFS
117 133
diff --git a/include/asm-generic/mutex-dec.h b/include/asm-generic/mutex-dec.h
index ed108be6743f..f104af7cf437 100644
--- a/include/asm-generic/mutex-dec.h
+++ b/include/asm-generic/mutex-dec.h
@@ -22,8 +22,6 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
22{ 22{
23 if (unlikely(atomic_dec_return(count) < 0)) 23 if (unlikely(atomic_dec_return(count) < 0))
24 fail_fn(count); 24 fail_fn(count);
25 else
26 smp_mb();
27} 25}
28 26
29/** 27/**
@@ -41,10 +39,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
41{ 39{
42 if (unlikely(atomic_dec_return(count) < 0)) 40 if (unlikely(atomic_dec_return(count) < 0))
43 return fail_fn(count); 41 return fail_fn(count);
44 else { 42 return 0;
45 smp_mb();
46 return 0;
47 }
48} 43}
49 44
50/** 45/**
@@ -63,7 +58,6 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
63static inline void 58static inline void
64__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) 59__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
65{ 60{
66 smp_mb();
67 if (unlikely(atomic_inc_return(count) <= 0)) 61 if (unlikely(atomic_inc_return(count) <= 0))
68 fail_fn(count); 62 fail_fn(count);
69} 63}
@@ -88,25 +82,9 @@ __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
88static inline int 82static inline int
89__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *)) 83__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
90{ 84{
91 /* 85 if (likely(atomic_cmpxchg(count, 1, 0) == 1))
92 * We have two variants here. The cmpxchg based one is the best one
93 * because it never induce a false contention state. It is included
94 * here because architectures using the inc/dec algorithms over the
95 * xchg ones are much more likely to support cmpxchg natively.
96 *
97 * If not we fall back to the spinlock based variant - that is
98 * just as efficient (and simpler) as a 'destructive' probing of
99 * the mutex state would be.
100 */
101#ifdef __HAVE_ARCH_CMPXCHG
102 if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
103 smp_mb();
104 return 1; 86 return 1;
105 }
106 return 0; 87 return 0;
107#else
108 return fail_fn(count);
109#endif
110} 88}
111 89
112#endif 90#endif
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index 7b9cd2cbfebe..580a6d35c700 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -27,8 +27,6 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
27{ 27{
28 if (unlikely(atomic_xchg(count, 0) != 1)) 28 if (unlikely(atomic_xchg(count, 0) != 1))
29 fail_fn(count); 29 fail_fn(count);
30 else
31 smp_mb();
32} 30}
33 31
34/** 32/**
@@ -46,10 +44,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
46{ 44{
47 if (unlikely(atomic_xchg(count, 0) != 1)) 45 if (unlikely(atomic_xchg(count, 0) != 1))
48 return fail_fn(count); 46 return fail_fn(count);
49 else { 47 return 0;
50 smp_mb();
51 return 0;
52 }
53} 48}
54 49
55/** 50/**
@@ -67,7 +62,6 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
67static inline void 62static inline void
68__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *)) 63__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
69{ 64{
70 smp_mb();
71 if (unlikely(atomic_xchg(count, 1) != 0)) 65 if (unlikely(atomic_xchg(count, 1) != 0))
72 fail_fn(count); 66 fail_fn(count);
73} 67}
@@ -110,7 +104,6 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
110 if (prev < 0) 104 if (prev < 0)
111 prev = 0; 105 prev = 0;
112 } 106 }
113 smp_mb();
114 107
115 return prev; 108 return prev;
116} 109}
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 71ef3f0b9685..89061c1a67d4 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -84,12 +84,12 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
84 84
85 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 85 if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
86 { 86 {
87 BCD_TO_BIN(time->tm_sec); 87 time->tm_sec = bcd2bin(time->tm_sec);
88 BCD_TO_BIN(time->tm_min); 88 time->tm_min = bcd2bin(time->tm_min);
89 BCD_TO_BIN(time->tm_hour); 89 time->tm_hour = bcd2bin(time->tm_hour);
90 BCD_TO_BIN(time->tm_mday); 90 time->tm_mday = bcd2bin(time->tm_mday);
91 BCD_TO_BIN(time->tm_mon); 91 time->tm_mon = bcd2bin(time->tm_mon);
92 BCD_TO_BIN(time->tm_year); 92 time->tm_year = bcd2bin(time->tm_year);
93 } 93 }
94 94
95#ifdef CONFIG_MACH_DECSTATION 95#ifdef CONFIG_MACH_DECSTATION
@@ -159,12 +159,12 @@ static inline int set_rtc_time(struct rtc_time *time)
159 159
160 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) 160 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
161 || RTC_ALWAYS_BCD) { 161 || RTC_ALWAYS_BCD) {
162 BIN_TO_BCD(sec); 162 sec = bin2bcd(sec);
163 BIN_TO_BCD(min); 163 min = bin2bcd(min);
164 BIN_TO_BCD(hrs); 164 hrs = bin2bcd(hrs);
165 BIN_TO_BCD(day); 165 day = bin2bcd(day);
166 BIN_TO_BCD(mon); 166 mon = bin2bcd(mon);
167 BIN_TO_BCD(yrs); 167 yrs = bin2bcd(yrs);
168 } 168 }
169 169
170 save_control = CMOS_READ(RTC_CONTROL); 170 save_control = CMOS_READ(RTC_CONTROL);
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 8786e01e0db8..969570167e9e 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -199,6 +199,8 @@ typedef struct siginfo {
199 */ 199 */
200#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */ 200#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
201#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */ 201#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
202#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
203#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
202#define NSIGTRAP 2 204#define NSIGTRAP 2
203 205
204/* 206/*
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 1d01043e797d..6129d6802149 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -6,33 +6,64 @@
6typedef __kernel_fsid_t fsid_t; 6typedef __kernel_fsid_t fsid_t;
7#endif 7#endif
8 8
9/*
10 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
11 * Yes, they differ in signedness as well as size.
12 * Special cases can override it for themselves -- except for S390x, which
13 * is just a little too special for us. And MIPS, which I'm not touching
14 * with a 10' pole.
15 */
16#ifndef __statfs_word
17#if BITS_PER_LONG == 64
18#define __statfs_word long
19#else
20#define __statfs_word __u32
21#endif
22#endif
23
9struct statfs { 24struct statfs {
10 __u32 f_type; 25 __statfs_word f_type;
11 __u32 f_bsize; 26 __statfs_word f_bsize;
12 __u32 f_blocks; 27 __statfs_word f_blocks;
13 __u32 f_bfree; 28 __statfs_word f_bfree;
14 __u32 f_bavail; 29 __statfs_word f_bavail;
15 __u32 f_files; 30 __statfs_word f_files;
16 __u32 f_ffree; 31 __statfs_word f_ffree;
17 __kernel_fsid_t f_fsid; 32 __kernel_fsid_t f_fsid;
18 __u32 f_namelen; 33 __statfs_word f_namelen;
19 __u32 f_frsize; 34 __statfs_word f_frsize;
20 __u32 f_spare[5]; 35 __statfs_word f_spare[5];
21}; 36};
22 37
38/*
39 * ARM needs to avoid the 32-bit padding at the end, for consistency
40 * between EABI and OABI
41 */
42#ifndef ARCH_PACK_STATFS64
43#define ARCH_PACK_STATFS64
44#endif
45
23struct statfs64 { 46struct statfs64 {
24 __u32 f_type; 47 __statfs_word f_type;
25 __u32 f_bsize; 48 __statfs_word f_bsize;
26 __u64 f_blocks; 49 __u64 f_blocks;
27 __u64 f_bfree; 50 __u64 f_bfree;
28 __u64 f_bavail; 51 __u64 f_bavail;
29 __u64 f_files; 52 __u64 f_files;
30 __u64 f_ffree; 53 __u64 f_ffree;
31 __kernel_fsid_t f_fsid; 54 __kernel_fsid_t f_fsid;
32 __u32 f_namelen; 55 __statfs_word f_namelen;
33 __u32 f_frsize; 56 __statfs_word f_frsize;
34 __u32 f_spare[5]; 57 __statfs_word f_spare[5];
35}; 58} ARCH_PACK_STATFS64;
59
60/*
61 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
62 * to be compatible with the i386 ABI
63 */
64#ifndef ARCH_PACK_COMPAT_STATFS64
65#define ARCH_PACK_COMPAT_STATFS64
66#endif
36 67
37struct compat_statfs64 { 68struct compat_statfs64 {
38 __u32 f_type; 69 __u32 f_type;
@@ -46,6 +77,6 @@ struct compat_statfs64 {
46 __u32 f_namelen; 77 __u32 f_namelen;
47 __u32 f_frsize; 78 __u32 f_frsize;
48 __u32 f_spare[5]; 79 __u32 f_spare[5];
49}; 80} ARCH_PACK_COMPAT_STATFS64;
50 81
51#endif 82#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index cb752ba72466..80744606bad1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -37,6 +37,13 @@
37#define MEM_DISCARD(sec) *(.mem##sec) 37#define MEM_DISCARD(sec) *(.mem##sec)
38#endif 38#endif
39 39
40#ifdef CONFIG_FTRACE_MCOUNT_RECORD
41#define MCOUNT_REC() VMLINUX_SYMBOL(__start_mcount_loc) = .; \
42 *(__mcount_loc) \
43 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
44#else
45#define MCOUNT_REC()
46#endif
40 47
41/* .data section */ 48/* .data section */
42#define DATA_DATA \ 49#define DATA_DATA \
@@ -52,7 +59,10 @@
52 . = ALIGN(8); \ 59 . = ALIGN(8); \
53 VMLINUX_SYMBOL(__start___markers) = .; \ 60 VMLINUX_SYMBOL(__start___markers) = .; \
54 *(__markers) \ 61 *(__markers) \
55 VMLINUX_SYMBOL(__stop___markers) = .; 62 VMLINUX_SYMBOL(__stop___markers) = .; \
63 VMLINUX_SYMBOL(__start___tracepoints) = .; \
64 *(__tracepoints) \
65 VMLINUX_SYMBOL(__stop___tracepoints) = .;
56 66
57#define RO_DATA(align) \ 67#define RO_DATA(align) \
58 . = ALIGN((align)); \ 68 . = ALIGN((align)); \
@@ -61,6 +71,7 @@
61 *(.rodata) *(.rodata.*) \ 71 *(.rodata) *(.rodata.*) \
62 *(__vermagic) /* Kernel version magic */ \ 72 *(__vermagic) /* Kernel version magic */ \
63 *(__markers_strings) /* Markers: strings */ \ 73 *(__markers_strings) /* Markers: strings */ \
74 *(__tracepoints_strings)/* Tracepoints: strings */ \
64 } \ 75 } \
65 \ 76 \
66 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \ 77 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
@@ -188,6 +199,7 @@
188 /* __*init sections */ \ 199 /* __*init sections */ \
189 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ 200 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
190 *(.ref.rodata) \ 201 *(.ref.rodata) \
202 MCOUNT_REC() \
191 DEV_KEEP(init.rodata) \ 203 DEV_KEEP(init.rodata) \
192 DEV_KEEP(exit.rodata) \ 204 DEV_KEEP(exit.rodata) \
193 CPU_KEEP(init.rodata) \ 205 CPU_KEEP(init.rodata) \
@@ -268,7 +280,15 @@
268 CPU_DISCARD(init.data) \ 280 CPU_DISCARD(init.data) \
269 CPU_DISCARD(init.rodata) \ 281 CPU_DISCARD(init.rodata) \
270 MEM_DISCARD(init.data) \ 282 MEM_DISCARD(init.data) \
271 MEM_DISCARD(init.rodata) 283 MEM_DISCARD(init.rodata) \
284 /* implement dynamic printk debug */ \
285 VMLINUX_SYMBOL(__start___verbose_strings) = .; \
286 *(__verbose_strings) \
287 VMLINUX_SYMBOL(__stop___verbose_strings) = .; \
288 . = ALIGN(8); \
289 VMLINUX_SYMBOL(__start___verbose) = .; \
290 *(__verbose) \
291 VMLINUX_SYMBOL(__stop___verbose) = .;
272 292
273#define INIT_TEXT \ 293#define INIT_TEXT \
274 *(.init.text) \ 294 *(.init.text) \
@@ -385,6 +405,7 @@
385 . = ALIGN(align); \ 405 . = ALIGN(align); \
386 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 406 VMLINUX_SYMBOL(__per_cpu_start) = .; \
387 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ 407 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
408 *(.data.percpu.page_aligned) \
388 *(.data.percpu) \ 409 *(.data.percpu) \
389 *(.data.percpu.shared_aligned) \ 410 *(.data.percpu.shared_aligned) \
390 } \ 411 } \
diff --git a/include/asm-h8300/timer.h b/include/asm-h8300/timer.h
new file mode 100644
index 000000000000..def80464d38f
--- /dev/null
+++ b/include/asm-h8300/timer.h
@@ -0,0 +1,25 @@
1#ifndef __H8300_TIMER_H
2#define __H8300_TIMER_H
3
4void h8300_timer_tick(void);
5void h8300_timer_setup(void);
6void h8300_gettod(unsigned int *year, unsigned int *mon, unsigned int *day,
7 unsigned int *hour, unsigned int *min, unsigned int *sec);
8
9#define TIMER_FREQ (CONFIG_CPU_CLOCK*10000) /* Timer input freq. */
10
11#define calc_param(cnt, div, rate, limit) \
12do { \
13 cnt = TIMER_FREQ / HZ; \
14 for (div = 0; div < ARRAY_SIZE(divide_rate); div++) { \
15 if (rate[div] == 0) \
16 continue; \
17 if ((cnt / rate[div]) > limit) \
18 break; \
19 } \
20 if (div == ARRAY_SIZE(divide_rate)) \
21 panic("Timer counter overflow"); \
22 cnt /= divide_rate[div]; \
23} while(0)
24
25#endif
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h
deleted file mode 100644
index ab150f5c1666..000000000000
--- a/include/asm-m32r/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_M32R_A_OUT_H
2#define _ASM_M32R_A_OUT_H
3
4struct exec
5{
6 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* _ASM_M32R_A_OUT_H */
diff --git a/include/asm-m32r/elf.h b/include/asm-m32r/elf.h
index 67bcd77494a5..0cc34c94bf2b 100644
--- a/include/asm-m32r/elf.h
+++ b/include/asm-m32r/elf.h
@@ -129,6 +129,6 @@ typedef elf_fpreg_t elf_fpregset_t;
129 intent than poking at uname or /proc/cpuinfo. */ 129 intent than poking at uname or /proc/cpuinfo. */
130#define ELF_PLATFORM (NULL) 130#define ELF_PLATFORM (NULL)
131 131
132#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 132#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
133 133
134#endif /* _ASM_M32R__ELF_H */ 134#endif /* _ASM_M32R__ELF_H */
diff --git a/include/asm-m68k/atarihw.h b/include/asm-m68k/atarihw.h
index ecf007df7743..1412b4ab202f 100644
--- a/include/asm-m68k/atarihw.h
+++ b/include/asm-m68k/atarihw.h
@@ -39,7 +39,6 @@ extern int atari_dont_touch_floppy_select;
39#define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT) 39#define MACH_IS_TT ((atari_mch_cookie >> 16) == ATARI_MCH_TT)
40#define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON) 40#define MACH_IS_FALCON ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON)
41#define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA) 41#define MACH_IS_MEDUSA (atari_mch_type == ATARI_MACH_MEDUSA)
42#define MACH_IS_HADES (atari_mch_type == ATARI_MACH_HADES)
43#define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40) 42#define MACH_IS_AB40 (atari_mch_type == ATARI_MACH_AB40)
44 43
45/* values for atari_switches */ 44/* values for atari_switches */
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index 91f7944333d4..26f505488c11 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -74,6 +74,14 @@ extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, 74extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
75 enum dma_data_direction); 75 enum dma_data_direction);
76 76
77static inline void dma_sync_single_range_for_device(struct device *dev,
78 dma_addr_t dma_handle, unsigned long offset, size_t size,
79 enum dma_data_direction direction)
80{
81 /* just sync everything for now */
82 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
83}
84
77static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, 85static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
78 size_t size, enum dma_data_direction dir) 86 size_t size, enum dma_data_direction dir)
79{ 87{
@@ -84,6 +92,14 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *s
84{ 92{
85} 93}
86 94
95static inline void dma_sync_single_range_for_cpu(struct device *dev,
96 dma_addr_t dma_handle, unsigned long offset, size_t size,
97 enum dma_data_direction direction)
98{
99 /* just sync everything for now */
100 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
101}
102
87static inline int dma_mapping_error(struct device *dev, dma_addr_t handle) 103static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
88{ 104{
89 return 0; 105 return 0;
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h
index d0c9e61e57b4..4240fbc946f8 100644
--- a/include/asm-m68k/dma.h
+++ b/include/asm-m68k/dma.h
@@ -11,10 +11,6 @@
11extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */ 11extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
12extern void free_dma(unsigned int dmanr); /* release it again */ 12extern void free_dma(unsigned int dmanr); /* release it again */
13 13
14#ifdef CONFIG_PCI
15extern int isa_dma_bridge_buggy;
16#else
17#define isa_dma_bridge_buggy (0) 14#define isa_dma_bridge_buggy (0)
18#endif
19 15
20#endif /* _M68K_DMA_H */ 16#endif /* _M68K_DMA_H */
diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h
index 14ea42152b97..0b0f49eb876b 100644
--- a/include/asm-m68k/elf.h
+++ b/include/asm-m68k/elf.h
@@ -114,6 +114,6 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
114 114
115#define ELF_PLATFORM (NULL) 115#define ELF_PLATFORM (NULL)
116 116
117#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) 117#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
118 118
119#endif 119#endif
diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h
index f8f6b185d793..5202f5a5b420 100644
--- a/include/asm-m68k/entry.h
+++ b/include/asm-m68k/entry.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33/* the following macro is used when enabling interrupts */ 33/* the following macro is used when enabling interrupts */
34#if defined(MACH_ATARI_ONLY) && !defined(CONFIG_HADES) 34#if defined(MACH_ATARI_ONLY)
35 /* block out HSYNC on the atari */ 35 /* block out HSYNC on the atari */
36#define ALLOWINT (~0x400) 36#define ALLOWINT (~0x400)
37#define MAX_NOINT_IPL 3 37#define MAX_NOINT_IPL 3
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
index 1daf6cbdd9f0..b996a3c8cff5 100644
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -92,15 +92,6 @@
92#define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n) 92#define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
93#endif 93#endif
94 94
95
96/* Q40 and Atari have byteswapped IDE busses and since many interesting
97 * values in the identification string are text, chars and words they
98 * happened to be almost correct without swapping.. However *_capacity
99 * is needed for drives over 8 GB. RZ */
100#if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
101#define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
102#endif
103
104#ifdef CONFIG_BLK_DEV_FALCON_IDE 95#ifdef CONFIG_BLK_DEV_FALCON_IDE
105#define IDE_ARCH_LOCK 96#define IDE_ARCH_LOCK
106 97
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 657187f0c7c2..9e673e3bd434 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -7,15 +7,12 @@
7 * - added skeleton for GG-II and Amiga PCMCIA 7 * - added skeleton for GG-II and Amiga PCMCIA
8 * 2/3/01 RZ: - moved a few more defs into raw_io.h 8 * 2/3/01 RZ: - moved a few more defs into raw_io.h
9 * 9 *
10 * inX/outX/readX/writeX should not be used by any driver unless it does 10 * inX/outX should not be used by any driver unless it does
11 * ISA or PCI access. Other drivers should use function defined in raw_io.h 11 * ISA access. Other drivers should use function defined in raw_io.h
12 * or define its own macros on top of these. 12 * or define its own macros on top of these.
13 * 13 *
14 * inX(),outX() are for PCI and ISA I/O 14 * inX(),outX() are for ISA I/O
15 * readX(),writeX() are for PCI memory
16 * isa_readX(),isa_writeX() are for ISA memory 15 * isa_readX(),isa_writeX() are for ISA memory
17 *
18 * moved mem{cpy,set}_*io inside CONFIG_PCI
19 */ 16 */
20 17
21#ifndef _IO_H 18#ifndef _IO_H
@@ -256,10 +253,7 @@ static inline void isa_delay(void)
256 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ 253 (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \
257 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) 254 raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))
258 255
259#endif /* CONFIG_ISA */
260
261 256
262#if defined(CONFIG_ISA) && !defined(CONFIG_PCI)
263#define inb isa_inb 257#define inb isa_inb
264#define inb_p isa_inb_p 258#define inb_p isa_inb_p
265#define outb isa_outb 259#define outb isa_outb
@@ -282,55 +276,9 @@ static inline void isa_delay(void)
282#define readw isa_readw 276#define readw isa_readw
283#define writeb isa_writeb 277#define writeb isa_writeb
284#define writew isa_writew 278#define writew isa_writew
285#endif /* CONFIG_ISA */
286
287#if defined(CONFIG_PCI)
288
289#define readl(addr) in_le32(addr)
290#define writel(val,addr) out_le32((addr),(val))
291
292/* those can be defined for both ISA and PCI - it won't work though */
293#define readb(addr) in_8(addr)
294#define readw(addr) in_le16(addr)
295#define writeb(val,addr) out_8((addr),(val))
296#define writew(val,addr) out_le16((addr),(val))
297 279
298#define readb_relaxed(addr) readb(addr) 280#else /* CONFIG_ISA */
299#define readw_relaxed(addr) readw(addr)
300#define readl_relaxed(addr) readl(addr)
301 281
302#ifndef CONFIG_ISA
303#define inb(port) in_8(port)
304#define outb(val,port) out_8((port),(val))
305#define inw(port) in_le16(port)
306#define outw(val,port) out_le16((port),(val))
307#define inl(port) in_le32(port)
308#define outl(val,port) out_le32((port),(val))
309
310#else
311/*
312 * kernel with both ISA and PCI compiled in, those have
313 * conflicting defs for in/out. Simply consider port < 1024
314 * ISA and everything else PCI. read,write not defined
315 * in this case
316 */
317#define inb(port) ((port)<1024 ? isa_inb(port) : in_8(port))
318#define inb_p(port) ((port)<1024 ? isa_inb_p(port) : in_8(port))
319#define inw(port) ((port)<1024 ? isa_inw(port) : in_le16(port))
320#define inw_p(port) ((port)<1024 ? isa_inw_p(port) : in_le16(port))
321#define inl(port) ((port)<1024 ? isa_inl(port) : in_le32(port))
322#define inl_p(port) ((port)<1024 ? isa_inl_p(port) : in_le32(port))
323
324#define outb(val,port) ((port)<1024 ? isa_outb((val),(port)) : out_8((port),(val)))
325#define outb_p(val,port) ((port)<1024 ? isa_outb_p((val),(port)) : out_8((port),(val)))
326#define outw(val,port) ((port)<1024 ? isa_outw((val),(port)) : out_le16((port),(val)))
327#define outw_p(val,port) ((port)<1024 ? isa_outw_p((val),(port)) : out_le16((port),(val)))
328#define outl(val,port) ((port)<1024 ? isa_outl((val),(port)) : out_le32((port),(val)))
329#define outl_p(val,port) ((port)<1024 ? isa_outl_p((val),(port)) : out_le32((port),(val)))
330#endif
331#endif /* CONFIG_PCI */
332
333#if !defined(CONFIG_ISA) && !defined(CONFIG_PCI)
334/* 282/*
335 * We need to define dummy functions for GENERIC_IOMAP support. 283 * We need to define dummy functions for GENERIC_IOMAP support.
336 */ 284 */
@@ -357,11 +305,11 @@ static inline void isa_delay(void)
357#define writeb(val,addr) out_8((addr),(val)) 305#define writeb(val,addr) out_8((addr),(val))
358#define readw(addr) in_le16(addr) 306#define readw(addr) in_le16(addr)
359#define writew(val,addr) out_le16((addr),(val)) 307#define writew(val,addr) out_le16((addr),(val))
360#endif 308
361#if !defined(CONFIG_PCI) 309#endif /* CONFIG_ISA */
310
362#define readl(addr) in_le32(addr) 311#define readl(addr) in_le32(addr)
363#define writel(val,addr) out_le32((addr),(val)) 312#define writel(val,addr) out_le32((addr),(val))
364#endif
365 313
366#define mmiowb() 314#define mmiowb()
367 315
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h
index 26d2b91209c5..5637dcef314e 100644
--- a/include/asm-m68k/machdep.h
+++ b/include/asm-m68k/machdep.h
@@ -14,7 +14,7 @@ extern void (*mach_sched_init) (irq_handler_t handler);
14/* machine dependent irq functions */ 14/* machine dependent irq functions */
15extern void (*mach_init_IRQ) (void); 15extern void (*mach_init_IRQ) (void);
16extern void (*mach_get_model) (char *model); 16extern void (*mach_get_model) (char *model);
17extern int (*mach_get_hardware_list) (char *buffer); 17extern void (*mach_get_hardware_list) (struct seq_file *m);
18/* machine dependent timer functions */ 18/* machine dependent timer functions */
19extern unsigned long (*mach_gettimeoffset)(void); 19extern unsigned long (*mach_gettimeoffset)(void);
20extern int (*mach_hwclk)(int, struct rtc_time*); 20extern int (*mach_hwclk)(int, struct rtc_time*);
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
index 678cb0b52314..4ad0aea48ab4 100644
--- a/include/asm-m68k/pci.h
+++ b/include/asm-m68k/pci.h
@@ -1,52 +1,7 @@
1#ifndef _ASM_M68K_PCI_H 1#ifndef _ASM_M68K_PCI_H
2#define _ASM_M68K_PCI_H 2#define _ASM_M68K_PCI_H
3 3
4/* 4#include <asm-generic/pci-dma-compat.h>
5 * asm-m68k/pci_m68k.h - m68k specific PCI declarations.
6 *
7 * Written by Wout Klaren.
8 */
9
10#include <asm/scatterlist.h>
11
12struct pci_ops;
13
14/*
15 * Structure with hardware dependent information and functions of the
16 * PCI bus.
17 */
18
19struct pci_bus_info
20{
21 /*
22 * Resources of the PCI bus.
23 */
24
25 struct resource mem_space;
26 struct resource io_space;
27
28 /*
29 * System dependent functions.
30 */
31
32 struct pci_ops *m68k_pci_ops;
33
34 void (*fixup)(int pci_modify);
35 void (*conf_device)(struct pci_dev *dev);
36};
37
38#define pcibios_assign_all_busses() 0
39#define pcibios_scan_all_fns(a, b) 0
40
41static inline void pcibios_set_master(struct pci_dev *dev)
42{
43 /* No special bus mastering setup handling */
44}
45
46static inline void pcibios_penalize_isa_irq(int irq, int active)
47{
48 /* We don't do dynamic PCI IRQ allocation */
49}
50 5
51/* The PCI address space does equal the physical memory 6/* The PCI address space does equal the physical memory
52 * address space. The networking and block device layers use 7 * address space. The networking and block device layers use
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h
index abc002798a2b..af0fda46e94b 100644
--- a/include/asm-m68k/thread_info.h
+++ b/include/asm-m68k/thread_info.h
@@ -52,5 +52,6 @@ struct thread_info {
52#define TIF_DELAYED_TRACE 14 /* single step a syscall */ 52#define TIF_DELAYED_TRACE 14 /* single step a syscall */
53#define TIF_SYSCALL_TRACE 15 /* syscall trace active */ 53#define TIF_SYSCALL_TRACE 15 /* syscall trace active */
54#define TIF_MEMDIE 16 54#define TIF_MEMDIE 16
55#define TIF_FREEZE 17 /* thread is freezing for suspend */
55 56
56#endif /* _ASM_M68K_THREAD_INFO_H */ 57#endif /* _ASM_M68K_THREAD_INFO_H */
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index dea32fbc7e51..22ab05c9c52b 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -40,15 +40,9 @@ static inline void *phys_to_virt(unsigned long address)
40 40
41/* 41/*
42 * IO bus memory addresses are 1:1 with the physical address, 42 * IO bus memory addresses are 1:1 with the physical address,
43 * except on the PCI bus of the Hades.
44 */ 43 */
45#ifdef CONFIG_HADES
46#define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0))
47#define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0)))
48#else
49#define virt_to_bus virt_to_phys 44#define virt_to_bus virt_to_phys
50#define bus_to_virt phys_to_virt 45#define bus_to_virt phys_to_virt
51#endif
52 46
53#endif 47#endif
54#endif 48#endif
diff --git a/include/asm-mips/Kbuild b/include/asm-mips/Kbuild
deleted file mode 100644
index 7897f05e3165..000000000000
--- a/include/asm-mips/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += cachectl.h sgidefs.h sysmips.h
diff --git a/include/asm-mips/a.out.h b/include/asm-mips/a.out.h
deleted file mode 100644
index cad8371422ab..000000000000
--- a/include/asm-mips/a.out.h
+++ /dev/null
@@ -1,35 +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) 1994 - 1999, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_A_OUT_H
9#define _ASM_A_OUT_H
10
11#ifdef __KERNEL__
12
13
14#endif
15
16struct exec
17{
18 unsigned long a_info; /* Use macros N_MAGIC, etc for access */
19 unsigned a_text; /* length of text, in bytes */
20 unsigned a_data; /* length of data, in bytes */
21 unsigned a_bss; /* length of uninitialized data area for
22 file, in bytes */
23 unsigned a_syms; /* length of symbol table data in file,
24 in bytes */
25 unsigned a_entry; /* start address */
26 unsigned a_trsize; /* length of relocation info for text, in
27 bytes */
28 unsigned a_drsize; /* length of relocation info for data, in bytes */
29};
30
31#define N_TRSIZE(a) ((a).a_trsize)
32#define N_DRSIZE(a) ((a).a_drsize)
33#define N_SYMSIZE(a) ((a).a_syms)
34
35#endif /* _ASM_A_OUT_H */
diff --git a/include/asm-mips/abi.h b/include/asm-mips/abi.h
deleted file mode 100644
index 1dd74fbdc09b..000000000000
--- a/include/asm-mips/abi.h
+++ /dev/null
@@ -1,25 +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) 2005, 06 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2005 MIPS Technologies, Inc.
8 */
9#ifndef _ASM_ABI_H
10#define _ASM_ABI_H
11
12#include <asm/signal.h>
13#include <asm/siginfo.h>
14
15struct mips_abi {
16 int (* const setup_frame)(struct k_sigaction * ka,
17 struct pt_regs *regs, int signr,
18 sigset_t *set);
19 int (* const setup_rt_frame)(struct k_sigaction * ka,
20 struct pt_regs *regs, int signr,
21 sigset_t *set, siginfo_t *info);
22 const unsigned long restart;
23};
24
25#endif /* _ASM_ABI_H */
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
deleted file mode 100644
index 569f80aacbd2..000000000000
--- a/include/asm-mips/addrspace.h
+++ /dev/null
@@ -1,154 +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) 1996, 99 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
9 */
10#ifndef _ASM_ADDRSPACE_H
11#define _ASM_ADDRSPACE_H
12
13#include <spaces.h>
14
15/*
16 * Configure language
17 */
18#ifdef __ASSEMBLY__
19#define _ATYPE_
20#define _ATYPE32_
21#define _ATYPE64_
22#define _CONST64_(x) x
23#else
24#define _ATYPE_ __PTRDIFF_TYPE__
25#define _ATYPE32_ int
26#define _ATYPE64_ __s64
27#ifdef CONFIG_64BIT
28#define _CONST64_(x) x ## L
29#else
30#define _CONST64_(x) x ## LL
31#endif
32#endif
33
34/*
35 * 32-bit MIPS address spaces
36 */
37#ifdef __ASSEMBLY__
38#define _ACAST32_
39#define _ACAST64_
40#else
41#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
42#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
43#endif
44
45/*
46 * Returns the kernel segment base of a given address
47 */
48#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000)
49
50/*
51 * Returns the physical address of a CKSEGx / XKPHYS address
52 */
53#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
54#define XPHYSADDR(a) ((_ACAST64_(a)) & \
55 _CONST64_(0x000000ffffffffff))
56
57#ifdef CONFIG_64BIT
58
59/*
60 * Memory segments (64bit kernel mode addresses)
61 * The compatibility segments use the full 64-bit sign extended value. Note
62 * the R8000 doesn't have them so don't reference these in generic MIPS code.
63 */
64#define XKUSEG _CONST64_(0x0000000000000000)
65#define XKSSEG _CONST64_(0x4000000000000000)
66#define XKPHYS _CONST64_(0x8000000000000000)
67#define XKSEG _CONST64_(0xc000000000000000)
68#define CKSEG0 _CONST64_(0xffffffff80000000)
69#define CKSEG1 _CONST64_(0xffffffffa0000000)
70#define CKSSEG _CONST64_(0xffffffffc0000000)
71#define CKSEG3 _CONST64_(0xffffffffe0000000)
72
73#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
74#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
75#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2)
76#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
77
78#else
79
80#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
81#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
82#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
83#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
84
85/*
86 * Map an address to a certain kernel segment
87 */
88#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
89#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
90#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
91#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
92
93/*
94 * Memory segments (32bit kernel mode addresses)
95 * These are the traditional names used in the 32-bit universe.
96 */
97#define KUSEG 0x00000000
98#define KSEG0 0x80000000
99#define KSEG1 0xa0000000
100#define KSEG2 0xc0000000
101#define KSEG3 0xe0000000
102
103#define CKUSEG 0x00000000
104#define CKSEG0 0x80000000
105#define CKSEG1 0xa0000000
106#define CKSEG2 0xc0000000
107#define CKSEG3 0xe0000000
108
109#endif
110
111/*
112 * Cache modes for XKPHYS address conversion macros
113 */
114#define K_CALG_COH_EXCL1_NOL2 0
115#define K_CALG_COH_SHRL1_NOL2 1
116#define K_CALG_UNCACHED 2
117#define K_CALG_NONCOHERENT 3
118#define K_CALG_COH_EXCL 4
119#define K_CALG_COH_SHAREABLE 5
120#define K_CALG_NOTUSED 6
121#define K_CALG_UNCACHED_ACCEL 7
122
123/*
124 * 64-bit address conversions
125 */
126#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
127#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
128#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
129#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \
130 (_CONST64_(cm) << 59) | (a))
131
132/*
133 * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
134 * the region, 3 bits for the CCA mode. This leaves 59 bits of which the
135 * R8000 implements most with its 48-bit physical address space.
136 */
137#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */
138
139#ifndef CONFIG_CPU_R8000
140
141/*
142 * The R8000 doesn't have the 32-bit compat spaces so we don't define them
143 * in order to catch bugs in the source code.
144 */
145
146#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
147#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
148
149#endif
150
151#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK)
152#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE)
153
154#endif /* _ASM_ADDRSPACE_H */
diff --git a/include/asm-mips/asm.h b/include/asm-mips/asm.h
deleted file mode 100644
index 608cfcfbb3ea..000000000000
--- a/include/asm-mips/asm.h
+++ /dev/null
@@ -1,409 +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) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle
7 * Copyright (C) 1999 by Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 * Copyright (C) 2002 Maciej W. Rozycki
10 *
11 * Some useful macros for MIPS assembler code
12 *
13 * Some of the routines below contain useless nops that will be optimized
14 * away by gas in -O mode. These nops are however required to fill delay
15 * slots in noreorder mode.
16 */
17#ifndef __ASM_ASM_H
18#define __ASM_ASM_H
19
20#include <asm/sgidefs.h>
21
22#ifndef CAT
23#ifdef __STDC__
24#define __CAT(str1, str2) str1##str2
25#else
26#define __CAT(str1, str2) str1/**/str2
27#endif
28#define CAT(str1, str2) __CAT(str1, str2)
29#endif
30
31/*
32 * PIC specific declarations
33 * Not used for the kernel but here seems to be the right place.
34 */
35#ifdef __PIC__
36#define CPRESTORE(register) \
37 .cprestore register
38#define CPADD(register) \
39 .cpadd register
40#define CPLOAD(register) \
41 .cpload register
42#else
43#define CPRESTORE(register)
44#define CPADD(register)
45#define CPLOAD(register)
46#endif
47
48/*
49 * LEAF - declare leaf routine
50 */
51#define LEAF(symbol) \
52 .globl symbol; \
53 .align 2; \
54 .type symbol, @function; \
55 .ent symbol, 0; \
56symbol: .frame sp, 0, ra
57
58/*
59 * NESTED - declare nested routine entry point
60 */
61#define NESTED(symbol, framesize, rpc) \
62 .globl symbol; \
63 .align 2; \
64 .type symbol, @function; \
65 .ent symbol, 0; \
66symbol: .frame sp, framesize, rpc
67
68/*
69 * END - mark end of function
70 */
71#define END(function) \
72 .end function; \
73 .size function, .-function
74
75/*
76 * EXPORT - export definition of symbol
77 */
78#define EXPORT(symbol) \
79 .globl symbol; \
80symbol:
81
82/*
83 * FEXPORT - export definition of a function symbol
84 */
85#define FEXPORT(symbol) \
86 .globl symbol; \
87 .type symbol, @function; \
88symbol:
89
90/*
91 * ABS - export absolute symbol
92 */
93#define ABS(symbol,value) \
94 .globl symbol; \
95symbol = value
96
97#define PANIC(msg) \
98 .set push; \
99 .set reorder; \
100 PTR_LA a0, 8f; \
101 jal panic; \
1029: b 9b; \
103 .set pop; \
104 TEXT(msg)
105
106/*
107 * Print formatted string
108 */
109#ifdef CONFIG_PRINTK
110#define PRINT(string) \
111 .set push; \
112 .set reorder; \
113 PTR_LA a0, 8f; \
114 jal printk; \
115 .set pop; \
116 TEXT(string)
117#else
118#define PRINT(string)
119#endif
120
121#define TEXT(msg) \
122 .pushsection .data; \
1238: .asciiz msg; \
124 .popsection;
125
126/*
127 * Build text tables
128 */
129#define TTABLE(string) \
130 .pushsection .text; \
131 .word 1f; \
132 .popsection \
133 .pushsection .data; \
1341: .asciiz string; \
135 .popsection
136
137/*
138 * MIPS IV pref instruction.
139 * Use with .set noreorder only!
140 *
141 * MIPS IV implementations are free to treat this as a nop. The R5000
142 * is one of them. So we should have an option not to use this instruction.
143 */
144#ifdef CONFIG_CPU_HAS_PREFETCH
145
146#define PREF(hint,addr) \
147 .set push; \
148 .set mips4; \
149 pref hint, addr; \
150 .set pop
151
152#define PREFX(hint,addr) \
153 .set push; \
154 .set mips4; \
155 prefx hint, addr; \
156 .set pop
157
158#else /* !CONFIG_CPU_HAS_PREFETCH */
159
160#define PREF(hint, addr)
161#define PREFX(hint, addr)
162
163#endif /* !CONFIG_CPU_HAS_PREFETCH */
164
165/*
166 * MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
167 */
168#if (_MIPS_ISA == _MIPS_ISA_MIPS1)
169#define MOVN(rd, rs, rt) \
170 .set push; \
171 .set reorder; \
172 beqz rt, 9f; \
173 move rd, rs; \
174 .set pop; \
1759:
176#define MOVZ(rd, rs, rt) \
177 .set push; \
178 .set reorder; \
179 bnez rt, 9f; \
180 move rd, rs; \
181 .set pop; \
1829:
183#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
184#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
185#define MOVN(rd, rs, rt) \
186 .set push; \
187 .set noreorder; \
188 bnezl rt, 9f; \
189 move rd, rs; \
190 .set pop; \
1919:
192#define MOVZ(rd, rs, rt) \
193 .set push; \
194 .set noreorder; \
195 beqzl rt, 9f; \
196 move rd, rs; \
197 .set pop; \
1989:
199#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
200#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
201 (_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
202#define MOVN(rd, rs, rt) \
203 movn rd, rs, rt
204#define MOVZ(rd, rs, rt) \
205 movz rd, rs, rt
206#endif /* MIPS IV, MIPS V, MIPS32 or MIPS64 */
207
208/*
209 * Stack alignment
210 */
211#if (_MIPS_SIM == _MIPS_SIM_ABI32)
212#define ALSZ 7
213#define ALMASK ~7
214#endif
215#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
216#define ALSZ 15
217#define ALMASK ~15
218#endif
219
220/*
221 * Macros to handle different pointer/register sizes for 32/64-bit code
222 */
223
224/*
225 * Size of a register
226 */
227#ifdef __mips64
228#define SZREG 8
229#else
230#define SZREG 4
231#endif
232
233/*
234 * Use the following macros in assemblercode to load/store registers,
235 * pointers etc.
236 */
237#if (_MIPS_SIM == _MIPS_SIM_ABI32)
238#define REG_S sw
239#define REG_L lw
240#define REG_SUBU subu
241#define REG_ADDU addu
242#endif
243#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
244#define REG_S sd
245#define REG_L ld
246#define REG_SUBU dsubu
247#define REG_ADDU daddu
248#endif
249
250/*
251 * How to add/sub/load/store/shift C int variables.
252 */
253#if (_MIPS_SZINT == 32)
254#define INT_ADD add
255#define INT_ADDU addu
256#define INT_ADDI addi
257#define INT_ADDIU addiu
258#define INT_SUB sub
259#define INT_SUBU subu
260#define INT_L lw
261#define INT_S sw
262#define INT_SLL sll
263#define INT_SLLV sllv
264#define INT_SRL srl
265#define INT_SRLV srlv
266#define INT_SRA sra
267#define INT_SRAV srav
268#endif
269
270#if (_MIPS_SZINT == 64)
271#define INT_ADD dadd
272#define INT_ADDU daddu
273#define INT_ADDI daddi
274#define INT_ADDIU daddiu
275#define INT_SUB dsub
276#define INT_SUBU dsubu
277#define INT_L ld
278#define INT_S sd
279#define INT_SLL dsll
280#define INT_SLLV dsllv
281#define INT_SRL dsrl
282#define INT_SRLV dsrlv
283#define INT_SRA dsra
284#define INT_SRAV dsrav
285#endif
286
287/*
288 * How to add/sub/load/store/shift C long variables.
289 */
290#if (_MIPS_SZLONG == 32)
291#define LONG_ADD add
292#define LONG_ADDU addu
293#define LONG_ADDI addi
294#define LONG_ADDIU addiu
295#define LONG_SUB sub
296#define LONG_SUBU subu
297#define LONG_L lw
298#define LONG_S sw
299#define LONG_SLL sll
300#define LONG_SLLV sllv
301#define LONG_SRL srl
302#define LONG_SRLV srlv
303#define LONG_SRA sra
304#define LONG_SRAV srav
305
306#define LONG .word
307#define LONGSIZE 4
308#define LONGMASK 3
309#define LONGLOG 2
310#endif
311
312#if (_MIPS_SZLONG == 64)
313#define LONG_ADD dadd
314#define LONG_ADDU daddu
315#define LONG_ADDI daddi
316#define LONG_ADDIU daddiu
317#define LONG_SUB dsub
318#define LONG_SUBU dsubu
319#define LONG_L ld
320#define LONG_S sd
321#define LONG_SLL dsll
322#define LONG_SLLV dsllv
323#define LONG_SRL dsrl
324#define LONG_SRLV dsrlv
325#define LONG_SRA dsra
326#define LONG_SRAV dsrav
327
328#define LONG .dword
329#define LONGSIZE 8
330#define LONGMASK 7
331#define LONGLOG 3
332#endif
333
334/*
335 * How to add/sub/load/store/shift pointers.
336 */
337#if (_MIPS_SZPTR == 32)
338#define PTR_ADD add
339#define PTR_ADDU addu
340#define PTR_ADDI addi
341#define PTR_ADDIU addiu
342#define PTR_SUB sub
343#define PTR_SUBU subu
344#define PTR_L lw
345#define PTR_S sw
346#define PTR_LA la
347#define PTR_LI li
348#define PTR_SLL sll
349#define PTR_SLLV sllv
350#define PTR_SRL srl
351#define PTR_SRLV srlv
352#define PTR_SRA sra
353#define PTR_SRAV srav
354
355#define PTR_SCALESHIFT 2
356
357#define PTR .word
358#define PTRSIZE 4
359#define PTRLOG 2
360#endif
361
362#if (_MIPS_SZPTR == 64)
363#define PTR_ADD dadd
364#define PTR_ADDU daddu
365#define PTR_ADDI daddi
366#define PTR_ADDIU daddiu
367#define PTR_SUB dsub
368#define PTR_SUBU dsubu
369#define PTR_L ld
370#define PTR_S sd
371#define PTR_LA dla
372#define PTR_LI dli
373#define PTR_SLL dsll
374#define PTR_SLLV dsllv
375#define PTR_SRL dsrl
376#define PTR_SRLV dsrlv
377#define PTR_SRA dsra
378#define PTR_SRAV dsrav
379
380#define PTR_SCALESHIFT 3
381
382#define PTR .dword
383#define PTRSIZE 8
384#define PTRLOG 3
385#endif
386
387/*
388 * Some cp0 registers were extended to 64bit for MIPS III.
389 */
390#if (_MIPS_SIM == _MIPS_SIM_ABI32)
391#define MFC0 mfc0
392#define MTC0 mtc0
393#endif
394#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
395#define MFC0 dmfc0
396#define MTC0 dmtc0
397#endif
398
399#define SSNOP sll zero, zero, 1
400
401#ifdef CONFIG_SGI_IP28
402/* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
403#include <asm/cacheops.h>
404#define R10KCBARRIER(addr) cache Cache_Barrier, addr;
405#else
406#define R10KCBARRIER(addr)
407#endif
408
409#endif /* __ASM_ASM_H */
diff --git a/include/asm-mips/asmmacro-32.h b/include/asm-mips/asmmacro-32.h
deleted file mode 100644
index 5de3963f511e..000000000000
--- a/include/asm-mips/asmmacro-32.h
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * asmmacro.h: Assembler macros to make things easier to read.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1998, 1999, 2003 Ralf Baechle
6 */
7#ifndef _ASM_ASMMACRO_32_H
8#define _ASM_ASMMACRO_32_H
9
10#include <asm/asm-offsets.h>
11#include <asm/regdef.h>
12#include <asm/fpregdef.h>
13#include <asm/mipsregs.h>
14
15 .macro fpu_save_double thread status tmp1=t0
16 cfc1 \tmp1, fcr31
17 sdc1 $f0, THREAD_FPR0(\thread)
18 sdc1 $f2, THREAD_FPR2(\thread)
19 sdc1 $f4, THREAD_FPR4(\thread)
20 sdc1 $f6, THREAD_FPR6(\thread)
21 sdc1 $f8, THREAD_FPR8(\thread)
22 sdc1 $f10, THREAD_FPR10(\thread)
23 sdc1 $f12, THREAD_FPR12(\thread)
24 sdc1 $f14, THREAD_FPR14(\thread)
25 sdc1 $f16, THREAD_FPR16(\thread)
26 sdc1 $f18, THREAD_FPR18(\thread)
27 sdc1 $f20, THREAD_FPR20(\thread)
28 sdc1 $f22, THREAD_FPR22(\thread)
29 sdc1 $f24, THREAD_FPR24(\thread)
30 sdc1 $f26, THREAD_FPR26(\thread)
31 sdc1 $f28, THREAD_FPR28(\thread)
32 sdc1 $f30, THREAD_FPR30(\thread)
33 sw \tmp1, THREAD_FCR31(\thread)
34 .endm
35
36 .macro fpu_save_single thread tmp=t0
37 cfc1 \tmp, fcr31
38 swc1 $f0, THREAD_FPR0(\thread)
39 swc1 $f1, THREAD_FPR1(\thread)
40 swc1 $f2, THREAD_FPR2(\thread)
41 swc1 $f3, THREAD_FPR3(\thread)
42 swc1 $f4, THREAD_FPR4(\thread)
43 swc1 $f5, THREAD_FPR5(\thread)
44 swc1 $f6, THREAD_FPR6(\thread)
45 swc1 $f7, THREAD_FPR7(\thread)
46 swc1 $f8, THREAD_FPR8(\thread)
47 swc1 $f9, THREAD_FPR9(\thread)
48 swc1 $f10, THREAD_FPR10(\thread)
49 swc1 $f11, THREAD_FPR11(\thread)
50 swc1 $f12, THREAD_FPR12(\thread)
51 swc1 $f13, THREAD_FPR13(\thread)
52 swc1 $f14, THREAD_FPR14(\thread)
53 swc1 $f15, THREAD_FPR15(\thread)
54 swc1 $f16, THREAD_FPR16(\thread)
55 swc1 $f17, THREAD_FPR17(\thread)
56 swc1 $f18, THREAD_FPR18(\thread)
57 swc1 $f19, THREAD_FPR19(\thread)
58 swc1 $f20, THREAD_FPR20(\thread)
59 swc1 $f21, THREAD_FPR21(\thread)
60 swc1 $f22, THREAD_FPR22(\thread)
61 swc1 $f23, THREAD_FPR23(\thread)
62 swc1 $f24, THREAD_FPR24(\thread)
63 swc1 $f25, THREAD_FPR25(\thread)
64 swc1 $f26, THREAD_FPR26(\thread)
65 swc1 $f27, THREAD_FPR27(\thread)
66 swc1 $f28, THREAD_FPR28(\thread)
67 swc1 $f29, THREAD_FPR29(\thread)
68 swc1 $f30, THREAD_FPR30(\thread)
69 swc1 $f31, THREAD_FPR31(\thread)
70 sw \tmp, THREAD_FCR31(\thread)
71 .endm
72
73 .macro fpu_restore_double thread status tmp=t0
74 lw \tmp, THREAD_FCR31(\thread)
75 ldc1 $f0, THREAD_FPR0(\thread)
76 ldc1 $f2, THREAD_FPR2(\thread)
77 ldc1 $f4, THREAD_FPR4(\thread)
78 ldc1 $f6, THREAD_FPR6(\thread)
79 ldc1 $f8, THREAD_FPR8(\thread)
80 ldc1 $f10, THREAD_FPR10(\thread)
81 ldc1 $f12, THREAD_FPR12(\thread)
82 ldc1 $f14, THREAD_FPR14(\thread)
83 ldc1 $f16, THREAD_FPR16(\thread)
84 ldc1 $f18, THREAD_FPR18(\thread)
85 ldc1 $f20, THREAD_FPR20(\thread)
86 ldc1 $f22, THREAD_FPR22(\thread)
87 ldc1 $f24, THREAD_FPR24(\thread)
88 ldc1 $f26, THREAD_FPR26(\thread)
89 ldc1 $f28, THREAD_FPR28(\thread)
90 ldc1 $f30, THREAD_FPR30(\thread)
91 ctc1 \tmp, fcr31
92 .endm
93
94 .macro fpu_restore_single thread tmp=t0
95 lw \tmp, THREAD_FCR31(\thread)
96 lwc1 $f0, THREAD_FPR0(\thread)
97 lwc1 $f1, THREAD_FPR1(\thread)
98 lwc1 $f2, THREAD_FPR2(\thread)
99 lwc1 $f3, THREAD_FPR3(\thread)
100 lwc1 $f4, THREAD_FPR4(\thread)
101 lwc1 $f5, THREAD_FPR5(\thread)
102 lwc1 $f6, THREAD_FPR6(\thread)
103 lwc1 $f7, THREAD_FPR7(\thread)
104 lwc1 $f8, THREAD_FPR8(\thread)
105 lwc1 $f9, THREAD_FPR9(\thread)
106 lwc1 $f10, THREAD_FPR10(\thread)
107 lwc1 $f11, THREAD_FPR11(\thread)
108 lwc1 $f12, THREAD_FPR12(\thread)
109 lwc1 $f13, THREAD_FPR13(\thread)
110 lwc1 $f14, THREAD_FPR14(\thread)
111 lwc1 $f15, THREAD_FPR15(\thread)
112 lwc1 $f16, THREAD_FPR16(\thread)
113 lwc1 $f17, THREAD_FPR17(\thread)
114 lwc1 $f18, THREAD_FPR18(\thread)
115 lwc1 $f19, THREAD_FPR19(\thread)
116 lwc1 $f20, THREAD_FPR20(\thread)
117 lwc1 $f21, THREAD_FPR21(\thread)
118 lwc1 $f22, THREAD_FPR22(\thread)
119 lwc1 $f23, THREAD_FPR23(\thread)
120 lwc1 $f24, THREAD_FPR24(\thread)
121 lwc1 $f25, THREAD_FPR25(\thread)
122 lwc1 $f26, THREAD_FPR26(\thread)
123 lwc1 $f27, THREAD_FPR27(\thread)
124 lwc1 $f28, THREAD_FPR28(\thread)
125 lwc1 $f29, THREAD_FPR29(\thread)
126 lwc1 $f30, THREAD_FPR30(\thread)
127 lwc1 $f31, THREAD_FPR31(\thread)
128 ctc1 \tmp, fcr31
129 .endm
130
131 .macro cpu_save_nonscratch thread
132 LONG_S s0, THREAD_REG16(\thread)
133 LONG_S s1, THREAD_REG17(\thread)
134 LONG_S s2, THREAD_REG18(\thread)
135 LONG_S s3, THREAD_REG19(\thread)
136 LONG_S s4, THREAD_REG20(\thread)
137 LONG_S s5, THREAD_REG21(\thread)
138 LONG_S s6, THREAD_REG22(\thread)
139 LONG_S s7, THREAD_REG23(\thread)
140 LONG_S sp, THREAD_REG29(\thread)
141 LONG_S fp, THREAD_REG30(\thread)
142 .endm
143
144 .macro cpu_restore_nonscratch thread
145 LONG_L s0, THREAD_REG16(\thread)
146 LONG_L s1, THREAD_REG17(\thread)
147 LONG_L s2, THREAD_REG18(\thread)
148 LONG_L s3, THREAD_REG19(\thread)
149 LONG_L s4, THREAD_REG20(\thread)
150 LONG_L s5, THREAD_REG21(\thread)
151 LONG_L s6, THREAD_REG22(\thread)
152 LONG_L s7, THREAD_REG23(\thread)
153 LONG_L sp, THREAD_REG29(\thread)
154 LONG_L fp, THREAD_REG30(\thread)
155 LONG_L ra, THREAD_REG31(\thread)
156 .endm
157
158#endif /* _ASM_ASMMACRO_32_H */
diff --git a/include/asm-mips/asmmacro-64.h b/include/asm-mips/asmmacro-64.h
deleted file mode 100644
index 225feefcb25d..000000000000
--- a/include/asm-mips/asmmacro-64.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * asmmacro.h: Assembler macros to make things easier to read.
3 *
4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 * Copyright (C) 1998, 1999 Ralf Baechle
6 * Copyright (C) 1999 Silicon Graphics, Inc.
7 */
8#ifndef _ASM_ASMMACRO_64_H
9#define _ASM_ASMMACRO_64_H
10
11#include <asm/asm-offsets.h>
12#include <asm/regdef.h>
13#include <asm/fpregdef.h>
14#include <asm/mipsregs.h>
15
16 .macro fpu_save_16even thread tmp=t0
17 cfc1 \tmp, fcr31
18 sdc1 $f0, THREAD_FPR0(\thread)
19 sdc1 $f2, THREAD_FPR2(\thread)
20 sdc1 $f4, THREAD_FPR4(\thread)
21 sdc1 $f6, THREAD_FPR6(\thread)
22 sdc1 $f8, THREAD_FPR8(\thread)
23 sdc1 $f10, THREAD_FPR10(\thread)
24 sdc1 $f12, THREAD_FPR12(\thread)
25 sdc1 $f14, THREAD_FPR14(\thread)
26 sdc1 $f16, THREAD_FPR16(\thread)
27 sdc1 $f18, THREAD_FPR18(\thread)
28 sdc1 $f20, THREAD_FPR20(\thread)
29 sdc1 $f22, THREAD_FPR22(\thread)
30 sdc1 $f24, THREAD_FPR24(\thread)
31 sdc1 $f26, THREAD_FPR26(\thread)
32 sdc1 $f28, THREAD_FPR28(\thread)
33 sdc1 $f30, THREAD_FPR30(\thread)
34 sw \tmp, THREAD_FCR31(\thread)
35 .endm
36
37 .macro fpu_save_16odd thread
38 sdc1 $f1, THREAD_FPR1(\thread)
39 sdc1 $f3, THREAD_FPR3(\thread)
40 sdc1 $f5, THREAD_FPR5(\thread)
41 sdc1 $f7, THREAD_FPR7(\thread)
42 sdc1 $f9, THREAD_FPR9(\thread)
43 sdc1 $f11, THREAD_FPR11(\thread)
44 sdc1 $f13, THREAD_FPR13(\thread)
45 sdc1 $f15, THREAD_FPR15(\thread)
46 sdc1 $f17, THREAD_FPR17(\thread)
47 sdc1 $f19, THREAD_FPR19(\thread)
48 sdc1 $f21, THREAD_FPR21(\thread)
49 sdc1 $f23, THREAD_FPR23(\thread)
50 sdc1 $f25, THREAD_FPR25(\thread)
51 sdc1 $f27, THREAD_FPR27(\thread)
52 sdc1 $f29, THREAD_FPR29(\thread)
53 sdc1 $f31, THREAD_FPR31(\thread)
54 .endm
55
56 .macro fpu_save_double thread status tmp
57 sll \tmp, \status, 5
58 bgez \tmp, 2f
59 fpu_save_16odd \thread
602:
61 fpu_save_16even \thread \tmp
62 .endm
63
64 .macro fpu_restore_16even thread tmp=t0
65 lw \tmp, THREAD_FCR31(\thread)
66 ldc1 $f0, THREAD_FPR0(\thread)
67 ldc1 $f2, THREAD_FPR2(\thread)
68 ldc1 $f4, THREAD_FPR4(\thread)
69 ldc1 $f6, THREAD_FPR6(\thread)
70 ldc1 $f8, THREAD_FPR8(\thread)
71 ldc1 $f10, THREAD_FPR10(\thread)
72 ldc1 $f12, THREAD_FPR12(\thread)
73 ldc1 $f14, THREAD_FPR14(\thread)
74 ldc1 $f16, THREAD_FPR16(\thread)
75 ldc1 $f18, THREAD_FPR18(\thread)
76 ldc1 $f20, THREAD_FPR20(\thread)
77 ldc1 $f22, THREAD_FPR22(\thread)
78 ldc1 $f24, THREAD_FPR24(\thread)
79 ldc1 $f26, THREAD_FPR26(\thread)
80 ldc1 $f28, THREAD_FPR28(\thread)
81 ldc1 $f30, THREAD_FPR30(\thread)
82 ctc1 \tmp, fcr31
83 .endm
84
85 .macro fpu_restore_16odd thread
86 ldc1 $f1, THREAD_FPR1(\thread)
87 ldc1 $f3, THREAD_FPR3(\thread)
88 ldc1 $f5, THREAD_FPR5(\thread)
89 ldc1 $f7, THREAD_FPR7(\thread)
90 ldc1 $f9, THREAD_FPR9(\thread)
91 ldc1 $f11, THREAD_FPR11(\thread)
92 ldc1 $f13, THREAD_FPR13(\thread)
93 ldc1 $f15, THREAD_FPR15(\thread)
94 ldc1 $f17, THREAD_FPR17(\thread)
95 ldc1 $f19, THREAD_FPR19(\thread)
96 ldc1 $f21, THREAD_FPR21(\thread)
97 ldc1 $f23, THREAD_FPR23(\thread)
98 ldc1 $f25, THREAD_FPR25(\thread)
99 ldc1 $f27, THREAD_FPR27(\thread)
100 ldc1 $f29, THREAD_FPR29(\thread)
101 ldc1 $f31, THREAD_FPR31(\thread)
102 .endm
103
104 .macro fpu_restore_double thread status tmp
105 sll \tmp, \status, 5
106 bgez \tmp, 1f # 16 register mode?
107
108 fpu_restore_16odd \thread
1091: fpu_restore_16even \thread \tmp
110 .endm
111
112 .macro cpu_save_nonscratch thread
113 LONG_S s0, THREAD_REG16(\thread)
114 LONG_S s1, THREAD_REG17(\thread)
115 LONG_S s2, THREAD_REG18(\thread)
116 LONG_S s3, THREAD_REG19(\thread)
117 LONG_S s4, THREAD_REG20(\thread)
118 LONG_S s5, THREAD_REG21(\thread)
119 LONG_S s6, THREAD_REG22(\thread)
120 LONG_S s7, THREAD_REG23(\thread)
121 LONG_S sp, THREAD_REG29(\thread)
122 LONG_S fp, THREAD_REG30(\thread)
123 .endm
124
125 .macro cpu_restore_nonscratch thread
126 LONG_L s0, THREAD_REG16(\thread)
127 LONG_L s1, THREAD_REG17(\thread)
128 LONG_L s2, THREAD_REG18(\thread)
129 LONG_L s3, THREAD_REG19(\thread)
130 LONG_L s4, THREAD_REG20(\thread)
131 LONG_L s5, THREAD_REG21(\thread)
132 LONG_L s6, THREAD_REG22(\thread)
133 LONG_L s7, THREAD_REG23(\thread)
134 LONG_L sp, THREAD_REG29(\thread)
135 LONG_L fp, THREAD_REG30(\thread)
136 LONG_L ra, THREAD_REG31(\thread)
137 .endm
138
139#endif /* _ASM_ASMMACRO_64_H */
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
deleted file mode 100644
index 7a881755800f..000000000000
--- a/include/asm-mips/asmmacro.h
+++ /dev/null
@@ -1,82 +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 Ralf Baechle
7 */
8#ifndef _ASM_ASMMACRO_H
9#define _ASM_ASMMACRO_H
10
11#include <asm/hazards.h>
12
13#ifdef CONFIG_32BIT
14#include <asm/asmmacro-32.h>
15#endif
16#ifdef CONFIG_64BIT
17#include <asm/asmmacro-64.h>
18#endif
19#ifdef CONFIG_MIPS_MT_SMTC
20#include <asm/mipsmtregs.h>
21#endif
22
23#ifdef CONFIG_MIPS_MT_SMTC
24 .macro local_irq_enable reg=t0
25 mfc0 \reg, CP0_TCSTATUS
26 ori \reg, \reg, TCSTATUS_IXMT
27 xori \reg, \reg, TCSTATUS_IXMT
28 mtc0 \reg, CP0_TCSTATUS
29 _ehb
30 .endm
31
32 .macro local_irq_disable reg=t0
33 mfc0 \reg, CP0_TCSTATUS
34 ori \reg, \reg, TCSTATUS_IXMT
35 mtc0 \reg, CP0_TCSTATUS
36 _ehb
37 .endm
38#else
39 .macro local_irq_enable reg=t0
40 mfc0 \reg, CP0_STATUS
41 ori \reg, \reg, 1
42 mtc0 \reg, CP0_STATUS
43 irq_enable_hazard
44 .endm
45
46 .macro local_irq_disable reg=t0
47 mfc0 \reg, CP0_STATUS
48 ori \reg, \reg, 1
49 xori \reg, \reg, 1
50 mtc0 \reg, CP0_STATUS
51 irq_disable_hazard
52 .endm
53#endif /* CONFIG_MIPS_MT_SMTC */
54
55/*
56 * Temporary until all gas have MT ASE support
57 */
58 .macro DMT reg=0
59 .word 0x41600bc1 | (\reg << 16)
60 .endm
61
62 .macro EMT reg=0
63 .word 0x41600be1 | (\reg << 16)
64 .endm
65
66 .macro DVPE reg=0
67 .word 0x41600001 | (\reg << 16)
68 .endm
69
70 .macro EVPE reg=0
71 .word 0x41600021 | (\reg << 16)
72 .endm
73
74 .macro MFTR rt=0, rd=0, u=0, sel=0
75 .word 0x41000000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
76 .endm
77
78 .macro MTTR rt=0, rd=0, u=0, sel=0
79 .word 0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
80 .endm
81
82#endif /* _ASM_ASMMACRO_H */
diff --git a/include/asm-mips/atomic.h b/include/asm-mips/atomic.h
deleted file mode 100644
index 1232be3885b0..000000000000
--- a/include/asm-mips/atomic.h
+++ /dev/null
@@ -1,801 +0,0 @@
1/*
2 * Atomic operations that C can't guarantee us. Useful for
3 * resource counting etc..
4 *
5 * But use these as seldom as possible since they are much more slower
6 * than regular operations.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 * Copyright (C) 1996, 97, 99, 2000, 03, 04, 06 by Ralf Baechle
13 */
14#ifndef _ASM_ATOMIC_H
15#define _ASM_ATOMIC_H
16
17#include <linux/irqflags.h>
18#include <asm/barrier.h>
19#include <asm/cpu-features.h>
20#include <asm/war.h>
21#include <asm/system.h>
22
23typedef struct { volatile int counter; } atomic_t;
24
25#define ATOMIC_INIT(i) { (i) }
26
27/*
28 * atomic_read - read atomic variable
29 * @v: pointer of type atomic_t
30 *
31 * Atomically reads the value of @v.
32 */
33#define atomic_read(v) ((v)->counter)
34
35/*
36 * atomic_set - set atomic variable
37 * @v: pointer of type atomic_t
38 * @i: required value
39 *
40 * Atomically sets the value of @v to @i.
41 */
42#define atomic_set(v, i) ((v)->counter = (i))
43
44/*
45 * atomic_add - add integer to atomic variable
46 * @i: integer value to add
47 * @v: pointer of type atomic_t
48 *
49 * Atomically adds @i to @v.
50 */
51static __inline__ void atomic_add(int i, atomic_t * v)
52{
53 if (cpu_has_llsc && R10000_LLSC_WAR) {
54 unsigned long temp;
55
56 __asm__ __volatile__(
57 " .set mips3 \n"
58 "1: ll %0, %1 # atomic_add \n"
59 " addu %0, %2 \n"
60 " sc %0, %1 \n"
61 " beqzl %0, 1b \n"
62 " .set mips0 \n"
63 : "=&r" (temp), "=m" (v->counter)
64 : "Ir" (i), "m" (v->counter));
65 } else if (cpu_has_llsc) {
66 unsigned long temp;
67
68 __asm__ __volatile__(
69 " .set mips3 \n"
70 "1: ll %0, %1 # atomic_add \n"
71 " addu %0, %2 \n"
72 " sc %0, %1 \n"
73 " beqz %0, 2f \n"
74 " .subsection 2 \n"
75 "2: b 1b \n"
76 " .previous \n"
77 " .set mips0 \n"
78 : "=&r" (temp), "=m" (v->counter)
79 : "Ir" (i), "m" (v->counter));
80 } else {
81 unsigned long flags;
82
83 raw_local_irq_save(flags);
84 v->counter += i;
85 raw_local_irq_restore(flags);
86 }
87}
88
89/*
90 * atomic_sub - subtract the atomic variable
91 * @i: integer value to subtract
92 * @v: pointer of type atomic_t
93 *
94 * Atomically subtracts @i from @v.
95 */
96static __inline__ void atomic_sub(int i, atomic_t * v)
97{
98 if (cpu_has_llsc && R10000_LLSC_WAR) {
99 unsigned long temp;
100
101 __asm__ __volatile__(
102 " .set mips3 \n"
103 "1: ll %0, %1 # atomic_sub \n"
104 " subu %0, %2 \n"
105 " sc %0, %1 \n"
106 " beqzl %0, 1b \n"
107 " .set mips0 \n"
108 : "=&r" (temp), "=m" (v->counter)
109 : "Ir" (i), "m" (v->counter));
110 } else if (cpu_has_llsc) {
111 unsigned long temp;
112
113 __asm__ __volatile__(
114 " .set mips3 \n"
115 "1: ll %0, %1 # atomic_sub \n"
116 " subu %0, %2 \n"
117 " sc %0, %1 \n"
118 " beqz %0, 2f \n"
119 " .subsection 2 \n"
120 "2: b 1b \n"
121 " .previous \n"
122 " .set mips0 \n"
123 : "=&r" (temp), "=m" (v->counter)
124 : "Ir" (i), "m" (v->counter));
125 } else {
126 unsigned long flags;
127
128 raw_local_irq_save(flags);
129 v->counter -= i;
130 raw_local_irq_restore(flags);
131 }
132}
133
134/*
135 * Same as above, but return the result value
136 */
137static __inline__ int atomic_add_return(int i, atomic_t * v)
138{
139 unsigned long result;
140
141 smp_llsc_mb();
142
143 if (cpu_has_llsc && R10000_LLSC_WAR) {
144 unsigned long temp;
145
146 __asm__ __volatile__(
147 " .set mips3 \n"
148 "1: ll %1, %2 # atomic_add_return \n"
149 " addu %0, %1, %3 \n"
150 " sc %0, %2 \n"
151 " beqzl %0, 1b \n"
152 " addu %0, %1, %3 \n"
153 " .set mips0 \n"
154 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
155 : "Ir" (i), "m" (v->counter)
156 : "memory");
157 } else if (cpu_has_llsc) {
158 unsigned long temp;
159
160 __asm__ __volatile__(
161 " .set mips3 \n"
162 "1: ll %1, %2 # atomic_add_return \n"
163 " addu %0, %1, %3 \n"
164 " sc %0, %2 \n"
165 " beqz %0, 2f \n"
166 " addu %0, %1, %3 \n"
167 " .subsection 2 \n"
168 "2: b 1b \n"
169 " .previous \n"
170 " .set mips0 \n"
171 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
172 : "Ir" (i), "m" (v->counter)
173 : "memory");
174 } else {
175 unsigned long flags;
176
177 raw_local_irq_save(flags);
178 result = v->counter;
179 result += i;
180 v->counter = result;
181 raw_local_irq_restore(flags);
182 }
183
184 smp_llsc_mb();
185
186 return result;
187}
188
189static __inline__ int atomic_sub_return(int i, atomic_t * v)
190{
191 unsigned long result;
192
193 smp_llsc_mb();
194
195 if (cpu_has_llsc && R10000_LLSC_WAR) {
196 unsigned long temp;
197
198 __asm__ __volatile__(
199 " .set mips3 \n"
200 "1: ll %1, %2 # atomic_sub_return \n"
201 " subu %0, %1, %3 \n"
202 " sc %0, %2 \n"
203 " beqzl %0, 1b \n"
204 " subu %0, %1, %3 \n"
205 " .set mips0 \n"
206 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
207 : "Ir" (i), "m" (v->counter)
208 : "memory");
209 } else if (cpu_has_llsc) {
210 unsigned long temp;
211
212 __asm__ __volatile__(
213 " .set mips3 \n"
214 "1: ll %1, %2 # atomic_sub_return \n"
215 " subu %0, %1, %3 \n"
216 " sc %0, %2 \n"
217 " beqz %0, 2f \n"
218 " subu %0, %1, %3 \n"
219 " .subsection 2 \n"
220 "2: b 1b \n"
221 " .previous \n"
222 " .set mips0 \n"
223 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
224 : "Ir" (i), "m" (v->counter)
225 : "memory");
226 } else {
227 unsigned long flags;
228
229 raw_local_irq_save(flags);
230 result = v->counter;
231 result -= i;
232 v->counter = result;
233 raw_local_irq_restore(flags);
234 }
235
236 smp_llsc_mb();
237
238 return result;
239}
240
241/*
242 * atomic_sub_if_positive - conditionally subtract integer from atomic variable
243 * @i: integer value to subtract
244 * @v: pointer of type atomic_t
245 *
246 * Atomically test @v and subtract @i if @v is greater or equal than @i.
247 * The function returns the old value of @v minus @i.
248 */
249static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
250{
251 unsigned long result;
252
253 smp_llsc_mb();
254
255 if (cpu_has_llsc && R10000_LLSC_WAR) {
256 unsigned long temp;
257
258 __asm__ __volatile__(
259 " .set mips3 \n"
260 "1: ll %1, %2 # atomic_sub_if_positive\n"
261 " subu %0, %1, %3 \n"
262 " bltz %0, 1f \n"
263 " sc %0, %2 \n"
264 " .set noreorder \n"
265 " beqzl %0, 1b \n"
266 " subu %0, %1, %3 \n"
267 " .set reorder \n"
268 "1: \n"
269 " .set mips0 \n"
270 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
271 : "Ir" (i), "m" (v->counter)
272 : "memory");
273 } else if (cpu_has_llsc) {
274 unsigned long temp;
275
276 __asm__ __volatile__(
277 " .set mips3 \n"
278 "1: ll %1, %2 # atomic_sub_if_positive\n"
279 " subu %0, %1, %3 \n"
280 " bltz %0, 1f \n"
281 " sc %0, %2 \n"
282 " .set noreorder \n"
283 " beqz %0, 2f \n"
284 " subu %0, %1, %3 \n"
285 " .set reorder \n"
286 " .subsection 2 \n"
287 "2: b 1b \n"
288 " .previous \n"
289 "1: \n"
290 " .set mips0 \n"
291 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
292 : "Ir" (i), "m" (v->counter)
293 : "memory");
294 } else {
295 unsigned long flags;
296
297 raw_local_irq_save(flags);
298 result = v->counter;
299 result -= i;
300 if (result >= 0)
301 v->counter = result;
302 raw_local_irq_restore(flags);
303 }
304
305 smp_llsc_mb();
306
307 return result;
308}
309
310#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
311#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
312
313/**
314 * atomic_add_unless - add unless the number is a given value
315 * @v: pointer of type atomic_t
316 * @a: the amount to add to v...
317 * @u: ...unless v is equal to u.
318 *
319 * Atomically adds @a to @v, so long as it was not @u.
320 * Returns non-zero if @v was not @u, and zero otherwise.
321 */
322static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
323{
324 int c, old;
325 c = atomic_read(v);
326 for (;;) {
327 if (unlikely(c == (u)))
328 break;
329 old = atomic_cmpxchg((v), c, c + (a));
330 if (likely(old == c))
331 break;
332 c = old;
333 }
334 return c != (u);
335}
336#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
337
338#define atomic_dec_return(v) atomic_sub_return(1, (v))
339#define atomic_inc_return(v) atomic_add_return(1, (v))
340
341/*
342 * atomic_sub_and_test - subtract value from variable and test result
343 * @i: integer value to subtract
344 * @v: pointer of type atomic_t
345 *
346 * Atomically subtracts @i from @v and returns
347 * true if the result is zero, or false for all
348 * other cases.
349 */
350#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
351
352/*
353 * atomic_inc_and_test - increment and test
354 * @v: pointer of type atomic_t
355 *
356 * Atomically increments @v by 1
357 * and returns true if the result is zero, or false for all
358 * other cases.
359 */
360#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
361
362/*
363 * atomic_dec_and_test - decrement by 1 and test
364 * @v: pointer of type atomic_t
365 *
366 * Atomically decrements @v by 1 and
367 * returns true if the result is 0, or false for all other
368 * cases.
369 */
370#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
371
372/*
373 * atomic_dec_if_positive - decrement by 1 if old value positive
374 * @v: pointer of type atomic_t
375 */
376#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
377
378/*
379 * atomic_inc - increment atomic variable
380 * @v: pointer of type atomic_t
381 *
382 * Atomically increments @v by 1.
383 */
384#define atomic_inc(v) atomic_add(1, (v))
385
386/*
387 * atomic_dec - decrement and test
388 * @v: pointer of type atomic_t
389 *
390 * Atomically decrements @v by 1.
391 */
392#define atomic_dec(v) atomic_sub(1, (v))
393
394/*
395 * atomic_add_negative - add and test if negative
396 * @v: pointer of type atomic_t
397 * @i: integer value to add
398 *
399 * Atomically adds @i to @v and returns true
400 * if the result is negative, or false when
401 * result is greater than or equal to zero.
402 */
403#define atomic_add_negative(i, v) (atomic_add_return(i, (v)) < 0)
404
405#ifdef CONFIG_64BIT
406
407typedef struct { volatile long counter; } atomic64_t;
408
409#define ATOMIC64_INIT(i) { (i) }
410
411/*
412 * atomic64_read - read atomic variable
413 * @v: pointer of type atomic64_t
414 *
415 */
416#define atomic64_read(v) ((v)->counter)
417
418/*
419 * atomic64_set - set atomic variable
420 * @v: pointer of type atomic64_t
421 * @i: required value
422 */
423#define atomic64_set(v, i) ((v)->counter = (i))
424
425/*
426 * atomic64_add - add integer to atomic variable
427 * @i: integer value to add
428 * @v: pointer of type atomic64_t
429 *
430 * Atomically adds @i to @v.
431 */
432static __inline__ void atomic64_add(long i, atomic64_t * v)
433{
434 if (cpu_has_llsc && R10000_LLSC_WAR) {
435 unsigned long temp;
436
437 __asm__ __volatile__(
438 " .set mips3 \n"
439 "1: lld %0, %1 # atomic64_add \n"
440 " addu %0, %2 \n"
441 " scd %0, %1 \n"
442 " beqzl %0, 1b \n"
443 " .set mips0 \n"
444 : "=&r" (temp), "=m" (v->counter)
445 : "Ir" (i), "m" (v->counter));
446 } else if (cpu_has_llsc) {
447 unsigned long temp;
448
449 __asm__ __volatile__(
450 " .set mips3 \n"
451 "1: lld %0, %1 # atomic64_add \n"
452 " addu %0, %2 \n"
453 " scd %0, %1 \n"
454 " beqz %0, 2f \n"
455 " .subsection 2 \n"
456 "2: b 1b \n"
457 " .previous \n"
458 " .set mips0 \n"
459 : "=&r" (temp), "=m" (v->counter)
460 : "Ir" (i), "m" (v->counter));
461 } else {
462 unsigned long flags;
463
464 raw_local_irq_save(flags);
465 v->counter += i;
466 raw_local_irq_restore(flags);
467 }
468}
469
470/*
471 * atomic64_sub - subtract the atomic variable
472 * @i: integer value to subtract
473 * @v: pointer of type atomic64_t
474 *
475 * Atomically subtracts @i from @v.
476 */
477static __inline__ void atomic64_sub(long i, atomic64_t * v)
478{
479 if (cpu_has_llsc && R10000_LLSC_WAR) {
480 unsigned long temp;
481
482 __asm__ __volatile__(
483 " .set mips3 \n"
484 "1: lld %0, %1 # atomic64_sub \n"
485 " subu %0, %2 \n"
486 " scd %0, %1 \n"
487 " beqzl %0, 1b \n"
488 " .set mips0 \n"
489 : "=&r" (temp), "=m" (v->counter)
490 : "Ir" (i), "m" (v->counter));
491 } else if (cpu_has_llsc) {
492 unsigned long temp;
493
494 __asm__ __volatile__(
495 " .set mips3 \n"
496 "1: lld %0, %1 # atomic64_sub \n"
497 " subu %0, %2 \n"
498 " scd %0, %1 \n"
499 " beqz %0, 2f \n"
500 " .subsection 2 \n"
501 "2: b 1b \n"
502 " .previous \n"
503 " .set mips0 \n"
504 : "=&r" (temp), "=m" (v->counter)
505 : "Ir" (i), "m" (v->counter));
506 } else {
507 unsigned long flags;
508
509 raw_local_irq_save(flags);
510 v->counter -= i;
511 raw_local_irq_restore(flags);
512 }
513}
514
515/*
516 * Same as above, but return the result value
517 */
518static __inline__ long atomic64_add_return(long i, atomic64_t * v)
519{
520 unsigned long result;
521
522 smp_llsc_mb();
523
524 if (cpu_has_llsc && R10000_LLSC_WAR) {
525 unsigned long temp;
526
527 __asm__ __volatile__(
528 " .set mips3 \n"
529 "1: lld %1, %2 # atomic64_add_return \n"
530 " addu %0, %1, %3 \n"
531 " scd %0, %2 \n"
532 " beqzl %0, 1b \n"
533 " addu %0, %1, %3 \n"
534 " .set mips0 \n"
535 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
536 : "Ir" (i), "m" (v->counter)
537 : "memory");
538 } else if (cpu_has_llsc) {
539 unsigned long temp;
540
541 __asm__ __volatile__(
542 " .set mips3 \n"
543 "1: lld %1, %2 # atomic64_add_return \n"
544 " addu %0, %1, %3 \n"
545 " scd %0, %2 \n"
546 " beqz %0, 2f \n"
547 " addu %0, %1, %3 \n"
548 " .subsection 2 \n"
549 "2: b 1b \n"
550 " .previous \n"
551 " .set mips0 \n"
552 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
553 : "Ir" (i), "m" (v->counter)
554 : "memory");
555 } else {
556 unsigned long flags;
557
558 raw_local_irq_save(flags);
559 result = v->counter;
560 result += i;
561 v->counter = result;
562 raw_local_irq_restore(flags);
563 }
564
565 smp_llsc_mb();
566
567 return result;
568}
569
570static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
571{
572 unsigned long result;
573
574 smp_llsc_mb();
575
576 if (cpu_has_llsc && R10000_LLSC_WAR) {
577 unsigned long temp;
578
579 __asm__ __volatile__(
580 " .set mips3 \n"
581 "1: lld %1, %2 # atomic64_sub_return \n"
582 " subu %0, %1, %3 \n"
583 " scd %0, %2 \n"
584 " beqzl %0, 1b \n"
585 " subu %0, %1, %3 \n"
586 " .set mips0 \n"
587 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
588 : "Ir" (i), "m" (v->counter)
589 : "memory");
590 } else if (cpu_has_llsc) {
591 unsigned long temp;
592
593 __asm__ __volatile__(
594 " .set mips3 \n"
595 "1: lld %1, %2 # atomic64_sub_return \n"
596 " subu %0, %1, %3 \n"
597 " scd %0, %2 \n"
598 " beqz %0, 2f \n"
599 " subu %0, %1, %3 \n"
600 " .subsection 2 \n"
601 "2: b 1b \n"
602 " .previous \n"
603 " .set mips0 \n"
604 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
605 : "Ir" (i), "m" (v->counter)
606 : "memory");
607 } else {
608 unsigned long flags;
609
610 raw_local_irq_save(flags);
611 result = v->counter;
612 result -= i;
613 v->counter = result;
614 raw_local_irq_restore(flags);
615 }
616
617 smp_llsc_mb();
618
619 return result;
620}
621
622/*
623 * atomic64_sub_if_positive - conditionally subtract integer from atomic variable
624 * @i: integer value to subtract
625 * @v: pointer of type atomic64_t
626 *
627 * Atomically test @v and subtract @i if @v is greater or equal than @i.
628 * The function returns the old value of @v minus @i.
629 */
630static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
631{
632 unsigned long result;
633
634 smp_llsc_mb();
635
636 if (cpu_has_llsc && R10000_LLSC_WAR) {
637 unsigned long temp;
638
639 __asm__ __volatile__(
640 " .set mips3 \n"
641 "1: lld %1, %2 # atomic64_sub_if_positive\n"
642 " dsubu %0, %1, %3 \n"
643 " bltz %0, 1f \n"
644 " scd %0, %2 \n"
645 " .set noreorder \n"
646 " beqzl %0, 1b \n"
647 " dsubu %0, %1, %3 \n"
648 " .set reorder \n"
649 "1: \n"
650 " .set mips0 \n"
651 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
652 : "Ir" (i), "m" (v->counter)
653 : "memory");
654 } else if (cpu_has_llsc) {
655 unsigned long temp;
656
657 __asm__ __volatile__(
658 " .set mips3 \n"
659 "1: lld %1, %2 # atomic64_sub_if_positive\n"
660 " dsubu %0, %1, %3 \n"
661 " bltz %0, 1f \n"
662 " scd %0, %2 \n"
663 " .set noreorder \n"
664 " beqz %0, 2f \n"
665 " dsubu %0, %1, %3 \n"
666 " .set reorder \n"
667 " .subsection 2 \n"
668 "2: b 1b \n"
669 " .previous \n"
670 "1: \n"
671 " .set mips0 \n"
672 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
673 : "Ir" (i), "m" (v->counter)
674 : "memory");
675 } else {
676 unsigned long flags;
677
678 raw_local_irq_save(flags);
679 result = v->counter;
680 result -= i;
681 if (result >= 0)
682 v->counter = result;
683 raw_local_irq_restore(flags);
684 }
685
686 smp_llsc_mb();
687
688 return result;
689}
690
691#define atomic64_cmpxchg(v, o, n) \
692 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
693#define atomic64_xchg(v, new) (xchg(&((v)->counter), (new)))
694
695/**
696 * atomic64_add_unless - add unless the number is a given value
697 * @v: pointer of type atomic64_t
698 * @a: the amount to add to v...
699 * @u: ...unless v is equal to u.
700 *
701 * Atomically adds @a to @v, so long as it was not @u.
702 * Returns non-zero if @v was not @u, and zero otherwise.
703 */
704static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
705{
706 long c, old;
707 c = atomic64_read(v);
708 for (;;) {
709 if (unlikely(c == (u)))
710 break;
711 old = atomic64_cmpxchg((v), c, c + (a));
712 if (likely(old == c))
713 break;
714 c = old;
715 }
716 return c != (u);
717}
718
719#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
720
721#define atomic64_dec_return(v) atomic64_sub_return(1, (v))
722#define atomic64_inc_return(v) atomic64_add_return(1, (v))
723
724/*
725 * atomic64_sub_and_test - subtract value from variable and test result
726 * @i: integer value to subtract
727 * @v: pointer of type atomic64_t
728 *
729 * Atomically subtracts @i from @v and returns
730 * true if the result is zero, or false for all
731 * other cases.
732 */
733#define atomic64_sub_and_test(i, v) (atomic64_sub_return((i), (v)) == 0)
734
735/*
736 * atomic64_inc_and_test - increment and test
737 * @v: pointer of type atomic64_t
738 *
739 * Atomically increments @v by 1
740 * and returns true if the result is zero, or false for all
741 * other cases.
742 */
743#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
744
745/*
746 * atomic64_dec_and_test - decrement by 1 and test
747 * @v: pointer of type atomic64_t
748 *
749 * Atomically decrements @v by 1 and
750 * returns true if the result is 0, or false for all other
751 * cases.
752 */
753#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
754
755/*
756 * atomic64_dec_if_positive - decrement by 1 if old value positive
757 * @v: pointer of type atomic64_t
758 */
759#define atomic64_dec_if_positive(v) atomic64_sub_if_positive(1, v)
760
761/*
762 * atomic64_inc - increment atomic variable
763 * @v: pointer of type atomic64_t
764 *
765 * Atomically increments @v by 1.
766 */
767#define atomic64_inc(v) atomic64_add(1, (v))
768
769/*
770 * atomic64_dec - decrement and test
771 * @v: pointer of type atomic64_t
772 *
773 * Atomically decrements @v by 1.
774 */
775#define atomic64_dec(v) atomic64_sub(1, (v))
776
777/*
778 * atomic64_add_negative - add and test if negative
779 * @v: pointer of type atomic64_t
780 * @i: integer value to add
781 *
782 * Atomically adds @i to @v and returns true
783 * if the result is negative, or false when
784 * result is greater than or equal to zero.
785 */
786#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0)
787
788#endif /* CONFIG_64BIT */
789
790/*
791 * atomic*_return operations are serializing but not the non-*_return
792 * versions.
793 */
794#define smp_mb__before_atomic_dec() smp_llsc_mb()
795#define smp_mb__after_atomic_dec() smp_llsc_mb()
796#define smp_mb__before_atomic_inc() smp_llsc_mb()
797#define smp_mb__after_atomic_inc() smp_llsc_mb()
798
799#include <asm-generic/atomic.h>
800
801#endif /* _ASM_ATOMIC_H */
diff --git a/include/asm-mips/auxvec.h b/include/asm-mips/auxvec.h
deleted file mode 100644
index 7cf7f2d21943..000000000000
--- a/include/asm-mips/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef _ASM_AUXVEC_H
2#define _ASM_AUXVEC_H
3
4#endif /* _ASM_AUXVEC_H */
diff --git a/include/asm-mips/barrier.h b/include/asm-mips/barrier.h
deleted file mode 100644
index 8e9ac313ca3b..000000000000
--- a/include/asm-mips/barrier.h
+++ /dev/null
@@ -1,155 +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_BARRIER_H
9#define __ASM_BARRIER_H
10
11/*
12 * read_barrier_depends - Flush all pending reads that subsequents reads
13 * depend on.
14 *
15 * No data-dependent reads from memory-like regions are ever reordered
16 * over this barrier. All reads preceding this primitive are guaranteed
17 * to access memory (but not necessarily other CPUs' caches) before any
18 * reads following this primitive that depend on the data return by
19 * any of the preceding reads. This primitive is much lighter weight than
20 * rmb() on most CPUs, and is never heavier weight than is
21 * rmb().
22 *
23 * These ordering constraints are respected by both the local CPU
24 * and the compiler.
25 *
26 * Ordering is not guaranteed by anything other than these primitives,
27 * not even by data dependencies. See the documentation for
28 * memory_barrier() for examples and URLs to more information.
29 *
30 * For example, the following code would force ordering (the initial
31 * value of "a" is zero, "b" is one, and "p" is "&a"):
32 *
33 * <programlisting>
34 * CPU 0 CPU 1
35 *
36 * b = 2;
37 * memory_barrier();
38 * p = &b; q = p;
39 * read_barrier_depends();
40 * d = *q;
41 * </programlisting>
42 *
43 * because the read of "*q" depends on the read of "p" and these
44 * two reads are separated by a read_barrier_depends(). However,
45 * the following code, with the same initial values for "a" and "b":
46 *
47 * <programlisting>
48 * CPU 0 CPU 1
49 *
50 * a = 2;
51 * memory_barrier();
52 * b = 3; y = b;
53 * read_barrier_depends();
54 * x = a;
55 * </programlisting>
56 *
57 * does not enforce ordering, since there is no data dependency between
58 * the read of "a" and the read of "b". Therefore, on some CPUs, such
59 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
60 * in cases like this where there are no data dependencies.
61 */
62
63#define read_barrier_depends() do { } while(0)
64#define smp_read_barrier_depends() do { } while(0)
65
66#ifdef CONFIG_CPU_HAS_SYNC
67#define __sync() \
68 __asm__ __volatile__( \
69 ".set push\n\t" \
70 ".set noreorder\n\t" \
71 ".set mips2\n\t" \
72 "sync\n\t" \
73 ".set pop" \
74 : /* no output */ \
75 : /* no input */ \
76 : "memory")
77#else
78#define __sync() do { } while(0)
79#endif
80
81#define __fast_iob() \
82 __asm__ __volatile__( \
83 ".set push\n\t" \
84 ".set noreorder\n\t" \
85 "lw $0,%0\n\t" \
86 "nop\n\t" \
87 ".set pop" \
88 : /* no output */ \
89 : "m" (*(int *)CKSEG1) \
90 : "memory")
91
92#define fast_wmb() __sync()
93#define fast_rmb() __sync()
94#define fast_mb() __sync()
95#ifdef CONFIG_SGI_IP28
96#define fast_iob() \
97 __asm__ __volatile__( \
98 ".set push\n\t" \
99 ".set noreorder\n\t" \
100 "lw $0,%0\n\t" \
101 "sync\n\t" \
102 "lw $0,%0\n\t" \
103 ".set pop" \
104 : /* no output */ \
105 : "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
106 : "memory")
107#else
108#define fast_iob() \
109 do { \
110 __sync(); \
111 __fast_iob(); \
112 } while (0)
113#endif
114
115#ifdef CONFIG_CPU_HAS_WB
116
117#include <asm/wbflush.h>
118
119#define wmb() fast_wmb()
120#define rmb() fast_rmb()
121#define mb() wbflush()
122#define iob() wbflush()
123
124#else /* !CONFIG_CPU_HAS_WB */
125
126#define wmb() fast_wmb()
127#define rmb() fast_rmb()
128#define mb() fast_mb()
129#define iob() fast_iob()
130
131#endif /* !CONFIG_CPU_HAS_WB */
132
133#if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
134#define __WEAK_ORDERING_MB " sync \n"
135#else
136#define __WEAK_ORDERING_MB " \n"
137#endif
138#if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
139#define __WEAK_LLSC_MB " sync \n"
140#else
141#define __WEAK_LLSC_MB " \n"
142#endif
143
144#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
145#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
146#define smp_wmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
147
148#define set_mb(var, value) \
149 do { var = value; smp_mb(); } while (0)
150
151#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
152#define smp_llsc_rmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
153#define smp_llsc_wmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
154
155#endif /* __ASM_BARRIER_H */
diff --git a/include/asm-mips/bcache.h b/include/asm-mips/bcache.h
deleted file mode 100644
index 0ba9d6ef76a7..000000000000
--- a/include/asm-mips/bcache.h
+++ /dev/null
@@ -1,60 +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) 1997, 1999 by Ralf Baechle
7 * Copyright (c) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_BCACHE_H
10#define _ASM_BCACHE_H
11
12
13/* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent,
14 chipset implemented caches. On machines with other CPUs the CPU does the
15 cache thing itself. */
16struct bcache_ops {
17 void (*bc_enable)(void);
18 void (*bc_disable)(void);
19 void (*bc_wback_inv)(unsigned long page, unsigned long size);
20 void (*bc_inv)(unsigned long page, unsigned long size);
21};
22
23extern void indy_sc_init(void);
24
25#ifdef CONFIG_BOARD_SCACHE
26
27extern struct bcache_ops *bcops;
28
29static inline void bc_enable(void)
30{
31 bcops->bc_enable();
32}
33
34static inline void bc_disable(void)
35{
36 bcops->bc_disable();
37}
38
39static inline void bc_wback_inv(unsigned long page, unsigned long size)
40{
41 bcops->bc_wback_inv(page, size);
42}
43
44static inline void bc_inv(unsigned long page, unsigned long size)
45{
46 bcops->bc_inv(page, size);
47}
48
49#else /* !defined(CONFIG_BOARD_SCACHE) */
50
51/* Not R4000 / R4400 / R4600 / R5000. */
52
53#define bc_enable() do { } while (0)
54#define bc_disable() do { } while (0)
55#define bc_wback_inv(page, size) do { } while (0)
56#define bc_inv(page, size) do { } while (0)
57
58#endif /* !defined(CONFIG_BOARD_SCACHE) */
59
60#endif /* _ASM_BCACHE_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
deleted file mode 100644
index 49df8c4c9d25..000000000000
--- a/include/asm-mips/bitops.h
+++ /dev/null
@@ -1,672 +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) 1994 - 1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_BITOPS_H
10#define _ASM_BITOPS_H
11
12#ifndef _LINUX_BITOPS_H
13#error only <linux/bitops.h> can be included directly
14#endif
15
16#include <linux/compiler.h>
17#include <linux/irqflags.h>
18#include <linux/types.h>
19#include <asm/barrier.h>
20#include <asm/bug.h>
21#include <asm/byteorder.h> /* sigh ... */
22#include <asm/cpu-features.h>
23#include <asm/sgidefs.h>
24#include <asm/war.h>
25
26#if _MIPS_SZLONG == 32
27#define SZLONG_LOG 5
28#define SZLONG_MASK 31UL
29#define __LL "ll "
30#define __SC "sc "
31#define __INS "ins "
32#define __EXT "ext "
33#elif _MIPS_SZLONG == 64
34#define SZLONG_LOG 6
35#define SZLONG_MASK 63UL
36#define __LL "lld "
37#define __SC "scd "
38#define __INS "dins "
39#define __EXT "dext "
40#endif
41
42/*
43 * clear_bit() doesn't provide any barrier for the compiler.
44 */
45#define smp_mb__before_clear_bit() smp_llsc_mb()
46#define smp_mb__after_clear_bit() smp_llsc_mb()
47
48/*
49 * set_bit - Atomically set a bit in memory
50 * @nr: the bit to set
51 * @addr: the address to start counting from
52 *
53 * This function is atomic and may not be reordered. See __set_bit()
54 * if you do not require the atomic guarantees.
55 * Note that @nr may be almost arbitrarily large; this function is not
56 * restricted to acting on a single-word quantity.
57 */
58static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
59{
60 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
61 unsigned short bit = nr & SZLONG_MASK;
62 unsigned long temp;
63
64 if (cpu_has_llsc && R10000_LLSC_WAR) {
65 __asm__ __volatile__(
66 " .set mips3 \n"
67 "1: " __LL "%0, %1 # set_bit \n"
68 " or %0, %2 \n"
69 " " __SC "%0, %1 \n"
70 " beqzl %0, 1b \n"
71 " .set mips0 \n"
72 : "=&r" (temp), "=m" (*m)
73 : "ir" (1UL << bit), "m" (*m));
74#ifdef CONFIG_CPU_MIPSR2
75 } else if (__builtin_constant_p(bit)) {
76 __asm__ __volatile__(
77 "1: " __LL "%0, %1 # set_bit \n"
78 " " __INS "%0, %4, %2, 1 \n"
79 " " __SC "%0, %1 \n"
80 " beqz %0, 2f \n"
81 " .subsection 2 \n"
82 "2: b 1b \n"
83 " .previous \n"
84 : "=&r" (temp), "=m" (*m)
85 : "ir" (bit), "m" (*m), "r" (~0));
86#endif /* CONFIG_CPU_MIPSR2 */
87 } else if (cpu_has_llsc) {
88 __asm__ __volatile__(
89 " .set mips3 \n"
90 "1: " __LL "%0, %1 # set_bit \n"
91 " or %0, %2 \n"
92 " " __SC "%0, %1 \n"
93 " beqz %0, 2f \n"
94 " .subsection 2 \n"
95 "2: b 1b \n"
96 " .previous \n"
97 " .set mips0 \n"
98 : "=&r" (temp), "=m" (*m)
99 : "ir" (1UL << bit), "m" (*m));
100 } else {
101 volatile unsigned long *a = addr;
102 unsigned long mask;
103 unsigned long flags;
104
105 a += nr >> SZLONG_LOG;
106 mask = 1UL << bit;
107 raw_local_irq_save(flags);
108 *a |= mask;
109 raw_local_irq_restore(flags);
110 }
111}
112
113/*
114 * clear_bit - Clears a bit in memory
115 * @nr: Bit to clear
116 * @addr: Address to start counting from
117 *
118 * clear_bit() is atomic and may not be reordered. However, it does
119 * not contain a memory barrier, so if it is used for locking purposes,
120 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
121 * in order to ensure changes are visible on other processors.
122 */
123static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
124{
125 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
126 unsigned short bit = nr & SZLONG_MASK;
127 unsigned long temp;
128
129 if (cpu_has_llsc && R10000_LLSC_WAR) {
130 __asm__ __volatile__(
131 " .set mips3 \n"
132 "1: " __LL "%0, %1 # clear_bit \n"
133 " and %0, %2 \n"
134 " " __SC "%0, %1 \n"
135 " beqzl %0, 1b \n"
136 " .set mips0 \n"
137 : "=&r" (temp), "=m" (*m)
138 : "ir" (~(1UL << bit)), "m" (*m));
139#ifdef CONFIG_CPU_MIPSR2
140 } else if (__builtin_constant_p(bit)) {
141 __asm__ __volatile__(
142 "1: " __LL "%0, %1 # clear_bit \n"
143 " " __INS "%0, $0, %2, 1 \n"
144 " " __SC "%0, %1 \n"
145 " beqz %0, 2f \n"
146 " .subsection 2 \n"
147 "2: b 1b \n"
148 " .previous \n"
149 : "=&r" (temp), "=m" (*m)
150 : "ir" (bit), "m" (*m));
151#endif /* CONFIG_CPU_MIPSR2 */
152 } else if (cpu_has_llsc) {
153 __asm__ __volatile__(
154 " .set mips3 \n"
155 "1: " __LL "%0, %1 # clear_bit \n"
156 " and %0, %2 \n"
157 " " __SC "%0, %1 \n"
158 " beqz %0, 2f \n"
159 " .subsection 2 \n"
160 "2: b 1b \n"
161 " .previous \n"
162 " .set mips0 \n"
163 : "=&r" (temp), "=m" (*m)
164 : "ir" (~(1UL << bit)), "m" (*m));
165 } else {
166 volatile unsigned long *a = addr;
167 unsigned long mask;
168 unsigned long flags;
169
170 a += nr >> SZLONG_LOG;
171 mask = 1UL << bit;
172 raw_local_irq_save(flags);
173 *a &= ~mask;
174 raw_local_irq_restore(flags);
175 }
176}
177
178/*
179 * clear_bit_unlock - Clears a bit in memory
180 * @nr: Bit to clear
181 * @addr: Address to start counting from
182 *
183 * clear_bit() is atomic and implies release semantics before the memory
184 * operation. It can be used for an unlock.
185 */
186static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
187{
188 smp_mb__before_clear_bit();
189 clear_bit(nr, addr);
190}
191
192/*
193 * change_bit - Toggle a bit in memory
194 * @nr: Bit to change
195 * @addr: Address to start counting from
196 *
197 * change_bit() is atomic and may not be reordered.
198 * Note that @nr may be almost arbitrarily large; this function is not
199 * restricted to acting on a single-word quantity.
200 */
201static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
202{
203 unsigned short bit = nr & SZLONG_MASK;
204
205 if (cpu_has_llsc && R10000_LLSC_WAR) {
206 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
207 unsigned long temp;
208
209 __asm__ __volatile__(
210 " .set mips3 \n"
211 "1: " __LL "%0, %1 # change_bit \n"
212 " xor %0, %2 \n"
213 " " __SC "%0, %1 \n"
214 " beqzl %0, 1b \n"
215 " .set mips0 \n"
216 : "=&r" (temp), "=m" (*m)
217 : "ir" (1UL << bit), "m" (*m));
218 } else if (cpu_has_llsc) {
219 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
220 unsigned long temp;
221
222 __asm__ __volatile__(
223 " .set mips3 \n"
224 "1: " __LL "%0, %1 # change_bit \n"
225 " xor %0, %2 \n"
226 " " __SC "%0, %1 \n"
227 " beqz %0, 2f \n"
228 " .subsection 2 \n"
229 "2: b 1b \n"
230 " .previous \n"
231 " .set mips0 \n"
232 : "=&r" (temp), "=m" (*m)
233 : "ir" (1UL << bit), "m" (*m));
234 } else {
235 volatile unsigned long *a = addr;
236 unsigned long mask;
237 unsigned long flags;
238
239 a += nr >> SZLONG_LOG;
240 mask = 1UL << bit;
241 raw_local_irq_save(flags);
242 *a ^= mask;
243 raw_local_irq_restore(flags);
244 }
245}
246
247/*
248 * test_and_set_bit - Set a bit and return its old value
249 * @nr: Bit to set
250 * @addr: Address to count from
251 *
252 * This operation is atomic and cannot be reordered.
253 * It also implies a memory barrier.
254 */
255static inline int test_and_set_bit(unsigned long nr,
256 volatile unsigned long *addr)
257{
258 unsigned short bit = nr & SZLONG_MASK;
259 unsigned long res;
260
261 smp_llsc_mb();
262
263 if (cpu_has_llsc && R10000_LLSC_WAR) {
264 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
265 unsigned long temp;
266
267 __asm__ __volatile__(
268 " .set mips3 \n"
269 "1: " __LL "%0, %1 # test_and_set_bit \n"
270 " or %2, %0, %3 \n"
271 " " __SC "%2, %1 \n"
272 " beqzl %2, 1b \n"
273 " and %2, %0, %3 \n"
274 " .set mips0 \n"
275 : "=&r" (temp), "=m" (*m), "=&r" (res)
276 : "r" (1UL << bit), "m" (*m)
277 : "memory");
278 } else if (cpu_has_llsc) {
279 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
280 unsigned long temp;
281
282 __asm__ __volatile__(
283 " .set push \n"
284 " .set noreorder \n"
285 " .set mips3 \n"
286 "1: " __LL "%0, %1 # test_and_set_bit \n"
287 " or %2, %0, %3 \n"
288 " " __SC "%2, %1 \n"
289 " beqz %2, 2f \n"
290 " and %2, %0, %3 \n"
291 " .subsection 2 \n"
292 "2: b 1b \n"
293 " nop \n"
294 " .previous \n"
295 " .set pop \n"
296 : "=&r" (temp), "=m" (*m), "=&r" (res)
297 : "r" (1UL << bit), "m" (*m)
298 : "memory");
299 } else {
300 volatile unsigned long *a = addr;
301 unsigned long mask;
302 unsigned long flags;
303
304 a += nr >> SZLONG_LOG;
305 mask = 1UL << bit;
306 raw_local_irq_save(flags);
307 res = (mask & *a);
308 *a |= mask;
309 raw_local_irq_restore(flags);
310 }
311
312 smp_llsc_mb();
313
314 return res != 0;
315}
316
317/*
318 * test_and_set_bit_lock - Set a bit and return its old value
319 * @nr: Bit to set
320 * @addr: Address to count from
321 *
322 * This operation is atomic and implies acquire ordering semantics
323 * after the memory operation.
324 */
325static inline int test_and_set_bit_lock(unsigned long nr,
326 volatile unsigned long *addr)
327{
328 unsigned short bit = nr & SZLONG_MASK;
329 unsigned long res;
330
331 if (cpu_has_llsc && R10000_LLSC_WAR) {
332 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
333 unsigned long temp;
334
335 __asm__ __volatile__(
336 " .set mips3 \n"
337 "1: " __LL "%0, %1 # test_and_set_bit \n"
338 " or %2, %0, %3 \n"
339 " " __SC "%2, %1 \n"
340 " beqzl %2, 1b \n"
341 " and %2, %0, %3 \n"
342 " .set mips0 \n"
343 : "=&r" (temp), "=m" (*m), "=&r" (res)
344 : "r" (1UL << bit), "m" (*m)
345 : "memory");
346 } else if (cpu_has_llsc) {
347 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
348 unsigned long temp;
349
350 __asm__ __volatile__(
351 " .set push \n"
352 " .set noreorder \n"
353 " .set mips3 \n"
354 "1: " __LL "%0, %1 # test_and_set_bit \n"
355 " or %2, %0, %3 \n"
356 " " __SC "%2, %1 \n"
357 " beqz %2, 2f \n"
358 " and %2, %0, %3 \n"
359 " .subsection 2 \n"
360 "2: b 1b \n"
361 " nop \n"
362 " .previous \n"
363 " .set pop \n"
364 : "=&r" (temp), "=m" (*m), "=&r" (res)
365 : "r" (1UL << bit), "m" (*m)
366 : "memory");
367 } else {
368 volatile unsigned long *a = addr;
369 unsigned long mask;
370 unsigned long flags;
371
372 a += nr >> SZLONG_LOG;
373 mask = 1UL << bit;
374 raw_local_irq_save(flags);
375 res = (mask & *a);
376 *a |= mask;
377 raw_local_irq_restore(flags);
378 }
379
380 smp_llsc_mb();
381
382 return res != 0;
383}
384/*
385 * test_and_clear_bit - Clear a bit and return its old value
386 * @nr: Bit to clear
387 * @addr: Address to count from
388 *
389 * This operation is atomic and cannot be reordered.
390 * It also implies a memory barrier.
391 */
392static inline int test_and_clear_bit(unsigned long nr,
393 volatile unsigned long *addr)
394{
395 unsigned short bit = nr & SZLONG_MASK;
396 unsigned long res;
397
398 smp_llsc_mb();
399
400 if (cpu_has_llsc && R10000_LLSC_WAR) {
401 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
402 unsigned long temp;
403
404 __asm__ __volatile__(
405 " .set mips3 \n"
406 "1: " __LL "%0, %1 # test_and_clear_bit \n"
407 " or %2, %0, %3 \n"
408 " xor %2, %3 \n"
409 " " __SC "%2, %1 \n"
410 " beqzl %2, 1b \n"
411 " and %2, %0, %3 \n"
412 " .set mips0 \n"
413 : "=&r" (temp), "=m" (*m), "=&r" (res)
414 : "r" (1UL << bit), "m" (*m)
415 : "memory");
416#ifdef CONFIG_CPU_MIPSR2
417 } else if (__builtin_constant_p(nr)) {
418 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
419 unsigned long temp;
420
421 __asm__ __volatile__(
422 "1: " __LL "%0, %1 # test_and_clear_bit \n"
423 " " __EXT "%2, %0, %3, 1 \n"
424 " " __INS "%0, $0, %3, 1 \n"
425 " " __SC "%0, %1 \n"
426 " beqz %0, 2f \n"
427 " .subsection 2 \n"
428 "2: b 1b \n"
429 " .previous \n"
430 : "=&r" (temp), "=m" (*m), "=&r" (res)
431 : "ir" (bit), "m" (*m)
432 : "memory");
433#endif
434 } else if (cpu_has_llsc) {
435 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
436 unsigned long temp;
437
438 __asm__ __volatile__(
439 " .set push \n"
440 " .set noreorder \n"
441 " .set mips3 \n"
442 "1: " __LL "%0, %1 # test_and_clear_bit \n"
443 " or %2, %0, %3 \n"
444 " xor %2, %3 \n"
445 " " __SC "%2, %1 \n"
446 " beqz %2, 2f \n"
447 " and %2, %0, %3 \n"
448 " .subsection 2 \n"
449 "2: b 1b \n"
450 " nop \n"
451 " .previous \n"
452 " .set pop \n"
453 : "=&r" (temp), "=m" (*m), "=&r" (res)
454 : "r" (1UL << bit), "m" (*m)
455 : "memory");
456 } else {
457 volatile unsigned long *a = addr;
458 unsigned long mask;
459 unsigned long flags;
460
461 a += nr >> SZLONG_LOG;
462 mask = 1UL << bit;
463 raw_local_irq_save(flags);
464 res = (mask & *a);
465 *a &= ~mask;
466 raw_local_irq_restore(flags);
467 }
468
469 smp_llsc_mb();
470
471 return res != 0;
472}
473
474/*
475 * test_and_change_bit - Change a bit and return its old value
476 * @nr: Bit to change
477 * @addr: Address to count from
478 *
479 * This operation is atomic and cannot be reordered.
480 * It also implies a memory barrier.
481 */
482static inline int test_and_change_bit(unsigned long nr,
483 volatile unsigned long *addr)
484{
485 unsigned short bit = nr & SZLONG_MASK;
486 unsigned long res;
487
488 smp_llsc_mb();
489
490 if (cpu_has_llsc && R10000_LLSC_WAR) {
491 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
492 unsigned long temp;
493
494 __asm__ __volatile__(
495 " .set mips3 \n"
496 "1: " __LL "%0, %1 # test_and_change_bit \n"
497 " xor %2, %0, %3 \n"
498 " " __SC "%2, %1 \n"
499 " beqzl %2, 1b \n"
500 " and %2, %0, %3 \n"
501 " .set mips0 \n"
502 : "=&r" (temp), "=m" (*m), "=&r" (res)
503 : "r" (1UL << bit), "m" (*m)
504 : "memory");
505 } else if (cpu_has_llsc) {
506 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
507 unsigned long temp;
508
509 __asm__ __volatile__(
510 " .set push \n"
511 " .set noreorder \n"
512 " .set mips3 \n"
513 "1: " __LL "%0, %1 # test_and_change_bit \n"
514 " xor %2, %0, %3 \n"
515 " " __SC "\t%2, %1 \n"
516 " beqz %2, 2f \n"
517 " and %2, %0, %3 \n"
518 " .subsection 2 \n"
519 "2: b 1b \n"
520 " nop \n"
521 " .previous \n"
522 " .set pop \n"
523 : "=&r" (temp), "=m" (*m), "=&r" (res)
524 : "r" (1UL << bit), "m" (*m)
525 : "memory");
526 } else {
527 volatile unsigned long *a = addr;
528 unsigned long mask;
529 unsigned long flags;
530
531 a += nr >> SZLONG_LOG;
532 mask = 1UL << bit;
533 raw_local_irq_save(flags);
534 res = (mask & *a);
535 *a ^= mask;
536 raw_local_irq_restore(flags);
537 }
538
539 smp_llsc_mb();
540
541 return res != 0;
542}
543
544#include <asm-generic/bitops/non-atomic.h>
545
546/*
547 * __clear_bit_unlock - Clears a bit in memory
548 * @nr: Bit to clear
549 * @addr: Address to start counting from
550 *
551 * __clear_bit() is non-atomic and implies release semantics before the memory
552 * operation. It can be used for an unlock if no other CPUs can concurrently
553 * modify other bits in the word.
554 */
555static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
556{
557 smp_mb();
558 __clear_bit(nr, addr);
559}
560
561#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
562
563/*
564 * Return the bit position (0..63) of the most significant 1 bit in a word
565 * Returns -1 if no 1 bit exists
566 */
567static inline unsigned long __fls(unsigned long x)
568{
569 int lz;
570
571 if (sizeof(x) == 4) {
572 __asm__(
573 " .set push \n"
574 " .set mips32 \n"
575 " clz %0, %1 \n"
576 " .set pop \n"
577 : "=r" (lz)
578 : "r" (x));
579
580 return 31 - lz;
581 }
582
583 BUG_ON(sizeof(x) != 8);
584
585 __asm__(
586 " .set push \n"
587 " .set mips64 \n"
588 " dclz %0, %1 \n"
589 " .set pop \n"
590 : "=r" (lz)
591 : "r" (x));
592
593 return 63 - lz;
594}
595
596/*
597 * __ffs - find first bit in word.
598 * @word: The word to search
599 *
600 * Returns 0..SZLONG-1
601 * Undefined if no bit exists, so code should check against 0 first.
602 */
603static inline unsigned long __ffs(unsigned long word)
604{
605 return __fls(word & -word);
606}
607
608/*
609 * fls - find last bit set.
610 * @word: The word to search
611 *
612 * This is defined the same way as ffs.
613 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
614 */
615static inline int fls(int word)
616{
617 __asm__("clz %0, %1" : "=r" (word) : "r" (word));
618
619 return 32 - word;
620}
621
622#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPS64)
623static inline int fls64(__u64 word)
624{
625 __asm__("dclz %0, %1" : "=r" (word) : "r" (word));
626
627 return 64 - word;
628}
629#else
630#include <asm-generic/bitops/fls64.h>
631#endif
632
633/*
634 * ffs - find first bit set.
635 * @word: The word to search
636 *
637 * This is defined the same way as
638 * the libc and compiler builtin ffs routines, therefore
639 * differs in spirit from the above ffz (man ffs).
640 */
641static inline int ffs(int word)
642{
643 if (!word)
644 return 0;
645
646 return fls(word & -word);
647}
648
649#else
650
651#include <asm-generic/bitops/__ffs.h>
652#include <asm-generic/bitops/__fls.h>
653#include <asm-generic/bitops/ffs.h>
654#include <asm-generic/bitops/fls.h>
655#include <asm-generic/bitops/fls64.h>
656
657#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
658
659#include <asm-generic/bitops/ffz.h>
660#include <asm-generic/bitops/find.h>
661
662#ifdef __KERNEL__
663
664#include <asm-generic/bitops/sched.h>
665#include <asm-generic/bitops/hweight.h>
666#include <asm-generic/bitops/ext2-non-atomic.h>
667#include <asm-generic/bitops/ext2-atomic.h>
668#include <asm-generic/bitops/minix.h>
669
670#endif /* __KERNEL__ */
671
672#endif /* _ASM_BITOPS_H */
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
deleted file mode 100644
index 610fe3af7a03..000000000000
--- a/include/asm-mips/bootinfo.h
+++ /dev/null
@@ -1,110 +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) 1995, 1996, 2003 by Ralf Baechle
7 * Copyright (C) 1995, 1996 Andreas Busse
8 * Copyright (C) 1995, 1996 Stoned Elipot
9 * Copyright (C) 1995, 1996 Paul M. Antoine.
10 */
11#ifndef _ASM_BOOTINFO_H
12#define _ASM_BOOTINFO_H
13
14#include <linux/types.h>
15#include <asm/setup.h>
16
17/*
18 * The MACH_ IDs are sort of equivalent to PCI product IDs. As such the
19 * numbers do not necessarily reflect technical relations or similarities
20 * between systems.
21 */
22
23/*
24 * Valid machtype values for group unknown
25 */
26#define MACH_UNKNOWN 0 /* whatever... */
27
28/*
29 * Valid machtype for group DEC
30 */
31#define MACH_DSUNKNOWN 0
32#define MACH_DS23100 1 /* DECstation 2100 or 3100 */
33#define MACH_DS5100 2 /* DECsystem 5100 */
34#define MACH_DS5000_200 3 /* DECstation 5000/200 */
35#define MACH_DS5000_1XX 4 /* DECstation 5000/120, 125, 133, 150 */
36#define MACH_DS5000_XX 5 /* DECstation 5000/20, 25, 33, 50 */
37#define MACH_DS5000_2X0 6 /* DECstation 5000/240, 260 */
38#define MACH_DS5400 7 /* DECsystem 5400 */
39#define MACH_DS5500 8 /* DECsystem 5500 */
40#define MACH_DS5800 9 /* DECsystem 5800 */
41#define MACH_DS5900 10 /* DECsystem 5900 */
42
43/*
44 * Valid machtype for group PMC-MSP
45 */
46#define MACH_MSP4200_EVAL 0 /* PMC-Sierra MSP4200 Evaluation */
47#define MACH_MSP4200_GW 1 /* PMC-Sierra MSP4200 Gateway demo */
48#define MACH_MSP4200_FPGA 2 /* PMC-Sierra MSP4200 Emulation */
49#define MACH_MSP7120_EVAL 3 /* PMC-Sierra MSP7120 Evaluation */
50#define MACH_MSP7120_GW 4 /* PMC-Sierra MSP7120 Residential GW */
51#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */
52#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */
53
54/*
55 * Valid machtype for group Mikrotik
56 */
57#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
58#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
59
60#define CL_SIZE COMMAND_LINE_SIZE
61
62extern char *system_type;
63const char *get_system_type(void);
64
65extern unsigned long mips_machtype;
66
67#define BOOT_MEM_MAP_MAX 32
68#define BOOT_MEM_RAM 1
69#define BOOT_MEM_ROM_DATA 2
70#define BOOT_MEM_RESERVED 3
71
72/*
73 * A memory map that's built upon what was determined
74 * or specified on the command line.
75 */
76struct boot_mem_map {
77 int nr_map;
78 struct boot_mem_map_entry {
79 phys_t addr; /* start of memory segment */
80 phys_t size; /* size of memory segment */
81 long type; /* type of memory segment */
82 } map[BOOT_MEM_MAP_MAX];
83};
84
85extern struct boot_mem_map boot_mem_map;
86
87extern void add_memory_region(phys_t start, phys_t size, long type);
88
89extern void prom_init(void);
90extern void prom_free_prom_memory(void);
91
92extern void free_init_pages(const char *what,
93 unsigned long begin, unsigned long end);
94
95/*
96 * Initial kernel command line, usually setup by prom_init()
97 */
98extern char arcs_cmdline[CL_SIZE];
99
100/*
101 * Registers a0, a1, a3 and a4 as passed to the kernel entry by firmware
102 */
103extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
104
105/*
106 * Platform memory detection hook called by setup_arch
107 */
108extern void plat_mem_setup(void);
109
110#endif /* _ASM_BOOTINFO_H */
diff --git a/include/asm-mips/branch.h b/include/asm-mips/branch.h
deleted file mode 100644
index 37c6857c8d4a..000000000000
--- a/include/asm-mips/branch.h
+++ /dev/null
@@ -1,38 +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) 1996, 1997, 1998, 2001 by Ralf Baechle
7 */
8#ifndef _ASM_BRANCH_H
9#define _ASM_BRANCH_H
10
11#include <asm/ptrace.h>
12
13static inline int delay_slot(struct pt_regs *regs)
14{
15 return regs->cp0_cause & CAUSEF_BD;
16}
17
18static inline unsigned long exception_epc(struct pt_regs *regs)
19{
20 if (!delay_slot(regs))
21 return regs->cp0_epc;
22
23 return regs->cp0_epc + 4;
24}
25
26extern int __compute_return_epc(struct pt_regs *regs);
27
28static inline int compute_return_epc(struct pt_regs *regs)
29{
30 if (!delay_slot(regs)) {
31 regs->cp0_epc += 4;
32 return 0;
33 }
34
35 return __compute_return_epc(regs);
36}
37
38#endif /* _ASM_BRANCH_H */
diff --git a/include/asm-mips/break.h b/include/asm-mips/break.h
deleted file mode 100644
index 25b980c91e7e..000000000000
--- a/include/asm-mips/break.h
+++ /dev/null
@@ -1,34 +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) 1995, 2003 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef __ASM_BREAK_H
10#define __ASM_BREAK_H
11
12/*
13 * The following break codes are or were in use for specific purposes in
14 * other MIPS operating systems. Linux/MIPS doesn't use all of them. The
15 * unused ones are here as placeholders; we might encounter them in
16 * non-Linux/MIPS object files or make use of them in the future.
17 */
18#define BRK_USERBP 0 /* User bp (used by debuggers) */
19#define BRK_KERNELBP 1 /* Break in the kernel */
20#define BRK_ABORT 2 /* Sometimes used by abort(3) to SIGIOT */
21#define BRK_BD_TAKEN 3 /* For bd slot emulation - not implemented */
22#define BRK_BD_NOTTAKEN 4 /* For bd slot emulation - not implemented */
23#define BRK_SSTEPBP 5 /* User bp (used by debuggers) */
24#define BRK_OVERFLOW 6 /* Overflow check */
25#define BRK_DIVZERO 7 /* Divide by zero check */
26#define BRK_RANGE 8 /* Range error check */
27#define BRK_STACKOVERFLOW 9 /* For Ada stackchecking */
28#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
29#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_KDB 513 /* Used in KDB_ENTER() */
32#define BRK_MULOVF 1023 /* Multiply overflow */
33
34#endif /* __ASM_BREAK_H */
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
deleted file mode 100644
index 7eb63de808bc..000000000000
--- a/include/asm-mips/bug.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef __ASM_BUG_H
2#define __ASM_BUG_H
3
4#include <asm/sgidefs.h>
5
6#ifdef CONFIG_BUG
7
8#include <asm/break.h>
9
10#define BUG() \
11do { \
12 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \
13} while (0)
14
15#define HAVE_ARCH_BUG
16
17#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
18
19#define BUG_ON(condition) \
20do { \
21 __asm__ __volatile__("tne $0, %0, %1" \
22 : : "r" (condition), "i" (BRK_BUG)); \
23} while (0)
24
25#define HAVE_ARCH_BUG_ON
26
27#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
28
29#endif
30
31#include <asm-generic/bug.h>
32
33#endif /* __ASM_BUG_H */
diff --git a/include/asm-mips/bugs.h b/include/asm-mips/bugs.h
deleted file mode 100644
index 9dc10df32078..000000000000
--- a/include/asm-mips/bugs.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * This is included by init/main.c to check for architecture-dependent bugs.
3 *
4 * Copyright (C) 2007 Maciej W. Rozycki
5 *
6 * Needs:
7 * void check_bugs(void);
8 */
9#ifndef _ASM_BUGS_H
10#define _ASM_BUGS_H
11
12#include <linux/bug.h>
13#include <linux/delay.h>
14
15#include <asm/cpu.h>
16#include <asm/cpu-info.h>
17
18extern int daddiu_bug;
19
20extern void check_bugs64_early(void);
21
22extern void check_bugs32(void);
23extern void check_bugs64(void);
24
25static inline void check_bugs_early(void)
26{
27#ifdef CONFIG_64BIT
28 check_bugs64_early();
29#endif
30}
31
32static inline void check_bugs(void)
33{
34 unsigned int cpu = smp_processor_id();
35
36 cpu_data[cpu].udelay_val = loops_per_jiffy;
37 check_bugs32();
38#ifdef CONFIG_64BIT
39 check_bugs64();
40#endif
41}
42
43static inline int r4k_daddiu_bug(void)
44{
45#ifdef CONFIG_64BIT
46 WARN_ON(daddiu_bug < 0);
47 return daddiu_bug != 0;
48#else
49 return 0;
50#endif
51}
52
53#endif /* _ASM_BUGS_H */
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h
deleted file mode 100644
index fe7dc2d59b69..000000000000
--- a/include/asm-mips/byteorder.h
+++ /dev/null
@@ -1,76 +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) 1996, 99, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_BYTEORDER_H
9#define _ASM_BYTEORDER_H
10
11#include <linux/compiler.h>
12#include <asm/types.h>
13
14#ifdef __GNUC__
15
16#ifdef CONFIG_CPU_MIPSR2
17
18static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
19{
20 __asm__(
21 " wsbh %0, %1 \n"
22 : "=r" (x)
23 : "r" (x));
24
25 return x;
26}
27#define __arch__swab16(x) ___arch__swab16(x)
28
29static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
30{
31 __asm__(
32 " wsbh %0, %1 \n"
33 " rotr %0, %0, 16 \n"
34 : "=r" (x)
35 : "r" (x));
36
37 return x;
38}
39#define __arch__swab32(x) ___arch__swab32(x)
40
41#ifdef CONFIG_CPU_MIPS64_R2
42
43static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
44{
45 __asm__(
46 " dsbh %0, %1 \n"
47 " dshd %0, %0 \n"
48 " drotr %0, %0, 32 \n"
49 : "=r" (x)
50 : "r" (x));
51
52 return x;
53}
54
55#define __arch__swab64(x) ___arch__swab64(x)
56
57#endif /* CONFIG_CPU_MIPS64_R2 */
58
59#endif /* CONFIG_CPU_MIPSR2 */
60
61#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
62# define __BYTEORDER_HAS_U64__
63# define __SWAB_64_THRU_32__
64#endif
65
66#endif /* __GNUC__ */
67
68#if defined(__MIPSEB__)
69# include <linux/byteorder/big_endian.h>
70#elif defined(__MIPSEL__)
71# include <linux/byteorder/little_endian.h>
72#else
73# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
74#endif
75
76#endif /* _ASM_BYTEORDER_H */
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
deleted file mode 100644
index 37f175c42bb5..000000000000
--- a/include/asm-mips/cache.h
+++ /dev/null
@@ -1,20 +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) 1997, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CACHE_H
10#define _ASM_CACHE_H
11
12#include <kmalloc.h>
13
14#define L1_CACHE_SHIFT CONFIG_MIPS_L1_CACHE_SHIFT
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#define SMP_CACHE_SHIFT L1_CACHE_SHIFT
18#define SMP_CACHE_BYTES L1_CACHE_BYTES
19
20#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mips/cachectl.h b/include/asm-mips/cachectl.h
deleted file mode 100644
index f3ce721861d3..000000000000
--- a/include/asm-mips/cachectl.h
+++ /dev/null
@@ -1,26 +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) 1994, 1995, 1996 by Ralf Baechle
7 */
8#ifndef _ASM_CACHECTL
9#define _ASM_CACHECTL
10
11/*
12 * Options for cacheflush system call
13 */
14#define ICACHE (1<<0) /* flush instruction cache */
15#define DCACHE (1<<1) /* writeback and flush data cache */
16#define BCACHE (ICACHE|DCACHE) /* flush both caches */
17
18/*
19 * Caching modes for the cachectl(2) call
20 *
21 * cachectl(2) is currently not supported and returns ENOSYS.
22 */
23#define CACHEABLE 0 /* make pages cacheable */
24#define UNCACHEABLE 1 /* make pages uncacheable */
25
26#endif /* _ASM_CACHECTL */
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
deleted file mode 100644
index 03b1d69b142f..000000000000
--- a/include/asm-mips/cacheflush.h
+++ /dev/null
@@ -1,116 +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) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CACHEFLUSH_H
10#define _ASM_CACHEFLUSH_H
11
12/* Keep includes the same across arches. */
13#include <linux/mm.h>
14#include <asm/cpu-features.h>
15
16/* Cache flushing:
17 *
18 * - flush_cache_all() flushes entire cache
19 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
20 * - flush_cache_dup mm(mm) handles cache flushing when forking
21 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
22 * - flush_cache_range(vma, start, end) flushes a range of pages
23 * - flush_icache_range(start, end) flush a range of instructions
24 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
25 *
26 * MIPS specific flush operations:
27 *
28 * - flush_cache_sigtramp() flush signal trampoline
29 * - flush_icache_all() flush the entire instruction cache
30 * - flush_data_cache_page() flushes a page from the data cache
31 */
32extern void (*flush_cache_all)(void);
33extern void (*__flush_cache_all)(void);
34extern void (*flush_cache_mm)(struct mm_struct *mm);
35#define flush_cache_dup_mm(mm) do { (void) (mm); } while (0)
36extern void (*flush_cache_range)(struct vm_area_struct *vma,
37 unsigned long start, unsigned long end);
38extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
39extern void __flush_dcache_page(struct page *page);
40
41static inline void flush_dcache_page(struct page *page)
42{
43 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc)
44 __flush_dcache_page(page);
45
46}
47
48#define flush_dcache_mmap_lock(mapping) do { } while (0)
49#define flush_dcache_mmap_unlock(mapping) do { } while (0)
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
60static inline void flush_icache_page(struct vm_area_struct *vma,
61 struct page *page)
62{
63}
64
65extern void (*flush_icache_range)(unsigned long start, unsigned long end);
66extern void (*local_flush_icache_range)(unsigned long start, unsigned long end);
67
68extern void (*__flush_cache_vmap)(void);
69
70static inline void flush_cache_vmap(unsigned long start, unsigned long end)
71{
72 if (cpu_has_dc_aliases)
73 __flush_cache_vmap();
74}
75
76extern void (*__flush_cache_vunmap)(void);
77
78static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
79{
80 if (cpu_has_dc_aliases)
81 __flush_cache_vunmap();
82}
83
84extern void copy_to_user_page(struct vm_area_struct *vma,
85 struct page *page, unsigned long vaddr, void *dst, const void *src,
86 unsigned long len);
87
88extern void copy_from_user_page(struct vm_area_struct *vma,
89 struct page *page, unsigned long vaddr, void *dst, const void *src,
90 unsigned long len);
91
92extern void (*flush_cache_sigtramp)(unsigned long addr);
93extern void (*flush_icache_all)(void);
94extern void (*local_flush_data_cache_page)(void * addr);
95extern void (*flush_data_cache_page)(unsigned long addr);
96
97/*
98 * This flag is used to indicate that the page pointed to by a pte
99 * is dirty and requires cleaning before returning it to the user.
100 */
101#define PG_dcache_dirty PG_arch_1
102
103#define Page_dcache_dirty(page) \
104 test_bit(PG_dcache_dirty, &(page)->flags)
105#define SetPageDcacheDirty(page) \
106 set_bit(PG_dcache_dirty, &(page)->flags)
107#define ClearPageDcacheDirty(page) \
108 clear_bit(PG_dcache_dirty, &(page)->flags)
109
110/* Run kernel code uncached, useful for cache probing functions. */
111unsigned long run_uncached(void *func);
112
113extern void *kmap_coherent(struct page *page, unsigned long addr);
114extern void kunmap_coherent(void);
115
116#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/cacheops.h b/include/asm-mips/cacheops.h
deleted file mode 100644
index 256ad2cc6eb8..000000000000
--- a/include/asm-mips/cacheops.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Cache operations for the cache instruction.
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 * (C) Copyright 1996, 97, 99, 2002, 03 Ralf Baechle
9 * (C) Copyright 1999 Silicon Graphics, Inc.
10 */
11#ifndef __ASM_CACHEOPS_H
12#define __ASM_CACHEOPS_H
13
14/*
15 * Cache Operations available on all MIPS processors with R4000-style caches
16 */
17#define Index_Invalidate_I 0x00
18#define Index_Writeback_Inv_D 0x01
19#define Index_Load_Tag_I 0x04
20#define Index_Load_Tag_D 0x05
21#define Index_Store_Tag_I 0x08
22#define Index_Store_Tag_D 0x09
23#if defined(CONFIG_CPU_LOONGSON2)
24#define Hit_Invalidate_I 0x00
25#else
26#define Hit_Invalidate_I 0x10
27#endif
28#define Hit_Invalidate_D 0x11
29#define Hit_Writeback_Inv_D 0x15
30
31/*
32 * R4000-specific cacheops
33 */
34#define Create_Dirty_Excl_D 0x0d
35#define Fill 0x14
36#define Hit_Writeback_I 0x18
37#define Hit_Writeback_D 0x19
38
39/*
40 * R4000SC and R4400SC-specific cacheops
41 */
42#define Index_Invalidate_SI 0x02
43#define Index_Writeback_Inv_SD 0x03
44#define Index_Load_Tag_SI 0x06
45#define Index_Load_Tag_SD 0x07
46#define Index_Store_Tag_SI 0x0A
47#define Index_Store_Tag_SD 0x0B
48#define Create_Dirty_Excl_SD 0x0f
49#define Hit_Invalidate_SI 0x12
50#define Hit_Invalidate_SD 0x13
51#define Hit_Writeback_Inv_SD 0x17
52#define Hit_Writeback_SD 0x1b
53#define Hit_Set_Virtual_SI 0x1e
54#define Hit_Set_Virtual_SD 0x1f
55
56/*
57 * R5000-specific cacheops
58 */
59#define R5K_Page_Invalidate_S 0x17
60
61/*
62 * RM7000-specific cacheops
63 */
64#define Page_Invalidate_T 0x16
65
66/*
67 * R10000-specific cacheops
68 *
69 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
70 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
71 */
72#define Index_Writeback_Inv_S 0x03
73#define Index_Load_Tag_S 0x07
74#define Index_Store_Tag_S 0x0B
75#define Hit_Invalidate_S 0x13
76#define Cache_Barrier 0x14
77#define Hit_Writeback_Inv_S 0x17
78#define Index_Load_Data_I 0x18
79#define Index_Load_Data_D 0x19
80#define Index_Load_Data_S 0x1b
81#define Index_Store_Data_I 0x1c
82#define Index_Store_Data_D 0x1d
83#define Index_Store_Data_S 0x1f
84
85#endif /* __ASM_CACHEOPS_H */
diff --git a/include/asm-mips/cevt-r4k.h b/include/asm-mips/cevt-r4k.h
deleted file mode 100644
index fa4328f9124f..000000000000
--- a/include/asm-mips/cevt-r4k.h
+++ /dev/null
@@ -1,46 +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) 2008 Kevin D. Kissell
7 */
8
9/*
10 * Definitions used for common event timer implementation
11 * for MIPS 4K-type processors and their MIPS MT variants.
12 * Avoids unsightly extern declarations in C files.
13 */
14#ifndef __ASM_CEVT_R4K_H
15#define __ASM_CEVT_R4K_H
16
17DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
18
19void mips_event_handler(struct clock_event_device *dev);
20int c0_compare_int_usable(void);
21void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
22irqreturn_t c0_compare_interrupt(int, void *);
23
24extern struct irqaction c0_compare_irqaction;
25extern int cp0_timer_irq_installed;
26
27/*
28 * Possibly handle a performance counter interrupt.
29 * Return true if the timer interrupt should not be checked
30 */
31
32static inline int handle_perf_irq(int r2)
33{
34 /*
35 * The performance counter overflow interrupt may be shared with the
36 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
37 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
38 * and we can't reliably determine if a counter interrupt has also
39 * happened (!r2) then don't check for a timer interrupt.
40 */
41 return (cp0_perfcount_irq < 0) &&
42 perf_irq() == IRQ_HANDLED &&
43 !r2;
44}
45
46#endif /* __ASM_CEVT_R4K_H */
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
deleted file mode 100644
index 290485ac5407..000000000000
--- a/include/asm-mips/checksum.h
+++ /dev/null
@@ -1,260 +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) 1995, 96, 97, 98, 99, 2001 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 Thiemo Seufer.
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_CHECKSUM_H
12#define _ASM_CHECKSUM_H
13
14#include <linux/in6.h>
15
16#include <asm/uaccess.h>
17
18/*
19 * computes the checksum of a memory block at buff, length len,
20 * and adds in "sum" (32-bit)
21 *
22 * returns a 32-bit number suitable for feeding into itself
23 * or csum_tcpudp_magic
24 *
25 * this function must be called with even lengths, except
26 * for the last fragment, which may be odd
27 *
28 * it's best to have buff aligned on a 32-bit boundary
29 */
30__wsum csum_partial(const void *buff, int len, __wsum sum);
31
32__wsum __csum_partial_copy_user(const void *src, void *dst,
33 int len, __wsum sum, int *err_ptr);
34
35/*
36 * this is a new version of the above that records errors it finds in *errp,
37 * but continues and zeros the rest of the buffer.
38 */
39static inline
40__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len,
41 __wsum sum, int *err_ptr)
42{
43 might_sleep();
44 return __csum_partial_copy_user((__force void *)src, dst,
45 len, sum, err_ptr);
46}
47
48/*
49 * Copy and checksum to user
50 */
51#define HAVE_CSUM_COPY_USER
52static inline
53__wsum csum_and_copy_to_user(const void *src, void __user *dst, int len,
54 __wsum sum, int *err_ptr)
55{
56 might_sleep();
57 if (access_ok(VERIFY_WRITE, dst, len))
58 return __csum_partial_copy_user(src, (__force void *)dst,
59 len, sum, err_ptr);
60 if (len)
61 *err_ptr = -EFAULT;
62
63 return (__force __wsum)-1; /* invalid checksum */
64}
65
66/*
67 * the same as csum_partial, but copies from user space (but on MIPS
68 * we have just one address space, so this is identical to the above)
69 */
70__wsum csum_partial_copy_nocheck(const void *src, void *dst,
71 int len, __wsum sum);
72
73/*
74 * Fold a partial checksum without adding pseudo headers
75 */
76static inline __sum16 csum_fold(__wsum sum)
77{
78 __asm__(
79 " .set push # csum_fold\n"
80 " .set noat \n"
81 " sll $1, %0, 16 \n"
82 " addu %0, $1 \n"
83 " sltu $1, %0, $1 \n"
84 " srl %0, %0, 16 \n"
85 " addu %0, $1 \n"
86 " xori %0, 0xffff \n"
87 " .set pop"
88 : "=r" (sum)
89 : "0" (sum));
90
91 return (__force __sum16)sum;
92}
93
94/*
95 * This is a version of ip_compute_csum() optimized for IP headers,
96 * which always checksum on 4 octet boundaries.
97 *
98 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
99 * Arnt Gulbrandsen.
100 */
101static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
102{
103 const unsigned int *word = iph;
104 const unsigned int *stop = word + ihl;
105 unsigned int csum;
106 int carry;
107
108 csum = word[0];
109 csum += word[1];
110 carry = (csum < word[1]);
111 csum += carry;
112
113 csum += word[2];
114 carry = (csum < word[2]);
115 csum += carry;
116
117 csum += word[3];
118 carry = (csum < word[3]);
119 csum += carry;
120
121 word += 4;
122 do {
123 csum += *word;
124 carry = (csum < *word);
125 csum += carry;
126 word++;
127 } while (word != stop);
128
129 return csum_fold(csum);
130}
131
132static inline __wsum csum_tcpudp_nofold(__be32 saddr,
133 __be32 daddr, unsigned short len, unsigned short proto,
134 __wsum sum)
135{
136 __asm__(
137 " .set push # csum_tcpudp_nofold\n"
138 " .set noat \n"
139#ifdef CONFIG_32BIT
140 " addu %0, %2 \n"
141 " sltu $1, %0, %2 \n"
142 " addu %0, $1 \n"
143
144 " addu %0, %3 \n"
145 " sltu $1, %0, %3 \n"
146 " addu %0, $1 \n"
147
148 " addu %0, %4 \n"
149 " sltu $1, %0, %4 \n"
150 " addu %0, $1 \n"
151#endif
152#ifdef CONFIG_64BIT
153 " daddu %0, %2 \n"
154 " daddu %0, %3 \n"
155 " daddu %0, %4 \n"
156 " dsll32 $1, %0, 0 \n"
157 " daddu %0, $1 \n"
158 " dsra32 %0, %0, 0 \n"
159#endif
160 " .set pop"
161 : "=r" (sum)
162 : "0" ((__force unsigned long)daddr),
163 "r" ((__force unsigned long)saddr),
164#ifdef __MIPSEL__
165 "r" ((proto + len) << 8),
166#else
167 "r" (proto + len),
168#endif
169 "r" ((__force unsigned long)sum));
170
171 return sum;
172}
173
174/*
175 * computes the checksum of the TCP/UDP pseudo-header
176 * returns a 16-bit checksum, already complemented
177 */
178static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
179 unsigned short len,
180 unsigned short proto,
181 __wsum sum)
182{
183 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
184}
185
186/*
187 * this routine is used for miscellaneous IP-like checksums, mainly
188 * in icmp.c
189 */
190static inline __sum16 ip_compute_csum(const void *buff, int len)
191{
192 return csum_fold(csum_partial(buff, len, 0));
193}
194
195#define _HAVE_ARCH_IPV6_CSUM
196static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
197 const struct in6_addr *daddr,
198 __u32 len, unsigned short proto,
199 __wsum sum)
200{
201 __asm__(
202 " .set push # csum_ipv6_magic\n"
203 " .set noreorder \n"
204 " .set noat \n"
205 " addu %0, %5 # proto (long in network byte order)\n"
206 " sltu $1, %0, %5 \n"
207 " addu %0, $1 \n"
208
209 " addu %0, %6 # csum\n"
210 " sltu $1, %0, %6 \n"
211 " lw %1, 0(%2) # four words source address\n"
212 " addu %0, $1 \n"
213 " addu %0, %1 \n"
214 " sltu $1, %0, %1 \n"
215
216 " lw %1, 4(%2) \n"
217 " addu %0, $1 \n"
218 " addu %0, %1 \n"
219 " sltu $1, %0, %1 \n"
220
221 " lw %1, 8(%2) \n"
222 " addu %0, $1 \n"
223 " addu %0, %1 \n"
224 " sltu $1, %0, %1 \n"
225
226 " lw %1, 12(%2) \n"
227 " addu %0, $1 \n"
228 " addu %0, %1 \n"
229 " sltu $1, %0, %1 \n"
230
231 " lw %1, 0(%3) \n"
232 " addu %0, $1 \n"
233 " addu %0, %1 \n"
234 " sltu $1, %0, %1 \n"
235
236 " lw %1, 4(%3) \n"
237 " addu %0, $1 \n"
238 " addu %0, %1 \n"
239 " sltu $1, %0, %1 \n"
240
241 " lw %1, 8(%3) \n"
242 " addu %0, $1 \n"
243 " addu %0, %1 \n"
244 " sltu $1, %0, %1 \n"
245
246 " lw %1, 12(%3) \n"
247 " addu %0, $1 \n"
248 " addu %0, %1 \n"
249 " sltu $1, %0, %1 \n"
250
251 " addu %0, $1 # Add final carry\n"
252 " .set pop"
253 : "=r" (sum), "=r" (proto)
254 : "r" (saddr), "r" (daddr),
255 "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
256
257 return csum_fold(sum);
258}
259
260#endif /* _ASM_CHECKSUM_H */
diff --git a/include/asm-mips/cmp.h b/include/asm-mips/cmp.h
deleted file mode 100644
index 89a73fb93ae6..000000000000
--- a/include/asm-mips/cmp.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_CMP_H
2#define _ASM_CMP_H
3
4/*
5 * Definitions for CMP multitasking on MIPS cores
6 */
7struct task_struct;
8
9extern void cmp_smp_setup(void);
10extern void cmp_smp_finish(void);
11extern void cmp_boot_secondary(int cpu, struct task_struct *t);
12extern void cmp_init_secondary(void);
13extern void cmp_cpus_done(void);
14extern void cmp_prepare_cpus(unsigned int max_cpus);
15
16/* This is platform specific */
17extern void cmp_send_ipi(int cpu, unsigned int action);
18#endif /* _ASM_CMP_H */
diff --git a/include/asm-mips/cmpxchg.h b/include/asm-mips/cmpxchg.h
deleted file mode 100644
index 4a812c3ceb90..000000000000
--- a/include/asm-mips/cmpxchg.h
+++ /dev/null
@@ -1,124 +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, 07 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_CMPXCHG_H
9#define __ASM_CMPXCHG_H
10
11#include <linux/irqflags.h>
12
13#define __HAVE_ARCH_CMPXCHG 1
14
15#define __cmpxchg_asm(ld, st, m, old, new) \
16({ \
17 __typeof(*(m)) __ret; \
18 \
19 if (cpu_has_llsc && R10000_LLSC_WAR) { \
20 __asm__ __volatile__( \
21 " .set push \n" \
22 " .set noat \n" \
23 " .set mips3 \n" \
24 "1: " ld " %0, %2 # __cmpxchg_asm \n" \
25 " bne %0, %z3, 2f \n" \
26 " .set mips0 \n" \
27 " move $1, %z4 \n" \
28 " .set mips3 \n" \
29 " " st " $1, %1 \n" \
30 " beqzl $1, 1b \n" \
31 "2: \n" \
32 " .set pop \n" \
33 : "=&r" (__ret), "=R" (*m) \
34 : "R" (*m), "Jr" (old), "Jr" (new) \
35 : "memory"); \
36 } else if (cpu_has_llsc) { \
37 __asm__ __volatile__( \
38 " .set push \n" \
39 " .set noat \n" \
40 " .set mips3 \n" \
41 "1: " ld " %0, %2 # __cmpxchg_asm \n" \
42 " bne %0, %z3, 2f \n" \
43 " .set mips0 \n" \
44 " move $1, %z4 \n" \
45 " .set mips3 \n" \
46 " " st " $1, %1 \n" \
47 " beqz $1, 3f \n" \
48 "2: \n" \
49 " .subsection 2 \n" \
50 "3: b 1b \n" \
51 " .previous \n" \
52 " .set pop \n" \
53 : "=&r" (__ret), "=R" (*m) \
54 : "R" (*m), "Jr" (old), "Jr" (new) \
55 : "memory"); \
56 } else { \
57 unsigned long __flags; \
58 \
59 raw_local_irq_save(__flags); \
60 __ret = *m; \
61 if (__ret == old) \
62 *m = new; \
63 raw_local_irq_restore(__flags); \
64 } \
65 \
66 __ret; \
67})
68
69/*
70 * This function doesn't exist, so you'll get a linker error
71 * if something tries to do an invalid cmpxchg().
72 */
73extern void __cmpxchg_called_with_bad_pointer(void);
74
75#define __cmpxchg(ptr, old, new, barrier) \
76({ \
77 __typeof__(ptr) __ptr = (ptr); \
78 __typeof__(*(ptr)) __old = (old); \
79 __typeof__(*(ptr)) __new = (new); \
80 __typeof__(*(ptr)) __res = 0; \
81 \
82 barrier; \
83 \
84 switch (sizeof(*(__ptr))) { \
85 case 4: \
86 __res = __cmpxchg_asm("ll", "sc", __ptr, __old, __new); \
87 break; \
88 case 8: \
89 if (sizeof(long) == 8) { \
90 __res = __cmpxchg_asm("lld", "scd", __ptr, \
91 __old, __new); \
92 break; \
93 } \
94 default: \
95 __cmpxchg_called_with_bad_pointer(); \
96 break; \
97 } \
98 \
99 barrier; \
100 \
101 __res; \
102})
103
104#define cmpxchg(ptr, old, new) __cmpxchg(ptr, old, new, smp_llsc_mb())
105#define cmpxchg_local(ptr, old, new) __cmpxchg(ptr, old, new, )
106
107#define cmpxchg64(ptr, o, n) \
108 ({ \
109 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
110 cmpxchg((ptr), (o), (n)); \
111 })
112
113#ifdef CONFIG_64BIT
114#define cmpxchg64_local(ptr, o, n) \
115 ({ \
116 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
117 cmpxchg_local((ptr), (o), (n)); \
118 })
119#else
120#include <asm-generic/cmpxchg-local.h>
121#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
122#endif
123
124#endif /* __ASM_CMPXCHG_H */
diff --git a/include/asm-mips/compat-signal.h b/include/asm-mips/compat-signal.h
deleted file mode 100644
index 368a99e5c3e1..000000000000
--- a/include/asm-mips/compat-signal.h
+++ /dev/null
@@ -1,119 +0,0 @@
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
13#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14
15typedef struct compat_siginfo {
16 int si_signo;
17 int si_code;
18 int si_errno;
19
20 union {
21 int _pad[SI_PAD_SIZE32];
22
23 /* kill() */
24 struct {
25 compat_pid_t _pid; /* sender's pid */
26 compat_uid_t _uid; /* sender's uid */
27 } _kill;
28
29 /* SIGCHLD */
30 struct {
31 compat_pid_t _pid; /* which child */
32 compat_uid_t _uid; /* sender's uid */
33 int _status; /* exit code */
34 compat_clock_t _utime;
35 compat_clock_t _stime;
36 } _sigchld;
37
38 /* IRIX SIGCHLD */
39 struct {
40 compat_pid_t _pid; /* which child */
41 compat_clock_t _utime;
42 int _status; /* exit code */
43 compat_clock_t _stime;
44 } _irix_sigchld;
45
46 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
47 struct {
48 s32 _addr; /* faulting insn/memory ref. */
49 } _sigfault;
50
51 /* SIGPOLL, SIGXFSZ (To do ...) */
52 struct {
53 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
54 int _fd;
55 } _sigpoll;
56
57 /* POSIX.1b timers */
58 struct {
59 timer_t _tid; /* timer id */
60 int _overrun; /* overrun count */
61 compat_sigval_t _sigval;/* same as below */
62 int _sys_private; /* not to be passed to user */
63 } _timer;
64
65 /* POSIX.1b signals */
66 struct {
67 compat_pid_t _pid; /* sender's pid */
68 compat_uid_t _uid; /* sender's uid */
69 compat_sigval_t _sigval;
70 } _rt;
71
72 } _sifields;
73} compat_siginfo_t;
74
75static inline int __copy_conv_sigset_to_user(compat_sigset_t __user *d,
76 const sigset_t *s)
77{
78 int err;
79
80 BUG_ON(sizeof(*d) != sizeof(*s));
81 BUG_ON(_NSIG_WORDS != 2);
82
83 err = __put_user(s->sig[0], &d->sig[0]);
84 err |= __put_user(s->sig[0] >> 32, &d->sig[1]);
85 err |= __put_user(s->sig[1], &d->sig[2]);
86 err |= __put_user(s->sig[1] >> 32, &d->sig[3]);
87
88 return err;
89}
90
91static inline int __copy_conv_sigset_from_user(sigset_t *d,
92 const compat_sigset_t __user *s)
93{
94 int err;
95 union sigset_u {
96 sigset_t s;
97 compat_sigset_t c;
98 } *u = (union sigset_u *) d;
99
100 BUG_ON(sizeof(*d) != sizeof(*s));
101 BUG_ON(_NSIG_WORDS != 2);
102
103#ifdef CONFIG_CPU_BIG_ENDIAN
104 err = __get_user(u->c.sig[1], &s->sig[0]);
105 err |= __get_user(u->c.sig[0], &s->sig[1]);
106 err |= __get_user(u->c.sig[3], &s->sig[2]);
107 err |= __get_user(u->c.sig[2], &s->sig[3]);
108#endif
109#ifdef CONFIG_CPU_LITTLE_ENDIAN
110 err = __get_user(u->c.sig[0], &s->sig[0]);
111 err |= __get_user(u->c.sig[1], &s->sig[1]);
112 err |= __get_user(u->c.sig[2], &s->sig[2]);
113 err |= __get_user(u->c.sig[3], &s->sig[3]);
114#endif
115
116 return err;
117}
118
119#endif /* __ASM_COMPAT_SIGNAL_H */
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
deleted file mode 100644
index ac5d541368e9..000000000000
--- a/include/asm-mips/compat.h
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifndef _ASM_COMPAT_H
2#define _ASM_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <asm/page.h>
8#include <asm/ptrace.h>
9
10#define COMPAT_USER_HZ 100
11
12typedef u32 compat_size_t;
13typedef s32 compat_ssize_t;
14typedef s32 compat_time_t;
15typedef s32 compat_clock_t;
16typedef s32 compat_suseconds_t;
17
18typedef s32 compat_pid_t;
19typedef s32 __compat_uid_t;
20typedef s32 __compat_gid_t;
21typedef __compat_uid_t __compat_uid32_t;
22typedef __compat_gid_t __compat_gid32_t;
23typedef u32 compat_mode_t;
24typedef u32 compat_ino_t;
25typedef u32 compat_dev_t;
26typedef s32 compat_off_t;
27typedef s64 compat_loff_t;
28typedef u32 compat_nlink_t;
29typedef s32 compat_ipc_pid_t;
30typedef s32 compat_daddr_t;
31typedef s32 compat_caddr_t;
32typedef struct {
33 s32 val[2];
34} compat_fsid_t;
35typedef s32 compat_timer_t;
36typedef s32 compat_key_t;
37
38typedef s32 compat_int_t;
39typedef s32 compat_long_t;
40typedef s64 compat_s64;
41typedef u32 compat_uint_t;
42typedef u32 compat_ulong_t;
43typedef u64 compat_u64;
44
45struct compat_timespec {
46 compat_time_t tv_sec;
47 s32 tv_nsec;
48};
49
50struct compat_timeval {
51 compat_time_t tv_sec;
52 s32 tv_usec;
53};
54
55struct compat_stat {
56 compat_dev_t st_dev;
57 s32 st_pad1[3];
58 compat_ino_t st_ino;
59 compat_mode_t st_mode;
60 compat_nlink_t st_nlink;
61 __compat_uid_t st_uid;
62 __compat_gid_t st_gid;
63 compat_dev_t st_rdev;
64 s32 st_pad2[2];
65 compat_off_t st_size;
66 s32 st_pad3;
67 compat_time_t st_atime;
68 s32 st_atime_nsec;
69 compat_time_t st_mtime;
70 s32 st_mtime_nsec;
71 compat_time_t st_ctime;
72 s32 st_ctime_nsec;
73 s32 st_blksize;
74 s32 st_blocks;
75 s32 st_pad4[14];
76};
77
78struct compat_flock {
79 short l_type;
80 short l_whence;
81 compat_off_t l_start;
82 compat_off_t l_len;
83 s32 l_sysid;
84 compat_pid_t l_pid;
85 short __unused;
86 s32 pad[4];
87};
88
89#define F_GETLK64 33
90#define F_SETLK64 34
91#define F_SETLKW64 35
92
93struct compat_flock64 {
94 short l_type;
95 short l_whence;
96 compat_loff_t l_start;
97 compat_loff_t l_len;
98 compat_pid_t l_pid;
99};
100
101struct compat_statfs {
102 int f_type;
103 int f_bsize;
104 int f_frsize;
105 int f_blocks;
106 int f_bfree;
107 int f_files;
108 int f_ffree;
109 int f_bavail;
110 compat_fsid_t f_fsid;
111 int f_namelen;
112 int f_spare[6];
113};
114
115#define COMPAT_RLIM_INFINITY 0x7fffffffUL
116
117typedef u32 compat_old_sigset_t; /* at least 32 bits */
118
119#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
120#define _COMPAT_NSIG_BPW 32
121
122typedef u32 compat_sigset_word;
123
124#define COMPAT_OFF_T_MAX 0x7fffffff
125#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
126
127/*
128 * A pointer passed in from user mode. This should not
129 * be used for syscall parameters, just declare them
130 * as pointers because the syscall entry code will have
131 * appropriately converted them already.
132 */
133typedef u32 compat_uptr_t;
134
135static inline void __user *compat_ptr(compat_uptr_t uptr)
136{
137 /* cast to a __user pointer via "unsigned long" makes sparse happy */
138 return (void __user *)(unsigned long)(long)uptr;
139}
140
141static inline compat_uptr_t ptr_to_compat(void __user *uptr)
142{
143 return (u32)(unsigned long)uptr;
144}
145
146static inline void __user *compat_alloc_user_space(long len)
147{
148 struct pt_regs *regs = (struct pt_regs *)
149 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
150
151 return (void __user *) (regs->regs[29] - len);
152}
153
154struct compat_ipc64_perm {
155 compat_key_t key;
156 __compat_uid32_t uid;
157 __compat_gid32_t gid;
158 __compat_uid32_t cuid;
159 __compat_gid32_t cgid;
160 compat_mode_t mode;
161 unsigned short seq;
162 unsigned short __pad2;
163 compat_ulong_t __unused1;
164 compat_ulong_t __unused2;
165};
166
167struct compat_semid64_ds {
168 struct compat_ipc64_perm sem_perm;
169 compat_time_t sem_otime;
170 compat_time_t sem_ctime;
171 compat_ulong_t sem_nsems;
172 compat_ulong_t __unused1;
173 compat_ulong_t __unused2;
174};
175
176struct compat_msqid64_ds {
177 struct compat_ipc64_perm msg_perm;
178#ifndef CONFIG_CPU_LITTLE_ENDIAN
179 compat_ulong_t __unused1;
180#endif
181 compat_time_t msg_stime;
182#ifdef CONFIG_CPU_LITTLE_ENDIAN
183 compat_ulong_t __unused1;
184#endif
185#ifndef CONFIG_CPU_LITTLE_ENDIAN
186 compat_ulong_t __unused2;
187#endif
188 compat_time_t msg_rtime;
189#ifdef CONFIG_CPU_LITTLE_ENDIAN
190 compat_ulong_t __unused2;
191#endif
192#ifndef CONFIG_CPU_LITTLE_ENDIAN
193 compat_ulong_t __unused3;
194#endif
195 compat_time_t msg_ctime;
196#ifdef CONFIG_CPU_LITTLE_ENDIAN
197 compat_ulong_t __unused3;
198#endif
199 compat_ulong_t msg_cbytes;
200 compat_ulong_t msg_qnum;
201 compat_ulong_t msg_qbytes;
202 compat_pid_t msg_lspid;
203 compat_pid_t msg_lrpid;
204 compat_ulong_t __unused4;
205 compat_ulong_t __unused5;
206};
207
208struct compat_shmid64_ds {
209 struct compat_ipc64_perm shm_perm;
210 compat_size_t shm_segsz;
211 compat_time_t shm_atime;
212 compat_time_t shm_dtime;
213 compat_time_t shm_ctime;
214 compat_pid_t shm_cpid;
215 compat_pid_t shm_lpid;
216 compat_ulong_t shm_nattch;
217 compat_ulong_t __unused1;
218 compat_ulong_t __unused2;
219};
220
221#endif /* _ASM_COMPAT_H */
diff --git a/include/asm-mips/compiler.h b/include/asm-mips/compiler.h
deleted file mode 100644
index 71f5c5cfc58a..000000000000
--- a/include/asm-mips/compiler.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (C) 2004, 2007 Maciej W. Rozycki
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#ifndef _ASM_COMPILER_H
9#define _ASM_COMPILER_H
10
11#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
12#define GCC_IMM_ASM() "n"
13#define GCC_REG_ACCUM "$0"
14#else
15#define GCC_IMM_ASM() "rn"
16#define GCC_REG_ACCUM "accum"
17#endif
18
19#endif /* _ASM_COMPILER_H */
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
deleted file mode 100644
index 5ea701fc3425..000000000000
--- a/include/asm-mips/cpu-features.h
+++ /dev/null
@@ -1,219 +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, 2004 Ralf Baechle
7 * Copyright (C) 2004 Maciej W. Rozycki
8 */
9#ifndef __ASM_CPU_FEATURES_H
10#define __ASM_CPU_FEATURES_H
11
12#include <asm/cpu.h>
13#include <asm/cpu-info.h>
14#include <cpu-feature-overrides.h>
15
16#ifndef current_cpu_type
17#define current_cpu_type() current_cpu_data.cputype
18#endif
19
20/*
21 * SMP assumption: Options of CPU 0 are a superset of all processors.
22 * This is true for all known MIPS systems.
23 */
24#ifndef cpu_has_tlb
25#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
26#endif
27#ifndef cpu_has_4kex
28#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
29#endif
30#ifndef cpu_has_3k_cache
31#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE)
32#endif
33#define cpu_has_6k_cache 0
34#define cpu_has_8k_cache 0
35#ifndef cpu_has_4k_cache
36#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE)
37#endif
38#ifndef cpu_has_tx39_cache
39#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE)
40#endif
41#ifndef cpu_has_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
46#endif
47#ifndef cpu_has_32fpr
48#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)
49#endif
50#ifndef cpu_has_counter
51#define cpu_has_counter (cpu_data[0].options & MIPS_CPU_COUNTER)
52#endif
53#ifndef cpu_has_watch
54#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH)
55#endif
56#ifndef cpu_has_divec
57#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC)
58#endif
59#ifndef cpu_has_vce
60#define cpu_has_vce (cpu_data[0].options & MIPS_CPU_VCE)
61#endif
62#ifndef cpu_has_cache_cdex_p
63#define cpu_has_cache_cdex_p (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_P)
64#endif
65#ifndef cpu_has_cache_cdex_s
66#define cpu_has_cache_cdex_s (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_S)
67#endif
68#ifndef cpu_has_prefetch
69#define cpu_has_prefetch (cpu_data[0].options & MIPS_CPU_PREFETCH)
70#endif
71#ifndef cpu_has_mcheck
72#define cpu_has_mcheck (cpu_data[0].options & MIPS_CPU_MCHECK)
73#endif
74#ifndef cpu_has_ejtag
75#define cpu_has_ejtag (cpu_data[0].options & MIPS_CPU_EJTAG)
76#endif
77#ifndef cpu_has_llsc
78#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC)
79#endif
80#ifndef cpu_has_mips16
81#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16)
82#endif
83#ifndef cpu_has_mdmx
84#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX)
85#endif
86#ifndef cpu_has_mips3d
87#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D)
88#endif
89#ifndef cpu_has_smartmips
90#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)
91#endif
92#ifndef cpu_has_vtag_icache
93#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
94#endif
95#ifndef cpu_has_dc_aliases
96#define cpu_has_dc_aliases (cpu_data[0].dcache.flags & MIPS_CACHE_ALIASES)
97#endif
98#ifndef cpu_has_ic_fills_f_dc
99#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
100#endif
101#ifndef cpu_has_pindexed_dcache
102#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
103#endif
104
105/*
106 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
107 * such as the R10000 have I-Caches that snoop local stores; the embedded ones
108 * don't. For maintaining I-cache coherency this means we need to flush the
109 * D-cache all the way back to whever the I-cache does refills from, so the
110 * I-cache has a chance to see the new data at all. Then we have to flush the
111 * I-cache also.
112 * Note we may have been rescheduled and may no longer be running on the CPU
113 * that did the store so we can't optimize this into only doing the flush on
114 * the local CPU.
115 */
116#ifndef cpu_icache_snoops_remote_store
117#ifdef CONFIG_SMP
118#define cpu_icache_snoops_remote_store (cpu_data[0].icache.flags & MIPS_IC_SNOOPS_REMOTE)
119#else
120#define cpu_icache_snoops_remote_store 1
121#endif
122#endif
123
124# ifndef cpu_has_mips32r1
125# define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1)
126# endif
127# ifndef cpu_has_mips32r2
128# define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2)
129# endif
130# ifndef cpu_has_mips64r1
131# define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1)
132# endif
133# ifndef cpu_has_mips64r2
134# define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2)
135# endif
136
137/*
138 * Shortcuts ...
139 */
140#define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2)
141#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2)
142#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)
143#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)
144
145#ifndef cpu_has_dsp
146#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
147#endif
148
149#ifndef cpu_has_mipsmt
150#define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT)
151#endif
152
153#ifndef cpu_has_userlocal
154#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI)
155#endif
156
157#ifdef CONFIG_32BIT
158# ifndef cpu_has_nofpuex
159# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)
160# endif
161# ifndef cpu_has_64bits
162# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
163# endif
164# ifndef cpu_has_64bit_zero_reg
165# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
166# endif
167# ifndef cpu_has_64bit_gp_regs
168# define cpu_has_64bit_gp_regs 0
169# endif
170# ifndef cpu_has_64bit_addresses
171# define cpu_has_64bit_addresses 0
172# endif
173#endif
174
175#ifdef CONFIG_64BIT
176# ifndef cpu_has_nofpuex
177# define cpu_has_nofpuex 0
178# endif
179# ifndef cpu_has_64bits
180# define cpu_has_64bits 1
181# endif
182# ifndef cpu_has_64bit_zero_reg
183# define cpu_has_64bit_zero_reg 1
184# endif
185# ifndef cpu_has_64bit_gp_regs
186# define cpu_has_64bit_gp_regs 1
187# endif
188# ifndef cpu_has_64bit_addresses
189# define cpu_has_64bit_addresses 1
190# endif
191#endif
192
193#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)
194# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT)
195#elif !defined(cpu_has_vint)
196# define cpu_has_vint 0
197#endif
198
199#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)
200# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC)
201#elif !defined(cpu_has_veic)
202# define cpu_has_veic 0
203#endif
204
205#ifndef cpu_has_inclusive_pcaches
206#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)
207#endif
208
209#ifndef cpu_dcache_line_size
210#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
211#endif
212#ifndef cpu_icache_line_size
213#define cpu_icache_line_size() cpu_data[0].icache.linesz
214#endif
215#ifndef cpu_scache_line_size
216#define cpu_scache_line_size() cpu_data[0].scache.linesz
217#endif
218
219#endif /* __ASM_CPU_FEATURES_H */
diff --git a/include/asm-mips/cpu-info.h b/include/asm-mips/cpu-info.h
deleted file mode 100644
index 2de73dbb2e9e..000000000000
--- a/include/asm-mips/cpu-info.h
+++ /dev/null
@@ -1,84 +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) 1994 Waldorf GMBH
7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8 * Copyright (C) 1996 Paul M. Antoine
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 * Copyright (C) 2004 Maciej W. Rozycki
11 */
12#ifndef __ASM_CPU_INFO_H
13#define __ASM_CPU_INFO_H
14
15#include <asm/cache.h>
16
17/*
18 * Descriptor for a cache
19 */
20struct cache_desc {
21 unsigned int waysize; /* Bytes per way */
22 unsigned short sets; /* Number of lines per set */
23 unsigned char ways; /* Number of ways */
24 unsigned char linesz; /* Size of line in bytes */
25 unsigned char waybit; /* Bits to select in a cache set */
26 unsigned char flags; /* Flags describing cache properties */
27};
28
29/*
30 * Flag definitions
31 */
32#define MIPS_CACHE_NOT_PRESENT 0x00000001
33#define MIPS_CACHE_VTAG 0x00000002 /* Virtually tagged cache */
34#define MIPS_CACHE_ALIASES 0x00000004 /* Cache could have aliases */
35#define MIPS_CACHE_IC_F_DC 0x00000008 /* Ic can refill from D-cache */
36#define MIPS_IC_SNOOPS_REMOTE 0x00000010 /* Ic snoops remote stores */
37#define MIPS_CACHE_PINDEX 0x00000020 /* Physically indexed cache */
38
39struct cpuinfo_mips {
40 unsigned long udelay_val;
41 unsigned long asid_cache;
42
43 /*
44 * Capability and feature descriptor structure for MIPS CPU
45 */
46 unsigned long options;
47 unsigned long ases;
48 unsigned int processor_id;
49 unsigned int fpu_id;
50 unsigned int cputype;
51 int isa_level;
52 int tlbsize;
53 struct cache_desc icache; /* Primary I-cache */
54 struct cache_desc dcache; /* Primary D or combined I/D cache */
55 struct cache_desc scache; /* Secondary cache */
56 struct cache_desc tcache; /* Tertiary/split secondary cache */
57 int srsets; /* Shadow register sets */
58 int core; /* physical core number */
59#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
60 /*
61 * In the MIPS MT "SMTC" model, each TC is considered
62 * to be a "CPU" for the purposes of scheduling, but
63 * exception resources, ASID spaces, etc, are common
64 * to all TCs within the same VPE.
65 */
66 int vpe_id; /* Virtual Processor number */
67#endif
68#ifdef CONFIG_MIPS_MT_SMTC
69 int tc_id; /* Thread Context number */
70#endif
71 void *data; /* Additional data */
72} __attribute__((aligned(SMP_CACHE_BYTES)));
73
74extern struct cpuinfo_mips cpu_data[];
75#define current_cpu_data cpu_data[smp_processor_id()]
76#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
77
78extern void cpu_probe(void);
79extern void cpu_report(void);
80
81extern const char *__cpu_name[];
82#define cpu_name_string() __cpu_name[smp_processor_id()]
83
84#endif /* __ASM_CPU_INFO_H */
diff --git a/include/asm-mips/cpu.h b/include/asm-mips/cpu.h
deleted file mode 100644
index 229a786101d9..000000000000
--- a/include/asm-mips/cpu.h
+++ /dev/null
@@ -1,267 +0,0 @@
1/*
2 * cpu.h: Values of the PRId register used to match up
3 * various MIPS cpu types.
4 *
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 * Copyright (C) 2004 Maciej W. Rozycki
7 */
8#ifndef _ASM_CPU_H
9#define _ASM_CPU_H
10
11/* Assigned Company values for bits 23:16 of the PRId Register
12 (CP0 register 15, select 0). As of the MIPS32 and MIPS64 specs from
13 MTI, the PRId register is defined in this (backwards compatible)
14 way:
15
16 +----------------+----------------+----------------+----------------+
17 | Company Options| Company ID | Processor ID | Revision |
18 +----------------+----------------+----------------+----------------+
19 31 24 23 16 15 8 7
20
21 I don't have docs for all the previous processors, but my impression is
22 that bits 16-23 have been 0 for all MIPS processors before the MIPS32/64
23 spec.
24*/
25
26#define PRID_COMP_LEGACY 0x000000
27#define PRID_COMP_MIPS 0x010000
28#define PRID_COMP_BROADCOM 0x020000
29#define PRID_COMP_ALCHEMY 0x030000
30#define PRID_COMP_SIBYTE 0x040000
31#define PRID_COMP_SANDCRAFT 0x050000
32#define PRID_COMP_NXP 0x060000
33#define PRID_COMP_TOSHIBA 0x070000
34#define PRID_COMP_LSI 0x080000
35#define PRID_COMP_LEXRA 0x0b0000
36
37
38/*
39 * Assigned values for the product ID register. In order to detect a
40 * certain CPU type exactly eventually additional registers may need to
41 * be examined. These are valid when 23:16 == PRID_COMP_LEGACY
42 */
43#define PRID_IMP_R2000 0x0100
44#define PRID_IMP_AU1_REV1 0x0100
45#define PRID_IMP_AU1_REV2 0x0200
46#define PRID_IMP_R3000 0x0200 /* Same as R2000A */
47#define PRID_IMP_R6000 0x0300 /* Same as R3000A */
48#define PRID_IMP_R4000 0x0400
49#define PRID_IMP_R6000A 0x0600
50#define PRID_IMP_R10000 0x0900
51#define PRID_IMP_R4300 0x0b00
52#define PRID_IMP_VR41XX 0x0c00
53#define PRID_IMP_R12000 0x0e00
54#define PRID_IMP_R14000 0x0f00
55#define PRID_IMP_R8000 0x1000
56#define PRID_IMP_PR4450 0x1200
57#define PRID_IMP_R4600 0x2000
58#define PRID_IMP_R4700 0x2100
59#define PRID_IMP_TX39 0x2200
60#define PRID_IMP_R4640 0x2200
61#define PRID_IMP_R4650 0x2200 /* Same as R4640 */
62#define PRID_IMP_R5000 0x2300
63#define PRID_IMP_TX49 0x2d00
64#define PRID_IMP_SONIC 0x2400
65#define PRID_IMP_MAGIC 0x2500
66#define PRID_IMP_RM7000 0x2700
67#define PRID_IMP_NEVADA 0x2800 /* RM5260 ??? */
68#define PRID_IMP_RM9000 0x3400
69#define PRID_IMP_LOONGSON1 0x4200
70#define PRID_IMP_R5432 0x5400
71#define PRID_IMP_R5500 0x5500
72#define PRID_IMP_LOONGSON2 0x6300
73
74#define PRID_IMP_UNKNOWN 0xff00
75
76/*
77 * These are the PRID's for when 23:16 == PRID_COMP_MIPS
78 */
79
80#define PRID_IMP_4KC 0x8000
81#define PRID_IMP_5KC 0x8100
82#define PRID_IMP_20KC 0x8200
83#define PRID_IMP_4KEC 0x8400
84#define PRID_IMP_4KSC 0x8600
85#define PRID_IMP_25KF 0x8800
86#define PRID_IMP_5KE 0x8900
87#define PRID_IMP_4KECR2 0x9000
88#define PRID_IMP_4KEMPR2 0x9100
89#define PRID_IMP_4KSD 0x9200
90#define PRID_IMP_24K 0x9300
91#define PRID_IMP_34K 0x9500
92#define PRID_IMP_24KE 0x9600
93#define PRID_IMP_74K 0x9700
94#define PRID_IMP_1004K 0x9900
95
96/*
97 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
98 */
99
100#define PRID_IMP_SB1 0x0100
101#define PRID_IMP_SB1A 0x1100
102
103/*
104 * These are the PRID's for when 23:16 == PRID_COMP_SANDCRAFT
105 */
106
107#define PRID_IMP_SR71000 0x0400
108
109/*
110 * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
111 */
112
113#define PRID_IMP_BCM4710 0x4000
114#define PRID_IMP_BCM3302 0x9000
115
116/*
117 * Definitions for 7:0 on legacy processors
118 */
119
120#define PRID_REV_MASK 0x00ff
121
122#define PRID_REV_TX4927 0x0022
123#define PRID_REV_TX4937 0x0030
124#define PRID_REV_R4400 0x0040
125#define PRID_REV_R3000A 0x0030
126#define PRID_REV_R3000 0x0020
127#define PRID_REV_R2000A 0x0010
128#define PRID_REV_TX3912 0x0010
129#define PRID_REV_TX3922 0x0030
130#define PRID_REV_TX3927 0x0040
131#define PRID_REV_VR4111 0x0050
132#define PRID_REV_VR4181 0x0050 /* Same as VR4111 */
133#define PRID_REV_VR4121 0x0060
134#define PRID_REV_VR4122 0x0070
135#define PRID_REV_VR4181A 0x0070 /* Same as VR4122 */
136#define PRID_REV_VR4130 0x0080
137#define PRID_REV_34K_V1_0_2 0x0022
138
139/*
140 * Older processors used to encode processor version and revision in two
141 * 4-bit bitfields, the 4K seems to simply count up and even newer MTI cores
142 * have switched to use the 8-bits as 3:3:2 bitfield with the last field as
143 * the patch number. *ARGH*
144 */
145#define PRID_REV_ENCODE_44(ver, rev) \
146 ((ver) << 4 | (rev))
147#define PRID_REV_ENCODE_332(ver, rev, patch) \
148 ((ver) << 5 | (rev) << 2 | (patch))
149
150/*
151 * FPU implementation/revision register (CP1 control register 0).
152 *
153 * +---------------------------------+----------------+----------------+
154 * | 0 | Implementation | Revision |
155 * +---------------------------------+----------------+----------------+
156 * 31 16 15 8 7 0
157 */
158
159#define FPIR_IMP_NONE 0x0000
160
161enum cpu_type_enum {
162 CPU_UNKNOWN,
163
164 /*
165 * R2000 class processors
166 */
167 CPU_R2000, CPU_R3000, CPU_R3000A, CPU_R3041, CPU_R3051, CPU_R3052,
168 CPU_R3081, CPU_R3081E,
169
170 /*
171 * R6000 class processors
172 */
173 CPU_R6000, CPU_R6000A,
174
175 /*
176 * R4000 class processors
177 */
178 CPU_R4000PC, CPU_R4000SC, CPU_R4000MC, CPU_R4200, CPU_R4300, CPU_R4310,
179 CPU_R4400PC, CPU_R4400SC, CPU_R4400MC, CPU_R4600, CPU_R4640, CPU_R4650,
180 CPU_R4700, CPU_R5000, CPU_R5000A, CPU_R5500, CPU_NEVADA, CPU_R5432,
181 CPU_R10000, CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121,
182 CPU_VR4122, CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000,
183 CPU_SR71000, CPU_RM9000, CPU_TX49XX,
184
185 /*
186 * R8000 class processors
187 */
188 CPU_R8000,
189
190 /*
191 * TX3900 class processors
192 */
193 CPU_TX3912, CPU_TX3922, CPU_TX3927,
194
195 /*
196 * MIPS32 class processors
197 */
198 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
199 CPU_AU1000, CPU_AU1100, CPU_AU1200, CPU_AU1210, CPU_AU1250, CPU_AU1500,
200 CPU_AU1550, CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
201
202 /*
203 * MIPS64 class processors
204 */
205 CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2,
206
207 CPU_LAST
208};
209
210
211/*
212 * ISA Level encodings
213 *
214 */
215#define MIPS_CPU_ISA_I 0x00000001
216#define MIPS_CPU_ISA_II 0x00000002
217#define MIPS_CPU_ISA_III 0x00000004
218#define MIPS_CPU_ISA_IV 0x00000008
219#define MIPS_CPU_ISA_V 0x00000010
220#define MIPS_CPU_ISA_M32R1 0x00000020
221#define MIPS_CPU_ISA_M32R2 0x00000040
222#define MIPS_CPU_ISA_M64R1 0x00000080
223#define MIPS_CPU_ISA_M64R2 0x00000100
224
225#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \
226 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 )
227#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
228 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
229
230/*
231 * CPU Option encodings
232 */
233#define MIPS_CPU_TLB 0x00000001 /* CPU has TLB */
234#define MIPS_CPU_4KEX 0x00000002 /* "R4K" exception model */
235#define MIPS_CPU_3K_CACHE 0x00000004 /* R3000-style caches */
236#define MIPS_CPU_4K_CACHE 0x00000008 /* R4000-style caches */
237#define MIPS_CPU_TX39_CACHE 0x00000010 /* TX3900-style caches */
238#define MIPS_CPU_FPU 0x00000020 /* CPU has FPU */
239#define MIPS_CPU_32FPR 0x00000040 /* 32 dbl. prec. FP registers */
240#define MIPS_CPU_COUNTER 0x00000080 /* Cycle count/compare */
241#define MIPS_CPU_WATCH 0x00000100 /* watchpoint registers */
242#define MIPS_CPU_DIVEC 0x00000200 /* dedicated interrupt vector */
243#define MIPS_CPU_VCE 0x00000400 /* virt. coherence conflict possible */
244#define MIPS_CPU_CACHE_CDEX_P 0x00000800 /* Create_Dirty_Exclusive CACHE op */
245#define MIPS_CPU_CACHE_CDEX_S 0x00001000 /* ... same for seconary cache ... */
246#define MIPS_CPU_MCHECK 0x00002000 /* Machine check exception */
247#define MIPS_CPU_EJTAG 0x00004000 /* EJTAG exception */
248#define MIPS_CPU_NOFPUEX 0x00008000 /* no FPU exception */
249#define MIPS_CPU_LLSC 0x00010000 /* CPU has ll/sc instructions */
250#define MIPS_CPU_INCLUSIVE_CACHES 0x00020000 /* P-cache subset enforced */
251#define MIPS_CPU_PREFETCH 0x00040000 /* CPU has usable prefetch */
252#define MIPS_CPU_VINT 0x00080000 /* CPU supports MIPSR2 vectored interrupts */
253#define MIPS_CPU_VEIC 0x00100000 /* CPU supports MIPSR2 external interrupt controller mode */
254#define MIPS_CPU_ULRI 0x00200000 /* CPU has ULRI feature */
255
256/*
257 * CPU ASE encodings
258 */
259#define MIPS_ASE_MIPS16 0x00000001 /* code compression */
260#define MIPS_ASE_MDMX 0x00000002 /* MIPS digital media extension */
261#define MIPS_ASE_MIPS3D 0x00000004 /* MIPS-3D */
262#define MIPS_ASE_SMARTMIPS 0x00000008 /* SmartMIPS */
263#define MIPS_ASE_DSP 0x00000010 /* Signal Processing ASE */
264#define MIPS_ASE_MIPSMT 0x00000020 /* CPU supports MIPS MT */
265
266
267#endif /* _ASM_CPU_H */
diff --git a/include/asm-mips/cputime.h b/include/asm-mips/cputime.h
deleted file mode 100644
index c00eacbdd979..000000000000
--- a/include/asm-mips/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __MIPS_CPUTIME_H
2#define __MIPS_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __MIPS_CPUTIME_H */
diff --git a/include/asm-mips/current.h b/include/asm-mips/current.h
deleted file mode 100644
index 559db66b9790..000000000000
--- a/include/asm-mips/current.h
+++ /dev/null
@@ -1,23 +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) 1998, 2002 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_CURRENT_H
10#define _ASM_CURRENT_H
11
12#include <linux/thread_info.h>
13
14struct task_struct;
15
16static inline struct task_struct * get_current(void)
17{
18 return current_thread_info()->task;
19}
20
21#define current get_current()
22
23#endif /* _ASM_CURRENT_H */
diff --git a/include/asm-mips/debug.h b/include/asm-mips/debug.h
deleted file mode 100644
index 1fd5a2b39445..000000000000
--- a/include/asm-mips/debug.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Debug macros for run-time debugging.
3 * Turned on/off with CONFIG_RUNTIME_DEBUG option.
4 *
5 * Copyright (C) 2001 MontaVista Software Inc.
6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef _ASM_DEBUG_H
16#define _ASM_DEBUG_H
17
18
19/*
20 * run-time macros for catching spurious errors. Eable CONFIG_RUNTIME_DEBUG in
21 * kernel hacking config menu to use them.
22 *
23 * Use them as run-time debugging aid. NEVER USE THEM AS ERROR HANDLING CODE!!!
24 */
25
26#ifdef CONFIG_RUNTIME_DEBUG
27
28#include <linux/kernel.h>
29
30#define db_assert(x) if (!(x)) { \
31 panic("assertion failed at %s:%d: %s", __FILE__, __LINE__, #x); }
32#define db_warn(x) if (!(x)) { \
33 printk(KERN_WARNING "warning at %s:%d: %s", __FILE__, __LINE__, #x); }
34#define db_verify(x, y) db_assert(x y)
35#define db_verify_warn(x, y) db_warn(x y)
36#define db_run(x) do { x; } while (0)
37
38#else
39
40#define db_assert(x)
41#define db_warn(x)
42#define db_verify(x, y) x
43#define db_verify_warn(x, y) x
44#define db_run(x)
45
46#endif
47
48#endif /* _ASM_DEBUG_H */
diff --git a/include/asm-mips/dec/ecc.h b/include/asm-mips/dec/ecc.h
deleted file mode 100644
index 707ffdbc9add..000000000000
--- a/include/asm-mips/dec/ecc.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * include/asm-mips/dec/ecc.h
3 *
4 * ECC handling logic definitions common to DECstation/DECsystem
5 * 5000/200 (KN02), 5000/240 (KN03), 5000/260 (KN05) and
6 * DECsystem 5900 (KN03), 5900/260 (KN05) systems.
7 *
8 * Copyright (C) 2003 Maciej W. Rozycki
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef __ASM_MIPS_DEC_ECC_H
16#define __ASM_MIPS_DEC_ECC_H
17
18/*
19 * Error Address Register bits.
20 * The register is r/wc -- any write clears it.
21 */
22#define KN0X_EAR_VALID (1<<31) /* error data valid, bus IRQ */
23#define KN0X_EAR_CPU (1<<30) /* CPU/DMA transaction */
24#define KN0X_EAR_WRITE (1<<29) /* write/read transaction */
25#define KN0X_EAR_ECCERR (1<<28) /* ECC/timeout or overrun */
26#define KN0X_EAR_RES_27 (1<<27) /* unused */
27#define KN0X_EAR_ADDRESS (0x7ffffff<<0) /* address involved */
28
29/*
30 * Error Syndrome Register bits.
31 * The register is frozen when EAR.VALID is set, otherwise it records bits
32 * from the last memory read. The register is r/wc -- any write clears it.
33 */
34#define KN0X_ESR_VLDHI (1<<31) /* error data valid hi word */
35#define KN0X_ESR_CHKHI (0x7f<<24) /* check bits read from mem */
36#define KN0X_ESR_SNGHI (1<<23) /* single/double bit error */
37#define KN0X_ESR_SYNHI (0x7f<<16) /* syndrome from ECC logic */
38#define KN0X_ESR_VLDLO (1<<15) /* error data valid lo word */
39#define KN0X_ESR_CHKLO (0x7f<<8) /* check bits read from mem */
40#define KN0X_ESR_SNGLO (1<<7) /* single/double bit error */
41#define KN0X_ESR_SYNLO (0x7f<<0) /* syndrome from ECC logic */
42
43
44#ifndef __ASSEMBLY__
45
46#include <linux/interrupt.h>
47
48struct pt_regs;
49
50extern void dec_ecc_be_init(void);
51extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
52extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id);
53#endif
54
55#endif /* __ASM_MIPS_DEC_ECC_H */
diff --git a/include/asm-mips/dec/interrupts.h b/include/asm-mips/dec/interrupts.h
deleted file mode 100644
index e10d341067c8..000000000000
--- a/include/asm-mips/dec/interrupts.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * Miscellaneous definitions used to initialise the interrupt vector table
3 * with the machine-specific interrupt routines.
4 *
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
7 * for more details.
8 *
9 * Copyright (C) 1997 by Paul M. Antoine.
10 * reworked 1998 by Harald Koerfgen.
11 * Copyright (C) 2001, 2002, 2003 Maciej W. Rozycki
12 */
13
14#ifndef __ASM_DEC_INTERRUPTS_H
15#define __ASM_DEC_INTERRUPTS_H
16
17#include <irq.h>
18#include <asm/mipsregs.h>
19
20
21/*
22 * The list of possible system devices which provide an
23 * interrupt. Not all devices exist on a given system.
24 */
25#define DEC_IRQ_CASCADE 0 /* cascade from CSR or I/O ASIC */
26
27/* Ordinary interrupts */
28#define DEC_IRQ_AB_RECV 1 /* ACCESS.bus receive */
29#define DEC_IRQ_AB_XMIT 2 /* ACCESS.bus transmit */
30#define DEC_IRQ_DZ11 3 /* DZ11 (DC7085) serial */
31#define DEC_IRQ_ASC 4 /* ASC (NCR53C94) SCSI */
32#define DEC_IRQ_FLOPPY 5 /* 82077 FDC */
33#define DEC_IRQ_FPU 6 /* R3k FPU */
34#define DEC_IRQ_HALT 7 /* HALT button or from ACCESS.Bus */
35#define DEC_IRQ_ISDN 8 /* Am79C30A ISDN */
36#define DEC_IRQ_LANCE 9 /* LANCE (Am7990) Ethernet */
37#define DEC_IRQ_BUS 10 /* memory, I/O bus read/write errors */
38#define DEC_IRQ_PSU 11 /* power supply unit warning */
39#define DEC_IRQ_RTC 12 /* DS1287 RTC */
40#define DEC_IRQ_SCC0 13 /* SCC (Z85C30) serial #0 */
41#define DEC_IRQ_SCC1 14 /* SCC (Z85C30) serial #1 */
42#define DEC_IRQ_SII 15 /* SII (DC7061) SCSI */
43#define DEC_IRQ_TC0 16 /* TURBOchannel slot #0 */
44#define DEC_IRQ_TC1 17 /* TURBOchannel slot #1 */
45#define DEC_IRQ_TC2 18 /* TURBOchannel slot #2 */
46#define DEC_IRQ_TIMER 19 /* ARC periodic timer */
47#define DEC_IRQ_VIDEO 20 /* framebuffer */
48
49/* I/O ASIC DMA interrupts */
50#define DEC_IRQ_ASC_MERR 21 /* ASC memory read error */
51#define DEC_IRQ_ASC_ERR 22 /* ASC page overrun */
52#define DEC_IRQ_ASC_DMA 23 /* ASC buffer pointer loaded */
53#define DEC_IRQ_FLOPPY_ERR 24 /* FDC error */
54#define DEC_IRQ_ISDN_ERR 25 /* ISDN memory read/overrun error */
55#define DEC_IRQ_ISDN_RXDMA 26 /* ISDN recv buffer pointer loaded */
56#define DEC_IRQ_ISDN_TXDMA 27 /* ISDN xmit buffer pointer loaded */
57#define DEC_IRQ_LANCE_MERR 28 /* LANCE memory read error */
58#define DEC_IRQ_SCC0A_RXERR 29 /* SCC0A (printer) receive overrun */
59#define DEC_IRQ_SCC0A_RXDMA 30 /* SCC0A receive half page */
60#define DEC_IRQ_SCC0A_TXERR 31 /* SCC0A xmit memory read/overrun */
61#define DEC_IRQ_SCC0A_TXDMA 32 /* SCC0A transmit page end */
62#define DEC_IRQ_AB_RXERR 33 /* ACCESS.bus receive overrun */
63#define DEC_IRQ_AB_RXDMA 34 /* ACCESS.bus receive half page */
64#define DEC_IRQ_AB_TXERR 35 /* ACCESS.bus xmit memory read/ovrn */
65#define DEC_IRQ_AB_TXDMA 36 /* ACCESS.bus transmit page end */
66#define DEC_IRQ_SCC1A_RXERR 37 /* SCC1A (modem) receive overrun */
67#define DEC_IRQ_SCC1A_RXDMA 38 /* SCC1A receive half page */
68#define DEC_IRQ_SCC1A_TXERR 39 /* SCC1A xmit memory read/overrun */
69#define DEC_IRQ_SCC1A_TXDMA 40 /* SCC1A transmit page end */
70
71/* TC5 & TC6 are virtual slots for KN02's onboard devices */
72#define DEC_IRQ_TC5 DEC_IRQ_ASC /* virtual PMAZ-AA */
73#define DEC_IRQ_TC6 DEC_IRQ_LANCE /* virtual PMAD-AA */
74
75#define DEC_NR_INTS 41
76
77
78/* Largest of cpu mask_nr tables. */
79#define DEC_MAX_CPU_INTS 6
80/* Largest of asic mask_nr tables. */
81#define DEC_MAX_ASIC_INTS 9
82
83
84/*
85 * CPU interrupt bits common to all systems.
86 */
87#define DEC_CPU_INR_FPU 7 /* R3k FPU */
88#define DEC_CPU_INR_SW1 1 /* software #1 */
89#define DEC_CPU_INR_SW0 0 /* software #0 */
90
91#define DEC_CPU_IRQ_BASE MIPS_CPU_IRQ_BASE /* first IRQ assigned to CPU */
92
93#define DEC_CPU_IRQ_NR(n) ((n) + DEC_CPU_IRQ_BASE)
94#define DEC_CPU_IRQ_MASK(n) (1 << ((n) + CAUSEB_IP))
95#define DEC_CPU_IRQ_ALL (0xff << CAUSEB_IP)
96
97
98#ifndef __ASSEMBLY__
99
100/*
101 * Interrupt table structures to hide differences between systems.
102 */
103typedef union { int i; void *p; } int_ptr;
104extern int dec_interrupt[DEC_NR_INTS];
105extern int_ptr cpu_mask_nr_tbl[DEC_MAX_CPU_INTS][2];
106extern int_ptr asic_mask_nr_tbl[DEC_MAX_ASIC_INTS][2];
107extern int cpu_fpu_mask;
108
109
110/*
111 * Common interrupt routine prototypes for all DECStations
112 */
113extern void kn02_io_int(void);
114extern void kn02xa_io_int(void);
115extern void kn03_io_int(void);
116extern void asic_dma_int(void);
117extern void asic_all_int(void);
118extern void kn02_all_int(void);
119extern void cpu_all_int(void);
120
121extern void dec_intr_unimplemented(void);
122extern void asic_intr_unimplemented(void);
123
124#endif /* __ASSEMBLY__ */
125
126#endif
diff --git a/include/asm-mips/dec/ioasic.h b/include/asm-mips/dec/ioasic.h
deleted file mode 100644
index 98badd6bf22d..000000000000
--- a/include/asm-mips/dec/ioasic.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * include/asm-mips/dec/ioasic.h
3 *
4 * DEC I/O ASIC access operations.
5 *
6 * Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
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
14#ifndef __ASM_DEC_IOASIC_H
15#define __ASM_DEC_IOASIC_H
16
17#include <linux/spinlock.h>
18#include <linux/types.h>
19
20extern spinlock_t ioasic_ssr_lock;
21
22extern volatile u32 *ioasic_base;
23
24static inline void ioasic_write(unsigned int reg, u32 v)
25{
26 ioasic_base[reg / 4] = v;
27}
28
29static inline u32 ioasic_read(unsigned int reg)
30{
31 return ioasic_base[reg / 4];
32}
33
34extern void init_ioasic_irqs(int base);
35
36extern void dec_ioasic_clocksource_init(void);
37
38#endif /* __ASM_DEC_IOASIC_H */
diff --git a/include/asm-mips/dec/ioasic_addrs.h b/include/asm-mips/dec/ioasic_addrs.h
deleted file mode 100644
index 4cbc1f8a1129..000000000000
--- a/include/asm-mips/dec/ioasic_addrs.h
+++ /dev/null
@@ -1,152 +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 * Definitions for the address map in the JUNKIO Asic
7 *
8 * Created with Information from:
9 *
10 * "DEC 3000 300/400/500/600/700/800/900 AXP Models System Programmer's Manual"
11 *
12 * and the Mach Sources
13 *
14 * Copyright (C) 199x the Anonymous
15 * Copyright (C) 2002, 2003 Maciej W. Rozycki
16 */
17
18#ifndef __ASM_MIPS_DEC_IOASIC_ADDRS_H
19#define __ASM_MIPS_DEC_IOASIC_ADDRS_H
20
21#define IOASIC_SLOT_SIZE 0x00040000
22
23/*
24 * Address ranges decoded by the I/O ASIC for onboard devices.
25 */
26#define IOASIC_SYS_ROM (0*IOASIC_SLOT_SIZE) /* system board ROM */
27#define IOASIC_IOCTL (1*IOASIC_SLOT_SIZE) /* I/O ASIC */
28#define IOASIC_ESAR (2*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
29#define IOASIC_LANCE (3*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
30#define IOASIC_SCC0 (4*IOASIC_SLOT_SIZE) /* SCC #0 */
31#define IOASIC_VDAC_HI (5*IOASIC_SLOT_SIZE) /* VDAC (maxine) */
32#define IOASIC_SCC1 (6*IOASIC_SLOT_SIZE) /* SCC #1 (3min, 3max+) */
33#define IOASIC_VDAC_LO (7*IOASIC_SLOT_SIZE) /* VDAC (maxine) */
34#define IOASIC_TOY (8*IOASIC_SLOT_SIZE) /* RTC */
35#define IOASIC_ISDN (9*IOASIC_SLOT_SIZE) /* ISDN (maxine) */
36#define IOASIC_ERRADDR (9*IOASIC_SLOT_SIZE) /* bus error address (3max+) */
37#define IOASIC_CHKSYN (10*IOASIC_SLOT_SIZE) /* ECC syndrome (3max+) */
38#define IOASIC_ACC_BUS (10*IOASIC_SLOT_SIZE) /* ACCESS.bus (maxine) */
39#define IOASIC_MCR (11*IOASIC_SLOT_SIZE) /* memory control (3max+) */
40#define IOASIC_FLOPPY (11*IOASIC_SLOT_SIZE) /* FDC (maxine) */
41#define IOASIC_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
42#define IOASIC_FDC_DMA (13*IOASIC_SLOT_SIZE) /* FDC DMA (maxine) */
43#define IOASIC_SCSI_DMA (14*IOASIC_SLOT_SIZE) /* ??? */
44#define IOASIC_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
45
46
47/*
48 * Offsets for I/O ASIC registers
49 * (relative to (dec_kn_slot_base + IOASIC_IOCTL)).
50 */
51 /* all systems */
52#define IO_REG_SCSI_DMA_P 0x00 /* SCSI DMA Pointer */
53#define IO_REG_SCSI_DMA_BP 0x10 /* SCSI DMA Buffer Pointer */
54#define IO_REG_LANCE_DMA_P 0x20 /* LANCE DMA Pointer */
55#define IO_REG_SCC0A_T_DMA_P 0x30 /* SCC0A Transmit DMA Pointer */
56#define IO_REG_SCC0A_R_DMA_P 0x40 /* SCC0A Receive DMA Pointer */
57
58 /* except Maxine */
59#define IO_REG_SCC1A_T_DMA_P 0x50 /* SCC1A Transmit DMA Pointer */
60#define IO_REG_SCC1A_R_DMA_P 0x60 /* SCC1A Receive DMA Pointer */
61
62 /* Maxine */
63#define IO_REG_AB_T_DMA_P 0x50 /* ACCESS.bus Transmit DMA Pointer */
64#define IO_REG_AB_R_DMA_P 0x60 /* ACCESS.bus Receive DMA Pointer */
65#define IO_REG_FLOPPY_DMA_P 0x70 /* Floppy DMA Pointer */
66#define IO_REG_ISDN_T_DMA_P 0x80 /* ISDN Transmit DMA Pointer */
67#define IO_REG_ISDN_T_DMA_BP 0x90 /* ISDN Transmit DMA Buffer Pointer */
68#define IO_REG_ISDN_R_DMA_P 0xa0 /* ISDN Receive DMA Pointer */
69#define IO_REG_ISDN_R_DMA_BP 0xb0 /* ISDN Receive DMA Buffer Pointer */
70
71 /* all systems */
72#define IO_REG_DATA_0 0xc0 /* System Data Buffer 0 */
73#define IO_REG_DATA_1 0xd0 /* System Data Buffer 1 */
74#define IO_REG_DATA_2 0xe0 /* System Data Buffer 2 */
75#define IO_REG_DATA_3 0xf0 /* System Data Buffer 3 */
76
77 /* all systems */
78#define IO_REG_SSR 0x100 /* System Support Register */
79#define IO_REG_SIR 0x110 /* System Interrupt Register */
80#define IO_REG_SIMR 0x120 /* System Interrupt Mask Reg. */
81#define IO_REG_SAR 0x130 /* System Address Register */
82
83 /* Maxine */
84#define IO_REG_ISDN_T_DATA 0x140 /* ISDN Xmit Data Register */
85#define IO_REG_ISDN_R_DATA 0x150 /* ISDN Receive Data Register */
86
87 /* all systems */
88#define IO_REG_LANCE_SLOT 0x160 /* LANCE I/O Slot Register */
89#define IO_REG_SCSI_SLOT 0x170 /* SCSI Slot Register */
90#define IO_REG_SCC0A_SLOT 0x180 /* SCC0A DMA Slot Register */
91
92 /* except Maxine */
93#define IO_REG_SCC1A_SLOT 0x190 /* SCC1A DMA Slot Register */
94
95 /* Maxine */
96#define IO_REG_AB_SLOT 0x190 /* ACCESS.bus DMA Slot Register */
97#define IO_REG_FLOPPY_SLOT 0x1a0 /* Floppy Slot Register */
98
99 /* all systems */
100#define IO_REG_SCSI_SCR 0x1b0 /* SCSI Partial-Word DMA Control */
101#define IO_REG_SCSI_SDR0 0x1c0 /* SCSI DMA Partial Word 0 */
102#define IO_REG_SCSI_SDR1 0x1d0 /* SCSI DMA Partial Word 1 */
103#define IO_REG_FCTR 0x1e0 /* Free-Running Counter */
104#define IO_REG_RES_31 0x1f0 /* unused */
105
106
107/*
108 * The upper 16 bits of the System Support Register are a part of the
109 * I/O ASIC's internal DMA engine and thus are common to all I/O ASIC
110 * machines. The exception is the Maxine, which makes use of the
111 * FLOPPY and ISDN bits (otherwise unused) and has a different SCC
112 * wiring.
113 */
114 /* all systems */
115#define IO_SSR_SCC0A_TX_DMA_EN (1<<31) /* SCC0A transmit DMA enable */
116#define IO_SSR_SCC0A_RX_DMA_EN (1<<30) /* SCC0A receive DMA enable */
117#define IO_SSR_RES_27 (1<<27) /* unused */
118#define IO_SSR_RES_26 (1<<26) /* unused */
119#define IO_SSR_RES_25 (1<<25) /* unused */
120#define IO_SSR_RES_24 (1<<24) /* unused */
121#define IO_SSR_RES_23 (1<<23) /* unused */
122#define IO_SSR_SCSI_DMA_DIR (1<<18) /* SCSI DMA direction */
123#define IO_SSR_SCSI_DMA_EN (1<<17) /* SCSI DMA enable */
124#define IO_SSR_LANCE_DMA_EN (1<<16) /* LANCE DMA enable */
125
126 /* except Maxine */
127#define IO_SSR_SCC1A_TX_DMA_EN (1<<29) /* SCC1A transmit DMA enable */
128#define IO_SSR_SCC1A_RX_DMA_EN (1<<28) /* SCC1A receive DMA enable */
129#define IO_SSR_RES_22 (1<<22) /* unused */
130#define IO_SSR_RES_21 (1<<21) /* unused */
131#define IO_SSR_RES_20 (1<<20) /* unused */
132#define IO_SSR_RES_19 (1<<19) /* unused */
133
134 /* Maxine */
135#define IO_SSR_AB_TX_DMA_EN (1<<29) /* ACCESS.bus xmit DMA enable */
136#define IO_SSR_AB_RX_DMA_EN (1<<28) /* ACCESS.bus recv DMA enable */
137#define IO_SSR_FLOPPY_DMA_DIR (1<<22) /* Floppy DMA direction */
138#define IO_SSR_FLOPPY_DMA_EN (1<<21) /* Floppy DMA enable */
139#define IO_SSR_ISDN_TX_DMA_EN (1<<20) /* ISDN transmit DMA enable */
140#define IO_SSR_ISDN_RX_DMA_EN (1<<19) /* ISDN receive DMA enable */
141
142/*
143 * The lower 16 bits are system-specific. Bits 15,11:8 are common and
144 * defined here. The rest is defined in system-specific headers.
145 */
146#define KN0X_IO_SSR_DIAGDN (1<<15) /* diagnostic jumper */
147#define KN0X_IO_SSR_SCC_RST (1<<11) /* ~SCC0,1 (Z85C30) reset */
148#define KN0X_IO_SSR_RTC_RST (1<<10) /* ~RTC (DS1287) reset */
149#define KN0X_IO_SSR_ASC_RST (1<<9) /* ~ASC (NCR53C94) reset */
150#define KN0X_IO_SSR_LANCE_RST (1<<8) /* ~LANCE (Am7990) reset */
151
152#endif /* __ASM_MIPS_DEC_IOASIC_ADDRS_H */
diff --git a/include/asm-mips/dec/ioasic_ints.h b/include/asm-mips/dec/ioasic_ints.h
deleted file mode 100644
index 9aaa9869615f..000000000000
--- a/include/asm-mips/dec/ioasic_ints.h
+++ /dev/null
@@ -1,74 +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 * Definitions for the interrupt related bits in the I/O ASIC
7 * interrupt status register (and the interrupt mask register, of course)
8 *
9 * Created with Information from:
10 *
11 * "DEC 3000 300/400/500/600/700/800/900 AXP Models System Programmer's Manual"
12 *
13 * and the Mach Sources
14 *
15 * Copyright (C) 199x the Anonymous
16 * Copyright (C) 2002 Maciej W. Rozycki
17 */
18
19#ifndef __ASM_DEC_IOASIC_INTS_H
20#define __ASM_DEC_IOASIC_INTS_H
21
22/*
23 * The upper 16 bits are a part of the I/O ASIC's internal DMA engine
24 * and thus are common to all I/O ASIC machines. The exception is
25 * the Maxine, which makes use of the FLOPPY and ISDN bits (otherwise
26 * unused) and has a different SCC wiring.
27 */
28 /* all systems */
29#define IO_INR_SCC0A_TXDMA 31 /* SCC0A transmit page end */
30#define IO_INR_SCC0A_TXERR 30 /* SCC0A transmit memory read error */
31#define IO_INR_SCC0A_RXDMA 29 /* SCC0A receive half page */
32#define IO_INR_SCC0A_RXERR 28 /* SCC0A receive overrun */
33#define IO_INR_ASC_DMA 19 /* ASC buffer pointer loaded */
34#define IO_INR_ASC_ERR 18 /* ASC page overrun */
35#define IO_INR_ASC_MERR 17 /* ASC memory read error */
36#define IO_INR_LANCE_MERR 16 /* LANCE memory read error */
37
38 /* except Maxine */
39#define IO_INR_SCC1A_TXDMA 27 /* SCC1A transmit page end */
40#define IO_INR_SCC1A_TXERR 26 /* SCC1A transmit memory read error */
41#define IO_INR_SCC1A_RXDMA 25 /* SCC1A receive half page */
42#define IO_INR_SCC1A_RXERR 24 /* SCC1A receive overrun */
43#define IO_INR_RES_23 23 /* unused */
44#define IO_INR_RES_22 22 /* unused */
45#define IO_INR_RES_21 21 /* unused */
46#define IO_INR_RES_20 20 /* unused */
47
48 /* Maxine */
49#define IO_INR_AB_TXDMA 27 /* ACCESS.bus transmit page end */
50#define IO_INR_AB_TXERR 26 /* ACCESS.bus xmit memory read error */
51#define IO_INR_AB_RXDMA 25 /* ACCESS.bus receive half page */
52#define IO_INR_AB_RXERR 24 /* ACCESS.bus receive overrun */
53#define IO_INR_FLOPPY_ERR 23 /* FDC error */
54#define IO_INR_ISDN_TXDMA 22 /* ISDN xmit buffer pointer loaded */
55#define IO_INR_ISDN_RXDMA 21 /* ISDN recv buffer pointer loaded */
56#define IO_INR_ISDN_ERR 20 /* ISDN memory read/overrun error */
57
58#define IO_INR_DMA 16 /* first DMA IRQ */
59
60/*
61 * The lower 16 bits are system-specific and thus defined in
62 * system-specific headers.
63 */
64
65
66#define IO_IRQ_BASE 8 /* first IRQ assigned to I/O ASIC */
67#define IO_IRQ_LINES 32 /* number of I/O ASIC interrupts */
68
69#define IO_IRQ_NR(n) ((n) + IO_IRQ_BASE)
70#define IO_IRQ_MASK(n) (1 << (n))
71#define IO_IRQ_ALL 0x0000ffff
72#define IO_IRQ_DMA 0xffff0000
73
74#endif /* __ASM_DEC_IOASIC_INTS_H */
diff --git a/include/asm-mips/dec/kn01.h b/include/asm-mips/dec/kn01.h
deleted file mode 100644
index 28fa717ac423..000000000000
--- a/include/asm-mips/dec/kn01.h
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Hardware info about DECstation DS2100/3100 systems (otherwise known as
3 * pmin/pmax or KN01).
4 *
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
7 * for more details.
8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN01_H
14#define __ASM_MIPS_DEC_KN01_H
15
16#define KN01_SLOT_BASE 0x10000000
17#define KN01_SLOT_SIZE 0x01000000
18
19/*
20 * Address ranges for devices.
21 */
22#define KN01_PMASK (0*KN01_SLOT_SIZE) /* color plane mask */
23#define KN01_PCC (1*KN01_SLOT_SIZE) /* PCC (DC503) cursor */
24#define KN01_VDAC (2*KN01_SLOT_SIZE) /* color map */
25#define KN01_RES_3 (3*KN01_SLOT_SIZE) /* unused */
26#define KN01_RES_4 (4*KN01_SLOT_SIZE) /* unused */
27#define KN01_RES_5 (5*KN01_SLOT_SIZE) /* unused */
28#define KN01_RES_6 (6*KN01_SLOT_SIZE) /* unused */
29#define KN01_ERRADDR (7*KN01_SLOT_SIZE) /* write error address */
30#define KN01_LANCE (8*KN01_SLOT_SIZE) /* LANCE (Am7990) Ethernet */
31#define KN01_LANCE_MEM (9*KN01_SLOT_SIZE) /* LANCE buffer memory */
32#define KN01_SII (10*KN01_SLOT_SIZE) /* SII (DC7061) SCSI */
33#define KN01_SII_MEM (11*KN01_SLOT_SIZE) /* SII buffer memory */
34#define KN01_DZ11 (12*KN01_SLOT_SIZE) /* DZ11 (DC7085) serial */
35#define KN01_RTC (13*KN01_SLOT_SIZE) /* DS1287 RTC (bytes #0) */
36#define KN01_ESAR (13*KN01_SLOT_SIZE) /* MAC address (bytes #1) */
37#define KN01_CSR (14*KN01_SLOT_SIZE) /* system ctrl & status reg */
38#define KN01_SYS_ROM (15*KN01_SLOT_SIZE) /* system board ROM */
39
40
41/*
42 * Frame buffer memory address.
43 */
44#define KN01_VFB_MEM 0x0fc00000
45
46/*
47 * CPU interrupt bits.
48 */
49#define KN01_CPU_INR_BUS 6 /* memory, I/O bus read/write errors */
50#define KN01_CPU_INR_VIDEO 6 /* PCC area detect #2 */
51#define KN01_CPU_INR_RTC 5 /* DS1287 RTC */
52#define KN01_CPU_INR_DZ11 4 /* DZ11 (DC7085) serial */
53#define KN01_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
54#define KN01_CPU_INR_SII 2 /* SII (DC7061) SCSI */
55
56
57/*
58 * System Control & Status Register bits.
59 */
60#define KN01_CSR_MNFMOD (1<<15) /* MNFMOD manufacturing jumper */
61#define KN01_CSR_STATUS (1<<14) /* self-test result status output */
62#define KN01_CSR_PARDIS (1<<13) /* parity error disable */
63#define KN01_CSR_CRSRTST (1<<12) /* PCC test output */
64#define KN01_CSR_MONO (1<<11) /* mono/color fb SIMM installed */
65#define KN01_CSR_MEMERR (1<<10) /* write timeout error status & ack*/
66#define KN01_CSR_VINT (1<<9) /* PCC area detect #2 status & ack */
67#define KN01_CSR_TXDIS (1<<8) /* DZ11 transmit disable */
68#define KN01_CSR_VBGTRG (1<<2) /* blue DAC voltage over green (r/o) */
69#define KN01_CSR_VRGTRG (1<<1) /* red DAC voltage over green (r/o) */
70#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */
71#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
72
73
74#ifndef __ASSEMBLY__
75
76#include <linux/interrupt.h>
77#include <linux/spinlock.h>
78#include <linux/types.h>
79
80struct pt_regs;
81
82extern u16 cached_kn01_csr;
83extern spinlock_t kn01_lock;
84
85extern void dec_kn01_be_init(void);
86extern int dec_kn01_be_handler(struct pt_regs *regs, int is_fixup);
87extern irqreturn_t dec_kn01_be_interrupt(int irq, void *dev_id);
88#endif
89
90#endif /* __ASM_MIPS_DEC_KN01_H */
diff --git a/include/asm-mips/dec/kn02.h b/include/asm-mips/dec/kn02.h
deleted file mode 100644
index 93430b5f4724..000000000000
--- a/include/asm-mips/dec/kn02.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * Hardware info about DECstation 5000/200 systems (otherwise known as
3 * 3max or KN02).
4 *
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
7 * for more details.
8 *
9 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
10 * are by courtesy of Chris Fraser.
11 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
12 */
13#ifndef __ASM_MIPS_DEC_KN02_H
14#define __ASM_MIPS_DEC_KN02_H
15
16#define KN02_SLOT_BASE 0x1fc00000
17#define KN02_SLOT_SIZE 0x00080000
18
19/*
20 * Address ranges decoded by the "system slot" logic for onboard devices.
21 */
22#define KN02_SYS_ROM (0*KN02_SLOT_SIZE) /* system board ROM */
23#define KN02_RES_1 (1*KN02_SLOT_SIZE) /* unused */
24#define KN02_CHKSYN (2*KN02_SLOT_SIZE) /* ECC syndrome */
25#define KN02_ERRADDR (3*KN02_SLOT_SIZE) /* bus error address */
26#define KN02_DZ11 (4*KN02_SLOT_SIZE) /* DZ11 (DC7085) serial */
27#define KN02_RTC (5*KN02_SLOT_SIZE) /* DS1287 RTC */
28#define KN02_CSR (6*KN02_SLOT_SIZE) /* system ctrl & status reg */
29#define KN02_SYS_ROM_7 (7*KN02_SLOT_SIZE) /* system board ROM (alias) */
30
31
32/*
33 * System Control & Status Register bits.
34 */
35#define KN02_CSR_RES_28 (0xf<<28) /* unused */
36#define KN02_CSR_PSU (1<<27) /* power supply unit warning */
37#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */
38#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */
39#define KN02_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
40#define KN02_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
41#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
42#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
43#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */
44#define KN02_CSR_LEDIAG (1<<12) /* ECC diagn. latch strobe */
45#define KN02_CSR_TXDIS (1<<11) /* DZ11 transmit disable */
46#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */
47#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */
48#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */
49#define KN02_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
50#define KN02_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
51
52
53/*
54 * CPU interrupt bits.
55 */
56#define KN02_CPU_INR_RES_6 6 /* unused */
57#define KN02_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
58#define KN02_CPU_INR_RES_4 4 /* unused */
59#define KN02_CPU_INR_RTC 3 /* DS1287 RTC */
60#define KN02_CPU_INR_CASCADE 2 /* CSR cascade */
61
62/*
63 * CSR interrupt bits.
64 */
65#define KN02_CSR_INR_DZ11 7 /* DZ11 (DC7085) serial */
66#define KN02_CSR_INR_LANCE 6 /* LANCE (Am7990) Ethernet */
67#define KN02_CSR_INR_ASC 5 /* ASC (NCR53C94) SCSI */
68#define KN02_CSR_INR_RES_4 4 /* unused */
69#define KN02_CSR_INR_RES_3 3 /* unused */
70#define KN02_CSR_INR_TC2 2 /* TURBOchannel slot #2 */
71#define KN02_CSR_INR_TC1 1 /* TURBOchannel slot #1 */
72#define KN02_CSR_INR_TC0 0 /* TURBOchannel slot #0 */
73
74
75#define KN02_IRQ_BASE 8 /* first IRQ assigned to CSR */
76#define KN02_IRQ_LINES 8 /* number of CSR interrupts */
77
78#define KN02_IRQ_NR(n) ((n) + KN02_IRQ_BASE)
79#define KN02_IRQ_MASK(n) (1 << (n))
80#define KN02_IRQ_ALL 0xff
81
82
83#ifndef __ASSEMBLY__
84
85#include <linux/types.h>
86
87extern u32 cached_kn02_csr;
88extern void init_kn02_irqs(int base);
89#endif
90
91#endif /* __ASM_MIPS_DEC_KN02_H */
diff --git a/include/asm-mips/dec/kn02ba.h b/include/asm-mips/dec/kn02ba.h
deleted file mode 100644
index c957a4f1b32d..000000000000
--- a/include/asm-mips/dec/kn02ba.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * include/asm-mips/dec/kn02ba.h
3 *
4 * DECstation 5000/1xx (3min or KN02-BA) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
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#ifndef __ASM_MIPS_DEC_KN02BA_H
14#define __ASM_MIPS_DEC_KN02BA_H
15
16#include <asm/dec/kn02xa.h> /* For common definitions. */
17
18/*
19 * CPU interrupt bits.
20 */
21#define KN02BA_CPU_INR_HALT 6 /* HALT button */
22#define KN02BA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
23#define KN02BA_CPU_INR_TC2 4 /* TURBOchannel slot #2 */
24#define KN02BA_CPU_INR_TC1 3 /* TURBOchannel slot #1 */
25#define KN02BA_CPU_INR_TC0 2 /* TURBOchannel slot #0 */
26
27/*
28 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
29 */
30#define KN02BA_IO_INR_RES_15 15 /* unused */
31#define KN02BA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
32#define KN02BA_IO_INR_RES_13 13 /* unused */
33#define KN02BA_IO_INR_BUS 12 /* memory, I/O bus read/write errors */
34#define KN02BA_IO_INR_RES_11 11 /* unused */
35#define KN02BA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
36#define KN02BA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
37#define KN02BA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
38#define KN02BA_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
39#define KN02BA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
40#define KN02BA_IO_INR_RTC 5 /* DS1287 RTC */
41#define KN02BA_IO_INR_PSU 4 /* power supply unit warning */
42#define KN02BA_IO_INR_RES_3 3 /* unused */
43#define KN02BA_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
44#define KN02BA_IO_INR_PBNC 1 /* ~HALT button debouncer */
45#define KN02BA_IO_INR_PBNO 0 /* HALT button debouncer */
46
47
48/*
49 * Memory Error Register bits.
50 */
51#define KN02BA_MER_RES_27 (1<<27) /* unused */
52
53/*
54 * Memory Size Register bits.
55 */
56#define KN02BA_MSR_RES_17 (0x3ff<<17) /* unused */
57
58/*
59 * I/O ASIC System Support Register bits.
60 */
61#define KN02BA_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
62#define KN02BA_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
63#define KN02BA_IO_SSR_RES_12 (1<<12) /* unused */
64
65#define KN02BA_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
66
67#endif /* __ASM_MIPS_DEC_KN02BA_H */
diff --git a/include/asm-mips/dec/kn02ca.h b/include/asm-mips/dec/kn02ca.h
deleted file mode 100644
index 92c0fe256099..000000000000
--- a/include/asm-mips/dec/kn02ca.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * include/asm-mips/dec/kn02ca.h
3 *
4 * Personal DECstation 5000/xx (Maxine or KN02-CA) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
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#ifndef __ASM_MIPS_DEC_KN02CA_H
14#define __ASM_MIPS_DEC_KN02CA_H
15
16#include <asm/dec/kn02xa.h> /* For common definitions. */
17
18/*
19 * CPU interrupt bits.
20 */
21#define KN02CA_CPU_INR_HALT 6 /* HALT from ACCESS.Bus */
22#define KN02CA_CPU_INR_CASCADE 5 /* I/O ASIC cascade */
23#define KN02CA_CPU_INR_BUS 4 /* memory, I/O bus read/write errors */
24#define KN02CA_CPU_INR_RTC 3 /* DS1287 RTC */
25#define KN02CA_CPU_INR_TIMER 2 /* ARC periodic timer */
26
27/*
28 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
29 */
30#define KN02CA_IO_INR_FLOPPY 15 /* 82077 FDC */
31#define KN02CA_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
32#define KN02CA_IO_INR_POWERON 13 /* (*) ACCESS.Bus/power-on reset */
33#define KN02CA_IO_INR_TC0 12 /* TURBOchannel slot #0 */
34#define KN02CA_IO_INR_TIMER 12 /* ARC periodic timer (?) */
35#define KN02CA_IO_INR_ISDN 11 /* Am79C30A ISDN */
36#define KN02CA_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
37#define KN02CA_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
38#define KN02CA_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
39#define KN02CA_IO_INR_HDFLOPPY 7 /* (*) HD (1.44MB) floppy status */
40#define KN02CA_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
41#define KN02CA_IO_INR_TC1 5 /* TURBOchannel slot #1 */
42#define KN02CA_IO_INR_XDFLOPPY 4 /* (*) XD (2.88MB) floppy status */
43#define KN02CA_IO_INR_VIDEO 3 /* framebuffer */
44#define KN02CA_IO_INR_XVIDEO 2 /* ~framebuffer */
45#define KN02CA_IO_INR_AB_XMIT 1 /* ACCESS.bus transmit */
46#define KN02CA_IO_INR_AB_RECV 0 /* ACCESS.bus receive */
47
48
49/*
50 * Memory Error Register bits.
51 */
52#define KN02CA_MER_INTR (1<<27) /* ARC IRQ status & ack */
53
54/*
55 * Memory Size Register bits.
56 */
57#define KN02CA_MSR_INTREN (1<<26) /* ARC periodic IRQ enable */
58#define KN02CA_MSR_MS10EN (1<<25) /* 10/1ms IRQ period select */
59#define KN02CA_MSR_PFORCE (0xf<<21) /* byte lane error force */
60#define KN02CA_MSR_MABEN (1<<20) /* A side VFB address enable */
61#define KN02CA_MSR_LASTBANK (0x7<<17) /* onboard RAM bank # */
62
63/*
64 * I/O ASIC System Support Register bits.
65 */
66#define KN03CA_IO_SSR_RES_14 (1<<14) /* unused */
67#define KN03CA_IO_SSR_RES_13 (1<<13) /* unused */
68#define KN03CA_IO_SSR_ISDN_RST (1<<12) /* ~ISDN (Am79C30A) reset */
69
70#define KN03CA_IO_SSR_FLOPPY_RST (1<<7) /* ~FDC (82077) reset */
71#define KN03CA_IO_SSR_VIDEO_RST (1<<6) /* ~framebuffer reset */
72#define KN03CA_IO_SSR_AB_RST (1<<5) /* ACCESS.bus reset */
73#define KN03CA_IO_SSR_RES_4 (1<<4) /* unused */
74#define KN03CA_IO_SSR_RES_3 (1<<4) /* unused */
75#define KN03CA_IO_SSR_RES_2 (1<<2) /* unused */
76#define KN03CA_IO_SSR_RES_1 (1<<1) /* unused */
77#define KN03CA_IO_SSR_LED (1<<0) /* power LED */
78
79#endif /* __ASM_MIPS_DEC_KN02CA_H */
diff --git a/include/asm-mips/dec/kn02xa.h b/include/asm-mips/dec/kn02xa.h
deleted file mode 100644
index b56b4577f6ef..000000000000
--- a/include/asm-mips/dec/kn02xa.h
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * Hardware info common to DECstation 5000/1xx systems (otherwise
3 * known as 3min or kn02ba) and Personal DECstations 5000/xx ones
4 * (otherwise known as maxine or kn02ca).
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
11 * are by courtesy of Chris Fraser.
12 * Copyright (C) 2000, 2002, 2003, 2005 Maciej W. Rozycki
13 *
14 * These are addresses which have to be known early in the boot process.
15 * For other addresses refer to tc.h, ioasic_addrs.h and friends.
16 */
17#ifndef __ASM_MIPS_DEC_KN02XA_H
18#define __ASM_MIPS_DEC_KN02XA_H
19
20#include <asm/dec/ioasic_addrs.h>
21
22#define KN02XA_SLOT_BASE 0x1c000000
23
24/*
25 * Memory control ASIC registers.
26 */
27#define KN02XA_MER 0x0c400000 /* memory error register */
28#define KN02XA_MSR 0x0c800000 /* memory size register */
29
30/*
31 * CPU control ASIC registers.
32 */
33#define KN02XA_MEM_CONF 0x0e000000 /* write timeout config */
34#define KN02XA_EAR 0x0e000004 /* error address register */
35#define KN02XA_BOOT0 0x0e000008 /* boot 0 register */
36#define KN02XA_MEM_INTR 0x0e00000c /* write err IRQ stat & ack */
37
38/*
39 * Memory Error Register bits, common definitions.
40 * The rest is defined in system-specific headers.
41 */
42#define KN02XA_MER_RES_28 (0xf<<28) /* unused */
43#define KN02XA_MER_RES_17 (0x3ff<<17) /* unused */
44#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */
45#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */
46#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */
47#define KN02XA_MER_SIZE (1<<13) /* r/o mirror of MSR_SIZE */
48#define KN02XA_MER_RES_12 (1<<12) /* unused */
49#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask: */
50#define KN02XA_MER_BYTERR_3 (0x8<<8) /* byte lane #3 */
51#define KN02XA_MER_BYTERR_2 (0x4<<8) /* byte lane #2 */
52#define KN02XA_MER_BYTERR_1 (0x2<<8) /* byte lane #1 */
53#define KN02XA_MER_BYTERR_0 (0x1<<8) /* byte lane #0 */
54#define KN02XA_MER_RES_0 (0xff<<0) /* unused */
55
56/*
57 * Memory Size Register bits, common definitions.
58 * The rest is defined in system-specific headers.
59 */
60#define KN02XA_MSR_RES_27 (0x1f<<27) /* unused */
61#define KN02XA_MSR_RES_14 (0x7<<14) /* unused */
62#define KN02XA_MSR_SIZE (1<<13) /* 16M/4M stride */
63#define KN02XA_MSR_RES_0 (0x1fff<<0) /* unused */
64
65/*
66 * Error Address Register bits.
67 */
68#define KN02XA_EAR_RES_29 (0x7<<29) /* unused */
69#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */
70#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */
71
72
73#ifndef __ASSEMBLY__
74
75#include <linux/interrupt.h>
76
77struct pt_regs;
78
79extern void dec_kn02xa_be_init(void);
80extern int dec_kn02xa_be_handler(struct pt_regs *regs, int is_fixup);
81extern irqreturn_t dec_kn02xa_be_interrupt(int irq, void *dev_id);
82#endif
83
84#endif /* __ASM_MIPS_DEC_KN02XA_H */
diff --git a/include/asm-mips/dec/kn03.h b/include/asm-mips/dec/kn03.h
deleted file mode 100644
index edede923ffb8..000000000000
--- a/include/asm-mips/dec/kn03.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Hardware info about DECstation 5000/2x0 systems (otherwise known as
3 * 3max+) and DECsystem 5900 systems (otherwise known as bigmax) which
4 * differ mechanically but are otherwise identical (both are known as
5 * KN03).
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
12 * are by courtesy of Chris Fraser.
13 * Copyright (C) 2000, 2002, 2003, 2005 Maciej W. Rozycki
14 */
15#ifndef __ASM_MIPS_DEC_KN03_H
16#define __ASM_MIPS_DEC_KN03_H
17
18#include <asm/dec/ecc.h>
19#include <asm/dec/ioasic_addrs.h>
20
21#define KN03_SLOT_BASE 0x1f800000
22
23/*
24 * CPU interrupt bits.
25 */
26#define KN03_CPU_INR_HALT 6 /* HALT button */
27#define KN03_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
28#define KN03_CPU_INR_RES_4 4 /* unused */
29#define KN03_CPU_INR_RTC 3 /* DS1287 RTC */
30#define KN03_CPU_INR_CASCADE 2 /* I/O ASIC cascade */
31
32/*
33 * I/O ASIC interrupt bits. Star marks denote non-IRQ status bits.
34 */
35#define KN03_IO_INR_3MAXP 15 /* (*) 3max+/bigmax ID */
36#define KN03_IO_INR_NVRAM 14 /* (*) NVRAM clear jumper */
37#define KN03_IO_INR_TC2 13 /* TURBOchannel slot #2 */
38#define KN03_IO_INR_TC1 12 /* TURBOchannel slot #1 */
39#define KN03_IO_INR_TC0 11 /* TURBOchannel slot #0 */
40#define KN03_IO_INR_NRMOD 10 /* (*) NRMOD manufacturing jumper */
41#define KN03_IO_INR_ASC 9 /* ASC (NCR53C94) SCSI */
42#define KN03_IO_INR_LANCE 8 /* LANCE (Am7990) Ethernet */
43#define KN03_IO_INR_SCC1 7 /* SCC (Z85C30) serial #1 */
44#define KN03_IO_INR_SCC0 6 /* SCC (Z85C30) serial #0 */
45#define KN03_IO_INR_RTC 5 /* DS1287 RTC */
46#define KN03_IO_INR_PSU 4 /* power supply unit warning */
47#define KN03_IO_INR_RES_3 3 /* unused */
48#define KN03_IO_INR_ASC_DATA 2 /* SCSI data ready (for PIO) */
49#define KN03_IO_INR_PBNC 1 /* ~HALT button debouncer */
50#define KN03_IO_INR_PBNO 0 /* HALT button debouncer */
51
52
53/*
54 * Memory Control Register bits.
55 */
56#define KN03_MCR_RES_16 (0xffff<<16) /* unused */
57#define KN03_MCR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
58#define KN03_MCR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
59#define KN03_MCR_CORRECT (1<<13) /* ECC correct/check */
60#define KN03_MCR_RES_11 (0x3<<12) /* unused */
61#define KN03_MCR_BNK32M (1<<10) /* 32M/8M stride */
62#define KN03_MCR_RES_7 (0x7<<7) /* unused */
63#define KN03_MCR_CHECK (0x7f<<0) /* diagnostic check bits */
64
65/*
66 * I/O ASIC System Support Register bits.
67 */
68#define KN03_IO_SSR_TXDIS1 (1<<14) /* SCC1 transmit disable */
69#define KN03_IO_SSR_TXDIS0 (1<<13) /* SCC0 transmit disable */
70#define KN03_IO_SSR_RES_12 (1<<12) /* unused */
71
72#define KN03_IO_SSR_LEDS (0xff<<0) /* ~diagnostic LEDs */
73
74#endif /* __ASM_MIPS_DEC_KN03_H */
diff --git a/include/asm-mips/dec/kn05.h b/include/asm-mips/dec/kn05.h
deleted file mode 100644
index 56d22dc8803a..000000000000
--- a/include/asm-mips/dec/kn05.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * include/asm-mips/dec/kn05.h
3 *
4 * DECstation/DECsystem 5000/260 (4max+ or KN05), 5000/150 (4min
5 * or KN04-BA), Personal DECstation/DECsystem 5000/50 (4maxine or
6 * KN04-CA) and DECsystem 5900/260 (KN05) R4k CPU card MB ASIC
7 * definitions.
8 *
9 * Copyright (C) 2002, 2003, 2005, 2008 Maciej W. Rozycki
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 *
16 * WARNING! All this information is pure guesswork based on the
17 * ROM. It is provided here in hope it will give someone some
18 * food for thought. No documentation for the KN05 nor the KN04
19 * module has been located so far.
20 */
21#ifndef __ASM_MIPS_DEC_KN05_H
22#define __ASM_MIPS_DEC_KN05_H
23
24#include <asm/dec/ioasic_addrs.h>
25
26/*
27 * The oncard MB (Memory Buffer) ASIC provides an additional address
28 * decoder. Certain address ranges within the "high" 16 slots are
29 * passed to the I/O ASIC's decoder like with the KN03 or KN02-BA/CA.
30 * Others are handled locally. "Low" slots are always passed.
31 */
32#define KN4K_SLOT_BASE 0x1fc00000
33
34#define KN4K_MB_ROM (0*IOASIC_SLOT_SIZE) /* KN05/KN04 card ROM */
35#define KN4K_IOCTL (1*IOASIC_SLOT_SIZE) /* I/O ASIC */
36#define KN4K_ESAR (2*IOASIC_SLOT_SIZE) /* LANCE MAC address chip */
37#define KN4K_LANCE (3*IOASIC_SLOT_SIZE) /* LANCE Ethernet */
38#define KN4K_MB_INT (4*IOASIC_SLOT_SIZE) /* MB interrupt register */
39#define KN4K_MB_EA (5*IOASIC_SLOT_SIZE) /* MB error address? */
40#define KN4K_MB_EC (6*IOASIC_SLOT_SIZE) /* MB error ??? */
41#define KN4K_MB_CSR (7*IOASIC_SLOT_SIZE) /* MB control & status */
42#define KN4K_RES_08 (8*IOASIC_SLOT_SIZE) /* unused? */
43#define KN4K_RES_09 (9*IOASIC_SLOT_SIZE) /* unused? */
44#define KN4K_RES_10 (10*IOASIC_SLOT_SIZE) /* unused? */
45#define KN4K_RES_11 (11*IOASIC_SLOT_SIZE) /* unused? */
46#define KN4K_SCSI (12*IOASIC_SLOT_SIZE) /* ASC SCSI */
47#define KN4K_RES_13 (13*IOASIC_SLOT_SIZE) /* unused? */
48#define KN4K_RES_14 (14*IOASIC_SLOT_SIZE) /* unused? */
49#define KN4K_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */
50
51/*
52 * Bits for the MB interrupt register.
53 * The register appears read-only.
54 */
55#define KN4K_MB_INT_TC (1<<0) /* TURBOchannel? */
56#define KN4K_MB_INT_RTC (1<<1) /* RTC? */
57#define KN4K_MB_INT_MT (1<<3) /* I/O ASIC cascade */
58
59/*
60 * Bits for the MB control & status register.
61 * Set to 0x00bf8001 for KN05 and to 0x003f8000 for KN04 by the firmware.
62 */
63#define KN4K_MB_CSR_PF (1<<0) /* PreFetching enable? */
64#define KN4K_MB_CSR_F (1<<1) /* ??? */
65#define KN4K_MB_CSR_ECC (0xff<<2) /* ??? */
66#define KN4K_MB_CSR_OD (1<<10) /* ??? */
67#define KN4K_MB_CSR_CP (1<<11) /* ??? */
68#define KN4K_MB_CSR_UNC (1<<12) /* ??? */
69#define KN4K_MB_CSR_IM (1<<13) /* ??? */
70#define KN4K_MB_CSR_NC (1<<14) /* ??? */
71#define KN4K_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */
72#define KN4K_MB_CSR_MSK (0x1f<<16) /* CPU Int[4:0] mask */
73#define KN4K_MB_CSR_FW (1<<21) /* ??? */
74#define KN4K_MB_CSR_W (1<<31) /* ??? */
75
76#endif /* __ASM_MIPS_DEC_KN05_H */
diff --git a/include/asm-mips/dec/kn230.h b/include/asm-mips/dec/kn230.h
deleted file mode 100644
index ff1bf17de8d8..000000000000
--- a/include/asm-mips/dec/kn230.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * include/asm-mips/dec/kn230.h
3 *
4 * DECsystem 5100 (MIPSmate or KN230) definitions.
5 *
6 * Copyright (C) 2002, 2003 Maciej W. Rozycki
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#ifndef __ASM_MIPS_DEC_KN230_H
14#define __ASM_MIPS_DEC_KN230_H
15
16/*
17 * CPU interrupt bits.
18 */
19#define KN230_CPU_INR_HALT 6 /* HALT button */
20#define KN230_CPU_INR_BUS 5 /* memory, I/O bus read/write errors */
21#define KN230_CPU_INR_RTC 4 /* DS1287 RTC */
22#define KN230_CPU_INR_SII 3 /* SII (DC7061) SCSI */
23#define KN230_CPU_INR_LANCE 3 /* LANCE (Am7990) Ethernet */
24#define KN230_CPU_INR_DZ11 2 /* DZ11 (DC7085) serial */
25
26#endif /* __ASM_MIPS_DEC_KN230_H */
diff --git a/include/asm-mips/dec/machtype.h b/include/asm-mips/dec/machtype.h
deleted file mode 100644
index a6ecdebc430a..000000000000
--- a/include/asm-mips/dec/machtype.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Various machine type macros
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, 2000 Harald Koerfgen
9 */
10
11#ifndef __ASM_DEC_MACHTYPE_H
12#define __ASM_DEC_MACHTYPE_H
13
14#include <asm/bootinfo.h>
15
16#define TURBOCHANNEL (mips_machtype == MACH_DS5000_200 || \
17 mips_machtype == MACH_DS5000_1XX || \
18 mips_machtype == MACH_DS5000_XX || \
19 mips_machtype == MACH_DS5000_2X0 || \
20 mips_machtype == MACH_DS5900)
21
22#define IOASIC (mips_machtype == MACH_DS5000_1XX || \
23 mips_machtype == MACH_DS5000_XX || \
24 mips_machtype == MACH_DS5000_2X0 || \
25 mips_machtype == MACH_DS5900)
26
27#endif
diff --git a/include/asm-mips/dec/prom.h b/include/asm-mips/dec/prom.h
deleted file mode 100644
index b9c8203688d5..000000000000
--- a/include/asm-mips/dec/prom.h
+++ /dev/null
@@ -1,174 +0,0 @@
1/*
2 * include/asm-mips/dec/prom.h
3 *
4 * DECstation PROM interface.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
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 * Based on arch/mips/dec/prom/prom.h by the Anonymous.
14 */
15#ifndef _ASM_DEC_PROM_H
16#define _ASM_DEC_PROM_H
17
18#include <linux/types.h>
19
20#include <asm/addrspace.h>
21
22/*
23 * PMAX/3MAX PROM entry points for DS2100/3100's and DS5000/2xx's.
24 * Many of these will work for MIPSen as well!
25 */
26#define VEC_RESET (u64 *)CKSEG1ADDR(0x1fc00000)
27 /* Prom base address */
28
29#define PMAX_PROM_ENTRY(x) (VEC_RESET + (x)) /* Prom jump table */
30
31#define PMAX_PROM_HALT PMAX_PROM_ENTRY(2) /* valid on MIPSen */
32#define PMAX_PROM_AUTOBOOT PMAX_PROM_ENTRY(5) /* valid on MIPSen */
33#define PMAX_PROM_OPEN PMAX_PROM_ENTRY(6)
34#define PMAX_PROM_READ PMAX_PROM_ENTRY(7)
35#define PMAX_PROM_CLOSE PMAX_PROM_ENTRY(10)
36#define PMAX_PROM_LSEEK PMAX_PROM_ENTRY(11)
37#define PMAX_PROM_GETCHAR PMAX_PROM_ENTRY(12)
38#define PMAX_PROM_PUTCHAR PMAX_PROM_ENTRY(13) /* 12 on MIPSen */
39#define PMAX_PROM_GETS PMAX_PROM_ENTRY(15)
40#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
41#define PMAX_PROM_GETENV PMAX_PROM_ENTRY(33) /* valid on MIPSen */
42
43
44/*
45 * Magic number indicating REX PROM available on DECstation. Found in
46 * register a2 on transfer of control to program from PROM.
47 */
48#define REX_PROM_MAGIC 0x30464354
49
50#ifdef CONFIG_64BIT
51
52#define prom_is_rex(magic) 1 /* KN04 and KN05 are REX PROMs. */
53
54#else /* !CONFIG_64BIT */
55
56#define prom_is_rex(magic) ((magic) == REX_PROM_MAGIC)
57
58#endif /* !CONFIG_64BIT */
59
60
61/*
62 * 3MIN/MAXINE PROM entry points for DS5000/1xx's, DS5000/xx's and
63 * DS5000/2x0.
64 */
65#define REX_PROM_GETBITMAP 0x84/4 /* get mem bitmap */
66#define REX_PROM_GETCHAR 0x24/4 /* getch() */
67#define REX_PROM_GETENV 0x64/4 /* get env. variable */
68#define REX_PROM_GETSYSID 0x80/4 /* get system id */
69#define REX_PROM_GETTCINFO 0xa4/4
70#define REX_PROM_PRINTF 0x30/4 /* printf() */
71#define REX_PROM_SLOTADDR 0x6c/4 /* slotaddr */
72#define REX_PROM_BOOTINIT 0x54/4 /* open() */
73#define REX_PROM_BOOTREAD 0x58/4 /* read() */
74#define REX_PROM_CLEARCACHE 0x7c/4
75
76
77/*
78 * Used by rex_getbitmap().
79 */
80typedef struct {
81 int pagesize;
82 unsigned char bitmap[0];
83} memmap;
84
85
86/*
87 * Function pointers as read from a PROM's callback vector.
88 */
89extern int (*__rex_bootinit)(void);
90extern int (*__rex_bootread)(void);
91extern int (*__rex_getbitmap)(memmap *);
92extern unsigned long *(*__rex_slot_address)(int);
93extern void *(*__rex_gettcinfo)(void);
94extern int (*__rex_getsysid)(void);
95extern void (*__rex_clear_cache)(void);
96
97extern int (*__prom_getchar)(void);
98extern char *(*__prom_getenv)(char *);
99extern int (*__prom_printf)(char *, ...);
100
101extern int (*__pmax_open)(char*, int);
102extern int (*__pmax_lseek)(int, long, int);
103extern int (*__pmax_read)(int, void *, int);
104extern int (*__pmax_close)(int);
105
106
107#ifdef CONFIG_64BIT
108
109/*
110 * On MIPS64 we have to call PROM functions via a helper
111 * dispatcher to accomodate ABI incompatibilities.
112 */
113#define __DEC_PROM_O32(fun, arg) fun arg __asm__(#fun); \
114 __asm__(#fun " = call_o32")
115
116int __DEC_PROM_O32(_rex_bootinit, (int (*)(void)));
117int __DEC_PROM_O32(_rex_bootread, (int (*)(void)));
118int __DEC_PROM_O32(_rex_getbitmap, (int (*)(memmap *), memmap *));
119unsigned long *__DEC_PROM_O32(_rex_slot_address,
120 (unsigned long *(*)(int), int));
121void *__DEC_PROM_O32(_rex_gettcinfo, (void *(*)(void)));
122int __DEC_PROM_O32(_rex_getsysid, (int (*)(void)));
123void __DEC_PROM_O32(_rex_clear_cache, (void (*)(void)));
124
125int __DEC_PROM_O32(_prom_getchar, (int (*)(void)));
126char *__DEC_PROM_O32(_prom_getenv, (char *(*)(char *), char *));
127int __DEC_PROM_O32(_prom_printf, (int (*)(char *, ...), char *, ...));
128
129
130#define rex_bootinit() _rex_bootinit(__rex_bootinit)
131#define rex_bootread() _rex_bootread(__rex_bootread)
132#define rex_getbitmap(x) _rex_getbitmap(__rex_getbitmap, x)
133#define rex_slot_address(x) _rex_slot_address(__rex_slot_address, x)
134#define rex_gettcinfo() _rex_gettcinfo(__rex_gettcinfo)
135#define rex_getsysid() _rex_getsysid(__rex_getsysid)
136#define rex_clear_cache() _rex_clear_cache(__rex_clear_cache)
137
138#define prom_getchar() _prom_getchar(__prom_getchar)
139#define prom_getenv(x) _prom_getenv(__prom_getenv, x)
140#define prom_printf(x...) _prom_printf(__prom_printf, x)
141
142#else /* !CONFIG_64BIT */
143
144/*
145 * On plain MIPS we just call PROM functions directly.
146 */
147#define rex_bootinit __rex_bootinit
148#define rex_bootread __rex_bootread
149#define rex_getbitmap __rex_getbitmap
150#define rex_slot_address __rex_slot_address
151#define rex_gettcinfo __rex_gettcinfo
152#define rex_getsysid __rex_getsysid
153#define rex_clear_cache __rex_clear_cache
154
155#define prom_getchar __prom_getchar
156#define prom_getenv __prom_getenv
157#define prom_printf __prom_printf
158
159#define pmax_open __pmax_open
160#define pmax_lseek __pmax_lseek
161#define pmax_read __pmax_read
162#define pmax_close __pmax_close
163
164#endif /* !CONFIG_64BIT */
165
166
167extern void prom_meminit(u32);
168extern void prom_identify_arch(u32);
169extern void prom_init_cmdline(s32, s32 *, u32);
170
171extern void register_prom_console(void);
172extern void unregister_prom_console(void);
173
174#endif /* _ASM_DEC_PROM_H */
diff --git a/include/asm-mips/dec/system.h b/include/asm-mips/dec/system.h
deleted file mode 100644
index b2afaccd6831..000000000000
--- a/include/asm-mips/dec/system.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-mips/dec/system.h
3 *
4 * Generic DECstation/DECsystem bits.
5 *
6 * Copyright (C) 2005, 2006 Maciej W. Rozycki
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#ifndef __ASM_DEC_SYSTEM_H
14#define __ASM_DEC_SYSTEM_H
15
16extern unsigned long dec_kn_slot_base, dec_kn_slot_size;
17extern int dec_tc_bus;
18
19#endif /* __ASM_DEC_SYSTEM_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
deleted file mode 100644
index b0bccd2c4ed5..000000000000
--- a/include/asm-mips/delay.h
+++ /dev/null
@@ -1,112 +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) 1994 by Waldorf Electronics
7 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2007 Maciej W. Rozycki
10 */
11#ifndef _ASM_DELAY_H
12#define _ASM_DELAY_H
13
14#include <linux/param.h>
15#include <linux/smp.h>
16
17#include <asm/compiler.h>
18#include <asm/war.h>
19
20static inline void __delay(unsigned long loops)
21{
22 if (sizeof(long) == 4)
23 __asm__ __volatile__ (
24 " .set noreorder \n"
25 " .align 3 \n"
26 "1: bnez %0, 1b \n"
27 " subu %0, 1 \n"
28 " .set reorder \n"
29 : "=r" (loops)
30 : "0" (loops));
31 else if (sizeof(long) == 8 && !DADDI_WAR)
32 __asm__ __volatile__ (
33 " .set noreorder \n"
34 " .align 3 \n"
35 "1: bnez %0, 1b \n"
36 " dsubu %0, 1 \n"
37 " .set reorder \n"
38 : "=r" (loops)
39 : "0" (loops));
40 else if (sizeof(long) == 8 && DADDI_WAR)
41 __asm__ __volatile__ (
42 " .set noreorder \n"
43 " .align 3 \n"
44 "1: bnez %0, 1b \n"
45 " dsubu %0, %2 \n"
46 " .set reorder \n"
47 : "=r" (loops)
48 : "0" (loops), "r" (1));
49}
50
51
52/*
53 * Division by multiplication: you don't have to worry about
54 * loss of precision.
55 *
56 * Use only for very small delays ( < 1 msec). Should probably use a
57 * lookup table, really, as the multiplications take much too long with
58 * short delays. This is a "reasonable" implementation, though (and the
59 * first constant multiplications gets optimized away if the delay is
60 * a constant)
61 */
62
63static inline void __udelay(unsigned long usecs, unsigned long lpj)
64{
65 unsigned long hi, lo;
66
67 /*
68 * The rates of 128 is rounded wrongly by the catchall case
69 * for 64-bit. Excessive precission? Probably ...
70 */
71#if defined(CONFIG_64BIT) && (HZ == 128)
72 usecs *= 0x0008637bd05af6c7UL; /* 2**64 / (1000000 / HZ) */
73#elif defined(CONFIG_64BIT)
74 usecs *= (0x8000000000000000UL / (500000 / HZ));
75#else /* 32-bit junk follows here */
76 usecs *= (unsigned long) (((0x8000000000000000ULL / (500000 / HZ)) +
77 0x80000000ULL) >> 32);
78#endif
79
80 if (sizeof(long) == 4)
81 __asm__("multu\t%2, %3"
82 : "=h" (usecs), "=l" (lo)
83 : "r" (usecs), "r" (lpj)
84 : GCC_REG_ACCUM);
85 else if (sizeof(long) == 8 && !R4000_WAR)
86 __asm__("dmultu\t%2, %3"
87 : "=h" (usecs), "=l" (lo)
88 : "r" (usecs), "r" (lpj)
89 : GCC_REG_ACCUM);
90 else if (sizeof(long) == 8 && R4000_WAR)
91 __asm__("dmultu\t%3, %4\n\tmfhi\t%0"
92 : "=r" (usecs), "=h" (hi), "=l" (lo)
93 : "r" (usecs), "r" (lpj)
94 : GCC_REG_ACCUM);
95
96 __delay(usecs);
97}
98
99#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
100
101#define udelay(usecs) __udelay((usecs), __udelay_val)
102
103/* make sure "usecs *= ..." in udelay do not overflow. */
104#if HZ >= 1000
105#define MAX_UDELAY_MS 1
106#elif HZ <= 200
107#define MAX_UDELAY_MS 5
108#else
109#define MAX_UDELAY_MS (1000 / HZ)
110#endif
111
112#endif /* _ASM_DELAY_H */
diff --git a/include/asm-mips/device.h b/include/asm-mips/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-mips/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-mips/div64.h b/include/asm-mips/div64.h
deleted file mode 100644
index d1d699105c11..000000000000
--- a/include/asm-mips/div64.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * Copyright (C) 2000, 2004 Maciej W. Rozycki
3 * Copyright (C) 2003, 07 Ralf Baechle (ralf@linux-mips.org)
4 *
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
7 * for more details.
8 */
9#ifndef _ASM_DIV64_H
10#define _ASM_DIV64_H
11
12#include <linux/types.h>
13
14#if (_MIPS_SZLONG == 32)
15
16#include <asm/compiler.h>
17
18/*
19 * No traps on overflows for any of these...
20 */
21
22#define do_div64_32(res, high, low, base) ({ \
23 unsigned long __quot32, __mod32; \
24 unsigned long __cf, __tmp, __tmp2, __i; \
25 \
26 __asm__(".set push\n\t" \
27 ".set noat\n\t" \
28 ".set noreorder\n\t" \
29 "move %2, $0\n\t" \
30 "move %3, $0\n\t" \
31 "b 1f\n\t" \
32 " li %4, 0x21\n" \
33 "0:\n\t" \
34 "sll $1, %0, 0x1\n\t" \
35 "srl %3, %0, 0x1f\n\t" \
36 "or %0, $1, %5\n\t" \
37 "sll %1, %1, 0x1\n\t" \
38 "sll %2, %2, 0x1\n" \
39 "1:\n\t" \
40 "bnez %3, 2f\n\t" \
41 " sltu %5, %0, %z6\n\t" \
42 "bnez %5, 3f\n" \
43 "2:\n\t" \
44 " addiu %4, %4, -1\n\t" \
45 "subu %0, %0, %z6\n\t" \
46 "addiu %2, %2, 1\n" \
47 "3:\n\t" \
48 "bnez %4, 0b\n\t" \
49 " srl %5, %1, 0x1f\n\t" \
50 ".set pop" \
51 : "=&r" (__mod32), "=&r" (__tmp), \
52 "=&r" (__quot32), "=&r" (__cf), \
53 "=&r" (__i), "=&r" (__tmp2) \
54 : "Jr" (base), "0" (high), "1" (low)); \
55 \
56 (res) = __quot32; \
57 __mod32; })
58
59#define do_div(n, base) ({ \
60 unsigned long long __quot; \
61 unsigned long __mod; \
62 unsigned long long __div; \
63 unsigned long __upper, __low, __high, __base; \
64 \
65 __div = (n); \
66 __base = (base); \
67 \
68 __high = __div >> 32; \
69 __low = __div; \
70 __upper = __high; \
71 \
72 if (__high) \
73 __asm__("divu $0, %z2, %z3" \
74 : "=h" (__upper), "=l" (__high) \
75 : "Jr" (__high), "Jr" (__base) \
76 : GCC_REG_ACCUM); \
77 \
78 __mod = do_div64_32(__low, __upper, __low, __base); \
79 \
80 __quot = __high; \
81 __quot = __quot << 32 | __low; \
82 (n) = __quot; \
83 __mod; })
84
85#endif /* (_MIPS_SZLONG == 32) */
86
87#if (_MIPS_SZLONG == 64)
88
89/*
90 * Hey, we're already 64-bit, no
91 * need to play games..
92 */
93#define do_div(n, base) ({ \
94 unsigned long __quot; \
95 unsigned int __mod; \
96 unsigned long __div; \
97 unsigned int __base; \
98 \
99 __div = (n); \
100 __base = (base); \
101 \
102 __mod = __div % __base; \
103 __quot = __div / __base; \
104 \
105 (n) = __quot; \
106 __mod; })
107
108#endif /* (_MIPS_SZLONG == 64) */
109
110#endif /* _ASM_DIV64_H */
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
deleted file mode 100644
index c64afb40cd06..000000000000
--- a/include/asm-mips/dma-mapping.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5#include <asm/cache.h>
6
7void *dma_alloc_noncoherent(struct device *dev, size_t size,
8 dma_addr_t *dma_handle, gfp_t flag);
9
10void dma_free_noncoherent(struct device *dev, size_t size,
11 void *vaddr, dma_addr_t dma_handle);
12
13void *dma_alloc_coherent(struct device *dev, size_t size,
14 dma_addr_t *dma_handle, gfp_t flag);
15
16void dma_free_coherent(struct device *dev, size_t size,
17 void *vaddr, dma_addr_t dma_handle);
18
19extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
20 enum dma_data_direction direction);
21extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
22 size_t size, enum dma_data_direction direction);
23extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
24 enum dma_data_direction direction);
25extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
26 unsigned long offset, size_t size, enum dma_data_direction direction);
27extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
28 size_t size, enum dma_data_direction direction);
29extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
30 int nhwentries, enum dma_data_direction direction);
31extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
32 size_t size, enum dma_data_direction direction);
33extern void dma_sync_single_for_device(struct device *dev,
34 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction);
35extern void dma_sync_single_range_for_cpu(struct device *dev,
36 dma_addr_t dma_handle, unsigned long offset, size_t size,
37 enum dma_data_direction direction);
38extern void dma_sync_single_range_for_device(struct device *dev,
39 dma_addr_t dma_handle, unsigned long offset, size_t size,
40 enum dma_data_direction direction);
41extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
42 int nelems, enum dma_data_direction direction);
43extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
44 int nelems, enum dma_data_direction direction);
45extern int dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
46extern int dma_supported(struct device *dev, u64 mask);
47
48static inline int
49dma_set_mask(struct device *dev, u64 mask)
50{
51 if(!dev->dma_mask || !dma_supported(dev, mask))
52 return -EIO;
53
54 *dev->dma_mask = mask;
55
56 return 0;
57}
58
59static inline int
60dma_get_cache_alignment(void)
61{
62 /* XXX Largest on any MIPS */
63 return 128;
64}
65
66extern int dma_is_consistent(struct device *dev, dma_addr_t dma_addr);
67
68extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
69 enum dma_data_direction direction);
70
71#if 0
72#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
73
74extern int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
75 dma_addr_t device_addr, size_t size, int flags);
76extern void dma_release_declared_memory(struct device *dev);
77extern void * dma_mark_declared_memory_occupied(struct device *dev,
78 dma_addr_t device_addr, size_t size);
79#endif
80
81#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
deleted file mode 100644
index 1353c81065d1..000000000000
--- a/include/asm-mips/dma.h
+++ /dev/null
@@ -1,315 +0,0 @@
1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen
5 * and John Boyd, Nov. 1992.
6 *
7 * NOTE: all this is true *only* for ISA/EISA expansions on Mips boards
8 * and can only be used for expansion cards. Onboard DMA controllers, such
9 * as the R4030 on Jazz boards behave totally different!
10 */
11
12#ifndef _ASM_DMA_H
13#define _ASM_DMA_H
14
15#include <asm/io.h> /* need byte IO */
16#include <linux/spinlock.h> /* And spinlocks */
17#include <linux/delay.h>
18#include <asm/system.h>
19
20
21#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
22#define dma_outb outb_p
23#else
24#define dma_outb outb
25#endif
26
27#define dma_inb inb
28
29/*
30 * NOTES about DMA transfers:
31 *
32 * controller 1: channels 0-3, byte operations, ports 00-1F
33 * controller 2: channels 4-7, word operations, ports C0-DF
34 *
35 * - ALL registers are 8 bits only, regardless of transfer size
36 * - channel 4 is not used - cascades 1 into 2.
37 * - channels 0-3 are byte - addresses/counts are for physical bytes
38 * - channels 5-7 are word - addresses/counts are for physical words
39 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
40 * - transfer count loaded to registers is 1 less than actual count
41 * - controller 2 offsets are all even (2x offsets for controller 1)
42 * - page registers for 5-7 don't use data bit 0, represent 128K pages
43 * - page registers for 0-3 use bit 0, represent 64K pages
44 *
45 * DMA transfers are limited to the lower 16MB of _physical_ memory.
46 * Note that addresses loaded into registers must be _physical_ addresses,
47 * not logical addresses (which may differ if paging is active).
48 *
49 * Address mapping for channels 0-3:
50 *
51 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
52 * | ... | | ... | | ... |
53 * | ... | | ... | | ... |
54 * | ... | | ... | | ... |
55 * P7 ... P0 A7 ... A0 A7 ... A0
56 * | Page | Addr MSB | Addr LSB | (DMA registers)
57 *
58 * Address mapping for channels 5-7:
59 *
60 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
61 * | ... | \ \ ... \ \ \ ... \ \
62 * | ... | \ \ ... \ \ \ ... \ (not used)
63 * | ... | \ \ ... \ \ \ ... \
64 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
65 * | Page | Addr MSB | Addr LSB | (DMA registers)
66 *
67 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
68 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
69 * the hardware level, so odd-byte transfers aren't possible).
70 *
71 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
72 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
73 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
74 *
75 */
76
77#ifndef CONFIG_GENERIC_ISA_DMA_SUPPORT_BROKEN
78#define MAX_DMA_CHANNELS 8
79#endif
80
81/*
82 * The maximum address in KSEG0 that we can perform a DMA transfer to on this
83 * platform. This describes only the PC style part of the DMA logic like on
84 * Deskstations or Acer PICA but not the much more versatile DMA logic used
85 * for the local devices on Acer PICA or Magnums.
86 */
87#if defined(CONFIG_SGI_IP22) || defined(CONFIG_SGI_IP28)
88/* don't care; ISA bus master won't work, ISA slave DMA supports 32bit addr */
89#define MAX_DMA_ADDRESS PAGE_OFFSET
90#else
91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
92#endif
93#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
94#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
95
96/* 8237 DMA controllers */
97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
98#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
99
100/* DMA controller registers */
101#define DMA1_CMD_REG 0x08 /* command register (w) */
102#define DMA1_STAT_REG 0x08 /* status register (r) */
103#define DMA1_REQ_REG 0x09 /* request register (w) */
104#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
105#define DMA1_MODE_REG 0x0B /* mode register (w) */
106#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
107#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
108#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
109#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
110#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
111
112#define DMA2_CMD_REG 0xD0 /* command register (w) */
113#define DMA2_STAT_REG 0xD0 /* status register (r) */
114#define DMA2_REQ_REG 0xD2 /* request register (w) */
115#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
116#define DMA2_MODE_REG 0xD6 /* mode register (w) */
117#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
118#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
119#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
120#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
121#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
122
123#define DMA_ADDR_0 0x00 /* DMA address registers */
124#define DMA_ADDR_1 0x02
125#define DMA_ADDR_2 0x04
126#define DMA_ADDR_3 0x06
127#define DMA_ADDR_4 0xC0
128#define DMA_ADDR_5 0xC4
129#define DMA_ADDR_6 0xC8
130#define DMA_ADDR_7 0xCC
131
132#define DMA_CNT_0 0x01 /* DMA count registers */
133#define DMA_CNT_1 0x03
134#define DMA_CNT_2 0x05
135#define DMA_CNT_3 0x07
136#define DMA_CNT_4 0xC2
137#define DMA_CNT_5 0xC6
138#define DMA_CNT_6 0xCA
139#define DMA_CNT_7 0xCE
140
141#define DMA_PAGE_0 0x87 /* DMA page registers */
142#define DMA_PAGE_1 0x83
143#define DMA_PAGE_2 0x81
144#define DMA_PAGE_3 0x82
145#define DMA_PAGE_5 0x8B
146#define DMA_PAGE_6 0x89
147#define DMA_PAGE_7 0x8A
148
149#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
150#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
151#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
152
153#define DMA_AUTOINIT 0x10
154
155extern spinlock_t dma_spin_lock;
156
157static __inline__ unsigned long claim_dma_lock(void)
158{
159 unsigned long flags;
160 spin_lock_irqsave(&dma_spin_lock, flags);
161 return flags;
162}
163
164static __inline__ void release_dma_lock(unsigned long flags)
165{
166 spin_unlock_irqrestore(&dma_spin_lock, flags);
167}
168
169/* enable/disable a specific DMA channel */
170static __inline__ void enable_dma(unsigned int dmanr)
171{
172 if (dmanr<=3)
173 dma_outb(dmanr, DMA1_MASK_REG);
174 else
175 dma_outb(dmanr & 3, DMA2_MASK_REG);
176}
177
178static __inline__ void disable_dma(unsigned int dmanr)
179{
180 if (dmanr<=3)
181 dma_outb(dmanr | 4, DMA1_MASK_REG);
182 else
183 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
184}
185
186/* Clear the 'DMA Pointer Flip Flop'.
187 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
188 * Use this once to initialize the FF to a known state.
189 * After that, keep track of it. :-)
190 * --- In order to do that, the DMA routines below should ---
191 * --- only be used while holding the DMA lock ! ---
192 */
193static __inline__ void clear_dma_ff(unsigned int dmanr)
194{
195 if (dmanr<=3)
196 dma_outb(0, DMA1_CLEAR_FF_REG);
197 else
198 dma_outb(0, DMA2_CLEAR_FF_REG);
199}
200
201/* set mode (above) for a specific DMA channel */
202static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
203{
204 if (dmanr<=3)
205 dma_outb(mode | dmanr, DMA1_MODE_REG);
206 else
207 dma_outb(mode | (dmanr&3), DMA2_MODE_REG);
208}
209
210/* Set only the page register bits of the transfer address.
211 * This is used for successive transfers when we know the contents of
212 * the lower 16 bits of the DMA current address register, but a 64k boundary
213 * may have been crossed.
214 */
215static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
216{
217 switch(dmanr) {
218 case 0:
219 dma_outb(pagenr, DMA_PAGE_0);
220 break;
221 case 1:
222 dma_outb(pagenr, DMA_PAGE_1);
223 break;
224 case 2:
225 dma_outb(pagenr, DMA_PAGE_2);
226 break;
227 case 3:
228 dma_outb(pagenr, DMA_PAGE_3);
229 break;
230 case 5:
231 dma_outb(pagenr & 0xfe, DMA_PAGE_5);
232 break;
233 case 6:
234 dma_outb(pagenr & 0xfe, DMA_PAGE_6);
235 break;
236 case 7:
237 dma_outb(pagenr & 0xfe, DMA_PAGE_7);
238 break;
239 }
240}
241
242
243/* Set transfer address & page bits for specific DMA channel.
244 * Assumes dma flipflop is clear.
245 */
246static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
247{
248 set_dma_page(dmanr, a>>16);
249 if (dmanr <= 3) {
250 dma_outb( a & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
251 dma_outb( (a>>8) & 0xff, ((dmanr&3)<<1) + IO_DMA1_BASE );
252 } else {
253 dma_outb( (a>>1) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
254 dma_outb( (a>>9) & 0xff, ((dmanr&3)<<2) + IO_DMA2_BASE );
255 }
256}
257
258
259/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for
260 * a specific DMA channel.
261 * You must ensure the parameters are valid.
262 * NOTE: from a manual: "the number of transfers is one more
263 * than the initial word count"! This is taken into account.
264 * Assumes dma flip-flop is clear.
265 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
266 */
267static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
268{
269 count--;
270 if (dmanr <= 3) {
271 dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
272 dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
273 } else {
274 dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
275 dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
276 }
277}
278
279
280/* Get DMA residue count. After a DMA transfer, this
281 * should return zero. Reading this while a DMA transfer is
282 * still in progress will return unpredictable results.
283 * If called before the channel has been used, it may return 1.
284 * Otherwise, it returns the number of _bytes_ left to transfer.
285 *
286 * Assumes DMA flip-flop is clear.
287 */
288static __inline__ int get_dma_residue(unsigned int dmanr)
289{
290 unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
291 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
292
293 /* using short to get 16-bit wrap around */
294 unsigned short count;
295
296 count = 1 + dma_inb(io_port);
297 count += dma_inb(io_port) << 8;
298
299 return (dmanr<=3)? count : (count<<1);
300}
301
302
303/* These are in kernel/dma.c: */
304extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
305extern void free_dma(unsigned int dmanr); /* release it again */
306
307/* From PCI */
308
309#ifdef CONFIG_PCI
310extern int isa_dma_bridge_buggy;
311#else
312#define isa_dma_bridge_buggy (0)
313#endif
314
315#endif /* _ASM_DMA_H */
diff --git a/include/asm-mips/ds1286.h b/include/asm-mips/ds1286.h
deleted file mode 100644
index 6983b6ff0af3..000000000000
--- a/include/asm-mips/ds1286.h
+++ /dev/null
@@ -1,15 +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 * Machine dependent access functions for RTC registers.
7 *
8 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
9 */
10#ifndef _ASM_DS1286_H
11#define _ASM_DS1286_H
12
13#include <ds1286.h>
14
15#endif /* _ASM_DS1286_H */
diff --git a/include/asm-mips/ds1287.h b/include/asm-mips/ds1287.h
deleted file mode 100644
index ba1702e86931..000000000000
--- a/include/asm-mips/ds1287.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * DS1287 timer functions.
3 *
4 * Copyright (C) 2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#ifndef __ASM_DS1287_H
21#define __ASM_DS1287_H
22
23extern int ds1287_timer_state(void);
24extern void ds1287_set_base_clock(unsigned int clock);
25extern int ds1287_clockevent_init(int irq);
26
27#endif
diff --git a/include/asm-mips/dsp.h b/include/asm-mips/dsp.h
deleted file mode 100644
index e9bfc0813c72..000000000000
--- a/include/asm-mips/dsp.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Copyright (C) 2005 Mips Technologies
3 * Author: Chris Dearman, chris@mips.com derived from fpu.h
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 by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_DSP_H
11#define _ASM_DSP_H
12
13#include <asm/cpu.h>
14#include <asm/cpu-features.h>
15#include <asm/hazards.h>
16#include <asm/mipsregs.h>
17
18#define DSP_DEFAULT 0x00000000
19#define DSP_MASK 0x3ff
20
21#define __enable_dsp_hazard() \
22do { \
23 asm("_ehb"); \
24} while (0)
25
26static inline void __init_dsp(void)
27{
28 mthi1(0);
29 mtlo1(0);
30 mthi2(0);
31 mtlo2(0);
32 mthi3(0);
33 mtlo3(0);
34 wrdsp(DSP_DEFAULT, DSP_MASK);
35}
36
37static inline void init_dsp(void)
38{
39 if (cpu_has_dsp)
40 __init_dsp();
41}
42
43#define __save_dsp(tsk) \
44do { \
45 tsk->thread.dsp.dspr[0] = mfhi1(); \
46 tsk->thread.dsp.dspr[1] = mflo1(); \
47 tsk->thread.dsp.dspr[2] = mfhi2(); \
48 tsk->thread.dsp.dspr[3] = mflo2(); \
49 tsk->thread.dsp.dspr[4] = mfhi3(); \
50 tsk->thread.dsp.dspr[5] = mflo3(); \
51 tsk->thread.dsp.dspcontrol = rddsp(DSP_MASK); \
52} while (0)
53
54#define save_dsp(tsk) \
55do { \
56 if (cpu_has_dsp) \
57 __save_dsp(tsk); \
58} while (0)
59
60#define __restore_dsp(tsk) \
61do { \
62 mthi1(tsk->thread.dsp.dspr[0]); \
63 mtlo1(tsk->thread.dsp.dspr[1]); \
64 mthi2(tsk->thread.dsp.dspr[2]); \
65 mtlo2(tsk->thread.dsp.dspr[3]); \
66 mthi3(tsk->thread.dsp.dspr[4]); \
67 mtlo3(tsk->thread.dsp.dspr[5]); \
68 wrdsp(tsk->thread.dsp.dspcontrol, DSP_MASK); \
69} while (0)
70
71#define restore_dsp(tsk) \
72do { \
73 if (cpu_has_dsp) \
74 __restore_dsp(tsk); \
75} while (0)
76
77#define __get_dsp_regs(tsk) \
78({ \
79 if (tsk == current) \
80 __save_dsp(current); \
81 \
82 tsk->thread.dsp.dspr; \
83})
84
85#endif /* _ASM_DSP_H */
diff --git a/include/asm-mips/edac.h b/include/asm-mips/edac.h
deleted file mode 100644
index 4da0c1fe30d9..000000000000
--- a/include/asm-mips/edac.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef ASM_EDAC_H
2#define ASM_EDAC_H
3
4/* ECC atomic, DMA, SMP and interrupt safe scrub function */
5
6static inline void atomic_scrub(void *va, u32 size)
7{
8 unsigned long *virt_addr = va;
9 unsigned long temp;
10 u32 i;
11
12 for (i = 0; i < size / sizeof(unsigned long); i++) {
13 /*
14 * Very carefully read and write to memory atomically
15 * so we are interrupt, DMA and SMP safe.
16 *
17 * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
18 */
19
20 __asm__ __volatile__ (
21 " .set mips2 \n"
22 "1: ll %0, %1 # atomic_scrub \n"
23 " addu %0, $0 \n"
24 " sc %0, %1 \n"
25 " beqz %0, 1b \n"
26 " .set mips0 \n"
27 : "=&r" (temp), "=m" (*virt_addr)
28 : "m" (*virt_addr));
29
30 virt_addr++;
31 }
32}
33
34#endif
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
deleted file mode 100644
index f69f7acba637..000000000000
--- a/include/asm-mips/elf.h
+++ /dev/null
@@ -1,371 +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 * Much of this is taken from binutils and GNU libc ...
7 */
8#ifndef _ASM_ELF_H
9#define _ASM_ELF_H
10
11
12/* ELF header e_flags defines. */
13/* MIPS architecture level. */
14#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
15#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
16#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
17#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
18#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
19#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
20#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
21#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32 R2 code. */
22#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64 R2 code. */
23
24/* The ABI of a file. */
25#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
26#define EF_MIPS_ABI_O64 0x00002000 /* O32 extended for 64 bit. */
27
28#define PT_MIPS_REGINFO 0x70000000
29#define PT_MIPS_RTPROC 0x70000001
30#define PT_MIPS_OPTIONS 0x70000002
31
32/* Flags in the e_flags field of the header */
33#define EF_MIPS_NOREORDER 0x00000001
34#define EF_MIPS_PIC 0x00000002
35#define EF_MIPS_CPIC 0x00000004
36#define EF_MIPS_ABI2 0x00000020
37#define EF_MIPS_OPTIONS_FIRST 0x00000080
38#define EF_MIPS_32BITMODE 0x00000100
39#define EF_MIPS_ABI 0x0000f000
40#define EF_MIPS_ARCH 0xf0000000
41
42#define DT_MIPS_RLD_VERSION 0x70000001
43#define DT_MIPS_TIME_STAMP 0x70000002
44#define DT_MIPS_ICHECKSUM 0x70000003
45#define DT_MIPS_IVERSION 0x70000004
46#define DT_MIPS_FLAGS 0x70000005
47 #define RHF_NONE 0x00000000
48 #define RHF_HARDWAY 0x00000001
49 #define RHF_NOTPOT 0x00000002
50 #define RHF_SGI_ONLY 0x00000010
51#define DT_MIPS_BASE_ADDRESS 0x70000006
52#define DT_MIPS_CONFLICT 0x70000008
53#define DT_MIPS_LIBLIST 0x70000009
54#define DT_MIPS_LOCAL_GOTNO 0x7000000a
55#define DT_MIPS_CONFLICTNO 0x7000000b
56#define DT_MIPS_LIBLISTNO 0x70000010
57#define DT_MIPS_SYMTABNO 0x70000011
58#define DT_MIPS_UNREFEXTNO 0x70000012
59#define DT_MIPS_GOTSYM 0x70000013
60#define DT_MIPS_HIPAGENO 0x70000014
61#define DT_MIPS_RLD_MAP 0x70000016
62
63#define R_MIPS_NONE 0
64#define R_MIPS_16 1
65#define R_MIPS_32 2
66#define R_MIPS_REL32 3
67#define R_MIPS_26 4
68#define R_MIPS_HI16 5
69#define R_MIPS_LO16 6
70#define R_MIPS_GPREL16 7
71#define R_MIPS_LITERAL 8
72#define R_MIPS_GOT16 9
73#define R_MIPS_PC16 10
74#define R_MIPS_CALL16 11
75#define R_MIPS_GPREL32 12
76/* The remaining relocs are defined on Irix, although they are not
77 in the MIPS ELF ABI. */
78#define R_MIPS_UNUSED1 13
79#define R_MIPS_UNUSED2 14
80#define R_MIPS_UNUSED3 15
81#define R_MIPS_SHIFT5 16
82#define R_MIPS_SHIFT6 17
83#define R_MIPS_64 18
84#define R_MIPS_GOT_DISP 19
85#define R_MIPS_GOT_PAGE 20
86#define R_MIPS_GOT_OFST 21
87/*
88 * The following two relocation types are specified in the MIPS ABI
89 * conformance guide version 1.2 but not yet in the psABI.
90 */
91#define R_MIPS_GOTHI16 22
92#define R_MIPS_GOTLO16 23
93#define R_MIPS_SUB 24
94#define R_MIPS_INSERT_A 25
95#define R_MIPS_INSERT_B 26
96#define R_MIPS_DELETE 27
97#define R_MIPS_HIGHER 28
98#define R_MIPS_HIGHEST 29
99/*
100 * The following two relocation types are specified in the MIPS ABI
101 * conformance guide version 1.2 but not yet in the psABI.
102 */
103#define R_MIPS_CALLHI16 30
104#define R_MIPS_CALLLO16 31
105/*
106 * This range is reserved for vendor specific relocations.
107 */
108#define R_MIPS_LOVENDOR 100
109#define R_MIPS_HIVENDOR 127
110
111#define SHN_MIPS_ACCOMON 0xff00 /* Allocated common symbols */
112#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
113#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
114#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
115#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
116
117#define SHT_MIPS_LIST 0x70000000
118#define SHT_MIPS_CONFLICT 0x70000002
119#define SHT_MIPS_GPTAB 0x70000003
120#define SHT_MIPS_UCODE 0x70000004
121#define SHT_MIPS_DEBUG 0x70000005
122#define SHT_MIPS_REGINFO 0x70000006
123#define SHT_MIPS_PACKAGE 0x70000007
124#define SHT_MIPS_PACKSYM 0x70000008
125#define SHT_MIPS_RELD 0x70000009
126#define SHT_MIPS_IFACE 0x7000000b
127#define SHT_MIPS_CONTENT 0x7000000c
128#define SHT_MIPS_OPTIONS 0x7000000d
129#define SHT_MIPS_SHDR 0x70000010
130#define SHT_MIPS_FDESC 0x70000011
131#define SHT_MIPS_EXTSYM 0x70000012
132#define SHT_MIPS_DENSE 0x70000013
133#define SHT_MIPS_PDESC 0x70000014
134#define SHT_MIPS_LOCSYM 0x70000015
135#define SHT_MIPS_AUXSYM 0x70000016
136#define SHT_MIPS_OPTSYM 0x70000017
137#define SHT_MIPS_LOCSTR 0x70000018
138#define SHT_MIPS_LINE 0x70000019
139#define SHT_MIPS_RFDESC 0x7000001a
140#define SHT_MIPS_DELTASYM 0x7000001b
141#define SHT_MIPS_DELTAINST 0x7000001c
142#define SHT_MIPS_DELTACLASS 0x7000001d
143#define SHT_MIPS_DWARF 0x7000001e
144#define SHT_MIPS_DELTADECL 0x7000001f
145#define SHT_MIPS_SYMBOL_LIB 0x70000020
146#define SHT_MIPS_EVENTS 0x70000021
147#define SHT_MIPS_TRANSLATE 0x70000022
148#define SHT_MIPS_PIXIE 0x70000023
149#define SHT_MIPS_XLATE 0x70000024
150#define SHT_MIPS_XLATE_DEBUG 0x70000025
151#define SHT_MIPS_WHIRL 0x70000026
152#define SHT_MIPS_EH_REGION 0x70000027
153#define SHT_MIPS_XLATE_OLD 0x70000028
154#define SHT_MIPS_PDR_EXCEPTION 0x70000029
155
156#define SHF_MIPS_GPREL 0x10000000
157#define SHF_MIPS_MERGE 0x20000000
158#define SHF_MIPS_ADDR 0x40000000
159#define SHF_MIPS_STRING 0x80000000
160#define SHF_MIPS_NOSTRIP 0x08000000
161#define SHF_MIPS_LOCAL 0x04000000
162#define SHF_MIPS_NAMES 0x02000000
163#define SHF_MIPS_NODUPES 0x01000000
164
165#ifndef ELF_ARCH
166/* ELF register definitions */
167#define ELF_NGREG 45
168#define ELF_NFPREG 33
169
170typedef unsigned long elf_greg_t;
171typedef elf_greg_t elf_gregset_t[ELF_NGREG];
172
173typedef double elf_fpreg_t;
174typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
175
176#ifdef CONFIG_32BIT
177
178/*
179 * This is used to ensure we don't load something for the wrong architecture.
180 */
181#define elf_check_arch(hdr) \
182({ \
183 int __res = 1; \
184 struct elfhdr *__h = (hdr); \
185 \
186 if (__h->e_machine != EM_MIPS) \
187 __res = 0; \
188 if (__h->e_ident[EI_CLASS] != ELFCLASS32) \
189 __res = 0; \
190 if ((__h->e_flags & EF_MIPS_ABI2) != 0) \
191 __res = 0; \
192 if (((__h->e_flags & EF_MIPS_ABI) != 0) && \
193 ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) \
194 __res = 0; \
195 \
196 __res; \
197})
198
199/*
200 * These are used to set parameters in the core dumps.
201 */
202#define ELF_CLASS ELFCLASS32
203
204#endif /* CONFIG_32BIT */
205
206#ifdef CONFIG_64BIT
207/*
208 * This is used to ensure we don't load something for the wrong architecture.
209 */
210#define elf_check_arch(hdr) \
211({ \
212 int __res = 1; \
213 struct elfhdr *__h = (hdr); \
214 \
215 if (__h->e_machine != EM_MIPS) \
216 __res = 0; \
217 if (__h->e_ident[EI_CLASS] != ELFCLASS64) \
218 __res = 0; \
219 \
220 __res; \
221})
222
223/*
224 * These are used to set parameters in the core dumps.
225 */
226#define ELF_CLASS ELFCLASS64
227
228#endif /* CONFIG_64BIT */
229
230/*
231 * These are used to set parameters in the core dumps.
232 */
233#ifdef __MIPSEB__
234#define ELF_DATA ELFDATA2MSB
235#elif __MIPSEL__
236#define ELF_DATA ELFDATA2LSB
237#endif
238#define ELF_ARCH EM_MIPS
239
240#endif /* !defined(ELF_ARCH) */
241
242struct mips_abi;
243
244extern struct mips_abi mips_abi;
245extern struct mips_abi mips_abi_32;
246extern struct mips_abi mips_abi_n32;
247
248#ifdef CONFIG_32BIT
249
250#define SET_PERSONALITY(ex, ibcs2) \
251do { \
252 if (ibcs2) \
253 set_personality(PER_SVR4); \
254 set_personality(PER_LINUX); \
255 \
256 current->thread.abi = &mips_abi; \
257} while (0)
258
259#endif /* CONFIG_32BIT */
260
261#ifdef CONFIG_64BIT
262
263#ifdef CONFIG_MIPS32_N32
264#define __SET_PERSONALITY32_N32() \
265 do { \
266 set_thread_flag(TIF_32BIT_ADDR); \
267 current->thread.abi = &mips_abi_n32; \
268 } while (0)
269#else
270#define __SET_PERSONALITY32_N32() \
271 do { } while (0)
272#endif
273
274#ifdef CONFIG_MIPS32_O32
275#define __SET_PERSONALITY32_O32() \
276 do { \
277 set_thread_flag(TIF_32BIT_REGS); \
278 set_thread_flag(TIF_32BIT_ADDR); \
279 current->thread.abi = &mips_abi_32; \
280 } while (0)
281#else
282#define __SET_PERSONALITY32_O32() \
283 do { } while (0)
284#endif
285
286#ifdef CONFIG_MIPS32_COMPAT
287#define __SET_PERSONALITY32(ex) \
288do { \
289 if ((((ex).e_flags & EF_MIPS_ABI2) != 0) && \
290 ((ex).e_flags & EF_MIPS_ABI) == 0) \
291 __SET_PERSONALITY32_N32(); \
292 else \
293 __SET_PERSONALITY32_O32(); \
294} while (0)
295#else
296#define __SET_PERSONALITY32(ex) do { } while (0)
297#endif
298
299#define SET_PERSONALITY(ex, ibcs2) \
300do { \
301 clear_thread_flag(TIF_32BIT_REGS); \
302 clear_thread_flag(TIF_32BIT_ADDR); \
303 \
304 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
305 __SET_PERSONALITY32(ex); \
306 else \
307 current->thread.abi = &mips_abi; \
308 \
309 if (ibcs2) \
310 set_personality(PER_SVR4); \
311 else if (current->personality != PER_LINUX32) \
312 set_personality(PER_LINUX); \
313} while (0)
314
315#endif /* CONFIG_64BIT */
316
317struct task_struct;
318
319extern void elf_dump_regs(elf_greg_t *, struct pt_regs *regs);
320extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
321extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
322
323#define ELF_CORE_COPY_REGS(elf_regs, regs) \
324 elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
325#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
326#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \
327 dump_task_fpu(tsk, elf_fpregs)
328
329#define USE_ELF_CORE_DUMP
330#define ELF_EXEC_PAGESIZE PAGE_SIZE
331
332/* This yields a mask that user programs can use to figure out what
333 instruction set this cpu supports. This could be done in userspace,
334 but it's not easy, and we've already done it here. */
335
336#define ELF_HWCAP (0)
337
338/* This yields a string that ld.so will use to load implementation
339 specific libraries for optimization. This is more specific in
340 intent than poking at uname or /proc/cpuinfo.
341
342 For the moment, we have only optimizations for the Intel generations,
343 but that could change... */
344
345#define ELF_PLATFORM (NULL)
346
347/*
348 * See comments in asm-alpha/elf.h, this is the same thing
349 * on the MIPS.
350 */
351#define ELF_PLAT_INIT(_r, load_addr) do { \
352 _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; \
353 _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; \
354 _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; \
355 _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; \
356 _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; \
357 _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; \
358 _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; \
359 _r->regs[30] = _r->regs[31] = 0; \
360} while (0)
361
362/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
363 use of this is to invoke "./ld.so someprog" to test out a new version of
364 the loader. We need to make sure that it is out of the way of the program
365 that it will "exec", and that there is sufficient room for the brk. */
366
367#ifndef ELF_ET_DYN_BASE
368#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
369#endif
370
371#endif /* _ASM_ELF_H */
diff --git a/include/asm-mips/emergency-restart.h b/include/asm-mips/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-mips/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-mips/emma2rh/emma2rh.h b/include/asm-mips/emma2rh/emma2rh.h
deleted file mode 100644
index 6a1af0af51e3..000000000000
--- a/include/asm-mips/emma2rh/emma2rh.h
+++ /dev/null
@@ -1,333 +0,0 @@
1/*
2 * include/asm-mips/emma2rh/emma2rh.h
3 * This file is EMMA2RH common header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24#ifndef __ASM_EMMA2RH_EMMA2RH_H
25#define __ASM_EMMA2RH_EMMA2RH_H
26
27#include <irq.h>
28
29/*
30 * EMMA2RH registers
31 */
32#define REGBASE 0x10000000
33
34#define EMMA2RH_BHIF_STRAP_0 (0x000010+REGBASE)
35#define EMMA2RH_BHIF_INT_ST_0 (0x000030+REGBASE)
36#define EMMA2RH_BHIF_INT_ST_1 (0x000034+REGBASE)
37#define EMMA2RH_BHIF_INT_ST_2 (0x000038+REGBASE)
38#define EMMA2RH_BHIF_INT_EN_0 (0x000040+REGBASE)
39#define EMMA2RH_BHIF_INT_EN_1 (0x000044+REGBASE)
40#define EMMA2RH_BHIF_INT_EN_2 (0x000048+REGBASE)
41#define EMMA2RH_BHIF_INT1_EN_0 (0x000050+REGBASE)
42#define EMMA2RH_BHIF_INT1_EN_1 (0x000054+REGBASE)
43#define EMMA2RH_BHIF_INT1_EN_2 (0x000058+REGBASE)
44#define EMMA2RH_BHIF_SW_INT (0x000070+REGBASE)
45#define EMMA2RH_BHIF_SW_INT_EN (0x000080+REGBASE)
46#define EMMA2RH_BHIF_SW_INT_CLR (0x000090+REGBASE)
47#define EMMA2RH_BHIF_MAIN_CTRL (0x0000b4+REGBASE)
48#define EMMA2RH_BHIF_EXCEPT_VECT_BASE_ADDRESS (0x0000c0+REGBASE)
49#define EMMA2RH_GPIO_DIR (0x110d20+REGBASE)
50#define EMMA2RH_GPIO_INT_ST (0x110d30+REGBASE)
51#define EMMA2RH_GPIO_INT_MASK (0x110d3c+REGBASE)
52#define EMMA2RH_GPIO_INT_MODE (0x110d48+REGBASE)
53#define EMMA2RH_GPIO_INT_CND_A (0x110d54+REGBASE)
54#define EMMA2RH_GPIO_INT_CND_B (0x110d60+REGBASE)
55#define EMMA2RH_PBRD_INT_EN (0x100010+REGBASE)
56#define EMMA2RH_PBRD_CLKSEL (0x100028+REGBASE)
57#define EMMA2RH_PFUR0_BASE (0x101000+REGBASE)
58#define EMMA2RH_PFUR1_BASE (0x102000+REGBASE)
59#define EMMA2RH_PFUR2_BASE (0x103000+REGBASE)
60#define EMMA2RH_PIIC0_BASE (0x107000+REGBASE)
61#define EMMA2RH_PIIC1_BASE (0x108000+REGBASE)
62#define EMMA2RH_PIIC2_BASE (0x109000+REGBASE)
63#define EMMA2RH_PCI_CONTROL (0x200000+REGBASE)
64#define EMMA2RH_PCI_ARBIT_CTR (0x200004+REGBASE)
65#define EMMA2RH_PCI_IWIN0_CTR (0x200010+REGBASE)
66#define EMMA2RH_PCI_IWIN1_CTR (0x200014+REGBASE)
67#define EMMA2RH_PCI_INIT_ESWP (0x200018+REGBASE)
68#define EMMA2RH_PCI_INT (0x200020+REGBASE)
69#define EMMA2RH_PCI_INT_EN (0x200024+REGBASE)
70#define EMMA2RH_PCI_TWIN_CTR (0x200030+REGBASE)
71#define EMMA2RH_PCI_TWIN_BADR (0x200034+REGBASE)
72#define EMMA2RH_PCI_TWIN0_DADR (0x200038+REGBASE)
73#define EMMA2RH_PCI_TWIN1_DADR (0x20003c+REGBASE)
74
75/*
76 * Memory map (physical address)
77 *
78 * Note most of the following address must be properly aligned by the
79 * corresponding size. For example, if PCI_IO_SIZE is 16MB, then
80 * PCI_IO_BASE must be aligned along 16MB boundary.
81 */
82
83/* the actual ram size is detected at run-time */
84#define EMMA2RH_RAM_BASE 0x00000000
85#define EMMA2RH_RAM_SIZE 0x10000000 /* less than 256MB */
86
87#define EMMA2RH_IO_BASE 0x10000000
88#define EMMA2RH_IO_SIZE 0x01000000 /* 16 MB */
89
90#define EMMA2RH_GENERALIO_BASE 0x11000000
91#define EMMA2RH_GENERALIO_SIZE 0x01000000 /* 16 MB */
92
93#define EMMA2RH_PCI_IO_BASE 0x12000000
94#define EMMA2RH_PCI_IO_SIZE 0x02000000 /* 32 MB */
95
96#define EMMA2RH_PCI_MEM_BASE 0x14000000
97#define EMMA2RH_PCI_MEM_SIZE 0x08000000 /* 128 MB */
98
99#define EMMA2RH_ROM_BASE 0x1c000000
100#define EMMA2RH_ROM_SIZE 0x04000000 /* 64 MB */
101
102#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
103#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
104
105#define NUM_CPU_IRQ 8
106#define NUM_EMMA2RH_IRQ 96
107
108#define CPU_EMMA2RH_CASCADE 2
109#define CPU_IRQ_BASE MIPS_CPU_IRQ_BASE
110#define EMMA2RH_IRQ_BASE (CPU_IRQ_BASE + NUM_CPU_IRQ)
111
112/*
113 * emma2rh irq defs
114 */
115
116#define EMMA2RH_IRQ_INT0 (0 + EMMA2RH_IRQ_BASE)
117#define EMMA2RH_IRQ_INT1 (1 + EMMA2RH_IRQ_BASE)
118#define EMMA2RH_IRQ_INT2 (2 + EMMA2RH_IRQ_BASE)
119#define EMMA2RH_IRQ_INT3 (3 + EMMA2RH_IRQ_BASE)
120#define EMMA2RH_IRQ_INT4 (4 + EMMA2RH_IRQ_BASE)
121#define EMMA2RH_IRQ_INT5 (5 + EMMA2RH_IRQ_BASE)
122#define EMMA2RH_IRQ_INT6 (6 + EMMA2RH_IRQ_BASE)
123#define EMMA2RH_IRQ_INT7 (7 + EMMA2RH_IRQ_BASE)
124#define EMMA2RH_IRQ_INT8 (8 + EMMA2RH_IRQ_BASE)
125#define EMMA2RH_IRQ_INT9 (9 + EMMA2RH_IRQ_BASE)
126#define EMMA2RH_IRQ_INT10 (10 + EMMA2RH_IRQ_BASE)
127#define EMMA2RH_IRQ_INT11 (11 + EMMA2RH_IRQ_BASE)
128#define EMMA2RH_IRQ_INT12 (12 + EMMA2RH_IRQ_BASE)
129#define EMMA2RH_IRQ_INT13 (13 + EMMA2RH_IRQ_BASE)
130#define EMMA2RH_IRQ_INT14 (14 + EMMA2RH_IRQ_BASE)
131#define EMMA2RH_IRQ_INT15 (15 + EMMA2RH_IRQ_BASE)
132#define EMMA2RH_IRQ_INT16 (16 + EMMA2RH_IRQ_BASE)
133#define EMMA2RH_IRQ_INT17 (17 + EMMA2RH_IRQ_BASE)
134#define EMMA2RH_IRQ_INT18 (18 + EMMA2RH_IRQ_BASE)
135#define EMMA2RH_IRQ_INT19 (19 + EMMA2RH_IRQ_BASE)
136#define EMMA2RH_IRQ_INT20 (20 + EMMA2RH_IRQ_BASE)
137#define EMMA2RH_IRQ_INT21 (21 + EMMA2RH_IRQ_BASE)
138#define EMMA2RH_IRQ_INT22 (22 + EMMA2RH_IRQ_BASE)
139#define EMMA2RH_IRQ_INT23 (23 + EMMA2RH_IRQ_BASE)
140#define EMMA2RH_IRQ_INT24 (24 + EMMA2RH_IRQ_BASE)
141#define EMMA2RH_IRQ_INT25 (25 + EMMA2RH_IRQ_BASE)
142#define EMMA2RH_IRQ_INT26 (26 + EMMA2RH_IRQ_BASE)
143#define EMMA2RH_IRQ_INT27 (27 + EMMA2RH_IRQ_BASE)
144#define EMMA2RH_IRQ_INT28 (28 + EMMA2RH_IRQ_BASE)
145#define EMMA2RH_IRQ_INT29 (29 + EMMA2RH_IRQ_BASE)
146#define EMMA2RH_IRQ_INT30 (30 + EMMA2RH_IRQ_BASE)
147#define EMMA2RH_IRQ_INT31 (31 + EMMA2RH_IRQ_BASE)
148#define EMMA2RH_IRQ_INT32 (32 + EMMA2RH_IRQ_BASE)
149#define EMMA2RH_IRQ_INT33 (33 + EMMA2RH_IRQ_BASE)
150#define EMMA2RH_IRQ_INT34 (34 + EMMA2RH_IRQ_BASE)
151#define EMMA2RH_IRQ_INT35 (35 + EMMA2RH_IRQ_BASE)
152#define EMMA2RH_IRQ_INT36 (36 + EMMA2RH_IRQ_BASE)
153#define EMMA2RH_IRQ_INT37 (37 + EMMA2RH_IRQ_BASE)
154#define EMMA2RH_IRQ_INT38 (38 + EMMA2RH_IRQ_BASE)
155#define EMMA2RH_IRQ_INT39 (39 + EMMA2RH_IRQ_BASE)
156#define EMMA2RH_IRQ_INT40 (40 + EMMA2RH_IRQ_BASE)
157#define EMMA2RH_IRQ_INT41 (41 + EMMA2RH_IRQ_BASE)
158#define EMMA2RH_IRQ_INT42 (42 + EMMA2RH_IRQ_BASE)
159#define EMMA2RH_IRQ_INT43 (43 + EMMA2RH_IRQ_BASE)
160#define EMMA2RH_IRQ_INT44 (44 + EMMA2RH_IRQ_BASE)
161#define EMMA2RH_IRQ_INT45 (45 + EMMA2RH_IRQ_BASE)
162#define EMMA2RH_IRQ_INT46 (46 + EMMA2RH_IRQ_BASE)
163#define EMMA2RH_IRQ_INT47 (47 + EMMA2RH_IRQ_BASE)
164#define EMMA2RH_IRQ_INT48 (48 + EMMA2RH_IRQ_BASE)
165#define EMMA2RH_IRQ_INT49 (49 + EMMA2RH_IRQ_BASE)
166#define EMMA2RH_IRQ_INT50 (50 + EMMA2RH_IRQ_BASE)
167#define EMMA2RH_IRQ_INT51 (51 + EMMA2RH_IRQ_BASE)
168#define EMMA2RH_IRQ_INT52 (52 + EMMA2RH_IRQ_BASE)
169#define EMMA2RH_IRQ_INT53 (53 + EMMA2RH_IRQ_BASE)
170#define EMMA2RH_IRQ_INT54 (54 + EMMA2RH_IRQ_BASE)
171#define EMMA2RH_IRQ_INT55 (55 + EMMA2RH_IRQ_BASE)
172#define EMMA2RH_IRQ_INT56 (56 + EMMA2RH_IRQ_BASE)
173#define EMMA2RH_IRQ_INT57 (57 + EMMA2RH_IRQ_BASE)
174#define EMMA2RH_IRQ_INT58 (58 + EMMA2RH_IRQ_BASE)
175#define EMMA2RH_IRQ_INT59 (59 + EMMA2RH_IRQ_BASE)
176#define EMMA2RH_IRQ_INT60 (60 + EMMA2RH_IRQ_BASE)
177#define EMMA2RH_IRQ_INT61 (61 + EMMA2RH_IRQ_BASE)
178#define EMMA2RH_IRQ_INT62 (62 + EMMA2RH_IRQ_BASE)
179#define EMMA2RH_IRQ_INT63 (63 + EMMA2RH_IRQ_BASE)
180
181#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT49
182#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT50
183#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT51
184#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT56
185#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT57
186#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT58
187
188/*
189 * EMMA2RH Register Access
190 */
191
192#define EMMA2RH_BASE (0xa0000000)
193
194static inline void emma2rh_sync(void)
195{
196 volatile u32 *p = (volatile u32 *)0xbfc00000;
197 (void)(*p);
198}
199
200static inline void emma2rh_out32(u32 offset, u32 val)
201{
202 *(volatile u32 *)(EMMA2RH_BASE | offset) = val;
203 emma2rh_sync();
204}
205
206static inline u32 emma2rh_in32(u32 offset)
207{
208 u32 val = *(volatile u32 *)(EMMA2RH_BASE | offset);
209 emma2rh_sync();
210 return val;
211}
212
213static inline void emma2rh_out16(u32 offset, u16 val)
214{
215 *(volatile u16 *)(EMMA2RH_BASE | offset) = val;
216 emma2rh_sync();
217}
218
219static inline u16 emma2rh_in16(u32 offset)
220{
221 u16 val = *(volatile u16 *)(EMMA2RH_BASE | offset);
222 emma2rh_sync();
223 return val;
224}
225
226static inline void emma2rh_out8(u32 offset, u8 val)
227{
228 *(volatile u8 *)(EMMA2RH_BASE | offset) = val;
229 emma2rh_sync();
230}
231
232static inline u8 emma2rh_in8(u32 offset)
233{
234 u8 val = *(volatile u8 *)(EMMA2RH_BASE | offset);
235 emma2rh_sync();
236 return val;
237}
238
239/**
240 * IIC registers map
241 **/
242
243/*---------------------------------------------------------------------------*/
244/* CNT - Control register (00H R/W) */
245/*---------------------------------------------------------------------------*/
246#define SPT 0x00000001
247#define STT 0x00000002
248#define ACKE 0x00000004
249#define WTIM 0x00000008
250#define SPIE 0x00000010
251#define WREL 0x00000020
252#define LREL 0x00000040
253#define IICE 0x00000080
254#define CNT_RESERVED 0x000000ff /* reserved bit 0 */
255
256#define I2C_EMMA_START (IICE | STT)
257#define I2C_EMMA_STOP (IICE | SPT)
258#define I2C_EMMA_REPSTART I2C_EMMA_START
259
260/*---------------------------------------------------------------------------*/
261/* STA - Status register (10H Read) */
262/*---------------------------------------------------------------------------*/
263#define MSTS 0x00000080
264#define ALD 0x00000040
265#define EXC 0x00000020
266#define COI 0x00000010
267#define TRC 0x00000008
268#define ACKD 0x00000004
269#define STD 0x00000002
270#define SPD 0x00000001
271
272/*---------------------------------------------------------------------------*/
273/* CSEL - Clock select register (20H R/W) */
274/*---------------------------------------------------------------------------*/
275#define FCL 0x00000080
276#define ND50 0x00000040
277#define CLD 0x00000020
278#define DAD 0x00000010
279#define SMC 0x00000008
280#define DFC 0x00000004
281#define CL 0x00000003
282#define CSEL_RESERVED 0x000000ff /* reserved bit 0 */
283
284#define FAST397 0x0000008b
285#define FAST297 0x0000008a
286#define FAST347 0x0000000b
287#define FAST260 0x0000000a
288#define FAST130 0x00000008
289#define STANDARD108 0x00000083
290#define STANDARD83 0x00000082
291#define STANDARD95 0x00000003
292#define STANDARD73 0x00000002
293#define STANDARD36 0x00000001
294#define STANDARD71 0x00000000
295
296/*---------------------------------------------------------------------------*/
297/* SVA - Slave address register (30H R/W) */
298/*---------------------------------------------------------------------------*/
299#define SVA 0x000000fe
300
301/*---------------------------------------------------------------------------*/
302/* SHR - Shift register (40H R/W) */
303/*---------------------------------------------------------------------------*/
304#define SR 0x000000ff
305
306/*---------------------------------------------------------------------------*/
307/* INT - Interrupt register (50H R/W) */
308/* INTM - Interrupt mask register (60H R/W) */
309/*---------------------------------------------------------------------------*/
310#define INTE0 0x00000001
311
312/***********************************************************************
313 * I2C registers
314 ***********************************************************************
315 */
316#define I2C_EMMA_CNT 0x00
317#define I2C_EMMA_STA 0x10
318#define I2C_EMMA_CSEL 0x20
319#define I2C_EMMA_SVA 0x30
320#define I2C_EMMA_SHR 0x40
321#define I2C_EMMA_INT 0x50
322#define I2C_EMMA_INTM 0x60
323
324/*
325 * include the board dependent part
326 */
327#if defined(CONFIG_MARKEINS)
328#include <asm/emma2rh/markeins.h>
329#else
330#error "Unknown EMMA2RH board!"
331#endif
332
333#endif /* __ASM_EMMA2RH_EMMA2RH_H */
diff --git a/include/asm-mips/emma2rh/markeins.h b/include/asm-mips/emma2rh/markeins.h
deleted file mode 100644
index 973b0628490d..000000000000
--- a/include/asm-mips/emma2rh/markeins.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * include/asm-mips/emma2rh/markeins.h
3 * This file is EMMA2RH board depended header.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file based on include/asm-mips/ddb5xxx/ddb5xxx.h
8 * Copyright 2001 MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef MARKEINS_H
26#define MARKEINS_H
27
28#define NUM_EMMA2RH_IRQ_SW 32
29#define NUM_EMMA2RH_IRQ_GPIO 32
30
31#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT7 - EMMA2RH_IRQ_INT0)
32#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT46 - EMMA2RH_IRQ_INT0)
33
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)
36
37#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE)
38#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT2 (2+EMMA2RH_SW_IRQ_BASE)
40#define EMMA2RH_SW_IRQ_INT3 (3+EMMA2RH_SW_IRQ_BASE)
41#define EMMA2RH_SW_IRQ_INT4 (4+EMMA2RH_SW_IRQ_BASE)
42#define EMMA2RH_SW_IRQ_INT5 (5+EMMA2RH_SW_IRQ_BASE)
43#define EMMA2RH_SW_IRQ_INT6 (6+EMMA2RH_SW_IRQ_BASE)
44#define EMMA2RH_SW_IRQ_INT7 (7+EMMA2RH_SW_IRQ_BASE)
45#define EMMA2RH_SW_IRQ_INT8 (8+EMMA2RH_SW_IRQ_BASE)
46#define EMMA2RH_SW_IRQ_INT9 (9+EMMA2RH_SW_IRQ_BASE)
47#define EMMA2RH_SW_IRQ_INT10 (10+EMMA2RH_SW_IRQ_BASE)
48#define EMMA2RH_SW_IRQ_INT11 (11+EMMA2RH_SW_IRQ_BASE)
49#define EMMA2RH_SW_IRQ_INT12 (12+EMMA2RH_SW_IRQ_BASE)
50#define EMMA2RH_SW_IRQ_INT13 (13+EMMA2RH_SW_IRQ_BASE)
51#define EMMA2RH_SW_IRQ_INT14 (14+EMMA2RH_SW_IRQ_BASE)
52#define EMMA2RH_SW_IRQ_INT15 (15+EMMA2RH_SW_IRQ_BASE)
53#define EMMA2RH_SW_IRQ_INT16 (16+EMMA2RH_SW_IRQ_BASE)
54#define EMMA2RH_SW_IRQ_INT17 (17+EMMA2RH_SW_IRQ_BASE)
55#define EMMA2RH_SW_IRQ_INT18 (18+EMMA2RH_SW_IRQ_BASE)
56#define EMMA2RH_SW_IRQ_INT19 (19+EMMA2RH_SW_IRQ_BASE)
57#define EMMA2RH_SW_IRQ_INT20 (20+EMMA2RH_SW_IRQ_BASE)
58#define EMMA2RH_SW_IRQ_INT21 (21+EMMA2RH_SW_IRQ_BASE)
59#define EMMA2RH_SW_IRQ_INT22 (22+EMMA2RH_SW_IRQ_BASE)
60#define EMMA2RH_SW_IRQ_INT23 (23+EMMA2RH_SW_IRQ_BASE)
61#define EMMA2RH_SW_IRQ_INT24 (24+EMMA2RH_SW_IRQ_BASE)
62#define EMMA2RH_SW_IRQ_INT25 (25+EMMA2RH_SW_IRQ_BASE)
63#define EMMA2RH_SW_IRQ_INT26 (26+EMMA2RH_SW_IRQ_BASE)
64#define EMMA2RH_SW_IRQ_INT27 (27+EMMA2RH_SW_IRQ_BASE)
65#define EMMA2RH_SW_IRQ_INT28 (28+EMMA2RH_SW_IRQ_BASE)
66#define EMMA2RH_SW_IRQ_INT29 (29+EMMA2RH_SW_IRQ_BASE)
67#define EMMA2RH_SW_IRQ_INT30 (30+EMMA2RH_SW_IRQ_BASE)
68#define EMMA2RH_SW_IRQ_INT31 (31+EMMA2RH_SW_IRQ_BASE)
69
70#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15
71#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16
72#define MARKEINS_PCI_IRQ_INTC EMMA2RH_GPIO_IRQ_BASE+17
73#define MARKEINS_PCI_IRQ_INTD EMMA2RH_GPIO_IRQ_BASE+18
74
75#endif /* CONFIG_MARKEINS */
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h
deleted file mode 100644
index 3c0d840e4577..000000000000
--- a/include/asm-mips/errno.h
+++ /dev/null
@@ -1,131 +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) 1995, 1999, 2001, 2002 by Ralf Baechle
7 */
8#ifndef _ASM_ERRNO_H
9#define _ASM_ERRNO_H
10
11/*
12 * These error numbers are intended to be MIPS ABI compatible
13 */
14
15#include <asm-generic/errno-base.h>
16
17#define ENOMSG 35 /* No message of desired type */
18#define EIDRM 36 /* Identifier removed */
19#define ECHRNG 37 /* Channel number out of range */
20#define EL2NSYNC 38 /* Level 2 not synchronized */
21#define EL3HLT 39 /* Level 3 halted */
22#define EL3RST 40 /* Level 3 reset */
23#define ELNRNG 41 /* Link number out of range */
24#define EUNATCH 42 /* Protocol driver not attached */
25#define ENOCSI 43 /* No CSI structure available */
26#define EL2HLT 44 /* Level 2 halted */
27#define EDEADLK 45 /* Resource deadlock would occur */
28#define ENOLCK 46 /* No record locks available */
29#define EBADE 50 /* Invalid exchange */
30#define EBADR 51 /* Invalid request descriptor */
31#define EXFULL 52 /* Exchange full */
32#define ENOANO 53 /* No anode */
33#define EBADRQC 54 /* Invalid request code */
34#define EBADSLT 55 /* Invalid slot */
35#define EDEADLOCK 56 /* File locking deadlock error */
36#define EBFONT 59 /* Bad font file format */
37#define ENOSTR 60 /* Device not a stream */
38#define ENODATA 61 /* No data available */
39#define ETIME 62 /* Timer expired */
40#define ENOSR 63 /* Out of streams resources */
41#define ENONET 64 /* Machine is not on the network */
42#define ENOPKG 65 /* Package not installed */
43#define EREMOTE 66 /* Object is remote */
44#define ENOLINK 67 /* Link has been severed */
45#define EADV 68 /* Advertise error */
46#define ESRMNT 69 /* Srmount error */
47#define ECOMM 70 /* Communication error on send */
48#define EPROTO 71 /* Protocol error */
49#define EDOTDOT 73 /* RFS specific error */
50#define EMULTIHOP 74 /* Multihop attempted */
51#define EBADMSG 77 /* Not a data message */
52#define ENAMETOOLONG 78 /* File name too long */
53#define EOVERFLOW 79 /* Value too large for defined data type */
54#define ENOTUNIQ 80 /* Name not unique on network */
55#define EBADFD 81 /* File descriptor in bad state */
56#define EREMCHG 82 /* Remote address changed */
57#define ELIBACC 83 /* Can not access a needed shared library */
58#define ELIBBAD 84 /* Accessing a corrupted shared library */
59#define ELIBSCN 85 /* .lib section in a.out corrupted */
60#define ELIBMAX 86 /* Attempting to link in too many shared libraries */
61#define ELIBEXEC 87 /* Cannot exec a shared library directly */
62#define EILSEQ 88 /* Illegal byte sequence */
63#define ENOSYS 89 /* Function not implemented */
64#define ELOOP 90 /* Too many symbolic links encountered */
65#define ERESTART 91 /* Interrupted system call should be restarted */
66#define ESTRPIPE 92 /* Streams pipe error */
67#define ENOTEMPTY 93 /* Directory not empty */
68#define EUSERS 94 /* Too many users */
69#define ENOTSOCK 95 /* Socket operation on non-socket */
70#define EDESTADDRREQ 96 /* Destination address required */
71#define EMSGSIZE 97 /* Message too long */
72#define EPROTOTYPE 98 /* Protocol wrong type for socket */
73#define ENOPROTOOPT 99 /* Protocol not available */
74#define EPROTONOSUPPORT 120 /* Protocol not supported */
75#define ESOCKTNOSUPPORT 121 /* Socket type not supported */
76#define EOPNOTSUPP 122 /* Operation not supported on transport endpoint */
77#define EPFNOSUPPORT 123 /* Protocol family not supported */
78#define EAFNOSUPPORT 124 /* Address family not supported by protocol */
79#define EADDRINUSE 125 /* Address already in use */
80#define EADDRNOTAVAIL 126 /* Cannot assign requested address */
81#define ENETDOWN 127 /* Network is down */
82#define ENETUNREACH 128 /* Network is unreachable */
83#define ENETRESET 129 /* Network dropped connection because of reset */
84#define ECONNABORTED 130 /* Software caused connection abort */
85#define ECONNRESET 131 /* Connection reset by peer */
86#define ENOBUFS 132 /* No buffer space available */
87#define EISCONN 133 /* Transport endpoint is already connected */
88#define ENOTCONN 134 /* Transport endpoint is not connected */
89#define EUCLEAN 135 /* Structure needs cleaning */
90#define ENOTNAM 137 /* Not a XENIX named type file */
91#define ENAVAIL 138 /* No XENIX semaphores available */
92#define EISNAM 139 /* Is a named type file */
93#define EREMOTEIO 140 /* Remote I/O error */
94#define EINIT 141 /* Reserved */
95#define EREMDEV 142 /* Error 142 */
96#define ESHUTDOWN 143 /* Cannot send after transport endpoint shutdown */
97#define ETOOMANYREFS 144 /* Too many references: cannot splice */
98#define ETIMEDOUT 145 /* Connection timed out */
99#define ECONNREFUSED 146 /* Connection refused */
100#define EHOSTDOWN 147 /* Host is down */
101#define EHOSTUNREACH 148 /* No route to host */
102#define EWOULDBLOCK EAGAIN /* Operation would block */
103#define EALREADY 149 /* Operation already in progress */
104#define EINPROGRESS 150 /* Operation now in progress */
105#define ESTALE 151 /* Stale NFS file handle */
106#define ECANCELED 158 /* AIO operation canceled */
107
108/*
109 * These error are Linux extensions.
110 */
111#define ENOMEDIUM 159 /* No medium found */
112#define EMEDIUMTYPE 160 /* Wrong medium type */
113#define ENOKEY 161 /* Required key not available */
114#define EKEYEXPIRED 162 /* Key has expired */
115#define EKEYREVOKED 163 /* Key has been revoked */
116#define EKEYREJECTED 164 /* Key was rejected by service */
117
118/* for robust mutexes */
119#define EOWNERDEAD 165 /* Owner died */
120#define ENOTRECOVERABLE 166 /* State not recoverable */
121
122#define EDQUOT 1133 /* Quota exceeded */
123
124#ifdef __KERNEL__
125
126/* The biggest error number defined here or in <linux/errno.h>. */
127#define EMAXERRNO 1133
128
129#endif /* __KERNEL__ */
130
131#endif /* _ASM_ERRNO_H */
diff --git a/include/asm-mips/fb.h b/include/asm-mips/fb.h
deleted file mode 100644
index bd3f68c9ddfc..000000000000
--- a/include/asm-mips/fb.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-mips/fcntl.h b/include/asm-mips/fcntl.h
deleted file mode 100644
index 2a52333a062d..000000000000
--- a/include/asm-mips/fcntl.h
+++ /dev/null
@@ -1,61 +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) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle
7 */
8#ifndef _ASM_FCNTL_H
9#define _ASM_FCNTL_H
10
11
12#define O_APPEND 0x0008
13#define O_SYNC 0x0010
14#define O_NONBLOCK 0x0080
15#define O_CREAT 0x0100 /* not fcntl */
16#define O_TRUNC 0x0200 /* not fcntl */
17#define O_EXCL 0x0400 /* not fcntl */
18#define O_NOCTTY 0x0800 /* not fcntl */
19#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
20#define O_LARGEFILE 0x2000 /* allow large file opens */
21#define O_DIRECT 0x8000 /* direct disk access hint */
22
23#define F_GETLK 14
24#define F_SETLK 6
25#define F_SETLKW 7
26
27#define F_SETOWN 24 /* for sockets. */
28#define F_GETOWN 23 /* for sockets. */
29
30#ifndef __mips64
31#define F_GETLK64 33 /* using 'struct flock64' */
32#define F_SETLK64 34
33#define F_SETLKW64 35
34#endif
35
36/*
37 * The flavours of struct flock. "struct flock" is the ABI compliant
38 * variant. Finally struct flock64 is the LFS variant of struct flock. As
39 * a historic accident and inconsistence with the ABI definition it doesn't
40 * contain all the same fields as struct flock.
41 */
42
43#ifdef CONFIG_32BIT
44
45struct flock {
46 short l_type;
47 short l_whence;
48 off_t l_start;
49 off_t l_len;
50 long l_sysid;
51 __kernel_pid_t l_pid;
52 long pad[4];
53};
54
55#define HAVE_ARCH_STRUCT_FLOCK
56
57#endif /* CONFIG_32BIT */
58
59#include <asm-generic/fcntl.h>
60
61#endif /* _ASM_FCNTL_H */
diff --git a/include/asm-mips/fixmap.h b/include/asm-mips/fixmap.h
deleted file mode 100644
index 9cc8522a394f..000000000000
--- a/include/asm-mips/fixmap.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
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 Ingo Molnar
9 *
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */
12
13#ifndef _ASM_FIXMAP_H
14#define _ASM_FIXMAP_H
15
16#include <asm/page.h>
17#ifdef CONFIG_HIGHMEM
18#include <linux/threads.h>
19#include <asm/kmap_types.h>
20#endif
21
22/*
23 * Here we define all the compile-time 'special' virtual
24 * addresses. The point is to have a constant address at
25 * compile time, but to set the physical address only
26 * in the boot process. We allocate these special addresses
27 * from the end of virtual memory (0xfffff000) backwards.
28 * Also this lets us do fail-safe vmalloc(), we
29 * can guarantee that these special addresses and
30 * vmalloc()-ed addresses never overlap.
31 *
32 * these 'compile-time allocated' memory buffers are
33 * fixed-size 4k pages. (or larger if used with an increment
34 * highger than 1) use fixmap_set(idx,phys) to associate
35 * physical memory with fixmap indices.
36 *
37 * TLB entries of such buffers will not be flushed across
38 * task switches.
39 */
40
41/*
42 * on UP currently we will have no trace of the fixmap mechanizm,
43 * no page table allocations, etc. This might change in the
44 * future, say framebuffers for the console driver(s) could be
45 * fix-mapped?
46 */
47enum fixed_addresses {
48#define FIX_N_COLOURS 8
49 FIX_CMAP_BEGIN,
50#ifdef CONFIG_MIPS_MT_SMTC
51 FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS),
52#else
53 FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
54#endif
55#ifdef CONFIG_HIGHMEM
56 /* reserved pte's for temporary kernel mappings */
57 FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
58 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
59#endif
60 __end_of_fixed_addresses
61};
62
63/*
64 * used by vmalloc.c.
65 *
66 * Leave one empty page between vmalloc'ed areas and
67 * the start of the fixmap, and leave one page empty
68 * at the top of mem..
69 */
70#if defined(CONFIG_CPU_TX39XX) || defined(CONFIG_CPU_TX49XX)
71#define FIXADDR_TOP ((unsigned long)(long)(int)(0xff000000 - 0x20000))
72#else
73#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
74#endif
75#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
76#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
77
78#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
79#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
80
81extern void __this_fixmap_does_not_exist(void);
82
83/*
84 * 'index to address' translation. If anyone tries to use the idx
85 * directly without tranlation, we catch the bug with a NULL-deference
86 * kernel oops. Illegal ranges of incoming indices are caught too.
87 */
88static inline unsigned long fix_to_virt(const unsigned int idx)
89{
90 /*
91 * this branch gets completely eliminated after inlining,
92 * except when someone tries to use fixaddr indices in an
93 * illegal way. (such as mixing up address types or using
94 * out-of-range indices).
95 *
96 * If it doesn't get removed, the linker will complain
97 * loudly with a reasonably clear error message..
98 */
99 if (idx >= __end_of_fixed_addresses)
100 __this_fixmap_does_not_exist();
101
102 return __fix_to_virt(idx);
103}
104
105static inline unsigned long virt_to_fix(const unsigned long vaddr)
106{
107 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
108 return __virt_to_fix(vaddr);
109}
110
111/*
112 * Called from pgtable_init()
113 */
114extern void fixrange_init(unsigned long start, unsigned long end,
115 pgd_t *pgd_base);
116
117
118#endif
diff --git a/include/asm-mips/floppy.h b/include/asm-mips/floppy.h
deleted file mode 100644
index 992d232adc83..000000000000
--- a/include/asm-mips/floppy.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Architecture specific parts of the Floppy driver
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) 1995 - 2000 Ralf Baechle
9 */
10#ifndef _ASM_FLOPPY_H
11#define _ASM_FLOPPY_H
12
13#include <linux/dma-mapping.h>
14
15static inline void fd_cacheflush(char * addr, long size)
16{
17 dma_cache_sync(NULL, addr, size, DMA_BIDIRECTIONAL);
18}
19
20#define MAX_BUFFER_SECTORS 24
21
22
23/*
24 * And on Mips's the CMOS info fails also ...
25 *
26 * FIXME: This information should come from the ARC configuration tree
27 * or whereever a particular machine has stored this ...
28 */
29#define FLOPPY0_TYPE fd_drive_type(0)
30#define FLOPPY1_TYPE fd_drive_type(1)
31
32#define FDC1 fd_getfdaddr1();
33
34#define N_FDC 1 /* do you *really* want a second controller? */
35#define N_DRIVE 8
36
37/*
38 * The DMA channel used by the floppy controller cannot access data at
39 * addresses >= 16MB
40 *
41 * Went back to the 1MB limit, as some people had problems with the floppy
42 * driver otherwise. It doesn't matter much for performance anyway, as most
43 * floppy accesses go through the track buffer.
44 *
45 * On MIPSes using vdma, this actually means that *all* transfers go thru
46 * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
47 * Actually this needs to be a bit more complicated since the so much different
48 * hardware available with MIPS CPUs ...
49 */
50#define CROSS_64KB(a, s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
51
52#define EXTRA_FLOPPY_PARAMS
53
54#include <floppy.h>
55
56#endif /* _ASM_FLOPPY_H */
diff --git a/include/asm-mips/fpregdef.h b/include/asm-mips/fpregdef.h
deleted file mode 100644
index 2b5fddc8f487..000000000000
--- a/include/asm-mips/fpregdef.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Definitions for the FPU register names
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) 1995, 1999 Ralf Baechle
9 * Copyright (C) 1985 MIPS Computer Systems, Inc.
10 * Copyright (C) 1990 - 1992, 1999 Silicon Graphics, Inc.
11 */
12#ifndef _ASM_FPREGDEF_H
13#define _ASM_FPREGDEF_H
14
15#include <asm/sgidefs.h>
16
17#if _MIPS_SIM == _MIPS_SIM_ABI32
18
19/*
20 * These definitions only cover the R3000-ish 16/32 register model.
21 * But we're trying to be R3000 friendly anyway ...
22 */
23#define fv0 $f0 /* return value */
24#define fv0f $f1
25#define fv1 $f2
26#define fv1f $f3
27#define fa0 $f12 /* argument registers */
28#define fa0f $f13
29#define fa1 $f14
30#define fa1f $f15
31#define ft0 $f4 /* caller saved */
32#define ft0f $f5
33#define ft1 $f6
34#define ft1f $f7
35#define ft2 $f8
36#define ft2f $f9
37#define ft3 $f10
38#define ft3f $f11
39#define ft4 $f16
40#define ft4f $f17
41#define ft5 $f18
42#define ft5f $f19
43#define fs0 $f20 /* callee saved */
44#define fs0f $f21
45#define fs1 $f22
46#define fs1f $f23
47#define fs2 $f24
48#define fs2f $f25
49#define fs3 $f26
50#define fs3f $f27
51#define fs4 $f28
52#define fs4f $f29
53#define fs5 $f30
54#define fs5f $f31
55
56#define fcr31 $31 /* FPU status register */
57
58#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
59
60#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
61
62#define fv0 $f0 /* return value */
63#define fv1 $f2
64#define fa0 $f12 /* argument registers */
65#define fa1 $f13
66#define fa2 $f14
67#define fa3 $f15
68#define fa4 $f16
69#define fa5 $f17
70#define fa6 $f18
71#define fa7 $f19
72#define ft0 $f4 /* caller saved */
73#define ft1 $f5
74#define ft2 $f6
75#define ft3 $f7
76#define ft4 $f8
77#define ft5 $f9
78#define ft6 $f10
79#define ft7 $f11
80#define ft8 $f20
81#define ft9 $f21
82#define ft10 $f22
83#define ft11 $f23
84#define ft12 $f1
85#define ft13 $f3
86#define fs0 $f24 /* callee saved */
87#define fs1 $f25
88#define fs2 $f26
89#define fs3 $f27
90#define fs4 $f28
91#define fs5 $f29
92#define fs6 $f30
93#define fs7 $f31
94
95#define fcr31 $31
96
97#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
98
99#endif /* _ASM_FPREGDEF_H */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
deleted file mode 100644
index 8a3ef247659a..000000000000
--- a/include/asm-mips/fpu.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * Copyright (C) 2002 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
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 by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_FPU_H
11#define _ASM_FPU_H
12
13#include <linux/sched.h>
14#include <linux/thread_info.h>
15#include <linux/bitops.h>
16
17#include <asm/mipsregs.h>
18#include <asm/cpu.h>
19#include <asm/cpu-features.h>
20#include <asm/hazards.h>
21#include <asm/processor.h>
22#include <asm/current.h>
23
24#ifdef CONFIG_MIPS_MT_FPAFF
25#include <asm/mips_mt.h>
26#endif
27
28struct sigcontext;
29struct sigcontext32;
30
31extern asmlinkage int (*save_fp_context)(struct sigcontext __user *sc);
32extern asmlinkage int (*restore_fp_context)(struct sigcontext __user *sc);
33
34extern asmlinkage int (*save_fp_context32)(struct sigcontext32 __user *sc);
35extern asmlinkage int (*restore_fp_context32)(struct sigcontext32 __user *sc);
36
37extern void fpu_emulator_init_fpu(void);
38extern int fpu_emulator_save_context(struct sigcontext __user *sc);
39extern int fpu_emulator_restore_context(struct sigcontext __user *sc);
40extern void _init_fpu(void);
41extern void _save_fp(struct task_struct *);
42extern void _restore_fp(struct task_struct *);
43
44#define __enable_fpu() \
45do { \
46 set_c0_status(ST0_CU1); \
47 enable_fpu_hazard(); \
48} while (0)
49
50#define __disable_fpu() \
51do { \
52 clear_c0_status(ST0_CU1); \
53 disable_fpu_hazard(); \
54} while (0)
55
56#define enable_fpu() \
57do { \
58 if (cpu_has_fpu) \
59 __enable_fpu(); \
60} while (0)
61
62#define disable_fpu() \
63do { \
64 if (cpu_has_fpu) \
65 __disable_fpu(); \
66} while (0)
67
68
69#define clear_fpu_owner() clear_thread_flag(TIF_USEDFPU)
70
71static inline int __is_fpu_owner(void)
72{
73 return test_thread_flag(TIF_USEDFPU);
74}
75
76static inline int is_fpu_owner(void)
77{
78 return cpu_has_fpu && __is_fpu_owner();
79}
80
81static inline void __own_fpu(void)
82{
83 __enable_fpu();
84 KSTK_STATUS(current) |= ST0_CU1;
85 set_thread_flag(TIF_USEDFPU);
86}
87
88static inline void own_fpu_inatomic(int restore)
89{
90 if (cpu_has_fpu && !__is_fpu_owner()) {
91 __own_fpu();
92 if (restore)
93 _restore_fp(current);
94 }
95}
96
97static inline void own_fpu(int restore)
98{
99 preempt_disable();
100 own_fpu_inatomic(restore);
101 preempt_enable();
102}
103
104static inline void lose_fpu(int save)
105{
106 preempt_disable();
107 if (is_fpu_owner()) {
108 if (save)
109 _save_fp(current);
110 KSTK_STATUS(current) &= ~ST0_CU1;
111 clear_thread_flag(TIF_USEDFPU);
112 __disable_fpu();
113 }
114 preempt_enable();
115}
116
117static inline void init_fpu(void)
118{
119 preempt_disable();
120 if (cpu_has_fpu) {
121 __own_fpu();
122 _init_fpu();
123 } else {
124 fpu_emulator_init_fpu();
125 }
126 preempt_enable();
127}
128
129static inline void save_fp(struct task_struct *tsk)
130{
131 if (cpu_has_fpu)
132 _save_fp(tsk);
133}
134
135static inline void restore_fp(struct task_struct *tsk)
136{
137 if (cpu_has_fpu)
138 _restore_fp(tsk);
139}
140
141static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
142{
143 if (tsk == current) {
144 preempt_disable();
145 if (is_fpu_owner())
146 _save_fp(current);
147 preempt_enable();
148 }
149
150 return tsk->thread.fpu.fpr;
151}
152
153#endif /* _ASM_FPU_H */
diff --git a/include/asm-mips/fpu_emulator.h b/include/asm-mips/fpu_emulator.h
deleted file mode 100644
index 2731c38bd7ae..000000000000
--- a/include/asm-mips/fpu_emulator.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * This program is free software; you can distribute it and/or modify it
3 * under the terms of the GNU General Public License (Version 2) as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope it will be useful, but WITHOUT
7 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9 * for more details.
10 *
11 * You should have received a copy of the GNU General Public License along
12 * with this program; if not, write to the Free Software Foundation, Inc.,
13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
14 *
15 * Further private data for which no space exists in mips_fpu_struct.
16 * This should be subsumed into the mips_fpu_struct structure as
17 * defined in processor.h as soon as the absurd wired absolute assembler
18 * offsets become dynamic at compile time.
19 *
20 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
21 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
22 */
23#ifndef _ASM_FPU_EMULATOR_H
24#define _ASM_FPU_EMULATOR_H
25
26struct mips_fpu_emulator_stats {
27 unsigned int emulated;
28 unsigned int loads;
29 unsigned int stores;
30 unsigned int cp1ops;
31 unsigned int cp1xops;
32 unsigned int errors;
33};
34
35extern struct mips_fpu_emulator_stats fpuemustats;
36
37#endif /* _ASM_FPU_EMULATOR_H */
diff --git a/include/asm-mips/futex.h b/include/asm-mips/futex.h
deleted file mode 100644
index b9cce90346cf..000000000000
--- a/include/asm-mips/futex.h
+++ /dev/null
@@ -1,203 +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 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef _ASM_FUTEX_H
9#define _ASM_FUTEX_H
10
11#ifdef __KERNEL__
12
13#include <linux/futex.h>
14#include <linux/uaccess.h>
15#include <asm/barrier.h>
16#include <asm/errno.h>
17#include <asm/war.h>
18
19#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
20{ \
21 if (cpu_has_llsc && R10000_LLSC_WAR) { \
22 __asm__ __volatile__( \
23 " .set push \n" \
24 " .set noat \n" \
25 " .set mips3 \n" \
26 "1: ll %1, %4 # __futex_atomic_op \n" \
27 " .set mips0 \n" \
28 " " insn " \n" \
29 " .set mips3 \n" \
30 "2: sc $1, %2 \n" \
31 " beqzl $1, 1b \n" \
32 __WEAK_LLSC_MB \
33 "3: \n" \
34 " .set pop \n" \
35 " .set mips0 \n" \
36 " .section .fixup,\"ax\" \n" \
37 "4: li %0, %6 \n" \
38 " j 3b \n" \
39 " .previous \n" \
40 " .section __ex_table,\"a\" \n" \
41 " "__UA_ADDR "\t1b, 4b \n" \
42 " "__UA_ADDR "\t2b, 4b \n" \
43 " .previous \n" \
44 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
45 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
46 : "memory"); \
47 } else if (cpu_has_llsc) { \
48 __asm__ __volatile__( \
49 " .set push \n" \
50 " .set noat \n" \
51 " .set mips3 \n" \
52 "1: ll %1, %4 # __futex_atomic_op \n" \
53 " .set mips0 \n" \
54 " " insn " \n" \
55 " .set mips3 \n" \
56 "2: sc $1, %2 \n" \
57 " beqz $1, 1b \n" \
58 __WEAK_LLSC_MB \
59 "3: \n" \
60 " .set pop \n" \
61 " .set mips0 \n" \
62 " .section .fixup,\"ax\" \n" \
63 "4: li %0, %6 \n" \
64 " j 3b \n" \
65 " .previous \n" \
66 " .section __ex_table,\"a\" \n" \
67 " "__UA_ADDR "\t1b, 4b \n" \
68 " "__UA_ADDR "\t2b, 4b \n" \
69 " .previous \n" \
70 : "=r" (ret), "=&r" (oldval), "=R" (*uaddr) \
71 : "0" (0), "R" (*uaddr), "Jr" (oparg), "i" (-EFAULT) \
72 : "memory"); \
73 } else \
74 ret = -ENOSYS; \
75}
76
77static inline int
78futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
79{
80 int op = (encoded_op >> 28) & 7;
81 int cmp = (encoded_op >> 24) & 15;
82 int oparg = (encoded_op << 8) >> 20;
83 int cmparg = (encoded_op << 20) >> 20;
84 int oldval = 0, ret;
85 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
86 oparg = 1 << oparg;
87
88 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
89 return -EFAULT;
90
91 pagefault_disable();
92
93 switch (op) {
94 case FUTEX_OP_SET:
95 __futex_atomic_op("move $1, %z5", ret, oldval, uaddr, oparg);
96 break;
97
98 case FUTEX_OP_ADD:
99 __futex_atomic_op("addu $1, %1, %z5",
100 ret, oldval, uaddr, oparg);
101 break;
102 case FUTEX_OP_OR:
103 __futex_atomic_op("or $1, %1, %z5",
104 ret, oldval, uaddr, oparg);
105 break;
106 case FUTEX_OP_ANDN:
107 __futex_atomic_op("and $1, %1, %z5",
108 ret, oldval, uaddr, ~oparg);
109 break;
110 case FUTEX_OP_XOR:
111 __futex_atomic_op("xor $1, %1, %z5",
112 ret, oldval, uaddr, oparg);
113 break;
114 default:
115 ret = -ENOSYS;
116 }
117
118 pagefault_enable();
119
120 if (!ret) {
121 switch (cmp) {
122 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
123 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
124 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
125 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
126 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
127 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
128 default: ret = -ENOSYS;
129 }
130 }
131 return ret;
132}
133
134static inline int
135futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
136{
137 int retval;
138
139 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
140 return -EFAULT;
141
142 if (cpu_has_llsc && R10000_LLSC_WAR) {
143 __asm__ __volatile__(
144 "# futex_atomic_cmpxchg_inatomic \n"
145 " .set push \n"
146 " .set noat \n"
147 " .set mips3 \n"
148 "1: ll %0, %2 \n"
149 " bne %0, %z3, 3f \n"
150 " .set mips0 \n"
151 " move $1, %z4 \n"
152 " .set mips3 \n"
153 "2: sc $1, %1 \n"
154 " beqzl $1, 1b \n"
155 __WEAK_LLSC_MB
156 "3: \n"
157 " .set pop \n"
158 " .section .fixup,\"ax\" \n"
159 "4: li %0, %5 \n"
160 " j 3b \n"
161 " .previous \n"
162 " .section __ex_table,\"a\" \n"
163 " "__UA_ADDR "\t1b, 4b \n"
164 " "__UA_ADDR "\t2b, 4b \n"
165 " .previous \n"
166 : "=&r" (retval), "=R" (*uaddr)
167 : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
168 : "memory");
169 } else if (cpu_has_llsc) {
170 __asm__ __volatile__(
171 "# futex_atomic_cmpxchg_inatomic \n"
172 " .set push \n"
173 " .set noat \n"
174 " .set mips3 \n"
175 "1: ll %0, %2 \n"
176 " bne %0, %z3, 3f \n"
177 " .set mips0 \n"
178 " move $1, %z4 \n"
179 " .set mips3 \n"
180 "2: sc $1, %1 \n"
181 " beqz $1, 1b \n"
182 __WEAK_LLSC_MB
183 "3: \n"
184 " .set pop \n"
185 " .section .fixup,\"ax\" \n"
186 "4: li %0, %5 \n"
187 " j 3b \n"
188 " .previous \n"
189 " .section __ex_table,\"a\" \n"
190 " "__UA_ADDR "\t1b, 4b \n"
191 " "__UA_ADDR "\t2b, 4b \n"
192 " .previous \n"
193 : "=&r" (retval), "=R" (*uaddr)
194 : "R" (*uaddr), "Jr" (oldval), "Jr" (newval), "i" (-EFAULT)
195 : "memory");
196 } else
197 return -ENOSYS;
198
199 return retval;
200}
201
202#endif
203#endif /* _ASM_FUTEX_H */
diff --git a/include/asm-mips/fw/arc/hinv.h b/include/asm-mips/fw/arc/hinv.h
deleted file mode 100644
index e6ff4add04e2..000000000000
--- a/include/asm-mips/fw/arc/hinv.h
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * ARCS hardware/memory inventory/configuration and system ID definitions.
3 */
4#ifndef _ASM_ARC_HINV_H
5#define _ASM_ARC_HINV_H
6
7#include <asm/sgidefs.h>
8#include <asm/fw/arc/types.h>
9
10/* configuration query defines */
11typedef enum configclass {
12 SystemClass,
13 ProcessorClass,
14 CacheClass,
15#ifndef _NT_PROM
16 MemoryClass,
17 AdapterClass,
18 ControllerClass,
19 PeripheralClass
20#else /* _NT_PROM */
21 AdapterClass,
22 ControllerClass,
23 PeripheralClass,
24 MemoryClass
25#endif /* _NT_PROM */
26} CONFIGCLASS;
27
28typedef enum configtype {
29 ARC,
30 CPU,
31 FPU,
32 PrimaryICache,
33 PrimaryDCache,
34 SecondaryICache,
35 SecondaryDCache,
36 SecondaryCache,
37#ifndef _NT_PROM
38 Memory,
39#endif
40 EISAAdapter,
41 TCAdapter,
42 SCSIAdapter,
43 DTIAdapter,
44 MultiFunctionAdapter,
45 DiskController,
46 TapeController,
47 CDROMController,
48 WORMController,
49 SerialController,
50 NetworkController,
51 DisplayController,
52 ParallelController,
53 PointerController,
54 KeyboardController,
55 AudioController,
56 OtherController,
57 DiskPeripheral,
58 FloppyDiskPeripheral,
59 TapePeripheral,
60 ModemPeripheral,
61 MonitorPeripheral,
62 PrinterPeripheral,
63 PointerPeripheral,
64 KeyboardPeripheral,
65 TerminalPeripheral,
66 LinePeripheral,
67 NetworkPeripheral,
68#ifdef _NT_PROM
69 Memory,
70#endif
71 OtherPeripheral,
72
73 /* new stuff for IP30 */
74 /* added without moving anything */
75 /* except ANONYMOUS. */
76
77 XTalkAdapter,
78 PCIAdapter,
79 GIOAdapter,
80 TPUAdapter,
81
82 Anonymous
83} CONFIGTYPE;
84
85typedef enum {
86 Failed = 1,
87 ReadOnly = 2,
88 Removable = 4,
89 ConsoleIn = 8,
90 ConsoleOut = 16,
91 Input = 32,
92 Output = 64
93} IDENTIFIERFLAG;
94
95#ifndef NULL /* for GetChild(NULL); */
96#define NULL 0
97#endif
98
99union key_u {
100 struct {
101#ifdef _MIPSEB
102 unsigned char c_bsize; /* block size in lines */
103 unsigned char c_lsize; /* line size in bytes/tag */
104 unsigned short c_size; /* cache size in 4K pages */
105#else /* _MIPSEL */
106 unsigned short c_size; /* cache size in 4K pages */
107 unsigned char c_lsize; /* line size in bytes/tag */
108 unsigned char c_bsize; /* block size in lines */
109#endif /* _MIPSEL */
110 } cache;
111 ULONG FullKey;
112};
113
114#if _MIPS_SIM == _MIPS_SIM_ABI64
115#define SGI_ARCS_VERS 64 /* sgi 64-bit version */
116#define SGI_ARCS_REV 0 /* rev .00 */
117#else
118#define SGI_ARCS_VERS 1 /* first version */
119#define SGI_ARCS_REV 10 /* rev .10, 3/04/92 */
120#endif
121
122typedef struct component {
123 CONFIGCLASS Class;
124 CONFIGTYPE Type;
125 IDENTIFIERFLAG Flags;
126 USHORT Version;
127 USHORT Revision;
128 ULONG Key;
129 ULONG AffinityMask;
130 ULONG ConfigurationDataSize;
131 ULONG IdentifierLength;
132 char *Identifier;
133} COMPONENT;
134
135/* internal structure that holds pathname parsing data */
136struct cfgdata {
137 char *name; /* full name */
138 int minlen; /* minimum length to match */
139 CONFIGTYPE type; /* type of token */
140};
141
142/* System ID */
143typedef struct systemid {
144 CHAR VendorId[8];
145 CHAR ProductId[8];
146} SYSTEMID;
147
148/* memory query functions */
149typedef enum memorytype {
150 ExceptionBlock,
151 SPBPage, /* ARCS == SystemParameterBlock */
152#ifndef _NT_PROM
153 FreeContiguous,
154 FreeMemory,
155 BadMemory,
156 LoadedProgram,
157 FirmwareTemporary,
158 FirmwarePermanent
159#else /* _NT_PROM */
160 FreeMemory,
161 BadMemory,
162 LoadedProgram,
163 FirmwareTemporary,
164 FirmwarePermanent,
165 FreeContiguous
166#endif /* _NT_PROM */
167} MEMORYTYPE;
168
169typedef struct memorydescriptor {
170 MEMORYTYPE Type;
171 LONG BasePage;
172 LONG PageCount;
173} MEMORYDESCRIPTOR;
174
175#endif /* _ASM_ARC_HINV_H */
diff --git a/include/asm-mips/fw/arc/types.h b/include/asm-mips/fw/arc/types.h
deleted file mode 100644
index b9adcd6f0860..000000000000
--- a/include/asm-mips/fw/arc/types.h
+++ /dev/null
@@ -1,86 +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 1999 Ralf Baechle (ralf@gnu.org)
7 * Copyright 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_ARC_TYPES_H
10#define _ASM_ARC_TYPES_H
11
12
13#ifdef CONFIG_ARC32
14
15typedef char CHAR;
16typedef short SHORT;
17typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
18typedef long LONG __attribute__ ((__mode__ (__SI__)));
19typedef unsigned char UCHAR;
20typedef unsigned short USHORT;
21typedef unsigned long ULONG __attribute__ ((__mode__ (__SI__)));
22typedef void VOID;
23
24/* The pointer types. Note that we're using a 64-bit compiler but all
25 pointer in the ARC structures are only 32-bit, so we need some disgusting
26 workarounds. Keep your vomit bag handy. */
27typedef LONG _PCHAR;
28typedef LONG _PSHORT;
29typedef LONG _PLARGE_INTEGER;
30typedef LONG _PLONG;
31typedef LONG _PUCHAR;
32typedef LONG _PUSHORT;
33typedef LONG _PULONG;
34typedef LONG _PVOID;
35
36#endif /* CONFIG_ARC32 */
37
38#ifdef CONFIG_ARC64
39
40typedef char CHAR;
41typedef short SHORT;
42typedef long LARGE_INTEGER __attribute__ ((__mode__ (__DI__)));
43typedef long LONG __attribute__ ((__mode__ (__DI__)));
44typedef unsigned char UCHAR;
45typedef unsigned short USHORT;
46typedef unsigned long ULONG __attribute__ ((__mode__ (__DI__)));
47typedef void VOID;
48
49/* The pointer types. We're 64-bit and the firmware is also 64-bit, so
50 live is sane ... */
51typedef CHAR *_PCHAR;
52typedef SHORT *_PSHORT;
53typedef LARGE_INTEGER *_PLARGE_INTEGER;
54typedef LONG *_PLONG;
55typedef UCHAR *_PUCHAR;
56typedef USHORT *_PUSHORT;
57typedef ULONG *_PULONG;
58typedef VOID *_PVOID;
59
60#endif /* CONFIG_ARC64 */
61
62typedef CHAR *PCHAR;
63typedef SHORT *PSHORT;
64typedef LARGE_INTEGER *PLARGE_INTEGER;
65typedef LONG *PLONG;
66typedef UCHAR *PUCHAR;
67typedef USHORT *PUSHORT;
68typedef ULONG *PULONG;
69typedef VOID *PVOID;
70
71/*
72 * Return type of ArcGetDisplayStatus()
73 */
74typedef struct {
75 USHORT CursorXPosition;
76 USHORT CursorYPosition;
77 USHORT CursorMaxXPosition;
78 USHORT CursorMaxYPosition;
79 USHORT ForegroundColor;
80 USHORT BackgroundColor;
81 UCHAR HighIntensity;
82 UCHAR Underscored;
83 UCHAR ReverseVideo;
84} DISPLAY_STATUS;
85
86#endif /* _ASM_ARC_TYPES_H */
diff --git a/include/asm-mips/fw/cfe/cfe_api.h b/include/asm-mips/fw/cfe/cfe_api.h
deleted file mode 100644
index 0995575db320..000000000000
--- a/include/asm-mips/fw/cfe/cfe_api.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 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 * Broadcom Common Firmware Environment (CFE)
20 *
21 * This file contains declarations for doing callbacks to
22 * cfe from an application. It should be the only header
23 * needed by the application to use this library
24 *
25 * Authors: Mitch Lichtenberg, Chris Demetriou
26 */
27#ifndef CFE_API_H
28#define CFE_API_H
29
30#include <linux/types.h>
31#include <linux/string.h>
32
33typedef long intptr_t;
34
35
36/*
37 * Constants
38 */
39
40/* Seal indicating CFE's presence, passed to user program. */
41#define CFE_EPTSEAL 0x43464531
42
43#define CFE_MI_RESERVED 0 /* memory is reserved, do not use */
44#define CFE_MI_AVAILABLE 1 /* memory is available */
45
46#define CFE_FLG_WARMSTART 0x00000001
47#define CFE_FLG_FULL_ARENA 0x00000001
48#define CFE_FLG_ENV_PERMANENT 0x00000001
49
50#define CFE_CPU_CMD_START 1
51#define CFE_CPU_CMD_STOP 0
52
53#define CFE_STDHANDLE_CONSOLE 0
54
55#define CFE_DEV_NETWORK 1
56#define CFE_DEV_DISK 2
57#define CFE_DEV_FLASH 3
58#define CFE_DEV_SERIAL 4
59#define CFE_DEV_CPU 5
60#define CFE_DEV_NVRAM 6
61#define CFE_DEV_CLOCK 7
62#define CFE_DEV_OTHER 8
63#define CFE_DEV_MASK 0x0F
64
65#define CFE_CACHE_FLUSH_D 1
66#define CFE_CACHE_INVAL_I 2
67#define CFE_CACHE_INVAL_D 4
68#define CFE_CACHE_INVAL_L2 8
69
70#define CFE_FWI_64BIT 0x00000001
71#define CFE_FWI_32BIT 0x00000002
72#define CFE_FWI_RELOC 0x00000004
73#define CFE_FWI_UNCACHED 0x00000008
74#define CFE_FWI_MULTICPU 0x00000010
75#define CFE_FWI_FUNCSIM 0x00000020
76#define CFE_FWI_RTLSIM 0x00000040
77
78typedef struct {
79 int64_t fwi_version; /* major, minor, eco version */
80 int64_t fwi_totalmem; /* total installed mem */
81 int64_t fwi_flags; /* various flags */
82 int64_t fwi_boardid; /* board ID */
83 int64_t fwi_bootarea_va; /* VA of boot area */
84 int64_t fwi_bootarea_pa; /* PA of boot area */
85 int64_t fwi_bootarea_size; /* size of boot area */
86} cfe_fwinfo_t;
87
88
89/*
90 * Defines and prototypes for functions which take no arguments.
91 */
92int64_t cfe_getticks(void);
93
94/*
95 * Defines and prototypes for the rest of the functions.
96 */
97int cfe_close(int handle);
98int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1);
99int cfe_cpu_stop(int cpu);
100int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen);
101int cfe_enummem(int idx, int flags, uint64_t * start, uint64_t * length,
102 uint64_t * type);
103int cfe_exit(int warm, int status);
104int cfe_flushcache(int flg);
105int cfe_getdevinfo(char *name);
106int cfe_getenv(char *name, char *dest, int destlen);
107int cfe_getfwinfo(cfe_fwinfo_t * info);
108int cfe_getstdhandle(int flg);
109int cfe_init(uint64_t handle, uint64_t ept);
110int cfe_inpstat(int handle);
111int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer,
112 int length, int *retlen, uint64_t offset);
113int cfe_open(char *name);
114int cfe_read(int handle, unsigned char *buffer, int length);
115int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
116 int length);
117int cfe_setenv(char *name, char *val);
118int cfe_write(int handle, unsigned char *buffer, int length);
119int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer,
120 int length);
121
122#endif /* CFE_API_H */
diff --git a/include/asm-mips/fw/cfe/cfe_error.h b/include/asm-mips/fw/cfe/cfe_error.h
deleted file mode 100644
index b80374636279..000000000000
--- a/include/asm-mips/fw/cfe/cfe_error.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 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/*
20 * Broadcom Common Firmware Environment (CFE)
21 *
22 * CFE's global error code list is here.
23 *
24 * Author: Mitch Lichtenberg
25 */
26
27#define CFE_OK 0
28#define CFE_ERR -1 /* generic error */
29#define CFE_ERR_INV_COMMAND -2
30#define CFE_ERR_EOF -3
31#define CFE_ERR_IOERR -4
32#define CFE_ERR_NOMEM -5
33#define CFE_ERR_DEVNOTFOUND -6
34#define CFE_ERR_DEVOPEN -7
35#define CFE_ERR_INV_PARAM -8
36#define CFE_ERR_ENVNOTFOUND -9
37#define CFE_ERR_ENVREADONLY -10
38
39#define CFE_ERR_NOTELF -11
40#define CFE_ERR_NOT32BIT -12
41#define CFE_ERR_WRONGENDIAN -13
42#define CFE_ERR_BADELFVERS -14
43#define CFE_ERR_NOTMIPS -15
44#define CFE_ERR_BADELFFMT -16
45#define CFE_ERR_BADADDR -17
46
47#define CFE_ERR_FILENOTFOUND -18
48#define CFE_ERR_UNSUPPORTED -19
49
50#define CFE_ERR_HOSTUNKNOWN -20
51
52#define CFE_ERR_TIMEOUT -21
53
54#define CFE_ERR_PROTOCOLERR -22
55
56#define CFE_ERR_NETDOWN -23
57#define CFE_ERR_NONAMESERVER -24
58
59#define CFE_ERR_NOHANDLES -25
60#define CFE_ERR_ALREADYBOUND -26
61
62#define CFE_ERR_CANNOTSET -27
63#define CFE_ERR_NOMORE -28
64#define CFE_ERR_BADFILESYS -29
65#define CFE_ERR_FSNOTAVAIL -30
66
67#define CFE_ERR_INVBOOTBLOCK -31
68#define CFE_ERR_WRONGDEVTYPE -32
69#define CFE_ERR_BBCHECKSUM -33
70#define CFE_ERR_BOOTPROGCHKSUM -34
71
72#define CFE_ERR_LDRNOTAVAIL -35
73
74#define CFE_ERR_NOTREADY -36
75
76#define CFE_ERR_GETMEM -37
77#define CFE_ERR_SETMEM -38
78
79#define CFE_ERR_NOTCONN -39
80#define CFE_ERR_ADDRINUSE -40
diff --git a/include/asm-mips/gcmpregs.h b/include/asm-mips/gcmpregs.h
deleted file mode 100644
index d74a8a4ca861..000000000000
--- a/include/asm-mips/gcmpregs.h
+++ /dev/null
@@ -1,117 +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) 2000, 07 MIPS Technologies, Inc.
7 *
8 * Multiprocessor Subsystem Register Definitions
9 *
10 */
11#ifndef _ASM_GCMPREGS_H
12#define _ASM_GCMPREGS_H
13
14
15/* Offsets to major blocks within GCMP from GCMP base */
16#define GCMP_GCB_OFS 0x0000 /* Global Control Block */
17#define GCMP_CLCB_OFS 0x2000 /* Core Local Control Block */
18#define GCMP_COCB_OFS 0x4000 /* Core Other Control Block */
19#define GCMP_GDB_OFS 0x8000 /* Global Debug Block */
20
21/* Offsets to individual GCMP registers from GCMP base */
22#define GCMPOFS(block, tag, reg) (GCMP_##block##_OFS + GCMP_##tag##_##reg##_OFS)
23
24#define GCMPGCBOFS(reg) GCMPOFS(GCB, GCB, reg)
25#define GCMPCLCBOFS(reg) GCMPOFS(CLCB, CCB, reg)
26#define GCMPCOCBOFS(reg) GCMPOFS(COCB, CCB, reg)
27#define GCMPGDBOFS(reg) GCMPOFS(GDB, GDB, reg)
28
29/* GCMP register access */
30#define GCMPGCB(reg) REGP(_gcmp_base, GCMPGCBOFS(reg))
31#define GCMPCLCB(reg) REGP(_gcmp_base, GCMPCLCBOFS(reg))
32#define GCMPCOCB(reg) REGP(_gcmp_base, GCMPCOCBOFS(reg))
33#define GCMPGDB(reg) REGP(_gcmp_base, GCMPGDBOFS(reg))
34
35/* Mask generation */
36#define GCMPMSK(block, reg, bits) (MSK(bits)<<GCMP_##block##_##reg##_SHF)
37#define GCMPGCBMSK(reg, bits) GCMPMSK(GCB, reg, bits)
38#define GCMPCCBMSK(reg, bits) GCMPMSK(CCB, reg, bits)
39#define GCMPGDBMSK(reg, bits) GCMPMSK(GDB, reg, bits)
40
41/* GCB registers */
42#define GCMP_GCB_GC_OFS 0x0000 /* Global Config Register */
43#define GCMP_GCB_GC_NUMIOCU_SHF 8
44#define GCMP_GCB_GC_NUMIOCU_MSK GCMPGCBMSK(GC_NUMIOCU, 4)
45#define GCMP_GCB_GC_NUMCORES_SHF 0
46#define GCMP_GCB_GC_NUMCORES_MSK GCMPGCBMSK(GC_NUMCORES, 8)
47#define GCMP_GCB_GCMPB_OFS 0x0008 /* Global GCMP Base */
48#define GCMP_GCB_GCMPB_GCMPBASE_SHF 15
49#define GCMP_GCB_GCMPB_GCMPBASE_MSK GCMPGCBMSK(GCMPB_GCMPBASE, 17)
50#define GCMP_GCB_GCMPB_CMDEFTGT_SHF 0
51#define GCMP_GCB_GCMPB_CMDEFTGT_MSK GCMPGCBMSK(GCMPB_CMDEFTGT, 2)
52#define GCMP_GCB_GCMPB_CMDEFTGT_MEM 0
53#define GCMP_GCB_GCMPB_CMDEFTGT_MEM1 1
54#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU1 2
55#define GCMP_GCB_GCMPB_CMDEFTGT_IOCU2 3
56#define GCMP_GCB_CCMC_OFS 0x0010 /* Global CM Control */
57#define GCMP_GCB_GCSRAP_OFS 0x0020 /* Global CSR Access Privilege */
58#define GCMP_GCB_GCSRAP_CMACCESS_SHF 0
59#define GCMP_GCB_GCSRAP_CMACCESS_MSK GCMPGCBMSK(GCSRAP_CMACCESS, 8)
60#define GCMP_GCB_GCMPREV_OFS 0x0030 /* GCMP Revision Register */
61#define GCMP_GCB_GCMEM_OFS 0x0040 /* Global CM Error Mask */
62#define GCMP_GCB_GCMEC_OFS 0x0048 /* Global CM Error Cause */
63#define GCMP_GCB_GMEC_ERROR_TYPE_SHF 27
64#define GCMP_GCB_GMEC_ERROR_TYPE_MSK GCMPGCBMSK(GMEC_ERROR_TYPE, 5)
65#define GCMP_GCB_GMEC_ERROR_INFO_SHF 0
66#define GCMP_GCB_GMEC_ERROR_INFO_MSK GCMPGCBMSK(GMEC_ERROR_INFO, 27)
67#define GCMP_GCB_GCMEA_OFS 0x0050 /* Global CM Error Address */
68#define GCMP_GCB_GCMEO_OFS 0x0058 /* Global CM Error Multiple */
69#define GCMP_GCB_GMEO_ERROR_2ND_SHF 0
70#define GCMP_GCB_GMEO_ERROR_2ND_MSK GCMPGCBMSK(GMEO_ERROR_2ND, 5)
71#define GCMP_GCB_GICBA_OFS 0x0080 /* Global Interrupt Controller Base Address */
72#define GCMP_GCB_GICBA_BASE_SHF 17
73#define GCMP_GCB_GICBA_BASE_MSK GCMPGCBMSK(GICBA_BASE, 15)
74#define GCMP_GCB_GICBA_EN_SHF 0
75#define GCMP_GCB_GICBA_EN_MSK GCMPGCBMSK(GICBA_EN, 1)
76
77/* GCB Regions */
78#define GCMP_GCB_CMxBASE_OFS(n) (0x0090+16*(n)) /* Global Region[0-3] Base Address */
79#define GCMP_GCB_CMxBASE_BASE_SHF 16
80#define GCMP_GCB_CMxBASE_BASE_MSK GCMPGCBMSK(CMxBASE_BASE, 16)
81#define GCMP_GCB_CMxMASK_OFS(n) (0x0098+16*(n)) /* Global Region[0-3] Address Mask */
82#define GCMP_GCB_CMxMASK_MASK_SHF 16
83#define GCMP_GCB_CMxMASK_MASK_MSK GCMPGCBMSK(CMxMASK_MASK, 16)
84#define GCMP_GCB_CMxMASK_CMREGTGT_SHF 0
85#define GCMP_GCB_CMxMASK_CMREGTGT_MSK GCMPGCBMSK(CMxMASK_CMREGTGT, 2)
86#define GCMP_GCB_CMxMASK_CMREGTGT_MEM 0
87#define GCMP_GCB_CMxMASK_CMREGTGT_MEM1 1
88#define GCMP_GCB_CMxMASK_CMREGTGT_IOCU1 2
89#define GCMP_GCB_CMxMASK_CMREGTGT_IOCU2 3
90
91
92/* Core local/Core other control block registers */
93#define GCMP_CCB_RESETR_OFS 0x0000 /* Reset Release */
94#define GCMP_CCB_RESETR_INRESET_SHF 0
95#define GCMP_CCB_RESETR_INRESET_MSK GCMPCCBMSK(RESETR_INRESET, 16)
96#define GCMP_CCB_COHCTL_OFS 0x0008 /* Coherence Control */
97#define GCMP_CCB_COHCTL_DOMAIN_SHF 0
98#define GCMP_CCB_COHCTL_DOMAIN_MSK GCMPCCBMSK(COHCTL_DOMAIN, 8)
99#define GCMP_CCB_CFG_OFS 0x0010 /* Config */
100#define GCMP_CCB_CFG_IOCUTYPE_SHF 10
101#define GCMP_CCB_CFG_IOCUTYPE_MSK GCMPCCBMSK(CFG_IOCUTYPE, 2)
102#define GCMP_CCB_CFG_IOCUTYPE_CPU 0
103#define GCMP_CCB_CFG_IOCUTYPE_NCIOCU 1
104#define GCMP_CCB_CFG_IOCUTYPE_CIOCU 2
105#define GCMP_CCB_CFG_NUMVPE_SHF 0
106#define GCMP_CCB_CFG_NUMVPE_MSK GCMPCCBMSK(CFG_NUMVPE, 10)
107#define GCMP_CCB_OTHER_OFS 0x0018 /* Other Address */
108#define GCMP_CCB_OTHER_CORENUM_SHF 16
109#define GCMP_CCB_OTHER_CORENUM_MSK GCMPCCBMSK(OTHER_CORENUM, 16)
110#define GCMP_CCB_RESETBASE_OFS 0x0020 /* Reset Exception Base */
111#define GCMP_CCB_RESETBASE_BEV_SHF 12
112#define GCMP_CCB_RESETBASE_BEV_MSK GCMPCCBMSK(RESETBASE_BEV, 20)
113#define GCMP_CCB_ID_OFS 0x0028 /* Identification */
114#define GCMP_CCB_DINTGROUP_OFS 0x0030 /* DINT Group Participate */
115#define GCMP_CCB_DBGGROUP_OFS 0x0100 /* DebugBreak Group */
116
117#endif /* _ASM_GCMPREGS_H */
diff --git a/include/asm-mips/gic.h b/include/asm-mips/gic.h
deleted file mode 100644
index 954807d9d66a..000000000000
--- a/include/asm-mips/gic.h
+++ /dev/null
@@ -1,487 +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) 2000, 07 MIPS Technologies, Inc.
7 *
8 * GIC Register Definitions
9 *
10 */
11#ifndef _ASM_GICREGS_H
12#define _ASM_GICREGS_H
13
14#undef GICISBYTELITTLEENDIAN
15#define GICISWORDLITTLEENDIAN
16
17/* Constants */
18#define GIC_POL_POS 1
19#define GIC_POL_NEG 0
20#define GIC_TRIG_EDGE 1
21#define GIC_TRIG_LEVEL 0
22
23#define GIC_NUM_INTRS 32
24
25#define MSK(n) ((1 << (n)) - 1)
26#define REG32(addr) (*(volatile unsigned int *) (addr))
27#define REG(base, offs) REG32((unsigned long)(base) + offs##_##OFS)
28#define REGP(base, phys) REG32((unsigned long)(base) + (phys))
29
30/* Accessors */
31#define GIC_REG(segment, offset) \
32 REG32(_gic_base + segment##_##SECTION_OFS + offset##_##OFS)
33#define GIC_REG_ADDR(segment, offset) \
34 REG32(_gic_base + segment##_##SECTION_OFS + offset)
35
36#define GIC_ABS_REG(segment, offset) \
37 (_gic_base + segment##_##SECTION_OFS + offset##_##OFS)
38#define GIC_REG_ABS_ADDR(segment, offset) \
39 (_gic_base + segment##_##SECTION_OFS + offset)
40
41#ifdef GICISBYTELITTLEENDIAN
42#define GICREAD(reg, data) (data) = (reg), (data) = le32_to_cpu(data)
43#define GICWRITE(reg, data) (reg) = cpu_to_le32(data)
44#define GICBIS(reg, bits) \
45 ({unsigned int data; \
46 GICREAD(reg, data); \
47 data |= bits; \
48 GICWRITE(reg, data); \
49 })
50
51#else
52#define GICREAD(reg, data) (data) = (reg)
53#define GICWRITE(reg, data) (reg) = (data)
54#define GICBIS(reg, bits) (reg) |= (bits)
55#endif
56
57
58/* GIC Address Space */
59#define SHARED_SECTION_OFS 0x0000
60#define SHARED_SECTION_SIZE 0x8000
61#define VPE_LOCAL_SECTION_OFS 0x8000
62#define VPE_LOCAL_SECTION_SIZE 0x4000
63#define VPE_OTHER_SECTION_OFS 0xc000
64#define VPE_OTHER_SECTION_SIZE 0x4000
65#define USM_VISIBLE_SECTION_OFS 0x10000
66#define USM_VISIBLE_SECTION_SIZE 0x10000
67
68/* Register Map for Shared Section */
69#if defined(CONFIG_CPU_LITTLE_ENDIAN) || defined(GICISWORDLITTLEENDIAN)
70
71#define GIC_SH_CONFIG_OFS 0x0000
72
73/* Shared Global Counter */
74#define GIC_SH_COUNTER_31_00_OFS 0x0010
75#define GIC_SH_COUNTER_63_32_OFS 0x0014
76
77/* Interrupt Polarity */
78#define GIC_SH_POL_31_0_OFS 0x0100
79#define GIC_SH_POL_63_32_OFS 0x0104
80#define GIC_SH_POL_95_64_OFS 0x0108
81#define GIC_SH_POL_127_96_OFS 0x010c
82#define GIC_SH_POL_159_128_OFS 0x0110
83#define GIC_SH_POL_191_160_OFS 0x0114
84#define GIC_SH_POL_223_192_OFS 0x0118
85#define GIC_SH_POL_255_224_OFS 0x011c
86
87/* Edge/Level Triggering */
88#define GIC_SH_TRIG_31_0_OFS 0x0180
89#define GIC_SH_TRIG_63_32_OFS 0x0184
90#define GIC_SH_TRIG_95_64_OFS 0x0188
91#define GIC_SH_TRIG_127_96_OFS 0x018c
92#define GIC_SH_TRIG_159_128_OFS 0x0190
93#define GIC_SH_TRIG_191_160_OFS 0x0194
94#define GIC_SH_TRIG_223_192_OFS 0x0198
95#define GIC_SH_TRIG_255_224_OFS 0x019c
96
97/* Dual Edge Triggering */
98#define GIC_SH_DUAL_31_0_OFS 0x0200
99#define GIC_SH_DUAL_63_32_OFS 0x0204
100#define GIC_SH_DUAL_95_64_OFS 0x0208
101#define GIC_SH_DUAL_127_96_OFS 0x020c
102#define GIC_SH_DUAL_159_128_OFS 0x0210
103#define GIC_SH_DUAL_191_160_OFS 0x0214
104#define GIC_SH_DUAL_223_192_OFS 0x0218
105#define GIC_SH_DUAL_255_224_OFS 0x021c
106
107/* Set/Clear corresponding bit in Edge Detect Register */
108#define GIC_SH_WEDGE_OFS 0x0280
109
110/* Reset Mask - Disables Interrupt */
111#define GIC_SH_RMASK_31_0_OFS 0x0300
112#define GIC_SH_RMASK_63_32_OFS 0x0304
113#define GIC_SH_RMASK_95_64_OFS 0x0308
114#define GIC_SH_RMASK_127_96_OFS 0x030c
115#define GIC_SH_RMASK_159_128_OFS 0x0310
116#define GIC_SH_RMASK_191_160_OFS 0x0314
117#define GIC_SH_RMASK_223_192_OFS 0x0318
118#define GIC_SH_RMASK_255_224_OFS 0x031c
119
120/* Set Mask (WO) - Enables Interrupt */
121#define GIC_SH_SMASK_31_0_OFS 0x0380
122#define GIC_SH_SMASK_63_32_OFS 0x0384
123#define GIC_SH_SMASK_95_64_OFS 0x0388
124#define GIC_SH_SMASK_127_96_OFS 0x038c
125#define GIC_SH_SMASK_159_128_OFS 0x0390
126#define GIC_SH_SMASK_191_160_OFS 0x0394
127#define GIC_SH_SMASK_223_192_OFS 0x0398
128#define GIC_SH_SMASK_255_224_OFS 0x039c
129
130/* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
131#define GIC_SH_MASK_31_0_OFS 0x0400
132#define GIC_SH_MASK_63_32_OFS 0x0404
133#define GIC_SH_MASK_95_64_OFS 0x0408
134#define GIC_SH_MASK_127_96_OFS 0x040c
135#define GIC_SH_MASK_159_128_OFS 0x0410
136#define GIC_SH_MASK_191_160_OFS 0x0414
137#define GIC_SH_MASK_223_192_OFS 0x0418
138#define GIC_SH_MASK_255_224_OFS 0x041c
139
140/* Pending Global Interrupts (RO) */
141#define GIC_SH_PEND_31_0_OFS 0x0480
142#define GIC_SH_PEND_63_32_OFS 0x0484
143#define GIC_SH_PEND_95_64_OFS 0x0488
144#define GIC_SH_PEND_127_96_OFS 0x048c
145#define GIC_SH_PEND_159_128_OFS 0x0490
146#define GIC_SH_PEND_191_160_OFS 0x0494
147#define GIC_SH_PEND_223_192_OFS 0x0498
148#define GIC_SH_PEND_255_224_OFS 0x049c
149
150#define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
151
152/* Maps Interrupt X to a Pin */
153#define GIC_SH_MAP_TO_PIN(intr) \
154 (GIC_SH_INTR_MAP_TO_PIN_BASE_OFS + (4 * intr))
155
156#define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2000
157
158/* Maps Interrupt X to a VPE */
159#define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
160 (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + (((vpe) / 32) * 4))
161#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
162
163/* Polarity : Reset Value is always 0 */
164#define GIC_SH_SET_POLARITY_OFS 0x0100
165#define GIC_SET_POLARITY(intr, pol) \
166 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + (((intr) / 32) * 4)), (pol) << ((intr) % 32))
167
168/* Triggering : Reset Value is always 0 */
169#define GIC_SH_SET_TRIGGER_OFS 0x0180
170#define GIC_SET_TRIGGER(intr, trig) \
171 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + (((intr) / 32) * 4)), (trig) << ((intr) % 32))
172
173/* Mask manipulation */
174#define GIC_SH_SMASK_OFS 0x0380
175#define GIC_SET_INTR_MASK(intr, val) \
176 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32)))
177
178#define GIC_SH_RMASK_OFS 0x0300
179#define GIC_CLR_INTR_MASK(intr, val) \
180 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + (((intr) / 32) * 4)), ((val) << ((intr) % 32)))
181
182/* Register Map for Local Section */
183#define GIC_VPE_CTL_OFS 0x0000
184#define GIC_VPE_PEND_OFS 0x0004
185#define GIC_VPE_MASK_OFS 0x0008
186#define GIC_VPE_RMASK_OFS 0x000c
187#define GIC_VPE_SMASK_OFS 0x0010
188#define GIC_VPE_WD_MAP_OFS 0x0040
189#define GIC_VPE_COMPARE_MAP_OFS 0x0044
190#define GIC_VPE_TIMER_MAP_OFS 0x0048
191#define GIC_VPE_PERFCTR_MAP_OFS 0x0050
192#define GIC_VPE_SWINT0_MAP_OFS 0x0054
193#define GIC_VPE_SWINT1_MAP_OFS 0x0058
194#define GIC_VPE_OTHER_ADDR_OFS 0x0080
195#define GIC_VPE_WD_CONFIG0_OFS 0x0090
196#define GIC_VPE_WD_COUNT0_OFS 0x0094
197#define GIC_VPE_WD_INITIAL0_OFS 0x0098
198#define GIC_VPE_COMPARE_LO_OFS 0x00a0
199#define GIC_VPE_COMPARE_HI 0x00a4
200
201#define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
202#define GIC_VPE_EIC_SS(intr) \
203 (GIC_EIC_SHADOW_SET_BASE + (4 * intr))
204
205#define GIC_VPE_EIC_VEC_BASE 0x0800
206#define GIC_VPE_EIC_VEC(intr) \
207 (GIC_VPE_EIC_VEC_BASE + (4 * intr))
208
209#define GIC_VPE_TENABLE_NMI_OFS 0x1000
210#define GIC_VPE_TENABLE_YQ_OFS 0x1004
211#define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
212#define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
213
214/* User Mode Visible Section Register Map */
215#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0000
216#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0004
217
218#else /* CONFIG_CPU_BIG_ENDIAN */
219
220#define GIC_SH_CONFIG_OFS 0x0000
221
222/* Shared Global Counter */
223#define GIC_SH_COUNTER_31_00_OFS 0x0014
224#define GIC_SH_COUNTER_63_32_OFS 0x0010
225
226/* Interrupt Polarity */
227#define GIC_SH_POL_31_0_OFS 0x0104
228#define GIC_SH_POL_63_32_OFS 0x0100
229#define GIC_SH_POL_95_64_OFS 0x010c
230#define GIC_SH_POL_127_96_OFS 0x0108
231#define GIC_SH_POL_159_128_OFS 0x0114
232#define GIC_SH_POL_191_160_OFS 0x0110
233#define GIC_SH_POL_223_192_OFS 0x011c
234#define GIC_SH_POL_255_224_OFS 0x0118
235
236/* Edge/Level Triggering */
237#define GIC_SH_TRIG_31_0_OFS 0x0184
238#define GIC_SH_TRIG_63_32_OFS 0x0180
239#define GIC_SH_TRIG_95_64_OFS 0x018c
240#define GIC_SH_TRIG_127_96_OFS 0x0188
241#define GIC_SH_TRIG_159_128_OFS 0x0194
242#define GIC_SH_TRIG_191_160_OFS 0x0190
243#define GIC_SH_TRIG_223_192_OFS 0x019c
244#define GIC_SH_TRIG_255_224_OFS 0x0198
245
246/* Dual Edge Triggering */
247#define GIC_SH_DUAL_31_0_OFS 0x0204
248#define GIC_SH_DUAL_63_32_OFS 0x0200
249#define GIC_SH_DUAL_95_64_OFS 0x020c
250#define GIC_SH_DUAL_127_96_OFS 0x0208
251#define GIC_SH_DUAL_159_128_OFS 0x0214
252#define GIC_SH_DUAL_191_160_OFS 0x0210
253#define GIC_SH_DUAL_223_192_OFS 0x021c
254#define GIC_SH_DUAL_255_224_OFS 0x0218
255
256/* Set/Clear corresponding bit in Edge Detect Register */
257#define GIC_SH_WEDGE_OFS 0x0280
258
259/* Reset Mask - Disables Interrupt */
260#define GIC_SH_RMASK_31_0_OFS 0x0304
261#define GIC_SH_RMASK_63_32_OFS 0x0300
262#define GIC_SH_RMASK_95_64_OFS 0x030c
263#define GIC_SH_RMASK_127_96_OFS 0x0308
264#define GIC_SH_RMASK_159_128_OFS 0x0314
265#define GIC_SH_RMASK_191_160_OFS 0x0310
266#define GIC_SH_RMASK_223_192_OFS 0x031c
267#define GIC_SH_RMASK_255_224_OFS 0x0318
268
269/* Set Mask (WO) - Enables Interrupt */
270#define GIC_SH_SMASK_31_0_OFS 0x0384
271#define GIC_SH_SMASK_63_32_OFS 0x0380
272#define GIC_SH_SMASK_95_64_OFS 0x038c
273#define GIC_SH_SMASK_127_96_OFS 0x0388
274#define GIC_SH_SMASK_159_128_OFS 0x0394
275#define GIC_SH_SMASK_191_160_OFS 0x0390
276#define GIC_SH_SMASK_223_192_OFS 0x039c
277#define GIC_SH_SMASK_255_224_OFS 0x0398
278
279/* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */
280#define GIC_SH_MASK_31_0_OFS 0x0404
281#define GIC_SH_MASK_63_32_OFS 0x0400
282#define GIC_SH_MASK_95_64_OFS 0x040c
283#define GIC_SH_MASK_127_96_OFS 0x0408
284#define GIC_SH_MASK_159_128_OFS 0x0414
285#define GIC_SH_MASK_191_160_OFS 0x0410
286#define GIC_SH_MASK_223_192_OFS 0x041c
287#define GIC_SH_MASK_255_224_OFS 0x0418
288
289/* Pending Global Interrupts (RO) */
290#define GIC_SH_PEND_31_0_OFS 0x0484
291#define GIC_SH_PEND_63_32_OFS 0x0480
292#define GIC_SH_PEND_95_64_OFS 0x048c
293#define GIC_SH_PEND_127_96_OFS 0x0488
294#define GIC_SH_PEND_159_128_OFS 0x0494
295#define GIC_SH_PEND_191_160_OFS 0x0490
296#define GIC_SH_PEND_223_192_OFS 0x049c
297#define GIC_SH_PEND_255_224_OFS 0x0498
298
299#define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500
300
301/* Maps Interrupt X to a Pin */
302#define GIC_SH_MAP_TO_PIN(intr) \
303 (GIC_SH_INTR_MAP_TO_PIN_BASE_OFS + (4 * intr))
304
305#define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2004
306
307/*
308 * Maps Interrupt X to a VPE. This is more complex than the LE case, as
309 * odd and even registers need to be transposed. It does work - trust me!
310 */
311#define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \
312 (GIC_SH_INTR_MAP_TO_VPE_BASE_OFS + (32 * (intr)) + \
313 (((((vpe) / 32) ^ 1) - 1) * 4))
314#define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32))
315
316/* Polarity */
317#define GIC_SH_SET_POLARITY_OFS 0x0100
318#define GIC_SET_POLARITY(intr, pol) \
319 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_POLARITY_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (pol) << ((intr) % 32))
320
321/* Triggering */
322#define GIC_SH_SET_TRIGGER_OFS 0x0180
323#define GIC_SET_TRIGGER(intr, trig) \
324 GICBIS(GIC_REG_ADDR(SHARED, GIC_SH_SET_TRIGGER_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), (trig) << ((intr) % 32))
325
326/* Mask manipulation */
327#define GIC_SH_SMASK_OFS 0x0380
328#define GIC_SET_INTR_MASK(intr, val) \
329 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_SMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
330
331#define GIC_SH_RMASK_OFS 0x0300
332#define GIC_CLR_INTR_MASK(intr, val) \
333 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_RMASK_OFS + 4 + (((((intr) / 32) ^ 1) - 1) * 4)), ((val) << ((intr) % 32)))
334
335/* Register Map for Local Section */
336#define GIC_VPE_CTL_OFS 0x0000
337#define GIC_VPE_PEND_OFS 0x0004
338#define GIC_VPE_MASK_OFS 0x0008
339#define GIC_VPE_RMASK_OFS 0x000c
340#define GIC_VPE_SMASK_OFS 0x0010
341#define GIC_VPE_WD_MAP_OFS 0x0040
342#define GIC_VPE_COMPARE_MAP_OFS 0x0044
343#define GIC_VPE_TIMER_MAP_OFS 0x0048
344#define GIC_VPE_PERFCTR_MAP_OFS 0x0050
345#define GIC_VPE_SWINT0_MAP_OFS 0x0054
346#define GIC_VPE_SWINT1_MAP_OFS 0x0058
347#define GIC_VPE_OTHER_ADDR_OFS 0x0080
348#define GIC_VPE_WD_CONFIG0_OFS 0x0090
349#define GIC_VPE_WD_COUNT0_OFS 0x0094
350#define GIC_VPE_WD_INITIAL0_OFS 0x0098
351#define GIC_VPE_COMPARE_LO_OFS 0x00a4
352#define GIC_VPE_COMPARE_HI_OFS 0x00a0
353
354#define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
355#define GIC_VPE_EIC_SS(intr) \
356 (GIC_EIC_SHADOW_SET_BASE + (4 * intr))
357
358#define GIC_VPE_EIC_VEC_BASE 0x0800
359#define GIC_VPE_EIC_VEC(intr) \
360 (GIC_VPE_EIC_VEC_BASE + (4 * intr))
361
362#define GIC_VPE_TENABLE_NMI_OFS 0x1000
363#define GIC_VPE_TENABLE_YQ_OFS 0x1004
364#define GIC_VPE_TENABLE_INT_31_0_OFS 0x1080
365#define GIC_VPE_TENABLE_INT_63_32_OFS 0x1084
366
367/* User Mode Visible Section Register Map */
368#define GIC_UMV_SH_COUNTER_31_00_OFS 0x0004
369#define GIC_UMV_SH_COUNTER_63_32_OFS 0x0000
370
371#endif /* !LE */
372
373/* Masks */
374#define GIC_SH_CONFIG_COUNTSTOP_SHF 28
375#define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF)
376
377#define GIC_SH_CONFIG_COUNTBITS_SHF 24
378#define GIC_SH_CONFIG_COUNTBITS_MSK (MSK(4) << GIC_SH_CONFIG_COUNTBITS_SHF)
379
380#define GIC_SH_CONFIG_NUMINTRS_SHF 16
381#define GIC_SH_CONFIG_NUMINTRS_MSK (MSK(8) << GIC_SH_CONFIG_NUMINTRS_SHF)
382
383#define GIC_SH_CONFIG_NUMVPES_SHF 0
384#define GIC_SH_CONFIG_NUMVPES_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPES_SHF)
385
386#define GIC_SH_WEDGE_SET(intr) (intr | (0x1 << 31))
387#define GIC_SH_WEDGE_CLR(intr) (intr & ~(0x1 << 31))
388
389#define GIC_MAP_TO_PIN_SHF 31
390#define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF)
391#define GIC_MAP_TO_NMI_SHF 30
392#define GIC_MAP_TO_NMI_MSK (MSK(1) << GIC_MAP_TO_NMI_SHF)
393#define GIC_MAP_TO_YQ_SHF 29
394#define GIC_MAP_TO_YQ_MSK (MSK(1) << GIC_MAP_TO_YQ_SHF)
395#define GIC_MAP_SHF 0
396#define GIC_MAP_MSK (MSK(6) << GIC_MAP_SHF)
397
398/* GIC_VPE_CTL Masks */
399#define GIC_VPE_CTL_PERFCNT_RTBL_SHF 2
400#define GIC_VPE_CTL_PERFCNT_RTBL_MSK (MSK(1) << GIC_VPE_CTL_PERFCNT_RTBL_SHF)
401#define GIC_VPE_CTL_TIMER_RTBL_SHF 1
402#define GIC_VPE_CTL_TIMER_RTBL_MSK (MSK(1) << GIC_VPE_CTL_TIMER_RTBL_SHF)
403#define GIC_VPE_CTL_EIC_MODE_SHF 0
404#define GIC_VPE_CTL_EIC_MODE_MSK (MSK(1) << GIC_VPE_CTL_EIC_MODE_SHF)
405
406/* GIC_VPE_PEND Masks */
407#define GIC_VPE_PEND_WD_SHF 0
408#define GIC_VPE_PEND_WD_MSK (MSK(1) << GIC_VPE_PEND_WD_SHF)
409#define GIC_VPE_PEND_CMP_SHF 1
410#define GIC_VPE_PEND_CMP_MSK (MSK(1) << GIC_VPE_PEND_CMP_SHF)
411#define GIC_VPE_PEND_TIMER_SHF 2
412#define GIC_VPE_PEND_TIMER_MSK (MSK(1) << GIC_VPE_PEND_TIMER_SHF)
413#define GIC_VPE_PEND_PERFCOUNT_SHF 3
414#define GIC_VPE_PEND_PERFCOUNT_MSK (MSK(1) << GIC_VPE_PEND_PERFCOUNT_SHF)
415#define GIC_VPE_PEND_SWINT0_SHF 4
416#define GIC_VPE_PEND_SWINT0_MSK (MSK(1) << GIC_VPE_PEND_SWINT0_SHF)
417#define GIC_VPE_PEND_SWINT1_SHF 5
418#define GIC_VPE_PEND_SWINT1_MSK (MSK(1) << GIC_VPE_PEND_SWINT1_SHF)
419
420/* GIC_VPE_RMASK Masks */
421#define GIC_VPE_RMASK_WD_SHF 0
422#define GIC_VPE_RMASK_WD_MSK (MSK(1) << GIC_VPE_RMASK_WD_SHF)
423#define GIC_VPE_RMASK_CMP_SHF 1
424#define GIC_VPE_RMASK_CMP_MSK (MSK(1) << GIC_VPE_RMASK_CMP_SHF)
425#define GIC_VPE_RMASK_TIMER_SHF 2
426#define GIC_VPE_RMASK_TIMER_MSK (MSK(1) << GIC_VPE_RMASK_TIMER_SHF)
427#define GIC_VPE_RMASK_PERFCNT_SHF 3
428#define GIC_VPE_RMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_RMASK_PERFCNT_SHF)
429#define GIC_VPE_RMASK_SWINT0_SHF 4
430#define GIC_VPE_RMASK_SWINT0_MSK (MSK(1) << GIC_VPE_RMASK_SWINT0_SHF)
431#define GIC_VPE_RMASK_SWINT1_SHF 5
432#define GIC_VPE_RMASK_SWINT1_MSK (MSK(1) << GIC_VPE_RMASK_SWINT1_SHF)
433
434/* GIC_VPE_SMASK Masks */
435#define GIC_VPE_SMASK_WD_SHF 0
436#define GIC_VPE_SMASK_WD_MSK (MSK(1) << GIC_VPE_SMASK_WD_SHF)
437#define GIC_VPE_SMASK_CMP_SHF 1
438#define GIC_VPE_SMASK_CMP_MSK (MSK(1) << GIC_VPE_SMASK_CMP_SHF)
439#define GIC_VPE_SMASK_TIMER_SHF 2
440#define GIC_VPE_SMASK_TIMER_MSK (MSK(1) << GIC_VPE_SMASK_TIMER_SHF)
441#define GIC_VPE_SMASK_PERFCNT_SHF 3
442#define GIC_VPE_SMASK_PERFCNT_MSK (MSK(1) << GIC_VPE_SMASK_PERFCNT_SHF)
443#define GIC_VPE_SMASK_SWINT0_SHF 4
444#define GIC_VPE_SMASK_SWINT0_MSK (MSK(1) << GIC_VPE_SMASK_SWINT0_SHF)
445#define GIC_VPE_SMASK_SWINT1_SHF 5
446#define GIC_VPE_SMASK_SWINT1_MSK (MSK(1) << GIC_VPE_SMASK_SWINT1_SHF)
447
448/*
449 * Set the Mapping of Interrupt X to a VPE.
450 */
451#define GIC_SH_MAP_TO_VPE_SMASK(intr, vpe) \
452 GICWRITE(GIC_REG_ADDR(SHARED, GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe)), \
453 GIC_SH_MAP_TO_VPE_REG_BIT(vpe))
454
455struct gic_pcpu_mask {
456 DECLARE_BITMAP(pcpu_mask, GIC_NUM_INTRS);
457};
458
459struct gic_pending_regs {
460 DECLARE_BITMAP(pending, GIC_NUM_INTRS);
461};
462
463struct gic_intrmask_regs {
464 DECLARE_BITMAP(intrmask, GIC_NUM_INTRS);
465};
466
467/*
468 * Interrupt Meta-data specification. The ipiflag helps
469 * in building ipi_map.
470 */
471struct gic_intr_map {
472 unsigned int intrnum; /* Ext Intr Num */
473 unsigned int cpunum; /* Directed to this CPU */
474 unsigned int pin; /* Directed to this Pin */
475 unsigned int polarity; /* Polarity : +/- */
476 unsigned int trigtype; /* Trigger : Edge/Levl */
477 unsigned int ipiflag; /* Is used for IPI ? */
478};
479
480extern void gic_init(unsigned long gic_base_addr,
481 unsigned long gic_addrspace_size, struct gic_intr_map *intrmap,
482 unsigned int intrmap_size, unsigned int irqbase);
483
484extern unsigned int gic_get_int(void);
485extern void gic_send_ipi(unsigned int intr);
486
487#endif /* _ASM_GICREGS_H */
diff --git a/include/asm-mips/gpio.h b/include/asm-mips/gpio.h
deleted file mode 100644
index 06e46faf862d..000000000000
--- a/include/asm-mips/gpio.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_MIPS_GPIO_H
2#define __ASM_MIPS_GPIO_H
3
4#include <gpio.h>
5
6#endif /* __ASM_MIPS_GPIO_H */
diff --git a/include/asm-mips/gt64120.h b/include/asm-mips/gt64120.h
deleted file mode 100644
index e64b41093c49..000000000000
--- a/include/asm-mips/gt64120.h
+++ /dev/null
@@ -1,580 +0,0 @@
1/*
2 * Copyright (C) 2000, 2004, 2005 MIPS Technologies, Inc.
3 * All rights reserved.
4 * Authors: Carsten Langgaard <carstenl@mips.com>
5 * Maciej W. Rozycki <macro@mips.com>
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef _ASM_GT64120_H
22#define _ASM_GT64120_H
23
24#include <linux/clocksource.h>
25
26#include <asm/addrspace.h>
27#include <asm/byteorder.h>
28
29#define MSK(n) ((1 << (n)) - 1)
30
31/*
32 * Register offset addresses
33 */
34/* CPU Configuration. */
35#define GT_CPU_OFS 0x000
36
37#define GT_MULTI_OFS 0x120
38
39/* CPU Address Decode. */
40#define GT_SCS10LD_OFS 0x008
41#define GT_SCS10HD_OFS 0x010
42#define GT_SCS32LD_OFS 0x018
43#define GT_SCS32HD_OFS 0x020
44#define GT_CS20LD_OFS 0x028
45#define GT_CS20HD_OFS 0x030
46#define GT_CS3BOOTLD_OFS 0x038
47#define GT_CS3BOOTHD_OFS 0x040
48#define GT_PCI0IOLD_OFS 0x048
49#define GT_PCI0IOHD_OFS 0x050
50#define GT_PCI0M0LD_OFS 0x058
51#define GT_PCI0M0HD_OFS 0x060
52#define GT_ISD_OFS 0x068
53
54#define GT_PCI0M1LD_OFS 0x080
55#define GT_PCI0M1HD_OFS 0x088
56#define GT_PCI1IOLD_OFS 0x090
57#define GT_PCI1IOHD_OFS 0x098
58#define GT_PCI1M0LD_OFS 0x0a0
59#define GT_PCI1M0HD_OFS 0x0a8
60#define GT_PCI1M1LD_OFS 0x0b0
61#define GT_PCI1M1HD_OFS 0x0b8
62#define GT_PCI1M1LD_OFS 0x0b0
63#define GT_PCI1M1HD_OFS 0x0b8
64
65#define GT_SCS10AR_OFS 0x0d0
66#define GT_SCS32AR_OFS 0x0d8
67#define GT_CS20R_OFS 0x0e0
68#define GT_CS3BOOTR_OFS 0x0e8
69
70#define GT_PCI0IOREMAP_OFS 0x0f0
71#define GT_PCI0M0REMAP_OFS 0x0f8
72#define GT_PCI0M1REMAP_OFS 0x100
73#define GT_PCI1IOREMAP_OFS 0x108
74#define GT_PCI1M0REMAP_OFS 0x110
75#define GT_PCI1M1REMAP_OFS 0x118
76
77/* CPU Error Report. */
78#define GT_CPUERR_ADDRLO_OFS 0x070
79#define GT_CPUERR_ADDRHI_OFS 0x078
80
81#define GT_CPUERR_DATALO_OFS 0x128 /* GT-64120A only */
82#define GT_CPUERR_DATAHI_OFS 0x130 /* GT-64120A only */
83#define GT_CPUERR_PARITY_OFS 0x138 /* GT-64120A only */
84
85/* CPU Sync Barrier. */
86#define GT_PCI0SYNC_OFS 0x0c0
87#define GT_PCI1SYNC_OFS 0x0c8
88
89/* SDRAM and Device Address Decode. */
90#define GT_SCS0LD_OFS 0x400
91#define GT_SCS0HD_OFS 0x404
92#define GT_SCS1LD_OFS 0x408
93#define GT_SCS1HD_OFS 0x40c
94#define GT_SCS2LD_OFS 0x410
95#define GT_SCS2HD_OFS 0x414
96#define GT_SCS3LD_OFS 0x418
97#define GT_SCS3HD_OFS 0x41c
98#define GT_CS0LD_OFS 0x420
99#define GT_CS0HD_OFS 0x424
100#define GT_CS1LD_OFS 0x428
101#define GT_CS1HD_OFS 0x42c
102#define GT_CS2LD_OFS 0x430
103#define GT_CS2HD_OFS 0x434
104#define GT_CS3LD_OFS 0x438
105#define GT_CS3HD_OFS 0x43c
106#define GT_BOOTLD_OFS 0x440
107#define GT_BOOTHD_OFS 0x444
108
109#define GT_ADERR_OFS 0x470
110
111/* SDRAM Configuration. */
112#define GT_SDRAM_CFG_OFS 0x448
113
114#define GT_SDRAM_OPMODE_OFS 0x474
115#define GT_SDRAM_BM_OFS 0x478
116#define GT_SDRAM_ADDRDECODE_OFS 0x47c
117
118/* SDRAM Parameters. */
119#define GT_SDRAM_B0_OFS 0x44c
120#define GT_SDRAM_B1_OFS 0x450
121#define GT_SDRAM_B2_OFS 0x454
122#define GT_SDRAM_B3_OFS 0x458
123
124/* Device Parameters. */
125#define GT_DEV_B0_OFS 0x45c
126#define GT_DEV_B1_OFS 0x460
127#define GT_DEV_B2_OFS 0x464
128#define GT_DEV_B3_OFS 0x468
129#define GT_DEV_BOOT_OFS 0x46c
130
131/* ECC. */
132#define GT_ECC_ERRDATALO 0x480 /* GT-64120A only */
133#define GT_ECC_ERRDATAHI 0x484 /* GT-64120A only */
134#define GT_ECC_MEM 0x488 /* GT-64120A only */
135#define GT_ECC_CALC 0x48c /* GT-64120A only */
136#define GT_ECC_ERRADDR 0x490 /* GT-64120A only */
137
138/* DMA Record. */
139#define GT_DMA0_CNT_OFS 0x800
140#define GT_DMA1_CNT_OFS 0x804
141#define GT_DMA2_CNT_OFS 0x808
142#define GT_DMA3_CNT_OFS 0x80c
143#define GT_DMA0_SA_OFS 0x810
144#define GT_DMA1_SA_OFS 0x814
145#define GT_DMA2_SA_OFS 0x818
146#define GT_DMA3_SA_OFS 0x81c
147#define GT_DMA0_DA_OFS 0x820
148#define GT_DMA1_DA_OFS 0x824
149#define GT_DMA2_DA_OFS 0x828
150#define GT_DMA3_DA_OFS 0x82c
151#define GT_DMA0_NEXT_OFS 0x830
152#define GT_DMA1_NEXT_OFS 0x834
153#define GT_DMA2_NEXT_OFS 0x838
154#define GT_DMA3_NEXT_OFS 0x83c
155
156#define GT_DMA0_CUR_OFS 0x870
157#define GT_DMA1_CUR_OFS 0x874
158#define GT_DMA2_CUR_OFS 0x878
159#define GT_DMA3_CUR_OFS 0x87c
160
161/* DMA Channel Control. */
162#define GT_DMA0_CTRL_OFS 0x840
163#define GT_DMA1_CTRL_OFS 0x844
164#define GT_DMA2_CTRL_OFS 0x848
165#define GT_DMA3_CTRL_OFS 0x84c
166
167/* DMA Arbiter. */
168#define GT_DMA_ARB_OFS 0x860
169
170/* Timer/Counter. */
171#define GT_TC0_OFS 0x850
172#define GT_TC1_OFS 0x854
173#define GT_TC2_OFS 0x858
174#define GT_TC3_OFS 0x85c
175
176#define GT_TC_CONTROL_OFS 0x864
177
178/* PCI Internal. */
179#define GT_PCI0_CMD_OFS 0xc00
180#define GT_PCI0_TOR_OFS 0xc04
181#define GT_PCI0_BS_SCS10_OFS 0xc08
182#define GT_PCI0_BS_SCS32_OFS 0xc0c
183#define GT_PCI0_BS_CS20_OFS 0xc10
184#define GT_PCI0_BS_CS3BT_OFS 0xc14
185
186#define GT_PCI1_IACK_OFS 0xc30
187#define GT_PCI0_IACK_OFS 0xc34
188
189#define GT_PCI0_BARE_OFS 0xc3c
190#define GT_PCI0_PREFMBR_OFS 0xc40
191
192#define GT_PCI0_SCS10_BAR_OFS 0xc48
193#define GT_PCI0_SCS32_BAR_OFS 0xc4c
194#define GT_PCI0_CS20_BAR_OFS 0xc50
195#define GT_PCI0_CS3BT_BAR_OFS 0xc54
196#define GT_PCI0_SSCS10_BAR_OFS 0xc58
197#define GT_PCI0_SSCS32_BAR_OFS 0xc5c
198
199#define GT_PCI0_SCS3BT_BAR_OFS 0xc64
200
201#define GT_PCI1_CMD_OFS 0xc80
202#define GT_PCI1_TOR_OFS 0xc84
203#define GT_PCI1_BS_SCS10_OFS 0xc88
204#define GT_PCI1_BS_SCS32_OFS 0xc8c
205#define GT_PCI1_BS_CS20_OFS 0xc90
206#define GT_PCI1_BS_CS3BT_OFS 0xc94
207
208#define GT_PCI1_BARE_OFS 0xcbc
209#define GT_PCI1_PREFMBR_OFS 0xcc0
210
211#define GT_PCI1_SCS10_BAR_OFS 0xcc8
212#define GT_PCI1_SCS32_BAR_OFS 0xccc
213#define GT_PCI1_CS20_BAR_OFS 0xcd0
214#define GT_PCI1_CS3BT_BAR_OFS 0xcd4
215#define GT_PCI1_SSCS10_BAR_OFS 0xcd8
216#define GT_PCI1_SSCS32_BAR_OFS 0xcdc
217
218#define GT_PCI1_SCS3BT_BAR_OFS 0xce4
219
220#define GT_PCI1_CFGADDR_OFS 0xcf0
221#define GT_PCI1_CFGDATA_OFS 0xcf4
222#define GT_PCI0_CFGADDR_OFS 0xcf8
223#define GT_PCI0_CFGDATA_OFS 0xcfc
224
225/* Interrupts. */
226#define GT_INTRCAUSE_OFS 0xc18
227#define GT_INTRMASK_OFS 0xc1c
228
229#define GT_PCI0_ICMASK_OFS 0xc24
230#define GT_PCI0_SERR0MASK_OFS 0xc28
231
232#define GT_CPU_INTSEL_OFS 0xc70
233#define GT_PCI0_INTSEL_OFS 0xc74
234
235#define GT_HINTRCAUSE_OFS 0xc98
236#define GT_HINTRMASK_OFS 0xc9c
237
238#define GT_PCI0_HICMASK_OFS 0xca4
239#define GT_PCI1_SERR1MASK_OFS 0xca8
240
241
242/*
243 * I2O Support Registers
244 */
245#define INBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x010
246#define INBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x014
247#define OUTBOUND_MESSAGE_REGISTER0_PCI_SIDE 0x018
248#define OUTBOUND_MESSAGE_REGISTER1_PCI_SIDE 0x01c
249#define INBOUND_DOORBELL_REGISTER_PCI_SIDE 0x020
250#define INBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x024
251#define INBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x028
252#define OUTBOUND_DOORBELL_REGISTER_PCI_SIDE 0x02c
253#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_PCI_SIDE 0x030
254#define OUTBOUND_INTERRUPT_MASK_REGISTER_PCI_SIDE 0x034
255#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x040
256#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_PCI_SIDE 0x044
257#define QUEUE_CONTROL_REGISTER_PCI_SIDE 0x050
258#define QUEUE_BASE_ADDRESS_REGISTER_PCI_SIDE 0x054
259#define INBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x060
260#define INBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x064
261#define INBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x068
262#define INBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x06c
263#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_PCI_SIDE 0x070
264#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_PCI_SIDE 0x074
265#define OUTBOUND_POST_HEAD_POINTER_REGISTER_PCI_SIDE 0x078
266#define OUTBOUND_POST_TAIL_POINTER_REGISTER_PCI_SIDE 0x07c
267
268#define INBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c10
269#define INBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c14
270#define OUTBOUND_MESSAGE_REGISTER0_CPU_SIDE 0x1c18
271#define OUTBOUND_MESSAGE_REGISTER1_CPU_SIDE 0x1c1c
272#define INBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c20
273#define INBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c24
274#define INBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c28
275#define OUTBOUND_DOORBELL_REGISTER_CPU_SIDE 0x1c2c
276#define OUTBOUND_INTERRUPT_CAUSE_REGISTER_CPU_SIDE 0x1c30
277#define OUTBOUND_INTERRUPT_MASK_REGISTER_CPU_SIDE 0x1c34
278#define INBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c40
279#define OUTBOUND_QUEUE_PORT_VIRTUAL_REGISTER_CPU_SIDE 0x1c44
280#define QUEUE_CONTROL_REGISTER_CPU_SIDE 0x1c50
281#define QUEUE_BASE_ADDRESS_REGISTER_CPU_SIDE 0x1c54
282#define INBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c60
283#define INBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c64
284#define INBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c68
285#define INBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c6c
286#define OUTBOUND_FREE_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c70
287#define OUTBOUND_FREE_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c74
288#define OUTBOUND_POST_HEAD_POINTER_REGISTER_CPU_SIDE 0x1c78
289#define OUTBOUND_POST_TAIL_POINTER_REGISTER_CPU_SIDE 0x1c7c
290
291/*
292 * Register encodings
293 */
294#define GT_CPU_ENDIAN_SHF 12
295#define GT_CPU_ENDIAN_MSK (MSK(1) << GT_CPU_ENDIAN_SHF)
296#define GT_CPU_ENDIAN_BIT GT_CPU_ENDIAN_MSK
297#define GT_CPU_WR_SHF 16
298#define GT_CPU_WR_MSK (MSK(1) << GT_CPU_WR_SHF)
299#define GT_CPU_WR_BIT GT_CPU_WR_MSK
300#define GT_CPU_WR_DXDXDXDX 0
301#define GT_CPU_WR_DDDD 1
302
303
304#define GT_PCI_DCRM_SHF 21
305#define GT_PCI_LD_SHF 0
306#define GT_PCI_LD_MSK (MSK(15) << GT_PCI_LD_SHF)
307#define GT_PCI_HD_SHF 0
308#define GT_PCI_HD_MSK (MSK(7) << GT_PCI_HD_SHF)
309#define GT_PCI_REMAP_SHF 0
310#define GT_PCI_REMAP_MSK (MSK(11) << GT_PCI_REMAP_SHF)
311
312
313#define GT_CFGADDR_CFGEN_SHF 31
314#define GT_CFGADDR_CFGEN_MSK (MSK(1) << GT_CFGADDR_CFGEN_SHF)
315#define GT_CFGADDR_CFGEN_BIT GT_CFGADDR_CFGEN_MSK
316
317#define GT_CFGADDR_BUSNUM_SHF 16
318#define GT_CFGADDR_BUSNUM_MSK (MSK(8) << GT_CFGADDR_BUSNUM_SHF)
319
320#define GT_CFGADDR_DEVNUM_SHF 11
321#define GT_CFGADDR_DEVNUM_MSK (MSK(5) << GT_CFGADDR_DEVNUM_SHF)
322
323#define GT_CFGADDR_FUNCNUM_SHF 8
324#define GT_CFGADDR_FUNCNUM_MSK (MSK(3) << GT_CFGADDR_FUNCNUM_SHF)
325
326#define GT_CFGADDR_REGNUM_SHF 2
327#define GT_CFGADDR_REGNUM_MSK (MSK(6) << GT_CFGADDR_REGNUM_SHF)
328
329
330#define GT_SDRAM_BM_ORDER_SHF 2
331#define GT_SDRAM_BM_ORDER_MSK (MSK(1) << GT_SDRAM_BM_ORDER_SHF)
332#define GT_SDRAM_BM_ORDER_BIT GT_SDRAM_BM_ORDER_MSK
333#define GT_SDRAM_BM_ORDER_SUB 1
334#define GT_SDRAM_BM_ORDER_LIN 0
335
336#define GT_SDRAM_BM_RSVD_ALL1 0xffb
337
338
339#define GT_SDRAM_ADDRDECODE_ADDR_SHF 0
340#define GT_SDRAM_ADDRDECODE_ADDR_MSK (MSK(3) << GT_SDRAM_ADDRDECODE_ADDR_SHF)
341#define GT_SDRAM_ADDRDECODE_ADDR_0 0
342#define GT_SDRAM_ADDRDECODE_ADDR_1 1
343#define GT_SDRAM_ADDRDECODE_ADDR_2 2
344#define GT_SDRAM_ADDRDECODE_ADDR_3 3
345#define GT_SDRAM_ADDRDECODE_ADDR_4 4
346#define GT_SDRAM_ADDRDECODE_ADDR_5 5
347#define GT_SDRAM_ADDRDECODE_ADDR_6 6
348#define GT_SDRAM_ADDRDECODE_ADDR_7 7
349
350
351#define GT_SDRAM_B0_CASLAT_SHF 0
352#define GT_SDRAM_B0_CASLAT_MSK (MSK(2) << GT_SDRAM_B0__SHF)
353#define GT_SDRAM_B0_CASLAT_2 1
354#define GT_SDRAM_B0_CASLAT_3 2
355
356#define GT_SDRAM_B0_FTDIS_SHF 2
357#define GT_SDRAM_B0_FTDIS_MSK (MSK(1) << GT_SDRAM_B0_FTDIS_SHF)
358#define GT_SDRAM_B0_FTDIS_BIT GT_SDRAM_B0_FTDIS_MSK
359
360#define GT_SDRAM_B0_SRASPRCHG_SHF 3
361#define GT_SDRAM_B0_SRASPRCHG_MSK (MSK(1) << GT_SDRAM_B0_SRASPRCHG_SHF)
362#define GT_SDRAM_B0_SRASPRCHG_BIT GT_SDRAM_B0_SRASPRCHG_MSK
363#define GT_SDRAM_B0_SRASPRCHG_2 0
364#define GT_SDRAM_B0_SRASPRCHG_3 1
365
366#define GT_SDRAM_B0_B0COMPAB_SHF 4
367#define GT_SDRAM_B0_B0COMPAB_MSK (MSK(1) << GT_SDRAM_B0_B0COMPAB_SHF)
368#define GT_SDRAM_B0_B0COMPAB_BIT GT_SDRAM_B0_B0COMPAB_MSK
369
370#define GT_SDRAM_B0_64BITINT_SHF 5
371#define GT_SDRAM_B0_64BITINT_MSK (MSK(1) << GT_SDRAM_B0_64BITINT_SHF)
372#define GT_SDRAM_B0_64BITINT_BIT GT_SDRAM_B0_64BITINT_MSK
373#define GT_SDRAM_B0_64BITINT_2 0
374#define GT_SDRAM_B0_64BITINT_4 1
375
376#define GT_SDRAM_B0_BW_SHF 6
377#define GT_SDRAM_B0_BW_MSK (MSK(1) << GT_SDRAM_B0_BW_SHF)
378#define GT_SDRAM_B0_BW_BIT GT_SDRAM_B0_BW_MSK
379#define GT_SDRAM_B0_BW_32 0
380#define GT_SDRAM_B0_BW_64 1
381
382#define GT_SDRAM_B0_BLODD_SHF 7
383#define GT_SDRAM_B0_BLODD_MSK (MSK(1) << GT_SDRAM_B0_BLODD_SHF)
384#define GT_SDRAM_B0_BLODD_BIT GT_SDRAM_B0_BLODD_MSK
385
386#define GT_SDRAM_B0_PAR_SHF 8
387#define GT_SDRAM_B0_PAR_MSK (MSK(1) << GT_SDRAM_B0_PAR_SHF)
388#define GT_SDRAM_B0_PAR_BIT GT_SDRAM_B0_PAR_MSK
389
390#define GT_SDRAM_B0_BYPASS_SHF 9
391#define GT_SDRAM_B0_BYPASS_MSK (MSK(1) << GT_SDRAM_B0_BYPASS_SHF)
392#define GT_SDRAM_B0_BYPASS_BIT GT_SDRAM_B0_BYPASS_MSK
393
394#define GT_SDRAM_B0_SRAS2SCAS_SHF 10
395#define GT_SDRAM_B0_SRAS2SCAS_MSK (MSK(1) << GT_SDRAM_B0_SRAS2SCAS_SHF)
396#define GT_SDRAM_B0_SRAS2SCAS_BIT GT_SDRAM_B0_SRAS2SCAS_MSK
397#define GT_SDRAM_B0_SRAS2SCAS_2 0
398#define GT_SDRAM_B0_SRAS2SCAS_3 1
399
400#define GT_SDRAM_B0_SIZE_SHF 11
401#define GT_SDRAM_B0_SIZE_MSK (MSK(1) << GT_SDRAM_B0_SIZE_SHF)
402#define GT_SDRAM_B0_SIZE_BIT GT_SDRAM_B0_SIZE_MSK
403#define GT_SDRAM_B0_SIZE_16M 0
404#define GT_SDRAM_B0_SIZE_64M 1
405
406#define GT_SDRAM_B0_EXTPAR_SHF 12
407#define GT_SDRAM_B0_EXTPAR_MSK (MSK(1) << GT_SDRAM_B0_EXTPAR_SHF)
408#define GT_SDRAM_B0_EXTPAR_BIT GT_SDRAM_B0_EXTPAR_MSK
409
410#define GT_SDRAM_B0_BLEN_SHF 13
411#define GT_SDRAM_B0_BLEN_MSK (MSK(1) << GT_SDRAM_B0_BLEN_SHF)
412#define GT_SDRAM_B0_BLEN_BIT GT_SDRAM_B0_BLEN_MSK
413#define GT_SDRAM_B0_BLEN_8 0
414#define GT_SDRAM_B0_BLEN_4 1
415
416
417#define GT_SDRAM_CFG_REFINT_SHF 0
418#define GT_SDRAM_CFG_REFINT_MSK (MSK(14) << GT_SDRAM_CFG_REFINT_SHF)
419
420#define GT_SDRAM_CFG_NINTERLEAVE_SHF 14
421#define GT_SDRAM_CFG_NINTERLEAVE_MSK (MSK(1) << GT_SDRAM_CFG_NINTERLEAVE_SHF)
422#define GT_SDRAM_CFG_NINTERLEAVE_BIT GT_SDRAM_CFG_NINTERLEAVE_MSK
423
424#define GT_SDRAM_CFG_RMW_SHF 15
425#define GT_SDRAM_CFG_RMW_MSK (MSK(1) << GT_SDRAM_CFG_RMW_SHF)
426#define GT_SDRAM_CFG_RMW_BIT GT_SDRAM_CFG_RMW_MSK
427
428#define GT_SDRAM_CFG_NONSTAGREF_SHF 16
429#define GT_SDRAM_CFG_NONSTAGREF_MSK (MSK(1) << GT_SDRAM_CFG_NONSTAGREF_SHF)
430#define GT_SDRAM_CFG_NONSTAGREF_BIT GT_SDRAM_CFG_NONSTAGREF_MSK
431
432#define GT_SDRAM_CFG_DUPCNTL_SHF 19
433#define GT_SDRAM_CFG_DUPCNTL_MSK (MSK(1) << GT_SDRAM_CFG_DUPCNTL_SHF)
434#define GT_SDRAM_CFG_DUPCNTL_BIT GT_SDRAM_CFG_DUPCNTL_MSK
435
436#define GT_SDRAM_CFG_DUPBA_SHF 20
437#define GT_SDRAM_CFG_DUPBA_MSK (MSK(1) << GT_SDRAM_CFG_DUPBA_SHF)
438#define GT_SDRAM_CFG_DUPBA_BIT GT_SDRAM_CFG_DUPBA_MSK
439
440#define GT_SDRAM_CFG_DUPEOT0_SHF 21
441#define GT_SDRAM_CFG_DUPEOT0_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT0_SHF)
442#define GT_SDRAM_CFG_DUPEOT0_BIT GT_SDRAM_CFG_DUPEOT0_MSK
443
444#define GT_SDRAM_CFG_DUPEOT1_SHF 22
445#define GT_SDRAM_CFG_DUPEOT1_MSK (MSK(1) << GT_SDRAM_CFG_DUPEOT1_SHF)
446#define GT_SDRAM_CFG_DUPEOT1_BIT GT_SDRAM_CFG_DUPEOT1_MSK
447
448#define GT_SDRAM_OPMODE_OP_SHF 0
449#define GT_SDRAM_OPMODE_OP_MSK (MSK(3) << GT_SDRAM_OPMODE_OP_SHF)
450#define GT_SDRAM_OPMODE_OP_NORMAL 0
451#define GT_SDRAM_OPMODE_OP_NOP 1
452#define GT_SDRAM_OPMODE_OP_PRCHG 2
453#define GT_SDRAM_OPMODE_OP_MODE 3
454#define GT_SDRAM_OPMODE_OP_CBR 4
455
456#define GT_TC_CONTROL_ENTC0_SHF 0
457#define GT_TC_CONTROL_ENTC0_MSK (MSK(1) << GT_TC_CONTROL_ENTC0_SHF)
458#define GT_TC_CONTROL_ENTC0_BIT GT_TC_CONTROL_ENTC0_MSK
459#define GT_TC_CONTROL_SELTC0_SHF 1
460#define GT_TC_CONTROL_SELTC0_MSK (MSK(1) << GT_TC_CONTROL_SELTC0_SHF)
461#define GT_TC_CONTROL_SELTC0_BIT GT_TC_CONTROL_SELTC0_MSK
462
463
464#define GT_PCI0_BARE_SWSCS3BOOTDIS_SHF 0
465#define GT_PCI0_BARE_SWSCS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS3BOOTDIS_SHF)
466#define GT_PCI0_BARE_SWSCS3BOOTDIS_BIT GT_PCI0_BARE_SWSCS3BOOTDIS_MSK
467
468#define GT_PCI0_BARE_SWSCS32DIS_SHF 1
469#define GT_PCI0_BARE_SWSCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS32DIS_SHF)
470#define GT_PCI0_BARE_SWSCS32DIS_BIT GT_PCI0_BARE_SWSCS32DIS_MSK
471
472#define GT_PCI0_BARE_SWSCS10DIS_SHF 2
473#define GT_PCI0_BARE_SWSCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SWSCS10DIS_SHF)
474#define GT_PCI0_BARE_SWSCS10DIS_BIT GT_PCI0_BARE_SWSCS10DIS_MSK
475
476#define GT_PCI0_BARE_INTIODIS_SHF 3
477#define GT_PCI0_BARE_INTIODIS_MSK (MSK(1) << GT_PCI0_BARE_INTIODIS_SHF)
478#define GT_PCI0_BARE_INTIODIS_BIT GT_PCI0_BARE_INTIODIS_MSK
479
480#define GT_PCI0_BARE_INTMEMDIS_SHF 4
481#define GT_PCI0_BARE_INTMEMDIS_MSK (MSK(1) << GT_PCI0_BARE_INTMEMDIS_SHF)
482#define GT_PCI0_BARE_INTMEMDIS_BIT GT_PCI0_BARE_INTMEMDIS_MSK
483
484#define GT_PCI0_BARE_CS3BOOTDIS_SHF 5
485#define GT_PCI0_BARE_CS3BOOTDIS_MSK (MSK(1) << GT_PCI0_BARE_CS3BOOTDIS_SHF)
486#define GT_PCI0_BARE_CS3BOOTDIS_BIT GT_PCI0_BARE_CS3BOOTDIS_MSK
487
488#define GT_PCI0_BARE_CS20DIS_SHF 6
489#define GT_PCI0_BARE_CS20DIS_MSK (MSK(1) << GT_PCI0_BARE_CS20DIS_SHF)
490#define GT_PCI0_BARE_CS20DIS_BIT GT_PCI0_BARE_CS20DIS_MSK
491
492#define GT_PCI0_BARE_SCS32DIS_SHF 7
493#define GT_PCI0_BARE_SCS32DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS32DIS_SHF)
494#define GT_PCI0_BARE_SCS32DIS_BIT GT_PCI0_BARE_SCS32DIS_MSK
495
496#define GT_PCI0_BARE_SCS10DIS_SHF 8
497#define GT_PCI0_BARE_SCS10DIS_MSK (MSK(1) << GT_PCI0_BARE_SCS10DIS_SHF)
498#define GT_PCI0_BARE_SCS10DIS_BIT GT_PCI0_BARE_SCS10DIS_MSK
499
500
501#define GT_INTRCAUSE_MASABORT0_SHF 18
502#define GT_INTRCAUSE_MASABORT0_MSK (MSK(1) << GT_INTRCAUSE_MASABORT0_SHF)
503#define GT_INTRCAUSE_MASABORT0_BIT GT_INTRCAUSE_MASABORT0_MSK
504
505#define GT_INTRCAUSE_TARABORT0_SHF 19
506#define GT_INTRCAUSE_TARABORT0_MSK (MSK(1) << GT_INTRCAUSE_TARABORT0_SHF)
507#define GT_INTRCAUSE_TARABORT0_BIT GT_INTRCAUSE_TARABORT0_MSK
508
509
510#define GT_PCI0_CFGADDR_REGNUM_SHF 2
511#define GT_PCI0_CFGADDR_REGNUM_MSK (MSK(6) << GT_PCI0_CFGADDR_REGNUM_SHF)
512#define GT_PCI0_CFGADDR_FUNCTNUM_SHF 8
513#define GT_PCI0_CFGADDR_FUNCTNUM_MSK (MSK(3) << GT_PCI0_CFGADDR_FUNCTNUM_SHF)
514#define GT_PCI0_CFGADDR_DEVNUM_SHF 11
515#define GT_PCI0_CFGADDR_DEVNUM_MSK (MSK(5) << GT_PCI0_CFGADDR_DEVNUM_SHF)
516#define GT_PCI0_CFGADDR_BUSNUM_SHF 16
517#define GT_PCI0_CFGADDR_BUSNUM_MSK (MSK(8) << GT_PCI0_CFGADDR_BUSNUM_SHF)
518#define GT_PCI0_CFGADDR_CONFIGEN_SHF 31
519#define GT_PCI0_CFGADDR_CONFIGEN_MSK (MSK(1) << GT_PCI0_CFGADDR_CONFIGEN_SHF)
520#define GT_PCI0_CFGADDR_CONFIGEN_BIT GT_PCI0_CFGADDR_CONFIGEN_MSK
521
522#define GT_PCI0_CMD_MBYTESWAP_SHF 0
523#define GT_PCI0_CMD_MBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_MBYTESWAP_SHF)
524#define GT_PCI0_CMD_MBYTESWAP_BIT GT_PCI0_CMD_MBYTESWAP_MSK
525#define GT_PCI0_CMD_MWORDSWAP_SHF 10
526#define GT_PCI0_CMD_MWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_MWORDSWAP_SHF)
527#define GT_PCI0_CMD_MWORDSWAP_BIT GT_PCI0_CMD_MWORDSWAP_MSK
528#define GT_PCI0_CMD_SBYTESWAP_SHF 16
529#define GT_PCI0_CMD_SBYTESWAP_MSK (MSK(1) << GT_PCI0_CMD_SBYTESWAP_SHF)
530#define GT_PCI0_CMD_SBYTESWAP_BIT GT_PCI0_CMD_SBYTESWAP_MSK
531#define GT_PCI0_CMD_SWORDSWAP_SHF 11
532#define GT_PCI0_CMD_SWORDSWAP_MSK (MSK(1) << GT_PCI0_CMD_SWORDSWAP_SHF)
533#define GT_PCI0_CMD_SWORDSWAP_BIT GT_PCI0_CMD_SWORDSWAP_MSK
534
535#define GT_INTR_T0EXP_SHF 8
536#define GT_INTR_T0EXP_MSK (MSK(1) << GT_INTR_T0EXP_SHF)
537#define GT_INTR_T0EXP_BIT GT_INTR_T0EXP_MSK
538#define GT_INTR_RETRYCTR0_SHF 20
539#define GT_INTR_RETRYCTR0_MSK (MSK(1) << GT_INTR_RETRYCTR0_SHF)
540#define GT_INTR_RETRYCTR0_BIT GT_INTR_RETRYCTR0_MSK
541
542/*
543 * Misc
544 */
545#define GT_DEF_PCI0_IO_BASE 0x10000000UL
546#define GT_DEF_PCI0_IO_SIZE 0x02000000UL
547#define GT_DEF_PCI0_MEM0_BASE 0x12000000UL
548#define GT_DEF_PCI0_MEM0_SIZE 0x02000000UL
549#define GT_DEF_BASE 0x14000000UL
550
551#define GT_MAX_BANKSIZE (256 * 1024 * 1024) /* Max 256MB bank */
552#define GT_LATTIM_MIN 6 /* Minimum lat */
553
554/*
555 * The gt64120_dep.h file must define the following macros
556 *
557 * GT_READ(ofs, data_pointer)
558 * GT_WRITE(ofs, data) - read/write GT64120 registers in 32bit
559 *
560 * TIMER - gt64120 timer irq, temporary solution until
561 * full gt64120 cascade interrupt support is in place
562 */
563
564#include <mach-gt64120.h>
565
566/*
567 * Because of an error/peculiarity in the Galileo chip, we need to swap the
568 * bytes when running bigendian. We also provide non-swapping versions.
569 */
570#define __GT_READ(ofs) \
571 (*(volatile u32 *)(GT64120_BASE+(ofs)))
572#define __GT_WRITE(ofs, data) \
573 do { *(volatile u32 *)(GT64120_BASE+(ofs)) = (data); } while (0)
574#define GT_READ(ofs) le32_to_cpu(__GT_READ(ofs))
575#define GT_WRITE(ofs, data) __GT_WRITE(ofs, cpu_to_le32(data))
576
577extern void gt641xx_set_base_clock(unsigned int clock);
578extern int gt641xx_timer0_state(void);
579
580#endif /* _ASM_GT64120_H */
diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h
deleted file mode 100644
index 90bf399e6dd9..000000000000
--- a/include/asm-mips/hardirq.h
+++ /dev/null
@@ -1,24 +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) 1997, 98, 99, 2000, 01, 05 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_HARDIRQ_H
11#define _ASM_HARDIRQ_H
12
13#include <linux/threads.h>
14#include <linux/irq.h>
15
16typedef struct {
17 unsigned int __softirq_pending;
18} ____cacheline_aligned irq_cpustat_t;
19
20#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
21
22extern void ack_bad_irq(unsigned int irq);
23
24#endif /* _ASM_HARDIRQ_H */
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
deleted file mode 100644
index 2de638f84c86..000000000000
--- a/include/asm-mips/hazards.h
+++ /dev/null
@@ -1,271 +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, 04, 07 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) MIPS Technologies, Inc.
8 * written by Ralf Baechle <ralf@linux-mips.org>
9 */
10#ifndef _ASM_HAZARDS_H
11#define _ASM_HAZARDS_H
12
13#ifdef __ASSEMBLY__
14#define ASMMACRO(name, code...) .macro name; code; .endm
15#else
16
17#include <asm/cpu-features.h>
18
19#define ASMMACRO(name, code...) \
20__asm__(".macro " #name "; " #code "; .endm"); \
21 \
22static inline void name(void) \
23{ \
24 __asm__ __volatile__ (#name); \
25}
26
27/*
28 * MIPS R2 instruction hazard barrier. Needs to be called as a subroutine.
29 */
30extern void mips_ihb(void);
31
32#endif
33
34ASMMACRO(_ssnop,
35 sll $0, $0, 1
36 )
37
38ASMMACRO(_ehb,
39 sll $0, $0, 3
40 )
41
42/*
43 * TLB hazards
44 */
45#if defined(CONFIG_CPU_MIPSR2)
46
47/*
48 * MIPSR2 defines ehb for hazard avoidance
49 */
50
51ASMMACRO(mtc0_tlbw_hazard,
52 _ehb
53 )
54ASMMACRO(tlbw_use_hazard,
55 _ehb
56 )
57ASMMACRO(tlb_probe_hazard,
58 _ehb
59 )
60ASMMACRO(irq_enable_hazard,
61 _ehb
62 )
63ASMMACRO(irq_disable_hazard,
64 _ehb
65 )
66ASMMACRO(back_to_back_c0_hazard,
67 _ehb
68 )
69/*
70 * gcc has a tradition of misscompiling the previous construct using the
71 * address of a label as argument to inline assembler. Gas otoh has the
72 * annoying difference between la and dla which are only usable for 32-bit
73 * rsp. 64-bit code, so can't be used without conditional compilation.
74 * The alterantive is switching the assembler to 64-bit code which happens
75 * to work right even for 32-bit code ...
76 */
77#define instruction_hazard() \
78do { \
79 unsigned long tmp; \
80 \
81 __asm__ __volatile__( \
82 " .set mips64r2 \n" \
83 " dla %0, 1f \n" \
84 " jr.hb %0 \n" \
85 " .set mips0 \n" \
86 "1: \n" \
87 : "=r" (tmp)); \
88} while (0)
89
90#elif defined(CONFIG_CPU_MIPSR1)
91
92/*
93 * These are slightly complicated by the fact that we guarantee R1 kernels to
94 * run fine on R2 processors.
95 */
96ASMMACRO(mtc0_tlbw_hazard,
97 _ssnop; _ssnop; _ehb
98 )
99ASMMACRO(tlbw_use_hazard,
100 _ssnop; _ssnop; _ssnop; _ehb
101 )
102ASMMACRO(tlb_probe_hazard,
103 _ssnop; _ssnop; _ssnop; _ehb
104 )
105ASMMACRO(irq_enable_hazard,
106 _ssnop; _ssnop; _ssnop; _ehb
107 )
108ASMMACRO(irq_disable_hazard,
109 _ssnop; _ssnop; _ssnop; _ehb
110 )
111ASMMACRO(back_to_back_c0_hazard,
112 _ssnop; _ssnop; _ssnop; _ehb
113 )
114/*
115 * gcc has a tradition of misscompiling the previous construct using the
116 * address of a label as argument to inline assembler. Gas otoh has the
117 * annoying difference between la and dla which are only usable for 32-bit
118 * rsp. 64-bit code, so can't be used without conditional compilation.
119 * The alterantive is switching the assembler to 64-bit code which happens
120 * to work right even for 32-bit code ...
121 */
122#define __instruction_hazard() \
123do { \
124 unsigned long tmp; \
125 \
126 __asm__ __volatile__( \
127 " .set mips64r2 \n" \
128 " dla %0, 1f \n" \
129 " jr.hb %0 \n" \
130 " .set mips0 \n" \
131 "1: \n" \
132 : "=r" (tmp)); \
133} while (0)
134
135#define instruction_hazard() \
136do { \
137 if (cpu_has_mips_r2) \
138 __instruction_hazard(); \
139} while (0)
140
141#elif defined(CONFIG_CPU_R10000)
142
143/*
144 * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer.
145 */
146
147ASMMACRO(mtc0_tlbw_hazard,
148 )
149ASMMACRO(tlbw_use_hazard,
150 )
151ASMMACRO(tlb_probe_hazard,
152 )
153ASMMACRO(irq_enable_hazard,
154 )
155ASMMACRO(irq_disable_hazard,
156 )
157ASMMACRO(back_to_back_c0_hazard,
158 )
159#define instruction_hazard() do { } while (0)
160
161#elif defined(CONFIG_CPU_RM9000)
162
163/*
164 * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent
165 * use of the JTLB for instructions should not occur for 4 cpu cycles and use
166 * for data translations should not occur for 3 cpu cycles.
167 */
168
169ASMMACRO(mtc0_tlbw_hazard,
170 _ssnop; _ssnop; _ssnop; _ssnop
171 )
172ASMMACRO(tlbw_use_hazard,
173 _ssnop; _ssnop; _ssnop; _ssnop
174 )
175ASMMACRO(tlb_probe_hazard,
176 _ssnop; _ssnop; _ssnop; _ssnop
177 )
178ASMMACRO(irq_enable_hazard,
179 )
180ASMMACRO(irq_disable_hazard,
181 )
182ASMMACRO(back_to_back_c0_hazard,
183 )
184#define instruction_hazard() do { } while (0)
185
186#elif defined(CONFIG_CPU_SB1)
187
188/*
189 * Mostly like R4000 for historic reasons
190 */
191ASMMACRO(mtc0_tlbw_hazard,
192 )
193ASMMACRO(tlbw_use_hazard,
194 )
195ASMMACRO(tlb_probe_hazard,
196 )
197ASMMACRO(irq_enable_hazard,
198 )
199ASMMACRO(irq_disable_hazard,
200 _ssnop; _ssnop; _ssnop
201 )
202ASMMACRO(back_to_back_c0_hazard,
203 )
204#define instruction_hazard() do { } while (0)
205
206#else
207
208/*
209 * Finally the catchall case for all other processors including R4000, R4400,
210 * R4600, R4700, R5000, RM7000, NEC VR41xx etc.
211 *
212 * The taken branch will result in a two cycle penalty for the two killed
213 * instructions on R4000 / R4400. Other processors only have a single cycle
214 * hazard so this is nice trick to have an optimal code for a range of
215 * processors.
216 */
217ASMMACRO(mtc0_tlbw_hazard,
218 nop; nop
219 )
220ASMMACRO(tlbw_use_hazard,
221 nop; nop; nop
222 )
223ASMMACRO(tlb_probe_hazard,
224 nop; nop; nop
225 )
226ASMMACRO(irq_enable_hazard,
227 _ssnop; _ssnop; _ssnop;
228 )
229ASMMACRO(irq_disable_hazard,
230 nop; nop; nop
231 )
232ASMMACRO(back_to_back_c0_hazard,
233 _ssnop; _ssnop; _ssnop;
234 )
235#define instruction_hazard() do { } while (0)
236
237#endif
238
239
240/* FPU hazards */
241
242#if defined(CONFIG_CPU_SB1)
243ASMMACRO(enable_fpu_hazard,
244 .set push;
245 .set mips64;
246 .set noreorder;
247 _ssnop;
248 bnezl $0, .+4;
249 _ssnop;
250 .set pop
251)
252ASMMACRO(disable_fpu_hazard,
253)
254
255#elif defined(CONFIG_CPU_MIPSR2)
256ASMMACRO(enable_fpu_hazard,
257 _ehb
258)
259ASMMACRO(disable_fpu_hazard,
260 _ehb
261)
262#else
263ASMMACRO(enable_fpu_hazard,
264 nop; nop; nop; nop
265)
266ASMMACRO(disable_fpu_hazard,
267 _ehb
268)
269#endif
270
271#endif /* _ASM_HAZARDS_H */
diff --git a/include/asm-mips/highmem.h b/include/asm-mips/highmem.h
deleted file mode 100644
index 4374ab2adc75..000000000000
--- a/include/asm-mips/highmem.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * highmem.h: virtual kernel memory mappings for high memory
3 *
4 * Used in CONFIG_HIGHMEM systems for memory pages which
5 * are not addressable by direct kernel virtual addresses.
6 *
7 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
8 * Gerhard.Wichert@pdb.siemens.de
9 *
10 *
11 * Redesigned the x86 32-bit VM architecture to deal with
12 * up to 16 Terabyte physical memory. With current x86 CPUs
13 * we now support up to 64 Gigabytes physical RAM.
14 *
15 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
16 */
17#ifndef _ASM_HIGHMEM_H
18#define _ASM_HIGHMEM_H
19
20#ifdef __KERNEL__
21
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/uaccess.h>
25#include <asm/kmap_types.h>
26
27/* undef for production */
28#define HIGHMEM_DEBUG 1
29
30/* declarations for highmem.c */
31extern unsigned long highstart_pfn, highend_pfn;
32
33extern pte_t *kmap_pte;
34extern pgprot_t kmap_prot;
35extern pte_t *pkmap_page_table;
36
37/*
38 * Right now we initialize only a single pte table. It can be extended
39 * easily, subsequent pte tables have to be allocated in one physical
40 * chunk of RAM.
41 */
42#define LAST_PKMAP 1024
43#define LAST_PKMAP_MASK (LAST_PKMAP-1)
44#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
45#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
46
47extern void * kmap_high(struct page *page);
48extern void kunmap_high(struct page *page);
49
50extern void *__kmap(struct page *page);
51extern void __kunmap(struct page *page);
52extern void *__kmap_atomic(struct page *page, enum km_type type);
53extern void __kunmap_atomic(void *kvaddr, enum km_type type);
54extern void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
55extern struct page *__kmap_atomic_to_page(void *ptr);
56
57#define kmap __kmap
58#define kunmap __kunmap
59#define kmap_atomic __kmap_atomic
60#define kunmap_atomic __kunmap_atomic
61#define kmap_atomic_to_page __kmap_atomic_to_page
62
63#define flush_cache_kmaps() flush_cache_all()
64
65#endif /* __KERNEL__ */
66
67#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-mips/hw_irq.h b/include/asm-mips/hw_irq.h
deleted file mode 100644
index aca05a43a97b..000000000000
--- a/include/asm-mips/hw_irq.h
+++ /dev/null
@@ -1,20 +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) 2000, 2001, 2002 by Ralf Baechle
7 */
8#ifndef __ASM_HW_IRQ_H
9#define __ASM_HW_IRQ_H
10
11#include <asm/atomic.h>
12
13extern atomic_t irq_err_count;
14
15/*
16 * interrupt-retrigger: NOP for now. This may not be apropriate for all
17 * machines, we'll see ...
18 */
19
20#endif /* __ASM_HW_IRQ_H */
diff --git a/include/asm-mips/i8253.h b/include/asm-mips/i8253.h
deleted file mode 100644
index 5dabc870b322..000000000000
--- a/include/asm-mips/i8253.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Machine specific IO port address definition for generic.
3 * Written by Osamu Tomita <tomita@cinet.co.jp>
4 */
5#ifndef __ASM_I8253_H
6#define __ASM_I8253_H
7
8#include <linux/spinlock.h>
9
10/* i8253A PIT registers */
11#define PIT_MODE 0x43
12#define PIT_CH0 0x40
13#define PIT_CH2 0x42
14
15#define PIT_TICK_RATE 1193182UL
16
17extern spinlock_t i8253_lock;
18
19extern void setup_pit_timer(void);
20
21#endif /* __ASM_I8253_H */
diff --git a/include/asm-mips/i8259.h b/include/asm-mips/i8259.h
deleted file mode 100644
index 8572a2d90484..000000000000
--- a/include/asm-mips/i8259.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 * include/asm-mips/i8259.h
3 *
4 * i8259A interrupt definitions.
5 *
6 * Copyright (C) 2003 Maciej W. Rozycki
7 * Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
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#ifndef _ASM_I8259_H
15#define _ASM_I8259_H
16
17#include <linux/compiler.h>
18#include <linux/spinlock.h>
19
20#include <asm/io.h>
21#include <irq.h>
22
23/* i8259A PIC registers */
24#define PIC_MASTER_CMD 0x20
25#define PIC_MASTER_IMR 0x21
26#define PIC_MASTER_ISR PIC_MASTER_CMD
27#define PIC_MASTER_POLL PIC_MASTER_ISR
28#define PIC_MASTER_OCW3 PIC_MASTER_ISR
29#define PIC_SLAVE_CMD 0xa0
30#define PIC_SLAVE_IMR 0xa1
31
32/* i8259A PIC related value */
33#define PIC_CASCADE_IR 2
34#define MASTER_ICW4_DEFAULT 0x01
35#define SLAVE_ICW4_DEFAULT 0x01
36#define PIC_ICW4_AEOI 2
37
38extern spinlock_t i8259A_lock;
39
40extern int i8259A_irq_pending(unsigned int irq);
41extern void make_8259A_irq(unsigned int irq);
42
43extern void init_i8259_irqs(void);
44
45/*
46 * Do the traditional i8259 interrupt polling thing. This is for the few
47 * cases where no better interrupt acknowledge method is available and we
48 * absolutely must touch the i8259.
49 */
50static inline int i8259_irq(void)
51{
52 int irq;
53
54 spin_lock(&i8259A_lock);
55
56 /* Perform an interrupt acknowledge cycle on controller 1. */
57 outb(0x0C, PIC_MASTER_CMD); /* prepare for poll */
58 irq = inb(PIC_MASTER_CMD) & 7;
59 if (irq == PIC_CASCADE_IR) {
60 /*
61 * Interrupt is cascaded so perform interrupt
62 * acknowledge on controller 2.
63 */
64 outb(0x0C, PIC_SLAVE_CMD); /* prepare for poll */
65 irq = (inb(PIC_SLAVE_CMD) & 7) + 8;
66 }
67
68 if (unlikely(irq == 7)) {
69 /*
70 * This may be a spurious interrupt.
71 *
72 * Read the interrupt status register (ISR). If the most
73 * significant bit is not set then there is no valid
74 * interrupt.
75 */
76 outb(0x0B, PIC_MASTER_ISR); /* ISR register */
77 if(~inb(PIC_MASTER_ISR) & 0x80)
78 irq = -1;
79 }
80
81 spin_unlock(&i8259A_lock);
82
83 return likely(irq >= 0) ? irq + I8259A_IRQ_BASE : irq;
84}
85
86#endif /* _ASM_I8259_H */
diff --git a/include/asm-mips/ide.h b/include/asm-mips/ide.h
deleted file mode 100644
index bb674c3b0303..000000000000
--- a/include/asm-mips/ide.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 * This file contains the MIPS architecture specific IDE code.
7 */
8#ifndef __ASM_IDE_H
9#define __ASM_IDE_H
10
11#include <ide.h>
12
13#endif /* __ASM_IDE_H */
diff --git a/include/asm-mips/inst.h b/include/asm-mips/inst.h
deleted file mode 100644
index 6489f00731ca..000000000000
--- a/include/asm-mips/inst.h
+++ /dev/null
@@ -1,394 +0,0 @@
1/*
2 * Format of an instruction in memory.
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) 1996, 2000 by Ralf Baechle
9 * Copyright (C) 2006 by Thiemo Seufer
10 */
11#ifndef _ASM_INST_H
12#define _ASM_INST_H
13
14/*
15 * Major opcodes; before MIPS IV cop1x was called cop3.
16 */
17enum major_op {
18 spec_op, bcond_op, j_op, jal_op,
19 beq_op, bne_op, blez_op, bgtz_op,
20 addi_op, addiu_op, slti_op, sltiu_op,
21 andi_op, ori_op, xori_op, lui_op,
22 cop0_op, cop1_op, cop2_op, cop1x_op,
23 beql_op, bnel_op, blezl_op, bgtzl_op,
24 daddi_op, daddiu_op, ldl_op, ldr_op,
25 spec2_op, jalx_op, mdmx_op, spec3_op,
26 lb_op, lh_op, lwl_op, lw_op,
27 lbu_op, lhu_op, lwr_op, lwu_op,
28 sb_op, sh_op, swl_op, sw_op,
29 sdl_op, sdr_op, swr_op, cache_op,
30 ll_op, lwc1_op, lwc2_op, pref_op,
31 lld_op, ldc1_op, ldc2_op, ld_op,
32 sc_op, swc1_op, swc2_op, major_3b_op,
33 scd_op, sdc1_op, sdc2_op, sd_op
34};
35
36/*
37 * func field of spec opcode.
38 */
39enum spec_op {
40 sll_op, movc_op, srl_op, sra_op,
41 sllv_op, pmon_op, srlv_op, srav_op,
42 jr_op, jalr_op, movz_op, movn_op,
43 syscall_op, break_op, spim_op, sync_op,
44 mfhi_op, mthi_op, mflo_op, mtlo_op,
45 dsllv_op, spec2_unused_op, dsrlv_op, dsrav_op,
46 mult_op, multu_op, div_op, divu_op,
47 dmult_op, dmultu_op, ddiv_op, ddivu_op,
48 add_op, addu_op, sub_op, subu_op,
49 and_op, or_op, xor_op, nor_op,
50 spec3_unused_op, spec4_unused_op, slt_op, sltu_op,
51 dadd_op, daddu_op, dsub_op, dsubu_op,
52 tge_op, tgeu_op, tlt_op, tltu_op,
53 teq_op, spec5_unused_op, tne_op, spec6_unused_op,
54 dsll_op, spec7_unused_op, dsrl_op, dsra_op,
55 dsll32_op, spec8_unused_op, dsrl32_op, dsra32_op
56};
57
58/*
59 * func field of spec2 opcode.
60 */
61enum spec2_op {
62 madd_op, maddu_op, mul_op, spec2_3_unused_op,
63 msub_op, msubu_op, /* more unused ops */
64 clz_op = 0x20, clo_op,
65 dclz_op = 0x24, dclo_op,
66 sdbpp_op = 0x3f
67};
68
69/*
70 * func field of spec3 opcode.
71 */
72enum spec3_op {
73 ext_op, dextm_op, dextu_op, dext_op,
74 ins_op, dinsm_op, dinsu_op, dins_op,
75 bshfl_op = 0x20,
76 dbshfl_op = 0x24,
77 rdhwr_op = 0x3b
78};
79
80/*
81 * rt field of bcond opcodes.
82 */
83enum rt_op {
84 bltz_op, bgez_op, bltzl_op, bgezl_op,
85 spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
86 tgei_op, tgeiu_op, tlti_op, tltiu_op,
87 teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
88 bltzal_op, bgezal_op, bltzall_op, bgezall_op,
89 rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
90 rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
91 bposge32_op, rt_op_0x1d, rt_op_0x1e, rt_op_0x1f
92};
93
94/*
95 * rs field of cop opcodes.
96 */
97enum cop_op {
98 mfc_op = 0x00, dmfc_op = 0x01,
99 cfc_op = 0x02, mtc_op = 0x04,
100 dmtc_op = 0x05, ctc_op = 0x06,
101 bc_op = 0x08, cop_op = 0x10,
102 copm_op = 0x18
103};
104
105/*
106 * rt field of cop.bc_op opcodes
107 */
108enum bcop_op {
109 bcf_op, bct_op, bcfl_op, bctl_op
110};
111
112/*
113 * func field of cop0 coi opcodes.
114 */
115enum cop0_coi_func {
116 tlbr_op = 0x01, tlbwi_op = 0x02,
117 tlbwr_op = 0x06, tlbp_op = 0x08,
118 rfe_op = 0x10, eret_op = 0x18
119};
120
121/*
122 * func field of cop0 com opcodes.
123 */
124enum cop0_com_func {
125 tlbr1_op = 0x01, tlbw_op = 0x02,
126 tlbp1_op = 0x08, dctr_op = 0x09,
127 dctw_op = 0x0a
128};
129
130/*
131 * fmt field of cop1 opcodes.
132 */
133enum cop1_fmt {
134 s_fmt, d_fmt, e_fmt, q_fmt,
135 w_fmt, l_fmt
136};
137
138/*
139 * func field of cop1 instructions using d, s or w format.
140 */
141enum cop1_sdw_func {
142 fadd_op = 0x00, fsub_op = 0x01,
143 fmul_op = 0x02, fdiv_op = 0x03,
144 fsqrt_op = 0x04, fabs_op = 0x05,
145 fmov_op = 0x06, fneg_op = 0x07,
146 froundl_op = 0x08, ftruncl_op = 0x09,
147 fceill_op = 0x0a, ffloorl_op = 0x0b,
148 fround_op = 0x0c, ftrunc_op = 0x0d,
149 fceil_op = 0x0e, ffloor_op = 0x0f,
150 fmovc_op = 0x11, fmovz_op = 0x12,
151 fmovn_op = 0x13, frecip_op = 0x15,
152 frsqrt_op = 0x16, fcvts_op = 0x20,
153 fcvtd_op = 0x21, fcvte_op = 0x22,
154 fcvtw_op = 0x24, fcvtl_op = 0x25,
155 fcmp_op = 0x30
156};
157
158/*
159 * func field of cop1x opcodes (MIPS IV).
160 */
161enum cop1x_func {
162 lwxc1_op = 0x00, ldxc1_op = 0x01,
163 pfetch_op = 0x07, swxc1_op = 0x08,
164 sdxc1_op = 0x09, madd_s_op = 0x20,
165 madd_d_op = 0x21, madd_e_op = 0x22,
166 msub_s_op = 0x28, msub_d_op = 0x29,
167 msub_e_op = 0x2a, nmadd_s_op = 0x30,
168 nmadd_d_op = 0x31, nmadd_e_op = 0x32,
169 nmsub_s_op = 0x38, nmsub_d_op = 0x39,
170 nmsub_e_op = 0x3a
171};
172
173/*
174 * func field for mad opcodes (MIPS IV).
175 */
176enum mad_func {
177 madd_fp_op = 0x08, msub_fp_op = 0x0a,
178 nmadd_fp_op = 0x0c, nmsub_fp_op = 0x0e
179};
180
181/*
182 * Damn ... bitfields depend from byteorder :-(
183 */
184#ifdef __MIPSEB__
185struct j_format { /* Jump format */
186 unsigned int opcode : 6;
187 unsigned int target : 26;
188};
189
190struct i_format { /* Immediate format (addi, lw, ...) */
191 unsigned int opcode : 6;
192 unsigned int rs : 5;
193 unsigned int rt : 5;
194 signed int simmediate : 16;
195};
196
197struct u_format { /* Unsigned immediate format (ori, xori, ...) */
198 unsigned int opcode : 6;
199 unsigned int rs : 5;
200 unsigned int rt : 5;
201 unsigned int uimmediate : 16;
202};
203
204struct c_format { /* Cache (>= R6000) format */
205 unsigned int opcode : 6;
206 unsigned int rs : 5;
207 unsigned int c_op : 3;
208 unsigned int cache : 2;
209 unsigned int simmediate : 16;
210};
211
212struct r_format { /* Register format */
213 unsigned int opcode : 6;
214 unsigned int rs : 5;
215 unsigned int rt : 5;
216 unsigned int rd : 5;
217 unsigned int re : 5;
218 unsigned int func : 6;
219};
220
221struct p_format { /* Performance counter format (R10000) */
222 unsigned int opcode : 6;
223 unsigned int rs : 5;
224 unsigned int rt : 5;
225 unsigned int rd : 5;
226 unsigned int re : 5;
227 unsigned int func : 6;
228};
229
230struct f_format { /* FPU register format */
231 unsigned int opcode : 6;
232 unsigned int : 1;
233 unsigned int fmt : 4;
234 unsigned int rt : 5;
235 unsigned int rd : 5;
236 unsigned int re : 5;
237 unsigned int func : 6;
238};
239
240struct ma_format { /* FPU multipy and add format (MIPS IV) */
241 unsigned int opcode : 6;
242 unsigned int fr : 5;
243 unsigned int ft : 5;
244 unsigned int fs : 5;
245 unsigned int fd : 5;
246 unsigned int func : 4;
247 unsigned int fmt : 2;
248};
249
250#elif defined(__MIPSEL__)
251
252struct j_format { /* Jump format */
253 unsigned int target : 26;
254 unsigned int opcode : 6;
255};
256
257struct i_format { /* Immediate format */
258 signed int simmediate : 16;
259 unsigned int rt : 5;
260 unsigned int rs : 5;
261 unsigned int opcode : 6;
262};
263
264struct u_format { /* Unsigned immediate format */
265 unsigned int uimmediate : 16;
266 unsigned int rt : 5;
267 unsigned int rs : 5;
268 unsigned int opcode : 6;
269};
270
271struct c_format { /* Cache (>= R6000) format */
272 unsigned int simmediate : 16;
273 unsigned int cache : 2;
274 unsigned int c_op : 3;
275 unsigned int rs : 5;
276 unsigned int opcode : 6;
277};
278
279struct r_format { /* Register format */
280 unsigned int func : 6;
281 unsigned int re : 5;
282 unsigned int rd : 5;
283 unsigned int rt : 5;
284 unsigned int rs : 5;
285 unsigned int opcode : 6;
286};
287
288struct p_format { /* Performance counter format (R10000) */
289 unsigned int func : 6;
290 unsigned int re : 5;
291 unsigned int rd : 5;
292 unsigned int rt : 5;
293 unsigned int rs : 5;
294 unsigned int opcode : 6;
295};
296
297struct f_format { /* FPU register format */
298 unsigned int func : 6;
299 unsigned int re : 5;
300 unsigned int rd : 5;
301 unsigned int rt : 5;
302 unsigned int fmt : 4;
303 unsigned int : 1;
304 unsigned int opcode : 6;
305};
306
307struct ma_format { /* FPU multipy and add format (MIPS IV) */
308 unsigned int fmt : 2;
309 unsigned int func : 4;
310 unsigned int fd : 5;
311 unsigned int fs : 5;
312 unsigned int ft : 5;
313 unsigned int fr : 5;
314 unsigned int opcode : 6;
315};
316
317#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */
318#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?"
319#endif
320
321union mips_instruction {
322 unsigned int word;
323 unsigned short halfword[2];
324 unsigned char byte[4];
325 struct j_format j_format;
326 struct i_format i_format;
327 struct u_format u_format;
328 struct c_format c_format;
329 struct r_format r_format;
330 struct f_format f_format;
331 struct ma_format ma_format;
332};
333
334/* HACHACHAHCAHC ... */
335
336/* In case some other massaging is needed, keep MIPSInst as wrapper */
337
338#define MIPSInst(x) x
339
340#define I_OPCODE_SFT 26
341#define MIPSInst_OPCODE(x) (MIPSInst(x) >> I_OPCODE_SFT)
342
343#define I_JTARGET_SFT 0
344#define MIPSInst_JTARGET(x) (MIPSInst(x) & 0x03ffffff)
345
346#define I_RS_SFT 21
347#define MIPSInst_RS(x) ((MIPSInst(x) & 0x03e00000) >> I_RS_SFT)
348
349#define I_RT_SFT 16
350#define MIPSInst_RT(x) ((MIPSInst(x) & 0x001f0000) >> I_RT_SFT)
351
352#define I_IMM_SFT 0
353#define MIPSInst_SIMM(x) ((int)((short)(MIPSInst(x) & 0xffff)))
354#define MIPSInst_UIMM(x) (MIPSInst(x) & 0xffff)
355
356#define I_CACHEOP_SFT 18
357#define MIPSInst_CACHEOP(x) ((MIPSInst(x) & 0x001c0000) >> I_CACHEOP_SFT)
358
359#define I_CACHESEL_SFT 16
360#define MIPSInst_CACHESEL(x) ((MIPSInst(x) & 0x00030000) >> I_CACHESEL_SFT)
361
362#define I_RD_SFT 11
363#define MIPSInst_RD(x) ((MIPSInst(x) & 0x0000f800) >> I_RD_SFT)
364
365#define I_RE_SFT 6
366#define MIPSInst_RE(x) ((MIPSInst(x) & 0x000007c0) >> I_RE_SFT)
367
368#define I_FUNC_SFT 0
369#define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
370
371#define I_FFMT_SFT 21
372#define MIPSInst_FFMT(x) ((MIPSInst(x) & 0x01e00000) >> I_FFMT_SFT)
373
374#define I_FT_SFT 16
375#define MIPSInst_FT(x) ((MIPSInst(x) & 0x001f0000) >> I_FT_SFT)
376
377#define I_FS_SFT 11
378#define MIPSInst_FS(x) ((MIPSInst(x) & 0x0000f800) >> I_FS_SFT)
379
380#define I_FD_SFT 6
381#define MIPSInst_FD(x) ((MIPSInst(x) & 0x000007c0) >> I_FD_SFT)
382
383#define I_FR_SFT 21
384#define MIPSInst_FR(x) ((MIPSInst(x) & 0x03e00000) >> I_FR_SFT)
385
386#define I_FMA_FUNC_SFT 2
387#define MIPSInst_FMA_FUNC(x) ((MIPSInst(x) & 0x0000003c) >> I_FMA_FUNC_SFT)
388
389#define I_FMA_FFMT_SFT 0
390#define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000003)
391
392typedef unsigned int mips_instruction;
393
394#endif /* _ASM_INST_H */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
deleted file mode 100644
index 501a40b9f18d..000000000000
--- a/include/asm-mips/io.h
+++ /dev/null
@@ -1,589 +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) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
10 * Author: Maciej W. Rozycki <macro@mips.com>
11 */
12#ifndef _ASM_IO_H
13#define _ASM_IO_H
14
15#include <linux/compiler.h>
16#include <linux/kernel.h>
17#include <linux/types.h>
18
19#include <asm/addrspace.h>
20#include <asm/byteorder.h>
21#include <asm/cpu.h>
22#include <asm/cpu-features.h>
23#include <asm-generic/iomap.h>
24#include <asm/page.h>
25#include <asm/pgtable-bits.h>
26#include <asm/processor.h>
27#include <asm/string.h>
28
29#include <ioremap.h>
30#include <mangle-port.h>
31
32/*
33 * Slowdown I/O port space accesses for antique hardware.
34 */
35#undef CONF_SLOWDOWN_IO
36
37/*
38 * Raw operations are never swapped in software. OTOH values that raw
39 * operations are working on may or may not have been swapped by the bus
40 * hardware. An example use would be for flash memory that's used for
41 * execute in place.
42 */
43# define __raw_ioswabb(a, x) (x)
44# define __raw_ioswabw(a, x) (x)
45# define __raw_ioswabl(a, x) (x)
46# define __raw_ioswabq(a, x) (x)
47# define ____raw_ioswabq(a, x) (x)
48
49/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */
50
51#define IO_SPACE_LIMIT 0xffff
52
53/*
54 * On MIPS I/O ports are memory mapped, so we access them using normal
55 * load/store instructions. mips_io_port_base is the virtual address to
56 * which all ports are being mapped. For sake of efficiency some code
57 * assumes that this is an address that can be loaded with a single lui
58 * instruction, so the lower 16 bits must be zero. Should be true on
59 * on any sane architecture; generic code does not use this assumption.
60 */
61extern const unsigned long mips_io_port_base;
62
63/*
64 * Gcc will generate code to load the value of mips_io_port_base after each
65 * function call which may be fairly wasteful in some cases. So we don't
66 * play quite by the book. We tell gcc mips_io_port_base is a long variable
67 * which solves the code generation issue. Now we need to violate the
68 * aliasing rules a little to make initialization possible and finally we
69 * will need the barrier() to fight side effects of the aliasing chat.
70 * This trickery will eventually collapse under gcc's optimizer. Oh well.
71 */
72static inline void set_io_port_base(unsigned long base)
73{
74 * (unsigned long *) &mips_io_port_base = base;
75 barrier();
76}
77
78/*
79 * Thanks to James van Artsdalen for a better timing-fix than
80 * the two short jumps: using outb's to a nonexistent port seems
81 * to guarantee better timings even on fast machines.
82 *
83 * On the other hand, I'd like to be sure of a non-existent port:
84 * I feel a bit unsafe about using 0x80 (should be safe, though)
85 *
86 * Linus
87 *
88 */
89
90#define __SLOW_DOWN_IO \
91 __asm__ __volatile__( \
92 "sb\t$0,0x80(%0)" \
93 : : "r" (mips_io_port_base));
94
95#ifdef CONF_SLOWDOWN_IO
96#ifdef REALLY_SLOW_IO
97#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
98#else
99#define SLOW_DOWN_IO __SLOW_DOWN_IO
100#endif
101#else
102#define SLOW_DOWN_IO
103#endif
104
105/*
106 * virt_to_phys - map virtual addresses to physical
107 * @address: address to remap
108 *
109 * The returned physical address is the physical (CPU) mapping for
110 * the memory address given. It is only valid to use this function on
111 * addresses directly mapped or allocated via kmalloc.
112 *
113 * This function does not give bus mappings for DMA transfers. In
114 * almost all conceivable cases a device driver should not be using
115 * this function
116 */
117static inline unsigned long virt_to_phys(volatile const void *address)
118{
119 return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET;
120}
121
122/*
123 * phys_to_virt - map physical address to virtual
124 * @address: address to remap
125 *
126 * The returned virtual address is a current CPU mapping for
127 * the memory address given. It is only valid to use this function on
128 * addresses that have a kernel mapping
129 *
130 * This function does not handle bus mappings for DMA transfers. In
131 * almost all conceivable cases a device driver should not be using
132 * this function
133 */
134static inline void * phys_to_virt(unsigned long address)
135{
136 return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
137}
138
139/*
140 * ISA I/O bus memory addresses are 1:1 with the physical address.
141 */
142static inline unsigned long isa_virt_to_bus(volatile void * address)
143{
144 return (unsigned long)address - PAGE_OFFSET;
145}
146
147static inline void * isa_bus_to_virt(unsigned long address)
148{
149 return (void *)(address + PAGE_OFFSET);
150}
151
152#define isa_page_to_bus page_to_phys
153
154/*
155 * However PCI ones are not necessarily 1:1 and therefore these interfaces
156 * are forbidden in portable PCI drivers.
157 *
158 * Allow them for x86 for legacy drivers, though.
159 */
160#define virt_to_bus virt_to_phys
161#define bus_to_virt phys_to_virt
162
163/*
164 * Change "struct page" to physical address.
165 */
166#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
167
168extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
169extern void __iounmap(const volatile void __iomem *addr);
170
171static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
172 unsigned long flags)
173{
174 void __iomem *addr = plat_ioremap(offset, size, flags);
175
176 if (addr)
177 return addr;
178
179#define __IS_LOW512(addr) (!((phys_t)(addr) & (phys_t) ~0x1fffffffULL))
180
181 if (cpu_has_64bit_addresses) {
182 u64 base = UNCAC_BASE;
183
184 /*
185 * R10000 supports a 2 bit uncached attribute therefore
186 * UNCAC_BASE may not equal IO_BASE.
187 */
188 if (flags == _CACHE_UNCACHED)
189 base = (u64) IO_BASE;
190 return (void __iomem *) (unsigned long) (base + offset);
191 } else if (__builtin_constant_p(offset) &&
192 __builtin_constant_p(size) && __builtin_constant_p(flags)) {
193 phys_t phys_addr, last_addr;
194
195 phys_addr = fixup_bigphys_addr(offset, size);
196
197 /* Don't allow wraparound or zero size. */
198 last_addr = phys_addr + size - 1;
199 if (!size || last_addr < phys_addr)
200 return NULL;
201
202 /*
203 * Map uncached objects in the low 512MB of address
204 * space using KSEG1.
205 */
206 if (__IS_LOW512(phys_addr) && __IS_LOW512(last_addr) &&
207 flags == _CACHE_UNCACHED)
208 return (void __iomem *)
209 (unsigned long)CKSEG1ADDR(phys_addr);
210 }
211
212 return __ioremap(offset, size, flags);
213
214#undef __IS_LOW512
215}
216
217/*
218 * ioremap - map bus memory into CPU space
219 * @offset: bus address of the memory
220 * @size: size of the resource to map
221 *
222 * ioremap performs a platform specific sequence of operations to
223 * make bus memory CPU accessible via the readb/readw/readl/writeb/
224 * writew/writel functions and the other mmio helpers. The returned
225 * address is not guaranteed to be usable directly as a virtual
226 * address.
227 */
228#define ioremap(offset, size) \
229 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
230
231/*
232 * ioremap_nocache - map bus memory into CPU space
233 * @offset: bus address of the memory
234 * @size: size of the resource to map
235 *
236 * ioremap_nocache performs a platform specific sequence of operations to
237 * make bus memory CPU accessible via the readb/readw/readl/writeb/
238 * writew/writel functions and the other mmio helpers. The returned
239 * address is not guaranteed to be usable directly as a virtual
240 * address.
241 *
242 * This version of ioremap ensures that the memory is marked uncachable
243 * on the CPU as well as honouring existing caching rules from things like
244 * the PCI bus. Note that there are other caches and buffers on many
245 * busses. In paticular driver authors should read up on PCI writes
246 *
247 * It's useful if some control registers are in such an area and
248 * write combining or read caching is not desirable:
249 */
250#define ioremap_nocache(offset, size) \
251 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
252
253/*
254 * ioremap_cachable - map bus memory into CPU space
255 * @offset: bus address of the memory
256 * @size: size of the resource to map
257 *
258 * ioremap_nocache performs a platform specific sequence of operations to
259 * make bus memory CPU accessible via the readb/readw/readl/writeb/
260 * writew/writel functions and the other mmio helpers. The returned
261 * address is not guaranteed to be usable directly as a virtual
262 * address.
263 *
264 * This version of ioremap ensures that the memory is marked cachable by
265 * the CPU. Also enables full write-combining. Useful for some
266 * memory-like regions on I/O busses.
267 */
268#define ioremap_cachable(offset, size) \
269 __ioremap_mode((offset), (size), _page_cachable_default)
270
271/*
272 * These two are MIPS specific ioremap variant. ioremap_cacheable_cow
273 * requests a cachable mapping, ioremap_uncached_accelerated requests a
274 * mapping using the uncached accelerated mode which isn't supported on
275 * all processors.
276 */
277#define ioremap_cacheable_cow(offset, size) \
278 __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)
279#define ioremap_uncached_accelerated(offset, size) \
280 __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)
281
282static inline void iounmap(const volatile void __iomem *addr)
283{
284 if (plat_iounmap(addr))
285 return;
286
287#define __IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == CKSEG1)
288
289 if (cpu_has_64bit_addresses ||
290 (__builtin_constant_p(addr) && __IS_KSEG1(addr)))
291 return;
292
293 __iounmap(addr);
294
295#undef __IS_KSEG1
296}
297
298#define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \
299 \
300static inline void pfx##write##bwlq(type val, \
301 volatile void __iomem *mem) \
302{ \
303 volatile type *__mem; \
304 type __val; \
305 \
306 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
307 \
308 __val = pfx##ioswab##bwlq(__mem, val); \
309 \
310 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
311 *__mem = __val; \
312 else if (cpu_has_64bits) { \
313 unsigned long __flags; \
314 type __tmp; \
315 \
316 if (irq) \
317 local_irq_save(__flags); \
318 __asm__ __volatile__( \
319 ".set mips3" "\t\t# __writeq""\n\t" \
320 "dsll32 %L0, %L0, 0" "\n\t" \
321 "dsrl32 %L0, %L0, 0" "\n\t" \
322 "dsll32 %M0, %M0, 0" "\n\t" \
323 "or %L0, %L0, %M0" "\n\t" \
324 "sd %L0, %2" "\n\t" \
325 ".set mips0" "\n" \
326 : "=r" (__tmp) \
327 : "0" (__val), "m" (*__mem)); \
328 if (irq) \
329 local_irq_restore(__flags); \
330 } else \
331 BUG(); \
332} \
333 \
334static inline type pfx##read##bwlq(const volatile void __iomem *mem) \
335{ \
336 volatile type *__mem; \
337 type __val; \
338 \
339 __mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem)); \
340 \
341 if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long)) \
342 __val = *__mem; \
343 else if (cpu_has_64bits) { \
344 unsigned long __flags; \
345 \
346 if (irq) \
347 local_irq_save(__flags); \
348 __asm__ __volatile__( \
349 ".set mips3" "\t\t# __readq" "\n\t" \
350 "ld %L0, %1" "\n\t" \
351 "dsra32 %M0, %L0, 0" "\n\t" \
352 "sll %L0, %L0, 0" "\n\t" \
353 ".set mips0" "\n" \
354 : "=r" (__val) \
355 : "m" (*__mem)); \
356 if (irq) \
357 local_irq_restore(__flags); \
358 } else { \
359 __val = 0; \
360 BUG(); \
361 } \
362 \
363 return pfx##ioswab##bwlq(__mem, __val); \
364}
365
366#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow) \
367 \
368static inline void pfx##out##bwlq##p(type val, unsigned long port) \
369{ \
370 volatile type *__addr; \
371 type __val; \
372 \
373 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
374 \
375 __val = pfx##ioswab##bwlq(__addr, val); \
376 \
377 /* Really, we want this to be atomic */ \
378 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
379 \
380 *__addr = __val; \
381 slow; \
382} \
383 \
384static inline type pfx##in##bwlq##p(unsigned long port) \
385{ \
386 volatile type *__addr; \
387 type __val; \
388 \
389 __addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
390 \
391 BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long)); \
392 \
393 __val = *__addr; \
394 slow; \
395 \
396 return pfx##ioswab##bwlq(__addr, __val); \
397}
398
399#define __BUILD_MEMORY_PFX(bus, bwlq, type) \
400 \
401__BUILD_MEMORY_SINGLE(bus, bwlq, type, 1)
402
403#define BUILDIO_MEM(bwlq, type) \
404 \
405__BUILD_MEMORY_PFX(__raw_, bwlq, type) \
406__BUILD_MEMORY_PFX(, bwlq, type) \
407__BUILD_MEMORY_PFX(__mem_, bwlq, type) \
408
409BUILDIO_MEM(b, u8)
410BUILDIO_MEM(w, u16)
411BUILDIO_MEM(l, u32)
412BUILDIO_MEM(q, u64)
413
414#define __BUILD_IOPORT_PFX(bus, bwlq, type) \
415 __BUILD_IOPORT_SINGLE(bus, bwlq, type, ,) \
416 __BUILD_IOPORT_SINGLE(bus, bwlq, type, _p, SLOW_DOWN_IO)
417
418#define BUILDIO_IOPORT(bwlq, type) \
419 __BUILD_IOPORT_PFX(, bwlq, type) \
420 __BUILD_IOPORT_PFX(__mem_, bwlq, type)
421
422BUILDIO_IOPORT(b, u8)
423BUILDIO_IOPORT(w, u16)
424BUILDIO_IOPORT(l, u32)
425#ifdef CONFIG_64BIT
426BUILDIO_IOPORT(q, u64)
427#endif
428
429#define __BUILDIO(bwlq, type) \
430 \
431__BUILD_MEMORY_SINGLE(____raw_, bwlq, type, 0)
432
433__BUILDIO(q, u64)
434
435#define readb_relaxed readb
436#define readw_relaxed readw
437#define readl_relaxed readl
438#define readq_relaxed readq
439
440/*
441 * Some code tests for these symbols
442 */
443#define readq readq
444#define writeq writeq
445
446#define __BUILD_MEMORY_STRING(bwlq, type) \
447 \
448static inline void writes##bwlq(volatile void __iomem *mem, \
449 const void *addr, unsigned int count) \
450{ \
451 const volatile type *__addr = addr; \
452 \
453 while (count--) { \
454 __mem_write##bwlq(*__addr, mem); \
455 __addr++; \
456 } \
457} \
458 \
459static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
460 unsigned int count) \
461{ \
462 volatile type *__addr = addr; \
463 \
464 while (count--) { \
465 *__addr = __mem_read##bwlq(mem); \
466 __addr++; \
467 } \
468}
469
470#define __BUILD_IOPORT_STRING(bwlq, type) \
471 \
472static inline void outs##bwlq(unsigned long port, const void *addr, \
473 unsigned int count) \
474{ \
475 const volatile type *__addr = addr; \
476 \
477 while (count--) { \
478 __mem_out##bwlq(*__addr, port); \
479 __addr++; \
480 } \
481} \
482 \
483static inline void ins##bwlq(unsigned long port, void *addr, \
484 unsigned int count) \
485{ \
486 volatile type *__addr = addr; \
487 \
488 while (count--) { \
489 *__addr = __mem_in##bwlq(port); \
490 __addr++; \
491 } \
492}
493
494#define BUILDSTRING(bwlq, type) \
495 \
496__BUILD_MEMORY_STRING(bwlq, type) \
497__BUILD_IOPORT_STRING(bwlq, type)
498
499BUILDSTRING(b, u8)
500BUILDSTRING(w, u16)
501BUILDSTRING(l, u32)
502#ifdef CONFIG_64BIT
503BUILDSTRING(q, u64)
504#endif
505
506
507/* Depends on MIPS II instruction set */
508#define mmiowb() asm volatile ("sync" ::: "memory")
509
510static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
511{
512 memset((void __force *) addr, val, count);
513}
514static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
515{
516 memcpy(dst, (void __force *) src, count);
517}
518static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
519{
520 memcpy((void __force *) dst, src, count);
521}
522
523/*
524 * The caches on some architectures aren't dma-coherent and have need to
525 * handle this in software. There are three types of operations that
526 * can be applied to dma buffers.
527 *
528 * - dma_cache_wback_inv(start, size) makes caches and coherent by
529 * writing the content of the caches back to memory, if necessary.
530 * The function also invalidates the affected part of the caches as
531 * necessary before DMA transfers from outside to memory.
532 * - dma_cache_wback(start, size) makes caches and coherent by
533 * writing the content of the caches back to memory, if necessary.
534 * The function also invalidates the affected part of the caches as
535 * necessary before DMA transfers from outside to memory.
536 * - dma_cache_inv(start, size) invalidates the affected parts of the
537 * caches. Dirty lines of the caches may be written back or simply
538 * be discarded. This operation is necessary before dma operations
539 * to the memory.
540 *
541 * This API used to be exported; it now is for arch code internal use only.
542 */
543#ifdef CONFIG_DMA_NONCOHERENT
544
545extern void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size);
546extern void (*_dma_cache_wback)(unsigned long start, unsigned long size);
547extern void (*_dma_cache_inv)(unsigned long start, unsigned long size);
548
549#define dma_cache_wback_inv(start, size) _dma_cache_wback_inv(start, size)
550#define dma_cache_wback(start, size) _dma_cache_wback(start, size)
551#define dma_cache_inv(start, size) _dma_cache_inv(start, size)
552
553#else /* Sane hardware */
554
555#define dma_cache_wback_inv(start,size) \
556 do { (void) (start); (void) (size); } while (0)
557#define dma_cache_wback(start,size) \
558 do { (void) (start); (void) (size); } while (0)
559#define dma_cache_inv(start,size) \
560 do { (void) (start); (void) (size); } while (0)
561
562#endif /* CONFIG_DMA_NONCOHERENT */
563
564/*
565 * Read a 32-bit register that requires a 64-bit read cycle on the bus.
566 * Avoid interrupt mucking, just adjust the address for 4-byte access.
567 * Assume the addresses are 8-byte aligned.
568 */
569#ifdef __MIPSEB__
570#define __CSR_32_ADJUST 4
571#else
572#define __CSR_32_ADJUST 0
573#endif
574
575#define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v))
576#define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST))
577
578/*
579 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
580 * access
581 */
582#define xlate_dev_mem_ptr(p) __va(p)
583
584/*
585 * Convert a virtual cached pointer to an uncached pointer
586 */
587#define xlate_dev_kmem_ptr(p) p
588
589#endif /* _ASM_IO_H */
diff --git a/include/asm-mips/ioctl.h b/include/asm-mips/ioctl.h
deleted file mode 100644
index 85067e248a83..000000000000
--- a/include/asm-mips/ioctl.h
+++ /dev/null
@@ -1,94 +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) 1995, 96, 99, 2001 Ralf Baechle
7 */
8#ifndef _ASM_IOCTL_H
9#define _ASM_IOCTL_H
10
11/*
12 * The original linux ioctl numbering scheme was just a general
13 * "anything goes" setup, where more or less random numbers were
14 * assigned. Sorry, I was clueless when I started out on this.
15 *
16 * On the alpha, we'll try to clean it up a bit, using a more sane
17 * ioctl numbering, and also trying to be compatible with OSF/1 in
18 * the process. I'd like to clean it up for the i386 as well, but
19 * it's so painful recognizing both the new and the old numbers..
20 *
21 * The same applies for for the MIPS ABI; in fact even the macros
22 * from Linux/Alpha fit almost perfectly.
23 */
24
25#define _IOC_NRBITS 8
26#define _IOC_TYPEBITS 8
27#define _IOC_SIZEBITS 13
28#define _IOC_DIRBITS 3
29
30#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
31#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
32#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
33#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
34
35#define _IOC_NRSHIFT 0
36#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
37#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
38#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
39
40/*
41 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
42 * And this turns out useful to catch old ioctl numbers in header
43 * files for us.
44 */
45#define _IOC_NONE 1U
46#define _IOC_READ 2U
47#define _IOC_WRITE 4U
48
49/*
50 * The following are included for compatibility
51 */
52#define _IOC_VOID 0x20000000
53#define _IOC_OUT 0x40000000
54#define _IOC_IN 0x80000000
55#define _IOC_INOUT (IOC_IN|IOC_OUT)
56
57#define _IOC(dir, type, nr, size) \
58 (((dir) << _IOC_DIRSHIFT) | \
59 ((type) << _IOC_TYPESHIFT) | \
60 ((nr) << _IOC_NRSHIFT) | \
61 ((size) << _IOC_SIZESHIFT))
62
63/* provoke compile error for invalid uses of size argument */
64extern unsigned int __invalid_size_argument_for_IOC;
65#define _IOC_TYPECHECK(t) \
66 ((sizeof(t) == sizeof(t[1]) && \
67 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
68 sizeof(t) : __invalid_size_argument_for_IOC)
69
70/* used to create numbers */
71#define _IO(type, nr) _IOC(_IOC_NONE, (type), (nr), 0)
72#define _IOR(type, nr, size) _IOC(_IOC_READ, (type), (nr), (_IOC_TYPECHECK(size)))
73#define _IOW(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
74#define _IOWR(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), (_IOC_TYPECHECK(size)))
75#define _IOR_BAD(type, nr, size) _IOC(_IOC_READ, (type), (nr), sizeof(size))
76#define _IOW_BAD(type, nr, size) _IOC(_IOC_WRITE, (type), (nr), sizeof(size))
77#define _IOWR_BAD(type, nr, size) _IOC(_IOC_READ|_IOC_WRITE, (type), (nr), sizeof(size))
78
79
80/* used to decode them.. */
81#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
82#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
83#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
84#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
85
86/* ...and for the drivers/sound files... */
87
88#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
89#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
90#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
91#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
92#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
93
94#endif /* _ASM_IOCTL_H */
diff --git a/include/asm-mips/ioctls.h b/include/asm-mips/ioctls.h
deleted file mode 100644
index 3f04a995ec54..000000000000
--- a/include/asm-mips/ioctls.h
+++ /dev/null
@@ -1,109 +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) 1995, 1996, 2001 Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#ifndef __ASM_IOCTLS_H
10#define __ASM_IOCTLS_H
11
12#include <asm/ioctl.h>
13
14#define TCGETA 0x5401
15#define TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
16#define TCSETAW 0x5403
17#define TCSETAF 0x5404
18
19#define TCSBRK 0x5405
20#define TCXONC 0x5406
21#define TCFLSH 0x5407
22
23#define TCGETS 0x540d
24#define TCSETS 0x540e
25#define TCSETSW 0x540f
26#define TCSETSF 0x5410
27
28#define TIOCEXCL 0x740d /* set exclusive use of tty */
29#define TIOCNXCL 0x740e /* reset exclusive use of tty */
30#define TIOCOUTQ 0x7472 /* output queue size */
31#define TIOCSTI 0x5472 /* simulate terminal input */
32#define TIOCMGET 0x741d /* get all modem bits */
33#define TIOCMBIS 0x741b /* bis modem bits */
34#define TIOCMBIC 0x741c /* bic modem bits */
35#define TIOCMSET 0x741a /* set all modem bits */
36#define TIOCPKT 0x5470 /* pty: set/clear packet mode */
37#define TIOCPKT_DATA 0x00 /* data packet */
38#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
39#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
40#define TIOCPKT_STOP 0x04 /* stop output */
41#define TIOCPKT_START 0x08 /* start output */
42#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
43#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
44/* #define TIOCPKT_IOCTL 0x40 state change of pty driver */
45#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
46#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
47#define TIOCNOTTY 0x5471 /* void tty association */
48#define TIOCSETD 0x7401
49#define TIOCGETD 0x7400
50
51#define FIOCLEX 0x6601
52#define FIONCLEX 0x6602
53#define FIOASYNC 0x667d
54#define FIONBIO 0x667e
55#define FIOQSIZE 0x667f
56
57#define TIOCGLTC 0x7474 /* get special local chars */
58#define TIOCSLTC 0x7475 /* set special local chars */
59#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
60#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
61#define TIOCCONS _IOW('t', 120, int) /* become virtual console */
62
63#define FIONREAD 0x467f
64#define TIOCINQ FIONREAD
65
66#define TIOCGETP 0x7408
67#define TIOCSETP 0x7409
68#define TIOCSETN 0x740a /* TIOCSETP wo flush */
69
70/* #define TIOCSETA _IOW('t', 20, struct termios) set termios struct */
71/* #define TIOCSETAW _IOW('t', 21, struct termios) drain output, set */
72/* #define TIOCSETAF _IOW('t', 22, struct termios) drn out, fls in, set */
73/* #define TIOCGETD _IOR('t', 26, int) get line discipline */
74/* #define TIOCSETD _IOW('t', 27, int) set line discipline */
75 /* 127-124 compat */
76
77#define TIOCSBRK 0x5427 /* BSD compatibility */
78#define TIOCCBRK 0x5428 /* BSD compatibility */
79#define TIOCGSID 0x7416 /* Return the session ID of FD */
80#define TCGETS2 _IOR('T', 0x2A, struct termios2)
81#define TCSETS2 _IOW('T', 0x2B, struct termios2)
82#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
83#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
84#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
85#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
86
87/* I hope the range from 0x5480 on is free ... */
88#define TIOCSCTTY 0x5480 /* become controlling tty */
89#define TIOCGSOFTCAR 0x5481
90#define TIOCSSOFTCAR 0x5482
91#define TIOCLINUX 0x5483
92#define TIOCGSERIAL 0x5484
93#define TIOCSSERIAL 0x5485
94#define TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
95#define TIOCSERCONFIG 0x5488
96#define TIOCSERGWILD 0x5489
97#define TIOCSERSWILD 0x548a
98#define TIOCGLCKTRMIOS 0x548b
99#define TIOCSLCKTRMIOS 0x548c
100#define TIOCSERGSTRUCT 0x548d /* For debugging only */
101#define TIOCSERGETLSR 0x548e /* Get line status register */
102#define TIOCSERGETMULTI 0x548f /* Get multiport config */
103#define TIOCSERSETMULTI 0x5490 /* Set multiport config */
104#define TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
105#define TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
106#define TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
107#define TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
108
109#endif /* __ASM_IOCTLS_H */
diff --git a/include/asm-mips/ip32/crime.h b/include/asm-mips/ip32/crime.h
deleted file mode 100644
index 7c36b0e5b1c6..000000000000
--- a/include/asm-mips/ip32/crime.h
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * Definitions for the SGI CRIME (CPU, Rendering, Interconnect and Memory
3 * Engine)
4 *
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
7 * for more details.
8 *
9 * Copyright (C) 2000 Harald Koerfgen
10 */
11
12#ifndef __ASM_CRIME_H__
13#define __ASM_CRIME_H__
14
15/*
16 * Address map
17 */
18#define CRIME_BASE 0x14000000 /* physical */
19
20struct sgi_crime {
21 volatile unsigned long id;
22#define CRIME_ID_MASK 0xff
23#define CRIME_ID_IDBITS 0xf0
24#define CRIME_ID_IDVALUE 0xa0
25#define CRIME_ID_REV 0x0f
26#define CRIME_REV_PETTY 0x00
27#define CRIME_REV_11 0x11
28#define CRIME_REV_13 0x13
29#define CRIME_REV_14 0x14
30
31 volatile unsigned long control;
32#define CRIME_CONTROL_MASK 0x3fff
33#define CRIME_CONTROL_TRITON_SYSADC 0x2000
34#define CRIME_CONTROL_CRIME_SYSADC 0x1000
35#define CRIME_CONTROL_HARD_RESET 0x0800
36#define CRIME_CONTROL_SOFT_RESET 0x0400
37#define CRIME_CONTROL_DOG_ENA 0x0200
38#define CRIME_CONTROL_ENDIANESS 0x0100
39#define CRIME_CONTROL_ENDIAN_BIG 0x0100
40#define CRIME_CONTROL_ENDIAN_LITTLE 0x0000
41#define CRIME_CONTROL_CQUEUE_HWM 0x000f
42#define CRIME_CONTROL_CQUEUE_SHFT 0
43#define CRIME_CONTROL_WBUF_HWM 0x00f0
44#define CRIME_CONTROL_WBUF_SHFT 8
45
46 volatile unsigned long istat;
47 volatile unsigned long imask;
48 volatile unsigned long soft_int;
49 volatile unsigned long hard_int;
50#define MACE_VID_IN1_INT BIT(0)
51#define MACE_VID_IN2_INT BIT(1)
52#define MACE_VID_OUT_INT BIT(2)
53#define MACE_ETHERNET_INT BIT(3)
54#define MACE_SUPERIO_INT BIT(4)
55#define MACE_MISC_INT BIT(5)
56#define MACE_AUDIO_INT BIT(6)
57#define MACE_PCI_BRIDGE_INT BIT(7)
58#define MACEPCI_SCSI0_INT BIT(8)
59#define MACEPCI_SCSI1_INT BIT(9)
60#define MACEPCI_SLOT0_INT BIT(10)
61#define MACEPCI_SLOT1_INT BIT(11)
62#define MACEPCI_SLOT2_INT BIT(12)
63#define MACEPCI_SHARED0_INT BIT(13)
64#define MACEPCI_SHARED1_INT BIT(14)
65#define MACEPCI_SHARED2_INT BIT(15)
66#define CRIME_GBE0_INT BIT(16)
67#define CRIME_GBE1_INT BIT(17)
68#define CRIME_GBE2_INT BIT(18)
69#define CRIME_GBE3_INT BIT(19)
70#define CRIME_CPUERR_INT BIT(20)
71#define CRIME_MEMERR_INT BIT(21)
72#define CRIME_RE_EMPTY_E_INT BIT(22)
73#define CRIME_RE_FULL_E_INT BIT(23)
74#define CRIME_RE_IDLE_E_INT BIT(24)
75#define CRIME_RE_EMPTY_L_INT BIT(25)
76#define CRIME_RE_FULL_L_INT BIT(26)
77#define CRIME_RE_IDLE_L_INT BIT(27)
78#define CRIME_SOFT0_INT BIT(28)
79#define CRIME_SOFT1_INT BIT(29)
80#define CRIME_SOFT2_INT BIT(30)
81#define CRIME_SYSCORERR_INT CRIME_SOFT2_INT
82#define CRIME_VICE_INT BIT(31)
83/* Masks for deciding who handles the interrupt */
84#define CRIME_MACE_INT_MASK 0x8f
85#define CRIME_MACEISA_INT_MASK 0x70
86#define CRIME_MACEPCI_INT_MASK 0xff00
87#define CRIME_CRIME_INT_MASK 0xffff0000
88
89 volatile unsigned long watchdog;
90#define CRIME_DOG_POWER_ON_RESET 0x00010000
91#define CRIME_DOG_WARM_RESET 0x00080000
92#define CRIME_DOG_TIMEOUT (CRIME_DOG_POWER_ON_RESET|CRIME_DOG_WARM_RESET)
93#define CRIME_DOG_VALUE 0x00007fff
94
95 volatile unsigned long timer;
96#define CRIME_MASTER_FREQ 66666500 /* Crime upcounter frequency */
97#define CRIME_NS_PER_TICK 15 /* for delay_calibrate */
98
99 volatile unsigned long cpu_error_addr;
100#define CRIME_CPU_ERROR_ADDR_MASK 0x3ffffffff
101
102 volatile unsigned long cpu_error_stat;
103#define CRIME_CPU_ERROR_MASK 0x7 /* cpu error stat is 3 bits */
104#define CRIME_CPU_ERROR_CPU_ILL_ADDR 0x4
105#define CRIME_CPU_ERROR_VICE_WRT_PRTY 0x2
106#define CRIME_CPU_ERROR_CPU_WRT_PRTY 0x1
107
108 unsigned long _pad0[54];
109
110 volatile unsigned long mc_ctrl;
111 volatile unsigned long bank_ctrl[8];
112#define CRIME_MEM_BANK_CONTROL_MASK 0x11f /* 9 bits 7:5 reserved */
113#define CRIME_MEM_BANK_CONTROL_ADDR 0x01f
114#define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE 0x100
115#define CRIME_MAXBANKS 8
116
117 volatile unsigned long mem_ref_counter;
118#define CRIME_MEM_REF_COUNTER_MASK 0x3ff /* 10bit */
119
120 volatile unsigned long mem_error_stat;
121#define CRIME_MEM_ERROR_STAT_MASK 0x0ff7ffff /* 28-bit register */
122#define CRIME_MEM_ERROR_MACE_ID 0x0000007f
123#define CRIME_MEM_ERROR_MACE_ACCESS 0x00000080
124#define CRIME_MEM_ERROR_RE_ID 0x00007f00
125#define CRIME_MEM_ERROR_RE_ACCESS 0x00008000
126#define CRIME_MEM_ERROR_GBE_ACCESS 0x00010000
127#define CRIME_MEM_ERROR_VICE_ACCESS 0x00020000
128#define CRIME_MEM_ERROR_CPU_ACCESS 0x00040000
129#define CRIME_MEM_ERROR_RESERVED 0x00080000
130#define CRIME_MEM_ERROR_SOFT_ERR 0x00100000
131#define CRIME_MEM_ERROR_HARD_ERR 0x00200000
132#define CRIME_MEM_ERROR_MULTIPLE 0x00400000
133#define CRIME_MEM_ERROR_ECC 0x01800000
134#define CRIME_MEM_ERROR_MEM_ECC_RD 0x00800000
135#define CRIME_MEM_ERROR_MEM_ECC_RMW 0x01000000
136#define CRIME_MEM_ERROR_INV 0x0e000000
137#define CRIME_MEM_ERROR_INV_MEM_ADDR_RD 0x02000000
138#define CRIME_MEM_ERROR_INV_MEM_ADDR_WR 0x04000000
139#define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW 0x08000000
140
141 volatile unsigned long mem_error_addr;
142#define CRIME_MEM_ERROR_ADDR_MASK 0x3fffffff
143
144 volatile unsigned long mem_ecc_syn;
145#define CRIME_MEM_ERROR_ECC_SYN_MASK 0xffffffff
146
147 volatile unsigned long mem_ecc_chk;
148#define CRIME_MEM_ERROR_ECC_CHK_MASK 0xffffffff
149
150 volatile unsigned long mem_ecc_repl;
151#define CRIME_MEM_ERROR_ECC_REPL_MASK 0xffffffff
152};
153
154extern struct sgi_crime __iomem *crime;
155
156#define CRIME_HI_MEM_BASE 0x40000000 /* this is where whole 1G of RAM is mapped */
157
158#endif /* __ASM_CRIME_H__ */
diff --git a/include/asm-mips/ip32/ip32_ints.h b/include/asm-mips/ip32/ip32_ints.h
deleted file mode 100644
index 85bc5302bce0..000000000000
--- a/include/asm-mips/ip32/ip32_ints.h
+++ /dev/null
@@ -1,114 +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) 2000 Harald Koerfgen
7 */
8
9#ifndef __ASM_IP32_INTS_H
10#define __ASM_IP32_INTS_H
11
12#include <asm/irq.h>
13
14/*
15 * This list reflects the assignment of interrupt numbers to
16 * interrupting events. Order is fairly irrelevant to handling
17 * priority. This differs from irix.
18 */
19
20enum ip32_irq_no {
21 /*
22 * CPU interrupts are 0 ... 7
23 */
24
25 CRIME_IRQ_BASE = MIPS_CPU_IRQ_BASE + 8,
26
27 /*
28 * MACE
29 */
30 MACE_VID_IN1_IRQ = CRIME_IRQ_BASE,
31 MACE_VID_IN2_IRQ,
32 MACE_VID_OUT_IRQ,
33 MACE_ETHERNET_IRQ,
34 /* SUPERIO, MISC, and AUDIO are MACEISA */
35 __MACE_SUPERIO,
36 __MACE_MISC,
37 __MACE_AUDIO,
38 MACE_PCI_BRIDGE_IRQ,
39
40 /*
41 * MACEPCI
42 */
43 MACEPCI_SCSI0_IRQ,
44 MACEPCI_SCSI1_IRQ,
45 MACEPCI_SLOT0_IRQ,
46 MACEPCI_SLOT1_IRQ,
47 MACEPCI_SLOT2_IRQ,
48 MACEPCI_SHARED0_IRQ,
49 MACEPCI_SHARED1_IRQ,
50 MACEPCI_SHARED2_IRQ,
51
52 /*
53 * CRIME
54 */
55 CRIME_GBE0_IRQ,
56 CRIME_GBE1_IRQ,
57 CRIME_GBE2_IRQ,
58 CRIME_GBE3_IRQ,
59 CRIME_CPUERR_IRQ,
60 CRIME_MEMERR_IRQ,
61 CRIME_RE_EMPTY_E_IRQ,
62 CRIME_RE_FULL_E_IRQ,
63 CRIME_RE_IDLE_E_IRQ,
64 CRIME_RE_EMPTY_L_IRQ,
65 CRIME_RE_FULL_L_IRQ,
66 CRIME_RE_IDLE_L_IRQ,
67 CRIME_SOFT0_IRQ,
68 CRIME_SOFT1_IRQ,
69 CRIME_SOFT2_IRQ,
70 CRIME_SYSCORERR_IRQ = CRIME_SOFT2_IRQ,
71 CRIME_VICE_IRQ,
72
73 /*
74 * MACEISA
75 */
76 MACEISA_AUDIO_SW_IRQ,
77 MACEISA_AUDIO_SC_IRQ,
78 MACEISA_AUDIO1_DMAT_IRQ,
79 MACEISA_AUDIO1_OF_IRQ,
80 MACEISA_AUDIO2_DMAT_IRQ,
81 MACEISA_AUDIO2_MERR_IRQ,
82 MACEISA_AUDIO3_DMAT_IRQ,
83 MACEISA_AUDIO3_MERR_IRQ,
84 MACEISA_RTC_IRQ,
85 MACEISA_KEYB_IRQ,
86 /* MACEISA_KEYB_POLL is not an IRQ */
87 __MACEISA_KEYB_POLL,
88 MACEISA_MOUSE_IRQ,
89 /* MACEISA_MOUSE_POLL is not an IRQ */
90 __MACEISA_MOUSE_POLL,
91 MACEISA_TIMER0_IRQ,
92 MACEISA_TIMER1_IRQ,
93 MACEISA_TIMER2_IRQ,
94 MACEISA_PARALLEL_IRQ,
95 MACEISA_PAR_CTXA_IRQ,
96 MACEISA_PAR_CTXB_IRQ,
97 MACEISA_PAR_MERR_IRQ,
98 MACEISA_SERIAL1_IRQ,
99 MACEISA_SERIAL1_TDMAT_IRQ,
100 MACEISA_SERIAL1_TDMAPR_IRQ,
101 MACEISA_SERIAL1_TDMAME_IRQ,
102 MACEISA_SERIAL1_RDMAT_IRQ,
103 MACEISA_SERIAL1_RDMAOR_IRQ,
104 MACEISA_SERIAL2_IRQ,
105 MACEISA_SERIAL2_TDMAT_IRQ,
106 MACEISA_SERIAL2_TDMAPR_IRQ,
107 MACEISA_SERIAL2_TDMAME_IRQ,
108 MACEISA_SERIAL2_RDMAT_IRQ,
109 MACEISA_SERIAL2_RDMAOR_IRQ,
110
111 IP32_IRQ_MAX = MACEISA_SERIAL2_RDMAOR_IRQ
112};
113
114#endif /* __ASM_IP32_INTS_H */
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h
deleted file mode 100644
index d08d7c672139..000000000000
--- a/include/asm-mips/ip32/mace.h
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * Definitions for the SGI MACE (Multimedia, Audio and Communications Engine)
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) 2000 Harald Koerfgen
9 * Copyright (C) 2004 Ladislav Michl
10 */
11
12#ifndef __ASM_MACE_H__
13#define __ASM_MACE_H__
14
15/*
16 * Address map
17 */
18#define MACE_BASE 0x1f000000 /* physical */
19
20/*
21 * PCI interface
22 */
23struct mace_pci {
24 volatile unsigned int error_addr;
25 volatile unsigned int error;
26#define MACEPCI_ERROR_MASTER_ABORT BIT(31)
27#define MACEPCI_ERROR_TARGET_ABORT BIT(30)
28#define MACEPCI_ERROR_DATA_PARITY_ERR BIT(29)
29#define MACEPCI_ERROR_RETRY_ERR BIT(28)
30#define MACEPCI_ERROR_ILLEGAL_CMD BIT(27)
31#define MACEPCI_ERROR_SYSTEM_ERR BIT(26)
32#define MACEPCI_ERROR_INTERRUPT_TEST BIT(25)
33#define MACEPCI_ERROR_PARITY_ERR BIT(24)
34#define MACEPCI_ERROR_OVERRUN BIT(23)
35#define MACEPCI_ERROR_RSVD BIT(22)
36#define MACEPCI_ERROR_MEMORY_ADDR BIT(21)
37#define MACEPCI_ERROR_CONFIG_ADDR BIT(20)
38#define MACEPCI_ERROR_MASTER_ABORT_ADDR_VALID BIT(19)
39#define MACEPCI_ERROR_TARGET_ABORT_ADDR_VALID BIT(18)
40#define MACEPCI_ERROR_DATA_PARITY_ADDR_VALID BIT(17)
41#define MACEPCI_ERROR_RETRY_ADDR_VALID BIT(16)
42#define MACEPCI_ERROR_SIG_TABORT BIT(4)
43#define MACEPCI_ERROR_DEVSEL_MASK 0xc0
44#define MACEPCI_ERROR_DEVSEL_FAST 0
45#define MACEPCI_ERROR_DEVSEL_MED 0x40
46#define MACEPCI_ERROR_DEVSEL_SLOW 0x80
47#define MACEPCI_ERROR_FBB BIT(1)
48#define MACEPCI_ERROR_66MHZ BIT(0)
49 volatile unsigned int control;
50#define MACEPCI_CONTROL_INT(x) BIT(x)
51#define MACEPCI_CONTROL_INT_MASK 0xff
52#define MACEPCI_CONTROL_SERR_ENA BIT(8)
53#define MACEPCI_CONTROL_ARB_N6 BIT(9)
54#define MACEPCI_CONTROL_PARITY_ERR BIT(10)
55#define MACEPCI_CONTROL_MRMRA_ENA BIT(11)
56#define MACEPCI_CONTROL_ARB_N3 BIT(12)
57#define MACEPCI_CONTROL_ARB_N4 BIT(13)
58#define MACEPCI_CONTROL_ARB_N5 BIT(14)
59#define MACEPCI_CONTROL_PARK_LIU BIT(15)
60#define MACEPCI_CONTROL_INV_INT(x) BIT(16+x)
61#define MACEPCI_CONTROL_INV_INT_MASK 0x00ff0000
62#define MACEPCI_CONTROL_OVERRUN_INT BIT(24)
63#define MACEPCI_CONTROL_PARITY_INT BIT(25)
64#define MACEPCI_CONTROL_SERR_INT BIT(26)
65#define MACEPCI_CONTROL_IT_INT BIT(27)
66#define MACEPCI_CONTROL_RE_INT BIT(28)
67#define MACEPCI_CONTROL_DPED_INT BIT(29)
68#define MACEPCI_CONTROL_TAR_INT BIT(30)
69#define MACEPCI_CONTROL_MAR_INT BIT(31)
70 volatile unsigned int rev;
71 unsigned int _pad[0xcf8/4 - 4];
72 volatile unsigned int config_addr;
73 union {
74 volatile unsigned char b[4];
75 volatile unsigned short w[2];
76 volatile unsigned int l;
77 } config_data;
78};
79#define MACEPCI_LOW_MEMORY 0x1a000000
80#define MACEPCI_LOW_IO 0x18000000
81#define MACEPCI_SWAPPED_VIEW 0
82#define MACEPCI_NATIVE_VIEW 0x40000000
83#define MACEPCI_IO 0x80000000
84#define MACEPCI_HI_MEMORY 0x280000000
85#define MACEPCI_HI_IO 0x100000000
86
87/*
88 * Video interface
89 */
90struct mace_video {
91 unsigned long xxx; /* later... */
92};
93
94/*
95 * Ethernet interface
96 */
97struct mace_ethernet {
98 volatile unsigned long mac_ctrl;
99 volatile unsigned long int_stat;
100 volatile unsigned long dma_ctrl;
101 volatile unsigned long timer;
102 volatile unsigned long tx_int_al;
103 volatile unsigned long rx_int_al;
104 volatile unsigned long tx_info;
105 volatile unsigned long tx_info_al;
106 volatile unsigned long rx_buff;
107 volatile unsigned long rx_buff_al1;
108 volatile unsigned long rx_buff_al2;
109 volatile unsigned long diag;
110 volatile unsigned long phy_data;
111 volatile unsigned long phy_regs;
112 volatile unsigned long phy_trans_go;
113 volatile unsigned long backoff_seed;
114 /*===================================*/
115 volatile unsigned long imq_reserved[4];
116 volatile unsigned long mac_addr;
117 volatile unsigned long mac_addr2;
118 volatile unsigned long mcast_filter;
119 volatile unsigned long tx_ring_base;
120 /* Following are read-only registers for debugging */
121 volatile unsigned long tx_pkt1_hdr;
122 volatile unsigned long tx_pkt1_ptr[3];
123 volatile unsigned long tx_pkt2_hdr;
124 volatile unsigned long tx_pkt2_ptr[3];
125 /*===================================*/
126 volatile unsigned long rx_fifo;
127};
128
129/*
130 * Peripherals
131 */
132
133/* Audio registers */
134struct mace_audio {
135 volatile unsigned long control;
136 volatile unsigned long codec_control; /* codec status control */
137 volatile unsigned long codec_mask; /* codec status input mask */
138 volatile unsigned long codec_read; /* codec status read data */
139 struct {
140 volatile unsigned long control; /* channel control */
141 volatile unsigned long read_ptr; /* channel read pointer */
142 volatile unsigned long write_ptr; /* channel write pointer */
143 volatile unsigned long depth; /* channel depth */
144 } chan[3];
145};
146
147
148/* register definitions for parallel port DMA */
149struct mace_parport {
150 /* 0 - do nothing,
151 * 1 - pulse terminal count to the device after buffer is drained */
152#define MACEPAR_CONTEXT_LASTFLAG BIT(63)
153 /* Should not cross 4K page boundary */
154#define MACEPAR_CONTEXT_DATA_BOUND 0x0000000000001000UL
155#define MACEPAR_CONTEXT_DATALEN_MASK 0x00000fff00000000UL
156#define MACEPAR_CONTEXT_DATALEN_SHIFT 32
157 /* Can be arbitrarily aligned on any byte boundary on output,
158 * 64 byte aligned on input */
159#define MACEPAR_CONTEXT_BASEADDR_MASK 0x00000000ffffffffUL
160 volatile u64 context_a;
161 volatile u64 context_b;
162 /* 0 - mem->device, 1 - device->mem */
163#define MACEPAR_CTLSTAT_DIRECTION BIT(0)
164 /* 0 - channel frozen, 1 - channel enabled */
165#define MACEPAR_CTLSTAT_ENABLE BIT(1)
166 /* 0 - channel active, 1 - complete channel reset */
167#define MACEPAR_CTLSTAT_RESET BIT(2)
168#define MACEPAR_CTLSTAT_CTXB_VALID BIT(3)
169#define MACEPAR_CTLSTAT_CTXA_VALID BIT(4)
170 volatile u64 cntlstat; /* Control/Status register */
171#define MACEPAR_DIAG_CTXINUSE BIT(0)
172 /* 1 - Dma engine is enabled and processing something */
173#define MACEPAR_DIAG_DMACTIVE BIT(1)
174 /* Counter of bytes left */
175#define MACEPAR_DIAG_CTRMASK 0x0000000000003ffcUL
176#define MACEPAR_DIAG_CTRSHIFT 2
177 volatile u64 diagnostic; /* RO: diagnostic register */
178};
179
180/* ISA Control and DMA registers */
181struct mace_isactrl {
182 volatile unsigned long ringbase;
183#define MACEISA_RINGBUFFERS_SIZE (8 * 4096)
184
185 volatile unsigned long misc;
186#define MACEISA_FLASH_WE BIT(0) /* 1=> Enable FLASH writes */
187#define MACEISA_PWD_CLEAR BIT(1) /* 1=> PWD CLEAR jumper detected */
188#define MACEISA_NIC_DEASSERT BIT(2)
189#define MACEISA_NIC_DATA BIT(3)
190#define MACEISA_LED_RED BIT(4) /* 0=> Illuminate red LED */
191#define MACEISA_LED_GREEN BIT(5) /* 0=> Illuminate green LED */
192#define MACEISA_DP_RAM_ENABLE BIT(6)
193
194 volatile unsigned long istat;
195 volatile unsigned long imask;
196#define MACEISA_AUDIO_SW_INT BIT(0)
197#define MACEISA_AUDIO_SC_INT BIT(1)
198#define MACEISA_AUDIO1_DMAT_INT BIT(2)
199#define MACEISA_AUDIO1_OF_INT BIT(3)
200#define MACEISA_AUDIO2_DMAT_INT BIT(4)
201#define MACEISA_AUDIO2_MERR_INT BIT(5)
202#define MACEISA_AUDIO3_DMAT_INT BIT(6)
203#define MACEISA_AUDIO3_MERR_INT BIT(7)
204#define MACEISA_RTC_INT BIT(8)
205#define MACEISA_KEYB_INT BIT(9)
206#define MACEISA_KEYB_POLL_INT BIT(10)
207#define MACEISA_MOUSE_INT BIT(11)
208#define MACEISA_MOUSE_POLL_INT BIT(12)
209#define MACEISA_TIMER0_INT BIT(13)
210#define MACEISA_TIMER1_INT BIT(14)
211#define MACEISA_TIMER2_INT BIT(15)
212#define MACEISA_PARALLEL_INT BIT(16)
213#define MACEISA_PAR_CTXA_INT BIT(17)
214#define MACEISA_PAR_CTXB_INT BIT(18)
215#define MACEISA_PAR_MERR_INT BIT(19)
216#define MACEISA_SERIAL1_INT BIT(20)
217#define MACEISA_SERIAL1_TDMAT_INT BIT(21)
218#define MACEISA_SERIAL1_TDMAPR_INT BIT(22)
219#define MACEISA_SERIAL1_TDMAME_INT BIT(23)
220#define MACEISA_SERIAL1_RDMAT_INT BIT(24)
221#define MACEISA_SERIAL1_RDMAOR_INT BIT(25)
222#define MACEISA_SERIAL2_INT BIT(26)
223#define MACEISA_SERIAL2_TDMAT_INT BIT(27)
224#define MACEISA_SERIAL2_TDMAPR_INT BIT(28)
225#define MACEISA_SERIAL2_TDMAME_INT BIT(29)
226#define MACEISA_SERIAL2_RDMAT_INT BIT(30)
227#define MACEISA_SERIAL2_RDMAOR_INT BIT(31)
228
229 volatile unsigned long _pad[0x2000/8 - 4];
230
231 volatile unsigned long dp_ram[0x400];
232 struct mace_parport parport;
233};
234
235/* Keyboard & Mouse registers
236 * -> drivers/input/serio/maceps2.c */
237struct mace_ps2port {
238 volatile unsigned long tx;
239 volatile unsigned long rx;
240 volatile unsigned long control;
241 volatile unsigned long status;
242};
243
244struct mace_ps2 {
245 struct mace_ps2port keyb;
246 struct mace_ps2port mouse;
247};
248
249/* I2C registers
250 * -> drivers/i2c/algos/i2c-algo-sgi.c */
251struct mace_i2c {
252 volatile unsigned long config;
253#define MACEI2C_RESET BIT(0)
254#define MACEI2C_FAST BIT(1)
255#define MACEI2C_DATA_OVERRIDE BIT(2)
256#define MACEI2C_CLOCK_OVERRIDE BIT(3)
257#define MACEI2C_DATA_STATUS BIT(4)
258#define MACEI2C_CLOCK_STATUS BIT(5)
259 volatile unsigned long control;
260 volatile unsigned long data;
261};
262
263/* Timer registers */
264typedef union {
265 volatile unsigned long ust_msc;
266 struct reg {
267 volatile unsigned int ust;
268 volatile unsigned int msc;
269 } reg;
270} timer_reg;
271
272struct mace_timers {
273 volatile unsigned long ust;
274#define MACE_UST_PERIOD_NS 960
275
276 volatile unsigned long compare1;
277 volatile unsigned long compare2;
278 volatile unsigned long compare3;
279
280 timer_reg audio_in;
281 timer_reg audio_out1;
282 timer_reg audio_out2;
283 timer_reg video_in1;
284 timer_reg video_in2;
285 timer_reg video_out;
286};
287
288struct mace_perif {
289 struct mace_audio audio;
290 char _pad0[0x10000 - sizeof(struct mace_audio)];
291
292 struct mace_isactrl ctrl;
293 char _pad1[0x10000 - sizeof(struct mace_isactrl)];
294
295 struct mace_ps2 ps2;
296 char _pad2[0x10000 - sizeof(struct mace_ps2)];
297
298 struct mace_i2c i2c;
299 char _pad3[0x10000 - sizeof(struct mace_i2c)];
300
301 struct mace_timers timers;
302 char _pad4[0x10000 - sizeof(struct mace_timers)];
303};
304
305
306/*
307 * ISA peripherals
308 */
309
310/* Parallel port */
311struct mace_parallel {
312};
313
314struct mace_ecp1284 { /* later... */
315};
316
317/* Serial port */
318struct mace_serial {
319 volatile unsigned long xxx; /* later... */
320};
321
322struct mace_isa {
323 struct mace_parallel parallel;
324 char _pad1[0x8000 - sizeof(struct mace_parallel)];
325
326 struct mace_ecp1284 ecp1284;
327 char _pad2[0x8000 - sizeof(struct mace_ecp1284)];
328
329 struct mace_serial serial1;
330 char _pad3[0x8000 - sizeof(struct mace_serial)];
331
332 struct mace_serial serial2;
333 char _pad4[0x8000 - sizeof(struct mace_serial)];
334
335 volatile unsigned char rtc[0x10000];
336};
337
338struct sgi_mace {
339 char _reserved[0x80000];
340
341 struct mace_pci pci;
342 char _pad0[0x80000 - sizeof(struct mace_pci)];
343
344 struct mace_video video_in1;
345 char _pad1[0x80000 - sizeof(struct mace_video)];
346
347 struct mace_video video_in2;
348 char _pad2[0x80000 - sizeof(struct mace_video)];
349
350 struct mace_video video_out;
351 char _pad3[0x80000 - sizeof(struct mace_video)];
352
353 struct mace_ethernet eth;
354 char _pad4[0x80000 - sizeof(struct mace_ethernet)];
355
356 struct mace_perif perif;
357 char _pad5[0x80000 - sizeof(struct mace_perif)];
358
359 struct mace_isa isa;
360 char _pad6[0x80000 - sizeof(struct mace_isa)];
361};
362
363extern struct sgi_mace __iomem *mace;
364
365#endif /* __ASM_MACE_H__ */
diff --git a/include/asm-mips/ipcbuf.h b/include/asm-mips/ipcbuf.h
deleted file mode 100644
index d47d08f264e7..000000000000
--- a/include/asm-mips/ipcbuf.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_IPCBUF_H
2#define _ASM_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for alpha architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short seq;
23 unsigned short __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_IPCBUF_H */
diff --git a/include/asm-mips/irq.h b/include/asm-mips/irq.h
deleted file mode 100644
index a58f0eecc68f..000000000000
--- a/include/asm-mips/irq.h
+++ /dev/null
@@ -1,163 +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) 1994 by Waldorf GMBH, written by Ralf Baechle
7 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 03 by Ralf Baechle
8 */
9#ifndef _ASM_IRQ_H
10#define _ASM_IRQ_H
11
12#include <linux/linkage.h>
13
14#include <asm/mipsmtregs.h>
15
16#include <irq.h>
17
18#ifdef CONFIG_I8259
19static inline int irq_canonicalize(int irq)
20{
21 return ((irq == I8259A_IRQ_BASE + 2) ? I8259A_IRQ_BASE + 9 : irq);
22}
23#else
24#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
25#endif
26
27#ifdef CONFIG_MIPS_MT_SMTC
28
29struct irqaction;
30
31extern unsigned long irq_hwmask[];
32extern int setup_irq_smtc(unsigned int irq, struct irqaction * new,
33 unsigned long hwmask);
34
35static inline void smtc_im_ack_irq(unsigned int irq)
36{
37 if (irq_hwmask[irq] & ST0_IM)
38 set_c0_status(irq_hwmask[irq] & ST0_IM);
39}
40
41#else
42
43static inline void smtc_im_ack_irq(unsigned int irq)
44{
45}
46
47#endif /* CONFIG_MIPS_MT_SMTC */
48
49#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
50#include <linux/cpumask.h>
51
52extern void plat_set_irq_affinity(unsigned int irq, cpumask_t affinity);
53extern void smtc_forward_irq(unsigned int irq);
54
55/*
56 * IRQ affinity hook invoked at the beginning of interrupt dispatch
57 * if option is enabled.
58 *
59 * Up through Linux 2.6.22 (at least) cpumask operations are very
60 * inefficient on MIPS. Initial prototypes of SMTC IRQ affinity
61 * used a "fast path" per-IRQ-descriptor cache of affinity information
62 * to reduce latency. As there is a project afoot to optimize the
63 * cpumask implementations, this version is optimistically assuming
64 * that cpumask.h macro overhead is reasonable during interrupt dispatch.
65 */
66#define IRQ_AFFINITY_HOOK(irq) \
67do { \
68 if (!cpu_isset(smp_processor_id(), irq_desc[irq].affinity)) { \
69 smtc_forward_irq(irq); \
70 irq_exit(); \
71 return; \
72 } \
73} while (0)
74
75#else /* Not doing SMTC affinity */
76
77#define IRQ_AFFINITY_HOOK(irq) do { } while (0)
78
79#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
80
81#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
82
83/*
84 * Clear interrupt mask handling "backstop" if irq_hwmask
85 * entry so indicates. This implies that the ack() or end()
86 * functions will take over re-enabling the low-level mask.
87 * Otherwise it will be done on return from exception.
88 */
89#define __DO_IRQ_SMTC_HOOK(irq) \
90do { \
91 IRQ_AFFINITY_HOOK(irq); \
92 if (irq_hwmask[irq] & 0x0000ff00) \
93 write_c0_tccontext(read_c0_tccontext() & \
94 ~(irq_hwmask[irq] & 0x0000ff00)); \
95} while (0)
96
97#define __NO_AFFINITY_IRQ_SMTC_HOOK(irq) \
98do { \
99 if (irq_hwmask[irq] & 0x0000ff00) \
100 write_c0_tccontext(read_c0_tccontext() & \
101 ~(irq_hwmask[irq] & 0x0000ff00)); \
102} while (0)
103
104#else
105
106#define __DO_IRQ_SMTC_HOOK(irq) \
107do { \
108 IRQ_AFFINITY_HOOK(irq); \
109} while (0)
110#define __NO_AFFINITY_IRQ_SMTC_HOOK(irq) do { } while (0)
111
112#endif
113
114/*
115 * do_IRQ handles all normal device IRQ's (the special
116 * SMP cross-CPU interrupts have their own specific
117 * handlers).
118 *
119 * Ideally there should be away to get this into kernel/irq/handle.c to
120 * avoid the overhead of a call for just a tiny function ...
121 */
122#define do_IRQ(irq) \
123do { \
124 irq_enter(); \
125 __DO_IRQ_SMTC_HOOK(irq); \
126 generic_handle_irq(irq); \
127 irq_exit(); \
128} while (0)
129
130#ifdef CONFIG_MIPS_MT_SMTC_IRQAFF
131/*
132 * To avoid inefficient and in some cases pathological re-checking of
133 * IRQ affinity, we have this variant that skips the affinity check.
134 */
135
136
137#define do_IRQ_no_affinity(irq) \
138do { \
139 irq_enter(); \
140 __NO_AFFINITY_IRQ_SMTC_HOOK(irq); \
141 generic_handle_irq(irq); \
142 irq_exit(); \
143} while (0)
144
145#endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
146
147extern void arch_init_irq(void);
148extern void spurious_interrupt(void);
149
150extern int allocate_irqno(void);
151extern void alloc_legacy_irqno(void);
152extern void free_irqno(unsigned int irq);
153
154/*
155 * Before R2 the timer and performance counter interrupts were both fixed to
156 * IE7. Since R2 their number has to be read from the c0_intctl register.
157 */
158#define CP0_LEGACY_COMPARE_IRQ 7
159
160extern int cp0_compare_irq;
161extern int cp0_perfcount_irq;
162
163#endif /* _ASM_IRQ_H */
diff --git a/include/asm-mips/irq_cpu.h b/include/asm-mips/irq_cpu.h
deleted file mode 100644
index ef6a07cddb23..000000000000
--- a/include/asm-mips/irq_cpu.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * include/asm-mips/irq_cpu.h
3 *
4 * MIPS CPU interrupt definitions.
5 *
6 * Copyright (C) 2002 Maciej W. Rozycki
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#ifndef _ASM_IRQ_CPU_H
14#define _ASM_IRQ_CPU_H
15
16extern void mips_cpu_irq_init(void);
17extern void rm7k_cpu_irq_init(void);
18extern void rm9k_cpu_irq_init(void);
19
20#endif /* _ASM_IRQ_CPU_H */
diff --git a/include/asm-mips/irq_gt641xx.h b/include/asm-mips/irq_gt641xx.h
deleted file mode 100644
index f9a7c3ac2e66..000000000000
--- a/include/asm-mips/irq_gt641xx.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Galileo/Marvell GT641xx IRQ definitions.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#ifndef _ASM_IRQ_GT641XX_H
21#define _ASM_IRQ_GT641XX_H
22
23#ifndef GT641XX_IRQ_BASE
24#define GT641XX_IRQ_BASE 8
25#endif
26
27#define GT641XX_MEMORY_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 1)
28#define GT641XX_DMA_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 2)
29#define GT641XX_CPU_ACCESS_OUT_OF_RANGE_IRQ (GT641XX_IRQ_BASE + 3)
30#define GT641XX_DMA0_IRQ (GT641XX_IRQ_BASE + 4)
31#define GT641XX_DMA1_IRQ (GT641XX_IRQ_BASE + 5)
32#define GT641XX_DMA2_IRQ (GT641XX_IRQ_BASE + 6)
33#define GT641XX_DMA3_IRQ (GT641XX_IRQ_BASE + 7)
34#define GT641XX_TIMER0_IRQ (GT641XX_IRQ_BASE + 8)
35#define GT641XX_TIMER1_IRQ (GT641XX_IRQ_BASE + 9)
36#define GT641XX_TIMER2_IRQ (GT641XX_IRQ_BASE + 10)
37#define GT641XX_TIMER3_IRQ (GT641XX_IRQ_BASE + 11)
38#define GT641XX_PCI_0_MASTER_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 12)
39#define GT641XX_PCI_0_SLAVE_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 13)
40#define GT641XX_PCI_0_MASTER_WRITE_ERROR_IRQ (GT641XX_IRQ_BASE + 14)
41#define GT641XX_PCI_0_SLAVE_READ_ERROR_IRQ (GT641XX_IRQ_BASE + 15)
42#define GT641XX_PCI_0_ADDRESS_ERROR_IRQ (GT641XX_IRQ_BASE + 16)
43#define GT641XX_MEMORY_ERROR_IRQ (GT641XX_IRQ_BASE + 17)
44#define GT641XX_PCI_0_MASTER_ABORT_IRQ (GT641XX_IRQ_BASE + 18)
45#define GT641XX_PCI_0_TARGET_ABORT_IRQ (GT641XX_IRQ_BASE + 19)
46#define GT641XX_PCI_0_RETRY_TIMEOUT_IRQ (GT641XX_IRQ_BASE + 20)
47#define GT641XX_CPU_INT0_IRQ (GT641XX_IRQ_BASE + 21)
48#define GT641XX_CPU_INT1_IRQ (GT641XX_IRQ_BASE + 22)
49#define GT641XX_CPU_INT2_IRQ (GT641XX_IRQ_BASE + 23)
50#define GT641XX_CPU_INT3_IRQ (GT641XX_IRQ_BASE + 24)
51#define GT641XX_CPU_INT4_IRQ (GT641XX_IRQ_BASE + 25)
52#define GT641XX_PCI_INT0_IRQ (GT641XX_IRQ_BASE + 26)
53#define GT641XX_PCI_INT1_IRQ (GT641XX_IRQ_BASE + 27)
54#define GT641XX_PCI_INT2_IRQ (GT641XX_IRQ_BASE + 28)
55#define GT641XX_PCI_INT3_IRQ (GT641XX_IRQ_BASE + 29)
56
57extern void gt641xx_irq_dispatch(void);
58extern void gt641xx_irq_init(void);
59
60#endif /* _ASM_IRQ_GT641XX_H */
diff --git a/include/asm-mips/irq_regs.h b/include/asm-mips/irq_regs.h
deleted file mode 100644
index 33bd2a06de57..000000000000
--- a/include/asm-mips/irq_regs.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version
5 * 2 of the License, or (at your option) any later version.
6 *
7 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_IRQ_REGS_H
10#define __ASM_IRQ_REGS_H
11
12#define ARCH_HAS_OWN_IRQ_REGS
13
14#include <linux/thread_info.h>
15
16static inline struct pt_regs *get_irq_regs(void)
17{
18 return current_thread_info()->regs;
19}
20
21#endif /* __ASM_IRQ_REGS_H */
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
deleted file mode 100644
index 701ec0ba8fa9..000000000000
--- a/include/asm-mips/irqflags.h
+++ /dev/null
@@ -1,283 +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) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Copyright (C) 2000 MIPS Technologies, Inc.
10 */
11#ifndef _ASM_IRQFLAGS_H
12#define _ASM_IRQFLAGS_H
13
14#ifndef __ASSEMBLY__
15
16#include <linux/compiler.h>
17#include <asm/hazards.h>
18
19__asm__(
20 " .macro raw_local_irq_enable \n"
21 " .set push \n"
22 " .set reorder \n"
23 " .set noat \n"
24#ifdef CONFIG_MIPS_MT_SMTC
25 " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
26 " ori $1, 0x400 \n"
27 " xori $1, 0x400 \n"
28 " mtc0 $1, $2, 1 \n"
29#elif defined(CONFIG_CPU_MIPSR2)
30 " ei \n"
31#else
32 " mfc0 $1,$12 \n"
33 " ori $1,0x1f \n"
34 " xori $1,0x1e \n"
35 " mtc0 $1,$12 \n"
36#endif
37 " irq_enable_hazard \n"
38 " .set pop \n"
39 " .endm");
40
41extern void smtc_ipi_replay(void);
42
43static inline void raw_local_irq_enable(void)
44{
45#ifdef CONFIG_MIPS_MT_SMTC
46 /*
47 * SMTC kernel needs to do a software replay of queued
48 * IPIs, at the cost of call overhead on each local_irq_enable()
49 */
50 smtc_ipi_replay();
51#endif
52 __asm__ __volatile__(
53 "raw_local_irq_enable"
54 : /* no outputs */
55 : /* no inputs */
56 : "memory");
57}
58
59
60/*
61 * For cli() we have to insert nops to make sure that the new value
62 * has actually arrived in the status register before the end of this
63 * macro.
64 * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
65 * no nops at all.
66 */
67/*
68 * For TX49, operating only IE bit is not enough.
69 *
70 * If mfc0 $12 follows store and the mfc0 is last instruction of a
71 * page and fetching the next instruction causes TLB miss, the result
72 * of the mfc0 might wrongly contain EXL bit.
73 *
74 * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
75 *
76 * Workaround: mask EXL bit of the result or place a nop before mfc0.
77 */
78__asm__(
79 " .macro raw_local_irq_disable\n"
80 " .set push \n"
81 " .set noat \n"
82#ifdef CONFIG_MIPS_MT_SMTC
83 " mfc0 $1, $2, 1 \n"
84 " ori $1, 0x400 \n"
85 " .set noreorder \n"
86 " mtc0 $1, $2, 1 \n"
87#elif defined(CONFIG_CPU_MIPSR2)
88 " di \n"
89#else
90 " mfc0 $1,$12 \n"
91 " ori $1,0x1f \n"
92 " xori $1,0x1f \n"
93 " .set noreorder \n"
94 " mtc0 $1,$12 \n"
95#endif
96 " irq_disable_hazard \n"
97 " .set pop \n"
98 " .endm \n");
99
100static inline void raw_local_irq_disable(void)
101{
102 __asm__ __volatile__(
103 "raw_local_irq_disable"
104 : /* no outputs */
105 : /* no inputs */
106 : "memory");
107}
108
109__asm__(
110 " .macro raw_local_save_flags flags \n"
111 " .set push \n"
112 " .set reorder \n"
113#ifdef CONFIG_MIPS_MT_SMTC
114 " mfc0 \\flags, $2, 1 \n"
115#else
116 " mfc0 \\flags, $12 \n"
117#endif
118 " .set pop \n"
119 " .endm \n");
120
121#define raw_local_save_flags(x) \
122__asm__ __volatile__( \
123 "raw_local_save_flags %0" \
124 : "=r" (x))
125
126__asm__(
127 " .macro raw_local_irq_save result \n"
128 " .set push \n"
129 " .set reorder \n"
130 " .set noat \n"
131#ifdef CONFIG_MIPS_MT_SMTC
132 " mfc0 \\result, $2, 1 \n"
133 " ori $1, \\result, 0x400 \n"
134 " .set noreorder \n"
135 " mtc0 $1, $2, 1 \n"
136 " andi \\result, \\result, 0x400 \n"
137#elif defined(CONFIG_CPU_MIPSR2)
138 " di \\result \n"
139 " andi \\result, 1 \n"
140#else
141 " mfc0 \\result, $12 \n"
142 " ori $1, \\result, 0x1f \n"
143 " xori $1, 0x1f \n"
144 " .set noreorder \n"
145 " mtc0 $1, $12 \n"
146#endif
147 " irq_disable_hazard \n"
148 " .set pop \n"
149 " .endm \n");
150
151#define raw_local_irq_save(x) \
152__asm__ __volatile__( \
153 "raw_local_irq_save\t%0" \
154 : "=r" (x) \
155 : /* no inputs */ \
156 : "memory")
157
158__asm__(
159 " .macro raw_local_irq_restore flags \n"
160 " .set push \n"
161 " .set noreorder \n"
162 " .set noat \n"
163#ifdef CONFIG_MIPS_MT_SMTC
164 "mfc0 $1, $2, 1 \n"
165 "andi \\flags, 0x400 \n"
166 "ori $1, 0x400 \n"
167 "xori $1, 0x400 \n"
168 "or \\flags, $1 \n"
169 "mtc0 \\flags, $2, 1 \n"
170#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
171 /*
172 * Slow, but doesn't suffer from a relativly unlikely race
173 * condition we're having since days 1.
174 */
175 " beqz \\flags, 1f \n"
176 " di \n"
177 " ei \n"
178 "1: \n"
179#elif defined(CONFIG_CPU_MIPSR2)
180 /*
181 * Fast, dangerous. Life is fun, life is good.
182 */
183 " mfc0 $1, $12 \n"
184 " ins $1, \\flags, 0, 1 \n"
185 " mtc0 $1, $12 \n"
186#else
187 " mfc0 $1, $12 \n"
188 " andi \\flags, 1 \n"
189 " ori $1, 0x1f \n"
190 " xori $1, 0x1f \n"
191 " or \\flags, $1 \n"
192 " mtc0 \\flags, $12 \n"
193#endif
194 " irq_disable_hazard \n"
195 " .set pop \n"
196 " .endm \n");
197
198
199static inline void raw_local_irq_restore(unsigned long flags)
200{
201 unsigned long __tmp1;
202
203#ifdef CONFIG_MIPS_MT_SMTC
204 /*
205 * SMTC kernel needs to do a software replay of queued
206 * IPIs, at the cost of branch and call overhead on each
207 * local_irq_restore()
208 */
209 if (unlikely(!(flags & 0x0400)))
210 smtc_ipi_replay();
211#endif
212
213 __asm__ __volatile__(
214 "raw_local_irq_restore\t%0"
215 : "=r" (__tmp1)
216 : "0" (flags)
217 : "memory");
218}
219
220static inline void __raw_local_irq_restore(unsigned long flags)
221{
222 unsigned long __tmp1;
223
224 __asm__ __volatile__(
225 "raw_local_irq_restore\t%0"
226 : "=r" (__tmp1)
227 : "0" (flags)
228 : "memory");
229}
230
231static inline int raw_irqs_disabled_flags(unsigned long flags)
232{
233#ifdef CONFIG_MIPS_MT_SMTC
234 /*
235 * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU
236 */
237 return flags & 0x400;
238#else
239 return !(flags & 1);
240#endif
241}
242
243#endif
244
245/*
246 * Do the CPU's IRQ-state tracing from assembly code.
247 */
248#ifdef CONFIG_TRACE_IRQFLAGS
249/* Reload some registers clobbered by trace_hardirqs_on */
250#ifdef CONFIG_64BIT
251# define TRACE_IRQS_RELOAD_REGS \
252 LONG_L $11, PT_R11(sp); \
253 LONG_L $10, PT_R10(sp); \
254 LONG_L $9, PT_R9(sp); \
255 LONG_L $8, PT_R8(sp); \
256 LONG_L $7, PT_R7(sp); \
257 LONG_L $6, PT_R6(sp); \
258 LONG_L $5, PT_R5(sp); \
259 LONG_L $4, PT_R4(sp); \
260 LONG_L $2, PT_R2(sp)
261#else
262# define TRACE_IRQS_RELOAD_REGS \
263 LONG_L $7, PT_R7(sp); \
264 LONG_L $6, PT_R6(sp); \
265 LONG_L $5, PT_R5(sp); \
266 LONG_L $4, PT_R4(sp); \
267 LONG_L $2, PT_R2(sp)
268#endif
269# define TRACE_IRQS_ON \
270 CLI; /* make sure trace_hardirqs_on() is called in kernel level */ \
271 jal trace_hardirqs_on
272# define TRACE_IRQS_ON_RELOAD \
273 TRACE_IRQS_ON; \
274 TRACE_IRQS_RELOAD_REGS
275# define TRACE_IRQS_OFF \
276 jal trace_hardirqs_off
277#else
278# define TRACE_IRQS_ON
279# define TRACE_IRQS_ON_RELOAD
280# define TRACE_IRQS_OFF
281#endif
282
283#endif /* _ASM_IRQFLAGS_H */
diff --git a/include/asm-mips/isadep.h b/include/asm-mips/isadep.h
deleted file mode 100644
index 24c6cda79377..000000000000
--- a/include/asm-mips/isadep.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Various ISA level dependent constants.
3 * Most of the following constants reflect the different layout
4 * of Coprocessor 0 registers.
5 *
6 * Copyright (c) 1998 Harald Koerfgen
7 */
8
9#ifndef __ASM_ISADEP_H
10#define __ASM_ISADEP_H
11
12#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
13/*
14 * R2000 or R3000
15 */
16
17/*
18 * kernel or user mode? (CP0_STATUS)
19 */
20#define KU_MASK 0x08
21#define KU_USER 0x08
22#define KU_KERN 0x00
23
24#else
25/*
26 * kernel or user mode?
27 */
28#define KU_MASK 0x18
29#define KU_USER 0x10
30#define KU_KERN 0x00
31
32#endif
33
34#endif /* __ASM_ISADEP_H */
diff --git a/include/asm-mips/jazz.h b/include/asm-mips/jazz.h
deleted file mode 100644
index 83f449dec95e..000000000000
--- a/include/asm-mips/jazz.h
+++ /dev/null
@@ -1,310 +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) 1995 - 1998 by Andreas Busse and Ralf Baechle
7 */
8#ifndef __ASM_JAZZ_H
9#define __ASM_JAZZ_H
10
11/*
12 * The addresses below are virtual address. The mappings are
13 * created on startup via wired entries in the tlb. The Mips
14 * Magnum R3000 and R4000 machines are similar in many aspects,
15 * but many hardware register are accessible at 0xb9000000 in
16 * instead of 0xe0000000.
17 */
18
19#define JAZZ_LOCAL_IO_SPACE 0xe0000000
20
21/*
22 * Revision numbers in PICA_ASIC_REVISION
23 *
24 * 0xf0000000 - Rev1
25 * 0xf0000001 - Rev2
26 * 0xf0000002 - Rev3
27 */
28#define PICA_ASIC_REVISION 0xe0000008
29
30/*
31 * The segments of the seven segment LED are mapped
32 * to the control bits as follows:
33 *
34 * (7)
35 * ---------
36 * | |
37 * (2) | | (6)
38 * | (1) |
39 * ---------
40 * | |
41 * (3) | | (5)
42 * | (4) |
43 * --------- . (0)
44 */
45#define PICA_LED 0xe000f000
46
47/*
48 * Some characters for the LED control registers
49 * The original Mips machines seem to have a LED display
50 * with integrated decoder while the Acer machines can
51 * control each of the seven segments and the dot independently.
52 * It's only a toy, anyway...
53 */
54#define LED_DOT 0x01
55#define LED_SPACE 0x00
56#define LED_0 0xfc
57#define LED_1 0x60
58#define LED_2 0xda
59#define LED_3 0xf2
60#define LED_4 0x66
61#define LED_5 0xb6
62#define LED_6 0xbe
63#define LED_7 0xe0
64#define LED_8 0xfe
65#define LED_9 0xf6
66#define LED_A 0xee
67#define LED_b 0x3e
68#define LED_C 0x9c
69#define LED_d 0x7a
70#define LED_E 0x9e
71#define LED_F 0x8e
72
73#ifndef __ASSEMBLY__
74
75static __inline__ void pica_set_led(unsigned int bits)
76{
77 volatile unsigned int *led_register = (unsigned int *) PICA_LED;
78
79 *led_register = bits;
80}
81
82#endif /* !__ASSEMBLY__ */
83
84/*
85 * Base address of the Sonic Ethernet adapter in Jazz machines.
86 */
87#define JAZZ_ETHERNET_BASE 0xe0001000
88
89/*
90 * Base address of the 53C94 SCSI hostadapter in Jazz machines.
91 */
92#define JAZZ_SCSI_BASE 0xe0002000
93
94/*
95 * i8042 keyboard controller for JAZZ and PICA chipsets.
96 * This address is just a guess and seems to differ from
97 * other mips machines such as RC3xxx...
98 */
99#define JAZZ_KEYBOARD_ADDRESS 0xe0005000
100#define JAZZ_KEYBOARD_DATA 0xe0005000
101#define JAZZ_KEYBOARD_COMMAND 0xe0005001
102
103#ifndef __ASSEMBLY__
104
105typedef struct {
106 unsigned char data;
107 unsigned char command;
108} jazz_keyboard_hardware;
109
110#define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
111
112typedef struct {
113 unsigned char pad0[3];
114 unsigned char data;
115 unsigned char pad1[3];
116 unsigned char command;
117} mips_keyboard_hardware;
118
119/*
120 * For now. Needs to be changed for RC3xxx support. See below.
121 */
122#define keyboard_hardware jazz_keyboard_hardware
123
124#endif /* !__ASSEMBLY__ */
125
126/*
127 * i8042 keyboard controller for most other Mips machines.
128 */
129#define MIPS_KEYBOARD_ADDRESS 0xb9005000
130#define MIPS_KEYBOARD_DATA 0xb9005003
131#define MIPS_KEYBOARD_COMMAND 0xb9005007
132
133/*
134 * Serial and parallel ports (WD 16C552) on the Mips JAZZ
135 */
136#define JAZZ_SERIAL1_BASE (unsigned int)0xe0006000
137#define JAZZ_SERIAL2_BASE (unsigned int)0xe0007000
138#define JAZZ_PARALLEL_BASE (unsigned int)0xe0008000
139
140/*
141 * Dummy Device Address. Used in jazzdma.c
142 */
143#define JAZZ_DUMMY_DEVICE 0xe000d000
144
145/*
146 * JAZZ timer registers and interrupt no.
147 * Note that the hardware timer interrupt is actually on
148 * cpu level 6, but to keep compatibility with PC stuff
149 * it is remapped to vector 0. See arch/mips/kernel/entry.S.
150 */
151#define JAZZ_TIMER_INTERVAL 0xe0000228
152#define JAZZ_TIMER_REGISTER 0xe0000230
153
154/*
155 * DRAM configuration register
156 */
157#ifndef __ASSEMBLY__
158#ifdef __MIPSEL__
159typedef struct {
160 unsigned int bank2 : 3;
161 unsigned int bank1 : 3;
162 unsigned int mem_bus_width : 1;
163 unsigned int reserved2 : 1;
164 unsigned int page_mode : 1;
165 unsigned int reserved1 : 23;
166} dram_configuration;
167#else /* defined (__MIPSEB__) */
168typedef struct {
169 unsigned int reserved1 : 23;
170 unsigned int page_mode : 1;
171 unsigned int reserved2 : 1;
172 unsigned int mem_bus_width : 1;
173 unsigned int bank1 : 3;
174 unsigned int bank2 : 3;
175} dram_configuration;
176#endif
177#endif /* !__ASSEMBLY__ */
178
179#define PICA_DRAM_CONFIG 0xe00fffe0
180
181/*
182 * JAZZ interrupt control registers
183 */
184#define JAZZ_IO_IRQ_SOURCE 0xe0010000
185#define JAZZ_IO_IRQ_ENABLE 0xe0010002
186
187/*
188 * JAZZ Interrupt Level definitions
189 *
190 * This is somewhat broken. For reasons which nobody can remember anymore
191 * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
192 */
193#define JAZZ_IRQ_START 24
194#define JAZZ_IRQ_END (24 + 9)
195#define JAZZ_PARALLEL_IRQ (JAZZ_IRQ_START + 0)
196#define JAZZ_FLOPPY_IRQ (JAZZ_IRQ_START + 1)
197#define JAZZ_SOUND_IRQ (JAZZ_IRQ_START + 2)
198#define JAZZ_VIDEO_IRQ (JAZZ_IRQ_START + 3)
199#define JAZZ_ETHERNET_IRQ (JAZZ_IRQ_START + 4)
200#define JAZZ_SCSI_IRQ (JAZZ_IRQ_START + 5)
201#define JAZZ_KEYBOARD_IRQ (JAZZ_IRQ_START + 6)
202#define JAZZ_MOUSE_IRQ (JAZZ_IRQ_START + 7)
203#define JAZZ_SERIAL1_IRQ (JAZZ_IRQ_START + 8)
204#define JAZZ_SERIAL2_IRQ (JAZZ_IRQ_START + 9)
205
206#define JAZZ_TIMER_IRQ (MIPS_CPU_IRQ_BASE+6)
207
208
209/*
210 * JAZZ DMA Channels
211 * Note: Channels 4...7 are not used with respect to the Acer PICA-61
212 * chipset which does not provide these DMA channels.
213 */
214#define JAZZ_SCSI_DMA 0 /* SCSI */
215#define JAZZ_FLOPPY_DMA 1 /* FLOPPY */
216#define JAZZ_AUDIOL_DMA 2 /* AUDIO L */
217#define JAZZ_AUDIOR_DMA 3 /* AUDIO R */
218
219/*
220 * JAZZ R4030 MCT_ADR chip (DMA controller)
221 * Note: Virtual Addresses !
222 */
223#define JAZZ_R4030_CONFIG 0xE0000000 /* R4030 config register */
224#define JAZZ_R4030_REVISION 0xE0000008 /* same as PICA_ASIC_REVISION */
225#define JAZZ_R4030_INV_ADDR 0xE0000010 /* Invalid Address register */
226
227#define JAZZ_R4030_TRSTBL_BASE 0xE0000018 /* Translation Table Base */
228#define JAZZ_R4030_TRSTBL_LIM 0xE0000020 /* Translation Table Limit */
229#define JAZZ_R4030_TRSTBL_INV 0xE0000028 /* Translation Table Invalidate */
230
231#define JAZZ_R4030_CACHE_MTNC 0xE0000030 /* Cache Maintenance */
232#define JAZZ_R4030_R_FAIL_ADDR 0xE0000038 /* Remote Failed Address */
233#define JAZZ_R4030_M_FAIL_ADDR 0xE0000040 /* Memory Failed Address */
234
235#define JAZZ_R4030_CACHE_PTAG 0xE0000048 /* I/O Cache Physical Tag */
236#define JAZZ_R4030_CACHE_LTAG 0xE0000050 /* I/O Cache Logical Tag */
237#define JAZZ_R4030_CACHE_BMASK 0xE0000058 /* I/O Cache Byte Mask */
238#define JAZZ_R4030_CACHE_BWIN 0xE0000060 /* I/O Cache Buffer Window */
239
240/*
241 * Remote Speed Registers.
242 *
243 * 0: free, 1: Ethernet, 2: SCSI, 3: Floppy,
244 * 4: RTC, 5: Kb./Mouse 6: serial 1, 7: serial 2,
245 * 8: parallel, 9: NVRAM, 10: CPU, 11: PROM,
246 * 12: reserved, 13: free, 14: 7seg LED, 15: ???
247 */
248#define JAZZ_R4030_REM_SPEED 0xE0000070 /* 16 Remote Speed Registers */
249 /* 0xE0000070,78,80... 0xE00000E8 */
250#define JAZZ_R4030_IRQ_ENABLE 0xE00000E8 /* Internal Interrupt Enable */
251#define JAZZ_R4030_INVAL_ADDR 0xE0000010 /* Invalid address Register */
252#define JAZZ_R4030_IRQ_SOURCE 0xE0000200 /* Interrupt Source Register */
253#define JAZZ_R4030_I386_ERROR 0xE0000208 /* i386/EISA Bus Error */
254
255/*
256 * Virtual (E)ISA controller address
257 */
258#define JAZZ_EISA_IRQ_ACK 0xE0000238 /* EISA interrupt acknowledge */
259
260/*
261 * Access the R4030 DMA and I/O Controller
262 */
263#ifndef __ASSEMBLY__
264
265static inline void r4030_delay(void)
266{
267__asm__ __volatile__(
268 ".set\tnoreorder\n\t"
269 "nop\n\t"
270 "nop\n\t"
271 "nop\n\t"
272 "nop\n\t"
273 ".set\treorder");
274}
275
276static inline unsigned short r4030_read_reg16(unsigned long addr)
277{
278 unsigned short ret = *((volatile unsigned short *)addr);
279 r4030_delay();
280 return ret;
281}
282
283static inline unsigned int r4030_read_reg32(unsigned long addr)
284{
285 unsigned int ret = *((volatile unsigned int *)addr);
286 r4030_delay();
287 return ret;
288}
289
290static inline void r4030_write_reg16(unsigned long addr, unsigned val)
291{
292 *((volatile unsigned short *)addr) = val;
293 r4030_delay();
294}
295
296static inline void r4030_write_reg32(unsigned long addr, unsigned val)
297{
298 *((volatile unsigned int *)addr) = val;
299 r4030_delay();
300}
301
302#endif /* !__ASSEMBLY__ */
303
304#define JAZZ_FDC_BASE 0xe0003000
305#define JAZZ_RTC_BASE 0xe0004000
306#define JAZZ_PORT_BASE 0xe2000000
307
308#define JAZZ_EISA_BASE 0xe3000000
309
310#endif /* __ASM_JAZZ_H */
diff --git a/include/asm-mips/jazzdma.h b/include/asm-mips/jazzdma.h
deleted file mode 100644
index 8bb37bba68f0..000000000000
--- a/include/asm-mips/jazzdma.h
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * Helpfile for jazzdma.c -- Mips Jazz R4030 DMA controller support
3 */
4#ifndef _ASM_JAZZDMA_H
5#define _ASM_JAZZDMA_H
6
7/*
8 * Prototypes and macros
9 */
10extern unsigned long vdma_alloc(unsigned long paddr, unsigned long size);
11extern int vdma_free(unsigned long laddr);
12extern int vdma_remap(unsigned long laddr, unsigned long paddr,
13 unsigned long size);
14extern unsigned long vdma_phys2log(unsigned long paddr);
15extern unsigned long vdma_log2phys(unsigned long laddr);
16extern void vdma_stats(void); /* for debugging only */
17
18extern void vdma_enable(int channel);
19extern void vdma_disable(int channel);
20extern void vdma_set_mode(int channel, int mode);
21extern void vdma_set_addr(int channel, long addr);
22extern void vdma_set_count(int channel, int count);
23extern int vdma_get_residue(int channel);
24extern int vdma_get_enable(int channel);
25
26/*
27 * some definitions used by the driver functions
28 */
29#define VDMA_PAGESIZE 4096
30#define VDMA_PGTBL_ENTRIES 4096
31#define VDMA_PGTBL_SIZE (sizeof(VDMA_PGTBL_ENTRY) * VDMA_PGTBL_ENTRIES)
32#define VDMA_PAGE_EMPTY 0xff000000
33
34/*
35 * Macros to get page no. and offset of a given address
36 * Note that VDMA_PAGE() works for physical addresses only
37 */
38#define VDMA_PAGE(a) ((unsigned int)(a) >> 12)
39#define VDMA_OFFSET(a) ((unsigned int)(a) & (VDMA_PAGESIZE-1))
40
41/*
42 * error code returned by vdma_alloc()
43 * (See also arch/mips/kernel/jazzdma.c)
44 */
45#define VDMA_ERROR 0xffffffff
46
47/*
48 * VDMA pagetable entry description
49 */
50typedef volatile struct VDMA_PGTBL_ENTRY {
51 unsigned int frame; /* physical frame no. */
52 unsigned int owner; /* owner of this entry (0=free) */
53} VDMA_PGTBL_ENTRY;
54
55
56/*
57 * DMA channel control registers
58 * in the R4030 MCT_ADR chip
59 */
60#define JAZZ_R4030_CHNL_MODE 0xE0000100 /* 8 DMA Channel Mode Registers, */
61 /* 0xE0000100,120,140... */
62#define JAZZ_R4030_CHNL_ENABLE 0xE0000108 /* 8 DMA Channel Enable Regs, */
63 /* 0xE0000108,128,148... */
64#define JAZZ_R4030_CHNL_COUNT 0xE0000110 /* 8 DMA Channel Byte Cnt Regs, */
65 /* 0xE0000110,130,150... */
66#define JAZZ_R4030_CHNL_ADDR 0xE0000118 /* 8 DMA Channel Address Regs, */
67 /* 0xE0000118,138,158... */
68
69/* channel enable register bits */
70
71#define R4030_CHNL_ENABLE (1<<0)
72#define R4030_CHNL_WRITE (1<<1)
73#define R4030_TC_INTR (1<<8)
74#define R4030_MEM_INTR (1<<9)
75#define R4030_ADDR_INTR (1<<10)
76
77/*
78 * Channel mode register bits
79 */
80#define R4030_MODE_ATIME_40 (0) /* device access time on remote bus */
81#define R4030_MODE_ATIME_80 (1)
82#define R4030_MODE_ATIME_120 (2)
83#define R4030_MODE_ATIME_160 (3)
84#define R4030_MODE_ATIME_200 (4)
85#define R4030_MODE_ATIME_240 (5)
86#define R4030_MODE_ATIME_280 (6)
87#define R4030_MODE_ATIME_320 (7)
88#define R4030_MODE_WIDTH_8 (1<<3) /* device data bus width */
89#define R4030_MODE_WIDTH_16 (2<<3)
90#define R4030_MODE_WIDTH_32 (3<<3)
91#define R4030_MODE_INTR_EN (1<<5)
92#define R4030_MODE_BURST (1<<6) /* Rev. 2 only */
93#define R4030_MODE_FAST_ACK (1<<7) /* Rev. 2 only */
94
95#endif /* _ASM_JAZZDMA_H */
diff --git a/include/asm-mips/kdebug.h b/include/asm-mips/kdebug.h
deleted file mode 100644
index 5bf62aafc890..000000000000
--- a/include/asm-mips/kdebug.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_MIPS_KDEBUG_H
2#define _ASM_MIPS_KDEBUG_H
3
4#include <linux/notifier.h>
5
6enum die_val {
7 DIE_OOPS = 1,
8 DIE_FP,
9 DIE_TRAP,
10 DIE_RI,
11};
12
13#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/include/asm-mips/kexec.h b/include/asm-mips/kexec.h
deleted file mode 100644
index 4314892aaebb..000000000000
--- a/include/asm-mips/kexec.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * kexec.h for kexec
3 * Created by <nschichan@corp.free.fr> on Thu Oct 12 14:59:34 2006
4 *
5 * This source code is licensed under the GNU General Public License,
6 * Version 2. See the file COPYING for more details.
7 */
8
9#ifndef _MIPS_KEXEC
10# define _MIPS_KEXEC
11
12/* Maximum physical address we can use pages from */
13#define KEXEC_SOURCE_MEMORY_LIMIT (0x20000000)
14/* Maximum address we can reach in physical address mode */
15#define KEXEC_DESTINATION_MEMORY_LIMIT (0x20000000)
16 /* Maximum address we can use for the control code buffer */
17#define KEXEC_CONTROL_MEMORY_LIMIT (0x20000000)
18
19#define KEXEC_CONTROL_PAGE_SIZE 4096
20
21/* The native architecture */
22#define KEXEC_ARCH KEXEC_ARCH_MIPS
23
24static inline void crash_setup_regs(struct pt_regs *newregs,
25 struct pt_regs *oldregs)
26{
27 /* Dummy implementation for now */
28}
29
30#endif /* !_MIPS_KEXEC */
diff --git a/include/asm-mips/kgdb.h b/include/asm-mips/kgdb.h
deleted file mode 100644
index 48223b09396c..000000000000
--- a/include/asm-mips/kgdb.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __ASM_KGDB_H_
2#define __ASM_KGDB_H_
3
4#ifdef __KERNEL__
5
6#include <asm/sgidefs.h>
7
8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
9 (_MIPS_ISA == _MIPS_ISA_MIPS32)
10
11#define KGDB_GDB_REG_SIZE 32
12
13#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
14 (_MIPS_ISA == _MIPS_ISA_MIPS64)
15
16#ifdef CONFIG_32BIT
17#define KGDB_GDB_REG_SIZE 32
18#else /* CONFIG_CPU_32BIT */
19#define KGDB_GDB_REG_SIZE 64
20#endif
21#else
22#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
23#endif /* _MIPS_ISA */
24
25#define BUFMAX 2048
26#if (KGDB_GDB_REG_SIZE == 32)
27#define NUMREGBYTES (90*sizeof(u32))
28#define NUMCRITREGBYTES (12*sizeof(u32))
29#else
30#define NUMREGBYTES (90*sizeof(u64))
31#define NUMCRITREGBYTES (12*sizeof(u64))
32#endif
33#define BREAK_INSTR_SIZE 4
34#define CACHE_FLUSH_IS_SAFE 0
35
36extern void arch_kgdb_breakpoint(void);
37extern int kgdb_early_setup;
38extern void *saved_vectors[32];
39extern void handle_exception(struct pt_regs *regs);
40extern void breakinst(void);
41
42#endif /* __KERNEL__ */
43
44#endif /* __ASM_KGDB_H_ */
diff --git a/include/asm-mips/kmap_types.h b/include/asm-mips/kmap_types.h
deleted file mode 100644
index 806aae3c5338..000000000000
--- a/include/asm-mips/kmap_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H
3
4
5#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n ,
7#else
8# define D(n)
9#endif
10
11enum km_type {
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27
28#undef D
29
30#endif
diff --git a/include/asm-mips/kspd.h b/include/asm-mips/kspd.h
deleted file mode 100644
index 4e9e724c8935..000000000000
--- a/include/asm-mips/kspd.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_KSPD_H
20#define _ASM_KSPD_H
21
22struct kspd_notifications {
23 void (*kspd_sp_exit)(int sp_id);
24
25 struct list_head list;
26};
27
28#ifdef CONFIG_MIPS_APSP_KSPD
29extern void kspd_notify(struct kspd_notifications *notify);
30#else
31static inline void kspd_notify(struct kspd_notifications *notify)
32{
33}
34#endif
35
36#endif
diff --git a/include/asm-mips/lasat/ds1603.h b/include/asm-mips/lasat/ds1603.h
deleted file mode 100644
index edcd7544b358..000000000000
--- a/include/asm-mips/lasat/ds1603.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#include <asm/addrspace.h>
2
3/* Lasat 100 */
4#define DS1603_REG_100 (KSEG1ADDR(0x1c810000))
5#define DS1603_RST_100 (1 << 2)
6#define DS1603_CLK_100 (1 << 0)
7#define DS1603_DATA_SHIFT_100 1
8#define DS1603_DATA_100 (1 << DS1603_DATA_SHIFT_100)
9
10/* Lasat 200 */
11#define DS1603_REG_200 (KSEG1ADDR(0x11000000))
12#define DS1603_RST_200 (1 << 3)
13#define DS1603_CLK_200 (1 << 4)
14#define DS1603_DATA_200 (1 << 5)
15
16#define DS1603_DATA_REG_200 (DS1603_REG_200 + 0x10000)
17#define DS1603_DATA_READ_SHIFT_200 9
18#define DS1603_DATA_READ_200 (1 << DS1603_DATA_READ_SHIFT_200)
diff --git a/include/asm-mips/lasat/eeprom.h b/include/asm-mips/lasat/eeprom.h
deleted file mode 100644
index 3dac203697fa..000000000000
--- a/include/asm-mips/lasat/eeprom.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#include <asm/addrspace.h>
2
3/* lasat 100 */
4#define AT93C_REG_100 KSEG1ADDR(0x1c810000)
5#define AT93C_RDATA_REG_100 AT93C_REG_100
6#define AT93C_RDATA_SHIFT_100 4
7#define AT93C_WDATA_SHIFT_100 4
8#define AT93C_CS_M_100 (1 << 5)
9#define AT93C_CLK_M_100 (1 << 3)
10
11/* lasat 200 */
12#define AT93C_REG_200 KSEG1ADDR(0x11000000)
13#define AT93C_RDATA_REG_200 (AT93C_REG_200+0x10000)
14#define AT93C_RDATA_SHIFT_200 8
15#define AT93C_WDATA_SHIFT_200 2
16#define AT93C_CS_M_200 (1 << 0)
17#define AT93C_CLK_M_200 (1 << 1)
diff --git a/include/asm-mips/lasat/head.h b/include/asm-mips/lasat/head.h
deleted file mode 100644
index f5589f31a197..000000000000
--- a/include/asm-mips/lasat/head.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Image header stuff
3 */
4#ifndef _HEAD_H
5#define _HEAD_H
6
7#define LASAT_K_MAGIC0_VAL 0xfedeabba
8#define LASAT_K_MAGIC1_VAL 0x00bedead
9
10#ifndef _LANGUAGE_ASSEMBLY
11#include <linux/types.h>
12struct bootloader_header {
13 u32 magic[2];
14 u32 version;
15 u32 image_start;
16 u32 image_size;
17 u32 kernel_start;
18 u32 kernel_entry;
19};
20#endif
21
22#endif /* _HEAD_H */
diff --git a/include/asm-mips/lasat/lasat.h b/include/asm-mips/lasat/lasat.h
deleted file mode 100644
index caeba1e302a2..000000000000
--- a/include/asm-mips/lasat/lasat.h
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * lasat.h
3 *
4 * Thomas Horsten <thh@lasat.com>
5 * Copyright (C) 2000 LASAT Networks A/S.
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * Configuration for LASAT boards, loads the appropriate include files.
21 */
22#ifndef _LASAT_H
23#define _LASAT_H
24
25#ifndef _LANGUAGE_ASSEMBLY
26
27extern struct lasat_misc {
28 volatile u32 *reset_reg;
29 volatile u32 *flash_wp_reg;
30 u32 flash_wp_bit;
31} *lasat_misc;
32
33enum lasat_mtdparts {
34 LASAT_MTD_BOOTLOADER,
35 LASAT_MTD_SERVICE,
36 LASAT_MTD_NORMAL,
37 LASAT_MTD_CONFIG,
38 LASAT_MTD_FS,
39 LASAT_MTD_LAST
40};
41
42/*
43 * The format of the data record in the EEPROM.
44 * See Documentation/LASAT/eeprom.txt for a detailed description
45 * of the fields in this struct, and the LASAT Hardware Configuration
46 * field specification for a detailed description of the config
47 * field.
48 */
49#include <linux/types.h>
50
51#define LASAT_EEPROM_VERSION 7
52struct lasat_eeprom_struct {
53 unsigned int version;
54 unsigned int cfg[3];
55 unsigned char hwaddr[6];
56 unsigned char print_partno[12];
57 unsigned char term0;
58 unsigned char print_serial[14];
59 unsigned char term1;
60 unsigned char prod_partno[12];
61 unsigned char term2;
62 unsigned char prod_serial[14];
63 unsigned char term3;
64 unsigned char passwd_hash[16];
65 unsigned char pwdnull;
66 unsigned char vendid;
67 unsigned char ts_ref;
68 unsigned char ts_signoff;
69 unsigned char reserved[11];
70 unsigned char debugaccess;
71 unsigned short prid;
72 unsigned int serviceflag;
73 unsigned int ipaddr;
74 unsigned int netmask;
75 unsigned int crc32;
76};
77
78struct lasat_eeprom_struct_pre7 {
79 unsigned int version;
80 unsigned int flags[3];
81 unsigned char hwaddr0[6];
82 unsigned char hwaddr1[6];
83 unsigned char print_partno[9];
84 unsigned char term0;
85 unsigned char print_serial[14];
86 unsigned char term1;
87 unsigned char prod_partno[9];
88 unsigned char term2;
89 unsigned char prod_serial[14];
90 unsigned char term3;
91 unsigned char passwd_hash[24];
92 unsigned char pwdnull;
93 unsigned char vendor;
94 unsigned char ts_ref;
95 unsigned char ts_signoff;
96 unsigned char reserved[6];
97 unsigned int writecount;
98 unsigned int ipaddr;
99 unsigned int netmask;
100 unsigned int crc32;
101};
102
103/* Configuration descriptor encoding - see the doc for details */
104
105#define LASAT_W0_DSCTYPE(v) (((v)) & 0xf)
106#define LASAT_W0_BMID(v) (((v) >> 0x04) & 0xf)
107#define LASAT_W0_CPUTYPE(v) (((v) >> 0x08) & 0xf)
108#define LASAT_W0_BUSSPEED(v) (((v) >> 0x0c) & 0xf)
109#define LASAT_W0_CPUCLK(v) (((v) >> 0x10) & 0xf)
110#define LASAT_W0_SDRAMBANKSZ(v) (((v) >> 0x14) & 0xf)
111#define LASAT_W0_SDRAMBANKS(v) (((v) >> 0x18) & 0xf)
112#define LASAT_W0_L2CACHE(v) (((v) >> 0x1c) & 0xf)
113
114#define LASAT_W1_EDHAC(v) (((v)) & 0xf)
115#define LASAT_W1_HIFN(v) (((v) >> 0x04) & 0x1)
116#define LASAT_W1_ISDN(v) (((v) >> 0x05) & 0x1)
117#define LASAT_W1_IDE(v) (((v) >> 0x06) & 0x1)
118#define LASAT_W1_HDLC(v) (((v) >> 0x07) & 0x1)
119#define LASAT_W1_USVERSION(v) (((v) >> 0x08) & 0x1)
120#define LASAT_W1_4MACS(v) (((v) >> 0x09) & 0x1)
121#define LASAT_W1_EXTSERIAL(v) (((v) >> 0x0a) & 0x1)
122#define LASAT_W1_FLASHSIZE(v) (((v) >> 0x0c) & 0xf)
123#define LASAT_W1_PCISLOTS(v) (((v) >> 0x10) & 0xf)
124#define LASAT_W1_PCI1OPT(v) (((v) >> 0x14) & 0xf)
125#define LASAT_W1_PCI2OPT(v) (((v) >> 0x18) & 0xf)
126#define LASAT_W1_PCI3OPT(v) (((v) >> 0x1c) & 0xf)
127
128/* Routines specific to LASAT boards */
129
130#define LASAT_BMID_MASQUERADE2 0
131#define LASAT_BMID_MASQUERADEPRO 1
132#define LASAT_BMID_SAFEPIPE25 2
133#define LASAT_BMID_SAFEPIPE50 3
134#define LASAT_BMID_SAFEPIPE100 4
135#define LASAT_BMID_SAFEPIPE5000 5
136#define LASAT_BMID_SAFEPIPE7000 6
137#define LASAT_BMID_SAFEPIPE1000 7
138#if 0
139#define LASAT_BMID_SAFEPIPE30 7
140#define LASAT_BMID_SAFEPIPE5100 8
141#define LASAT_BMID_SAFEPIPE7100 9
142#endif
143#define LASAT_BMID_UNKNOWN 0xf
144#define LASAT_MAX_BMID_NAMES 9 /* no larger than 15! */
145
146#define LASAT_HAS_EDHAC (1 << 0)
147#define LASAT_EDHAC_FAST (1 << 1)
148#define LASAT_HAS_EADI (1 << 2)
149#define LASAT_HAS_HIFN (1 << 3)
150#define LASAT_HAS_ISDN (1 << 4)
151#define LASAT_HAS_LEASEDLINE_IF (1 << 5)
152#define LASAT_HAS_HDC (1 << 6)
153
154#define LASAT_PRID_MASQUERADE2 0
155#define LASAT_PRID_MASQUERADEPRO 1
156#define LASAT_PRID_SAFEPIPE25 2
157#define LASAT_PRID_SAFEPIPE50 3
158#define LASAT_PRID_SAFEPIPE100 4
159#define LASAT_PRID_SAFEPIPE5000 5
160#define LASAT_PRID_SAFEPIPE7000 6
161#define LASAT_PRID_SAFEPIPE30 7
162#define LASAT_PRID_SAFEPIPE5100 8
163#define LASAT_PRID_SAFEPIPE7100 9
164
165#define LASAT_PRID_SAFEPIPE1110 10
166#define LASAT_PRID_SAFEPIPE3020 11
167#define LASAT_PRID_SAFEPIPE3030 12
168#define LASAT_PRID_SAFEPIPE5020 13
169#define LASAT_PRID_SAFEPIPE5030 14
170#define LASAT_PRID_SAFEPIPE1120 15
171#define LASAT_PRID_SAFEPIPE1130 16
172#define LASAT_PRID_SAFEPIPE6010 17
173#define LASAT_PRID_SAFEPIPE6110 18
174#define LASAT_PRID_SAFEPIPE6210 19
175#define LASAT_PRID_SAFEPIPE1020 20
176#define LASAT_PRID_SAFEPIPE1040 21
177#define LASAT_PRID_SAFEPIPE1060 22
178
179struct lasat_info {
180 unsigned int li_cpu_hz;
181 unsigned int li_bus_hz;
182 unsigned int li_bmid;
183 unsigned int li_memsize;
184 unsigned int li_flash_size;
185 unsigned int li_prid;
186 unsigned char li_bmstr[16];
187 unsigned char li_namestr[32];
188 unsigned char li_typestr[16];
189 /* Info on the Flash layout */
190 unsigned int li_flash_base;
191 unsigned long li_flashpart_base[LASAT_MTD_LAST];
192 unsigned long li_flashpart_size[LASAT_MTD_LAST];
193 struct lasat_eeprom_struct li_eeprom_info;
194 unsigned int li_eeprom_upgrade_version;
195 unsigned int li_debugaccess;
196};
197
198extern struct lasat_info lasat_board_info;
199
200static inline unsigned long lasat_flash_partition_start(int partno)
201{
202 if (partno < 0 || partno >= LASAT_MTD_LAST)
203 return 0;
204
205 return lasat_board_info.li_flashpart_base[partno];
206}
207
208static inline unsigned long lasat_flash_partition_size(int partno)
209{
210 if (partno < 0 || partno >= LASAT_MTD_LAST)
211 return 0;
212
213 return lasat_board_info.li_flashpart_size[partno];
214}
215
216/* Called from setup() to initialize the global board_info struct */
217extern int lasat_init_board_info(void);
218
219/* Write the modified EEPROM info struct */
220extern void lasat_write_eeprom_info(void);
221
222#define N_MACHTYPES 2
223/* for calibration of delays */
224
225/* the lasat_ndelay function is necessary because it is used at an
226 * early stage of the boot process where ndelay is not calibrated.
227 * It is used for the bit-banging rtc and eeprom drivers */
228
229#include <linux/delay.h>
230
231/* calculating with the slowest board with 100 MHz clock */
232#define LASAT_100_DIVIDER 20
233/* All 200's run at 250 MHz clock */
234#define LASAT_200_DIVIDER 8
235
236extern unsigned int lasat_ndelay_divider;
237
238static inline void lasat_ndelay(unsigned int ns)
239{
240 __delay(ns / lasat_ndelay_divider);
241}
242
243#define IS_LASAT_200() (current_cpu_data.cputype == CPU_R5000)
244
245#endif /* !defined (_LANGUAGE_ASSEMBLY) */
246
247#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef
248#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba
249
250/* Lasat 100 boards */
251#define LASAT_GT_BASE (KSEG1ADDR(0x14000000))
252
253/* Lasat 200 boards */
254#define Vrc5074_PHYS_BASE 0x1fa00000
255#define Vrc5074_BASE (KSEG1ADDR(Vrc5074_PHYS_BASE))
256#define PCI_WINDOW1 0x1a000000
257
258#endif /* _LASAT_H */
diff --git a/include/asm-mips/lasat/lasatint.h b/include/asm-mips/lasat/lasatint.h
deleted file mode 100644
index e0d2458b43d0..000000000000
--- a/include/asm-mips/lasat/lasatint.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __ASM_LASAT_LASATINT_H
2#define __ASM_LASAT_LASATINT_H
3
4/* lasat 100 */
5#define LASAT_INT_STATUS_REG_100 (KSEG1ADDR(0x1c880000))
6#define LASAT_INT_MASK_REG_100 (KSEG1ADDR(0x1c890000))
7#define LASATINT_MASK_SHIFT_100 0
8
9/* lasat 200 */
10#define LASAT_INT_STATUS_REG_200 (KSEG1ADDR(0x1104003c))
11#define LASAT_INT_MASK_REG_200 (KSEG1ADDR(0x1104003c))
12#define LASATINT_MASK_SHIFT_200 16
13
14#endif /* __ASM_LASAT_LASATINT_H */
diff --git a/include/asm-mips/lasat/picvue.h b/include/asm-mips/lasat/picvue.h
deleted file mode 100644
index 42a492edc40e..000000000000
--- a/include/asm-mips/lasat/picvue.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/* Lasat 100 */
2#define PVC_REG_100 KSEG1ADDR(0x1c820000)
3#define PVC_DATA_SHIFT_100 0
4#define PVC_DATA_M_100 0xFF
5#define PVC_E_100 (1 << 8)
6#define PVC_RW_100 (1 << 9)
7#define PVC_RS_100 (1 << 10)
8
9/* Lasat 200 */
10#define PVC_REG_200 KSEG1ADDR(0x11000000)
11#define PVC_DATA_SHIFT_200 24
12#define PVC_DATA_M_200 (0xFF << PVC_DATA_SHIFT_200)
13#define PVC_E_200 (1 << 16)
14#define PVC_RW_200 (1 << 17)
15#define PVC_RS_200 (1 << 18)
diff --git a/include/asm-mips/lasat/serial.h b/include/asm-mips/lasat/serial.h
deleted file mode 100644
index 1c37d70579b8..000000000000
--- a/include/asm-mips/lasat/serial.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#include <asm/lasat/lasat.h>
2
3/* Lasat 100 boards serial configuration */
4#define LASAT_BASE_BAUD_100 (7372800 / 16)
5#define LASAT_UART_REGS_BASE_100 0x1c8b0000
6#define LASAT_UART_REGS_SHIFT_100 2
7#define LASATINT_UART_100 16
8
9/* * LASAT 200 boards serial configuration */
10#define LASAT_BASE_BAUD_200 (100000000 / 16 / 12)
11#define LASAT_UART_REGS_BASE_200 (Vrc5074_PHYS_BASE + 0x0300)
12#define LASAT_UART_REGS_SHIFT_200 3
13#define LASATINT_UART_200 21
diff --git a/include/asm-mips/linkage.h b/include/asm-mips/linkage.h
deleted file mode 100644
index e9a940d1b0c6..000000000000
--- a/include/asm-mips/linkage.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#ifdef __ASSEMBLY__
5#include <asm/asm.h>
6#endif
7
8#define __weak __attribute__((weak))
9
10#endif
diff --git a/include/asm-mips/local.h b/include/asm-mips/local.h
deleted file mode 100644
index f96fd59e0845..000000000000
--- a/include/asm-mips/local.h
+++ /dev/null
@@ -1,221 +0,0 @@
1#ifndef _ARCH_MIPS_LOCAL_H
2#define _ARCH_MIPS_LOCAL_H
3
4#include <linux/percpu.h>
5#include <linux/bitops.h>
6#include <asm/atomic.h>
7#include <asm/cmpxchg.h>
8#include <asm/war.h>
9
10typedef struct
11{
12 atomic_long_t a;
13} local_t;
14
15#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
16
17#define local_read(l) atomic_long_read(&(l)->a)
18#define local_set(l, i) atomic_long_set(&(l)->a, (i))
19
20#define local_add(i, l) atomic_long_add((i), (&(l)->a))
21#define local_sub(i, l) atomic_long_sub((i), (&(l)->a))
22#define local_inc(l) atomic_long_inc(&(l)->a)
23#define local_dec(l) atomic_long_dec(&(l)->a)
24
25/*
26 * Same as above, but return the result value
27 */
28static __inline__ long local_add_return(long i, local_t * l)
29{
30 unsigned long result;
31
32 if (cpu_has_llsc && R10000_LLSC_WAR) {
33 unsigned long temp;
34
35 __asm__ __volatile__(
36 " .set mips3 \n"
37 "1:" __LL "%1, %2 # local_add_return \n"
38 " addu %0, %1, %3 \n"
39 __SC "%0, %2 \n"
40 " beqzl %0, 1b \n"
41 " addu %0, %1, %3 \n"
42 " .set mips0 \n"
43 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
44 : "Ir" (i), "m" (l->a.counter)
45 : "memory");
46 } else if (cpu_has_llsc) {
47 unsigned long temp;
48
49 __asm__ __volatile__(
50 " .set mips3 \n"
51 "1:" __LL "%1, %2 # local_add_return \n"
52 " addu %0, %1, %3 \n"
53 __SC "%0, %2 \n"
54 " beqz %0, 1b \n"
55 " addu %0, %1, %3 \n"
56 " .set mips0 \n"
57 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
58 : "Ir" (i), "m" (l->a.counter)
59 : "memory");
60 } else {
61 unsigned long flags;
62
63 local_irq_save(flags);
64 result = l->a.counter;
65 result += i;
66 l->a.counter = result;
67 local_irq_restore(flags);
68 }
69
70 return result;
71}
72
73static __inline__ long local_sub_return(long i, local_t * l)
74{
75 unsigned long result;
76
77 if (cpu_has_llsc && R10000_LLSC_WAR) {
78 unsigned long temp;
79
80 __asm__ __volatile__(
81 " .set mips3 \n"
82 "1:" __LL "%1, %2 # local_sub_return \n"
83 " subu %0, %1, %3 \n"
84 __SC "%0, %2 \n"
85 " beqzl %0, 1b \n"
86 " subu %0, %1, %3 \n"
87 " .set mips0 \n"
88 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
89 : "Ir" (i), "m" (l->a.counter)
90 : "memory");
91 } else if (cpu_has_llsc) {
92 unsigned long temp;
93
94 __asm__ __volatile__(
95 " .set mips3 \n"
96 "1:" __LL "%1, %2 # local_sub_return \n"
97 " subu %0, %1, %3 \n"
98 __SC "%0, %2 \n"
99 " beqz %0, 1b \n"
100 " subu %0, %1, %3 \n"
101 " .set mips0 \n"
102 : "=&r" (result), "=&r" (temp), "=m" (l->a.counter)
103 : "Ir" (i), "m" (l->a.counter)
104 : "memory");
105 } else {
106 unsigned long flags;
107
108 local_irq_save(flags);
109 result = l->a.counter;
110 result -= i;
111 l->a.counter = result;
112 local_irq_restore(flags);
113 }
114
115 return result;
116}
117
118#define local_cmpxchg(l, o, n) \
119 ((long)cmpxchg_local(&((l)->a.counter), (o), (n)))
120#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n)))
121
122/**
123 * local_add_unless - add unless the number is a given value
124 * @l: pointer of type local_t
125 * @a: the amount to add to l...
126 * @u: ...unless l is equal to u.
127 *
128 * Atomically adds @a to @l, so long as it was not @u.
129 * Returns non-zero if @l was not @u, and zero otherwise.
130 */
131#define local_add_unless(l, a, u) \
132({ \
133 long c, old; \
134 c = local_read(l); \
135 while (c != (u) && (old = local_cmpxchg((l), c, c + (a))) != c) \
136 c = old; \
137 c != (u); \
138})
139#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
140
141#define local_dec_return(l) local_sub_return(1, (l))
142#define local_inc_return(l) local_add_return(1, (l))
143
144/*
145 * local_sub_and_test - subtract value from variable and test result
146 * @i: integer value to subtract
147 * @l: pointer of type local_t
148 *
149 * Atomically subtracts @i from @l and returns
150 * true if the result is zero, or false for all
151 * other cases.
152 */
153#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0)
154
155/*
156 * local_inc_and_test - increment and test
157 * @l: pointer of type local_t
158 *
159 * Atomically increments @l by 1
160 * and returns true if the result is zero, or false for all
161 * other cases.
162 */
163#define local_inc_and_test(l) (local_inc_return(l) == 0)
164
165/*
166 * local_dec_and_test - decrement by 1 and test
167 * @l: pointer of type local_t
168 *
169 * Atomically decrements @l by 1 and
170 * returns true if the result is 0, or false for all other
171 * cases.
172 */
173#define local_dec_and_test(l) (local_sub_return(1, (l)) == 0)
174
175/*
176 * local_add_negative - add and test if negative
177 * @l: pointer of type local_t
178 * @i: integer value to add
179 *
180 * Atomically adds @i to @l and returns true
181 * if the result is negative, or false when
182 * result is greater than or equal to zero.
183 */
184#define local_add_negative(i, l) (local_add_return(i, (l)) < 0)
185
186/* Use these for per-cpu local_t variables: on some archs they are
187 * much more efficient than these naive implementations. Note they take
188 * a variable, not an address.
189 */
190
191#define __local_inc(l) ((l)->a.counter++)
192#define __local_dec(l) ((l)->a.counter++)
193#define __local_add(i, l) ((l)->a.counter+=(i))
194#define __local_sub(i, l) ((l)->a.counter-=(i))
195
196/* Need to disable preemption for the cpu local counters otherwise we could
197 still access a variable of a previous CPU in a non atomic way. */
198#define cpu_local_wrap_v(l) \
199 ({ local_t res__; \
200 preempt_disable(); \
201 res__ = (l); \
202 preempt_enable(); \
203 res__; })
204#define cpu_local_wrap(l) \
205 ({ preempt_disable(); \
206 l; \
207 preempt_enable(); }) \
208
209#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
210#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
211#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var(l)))
212#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var(l)))
213#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var(l)))
214#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var(l)))
215
216#define __cpu_local_inc(l) cpu_local_inc(l)
217#define __cpu_local_dec(l) cpu_local_dec(l)
218#define __cpu_local_add(i, l) cpu_local_add((i), (l))
219#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
220
221#endif /* _ARCH_MIPS_LOCAL_H */
diff --git a/include/asm-mips/m48t35.h b/include/asm-mips/m48t35.h
deleted file mode 100644
index f44852e9a96d..000000000000
--- a/include/asm-mips/m48t35.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
3 */
4#ifndef _ASM_M48T35_H
5#define _ASM_M48T35_H
6
7#include <linux/spinlock.h>
8
9extern spinlock_t rtc_lock;
10
11struct m48t35_rtc {
12 volatile u8 pad[0x7ff8]; /* starts at 0x7ff8 */
13 volatile u8 control;
14 volatile u8 sec;
15 volatile u8 min;
16 volatile u8 hour;
17 volatile u8 day;
18 volatile u8 date;
19 volatile u8 month;
20 volatile u8 year;
21};
22
23#define M48T35_RTC_SET 0x80
24#define M48T35_RTC_STOPPED 0x80
25#define M48T35_RTC_READ 0x40
26
27#endif /* _ASM_M48T35_H */
diff --git a/include/asm-mips/m48t37.h b/include/asm-mips/m48t37.h
deleted file mode 100644
index cabf86264f36..000000000000
--- a/include/asm-mips/m48t37.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Registers for the SGS-Thomson M48T37 Timekeeper RAM chip
3 */
4#ifndef _ASM_M48T37_H
5#define _ASM_M48T37_H
6
7#include <linux/spinlock.h>
8
9extern spinlock_t rtc_lock;
10
11struct m48t37_rtc {
12 volatile u8 pad[0x7ff0]; /* NVRAM */
13 volatile u8 flags;
14 volatile u8 century;
15 volatile u8 alarm_sec;
16 volatile u8 alarm_min;
17 volatile u8 alarm_hour;
18 volatile u8 alarm_data;
19 volatile u8 interrupts;
20 volatile u8 watchdog;
21 volatile u8 control;
22 volatile u8 sec;
23 volatile u8 min;
24 volatile u8 hour;
25 volatile u8 day;
26 volatile u8 date;
27 volatile u8 month;
28 volatile u8 year;
29};
30
31#define M48T37_RTC_SET 0x80
32#define M48T37_RTC_STOPPED 0x80
33#define M48T37_RTC_READ 0x40
34
35#endif /* _ASM_M48T37_H */
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
deleted file mode 100644
index 0d302bad4492..000000000000
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ /dev/null
@@ -1,1772 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
5 *
6 * Copyright 2000-2001, 2006-2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30 /*
31 * some definitions add by takuzo@sm.sony.co.jp and sato@sm.sony.co.jp
32 */
33
34#ifndef _AU1000_H_
35#define _AU1000_H_
36
37
38#ifndef _LANGUAGE_ASSEMBLY
39
40#include <linux/delay.h>
41#include <linux/types.h>
42
43#include <linux/io.h>
44#include <linux/irq.h>
45
46/* cpu pipeline flush */
47void static inline au_sync(void)
48{
49 __asm__ volatile ("sync");
50}
51
52void static inline au_sync_udelay(int us)
53{
54 __asm__ volatile ("sync");
55 udelay(us);
56}
57
58void static inline au_sync_delay(int ms)
59{
60 __asm__ volatile ("sync");
61 mdelay(ms);
62}
63
64void static inline au_writeb(u8 val, unsigned long reg)
65{
66 *(volatile u8 *)reg = val;
67}
68
69void static inline au_writew(u16 val, unsigned long reg)
70{
71 *(volatile u16 *)reg = val;
72}
73
74void static inline au_writel(u32 val, unsigned long reg)
75{
76 *(volatile u32 *)reg = val;
77}
78
79static inline u8 au_readb(unsigned long reg)
80{
81 return *(volatile u8 *)reg;
82}
83
84static inline u16 au_readw(unsigned long reg)
85{
86 return *(volatile u16 *)reg;
87}
88
89static inline u32 au_readl(unsigned long reg)
90{
91 return *(volatile u32 *)reg;
92}
93
94
95/* arch/mips/au1000/common/clocks.c */
96extern void set_au1x00_speed(unsigned int new_freq);
97extern unsigned int get_au1x00_speed(void);
98extern void set_au1x00_uart_baud_base(unsigned long new_baud_base);
99extern unsigned long get_au1x00_uart_baud_base(void);
100extern void set_au1x00_lcd_clock(void);
101extern unsigned int get_au1x00_lcd_clock(void);
102
103/*
104 * Every board describes its IRQ mapping with this table.
105 */
106struct au1xxx_irqmap {
107 int im_irq;
108 int im_type;
109 int im_request;
110};
111
112/*
113 * init_IRQ looks for a table with this name.
114 */
115extern struct au1xxx_irqmap au1xxx_irq_map[];
116
117#endif /* !defined (_LANGUAGE_ASSEMBLY) */
118
119/*
120 * SDRAM register offsets
121 */
122#if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1500) || \
123 defined(CONFIG_SOC_AU1100)
124#define MEM_SDMODE0 0x0000
125#define MEM_SDMODE1 0x0004
126#define MEM_SDMODE2 0x0008
127#define MEM_SDADDR0 0x000C
128#define MEM_SDADDR1 0x0010
129#define MEM_SDADDR2 0x0014
130#define MEM_SDREFCFG 0x0018
131#define MEM_SDPRECMD 0x001C
132#define MEM_SDAUTOREF 0x0020
133#define MEM_SDWRMD0 0x0024
134#define MEM_SDWRMD1 0x0028
135#define MEM_SDWRMD2 0x002C
136#define MEM_SDSLEEP 0x0030
137#define MEM_SDSMCKE 0x0034
138
139/*
140 * MEM_SDMODE register content definitions
141 */
142#define MEM_SDMODE_F (1 << 22)
143#define MEM_SDMODE_SR (1 << 21)
144#define MEM_SDMODE_BS (1 << 20)
145#define MEM_SDMODE_RS (3 << 18)
146#define MEM_SDMODE_CS (7 << 15)
147#define MEM_SDMODE_TRAS (15 << 11)
148#define MEM_SDMODE_TMRD (3 << 9)
149#define MEM_SDMODE_TWR (3 << 7)
150#define MEM_SDMODE_TRP (3 << 5)
151#define MEM_SDMODE_TRCD (3 << 3)
152#define MEM_SDMODE_TCL (7 << 0)
153
154#define MEM_SDMODE_BS_2Bank (0 << 20)
155#define MEM_SDMODE_BS_4Bank (1 << 20)
156#define MEM_SDMODE_RS_11Row (0 << 18)
157#define MEM_SDMODE_RS_12Row (1 << 18)
158#define MEM_SDMODE_RS_13Row (2 << 18)
159#define MEM_SDMODE_RS_N(N) ((N) << 18)
160#define MEM_SDMODE_CS_7Col (0 << 15)
161#define MEM_SDMODE_CS_8Col (1 << 15)
162#define MEM_SDMODE_CS_9Col (2 << 15)
163#define MEM_SDMODE_CS_10Col (3 << 15)
164#define MEM_SDMODE_CS_11Col (4 << 15)
165#define MEM_SDMODE_CS_N(N) ((N) << 15)
166#define MEM_SDMODE_TRAS_N(N) ((N) << 11)
167#define MEM_SDMODE_TMRD_N(N) ((N) << 9)
168#define MEM_SDMODE_TWR_N(N) ((N) << 7)
169#define MEM_SDMODE_TRP_N(N) ((N) << 5)
170#define MEM_SDMODE_TRCD_N(N) ((N) << 3)
171#define MEM_SDMODE_TCL_N(N) ((N) << 0)
172
173/*
174 * MEM_SDADDR register contents definitions
175 */
176#define MEM_SDADDR_E (1 << 20)
177#define MEM_SDADDR_CSBA (0x03FF << 10)
178#define MEM_SDADDR_CSMASK (0x03FF << 0)
179#define MEM_SDADDR_CSBA_N(N) ((N) & (0x03FF << 22) >> 12)
180#define MEM_SDADDR_CSMASK_N(N) ((N)&(0x03FF << 22) >> 22)
181
182/*
183 * MEM_SDREFCFG register content definitions
184 */
185#define MEM_SDREFCFG_TRC (15 << 28)
186#define MEM_SDREFCFG_TRPM (3 << 26)
187#define MEM_SDREFCFG_E (1 << 25)
188#define MEM_SDREFCFG_RE (0x1ffffff << 0)
189#define MEM_SDREFCFG_TRC_N(N) ((N) << MEM_SDREFCFG_TRC)
190#define MEM_SDREFCFG_TRPM_N(N) ((N) << MEM_SDREFCFG_TRPM)
191#define MEM_SDREFCFG_REF_N(N) (N)
192#endif
193
194/***********************************************************************/
195
196/*
197 * Au1550 SDRAM Register Offsets
198 */
199
200/***********************************************************************/
201
202#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
203#define MEM_SDMODE0 0x0800
204#define MEM_SDMODE1 0x0808
205#define MEM_SDMODE2 0x0810
206#define MEM_SDADDR0 0x0820
207#define MEM_SDADDR1 0x0828
208#define MEM_SDADDR2 0x0830
209#define MEM_SDCONFIGA 0x0840
210#define MEM_SDCONFIGB 0x0848
211#define MEM_SDSTAT 0x0850
212#define MEM_SDERRADDR 0x0858
213#define MEM_SDSTRIDE0 0x0860
214#define MEM_SDSTRIDE1 0x0868
215#define MEM_SDSTRIDE2 0x0870
216#define MEM_SDWRMD0 0x0880
217#define MEM_SDWRMD1 0x0888
218#define MEM_SDWRMD2 0x0890
219#define MEM_SDPRECMD 0x08C0
220#define MEM_SDAUTOREF 0x08C8
221#define MEM_SDSREF 0x08D0
222#define MEM_SDSLEEP MEM_SDSREF
223
224#endif
225
226/*
227 * Physical base addresses for integrated peripherals
228 */
229
230#ifdef CONFIG_SOC_AU1000
231#define MEM_PHYS_ADDR 0x14000000
232#define STATIC_MEM_PHYS_ADDR 0x14001000
233#define DMA0_PHYS_ADDR 0x14002000
234#define DMA1_PHYS_ADDR 0x14002100
235#define DMA2_PHYS_ADDR 0x14002200
236#define DMA3_PHYS_ADDR 0x14002300
237#define DMA4_PHYS_ADDR 0x14002400
238#define DMA5_PHYS_ADDR 0x14002500
239#define DMA6_PHYS_ADDR 0x14002600
240#define DMA7_PHYS_ADDR 0x14002700
241#define IC0_PHYS_ADDR 0x10400000
242#define IC1_PHYS_ADDR 0x11800000
243#define AC97_PHYS_ADDR 0x10000000
244#define USBH_PHYS_ADDR 0x10100000
245#define USBD_PHYS_ADDR 0x10200000
246#define IRDA_PHYS_ADDR 0x10300000
247#define MAC0_PHYS_ADDR 0x10500000
248#define MAC1_PHYS_ADDR 0x10510000
249#define MACEN_PHYS_ADDR 0x10520000
250#define MACDMA0_PHYS_ADDR 0x14004000
251#define MACDMA1_PHYS_ADDR 0x14004200
252#define I2S_PHYS_ADDR 0x11000000
253#define UART0_PHYS_ADDR 0x11100000
254#define UART1_PHYS_ADDR 0x11200000
255#define UART2_PHYS_ADDR 0x11300000
256#define UART3_PHYS_ADDR 0x11400000
257#define SSI0_PHYS_ADDR 0x11600000
258#define SSI1_PHYS_ADDR 0x11680000
259#define SYS_PHYS_ADDR 0x11900000
260#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
261#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
262#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
263#endif
264
265/********************************************************************/
266
267#ifdef CONFIG_SOC_AU1500
268#define MEM_PHYS_ADDR 0x14000000
269#define STATIC_MEM_PHYS_ADDR 0x14001000
270#define DMA0_PHYS_ADDR 0x14002000
271#define DMA1_PHYS_ADDR 0x14002100
272#define DMA2_PHYS_ADDR 0x14002200
273#define DMA3_PHYS_ADDR 0x14002300
274#define DMA4_PHYS_ADDR 0x14002400
275#define DMA5_PHYS_ADDR 0x14002500
276#define DMA6_PHYS_ADDR 0x14002600
277#define DMA7_PHYS_ADDR 0x14002700
278#define IC0_PHYS_ADDR 0x10400000
279#define IC1_PHYS_ADDR 0x11800000
280#define AC97_PHYS_ADDR 0x10000000
281#define USBH_PHYS_ADDR 0x10100000
282#define USBD_PHYS_ADDR 0x10200000
283#define PCI_PHYS_ADDR 0x14005000
284#define MAC0_PHYS_ADDR 0x11500000
285#define MAC1_PHYS_ADDR 0x11510000
286#define MACEN_PHYS_ADDR 0x11520000
287#define MACDMA0_PHYS_ADDR 0x14004000
288#define MACDMA1_PHYS_ADDR 0x14004200
289#define I2S_PHYS_ADDR 0x11000000
290#define UART0_PHYS_ADDR 0x11100000
291#define UART3_PHYS_ADDR 0x11400000
292#define GPIO2_PHYS_ADDR 0x11700000
293#define SYS_PHYS_ADDR 0x11900000
294#define PCI_MEM_PHYS_ADDR 0x400000000ULL
295#define PCI_IO_PHYS_ADDR 0x500000000ULL
296#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
297#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
298#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
299#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
300#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
301#endif
302
303/********************************************************************/
304
305#ifdef CONFIG_SOC_AU1100
306#define MEM_PHYS_ADDR 0x14000000
307#define STATIC_MEM_PHYS_ADDR 0x14001000
308#define DMA0_PHYS_ADDR 0x14002000
309#define DMA1_PHYS_ADDR 0x14002100
310#define DMA2_PHYS_ADDR 0x14002200
311#define DMA3_PHYS_ADDR 0x14002300
312#define DMA4_PHYS_ADDR 0x14002400
313#define DMA5_PHYS_ADDR 0x14002500
314#define DMA6_PHYS_ADDR 0x14002600
315#define DMA7_PHYS_ADDR 0x14002700
316#define IC0_PHYS_ADDR 0x10400000
317#define SD0_PHYS_ADDR 0x10600000
318#define SD1_PHYS_ADDR 0x10680000
319#define IC1_PHYS_ADDR 0x11800000
320#define AC97_PHYS_ADDR 0x10000000
321#define USBH_PHYS_ADDR 0x10100000
322#define USBD_PHYS_ADDR 0x10200000
323#define IRDA_PHYS_ADDR 0x10300000
324#define MAC0_PHYS_ADDR 0x10500000
325#define MACEN_PHYS_ADDR 0x10520000
326#define MACDMA0_PHYS_ADDR 0x14004000
327#define MACDMA1_PHYS_ADDR 0x14004200
328#define I2S_PHYS_ADDR 0x11000000
329#define UART0_PHYS_ADDR 0x11100000
330#define UART1_PHYS_ADDR 0x11200000
331#define UART3_PHYS_ADDR 0x11400000
332#define SSI0_PHYS_ADDR 0x11600000
333#define SSI1_PHYS_ADDR 0x11680000
334#define GPIO2_PHYS_ADDR 0x11700000
335#define SYS_PHYS_ADDR 0x11900000
336#define LCD_PHYS_ADDR 0x15000000
337#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
338#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
339#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
340#endif
341
342/***********************************************************************/
343
344#ifdef CONFIG_SOC_AU1550
345#define MEM_PHYS_ADDR 0x14000000
346#define STATIC_MEM_PHYS_ADDR 0x14001000
347#define IC0_PHYS_ADDR 0x10400000
348#define IC1_PHYS_ADDR 0x11800000
349#define USBH_PHYS_ADDR 0x14020000
350#define USBD_PHYS_ADDR 0x10200000
351#define PCI_PHYS_ADDR 0x14005000
352#define MAC0_PHYS_ADDR 0x10500000
353#define MAC1_PHYS_ADDR 0x10510000
354#define MACEN_PHYS_ADDR 0x10520000
355#define MACDMA0_PHYS_ADDR 0x14004000
356#define MACDMA1_PHYS_ADDR 0x14004200
357#define UART0_PHYS_ADDR 0x11100000
358#define UART1_PHYS_ADDR 0x11200000
359#define UART3_PHYS_ADDR 0x11400000
360#define GPIO2_PHYS_ADDR 0x11700000
361#define SYS_PHYS_ADDR 0x11900000
362#define DDMA_PHYS_ADDR 0x14002000
363#define PE_PHYS_ADDR 0x14008000
364#define PSC0_PHYS_ADDR 0x11A00000
365#define PSC1_PHYS_ADDR 0x11B00000
366#define PSC2_PHYS_ADDR 0x10A00000
367#define PSC3_PHYS_ADDR 0x10B00000
368#define PCI_MEM_PHYS_ADDR 0x400000000ULL
369#define PCI_IO_PHYS_ADDR 0x500000000ULL
370#define PCI_CONFIG0_PHYS_ADDR 0x600000000ULL
371#define PCI_CONFIG1_PHYS_ADDR 0x680000000ULL
372#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
373#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
374#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
375#endif
376
377/***********************************************************************/
378
379#ifdef CONFIG_SOC_AU1200
380#define MEM_PHYS_ADDR 0x14000000
381#define STATIC_MEM_PHYS_ADDR 0x14001000
382#define AES_PHYS_ADDR 0x10300000
383#define CIM_PHYS_ADDR 0x14004000
384#define IC0_PHYS_ADDR 0x10400000
385#define IC1_PHYS_ADDR 0x11800000
386#define USBM_PHYS_ADDR 0x14020000
387#define USBH_PHYS_ADDR 0x14020100
388#define UART0_PHYS_ADDR 0x11100000
389#define UART1_PHYS_ADDR 0x11200000
390#define GPIO2_PHYS_ADDR 0x11700000
391#define SYS_PHYS_ADDR 0x11900000
392#define DDMA_PHYS_ADDR 0x14002000
393#define PSC0_PHYS_ADDR 0x11A00000
394#define PSC1_PHYS_ADDR 0x11B00000
395#define SD0_PHYS_ADDR 0x10600000
396#define SD1_PHYS_ADDR 0x10680000
397#define LCD_PHYS_ADDR 0x15000000
398#define SWCNT_PHYS_ADDR 0x1110010C
399#define MAEFE_PHYS_ADDR 0x14012000
400#define MAEBE_PHYS_ADDR 0x14010000
401#define PCMCIA_IO_PHYS_ADDR 0xF00000000ULL
402#define PCMCIA_ATTR_PHYS_ADDR 0xF40000000ULL
403#define PCMCIA_MEM_PHYS_ADDR 0xF80000000ULL
404#endif
405
406/* Static Bus Controller */
407#define MEM_STCFG0 0xB4001000
408#define MEM_STTIME0 0xB4001004
409#define MEM_STADDR0 0xB4001008
410
411#define MEM_STCFG1 0xB4001010
412#define MEM_STTIME1 0xB4001014
413#define MEM_STADDR1 0xB4001018
414
415#define MEM_STCFG2 0xB4001020
416#define MEM_STTIME2 0xB4001024
417#define MEM_STADDR2 0xB4001028
418
419#define MEM_STCFG3 0xB4001030
420#define MEM_STTIME3 0xB4001034
421#define MEM_STADDR3 0xB4001038
422
423#if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
424#define MEM_STNDCTL 0xB4001100
425#define MEM_STSTAT 0xB4001104
426
427#define MEM_STNAND_CMD 0x0
428#define MEM_STNAND_ADDR 0x4
429#define MEM_STNAND_DATA 0x20
430#endif
431
432/* Interrupt Controller 0 */
433#define IC0_CFG0RD 0xB0400040
434#define IC0_CFG0SET 0xB0400040
435#define IC0_CFG0CLR 0xB0400044
436
437#define IC0_CFG1RD 0xB0400048
438#define IC0_CFG1SET 0xB0400048
439#define IC0_CFG1CLR 0xB040004C
440
441#define IC0_CFG2RD 0xB0400050
442#define IC0_CFG2SET 0xB0400050
443#define IC0_CFG2CLR 0xB0400054
444
445#define IC0_REQ0INT 0xB0400054
446#define IC0_SRCRD 0xB0400058
447#define IC0_SRCSET 0xB0400058
448#define IC0_SRCCLR 0xB040005C
449#define IC0_REQ1INT 0xB040005C
450
451#define IC0_ASSIGNRD 0xB0400060
452#define IC0_ASSIGNSET 0xB0400060
453#define IC0_ASSIGNCLR 0xB0400064
454
455#define IC0_WAKERD 0xB0400068
456#define IC0_WAKESET 0xB0400068
457#define IC0_WAKECLR 0xB040006C
458
459#define IC0_MASKRD 0xB0400070
460#define IC0_MASKSET 0xB0400070
461#define IC0_MASKCLR 0xB0400074
462
463#define IC0_RISINGRD 0xB0400078
464#define IC0_RISINGCLR 0xB0400078
465#define IC0_FALLINGRD 0xB040007C
466#define IC0_FALLINGCLR 0xB040007C
467
468#define IC0_TESTBIT 0xB0400080
469
470/* Interrupt Controller 1 */
471#define IC1_CFG0RD 0xB1800040
472#define IC1_CFG0SET 0xB1800040
473#define IC1_CFG0CLR 0xB1800044
474
475#define IC1_CFG1RD 0xB1800048
476#define IC1_CFG1SET 0xB1800048
477#define IC1_CFG1CLR 0xB180004C
478
479#define IC1_CFG2RD 0xB1800050
480#define IC1_CFG2SET 0xB1800050
481#define IC1_CFG2CLR 0xB1800054
482
483#define IC1_REQ0INT 0xB1800054
484#define IC1_SRCRD 0xB1800058
485#define IC1_SRCSET 0xB1800058
486#define IC1_SRCCLR 0xB180005C
487#define IC1_REQ1INT 0xB180005C
488
489#define IC1_ASSIGNRD 0xB1800060
490#define IC1_ASSIGNSET 0xB1800060
491#define IC1_ASSIGNCLR 0xB1800064
492
493#define IC1_WAKERD 0xB1800068
494#define IC1_WAKESET 0xB1800068
495#define IC1_WAKECLR 0xB180006C
496
497#define IC1_MASKRD 0xB1800070
498#define IC1_MASKSET 0xB1800070
499#define IC1_MASKCLR 0xB1800074
500
501#define IC1_RISINGRD 0xB1800078
502#define IC1_RISINGCLR 0xB1800078
503#define IC1_FALLINGRD 0xB180007C
504#define IC1_FALLINGCLR 0xB180007C
505
506#define IC1_TESTBIT 0xB1800080
507
508/* Interrupt Configuration Modes */
509#define INTC_INT_DISABLED 0x0
510#define INTC_INT_RISE_EDGE 0x1
511#define INTC_INT_FALL_EDGE 0x2
512#define INTC_INT_RISE_AND_FALL_EDGE 0x3
513#define INTC_INT_HIGH_LEVEL 0x5
514#define INTC_INT_LOW_LEVEL 0x6
515#define INTC_INT_HIGH_AND_LOW_LEVEL 0x7
516
517/* Interrupt Numbers */
518/* Au1000 */
519#ifdef CONFIG_SOC_AU1000
520enum soc_au1000_ints {
521 AU1000_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
522 AU1000_UART0_INT = AU1000_FIRST_INT,
523 AU1000_UART1_INT, /* au1000 */
524 AU1000_UART2_INT, /* au1000 */
525 AU1000_UART3_INT,
526 AU1000_SSI0_INT, /* au1000 */
527 AU1000_SSI1_INT, /* au1000 */
528 AU1000_DMA_INT_BASE,
529
530 AU1000_TOY_INT = AU1000_FIRST_INT + 14,
531 AU1000_TOY_MATCH0_INT,
532 AU1000_TOY_MATCH1_INT,
533 AU1000_TOY_MATCH2_INT,
534 AU1000_RTC_INT,
535 AU1000_RTC_MATCH0_INT,
536 AU1000_RTC_MATCH1_INT,
537 AU1000_RTC_MATCH2_INT,
538 AU1000_IRDA_TX_INT, /* au1000 */
539 AU1000_IRDA_RX_INT, /* au1000 */
540 AU1000_USB_DEV_REQ_INT,
541 AU1000_USB_DEV_SUS_INT,
542 AU1000_USB_HOST_INT,
543 AU1000_ACSYNC_INT,
544 AU1000_MAC0_DMA_INT,
545 AU1000_MAC1_DMA_INT,
546 AU1000_I2S_UO_INT, /* au1000 */
547 AU1000_AC97C_INT,
548 AU1000_GPIO_0,
549 AU1000_GPIO_1,
550 AU1000_GPIO_2,
551 AU1000_GPIO_3,
552 AU1000_GPIO_4,
553 AU1000_GPIO_5,
554 AU1000_GPIO_6,
555 AU1000_GPIO_7,
556 AU1000_GPIO_8,
557 AU1000_GPIO_9,
558 AU1000_GPIO_10,
559 AU1000_GPIO_11,
560 AU1000_GPIO_12,
561 AU1000_GPIO_13,
562 AU1000_GPIO_14,
563 AU1000_GPIO_15,
564 AU1000_GPIO_16,
565 AU1000_GPIO_17,
566 AU1000_GPIO_18,
567 AU1000_GPIO_19,
568 AU1000_GPIO_20,
569 AU1000_GPIO_21,
570 AU1000_GPIO_22,
571 AU1000_GPIO_23,
572 AU1000_GPIO_24,
573 AU1000_GPIO_25,
574 AU1000_GPIO_26,
575 AU1000_GPIO_27,
576 AU1000_GPIO_28,
577 AU1000_GPIO_29,
578 AU1000_GPIO_30,
579 AU1000_GPIO_31,
580};
581
582#define UART0_ADDR 0xB1100000
583#define UART1_ADDR 0xB1200000
584#define UART2_ADDR 0xB1300000
585#define UART3_ADDR 0xB1400000
586
587#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
588#define USB_HOST_CONFIG 0xB017FFFC
589
590#define AU1000_ETH0_BASE 0xB0500000
591#define AU1000_ETH1_BASE 0xB0510000
592#define AU1000_MAC0_ENABLE 0xB0520000
593#define AU1000_MAC1_ENABLE 0xB0520004
594#define NUM_ETH_INTERFACES 2
595#endif /* CONFIG_SOC_AU1000 */
596
597/* Au1500 */
598#ifdef CONFIG_SOC_AU1500
599enum soc_au1500_ints {
600 AU1500_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
601 AU1500_UART0_INT = AU1500_FIRST_INT,
602 AU1000_PCI_INTA, /* au1500 */
603 AU1000_PCI_INTB, /* au1500 */
604 AU1500_UART3_INT,
605 AU1000_PCI_INTC, /* au1500 */
606 AU1000_PCI_INTD, /* au1500 */
607 AU1000_DMA_INT_BASE,
608
609 AU1000_TOY_INT = AU1500_FIRST_INT + 14,
610 AU1000_TOY_MATCH0_INT,
611 AU1000_TOY_MATCH1_INT,
612 AU1000_TOY_MATCH2_INT,
613 AU1000_RTC_INT,
614 AU1000_RTC_MATCH0_INT,
615 AU1000_RTC_MATCH1_INT,
616 AU1000_RTC_MATCH2_INT,
617 AU1500_PCI_ERR_INT,
618 AU1500_RESERVED_INT,
619 AU1000_USB_DEV_REQ_INT,
620 AU1000_USB_DEV_SUS_INT,
621 AU1000_USB_HOST_INT,
622 AU1000_ACSYNC_INT,
623 AU1500_MAC0_DMA_INT,
624 AU1500_MAC1_DMA_INT,
625 AU1000_AC97C_INT = AU1500_FIRST_INT + 31,
626 AU1000_GPIO_0,
627 AU1000_GPIO_1,
628 AU1000_GPIO_2,
629 AU1000_GPIO_3,
630 AU1000_GPIO_4,
631 AU1000_GPIO_5,
632 AU1000_GPIO_6,
633 AU1000_GPIO_7,
634 AU1000_GPIO_8,
635 AU1000_GPIO_9,
636 AU1000_GPIO_10,
637 AU1000_GPIO_11,
638 AU1000_GPIO_12,
639 AU1000_GPIO_13,
640 AU1000_GPIO_14,
641 AU1000_GPIO_15,
642 AU1500_GPIO_200,
643 AU1500_GPIO_201,
644 AU1500_GPIO_202,
645 AU1500_GPIO_203,
646 AU1500_GPIO_20,
647 AU1500_GPIO_204,
648 AU1500_GPIO_205,
649 AU1500_GPIO_23,
650 AU1500_GPIO_24,
651 AU1500_GPIO_25,
652 AU1500_GPIO_26,
653 AU1500_GPIO_27,
654 AU1500_GPIO_28,
655 AU1500_GPIO_206,
656 AU1500_GPIO_207,
657 AU1500_GPIO_208_215,
658};
659
660/* shortcuts */
661#define INTA AU1000_PCI_INTA
662#define INTB AU1000_PCI_INTB
663#define INTC AU1000_PCI_INTC
664#define INTD AU1000_PCI_INTD
665
666#define UART0_ADDR 0xB1100000
667#define UART3_ADDR 0xB1400000
668
669#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
670#define USB_HOST_CONFIG 0xB017fffc
671
672#define AU1500_ETH0_BASE 0xB1500000
673#define AU1500_ETH1_BASE 0xB1510000
674#define AU1500_MAC0_ENABLE 0xB1520000
675#define AU1500_MAC1_ENABLE 0xB1520004
676#define NUM_ETH_INTERFACES 2
677#endif /* CONFIG_SOC_AU1500 */
678
679/* Au1100 */
680#ifdef CONFIG_SOC_AU1100
681enum soc_au1100_ints {
682 AU1100_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
683 AU1100_UART0_INT,
684 AU1100_UART1_INT,
685 AU1100_SD_INT,
686 AU1100_UART3_INT,
687 AU1000_SSI0_INT,
688 AU1000_SSI1_INT,
689 AU1000_DMA_INT_BASE,
690
691 AU1000_TOY_INT = AU1100_FIRST_INT + 14,
692 AU1000_TOY_MATCH0_INT,
693 AU1000_TOY_MATCH1_INT,
694 AU1000_TOY_MATCH2_INT,
695 AU1000_RTC_INT,
696 AU1000_RTC_MATCH0_INT,
697 AU1000_RTC_MATCH1_INT,
698 AU1000_RTC_MATCH2_INT,
699 AU1000_IRDA_TX_INT,
700 AU1000_IRDA_RX_INT,
701 AU1000_USB_DEV_REQ_INT,
702 AU1000_USB_DEV_SUS_INT,
703 AU1000_USB_HOST_INT,
704 AU1000_ACSYNC_INT,
705 AU1100_MAC0_DMA_INT,
706 AU1100_GPIO_208_215,
707 AU1100_LCD_INT,
708 AU1000_AC97C_INT,
709 AU1000_GPIO_0,
710 AU1000_GPIO_1,
711 AU1000_GPIO_2,
712 AU1000_GPIO_3,
713 AU1000_GPIO_4,
714 AU1000_GPIO_5,
715 AU1000_GPIO_6,
716 AU1000_GPIO_7,
717 AU1000_GPIO_8,
718 AU1000_GPIO_9,
719 AU1000_GPIO_10,
720 AU1000_GPIO_11,
721 AU1000_GPIO_12,
722 AU1000_GPIO_13,
723 AU1000_GPIO_14,
724 AU1000_GPIO_15,
725 AU1000_GPIO_16,
726 AU1000_GPIO_17,
727 AU1000_GPIO_18,
728 AU1000_GPIO_19,
729 AU1000_GPIO_20,
730 AU1000_GPIO_21,
731 AU1000_GPIO_22,
732 AU1000_GPIO_23,
733 AU1000_GPIO_24,
734 AU1000_GPIO_25,
735 AU1000_GPIO_26,
736 AU1000_GPIO_27,
737 AU1000_GPIO_28,
738 AU1000_GPIO_29,
739 AU1000_GPIO_30,
740 AU1000_GPIO_31,
741};
742
743#define UART0_ADDR 0xB1100000
744#define UART1_ADDR 0xB1200000
745#define UART3_ADDR 0xB1400000
746
747#define USB_OHCI_BASE 0x10100000 /* phys addr for ioremap */
748#define USB_HOST_CONFIG 0xB017FFFC
749
750#define AU1100_ETH0_BASE 0xB0500000
751#define AU1100_MAC0_ENABLE 0xB0520000
752#define NUM_ETH_INTERFACES 1
753#endif /* CONFIG_SOC_AU1100 */
754
755#ifdef CONFIG_SOC_AU1550
756enum soc_au1550_ints {
757 AU1550_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
758 AU1550_UART0_INT = AU1550_FIRST_INT,
759 AU1550_PCI_INTA,
760 AU1550_PCI_INTB,
761 AU1550_DDMA_INT,
762 AU1550_CRYPTO_INT,
763 AU1550_PCI_INTC,
764 AU1550_PCI_INTD,
765 AU1550_PCI_RST_INT,
766 AU1550_UART1_INT,
767 AU1550_UART3_INT,
768 AU1550_PSC0_INT,
769 AU1550_PSC1_INT,
770 AU1550_PSC2_INT,
771 AU1550_PSC3_INT,
772 AU1000_TOY_INT,
773 AU1000_TOY_MATCH0_INT,
774 AU1000_TOY_MATCH1_INT,
775 AU1000_TOY_MATCH2_INT,
776 AU1000_RTC_INT,
777 AU1000_RTC_MATCH0_INT,
778 AU1000_RTC_MATCH1_INT,
779 AU1000_RTC_MATCH2_INT,
780
781 AU1550_NAND_INT = AU1550_FIRST_INT + 23,
782 AU1550_USB_DEV_REQ_INT,
783 AU1000_USB_DEV_REQ_INT = AU1550_USB_DEV_REQ_INT,
784 AU1550_USB_DEV_SUS_INT,
785 AU1000_USB_DEV_SUS_INT = AU1550_USB_DEV_SUS_INT,
786 AU1550_USB_HOST_INT,
787 AU1000_USB_HOST_INT = AU1550_USB_HOST_INT,
788 AU1550_MAC0_DMA_INT,
789 AU1550_MAC1_DMA_INT,
790 AU1000_GPIO_0 = AU1550_FIRST_INT + 32,
791 AU1000_GPIO_1,
792 AU1000_GPIO_2,
793 AU1000_GPIO_3,
794 AU1000_GPIO_4,
795 AU1000_GPIO_5,
796 AU1000_GPIO_6,
797 AU1000_GPIO_7,
798 AU1000_GPIO_8,
799 AU1000_GPIO_9,
800 AU1000_GPIO_10,
801 AU1000_GPIO_11,
802 AU1000_GPIO_12,
803 AU1000_GPIO_13,
804 AU1000_GPIO_14,
805 AU1000_GPIO_15,
806 AU1550_GPIO_200,
807 AU1500_GPIO_201_205, /* Logical or of GPIO201:205 */
808 AU1500_GPIO_16,
809 AU1500_GPIO_17,
810 AU1500_GPIO_20,
811 AU1500_GPIO_21,
812 AU1500_GPIO_22,
813 AU1500_GPIO_23,
814 AU1500_GPIO_24,
815 AU1500_GPIO_25,
816 AU1500_GPIO_26,
817 AU1500_GPIO_27,
818 AU1500_GPIO_28,
819 AU1500_GPIO_206,
820 AU1500_GPIO_207,
821 AU1500_GPIO_208_218, /* Logical or of GPIO208:218 */
822};
823
824/* shortcuts */
825#define INTA AU1550_PCI_INTA
826#define INTB AU1550_PCI_INTB
827#define INTC AU1550_PCI_INTC
828#define INTD AU1550_PCI_INTD
829
830#define UART0_ADDR 0xB1100000
831#define UART1_ADDR 0xB1200000
832#define UART3_ADDR 0xB1400000
833
834#define USB_OHCI_BASE 0x14020000 /* phys addr for ioremap */
835#define USB_OHCI_LEN 0x00060000
836#define USB_HOST_CONFIG 0xB4027ffc
837
838#define AU1550_ETH0_BASE 0xB0500000
839#define AU1550_ETH1_BASE 0xB0510000
840#define AU1550_MAC0_ENABLE 0xB0520000
841#define AU1550_MAC1_ENABLE 0xB0520004
842#define NUM_ETH_INTERFACES 2
843#endif /* CONFIG_SOC_AU1550 */
844
845#ifdef CONFIG_SOC_AU1200
846enum soc_au1200_ints {
847 AU1200_FIRST_INT = MIPS_CPU_IRQ_BASE + 8,
848 AU1200_UART0_INT = AU1200_FIRST_INT,
849 AU1200_SWT_INT,
850 AU1200_SD_INT,
851 AU1200_DDMA_INT,
852 AU1200_MAE_BE_INT,
853 AU1200_GPIO_200,
854 AU1200_GPIO_201,
855 AU1200_GPIO_202,
856 AU1200_UART1_INT,
857 AU1200_MAE_FE_INT,
858 AU1200_PSC0_INT,
859 AU1200_PSC1_INT,
860 AU1200_AES_INT,
861 AU1200_CAMERA_INT,
862 AU1000_TOY_INT,
863 AU1000_TOY_MATCH0_INT,
864 AU1000_TOY_MATCH1_INT,
865 AU1000_TOY_MATCH2_INT,
866 AU1000_RTC_INT,
867 AU1000_RTC_MATCH0_INT,
868 AU1000_RTC_MATCH1_INT,
869 AU1000_RTC_MATCH2_INT,
870
871 AU1200_NAND_INT = AU1200_FIRST_INT + 23,
872 AU1200_GPIO_204,
873 AU1200_GPIO_205,
874 AU1200_GPIO_206,
875 AU1200_GPIO_207,
876 AU1200_GPIO_208_215, /* Logical OR of 208:215 */
877 AU1200_USB_INT,
878 AU1000_USB_HOST_INT = AU1200_USB_INT,
879 AU1200_LCD_INT,
880 AU1200_MAE_BOTH_INT,
881 AU1000_GPIO_0,
882 AU1000_GPIO_1,
883 AU1000_GPIO_2,
884 AU1000_GPIO_3,
885 AU1000_GPIO_4,
886 AU1000_GPIO_5,
887 AU1000_GPIO_6,
888 AU1000_GPIO_7,
889 AU1000_GPIO_8,
890 AU1000_GPIO_9,
891 AU1000_GPIO_10,
892 AU1000_GPIO_11,
893 AU1000_GPIO_12,
894 AU1000_GPIO_13,
895 AU1000_GPIO_14,
896 AU1000_GPIO_15,
897 AU1000_GPIO_16,
898 AU1000_GPIO_17,
899 AU1000_GPIO_18,
900 AU1000_GPIO_19,
901 AU1000_GPIO_20,
902 AU1000_GPIO_21,
903 AU1000_GPIO_22,
904 AU1000_GPIO_23,
905 AU1000_GPIO_24,
906 AU1000_GPIO_25,
907 AU1000_GPIO_26,
908 AU1000_GPIO_27,
909 AU1000_GPIO_28,
910 AU1000_GPIO_29,
911 AU1000_GPIO_30,
912 AU1000_GPIO_31,
913};
914
915#define UART0_ADDR 0xB1100000
916#define UART1_ADDR 0xB1200000
917
918#define USB_UOC_BASE 0x14020020
919#define USB_UOC_LEN 0x20
920#define USB_OHCI_BASE 0x14020100
921#define USB_OHCI_LEN 0x100
922#define USB_EHCI_BASE 0x14020200
923#define USB_EHCI_LEN 0x100
924#define USB_UDC_BASE 0x14022000
925#define USB_UDC_LEN 0x2000
926#define USB_MSR_BASE 0xB4020000
927#define USB_MSR_MCFG 4
928#define USBMSRMCFG_OMEMEN 0
929#define USBMSRMCFG_OBMEN 1
930#define USBMSRMCFG_EMEMEN 2
931#define USBMSRMCFG_EBMEN 3
932#define USBMSRMCFG_DMEMEN 4
933#define USBMSRMCFG_DBMEN 5
934#define USBMSRMCFG_GMEMEN 6
935#define USBMSRMCFG_OHCCLKEN 16
936#define USBMSRMCFG_EHCCLKEN 17
937#define USBMSRMCFG_UDCCLKEN 18
938#define USBMSRMCFG_PHYPLLEN 19
939#define USBMSRMCFG_RDCOMB 30
940#define USBMSRMCFG_PFEN 31
941
942#endif /* CONFIG_SOC_AU1200 */
943
944#define AU1000_INTC0_INT_BASE (MIPS_CPU_IRQ_BASE + 8)
945#define AU1000_INTC0_INT_LAST (AU1000_INTC0_INT_BASE + 31)
946#define AU1000_INTC1_INT_BASE (AU1000_INTC0_INT_BASE + 32)
947#define AU1000_INTC1_INT_LAST (AU1000_INTC1_INT_BASE + 31)
948
949#define AU1000_MAX_INTR AU1000_INTC1_INT_LAST
950#define INTX 0xFF /* not valid */
951
952/* Programmable Counters 0 and 1 */
953#define SYS_BASE 0xB1900000
954#define SYS_COUNTER_CNTRL (SYS_BASE + 0x14)
955# define SYS_CNTRL_E1S (1 << 23)
956# define SYS_CNTRL_T1S (1 << 20)
957# define SYS_CNTRL_M21 (1 << 19)
958# define SYS_CNTRL_M11 (1 << 18)
959# define SYS_CNTRL_M01 (1 << 17)
960# define SYS_CNTRL_C1S (1 << 16)
961# define SYS_CNTRL_BP (1 << 14)
962# define SYS_CNTRL_EN1 (1 << 13)
963# define SYS_CNTRL_BT1 (1 << 12)
964# define SYS_CNTRL_EN0 (1 << 11)
965# define SYS_CNTRL_BT0 (1 << 10)
966# define SYS_CNTRL_E0 (1 << 8)
967# define SYS_CNTRL_E0S (1 << 7)
968# define SYS_CNTRL_32S (1 << 5)
969# define SYS_CNTRL_T0S (1 << 4)
970# define SYS_CNTRL_M20 (1 << 3)
971# define SYS_CNTRL_M10 (1 << 2)
972# define SYS_CNTRL_M00 (1 << 1)
973# define SYS_CNTRL_C0S (1 << 0)
974
975/* Programmable Counter 0 Registers */
976#define SYS_TOYTRIM (SYS_BASE + 0)
977#define SYS_TOYWRITE (SYS_BASE + 4)
978#define SYS_TOYMATCH0 (SYS_BASE + 8)
979#define SYS_TOYMATCH1 (SYS_BASE + 0xC)
980#define SYS_TOYMATCH2 (SYS_BASE + 0x10)
981#define SYS_TOYREAD (SYS_BASE + 0x40)
982
983/* Programmable Counter 1 Registers */
984#define SYS_RTCTRIM (SYS_BASE + 0x44)
985#define SYS_RTCWRITE (SYS_BASE + 0x48)
986#define SYS_RTCMATCH0 (SYS_BASE + 0x4C)
987#define SYS_RTCMATCH1 (SYS_BASE + 0x50)
988#define SYS_RTCMATCH2 (SYS_BASE + 0x54)
989#define SYS_RTCREAD (SYS_BASE + 0x58)
990
991/* I2S Controller */
992#define I2S_DATA 0xB1000000
993# define I2S_DATA_MASK 0xffffff
994#define I2S_CONFIG 0xB1000004
995# define I2S_CONFIG_XU (1 << 25)
996# define I2S_CONFIG_XO (1 << 24)
997# define I2S_CONFIG_RU (1 << 23)
998# define I2S_CONFIG_RO (1 << 22)
999# define I2S_CONFIG_TR (1 << 21)
1000# define I2S_CONFIG_TE (1 << 20)
1001# define I2S_CONFIG_TF (1 << 19)
1002# define I2S_CONFIG_RR (1 << 18)
1003# define I2S_CONFIG_RE (1 << 17)
1004# define I2S_CONFIG_RF (1 << 16)
1005# define I2S_CONFIG_PD (1 << 11)
1006# define I2S_CONFIG_LB (1 << 10)
1007# define I2S_CONFIG_IC (1 << 9)
1008# define I2S_CONFIG_FM_BIT 7
1009# define I2S_CONFIG_FM_MASK (0x3 << I2S_CONFIG_FM_BIT)
1010# define I2S_CONFIG_FM_I2S (0x0 << I2S_CONFIG_FM_BIT)
1011# define I2S_CONFIG_FM_LJ (0x1 << I2S_CONFIG_FM_BIT)
1012# define I2S_CONFIG_FM_RJ (0x2 << I2S_CONFIG_FM_BIT)
1013# define I2S_CONFIG_TN (1 << 6)
1014# define I2S_CONFIG_RN (1 << 5)
1015# define I2S_CONFIG_SZ_BIT 0
1016# define I2S_CONFIG_SZ_MASK (0x1F << I2S_CONFIG_SZ_BIT)
1017
1018#define I2S_CONTROL 0xB1000008
1019# define I2S_CONTROL_D (1 << 1)
1020# define I2S_CONTROL_CE (1 << 0)
1021
1022/* USB Host Controller */
1023#ifndef USB_OHCI_LEN
1024#define USB_OHCI_LEN 0x00100000
1025#endif
1026
1027#ifndef CONFIG_SOC_AU1200
1028
1029/* USB Device Controller */
1030#define USBD_EP0RD 0xB0200000
1031#define USBD_EP0WR 0xB0200004
1032#define USBD_EP2WR 0xB0200008
1033#define USBD_EP3WR 0xB020000C
1034#define USBD_EP4RD 0xB0200010
1035#define USBD_EP5RD 0xB0200014
1036#define USBD_INTEN 0xB0200018
1037#define USBD_INTSTAT 0xB020001C
1038# define USBDEV_INT_SOF (1 << 12)
1039# define USBDEV_INT_HF_BIT 6
1040# define USBDEV_INT_HF_MASK (0x3f << USBDEV_INT_HF_BIT)
1041# define USBDEV_INT_CMPLT_BIT 0
1042# define USBDEV_INT_CMPLT_MASK (0x3f << USBDEV_INT_CMPLT_BIT)
1043#define USBD_CONFIG 0xB0200020
1044#define USBD_EP0CS 0xB0200024
1045#define USBD_EP2CS 0xB0200028
1046#define USBD_EP3CS 0xB020002C
1047#define USBD_EP4CS 0xB0200030
1048#define USBD_EP5CS 0xB0200034
1049# define USBDEV_CS_SU (1 << 14)
1050# define USBDEV_CS_NAK (1 << 13)
1051# define USBDEV_CS_ACK (1 << 12)
1052# define USBDEV_CS_BUSY (1 << 11)
1053# define USBDEV_CS_TSIZE_BIT 1
1054# define USBDEV_CS_TSIZE_MASK (0x3ff << USBDEV_CS_TSIZE_BIT)
1055# define USBDEV_CS_STALL (1 << 0)
1056#define USBD_EP0RDSTAT 0xB0200040
1057#define USBD_EP0WRSTAT 0xB0200044
1058#define USBD_EP2WRSTAT 0xB0200048
1059#define USBD_EP3WRSTAT 0xB020004C
1060#define USBD_EP4RDSTAT 0xB0200050
1061#define USBD_EP5RDSTAT 0xB0200054
1062# define USBDEV_FSTAT_FLUSH (1 << 6)
1063# define USBDEV_FSTAT_UF (1 << 5)
1064# define USBDEV_FSTAT_OF (1 << 4)
1065# define USBDEV_FSTAT_FCNT_BIT 0
1066# define USBDEV_FSTAT_FCNT_MASK (0x0f << USBDEV_FSTAT_FCNT_BIT)
1067#define USBD_ENABLE 0xB0200058
1068# define USBDEV_ENABLE (1 << 1)
1069# define USBDEV_CE (1 << 0)
1070
1071#endif /* !CONFIG_SOC_AU1200 */
1072
1073/* Ethernet Controllers */
1074
1075/* 4 byte offsets from AU1000_ETH_BASE */
1076#define MAC_CONTROL 0x0
1077# define MAC_RX_ENABLE (1 << 2)
1078# define MAC_TX_ENABLE (1 << 3)
1079# define MAC_DEF_CHECK (1 << 5)
1080# define MAC_SET_BL(X) (((X) & 0x3) << 6)
1081# define MAC_AUTO_PAD (1 << 8)
1082# define MAC_DISABLE_RETRY (1 << 10)
1083# define MAC_DISABLE_BCAST (1 << 11)
1084# define MAC_LATE_COL (1 << 12)
1085# define MAC_HASH_MODE (1 << 13)
1086# define MAC_HASH_ONLY (1 << 15)
1087# define MAC_PASS_ALL (1 << 16)
1088# define MAC_INVERSE_FILTER (1 << 17)
1089# define MAC_PROMISCUOUS (1 << 18)
1090# define MAC_PASS_ALL_MULTI (1 << 19)
1091# define MAC_FULL_DUPLEX (1 << 20)
1092# define MAC_NORMAL_MODE 0
1093# define MAC_INT_LOOPBACK (1 << 21)
1094# define MAC_EXT_LOOPBACK (1 << 22)
1095# define MAC_DISABLE_RX_OWN (1 << 23)
1096# define MAC_BIG_ENDIAN (1 << 30)
1097# define MAC_RX_ALL (1 << 31)
1098#define MAC_ADDRESS_HIGH 0x4
1099#define MAC_ADDRESS_LOW 0x8
1100#define MAC_MCAST_HIGH 0xC
1101#define MAC_MCAST_LOW 0x10
1102#define MAC_MII_CNTRL 0x14
1103# define MAC_MII_BUSY (1 << 0)
1104# define MAC_MII_READ 0
1105# define MAC_MII_WRITE (1 << 1)
1106# define MAC_SET_MII_SELECT_REG(X) (((X) & 0x1f) << 6)
1107# define MAC_SET_MII_SELECT_PHY(X) (((X) & 0x1f) << 11)
1108#define MAC_MII_DATA 0x18
1109#define MAC_FLOW_CNTRL 0x1C
1110# define MAC_FLOW_CNTRL_BUSY (1 << 0)
1111# define MAC_FLOW_CNTRL_ENABLE (1 << 1)
1112# define MAC_PASS_CONTROL (1 << 2)
1113# define MAC_SET_PAUSE(X) (((X) & 0xffff) << 16)
1114#define MAC_VLAN1_TAG 0x20
1115#define MAC_VLAN2_TAG 0x24
1116
1117/* Ethernet Controller Enable */
1118
1119# define MAC_EN_CLOCK_ENABLE (1 << 0)
1120# define MAC_EN_RESET0 (1 << 1)
1121# define MAC_EN_TOSS (0 << 2)
1122# define MAC_EN_CACHEABLE (1 << 3)
1123# define MAC_EN_RESET1 (1 << 4)
1124# define MAC_EN_RESET2 (1 << 5)
1125# define MAC_DMA_RESET (1 << 6)
1126
1127/* Ethernet Controller DMA Channels */
1128
1129#define MAC0_TX_DMA_ADDR 0xB4004000
1130#define MAC1_TX_DMA_ADDR 0xB4004200
1131/* offsets from MAC_TX_RING_ADDR address */
1132#define MAC_TX_BUFF0_STATUS 0x0
1133# define TX_FRAME_ABORTED (1 << 0)
1134# define TX_JAB_TIMEOUT (1 << 1)
1135# define TX_NO_CARRIER (1 << 2)
1136# define TX_LOSS_CARRIER (1 << 3)
1137# define TX_EXC_DEF (1 << 4)
1138# define TX_LATE_COLL_ABORT (1 << 5)
1139# define TX_EXC_COLL (1 << 6)
1140# define TX_UNDERRUN (1 << 7)
1141# define TX_DEFERRED (1 << 8)
1142# define TX_LATE_COLL (1 << 9)
1143# define TX_COLL_CNT_MASK (0xF << 10)
1144# define TX_PKT_RETRY (1 << 31)
1145#define MAC_TX_BUFF0_ADDR 0x4
1146# define TX_DMA_ENABLE (1 << 0)
1147# define TX_T_DONE (1 << 1)
1148# define TX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1149#define MAC_TX_BUFF0_LEN 0x8
1150#define MAC_TX_BUFF1_STATUS 0x10
1151#define MAC_TX_BUFF1_ADDR 0x14
1152#define MAC_TX_BUFF1_LEN 0x18
1153#define MAC_TX_BUFF2_STATUS 0x20
1154#define MAC_TX_BUFF2_ADDR 0x24
1155#define MAC_TX_BUFF2_LEN 0x28
1156#define MAC_TX_BUFF3_STATUS 0x30
1157#define MAC_TX_BUFF3_ADDR 0x34
1158#define MAC_TX_BUFF3_LEN 0x38
1159
1160#define MAC0_RX_DMA_ADDR 0xB4004100
1161#define MAC1_RX_DMA_ADDR 0xB4004300
1162/* offsets from MAC_RX_RING_ADDR */
1163#define MAC_RX_BUFF0_STATUS 0x0
1164# define RX_FRAME_LEN_MASK 0x3fff
1165# define RX_WDOG_TIMER (1 << 14)
1166# define RX_RUNT (1 << 15)
1167# define RX_OVERLEN (1 << 16)
1168# define RX_COLL (1 << 17)
1169# define RX_ETHER (1 << 18)
1170# define RX_MII_ERROR (1 << 19)
1171# define RX_DRIBBLING (1 << 20)
1172# define RX_CRC_ERROR (1 << 21)
1173# define RX_VLAN1 (1 << 22)
1174# define RX_VLAN2 (1 << 23)
1175# define RX_LEN_ERROR (1 << 24)
1176# define RX_CNTRL_FRAME (1 << 25)
1177# define RX_U_CNTRL_FRAME (1 << 26)
1178# define RX_MCAST_FRAME (1 << 27)
1179# define RX_BCAST_FRAME (1 << 28)
1180# define RX_FILTER_FAIL (1 << 29)
1181# define RX_PACKET_FILTER (1 << 30)
1182# define RX_MISSED_FRAME (1 << 31)
1183
1184# define RX_ERROR (RX_WDOG_TIMER | RX_RUNT | RX_OVERLEN | \
1185 RX_COLL | RX_MII_ERROR | RX_CRC_ERROR | \
1186 RX_LEN_ERROR | RX_U_CNTRL_FRAME | RX_MISSED_FRAME)
1187#define MAC_RX_BUFF0_ADDR 0x4
1188# define RX_DMA_ENABLE (1 << 0)
1189# define RX_T_DONE (1 << 1)
1190# define RX_GET_DMA_BUFFER(X) (((X) >> 2) & 0x3)
1191# define RX_SET_BUFF_ADDR(X) ((X) & 0xffffffc0)
1192#define MAC_RX_BUFF1_STATUS 0x10
1193#define MAC_RX_BUFF1_ADDR 0x14
1194#define MAC_RX_BUFF2_STATUS 0x20
1195#define MAC_RX_BUFF2_ADDR 0x24
1196#define MAC_RX_BUFF3_STATUS 0x30
1197#define MAC_RX_BUFF3_ADDR 0x34
1198
1199/* UARTS 0-3 */
1200#define UART_BASE UART0_ADDR
1201#ifdef CONFIG_SOC_AU1200
1202#define UART_DEBUG_BASE UART1_ADDR
1203#else
1204#define UART_DEBUG_BASE UART3_ADDR
1205#endif
1206
1207#define UART_RX 0 /* Receive buffer */
1208#define UART_TX 4 /* Transmit buffer */
1209#define UART_IER 8 /* Interrupt Enable Register */
1210#define UART_IIR 0xC /* Interrupt ID Register */
1211#define UART_FCR 0x10 /* FIFO Control Register */
1212#define UART_LCR 0x14 /* Line Control Register */
1213#define UART_MCR 0x18 /* Modem Control Register */
1214#define UART_LSR 0x1C /* Line Status Register */
1215#define UART_MSR 0x20 /* Modem Status Register */
1216#define UART_CLK 0x28 /* Baud Rate Clock Divider */
1217#define UART_MOD_CNTRL 0x100 /* Module Control */
1218
1219#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
1220#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
1221#define UART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */
1222#define UART_FCR_DMA_SELECT 0x08 /* For DMA applications */
1223#define UART_FCR_TRIGGER_MASK 0xF0 /* Mask for the FIFO trigger range */
1224#define UART_FCR_R_TRIGGER_1 0x00 /* Mask for receive trigger set at 1 */
1225#define UART_FCR_R_TRIGGER_4 0x40 /* Mask for receive trigger set at 4 */
1226#define UART_FCR_R_TRIGGER_8 0x80 /* Mask for receive trigger set at 8 */
1227#define UART_FCR_R_TRIGGER_14 0xA0 /* Mask for receive trigger set at 14 */
1228#define UART_FCR_T_TRIGGER_0 0x00 /* Mask for transmit trigger set at 0 */
1229#define UART_FCR_T_TRIGGER_4 0x10 /* Mask for transmit trigger set at 4 */
1230#define UART_FCR_T_TRIGGER_8 0x20 /* Mask for transmit trigger set at 8 */
1231#define UART_FCR_T_TRIGGER_12 0x30 /* Mask for transmit trigger set at 12 */
1232
1233/*
1234 * These are the definitions for the Line Control Register
1235 */
1236#define UART_LCR_SBC 0x40 /* Set break control */
1237#define UART_LCR_SPAR 0x20 /* Stick parity (?) */
1238#define UART_LCR_EPAR 0x10 /* Even parity select */
1239#define UART_LCR_PARITY 0x08 /* Parity Enable */
1240#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */
1241#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */
1242#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */
1243#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */
1244#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */
1245
1246/*
1247 * These are the definitions for the Line Status Register
1248 */
1249#define UART_LSR_TEMT 0x40 /* Transmitter empty */
1250#define UART_LSR_THRE 0x20 /* Transmit-hold-register empty */
1251#define UART_LSR_BI 0x10 /* Break interrupt indicator */
1252#define UART_LSR_FE 0x08 /* Frame error indicator */
1253#define UART_LSR_PE 0x04 /* Parity error indicator */
1254#define UART_LSR_OE 0x02 /* Overrun error indicator */
1255#define UART_LSR_DR 0x01 /* Receiver data ready */
1256
1257/*
1258 * These are the definitions for the Interrupt Identification Register
1259 */
1260#define UART_IIR_NO_INT 0x01 /* No interrupts pending */
1261#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */
1262#define UART_IIR_MSI 0x00 /* Modem status interrupt */
1263#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
1264#define UART_IIR_RDI 0x04 /* Receiver data interrupt */
1265#define UART_IIR_RLSI 0x06 /* Receiver line status interrupt */
1266
1267/*
1268 * These are the definitions for the Interrupt Enable Register
1269 */
1270#define UART_IER_MSI 0x08 /* Enable Modem status interrupt */
1271#define UART_IER_RLSI 0x04 /* Enable receiver line status interrupt */
1272#define UART_IER_THRI 0x02 /* Enable Transmitter holding register int. */
1273#define UART_IER_RDI 0x01 /* Enable receiver data interrupt */
1274
1275/*
1276 * These are the definitions for the Modem Control Register
1277 */
1278#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
1279#define UART_MCR_OUT2 0x08 /* Out2 complement */
1280#define UART_MCR_OUT1 0x04 /* Out1 complement */
1281#define UART_MCR_RTS 0x02 /* RTS complement */
1282#define UART_MCR_DTR 0x01 /* DTR complement */
1283
1284/*
1285 * These are the definitions for the Modem Status Register
1286 */
1287#define UART_MSR_DCD 0x80 /* Data Carrier Detect */
1288#define UART_MSR_RI 0x40 /* Ring Indicator */
1289#define UART_MSR_DSR 0x20 /* Data Set Ready */
1290#define UART_MSR_CTS 0x10 /* Clear to Send */
1291#define UART_MSR_DDCD 0x08 /* Delta DCD */
1292#define UART_MSR_TERI 0x04 /* Trailing edge ring indicator */
1293#define UART_MSR_DDSR 0x02 /* Delta DSR */
1294#define UART_MSR_DCTS 0x01 /* Delta CTS */
1295#define UART_MSR_ANY_DELTA 0x0F /* Any of the delta bits! */
1296
1297/* SSIO */
1298#define SSI0_STATUS 0xB1600000
1299# define SSI_STATUS_BF (1 << 4)
1300# define SSI_STATUS_OF (1 << 3)
1301# define SSI_STATUS_UF (1 << 2)
1302# define SSI_STATUS_D (1 << 1)
1303# define SSI_STATUS_B (1 << 0)
1304#define SSI0_INT 0xB1600004
1305# define SSI_INT_OI (1 << 3)
1306# define SSI_INT_UI (1 << 2)
1307# define SSI_INT_DI (1 << 1)
1308#define SSI0_INT_ENABLE 0xB1600008
1309# define SSI_INTE_OIE (1 << 3)
1310# define SSI_INTE_UIE (1 << 2)
1311# define SSI_INTE_DIE (1 << 1)
1312#define SSI0_CONFIG 0xB1600020
1313# define SSI_CONFIG_AO (1 << 24)
1314# define SSI_CONFIG_DO (1 << 23)
1315# define SSI_CONFIG_ALEN_BIT 20
1316# define SSI_CONFIG_ALEN_MASK (0x7 << 20)
1317# define SSI_CONFIG_DLEN_BIT 16
1318# define SSI_CONFIG_DLEN_MASK (0x7 << 16)
1319# define SSI_CONFIG_DD (1 << 11)
1320# define SSI_CONFIG_AD (1 << 10)
1321# define SSI_CONFIG_BM_BIT 8
1322# define SSI_CONFIG_BM_MASK (0x3 << 8)
1323# define SSI_CONFIG_CE (1 << 7)
1324# define SSI_CONFIG_DP (1 << 6)
1325# define SSI_CONFIG_DL (1 << 5)
1326# define SSI_CONFIG_EP (1 << 4)
1327#define SSI0_ADATA 0xB1600024
1328# define SSI_AD_D (1 << 24)
1329# define SSI_AD_ADDR_BIT 16
1330# define SSI_AD_ADDR_MASK (0xff << 16)
1331# define SSI_AD_DATA_BIT 0
1332# define SSI_AD_DATA_MASK (0xfff << 0)
1333#define SSI0_CLKDIV 0xB1600028
1334#define SSI0_CONTROL 0xB1600100
1335# define SSI_CONTROL_CD (1 << 1)
1336# define SSI_CONTROL_E (1 << 0)
1337
1338/* SSI1 */
1339#define SSI1_STATUS 0xB1680000
1340#define SSI1_INT 0xB1680004
1341#define SSI1_INT_ENABLE 0xB1680008
1342#define SSI1_CONFIG 0xB1680020
1343#define SSI1_ADATA 0xB1680024
1344#define SSI1_CLKDIV 0xB1680028
1345#define SSI1_ENABLE 0xB1680100
1346
1347/*
1348 * Register content definitions
1349 */
1350#define SSI_STATUS_BF (1 << 4)
1351#define SSI_STATUS_OF (1 << 3)
1352#define SSI_STATUS_UF (1 << 2)
1353#define SSI_STATUS_D (1 << 1)
1354#define SSI_STATUS_B (1 << 0)
1355
1356/* SSI_INT */
1357#define SSI_INT_OI (1 << 3)
1358#define SSI_INT_UI (1 << 2)
1359#define SSI_INT_DI (1 << 1)
1360
1361/* SSI_INTEN */
1362#define SSI_INTEN_OIE (1 << 3)
1363#define SSI_INTEN_UIE (1 << 2)
1364#define SSI_INTEN_DIE (1 << 1)
1365
1366#define SSI_CONFIG_AO (1 << 24)
1367#define SSI_CONFIG_DO (1 << 23)
1368#define SSI_CONFIG_ALEN (7 << 20)
1369#define SSI_CONFIG_DLEN (15 << 16)
1370#define SSI_CONFIG_DD (1 << 11)
1371#define SSI_CONFIG_AD (1 << 10)
1372#define SSI_CONFIG_BM (3 << 8)
1373#define SSI_CONFIG_CE (1 << 7)
1374#define SSI_CONFIG_DP (1 << 6)
1375#define SSI_CONFIG_DL (1 << 5)
1376#define SSI_CONFIG_EP (1 << 4)
1377#define SSI_CONFIG_ALEN_N(N) ((N-1) << 20)
1378#define SSI_CONFIG_DLEN_N(N) ((N-1) << 16)
1379#define SSI_CONFIG_BM_HI (0 << 8)
1380#define SSI_CONFIG_BM_LO (1 << 8)
1381#define SSI_CONFIG_BM_CY (2 << 8)
1382
1383#define SSI_ADATA_D (1 << 24)
1384#define SSI_ADATA_ADDR (0xFF << 16)
1385#define SSI_ADATA_DATA 0x0FFF
1386#define SSI_ADATA_ADDR_N(N) (N << 16)
1387
1388#define SSI_ENABLE_CD (1 << 1)
1389#define SSI_ENABLE_E (1 << 0)
1390
1391/* IrDA Controller */
1392#define IRDA_BASE 0xB0300000
1393#define IR_RING_PTR_STATUS (IRDA_BASE + 0x00)
1394#define IR_RING_BASE_ADDR_H (IRDA_BASE + 0x04)
1395#define IR_RING_BASE_ADDR_L (IRDA_BASE + 0x08)
1396#define IR_RING_SIZE (IRDA_BASE + 0x0C)
1397#define IR_RING_PROMPT (IRDA_BASE + 0x10)
1398#define IR_RING_ADDR_CMPR (IRDA_BASE + 0x14)
1399#define IR_INT_CLEAR (IRDA_BASE + 0x18)
1400#define IR_CONFIG_1 (IRDA_BASE + 0x20)
1401# define IR_RX_INVERT_LED (1 << 0)
1402# define IR_TX_INVERT_LED (1 << 1)
1403# define IR_ST (1 << 2)
1404# define IR_SF (1 << 3)
1405# define IR_SIR (1 << 4)
1406# define IR_MIR (1 << 5)
1407# define IR_FIR (1 << 6)
1408# define IR_16CRC (1 << 7)
1409# define IR_TD (1 << 8)
1410# define IR_RX_ALL (1 << 9)
1411# define IR_DMA_ENABLE (1 << 10)
1412# define IR_RX_ENABLE (1 << 11)
1413# define IR_TX_ENABLE (1 << 12)
1414# define IR_LOOPBACK (1 << 14)
1415# define IR_SIR_MODE (IR_SIR | IR_DMA_ENABLE | \
1416 IR_RX_ALL | IR_RX_ENABLE | IR_SF | IR_16CRC)
1417#define IR_SIR_FLAGS (IRDA_BASE + 0x24)
1418#define IR_ENABLE (IRDA_BASE + 0x28)
1419# define IR_RX_STATUS (1 << 9)
1420# define IR_TX_STATUS (1 << 10)
1421#define IR_READ_PHY_CONFIG (IRDA_BASE + 0x2C)
1422#define IR_WRITE_PHY_CONFIG (IRDA_BASE + 0x30)
1423#define IR_MAX_PKT_LEN (IRDA_BASE + 0x34)
1424#define IR_RX_BYTE_CNT (IRDA_BASE + 0x38)
1425#define IR_CONFIG_2 (IRDA_BASE + 0x3C)
1426# define IR_MODE_INV (1 << 0)
1427# define IR_ONE_PIN (1 << 1)
1428#define IR_INTERFACE_CONFIG (IRDA_BASE + 0x40)
1429
1430/* GPIO */
1431#define SYS_PINFUNC 0xB190002C
1432# define SYS_PF_USB (1 << 15) /* 2nd USB device/host */
1433# define SYS_PF_U3 (1 << 14) /* GPIO23/U3TXD */
1434# define SYS_PF_U2 (1 << 13) /* GPIO22/U2TXD */
1435# define SYS_PF_U1 (1 << 12) /* GPIO21/U1TXD */
1436# define SYS_PF_SRC (1 << 11) /* GPIO6/SROMCKE */
1437# define SYS_PF_CK5 (1 << 10) /* GPIO3/CLK5 */
1438# define SYS_PF_CK4 (1 << 9) /* GPIO2/CLK4 */
1439# define SYS_PF_IRF (1 << 8) /* GPIO15/IRFIRSEL */
1440# define SYS_PF_UR3 (1 << 7) /* GPIO[14:9]/UART3 */
1441# define SYS_PF_I2D (1 << 6) /* GPIO8/I2SDI */
1442# define SYS_PF_I2S (1 << 5) /* I2S/GPIO[29:31] */
1443# define SYS_PF_NI2 (1 << 4) /* NI2/GPIO[24:28] */
1444# define SYS_PF_U0 (1 << 3) /* U0TXD/GPIO20 */
1445# define SYS_PF_RD (1 << 2) /* IRTXD/GPIO19 */
1446# define SYS_PF_A97 (1 << 1) /* AC97/SSL1 */
1447# define SYS_PF_S0 (1 << 0) /* SSI_0/GPIO[16:18] */
1448
1449/* Au1100 only */
1450# define SYS_PF_PC (1 << 18) /* PCMCIA/GPIO[207:204] */
1451# define SYS_PF_LCD (1 << 17) /* extern lcd/GPIO[203:200] */
1452# define SYS_PF_CS (1 << 16) /* EXTCLK0/32KHz to gpio2 */
1453# define SYS_PF_EX0 (1 << 9) /* GPIO2/clock */
1454
1455/* Au1550 only. Redefines lots of pins */
1456# define SYS_PF_PSC2_MASK (7 << 17)
1457# define SYS_PF_PSC2_AC97 0
1458# define SYS_PF_PSC2_SPI 0
1459# define SYS_PF_PSC2_I2S (1 << 17)
1460# define SYS_PF_PSC2_SMBUS (3 << 17)
1461# define SYS_PF_PSC2_GPIO (7 << 17)
1462# define SYS_PF_PSC3_MASK (7 << 20)
1463# define SYS_PF_PSC3_AC97 0
1464# define SYS_PF_PSC3_SPI 0
1465# define SYS_PF_PSC3_I2S (1 << 20)
1466# define SYS_PF_PSC3_SMBUS (3 << 20)
1467# define SYS_PF_PSC3_GPIO (7 << 20)
1468# define SYS_PF_PSC1_S1 (1 << 1)
1469# define SYS_PF_MUST_BE_SET ((1 << 5) | (1 << 2))
1470
1471/* Au1200 only */
1472#ifdef CONFIG_SOC_AU1200
1473#define SYS_PINFUNC_DMA (1 << 31)
1474#define SYS_PINFUNC_S0A (1 << 30)
1475#define SYS_PINFUNC_S1A (1 << 29)
1476#define SYS_PINFUNC_LP0 (1 << 28)
1477#define SYS_PINFUNC_LP1 (1 << 27)
1478#define SYS_PINFUNC_LD16 (1 << 26)
1479#define SYS_PINFUNC_LD8 (1 << 25)
1480#define SYS_PINFUNC_LD1 (1 << 24)
1481#define SYS_PINFUNC_LD0 (1 << 23)
1482#define SYS_PINFUNC_P1A (3 << 21)
1483#define SYS_PINFUNC_P1B (1 << 20)
1484#define SYS_PINFUNC_FS3 (1 << 19)
1485#define SYS_PINFUNC_P0A (3 << 17)
1486#define SYS_PINFUNC_CS (1 << 16)
1487#define SYS_PINFUNC_CIM (1 << 15)
1488#define SYS_PINFUNC_P1C (1 << 14)
1489#define SYS_PINFUNC_U1T (1 << 12)
1490#define SYS_PINFUNC_U1R (1 << 11)
1491#define SYS_PINFUNC_EX1 (1 << 10)
1492#define SYS_PINFUNC_EX0 (1 << 9)
1493#define SYS_PINFUNC_U0R (1 << 8)
1494#define SYS_PINFUNC_MC (1 << 7)
1495#define SYS_PINFUNC_S0B (1 << 6)
1496#define SYS_PINFUNC_S0C (1 << 5)
1497#define SYS_PINFUNC_P0B (1 << 4)
1498#define SYS_PINFUNC_U0T (1 << 3)
1499#define SYS_PINFUNC_S1B (1 << 2)
1500#endif
1501
1502#define SYS_TRIOUTRD 0xB1900100
1503#define SYS_TRIOUTCLR 0xB1900100
1504#define SYS_OUTPUTRD 0xB1900108
1505#define SYS_OUTPUTSET 0xB1900108
1506#define SYS_OUTPUTCLR 0xB190010C
1507#define SYS_PINSTATERD 0xB1900110
1508#define SYS_PININPUTEN 0xB1900110
1509
1510/* GPIO2, Au1500, Au1550 only */
1511#define GPIO2_BASE 0xB1700000
1512#define GPIO2_DIR (GPIO2_BASE + 0)
1513#define GPIO2_OUTPUT (GPIO2_BASE + 8)
1514#define GPIO2_PINSTATE (GPIO2_BASE + 0xC)
1515#define GPIO2_INTENABLE (GPIO2_BASE + 0x10)
1516#define GPIO2_ENABLE (GPIO2_BASE + 0x14)
1517
1518/* Power Management */
1519#define SYS_SCRATCH0 0xB1900018
1520#define SYS_SCRATCH1 0xB190001C
1521#define SYS_WAKEMSK 0xB1900034
1522#define SYS_ENDIAN 0xB1900038
1523#define SYS_POWERCTRL 0xB190003C
1524#define SYS_WAKESRC 0xB190005C
1525#define SYS_SLPPWR 0xB1900078
1526#define SYS_SLEEP 0xB190007C
1527
1528/* Clock Controller */
1529#define SYS_FREQCTRL0 0xB1900020
1530# define SYS_FC_FRDIV2_BIT 22
1531# define SYS_FC_FRDIV2_MASK (0xff << SYS_FC_FRDIV2_BIT)
1532# define SYS_FC_FE2 (1 << 21)
1533# define SYS_FC_FS2 (1 << 20)
1534# define SYS_FC_FRDIV1_BIT 12
1535# define SYS_FC_FRDIV1_MASK (0xff << SYS_FC_FRDIV1_BIT)
1536# define SYS_FC_FE1 (1 << 11)
1537# define SYS_FC_FS1 (1 << 10)
1538# define SYS_FC_FRDIV0_BIT 2
1539# define SYS_FC_FRDIV0_MASK (0xff << SYS_FC_FRDIV0_BIT)
1540# define SYS_FC_FE0 (1 << 1)
1541# define SYS_FC_FS0 (1 << 0)
1542#define SYS_FREQCTRL1 0xB1900024
1543# define SYS_FC_FRDIV5_BIT 22
1544# define SYS_FC_FRDIV5_MASK (0xff << SYS_FC_FRDIV5_BIT)
1545# define SYS_FC_FE5 (1 << 21)
1546# define SYS_FC_FS5 (1 << 20)
1547# define SYS_FC_FRDIV4_BIT 12
1548# define SYS_FC_FRDIV4_MASK (0xff << SYS_FC_FRDIV4_BIT)
1549# define SYS_FC_FE4 (1 << 11)
1550# define SYS_FC_FS4 (1 << 10)
1551# define SYS_FC_FRDIV3_BIT 2
1552# define SYS_FC_FRDIV3_MASK (0xff << SYS_FC_FRDIV3_BIT)
1553# define SYS_FC_FE3 (1 << 1)
1554# define SYS_FC_FS3 (1 << 0)
1555#define SYS_CLKSRC 0xB1900028
1556# define SYS_CS_ME1_BIT 27
1557# define SYS_CS_ME1_MASK (0x7 << SYS_CS_ME1_BIT)
1558# define SYS_CS_DE1 (1 << 26)
1559# define SYS_CS_CE1 (1 << 25)
1560# define SYS_CS_ME0_BIT 22
1561# define SYS_CS_ME0_MASK (0x7 << SYS_CS_ME0_BIT)
1562# define SYS_CS_DE0 (1 << 21)
1563# define SYS_CS_CE0 (1 << 20)
1564# define SYS_CS_MI2_BIT 17
1565# define SYS_CS_MI2_MASK (0x7 << SYS_CS_MI2_BIT)
1566# define SYS_CS_DI2 (1 << 16)
1567# define SYS_CS_CI2 (1 << 15)
1568#ifdef CONFIG_SOC_AU1100
1569# define SYS_CS_ML_BIT 7
1570# define SYS_CS_ML_MASK (0x7 << SYS_CS_ML_BIT)
1571# define SYS_CS_DL (1 << 6)
1572# define SYS_CS_CL (1 << 5)
1573#else
1574# define SYS_CS_MUH_BIT 12
1575# define SYS_CS_MUH_MASK (0x7 << SYS_CS_MUH_BIT)
1576# define SYS_CS_DUH (1 << 11)
1577# define SYS_CS_CUH (1 << 10)
1578# define SYS_CS_MUD_BIT 7
1579# define SYS_CS_MUD_MASK (0x7 << SYS_CS_MUD_BIT)
1580# define SYS_CS_DUD (1 << 6)
1581# define SYS_CS_CUD (1 << 5)
1582#endif
1583# define SYS_CS_MIR_BIT 2
1584# define SYS_CS_MIR_MASK (0x7 << SYS_CS_MIR_BIT)
1585# define SYS_CS_DIR (1 << 1)
1586# define SYS_CS_CIR (1 << 0)
1587
1588# define SYS_CS_MUX_AUX 0x1
1589# define SYS_CS_MUX_FQ0 0x2
1590# define SYS_CS_MUX_FQ1 0x3
1591# define SYS_CS_MUX_FQ2 0x4
1592# define SYS_CS_MUX_FQ3 0x5
1593# define SYS_CS_MUX_FQ4 0x6
1594# define SYS_CS_MUX_FQ5 0x7
1595#define SYS_CPUPLL 0xB1900060
1596#define SYS_AUXPLL 0xB1900064
1597
1598/* AC97 Controller */
1599#define AC97C_CONFIG 0xB0000000
1600# define AC97C_RECV_SLOTS_BIT 13
1601# define AC97C_RECV_SLOTS_MASK (0x3ff << AC97C_RECV_SLOTS_BIT)
1602# define AC97C_XMIT_SLOTS_BIT 3
1603# define AC97C_XMIT_SLOTS_MASK (0x3ff << AC97C_XMIT_SLOTS_BIT)
1604# define AC97C_SG (1 << 2)
1605# define AC97C_SYNC (1 << 1)
1606# define AC97C_RESET (1 << 0)
1607#define AC97C_STATUS 0xB0000004
1608# define AC97C_XU (1 << 11)
1609# define AC97C_XO (1 << 10)
1610# define AC97C_RU (1 << 9)
1611# define AC97C_RO (1 << 8)
1612# define AC97C_READY (1 << 7)
1613# define AC97C_CP (1 << 6)
1614# define AC97C_TR (1 << 5)
1615# define AC97C_TE (1 << 4)
1616# define AC97C_TF (1 << 3)
1617# define AC97C_RR (1 << 2)
1618# define AC97C_RE (1 << 1)
1619# define AC97C_RF (1 << 0)
1620#define AC97C_DATA 0xB0000008
1621#define AC97C_CMD 0xB000000C
1622# define AC97C_WD_BIT 16
1623# define AC97C_READ (1 << 7)
1624# define AC97C_INDEX_MASK 0x7f
1625#define AC97C_CNTRL 0xB0000010
1626# define AC97C_RS (1 << 1)
1627# define AC97C_CE (1 << 0)
1628
1629/* Secure Digital (SD) Controller */
1630#define SD0_XMIT_FIFO 0xB0600000
1631#define SD0_RECV_FIFO 0xB0600004
1632#define SD1_XMIT_FIFO 0xB0680000
1633#define SD1_RECV_FIFO 0xB0680004
1634
1635#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
1636/* Au1500 PCI Controller */
1637#define Au1500_CFG_BASE 0xB4005000 /* virtual, KSEG1 addr */
1638#define Au1500_PCI_CMEM (Au1500_CFG_BASE + 0)
1639#define Au1500_PCI_CFG (Au1500_CFG_BASE + 4)
1640# define PCI_ERROR ((1 << 22) | (1 << 23) | (1 << 24) | \
1641 (1 << 25) | (1 << 26) | (1 << 27))
1642#define Au1500_PCI_B2BMASK_CCH (Au1500_CFG_BASE + 8)
1643#define Au1500_PCI_B2B0_VID (Au1500_CFG_BASE + 0xC)
1644#define Au1500_PCI_B2B1_ID (Au1500_CFG_BASE + 0x10)
1645#define Au1500_PCI_MWMASK_DEV (Au1500_CFG_BASE + 0x14)
1646#define Au1500_PCI_MWBASE_REV_CCL (Au1500_CFG_BASE + 0x18)
1647#define Au1500_PCI_ERR_ADDR (Au1500_CFG_BASE + 0x1C)
1648#define Au1500_PCI_SPEC_INTACK (Au1500_CFG_BASE + 0x20)
1649#define Au1500_PCI_ID (Au1500_CFG_BASE + 0x100)
1650#define Au1500_PCI_STATCMD (Au1500_CFG_BASE + 0x104)
1651#define Au1500_PCI_CLASSREV (Au1500_CFG_BASE + 0x108)
1652#define Au1500_PCI_HDRTYPE (Au1500_CFG_BASE + 0x10C)
1653#define Au1500_PCI_MBAR (Au1500_CFG_BASE + 0x110)
1654
1655#define Au1500_PCI_HDR 0xB4005100 /* virtual, KSEG1 addr */
1656
1657/*
1658 * All of our structures, like PCI resource, have 32-bit members.
1659 * Drivers are expected to do an ioremap on the PCI MEM resource, but it's
1660 * hard to store 0x4 0000 0000 in a 32-bit type. We require a small patch
1661 * to __ioremap to check for addresses between (u32)Au1500_PCI_MEM_START and
1662 * (u32)Au1500_PCI_MEM_END and change those to the full 36-bit PCI MEM
1663 * addresses. For PCI I/O, it's simpler because we get to do the ioremap
1664 * ourselves and then adjust the device's resources.
1665 */
1666#define Au1500_EXT_CFG 0x600000000ULL
1667#define Au1500_EXT_CFG_TYPE1 0x680000000ULL
1668#define Au1500_PCI_IO_START 0x500000000ULL
1669#define Au1500_PCI_IO_END 0x5000FFFFFULL
1670#define Au1500_PCI_MEM_START 0x440000000ULL
1671#define Au1500_PCI_MEM_END 0x44FFFFFFFULL
1672
1673#define PCI_IO_START 0x00001000
1674#define PCI_IO_END 0x000FFFFF
1675#define PCI_MEM_START 0x40000000
1676#define PCI_MEM_END 0x4FFFFFFF
1677
1678#define PCI_FIRST_DEVFN (0 << 3)
1679#define PCI_LAST_DEVFN (19 << 3)
1680
1681#define IOPORT_RESOURCE_START 0x00001000 /* skip legacy probing */
1682#define IOPORT_RESOURCE_END 0xffffffff
1683#define IOMEM_RESOURCE_START 0x10000000
1684#define IOMEM_RESOURCE_END 0xffffffff
1685
1686#else /* Au1000 and Au1100 and Au1200 */
1687
1688/* Don't allow any legacy ports probing */
1689#define IOPORT_RESOURCE_START 0x10000000
1690#define IOPORT_RESOURCE_END 0xffffffff
1691#define IOMEM_RESOURCE_START 0x10000000
1692#define IOMEM_RESOURCE_END 0xffffffff
1693
1694#define PCI_IO_START 0
1695#define PCI_IO_END 0
1696#define PCI_MEM_START 0
1697#define PCI_MEM_END 0
1698#define PCI_FIRST_DEVFN 0
1699#define PCI_LAST_DEVFN 0
1700
1701#endif
1702
1703#ifndef _LANGUAGE_ASSEMBLY
1704typedef volatile struct {
1705 /* 0x0000 */ u32 toytrim;
1706 /* 0x0004 */ u32 toywrite;
1707 /* 0x0008 */ u32 toymatch0;
1708 /* 0x000C */ u32 toymatch1;
1709 /* 0x0010 */ u32 toymatch2;
1710 /* 0x0014 */ u32 cntrctrl;
1711 /* 0x0018 */ u32 scratch0;
1712 /* 0x001C */ u32 scratch1;
1713 /* 0x0020 */ u32 freqctrl0;
1714 /* 0x0024 */ u32 freqctrl1;
1715 /* 0x0028 */ u32 clksrc;
1716 /* 0x002C */ u32 pinfunc;
1717 /* 0x0030 */ u32 reserved0;
1718 /* 0x0034 */ u32 wakemsk;
1719 /* 0x0038 */ u32 endian;
1720 /* 0x003C */ u32 powerctrl;
1721 /* 0x0040 */ u32 toyread;
1722 /* 0x0044 */ u32 rtctrim;
1723 /* 0x0048 */ u32 rtcwrite;
1724 /* 0x004C */ u32 rtcmatch0;
1725 /* 0x0050 */ u32 rtcmatch1;
1726 /* 0x0054 */ u32 rtcmatch2;
1727 /* 0x0058 */ u32 rtcread;
1728 /* 0x005C */ u32 wakesrc;
1729 /* 0x0060 */ u32 cpupll;
1730 /* 0x0064 */ u32 auxpll;
1731 /* 0x0068 */ u32 reserved1;
1732 /* 0x006C */ u32 reserved2;
1733 /* 0x0070 */ u32 reserved3;
1734 /* 0x0074 */ u32 reserved4;
1735 /* 0x0078 */ u32 slppwr;
1736 /* 0x007C */ u32 sleep;
1737 /* 0x0080 */ u32 reserved5[32];
1738 /* 0x0100 */ u32 trioutrd;
1739#define trioutclr trioutrd
1740 /* 0x0104 */ u32 reserved6;
1741 /* 0x0108 */ u32 outputrd;
1742#define outputset outputrd
1743 /* 0x010C */ u32 outputclr;
1744 /* 0x0110 */ u32 pinstaterd;
1745#define pininputen pinstaterd
1746} AU1X00_SYS;
1747
1748static AU1X00_SYS * const sys = (AU1X00_SYS *)SYS_BASE;
1749
1750#endif
1751
1752/*
1753 * Processor information based on PRID.
1754 * Copied from PowerPC.
1755 */
1756#ifndef _LANGUAGE_ASSEMBLY
1757struct cpu_spec {
1758 /* CPU is matched via (PRID & prid_mask) == prid_value */
1759 unsigned int prid_mask;
1760 unsigned int prid_value;
1761
1762 char *cpu_name;
1763 unsigned char cpu_od; /* Set Config[OD] */
1764 unsigned char cpu_bclk; /* Enable BCLK switching */
1765 unsigned char cpu_pll_wo; /* sys_cpupll reg. write-only */
1766};
1767
1768extern struct cpu_spec cpu_specs[];
1769extern struct cpu_spec *cur_cpu_spec[];
1770#endif
1771
1772#endif
diff --git a/include/asm-mips/mach-au1x00/au1000_dma.h b/include/asm-mips/mach-au1x00/au1000_dma.h
deleted file mode 100644
index c333b4e1cd44..000000000000
--- a/include/asm-mips/mach-au1x00/au1000_dma.h
+++ /dev/null
@@ -1,458 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Defines for using and allocating DMA channels on the Alchemy
4 * Au1x00 MIPS processors.
5 *
6 * Copyright 2000, 2008 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc. <source@mvista.com>
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 */
30#ifndef __ASM_AU1000_DMA_H
31#define __ASM_AU1000_DMA_H
32
33#include <linux/io.h> /* need byte IO */
34#include <linux/spinlock.h> /* And spinlocks */
35#include <linux/delay.h>
36#include <asm/system.h>
37
38#define NUM_AU1000_DMA_CHANNELS 8
39
40/* DMA Channel Base Addresses */
41#define DMA_CHANNEL_BASE 0xB4002000
42#define DMA_CHANNEL_LEN 0x00000100
43
44/* DMA Channel Register Offsets */
45#define DMA_MODE_SET 0x00000000
46#define DMA_MODE_READ DMA_MODE_SET
47#define DMA_MODE_CLEAR 0x00000004
48/* DMA Mode register bits follow */
49#define DMA_DAH_MASK (0x0f << 20)
50#define DMA_DID_BIT 16
51#define DMA_DID_MASK (0x0f << DMA_DID_BIT)
52#define DMA_DS (1 << 15)
53#define DMA_BE (1 << 13)
54#define DMA_DR (1 << 12)
55#define DMA_TS8 (1 << 11)
56#define DMA_DW_BIT 9
57#define DMA_DW_MASK (0x03 << DMA_DW_BIT)
58#define DMA_DW8 (0 << DMA_DW_BIT)
59#define DMA_DW16 (1 << DMA_DW_BIT)
60#define DMA_DW32 (2 << DMA_DW_BIT)
61#define DMA_NC (1 << 8)
62#define DMA_IE (1 << 7)
63#define DMA_HALT (1 << 6)
64#define DMA_GO (1 << 5)
65#define DMA_AB (1 << 4)
66#define DMA_D1 (1 << 3)
67#define DMA_BE1 (1 << 2)
68#define DMA_D0 (1 << 1)
69#define DMA_BE0 (1 << 0)
70
71#define DMA_PERIPHERAL_ADDR 0x00000008
72#define DMA_BUFFER0_START 0x0000000C
73#define DMA_BUFFER1_START 0x00000014
74#define DMA_BUFFER0_COUNT 0x00000010
75#define DMA_BUFFER1_COUNT 0x00000018
76#define DMA_BAH_BIT 16
77#define DMA_BAH_MASK (0x0f << DMA_BAH_BIT)
78#define DMA_COUNT_BIT 0
79#define DMA_COUNT_MASK (0xffff << DMA_COUNT_BIT)
80
81/* DMA Device IDs follow */
82enum {
83 DMA_ID_UART0_TX = 0,
84 DMA_ID_UART0_RX,
85 DMA_ID_GP04,
86 DMA_ID_GP05,
87 DMA_ID_AC97C_TX,
88 DMA_ID_AC97C_RX,
89 DMA_ID_UART3_TX,
90 DMA_ID_UART3_RX,
91 DMA_ID_USBDEV_EP0_RX,
92 DMA_ID_USBDEV_EP0_TX,
93 DMA_ID_USBDEV_EP2_TX,
94 DMA_ID_USBDEV_EP3_TX,
95 DMA_ID_USBDEV_EP4_RX,
96 DMA_ID_USBDEV_EP5_RX,
97 DMA_ID_I2S_TX,
98 DMA_ID_I2S_RX,
99 DMA_NUM_DEV
100};
101
102/* DMA Device ID's for 2nd bank (AU1100) follow */
103enum {
104 DMA_ID_SD0_TX = 0,
105 DMA_ID_SD0_RX,
106 DMA_ID_SD1_TX,
107 DMA_ID_SD1_RX,
108 DMA_NUM_DEV_BANK2
109};
110
111struct dma_chan {
112 int dev_id; /* this channel is allocated if >= 0, */
113 /* free otherwise */
114 unsigned int io;
115 const char *dev_str;
116 int irq;
117 void *irq_dev;
118 unsigned int fifo_addr;
119 unsigned int mode;
120};
121
122/* These are in arch/mips/au1000/common/dma.c */
123extern struct dma_chan au1000_dma_table[];
124extern int request_au1000_dma(int dev_id,
125 const char *dev_str,
126 irq_handler_t irqhandler,
127 unsigned long irqflags,
128 void *irq_dev_id);
129extern void free_au1000_dma(unsigned int dmanr);
130extern int au1000_dma_read_proc(char *buf, char **start, off_t fpos,
131 int length, int *eof, void *data);
132extern void dump_au1000_dma_channel(unsigned int dmanr);
133extern spinlock_t au1000_dma_spin_lock;
134
135static inline struct dma_chan *get_dma_chan(unsigned int dmanr)
136{
137 if (dmanr >= NUM_AU1000_DMA_CHANNELS ||
138 au1000_dma_table[dmanr].dev_id < 0)
139 return NULL;
140 return &au1000_dma_table[dmanr];
141}
142
143static inline unsigned long claim_dma_lock(void)
144{
145 unsigned long flags;
146
147 spin_lock_irqsave(&au1000_dma_spin_lock, flags);
148 return flags;
149}
150
151static inline void release_dma_lock(unsigned long flags)
152{
153 spin_unlock_irqrestore(&au1000_dma_spin_lock, flags);
154}
155
156/*
157 * Set the DMA buffer enable bits in the mode register.
158 */
159static inline void enable_dma_buffer0(unsigned int dmanr)
160{
161 struct dma_chan *chan = get_dma_chan(dmanr);
162
163 if (!chan)
164 return;
165 au_writel(DMA_BE0, chan->io + DMA_MODE_SET);
166}
167
168static inline void enable_dma_buffer1(unsigned int dmanr)
169{
170 struct dma_chan *chan = get_dma_chan(dmanr);
171
172 if (!chan)
173 return;
174 au_writel(DMA_BE1, chan->io + DMA_MODE_SET);
175}
176static inline void enable_dma_buffers(unsigned int dmanr)
177{
178 struct dma_chan *chan = get_dma_chan(dmanr);
179
180 if (!chan)
181 return;
182 au_writel(DMA_BE0 | DMA_BE1, chan->io + DMA_MODE_SET);
183}
184
185static inline void start_dma(unsigned int dmanr)
186{
187 struct dma_chan *chan = get_dma_chan(dmanr);
188
189 if (!chan)
190 return;
191 au_writel(DMA_GO, chan->io + DMA_MODE_SET);
192}
193
194#define DMA_HALT_POLL 0x5000
195
196static inline void halt_dma(unsigned int dmanr)
197{
198 struct dma_chan *chan = get_dma_chan(dmanr);
199 int i;
200
201 if (!chan)
202 return;
203 au_writel(DMA_GO, chan->io + DMA_MODE_CLEAR);
204
205 /* Poll the halt bit */
206 for (i = 0; i < DMA_HALT_POLL; i++)
207 if (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT)
208 break;
209 if (i == DMA_HALT_POLL)
210 printk(KERN_INFO "halt_dma: HALT poll expired!\n");
211}
212
213static inline void disable_dma(unsigned int dmanr)
214{
215 struct dma_chan *chan = get_dma_chan(dmanr);
216
217 if (!chan)
218 return;
219
220 halt_dma(dmanr);
221
222 /* Now we can disable the buffers */
223 au_writel(~DMA_GO, chan->io + DMA_MODE_CLEAR);
224}
225
226static inline int dma_halted(unsigned int dmanr)
227{
228 struct dma_chan *chan = get_dma_chan(dmanr);
229
230 if (!chan)
231 return 1;
232 return (au_readl(chan->io + DMA_MODE_READ) & DMA_HALT) ? 1 : 0;
233}
234
235/* Initialize a DMA channel. */
236static inline void init_dma(unsigned int dmanr)
237{
238 struct dma_chan *chan = get_dma_chan(dmanr);
239 u32 mode;
240
241 if (!chan)
242 return;
243
244 disable_dma(dmanr);
245
246 /* Set device FIFO address */
247 au_writel(CPHYSADDR(chan->fifo_addr), chan->io + DMA_PERIPHERAL_ADDR);
248
249 mode = chan->mode | (chan->dev_id << DMA_DID_BIT);
250 if (chan->irq)
251 mode |= DMA_IE;
252
253 au_writel(~mode, chan->io + DMA_MODE_CLEAR);
254 au_writel(mode, chan->io + DMA_MODE_SET);
255}
256
257/*
258 * Set mode for a specific DMA channel
259 */
260static inline void set_dma_mode(unsigned int dmanr, unsigned int mode)
261{
262 struct dma_chan *chan = get_dma_chan(dmanr);
263
264 if (!chan)
265 return;
266 /*
267 * set_dma_mode is only allowed to change endianess, direction,
268 * transfer size, device FIFO width, and coherency settings.
269 * Make sure anything else is masked off.
270 */
271 mode &= (DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
272 chan->mode &= ~(DMA_BE | DMA_DR | DMA_TS8 | DMA_DW_MASK | DMA_NC);
273 chan->mode |= mode;
274}
275
276static inline unsigned int get_dma_mode(unsigned int dmanr)
277{
278 struct dma_chan *chan = get_dma_chan(dmanr);
279
280 if (!chan)
281 return 0;
282 return chan->mode;
283}
284
285static inline int get_dma_active_buffer(unsigned int dmanr)
286{
287 struct dma_chan *chan = get_dma_chan(dmanr);
288
289 if (!chan)
290 return -1;
291 return (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ? 1 : 0;
292}
293
294/*
295 * Set the device FIFO address for a specific DMA channel - only
296 * applicable to GPO4 and GPO5. All the other devices have fixed
297 * FIFO addresses.
298 */
299static inline void set_dma_fifo_addr(unsigned int dmanr, unsigned int a)
300{
301 struct dma_chan *chan = get_dma_chan(dmanr);
302
303 if (!chan)
304 return;
305
306 if (chan->mode & DMA_DS) /* second bank of device IDs */
307 return;
308
309 if (chan->dev_id != DMA_ID_GP04 && chan->dev_id != DMA_ID_GP05)
310 return;
311
312 au_writel(CPHYSADDR(a), chan->io + DMA_PERIPHERAL_ADDR);
313}
314
315/*
316 * Clear the DMA buffer done bits in the mode register.
317 */
318static inline void clear_dma_done0(unsigned int dmanr)
319{
320 struct dma_chan *chan = get_dma_chan(dmanr);
321
322 if (!chan)
323 return;
324 au_writel(DMA_D0, chan->io + DMA_MODE_CLEAR);
325}
326
327static inline void clear_dma_done1(unsigned int dmanr)
328{
329 struct dma_chan *chan = get_dma_chan(dmanr);
330
331 if (!chan)
332 return;
333 au_writel(DMA_D1, chan->io + DMA_MODE_CLEAR);
334}
335
336/*
337 * This does nothing - not applicable to Au1000 DMA.
338 */
339static inline void set_dma_page(unsigned int dmanr, char pagenr)
340{
341}
342
343/*
344 * Set Buffer 0 transfer address for specific DMA channel.
345 */
346static inline void set_dma_addr0(unsigned int dmanr, unsigned int a)
347{
348 struct dma_chan *chan = get_dma_chan(dmanr);
349
350 if (!chan)
351 return;
352 au_writel(a, chan->io + DMA_BUFFER0_START);
353}
354
355/*
356 * Set Buffer 1 transfer address for specific DMA channel.
357 */
358static inline void set_dma_addr1(unsigned int dmanr, unsigned int a)
359{
360 struct dma_chan *chan = get_dma_chan(dmanr);
361
362 if (!chan)
363 return;
364 au_writel(a, chan->io + DMA_BUFFER1_START);
365}
366
367
368/*
369 * Set Buffer 0 transfer size (max 64k) for a specific DMA channel.
370 */
371static inline void set_dma_count0(unsigned int dmanr, unsigned int count)
372{
373 struct dma_chan *chan = get_dma_chan(dmanr);
374
375 if (!chan)
376 return;
377 count &= DMA_COUNT_MASK;
378 au_writel(count, chan->io + DMA_BUFFER0_COUNT);
379}
380
381/*
382 * Set Buffer 1 transfer size (max 64k) for a specific DMA channel.
383 */
384static inline void set_dma_count1(unsigned int dmanr, unsigned int count)
385{
386 struct dma_chan *chan = get_dma_chan(dmanr);
387
388 if (!chan)
389 return;
390 count &= DMA_COUNT_MASK;
391 au_writel(count, chan->io + DMA_BUFFER1_COUNT);
392}
393
394/*
395 * Set both buffer transfer sizes (max 64k) for a specific DMA channel.
396 */
397static inline void set_dma_count(unsigned int dmanr, unsigned int count)
398{
399 struct dma_chan *chan = get_dma_chan(dmanr);
400
401 if (!chan)
402 return;
403 count &= DMA_COUNT_MASK;
404 au_writel(count, chan->io + DMA_BUFFER0_COUNT);
405 au_writel(count, chan->io + DMA_BUFFER1_COUNT);
406}
407
408/*
409 * Returns which buffer has its done bit set in the mode register.
410 * Returns -1 if neither or both done bits set.
411 */
412static inline unsigned int get_dma_buffer_done(unsigned int dmanr)
413{
414 struct dma_chan *chan = get_dma_chan(dmanr);
415
416 if (!chan)
417 return 0;
418 return au_readl(chan->io + DMA_MODE_READ) & (DMA_D0 | DMA_D1);
419}
420
421
422/*
423 * Returns the DMA channel's Buffer Done IRQ number.
424 */
425static inline int get_dma_done_irq(unsigned int dmanr)
426{
427 struct dma_chan *chan = get_dma_chan(dmanr);
428
429 if (!chan)
430 return -1;
431 return chan->irq;
432}
433
434/*
435 * Get DMA residue count. Returns the number of _bytes_ left to transfer.
436 */
437static inline int get_dma_residue(unsigned int dmanr)
438{
439 int curBufCntReg, count;
440 struct dma_chan *chan = get_dma_chan(dmanr);
441
442 if (!chan)
443 return 0;
444
445 curBufCntReg = (au_readl(chan->io + DMA_MODE_READ) & DMA_AB) ?
446 DMA_BUFFER1_COUNT : DMA_BUFFER0_COUNT;
447
448 count = au_readl(chan->io + curBufCntReg) & DMA_COUNT_MASK;
449
450 if ((chan->mode & DMA_DW_MASK) == DMA_DW16)
451 count <<= 1;
452 else if ((chan->mode & DMA_DW_MASK) == DMA_DW32)
453 count <<= 2;
454
455 return count;
456}
457
458#endif /* __ASM_AU1000_DMA_H */
diff --git a/include/asm-mips/mach-au1x00/au1000_gpio.h b/include/asm-mips/mach-au1x00/au1000_gpio.h
deleted file mode 100644
index d8c96fda5549..000000000000
--- a/include/asm-mips/mach-au1x00/au1000_gpio.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * FILE NAME au1000_gpio.h
3 *
4 * BRIEF MODULE DESCRIPTION
5 * API to Alchemy Au1xx0 GPIO device.
6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Steve Longerbeam
9 *
10 * Copyright 2001, 2008 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __AU1000_GPIO_H
34#define __AU1000_GPIO_H
35
36#include <linux/ioctl.h>
37
38#define AU1000GPIO_IOC_MAGIC 'A'
39
40#define AU1000GPIO_IN _IOR(AU1000GPIO_IOC_MAGIC, 0, int)
41#define AU1000GPIO_SET _IOW(AU1000GPIO_IOC_MAGIC, 1, int)
42#define AU1000GPIO_CLEAR _IOW(AU1000GPIO_IOC_MAGIC, 2, int)
43#define AU1000GPIO_OUT _IOW(AU1000GPIO_IOC_MAGIC, 3, int)
44#define AU1000GPIO_TRISTATE _IOW(AU1000GPIO_IOC_MAGIC, 4, int)
45#define AU1000GPIO_AVAIL_MASK _IOR(AU1000GPIO_IOC_MAGIC, 5, int)
46
47#ifdef __KERNEL__
48extern u32 get_au1000_avail_gpio_mask(void);
49extern int au1000gpio_tristate(u32 data);
50extern int au1000gpio_in(u32 *data);
51extern int au1000gpio_set(u32 data);
52extern int au1000gpio_clear(u32 data);
53extern int au1000gpio_out(u32 data);
54#endif
55
56#endif
diff --git a/include/asm-mips/mach-au1x00/au1100_mmc.h b/include/asm-mips/mach-au1x00/au1100_mmc.h
deleted file mode 100644
index c35e20918490..000000000000
--- a/include/asm-mips/mach-au1x00/au1100_mmc.h
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Defines for using the MMC/SD controllers on the
4 * Alchemy Au1100 mips processor.
5 *
6 * Copyright (c) 2003 Embedded Edge, LLC.
7 * Author: Embedded Edge, LLC.
8 * dan@embeddededge.com or tim@embeddededge.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 */
31/*
32 * AU1100 MMC/SD definitions.
33 *
34 * From "AMD Alchemy Solutions Au1100 Processor Data Book - Preliminary"
35 * June, 2003
36 */
37
38#ifndef __ASM_AU1100_MMC_H
39#define __ASM_AU1100_MMC_H
40
41#include <linux/leds.h>
42
43struct au1xmmc_platform_data {
44 int(*cd_setup)(void *mmc_host, int on);
45 int(*card_inserted)(void *mmc_host);
46 int(*card_readonly)(void *mmc_host);
47 void(*set_power)(void *mmc_host, int state);
48 struct led_classdev *led;
49};
50
51#define SD0_BASE 0xB0600000
52#define SD1_BASE 0xB0680000
53
54
55/*
56 * Register offsets.
57 */
58#define SD_TXPORT (0x0000)
59#define SD_RXPORT (0x0004)
60#define SD_CONFIG (0x0008)
61#define SD_ENABLE (0x000C)
62#define SD_CONFIG2 (0x0010)
63#define SD_BLKSIZE (0x0014)
64#define SD_STATUS (0x0018)
65#define SD_DEBUG (0x001C)
66#define SD_CMD (0x0020)
67#define SD_CMDARG (0x0024)
68#define SD_RESP3 (0x0028)
69#define SD_RESP2 (0x002C)
70#define SD_RESP1 (0x0030)
71#define SD_RESP0 (0x0034)
72#define SD_TIMEOUT (0x0038)
73
74
75/*
76 * SD_TXPORT bit definitions.
77 */
78#define SD_TXPORT_TXD (0x000000ff)
79
80
81/*
82 * SD_RXPORT bit definitions.
83 */
84#define SD_RXPORT_RXD (0x000000ff)
85
86
87/*
88 * SD_CONFIG bit definitions.
89 */
90#define SD_CONFIG_DIV (0x000001ff)
91#define SD_CONFIG_DE (0x00000200)
92#define SD_CONFIG_NE (0x00000400)
93#define SD_CONFIG_TU (0x00000800)
94#define SD_CONFIG_TO (0x00001000)
95#define SD_CONFIG_RU (0x00002000)
96#define SD_CONFIG_RO (0x00004000)
97#define SD_CONFIG_I (0x00008000)
98#define SD_CONFIG_CR (0x00010000)
99#define SD_CONFIG_RAT (0x00020000)
100#define SD_CONFIG_DD (0x00040000)
101#define SD_CONFIG_DT (0x00080000)
102#define SD_CONFIG_SC (0x00100000)
103#define SD_CONFIG_RC (0x00200000)
104#define SD_CONFIG_WC (0x00400000)
105#define SD_CONFIG_xxx (0x00800000)
106#define SD_CONFIG_TH (0x01000000)
107#define SD_CONFIG_TE (0x02000000)
108#define SD_CONFIG_TA (0x04000000)
109#define SD_CONFIG_RH (0x08000000)
110#define SD_CONFIG_RA (0x10000000)
111#define SD_CONFIG_RF (0x20000000)
112#define SD_CONFIG_CD (0x40000000)
113#define SD_CONFIG_SI (0x80000000)
114
115
116/*
117 * SD_ENABLE bit definitions.
118 */
119#define SD_ENABLE_CE (0x00000001)
120#define SD_ENABLE_R (0x00000002)
121
122
123/*
124 * SD_CONFIG2 bit definitions.
125 */
126#define SD_CONFIG2_EN (0x00000001)
127#define SD_CONFIG2_FF (0x00000002)
128#define SD_CONFIG2_xx1 (0x00000004)
129#define SD_CONFIG2_DF (0x00000008)
130#define SD_CONFIG2_DC (0x00000010)
131#define SD_CONFIG2_xx2 (0x000000e0)
132#define SD_CONFIG2_WB (0x00000100)
133#define SD_CONFIG2_RW (0x00000200)
134
135
136/*
137 * SD_BLKSIZE bit definitions.
138 */
139#define SD_BLKSIZE_BS (0x000007ff)
140#define SD_BLKSIZE_BS_SHIFT (0)
141#define SD_BLKSIZE_BC (0x01ff0000)
142#define SD_BLKSIZE_BC_SHIFT (16)
143
144
145/*
146 * SD_STATUS bit definitions.
147 */
148#define SD_STATUS_DCRCW (0x00000007)
149#define SD_STATUS_xx1 (0x00000008)
150#define SD_STATUS_CB (0x00000010)
151#define SD_STATUS_DB (0x00000020)
152#define SD_STATUS_CF (0x00000040)
153#define SD_STATUS_D3 (0x00000080)
154#define SD_STATUS_xx2 (0x00000300)
155#define SD_STATUS_NE (0x00000400)
156#define SD_STATUS_TU (0x00000800)
157#define SD_STATUS_TO (0x00001000)
158#define SD_STATUS_RU (0x00002000)
159#define SD_STATUS_RO (0x00004000)
160#define SD_STATUS_I (0x00008000)
161#define SD_STATUS_CR (0x00010000)
162#define SD_STATUS_RAT (0x00020000)
163#define SD_STATUS_DD (0x00040000)
164#define SD_STATUS_DT (0x00080000)
165#define SD_STATUS_SC (0x00100000)
166#define SD_STATUS_RC (0x00200000)
167#define SD_STATUS_WC (0x00400000)
168#define SD_STATUS_xx3 (0x00800000)
169#define SD_STATUS_TH (0x01000000)
170#define SD_STATUS_TE (0x02000000)
171#define SD_STATUS_TA (0x04000000)
172#define SD_STATUS_RH (0x08000000)
173#define SD_STATUS_RA (0x10000000)
174#define SD_STATUS_RF (0x20000000)
175#define SD_STATUS_CD (0x40000000)
176#define SD_STATUS_SI (0x80000000)
177
178
179/*
180 * SD_CMD bit definitions.
181 */
182#define SD_CMD_GO (0x00000001)
183#define SD_CMD_RY (0x00000002)
184#define SD_CMD_xx1 (0x0000000c)
185#define SD_CMD_CT_MASK (0x000000f0)
186#define SD_CMD_CT_0 (0x00000000)
187#define SD_CMD_CT_1 (0x00000010)
188#define SD_CMD_CT_2 (0x00000020)
189#define SD_CMD_CT_3 (0x00000030)
190#define SD_CMD_CT_4 (0x00000040)
191#define SD_CMD_CT_5 (0x00000050)
192#define SD_CMD_CT_6 (0x00000060)
193#define SD_CMD_CT_7 (0x00000070)
194#define SD_CMD_CI (0x0000ff00)
195#define SD_CMD_CI_SHIFT (8)
196#define SD_CMD_RT_MASK (0x00ff0000)
197#define SD_CMD_RT_0 (0x00000000)
198#define SD_CMD_RT_1 (0x00010000)
199#define SD_CMD_RT_2 (0x00020000)
200#define SD_CMD_RT_3 (0x00030000)
201#define SD_CMD_RT_4 (0x00040000)
202#define SD_CMD_RT_5 (0x00050000)
203#define SD_CMD_RT_6 (0x00060000)
204#define SD_CMD_RT_1B (0x00810000)
205
206
207#endif /* __ASM_AU1100_MMC_H */
208
diff --git a/include/asm-mips/mach-au1x00/au1550_spi.h b/include/asm-mips/mach-au1x00/au1550_spi.h
deleted file mode 100644
index 08e1958e9410..000000000000
--- a/include/asm-mips/mach-au1x00/au1550_spi.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * au1550_spi.h - Au1550 PSC SPI controller driver - platform data structure
3 */
4
5#ifndef _AU1550_SPI_H_
6#define _AU1550_SPI_H_
7
8struct au1550_spi_info {
9 u32 mainclk_hz; /* main input clock frequency of PSC */
10 u16 num_chipselect; /* number of chipselects supported */
11 void (*activate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
12 void (*deactivate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
13};
14
15#endif
diff --git a/include/asm-mips/mach-au1x00/au1xxx.h b/include/asm-mips/mach-au1x00/au1xxx.h
deleted file mode 100644
index 1b3655090ed3..000000000000
--- a/include/asm-mips/mach-au1x00/au1xxx.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _AU1XXX_H_
24#define _AU1XXX_H_
25
26#include <asm/mach-au1x00/au1000.h>
27
28#if defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || \
29 defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_DB1550)
30#include <asm/mach-db1x00/db1x00.h>
31
32#elif defined(CONFIG_MIPS_PB1550)
33#include <asm/mach-pb1x00/pb1550.h>
34
35#elif defined(CONFIG_MIPS_PB1200)
36#include <asm/mach-pb1x00/pb1200.h>
37
38#elif defined(CONFIG_MIPS_DB1200)
39#include <asm/mach-db1x00/db1200.h>
40
41#endif
42
43#endif /* _AU1XXX_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h b/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
deleted file mode 100644
index 44a67bf05dc1..000000000000
--- a/include/asm-mips/mach-au1x00/au1xxx_dbdma.h
+++ /dev/null
@@ -1,386 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1550 Descriptor
5 * Based DMA Controller.
6 *
7 * Copyright 2004 Embedded Edge, LLC
8 * dan@embeddededge.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31/*
32 * Specifics for the Au1xxx Descriptor-Based DMA Controller,
33 * first seen in the AU1550 part.
34 */
35#ifndef _AU1000_DBDMA_H_
36#define _AU1000_DBDMA_H_
37
38#ifndef _LANGUAGE_ASSEMBLY
39
40/*
41 * The DMA base addresses.
42 * The channels are every 256 bytes (0x0100) from the channel 0 base.
43 * Interrupt status/enable is bits 15:0 for channels 15 to zero.
44 */
45#define DDMA_GLOBAL_BASE 0xb4003000
46#define DDMA_CHANNEL_BASE 0xb4002000
47
48typedef volatile struct dbdma_global {
49 u32 ddma_config;
50 u32 ddma_intstat;
51 u32 ddma_throttle;
52 u32 ddma_inten;
53} dbdma_global_t;
54
55/* General Configuration. */
56#define DDMA_CONFIG_AF (1 << 2)
57#define DDMA_CONFIG_AH (1 << 1)
58#define DDMA_CONFIG_AL (1 << 0)
59
60#define DDMA_THROTTLE_EN (1 << 31)
61
62/* The structure of a DMA Channel. */
63typedef volatile struct au1xxx_dma_channel {
64 u32 ddma_cfg; /* See below */
65 u32 ddma_desptr; /* 32-byte aligned pointer to descriptor */
66 u32 ddma_statptr; /* word aligned pointer to status word */
67 u32 ddma_dbell; /* A write activates channel operation */
68 u32 ddma_irq; /* If bit 0 set, interrupt pending */
69 u32 ddma_stat; /* See below */
70 u32 ddma_bytecnt; /* Byte count, valid only when chan idle */
71 /* Remainder, up to the 256 byte boundary, is reserved. */
72} au1x_dma_chan_t;
73
74#define DDMA_CFG_SED (1 << 9) /* source DMA level/edge detect */
75#define DDMA_CFG_SP (1 << 8) /* source DMA polarity */
76#define DDMA_CFG_DED (1 << 7) /* destination DMA level/edge detect */
77#define DDMA_CFG_DP (1 << 6) /* destination DMA polarity */
78#define DDMA_CFG_SYNC (1 << 5) /* Sync static bus controller */
79#define DDMA_CFG_PPR (1 << 4) /* PCI posted read/write control */
80#define DDMA_CFG_DFN (1 << 3) /* Descriptor fetch non-coherent */
81#define DDMA_CFG_SBE (1 << 2) /* Source big endian */
82#define DDMA_CFG_DBE (1 << 1) /* Destination big endian */
83#define DDMA_CFG_EN (1 << 0) /* Channel enable */
84
85/*
86 * Always set when descriptor processing done, regardless of
87 * interrupt enable state. Reflected in global intstat, don't
88 * clear this until global intstat is read/used.
89 */
90#define DDMA_IRQ_IN (1 << 0)
91
92#define DDMA_STAT_DB (1 << 2) /* Doorbell pushed */
93#define DDMA_STAT_V (1 << 1) /* Descriptor valid */
94#define DDMA_STAT_H (1 << 0) /* Channel Halted */
95
96/*
97 * "Standard" DDMA Descriptor.
98 * Must be 32-byte aligned.
99 */
100typedef volatile struct au1xxx_ddma_desc {
101 u32 dscr_cmd0; /* See below */
102 u32 dscr_cmd1; /* See below */
103 u32 dscr_source0; /* source phys address */
104 u32 dscr_source1; /* See below */
105 u32 dscr_dest0; /* Destination address */
106 u32 dscr_dest1; /* See below */
107 u32 dscr_stat; /* completion status */
108 u32 dscr_nxtptr; /* Next descriptor pointer (mostly) */
109 /*
110 * First 32 bytes are HW specific!!!
111 * Lets have some SW data following -- make sure it's 32 bytes.
112 */
113 u32 sw_status;
114 u32 sw_context;
115 u32 sw_reserved[6];
116} au1x_ddma_desc_t;
117
118#define DSCR_CMD0_V (1 << 31) /* Descriptor valid */
119#define DSCR_CMD0_MEM (1 << 30) /* mem-mem transfer */
120#define DSCR_CMD0_SID_MASK (0x1f << 25) /* Source ID */
121#define DSCR_CMD0_DID_MASK (0x1f << 20) /* Destination ID */
122#define DSCR_CMD0_SW_MASK (0x3 << 18) /* Source Width */
123#define DSCR_CMD0_DW_MASK (0x3 << 16) /* Destination Width */
124#define DSCR_CMD0_ARB (0x1 << 15) /* Set for Hi Pri */
125#define DSCR_CMD0_DT_MASK (0x3 << 13) /* Descriptor Type */
126#define DSCR_CMD0_SN (0x1 << 12) /* Source non-coherent */
127#define DSCR_CMD0_DN (0x1 << 11) /* Destination non-coherent */
128#define DSCR_CMD0_SM (0x1 << 10) /* Stride mode */
129#define DSCR_CMD0_IE (0x1 << 8) /* Interrupt Enable */
130#define DSCR_CMD0_SP (0x1 << 4) /* Status pointer select */
131#define DSCR_CMD0_CV (0x1 << 2) /* Clear Valid when done */
132#define DSCR_CMD0_ST_MASK (0x3 << 0) /* Status instruction */
133
134#define SW_STATUS_INUSE (1 << 0)
135
136/* Command 0 device IDs. */
137#ifdef CONFIG_SOC_AU1550
138#define DSCR_CMD0_UART0_TX 0
139#define DSCR_CMD0_UART0_RX 1
140#define DSCR_CMD0_UART3_TX 2
141#define DSCR_CMD0_UART3_RX 3
142#define DSCR_CMD0_DMA_REQ0 4
143#define DSCR_CMD0_DMA_REQ1 5
144#define DSCR_CMD0_DMA_REQ2 6
145#define DSCR_CMD0_DMA_REQ3 7
146#define DSCR_CMD0_USBDEV_RX0 8
147#define DSCR_CMD0_USBDEV_TX0 9
148#define DSCR_CMD0_USBDEV_TX1 10
149#define DSCR_CMD0_USBDEV_TX2 11
150#define DSCR_CMD0_USBDEV_RX3 12
151#define DSCR_CMD0_USBDEV_RX4 13
152#define DSCR_CMD0_PSC0_TX 14
153#define DSCR_CMD0_PSC0_RX 15
154#define DSCR_CMD0_PSC1_TX 16
155#define DSCR_CMD0_PSC1_RX 17
156#define DSCR_CMD0_PSC2_TX 18
157#define DSCR_CMD0_PSC2_RX 19
158#define DSCR_CMD0_PSC3_TX 20
159#define DSCR_CMD0_PSC3_RX 21
160#define DSCR_CMD0_PCI_WRITE 22
161#define DSCR_CMD0_NAND_FLASH 23
162#define DSCR_CMD0_MAC0_RX 24
163#define DSCR_CMD0_MAC0_TX 25
164#define DSCR_CMD0_MAC1_RX 26
165#define DSCR_CMD0_MAC1_TX 27
166#endif /* CONFIG_SOC_AU1550 */
167
168#ifdef CONFIG_SOC_AU1200
169#define DSCR_CMD0_UART0_TX 0
170#define DSCR_CMD0_UART0_RX 1
171#define DSCR_CMD0_UART1_TX 2
172#define DSCR_CMD0_UART1_RX 3
173#define DSCR_CMD0_DMA_REQ0 4
174#define DSCR_CMD0_DMA_REQ1 5
175#define DSCR_CMD0_MAE_BE 6
176#define DSCR_CMD0_MAE_FE 7
177#define DSCR_CMD0_SDMS_TX0 8
178#define DSCR_CMD0_SDMS_RX0 9
179#define DSCR_CMD0_SDMS_TX1 10
180#define DSCR_CMD0_SDMS_RX1 11
181#define DSCR_CMD0_AES_TX 13
182#define DSCR_CMD0_AES_RX 12
183#define DSCR_CMD0_PSC0_TX 14
184#define DSCR_CMD0_PSC0_RX 15
185#define DSCR_CMD0_PSC1_TX 16
186#define DSCR_CMD0_PSC1_RX 17
187#define DSCR_CMD0_CIM_RXA 18
188#define DSCR_CMD0_CIM_RXB 19
189#define DSCR_CMD0_CIM_RXC 20
190#define DSCR_CMD0_MAE_BOTH 21
191#define DSCR_CMD0_LCD 22
192#define DSCR_CMD0_NAND_FLASH 23
193#define DSCR_CMD0_PSC0_SYNC 24
194#define DSCR_CMD0_PSC1_SYNC 25
195#define DSCR_CMD0_CIM_SYNC 26
196#endif /* CONFIG_SOC_AU1200 */
197
198#define DSCR_CMD0_THROTTLE 30
199#define DSCR_CMD0_ALWAYS 31
200#define DSCR_NDEV_IDS 32
201/* This macro is used to find/create custom device types */
202#define DSCR_DEV2CUSTOM_ID(x, d) (((((x) & 0xFFFF) << 8) | 0x32000000) | \
203 ((d) & 0xFF))
204#define DSCR_CUSTOM2DEV_ID(x) ((x) & 0xFF)
205
206#define DSCR_CMD0_SID(x) (((x) & 0x1f) << 25)
207#define DSCR_CMD0_DID(x) (((x) & 0x1f) << 20)
208
209/* Source/Destination transfer width. */
210#define DSCR_CMD0_BYTE 0
211#define DSCR_CMD0_HALFWORD 1
212#define DSCR_CMD0_WORD 2
213
214#define DSCR_CMD0_SW(x) (((x) & 0x3) << 18)
215#define DSCR_CMD0_DW(x) (((x) & 0x3) << 16)
216
217/* DDMA Descriptor Type. */
218#define DSCR_CMD0_STANDARD 0
219#define DSCR_CMD0_LITERAL 1
220#define DSCR_CMD0_CMP_BRANCH 2
221
222#define DSCR_CMD0_DT(x) (((x) & 0x3) << 13)
223
224/* Status Instruction. */
225#define DSCR_CMD0_ST_NOCHANGE 0 /* Don't change */
226#define DSCR_CMD0_ST_CURRENT 1 /* Write current status */
227#define DSCR_CMD0_ST_CMD0 2 /* Write cmd0 with V cleared */
228#define DSCR_CMD0_ST_BYTECNT 3 /* Write remaining byte count */
229
230#define DSCR_CMD0_ST(x) (((x) & 0x3) << 0)
231
232/* Descriptor Command 1. */
233#define DSCR_CMD1_SUPTR_MASK (0xf << 28) /* upper 4 bits of src addr */
234#define DSCR_CMD1_DUPTR_MASK (0xf << 24) /* upper 4 bits of dest addr */
235#define DSCR_CMD1_FL_MASK (0x3 << 22) /* Flag bits */
236#define DSCR_CMD1_BC_MASK (0x3fffff) /* Byte count */
237
238/* Flag description. */
239#define DSCR_CMD1_FL_MEM_STRIDE0 0
240#define DSCR_CMD1_FL_MEM_STRIDE1 1
241#define DSCR_CMD1_FL_MEM_STRIDE2 2
242
243#define DSCR_CMD1_FL(x) (((x) & 0x3) << 22)
244
245/* Source1, 1-dimensional stride. */
246#define DSCR_SRC1_STS_MASK (3 << 30) /* Src xfer size */
247#define DSCR_SRC1_SAM_MASK (3 << 28) /* Src xfer movement */
248#define DSCR_SRC1_SB_MASK (0x3fff << 14) /* Block size */
249#define DSCR_SRC1_SB(x) (((x) & 0x3fff) << 14)
250#define DSCR_SRC1_SS_MASK (0x3fff << 0) /* Stride */
251#define DSCR_SRC1_SS(x) (((x) & 0x3fff) << 0)
252
253/* Dest1, 1-dimensional stride. */
254#define DSCR_DEST1_DTS_MASK (3 << 30) /* Dest xfer size */
255#define DSCR_DEST1_DAM_MASK (3 << 28) /* Dest xfer movement */
256#define DSCR_DEST1_DB_MASK (0x3fff << 14) /* Block size */
257#define DSCR_DEST1_DB(x) (((x) & 0x3fff) << 14)
258#define DSCR_DEST1_DS_MASK (0x3fff << 0) /* Stride */
259#define DSCR_DEST1_DS(x) (((x) & 0x3fff) << 0)
260
261#define DSCR_xTS_SIZE1 0
262#define DSCR_xTS_SIZE2 1
263#define DSCR_xTS_SIZE4 2
264#define DSCR_xTS_SIZE8 3
265#define DSCR_SRC1_STS(x) (((x) & 3) << 30)
266#define DSCR_DEST1_DTS(x) (((x) & 3) << 30)
267
268#define DSCR_xAM_INCREMENT 0
269#define DSCR_xAM_DECREMENT 1
270#define DSCR_xAM_STATIC 2
271#define DSCR_xAM_BURST 3
272#define DSCR_SRC1_SAM(x) (((x) & 3) << 28)
273#define DSCR_DEST1_DAM(x) (((x) & 3) << 28)
274
275/* The next descriptor pointer. */
276#define DSCR_NXTPTR_MASK (0x07ffffff)
277#define DSCR_NXTPTR(x) ((x) >> 5)
278#define DSCR_GET_NXTPTR(x) ((x) << 5)
279#define DSCR_NXTPTR_MS (1 << 27)
280
281/* The number of DBDMA channels. */
282#define NUM_DBDMA_CHANS 16
283
284/*
285 * DDMA API definitions
286 * FIXME: may not fit to this header file
287 */
288typedef struct dbdma_device_table {
289 u32 dev_id;
290 u32 dev_flags;
291 u32 dev_tsize;
292 u32 dev_devwidth;
293 u32 dev_physaddr; /* If FIFO */
294 u32 dev_intlevel;
295 u32 dev_intpolarity;
296} dbdev_tab_t;
297
298
299typedef struct dbdma_chan_config {
300 spinlock_t lock;
301
302 u32 chan_flags;
303 u32 chan_index;
304 dbdev_tab_t *chan_src;
305 dbdev_tab_t *chan_dest;
306 au1x_dma_chan_t *chan_ptr;
307 au1x_ddma_desc_t *chan_desc_base;
308 au1x_ddma_desc_t *get_ptr, *put_ptr, *cur_ptr;
309 void *chan_callparam;
310 void (*chan_callback)(int, void *);
311} chan_tab_t;
312
313#define DEV_FLAGS_INUSE (1 << 0)
314#define DEV_FLAGS_ANYUSE (1 << 1)
315#define DEV_FLAGS_OUT (1 << 2)
316#define DEV_FLAGS_IN (1 << 3)
317#define DEV_FLAGS_BURSTABLE (1 << 4)
318#define DEV_FLAGS_SYNC (1 << 5)
319/* end DDMA API definitions */
320
321/*
322 * External functions for drivers to use.
323 * Use this to allocate a DBDMA channel. The device IDs are one of
324 * the DSCR_CMD0 devices IDs, which is usually redefined to a more
325 * meaningful name. The 'callback' is called during DMA completion
326 * interrupt.
327 */
328extern u32 au1xxx_dbdma_chan_alloc(u32 srcid, u32 destid,
329 void (*callback)(int, void *),
330 void *callparam);
331
332#define DBDMA_MEM_CHAN DSCR_CMD0_ALWAYS
333
334/* Set the device width of an in/out FIFO. */
335u32 au1xxx_dbdma_set_devwidth(u32 chanid, int bits);
336
337/* Allocate a ring of descriptors for DBDMA. */
338u32 au1xxx_dbdma_ring_alloc(u32 chanid, int entries);
339
340/* Put buffers on source/destination descriptors. */
341u32 _au1xxx_dbdma_put_source(u32 chanid, void *buf, int nbytes, u32 flags);
342u32 _au1xxx_dbdma_put_dest(u32 chanid, void *buf, int nbytes, u32 flags);
343
344/* Get a buffer from the destination descriptor. */
345u32 au1xxx_dbdma_get_dest(u32 chanid, void **buf, int *nbytes);
346
347void au1xxx_dbdma_stop(u32 chanid);
348void au1xxx_dbdma_start(u32 chanid);
349void au1xxx_dbdma_reset(u32 chanid);
350u32 au1xxx_get_dma_residue(u32 chanid);
351
352void au1xxx_dbdma_chan_free(u32 chanid);
353void au1xxx_dbdma_dump(u32 chanid);
354
355u32 au1xxx_dbdma_put_dscr(u32 chanid, au1x_ddma_desc_t *dscr);
356
357u32 au1xxx_ddma_add_device(dbdev_tab_t *dev);
358extern void au1xxx_ddma_del_device(u32 devid);
359void *au1xxx_ddma_get_nextptr_virt(au1x_ddma_desc_t *dp);
360
361/*
362 * Some compatibilty macros -- needed to make changes to API
363 * without breaking existing drivers.
364 */
365#define au1xxx_dbdma_put_source(chanid, buf, nbytes) \
366 _au1xxx_dbdma_put_source(chanid, buf, nbytes, DDMA_FLAGS_IE)
367#define au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags) \
368 _au1xxx_dbdma_put_source(chanid, buf, nbytes, flags)
369#define put_source_flags(chanid, buf, nbytes, flags) \
370 au1xxx_dbdma_put_source_flags(chanid, buf, nbytes, flags)
371
372#define au1xxx_dbdma_put_dest(chanid, buf, nbytes) \
373 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, DDMA_FLAGS_IE)
374#define au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags) \
375 _au1xxx_dbdma_put_dest(chanid, buf, nbytes, flags)
376#define put_dest_flags(chanid, buf, nbytes, flags) \
377 au1xxx_dbdma_put_dest_flags(chanid, buf, nbytes, flags)
378
379/*
380 * Flags for the put_source/put_dest functions.
381 */
382#define DDMA_FLAGS_IE (1 << 0)
383#define DDMA_FLAGS_NOIE (1 << 1)
384
385#endif /* _LANGUAGE_ASSEMBLY */
386#endif /* _AU1000_DBDMA_H_ */
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
deleted file mode 100644
index 60638b8969ba..000000000000
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ /dev/null
@@ -1,194 +0,0 @@
1/*
2 * include/asm-mips/mach-au1x00/au1xxx_ide.h version 01.30.00 Aug. 02 2005
3 *
4 * BRIEF MODULE DESCRIPTION
5 * AMD Alchemy Au1xxx IDE interface routines over the Static Bus
6 *
7 * Copyright (c) 2003-2005 AMD, Personal Connectivity Solutions
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the License, or (at your option) any later
12 * version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 * POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along with
26 * this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 *
29 * Note: for more information, please refer "AMD Alchemy Au1200/Au1550 IDE
30 * Interface and Linux Device Driver" Application Note.
31 */
32
33#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
34#define DMA_WAIT_TIMEOUT 100
35#define NUM_DESCRIPTORS PRD_ENTRIES
36#else /* CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA */
37#define NUM_DESCRIPTORS 2
38#endif
39
40#ifndef AU1XXX_ATA_RQSIZE
41#define AU1XXX_ATA_RQSIZE 128
42#endif
43
44/* Disable Burstable-Support for DBDMA */
45#ifndef CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON
46#define CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON 0
47#endif
48
49#ifdef CONFIG_PM
50/*
51 * This will enable the device to be powered up when write() or read()
52 * is called. If this is not defined, the driver will return -EBUSY.
53 */
54#define WAKE_ON_ACCESS 1
55
56typedef struct {
57 spinlock_t lock; /* Used to block on state transitions */
58 au1xxx_power_dev_t *dev; /* Power Managers device structure */
59 unsigned stopped; /* Used to signal device is stopped */
60} pm_state;
61#endif
62
63typedef struct {
64 u32 tx_dev_id, rx_dev_id, target_dev_id;
65 u32 tx_chan, rx_chan;
66 void *tx_desc_head, *rx_desc_head;
67 ide_hwif_t *hwif;
68#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
69 ide_drive_t *drive;
70 struct dbdma_cmd *dma_table_cpu;
71 dma_addr_t dma_table_dma;
72#endif
73 int irq;
74 u32 regbase;
75#ifdef CONFIG_PM
76 pm_state pm;
77#endif
78} _auide_hwif;
79
80/******************************************************************************/
81/* PIO Mode timing calculation : */
82/* */
83/* Static Bus Spec ATA Spec */
84/* Tcsoe = t1 */
85/* Toecs = t9 */
86/* Twcs = t9 */
87/* Tcsh = t2i | t2 */
88/* Tcsoff = t2i | t2 */
89/* Twp = t2 */
90/* Tcsw = t1 */
91/* Tpm = 0 */
92/* Ta = t1+t2 */
93/******************************************************************************/
94
95#define TCSOE_MASK (0x07 << 29)
96#define TOECS_MASK (0x07 << 26)
97#define TWCS_MASK (0x07 << 28)
98#define TCSH_MASK (0x0F << 24)
99#define TCSOFF_MASK (0x07 << 20)
100#define TWP_MASK (0x3F << 14)
101#define TCSW_MASK (0x0F << 10)
102#define TPM_MASK (0x0F << 6)
103#define TA_MASK (0x3F << 0)
104#define TS_MASK (1 << 8)
105
106/* Timing parameters PIO mode 0 */
107#define SBC_IDE_PIO0_TCSOE (0x04 << 29)
108#define SBC_IDE_PIO0_TOECS (0x01 << 26)
109#define SBC_IDE_PIO0_TWCS (0x02 << 28)
110#define SBC_IDE_PIO0_TCSH (0x08 << 24)
111#define SBC_IDE_PIO0_TCSOFF (0x07 << 20)
112#define SBC_IDE_PIO0_TWP (0x10 << 14)
113#define SBC_IDE_PIO0_TCSW (0x04 << 10)
114#define SBC_IDE_PIO0_TPM (0x00 << 6)
115#define SBC_IDE_PIO0_TA (0x15 << 0)
116/* Timing parameters PIO mode 1 */
117#define SBC_IDE_PIO1_TCSOE (0x03 << 29)
118#define SBC_IDE_PIO1_TOECS (0x01 << 26)
119#define SBC_IDE_PIO1_TWCS (0x01 << 28)
120#define SBC_IDE_PIO1_TCSH (0x06 << 24)
121#define SBC_IDE_PIO1_TCSOFF (0x06 << 20)
122#define SBC_IDE_PIO1_TWP (0x08 << 14)
123#define SBC_IDE_PIO1_TCSW (0x03 << 10)
124#define SBC_IDE_PIO1_TPM (0x00 << 6)
125#define SBC_IDE_PIO1_TA (0x0B << 0)
126/* Timing parameters PIO mode 2 */
127#define SBC_IDE_PIO2_TCSOE (0x05 << 29)
128#define SBC_IDE_PIO2_TOECS (0x01 << 26)
129#define SBC_IDE_PIO2_TWCS (0x01 << 28)
130#define SBC_IDE_PIO2_TCSH (0x07 << 24)
131#define SBC_IDE_PIO2_TCSOFF (0x07 << 20)
132#define SBC_IDE_PIO2_TWP (0x1F << 14)
133#define SBC_IDE_PIO2_TCSW (0x05 << 10)
134#define SBC_IDE_PIO2_TPM (0x00 << 6)
135#define SBC_IDE_PIO2_TA (0x22 << 0)
136/* Timing parameters PIO mode 3 */
137#define SBC_IDE_PIO3_TCSOE (0x05 << 29)
138#define SBC_IDE_PIO3_TOECS (0x01 << 26)
139#define SBC_IDE_PIO3_TWCS (0x01 << 28)
140#define SBC_IDE_PIO3_TCSH (0x0D << 24)
141#define SBC_IDE_PIO3_TCSOFF (0x0D << 20)
142#define SBC_IDE_PIO3_TWP (0x15 << 14)
143#define SBC_IDE_PIO3_TCSW (0x05 << 10)
144#define SBC_IDE_PIO3_TPM (0x00 << 6)
145#define SBC_IDE_PIO3_TA (0x1A << 0)
146/* Timing parameters PIO mode 4 */
147#define SBC_IDE_PIO4_TCSOE (0x04 << 29)
148#define SBC_IDE_PIO4_TOECS (0x01 << 26)
149#define SBC_IDE_PIO4_TWCS (0x01 << 28)
150#define SBC_IDE_PIO4_TCSH (0x04 << 24)
151#define SBC_IDE_PIO4_TCSOFF (0x04 << 20)
152#define SBC_IDE_PIO4_TWP (0x0D << 14)
153#define SBC_IDE_PIO4_TCSW (0x03 << 10)
154#define SBC_IDE_PIO4_TPM (0x00 << 6)
155#define SBC_IDE_PIO4_TA (0x12 << 0)
156/* Timing parameters MDMA mode 0 */
157#define SBC_IDE_MDMA0_TCSOE (0x03 << 29)
158#define SBC_IDE_MDMA0_TOECS (0x01 << 26)
159#define SBC_IDE_MDMA0_TWCS (0x01 << 28)
160#define SBC_IDE_MDMA0_TCSH (0x07 << 24)
161#define SBC_IDE_MDMA0_TCSOFF (0x07 << 20)
162#define SBC_IDE_MDMA0_TWP (0x0C << 14)
163#define SBC_IDE_MDMA0_TCSW (0x03 << 10)
164#define SBC_IDE_MDMA0_TPM (0x00 << 6)
165#define SBC_IDE_MDMA0_TA (0x0F << 0)
166/* Timing parameters MDMA mode 1 */
167#define SBC_IDE_MDMA1_TCSOE (0x05 << 29)
168#define SBC_IDE_MDMA1_TOECS (0x01 << 26)
169#define SBC_IDE_MDMA1_TWCS (0x01 << 28)
170#define SBC_IDE_MDMA1_TCSH (0x05 << 24)
171#define SBC_IDE_MDMA1_TCSOFF (0x05 << 20)
172#define SBC_IDE_MDMA1_TWP (0x0F << 14)
173#define SBC_IDE_MDMA1_TCSW (0x05 << 10)
174#define SBC_IDE_MDMA1_TPM (0x00 << 6)
175#define SBC_IDE_MDMA1_TA (0x15 << 0)
176/* Timing parameters MDMA mode 2 */
177#define SBC_IDE_MDMA2_TCSOE (0x04 << 29)
178#define SBC_IDE_MDMA2_TOECS (0x01 << 26)
179#define SBC_IDE_MDMA2_TWCS (0x01 << 28)
180#define SBC_IDE_MDMA2_TCSH (0x04 << 24)
181#define SBC_IDE_MDMA2_TCSOFF (0x04 << 20)
182#define SBC_IDE_MDMA2_TWP (0x0D << 14)
183#define SBC_IDE_MDMA2_TCSW (0x04 << 10)
184#define SBC_IDE_MDMA2_TPM (0x00 << 6)
185#define SBC_IDE_MDMA2_TA (0x12 << 0)
186
187#define SBC_IDE_TIMING(mode) \
188 (SBC_IDE_##mode##_TWCS | \
189 SBC_IDE_##mode##_TCSH | \
190 SBC_IDE_##mode##_TCSOFF | \
191 SBC_IDE_##mode##_TWP | \
192 SBC_IDE_##mode##_TCSW | \
193 SBC_IDE_##mode##_TPM | \
194 SBC_IDE_##mode##_TA)
diff --git a/include/asm-mips/mach-au1x00/au1xxx_psc.h b/include/asm-mips/mach-au1x00/au1xxx_psc.h
deleted file mode 100644
index 892b7f168eb4..000000000000
--- a/include/asm-mips/mach-au1x00/au1xxx_psc.h
+++ /dev/null
@@ -1,505 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Include file for Alchemy Semiconductor's Au1k CPU.
5 *
6 * Copyright 2004 Embedded Edge, LLC
7 * dan@embeddededge.com
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 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30/* Specifics for the Au1xxx Programmable Serial Controllers, first
31 * seen in the AU1550 part.
32 */
33#ifndef _AU1000_PSC_H_
34#define _AU1000_PSC_H_
35
36/* The PSC base addresses. */
37#ifdef CONFIG_SOC_AU1550
38#define PSC0_BASE_ADDR 0xb1a00000
39#define PSC1_BASE_ADDR 0xb1b00000
40#define PSC2_BASE_ADDR 0xb0a00000
41#define PSC3_BASE_ADDR 0xb0b00000
42#endif
43
44#ifdef CONFIG_SOC_AU1200
45#define PSC0_BASE_ADDR 0xb1a00000
46#define PSC1_BASE_ADDR 0xb1b00000
47#endif
48
49/*
50 * The PSC select and control registers are common to all protocols.
51 */
52#define PSC_SEL_OFFSET 0x00000000
53#define PSC_CTRL_OFFSET 0x00000004
54
55#define PSC_SEL_CLK_MASK (3 << 4)
56#define PSC_SEL_CLK_INTCLK (0 << 4)
57#define PSC_SEL_CLK_EXTCLK (1 << 4)
58#define PSC_SEL_CLK_SERCLK (2 << 4)
59
60#define PSC_SEL_PS_MASK 0x00000007
61#define PSC_SEL_PS_DISABLED 0
62#define PSC_SEL_PS_SPIMODE 2
63#define PSC_SEL_PS_I2SMODE 3
64#define PSC_SEL_PS_AC97MODE 4
65#define PSC_SEL_PS_SMBUSMODE 5
66
67#define PSC_CTRL_DISABLE 0
68#define PSC_CTRL_SUSPEND 2
69#define PSC_CTRL_ENABLE 3
70
71/* AC97 Registers. */
72#define PSC_AC97CFG_OFFSET 0x00000008
73#define PSC_AC97MSK_OFFSET 0x0000000c
74#define PSC_AC97PCR_OFFSET 0x00000010
75#define PSC_AC97STAT_OFFSET 0x00000014
76#define PSC_AC97EVNT_OFFSET 0x00000018
77#define PSC_AC97TXRX_OFFSET 0x0000001c
78#define PSC_AC97CDC_OFFSET 0x00000020
79#define PSC_AC97RST_OFFSET 0x00000024
80#define PSC_AC97GPO_OFFSET 0x00000028
81#define PSC_AC97GPI_OFFSET 0x0000002c
82
83#define AC97_PSC_SEL (AC97_PSC_BASE + PSC_SEL_OFFSET)
84#define AC97_PSC_CTRL (AC97_PSC_BASE + PSC_CTRL_OFFSET)
85#define PSC_AC97CFG (AC97_PSC_BASE + PSC_AC97CFG_OFFSET)
86#define PSC_AC97MSK (AC97_PSC_BASE + PSC_AC97MSK_OFFSET)
87#define PSC_AC97PCR (AC97_PSC_BASE + PSC_AC97PCR_OFFSET)
88#define PSC_AC97STAT (AC97_PSC_BASE + PSC_AC97STAT_OFFSET)
89#define PSC_AC97EVNT (AC97_PSC_BASE + PSC_AC97EVNT_OFFSET)
90#define PSC_AC97TXRX (AC97_PSC_BASE + PSC_AC97TXRX_OFFSET)
91#define PSC_AC97CDC (AC97_PSC_BASE + PSC_AC97CDC_OFFSET)
92#define PSC_AC97RST (AC97_PSC_BASE + PSC_AC97RST_OFFSET)
93#define PSC_AC97GPO (AC97_PSC_BASE + PSC_AC97GPO_OFFSET)
94#define PSC_AC97GPI (AC97_PSC_BASE + PSC_AC97GPI_OFFSET)
95
96/* AC97 Config Register. */
97#define PSC_AC97CFG_RT_MASK (3 << 30)
98#define PSC_AC97CFG_RT_FIFO1 (0 << 30)
99#define PSC_AC97CFG_RT_FIFO2 (1 << 30)
100#define PSC_AC97CFG_RT_FIFO4 (2 << 30)
101#define PSC_AC97CFG_RT_FIFO8 (3 << 30)
102
103#define PSC_AC97CFG_TT_MASK (3 << 28)
104#define PSC_AC97CFG_TT_FIFO1 (0 << 28)
105#define PSC_AC97CFG_TT_FIFO2 (1 << 28)
106#define PSC_AC97CFG_TT_FIFO4 (2 << 28)
107#define PSC_AC97CFG_TT_FIFO8 (3 << 28)
108
109#define PSC_AC97CFG_DD_DISABLE (1 << 27)
110#define PSC_AC97CFG_DE_ENABLE (1 << 26)
111#define PSC_AC97CFG_SE_ENABLE (1 << 25)
112
113#define PSC_AC97CFG_LEN_MASK (0xf << 21)
114#define PSC_AC97CFG_TXSLOT_MASK (0x3ff << 11)
115#define PSC_AC97CFG_RXSLOT_MASK (0x3ff << 1)
116#define PSC_AC97CFG_GE_ENABLE (1)
117
118/* Enable slots 3-12. */
119#define PSC_AC97CFG_TXSLOT_ENA(x) (1 << (((x) - 3) + 11))
120#define PSC_AC97CFG_RXSLOT_ENA(x) (1 << (((x) - 3) + 1))
121
122/*
123 * The word length equation is ((x) * 2) + 2, so choose 'x' appropriately.
124 * The only sensible numbers are 7, 9, or possibly 11. Nah, just do the
125 * arithmetic in the macro.
126 */
127#define PSC_AC97CFG_SET_LEN(x) (((((x) - 2) / 2) & 0xf) << 21)
128#define PSC_AC97CFG_GET_LEN(x) (((((x) >> 21) & 0xf) * 2) + 2)
129
130/* AC97 Mask Register. */
131#define PSC_AC97MSK_GR (1 << 25)
132#define PSC_AC97MSK_CD (1 << 24)
133#define PSC_AC97MSK_RR (1 << 13)
134#define PSC_AC97MSK_RO (1 << 12)
135#define PSC_AC97MSK_RU (1 << 11)
136#define PSC_AC97MSK_TR (1 << 10)
137#define PSC_AC97MSK_TO (1 << 9)
138#define PSC_AC97MSK_TU (1 << 8)
139#define PSC_AC97MSK_RD (1 << 5)
140#define PSC_AC97MSK_TD (1 << 4)
141#define PSC_AC97MSK_ALLMASK (PSC_AC97MSK_GR | PSC_AC97MSK_CD | \
142 PSC_AC97MSK_RR | PSC_AC97MSK_RO | \
143 PSC_AC97MSK_RU | PSC_AC97MSK_TR | \
144 PSC_AC97MSK_TO | PSC_AC97MSK_TU | \
145 PSC_AC97MSK_RD | PSC_AC97MSK_TD)
146
147/* AC97 Protocol Control Register. */
148#define PSC_AC97PCR_RC (1 << 6)
149#define PSC_AC97PCR_RP (1 << 5)
150#define PSC_AC97PCR_RS (1 << 4)
151#define PSC_AC97PCR_TC (1 << 2)
152#define PSC_AC97PCR_TP (1 << 1)
153#define PSC_AC97PCR_TS (1 << 0)
154
155/* AC97 Status register (read only). */
156#define PSC_AC97STAT_CB (1 << 26)
157#define PSC_AC97STAT_CP (1 << 25)
158#define PSC_AC97STAT_CR (1 << 24)
159#define PSC_AC97STAT_RF (1 << 13)
160#define PSC_AC97STAT_RE (1 << 12)
161#define PSC_AC97STAT_RR (1 << 11)
162#define PSC_AC97STAT_TF (1 << 10)
163#define PSC_AC97STAT_TE (1 << 9)
164#define PSC_AC97STAT_TR (1 << 8)
165#define PSC_AC97STAT_RB (1 << 5)
166#define PSC_AC97STAT_TB (1 << 4)
167#define PSC_AC97STAT_DI (1 << 2)
168#define PSC_AC97STAT_DR (1 << 1)
169#define PSC_AC97STAT_SR (1 << 0)
170
171/* AC97 Event Register. */
172#define PSC_AC97EVNT_GR (1 << 25)
173#define PSC_AC97EVNT_CD (1 << 24)
174#define PSC_AC97EVNT_RR (1 << 13)
175#define PSC_AC97EVNT_RO (1 << 12)
176#define PSC_AC97EVNT_RU (1 << 11)
177#define PSC_AC97EVNT_TR (1 << 10)
178#define PSC_AC97EVNT_TO (1 << 9)
179#define PSC_AC97EVNT_TU (1 << 8)
180#define PSC_AC97EVNT_RD (1 << 5)
181#define PSC_AC97EVNT_TD (1 << 4)
182
183/* CODEC Command Register. */
184#define PSC_AC97CDC_RD (1 << 25)
185#define PSC_AC97CDC_ID_MASK (3 << 23)
186#define PSC_AC97CDC_INDX_MASK (0x7f << 16)
187#define PSC_AC97CDC_ID(x) (((x) & 0x03) << 23)
188#define PSC_AC97CDC_INDX(x) (((x) & 0x7f) << 16)
189
190/* AC97 Reset Control Register. */
191#define PSC_AC97RST_RST (1 << 1)
192#define PSC_AC97RST_SNC (1 << 0)
193
194/* PSC in I2S Mode. */
195typedef struct psc_i2s {
196 u32 psc_sel;
197 u32 psc_ctrl;
198 u32 psc_i2scfg;
199 u32 psc_i2smsk;
200 u32 psc_i2spcr;
201 u32 psc_i2sstat;
202 u32 psc_i2sevent;
203 u32 psc_i2stxrx;
204 u32 psc_i2sudf;
205} psc_i2s_t;
206
207#define PSC_I2SCFG_OFFSET 0x08
208#define PSC_I2SMASK_OFFSET 0x0C
209#define PSC_I2SPCR_OFFSET 0x10
210#define PSC_I2SSTAT_OFFSET 0x14
211#define PSC_I2SEVENT_OFFSET 0x18
212#define PSC_I2SRXTX_OFFSET 0x1C
213#define PSC_I2SUDF_OFFSET 0x20
214
215/* I2S Config Register. */
216#define PSC_I2SCFG_RT_MASK (3 << 30)
217#define PSC_I2SCFG_RT_FIFO1 (0 << 30)
218#define PSC_I2SCFG_RT_FIFO2 (1 << 30)
219#define PSC_I2SCFG_RT_FIFO4 (2 << 30)
220#define PSC_I2SCFG_RT_FIFO8 (3 << 30)
221
222#define PSC_I2SCFG_TT_MASK (3 << 28)
223#define PSC_I2SCFG_TT_FIFO1 (0 << 28)
224#define PSC_I2SCFG_TT_FIFO2 (1 << 28)
225#define PSC_I2SCFG_TT_FIFO4 (2 << 28)
226#define PSC_I2SCFG_TT_FIFO8 (3 << 28)
227
228#define PSC_I2SCFG_DD_DISABLE (1 << 27)
229#define PSC_I2SCFG_DE_ENABLE (1 << 26)
230#define PSC_I2SCFG_SET_WS(x) (((((x) / 2) - 1) & 0x7f) << 16)
231#define PSC_I2SCFG_WS(n) ((n & 0xFF) << 16)
232#define PSC_I2SCFG_WS_MASK (PSC_I2SCFG_WS(0x3F))
233#define PSC_I2SCFG_WI (1 << 15)
234
235#define PSC_I2SCFG_DIV_MASK (3 << 13)
236#define PSC_I2SCFG_DIV2 (0 << 13)
237#define PSC_I2SCFG_DIV4 (1 << 13)
238#define PSC_I2SCFG_DIV8 (2 << 13)
239#define PSC_I2SCFG_DIV16 (3 << 13)
240
241#define PSC_I2SCFG_BI (1 << 12)
242#define PSC_I2SCFG_BUF (1 << 11)
243#define PSC_I2SCFG_MLJ (1 << 10)
244#define PSC_I2SCFG_XM (1 << 9)
245
246/* The word length equation is simply LEN+1. */
247#define PSC_I2SCFG_SET_LEN(x) ((((x) - 1) & 0x1f) << 4)
248#define PSC_I2SCFG_GET_LEN(x) ((((x) >> 4) & 0x1f) + 1)
249
250#define PSC_I2SCFG_LB (1 << 2)
251#define PSC_I2SCFG_MLF (1 << 1)
252#define PSC_I2SCFG_MS (1 << 0)
253
254/* I2S Mask Register. */
255#define PSC_I2SMSK_RR (1 << 13)
256#define PSC_I2SMSK_RO (1 << 12)
257#define PSC_I2SMSK_RU (1 << 11)
258#define PSC_I2SMSK_TR (1 << 10)
259#define PSC_I2SMSK_TO (1 << 9)
260#define PSC_I2SMSK_TU (1 << 8)
261#define PSC_I2SMSK_RD (1 << 5)
262#define PSC_I2SMSK_TD (1 << 4)
263#define PSC_I2SMSK_ALLMASK (PSC_I2SMSK_RR | PSC_I2SMSK_RO | \
264 PSC_I2SMSK_RU | PSC_I2SMSK_TR | \
265 PSC_I2SMSK_TO | PSC_I2SMSK_TU | \
266 PSC_I2SMSK_RD | PSC_I2SMSK_TD)
267
268/* I2S Protocol Control Register. */
269#define PSC_I2SPCR_RC (1 << 6)
270#define PSC_I2SPCR_RP (1 << 5)
271#define PSC_I2SPCR_RS (1 << 4)
272#define PSC_I2SPCR_TC (1 << 2)
273#define PSC_I2SPCR_TP (1 << 1)
274#define PSC_I2SPCR_TS (1 << 0)
275
276/* I2S Status register (read only). */
277#define PSC_I2SSTAT_RF (1 << 13)
278#define PSC_I2SSTAT_RE (1 << 12)
279#define PSC_I2SSTAT_RR (1 << 11)
280#define PSC_I2SSTAT_TF (1 << 10)
281#define PSC_I2SSTAT_TE (1 << 9)
282#define PSC_I2SSTAT_TR (1 << 8)
283#define PSC_I2SSTAT_RB (1 << 5)
284#define PSC_I2SSTAT_TB (1 << 4)
285#define PSC_I2SSTAT_DI (1 << 2)
286#define PSC_I2SSTAT_DR (1 << 1)
287#define PSC_I2SSTAT_SR (1 << 0)
288
289/* I2S Event Register. */
290#define PSC_I2SEVNT_RR (1 << 13)
291#define PSC_I2SEVNT_RO (1 << 12)
292#define PSC_I2SEVNT_RU (1 << 11)
293#define PSC_I2SEVNT_TR (1 << 10)
294#define PSC_I2SEVNT_TO (1 << 9)
295#define PSC_I2SEVNT_TU (1 << 8)
296#define PSC_I2SEVNT_RD (1 << 5)
297#define PSC_I2SEVNT_TD (1 << 4)
298
299/* PSC in SPI Mode. */
300typedef struct psc_spi {
301 u32 psc_sel;
302 u32 psc_ctrl;
303 u32 psc_spicfg;
304 u32 psc_spimsk;
305 u32 psc_spipcr;
306 u32 psc_spistat;
307 u32 psc_spievent;
308 u32 psc_spitxrx;
309} psc_spi_t;
310
311/* SPI Config Register. */
312#define PSC_SPICFG_RT_MASK (3 << 30)
313#define PSC_SPICFG_RT_FIFO1 (0 << 30)
314#define PSC_SPICFG_RT_FIFO2 (1 << 30)
315#define PSC_SPICFG_RT_FIFO4 (2 << 30)
316#define PSC_SPICFG_RT_FIFO8 (3 << 30)
317
318#define PSC_SPICFG_TT_MASK (3 << 28)
319#define PSC_SPICFG_TT_FIFO1 (0 << 28)
320#define PSC_SPICFG_TT_FIFO2 (1 << 28)
321#define PSC_SPICFG_TT_FIFO4 (2 << 28)
322#define PSC_SPICFG_TT_FIFO8 (3 << 28)
323
324#define PSC_SPICFG_DD_DISABLE (1 << 27)
325#define PSC_SPICFG_DE_ENABLE (1 << 26)
326#define PSC_SPICFG_CLR_BAUD(x) ((x) & ~((0x3f) << 15))
327#define PSC_SPICFG_SET_BAUD(x) (((x) & 0x3f) << 15)
328
329#define PSC_SPICFG_SET_DIV(x) (((x) & 0x03) << 13)
330#define PSC_SPICFG_DIV2 0
331#define PSC_SPICFG_DIV4 1
332#define PSC_SPICFG_DIV8 2
333#define PSC_SPICFG_DIV16 3
334
335#define PSC_SPICFG_BI (1 << 12)
336#define PSC_SPICFG_PSE (1 << 11)
337#define PSC_SPICFG_CGE (1 << 10)
338#define PSC_SPICFG_CDE (1 << 9)
339
340#define PSC_SPICFG_CLR_LEN(x) ((x) & ~((0x1f) << 4))
341#define PSC_SPICFG_SET_LEN(x) (((x-1) & 0x1f) << 4)
342
343#define PSC_SPICFG_LB (1 << 3)
344#define PSC_SPICFG_MLF (1 << 1)
345#define PSC_SPICFG_MO (1 << 0)
346
347/* SPI Mask Register. */
348#define PSC_SPIMSK_MM (1 << 16)
349#define PSC_SPIMSK_RR (1 << 13)
350#define PSC_SPIMSK_RO (1 << 12)
351#define PSC_SPIMSK_RU (1 << 11)
352#define PSC_SPIMSK_TR (1 << 10)
353#define PSC_SPIMSK_TO (1 << 9)
354#define PSC_SPIMSK_TU (1 << 8)
355#define PSC_SPIMSK_SD (1 << 5)
356#define PSC_SPIMSK_MD (1 << 4)
357#define PSC_SPIMSK_ALLMASK (PSC_SPIMSK_MM | PSC_SPIMSK_RR | \
358 PSC_SPIMSK_RO | PSC_SPIMSK_TO | \
359 PSC_SPIMSK_TU | PSC_SPIMSK_SD | \
360 PSC_SPIMSK_MD)
361
362/* SPI Protocol Control Register. */
363#define PSC_SPIPCR_RC (1 << 6)
364#define PSC_SPIPCR_SP (1 << 5)
365#define PSC_SPIPCR_SS (1 << 4)
366#define PSC_SPIPCR_TC (1 << 2)
367#define PSC_SPIPCR_MS (1 << 0)
368
369/* SPI Status register (read only). */
370#define PSC_SPISTAT_RF (1 << 13)
371#define PSC_SPISTAT_RE (1 << 12)
372#define PSC_SPISTAT_RR (1 << 11)
373#define PSC_SPISTAT_TF (1 << 10)
374#define PSC_SPISTAT_TE (1 << 9)
375#define PSC_SPISTAT_TR (1 << 8)
376#define PSC_SPISTAT_SB (1 << 5)
377#define PSC_SPISTAT_MB (1 << 4)
378#define PSC_SPISTAT_DI (1 << 2)
379#define PSC_SPISTAT_DR (1 << 1)
380#define PSC_SPISTAT_SR (1 << 0)
381
382/* SPI Event Register. */
383#define PSC_SPIEVNT_MM (1 << 16)
384#define PSC_SPIEVNT_RR (1 << 13)
385#define PSC_SPIEVNT_RO (1 << 12)
386#define PSC_SPIEVNT_RU (1 << 11)
387#define PSC_SPIEVNT_TR (1 << 10)
388#define PSC_SPIEVNT_TO (1 << 9)
389#define PSC_SPIEVNT_TU (1 << 8)
390#define PSC_SPIEVNT_SD (1 << 5)
391#define PSC_SPIEVNT_MD (1 << 4)
392
393/* Transmit register control. */
394#define PSC_SPITXRX_LC (1 << 29)
395#define PSC_SPITXRX_SR (1 << 28)
396
397/* PSC in SMBus (I2C) Mode. */
398typedef struct psc_smb {
399 u32 psc_sel;
400 u32 psc_ctrl;
401 u32 psc_smbcfg;
402 u32 psc_smbmsk;
403 u32 psc_smbpcr;
404 u32 psc_smbstat;
405 u32 psc_smbevnt;
406 u32 psc_smbtxrx;
407 u32 psc_smbtmr;
408} psc_smb_t;
409
410/* SMBus Config Register. */
411#define PSC_SMBCFG_RT_MASK (3 << 30)
412#define PSC_SMBCFG_RT_FIFO1 (0 << 30)
413#define PSC_SMBCFG_RT_FIFO2 (1 << 30)
414#define PSC_SMBCFG_RT_FIFO4 (2 << 30)
415#define PSC_SMBCFG_RT_FIFO8 (3 << 30)
416
417#define PSC_SMBCFG_TT_MASK (3 << 28)
418#define PSC_SMBCFG_TT_FIFO1 (0 << 28)
419#define PSC_SMBCFG_TT_FIFO2 (1 << 28)
420#define PSC_SMBCFG_TT_FIFO4 (2 << 28)
421#define PSC_SMBCFG_TT_FIFO8 (3 << 28)
422
423#define PSC_SMBCFG_DD_DISABLE (1 << 27)
424#define PSC_SMBCFG_DE_ENABLE (1 << 26)
425
426#define PSC_SMBCFG_SET_DIV(x) (((x) & 0x03) << 13)
427#define PSC_SMBCFG_DIV2 0
428#define PSC_SMBCFG_DIV4 1
429#define PSC_SMBCFG_DIV8 2
430#define PSC_SMBCFG_DIV16 3
431
432#define PSC_SMBCFG_GCE (1 << 9)
433#define PSC_SMBCFG_SFM (1 << 8)
434
435#define PSC_SMBCFG_SET_SLV(x) (((x) & 0x7f) << 1)
436
437/* SMBus Mask Register. */
438#define PSC_SMBMSK_DN (1 << 30)
439#define PSC_SMBMSK_AN (1 << 29)
440#define PSC_SMBMSK_AL (1 << 28)
441#define PSC_SMBMSK_RR (1 << 13)
442#define PSC_SMBMSK_RO (1 << 12)
443#define PSC_SMBMSK_RU (1 << 11)
444#define PSC_SMBMSK_TR (1 << 10)
445#define PSC_SMBMSK_TO (1 << 9)
446#define PSC_SMBMSK_TU (1 << 8)
447#define PSC_SMBMSK_SD (1 << 5)
448#define PSC_SMBMSK_MD (1 << 4)
449#define PSC_SMBMSK_ALLMASK (PSC_SMBMSK_DN | PSC_SMBMSK_AN | \
450 PSC_SMBMSK_AL | PSC_SMBMSK_RR | \
451 PSC_SMBMSK_RO | PSC_SMBMSK_TO | \
452 PSC_SMBMSK_TU | PSC_SMBMSK_SD | \
453 PSC_SMBMSK_MD)
454
455/* SMBus Protocol Control Register. */
456#define PSC_SMBPCR_DC (1 << 2)
457#define PSC_SMBPCR_MS (1 << 0)
458
459/* SMBus Status register (read only). */
460#define PSC_SMBSTAT_BB (1 << 28)
461#define PSC_SMBSTAT_RF (1 << 13)
462#define PSC_SMBSTAT_RE (1 << 12)
463#define PSC_SMBSTAT_RR (1 << 11)
464#define PSC_SMBSTAT_TF (1 << 10)
465#define PSC_SMBSTAT_TE (1 << 9)
466#define PSC_SMBSTAT_TR (1 << 8)
467#define PSC_SMBSTAT_SB (1 << 5)
468#define PSC_SMBSTAT_MB (1 << 4)
469#define PSC_SMBSTAT_DI (1 << 2)
470#define PSC_SMBSTAT_DR (1 << 1)
471#define PSC_SMBSTAT_SR (1 << 0)
472
473/* SMBus Event Register. */
474#define PSC_SMBEVNT_DN (1 << 30)
475#define PSC_SMBEVNT_AN (1 << 29)
476#define PSC_SMBEVNT_AL (1 << 28)
477#define PSC_SMBEVNT_RR (1 << 13)
478#define PSC_SMBEVNT_RO (1 << 12)
479#define PSC_SMBEVNT_RU (1 << 11)
480#define PSC_SMBEVNT_TR (1 << 10)
481#define PSC_SMBEVNT_TO (1 << 9)
482#define PSC_SMBEVNT_TU (1 << 8)
483#define PSC_SMBEVNT_SD (1 << 5)
484#define PSC_SMBEVNT_MD (1 << 4)
485#define PSC_SMBEVNT_ALLCLR (PSC_SMBEVNT_DN | PSC_SMBEVNT_AN | \
486 PSC_SMBEVNT_AL | PSC_SMBEVNT_RR | \
487 PSC_SMBEVNT_RO | PSC_SMBEVNT_TO | \
488 PSC_SMBEVNT_TU | PSC_SMBEVNT_SD | \
489 PSC_SMBEVNT_MD)
490
491/* Transmit register control. */
492#define PSC_SMBTXRX_RSR (1 << 28)
493#define PSC_SMBTXRX_STP (1 << 29)
494#define PSC_SMBTXRX_DATAMASK 0xff
495
496/* SMBus protocol timers register. */
497#define PSC_SMBTMR_SET_TH(x) (((x) & 0x03) << 30)
498#define PSC_SMBTMR_SET_PS(x) (((x) & 0x1f) << 25)
499#define PSC_SMBTMR_SET_PU(x) (((x) & 0x1f) << 20)
500#define PSC_SMBTMR_SET_SH(x) (((x) & 0x1f) << 15)
501#define PSC_SMBTMR_SET_SU(x) (((x) & 0x1f) << 10)
502#define PSC_SMBTMR_SET_CL(x) (((x) & 0x1f) << 5)
503#define PSC_SMBTMR_SET_CH(x) (((x) & 0x1f) << 0)
504
505#endif /* _AU1000_PSC_H_ */
diff --git a/include/asm-mips/mach-au1x00/gpio.h b/include/asm-mips/mach-au1x00/gpio.h
deleted file mode 100644
index 2dc61e009a08..000000000000
--- a/include/asm-mips/mach-au1x00/gpio.h
+++ /dev/null
@@ -1,69 +0,0 @@
1#ifndef _AU1XXX_GPIO_H_
2#define _AU1XXX_GPIO_H_
3
4#include <linux/types.h>
5
6#define AU1XXX_GPIO_BASE 200
7
8struct au1x00_gpio2 {
9 u32 dir;
10 u32 reserved;
11 u32 output;
12 u32 pinstate;
13 u32 inten;
14 u32 enable;
15};
16
17extern int au1xxx_gpio_get_value(unsigned gpio);
18extern void au1xxx_gpio_set_value(unsigned gpio, int value);
19extern int au1xxx_gpio_direction_input(unsigned gpio);
20extern int au1xxx_gpio_direction_output(unsigned gpio, int value);
21
22
23/* Wrappers for the arch-neutral GPIO API */
24
25static inline int gpio_request(unsigned gpio, const char *label)
26{
27 /* Not yet implemented */
28 return 0;
29}
30
31static inline void gpio_free(unsigned gpio)
32{
33 /* Not yet implemented */
34}
35
36static inline int gpio_direction_input(unsigned gpio)
37{
38 return au1xxx_gpio_direction_input(gpio);
39}
40
41static inline int gpio_direction_output(unsigned gpio, int value)
42{
43 return au1xxx_gpio_direction_output(gpio, value);
44}
45
46static inline int gpio_get_value(unsigned gpio)
47{
48 return au1xxx_gpio_get_value(gpio);
49}
50
51static inline void gpio_set_value(unsigned gpio, int value)
52{
53 au1xxx_gpio_set_value(gpio, value);
54}
55
56static inline int gpio_to_irq(unsigned gpio)
57{
58 return gpio;
59}
60
61static inline int irq_to_gpio(unsigned irq)
62{
63 return irq;
64}
65
66/* For cansleep */
67#include <asm-generic/gpio.h>
68
69#endif /* _AU1XXX_GPIO_H_ */
diff --git a/include/asm-mips/mach-au1x00/ioremap.h b/include/asm-mips/mach-au1x00/ioremap.h
deleted file mode 100644
index 364cea2dc71f..000000000000
--- a/include/asm-mips/mach-au1x00/ioremap.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * include/asm-mips/mach-au1x00/ioremap.h
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
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef __ASM_MACH_AU1X00_IOREMAP_H
10#define __ASM_MACH_AU1X00_IOREMAP_H
11
12#include <linux/types.h>
13
14#ifdef CONFIG_64BIT_PHYS_ADDR
15extern phys_t __fixup_bigphys_addr(phys_t, phys_t);
16#else
17static inline phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
18{
19 return phys_addr;
20}
21#endif
22
23/*
24 * Allow physical addresses to be fixed up to help 36-bit peripherals.
25 */
26static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
27{
28 return __fixup_bigphys_addr(phys_addr, size);
29}
30
31static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
32 unsigned long flags)
33{
34 return NULL;
35}
36
37static inline int plat_iounmap(const volatile void __iomem *addr)
38{
39 return 0;
40}
41
42#endif /* __ASM_MACH_AU1X00_IOREMAP_H */
diff --git a/include/asm-mips/mach-au1x00/prom.h b/include/asm-mips/mach-au1x00/prom.h
deleted file mode 100644
index e38715577c51..000000000000
--- a/include/asm-mips/mach-au1x00/prom.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __AU1X00_PROM_H
2#define __AU1X00_PROM_H
3
4extern int prom_argc;
5extern char **prom_argv;
6extern char **prom_envp;
7
8extern void prom_init_cmdline(void);
9extern char *prom_getcmdline(void);
10extern char *prom_getenv(char *envname);
11extern int prom_get_ethernet_addr(char *ethernet_addr);
12
13#endif
diff --git a/include/asm-mips/mach-au1x00/war.h b/include/asm-mips/mach-au1x00/war.h
deleted file mode 100644
index dd57d03d68ba..000000000000
--- a/include/asm-mips/mach-au1x00/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_AU1X00_WAR_H
9#define __ASM_MIPS_MACH_AU1X00_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_AU1X00_WAR_H */
diff --git a/include/asm-mips/mach-bcm47xx/bcm47xx.h b/include/asm-mips/mach-bcm47xx/bcm47xx.h
deleted file mode 100644
index d008f47a28bd..000000000000
--- a/include/asm-mips/mach-bcm47xx/bcm47xx.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
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_BCM47XX_H
20#define __ASM_BCM47XX_H
21
22/* SSB bus */
23extern struct ssb_bus ssb_bcm47xx;
24
25#endif /* __ASM_BCM47XX_H */
diff --git a/include/asm-mips/mach-bcm47xx/gpio.h b/include/asm-mips/mach-bcm47xx/gpio.h
deleted file mode 100644
index cfc8f4d618ce..000000000000
--- a/include/asm-mips/mach-bcm47xx/gpio.h
+++ /dev/null
@@ -1,59 +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) 2007 Aurelien Jarno <aurelien@aurel32.net>
7 */
8
9#ifndef __BCM47XX_GPIO_H
10#define __BCM47XX_GPIO_H
11
12#define BCM47XX_EXTIF_GPIO_LINES 5
13#define BCM47XX_CHIPCO_GPIO_LINES 16
14
15extern int bcm47xx_gpio_to_irq(unsigned gpio);
16extern int bcm47xx_gpio_get_value(unsigned gpio);
17extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
18extern int bcm47xx_gpio_direction_input(unsigned gpio);
19extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);
20
21static inline int gpio_request(unsigned gpio, const char *label)
22{
23 return 0;
24}
25
26static inline void gpio_free(unsigned gpio)
27{
28}
29
30static inline int gpio_to_irq(unsigned gpio)
31{
32 return bcm47xx_gpio_to_irq(gpio);
33}
34
35static inline int gpio_get_value(unsigned gpio)
36{
37 return bcm47xx_gpio_get_value(gpio);
38}
39
40static inline void gpio_set_value(unsigned gpio, int value)
41{
42 bcm47xx_gpio_set_value(gpio, value);
43}
44
45static inline int gpio_direction_input(unsigned gpio)
46{
47 return bcm47xx_gpio_direction_input(gpio);
48}
49
50static inline int gpio_direction_output(unsigned gpio, int value)
51{
52 return bcm47xx_gpio_direction_output(gpio, value);
53}
54
55
56/* cansleep wrappers */
57#include <asm-generic/gpio.h>
58
59#endif /* __BCM47XX_GPIO_H */
diff --git a/include/asm-mips/mach-bcm47xx/war.h b/include/asm-mips/mach-bcm47xx/war.h
deleted file mode 100644
index 4a2b7986b582..000000000000
--- a/include/asm-mips/mach-bcm47xx/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_BCM947XX_WAR_H
9#define __ASM_MIPS_MACH_BCM947XX_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_BCM947XX_WAR_H */
diff --git a/include/asm-mips/mach-cobalt/cobalt.h b/include/asm-mips/mach-cobalt/cobalt.h
deleted file mode 100644
index 5b9fce73f11d..000000000000
--- a/include/asm-mips/mach-cobalt/cobalt.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * The Cobalt board ID information.
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) 1997 Cobalt Microserver
9 * Copyright (C) 1997, 2003 Ralf Baechle
10 * Copyright (C) 2001, 2002, 2003 Liam Davies (ldavies@agile.tv)
11 */
12#ifndef __ASM_COBALT_H
13#define __ASM_COBALT_H
14
15extern int cobalt_board_id;
16
17#define COBALT_BRD_ID_QUBE1 0x3
18#define COBALT_BRD_ID_RAQ1 0x4
19#define COBALT_BRD_ID_QUBE2 0x5
20#define COBALT_BRD_ID_RAQ2 0x6
21
22#endif /* __ASM_COBALT_H */
diff --git a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h b/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
deleted file mode 100644
index b3314cf53194..000000000000
--- a/include/asm-mips/mach-cobalt/cpu-feature-overrides.h
+++ /dev/null
@@ -1,56 +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, 07 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
9#define __ASM_COBALT_CPU_FEATURE_OVERRIDES_H
10
11
12#define cpu_has_tlb 1
13#define cpu_has_4kex 1
14#define cpu_has_3k_cache 0
15#define cpu_has_4k_cache 1
16#define cpu_has_tx39_cache 0
17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1
19#define cpu_has_counter 1
20#define cpu_has_watch 0
21#define cpu_has_divec 1
22#define cpu_has_vce 0
23#define cpu_has_cache_cdex_p 0
24#define cpu_has_cache_cdex_s 0
25#define cpu_has_prefetch 0
26#define cpu_has_mcheck 0
27#define cpu_has_ejtag 0
28
29#define cpu_has_inclusive_pcaches 0
30#define cpu_dcache_line_size() 32
31#define cpu_icache_line_size() 32
32#define cpu_scache_line_size() 0
33
34#ifdef CONFIG_64BIT
35#define cpu_has_llsc 0
36#else
37#define cpu_has_llsc 1
38#endif
39
40#define cpu_has_mips16 0
41#define cpu_has_mdmx 0
42#define cpu_has_mips3d 0
43#define cpu_has_smartmips 0
44#define cpu_has_vtag_icache 0
45#define cpu_has_ic_fills_f_dc 0
46#define cpu_icache_snoops_remote_store 0
47#define cpu_has_dsp 0
48#define cpu_has_mipsmt 0
49#define cpu_has_userlocal 0
50
51#define cpu_has_mips32r1 0
52#define cpu_has_mips32r2 0
53#define cpu_has_mips64r1 0
54#define cpu_has_mips64r2 0
55
56#endif /* __ASM_COBALT_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-cobalt/irq.h b/include/asm-mips/mach-cobalt/irq.h
deleted file mode 100644
index 57c8c9ac5851..000000000000
--- a/include/asm-mips/mach-cobalt/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * Cobalt IRQ definitions.
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) 1997 Cobalt Microserver
9 * Copyright (C) 1997, 2003 Ralf Baechle
10 * Copyright (C) 2001-2003 Liam Davies (ldavies@agile.tv)
11 * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
12 */
13#ifndef _ASM_COBALT_IRQ_H
14#define _ASM_COBALT_IRQ_H
15
16/*
17 * i8259 interrupts used on Cobalt:
18 *
19 * 8 - RTC
20 * 9 - PCI slot
21 * 14 - IDE0
22 * 15 - IDE1(no connector on board)
23 */
24#define I8259A_IRQ_BASE 0
25
26#define PCISLOT_IRQ (I8259A_IRQ_BASE + 9)
27
28/*
29 * CPU interrupts used on Cobalt:
30 *
31 * 0 - Software interrupt 0 (unused)
32 * 1 - Software interrupt 0 (unused)
33 * 2 - cascade GT64111
34 * 3 - ethernet or SCSI host controller
35 * 4 - ethernet
36 * 5 - 16550 UART
37 * 6 - cascade i8259
38 * 7 - CP0 counter
39 */
40#define MIPS_CPU_IRQ_BASE 16
41
42#define GT641XX_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 2)
43#define RAQ2_SCSI_IRQ (MIPS_CPU_IRQ_BASE + 3)
44#define ETH0_IRQ (MIPS_CPU_IRQ_BASE + 3)
45#define QUBE1_ETH0_IRQ (MIPS_CPU_IRQ_BASE + 4)
46#define ETH1_IRQ (MIPS_CPU_IRQ_BASE + 4)
47#define SERIAL_IRQ (MIPS_CPU_IRQ_BASE + 5)
48#define SCSI_IRQ (MIPS_CPU_IRQ_BASE + 5)
49#define I8259_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 6)
50
51#define GT641XX_IRQ_BASE 24
52
53#include <asm/irq_gt641xx.h>
54
55#define NR_IRQS (GT641XX_PCI_INT3_IRQ + 1)
56
57#endif /* _ASM_COBALT_IRQ_H */
diff --git a/include/asm-mips/mach-cobalt/mach-gt64120.h b/include/asm-mips/mach-cobalt/mach-gt64120.h
deleted file mode 100644
index ae9c5523c7ef..000000000000
--- a/include/asm-mips/mach-cobalt/mach-gt64120.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright (C) 2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef _COBALT_MACH_GT64120_H
19#define _COBALT_MACH_GT64120_H
20
21/*
22 * Cobalt uses GT64111. GT64111 is almost the same as GT64120.
23 */
24
25#define GT64120_BASE CKSEG1ADDR(GT_DEF_BASE)
26
27#endif /* _COBALT_MACH_GT64120_H */
diff --git a/include/asm-mips/mach-cobalt/war.h b/include/asm-mips/mach-cobalt/war.h
deleted file mode 100644
index 97884fd18ac0..000000000000
--- a/include/asm-mips/mach-cobalt/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_COBALT_WAR_H
9#define __ASM_MIPS_MACH_COBALT_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_COBALT_WAR_H */
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
deleted file mode 100644
index 27f26102b1bb..000000000000
--- a/include/asm-mips/mach-db1x00/db1200.h
+++ /dev/null
@@ -1,230 +0,0 @@
1/*
2 * AMD Alchemy DBAu1200 Reference Board
3 * Board register defines.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 *
23 */
24#ifndef __ASM_DB1200_H
25#define __ASM_DB1200_H
26
27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h>
29
30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
34
35/*
36 * SPI and SMB are muxed on the DBAu1200 board.
37 * Refer to board documentation.
38 */
39#define SPI_PSC_BASE PSC0_BASE_ADDR
40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
41/*
42 * AC'97 and I2S are muxed on the DBAu1200 board.
43 * Refer to board documentation.
44 */
45#define AC97_PSC_BASE PSC1_BASE_ADDR
46#define I2S_PSC_BASE PSC1_BASE_ADDR
47
48#define BCSR_KSEG1_ADDR 0xB9800000
49
50typedef volatile struct
51{
52 /*00*/ u16 whoami;
53 u16 reserved0;
54 /*04*/ u16 status;
55 u16 reserved1;
56 /*08*/ u16 switches;
57 u16 reserved2;
58 /*0C*/ u16 resets;
59 u16 reserved3;
60
61 /*10*/ u16 pcmcia;
62 u16 reserved4;
63 /*14*/ u16 board;
64 u16 reserved5;
65 /*18*/ u16 disk_leds;
66 u16 reserved6;
67 /*1C*/ u16 system;
68 u16 reserved7;
69
70 /*20*/ u16 intclr;
71 u16 reserved8;
72 /*24*/ u16 intset;
73 u16 reserved9;
74 /*28*/ u16 intclr_mask;
75 u16 reserved10;
76 /*2C*/ u16 intset_mask;
77 u16 reserved11;
78
79 /*30*/ u16 sig_status;
80 u16 reserved12;
81 /*34*/ u16 int_status;
82 u16 reserved13;
83 /*38*/ u16 reserved14;
84 u16 reserved15;
85 /*3C*/ u16 reserved16;
86 u16 reserved17;
87
88} BCSR;
89
90static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
91
92/*
93 * Register bit definitions for the BCSRs
94 */
95#define BCSR_WHOAMI_DCID 0x000F
96#define BCSR_WHOAMI_CPLD 0x00F0
97#define BCSR_WHOAMI_BOARD 0x0F00
98
99#define BCSR_STATUS_PCMCIA0VS 0x0003
100#define BCSR_STATUS_PCMCIA1VS 0x000C
101#define BCSR_STATUS_SWAPBOOT 0x0040
102#define BCSR_STATUS_FLASHBUSY 0x0100
103#define BCSR_STATUS_IDECBLID 0x0200
104#define BCSR_STATUS_SD0WP 0x0400
105#define BCSR_STATUS_U0RXD 0x1000
106#define BCSR_STATUS_U1RXD 0x2000
107
108#define BCSR_SWITCHES_OCTAL 0x00FF
109#define BCSR_SWITCHES_DIP_1 0x0080
110#define BCSR_SWITCHES_DIP_2 0x0040
111#define BCSR_SWITCHES_DIP_3 0x0020
112#define BCSR_SWITCHES_DIP_4 0x0010
113#define BCSR_SWITCHES_DIP_5 0x0008
114#define BCSR_SWITCHES_DIP_6 0x0004
115#define BCSR_SWITCHES_DIP_7 0x0002
116#define BCSR_SWITCHES_DIP_8 0x0001
117#define BCSR_SWITCHES_ROTARY 0x0F00
118
119#define BCSR_RESETS_ETH 0x0001
120#define BCSR_RESETS_CAMERA 0x0002
121#define BCSR_RESETS_DC 0x0004
122#define BCSR_RESETS_IDE 0x0008
123#define BCSR_RESETS_TV 0x0010
124/* Not resets but in the same register */
125#define BCSR_RESETS_PWMR1MUX 0x0800
126#define BCSR_RESETS_PCS0MUX 0x1000
127#define BCSR_RESETS_PCS1MUX 0x2000
128#define BCSR_RESETS_SPISEL 0x4000
129
130#define BCSR_PCMCIA_PC0VPP 0x0003
131#define BCSR_PCMCIA_PC0VCC 0x000C
132#define BCSR_PCMCIA_PC0DRVEN 0x0010
133#define BCSR_PCMCIA_PC0RST 0x0080
134#define BCSR_PCMCIA_PC1VPP 0x0300
135#define BCSR_PCMCIA_PC1VCC 0x0C00
136#define BCSR_PCMCIA_PC1DRVEN 0x1000
137#define BCSR_PCMCIA_PC1RST 0x8000
138
139#define BCSR_BOARD_LCDVEE 0x0001
140#define BCSR_BOARD_LCDVDD 0x0002
141#define BCSR_BOARD_LCDBL 0x0004
142#define BCSR_BOARD_CAMSNAP 0x0010
143#define BCSR_BOARD_CAMPWR 0x0020
144#define BCSR_BOARD_SD0PWR 0x0040
145
146#define BCSR_LEDS_DECIMALS 0x0003
147#define BCSR_LEDS_LED0 0x0100
148#define BCSR_LEDS_LED1 0x0200
149#define BCSR_LEDS_LED2 0x0400
150#define BCSR_LEDS_LED3 0x0800
151
152#define BCSR_SYSTEM_POWEROFF 0x4000
153#define BCSR_SYSTEM_RESET 0x8000
154
155/* Bit positions for the different interrupt sources */
156#define BCSR_INT_IDE 0x0001
157#define BCSR_INT_ETH 0x0002
158#define BCSR_INT_PC0 0x0004
159#define BCSR_INT_PC0STSCHG 0x0008
160#define BCSR_INT_PC1 0x0010
161#define BCSR_INT_PC1STSCHG 0x0020
162#define BCSR_INT_DC 0x0040
163#define BCSR_INT_FLASHBUSY 0x0080
164#define BCSR_INT_PC0INSERT 0x0100
165#define BCSR_INT_PC0EJECT 0x0200
166#define BCSR_INT_PC1INSERT 0x0400
167#define BCSR_INT_PC1EJECT 0x0800
168#define BCSR_INT_SD0INSERT 0x1000
169#define BCSR_INT_SD0EJECT 0x2000
170
171#define SMC91C111_PHYS_ADDR 0x19000300
172#define SMC91C111_INT DB1200_ETH_INT
173
174#define IDE_PHYS_ADDR 0x18800000
175#define IDE_REG_SHIFT 5
176#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
177#define IDE_INT DB1200_IDE_INT
178#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
179#define IDE_RQSIZE 128
180
181#define NAND_PHYS_ADDR 0x20000000
182
183/*
184 * External Interrupts for DBAu1200 as of 8/6/2004.
185 * Bit positions in the CPLD registers can be calculated by taking
186 * the interrupt define and subtracting the DB1200_INT_BEGIN value.
187 *
188 * Example: IDE bis pos is = 64 - 64
189 * ETH bit pos is = 65 - 64
190 */
191enum external_pb1200_ints {
192 DB1200_INT_BEGIN = AU1000_MAX_INTR + 1,
193
194 DB1200_IDE_INT = DB1200_INT_BEGIN,
195 DB1200_ETH_INT,
196 DB1200_PC0_INT,
197 DB1200_PC0_STSCHG_INT,
198 DB1200_PC1_INT,
199 DB1200_PC1_STSCHG_INT,
200 DB1200_DC_INT,
201 DB1200_FLASHBUSY_INT,
202 DB1200_PC0_INSERT_INT,
203 DB1200_PC0_EJECT_INT,
204 DB1200_PC1_INSERT_INT,
205 DB1200_PC1_EJECT_INT,
206 DB1200_SD0_INSERT_INT,
207 DB1200_SD0_EJECT_INT,
208
209 DB1200_INT_END = DB1200_INT_BEGIN + 15,
210};
211
212
213/*
214 * DBAu1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
215 */
216#define PCMCIA_MAX_SOCK 1
217#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
218
219/* VPP/VCC */
220#define SET_VCC_VPP(VCC, VPP, SLOT) \
221 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
222
223#define BOARD_PC0_INT DB1200_PC0_INT
224#define BOARD_PC1_INT DB1200_PC1_INT
225#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
226
227/* NAND chip select */
228#define NAND_CS 1
229
230#endif /* __ASM_DB1200_H */
diff --git a/include/asm-mips/mach-db1x00/db1x00.h b/include/asm-mips/mach-db1x00/db1x00.h
deleted file mode 100644
index 1a515b8c870f..000000000000
--- a/include/asm-mips/mach-db1x00/db1x00.h
+++ /dev/null
@@ -1,179 +0,0 @@
1/*
2 * AMD Alchemy DBAu1x00 Reference Boards
3 *
4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * 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 it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_DB1X00_H
28#define __ASM_DB1X00_H
29
30#include <asm/mach-au1x00/au1xxx_psc.h>
31
32#ifdef CONFIG_MIPS_DB1550
33
34#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
35#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
36#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
37#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
38
39#define SPI_PSC_BASE PSC0_BASE_ADDR
40#define AC97_PSC_BASE PSC1_BASE_ADDR
41#define SMBUS_PSC_BASE PSC2_BASE_ADDR
42#define I2S_PSC_BASE PSC3_BASE_ADDR
43
44#define BCSR_KSEG1_ADDR 0xAF000000
45#define NAND_PHYS_ADDR 0x20000000
46
47#else
48#define BCSR_KSEG1_ADDR 0xAE000000
49#endif
50
51/*
52 * Overlay data structure of the DBAu1x00 board registers.
53 * Registers are located at physical 0E0000xx, KSEG1 0xAE0000xx.
54 */
55typedef volatile struct
56{
57 /*00*/ unsigned short whoami;
58 unsigned short reserved0;
59 /*04*/ unsigned short status;
60 unsigned short reserved1;
61 /*08*/ unsigned short switches;
62 unsigned short reserved2;
63 /*0C*/ unsigned short resets;
64 unsigned short reserved3;
65 /*10*/ unsigned short pcmcia;
66 unsigned short reserved4;
67 /*14*/ unsigned short specific;
68 unsigned short reserved5;
69 /*18*/ unsigned short leds;
70 unsigned short reserved6;
71 /*1C*/ unsigned short swreset;
72 unsigned short reserved7;
73
74} BCSR;
75
76
77/*
78 * Register/mask bit definitions for the BCSRs
79 */
80#define BCSR_WHOAMI_DCID 0x000F
81#define BCSR_WHOAMI_CPLD 0x00F0
82#define BCSR_WHOAMI_BOARD 0x0F00
83
84#define BCSR_STATUS_PC0VS 0x0003
85#define BCSR_STATUS_PC1VS 0x000C
86#define BCSR_STATUS_PC0FI 0x0010
87#define BCSR_STATUS_PC1FI 0x0020
88#define BCSR_STATUS_FLASHBUSY 0x0100
89#define BCSR_STATUS_ROMBUSY 0x0400
90#define BCSR_STATUS_SWAPBOOT 0x2000
91#define BCSR_STATUS_FLASHDEN 0xC000
92
93#define BCSR_SWITCHES_DIP 0x00FF
94#define BCSR_SWITCHES_DIP_1 0x0080
95#define BCSR_SWITCHES_DIP_2 0x0040
96#define BCSR_SWITCHES_DIP_3 0x0020
97#define BCSR_SWITCHES_DIP_4 0x0010
98#define BCSR_SWITCHES_DIP_5 0x0008
99#define BCSR_SWITCHES_DIP_6 0x0004
100#define BCSR_SWITCHES_DIP_7 0x0002
101#define BCSR_SWITCHES_DIP_8 0x0001
102#define BCSR_SWITCHES_ROTARY 0x0F00
103
104#define BCSR_RESETS_PHY0 0x0001
105#define BCSR_RESETS_PHY1 0x0002
106#define BCSR_RESETS_DC 0x0004
107#define BCSR_RESETS_FIR_SEL 0x2000
108#define BCSR_RESETS_IRDA_MODE_MASK 0xC000
109#define BCSR_RESETS_IRDA_MODE_FULL 0x0000
110#define BCSR_RESETS_IRDA_MODE_OFF 0x4000
111#define BCSR_RESETS_IRDA_MODE_2_3 0x8000
112#define BCSR_RESETS_IRDA_MODE_1_3 0xC000
113
114#define BCSR_PCMCIA_PC0VPP 0x0003
115#define BCSR_PCMCIA_PC0VCC 0x000C
116#define BCSR_PCMCIA_PC0DRVEN 0x0010
117#define BCSR_PCMCIA_PC0RST 0x0080
118#define BCSR_PCMCIA_PC1VPP 0x0300
119#define BCSR_PCMCIA_PC1VCC 0x0C00
120#define BCSR_PCMCIA_PC1DRVEN 0x1000
121#define BCSR_PCMCIA_PC1RST 0x8000
122
123#define BCSR_BOARD_PCIM66EN 0x0001
124#define BCSR_BOARD_SD0_PWR 0x0040
125#define BCSR_BOARD_SD1_PWR 0x0080
126#define BCSR_BOARD_PCIM33 0x0100
127#define BCSR_BOARD_GPIO200RST 0x0400
128#define BCSR_BOARD_PCICFG 0x1000
129#define BCSR_BOARD_SD0_WP 0x4000
130#define BCSR_BOARD_SD1_WP 0x8000
131
132#define BCSR_LEDS_DECIMALS 0x0003
133#define BCSR_LEDS_LED0 0x0100
134#define BCSR_LEDS_LED1 0x0200
135#define BCSR_LEDS_LED2 0x0400
136#define BCSR_LEDS_LED3 0x0800
137
138#define BCSR_SWRESET_RESET 0x0080
139
140/* PCMCIA DBAu1x00 specific defines */
141#define PCMCIA_MAX_SOCK 1
142#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
143
144/* VPP/VCC */
145#define SET_VCC_VPP(VCC, VPP, SLOT)\
146 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
147
148/*
149 * NAND defines
150 *
151 * Timing values as described in databook, * ns value stripped of the
152 * lower 2 bits.
153 * These defines are here rather than an Au1550 generic file because
154 * the parts chosen on another board may be different and may require
155 * different timings.
156 */
157#define NAND_T_H (18 >> 2)
158#define NAND_T_PUL (30 >> 2)
159#define NAND_T_SU (30 >> 2)
160#define NAND_T_WH (30 >> 2)
161
162/* Bitfield shift amounts */
163#define NAND_T_H_SHIFT 0
164#define NAND_T_PUL_SHIFT 4
165#define NAND_T_SU_SHIFT 8
166#define NAND_T_WH_SHIFT 12
167
168#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
169 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
170 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
171 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
172#define NAND_CS 1
173
174/* Should be done by YAMON */
175#define NAND_STCFG 0x00400005 /* 8-bit NAND */
176#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
177#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
178
179#endif /* __ASM_DB1X00_H */
diff --git a/include/asm-mips/mach-dec/mc146818rtc.h b/include/asm-mips/mach-dec/mc146818rtc.h
deleted file mode 100644
index 6724e99e43e1..000000000000
--- a/include/asm-mips/mach-dec/mc146818rtc.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * RTC definitions for DECstation style attached Dallas DS1287 chip.
3 *
4 * Copyright (C) 1998, 2001 by Ralf Baechle
5 * Copyright (C) 1998 by Harald Koerfgen
6 * Copyright (C) 2002, 2005 Maciej W. Rozycki
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#ifndef __ASM_MIPS_DEC_RTC_DEC_H
14#define __ASM_MIPS_DEC_RTC_DEC_H
15
16#include <linux/types.h>
17#include <asm/addrspace.h>
18#include <asm/dec/system.h>
19
20extern volatile u8 *dec_rtc_base;
21
22#define ARCH_RTC_LOCATION
23
24#define RTC_PORT(x) CPHYSADDR((long)dec_rtc_base)
25#define RTC_IO_EXTENT dec_kn_slot_size
26#define RTC_IOMAPPED 0
27#undef RTC_IRQ
28
29#define RTC_DEC_YEAR 0x3f /* Where we store the real year on DECs. */
30
31static inline unsigned char CMOS_READ(unsigned long addr)
32{
33 return dec_rtc_base[addr * 4];
34}
35
36static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
37{
38 dec_rtc_base[addr * 4] = data;
39}
40
41#define RTC_ALWAYS_BCD 0
42
43#endif /* __ASM_MIPS_DEC_RTC_DEC_H */
diff --git a/include/asm-mips/mach-dec/war.h b/include/asm-mips/mach-dec/war.h
deleted file mode 100644
index ca5e2ef909ad..000000000000
--- a/include/asm-mips/mach-dec/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_DEC_WAR_H
9#define __ASM_MIPS_MACH_DEC_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_DEC_WAR_H */
diff --git a/include/asm-mips/mach-emma2rh/irq.h b/include/asm-mips/mach-emma2rh/irq.h
deleted file mode 100644
index 5439eb856461..000000000000
--- a/include/asm-mips/mach-emma2rh/irq.h
+++ /dev/null
@@ -1,15 +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 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_EMMA2RH_IRQ_H
9#define __ASM_MACH_EMMA2RH_IRQ_H
10
11#define NR_IRQS 256
12
13#include_next <irq.h>
14
15#endif /* __ASM_MACH_EMMA2RH_IRQ_H */
diff --git a/include/asm-mips/mach-emma2rh/war.h b/include/asm-mips/mach-emma2rh/war.h
deleted file mode 100644
index b660a4c30e6a..000000000000
--- a/include/asm-mips/mach-emma2rh/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_EMMA2RH_WAR_H
9#define __ASM_MIPS_MACH_EMMA2RH_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_EMMA2RH_WAR_H */
diff --git a/include/asm-mips/mach-excite/cpu-feature-overrides.h b/include/asm-mips/mach-excite/cpu-feature-overrides.h
deleted file mode 100644
index 107104c3cd12..000000000000
--- a/include/asm-mips/mach-excite/cpu-feature-overrides.h
+++ /dev/null
@@ -1,48 +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) 2004 Thomas Koeller <thomas.koeller@baslerweb.com>
7 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H
11
12/*
13 * Basler eXcite has an RM9122 processor.
14 */
15#define cpu_has_watch 1
16#define cpu_has_mips16 0
17#define cpu_has_divec 0
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 0
23#define cpu_has_ejtag 0
24
25#define cpu_has_llsc 1
26#define cpu_has_vtag_icache 0
27#define cpu_has_dc_aliases 0
28#define cpu_has_ic_fills_f_dc 0
29#define cpu_has_dsp 0
30#define cpu_icache_snoops_remote_store 0
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
33
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_mips32r1 0
38#define cpu_has_mips32r2 0
39#define cpu_has_mips64r1 0
40#define cpu_has_mips64r2 0
41
42#define cpu_has_inclusive_pcaches 0
43
44#define cpu_dcache_line_size() 32
45#define cpu_icache_line_size() 32
46#define cpu_scache_line_size() 32
47
48#endif /* __ASM_MACH_EXCITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-excite/excite.h b/include/asm-mips/mach-excite/excite.h
deleted file mode 100644
index 4c29ba44992c..000000000000
--- a/include/asm-mips/mach-excite/excite.h
+++ /dev/null
@@ -1,154 +0,0 @@
1#ifndef __EXCITE_H__
2#define __EXCITE_H__
3
4#include <linux/init.h>
5#include <asm/addrspace.h>
6#include <asm/types.h>
7
8#define EXCITE_CPU_EXT_CLOCK 100000000
9
10#if !defined(__ASSEMBLY__)
11void __init excite_kgdb_init(void);
12void excite_procfs_init(void);
13extern unsigned long memsize;
14extern char modetty[];
15extern u32 unit_id;
16#endif
17
18/* Base name for XICAP devices */
19#define XICAP_NAME "xicap_gpi"
20
21/* OCD register offsets */
22#define LKB0 0x0038
23#define LKB5 0x0128
24#define LKM5 0x012C
25#define LKB7 0x0138
26#define LKM7 0x013c
27#define LKB8 0x0140
28#define LKM8 0x0144
29#define LKB9 0x0148
30#define LKM9 0x014c
31#define LKB10 0x0150
32#define LKM10 0x0154
33#define LKB11 0x0158
34#define LKM11 0x015c
35#define LKB12 0x0160
36#define LKM12 0x0164
37#define LKB13 0x0168
38#define LKM13 0x016c
39#define LDP0 0x0200
40#define LDP1 0x0210
41#define LDP2 0x0220
42#define LDP3 0x0230
43#define INTPIN0 0x0A40
44#define INTPIN1 0x0A44
45#define INTPIN2 0x0A48
46#define INTPIN3 0x0A4C
47#define INTPIN4 0x0A50
48#define INTPIN5 0x0A54
49#define INTPIN6 0x0A58
50#define INTPIN7 0x0A5C
51
52
53
54
55/* TITAN register offsets */
56#define CPRR 0x0004
57#define CPDSR 0x0008
58#define CPTC0R 0x000c
59#define CPTC1R 0x0010
60#define CPCFG0 0x0020
61#define CPCFG1 0x0024
62#define CPDST0A 0x0028
63#define CPDST0B 0x002c
64#define CPDST1A 0x0030
65#define CPDST1B 0x0034
66#define CPXDSTA 0x0038
67#define CPXDSTB 0x003c
68#define CPXCISRA 0x0048
69#define CPXCISRB 0x004c
70#define CPGIG0ER 0x0050
71#define CPGIG1ER 0x0054
72#define CPGRWL 0x0068
73#define CPURSLMT 0x00f8
74#define UACFG 0x0200
75#define UAINTS 0x0204
76#define SDRXFCIE 0x4828
77#define SDTXFCIE 0x4928
78#define INTP0Status0 0x1B00
79#define INTP0Mask0 0x1B04
80#define INTP0Set0 0x1B08
81#define INTP0Clear0 0x1B0C
82#define GXCFG 0x5000
83#define GXDMADRPFX 0x5018
84#define GXDMA_DESCADR 0x501c
85#define GXCH0TDESSTRT 0x5054
86
87/* IRQ definitions */
88#define NMICONFIG 0xac0
89#define TITAN_MSGINT 0xc4
90#define TITAN_IRQ ((TITAN_MSGINT / 0x20) + 2)
91#define FPGA0_MSGINT 0x5a
92#define FPGA0_IRQ ((FPGA0_MSGINT / 0x20) + 2)
93#define FPGA1_MSGINT 0x7b
94#define FPGA1_IRQ ((FPGA1_MSGINT / 0x20) + 2)
95#define PHY_MSGINT 0x9c
96#define PHY_IRQ ((PHY_MSGINT / 0x20) + 2)
97
98#if defined(CONFIG_BASLER_EXCITE_PROTOTYPE)
99/* Pre-release units used interrupt pin #9 */
100#define USB_IRQ 11
101#else
102/* Re-designed units use interrupt pin #1 */
103#define USB_MSGINT 0x39
104#define USB_IRQ ((USB_MSGINT / 0x20) + 2)
105#endif
106#define TIMER_IRQ 12
107
108
109/* Device address ranges */
110#define EXCITE_OFFS_OCD 0x1fffc000
111#define EXCITE_SIZE_OCD (16 * 1024)
112#define EXCITE_PHYS_OCD CPHYSADDR(EXCITE_OFFS_OCD)
113#define EXCITE_ADDR_OCD CKSEG1ADDR(EXCITE_OFFS_OCD)
114
115#define EXCITE_OFFS_SCRAM 0x1fffa000
116#define EXCITE_SIZE_SCRAM (8 << 10)
117#define EXCITE_PHYS_SCRAM CPHYSADDR(EXCITE_OFFS_SCRAM)
118#define EXCITE_ADDR_SCRAM CKSEG1ADDR(EXCITE_OFFS_SCRAM)
119
120#define EXCITE_OFFS_PCI_IO 0x1fff8000
121#define EXCITE_SIZE_PCI_IO (8 << 10)
122#define EXCITE_PHYS_PCI_IO CPHYSADDR(EXCITE_OFFS_PCI_IO)
123#define EXCITE_ADDR_PCI_IO CKSEG1ADDR(EXCITE_OFFS_PCI_IO)
124
125#define EXCITE_OFFS_TITAN 0x1fff0000
126#define EXCITE_SIZE_TITAN (32 << 10)
127#define EXCITE_PHYS_TITAN CPHYSADDR(EXCITE_OFFS_TITAN)
128#define EXCITE_ADDR_TITAN CKSEG1ADDR(EXCITE_OFFS_TITAN)
129
130#define EXCITE_OFFS_PCI_MEM 0x1ffe0000
131#define EXCITE_SIZE_PCI_MEM (64 << 10)
132#define EXCITE_PHYS_PCI_MEM CPHYSADDR(EXCITE_OFFS_PCI_MEM)
133#define EXCITE_ADDR_PCI_MEM CKSEG1ADDR(EXCITE_OFFS_PCI_MEM)
134
135#define EXCITE_OFFS_FPGA 0x1ffdc000
136#define EXCITE_SIZE_FPGA (16 << 10)
137#define EXCITE_PHYS_FPGA CPHYSADDR(EXCITE_OFFS_FPGA)
138#define EXCITE_ADDR_FPGA CKSEG1ADDR(EXCITE_OFFS_FPGA)
139
140#define EXCITE_OFFS_NAND 0x1ffd8000
141#define EXCITE_SIZE_NAND (16 << 10)
142#define EXCITE_PHYS_NAND CPHYSADDR(EXCITE_OFFS_NAND)
143#define EXCITE_ADDR_NAND CKSEG1ADDR(EXCITE_OFFS_NAND)
144
145#define EXCITE_OFFS_BOOTROM 0x1f000000
146#define EXCITE_SIZE_BOOTROM (8 << 20)
147#define EXCITE_PHYS_BOOTROM CPHYSADDR(EXCITE_OFFS_BOOTROM)
148#define EXCITE_ADDR_BOOTROM CKSEG1ADDR(EXCITE_OFFS_BOOTROM)
149
150/* FPGA address offsets */
151#define EXCITE_FPGA_DPR 0x0104 /* dual-ported ram */
152#define EXCITE_FPGA_SYSCTL 0x0200 /* system control register block */
153
154#endif /* __EXCITE_H__ */
diff --git a/include/asm-mips/mach-excite/excite_fpga.h b/include/asm-mips/mach-excite/excite_fpga.h
deleted file mode 100644
index 0a1ef69bece7..000000000000
--- a/include/asm-mips/mach-excite/excite_fpga.h
+++ /dev/null
@@ -1,80 +0,0 @@
1#ifndef EXCITE_FPGA_H_INCLUDED
2#define EXCITE_FPGA_H_INCLUDED
3
4
5/**
6 * Address alignment of the individual FPGA bytes.
7 * The address arrangement of the individual bytes of the FPGA is two
8 * byte aligned at the embedded MK2 platform.
9 */
10#ifdef EXCITE_CCI_FPGA_MK2
11typedef unsigned char excite_cci_fpga_align_t __attribute__ ((aligned(2)));
12#else
13typedef unsigned char excite_cci_fpga_align_t;
14#endif
15
16
17/**
18 * Size of Dual Ported RAM.
19 */
20#define EXCITE_DPR_SIZE 263
21
22
23/**
24 * Size of Reserved Status Fields in Dual Ported RAM.
25 */
26#define EXCITE_DPR_STATUS_SIZE 7
27
28
29
30/**
31 * FPGA.
32 * Hardware register layout of the FPGA interface. The FPGA must accessed
33 * byte wise solely.
34 * @see EXCITE_CCI_DPR_MK2
35 */
36typedef struct excite_fpga {
37
38 /**
39 * Dual Ported RAM.
40 */
41 excite_cci_fpga_align_t dpr[EXCITE_DPR_SIZE];
42
43 /**
44 * Status.
45 */
46 excite_cci_fpga_align_t status[EXCITE_DPR_STATUS_SIZE];
47
48#ifdef EXCITE_CCI_FPGA_MK2
49 /**
50 * RM9000 Interrupt.
51 * Write access initiates interrupt at the RM9000 (MIPS) processor of the eXcite.
52 */
53 excite_cci_fpga_align_t rm9k_int;
54#else
55 /**
56 * MK2 Interrupt.
57 * Write access initiates interrupt at the ARM processor of the MK2.
58 */
59 excite_cci_fpga_align_t mk2_int;
60
61 excite_cci_fpga_align_t gap[0x1000-0x10f];
62
63 /**
64 * IRQ Source/Acknowledge.
65 */
66 excite_cci_fpga_align_t rm9k_irq_src;
67
68 /**
69 * IRQ Mask.
70 * Set bits enable the related interrupt.
71 */
72 excite_cci_fpga_align_t rm9k_irq_mask;
73#endif
74
75
76} excite_fpga;
77
78
79
80#endif /* ndef EXCITE_FPGA_H_INCLUDED */
diff --git a/include/asm-mips/mach-excite/excite_nandflash.h b/include/asm-mips/mach-excite/excite_nandflash.h
deleted file mode 100644
index c4cf6140622e..000000000000
--- a/include/asm-mips/mach-excite/excite_nandflash.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __EXCITE_NANDFLASH_H__
2#define __EXCITE_NANDFLASH_H__
3
4/* Resource names */
5#define EXCITE_NANDFLASH_RESOURCE_REGS "excite_nandflash_regs"
6
7#endif /* __EXCITE_NANDFLASH_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_eth.h b/include/asm-mips/mach-excite/rm9k_eth.h
deleted file mode 100644
index 94705a46f72e..000000000000
--- a/include/asm-mips/mach-excite/rm9k_eth.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#if !defined(__RM9K_ETH_H__)
2#define __RM9K_ETH_H__
3
4#define RM9K_GE_NAME "rm9k_ge"
5
6/* Resource names */
7#define RM9K_GE_RESOURCE_MAC "rm9k_ge_mac"
8#define RM9K_GE_RESOURCE_MSTAT "rm9k_ge_mstat"
9#define RM9K_GE_RESOURCE_PKTPROC "rm9k_ge_pktproc"
10#define RM9K_GE_RESOURCE_XDMA "rm9k_ge_xdma"
11#define RM9K_GE_RESOURCE_FIFO_RX "rm9k_ge_fifo_rx"
12#define RM9K_GE_RESOURCE_FIFO_TX "rm9k_ge_fifo_tx"
13#define RM9K_GE_RESOURCE_FIFOMEM_RX "rm9k_ge_fifo_memory_rx"
14#define RM9K_GE_RESOURCE_FIFOMEM_TX "rm9k_ge_fifo_memory_tx"
15#define RM9K_GE_RESOURCE_PHY "rm9k_ge_phy"
16#define RM9K_GE_RESOURCE_DMADESC_RX "rm9k_ge_dmadesc_rx"
17#define RM9K_GE_RESOURCE_DMADESC_TX "rm9k_ge_dmadesc_tx"
18#define RM9K_GE_RESOURCE_IRQ_MAIN "rm9k_ge_irq_main"
19#define RM9K_GE_RESOURCE_IRQ_PHY "rm9k_ge_irq_phy"
20#define RM9K_GE_RESOURCE_GPI_SLICE "rm9k_ge_gpi_slice"
21#define RM9K_GE_RESOURCE_MDIO_CHANNEL "rm9k_ge_mdio_channel"
22
23#endif /* !defined(__RM9K_ETH_H__) */
diff --git a/include/asm-mips/mach-excite/rm9k_wdt.h b/include/asm-mips/mach-excite/rm9k_wdt.h
deleted file mode 100644
index 3fa3c08d2da7..000000000000
--- a/include/asm-mips/mach-excite/rm9k_wdt.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __RM9K_WDT_H__
2#define __RM9K_WDT_H__
3
4/* Device name */
5#define WDT_NAME "wdt_gpi"
6
7/* Resource names */
8#define WDT_RESOURCE_REGS "excite_watchdog_regs"
9#define WDT_RESOURCE_IRQ "excite_watchdog_irq"
10#define WDT_RESOURCE_COUNTER "excite_watchdog_counter"
11
12#endif /* __RM9K_WDT_H__ */
diff --git a/include/asm-mips/mach-excite/rm9k_xicap.h b/include/asm-mips/mach-excite/rm9k_xicap.h
deleted file mode 100644
index 009577734a8d..000000000000
--- a/include/asm-mips/mach-excite/rm9k_xicap.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __EXCITE_XICAP_H__
2#define __EXCITE_XICAP_H__
3
4
5/* Resource names */
6#define XICAP_RESOURCE_FIFO_RX "xicap_fifo_rx"
7#define XICAP_RESOURCE_FIFO_TX "xicap_fifo_tx"
8#define XICAP_RESOURCE_XDMA "xicap_xdma"
9#define XICAP_RESOURCE_DMADESC "xicap_dmadesc"
10#define XICAP_RESOURCE_PKTPROC "xicap_pktproc"
11#define XICAP_RESOURCE_IRQ "xicap_irq"
12#define XICAP_RESOURCE_GPI_SLICE "xicap_gpi_slice"
13#define XICAP_RESOURCE_FIFO_BLK "xicap_fifo_blocks"
14#define XICAP_RESOURCE_PKT_STREAM "xicap_pkt_stream"
15
16#endif /* __EXCITE_XICAP_H__ */
diff --git a/include/asm-mips/mach-excite/war.h b/include/asm-mips/mach-excite/war.h
deleted file mode 100644
index 1f82180c1598..000000000000
--- a/include/asm-mips/mach-excite/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_EXCITE_WAR_H
9#define __ASM_MIPS_MACH_EXCITE_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 1
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_EXCITE_WAR_H */
diff --git a/include/asm-mips/mach-generic/cpu-feature-overrides.h b/include/asm-mips/mach-generic/cpu-feature-overrides.h
deleted file mode 100644
index 7c185bb06f13..000000000000
--- a/include/asm-mips/mach-generic/cpu-feature-overrides.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) 2003 Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H
10
11/* Intentionally empty file ... */
12
13#endif /* __ASM_MACH_GENERIC_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-generic/dma-coherence.h b/include/asm-mips/mach-generic/dma-coherence.h
deleted file mode 100644
index 76e04e7feb84..000000000000
--- a/include/asm-mips/mach-generic/dma-coherence.h
+++ /dev/null
@@ -1,45 +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 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/floppy.h b/include/asm-mips/mach-generic/floppy.h
deleted file mode 100644
index 001a8ce17c17..000000000000
--- a/include/asm-mips/mach-generic/floppy.h
+++ /dev/null
@@ -1,139 +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) 1996, 1997, 1998, 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_FLOPPY_H
9#define __ASM_MACH_GENERIC_FLOPPY_H
10
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/ioport.h>
14#include <linux/sched.h>
15#include <linux/linkage.h>
16#include <linux/types.h>
17#include <linux/mm.h>
18
19#include <asm/bootinfo.h>
20#include <asm/cachectl.h>
21#include <asm/dma.h>
22#include <asm/floppy.h>
23#include <asm/io.h>
24#include <asm/irq.h>
25#include <asm/pgtable.h>
26
27/*
28 * How to access the FDC's registers.
29 */
30static inline unsigned char fd_inb(unsigned int port)
31{
32 return inb_p(port);
33}
34
35static inline void fd_outb(unsigned char value, unsigned int port)
36{
37 outb_p(value, port);
38}
39
40/*
41 * How to access the floppy DMA functions.
42 */
43static inline void fd_enable_dma(void)
44{
45 enable_dma(FLOPPY_DMA);
46}
47
48static inline void fd_disable_dma(void)
49{
50 disable_dma(FLOPPY_DMA);
51}
52
53static inline int fd_request_dma(void)
54{
55 return request_dma(FLOPPY_DMA, "floppy");
56}
57
58static inline void fd_free_dma(void)
59{
60 free_dma(FLOPPY_DMA);
61}
62
63static inline void fd_clear_dma_ff(void)
64{
65 clear_dma_ff(FLOPPY_DMA);
66}
67
68static inline void fd_set_dma_mode(char mode)
69{
70 set_dma_mode(FLOPPY_DMA, mode);
71}
72
73static inline void fd_set_dma_addr(char *addr)
74{
75 set_dma_addr(FLOPPY_DMA, (unsigned long) addr);
76}
77
78static inline void fd_set_dma_count(unsigned int count)
79{
80 set_dma_count(FLOPPY_DMA, count);
81}
82
83static inline int fd_get_dma_residue(void)
84{
85 return get_dma_residue(FLOPPY_DMA);
86}
87
88static inline void fd_enable_irq(void)
89{
90 enable_irq(FLOPPY_IRQ);
91}
92
93static inline void fd_disable_irq(void)
94{
95 disable_irq(FLOPPY_IRQ);
96}
97
98static inline int fd_request_irq(void)
99{
100 return request_irq(FLOPPY_IRQ, floppy_interrupt,
101 IRQF_DISABLED, "floppy", NULL);
102}
103
104static inline void fd_free_irq(void)
105{
106 free_irq(FLOPPY_IRQ, NULL);
107}
108
109#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
110
111
112static inline unsigned long fd_getfdaddr1(void)
113{
114 return 0x3f0;
115}
116
117static inline unsigned long fd_dma_mem_alloc(unsigned long size)
118{
119 unsigned long mem;
120
121 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
122
123 return mem;
124}
125
126static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
127{
128 free_pages(addr, get_order(size));
129}
130
131static inline unsigned long fd_drive_type(unsigned long n)
132{
133 if (n == 0)
134 return 4; /* 3,5", 1.44mb */
135
136 return 0;
137}
138
139#endif /* __ASM_MACH_GENERIC_FLOPPY_H */
diff --git a/include/asm-mips/mach-generic/gpio.h b/include/asm-mips/mach-generic/gpio.h
deleted file mode 100644
index b4e70208da64..000000000000
--- a/include/asm-mips/mach-generic/gpio.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __ASM_MACH_GENERIC_GPIO_H
2#define __ASM_MACH_GENERIC_GPIO_H
3
4#ifdef CONFIG_GPIOLIB
5#define gpio_get_value __gpio_get_value
6#define gpio_set_value __gpio_set_value
7#define gpio_cansleep __gpio_cansleep
8#else
9int gpio_request(unsigned gpio, const char *label);
10void gpio_free(unsigned gpio);
11int gpio_direction_input(unsigned gpio);
12int gpio_direction_output(unsigned gpio, int value);
13int gpio_get_value(unsigned gpio);
14void gpio_set_value(unsigned gpio, int value);
15#endif
16int gpio_to_irq(unsigned gpio);
17int irq_to_gpio(unsigned irq);
18
19#include <asm-generic/gpio.h> /* cansleep wrappers */
20
21#endif /* __ASM_MACH_GENERIC_GPIO_H */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
deleted file mode 100644
index 73008f7bdc93..000000000000
--- a/include/asm-mips/mach-generic/ide.h
+++ /dev/null
@@ -1,167 +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) 1994-1996 Linus Torvalds & authors
7 *
8 * Copied from i386; many of the especially older MIPS or ISA-based platforms
9 * are basically identical. Using this file probably implies i8259 PIC
10 * support in a system but the very least interrupt numbers 0 - 15 need to
11 * be put aside for legacy devices.
12 */
13#ifndef __ASM_MACH_GENERIC_IDE_H
14#define __ASM_MACH_GENERIC_IDE_H
15
16#ifdef __KERNEL__
17
18#include <linux/pci.h>
19#include <linux/stddef.h>
20#include <asm/processor.h>
21
22static __inline__ int ide_probe_legacy(void)
23{
24#ifdef CONFIG_PCI
25 struct pci_dev *dev;
26 /*
27 * This can be called on the ide_setup() path, super-early in
28 * boot. But the down_read() will enable local interrupts,
29 * which can cause some machines to crash. So here we detect
30 * and flag that situation and bail out early.
31 */
32 if (no_pci_devices())
33 return 0;
34 dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL);
35 if (dev)
36 goto found;
37 dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
38 if (dev)
39 goto found;
40 return 0;
41found:
42 pci_dev_put(dev);
43 return 1;
44#elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
45 return 1;
46#else
47 return 0;
48#endif
49}
50
51/* MIPS port and memory-mapped I/O string operations. */
52static inline void __ide_flush_prologue(void)
53{
54#ifdef CONFIG_SMP
55 if (cpu_has_dc_aliases)
56 preempt_disable();
57#endif
58}
59
60static inline void __ide_flush_epilogue(void)
61{
62#ifdef CONFIG_SMP
63 if (cpu_has_dc_aliases)
64 preempt_enable();
65#endif
66}
67
68static inline void __ide_flush_dcache_range(unsigned long addr, unsigned long size)
69{
70 if (cpu_has_dc_aliases) {
71 unsigned long end = addr + size;
72
73 while (addr < end) {
74 local_flush_data_cache_page((void *)addr);
75 addr += PAGE_SIZE;
76 }
77 }
78}
79
80/*
81 * insw() and gang might be called with interrupts disabled, so we can't
82 * send IPIs for flushing due to the potencial of deadlocks, see the comment
83 * above smp_call_function() in arch/mips/kernel/smp.c. We work around the
84 * problem by disabling preemption so we know we actually perform the flush
85 * on the processor that actually has the lines to be flushed which hopefully
86 * is even better for performance anyway.
87 */
88static inline void __ide_insw(unsigned long port, void *addr,
89 unsigned int count)
90{
91 __ide_flush_prologue();
92 insw(port, addr, count);
93 __ide_flush_dcache_range((unsigned long)addr, count * 2);
94 __ide_flush_epilogue();
95}
96
97static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
98{
99 __ide_flush_prologue();
100 insl(port, addr, count);
101 __ide_flush_dcache_range((unsigned long)addr, count * 4);
102 __ide_flush_epilogue();
103}
104
105static inline void __ide_outsw(unsigned long port, const void *addr,
106 unsigned long count)
107{
108 __ide_flush_prologue();
109 outsw(port, addr, count);
110 __ide_flush_dcache_range((unsigned long)addr, count * 2);
111 __ide_flush_epilogue();
112}
113
114static inline void __ide_outsl(unsigned long port, const void *addr,
115 unsigned long count)
116{
117 __ide_flush_prologue();
118 outsl(port, addr, count);
119 __ide_flush_dcache_range((unsigned long)addr, count * 4);
120 __ide_flush_epilogue();
121}
122
123static inline void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
124{
125 __ide_flush_prologue();
126 readsw(port, addr, count);
127 __ide_flush_dcache_range((unsigned long)addr, count * 2);
128 __ide_flush_epilogue();
129}
130
131static inline void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
132{
133 __ide_flush_prologue();
134 readsl(port, addr, count);
135 __ide_flush_dcache_range((unsigned long)addr, count * 4);
136 __ide_flush_epilogue();
137}
138
139static inline void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
140{
141 __ide_flush_prologue();
142 writesw(port, addr, count);
143 __ide_flush_dcache_range((unsigned long)addr, count * 2);
144 __ide_flush_epilogue();
145}
146
147static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
148{
149 __ide_flush_prologue();
150 writesl(port, addr, count);
151 __ide_flush_dcache_range((unsigned long)addr, count * 4);
152 __ide_flush_epilogue();
153}
154
155/* ide_insw calls insw, not __ide_insw. Why? */
156#undef insw
157#undef insl
158#undef outsw
159#undef outsl
160#define insw(port, addr, count) __ide_insw(port, addr, count)
161#define insl(port, addr, count) __ide_insl(port, addr, count)
162#define outsw(port, addr, count) __ide_outsw(port, addr, count)
163#define outsl(port, addr, count) __ide_outsl(port, addr, count)
164
165#endif /* __KERNEL__ */
166
167#endif /* __ASM_MACH_GENERIC_IDE_H */
diff --git a/include/asm-mips/mach-generic/ioremap.h b/include/asm-mips/mach-generic/ioremap.h
deleted file mode 100644
index b379938d47f0..000000000000
--- a/include/asm-mips/mach-generic/ioremap.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/asm-mips/mach-generic/ioremap.h
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
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef __ASM_MACH_GENERIC_IOREMAP_H
10#define __ASM_MACH_GENERIC_IOREMAP_H
11
12#include <linux/types.h>
13
14/*
15 * Allow physical addresses to be fixed up to help peripherals located
16 * outside the low 32-bit range -- generic pass-through version.
17 */
18static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
19{
20 return phys_addr;
21}
22
23static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
24 unsigned long flags)
25{
26 return NULL;
27}
28
29static inline int plat_iounmap(const volatile void __iomem *addr)
30{
31 return 0;
32}
33
34#endif /* __ASM_MACH_GENERIC_IOREMAP_H */
diff --git a/include/asm-mips/mach-generic/irq.h b/include/asm-mips/mach-generic/irq.h
deleted file mode 100644
index 70d9a25132c5..000000000000
--- a/include/asm-mips/mach-generic/irq.h
+++ /dev/null
@@ -1,45 +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 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_IRQ_H
9#define __ASM_MACH_GENERIC_IRQ_H
10
11#ifndef NR_IRQS
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 */
44
45#endif /* __ASM_MACH_GENERIC_IRQ_H */
diff --git a/include/asm-mips/mach-generic/kernel-entry-init.h b/include/asm-mips/mach-generic/kernel-entry-init.h
deleted file mode 100644
index 7e66505fa574..000000000000
--- a/include/asm-mips/mach-generic/kernel-entry-init.h
+++ /dev/null
@@ -1,25 +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) 2005 Embedded Alley Solutions, Inc
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_GENERIC_KERNEL_ENTRY_H
10#define __ASM_MACH_GENERIC_KERNEL_ENTRY_H
11
12/* Intentionally empty macro, used in head.S. Override in
13 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
14 */
15.macro kernel_entry_setup
16.endm
17
18/*
19 * Do SMP slave processor setup necessary before we can savely execute C code.
20 */
21 .macro smp_slave_setup
22 .endm
23
24
25#endif /* __ASM_MACH_GENERIC_KERNEL_ENTRY_H */
diff --git a/include/asm-mips/mach-generic/kmalloc.h b/include/asm-mips/mach-generic/kmalloc.h
deleted file mode 100644
index b8e6deba352f..000000000000
--- a/include/asm-mips/mach-generic/kmalloc.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ASM_MACH_GENERIC_KMALLOC_H
2#define __ASM_MACH_GENERIC_KMALLOC_H
3
4
5#ifndef CONFIG_DMA_COHERENT
6/*
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.
9 */
10#define ARCH_KMALLOC_MINALIGN 128
11#endif
12
13#endif /* __ASM_MACH_GENERIC_KMALLOC_H */
diff --git a/include/asm-mips/mach-generic/mangle-port.h b/include/asm-mips/mach-generic/mangle-port.h
deleted file mode 100644
index f49dc990214b..000000000000
--- a/include/asm-mips/mach-generic/mangle-port.h
+++ /dev/null
@@ -1,52 +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, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
9#define __ASM_MACH_GENERIC_MANGLE_PORT_H
10
11#define __swizzle_addr_b(port) (port)
12#define __swizzle_addr_w(port) (port)
13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port)
15
16/*
17 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
18 * less sane hardware forces software to fiddle with this...
19 *
20 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
21 * you can't have the numerical value of data and byte addresses within
22 * multibyte quantities both preserved at the same time. Hence two
23 * variations of functions: non-prefixed ones that preserve the value
24 * and prefixed ones that preserve byte addresses. The latters are
25 * typically used for moving raw data between a peripheral and memory (cf.
26 * string I/O functions), hence the "__mem_" prefix.
27 */
28#if defined(CONFIG_SWAP_IO_SPACE)
29
30# define ioswabb(a, x) (x)
31# define __mem_ioswabb(a, x) (x)
32# define ioswabw(a, x) le16_to_cpu(x)
33# define __mem_ioswabw(a, x) (x)
34# define ioswabl(a, x) le32_to_cpu(x)
35# define __mem_ioswabl(a, x) (x)
36# define ioswabq(a, x) le64_to_cpu(x)
37# define __mem_ioswabq(a, x) (x)
38
39#else
40
41# define ioswabb(a, x) (x)
42# define __mem_ioswabb(a, x) (x)
43# define ioswabw(a, x) (x)
44# define __mem_ioswabw(a, x) cpu_to_le16(x)
45# define ioswabl(a, x) (x)
46# define __mem_ioswabl(a, x) cpu_to_le32(x)
47# define ioswabq(a, x) (x)
48# define __mem_ioswabq(a, x) cpu_to_le32(x)
49
50#endif
51
52#endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-generic/mc146818rtc.h b/include/asm-mips/mach-generic/mc146818rtc.h
deleted file mode 100644
index 0b9a942f079d..000000000000
--- a/include/asm-mips/mach-generic/mc146818rtc.h
+++ /dev/null
@@ -1,36 +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) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_GENERIC_MC146818RTC_H
11#define __ASM_MACH_GENERIC_MC146818RTC_H
12
13#include <asm/io.h>
14
15#define RTC_PORT(x) (0x70 + (x))
16#define RTC_IRQ 8
17
18static inline unsigned char CMOS_READ(unsigned long addr)
19{
20 outb_p(addr, RTC_PORT(0));
21 return inb_p(RTC_PORT(1));
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 outb_p(addr, RTC_PORT(0));
27 outb_p(data, RTC_PORT(1));
28}
29
30#define RTC_ALWAYS_BCD 1
31
32#ifndef mc146818_decode_year
33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
34#endif
35
36#endif /* __ASM_MACH_GENERIC_MC146818RTC_H */
diff --git a/include/asm-mips/mach-generic/spaces.h b/include/asm-mips/mach-generic/spaces.h
deleted file mode 100644
index c9fa4b14968d..000000000000
--- a/include/asm-mips/mach-generic/spaces.h
+++ /dev/null
@@ -1,85 +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) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_GENERIC_SPACES_H
11#define _ASM_MACH_GENERIC_SPACES_H
12
13#include <linux/const.h>
14
15/*
16 * This gives the physical RAM offset.
17 */
18#ifndef PHYS_OFFSET
19#define PHYS_OFFSET _AC(0, UL)
20#endif
21
22#ifdef CONFIG_32BIT
23
24#define CAC_BASE _AC(0x80000000, UL)
25#define IO_BASE _AC(0xa0000000, UL)
26#define UNCAC_BASE _AC(0xa0000000, UL)
27
28#ifndef MAP_BASE
29#define MAP_BASE _AC(0xc0000000, UL)
30#endif
31
32/*
33 * Memory above this physical address will be considered highmem.
34 */
35#ifndef HIGHMEM_START
36#define HIGHMEM_START _AC(0x20000000, UL)
37#endif
38
39#endif /* CONFIG_32BIT */
40
41#ifdef CONFIG_64BIT
42
43#ifndef CAC_BASE
44#ifdef CONFIG_DMA_NONCOHERENT
45#define CAC_BASE _AC(0x9800000000000000, UL)
46#else
47#define CAC_BASE _AC(0xa800000000000000, UL)
48#endif
49#endif
50
51#ifndef IO_BASE
52#define IO_BASE _AC(0x9000000000000000, UL)
53#endif
54
55#ifndef UNCAC_BASE
56#define UNCAC_BASE _AC(0x9000000000000000, UL)
57#endif
58
59#ifndef MAP_BASE
60#define MAP_BASE _AC(0xc000000000000000, UL)
61#endif
62
63/*
64 * Memory above this physical address will be considered highmem.
65 * Fixme: 59 bits is a fictive number and makes assumptions about processors
66 * in the distant future. Nobody will care for a few years :-)
67 */
68#ifndef HIGHMEM_START
69#define HIGHMEM_START (_AC(1, UL) << _AC(59, UL))
70#endif
71
72#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
73#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
74#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
75
76#endif /* CONFIG_64BIT */
77
78/*
79 * This handles the memory map.
80 */
81#ifndef PAGE_OFFSET
82#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
83#endif
84
85#endif /* __ASM_MACH_GENERIC_SPACES_H */
diff --git a/include/asm-mips/mach-generic/topology.h b/include/asm-mips/mach-generic/topology.h
deleted file mode 100644
index 5428f333a02c..000000000000
--- a/include/asm-mips/mach-generic/topology.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/topology.h>
diff --git a/include/asm-mips/mach-ip22/cpu-feature-overrides.h b/include/asm-mips/mach-ip22/cpu-feature-overrides.h
deleted file mode 100644
index 9c8735158da1..000000000000
--- a/include/asm-mips/mach-ip22/cpu-feature-overrides.h
+++ /dev/null
@@ -1,44 +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, 07 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * IP22 with a variety of processors so we can't use defaults for everything.
13 */
14#define cpu_has_tlb 1
15#define cpu_has_4kex 1
16#define cpu_has_4k_cache 1
17#define cpu_has_fpu 1
18#define cpu_has_32fpr 1
19#define cpu_has_counter 1
20#define cpu_has_mips16 0
21#define cpu_has_divec 0
22#define cpu_has_cache_cdex_p 1
23#define cpu_has_prefetch 0
24#define cpu_has_mcheck 0
25#define cpu_has_ejtag 0
26
27#define cpu_has_llsc 1
28#define cpu_has_vtag_icache 0 /* Needs to change for R8000 */
29#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
30#define cpu_has_ic_fills_f_dc 0
31
32#define cpu_has_dsp 0
33#define cpu_has_mipsmt 0
34#define cpu_has_userlocal 0
35
36#define cpu_has_nofpuex 0
37#define cpu_has_64bits 1
38
39#define cpu_has_mips32r1 0
40#define cpu_has_mips32r2 0
41#define cpu_has_mips64r1 0
42#define cpu_has_mips64r2 0
43
44#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip22/ds1286.h b/include/asm-mips/mach-ip22/ds1286.h
deleted file mode 100644
index f19f1eafbc71..000000000000
--- a/include/asm-mips/mach-ip22/ds1286.h
+++ /dev/null
@@ -1,18 +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) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_IP22_DS1286_H
11#define __ASM_MACH_IP22_DS1286_H
12
13#include <asm/sgi/hpc3.h>
14
15#define rtc_read(reg) (hpc3c0->rtcregs[(reg)] & 0xff)
16#define rtc_write(data, reg) do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
17
18#endif /* __ASM_MACH_IP22_DS1286_H */
diff --git a/include/asm-mips/mach-ip22/spaces.h b/include/asm-mips/mach-ip22/spaces.h
deleted file mode 100644
index 7f9fa6f66059..000000000000
--- a/include/asm-mips/mach-ip22/spaces.h
+++ /dev/null
@@ -1,27 +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) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_IP22_SPACES_H
11#define _ASM_MACH_IP22_SPACES_H
12
13
14#ifdef CONFIG_64BIT
15
16#define PAGE_OFFSET 0xffffffff80000000UL
17
18#define CAC_BASE 0xffffffff80000000
19#define IO_BASE 0xffffffffa0000000
20#define UNCAC_BASE 0xffffffffa0000000
21#define MAP_BASE 0xc000000000000000
22
23#endif /* CONFIG_64BIT */
24
25#include <asm/mach-generic/spaces.h>
26
27#endif /* __ASM_MACH_IP22_SPACES_H */
diff --git a/include/asm-mips/mach-ip22/war.h b/include/asm-mips/mach-ip22/war.h
deleted file mode 100644
index a44fa9656a82..000000000000
--- a/include/asm-mips/mach-ip22/war.h
+++ /dev/null
@@ -1,29 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_IP22_WAR_H
9#define __ASM_MIPS_MACH_IP22_WAR_H
10
11/*
12 * R4600 CPU modules for the Indy come with both V1.7 and V2.0 processors.
13 */
14
15#define R4600_V1_INDEX_ICACHEOP_WAR 1
16#define R4600_V1_HIT_CACHEOP_WAR 1
17#define R4600_V2_HIT_CACHEOP_WAR 1
18#define R5432_CP0_INTERRUPT_WAR 0
19#define BCM1250_M3_WAR 0
20#define SIBYTE_1956_WAR 0
21#define MIPS4K_ICACHE_REFILL_WAR 0
22#define MIPS_CACHE_SYNC_WAR 0
23#define TX49XX_ICACHE_INDEX_INV_WAR 0
24#define RM9000_CDEX_SMP_WAR 0
25#define ICACHE_REFILLS_WORKAROUND_WAR 0
26#define R10000_LLSC_WAR 0
27#define MIPS34K_MISSED_ITLB_WAR 0
28
29#endif /* __ASM_MIPS_MACH_IP22_WAR_H */
diff --git a/include/asm-mips/mach-ip27/cpu-feature-overrides.h b/include/asm-mips/mach-ip27/cpu-feature-overrides.h
deleted file mode 100644
index 7d3112b148d9..000000000000
--- a/include/asm-mips/mach-ip27/cpu-feature-overrides.h
+++ /dev/null
@@ -1,54 +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, 07 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * IP27 only comes with R10000 family processors all using the same config
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_icache_snoops_remote_store 1
30#define cpu_has_mipsmt 0
31#define cpu_has_userlocal 0
32
33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1
35
36#define cpu_has_4kex 1
37#define cpu_has_3k_cache 0
38#define cpu_has_6k_cache 0
39#define cpu_has_4k_cache 1
40#define cpu_has_8k_cache 0
41#define cpu_has_tx39_cache 0
42
43#define cpu_has_inclusive_pcaches 1
44
45#define cpu_dcache_line_size() 32
46#define cpu_icache_line_size() 64
47#define cpu_scache_line_size() 128
48
49#define cpu_has_mips32r1 0
50#define cpu_has_mips32r2 0
51#define cpu_has_mips64r1 0
52#define cpu_has_mips64r2 0
53
54#endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip27/dma-coherence.h b/include/asm-mips/mach-ip27/dma-coherence.h
deleted file mode 100644
index ed7e6222dc15..000000000000
--- a/include/asm-mips/mach-ip27/dma-coherence.h
+++ /dev/null
@@ -1,50 +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 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/irq.h b/include/asm-mips/mach-ip27/irq.h
deleted file mode 100644
index cf4384bfa846..000000000000
--- a/include/asm-mips/mach-ip27/irq.h
+++ /dev/null
@@ -1,22 +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) 1999, 2000, 01, 02, 03 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2001 Kanoj Sarcar
9 */
10#ifndef __ASM_MACH_IP27_IRQ_H
11#define __ASM_MACH_IP27_IRQ_H
12
13/*
14 * A hardwired interrupt number is completly stupid for this system - a
15 * large configuration might have thousands if not tenthousands of
16 * interrupts.
17 */
18#define NR_IRQS 256
19
20#include_next <irq.h>
21
22#endif /* __ASM_MACH_IP27_IRQ_H */
diff --git a/include/asm-mips/mach-ip27/kernel-entry-init.h b/include/asm-mips/mach-ip27/kernel-entry-init.h
deleted file mode 100644
index 624d66c7f290..000000000000
--- a/include/asm-mips/mach-ip27/kernel-entry-init.h
+++ /dev/null
@@ -1,59 +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) 2000 Silicon Graphics, Inc.
7 * Copyright (C) 2005 Ralf Baechle <ralf@linux-mips.org>
8 */
9#ifndef __ASM_MACH_IP27_KERNEL_ENTRY_H
10#define __ASM_MACH_IP27_KERNEL_ENTRY_H
11
12#include <asm/sn/addrs.h>
13#include <asm/sn/sn0/hubni.h>
14#include <asm/sn/klkernvars.h>
15
16/*
17 * Returns the local nasid into res.
18 */
19 .macro GET_NASID_ASM res
20 dli \res, LOCAL_HUB_ADDR(NI_STATUS_REV_ID)
21 ld \res, (\res)
22 and \res, NSRI_NODEID_MASK
23 dsrl \res, NSRI_NODEID_SHFT
24 .endm
25
26/*
27 * Intentionally empty macro, used in head.S. Override in
28 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
29 */
30 .macro kernel_entry_setup
31 GET_NASID_ASM t1
32 move t2, t1 # text and data are here
33 MAPPED_KERNEL_SETUP_TLB
34 .endm
35
36/*
37 * Do SMP slave processor setup necessary before we can savely execute C code.
38 */
39 .macro smp_slave_setup
40 GET_NASID_ASM t1
41 dli t0, KLDIR_OFFSET + (KLI_KERN_VARS * KLDIR_ENT_SIZE) + \
42 KLDIR_OFF_POINTER + CAC_BASE
43 dsll t1, NASID_SHFT
44 or t0, t0, t1
45 ld t0, 0(t0) # t0 points to kern_vars struct
46 lh t1, KV_RO_NASID_OFFSET(t0)
47 lh t2, KV_RW_NASID_OFFSET(t0)
48 MAPPED_KERNEL_SETUP_TLB
49
50 /*
51 * We might not get launched at the address the kernel is linked to,
52 * so we jump there.
53 */
54 PTR_LA t0, 0f
55 jr t0
560:
57 .endm
58
59#endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */
diff --git a/include/asm-mips/mach-ip27/kmalloc.h b/include/asm-mips/mach-ip27/kmalloc.h
deleted file mode 100644
index 426bd049b2d7..000000000000
--- a/include/asm-mips/mach-ip27/kmalloc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_MACH_IP27_KMALLOC_H
2#define __ASM_MACH_IP27_KMALLOC_H
3
4/*
5 * All happy, no need to define ARCH_KMALLOC_MINALIGN
6 */
7
8#endif /* __ASM_MACH_IP27_KMALLOC_H */
diff --git a/include/asm-mips/mach-ip27/mangle-port.h b/include/asm-mips/mach-ip27/mangle-port.h
deleted file mode 100644
index f6e4912ea062..000000000000
--- a/include/asm-mips/mach-ip27/mangle-port.h
+++ /dev/null
@@ -1,25 +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, 2004 Ralf Baechle
7 */
8#ifndef __ASM_MACH_IP27_MANGLE_PORT_H
9#define __ASM_MACH_IP27_MANGLE_PORT_H
10
11#define __swizzle_addr_b(port) (port)
12#define __swizzle_addr_w(port) ((port) ^ 2)
13#define __swizzle_addr_l(port) (port)
14#define __swizzle_addr_q(port) (port)
15
16# define ioswabb(a, x) (x)
17# define __mem_ioswabb(a, x) (x)
18# define ioswabw(a, x) (x)
19# define __mem_ioswabw(a, x) cpu_to_le16(x)
20# define ioswabl(a, x) (x)
21# define __mem_ioswabl(a, x) cpu_to_le32(x)
22# define ioswabq(a, x) (x)
23# define __mem_ioswabq(a, x) cpu_to_le32(x)
24
25#endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip27/mmzone.h b/include/asm-mips/mach-ip27/mmzone.h
deleted file mode 100644
index 986a3b9b59a7..000000000000
--- a/include/asm-mips/mach-ip27/mmzone.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ASM_MACH_MMZONE_H
2#define _ASM_MACH_MMZONE_H
3
4#include <asm/sn/addrs.h>
5#include <asm/sn/arch.h>
6#include <asm/sn/hub.h>
7
8#define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr))
9
10#define LEVELS_PER_SLICE 128
11
12struct slice_data {
13 unsigned long irq_enable_mask[2];
14 int level_to_irq[LEVELS_PER_SLICE];
15};
16
17struct hub_data {
18 kern_vars_t kern_vars;
19 DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW);
20 cpumask_t h_cpus;
21 unsigned long slice_map;
22 unsigned long irq_alloc_mask[2];
23 struct slice_data slice[2];
24};
25
26struct node_data {
27 struct pglist_data pglist;
28 struct hub_data hub;
29};
30
31extern struct node_data *__node_data[];
32
33#define NODE_DATA(n) (&__node_data[(n)]->pglist)
34#define hub_data(n) (&__node_data[(n)]->hub)
35
36#endif /* _ASM_MACH_MMZONE_H */
diff --git a/include/asm-mips/mach-ip27/spaces.h b/include/asm-mips/mach-ip27/spaces.h
deleted file mode 100644
index b18802a0b17e..000000000000
--- a/include/asm-mips/mach-ip27/spaces.h
+++ /dev/null
@@ -1,30 +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) 1996, 99 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_IP27_SPACES_H
11#define _ASM_MACH_IP27_SPACES_H
12
13/*
14 * IP27 uses the R10000's uncached attribute feature. Attribute 3 selects
15 * uncached memory addressing.
16 */
17
18#define HSPEC_BASE 0x9000000000000000
19#define IO_BASE 0x9200000000000000
20#define MSPEC_BASE 0x9400000000000000
21#define UNCAC_BASE 0x9600000000000000
22
23#define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
24#define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
25
26#define HIGHMEM_START (~0UL)
27
28#include <asm/mach-generic/spaces.h>
29
30#endif /* _ASM_MACH_IP27_SPACES_H */
diff --git a/include/asm-mips/mach-ip27/topology.h b/include/asm-mips/mach-ip27/topology.h
deleted file mode 100644
index 7785bec732f2..000000000000
--- a/include/asm-mips/mach-ip27/topology.h
+++ /dev/null
@@ -1,59 +0,0 @@
1#ifndef _ASM_MACH_TOPOLOGY_H
2#define _ASM_MACH_TOPOLOGY_H 1
3
4#include <asm/sn/hub.h>
5#include <asm/sn/types.h>
6#include <asm/mmzone.h>
7
8struct cpuinfo_ip27 {
9// cpuid_t p_cpuid; /* PROM assigned cpuid */
10 cnodeid_t p_nodeid; /* my node ID in compact-id-space */
11 nasid_t p_nasid; /* my node ID in numa-as-id-space */
12 unsigned char p_slice; /* Physical position on node board */
13#if 0
14 unsigned long loops_per_sec;
15 unsigned long ipi_count;
16 unsigned long irq_attempt[NR_IRQS];
17 unsigned long smp_local_irq_count;
18 unsigned long prof_multiplier;
19 unsigned long prof_counter;
20#endif
21};
22
23extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
24
25#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid)
26#define parent_node(node) (node)
27#define node_to_cpumask(node) (hub_data(node)->h_cpus)
28#define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
29struct pci_bus;
30extern int pcibus_to_node(struct pci_bus *);
31
32#define pcibus_to_cpumask(bus) (cpu_online_map)
33
34extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
35
36#define node_distance(from, to) (__node_distances[(from)][(to)])
37
38/* sched_domains SD_NODE_INIT for SGI IP27 machines */
39#define SD_NODE_INIT (struct sched_domain) { \
40 .span = CPU_MASK_NONE, \
41 .parent = NULL, \
42 .child = NULL, \
43 .groups = NULL, \
44 .min_interval = 8, \
45 .max_interval = 32, \
46 .busy_factor = 32, \
47 .imbalance_pct = 125, \
48 .cache_nice_tries = 1, \
49 .flags = SD_LOAD_BALANCE \
50 | SD_BALANCE_EXEC \
51 | SD_WAKE_BALANCE, \
52 .last_balance = jiffies, \
53 .balance_interval = 1, \
54 .nr_balance_failed = 0, \
55}
56
57#include <asm-generic/topology.h>
58
59#endif /* _ASM_MACH_TOPOLOGY_H */
diff --git a/include/asm-mips/mach-ip27/war.h b/include/asm-mips/mach-ip27/war.h
deleted file mode 100644
index e2ddcc9b1fff..000000000000
--- a/include/asm-mips/mach-ip27/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_IP27_WAR_H
9#define __ASM_MIPS_MACH_IP27_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 1
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_IP27_WAR_H */
diff --git a/include/asm-mips/mach-ip28/cpu-feature-overrides.h b/include/asm-mips/mach-ip28/cpu-feature-overrides.h
deleted file mode 100644
index 9a53b326f848..000000000000
--- a/include/asm-mips/mach-ip28/cpu-feature-overrides.h
+++ /dev/null
@@ -1,50 +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 Ralf Baechle
7 * 6/2004 pf
8 */
9#ifndef __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H
11
12/*
13 * IP28 only comes with R10000 family processors all using the same config
14 */
15#define cpu_has_watch 1
16#define cpu_has_mips16 0
17#define cpu_has_divec 0
18#define cpu_has_vce 0
19#define cpu_has_cache_cdex_p 0
20#define cpu_has_cache_cdex_s 0
21#define cpu_has_prefetch 1
22#define cpu_has_mcheck 0
23#define cpu_has_ejtag 0
24
25#define cpu_has_llsc 1
26#define cpu_has_vtag_icache 0
27#define cpu_has_dc_aliases 0 /* see probe_pcache() */
28#define cpu_has_ic_fills_f_dc 0
29#define cpu_has_dsp 0
30#define cpu_icache_snoops_remote_store 1
31#define cpu_has_mipsmt 0
32#define cpu_has_userlocal 0
33
34#define cpu_has_nofpuex 0
35#define cpu_has_64bits 1
36
37#define cpu_has_4kex 1
38#define cpu_has_4k_cache 1
39
40#define cpu_has_inclusive_pcaches 1
41
42#define cpu_dcache_line_size() 32
43#define cpu_icache_line_size() 64
44
45#define cpu_has_mips32r1 0
46#define cpu_has_mips32r2 0
47#define cpu_has_mips64r1 0
48#define cpu_has_mips64r2 0
49
50#endif /* __ASM_MACH_IP28_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip28/ds1286.h b/include/asm-mips/mach-ip28/ds1286.h
deleted file mode 100644
index 471bb9a33e0f..000000000000
--- a/include/asm-mips/mach-ip28/ds1286.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASM_MACH_IP28_DS1286_H
2#define __ASM_MACH_IP28_DS1286_H
3#include <asm/mach-ip22/ds1286.h>
4#endif /* __ASM_MACH_IP28_DS1286_H */
diff --git a/include/asm-mips/mach-ip28/spaces.h b/include/asm-mips/mach-ip28/spaces.h
deleted file mode 100644
index 05aabb27e5e7..000000000000
--- a/include/asm-mips/mach-ip28/spaces.h
+++ /dev/null
@@ -1,22 +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) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 * 2004 pf
10 */
11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H
13
14#define CAC_BASE 0xa800000000000000
15
16#define HIGHMEM_START (~0UL)
17
18#define PHYS_OFFSET _AC(0x20000000, UL)
19
20#include <asm/mach-generic/spaces.h>
21
22#endif /* _ASM_MACH_IP28_SPACES_H */
diff --git a/include/asm-mips/mach-ip28/war.h b/include/asm-mips/mach-ip28/war.h
deleted file mode 100644
index a1baafab486a..000000000000
--- a/include/asm-mips/mach-ip28/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_IP28_WAR_H
9#define __ASM_MIPS_MACH_IP28_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 1
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_IP28_WAR_H */
diff --git a/include/asm-mips/mach-ip32/cpu-feature-overrides.h b/include/asm-mips/mach-ip32/cpu-feature-overrides.h
deleted file mode 100644
index 6782fccebe8d..000000000000
--- a/include/asm-mips/mach-ip32/cpu-feature-overrides.h
+++ /dev/null
@@ -1,50 +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) 2005 Ilya A. Volynets-Evenbakh
7 * Copyright (C) 2005, 07 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H
11
12
13/*
14 * R5000 has an interesting "restriction": ll(d)/sc(d)
15 * instructions to XKPHYS region simply do uncached bus
16 * requests. This breaks all the atomic bitops functions.
17 * so, for 64bit IP32 kernel we just don't use ll/sc.
18 * This does not affect luserland.
19 */
20#if (defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_NEVADA)) && defined(CONFIG_64BIT)
21#define cpu_has_llsc 0
22#else
23#define cpu_has_llsc 1
24#endif
25
26/* Settings which are common for all ip32 CPUs */
27#define cpu_has_tlb 1
28#define cpu_has_4kex 1
29#define cpu_has_fpu 1
30#define cpu_has_32fpr 1
31#define cpu_has_counter 1
32#define cpu_has_mips16 0
33#define cpu_has_vce 0
34#define cpu_has_cache_cdex_s 0
35#define cpu_has_mcheck 0
36#define cpu_has_ejtag 0
37#define cpu_has_vtag_icache 0
38#define cpu_has_ic_fills_f_dc 0
39#define cpu_has_dsp 0
40#define cpu_has_4k_cache 1
41#define cpu_has_mipsmt 0
42#define cpu_has_userlocal 0
43
44
45#define cpu_has_mips32r1 0
46#define cpu_has_mips32r2 0
47#define cpu_has_mips64r1 0
48#define cpu_has_mips64r2 0
49
50#endif /* __ASM_MACH_IP32_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-ip32/dma-coherence.h b/include/asm-mips/mach-ip32/dma-coherence.h
deleted file mode 100644
index a5511ebb2d53..000000000000
--- a/include/asm-mips/mach-ip32/dma-coherence.h
+++ /dev/null
@@ -1,72 +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 Ralf Baechle <ralf@linux-mips.org>
7 *
8 */
9#ifndef __ASM_MACH_IP32_DMA_COHERENCE_H
10#define __ASM_MACH_IP32_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_IP32_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-ip32/kmalloc.h b/include/asm-mips/mach-ip32/kmalloc.h
deleted file mode 100644
index b1e0be60f720..000000000000
--- a/include/asm-mips/mach-ip32/kmalloc.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __ASM_MACH_IP32_KMALLOC_H
2#define __ASM_MACH_IP32_KMALLOC_H
3
4
5#if defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_RM7000)
6#define ARCH_KMALLOC_MINALIGN 32
7#else
8#define ARCH_KMALLOC_MINALIGN 128
9#endif
10
11#endif /* __ASM_MACH_IP32_KMALLOC_H */
diff --git a/include/asm-mips/mach-ip32/mangle-port.h b/include/asm-mips/mach-ip32/mangle-port.h
deleted file mode 100644
index f1d0f1756a9f..000000000000
--- a/include/asm-mips/mach-ip32/mangle-port.h
+++ /dev/null
@@ -1,26 +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 Ladislav Michl
7 * Copyright (C) 2004 Ralf Baechle
8 */
9#ifndef __ASM_MACH_IP32_MANGLE_PORT_H
10#define __ASM_MACH_IP32_MANGLE_PORT_H
11
12#define __swizzle_addr_b(port) ((port) ^ 3)
13#define __swizzle_addr_w(port) ((port) ^ 2)
14#define __swizzle_addr_l(port) (port)
15#define __swizzle_addr_q(port) (port)
16
17# define ioswabb(a, x) (x)
18# define __mem_ioswabb(a, x) (x)
19# define ioswabw(a, x) (x)
20# define __mem_ioswabw(a, x) cpu_to_le16(x)
21# define ioswabl(a, x) (x)
22# define __mem_ioswabl(a, x) cpu_to_le32(x)
23# define ioswabq(a, x) (x)
24# define __mem_ioswabq(a, x) cpu_to_le32(x)
25
26#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-ip32/mc146818rtc.h b/include/asm-mips/mach-ip32/mc146818rtc.h
deleted file mode 100644
index c28ba8d84076..000000000000
--- a/include/asm-mips/mach-ip32/mc146818rtc.h
+++ /dev/null
@@ -1,36 +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) 1998, 2001, 03 by Ralf Baechle
7 * Copyright (C) 2000 Harald Koerfgen
8 *
9 * RTC routines for IP32 style attached Dallas chip.
10 */
11#ifndef __ASM_MACH_IP32_MC146818RTC_H
12#define __ASM_MACH_IP32_MC146818RTC_H
13
14#include <asm/ip32/mace.h>
15
16#define RTC_PORT(x) (0x70 + (x))
17
18static unsigned char CMOS_READ(unsigned long addr)
19{
20 return mace->isa.rtc[addr << 8];
21}
22
23static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
24{
25 mace->isa.rtc[addr << 8] = data;
26}
27
28/*
29 * FIXME: Do it right. For now just assume that noone lives in 20th century
30 * and no O2 user in 22th century ;-)
31 */
32#define mc146818_decode_year(year) ((year) + 2000)
33
34#define RTC_ALWAYS_BCD 0
35
36#endif /* __ASM_MACH_IP32_MC146818RTC_H */
diff --git a/include/asm-mips/mach-ip32/war.h b/include/asm-mips/mach-ip32/war.h
deleted file mode 100644
index d194056dcd7a..000000000000
--- a/include/asm-mips/mach-ip32/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_IP32_WAR_H
9#define __ASM_MIPS_MACH_IP32_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_IP32_WAR_H */
diff --git a/include/asm-mips/mach-jazz/dma-coherence.h b/include/asm-mips/mach-jazz/dma-coherence.h
deleted file mode 100644
index d66979a124a8..000000000000
--- a/include/asm-mips/mach-jazz/dma-coherence.h
+++ /dev/null
@@ -1,40 +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 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-jazz/floppy.h b/include/asm-mips/mach-jazz/floppy.h
deleted file mode 100644
index 56e9ca6ae426..000000000000
--- a/include/asm-mips/mach-jazz/floppy.h
+++ /dev/null
@@ -1,135 +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) 1998, 2003 by Ralf Baechle
7 */
8#ifndef __ASM_MACH_JAZZ_FLOPPY_H
9#define __ASM_MACH_JAZZ_FLOPPY_H
10
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/linkage.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <asm/addrspace.h>
17#include <asm/jazz.h>
18#include <asm/jazzdma.h>
19#include <asm/pgtable.h>
20
21static inline unsigned char fd_inb(unsigned int port)
22{
23 unsigned char c;
24
25 c = *(volatile unsigned char *) port;
26 udelay(1);
27
28 return c;
29}
30
31static inline void fd_outb(unsigned char value, unsigned int port)
32{
33 *(volatile unsigned char *) port = value;
34}
35
36/*
37 * How to access the floppy DMA functions.
38 */
39static inline void fd_enable_dma(void)
40{
41 vdma_enable(JAZZ_FLOPPY_DMA);
42}
43
44static inline void fd_disable_dma(void)
45{
46 vdma_disable(JAZZ_FLOPPY_DMA);
47}
48
49static inline int fd_request_dma(void)
50{
51 return 0;
52}
53
54static inline void fd_free_dma(void)
55{
56}
57
58static inline void fd_clear_dma_ff(void)
59{
60}
61
62static inline void fd_set_dma_mode(char mode)
63{
64 vdma_set_mode(JAZZ_FLOPPY_DMA, mode);
65}
66
67static inline void fd_set_dma_addr(char *a)
68{
69 vdma_set_addr(JAZZ_FLOPPY_DMA, vdma_phys2log(CPHYSADDR((unsigned long)a)));
70}
71
72static inline void fd_set_dma_count(unsigned int count)
73{
74 vdma_set_count(JAZZ_FLOPPY_DMA, count);
75}
76
77static inline int fd_get_dma_residue(void)
78{
79 return vdma_get_residue(JAZZ_FLOPPY_DMA);
80}
81
82static inline void fd_enable_irq(void)
83{
84}
85
86static inline void fd_disable_irq(void)
87{
88}
89
90static inline int fd_request_irq(void)
91{
92 return request_irq(FLOPPY_IRQ, floppy_interrupt,
93 IRQF_DISABLED, "floppy", NULL);
94}
95
96static inline void fd_free_irq(void)
97{
98 free_irq(FLOPPY_IRQ, NULL);
99}
100
101static inline unsigned long fd_getfdaddr1(void)
102{
103 return JAZZ_FDC_BASE;
104}
105
106static inline unsigned long fd_dma_mem_alloc(unsigned long size)
107{
108 unsigned long mem;
109
110 mem = __get_dma_pages(GFP_KERNEL, get_order(size));
111 if(!mem)
112 return 0;
113 vdma_alloc(CPHYSADDR(mem), size); /* XXX error checking */
114
115 return mem;
116}
117
118static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
119{
120 vdma_free(vdma_phys2log(CPHYSADDR(addr)));
121 free_pages(addr, get_order(size));
122}
123
124static inline unsigned long fd_drive_type(unsigned long n)
125{
126 /* XXX This is wrong for machines with ED 2.88mb disk drives like the
127 Olivetti M700. Anyway, we should suck this from the ARC
128 firmware. */
129 if (n == 0)
130 return 4; /* 3,5", 1.44mb */
131
132 return 0;
133}
134
135#endif /* __ASM_MACH_JAZZ_FLOPPY_H */
diff --git a/include/asm-mips/mach-jazz/mc146818rtc.h b/include/asm-mips/mach-jazz/mc146818rtc.h
deleted file mode 100644
index 987f727afe25..000000000000
--- a/include/asm-mips/mach-jazz/mc146818rtc.h
+++ /dev/null
@@ -1,38 +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) 1998, 2001, 03 by Ralf Baechle
7 * Copyright (C) 2007 Thomas Bogendoerfer
8 *
9 * RTC routines for Jazz style attached Dallas chip.
10 */
11#ifndef __ASM_MACH_JAZZ_MC146818RTC_H
12#define __ASM_MACH_JAZZ_MC146818RTC_H
13
14#include <linux/delay.h>
15
16#include <asm/io.h>
17#include <asm/jazz.h>
18
19#define RTC_PORT(x) (0x70 + (x))
20#define RTC_IRQ 8
21
22static inline unsigned char CMOS_READ(unsigned long addr)
23{
24 outb_p(addr, RTC_PORT(0));
25 return *(volatile char *)JAZZ_RTC_BASE;
26}
27
28static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
29{
30 outb_p(addr, RTC_PORT(0));
31 *(volatile char *)JAZZ_RTC_BASE = data;
32}
33
34#define RTC_ALWAYS_BCD 0
35
36#define mc146818_decode_year(year) ((year) + 1980)
37
38#endif /* __ASM_MACH_JAZZ_MC146818RTC_H */
diff --git a/include/asm-mips/mach-jazz/war.h b/include/asm-mips/mach-jazz/war.h
deleted file mode 100644
index 6158ee861bfd..000000000000
--- a/include/asm-mips/mach-jazz/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_JAZZ_WAR_H
9#define __ASM_MIPS_MACH_JAZZ_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_JAZZ_WAR_H */
diff --git a/include/asm-mips/mach-lasat/irq.h b/include/asm-mips/mach-lasat/irq.h
deleted file mode 100644
index 3a282419d5f9..000000000000
--- a/include/asm-mips/mach-lasat/irq.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_MACH_LASAT_IRQ_H
2#define _ASM_MACH_LASAT_IRQ_H
3
4#define LASAT_CASCADE_IRQ (MIPS_CPU_IRQ_BASE + 2)
5
6#define LASAT_IRQ_BASE 8
7#define LASAT_IRQ_END 23
8
9#define NR_IRQS 24
10
11#include_next <irq.h>
12
13#endif /* _ASM_MACH_LASAT_IRQ_H */
diff --git a/include/asm-mips/mach-lasat/mach-gt64120.h b/include/asm-mips/mach-lasat/mach-gt64120.h
deleted file mode 100644
index 1a9ad45cc135..000000000000
--- a/include/asm-mips/mach-lasat/mach-gt64120.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_GT64120_LASAT_GT64120_DEP_H
9#define _ASM_GT64120_LASAT_GT64120_DEP_H
10
11/*
12 * GT64120 config space base address on Lasat 100
13 */
14#define GT64120_BASE (KSEG1ADDR(0x14000000))
15
16/*
17 * PCI Bus allocation
18 *
19 * (Guessing ...)
20 */
21#define GT_PCI_MEM_BASE 0x12000000UL
22#define GT_PCI_MEM_SIZE 0x02000000UL
23#define GT_PCI_IO_BASE 0x10000000UL
24#define GT_PCI_IO_SIZE 0x02000000UL
25#define GT_ISA_IO_BASE PCI_IO_BASE
26
27#endif /* _ASM_GT64120_LASAT_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-lasat/war.h b/include/asm-mips/mach-lasat/war.h
deleted file mode 100644
index bb1e0325c9be..000000000000
--- a/include/asm-mips/mach-lasat/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_LASAT_WAR_H
9#define __ASM_MIPS_MACH_LASAT_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_LASAT_WAR_H */
diff --git a/include/asm-mips/mach-lemote/dma-coherence.h b/include/asm-mips/mach-lemote/dma-coherence.h
deleted file mode 100644
index 7e914777ebc4..000000000000
--- a/include/asm-mips/mach-lemote/dma-coherence.h
+++ /dev/null
@@ -1,42 +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, 07 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 *
10 */
11#ifndef __ASM_MACH_LEMOTE_DMA_COHERENCE_H
12#define __ASM_MACH_LEMOTE_DMA_COHERENCE_H
13
14struct device;
15
16static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
17 size_t size)
18{
19 return virt_to_phys(addr) | 0x80000000;
20}
21
22static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
23 struct page *page)
24{
25 return page_to_phys(page) | 0x80000000;
26}
27
28static inline unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
29{
30 return dma_addr & 0x7fffffff;
31}
32
33static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
34{
35}
36
37static inline int plat_device_is_coherent(struct device *dev)
38{
39 return 0;
40}
41
42#endif /* __ASM_MACH_LEMOTE_DMA_COHERENCE_H */
diff --git a/include/asm-mips/mach-lemote/mc146818rtc.h b/include/asm-mips/mach-lemote/mc146818rtc.h
deleted file mode 100644
index ed5147e11085..000000000000
--- a/include/asm-mips/mach-lemote/mc146818rtc.h
+++ /dev/null
@@ -1,36 +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) 1998, 2001, 03, 07 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_LEMOTE_MC146818RTC_H
11#define __ASM_MACH_LEMOTE_MC146818RTC_H
12
13#include <linux/io.h>
14
15#define RTC_PORT(x) (0x70 + (x))
16#define RTC_IRQ 8
17
18static inline unsigned char CMOS_READ(unsigned long addr)
19{
20 outb_p(addr, RTC_PORT(0));
21 return inb_p(RTC_PORT(1));
22}
23
24static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
25{
26 outb_p(addr, RTC_PORT(0));
27 outb_p(data, RTC_PORT(1));
28}
29
30#define RTC_ALWAYS_BCD 0
31
32#ifndef mc146818_decode_year
33#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1970)
34#endif
35
36#endif /* __ASM_MACH_LEMOTE_MC146818RTC_H */
diff --git a/include/asm-mips/mach-lemote/war.h b/include/asm-mips/mach-lemote/war.h
deleted file mode 100644
index 05f89e0f2a11..000000000000
--- a/include/asm-mips/mach-lemote/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_LEMOTE_WAR_H
9#define __ASM_MIPS_MACH_LEMOTE_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_LEMOTE_WAR_H */
diff --git a/include/asm-mips/mach-malta/cpu-feature-overrides.h b/include/asm-mips/mach-malta/cpu-feature-overrides.h
deleted file mode 100644
index 7f3e3f9bd23a..000000000000
--- a/include/asm-mips/mach-malta/cpu-feature-overrides.h
+++ /dev/null
@@ -1,72 +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, 2004 Chris Dearman
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 */
9#ifndef __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
10#define __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H
11
12
13/*
14 * CPU feature overrides for MIPS boards
15 */
16#ifdef CONFIG_CPU_MIPS32
17#define cpu_has_tlb 1
18#define cpu_has_4kex 1
19#define cpu_has_4k_cache 1
20/* #define cpu_has_fpu ? */
21/* #define cpu_has_32fpr ? */
22#define cpu_has_counter 1
23/* #define cpu_has_watch ? */
24#define cpu_has_divec 1
25#define cpu_has_vce 0
26/* #define cpu_has_cache_cdex_p ? */
27/* #define cpu_has_cache_cdex_s ? */
28/* #define cpu_has_prefetch ? */
29#define cpu_has_mcheck 1
30/* #define cpu_has_ejtag ? */
31#ifdef CONFIG_CPU_HAS_LLSC
32#define cpu_has_llsc 1
33#else
34#define cpu_has_llsc 0
35#endif
36/* #define cpu_has_vtag_icache ? */
37/* #define cpu_has_dc_aliases ? */
38/* #define cpu_has_ic_fills_f_dc ? */
39#define cpu_has_nofpuex 0
40/* #define cpu_has_64bits ? */
41/* #define cpu_has_64bit_zero_reg ? */
42/* #define cpu_has_inclusive_pcaches ? */
43#define cpu_icache_snoops_remote_store 1
44#endif
45
46#ifdef CONFIG_CPU_MIPS64
47#define cpu_has_tlb 1
48#define cpu_has_4kex 1
49#define cpu_has_4k_cache 1
50/* #define cpu_has_fpu ? */
51/* #define cpu_has_32fpr ? */
52#define cpu_has_counter 1
53/* #define cpu_has_watch ? */
54#define cpu_has_divec 1
55#define cpu_has_vce 0
56/* #define cpu_has_cache_cdex_p ? */
57/* #define cpu_has_cache_cdex_s ? */
58/* #define cpu_has_prefetch ? */
59#define cpu_has_mcheck 1
60/* #define cpu_has_ejtag ? */
61#define cpu_has_llsc 1
62/* #define cpu_has_vtag_icache ? */
63/* #define cpu_has_dc_aliases ? */
64/* #define cpu_has_ic_fills_f_dc ? */
65#define cpu_has_nofpuex 0
66/* #define cpu_has_64bits ? */
67/* #define cpu_has_64bit_zero_reg ? */
68/* #define cpu_has_inclusive_pcaches ? */
69#define cpu_icache_snoops_remote_store 1
70#endif
71
72#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-malta/irq.h b/include/asm-mips/mach-malta/irq.h
deleted file mode 100644
index 9b9da26683c2..000000000000
--- a/include/asm-mips/mach-malta/irq.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_MACH_MIPS_IRQ_H
2#define __ASM_MACH_MIPS_IRQ_H
3
4
5#define NR_IRQS 256
6
7#include_next <irq.h>
8
9#endif /* __ASM_MACH_MIPS_IRQ_H */
diff --git a/include/asm-mips/mach-malta/kernel-entry-init.h b/include/asm-mips/mach-malta/kernel-entry-init.h
deleted file mode 100644
index 0b793e7bf67e..000000000000
--- a/include/asm-mips/mach-malta/kernel-entry-init.h
+++ /dev/null
@@ -1,52 +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 * Chris Dearman (chris@mips.com)
7 * Copyright (C) 2007 Mips Technologies, Inc.
8 */
9#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
10#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11
12 .macro kernel_entry_setup
13#ifdef CONFIG_MIPS_MT_SMTC
14 mfc0 t0, CP0_CONFIG
15 bgez t0, 9f
16 mfc0 t0, CP0_CONFIG, 1
17 bgez t0, 9f
18 mfc0 t0, CP0_CONFIG, 2
19 bgez t0, 9f
20 mfc0 t0, CP0_CONFIG, 3
21 and t0, 1<<2
22 bnez t0, 0f
239:
24 /* Assume we came from YAMON... */
25 PTR_LA v0, 0x9fc00534 /* YAMON print */
26 lw v0, (v0)
27 move a0, zero
28 PTR_LA a1, nonmt_processor
29 jal v0
30
31 PTR_LA v0, 0x9fc00520 /* YAMON exit */
32 lw v0, (v0)
33 li a0, 1
34 jal v0
35
361: b 1b
37
38 __INITDATA
39nonmt_processor:
40 .asciz "SMTC kernel requires the MT ASE to run\n"
41 __FINIT
420:
43#endif
44 .endm
45
46/*
47 * Do SMP slave processor setup necessary before we can safely execute C code.
48 */
49 .macro smp_slave_setup
50 .endm
51
52#endif /* __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H */
diff --git a/include/asm-mips/mach-malta/mach-gt64120.h b/include/asm-mips/mach-malta/mach-gt64120.h
deleted file mode 100644
index 0f863148f3b6..000000000000
--- a/include/asm-mips/mach-malta/mach-gt64120.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef _ASM_MACH_MIPS_MACH_GT64120_DEP_H
9#define _ASM_MACH_MIPS_MACH_GT64120_DEP_H
10
11#define MIPS_GT_BASE 0x1be00000
12
13extern unsigned long _pcictrl_gt64120;
14/*
15 * GT64120 config space base address
16 */
17#define GT64120_BASE _pcictrl_gt64120
18
19#endif /* _ASM_MACH_MIPS_MACH_GT64120_DEP_H */
diff --git a/include/asm-mips/mach-malta/mc146818rtc.h b/include/asm-mips/mach-malta/mc146818rtc.h
deleted file mode 100644
index ea612f37f614..000000000000
--- a/include/asm-mips/mach-malta/mc146818rtc.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2003 by Ralf Baechle
5 *
6 * This program is free software; you can distribute it and/or modify it
7 * under the terms of the GNU General Public License (Version 2) as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
18 *
19 * RTC routines for Malta style attached PIIX4 device, which contains a
20 * Motorola MC146818A-compatible Real Time Clock.
21 */
22#ifndef __ASM_MACH_MALTA_MC146818RTC_H
23#define __ASM_MACH_MALTA_MC146818RTC_H
24
25#include <asm/io.h>
26#include <asm/mips-boards/generic.h>
27#include <asm/mips-boards/malta.h>
28
29#define RTC_PORT(x) (0x70 + (x))
30#define RTC_IRQ 8
31
32static inline unsigned char CMOS_READ(unsigned long addr)
33{
34 outb(addr, MALTA_RTC_ADR_REG);
35 return inb(MALTA_RTC_DAT_REG);
36}
37
38static inline void CMOS_WRITE(unsigned char data, unsigned long addr)
39{
40 outb(addr, MALTA_RTC_ADR_REG);
41 outb(data, MALTA_RTC_DAT_REG);
42}
43
44#define RTC_ALWAYS_BCD 0
45
46#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
47
48#endif /* __ASM_MACH_MALTA_MC146818RTC_H */
diff --git a/include/asm-mips/mach-malta/war.h b/include/asm-mips/mach-malta/war.h
deleted file mode 100644
index 7c6931d5f45f..000000000000
--- a/include/asm-mips/mach-malta/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_MIPS_WAR_H
9#define __ASM_MIPS_MACH_MIPS_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 1
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
diff --git a/include/asm-mips/mach-mipssim/cpu-feature-overrides.h b/include/asm-mips/mach-mipssim/cpu-feature-overrides.h
deleted file mode 100644
index 779b02205737..000000000000
--- a/include/asm-mips/mach-mipssim/cpu-feature-overrides.h
+++ /dev/null
@@ -1,65 +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, 2004 Chris Dearman
7 */
8#ifndef __ASM_MACH_SIM_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_SIM_CPU_FEATURE_OVERRIDES_H
10
11
12/*
13 * CPU feature overrides for MIPS boards
14 */
15#ifdef CONFIG_CPU_MIPS32
16#define cpu_has_tlb 1
17#define cpu_has_4kex 1
18#define cpu_has_4k_cache 1
19#define cpu_has_fpu 0
20/* #define cpu_has_32fpr ? */
21#define cpu_has_counter 1
22/* #define cpu_has_watch ? */
23#define cpu_has_divec 1
24#define cpu_has_vce 0
25/* #define cpu_has_cache_cdex_p ? */
26/* #define cpu_has_cache_cdex_s ? */
27/* #define cpu_has_prefetch ? */
28#define cpu_has_mcheck 1
29/* #define cpu_has_ejtag ? */
30#define cpu_has_llsc 1
31/* #define cpu_has_vtag_icache ? */
32/* #define cpu_has_dc_aliases ? */
33/* #define cpu_has_ic_fills_f_dc ? */
34#define cpu_has_nofpuex 0
35/* #define cpu_has_64bits ? */
36/* #define cpu_has_64bit_zero_reg ? */
37/* #define cpu_has_inclusive_pcaches ? */
38#endif
39
40#ifdef CONFIG_CPU_MIPS64
41#define cpu_has_tlb 1
42#define cpu_has_4kex 1
43#define cpu_has_4k_cache 1
44/* #define cpu_has_fpu ? */
45/* #define cpu_has_32fpr ? */
46#define cpu_has_counter 1
47/* #define cpu_has_watch ? */
48#define cpu_has_divec 1
49#define cpu_has_vce 0
50/* #define cpu_has_cache_cdex_p ? */
51/* #define cpu_has_cache_cdex_s ? */
52/* #define cpu_has_prefetch ? */
53#define cpu_has_mcheck 1
54/* #define cpu_has_ejtag ? */
55#define cpu_has_llsc 1
56/* #define cpu_has_vtag_icache ? */
57/* #define cpu_has_dc_aliases ? */
58/* #define cpu_has_ic_fills_f_dc ? */
59#define cpu_has_nofpuex 0
60/* #define cpu_has_64bits ? */
61/* #define cpu_has_64bit_zero_reg ? */
62/* #define cpu_has_inclusive_pcaches ? */
63#endif
64
65#endif /* __ASM_MACH_MIPS_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-mipssim/war.h b/include/asm-mips/mach-mipssim/war.h
deleted file mode 100644
index c8a74a3515e0..000000000000
--- a/include/asm-mips/mach-mipssim/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_MIPSSIM_WAR_H
9#define __ASM_MIPS_MACH_MIPSSIM_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_MIPSSIM_WAR_H */
diff --git a/include/asm-mips/mach-pb1x00/mc146818rtc.h b/include/asm-mips/mach-pb1x00/mc146818rtc.h
deleted file mode 100644
index 622c58710e5b..000000000000
--- a/include/asm-mips/mach-pb1x00/mc146818rtc.h
+++ /dev/null
@@ -1,34 +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) 1998, 2001, 03 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip.
9 */
10#ifndef __ASM_MACH_AU1XX_MC146818RTC_H
11#define __ASM_MACH_AU1XX_MC146818RTC_H
12
13#include <asm/io.h>
14#include <asm/mach-au1x00/au1000.h>
15
16#define RTC_PORT(x) (0x0c000000 + (x))
17#define RTC_IRQ 8
18#define PB1500_RTC_ADDR 0x0c000000
19
20static inline unsigned char CMOS_READ(unsigned long offset)
21{
22 offset <<= 2;
23 return (u8)(au_readl(offset + PB1500_RTC_ADDR) & 0xff);
24}
25
26static inline void CMOS_WRITE(unsigned char data, unsigned long offset)
27{
28 offset <<= 2;
29 au_writel(data, offset + PB1500_RTC_ADDR);
30}
31
32#define RTC_ALWAYS_BCD 1
33
34#endif /* __ASM_MACH_AU1XX_MC146818RTC_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1000.h b/include/asm-mips/mach-pb1x00/pb1000.h
deleted file mode 100644
index 6d1ff9060e44..000000000000
--- a/include/asm-mips/mach-pb1x00/pb1000.h
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * Alchemy Semi Pb1000 Referrence Board
3 *
4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 *
24 *
25 */
26#ifndef __ASM_PB1000_H
27#define __ASM_PB1000_H
28
29/* PCMCIA PB1000 specific defines */
30#define PCMCIA_MAX_SOCK 1
31#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
32
33#define PB1000_PCR 0xBE000000
34# define PCR_SLOT_0_VPP0 (1 << 0)
35# define PCR_SLOT_0_VPP1 (1 << 1)
36# define PCR_SLOT_0_VCC0 (1 << 2)
37# define PCR_SLOT_0_VCC1 (1 << 3)
38# define PCR_SLOT_0_RST (1 << 4)
39# define PCR_SLOT_1_VPP0 (1 << 8)
40# define PCR_SLOT_1_VPP1 (1 << 9)
41# define PCR_SLOT_1_VCC0 (1 << 10)
42# define PCR_SLOT_1_VCC1 (1 << 11)
43# define PCR_SLOT_1_RST (1 << 12)
44
45#define PB1000_MDR 0xBE000004
46# define MDR_PI (1 << 5) /* PCMCIA int latch */
47# define MDR_EPI (1 << 14) /* enable PCMCIA int */
48# define MDR_CPI (1 << 15) /* clear PCMCIA int */
49
50#define PB1000_ACR1 0xBE000008
51# define ACR1_SLOT_0_CD1 (1 << 0) /* card detect 1 */
52# define ACR1_SLOT_0_CD2 (1 << 1) /* card detect 2 */
53# define ACR1_SLOT_0_READY (1 << 2) /* ready */
54# define ACR1_SLOT_0_STATUS (1 << 3) /* status change */
55# define ACR1_SLOT_0_VS1 (1 << 4) /* voltage sense 1 */
56# define ACR1_SLOT_0_VS2 (1 << 5) /* voltage sense 2 */
57# define ACR1_SLOT_0_INPACK (1 << 6) /* inpack pin status */
58# define ACR1_SLOT_1_CD1 (1 << 8) /* card detect 1 */
59# define ACR1_SLOT_1_CD2 (1 << 9) /* card detect 2 */
60# define ACR1_SLOT_1_READY (1 << 10) /* ready */
61# define ACR1_SLOT_1_STATUS (1 << 11) /* status change */
62# define ACR1_SLOT_1_VS1 (1 << 12) /* voltage sense 1 */
63# define ACR1_SLOT_1_VS2 (1 << 13) /* voltage sense 2 */
64# define ACR1_SLOT_1_INPACK (1 << 14) /* inpack pin status */
65
66#define CPLD_AUX0 0xBE00000C
67#define CPLD_AUX1 0xBE000010
68#define CPLD_AUX2 0xBE000014
69
70/* Voltage levels */
71
72/* VPPEN1 - VPPEN0 */
73#define VPP_GND ((0 << 1) | (0 << 0))
74#define VPP_5V ((1 << 1) | (0 << 0))
75#define VPP_3V ((0 << 1) | (1 << 0))
76#define VPP_12V ((0 << 1) | (1 << 0))
77#define VPP_HIZ ((1 << 1) | (1 << 0))
78
79/* VCCEN1 - VCCEN0 */
80#define VCC_3V ((0 << 1) | (1 << 0))
81#define VCC_5V ((1 << 1) | (0 << 0))
82#define VCC_HIZ ((0 << 1) | (0 << 0))
83
84/* VPP/VCC */
85#define SET_VCC_VPP(VCC, VPP, SLOT) \
86 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
87#endif /* __ASM_PB1000_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1100.h b/include/asm-mips/mach-pb1x00/pb1100.h
deleted file mode 100644
index b1a60f1cbd02..000000000000
--- a/include/asm-mips/mach-pb1x00/pb1100.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Alchemy Semi Pb1100 Referrence Board
3 *
4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 *
24 *
25 */
26#ifndef __ASM_PB1100_H
27#define __ASM_PB1100_H
28
29#define PB1100_IDENT 0xAE000000
30#define BOARD_STATUS_REG 0xAE000004
31# define PB1100_ROM_SEL (1 << 15)
32# define PB1100_ROM_SIZ (1 << 14)
33# define PB1100_SWAP_BOOT (1 << 13)
34# define PB1100_FLASH_WP (1 << 12)
35# define PB1100_ROM_H_STS (1 << 11)
36# define PB1100_ROM_L_STS (1 << 10)
37# define PB1100_FLASH_H_STS (1 << 9)
38# define PB1100_FLASH_L_STS (1 << 8)
39# define PB1100_SRAM_SIZ (1 << 7)
40# define PB1100_TSC_BUSY (1 << 6)
41# define PB1100_PCMCIA_VS_MASK (3 << 4)
42# define PB1100_RS232_CD (1 << 3)
43# define PB1100_RS232_CTS (1 << 2)
44# define PB1100_RS232_DSR (1 << 1)
45# define PB1100_RS232_RI (1 << 0)
46
47#define PB1100_IRDA_RS232 0xAE00000C
48# define PB1100_IRDA_FULL (0 << 14) /* full power */
49# define PB1100_IRDA_SHUTDOWN (1 << 14)
50# define PB1100_IRDA_TT (2 << 14) /* 2/3 power */
51# define PB1100_IRDA_OT (3 << 14) /* 1/3 power */
52# define PB1100_IRDA_FIR (1 << 13)
53
54#define PCMCIA_BOARD_REG 0xAE000010
55# define PB1100_SD_WP1_RO (1 << 15) /* read only */
56# define PB1100_SD_WP0_RO (1 << 14) /* read only */
57# define PB1100_SD_PWR1 (1 << 11) /* applies power to SD1 */
58# define PB1100_SD_PWR0 (1 << 10) /* applies power to SD0 */
59# define PB1100_SEL_SD_CONN1 (1 << 9)
60# define PB1100_SEL_SD_CONN0 (1 << 8)
61# define PC_DEASSERT_RST (1 << 7)
62# define PC_DRV_EN (1 << 4)
63
64#define PB1100_G_CONTROL 0xAE000014 /* graphics control */
65
66#define PB1100_RST_VDDI 0xAE00001C
67# define PB1100_SOFT_RESET (1 << 15) /* clear to reset the board */
68# define PB1100_VDDI_MASK 0x1F
69
70#define PB1100_LEDS 0xAE000018
71
72/*
73 * 11:8 is 4 discreet LEDs. Clearing a bit illuminates the LED.
74 * 7:0 is the LED Display's decimal points.
75 */
76#define PB1100_HEX_LED 0xAE000018
77
78/* PCMCIA Pb1100 specific defines */
79#define PCMCIA_MAX_SOCK 0
80#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
81
82/* VPP/VCC */
83#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
84
85#endif /* __ASM_PB1100_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
deleted file mode 100644
index c8618df88cb5..000000000000
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ /dev/null
@@ -1,259 +0,0 @@
1/*
2 * AMD Alchemy Pb1200 Referrence Board
3 * Board Registers defines.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 *
23 */
24#ifndef __ASM_PB1200_H
25#define __ASM_PB1200_H
26
27#include <linux/types.h>
28#include <asm/mach-au1x00/au1xxx_psc.h>
29
30#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
31#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
32#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
33#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
34
35/*
36 * SPI and SMB are muxed on the Pb1200 board.
37 * Refer to board documentation.
38 */
39#define SPI_PSC_BASE PSC0_BASE_ADDR
40#define SMBUS_PSC_BASE PSC0_BASE_ADDR
41/*
42 * AC97 and I2S are muxed on the Pb1200 board.
43 * Refer to board documentation.
44 */
45#define AC97_PSC_BASE PSC1_BASE_ADDR
46#define I2S_PSC_BASE PSC1_BASE_ADDR
47
48#define BCSR_KSEG1_ADDR 0xAD800000
49
50typedef volatile struct
51{
52 /*00*/ u16 whoami;
53 u16 reserved0;
54 /*04*/ u16 status;
55 u16 reserved1;
56 /*08*/ u16 switches;
57 u16 reserved2;
58 /*0C*/ u16 resets;
59 u16 reserved3;
60
61 /*10*/ u16 pcmcia;
62 u16 reserved4;
63 /*14*/ u16 board;
64 u16 reserved5;
65 /*18*/ u16 disk_leds;
66 u16 reserved6;
67 /*1C*/ u16 system;
68 u16 reserved7;
69
70 /*20*/ u16 intclr;
71 u16 reserved8;
72 /*24*/ u16 intset;
73 u16 reserved9;
74 /*28*/ u16 intclr_mask;
75 u16 reserved10;
76 /*2C*/ u16 intset_mask;
77 u16 reserved11;
78
79 /*30*/ u16 sig_status;
80 u16 reserved12;
81 /*34*/ u16 int_status;
82 u16 reserved13;
83 /*38*/ u16 reserved14;
84 u16 reserved15;
85 /*3C*/ u16 reserved16;
86 u16 reserved17;
87
88} BCSR;
89
90static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
91
92/*
93 * Register bit definitions for the BCSRs
94 */
95#define BCSR_WHOAMI_DCID 0x000F
96#define BCSR_WHOAMI_CPLD 0x00F0
97#define BCSR_WHOAMI_BOARD 0x0F00
98
99#define BCSR_STATUS_PCMCIA0VS 0x0003
100#define BCSR_STATUS_PCMCIA1VS 0x000C
101#define BCSR_STATUS_SWAPBOOT 0x0040
102#define BCSR_STATUS_FLASHBUSY 0x0100
103#define BCSR_STATUS_IDECBLID 0x0200
104#define BCSR_STATUS_SD0WP 0x0400
105#define BCSR_STATUS_SD1WP 0x0800
106#define BCSR_STATUS_U0RXD 0x1000
107#define BCSR_STATUS_U1RXD 0x2000
108
109#define BCSR_SWITCHES_OCTAL 0x00FF
110#define BCSR_SWITCHES_DIP_1 0x0080
111#define BCSR_SWITCHES_DIP_2 0x0040
112#define BCSR_SWITCHES_DIP_3 0x0020
113#define BCSR_SWITCHES_DIP_4 0x0010
114#define BCSR_SWITCHES_DIP_5 0x0008
115#define BCSR_SWITCHES_DIP_6 0x0004
116#define BCSR_SWITCHES_DIP_7 0x0002
117#define BCSR_SWITCHES_DIP_8 0x0001
118#define BCSR_SWITCHES_ROTARY 0x0F00
119
120#define BCSR_RESETS_ETH 0x0001
121#define BCSR_RESETS_CAMERA 0x0002
122#define BCSR_RESETS_DC 0x0004
123#define BCSR_RESETS_IDE 0x0008
124/* not resets but in the same register */
125#define BCSR_RESETS_WSCFSM 0x0800
126#define BCSR_RESETS_PCS0MUX 0x1000
127#define BCSR_RESETS_PCS1MUX 0x2000
128#define BCSR_RESETS_SPISEL 0x4000
129#define BCSR_RESETS_SD1MUX 0x8000
130
131#define BCSR_PCMCIA_PC0VPP 0x0003
132#define BCSR_PCMCIA_PC0VCC 0x000C
133#define BCSR_PCMCIA_PC0DRVEN 0x0010
134#define BCSR_PCMCIA_PC0RST 0x0080
135#define BCSR_PCMCIA_PC1VPP 0x0300
136#define BCSR_PCMCIA_PC1VCC 0x0C00
137#define BCSR_PCMCIA_PC1DRVEN 0x1000
138#define BCSR_PCMCIA_PC1RST 0x8000
139
140#define BCSR_BOARD_LCDVEE 0x0001
141#define BCSR_BOARD_LCDVDD 0x0002
142#define BCSR_BOARD_LCDBL 0x0004
143#define BCSR_BOARD_CAMSNAP 0x0010
144#define BCSR_BOARD_CAMPWR 0x0020
145#define BCSR_BOARD_SD0PWR 0x0040
146#define BCSR_BOARD_SD1PWR 0x0080
147
148#define BCSR_LEDS_DECIMALS 0x00FF
149#define BCSR_LEDS_LED0 0x0100
150#define BCSR_LEDS_LED1 0x0200
151#define BCSR_LEDS_LED2 0x0400
152#define BCSR_LEDS_LED3 0x0800
153
154#define BCSR_SYSTEM_VDDI 0x001F
155#define BCSR_SYSTEM_POWEROFF 0x4000
156#define BCSR_SYSTEM_RESET 0x8000
157
158/* Bit positions for the different interrupt sources */
159#define BCSR_INT_IDE 0x0001
160#define BCSR_INT_ETH 0x0002
161#define BCSR_INT_PC0 0x0004
162#define BCSR_INT_PC0STSCHG 0x0008
163#define BCSR_INT_PC1 0x0010
164#define BCSR_INT_PC1STSCHG 0x0020
165#define BCSR_INT_DC 0x0040
166#define BCSR_INT_FLASHBUSY 0x0080
167#define BCSR_INT_PC0INSERT 0x0100
168#define BCSR_INT_PC0EJECT 0x0200
169#define BCSR_INT_PC1INSERT 0x0400
170#define BCSR_INT_PC1EJECT 0x0800
171#define BCSR_INT_SD0INSERT 0x1000
172#define BCSR_INT_SD0EJECT 0x2000
173#define BCSR_INT_SD1INSERT 0x4000
174#define BCSR_INT_SD1EJECT 0x8000
175
176#define SMC91C111_PHYS_ADDR 0x0D000300
177#define SMC91C111_INT PB1200_ETH_INT
178
179#define IDE_PHYS_ADDR 0x0C800000
180#define IDE_REG_SHIFT 5
181#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
182#define IDE_INT PB1200_IDE_INT
183#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
184#define IDE_RQSIZE 128
185
186#define NAND_PHYS_ADDR 0x1C000000
187
188/*
189 * Timing values as described in databook, * ns value stripped of
190 * lower 2 bits.
191 * These defines are here rather than an Au1200 generic file because
192 * the parts chosen on another board may be different and may require
193 * different timings.
194 */
195#define NAND_T_H (18 >> 2)
196#define NAND_T_PUL (30 >> 2)
197#define NAND_T_SU (30 >> 2)
198#define NAND_T_WH (30 >> 2)
199
200/* Bitfield shift amounts */
201#define NAND_T_H_SHIFT 0
202#define NAND_T_PUL_SHIFT 4
203#define NAND_T_SU_SHIFT 8
204#define NAND_T_WH_SHIFT 12
205
206#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
207 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
208 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
209 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
210
211/*
212 * External Interrupts for Pb1200 as of 8/6/2004.
213 * Bit positions in the CPLD registers can be calculated by taking
214 * the interrupt define and subtracting the PB1200_INT_BEGIN value.
215 *
216 * Example: IDE bis pos is = 64 - 64
217 * ETH bit pos is = 65 - 64
218 */
219enum external_pb1200_ints {
220 PB1200_INT_BEGIN = AU1000_MAX_INTR + 1,
221
222 PB1200_IDE_INT = PB1200_INT_BEGIN,
223 PB1200_ETH_INT,
224 PB1200_PC0_INT,
225 PB1200_PC0_STSCHG_INT,
226 PB1200_PC1_INT,
227 PB1200_PC1_STSCHG_INT,
228 PB1200_DC_INT,
229 PB1200_FLASHBUSY_INT,
230 PB1200_PC0_INSERT_INT,
231 PB1200_PC0_EJECT_INT,
232 PB1200_PC1_INSERT_INT,
233 PB1200_PC1_EJECT_INT,
234 PB1200_SD0_INSERT_INT,
235 PB1200_SD0_EJECT_INT,
236 PB1200_SD1_INSERT_INT,
237 PB1200_SD1_EJECT_INT,
238
239 PB1200_INT_END = PB1200_INT_BEGIN + 15
240};
241
242/*
243 * Pb1200 specific PCMCIA defines for drivers/pcmcia/au1000_db1x00.c
244 */
245#define PCMCIA_MAX_SOCK 1
246#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
247
248/* VPP/VCC */
249#define SET_VCC_VPP(VCC, VPP, SLOT) \
250 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
251
252#define BOARD_PC0_INT PB1200_PC0_INT
253#define BOARD_PC1_INT PB1200_PC1_INT
254#define BOARD_CARD_INSERTED(SOCKET) bcsr->sig_status & (1 << (8 + (2 * SOCKET)))
255
256/* NAND chip select */
257#define NAND_CS 1
258
259#endif /* __ASM_PB1200_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1500.h b/include/asm-mips/mach-pb1x00/pb1500.h
deleted file mode 100644
index da51a2eb7b82..000000000000
--- a/include/asm-mips/mach-pb1x00/pb1500.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Alchemy Semi Pb1500 Referrence Board
3 *
4 * Copyright 2001, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 *
24 *
25 */
26#ifndef __ASM_PB1500_H
27#define __ASM_PB1500_H
28
29#define IDENT_BOARD_REG 0xAE000000
30#define BOARD_STATUS_REG 0xAE000004
31#define PCI_BOARD_REG 0xAE000010
32#define PCMCIA_BOARD_REG 0xAE000010
33# define PC_DEASSERT_RST 0x80
34# define PC_DRV_EN 0x10
35#define PB1500_G_CONTROL 0xAE000014
36#define PB1500_RST_VDDI 0xAE00001C
37#define PB1500_LEDS 0xAE000018
38
39#define PB1500_HEX_LED 0xAF000004
40#define PB1500_HEX_LED_BLANK 0xAF000008
41
42/* PCMCIA Pb1500 specific defines */
43#define PCMCIA_MAX_SOCK 0
44#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
45
46/* VPP/VCC */
47#define SET_VCC_VPP(VCC, VPP) (((VCC) << 2) | ((VPP) << 0))
48
49#endif /* __ASM_PB1500_H */
diff --git a/include/asm-mips/mach-pb1x00/pb1550.h b/include/asm-mips/mach-pb1x00/pb1550.h
deleted file mode 100644
index 6704a11497db..000000000000
--- a/include/asm-mips/mach-pb1x00/pb1550.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * AMD Alchemy Semi PB1550 Referrence Board
3 * Board Registers defines.
4 *
5 * Copyright 2004 Embedded Edge LLC.
6 * Copyright 2005 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * 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 it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 *
26 */
27#ifndef __ASM_PB1550_H
28#define __ASM_PB1550_H
29
30#include <linux/types.h>
31#include <asm/mach-au1x00/au1xxx_psc.h>
32
33#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
34#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
35#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC3_TX
36#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC3_RX
37
38#define SPI_PSC_BASE PSC0_BASE_ADDR
39#define AC97_PSC_BASE PSC1_BASE_ADDR
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR
42
43#define BCSR_PHYS_ADDR 0xAF000000
44
45typedef volatile struct
46{
47 /*00*/ u16 whoami;
48 u16 reserved0;
49 /*04*/ u16 status;
50 u16 reserved1;
51 /*08*/ u16 switches;
52 u16 reserved2;
53 /*0C*/ u16 resets;
54 u16 reserved3;
55 /*10*/ u16 pcmcia;
56 u16 reserved4;
57 /*14*/ u16 pci;
58 u16 reserved5;
59 /*18*/ u16 leds;
60 u16 reserved6;
61 /*1C*/ u16 system;
62 u16 reserved7;
63
64} BCSR;
65
66static BCSR * const bcsr = (BCSR *)BCSR_PHYS_ADDR;
67
68/*
69 * Register bit definitions for the BCSRs
70 */
71#define BCSR_WHOAMI_DCID 0x000F
72#define BCSR_WHOAMI_CPLD 0x00F0
73#define BCSR_WHOAMI_BOARD 0x0F00
74
75#define BCSR_STATUS_PCMCIA0VS 0x0003
76#define BCSR_STATUS_PCMCIA1VS 0x000C
77#define BCSR_STATUS_PCMCIA0FI 0x0010
78#define BCSR_STATUS_PCMCIA1FI 0x0020
79#define BCSR_STATUS_SWAPBOOT 0x0040
80#define BCSR_STATUS_SRAMWIDTH 0x0080
81#define BCSR_STATUS_FLASHBUSY 0x0100
82#define BCSR_STATUS_ROMBUSY 0x0200
83#define BCSR_STATUS_USBOTGID 0x0800
84#define BCSR_STATUS_U0RXD 0x1000
85#define BCSR_STATUS_U1RXD 0x2000
86#define BCSR_STATUS_U3RXD 0x8000
87
88#define BCSR_SWITCHES_OCTAL 0x00FF
89#define BCSR_SWITCHES_DIP_1 0x0080
90#define BCSR_SWITCHES_DIP_2 0x0040
91#define BCSR_SWITCHES_DIP_3 0x0020
92#define BCSR_SWITCHES_DIP_4 0x0010
93#define BCSR_SWITCHES_DIP_5 0x0008
94#define BCSR_SWITCHES_DIP_6 0x0004
95#define BCSR_SWITCHES_DIP_7 0x0002
96#define BCSR_SWITCHES_DIP_8 0x0001
97#define BCSR_SWITCHES_ROTARY 0x0F00
98
99#define BCSR_RESETS_PHY0 0x0001
100#define BCSR_RESETS_PHY1 0x0002
101#define BCSR_RESETS_DC 0x0004
102#define BCSR_RESETS_WSC 0x2000
103#define BCSR_RESETS_SPISEL 0x4000
104#define BCSR_RESETS_DMAREQ 0x8000
105
106#define BCSR_PCMCIA_PC0VPP 0x0003
107#define BCSR_PCMCIA_PC0VCC 0x000C
108#define BCSR_PCMCIA_PC0DRVEN 0x0010
109#define BCSR_PCMCIA_PC0RST 0x0080
110#define BCSR_PCMCIA_PC1VPP 0x0300
111#define BCSR_PCMCIA_PC1VCC 0x0C00
112#define BCSR_PCMCIA_PC1DRVEN 0x1000
113#define BCSR_PCMCIA_PC1RST 0x8000
114
115#define BCSR_PCI_M66EN 0x0001
116#define BCSR_PCI_M33 0x0100
117#define BCSR_PCI_EXTERNARB 0x0200
118#define BCSR_PCI_GPIO200RST 0x0400
119#define BCSR_PCI_CLKOUT 0x0800
120#define BCSR_PCI_CFGHOST 0x1000
121
122#define BCSR_LEDS_DECIMALS 0x00FF
123#define BCSR_LEDS_LED0 0x0100
124#define BCSR_LEDS_LED1 0x0200
125#define BCSR_LEDS_LED2 0x0400
126#define BCSR_LEDS_LED3 0x0800
127
128#define BCSR_SYSTEM_VDDI 0x001F
129#define BCSR_SYSTEM_POWEROFF 0x4000
130#define BCSR_SYSTEM_RESET 0x8000
131
132#define PCMCIA_MAX_SOCK 1
133#define PCMCIA_NUM_SOCKS (PCMCIA_MAX_SOCK + 1)
134
135/* VPP/VCC */
136#define SET_VCC_VPP(VCC, VPP, SLOT) \
137 ((((VCC) << 2) | ((VPP) << 0)) << ((SLOT) * 8))
138
139#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
140#define PB1550_BOTH_BANKS
141#elif defined(CONFIG_MTD_PB1550_BOOT) && !defined(CONFIG_MTD_PB1550_USER)
142#define PB1550_BOOT_ONLY
143#elif !defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
144#define PB1550_USER_ONLY
145#endif
146
147/*
148 * Timing values as described in databook, * ns value stripped of
149 * lower 2 bits.
150 * These defines are here rather than an SOC1550 generic file because
151 * the parts chosen on another board may be different and may require
152 * different timings.
153 */
154#define NAND_T_H (18 >> 2)
155#define NAND_T_PUL (30 >> 2)
156#define NAND_T_SU (30 >> 2)
157#define NAND_T_WH (30 >> 2)
158
159/* Bitfield shift amounts */
160#define NAND_T_H_SHIFT 0
161#define NAND_T_PUL_SHIFT 4
162#define NAND_T_SU_SHIFT 8
163#define NAND_T_WH_SHIFT 12
164
165#define NAND_TIMING (((NAND_T_H & 0xF) << NAND_T_H_SHIFT) | \
166 ((NAND_T_PUL & 0xF) << NAND_T_PUL_SHIFT) | \
167 ((NAND_T_SU & 0xF) << NAND_T_SU_SHIFT) | \
168 ((NAND_T_WH & 0xF) << NAND_T_WH_SHIFT))
169
170#define NAND_CS 1
171
172/* Should be done by YAMON */
173#define NAND_STCFG 0x00400005 /* 8-bit NAND */
174#define NAND_STTIME 0x00007774 /* valid for 396 MHz SD=2 only */
175#define NAND_STADDR 0x12000FFF /* physical address 0x20000000 */
176
177#endif /* __ASM_PB1550_H */
diff --git a/include/asm-mips/mach-pnx8550/cm.h b/include/asm-mips/mach-pnx8550/cm.h
deleted file mode 100644
index bb0a56c7d011..000000000000
--- a/include/asm-mips/mach-pnx8550/cm.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Clock module specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef __PNX8550_CM_H
23#define __PNX8550_CM_H
24
25#define PNX8550_CM_BASE 0xBBE47000
26
27#define PNX8550_CM_PLL0_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x000)
28#define PNX8550_CM_PLL1_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x004)
29#define PNX8550_CM_PLL2_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x008)
30#define PNX8550_CM_PLL3_CTL *(volatile unsigned long *)(PNX8550_CM_BASE + 0x00C)
31
32// Table not complete.....
33
34#define PNX8550_CM_PLL_BLOCKED_MASK 0x80000000
35#define PNX8550_CM_PLL_LOCK_MASK 0x40000000
36#define PNX8550_CM_PLL_CURRENT_ADJ_MASK 0x3c000000
37#define PNX8550_CM_PLL_N_MASK 0x01ff0000
38#define PNX8550_CM_PLL_M_MASK 0x00003f00
39#define PNX8550_CM_PLL_P_MASK 0x0000000c
40#define PNX8550_CM_PLL_PD_MASK 0x00000002
41
42
43#endif
diff --git a/include/asm-mips/mach-pnx8550/glb.h b/include/asm-mips/mach-pnx8550/glb.h
deleted file mode 100644
index 07aa85e609bc..000000000000
--- a/include/asm-mips/mach-pnx8550/glb.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PNX8550 global definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef __PNX8550_GLB_H
23#define __PNX8550_GLB_H
24
25#define PNX8550_GLB1_BASE 0xBBE63000
26#define PNX8550_GLB2_BASE 0xBBE4d000
27#define PNX8550_RESET_BASE 0xBBE60000
28
29/* PCI Inta Output Enable Registers */
30#define PNX8550_GLB2_ENAB_INTA_O *(volatile unsigned long *)(PNX8550_GLB2_BASE + 0x050)
31
32/* Bit 1:Enable DAC Powerdown
33 0:DACs are enabled and are working normally
34 1:DACs are powerdown
35*/
36#define PNX8550_GLB_DAC_PD 0x2
37/* Bit 0:Enable of PCI inta output
38 0 = Disable PCI inta output
39 1 = Enable PCI inta output
40*/
41#define PNX8550_GLB_ENABLE_INTA_O 0x1
42
43/* PCI Direct Mappings */
44#define PNX8550_PCIMEM 0x12000000
45#define PNX8550_PCIMEM_SIZE 0x08000000
46#define PNX8550_PCIIO 0x1c000000
47#define PNX8550_PCIIO_SIZE 0x02000000 /* 32M */
48
49#define PNX8550_PORT_BASE KSEG1
50
51// GPIO def
52#define PNX8550_GPIO_BASE 0x1Be00000
53
54#define PNX8550_GPIO_DIRQ0 (PNX8550_GPIO_BASE + 0x104500)
55#define PNX8550_GPIO_MC1 (PNX8550_GPIO_BASE + 0x104004)
56#define PNX8550_GPIO_MC_31_BIT 30
57#define PNX8550_GPIO_MC_30_BIT 28
58#define PNX8550_GPIO_MC_29_BIT 26
59#define PNX8550_GPIO_MC_28_BIT 24
60#define PNX8550_GPIO_MC_27_BIT 22
61#define PNX8550_GPIO_MC_26_BIT 20
62#define PNX8550_GPIO_MC_25_BIT 18
63#define PNX8550_GPIO_MC_24_BIT 16
64#define PNX8550_GPIO_MC_23_BIT 14
65#define PNX8550_GPIO_MC_22_BIT 12
66#define PNX8550_GPIO_MC_21_BIT 10
67#define PNX8550_GPIO_MC_20_BIT 8
68#define PNX8550_GPIO_MC_19_BIT 6
69#define PNX8550_GPIO_MC_18_BIT 4
70#define PNX8550_GPIO_MC_17_BIT 2
71#define PNX8550_GPIO_MC_16_BIT 0
72
73#define PNX8550_GPIO_MODE_PRIMOP 0x1
74#define PNX8550_GPIO_MODE_NO_OPENDR 0x2
75#define PNX8550_GPIO_MODE_OPENDR 0x3
76
77// RESET module
78#define PNX8550_RST_CTL *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x0)
79#define PNX8550_RST_CAUSE *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x4)
80#define PNX8550_RST_EN_WATCHDOG *(volatile unsigned long *)(PNX8550_RESET_BASE + 0x8)
81
82#define PNX8550_RST_REL_MIPS_RST_N 0x8
83#define PNX8550_RST_DO_SW_RST 0x4
84#define PNX8550_RST_REL_SYS_RST_OUT 0x2
85#define PNX8550_RST_ASSERT_SYS_RST_OUT 0x1
86#endif
diff --git a/include/asm-mips/mach-pnx8550/int.h b/include/asm-mips/mach-pnx8550/int.h
deleted file mode 100644
index 0e0668b524f4..000000000000
--- a/include/asm-mips/mach-pnx8550/int.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Interrupt specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef __PNX8550_INT_H
23#define __PNX8550_INT_H
24
25#define PNX8550_GIC_BASE 0xBBE3E000
26
27#define PNX8550_GIC_PRIMASK_0 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x000)
28#define PNX8550_GIC_PRIMASK_1 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x004)
29#define PNX8550_GIC_VECTOR_0 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x100)
30#define PNX8550_GIC_VECTOR_1 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x104)
31#define PNX8550_GIC_PEND_1_31 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x200)
32#define PNX8550_GIC_PEND_32_63 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x204)
33#define PNX8550_GIC_PEND_64_70 *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x208)
34#define PNX8550_GIC_FEATURES *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x300)
35#define PNX8550_GIC_REQ(x) *(volatile unsigned long *)(PNX8550_GIC_BASE + 0x400 + (x)*4)
36#define PNX8550_GIC_MOD_ID *(volatile unsigned long *)(PNX8550_GIC_BASE + 0xFFC)
37
38// cp0 is two software + six hw exceptions
39#define PNX8550_INT_CP0_TOTINT 8
40#define PNX8550_INT_CP0_MIN 0
41#define PNX8550_INT_CP0_MAX (PNX8550_INT_CP0_MIN + PNX8550_INT_CP0_TOTINT - 1)
42
43#define MIPS_CPU_GIC_IRQ 2
44#define MIPS_CPU_TIMER_IRQ 7
45
46// GIC are 71 exceptions connected to cp0's first hardware exception
47#define PNX8550_INT_GIC_TOTINT 71
48#define PNX8550_INT_GIC_MIN (PNX8550_INT_CP0_MAX+1)
49#define PNX8550_INT_GIC_MAX (PNX8550_INT_GIC_MIN + PNX8550_INT_GIC_TOTINT - 1)
50
51#define PNX8550_INT_UNDEF (PNX8550_INT_GIC_MIN+0)
52#define PNX8550_INT_IPC_TARGET0_MIPS (PNX8550_INT_GIC_MIN+1)
53#define PNX8550_INT_IPC_TARGET1_TM32_1 (PNX8550_INT_GIC_MIN+2)
54#define PNX8550_INT_IPC_TARGET1_TM32_2 (PNX8550_INT_GIC_MIN+3)
55#define PNX8550_INT_RESERVED_4 (PNX8550_INT_GIC_MIN+4)
56#define PNX8550_INT_USB (PNX8550_INT_GIC_MIN+5)
57#define PNX8550_INT_GPIO_EQ1 (PNX8550_INT_GIC_MIN+6)
58#define PNX8550_INT_GPIO_EQ2 (PNX8550_INT_GIC_MIN+7)
59#define PNX8550_INT_GPIO_EQ3 (PNX8550_INT_GIC_MIN+8)
60#define PNX8550_INT_GPIO_EQ4 (PNX8550_INT_GIC_MIN+9)
61
62#define PNX8550_INT_GPIO_EQ5 (PNX8550_INT_GIC_MIN+10)
63#define PNX8550_INT_GPIO_EQ6 (PNX8550_INT_GIC_MIN+11)
64#define PNX8550_INT_RESERVED_12 (PNX8550_INT_GIC_MIN+12)
65#define PNX8550_INT_QVCP1 (PNX8550_INT_GIC_MIN+13)
66#define PNX8550_INT_QVCP2 (PNX8550_INT_GIC_MIN+14)
67#define PNX8550_INT_I2C1 (PNX8550_INT_GIC_MIN+15)
68#define PNX8550_INT_I2C2 (PNX8550_INT_GIC_MIN+16)
69#define PNX8550_INT_ISO_UART1 (PNX8550_INT_GIC_MIN+17)
70#define PNX8550_INT_ISO_UART2 (PNX8550_INT_GIC_MIN+18)
71#define PNX8550_INT_UART1 (PNX8550_INT_GIC_MIN+19)
72
73#define PNX8550_INT_UART2 (PNX8550_INT_GIC_MIN+20)
74#define PNX8550_INT_QNTR (PNX8550_INT_GIC_MIN+21)
75#define PNX8550_INT_RESERVED22 (PNX8550_INT_GIC_MIN+22)
76#define PNX8550_INT_T_DSC (PNX8550_INT_GIC_MIN+23)
77#define PNX8550_INT_M_DSC (PNX8550_INT_GIC_MIN+24)
78#define PNX8550_INT_RESERVED25 (PNX8550_INT_GIC_MIN+25)
79#define PNX8550_INT_2D_DRAW_ENG (PNX8550_INT_GIC_MIN+26)
80#define PNX8550_INT_MEM_BASED_SCALAR1 (PNX8550_INT_GIC_MIN+27)
81#define PNX8550_INT_VIDEO_MPEG (PNX8550_INT_GIC_MIN+28)
82#define PNX8550_INT_VIDEO_INPUT_P1 (PNX8550_INT_GIC_MIN+29)
83
84#define PNX8550_INT_VIDEO_INPUT_P2 (PNX8550_INT_GIC_MIN+30)
85#define PNX8550_INT_SPDI1 (PNX8550_INT_GIC_MIN+31)
86#define PNX8550_INT_SPDO (PNX8550_INT_GIC_MIN+32)
87#define PNX8550_INT_AUDIO_INPUT1 (PNX8550_INT_GIC_MIN+33)
88#define PNX8550_INT_AUDIO_OUTPUT1 (PNX8550_INT_GIC_MIN+34)
89#define PNX8550_INT_AUDIO_INPUT2 (PNX8550_INT_GIC_MIN+35)
90#define PNX8550_INT_AUDIO_OUTPUT2 (PNX8550_INT_GIC_MIN+36)
91#define PNX8550_INT_MEMBASED_SCALAR2 (PNX8550_INT_GIC_MIN+37)
92#define PNX8550_INT_VPK (PNX8550_INT_GIC_MIN+38)
93#define PNX8550_INT_MPEG1_MIPS (PNX8550_INT_GIC_MIN+39)
94
95#define PNX8550_INT_MPEG1_TM (PNX8550_INT_GIC_MIN+40)
96#define PNX8550_INT_MPEG2_MIPS (PNX8550_INT_GIC_MIN+41)
97#define PNX8550_INT_MPEG2_TM (PNX8550_INT_GIC_MIN+42)
98#define PNX8550_INT_TS_DMA (PNX8550_INT_GIC_MIN+43)
99#define PNX8550_INT_EDMA (PNX8550_INT_GIC_MIN+44)
100#define PNX8550_INT_TM_DEBUG1 (PNX8550_INT_GIC_MIN+45)
101#define PNX8550_INT_TM_DEBUG2 (PNX8550_INT_GIC_MIN+46)
102#define PNX8550_INT_PCI_INTA (PNX8550_INT_GIC_MIN+47)
103#define PNX8550_INT_CLOCK_MODULE (PNX8550_INT_GIC_MIN+48)
104#define PNX8550_INT_PCI_XIO_INTA_PCI (PNX8550_INT_GIC_MIN+49)
105
106#define PNX8550_INT_PCI_XIO_INTB_DMA (PNX8550_INT_GIC_MIN+50)
107#define PNX8550_INT_PCI_XIO_INTC_GPPM (PNX8550_INT_GIC_MIN+51)
108#define PNX8550_INT_PCI_XIO_INTD_GPXIO (PNX8550_INT_GIC_MIN+52)
109#define PNX8550_INT_DVD_CSS (PNX8550_INT_GIC_MIN+53)
110#define PNX8550_INT_VLD (PNX8550_INT_GIC_MIN+54)
111#define PNX8550_INT_GPIO_TSU_7_0 (PNX8550_INT_GIC_MIN+55)
112#define PNX8550_INT_GPIO_TSU_15_8 (PNX8550_INT_GIC_MIN+56)
113#define PNX8550_INT_GPIO_CTU_IR (PNX8550_INT_GIC_MIN+57)
114#define PNX8550_INT_GPIO0 (PNX8550_INT_GIC_MIN+58)
115#define PNX8550_INT_GPIO1 (PNX8550_INT_GIC_MIN+59)
116
117#define PNX8550_INT_GPIO2 (PNX8550_INT_GIC_MIN+60)
118#define PNX8550_INT_GPIO3 (PNX8550_INT_GIC_MIN+61)
119#define PNX8550_INT_GPIO4 (PNX8550_INT_GIC_MIN+62)
120#define PNX8550_INT_GPIO5 (PNX8550_INT_GIC_MIN+63)
121#define PNX8550_INT_GPIO6 (PNX8550_INT_GIC_MIN+64)
122#define PNX8550_INT_GPIO7 (PNX8550_INT_GIC_MIN+65)
123#define PNX8550_INT_PMAN_SECURITY (PNX8550_INT_GIC_MIN+66)
124#define PNX8550_INT_I2C3 (PNX8550_INT_GIC_MIN+67)
125#define PNX8550_INT_RESERVED_68 (PNX8550_INT_GIC_MIN+68)
126#define PNX8550_INT_SPDI2 (PNX8550_INT_GIC_MIN+69)
127
128#define PNX8550_INT_I2C4 (PNX8550_INT_GIC_MIN+70)
129
130// Timer are 3 exceptions connected to cp0's 7th hardware exception
131#define PNX8550_INT_TIMER_TOTINT 3
132#define PNX8550_INT_TIMER_MIN (PNX8550_INT_GIC_MAX+1)
133#define PNX8550_INT_TIMER_MAX (PNX8550_INT_TIMER_MIN + PNX8550_INT_TIMER_TOTINT - 1)
134
135#define PNX8550_INT_TIMER1 (PNX8550_INT_TIMER_MIN+0)
136#define PNX8550_INT_TIMER2 (PNX8550_INT_TIMER_MIN+1)
137#define PNX8550_INT_TIMER3 (PNX8550_INT_TIMER_MIN+2)
138#define PNX8550_INT_WATCHDOG PNX8550_INT_TIMER3
139
140#endif
diff --git a/include/asm-mips/mach-pnx8550/kernel-entry-init.h b/include/asm-mips/mach-pnx8550/kernel-entry-init.h
deleted file mode 100644
index bdde00c9199b..000000000000
--- a/include/asm-mips/mach-pnx8550/kernel-entry-init.h
+++ /dev/null
@@ -1,262 +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) 2005 Embedded Alley Solutions, Inc
7 */
8#ifndef __ASM_MACH_KERNEL_ENTRY_INIT_H
9#define __ASM_MACH_KERNEL_ENTRY_INIT_H
10
11#include <asm/cacheops.h>
12#include <asm/addrspace.h>
13
14#define CO_CONFIGPR_VALID 0x3F1F41FF /* valid bits to write to ConfigPR */
15#define HAZARD_CP0 nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;
16#define CACHE_OPC 0xBC000000 /* MIPS cache instruction opcode */
17#define ICACHE_LINE_SIZE 32 /* Instruction cache line size bytes */
18#define DCACHE_LINE_SIZE 32 /* Data cache line size in bytes */
19
20#define ICACHE_SET_COUNT 256 /* Instruction cache set count */
21#define DCACHE_SET_COUNT 128 /* Data cache set count */
22
23#define ICACHE_SET_SIZE (ICACHE_SET_COUNT * ICACHE_LINE_SIZE)
24#define DCACHE_SET_SIZE (DCACHE_SET_COUNT * DCACHE_LINE_SIZE)
25
26 .macro kernel_entry_setup
27 .set push
28 .set noreorder
29 /*
30 * PNX8550 entry point, when running a non compressed
31 * kernel. When loading a zImage, the head.S code in
32 * arch/mips/zboot/pnx8550 will init the caches and,
33 * decompress the kernel, and branch to kernel_entry.
34 */
35cache_begin: li t0, (1<<28)
36 mtc0 t0, CP0_STATUS /* cp0 usable */
37 HAZARD_CP0
38
39 mtc0 zero, CP0_CAUSE
40 HAZARD_CP0
41
42
43 /* Set static virtual to phys address translation and TLB disabled */
44 mfc0 t0, CP0_CONFIG, 7
45 HAZARD_CP0
46
47 and t0, ~((1<<19) | (1<<20)) /* TLB/MAP cleared */
48 mtc0 t0, CP0_CONFIG, 7
49 HAZARD_CP0
50
51 /* CPU boots with kseg0 cache algo set to 0x2 -- uncached */
52
53 init_icache
54 nop
55 init_dcache
56 nop
57
58 cachePr4450ICReset
59 nop
60
61 cachePr4450DCReset
62 nop
63
64 /* read ConfigPR into t0 */
65 mfc0 t0, CP0_CONFIG, 7
66 HAZARD_CP0
67
68 /* enable the TLB */
69 or t0, (1<<19)
70
71 /* disable the ICACHE: at least 10x slower */
72 /* or t0, (1<<26) */
73
74 /* disable the DCACHE; CONFIG_CPU_HAS_LLSC should not be set */
75 /* or t0, (1<<27) */
76
77 and t0, CO_CONFIGPR_VALID
78
79 /* enable TLB. */
80 mtc0 t0, CP0_CONFIG, 7
81 HAZARD_CP0
82cache_end:
83 /* Setup CMEM_0 to MMIO address space, 2MB */
84 lui t0, 0x1BE0
85 addi t0, t0, 0x3
86 mtc0 $8, $22, 4
87 nop
88
89 /* Setup CMEM_1, 128MB */
90 lui t0, 0x1000
91 addi t0, t0, 0xf
92 mtc0 $8, $22, 5
93 nop
94
95
96 /* Setup CMEM_2, 32MB */
97 lui t0, 0x1C00
98 addi t0, t0, 0xb
99 mtc0 $8, $22, 6
100 nop
101
102 /* Setup CMEM_3, 0MB */
103 lui t0, 0x0
104 addi t0, t0, 0x0
105 mtc0 $8, $22, 7
106 nop
107
108 /* Enable cache */
109 mfc0 t0, CP0_CONFIG
110 HAZARD_CP0
111 and t0, t0, 0xFFFFFFF8
112 or t0, t0, 3
113 mtc0 t0, CP0_CONFIG
114 HAZARD_CP0
115 .set pop
116 .endm
117
118 .macro init_icache
119 .set push
120 .set noreorder
121
122 /* Get Cache Configuration */
123 mfc0 t3, CP0_CONFIG, 1
124 HAZARD_CP0
125
126 /* get cache Line size */
127
128 srl t1, t3, 19 /* C0_CONFIGPR_IL_SHIFT */
129 andi t1, t1, 0x7 /* C0_CONFIGPR_IL_MASK */
130 beq t1, zero, pr4450_instr_cache_invalidated /* if zero instruction cache is absent */
131 nop
132 addiu t0, t1, 1
133 ori t1, zero, 1
134 sllv t1, t1, t0
135
136 /* get max cache Index */
137 srl t2, t3, 22 /* C0_CONFIGPR_IS_SHIFT */
138 andi t2, t2, 0x7 /* C0_CONFIGPR_IS_MASK */
139 addiu t0, t2, 6
140 ori t2, zero, 1
141 sllv t2, t2, t0
142
143 /* get max cache way */
144 srl t3, t3, 16 /* C0_CONFIGPR_IA_SHIFT */
145 andi t3, t3, 0x7 /* C0_CONFIGPR_IA_MASK */
146 addiu t3, t3, 1
147
148 /* total no of cache lines */
149 multu t2, t3 /* max index * max way */
150 mflo t2
151 addiu t2, t2, -1
152
153 move t0, zero
154pr4450_next_instruction_cache_set:
155 cache Index_Invalidate_I, 0(t0)
156 addu t0, t0, t1 /* add bytes in a line */
157 bne t2, zero, pr4450_next_instruction_cache_set
158 addiu t2, t2, -1 /* reduce no of lines to invalidate by one */
159pr4450_instr_cache_invalidated:
160 .set pop
161 .endm
162
163 .macro init_dcache
164 .set push
165 .set noreorder
166 move t1, zero
167
168 /* Store Tag Information */
169 mtc0 zero, CP0_TAGLO, 0
170 HAZARD_CP0
171
172 mtc0 zero, CP0_TAGHI, 0
173 HAZARD_CP0
174
175 /* Cache size is 16384 = 512 lines x 32 bytes per line */
176 or t2, zero, (128*4)-1 /* 512 lines */
177 /* Invalidate all lines */
1782:
179 cache Index_Store_Tag_D, 0(t1)
180 addiu t2, t2, -1
181 bne t2, zero, 2b
182 addiu t1, t1, 32 /* 32 bytes in a line */
183 .set pop
184 .endm
185
186 .macro cachePr4450ICReset
187 .set push
188 .set noreorder
189
190 /* Save CP0 status reg on entry; */
191 /* disable interrupts during cache reset */
192 mfc0 t0, CP0_STATUS /* T0 = interrupt status on entry */
193 HAZARD_CP0
194
195 mtc0 zero, CP0_STATUS /* disable CPU interrupts */
196 HAZARD_CP0
197
198 or t1, zero, zero /* T1 = starting cache index (0) */
199 ori t2, zero, (256 - 1) /* T2 = inst cache set cnt - 1 */
200
201 icache_invd_loop:
202 /* 9 == register t1 */
203 .word CACHE_OPC | (9 << 21) | (Index_Invalidate_I << 16) | \
204 (0 * ICACHE_SET_SIZE) /* invalidate inst cache WAY0 */
205 .word CACHE_OPC | (9 << 21) | (Index_Invalidate_I << 16) | \
206 (1 * ICACHE_SET_SIZE) /* invalidate inst cache WAY1 */
207
208 addiu t1, t1, ICACHE_LINE_SIZE /* T1 = next cache line index */
209 bne t2, zero, icache_invd_loop /* T2 = 0 if all sets invalidated */
210 addiu t2, t2, -1 /* decrement T2 set cnt (delay slot) */
211
212 /* Initialize the latches in the instruction cache tag */
213 /* that drive the way selection tri-state bus drivers, by doing a */
214 /* dummy load while the instruction cache is still disabled. */
215 /* TODO: Is this needed ? */
216 la t1, KSEG0 /* T1 = cached memory base address */
217 lw zero, 0x0000(t1) /* (dummy read of first memory word) */
218
219 mtc0 t0, CP0_STATUS /* restore interrupt status on entry */
220 HAZARD_CP0
221 .set pop
222 .endm
223
224 .macro cachePr4450DCReset
225 .set push
226 .set noreorder
227 mfc0 t0, CP0_STATUS /* T0 = interrupt status on entry */
228 HAZARD_CP0
229 mtc0 zero, CP0_STATUS /* disable CPU interrupts */
230 HAZARD_CP0
231
232 /* Writeback/invalidate entire data cache sets/ways/lines */
233 or t1, zero, zero /* T1 = starting cache index (0) */
234 ori t2, zero, (DCACHE_SET_COUNT - 1) /* T2 = data cache set cnt - 1 */
235
236 dcache_wbinvd_loop:
237 /* 9 == register t1 */
238 .word CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
239 (0 * DCACHE_SET_SIZE) /* writeback/invalidate WAY0 */
240 .word CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
241 (1 * DCACHE_SET_SIZE) /* writeback/invalidate WAY1 */
242 .word CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
243 (2 * DCACHE_SET_SIZE) /* writeback/invalidate WAY2 */
244 .word CACHE_OPC | (9 << 21) | (Index_Writeback_Inv_D << 16) | \
245 (3 * DCACHE_SET_SIZE) /* writeback/invalidate WAY3 */
246
247 addiu t1, t1, DCACHE_LINE_SIZE /* T1 = next data cache line index */
248 bne t2, zero, dcache_wbinvd_loop /* T2 = 0 when wbinvd entire cache */
249 addiu t2, t2, -1 /* decrement T2 set cnt (delay slot) */
250
251 /* Initialize the latches in the data cache tag that drive the way
252 selection tri-state bus drivers, by doing a dummy load while the
253 data cache is still in the disabled mode. TODO: Is this needed ? */
254 la t1, KSEG0 /* T1 = cached memory base address */
255 lw zero, 0x0000(t1) /* (dummy read of first memory word) */
256
257 mtc0 t0, CP0_STATUS /* restore interrupt status on entry */
258 HAZARD_CP0
259 .set pop
260 .endm
261
262#endif /* __ASM_MACH_KERNEL_ENTRY_INIT_H */
diff --git a/include/asm-mips/mach-pnx8550/nand.h b/include/asm-mips/mach-pnx8550/nand.h
deleted file mode 100644
index aefbc514ab09..000000000000
--- a/include/asm-mips/mach-pnx8550/nand.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifndef __PNX8550_NAND_H
2#define __PNX8550_NAND_H
3
4#define PNX8550_NAND_BASE_ADDR 0x10000000
5#define PNX8550_PCIXIO_BASE 0xBBE40000
6
7#define PNX8550_DMA_EXT_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x800)
8#define PNX8550_DMA_INT_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x804)
9#define PNX8550_DMA_TRANS_SIZE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x808)
10#define PNX8550_DMA_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x80c)
11#define PNX8550_XIO_SEL0 *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x814)
12#define PNX8550_GPXIO_ADDR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x820)
13#define PNX8550_GPXIO_WR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x824)
14#define PNX8550_GPXIO_RD *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x828)
15#define PNX8550_GPXIO_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x82C)
16#define PNX8550_XIO_FLASH_CTRL *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0x830)
17#define PNX8550_GPXIO_INT_STATUS *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb0)
18#define PNX8550_GPXIO_INT_ENABLE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb4)
19#define PNX8550_GPXIO_INT_CLEAR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfb8)
20#define PNX8550_DMA_INT_STATUS *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd0)
21#define PNX8550_DMA_INT_ENABLE *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd4)
22#define PNX8550_DMA_INT_CLEAR *(volatile unsigned long *)(PNX8550_PCIXIO_BASE + 0xfd8)
23
24#define PNX8550_XIO_SEL0_EN_16BIT 0x00800000
25#define PNX8550_XIO_SEL0_USE_ACK 0x00400000
26#define PNX8550_XIO_SEL0_REN_HIGH 0x00100000
27#define PNX8550_XIO_SEL0_REN_LOW 0x00040000
28#define PNX8550_XIO_SEL0_WEN_HIGH 0x00010000
29#define PNX8550_XIO_SEL0_WEN_LOW 0x00004000
30#define PNX8550_XIO_SEL0_WAIT 0x00000200
31#define PNX8550_XIO_SEL0_OFFSET 0x00000020
32#define PNX8550_XIO_SEL0_TYPE_68360 0x00000000
33#define PNX8550_XIO_SEL0_TYPE_NOR 0x00000008
34#define PNX8550_XIO_SEL0_TYPE_NAND 0x00000010
35#define PNX8550_XIO_SEL0_TYPE_IDE 0x00000018
36#define PNX8550_XIO_SEL0_SIZE_8MB 0x00000000
37#define PNX8550_XIO_SEL0_SIZE_16MB 0x00000002
38#define PNX8550_XIO_SEL0_SIZE_32MB 0x00000004
39#define PNX8550_XIO_SEL0_SIZE_64MB 0x00000006
40#define PNX8550_XIO_SEL0_ENAB 0x00000001
41
42#define PNX8550_SEL0_DEFAULT ((PNX8550_XIO_SEL0_EN_16BIT) | \
43 (PNX8550_XIO_SEL0_REN_HIGH*0)| \
44 (PNX8550_XIO_SEL0_REN_LOW*2) | \
45 (PNX8550_XIO_SEL0_WEN_HIGH*0)| \
46 (PNX8550_XIO_SEL0_WEN_LOW*2) | \
47 (PNX8550_XIO_SEL0_WAIT*4) | \
48 (PNX8550_XIO_SEL0_OFFSET*0) | \
49 (PNX8550_XIO_SEL0_TYPE_NAND) | \
50 (PNX8550_XIO_SEL0_SIZE_32MB) | \
51 (PNX8550_XIO_SEL0_ENAB))
52
53#define PNX8550_GPXIO_PENDING 0x00000200
54#define PNX8550_GPXIO_DONE 0x00000100
55#define PNX8550_GPXIO_CLR_DONE 0x00000080
56#define PNX8550_GPXIO_INIT 0x00000040
57#define PNX8550_GPXIO_READ_CMD 0x00000010
58#define PNX8550_GPXIO_BEN 0x0000000F
59
60#define PNX8550_XIO_FLASH_64MB 0x00200000
61#define PNX8550_XIO_FLASH_INC_DATA 0x00100000
62#define PNX8550_XIO_FLASH_CMD_PH 0x000C0000
63#define PNX8550_XIO_FLASH_CMD_PH2 0x00080000
64#define PNX8550_XIO_FLASH_CMD_PH1 0x00040000
65#define PNX8550_XIO_FLASH_CMD_PH0 0x00000000
66#define PNX8550_XIO_FLASH_ADR_PH 0x00030000
67#define PNX8550_XIO_FLASH_ADR_PH3 0x00030000
68#define PNX8550_XIO_FLASH_ADR_PH2 0x00020000
69#define PNX8550_XIO_FLASH_ADR_PH1 0x00010000
70#define PNX8550_XIO_FLASH_ADR_PH0 0x00000000
71#define PNX8550_XIO_FLASH_CMD_B(x) ((x<<8) & 0x0000FF00)
72#define PNX8550_XIO_FLASH_CMD_A(x) (x & 0x000000FF)
73
74#define PNX8550_XIO_INT_ACK 0x00004000
75#define PNX8550_XIO_INT_COMPL 0x00002000
76#define PNX8550_XIO_INT_NONSUP 0x00000200
77#define PNX8550_XIO_INT_ABORT 0x00000004
78
79#define PNX8550_DMA_CTRL_SINGLE_DATA 0x00000400
80#define PNX8550_DMA_CTRL_SND2XIO 0x00000200
81#define PNX8550_DMA_CTRL_FIX_ADDR 0x00000100
82#define PNX8550_DMA_CTRL_BURST_8 0x00000000
83#define PNX8550_DMA_CTRL_BURST_16 0x00000020
84#define PNX8550_DMA_CTRL_BURST_32 0x00000040
85#define PNX8550_DMA_CTRL_BURST_64 0x00000060
86#define PNX8550_DMA_CTRL_BURST_128 0x00000080
87#define PNX8550_DMA_CTRL_BURST_256 0x000000A0
88#define PNX8550_DMA_CTRL_BURST_512 0x000000C0
89#define PNX8550_DMA_CTRL_BURST_NORES 0x000000E0
90#define PNX8550_DMA_CTRL_INIT_DMA 0x00000010
91#define PNX8550_DMA_CTRL_CMD_TYPE 0x0000000F
92
93/* see PCI system arch, page 100 for the full list: */
94#define PNX8550_DMA_CTRL_PCI_CMD_READ 0x00000006
95#define PNX8550_DMA_CTRL_PCI_CMD_WRITE 0x00000007
96
97#define PNX8550_DMA_INT_STAT_ACK_DONE (1<<14)
98#define PNX8550_DMA_INT_STAT_DMA_DONE (1<<12)
99#define PNX8550_DMA_INT_STAT_DMA_ERR (1<<9)
100#define PNX8550_DMA_INT_STAT_PERR5 (1<<5)
101#define PNX8550_DMA_INT_STAT_PERR4 (1<<4)
102#define PNX8550_DMA_INT_STAT_M_ABORT (1<<2)
103#define PNX8550_DMA_INT_STAT_T_ABORT (1<<1)
104
105#define PNX8550_DMA_INT_EN_ACK_DONE (1<<14)
106#define PNX8550_DMA_INT_EN_DMA_DONE (1<<12)
107#define PNX8550_DMA_INT_EN_DMA_ERR (1<<9)
108#define PNX8550_DMA_INT_EN_PERR5 (1<<5)
109#define PNX8550_DMA_INT_EN_PERR4 (1<<4)
110#define PNX8550_DMA_INT_EN_M_ABORT (1<<2)
111#define PNX8550_DMA_INT_EN_T_ABORT (1<<1)
112
113#define PNX8550_DMA_INT_CLR_ACK_DONE (1<<14)
114#define PNX8550_DMA_INT_CLR_DMA_DONE (1<<12)
115#define PNX8550_DMA_INT_CLR_DMA_ERR (1<<9)
116#define PNX8550_DMA_INT_CLR_PERR5 (1<<5)
117#define PNX8550_DMA_INT_CLR_PERR4 (1<<4)
118#define PNX8550_DMA_INT_CLR_M_ABORT (1<<2)
119#define PNX8550_DMA_INT_CLR_T_ABORT (1<<1)
120
121#endif
diff --git a/include/asm-mips/mach-pnx8550/pci.h b/include/asm-mips/mach-pnx8550/pci.h
deleted file mode 100644
index b921508d701b..000000000000
--- a/include/asm-mips/mach-pnx8550/pci.h
+++ /dev/null
@@ -1,185 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PCI specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef __PNX8550_PCI_H
23#define __PNX8550_PCI_H
24
25#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29
30#define PCI_ACCESS_READ 0
31#define PCI_ACCESS_WRITE 1
32
33#define PCI_CMD_IOR 0x20
34#define PCI_CMD_IOW 0x30
35#define PCI_CMD_CONFIG_READ 0xa0
36#define PCI_CMD_CONFIG_WRITE 0xb0
37
38#define PCI_IO_TIMEOUT 1000
39#define PCI_IO_RETRY 5
40/* Timeout for IO and CFG accesses.
41 This is in 1/1024 th of a jiffie(=10ms)
42 i.e. approx 10us */
43#define PCI_IO_JIFFIES_TIMEOUT 40
44#define PCI_IO_JIFFIES_SHIFT 10
45
46#define PCI_BYTE_ENABLE_MASK 0x0000000f
47#define PCI_CFG_BUS_SHIFT 16
48#define PCI_CFG_FUNC_SHIFT 8
49#define PCI_CFG_REG_SHIFT 2
50
51#define PCI_BASE 0x1be00000
52#define PCI_SETUP 0x00040010
53#define PCI_DIS_REQGNT (1<<30)
54#define PCI_DIS_REQGNTA (1<<29)
55#define PCI_DIS_REQGNTB (1<<28)
56#define PCI_D2_SUPPORT (1<<27)
57#define PCI_D1_SUPPORT (1<<26)
58#define PCI_EN_TA (1<<24)
59#define PCI_EN_PCI2MMI (1<<23)
60#define PCI_EN_XIO (1<<22)
61#define PCI_BASE18_PREF (1<<21)
62#define SIZE_16M 0x3
63#define SIZE_32M 0x4
64#define SIZE_64M 0x5
65#define SIZE_128M 0x6
66#define PCI_SETUP_BASE18_SIZE(X) (X<<18)
67#define PCI_SETUP_BASE18_EN (1<<17)
68#define PCI_SETUP_BASE14_PREF (1<<16)
69#define PCI_SETUP_BASE14_SIZE(X) (X<<12)
70#define PCI_SETUP_BASE14_EN (1<<11)
71#define PCI_SETUP_BASE10_PREF (1<<10)
72#define PCI_SETUP_BASE10_SIZE(X) (X<<7)
73#define PCI_SETUP_CFGMANAGE_EN (1<<1)
74#define PCI_SETUP_PCIARB_EN (1<<0)
75
76#define PCI_CTRL 0x040014
77#define PCI_SWPB_DCS_PCI (1<<16)
78#define PCI_SWPB_PCI_PCI (1<<15)
79#define PCI_SWPB_PCI_DCS (1<<14)
80#define PCI_REG_WR_POST (1<<13)
81#define PCI_XIO_WR_POST (1<<12)
82#define PCI_PCI2_WR_POST (1<<13)
83#define PCI_PCI1_WR_POST (1<<12)
84#define PCI_SERR_SEEN (1<<11)
85#define PCI_B10_SPEC_RD (1<<6)
86#define PCI_B14_SPEC_RD (1<<5)
87#define PCI_B18_SPEC_RD (1<<4)
88#define PCI_B10_NOSUBWORD (1<<3)
89#define PCI_B14_NOSUBWORD (1<<2)
90#define PCI_B18_NOSUBWORD (1<<1)
91#define PCI_RETRY_TMREN (1<<0)
92
93#define PCI_BASE1_LO 0x040018
94#define PCI_BASE1_HI 0x04001C
95#define PCI_BASE2_LO 0x040020
96#define PCI_BASE2_HI 0x040024
97#define PCI_RDLIFETIM 0x040028
98#define PCI_GPPM_ADDR 0x04002C
99#define PCI_GPPM_WDAT 0x040030
100#define PCI_GPPM_RDAT 0x040034
101#define PCI_GPPM_CTRL 0x040038
102#define GPPM_DONE (1<<10)
103#define INIT_PCI_CYCLE (1<<9)
104#define GPPM_CMD(X) (((X)&0xf)<<4)
105#define GPPM_BYTEEN(X) ((X)&0xf)
106#define PCI_UNLOCKREG 0x04003C
107#define UNLOCK_SSID(X) (((X)&0xff)<<8)
108#define UNLOCK_SETUP(X) (((X)&0xff)<<0)
109#define UNLOCK_MAGIC 0xCA
110#define PCI_DEV_VEND_ID 0x040040
111#define DEVICE_ID(X) (((X)>>16)&0xffff)
112#define VENDOR_ID(X) (((X)&0xffff))
113#define PCI_CFG_CMDSTAT 0x040044
114#define PCI_CFG_STATUS(X) (((X)>>16)&0xffff)
115#define PCI_CFG_COMMAND(X) ((X)&0xffff)
116#define PCI_CLASS_REV 0x040048
117#define PCI_CLASSCODE(X) (((X)>>8)&0xffffff)
118#define PCI_REVID(X) ((X)&0xff)
119#define PCI_LAT_TMR 0x04004c
120#define PCI_BASE10 0x040050
121#define PCI_BASE14 0x040054
122#define PCI_BASE18 0x040058
123#define PCI_SUBSYS_ID 0x04006c
124#define PCI_CAP_PTR 0x040074
125#define PCI_CFG_MISC 0x04007c
126#define PCI_PMC 0x040080
127#define PCI_PWR_STATE 0x040084
128#define PCI_IO 0x040088
129#define PCI_SLVTUNING 0x04008C
130#define PCI_DMATUNING 0x040090
131#define PCI_DMAEADDR 0x040800
132#define PCI_DMAIADDR 0x040804
133#define PCI_DMALEN 0x040808
134#define PCI_DMACTRL 0x04080C
135#define PCI_XIOCTRL 0x040810
136#define PCI_SEL0PROF 0x040814
137#define PCI_SEL1PROF 0x040818
138#define PCI_SEL2PROF 0x04081C
139#define PCI_GPXIOADDR 0x040820
140#define PCI_NANDCTRLS 0x400830
141#define PCI_SEL3PROF 0x040834
142#define PCI_SEL4PROF 0x040838
143#define PCI_GPXIO_STAT 0x040FB0
144#define PCI_GPXIO_IMASK 0x040FB4
145#define PCI_GPXIO_ICLR 0x040FB8
146#define PCI_GPXIO_ISET 0x040FBC
147#define PCI_GPPM_STATUS 0x040FC0
148#define GPPM_DONE (1<<10)
149#define GPPM_ERR (1<<9)
150#define GPPM_MPAR_ERR (1<<8)
151#define GPPM_PAR_ERR (1<<7)
152#define GPPM_R_MABORT (1<<2)
153#define GPPM_R_TABORT (1<<1)
154#define PCI_GPPM_IMASK 0x040FC4
155#define PCI_GPPM_ICLR 0x040FC8
156#define PCI_GPPM_ISET 0x040FCC
157#define PCI_DMA_STATUS 0x040FD0
158#define PCI_DMA_IMASK 0x040FD4
159#define PCI_DMA_ICLR 0x040FD8
160#define PCI_DMA_ISET 0x040FDC
161#define PCI_ISTATUS 0x040FE0
162#define PCI_IMASK 0x040FE4
163#define PCI_ICLR 0x040FE8
164#define PCI_ISET 0x040FEC
165#define PCI_MOD_ID 0x040FFC
166
167/*
168 * PCI configuration cycle AD bus definition
169 */
170/* Type 0 */
171#define PCI_CFG_TYPE0_REG_SHF 0
172#define PCI_CFG_TYPE0_FUNC_SHF 8
173
174/* Type 1 */
175#define PCI_CFG_TYPE1_REG_SHF 0
176#define PCI_CFG_TYPE1_FUNC_SHF 8
177#define PCI_CFG_TYPE1_DEV_SHF 11
178#define PCI_CFG_TYPE1_BUS_SHF 16
179
180/*
181 * Ethernet device DP83816 definition
182 */
183#define DP83816_IRQ_ETHER 66
184
185#endif
diff --git a/include/asm-mips/mach-pnx8550/uart.h b/include/asm-mips/mach-pnx8550/uart.h
deleted file mode 100644
index ad7608d44874..000000000000
--- a/include/asm-mips/mach-pnx8550/uart.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef __IP3106_UART_H
2#define __IP3106_UART_H
3
4#include <int.h>
5
6/* early macros for kgdb use. fixme: clean this up */
7
8#define UART_BASE 0xbbe4a000 /* PNX8550 */
9
10#define PNX8550_UART_PORT0 (UART_BASE)
11#define PNX8550_UART_PORT1 (UART_BASE + 0x1000)
12
13#define PNX8550_UART_INT(x) (PNX8550_INT_GIC_MIN+19+x)
14#define IRQ_TO_UART(x) (x-PNX8550_INT_GIC_MIN-19)
15
16/* early macros needed for prom/kgdb */
17
18#define ip3106_lcr(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x000)
19#define ip3106_mcr(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x004)
20#define ip3106_baud(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x008)
21#define ip3106_cfg(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x00C)
22#define ip3106_fifo(base, port) *(volatile u32 *)(base+(port*0x1000) + 0x028)
23#define ip3106_istat(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE0)
24#define ip3106_ien(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE4)
25#define ip3106_iclr(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE8)
26#define ip3106_iset(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFEC)
27#define ip3106_pd(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFF4)
28#define ip3106_mid(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFFC)
29
30#endif
diff --git a/include/asm-mips/mach-pnx8550/usb.h b/include/asm-mips/mach-pnx8550/usb.h
deleted file mode 100644
index 483b7fc65d41..000000000000
--- a/include/asm-mips/mach-pnx8550/usb.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * USB specific definitions
5 *
6 * Author: source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * 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#ifndef __PNX8550_USB_H
23#define __PNX8550_USB_H
24
25/*
26 * USB Host controller
27 */
28
29#define PNX8550_USB_OHCI_OP_BASE 0x1be48000
30#define PNX8550_USB_OHCI_OP_LEN 0x1000
31
32#endif
diff --git a/include/asm-mips/mach-pnx8550/war.h b/include/asm-mips/mach-pnx8550/war.h
deleted file mode 100644
index d0458dd082f9..000000000000
--- a/include/asm-mips/mach-pnx8550/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_PNX8550_WAR_H
9#define __ASM_MIPS_MACH_PNX8550_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_PNX8550_WAR_H */
diff --git a/include/asm-mips/mach-rc32434/cpu-feature-overrides.h b/include/asm-mips/mach-rc32434/cpu-feature-overrides.h
deleted file mode 100644
index f3bc7efa2608..000000000000
--- a/include/asm-mips/mach-rc32434/cpu-feature-overrides.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * IDT RC32434 specific CPU feature overrides
3 *
4 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
5 *
6 * This file was derived from: include/asm-mips/cpu-features.h
7 * Copyright (C) 2003, 2004 Ralf Baechle
8 * Copyright (C) 2004 Maciej W. Rozycki
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (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
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25#ifndef __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
26#define __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H
27
28/*
29 * The IDT RC32434 SOC has a built-in MIPS 4Kc core.
30 */
31#define cpu_has_tlb 1
32#define cpu_has_4kex 1
33#define cpu_has_3k_cache 0
34#define cpu_has_4k_cache 1
35#define cpu_has_tx39_cache 0
36#define cpu_has_sb1_cache 0
37#define cpu_has_fpu 0
38#define cpu_has_32fpr 0
39#define cpu_has_counter 1
40#define cpu_has_watch 1
41#define cpu_has_divec 1
42#define cpu_has_vce 0
43#define cpu_has_cache_cdex_p 0
44#define cpu_has_cache_cdex_s 0
45#define cpu_has_prefetch 1
46#define cpu_has_mcheck 1
47#define cpu_has_ejtag 1
48#define cpu_has_llsc 1
49
50#define cpu_has_mips16 0
51#define cpu_has_mdmx 0
52#define cpu_has_mips3d 0
53#define cpu_has_smartmips 0
54
55#define cpu_has_vtag_icache 0
56/* #define cpu_has_dc_aliases ? */
57/* #define cpu_has_ic_fills_f_dc ? */
58/* #define cpu_has_pindexed_dcache ? */
59
60/* #define cpu_icache_snoops_remote_store ? */
61
62#define cpu_has_mips32r1 1
63#define cpu_has_mips32r2 0
64#define cpu_has_mips64r1 0
65#define cpu_has_mips64r2 0
66
67#define cpu_has_dsp 0
68#define cpu_has_mipsmt 0
69
70/* #define cpu_has_nofpuex ? */
71#define cpu_has_64bits 0
72#define cpu_has_64bit_zero_reg 0
73#define cpu_has_64bit_gp_regs 0
74#define cpu_has_64bit_addresses 0
75
76#define cpu_has_inclusive_pcaches 0
77
78#define cpu_dcache_line_size() 16
79#define cpu_icache_line_size() 16
80
81#endif /* __ASM_MACH_RC32434_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-rc32434/ddr.h b/include/asm-mips/mach-rc32434/ddr.h
deleted file mode 100644
index 291e2cf9dde0..000000000000
--- a/include/asm-mips/mach-rc32434/ddr.h
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * Definitions for the DDR registers
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#ifndef _ASM_RC32434_DDR_H_
30#define _ASM_RC32434_DDR_H_
31
32#include <asm/mach-rc32434/rb.h>
33
34/* DDR register structure */
35struct ddr_ram {
36 u32 ddrbase;
37 u32 ddrmask;
38 u32 res1;
39 u32 res2;
40 u32 ddrc;
41 u32 ddrabase;
42 u32 ddramask;
43 u32 ddramap;
44 u32 ddrcust;
45 u32 ddrrdc;
46 u32 ddrspare;
47};
48
49#define DDR0_PHYS_ADDR 0x18018000
50
51/* DDR banks masks */
52#define DDR_MASK 0xffff0000
53#define DDR0_BASE_MSK DDR_MASK
54#define DDR1_BASE_MSK DDR_MASK
55
56/* DDR bank0 registers */
57#define RC32434_DDR0_ATA_BIT 5
58#define RC32434_DDR0_ATA_MSK 0x000000E0
59#define RC32434_DDR0_DBW_BIT 8
60#define RC32434_DDR0_DBW_MSK 0x00000100
61#define RC32434_DDR0_WR_BIT 9
62#define RC32434_DDR0_WR_MSK 0x00000600
63#define RC32434_DDR0_PS_BIT 11
64#define RC32434_DDR0_PS_MSK 0x00001800
65#define RC32434_DDR0_DTYPE_BIT 13
66#define RC32434_DDR0_DTYPE_MSK 0x0000e000
67#define RC32434_DDR0_RFC_BIT 16
68#define RC32434_DDR0_RFC_MSK 0x000f0000
69#define RC32434_DDR0_RP_BIT 20
70#define RC32434_DDR0_RP_MSK 0x00300000
71#define RC32434_DDR0_AP_BIT 22
72#define RC32434_DDR0_AP_MSK 0x00400000
73#define RC32434_DDR0_RCD_BIT 23
74#define RC32434_DDR0_RCD_MSK 0x01800000
75#define RC32434_DDR0_CL_BIT 25
76#define RC32434_DDR0_CL_MSK 0x06000000
77#define RC32434_DDR0_DBM_BIT 27
78#define RC32434_DDR0_DBM_MSK 0x08000000
79#define RC32434_DDR0_SDS_BIT 28
80#define RC32434_DDR0_SDS_MSK 0x10000000
81#define RC32434_DDR0_ATP_BIT 29
82#define RC32434_DDR0_ATP_MSK 0x60000000
83#define RC32434_DDR0_RE_BIT 31
84#define RC32434_DDR0_RE_MSK 0x80000000
85
86/* DDR bank C registers */
87#define RC32434_DDRC_MSK(x) BIT_TO_MASK(x)
88#define RC32434_DDRC_CES_BIT 0
89#define RC32434_DDRC_ACE_BIT 1
90
91/* Custom DDR bank registers */
92#define RC32434_DCST_MSK(x) BIT_TO_MASK(x)
93#define RC32434_DCST_CS_BIT 0
94#define RC32434_DCST_CS_MSK 0x00000003
95#define RC32434_DCST_WE_BIT 2
96#define RC32434_DCST_RAS_BIT 3
97#define RC32434_DCST_CAS_BIT 4
98#define RC32434_DSCT_CKE_BIT 5
99#define RC32434_DSCT_BA_BIT 6
100#define RC32434_DSCT_BA_MSK 0x000000c0
101
102/* DDR QSC registers */
103#define RC32434_QSC_DM_BIT 0
104#define RC32434_QSC_DM_MSK 0x00000003
105#define RC32434_QSC_DQSBS_BIT 2
106#define RC32434_QSC_DQSBS_MSK 0x000000fc
107#define RC32434_QSC_DB_BIT 8
108#define RC32434_QSC_DB_MSK 0x00000100
109#define RC32434_QSC_DBSP_BIT 9
110#define RC32434_QSC_DBSP_MSK 0x01fffe00
111#define RC32434_QSC_BDP_BIT 25
112#define RC32434_QSC_BDP_MSK 0x7e000000
113
114/* DDR LLC registers */
115#define RC32434_LLC_EAO_BIT 0
116#define RC32434_LLC_EAO_MSK 0x00000001
117#define RC32434_LLC_EO_BIT 1
118#define RC32434_LLC_EO_MSK 0x0000003e
119#define RC32434_LLC_FS_BIT 6
120#define RC32434_LLC_FS_MSK 0x000000c0
121#define RC32434_LLC_AS_BIT 8
122#define RC32434_LLC_AS_MSK 0x00000700
123#define RC32434_LLC_SP_BIT 11
124#define RC32434_LLC_SP_MSK 0x001ff800
125
126/* DDR LLFC registers */
127#define RC32434_LLFC_MSK(x) BIT_TO_MASK(x)
128#define RC32434_LLFC_MEN_BIT 0
129#define RC32434_LLFC_EAN_BIT 1
130#define RC32434_LLFC_FF_BIT 2
131
132/* DDR DLLTA registers */
133#define RC32434_DLLTA_ADDR_BIT 2
134#define RC32434_DLLTA_ADDR_MSK 0xfffffffc
135
136/* DDR DLLED registers */
137#define RC32434_DLLED_MSK(x) BIT_TO_MASK(x)
138#define RC32434_DLLED_DBE_BIT 0
139#define RC32434_DLLED_DTE_BIT 1
140
141#endif /* _ASM_RC32434_DDR_H_ */
diff --git a/include/asm-mips/mach-rc32434/dma.h b/include/asm-mips/mach-rc32434/dma.h
deleted file mode 100644
index 5f898b5873f7..000000000000
--- a/include/asm-mips/mach-rc32434/dma.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * Copyright 2002 Integrated Device Technology, Inc.
3 * All rights reserved.
4 *
5 * DMA register definition.
6 *
7 * Author : ryan.holmQVist@idt.com
8 * Date : 20011005
9 */
10
11#ifndef __ASM_RC32434_DMA_H
12#define __ASM_RC32434_DMA_H
13
14#include <asm/mach-rc32434/rb.h>
15
16#define DMA0_BASE_ADDR 0x18040000
17
18/*
19 * DMA descriptor (in physical memory).
20 */
21
22struct dma_desc {
23 u32 control; /* Control. use DMAD_* */
24 u32 ca; /* Current Address. */
25 u32 devcs; /* Device control and status. */
26 u32 link; /* Next descriptor in chain. */
27};
28
29#define DMA_DESC_SIZ sizeof(struct dma_desc)
30#define DMA_DESC_COUNT_BIT 0
31#define DMA_DESC_COUNT_MSK 0x0003ffff
32#define DMA_DESC_DS_BIT 20
33#define DMA_DESC_DS_MSK 0x00300000
34
35#define DMA_DESC_DEV_CMD_BIT 22
36#define DMA_DESC_DEV_CMD_MSK 0x01c00000
37
38/* DMA command sizes */
39#define DMA_DESC_DEV_CMD_BYTE 0
40#define DMA_DESC_DEV_CMD_HLF_WD 1
41#define DMA_DESC_DEV_CMD_WORD 2
42#define DMA_DESC_DEV_CMD_2WORDS 3
43#define DMA_DESC_DEV_CMD_4WORDS 4
44#define DMA_DESC_DEV_CMD_6WORDS 5
45#define DMA_DESC_DEV_CMD_8WORDS 6
46#define DMA_DESC_DEV_CMD_16WORDS 7
47
48/* DMA descriptors interrupts */
49#define DMA_DESC_COF (1 << 25) /* Chain on finished */
50#define DMA_DESC_COD (1 << 26) /* Chain on done */
51#define DMA_DESC_IOF (1 << 27) /* Interrupt on finished */
52#define DMA_DESC_IOD (1 << 28) /* Interrupt on done */
53#define DMA_DESC_TERM (1 << 29) /* Terminated */
54#define DMA_DESC_DONE (1 << 30) /* Done */
55#define DMA_DESC_FINI (1 << 31) /* Finished */
56
57/*
58 * DMA register (within Internal Register Map).
59 */
60
61struct dma_reg {
62 u32 dmac; /* Control. */
63 u32 dmas; /* Status. */
64 u32 dmasm; /* Mask. */
65 u32 dmadptr; /* Descriptor pointer. */
66 u32 dmandptr; /* Next descriptor pointer. */
67};
68
69/* DMA channels specific registers */
70#define DMA_CHAN_RUN_BIT (1 << 0)
71#define DMA_CHAN_DONE_BIT (1 << 1)
72#define DMA_CHAN_MODE_BIT (1 << 2)
73#define DMA_CHAN_MODE_MSK 0x0000000c
74#define DMA_CHAN_MODE_AUTO 0
75#define DMA_CHAN_MODE_BURST 1
76#define DMA_CHAN_MODE_XFRT 2
77#define DMA_CHAN_MODE_RSVD 3
78#define DMA_CHAN_ACT_BIT (1 << 4)
79
80/* DMA status registers */
81#define DMA_STAT_FINI (1 << 0)
82#define DMA_STAT_DONE (1 << 1)
83#define DMA_STAT_CHAIN (1 << 2)
84#define DMA_STAT_ERR (1 << 3)
85#define DMA_STAT_HALT (1 << 4)
86
87/*
88 * DMA channel definitions
89 */
90
91#define DMA_CHAN_ETH_RCV 0
92#define DMA_CHAN_ETH_XMT 1
93#define DMA_CHAN_MEM_TO_FIFO 2
94#define DMA_CHAN_FIFO_TO_MEM 3
95#define DMA_CHAN_PCI_TO_MEM 4
96#define DMA_CHAN_MEM_TO_PCI 5
97#define DMA_CHAN_COUNT 6
98
99struct dma_channel {
100 struct dma_reg ch[DMA_CHAN_COUNT];
101};
102
103#endif /* __ASM_RC32434_DMA_H */
diff --git a/include/asm-mips/mach-rc32434/dma_v.h b/include/asm-mips/mach-rc32434/dma_v.h
deleted file mode 100644
index 173a9f9146cd..000000000000
--- a/include/asm-mips/mach-rc32434/dma_v.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright 2002 Integrated Device Technology, Inc.
3 * All rights reserved.
4 *
5 * DMA register definition.
6 *
7 * Author : ryan.holmQVist@idt.com
8 * Date : 20011005
9 */
10
11#ifndef _ASM_RC32434_DMA_V_H_
12#define _ASM_RC32434_DMA_V_H_
13
14#include <asm/mach-rc32434/dma.h>
15#include <asm/mach-rc32434/rc32434.h>
16
17#define DMA_CHAN_OFFSET 0x14
18#define IS_DMA_USED(X) (((X) & \
19 (DMA_DESC_FINI | DMA_DESC_DONE | DMA_DESC_TERM)) \
20 != 0)
21#define DMA_COUNT(count) ((count) & DMA_DESC_COUNT_MSK)
22
23#define DMA_HALT_TIMEOUT 500
24
25static inline int rc32434_halt_dma(struct dma_reg *ch)
26{
27 int timeout = 1;
28 if (__raw_readl(&ch->dmac) & DMA_CHAN_RUN_BIT) {
29 __raw_writel(0, &ch->dmac);
30 for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
31 if (__raw_readl(&ch->dmas) & DMA_STAT_HALT) {
32 __raw_writel(0, &ch->dmas);
33 break;
34 }
35 }
36 }
37
38 return timeout ? 0 : 1;
39}
40
41static inline void rc32434_start_dma(struct dma_reg *ch, u32 dma_addr)
42{
43 __raw_writel(0, &ch->dmandptr);
44 __raw_writel(dma_addr, &ch->dmadptr);
45}
46
47static inline void rc32434_chain_dma(struct dma_reg *ch, u32 dma_addr)
48{
49 __raw_writel(dma_addr, &ch->dmandptr);
50}
51
52#endif /* _ASM_RC32434_DMA_V_H_ */
diff --git a/include/asm-mips/mach-rc32434/eth.h b/include/asm-mips/mach-rc32434/eth.h
deleted file mode 100644
index a25cbc56173d..000000000000
--- a/include/asm-mips/mach-rc32434/eth.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * Definitions for the Ethernet registers
3 *
4 * Copyright 2002 Allend Stichter <allen.stichter@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#ifndef __ASM_RC32434_ETH_H
30#define __ASM_RC32434_ETH_H
31
32
33#define ETH0_BASE_ADDR 0x18060000
34
35struct eth_regs {
36 u32 ethintfc;
37 u32 ethfifott;
38 u32 etharc;
39 u32 ethhash0;
40 u32 ethhash1;
41 u32 ethu0[4]; /* Reserved. */
42 u32 ethpfs;
43 u32 ethmcp;
44 u32 eth_u1[10]; /* Reserved. */
45 u32 ethspare;
46 u32 eth_u2[42]; /* Reserved. */
47 u32 ethsal0;
48 u32 ethsah0;
49 u32 ethsal1;
50 u32 ethsah1;
51 u32 ethsal2;
52 u32 ethsah2;
53 u32 ethsal3;
54 u32 ethsah3;
55 u32 ethrbc;
56 u32 ethrpc;
57 u32 ethrupc;
58 u32 ethrfc;
59 u32 ethtbc;
60 u32 ethgpf;
61 u32 eth_u9[50]; /* Reserved. */
62 u32 ethmac1;
63 u32 ethmac2;
64 u32 ethipgt;
65 u32 ethipgr;
66 u32 ethclrt;
67 u32 ethmaxf;
68 u32 eth_u10; /* Reserved. */
69 u32 ethmtest;
70 u32 miimcfg;
71 u32 miimcmd;
72 u32 miimaddr;
73 u32 miimwtd;
74 u32 miimrdd;
75 u32 miimind;
76 u32 eth_u11; /* Reserved. */
77 u32 eth_u12; /* Reserved. */
78 u32 ethcfsa0;
79 u32 ethcfsa1;
80 u32 ethcfsa2;
81};
82
83/* Ethernet interrupt registers */
84#define ETH_INT_FC_EN (1 << 0)
85#define ETH_INT_FC_ITS (1 << 1)
86#define ETH_INT_FC_RIP (1 << 2)
87#define ETH_INT_FC_JAM (1 << 3)
88#define ETH_INT_FC_OVR (1 << 4)
89#define ETH_INT_FC_UND (1 << 5)
90#define ETH_INT_FC_IOC 0x000000c0
91
92/* Ethernet FIFO registers */
93#define ETH_FIFI_TT_TTH_BIT 0
94#define ETH_FIFO_TT_TTH 0x0000007f
95
96/* Ethernet ARC/multicast registers */
97#define ETH_ARC_PRO (1 << 0)
98#define ETH_ARC_AM (1 << 1)
99#define ETH_ARC_AFM (1 << 2)
100#define ETH_ARC_AB (1 << 3)
101
102/* Ethernet SAL registers */
103#define ETH_SAL_BYTE_5 0x000000ff
104#define ETH_SAL_BYTE_4 0x0000ff00
105#define ETH_SAL_BYTE_3 0x00ff0000
106#define ETH_SAL_BYTE_2 0xff000000
107
108/* Ethernet SAH registers */
109#define ETH_SAH_BYTE1 0x000000ff
110#define ETH_SAH_BYTE0 0x0000ff00
111
112/* Ethernet GPF register */
113#define ETH_GPF_PTV 0x0000ffff
114
115/* Ethernet PFG register */
116#define ETH_PFS_PFD (1 << 0)
117
118/* Ethernet CFSA[0-3] registers */
119#define ETH_CFSA0_CFSA4 0x000000ff
120#define ETH_CFSA0_CFSA5 0x0000ff00
121#define ETH_CFSA1_CFSA2 0x000000ff
122#define ETH_CFSA1_CFSA3 0x0000ff00
123#define ETH_CFSA1_CFSA0 0x000000ff
124#define ETH_CFSA1_CFSA1 0x0000ff00
125
126/* Ethernet MAC1 registers */
127#define ETH_MAC1_RE (1 << 0)
128#define ETH_MAC1_PAF (1 << 1)
129#define ETH_MAC1_RFC (1 << 2)
130#define ETH_MAC1_TFC (1 << 3)
131#define ETH_MAC1_LB (1 << 4)
132#define ETH_MAC1_MR (1 << 31)
133
134/* Ethernet MAC2 registers */
135#define ETH_MAC2_FD (1 << 0)
136#define ETH_MAC2_FLC (1 << 1)
137#define ETH_MAC2_HFE (1 << 2)
138#define ETH_MAC2_DC (1 << 3)
139#define ETH_MAC2_CEN (1 << 4)
140#define ETH_MAC2_PE (1 << 5)
141#define ETH_MAC2_VPE (1 << 6)
142#define ETH_MAC2_APE (1 << 7)
143#define ETH_MAC2_PPE (1 << 8)
144#define ETH_MAC2_LPE (1 << 9)
145#define ETH_MAC2_NB (1 << 12)
146#define ETH_MAC2_BP (1 << 13)
147#define ETH_MAC2_ED (1 << 14)
148
149/* Ethernet IPGT register */
150#define ETH_IPGT 0x0000007f
151
152/* Ethernet IPGR registers */
153#define ETH_IPGR_IPGR2 0x0000007f
154#define ETH_IPGR_IPGR1 0x00007f00
155
156/* Ethernet CLRT registers */
157#define ETH_CLRT_MAX_RET 0x0000000f
158#define ETH_CLRT_COL_WIN 0x00003f00
159
160/* Ethernet MAXF register */
161#define ETH_MAXF 0x0000ffff
162
163/* Ethernet test registers */
164#define ETH_TEST_REG (1 << 2)
165#define ETH_MCP_DIV 0x000000ff
166
167/* MII registers */
168#define ETH_MII_CFG_RSVD 0x0000000c
169#define ETH_MII_CMD_RD (1 << 0)
170#define ETH_MII_CMD_SCN (1 << 1)
171#define ETH_MII_REG_ADDR 0x0000001f
172#define ETH_MII_PHY_ADDR 0x00001f00
173#define ETH_MII_WTD_DATA 0x0000ffff
174#define ETH_MII_RDD_DATA 0x0000ffff
175#define ETH_MII_IND_BSY (1 << 0)
176#define ETH_MII_IND_SCN (1 << 1)
177#define ETH_MII_IND_NV (1 << 2)
178
179/*
180 * Values for the DEVCS field of the Ethernet DMA Rx and Tx descriptors.
181 */
182
183#define ETH_RX_FD (1 << 0)
184#define ETH_RX_LD (1 << 1)
185#define ETH_RX_ROK (1 << 2)
186#define ETH_RX_FM (1 << 3)
187#define ETH_RX_MP (1 << 4)
188#define ETH_RX_BP (1 << 5)
189#define ETH_RX_VLT (1 << 6)
190#define ETH_RX_CF (1 << 7)
191#define ETH_RX_OVR (1 << 8)
192#define ETH_RX_CRC (1 << 9)
193#define ETH_RX_CV (1 << 10)
194#define ETH_RX_DB (1 << 11)
195#define ETH_RX_LE (1 << 12)
196#define ETH_RX_LOR (1 << 13)
197#define ETH_RX_CES (1 << 14)
198#define ETH_RX_LEN_BIT 16
199#define ETH_RX_LEN 0xffff0000
200
201#define ETH_TX_FD (1 << 0)
202#define ETH_TX_LD (1 << 1)
203#define ETH_TX_OEN (1 << 2)
204#define ETH_TX_PEN (1 << 3)
205#define ETH_TX_CEN (1 << 4)
206#define ETH_TX_HEN (1 << 5)
207#define ETH_TX_TOK (1 << 6)
208#define ETH_TX_MP (1 << 7)
209#define ETH_TX_BP (1 << 8)
210#define ETH_TX_UND (1 << 9)
211#define ETH_TX_OF (1 << 10)
212#define ETH_TX_ED (1 << 11)
213#define ETH_TX_EC (1 << 12)
214#define ETH_TX_LC (1 << 13)
215#define ETH_TX_TD (1 << 14)
216#define ETH_TX_CRC (1 << 15)
217#define ETH_TX_LE (1 << 16)
218#define ETH_TX_CC 0x001E0000
219
220#endif /* __ASM_RC32434_ETH_H */
diff --git a/include/asm-mips/mach-rc32434/gpio.h b/include/asm-mips/mach-rc32434/gpio.h
deleted file mode 100644
index f946f5f45bbb..000000000000
--- a/include/asm-mips/mach-rc32434/gpio.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * Copyright 2002 Integrated Device Technology, Inc.
3 * All rights reserved.
4 *
5 * GPIO register definition.
6 *
7 * Author : ryan.holmQVist@idt.com
8 * Date : 20011005
9 * Copyright (C) 2001, 2002 Ryan Holm <ryan.holmQVist@idt.com>
10 * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
11 */
12
13#ifndef _RC32434_GPIO_H_
14#define _RC32434_GPIO_H_
15
16#include <linux/types.h>
17
18struct rb532_gpio_reg {
19 u32 gpiofunc; /* GPIO Function Register
20 * gpiofunc[x]==0 bit = gpio
21 * func[x]==1 bit = altfunc
22 */
23 u32 gpiocfg; /* GPIO Configuration Register
24 * gpiocfg[x]==0 bit = input
25 * gpiocfg[x]==1 bit = output
26 */
27 u32 gpiod; /* GPIO Data Register
28 * gpiod[x] read/write gpio pinX status
29 */
30 u32 gpioilevel; /* GPIO Interrupt Status Register
31 * interrupt level (see gpioistat)
32 */
33 u32 gpioistat; /* Gpio Interrupt Status Register
34 * istat[x] = (gpiod[x] == level[x])
35 * cleared in ISR (STICKY bits)
36 */
37 u32 gpionmien; /* GPIO Non-maskable Interrupt Enable Register */
38};
39
40/* UART GPIO signals */
41#define RC32434_UART0_SOUT (1 << 0)
42#define RC32434_UART0_SIN (1 << 1)
43#define RC32434_UART0_RTS (1 << 2)
44#define RC32434_UART0_CTS (1 << 3)
45
46/* M & P bus GPIO signals */
47#define RC32434_MP_BIT_22 (1 << 4)
48#define RC32434_MP_BIT_23 (1 << 5)
49#define RC32434_MP_BIT_24 (1 << 6)
50#define RC32434_MP_BIT_25 (1 << 7)
51
52/* CPU GPIO signals */
53#define RC32434_CPU_GPIO (1 << 8)
54
55/* Reserved GPIO signals */
56#define RC32434_AF_SPARE_6 (1 << 9)
57#define RC32434_AF_SPARE_4 (1 << 10)
58#define RC32434_AF_SPARE_3 (1 << 11)
59#define RC32434_AF_SPARE_2 (1 << 12)
60
61/* PCI messaging unit */
62#define RC32434_PCI_MSU_GPIO (1 << 13)
63
64
65extern void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val);
66extern unsigned get_434_reg(unsigned reg_offs);
67extern void set_latch_u5(unsigned char or_mask, unsigned char nand_mask);
68extern unsigned char get_latch_u5(void);
69
70extern int rb532_gpio_get_value(unsigned gpio);
71extern void rb532_gpio_set_value(unsigned gpio, int value);
72extern int rb532_gpio_direction_input(unsigned gpio);
73extern int rb532_gpio_direction_output(unsigned gpio, int value);
74extern void rb532_gpio_set_int_level(unsigned gpio, int value);
75extern int rb532_gpio_get_int_level(unsigned gpio);
76extern void rb532_gpio_set_int_status(unsigned gpio, int value);
77extern int rb532_gpio_get_int_status(unsigned gpio);
78
79
80/* Wrappers for the arch-neutral GPIO API */
81
82static inline int gpio_request(unsigned gpio, const char *label)
83{
84 /* Not yet implemented */
85 return 0;
86}
87
88static inline void gpio_free(unsigned gpio)
89{
90 /* Not yet implemented */
91}
92
93static inline int gpio_direction_input(unsigned gpio)
94{
95 return rb532_gpio_direction_input(gpio);
96}
97
98static inline int gpio_direction_output(unsigned gpio, int value)
99{
100 return rb532_gpio_direction_output(gpio, value);
101}
102
103static inline int gpio_get_value(unsigned gpio)
104{
105 return rb532_gpio_get_value(gpio);
106}
107
108static inline void gpio_set_value(unsigned gpio, int value)
109{
110 rb532_gpio_set_value(gpio, value);
111}
112
113static inline int gpio_to_irq(unsigned gpio)
114{
115 return gpio;
116}
117
118static inline int irq_to_gpio(unsigned irq)
119{
120 return irq;
121}
122
123/* For cansleep */
124#include <asm-generic/gpio.h>
125
126#endif /* _RC32434_GPIO_H_ */
diff --git a/include/asm-mips/mach-rc32434/integ.h b/include/asm-mips/mach-rc32434/integ.h
deleted file mode 100644
index fa65bc3d8807..000000000000
--- a/include/asm-mips/mach-rc32434/integ.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Definitions for the Watchdog registers
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#ifndef __RC32434_INTEG_H__
30#define __RC32434_INTEG_H__
31
32#include <asm/mach-rc32434/rb.h>
33
34#define INTEG0_BASE_ADDR 0x18030030
35
36struct integ {
37 u32 errcs; /* sticky use ERRCS_ */
38 u32 wtcount; /* Watchdog timer count reg. */
39 u32 wtcompare; /* Watchdog timer timeout value. */
40 u32 wtc; /* Watchdog timer control. use WTC_ */
41};
42
43/* Error counters */
44#define RC32434_ERR_WTO 0
45#define RC32434_ERR_WNE 1
46#define RC32434_ERR_UCW 2
47#define RC32434_ERR_UCR 3
48#define RC32434_ERR_UPW 4
49#define RC32434_ERR_UPR 5
50#define RC32434_ERR_UDW 6
51#define RC32434_ERR_UDR 7
52#define RC32434_ERR_SAE 8
53#define RC32434_ERR_WRE 9
54
55/* Watchdog control bits */
56#define RC32434_WTC_EN 0
57#define RC32434_WTC_TO 1
58
59#endif /* __RC32434_INTEG_H__ */
diff --git a/include/asm-mips/mach-rc32434/irq.h b/include/asm-mips/mach-rc32434/irq.h
deleted file mode 100644
index cb9e4725f5dc..000000000000
--- a/include/asm-mips/mach-rc32434/irq.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_RC32434_IRQ_H
2#define __ASM_RC32434_IRQ_H
3
4#define NR_IRQS 256
5
6#include <asm/mach-generic/irq.h>
7
8#endif /* __ASM_RC32434_IRQ_H */
diff --git a/include/asm-mips/mach-rc32434/pci.h b/include/asm-mips/mach-rc32434/pci.h
deleted file mode 100644
index 410638f2af74..000000000000
--- a/include/asm-mips/mach-rc32434/pci.h
+++ /dev/null
@@ -1,481 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Copyright 2004 IDT Inc. (rischelp@idt.com)
23 *
24 * Initial Release
25 */
26
27#ifndef _ASM_RC32434_PCI_H_
28#define _ASM_RC32434_PCI_H_
29
30#define epld_mask ((volatile unsigned char *)0xB900000d)
31
32#define PCI0_BASE_ADDR 0x18080000
33#define PCI_LBA_COUNT 4
34
35struct pci_map {
36 u32 address; /* Address. */
37 u32 control; /* Control. */
38 u32 mapping; /* mapping. */
39};
40
41struct pci_reg {
42 u32 pcic;
43 u32 pcis;
44 u32 pcism;
45 u32 pcicfga;
46 u32 pcicfgd;
47 volatile struct pci_map pcilba[PCI_LBA_COUNT];
48 u32 pcidac;
49 u32 pcidas;
50 u32 pcidasm;
51 u32 pcidad;
52 u32 pcidma8c;
53 u32 pcidma9c;
54 u32 pcitc;
55};
56
57#define PCI_MSU_COUNT 2
58
59struct pci_msu {
60 u32 pciim[PCI_MSU_COUNT];
61 u32 pciom[PCI_MSU_COUNT];
62 u32 pciid;
63 u32 pciiic;
64 u32 pciiim;
65 u32 pciiod;
66 u32 pciioic;
67 u32 pciioim;
68};
69
70/*
71 * PCI Control Register
72 */
73
74#define PCI_CTL_EN (1 << 0)
75#define PCI_CTL_TNR (1 << 1)
76#define PCI_CTL_SCE (1 << 2)
77#define PCI_CTL_IEN (1 << 3)
78#define PCI_CTL_AAA (1 << 4)
79#define PCI_CTL_EAP (1 << 5)
80#define PCI_CTL_PCIM_BIT 6
81#define PCI_CTL_PCIM 0x000001c0
82
83#define PCI_CTL_PCIM_DIS 0
84#define PCI_CTL_PCIM_TNR 1 /* Satellite - target not ready */
85#define PCI_CTL_PCIM_SUS 2 /* Satellite - suspended CPU. */
86#define PCI_CTL_PCIM_EXT 3 /* Host - external arbiter. */
87#define PCI_CTL PCIM_PRIO 4 /* Host - fixed priority arb. */
88#define PCI_CTL_PCIM_RR 5 /* Host - round robin priority. */
89#define PCI_CTL_PCIM_RSVD6 6
90#define PCI_CTL_PCIM_RSVD7 7
91
92#define PCI_CTL_IGM (1 << 9)
93
94/*
95 * PCI Status Register
96 */
97
98#define PCI_STAT_EED (1 << 0)
99#define PCI_STAT_WR (1 << 1)
100#define PCI_STAT_NMI (1 << 2)
101#define PCI_STAT_II (1 << 3)
102#define PCI_STAT_CWE (1 << 4)
103#define PCI_STAT_CRE (1 << 5)
104#define PCI_STAT_MDPE (1 << 6)
105#define PCI_STAT_STA (1 << 7)
106#define PCI_STAT_RTA (1 << 8)
107#define PCI_STAT_RMA (1 << 9)
108#define PCI_STAT_SSE (1 << 10)
109#define PCI_STAT_OSE (1 << 11)
110#define PCI_STAT_PE (1 << 12)
111#define PCI_STAT_TAE (1 << 13)
112#define PCI_STAT_RLE (1 << 14)
113#define PCI_STAT_BME (1 << 15)
114#define PCI_STAT_PRD (1 << 16)
115#define PCI_STAT_RIP (1 << 17)
116
117/*
118 * PCI Status Mask Register
119 */
120
121#define PCI_STATM_EED PCI_STAT_EED
122#define PCI_STATM_WR PCI_STAT_WR
123#define PCI_STATM_NMI PCI_STAT_NMI
124#define PCI_STATM_II PCI_STAT_II
125#define PCI_STATM_CWE PCI_STAT_CWE
126#define PCI_STATM_CRE PCI_STAT_CRE
127#define PCI_STATM_MDPE PCI_STAT_MDPE
128#define PCI_STATM_STA PCI_STAT_STA
129#define PCI_STATM_RTA PCI_STAT_RTA
130#define PCI_STATM_RMA PCI_STAT_RMA
131#define PCI_STATM_SSE PCI_STAT_SSE
132#define PCI_STATM_OSE PCI_STAT_OSE
133#define PCI_STATM_PE PCI_STAT_PE
134#define PCI_STATM_TAE PCI_STAT_TAE
135#define PCI_STATM_RLE PCI_STAT_RLE
136#define PCI_STATM_BME PCI_STAT_BME
137#define PCI_STATM_PRD PCI_STAT_PRD
138#define PCI_STATM_RIP PCI_STAT_RIP
139
140/*
141 * PCI Configuration Address Register
142 */
143#define PCI_CFGA_REG_BIT 2
144#define PCI_CFGA_REG 0x000000fc
145#define PCI_CFGA_REG_ID (0x00 >> 2) /* use PCFGID */
146#define PCI_CFGA_REG_04 (0x04 >> 2) /* use PCFG04_ */
147#define PCI_CFGA_REG_08 (0x08 >> 2) /* use PCFG08_ */
148#define PCI_CFGA_REG_0C (0x0C >> 2) /* use PCFG0C_ */
149#define PCI_CFGA_REG_PBA0 (0x10 >> 2) /* use PCIPBA_ */
150#define PCI_CFGA_REG_PBA1 (0x14 >> 2) /* use PCIPBA_ */
151#define PCI_CFGA_REG_PBA2 (0x18 >> 2) /* use PCIPBA_ */
152#define PCI_CFGA_REG_PBA3 (0x1c >> 2) /* use PCIPBA_ */
153#define PCI_CFGA_REG_SUBSYS (0x2c >> 2) /* use PCFGSS_ */
154#define PCI_CFGA_REG_3C (0x3C >> 2) /* use PCFG3C_ */
155#define PCI_CFGA_REG_PBBA0C (0x44 >> 2) /* use PCIPBAC_ */
156#define PCI_CFGA_REG_PBA0M (0x48 >> 2)
157#define PCI_CFGA_REG_PBA1C (0x4c >> 2) /* use PCIPBAC_ */
158#define PCI_CFGA_REG_PBA1M (0x50 >> 2)
159#define PCI_CFGA_REG_PBA2C (0x54 >> 2) /* use PCIPBAC_ */
160#define PCI_CFGA_REG_PBA2M (0x58 >> 2)
161#define PCI_CFGA_REG_PBA3C (0x5c >> 2) /* use PCIPBAC_ */
162#define PCI_CFGA_REG_PBA3M (0x60 >> 2)
163#define PCI_CFGA_REG_PMGT (0x64 >> 2)
164#define PCI_CFGA_FUNC_BIT 8
165#define PCI_CFGA_FUNC 0x00000700
166#define PCI_CFGA_DEV_BIT 11
167#define PCI_CFGA_DEV 0x0000f800
168#define PCI_CFGA_DEV_INTERN 0
169#define PCI_CFGA_BUS_BIT 16
170#define PCI CFGA_BUS 0x00ff0000
171#define PCI_CFGA_BUS_TYPE0 0
172#define PCI_CFGA_EN (1 << 31)
173
174/* PCI CFG04 commands */
175#define PCI_CFG04_CMD_IO_ENA (1 << 0)
176#define PCI_CFG04_CMD_MEM_ENA (1 << 1)
177#define PCI_CFG04_CMD_BM_ENA (1 << 2)
178#define PCI_CFG04_CMD_MW_INV (1 << 4)
179#define PCI_CFG04_CMD_PAR_ENA (1 << 6)
180#define PCI_CFG04_CMD_SER_ENA (1 << 8)
181#define PCI_CFG04_CMD_FAST_ENA (1 << 9)
182
183/* PCI CFG04 status fields */
184#define PCI_CFG04_STAT_BIT 16
185#define PCI_CFG04_STAT 0xffff0000
186#define PCI_CFG04_STAT_66_MHZ (1 << 21)
187#define PCI_CFG04_STAT_FBB (1 << 23)
188#define PCI_CFG04_STAT_MDPE (1 << 24)
189#define PCI_CFG04_STAT_DST (1 << 25)
190#define PCI_CFG04_STAT_STA (1 << 27)
191#define PCI_CFG04_STAT_RTA (1 << 28)
192#define PCI_CFG04_STAT_RMA (1 << 29)
193#define PCI_CFG04_STAT_SSE (1 << 30)
194#define PCI_CFG04_STAT_PE (1 << 31)
195
196#define PCI_PBA_MSI (1 << 0)
197#define PCI_PBA_P (1 << 2)
198
199/* PCI PBAC registers */
200#define PCI_PBAC_MSI (1 << 0)
201#define PCI_PBAC_P (1 << 1)
202#define PCI_PBAC_SIZE_BIT 2
203#define PCI_PBAC_SIZE 0x0000007c
204#define PCI_PBAC_SB (1 << 7)
205#define PCI_PBAC_PP (1 << 8)
206#define PCI_PBAC_MR_BIT 9
207#define PCI_PBAC_MR 0x00000600
208#define PCI_PBAC_MR_RD 0
209#define PCI_PBAC_MR_RD_LINE 1
210#define PCI_PBAC_MR_RD_MULT 2
211#define PCI_PBAC_MRL (1 << 11)
212#define PCI_PBAC_MRM (1 << 12)
213#define PCI_PBAC_TRP (1 << 13)
214
215#define PCI_CFG40_TRDY_TIM 0x000000ff
216#define PCI_CFG40_RET_LIM 0x0000ff00
217
218/*
219 * PCI Local Base Address [0|1|2|3] Register
220 */
221
222#define PCI_LBA_BADDR_BIT 0
223#define PCI_LBA_BADDR 0xffffff00
224
225/*
226 * PCI Local Base Address Control Register
227 */
228
229#define PCI_LBAC_MSI (1 << 0)
230#define PCI_LBAC_MSI_MEM 0
231#define PCI_LBAC_MSI_IO 1
232#define PCI_LBAC_SIZE_BIT 2
233#define PCI_LBAC_SIZE 0x0000007c
234#define PCI_LBAC_SB (1 << 7)
235#define PCI_LBAC_RT (1 << 8)
236#define PCI_LBAC_RT_NO_PREF 0
237#define PCI_LBAC_RT_PREF 1
238
239/*
240 * PCI Local Base Address [0|1|2|3] Mapping Register
241 */
242#define PCI_LBAM_MADDR_BIT 8
243#define PCI_LBAM_MADDR 0xffffff00
244
245/*
246 * PCI Decoupled Access Control Register
247 */
248#define PCI_DAC_DEN (1 << 0)
249
250/*
251 * PCI Decoupled Access Status Register
252 */
253#define PCI_DAS_D (1 << 0)
254#define PCI_DAS_B (1 << 1)
255#define PCI_DAS_E (1 << 2)
256#define PCI_DAS_OFE (1 << 3)
257#define PCI_DAS_OFF (1 << 4)
258#define PCI_DAS_IFE (1 << 5)
259#define PCI_DAS_IFF (1 << 6)
260
261/*
262 * PCI DMA Channel 8 Configuration Register
263 */
264#define PCI_DMA8C_MBS_BIT 0
265#define PCI_DMA8C_MBS 0x00000fff /* Maximum Burst Size. */
266#define PCI_DMA8C_OUR (1 << 12)
267
268/*
269 * PCI DMA Channel 9 Configuration Register
270 */
271#define PCI_DMA9C_MBS_BIT 0 /* Maximum Burst Size. */
272#define PCI_DMA9C_MBS 0x00000fff
273
274/*
275 * PCI to Memory(DMA Channel 8) AND Memory to PCI DMA(DMA Channel 9)Descriptors
276 */
277
278#define PCI_DMAD_PT_BIT 22 /* in DEVCMD field (descriptor) */
279#define PCI_DMAD_PT 0x00c00000 /* preferred transaction field */
280/* These are for reads (DMA channel 8) */
281#define PCI_DMAD_DEVCMD_MR 0 /* memory read */
282#define PCI_DMAD_DEVCMD_MRL 1 /* memory read line */
283#define PCI_DMAD_DEVCMD_MRM 2 /* memory read multiple */
284#define PCI_DMAD_DEVCMD_IOR 3 /* I/O read */
285/* These are for writes (DMA channel 9) */
286#define PCI_DMAD_DEVCMD_MW 0 /* memory write */
287#define PCI_DMAD_DEVCMD_MWI 1 /* memory write invalidate */
288#define PCI_DMAD_DEVCMD_IOW 3 /* I/O write */
289
290/* Swap byte field applies to both DMA channel 8 and 9 */
291#define PCI_DMAD_SB (1 << 24) /* swap byte field */
292
293
294/*
295 * PCI Target Control Register
296 */
297
298#define PCI_TC_RTIMER_BIT 0
299#define PCI_TC_RTIMER 0x000000ff
300#define PCI_TC_DTIMER_BIT 8
301#define PCI_TC_DTIMER 0x0000ff00
302#define PCI_TC_RDR (1 << 18)
303#define PCI_TC_DDT (1 << 19)
304
305/*
306 * PCI messaging unit [applies to both inbound and outbound registers ]
307 */
308#define PCI_MSU_M0 (1 << 0)
309#define PCI_MSU_M1 (1 << 1)
310#define PCI_MSU_DB (1 << 2)
311
312#define PCI_MSG_ADDR 0xB8088010
313#define PCI0_ADDR 0xB8080000
314#define rc32434_pci ((struct pci_reg *) PCI0_ADDR)
315#define rc32434_pci_msg ((struct pci_msu *) PCI_MSG_ADDR)
316
317#define PCIM_SHFT 0x6
318#define PCIM_BIT_LEN 0x7
319#define PCIM_H_EA 0x3
320#define PCIM_H_IA_FIX 0x4
321#define PCIM_H_IA_RR 0x5
322#if 0
323#define PCI_ADDR_START 0x13000000
324#endif
325
326#define PCI_ADDR_START 0x50000000
327
328#define CPUTOPCI_MEM_WIN 0x02000000
329#define CPUTOPCI_IO_WIN 0x00100000
330#define PCILBA_SIZE_SHFT 2
331#define PCILBA_SIZE_MASK 0x1F
332#define SIZE_256MB 0x1C
333#define SIZE_128MB 0x1B
334#define SIZE_64MB 0x1A
335#define SIZE_32MB 0x19
336#define SIZE_16MB 0x18
337#define SIZE_4MB 0x16
338#define SIZE_2MB 0x15
339#define SIZE_1MB 0x14
340#define KORINA_CONFIG0_ADDR 0x80000000
341#define KORINA_CONFIG1_ADDR 0x80000004
342#define KORINA_CONFIG2_ADDR 0x80000008
343#define KORINA_CONFIG3_ADDR 0x8000000C
344#define KORINA_CONFIG4_ADDR 0x80000010
345#define KORINA_CONFIG5_ADDR 0x80000014
346#define KORINA_CONFIG6_ADDR 0x80000018
347#define KORINA_CONFIG7_ADDR 0x8000001C
348#define KORINA_CONFIG8_ADDR 0x80000020
349#define KORINA_CONFIG9_ADDR 0x80000024
350#define KORINA_CONFIG10_ADDR 0x80000028
351#define KORINA_CONFIG11_ADDR 0x8000002C
352#define KORINA_CONFIG12_ADDR 0x80000030
353#define KORINA_CONFIG13_ADDR 0x80000034
354#define KORINA_CONFIG14_ADDR 0x80000038
355#define KORINA_CONFIG15_ADDR 0x8000003C
356#define KORINA_CONFIG16_ADDR 0x80000040
357#define KORINA_CONFIG17_ADDR 0x80000044
358#define KORINA_CONFIG18_ADDR 0x80000048
359#define KORINA_CONFIG19_ADDR 0x8000004C
360#define KORINA_CONFIG20_ADDR 0x80000050
361#define KORINA_CONFIG21_ADDR 0x80000054
362#define KORINA_CONFIG22_ADDR 0x80000058
363#define KORINA_CONFIG23_ADDR 0x8000005C
364#define KORINA_CONFIG24_ADDR 0x80000060
365#define KORINA_CONFIG25_ADDR 0x80000064
366#define KORINA_CMD (PCI_CFG04_CMD_IO_ENA | \
367 PCI_CFG04_CMD_MEM_ENA | \
368 PCI_CFG04_CMD_BM_ENA | \
369 PCI_CFG04_CMD_MW_INV | \
370 PCI_CFG04_CMD_PAR_ENA | \
371 PCI_CFG04_CMD_SER_ENA)
372
373#define KORINA_STAT (PCI_CFG04_STAT_MDPE | \
374 PCI_CFG04_STAT_STA | \
375 PCI_CFG04_STAT_RTA | \
376 PCI_CFG04_STAT_RMA | \
377 PCI_CFG04_STAT_SSE | \
378 PCI_CFG04_STAT_PE)
379
380#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)
381
382#define KORINA_REVID 0
383#define KORINA_CLASS_CODE 0
384#define KORINA_CNFG2 ((KORINA_CLASS_CODE<<8) | \
385 KORINA_REVID)
386
387#define KORINA_CACHE_LINE_SIZE 4
388#define KORINA_MASTER_LAT 0x3c
389#define KORINA_HEADER_TYPE 0
390#define KORINA_BIST 0
391
392#define KORINA_CNFG3 ((KORINA_BIST << 24) | \
393 (KORINA_HEADER_TYPE<<16) | \
394 (KORINA_MASTER_LAT<<8) | \
395 KORINA_CACHE_LINE_SIZE)
396
397#define KORINA_BAR0 0x00000008 /* 128 MB Memory */
398#define KORINA_BAR1 0x18800001 /* 1 MB IO */
399#define KORINA_BAR2 0x18000001 /* 2 MB IO window for Korina
400 internal Registers */
401#define KORINA_BAR3 0x48000008 /* Spare 128 MB Memory */
402
403#define KORINA_CNFG4 KORINA_BAR0
404#define KORINA_CNFG5 KORINA_BAR1
405#define KORINA_CNFG6 KORINA_BAR2
406#define KORINA_CNFG7 KORINA_BAR3
407
408#define KORINA_SUBSYS_VENDOR_ID 0x011d
409#define KORINA_SUBSYSTEM_ID 0x0214
410#define KORINA_CNFG8 0
411#define KORINA_CNFG9 0
412#define KORINA_CNFG10 0
413#define KORINA_CNFG11 ((KORINA_SUBSYS_VENDOR_ID<<16) | \
414 KORINA_SUBSYSTEM_ID)
415#define KORINA_INT_LINE 1
416#define KORINA_INT_PIN 1
417#define KORINA_MIN_GNT 8
418#define KORINA_MAX_LAT 0x38
419#define KORINA_CNFG12 0
420#define KORINA_CNFG13 0
421#define KORINA_CNFG14 0
422#define KORINA_CNFG15 ((KORINA_MAX_LAT<<24) | \
423 (KORINA_MIN_GNT<<16) | \
424 (KORINA_INT_PIN<<8) | \
425 KORINA_INT_LINE)
426#define KORINA_RETRY_LIMIT 0x80
427#define KORINA_TRDY_LIMIT 0x80
428#define KORINA_CNFG16 ((KORINA_RETRY_LIMIT<<8) | \
429 KORINA_TRDY_LIMIT)
430#define PCI_PBAxC_R 0x0
431#define PCI_PBAxC_RL 0x1
432#define PCI_PBAxC_RM 0x2
433#define SIZE_SHFT 2
434
435#if defined(__MIPSEB__)
436#define KORINA_PBA0C (PCI_PBAC_MRL | PCI_PBAC_SB | \
437 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
438 PCI_PBAC_PP | \
439 (SIZE_128MB<<SIZE_SHFT) | \
440 PCI_PBAC_P)
441#else
442#define KORINA_PBA0C (PCI_PBAC_MRL | \
443 ((PCI_PBAxC_RM & 0x3) << PCI_PBAC_MR_BIT) | \
444 PCI_PBAC_PP | \
445 (SIZE_128MB<<SIZE_SHFT) | \
446 PCI_PBAC_P)
447#endif
448#define KORINA_CNFG17 KORINA_PBA0C
449#define KORINA_PBA0M 0x0
450#define KORINA_CNFG18 KORINA_PBA0M
451
452#if defined(__MIPSEB__)
453#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | PCI_PBAC_SB | \
454 PCI_PBAC_MSI)
455#else
456#define KORINA_PBA1C ((SIZE_1MB<<SIZE_SHFT) | \
457 PCI_PBAC_MSI)
458#endif
459#define KORINA_CNFG19 KORINA_PBA1C
460#define KORINA_PBA1M 0x0
461#define KORINA_CNFG20 KORINA_PBA1M
462
463#if defined(__MIPSEB__)
464#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | PCI_PBAC_SB | \
465 PCI_PBAC_MSI)
466#else
467#define KORINA_PBA2C ((SIZE_2MB<<SIZE_SHFT) | \
468 PCI_PBAC_MSI)
469#endif
470#define KORINA_CNFG21 KORINA_PBA2C
471#define KORINA_PBA2M 0x18000000
472#define KORINA_CNFG22 KORINA_PBA2M
473#define KORINA_PBA3C 0
474#define KORINA_CNFG23 KORINA_PBA3C
475#define KORINA_PBA3M 0
476#define KORINA_CNFG24 KORINA_PBA3M
477
478#define PCITC_DTIMER_VAL 8
479#define PCITC_RTIMER_VAL 0x10
480
481#endif /* __ASM_RC32434_PCI_H */
diff --git a/include/asm-mips/mach-rc32434/prom.h b/include/asm-mips/mach-rc32434/prom.h
deleted file mode 100644
index 1d66ddcda89a..000000000000
--- a/include/asm-mips/mach-rc32434/prom.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Definitions for the PROM
3 *
4 * Copyright 2002 Ryan Holm <ryan.holmQVist@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#define PROM_ENTRY(x) (0xbfc00000 + ((x) * 8))
30
31#define GPIO_INIT_NOBUTTON ""
32#define GPIO_INIT_BUTTON " 2"
33
34#define SR_NMI 0x00180000
35#define SERIAL_SPEED_ENTRY 0x00000001
36
37#define FREQ_TAG "HZ="
38#define GPIO_TAG "gpio="
39#define KMAC_TAG "kmac="
40#define MEM_TAG "mem="
41#define BOARD_TAG "board="
42
43#define BOARD_RB532 "500"
44#define BOARD_RB532A "500r5"
diff --git a/include/asm-mips/mach-rc32434/rb.h b/include/asm-mips/mach-rc32434/rb.h
deleted file mode 100644
index e0a76e3ffea8..000000000000
--- a/include/asm-mips/mach-rc32434/rb.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * Copyright (C) 2004 IDT Inc.
13 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
14 */
15#ifndef __ASM_RC32434_RB_H
16#define __ASM_RC32434_RB_H
17
18#include <linux/genhd.h>
19
20#define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(0x18000000))
21#define DEV0BASE 0x010000
22#define DEV0MASK 0x010004
23#define DEV0C 0x010008
24#define DEV0T 0x01000C
25#define DEV1BASE 0x010010
26#define DEV1MASK 0x010014
27#define DEV1C 0x010018
28#define DEV1TC 0x01001C
29#define DEV2BASE 0x010020
30#define DEV2MASK 0x010024
31#define DEV2C 0x010028
32#define DEV2TC 0x01002C
33#define DEV3BASE 0x010030
34#define DEV3MASK 0x010034
35#define DEV3C 0x010038
36#define DEV3TC 0x01003C
37#define BTCS 0x010040
38#define BTCOMPARE 0x010044
39#define GPIOBASE 0x050000
40#define GPIOCFG 0x050004
41#define GPIOD 0x050008
42#define GPIOILEVEL 0x05000C
43#define GPIOISTAT 0x050010
44#define GPIONMIEN 0x050014
45#define IMASK6 0x038038
46#define LO_WPX (1 << 0)
47#define LO_ALE (1 << 1)
48#define LO_CLE (1 << 2)
49#define LO_CEX (1 << 3)
50#define LO_FOFF (1 << 5)
51#define LO_SPICS (1 << 6)
52#define LO_ULED (1 << 7)
53
54#define BIT_TO_MASK(x) (1 << x)
55
56struct dev_reg {
57 u32 base;
58 u32 mask;
59 u32 ctl;
60 u32 timing;
61};
62
63struct korina_device {
64 char *name;
65 unsigned char mac[6];
66 struct net_device *dev;
67};
68
69struct cf_device {
70 int gpio_pin;
71 void *dev;
72 struct gendisk *gd;
73};
74
75struct mpmc_device {
76 unsigned char state;
77 spinlock_t lock;
78 void __iomem *base;
79};
80
81#endif /* __ASM_RC32434_RB_H */
diff --git a/include/asm-mips/mach-rc32434/rc32434.h b/include/asm-mips/mach-rc32434/rc32434.h
deleted file mode 100644
index c4a02145104e..000000000000
--- a/include/asm-mips/mach-rc32434/rc32434.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Definitions for IDT RC323434 CPU.
3 */
4
5#ifndef _ASM_RC32434_RC32434_H_
6#define _ASM_RC32434_RC32434_H_
7
8#include <linux/delay.h>
9#include <linux/io.h>
10
11#define RC32434_REG_BASE 0x18000000
12#define RC32434_RST (1 << 15)
13
14#define IDT_CLOCK_MULT 2
15#define MIPS_CPU_TIMER_IRQ 7
16
17/* Interrupt Controller */
18#define IC_GROUP0_PEND (RC32434_REG_BASE + 0x38000)
19#define IC_GROUP0_MASK (RC32434_REG_BASE + 0x38008)
20#define IC_GROUP_OFFSET 0x0C
21
22#define NUM_INTR_GROUPS 5
23
24/* 16550 UARTs */
25#define GROUP0_IRQ_BASE 8 /* GRP2 IRQ numbers start here */
26 /* GRP3 IRQ numbers start here */
27#define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32)
28 /* GRP4 IRQ numbers start here */
29#define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32)
30 /* GRP5 IRQ numbers start here */
31#define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32)
32#define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
33
34
35#ifdef __MIPSEB__
36#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58003)
37#else
38#define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58000)
39#endif
40
41#define RC32434_UART0_IRQ (GROUP3_IRQ_BASE + 0)
42
43/* cpu pipeline flush */
44static inline void rc32434_sync(void)
45{
46 __asm__ volatile ("sync");
47}
48
49static inline void rc32434_sync_udelay(int us)
50{
51 __asm__ volatile ("sync");
52 udelay(us);
53}
54
55static inline void rc32434_sync_delay(int ms)
56{
57 __asm__ volatile ("sync");
58 mdelay(ms);
59}
60
61#endif /* _ASM_RC32434_RC32434_H_ */
diff --git a/include/asm-mips/mach-rc32434/timer.h b/include/asm-mips/mach-rc32434/timer.h
deleted file mode 100644
index e49b1d57a017..000000000000
--- a/include/asm-mips/mach-rc32434/timer.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Definitions for timer registers
3 *
4 * Copyright 2004 Philip Rischel <rischelp@idt.com>
5 * Copyright 2008 Florian Fainelli <florian@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 */
28
29#ifndef __ASM_RC32434_TIMER_H
30#define __ASM_RC32434_TIMER_H
31
32#include <asm/mach-rc32434/rb.h>
33
34#define TIMER0_BASE_ADDR 0x18028000
35#define TIMER_COUNT 3
36
37struct timer_counter {
38 u32 count;
39 u32 compare;
40 u32 ctc; /*use CTC_ */
41};
42
43struct timer {
44 struct timer_counter tim[TIMER_COUNT];
45 u32 rcount; /* use RCOUNT_ */
46 u32 rcompare; /* use RCOMPARE_ */
47 u32 rtc; /* use RTC_ */
48};
49
50#define RC32434_CTC_EN_BIT 0
51#define RC32434_CTC_TO_BIT 1
52
53/* Real time clock registers */
54#define RC32434_RTC_MSK(x) BIT_TO_MASK(x)
55#define RC32434_RTC_CE_BIT 0
56#define RC32434_RTC_TO_BIT 1
57#define RC32434_RTC_RQE_BIT 2
58
59/* Counter registers */
60#define RC32434_RCOUNT_BIT 0
61#define RC32434_RCOUNT_MSK 0x0000ffff
62#define RC32434_RCOMP_BIT 0
63#define RC32434_RCOMP_MSK 0x0000ffff
64
65#endif /* __ASM_RC32434_TIMER_H */
diff --git a/include/asm-mips/mach-rc32434/war.h b/include/asm-mips/mach-rc32434/war.h
deleted file mode 100644
index 3ddf187e98a6..000000000000
--- a/include/asm-mips/mach-rc32434/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_MIPS_WAR_H
9#define __ASM_MIPS_MACH_MIPS_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 1
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_MIPS_WAR_H */
diff --git a/include/asm-mips/mach-rm/cpu-feature-overrides.h b/include/asm-mips/mach-rm/cpu-feature-overrides.h
deleted file mode 100644
index ccf543363537..000000000000
--- a/include/asm-mips/mach-rm/cpu-feature-overrides.h
+++ /dev/null
@@ -1,43 +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, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * SNI RM200 C apparently was only shipped with R4600 V2.0 and R5000 processors.
9 */
10#ifndef __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H
11#define __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H
12
13#include <cpu-feature-overrides.h>
14
15#define cpu_has_tlb 1
16#define cpu_has_4kex 1
17#define cpu_has_4k_cache 1
18#define cpu_has_fpu 1
19#define cpu_has_32fpr 1
20#define cpu_has_counter 1
21#define cpu_has_watch 0
22#define cpu_has_mips16 0
23#define cpu_has_divec 0
24#define cpu_has_cache_cdex_p 1
25#define cpu_has_prefetch 0
26#define cpu_has_mcheck 0
27#define cpu_has_ejtag 0
28#define cpu_has_llsc 1
29#define cpu_has_vtag_icache 0
30#define cpu_has_dc_aliases (PAGE_SIZE < 0x4000)
31#define cpu_has_ic_fills_f_dc 0
32#define cpu_has_dsp 0
33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1
35#define cpu_has_mipsmt 0
36#define cpu_has_userlocal 0
37
38#define cpu_has_mips32r1 0
39#define cpu_has_mips32r2 0
40#define cpu_has_mips64r1 0
41#define cpu_has_mips64r2 0
42
43#endif /* __ASM_MACH_RM200_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-rm/mc146818rtc.h b/include/asm-mips/mach-rm/mc146818rtc.h
deleted file mode 100644
index 145bce096fe9..000000000000
--- a/include/asm-mips/mach-rm/mc146818rtc.h
+++ /dev/null
@@ -1,21 +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) 2004 by Ralf Baechle
7 *
8 * RTC routines for PC style attached Dallas chip with ARC epoch.
9 */
10#ifndef __ASM_MACH_RM_MC146818RTC_H
11#define __ASM_MACH_RM_MC146818RTC_H
12
13#ifdef CONFIG_CPU_BIG_ENDIAN
14#define mc146818_decode_year(year) ((year) < 70 ? (year) + 2000 : (year) + 1900)
15#else
16#define mc146818_decode_year(year) ((year) + 1980)
17#endif
18
19#include_next <mc146818rtc.h>
20
21#endif /* __ASM_MACH_RM_MC146818RTC_H */
diff --git a/include/asm-mips/mach-rm/war.h b/include/asm-mips/mach-rm/war.h
deleted file mode 100644
index 948d3129a114..000000000000
--- a/include/asm-mips/mach-rm/war.h
+++ /dev/null
@@ -1,29 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_RM_WAR_H
9#define __ASM_MIPS_MACH_RM_WAR_H
10
11/*
12 * The RM200C seems to have been shipped only with V2.0 R4600s
13 */
14
15#define R4600_V1_INDEX_ICACHEOP_WAR 0
16#define R4600_V1_HIT_CACHEOP_WAR 0
17#define R4600_V2_HIT_CACHEOP_WAR 1
18#define R5432_CP0_INTERRUPT_WAR 0
19#define BCM1250_M3_WAR 0
20#define SIBYTE_1956_WAR 0
21#define MIPS4K_ICACHE_REFILL_WAR 0
22#define MIPS_CACHE_SYNC_WAR 0
23#define TX49XX_ICACHE_INDEX_INV_WAR 0
24#define RM9000_CDEX_SMP_WAR 0
25#define ICACHE_REFILLS_WORKAROUND_WAR 0
26#define R10000_LLSC_WAR 0
27#define MIPS34K_MISSED_ITLB_WAR 0
28
29#endif /* __ASM_MIPS_MACH_RM_WAR_H */
diff --git a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h b/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
deleted file mode 100644
index 1c1f92415b9a..000000000000
--- a/include/asm-mips/mach-sibyte/cpu-feature-overrides.h
+++ /dev/null
@@ -1,47 +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, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Sibyte are MIPS64 processors wired to a specific configuration
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 1
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 1
22#define cpu_has_ejtag 1
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 1
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_has_mipsmt 0
30#define cpu_has_userlocal 0
31#define cpu_icache_snoops_remote_store 0
32
33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1
35
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 0
38#define cpu_has_mips64r1 1
39#define cpu_has_mips64r2 0
40
41#define cpu_has_inclusive_pcaches 0
42
43#define cpu_dcache_line_size() 32
44#define cpu_icache_line_size() 32
45#define cpu_scache_line_size() 32
46
47#endif /* __ASM_MACH_SIBYTE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-sibyte/war.h b/include/asm-mips/mach-sibyte/war.h
deleted file mode 100644
index 7950ef4f032c..000000000000
--- a/include/asm-mips/mach-sibyte/war.h
+++ /dev/null
@@ -1,37 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_SIBYTE_WAR_H
9#define __ASM_MIPS_MACH_SIBYTE_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15
16#if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \
17 defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
18
19#define BCM1250_M3_WAR 1
20#define SIBYTE_1956_WAR 1
21
22#else
23
24#define BCM1250_M3_WAR 0
25#define SIBYTE_1956_WAR 0
26
27#endif
28
29#define MIPS4K_ICACHE_REFILL_WAR 0
30#define MIPS_CACHE_SYNC_WAR 0
31#define TX49XX_ICACHE_INDEX_INV_WAR 0
32#define RM9000_CDEX_SMP_WAR 0
33#define ICACHE_REFILLS_WORKAROUND_WAR 0
34#define R10000_LLSC_WAR 0
35#define MIPS34K_MISSED_ITLB_WAR 0
36
37#endif /* __ASM_MIPS_MACH_SIBYTE_WAR_H */
diff --git a/include/asm-mips/mach-tx39xx/ioremap.h b/include/asm-mips/mach-tx39xx/ioremap.h
deleted file mode 100644
index 93c6c04ffda3..000000000000
--- a/include/asm-mips/mach-tx39xx/ioremap.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * include/asm-mips/mach-tx39xx/ioremap.h
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
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef __ASM_MACH_TX39XX_IOREMAP_H
10#define __ASM_MACH_TX39XX_IOREMAP_H
11
12#include <linux/types.h>
13
14/*
15 * Allow physical addresses to be fixed up to help peripherals located
16 * outside the low 32-bit range -- generic pass-through version.
17 */
18static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
19{
20 return phys_addr;
21}
22
23static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
24 unsigned long flags)
25{
26#define TXX9_DIRECTMAP_BASE 0xff000000ul
27 if (offset >= TXX9_DIRECTMAP_BASE &&
28 offset < TXX9_DIRECTMAP_BASE + 0xff0000)
29 return (void __iomem *)offset;
30 return NULL;
31}
32
33static inline int plat_iounmap(const volatile void __iomem *addr)
34{
35 return (unsigned long)addr >= TXX9_DIRECTMAP_BASE;
36}
37
38#endif /* __ASM_MACH_TX39XX_IOREMAP_H */
diff --git a/include/asm-mips/mach-tx39xx/mangle-port.h b/include/asm-mips/mach-tx39xx/mangle-port.h
deleted file mode 100644
index ef0b502fd8b7..000000000000
--- a/include/asm-mips/mach-tx39xx/mangle-port.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __ASM_MACH_TX39XX_MANGLE_PORT_H
2#define __ASM_MACH_TX39XX_MANGLE_PORT_H
3
4#if defined(CONFIG_TOSHIBA_JMR3927)
5extern unsigned long (*__swizzle_addr_b)(unsigned long port);
6#define NEEDS_TXX9_SWIZZLE_ADDR_B
7#else
8#define __swizzle_addr_b(port) (port)
9#endif
10#define __swizzle_addr_w(port) (port)
11#define __swizzle_addr_l(port) (port)
12#define __swizzle_addr_q(port) (port)
13
14#define ioswabb(a, x) (x)
15#define __mem_ioswabb(a, x) (x)
16#define ioswabw(a, x) le16_to_cpu(x)
17#define __mem_ioswabw(a, x) (x)
18#define ioswabl(a, x) le32_to_cpu(x)
19#define __mem_ioswabl(a, x) (x)
20#define ioswabq(a, x) le64_to_cpu(x)
21#define __mem_ioswabq(a, x) (x)
22
23#endif /* __ASM_MACH_TX39XX_MANGLE_PORT_H */
diff --git a/include/asm-mips/mach-tx39xx/war.h b/include/asm-mips/mach-tx39xx/war.h
deleted file mode 100644
index 433814616359..000000000000
--- a/include/asm-mips/mach-tx39xx/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_TX39XX_WAR_H
9#define __ASM_MIPS_MACH_TX39XX_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_TX39XX_WAR_H */
diff --git a/include/asm-mips/mach-tx49xx/cpu-feature-overrides.h b/include/asm-mips/mach-tx49xx/cpu-feature-overrides.h
deleted file mode 100644
index 275eaf92c748..000000000000
--- a/include/asm-mips/mach-tx49xx/cpu-feature-overrides.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
2#define __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
3
4#define cpu_has_llsc 1
5#define cpu_has_64bits 1
6#define cpu_has_inclusive_pcaches 0
7
8#define cpu_has_mips16 0
9#define cpu_has_mdmx 0
10#define cpu_has_mips3d 0
11#define cpu_has_smartmips 0
12#define cpu_has_vtag_icache 0
13#define cpu_has_ic_fills_f_dc 0
14#define cpu_has_dsp 0
15#define cpu_has_mipsmt 0
16#define cpu_has_userlocal 0
17
18#define cpu_has_mips32r1 0
19#define cpu_has_mips32r2 0
20#define cpu_has_mips64r1 0
21#define cpu_has_mips64r2 0
22
23#endif /* __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-tx49xx/ioremap.h b/include/asm-mips/mach-tx49xx/ioremap.h
deleted file mode 100644
index 1e7beae72229..000000000000
--- a/include/asm-mips/mach-tx49xx/ioremap.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/asm-mips/mach-tx49xx/ioremap.h
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
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef __ASM_MACH_TX49XX_IOREMAP_H
10#define __ASM_MACH_TX49XX_IOREMAP_H
11
12#include <linux/types.h>
13
14/*
15 * Allow physical addresses to be fixed up to help peripherals located
16 * outside the low 32-bit range -- generic pass-through version.
17 */
18static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
19{
20 return phys_addr;
21}
22
23static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
24 unsigned long flags)
25{
26#ifdef CONFIG_64BIT
27#define TXX9_DIRECTMAP_BASE 0xfff000000ul
28#else
29#define TXX9_DIRECTMAP_BASE 0xff000000ul
30#endif
31 if (offset >= TXX9_DIRECTMAP_BASE &&
32 offset < TXX9_DIRECTMAP_BASE + 0x400000)
33 return (void __iomem *)(unsigned long)(int)offset;
34 return NULL;
35}
36
37static inline int plat_iounmap(const volatile void __iomem *addr)
38{
39 return (unsigned long)addr >=
40 (unsigned long)(int)(TXX9_DIRECTMAP_BASE & 0xffffffff);
41}
42
43#endif /* __ASM_MACH_TX49XX_IOREMAP_H */
diff --git a/include/asm-mips/mach-tx49xx/kmalloc.h b/include/asm-mips/mach-tx49xx/kmalloc.h
deleted file mode 100644
index 913ff196259d..000000000000
--- a/include/asm-mips/mach-tx49xx/kmalloc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_MACH_TX49XX_KMALLOC_H
2#define __ASM_MACH_TX49XX_KMALLOC_H
3
4/*
5 * All happy, no need to define ARCH_KMALLOC_MINALIGN
6 */
7
8#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
diff --git a/include/asm-mips/mach-tx49xx/war.h b/include/asm-mips/mach-tx49xx/war.h
deleted file mode 100644
index 39b5d1177c57..000000000000
--- a/include/asm-mips/mach-tx49xx/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_TX49XX_WAR_H
9#define __ASM_MIPS_MACH_TX49XX_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 1
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_TX49XX_WAR_H */
diff --git a/include/asm-mips/mach-vr41xx/irq.h b/include/asm-mips/mach-vr41xx/irq.h
deleted file mode 100644
index 862058d3f81b..000000000000
--- a/include/asm-mips/mach-vr41xx/irq.h
+++ /dev/null
@@ -1,8 +0,0 @@
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
6#include_next <irq.h>
7
8#endif /* __ASM_MACH_VR41XX_IRQ_H */
diff --git a/include/asm-mips/mach-vr41xx/war.h b/include/asm-mips/mach-vr41xx/war.h
deleted file mode 100644
index 56a38926412a..000000000000
--- a/include/asm-mips/mach-vr41xx/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_VR41XX_WAR_H
9#define __ASM_MIPS_MACH_VR41XX_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_VR41XX_WAR_H */
diff --git a/include/asm-mips/mach-wrppmc/mach-gt64120.h b/include/asm-mips/mach-wrppmc/mach-gt64120.h
deleted file mode 100644
index 83746b84a5ec..000000000000
--- a/include/asm-mips/mach-wrppmc/mach-gt64120.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef __ASM_MIPS_GT64120_H
9#define __ASM_MIPS_GT64120_H
10
11/*
12 * This is the CPU physical memory map of PPMC Board:
13 *
14 * 0x00000000-0x03FFFFFF - 64MB SDRAM (SCS[0]#)
15 * 0x1C000000-0x1C000000 - LED (CS0)
16 * 0x1C800000-0x1C800007 - UART 16550 port (CS1)
17 * 0x1F000000-0x1F000000 - MailBox (CS3)
18 * 0x1FC00000-0x20000000 - 4MB Flash (BOOT CS)
19 */
20
21#define WRPPMC_SDRAM_SCS0_BASE 0x00000000
22#define WRPPMC_SDRAM_SCS0_SIZE 0x04000000
23
24#define WRPPMC_UART16550_BASE 0x1C800000
25#define WRPPMC_UART16550_CLOCK 3686400 /* 3.68MHZ */
26
27#define WRPPMC_LED_BASE 0x1C000000
28#define WRPPMC_MBOX_BASE 0x1F000000
29
30#define WRPPMC_BOOTROM_BASE 0x1FC00000
31#define WRPPMC_BOOTROM_SIZE 0x00400000 /* 4M Flash */
32
33#define WRPPMC_MIPS_TIMER_IRQ 7 /* MIPS compare/count timer interrupt */
34#define WRPPMC_UART16550_IRQ 6
35#define WRPPMC_PCI_INTA_IRQ 3
36
37/*
38 * PCI Bus I/O and Memory resources allocation
39 *
40 * NOTE: We only have PCI_0 hose interface
41 */
42#define GT_PCI_MEM_BASE 0x13000000UL
43#define GT_PCI_MEM_SIZE 0x02000000UL
44#define GT_PCI_IO_BASE 0x11000000UL
45#define GT_PCI_IO_SIZE 0x02000000UL
46
47/*
48 * PCI interrupts will come in on either the INTA or INTD interrupt lines,
49 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
50 * boards, they all either come in on IntD or they all come in on IntA, they
51 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
52 * "requested" interrupt numbers and go through the list whenever we get an
53 * IntA/D.
54 *
55 * Interrupts < 8 are directly wired to the processor; PCI INTA is 8 and
56 * INTD is 11.
57 */
58#define GT_TIMER 4
59#define GT_INTA 2
60#define GT_INTD 5
61
62#ifndef __ASSEMBLY__
63
64/*
65 * GT64120 internal register space base address
66 */
67extern unsigned long gt64120_base;
68
69#define GT64120_BASE (gt64120_base)
70
71/* define WRPPMC_EARLY_DEBUG to enable early output something to UART */
72#undef WRPPMC_EARLY_DEBUG
73
74#ifdef WRPPMC_EARLY_DEBUG
75extern void wrppmc_led_on(int mask);
76extern void wrppmc_led_off(int mask);
77extern void wrppmc_early_printk(const char *fmt, ...);
78#else
79#define wrppmc_early_printk(fmt, ...) do {} while (0)
80#endif /* WRPPMC_EARLY_DEBUG */
81
82#endif /* __ASSEMBLY__ */
83#endif /* __ASM_MIPS_GT64120_H */
diff --git a/include/asm-mips/mach-wrppmc/war.h b/include/asm-mips/mach-wrppmc/war.h
deleted file mode 100644
index ac48629bb1ce..000000000000
--- a/include/asm-mips/mach-wrppmc/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_WRPPMC_WAR_H
9#define __ASM_MIPS_MACH_WRPPMC_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_WRPPMC_WAR_H */
diff --git a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h b/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
deleted file mode 100644
index 470e5e9e10d6..000000000000
--- a/include/asm-mips/mach-yosemite/cpu-feature-overrides.h
+++ /dev/null
@@ -1,47 +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, 04, 07 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
9#define __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H
10
11/*
12 * Momentum Jaguar ATX always has the RM9000 processor.
13 */
14#define cpu_has_watch 1
15#define cpu_has_mips16 0
16#define cpu_has_divec 0
17#define cpu_has_vce 0
18#define cpu_has_cache_cdex_p 0
19#define cpu_has_cache_cdex_s 0
20#define cpu_has_prefetch 1
21#define cpu_has_mcheck 0
22#define cpu_has_ejtag 0
23
24#define cpu_has_llsc 1
25#define cpu_has_vtag_icache 0
26#define cpu_has_dc_aliases 0
27#define cpu_has_ic_fills_f_dc 0
28#define cpu_has_dsp 0
29#define cpu_has_mipsmt 0
30#define cpu_has_userlocal 0
31#define cpu_icache_snoops_remote_store 0
32
33#define cpu_has_nofpuex 0
34#define cpu_has_64bits 1
35
36#define cpu_has_inclusive_pcaches 0
37
38#define cpu_dcache_line_size() 32
39#define cpu_icache_line_size() 32
40#define cpu_scache_line_size() 32
41
42#define cpu_has_mips32r1 0
43#define cpu_has_mips32r2 0
44#define cpu_has_mips64r1 0
45#define cpu_has_mips64r2 0
46
47#endif /* __ASM_MACH_YOSEMITE_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-yosemite/war.h b/include/asm-mips/mach-yosemite/war.h
deleted file mode 100644
index e5c6d53efc86..000000000000
--- a/include/asm-mips/mach-yosemite/war.h
+++ /dev/null
@@ -1,25 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_YOSEMITE_WAR_H
9#define __ASM_MIPS_MACH_YOSEMITE_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 1
21#define ICACHE_REFILLS_WORKAROUND_WAR 1
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_YOSEMITE_WAR_H */
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h
deleted file mode 100644
index cdc379a0a94e..000000000000
--- a/include/asm-mips/mc146818-time.h
+++ /dev/null
@@ -1,119 +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 * Machine dependent access functions for RTC registers.
7 */
8#ifndef __ASM_MC146818_TIME_H
9#define __ASM_MC146818_TIME_H
10
11#include <linux/bcd.h>
12#include <linux/mc146818rtc.h>
13#include <linux/time.h>
14
15/*
16 * For check timing call set_rtc_mmss() 500ms; used in timer interrupt.
17 */
18#define USEC_AFTER 500000
19#define USEC_BEFORE 500000
20
21/*
22 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
23 * called 500 ms after the second nowtime has started, because when
24 * nowtime is written into the registers of the CMOS clock, it will
25 * jump to the next second precisely 500 ms later. Check the Motorola
26 * MC146818A or Dallas DS12887 data sheet for details.
27 *
28 * BUG: This routine does not handle hour overflow properly; it just
29 * sets the minutes. Usually you'll only notice that after reboot!
30 */
31static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
32{
33 int real_seconds, real_minutes, cmos_minutes;
34 unsigned char save_control, save_freq_select;
35 int retval = 0;
36 unsigned long flags;
37
38 spin_lock_irqsave(&rtc_lock, flags);
39 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
40 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
41
42 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */
43 CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
44
45 cmos_minutes = CMOS_READ(RTC_MINUTES);
46 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
47 BCD_TO_BIN(cmos_minutes);
48
49 /*
50 * since we're only adjusting minutes and seconds,
51 * don't interfere with hour overflow. This avoids
52 * messing with unknown time zones but requires your
53 * RTC not to be off by more than 15 minutes
54 */
55 real_seconds = nowtime % 60;
56 real_minutes = nowtime / 60;
57 if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
58 real_minutes += 30; /* correct for half hour time zone */
59 real_minutes %= 60;
60
61 if (abs(real_minutes - cmos_minutes) < 30) {
62 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
63 BIN_TO_BCD(real_seconds);
64 BIN_TO_BCD(real_minutes);
65 }
66 CMOS_WRITE(real_seconds, RTC_SECONDS);
67 CMOS_WRITE(real_minutes, RTC_MINUTES);
68 } else {
69 printk(KERN_WARNING
70 "set_rtc_mmss: can't update from %d to %d\n",
71 cmos_minutes, real_minutes);
72 retval = -1;
73 }
74
75 /* The following flags have to be released exactly in this order,
76 * otherwise the DS12887 (popular MC146818A clone with integrated
77 * battery and quartz) will not reset the oscillator and will not
78 * update precisely 500 ms later. You won't find this mentioned in
79 * the Dallas Semiconductor data sheets, but who believes data
80 * sheets anyway ... -- Markus Kuhn
81 */
82 CMOS_WRITE(save_control, RTC_CONTROL);
83 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
84 spin_unlock_irqrestore(&rtc_lock, flags);
85
86 return retval;
87}
88
89static inline unsigned long mc146818_get_cmos_time(void)
90{
91 unsigned int year, mon, day, hour, min, sec;
92 unsigned long flags;
93
94 spin_lock_irqsave(&rtc_lock, flags);
95
96 do {
97 sec = CMOS_READ(RTC_SECONDS);
98 min = CMOS_READ(RTC_MINUTES);
99 hour = CMOS_READ(RTC_HOURS);
100 day = CMOS_READ(RTC_DAY_OF_MONTH);
101 mon = CMOS_READ(RTC_MONTH);
102 year = CMOS_READ(RTC_YEAR);
103 } while (sec != CMOS_READ(RTC_SECONDS));
104
105 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
106 BCD_TO_BIN(sec);
107 BCD_TO_BIN(min);
108 BCD_TO_BIN(hour);
109 BCD_TO_BIN(day);
110 BCD_TO_BIN(mon);
111 BCD_TO_BIN(year);
112 }
113 spin_unlock_irqrestore(&rtc_lock, flags);
114 year = mc146818_decode_year(year);
115
116 return mktime(year, mon, day, hour, min, sec);
117}
118
119#endif /* __ASM_MC146818_TIME_H */
diff --git a/include/asm-mips/mc146818rtc.h b/include/asm-mips/mc146818rtc.h
deleted file mode 100644
index 68b4da6d520b..000000000000
--- a/include/asm-mips/mc146818rtc.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 * Machine dependent access functions for RTC registers.
7 *
8 * Copyright (C) 1996, 1997, 1998, 2000 Ralf Baechle
9 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_MC146818RTC_H
12#define _ASM_MC146818RTC_H
13
14#include <mc146818rtc.h>
15
16#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-mips/mips-boards/bonito64.h b/include/asm-mips/mips-boards/bonito64.h
deleted file mode 100644
index a0f04bb99c99..000000000000
--- a/include/asm-mips/mips-boards/bonito64.h
+++ /dev/null
@@ -1,436 +0,0 @@
1/*
2 * Bonito Register Map
3 *
4 * This file is the original bonito.h from Algorithmics with minor changes
5 * to fit into linux.
6 *
7 * Copyright (c) 1999 Algorithmics Ltd
8 *
9 * Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2001 MIPS Technologies, Inc. All rights reserved.
11 *
12 * Algorithmics gives permission for anyone to use and modify this file
13 * without any obligation or license condition except that you retain
14 * this copyright message in any source redistribution in whole or part.
15 *
16 */
17
18/* Revision 1.48 autogenerated on 08/17/99 15:20:01 */
19/* This bonito64 version editted from bonito.h Revision 1.48 on 11/09/00 */
20
21#ifndef _ASM_MIPS_BOARDS_BONITO64_H
22#define _ASM_MIPS_BOARDS_BONITO64_H
23
24#ifdef __ASSEMBLY__
25
26/* offsets from base register */
27#define BONITO(x) (x)
28
29#elif defined(CONFIG_LEMOTE_FULONG)
30
31#define BONITO(x) (*(volatile u32 *)((char *)CKSEG1ADDR(BONITO_REG_BASE) + (x)))
32#define BONITO_IRQ_BASE 32
33
34#else
35
36/*
37 * Algorithmics Bonito64 system controller register base.
38 */
39extern unsigned long _pcictrl_bonito;
40extern unsigned long _pcictrl_bonito_pcicfg;
41
42#define BONITO(x) *(volatile u32 *)(_pcictrl_bonito + (x))
43
44#endif /* __ASSEMBLY__ */
45
46
47#define BONITO_BOOT_BASE 0x1fc00000
48#define BONITO_BOOT_SIZE 0x00100000
49#define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1)
50#define BONITO_FLASH_BASE 0x1c000000
51#define BONITO_FLASH_SIZE 0x03000000
52#define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1)
53#define BONITO_SOCKET_BASE 0x1f800000
54#define BONITO_SOCKET_SIZE 0x00400000
55#define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1)
56#define BONITO_REG_BASE 0x1fe00000
57#define BONITO_REG_SIZE 0x00040000
58#define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1)
59#define BONITO_DEV_BASE 0x1ff00000
60#define BONITO_DEV_SIZE 0x00100000
61#define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1)
62#define BONITO_PCILO_BASE 0x10000000
63#define BONITO_PCILO_SIZE 0x0c000000
64#define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1)
65#define BONITO_PCILO0_BASE 0x10000000
66#define BONITO_PCILO1_BASE 0x14000000
67#define BONITO_PCILO2_BASE 0x18000000
68#define BONITO_PCIHI_BASE 0x20000000
69#define BONITO_PCIHI_SIZE 0x20000000
70#define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1)
71#define BONITO_PCIIO_BASE 0x1fd00000
72#define BONITO_PCIIO_SIZE 0x00100000
73#define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1)
74#define BONITO_PCICFG_BASE 0x1fe80000
75#define BONITO_PCICFG_SIZE 0x00080000
76#define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1)
77
78
79/* Bonito Register Bases */
80
81#define BONITO_PCICONFIGBASE 0x00
82#define BONITO_REGBASE 0x100
83
84
85/* PCI Configuration Registers */
86
87#define BONITO_PCI_REG(x) BONITO(BONITO_PCICONFIGBASE + (x))
88#define BONITO_PCIDID BONITO_PCI_REG(0x00)
89#define BONITO_PCICMD BONITO_PCI_REG(0x04)
90#define BONITO_PCICLASS BONITO_PCI_REG(0x08)
91#define BONITO_PCILTIMER BONITO_PCI_REG(0x0c)
92#define BONITO_PCIBASE0 BONITO_PCI_REG(0x10)
93#define BONITO_PCIBASE1 BONITO_PCI_REG(0x14)
94#define BONITO_PCIBASE2 BONITO_PCI_REG(0x18)
95#define BONITO_PCIEXPRBASE BONITO_PCI_REG(0x30)
96#define BONITO_PCIINT BONITO_PCI_REG(0x3c)
97
98#define BONITO_PCICMD_PERR_CLR 0x80000000
99#define BONITO_PCICMD_SERR_CLR 0x40000000
100#define BONITO_PCICMD_MABORT_CLR 0x20000000
101#define BONITO_PCICMD_MTABORT_CLR 0x10000000
102#define BONITO_PCICMD_TABORT_CLR 0x08000000
103#define BONITO_PCICMD_MPERR_CLR 0x01000000
104#define BONITO_PCICMD_PERRRESPEN 0x00000040
105#define BONITO_PCICMD_ASTEPEN 0x00000080
106#define BONITO_PCICMD_SERREN 0x00000100
107#define BONITO_PCILTIMER_BUSLATENCY 0x0000ff00
108#define BONITO_PCILTIMER_BUSLATENCY_SHIFT 8
109
110
111
112
113/* 1. Bonito h/w Configuration */
114/* Power on register */
115
116#define BONITO_BONPONCFG BONITO(BONITO_REGBASE + 0x00)
117
118#define BONITO_BONPONCFG_SYSCONTROLLERRD 0x00040000
119#define BONITO_BONPONCFG_ROMCS1SAMP 0x00020000
120#define BONITO_BONPONCFG_ROMCS0SAMP 0x00010000
121#define BONITO_BONPONCFG_CPUBIGEND 0x00004000
122/* Added by RPF 11-9-00 */
123#define BONITO_BONPONCFG_BURSTORDER 0x00001000
124/* --- */
125#define BONITO_BONPONCFG_CPUPARITY 0x00002000
126#define BONITO_BONPONCFG_CPUTYPE 0x00000007
127#define BONITO_BONPONCFG_CPUTYPE_SHIFT 0
128#define BONITO_BONPONCFG_PCIRESET_OUT 0x00000008
129#define BONITO_BONPONCFG_IS_ARBITER 0x00000010
130#define BONITO_BONPONCFG_ROMBOOT 0x000000c0
131#define BONITO_BONPONCFG_ROMBOOT_SHIFT 6
132
133#define BONITO_BONPONCFG_ROMBOOT_FLASH (0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
134#define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
135#define BONITO_BONPONCFG_ROMBOOT_SDRAM (0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
136#define BONITO_BONPONCFG_ROMBOOT_CPURESET (0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
137
138#define BONITO_BONPONCFG_ROMCS0WIDTH 0x00000100
139#define BONITO_BONPONCFG_ROMCS1WIDTH 0x00000200
140#define BONITO_BONPONCFG_ROMCS0FAST 0x00000400
141#define BONITO_BONPONCFG_ROMCS1FAST 0x00000800
142#define BONITO_BONPONCFG_CONFIG_DIS 0x00000020
143
144
145/* Other Bonito configuration */
146
147#define BONITO_BONGENCFG_OFFSET 0x4
148#define BONITO_BONGENCFG BONITO(BONITO_REGBASE + BONITO_BONGENCFG_OFFSET)
149
150#define BONITO_BONGENCFG_DEBUGMODE 0x00000001
151#define BONITO_BONGENCFG_SNOOPEN 0x00000002
152#define BONITO_BONGENCFG_CPUSELFRESET 0x00000004
153
154#define BONITO_BONGENCFG_FORCE_IRQA 0x00000008
155#define BONITO_BONGENCFG_IRQA_ISOUT 0x00000010
156#define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
157#define BONITO_BONGENCFG_BYTESWAP 0x00000040
158
159#define BONITO_BONGENCFG_UNCACHED 0x00000080
160#define BONITO_BONGENCFG_PREFETCHEN 0x00000100
161#define BONITO_BONGENCFG_WBEHINDEN 0x00000200
162#define BONITO_BONGENCFG_CACHEALG 0x00000c00
163#define BONITO_BONGENCFG_CACHEALG_SHIFT 10
164#define BONITO_BONGENCFG_PCIQUEUE 0x00001000
165#define BONITO_BONGENCFG_CACHESTOP 0x00002000
166#define BONITO_BONGENCFG_MSTRBYTESWAP 0x00004000
167#define BONITO_BONGENCFG_BUSERREN 0x00008000
168#define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
169#define BONITO_BONGENCFG_SHORTCOPYTIMEOUT 0x00020000
170
171/* 2. IO & IDE configuration */
172
173#define BONITO_IODEVCFG BONITO(BONITO_REGBASE + 0x08)
174
175/* 3. IO & IDE configuration */
176
177#define BONITO_SDCFG BONITO(BONITO_REGBASE + 0x0c)
178
179/* 4. PCI address map control */
180
181#define BONITO_PCIMAP BONITO(BONITO_REGBASE + 0x10)
182#define BONITO_PCIMEMBASECFG BONITO(BONITO_REGBASE + 0x14)
183#define BONITO_PCIMAP_CFG BONITO(BONITO_REGBASE + 0x18)
184
185/* 5. ICU & GPIO regs */
186
187/* GPIO Regs - r/w */
188
189#define BONITO_GPIODATA_OFFSET 0x1c
190#define BONITO_GPIODATA BONITO(BONITO_REGBASE + BONITO_GPIODATA_OFFSET)
191#define BONITO_GPIOIE BONITO(BONITO_REGBASE + 0x20)
192
193/* ICU Configuration Regs - r/w */
194
195#define BONITO_INTEDGE BONITO(BONITO_REGBASE + 0x24)
196#define BONITO_INTSTEER BONITO(BONITO_REGBASE + 0x28)
197#define BONITO_INTPOL BONITO(BONITO_REGBASE + 0x2c)
198
199/* ICU Enable Regs - IntEn & IntISR are r/o. */
200
201#define BONITO_INTENSET BONITO(BONITO_REGBASE + 0x30)
202#define BONITO_INTENCLR BONITO(BONITO_REGBASE + 0x34)
203#define BONITO_INTEN BONITO(BONITO_REGBASE + 0x38)
204#define BONITO_INTISR BONITO(BONITO_REGBASE + 0x3c)
205
206/* PCI mail boxes */
207
208#define BONITO_PCIMAIL0_OFFSET 0x40
209#define BONITO_PCIMAIL1_OFFSET 0x44
210#define BONITO_PCIMAIL2_OFFSET 0x48
211#define BONITO_PCIMAIL3_OFFSET 0x4c
212#define BONITO_PCIMAIL0 BONITO(BONITO_REGBASE + 0x40)
213#define BONITO_PCIMAIL1 BONITO(BONITO_REGBASE + 0x44)
214#define BONITO_PCIMAIL2 BONITO(BONITO_REGBASE + 0x48)
215#define BONITO_PCIMAIL3 BONITO(BONITO_REGBASE + 0x4c)
216
217
218/* 6. PCI cache */
219
220#define BONITO_PCICACHECTRL BONITO(BONITO_REGBASE + 0x50)
221#define BONITO_PCICACHETAG BONITO(BONITO_REGBASE + 0x54)
222
223#define BONITO_PCIBADADDR BONITO(BONITO_REGBASE + 0x58)
224#define BONITO_PCIMSTAT BONITO(BONITO_REGBASE + 0x5c)
225
226
227/*
228#define BONITO_PCIRDPOST BONITO(BONITO_REGBASE + 0x60)
229#define BONITO_PCIDATA BONITO(BONITO_REGBASE + 0x64)
230*/
231
232/* 7. IDE DMA & Copier */
233
234#define BONITO_CONFIGBASE 0x000
235#define BONITO_BONITOBASE 0x100
236#define BONITO_LDMABASE 0x200
237#define BONITO_COPBASE 0x300
238#define BONITO_REG_BLOCKMASK 0x300
239
240#define BONITO_LDMACTRL BONITO(BONITO_LDMABASE + 0x0)
241#define BONITO_LDMASTAT BONITO(BONITO_LDMABASE + 0x0)
242#define BONITO_LDMAADDR BONITO(BONITO_LDMABASE + 0x4)
243#define BONITO_LDMAGO BONITO(BONITO_LDMABASE + 0x8)
244#define BONITO_LDMADATA BONITO(BONITO_LDMABASE + 0xc)
245
246#define BONITO_COPCTRL BONITO(BONITO_COPBASE + 0x0)
247#define BONITO_COPSTAT BONITO(BONITO_COPBASE + 0x0)
248#define BONITO_COPPADDR BONITO(BONITO_COPBASE + 0x4)
249#define BONITO_COPDADDR BONITO(BONITO_COPBASE + 0x8)
250#define BONITO_COPGO BONITO(BONITO_COPBASE + 0xc)
251
252
253/* ###### Bit Definitions for individual Registers #### */
254
255/* Gen DMA. */
256
257#define BONITO_IDECOPDADDR_DMA_DADDR 0x0ffffffc
258#define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT 2
259#define BONITO_IDECOPPADDR_DMA_PADDR 0xfffffffc
260#define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT 2
261#define BONITO_IDECOPGO_DMA_SIZE 0x0000fffe
262#define BONITO_IDECOPGO_DMA_SIZE_SHIFT 0
263#define BONITO_IDECOPGO_DMA_WRITE 0x00010000
264#define BONITO_IDECOPGO_DMAWCOUNT 0x000f0000
265#define BONITO_IDECOPGO_DMAWCOUNT_SHIFT 16
266
267#define BONITO_IDECOPCTRL_DMA_STARTBIT 0x80000000
268#define BONITO_IDECOPCTRL_DMA_RSTBIT 0x40000000
269
270/* DRAM - sdCfg */
271
272#define BONITO_SDCFG_AROWBITS 0x00000003
273#define BONITO_SDCFG_AROWBITS_SHIFT 0
274#define BONITO_SDCFG_ACOLBITS 0x0000000c
275#define BONITO_SDCFG_ACOLBITS_SHIFT 2
276#define BONITO_SDCFG_ABANKBIT 0x00000010
277#define BONITO_SDCFG_ASIDES 0x00000020
278#define BONITO_SDCFG_AABSENT 0x00000040
279#define BONITO_SDCFG_AWIDTH64 0x00000080
280
281#define BONITO_SDCFG_BROWBITS 0x00000300
282#define BONITO_SDCFG_BROWBITS_SHIFT 8
283#define BONITO_SDCFG_BCOLBITS 0x00000c00
284#define BONITO_SDCFG_BCOLBITS_SHIFT 10
285#define BONITO_SDCFG_BBANKBIT 0x00001000
286#define BONITO_SDCFG_BSIDES 0x00002000
287#define BONITO_SDCFG_BABSENT 0x00004000
288#define BONITO_SDCFG_BWIDTH64 0x00008000
289
290#define BONITO_SDCFG_EXTRDDATA 0x00010000
291#define BONITO_SDCFG_EXTRASCAS 0x00020000
292#define BONITO_SDCFG_EXTPRECH 0x00040000
293#define BONITO_SDCFG_EXTRASWIDTH 0x00180000
294#define BONITO_SDCFG_EXTRASWIDTH_SHIFT 19
295/* Changed by RPF 11-9-00 */
296#define BONITO_SDCFG_DRAMMODESET 0x00200000
297/* --- */
298#define BONITO_SDCFG_DRAMEXTREGS 0x00400000
299#define BONITO_SDCFG_DRAMPARITY 0x00800000
300/* Added by RPF 11-9-00 */
301#define BONITO_SDCFG_DRAMBURSTLEN 0x03000000
302#define BONITO_SDCFG_DRAMBURSTLEN_SHIFT 24
303#define BONITO_SDCFG_DRAMMODESET_DONE 0x80000000
304/* --- */
305
306/* PCI Cache - pciCacheCtrl */
307
308#define BONITO_PCICACHECTRL_CACHECMD 0x00000007
309#define BONITO_PCICACHECTRL_CACHECMD_SHIFT 0
310#define BONITO_PCICACHECTRL_CACHECMDLINE 0x00000018
311#define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT 3
312#define BONITO_PCICACHECTRL_CMDEXEC 0x00000020
313
314#define BONITO_PCICACHECTRL_IOBCCOH_PRES 0x00000100
315#define BONITO_PCICACHECTRL_IOBCCOH_EN 0x00000200
316#define BONITO_PCICACHECTRL_CPUCOH_PRES 0x00000400
317#define BONITO_PCICACHECTRL_CPUCOH_EN 0x00000800
318
319#define BONITO_IODEVCFG_BUFFBIT_CS0 0x00000001
320#define BONITO_IODEVCFG_SPEEDBIT_CS0 0x00000002
321#define BONITO_IODEVCFG_MOREABITS_CS0 0x00000004
322
323#define BONITO_IODEVCFG_BUFFBIT_CS1 0x00000008
324#define BONITO_IODEVCFG_SPEEDBIT_CS1 0x00000010
325#define BONITO_IODEVCFG_MOREABITS_CS1 0x00000020
326
327#define BONITO_IODEVCFG_BUFFBIT_CS2 0x00000040
328#define BONITO_IODEVCFG_SPEEDBIT_CS2 0x00000080
329#define BONITO_IODEVCFG_MOREABITS_CS2 0x00000100
330
331#define BONITO_IODEVCFG_BUFFBIT_CS3 0x00000200
332#define BONITO_IODEVCFG_SPEEDBIT_CS3 0x00000400
333#define BONITO_IODEVCFG_MOREABITS_CS3 0x00000800
334
335#define BONITO_IODEVCFG_BUFFBIT_IDE 0x00001000
336#define BONITO_IODEVCFG_SPEEDBIT_IDE 0x00002000
337#define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
338#define BONITO_IODEVCFG_MODEBIT_IDE 0x00008000
339#define BONITO_IODEVCFG_DMAON_IDE 0x001f0000
340#define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
341#define BONITO_IODEVCFG_DMAOFF_IDE 0x01e00000
342#define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT 21
343#define BONITO_IODEVCFG_EPROMSPLIT 0x02000000
344/* Added by RPF 11-9-00 */
345#define BONITO_IODEVCFG_CPUCLOCKPERIOD 0xfc000000
346#define BONITO_IODEVCFG_CPUCLOCKPERIOD_SHIFT 26
347/* --- */
348
349/* gpio */
350#define BONITO_GPIO_GPIOW 0x000003ff
351#define BONITO_GPIO_GPIOW_SHIFT 0
352#define BONITO_GPIO_GPIOR 0x01ff0000
353#define BONITO_GPIO_GPIOR_SHIFT 16
354#define BONITO_GPIO_GPINR 0xfe000000
355#define BONITO_GPIO_GPINR_SHIFT 25
356#define BONITO_GPIO_IOW(N) (1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
357#define BONITO_GPIO_IOR(N) (1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
358#define BONITO_GPIO_INR(N) (1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
359
360/* ICU */
361#define BONITO_ICU_MBOXES 0x0000000f
362#define BONITO_ICU_MBOXES_SHIFT 0
363#define BONITO_ICU_DMARDY 0x00000010
364#define BONITO_ICU_DMAEMPTY 0x00000020
365#define BONITO_ICU_COPYRDY 0x00000040
366#define BONITO_ICU_COPYEMPTY 0x00000080
367#define BONITO_ICU_COPYERR 0x00000100
368#define BONITO_ICU_PCIIRQ 0x00000200
369#define BONITO_ICU_MASTERERR 0x00000400
370#define BONITO_ICU_SYSTEMERR 0x00000800
371#define BONITO_ICU_DRAMPERR 0x00001000
372#define BONITO_ICU_RETRYERR 0x00002000
373#define BONITO_ICU_GPIOS 0x01ff0000
374#define BONITO_ICU_GPIOS_SHIFT 16
375#define BONITO_ICU_GPINS 0x7e000000
376#define BONITO_ICU_GPINS_SHIFT 25
377#define BONITO_ICU_MBOX(N) (1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
378#define BONITO_ICU_GPIO(N) (1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
379#define BONITO_ICU_GPIN(N) (1<<(BONITO_ICU_GPINS_SHIFT+(N)))
380
381/* pcimap */
382
383#define BONITO_PCIMAP_PCIMAP_LO0 0x0000003f
384#define BONITO_PCIMAP_PCIMAP_LO0_SHIFT 0
385#define BONITO_PCIMAP_PCIMAP_LO1 0x00000fc0
386#define BONITO_PCIMAP_PCIMAP_LO1_SHIFT 6
387#define BONITO_PCIMAP_PCIMAP_LO2 0x0003f000
388#define BONITO_PCIMAP_PCIMAP_LO2_SHIFT 12
389#define BONITO_PCIMAP_PCIMAP_2 0x00040000
390#define BONITO_PCIMAP_WIN(WIN, ADDR) ((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
391
392#define BONITO_PCIMAP_WINSIZE (1<<26)
393#define BONITO_PCIMAP_WINOFFSET(ADDR) ((ADDR) & (BONITO_PCIMAP_WINSIZE - 1))
394#define BONITO_PCIMAP_WINBASE(ADDR) ((ADDR) << 26)
395
396/* pcimembaseCfg */
397
398#define BONITO_PCIMEMBASECFG_MASK 0xf0000000
399#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK 0x0000001f
400#define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT 0
401#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS 0x000003e0
402#define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT 5
403#define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED 0x00000400
404#define BONITO_PCIMEMBASECFG_MEMBASE0_IO 0x00000800
405
406#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK 0x0001f000
407#define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT 12
408#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS 0x003e0000
409#define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT 17
410#define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED 0x00400000
411#define BONITO_PCIMEMBASECFG_MEMBASE1_IO 0x00800000
412
413#define BONITO_PCIMEMBASECFG_ASHIFT 23
414#define BONITO_PCIMEMBASECFG_AMASK 0x007fffff
415#define BONITO_PCIMEMBASECFGSIZE(WIN, SIZE) (((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
416#define BONITO_PCIMEMBASECFGBASE(WIN, BASE) (((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
417
418#define BONITO_PCIMEMBASECFG_SIZE(WIN, CFG) (((((~(CFG)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)) << (BONITO_PCIMEMBASECFG_ASHIFT - BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) | BONITO_PCIMEMBASECFG_AMASK)
419
420
421#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
422#define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
423#define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
424
425#define BONITO_PCITOPHYS(WIN, ADDR, CFG) ( \
426 (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG)))) | \
427 (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG)) \
428 )
429
430/* PCICmd */
431
432#define BONITO_PCICMD_MEMEN 0x00000002
433#define BONITO_PCICMD_MSTREN 0x00000004
434
435
436#endif /* _ASM_MIPS_BOARDS_BONITO64_H */
diff --git a/include/asm-mips/mips-boards/generic.h b/include/asm-mips/mips-boards/generic.h
deleted file mode 100644
index 7f0b034dd9a5..000000000000
--- a/include/asm-mips/mips-boards/generic.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Defines of the MIPS boards specific address-MAP, registers, etc.
19 */
20#ifndef __ASM_MIPS_BOARDS_GENERIC_H
21#define __ASM_MIPS_BOARDS_GENERIC_H
22
23#include <asm/addrspace.h>
24#include <asm/byteorder.h>
25#include <asm/mips-boards/bonito64.h>
26
27/*
28 * Display register base.
29 */
30#define ASCII_DISPLAY_WORD_BASE 0x1f000410
31#define ASCII_DISPLAY_POS_BASE 0x1f000418
32
33
34/*
35 * Yamon Prom print address.
36 */
37#define YAMON_PROM_PRINT_ADDR 0x1fc00504
38
39
40/*
41 * Reset register.
42 */
43#define SOFTRES_REG 0x1f000500
44#define GORESET 0x42
45
46/*
47 * Revision register.
48 */
49#define MIPS_REVISION_REG 0x1fc00010
50#define MIPS_REVISION_CORID_QED_RM5261 0
51#define MIPS_REVISION_CORID_CORE_LV 1
52#define MIPS_REVISION_CORID_BONITO64 2
53#define MIPS_REVISION_CORID_CORE_20K 3
54#define MIPS_REVISION_CORID_CORE_FPGA 4
55#define MIPS_REVISION_CORID_CORE_MSC 5
56#define MIPS_REVISION_CORID_CORE_EMUL 6
57#define MIPS_REVISION_CORID_CORE_FPGA2 7
58#define MIPS_REVISION_CORID_CORE_FPGAR2 8
59#define MIPS_REVISION_CORID_CORE_FPGA3 9
60#define MIPS_REVISION_CORID_CORE_24K 10
61#define MIPS_REVISION_CORID_CORE_FPGA4 11
62#define MIPS_REVISION_CORID_CORE_FPGA5 12
63
64/**** Artificial corid defines ****/
65/*
66 * CoreEMUL with Bonito System Controller is treated like a Core20K
67 * CoreEMUL with SOC-it 101 System Controller is treated like a CoreMSC
68 */
69#define MIPS_REVISION_CORID_CORE_EMUL_BON -1
70#define MIPS_REVISION_CORID_CORE_EMUL_MSC -2
71
72#define MIPS_REVISION_CORID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 10) & 0x3f)
73
74extern int mips_revision_corid;
75
76#define MIPS_REVISION_SCON_OTHER 0
77#define MIPS_REVISION_SCON_SOCITSC 1
78#define MIPS_REVISION_SCON_SOCITSCP 2
79
80/* Artificial SCON defines for MIPS_REVISION_SCON_OTHER */
81#define MIPS_REVISION_SCON_UNKNOWN -1
82#define MIPS_REVISION_SCON_GT64120 -2
83#define MIPS_REVISION_SCON_BONITO -3
84#define MIPS_REVISION_SCON_BRTL -4
85#define MIPS_REVISION_SCON_SOCIT -5
86#define MIPS_REVISION_SCON_ROCIT -6
87
88#define MIPS_REVISION_SCONID (((*(volatile u32 *)ioremap(MIPS_REVISION_REG, 4)) >> 24) & 0xff)
89
90extern int mips_revision_sconid;
91
92extern void mips_reboot_setup(void);
93
94#ifdef CONFIG_PCI
95extern void mips_pcibios_init(void);
96#else
97#define mips_pcibios_init() do { } while (0)
98#endif
99
100#ifdef CONFIG_KGDB
101extern void kgdb_config(void);
102#endif
103
104#endif /* __ASM_MIPS_BOARDS_GENERIC_H */
diff --git a/include/asm-mips/mips-boards/launch.h b/include/asm-mips/mips-boards/launch.h
deleted file mode 100644
index d8ae7f95a522..000000000000
--- a/include/asm-mips/mips-boards/launch.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 *
3 */
4
5#ifndef _ASSEMBLER_
6
7struct cpulaunch {
8 unsigned long pc;
9 unsigned long gp;
10 unsigned long sp;
11 unsigned long a0;
12 unsigned long _pad[3]; /* pad to cache line size to avoid thrashing */
13 unsigned long flags;
14};
15
16#else
17
18#define LOG2CPULAUNCH 5
19#define LAUNCH_PC 0
20#define LAUNCH_GP 4
21#define LAUNCH_SP 8
22#define LAUNCH_A0 12
23#define LAUNCH_FLAGS 28
24
25#endif
26
27#define LAUNCH_FREADY 1
28#define LAUNCH_FGO 2
29#define LAUNCH_FGONE 4
30
31#define CPULAUNCH 0x00000f00
32#define NCPULAUNCH 8
33
34/* Polling period in count cycles for secondary CPU's */
35#define LAUNCHPERIOD 10000
diff --git a/include/asm-mips/mips-boards/malta.h b/include/asm-mips/mips-boards/malta.h
deleted file mode 100644
index c1891578fa65..000000000000
--- a/include/asm-mips/mips-boards/malta.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Defines of the Malta board specific address-MAP, registers, etc.
19 */
20#ifndef __ASM_MIPS_BOARDS_MALTA_H
21#define __ASM_MIPS_BOARDS_MALTA_H
22
23#include <asm/addrspace.h>
24#include <asm/io.h>
25#include <asm/mips-boards/msc01_pci.h>
26#include <asm/gt64120.h>
27
28/* Mips interrupt controller found in SOCit variations */
29#define MIPS_MSC01_IC_REG_BASE 0x1bc40000
30#define MIPS_SOCITSC_IC_REG_BASE 0x1ffa0000
31
32/*
33 * Malta I/O ports base address for the Galileo GT64120 and Algorithmics
34 * Bonito system controllers.
35 */
36#define MALTA_GT_PORT_BASE get_gt_port_base(GT_PCI0IOLD_OFS)
37#define MALTA_BONITO_PORT_BASE ((unsigned long)ioremap (0x1fd00000, 0x10000))
38#define MALTA_MSC_PORT_BASE get_msc_port_base(MSC01_PCI_SC2PIOBASL)
39
40static inline unsigned long get_gt_port_base(unsigned long reg)
41{
42 unsigned long addr;
43 addr = GT_READ(reg);
44 return (unsigned long) ioremap (((addr & 0xffff) << 21), 0x10000);
45}
46
47static inline unsigned long get_msc_port_base(unsigned long reg)
48{
49 unsigned long addr;
50 MSC_READ(reg, addr);
51 return (unsigned long) ioremap(addr, 0x10000);
52}
53
54/*
55 * GCMP Specific definitions
56 */
57#define GCMP_BASE_ADDR 0x1fbf8000
58#define GCMP_ADDRSPACE_SZ (256 * 1024)
59
60/*
61 * GIC Specific definitions
62 */
63#define GIC_BASE_ADDR 0x1bdc0000
64#define GIC_ADDRSPACE_SZ (128 * 1024)
65
66/*
67 * MSC01 BIU Specific definitions
68 * FIXME : These should be elsewhere ?
69 */
70#define MSC01_BIU_REG_BASE 0x1bc80000
71#define MSC01_BIU_ADDRSPACE_SZ (256 * 1024)
72#define MSC01_SC_CFG_OFS 0x0110
73#define MSC01_SC_CFG_GICPRES_MSK 0x00000004
74#define MSC01_SC_CFG_GICPRES_SHF 2
75#define MSC01_SC_CFG_GICENA_SHF 3
76
77/*
78 * Malta RTC-device indirect register access.
79 */
80#define MALTA_RTC_ADR_REG 0x70
81#define MALTA_RTC_DAT_REG 0x71
82
83/*
84 * Malta SMSC FDC37M817 Super I/O Controller register.
85 */
86#define SMSC_CONFIG_REG 0x3f0
87#define SMSC_DATA_REG 0x3f1
88
89#define SMSC_CONFIG_DEVNUM 0x7
90#define SMSC_CONFIG_ACTIVATE 0x30
91#define SMSC_CONFIG_ENTER 0x55
92#define SMSC_CONFIG_EXIT 0xaa
93
94#define SMSC_CONFIG_DEVNUM_FLOPPY 0
95
96#define SMSC_CONFIG_ACTIVATE_ENABLE 1
97
98#define SMSC_WRITE(x, a) outb(x, a)
99
100#define MALTA_JMPRS_REG 0x1f000210
101
102#endif /* __ASM_MIPS_BOARDS_MALTA_H */
diff --git a/include/asm-mips/mips-boards/maltaint.h b/include/asm-mips/mips-boards/maltaint.h
deleted file mode 100644
index cea872fc6f5c..000000000000
--- a/include/asm-mips/mips-boards/maltaint.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Defines for the Malta interrupt controller.
23 *
24 */
25#ifndef _MIPS_MALTAINT_H
26#define _MIPS_MALTAINT_H
27
28#include <irq.h>
29
30/*
31 * Interrupts 0..15 are used for Malta ISA compatible interrupts
32 */
33#define MALTA_INT_BASE 0
34
35/* CPU interrupt offsets */
36#define MIPSCPU_INT_SW0 0
37#define MIPSCPU_INT_SW1 1
38#define MIPSCPU_INT_MB0 2
39#define MIPSCPU_INT_I8259A MIPSCPU_INT_MB0
40#define MIPSCPU_INT_MB1 3
41#define MIPSCPU_INT_SMI MIPSCPU_INT_MB1
42#define MIPSCPU_INT_IPI0 MIPSCPU_INT_MB1 /* GIC IPI */
43#define MIPSCPU_INT_MB2 4
44#define MIPSCPU_INT_IPI1 MIPSCPU_INT_MB2 /* GIC IPI */
45#define MIPSCPU_INT_MB3 5
46#define MIPSCPU_INT_COREHI MIPSCPU_INT_MB3
47#define MIPSCPU_INT_MB4 6
48#define MIPSCPU_INT_CORELO MIPSCPU_INT_MB4
49
50/*
51 * Interrupts 64..127 are used for Soc-it Classic interrupts
52 */
53#define MSC01C_INT_BASE 64
54
55/* SOC-it Classic interrupt offsets */
56#define MSC01C_INT_TMR 0
57#define MSC01C_INT_PCI 1
58
59/*
60 * Interrupts 64..127 are used for Soc-it EIC interrupts
61 */
62#define MSC01E_INT_BASE 64
63
64/* SOC-it EIC interrupt offsets */
65#define MSC01E_INT_SW0 1
66#define MSC01E_INT_SW1 2
67#define MSC01E_INT_MB0 3
68#define MSC01E_INT_I8259A MSC01E_INT_MB0
69#define MSC01E_INT_MB1 4
70#define MSC01E_INT_SMI MSC01E_INT_MB1
71#define MSC01E_INT_MB2 5
72#define MSC01E_INT_MB3 6
73#define MSC01E_INT_COREHI MSC01E_INT_MB3
74#define MSC01E_INT_MB4 7
75#define MSC01E_INT_CORELO MSC01E_INT_MB4
76#define MSC01E_INT_TMR 8
77#define MSC01E_INT_PCI 9
78#define MSC01E_INT_PERFCTR 10
79#define MSC01E_INT_CPUCTR 11
80
81/* GIC's Nomenclature for Core Interrupt Pins on the Malta */
82#define GIC_CPU_INT0 0 /* Core Interrupt 2 */
83#define GIC_CPU_INT1 1 /* . */
84#define GIC_CPU_INT2 2 /* . */
85#define GIC_CPU_INT3 3 /* . */
86#define GIC_CPU_INT4 4 /* . */
87#define GIC_CPU_INT5 5 /* Core Interrupt 5 */
88
89#define GIC_EXT_INTR(x) x
90
91/* Dummy data */
92#define X 0xdead
93
94/* External Interrupts used for IPI */
95#define GIC_IPI_EXT_INTR_RESCHED_VPE0 16
96#define GIC_IPI_EXT_INTR_CALLFNC_VPE0 17
97#define GIC_IPI_EXT_INTR_RESCHED_VPE1 18
98#define GIC_IPI_EXT_INTR_CALLFNC_VPE1 19
99#define GIC_IPI_EXT_INTR_RESCHED_VPE2 20
100#define GIC_IPI_EXT_INTR_CALLFNC_VPE2 21
101#define GIC_IPI_EXT_INTR_RESCHED_VPE3 22
102#define GIC_IPI_EXT_INTR_CALLFNC_VPE3 23
103
104#define MIPS_GIC_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
105
106#ifndef __ASSEMBLY__
107extern void maltaint_init(void);
108#endif
109
110#endif /* !(_MIPS_MALTAINT_H) */
diff --git a/include/asm-mips/mips-boards/msc01_pci.h b/include/asm-mips/mips-boards/msc01_pci.h
deleted file mode 100644
index e036b7dd6deb..000000000000
--- a/include/asm-mips/mips-boards/msc01_pci.h
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * PCI Register definitions for the MIPS System Controller.
3 *
4 * Copyright (C) 2002, 2005 MIPS Technologies, Inc. All rights reserved.
5 * Authors: Carsten Langgaard <carstenl@mips.com>
6 * Maciej W. Rozycki <macro@mips.com>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef __ASM_MIPS_BOARDS_MSC01_PCI_H
13#define __ASM_MIPS_BOARDS_MSC01_PCI_H
14
15/*
16 * Register offset addresses
17 */
18
19#define MSC01_PCI_ID_OFS 0x0000
20#define MSC01_PCI_SC2PMBASL_OFS 0x0208
21#define MSC01_PCI_SC2PMMSKL_OFS 0x0218
22#define MSC01_PCI_SC2PMMAPL_OFS 0x0228
23#define MSC01_PCI_SC2PIOBASL_OFS 0x0248
24#define MSC01_PCI_SC2PIOMSKL_OFS 0x0258
25#define MSC01_PCI_SC2PIOMAPL_OFS 0x0268
26#define MSC01_PCI_P2SCMSKL_OFS 0x0308
27#define MSC01_PCI_P2SCMAPL_OFS 0x0318
28#define MSC01_PCI_INTCFG_OFS 0x0600
29#define MSC01_PCI_INTSTAT_OFS 0x0608
30#define MSC01_PCI_CFGADDR_OFS 0x0610
31#define MSC01_PCI_CFGDATA_OFS 0x0618
32#define MSC01_PCI_IACK_OFS 0x0620
33#define MSC01_PCI_HEAD0_OFS 0x2000 /* DevID, VendorID */
34#define MSC01_PCI_HEAD1_OFS 0x2008 /* Status, Command */
35#define MSC01_PCI_HEAD2_OFS 0x2010 /* Class code, RevID */
36#define MSC01_PCI_HEAD3_OFS 0x2018 /* bist, header, latency */
37#define MSC01_PCI_HEAD4_OFS 0x2020 /* BAR 0 */
38#define MSC01_PCI_HEAD5_OFS 0x2028 /* BAR 1 */
39#define MSC01_PCI_HEAD6_OFS 0x2030 /* BAR 2 */
40#define MSC01_PCI_HEAD7_OFS 0x2038 /* BAR 3 */
41#define MSC01_PCI_HEAD8_OFS 0x2040 /* BAR 4 */
42#define MSC01_PCI_HEAD9_OFS 0x2048 /* BAR 5 */
43#define MSC01_PCI_HEAD10_OFS 0x2050 /* CardBus CIS Ptr */
44#define MSC01_PCI_HEAD11_OFS 0x2058 /* SubSystem ID, -VendorID */
45#define MSC01_PCI_HEAD12_OFS 0x2060 /* ROM BAR */
46#define MSC01_PCI_HEAD13_OFS 0x2068 /* Capabilities ptr */
47#define MSC01_PCI_HEAD14_OFS 0x2070 /* reserved */
48#define MSC01_PCI_HEAD15_OFS 0x2078 /* Maxl, ming, intpin, int */
49#define MSC01_PCI_BAR0_OFS 0x2220
50#define MSC01_PCI_CFG_OFS 0x2380
51#define MSC01_PCI_SWAP_OFS 0x2388
52
53
54/*****************************************************************************
55 * Register encodings
56 ****************************************************************************/
57
58#define MSC01_PCI_ID_ID_SHF 16
59#define MSC01_PCI_ID_ID_MSK 0x00ff0000
60#define MSC01_PCI_ID_ID_HOSTBRIDGE 82
61#define MSC01_PCI_ID_MAR_SHF 8
62#define MSC01_PCI_ID_MAR_MSK 0x0000ff00
63#define MSC01_PCI_ID_MIR_SHF 0
64#define MSC01_PCI_ID_MIR_MSK 0x000000ff
65
66#define MSC01_PCI_SC2PMBASL_BAS_SHF 24
67#define MSC01_PCI_SC2PMBASL_BAS_MSK 0xff000000
68
69#define MSC01_PCI_SC2PMMSKL_MSK_SHF 24
70#define MSC01_PCI_SC2PMMSKL_MSK_MSK 0xff000000
71
72#define MSC01_PCI_SC2PMMAPL_MAP_SHF 24
73#define MSC01_PCI_SC2PMMAPL_MAP_MSK 0xff000000
74
75#define MSC01_PCI_SC2PIOBASL_BAS_SHF 24
76#define MSC01_PCI_SC2PIOBASL_BAS_MSK 0xff000000
77
78#define MSC01_PCI_SC2PIOMSKL_MSK_SHF 24
79#define MSC01_PCI_SC2PIOMSKL_MSK_MSK 0xff000000
80
81#define MSC01_PCI_SC2PIOMAPL_MAP_SHF 24
82#define MSC01_PCI_SC2PIOMAPL_MAP_MSK 0xff000000
83
84#define MSC01_PCI_P2SCMSKL_MSK_SHF 24
85#define MSC01_PCI_P2SCMSKL_MSK_MSK 0xff000000
86
87#define MSC01_PCI_P2SCMAPL_MAP_SHF 24
88#define MSC01_PCI_P2SCMAPL_MAP_MSK 0xff000000
89
90#define MSC01_PCI_INTCFG_RST_SHF 10
91#define MSC01_PCI_INTCFG_RST_MSK 0x00000400
92#define MSC01_PCI_INTCFG_RST_BIT 0x00000400
93#define MSC01_PCI_INTCFG_MWE_SHF 9
94#define MSC01_PCI_INTCFG_MWE_MSK 0x00000200
95#define MSC01_PCI_INTCFG_MWE_BIT 0x00000200
96#define MSC01_PCI_INTCFG_DTO_SHF 8
97#define MSC01_PCI_INTCFG_DTO_MSK 0x00000100
98#define MSC01_PCI_INTCFG_DTO_BIT 0x00000100
99#define MSC01_PCI_INTCFG_MA_SHF 7
100#define MSC01_PCI_INTCFG_MA_MSK 0x00000080
101#define MSC01_PCI_INTCFG_MA_BIT 0x00000080
102#define MSC01_PCI_INTCFG_TA_SHF 6
103#define MSC01_PCI_INTCFG_TA_MSK 0x00000040
104#define MSC01_PCI_INTCFG_TA_BIT 0x00000040
105#define MSC01_PCI_INTCFG_RTY_SHF 5
106#define MSC01_PCI_INTCFG_RTY_MSK 0x00000020
107#define MSC01_PCI_INTCFG_RTY_BIT 0x00000020
108#define MSC01_PCI_INTCFG_MWP_SHF 4
109#define MSC01_PCI_INTCFG_MWP_MSK 0x00000010
110#define MSC01_PCI_INTCFG_MWP_BIT 0x00000010
111#define MSC01_PCI_INTCFG_MRP_SHF 3
112#define MSC01_PCI_INTCFG_MRP_MSK 0x00000008
113#define MSC01_PCI_INTCFG_MRP_BIT 0x00000008
114#define MSC01_PCI_INTCFG_SWP_SHF 2
115#define MSC01_PCI_INTCFG_SWP_MSK 0x00000004
116#define MSC01_PCI_INTCFG_SWP_BIT 0x00000004
117#define MSC01_PCI_INTCFG_SRP_SHF 1
118#define MSC01_PCI_INTCFG_SRP_MSK 0x00000002
119#define MSC01_PCI_INTCFG_SRP_BIT 0x00000002
120#define MSC01_PCI_INTCFG_SE_SHF 0
121#define MSC01_PCI_INTCFG_SE_MSK 0x00000001
122#define MSC01_PCI_INTCFG_SE_BIT 0x00000001
123
124#define MSC01_PCI_INTSTAT_RST_SHF 10
125#define MSC01_PCI_INTSTAT_RST_MSK 0x00000400
126#define MSC01_PCI_INTSTAT_RST_BIT 0x00000400
127#define MSC01_PCI_INTSTAT_MWE_SHF 9
128#define MSC01_PCI_INTSTAT_MWE_MSK 0x00000200
129#define MSC01_PCI_INTSTAT_MWE_BIT 0x00000200
130#define MSC01_PCI_INTSTAT_DTO_SHF 8
131#define MSC01_PCI_INTSTAT_DTO_MSK 0x00000100
132#define MSC01_PCI_INTSTAT_DTO_BIT 0x00000100
133#define MSC01_PCI_INTSTAT_MA_SHF 7
134#define MSC01_PCI_INTSTAT_MA_MSK 0x00000080
135#define MSC01_PCI_INTSTAT_MA_BIT 0x00000080
136#define MSC01_PCI_INTSTAT_TA_SHF 6
137#define MSC01_PCI_INTSTAT_TA_MSK 0x00000040
138#define MSC01_PCI_INTSTAT_TA_BIT 0x00000040
139#define MSC01_PCI_INTSTAT_RTY_SHF 5
140#define MSC01_PCI_INTSTAT_RTY_MSK 0x00000020
141#define MSC01_PCI_INTSTAT_RTY_BIT 0x00000020
142#define MSC01_PCI_INTSTAT_MWP_SHF 4
143#define MSC01_PCI_INTSTAT_MWP_MSK 0x00000010
144#define MSC01_PCI_INTSTAT_MWP_BIT 0x00000010
145#define MSC01_PCI_INTSTAT_MRP_SHF 3
146#define MSC01_PCI_INTSTAT_MRP_MSK 0x00000008
147#define MSC01_PCI_INTSTAT_MRP_BIT 0x00000008
148#define MSC01_PCI_INTSTAT_SWP_SHF 2
149#define MSC01_PCI_INTSTAT_SWP_MSK 0x00000004
150#define MSC01_PCI_INTSTAT_SWP_BIT 0x00000004
151#define MSC01_PCI_INTSTAT_SRP_SHF 1
152#define MSC01_PCI_INTSTAT_SRP_MSK 0x00000002
153#define MSC01_PCI_INTSTAT_SRP_BIT 0x00000002
154#define MSC01_PCI_INTSTAT_SE_SHF 0
155#define MSC01_PCI_INTSTAT_SE_MSK 0x00000001
156#define MSC01_PCI_INTSTAT_SE_BIT 0x00000001
157
158#define MSC01_PCI_CFGADDR_BNUM_SHF 16
159#define MSC01_PCI_CFGADDR_BNUM_MSK 0x00ff0000
160#define MSC01_PCI_CFGADDR_DNUM_SHF 11
161#define MSC01_PCI_CFGADDR_DNUM_MSK 0x0000f800
162#define MSC01_PCI_CFGADDR_FNUM_SHF 8
163#define MSC01_PCI_CFGADDR_FNUM_MSK 0x00000700
164#define MSC01_PCI_CFGADDR_RNUM_SHF 2
165#define MSC01_PCI_CFGADDR_RNUM_MSK 0x000000fc
166
167#define MSC01_PCI_CFGDATA_DATA_SHF 0
168#define MSC01_PCI_CFGDATA_DATA_MSK 0xffffffff
169
170/* The defines below are ONLY valid for a MEM bar! */
171#define MSC01_PCI_BAR0_SIZE_SHF 4
172#define MSC01_PCI_BAR0_SIZE_MSK 0xfffffff0
173#define MSC01_PCI_BAR0_P_SHF 3
174#define MSC01_PCI_BAR0_P_MSK 0x00000008
175#define MSC01_PCI_BAR0_P_BIT MSC01_PCI_BAR0_P_MSK
176#define MSC01_PCI_BAR0_D_SHF 1
177#define MSC01_PCI_BAR0_D_MSK 0x00000006
178#define MSC01_PCI_BAR0_T_SHF 0
179#define MSC01_PCI_BAR0_T_MSK 0x00000001
180#define MSC01_PCI_BAR0_T_BIT MSC01_PCI_BAR0_T_MSK
181
182
183#define MSC01_PCI_CFG_RA_SHF 17
184#define MSC01_PCI_CFG_RA_MSK 0x00020000
185#define MSC01_PCI_CFG_RA_BIT MSC01_PCI_CFG_RA_MSK
186#define MSC01_PCI_CFG_G_SHF 16
187#define MSC01_PCI_CFG_G_MSK 0x00010000
188#define MSC01_PCI_CFG_G_BIT MSC01_PCI_CFG_G_MSK
189#define MSC01_PCI_CFG_EN_SHF 15
190#define MSC01_PCI_CFG_EN_MSK 0x00008000
191#define MSC01_PCI_CFG_EN_BIT MSC01_PCI_CFG_EN_MSK
192#define MSC01_PCI_CFG_MAXRTRY_SHF 0
193#define MSC01_PCI_CFG_MAXRTRY_MSK 0x00000fff
194
195#define MSC01_PCI_SWAP_IO_SHF 18
196#define MSC01_PCI_SWAP_IO_MSK 0x000c0000
197#define MSC01_PCI_SWAP_MEM_SHF 16
198#define MSC01_PCI_SWAP_MEM_MSK 0x00030000
199#define MSC01_PCI_SWAP_BAR0_SHF 0
200#define MSC01_PCI_SWAP_BAR0_MSK 0x00000003
201#define MSC01_PCI_SWAP_NOSWAP 0
202#define MSC01_PCI_SWAP_BYTESWAP 1
203
204/*
205 * MIPS System controller PCI register base.
206 *
207 * FIXME - are these macros specific to Malta and co or to the MSC? If the
208 * latter, they should be moved elsewhere.
209 */
210#define MIPS_MSC01_PCI_REG_BASE 0x1bd00000
211#define MIPS_SOCITSC_PCI_REG_BASE 0x1ff10000
212
213extern unsigned long _pcictrl_msc;
214
215#define MSC01_PCI_REG_BASE _pcictrl_msc
216
217#define MSC_WRITE(reg, data) do { *(volatile u32 *)(reg) = data; } while (0)
218#define MSC_READ(reg, data) do { data = *(volatile u32 *)(reg); } while (0)
219
220/*
221 * Registers absolute addresses
222 */
223
224#define MSC01_PCI_ID (MSC01_PCI_REG_BASE + MSC01_PCI_ID_OFS)
225#define MSC01_PCI_SC2PMBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMBASL_OFS)
226#define MSC01_PCI_SC2PMMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMSKL_OFS)
227#define MSC01_PCI_SC2PMMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PMMAPL_OFS)
228#define MSC01_PCI_SC2PIOBASL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOBASL_OFS)
229#define MSC01_PCI_SC2PIOMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMSKL_OFS)
230#define MSC01_PCI_SC2PIOMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_SC2PIOMAPL_OFS)
231#define MSC01_PCI_P2SCMSKL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMSKL_OFS)
232#define MSC01_PCI_P2SCMAPL (MSC01_PCI_REG_BASE + MSC01_PCI_P2SCMAPL_OFS)
233#define MSC01_PCI_INTCFG (MSC01_PCI_REG_BASE + MSC01_PCI_INTCFG_OFS)
234#define MSC01_PCI_INTSTAT (MSC01_PCI_REG_BASE + MSC01_PCI_INTSTAT_OFS)
235#define MSC01_PCI_CFGADDR (MSC01_PCI_REG_BASE + MSC01_PCI_CFGADDR_OFS)
236#define MSC01_PCI_CFGDATA (MSC01_PCI_REG_BASE + MSC01_PCI_CFGDATA_OFS)
237#define MSC01_PCI_IACK (MSC01_PCI_REG_BASE + MSC01_PCI_IACK_OFS)
238#define MSC01_PCI_HEAD0 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD0_OFS)
239#define MSC01_PCI_HEAD1 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD1_OFS)
240#define MSC01_PCI_HEAD2 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD2_OFS)
241#define MSC01_PCI_HEAD3 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD3_OFS)
242#define MSC01_PCI_HEAD4 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD4_OFS)
243#define MSC01_PCI_HEAD5 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD5_OFS)
244#define MSC01_PCI_HEAD6 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD6_OFS)
245#define MSC01_PCI_HEAD7 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD7_OFS)
246#define MSC01_PCI_HEAD8 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD8_OFS)
247#define MSC01_PCI_HEAD9 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD9_OFS)
248#define MSC01_PCI_HEAD10 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD10_OFS)
249#define MSC01_PCI_HEAD11 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
250#define MSC01_PCI_HEAD12 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
251#define MSC01_PCI_HEAD13 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
252#define MSC01_PCI_HEAD14 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
253#define MSC01_PCI_HEAD15 (MSC01_PCI_REG_BASE + MSC01_PCI_HEAD11_OFS)
254#define MSC01_PCI_BAR0 (MSC01_PCI_REG_BASE + MSC01_PCI_BAR0_OFS)
255#define MSC01_PCI_CFG (MSC01_PCI_REG_BASE + MSC01_PCI_CFG_OFS)
256#define MSC01_PCI_SWAP (MSC01_PCI_REG_BASE + MSC01_PCI_SWAP_OFS)
257
258#endif /* __ASM_MIPS_BOARDS_MSC01_PCI_H */
diff --git a/include/asm-mips/mips-boards/piix4.h b/include/asm-mips/mips-boards/piix4.h
deleted file mode 100644
index 2971d60f2e95..000000000000
--- a/include/asm-mips/mips-boards/piix4.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Register definitions for Intel PIIX4 South Bridge Device.
19 */
20#ifndef __ASM_MIPS_BOARDS_PIIX4_H
21#define __ASM_MIPS_BOARDS_PIIX4_H
22
23/************************************************************************
24 * IO register offsets
25 ************************************************************************/
26#define PIIX4_ICTLR1_ICW1 0x20
27#define PIIX4_ICTLR1_ICW2 0x21
28#define PIIX4_ICTLR1_ICW3 0x21
29#define PIIX4_ICTLR1_ICW4 0x21
30#define PIIX4_ICTLR2_ICW1 0xa0
31#define PIIX4_ICTLR2_ICW2 0xa1
32#define PIIX4_ICTLR2_ICW3 0xa1
33#define PIIX4_ICTLR2_ICW4 0xa1
34#define PIIX4_ICTLR1_OCW1 0x21
35#define PIIX4_ICTLR1_OCW2 0x20
36#define PIIX4_ICTLR1_OCW3 0x20
37#define PIIX4_ICTLR1_OCW4 0x20
38#define PIIX4_ICTLR2_OCW1 0xa1
39#define PIIX4_ICTLR2_OCW2 0xa0
40#define PIIX4_ICTLR2_OCW3 0xa0
41#define PIIX4_ICTLR2_OCW4 0xa0
42
43
44/************************************************************************
45 * Register encodings.
46 ************************************************************************/
47#define PIIX4_OCW2_NSEOI (0x1 << 5)
48#define PIIX4_OCW2_SEOI (0x3 << 5)
49#define PIIX4_OCW2_RNSEOI (0x5 << 5)
50#define PIIX4_OCW2_RAEOIS (0x4 << 5)
51#define PIIX4_OCW2_RAEOIC (0x0 << 5)
52#define PIIX4_OCW2_RSEOI (0x7 << 5)
53#define PIIX4_OCW2_SP (0x6 << 5)
54#define PIIX4_OCW2_NOP (0x2 << 5)
55
56#define PIIX4_OCW2_SEL (0x0 << 3)
57
58#define PIIX4_OCW2_ILS_0 0
59#define PIIX4_OCW2_ILS_1 1
60#define PIIX4_OCW2_ILS_2 2
61#define PIIX4_OCW2_ILS_3 3
62#define PIIX4_OCW2_ILS_4 4
63#define PIIX4_OCW2_ILS_5 5
64#define PIIX4_OCW2_ILS_6 6
65#define PIIX4_OCW2_ILS_7 7
66#define PIIX4_OCW2_ILS_8 0
67#define PIIX4_OCW2_ILS_9 1
68#define PIIX4_OCW2_ILS_10 2
69#define PIIX4_OCW2_ILS_11 3
70#define PIIX4_OCW2_ILS_12 4
71#define PIIX4_OCW2_ILS_13 5
72#define PIIX4_OCW2_ILS_14 6
73#define PIIX4_OCW2_ILS_15 7
74
75#define PIIX4_OCW3_SEL (0x1 << 3)
76
77#define PIIX4_OCW3_IRR 0x2
78#define PIIX4_OCW3_ISR 0x3
79
80#endif /* __ASM_MIPS_BOARDS_PIIX4_H */
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h
deleted file mode 100644
index a9db576a9768..000000000000
--- a/include/asm-mips/mips-boards/prom.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * MIPS boards bootprom interface for the Linux kernel.
23 *
24 */
25
26#ifndef _MIPS_PROM_H
27#define _MIPS_PROM_H
28
29extern char *prom_getcmdline(void);
30extern char *prom_getenv(char *name);
31extern void prom_init_cmdline(void);
32extern void prom_meminit(void);
33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
34extern void mips_display_message(const char *str);
35extern void mips_display_word(unsigned int num);
36extern void mips_scroll_message(void);
37extern int get_ethernet_addr(char *ethernet_addr);
38
39/* Memory descriptor management. */
40#define PROM_MAX_PMEMBLOCKS 32
41struct prom_pmemblock {
42 unsigned long base; /* Within KSEG0. */
43 unsigned int size; /* In bytes. */
44 unsigned int type; /* free or prom memory */
45};
46
47#endif /* !(_MIPS_PROM_H) */
diff --git a/include/asm-mips/mips-boards/sim.h b/include/asm-mips/mips-boards/sim.h
deleted file mode 100644
index acb7c2331d98..000000000000
--- a/include/asm-mips/mips-boards/sim.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_MIPS_BOARDS_SIM_H
20#define _ASM_MIPS_BOARDS_SIM_H
21
22#define STATS_ON 1
23#define STATS_OFF 2
24#define STATS_CLEAR 3
25#define STATS_DUMP 4
26#define TRACE_ON 5
27#define TRACE_OFF 6
28
29
30#define simcfg(code) \
31({ \
32 __asm__ __volatile__( \
33 "sltiu $0,$0, %0" \
34 ::"i"(code) \
35 ); \
36})
37
38
39
40#endif
diff --git a/include/asm-mips/mips-boards/simint.h b/include/asm-mips/mips-boards/simint.h
deleted file mode 100644
index 8ef6db76d5c1..000000000000
--- a/include/asm-mips/mips-boards/simint.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 */
17#ifndef _MIPS_SIMINT_H
18#define _MIPS_SIMINT_H
19
20#include <irq.h>
21
22#define SIM_INT_BASE 0
23#define MIPSCPU_INT_MB0 2
24#define MIPS_CPU_TIMER_IRQ 7
25
26
27#define MSC01E_INT_BASE 64
28
29#define MSC01E_INT_CPUCTR 11
30
31#endif
diff --git a/include/asm-mips/mips_mt.h b/include/asm-mips/mips_mt.h
deleted file mode 100644
index ac7935203f89..000000000000
--- a/include/asm-mips/mips_mt.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Definitions and decalrations for MIPS MT support
3 * that are common between SMTC, VSMP, and/or AP/SP
4 * kernel models.
5 */
6#ifndef __ASM_MIPS_MT_H
7#define __ASM_MIPS_MT_H
8
9#include <linux/cpumask.h>
10
11/*
12 * How many VPEs and TCs is Linux allowed to use? 0 means no limit.
13 */
14extern int tclimit;
15extern int vpelimit;
16
17extern cpumask_t mt_fpu_cpumask;
18extern unsigned long mt_fpemul_threshold;
19
20extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
21extern void mips_mt_set_cpuoptions(void);
22
23struct class;
24extern struct class *mt_class;
25
26#endif /* __ASM_MIPS_MT_H */
diff --git a/include/asm-mips/mipsmtregs.h b/include/asm-mips/mipsmtregs.h
deleted file mode 100644
index c9420aa97e32..000000000000
--- a/include/asm-mips/mipsmtregs.h
+++ /dev/null
@@ -1,395 +0,0 @@
1/*
2 * MT regs definitions, follows on from mipsregs.h
3 * Copyright (C) 2004 - 2005 MIPS Technologies, Inc. All rights reserved.
4 * Elizabeth Clarke et. al.
5 *
6 */
7#ifndef _ASM_MIPSMTREGS_H
8#define _ASM_MIPSMTREGS_H
9
10#include <asm/mipsregs.h>
11#include <asm/war.h>
12
13#ifndef __ASSEMBLY__
14
15/*
16 * C macros
17 */
18
19#define read_c0_mvpcontrol() __read_32bit_c0_register($0, 1)
20#define write_c0_mvpcontrol(val) __write_32bit_c0_register($0, 1, val)
21
22#define read_c0_mvpconf0() __read_32bit_c0_register($0, 2)
23#define read_c0_mvpconf1() __read_32bit_c0_register($0, 3)
24
25#define read_c0_vpecontrol() __read_32bit_c0_register($1, 1)
26#define write_c0_vpecontrol(val) __write_32bit_c0_register($1, 1, val)
27
28#define read_c0_vpeconf0() __read_32bit_c0_register($1, 2)
29#define write_c0_vpeconf0(val) __write_32bit_c0_register($1, 2, val)
30
31#define read_c0_tcstatus() __read_32bit_c0_register($2, 1)
32#define write_c0_tcstatus(val) __write_32bit_c0_register($2, 1, val)
33
34#define read_c0_tcbind() __read_32bit_c0_register($2, 2)
35
36#define read_c0_tccontext() __read_32bit_c0_register($2, 5)
37#define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val)
38
39#else /* Assembly */
40/*
41 * Macros for use in assembly language code
42 */
43
44#define CP0_MVPCONTROL $0, 1
45#define CP0_MVPCONF0 $0, 2
46#define CP0_MVPCONF1 $0, 3
47#define CP0_VPECONTROL $1, 1
48#define CP0_VPECONF0 $1, 2
49#define CP0_VPECONF1 $1, 3
50#define CP0_YQMASK $1, 4
51#define CP0_VPESCHEDULE $1, 5
52#define CP0_VPESCHEFBK $1, 6
53#define CP0_TCSTATUS $2, 1
54#define CP0_TCBIND $2, 2
55#define CP0_TCRESTART $2, 3
56#define CP0_TCHALT $2, 4
57#define CP0_TCCONTEXT $2, 5
58#define CP0_TCSCHEDULE $2, 6
59#define CP0_TCSCHEFBK $2, 7
60#define CP0_SRSCONF0 $6, 1
61#define CP0_SRSCONF1 $6, 2
62#define CP0_SRSCONF2 $6, 3
63#define CP0_SRSCONF3 $6, 4
64#define CP0_SRSCONF4 $6, 5
65
66#endif
67
68/* MVPControl fields */
69#define MVPCONTROL_EVP (_ULCAST_(1))
70
71#define MVPCONTROL_VPC_SHIFT 1
72#define MVPCONTROL_VPC (_ULCAST_(1) << MVPCONTROL_VPC_SHIFT)
73
74#define MVPCONTROL_STLB_SHIFT 2
75#define MVPCONTROL_STLB (_ULCAST_(1) << MVPCONTROL_STLB_SHIFT)
76
77
78/* MVPConf0 fields */
79#define MVPCONF0_PTC_SHIFT 0
80#define MVPCONF0_PTC ( _ULCAST_(0xff))
81#define MVPCONF0_PVPE_SHIFT 10
82#define MVPCONF0_PVPE ( _ULCAST_(0xf) << MVPCONF0_PVPE_SHIFT)
83#define MVPCONF0_TCA_SHIFT 15
84#define MVPCONF0_TCA ( _ULCAST_(1) << MVPCONF0_TCA_SHIFT)
85#define MVPCONF0_PTLBE_SHIFT 16
86#define MVPCONF0_PTLBE (_ULCAST_(0x3ff) << MVPCONF0_PTLBE_SHIFT)
87#define MVPCONF0_TLBS_SHIFT 29
88#define MVPCONF0_TLBS (_ULCAST_(1) << MVPCONF0_TLBS_SHIFT)
89#define MVPCONF0_M_SHIFT 31
90#define MVPCONF0_M (_ULCAST_(0x1) << MVPCONF0_M_SHIFT)
91
92
93/* config3 fields */
94#define CONFIG3_MT_SHIFT 2
95#define CONFIG3_MT (_ULCAST_(1) << CONFIG3_MT_SHIFT)
96
97
98/* VPEControl fields (per VPE) */
99#define VPECONTROL_TARGTC (_ULCAST_(0xff))
100
101#define VPECONTROL_TE_SHIFT 15
102#define VPECONTROL_TE (_ULCAST_(1) << VPECONTROL_TE_SHIFT)
103#define VPECONTROL_EXCPT_SHIFT 16
104#define VPECONTROL_EXCPT (_ULCAST_(0x7) << VPECONTROL_EXCPT_SHIFT)
105
106/* Thread Exception Codes for EXCPT field */
107#define THREX_TU 0
108#define THREX_TO 1
109#define THREX_IYQ 2
110#define THREX_GSX 3
111#define THREX_YSCH 4
112#define THREX_GSSCH 5
113
114#define VPECONTROL_GSI_SHIFT 20
115#define VPECONTROL_GSI (_ULCAST_(1) << VPECONTROL_GSI_SHIFT)
116#define VPECONTROL_YSI_SHIFT 21
117#define VPECONTROL_YSI (_ULCAST_(1) << VPECONTROL_YSI_SHIFT)
118
119/* VPEConf0 fields (per VPE) */
120#define VPECONF0_VPA_SHIFT 0
121#define VPECONF0_VPA (_ULCAST_(1) << VPECONF0_VPA_SHIFT)
122#define VPECONF0_MVP_SHIFT 1
123#define VPECONF0_MVP (_ULCAST_(1) << VPECONF0_MVP_SHIFT)
124#define VPECONF0_XTC_SHIFT 21
125#define VPECONF0_XTC (_ULCAST_(0xff) << VPECONF0_XTC_SHIFT)
126
127/* TCStatus fields (per TC) */
128#define TCSTATUS_TASID (_ULCAST_(0xff))
129#define TCSTATUS_IXMT_SHIFT 10
130#define TCSTATUS_IXMT (_ULCAST_(1) << TCSTATUS_IXMT_SHIFT)
131#define TCSTATUS_TKSU_SHIFT 11
132#define TCSTATUS_TKSU (_ULCAST_(3) << TCSTATUS_TKSU_SHIFT)
133#define TCSTATUS_A_SHIFT 13
134#define TCSTATUS_A (_ULCAST_(1) << TCSTATUS_A_SHIFT)
135#define TCSTATUS_DA_SHIFT 15
136#define TCSTATUS_DA (_ULCAST_(1) << TCSTATUS_DA_SHIFT)
137#define TCSTATUS_DT_SHIFT 20
138#define TCSTATUS_DT (_ULCAST_(1) << TCSTATUS_DT_SHIFT)
139#define TCSTATUS_TDS_SHIFT 21
140#define TCSTATUS_TDS (_ULCAST_(1) << TCSTATUS_TDS_SHIFT)
141#define TCSTATUS_TSST_SHIFT 22
142#define TCSTATUS_TSST (_ULCAST_(1) << TCSTATUS_TSST_SHIFT)
143#define TCSTATUS_RNST_SHIFT 23
144#define TCSTATUS_RNST (_ULCAST_(3) << TCSTATUS_RNST_SHIFT)
145/* Codes for RNST */
146#define TC_RUNNING 0
147#define TC_WAITING 1
148#define TC_YIELDING 2
149#define TC_GATED 3
150
151#define TCSTATUS_TMX_SHIFT 27
152#define TCSTATUS_TMX (_ULCAST_(1) << TCSTATUS_TMX_SHIFT)
153/* TCStatus TCU bits can use same definitions/offsets as CU bits in Status */
154
155/* TCBind */
156#define TCBIND_CURVPE_SHIFT 0
157#define TCBIND_CURVPE (_ULCAST_(0xf))
158
159#define TCBIND_CURTC_SHIFT 21
160
161#define TCBIND_CURTC (_ULCAST_(0xff) << TCBIND_CURTC_SHIFT)
162
163/* TCHalt */
164#define TCHALT_H (_ULCAST_(1))
165
166#ifndef __ASSEMBLY__
167
168static inline unsigned int dvpe(void)
169{
170 int res = 0;
171
172 __asm__ __volatile__(
173 " .set push \n"
174 " .set noreorder \n"
175 " .set noat \n"
176 " .set mips32r2 \n"
177 " .word 0x41610001 # dvpe $1 \n"
178 " move %0, $1 \n"
179 " ehb \n"
180 " .set pop \n"
181 : "=r" (res));
182
183 instruction_hazard();
184
185 return res;
186}
187
188static inline void __raw_evpe(void)
189{
190 __asm__ __volatile__(
191 " .set push \n"
192 " .set noreorder \n"
193 " .set noat \n"
194 " .set mips32r2 \n"
195 " .word 0x41600021 # evpe \n"
196 " ehb \n"
197 " .set pop \n");
198}
199
200/* Enable virtual processor execution if previous suggested it should be.
201 EVPE_ENABLE to force */
202
203#define EVPE_ENABLE MVPCONTROL_EVP
204
205static inline void evpe(int previous)
206{
207 if ((previous & MVPCONTROL_EVP))
208 __raw_evpe();
209}
210
211static inline unsigned int dmt(void)
212{
213 int res;
214
215 __asm__ __volatile__(
216 " .set push \n"
217 " .set mips32r2 \n"
218 " .set noat \n"
219 " .word 0x41610BC1 # dmt $1 \n"
220 " ehb \n"
221 " move %0, $1 \n"
222 " .set pop \n"
223 : "=r" (res));
224
225 instruction_hazard();
226
227 return res;
228}
229
230static inline void __raw_emt(void)
231{
232 __asm__ __volatile__(
233 " .set noreorder \n"
234 " .set mips32r2 \n"
235 " .word 0x41600be1 # emt \n"
236 " ehb \n"
237 " .set mips0 \n"
238 " .set reorder");
239}
240
241/* enable multi-threaded execution if previous suggested it should be.
242 EMT_ENABLE to force */
243
244#define EMT_ENABLE VPECONTROL_TE
245
246static inline void emt(int previous)
247{
248 if ((previous & EMT_ENABLE))
249 __raw_emt();
250}
251
252static inline void ehb(void)
253{
254 __asm__ __volatile__(
255 " .set mips32r2 \n"
256 " ehb \n"
257 " .set mips0 \n");
258}
259
260#define mftc0(rt,sel) \
261({ \
262 unsigned long __res; \
263 \
264 __asm__ __volatile__( \
265 " .set push \n" \
266 " .set mips32r2 \n" \
267 " .set noat \n" \
268 " # mftc0 $1, $" #rt ", " #sel " \n" \
269 " .word 0x41000800 | (" #rt " << 16) | " #sel " \n" \
270 " move %0, $1 \n" \
271 " .set pop \n" \
272 : "=r" (__res)); \
273 \
274 __res; \
275})
276
277#define mftgpr(rt) \
278({ \
279 unsigned long __res; \
280 \
281 __asm__ __volatile__( \
282 " .set push \n" \
283 " .set noat \n" \
284 " .set mips32r2 \n" \
285 " # mftgpr $1," #rt " \n" \
286 " .word 0x41000820 | (" #rt " << 16) \n" \
287 " move %0, $1 \n" \
288 " .set pop \n" \
289 : "=r" (__res)); \
290 \
291 __res; \
292})
293
294#define mftr(rt, u, sel) \
295({ \
296 unsigned long __res; \
297 \
298 __asm__ __volatile__( \
299 " mftr %0, " #rt ", " #u ", " #sel " \n" \
300 : "=r" (__res)); \
301 \
302 __res; \
303})
304
305#define mttgpr(rd,v) \
306do { \
307 __asm__ __volatile__( \
308 " .set push \n" \
309 " .set mips32r2 \n" \
310 " .set noat \n" \
311 " move $1, %0 \n" \
312 " # mttgpr $1, " #rd " \n" \
313 " .word 0x41810020 | (" #rd " << 11) \n" \
314 " .set pop \n" \
315 : : "r" (v)); \
316} while (0)
317
318#define mttc0(rd, sel, v) \
319({ \
320 __asm__ __volatile__( \
321 " .set push \n" \
322 " .set mips32r2 \n" \
323 " .set noat \n" \
324 " move $1, %0 \n" \
325 " # mttc0 %0," #rd ", " #sel " \n" \
326 " .word 0x41810000 | (" #rd " << 11) | " #sel " \n" \
327 " .set pop \n" \
328 : \
329 : "r" (v)); \
330})
331
332
333#define mttr(rd, u, sel, v) \
334({ \
335 __asm__ __volatile__( \
336 "mttr %0," #rd ", " #u ", " #sel \
337 : : "r" (v)); \
338})
339
340
341#define settc(tc) \
342do { \
343 write_c0_vpecontrol((read_c0_vpecontrol()&~VPECONTROL_TARGTC) | (tc)); \
344 ehb(); \
345} while (0)
346
347
348/* you *must* set the target tc (settc) before trying to use these */
349#define read_vpe_c0_vpecontrol() mftc0(1, 1)
350#define write_vpe_c0_vpecontrol(val) mttc0(1, 1, val)
351#define read_vpe_c0_vpeconf0() mftc0(1, 2)
352#define write_vpe_c0_vpeconf0(val) mttc0(1, 2, val)
353#define read_vpe_c0_count() mftc0(9, 0)
354#define write_vpe_c0_count(val) mttc0(9, 0, val)
355#define read_vpe_c0_status() mftc0(12, 0)
356#define write_vpe_c0_status(val) mttc0(12, 0, val)
357#define read_vpe_c0_cause() mftc0(13, 0)
358#define write_vpe_c0_cause(val) mttc0(13, 0, val)
359#define read_vpe_c0_config() mftc0(16, 0)
360#define write_vpe_c0_config(val) mttc0(16, 0, val)
361#define read_vpe_c0_config1() mftc0(16, 1)
362#define write_vpe_c0_config1(val) mttc0(16, 1, val)
363#define read_vpe_c0_config7() mftc0(16, 7)
364#define write_vpe_c0_config7(val) mttc0(16, 7, val)
365#define read_vpe_c0_ebase() mftc0(15, 1)
366#define write_vpe_c0_ebase(val) mttc0(15, 1, val)
367#define write_vpe_c0_compare(val) mttc0(11, 0, val)
368#define read_vpe_c0_badvaddr() mftc0(8, 0)
369#define read_vpe_c0_epc() mftc0(14, 0)
370#define write_vpe_c0_epc(val) mttc0(14, 0, val)
371
372
373/* TC */
374#define read_tc_c0_tcstatus() mftc0(2, 1)
375#define write_tc_c0_tcstatus(val) mttc0(2, 1, val)
376#define read_tc_c0_tcbind() mftc0(2, 2)
377#define write_tc_c0_tcbind(val) mttc0(2, 2, val)
378#define read_tc_c0_tcrestart() mftc0(2, 3)
379#define write_tc_c0_tcrestart(val) mttc0(2, 3, val)
380#define read_tc_c0_tchalt() mftc0(2, 4)
381#define write_tc_c0_tchalt(val) mttc0(2, 4, val)
382#define read_tc_c0_tccontext() mftc0(2, 5)
383#define write_tc_c0_tccontext(val) mttc0(2, 5, val)
384
385/* GPR */
386#define read_tc_gpr_sp() mftgpr(29)
387#define write_tc_gpr_sp(val) mttgpr(29, val)
388#define read_tc_gpr_gp() mftgpr(28)
389#define write_tc_gpr_gp(val) mttgpr(28, val)
390
391__BUILD_SET_C0(mvpcontrol)
392
393#endif /* Not __ASSEMBLY__ */
394
395#endif
diff --git a/include/asm-mips/mipsprom.h b/include/asm-mips/mipsprom.h
deleted file mode 100644
index 146d41b67adc..000000000000
--- a/include/asm-mips/mipsprom.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef __ASM_MIPS_PROM_H
2#define __ASM_MIPS_PROM_H
3
4#define PROM_RESET 0
5#define PROM_EXEC 1
6#define PROM_RESTART 2
7#define PROM_REINIT 3
8#define PROM_REBOOT 4
9#define PROM_AUTOBOOT 5
10#define PROM_OPEN 6
11#define PROM_READ 7
12#define PROM_WRITE 8
13#define PROM_IOCTL 9
14#define PROM_CLOSE 10
15#define PROM_GETCHAR 11
16#define PROM_PUTCHAR 12
17#define PROM_SHOWCHAR 13 /* XXX */
18#define PROM_GETS 14 /* XXX */
19#define PROM_PUTS 15 /* XXX */
20#define PROM_PRINTF 16 /* XXX */
21
22/* What are these for? */
23#define PROM_INITPROTO 17 /* XXX */
24#define PROM_PROTOENABLE 18 /* XXX */
25#define PROM_PROTODISABLE 19 /* XXX */
26#define PROM_GETPKT 20 /* XXX */
27#define PROM_PUTPKT 21 /* XXX */
28
29/* More PROM shit. Probably has to do with VME RMW cycles??? */
30#define PROM_ORW_RMW 22 /* XXX */
31#define PROM_ORH_RMW 23 /* XXX */
32#define PROM_ORB_RMW 24 /* XXX */
33#define PROM_ANDW_RMW 25 /* XXX */
34#define PROM_ANDH_RMW 26 /* XXX */
35#define PROM_ANDB_RMW 27 /* XXX */
36
37/* Cache handling stuff */
38#define PROM_FLUSHCACHE 28 /* XXX */
39#define PROM_CLEARCACHE 29 /* XXX */
40
41/* Libc alike stuff */
42#define PROM_SETJMP 30 /* XXX */
43#define PROM_LONGJMP 31 /* XXX */
44#define PROM_BEVUTLB 32 /* XXX */
45#define PROM_GETENV 33 /* XXX */
46#define PROM_SETENV 34 /* XXX */
47#define PROM_ATOB 35 /* XXX */
48#define PROM_STRCMP 36 /* XXX */
49#define PROM_STRLEN 37 /* XXX */
50#define PROM_STRCPY 38 /* XXX */
51#define PROM_STRCAT 39 /* XXX */
52
53/* Misc stuff */
54#define PROM_PARSER 40 /* XXX */
55#define PROM_RANGE 41 /* XXX */
56#define PROM_ARGVIZE 42 /* XXX */
57#define PROM_HELP 43 /* XXX */
58
59/* Entry points for some PROM commands */
60#define PROM_DUMPCMD 44 /* XXX */
61#define PROM_SETENVCMD 45 /* XXX */
62#define PROM_UNSETENVCMD 46 /* XXX */
63#define PROM_PRINTENVCMD 47 /* XXX */
64#define PROM_BEVEXCEPT 48 /* XXX */
65#define PROM_ENABLECMD 49 /* XXX */
66#define PROM_DISABLECMD 50 /* XXX */
67
68#define PROM_CLEARNOFAULT 51 /* XXX */
69#define PROM_NOTIMPLEMENT 52 /* XXX */
70
71#define PROM_NV_GET 53 /* XXX */
72#define PROM_NV_SET 54 /* XXX */
73
74extern char *prom_getenv(char *);
75
76#endif /* __ASM_MIPS_PROM_H */
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
deleted file mode 100644
index 979866000da4..000000000000
--- a/include/asm-mips/mipsregs.h
+++ /dev/null
@@ -1,1526 +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) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 * Modified for further R[236]000 support by Paul M. Antoine, 1996.
9 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000, 07 MIPS Technologies, Inc.
11 * Copyright (C) 2003, 2004 Maciej W. Rozycki
12 */
13#ifndef _ASM_MIPSREGS_H
14#define _ASM_MIPSREGS_H
15
16#include <linux/linkage.h>
17#include <asm/hazards.h>
18#include <asm/war.h>
19
20/*
21 * The following macros are especially useful for __asm__
22 * inline assembler.
23 */
24#ifndef __STR
25#define __STR(x) #x
26#endif
27#ifndef STR
28#define STR(x) __STR(x)
29#endif
30
31/*
32 * Configure language
33 */
34#ifdef __ASSEMBLY__
35#define _ULCAST_
36#else
37#define _ULCAST_ (unsigned long)
38#endif
39
40/*
41 * Coprocessor 0 register names
42 */
43#define CP0_INDEX $0
44#define CP0_RANDOM $1
45#define CP0_ENTRYLO0 $2
46#define CP0_ENTRYLO1 $3
47#define CP0_CONF $3
48#define CP0_CONTEXT $4
49#define CP0_PAGEMASK $5
50#define CP0_WIRED $6
51#define CP0_INFO $7
52#define CP0_BADVADDR $8
53#define CP0_COUNT $9
54#define CP0_ENTRYHI $10
55#define CP0_COMPARE $11
56#define CP0_STATUS $12
57#define CP0_CAUSE $13
58#define CP0_EPC $14
59#define CP0_PRID $15
60#define CP0_CONFIG $16
61#define CP0_LLADDR $17
62#define CP0_WATCHLO $18
63#define CP0_WATCHHI $19
64#define CP0_XCONTEXT $20
65#define CP0_FRAMEMASK $21
66#define CP0_DIAGNOSTIC $22
67#define CP0_DEBUG $23
68#define CP0_DEPC $24
69#define CP0_PERFORMANCE $25
70#define CP0_ECC $26
71#define CP0_CACHEERR $27
72#define CP0_TAGLO $28
73#define CP0_TAGHI $29
74#define CP0_ERROREPC $30
75#define CP0_DESAVE $31
76
77/*
78 * R4640/R4650 cp0 register names. These registers are listed
79 * here only for completeness; without MMU these CPUs are not useable
80 * by Linux. A future ELKS port might take make Linux run on them
81 * though ...
82 */
83#define CP0_IBASE $0
84#define CP0_IBOUND $1
85#define CP0_DBASE $2
86#define CP0_DBOUND $3
87#define CP0_CALG $17
88#define CP0_IWATCH $18
89#define CP0_DWATCH $19
90
91/*
92 * Coprocessor 0 Set 1 register names
93 */
94#define CP0_S1_DERRADDR0 $26
95#define CP0_S1_DERRADDR1 $27
96#define CP0_S1_INTCONTROL $20
97
98/*
99 * Coprocessor 0 Set 2 register names
100 */
101#define CP0_S2_SRSCTL $12 /* MIPSR2 */
102
103/*
104 * Coprocessor 0 Set 3 register names
105 */
106#define CP0_S3_SRSMAP $12 /* MIPSR2 */
107
108/*
109 * TX39 Series
110 */
111#define CP0_TX39_CACHE $7
112
113/*
114 * Coprocessor 1 (FPU) register names
115 */
116#define CP1_REVISION $0
117#define CP1_STATUS $31
118
119/*
120 * FPU Status Register Values
121 */
122/*
123 * Status Register Values
124 */
125
126#define FPU_CSR_FLUSH 0x01000000 /* flush denormalised results to 0 */
127#define FPU_CSR_COND 0x00800000 /* $fcc0 */
128#define FPU_CSR_COND0 0x00800000 /* $fcc0 */
129#define FPU_CSR_COND1 0x02000000 /* $fcc1 */
130#define FPU_CSR_COND2 0x04000000 /* $fcc2 */
131#define FPU_CSR_COND3 0x08000000 /* $fcc3 */
132#define FPU_CSR_COND4 0x10000000 /* $fcc4 */
133#define FPU_CSR_COND5 0x20000000 /* $fcc5 */
134#define FPU_CSR_COND6 0x40000000 /* $fcc6 */
135#define FPU_CSR_COND7 0x80000000 /* $fcc7 */
136
137/*
138 * X the exception cause indicator
139 * E the exception enable
140 * S the sticky/flag bit
141*/
142#define FPU_CSR_ALL_X 0x0003f000
143#define FPU_CSR_UNI_X 0x00020000
144#define FPU_CSR_INV_X 0x00010000
145#define FPU_CSR_DIV_X 0x00008000
146#define FPU_CSR_OVF_X 0x00004000
147#define FPU_CSR_UDF_X 0x00002000
148#define FPU_CSR_INE_X 0x00001000
149
150#define FPU_CSR_ALL_E 0x00000f80
151#define FPU_CSR_INV_E 0x00000800
152#define FPU_CSR_DIV_E 0x00000400
153#define FPU_CSR_OVF_E 0x00000200
154#define FPU_CSR_UDF_E 0x00000100
155#define FPU_CSR_INE_E 0x00000080
156
157#define FPU_CSR_ALL_S 0x0000007c
158#define FPU_CSR_INV_S 0x00000040
159#define FPU_CSR_DIV_S 0x00000020
160#define FPU_CSR_OVF_S 0x00000010
161#define FPU_CSR_UDF_S 0x00000008
162#define FPU_CSR_INE_S 0x00000004
163
164/* rounding mode */
165#define FPU_CSR_RN 0x0 /* nearest */
166#define FPU_CSR_RZ 0x1 /* towards zero */
167#define FPU_CSR_RU 0x2 /* towards +Infinity */
168#define FPU_CSR_RD 0x3 /* towards -Infinity */
169
170
171/*
172 * Values for PageMask register
173 */
174#ifdef CONFIG_CPU_VR41XX
175
176/* Why doesn't stupidity hurt ... */
177
178#define PM_1K 0x00000000
179#define PM_4K 0x00001800
180#define PM_16K 0x00007800
181#define PM_64K 0x0001f800
182#define PM_256K 0x0007f800
183
184#else
185
186#define PM_4K 0x00000000
187#define PM_16K 0x00006000
188#define PM_64K 0x0001e000
189#define PM_256K 0x0007e000
190#define PM_1M 0x001fe000
191#define PM_4M 0x007fe000
192#define PM_16M 0x01ffe000
193#define PM_64M 0x07ffe000
194#define PM_256M 0x1fffe000
195
196#endif
197
198/*
199 * Default page size for a given kernel configuration
200 */
201#ifdef CONFIG_PAGE_SIZE_4KB
202#define PM_DEFAULT_MASK PM_4K
203#elif defined(CONFIG_PAGE_SIZE_16KB)
204#define PM_DEFAULT_MASK PM_16K
205#elif defined(CONFIG_PAGE_SIZE_64KB)
206#define PM_DEFAULT_MASK PM_64K
207#else
208#error Bad page size configuration!
209#endif
210
211
212/*
213 * Values used for computation of new tlb entries
214 */
215#define PL_4K 12
216#define PL_16K 14
217#define PL_64K 16
218#define PL_256K 18
219#define PL_1M 20
220#define PL_4M 22
221#define PL_16M 24
222#define PL_64M 26
223#define PL_256M 28
224
225/*
226 * R4x00 interrupt enable / cause bits
227 */
228#define IE_SW0 (_ULCAST_(1) << 8)
229#define IE_SW1 (_ULCAST_(1) << 9)
230#define IE_IRQ0 (_ULCAST_(1) << 10)
231#define IE_IRQ1 (_ULCAST_(1) << 11)
232#define IE_IRQ2 (_ULCAST_(1) << 12)
233#define IE_IRQ3 (_ULCAST_(1) << 13)
234#define IE_IRQ4 (_ULCAST_(1) << 14)
235#define IE_IRQ5 (_ULCAST_(1) << 15)
236
237/*
238 * R4x00 interrupt cause bits
239 */
240#define C_SW0 (_ULCAST_(1) << 8)
241#define C_SW1 (_ULCAST_(1) << 9)
242#define C_IRQ0 (_ULCAST_(1) << 10)
243#define C_IRQ1 (_ULCAST_(1) << 11)
244#define C_IRQ2 (_ULCAST_(1) << 12)
245#define C_IRQ3 (_ULCAST_(1) << 13)
246#define C_IRQ4 (_ULCAST_(1) << 14)
247#define C_IRQ5 (_ULCAST_(1) << 15)
248
249/*
250 * Bitfields in the R4xx0 cp0 status register
251 */
252#define ST0_IE 0x00000001
253#define ST0_EXL 0x00000002
254#define ST0_ERL 0x00000004
255#define ST0_KSU 0x00000018
256# define KSU_USER 0x00000010
257# define KSU_SUPERVISOR 0x00000008
258# define KSU_KERNEL 0x00000000
259#define ST0_UX 0x00000020
260#define ST0_SX 0x00000040
261#define ST0_KX 0x00000080
262#define ST0_DE 0x00010000
263#define ST0_CE 0x00020000
264
265/*
266 * Setting c0_status.co enables Hit_Writeback and Hit_Writeback_Invalidate
267 * cacheops in userspace. This bit exists only on RM7000 and RM9000
268 * processors.
269 */
270#define ST0_CO 0x08000000
271
272/*
273 * Bitfields in the R[23]000 cp0 status register.
274 */
275#define ST0_IEC 0x00000001
276#define ST0_KUC 0x00000002
277#define ST0_IEP 0x00000004
278#define ST0_KUP 0x00000008
279#define ST0_IEO 0x00000010
280#define ST0_KUO 0x00000020
281/* bits 6 & 7 are reserved on R[23]000 */
282#define ST0_ISC 0x00010000
283#define ST0_SWC 0x00020000
284#define ST0_CM 0x00080000
285
286/*
287 * Bits specific to the R4640/R4650
288 */
289#define ST0_UM (_ULCAST_(1) << 4)
290#define ST0_IL (_ULCAST_(1) << 23)
291#define ST0_DL (_ULCAST_(1) << 24)
292
293/*
294 * Enable the MIPS MDMX and DSP ASEs
295 */
296#define ST0_MX 0x01000000
297
298/*
299 * Bitfields in the TX39 family CP0 Configuration Register 3
300 */
301#define TX39_CONF_ICS_SHIFT 19
302#define TX39_CONF_ICS_MASK 0x00380000
303#define TX39_CONF_ICS_1KB 0x00000000
304#define TX39_CONF_ICS_2KB 0x00080000
305#define TX39_CONF_ICS_4KB 0x00100000
306#define TX39_CONF_ICS_8KB 0x00180000
307#define TX39_CONF_ICS_16KB 0x00200000
308
309#define TX39_CONF_DCS_SHIFT 16
310#define TX39_CONF_DCS_MASK 0x00070000
311#define TX39_CONF_DCS_1KB 0x00000000
312#define TX39_CONF_DCS_2KB 0x00010000
313#define TX39_CONF_DCS_4KB 0x00020000
314#define TX39_CONF_DCS_8KB 0x00030000
315#define TX39_CONF_DCS_16KB 0x00040000
316
317#define TX39_CONF_CWFON 0x00004000
318#define TX39_CONF_WBON 0x00002000
319#define TX39_CONF_RF_SHIFT 10
320#define TX39_CONF_RF_MASK 0x00000c00
321#define TX39_CONF_DOZE 0x00000200
322#define TX39_CONF_HALT 0x00000100
323#define TX39_CONF_LOCK 0x00000080
324#define TX39_CONF_ICE 0x00000020
325#define TX39_CONF_DCE 0x00000010
326#define TX39_CONF_IRSIZE_SHIFT 2
327#define TX39_CONF_IRSIZE_MASK 0x0000000c
328#define TX39_CONF_DRSIZE_SHIFT 0
329#define TX39_CONF_DRSIZE_MASK 0x00000003
330
331/*
332 * Status register bits available in all MIPS CPUs.
333 */
334#define ST0_IM 0x0000ff00
335#define STATUSB_IP0 8
336#define STATUSF_IP0 (_ULCAST_(1) << 8)
337#define STATUSB_IP1 9
338#define STATUSF_IP1 (_ULCAST_(1) << 9)
339#define STATUSB_IP2 10
340#define STATUSF_IP2 (_ULCAST_(1) << 10)
341#define STATUSB_IP3 11
342#define STATUSF_IP3 (_ULCAST_(1) << 11)
343#define STATUSB_IP4 12
344#define STATUSF_IP4 (_ULCAST_(1) << 12)
345#define STATUSB_IP5 13
346#define STATUSF_IP5 (_ULCAST_(1) << 13)
347#define STATUSB_IP6 14
348#define STATUSF_IP6 (_ULCAST_(1) << 14)
349#define STATUSB_IP7 15
350#define STATUSF_IP7 (_ULCAST_(1) << 15)
351#define STATUSB_IP8 0
352#define STATUSF_IP8 (_ULCAST_(1) << 0)
353#define STATUSB_IP9 1
354#define STATUSF_IP9 (_ULCAST_(1) << 1)
355#define STATUSB_IP10 2
356#define STATUSF_IP10 (_ULCAST_(1) << 2)
357#define STATUSB_IP11 3
358#define STATUSF_IP11 (_ULCAST_(1) << 3)
359#define STATUSB_IP12 4
360#define STATUSF_IP12 (_ULCAST_(1) << 4)
361#define STATUSB_IP13 5
362#define STATUSF_IP13 (_ULCAST_(1) << 5)
363#define STATUSB_IP14 6
364#define STATUSF_IP14 (_ULCAST_(1) << 6)
365#define STATUSB_IP15 7
366#define STATUSF_IP15 (_ULCAST_(1) << 7)
367#define ST0_CH 0x00040000
368#define ST0_SR 0x00100000
369#define ST0_TS 0x00200000
370#define ST0_BEV 0x00400000
371#define ST0_RE 0x02000000
372#define ST0_FR 0x04000000
373#define ST0_CU 0xf0000000
374#define ST0_CU0 0x10000000
375#define ST0_CU1 0x20000000
376#define ST0_CU2 0x40000000
377#define ST0_CU3 0x80000000
378#define ST0_XX 0x80000000 /* MIPS IV naming */
379
380/*
381 * Bitfields and bit numbers in the coprocessor 0 cause register.
382 *
383 * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
384 */
385#define CAUSEB_EXCCODE 2
386#define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
387#define CAUSEB_IP 8
388#define CAUSEF_IP (_ULCAST_(255) << 8)
389#define CAUSEB_IP0 8
390#define CAUSEF_IP0 (_ULCAST_(1) << 8)
391#define CAUSEB_IP1 9
392#define CAUSEF_IP1 (_ULCAST_(1) << 9)
393#define CAUSEB_IP2 10
394#define CAUSEF_IP2 (_ULCAST_(1) << 10)
395#define CAUSEB_IP3 11
396#define CAUSEF_IP3 (_ULCAST_(1) << 11)
397#define CAUSEB_IP4 12
398#define CAUSEF_IP4 (_ULCAST_(1) << 12)
399#define CAUSEB_IP5 13
400#define CAUSEF_IP5 (_ULCAST_(1) << 13)
401#define CAUSEB_IP6 14
402#define CAUSEF_IP6 (_ULCAST_(1) << 14)
403#define CAUSEB_IP7 15
404#define CAUSEF_IP7 (_ULCAST_(1) << 15)
405#define CAUSEB_IV 23
406#define CAUSEF_IV (_ULCAST_(1) << 23)
407#define CAUSEB_CE 28
408#define CAUSEF_CE (_ULCAST_(3) << 28)
409#define CAUSEB_BD 31
410#define CAUSEF_BD (_ULCAST_(1) << 31)
411
412/*
413 * Bits in the coprocessor 0 config register.
414 */
415/* Generic bits. */
416#define CONF_CM_CACHABLE_NO_WA 0
417#define CONF_CM_CACHABLE_WA 1
418#define CONF_CM_UNCACHED 2
419#define CONF_CM_CACHABLE_NONCOHERENT 3
420#define CONF_CM_CACHABLE_CE 4
421#define CONF_CM_CACHABLE_COW 5
422#define CONF_CM_CACHABLE_CUW 6
423#define CONF_CM_CACHABLE_ACCELERATED 7
424#define CONF_CM_CMASK 7
425#define CONF_BE (_ULCAST_(1) << 15)
426
427/* Bits common to various processors. */
428#define CONF_CU (_ULCAST_(1) << 3)
429#define CONF_DB (_ULCAST_(1) << 4)
430#define CONF_IB (_ULCAST_(1) << 5)
431#define CONF_DC (_ULCAST_(7) << 6)
432#define CONF_IC (_ULCAST_(7) << 9)
433#define CONF_EB (_ULCAST_(1) << 13)
434#define CONF_EM (_ULCAST_(1) << 14)
435#define CONF_SM (_ULCAST_(1) << 16)
436#define CONF_SC (_ULCAST_(1) << 17)
437#define CONF_EW (_ULCAST_(3) << 18)
438#define CONF_EP (_ULCAST_(15)<< 24)
439#define CONF_EC (_ULCAST_(7) << 28)
440#define CONF_CM (_ULCAST_(1) << 31)
441
442/* Bits specific to the R4xx0. */
443#define R4K_CONF_SW (_ULCAST_(1) << 20)
444#define R4K_CONF_SS (_ULCAST_(1) << 21)
445#define R4K_CONF_SB (_ULCAST_(3) << 22)
446
447/* Bits specific to the R5000. */
448#define R5K_CONF_SE (_ULCAST_(1) << 12)
449#define R5K_CONF_SS (_ULCAST_(3) << 20)
450
451/* Bits specific to the RM7000. */
452#define RM7K_CONF_SE (_ULCAST_(1) << 3)
453#define RM7K_CONF_TE (_ULCAST_(1) << 12)
454#define RM7K_CONF_CLK (_ULCAST_(1) << 16)
455#define RM7K_CONF_TC (_ULCAST_(1) << 17)
456#define RM7K_CONF_SI (_ULCAST_(3) << 20)
457#define RM7K_CONF_SC (_ULCAST_(1) << 31)
458
459/* Bits specific to the R10000. */
460#define R10K_CONF_DN (_ULCAST_(3) << 3)
461#define R10K_CONF_CT (_ULCAST_(1) << 5)
462#define R10K_CONF_PE (_ULCAST_(1) << 6)
463#define R10K_CONF_PM (_ULCAST_(3) << 7)
464#define R10K_CONF_EC (_ULCAST_(15)<< 9)
465#define R10K_CONF_SB (_ULCAST_(1) << 13)
466#define R10K_CONF_SK (_ULCAST_(1) << 14)
467#define R10K_CONF_SS (_ULCAST_(7) << 16)
468#define R10K_CONF_SC (_ULCAST_(7) << 19)
469#define R10K_CONF_DC (_ULCAST_(7) << 26)
470#define R10K_CONF_IC (_ULCAST_(7) << 29)
471
472/* Bits specific to the VR41xx. */
473#define VR41_CONF_CS (_ULCAST_(1) << 12)
474#define VR41_CONF_P4K (_ULCAST_(1) << 13)
475#define VR41_CONF_BP (_ULCAST_(1) << 16)
476#define VR41_CONF_M16 (_ULCAST_(1) << 20)
477#define VR41_CONF_AD (_ULCAST_(1) << 23)
478
479/* Bits specific to the R30xx. */
480#define R30XX_CONF_FDM (_ULCAST_(1) << 19)
481#define R30XX_CONF_REV (_ULCAST_(1) << 22)
482#define R30XX_CONF_AC (_ULCAST_(1) << 23)
483#define R30XX_CONF_RF (_ULCAST_(1) << 24)
484#define R30XX_CONF_HALT (_ULCAST_(1) << 25)
485#define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
486#define R30XX_CONF_DBR (_ULCAST_(1) << 29)
487#define R30XX_CONF_SB (_ULCAST_(1) << 30)
488#define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
489
490/* Bits specific to the TX49. */
491#define TX49_CONF_DC (_ULCAST_(1) << 16)
492#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */
493#define TX49_CONF_HALT (_ULCAST_(1) << 18)
494#define TX49_CONF_CWFON (_ULCAST_(1) << 27)
495
496/* Bits specific to the MIPS32/64 PRA. */
497#define MIPS_CONF_MT (_ULCAST_(7) << 7)
498#define MIPS_CONF_AR (_ULCAST_(7) << 10)
499#define MIPS_CONF_AT (_ULCAST_(3) << 13)
500#define MIPS_CONF_M (_ULCAST_(1) << 31)
501
502/*
503 * Bits in the MIPS32/64 PRA coprocessor 0 config registers 1 and above.
504 */
505#define MIPS_CONF1_FP (_ULCAST_(1) << 0)
506#define MIPS_CONF1_EP (_ULCAST_(1) << 1)
507#define MIPS_CONF1_CA (_ULCAST_(1) << 2)
508#define MIPS_CONF1_WR (_ULCAST_(1) << 3)
509#define MIPS_CONF1_PC (_ULCAST_(1) << 4)
510#define MIPS_CONF1_MD (_ULCAST_(1) << 5)
511#define MIPS_CONF1_C2 (_ULCAST_(1) << 6)
512#define MIPS_CONF1_DA (_ULCAST_(7) << 7)
513#define MIPS_CONF1_DL (_ULCAST_(7) << 10)
514#define MIPS_CONF1_DS (_ULCAST_(7) << 13)
515#define MIPS_CONF1_IA (_ULCAST_(7) << 16)
516#define MIPS_CONF1_IL (_ULCAST_(7) << 19)
517#define MIPS_CONF1_IS (_ULCAST_(7) << 22)
518#define MIPS_CONF1_TLBS (_ULCAST_(63)<< 25)
519
520#define MIPS_CONF2_SA (_ULCAST_(15)<< 0)
521#define MIPS_CONF2_SL (_ULCAST_(15)<< 4)
522#define MIPS_CONF2_SS (_ULCAST_(15)<< 8)
523#define MIPS_CONF2_SU (_ULCAST_(15)<< 12)
524#define MIPS_CONF2_TA (_ULCAST_(15)<< 16)
525#define MIPS_CONF2_TL (_ULCAST_(15)<< 20)
526#define MIPS_CONF2_TS (_ULCAST_(15)<< 24)
527#define MIPS_CONF2_TU (_ULCAST_(7) << 28)
528
529#define MIPS_CONF3_TL (_ULCAST_(1) << 0)
530#define MIPS_CONF3_SM (_ULCAST_(1) << 1)
531#define MIPS_CONF3_MT (_ULCAST_(1) << 2)
532#define MIPS_CONF3_SP (_ULCAST_(1) << 4)
533#define MIPS_CONF3_VINT (_ULCAST_(1) << 5)
534#define MIPS_CONF3_VEIC (_ULCAST_(1) << 6)
535#define MIPS_CONF3_LPA (_ULCAST_(1) << 7)
536#define MIPS_CONF3_DSP (_ULCAST_(1) << 10)
537#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
538
539#define MIPS_CONF7_WII (_ULCAST_(1) << 31)
540
541#define MIPS_CONF7_RPS (_ULCAST_(1) << 2)
542
543
544/*
545 * Bits in the MIPS32/64 coprocessor 1 (FPU) revision register.
546 */
547#define MIPS_FPIR_S (_ULCAST_(1) << 16)
548#define MIPS_FPIR_D (_ULCAST_(1) << 17)
549#define MIPS_FPIR_PS (_ULCAST_(1) << 18)
550#define MIPS_FPIR_3D (_ULCAST_(1) << 19)
551#define MIPS_FPIR_W (_ULCAST_(1) << 20)
552#define MIPS_FPIR_L (_ULCAST_(1) << 21)
553#define MIPS_FPIR_F64 (_ULCAST_(1) << 22)
554
555#ifndef __ASSEMBLY__
556
557/*
558 * Functions to access the R10000 performance counters. These are basically
559 * mfc0 and mtc0 instructions from and to coprocessor register with a 5-bit
560 * performance counter number encoded into bits 1 ... 5 of the instruction.
561 * Only performance counters 0 to 1 actually exist, so for a non-R10000 aware
562 * disassembler these will look like an access to sel 0 or 1.
563 */
564#define read_r10k_perf_cntr(counter) \
565({ \
566 unsigned int __res; \
567 __asm__ __volatile__( \
568 "mfpc\t%0, %1" \
569 : "=r" (__res) \
570 : "i" (counter)); \
571 \
572 __res; \
573})
574
575#define write_r10k_perf_cntr(counter,val) \
576do { \
577 __asm__ __volatile__( \
578 "mtpc\t%0, %1" \
579 : \
580 : "r" (val), "i" (counter)); \
581} while (0)
582
583#define read_r10k_perf_event(counter) \
584({ \
585 unsigned int __res; \
586 __asm__ __volatile__( \
587 "mfps\t%0, %1" \
588 : "=r" (__res) \
589 : "i" (counter)); \
590 \
591 __res; \
592})
593
594#define write_r10k_perf_cntl(counter,val) \
595do { \
596 __asm__ __volatile__( \
597 "mtps\t%0, %1" \
598 : \
599 : "r" (val), "i" (counter)); \
600} while (0)
601
602
603/*
604 * Macros to access the system control coprocessor
605 */
606
607#define __read_32bit_c0_register(source, sel) \
608({ int __res; \
609 if (sel == 0) \
610 __asm__ __volatile__( \
611 "mfc0\t%0, " #source "\n\t" \
612 : "=r" (__res)); \
613 else \
614 __asm__ __volatile__( \
615 ".set\tmips32\n\t" \
616 "mfc0\t%0, " #source ", " #sel "\n\t" \
617 ".set\tmips0\n\t" \
618 : "=r" (__res)); \
619 __res; \
620})
621
622#define __read_64bit_c0_register(source, sel) \
623({ unsigned long long __res; \
624 if (sizeof(unsigned long) == 4) \
625 __res = __read_64bit_c0_split(source, sel); \
626 else if (sel == 0) \
627 __asm__ __volatile__( \
628 ".set\tmips3\n\t" \
629 "dmfc0\t%0, " #source "\n\t" \
630 ".set\tmips0" \
631 : "=r" (__res)); \
632 else \
633 __asm__ __volatile__( \
634 ".set\tmips64\n\t" \
635 "dmfc0\t%0, " #source ", " #sel "\n\t" \
636 ".set\tmips0" \
637 : "=r" (__res)); \
638 __res; \
639})
640
641#define __write_32bit_c0_register(register, sel, value) \
642do { \
643 if (sel == 0) \
644 __asm__ __volatile__( \
645 "mtc0\t%z0, " #register "\n\t" \
646 : : "Jr" ((unsigned int)(value))); \
647 else \
648 __asm__ __volatile__( \
649 ".set\tmips32\n\t" \
650 "mtc0\t%z0, " #register ", " #sel "\n\t" \
651 ".set\tmips0" \
652 : : "Jr" ((unsigned int)(value))); \
653} while (0)
654
655#define __write_64bit_c0_register(register, sel, value) \
656do { \
657 if (sizeof(unsigned long) == 4) \
658 __write_64bit_c0_split(register, sel, value); \
659 else if (sel == 0) \
660 __asm__ __volatile__( \
661 ".set\tmips3\n\t" \
662 "dmtc0\t%z0, " #register "\n\t" \
663 ".set\tmips0" \
664 : : "Jr" (value)); \
665 else \
666 __asm__ __volatile__( \
667 ".set\tmips64\n\t" \
668 "dmtc0\t%z0, " #register ", " #sel "\n\t" \
669 ".set\tmips0" \
670 : : "Jr" (value)); \
671} while (0)
672
673#define __read_ulong_c0_register(reg, sel) \
674 ((sizeof(unsigned long) == 4) ? \
675 (unsigned long) __read_32bit_c0_register(reg, sel) : \
676 (unsigned long) __read_64bit_c0_register(reg, sel))
677
678#define __write_ulong_c0_register(reg, sel, val) \
679do { \
680 if (sizeof(unsigned long) == 4) \
681 __write_32bit_c0_register(reg, sel, val); \
682 else \
683 __write_64bit_c0_register(reg, sel, val); \
684} while (0)
685
686/*
687 * On RM7000/RM9000 these are uses to access cop0 set 1 registers
688 */
689#define __read_32bit_c0_ctrl_register(source) \
690({ int __res; \
691 __asm__ __volatile__( \
692 "cfc0\t%0, " #source "\n\t" \
693 : "=r" (__res)); \
694 __res; \
695})
696
697#define __write_32bit_c0_ctrl_register(register, value) \
698do { \
699 __asm__ __volatile__( \
700 "ctc0\t%z0, " #register "\n\t" \
701 : : "Jr" ((unsigned int)(value))); \
702} while (0)
703
704/*
705 * These versions are only needed for systems with more than 38 bits of
706 * physical address space running the 32-bit kernel. That's none atm :-)
707 */
708#define __read_64bit_c0_split(source, sel) \
709({ \
710 unsigned long long __val; \
711 unsigned long __flags; \
712 \
713 local_irq_save(__flags); \
714 if (sel == 0) \
715 __asm__ __volatile__( \
716 ".set\tmips64\n\t" \
717 "dmfc0\t%M0, " #source "\n\t" \
718 "dsll\t%L0, %M0, 32\n\t" \
719 "dsrl\t%M0, %M0, 32\n\t" \
720 "dsrl\t%L0, %L0, 32\n\t" \
721 ".set\tmips0" \
722 : "=r" (__val)); \
723 else \
724 __asm__ __volatile__( \
725 ".set\tmips64\n\t" \
726 "dmfc0\t%M0, " #source ", " #sel "\n\t" \
727 "dsll\t%L0, %M0, 32\n\t" \
728 "dsrl\t%M0, %M0, 32\n\t" \
729 "dsrl\t%L0, %L0, 32\n\t" \
730 ".set\tmips0" \
731 : "=r" (__val)); \
732 local_irq_restore(__flags); \
733 \
734 __val; \
735})
736
737#define __write_64bit_c0_split(source, sel, val) \
738do { \
739 unsigned long __flags; \
740 \
741 local_irq_save(__flags); \
742 if (sel == 0) \
743 __asm__ __volatile__( \
744 ".set\tmips64\n\t" \
745 "dsll\t%L0, %L0, 32\n\t" \
746 "dsrl\t%L0, %L0, 32\n\t" \
747 "dsll\t%M0, %M0, 32\n\t" \
748 "or\t%L0, %L0, %M0\n\t" \
749 "dmtc0\t%L0, " #source "\n\t" \
750 ".set\tmips0" \
751 : : "r" (val)); \
752 else \
753 __asm__ __volatile__( \
754 ".set\tmips64\n\t" \
755 "dsll\t%L0, %L0, 32\n\t" \
756 "dsrl\t%L0, %L0, 32\n\t" \
757 "dsll\t%M0, %M0, 32\n\t" \
758 "or\t%L0, %L0, %M0\n\t" \
759 "dmtc0\t%L0, " #source ", " #sel "\n\t" \
760 ".set\tmips0" \
761 : : "r" (val)); \
762 local_irq_restore(__flags); \
763} while (0)
764
765#define read_c0_index() __read_32bit_c0_register($0, 0)
766#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
767
768#define read_c0_random() __read_32bit_c0_register($1, 0)
769#define write_c0_random(val) __write_32bit_c0_register($1, 0, val)
770
771#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
772#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
773
774#define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
775#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
776
777#define read_c0_conf() __read_32bit_c0_register($3, 0)
778#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
779
780#define read_c0_context() __read_ulong_c0_register($4, 0)
781#define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
782
783#define read_c0_userlocal() __read_ulong_c0_register($4, 2)
784#define write_c0_userlocal(val) __write_ulong_c0_register($4, 2, val)
785
786#define read_c0_pagemask() __read_32bit_c0_register($5, 0)
787#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
788
789#define read_c0_wired() __read_32bit_c0_register($6, 0)
790#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
791
792#define read_c0_info() __read_32bit_c0_register($7, 0)
793
794#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
795#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
796
797#define read_c0_badvaddr() __read_ulong_c0_register($8, 0)
798#define write_c0_badvaddr(val) __write_ulong_c0_register($8, 0, val)
799
800#define read_c0_count() __read_32bit_c0_register($9, 0)
801#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
802
803#define read_c0_count2() __read_32bit_c0_register($9, 6) /* pnx8550 */
804#define write_c0_count2(val) __write_32bit_c0_register($9, 6, val)
805
806#define read_c0_count3() __read_32bit_c0_register($9, 7) /* pnx8550 */
807#define write_c0_count3(val) __write_32bit_c0_register($9, 7, val)
808
809#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
810#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
811
812#define read_c0_compare() __read_32bit_c0_register($11, 0)
813#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
814
815#define read_c0_compare2() __read_32bit_c0_register($11, 6) /* pnx8550 */
816#define write_c0_compare2(val) __write_32bit_c0_register($11, 6, val)
817
818#define read_c0_compare3() __read_32bit_c0_register($11, 7) /* pnx8550 */
819#define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val)
820
821#define read_c0_status() __read_32bit_c0_register($12, 0)
822#ifdef CONFIG_MIPS_MT_SMTC
823#define write_c0_status(val) \
824do { \
825 __write_32bit_c0_register($12, 0, val); \
826 __ehb(); \
827} while (0)
828#else
829/*
830 * Legacy non-SMTC code, which may be hazardous
831 * but which might not support EHB
832 */
833#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
834#endif /* CONFIG_MIPS_MT_SMTC */
835
836#define read_c0_cause() __read_32bit_c0_register($13, 0)
837#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
838
839#define read_c0_epc() __read_ulong_c0_register($14, 0)
840#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
841
842#define read_c0_prid() __read_32bit_c0_register($15, 0)
843
844#define read_c0_config() __read_32bit_c0_register($16, 0)
845#define read_c0_config1() __read_32bit_c0_register($16, 1)
846#define read_c0_config2() __read_32bit_c0_register($16, 2)
847#define read_c0_config3() __read_32bit_c0_register($16, 3)
848#define read_c0_config4() __read_32bit_c0_register($16, 4)
849#define read_c0_config5() __read_32bit_c0_register($16, 5)
850#define read_c0_config6() __read_32bit_c0_register($16, 6)
851#define read_c0_config7() __read_32bit_c0_register($16, 7)
852#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
853#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
854#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
855#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
856#define write_c0_config4(val) __write_32bit_c0_register($16, 4, val)
857#define write_c0_config5(val) __write_32bit_c0_register($16, 5, val)
858#define write_c0_config6(val) __write_32bit_c0_register($16, 6, val)
859#define write_c0_config7(val) __write_32bit_c0_register($16, 7, val)
860
861/*
862 * The WatchLo register. There may be upto 8 of them.
863 */
864#define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
865#define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
866#define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
867#define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
868#define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
869#define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
870#define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
871#define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
872#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
873#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
874#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
875#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
876#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
877#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
878#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
879#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
880
881/*
882 * The WatchHi register. There may be upto 8 of them.
883 */
884#define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
885#define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
886#define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
887#define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
888#define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
889#define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
890#define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
891#define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
892
893#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
894#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
895#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
896#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
897#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
898#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
899#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
900#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
901
902#define read_c0_xcontext() __read_ulong_c0_register($20, 0)
903#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
904
905#define read_c0_intcontrol() __read_32bit_c0_ctrl_register($20)
906#define write_c0_intcontrol(val) __write_32bit_c0_ctrl_register($20, val)
907
908#define read_c0_framemask() __read_32bit_c0_register($21, 0)
909#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
910
911/* RM9000 PerfControl performance counter control register */
912#define read_c0_perfcontrol() __read_32bit_c0_register($22, 0)
913#define write_c0_perfcontrol(val) __write_32bit_c0_register($22, 0, val)
914
915#define read_c0_diag() __read_32bit_c0_register($22, 0)
916#define write_c0_diag(val) __write_32bit_c0_register($22, 0, val)
917
918#define read_c0_diag1() __read_32bit_c0_register($22, 1)
919#define write_c0_diag1(val) __write_32bit_c0_register($22, 1, val)
920
921#define read_c0_diag2() __read_32bit_c0_register($22, 2)
922#define write_c0_diag2(val) __write_32bit_c0_register($22, 2, val)
923
924#define read_c0_diag3() __read_32bit_c0_register($22, 3)
925#define write_c0_diag3(val) __write_32bit_c0_register($22, 3, val)
926
927#define read_c0_diag4() __read_32bit_c0_register($22, 4)
928#define write_c0_diag4(val) __write_32bit_c0_register($22, 4, val)
929
930#define read_c0_diag5() __read_32bit_c0_register($22, 5)
931#define write_c0_diag5(val) __write_32bit_c0_register($22, 5, val)
932
933#define read_c0_debug() __read_32bit_c0_register($23, 0)
934#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
935
936#define read_c0_depc() __read_ulong_c0_register($24, 0)
937#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
938
939/*
940 * MIPS32 / MIPS64 performance counters
941 */
942#define read_c0_perfctrl0() __read_32bit_c0_register($25, 0)
943#define write_c0_perfctrl0(val) __write_32bit_c0_register($25, 0, val)
944#define read_c0_perfcntr0() __read_32bit_c0_register($25, 1)
945#define write_c0_perfcntr0(val) __write_32bit_c0_register($25, 1, val)
946#define read_c0_perfctrl1() __read_32bit_c0_register($25, 2)
947#define write_c0_perfctrl1(val) __write_32bit_c0_register($25, 2, val)
948#define read_c0_perfcntr1() __read_32bit_c0_register($25, 3)
949#define write_c0_perfcntr1(val) __write_32bit_c0_register($25, 3, val)
950#define read_c0_perfctrl2() __read_32bit_c0_register($25, 4)
951#define write_c0_perfctrl2(val) __write_32bit_c0_register($25, 4, val)
952#define read_c0_perfcntr2() __read_32bit_c0_register($25, 5)
953#define write_c0_perfcntr2(val) __write_32bit_c0_register($25, 5, val)
954#define read_c0_perfctrl3() __read_32bit_c0_register($25, 6)
955#define write_c0_perfctrl3(val) __write_32bit_c0_register($25, 6, val)
956#define read_c0_perfcntr3() __read_32bit_c0_register($25, 7)
957#define write_c0_perfcntr3(val) __write_32bit_c0_register($25, 7, val)
958
959/* RM9000 PerfCount performance counter register */
960#define read_c0_perfcount() __read_64bit_c0_register($25, 0)
961#define write_c0_perfcount(val) __write_64bit_c0_register($25, 0, val)
962
963#define read_c0_ecc() __read_32bit_c0_register($26, 0)
964#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
965
966#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
967#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
968
969#define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
970
971#define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
972#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
973
974#define read_c0_taglo() __read_32bit_c0_register($28, 0)
975#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
976
977#define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
978#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
979
980#define read_c0_taghi() __read_32bit_c0_register($29, 0)
981#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
982
983#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
984#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
985
986/* MIPSR2 */
987#define read_c0_hwrena() __read_32bit_c0_register($7, 0)
988#define write_c0_hwrena(val) __write_32bit_c0_register($7, 0, val)
989
990#define read_c0_intctl() __read_32bit_c0_register($12, 1)
991#define write_c0_intctl(val) __write_32bit_c0_register($12, 1, val)
992
993#define read_c0_srsctl() __read_32bit_c0_register($12, 2)
994#define write_c0_srsctl(val) __write_32bit_c0_register($12, 2, val)
995
996#define read_c0_srsmap() __read_32bit_c0_register($12, 3)
997#define write_c0_srsmap(val) __write_32bit_c0_register($12, 3, val)
998
999#define read_c0_ebase() __read_32bit_c0_register($15, 1)
1000#define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val)
1001
1002/*
1003 * Macros to access the floating point coprocessor control registers
1004 */
1005#define read_32bit_cp1_register(source) \
1006({ int __res; \
1007 __asm__ __volatile__( \
1008 ".set\tpush\n\t" \
1009 ".set\treorder\n\t" \
1010 "cfc1\t%0,"STR(source)"\n\t" \
1011 ".set\tpop" \
1012 : "=r" (__res)); \
1013 __res;})
1014
1015#define rddsp(mask) \
1016({ \
1017 unsigned int __res; \
1018 \
1019 __asm__ __volatile__( \
1020 " .set push \n" \
1021 " .set noat \n" \
1022 " # rddsp $1, %x1 \n" \
1023 " .word 0x7c000cb8 | (%x1 << 16) \n" \
1024 " move %0, $1 \n" \
1025 " .set pop \n" \
1026 : "=r" (__res) \
1027 : "i" (mask)); \
1028 __res; \
1029})
1030
1031#define wrdsp(val, mask) \
1032do { \
1033 __asm__ __volatile__( \
1034 " .set push \n" \
1035 " .set noat \n" \
1036 " move $1, %0 \n" \
1037 " # wrdsp $1, %x1 \n" \
1038 " .word 0x7c2004f8 | (%x1 << 11) \n" \
1039 " .set pop \n" \
1040 : \
1041 : "r" (val), "i" (mask)); \
1042} while (0)
1043
1044#if 0 /* Need DSP ASE capable assembler ... */
1045#define mflo0() ({ long mflo0; __asm__("mflo %0, $ac0" : "=r" (mflo0)); mflo0;})
1046#define mflo1() ({ long mflo1; __asm__("mflo %0, $ac1" : "=r" (mflo1)); mflo1;})
1047#define mflo2() ({ long mflo2; __asm__("mflo %0, $ac2" : "=r" (mflo2)); mflo2;})
1048#define mflo3() ({ long mflo3; __asm__("mflo %0, $ac3" : "=r" (mflo3)); mflo3;})
1049
1050#define mfhi0() ({ long mfhi0; __asm__("mfhi %0, $ac0" : "=r" (mfhi0)); mfhi0;})
1051#define mfhi1() ({ long mfhi1; __asm__("mfhi %0, $ac1" : "=r" (mfhi1)); mfhi1;})
1052#define mfhi2() ({ long mfhi2; __asm__("mfhi %0, $ac2" : "=r" (mfhi2)); mfhi2;})
1053#define mfhi3() ({ long mfhi3; __asm__("mfhi %0, $ac3" : "=r" (mfhi3)); mfhi3;})
1054
1055#define mtlo0(x) __asm__("mtlo %0, $ac0" ::"r" (x))
1056#define mtlo1(x) __asm__("mtlo %0, $ac1" ::"r" (x))
1057#define mtlo2(x) __asm__("mtlo %0, $ac2" ::"r" (x))
1058#define mtlo3(x) __asm__("mtlo %0, $ac3" ::"r" (x))
1059
1060#define mthi0(x) __asm__("mthi %0, $ac0" ::"r" (x))
1061#define mthi1(x) __asm__("mthi %0, $ac1" ::"r" (x))
1062#define mthi2(x) __asm__("mthi %0, $ac2" ::"r" (x))
1063#define mthi3(x) __asm__("mthi %0, $ac3" ::"r" (x))
1064
1065#else
1066
1067#define mfhi0() \
1068({ \
1069 unsigned long __treg; \
1070 \
1071 __asm__ __volatile__( \
1072 " .set push \n" \
1073 " .set noat \n" \
1074 " # mfhi %0, $ac0 \n" \
1075 " .word 0x00000810 \n" \
1076 " move %0, $1 \n" \
1077 " .set pop \n" \
1078 : "=r" (__treg)); \
1079 __treg; \
1080})
1081
1082#define mfhi1() \
1083({ \
1084 unsigned long __treg; \
1085 \
1086 __asm__ __volatile__( \
1087 " .set push \n" \
1088 " .set noat \n" \
1089 " # mfhi %0, $ac1 \n" \
1090 " .word 0x00200810 \n" \
1091 " move %0, $1 \n" \
1092 " .set pop \n" \
1093 : "=r" (__treg)); \
1094 __treg; \
1095})
1096
1097#define mfhi2() \
1098({ \
1099 unsigned long __treg; \
1100 \
1101 __asm__ __volatile__( \
1102 " .set push \n" \
1103 " .set noat \n" \
1104 " # mfhi %0, $ac2 \n" \
1105 " .word 0x00400810 \n" \
1106 " move %0, $1 \n" \
1107 " .set pop \n" \
1108 : "=r" (__treg)); \
1109 __treg; \
1110})
1111
1112#define mfhi3() \
1113({ \
1114 unsigned long __treg; \
1115 \
1116 __asm__ __volatile__( \
1117 " .set push \n" \
1118 " .set noat \n" \
1119 " # mfhi %0, $ac3 \n" \
1120 " .word 0x00600810 \n" \
1121 " move %0, $1 \n" \
1122 " .set pop \n" \
1123 : "=r" (__treg)); \
1124 __treg; \
1125})
1126
1127#define mflo0() \
1128({ \
1129 unsigned long __treg; \
1130 \
1131 __asm__ __volatile__( \
1132 " .set push \n" \
1133 " .set noat \n" \
1134 " # mflo %0, $ac0 \n" \
1135 " .word 0x00000812 \n" \
1136 " move %0, $1 \n" \
1137 " .set pop \n" \
1138 : "=r" (__treg)); \
1139 __treg; \
1140})
1141
1142#define mflo1() \
1143({ \
1144 unsigned long __treg; \
1145 \
1146 __asm__ __volatile__( \
1147 " .set push \n" \
1148 " .set noat \n" \
1149 " # mflo %0, $ac1 \n" \
1150 " .word 0x00200812 \n" \
1151 " move %0, $1 \n" \
1152 " .set pop \n" \
1153 : "=r" (__treg)); \
1154 __treg; \
1155})
1156
1157#define mflo2() \
1158({ \
1159 unsigned long __treg; \
1160 \
1161 __asm__ __volatile__( \
1162 " .set push \n" \
1163 " .set noat \n" \
1164 " # mflo %0, $ac2 \n" \
1165 " .word 0x00400812 \n" \
1166 " move %0, $1 \n" \
1167 " .set pop \n" \
1168 : "=r" (__treg)); \
1169 __treg; \
1170})
1171
1172#define mflo3() \
1173({ \
1174 unsigned long __treg; \
1175 \
1176 __asm__ __volatile__( \
1177 " .set push \n" \
1178 " .set noat \n" \
1179 " # mflo %0, $ac3 \n" \
1180 " .word 0x00600812 \n" \
1181 " move %0, $1 \n" \
1182 " .set pop \n" \
1183 : "=r" (__treg)); \
1184 __treg; \
1185})
1186
1187#define mthi0(x) \
1188do { \
1189 __asm__ __volatile__( \
1190 " .set push \n" \
1191 " .set noat \n" \
1192 " move $1, %0 \n" \
1193 " # mthi $1, $ac0 \n" \
1194 " .word 0x00200011 \n" \
1195 " .set pop \n" \
1196 : \
1197 : "r" (x)); \
1198} while (0)
1199
1200#define mthi1(x) \
1201do { \
1202 __asm__ __volatile__( \
1203 " .set push \n" \
1204 " .set noat \n" \
1205 " move $1, %0 \n" \
1206 " # mthi $1, $ac1 \n" \
1207 " .word 0x00200811 \n" \
1208 " .set pop \n" \
1209 : \
1210 : "r" (x)); \
1211} while (0)
1212
1213#define mthi2(x) \
1214do { \
1215 __asm__ __volatile__( \
1216 " .set push \n" \
1217 " .set noat \n" \
1218 " move $1, %0 \n" \
1219 " # mthi $1, $ac2 \n" \
1220 " .word 0x00201011 \n" \
1221 " .set pop \n" \
1222 : \
1223 : "r" (x)); \
1224} while (0)
1225
1226#define mthi3(x) \
1227do { \
1228 __asm__ __volatile__( \
1229 " .set push \n" \
1230 " .set noat \n" \
1231 " move $1, %0 \n" \
1232 " # mthi $1, $ac3 \n" \
1233 " .word 0x00201811 \n" \
1234 " .set pop \n" \
1235 : \
1236 : "r" (x)); \
1237} while (0)
1238
1239#define mtlo0(x) \
1240do { \
1241 __asm__ __volatile__( \
1242 " .set push \n" \
1243 " .set noat \n" \
1244 " move $1, %0 \n" \
1245 " # mtlo $1, $ac0 \n" \
1246 " .word 0x00200013 \n" \
1247 " .set pop \n" \
1248 : \
1249 : "r" (x)); \
1250} while (0)
1251
1252#define mtlo1(x) \
1253do { \
1254 __asm__ __volatile__( \
1255 " .set push \n" \
1256 " .set noat \n" \
1257 " move $1, %0 \n" \
1258 " # mtlo $1, $ac1 \n" \
1259 " .word 0x00200813 \n" \
1260 " .set pop \n" \
1261 : \
1262 : "r" (x)); \
1263} while (0)
1264
1265#define mtlo2(x) \
1266do { \
1267 __asm__ __volatile__( \
1268 " .set push \n" \
1269 " .set noat \n" \
1270 " move $1, %0 \n" \
1271 " # mtlo $1, $ac2 \n" \
1272 " .word 0x00201013 \n" \
1273 " .set pop \n" \
1274 : \
1275 : "r" (x)); \
1276} while (0)
1277
1278#define mtlo3(x) \
1279do { \
1280 __asm__ __volatile__( \
1281 " .set push \n" \
1282 " .set noat \n" \
1283 " move $1, %0 \n" \
1284 " # mtlo $1, $ac3 \n" \
1285 " .word 0x00201813 \n" \
1286 " .set pop \n" \
1287 : \
1288 : "r" (x)); \
1289} while (0)
1290
1291#endif
1292
1293/*
1294 * TLB operations.
1295 *
1296 * It is responsibility of the caller to take care of any TLB hazards.
1297 */
1298static inline void tlb_probe(void)
1299{
1300 __asm__ __volatile__(
1301 ".set noreorder\n\t"
1302 "tlbp\n\t"
1303 ".set reorder");
1304}
1305
1306static inline void tlb_read(void)
1307{
1308#if MIPS34K_MISSED_ITLB_WAR
1309 int res = 0;
1310
1311 __asm__ __volatile__(
1312 " .set push \n"
1313 " .set noreorder \n"
1314 " .set noat \n"
1315 " .set mips32r2 \n"
1316 " .word 0x41610001 # dvpe $1 \n"
1317 " move %0, $1 \n"
1318 " ehb \n"
1319 " .set pop \n"
1320 : "=r" (res));
1321
1322 instruction_hazard();
1323#endif
1324
1325 __asm__ __volatile__(
1326 ".set noreorder\n\t"
1327 "tlbr\n\t"
1328 ".set reorder");
1329
1330#if MIPS34K_MISSED_ITLB_WAR
1331 if ((res & _ULCAST_(1)))
1332 __asm__ __volatile__(
1333 " .set push \n"
1334 " .set noreorder \n"
1335 " .set noat \n"
1336 " .set mips32r2 \n"
1337 " .word 0x41600021 # evpe \n"
1338 " ehb \n"
1339 " .set pop \n");
1340#endif
1341}
1342
1343static inline void tlb_write_indexed(void)
1344{
1345 __asm__ __volatile__(
1346 ".set noreorder\n\t"
1347 "tlbwi\n\t"
1348 ".set reorder");
1349}
1350
1351static inline void tlb_write_random(void)
1352{
1353 __asm__ __volatile__(
1354 ".set noreorder\n\t"
1355 "tlbwr\n\t"
1356 ".set reorder");
1357}
1358
1359/*
1360 * Manipulate bits in a c0 register.
1361 */
1362#ifndef CONFIG_MIPS_MT_SMTC
1363/*
1364 * SMTC Linux requires shutting-down microthread scheduling
1365 * during CP0 register read-modify-write sequences.
1366 */
1367#define __BUILD_SET_C0(name) \
1368static inline unsigned int \
1369set_c0_##name(unsigned int set) \
1370{ \
1371 unsigned int res; \
1372 \
1373 res = read_c0_##name(); \
1374 res |= set; \
1375 write_c0_##name(res); \
1376 \
1377 return res; \
1378} \
1379 \
1380static inline unsigned int \
1381clear_c0_##name(unsigned int clear) \
1382{ \
1383 unsigned int res; \
1384 \
1385 res = read_c0_##name(); \
1386 res &= ~clear; \
1387 write_c0_##name(res); \
1388 \
1389 return res; \
1390} \
1391 \
1392static inline unsigned int \
1393change_c0_##name(unsigned int change, unsigned int new) \
1394{ \
1395 unsigned int res; \
1396 \
1397 res = read_c0_##name(); \
1398 res &= ~change; \
1399 res |= (new & change); \
1400 write_c0_##name(res); \
1401 \
1402 return res; \
1403}
1404
1405#else /* SMTC versions that manage MT scheduling */
1406
1407#include <linux/irqflags.h>
1408
1409/*
1410 * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with
1411 * header file recursion.
1412 */
1413static inline unsigned int __dmt(void)
1414{
1415 int res;
1416
1417 __asm__ __volatile__(
1418 " .set push \n"
1419 " .set mips32r2 \n"
1420 " .set noat \n"
1421 " .word 0x41610BC1 # dmt $1 \n"
1422 " ehb \n"
1423 " move %0, $1 \n"
1424 " .set pop \n"
1425 : "=r" (res));
1426
1427 instruction_hazard();
1428
1429 return res;
1430}
1431
1432#define __VPECONTROL_TE_SHIFT 15
1433#define __VPECONTROL_TE (1UL << __VPECONTROL_TE_SHIFT)
1434
1435#define __EMT_ENABLE __VPECONTROL_TE
1436
1437static inline void __emt(unsigned int previous)
1438{
1439 if ((previous & __EMT_ENABLE))
1440 __asm__ __volatile__(
1441 " .set mips32r2 \n"
1442 " .word 0x41600be1 # emt \n"
1443 " ehb \n"
1444 " .set mips0 \n");
1445}
1446
1447static inline void __ehb(void)
1448{
1449 __asm__ __volatile__(
1450 " .set mips32r2 \n"
1451 " ehb \n" " .set mips0 \n");
1452}
1453
1454/*
1455 * Note that local_irq_save/restore affect TC-specific IXMT state,
1456 * not Status.IE as in non-SMTC kernel.
1457 */
1458
1459#define __BUILD_SET_C0(name) \
1460static inline unsigned int \
1461set_c0_##name(unsigned int set) \
1462{ \
1463 unsigned int res; \
1464 unsigned int omt; \
1465 unsigned long flags; \
1466 \
1467 local_irq_save(flags); \
1468 omt = __dmt(); \
1469 res = read_c0_##name(); \
1470 res |= set; \
1471 write_c0_##name(res); \
1472 __emt(omt); \
1473 local_irq_restore(flags); \
1474 \
1475 return res; \
1476} \
1477 \
1478static inline unsigned int \
1479clear_c0_##name(unsigned int clear) \
1480{ \
1481 unsigned int res; \
1482 unsigned int omt; \
1483 unsigned long flags; \
1484 \
1485 local_irq_save(flags); \
1486 omt = __dmt(); \
1487 res = read_c0_##name(); \
1488 res &= ~clear; \
1489 write_c0_##name(res); \
1490 __emt(omt); \
1491 local_irq_restore(flags); \
1492 \
1493 return res; \
1494} \
1495 \
1496static inline unsigned int \
1497change_c0_##name(unsigned int change, unsigned int new) \
1498{ \
1499 unsigned int res; \
1500 unsigned int omt; \
1501 unsigned long flags; \
1502 \
1503 local_irq_save(flags); \
1504 \
1505 omt = __dmt(); \
1506 res = read_c0_##name(); \
1507 res &= ~change; \
1508 res |= (new & change); \
1509 write_c0_##name(res); \
1510 __emt(omt); \
1511 local_irq_restore(flags); \
1512 \
1513 return res; \
1514}
1515#endif
1516
1517__BUILD_SET_C0(status)
1518__BUILD_SET_C0(cause)
1519__BUILD_SET_C0(config)
1520__BUILD_SET_C0(intcontrol)
1521__BUILD_SET_C0(intctl)
1522__BUILD_SET_C0(srsmap)
1523
1524#endif /* !__ASSEMBLY__ */
1525
1526#endif /* _ASM_MIPSREGS_H */
diff --git a/include/asm-mips/mman.h b/include/asm-mips/mman.h
deleted file mode 100644
index e4d6f1fb1cf7..000000000000
--- a/include/asm-mips/mman.h
+++ /dev/null
@@ -1,77 +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) 1995, 1999, 2002 by Ralf Baechle
7 */
8#ifndef _ASM_MMAN_H
9#define _ASM_MMAN_H
10
11/*
12 * Protections are chosen from these bits, OR'd together. The
13 * implementation does not necessarily support PROT_EXEC or PROT_WRITE
14 * without PROT_READ. The only guarantees are that no writing will be
15 * allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
16 */
17#define PROT_NONE 0x00 /* page can not be accessed */
18#define PROT_READ 0x01 /* page can be read */
19#define PROT_WRITE 0x02 /* page can be written */
20#define PROT_EXEC 0x04 /* page can be executed */
21/* 0x08 reserved for PROT_EXEC_NOFLUSH */
22#define PROT_SEM 0x10 /* page may be used for atomic ops */
23#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
24#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
25
26/*
27 * Flags for mmap
28 */
29#define MAP_SHARED 0x001 /* Share changes */
30#define MAP_PRIVATE 0x002 /* Changes are private */
31#define MAP_TYPE 0x00f /* Mask for type of mapping */
32#define MAP_FIXED 0x010 /* Interpret addr exactly */
33
34/* not used by linux, but here to make sure we don't clash with ABI defines */
35#define MAP_RENAME 0x020 /* Assign page to file */
36#define MAP_AUTOGROW 0x040 /* File may grow by writing */
37#define MAP_LOCAL 0x080 /* Copy on fork/sproc */
38#define MAP_AUTORSRV 0x100 /* Logical swap reserved on demand */
39
40/* These are linux-specific */
41#define MAP_NORESERVE 0x0400 /* don't check for reservations */
42#define MAP_ANONYMOUS 0x0800 /* don't use a file */
43#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
44#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
45#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
46#define MAP_LOCKED 0x8000 /* pages are locked */
47#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
48#define MAP_NONBLOCK 0x20000 /* do not block on IO */
49
50/*
51 * Flags for msync
52 */
53#define MS_ASYNC 0x0001 /* sync memory asynchronously */
54#define MS_INVALIDATE 0x0002 /* invalidate mappings & caches */
55#define MS_SYNC 0x0004 /* synchronous memory sync */
56
57/*
58 * Flags for mlockall
59 */
60#define MCL_CURRENT 1 /* lock all current mappings */
61#define MCL_FUTURE 2 /* lock all future mappings */
62
63#define MADV_NORMAL 0 /* no further special treatment */
64#define MADV_RANDOM 1 /* expect random page references */
65#define MADV_SEQUENTIAL 2 /* expect sequential page references */
66#define MADV_WILLNEED 3 /* will need these pages */
67#define MADV_DONTNEED 4 /* don't need these pages */
68
69/* common parameters: try to keep these consistent across architectures */
70#define MADV_REMOVE 9 /* remove these pages & resources */
71#define MADV_DONTFORK 10 /* don't inherit across fork */
72#define MADV_DOFORK 11 /* do inherit across fork */
73
74/* compatibility flags */
75#define MAP_FILE 0
76
77#endif /* _ASM_MMAN_H */
diff --git a/include/asm-mips/mmu.h b/include/asm-mips/mmu.h
deleted file mode 100644
index 4063edd79623..000000000000
--- a/include/asm-mips/mmu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_MMU_H
2#define __ASM_MMU_H
3
4typedef unsigned long mm_context_t[NR_CPUS];
5
6#endif /* __ASM_MMU_H */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
deleted file mode 100644
index 0c4f245eaeb2..000000000000
--- a/include/asm-mips/mmu_context.h
+++ /dev/null
@@ -1,297 +0,0 @@
1/*
2 * Switch a MMU context.
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) 1996, 1997, 1998, 1999 by Ralf Baechle
9 * Copyright (C) 1999 Silicon Graphics, Inc.
10 */
11#ifndef _ASM_MMU_CONTEXT_H
12#define _ASM_MMU_CONTEXT_H
13
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/slab.h>
17#include <asm/cacheflush.h>
18#include <asm/tlbflush.h>
19#ifdef CONFIG_MIPS_MT_SMTC
20#include <asm/mipsmtregs.h>
21#include <asm/smtc.h>
22#endif /* SMTC */
23#include <asm-generic/mm_hooks.h>
24
25/*
26 * For the fast tlb miss handlers, we keep a per cpu array of pointers
27 * to the current pgd for each processor. Also, the proc. id is stuffed
28 * into the context register.
29 */
30extern unsigned long pgd_current[];
31
32#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
33 pgd_current[smp_processor_id()] = (unsigned long)(pgd)
34
35#ifdef CONFIG_32BIT
36#define TLBMISS_HANDLER_SETUP() \
37 write_c0_context((unsigned long) smp_processor_id() << 25); \
38 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
39#endif
40#ifdef CONFIG_64BIT
41#define TLBMISS_HANDLER_SETUP() \
42 write_c0_context((unsigned long) smp_processor_id() << 26); \
43 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
44#endif
45
46#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
47
48#define ASID_INC 0x40
49#define ASID_MASK 0xfc0
50
51#elif defined(CONFIG_CPU_R8000)
52
53#define ASID_INC 0x10
54#define ASID_MASK 0xff0
55
56#elif defined(CONFIG_CPU_RM9000)
57
58#define ASID_INC 0x1
59#define ASID_MASK 0xfff
60
61/* SMTC/34K debug hack - but maybe we'll keep it */
62#elif defined(CONFIG_MIPS_MT_SMTC)
63
64#define ASID_INC 0x1
65extern unsigned long smtc_asid_mask;
66#define ASID_MASK (smtc_asid_mask)
67#define HW_ASID_MASK 0xff
68/* End SMTC/34K debug hack */
69#else /* FIXME: not correct for R6000 */
70
71#define ASID_INC 0x1
72#define ASID_MASK 0xff
73
74#endif
75
76#define cpu_context(cpu, mm) ((mm)->context[cpu])
77#define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)
78#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
79
80static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
81{
82}
83
84/*
85 * All unused by hardware upper bits will be considered
86 * as a software asid extension.
87 */
88#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
89#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
90
91#ifndef CONFIG_MIPS_MT_SMTC
92/* Normal, classic MIPS get_new_mmu_context */
93static inline void
94get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
95{
96 unsigned long asid = asid_cache(cpu);
97
98 if (! ((asid += ASID_INC) & ASID_MASK) ) {
99 if (cpu_has_vtag_icache)
100 flush_icache_all();
101 local_flush_tlb_all(); /* start new asid cycle */
102 if (!asid) /* fix version if needed */
103 asid = ASID_FIRST_VERSION;
104 }
105 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
106}
107
108#else /* CONFIG_MIPS_MT_SMTC */
109
110#define get_new_mmu_context(mm, cpu) smtc_get_new_mmu_context((mm), (cpu))
111
112#endif /* CONFIG_MIPS_MT_SMTC */
113
114/*
115 * Initialize the context related info for a new mm_struct
116 * instance.
117 */
118static inline int
119init_new_context(struct task_struct *tsk, struct mm_struct *mm)
120{
121 int i;
122
123 for_each_online_cpu(i)
124 cpu_context(i, mm) = 0;
125
126 return 0;
127}
128
129static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
130 struct task_struct *tsk)
131{
132 unsigned int cpu = smp_processor_id();
133 unsigned long flags;
134#ifdef CONFIG_MIPS_MT_SMTC
135 unsigned long oldasid;
136 unsigned long mtflags;
137 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
138 local_irq_save(flags);
139 mtflags = dvpe();
140#else /* Not SMTC */
141 local_irq_save(flags);
142#endif /* CONFIG_MIPS_MT_SMTC */
143
144 /* Check if our ASID is of an older version and thus invalid */
145 if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK)
146 get_new_mmu_context(next, cpu);
147#ifdef CONFIG_MIPS_MT_SMTC
148 /*
149 * If the EntryHi ASID being replaced happens to be
150 * the value flagged at ASID recycling time as having
151 * an extended life, clear the bit showing it being
152 * in use by this "CPU", and if that's the last bit,
153 * free up the ASID value for use and flush any old
154 * instances of it from the TLB.
155 */
156 oldasid = (read_c0_entryhi() & ASID_MASK);
157 if(smtc_live_asid[mytlb][oldasid]) {
158 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
159 if(smtc_live_asid[mytlb][oldasid] == 0)
160 smtc_flush_tlb_asid(oldasid);
161 }
162 /*
163 * Tread softly on EntryHi, and so long as we support
164 * having ASID_MASK smaller than the hardware maximum,
165 * make sure no "soft" bits become "hard"...
166 */
167 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK)
168 | (cpu_context(cpu, next) & ASID_MASK));
169 ehb(); /* Make sure it propagates to TCStatus */
170 evpe(mtflags);
171#else
172 write_c0_entryhi(cpu_context(cpu, next));
173#endif /* CONFIG_MIPS_MT_SMTC */
174 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
175
176 /*
177 * Mark current->active_mm as not "active" anymore.
178 * We don't want to mislead possible IPI tlb flush routines.
179 */
180 cpu_clear(cpu, prev->cpu_vm_mask);
181 cpu_set(cpu, next->cpu_vm_mask);
182
183 local_irq_restore(flags);
184}
185
186/*
187 * Destroy context related info for an mm_struct that is about
188 * to be put to rest.
189 */
190static inline void destroy_context(struct mm_struct *mm)
191{
192}
193
194#define deactivate_mm(tsk, mm) do { } while (0)
195
196/*
197 * After we have set current->mm to a new value, this activates
198 * the context for the new mm so we see the new mappings.
199 */
200static inline void
201activate_mm(struct mm_struct *prev, struct mm_struct *next)
202{
203 unsigned long flags;
204 unsigned int cpu = smp_processor_id();
205
206#ifdef CONFIG_MIPS_MT_SMTC
207 unsigned long oldasid;
208 unsigned long mtflags;
209 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
210#endif /* CONFIG_MIPS_MT_SMTC */
211
212 local_irq_save(flags);
213
214 /* Unconditionally get a new ASID. */
215 get_new_mmu_context(next, cpu);
216
217#ifdef CONFIG_MIPS_MT_SMTC
218 /* See comments for similar code above */
219 mtflags = dvpe();
220 oldasid = read_c0_entryhi() & ASID_MASK;
221 if(smtc_live_asid[mytlb][oldasid]) {
222 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
223 if(smtc_live_asid[mytlb][oldasid] == 0)
224 smtc_flush_tlb_asid(oldasid);
225 }
226 /* See comments for similar code above */
227 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) |
228 (cpu_context(cpu, next) & ASID_MASK));
229 ehb(); /* Make sure it propagates to TCStatus */
230 evpe(mtflags);
231#else
232 write_c0_entryhi(cpu_context(cpu, next));
233#endif /* CONFIG_MIPS_MT_SMTC */
234 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
235
236 /* mark mmu ownership change */
237 cpu_clear(cpu, prev->cpu_vm_mask);
238 cpu_set(cpu, next->cpu_vm_mask);
239
240 local_irq_restore(flags);
241}
242
243/*
244 * If mm is currently active_mm, we can't really drop it. Instead,
245 * we will get a new one for it.
246 */
247static inline void
248drop_mmu_context(struct mm_struct *mm, unsigned cpu)
249{
250 unsigned long flags;
251#ifdef CONFIG_MIPS_MT_SMTC
252 unsigned long oldasid;
253 /* Can't use spinlock because called from TLB flush within DVPE */
254 unsigned int prevvpe;
255 int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id;
256#endif /* CONFIG_MIPS_MT_SMTC */
257
258 local_irq_save(flags);
259
260 if (cpu_isset(cpu, mm->cpu_vm_mask)) {
261 get_new_mmu_context(mm, cpu);
262#ifdef CONFIG_MIPS_MT_SMTC
263 /* See comments for similar code above */
264 prevvpe = dvpe();
265 oldasid = (read_c0_entryhi() & ASID_MASK);
266 if (smtc_live_asid[mytlb][oldasid]) {
267 smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu);
268 if(smtc_live_asid[mytlb][oldasid] == 0)
269 smtc_flush_tlb_asid(oldasid);
270 }
271 /* See comments for similar code above */
272 write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK)
273 | cpu_asid(cpu, mm));
274 ehb(); /* Make sure it propagates to TCStatus */
275 evpe(prevvpe);
276#else /* not CONFIG_MIPS_MT_SMTC */
277 write_c0_entryhi(cpu_asid(cpu, mm));
278#endif /* CONFIG_MIPS_MT_SMTC */
279 } else {
280 /* will get a new context next time */
281#ifndef CONFIG_MIPS_MT_SMTC
282 cpu_context(cpu, mm) = 0;
283#else /* SMTC */
284 int i;
285
286 /* SMTC shares the TLB (and ASIDs) across VPEs */
287 for_each_online_cpu(i) {
288 if((smtc_status & SMTC_TLB_SHARED)
289 || (cpu_data[i].vpe_id == cpu_data[cpu].vpe_id))
290 cpu_context(i, mm) = 0;
291 }
292#endif /* CONFIG_MIPS_MT_SMTC */
293 }
294 local_irq_restore(flags);
295}
296
297#endif /* _ASM_MMU_CONTEXT_H */
diff --git a/include/asm-mips/mmzone.h b/include/asm-mips/mmzone.h
deleted file mode 100644
index f53ec54c92ff..000000000000
--- a/include/asm-mips/mmzone.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
3 * Rewritten for Linux 2.6 by Christoph Hellwig (hch@lst.de) Jan 2004
4 */
5#ifndef _ASM_MMZONE_H_
6#define _ASM_MMZONE_H_
7
8#include <asm/page.h>
9#include <mmzone.h>
10
11#ifdef CONFIG_DISCONTIGMEM
12
13#define pfn_to_nid(pfn) pa_to_nid((pfn) << PAGE_SHIFT)
14
15#endif /* CONFIG_DISCONTIGMEM */
16
17#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h
deleted file mode 100644
index de6d09ebbd80..000000000000
--- a/include/asm-mips/module.h
+++ /dev/null
@@ -1,136 +0,0 @@
1#ifndef _ASM_MODULE_H
2#define _ASM_MODULE_H
3
4#include <linux/list.h>
5#include <asm/uaccess.h>
6
7struct mod_arch_specific {
8 /* Data Bus Error exception tables */
9 struct list_head dbe_list;
10 const struct exception_table_entry *dbe_start;
11 const struct exception_table_entry *dbe_end;
12};
13
14typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
15
16typedef struct {
17 Elf64_Addr r_offset; /* Address of relocation. */
18 Elf64_Word r_sym; /* Symbol index. */
19 Elf64_Byte r_ssym; /* Special symbol. */
20 Elf64_Byte r_type3; /* Third relocation. */
21 Elf64_Byte r_type2; /* Second relocation. */
22 Elf64_Byte r_type; /* First relocation. */
23} Elf64_Mips_Rel;
24
25typedef struct {
26 Elf64_Addr r_offset; /* Address of relocation. */
27 Elf64_Word r_sym; /* Symbol index. */
28 Elf64_Byte r_ssym; /* Special symbol. */
29 Elf64_Byte r_type3; /* Third relocation. */
30 Elf64_Byte r_type2; /* Second relocation. */
31 Elf64_Byte r_type; /* First relocation. */
32 Elf64_Sxword r_addend; /* Addend. */
33} Elf64_Mips_Rela;
34
35#ifdef CONFIG_32BIT
36
37#define Elf_Shdr Elf32_Shdr
38#define Elf_Sym Elf32_Sym
39#define Elf_Ehdr Elf32_Ehdr
40#define Elf_Addr Elf32_Addr
41
42#define Elf_Mips_Rel Elf32_Rel
43#define Elf_Mips_Rela Elf32_Rela
44
45#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
46#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
47
48#endif
49
50#ifdef CONFIG_64BIT
51
52#define Elf_Shdr Elf64_Shdr
53#define Elf_Sym Elf64_Sym
54#define Elf_Ehdr Elf64_Ehdr
55#define Elf_Addr Elf64_Addr
56
57#define Elf_Mips_Rel Elf64_Mips_Rel
58#define Elf_Mips_Rela Elf64_Mips_Rela
59
60#define ELF_MIPS_R_SYM(rel) (rel.r_sym)
61#define ELF_MIPS_R_TYPE(rel) (rel.r_type)
62
63#endif
64
65#ifdef CONFIG_MODULES
66/* Given an address, look for it in the exception tables. */
67const struct exception_table_entry*search_module_dbetables(unsigned long addr);
68#else
69/* Given an address, look for it in the exception tables. */
70static inline const struct exception_table_entry *
71search_module_dbetables(unsigned long addr)
72{
73 return NULL;
74}
75#endif
76
77#ifdef CONFIG_CPU_MIPS32_R1
78#define MODULE_PROC_FAMILY "MIPS32_R1 "
79#elif defined CONFIG_CPU_MIPS32_R2
80#define MODULE_PROC_FAMILY "MIPS32_R2 "
81#elif defined CONFIG_CPU_MIPS64_R1
82#define MODULE_PROC_FAMILY "MIPS64_R1 "
83#elif defined CONFIG_CPU_MIPS64_R2
84#define MODULE_PROC_FAMILY "MIPS64_R2 "
85#elif defined CONFIG_CPU_R3000
86#define MODULE_PROC_FAMILY "R3000 "
87#elif defined CONFIG_CPU_TX39XX
88#define MODULE_PROC_FAMILY "TX39XX "
89#elif defined CONFIG_CPU_VR41XX
90#define MODULE_PROC_FAMILY "VR41XX "
91#elif defined CONFIG_CPU_R4300
92#define MODULE_PROC_FAMILY "R4300 "
93#elif defined CONFIG_CPU_R4X00
94#define MODULE_PROC_FAMILY "R4X00 "
95#elif defined CONFIG_CPU_TX49XX
96#define MODULE_PROC_FAMILY "TX49XX "
97#elif defined CONFIG_CPU_R5000
98#define MODULE_PROC_FAMILY "R5000 "
99#elif defined CONFIG_CPU_R5432
100#define MODULE_PROC_FAMILY "R5432 "
101#elif defined CONFIG_CPU_R6000
102#define MODULE_PROC_FAMILY "R6000 "
103#elif defined CONFIG_CPU_NEVADA
104#define MODULE_PROC_FAMILY "NEVADA "
105#elif defined CONFIG_CPU_R8000
106#define MODULE_PROC_FAMILY "R8000 "
107#elif defined CONFIG_CPU_R10000
108#define MODULE_PROC_FAMILY "R10000 "
109#elif defined CONFIG_CPU_RM7000
110#define MODULE_PROC_FAMILY "RM7000 "
111#elif defined CONFIG_CPU_RM9000
112#define MODULE_PROC_FAMILY "RM9000 "
113#elif defined CONFIG_CPU_SB1
114#define MODULE_PROC_FAMILY "SB1 "
115#elif defined CONFIG_CPU_LOONGSON2
116#define MODULE_PROC_FAMILY "LOONGSON2 "
117#else
118#error MODULE_PROC_FAMILY undefined for your processor configuration
119#endif
120
121#ifdef CONFIG_32BIT
122#define MODULE_KERNEL_TYPE "32BIT "
123#elif defined CONFIG_64BIT
124#define MODULE_KERNEL_TYPE "64BIT "
125#endif
126
127#ifdef CONFIG_MIPS_MT_SMTC
128#define MODULE_KERNEL_SMTC "MT_SMTC "
129#else
130#define MODULE_KERNEL_SMTC ""
131#endif
132
133#define MODULE_ARCH_VERMAGIC \
134 MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC
135
136#endif /* _ASM_MODULE_H */
diff --git a/include/asm-mips/msc01_ic.h b/include/asm-mips/msc01_ic.h
deleted file mode 100644
index 7989b9ffc1d2..000000000000
--- a/include/asm-mips/msc01_ic.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * PCI Register definitions for the MIPS System Controller.
3 *
4 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __ASM_MIPS_BOARDS_MSC01_IC_H
12#define __ASM_MIPS_BOARDS_MSC01_IC_H
13
14/*****************************************************************************
15 * Register offset addresses
16 *****************************************************************************/
17
18#define MSC01_IC_RST_OFS 0x00008 /* Software reset */
19#define MSC01_IC_ENAL_OFS 0x00100 /* Int_in enable mask 31:0 */
20#define MSC01_IC_ENAH_OFS 0x00108 /* Int_in enable mask 63:32 */
21#define MSC01_IC_DISL_OFS 0x00120 /* Int_in disable mask 31:0 */
22#define MSC01_IC_DISH_OFS 0x00128 /* Int_in disable mask 63:32 */
23#define MSC01_IC_ISBL_OFS 0x00140 /* Raw int_in 31:0 */
24#define MSC01_IC_ISBH_OFS 0x00148 /* Raw int_in 63:32 */
25#define MSC01_IC_ISAL_OFS 0x00160 /* Masked int_in 31:0 */
26#define MSC01_IC_ISAH_OFS 0x00168 /* Masked int_in 63:32 */
27#define MSC01_IC_LVL_OFS 0x00180 /* Disable priority int_out */
28#define MSC01_IC_RAMW_OFS 0x00180 /* Shadow set RAM (EI) */
29#define MSC01_IC_OSB_OFS 0x00188 /* Raw int_out */
30#define MSC01_IC_OSA_OFS 0x00190 /* Masked int_out */
31#define MSC01_IC_GENA_OFS 0x00198 /* Global HW int enable */
32#define MSC01_IC_BASE_OFS 0x001a0 /* Base address of IC_VEC */
33#define MSC01_IC_VEC_OFS 0x001b0 /* Active int's vector address */
34#define MSC01_IC_EOI_OFS 0x001c0 /* Enable lower level ints */
35#define MSC01_IC_CFG_OFS 0x001c8 /* Configuration register */
36#define MSC01_IC_TRLD_OFS 0x001d0 /* Interval timer reload val */
37#define MSC01_IC_TVAL_OFS 0x001e0 /* Interval timer current val */
38#define MSC01_IC_TCFG_OFS 0x001f0 /* Interval timer config */
39#define MSC01_IC_SUP_OFS 0x00200 /* Set up int_in line 0 */
40#define MSC01_IC_ENA_OFS 0x00800 /* Int_in enable mask 63:0 */
41#define MSC01_IC_DIS_OFS 0x00820 /* Int_in disable mask 63:0 */
42#define MSC01_IC_ISB_OFS 0x00840 /* Raw int_in 63:0 */
43#define MSC01_IC_ISA_OFS 0x00860 /* Masked int_in 63:0 */
44
45/*****************************************************************************
46 * Register field encodings
47 *****************************************************************************/
48
49#define MSC01_IC_RST_RST_SHF 0
50#define MSC01_IC_RST_RST_MSK 0x00000001
51#define MSC01_IC_RST_RST_BIT MSC01_IC_RST_RST_MSK
52#define MSC01_IC_LVL_LVL_SHF 0
53#define MSC01_IC_LVL_LVL_MSK 0x000000ff
54#define MSC01_IC_LVL_SPUR_SHF 16
55#define MSC01_IC_LVL_SPUR_MSK 0x00010000
56#define MSC01_IC_LVL_SPUR_BIT MSC01_IC_LVL_SPUR_MSK
57#define MSC01_IC_RAMW_RIPL_SHF 0
58#define MSC01_IC_RAMW_RIPL_MSK 0x0000003f
59#define MSC01_IC_RAMW_DATA_SHF 6
60#define MSC01_IC_RAMW_DATA_MSK 0x00000fc0
61#define MSC01_IC_RAMW_ADDR_SHF 25
62#define MSC01_IC_RAMW_ADDR_MSK 0x7e000000
63#define MSC01_IC_RAMW_READ_SHF 31
64#define MSC01_IC_RAMW_READ_MSK 0x80000000
65#define MSC01_IC_RAMW_READ_BIT MSC01_IC_RAMW_READ_MSK
66#define MSC01_IC_OSB_OSB_SHF 0
67#define MSC01_IC_OSB_OSB_MSK 0x000000ff
68#define MSC01_IC_OSA_OSA_SHF 0
69#define MSC01_IC_OSA_OSA_MSK 0x000000ff
70#define MSC01_IC_GENA_GENA_SHF 0
71#define MSC01_IC_GENA_GENA_MSK 0x00000001
72#define MSC01_IC_GENA_GENA_BIT MSC01_IC_GENA_GENA_MSK
73#define MSC01_IC_CFG_DIS_SHF 0
74#define MSC01_IC_CFG_DIS_MSK 0x00000001
75#define MSC01_IC_CFG_DIS_BIT MSC01_IC_CFG_DIS_MSK
76#define MSC01_IC_CFG_SHFT_SHF 8
77#define MSC01_IC_CFG_SHFT_MSK 0x00000f00
78#define MSC01_IC_TCFG_ENA_SHF 0
79#define MSC01_IC_TCFG_ENA_MSK 0x00000001
80#define MSC01_IC_TCFG_ENA_BIT MSC01_IC_TCFG_ENA_MSK
81#define MSC01_IC_TCFG_INT_SHF 8
82#define MSC01_IC_TCFG_INT_MSK 0x00000100
83#define MSC01_IC_TCFG_INT_BIT MSC01_IC_TCFG_INT_MSK
84#define MSC01_IC_TCFG_EDGE_SHF 16
85#define MSC01_IC_TCFG_EDGE_MSK 0x00010000
86#define MSC01_IC_TCFG_EDGE_BIT MSC01_IC_TCFG_EDGE_MSK
87#define MSC01_IC_SUP_PRI_SHF 0
88#define MSC01_IC_SUP_PRI_MSK 0x00000007
89#define MSC01_IC_SUP_EDGE_SHF 8
90#define MSC01_IC_SUP_EDGE_MSK 0x00000100
91#define MSC01_IC_SUP_EDGE_BIT MSC01_IC_SUP_EDGE_MSK
92#define MSC01_IC_SUP_STEP 8
93
94/*
95 * MIPS System controller interrupt register base.
96 *
97 */
98
99/*****************************************************************************
100 * Absolute register addresses
101 *****************************************************************************/
102
103#define MSC01_IC_RST (MSC01_IC_REG_BASE + MSC01_IC_RST_OFS)
104#define MSC01_IC_ENAL (MSC01_IC_REG_BASE + MSC01_IC_ENAL_OFS)
105#define MSC01_IC_ENAH (MSC01_IC_REG_BASE + MSC01_IC_ENAH_OFS)
106#define MSC01_IC_DISL (MSC01_IC_REG_BASE + MSC01_IC_DISL_OFS)
107#define MSC01_IC_DISH (MSC01_IC_REG_BASE + MSC01_IC_DISH_OFS)
108#define MSC01_IC_ISBL (MSC01_IC_REG_BASE + MSC01_IC_ISBL_OFS)
109#define MSC01_IC_ISBH (MSC01_IC_REG_BASE + MSC01_IC_ISBH_OFS)
110#define MSC01_IC_ISAL (MSC01_IC_REG_BASE + MSC01_IC_ISAL_OFS)
111#define MSC01_IC_ISAH (MSC01_IC_REG_BASE + MSC01_IC_ISAH_OFS)
112#define MSC01_IC_LVL (MSC01_IC_REG_BASE + MSC01_IC_LVL_OFS)
113#define MSC01_IC_RAMW (MSC01_IC_REG_BASE + MSC01_IC_RAMW_OFS)
114#define MSC01_IC_OSB (MSC01_IC_REG_BASE + MSC01_IC_OSB_OFS)
115#define MSC01_IC_OSA (MSC01_IC_REG_BASE + MSC01_IC_OSA_OFS)
116#define MSC01_IC_GENA (MSC01_IC_REG_BASE + MSC01_IC_GENA_OFS)
117#define MSC01_IC_BASE (MSC01_IC_REG_BASE + MSC01_IC_BASE_OFS)
118#define MSC01_IC_VEC (MSC01_IC_REG_BASE + MSC01_IC_VEC_OFS)
119#define MSC01_IC_EOI (MSC01_IC_REG_BASE + MSC01_IC_EOI_OFS)
120#define MSC01_IC_CFG (MSC01_IC_REG_BASE + MSC01_IC_CFG_OFS)
121#define MSC01_IC_TRLD (MSC01_IC_REG_BASE + MSC01_IC_TRLD_OFS)
122#define MSC01_IC_TVAL (MSC01_IC_REG_BASE + MSC01_IC_TVAL_OFS)
123#define MSC01_IC_TCFG (MSC01_IC_REG_BASE + MSC01_IC_TCFG_OFS)
124#define MSC01_IC_SUP (MSC01_IC_REG_BASE + MSC01_IC_SUP_OFS)
125#define MSC01_IC_ENA (MSC01_IC_REG_BASE + MSC01_IC_ENA_OFS)
126#define MSC01_IC_DIS (MSC01_IC_REG_BASE + MSC01_IC_DIS_OFS)
127#define MSC01_IC_ISB (MSC01_IC_REG_BASE + MSC01_IC_ISB_OFS)
128#define MSC01_IC_ISA (MSC01_IC_REG_BASE + MSC01_IC_ISA_OFS)
129
130/*
131 * Soc-it interrupts are configurable.
132 * Every board describes its IRQ mapping with this table.
133 */
134typedef struct msc_irqmap {
135 int im_irq;
136 int im_type;
137 int im_lvl;
138} msc_irqmap_t;
139
140/* im_type */
141#define MSC01_IRQ_LEVEL 0
142#define MSC01_IRQ_EDGE 1
143
144extern void __init init_msc_irqs(unsigned long icubase, unsigned int base, msc_irqmap_t *imp, int nirq);
145extern void ll_msc_irq(void);
146
147#endif /* __ASM_MIPS_BOARDS_MSC01_IC_H */
148
diff --git a/include/asm-mips/msgbuf.h b/include/asm-mips/msgbuf.h
deleted file mode 100644
index 0d6c7f14de31..000000000000
--- a/include/asm-mips/msgbuf.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _ASM_MSGBUF_H
2#define _ASM_MSGBUF_H
3
4
5/*
6 * The msqid64_ds structure for the MIPS architecture.
7 * Note extra padding because this structure is passed back and forth
8 * between kernel and user space.
9 *
10 * Pad space is left for:
11 * - extension of time_t to 64-bit on 32-bitsystem to solve the y2038 problem
12 * - 2 miscellaneous unsigned long values
13 */
14
15struct msqid64_ds {
16 struct ipc64_perm msg_perm;
17#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
18 unsigned long __unused1;
19#endif
20 __kernel_time_t msg_stime; /* last msgsnd time */
21#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
22 unsigned long __unused1;
23#endif
24#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
25 unsigned long __unused2;
26#endif
27 __kernel_time_t msg_rtime; /* last msgrcv time */
28#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
29 unsigned long __unused2;
30#endif
31#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
32 unsigned long __unused3;
33#endif
34 __kernel_time_t msg_ctime; /* last change time */
35#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN)
36 unsigned long __unused3;
37#endif
38 unsigned long msg_cbytes; /* current number of bytes on queue */
39 unsigned long msg_qnum; /* number of messages in queue */
40 unsigned long msg_qbytes; /* max number of bytes on queue */
41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
42 __kernel_pid_t msg_lrpid; /* last receive pid */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47#endif /* _ASM_MSGBUF_H */
diff --git a/include/asm-mips/mutex.h b/include/asm-mips/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-mips/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-mips/nile4.h b/include/asm-mips/nile4.h
deleted file mode 100644
index c3ca959aa4d9..000000000000
--- a/include/asm-mips/nile4.h
+++ /dev/null
@@ -1,310 +0,0 @@
1/*
2 * asm-mips/nile4.h -- NEC Vrc-5074 Nile 4 definitions
3 *
4 * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
5 * Sony Software Development Center Europe (SDCE), Brussels
6 *
7 * This file is based on the following documentation:
8 *
9 * NEC Vrc 5074 System Controller Data Sheet, June 1998
10 */
11
12#ifndef _ASM_NILE4_H
13#define _ASM_NILE4_H
14
15#define NILE4_BASE 0xbfa00000
16#define NILE4_SIZE 0x00200000 /* 2 MB */
17
18
19 /*
20 * Physical Device Address Registers (PDARs)
21 */
22
23#define NILE4_SDRAM0 0x0000 /* SDRAM Bank 0 [R/W] */
24#define NILE4_SDRAM1 0x0008 /* SDRAM Bank 1 [R/W] */
25#define NILE4_DCS2 0x0010 /* Device Chip-Select 2 [R/W] */
26#define NILE4_DCS3 0x0018 /* Device Chip-Select 3 [R/W] */
27#define NILE4_DCS4 0x0020 /* Device Chip-Select 4 [R/W] */
28#define NILE4_DCS5 0x0028 /* Device Chip-Select 5 [R/W] */
29#define NILE4_DCS6 0x0030 /* Device Chip-Select 6 [R/W] */
30#define NILE4_DCS7 0x0038 /* Device Chip-Select 7 [R/W] */
31#define NILE4_DCS8 0x0040 /* Device Chip-Select 8 [R/W] */
32#define NILE4_PCIW0 0x0060 /* PCI Address Window 0 [R/W] */
33#define NILE4_PCIW1 0x0068 /* PCI Address Window 1 [R/W] */
34#define NILE4_INTCS 0x0070 /* Controller Internal Registers and Devices */
35 /* [R/W] */
36#define NILE4_BOOTCS 0x0078 /* Boot ROM Chip-Select [R/W] */
37
38
39 /*
40 * CPU Interface Registers
41 */
42
43#define NILE4_CPUSTAT 0x0080 /* CPU Status [R/W] */
44#define NILE4_INTCTRL 0x0088 /* Interrupt Control [R/W] */
45#define NILE4_INTSTAT0 0x0090 /* Interrupt Status 0 [R] */
46#define NILE4_INTSTAT1 0x0098 /* Interrupt Status 1 and CPU Interrupt */
47 /* Enable [R/W] */
48#define NILE4_INTCLR 0x00A0 /* Interrupt Clear [R/W] */
49#define NILE4_INTPPES 0x00A8 /* PCI Interrupt Control [R/W] */
50
51
52 /*
53 * Memory-Interface Registers
54 */
55
56#define NILE4_MEMCTRL 0x00C0 /* Memory Control */
57#define NILE4_ACSTIME 0x00C8 /* Memory Access Timing [R/W] */
58#define NILE4_CHKERR 0x00D0 /* Memory Check Error Status [R] */
59
60
61 /*
62 * PCI-Bus Registers
63 */
64
65#define NILE4_PCICTRL 0x00E0 /* PCI Control [R/W] */
66#define NILE4_PCIARB 0x00E8 /* PCI Arbiter [R/W] */
67#define NILE4_PCIINIT0 0x00F0 /* PCI Master (Initiator) 0 [R/W] */
68#define NILE4_PCIINIT1 0x00F8 /* PCI Master (Initiator) 1 [R/W] */
69#define NILE4_PCIERR 0x00B8 /* PCI Error [R/W] */
70
71
72 /*
73 * Local-Bus Registers
74 */
75
76#define NILE4_LCNFG 0x0100 /* Local Bus Configuration [R/W] */
77#define NILE4_LCST2 0x0110 /* Local Bus Chip-Select Timing 2 [R/W] */
78#define NILE4_LCST3 0x0118 /* Local Bus Chip-Select Timing 3 [R/W] */
79#define NILE4_LCST4 0x0120 /* Local Bus Chip-Select Timing 4 [R/W] */
80#define NILE4_LCST5 0x0128 /* Local Bus Chip-Select Timing 5 [R/W] */
81#define NILE4_LCST6 0x0130 /* Local Bus Chip-Select Timing 6 [R/W] */
82#define NILE4_LCST7 0x0138 /* Local Bus Chip-Select Timing 7 [R/W] */
83#define NILE4_LCST8 0x0140 /* Local Bus Chip-Select Timing 8 [R/W] */
84#define NILE4_DCSFN 0x0150 /* Device Chip-Select Muxing and Output */
85 /* Enables [R/W] */
86#define NILE4_DCSIO 0x0158 /* Device Chip-Selects As I/O Bits [R/W] */
87#define NILE4_BCST 0x0178 /* Local Boot Chip-Select Timing [R/W] */
88
89
90 /*
91 * DMA Registers
92 */
93
94#define NILE4_DMACTRL0 0x0180 /* DMA Control 0 [R/W] */
95#define NILE4_DMASRCA0 0x0188 /* DMA Source Address 0 [R/W] */
96#define NILE4_DMADESA0 0x0190 /* DMA Destination Address 0 [R/W] */
97#define NILE4_DMACTRL1 0x0198 /* DMA Control 1 [R/W] */
98#define NILE4_DMASRCA1 0x01A0 /* DMA Source Address 1 [R/W] */
99#define NILE4_DMADESA1 0x01A8 /* DMA Destination Address 1 [R/W] */
100
101
102 /*
103 * Timer Registers
104 */
105
106#define NILE4_T0CTRL 0x01C0 /* SDRAM Refresh Control [R/W] */
107#define NILE4_T0CNTR 0x01C8 /* SDRAM Refresh Counter [R/W] */
108#define NILE4_T1CTRL 0x01D0 /* CPU-Bus Read Time-Out Control [R/W] */
109#define NILE4_T1CNTR 0x01D8 /* CPU-Bus Read Time-Out Counter [R/W] */
110#define NILE4_T2CTRL 0x01E0 /* General-Purpose Timer Control [R/W] */
111#define NILE4_T2CNTR 0x01E8 /* General-Purpose Timer Counter [R/W] */
112#define NILE4_T3CTRL 0x01F0 /* Watchdog Timer Control [R/W] */
113#define NILE4_T3CNTR 0x01F8 /* Watchdog Timer Counter [R/W] */
114
115
116 /*
117 * PCI Configuration Space Registers
118 */
119
120#define NILE4_PCI_BASE 0x0200
121
122#define NILE4_VID 0x0200 /* PCI Vendor ID [R] */
123#define NILE4_DID 0x0202 /* PCI Device ID [R] */
124#define NILE4_PCICMD 0x0204 /* PCI Command [R/W] */
125#define NILE4_PCISTS 0x0206 /* PCI Status [R/W] */
126#define NILE4_REVID 0x0208 /* PCI Revision ID [R] */
127#define NILE4_CLASS 0x0209 /* PCI Class Code [R] */
128#define NILE4_CLSIZ 0x020C /* PCI Cache Line Size [R/W] */
129#define NILE4_MLTIM 0x020D /* PCI Latency Timer [R/W] */
130#define NILE4_HTYPE 0x020E /* PCI Header Type [R] */
131#define NILE4_BIST 0x020F /* BIST [R] (unimplemented) */
132#define NILE4_BARC 0x0210 /* PCI Base Address Register Control [R/W] */
133#define NILE4_BAR0 0x0218 /* PCI Base Address Register 0 [R/W] */
134#define NILE4_BAR1 0x0220 /* PCI Base Address Register 1 [R/W] */
135#define NILE4_CIS 0x0228 /* PCI Cardbus CIS Pointer [R] */
136 /* (unimplemented) */
137#define NILE4_SSVID 0x022C /* PCI Sub-System Vendor ID [R/W] */
138#define NILE4_SSID 0x022E /* PCI Sub-System ID [R/W] */
139#define NILE4_ROM 0x0230 /* Expansion ROM Base Address [R] */
140 /* (unimplemented) */
141#define NILE4_INTLIN 0x023C /* PCI Interrupt Line [R/W] */
142#define NILE4_INTPIN 0x023D /* PCI Interrupt Pin [R] */
143#define NILE4_MINGNT 0x023E /* PCI Min_Gnt [R] (unimplemented) */
144#define NILE4_MAXLAT 0x023F /* PCI Max_Lat [R] (unimplemented) */
145#define NILE4_BAR2 0x0240 /* PCI Base Address Register 2 [R/W] */
146#define NILE4_BAR3 0x0248 /* PCI Base Address Register 3 [R/W] */
147#define NILE4_BAR4 0x0250 /* PCI Base Address Register 4 [R/W] */
148#define NILE4_BAR5 0x0258 /* PCI Base Address Register 5 [R/W] */
149#define NILE4_BAR6 0x0260 /* PCI Base Address Register 6 [R/W] */
150#define NILE4_BAR7 0x0268 /* PCI Base Address Register 7 [R/W] */
151#define NILE4_BAR8 0x0270 /* PCI Base Address Register 8 [R/W] */
152#define NILE4_BARB 0x0278 /* PCI Base Address Register BOOT [R/W] */
153
154
155 /*
156 * Serial-Port Registers
157 */
158
159#define NILE4_UART_BASE 0x0300
160
161#define NILE4_UARTRBR 0x0300 /* UART Receiver Data Buffer [R] */
162#define NILE4_UARTTHR 0x0300 /* UART Transmitter Data Holding [W] */
163#define NILE4_UARTIER 0x0308 /* UART Interrupt Enable [R/W] */
164#define NILE4_UARTDLL 0x0300 /* UART Divisor Latch LSB [R/W] */
165#define NILE4_UARTDLM 0x0308 /* UART Divisor Latch MSB [R/W] */
166#define NILE4_UARTIIR 0x0310 /* UART Interrupt ID [R] */
167#define NILE4_UARTFCR 0x0310 /* UART FIFO Control [W] */
168#define NILE4_UARTLCR 0x0318 /* UART Line Control [R/W] */
169#define NILE4_UARTMCR 0x0320 /* UART Modem Control [R/W] */
170#define NILE4_UARTLSR 0x0328 /* UART Line Status [R/W] */
171#define NILE4_UARTMSR 0x0330 /* UART Modem Status [R/W] */
172#define NILE4_UARTSCR 0x0338 /* UART Scratch [R/W] */
173
174#define NILE4_UART_BASE_BAUD 520833 /* 100 MHz / 12 / 16 */
175
176
177 /*
178 * Interrupt Lines
179 */
180
181#define NILE4_INT_CPCE 0 /* CPU-Interface Parity-Error Interrupt */
182#define NILE4_INT_CNTD 1 /* CPU No-Target Decode Interrupt */
183#define NILE4_INT_MCE 2 /* Memory-Check Error Interrupt */
184#define NILE4_INT_DMA 3 /* DMA Controller Interrupt */
185#define NILE4_INT_UART 4 /* UART Interrupt */
186#define NILE4_INT_WDOG 5 /* Watchdog Timer Interrupt */
187#define NILE4_INT_GPT 6 /* General-Purpose Timer Interrupt */
188#define NILE4_INT_LBRTD 7 /* Local-Bus Ready Timer Interrupt */
189#define NILE4_INT_INTA 8 /* PCI Interrupt Signal INTA# */
190#define NILE4_INT_INTB 9 /* PCI Interrupt Signal INTB# */
191#define NILE4_INT_INTC 10 /* PCI Interrupt Signal INTC# */
192#define NILE4_INT_INTD 11 /* PCI Interrupt Signal INTD# */
193#define NILE4_INT_INTE 12 /* PCI Interrupt Signal INTE# (ISA cascade) */
194#define NILE4_INT_RESV 13 /* Reserved */
195#define NILE4_INT_PCIS 14 /* PCI SERR# Interrupt */
196#define NILE4_INT_PCIE 15 /* PCI Internal Error Interrupt */
197
198
199 /*
200 * Nile 4 Register Access
201 */
202
203static inline void nile4_sync(void)
204{
205 volatile u32 *p = (volatile u32 *)0xbfc00000;
206 (void)(*p);
207}
208
209static inline void nile4_out32(u32 offset, u32 val)
210{
211 *(volatile u32 *)(NILE4_BASE+offset) = val;
212 nile4_sync();
213}
214
215static inline u32 nile4_in32(u32 offset)
216{
217 u32 val = *(volatile u32 *)(NILE4_BASE+offset);
218 nile4_sync();
219 return val;
220}
221
222static inline void nile4_out16(u32 offset, u16 val)
223{
224 *(volatile u16 *)(NILE4_BASE+offset) = val;
225 nile4_sync();
226}
227
228static inline u16 nile4_in16(u32 offset)
229{
230 u16 val = *(volatile u16 *)(NILE4_BASE+offset);
231 nile4_sync();
232 return val;
233}
234
235static inline void nile4_out8(u32 offset, u8 val)
236{
237 *(volatile u8 *)(NILE4_BASE+offset) = val;
238 nile4_sync();
239}
240
241static inline u8 nile4_in8(u32 offset)
242{
243 u8 val = *(volatile u8 *)(NILE4_BASE+offset);
244 nile4_sync();
245 return val;
246}
247
248
249 /*
250 * Physical Device Address Registers
251 */
252
253extern void nile4_set_pdar(u32 pdar, u32 phys, u32 size, int width,
254 int on_memory_bus, int visible);
255
256
257 /*
258 * PCI Master Registers
259 */
260
261#define NILE4_PCICMD_IACK 0 /* PCI Interrupt Acknowledge */
262#define NILE4_PCICMD_IO 1 /* PCI I/O Space */
263#define NILE4_PCICMD_MEM 3 /* PCI Memory Space */
264#define NILE4_PCICMD_CFG 5 /* PCI Configuration Space */
265
266
267 /*
268 * PCI Address Spaces
269 *
270 * Note that these are multiplexed using PCIINIT[01]!
271 */
272
273#define NILE4_PCI_IO_BASE 0xa6000000
274#define NILE4_PCI_MEM_BASE 0xa8000000
275#define NILE4_PCI_CFG_BASE NILE4_PCI_MEM_BASE
276#define NILE4_PCI_IACK_BASE NILE4_PCI_IO_BASE
277
278
279extern void nile4_set_pmr(u32 pmr, u32 type, u32 addr);
280
281
282 /*
283 * Interrupt Programming
284 */
285
286#define NUM_I8259_INTERRUPTS 16
287#define NUM_NILE4_INTERRUPTS 16
288
289#define IRQ_I8259_CASCADE NILE4_INT_INTE
290#define is_i8259_irq(irq) ((irq) < NUM_I8259_INTERRUPTS)
291#define nile4_to_irq(n) ((n)+NUM_I8259_INTERRUPTS)
292#define irq_to_nile4(n) ((n)-NUM_I8259_INTERRUPTS)
293
294extern void nile4_map_irq(int nile4_irq, int cpu_irq);
295extern void nile4_map_irq_all(int cpu_irq);
296extern void nile4_enable_irq(unsigned int nile4_irq);
297extern void nile4_disable_irq(unsigned int nile4_irq);
298extern void nile4_disable_irq_all(void);
299extern u16 nile4_get_irq_stat(int cpu_irq);
300extern void nile4_enable_irq_output(int cpu_irq);
301extern void nile4_disable_irq_output(int cpu_irq);
302extern void nile4_set_pci_irq_polarity(int pci_irq, int high);
303extern void nile4_set_pci_irq_level_or_edge(int pci_irq, int level);
304extern void nile4_clear_irq(int nile4_irq);
305extern void nile4_clear_irq_mask(u32 mask);
306extern u8 nile4_i8259_iack(void);
307extern void nile4_dump_irq_status(void); /* Debug */
308
309#endif
310
diff --git a/include/asm-mips/paccess.h b/include/asm-mips/paccess.h
deleted file mode 100644
index c2394f8b0fe1..000000000000
--- a/include/asm-mips/paccess.h
+++ /dev/null
@@ -1,112 +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) 1996, 1997, 1998, 1999, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 *
9 * Protected memory access. Used for everything that might take revenge
10 * by sending a DBE error like accessing possibly non-existant memory or
11 * devices.
12 */
13#ifndef _ASM_PACCESS_H
14#define _ASM_PACCESS_H
15
16#include <linux/errno.h>
17
18#ifdef CONFIG_32BIT
19#define __PA_ADDR ".word"
20#endif
21#ifdef CONFIG_64BIT
22#define __PA_ADDR ".dword"
23#endif
24
25extern asmlinkage void handle_ibe(void);
26extern asmlinkage void handle_dbe(void);
27
28#define put_dbe(x, ptr) __put_dbe((x), (ptr), sizeof(*(ptr)))
29#define get_dbe(x, ptr) __get_dbe((x), (ptr), sizeof(*(ptr)))
30
31struct __large_pstruct { unsigned long buf[100]; };
32#define __mp(x) (*(struct __large_pstruct *)(x))
33
34#define __get_dbe(x, ptr, size) \
35({ \
36 long __gu_err; \
37 __typeof__(*(ptr)) __gu_val; \
38 unsigned long __gu_addr; \
39 __asm__("":"=r" (__gu_val)); \
40 __gu_addr = (unsigned long) (ptr); \
41 __asm__("":"=r" (__gu_err)); \
42 switch (size) { \
43 case 1: __get_dbe_asm("lb"); break; \
44 case 2: __get_dbe_asm("lh"); break; \
45 case 4: __get_dbe_asm("lw"); break; \
46 case 8: __get_dbe_asm("ld"); break; \
47 default: __get_dbe_unknown(); break; \
48 } \
49 x = (__typeof__(*(ptr))) __gu_val; \
50 __gu_err; \
51})
52
53#define __get_dbe_asm(insn) \
54{ \
55 __asm__ __volatile__( \
56 "1:\t" insn "\t%1,%2\n\t" \
57 "move\t%0,$0\n" \
58 "2:\n\t" \
59 ".section\t.fixup,\"ax\"\n" \
60 "3:\tli\t%0,%3\n\t" \
61 "move\t%1,$0\n\t" \
62 "j\t2b\n\t" \
63 ".previous\n\t" \
64 ".section\t__dbe_table,\"a\"\n\t" \
65 __PA_ADDR "\t1b, 3b\n\t" \
66 ".previous" \
67 :"=r" (__gu_err), "=r" (__gu_val) \
68 :"o" (__mp(__gu_addr)), "i" (-EFAULT)); \
69}
70
71extern void __get_dbe_unknown(void);
72
73#define __put_dbe(x, ptr, size) \
74({ \
75 long __pu_err; \
76 __typeof__(*(ptr)) __pu_val; \
77 long __pu_addr; \
78 __pu_val = (x); \
79 __pu_addr = (long) (ptr); \
80 __asm__("":"=r" (__pu_err)); \
81 switch (size) { \
82 case 1: __put_dbe_asm("sb"); break; \
83 case 2: __put_dbe_asm("sh"); break; \
84 case 4: __put_dbe_asm("sw"); break; \
85 case 8: __put_dbe_asm("sd"); break; \
86 default: __put_dbe_unknown(); break; \
87 } \
88 __pu_err; \
89})
90
91#define __put_dbe_asm(insn) \
92{ \
93 __asm__ __volatile__( \
94 "1:\t" insn "\t%1,%2\n\t" \
95 "move\t%0,$0\n" \
96 "2:\n\t" \
97 ".section\t.fixup,\"ax\"\n" \
98 "3:\tli\t%0,%3\n\t" \
99 "j\t2b\n\t" \
100 ".previous\n\t" \
101 ".section\t__dbe_table,\"a\"\n\t" \
102 __PA_ADDR "\t1b, 3b\n\t" \
103 ".previous" \
104 : "=r" (__pu_err) \
105 : "r" (__pu_val), "o" (__mp(__pu_addr)), "i" (-EFAULT)); \
106}
107
108extern void __put_dbe_unknown(void);
109
110extern unsigned long search_dbe_table(unsigned long addr);
111
112#endif /* _ASM_PACCESS_H */
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
deleted file mode 100644
index fe7a88ea066e..000000000000
--- a/include/asm-mips/page.h
+++ /dev/null
@@ -1,191 +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) 1994 - 1999, 2000, 03 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PAGE_H
10#define _ASM_PAGE_H
11
12#include <spaces.h>
13
14/*
15 * PAGE_SHIFT determines the page size
16 */
17#ifdef CONFIG_PAGE_SIZE_4KB
18#define PAGE_SHIFT 12
19#endif
20#ifdef CONFIG_PAGE_SIZE_8KB
21#define PAGE_SHIFT 13
22#endif
23#ifdef CONFIG_PAGE_SIZE_16KB
24#define PAGE_SHIFT 14
25#endif
26#ifdef CONFIG_PAGE_SIZE_64KB
27#define PAGE_SHIFT 16
28#endif
29#define PAGE_SIZE (1UL << PAGE_SHIFT)
30#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
31
32#ifndef __ASSEMBLY__
33
34#include <linux/pfn.h>
35#include <asm/io.h>
36
37extern void build_clear_page(void);
38extern void build_copy_page(void);
39
40/*
41 * It's normally defined only for FLATMEM config but it's
42 * used in our early mem init code for all memory models.
43 * So always define it.
44 */
45#define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)
46
47extern void clear_page(void * page);
48extern void copy_page(void * to, void * from);
49
50extern unsigned long shm_align_mask;
51
52static inline unsigned long pages_do_alias(unsigned long addr1,
53 unsigned long addr2)
54{
55 return (addr1 ^ addr2) & shm_align_mask;
56}
57
58struct page;
59
60static inline void clear_user_page(void *addr, unsigned long vaddr,
61 struct page *page)
62{
63 extern void (*flush_data_cache_page)(unsigned long addr);
64
65 clear_page(addr);
66 if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK))
67 flush_data_cache_page((unsigned long)addr);
68}
69
70extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
71 struct page *to);
72struct vm_area_struct;
73extern void copy_user_highpage(struct page *to, struct page *from,
74 unsigned long vaddr, struct vm_area_struct *vma);
75
76#define __HAVE_ARCH_COPY_USER_HIGHPAGE
77
78/*
79 * These are used to make use of C type-checking..
80 */
81#ifdef CONFIG_64BIT_PHYS_ADDR
82 #ifdef CONFIG_CPU_MIPS32
83 typedef struct { unsigned long pte_low, pte_high; } pte_t;
84 #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
85 #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
86 #else
87 typedef struct { unsigned long long pte; } pte_t;
88 #define pte_val(x) ((x).pte)
89 #define __pte(x) ((pte_t) { (x) } )
90 #endif
91#else
92typedef struct { unsigned long pte; } pte_t;
93#define pte_val(x) ((x).pte)
94#define __pte(x) ((pte_t) { (x) } )
95#endif
96typedef struct page *pgtable_t;
97
98/*
99 * For 3-level pagetables we defines these ourselves, for 2-level the
100 * definitions are supplied by <asm-generic/pgtable-nopmd.h>.
101 */
102#ifdef CONFIG_64BIT
103
104typedef struct { unsigned long pmd; } pmd_t;
105#define pmd_val(x) ((x).pmd)
106#define __pmd(x) ((pmd_t) { (x) } )
107
108#endif
109
110/*
111 * Right now we don't support 4-level pagetables, so all pud-related
112 * definitions come from <asm-generic/pgtable-nopud.h>.
113 */
114
115/*
116 * Finall the top of the hierarchy, the pgd
117 */
118typedef struct { unsigned long pgd; } pgd_t;
119#define pgd_val(x) ((x).pgd)
120#define __pgd(x) ((pgd_t) { (x) } )
121
122/*
123 * Manipulate page protection bits
124 */
125typedef struct { unsigned long pgprot; } pgprot_t;
126#define pgprot_val(x) ((x).pgprot)
127#define __pgprot(x) ((pgprot_t) { (x) } )
128
129/*
130 * On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd
131 * pair of pages we only have a single global bit per pair of pages. When
132 * writing to the TLB make sure we always have the bit set for both pages
133 * or none. This macro is used to access the `buddy' of the pte we're just
134 * working on.
135 */
136#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
137
138#endif /* !__ASSEMBLY__ */
139
140/*
141 * __pa()/__va() should be used only during mem init.
142 */
143#ifdef CONFIG_64BIT
144#define __pa(x) \
145({ \
146 unsigned long __x = (unsigned long)(x); \
147 __x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x); \
148})
149#else
150#define __pa(x) \
151 ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
152#endif
153#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
154#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
155
156#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
157
158#ifdef CONFIG_FLATMEM
159
160#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
161
162#elif defined(CONFIG_SPARSEMEM)
163
164/* pfn_valid is defined in linux/mmzone.h */
165
166#elif defined(CONFIG_NEED_MULTIPLE_NODES)
167
168#define pfn_valid(pfn) \
169({ \
170 unsigned long __pfn = (pfn); \
171 int __n = pfn_to_nid(__pfn); \
172 ((__n >= 0) ? (__pfn < NODE_DATA(__n)->node_start_pfn + \
173 NODE_DATA(__n)->node_spanned_pages) \
174 : 0); \
175})
176
177#endif
178
179#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
180#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr)))
181
182#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
183 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
184
185#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
186#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
187
188#include <asm-generic/memory_model.h>
189#include <asm-generic/page.h>
190
191#endif /* _ASM_PAGE_H */
diff --git a/include/asm-mips/param.h b/include/asm-mips/param.h
deleted file mode 100644
index 1d9bb8c5ab24..000000000000
--- a/include/asm-mips/param.h
+++ /dev/null
@@ -1,31 +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 1994 - 2000, 2002 Ralf Baechle (ralf@gnu.org)
7 * Copyright 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PARAM_H
10#define _ASM_PARAM_H
11
12#ifdef __KERNEL__
13
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif
18
19#ifndef HZ
20#define HZ 100
21#endif
22
23#define EXEC_PAGESIZE 65536
24
25#ifndef NOGROUP
26#define NOGROUP (-1)
27#endif
28
29#define MAXHOSTNAMELEN 64 /* max length of hostname */
30
31#endif /* _ASM_PARAM_H */
diff --git a/include/asm-mips/parport.h b/include/asm-mips/parport.h
deleted file mode 100644
index f52656826cce..000000000000
--- a/include/asm-mips/parport.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
3 *
4 * This file should only be included by drivers/parport/parport_pc.c.
5 */
6#ifndef _ASM_PARPORT_H
7#define _ASM_PARPORT_H
8
9static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
10static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
11{
12 return parport_pc_find_isa_ports(autoirq, autodma);
13}
14
15#endif /* _ASM_PARPORT_H */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
deleted file mode 100644
index 5510c53b7feb..000000000000
--- a/include/asm-mips/pci.h
+++ /dev/null
@@ -1,179 +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#ifndef _ASM_PCI_H
7#define _ASM_PCI_H
8
9#include <linux/mm.h>
10
11#ifdef __KERNEL__
12
13/*
14 * This file essentially defines the interface between board
15 * specific PCI code and MIPS common PCI code. Should potentially put
16 * into include/asm/pci.h file.
17 */
18
19#include <linux/ioport.h>
20
21/*
22 * Each pci channel is a top-level PCI bus seem by CPU. A machine with
23 * multiple PCI channels may have multiple PCI host controllers or a
24 * single controller supporting multiple channels.
25 */
26struct pci_controller {
27 struct pci_controller *next;
28 struct pci_bus *bus;
29
30 struct pci_ops *pci_ops;
31 struct resource *mem_resource;
32 unsigned long mem_offset;
33 struct resource *io_resource;
34 unsigned long io_offset;
35 unsigned long io_map_base;
36
37 unsigned int index;
38 /* For compatibility with current (as of July 2003) pciutils
39 and XFree86. Eventually will be removed. */
40 unsigned int need_domain_info;
41
42 int iommu;
43
44 /* Optional access methods for reading/writing the bus number
45 of the PCI controller */
46 int (*get_busno)(void);
47 void (*set_busno)(int busno);
48};
49
50/*
51 * Used by boards to register their PCI busses before the actual scanning.
52 */
53extern struct pci_controller * alloc_pci_controller(void);
54extern void register_pci_controller(struct pci_controller *hose);
55
56/*
57 * board supplied pci irq fixup routine
58 */
59extern int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
60
61
62/* Can be used to override the logic in pci_scan_bus for skipping
63 already-configured bus numbers - to be used for buggy BIOSes
64 or architectures with incomplete PCI setup by the loader */
65
66extern unsigned int pcibios_assign_all_busses(void);
67
68#define pcibios_scan_all_fns(a, b) 0
69
70extern unsigned long PCIBIOS_MIN_IO;
71extern unsigned long PCIBIOS_MIN_MEM;
72
73#define PCIBIOS_MIN_CARDBUS_IO 0x4000
74
75extern void pcibios_set_master(struct pci_dev *dev);
76
77static inline void pcibios_penalize_isa_irq(int irq, int active)
78{
79 /* We don't do dynamic PCI IRQ allocation */
80}
81
82/*
83 * Dynamic DMA mapping stuff.
84 * MIPS has everything mapped statically.
85 */
86
87#include <linux/types.h>
88#include <linux/slab.h>
89#include <asm/scatterlist.h>
90#include <linux/string.h>
91#include <asm/io.h>
92
93struct pci_dev;
94
95/*
96 * The PCI address space does equal the physical memory address space. The
97 * networking and block device layers use this boolean for bounce buffer
98 * decisions. This is set if any hose does not have an IOMMU.
99 */
100extern unsigned int PCI_DMA_BUS_IS_PHYS;
101
102#ifdef CONFIG_DMA_NEED_PCI_MAP_STATE
103
104/* pci_unmap_{single,page} is not a nop, thus... */
105#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
106#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
107#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
108#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
109#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
110#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
111
112#else /* CONFIG_DMA_NEED_PCI_MAP_STATE */
113
114/* pci_unmap_{page,single} is a nop so... */
115#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
116#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
117#define pci_unmap_addr(PTR, ADDR_NAME) (0)
118#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
119#define pci_unmap_len(PTR, LEN_NAME) (0)
120#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
121
122#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */
123
124#ifdef CONFIG_PCI
125static inline void pci_dma_burst_advice(struct pci_dev *pdev,
126 enum pci_dma_burst_strategy *strat,
127 unsigned long *strategy_parameter)
128{
129 *strat = PCI_DMA_BURST_INFINITY;
130 *strategy_parameter = ~0UL;
131}
132#endif
133
134extern void pcibios_resource_to_bus(struct pci_dev *dev,
135 struct pci_bus_region *region, struct resource *res);
136
137extern void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
138 struct pci_bus_region *region);
139
140static inline struct resource *
141pcibios_select_root(struct pci_dev *pdev, struct resource *res)
142{
143 struct resource *root = NULL;
144
145 if (res->flags & IORESOURCE_IO)
146 root = &ioport_resource;
147 if (res->flags & IORESOURCE_MEM)
148 root = &iomem_resource;
149
150 return root;
151}
152
153#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
154
155static inline int pci_proc_domain(struct pci_bus *bus)
156{
157 struct pci_controller *hose = bus->sysdata;
158 return hose->need_domain_info;
159}
160
161#endif /* __KERNEL__ */
162
163/* implement the pci_ DMA API in terms of the generic device dma_ one */
164#include <asm-generic/pci-dma-compat.h>
165
166/* Do platform specific device initialization at pci_enable_device() time */
167extern int pcibios_plat_dev_init(struct pci_dev *dev);
168
169/* Chances are this interrupt is wired PC-style ... */
170static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
171{
172 return channel ? 15 : 14;
173}
174
175extern int pci_probe_only;
176
177extern char * (*pcibios_plat_setup)(char *str);
178
179#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/pci/bridge.h b/include/asm-mips/pci/bridge.h
deleted file mode 100644
index 5f4b9d4e4114..000000000000
--- a/include/asm-mips/pci/bridge.h
+++ /dev/null
@@ -1,854 +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 * bridge.h - bridge chip header file, derived from IRIX <sys/PCI/bridge.h>,
7 * revision 1.76.
8 *
9 * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_PCI_BRIDGE_H
13#define _ASM_PCI_BRIDGE_H
14
15#include <linux/types.h>
16#include <linux/pci.h>
17#include <asm/xtalk/xwidget.h> /* generic widget header */
18#include <asm/sn/types.h>
19
20/* I/O page size */
21
22#define IOPFNSHIFT 12 /* 4K per mapped page */
23
24#define IOPGSIZE (1 << IOPFNSHIFT)
25#define IOPG(x) ((x) >> IOPFNSHIFT)
26#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
27
28/* Bridge RAM sizes */
29
30#define BRIDGE_ATE_RAM_SIZE 0x00000400 /* 1kB ATE RAM */
31
32#define BRIDGE_CONFIG_BASE 0x20000
33#define BRIDGE_CONFIG1_BASE 0x28000
34#define BRIDGE_CONFIG_END 0x30000
35#define BRIDGE_CONFIG_SLOT_SIZE 0x1000
36
37#define BRIDGE_SSRAM_512K 0x00080000 /* 512kB */
38#define BRIDGE_SSRAM_128K 0x00020000 /* 128kB */
39#define BRIDGE_SSRAM_64K 0x00010000 /* 64kB */
40#define BRIDGE_SSRAM_0K 0x00000000 /* 0kB */
41
42/* ========================================================================
43 * Bridge address map
44 */
45
46#ifndef __ASSEMBLY__
47
48/*
49 * All accesses to bridge hardware registers must be done
50 * using 32-bit loads and stores.
51 */
52typedef u32 bridgereg_t;
53
54typedef u64 bridge_ate_t;
55
56/* pointers to bridge ATEs
57 * are always "pointer to volatile"
58 */
59typedef volatile bridge_ate_t *bridge_ate_p;
60
61/*
62 * It is generally preferred that hardware registers on the bridge
63 * are located from C code via this structure.
64 *
65 * Generated from Bridge spec dated 04oct95
66 */
67
68typedef volatile struct bridge_s {
69 /* Local Registers 0x000000-0x00FFFF */
70
71 /* standard widget configuration 0x000000-0x000057 */
72 widget_cfg_t b_widget; /* 0x000000 */
73
74 /* helper fieldnames for accessing bridge widget */
75
76#define b_wid_id b_widget.w_id
77#define b_wid_stat b_widget.w_status
78#define b_wid_err_upper b_widget.w_err_upper_addr
79#define b_wid_err_lower b_widget.w_err_lower_addr
80#define b_wid_control b_widget.w_control
81#define b_wid_req_timeout b_widget.w_req_timeout
82#define b_wid_int_upper b_widget.w_intdest_upper_addr
83#define b_wid_int_lower b_widget.w_intdest_lower_addr
84#define b_wid_err_cmdword b_widget.w_err_cmd_word
85#define b_wid_llp b_widget.w_llp_cfg
86#define b_wid_tflush b_widget.w_tflush
87
88 /* bridge-specific widget configuration 0x000058-0x00007F */
89 bridgereg_t _pad_000058;
90 bridgereg_t b_wid_aux_err; /* 0x00005C */
91 bridgereg_t _pad_000060;
92 bridgereg_t b_wid_resp_upper; /* 0x000064 */
93 bridgereg_t _pad_000068;
94 bridgereg_t b_wid_resp_lower; /* 0x00006C */
95 bridgereg_t _pad_000070;
96 bridgereg_t b_wid_tst_pin_ctrl; /* 0x000074 */
97 bridgereg_t _pad_000078[2];
98
99 /* PMU & Map 0x000080-0x00008F */
100 bridgereg_t _pad_000080;
101 bridgereg_t b_dir_map; /* 0x000084 */
102 bridgereg_t _pad_000088[2];
103
104 /* SSRAM 0x000090-0x00009F */
105 bridgereg_t _pad_000090;
106 bridgereg_t b_ram_perr; /* 0x000094 */
107 bridgereg_t _pad_000098[2];
108
109 /* Arbitration 0x0000A0-0x0000AF */
110 bridgereg_t _pad_0000A0;
111 bridgereg_t b_arb; /* 0x0000A4 */
112 bridgereg_t _pad_0000A8[2];
113
114 /* Number In A Can 0x0000B0-0x0000BF */
115 bridgereg_t _pad_0000B0;
116 bridgereg_t b_nic; /* 0x0000B4 */
117 bridgereg_t _pad_0000B8[2];
118
119 /* PCI/GIO 0x0000C0-0x0000FF */
120 bridgereg_t _pad_0000C0;
121 bridgereg_t b_bus_timeout; /* 0x0000C4 */
122#define b_pci_bus_timeout b_bus_timeout
123
124 bridgereg_t _pad_0000C8;
125 bridgereg_t b_pci_cfg; /* 0x0000CC */
126 bridgereg_t _pad_0000D0;
127 bridgereg_t b_pci_err_upper; /* 0x0000D4 */
128 bridgereg_t _pad_0000D8;
129 bridgereg_t b_pci_err_lower; /* 0x0000DC */
130 bridgereg_t _pad_0000E0[8];
131#define b_gio_err_lower b_pci_err_lower
132#define b_gio_err_upper b_pci_err_upper
133
134 /* Interrupt 0x000100-0x0001FF */
135 bridgereg_t _pad_000100;
136 bridgereg_t b_int_status; /* 0x000104 */
137 bridgereg_t _pad_000108;
138 bridgereg_t b_int_enable; /* 0x00010C */
139 bridgereg_t _pad_000110;
140 bridgereg_t b_int_rst_stat; /* 0x000114 */
141 bridgereg_t _pad_000118;
142 bridgereg_t b_int_mode; /* 0x00011C */
143 bridgereg_t _pad_000120;
144 bridgereg_t b_int_device; /* 0x000124 */
145 bridgereg_t _pad_000128;
146 bridgereg_t b_int_host_err; /* 0x00012C */
147
148 struct {
149 bridgereg_t __pad; /* 0x0001{30,,,68} */
150 bridgereg_t addr; /* 0x0001{34,,,6C} */
151 } b_int_addr[8]; /* 0x000130 */
152
153 bridgereg_t _pad_000170[36];
154
155 /* Device 0x000200-0x0003FF */
156 struct {
157 bridgereg_t __pad; /* 0x0002{00,,,38} */
158 bridgereg_t reg; /* 0x0002{04,,,3C} */
159 } b_device[8]; /* 0x000200 */
160
161 struct {
162 bridgereg_t __pad; /* 0x0002{40,,,78} */
163 bridgereg_t reg; /* 0x0002{44,,,7C} */
164 } b_wr_req_buf[8]; /* 0x000240 */
165
166 struct {
167 bridgereg_t __pad; /* 0x0002{80,,,88} */
168 bridgereg_t reg; /* 0x0002{84,,,8C} */
169 } b_rrb_map[2]; /* 0x000280 */
170#define b_even_resp b_rrb_map[0].reg /* 0x000284 */
171#define b_odd_resp b_rrb_map[1].reg /* 0x00028C */
172
173 bridgereg_t _pad_000290;
174 bridgereg_t b_resp_status; /* 0x000294 */
175 bridgereg_t _pad_000298;
176 bridgereg_t b_resp_clear; /* 0x00029C */
177
178 bridgereg_t _pad_0002A0[24];
179
180 char _pad_000300[0x10000 - 0x000300];
181
182 /* Internal Address Translation Entry RAM 0x010000-0x0103FF */
183 union {
184 bridge_ate_t wr; /* write-only */
185 struct {
186 bridgereg_t _p_pad;
187 bridgereg_t rd; /* read-only */
188 } hi;
189 } b_int_ate_ram[128];
190
191 char _pad_010400[0x11000 - 0x010400];
192
193 /* Internal Address Translation Entry RAM LOW 0x011000-0x0113FF */
194 struct {
195 bridgereg_t _p_pad;
196 bridgereg_t rd; /* read-only */
197 } b_int_ate_ram_lo[128];
198
199 char _pad_011400[0x20000 - 0x011400];
200
201 /* PCI Device Configuration Spaces 0x020000-0x027FFF */
202 union { /* make all access sizes available. */
203 u8 c[0x1000 / 1];
204 u16 s[0x1000 / 2];
205 u32 l[0x1000 / 4];
206 u64 d[0x1000 / 8];
207 union {
208 u8 c[0x100 / 1];
209 u16 s[0x100 / 2];
210 u32 l[0x100 / 4];
211 u64 d[0x100 / 8];
212 } f[8];
213 } b_type0_cfg_dev[8]; /* 0x020000 */
214
215 /* PCI Type 1 Configuration Space 0x028000-0x028FFF */
216 union { /* make all access sizes available. */
217 u8 c[0x1000 / 1];
218 u16 s[0x1000 / 2];
219 u32 l[0x1000 / 4];
220 u64 d[0x1000 / 8];
221 } b_type1_cfg; /* 0x028000-0x029000 */
222
223 char _pad_029000[0x007000]; /* 0x029000-0x030000 */
224
225 /* PCI Interrupt Acknowledge Cycle 0x030000 */
226 union {
227 u8 c[8 / 1];
228 u16 s[8 / 2];
229 u32 l[8 / 4];
230 u64 d[8 / 8];
231 } b_pci_iack; /* 0x030000 */
232
233 u8 _pad_030007[0x04fff8]; /* 0x030008-0x07FFFF */
234
235 /* External Address Translation Entry RAM 0x080000-0x0FFFFF */
236 bridge_ate_t b_ext_ate_ram[0x10000];
237
238 /* Reserved 0x100000-0x1FFFFF */
239 char _pad_100000[0x200000-0x100000];
240
241 /* PCI/GIO Device Spaces 0x200000-0xBFFFFF */
242 union { /* make all access sizes available. */
243 u8 c[0x100000 / 1];
244 u16 s[0x100000 / 2];
245 u32 l[0x100000 / 4];
246 u64 d[0x100000 / 8];
247 } b_devio_raw[10]; /* 0x200000 */
248
249 /* b_devio macro is a bit strange; it reflects the
250 * fact that the Bridge ASIC provides 2M for the
251 * first two DevIO windows and 1M for the other six.
252 */
253#define b_devio(n) b_devio_raw[((n)<2)?(n*2):(n+2)]
254
255 /* External Flash Proms 1,0 0xC00000-0xFFFFFF */
256 union { /* make all access sizes available. */
257 u8 c[0x400000 / 1]; /* read-only */
258 u16 s[0x400000 / 2]; /* read-write */
259 u32 l[0x400000 / 4]; /* read-only */
260 u64 d[0x400000 / 8]; /* read-only */
261 } b_external_flash; /* 0xC00000 */
262} bridge_t;
263
264/*
265 * Field formats for Error Command Word and Auxillary Error Command Word
266 * of bridge.
267 */
268typedef struct bridge_err_cmdword_s {
269 union {
270 u32 cmd_word;
271 struct {
272 u32 didn:4, /* Destination ID */
273 sidn:4, /* Source ID */
274 pactyp:4, /* Packet type */
275 tnum:5, /* Trans Number */
276 coh:1, /* Coh Transacti */
277 ds:2, /* Data size */
278 gbr:1, /* GBR enable */
279 vbpm:1, /* VBPM message */
280 error:1, /* Error occurred */
281 barr:1, /* Barrier op */
282 rsvd:8;
283 } berr_st;
284 } berr_un;
285} bridge_err_cmdword_t;
286
287#define berr_field berr_un.berr_st
288#endif /* !__ASSEMBLY__ */
289
290/*
291 * The values of these macros can and should be crosschecked
292 * regularly against the offsets of the like-named fields
293 * within the "bridge_t" structure above.
294 */
295
296/* Byte offset macros for Bridge internal registers */
297
298#define BRIDGE_WID_ID WIDGET_ID
299#define BRIDGE_WID_STAT WIDGET_STATUS
300#define BRIDGE_WID_ERR_UPPER WIDGET_ERR_UPPER_ADDR
301#define BRIDGE_WID_ERR_LOWER WIDGET_ERR_LOWER_ADDR
302#define BRIDGE_WID_CONTROL WIDGET_CONTROL
303#define BRIDGE_WID_REQ_TIMEOUT WIDGET_REQ_TIMEOUT
304#define BRIDGE_WID_INT_UPPER WIDGET_INTDEST_UPPER_ADDR
305#define BRIDGE_WID_INT_LOWER WIDGET_INTDEST_LOWER_ADDR
306#define BRIDGE_WID_ERR_CMDWORD WIDGET_ERR_CMD_WORD
307#define BRIDGE_WID_LLP WIDGET_LLP_CFG
308#define BRIDGE_WID_TFLUSH WIDGET_TFLUSH
309
310#define BRIDGE_WID_AUX_ERR 0x00005C /* Aux Error Command Word */
311#define BRIDGE_WID_RESP_UPPER 0x000064 /* Response Buf Upper Addr */
312#define BRIDGE_WID_RESP_LOWER 0x00006C /* Response Buf Lower Addr */
313#define BRIDGE_WID_TST_PIN_CTRL 0x000074 /* Test pin control */
314
315#define BRIDGE_DIR_MAP 0x000084 /* Direct Map reg */
316
317#define BRIDGE_RAM_PERR 0x000094 /* SSRAM Parity Error */
318
319#define BRIDGE_ARB 0x0000A4 /* Arbitration Priority reg */
320
321#define BRIDGE_NIC 0x0000B4 /* Number In A Can */
322
323#define BRIDGE_BUS_TIMEOUT 0x0000C4 /* Bus Timeout Register */
324#define BRIDGE_PCI_BUS_TIMEOUT BRIDGE_BUS_TIMEOUT
325#define BRIDGE_PCI_CFG 0x0000CC /* PCI Type 1 Config reg */
326#define BRIDGE_PCI_ERR_UPPER 0x0000D4 /* PCI error Upper Addr */
327#define BRIDGE_PCI_ERR_LOWER 0x0000DC /* PCI error Lower Addr */
328
329#define BRIDGE_INT_STATUS 0x000104 /* Interrupt Status */
330#define BRIDGE_INT_ENABLE 0x00010C /* Interrupt Enables */
331#define BRIDGE_INT_RST_STAT 0x000114 /* Reset Intr Status */
332#define BRIDGE_INT_MODE 0x00011C /* Interrupt Mode */
333#define BRIDGE_INT_DEVICE 0x000124 /* Interrupt Device */
334#define BRIDGE_INT_HOST_ERR 0x00012C /* Host Error Field */
335
336#define BRIDGE_INT_ADDR0 0x000134 /* Host Address Reg */
337#define BRIDGE_INT_ADDR_OFF 0x000008 /* Host Addr offset (1..7) */
338#define BRIDGE_INT_ADDR(x) (BRIDGE_INT_ADDR0+(x)*BRIDGE_INT_ADDR_OFF)
339
340#define BRIDGE_DEVICE0 0x000204 /* Device 0 */
341#define BRIDGE_DEVICE_OFF 0x000008 /* Device offset (1..7) */
342#define BRIDGE_DEVICE(x) (BRIDGE_DEVICE0+(x)*BRIDGE_DEVICE_OFF)
343
344#define BRIDGE_WR_REQ_BUF0 0x000244 /* Write Request Buffer 0 */
345#define BRIDGE_WR_REQ_BUF_OFF 0x000008 /* Buffer Offset (1..7) */
346#define BRIDGE_WR_REQ_BUF(x) (BRIDGE_WR_REQ_BUF0+(x)*BRIDGE_WR_REQ_BUF_OFF)
347
348#define BRIDGE_EVEN_RESP 0x000284 /* Even Device Response Buf */
349#define BRIDGE_ODD_RESP 0x00028C /* Odd Device Response Buf */
350
351#define BRIDGE_RESP_STATUS 0x000294 /* Read Response Status reg */
352#define BRIDGE_RESP_CLEAR 0x00029C /* Read Response Clear reg */
353
354/* Byte offset macros for Bridge I/O space */
355
356#define BRIDGE_ATE_RAM 0x00010000 /* Internal Addr Xlat Ram */
357
358#define BRIDGE_TYPE0_CFG_DEV0 0x00020000 /* Type 0 Cfg, Device 0 */
359#define BRIDGE_TYPE0_CFG_SLOT_OFF 0x00001000 /* Type 0 Cfg Slot Offset (1..7) */
360#define BRIDGE_TYPE0_CFG_FUNC_OFF 0x00000100 /* Type 0 Cfg Func Offset (1..7) */
361#define BRIDGE_TYPE0_CFG_DEV(s) (BRIDGE_TYPE0_CFG_DEV0+\
362 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF)
363#define BRIDGE_TYPE0_CFG_DEVF(s, f) (BRIDGE_TYPE0_CFG_DEV0+\
364 (s)*BRIDGE_TYPE0_CFG_SLOT_OFF+\
365 (f)*BRIDGE_TYPE0_CFG_FUNC_OFF)
366
367#define BRIDGE_TYPE1_CFG 0x00028000 /* Type 1 Cfg space */
368
369#define BRIDGE_PCI_IACK 0x00030000 /* PCI Interrupt Ack */
370#define BRIDGE_EXT_SSRAM 0x00080000 /* Extern SSRAM (ATE) */
371
372/* Byte offset macros for Bridge device IO spaces */
373
374#define BRIDGE_DEV_CNT 8 /* Up to 8 devices per bridge */
375#define BRIDGE_DEVIO0 0x00200000 /* Device IO 0 Addr */
376#define BRIDGE_DEVIO1 0x00400000 /* Device IO 1 Addr */
377#define BRIDGE_DEVIO2 0x00600000 /* Device IO 2 Addr */
378#define BRIDGE_DEVIO_OFF 0x00100000 /* Device IO Offset (3..7) */
379
380#define BRIDGE_DEVIO_2MB 0x00200000 /* Device IO Offset (0..1) */
381#define BRIDGE_DEVIO_1MB 0x00100000 /* Device IO Offset (2..7) */
382
383#define BRIDGE_DEVIO(x) ((x)<=1 ? BRIDGE_DEVIO0+(x)*BRIDGE_DEVIO_2MB : BRIDGE_DEVIO2+((x)-2)*BRIDGE_DEVIO_1MB)
384
385#define BRIDGE_EXTERNAL_FLASH 0x00C00000 /* External Flash PROMS */
386
387/* ========================================================================
388 * Bridge register bit field definitions
389 */
390
391/* Widget part number of bridge */
392#define BRIDGE_WIDGET_PART_NUM 0xc002
393#define XBRIDGE_WIDGET_PART_NUM 0xd002
394
395/* Manufacturer of bridge */
396#define BRIDGE_WIDGET_MFGR_NUM 0x036
397#define XBRIDGE_WIDGET_MFGR_NUM 0x024
398
399/* Revision numbers for known Bridge revisions */
400#define BRIDGE_REV_A 0x1
401#define BRIDGE_REV_B 0x2
402#define BRIDGE_REV_C 0x3
403#define BRIDGE_REV_D 0x4
404
405/* Bridge widget status register bits definition */
406
407#define BRIDGE_STAT_LLP_REC_CNT (0xFFu << 24)
408#define BRIDGE_STAT_LLP_TX_CNT (0xFF << 16)
409#define BRIDGE_STAT_FLASH_SELECT (0x1 << 6)
410#define BRIDGE_STAT_PCI_GIO_N (0x1 << 5)
411#define BRIDGE_STAT_PENDING (0x1F << 0)
412
413/* Bridge widget control register bits definition */
414#define BRIDGE_CTRL_FLASH_WR_EN (0x1ul << 31)
415#define BRIDGE_CTRL_EN_CLK50 (0x1 << 30)
416#define BRIDGE_CTRL_EN_CLK40 (0x1 << 29)
417#define BRIDGE_CTRL_EN_CLK33 (0x1 << 28)
418#define BRIDGE_CTRL_RST(n) ((n) << 24)
419#define BRIDGE_CTRL_RST_MASK (BRIDGE_CTRL_RST(0xF))
420#define BRIDGE_CTRL_RST_PIN(x) (BRIDGE_CTRL_RST(0x1 << (x)))
421#define BRIDGE_CTRL_IO_SWAP (0x1 << 23)
422#define BRIDGE_CTRL_MEM_SWAP (0x1 << 22)
423#define BRIDGE_CTRL_PAGE_SIZE (0x1 << 21)
424#define BRIDGE_CTRL_SS_PAR_BAD (0x1 << 20)
425#define BRIDGE_CTRL_SS_PAR_EN (0x1 << 19)
426#define BRIDGE_CTRL_SSRAM_SIZE(n) ((n) << 17)
427#define BRIDGE_CTRL_SSRAM_SIZE_MASK (BRIDGE_CTRL_SSRAM_SIZE(0x3))
428#define BRIDGE_CTRL_SSRAM_512K (BRIDGE_CTRL_SSRAM_SIZE(0x3))
429#define BRIDGE_CTRL_SSRAM_128K (BRIDGE_CTRL_SSRAM_SIZE(0x2))
430#define BRIDGE_CTRL_SSRAM_64K (BRIDGE_CTRL_SSRAM_SIZE(0x1))
431#define BRIDGE_CTRL_SSRAM_1K (BRIDGE_CTRL_SSRAM_SIZE(0x0))
432#define BRIDGE_CTRL_F_BAD_PKT (0x1 << 16)
433#define BRIDGE_CTRL_LLP_XBAR_CRD(n) ((n) << 12)
434#define BRIDGE_CTRL_LLP_XBAR_CRD_MASK (BRIDGE_CTRL_LLP_XBAR_CRD(0xf))
435#define BRIDGE_CTRL_CLR_RLLP_CNT (0x1 << 11)
436#define BRIDGE_CTRL_CLR_TLLP_CNT (0x1 << 10)
437#define BRIDGE_CTRL_SYS_END (0x1 << 9)
438#define BRIDGE_CTRL_MAX_TRANS(n) ((n) << 4)
439#define BRIDGE_CTRL_MAX_TRANS_MASK (BRIDGE_CTRL_MAX_TRANS(0x1f))
440#define BRIDGE_CTRL_WIDGET_ID(n) ((n) << 0)
441#define BRIDGE_CTRL_WIDGET_ID_MASK (BRIDGE_CTRL_WIDGET_ID(0xf))
442
443/* Bridge Response buffer Error Upper Register bit fields definition */
444#define BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT (20)
445#define BRIDGE_RESP_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
446#define BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT (16)
447#define BRIDGE_RESP_ERRUPPR_BUFNUM_MASK (0xF << BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
448#define BRIDGE_RESP_ERRRUPPR_BUFMASK (0xFFFF)
449
450#define BRIDGE_RESP_ERRUPPR_BUFNUM(x) \
451 (((x) & BRIDGE_RESP_ERRUPPR_BUFNUM_MASK) >> \
452 BRIDGE_RESP_ERRUPPR_BUFNUM_SHFT)
453
454#define BRIDGE_RESP_ERRUPPR_DEVICE(x) \
455 (((x) & BRIDGE_RESP_ERRUPPR_DEVNUM_MASK) >> \
456 BRIDGE_RESP_ERRUPPR_DEVNUM_SHFT)
457
458/* Bridge direct mapping register bits definition */
459#define BRIDGE_DIRMAP_W_ID_SHFT 20
460#define BRIDGE_DIRMAP_W_ID (0xf << BRIDGE_DIRMAP_W_ID_SHFT)
461#define BRIDGE_DIRMAP_RMF_64 (0x1 << 18)
462#define BRIDGE_DIRMAP_ADD512 (0x1 << 17)
463#define BRIDGE_DIRMAP_OFF (0x1ffff << 0)
464#define BRIDGE_DIRMAP_OFF_ADDRSHFT (31) /* lsbit of DIRMAP_OFF is xtalk address bit 31 */
465
466/* Bridge Arbitration register bits definition */
467#define BRIDGE_ARB_REQ_WAIT_TICK(x) ((x) << 16)
468#define BRIDGE_ARB_REQ_WAIT_TICK_MASK BRIDGE_ARB_REQ_WAIT_TICK(0x3)
469#define BRIDGE_ARB_REQ_WAIT_EN(x) ((x) << 8)
470#define BRIDGE_ARB_REQ_WAIT_EN_MASK BRIDGE_ARB_REQ_WAIT_EN(0xff)
471#define BRIDGE_ARB_FREEZE_GNT (1 << 6)
472#define BRIDGE_ARB_HPRI_RING_B2 (1 << 5)
473#define BRIDGE_ARB_HPRI_RING_B1 (1 << 4)
474#define BRIDGE_ARB_HPRI_RING_B0 (1 << 3)
475#define BRIDGE_ARB_LPRI_RING_B2 (1 << 2)
476#define BRIDGE_ARB_LPRI_RING_B1 (1 << 1)
477#define BRIDGE_ARB_LPRI_RING_B0 (1 << 0)
478
479/* Bridge Bus time-out register bits definition */
480#define BRIDGE_BUS_PCI_RETRY_HLD(x) ((x) << 16)
481#define BRIDGE_BUS_PCI_RETRY_HLD_MASK BRIDGE_BUS_PCI_RETRY_HLD(0x1f)
482#define BRIDGE_BUS_GIO_TIMEOUT (1 << 12)
483#define BRIDGE_BUS_PCI_RETRY_CNT(x) ((x) << 0)
484#define BRIDGE_BUS_PCI_RETRY_MASK BRIDGE_BUS_PCI_RETRY_CNT(0x3ff)
485
486/* Bridge interrupt status register bits definition */
487#define BRIDGE_ISR_MULTI_ERR (0x1u << 31)
488#define BRIDGE_ISR_PMU_ESIZE_FAULT (0x1 << 30)
489#define BRIDGE_ISR_UNEXP_RESP (0x1 << 29)
490#define BRIDGE_ISR_BAD_XRESP_PKT (0x1 << 28)
491#define BRIDGE_ISR_BAD_XREQ_PKT (0x1 << 27)
492#define BRIDGE_ISR_RESP_XTLK_ERR (0x1 << 26)
493#define BRIDGE_ISR_REQ_XTLK_ERR (0x1 << 25)
494#define BRIDGE_ISR_INVLD_ADDR (0x1 << 24)
495#define BRIDGE_ISR_UNSUPPORTED_XOP (0x1 << 23)
496#define BRIDGE_ISR_XREQ_FIFO_OFLOW (0x1 << 22)
497#define BRIDGE_ISR_LLP_REC_SNERR (0x1 << 21)
498#define BRIDGE_ISR_LLP_REC_CBERR (0x1 << 20)
499#define BRIDGE_ISR_LLP_RCTY (0x1 << 19)
500#define BRIDGE_ISR_LLP_TX_RETRY (0x1 << 18)
501#define BRIDGE_ISR_LLP_TCTY (0x1 << 17)
502#define BRIDGE_ISR_SSRAM_PERR (0x1 << 16)
503#define BRIDGE_ISR_PCI_ABORT (0x1 << 15)
504#define BRIDGE_ISR_PCI_PARITY (0x1 << 14)
505#define BRIDGE_ISR_PCI_SERR (0x1 << 13)
506#define BRIDGE_ISR_PCI_PERR (0x1 << 12)
507#define BRIDGE_ISR_PCI_MST_TIMEOUT (0x1 << 11)
508#define BRIDGE_ISR_GIO_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
509#define BRIDGE_ISR_PCI_RETRY_CNT (0x1 << 10)
510#define BRIDGE_ISR_XREAD_REQ_TIMEOUT (0x1 << 9)
511#define BRIDGE_ISR_GIO_B_ENBL_ERR (0x1 << 8)
512#define BRIDGE_ISR_INT_MSK (0xff << 0)
513#define BRIDGE_ISR_INT(x) (0x1 << (x))
514
515#define BRIDGE_ISR_LINK_ERROR \
516 (BRIDGE_ISR_LLP_REC_SNERR|BRIDGE_ISR_LLP_REC_CBERR| \
517 BRIDGE_ISR_LLP_RCTY|BRIDGE_ISR_LLP_TX_RETRY| \
518 BRIDGE_ISR_LLP_TCTY)
519
520#define BRIDGE_ISR_PCIBUS_PIOERR \
521 (BRIDGE_ISR_PCI_MST_TIMEOUT|BRIDGE_ISR_PCI_ABORT)
522
523#define BRIDGE_ISR_PCIBUS_ERROR \
524 (BRIDGE_ISR_PCIBUS_PIOERR|BRIDGE_ISR_PCI_PERR| \
525 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_RETRY_CNT| \
526 BRIDGE_ISR_PCI_PARITY)
527
528#define BRIDGE_ISR_XTALK_ERROR \
529 (BRIDGE_ISR_XREAD_REQ_TIMEOUT|BRIDGE_ISR_XREQ_FIFO_OFLOW|\
530 BRIDGE_ISR_UNSUPPORTED_XOP|BRIDGE_ISR_INVLD_ADDR| \
531 BRIDGE_ISR_REQ_XTLK_ERR|BRIDGE_ISR_RESP_XTLK_ERR| \
532 BRIDGE_ISR_BAD_XREQ_PKT|BRIDGE_ISR_BAD_XRESP_PKT| \
533 BRIDGE_ISR_UNEXP_RESP)
534
535#define BRIDGE_ISR_ERRORS \
536 (BRIDGE_ISR_LINK_ERROR|BRIDGE_ISR_PCIBUS_ERROR| \
537 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR| \
538 BRIDGE_ISR_PMU_ESIZE_FAULT)
539
540/*
541 * List of Errors which are fatal and kill the system
542 */
543#define BRIDGE_ISR_ERROR_FATAL \
544 ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\
545 BRIDGE_ISR_PCI_SERR|BRIDGE_ISR_PCI_PARITY )
546
547#define BRIDGE_ISR_ERROR_DUMP \
548 (BRIDGE_ISR_PCIBUS_ERROR|BRIDGE_ISR_PMU_ESIZE_FAULT| \
549 BRIDGE_ISR_XTALK_ERROR|BRIDGE_ISR_SSRAM_PERR)
550
551/* Bridge interrupt enable register bits definition */
552#define BRIDGE_IMR_UNEXP_RESP BRIDGE_ISR_UNEXP_RESP
553#define BRIDGE_IMR_PMU_ESIZE_FAULT BRIDGE_ISR_PMU_ESIZE_FAULT
554#define BRIDGE_IMR_BAD_XRESP_PKT BRIDGE_ISR_BAD_XRESP_PKT
555#define BRIDGE_IMR_BAD_XREQ_PKT BRIDGE_ISR_BAD_XREQ_PKT
556#define BRIDGE_IMR_RESP_XTLK_ERR BRIDGE_ISR_RESP_XTLK_ERR
557#define BRIDGE_IMR_REQ_XTLK_ERR BRIDGE_ISR_REQ_XTLK_ERR
558#define BRIDGE_IMR_INVLD_ADDR BRIDGE_ISR_INVLD_ADDR
559#define BRIDGE_IMR_UNSUPPORTED_XOP BRIDGE_ISR_UNSUPPORTED_XOP
560#define BRIDGE_IMR_XREQ_FIFO_OFLOW BRIDGE_ISR_XREQ_FIFO_OFLOW
561#define BRIDGE_IMR_LLP_REC_SNERR BRIDGE_ISR_LLP_REC_SNERR
562#define BRIDGE_IMR_LLP_REC_CBERR BRIDGE_ISR_LLP_REC_CBERR
563#define BRIDGE_IMR_LLP_RCTY BRIDGE_ISR_LLP_RCTY
564#define BRIDGE_IMR_LLP_TX_RETRY BRIDGE_ISR_LLP_TX_RETRY
565#define BRIDGE_IMR_LLP_TCTY BRIDGE_ISR_LLP_TCTY
566#define BRIDGE_IMR_SSRAM_PERR BRIDGE_ISR_SSRAM_PERR
567#define BRIDGE_IMR_PCI_ABORT BRIDGE_ISR_PCI_ABORT
568#define BRIDGE_IMR_PCI_PARITY BRIDGE_ISR_PCI_PARITY
569#define BRIDGE_IMR_PCI_SERR BRIDGE_ISR_PCI_SERR
570#define BRIDGE_IMR_PCI_PERR BRIDGE_ISR_PCI_PERR
571#define BRIDGE_IMR_PCI_MST_TIMEOUT BRIDGE_ISR_PCI_MST_TIMEOUT
572#define BRIDGE_IMR_GIO_MST_TIMEOUT BRIDGE_ISR_GIO_MST_TIMEOUT
573#define BRIDGE_IMR_PCI_RETRY_CNT BRIDGE_ISR_PCI_RETRY_CNT
574#define BRIDGE_IMR_XREAD_REQ_TIMEOUT BRIDGE_ISR_XREAD_REQ_TIMEOUT
575#define BRIDGE_IMR_GIO_B_ENBL_ERR BRIDGE_ISR_GIO_B_ENBL_ERR
576#define BRIDGE_IMR_INT_MSK BRIDGE_ISR_INT_MSK
577#define BRIDGE_IMR_INT(x) BRIDGE_ISR_INT(x)
578
579/* Bridge interrupt reset register bits definition */
580#define BRIDGE_IRR_MULTI_CLR (0x1 << 6)
581#define BRIDGE_IRR_CRP_GRP_CLR (0x1 << 5)
582#define BRIDGE_IRR_RESP_BUF_GRP_CLR (0x1 << 4)
583#define BRIDGE_IRR_REQ_DSP_GRP_CLR (0x1 << 3)
584#define BRIDGE_IRR_LLP_GRP_CLR (0x1 << 2)
585#define BRIDGE_IRR_SSRAM_GRP_CLR (0x1 << 1)
586#define BRIDGE_IRR_PCI_GRP_CLR (0x1 << 0)
587#define BRIDGE_IRR_GIO_GRP_CLR (0x1 << 0)
588#define BRIDGE_IRR_ALL_CLR 0x7f
589
590#define BRIDGE_IRR_CRP_GRP (BRIDGE_ISR_UNEXP_RESP | \
591 BRIDGE_ISR_XREQ_FIFO_OFLOW)
592#define BRIDGE_IRR_RESP_BUF_GRP (BRIDGE_ISR_BAD_XRESP_PKT | \
593 BRIDGE_ISR_RESP_XTLK_ERR | \
594 BRIDGE_ISR_XREAD_REQ_TIMEOUT)
595#define BRIDGE_IRR_REQ_DSP_GRP (BRIDGE_ISR_UNSUPPORTED_XOP | \
596 BRIDGE_ISR_BAD_XREQ_PKT | \
597 BRIDGE_ISR_REQ_XTLK_ERR | \
598 BRIDGE_ISR_INVLD_ADDR)
599#define BRIDGE_IRR_LLP_GRP (BRIDGE_ISR_LLP_REC_SNERR | \
600 BRIDGE_ISR_LLP_REC_CBERR | \
601 BRIDGE_ISR_LLP_RCTY | \
602 BRIDGE_ISR_LLP_TX_RETRY | \
603 BRIDGE_ISR_LLP_TCTY)
604#define BRIDGE_IRR_SSRAM_GRP (BRIDGE_ISR_SSRAM_PERR | \
605 BRIDGE_ISR_PMU_ESIZE_FAULT)
606#define BRIDGE_IRR_PCI_GRP (BRIDGE_ISR_PCI_ABORT | \
607 BRIDGE_ISR_PCI_PARITY | \
608 BRIDGE_ISR_PCI_SERR | \
609 BRIDGE_ISR_PCI_PERR | \
610 BRIDGE_ISR_PCI_MST_TIMEOUT | \
611 BRIDGE_ISR_PCI_RETRY_CNT)
612
613#define BRIDGE_IRR_GIO_GRP (BRIDGE_ISR_GIO_B_ENBL_ERR | \
614 BRIDGE_ISR_GIO_MST_TIMEOUT)
615
616/* Bridge INT_DEV register bits definition */
617#define BRIDGE_INT_DEV_SHFT(n) ((n)*3)
618#define BRIDGE_INT_DEV_MASK(n) (0x7 << BRIDGE_INT_DEV_SHFT(n))
619#define BRIDGE_INT_DEV_SET(_dev, _line) (_dev << BRIDGE_INT_DEV_SHFT(_line))
620
621/* Bridge interrupt(x) register bits definition */
622#define BRIDGE_INT_ADDR_HOST 0x0003FF00
623#define BRIDGE_INT_ADDR_FLD 0x000000FF
624
625#define BRIDGE_TMO_PCI_RETRY_HLD_MASK 0x1f0000
626#define BRIDGE_TMO_GIO_TIMEOUT_MASK 0x001000
627#define BRIDGE_TMO_PCI_RETRY_CNT_MASK 0x0003ff
628
629#define BRIDGE_TMO_PCI_RETRY_CNT_MAX 0x3ff
630
631/*
632 * The NASID should be shifted by this amount and stored into the
633 * interrupt(x) register.
634 */
635#define BRIDGE_INT_ADDR_NASID_SHFT 8
636
637/*
638 * The BRIDGE_INT_ADDR_DEST_IO bit should be set to send an interrupt to
639 * memory.
640 */
641#define BRIDGE_INT_ADDR_DEST_IO (1 << 17)
642#define BRIDGE_INT_ADDR_DEST_MEM 0
643#define BRIDGE_INT_ADDR_MASK (1 << 17)
644
645/* Bridge device(x) register bits definition */
646#define BRIDGE_DEV_ERR_LOCK_EN 0x10000000
647#define BRIDGE_DEV_PAGE_CHK_DIS 0x08000000
648#define BRIDGE_DEV_FORCE_PCI_PAR 0x04000000
649#define BRIDGE_DEV_VIRTUAL_EN 0x02000000
650#define BRIDGE_DEV_PMU_WRGA_EN 0x01000000
651#define BRIDGE_DEV_DIR_WRGA_EN 0x00800000
652#define BRIDGE_DEV_DEV_SIZE 0x00400000
653#define BRIDGE_DEV_RT 0x00200000
654#define BRIDGE_DEV_SWAP_PMU 0x00100000
655#define BRIDGE_DEV_SWAP_DIR 0x00080000
656#define BRIDGE_DEV_PREF 0x00040000
657#define BRIDGE_DEV_PRECISE 0x00020000
658#define BRIDGE_DEV_COH 0x00010000
659#define BRIDGE_DEV_BARRIER 0x00008000
660#define BRIDGE_DEV_GBR 0x00004000
661#define BRIDGE_DEV_DEV_SWAP 0x00002000
662#define BRIDGE_DEV_DEV_IO_MEM 0x00001000
663#define BRIDGE_DEV_OFF_MASK 0x00000fff
664#define BRIDGE_DEV_OFF_ADDR_SHFT 20
665
666#define BRIDGE_DEV_PMU_BITS (BRIDGE_DEV_PMU_WRGA_EN | \
667 BRIDGE_DEV_SWAP_PMU)
668#define BRIDGE_DEV_D32_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
669 BRIDGE_DEV_SWAP_DIR | \
670 BRIDGE_DEV_PREF | \
671 BRIDGE_DEV_PRECISE | \
672 BRIDGE_DEV_COH | \
673 BRIDGE_DEV_BARRIER)
674#define BRIDGE_DEV_D64_BITS (BRIDGE_DEV_DIR_WRGA_EN | \
675 BRIDGE_DEV_SWAP_DIR | \
676 BRIDGE_DEV_COH | \
677 BRIDGE_DEV_BARRIER)
678
679/* Bridge Error Upper register bit field definition */
680#define BRIDGE_ERRUPPR_DEVMASTER (0x1 << 20) /* Device was master */
681#define BRIDGE_ERRUPPR_PCIVDEV (0x1 << 19) /* Virtual Req value */
682#define BRIDGE_ERRUPPR_DEVNUM_SHFT (16)
683#define BRIDGE_ERRUPPR_DEVNUM_MASK (0x7 << BRIDGE_ERRUPPR_DEVNUM_SHFT)
684#define BRIDGE_ERRUPPR_DEVICE(err) (((err) >> BRIDGE_ERRUPPR_DEVNUM_SHFT) & 0x7)
685#define BRIDGE_ERRUPPR_ADDRMASK (0xFFFF)
686
687/* Bridge interrupt mode register bits definition */
688#define BRIDGE_INTMODE_CLR_PKT_EN(x) (0x1 << (x))
689
690/* this should be written to the xbow's link_control(x) register */
691#define BRIDGE_CREDIT 3
692
693/* RRB assignment register */
694#define BRIDGE_RRB_EN 0x8 /* after shifting down */
695#define BRIDGE_RRB_DEV 0x7 /* after shifting down */
696#define BRIDGE_RRB_VDEV 0x4 /* after shifting down */
697#define BRIDGE_RRB_PDEV 0x3 /* after shifting down */
698
699/* RRB status register */
700#define BRIDGE_RRB_VALID(r) (0x00010000<<(r))
701#define BRIDGE_RRB_INUSE(r) (0x00000001<<(r))
702
703/* RRB clear register */
704#define BRIDGE_RRB_CLEAR(r) (0x00000001<<(r))
705
706/* xbox system controller declarations */
707#define XBOX_BRIDGE_WID 8
708#define FLASH_PROM1_BASE 0xE00000 /* To read the xbox sysctlr status */
709#define XBOX_RPS_EXISTS 1 << 6 /* RPS bit in status register */
710#define XBOX_RPS_FAIL 1 << 4 /* RPS status bit in register */
711
712/* ========================================================================
713 */
714/*
715 * Macros for Xtalk to Bridge bus (PCI/GIO) PIO
716 * refer to section 4.2.1 of Bridge Spec for xtalk to PCI/GIO PIO mappings
717 */
718/* XTALK addresses that map into Bridge Bus addr space */
719#define BRIDGE_PIO32_XTALK_ALIAS_BASE 0x000040000000L
720#define BRIDGE_PIO32_XTALK_ALIAS_LIMIT 0x00007FFFFFFFL
721#define BRIDGE_PIO64_XTALK_ALIAS_BASE 0x000080000000L
722#define BRIDGE_PIO64_XTALK_ALIAS_LIMIT 0x0000BFFFFFFFL
723#define BRIDGE_PCIIO_XTALK_ALIAS_BASE 0x000100000000L
724#define BRIDGE_PCIIO_XTALK_ALIAS_LIMIT 0x0001FFFFFFFFL
725
726/* Ranges of PCI bus space that can be accessed via PIO from xtalk */
727#define BRIDGE_MIN_PIO_ADDR_MEM 0x00000000 /* 1G PCI memory space */
728#define BRIDGE_MAX_PIO_ADDR_MEM 0x3fffffff
729#define BRIDGE_MIN_PIO_ADDR_IO 0x00000000 /* 4G PCI IO space */
730#define BRIDGE_MAX_PIO_ADDR_IO 0xffffffff
731
732/* XTALK addresses that map into PCI addresses */
733#define BRIDGE_PCI_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
734#define BRIDGE_PCI_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
735#define BRIDGE_PCI_MEM64_BASE BRIDGE_PIO64_XTALK_ALIAS_BASE
736#define BRIDGE_PCI_MEM64_LIMIT BRIDGE_PIO64_XTALK_ALIAS_LIMIT
737#define BRIDGE_PCI_IO_BASE BRIDGE_PCIIO_XTALK_ALIAS_BASE
738#define BRIDGE_PCI_IO_LIMIT BRIDGE_PCIIO_XTALK_ALIAS_LIMIT
739
740/*
741 * Macros for Bridge bus (PCI/GIO) to Xtalk DMA
742 */
743/* Bridge Bus DMA addresses */
744#define BRIDGE_LOCAL_BASE 0
745#define BRIDGE_DMA_MAPPED_BASE 0x40000000
746#define BRIDGE_DMA_MAPPED_SIZE 0x40000000 /* 1G Bytes */
747#define BRIDGE_DMA_DIRECT_BASE 0x80000000
748#define BRIDGE_DMA_DIRECT_SIZE 0x80000000 /* 2G Bytes */
749
750#define PCI32_LOCAL_BASE BRIDGE_LOCAL_BASE
751
752/* PCI addresses of regions decoded by Bridge for DMA */
753#define PCI32_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
754#define PCI32_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
755
756#define IS_PCI32_LOCAL(x) ((ulong_t)(x) < PCI32_MAPPED_BASE)
757#define IS_PCI32_MAPPED(x) ((ulong_t)(x) < PCI32_DIRECT_BASE && \
758 (ulong_t)(x) >= PCI32_MAPPED_BASE)
759#define IS_PCI32_DIRECT(x) ((ulong_t)(x) >= PCI32_MAPPED_BASE)
760#define IS_PCI64(x) ((ulong_t)(x) >= PCI64_BASE)
761
762/*
763 * The GIO address space.
764 */
765/* Xtalk to GIO PIO */
766#define BRIDGE_GIO_MEM32_BASE BRIDGE_PIO32_XTALK_ALIAS_BASE
767#define BRIDGE_GIO_MEM32_LIMIT BRIDGE_PIO32_XTALK_ALIAS_LIMIT
768
769#define GIO_LOCAL_BASE BRIDGE_LOCAL_BASE
770
771/* GIO addresses of regions decoded by Bridge for DMA */
772#define GIO_MAPPED_BASE BRIDGE_DMA_MAPPED_BASE
773#define GIO_DIRECT_BASE BRIDGE_DMA_DIRECT_BASE
774
775#define IS_GIO_LOCAL(x) ((ulong_t)(x) < GIO_MAPPED_BASE)
776#define IS_GIO_MAPPED(x) ((ulong_t)(x) < GIO_DIRECT_BASE && \
777 (ulong_t)(x) >= GIO_MAPPED_BASE)
778#define IS_GIO_DIRECT(x) ((ulong_t)(x) >= GIO_MAPPED_BASE)
779
780/* PCI to xtalk mapping */
781
782/* given a DIR_OFF value and a pci/gio 32 bits direct address, determine
783 * which xtalk address is accessed
784 */
785#define BRIDGE_DIRECT_32_SEG_SIZE BRIDGE_DMA_DIRECT_SIZE
786#define BRIDGE_DIRECT_32_TO_XTALK(dir_off,adr) \
787 ((dir_off) * BRIDGE_DIRECT_32_SEG_SIZE + \
788 ((adr) & (BRIDGE_DIRECT_32_SEG_SIZE - 1)) + PHYS_RAMBASE)
789
790/* 64-bit address attribute masks */
791#define PCI64_ATTR_TARG_MASK 0xf000000000000000
792#define PCI64_ATTR_TARG_SHFT 60
793#define PCI64_ATTR_PREF 0x0800000000000000
794#define PCI64_ATTR_PREC 0x0400000000000000
795#define PCI64_ATTR_VIRTUAL 0x0200000000000000
796#define PCI64_ATTR_BAR 0x0100000000000000
797#define PCI64_ATTR_RMF_MASK 0x00ff000000000000
798#define PCI64_ATTR_RMF_SHFT 48
799
800#ifndef __ASSEMBLY__
801/* Address translation entry for mapped pci32 accesses */
802typedef union ate_u {
803 u64 ent;
804 struct ate_s {
805 u64 rmf:16;
806 u64 addr:36;
807 u64 targ:4;
808 u64 reserved:3;
809 u64 barrier:1;
810 u64 prefetch:1;
811 u64 precise:1;
812 u64 coherent:1;
813 u64 valid:1;
814 } field;
815} ate_t;
816#endif /* !__ASSEMBLY__ */
817
818#define ATE_V 0x01
819#define ATE_CO 0x02
820#define ATE_PREC 0x04
821#define ATE_PREF 0x08
822#define ATE_BAR 0x10
823
824#define ATE_PFNSHIFT 12
825#define ATE_TIDSHIFT 8
826#define ATE_RMFSHIFT 48
827
828#define mkate(xaddr, xid, attr) ((xaddr) & 0x0000fffffffff000ULL) | \
829 ((xid)<<ATE_TIDSHIFT) | \
830 (attr)
831
832#define BRIDGE_INTERNAL_ATES 128
833
834struct bridge_controller {
835 struct pci_controller pc;
836 struct resource mem;
837 struct resource io;
838 bridge_t *base;
839 nasid_t nasid;
840 unsigned int widget_id;
841 unsigned int irq_cpu;
842 dma64_addr_t baddr;
843 unsigned int pci_int[8];
844};
845
846#define BRIDGE_CONTROLLER(bus) \
847 ((struct bridge_controller *)((bus)->sysdata))
848
849extern void register_bridge_irq(unsigned int irq);
850extern int request_bridge_irq(struct bridge_controller *bc);
851
852extern struct pci_ops bridge_pci_ops;
853
854#endif /* _ASM_PCI_BRIDGE_H */
diff --git a/include/asm-mips/percpu.h b/include/asm-mips/percpu.h
deleted file mode 100644
index 844e763e9332..000000000000
--- a/include/asm-mips/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_PERCPU_H
2#define __ASM_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif /* __ASM_PERCPU_H */
diff --git a/include/asm-mips/pgalloc.h b/include/asm-mips/pgalloc.h
deleted file mode 100644
index 1275831dda29..000000000000
--- a/include/asm-mips/pgalloc.h
+++ /dev/null
@@ -1,143 +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) 1994 - 2001, 2003 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGALLOC_H
10#define _ASM_PGALLOC_H
11
12#include <linux/highmem.h>
13#include <linux/mm.h>
14#include <linux/sched.h>
15
16static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
17 pte_t *pte)
18{
19 set_pmd(pmd, __pmd((unsigned long)pte));
20}
21
22static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
23 pgtable_t pte)
24{
25 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
26}
27#define pmd_pgtable(pmd) pmd_page(pmd)
28
29/*
30 * Initialize a new pmd table with invalid pointers.
31 */
32extern void pmd_init(unsigned long page, unsigned long pagetable);
33
34#ifdef CONFIG_64BIT
35
36static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
37{
38 set_pud(pud, __pud((unsigned long)pmd));
39}
40#endif
41
42/*
43 * Initialize a new pgd / pmd table with invalid pointers.
44 */
45extern void pgd_init(unsigned long page);
46
47static inline pgd_t *pgd_alloc(struct mm_struct *mm)
48{
49 pgd_t *ret, *init;
50
51 ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER);
52 if (ret) {
53 init = pgd_offset(&init_mm, 0UL);
54 pgd_init((unsigned long)ret);
55 memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
56 (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
57 }
58
59 return ret;
60}
61
62static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
63{
64 free_pages((unsigned long)pgd, PGD_ORDER);
65}
66
67static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
68 unsigned long address)
69{
70 pte_t *pte;
71
72 pte = (pte_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, PTE_ORDER);
73
74 return pte;
75}
76
77static inline struct page *pte_alloc_one(struct mm_struct *mm,
78 unsigned long address)
79{
80 struct page *pte;
81
82 pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
83 if (pte) {
84 clear_highpage(pte);
85 pgtable_page_ctor(pte);
86 }
87 return pte;
88}
89
90static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
91{
92 free_pages((unsigned long)pte, PTE_ORDER);
93}
94
95static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
96{
97 pgtable_page_dtor(pte);
98 __free_pages(pte, PTE_ORDER);
99}
100
101#define __pte_free_tlb(tlb,pte) \
102do { \
103 pgtable_page_dtor(pte); \
104 tlb_remove_page((tlb), pte); \
105} while (0)
106
107#ifdef CONFIG_32BIT
108
109/*
110 * allocating and freeing a pmd is trivial: the 1-entry pmd is
111 * inside the pgd, so has no extra memory associated with it.
112 */
113#define pmd_free(mm, x) do { } while (0)
114#define __pmd_free_tlb(tlb, x) do { } while (0)
115
116#endif
117
118#ifdef CONFIG_64BIT
119
120static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
121{
122 pmd_t *pmd;
123
124 pmd = (pmd_t *) __get_free_pages(GFP_KERNEL|__GFP_REPEAT, PMD_ORDER);
125 if (pmd)
126 pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table);
127 return pmd;
128}
129
130static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
131{
132 free_pages((unsigned long)pmd, PMD_ORDER);
133}
134
135#define __pmd_free_tlb(tlb, x) pmd_free((tlb)->mm, x)
136
137#endif
138
139#define check_pgt_cache() do { } while (0)
140
141extern void pagetable_init(void);
142
143#endif /* _ASM_PGALLOC_H */
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
deleted file mode 100644
index 55813d6150c7..000000000000
--- a/include/asm-mips/pgtable-32.h
+++ /dev/null
@@ -1,234 +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) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGTABLE_32_H
10#define _ASM_PGTABLE_32_H
11
12#include <asm/addrspace.h>
13#include <asm/page.h>
14
15#include <linux/linkage.h>
16#include <asm/cachectl.h>
17#include <asm/fixmap.h>
18
19#include <asm-generic/pgtable-nopmd.h>
20
21/*
22 * - add_wired_entry() add a fixed TLB entry, and move wired register
23 */
24extern void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
25 unsigned long entryhi, unsigned long pagemask);
26
27/*
28 * - add_temporary_entry() add a temporary TLB entry. We use TLB entries
29 * starting at the top and working down. This is for populating the
30 * TLB before trap_init() puts the TLB miss handler in place. It
31 * should be used only for entries matching the actual page tables,
32 * to prevent inconsistencies.
33 */
34extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
35 unsigned long entryhi, unsigned long pagemask);
36
37
38/* Basically we have the same two-level (which is the logical three level
39 * Linux page table layout folded) page tables as the i386. Some day
40 * when we have proper page coloring support we can have a 1% quicker
41 * tlb refill handling mechanism, but for now it is a bit slower but
42 * works even with the cache aliasing problem the R4k and above have.
43 */
44
45/* PGDIR_SHIFT determines what a third-level page table entry can map */
46#define PGDIR_SHIFT (2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2)
47#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
48#define PGDIR_MASK (~(PGDIR_SIZE-1))
49
50/*
51 * Entries per page directory level: we use two-level, so
52 * we don't really have any PUD/PMD directory physically.
53 */
54#define __PGD_ORDER (32 - 3 * PAGE_SHIFT + PGD_T_LOG2 + PTE_T_LOG2)
55#define PGD_ORDER (__PGD_ORDER >= 0 ? __PGD_ORDER : 0)
56#define PUD_ORDER aieeee_attempt_to_allocate_pud
57#define PMD_ORDER 1
58#define PTE_ORDER 0
59
60#define PTRS_PER_PGD (USER_PTRS_PER_PGD * 2)
61#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
62
63#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
64#define FIRST_USER_ADDRESS 0
65
66#define VMALLOC_START MAP_BASE
67
68#define PKMAP_BASE (0xfe000000UL)
69
70#ifdef CONFIG_HIGHMEM
71# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
72#else
73# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
74#endif
75
76#ifdef CONFIG_64BIT_PHYS_ADDR
77#define pte_ERROR(e) \
78 printk("%s:%d: bad pte %016Lx.\n", __FILE__, __LINE__, pte_val(e))
79#else
80#define pte_ERROR(e) \
81 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
82#endif
83#define pgd_ERROR(e) \
84 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
85
86extern void load_pgd(unsigned long pg_dir);
87
88extern pte_t invalid_pte_table[PAGE_SIZE/sizeof(pte_t)];
89
90/*
91 * Empty pgd/pmd entries point to the invalid_pte_table.
92 */
93static inline int pmd_none(pmd_t pmd)
94{
95 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
96}
97
98#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
99
100static inline int pmd_present(pmd_t pmd)
101{
102 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
103}
104
105static inline void pmd_clear(pmd_t *pmdp)
106{
107 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
108}
109
110#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
111#define pte_page(x) pfn_to_page(pte_pfn(x))
112#define pte_pfn(x) ((unsigned long)((x).pte_high >> 6))
113static inline pte_t
114pfn_pte(unsigned long pfn, pgprot_t prot)
115{
116 pte_t pte;
117 pte.pte_high = (pfn << 6) | (pgprot_val(prot) & 0x3f);
118 pte.pte_low = pgprot_val(prot);
119 return pte;
120}
121
122#else
123
124#define pte_page(x) pfn_to_page(pte_pfn(x))
125
126#ifdef CONFIG_CPU_VR41XX
127#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
128#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
129#else
130#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
131#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
132#endif
133#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
134
135#define __pgd_offset(address) pgd_index(address)
136#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
137#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
138
139/* to find an entry in a kernel page-table-directory */
140#define pgd_offset_k(address) pgd_offset(&init_mm, address)
141
142#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
143
144/* to find an entry in a page-table-directory */
145#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
146
147/* Find an entry in the third-level page table.. */
148#define __pte_offset(address) \
149 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
150#define pte_offset(dir, address) \
151 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
152#define pte_offset_kernel(dir, address) \
153 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
154
155#define pte_offset_map(dir, address) \
156 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
157#define pte_offset_map_nested(dir, address) \
158 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
159#define pte_unmap(pte) ((void)(pte))
160#define pte_unmap_nested(pte) ((void)(pte))
161
162#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
163
164/* Swap entries must have VALID bit cleared. */
165#define __swp_type(x) (((x).val >> 10) & 0x1f)
166#define __swp_offset(x) ((x).val >> 15)
167#define __swp_entry(type,offset) \
168 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
169
170/*
171 * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
172 */
173#define PTE_FILE_MAX_BITS 28
174
175#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \
176 (((_pte).pte >> 2 ) & 0x38) | \
177 (((_pte).pte >> 10) << 6 ))
178
179#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \
180 (((off) & 0x38) << 2 ) | \
181 (((off) >> 6 ) << 10) | \
182 _PAGE_FILE })
183
184#else
185
186/* Swap entries must have VALID and GLOBAL bits cleared. */
187#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
188#define __swp_type(x) (((x).val >> 2) & 0x1f)
189#define __swp_offset(x) ((x).val >> 7)
190#define __swp_entry(type,offset) \
191 ((swp_entry_t) { ((type) << 2) | ((offset) << 7) })
192#else
193#define __swp_type(x) (((x).val >> 8) & 0x1f)
194#define __swp_offset(x) ((x).val >> 13)
195#define __swp_entry(type,offset) \
196 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
197#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
198
199#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
200/*
201 * Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
202 */
203#define PTE_FILE_MAX_BITS 30
204
205#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2)
206#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 })
207
208#else
209/*
210 * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range:
211 */
212#define PTE_FILE_MAX_BITS 28
213
214#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \
215 (((_pte).pte >> 2) & 0x8) | \
216 (((_pte).pte >> 8) << 4))
217
218#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \
219 (((off) & 0x8) << 2) | \
220 (((off) >> 4) << 8) | \
221 _PAGE_FILE })
222#endif
223
224#endif
225
226#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
227#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
228#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
229#else
230#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
231#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
232#endif
233
234#endif /* _ASM_PGTABLE_32_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
deleted file mode 100644
index 943515f0ef87..000000000000
--- a/include/asm-mips/pgtable-64.h
+++ /dev/null
@@ -1,253 +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) 1994, 95, 96, 97, 98, 99, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PGTABLE_64_H
10#define _ASM_PGTABLE_64_H
11
12#include <linux/linkage.h>
13
14#include <asm/addrspace.h>
15#include <asm/page.h>
16#include <asm/cachectl.h>
17#include <asm/fixmap.h>
18
19#include <asm-generic/pgtable-nopud.h>
20
21/*
22 * Each address space has 2 4K pages as its page directory, giving 1024
23 * (== PTRS_PER_PGD) 8 byte pointers to pmd tables. Each pmd table is a
24 * single 4K page, giving 512 (== PTRS_PER_PMD) 8 byte pointers to page
25 * tables. Each page table is also a single 4K page, giving 512 (==
26 * PTRS_PER_PTE) 8 byte ptes. Each pud entry is initialized to point to
27 * invalid_pmd_table, each pmd entry is initialized to point to
28 * invalid_pte_table, each pte is initialized to 0. When memory is low,
29 * and a pmd table or a page table allocation fails, empty_bad_pmd_table
30 * and empty_bad_page_table is returned back to higher layer code, so
31 * that the failure is recognized later on. Linux does not seem to
32 * handle these failures very well though. The empty_bad_page_table has
33 * invalid pte entries in it, to force page faults.
34 *
35 * Kernel mappings: kernel mappings are held in the swapper_pg_table.
36 * The layout is identical to userspace except it's indexed with the
37 * fault address - VMALLOC_START.
38 */
39
40/* PMD_SHIFT determines the size of the area a second-level page table can map */
41#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
42#define PMD_SIZE (1UL << PMD_SHIFT)
43#define PMD_MASK (~(PMD_SIZE-1))
44
45/* PGDIR_SHIFT determines what a third-level page table entry can map */
46#define PGDIR_SHIFT (PMD_SHIFT + (PAGE_SHIFT + PMD_ORDER - 3))
47#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
48#define PGDIR_MASK (~(PGDIR_SIZE-1))
49
50/*
51 * For 4kB page size we use a 3 level page tree and an 8kB pud, which
52 * permits us mapping 40 bits of virtual address space.
53 *
54 * We used to implement 41 bits by having an order 1 pmd level but that seemed
55 * rather pointless.
56 *
57 * For 8kB page size we use a 3 level page tree which permits a total of
58 * 8TB of address space. Alternatively a 33-bit / 8GB organization using
59 * two levels would be easy to implement.
60 *
61 * For 16kB page size we use a 2 level page tree which permits a total of
62 * 36 bits of virtual address space. We could add a third level but it seems
63 * like at the moment there's no need for this.
64 *
65 * For 64kB page size we use a 2 level page table tree for a total of 42 bits
66 * of virtual address space.
67 */
68#ifdef CONFIG_PAGE_SIZE_4KB
69#define PGD_ORDER 1
70#define PUD_ORDER aieeee_attempt_to_allocate_pud
71#define PMD_ORDER 0
72#define PTE_ORDER 0
73#endif
74#ifdef CONFIG_PAGE_SIZE_8KB
75#define PGD_ORDER 0
76#define PUD_ORDER aieeee_attempt_to_allocate_pud
77#define PMD_ORDER 0
78#define PTE_ORDER 0
79#endif
80#ifdef CONFIG_PAGE_SIZE_16KB
81#define PGD_ORDER 0
82#define PUD_ORDER aieeee_attempt_to_allocate_pud
83#define PMD_ORDER 0
84#define PTE_ORDER 0
85#endif
86#ifdef CONFIG_PAGE_SIZE_64KB
87#define PGD_ORDER 0
88#define PUD_ORDER aieeee_attempt_to_allocate_pud
89#define PMD_ORDER 0
90#define PTE_ORDER 0
91#endif
92
93#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
94#define PTRS_PER_PMD ((PAGE_SIZE << PMD_ORDER) / sizeof(pmd_t))
95#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
96
97#if PGDIR_SIZE >= TASK_SIZE
98#define USER_PTRS_PER_PGD (1)
99#else
100#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
101#endif
102#define FIRST_USER_ADDRESS 0UL
103
104#define VMALLOC_START MAP_BASE
105#define VMALLOC_END \
106 (VMALLOC_START + PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE)
107#if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
108 VMALLOC_START != CKSSEG
109/* Load modules into 32bit-compatible segment. */
110#define MODULE_START CKSSEG
111#define MODULE_END (FIXADDR_START-2*PAGE_SIZE)
112extern pgd_t module_pg_dir[PTRS_PER_PGD];
113#endif
114
115#define pte_ERROR(e) \
116 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
117#define pmd_ERROR(e) \
118 printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
119#define pgd_ERROR(e) \
120 printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
121
122extern pte_t invalid_pte_table[PTRS_PER_PTE];
123extern pte_t empty_bad_page_table[PTRS_PER_PTE];
124extern pmd_t invalid_pmd_table[PTRS_PER_PMD];
125extern pmd_t empty_bad_pmd_table[PTRS_PER_PMD];
126
127/*
128 * Empty pgd/pmd entries point to the invalid_pte_table.
129 */
130static inline int pmd_none(pmd_t pmd)
131{
132 return pmd_val(pmd) == (unsigned long) invalid_pte_table;
133}
134
135#define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK)
136
137static inline int pmd_present(pmd_t pmd)
138{
139 return pmd_val(pmd) != (unsigned long) invalid_pte_table;
140}
141
142static inline void pmd_clear(pmd_t *pmdp)
143{
144 pmd_val(*pmdp) = ((unsigned long) invalid_pte_table);
145}
146
147/*
148 * Empty pud entries point to the invalid_pmd_table.
149 */
150static inline int pud_none(pud_t pud)
151{
152 return pud_val(pud) == (unsigned long) invalid_pmd_table;
153}
154
155static inline int pud_bad(pud_t pud)
156{
157 return pud_val(pud) & ~PAGE_MASK;
158}
159
160static inline int pud_present(pud_t pud)
161{
162 return pud_val(pud) != (unsigned long) invalid_pmd_table;
163}
164
165static inline void pud_clear(pud_t *pudp)
166{
167 pud_val(*pudp) = ((unsigned long) invalid_pmd_table);
168}
169
170#define pte_page(x) pfn_to_page(pte_pfn(x))
171
172#ifdef CONFIG_CPU_VR41XX
173#define pte_pfn(x) ((unsigned long)((x).pte >> (PAGE_SHIFT + 2)))
174#define pfn_pte(pfn, prot) __pte(((pfn) << (PAGE_SHIFT + 2)) | pgprot_val(prot))
175#else
176#define pte_pfn(x) ((unsigned long)((x).pte >> PAGE_SHIFT))
177#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
178#endif
179
180#define __pgd_offset(address) pgd_index(address)
181#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
182#define __pmd_offset(address) pmd_index(address)
183
184/* to find an entry in a kernel page-table-directory */
185#ifdef MODULE_START
186#define pgd_offset_k(address) \
187 ((address) >= MODULE_START ? module_pg_dir : pgd_offset(&init_mm, 0UL))
188#else
189#define pgd_offset_k(address) pgd_offset(&init_mm, 0UL)
190#endif
191
192#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
193#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
194
195/* to find an entry in a page-table-directory */
196#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr))
197
198static inline unsigned long pud_page_vaddr(pud_t pud)
199{
200 return pud_val(pud);
201}
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))
204
205/* Find an entry in the second-level page table.. */
206static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
207{
208 return (pmd_t *) pud_page_vaddr(*pud) + pmd_index(address);
209}
210
211/* Find an entry in the third-level page table.. */
212#define __pte_offset(address) \
213 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
214#define pte_offset(dir, address) \
215 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
216#define pte_offset_kernel(dir, address) \
217 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
218#define pte_offset_map(dir, address) \
219 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
220#define pte_offset_map_nested(dir, address) \
221 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
222#define pte_unmap(pte) ((void)(pte))
223#define pte_unmap_nested(pte) ((void)(pte))
224
225/*
226 * Initialize a new pgd / pmd table with invalid pointers.
227 */
228extern void pgd_init(unsigned long page);
229extern void pmd_init(unsigned long page, unsigned long pagetable);
230
231/*
232 * Non-present pages: high 24 bits are offset, next 8 bits type,
233 * low 32 bits zero.
234 */
235static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
236{ pte_t pte; pte_val(pte) = (type << 32) | (offset << 40); return pte; }
237
238#define __swp_type(x) (((x).val >> 32) & 0xff)
239#define __swp_offset(x) ((x).val >> 40)
240#define __swp_entry(type, offset) ((swp_entry_t) { pte_val(mk_swap_pte((type), (offset))) })
241#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
242#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
243
244/*
245 * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
246 * make things easier, and only use the upper 56 bits for the page offset...
247 */
248#define PTE_FILE_MAX_BITS 56
249
250#define pte_to_pgoff(_pte) ((_pte).pte >> 8)
251#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE })
252
253#endif /* _ASM_PGTABLE_64_H */
diff --git a/include/asm-mips/pgtable-bits.h b/include/asm-mips/pgtable-bits.h
deleted file mode 100644
index 51b34a48c84a..000000000000
--- a/include/asm-mips/pgtable-bits.h
+++ /dev/null
@@ -1,137 +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) 1994 - 2002 by Ralf Baechle
7 * Copyright (C) 1999, 2000, 2001 Silicon Graphics, Inc.
8 * Copyright (C) 2002 Maciej W. Rozycki
9 */
10#ifndef _ASM_PGTABLE_BITS_H
11#define _ASM_PGTABLE_BITS_H
12
13
14/*
15 * Note that we shift the lower 32bits of each EntryLo[01] entry
16 * 6 bits to the left. That way we can convert the PFN into the
17 * physical address by a single 'and' operation and gain 6 additional
18 * bits for storing information which isn't present in a normal
19 * MIPS page table.
20 *
21 * Similar to the Alpha port, we need to keep track of the ref
22 * and mod bits in software. We have a software "yeah you can read
23 * from this page" bit, and a hardware one which actually lets the
24 * process read from the page. On the same token we have a software
25 * writable bit and the real hardware one which actually lets the
26 * process write to the page, this keeps a mod bit via the hardware
27 * dirty bit.
28 *
29 * Certain revisions of the R4000 and R5000 have a bug where if a
30 * certain sequence occurs in the last 3 instructions of an executable
31 * page, and the following page is not mapped, the cpu can do
32 * unpredictable things. The code (when it is written) to deal with
33 * this problem will be in the update_mmu_cache() code for the r4k.
34 */
35#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
36
37#define _PAGE_PRESENT (1<<6) /* implemented in software */
38#define _PAGE_READ (1<<7) /* implemented in software */
39#define _PAGE_WRITE (1<<8) /* implemented in software */
40#define _PAGE_ACCESSED (1<<9) /* implemented in software */
41#define _PAGE_MODIFIED (1<<10) /* implemented in software */
42#define _PAGE_FILE (1<<10) /* set:pagecache unset:swap */
43
44#define _PAGE_R4KBUG (1<<0) /* workaround for r4k bug */
45#define _PAGE_GLOBAL (1<<0)
46#define _PAGE_VALID (1<<1)
47#define _PAGE_SILENT_READ (1<<1) /* synonym */
48#define _PAGE_DIRTY (1<<2) /* The MIPS dirty bit */
49#define _PAGE_SILENT_WRITE (1<<2)
50#define _CACHE_SHIFT 3
51#define _CACHE_MASK (7<<3)
52
53#else
54
55#define _PAGE_PRESENT (1<<0) /* implemented in software */
56#define _PAGE_READ (1<<1) /* implemented in software */
57#define _PAGE_WRITE (1<<2) /* implemented in software */
58#define _PAGE_ACCESSED (1<<3) /* implemented in software */
59#define _PAGE_MODIFIED (1<<4) /* implemented in software */
60#define _PAGE_FILE (1<<4) /* set:pagecache unset:swap */
61
62#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
63
64#define _PAGE_GLOBAL (1<<8)
65#define _PAGE_VALID (1<<9)
66#define _PAGE_SILENT_READ (1<<9) /* synonym */
67#define _PAGE_DIRTY (1<<10) /* The MIPS dirty bit */
68#define _PAGE_SILENT_WRITE (1<<10)
69#define _CACHE_UNCACHED (1<<11)
70#define _CACHE_MASK (1<<11)
71
72#else
73
74#define _PAGE_R4KBUG (1<<5) /* workaround for r4k bug */
75#define _PAGE_GLOBAL (1<<6)
76#define _PAGE_VALID (1<<7)
77#define _PAGE_SILENT_READ (1<<7) /* synonym */
78#define _PAGE_DIRTY (1<<8) /* The MIPS dirty bit */
79#define _PAGE_SILENT_WRITE (1<<8)
80#define _CACHE_SHIFT 9
81#define _CACHE_MASK (7<<9)
82
83#endif
84#endif /* defined(CONFIG_64BIT_PHYS_ADDR && defined(CONFIG_CPU_MIPS32) */
85
86
87/*
88 * Cache attributes
89 */
90#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
91
92#define _CACHE_CACHABLE_NONCOHERENT 0
93
94#elif defined(CONFIG_CPU_SB1)
95
96/* No penalty for being coherent on the SB1, so just
97 use it for "noncoherent" spaces, too. Shouldn't hurt. */
98
99#define _CACHE_UNCACHED (2<<_CACHE_SHIFT)
100#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT)
101#define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT)
102#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT)
103
104#elif defined(CONFIG_CPU_RM9000)
105
106#define _CACHE_WT (0<<_CACHE_SHIFT)
107#define _CACHE_WTWA (1<<_CACHE_SHIFT)
108#define _CACHE_UC_B (2<<_CACHE_SHIFT)
109#define _CACHE_WB (3<<_CACHE_SHIFT)
110#define _CACHE_CWBEA (4<<_CACHE_SHIFT)
111#define _CACHE_CWB (5<<_CACHE_SHIFT)
112#define _CACHE_UCNB (6<<_CACHE_SHIFT)
113#define _CACHE_FPC (7<<_CACHE_SHIFT)
114
115#define _CACHE_UNCACHED _CACHE_UC_B
116#define _CACHE_CACHABLE_NONCOHERENT _CACHE_WB
117
118#else
119
120#define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT) /* R4600 only */
121#define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT) /* R4600 only */
122#define _CACHE_UNCACHED (2<<_CACHE_SHIFT) /* R4[0246]00 */
123#define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT) /* R4[0246]00 */
124#define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT) /* R4[04]00MC only */
125#define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT) /* R4[04]00MC only */
126#define _CACHE_CACHABLE_COHERENT (5<<_CACHE_SHIFT) /* MIPS32R2 CMP */
127#define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT) /* R4[04]00MC only */
128#define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) /* R10000 only */
129
130#endif
131
132#define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED)
133#define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED)
134
135#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK)
136
137#endif /* _ASM_PGTABLE_BITS_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
deleted file mode 100644
index 6a0edf72ffbc..000000000000
--- a/include/asm-mips/pgtable.h
+++ /dev/null
@@ -1,383 +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 Ralf Baechle
7 */
8#ifndef _ASM_PGTABLE_H
9#define _ASM_PGTABLE_H
10
11#ifdef CONFIG_32BIT
12#include <asm/pgtable-32.h>
13#endif
14#ifdef CONFIG_64BIT
15#include <asm/pgtable-64.h>
16#endif
17
18#include <asm/io.h>
19#include <asm/pgtable-bits.h>
20
21struct mm_struct;
22struct vm_area_struct;
23
24#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
25#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
26 _page_cachable_default)
27#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | \
28 _page_cachable_default)
29#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | \
30 _page_cachable_default)
31#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \
32 _PAGE_GLOBAL | _page_cachable_default)
33#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
34 _page_cachable_default)
35#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \
36 __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
37
38/*
39 * MIPS can't do page protection for execute, and considers that the same like
40 * read. Also, write permissions imply read permissions. This is the closest
41 * we can get by reasonable means..
42 */
43
44/*
45 * Dummy values to fill the table in mmap.c
46 * The real values will be generated at runtime
47 */
48#define __P000 __pgprot(0)
49#define __P001 __pgprot(0)
50#define __P010 __pgprot(0)
51#define __P011 __pgprot(0)
52#define __P100 __pgprot(0)
53#define __P101 __pgprot(0)
54#define __P110 __pgprot(0)
55#define __P111 __pgprot(0)
56
57#define __S000 __pgprot(0)
58#define __S001 __pgprot(0)
59#define __S010 __pgprot(0)
60#define __S011 __pgprot(0)
61#define __S100 __pgprot(0)
62#define __S101 __pgprot(0)
63#define __S110 __pgprot(0)
64#define __S111 __pgprot(0)
65
66extern unsigned long _page_cachable_default;
67
68/*
69 * ZERO_PAGE is a global shared page that is always zero; used
70 * for zero-mapped memory areas etc..
71 */
72
73extern unsigned long empty_zero_page;
74extern unsigned long zero_page_mask;
75
76#define ZERO_PAGE(vaddr) \
77 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
78
79extern void paging_init(void);
80
81/*
82 * Conversion functions: convert a page and protection to a page entry,
83 * and a page entry and page directory to the page they refer to.
84 */
85#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
86#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
87#define pmd_page_vaddr(pmd) pmd_val(pmd)
88
89#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
90
91#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
92#define pte_present(pte) ((pte).pte_low & _PAGE_PRESENT)
93
94static inline void set_pte(pte_t *ptep, pte_t pte)
95{
96 ptep->pte_high = pte.pte_high;
97 smp_wmb();
98 ptep->pte_low = pte.pte_low;
99 //printk("pte_high %x pte_low %x\n", ptep->pte_high, ptep->pte_low);
100
101 if (pte.pte_low & _PAGE_GLOBAL) {
102 pte_t *buddy = ptep_buddy(ptep);
103 /*
104 * Make sure the buddy is global too (if it's !none,
105 * it better already be global)
106 */
107 if (pte_none(*buddy)) {
108 buddy->pte_low |= _PAGE_GLOBAL;
109 buddy->pte_high |= _PAGE_GLOBAL;
110 }
111 }
112}
113#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
114
115static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
116{
117 pte_t null = __pte(0);
118
119 /* Preserve global status for the pair */
120 if (ptep_buddy(ptep)->pte_low & _PAGE_GLOBAL)
121 null.pte_low = null.pte_high = _PAGE_GLOBAL;
122
123 set_pte_at(mm, addr, ptep, null);
124}
125#else
126
127#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
128#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
129
130/*
131 * Certain architectures need to do special things when pte's
132 * within a page table are directly modified. Thus, the following
133 * hook is made available.
134 */
135static inline void set_pte(pte_t *ptep, pte_t pteval)
136{
137 *ptep = pteval;
138#if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX)
139 if (pte_val(pteval) & _PAGE_GLOBAL) {
140 pte_t *buddy = ptep_buddy(ptep);
141 /*
142 * Make sure the buddy is global too (if it's !none,
143 * it better already be global)
144 */
145 if (pte_none(*buddy))
146 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;
147 }
148#endif
149}
150#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
151
152static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
153{
154#if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX)
155 /* Preserve global status for the pair */
156 if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
157 set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
158 else
159#endif
160 set_pte_at(mm, addr, ptep, __pte(0));
161}
162#endif
163
164/*
165 * (pmds are folded into puds so this doesn't get actually called,
166 * but the define is needed for a generic inline function.)
167 */
168#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
169
170#ifdef CONFIG_64BIT
171/*
172 * (puds are folded into pgds so this doesn't get actually called,
173 * but the define is needed for a generic inline function.)
174 */
175#define set_pud(pudptr, pudval) do { *(pudptr) = (pudval); } while(0)
176#endif
177
178#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
179#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1)
180#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
181
182/*
183 * We used to declare this array with size but gcc 3.3 and older are not able
184 * to find that this expression is a constant, so the size is dropped.
185 */
186extern pgd_t swapper_pg_dir[];
187
188/*
189 * The following only work if pte_present() is true.
190 * Undefined behaviour if not..
191 */
192#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
193static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; }
194static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; }
195static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; }
196static inline int pte_file(pte_t pte) { return pte.pte_low & _PAGE_FILE; }
197
198static inline pte_t pte_wrprotect(pte_t pte)
199{
200 pte.pte_low &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
201 pte.pte_high &= ~_PAGE_SILENT_WRITE;
202 return pte;
203}
204
205static inline pte_t pte_mkclean(pte_t pte)
206{
207 pte.pte_low &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
208 pte.pte_high &= ~_PAGE_SILENT_WRITE;
209 return pte;
210}
211
212static inline pte_t pte_mkold(pte_t pte)
213{
214 pte.pte_low &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ);
215 pte.pte_high &= ~_PAGE_SILENT_READ;
216 return pte;
217}
218
219static inline pte_t pte_mkwrite(pte_t pte)
220{
221 pte.pte_low |= _PAGE_WRITE;
222 if (pte.pte_low & _PAGE_MODIFIED) {
223 pte.pte_low |= _PAGE_SILENT_WRITE;
224 pte.pte_high |= _PAGE_SILENT_WRITE;
225 }
226 return pte;
227}
228
229static inline pte_t pte_mkdirty(pte_t pte)
230{
231 pte.pte_low |= _PAGE_MODIFIED;
232 if (pte.pte_low & _PAGE_WRITE) {
233 pte.pte_low |= _PAGE_SILENT_WRITE;
234 pte.pte_high |= _PAGE_SILENT_WRITE;
235 }
236 return pte;
237}
238
239static inline pte_t pte_mkyoung(pte_t pte)
240{
241 pte.pte_low |= _PAGE_ACCESSED;
242 if (pte.pte_low & _PAGE_READ) {
243 pte.pte_low |= _PAGE_SILENT_READ;
244 pte.pte_high |= _PAGE_SILENT_READ;
245 }
246 return pte;
247}
248#else
249static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
250static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
251static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
252static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
253
254static inline pte_t pte_wrprotect(pte_t pte)
255{
256 pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
257 return pte;
258}
259
260static inline pte_t pte_mkclean(pte_t pte)
261{
262 pte_val(pte) &= ~(_PAGE_MODIFIED|_PAGE_SILENT_WRITE);
263 return pte;
264}
265
266static inline pte_t pte_mkold(pte_t pte)
267{
268 pte_val(pte) &= ~(_PAGE_ACCESSED|_PAGE_SILENT_READ);
269 return pte;
270}
271
272static inline pte_t pte_mkwrite(pte_t pte)
273{
274 pte_val(pte) |= _PAGE_WRITE;
275 if (pte_val(pte) & _PAGE_MODIFIED)
276 pte_val(pte) |= _PAGE_SILENT_WRITE;
277 return pte;
278}
279
280static inline pte_t pte_mkdirty(pte_t pte)
281{
282 pte_val(pte) |= _PAGE_MODIFIED;
283 if (pte_val(pte) & _PAGE_WRITE)
284 pte_val(pte) |= _PAGE_SILENT_WRITE;
285 return pte;
286}
287
288static inline pte_t pte_mkyoung(pte_t pte)
289{
290 pte_val(pte) |= _PAGE_ACCESSED;
291 if (pte_val(pte) & _PAGE_READ)
292 pte_val(pte) |= _PAGE_SILENT_READ;
293 return pte;
294}
295#endif
296static inline int pte_special(pte_t pte) { return 0; }
297static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
298
299/*
300 * Macro to make mark a page protection value as "uncacheable". Note
301 * that "protection" is really a misnomer here as the protection value
302 * contains the memory attribute bits, dirty bits, and various other
303 * bits as well.
304 */
305#define pgprot_noncached pgprot_noncached
306
307static inline pgprot_t pgprot_noncached(pgprot_t _prot)
308{
309 unsigned long prot = pgprot_val(_prot);
310
311 prot = (prot & ~_CACHE_MASK) | _CACHE_UNCACHED;
312
313 return __pgprot(prot);
314}
315
316/*
317 * Conversion functions: convert a page and protection to a page entry,
318 * and a page entry and page directory to the page they refer to.
319 */
320#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
321
322#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
323static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
324{
325 pte.pte_low &= _PAGE_CHG_MASK;
326 pte.pte_high &= ~0x3f;
327 pte.pte_low |= pgprot_val(newprot);
328 pte.pte_high |= pgprot_val(newprot) & 0x3f;
329 return pte;
330}
331#else
332static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
333{
334 return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
335}
336#endif
337
338
339extern void __update_tlb(struct vm_area_struct *vma, unsigned long address,
340 pte_t pte);
341extern void __update_cache(struct vm_area_struct *vma, unsigned long address,
342 pte_t pte);
343
344static inline void update_mmu_cache(struct vm_area_struct *vma,
345 unsigned long address, pte_t pte)
346{
347 __update_tlb(vma, address, pte);
348 __update_cache(vma, address, pte);
349}
350
351#define kern_addr_valid(addr) (1)
352
353#ifdef CONFIG_64BIT_PHYS_ADDR
354extern int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot);
355
356static inline int io_remap_pfn_range(struct vm_area_struct *vma,
357 unsigned long vaddr,
358 unsigned long pfn,
359 unsigned long size,
360 pgprot_t prot)
361{
362 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
363 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
364}
365#else
366#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
367 remap_pfn_range(vma, vaddr, pfn, size, prot)
368#endif
369
370#include <asm-generic/pgtable.h>
371
372/*
373 * We provide our own get_unmapped area to cope with the virtual aliasing
374 * constraints placed on us by the cache architecture.
375 */
376#define HAVE_ARCH_UNMAPPED_AREA
377
378/*
379 * No page table caches to initialise
380 */
381#define pgtable_cache_init() do { } while (0)
382
383#endif /* _ASM_PGTABLE_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_cic_int.h b/include/asm-mips/pmc-sierra/msp71xx/msp_cic_int.h
deleted file mode 100644
index c84bcf9570b1..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_cic_int.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * Defines for the MSP interrupt controller.
3 *
4 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
5 * Author: Carsten Langgaard, carstenl@mips.com
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 */
24
25#ifndef _MSP_CIC_INT_H
26#define _MSP_CIC_INT_H
27
28/*
29 * The PMC-Sierra CIC interrupts are all centrally managed by the
30 * CIC sub-system.
31 * We attempt to keep the interrupt numbers as consistent as possible
32 * across all of the MSP devices, but some differences will creep in ...
33 * The interrupts which are directly forwarded to the MIPS core interrupts
34 * are assigned interrupts in the range 0-7, interrupts cascaded through
35 * the CIC are assigned interrupts 8-39. The cascade occurs on C_IRQ4
36 * (MSP_INT_CIC). Currently we don't really distinguish between VPE1
37 * and VPE0 (or thread contexts for that matter). Will have to fix.
38 * The PER interrupts are assigned interrupts in the range 40-71.
39*/
40
41
42/*
43 * IRQs directly forwarded to the CPU
44 */
45#define MSP_MIPS_INTBASE 0
46#define MSP_INT_SW0 0 /* IRQ for swint0, C_SW0 */
47#define MSP_INT_SW1 1 /* IRQ for swint1, C_SW1 */
48#define MSP_INT_MAC0 2 /* IRQ for MAC 0, C_IRQ0 */
49#define MSP_INT_MAC1 3 /* IRQ for MAC 1, C_IRQ1 */
50#define MSP_INT_USB 4 /* IRQ for USB, C_IRQ2 */
51#define MSP_INT_SAR 5 /* IRQ for ADSL2+ SAR, C_IRQ3 */
52#define MSP_INT_CIC 6 /* IRQ for CIC block, C_IRQ4 */
53#define MSP_INT_SEC 7 /* IRQ for Sec engine, C_IRQ5 */
54
55/*
56 * IRQs cascaded on CPU interrupt 4 (CAUSE bit 12, C_IRQ4)
57 * These defines should be tied to the register definitions for the CIC
58 * interrupt routine. For now, just use hard-coded values.
59 */
60#define MSP_CIC_INTBASE (MSP_MIPS_INTBASE + 8)
61#define MSP_INT_EXT0 (MSP_CIC_INTBASE + 0)
62 /* External interrupt 0 */
63#define MSP_INT_EXT1 (MSP_CIC_INTBASE + 1)
64 /* External interrupt 1 */
65#define MSP_INT_EXT2 (MSP_CIC_INTBASE + 2)
66 /* External interrupt 2 */
67#define MSP_INT_EXT3 (MSP_CIC_INTBASE + 3)
68 /* External interrupt 3 */
69#define MSP_INT_CPUIF (MSP_CIC_INTBASE + 4)
70 /* CPU interface interrupt */
71#define MSP_INT_EXT4 (MSP_CIC_INTBASE + 5)
72 /* External interrupt 4 */
73#define MSP_INT_CIC_USB (MSP_CIC_INTBASE + 6)
74 /* Cascaded IRQ for USB */
75#define MSP_INT_MBOX (MSP_CIC_INTBASE + 7)
76 /* Sec engine mailbox IRQ */
77#define MSP_INT_EXT5 (MSP_CIC_INTBASE + 8)
78 /* External interrupt 5 */
79#define MSP_INT_TDM (MSP_CIC_INTBASE + 9)
80 /* TDM interrupt */
81#define MSP_INT_CIC_MAC0 (MSP_CIC_INTBASE + 10)
82 /* Cascaded IRQ for MAC 0 */
83#define MSP_INT_CIC_MAC1 (MSP_CIC_INTBASE + 11)
84 /* Cascaded IRQ for MAC 1 */
85#define MSP_INT_CIC_SEC (MSP_CIC_INTBASE + 12)
86 /* Cascaded IRQ for sec engine */
87#define MSP_INT_PER (MSP_CIC_INTBASE + 13)
88 /* Peripheral interrupt */
89#define MSP_INT_TIMER0 (MSP_CIC_INTBASE + 14)
90 /* SLP timer 0 */
91#define MSP_INT_TIMER1 (MSP_CIC_INTBASE + 15)
92 /* SLP timer 1 */
93#define MSP_INT_TIMER2 (MSP_CIC_INTBASE + 16)
94 /* SLP timer 2 */
95#define MSP_INT_VPE0_TIMER (MSP_CIC_INTBASE + 17)
96 /* VPE0 MIPS timer */
97#define MSP_INT_BLKCP (MSP_CIC_INTBASE + 18)
98 /* Block Copy */
99#define MSP_INT_UART0 (MSP_CIC_INTBASE + 19)
100 /* UART 0 */
101#define MSP_INT_PCI (MSP_CIC_INTBASE + 20)
102 /* PCI subsystem */
103#define MSP_INT_EXT6 (MSP_CIC_INTBASE + 21)
104 /* External interrupt 5 */
105#define MSP_INT_PCI_MSI (MSP_CIC_INTBASE + 22)
106 /* PCI Message Signal */
107#define MSP_INT_CIC_SAR (MSP_CIC_INTBASE + 23)
108 /* Cascaded ADSL2+ SAR IRQ */
109#define MSP_INT_DSL (MSP_CIC_INTBASE + 24)
110 /* ADSL2+ IRQ */
111#define MSP_INT_CIC_ERR (MSP_CIC_INTBASE + 25)
112 /* SLP error condition */
113#define MSP_INT_VPE1_TIMER (MSP_CIC_INTBASE + 26)
114 /* VPE1 MIPS timer */
115#define MSP_INT_VPE0_PC (MSP_CIC_INTBASE + 27)
116 /* VPE0 Performance counter */
117#define MSP_INT_VPE1_PC (MSP_CIC_INTBASE + 28)
118 /* VPE1 Performance counter */
119#define MSP_INT_EXT7 (MSP_CIC_INTBASE + 29)
120 /* External interrupt 5 */
121#define MSP_INT_VPE0_SW (MSP_CIC_INTBASE + 30)
122 /* VPE0 Software interrupt */
123#define MSP_INT_VPE1_SW (MSP_CIC_INTBASE + 31)
124 /* VPE0 Software interrupt */
125
126/*
127 * IRQs cascaded on CIC PER interrupt (MSP_INT_PER)
128 */
129#define MSP_PER_INTBASE (MSP_CIC_INTBASE + 32)
130/* Reserved 0-1 */
131#define MSP_INT_UART1 (MSP_PER_INTBASE + 2)
132 /* UART 1 */
133/* Reserved 3-5 */
134#define MSP_INT_2WIRE (MSP_PER_INTBASE + 6)
135 /* 2-wire */
136#define MSP_INT_TM0 (MSP_PER_INTBASE + 7)
137 /* Peripheral timer block out 0 */
138#define MSP_INT_TM1 (MSP_PER_INTBASE + 8)
139 /* Peripheral timer block out 1 */
140/* Reserved 9 */
141#define MSP_INT_SPRX (MSP_PER_INTBASE + 10)
142 /* SPI RX complete */
143#define MSP_INT_SPTX (MSP_PER_INTBASE + 11)
144 /* SPI TX complete */
145#define MSP_INT_GPIO (MSP_PER_INTBASE + 12)
146 /* GPIO */
147#define MSP_INT_PER_ERR (MSP_PER_INTBASE + 13)
148 /* Peripheral error */
149/* Reserved 14-31 */
150
151#endif /* !_MSP_CIC_INT_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_int.h b/include/asm-mips/pmc-sierra/msp71xx/msp_int.h
deleted file mode 100644
index 1d9f05474820..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_int.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * Defines for the MSP interrupt handlers.
3 *
4 * Copyright (C) 2005, PMC-Sierra, Inc. All rights reserved.
5 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 */
24
25#ifndef _MSP_INT_H
26#define _MSP_INT_H
27
28/*
29 * The PMC-Sierra MSP product line has at least two different interrupt
30 * controllers, the SLP register based scheme and the CIC interrupt
31 * controller block mechanism. This file distinguishes between them
32 * so that devices see a uniform interface.
33 */
34
35#if defined(CONFIG_IRQ_MSP_SLP)
36 #include "msp_slp_int.h"
37#elif defined(CONFIG_IRQ_MSP_CIC)
38 #include "msp_cic_int.h"
39#else
40 #error "What sort of interrupt controller does *your* MSP have?"
41#endif
42
43#endif /* !_MSP_INT_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_pci.h b/include/asm-mips/pmc-sierra/msp71xx/msp_pci.h
deleted file mode 100644
index 415606903617..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_pci.h
+++ /dev/null
@@ -1,205 +0,0 @@
1/*
2 * Copyright (c) 2000-2006 PMC-Sierra INC.
3 *
4 * This program is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General
6 * Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This program is distributed in the hope that it will be
11 * useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
19 * 02139, USA.
20 *
21 * PMC-SIERRA INC. DISCLAIMS ANY LIABILITY OF ANY KIND
22 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
23 * SOFTWARE.
24 */
25
26#ifndef _MSP_PCI_H_
27#define _MSP_PCI_H_
28
29#define MSP_HAS_PCI(ID) (((u32)(ID) <= 0x4236) && ((u32)(ID) >= 0x4220))
30
31/*
32 * It is convenient to program the OATRAN register so that
33 * Athena virtual address space and PCI address space are
34 * the same. This is not a requirement, just a convenience.
35 *
36 * The only hard restrictions on the value of OATRAN is that
37 * OATRAN must not be programmed to allow translated memory
38 * addresses to fall within the lowest 512MB of
39 * PCI address space. This region is hardcoded
40 * for use as Athena PCI Host Controller target
41 * access memory space to the Athena's SDRAM.
42 *
43 * Note that OATRAN applies only to memory accesses, not
44 * to I/O accesses.
45 *
46 * To program OATRAN to make Athena virtual address space
47 * and PCI address space have the same values, OATRAN
48 * is to be programmed to 0xB8000000. The top seven
49 * bits of the value mimic the seven bits clipped off
50 * by the PCI Host controller.
51 *
52 * With OATRAN at the said value, when the CPU does
53 * an access to its virtual address at, say 0xB900_5000,
54 * the address appearing on the PCI bus will be
55 * 0xB900_5000.
56 * - Michael Penner
57 */
58#define MSP_PCI_OATRAN 0xB8000000UL
59
60#define MSP_PCI_SPACE_BASE (MSP_PCI_OATRAN + 0x1002000UL)
61#define MSP_PCI_SPACE_SIZE (0x3000000UL - 0x2000)
62#define MSP_PCI_SPACE_END \
63 (MSP_PCI_SPACE_BASE + MSP_PCI_SPACE_SIZE - 1)
64#define MSP_PCI_IOSPACE_BASE (MSP_PCI_OATRAN + 0x1001000UL)
65#define MSP_PCI_IOSPACE_SIZE 0x1000
66#define MSP_PCI_IOSPACE_END \
67 (MSP_PCI_IOSPACE_BASE + MSP_PCI_IOSPACE_SIZE - 1)
68
69/* IRQ for PCI status interrupts */
70#define PCI_STAT_IRQ 20
71
72#define QFLUSH_REG_1 0xB7F40000
73
74typedef volatile unsigned int pcireg;
75typedef void * volatile ppcireg;
76
77struct pci_block_copy
78{
79 pcireg unused1; /* +0x00 */
80 pcireg unused2; /* +0x04 */
81 ppcireg unused3; /* +0x08 */
82 ppcireg unused4; /* +0x0C */
83 pcireg unused5; /* +0x10 */
84 pcireg unused6; /* +0x14 */
85 pcireg unused7; /* +0x18 */
86 ppcireg unused8; /* +0x1C */
87 ppcireg unused9; /* +0x20 */
88 pcireg unusedA; /* +0x24 */
89 ppcireg unusedB; /* +0x28 */
90 ppcireg unusedC; /* +0x2C */
91};
92
93enum
94{
95 config_device_vendor, /* 0 */
96 config_status_command, /* 1 */
97 config_class_revision, /* 2 */
98 config_BIST_header_latency_cache, /* 3 */
99 config_BAR0, /* 4 */
100 config_BAR1, /* 5 */
101 config_BAR2, /* 6 */
102 config_not_used7, /* 7 */
103 config_not_used8, /* 8 */
104 config_not_used9, /* 9 */
105 config_CIS, /* 10 */
106 config_subsystem, /* 11 */
107 config_not_used12, /* 12 */
108 config_capabilities, /* 13 */
109 config_not_used14, /* 14 */
110 config_lat_grant_irq, /* 15 */
111 config_message_control,/* 16 */
112 config_message_addr, /* 17 */
113 config_message_data, /* 18 */
114 config_VPD_addr, /* 19 */
115 config_VPD_data, /* 20 */
116 config_maxregs /* 21 - number of registers */
117};
118
119struct msp_pci_regs
120{
121 pcireg hop_unused_00; /* +0x00 */
122 pcireg hop_unused_04; /* +0x04 */
123 pcireg hop_unused_08; /* +0x08 */
124 pcireg hop_unused_0C; /* +0x0C */
125 pcireg hop_unused_10; /* +0x10 */
126 pcireg hop_unused_14; /* +0x14 */
127 pcireg hop_unused_18; /* +0x18 */
128 pcireg hop_unused_1C; /* +0x1C */
129 pcireg hop_unused_20; /* +0x20 */
130 pcireg hop_unused_24; /* +0x24 */
131 pcireg hop_unused_28; /* +0x28 */
132 pcireg hop_unused_2C; /* +0x2C */
133 pcireg hop_unused_30; /* +0x30 */
134 pcireg hop_unused_34; /* +0x34 */
135 pcireg if_control; /* +0x38 */
136 pcireg oatran; /* +0x3C */
137 pcireg reset_ctl; /* +0x40 */
138 pcireg config_addr; /* +0x44 */
139 pcireg hop_unused_48; /* +0x48 */
140 pcireg msg_signaled_int_status; /* +0x4C */
141 pcireg msg_signaled_int_mask; /* +0x50 */
142 pcireg if_status; /* +0x54 */
143 pcireg if_mask; /* +0x58 */
144 pcireg hop_unused_5C; /* +0x5C */
145 pcireg hop_unused_60; /* +0x60 */
146 pcireg hop_unused_64; /* +0x64 */
147 pcireg hop_unused_68; /* +0x68 */
148 pcireg hop_unused_6C; /* +0x6C */
149 pcireg hop_unused_70; /* +0x70 */
150
151 struct pci_block_copy pci_bc[2] __attribute__((aligned(64)));
152
153 pcireg error_hdr1; /* +0xE0 */
154 pcireg error_hdr2; /* +0xE4 */
155
156 pcireg config[config_maxregs] __attribute__((aligned(256)));
157
158};
159
160#define BPCI_CFGADDR_BUSNUM_SHF 16
161#define BPCI_CFGADDR_FUNCTNUM_SHF 8
162#define BPCI_CFGADDR_REGNUM_SHF 2
163#define BPCI_CFGADDR_ENABLE (1<<31)
164
165#define BPCI_IFCONTROL_RTO (1<<20) /* Retry timeout */
166#define BPCI_IFCONTROL_HCE (1<<16) /* Host configuration enable */
167#define BPCI_IFCONTROL_CTO_SHF 12 /* Shift count for CTO bits */
168#define BPCI_IFCONTROL_SE (1<<5) /* Enable exceptions on errors */
169#define BPCI_IFCONTROL_BIST (1<<4) /* Use BIST in per. mode */
170#define BPCI_IFCONTROL_CAP (1<<3) /* Enable capabilities */
171#define BPCI_IFCONTROL_MMC_SHF 0 /* Shift count for MMC bits */
172
173#define BPCI_IFSTATUS_MGT (1<<8) /* Master Grant timeout */
174#define BPCI_IFSTATUS_MTT (1<<9) /* Master TRDY timeout */
175#define BPCI_IFSTATUS_MRT (1<<10) /* Master retry timeout */
176#define BPCI_IFSTATUS_BC0F (1<<13) /* Block copy 0 fault */
177#define BPCI_IFSTATUS_BC1F (1<<14) /* Block copy 1 fault */
178#define BPCI_IFSTATUS_PCIU (1<<15) /* PCI unable to respond */
179#define BPCI_IFSTATUS_BSIZ (1<<16) /* PCI access with illegal size */
180#define BPCI_IFSTATUS_BADD (1<<17) /* PCI access with illegal addr */
181#define BPCI_IFSTATUS_RTO (1<<18) /* Retry time out */
182#define BPCI_IFSTATUS_SER (1<<19) /* System error */
183#define BPCI_IFSTATUS_PER (1<<20) /* Parity error */
184#define BPCI_IFSTATUS_LCA (1<<21) /* Local CPU abort */
185#define BPCI_IFSTATUS_MEM (1<<22) /* Memory prot. violation */
186#define BPCI_IFSTATUS_ARB (1<<23) /* Arbiter timed out */
187#define BPCI_IFSTATUS_STA (1<<27) /* Signaled target abort */
188#define BPCI_IFSTATUS_TA (1<<28) /* Target abort */
189#define BPCI_IFSTATUS_MA (1<<29) /* Master abort */
190#define BPCI_IFSTATUS_PEI (1<<30) /* Parity error as initiator */
191#define BPCI_IFSTATUS_PET (1<<31) /* Parity error as target */
192
193#define BPCI_RESETCTL_PR (1<<0) /* True if reset asserted */
194#define BPCI_RESETCTL_RT (1<<4) /* Release time */
195#define BPCI_RESETCTL_CT (1<<8) /* Config time */
196#define BPCI_RESETCTL_PE (1<<12) /* PCI enabled */
197#define BPCI_RESETCTL_HM (1<<13) /* PCI host mode */
198#define BPCI_RESETCTL_RI (1<<14) /* PCI reset in */
199
200extern struct msp_pci_regs msp_pci_regs
201 __attribute__((section(".register")));
202extern unsigned long msp_pci_config_space
203 __attribute__((section(".register")));
204
205#endif /* !_MSP_PCI_H_ */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_prom.h b/include/asm-mips/pmc-sierra/msp71xx/msp_prom.h
deleted file mode 100644
index 14ca7dc382a8..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_prom.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/*
2 * MIPS boards bootprom interface for the Linux kernel.
3 *
4 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
5 * Author: Carsten Langgaard, carstenl@mips.com
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 */
24
25#ifndef _ASM_MSP_PROM_H
26#define _ASM_MSP_PROM_H
27
28#include <linux/types.h>
29
30#define DEVICEID "deviceid"
31#define FEATURES "features"
32#define PROM_ENV "prom_env"
33#define PROM_ENV_FILE "/proc/"PROM_ENV
34#define PROM_ENV_SIZE 256
35
36#define CPU_DEVID_FAMILY 0x0000ff00
37#define CPU_DEVID_REVISION 0x000000ff
38
39#define FPGA_IS_POLO(revision) \
40 (((revision >= 0xb0) && (revision < 0xd0)))
41#define FPGA_IS_5000(revision) \
42 ((revision >= 0x80) && (revision <= 0x90))
43#define FPGA_IS_ZEUS(revision) ((revision < 0x7f))
44#define FPGA_IS_DUET(revision) \
45 (((revision >= 0xa0) && (revision < 0xb0)))
46#define FPGA_IS_MSP4200(revision) ((revision >= 0xd0))
47#define FPGA_IS_MSP7100(revision) ((revision >= 0xd0))
48
49#define MACHINE_TYPE_POLO "POLO"
50#define MACHINE_TYPE_DUET "DUET"
51#define MACHINE_TYPE_ZEUS "ZEUS"
52#define MACHINE_TYPE_MSP2000REVB "MSP2000REVB"
53#define MACHINE_TYPE_MSP5000 "MSP5000"
54#define MACHINE_TYPE_MSP4200 "MSP4200"
55#define MACHINE_TYPE_MSP7120 "MSP7120"
56#define MACHINE_TYPE_MSP7130 "MSP7130"
57#define MACHINE_TYPE_OTHER "OTHER"
58
59#define MACHINE_TYPE_POLO_FPGA "POLO-FPGA"
60#define MACHINE_TYPE_DUET_FPGA "DUET-FPGA"
61#define MACHINE_TYPE_ZEUS_FPGA "ZEUS_FPGA"
62#define MACHINE_TYPE_MSP2000REVB_FPGA "MSP2000REVB-FPGA"
63#define MACHINE_TYPE_MSP5000_FPGA "MSP5000-FPGA"
64#define MACHINE_TYPE_MSP4200_FPGA "MSP4200-FPGA"
65#define MACHINE_TYPE_MSP7100_FPGA "MSP7100-FPGA"
66#define MACHINE_TYPE_OTHER_FPGA "OTHER-FPGA"
67
68/* Device Family definitions */
69#define FAMILY_FPGA 0x0000
70#define FAMILY_ZEUS 0x1000
71#define FAMILY_POLO 0x2000
72#define FAMILY_DUET 0x4000
73#define FAMILY_TRIAD 0x5000
74#define FAMILY_MSP4200 0x4200
75#define FAMILY_MSP4200_FPGA 0x4f00
76#define FAMILY_MSP7100 0x7100
77#define FAMILY_MSP7100_FPGA 0x7f00
78
79/* Device Type definitions */
80#define TYPE_MSP7120 0x7120
81#define TYPE_MSP7130 0x7130
82
83#define ENET_KEY 'E'
84#define ENETTXD_KEY 'e'
85#define PCI_KEY 'P'
86#define PCIMUX_KEY 'p'
87#define SEC_KEY 'S'
88#define SPAD_KEY 'D'
89#define TDM_KEY 'T'
90#define ZSP_KEY 'Z'
91
92#define FEATURE_NOEXIST '-'
93#define FEATURE_EXIST '+'
94
95#define ENET_MII 'M'
96#define ENET_RMII 'R'
97
98#define ENETTXD_FALLING 'F'
99#define ENETTXD_RISING 'R'
100
101#define PCI_HOST 'H'
102#define PCI_PERIPHERAL 'P'
103
104#define PCIMUX_FULL 'F'
105#define PCIMUX_SINGLE 'S'
106
107#define SEC_DUET 'D'
108#define SEC_POLO 'P'
109#define SEC_SLOW 'S'
110#define SEC_TRIAD 'T'
111
112#define SPAD_POLO 'P'
113
114#define TDM_DUET 'D' /* DUET TDMs might exist */
115#define TDM_POLO 'P' /* POLO TDMs might exist */
116#define TDM_TRIAD 'T' /* TRIAD TDMs might exist */
117
118#define ZSP_DUET 'D' /* one DUET zsp engine */
119#define ZSP_TRIAD 'T' /* two TRIAD zsp engines */
120
121extern char *prom_getcmdline(void);
122extern char *prom_getenv(char *name);
123extern void prom_init_cmdline(void);
124extern void prom_meminit(void);
125extern void prom_fixup_mem_map(unsigned long start_mem,
126 unsigned long end_mem);
127
128#ifdef CONFIG_MTD_PMC_MSP_RAMROOT
129extern bool get_ramroot(void **start, unsigned long *size);
130#endif
131
132extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr);
133extern unsigned long get_deviceid(void);
134extern char identify_enet(unsigned long interface_num);
135extern char identify_enetTxD(unsigned long interface_num);
136extern char identify_pci(void);
137extern char identify_sec(void);
138extern char identify_spad(void);
139extern char identify_sec(void);
140extern char identify_tdm(void);
141extern char identify_zsp(void);
142extern unsigned long identify_family(void);
143extern unsigned long identify_revision(void);
144
145/*
146 * The following macro calls prom_printf and puts the format string
147 * into an init section so it can be reclaimed.
148 */
149#define ppfinit(f, x...) \
150 do { \
151 static char _f[] __initdata = KERN_INFO f; \
152 printk(_f, ## x); \
153 } while (0)
154
155/* Memory descriptor management. */
156#define PROM_MAX_PMEMBLOCKS 7 /* 6 used */
157
158enum yamon_memtypes {
159 yamon_dontuse,
160 yamon_prom,
161 yamon_free,
162};
163
164struct prom_pmemblock {
165 unsigned long base; /* Within KSEG0. */
166 unsigned int size; /* In bytes. */
167 unsigned int type; /* free or prom memory */
168};
169
170extern int prom_argc;
171extern char **prom_argv;
172extern char **prom_envp;
173extern int *prom_vec;
174extern struct prom_pmemblock *prom_getmdesc(void);
175
176#endif /* !_ASM_MSP_PROM_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_regops.h b/include/asm-mips/pmc-sierra/msp71xx/msp_regops.h
deleted file mode 100644
index 60a5a38dd5b2..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_regops.h
+++ /dev/null
@@ -1,236 +0,0 @@
1/*
2 * SMP/VPE-safe functions to access "registers" (see note).
3 *
4 * NOTES:
5* - These macros use ll/sc instructions, so it is your responsibility to
6 * ensure these are available on your platform before including this file.
7 * - The MIPS32 spec states that ll/sc results are undefined for uncached
8 * accesses. This means they can't be used on HW registers accessed
9 * through kseg1. Code which requires these macros for this purpose must
10 * front-end the registers with cached memory "registers" and have a single
11 * thread update the actual HW registers.
12 * - A maximum of 2k of code can be inserted between ll and sc. Every
13 * memory accesses between the instructions will increase the chance of
14 * sc failing and having to loop.
15 * - When using custom_read_reg32/custom_write_reg32 only perform the
16 * necessary logical operations on the register value in between these
17 * two calls. All other logic should be performed before the first call.
18 * - There is a bug on the R10000 chips which has a workaround. If you
19 * are affected by this bug, make sure to define the symbol 'R10000_LLSC_WAR'
20 * to be non-zero. If you are using this header from within linux, you may
21 * include <asm/war.h> before including this file to have this defined
22 * appropriately for you.
23 *
24 * Copyright 2005-2007 PMC-Sierra, Inc.
25 *
26 * This program is free software; you can redistribute it and/or modify it
27 * under the terms of the GNU General Public License as published by the
28 * Free Software Foundation; either version 2 of the License, or (at your
29 * option) any later version.
30 *
31 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
32 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
40 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * You should have received a copy of the GNU General Public License along
43 * with this program; if not, write to the Free Software Foundation, Inc., 675
44 * Mass Ave, Cambridge, MA 02139, USA.
45 */
46
47#ifndef __ASM_REGOPS_H__
48#define __ASM_REGOPS_H__
49
50#include <linux/types.h>
51
52#include <asm/war.h>
53
54#ifndef R10000_LLSC_WAR
55#define R10000_LLSC_WAR 0
56#endif
57
58#if R10000_LLSC_WAR == 1
59#define __beqz "beqzl "
60#else
61#define __beqz "beqz "
62#endif
63
64#ifndef _LINUX_TYPES_H
65typedef unsigned int u32;
66#endif
67
68/*
69 * Sets all the masked bits to the corresponding value bits
70 */
71static inline void set_value_reg32(volatile u32 *const addr,
72 u32 const mask,
73 u32 const value)
74{
75 u32 temp;
76
77 __asm__ __volatile__(
78 " .set push \n"
79 " .set mips3 \n"
80 "1: ll %0, %1 # set_value_reg32 \n"
81 " and %0, %2 \n"
82 " or %0, %3 \n"
83 " sc %0, %1 \n"
84 " "__beqz"%0, 1b \n"
85 " nop \n"
86 " .set pop \n"
87 : "=&r" (temp), "=m" (*addr)
88 : "ir" (~mask), "ir" (value), "m" (*addr));
89}
90
91/*
92 * Sets all the masked bits to '1'
93 */
94static inline void set_reg32(volatile u32 *const addr,
95 u32 const mask)
96{
97 u32 temp;
98
99 __asm__ __volatile__(
100 " .set push \n"
101 " .set mips3 \n"
102 "1: ll %0, %1 # set_reg32 \n"
103 " or %0, %2 \n"
104 " sc %0, %1 \n"
105 " "__beqz"%0, 1b \n"
106 " nop \n"
107 " .set pop \n"
108 : "=&r" (temp), "=m" (*addr)
109 : "ir" (mask), "m" (*addr));
110}
111
112/*
113 * Sets all the masked bits to '0'
114 */
115static inline void clear_reg32(volatile u32 *const addr,
116 u32 const mask)
117{
118 u32 temp;
119
120 __asm__ __volatile__(
121 " .set push \n"
122 " .set mips3 \n"
123 "1: ll %0, %1 # clear_reg32 \n"
124 " and %0, %2 \n"
125 " sc %0, %1 \n"
126 " "__beqz"%0, 1b \n"
127 " nop \n"
128 " .set pop \n"
129 : "=&r" (temp), "=m" (*addr)
130 : "ir" (~mask), "m" (*addr));
131}
132
133/*
134 * Toggles all masked bits from '0' to '1' and '1' to '0'
135 */
136static inline void toggle_reg32(volatile u32 *const addr,
137 u32 const mask)
138{
139 u32 temp;
140
141 __asm__ __volatile__(
142 " .set push \n"
143 " .set mips3 \n"
144 "1: ll %0, %1 # toggle_reg32 \n"
145 " xor %0, %2 \n"
146 " sc %0, %1 \n"
147 " "__beqz"%0, 1b \n"
148 " nop \n"
149 " .set pop \n"
150 : "=&r" (temp), "=m" (*addr)
151 : "ir" (mask), "m" (*addr));
152}
153
154/*
155 * Read all masked bits others are returned as '0'
156 */
157static inline u32 read_reg32(volatile u32 *const addr,
158 u32 const mask)
159{
160 u32 temp;
161
162 __asm__ __volatile__(
163 " .set push \n"
164 " .set noreorder \n"
165 " lw %0, %1 # read \n"
166 " and %0, %2 # mask \n"
167 " .set pop \n"
168 : "=&r" (temp)
169 : "m" (*addr), "ir" (mask));
170
171 return temp;
172}
173
174/*
175 * blocking_read_reg32 - Read address with blocking load
176 *
177 * Uncached writes need to be read back to ensure they reach RAM.
178 * The returned value must be 'used' to prevent from becoming a
179 * non-blocking load.
180 */
181static inline u32 blocking_read_reg32(volatile u32 *const addr)
182{
183 u32 temp;
184
185 __asm__ __volatile__(
186 " .set push \n"
187 " .set noreorder \n"
188 " lw %0, %1 # read \n"
189 " move %0, %0 # block \n"
190 " .set pop \n"
191 : "=&r" (temp)
192 : "m" (*addr));
193
194 return temp;
195}
196
197/*
198 * For special strange cases only:
199 *
200 * If you need custom processing within a ll/sc loop, use the following macros
201 * VERY CAREFULLY:
202 *
203 * u32 tmp; <-- Define a variable to hold the data
204 *
205 * custom_read_reg32(address, tmp); <-- Reads the address and put the value
206 * in the 'tmp' variable given
207 *
208 * From here on out, you are (basicly) atomic, so don't do anything too
209 * fancy!
210 * Also, this code may loop if the end of this block fails to write
211 * everything back safely due do the other CPU, so do NOT do anything
212 * with side-effects!
213 *
214 * custom_write_reg32(address, tmp); <-- Writes back 'tmp' safely.
215 */
216#define custom_read_reg32(address, tmp) \
217 __asm__ __volatile__( \
218 " .set push \n" \
219 " .set mips3 \n" \
220 "1: ll %0, %1 #custom_read_reg32 \n" \
221 " .set pop \n" \
222 : "=r" (tmp), "=m" (*address) \
223 : "m" (*address))
224
225#define custom_write_reg32(address, tmp) \
226 __asm__ __volatile__( \
227 " .set push \n" \
228 " .set mips3 \n" \
229 " sc %0, %1 #custom_write_reg32 \n" \
230 " "__beqz"%0, 1b \n" \
231 " nop \n" \
232 " .set pop \n" \
233 : "=&r" (tmp), "=m" (*address) \
234 : "0" (tmp), "m" (*address))
235
236#endif /* __ASM_REGOPS_H__ */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h b/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h
deleted file mode 100644
index 603eb737b4a8..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_regs.h
+++ /dev/null
@@ -1,663 +0,0 @@
1/*
2 * Defines for the address space, registers and register configuration
3 * (bit masks, access macros etc) for the PMC-Sierra line of MSP products.
4 * This file contains addess maps for all the devices in the line of
5 * products but only has register definitions and configuration masks for
6 * registers which aren't definitely associated with any device. Things
7 * like clock settings, reset access, the ELB etc. Individual device
8 * drivers will reference the appropriate XXX_BASE value defined here
9 * and have individual registers offset from that.
10 *
11 * Copyright (C) 2005-2007 PMC-Sierra, Inc. All rights reserved.
12 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
13 *
14 * ########################################################################
15 *
16 * This program is free software; you can distribute it and/or modify it
17 * under the terms of the GNU General Public License (Version 2) as
18 * published by the Free Software Foundation.
19 *
20 * This program is distributed in the hope it will be useful, but WITHOUT
21 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * for more details.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
28 *
29 * ########################################################################
30 */
31
32#include <asm/addrspace.h>
33#include <linux/types.h>
34
35#ifndef _ASM_MSP_REGS_H
36#define _ASM_MSP_REGS_H
37
38/*
39 ########################################################################
40 # Address space and device base definitions #
41 ########################################################################
42 */
43
44/*
45 ***************************************************************************
46 * System Logic and Peripherals (ELB, UART0, etc) device address space *
47 ***************************************************************************
48 */
49#define MSP_SLP_BASE 0x1c000000
50 /* System Logic and Peripherals */
51#define MSP_RST_BASE (MSP_SLP_BASE + 0x10)
52 /* System reset register base */
53#define MSP_RST_SIZE 0x0C /* System reset register space */
54
55#define MSP_WTIMER_BASE (MSP_SLP_BASE + 0x04C)
56 /* watchdog timer base */
57#define MSP_ITIMER_BASE (MSP_SLP_BASE + 0x054)
58 /* internal timer base */
59#define MSP_UART0_BASE (MSP_SLP_BASE + 0x100)
60 /* UART0 controller base */
61#define MSP_BCPY_CTRL_BASE (MSP_SLP_BASE + 0x120)
62 /* Block Copy controller base */
63#define MSP_BCPY_DESC_BASE (MSP_SLP_BASE + 0x160)
64 /* Block Copy descriptor base */
65
66/*
67 ***************************************************************************
68 * PCI address space *
69 ***************************************************************************
70 */
71#define MSP_PCI_BASE 0x19000000
72
73/*
74 ***************************************************************************
75 * MSbus device address space *
76 ***************************************************************************
77 */
78#define MSP_MSB_BASE 0x18000000
79 /* MSbus address start */
80#define MSP_PER_BASE (MSP_MSB_BASE + 0x400000)
81 /* Peripheral device registers */
82#define MSP_MAC0_BASE (MSP_MSB_BASE + 0x600000)
83 /* MAC A device registers */
84#define MSP_MAC1_BASE (MSP_MSB_BASE + 0x700000)
85 /* MAC B device registers */
86#define MSP_MAC_SIZE 0xE0 /* MAC register space */
87
88#define MSP_SEC_BASE (MSP_MSB_BASE + 0x800000)
89 /* Security Engine registers */
90#define MSP_MAC2_BASE (MSP_MSB_BASE + 0x900000)
91 /* MAC C device registers */
92#define MSP_ADSL2_BASE (MSP_MSB_BASE + 0xA80000)
93 /* ADSL2 device registers */
94#define MSP_USB_BASE (MSP_MSB_BASE + 0xB40000)
95 /* USB device registers */
96#define MSP_USB_BASE_START (MSP_MSB_BASE + 0xB40100)
97 /* USB device registers */
98#define MSP_USB_BASE_END (MSP_MSB_BASE + 0xB401FF)
99 /* USB device registers */
100#define MSP_CPUIF_BASE (MSP_MSB_BASE + 0xC00000)
101 /* CPU interface registers */
102
103/* Devices within the MSbus peripheral block */
104#define MSP_UART1_BASE (MSP_PER_BASE + 0x030)
105 /* UART1 controller base */
106#define MSP_SPI_BASE (MSP_PER_BASE + 0x058)
107 /* SPI/MPI control registers */
108#define MSP_TWI_BASE (MSP_PER_BASE + 0x090)
109 /* Two-wire control registers */
110#define MSP_PTIMER_BASE (MSP_PER_BASE + 0x0F0)
111 /* Programmable timer control */
112
113/*
114 ***************************************************************************
115 * Physical Memory configuration address space *
116 ***************************************************************************
117 */
118#define MSP_MEM_CFG_BASE 0x17f00000
119
120#define MSP_MEM_INDIRECT_CTL_10 0x10
121
122/*
123 * Notes:
124 * 1) The SPI registers are split into two blocks, one offset from the
125 * MSP_SPI_BASE by 0x00 and the other offset from the MSP_SPI_BASE by
126 * 0x68. The SPI driver definitions for the register must be aware
127 * of this.
128 * 2) The block copy engine register are divided into two regions, one
129 * for the control/configuration of the engine proper and one for the
130 * values of the descriptors used in the copy process. These have
131 * different base defines (CTRL_BASE vs DESC_BASE)
132 * 3) These constants are for physical addresses which means that they
133 * work correctly with "ioremap" and friends. This means that device
134 * drivers will need to remap these addresses using ioremap and perhaps
135 * the readw/writew macros. Or they could use the regptr() macro
136 * defined below, but the readw/writew calls are the correct thing.
137 * 4) The UARTs have an additional status register offset from the base
138 * address. This register isn't used in the standard 8250 driver but
139 * may be used in other software. Consult the hardware datasheet for
140 * offset details.
141 * 5) For some unknown reason the security engine (MSP_SEC_BASE) registers
142 * start at an offset of 0x84 from the base address but the block of
143 * registers before this is reserved for the security engine. The
144 * driver will have to be aware of this but it makes the register
145 * definitions line up better with the documentation.
146 */
147
148/*
149 ########################################################################
150 # System register definitions. Not associated with a specific device #
151 ########################################################################
152 */
153
154/*
155 * This macro maps the physical register number into uncached space
156 * and (for C code) casts it into a u32 pointer so it can be dereferenced
157 * Normally these would be accessed with ioremap and readX/writeX, but
158 * these are convenient for a lot of internal kernel code.
159 */
160#ifdef __ASSEMBLER__
161 #define regptr(addr) (KSEG1ADDR(addr))
162#else
163 #define regptr(addr) ((volatile u32 *const)(KSEG1ADDR(addr)))
164#endif
165
166/*
167 ***************************************************************************
168 * System Logic and Peripherals (RESET, ELB, etc) registers *
169 ***************************************************************************
170 */
171
172/* System Control register definitions */
173#define DEV_ID_REG regptr(MSP_SLP_BASE + 0x00)
174 /* Device-ID RO */
175#define FWR_ID_REG regptr(MSP_SLP_BASE + 0x04)
176 /* Firmware-ID Register RW */
177#define SYS_ID_REG0 regptr(MSP_SLP_BASE + 0x08)
178 /* System-ID Register-0 RW */
179#define SYS_ID_REG1 regptr(MSP_SLP_BASE + 0x0C)
180 /* System-ID Register-1 RW */
181
182/* System Reset register definitions */
183#define RST_STS_REG regptr(MSP_SLP_BASE + 0x10)
184 /* System Reset Status RO */
185#define RST_SET_REG regptr(MSP_SLP_BASE + 0x14)
186 /* System Set Reset WO */
187#define RST_CLR_REG regptr(MSP_SLP_BASE + 0x18)
188 /* System Clear Reset WO */
189
190/* System Clock Registers */
191#define PCI_SLP_REG regptr(MSP_SLP_BASE + 0x1C)
192 /* PCI clock generator RW */
193#define URT_SLP_REG regptr(MSP_SLP_BASE + 0x20)
194 /* UART clock generator RW */
195/* reserved (MSP_SLP_BASE + 0x24) */
196/* reserved (MSP_SLP_BASE + 0x28) */
197#define PLL1_SLP_REG regptr(MSP_SLP_BASE + 0x2C)
198 /* PLL1 clock generator RW */
199#define PLL0_SLP_REG regptr(MSP_SLP_BASE + 0x30)
200 /* PLL0 clock generator RW */
201#define MIPS_SLP_REG regptr(MSP_SLP_BASE + 0x34)
202 /* MIPS clock generator RW */
203#define VE_SLP_REG regptr(MSP_SLP_BASE + 0x38)
204 /* Voice Eng clock generator RW */
205/* reserved (MSP_SLP_BASE + 0x3C) */
206#define MSB_SLP_REG regptr(MSP_SLP_BASE + 0x40)
207 /* MS-Bus clock generator RW */
208#define SMAC_SLP_REG regptr(MSP_SLP_BASE + 0x44)
209 /* Sec & MAC clock generator RW */
210#define PERF_SLP_REG regptr(MSP_SLP_BASE + 0x48)
211 /* Per & TDM clock generator RW */
212
213/* Interrupt Controller Registers */
214#define SLP_INT_STS_REG regptr(MSP_SLP_BASE + 0x70)
215 /* Interrupt status register RW */
216#define SLP_INT_MSK_REG regptr(MSP_SLP_BASE + 0x74)
217 /* Interrupt enable/mask RW */
218#define SE_MBOX_REG regptr(MSP_SLP_BASE + 0x78)
219 /* Security Engine mailbox RW */
220#define VE_MBOX_REG regptr(MSP_SLP_BASE + 0x7C)
221 /* Voice Engine mailbox RW */
222
223/* ELB Controller Registers */
224#define CS0_CNFG_REG regptr(MSP_SLP_BASE + 0x80)
225 /* ELB CS0 Configuration Reg */
226#define CS0_ADDR_REG regptr(MSP_SLP_BASE + 0x84)
227 /* ELB CS0 Base Address Reg */
228#define CS0_MASK_REG regptr(MSP_SLP_BASE + 0x88)
229 /* ELB CS0 Mask Register */
230#define CS0_ACCESS_REG regptr(MSP_SLP_BASE + 0x8C)
231 /* ELB CS0 access register */
232
233#define CS1_CNFG_REG regptr(MSP_SLP_BASE + 0x90)
234 /* ELB CS1 Configuration Reg */
235#define CS1_ADDR_REG regptr(MSP_SLP_BASE + 0x94)
236 /* ELB CS1 Base Address Reg */
237#define CS1_MASK_REG regptr(MSP_SLP_BASE + 0x98)
238 /* ELB CS1 Mask Register */
239#define CS1_ACCESS_REG regptr(MSP_SLP_BASE + 0x9C)
240 /* ELB CS1 access register */
241
242#define CS2_CNFG_REG regptr(MSP_SLP_BASE + 0xA0)
243 /* ELB CS2 Configuration Reg */
244#define CS2_ADDR_REG regptr(MSP_SLP_BASE + 0xA4)
245 /* ELB CS2 Base Address Reg */
246#define CS2_MASK_REG regptr(MSP_SLP_BASE + 0xA8)
247 /* ELB CS2 Mask Register */
248#define CS2_ACCESS_REG regptr(MSP_SLP_BASE + 0xAC)
249 /* ELB CS2 access register */
250
251#define CS3_CNFG_REG regptr(MSP_SLP_BASE + 0xB0)
252 /* ELB CS3 Configuration Reg */
253#define CS3_ADDR_REG regptr(MSP_SLP_BASE + 0xB4)
254 /* ELB CS3 Base Address Reg */
255#define CS3_MASK_REG regptr(MSP_SLP_BASE + 0xB8)
256 /* ELB CS3 Mask Register */
257#define CS3_ACCESS_REG regptr(MSP_SLP_BASE + 0xBC)
258 /* ELB CS3 access register */
259
260#define CS4_CNFG_REG regptr(MSP_SLP_BASE + 0xC0)
261 /* ELB CS4 Configuration Reg */
262#define CS4_ADDR_REG regptr(MSP_SLP_BASE + 0xC4)
263 /* ELB CS4 Base Address Reg */
264#define CS4_MASK_REG regptr(MSP_SLP_BASE + 0xC8)
265 /* ELB CS4 Mask Register */
266#define CS4_ACCESS_REG regptr(MSP_SLP_BASE + 0xCC)
267 /* ELB CS4 access register */
268
269#define CS5_CNFG_REG regptr(MSP_SLP_BASE + 0xD0)
270 /* ELB CS5 Configuration Reg */
271#define CS5_ADDR_REG regptr(MSP_SLP_BASE + 0xD4)
272 /* ELB CS5 Base Address Reg */
273#define CS5_MASK_REG regptr(MSP_SLP_BASE + 0xD8)
274 /* ELB CS5 Mask Register */
275#define CS5_ACCESS_REG regptr(MSP_SLP_BASE + 0xDC)
276 /* ELB CS5 access register */
277
278/* reserved 0xE0 - 0xE8 */
279#define ELB_1PC_EN_REG regptr(MSP_SLP_BASE + 0xEC)
280 /* ELB single PC card detect */
281
282/* reserved 0xF0 - 0xF8 */
283#define ELB_CLK_CFG_REG regptr(MSP_SLP_BASE + 0xFC)
284 /* SDRAM read/ELB timing Reg */
285
286/* Extended UART status registers */
287#define UART0_STATUS_REG regptr(MSP_UART0_BASE + 0x0c0)
288 /* UART Status Register 0 */
289#define UART1_STATUS_REG regptr(MSP_UART1_BASE + 0x170)
290 /* UART Status Register 1 */
291
292/* Performance monitoring registers */
293#define PERF_MON_CTRL_REG regptr(MSP_SLP_BASE + 0x140)
294 /* Performance monitor control */
295#define PERF_MON_CLR_REG regptr(MSP_SLP_BASE + 0x144)
296 /* Performance monitor clear */
297#define PERF_MON_CNTH_REG regptr(MSP_SLP_BASE + 0x148)
298 /* Perf monitor counter high */
299#define PERF_MON_CNTL_REG regptr(MSP_SLP_BASE + 0x14C)
300 /* Perf monitor counter low */
301
302/* System control registers */
303#define SYS_CTRL_REG regptr(MSP_SLP_BASE + 0x150)
304 /* System control register */
305#define SYS_ERR1_REG regptr(MSP_SLP_BASE + 0x154)
306 /* System Error status 1 */
307#define SYS_ERR2_REG regptr(MSP_SLP_BASE + 0x158)
308 /* System Error status 2 */
309#define SYS_INT_CFG_REG regptr(MSP_SLP_BASE + 0x15C)
310 /* System Interrupt config */
311
312/* Voice Engine Memory configuration */
313#define VE_MEM_REG regptr(MSP_SLP_BASE + 0x17C)
314 /* Voice engine memory config */
315
316/* CPU/SLP Error Status registers */
317#define CPU_ERR1_REG regptr(MSP_SLP_BASE + 0x180)
318 /* CPU/SLP Error status 1 */
319#define CPU_ERR2_REG regptr(MSP_SLP_BASE + 0x184)
320 /* CPU/SLP Error status 1 */
321
322#define EXTENDED_GPIO_REG regptr(MSP_SLP_BASE + 0x188)
323 /* Extended GPIO register */
324
325/* System Error registers */
326#define SLP_ERR_STS_REG regptr(MSP_SLP_BASE + 0x190)
327 /* Int status for SLP errors */
328#define SLP_ERR_MSK_REG regptr(MSP_SLP_BASE + 0x194)
329 /* Int mask for SLP errors */
330#define SLP_ELB_ERST_REG regptr(MSP_SLP_BASE + 0x198)
331 /* External ELB reset */
332#define SLP_BOOT_STS_REG regptr(MSP_SLP_BASE + 0x19C)
333 /* Boot Status */
334
335/* Extended ELB addressing */
336#define CS0_EXT_ADDR_REG regptr(MSP_SLP_BASE + 0x1A0)
337 /* CS0 Extended address */
338#define CS1_EXT_ADDR_REG regptr(MSP_SLP_BASE + 0x1A4)
339 /* CS1 Extended address */
340#define CS2_EXT_ADDR_REG regptr(MSP_SLP_BASE + 0x1A8)
341 /* CS2 Extended address */
342#define CS3_EXT_ADDR_REG regptr(MSP_SLP_BASE + 0x1AC)
343 /* CS3 Extended address */
344/* reserved 0x1B0 */
345#define CS5_EXT_ADDR_REG regptr(MSP_SLP_BASE + 0x1B4)
346 /* CS5 Extended address */
347
348/* PLL Adjustment registers */
349#define PLL_LOCK_REG regptr(MSP_SLP_BASE + 0x200)
350 /* PLL0 lock status */
351#define PLL_ARST_REG regptr(MSP_SLP_BASE + 0x204)
352 /* PLL Analog reset status */
353#define PLL0_ADJ_REG regptr(MSP_SLP_BASE + 0x208)
354 /* PLL0 Adjustment value */
355#define PLL1_ADJ_REG regptr(MSP_SLP_BASE + 0x20C)
356 /* PLL1 Adjustment value */
357
358/*
359 ***************************************************************************
360 * Peripheral Register definitions *
361 ***************************************************************************
362 */
363
364/* Peripheral status */
365#define PER_CTRL_REG regptr(MSP_PER_BASE + 0x50)
366 /* Peripheral control register */
367#define PER_STS_REG regptr(MSP_PER_BASE + 0x54)
368 /* Peripheral status register */
369
370/* SPI/MPI Registers */
371#define SMPI_TX_SZ_REG regptr(MSP_PER_BASE + 0x58)
372 /* SPI/MPI Tx Size register */
373#define SMPI_RX_SZ_REG regptr(MSP_PER_BASE + 0x5C)
374 /* SPI/MPI Rx Size register */
375#define SMPI_CTL_REG regptr(MSP_PER_BASE + 0x60)
376 /* SPI/MPI Control register */
377#define SMPI_MS_REG regptr(MSP_PER_BASE + 0x64)
378 /* SPI/MPI Chip Select reg */
379#define SMPI_CORE_DATA_REG regptr(MSP_PER_BASE + 0xC0)
380 /* SPI/MPI Core Data reg */
381#define SMPI_CORE_CTRL_REG regptr(MSP_PER_BASE + 0xC4)
382 /* SPI/MPI Core Control reg */
383#define SMPI_CORE_STAT_REG regptr(MSP_PER_BASE + 0xC8)
384 /* SPI/MPI Core Status reg */
385#define SMPI_CORE_SSEL_REG regptr(MSP_PER_BASE + 0xCC)
386 /* SPI/MPI Core Ssel reg */
387#define SMPI_FIFO_REG regptr(MSP_PER_BASE + 0xD0)
388 /* SPI/MPI Data FIFO reg */
389
390/* Peripheral Block Error Registers */
391#define PER_ERR_STS_REG regptr(MSP_PER_BASE + 0x70)
392 /* Error Bit Status Register */
393#define PER_ERR_MSK_REG regptr(MSP_PER_BASE + 0x74)
394 /* Error Bit Mask Register */
395#define PER_HDR1_REG regptr(MSP_PER_BASE + 0x78)
396 /* Error Header 1 Register */
397#define PER_HDR2_REG regptr(MSP_PER_BASE + 0x7C)
398 /* Error Header 2 Register */
399
400/* Peripheral Block Interrupt Registers */
401#define PER_INT_STS_REG regptr(MSP_PER_BASE + 0x80)
402 /* Interrupt status register */
403#define PER_INT_MSK_REG regptr(MSP_PER_BASE + 0x84)
404 /* Interrupt Mask Register */
405#define GPIO_INT_STS_REG regptr(MSP_PER_BASE + 0x88)
406 /* GPIO interrupt status reg */
407#define GPIO_INT_MSK_REG regptr(MSP_PER_BASE + 0x8C)
408 /* GPIO interrupt MASK Reg */
409
410/* POLO GPIO registers */
411#define POLO_GPIO_DAT1_REG regptr(MSP_PER_BASE + 0x0E0)
412 /* Polo GPIO[8:0] data reg */
413#define POLO_GPIO_CFG1_REG regptr(MSP_PER_BASE + 0x0E4)
414 /* Polo GPIO[7:0] config reg */
415#define POLO_GPIO_CFG2_REG regptr(MSP_PER_BASE + 0x0E8)
416 /* Polo GPIO[15:8] config reg */
417#define POLO_GPIO_OD1_REG regptr(MSP_PER_BASE + 0x0EC)
418 /* Polo GPIO[31:0] output drive */
419#define POLO_GPIO_CFG3_REG regptr(MSP_PER_BASE + 0x170)
420 /* Polo GPIO[23:16] config reg */
421#define POLO_GPIO_DAT2_REG regptr(MSP_PER_BASE + 0x174)
422 /* Polo GPIO[15:9] data reg */
423#define POLO_GPIO_DAT3_REG regptr(MSP_PER_BASE + 0x178)
424 /* Polo GPIO[23:16] data reg */
425#define POLO_GPIO_DAT4_REG regptr(MSP_PER_BASE + 0x17C)
426 /* Polo GPIO[31:24] data reg */
427#define POLO_GPIO_DAT5_REG regptr(MSP_PER_BASE + 0x180)
428 /* Polo GPIO[39:32] data reg */
429#define POLO_GPIO_DAT6_REG regptr(MSP_PER_BASE + 0x184)
430 /* Polo GPIO[47:40] data reg */
431#define POLO_GPIO_DAT7_REG regptr(MSP_PER_BASE + 0x188)
432 /* Polo GPIO[54:48] data reg */
433#define POLO_GPIO_CFG4_REG regptr(MSP_PER_BASE + 0x18C)
434 /* Polo GPIO[31:24] config reg */
435#define POLO_GPIO_CFG5_REG regptr(MSP_PER_BASE + 0x190)
436 /* Polo GPIO[39:32] config reg */
437#define POLO_GPIO_CFG6_REG regptr(MSP_PER_BASE + 0x194)
438 /* Polo GPIO[47:40] config reg */
439#define POLO_GPIO_CFG7_REG regptr(MSP_PER_BASE + 0x198)
440 /* Polo GPIO[54:48] config reg */
441#define POLO_GPIO_OD2_REG regptr(MSP_PER_BASE + 0x19C)
442 /* Polo GPIO[54:32] output drive */
443
444/* Generic GPIO registers */
445#define GPIO_DATA1_REG regptr(MSP_PER_BASE + 0x170)
446 /* GPIO[1:0] data register */
447#define GPIO_DATA2_REG regptr(MSP_PER_BASE + 0x174)
448 /* GPIO[5:2] data register */
449#define GPIO_DATA3_REG regptr(MSP_PER_BASE + 0x178)
450 /* GPIO[9:6] data register */
451#define GPIO_DATA4_REG regptr(MSP_PER_BASE + 0x17C)
452 /* GPIO[15:10] data register */
453#define GPIO_CFG1_REG regptr(MSP_PER_BASE + 0x180)
454 /* GPIO[1:0] config register */
455#define GPIO_CFG2_REG regptr(MSP_PER_BASE + 0x184)
456 /* GPIO[5:2] config register */
457#define GPIO_CFG3_REG regptr(MSP_PER_BASE + 0x188)
458 /* GPIO[9:6] config register */
459#define GPIO_CFG4_REG regptr(MSP_PER_BASE + 0x18C)
460 /* GPIO[15:10] config register */
461#define GPIO_OD_REG regptr(MSP_PER_BASE + 0x190)
462 /* GPIO[15:0] output drive */
463
464/*
465 ***************************************************************************
466 * CPU Interface register definitions *
467 ***************************************************************************
468 */
469#define PCI_FLUSH_REG regptr(MSP_CPUIF_BASE + 0x00)
470 /* PCI-SDRAM queue flush trigger */
471#define OCP_ERR1_REG regptr(MSP_CPUIF_BASE + 0x04)
472 /* OCP Error Attribute 1 */
473#define OCP_ERR2_REG regptr(MSP_CPUIF_BASE + 0x08)
474 /* OCP Error Attribute 2 */
475#define OCP_STS_REG regptr(MSP_CPUIF_BASE + 0x0C)
476 /* OCP Error Status */
477#define CPUIF_PM_REG regptr(MSP_CPUIF_BASE + 0x10)
478 /* CPU policy configuration */
479#define CPUIF_CFG_REG regptr(MSP_CPUIF_BASE + 0x10)
480 /* Misc configuration options */
481
482/* Central Interrupt Controller Registers */
483#define MSP_CIC_BASE (MSP_CPUIF_BASE + 0x8000)
484 /* Central Interrupt registers */
485#define CIC_EXT_CFG_REG regptr(MSP_CIC_BASE + 0x00)
486 /* External interrupt config */
487#define CIC_STS_REG regptr(MSP_CIC_BASE + 0x04)
488 /* CIC Interrupt Status */
489#define CIC_VPE0_MSK_REG regptr(MSP_CIC_BASE + 0x08)
490 /* VPE0 Interrupt Mask */
491#define CIC_VPE1_MSK_REG regptr(MSP_CIC_BASE + 0x0C)
492 /* VPE1 Interrupt Mask */
493#define CIC_TC0_MSK_REG regptr(MSP_CIC_BASE + 0x10)
494 /* Thread Context 0 Int Mask */
495#define CIC_TC1_MSK_REG regptr(MSP_CIC_BASE + 0x14)
496 /* Thread Context 1 Int Mask */
497#define CIC_TC2_MSK_REG regptr(MSP_CIC_BASE + 0x18)
498 /* Thread Context 2 Int Mask */
499#define CIC_TC3_MSK_REG regptr(MSP_CIC_BASE + 0x18)
500 /* Thread Context 3 Int Mask */
501#define CIC_TC4_MSK_REG regptr(MSP_CIC_BASE + 0x18)
502 /* Thread Context 4 Int Mask */
503#define CIC_PCIMSI_STS_REG regptr(MSP_CIC_BASE + 0x18)
504#define CIC_PCIMSI_MSK_REG regptr(MSP_CIC_BASE + 0x18)
505#define CIC_PCIFLSH_REG regptr(MSP_CIC_BASE + 0x18)
506#define CIC_VPE0_SWINT_REG regptr(MSP_CIC_BASE + 0x08)
507
508
509/*
510 ***************************************************************************
511 * Memory controller registers *
512 ***************************************************************************
513 */
514#define MEM_CFG1_REG regptr(MSP_MEM_CFG_BASE + 0x00)
515#define MEM_SS_ADDR regptr(MSP_MEM_CFG_BASE + 0x00)
516#define MEM_SS_DATA regptr(MSP_MEM_CFG_BASE + 0x04)
517#define MEM_SS_WRITE regptr(MSP_MEM_CFG_BASE + 0x08)
518
519/*
520 ***************************************************************************
521 * PCI controller registers *
522 ***************************************************************************
523 */
524#define PCI_BASE_REG regptr(MSP_PCI_BASE + 0x00)
525#define PCI_CONFIG_SPACE_REG regptr(MSP_PCI_BASE + 0x800)
526#define PCI_JTAG_DEVID_REG regptr(MSP_SLP_BASE + 0x13c)
527
528/*
529 ########################################################################
530 # Register content & macro definitions #
531 ########################################################################
532 */
533
534/*
535 ***************************************************************************
536 * DEV_ID defines *
537 ***************************************************************************
538 */
539#define DEV_ID_PCI_DIS (1 << 26) /* Set if PCI disabled */
540#define DEV_ID_PCI_HOST (1 << 20) /* Set if PCI host */
541#define DEV_ID_SINGLE_PC (1 << 19) /* Set if single PC Card */
542#define DEV_ID_FAMILY (0xff << 8) /* family ID code */
543#define POLO_ZEUS_SUB_FAMILY (0x7 << 16) /* sub family for Polo/Zeus */
544
545#define MSPFPGA_ID (0x00 << 8) /* you are on your own here */
546#define MSP5000_ID (0x50 << 8)
547#define MSP4F00_ID (0x4f << 8) /* FPGA version of MSP4200 */
548#define MSP4E00_ID (0x4f << 8) /* FPGA version of MSP7120 */
549#define MSP4200_ID (0x42 << 8)
550#define MSP4000_ID (0x40 << 8)
551#define MSP2XXX_ID (0x20 << 8)
552#define MSPZEUS_ID (0x10 << 8)
553
554#define MSP2004_SUB_ID (0x0 << 16)
555#define MSP2005_SUB_ID (0x1 << 16)
556#define MSP2006_SUB_ID (0x1 << 16)
557#define MSP2007_SUB_ID (0x2 << 16)
558#define MSP2010_SUB_ID (0x3 << 16)
559#define MSP2015_SUB_ID (0x4 << 16)
560#define MSP2020_SUB_ID (0x5 << 16)
561#define MSP2100_SUB_ID (0x6 << 16)
562
563/*
564 ***************************************************************************
565 * RESET defines *
566 ***************************************************************************
567 */
568#define MSP_GR_RST (0x01 << 0) /* Global reset bit */
569#define MSP_MR_RST (0x01 << 1) /* MIPS reset bit */
570#define MSP_PD_RST (0x01 << 2) /* PVC DMA reset bit */
571#define MSP_PP_RST (0x01 << 3) /* PVC reset bit */
572/* reserved */
573#define MSP_EA_RST (0x01 << 6) /* Mac A reset bit */
574#define MSP_EB_RST (0x01 << 7) /* Mac B reset bit */
575#define MSP_SE_RST (0x01 << 8) /* Security Eng reset bit */
576#define MSP_PB_RST (0x01 << 9) /* Per block reset bit */
577#define MSP_EC_RST (0x01 << 10) /* Mac C reset bit */
578#define MSP_TW_RST (0x01 << 11) /* TWI reset bit */
579#define MSP_SPI_RST (0x01 << 12) /* SPI/MPI reset bit */
580#define MSP_U1_RST (0x01 << 13) /* UART1 reset bit */
581#define MSP_U0_RST (0x01 << 14) /* UART0 reset bit */
582
583/*
584 ***************************************************************************
585 * UART defines *
586 ***************************************************************************
587 */
588#define MSP_BASE_BAUD 25000000
589#define MSP_UART_REG_LEN 0x20
590
591/*
592 ***************************************************************************
593 * ELB defines *
594 ***************************************************************************
595 */
596#define PCCARD_32 0x02 /* Set if is PCCARD 32 (Cardbus) */
597#define SINGLE_PCCARD 0x01 /* Set to enable single PC card */
598
599/*
600 ***************************************************************************
601 * CIC defines *
602 ***************************************************************************
603 */
604
605/* CIC_EXT_CFG_REG */
606#define EXT_INT_POL(eirq) (1 << (eirq + 8))
607#define EXT_INT_EDGE(eirq) (1 << eirq)
608
609#define CIC_EXT_SET_TRIGGER_LEVEL(reg, eirq) (reg &= ~EXT_INT_EDGE(eirq))
610#define CIC_EXT_SET_TRIGGER_EDGE(reg, eirq) (reg |= EXT_INT_EDGE(eirq))
611#define CIC_EXT_SET_ACTIVE_HI(reg, eirq) (reg |= EXT_INT_POL(eirq))
612#define CIC_EXT_SET_ACTIVE_LO(reg, eirq) (reg &= ~EXT_INT_POL(eirq))
613#define CIC_EXT_SET_ACTIVE_RISING CIC_EXT_SET_ACTIVE_HI
614#define CIC_EXT_SET_ACTIVE_FALLING CIC_EXT_SET_ACTIVE_LO
615
616#define CIC_EXT_IS_TRIGGER_LEVEL(reg, eirq) \
617 ((reg & EXT_INT_EDGE(eirq)) == 0)
618#define CIC_EXT_IS_TRIGGER_EDGE(reg, eirq) (reg & EXT_INT_EDGE(eirq))
619#define CIC_EXT_IS_ACTIVE_HI(reg, eirq) (reg & EXT_INT_POL(eirq))
620#define CIC_EXT_IS_ACTIVE_LO(reg, eirq) \
621 ((reg & EXT_INT_POL(eirq)) == 0)
622#define CIC_EXT_IS_ACTIVE_RISING CIC_EXT_IS_ACTIVE_HI
623#define CIC_EXT_IS_ACTIVE_FALLING CIC_EXT_IS_ACTIVE_LO
624
625/*
626 ***************************************************************************
627 * Memory Controller defines *
628 ***************************************************************************
629 */
630
631/* Indirect memory controller registers */
632#define DDRC_CFG(n) (n)
633#define DDRC_DEBUG(n) (0x04 + n)
634#define DDRC_CTL(n) (0x40 + n)
635
636/* Macro to perform DDRC indirect write */
637#define DDRC_INDIRECT_WRITE(reg, mask, value) \
638({ \
639 *MEM_SS_ADDR = (((mask) & 0xf) << 8) | ((reg) & 0xff); \
640 *MEM_SS_DATA = (value); \
641 *MEM_SS_WRITE = 1; \
642})
643
644/*
645 ***************************************************************************
646 * SPI/MPI Mode *
647 ***************************************************************************
648 */
649#define SPI_MPI_RX_BUSY 0x00008000 /* SPI/MPI Receive Busy */
650#define SPI_MPI_FIFO_EMPTY 0x00004000 /* SPI/MPI Fifo Empty */
651#define SPI_MPI_TX_BUSY 0x00002000 /* SPI/MPI Transmit Busy */
652#define SPI_MPI_FIFO_FULL 0x00001000 /* SPI/MPU FIFO full */
653
654/*
655 ***************************************************************************
656 * SPI/MPI Control Register *
657 ***************************************************************************
658 */
659#define SPI_MPI_RX_START 0x00000004 /* Start receive command */
660#define SPI_MPI_FLUSH_Q 0x00000002 /* Flush SPI/MPI Queue */
661#define SPI_MPI_TX_START 0x00000001 /* Start Transmit Command */
662
663#endif /* !_ASM_MSP_REGS_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/msp_slp_int.h b/include/asm-mips/pmc-sierra/msp71xx/msp_slp_int.h
deleted file mode 100644
index 96d4c8ce8c83..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/msp_slp_int.h
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * Defines for the MSP interrupt controller.
3 *
4 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
5 * Author: Carsten Langgaard, carstenl@mips.com
6 *
7 * ########################################################################
8 *
9 * This program is free software; you can distribute it and/or modify it
10 * under the terms of the GNU General Public License (Version 2) as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 *
22 * ########################################################################
23 */
24
25#ifndef _MSP_SLP_INT_H
26#define _MSP_SLP_INT_H
27
28/*
29 * The PMC-Sierra SLP interrupts are arranged in a 3 level cascaded
30 * hierarchical system. The first level are the direct MIPS interrupts
31 * and are assigned the interrupt range 0-7. The second level is the SLM
32 * interrupt controller and is assigned the range 8-39. The third level
33 * comprises the Peripherial block, the PCI block, the PCI MSI block and
34 * the SLP. The PCI interrupts and the SLP errors are handled by the
35 * relevant subsystems so the core interrupt code needs only concern
36 * itself with the Peripheral block. These are assigned interrupts in
37 * the range 40-71.
38 */
39
40/*
41 * IRQs directly connected to CPU
42 */
43#define MSP_MIPS_INTBASE 0
44#define MSP_INT_SW0 0 /* IRQ for swint0, C_SW0 */
45#define MSP_INT_SW1 1 /* IRQ for swint1, C_SW1 */
46#define MSP_INT_MAC0 2 /* IRQ for MAC 0, C_IRQ0 */
47#define MSP_INT_MAC1 3 /* IRQ for MAC 1, C_IRQ1 */
48#define MSP_INT_C_IRQ2 4 /* Wired off, C_IRQ2 */
49#define MSP_INT_VE 5 /* IRQ for Voice Engine, C_IRQ3 */
50#define MSP_INT_SLP 6 /* IRQ for SLM block, C_IRQ4 */
51#define MSP_INT_TIMER 7 /* IRQ for the MIPS timer, C_IRQ5 */
52
53/*
54 * IRQs cascaded on CPU interrupt 4 (CAUSE bit 12, C_IRQ4)
55 * These defines should be tied to the register definition for the SLM
56 * interrupt routine. For now, just use hard-coded values.
57 */
58#define MSP_SLP_INTBASE (MSP_MIPS_INTBASE + 8)
59#define MSP_INT_EXT0 (MSP_SLP_INTBASE + 0)
60 /* External interrupt 0 */
61#define MSP_INT_EXT1 (MSP_SLP_INTBASE + 1)
62 /* External interrupt 1 */
63#define MSP_INT_EXT2 (MSP_SLP_INTBASE + 2)
64 /* External interrupt 2 */
65#define MSP_INT_EXT3 (MSP_SLP_INTBASE + 3)
66 /* External interrupt 3 */
67/* Reserved 4-7 */
68
69/*
70 *************************************************************************
71 * DANGER/DANGER/DANGER/DANGER/DANGER/DANGER/DANGER/DANGER/DANGER/DANGER *
72 * Some MSP produces have this interrupt labelled as Voice and some are *
73 * SEC mbox ... *
74 *************************************************************************
75 */
76#define MSP_INT_SLP_VE (MSP_SLP_INTBASE + 8)
77 /* Cascaded IRQ for Voice Engine*/
78#define MSP_INT_SLP_TDM (MSP_SLP_INTBASE + 9)
79 /* TDM interrupt */
80#define MSP_INT_SLP_MAC0 (MSP_SLP_INTBASE + 10)
81 /* Cascaded IRQ for MAC 0 */
82#define MSP_INT_SLP_MAC1 (MSP_SLP_INTBASE + 11)
83 /* Cascaded IRQ for MAC 1 */
84#define MSP_INT_SEC (MSP_SLP_INTBASE + 12)
85 /* IRQ for security engine */
86#define MSP_INT_PER (MSP_SLP_INTBASE + 13)
87 /* Peripheral interrupt */
88#define MSP_INT_TIMER0 (MSP_SLP_INTBASE + 14)
89 /* SLP timer 0 */
90#define MSP_INT_TIMER1 (MSP_SLP_INTBASE + 15)
91 /* SLP timer 1 */
92#define MSP_INT_TIMER2 (MSP_SLP_INTBASE + 16)
93 /* SLP timer 2 */
94#define MSP_INT_SLP_TIMER (MSP_SLP_INTBASE + 17)
95 /* Cascaded MIPS timer */
96#define MSP_INT_BLKCP (MSP_SLP_INTBASE + 18)
97 /* Block Copy */
98#define MSP_INT_UART0 (MSP_SLP_INTBASE + 19)
99 /* UART 0 */
100#define MSP_INT_PCI (MSP_SLP_INTBASE + 20)
101 /* PCI subsystem */
102#define MSP_INT_PCI_DBELL (MSP_SLP_INTBASE + 21)
103 /* PCI doorbell */
104#define MSP_INT_PCI_MSI (MSP_SLP_INTBASE + 22)
105 /* PCI Message Signal */
106#define MSP_INT_PCI_BC0 (MSP_SLP_INTBASE + 23)
107 /* PCI Block Copy 0 */
108#define MSP_INT_PCI_BC1 (MSP_SLP_INTBASE + 24)
109 /* PCI Block Copy 1 */
110#define MSP_INT_SLP_ERR (MSP_SLP_INTBASE + 25)
111 /* SLP error condition */
112#define MSP_INT_MAC2 (MSP_SLP_INTBASE + 26)
113 /* IRQ for MAC2 */
114/* Reserved 26-31 */
115
116/*
117 * IRQs cascaded on SLP PER interrupt (MSP_INT_PER)
118 */
119#define MSP_PER_INTBASE (MSP_SLP_INTBASE + 32)
120/* Reserved 0-1 */
121#define MSP_INT_UART1 (MSP_PER_INTBASE + 2)
122 /* UART 1 */
123/* Reserved 3-5 */
124#define MSP_INT_2WIRE (MSP_PER_INTBASE + 6)
125 /* 2-wire */
126#define MSP_INT_TM0 (MSP_PER_INTBASE + 7)
127 /* Peripheral timer block out 0 */
128#define MSP_INT_TM1 (MSP_PER_INTBASE + 8)
129 /* Peripheral timer block out 1 */
130/* Reserved 9 */
131#define MSP_INT_SPRX (MSP_PER_INTBASE + 10)
132 /* SPI RX complete */
133#define MSP_INT_SPTX (MSP_PER_INTBASE + 11)
134 /* SPI TX complete */
135#define MSP_INT_GPIO (MSP_PER_INTBASE + 12)
136 /* GPIO */
137#define MSP_INT_PER_ERR (MSP_PER_INTBASE + 13)
138 /* Peripheral error */
139/* Reserved 14-31 */
140
141#endif /* !_MSP_SLP_INT_H */
diff --git a/include/asm-mips/pmc-sierra/msp71xx/war.h b/include/asm-mips/pmc-sierra/msp71xx/war.h
deleted file mode 100644
index 0bf48fc1892b..000000000000
--- a/include/asm-mips/pmc-sierra/msp71xx/war.h
+++ /dev/null
@@ -1,28 +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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_PMC_SIERRA_WAR_H
9#define __ASM_MIPS_PMC_SIERRA_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#if defined(CONFIG_PMC_MSP7120_EVAL) || defined(CONFIG_PMC_MSP7120_GW) || \
24 defined(CONFIG_PMC_MSP7120_FPGA)
25#define MIPS34K_MISSED_ITLB_WAR 1
26#endif
27
28#endif /* __ASM_MIPS_PMC_SIERRA_WAR_H */
diff --git a/include/asm-mips/pmon.h b/include/asm-mips/pmon.h
deleted file mode 100644
index 6ad519189ce2..000000000000
--- a/include/asm-mips/pmon.h
+++ /dev/null
@@ -1,46 +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) 2004 by Ralf Baechle
7 *
8 * The cpustart method is a PMC-Sierra's function to start the secondary CPU.
9 * Stock PMON 2000 has the smpfork, semlock and semunlock methods instead.
10 */
11#ifndef _ASM_PMON_H
12#define _ASM_PMON_H
13
14struct callvectors {
15 int (*open) (char*, int, int);
16 int (*close) (int);
17 int (*read) (int, void*, int);
18 int (*write) (int, void*, int);
19 off_t (*lseek) (int, off_t, int);
20 int (*printf) (const char*, ...);
21 void (*cacheflush) (void);
22 char* (*gets) (char*);
23 union {
24 int (*smpfork) (unsigned long cp, char *sp);
25 int (*cpustart) (long, void (*)(void), void *, long);
26 } _s;
27 int (*semlock) (int sem);
28 void (*semunlock) (int sem);
29};
30
31extern struct callvectors *debug_vectors;
32
33#define pmon_open(name, flags, mode) debug_vectors->open(name, flage, mode)
34#define pmon_close(fd) debug_vectors->close(fd)
35#define pmon_read(fd, buf, count) debug_vectors->read(fd, buf, count)
36#define pmon_write(fd, buf, count) debug_vectors->write(fd, buf, count)
37#define pmon_lseek(fd, off, whence) debug_vectors->lseek(fd, off, whence)
38#define pmon_printf(fmt...) debug_vectors->printf(fmt)
39#define pmon_cacheflush() debug_vectors->cacheflush()
40#define pmon_gets(s) debug_vectors->gets(s)
41#define pmon_cpustart(n, f, sp, gp) debug_vectors->_s.cpustart(n, f, sp, gp)
42#define pmon_smpfork(cp, sp) debug_vectors->_s.smpfork(cp, sp)
43#define pmon_semlock(sem) debug_vectors->semlock(sem)
44#define pmon_semunlock(sem) debug_vectors->semunlock(sem)
45
46#endif /* _ASM_PMON_H */
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h
deleted file mode 100644
index 47b952080431..000000000000
--- a/include/asm-mips/poll.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_POLL_H
2#define __ASM_POLL_H
3
4#define POLLWRNORM POLLOUT
5#define POLLWRBAND 0x0100
6
7#include <asm-generic/poll.h>
8
9#endif /* __ASM_POLL_H */
diff --git a/include/asm-mips/posix_types.h b/include/asm-mips/posix_types.h
deleted file mode 100644
index c200102c8586..000000000000
--- a/include/asm-mips/posix_types.h
+++ /dev/null
@@ -1,144 +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) 1996, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_POSIX_TYPES_H
10#define _ASM_POSIX_TYPES_H
11
12#include <asm/sgidefs.h>
13
14/*
15 * This file is generally used by user-level software, so you need to
16 * be a little careful about namespace pollution etc. Also, we cannot
17 * assume GCC is being used.
18 */
19
20typedef unsigned long __kernel_ino_t;
21typedef unsigned int __kernel_mode_t;
22#if (_MIPS_SZLONG == 32)
23typedef unsigned long __kernel_nlink_t;
24#endif
25#if (_MIPS_SZLONG == 64)
26typedef unsigned int __kernel_nlink_t;
27#endif
28typedef long __kernel_off_t;
29typedef int __kernel_pid_t;
30typedef int __kernel_ipc_pid_t;
31typedef unsigned int __kernel_uid_t;
32typedef unsigned int __kernel_gid_t;
33#if (_MIPS_SZLONG == 32)
34typedef unsigned int __kernel_size_t;
35typedef int __kernel_ssize_t;
36typedef int __kernel_ptrdiff_t;
37#endif
38#if (_MIPS_SZLONG == 64)
39typedef unsigned long __kernel_size_t;
40typedef long __kernel_ssize_t;
41typedef long __kernel_ptrdiff_t;
42#endif
43typedef long __kernel_time_t;
44typedef long __kernel_suseconds_t;
45typedef long __kernel_clock_t;
46typedef int __kernel_timer_t;
47typedef int __kernel_clockid_t;
48typedef long __kernel_daddr_t;
49typedef char * __kernel_caddr_t;
50
51typedef unsigned short __kernel_uid16_t;
52typedef unsigned short __kernel_gid16_t;
53typedef unsigned int __kernel_uid32_t;
54typedef unsigned int __kernel_gid32_t;
55typedef __kernel_uid_t __kernel_old_uid_t;
56typedef __kernel_gid_t __kernel_old_gid_t;
57typedef unsigned int __kernel_old_dev_t;
58
59#ifdef __GNUC__
60typedef long long __kernel_loff_t;
61#endif
62
63typedef struct {
64#if (_MIPS_SZLONG == 32)
65 long val[2];
66#endif
67#if (_MIPS_SZLONG == 64)
68 int val[2];
69#endif
70} __kernel_fsid_t;
71
72#if defined(__KERNEL__)
73
74#undef __FD_SET
75static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
76{
77 unsigned long __tmp = __fd / __NFDBITS;
78 unsigned long __rem = __fd % __NFDBITS;
79 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
80}
81
82#undef __FD_CLR
83static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
84{
85 unsigned long __tmp = __fd / __NFDBITS;
86 unsigned long __rem = __fd % __NFDBITS;
87 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
88}
89
90#undef __FD_ISSET
91static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
92{
93 unsigned long __tmp = __fd / __NFDBITS;
94 unsigned long __rem = __fd % __NFDBITS;
95 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
96}
97
98/*
99 * This will unroll the loop for the normal constant case (8 ints,
100 * for a 256-bit fd_set)
101 */
102#undef __FD_ZERO
103static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
104{
105 unsigned long *__tmp = __p->fds_bits;
106 int __i;
107
108 if (__builtin_constant_p(__FDSET_LONGS)) {
109 switch (__FDSET_LONGS) {
110 case 16:
111 __tmp[ 0] = 0; __tmp[ 1] = 0;
112 __tmp[ 2] = 0; __tmp[ 3] = 0;
113 __tmp[ 4] = 0; __tmp[ 5] = 0;
114 __tmp[ 6] = 0; __tmp[ 7] = 0;
115 __tmp[ 8] = 0; __tmp[ 9] = 0;
116 __tmp[10] = 0; __tmp[11] = 0;
117 __tmp[12] = 0; __tmp[13] = 0;
118 __tmp[14] = 0; __tmp[15] = 0;
119 return;
120
121 case 8:
122 __tmp[ 0] = 0; __tmp[ 1] = 0;
123 __tmp[ 2] = 0; __tmp[ 3] = 0;
124 __tmp[ 4] = 0; __tmp[ 5] = 0;
125 __tmp[ 6] = 0; __tmp[ 7] = 0;
126 return;
127
128 case 4:
129 __tmp[ 0] = 0; __tmp[ 1] = 0;
130 __tmp[ 2] = 0; __tmp[ 3] = 0;
131 return;
132 }
133 }
134 __i = __FDSET_LONGS;
135 while (__i) {
136 __i--;
137 *__tmp = 0;
138 __tmp++;
139 }
140}
141
142#endif /* defined(__KERNEL__) */
143
144#endif /* _ASM_POSIX_TYPES_H */
diff --git a/include/asm-mips/prefetch.h b/include/asm-mips/prefetch.h
deleted file mode 100644
index 17850834ccb0..000000000000
--- a/include/asm-mips/prefetch.h
+++ /dev/null
@@ -1,87 +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 by Ralf Baechle
7 */
8#ifndef __ASM_PREFETCH_H
9#define __ASM_PREFETCH_H
10
11
12/*
13 * R5000 and RM5200 implements pref and prefx instructions but they're nops, so
14 * rather than wasting time we pretend these processors don't support
15 * prefetching at all.
16 *
17 * R5432 implements Load, Store, LoadStreamed, StoreStreamed, LoadRetained,
18 * StoreRetained and WriteBackInvalidate but not Pref_PrepareForStore.
19 *
20 * Hell (and the book on my shelf I can't open ...) know what the R8000 does.
21 *
22 * RM7000 version 1.0 interprets all hints as Pref_Load; version 2.0 implements
23 * Pref_PrepareForStore also.
24 *
25 * RM9000 is MIPS IV but implements prefetching like MIPS32/MIPS64; it's
26 * Pref_WriteBackInvalidate is a nop and Pref_PrepareForStore is broken in
27 * current versions due to erratum G105.
28 *
29 * VR7701 only implements the Load prefetch.
30 *
31 * Finally MIPS32 and MIPS64 implement all of the following hints.
32 */
33
34#define Pref_Load 0
35#define Pref_Store 1
36 /* 2 and 3 are reserved */
37#define Pref_LoadStreamed 4
38#define Pref_StoreStreamed 5
39#define Pref_LoadRetained 6
40#define Pref_StoreRetained 7
41 /* 8 ... 24 are reserved */
42#define Pref_WriteBackInvalidate 25
43#define Pref_PrepareForStore 30
44
45#ifdef __ASSEMBLY__
46
47 .macro __pref hint addr
48#ifdef CONFIG_CPU_HAS_PREFETCH
49 pref \hint, \addr
50#endif
51 .endm
52
53 .macro pref_load addr
54 __pref Pref_Load, \addr
55 .endm
56
57 .macro pref_store addr
58 __pref Pref_Store, \addr
59 .endm
60
61 .macro pref_load_streamed addr
62 __pref Pref_LoadStreamed, \addr
63 .endm
64
65 .macro pref_store_streamed addr
66 __pref Pref_StoreStreamed, \addr
67 .endm
68
69 .macro pref_load_retained addr
70 __pref Pref_LoadRetained, \addr
71 .endm
72
73 .macro pref_store_retained addr
74 __pref Pref_StoreRetained, \addr
75 .endm
76
77 .macro pref_wback_inv addr
78 __pref Pref_WriteBackInvalidate, \addr
79 .endm
80
81 .macro pref_prepare_for_store addr
82 __pref Pref_PrepareForStore, \addr
83 .endm
84
85#endif
86
87#endif /* __ASM_PREFETCH_H */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
deleted file mode 100644
index a1e4453469f9..000000000000
--- a/include/asm-mips/processor.h
+++ /dev/null
@@ -1,263 +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) 1994 Waldorf GMBH
7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8 * Copyright (C) 1996 Paul M. Antoine
9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10 */
11#ifndef _ASM_PROCESSOR_H
12#define _ASM_PROCESSOR_H
13
14#include <linux/cpumask.h>
15#include <linux/threads.h>
16
17#include <asm/cachectl.h>
18#include <asm/cpu.h>
19#include <asm/cpu-info.h>
20#include <asm/mipsregs.h>
21#include <asm/prefetch.h>
22#include <asm/system.h>
23
24/*
25 * Return current * instruction pointer ("program counter").
26 */
27#define current_text_addr() ({ __label__ _l; _l: &&_l;})
28
29/*
30 * System setup and hardware flags..
31 */
32extern void (*cpu_wait)(void);
33
34extern unsigned int vced_count, vcei_count;
35
36#ifdef CONFIG_32BIT
37/*
38 * User space process size: 2GB. This is hardcoded into a few places,
39 * so don't change it unless you know what you are doing.
40 */
41#define TASK_SIZE 0x7fff8000UL
42#define STACK_TOP TASK_SIZE
43
44/*
45 * This decides where the kernel will search for a free chunk of vm
46 * space during mmap's.
47 */
48#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
49#endif
50
51#ifdef CONFIG_64BIT
52/*
53 * User space process size: 1TB. This is hardcoded into a few places,
54 * so don't change it unless you know what you are doing. TASK_SIZE
55 * is limited to 1TB by the R4000 architecture; R10000 and better can
56 * support 16TB; the architectural reserve for future expansion is
57 * 8192EB ...
58 */
59#define TASK_SIZE32 0x7fff8000UL
60#define TASK_SIZE 0x10000000000UL
61#define STACK_TOP \
62 (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
63
64/*
65 * This decides where the kernel will search for a free chunk of vm
66 * space during mmap's.
67 */
68#define TASK_UNMAPPED_BASE \
69 (test_thread_flag(TIF_32BIT_ADDR) ? \
70 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
71#define TASK_SIZE_OF(tsk) \
72 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
73#endif
74
75#ifdef __KERNEL__
76#define STACK_TOP_MAX TASK_SIZE
77#endif
78
79#define NUM_FPU_REGS 32
80
81typedef __u64 fpureg_t;
82
83/*
84 * It would be nice to add some more fields for emulator statistics, but there
85 * are a number of fixed offsets in offset.h and elsewhere that would have to
86 * be recalculated by hand. So the additional information will be private to
87 * the FPU emulator for now. See asm-mips/fpu_emulator.h.
88 */
89
90struct mips_fpu_struct {
91 fpureg_t fpr[NUM_FPU_REGS];
92 unsigned int fcr31;
93};
94
95#define NUM_DSP_REGS 6
96
97typedef __u32 dspreg_t;
98
99struct mips_dsp_state {
100 dspreg_t dspr[NUM_DSP_REGS];
101 unsigned int dspcontrol;
102};
103
104#define INIT_CPUMASK { \
105 {0,} \
106}
107
108typedef struct {
109 unsigned long seg;
110} mm_segment_t;
111
112#define ARCH_MIN_TASKALIGN 8
113
114struct mips_abi;
115
116/*
117 * If you change thread_struct remember to change the #defines below too!
118 */
119struct thread_struct {
120 /* Saved main processor registers. */
121 unsigned long reg16;
122 unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
123 unsigned long reg29, reg30, reg31;
124
125 /* Saved cp0 stuff. */
126 unsigned long cp0_status;
127
128 /* Saved fpu/fpu emulator stuff. */
129 struct mips_fpu_struct fpu;
130#ifdef CONFIG_MIPS_MT_FPAFF
131 /* Emulated instruction count */
132 unsigned long emulated_fp;
133 /* Saved per-thread scheduler affinity mask */
134 cpumask_t user_cpus_allowed;
135#endif /* CONFIG_MIPS_MT_FPAFF */
136
137 /* Saved state of the DSP ASE, if available. */
138 struct mips_dsp_state dsp;
139
140 /* Other stuff associated with the thread. */
141 unsigned long cp0_badvaddr; /* Last user fault */
142 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
143 unsigned long error_code;
144 unsigned long trap_no;
145 unsigned long irix_trampoline; /* Wheee... */
146 unsigned long irix_oldctx;
147 struct mips_abi *abi;
148};
149
150#ifdef CONFIG_MIPS_MT_FPAFF
151#define FPAFF_INIT \
152 .emulated_fp = 0, \
153 .user_cpus_allowed = INIT_CPUMASK,
154#else
155#define FPAFF_INIT
156#endif /* CONFIG_MIPS_MT_FPAFF */
157
158#define INIT_THREAD { \
159 /* \
160 * Saved main processor registers \
161 */ \
162 .reg16 = 0, \
163 .reg17 = 0, \
164 .reg18 = 0, \
165 .reg19 = 0, \
166 .reg20 = 0, \
167 .reg21 = 0, \
168 .reg22 = 0, \
169 .reg23 = 0, \
170 .reg29 = 0, \
171 .reg30 = 0, \
172 .reg31 = 0, \
173 /* \
174 * Saved cp0 stuff \
175 */ \
176 .cp0_status = 0, \
177 /* \
178 * Saved FPU/FPU emulator stuff \
179 */ \
180 .fpu = { \
181 .fpr = {0,}, \
182 .fcr31 = 0, \
183 }, \
184 /* \
185 * FPU affinity state (null if not FPAFF) \
186 */ \
187 FPAFF_INIT \
188 /* \
189 * Saved DSP stuff \
190 */ \
191 .dsp = { \
192 .dspr = {0, }, \
193 .dspcontrol = 0, \
194 }, \
195 /* \
196 * Other stuff associated with the process \
197 */ \
198 .cp0_badvaddr = 0, \
199 .cp0_baduaddr = 0, \
200 .error_code = 0, \
201 .trap_no = 0, \
202 .irix_trampoline = 0, \
203 .irix_oldctx = 0, \
204}
205
206struct task_struct;
207
208/* Free all resources held by a thread. */
209#define release_thread(thread) do { } while(0)
210
211/* Prepare to copy thread state - unlazy all lazy status */
212#define prepare_to_copy(tsk) do { } while (0)
213
214extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
215
216extern unsigned long thread_saved_pc(struct task_struct *tsk);
217
218/*
219 * Do necessary setup to start up a newly executed thread.
220 */
221extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp);
222
223unsigned long get_wchan(struct task_struct *p);
224
225#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
226#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
227#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
228#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
229#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
230
231#define cpu_relax() barrier()
232
233/*
234 * Return_address is a replacement for __builtin_return_address(count)
235 * which on certain architectures cannot reasonably be implemented in GCC
236 * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
237 * Note that __builtin_return_address(x>=1) is forbidden because GCC
238 * aborts compilation on some CPUs. It's simply not possible to unwind
239 * some CPU's stackframes.
240 *
241 * __builtin_return_address works only for non-leaf functions. We avoid the
242 * overhead of a function call by forcing the compiler to save the return
243 * address register on the stack.
244 */
245#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
246
247#ifdef CONFIG_CPU_HAS_PREFETCH
248
249#define ARCH_HAS_PREFETCH
250
251static inline void prefetch(const void *addr)
252{
253 __asm__ __volatile__(
254 " .set mips4 \n"
255 " pref %0, (%1) \n"
256 " .set mips0 \n"
257 :
258 : "i" (Pref_Load), "r" (addr));
259}
260
261#endif
262
263#endif /* _ASM_PROCESSOR_H */
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
deleted file mode 100644
index 786f7e3c99bc..000000000000
--- a/include/asm-mips/ptrace.h
+++ /dev/null
@@ -1,99 +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) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_PTRACE_H
10#define _ASM_PTRACE_H
11
12
13/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
14#define FPR_BASE 32
15#define PC 64
16#define CAUSE 65
17#define BADVADDR 66
18#define MMHI 67
19#define MMLO 68
20#define FPC_CSR 69
21#define FPC_EIR 70
22#define DSP_BASE 71 /* 3 more hi / lo register pairs */
23#define DSP_CONTROL 77
24#define ACX 78
25
26/*
27 * This struct defines the way the registers are stored on the stack during a
28 * system call/exception. As usual the registers k0/k1 aren't being saved.
29 */
30struct pt_regs {
31#ifdef CONFIG_32BIT
32 /* Pad bytes for argument save space on the stack. */
33 unsigned long pad0[6];
34#endif
35
36 /* Saved main processor registers. */
37 unsigned long regs[32];
38
39 /* Saved special registers. */
40 unsigned long cp0_status;
41 unsigned long hi;
42 unsigned long lo;
43#ifdef CONFIG_CPU_HAS_SMARTMIPS
44 unsigned long acx;
45#endif
46 unsigned long cp0_badvaddr;
47 unsigned long cp0_cause;
48 unsigned long cp0_epc;
49#ifdef CONFIG_MIPS_MT_SMTC
50 unsigned long cp0_tcstatus;
51#endif /* CONFIG_MIPS_MT_SMTC */
52} __attribute__ ((aligned (8)));
53
54/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
55#define PTRACE_GETREGS 12
56#define PTRACE_SETREGS 13
57#define PTRACE_GETFPREGS 14
58#define PTRACE_SETFPREGS 15
59/* #define PTRACE_GETFPXREGS 18 */
60/* #define PTRACE_SETFPXREGS 19 */
61
62#define PTRACE_OLDSETOPTIONS 21
63
64#define PTRACE_GET_THREAD_AREA 25
65#define PTRACE_SET_THREAD_AREA 26
66
67/* Calls to trace a 64bit program from a 32bit program. */
68#define PTRACE_PEEKTEXT_3264 0xc0
69#define PTRACE_PEEKDATA_3264 0xc1
70#define PTRACE_POKETEXT_3264 0xc2
71#define PTRACE_POKEDATA_3264 0xc3
72#define PTRACE_GET_THREAD_AREA_3264 0xc4
73
74#ifdef __KERNEL__
75
76#include <linux/linkage.h>
77#include <asm/isadep.h>
78
79/*
80 * Does the process account for user or for system time?
81 */
82#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
83
84#define instruction_pointer(regs) ((regs)->cp0_epc)
85#define profile_pc(regs) instruction_pointer(regs)
86
87extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
88
89extern NORET_TYPE void die(const char *, const struct pt_regs *) ATTRIB_NORET;
90
91static inline void die_if_kernel(const char *str, const struct pt_regs *regs)
92{
93 if (unlikely(!user_mode(regs)))
94 die(str, regs);
95}
96
97#endif
98
99#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-mips/r4k-timer.h b/include/asm-mips/r4k-timer.h
deleted file mode 100644
index a37d12b3b61c..000000000000
--- a/include/asm-mips/r4k-timer.h
+++ /dev/null
@@ -1,30 +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) 2008 by Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef __ASM_R4K_TYPES_H
9#define __ASM_R4K_TYPES_H
10
11#include <linux/compiler.h>
12
13#ifdef CONFIG_SYNC_R4K
14
15extern void synchronise_count_master(void);
16extern void synchronise_count_slave(void);
17
18#else
19
20static inline void synchronise_count_master(void)
21{
22}
23
24static inline void synchronise_count_slave(void)
25{
26}
27
28#endif
29
30#endif /* __ASM_R4K_TYPES_H */
diff --git a/include/asm-mips/r4kcache.h b/include/asm-mips/r4kcache.h
deleted file mode 100644
index 4c140db36786..000000000000
--- a/include/asm-mips/r4kcache.h
+++ /dev/null
@@ -1,443 +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 * Inline assembly cache operations.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1997 - 2002 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 2004 Ralf Baechle (ralf@linux-mips.org)
11 */
12#ifndef _ASM_R4KCACHE_H
13#define _ASM_R4KCACHE_H
14
15#include <asm/asm.h>
16#include <asm/cacheops.h>
17#include <asm/cpu-features.h>
18#include <asm/mipsmtregs.h>
19
20/*
21 * This macro return a properly sign-extended address suitable as base address
22 * for indexed cache operations. Two issues here:
23 *
24 * - The MIPS32 and MIPS64 specs permit an implementation to directly derive
25 * the index bits from the virtual address. This breaks with tradition
26 * set by the R4000. To keep unpleasant surprises from happening we pick
27 * an address in KSEG0 / CKSEG0.
28 * - We need a properly sign extended address for 64-bit code. To get away
29 * without ifdefs we let the compiler do it by a type cast.
30 */
31#define INDEX_BASE CKSEG0
32
33#define cache_op(op,addr) \
34 __asm__ __volatile__( \
35 " .set push \n" \
36 " .set noreorder \n" \
37 " .set mips3\n\t \n" \
38 " cache %0, %1 \n" \
39 " .set pop \n" \
40 : \
41 : "i" (op), "R" (*(unsigned char *)(addr)))
42
43#ifdef CONFIG_MIPS_MT
44/*
45 * Temporary hacks for SMTC debug. Optionally force single-threaded
46 * execution during I-cache flushes.
47 */
48
49#define PROTECT_CACHE_FLUSHES 1
50
51#ifdef PROTECT_CACHE_FLUSHES
52
53extern int mt_protiflush;
54extern int mt_protdflush;
55extern void mt_cflush_lockdown(void);
56extern void mt_cflush_release(void);
57
58#define BEGIN_MT_IPROT \
59 unsigned long flags = 0; \
60 unsigned long mtflags = 0; \
61 if(mt_protiflush) { \
62 local_irq_save(flags); \
63 ehb(); \
64 mtflags = dvpe(); \
65 mt_cflush_lockdown(); \
66 }
67
68#define END_MT_IPROT \
69 if(mt_protiflush) { \
70 mt_cflush_release(); \
71 evpe(mtflags); \
72 local_irq_restore(flags); \
73 }
74
75#define BEGIN_MT_DPROT \
76 unsigned long flags = 0; \
77 unsigned long mtflags = 0; \
78 if(mt_protdflush) { \
79 local_irq_save(flags); \
80 ehb(); \
81 mtflags = dvpe(); \
82 mt_cflush_lockdown(); \
83 }
84
85#define END_MT_DPROT \
86 if(mt_protdflush) { \
87 mt_cflush_release(); \
88 evpe(mtflags); \
89 local_irq_restore(flags); \
90 }
91
92#else
93
94#define BEGIN_MT_IPROT
95#define BEGIN_MT_DPROT
96#define END_MT_IPROT
97#define END_MT_DPROT
98
99#endif /* PROTECT_CACHE_FLUSHES */
100
101#define __iflush_prologue \
102 unsigned long redundance; \
103 extern int mt_n_iflushes; \
104 BEGIN_MT_IPROT \
105 for (redundance = 0; redundance < mt_n_iflushes; redundance++) {
106
107#define __iflush_epilogue \
108 END_MT_IPROT \
109 }
110
111#define __dflush_prologue \
112 unsigned long redundance; \
113 extern int mt_n_dflushes; \
114 BEGIN_MT_DPROT \
115 for (redundance = 0; redundance < mt_n_dflushes; redundance++) {
116
117#define __dflush_epilogue \
118 END_MT_DPROT \
119 }
120
121#define __inv_dflush_prologue __dflush_prologue
122#define __inv_dflush_epilogue __dflush_epilogue
123#define __sflush_prologue {
124#define __sflush_epilogue }
125#define __inv_sflush_prologue __sflush_prologue
126#define __inv_sflush_epilogue __sflush_epilogue
127
128#else /* CONFIG_MIPS_MT */
129
130#define __iflush_prologue {
131#define __iflush_epilogue }
132#define __dflush_prologue {
133#define __dflush_epilogue }
134#define __inv_dflush_prologue {
135#define __inv_dflush_epilogue }
136#define __sflush_prologue {
137#define __sflush_epilogue }
138#define __inv_sflush_prologue {
139#define __inv_sflush_epilogue }
140
141#endif /* CONFIG_MIPS_MT */
142
143static inline void flush_icache_line_indexed(unsigned long addr)
144{
145 __iflush_prologue
146 cache_op(Index_Invalidate_I, addr);
147 __iflush_epilogue
148}
149
150static inline void flush_dcache_line_indexed(unsigned long addr)
151{
152 __dflush_prologue
153 cache_op(Index_Writeback_Inv_D, addr);
154 __dflush_epilogue
155}
156
157static inline void flush_scache_line_indexed(unsigned long addr)
158{
159 cache_op(Index_Writeback_Inv_SD, addr);
160}
161
162static inline void flush_icache_line(unsigned long addr)
163{
164 __iflush_prologue
165 cache_op(Hit_Invalidate_I, addr);
166 __iflush_epilogue
167}
168
169static inline void flush_dcache_line(unsigned long addr)
170{
171 __dflush_prologue
172 cache_op(Hit_Writeback_Inv_D, addr);
173 __dflush_epilogue
174}
175
176static inline void invalidate_dcache_line(unsigned long addr)
177{
178 __dflush_prologue
179 cache_op(Hit_Invalidate_D, addr);
180 __dflush_epilogue
181}
182
183static inline void invalidate_scache_line(unsigned long addr)
184{
185 cache_op(Hit_Invalidate_SD, addr);
186}
187
188static inline void flush_scache_line(unsigned long addr)
189{
190 cache_op(Hit_Writeback_Inv_SD, addr);
191}
192
193#define protected_cache_op(op,addr) \
194 __asm__ __volatile__( \
195 " .set push \n" \
196 " .set noreorder \n" \
197 " .set mips3 \n" \
198 "1: cache %0, (%1) \n" \
199 "2: .set pop \n" \
200 " .section __ex_table,\"a\" \n" \
201 " "STR(PTR)" 1b, 2b \n" \
202 " .previous" \
203 : \
204 : "i" (op), "r" (addr))
205
206/*
207 * The next two are for badland addresses like signal trampolines.
208 */
209static inline void protected_flush_icache_line(unsigned long addr)
210{
211 protected_cache_op(Hit_Invalidate_I, addr);
212}
213
214/*
215 * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D
216 * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style
217 * caches. We're talking about one cacheline unnecessarily getting invalidated
218 * here so the penalty isn't overly hard.
219 */
220static inline void protected_writeback_dcache_line(unsigned long addr)
221{
222 protected_cache_op(Hit_Writeback_Inv_D, addr);
223}
224
225static inline void protected_writeback_scache_line(unsigned long addr)
226{
227 protected_cache_op(Hit_Writeback_Inv_SD, addr);
228}
229
230/*
231 * This one is RM7000-specific
232 */
233static inline void invalidate_tcache_page(unsigned long addr)
234{
235 cache_op(Page_Invalidate_T, addr);
236}
237
238#define cache16_unroll32(base,op) \
239 __asm__ __volatile__( \
240 " .set push \n" \
241 " .set noreorder \n" \
242 " .set mips3 \n" \
243 " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \
244 " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \
245 " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \
246 " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \
247 " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \
248 " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \
249 " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \
250 " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \
251 " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \
252 " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \
253 " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \
254 " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \
255 " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \
256 " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \
257 " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \
258 " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \
259 " .set pop \n" \
260 : \
261 : "r" (base), \
262 "i" (op));
263
264#define cache32_unroll32(base,op) \
265 __asm__ __volatile__( \
266 " .set push \n" \
267 " .set noreorder \n" \
268 " .set mips3 \n" \
269 " cache %1, 0x000(%0); cache %1, 0x020(%0) \n" \
270 " cache %1, 0x040(%0); cache %1, 0x060(%0) \n" \
271 " cache %1, 0x080(%0); cache %1, 0x0a0(%0) \n" \
272 " cache %1, 0x0c0(%0); cache %1, 0x0e0(%0) \n" \
273 " cache %1, 0x100(%0); cache %1, 0x120(%0) \n" \
274 " cache %1, 0x140(%0); cache %1, 0x160(%0) \n" \
275 " cache %1, 0x180(%0); cache %1, 0x1a0(%0) \n" \
276 " cache %1, 0x1c0(%0); cache %1, 0x1e0(%0) \n" \
277 " cache %1, 0x200(%0); cache %1, 0x220(%0) \n" \
278 " cache %1, 0x240(%0); cache %1, 0x260(%0) \n" \
279 " cache %1, 0x280(%0); cache %1, 0x2a0(%0) \n" \
280 " cache %1, 0x2c0(%0); cache %1, 0x2e0(%0) \n" \
281 " cache %1, 0x300(%0); cache %1, 0x320(%0) \n" \
282 " cache %1, 0x340(%0); cache %1, 0x360(%0) \n" \
283 " cache %1, 0x380(%0); cache %1, 0x3a0(%0) \n" \
284 " cache %1, 0x3c0(%0); cache %1, 0x3e0(%0) \n" \
285 " .set pop \n" \
286 : \
287 : "r" (base), \
288 "i" (op));
289
290#define cache64_unroll32(base,op) \
291 __asm__ __volatile__( \
292 " .set push \n" \
293 " .set noreorder \n" \
294 " .set mips3 \n" \
295 " cache %1, 0x000(%0); cache %1, 0x040(%0) \n" \
296 " cache %1, 0x080(%0); cache %1, 0x0c0(%0) \n" \
297 " cache %1, 0x100(%0); cache %1, 0x140(%0) \n" \
298 " cache %1, 0x180(%0); cache %1, 0x1c0(%0) \n" \
299 " cache %1, 0x200(%0); cache %1, 0x240(%0) \n" \
300 " cache %1, 0x280(%0); cache %1, 0x2c0(%0) \n" \
301 " cache %1, 0x300(%0); cache %1, 0x340(%0) \n" \
302 " cache %1, 0x380(%0); cache %1, 0x3c0(%0) \n" \
303 " cache %1, 0x400(%0); cache %1, 0x440(%0) \n" \
304 " cache %1, 0x480(%0); cache %1, 0x4c0(%0) \n" \
305 " cache %1, 0x500(%0); cache %1, 0x540(%0) \n" \
306 " cache %1, 0x580(%0); cache %1, 0x5c0(%0) \n" \
307 " cache %1, 0x600(%0); cache %1, 0x640(%0) \n" \
308 " cache %1, 0x680(%0); cache %1, 0x6c0(%0) \n" \
309 " cache %1, 0x700(%0); cache %1, 0x740(%0) \n" \
310 " cache %1, 0x780(%0); cache %1, 0x7c0(%0) \n" \
311 " .set pop \n" \
312 : \
313 : "r" (base), \
314 "i" (op));
315
316#define cache128_unroll32(base,op) \
317 __asm__ __volatile__( \
318 " .set push \n" \
319 " .set noreorder \n" \
320 " .set mips3 \n" \
321 " cache %1, 0x000(%0); cache %1, 0x080(%0) \n" \
322 " cache %1, 0x100(%0); cache %1, 0x180(%0) \n" \
323 " cache %1, 0x200(%0); cache %1, 0x280(%0) \n" \
324 " cache %1, 0x300(%0); cache %1, 0x380(%0) \n" \
325 " cache %1, 0x400(%0); cache %1, 0x480(%0) \n" \
326 " cache %1, 0x500(%0); cache %1, 0x580(%0) \n" \
327 " cache %1, 0x600(%0); cache %1, 0x680(%0) \n" \
328 " cache %1, 0x700(%0); cache %1, 0x780(%0) \n" \
329 " cache %1, 0x800(%0); cache %1, 0x880(%0) \n" \
330 " cache %1, 0x900(%0); cache %1, 0x980(%0) \n" \
331 " cache %1, 0xa00(%0); cache %1, 0xa80(%0) \n" \
332 " cache %1, 0xb00(%0); cache %1, 0xb80(%0) \n" \
333 " cache %1, 0xc00(%0); cache %1, 0xc80(%0) \n" \
334 " cache %1, 0xd00(%0); cache %1, 0xd80(%0) \n" \
335 " cache %1, 0xe00(%0); cache %1, 0xe80(%0) \n" \
336 " cache %1, 0xf00(%0); cache %1, 0xf80(%0) \n" \
337 " .set pop \n" \
338 : \
339 : "r" (base), \
340 "i" (op));
341
342/* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */
343#define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize) \
344static inline void blast_##pfx##cache##lsize(void) \
345{ \
346 unsigned long start = INDEX_BASE; \
347 unsigned long end = start + current_cpu_data.desc.waysize; \
348 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
349 unsigned long ws_end = current_cpu_data.desc.ways << \
350 current_cpu_data.desc.waybit; \
351 unsigned long ws, addr; \
352 \
353 __##pfx##flush_prologue \
354 \
355 for (ws = 0; ws < ws_end; ws += ws_inc) \
356 for (addr = start; addr < end; addr += lsize * 32) \
357 cache##lsize##_unroll32(addr|ws, indexop); \
358 \
359 __##pfx##flush_epilogue \
360} \
361 \
362static inline void blast_##pfx##cache##lsize##_page(unsigned long page) \
363{ \
364 unsigned long start = page; \
365 unsigned long end = page + PAGE_SIZE; \
366 \
367 __##pfx##flush_prologue \
368 \
369 do { \
370 cache##lsize##_unroll32(start, hitop); \
371 start += lsize * 32; \
372 } while (start < end); \
373 \
374 __##pfx##flush_epilogue \
375} \
376 \
377static inline void blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
378{ \
379 unsigned long indexmask = current_cpu_data.desc.waysize - 1; \
380 unsigned long start = INDEX_BASE + (page & indexmask); \
381 unsigned long end = start + PAGE_SIZE; \
382 unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
383 unsigned long ws_end = current_cpu_data.desc.ways << \
384 current_cpu_data.desc.waybit; \
385 unsigned long ws, addr; \
386 \
387 __##pfx##flush_prologue \
388 \
389 for (ws = 0; ws < ws_end; ws += ws_inc) \
390 for (addr = start; addr < end; addr += lsize * 32) \
391 cache##lsize##_unroll32(addr|ws, indexop); \
392 \
393 __##pfx##flush_epilogue \
394}
395
396__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16)
397__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
398__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
399__BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32)
400__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
401__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
402__BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
403__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
404__BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
405
406__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16)
407__BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32)
408__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16)
409__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32)
410__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64)
411__BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128)
412
413/* build blast_xxx_range, protected_blast_xxx_range */
414#define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot) \
415static inline void prot##blast_##pfx##cache##_range(unsigned long start, \
416 unsigned long end) \
417{ \
418 unsigned long lsize = cpu_##desc##_line_size(); \
419 unsigned long addr = start & ~(lsize - 1); \
420 unsigned long aend = (end - 1) & ~(lsize - 1); \
421 \
422 __##pfx##flush_prologue \
423 \
424 while (1) { \
425 prot##cache_op(hitop, addr); \
426 if (addr == aend) \
427 break; \
428 addr += lsize; \
429 } \
430 \
431 __##pfx##flush_epilogue \
432}
433
434__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_)
435__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_)
436__BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_)
437__BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, )
438__BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
439/* blast_inv_dcache_range */
440__BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
441__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, )
442
443#endif /* _ASM_R4KCACHE_H */
diff --git a/include/asm-mips/reboot.h b/include/asm-mips/reboot.h
deleted file mode 100644
index e48c0bfab257..000000000000
--- a/include/asm-mips/reboot.h
+++ /dev/null
@@ -1,15 +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) 1997, 1999, 2001, 06 by Ralf Baechle
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 */
9#ifndef _ASM_REBOOT_H
10#define _ASM_REBOOT_H
11
12extern void (*_machine_restart)(char *command);
13extern void (*_machine_halt)(void);
14
15#endif /* _ASM_REBOOT_H */
diff --git a/include/asm-mips/reg.h b/include/asm-mips/reg.h
deleted file mode 100644
index 634b55d7e7f6..000000000000
--- a/include/asm-mips/reg.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Various register offset definitions for debuggers, core file
3 * examiners and whatnot.
4 *
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
7 * for more details.
8 *
9 * Copyright (C) 1995, 1999 Ralf Baechle
10 * Copyright (C) 1995, 1999 Silicon Graphics
11 */
12#ifndef __ASM_MIPS_REG_H
13#define __ASM_MIPS_REG_H
14
15
16#if defined(CONFIG_32BIT) || defined(WANT_COMPAT_REG_H)
17
18#define EF_R0 6
19#define EF_R1 7
20#define EF_R2 8
21#define EF_R3 9
22#define EF_R4 10
23#define EF_R5 11
24#define EF_R6 12
25#define EF_R7 13
26#define EF_R8 14
27#define EF_R9 15
28#define EF_R10 16
29#define EF_R11 17
30#define EF_R12 18
31#define EF_R13 19
32#define EF_R14 20
33#define EF_R15 21
34#define EF_R16 22
35#define EF_R17 23
36#define EF_R18 24
37#define EF_R19 25
38#define EF_R20 26
39#define EF_R21 27
40#define EF_R22 28
41#define EF_R23 29
42#define EF_R24 30
43#define EF_R25 31
44
45/*
46 * k0/k1 unsaved
47 */
48#define EF_R26 32
49#define EF_R27 33
50
51#define EF_R28 34
52#define EF_R29 35
53#define EF_R30 36
54#define EF_R31 37
55
56/*
57 * Saved special registers
58 */
59#define EF_LO 38
60#define EF_HI 39
61
62#define EF_CP0_EPC 40
63#define EF_CP0_BADVADDR 41
64#define EF_CP0_STATUS 42
65#define EF_CP0_CAUSE 43
66#define EF_UNUSED0 44
67
68#define EF_SIZE 180
69
70#endif
71
72#ifdef CONFIG_64BIT
73
74#define EF_R0 0
75#define EF_R1 1
76#define EF_R2 2
77#define EF_R3 3
78#define EF_R4 4
79#define EF_R5 5
80#define EF_R6 6
81#define EF_R7 7
82#define EF_R8 8
83#define EF_R9 9
84#define EF_R10 10
85#define EF_R11 11
86#define EF_R12 12
87#define EF_R13 13
88#define EF_R14 14
89#define EF_R15 15
90#define EF_R16 16
91#define EF_R17 17
92#define EF_R18 18
93#define EF_R19 19
94#define EF_R20 20
95#define EF_R21 21
96#define EF_R22 22
97#define EF_R23 23
98#define EF_R24 24
99#define EF_R25 25
100
101/*
102 * k0/k1 unsaved
103 */
104#define EF_R26 26
105#define EF_R27 27
106
107
108#define EF_R28 28
109#define EF_R29 29
110#define EF_R30 30
111#define EF_R31 31
112
113/*
114 * Saved special registers
115 */
116#define EF_LO 32
117#define EF_HI 33
118
119#define EF_CP0_EPC 34
120#define EF_CP0_BADVADDR 35
121#define EF_CP0_STATUS 36
122#define EF_CP0_CAUSE 37
123
124#define EF_SIZE 304 /* size in bytes */
125
126#endif /* CONFIG_64BIT */
127
128#endif /* __ASM_MIPS_REG_H */
diff --git a/include/asm-mips/regdef.h b/include/asm-mips/regdef.h
deleted file mode 100644
index 7c8ecb6b9c40..000000000000
--- a/include/asm-mips/regdef.h
+++ /dev/null
@@ -1,100 +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) 1985 MIPS Computer Systems, Inc.
7 * Copyright (C) 1994, 95, 99, 2003 by Ralf Baechle
8 * Copyright (C) 1990 - 1992, 1999 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_REGDEF_H
11#define _ASM_REGDEF_H
12
13#include <asm/sgidefs.h>
14
15#if _MIPS_SIM == _MIPS_SIM_ABI32
16
17/*
18 * Symbolic register names for 32 bit ABI
19 */
20#define zero $0 /* wired zero */
21#define AT $1 /* assembler temp - uppercase because of ".set at" */
22#define v0 $2 /* return value */
23#define v1 $3
24#define a0 $4 /* argument registers */
25#define a1 $5
26#define a2 $6
27#define a3 $7
28#define t0 $8 /* caller saved */
29#define t1 $9
30#define t2 $10
31#define t3 $11
32#define t4 $12
33#define t5 $13
34#define t6 $14
35#define t7 $15
36#define s0 $16 /* callee saved */
37#define s1 $17
38#define s2 $18
39#define s3 $19
40#define s4 $20
41#define s5 $21
42#define s6 $22
43#define s7 $23
44#define t8 $24 /* caller saved */
45#define t9 $25
46#define jp $25 /* PIC jump register */
47#define k0 $26 /* kernel scratch */
48#define k1 $27
49#define gp $28 /* global pointer */
50#define sp $29 /* stack pointer */
51#define fp $30 /* frame pointer */
52#define s8 $30 /* same like fp! */
53#define ra $31 /* return address */
54
55#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
56
57#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
58
59#define zero $0 /* wired zero */
60#define AT $at /* assembler temp - uppercase because of ".set at" */
61#define v0 $2 /* return value - caller saved */
62#define v1 $3
63#define a0 $4 /* argument registers */
64#define a1 $5
65#define a2 $6
66#define a3 $7
67#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */
68#define ta0 $8
69#define a5 $9
70#define ta1 $9
71#define a6 $10
72#define ta2 $10
73#define a7 $11
74#define ta3 $11
75#define t0 $12 /* caller saved */
76#define t1 $13
77#define t2 $14
78#define t3 $15
79#define s0 $16 /* callee saved */
80#define s1 $17
81#define s2 $18
82#define s3 $19
83#define s4 $20
84#define s5 $21
85#define s6 $22
86#define s7 $23
87#define t8 $24 /* caller saved */
88#define t9 $25 /* callee address for PIC/temp */
89#define jp $25 /* PIC jump register */
90#define k0 $26 /* kernel temporary */
91#define k1 $27
92#define gp $28 /* global pointer - caller saved for PIC */
93#define sp $29 /* stack pointer */
94#define fp $30 /* frame pointer */
95#define s8 $30 /* callee saved */
96#define ra $31 /* return address */
97
98#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
99
100#endif /* _ASM_REGDEF_H */
diff --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h
deleted file mode 100644
index 87cb3085269c..000000000000
--- a/include/asm-mips/resource.h
+++ /dev/null
@@ -1,35 +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) 1995, 96, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_RESOURCE_H
10#define _ASM_RESOURCE_H
11
12
13/*
14 * These five resource limit IDs have a MIPS/Linux-specific ordering,
15 * the rest comes from the generic header:
16 */
17#define RLIMIT_NOFILE 5 /* max number of open files */
18#define RLIMIT_AS 6 /* address space limit */
19#define RLIMIT_RSS 7 /* max resident set size */
20#define RLIMIT_NPROC 8 /* max number of processes */
21#define RLIMIT_MEMLOCK 9 /* max locked-in-memory address space */
22
23/*
24 * SuS says limits have to be unsigned.
25 * Which makes a ton more sense anyway,
26 * but we keep the old value on MIPS32,
27 * for compatibility:
28 */
29#ifdef CONFIG_32BIT
30# define RLIM_INFINITY 0x7fffffffUL
31#endif
32
33#include <asm-generic/resource.h>
34
35#endif /* _ASM_RESOURCE_H */
diff --git a/include/asm-mips/rm9k-ocd.h b/include/asm-mips/rm9k-ocd.h
deleted file mode 100644
index b0b80d9ecf96..000000000000
--- a/include/asm-mips/rm9k-ocd.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#if !defined(_ASM_RM9K_OCD_H)
21#define _ASM_RM9K_OCD_H
22
23#include <linux/types.h>
24#include <linux/spinlock.h>
25#include <asm/io.h>
26
27extern volatile void __iomem * const ocd_base;
28extern volatile void __iomem * const titan_base;
29
30#define ocd_addr(__x__) (ocd_base + (__x__))
31#define titan_addr(__x__) (titan_base + (__x__))
32#define scram_addr(__x__) (scram_base + (__x__))
33
34/* OCD register access */
35#define ocd_readl(__offs__) __raw_readl(ocd_addr(__offs__))
36#define ocd_readw(__offs__) __raw_readw(ocd_addr(__offs__))
37#define ocd_readb(__offs__) __raw_readb(ocd_addr(__offs__))
38#define ocd_writel(__val__, __offs__) \
39 __raw_writel((__val__), ocd_addr(__offs__))
40#define ocd_writew(__val__, __offs__) \
41 __raw_writew((__val__), ocd_addr(__offs__))
42#define ocd_writeb(__val__, __offs__) \
43 __raw_writeb((__val__), ocd_addr(__offs__))
44
45/* TITAN register access - 32 bit-wide only */
46#define titan_readl(__offs__) __raw_readl(titan_addr(__offs__))
47#define titan_writel(__val__, __offs__) \
48 __raw_writel((__val__), titan_addr(__offs__))
49
50/* Protect access to shared TITAN registers */
51extern spinlock_t titan_lock;
52extern int titan_irqflags;
53#define lock_titan_regs() spin_lock_irqsave(&titan_lock, titan_irqflags)
54#define unlock_titan_regs() spin_unlock_irqrestore(&titan_lock, titan_irqflags)
55
56#endif /* !defined(_ASM_RM9K_OCD_H) */
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
deleted file mode 100644
index 4ca3063ed2ce..000000000000
--- a/include/asm-mips/rtlx.h
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 */
5
6#ifndef __ASM_RTLX_H_
7#define __ASM_RTLX_H_
8
9#include <irq.h>
10
11#define LX_NODE_BASE 10
12
13#define MIPS_CPU_RTLX_IRQ 0
14
15#define RTLX_VERSION 2
16#define RTLX_xID 0x12345600
17#define RTLX_ID (RTLX_xID | RTLX_VERSION)
18#define RTLX_CHANNELS 8
19
20#define RTLX_CHANNEL_STDIO 0
21#define RTLX_CHANNEL_DBG 1
22#define RTLX_CHANNEL_SYSIO 2
23
24extern int rtlx_open(int index, int can_sleep);
25extern int rtlx_release(int index);
26extern ssize_t rtlx_read(int index, void __user *buff, size_t count);
27extern ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
28extern unsigned int rtlx_read_poll(int index, int can_sleep);
29extern unsigned int rtlx_write_poll(int index);
30
31enum rtlx_state {
32 RTLX_STATE_UNUSED = 0,
33 RTLX_STATE_INITIALISED,
34 RTLX_STATE_REMOTE_READY,
35 RTLX_STATE_OPENED
36};
37
38#define RTLX_BUFFER_SIZE 2048
39
40/* each channel supports read and write.
41 linux (vpe0) reads lx_buffer and writes rt_buffer
42 SP (vpe1) reads rt_buffer and writes lx_buffer
43*/
44struct rtlx_channel {
45 enum rtlx_state rt_state;
46 enum rtlx_state lx_state;
47
48 int buffer_size;
49
50 /* read and write indexes per buffer */
51 int rt_write, rt_read;
52 char *rt_buffer;
53
54 int lx_write, lx_read;
55 char *lx_buffer;
56};
57
58struct rtlx_info {
59 unsigned long id;
60 enum rtlx_state state;
61
62 struct rtlx_channel channel[RTLX_CHANNELS];
63};
64
65#endif /* __ASM_RTLX_H_ */
diff --git a/include/asm-mips/scatterlist.h b/include/asm-mips/scatterlist.h
deleted file mode 100644
index 83d69fe17c9f..000000000000
--- a/include/asm-mips/scatterlist.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef __ASM_SCATTERLIST_H
2#define __ASM_SCATTERLIST_H
3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 dma_addr_t dma_address;
13 unsigned int length;
14};
15
16/*
17 * These macros should be used after a pci_map_sg call has been done
18 * to get bus addresses of each of the SG entries and their lengths.
19 * You should only work with the number of sg entries pci_map_sg
20 * returns, or alternatively stop on the first sg_dma_len(sg) which
21 * is 0.
22 */
23#define sg_dma_address(sg) ((sg)->dma_address)
24#define sg_dma_len(sg) ((sg)->length)
25
26#define ISA_DMA_THRESHOLD (0x00ffffffUL)
27
28#endif /* __ASM_SCATTERLIST_H */
diff --git a/include/asm-mips/seccomp.h b/include/asm-mips/seccomp.h
deleted file mode 100644
index 36ed44070256..000000000000
--- a/include/asm-mips/seccomp.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef __ASM_SECCOMP_H
2
3#include <linux/thread_info.h>
4#include <linux/unistd.h>
5
6#define __NR_seccomp_read __NR_read
7#define __NR_seccomp_write __NR_write
8#define __NR_seccomp_exit __NR_exit
9#define __NR_seccomp_sigreturn __NR_rt_sigreturn
10
11/*
12 * Kludge alert:
13 *
14 * The generic seccomp code currently allows only a single compat ABI. Until
15 * this is fixed we priorize O32 as the compat ABI over N32.
16 */
17#ifdef CONFIG_MIPS32_O32
18
19#define TIF_32BIT TIF_32BIT_REGS
20
21#define __NR_seccomp_read_32 4003
22#define __NR_seccomp_write_32 4004
23#define __NR_seccomp_exit_32 4001
24#define __NR_seccomp_sigreturn_32 4193 /* rt_sigreturn */
25
26#elif defined(CONFIG_MIPS32_N32)
27
28#define TIF_32BIT _TIF_32BIT_ADDR
29
30#define __NR_seccomp_read_32 6000
31#define __NR_seccomp_write_32 6001
32#define __NR_seccomp_exit_32 6058
33#define __NR_seccomp_sigreturn_32 6211 /* rt_sigreturn */
34
35#endif /* CONFIG_MIPS32_O32 */
36
37#endif /* __ASM_SECCOMP_H */
diff --git a/include/asm-mips/sections.h b/include/asm-mips/sections.h
deleted file mode 100644
index b7e37262c246..000000000000
--- a/include/asm-mips/sections.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SECTIONS_H
2#define _ASM_SECTIONS_H
3
4#include <asm-generic/sections.h>
5
6#endif /* _ASM_SECTIONS_H */
diff --git a/include/asm-mips/segment.h b/include/asm-mips/segment.h
deleted file mode 100644
index 92ac001fc483..000000000000
--- a/include/asm-mips/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SEGMENT_H
2#define _ASM_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif /* _ASM_SEGMENT_H */
diff --git a/include/asm-mips/sembuf.h b/include/asm-mips/sembuf.h
deleted file mode 100644
index 7281a4decaa0..000000000000
--- a/include/asm-mips/sembuf.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_SEMBUF_H
2#define _ASM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for the MIPS architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 */
12
13struct semid64_ds {
14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
15 __kernel_time_t sem_otime; /* last semop time */
16 __kernel_time_t sem_ctime; /* last change time */
17 unsigned long sem_nsems; /* no. of semaphores in array */
18 unsigned long __unused1;
19 unsigned long __unused2;
20};
21
22#endif /* _ASM_SEMBUF_H */
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
deleted file mode 100644
index c07ebd8eb9e7..000000000000
--- a/include/asm-mips/serial.h
+++ /dev/null
@@ -1,22 +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) 1999 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SERIAL_H
10#define _ASM_SERIAL_H
11
12
13/*
14 * This assumes you have a 1.8432 MHz clock for your UART.
15 *
16 * It'd be nice if someone built a serial card with a 24.576 MHz
17 * clock, since the 16550A is capable of handling a top speed of 1.5
18 * megabits/second; but this requires the faster clock.
19 */
20#define BASE_BAUD (1843200 / 16)
21
22#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-mips/setup.h b/include/asm-mips/setup.h
deleted file mode 100644
index e600cedda976..000000000000
--- a/include/asm-mips/setup.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _MIPS_SETUP_H
2#define _MIPS_SETUP_H
3
4#define COMMAND_LINE_SIZE 256
5
6#ifdef __KERNEL__
7extern void setup_early_printk(void);
8#endif /* __KERNEL__ */
9
10#endif /* __SETUP_H */
diff --git a/include/asm-mips/sgi/gio.h b/include/asm-mips/sgi/gio.h
deleted file mode 100644
index 889cf028c95d..000000000000
--- a/include/asm-mips/sgi/gio.h
+++ /dev/null
@@ -1,86 +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 * gio.h: Definitions for SGI GIO bus
7 *
8 * Copyright (C) 2002 Ladislav Michl
9 */
10
11#ifndef _SGI_GIO_H
12#define _SGI_GIO_H
13
14/*
15 * GIO bus addresses
16 *
17 * The Indigo and Indy have two GIO bus connectors. Indigo2 (all models) have
18 * three physical connectors, but only two slots, GFX and EXP0.
19 *
20 * There is 10MB of GIO address space for GIO64 slot devices
21 * slot# slot type address range size
22 * ----- --------- ----------------------- -----
23 * 0 GFX 0x1f000000 - 0x1f3fffff 4MB
24 * 1 EXP0 0x1f400000 - 0x1f5fffff 2MB
25 * 2 EXP1 0x1f600000 - 0x1f9fffff 4MB
26 *
27 * There are un-slotted devices, HPC, I/O and misc devices, which are grouped
28 * into the HPC address space.
29 * - MISC 0x1fb00000 - 0x1fbfffff 1MB
30 *
31 * Following space is reserved and unused
32 * - RESERVED 0x18000000 - 0x1effffff 112MB
33 *
34 * GIO bus IDs
35 *
36 * Each GIO bus device identifies itself to the system by answering a
37 * read with an "ID" value. IDs are either 8 or 32 bits long. IDs less
38 * than 128 are 8 bits long, with the most significant 24 bits read from
39 * the slot undefined.
40 *
41 * 32-bit IDs are divided into
42 * bits 0:6 the product ID; ranges from 0x00 to 0x7F.
43 * bit 7 0=GIO Product ID is 8 bits wide
44 * 1=GIO Product ID is 32 bits wide.
45 * bits 8:15 manufacturer version for the product.
46 * bit 16 0=GIO32 and GIO32-bis, 1=GIO64.
47 * bit 17 0=no ROM present
48 * 1=ROM present on this board AND next three words
49 * space define the ROM.
50 * bits 18:31 up to manufacturer.
51 *
52 * IDs above 0x50/0xd0 are of 3rd party boards.
53 *
54 * 8-bit IDs
55 * 0x01 XPI low cost FDDI
56 * 0x02 GTR TokenRing
57 * 0x04 Synchronous ISDN
58 * 0x05 ATM board [*]
59 * 0x06 Canon Interface
60 * 0x07 16 bit SCSI Card [*]
61 * 0x08 JPEG (Double Wide)
62 * 0x09 JPEG (Single Wide)
63 * 0x0a XPI mez. FDDI device 0
64 * 0x0b XPI mez. FDDI device 1
65 * 0x0c SMPTE 259M Video [*]
66 * 0x0d Babblefish Compression [*]
67 * 0x0e E-Plex 8-port Ethernet
68 * 0x30 Lyon Lamb IVAS
69 * 0xb8 GIO 100BaseTX Fast Ethernet (gfe)
70 *
71 * [*] Device provide 32-bit ID.
72 *
73 */
74
75#define GIO_ID(x) (x & 0x7f)
76#define GIO_32BIT_ID 0x80
77#define GIO_REV(x) ((x >> 8) & 0xff)
78#define GIO_64BIT_IFACE 0x10000
79#define GIO_ROM_PRESENT 0x20000
80#define GIO_VENDOR_CODE(x) ((x >> 18) & 0x3fff)
81
82#define GIO_SLOT_GFX_BASE 0x1f000000
83#define GIO_SLOT_EXP0_BASE 0x1f400000
84#define GIO_SLOT_EXP1_BASE 0x1f600000
85
86#endif /* _SGI_GIO_H */
diff --git a/include/asm-mips/sgi/hpc3.h b/include/asm-mips/sgi/hpc3.h
deleted file mode 100644
index c4729f531919..000000000000
--- a/include/asm-mips/sgi/hpc3.h
+++ /dev/null
@@ -1,317 +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 * hpc3.h: Definitions for SGI HPC3 controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1998 Ralf Baechle
10 */
11
12#ifndef _SGI_HPC3_H
13#define _SGI_HPC3_H
14
15#include <linux/types.h>
16#include <asm/page.h>
17
18/* An HPC DMA descriptor. */
19struct hpc_dma_desc {
20 u32 pbuf; /* physical address of data buffer */
21 u32 cntinfo; /* counter and info bits */
22#define HPCDMA_EOX 0x80000000 /* last desc in chain for tx */
23#define HPCDMA_EOR 0x80000000 /* last desc in chain for rx */
24#define HPCDMA_EOXP 0x40000000 /* end of packet for tx */
25#define HPCDMA_EORP 0x40000000 /* end of packet for rx */
26#define HPCDMA_XIE 0x20000000 /* irq generated when at end of this desc */
27#define HPCDMA_XIU 0x01000000 /* Tx buffer in use by CPU. */
28#define HPCDMA_EIPC 0x00ff0000 /* SEEQ ethernet special xternal bytecount */
29#define HPCDMA_ETXD 0x00008000 /* set to one by HPC when packet tx'd */
30#define HPCDMA_OWN 0x00004000 /* Denotes ring buffer ownership on rx */
31#define HPCDMA_BCNT 0x00003fff /* size in bytes of this dma buffer */
32
33 u32 pnext; /* paddr of next hpc_dma_desc if any */
34};
35
36/* The set of regs for each HPC3 PBUS DMA channel. */
37struct hpc3_pbus_dmacregs {
38 volatile u32 pbdma_bptr; /* pbus dma channel buffer ptr */
39 volatile u32 pbdma_dptr; /* pbus dma channel desc ptr */
40 u32 _unused0[0x1000/4 - 2]; /* padding */
41 volatile u32 pbdma_ctrl; /* pbus dma channel control register has
42 * copletely different meaning for read
43 * compared with write */
44 /* read */
45#define HPC3_PDMACTRL_INT 0x00000001 /* interrupt (cleared after read) */
46#define HPC3_PDMACTRL_ISACT 0x00000002 /* channel active */
47 /* write */
48#define HPC3_PDMACTRL_SEL 0x00000002 /* little endian transfer */
49#define HPC3_PDMACTRL_RCV 0x00000004 /* direction is receive */
50#define HPC3_PDMACTRL_FLSH 0x00000008 /* enable flush for receive DMA */
51#define HPC3_PDMACTRL_ACT 0x00000010 /* start dma transfer */
52#define HPC3_PDMACTRL_LD 0x00000020 /* load enable for ACT */
53#define HPC3_PDMACTRL_RT 0x00000040 /* Use realtime GIO bus servicing */
54#define HPC3_PDMACTRL_HW 0x0000ff00 /* DMA High-water mark */
55#define HPC3_PDMACTRL_FB 0x003f0000 /* Ptr to beginning of fifo */
56#define HPC3_PDMACTRL_FE 0x3f000000 /* Ptr to end of fifo */
57
58 u32 _unused1[0x1000/4 - 1]; /* padding */
59};
60
61/* The HPC3 SCSI registers, this does not include external ones. */
62struct hpc3_scsiregs {
63 volatile u32 cbptr; /* current dma buffer ptr, diagnostic use only */
64 volatile u32 ndptr; /* next dma descriptor ptr */
65 u32 _unused0[0x1000/4 - 2]; /* padding */
66 volatile u32 bcd; /* byte count info */
67#define HPC3_SBCD_BCNTMSK 0x00003fff /* bytes to transfer from/to memory */
68#define HPC3_SBCD_XIE 0x00004000 /* Send IRQ when done with cur buf */
69#define HPC3_SBCD_EOX 0x00008000 /* Indicates this is last buf in chain */
70
71 volatile u32 ctrl; /* control register */
72#define HPC3_SCTRL_IRQ 0x01 /* IRQ asserted, either dma done or parity */
73#define HPC3_SCTRL_ENDIAN 0x02 /* DMA endian mode, 0=big 1=little */
74#define HPC3_SCTRL_DIR 0x04 /* DMA direction, 1=dev2mem 0=mem2dev */
75#define HPC3_SCTRL_FLUSH 0x08 /* Tells HPC3 to flush scsi fifos */
76#define HPC3_SCTRL_ACTIVE 0x10 /* SCSI DMA channel is active */
77#define HPC3_SCTRL_AMASK 0x20 /* DMA active inhibits PIO */
78#define HPC3_SCTRL_CRESET 0x40 /* Resets dma channel and external controller */
79#define HPC3_SCTRL_PERR 0x80 /* Bad parity on HPC3 iface to scsi controller */
80
81 volatile u32 gfptr; /* current GIO fifo ptr */
82 volatile u32 dfptr; /* current device fifo ptr */
83 volatile u32 dconfig; /* DMA configuration register */
84#define HPC3_SDCFG_HCLK 0x00001 /* Enable DMA half clock mode */
85#define HPC3_SDCFG_D1 0x00006 /* Cycles to spend in D1 state */
86#define HPC3_SDCFG_D2 0x00038 /* Cycles to spend in D2 state */
87#define HPC3_SDCFG_D3 0x001c0 /* Cycles to spend in D3 state */
88#define HPC3_SDCFG_HWAT 0x00e00 /* DMA high water mark */
89#define HPC3_SDCFG_HW 0x01000 /* Enable 16-bit halfword DMA accesses to scsi */
90#define HPC3_SDCFG_SWAP 0x02000 /* Byte swap all DMA accesses */
91#define HPC3_SDCFG_EPAR 0x04000 /* Enable parity checking for DMA */
92#define HPC3_SDCFG_POLL 0x08000 /* hd_dreq polarity control */
93#define HPC3_SDCFG_ERLY 0x30000 /* hd_dreq behavior control bits */
94
95 volatile u32 pconfig; /* PIO configuration register */
96#define HPC3_SPCFG_P3 0x0003 /* Cycles to spend in P3 state */
97#define HPC3_SPCFG_P2W 0x001c /* Cycles to spend in P2 state for writes */
98#define HPC3_SPCFG_P2R 0x01e0 /* Cycles to spend in P2 state for reads */
99#define HPC3_SPCFG_P1 0x0e00 /* Cycles to spend in P1 state */
100#define HPC3_SPCFG_HW 0x1000 /* Enable 16-bit halfword PIO accesses to scsi */
101#define HPC3_SPCFG_SWAP 0x2000 /* Byte swap all PIO accesses */
102#define HPC3_SPCFG_EPAR 0x4000 /* Enable parity checking for PIO */
103#define HPC3_SPCFG_FUJI 0x8000 /* Fujitsu scsi controller mode for faster dma/pio */
104
105 u32 _unused1[0x1000/4 - 6]; /* padding */
106};
107
108/* SEEQ ethernet HPC3 registers, only one seeq per HPC3. */
109struct hpc3_ethregs {
110 /* Receiver registers. */
111 volatile u32 rx_cbptr; /* current dma buffer ptr, diagnostic use only */
112 volatile u32 rx_ndptr; /* next dma descriptor ptr */
113 u32 _unused0[0x1000/4 - 2]; /* padding */
114 volatile u32 rx_bcd; /* byte count info */
115#define HPC3_ERXBCD_BCNTMSK 0x00003fff /* bytes to be sent to memory */
116#define HPC3_ERXBCD_XIE 0x20000000 /* HPC3 interrupts cpu at end of this buf */
117#define HPC3_ERXBCD_EOX 0x80000000 /* flags this as end of descriptor chain */
118
119 volatile u32 rx_ctrl; /* control register */
120#define HPC3_ERXCTRL_STAT50 0x0000003f /* Receive status reg bits of Seeq8003 */
121#define HPC3_ERXCTRL_STAT6 0x00000040 /* Rdonly irq status */
122#define HPC3_ERXCTRL_STAT7 0x00000080 /* Rdonlt old/new status bit from Seeq */
123#define HPC3_ERXCTRL_ENDIAN 0x00000100 /* Endian for dma channel, little=1 big=0 */
124#define HPC3_ERXCTRL_ACTIVE 0x00000200 /* Tells if DMA transfer is in progress */
125#define HPC3_ERXCTRL_AMASK 0x00000400 /* Tells if ACTIVE inhibits PIO's to hpc3 */
126#define HPC3_ERXCTRL_RBO 0x00000800 /* Receive buffer overflow if set to 1 */
127
128 volatile u32 rx_gfptr; /* current GIO fifo ptr */
129 volatile u32 rx_dfptr; /* current device fifo ptr */
130 u32 _unused1; /* padding */
131 volatile u32 reset; /* reset register */
132#define HPC3_ERST_CRESET 0x1 /* Reset dma channel and external controller */
133#define HPC3_ERST_CLRIRQ 0x2 /* Clear channel interrupt */
134#define HPC3_ERST_LBACK 0x4 /* Enable diagnostic loopback mode of Seeq8003 */
135
136 volatile u32 dconfig; /* DMA configuration register */
137#define HPC3_EDCFG_D1 0x0000f /* Cycles to spend in D1 state for PIO */
138#define HPC3_EDCFG_D2 0x000f0 /* Cycles to spend in D2 state for PIO */
139#define HPC3_EDCFG_D3 0x00f00 /* Cycles to spend in D3 state for PIO */
140#define HPC3_EDCFG_WCTRL 0x01000 /* Enable writes of desc into ex ctrl port */
141#define HPC3_EDCFG_FRXDC 0x02000 /* Clear eop stat bits upon rxdc, hw seeq fix */
142#define HPC3_EDCFG_FEOP 0x04000 /* Bad packet marker timeout enable */
143#define HPC3_EDCFG_FIRQ 0x08000 /* Another bad packet timeout enable */
144#define HPC3_EDCFG_PTO 0x30000 /* Programmed timeout value for above two */
145
146 volatile u32 pconfig; /* PIO configuration register */
147#define HPC3_EPCFG_P1 0x000f /* Cycles to spend in P1 state for PIO */
148#define HPC3_EPCFG_P2 0x00f0 /* Cycles to spend in P2 state for PIO */
149#define HPC3_EPCFG_P3 0x0f00 /* Cycles to spend in P3 state for PIO */
150#define HPC3_EPCFG_TST 0x1000 /* Diagnistic ram test feature bit */
151
152 u32 _unused2[0x1000/4 - 8]; /* padding */
153
154 /* Transmitter registers. */
155 volatile u32 tx_cbptr; /* current dma buffer ptr, diagnostic use only */
156 volatile u32 tx_ndptr; /* next dma descriptor ptr */
157 u32 _unused3[0x1000/4 - 2]; /* padding */
158 volatile u32 tx_bcd; /* byte count info */
159#define HPC3_ETXBCD_BCNTMSK 0x00003fff /* bytes to be read from memory */
160#define HPC3_ETXBCD_ESAMP 0x10000000 /* if set, too late to add descriptor */
161#define HPC3_ETXBCD_XIE 0x20000000 /* Interrupt cpu at end of cur desc */
162#define HPC3_ETXBCD_EOP 0x40000000 /* Last byte of cur buf is end of packet */
163#define HPC3_ETXBCD_EOX 0x80000000 /* This buf is the end of desc chain */
164
165 volatile u32 tx_ctrl; /* control register */
166#define HPC3_ETXCTRL_STAT30 0x0000000f /* Rdonly copy of seeq tx stat reg */
167#define HPC3_ETXCTRL_STAT4 0x00000010 /* Indicate late collision occurred */
168#define HPC3_ETXCTRL_STAT75 0x000000e0 /* Rdonly irq status from seeq */
169#define HPC3_ETXCTRL_ENDIAN 0x00000100 /* DMA channel endian mode, 1=little 0=big */
170#define HPC3_ETXCTRL_ACTIVE 0x00000200 /* DMA tx channel is active */
171#define HPC3_ETXCTRL_AMASK 0x00000400 /* Indicates ACTIVE inhibits PIO's */
172
173 volatile u32 tx_gfptr; /* current GIO fifo ptr */
174 volatile u32 tx_dfptr; /* current device fifo ptr */
175 u32 _unused4[0x1000/4 - 4]; /* padding */
176};
177
178struct hpc3_regs {
179 /* First regs for the PBUS 8 dma channels. */
180 struct hpc3_pbus_dmacregs pbdma[8];
181
182 /* Now the HPC scsi registers, we get two scsi reg sets. */
183 struct hpc3_scsiregs scsi_chan0, scsi_chan1;
184
185 /* The SEEQ hpc3 ethernet dma/control registers. */
186 struct hpc3_ethregs ethregs;
187
188 /* Here are where the hpc3 fifo's can be directly accessed
189 * via PIO accesses. Under normal operation we never stick
190 * our grubby paws in here so it's just padding. */
191 u32 _unused0[0x18000/4];
192
193 /* HPC3 irq status regs. Due to a peculiar bug you need to
194 * look at two different register addresses to get at all of
195 * the status bits. The first reg can only reliably report
196 * bits 4:0 of the status, and the second reg can only
197 * reliably report bits 9:5 of the hpc3 irq status. I told
198 * you it was a peculiar bug. ;-)
199 */
200 volatile u32 istat0; /* Irq status, only bits <4:0> reliable. */
201#define HPC3_ISTAT_PBIMASK 0x0ff /* irq bits for pbus devs 0 --> 7 */
202#define HPC3_ISTAT_SC0MASK 0x100 /* irq bit for scsi channel 0 */
203#define HPC3_ISTAT_SC1MASK 0x200 /* irq bit for scsi channel 1 */
204
205 volatile u32 gio_misc; /* GIO misc control bits. */
206#define HPC3_GIOMISC_ERTIME 0x1 /* Enable external timer real time. */
207#define HPC3_GIOMISC_DENDIAN 0x2 /* dma descriptor endian, 1=lit 0=big */
208
209 u32 eeprom; /* EEPROM data reg. */
210#define HPC3_EEPROM_EPROT 0x01 /* Protect register enable */
211#define HPC3_EEPROM_CSEL 0x02 /* Chip select */
212#define HPC3_EEPROM_ECLK 0x04 /* EEPROM clock */
213#define HPC3_EEPROM_DATO 0x08 /* Data out */
214#define HPC3_EEPROM_DATI 0x10 /* Data in */
215
216 volatile u32 istat1; /* Irq status, only bits <9:5> reliable. */
217 volatile u32 bestat; /* Bus error interrupt status reg. */
218#define HPC3_BESTAT_BLMASK 0x000ff /* Bus lane where bad parity occurred */
219#define HPC3_BESTAT_CTYPE 0x00100 /* Bus cycle type, 0=PIO 1=DMA */
220#define HPC3_BESTAT_PIDSHIFT 9
221#define HPC3_BESTAT_PIDMASK 0x3f700 /* DMA channel parity identifier */
222
223 u32 _unused1[0x14000/4 - 5]; /* padding */
224
225 /* Now direct PIO per-HPC3 peripheral access to external regs. */
226 volatile u32 scsi0_ext[256]; /* SCSI channel 0 external regs */
227 u32 _unused2[0x7c00/4];
228 volatile u32 scsi1_ext[256]; /* SCSI channel 1 external regs */
229 u32 _unused3[0x7c00/4];
230 volatile u32 eth_ext[320]; /* Ethernet external registers */
231 u32 _unused4[0x3b00/4];
232
233 /* Per-peripheral device external registers and DMA/PIO control. */
234 volatile u32 pbus_extregs[16][256];
235 volatile u32 pbus_dmacfg[8][128];
236 /* Cycles to spend in D3 for reads */
237#define HPC3_DMACFG_D3R_MASK 0x00000001
238#define HPC3_DMACFG_D3R_SHIFT 0
239 /* Cycles to spend in D4 for reads */
240#define HPC3_DMACFG_D4R_MASK 0x0000001e
241#define HPC3_DMACFG_D4R_SHIFT 1
242 /* Cycles to spend in D5 for reads */
243#define HPC3_DMACFG_D5R_MASK 0x000001e0
244#define HPC3_DMACFG_D5R_SHIFT 5
245 /* Cycles to spend in D3 for writes */
246#define HPC3_DMACFG_D3W_MASK 0x00000200
247#define HPC3_DMACFG_D3W_SHIFT 9
248 /* Cycles to spend in D4 for writes */
249#define HPC3_DMACFG_D4W_MASK 0x00003c00
250#define HPC3_DMACFG_D4W_SHIFT 10
251 /* Cycles to spend in D5 for writes */
252#define HPC3_DMACFG_D5W_MASK 0x0003c000
253#define HPC3_DMACFG_D5W_SHIFT 14
254 /* Enable 16-bit DMA access mode */
255#define HPC3_DMACFG_DS16 0x00040000
256 /* Places halfwords on high 16 bits of bus */
257#define HPC3_DMACFG_EVENHI 0x00080000
258 /* Make this device real time */
259#define HPC3_DMACFG_RTIME 0x00200000
260 /* 5 bit burst count for DMA device */
261#define HPC3_DMACFG_BURST_MASK 0x07c00000
262#define HPC3_DMACFG_BURST_SHIFT 22
263 /* Use live pbus_dreq unsynchronized signal */
264#define HPC3_DMACFG_DRQLIVE 0x08000000
265 volatile u32 pbus_piocfg[16][64];
266 /* Cycles to spend in P2 state for reads */
267#define HPC3_PIOCFG_P2R_MASK 0x00001
268#define HPC3_PIOCFG_P2R_SHIFT 0
269 /* Cycles to spend in P3 state for reads */
270#define HPC3_PIOCFG_P3R_MASK 0x0001e
271#define HPC3_PIOCFG_P3R_SHIFT 1
272 /* Cycles to spend in P4 state for reads */
273#define HPC3_PIOCFG_P4R_MASK 0x001e0
274#define HPC3_PIOCFG_P4R_SHIFT 5
275 /* Cycles to spend in P2 state for writes */
276#define HPC3_PIOCFG_P2W_MASK 0x00200
277#define HPC3_PIOCFG_P2W_SHIFT 9
278 /* Cycles to spend in P3 state for writes */
279#define HPC3_PIOCFG_P3W_MASK 0x03c00
280#define HPC3_PIOCFG_P3W_SHIFT 10
281 /* Cycles to spend in P4 state for writes */
282#define HPC3_PIOCFG_P4W_MASK 0x3c000
283#define HPC3_PIOCFG_P4W_SHIFT 14
284 /* Enable 16-bit PIO accesses */
285#define HPC3_PIOCFG_DS16 0x40000
286 /* Place even address bits in bits <15:8> */
287#define HPC3_PIOCFG_EVENHI 0x80000
288
289 /* PBUS PROM control regs. */
290 volatile u32 pbus_promwe; /* PROM write enable register */
291#define HPC3_PROM_WENAB 0x1 /* Enable writes to the PROM */
292
293 u32 _unused5[0x0800/4 - 1];
294 volatile u32 pbus_promswap; /* Chip select swap reg */
295#define HPC3_PROM_SWAP 0x1 /* invert GIO addr bit to select prom0 or prom1 */
296
297 u32 _unused6[0x0800/4 - 1];
298 volatile u32 pbus_gout; /* PROM general purpose output reg */
299#define HPC3_PROM_STAT 0x1 /* General purpose status bit in gout */
300
301 u32 _unused7[0x1000/4 - 1];
302 volatile u32 rtcregs[14]; /* Dallas clock registers */
303 u32 _unused8[50];
304 volatile u32 bbram[8192-50-14]; /* Battery backed ram */
305};
306
307/*
308 * It is possible to have two HPC3's within the address space on
309 * one machine, though only having one is more likely on an Indy.
310 */
311extern struct hpc3_regs *hpc3c0, *hpc3c1;
312#define HPC3_CHIP0_BASE 0x1fb80000 /* physical */
313#define HPC3_CHIP1_BASE 0x1fb00000 /* physical */
314
315extern void sgihpc_init(void);
316
317#endif /* _SGI_HPC3_H */
diff --git a/include/asm-mips/sgi/ioc.h b/include/asm-mips/sgi/ioc.h
deleted file mode 100644
index 343ed15f8dc4..000000000000
--- a/include/asm-mips/sgi/ioc.h
+++ /dev/null
@@ -1,200 +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 * ioc.h: Definitions for SGI I/O Controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
10 * Copyright (C) 2001, 2003 Ladislav Michl
11 */
12
13#ifndef _SGI_IOC_H
14#define _SGI_IOC_H
15
16#include <linux/types.h>
17#include <asm/sgi/pi1.h>
18
19/*
20 * All registers are 8-bit wide alligned on 32-bit boundary. Bad things
21 * happen if you try word access them. You have been warned.
22 */
23
24struct sgioc_uart_regs {
25 u8 _ctrl1[3];
26 volatile u8 ctrl1;
27 u8 _data1[3];
28 volatile u8 data1;
29 u8 _ctrl2[3];
30 volatile u8 ctrl2;
31 u8 _data2[3];
32 volatile u8 data2;
33};
34
35struct sgioc_keyb_regs {
36 u8 _data[3];
37 volatile u8 data;
38 u8 _command[3];
39 volatile u8 command;
40};
41
42struct sgint_regs {
43 u8 _istat0[3];
44 volatile u8 istat0; /* Interrupt status zero */
45#define SGINT_ISTAT0_FFULL 0x01
46#define SGINT_ISTAT0_SCSI0 0x02
47#define SGINT_ISTAT0_SCSI1 0x04
48#define SGINT_ISTAT0_ENET 0x08
49#define SGINT_ISTAT0_GFXDMA 0x10
50#define SGINT_ISTAT0_PPORT 0x20
51#define SGINT_ISTAT0_HPC2 0x40
52#define SGINT_ISTAT0_LIO2 0x80
53 u8 _imask0[3];
54 volatile u8 imask0; /* Interrupt mask zero */
55 u8 _istat1[3];
56 volatile u8 istat1; /* Interrupt status one */
57#define SGINT_ISTAT1_ISDNI 0x01
58#define SGINT_ISTAT1_PWR 0x02
59#define SGINT_ISTAT1_ISDNH 0x04
60#define SGINT_ISTAT1_LIO3 0x08
61#define SGINT_ISTAT1_HPC3 0x10
62#define SGINT_ISTAT1_AFAIL 0x20
63#define SGINT_ISTAT1_VIDEO 0x40
64#define SGINT_ISTAT1_GIO2 0x80
65 u8 _imask1[3];
66 volatile u8 imask1; /* Interrupt mask one */
67 u8 _vmeistat[3];
68 volatile u8 vmeistat; /* VME interrupt status */
69 u8 _cmeimask0[3];
70 volatile u8 cmeimask0; /* VME interrupt mask zero */
71 u8 _cmeimask1[3];
72 volatile u8 cmeimask1; /* VME interrupt mask one */
73 u8 _cmepol[3];
74 volatile u8 cmepol; /* VME polarity */
75 u8 _tclear[3];
76 volatile u8 tclear;
77 u8 _errstat[3];
78 volatile u8 errstat; /* Error status reg, reserved on INT2 */
79 u32 _unused0[2];
80 u8 _tcnt0[3];
81 volatile u8 tcnt0; /* counter 0 */
82 u8 _tcnt1[3];
83 volatile u8 tcnt1; /* counter 1 */
84 u8 _tcnt2[3];
85 volatile u8 tcnt2; /* counter 2 */
86 u8 _tcword[3];
87 volatile u8 tcword; /* control word */
88#define SGINT_TCWORD_BCD 0x01 /* Use BCD mode for counters */
89#define SGINT_TCWORD_MMASK 0x0e /* Mode bitmask. */
90#define SGINT_TCWORD_MITC 0x00 /* IRQ on terminal count (doesn't work) */
91#define SGINT_TCWORD_MOS 0x02 /* One-shot IRQ mode. */
92#define SGINT_TCWORD_MRGEN 0x04 /* Normal rate generation */
93#define SGINT_TCWORD_MSWGEN 0x06 /* Square wave generator mode */
94#define SGINT_TCWORD_MSWST 0x08 /* Software strobe */
95#define SGINT_TCWORD_MHWST 0x0a /* Hardware strobe */
96#define SGINT_TCWORD_CMASK 0x30 /* Command mask */
97#define SGINT_TCWORD_CLAT 0x00 /* Latch command */
98#define SGINT_TCWORD_CLSB 0x10 /* LSB read/write */
99#define SGINT_TCWORD_CMSB 0x20 /* MSB read/write */
100#define SGINT_TCWORD_CALL 0x30 /* Full counter read/write */
101#define SGINT_TCWORD_CNT0 0x00 /* Select counter zero */
102#define SGINT_TCWORD_CNT1 0x40 /* Select counter one */
103#define SGINT_TCWORD_CNT2 0x80 /* Select counter two */
104#define SGINT_TCWORD_CRBCK 0xc0 /* Readback command */
105};
106
107/*
108 * The timer is the good old 8254. Unlike in PCs it's clocked at exactly 1MHz
109 */
110#define SGINT_TIMER_CLOCK 1000000
111
112/*
113 * This is the constant we're using for calibrating the counter.
114 */
115#define SGINT_TCSAMP_COUNTER ((SGINT_TIMER_CLOCK / HZ) + 255)
116
117/* We need software copies of these because they are write only. */
118extern u8 sgi_ioc_reset, sgi_ioc_write;
119
120struct sgioc_regs {
121 struct pi1_regs pport;
122 u32 _unused0[2];
123 struct sgioc_uart_regs uart;
124 struct sgioc_keyb_regs kbdmouse;
125 u8 _gcsel[3];
126 volatile u8 gcsel;
127 u8 _genctrl[3];
128 volatile u8 genctrl;
129 u8 _panel[3];
130 volatile u8 panel;
131#define SGIOC_PANEL_POWERON 0x01
132#define SGIOC_PANEL_POWERINTR 0x02
133#define SGIOC_PANEL_VOLDNINTR 0x10
134#define SGIOC_PANEL_VOLDNHOLD 0x20
135#define SGIOC_PANEL_VOLUPINTR 0x40
136#define SGIOC_PANEL_VOLUPHOLD 0x80
137 u32 _unused1;
138 u8 _sysid[3];
139 volatile u8 sysid;
140#define SGIOC_SYSID_FULLHOUSE 0x01
141#define SGIOC_SYSID_BOARDREV(x) (((x) & 0x1e) >> 1)
142#define SGIOC_SYSID_CHIPREV(x) (((x) & 0xe0) >> 5)
143 u32 _unused2;
144 u8 _read[3];
145 volatile u8 read;
146 u32 _unused3;
147 u8 _dmasel[3];
148 volatile u8 dmasel;
149#define SGIOC_DMASEL_SCLK10MHZ 0x00 /* use 10MHZ serial clock */
150#define SGIOC_DMASEL_ISDNB 0x01 /* enable isdn B */
151#define SGIOC_DMASEL_ISDNA 0x02 /* enable isdn A */
152#define SGIOC_DMASEL_PPORT 0x04 /* use parallel DMA */
153#define SGIOC_DMASEL_SCLK667MHZ 0x10 /* use 6.67MHZ serial clock */
154#define SGIOC_DMASEL_SCLKEXT 0x20 /* use external serial clock */
155 u32 _unused4;
156 u8 _reset[3];
157 volatile u8 reset;
158#define SGIOC_RESET_PPORT 0x01 /* 0=parport reset, 1=nornal */
159#define SGIOC_RESET_KBDMOUSE 0x02 /* 0=kbdmouse reset, 1=normal */
160#define SGIOC_RESET_EISA 0x04 /* 0=eisa reset, 1=normal */
161#define SGIOC_RESET_ISDN 0x08 /* 0=isdn reset, 1=normal */
162#define SGIOC_RESET_LC0OFF 0x10 /* guiness: turn led off (red, else green) */
163#define SGIOC_RESET_LC1OFF 0x20 /* guiness: turn led off (green, else amber) */
164 u32 _unused5;
165 u8 _write[3];
166 volatile u8 write;
167#define SGIOC_WRITE_NTHRESH 0x01 /* use 4.5db threshhold */
168#define SGIOC_WRITE_TPSPEED 0x02 /* use 100ohm TP speed */
169#define SGIOC_WRITE_EPSEL 0x04 /* force cable mode: 1=AUI 0=TP */
170#define SGIOC_WRITE_EASEL 0x08 /* 1=autoselect 0=manual cable selection */
171#define SGIOC_WRITE_U1AMODE 0x10 /* 1=PC 0=MAC UART mode */
172#define SGIOC_WRITE_U0AMODE 0x20 /* 1=PC 0=MAC UART mode */
173#define SGIOC_WRITE_MLO 0x40 /* 1=4.75V 0=+5V */
174#define SGIOC_WRITE_MHI 0x80 /* 1=5.25V 0=+5V */
175 u32 _unused6;
176 struct sgint_regs int3;
177 u32 _unused7[16];
178 volatile u32 extio; /* FullHouse only */
179#define EXTIO_S0_IRQ_3 0x8000 /* S0: vid.vsync */
180#define EXTIO_S0_IRQ_2 0x4000 /* S0: gfx.fifofull */
181#define EXTIO_S0_IRQ_1 0x2000 /* S0: gfx.int */
182#define EXTIO_S0_RETRACE 0x1000
183#define EXTIO_SG_IRQ_3 0x0800 /* SG: vid.vsync */
184#define EXTIO_SG_IRQ_2 0x0400 /* SG: gfx.fifofull */
185#define EXTIO_SG_IRQ_1 0x0200 /* SG: gfx.int */
186#define EXTIO_SG_RETRACE 0x0100
187#define EXTIO_GIO_33MHZ 0x0080
188#define EXTIO_EISA_BUSERR 0x0040
189#define EXTIO_MC_BUSERR 0x0020
190#define EXTIO_HPC3_BUSERR 0x0010
191#define EXTIO_S0_STAT_1 0x0008
192#define EXTIO_S0_STAT_0 0x0004
193#define EXTIO_SG_STAT_1 0x0002
194#define EXTIO_SG_STAT_0 0x0001
195};
196
197extern struct sgioc_regs *sgioc;
198extern struct sgint_regs *sgint;
199
200#endif
diff --git a/include/asm-mips/sgi/ip22.h b/include/asm-mips/sgi/ip22.h
deleted file mode 100644
index c0501f91719b..000000000000
--- a/include/asm-mips/sgi/ip22.h
+++ /dev/null
@@ -1,78 +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 * ip22.h: Definitions for SGI IP22 machines
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle
10 */
11
12#ifndef _SGI_IP22_H
13#define _SGI_IP22_H
14
15/*
16 * These are the virtual IRQ numbers, we divide all IRQ's into
17 * 'spaces', the 'space' determines where and how to enable/disable
18 * that particular IRQ on an SGI machine. HPC DMA and MC DMA interrupts
19 * are not supported this way. Driver is supposed to allocate HPC/MC
20 * interrupt as shareable and then look to proper status bit (see
21 * HAL2 driver). This will prevent many complications, trust me ;-)
22 */
23
24#include <irq.h>
25#include <asm/sgi/ioc.h>
26
27#define SGINT_EISA 0 /* 16 EISA irq levels (Indigo2) */
28#define SGINT_CPU MIPS_CPU_IRQ_BASE /* MIPS CPU define 8 interrupt sources */
29#define SGINT_LOCAL0 (SGINT_CPU+8) /* 8 local0 irq levels */
30#define SGINT_LOCAL1 (SGINT_CPU+16) /* 8 local1 irq levels */
31#define SGINT_LOCAL2 (SGINT_CPU+24) /* 8 local2 vectored irq levels */
32#define SGINT_LOCAL3 (SGINT_CPU+32) /* 8 local3 vectored irq levels */
33#define SGINT_END (SGINT_CPU+40) /* End of 'spaces' */
34
35/*
36 * Individual interrupt definitions for the Indy and Indigo2
37 */
38
39#define SGI_SOFT_0_IRQ SGINT_CPU + 0
40#define SGI_SOFT_1_IRQ SGINT_CPU + 1
41#define SGI_LOCAL_0_IRQ SGINT_CPU + 2
42#define SGI_LOCAL_1_IRQ SGINT_CPU + 3
43#define SGI_8254_0_IRQ SGINT_CPU + 4
44#define SGI_8254_1_IRQ SGINT_CPU + 5
45#define SGI_BUSERR_IRQ SGINT_CPU + 6
46#define SGI_TIMER_IRQ SGINT_CPU + 7
47
48#define SGI_FIFO_IRQ SGINT_LOCAL0 + 0 /* FIFO full */
49#define SGI_GIO_0_IRQ SGI_FIFO_IRQ /* GIO-0 */
50#define SGI_WD93_0_IRQ SGINT_LOCAL0 + 1 /* 1st onboard WD93 */
51#define SGI_WD93_1_IRQ SGINT_LOCAL0 + 2 /* 2nd onboard WD93 */
52#define SGI_ENET_IRQ SGINT_LOCAL0 + 3 /* onboard ethernet */
53#define SGI_MCDMA_IRQ SGINT_LOCAL0 + 4 /* MC DMA done */
54#define SGI_PARPORT_IRQ SGINT_LOCAL0 + 5 /* Parallel port */
55#define SGI_GIO_1_IRQ SGINT_LOCAL0 + 6 /* GE / GIO-1 / 2nd-HPC */
56#define SGI_MAP_0_IRQ SGINT_LOCAL0 + 7 /* Mappable interrupt 0 */
57
58#define SGI_GPL0_IRQ SGINT_LOCAL1 + 0 /* General Purpose LOCAL1_N<0> */
59#define SGI_PANEL_IRQ SGINT_LOCAL1 + 1 /* front panel */
60#define SGI_GPL2_IRQ SGINT_LOCAL1 + 2 /* General Purpose LOCAL1_N<2> */
61#define SGI_MAP_1_IRQ SGINT_LOCAL1 + 3 /* Mappable interrupt 1 */
62#define SGI_HPCDMA_IRQ SGINT_LOCAL1 + 4 /* HPC DMA done */
63#define SGI_ACFAIL_IRQ SGINT_LOCAL1 + 5 /* AC fail */
64#define SGI_VINO_IRQ SGINT_LOCAL1 + 6 /* Indy VINO */
65#define SGI_GIO_2_IRQ SGINT_LOCAL1 + 7 /* Vert retrace / GIO-2 */
66
67/* Mapped interrupts. These interrupts may be mapped to either 0, or 1 */
68#define SGI_VERT_IRQ SGINT_LOCAL2 + 0 /* INT3: newport vertical status */
69#define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */
70#define SGI_KEYBD_IRQ SGINT_LOCAL2 + 4 /* keyboard */
71#define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */
72
73#define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE)
74
75extern unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg);
76extern unsigned short ip22_nvram_read(int reg);
77
78#endif
diff --git a/include/asm-mips/sgi/mc.h b/include/asm-mips/sgi/mc.h
deleted file mode 100644
index 1576c2394de8..000000000000
--- a/include/asm-mips/sgi/mc.h
+++ /dev/null
@@ -1,231 +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 * mc.h: Definitions for SGI Memory Controller
7 *
8 * Copyright (C) 1996 David S. Miller
9 * Copyright (C) 1999 Ralf Baechle
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12
13#ifndef _SGI_MC_H
14#define _SGI_MC_H
15
16struct sgimc_regs {
17 u32 _unused0;
18 volatile u32 cpuctrl0; /* CPU control register 0, readwrite */
19#define SGIMC_CCTRL0_REFS 0x0000000f /* REFS mask */
20#define SGIMC_CCTRL0_EREFRESH 0x00000010 /* Memory refresh enable */
21#define SGIMC_CCTRL0_EPERRGIO 0x00000020 /* GIO parity error enable */
22#define SGIMC_CCTRL0_EPERRMEM 0x00000040 /* Main mem parity error enable */
23#define SGIMC_CCTRL0_EPERRCPU 0x00000080 /* CPU bus parity error enable */
24#define SGIMC_CCTRL0_WDOG 0x00000100 /* Watchdog timer enable */
25#define SGIMC_CCTRL0_SYSINIT 0x00000200 /* System init bit */
26#define SGIMC_CCTRL0_GFXRESET 0x00000400 /* Graphics interface reset */
27#define SGIMC_CCTRL0_EISALOCK 0x00000800 /* Lock CPU from memory for EISA */
28#define SGIMC_CCTRL0_EPERRSCMD 0x00001000 /* SysCMD bus parity error enable */
29#define SGIMC_CCTRL0_IENAB 0x00002000 /* Allow interrupts from MC */
30#define SGIMC_CCTRL0_ESNOOP 0x00004000 /* Snooping I/O enable */
31#define SGIMC_CCTRL0_EPROMWR 0x00008000 /* Prom writes from cpu enable */
32#define SGIMC_CCTRL0_WRESETPMEM 0x00010000 /* Perform warm reset, preserves mem */
33#define SGIMC_CCTRL0_LENDIAN 0x00020000 /* Put MC in little-endian mode */
34#define SGIMC_CCTRL0_WRESETDMEM 0x00040000 /* Warm reset, destroys mem contents */
35#define SGIMC_CCTRL0_CMEMBADPAR 0x02000000 /* Generate bad perr from cpu to mem */
36#define SGIMC_CCTRL0_R4KNOCHKPARR 0x04000000 /* Don't chk parity on mem data reads */
37#define SGIMC_CCTRL0_GIOBTOB 0x08000000 /* Allow GIO back to back writes */
38 u32 _unused1;
39 volatile u32 cpuctrl1; /* CPU control register 1, readwrite */
40#define SGIMC_CCTRL1_EGIOTIMEO 0x00000010 /* GIO bus timeout enable */
41#define SGIMC_CCTRL1_FIXEDEHPC 0x00001000 /* Fixed HPC endianness */
42#define SGIMC_CCTRL1_LITTLEHPC 0x00002000 /* Little endian HPC */
43#define SGIMC_CCTRL1_FIXEDEEXP0 0x00004000 /* Fixed EXP0 endianness */
44#define SGIMC_CCTRL1_LITTLEEXP0 0x00008000 /* Little endian EXP0 */
45#define SGIMC_CCTRL1_FIXEDEEXP1 0x00010000 /* Fixed EXP1 endianness */
46#define SGIMC_CCTRL1_LITTLEEXP1 0x00020000 /* Little endian EXP1 */
47
48 u32 _unused2;
49 volatile u32 watchdogt; /* Watchdog reg rdonly, write clears */
50
51 u32 _unused3;
52 volatile u32 systemid; /* MC system ID register, readonly */
53#define SGIMC_SYSID_MASKREV 0x0000000f /* Revision of MC controller */
54#define SGIMC_SYSID_EPRESENT 0x00000010 /* Indicates presence of EISA bus */
55
56 u32 _unused4[3];
57 volatile u32 divider; /* Divider reg for RPSS */
58
59 u32 _unused5;
60 u32 eeprom; /* EEPROM byte reg for r4k */
61#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */
62#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */
63#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */
64#define SGIMC_EEPROM_SDATAO 0x00000008 /* Serial EEPROM data-out */
65#define SGIMC_EEPROM_SDATAI 0x00000010 /* Serial EEPROM data-in */
66
67 u32 _unused6[3];
68 volatile u32 rcntpre; /* Preload refresh counter */
69
70 u32 _unused7;
71 volatile u32 rcounter; /* Readonly refresh counter */
72
73 u32 _unused8[13];
74 volatile u32 giopar; /* Parameter word for GIO64 */
75#define SGIMC_GIOPAR_HPC64 0x00000001 /* HPC talks to GIO using 64-bits */
76#define SGIMC_GIOPAR_GFX64 0x00000002 /* GFX talks to GIO using 64-bits */
77#define SGIMC_GIOPAR_EXP064 0x00000004 /* EXP(slot0) talks using 64-bits */
78#define SGIMC_GIOPAR_EXP164 0x00000008 /* EXP(slot1) talks using 64-bits */
79#define SGIMC_GIOPAR_EISA64 0x00000010 /* EISA bus talks 64-bits to GIO */
80#define SGIMC_GIOPAR_HPC264 0x00000020 /* 2nd HPX talks 64-bits to GIO */
81#define SGIMC_GIOPAR_RTIMEGFX 0x00000040 /* GFX device has realtime attr */
82#define SGIMC_GIOPAR_RTIMEEXP0 0x00000080 /* EXP(slot0) has realtime attr */
83#define SGIMC_GIOPAR_RTIMEEXP1 0x00000100 /* EXP(slot1) has realtime attr */
84#define SGIMC_GIOPAR_MASTEREISA 0x00000200 /* EISA bus can act as bus master */
85#define SGIMC_GIOPAR_ONEBUS 0x00000400 /* Exists one GIO64 pipelined bus */
86#define SGIMC_GIOPAR_MASTERGFX 0x00000800 /* GFX can act as a bus master */
87#define SGIMC_GIOPAR_MASTEREXP0 0x00001000 /* EXP(slot0) can bus master */
88#define SGIMC_GIOPAR_MASTEREXP1 0x00002000 /* EXP(slot1) can bus master */
89#define SGIMC_GIOPAR_PLINEEXP0 0x00004000 /* EXP(slot0) has pipeline attr */
90#define SGIMC_GIOPAR_PLINEEXP1 0x00008000 /* EXP(slot1) has pipeline attr */
91
92 u32 _unused9;
93 volatile u32 cputp; /* CPU bus arb time period */
94
95 u32 _unused10[3];
96 volatile u32 lbursttp; /* Time period for long bursts */
97
98 /* MC chip can drive up to 4 bank 4 SIMMs each. All SIMMs in bank must
99 * be the same size. The size encoding for supported SIMMs is bellow */
100 u32 _unused11[9];
101 volatile u32 mconfig0; /* Memory config register zero */
102 u32 _unused12;
103 volatile u32 mconfig1; /* Memory config register one */
104#define SGIMC_MCONFIG_BASEADDR 0x000000ff /* Base address of bank*/
105#define SGIMC_MCONFIG_RMASK 0x00001f00 /* Ram config bitmask */
106#define SGIMC_MCONFIG_BVALID 0x00002000 /* Bank is valid */
107#define SGIMC_MCONFIG_SBANKS 0x00004000 /* Number of subbanks */
108
109 u32 _unused13;
110 volatile u32 cmacc; /* Mem access config for CPU */
111 u32 _unused14;
112 volatile u32 gmacc; /* Mem access config for GIO */
113
114 /* This define applies to both cmacc and gmacc registers above. */
115#define SGIMC_MACC_ALIASBIG 0x20000000 /* 512MB home for alias */
116
117 /* Error address/status regs from GIO and CPU perspectives. */
118 u32 _unused15;
119 volatile u32 cerr; /* Error address reg for CPU */
120 u32 _unused16;
121 volatile u32 cstat; /* Status reg for CPU */
122#define SGIMC_CSTAT_RD 0x00000100 /* read parity error */
123#define SGIMC_CSTAT_PAR 0x00000200 /* CPU parity error */
124#define SGIMC_CSTAT_ADDR 0x00000400 /* memory bus error bad addr */
125#define SGIMC_CSTAT_SYSAD_PAR 0x00000800 /* sysad parity error */
126#define SGIMC_CSTAT_SYSCMD_PAR 0x00001000 /* syscmd parity error */
127#define SGIMC_CSTAT_BAD_DATA 0x00002000 /* bad data identifier */
128#define SGIMC_CSTAT_PAR_MASK 0x00001f00 /* parity error mask */
129#define SGIMC_CSTAT_RD_PAR (SGIMC_CSTAT_RD | SGIMC_CSTAT_PAR)
130
131 u32 _unused17;
132 volatile u32 gerr; /* Error address reg for GIO */
133 u32 _unused18;
134 volatile u32 gstat; /* Status reg for GIO */
135#define SGIMC_GSTAT_RD 0x00000100 /* read parity error */
136#define SGIMC_GSTAT_WR 0x00000200 /* write parity error */
137#define SGIMC_GSTAT_TIME 0x00000400 /* GIO bus timed out */
138#define SGIMC_GSTAT_PROM 0x00000800 /* write to PROM when PROM_EN not set */
139#define SGIMC_GSTAT_ADDR 0x00001000 /* parity error on addr cycle */
140#define SGIMC_GSTAT_BC 0x00002000 /* parity error on byte count cycle */
141#define SGIMC_GSTAT_PIO_RD 0x00004000 /* read data parity on pio */
142#define SGIMC_GSTAT_PIO_WR 0x00008000 /* write data parity on pio */
143
144 /* Special hard bus locking registers. */
145 u32 _unused19;
146 volatile u32 syssembit; /* Uni-bit system semaphore */
147 u32 _unused20;
148 volatile u32 mlock; /* Global GIO memory access lock */
149 u32 _unused21;
150 volatile u32 elock; /* Locks EISA from GIO accesses */
151
152 /* GIO dma control registers. */
153 u32 _unused22[15];
154 volatile u32 gio_dma_trans; /* DMA mask to translation GIO addrs */
155 u32 _unused23;
156 volatile u32 gio_dma_sbits; /* DMA GIO addr substitution bits */
157 u32 _unused24;
158 volatile u32 dma_intr_cause; /* DMA IRQ cause indicator bits */
159 u32 _unused25;
160 volatile u32 dma_ctrl; /* Main DMA control reg */
161
162 /* DMA TLB entry 0 */
163 u32 _unused26[5];
164 volatile u32 dtlb_hi0;
165 u32 _unused27;
166 volatile u32 dtlb_lo0;
167
168 /* DMA TLB entry 1 */
169 u32 _unused28;
170 volatile u32 dtlb_hi1;
171 u32 _unused29;
172 volatile u32 dtlb_lo1;
173
174 /* DMA TLB entry 2 */
175 u32 _unused30;
176 volatile u32 dtlb_hi2;
177 u32 _unused31;
178 volatile u32 dtlb_lo2;
179
180 /* DMA TLB entry 3 */
181 u32 _unused32;
182 volatile u32 dtlb_hi3;
183 u32 _unused33;
184 volatile u32 dtlb_lo3;
185
186 u32 _unused34[0x0392];
187
188 u32 _unused35;
189 volatile u32 rpsscounter; /* Chirps at 100ns */
190
191 u32 _unused36[0x1000/4-2*4];
192
193 u32 _unused37;
194 volatile u32 maddronly; /* Address DMA goes at */
195 u32 _unused38;
196 volatile u32 maddrpdeflts; /* Same as above, plus set defaults */
197 u32 _unused39;
198 volatile u32 dmasz; /* DMA count */
199 u32 _unused40;
200 volatile u32 ssize; /* DMA stride size */
201 u32 _unused41;
202 volatile u32 gmaddronly; /* Set GIO DMA but don't start trans */
203 u32 _unused42;
204 volatile u32 dmaddnpgo; /* Set GIO DMA addr + start transfer */
205 u32 _unused43;
206 volatile u32 dmamode; /* DMA mode config bit settings */
207 u32 _unused44;
208 volatile u32 dmaccount; /* Zoom and byte count for DMA */
209 u32 _unused45;
210 volatile u32 dmastart; /* Pedal to the metal. */
211 u32 _unused46;
212 volatile u32 dmarunning; /* DMA op is in progress */
213 u32 _unused47;
214 volatile u32 maddrdefstart; /* Set dma addr, defaults, and kick it */
215};
216
217extern struct sgimc_regs *sgimc;
218#define SGIMC_BASE 0x1fa00000 /* physical */
219
220/* Base location of the two ram banks found in IP2[0268] machines. */
221#define SGIMC_SEG0_BADDR 0x08000000
222#define SGIMC_SEG1_BADDR 0x20000000
223
224/* Maximum size of the above banks are per machine. */
225#define SGIMC_SEG0_SIZE_ALL 0x10000000 /* 256MB */
226#define SGIMC_SEG1_SIZE_IP20_IP22 0x08000000 /* 128MB */
227#define SGIMC_SEG1_SIZE_IP26_IP28 0x20000000 /* 512MB */
228
229extern void sgimc_init(void);
230
231#endif /* _SGI_MC_H */
diff --git a/include/asm-mips/sgi/pi1.h b/include/asm-mips/sgi/pi1.h
deleted file mode 100644
index c9506915dc5c..000000000000
--- a/include/asm-mips/sgi/pi1.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * pi1.h: Definitions for SGI PI1 parallel port
3 */
4
5#ifndef _SGI_PI1_H
6#define _SGI_PI1_H
7
8struct pi1_regs {
9 u8 _data[3];
10 volatile u8 data;
11 u8 _ctrl[3];
12 volatile u8 ctrl;
13#define PI1_CTRL_STROBE_N 0x01
14#define PI1_CTRL_AFD_N 0x02
15#define PI1_CTRL_INIT_N 0x04
16#define PI1_CTRL_SLIN_N 0x08
17#define PI1_CTRL_IRQ_ENA 0x10
18#define PI1_CTRL_DIR 0x20
19#define PI1_CTRL_SEL 0x40
20 u8 _status[3];
21 volatile u8 status;
22#define PI1_STAT_DEVID 0x03 /* bits 0-1 */
23#define PI1_STAT_NOINK 0x04 /* SGI MODE only */
24#define PI1_STAT_ERROR 0x08
25#define PI1_STAT_ONLINE 0x10
26#define PI1_STAT_PE 0x20
27#define PI1_STAT_ACK 0x40
28#define PI1_STAT_BUSY 0x80
29 u8 _dmactrl[3];
30 volatile u8 dmactrl;
31#define PI1_DMACTRL_FIFO_EMPTY 0x01 /* fifo empty R/O */
32#define PI1_DMACTRL_ABORT 0x02 /* reset DMA and internal fifo W/O */
33#define PI1_DMACTRL_STDMODE 0x00 /* bits 2-3 */
34#define PI1_DMACTRL_SGIMODE 0x04 /* bits 2-3 */
35#define PI1_DMACTRL_RICOHMODE 0x08 /* bits 2-3 */
36#define PI1_DMACTRL_HPMODE 0x0c /* bits 2-3 */
37#define PI1_DMACTRL_BLKMODE 0x10 /* block mode */
38#define PI1_DMACTRL_FIFO_CLEAR 0x20 /* clear fifo W/O */
39#define PI1_DMACTRL_READ 0x40 /* read */
40#define PI1_DMACTRL_RUN 0x80 /* pedal to the metal */
41 u8 _intstat[3];
42 volatile u8 intstat;
43#define PI1_INTSTAT_ACK 0x04
44#define PI1_INTSTAT_FEMPTY 0x08
45#define PI1_INTSTAT_NOINK 0x10
46#define PI1_INTSTAT_ONLINE 0x20
47#define PI1_INTSTAT_ERR 0x40
48#define PI1_INTSTAT_PE 0x80
49 u8 _intmask[3];
50 volatile u8 intmask; /* enabled low, reset high*/
51#define PI1_INTMASK_ACK 0x04
52#define PI1_INTMASK_FIFO_EMPTY 0x08
53#define PI1_INTMASK_NOINK 0x10
54#define PI1_INTMASK_ONLINE 0x20
55#define PI1_INTMASK_ERR 0x40
56#define PI1_INTMASK_PE 0x80
57 u8 _timer1[3];
58 volatile u8 timer1;
59#define PI1_TIME1 0x27
60 u8 _timer2[3];
61 volatile u8 timer2;
62#define PI1_TIME2 0x13
63 u8 _timer3[3];
64 volatile u8 timer3;
65#define PI1_TIME3 0x10
66 u8 _timer4[3];
67 volatile u8 timer4;
68#define PI1_TIME4 0x00
69};
70
71#endif
diff --git a/include/asm-mips/sgi/seeq.h b/include/asm-mips/sgi/seeq.h
deleted file mode 100644
index af0ffd76899d..000000000000
--- a/include/asm-mips/sgi/seeq.h
+++ /dev/null
@@ -1,21 +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) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_SGI_SEEQ_H
9#define __ASM_SGI_SEEQ_H
10
11#include <linux/if_ether.h>
12
13#include <asm/sgi/hpc3.h>
14
15struct sgiseeq_platform_data {
16 struct hpc3_regs *hpc;
17 unsigned int irq;
18 unsigned char mac[ETH_ALEN];
19};
20
21#endif /* __ASM_SGI_SEEQ_H */
diff --git a/include/asm-mips/sgi/sgi.h b/include/asm-mips/sgi/sgi.h
deleted file mode 100644
index 645cea7c0f8e..000000000000
--- a/include/asm-mips/sgi/sgi.h
+++ /dev/null
@@ -1,47 +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 * sgi.h: Definitions specific to SGI machines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@sgi.com)
9 */
10#ifndef _ASM_SGI_SGI_H
11#define _ASM_SGI_SGI_H
12
13/* UP=UniProcessor MP=MultiProcessor(capable) */
14enum sgi_mach {
15 ip4, /* R2k UP */
16 ip5, /* R2k MP */
17 ip6, /* R3k UP */
18 ip7, /* R3k MP */
19 ip9, /* R3k UP */
20 ip12, /* R3kA UP, Indigo */
21 ip15, /* R3kA MP */
22 ip17, /* R4K UP */
23 ip19, /* R4K MP */
24 ip20, /* R4K UP, Indigo */
25 ip21, /* TFP MP */
26 ip22, /* R4x00 UP, Indigo2 */
27 ip25, /* R10k MP */
28 ip26, /* TFP UP, Indigo2 */
29 ip27, /* R10k MP, R12k MP, Origin */
30 ip28, /* R10k UP, Indigo2 */
31 ip30, /* Octane */
32 ip32, /* O2 */
33};
34
35extern enum sgi_mach sgimach;
36extern void sgi_sysinit(void);
37
38/* Many I/O space registers are byte sized and are contained within
39 * one byte per word, specifically the MSB, this macro helps out.
40 */
41#ifdef __MIPSEL__
42#define SGI_MSB(regaddr) (regaddr)
43#else
44#define SGI_MSB(regaddr) ((regaddr) | 0x3)
45#endif
46
47#endif /* _ASM_SGI_SGI_H */
diff --git a/include/asm-mips/sgi/wd.h b/include/asm-mips/sgi/wd.h
deleted file mode 100644
index 0d6c3a4da891..000000000000
--- a/include/asm-mips/sgi/wd.h
+++ /dev/null
@@ -1,20 +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) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_SGI_WD_H
9#define __ASM_SGI_WD_H
10
11#include <asm/sgi/hpc3.h>
12
13struct sgiwd93_platform_data {
14 unsigned int unit;
15 unsigned int irq;
16 struct hpc3_scsiregs *hregs;
17 unsigned char *wdregs;
18};
19
20#endif /* __ASM_SGI_WD_H */
diff --git a/include/asm-mips/sgialib.h b/include/asm-mips/sgialib.h
deleted file mode 100644
index bfce5c786f1c..000000000000
--- a/include/asm-mips/sgialib.h
+++ /dev/null
@@ -1,124 +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 * SGI ARCS firmware interface library for the Linux kernel.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 2001, 2002 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SGIALIB_H
12#define _ASM_SGIALIB_H
13
14#include <asm/sgiarcs.h>
15
16extern struct linux_romvec *romvec;
17extern int prom_argc;
18
19extern LONG *_prom_argv, *_prom_envp;
20
21/* A 32-bit ARC PROM pass arguments and environment as 32-bit pointer.
22 These macros take care of sign extension. */
23#define prom_argv(index) ((char *) (long) _prom_argv[(index)])
24#define prom_argc(index) ((char *) (long) _prom_argc[(index)])
25
26extern int prom_flags;
27
28#define PROM_FLAG_ARCS 1
29#define PROM_FLAG_USE_AS_CONSOLE 2
30#define PROM_FLAG_DONT_FREE_TEMP 4
31
32/* Simple char-by-char console I/O. */
33extern void prom_putchar(char c);
34extern char prom_getchar(void);
35
36/* Memory descriptor management. */
37#define PROM_MAX_PMEMBLOCKS 32
38struct prom_pmemblock {
39 LONG base; /* Within KSEG0 or XKPHYS. */
40 ULONG size; /* In bytes. */
41 ULONG type; /* free or prom memory */
42};
43
44/* Get next memory descriptor after CURR, returns first descriptor
45 * in chain is CURR is NULL.
46 */
47extern struct linux_mdesc *prom_getmdesc(struct linux_mdesc *curr);
48#define PROM_NULL_MDESC ((struct linux_mdesc *) 0)
49
50/* Called by prom_init to setup the physical memory pmemblock
51 * array.
52 */
53extern void prom_meminit(void);
54extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
55
56/* PROM device tree library routines. */
57#define PROM_NULL_COMPONENT ((pcomponent *) 0)
58
59/* Get sibling component of THIS. */
60extern pcomponent *ArcGetPeer(pcomponent *this);
61
62/* Get child component of THIS. */
63extern pcomponent *ArcGetChild(pcomponent *this);
64
65/* Get parent component of CHILD. */
66extern pcomponent *prom_getparent(pcomponent *child);
67
68/* Copy component opaque data of component THIS into BUFFER
69 * if component THIS has opaque data. Returns success or
70 * failure status.
71 */
72extern long prom_getcdata(void *buffer, pcomponent *this);
73
74/* Other misc. component routines. */
75extern pcomponent *prom_childadd(pcomponent *this, pcomponent *tmp, void *data);
76extern long prom_delcomponent(pcomponent *this);
77extern pcomponent *prom_componentbypath(char *path);
78
79/* This is called at prom_init time to identify the
80 * ARC architecture we are running on
81 */
82extern void prom_identify_arch(void);
83
84/* Environment variable routines. */
85extern PCHAR ArcGetEnvironmentVariable(PCHAR name);
86extern LONG ArcSetEnvironmentVariable(PCHAR name, PCHAR value);
87
88/* ARCS command line acquisition and parsing. */
89extern char *prom_getcmdline(void);
90extern void prom_init_cmdline(void);
91
92/* Acquiring info about the current time, etc. */
93extern struct linux_tinfo *prom_gettinfo(void);
94extern unsigned long prom_getrtime(void);
95
96/* File operations. */
97extern long prom_getvdirent(unsigned long fd, struct linux_vdirent *ent, unsigned long num, unsigned long *cnt);
98extern long prom_open(char *name, enum linux_omode md, unsigned long *fd);
99extern long prom_close(unsigned long fd);
100extern LONG ArcRead(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
101extern long prom_getrstatus(unsigned long fd);
102extern LONG ArcWrite(ULONG fd, PVOID buf, ULONG num, PULONG cnt);
103extern long prom_seek(unsigned long fd, struct linux_bigint *off, enum linux_seekmode sm);
104extern long prom_mount(char *name, enum linux_mountops op);
105extern long prom_getfinfo(unsigned long fd, struct linux_finfo *buf);
106extern long prom_setfinfo(unsigned long fd, unsigned long flags, unsigned long msk);
107
108/* Running stand-along programs. */
109extern long prom_load(char *name, unsigned long end, unsigned long *pc, unsigned long *eaddr);
110extern long prom_invoke(unsigned long pc, unsigned long sp, long argc, char **argv, char **envp);
111extern long prom_exec(char *name, long argc, char **argv, char **envp);
112
113/* Misc. routines. */
114extern VOID prom_halt(VOID) __attribute__((noreturn));
115extern VOID prom_powerdown(VOID) __attribute__((noreturn));
116extern VOID prom_restart(VOID) __attribute__((noreturn));
117extern VOID ArcReboot(VOID) __attribute__((noreturn));
118extern VOID ArcEnterInteractiveMode(VOID) __attribute__((noreturn));
119extern long prom_cfgsave(VOID);
120extern struct linux_sysid *prom_getsysid(VOID);
121extern VOID ArcFlushAllCaches(VOID);
122extern DISPLAY_STATUS *ArcGetDisplayStatus(ULONG FileID);
123
124#endif /* _ASM_SGIALIB_H */
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
deleted file mode 100644
index 721327f88601..000000000000
--- a/include/asm-mips/sgiarcs.h
+++ /dev/null
@@ -1,548 +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 * ARC firmware interface defines.
7 *
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1999, 2001 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
11 */
12#ifndef _ASM_SGIARCS_H
13#define _ASM_SGIARCS_H
14
15#include <asm/types.h>
16#include <asm/fw/arc/types.h>
17
18/* Various ARCS error codes. */
19#define PROM_ESUCCESS 0x00
20#define PROM_E2BIG 0x01
21#define PROM_EACCESS 0x02
22#define PROM_EAGAIN 0x03
23#define PROM_EBADF 0x04
24#define PROM_EBUSY 0x05
25#define PROM_EFAULT 0x06
26#define PROM_EINVAL 0x07
27#define PROM_EIO 0x08
28#define PROM_EISDIR 0x09
29#define PROM_EMFILE 0x0a
30#define PROM_EMLINK 0x0b
31#define PROM_ENAMETOOLONG 0x0c
32#define PROM_ENODEV 0x0d
33#define PROM_ENOENT 0x0e
34#define PROM_ENOEXEC 0x0f
35#define PROM_ENOMEM 0x10
36#define PROM_ENOSPC 0x11
37#define PROM_ENOTDIR 0x12
38#define PROM_ENOTTY 0x13
39#define PROM_ENXIO 0x14
40#define PROM_EROFS 0x15
41/* SGI ARCS specific errno's. */
42#define PROM_EADDRNOTAVAIL 0x1f
43#define PROM_ETIMEDOUT 0x20
44#define PROM_ECONNABORTED 0x21
45#define PROM_ENOCONNECT 0x22
46
47/* Device classes, types, and identifiers for prom
48 * device inventory queries.
49 */
50enum linux_devclass {
51 system, processor, cache, adapter, controller, peripheral, memory
52};
53
54enum linux_devtypes {
55 /* Generic stuff. */
56 Arc, Cpu, Fpu,
57
58 /* Primary insn and data caches. */
59 picache, pdcache,
60
61 /* Secondary insn, data, and combined caches. */
62 sicache, sdcache, sccache,
63
64 memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
65 multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
66 worm_controller, serial_controller, net_controller, disp_controller,
67 parallel_controller, ptr_controller, kbd_controller, audio_controller,
68 misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
69 modem_peripheral, monitor_peripheral, printer_peripheral,
70 ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
71 net_peripheral, misc_peripheral, anon
72};
73
74enum linux_identifier {
75 bogus, ronly, removable, consin, consout, input, output
76};
77
78/* A prom device tree component. */
79struct linux_component {
80 enum linux_devclass class; /* node class */
81 enum linux_devtypes type; /* node type */
82 enum linux_identifier iflags; /* node flags */
83 USHORT vers; /* node version */
84 USHORT rev; /* node revision */
85 ULONG key; /* completely magic */
86 ULONG amask; /* XXX affinity mask??? */
87 ULONG cdsize; /* size of configuration data */
88 ULONG ilen; /* length of string identifier */
89 _PULONG iname; /* string identifier */
90};
91typedef struct linux_component pcomponent;
92
93struct linux_sysid {
94 char vend[8], prod[8];
95};
96
97/* ARCS prom memory descriptors. */
98enum arcs_memtypes {
99 arcs_eblock, /* exception block */
100 arcs_rvpage, /* ARCS romvec page */
101 arcs_fcontig, /* Contiguous and free */
102 arcs_free, /* Generic free memory */
103 arcs_bmem, /* Borken memory, don't use */
104 arcs_prog, /* A loaded program resides here */
105 arcs_atmp, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
106 arcs_aperm, /* ARCS permanent storage... */
107};
108
109/* ARC has slightly different types than ARCS */
110enum arc_memtypes {
111 arc_eblock, /* exception block */
112 arc_rvpage, /* romvec page */
113 arc_free, /* Generic free memory */
114 arc_bmem, /* Borken memory, don't use */
115 arc_prog, /* A loaded program resides here */
116 arc_atmp, /* temporary storage area */
117 arc_aperm, /* permanent storage */
118 arc_fcontig, /* Contiguous and free */
119};
120
121union linux_memtypes {
122 enum arcs_memtypes arcs;
123 enum arc_memtypes arc;
124};
125
126struct linux_mdesc {
127 union linux_memtypes type;
128 ULONG base;
129 ULONG pages;
130};
131
132/* Time of day descriptor. */
133struct linux_tinfo {
134 unsigned short yr;
135 unsigned short mnth;
136 unsigned short day;
137 unsigned short hr;
138 unsigned short min;
139 unsigned short sec;
140 unsigned short msec;
141};
142
143/* ARCS virtual dirents. */
144struct linux_vdirent {
145 ULONG namelen;
146 unsigned char attr;
147 char fname[32]; /* XXX imperical, should be a define */
148};
149
150/* Other stuff for files. */
151enum linux_omode {
152 rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
153 wronly_ssede, rdwr_ssede, dirent, dirent_creat
154};
155
156enum linux_seekmode {
157 absolute, relative
158};
159
160enum linux_mountops {
161 media_load, media_unload
162};
163
164/* This prom has a bolixed design. */
165struct linux_bigint {
166#ifdef __MIPSEL__
167 u32 lo;
168 s32 hi;
169#else /* !(__MIPSEL__) */
170 s32 hi;
171 u32 lo;
172#endif
173};
174
175struct linux_finfo {
176 struct linux_bigint begin;
177 struct linux_bigint end;
178 struct linux_bigint cur;
179 enum linux_devtypes dtype;
180 unsigned long namelen;
181 unsigned char attr;
182 char name[32]; /* XXX imperical, should be define */
183};
184
185/* This describes the vector containing function pointers to the ARC
186 firmware functions. */
187struct linux_romvec {
188 LONG load; /* Load an executable image. */
189 LONG invoke; /* Invoke a standalong image. */
190 LONG exec; /* Load and begin execution of a
191 standalone image. */
192 LONG halt; /* Halt the machine. */
193 LONG pdown; /* Power down the machine. */
194 LONG restart; /* XXX soft reset??? */
195 LONG reboot; /* Reboot the machine. */
196 LONG imode; /* Enter PROM interactive mode. */
197 LONG _unused1; /* Was ReturnFromMain(). */
198
199 /* PROM device tree interface. */
200 LONG next_component;
201 LONG child_component;
202 LONG parent_component;
203 LONG component_data;
204 LONG child_add;
205 LONG comp_del;
206 LONG component_by_path;
207
208 /* Misc. stuff. */
209 LONG cfg_save;
210 LONG get_sysid;
211
212 /* Probing for memory. */
213 LONG get_mdesc;
214 LONG _unused2; /* was Signal() */
215
216 LONG get_tinfo;
217 LONG get_rtime;
218
219 /* File type operations. */
220 LONG get_vdirent;
221 LONG open;
222 LONG close;
223 LONG read;
224 LONG get_rstatus;
225 LONG write;
226 LONG seek;
227 LONG mount;
228
229 /* Dealing with firmware environment variables. */
230 LONG get_evar;
231 LONG set_evar;
232
233 LONG get_finfo;
234 LONG set_finfo;
235
236 /* Miscellaneous. */
237 LONG cache_flush;
238 LONG TestUnicodeCharacter; /* ARC; not sure if ARCS too */
239 LONG GetDisplayStatus;
240};
241
242/* The SGI ARCS parameter block is in a fixed location for standalone
243 * programs to access PROM facilities easily.
244 */
245typedef struct _SYSTEM_PARAMETER_BLOCK {
246 ULONG magic; /* magic cookie */
247#define PROMBLOCK_MAGIC 0x53435241
248
249 ULONG len; /* length of parm block */
250 USHORT ver; /* ARCS firmware version */
251 USHORT rev; /* ARCS firmware revision */
252 _PLONG rs_block; /* Restart block. */
253 _PLONG dbg_block; /* Debug block. */
254 _PLONG gevect; /* XXX General vector??? */
255 _PLONG utlbvect; /* XXX UTLB vector??? */
256 ULONG rveclen; /* Size of romvec struct. */
257 _PVOID romvec; /* Function interface. */
258 ULONG pveclen; /* Length of private vector. */
259 _PVOID pvector; /* Private vector. */
260 ULONG adap_cnt; /* Adapter count. */
261 ULONG adap_typ0; /* First adapter type. */
262 ULONG adap_vcnt0; /* Adapter 0 vector count. */
263 _PVOID adap_vector; /* Adapter 0 vector ptr. */
264 ULONG adap_typ1; /* Second adapter type. */
265 ULONG adap_vcnt1; /* Adapter 1 vector count. */
266 _PVOID adap_vector1; /* Adapter 1 vector ptr. */
267 /* More adapter vectors go here... */
268} SYSTEM_PARAMETER_BLOCK, *PSYSTEM_PARAMETER_BLOCK;
269
270#define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
271#define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
272
273/* Cache layout parameter block. */
274union linux_cache_key {
275 struct param {
276#ifdef __MIPSEL__
277 unsigned short size;
278 unsigned char lsize;
279 unsigned char bsize;
280#else /* !(__MIPSEL__) */
281 unsigned char bsize;
282 unsigned char lsize;
283 unsigned short size;
284#endif
285 } info;
286 unsigned long allinfo;
287};
288
289/* Configuration data. */
290struct linux_cdata {
291 char *name;
292 int mlen;
293 enum linux_devtypes type;
294};
295
296/* Common SGI ARCS firmware file descriptors. */
297#define SGIPROM_STDIN 0
298#define SGIPROM_STDOUT 1
299
300/* Common SGI ARCS firmware file types. */
301#define SGIPROM_ROFILE 0x01 /* read-only file */
302#define SGIPROM_HFILE 0x02 /* hidden file */
303#define SGIPROM_SFILE 0x04 /* System file */
304#define SGIPROM_AFILE 0x08 /* Archive file */
305#define SGIPROM_DFILE 0x10 /* Directory file */
306#define SGIPROM_DELFILE 0x20 /* Deleted file */
307
308/* SGI ARCS boot record information. */
309struct sgi_partition {
310 unsigned char flag;
311#define SGIPART_UNUSED 0x00
312#define SGIPART_ACTIVE 0x80
313
314 unsigned char shead, ssect, scyl; /* unused */
315 unsigned char systype; /* OS type, Irix or NT */
316 unsigned char ehead, esect, ecyl; /* unused */
317 unsigned char rsect0, rsect1, rsect2, rsect3;
318 unsigned char tsect0, tsect1, tsect2, tsect3;
319};
320
321#define SGIBBLOCK_MAGIC 0xaa55
322#define SGIBBLOCK_MAXPART 0x0004
323
324struct sgi_bootblock {
325 unsigned char _unused[446];
326 struct sgi_partition partitions[SGIBBLOCK_MAXPART];
327 unsigned short magic;
328};
329
330/* BIOS parameter block. */
331struct sgi_bparm_block {
332 unsigned short bytes_sect; /* bytes per sector */
333 unsigned char sect_clust; /* sectors per cluster */
334 unsigned short sect_resv; /* reserved sectors */
335 unsigned char nfats; /* # of allocation tables */
336 unsigned short nroot_dirents; /* # of root directory entries */
337 unsigned short sect_volume; /* sectors in volume */
338 unsigned char media_type; /* media descriptor */
339 unsigned short sect_fat; /* sectors per allocation table */
340 unsigned short sect_track; /* sectors per track */
341 unsigned short nheads; /* # of heads */
342 unsigned short nhsects; /* # of hidden sectors */
343};
344
345struct sgi_bsector {
346 unsigned char jmpinfo[3];
347 unsigned char manuf_name[8];
348 struct sgi_bparm_block info;
349};
350
351/* Debugging block used with SGI symmon symbolic debugger. */
352#define SMB_DEBUG_MAGIC 0xfeeddead
353struct linux_smonblock {
354 unsigned long magic;
355 void (*handler)(void); /* Breakpoint routine. */
356 unsigned long dtable_base; /* Base addr of dbg table. */
357 int (*printf)(const char *fmt, ...);
358 unsigned long btable_base; /* Breakpoint table. */
359 unsigned long mpflushreqs; /* SMP cache flush request list. */
360 unsigned long ntab; /* Name table. */
361 unsigned long stab; /* Symbol table. */
362 int smax; /* Max # of symbols. */
363};
364
365/*
366 * Macros for calling a 32-bit ARC implementation from 64-bit code
367 */
368
369#if defined(CONFIG_64BIT) && defined(CONFIG_ARC32)
370
371#define __arc_clobbers \
372 "$2", "$3" /* ... */, "$8", "$9", "$10", "$11", \
373 "$12", "$13", "$14", "$15", "$16", "$24", "$25", "$31"
374
375#define ARC_CALL0(dest) \
376({ long __res; \
377 long __vec = (long) romvec->dest; \
378 __asm__ __volatile__( \
379 "dsubu\t$29, 32\n\t" \
380 "jalr\t%1\n\t" \
381 "daddu\t$29, 32\n\t" \
382 "move\t%0, $2" \
383 : "=r" (__res), "=r" (__vec) \
384 : "1" (__vec) \
385 : __arc_clobbers, "$4", "$5", "$6", "$7"); \
386 (unsigned long) __res; \
387})
388
389#define ARC_CALL1(dest, a1) \
390({ long __res; \
391 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
392 long __vec = (long) romvec->dest; \
393 __asm__ __volatile__( \
394 "dsubu\t$29, 32\n\t" \
395 "jalr\t%1\n\t" \
396 "daddu\t$29, 32\n\t" \
397 "move\t%0, $2" \
398 : "=r" (__res), "=r" (__vec) \
399 : "1" (__vec), "r" (__a1) \
400 : __arc_clobbers, "$5", "$6", "$7"); \
401 (unsigned long) __res; \
402})
403
404#define ARC_CALL2(dest, a1, a2) \
405({ long __res; \
406 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
407 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
408 long __vec = (long) romvec->dest; \
409 __asm__ __volatile__( \
410 "dsubu\t$29, 32\n\t" \
411 "jalr\t%1\n\t" \
412 "daddu\t$29, 32\n\t" \
413 "move\t%0, $2" \
414 : "=r" (__res), "=r" (__vec) \
415 : "1" (__vec), "r" (__a1), "r" (__a2) \
416 : __arc_clobbers, "$6", "$7"); \
417 __res; \
418})
419
420#define ARC_CALL3(dest, a1, a2, a3) \
421({ long __res; \
422 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
423 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
424 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
425 long __vec = (long) romvec->dest; \
426 __asm__ __volatile__( \
427 "dsubu\t$29, 32\n\t" \
428 "jalr\t%1\n\t" \
429 "daddu\t$29, 32\n\t" \
430 "move\t%0, $2" \
431 : "=r" (__res), "=r" (__vec) \
432 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3) \
433 : __arc_clobbers, "$7"); \
434 __res; \
435})
436
437#define ARC_CALL4(dest, a1, a2, a3, a4) \
438({ long __res; \
439 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
440 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
441 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
442 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
443 long __vec = (long) romvec->dest; \
444 __asm__ __volatile__( \
445 "dsubu\t$29, 32\n\t" \
446 "jalr\t%1\n\t" \
447 "daddu\t$29, 32\n\t" \
448 "move\t%0, $2" \
449 : "=r" (__res), "=r" (__vec) \
450 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3), \
451 "r" (__a4) \
452 : __arc_clobbers); \
453 __res; \
454})
455
456#define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
457({ long __res; \
458 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
462 register signed int __a5 = (int) (long) (a5); \
463 long __vec = (long) romvec->dest; \
464 __asm__ __volatile__( \
465 "dsubu\t$29, 32\n\t" \
466 "sw\t%7, 16($29)\n\t" \
467 "jalr\t%1\n\t" \
468 "daddu\t$29, 32\n\t" \
469 "move\t%0, $2" \
470 : "=r" (__res), "=r" (__vec) \
471 : "1" (__vec), \
472 "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4), \
473 "r" (__a5) \
474 : __arc_clobbers); \
475 __res; \
476})
477
478#endif /* defined(CONFIG_64BIT) && defined(CONFIG_ARC32) */
479
480#if (defined(CONFIG_32BIT) && defined(CONFIG_ARC32)) || \
481 (defined(CONFIG_64BIT) && defined(CONFIG_ARC64))
482
483#define ARC_CALL0(dest) \
484({ long __res; \
485 long (*__vec)(void) = (void *) romvec->dest; \
486 \
487 __res = __vec(); \
488 __res; \
489})
490
491#define ARC_CALL1(dest, a1) \
492({ long __res; \
493 long __a1 = (long) (a1); \
494 long (*__vec)(long) = (void *) romvec->dest; \
495 \
496 __res = __vec(__a1); \
497 __res; \
498})
499
500#define ARC_CALL2(dest, a1, a2) \
501({ long __res; \
502 long __a1 = (long) (a1); \
503 long __a2 = (long) (a2); \
504 long (*__vec)(long, long) = (void *) romvec->dest; \
505 \
506 __res = __vec(__a1, __a2); \
507 __res; \
508})
509
510#define ARC_CALL3(dest, a1, a2, a3) \
511({ long __res; \
512 long __a1 = (long) (a1); \
513 long __a2 = (long) (a2); \
514 long __a3 = (long) (a3); \
515 long (*__vec)(long, long, long) = (void *) romvec->dest; \
516 \
517 __res = __vec(__a1, __a2, __a3); \
518 __res; \
519})
520
521#define ARC_CALL4(dest, a1, a2, a3, a4) \
522({ long __res; \
523 long __a1 = (long) (a1); \
524 long __a2 = (long) (a2); \
525 long __a3 = (long) (a3); \
526 long __a4 = (long) (a4); \
527 long (*__vec)(long, long, long, long) = (void *) romvec->dest; \
528 \
529 __res = __vec(__a1, __a2, __a3, __a4); \
530 __res; \
531})
532
533#define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
534({ long __res; \
535 long __a1 = (long) (a1); \
536 long __a2 = (long) (a2); \
537 long __a3 = (long) (a3); \
538 long __a4 = (long) (a4); \
539 long __a5 = (long) (a5); \
540 long (*__vec)(long, long, long, long, long); \
541 __vec = (void *) romvec->dest; \
542 \
543 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
544 __res; \
545})
546#endif /* both kernel and ARC either 32-bit or 64-bit */
547
548#endif /* _ASM_SGIARCS_H */
diff --git a/include/asm-mips/sgidefs.h b/include/asm-mips/sgidefs.h
deleted file mode 100644
index 876442fcfb32..000000000000
--- a/include/asm-mips/sgidefs.h
+++ /dev/null
@@ -1,44 +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) 1996, 1999, 2001 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef __ASM_SGIDEFS_H
11#define __ASM_SGIDEFS_H
12
13/*
14 * Using a Linux compiler for building Linux seems logic but not to
15 * everybody.
16 */
17#ifndef __linux__
18#error Use a Linux compiler or give up.
19#endif
20
21/*
22 * Definitions for the ISA levels
23 *
24 * With the introduction of MIPS32 / MIPS64 instruction sets definitions
25 * MIPS ISAs are no longer subsets of each other. Therefore comparisons
26 * on these symbols except with == may result in unexpected results and
27 * are forbidden!
28 */
29#define _MIPS_ISA_MIPS1 1
30#define _MIPS_ISA_MIPS2 2
31#define _MIPS_ISA_MIPS3 3
32#define _MIPS_ISA_MIPS4 4
33#define _MIPS_ISA_MIPS5 5
34#define _MIPS_ISA_MIPS32 6
35#define _MIPS_ISA_MIPS64 7
36
37/*
38 * Subprogram calling convention
39 */
40#define _MIPS_SIM_ABI32 1
41#define _MIPS_SIM_NABI32 2
42#define _MIPS_SIM_ABI64 3
43
44#endif /* __ASM_SGIDEFS_H */
diff --git a/include/asm-mips/shmbuf.h b/include/asm-mips/shmbuf.h
deleted file mode 100644
index f994438277bf..000000000000
--- a/include/asm-mips/shmbuf.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_SHMBUF_H
2#define _ASM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for the MIPS architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 32-bit rsp. 64-bit values
11 */
12
13struct shmid64_ds {
14 struct ipc64_perm shm_perm; /* operation perms */
15 size_t shm_segsz; /* size of segment (bytes) */
16 __kernel_time_t shm_atime; /* last attach time */
17 __kernel_time_t shm_dtime; /* last detach time */
18 __kernel_time_t shm_ctime; /* last change time */
19 __kernel_pid_t shm_cpid; /* pid of creator */
20 __kernel_pid_t shm_lpid; /* pid of last operator */
21 unsigned long shm_nattch; /* no. of current attaches */
22 unsigned long __unused1;
23 unsigned long __unused2;
24};
25
26struct shminfo64 {
27 unsigned long shmmax;
28 unsigned long shmmin;
29 unsigned long shmmni;
30 unsigned long shmseg;
31 unsigned long shmall;
32 unsigned long __unused1;
33 unsigned long __unused2;
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* _ASM_SHMBUF_H */
diff --git a/include/asm-mips/shmparam.h b/include/asm-mips/shmparam.h
deleted file mode 100644
index 09290720751c..000000000000
--- a/include/asm-mips/shmparam.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#ifndef _ASM_SHMPARAM_H
7#define _ASM_SHMPARAM_H
8
9#define __ARCH_FORCE_SHMLBA 1
10
11#define SHMLBA 0x40000 /* attach addr a multiple of this */
12
13#endif /* _ASM_SHMPARAM_H */
diff --git a/include/asm-mips/sibyte/bcm1480_int.h b/include/asm-mips/sibyte/bcm1480_int.h
deleted file mode 100644
index 6109557c14e9..000000000000
--- a/include/asm-mips/sibyte/bcm1480_int.h
+++ /dev/null
@@ -1,312 +0,0 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * Interrupt Mapper definitions File: bcm1480_int.h
5 *
6 * This module contains constants for manipulating the
7 * BCM1255/BCM1280/BCM1455/BCM1480's interrupt mapper and
8 * definitions for the interrupt sources.
9 *
10 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 ********************************************************************* */
32
33
34#ifndef _BCM1480_INT_H
35#define _BCM1480_INT_H
36
37#include "sb1250_defs.h"
38
39/* *********************************************************************
40 * Interrupt Mapper Constants
41 ********************************************************************* */
42
43/*
44 * The interrupt mapper deals with 128-bit logical registers that are
45 * implemented as pairs of 64-bit registers, with the "low" 64 bits in
46 * a register that has an address 0x1000 higher(!) than the
47 * corresponding "high" register.
48 *
49 * For appropriate registers, bit 0 of the "high" register is a
50 * cascade bit that summarizes (as a bit-OR) the 64 bits of the "low"
51 * register.
52 */
53
54/*
55 * This entire file uses _BCM1480_ in all the symbols because it is
56 * entirely BCM1480 specific.
57 */
58
59/*
60 * Interrupt sources (Table 22)
61 */
62
63#define K_BCM1480_INT_SOURCES 128
64
65#define _BCM1480_INT_HIGH(k) (k)
66#define _BCM1480_INT_LOW(k) ((k)+64)
67
68#define K_BCM1480_INT_ADDR_TRAP _BCM1480_INT_HIGH(1)
69#define K_BCM1480_INT_GPIO_0 _BCM1480_INT_HIGH(4)
70#define K_BCM1480_INT_GPIO_1 _BCM1480_INT_HIGH(5)
71#define K_BCM1480_INT_GPIO_2 _BCM1480_INT_HIGH(6)
72#define K_BCM1480_INT_GPIO_3 _BCM1480_INT_HIGH(7)
73#define K_BCM1480_INT_PCI_INTA _BCM1480_INT_HIGH(8)
74#define K_BCM1480_INT_PCI_INTB _BCM1480_INT_HIGH(9)
75#define K_BCM1480_INT_PCI_INTC _BCM1480_INT_HIGH(10)
76#define K_BCM1480_INT_PCI_INTD _BCM1480_INT_HIGH(11)
77#define K_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_HIGH(12)
78#define K_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_HIGH(13)
79#define K_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_HIGH(14)
80#define K_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_HIGH(15)
81#define K_BCM1480_INT_TIMER_0 _BCM1480_INT_HIGH(20)
82#define K_BCM1480_INT_TIMER_1 _BCM1480_INT_HIGH(21)
83#define K_BCM1480_INT_TIMER_2 _BCM1480_INT_HIGH(22)
84#define K_BCM1480_INT_TIMER_3 _BCM1480_INT_HIGH(23)
85#define K_BCM1480_INT_DM_CH_0 _BCM1480_INT_HIGH(28)
86#define K_BCM1480_INT_DM_CH_1 _BCM1480_INT_HIGH(29)
87#define K_BCM1480_INT_DM_CH_2 _BCM1480_INT_HIGH(30)
88#define K_BCM1480_INT_DM_CH_3 _BCM1480_INT_HIGH(31)
89#define K_BCM1480_INT_MAC_0 _BCM1480_INT_HIGH(36)
90#define K_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_HIGH(37)
91#define K_BCM1480_INT_MAC_1 _BCM1480_INT_HIGH(38)
92#define K_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_HIGH(39)
93#define K_BCM1480_INT_MAC_2 _BCM1480_INT_HIGH(40)
94#define K_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_HIGH(41)
95#define K_BCM1480_INT_MAC_3 _BCM1480_INT_HIGH(42)
96#define K_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_HIGH(43)
97#define K_BCM1480_INT_PMI_LOW _BCM1480_INT_HIGH(52)
98#define K_BCM1480_INT_PMI_HIGH _BCM1480_INT_HIGH(53)
99#define K_BCM1480_INT_PMO_LOW _BCM1480_INT_HIGH(54)
100#define K_BCM1480_INT_PMO_HIGH _BCM1480_INT_HIGH(55)
101#define K_BCM1480_INT_MBOX_0_0 _BCM1480_INT_HIGH(56)
102#define K_BCM1480_INT_MBOX_0_1 _BCM1480_INT_HIGH(57)
103#define K_BCM1480_INT_MBOX_0_2 _BCM1480_INT_HIGH(58)
104#define K_BCM1480_INT_MBOX_0_3 _BCM1480_INT_HIGH(59)
105#define K_BCM1480_INT_MBOX_1_0 _BCM1480_INT_HIGH(60)
106#define K_BCM1480_INT_MBOX_1_1 _BCM1480_INT_HIGH(61)
107#define K_BCM1480_INT_MBOX_1_2 _BCM1480_INT_HIGH(62)
108#define K_BCM1480_INT_MBOX_1_3 _BCM1480_INT_HIGH(63)
109
110#define K_BCM1480_INT_BAD_ECC _BCM1480_INT_LOW(1)
111#define K_BCM1480_INT_COR_ECC _BCM1480_INT_LOW(2)
112#define K_BCM1480_INT_IO_BUS _BCM1480_INT_LOW(3)
113#define K_BCM1480_INT_PERF_CNT _BCM1480_INT_LOW(4)
114#define K_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_LOW(5)
115#define K_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_LOW(6)
116#define K_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_LOW(7)
117#define K_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_LOW(8)
118#define K_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_LOW(9)
119#define K_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_LOW(10)
120#define K_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_LOW(11)
121#define K_BCM1480_INT_PCI_ERROR _BCM1480_INT_LOW(16)
122#define K_BCM1480_INT_PCI_RESET _BCM1480_INT_LOW(17)
123#define K_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_LOW(18)
124#define K_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_LOW(19)
125#define K_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_LOW(20)
126#define K_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_LOW(21)
127#define K_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_LOW(22)
128#define K_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_LOW(23)
129#define K_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_LOW(24)
130#define K_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_LOW(25)
131#define K_BCM1480_INT_LDT_SMI _BCM1480_INT_LOW(32)
132#define K_BCM1480_INT_LDT_NMI _BCM1480_INT_LOW(33)
133#define K_BCM1480_INT_LDT_INIT _BCM1480_INT_LOW(34)
134#define K_BCM1480_INT_LDT_STARTUP _BCM1480_INT_LOW(35)
135#define K_BCM1480_INT_LDT_EXT _BCM1480_INT_LOW(36)
136#define K_BCM1480_INT_SMB_0 _BCM1480_INT_LOW(40)
137#define K_BCM1480_INT_SMB_1 _BCM1480_INT_LOW(41)
138#define K_BCM1480_INT_PCMCIA _BCM1480_INT_LOW(42)
139#define K_BCM1480_INT_UART_0 _BCM1480_INT_LOW(44)
140#define K_BCM1480_INT_UART_1 _BCM1480_INT_LOW(45)
141#define K_BCM1480_INT_UART_2 _BCM1480_INT_LOW(46)
142#define K_BCM1480_INT_UART_3 _BCM1480_INT_LOW(47)
143#define K_BCM1480_INT_GPIO_4 _BCM1480_INT_LOW(52)
144#define K_BCM1480_INT_GPIO_5 _BCM1480_INT_LOW(53)
145#define K_BCM1480_INT_GPIO_6 _BCM1480_INT_LOW(54)
146#define K_BCM1480_INT_GPIO_7 _BCM1480_INT_LOW(55)
147#define K_BCM1480_INT_GPIO_8 _BCM1480_INT_LOW(56)
148#define K_BCM1480_INT_GPIO_9 _BCM1480_INT_LOW(57)
149#define K_BCM1480_INT_GPIO_10 _BCM1480_INT_LOW(58)
150#define K_BCM1480_INT_GPIO_11 _BCM1480_INT_LOW(59)
151#define K_BCM1480_INT_GPIO_12 _BCM1480_INT_LOW(60)
152#define K_BCM1480_INT_GPIO_13 _BCM1480_INT_LOW(61)
153#define K_BCM1480_INT_GPIO_14 _BCM1480_INT_LOW(62)
154#define K_BCM1480_INT_GPIO_15 _BCM1480_INT_LOW(63)
155
156/*
157 * Mask values for each interrupt
158 */
159
160#define _BCM1480_INT_MASK(w, n) _SB_MAKEMASK(w, ((n) & 0x3F))
161#define _BCM1480_INT_MASK1(n) _SB_MAKEMASK1(((n) & 0x3F))
162#define _BCM1480_INT_OFFSET(n) (((n) & 0x40) << 6)
163
164#define M_BCM1480_INT_CASCADE _BCM1480_INT_MASK1(_BCM1480_INT_HIGH(0))
165
166#define M_BCM1480_INT_ADDR_TRAP _BCM1480_INT_MASK1(K_BCM1480_INT_ADDR_TRAP)
167#define M_BCM1480_INT_GPIO_0 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_0)
168#define M_BCM1480_INT_GPIO_1 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_1)
169#define M_BCM1480_INT_GPIO_2 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_2)
170#define M_BCM1480_INT_GPIO_3 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_3)
171#define M_BCM1480_INT_PCI_INTA _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTA)
172#define M_BCM1480_INT_PCI_INTB _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTB)
173#define M_BCM1480_INT_PCI_INTC _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTC)
174#define M_BCM1480_INT_PCI_INTD _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_INTD)
175#define M_BCM1480_INT_CYCLE_CP0 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP0)
176#define M_BCM1480_INT_CYCLE_CP1 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP1)
177#define M_BCM1480_INT_CYCLE_CP2 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP2)
178#define M_BCM1480_INT_CYCLE_CP3 _BCM1480_INT_MASK1(K_BCM1480_INT_CYCLE_CP3)
179#define M_BCM1480_INT_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_0)
180#define M_BCM1480_INT_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_1)
181#define M_BCM1480_INT_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_2)
182#define M_BCM1480_INT_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_TIMER_3)
183#define M_BCM1480_INT_DM_CH_0 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_0)
184#define M_BCM1480_INT_DM_CH_1 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_1)
185#define M_BCM1480_INT_DM_CH_2 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_2)
186#define M_BCM1480_INT_DM_CH_3 _BCM1480_INT_MASK1(K_BCM1480_INT_DM_CH_3)
187#define M_BCM1480_INT_MAC_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0)
188#define M_BCM1480_INT_MAC_0_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_0_CH1)
189#define M_BCM1480_INT_MAC_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1)
190#define M_BCM1480_INT_MAC_1_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_1_CH1)
191#define M_BCM1480_INT_MAC_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2)
192#define M_BCM1480_INT_MAC_2_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_2_CH1)
193#define M_BCM1480_INT_MAC_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3)
194#define M_BCM1480_INT_MAC_3_CH1 _BCM1480_INT_MASK1(K_BCM1480_INT_MAC_3_CH1)
195#define M_BCM1480_INT_PMI_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_LOW)
196#define M_BCM1480_INT_PMI_HIGH _BCM1480_INT_MASK1(K_BCM1480_INT_PMI_HIGH)
197#define M_BCM1480_INT_PMO_LOW _BCM1480_INT_MASK1(K_BCM1480_INT_PMO_LOW)
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)
200#define M_BCM1480_INT_MBOX_0_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_0)
201#define M_BCM1480_INT_MBOX_0_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_1)
202#define M_BCM1480_INT_MBOX_0_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_2)
203#define M_BCM1480_INT_MBOX_0_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_0_3)
204#define M_BCM1480_INT_MBOX_1_0 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_0)
205#define M_BCM1480_INT_MBOX_1_1 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_1)
206#define M_BCM1480_INT_MBOX_1_2 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_2)
207#define M_BCM1480_INT_MBOX_1_3 _BCM1480_INT_MASK1(K_BCM1480_INT_MBOX_1_3)
208#define M_BCM1480_INT_BAD_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_BAD_ECC)
209#define M_BCM1480_INT_COR_ECC _BCM1480_INT_MASK1(K_BCM1480_INT_COR_ECC)
210#define M_BCM1480_INT_IO_BUS _BCM1480_INT_MASK1(K_BCM1480_INT_IO_BUS)
211#define M_BCM1480_INT_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_PERF_CNT)
212#define M_BCM1480_INT_SW_PERF_CNT _BCM1480_INT_MASK1(K_BCM1480_INT_SW_PERF_CNT)
213#define M_BCM1480_INT_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_TRACE_FREEZE)
214#define M_BCM1480_INT_SW_TRACE_FREEZE _BCM1480_INT_MASK1(K_BCM1480_INT_SW_TRACE_FREEZE)
215#define M_BCM1480_INT_WATCHDOG_TIMER_0 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_0)
216#define M_BCM1480_INT_WATCHDOG_TIMER_1 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_1)
217#define M_BCM1480_INT_WATCHDOG_TIMER_2 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_2)
218#define M_BCM1480_INT_WATCHDOG_TIMER_3 _BCM1480_INT_MASK1(K_BCM1480_INT_WATCHDOG_TIMER_3)
219#define M_BCM1480_INT_PCI_ERROR _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_ERROR)
220#define M_BCM1480_INT_PCI_RESET _BCM1480_INT_MASK1(K_BCM1480_INT_PCI_RESET)
221#define M_BCM1480_INT_NODE_CONTROLLER _BCM1480_INT_MASK1(K_BCM1480_INT_NODE_CONTROLLER)
222#define M_BCM1480_INT_HOST_BRIDGE _BCM1480_INT_MASK1(K_BCM1480_INT_HOST_BRIDGE)
223#define M_BCM1480_INT_PORT_0_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_FATAL)
224#define M_BCM1480_INT_PORT_0_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_0_NONFATAL)
225#define M_BCM1480_INT_PORT_1_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_FATAL)
226#define M_BCM1480_INT_PORT_1_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_1_NONFATAL)
227#define M_BCM1480_INT_PORT_2_FATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_FATAL)
228#define M_BCM1480_INT_PORT_2_NONFATAL _BCM1480_INT_MASK1(K_BCM1480_INT_PORT_2_NONFATAL)
229#define M_BCM1480_INT_LDT_SMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_SMI)
230#define M_BCM1480_INT_LDT_NMI _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_NMI)
231#define M_BCM1480_INT_LDT_INIT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_INIT)
232#define M_BCM1480_INT_LDT_STARTUP _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_STARTUP)
233#define M_BCM1480_INT_LDT_EXT _BCM1480_INT_MASK1(K_BCM1480_INT_LDT_EXT)
234#define M_BCM1480_INT_SMB_0 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_0)
235#define M_BCM1480_INT_SMB_1 _BCM1480_INT_MASK1(K_BCM1480_INT_SMB_1)
236#define M_BCM1480_INT_PCMCIA _BCM1480_INT_MASK1(K_BCM1480_INT_PCMCIA)
237#define M_BCM1480_INT_UART_0 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_0)
238#define M_BCM1480_INT_UART_1 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_1)
239#define M_BCM1480_INT_UART_2 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_2)
240#define M_BCM1480_INT_UART_3 _BCM1480_INT_MASK1(K_BCM1480_INT_UART_3)
241#define M_BCM1480_INT_GPIO_4 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_4)
242#define M_BCM1480_INT_GPIO_5 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_5)
243#define M_BCM1480_INT_GPIO_6 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_6)
244#define M_BCM1480_INT_GPIO_7 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_7)
245#define M_BCM1480_INT_GPIO_8 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_8)
246#define M_BCM1480_INT_GPIO_9 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_9)
247#define M_BCM1480_INT_GPIO_10 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_10)
248#define M_BCM1480_INT_GPIO_11 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_11)
249#define M_BCM1480_INT_GPIO_12 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_12)
250#define M_BCM1480_INT_GPIO_13 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_13)
251#define M_BCM1480_INT_GPIO_14 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_14)
252#define M_BCM1480_INT_GPIO_15 _BCM1480_INT_MASK1(K_BCM1480_INT_GPIO_15)
253
254/*
255 * Interrupt mappings (Table 18)
256 */
257
258#define K_BCM1480_INT_MAP_I0 0 /* interrupt pins on processor */
259#define K_BCM1480_INT_MAP_I1 1
260#define K_BCM1480_INT_MAP_I2 2
261#define K_BCM1480_INT_MAP_I3 3
262#define K_BCM1480_INT_MAP_I4 4
263#define K_BCM1480_INT_MAP_I5 5
264#define K_BCM1480_INT_MAP_NMI 6 /* nonmaskable */
265#define K_BCM1480_INT_MAP_DINT 7 /* debug interrupt */
266
267/*
268 * Interrupt LDT Set Register (Table 19)
269 */
270
271#define S_BCM1480_INT_HT_INTMSG 0
272#define M_BCM1480_INT_HT_INTMSG _SB_MAKEMASK(3, S_BCM1480_INT_HT_INTMSG)
273#define V_BCM1480_INT_HT_INTMSG(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTMSG)
274#define G_BCM1480_INT_HT_INTMSG(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTMSG, M_BCM1480_INT_HT_INTMSG)
275
276#define K_BCM1480_INT_HT_INTMSG_FIXED 0
277#define K_BCM1480_INT_HT_INTMSG_ARBITRATED 1
278#define K_BCM1480_INT_HT_INTMSG_SMI 2
279#define K_BCM1480_INT_HT_INTMSG_NMI 3
280#define K_BCM1480_INT_HT_INTMSG_INIT 4
281#define K_BCM1480_INT_HT_INTMSG_STARTUP 5
282#define K_BCM1480_INT_HT_INTMSG_EXTINT 6
283#define K_BCM1480_INT_HT_INTMSG_RESERVED 7
284
285#define M_BCM1480_INT_HT_TRIGGERMODE _SB_MAKEMASK1(3)
286#define V_BCM1480_INT_HT_EDGETRIGGER 0
287#define V_BCM1480_INT_HT_LEVELTRIGGER M_BCM1480_INT_HT_TRIGGERMODE
288
289#define M_BCM1480_INT_HT_DESTMODE _SB_MAKEMASK1(4)
290#define V_BCM1480_INT_HT_PHYSICALDEST 0
291#define V_BCM1480_INT_HT_LOGICALDEST M_BCM1480_INT_HT_DESTMODE
292
293#define S_BCM1480_INT_HT_INTDEST 5
294#define M_BCM1480_INT_HT_INTDEST _SB_MAKEMASK(8, S_BCM1480_INT_HT_INTDEST)
295#define V_BCM1480_INT_HT_INTDEST(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_INTDEST)
296#define G_BCM1480_INT_HT_INTDEST(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_INTDEST, M_BCM1480_INT_HT_INTDEST)
297
298#define S_BCM1480_INT_HT_VECTOR 13
299#define M_BCM1480_INT_HT_VECTOR _SB_MAKEMASK(8, S_BCM1480_INT_HT_VECTOR)
300#define V_BCM1480_INT_HT_VECTOR(x) _SB_MAKEVALUE(x, S_BCM1480_INT_HT_VECTOR)
301#define G_BCM1480_INT_HT_VECTOR(x) _SB_GETVALUE(x, S_BCM1480_INT_HT_VECTOR, M_BCM1480_INT_HT_VECTOR)
302
303/*
304 * Vector prefix (Table 4-7)
305 */
306
307#define M_BCM1480_HTVECT_RAISE_INTLDT_HIGH 0x00
308#define M_BCM1480_HTVECT_RAISE_MBOX_0 0x40
309#define M_BCM1480_HTVECT_RAISE_INTLDT_LO 0x80
310#define M_BCM1480_HTVECT_RAISE_MBOX_1 0xC0
311
312#endif /* _BCM1480_INT_H */
diff --git a/include/asm-mips/sibyte/bcm1480_l2c.h b/include/asm-mips/sibyte/bcm1480_l2c.h
deleted file mode 100644
index fd75817f7ac4..000000000000
--- a/include/asm-mips/sibyte/bcm1480_l2c.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * L2 Cache constants and macros File: bcm1480_l2c.h
5 *
6 * This module contains constants useful for manipulating the
7 * level 2 cache.
8 *
9 * BCM1400 specification level: 1280-UM100-D2 (11/14/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _BCM1480_L2C_H
34#define _BCM1480_L2C_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Format of level 2 cache management address (Table 55)
40 */
41
42#define S_BCM1480_L2C_MGMT_INDEX 5
43#define M_BCM1480_L2C_MGMT_INDEX _SB_MAKEMASK(12, S_BCM1480_L2C_MGMT_INDEX)
44#define V_BCM1480_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_INDEX)
45#define G_BCM1480_L2C_MGMT_INDEX(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_INDEX, M_BCM1480_L2C_MGMT_INDEX)
46
47#define S_BCM1480_L2C_MGMT_WAY 17
48#define M_BCM1480_L2C_MGMT_WAY _SB_MAKEMASK(3, S_BCM1480_L2C_MGMT_WAY)
49#define V_BCM1480_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_WAY)
50#define G_BCM1480_L2C_MGMT_WAY(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_WAY, M_BCM1480_L2C_MGMT_WAY)
51
52#define M_BCM1480_L2C_MGMT_DIRTY _SB_MAKEMASK1(20)
53#define M_BCM1480_L2C_MGMT_VALID _SB_MAKEMASK1(21)
54
55#define S_BCM1480_L2C_MGMT_ECC_DIAG 22
56#define M_BCM1480_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2, S_BCM1480_L2C_MGMT_ECC_DIAG)
57#define V_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_MGMT_ECC_DIAG)
58#define G_BCM1480_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x, S_BCM1480_L2C_MGMT_ECC_DIAG, M_BCM1480_L2C_MGMT_ECC_DIAG)
59
60#define A_BCM1480_L2C_MGMT_TAG_BASE 0x00D0000000
61
62#define BCM1480_L2C_ENTRIES_PER_WAY 4096
63#define BCM1480_L2C_NUM_WAYS 8
64
65
66/*
67 * Level 2 Cache Tag register (Table 59)
68 */
69
70#define S_BCM1480_L2C_TAG_MBZ 0
71#define M_BCM1480_L2C_TAG_MBZ _SB_MAKEMASK(5, S_BCM1480_L2C_TAG_MBZ)
72
73#define S_BCM1480_L2C_TAG_INDEX 5
74#define M_BCM1480_L2C_TAG_INDEX _SB_MAKEMASK(12, S_BCM1480_L2C_TAG_INDEX)
75#define V_BCM1480_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_INDEX)
76#define G_BCM1480_L2C_TAG_INDEX(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_INDEX, M_BCM1480_L2C_TAG_INDEX)
77
78/* Note that index bit 16 is also tag bit 40 */
79#define S_BCM1480_L2C_TAG_TAG 17
80#define M_BCM1480_L2C_TAG_TAG _SB_MAKEMASK(23, S_BCM1480_L2C_TAG_TAG)
81#define V_BCM1480_L2C_TAG_TAG(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_TAG)
82#define G_BCM1480_L2C_TAG_TAG(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_TAG, M_BCM1480_L2C_TAG_TAG)
83
84#define S_BCM1480_L2C_TAG_ECC 40
85#define M_BCM1480_L2C_TAG_ECC _SB_MAKEMASK(6, S_BCM1480_L2C_TAG_ECC)
86#define V_BCM1480_L2C_TAG_ECC(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_ECC)
87#define G_BCM1480_L2C_TAG_ECC(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_ECC, M_BCM1480_L2C_TAG_ECC)
88
89#define S_BCM1480_L2C_TAG_WAY 46
90#define M_BCM1480_L2C_TAG_WAY _SB_MAKEMASK(3, S_BCM1480_L2C_TAG_WAY)
91#define V_BCM1480_L2C_TAG_WAY(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_TAG_WAY)
92#define G_BCM1480_L2C_TAG_WAY(x) _SB_GETVALUE(x, S_BCM1480_L2C_TAG_WAY, M_BCM1480_L2C_TAG_WAY)
93
94#define M_BCM1480_L2C_TAG_DIRTY _SB_MAKEMASK1(49)
95#define M_BCM1480_L2C_TAG_VALID _SB_MAKEMASK1(50)
96
97#define S_BCM1480_L2C_DATA_ECC 51
98#define M_BCM1480_L2C_DATA_ECC _SB_MAKEMASK(10, S_BCM1480_L2C_DATA_ECC)
99#define V_BCM1480_L2C_DATA_ECC(x) _SB_MAKEVALUE(x, S_BCM1480_L2C_DATA_ECC)
100#define G_BCM1480_L2C_DATA_ECC(x) _SB_GETVALUE(x, S_BCM1480_L2C_DATA_ECC, M_BCM1480_L2C_DATA_ECC)
101
102
103/*
104 * L2 Misc0 Value Register (Table 60)
105 */
106
107#define S_BCM1480_L2C_MISC0_WAY_REMOTE 0
108#define M_BCM1480_L2C_MISC0_WAY_REMOTE _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_REMOTE)
109#define G_BCM1480_L2C_MISC0_WAY_REMOTE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_REMOTE, M_BCM1480_L2C_MISC0_WAY_REMOTE)
110
111#define S_BCM1480_L2C_MISC0_WAY_LOCAL 8
112#define M_BCM1480_L2C_MISC0_WAY_LOCAL _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_LOCAL)
113#define G_BCM1480_L2C_MISC0_WAY_LOCAL(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_LOCAL, M_BCM1480_L2C_MISC0_WAY_LOCAL)
114
115#define S_BCM1480_L2C_MISC0_WAY_ENABLE 16
116#define M_BCM1480_L2C_MISC0_WAY_ENABLE _SB_MAKEMASK(8, S_BCM1480_L2C_MISC0_WAY_ENABLE)
117#define G_BCM1480_L2C_MISC0_WAY_ENABLE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_WAY_ENABLE, M_BCM1480_L2C_MISC0_WAY_ENABLE)
118
119#define S_BCM1480_L2C_MISC0_CACHE_DISABLE 24
120#define M_BCM1480_L2C_MISC0_CACHE_DISABLE _SB_MAKEMASK(2, S_BCM1480_L2C_MISC0_CACHE_DISABLE)
121#define G_BCM1480_L2C_MISC0_CACHE_DISABLE(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_CACHE_DISABLE, M_BCM1480_L2C_MISC0_CACHE_DISABLE)
122
123#define S_BCM1480_L2C_MISC0_CACHE_QUAD 26
124#define M_BCM1480_L2C_MISC0_CACHE_QUAD _SB_MAKEMASK(2, S_BCM1480_L2C_MISC0_CACHE_QUAD)
125#define G_BCM1480_L2C_MISC0_CACHE_QUAD(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC0_CACHE_QUAD, M_BCM1480_L2C_MISC0_CACHE_QUAD)
126
127#define S_BCM1480_L2C_MISC0_MC_PRIORITY 30
128#define M_BCM1480_L2C_MISC0_MC_PRIORITY _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_MC_PRIORITY)
129
130#define S_BCM1480_L2C_MISC0_ECC_CLEANUP 31
131#define M_BCM1480_L2C_MISC0_ECC_CLEANUP _SB_MAKEMASK1(S_BCM1480_L2C_MISC0_ECC_CLEANUP)
132
133
134/*
135 * L2 Misc1 Value Register (Table 60)
136 */
137
138#define S_BCM1480_L2C_MISC1_WAY_AGENT_0 0
139#define M_BCM1480_L2C_MISC1_WAY_AGENT_0 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_0)
140#define G_BCM1480_L2C_MISC1_WAY_AGENT_0(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_0, M_BCM1480_L2C_MISC1_WAY_AGENT_0)
141
142#define S_BCM1480_L2C_MISC1_WAY_AGENT_1 8
143#define M_BCM1480_L2C_MISC1_WAY_AGENT_1 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_1)
144#define G_BCM1480_L2C_MISC1_WAY_AGENT_1(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_1, M_BCM1480_L2C_MISC1_WAY_AGENT_1)
145
146#define S_BCM1480_L2C_MISC1_WAY_AGENT_2 16
147#define M_BCM1480_L2C_MISC1_WAY_AGENT_2 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_2)
148#define G_BCM1480_L2C_MISC1_WAY_AGENT_2(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_2, M_BCM1480_L2C_MISC1_WAY_AGENT_2)
149
150#define S_BCM1480_L2C_MISC1_WAY_AGENT_3 24
151#define M_BCM1480_L2C_MISC1_WAY_AGENT_3 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_3)
152#define G_BCM1480_L2C_MISC1_WAY_AGENT_3(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_3, M_BCM1480_L2C_MISC1_WAY_AGENT_3)
153
154#define S_BCM1480_L2C_MISC1_WAY_AGENT_4 32
155#define M_BCM1480_L2C_MISC1_WAY_AGENT_4 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC1_WAY_AGENT_4)
156#define G_BCM1480_L2C_MISC1_WAY_AGENT_4(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC1_WAY_AGENT_4, M_BCM1480_L2C_MISC1_WAY_AGENT_4)
157
158
159/*
160 * L2 Misc2 Value Register (Table 60)
161 */
162
163#define S_BCM1480_L2C_MISC2_WAY_AGENT_8 0
164#define M_BCM1480_L2C_MISC2_WAY_AGENT_8 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_8)
165#define G_BCM1480_L2C_MISC2_WAY_AGENT_8(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_8, M_BCM1480_L2C_MISC2_WAY_AGENT_8)
166
167#define S_BCM1480_L2C_MISC2_WAY_AGENT_9 8
168#define M_BCM1480_L2C_MISC2_WAY_AGENT_9 _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_9)
169#define G_BCM1480_L2C_MISC2_WAY_AGENT_9(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_9, M_BCM1480_L2C_MISC2_WAY_AGENT_9)
170
171#define S_BCM1480_L2C_MISC2_WAY_AGENT_A 16
172#define M_BCM1480_L2C_MISC2_WAY_AGENT_A _SB_MAKEMASK(8, S_BCM1480_L2C_MISC2_WAY_AGENT_A)
173#define G_BCM1480_L2C_MISC2_WAY_AGENT_A(x) _SB_GETVALUE(x, S_BCM1480_L2C_MISC2_WAY_AGENT_A, M_BCM1480_L2C_MISC2_WAY_AGENT_A)
174
175
176#endif /* _BCM1480_L2C_H */
diff --git a/include/asm-mips/sibyte/bcm1480_mc.h b/include/asm-mips/sibyte/bcm1480_mc.h
deleted file mode 100644
index f26a41a82b59..000000000000
--- a/include/asm-mips/sibyte/bcm1480_mc.h
+++ /dev/null
@@ -1,984 +0,0 @@
1/* *********************************************************************
2 * BCM1280/BCM1480 Board Support Package
3 *
4 * Memory Controller constants File: bcm1480_mc.h
5 *
6 * This module contains constants and macros useful for
7 * programming the memory controller.
8 *
9 * BCM1400 specification level: 1280-UM100-D1 (11/14/03 Review Copy)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _BCM1480_MC_H
34#define _BCM1480_MC_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Memory Channel Configuration Register (Table 81)
40 */
41
42#define S_BCM1480_MC_INTLV0 0
43#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV0)
44#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV0)
45#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV0, M_BCM1480_MC_INTLV0)
46#define V_BCM1480_MC_INTLV0_DEFAULT V_BCM1480_MC_INTLV0(0)
47
48#define S_BCM1480_MC_INTLV1 8
49#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV1)
50#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV1)
51#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV1, M_BCM1480_MC_INTLV1)
52#define V_BCM1480_MC_INTLV1_DEFAULT V_BCM1480_MC_INTLV1(0)
53
54#define S_BCM1480_MC_INTLV2 16
55#define M_BCM1480_MC_INTLV2 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV2)
56#define V_BCM1480_MC_INTLV2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV2)
57#define G_BCM1480_MC_INTLV2(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV2, M_BCM1480_MC_INTLV2)
58#define V_BCM1480_MC_INTLV2_DEFAULT V_BCM1480_MC_INTLV2(0)
59
60#define S_BCM1480_MC_CS_MODE 32
61#define M_BCM1480_MC_CS_MODE _SB_MAKEMASK(8, S_BCM1480_MC_CS_MODE)
62#define V_BCM1480_MC_CS_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS_MODE)
63#define G_BCM1480_MC_CS_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_CS_MODE, M_BCM1480_MC_CS_MODE)
64#define V_BCM1480_MC_CS_MODE_DEFAULT V_BCM1480_MC_CS_MODE(0)
65
66#define V_BCM1480_MC_CONFIG_DEFAULT (V_BCM1480_MC_INTLV0_DEFAULT | \
67 V_BCM1480_MC_INTLV1_DEFAULT | \
68 V_BCM1480_MC_INTLV2_DEFAULT | \
69 V_BCM1480_MC_CS_MODE_DEFAULT)
70
71#define K_BCM1480_MC_CS01_MODE 0x03
72#define K_BCM1480_MC_CS02_MODE 0x05
73#define K_BCM1480_MC_CS0123_MODE 0x0F
74#define K_BCM1480_MC_CS0246_MODE 0x55
75#define K_BCM1480_MC_CS0145_MODE 0x33
76#define K_BCM1480_MC_CS0167_MODE 0xC3
77#define K_BCM1480_MC_CSFULL_MODE 0xFF
78
79/*
80 * Chip Select Start Address Register (Table 82)
81 */
82
83#define S_BCM1480_MC_CS0_START 0
84#define M_BCM1480_MC_CS0_START _SB_MAKEMASK(12, S_BCM1480_MC_CS0_START)
85#define V_BCM1480_MC_CS0_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS0_START)
86#define G_BCM1480_MC_CS0_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS0_START, M_BCM1480_MC_CS0_START)
87
88#define S_BCM1480_MC_CS1_START 16
89#define M_BCM1480_MC_CS1_START _SB_MAKEMASK(12, S_BCM1480_MC_CS1_START)
90#define V_BCM1480_MC_CS1_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS1_START)
91#define G_BCM1480_MC_CS1_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS1_START, M_BCM1480_MC_CS1_START)
92
93#define S_BCM1480_MC_CS2_START 32
94#define M_BCM1480_MC_CS2_START _SB_MAKEMASK(12, S_BCM1480_MC_CS2_START)
95#define V_BCM1480_MC_CS2_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS2_START)
96#define G_BCM1480_MC_CS2_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS2_START, M_BCM1480_MC_CS2_START)
97
98#define S_BCM1480_MC_CS3_START 48
99#define M_BCM1480_MC_CS3_START _SB_MAKEMASK(12, S_BCM1480_MC_CS3_START)
100#define V_BCM1480_MC_CS3_START(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS3_START)
101#define G_BCM1480_MC_CS3_START(x) _SB_GETVALUE(x, S_BCM1480_MC_CS3_START, M_BCM1480_MC_CS3_START)
102
103/*
104 * Chip Select End Address Register (Table 83)
105 */
106
107#define S_BCM1480_MC_CS0_END 0
108#define M_BCM1480_MC_CS0_END _SB_MAKEMASK(12, S_BCM1480_MC_CS0_END)
109#define V_BCM1480_MC_CS0_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS0_END)
110#define G_BCM1480_MC_CS0_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS0_END, M_BCM1480_MC_CS0_END)
111
112#define S_BCM1480_MC_CS1_END 16
113#define M_BCM1480_MC_CS1_END _SB_MAKEMASK(12, S_BCM1480_MC_CS1_END)
114#define V_BCM1480_MC_CS1_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS1_END)
115#define G_BCM1480_MC_CS1_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS1_END, M_BCM1480_MC_CS1_END)
116
117#define S_BCM1480_MC_CS2_END 32
118#define M_BCM1480_MC_CS2_END _SB_MAKEMASK(12, S_BCM1480_MC_CS2_END)
119#define V_BCM1480_MC_CS2_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS2_END)
120#define G_BCM1480_MC_CS2_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS2_END, M_BCM1480_MC_CS2_END)
121
122#define S_BCM1480_MC_CS3_END 48
123#define M_BCM1480_MC_CS3_END _SB_MAKEMASK(12, S_BCM1480_MC_CS3_END)
124#define V_BCM1480_MC_CS3_END(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS3_END)
125#define G_BCM1480_MC_CS3_END(x) _SB_GETVALUE(x, S_BCM1480_MC_CS3_END, M_BCM1480_MC_CS3_END)
126
127/*
128 * Row Address Bit Select Register 0 (Table 84)
129 */
130
131#define S_BCM1480_MC_ROW00 0
132#define M_BCM1480_MC_ROW00 _SB_MAKEMASK(6, S_BCM1480_MC_ROW00)
133#define V_BCM1480_MC_ROW00(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW00)
134#define G_BCM1480_MC_ROW00(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW00, M_BCM1480_MC_ROW00)
135
136#define S_BCM1480_MC_ROW01 8
137#define M_BCM1480_MC_ROW01 _SB_MAKEMASK(6, S_BCM1480_MC_ROW01)
138#define V_BCM1480_MC_ROW01(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW01)
139#define G_BCM1480_MC_ROW01(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW01, M_BCM1480_MC_ROW01)
140
141#define S_BCM1480_MC_ROW02 16
142#define M_BCM1480_MC_ROW02 _SB_MAKEMASK(6, S_BCM1480_MC_ROW02)
143#define V_BCM1480_MC_ROW02(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW02)
144#define G_BCM1480_MC_ROW02(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW02, M_BCM1480_MC_ROW02)
145
146#define S_BCM1480_MC_ROW03 24
147#define M_BCM1480_MC_ROW03 _SB_MAKEMASK(6, S_BCM1480_MC_ROW03)
148#define V_BCM1480_MC_ROW03(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW03)
149#define G_BCM1480_MC_ROW03(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW03, M_BCM1480_MC_ROW03)
150
151#define S_BCM1480_MC_ROW04 32
152#define M_BCM1480_MC_ROW04 _SB_MAKEMASK(6, S_BCM1480_MC_ROW04)
153#define V_BCM1480_MC_ROW04(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW04)
154#define G_BCM1480_MC_ROW04(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW04, M_BCM1480_MC_ROW04)
155
156#define S_BCM1480_MC_ROW05 40
157#define M_BCM1480_MC_ROW05 _SB_MAKEMASK(6, S_BCM1480_MC_ROW05)
158#define V_BCM1480_MC_ROW05(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW05)
159#define G_BCM1480_MC_ROW05(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW05, M_BCM1480_MC_ROW05)
160
161#define S_BCM1480_MC_ROW06 48
162#define M_BCM1480_MC_ROW06 _SB_MAKEMASK(6, S_BCM1480_MC_ROW06)
163#define V_BCM1480_MC_ROW06(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW06)
164#define G_BCM1480_MC_ROW06(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW06, M_BCM1480_MC_ROW06)
165
166#define S_BCM1480_MC_ROW07 56
167#define M_BCM1480_MC_ROW07 _SB_MAKEMASK(6, S_BCM1480_MC_ROW07)
168#define V_BCM1480_MC_ROW07(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW07)
169#define G_BCM1480_MC_ROW07(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW07, M_BCM1480_MC_ROW07)
170
171/*
172 * Row Address Bit Select Register 1 (Table 85)
173 */
174
175#define S_BCM1480_MC_ROW08 0
176#define M_BCM1480_MC_ROW08 _SB_MAKEMASK(6, S_BCM1480_MC_ROW08)
177#define V_BCM1480_MC_ROW08(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW08)
178#define G_BCM1480_MC_ROW08(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW08, M_BCM1480_MC_ROW08)
179
180#define S_BCM1480_MC_ROW09 8
181#define M_BCM1480_MC_ROW09 _SB_MAKEMASK(6, S_BCM1480_MC_ROW09)
182#define V_BCM1480_MC_ROW09(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW09)
183#define G_BCM1480_MC_ROW09(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW09, M_BCM1480_MC_ROW09)
184
185#define S_BCM1480_MC_ROW10 16
186#define M_BCM1480_MC_ROW10 _SB_MAKEMASK(6, S_BCM1480_MC_ROW10)
187#define V_BCM1480_MC_ROW10(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW10)
188#define G_BCM1480_MC_ROW10(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW10, M_BCM1480_MC_ROW10)
189
190#define S_BCM1480_MC_ROW11 24
191#define M_BCM1480_MC_ROW11 _SB_MAKEMASK(6, S_BCM1480_MC_ROW11)
192#define V_BCM1480_MC_ROW11(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW11)
193#define G_BCM1480_MC_ROW11(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW11, M_BCM1480_MC_ROW11)
194
195#define S_BCM1480_MC_ROW12 32
196#define M_BCM1480_MC_ROW12 _SB_MAKEMASK(6, S_BCM1480_MC_ROW12)
197#define V_BCM1480_MC_ROW12(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW12)
198#define G_BCM1480_MC_ROW12(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW12, M_BCM1480_MC_ROW12)
199
200#define S_BCM1480_MC_ROW13 40
201#define M_BCM1480_MC_ROW13 _SB_MAKEMASK(6, S_BCM1480_MC_ROW13)
202#define V_BCM1480_MC_ROW13(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW13)
203#define G_BCM1480_MC_ROW13(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW13, M_BCM1480_MC_ROW13)
204
205#define S_BCM1480_MC_ROW14 48
206#define M_BCM1480_MC_ROW14 _SB_MAKEMASK(6, S_BCM1480_MC_ROW14)
207#define V_BCM1480_MC_ROW14(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ROW14)
208#define G_BCM1480_MC_ROW14(x) _SB_GETVALUE(x, S_BCM1480_MC_ROW14, M_BCM1480_MC_ROW14)
209
210#define K_BCM1480_MC_ROWX_BIT_SPACING 8
211
212/*
213 * Column Address Bit Select Register 0 (Table 86)
214 */
215
216#define S_BCM1480_MC_COL00 0
217#define M_BCM1480_MC_COL00 _SB_MAKEMASK(6, S_BCM1480_MC_COL00)
218#define V_BCM1480_MC_COL00(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL00)
219#define G_BCM1480_MC_COL00(x) _SB_GETVALUE(x, S_BCM1480_MC_COL00, M_BCM1480_MC_COL00)
220
221#define S_BCM1480_MC_COL01 8
222#define M_BCM1480_MC_COL01 _SB_MAKEMASK(6, S_BCM1480_MC_COL01)
223#define V_BCM1480_MC_COL01(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL01)
224#define G_BCM1480_MC_COL01(x) _SB_GETVALUE(x, S_BCM1480_MC_COL01, M_BCM1480_MC_COL01)
225
226#define S_BCM1480_MC_COL02 16
227#define M_BCM1480_MC_COL02 _SB_MAKEMASK(6, S_BCM1480_MC_COL02)
228#define V_BCM1480_MC_COL02(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL02)
229#define G_BCM1480_MC_COL02(x) _SB_GETVALUE(x, S_BCM1480_MC_COL02, M_BCM1480_MC_COL02)
230
231#define S_BCM1480_MC_COL03 24
232#define M_BCM1480_MC_COL03 _SB_MAKEMASK(6, S_BCM1480_MC_COL03)
233#define V_BCM1480_MC_COL03(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL03)
234#define G_BCM1480_MC_COL03(x) _SB_GETVALUE(x, S_BCM1480_MC_COL03, M_BCM1480_MC_COL03)
235
236#define S_BCM1480_MC_COL04 32
237#define M_BCM1480_MC_COL04 _SB_MAKEMASK(6, S_BCM1480_MC_COL04)
238#define V_BCM1480_MC_COL04(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL04)
239#define G_BCM1480_MC_COL04(x) _SB_GETVALUE(x, S_BCM1480_MC_COL04, M_BCM1480_MC_COL04)
240
241#define S_BCM1480_MC_COL05 40
242#define M_BCM1480_MC_COL05 _SB_MAKEMASK(6, S_BCM1480_MC_COL05)
243#define V_BCM1480_MC_COL05(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL05)
244#define G_BCM1480_MC_COL05(x) _SB_GETVALUE(x, S_BCM1480_MC_COL05, M_BCM1480_MC_COL05)
245
246#define S_BCM1480_MC_COL06 48
247#define M_BCM1480_MC_COL06 _SB_MAKEMASK(6, S_BCM1480_MC_COL06)
248#define V_BCM1480_MC_COL06(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL06)
249#define G_BCM1480_MC_COL06(x) _SB_GETVALUE(x, S_BCM1480_MC_COL06, M_BCM1480_MC_COL06)
250
251#define S_BCM1480_MC_COL07 56
252#define M_BCM1480_MC_COL07 _SB_MAKEMASK(6, S_BCM1480_MC_COL07)
253#define V_BCM1480_MC_COL07(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL07)
254#define G_BCM1480_MC_COL07(x) _SB_GETVALUE(x, S_BCM1480_MC_COL07, M_BCM1480_MC_COL07)
255
256/*
257 * Column Address Bit Select Register 1 (Table 87)
258 */
259
260#define S_BCM1480_MC_COL08 0
261#define M_BCM1480_MC_COL08 _SB_MAKEMASK(6, S_BCM1480_MC_COL08)
262#define V_BCM1480_MC_COL08(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL08)
263#define G_BCM1480_MC_COL08(x) _SB_GETVALUE(x, S_BCM1480_MC_COL08, M_BCM1480_MC_COL08)
264
265#define S_BCM1480_MC_COL09 8
266#define M_BCM1480_MC_COL09 _SB_MAKEMASK(6, S_BCM1480_MC_COL09)
267#define V_BCM1480_MC_COL09(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL09)
268#define G_BCM1480_MC_COL09(x) _SB_GETVALUE(x, S_BCM1480_MC_COL09, M_BCM1480_MC_COL09)
269
270#define S_BCM1480_MC_COL10 16 /* not a valid position, must be prog as 0 */
271
272#define S_BCM1480_MC_COL11 24
273#define M_BCM1480_MC_COL11 _SB_MAKEMASK(6, S_BCM1480_MC_COL11)
274#define V_BCM1480_MC_COL11(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL11)
275#define G_BCM1480_MC_COL11(x) _SB_GETVALUE(x, S_BCM1480_MC_COL11, M_BCM1480_MC_COL11)
276
277#define S_BCM1480_MC_COL12 32
278#define M_BCM1480_MC_COL12 _SB_MAKEMASK(6, S_BCM1480_MC_COL12)
279#define V_BCM1480_MC_COL12(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL12)
280#define G_BCM1480_MC_COL12(x) _SB_GETVALUE(x, S_BCM1480_MC_COL12, M_BCM1480_MC_COL12)
281
282#define S_BCM1480_MC_COL13 40
283#define M_BCM1480_MC_COL13 _SB_MAKEMASK(6, S_BCM1480_MC_COL13)
284#define V_BCM1480_MC_COL13(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL13)
285#define G_BCM1480_MC_COL13(x) _SB_GETVALUE(x, S_BCM1480_MC_COL13, M_BCM1480_MC_COL13)
286
287#define S_BCM1480_MC_COL14 48
288#define M_BCM1480_MC_COL14 _SB_MAKEMASK(6, S_BCM1480_MC_COL14)
289#define V_BCM1480_MC_COL14(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COL14)
290#define G_BCM1480_MC_COL14(x) _SB_GETVALUE(x, S_BCM1480_MC_COL14, M_BCM1480_MC_COL14)
291
292#define K_BCM1480_MC_COLX_BIT_SPACING 8
293
294/*
295 * CS0 and CS1 Bank Address Bit Select Register (Table 88)
296 */
297
298#define S_BCM1480_MC_CS01_BANK0 0
299#define M_BCM1480_MC_CS01_BANK0 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK0)
300#define V_BCM1480_MC_CS01_BANK0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK0)
301#define G_BCM1480_MC_CS01_BANK0(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK0, M_BCM1480_MC_CS01_BANK0)
302
303#define S_BCM1480_MC_CS01_BANK1 8
304#define M_BCM1480_MC_CS01_BANK1 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK1)
305#define V_BCM1480_MC_CS01_BANK1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK1)
306#define G_BCM1480_MC_CS01_BANK1(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK1, M_BCM1480_MC_CS01_BANK1)
307
308#define S_BCM1480_MC_CS01_BANK2 16
309#define M_BCM1480_MC_CS01_BANK2 _SB_MAKEMASK(6, S_BCM1480_MC_CS01_BANK2)
310#define V_BCM1480_MC_CS01_BANK2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS01_BANK2)
311#define G_BCM1480_MC_CS01_BANK2(x) _SB_GETVALUE(x, S_BCM1480_MC_CS01_BANK2, M_BCM1480_MC_CS01_BANK2)
312
313/*
314 * CS2 and CS3 Bank Address Bit Select Register (Table 89)
315 */
316
317#define S_BCM1480_MC_CS23_BANK0 0
318#define M_BCM1480_MC_CS23_BANK0 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK0)
319#define V_BCM1480_MC_CS23_BANK0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK0)
320#define G_BCM1480_MC_CS23_BANK0(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK0, M_BCM1480_MC_CS23_BANK0)
321
322#define S_BCM1480_MC_CS23_BANK1 8
323#define M_BCM1480_MC_CS23_BANK1 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK1)
324#define V_BCM1480_MC_CS23_BANK1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK1)
325#define G_BCM1480_MC_CS23_BANK1(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK1, M_BCM1480_MC_CS23_BANK1)
326
327#define S_BCM1480_MC_CS23_BANK2 16
328#define M_BCM1480_MC_CS23_BANK2 _SB_MAKEMASK(6, S_BCM1480_MC_CS23_BANK2)
329#define V_BCM1480_MC_CS23_BANK2(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CS23_BANK2)
330#define G_BCM1480_MC_CS23_BANK2(x) _SB_GETVALUE(x, S_BCM1480_MC_CS23_BANK2, M_BCM1480_MC_CS23_BANK2)
331
332#define K_BCM1480_MC_CSXX_BANKX_BIT_SPACING 8
333
334/*
335 * DRAM Command Register (Table 90)
336 */
337
338#define S_BCM1480_MC_COMMAND 0
339#define M_BCM1480_MC_COMMAND _SB_MAKEMASK(4, S_BCM1480_MC_COMMAND)
340#define V_BCM1480_MC_COMMAND(x) _SB_MAKEVALUE(x, S_BCM1480_MC_COMMAND)
341#define G_BCM1480_MC_COMMAND(x) _SB_GETVALUE(x, S_BCM1480_MC_COMMAND, M_BCM1480_MC_COMMAND)
342
343#define K_BCM1480_MC_COMMAND_EMRS 0
344#define K_BCM1480_MC_COMMAND_MRS 1
345#define K_BCM1480_MC_COMMAND_PRE 2
346#define K_BCM1480_MC_COMMAND_AR 3
347#define K_BCM1480_MC_COMMAND_SETRFSH 4
348#define K_BCM1480_MC_COMMAND_CLRRFSH 5
349#define K_BCM1480_MC_COMMAND_SETPWRDN 6
350#define K_BCM1480_MC_COMMAND_CLRPWRDN 7
351
352#if SIBYTE_HDR_FEATURE(1480, PASS2)
353#define K_BCM1480_MC_COMMAND_EMRS2 8
354#define K_BCM1480_MC_COMMAND_EMRS3 9
355#define K_BCM1480_MC_COMMAND_ENABLE_MCLK 10
356#define K_BCM1480_MC_COMMAND_DISABLE_MCLK 11
357#endif
358
359#define V_BCM1480_MC_COMMAND_EMRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS)
360#define V_BCM1480_MC_COMMAND_MRS V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_MRS)
361#define V_BCM1480_MC_COMMAND_PRE V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_PRE)
362#define V_BCM1480_MC_COMMAND_AR V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_AR)
363#define V_BCM1480_MC_COMMAND_SETRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETRFSH)
364#define V_BCM1480_MC_COMMAND_CLRRFSH V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRRFSH)
365#define V_BCM1480_MC_COMMAND_SETPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_SETPWRDN)
366#define V_BCM1480_MC_COMMAND_CLRPWRDN V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_CLRPWRDN)
367
368#if SIBYTE_HDR_FEATURE(1480, PASS2)
369#define V_BCM1480_MC_COMMAND_EMRS2 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS2)
370#define V_BCM1480_MC_COMMAND_EMRS3 V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_EMRS3)
371#define V_BCM1480_MC_COMMAND_ENABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_ENABLE_MCLK)
372#define V_BCM1480_MC_COMMAND_DISABLE_MCLK V_BCM1480_MC_COMMAND(K_BCM1480_MC_COMMAND_DISABLE_MCLK)
373#endif
374
375#define S_BCM1480_MC_CS0 4
376#define M_BCM1480_MC_CS0 _SB_MAKEMASK1(4)
377#define M_BCM1480_MC_CS1 _SB_MAKEMASK1(5)
378#define M_BCM1480_MC_CS2 _SB_MAKEMASK1(6)
379#define M_BCM1480_MC_CS3 _SB_MAKEMASK1(7)
380#define M_BCM1480_MC_CS4 _SB_MAKEMASK1(8)
381#define M_BCM1480_MC_CS5 _SB_MAKEMASK1(9)
382#define M_BCM1480_MC_CS6 _SB_MAKEMASK1(10)
383#define M_BCM1480_MC_CS7 _SB_MAKEMASK1(11)
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
389#define M_BCM1480_MC_CMD_ACTIVE _SB_MAKEMASK1(16)
390
391/*
392 * DRAM Mode Register (Table 91)
393 */
394
395#define S_BCM1480_MC_EMODE 0
396#define M_BCM1480_MC_EMODE _SB_MAKEMASK(15, S_BCM1480_MC_EMODE)
397#define V_BCM1480_MC_EMODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_EMODE)
398#define G_BCM1480_MC_EMODE(x) _SB_GETVALUE(x, S_BCM1480_MC_EMODE, M_BCM1480_MC_EMODE)
399#define V_BCM1480_MC_EMODE_DEFAULT V_BCM1480_MC_EMODE(0)
400
401#define S_BCM1480_MC_MODE 16
402#define M_BCM1480_MC_MODE _SB_MAKEMASK(15, S_BCM1480_MC_MODE)
403#define V_BCM1480_MC_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_MODE)
404#define G_BCM1480_MC_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_MODE, M_BCM1480_MC_MODE)
405#define V_BCM1480_MC_MODE_DEFAULT V_BCM1480_MC_MODE(0)
406
407#define S_BCM1480_MC_DRAM_TYPE 32
408#define M_BCM1480_MC_DRAM_TYPE _SB_MAKEMASK(4, S_BCM1480_MC_DRAM_TYPE)
409#define V_BCM1480_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DRAM_TYPE)
410#define G_BCM1480_MC_DRAM_TYPE(x) _SB_GETVALUE(x, S_BCM1480_MC_DRAM_TYPE, M_BCM1480_MC_DRAM_TYPE)
411
412#define K_BCM1480_MC_DRAM_TYPE_JEDEC 0
413#define K_BCM1480_MC_DRAM_TYPE_FCRAM 1
414
415#if SIBYTE_HDR_FEATURE(1480, PASS2)
416#define K_BCM1480_MC_DRAM_TYPE_DDR2 2
417#endif
418
419#define K_BCM1480_MC_DRAM_TYPE_DDR2_PASS1 0
420
421#define V_BCM1480_MC_DRAM_TYPE_JEDEC V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_JEDEC)
422#define V_BCM1480_MC_DRAM_TYPE_FCRAM V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_FCRAM)
423
424#if SIBYTE_HDR_FEATURE(1480, PASS2)
425#define V_BCM1480_MC_DRAM_TYPE_DDR2 V_BCM1480_MC_DRAM_TYPE(K_BCM1480_MC_DRAM_TYPE_DDR2)
426#endif
427
428#define M_BCM1480_MC_GANGED _SB_MAKEMASK1(36)
429#define M_BCM1480_MC_BY9_INTF _SB_MAKEMASK1(37)
430#define M_BCM1480_MC_FORCE_ECC64 _SB_MAKEMASK1(38)
431#define M_BCM1480_MC_ECC_DISABLE _SB_MAKEMASK1(39)
432
433#define S_BCM1480_MC_PG_POLICY 40
434#define M_BCM1480_MC_PG_POLICY _SB_MAKEMASK(2, S_BCM1480_MC_PG_POLICY)
435#define V_BCM1480_MC_PG_POLICY(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PG_POLICY)
436#define G_BCM1480_MC_PG_POLICY(x) _SB_GETVALUE(x, S_BCM1480_MC_PG_POLICY, M_BCM1480_MC_PG_POLICY)
437
438#define K_BCM1480_MC_PG_POLICY_CLOSED 0
439#define K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK 1
440
441#define V_BCM1480_MC_PG_POLICY_CLOSED V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CLOSED)
442#define V_BCM1480_MC_PG_POLICY_CAS_TIME_CHK V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
443
444#if SIBYTE_HDR_FEATURE(1480, PASS2)
445#define M_BCM1480_MC_2T_CMD _SB_MAKEMASK1(42)
446#define M_BCM1480_MC_ECC_COR_DIS _SB_MAKEMASK1(43)
447#endif
448
449#define V_BCM1480_MC_DRAMMODE_DEFAULT V_BCM1480_MC_EMODE_DEFAULT | V_BCM1480_MC_MODE_DEFAULT | V_BCM1480_MC_DRAM_TYPE_JEDEC | \
450 V_BCM1480_MC_PG_POLICY(K_BCM1480_MC_PG_POLICY_CAS_TIME_CHK)
451
452/*
453 * Memory Clock Configuration Register (Table 92)
454 */
455
456#define S_BCM1480_MC_CLK_RATIO 0
457#define M_BCM1480_MC_CLK_RATIO _SB_MAKEMASK(6, S_BCM1480_MC_CLK_RATIO)
458#define V_BCM1480_MC_CLK_RATIO(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CLK_RATIO)
459#define G_BCM1480_MC_CLK_RATIO(x) _SB_GETVALUE(x, S_BCM1480_MC_CLK_RATIO, M_BCM1480_MC_CLK_RATIO)
460
461#define V_BCM1480_MC_CLK_RATIO_DEFAULT V_BCM1480_MC_CLK_RATIO(10)
462
463#define S_BCM1480_MC_REF_RATE 8
464#define M_BCM1480_MC_REF_RATE _SB_MAKEMASK(8, S_BCM1480_MC_REF_RATE)
465#define V_BCM1480_MC_REF_RATE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_REF_RATE)
466#define G_BCM1480_MC_REF_RATE(x) _SB_GETVALUE(x, S_BCM1480_MC_REF_RATE, M_BCM1480_MC_REF_RATE)
467
468#define K_BCM1480_MC_REF_RATE_100MHz 0x31
469#define K_BCM1480_MC_REF_RATE_200MHz 0x62
470#define K_BCM1480_MC_REF_RATE_400MHz 0xC4
471
472#define V_BCM1480_MC_REF_RATE_100MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_100MHz)
473#define V_BCM1480_MC_REF_RATE_200MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_200MHz)
474#define V_BCM1480_MC_REF_RATE_400MHz V_BCM1480_MC_REF_RATE(K_BCM1480_MC_REF_RATE_400MHz)
475#define V_BCM1480_MC_REF_RATE_DEFAULT V_BCM1480_MC_REF_RATE_400MHz
476
477#if SIBYTE_HDR_FEATURE(1480, PASS2)
478#define M_BCM1480_MC_AUTO_REF_DIS _SB_MAKEMASK1(16)
479#endif
480
481/*
482 * ODT Register (Table 99)
483 */
484
485#if SIBYTE_HDR_FEATURE(1480, PASS2)
486#define M_BCM1480_MC_RD_ODT0_CS0 _SB_MAKEMASK1(0)
487#define M_BCM1480_MC_RD_ODT0_CS2 _SB_MAKEMASK1(1)
488#define M_BCM1480_MC_RD_ODT0_CS4 _SB_MAKEMASK1(2)
489#define M_BCM1480_MC_RD_ODT0_CS6 _SB_MAKEMASK1(3)
490#define M_BCM1480_MC_WR_ODT0_CS0 _SB_MAKEMASK1(4)
491#define M_BCM1480_MC_WR_ODT0_CS2 _SB_MAKEMASK1(5)
492#define M_BCM1480_MC_WR_ODT0_CS4 _SB_MAKEMASK1(6)
493#define M_BCM1480_MC_WR_ODT0_CS6 _SB_MAKEMASK1(7)
494#define M_BCM1480_MC_RD_ODT2_CS0 _SB_MAKEMASK1(8)
495#define M_BCM1480_MC_RD_ODT2_CS2 _SB_MAKEMASK1(9)
496#define M_BCM1480_MC_RD_ODT2_CS4 _SB_MAKEMASK1(10)
497#define M_BCM1480_MC_RD_ODT2_CS6 _SB_MAKEMASK1(11)
498#define M_BCM1480_MC_WR_ODT2_CS0 _SB_MAKEMASK1(12)
499#define M_BCM1480_MC_WR_ODT2_CS2 _SB_MAKEMASK1(13)
500#define M_BCM1480_MC_WR_ODT2_CS4 _SB_MAKEMASK1(14)
501#define M_BCM1480_MC_WR_ODT2_CS6 _SB_MAKEMASK1(15)
502#define M_BCM1480_MC_RD_ODT4_CS0 _SB_MAKEMASK1(16)
503#define M_BCM1480_MC_RD_ODT4_CS2 _SB_MAKEMASK1(17)
504#define M_BCM1480_MC_RD_ODT4_CS4 _SB_MAKEMASK1(18)
505#define M_BCM1480_MC_RD_ODT4_CS6 _SB_MAKEMASK1(19)
506#define M_BCM1480_MC_WR_ODT4_CS0 _SB_MAKEMASK1(20)
507#define M_BCM1480_MC_WR_ODT4_CS2 _SB_MAKEMASK1(21)
508#define M_BCM1480_MC_WR_ODT4_CS4 _SB_MAKEMASK1(22)
509#define M_BCM1480_MC_WR_ODT4_CS6 _SB_MAKEMASK1(23)
510#define M_BCM1480_MC_RD_ODT6_CS0 _SB_MAKEMASK1(24)
511#define M_BCM1480_MC_RD_ODT6_CS2 _SB_MAKEMASK1(25)
512#define M_BCM1480_MC_RD_ODT6_CS4 _SB_MAKEMASK1(26)
513#define M_BCM1480_MC_RD_ODT6_CS6 _SB_MAKEMASK1(27)
514#define M_BCM1480_MC_WR_ODT6_CS0 _SB_MAKEMASK1(28)
515#define M_BCM1480_MC_WR_ODT6_CS2 _SB_MAKEMASK1(29)
516#define M_BCM1480_MC_WR_ODT6_CS4 _SB_MAKEMASK1(30)
517#define M_BCM1480_MC_WR_ODT6_CS6 _SB_MAKEMASK1(31)
518
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)
536#endif
537
538/*
539 * Memory DLL Configuration Register (Table 93)
540 */
541
542#define S_BCM1480_MC_ADDR_COARSE_ADJ 0
543#define M_BCM1480_MC_ADDR_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_ADDR_COARSE_ADJ)
544#define V_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_COARSE_ADJ)
545#define G_BCM1480_MC_ADDR_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_COARSE_ADJ, M_BCM1480_MC_ADDR_COARSE_ADJ)
546#define V_BCM1480_MC_ADDR_COARSE_ADJ_DEFAULT V_BCM1480_MC_ADDR_COARSE_ADJ(0x0)
547
548#if SIBYTE_HDR_FEATURE(1480, PASS2)
549#define S_BCM1480_MC_ADDR_FREQ_RANGE 8
550#define M_BCM1480_MC_ADDR_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_ADDR_FREQ_RANGE)
551#define V_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_FREQ_RANGE)
552#define G_BCM1480_MC_ADDR_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_FREQ_RANGE, M_BCM1480_MC_ADDR_FREQ_RANGE)
553#define V_BCM1480_MC_ADDR_FREQ_RANGE_DEFAULT V_BCM1480_MC_ADDR_FREQ_RANGE(0x4)
554#endif
555
556#define S_BCM1480_MC_ADDR_FINE_ADJ 8
557#define M_BCM1480_MC_ADDR_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_ADDR_FINE_ADJ)
558#define V_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ADDR_FINE_ADJ)
559#define G_BCM1480_MC_ADDR_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_ADDR_FINE_ADJ, M_BCM1480_MC_ADDR_FINE_ADJ)
560#define V_BCM1480_MC_ADDR_FINE_ADJ_DEFAULT V_BCM1480_MC_ADDR_FINE_ADJ(0x8)
561
562#define S_BCM1480_MC_DQI_COARSE_ADJ 16
563#define M_BCM1480_MC_DQI_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_DQI_COARSE_ADJ)
564#define V_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_COARSE_ADJ)
565#define G_BCM1480_MC_DQI_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_COARSE_ADJ, M_BCM1480_MC_DQI_COARSE_ADJ)
566#define V_BCM1480_MC_DQI_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQI_COARSE_ADJ(0x0)
567
568#if SIBYTE_HDR_FEATURE(1480, PASS2)
569#define S_BCM1480_MC_DQI_FREQ_RANGE 24
570#define M_BCM1480_MC_DQI_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DQI_FREQ_RANGE)
571#define V_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_FREQ_RANGE)
572#define G_BCM1480_MC_DQI_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_FREQ_RANGE, M_BCM1480_MC_DQI_FREQ_RANGE)
573#define V_BCM1480_MC_DQI_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQI_FREQ_RANGE(0x4)
574#endif
575
576#define S_BCM1480_MC_DQI_FINE_ADJ 24
577#define M_BCM1480_MC_DQI_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_DQI_FINE_ADJ)
578#define V_BCM1480_MC_DQI_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQI_FINE_ADJ)
579#define G_BCM1480_MC_DQI_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQI_FINE_ADJ, M_BCM1480_MC_DQI_FINE_ADJ)
580#define V_BCM1480_MC_DQI_FINE_ADJ_DEFAULT V_BCM1480_MC_DQI_FINE_ADJ(0x8)
581
582#define S_BCM1480_MC_DQO_COARSE_ADJ 32
583#define M_BCM1480_MC_DQO_COARSE_ADJ _SB_MAKEMASK(6, S_BCM1480_MC_DQO_COARSE_ADJ)
584#define V_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_COARSE_ADJ)
585#define G_BCM1480_MC_DQO_COARSE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_COARSE_ADJ, M_BCM1480_MC_DQO_COARSE_ADJ)
586#define V_BCM1480_MC_DQO_COARSE_ADJ_DEFAULT V_BCM1480_MC_DQO_COARSE_ADJ(0x0)
587
588#if SIBYTE_HDR_FEATURE(1480, PASS2)
589#define S_BCM1480_MC_DQO_FREQ_RANGE 40
590#define M_BCM1480_MC_DQO_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DQO_FREQ_RANGE)
591#define V_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_FREQ_RANGE)
592#define G_BCM1480_MC_DQO_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_FREQ_RANGE, M_BCM1480_MC_DQO_FREQ_RANGE)
593#define V_BCM1480_MC_DQO_FREQ_RANGE_DEFAULT V_BCM1480_MC_DQO_FREQ_RANGE(0x4)
594#endif
595
596#define S_BCM1480_MC_DQO_FINE_ADJ 40
597#define M_BCM1480_MC_DQO_FINE_ADJ _SB_MAKEMASK(4, S_BCM1480_MC_DQO_FINE_ADJ)
598#define V_BCM1480_MC_DQO_FINE_ADJ(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DQO_FINE_ADJ)
599#define G_BCM1480_MC_DQO_FINE_ADJ(x) _SB_GETVALUE(x, S_BCM1480_MC_DQO_FINE_ADJ, M_BCM1480_MC_DQO_FINE_ADJ)
600#define V_BCM1480_MC_DQO_FINE_ADJ_DEFAULT V_BCM1480_MC_DQO_FINE_ADJ(0x8)
601
602#if SIBYTE_HDR_FEATURE(1480, PASS2)
603#define S_BCM1480_MC_DLL_PDSEL 44
604#define M_BCM1480_MC_DLL_PDSEL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_PDSEL)
605#define V_BCM1480_MC_DLL_PDSEL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_PDSEL)
606#define G_BCM1480_MC_DLL_PDSEL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_PDSEL, M_BCM1480_MC_DLL_PDSEL)
607#define V_BCM1480_MC_DLL_DEFAULT_PDSEL V_BCM1480_MC_DLL_PDSEL(0x0)
608
609#define M_BCM1480_MC_DLL_REGBYPASS _SB_MAKEMASK1(46)
610#define M_BCM1480_MC_DQO_SHIFT _SB_MAKEMASK1(47)
611#endif
612
613#define S_BCM1480_MC_DLL_DEFAULT 48
614#define M_BCM1480_MC_DLL_DEFAULT _SB_MAKEMASK(6, S_BCM1480_MC_DLL_DEFAULT)
615#define V_BCM1480_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x, S_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)
617#define V_BCM1480_MC_DLL_DEFAULT_DEFAULT V_BCM1480_MC_DLL_DEFAULT(0x10)
618
619#if SIBYTE_HDR_FEATURE(1480, PASS2)
620#define S_BCM1480_MC_DLL_REGCTRL 54
621#define M_BCM1480_MC_DLL_REGCTRL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_REGCTRL)
622#define V_BCM1480_MC_DLL_REGCTRL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_REGCTRL)
623#define G_BCM1480_MC_DLL_REGCTRL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_REGCTRL, M_BCM1480_MC_DLL_REGCTRL)
624#define V_BCM1480_MC_DLL_DEFAULT_REGCTRL V_BCM1480_MC_DLL_REGCTRL(0x0)
625#endif
626
627#if SIBYTE_HDR_FEATURE(1480, PASS2)
628#define S_BCM1480_MC_DLL_FREQ_RANGE 56
629#define M_BCM1480_MC_DLL_FREQ_RANGE _SB_MAKEMASK(4, S_BCM1480_MC_DLL_FREQ_RANGE)
630#define V_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_FREQ_RANGE)
631#define G_BCM1480_MC_DLL_FREQ_RANGE(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_FREQ_RANGE, M_BCM1480_MC_DLL_FREQ_RANGE)
632#define V_BCM1480_MC_DLL_FREQ_RANGE_DEFAULT V_BCM1480_MC_DLL_FREQ_RANGE(0x4)
633#endif
634
635#define S_BCM1480_MC_DLL_STEP_SIZE 56
636#define M_BCM1480_MC_DLL_STEP_SIZE _SB_MAKEMASK(4, S_BCM1480_MC_DLL_STEP_SIZE)
637#define V_BCM1480_MC_DLL_STEP_SIZE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_STEP_SIZE)
638#define G_BCM1480_MC_DLL_STEP_SIZE(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_STEP_SIZE, M_BCM1480_MC_DLL_STEP_SIZE)
639#define V_BCM1480_MC_DLL_STEP_SIZE_DEFAULT V_BCM1480_MC_DLL_STEP_SIZE(0x8)
640
641#if SIBYTE_HDR_FEATURE(1480, PASS2)
642#define S_BCM1480_MC_DLL_BGCTRL 60
643#define M_BCM1480_MC_DLL_BGCTRL _SB_MAKEMASK(2, S_BCM1480_MC_DLL_BGCTRL)
644#define V_BCM1480_MC_DLL_BGCTRL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_DLL_BGCTRL)
645#define G_BCM1480_MC_DLL_BGCTRL(x) _SB_GETVALUE(x, S_BCM1480_MC_DLL_BGCTRL, M_BCM1480_MC_DLL_BGCTRL)
646#define V_BCM1480_MC_DLL_DEFAULT_BGCTRL V_BCM1480_MC_DLL_BGCTRL(0x0)
647#endif
648
649#define M_BCM1480_MC_DLL_BYPASS _SB_MAKEMASK1(63)
650
651/*
652 * Memory Drive Configuration Register (Table 94)
653 */
654
655#define S_BCM1480_MC_RTT_BYP_PULLDOWN 0
656#define M_BCM1480_MC_RTT_BYP_PULLDOWN _SB_MAKEMASK(3, S_BCM1480_MC_RTT_BYP_PULLDOWN)
657#define V_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_RTT_BYP_PULLDOWN)
658#define G_BCM1480_MC_RTT_BYP_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_RTT_BYP_PULLDOWN, M_BCM1480_MC_RTT_BYP_PULLDOWN)
659
660#define S_BCM1480_MC_RTT_BYP_PULLUP 6
661#define M_BCM1480_MC_RTT_BYP_PULLUP _SB_MAKEMASK(3, S_BCM1480_MC_RTT_BYP_PULLUP)
662#define V_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_RTT_BYP_PULLUP)
663#define G_BCM1480_MC_RTT_BYP_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_RTT_BYP_PULLUP, M_BCM1480_MC_RTT_BYP_PULLUP)
664
665#define M_BCM1480_MC_RTT_BYPASS _SB_MAKEMASK1(8)
666#define M_BCM1480_MC_RTT_COMP_MOV_AVG _SB_MAKEMASK1(9)
667
668#define S_BCM1480_MC_PVT_BYP_C1_PULLDOWN 10
669#define M_BCM1480_MC_PVT_BYP_C1_PULLDOWN _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
670#define V_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
671#define G_BCM1480_MC_PVT_BYP_C1_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLDOWN, M_BCM1480_MC_PVT_BYP_C1_PULLDOWN)
672
673#define S_BCM1480_MC_PVT_BYP_C1_PULLUP 15
674#define M_BCM1480_MC_PVT_BYP_C1_PULLUP _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C1_PULLUP)
675#define V_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLUP)
676#define G_BCM1480_MC_PVT_BYP_C1_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C1_PULLUP, M_BCM1480_MC_PVT_BYP_C1_PULLUP)
677
678#define S_BCM1480_MC_PVT_BYP_C2_PULLDOWN 20
679#define M_BCM1480_MC_PVT_BYP_C2_PULLDOWN _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
680#define V_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
681#define G_BCM1480_MC_PVT_BYP_C2_PULLDOWN(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLDOWN, M_BCM1480_MC_PVT_BYP_C2_PULLDOWN)
682
683#define S_BCM1480_MC_PVT_BYP_C2_PULLUP 25
684#define M_BCM1480_MC_PVT_BYP_C2_PULLUP _SB_MAKEMASK(4, S_BCM1480_MC_PVT_BYP_C2_PULLUP)
685#define V_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLUP)
686#define G_BCM1480_MC_PVT_BYP_C2_PULLUP(x) _SB_GETVALUE(x, S_BCM1480_MC_PVT_BYP_C2_PULLUP, M_BCM1480_MC_PVT_BYP_C2_PULLUP)
687
688#define M_BCM1480_MC_PVT_BYPASS _SB_MAKEMASK1(30)
689#define M_BCM1480_MC_PVT_COMP_MOV_AVG _SB_MAKEMASK1(31)
690
691#define M_BCM1480_MC_CLK_CLASS _SB_MAKEMASK1(34)
692#define M_BCM1480_MC_DATA_CLASS _SB_MAKEMASK1(35)
693#define M_BCM1480_MC_ADDR_CLASS _SB_MAKEMASK1(36)
694
695#define M_BCM1480_MC_DQ_ODT_75 _SB_MAKEMASK1(37)
696#define M_BCM1480_MC_DQ_ODT_150 _SB_MAKEMASK1(38)
697#define M_BCM1480_MC_DQS_ODT_75 _SB_MAKEMASK1(39)
698#define M_BCM1480_MC_DQS_ODT_150 _SB_MAKEMASK1(40)
699#define M_BCM1480_MC_DQS_DIFF _SB_MAKEMASK1(41)
700
701/*
702 * ECC Test Data Register (Table 95)
703 */
704
705#define S_BCM1480_MC_DATA_INVERT 0
706#define M_DATA_ECC_INVERT _SB_MAKEMASK(64, S_BCM1480_MC_ECC_INVERT)
707
708/*
709 * ECC Test ECC Register (Table 96)
710 */
711
712#define S_BCM1480_MC_ECC_INVERT 0
713#define M_BCM1480_MC_ECC_INVERT _SB_MAKEMASK(8, S_BCM1480_MC_ECC_INVERT)
714
715/*
716 * SDRAM Timing Register (Table 97)
717 */
718
719#define S_BCM1480_MC_tRCD 0
720#define M_BCM1480_MC_tRCD _SB_MAKEMASK(4, S_BCM1480_MC_tRCD)
721#define V_BCM1480_MC_tRCD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCD)
722#define G_BCM1480_MC_tRCD(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCD, M_BCM1480_MC_tRCD)
723#define K_BCM1480_MC_tRCD_DEFAULT 3
724#define V_BCM1480_MC_tRCD_DEFAULT V_BCM1480_MC_tRCD(K_BCM1480_MC_tRCD_DEFAULT)
725
726#define S_BCM1480_MC_tCL 4
727#define M_BCM1480_MC_tCL _SB_MAKEMASK(4, S_BCM1480_MC_tCL)
728#define V_BCM1480_MC_tCL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tCL)
729#define G_BCM1480_MC_tCL(x) _SB_GETVALUE(x, S_BCM1480_MC_tCL, M_BCM1480_MC_tCL)
730#define K_BCM1480_MC_tCL_DEFAULT 2
731#define V_BCM1480_MC_tCL_DEFAULT V_BCM1480_MC_tCL(K_BCM1480_MC_tCL_DEFAULT)
732
733#define M_BCM1480_MC_tCrDh _SB_MAKEMASK1(8)
734
735#define S_BCM1480_MC_tWR 9
736#define M_BCM1480_MC_tWR _SB_MAKEMASK(3, S_BCM1480_MC_tWR)
737#define V_BCM1480_MC_tWR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tWR)
738#define G_BCM1480_MC_tWR(x) _SB_GETVALUE(x, S_BCM1480_MC_tWR, M_BCM1480_MC_tWR)
739#define K_BCM1480_MC_tWR_DEFAULT 2
740#define V_BCM1480_MC_tWR_DEFAULT V_BCM1480_MC_tWR(K_BCM1480_MC_tWR_DEFAULT)
741
742#define S_BCM1480_MC_tCwD 12
743#define M_BCM1480_MC_tCwD _SB_MAKEMASK(4, S_BCM1480_MC_tCwD)
744#define V_BCM1480_MC_tCwD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tCwD)
745#define G_BCM1480_MC_tCwD(x) _SB_GETVALUE(x, S_BCM1480_MC_tCwD, M_BCM1480_MC_tCwD)
746#define K_BCM1480_MC_tCwD_DEFAULT 1
747#define V_BCM1480_MC_tCwD_DEFAULT V_BCM1480_MC_tCwD(K_BCM1480_MC_tCwD_DEFAULT)
748
749#define S_BCM1480_MC_tRP 16
750#define M_BCM1480_MC_tRP _SB_MAKEMASK(4, S_BCM1480_MC_tRP)
751#define V_BCM1480_MC_tRP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRP)
752#define G_BCM1480_MC_tRP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRP, M_BCM1480_MC_tRP)
753#define K_BCM1480_MC_tRP_DEFAULT 4
754#define V_BCM1480_MC_tRP_DEFAULT V_BCM1480_MC_tRP(K_BCM1480_MC_tRP_DEFAULT)
755
756#define S_BCM1480_MC_tRRD 20
757#define M_BCM1480_MC_tRRD _SB_MAKEMASK(4, S_BCM1480_MC_tRRD)
758#define V_BCM1480_MC_tRRD(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRRD)
759#define G_BCM1480_MC_tRRD(x) _SB_GETVALUE(x, S_BCM1480_MC_tRRD, M_BCM1480_MC_tRRD)
760#define K_BCM1480_MC_tRRD_DEFAULT 2
761#define V_BCM1480_MC_tRRD_DEFAULT V_BCM1480_MC_tRRD(K_BCM1480_MC_tRRD_DEFAULT)
762
763#define S_BCM1480_MC_tRCw 24
764#define M_BCM1480_MC_tRCw _SB_MAKEMASK(5, S_BCM1480_MC_tRCw)
765#define V_BCM1480_MC_tRCw(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCw)
766#define G_BCM1480_MC_tRCw(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCw, M_BCM1480_MC_tRCw)
767#define K_BCM1480_MC_tRCw_DEFAULT 10
768#define V_BCM1480_MC_tRCw_DEFAULT V_BCM1480_MC_tRCw(K_BCM1480_MC_tRCw_DEFAULT)
769
770#define S_BCM1480_MC_tRCr 32
771#define M_BCM1480_MC_tRCr _SB_MAKEMASK(5, S_BCM1480_MC_tRCr)
772#define V_BCM1480_MC_tRCr(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRCr)
773#define G_BCM1480_MC_tRCr(x) _SB_GETVALUE(x, S_BCM1480_MC_tRCr, M_BCM1480_MC_tRCr)
774#define K_BCM1480_MC_tRCr_DEFAULT 9
775#define V_BCM1480_MC_tRCr_DEFAULT V_BCM1480_MC_tRCr(K_BCM1480_MC_tRCr_DEFAULT)
776
777#if SIBYTE_HDR_FEATURE(1480, PASS2)
778#define S_BCM1480_MC_tFAW 40
779#define M_BCM1480_MC_tFAW _SB_MAKEMASK(6, S_BCM1480_MC_tFAW)
780#define V_BCM1480_MC_tFAW(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tFAW)
781#define G_BCM1480_MC_tFAW(x) _SB_GETVALUE(x, S_BCM1480_MC_tFAW, M_BCM1480_MC_tFAW)
782#define K_BCM1480_MC_tFAW_DEFAULT 0
783#define V_BCM1480_MC_tFAW_DEFAULT V_BCM1480_MC_tFAW(K_BCM1480_MC_tFAW_DEFAULT)
784#endif
785
786#define S_BCM1480_MC_tRFC 48
787#define M_BCM1480_MC_tRFC _SB_MAKEMASK(7, S_BCM1480_MC_tRFC)
788#define V_BCM1480_MC_tRFC(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRFC)
789#define G_BCM1480_MC_tRFC(x) _SB_GETVALUE(x, S_BCM1480_MC_tRFC, M_BCM1480_MC_tRFC)
790#define K_BCM1480_MC_tRFC_DEFAULT 12
791#define V_BCM1480_MC_tRFC_DEFAULT V_BCM1480_MC_tRFC(K_BCM1480_MC_tRFC_DEFAULT)
792
793#define S_BCM1480_MC_tFIFO 56
794#define M_BCM1480_MC_tFIFO _SB_MAKEMASK(2, S_BCM1480_MC_tFIFO)
795#define V_BCM1480_MC_tFIFO(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tFIFO)
796#define G_BCM1480_MC_tFIFO(x) _SB_GETVALUE(x, S_BCM1480_MC_tFIFO, M_BCM1480_MC_tFIFO)
797#define K_BCM1480_MC_tFIFO_DEFAULT 0
798#define V_BCM1480_MC_tFIFO_DEFAULT V_BCM1480_MC_tFIFO(K_BCM1480_MC_tFIFO_DEFAULT)
799
800#define S_BCM1480_MC_tW2R 58
801#define M_BCM1480_MC_tW2R _SB_MAKEMASK(2, S_BCM1480_MC_tW2R)
802#define V_BCM1480_MC_tW2R(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tW2R)
803#define G_BCM1480_MC_tW2R(x) _SB_GETVALUE(x, S_BCM1480_MC_tW2R, M_BCM1480_MC_tW2R)
804#define K_BCM1480_MC_tW2R_DEFAULT 1
805#define V_BCM1480_MC_tW2R_DEFAULT V_BCM1480_MC_tW2R(K_BCM1480_MC_tW2R_DEFAULT)
806
807#define S_BCM1480_MC_tR2W 60
808#define M_BCM1480_MC_tR2W _SB_MAKEMASK(2, S_BCM1480_MC_tR2W)
809#define V_BCM1480_MC_tR2W(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tR2W)
810#define G_BCM1480_MC_tR2W(x) _SB_GETVALUE(x, S_BCM1480_MC_tR2W, M_BCM1480_MC_tR2W)
811#define K_BCM1480_MC_tR2W_DEFAULT 0
812#define V_BCM1480_MC_tR2W_DEFAULT V_BCM1480_MC_tR2W(K_BCM1480_MC_tR2W_DEFAULT)
813
814#define M_BCM1480_MC_tR2R _SB_MAKEMASK1(62)
815
816#define V_BCM1480_MC_TIMING_DEFAULT (M_BCM1480_MC_tR2R | \
817 V_BCM1480_MC_tFIFO_DEFAULT | \
818 V_BCM1480_MC_tR2W_DEFAULT | \
819 V_BCM1480_MC_tW2R_DEFAULT | \
820 V_BCM1480_MC_tRFC_DEFAULT | \
821 V_BCM1480_MC_tRCr_DEFAULT | \
822 V_BCM1480_MC_tRCw_DEFAULT | \
823 V_BCM1480_MC_tRRD_DEFAULT | \
824 V_BCM1480_MC_tRP_DEFAULT | \
825 V_BCM1480_MC_tCwD_DEFAULT | \
826 V_BCM1480_MC_tWR_DEFAULT | \
827 M_BCM1480_MC_tCrDh | \
828 V_BCM1480_MC_tCL_DEFAULT | \
829 V_BCM1480_MC_tRCD_DEFAULT)
830
831/*
832 * SDRAM Timing Register 2
833 */
834
835#if SIBYTE_HDR_FEATURE(1480, PASS2)
836
837#define S_BCM1480_MC_tAL 0
838#define M_BCM1480_MC_tAL _SB_MAKEMASK(4, S_BCM1480_MC_tAL)
839#define V_BCM1480_MC_tAL(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tAL)
840#define G_BCM1480_MC_tAL(x) _SB_GETVALUE(x, S_BCM1480_MC_tAL, M_BCM1480_MC_tAL)
841#define K_BCM1480_MC_tAL_DEFAULT 0
842#define V_BCM1480_MC_tAL_DEFAULT V_BCM1480_MC_tAL(K_BCM1480_MC_tAL_DEFAULT)
843
844#define S_BCM1480_MC_tRTP 4
845#define M_BCM1480_MC_tRTP _SB_MAKEMASK(3, S_BCM1480_MC_tRTP)
846#define V_BCM1480_MC_tRTP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRTP)
847#define G_BCM1480_MC_tRTP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRTP, M_BCM1480_MC_tRTP)
848#define K_BCM1480_MC_tRTP_DEFAULT 2
849#define V_BCM1480_MC_tRTP_DEFAULT V_BCM1480_MC_tRTP(K_BCM1480_MC_tRTP_DEFAULT)
850
851#define S_BCM1480_MC_tW2W 8
852#define M_BCM1480_MC_tW2W _SB_MAKEMASK(2, S_BCM1480_MC_tW2W)
853#define V_BCM1480_MC_tW2W(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tW2W)
854#define G_BCM1480_MC_tW2W(x) _SB_GETVALUE(x, S_BCM1480_MC_tW2W, M_BCM1480_MC_tW2W)
855#define K_BCM1480_MC_tW2W_DEFAULT 0
856#define V_BCM1480_MC_tW2W_DEFAULT V_BCM1480_MC_tW2W(K_BCM1480_MC_tW2W_DEFAULT)
857
858#define S_BCM1480_MC_tRAP 12
859#define M_BCM1480_MC_tRAP _SB_MAKEMASK(4, S_BCM1480_MC_tRAP)
860#define V_BCM1480_MC_tRAP(x) _SB_MAKEVALUE(x, S_BCM1480_MC_tRAP)
861#define G_BCM1480_MC_tRAP(x) _SB_GETVALUE(x, S_BCM1480_MC_tRAP, M_BCM1480_MC_tRAP)
862#define K_BCM1480_MC_tRAP_DEFAULT 0
863#define V_BCM1480_MC_tRAP_DEFAULT V_BCM1480_MC_tRAP(K_BCM1480_MC_tRAP_DEFAULT)
864
865#endif
866
867
868
869/*
870 * Global Registers: single instances per BCM1480
871 */
872
873/*
874 * Global Configuration Register (Table 99)
875 */
876
877#define S_BCM1480_MC_BLK_SET_MARK 8
878#define M_BCM1480_MC_BLK_SET_MARK _SB_MAKEMASK(4, S_BCM1480_MC_BLK_SET_MARK)
879#define V_BCM1480_MC_BLK_SET_MARK(x) _SB_MAKEVALUE(x, S_BCM1480_MC_BLK_SET_MARK)
880#define G_BCM1480_MC_BLK_SET_MARK(x) _SB_GETVALUE(x, S_BCM1480_MC_BLK_SET_MARK, M_BCM1480_MC_BLK_SET_MARK)
881
882#define S_BCM1480_MC_BLK_CLR_MARK 12
883#define M_BCM1480_MC_BLK_CLR_MARK _SB_MAKEMASK(4, S_BCM1480_MC_BLK_CLR_MARK)
884#define V_BCM1480_MC_BLK_CLR_MARK(x) _SB_MAKEVALUE(x, S_BCM1480_MC_BLK_CLR_MARK)
885#define G_BCM1480_MC_BLK_CLR_MARK(x) _SB_GETVALUE(x, S_BCM1480_MC_BLK_CLR_MARK, M_BCM1480_MC_BLK_CLR_MARK)
886
887#define M_BCM1480_MC_PKT_PRIORITY _SB_MAKEMASK1(16)
888
889#define S_BCM1480_MC_MAX_AGE 20
890#define M_BCM1480_MC_MAX_AGE _SB_MAKEMASK(4, S_BCM1480_MC_MAX_AGE)
891#define V_BCM1480_MC_MAX_AGE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_MAX_AGE)
892#define G_BCM1480_MC_MAX_AGE(x) _SB_GETVALUE(x, S_BCM1480_MC_MAX_AGE, M_BCM1480_MC_MAX_AGE)
893
894#define M_BCM1480_MC_BERR_DISABLE _SB_MAKEMASK1(29)
895#define M_BCM1480_MC_FORCE_SEQ _SB_MAKEMASK1(30)
896#define M_BCM1480_MC_VGEN _SB_MAKEMASK1(32)
897
898#define S_BCM1480_MC_SLEW 33
899#define M_BCM1480_MC_SLEW _SB_MAKEMASK(2, S_BCM1480_MC_SLEW)
900#define V_BCM1480_MC_SLEW(x) _SB_MAKEVALUE(x, S_BCM1480_MC_SLEW)
901#define G_BCM1480_MC_SLEW(x) _SB_GETVALUE(x, S_BCM1480_MC_SLEW, M_BCM1480_MC_SLEW)
902
903#define M_BCM1480_MC_SSTL_VOLTAGE _SB_MAKEMASK1(35)
904
905/*
906 * Global Channel Interleave Register (Table 100)
907 */
908
909#define S_BCM1480_MC_INTLV0 0
910#define M_BCM1480_MC_INTLV0 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV0)
911#define V_BCM1480_MC_INTLV0(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV0)
912#define G_BCM1480_MC_INTLV0(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV0, M_BCM1480_MC_INTLV0)
913
914#define S_BCM1480_MC_INTLV1 8
915#define M_BCM1480_MC_INTLV1 _SB_MAKEMASK(6, S_BCM1480_MC_INTLV1)
916#define V_BCM1480_MC_INTLV1(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV1)
917#define G_BCM1480_MC_INTLV1(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV1, M_BCM1480_MC_INTLV1)
918
919#define S_BCM1480_MC_INTLV_MODE 16
920#define M_BCM1480_MC_INTLV_MODE _SB_MAKEMASK(3, S_BCM1480_MC_INTLV_MODE)
921#define V_BCM1480_MC_INTLV_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_MC_INTLV_MODE)
922#define G_BCM1480_MC_INTLV_MODE(x) _SB_GETVALUE(x, S_BCM1480_MC_INTLV_MODE, M_BCM1480_MC_INTLV_MODE)
923
924#define K_BCM1480_MC_INTLV_MODE_NONE 0x0
925#define K_BCM1480_MC_INTLV_MODE_01 0x1
926#define K_BCM1480_MC_INTLV_MODE_23 0x2
927#define K_BCM1480_MC_INTLV_MODE_01_23 0x3
928#define K_BCM1480_MC_INTLV_MODE_0123 0x4
929
930#define V_BCM1480_MC_INTLV_MODE_NONE V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_NONE)
931#define V_BCM1480_MC_INTLV_MODE_01 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01)
932#define V_BCM1480_MC_INTLV_MODE_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_23)
933#define V_BCM1480_MC_INTLV_MODE_01_23 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_01_23)
934#define V_BCM1480_MC_INTLV_MODE_0123 V_BCM1480_MC_INTLV_MODE(K_BCM1480_MC_INTLV_MODE_0123)
935
936/*
937 * ECC Status Register
938 */
939
940#define S_BCM1480_MC_ECC_ERR_ADDR 0
941#define M_BCM1480_MC_ECC_ERR_ADDR _SB_MAKEMASK(37, S_BCM1480_MC_ECC_ERR_ADDR)
942#define V_BCM1480_MC_ECC_ERR_ADDR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_ERR_ADDR)
943#define G_BCM1480_MC_ECC_ERR_ADDR(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_ERR_ADDR, M_BCM1480_MC_ECC_ERR_ADDR)
944
945#if SIBYTE_HDR_FEATURE(1480, PASS2)
946#define M_BCM1480_MC_ECC_ERR_RMW _SB_MAKEMASK1(60)
947#endif
948
949#define M_BCM1480_MC_ECC_MULT_ERR_DET _SB_MAKEMASK1(61)
950#define M_BCM1480_MC_ECC_UERR_DET _SB_MAKEMASK1(62)
951#define M_BCM1480_MC_ECC_CERR_DET _SB_MAKEMASK1(63)
952
953/*
954 * Global ECC Address Register (Table 102)
955 */
956
957#define S_BCM1480_MC_ECC_CORR_ADDR 0
958#define M_BCM1480_MC_ECC_CORR_ADDR _SB_MAKEMASK(37, S_BCM1480_MC_ECC_CORR_ADDR)
959#define V_BCM1480_MC_ECC_CORR_ADDR(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_CORR_ADDR)
960#define G_BCM1480_MC_ECC_CORR_ADDR(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_CORR_ADDR, M_BCM1480_MC_ECC_CORR_ADDR)
961
962/*
963 * Global ECC Correction Register (Table 103)
964 */
965
966#define S_BCM1480_MC_ECC_CORRECT 0
967#define M_BCM1480_MC_ECC_CORRECT _SB_MAKEMASK(64, S_BCM1480_MC_ECC_CORRECT)
968#define V_BCM1480_MC_ECC_CORRECT(x) _SB_MAKEVALUE(x, S_BCM1480_MC_ECC_CORRECT)
969#define G_BCM1480_MC_ECC_CORRECT(x) _SB_GETVALUE(x, S_BCM1480_MC_ECC_CORRECT, M_BCM1480_MC_ECC_CORRECT)
970
971/*
972 * Global ECC Performance Counters Control Register (Table 104)
973 */
974
975#define S_BCM1480_MC_CHANNEL_SELECT 0
976#define M_BCM1480_MC_CHANNEL_SELECT _SB_MAKEMASK(4, S_BCM1480_MC_CHANNEL_SELECT)
977#define V_BCM1480_MC_CHANNEL_SELECT(x) _SB_MAKEVALUE(x, S_BCM1480_MC_CHANNEL_SELECT)
978#define G_BCM1480_MC_CHANNEL_SELECT(x) _SB_GETVALUE(x, S_BCM1480_MC_CHANNEL_SELECT, M_BCM1480_MC_CHANNEL_SELECT)
979#define K_BCM1480_MC_CHANNEL_SELECT_0 0x1
980#define K_BCM1480_MC_CHANNEL_SELECT_1 0x2
981#define K_BCM1480_MC_CHANNEL_SELECT_2 0x4
982#define K_BCM1480_MC_CHANNEL_SELECT_3 0x8
983
984#endif /* _BCM1480_MC_H */
diff --git a/include/asm-mips/sibyte/bcm1480_regs.h b/include/asm-mips/sibyte/bcm1480_regs.h
deleted file mode 100644
index b4077bb72611..000000000000
--- a/include/asm-mips/sibyte/bcm1480_regs.h
+++ /dev/null
@@ -1,902 +0,0 @@
1/* *********************************************************************
2 * BCM1255/BCM1280/BCM1455/BCM1480 Board Support Package
3 *
4 * Register Definitions File: bcm1480_regs.h
5 *
6 * This module contains the addresses of the on-chip peripherals
7 * on the BCM1280 and BCM1480.
8 *
9 * BCM1480 specification level: 1X55_1X80-UM100-D4 (11/24/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _BCM1480_REGS_H
33#define _BCM1480_REGS_H
34
35#include "sb1250_defs.h"
36
37/* *********************************************************************
38 * Pull in the BCM1250's registers since a great deal of the 1480's
39 * functions are the same as the BCM1250.
40 ********************************************************************* */
41
42#include "sb1250_regs.h"
43
44
45/* *********************************************************************
46 * Some general notes:
47 *
48 * Register addresses are grouped by function and follow the order
49 * of the User Manual.
50 *
51 * For the most part, when there is more than one peripheral
52 * of the same type on the SOC, the constants below will be
53 * offsets from the base of each peripheral. For example,
54 * the MAC registers are described as offsets from the first
55 * MAC register, and there will be a MAC_REGISTER() macro
56 * to calculate the base address of a given MAC.
57 *
58 * The information in this file is based on the BCM1X55/BCM1X80
59 * User Manual, Document 1X55_1X80-UM100-R, 22/12/03.
60 *
61 * This file is basically a "what's new" header file. Since the
62 * BCM1250 and the new BCM1480 (and derivatives) share many common
63 * features, this file contains only what's new or changed from
64 * the 1250. (above, you can see that we include the 1250 symbols
65 * to get the base functionality).
66 *
67 * In software, be sure to use the correct symbols, particularly
68 * for blocks that are different between the two chip families.
69 * All BCM1480-specific symbols have _BCM1480_ in their names,
70 * and all BCM1250-specific and "base" functions that are common in
71 * both chips have no special names (this is for compatibility with
72 * older include files). Therefore, if you're working with the
73 * SCD, which is very different on each chip, A_SCD_xxx implies
74 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
75 * version.
76 ********************************************************************* */
77
78
79/* *********************************************************************
80 * Memory Controller Registers (Section 6)
81 ********************************************************************* */
82
83#define A_BCM1480_MC_BASE_0 0x0010050000
84#define A_BCM1480_MC_BASE_1 0x0010051000
85#define A_BCM1480_MC_BASE_2 0x0010052000
86#define A_BCM1480_MC_BASE_3 0x0010053000
87#define BCM1480_MC_REGISTER_SPACING 0x1000
88
89#define A_BCM1480_MC_BASE(ctlid) (A_BCM1480_MC_BASE_0+(ctlid)*BCM1480_MC_REGISTER_SPACING)
90#define A_BCM1480_MC_REGISTER(ctlid, reg) (A_BCM1480_MC_BASE(ctlid)+(reg))
91
92#define R_BCM1480_MC_CONFIG 0x0000000100
93#define R_BCM1480_MC_CS_START 0x0000000120
94#define R_BCM1480_MC_CS_END 0x0000000140
95#define S_BCM1480_MC_CS_STARTEND 24
96
97#define R_BCM1480_MC_CS01_ROW0 0x0000000180
98#define R_BCM1480_MC_CS01_ROW1 0x00000001A0
99#define R_BCM1480_MC_CS23_ROW0 0x0000000200
100#define R_BCM1480_MC_CS23_ROW1 0x0000000220
101#define R_BCM1480_MC_CS01_COL0 0x0000000280
102#define R_BCM1480_MC_CS01_COL1 0x00000002A0
103#define R_BCM1480_MC_CS23_COL0 0x0000000300
104#define R_BCM1480_MC_CS23_COL1 0x0000000320
105
106#define R_BCM1480_MC_CSX_BASE 0x0000000180
107#define R_BCM1480_MC_CSX_ROW0 0x0000000000 /* relative to CSX_BASE */
108#define R_BCM1480_MC_CSX_ROW1 0x0000000020 /* relative to CSX_BASE */
109#define R_BCM1480_MC_CSX_COL0 0x0000000100 /* relative to CSX_BASE */
110#define R_BCM1480_MC_CSX_COL1 0x0000000120 /* relative to CSX_BASE */
111#define BCM1480_MC_CSX_SPACING 0x0000000080 /* CS23 relative to CS01 */
112
113#define R_BCM1480_MC_CS01_BA 0x0000000380
114#define R_BCM1480_MC_CS23_BA 0x00000003A0
115#define R_BCM1480_MC_DRAMCMD 0x0000000400
116#define R_BCM1480_MC_DRAMMODE 0x0000000420
117#define R_BCM1480_MC_CLOCK_CFG 0x0000000440
118#define R_BCM1480_MC_MCLK_CFG R_BCM1480_MC_CLOCK_CFG
119#define R_BCM1480_MC_TEST_DATA 0x0000000480
120#define R_BCM1480_MC_TEST_ECC 0x00000004A0
121#define R_BCM1480_MC_TIMING1 0x00000004C0
122#define R_BCM1480_MC_TIMING2 0x00000004E0
123#define R_BCM1480_MC_DLL_CFG 0x0000000500
124#define R_BCM1480_MC_DRIVE_CFG 0x0000000520
125
126#if SIBYTE_HDR_FEATURE(1480, PASS2)
127#define R_BCM1480_MC_ODT 0x0000000460
128#define R_BCM1480_MC_ECC_STATUS 0x0000000540
129#endif
130
131/* Global registers (single instance) */
132#define A_BCM1480_MC_GLB_CONFIG 0x0010054100
133#define A_BCM1480_MC_GLB_INTLV 0x0010054120
134#define A_BCM1480_MC_GLB_ECC_STATUS 0x0010054140
135#define A_BCM1480_MC_GLB_ECC_ADDR 0x0010054160
136#define A_BCM1480_MC_GLB_ECC_CORRECT 0x0010054180
137#define A_BCM1480_MC_GLB_PERF_CNT_CONTROL 0x00100541A0
138
139/* *********************************************************************
140 * L2 Cache Control Registers (Section 5)
141 ********************************************************************* */
142
143#define A_BCM1480_L2_BASE 0x0010040000
144
145#define A_BCM1480_L2_READ_TAG 0x0010040018
146#define A_BCM1480_L2_ECC_TAG 0x0010040038
147#define A_BCM1480_L2_MISC0_VALUE 0x0010040058
148#define A_BCM1480_L2_MISC1_VALUE 0x0010040078
149#define A_BCM1480_L2_MISC2_VALUE 0x0010040098
150#define A_BCM1480_L2_MISC_CONFIG 0x0010040040 /* x040 */
151#define A_BCM1480_L2_CACHE_DISABLE 0x0010040060 /* x060 */
152#define A_BCM1480_L2_MAKECACHEDISABLE(x) (A_BCM1480_L2_CACHE_DISABLE | (((x)&0xF) << 12))
153#define A_BCM1480_L2_WAY_ENABLE_3_0 0x0010040080 /* x080 */
154#define A_BCM1480_L2_WAY_ENABLE_7_4 0x00100400A0 /* x0A0 */
155#define A_BCM1480_L2_MAKE_WAY_ENABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((x)&0xF) << 12))
156#define A_BCM1480_L2_MAKE_WAY_ENABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((x)&0xF) << 12))
157#define A_BCM1480_L2_MAKE_WAY_DISABLE_LO(x) (A_BCM1480_L2_WAY_ENABLE_3_0 | (((~x)&0xF) << 12))
158#define A_BCM1480_L2_MAKE_WAY_DISABLE_HI(x) (A_BCM1480_L2_WAY_ENABLE_7_4 | (((~x)&0xF) << 12))
159#define A_BCM1480_L2_WAY_LOCAL_3_0 0x0010040100 /* x100 */
160#define A_BCM1480_L2_WAY_LOCAL_7_4 0x0010040120 /* x120 */
161#define A_BCM1480_L2_WAY_REMOTE_3_0 0x0010040140 /* x140 */
162#define A_BCM1480_L2_WAY_REMOTE_7_4 0x0010040160 /* x160 */
163#define A_BCM1480_L2_WAY_AGENT_3_0 0x00100400C0 /* xxC0 */
164#define A_BCM1480_L2_WAY_AGENT_7_4 0x00100400E0 /* xxE0 */
165#define A_BCM1480_L2_WAY_ENABLE(A, banks) (A | (((~(banks))&0x0F) << 8))
166#define A_BCM1480_L2_BANK_BASE 0x00D0300000
167#define A_BCM1480_L2_BANK_ADDRESS(b) (A_BCM1480_L2_BANK_BASE | (((b)&0x7)<<17))
168#define A_BCM1480_L2_MGMT_TAG_BASE 0x00D0000000
169
170
171/* *********************************************************************
172 * PCI-X Interface Registers (Section 7)
173 ********************************************************************* */
174
175#define A_BCM1480_PCI_BASE 0x0010061400
176
177#define A_BCM1480_PCI_RESET 0x0010061400
178#define A_BCM1480_PCI_DLL 0x0010061500
179
180#define A_BCM1480_PCI_TYPE00_HEADER 0x002E000000
181
182/* *********************************************************************
183 * Ethernet MAC Registers (Section 11) and DMA Registers (Section 10.6)
184 ********************************************************************* */
185
186/* No register changes with Rev.C BCM1250, but one additional MAC */
187
188#define A_BCM1480_MAC_BASE_2 0x0010066000
189
190#ifndef A_MAC_BASE_2
191#define A_MAC_BASE_2 A_BCM1480_MAC_BASE_2
192#endif
193
194#define A_BCM1480_MAC_BASE_3 0x0010067000
195#define A_MAC_BASE_3 A_BCM1480_MAC_BASE_3
196
197#define R_BCM1480_MAC_DMA_OODPKTLOST 0x00000038
198
199#ifndef R_MAC_DMA_OODPKTLOST
200#define R_MAC_DMA_OODPKTLOST R_BCM1480_MAC_DMA_OODPKTLOST
201#endif
202
203
204/* *********************************************************************
205 * DUART Registers (Section 14)
206 ********************************************************************* */
207
208/* No significant differences from BCM1250, two DUARTs */
209
210/* Conventions, per user manual:
211 * DUART generic, channels A,B,C,D
212 * DUART0 implementing channels A,B
213 * DUART1 inplementing channels C,D
214 */
215
216#define BCM1480_DUART_NUM_PORTS 4
217
218#define A_BCM1480_DUART0 0x0010060000
219#define A_BCM1480_DUART1 0x0010060400
220#define A_BCM1480_DUART(chan) ((((chan)&2) == 0)? A_BCM1480_DUART0 : A_BCM1480_DUART1)
221
222#define BCM1480_DUART_CHANREG_SPACING 0x100
223#define A_BCM1480_DUART_CHANREG(chan, reg) \
224 (A_BCM1480_DUART(chan) + \
225 BCM1480_DUART_CHANREG_SPACING * (((chan) & 1) + 1) + (reg))
226#define A_BCM1480_DUART_CTRLREG(chan, reg) \
227 (A_BCM1480_DUART(chan) + \
228 BCM1480_DUART_CHANREG_SPACING * 3 + (reg))
229
230#define DUART_IMRISR_SPACING 0x20
231#define DUART_INCHNG_SPACING 0x10
232
233#define R_BCM1480_DUART_IMRREG(chan) \
234 (R_DUART_IMR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
235#define R_BCM1480_DUART_ISRREG(chan) \
236 (R_DUART_ISR_A + ((chan) & 1) * DUART_IMRISR_SPACING)
237#define R_BCM1480_DUART_INCHREG(chan) \
238 (R_DUART_IN_CHNG_A + ((chan) & 1) * DUART_INCHNG_SPACING)
239
240#define A_BCM1480_DUART_IMRREG(chan) \
241 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_IMRREG(chan)))
242#define A_BCM1480_DUART_ISRREG(chan) \
243 (A_BCM1480_DUART_CTRLREG((chan), R_BCM1480_DUART_ISRREG(chan)))
244
245#define A_BCM1480_DUART_IN_PORT(chan) \
246 (A_BCM1480_DUART_CTRLREG((chan), R_DUART_IN_PORT))
247
248/*
249 * These constants are the absolute addresses.
250 */
251
252#define A_BCM1480_DUART_MODE_REG_1_C 0x0010060400
253#define A_BCM1480_DUART_MODE_REG_2_C 0x0010060410
254#define A_BCM1480_DUART_STATUS_C 0x0010060420
255#define A_BCM1480_DUART_CLK_SEL_C 0x0010060430
256#define A_BCM1480_DUART_FULL_CTL_C 0x0010060440
257#define A_BCM1480_DUART_CMD_C 0x0010060450
258#define A_BCM1480_DUART_RX_HOLD_C 0x0010060460
259#define A_BCM1480_DUART_TX_HOLD_C 0x0010060470
260#define A_BCM1480_DUART_OPCR_C 0x0010060480
261#define A_BCM1480_DUART_AUX_CTRL_C 0x0010060490
262
263#define A_BCM1480_DUART_MODE_REG_1_D 0x0010060500
264#define A_BCM1480_DUART_MODE_REG_2_D 0x0010060510
265#define A_BCM1480_DUART_STATUS_D 0x0010060520
266#define A_BCM1480_DUART_CLK_SEL_D 0x0010060530
267#define A_BCM1480_DUART_FULL_CTL_D 0x0010060540
268#define A_BCM1480_DUART_CMD_D 0x0010060550
269#define A_BCM1480_DUART_RX_HOLD_D 0x0010060560
270#define A_BCM1480_DUART_TX_HOLD_D 0x0010060570
271#define A_BCM1480_DUART_OPCR_D 0x0010060580
272#define A_BCM1480_DUART_AUX_CTRL_D 0x0010060590
273
274#define A_BCM1480_DUART_INPORT_CHNG_CD 0x0010060600
275#define A_BCM1480_DUART_AUX_CTRL_CD 0x0010060610
276#define A_BCM1480_DUART_ISR_C 0x0010060620
277#define A_BCM1480_DUART_IMR_C 0x0010060630
278#define A_BCM1480_DUART_ISR_D 0x0010060640
279#define A_BCM1480_DUART_IMR_D 0x0010060650
280#define A_BCM1480_DUART_OUT_PORT_CD 0x0010060660
281#define A_BCM1480_DUART_OPCR_CD 0x0010060670
282#define A_BCM1480_DUART_IN_PORT_CD 0x0010060680
283#define A_BCM1480_DUART_ISR_CD 0x0010060690
284#define A_BCM1480_DUART_IMR_CD 0x00100606A0
285#define A_BCM1480_DUART_SET_OPR_CD 0x00100606B0
286#define A_BCM1480_DUART_CLEAR_OPR_CD 0x00100606C0
287#define A_BCM1480_DUART_INPORT_CHNG_C 0x00100606D0
288#define A_BCM1480_DUART_INPORT_CHNG_D 0x00100606E0
289
290
291/* *********************************************************************
292 * Generic Bus Registers (Section 15) and PCMCIA Registers (Section 16)
293 ********************************************************************* */
294
295#define A_BCM1480_IO_PCMCIA_CFG_B 0x0010061A58
296#define A_BCM1480_IO_PCMCIA_STATUS_B 0x0010061A68
297
298/* *********************************************************************
299 * GPIO Registers (Section 17)
300 ********************************************************************* */
301
302/* One additional GPIO register, placed _before_ the BCM1250's GPIO block base */
303
304#define A_BCM1480_GPIO_INT_ADD_TYPE 0x0010061A78
305#define R_BCM1480_GPIO_INT_ADD_TYPE (-8)
306
307#define A_GPIO_INT_ADD_TYPE A_BCM1480_GPIO_INT_ADD_TYPE
308#define R_GPIO_INT_ADD_TYPE R_BCM1480_GPIO_INT_ADD_TYPE
309
310/* *********************************************************************
311 * SMBus Registers (Section 18)
312 ********************************************************************* */
313
314/* No changes from BCM1250 */
315
316/* *********************************************************************
317 * Timer Registers (Sections 4.6)
318 ********************************************************************* */
319
320/* BCM1480 has two additional watchdogs */
321
322/* Watchdog timers */
323
324#define A_BCM1480_SCD_WDOG_2 0x0010022050
325#define A_BCM1480_SCD_WDOG_3 0x0010022150
326
327#define BCM1480_SCD_NUM_WDOGS 4
328
329#define A_BCM1480_SCD_WDOG_BASE(w) (A_BCM1480_SCD_WDOG_0+((w)&2)*0x1000 + ((w)&1)*0x100)
330#define A_BCM1480_SCD_WDOG_REGISTER(w, r) (A_BCM1480_SCD_WDOG_BASE(w) + (r))
331
332#define A_BCM1480_SCD_WDOG_INIT_2 0x0010022050
333#define A_BCM1480_SCD_WDOG_CNT_2 0x0010022058
334#define A_BCM1480_SCD_WDOG_CFG_2 0x0010022060
335
336#define A_BCM1480_SCD_WDOG_INIT_3 0x0010022150
337#define A_BCM1480_SCD_WDOG_CNT_3 0x0010022158
338#define A_BCM1480_SCD_WDOG_CFG_3 0x0010022160
339
340/* BCM1480 has two additional compare registers */
341
342#define A_BCM1480_SCD_ZBBUS_CYCLE_COUNT A_SCD_ZBBUS_CYCLE_COUNT
343#define A_BCM1480_SCD_ZBBUS_CYCLE_CP_BASE 0x0010020C00
344#define A_BCM1480_SCD_ZBBUS_CYCLE_CP0 A_SCD_ZBBUS_CYCLE_CP0
345#define A_BCM1480_SCD_ZBBUS_CYCLE_CP1 A_SCD_ZBBUS_CYCLE_CP1
346#define A_BCM1480_SCD_ZBBUS_CYCLE_CP2 0x0010020C10
347#define A_BCM1480_SCD_ZBBUS_CYCLE_CP3 0x0010020C18
348
349/* *********************************************************************
350 * System Control Registers (Section 4.2)
351 ********************************************************************* */
352
353/* Scratch register in different place */
354
355#define A_BCM1480_SCD_SCRATCH 0x100200A0
356
357/* *********************************************************************
358 * System Address Trap Registers (Section 4.9)
359 ********************************************************************* */
360
361/* No changes from BCM1250 */
362
363/* *********************************************************************
364 * System Interrupt Mapper Registers (Sections 4.3-4.5)
365 ********************************************************************* */
366
367#define A_BCM1480_IMR_CPU0_BASE 0x0010020000
368#define A_BCM1480_IMR_CPU1_BASE 0x0010022000
369#define A_BCM1480_IMR_CPU2_BASE 0x0010024000
370#define A_BCM1480_IMR_CPU3_BASE 0x0010026000
371#define BCM1480_IMR_REGISTER_SPACING 0x2000
372#define BCM1480_IMR_REGISTER_SPACING_SHIFT 13
373
374#define A_BCM1480_IMR_MAPPER(cpu) (A_BCM1480_IMR_CPU0_BASE+(cpu)*BCM1480_IMR_REGISTER_SPACING)
375#define A_BCM1480_IMR_REGISTER(cpu, reg) (A_BCM1480_IMR_MAPPER(cpu)+(reg))
376
377/* Most IMR registers are 128 bits, implemented as non-contiguous
378 64-bit registers high (_H) and low (_L) */
379#define BCM1480_IMR_HL_SPACING 0x1000
380
381#define R_BCM1480_IMR_INTERRUPT_DIAG_H 0x0010
382#define R_BCM1480_IMR_LDT_INTERRUPT_H 0x0018
383#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_H 0x0020
384#define R_BCM1480_IMR_INTERRUPT_MASK_H 0x0028
385#define R_BCM1480_IMR_INTERRUPT_TRACE_H 0x0038
386#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_H 0x0040
387#define R_BCM1480_IMR_LDT_INTERRUPT_SET 0x0048
388#define R_BCM1480_IMR_MAILBOX_0_CPU 0x00C0
389#define R_BCM1480_IMR_MAILBOX_0_SET_CPU 0x00C8
390#define R_BCM1480_IMR_MAILBOX_0_CLR_CPU 0x00D0
391#define R_BCM1480_IMR_MAILBOX_1_CPU 0x00E0
392#define R_BCM1480_IMR_MAILBOX_1_SET_CPU 0x00E8
393#define R_BCM1480_IMR_MAILBOX_1_CLR_CPU 0x00F0
394#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_H 0x0100
395#define BCM1480_IMR_INTERRUPT_STATUS_COUNT 8
396#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_H 0x0200
397#define BCM1480_IMR_INTERRUPT_MAP_COUNT 64
398
399#define R_BCM1480_IMR_INTERRUPT_DIAG_L 0x1010
400#define R_BCM1480_IMR_LDT_INTERRUPT_L 0x1018
401#define R_BCM1480_IMR_LDT_INTERRUPT_CLR_L 0x1020
402#define R_BCM1480_IMR_INTERRUPT_MASK_L 0x1028
403#define R_BCM1480_IMR_INTERRUPT_TRACE_L 0x1038
404#define R_BCM1480_IMR_INTERRUPT_SOURCE_STATUS_L 0x1040
405#define R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L 0x1100
406#define R_BCM1480_IMR_INTERRUPT_MAP_BASE_L 0x1200
407
408#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE 0x0010028000
409#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU1_BASE 0x0010028100
410#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU2_BASE 0x0010028200
411#define A_BCM1480_IMR_ALIAS_MAILBOX_CPU3_BASE 0x0010028300
412#define BCM1480_IMR_ALIAS_MAILBOX_SPACING 0100
413
414#define A_BCM1480_IMR_ALIAS_MAILBOX(cpu) (A_BCM1480_IMR_ALIAS_MAILBOX_CPU0_BASE + \
415 (cpu)*BCM1480_IMR_ALIAS_MAILBOX_SPACING)
416#define A_BCM1480_IMR_ALIAS_MAILBOX_REGISTER(cpu, reg) (A_BCM1480_IMR_ALIAS_MAILBOX(cpu)+(reg))
417
418#define R_BCM1480_IMR_ALIAS_MAILBOX_0 0x0000 /* 0x0x0 */
419#define R_BCM1480_IMR_ALIAS_MAILBOX_0_SET 0x0008 /* 0x0x8 */
420
421/*
422 * these macros work together to build the address of a mailbox
423 * register, e.g., A_BCM1480_MAILBOX_REGISTER(0,R_BCM1480_IMR_MAILBOX_SET,2)
424 * for mbox_0_set_cpu2 returns 0x00100240C8
425 */
426#define R_BCM1480_IMR_MAILBOX_CPU 0x00
427#define R_BCM1480_IMR_MAILBOX_SET 0x08
428#define R_BCM1480_IMR_MAILBOX_CLR 0x10
429#define R_BCM1480_IMR_MAILBOX_NUM_SPACING 0x20
430#define A_BCM1480_MAILBOX_REGISTER(num, reg, cpu) \
431 (A_BCM1480_IMR_CPU0_BASE + \
432 (num * R_BCM1480_IMR_MAILBOX_NUM_SPACING) + \
433 (cpu * BCM1480_IMR_REGISTER_SPACING) + \
434 (R_BCM1480_IMR_MAILBOX_0_CPU + reg))
435
436/* *********************************************************************
437 * System Performance Counter Registers (Section 4.7)
438 ********************************************************************* */
439
440/* BCM1480 has four more performance counter registers, and two control
441 registers. */
442
443#define A_BCM1480_SCD_PERF_CNT_BASE 0x00100204C0
444
445#define A_BCM1480_SCD_PERF_CNT_CFG0 0x00100204C0
446#define A_BCM1480_SCD_PERF_CNT_CFG_0 A_BCM1480_SCD_PERF_CNT_CFG0
447#define A_BCM1480_SCD_PERF_CNT_CFG1 0x00100204C8
448#define A_BCM1480_SCD_PERF_CNT_CFG_1 A_BCM1480_SCD_PERF_CNT_CFG1
449
450#define A_BCM1480_SCD_PERF_CNT_0 A_SCD_PERF_CNT_0
451#define A_BCM1480_SCD_PERF_CNT_1 A_SCD_PERF_CNT_1
452#define A_BCM1480_SCD_PERF_CNT_2 A_SCD_PERF_CNT_2
453#define A_BCM1480_SCD_PERF_CNT_3 A_SCD_PERF_CNT_3
454
455#define A_BCM1480_SCD_PERF_CNT_4 0x00100204F0
456#define A_BCM1480_SCD_PERF_CNT_5 0x00100204F8
457#define A_BCM1480_SCD_PERF_CNT_6 0x0010020500
458#define A_BCM1480_SCD_PERF_CNT_7 0x0010020508
459
460#define BCM1480_SCD_NUM_PERF_CNT 8
461#define BCM1480_SCD_PERF_CNT_SPACING 8
462#define A_BCM1480_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*BCM1480_SCD_PERF_CNT_SPACING))
463
464/* *********************************************************************
465 * System Bus Watcher Registers (Section 4.8)
466 ********************************************************************* */
467
468
469/* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */
470
471#define A_BCM1480_BUS_ERR_STATUS_DEBUG 0x00100208D8
472
473/* *********************************************************************
474 * System Debug Controller Registers (Section 19)
475 ********************************************************************* */
476
477/* Same as 1250 */
478
479/* *********************************************************************
480 * System Trace Unit Registers (Sections 4.10)
481 ********************************************************************* */
482
483/* Same as 1250 */
484
485/* *********************************************************************
486 * Data Mover DMA Registers (Section 10.7)
487 ********************************************************************* */
488
489/* Same as 1250 */
490
491
492/* *********************************************************************
493 * HyperTransport Interface Registers (Section 8)
494 ********************************************************************* */
495
496#define BCM1480_HT_NUM_PORTS 3
497#define BCM1480_HT_PORT_SPACING 0x800
498#define A_BCM1480_HT_PORT_HEADER(x) (A_BCM1480_HT_PORT0_HEADER + ((x)*BCM1480_HT_PORT_SPACING))
499
500#define A_BCM1480_HT_PORT0_HEADER 0x00FE000000
501#define A_BCM1480_HT_PORT1_HEADER 0x00FE000800
502#define A_BCM1480_HT_PORT2_HEADER 0x00FE001000
503#define A_BCM1480_HT_TYPE00_HEADER 0x00FE002000
504
505
506/* *********************************************************************
507 * Node Controller Registers (Section 9)
508 ********************************************************************* */
509
510#define A_BCM1480_NC_BASE 0x00DFBD0000
511
512#define A_BCM1480_NC_RLD_FIELD 0x00DFBD0000
513#define A_BCM1480_NC_RLD_TRIGGER 0x00DFBD0020
514#define A_BCM1480_NC_RLD_BAD_ERROR 0x00DFBD0040
515#define A_BCM1480_NC_RLD_COR_ERROR 0x00DFBD0060
516#define A_BCM1480_NC_RLD_ECC_STATUS 0x00DFBD0080
517#define A_BCM1480_NC_RLD_WAY_ENABLE 0x00DFBD00A0
518#define A_BCM1480_NC_RLD_RANDOM_LFSR 0x00DFBD00C0
519
520#define A_BCM1480_NC_INTERRUPT_STATUS 0x00DFBD00E0
521#define A_BCM1480_NC_INTERRUPT_ENABLE 0x00DFBD0100
522#define A_BCM1480_NC_TIMEOUT_COUNTER 0x00DFBD0120
523#define A_BCM1480_NC_TIMEOUT_COUNTER_SEL 0x00DFBD0140
524
525#define A_BCM1480_NC_CREDIT_STATUS_REG0 0x00DFBD0200
526#define A_BCM1480_NC_CREDIT_STATUS_REG1 0x00DFBD0220
527#define A_BCM1480_NC_CREDIT_STATUS_REG2 0x00DFBD0240
528#define A_BCM1480_NC_CREDIT_STATUS_REG3 0x00DFBD0260
529#define A_BCM1480_NC_CREDIT_STATUS_REG4 0x00DFBD0280
530#define A_BCM1480_NC_CREDIT_STATUS_REG5 0x00DFBD02A0
531#define A_BCM1480_NC_CREDIT_STATUS_REG6 0x00DFBD02C0
532#define A_BCM1480_NC_CREDIT_STATUS_REG7 0x00DFBD02E0
533#define A_BCM1480_NC_CREDIT_STATUS_REG8 0x00DFBD0300
534#define A_BCM1480_NC_CREDIT_STATUS_REG9 0x00DFBD0320
535#define A_BCM1480_NC_CREDIT_STATUS_REG10 0x00DFBE0000
536#define A_BCM1480_NC_CREDIT_STATUS_REG11 0x00DFBE0020
537#define A_BCM1480_NC_CREDIT_STATUS_REG12 0x00DFBE0040
538
539#define A_BCM1480_NC_SR_TIMEOUT_COUNTER 0x00DFBE0060
540#define A_BCM1480_NC_SR_TIMEOUT_COUNTER_SEL 0x00DFBE0080
541
542
543/* *********************************************************************
544 * H&R Block Configuration Registers (Section 12.4)
545 ********************************************************************* */
546
547#define A_BCM1480_HR_BASE_0 0x00DF820000
548#define A_BCM1480_HR_BASE_1 0x00DF8A0000
549#define A_BCM1480_HR_BASE_2 0x00DF920000
550#define BCM1480_HR_REGISTER_SPACING 0x80000
551
552#define A_BCM1480_HR_BASE(idx) (A_BCM1480_HR_BASE_0 + ((idx)*BCM1480_HR_REGISTER_SPACING))
553#define A_BCM1480_HR_REGISTER(idx, reg) (A_BCM1480_HR_BASE(idx) + (reg))
554
555#define R_BCM1480_HR_CFG 0x0000000000
556
557#define R_BCM1480_HR_MAPPING 0x0000010010
558
559#define BCM1480_HR_RULE_SPACING 0x0000000010
560#define BCM1480_HR_NUM_RULES 16
561#define BCM1480_HR_OP_OFFSET 0x0000000100
562#define BCM1480_HR_TYPE_OFFSET 0x0000000108
563#define R_BCM1480_HR_RULE_OP(idx) (BCM1480_HR_OP_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
564#define R_BCM1480_HR_RULE_TYPE(idx) (BCM1480_HR_TYPE_OFFSET + ((idx)*BCM1480_HR_RULE_SPACING))
565
566#define BCM1480_HR_LEAF_SPACING 0x0000000010
567#define BCM1480_HR_NUM_LEAVES 10
568#define BCM1480_HR_LEAF_OFFSET 0x0000000300
569#define R_BCM1480_HR_HA_LEAF0(idx) (BCM1480_HR_LEAF_OFFSET + ((idx)*BCM1480_HR_LEAF_SPACING))
570
571#define R_BCM1480_HR_EX_LEAF0 0x00000003A0
572
573#define BCM1480_HR_PATH_SPACING 0x0000000010
574#define BCM1480_HR_NUM_PATHS 16
575#define BCM1480_HR_PATH_OFFSET 0x0000000600
576#define R_BCM1480_HR_PATH(idx) (BCM1480_HR_PATH_OFFSET + ((idx)*BCM1480_HR_PATH_SPACING))
577
578#define R_BCM1480_HR_PATH_DEFAULT 0x0000000700
579
580#define BCM1480_HR_ROUTE_SPACING 8
581#define BCM1480_HR_NUM_ROUTES 512
582#define BCM1480_HR_ROUTE_OFFSET 0x0000001000
583#define R_BCM1480_HR_RT_WORD(idx) (BCM1480_HR_ROUTE_OFFSET + ((idx)*BCM1480_HR_ROUTE_SPACING))
584
585
586/* checked to here - ehs */
587/* *********************************************************************
588 * Packet Manager DMA Registers (Section 12.5)
589 ********************************************************************* */
590
591#define A_BCM1480_PM_BASE 0x0010056000
592
593#define A_BCM1480_PMI_LCL_0 0x0010058000
594#define A_BCM1480_PMO_LCL_0 0x001005C000
595#define A_BCM1480_PMI_OFFSET_0 (A_BCM1480_PMI_LCL_0 - A_BCM1480_PM_BASE)
596#define A_BCM1480_PMO_OFFSET_0 (A_BCM1480_PMO_LCL_0 - A_BCM1480_PM_BASE)
597
598#define BCM1480_PM_LCL_REGISTER_SPACING 0x100
599#define BCM1480_PM_NUM_CHANNELS 32
600
601#define A_BCM1480_PMI_LCL_BASE(idx) (A_BCM1480_PMI_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
602#define A_BCM1480_PMI_LCL_REGISTER(idx, reg) (A_BCM1480_PMI_LCL_BASE(idx) + (reg))
603#define A_BCM1480_PMO_LCL_BASE(idx) (A_BCM1480_PMO_LCL_0 + ((idx)*BCM1480_PM_LCL_REGISTER_SPACING))
604#define A_BCM1480_PMO_LCL_REGISTER(idx, reg) (A_BCM1480_PMO_LCL_BASE(idx) + (reg))
605
606#define BCM1480_PM_INT_PACKING 8
607#define BCM1480_PM_INT_FUNCTION_SPACING 0x40
608#define BCM1480_PM_INT_NUM_FUNCTIONS 3
609
610/*
611 * DMA channel registers relative to A_BCM1480_PMI_LCL_BASE(n) and A_BCM1480_PMO_LCL_BASE(n)
612 */
613
614#define R_BCM1480_PM_BASE_SIZE 0x0000000000
615#define R_BCM1480_PM_CNT 0x0000000008
616#define R_BCM1480_PM_PFCNT 0x0000000010
617#define R_BCM1480_PM_LAST 0x0000000018
618#define R_BCM1480_PM_PFINDX 0x0000000020
619#define R_BCM1480_PM_INT_WMK 0x0000000028
620#define R_BCM1480_PM_CONFIG0 0x0000000030
621#define R_BCM1480_PM_LOCALDEBUG 0x0000000078
622#define R_BCM1480_PM_CACHEABILITY 0x0000000080 /* PMI only */
623#define R_BCM1480_PM_INT_CNFG 0x0000000088
624#define R_BCM1480_PM_DESC_MERGE_TIMER 0x0000000090
625#define R_BCM1480_PM_LOCALDEBUG_PIB 0x00000000F8 /* PMI only */
626#define R_BCM1480_PM_LOCALDEBUG_POB 0x00000000F8 /* PMO only */
627
628/*
629 * Global Registers (Not Channelized)
630 */
631
632#define A_BCM1480_PMI_GLB_0 0x0010056000
633#define A_BCM1480_PMO_GLB_0 0x0010057000
634
635/*
636 * PM to TX Mapping Register relative to A_BCM1480_PMI_GLB_0 and A_BCM1480_PMO_GLB_0
637 */
638
639#define R_BCM1480_PM_PMO_MAPPING 0x00000008C8 /* PMO only */
640
641#define A_BCM1480_PM_PMO_MAPPING (A_BCM1480_PMO_GLB_0 + R_BCM1480_PM_PMO_MAPPING)
642
643/*
644 * Interrupt mapping registers
645 */
646
647
648#define A_BCM1480_PMI_INT_0 0x0010056800
649#define A_BCM1480_PMI_INT(q) (A_BCM1480_PMI_INT_0 + ((q>>8)<<8))
650#define A_BCM1480_PMI_INT_OFFSET_0 (A_BCM1480_PMI_INT_0 - A_BCM1480_PM_BASE)
651#define A_BCM1480_PMO_INT_0 0x0010057800
652#define A_BCM1480_PMO_INT(q) (A_BCM1480_PMO_INT_0 + ((q>>8)<<8))
653#define A_BCM1480_PMO_INT_OFFSET_0 (A_BCM1480_PMO_INT_0 - A_BCM1480_PM_BASE)
654
655/*
656 * Interrupt registers relative to A_BCM1480_PMI_INT_0 and A_BCM1480_PMO_INT_0
657 */
658
659#define R_BCM1480_PM_INT_ST 0x0000000000
660#define R_BCM1480_PM_INT_MSK 0x0000000040
661#define R_BCM1480_PM_INT_CLR 0x0000000080
662#define R_BCM1480_PM_MRGD_INT 0x00000000C0
663
664/*
665 * Debug registers (global)
666 */
667
668#define A_BCM1480_PM_GLOBALDEBUGMODE_PMI 0x0010056000
669#define A_BCM1480_PM_GLOBALDEBUG_PID 0x00100567F8
670#define A_BCM1480_PM_GLOBALDEBUG_PIB 0x0010056FF8
671#define A_BCM1480_PM_GLOBALDEBUGMODE_PMO 0x0010057000
672#define A_BCM1480_PM_GLOBALDEBUG_POD 0x00100577F8
673#define A_BCM1480_PM_GLOBALDEBUG_POB 0x0010057FF8
674
675/* *********************************************************************
676 * Switch performance counters
677 ********************************************************************* */
678
679#define A_BCM1480_SWPERF_CFG 0xdfb91800
680#define A_BCM1480_SWPERF_CNT0 0xdfb91880
681#define A_BCM1480_SWPERF_CNT1 0xdfb91888
682#define A_BCM1480_SWPERF_CNT2 0xdfb91890
683#define A_BCM1480_SWPERF_CNT3 0xdfb91898
684
685
686/* *********************************************************************
687 * Switch Trace Unit
688 ********************************************************************* */
689
690#define A_BCM1480_SWTRC_MATCH_CONTROL_0 0xDFB91000
691#define A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 0xDFB91100
692#define A_BCM1480_SWTRC_MATCH_DATA_MASK_0 0xDFB91108
693#define A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 0xDFB91200
694#define A_BCM1480_SWTRC_MATCH_TAG_MAKS_0 0xDFB91208
695#define A_BCM1480_SWTRC_EVENT_0 0xDFB91300
696#define A_BCM1480_SWTRC_SEQUENCE_0 0xDFB91400
697
698#define A_BCM1480_SWTRC_CFG 0xDFB91500
699#define A_BCM1480_SWTRC_READ 0xDFB91508
700
701#define A_BCM1480_SWDEBUG_SCHEDSTOP 0xDFB92000
702
703#define A_BCM1480_SWTRC_MATCH_CONTROL(x) (A_BCM1480_SWTRC_MATCH_CONTROL_0 + ((x)*8))
704#define A_BCM1480_SWTRC_EVENT(x) (A_BCM1480_SWTRC_EVENT_0 + ((x)*8))
705#define A_BCM1480_SWTRC_SEQUENCE(x) (A_BCM1480_SWTRC_SEQUENCE_0 + ((x)*8))
706
707#define A_BCM1480_SWTRC_MATCH_DATA_VALUE(x) (A_BCM1480_SWTRC_MATCH_DATA_VALUE_0 + ((x)*16))
708#define A_BCM1480_SWTRC_MATCH_DATA_MASK(x) (A_BCM1480_SWTRC_MATCH_DATA_MASK_0 + ((x)*16))
709#define A_BCM1480_SWTRC_MATCH_TAG_VALUE(x) (A_BCM1480_SWTRC_MATCH_TAG_VALUE_0 + ((x)*16))
710#define A_BCM1480_SWTRC_MATCH_TAG_MASK(x) (A_BCM1480_SWTRC_MATCH_TAG_MASK_0 + ((x)*16))
711
712
713
714/* *********************************************************************
715 * High-Speed Port Registers (Section 13)
716 ********************************************************************* */
717
718#define A_BCM1480_HSP_BASE_0 0x00DF810000
719#define A_BCM1480_HSP_BASE_1 0x00DF890000
720#define A_BCM1480_HSP_BASE_2 0x00DF910000
721#define BCM1480_HSP_REGISTER_SPACING 0x80000
722
723#define A_BCM1480_HSP_BASE(idx) (A_BCM1480_HSP_BASE_0 + ((idx)*BCM1480_HSP_REGISTER_SPACING))
724#define A_BCM1480_HSP_REGISTER(idx, reg) (A_BCM1480_HSP_BASE(idx) + (reg))
725
726#define R_BCM1480_HSP_RX_SPI4_CFG_0 0x0000000000
727#define R_BCM1480_HSP_RX_SPI4_CFG_1 0x0000000008
728#define R_BCM1480_HSP_RX_SPI4_DESKEW_OVERRIDE 0x0000000010
729#define R_BCM1480_HSP_RX_SPI4_DESKEW_DATAPATH 0x0000000018
730#define R_BCM1480_HSP_RX_SPI4_PORT_INT_EN 0x0000000020
731#define R_BCM1480_HSP_RX_SPI4_PORT_INT_STATUS 0x0000000028
732
733#define R_BCM1480_HSP_RX_SPI4_CALENDAR_0 0x0000000200
734#define R_BCM1480_HSP_RX_SPI4_CALENDAR_1 0x0000000208
735
736#define R_BCM1480_HSP_RX_PLL_CNFG 0x0000000800
737#define R_BCM1480_HSP_RX_CALIBRATION 0x0000000808
738#define R_BCM1480_HSP_RX_TEST 0x0000000810
739#define R_BCM1480_HSP_RX_DIAG_DETAILS 0x0000000818
740#define R_BCM1480_HSP_RX_DIAG_CRC_0 0x0000000820
741#define R_BCM1480_HSP_RX_DIAG_CRC_1 0x0000000828
742#define R_BCM1480_HSP_RX_DIAG_HTCMD 0x0000000830
743#define R_BCM1480_HSP_RX_DIAG_PKTCTL 0x0000000838
744
745#define R_BCM1480_HSP_RX_VIS_FLCTRL_COUNTER 0x0000000870
746
747#define R_BCM1480_HSP_RX_PKT_RAMALLOC_0 0x0000020020
748#define R_BCM1480_HSP_RX_PKT_RAMALLOC_1 0x0000020028
749#define R_BCM1480_HSP_RX_PKT_RAMALLOC_2 0x0000020030
750#define R_BCM1480_HSP_RX_PKT_RAMALLOC_3 0x0000020038
751#define R_BCM1480_HSP_RX_PKT_RAMALLOC_4 0x0000020040
752#define R_BCM1480_HSP_RX_PKT_RAMALLOC_5 0x0000020048
753#define R_BCM1480_HSP_RX_PKT_RAMALLOC_6 0x0000020050
754#define R_BCM1480_HSP_RX_PKT_RAMALLOC_7 0x0000020058
755#define R_BCM1480_HSP_RX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_RX_PKT_RAMALLOC_0 + 8*(idx))
756
757/* XXX Following registers were shuffled. Renamed/renumbered per errata. */
758#define R_BCM1480_HSP_RX_HT_RAMALLOC_0 0x0000020078
759#define R_BCM1480_HSP_RX_HT_RAMALLOC_1 0x0000020080
760#define R_BCM1480_HSP_RX_HT_RAMALLOC_2 0x0000020088
761#define R_BCM1480_HSP_RX_HT_RAMALLOC_3 0x0000020090
762#define R_BCM1480_HSP_RX_HT_RAMALLOC_4 0x0000020098
763#define R_BCM1480_HSP_RX_HT_RAMALLOC_5 0x00000200A0
764
765#define R_BCM1480_HSP_RX_SPI_WATERMARK_0 0x00000200B0
766#define R_BCM1480_HSP_RX_SPI_WATERMARK_1 0x00000200B8
767#define R_BCM1480_HSP_RX_SPI_WATERMARK_2 0x00000200C0
768#define R_BCM1480_HSP_RX_SPI_WATERMARK_3 0x00000200C8
769#define R_BCM1480_HSP_RX_SPI_WATERMARK_4 0x00000200D0
770#define R_BCM1480_HSP_RX_SPI_WATERMARK_5 0x00000200D8
771#define R_BCM1480_HSP_RX_SPI_WATERMARK_6 0x00000200E0
772#define R_BCM1480_HSP_RX_SPI_WATERMARK_7 0x00000200E8
773#define R_BCM1480_HSP_RX_SPI_WATERMARK(idx) (R_BCM1480_HSP_RX_SPI_WATERMARK_0 + 8*(idx))
774
775#define R_BCM1480_HSP_RX_VIS_CMDQ_0 0x00000200F0
776#define R_BCM1480_HSP_RX_VIS_CMDQ_1 0x00000200F8
777#define R_BCM1480_HSP_RX_VIS_CMDQ_2 0x0000020100
778#define R_BCM1480_HSP_RX_RAM_READCTL 0x0000020108
779#define R_BCM1480_HSP_RX_RAM_READWINDOW 0x0000020110
780#define R_BCM1480_HSP_RX_RF_READCTL 0x0000020118
781#define R_BCM1480_HSP_RX_RF_READWINDOW 0x0000020120
782
783#define R_BCM1480_HSP_TX_SPI4_CFG_0 0x0000040000
784#define R_BCM1480_HSP_TX_SPI4_CFG_1 0x0000040008
785#define R_BCM1480_HSP_TX_SPI4_TRAINING_FMT 0x0000040010
786
787#define R_BCM1480_HSP_TX_PKT_RAMALLOC_0 0x0000040020
788#define R_BCM1480_HSP_TX_PKT_RAMALLOC_1 0x0000040028
789#define R_BCM1480_HSP_TX_PKT_RAMALLOC_2 0x0000040030
790#define R_BCM1480_HSP_TX_PKT_RAMALLOC_3 0x0000040038
791#define R_BCM1480_HSP_TX_PKT_RAMALLOC_4 0x0000040040
792#define R_BCM1480_HSP_TX_PKT_RAMALLOC_5 0x0000040048
793#define R_BCM1480_HSP_TX_PKT_RAMALLOC_6 0x0000040050
794#define R_BCM1480_HSP_TX_PKT_RAMALLOC_7 0x0000040058
795#define R_BCM1480_HSP_TX_PKT_RAMALLOC(idx) (R_BCM1480_HSP_TX_PKT_RAMALLOC_0 + 8*(idx))
796#define R_BCM1480_HSP_TX_NPC_RAMALLOC 0x0000040078
797#define R_BCM1480_HSP_TX_RSP_RAMALLOC 0x0000040080
798#define R_BCM1480_HSP_TX_PC_RAMALLOC 0x0000040088
799#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_0 0x0000040090
800#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_1 0x0000040098
801#define R_BCM1480_HSP_TX_HTCC_RAMALLOC_2 0x00000400A0
802
803#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 0x00000400B0
804#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_1 0x00000400B8
805#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_2 0x00000400C0
806#define R_BCM1480_HSP_TX_PKT_RXPHITCNT_3 0x00000400C8
807#define R_BCM1480_HSP_TX_PKT_RXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_RXPHITCNT_0 + 8*(idx))
808#define R_BCM1480_HSP_TX_HTIO_RXPHITCNT 0x00000400D0
809#define R_BCM1480_HSP_TX_HTCC_RXPHITCNT 0x00000400D8
810
811#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 0x00000400E0
812#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_1 0x00000400E8
813#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_2 0x00000400F0
814#define R_BCM1480_HSP_TX_PKT_TXPHITCNT_3 0x00000400F8
815#define R_BCM1480_HSP_TX_PKT_TXPHITCNT(idx) (R_BCM1480_HSP_TX_PKT_TXPHITCNT_0 + 8*(idx))
816#define R_BCM1480_HSP_TX_HTIO_TXPHITCNT 0x0000040100
817#define R_BCM1480_HSP_TX_HTCC_TXPHITCNT 0x0000040108
818
819#define R_BCM1480_HSP_TX_SPI4_CALENDAR_0 0x0000040200
820#define R_BCM1480_HSP_TX_SPI4_CALENDAR_1 0x0000040208
821
822#define R_BCM1480_HSP_TX_PLL_CNFG 0x0000040800
823#define R_BCM1480_HSP_TX_CALIBRATION 0x0000040808
824#define R_BCM1480_HSP_TX_TEST 0x0000040810
825
826#define R_BCM1480_HSP_TX_VIS_CMDQ_0 0x0000040840
827#define R_BCM1480_HSP_TX_VIS_CMDQ_1 0x0000040848
828#define R_BCM1480_HSP_TX_VIS_CMDQ_2 0x0000040850
829#define R_BCM1480_HSP_TX_RAM_READCTL 0x0000040860
830#define R_BCM1480_HSP_TX_RAM_READWINDOW 0x0000040868
831#define R_BCM1480_HSP_TX_RF_READCTL 0x0000040870
832#define R_BCM1480_HSP_TX_RF_READWINDOW 0x0000040878
833
834#define R_BCM1480_HSP_TX_SPI4_PORT_INT_STATUS 0x0000040880
835#define R_BCM1480_HSP_TX_SPI4_PORT_INT_EN 0x0000040888
836
837#define R_BCM1480_HSP_TX_NEXT_ADDR_BASE 0x000040400
838#define R_BCM1480_HSP_TX_NEXT_ADDR_REGISTER(x) (R_BCM1480_HSP_TX_NEXT_ADDR_BASE+ 8*(x))
839
840
841
842/* *********************************************************************
843 * Physical Address Map (Table 10 and Figure 7)
844 ********************************************************************* */
845
846#define A_BCM1480_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
847#define A_BCM1480_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
848#define A_BCM1480_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
849#define A_BCM1480_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
850#define A_BCM1480_PHYS_GENBUS _SB_MAKE64(0x0010090000)
851#define A_BCM1480_PHYS_GENBUS_END _SB_MAKE64(0x0028000000)
852#define A_BCM1480_PHYS_PCI_MISC_MATCH_BYTES _SB_MAKE64(0x0028000000)
853#define A_BCM1480_PHYS_PCI_IACK_MATCH_BYTES _SB_MAKE64(0x0029000000)
854#define A_BCM1480_PHYS_PCI_IO_MATCH_BYTES _SB_MAKE64(0x002C000000)
855#define A_BCM1480_PHYS_PCI_CFG_MATCH_BYTES _SB_MAKE64(0x002E000000)
856#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BYTES _SB_MAKE64(0x002F000000)
857#define A_BCM1480_PHYS_PCI_MEM_MATCH_BYTES _SB_MAKE64(0x0030000000)
858#define A_BCM1480_PHYS_HT_MEM_MATCH_BYTES _SB_MAKE64(0x0040000000)
859#define A_BCM1480_PHYS_HT_MEM_MATCH_BITS _SB_MAKE64(0x0060000000)
860#define A_BCM1480_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
861#define A_BCM1480_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
862#define A_BCM1480_PHYS_PCI_MISC_MATCH_BITS _SB_MAKE64(0x00A8000000)
863#define A_BCM1480_PHYS_PCI_IACK_MATCH_BITS _SB_MAKE64(0x00A9000000)
864#define A_BCM1480_PHYS_PCI_IO_MATCH_BITS _SB_MAKE64(0x00AC000000)
865#define A_BCM1480_PHYS_PCI_CFG_MATCH_BITS _SB_MAKE64(0x00AE000000)
866#define A_BCM1480_PHYS_PCI_OMAP_MATCH_BITS _SB_MAKE64(0x00AF000000)
867#define A_BCM1480_PHYS_PCI_MEM_MATCH_BITS _SB_MAKE64(0x00B0000000)
868#define A_BCM1480_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
869#define A_BCM1480_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
870#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
871#define A_BCM1480_PHYS_HT_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
872#define A_BCM1480_PHYS_HT_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
873#define A_BCM1480_PHYS_HS_SUBSYS _SB_MAKE64(0x00DF000000)
874#define A_BCM1480_PHYS_HT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
875#define A_BCM1480_PHYS_HT_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
876#define A_BCM1480_PHYS_HT_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
877#define A_BCM1480_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
878#define A_BCM1480_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
879#define A_BCM1480_PHYS_PCI_UPPER _SB_MAKE64(0x1000000000)
880#define A_BCM1480_PHYS_HT_UPPER_MATCH_BYTES _SB_MAKE64(0x2000000000)
881#define A_BCM1480_PHYS_HT_UPPER_MATCH_BITS _SB_MAKE64(0x3000000000)
882#define A_BCM1480_PHYS_HT_NODE_ALIAS _SB_MAKE64(0x4000000000)
883#define A_BCM1480_PHYS_HT_FULLACCESS _SB_MAKE64(0xF000000000)
884
885
886/* *********************************************************************
887 * L2 Cache as RAM (Table 54)
888 ********************************************************************* */
889
890#define A_BCM1480_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
891#define BCM1480_PHYS_L2CACHE_NUM_WAYS 8
892#define A_BCM1480_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000100000)
893#define A_BCM1480_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0300000)
894#define A_BCM1480_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D0320000)
895#define A_BCM1480_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D0340000)
896#define A_BCM1480_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D0360000)
897#define A_BCM1480_PHYS_L2CACHE_WAY4 _SB_MAKE64(0x00D0380000)
898#define A_BCM1480_PHYS_L2CACHE_WAY5 _SB_MAKE64(0x00D03A0000)
899#define A_BCM1480_PHYS_L2CACHE_WAY6 _SB_MAKE64(0x00D03C0000)
900#define A_BCM1480_PHYS_L2CACHE_WAY7 _SB_MAKE64(0x00D03E0000)
901
902#endif /* _BCM1480_REGS_H */
diff --git a/include/asm-mips/sibyte/bcm1480_scd.h b/include/asm-mips/sibyte/bcm1480_scd.h
deleted file mode 100644
index 25ef24cbb92a..000000000000
--- a/include/asm-mips/sibyte/bcm1480_scd.h
+++ /dev/null
@@ -1,406 +0,0 @@
1/* *********************************************************************
2 * BCM1280/BCM1400 Board Support Package
3 *
4 * SCD Constants and Macros File: bcm1480_scd.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the System Control and Debug module.
8 *
9 * BCM1400 specification level: 1X55_1X80-UM100-R (12/18/03)
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _BCM1480_SCD_H
33#define _BCM1480_SCD_H
34
35#include "sb1250_defs.h"
36
37/* *********************************************************************
38 * Pull in the BCM1250's SCD since lots of stuff is the same.
39 ********************************************************************* */
40
41#include "sb1250_scd.h"
42
43/* *********************************************************************
44 * Some general notes:
45 *
46 * This file is basically a "what's new" header file. Since the
47 * BCM1250 and the new BCM1480 (and derivatives) share many common
48 * features, this file contains only what's new or changed from
49 * the 1250. (above, you can see that we include the 1250 symbols
50 * to get the base functionality).
51 *
52 * In software, be sure to use the correct symbols, particularly
53 * for blocks that are different between the two chip families.
54 * All BCM1480-specific symbols have _BCM1480_ in their names,
55 * and all BCM1250-specific and "base" functions that are common in
56 * both chips have no special names (this is for compatibility with
57 * older include files). Therefore, if you're working with the
58 * SCD, which is very different on each chip, A_SCD_xxx implies
59 * the BCM1250 version and A_BCM1480_SCD_xxx implies the BCM1480
60 * version.
61 ********************************************************************* */
62
63/* *********************************************************************
64 * System control/debug registers
65 ********************************************************************* */
66
67/*
68 * System Identification and Revision Register (Table 12)
69 * Register: SCD_SYSTEM_REVISION
70 * This register is field compatible with the 1250.
71 */
72
73/*
74 * New part definitions
75 */
76
77#define K_SYS_PART_BCM1480 0x1406
78#define K_SYS_PART_BCM1280 0x1206
79#define K_SYS_PART_BCM1455 0x1407
80#define K_SYS_PART_BCM1255 0x1257
81#define K_SYS_PART_BCM1158 0x1156
82
83/*
84 * Manufacturing Information Register (Table 14)
85 * Register: SCD_SYSTEM_MANUF
86 */
87
88/*
89 * System Configuration Register (Table 15)
90 * Register: SCD_SYSTEM_CFG
91 * Entire register is different from 1250, all new constants below
92 */
93
94#define M_BCM1480_SYS_RESERVED0 _SB_MAKEMASK1(0)
95#define M_BCM1480_SYS_HT_MINRSTCNT _SB_MAKEMASK1(1)
96#define M_BCM1480_SYS_RESERVED2 _SB_MAKEMASK1(2)
97#define M_BCM1480_SYS_RESERVED3 _SB_MAKEMASK1(3)
98#define M_BCM1480_SYS_RESERVED4 _SB_MAKEMASK1(4)
99#define M_BCM1480_SYS_IOB_DIV _SB_MAKEMASK1(5)
100
101#define S_BCM1480_SYS_PLL_DIV _SB_MAKE64(6)
102#define M_BCM1480_SYS_PLL_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_PLL_DIV)
103#define V_BCM1480_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_PLL_DIV)
104#define G_BCM1480_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_PLL_DIV, M_BCM1480_SYS_PLL_DIV)
105
106#define S_BCM1480_SYS_SW_DIV _SB_MAKE64(11)
107#define M_BCM1480_SYS_SW_DIV _SB_MAKEMASK(5, S_BCM1480_SYS_SW_DIV)
108#define V_BCM1480_SYS_SW_DIV(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_SW_DIV)
109#define G_BCM1480_SYS_SW_DIV(x) _SB_GETVALUE(x, S_BCM1480_SYS_SW_DIV, M_BCM1480_SYS_SW_DIV)
110
111#define M_BCM1480_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
112#define M_BCM1480_SYS_DUART1_ENABLE _SB_MAKEMASK1(17)
113
114#define S_BCM1480_SYS_BOOT_MODE _SB_MAKE64(18)
115#define M_BCM1480_SYS_BOOT_MODE _SB_MAKEMASK(2, S_BCM1480_SYS_BOOT_MODE)
116#define V_BCM1480_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_BOOT_MODE)
117#define G_BCM1480_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_BCM1480_SYS_BOOT_MODE, M_BCM1480_SYS_BOOT_MODE)
118#define K_BCM1480_SYS_BOOT_MODE_ROM32 0
119#define K_BCM1480_SYS_BOOT_MODE_ROM8 1
120#define K_BCM1480_SYS_BOOT_MODE_SMBUS_SMALL 2
121#define K_BCM1480_SYS_BOOT_MODE_SMBUS_BIG 3
122#define M_BCM1480_SYS_BOOT_MODE_SMBUS _SB_MAKEMASK1(19)
123
124#define M_BCM1480_SYS_PCI_HOST _SB_MAKEMASK1(20)
125#define M_BCM1480_SYS_PCI_ARBITER _SB_MAKEMASK1(21)
126#define M_BCM1480_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
127#define M_BCM1480_SYS_GENCLK_EN _SB_MAKEMASK1(23)
128#define M_BCM1480_SYS_GEN_PARITY_EN _SB_MAKEMASK1(24)
129#define M_BCM1480_SYS_RESERVED25 _SB_MAKEMASK1(25)
130
131#define S_BCM1480_SYS_CONFIG 26
132#define M_BCM1480_SYS_CONFIG _SB_MAKEMASK(6, S_BCM1480_SYS_CONFIG)
133#define V_BCM1480_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_CONFIG)
134#define G_BCM1480_SYS_CONFIG(x) _SB_GETVALUE(x, S_BCM1480_SYS_CONFIG, M_BCM1480_SYS_CONFIG)
135
136#define M_BCM1480_SYS_RESERVED32 _SB_MAKEMASK(32, 15)
137
138#define S_BCM1480_SYS_NODEID 47
139#define M_BCM1480_SYS_NODEID _SB_MAKEMASK(4, S_BCM1480_SYS_NODEID)
140#define V_BCM1480_SYS_NODEID(x) _SB_MAKEVALUE(x, S_BCM1480_SYS_NODEID)
141#define G_BCM1480_SYS_NODEID(x) _SB_GETVALUE(x, S_BCM1480_SYS_NODEID, M_BCM1480_SYS_NODEID)
142
143#define M_BCM1480_SYS_CCNUMA_EN _SB_MAKEMASK1(51)
144#define M_BCM1480_SYS_CPU_RESET_0 _SB_MAKEMASK1(52)
145#define M_BCM1480_SYS_CPU_RESET_1 _SB_MAKEMASK1(53)
146#define M_BCM1480_SYS_CPU_RESET_2 _SB_MAKEMASK1(54)
147#define M_BCM1480_SYS_CPU_RESET_3 _SB_MAKEMASK1(55)
148#define S_BCM1480_SYS_DISABLECPU0 56
149#define M_BCM1480_SYS_DISABLECPU0 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU0)
150#define S_BCM1480_SYS_DISABLECPU1 57
151#define M_BCM1480_SYS_DISABLECPU1 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU1)
152#define S_BCM1480_SYS_DISABLECPU2 58
153#define M_BCM1480_SYS_DISABLECPU2 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU2)
154#define S_BCM1480_SYS_DISABLECPU3 59
155#define M_BCM1480_SYS_DISABLECPU3 _SB_MAKEMASK1(S_BCM1480_SYS_DISABLECPU3)
156
157#define M_BCM1480_SYS_SB_SOFTRES _SB_MAKEMASK1(60)
158#define M_BCM1480_SYS_EXT_RESET _SB_MAKEMASK1(61)
159#define M_BCM1480_SYS_SYSTEM_RESET _SB_MAKEMASK1(62)
160#define M_BCM1480_SYS_SW_FLAG _SB_MAKEMASK1(63)
161
162/*
163 * Scratch Register (Table 16)
164 * Register: SCD_SYSTEM_SCRATCH
165 * Same as BCM1250
166 */
167
168
169/*
170 * Mailbox Registers (Table 17)
171 * Registers: SCD_MBOX_{0,1}_CPU_x
172 * Same as BCM1250
173 */
174
175
176/*
177 * See bcm1480_int.h for interrupt mapper registers.
178 */
179
180
181/*
182 * Watchdog Timer Initial Count Registers (Table 23)
183 * Registers: SCD_WDOG_INIT_CNT_x
184 *
185 * The watchdogs are almost the same as the 1250, except
186 * the configuration register has more bits to control the
187 * other CPUs.
188 */
189
190
191/*
192 * Watchdog Timer Configuration Registers (Table 25)
193 * Registers: SCD_WDOG_CFG_x
194 */
195
196#define M_BCM1480_SCD_WDOG_ENABLE _SB_MAKEMASK1(0)
197
198#define S_BCM1480_SCD_WDOG_RESET_TYPE 2
199#define M_BCM1480_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(5, S_BCM1480_SCD_WDOG_RESET_TYPE)
200#define V_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE)
201#define G_BCM1480_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_BCM1480_SCD_WDOG_RESET_TYPE, M_BCM1480_SCD_WDOG_RESET_TYPE)
202
203#define K_BCM1480_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
204#define K_BCM1480_SCD_WDOG_RESET_SOFT 1
205#define K_BCM1480_SCD_WDOG_RESET_CPU0 3
206#define K_BCM1480_SCD_WDOG_RESET_CPU1 5
207#define K_BCM1480_SCD_WDOG_RESET_CPU2 9
208#define K_BCM1480_SCD_WDOG_RESET_CPU3 17
209#define K_BCM1480_SCD_WDOG_RESET_ALL_CPUS 31
210
211
212#define M_BCM1480_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(8)
213
214/*
215 * General Timer Initial Count Registers (Table 26)
216 * Registers: SCD_TIMER_INIT_x
217 *
218 * The timer registers are the same as the BCM1250
219 */
220
221
222/*
223 * ZBbus Count Register (Table 29)
224 * Register: ZBBUS_CYCLE_COUNT
225 *
226 * Same as BCM1250
227 */
228
229/*
230 * ZBbus Compare Registers (Table 30)
231 * Registers: ZBBUS_CYCLE_CPx
232 *
233 * Same as BCM1250
234 */
235
236
237/*
238 * System Performance Counter Configuration Register (Table 31)
239 * Register: PERF_CNT_CFG_0
240 *
241 * SPC_CFG_SRC[0-3] is the same as the 1250.
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.
244 */
245
246#define S_SPC_CFG_SRC4 32
247#define M_SPC_CFG_SRC4 _SB_MAKEMASK(8, S_SPC_CFG_SRC4)
248#define V_SPC_CFG_SRC4(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC4)
249#define G_SPC_CFG_SRC4(x) _SB_GETVALUE(x, S_SPC_CFG_SRC4, M_SPC_CFG_SRC4)
250
251#define S_SPC_CFG_SRC5 40
252#define M_SPC_CFG_SRC5 _SB_MAKEMASK(8, S_SPC_CFG_SRC5)
253#define V_SPC_CFG_SRC5(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC5)
254#define G_SPC_CFG_SRC5(x) _SB_GETVALUE(x, S_SPC_CFG_SRC5, M_SPC_CFG_SRC5)
255
256#define S_SPC_CFG_SRC6 48
257#define M_SPC_CFG_SRC6 _SB_MAKEMASK(8, S_SPC_CFG_SRC6)
258#define V_SPC_CFG_SRC6(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC6)
259#define G_SPC_CFG_SRC6(x) _SB_GETVALUE(x, S_SPC_CFG_SRC6, M_SPC_CFG_SRC6)
260
261#define S_SPC_CFG_SRC7 56
262#define M_SPC_CFG_SRC7 _SB_MAKEMASK(8, S_SPC_CFG_SRC7)
263#define V_SPC_CFG_SRC7(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC7)
264#define G_SPC_CFG_SRC7(x) _SB_GETVALUE(x, S_SPC_CFG_SRC7, M_SPC_CFG_SRC7)
265
266/*
267 * System Performance Counter Control Register (Table 32)
268 * Register: PERF_CNT_CFG_1
269 * BCM1480 specific
270 */
271#define M_BCM1480_SPC_CFG_CLEAR _SB_MAKEMASK1(0)
272#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
277
278/*
279 * System Performance Counters (Table 33)
280 * Registers: PERF_CNT_x
281 */
282
283#define S_BCM1480_SPC_CNT_COUNT 0
284#define M_BCM1480_SPC_CNT_COUNT _SB_MAKEMASK(40, S_BCM1480_SPC_CNT_COUNT)
285#define V_BCM1480_SPC_CNT_COUNT(x) _SB_MAKEVALUE(x, S_BCM1480_SPC_CNT_COUNT)
286#define G_BCM1480_SPC_CNT_COUNT(x) _SB_GETVALUE(x, S_BCM1480_SPC_CNT_COUNT, M_BCM1480_SPC_CNT_COUNT)
287
288#define M_BCM1480_SPC_CNT_OFLOW _SB_MAKEMASK1(40)
289
290
291/*
292 * Bus Watcher Error Status Register (Tables 36, 37)
293 * Registers: BUS_ERR_STATUS, BUS_ERR_STATUS_DEBUG
294 * Same as BCM1250.
295 */
296
297/*
298 * Bus Watcher Error Data Registers (Table 38)
299 * Registers: BUS_ERR_DATA_x
300 * Same as BCM1250.
301 */
302
303/*
304 * Bus Watcher L2 ECC Counter Register (Table 39)
305 * Register: BUS_L2_ERRORS
306 * Same as BCM1250.
307 */
308
309
310/*
311 * Bus Watcher Memory and I/O Error Counter Register (Table 40)
312 * Register: BUS_MEM_IO_ERRORS
313 * Same as BCM1250.
314 */
315
316
317/*
318 * Address Trap Registers
319 *
320 * Register layout same as BCM1250, almost. The bus agents
321 * are different, and the address trap configuration bits are
322 * slightly different.
323 */
324
325#define M_BCM1480_ATRAP_INDEX _SB_MAKEMASK(4, 0)
326#define M_BCM1480_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
327
328#define S_BCM1480_ATRAP_CFG_CNT 0
329#define M_BCM1480_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_BCM1480_ATRAP_CFG_CNT)
330#define V_BCM1480_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CNT)
331#define G_BCM1480_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CNT, M_BCM1480_ATRAP_CFG_CNT)
332
333#define M_BCM1480_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
334#define M_BCM1480_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
335#define M_BCM1480_ATRAP_CFG_INV _SB_MAKEMASK1(5)
336#define M_BCM1480_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
337#define M_BCM1480_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
338
339#define S_BCM1480_ATRAP_CFG_AGENTID 8
340#define M_BCM1480_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_BCM1480_ATRAP_CFG_AGENTID)
341#define V_BCM1480_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID)
342#define G_BCM1480_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_AGENTID, M_BCM1480_ATRAP_CFG_AGENTID)
343
344
345#define K_BCM1480_BUS_AGENT_CPU0 0
346#define K_BCM1480_BUS_AGENT_CPU1 1
347#define K_BCM1480_BUS_AGENT_NC 2
348#define K_BCM1480_BUS_AGENT_IOB 3
349#define K_BCM1480_BUS_AGENT_SCD 4
350#define K_BCM1480_BUS_AGENT_L2C 6
351#define K_BCM1480_BUS_AGENT_MC 7
352#define K_BCM1480_BUS_AGENT_CPU2 8
353#define K_BCM1480_BUS_AGENT_CPU3 9
354#define K_BCM1480_BUS_AGENT_PM 10
355
356#define S_BCM1480_ATRAP_CFG_CATTR 12
357#define M_BCM1480_ATRAP_CFG_CATTR _SB_MAKEMASK(2, S_BCM1480_ATRAP_CFG_CATTR)
358#define V_BCM1480_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_BCM1480_ATRAP_CFG_CATTR)
359#define G_BCM1480_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_BCM1480_ATRAP_CFG_CATTR, M_BCM1480_ATRAP_CFG_CATTR)
360
361#define K_BCM1480_ATRAP_CFG_CATTR_IGNORE 0
362#define K_BCM1480_ATRAP_CFG_CATTR_UNC 1
363#define K_BCM1480_ATRAP_CFG_CATTR_NONCOH 2
364#define K_BCM1480_ATRAP_CFG_CATTR_COHERENT 3
365
366#define M_BCM1480_ATRAP_CFG_CATTRINV _SB_MAKEMASK1(14)
367
368
369/*
370 * Trace Event Registers (Table 47)
371 * Same as BCM1250.
372 */
373
374/*
375 * Trace Sequence Control Registers (Table 48)
376 * Registers: TRACE_SEQUENCE_x
377 *
378 * Same as BCM1250 except for two new fields.
379 */
380
381
382#define M_BCM1480_SCD_TRSEQ_TID_MATCH_EN _SB_MAKEMASK1(25)
383
384#define S_BCM1480_SCD_TRSEQ_SWFUNC 26
385#define M_BCM1480_SCD_TRSEQ_SWFUNC _SB_MAKEMASK(2, S_BCM1480_SCD_TRSEQ_SWFUNC)
386#define V_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC)
387#define G_BCM1480_SCD_TRSEQ_SWFUNC(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRSEQ_SWFUNC, M_BCM1480_SCD_TRSEQ_SWFUNC)
388
389/*
390 * Trace Control Register (Table 49)
391 * Register: TRACE_CFG
392 *
393 * BCM1480 changes to this register (other than location of the CUR_ADDR field)
394 * are defined below.
395 */
396
397#define S_BCM1480_SCD_TRACE_CFG_MODE 16
398#define M_BCM1480_SCD_TRACE_CFG_MODE _SB_MAKEMASK(2, S_BCM1480_SCD_TRACE_CFG_MODE)
399#define V_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_MAKEVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE)
400#define G_BCM1480_SCD_TRACE_CFG_MODE(x) _SB_GETVALUE(x, S_BCM1480_SCD_TRACE_CFG_MODE, M_BCM1480_SCD_TRACE_CFG_MODE)
401
402#define K_BCM1480_SCD_TRACE_CFG_MODE_BLOCKERS 0
403#define K_BCM1480_SCD_TRACE_CFG_MODE_BYTEEN_INT 1
404#define K_BCM1480_SCD_TRACE_CFG_MODE_FLOW_ID 2
405
406#endif /* _BCM1480_SCD_H */
diff --git a/include/asm-mips/sibyte/bigsur.h b/include/asm-mips/sibyte/bigsur.h
deleted file mode 100644
index ebefe797fc1d..000000000000
--- a/include/asm-mips/sibyte/bigsur.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2000,2001,2002,2003,2004 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#ifndef __ASM_SIBYTE_BIGSUR_H
19#define __ASM_SIBYTE_BIGSUR_H
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/bcm1480_int.h>
23
24#ifdef CONFIG_SIBYTE_BIGSUR
25#define SIBYTE_BOARD_NAME "BCM91x80A/B (BigSur)"
26#define SIBYTE_HAVE_PCMCIA 1
27#define SIBYTE_HAVE_IDE 1
28#endif
29
30/* Generic bus chip selects */
31#define LEDS_CS 3
32#define LEDS_PHYS 0x100a0000
33
34#ifdef SIBYTE_HAVE_IDE
35#define IDE_CS 4
36#define IDE_PHYS 0x100b0000
37#define K_GPIO_GB_IDE 4
38#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
39#endif
40
41#ifdef SIBYTE_HAVE_PCMCIA
42#define PCMCIA_CS 6
43#define PCMCIA_PHYS 0x11000000
44#define K_GPIO_PC_READY 9
45#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
46#endif
47
48#endif /* __ASM_SIBYTE_BIGSUR_H */
49
diff --git a/include/asm-mips/sibyte/board.h b/include/asm-mips/sibyte/board.h
deleted file mode 100644
index 25372ae0e814..000000000000
--- a/include/asm-mips/sibyte/board.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 2000,2001,2002,2003,2004 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 _SIBYTE_BOARD_H
20#define _SIBYTE_BOARD_H
21
22#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_CRHONE) || \
23 defined(CONFIG_SIBYTE_CRHINE) || defined(CONFIG_SIBYTE_LITTLESUR)
24#include <asm/sibyte/swarm.h>
25#endif
26
27#if defined(CONFIG_SIBYTE_SENTOSA) || defined(CONFIG_SIBYTE_RHONE)
28#include <asm/sibyte/sentosa.h>
29#endif
30
31#ifdef CONFIG_SIBYTE_CARMEL
32#include <asm/sibyte/carmel.h>
33#endif
34
35#ifdef CONFIG_SIBYTE_BIGSUR
36#include <asm/sibyte/bigsur.h>
37#endif
38
39#ifdef __ASSEMBLY__
40
41#ifdef LEDS_PHYS
42#define setleds(t0, t1, c0, c1, c2, c3) \
43 li t0, (LEDS_PHYS|0xa0000000); \
44 li t1, c0; \
45 sb t1, 0x18(t0); \
46 li t1, c1; \
47 sb t1, 0x10(t0); \
48 li t1, c2; \
49 sb t1, 0x08(t0); \
50 li t1, c3; \
51 sb t1, 0x00(t0)
52#else
53#define setleds(t0, t1, c0, c1, c2, c3)
54#endif /* LEDS_PHYS */
55
56#else
57
58void swarm_setup(void);
59
60#ifdef LEDS_PHYS
61extern void setleds(char *str);
62#else
63#define setleds(s) do { } while (0)
64#endif /* LEDS_PHYS */
65
66#endif /* __ASSEMBLY__ */
67
68#endif /* _SIBYTE_BOARD_H */
diff --git a/include/asm-mips/sibyte/carmel.h b/include/asm-mips/sibyte/carmel.h
deleted file mode 100644
index 11cad71323e8..000000000000
--- a/include/asm-mips/sibyte/carmel.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (C) 2002 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#ifndef __ASM_SIBYTE_CARMEL_H
19#define __ASM_SIBYTE_CARMEL_H
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/sb1250_int.h>
23
24#define SIBYTE_BOARD_NAME "Carmel"
25
26#define GPIO_PHY_INTERRUPT 2
27#define GPIO_NONMASKABLE_INT 3
28#define GPIO_CF_INSERTED 6
29#define GPIO_MONTEREY_RESET 7
30#define GPIO_QUADUART_INT 8
31#define GPIO_CF_INT 9
32#define GPIO_FPGA_CCLK 10
33#define GPIO_FPGA_DOUT 11
34#define GPIO_FPGA_DIN 12
35#define GPIO_FPGA_PGM 13
36#define GPIO_FPGA_DONE 14
37#define GPIO_FPGA_INIT 15
38
39#define LEDS_CS 2
40#define LEDS_PHYS 0x100C0000
41#define MLEDS_CS 3
42#define MLEDS_PHYS 0x100A0000
43#define UART_CS 4
44#define UART_PHYS 0x100D0000
45#define ARAVALI_CS 5
46#define ARAVALI_PHYS 0x11000000
47#define IDE_CS 6
48#define IDE_PHYS 0x100B0000
49#define ARAVALI2_CS 7
50#define ARAVALI2_PHYS 0x100E0000
51
52#if defined(CONFIG_SIBYTE_CARMEL)
53#define K_GPIO_GB_IDE 9
54#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
55#endif
56
57
58#endif /* __ASM_SIBYTE_CARMEL_H */
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
deleted file mode 100644
index 80c1a052662a..000000000000
--- a/include/asm-mips/sibyte/sb1250.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef _ASM_SIBYTE_SB1250_H
20#define _ASM_SIBYTE_SB1250_H
21
22/*
23 * yymmddpp: year, month, day, patch.
24 * should sync with Makefile EXTRAVERSION
25 */
26#define SIBYTE_RELEASE 0x02111403
27
28#define SB1250_NR_IRQS 64
29
30#define BCM1480_NR_IRQS 128
31#define BCM1480_NR_IRQS_HALF 64
32
33#define SB1250_DUART_MINOR_BASE 64
34
35#ifndef __ASSEMBLY__
36
37#include <asm/addrspace.h>
38
39/* For revision/pass information */
40#include <asm/sibyte/sb1250_scd.h>
41#include <asm/sibyte/bcm1480_scd.h>
42extern unsigned int sb1_pass;
43extern unsigned int soc_pass;
44extern unsigned int soc_type;
45extern unsigned int periph_rev;
46extern unsigned int zbbus_mhz;
47
48extern void sb1250_time_init(void);
49extern void sb1250_mask_irq(int cpu, int irq);
50extern void sb1250_unmask_irq(int cpu, int irq);
51
52extern void bcm1480_time_init(void);
53extern void bcm1480_mask_irq(int cpu, int irq);
54extern void bcm1480_unmask_irq(int cpu, int irq);
55
56#define AT_spin \
57 __asm__ __volatile__ ( \
58 ".set noat\n" \
59 "li $at, 0\n" \
60 "1: beqz $at, 1b\n" \
61 ".set at\n" \
62 )
63
64#endif
65
66#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
67
68#endif
diff --git a/include/asm-mips/sibyte/sb1250_defs.h b/include/asm-mips/sibyte/sb1250_defs.h
deleted file mode 100644
index 09365f9111fa..000000000000
--- a/include/asm-mips/sibyte/sb1250_defs.h
+++ /dev/null
@@ -1,259 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Global constants and macros File: sb1250_defs.h
5 *
6 * This file contains macros and definitions used by the other
7 * include files.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _SB1250_DEFS_H
33#define _SB1250_DEFS_H
34
35/*
36 * These headers require ANSI C89 string concatenation, and GCC or other
37 * 'long long' (64-bit integer) support.
38 */
39#if !defined(__STDC__) && !defined(_MSC_VER)
40#error SiByte headers require ANSI C89 support
41#endif
42
43
44/* *********************************************************************
45 * Macros for feature tests, used to enable include file features
46 * for chip features only present in certain chip revisions.
47 *
48 * SIBYTE_HDR_FEATURES may be defined to be the mask value chip/revision
49 * which is to be exposed by the headers. If undefined, it defaults to
50 * "all features."
51 *
52 * Use like:
53 *
54 * #define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_112x_PASS1
55 *
56 * Generate defines only for that revision of chip.
57 *
58 * #if SIBYTE_HDR_FEATURE(chip,pass)
59 *
60 * True if header features for that revision or later of
61 * that particular chip type are enabled in SIBYTE_HDR_FEATURES.
62 * (Use this to bracket #defines for features present in a given
63 * revision and later.)
64 *
65 * Note that there is no implied ordering between chip types.
66 *
67 * Note also that 'chip' and 'pass' must textually exactly
68 * match the defines below. So, for example,
69 * SIBYTE_HDR_FEATURE(112x, PASS1) is OK, but
70 * SIBYTE_HDR_FEATURE(1120, pass1) is not (for two reasons).
71 *
72 * #if SIBYTE_HDR_FEATURE_UP_TO(chip,pass)
73 *
74 * Same as SIBYTE_HDR_FEATURE, but true for the named revision
75 * and earlier revisions of the named chip type.
76 *
77 * #if SIBYTE_HDR_FEATURE_EXACT(chip,pass)
78 *
79 * Same as SIBYTE_HDR_FEATURE, but only true for the named
80 * revision of the named chip type. (Note that this CANNOT
81 * be used to verify that you're compiling only for that
82 * particular chip/revision. It will be true any time this
83 * chip/revision is included in SIBYTE_HDR_FEATURES.)
84 *
85 * #if SIBYTE_HDR_FEATURE_CHIP(chip)
86 *
87 * True if header features for (any revision of) that chip type
88 * are enabled in SIBYTE_HDR_FEATURES. (Use this to bracket
89 * #defines for features specific to a given chip type.)
90 *
91 * Mask values currently include room for additional revisions of each
92 * chip type, but can be renumbered at will. Note that they MUST fit
93 * into 31 bits and may not include C type constructs, for safe use in
94 * CPP conditionals. Bit positions within chip types DO indicate
95 * ordering, so be careful when adding support for new minor revs.
96 ********************************************************************* */
97
98#define SIBYTE_HDR_FMASK_1250_ALL 0x000000ff
99#define SIBYTE_HDR_FMASK_1250_PASS1 0x00000001
100#define SIBYTE_HDR_FMASK_1250_PASS2 0x00000002
101#define SIBYTE_HDR_FMASK_1250_PASS3 0x00000004
102
103#define SIBYTE_HDR_FMASK_112x_ALL 0x00000f00
104#define SIBYTE_HDR_FMASK_112x_PASS1 0x00000100
105
106#define SIBYTE_HDR_FMASK_1480_ALL 0x0000f000
107#define SIBYTE_HDR_FMASK_1480_PASS1 0x00001000
108#define SIBYTE_HDR_FMASK_1480_PASS2 0x00002000
109
110/* Bit mask for chip/revision. (use _ALL for all revisions of a chip). */
111#define SIBYTE_HDR_FMASK(chip, pass) \
112 (SIBYTE_HDR_FMASK_ ## chip ## _ ## pass)
113#define SIBYTE_HDR_FMASK_ALLREVS(chip) \
114 (SIBYTE_HDR_FMASK_ ## chip ## _ALL)
115
116/* Default constant value for all chips, all revisions */
117#define SIBYTE_HDR_FMASK_ALL \
118 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL \
119 | SIBYTE_HDR_FMASK_1480_ALL)
120
121/* This one is used for the "original" BCM1250/BCM112x chips. We use this
122 to weed out constants and macros that do not exist on later chips like
123 the BCM1480 */
124#define SIBYTE_HDR_FMASK_1250_112x_ALL \
125 (SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL)
126#define SIBYTE_HDR_FMASK_1250_112x SIBYTE_HDR_FMASK_1250_112x_ALL
127
128#ifndef SIBYTE_HDR_FEATURES
129#define SIBYTE_HDR_FEATURES SIBYTE_HDR_FMASK_ALL
130#endif
131
132
133/* Bit mask for revisions of chip exclusively before the named revision. */
134#define SIBYTE_HDR_FMASK_BEFORE(chip, pass) \
135 ((SIBYTE_HDR_FMASK(chip, pass) - 1) & SIBYTE_HDR_FMASK_ALLREVS(chip))
136
137/* Bit mask for revisions of chip exclusively after the named revision. */
138#define SIBYTE_HDR_FMASK_AFTER(chip, pass) \
139 (~(SIBYTE_HDR_FMASK(chip, pass) \
140 | (SIBYTE_HDR_FMASK(chip, pass) - 1)) & SIBYTE_HDR_FMASK_ALLREVS(chip))
141
142
143/* True if header features enabled for (any revision of) that chip type. */
144#define SIBYTE_HDR_FEATURE_CHIP(chip) \
145 (!! (SIBYTE_HDR_FMASK_ALLREVS(chip) & SIBYTE_HDR_FEATURES))
146
147/* True for all versions of the BCM1250 and BCM1125, but not true for
148 anything else */
149#define SIBYTE_HDR_FEATURE_1250_112x \
150 (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
151/* (!! (SIBYTE_HDR_FEATURES & SIBYHTE_HDR_FMASK_1250_112x)) */
152
153/* True if header features enabled for that rev or later, inclusive. */
154#define SIBYTE_HDR_FEATURE(chip, pass) \
155 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
156 | SIBYTE_HDR_FMASK_AFTER(chip, pass)) & SIBYTE_HDR_FEATURES))
157
158/* True if header features enabled for exactly that rev. */
159#define SIBYTE_HDR_FEATURE_EXACT(chip, pass) \
160 (!! (SIBYTE_HDR_FMASK(chip, pass) & SIBYTE_HDR_FEATURES))
161
162/* True if header features enabled for that rev or before, inclusive. */
163#define SIBYTE_HDR_FEATURE_UP_TO(chip, pass) \
164 (!! ((SIBYTE_HDR_FMASK(chip, pass) \
165 | SIBYTE_HDR_FMASK_BEFORE(chip, pass)) & SIBYTE_HDR_FEATURES))
166
167
168/* *********************************************************************
169 * Naming schemes for constants in these files:
170 *
171 * M_xxx MASK constant (identifies bits in a register).
172 * For multi-bit fields, all bits in the field will
173 * be set.
174 *
175 * K_xxx "Code" constant (value for data in a multi-bit
176 * field). The value is right justified.
177 *
178 * V_xxx "Value" constant. This is the same as the
179 * corresponding "K_xxx" constant, except it is
180 * shifted to the correct position in the register.
181 *
182 * S_xxx SHIFT constant. This is the number of bits that
183 * a field value (code) needs to be shifted
184 * (towards the left) to put the value in the right
185 * position for the register.
186 *
187 * A_xxx ADDRESS constant. This will be a physical
188 * address. Use the PHYS_TO_K1 macro to generate
189 * a K1SEG address.
190 *
191 * R_xxx RELATIVE offset constant. This is an offset from
192 * an A_xxx constant (usually the first register in
193 * a group).
194 *
195 * G_xxx(X) GET value. This macro obtains a multi-bit field
196 * from a register, masks it, and shifts it to
197 * the bottom of the register (retrieving a K_xxx
198 * value, for example).
199 *
200 * V_xxx(X) VALUE. This macro computes the value of a
201 * K_xxx constant shifted to the correct position
202 * in the register.
203 ********************************************************************* */
204
205
206
207
208/*
209 * Cast to 64-bit number. Presumably the syntax is different in
210 * assembly language.
211 *
212 * Note: you'll need to define uint32_t and uint64_t in your headers.
213 */
214
215#if !defined(__ASSEMBLY__)
216#define _SB_MAKE64(x) ((uint64_t)(x))
217#define _SB_MAKE32(x) ((uint32_t)(x))
218#else
219#define _SB_MAKE64(x) (x)
220#define _SB_MAKE32(x) (x)
221#endif
222
223
224/*
225 * Make a mask for 1 bit at position 'n'
226 */
227
228#define _SB_MAKEMASK1(n) (_SB_MAKE64(1) << _SB_MAKE64(n))
229#define _SB_MAKEMASK1_32(n) (_SB_MAKE32(1) << _SB_MAKE32(n))
230
231/*
232 * Make a mask for 'v' bits at position 'n'
233 */
234
235#define _SB_MAKEMASK(v, n) (_SB_MAKE64((_SB_MAKE64(1)<<(v))-1) << _SB_MAKE64(n))
236#define _SB_MAKEMASK_32(v, n) (_SB_MAKE32((_SB_MAKE32(1)<<(v))-1) << _SB_MAKE32(n))
237
238/*
239 * Make a value at 'v' at bit position 'n'
240 */
241
242#define _SB_MAKEVALUE(v, n) (_SB_MAKE64(v) << _SB_MAKE64(n))
243#define _SB_MAKEVALUE_32(v, n) (_SB_MAKE32(v) << _SB_MAKE32(n))
244
245#define _SB_GETVALUE(v, n, m) ((_SB_MAKE64(v) & _SB_MAKE64(m)) >> _SB_MAKE64(n))
246#define _SB_GETVALUE_32(v, n, m) ((_SB_MAKE32(v) & _SB_MAKE32(m)) >> _SB_MAKE32(n))
247
248/*
249 * Macros to read/write on-chip registers
250 * XXX should we do the PHYS_TO_K1 here?
251 */
252
253
254#if defined(__mips64) && !defined(__ASSEMBLY__)
255#define SBWRITECSR(csr, val) *((volatile uint64_t *) PHYS_TO_K1(csr)) = (val)
256#define SBREADCSR(csr) (*((volatile uint64_t *) PHYS_TO_K1(csr)))
257#endif /* __ASSEMBLY__ */
258
259#endif
diff --git a/include/asm-mips/sibyte/sb1250_dma.h b/include/asm-mips/sibyte/sb1250_dma.h
deleted file mode 100644
index bad56171d747..000000000000
--- a/include/asm-mips/sibyte/sb1250_dma.h
+++ /dev/null
@@ -1,594 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * DMA definitions File: sb1250_dma.h
5 *
6 * This module contains constants and macros useful for
7 * programming the SB1250's DMA controllers, both the data mover
8 * and the Ethernet DMA.
9 *
10 * SB1250 specification level: User's manual 10/21/02
11 * BCM1280 specification level: User's manual 11/24/03
12 *
13 *********************************************************************
14 *
15 * Copyright 2000,2001,2002,2003
16 * Broadcom Corporation. All rights reserved.
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 ********************************************************************* */
33
34
35#ifndef _SB1250_DMA_H
36#define _SB1250_DMA_H
37
38
39#include "sb1250_defs.h"
40
41/* *********************************************************************
42 * DMA Registers
43 ********************************************************************* */
44
45/*
46 * Ethernet and Serial DMA Configuration Register 0 (Table 7-4)
47 * Registers: DMA_CONFIG0_MAC_x_RX_CH_0
48 * Registers: DMA_CONFIG0_MAC_x_TX_CH_0
49 * Registers: DMA_CONFIG0_SER_x_RX
50 * Registers: DMA_CONFIG0_SER_x_TX
51 */
52
53
54#define M_DMA_DROP _SB_MAKEMASK1(0)
55
56#define M_DMA_CHAIN_SEL _SB_MAKEMASK1(1)
57#define M_DMA_RESERVED1 _SB_MAKEMASK1(2)
58
59#define S_DMA_DESC_TYPE _SB_MAKE64(1)
60#define M_DMA_DESC_TYPE _SB_MAKEMASK(2, S_DMA_DESC_TYPE)
61#define V_DMA_DESC_TYPE(x) _SB_MAKEVALUE(x, S_DMA_DESC_TYPE)
62#define G_DMA_DESC_TYPE(x) _SB_GETVALUE(x, S_DMA_DESC_TYPE, M_DMA_DESC_TYPE)
63
64#define K_DMA_DESC_TYPE_RING_AL 0
65#define K_DMA_DESC_TYPE_CHAIN_AL 1
66
67#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
68#define K_DMA_DESC_TYPE_RING_UAL_WI 2
69#define K_DMA_DESC_TYPE_RING_UAL_RMW 3
70#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
71
72#define M_DMA_EOP_INT_EN _SB_MAKEMASK1(3)
73#define M_DMA_HWM_INT_EN _SB_MAKEMASK1(4)
74#define M_DMA_LWM_INT_EN _SB_MAKEMASK1(5)
75#define M_DMA_TBX_EN _SB_MAKEMASK1(6)
76#define M_DMA_TDX_EN _SB_MAKEMASK1(7)
77
78#define S_DMA_INT_PKTCNT _SB_MAKE64(8)
79#define M_DMA_INT_PKTCNT _SB_MAKEMASK(8, S_DMA_INT_PKTCNT)
80#define V_DMA_INT_PKTCNT(x) _SB_MAKEVALUE(x, S_DMA_INT_PKTCNT)
81#define G_DMA_INT_PKTCNT(x) _SB_GETVALUE(x, S_DMA_INT_PKTCNT, M_DMA_INT_PKTCNT)
82
83#define S_DMA_RINGSZ _SB_MAKE64(16)
84#define M_DMA_RINGSZ _SB_MAKEMASK(16, S_DMA_RINGSZ)
85#define V_DMA_RINGSZ(x) _SB_MAKEVALUE(x, S_DMA_RINGSZ)
86#define G_DMA_RINGSZ(x) _SB_GETVALUE(x, S_DMA_RINGSZ, M_DMA_RINGSZ)
87
88#define S_DMA_HIGH_WATERMARK _SB_MAKE64(32)
89#define M_DMA_HIGH_WATERMARK _SB_MAKEMASK(16, S_DMA_HIGH_WATERMARK)
90#define V_DMA_HIGH_WATERMARK(x) _SB_MAKEVALUE(x, S_DMA_HIGH_WATERMARK)
91#define G_DMA_HIGH_WATERMARK(x) _SB_GETVALUE(x, S_DMA_HIGH_WATERMARK, M_DMA_HIGH_WATERMARK)
92
93#define S_DMA_LOW_WATERMARK _SB_MAKE64(48)
94#define M_DMA_LOW_WATERMARK _SB_MAKEMASK(16, S_DMA_LOW_WATERMARK)
95#define V_DMA_LOW_WATERMARK(x) _SB_MAKEVALUE(x, S_DMA_LOW_WATERMARK)
96#define G_DMA_LOW_WATERMARK(x) _SB_GETVALUE(x, S_DMA_LOW_WATERMARK, M_DMA_LOW_WATERMARK)
97
98/*
99 * Ethernet and Serial DMA Configuration Register 1 (Table 7-5)
100 * Registers: DMA_CONFIG1_MAC_x_RX_CH_0
101 * Registers: DMA_CONFIG1_DMA_x_TX_CH_0
102 * Registers: DMA_CONFIG1_SER_x_RX
103 * Registers: DMA_CONFIG1_SER_x_TX
104 */
105
106#define M_DMA_HDR_CF_EN _SB_MAKEMASK1(0)
107#define M_DMA_ASIC_XFR_EN _SB_MAKEMASK1(1)
108#define M_DMA_PRE_ADDR_EN _SB_MAKEMASK1(2)
109#define M_DMA_FLOW_CTL_EN _SB_MAKEMASK1(3)
110#define M_DMA_NO_DSCR_UPDT _SB_MAKEMASK1(4)
111#define M_DMA_L2CA _SB_MAKEMASK1(5)
112
113#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
114#define M_DMA_RX_XTRA_STATUS _SB_MAKEMASK1(6)
115#define M_DMA_TX_CPU_PAUSE _SB_MAKEMASK1(6)
116#define M_DMA_TX_FC_PAUSE_EN _SB_MAKEMASK1(7)
117#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
118
119#define M_DMA_MBZ1 _SB_MAKEMASK(6, 15)
120
121#define S_DMA_HDR_SIZE _SB_MAKE64(21)
122#define M_DMA_HDR_SIZE _SB_MAKEMASK(9, S_DMA_HDR_SIZE)
123#define V_DMA_HDR_SIZE(x) _SB_MAKEVALUE(x, S_DMA_HDR_SIZE)
124#define G_DMA_HDR_SIZE(x) _SB_GETVALUE(x, S_DMA_HDR_SIZE, M_DMA_HDR_SIZE)
125
126#define M_DMA_MBZ2 _SB_MAKEMASK(5, 32)
127
128#define S_DMA_ASICXFR_SIZE _SB_MAKE64(37)
129#define M_DMA_ASICXFR_SIZE _SB_MAKEMASK(9, S_DMA_ASICXFR_SIZE)
130#define V_DMA_ASICXFR_SIZE(x) _SB_MAKEVALUE(x, S_DMA_ASICXFR_SIZE)
131#define G_DMA_ASICXFR_SIZE(x) _SB_GETVALUE(x, S_DMA_ASICXFR_SIZE, M_DMA_ASICXFR_SIZE)
132
133#define S_DMA_INT_TIMEOUT _SB_MAKE64(48)
134#define M_DMA_INT_TIMEOUT _SB_MAKEMASK(16, S_DMA_INT_TIMEOUT)
135#define V_DMA_INT_TIMEOUT(x) _SB_MAKEVALUE(x, S_DMA_INT_TIMEOUT)
136#define G_DMA_INT_TIMEOUT(x) _SB_GETVALUE(x, S_DMA_INT_TIMEOUT, M_DMA_INT_TIMEOUT)
137
138/*
139 * Ethernet and Serial DMA Descriptor base address (Table 7-6)
140 */
141
142#define M_DMA_DSCRBASE_MBZ _SB_MAKEMASK(4, 0)
143
144
145/*
146 * ASIC Mode Base Address (Table 7-7)
147 */
148
149#define M_DMA_ASIC_BASE_MBZ _SB_MAKEMASK(20, 0)
150
151/*
152 * DMA Descriptor Count Registers (Table 7-8)
153 */
154
155/* No bitfields */
156
157
158/*
159 * Current Descriptor Address Register (Table 7-11)
160 */
161
162#define S_DMA_CURDSCR_ADDR _SB_MAKE64(0)
163#define M_DMA_CURDSCR_ADDR _SB_MAKEMASK(40, S_DMA_CURDSCR_ADDR)
164#define S_DMA_CURDSCR_COUNT _SB_MAKE64(40)
165#define M_DMA_CURDSCR_COUNT _SB_MAKEMASK(16, S_DMA_CURDSCR_COUNT)
166
167#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
168#define M_DMA_TX_CH_PAUSE_ON _SB_MAKEMASK1(56)
169#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
170
171/*
172 * Receive Packet Drop Registers
173 */
174#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
175#define S_DMA_OODLOST_RX _SB_MAKE64(0)
176#define M_DMA_OODLOST_RX _SB_MAKEMASK(16, S_DMA_OODLOST_RX)
177#define G_DMA_OODLOST_RX(x) _SB_GETVALUE(x, S_DMA_OODLOST_RX, M_DMA_OODLOST_RX)
178
179#define S_DMA_EOP_COUNT_RX _SB_MAKE64(16)
180#define M_DMA_EOP_COUNT_RX _SB_MAKEMASK(8, S_DMA_EOP_COUNT_RX)
181#define G_DMA_EOP_COUNT_RX(x) _SB_GETVALUE(x, S_DMA_EOP_COUNT_RX, M_DMA_EOP_COUNT_RX)
182#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
183
184/* *********************************************************************
185 * DMA Descriptors
186 ********************************************************************* */
187
188/*
189 * Descriptor doubleword "A" (Table 7-12)
190 */
191
192#define S_DMA_DSCRA_OFFSET _SB_MAKE64(0)
193#define M_DMA_DSCRA_OFFSET _SB_MAKEMASK(5, S_DMA_DSCRA_OFFSET)
194#define V_DMA_DSCRA_OFFSET(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_OFFSET)
195#define G_DMA_DSCRA_OFFSET(x) _SB_GETVALUE(x, S_DMA_DSCRA_OFFSET, M_DMA_DSCRA_OFFSET)
196
197/* Note: Don't shift the address over, just mask it with the mask below */
198#define S_DMA_DSCRA_A_ADDR _SB_MAKE64(5)
199#define M_DMA_DSCRA_A_ADDR _SB_MAKEMASK(35, S_DMA_DSCRA_A_ADDR)
200
201#define M_DMA_DSCRA_A_ADDR_OFFSET (M_DMA_DSCRA_OFFSET | M_DMA_DSCRA_A_ADDR)
202
203#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
204#define S_DMA_DSCRA_A_ADDR_UA _SB_MAKE64(0)
205#define M_DMA_DSCRA_A_ADDR_UA _SB_MAKEMASK(40, S_DMA_DSCRA_A_ADDR_UA)
206#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
207
208#define S_DMA_DSCRA_A_SIZE _SB_MAKE64(40)
209#define M_DMA_DSCRA_A_SIZE _SB_MAKEMASK(9, S_DMA_DSCRA_A_SIZE)
210#define V_DMA_DSCRA_A_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_A_SIZE)
211#define G_DMA_DSCRA_A_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRA_A_SIZE, M_DMA_DSCRA_A_SIZE)
212
213#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
214#define S_DMA_DSCRA_DSCR_CNT _SB_MAKE64(40)
215#define M_DMA_DSCRA_DSCR_CNT _SB_MAKEMASK(8, S_DMA_DSCRA_DSCR_CNT)
216#define G_DMA_DSCRA_DSCR_CNT(x) _SB_GETVALUE(x, S_DMA_DSCRA_DSCR_CNT, M_DMA_DSCRA_DSCR_CNT)
217#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
218
219#define M_DMA_DSCRA_INTERRUPT _SB_MAKEMASK1(49)
220#define M_DMA_DSCRA_OFFSETB _SB_MAKEMASK1(50)
221
222#define S_DMA_DSCRA_STATUS _SB_MAKE64(51)
223#define M_DMA_DSCRA_STATUS _SB_MAKEMASK(13, S_DMA_DSCRA_STATUS)
224#define V_DMA_DSCRA_STATUS(x) _SB_MAKEVALUE(x, S_DMA_DSCRA_STATUS)
225#define G_DMA_DSCRA_STATUS(x) _SB_GETVALUE(x, S_DMA_DSCRA_STATUS, M_DMA_DSCRA_STATUS)
226
227/*
228 * Descriptor doubleword "B" (Table 7-13)
229 */
230
231
232#define S_DMA_DSCRB_OPTIONS _SB_MAKE64(0)
233#define M_DMA_DSCRB_OPTIONS _SB_MAKEMASK(4, S_DMA_DSCRB_OPTIONS)
234#define V_DMA_DSCRB_OPTIONS(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_OPTIONS)
235#define G_DMA_DSCRB_OPTIONS(x) _SB_GETVALUE(x, S_DMA_DSCRB_OPTIONS, M_DMA_DSCRB_OPTIONS)
236
237#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
238#define S_DMA_DSCRB_A_SIZE _SB_MAKE64(8)
239#define M_DMA_DSCRB_A_SIZE _SB_MAKEMASK(14, S_DMA_DSCRB_A_SIZE)
240#define V_DMA_DSCRB_A_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_A_SIZE)
241#define G_DMA_DSCRB_A_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_A_SIZE, M_DMA_DSCRB_A_SIZE)
242#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
243
244#define R_DMA_DSCRB_ADDR _SB_MAKE64(0x10)
245
246/* Note: Don't shift the address over, just mask it with the mask below */
247#define S_DMA_DSCRB_B_ADDR _SB_MAKE64(5)
248#define M_DMA_DSCRB_B_ADDR _SB_MAKEMASK(35, S_DMA_DSCRB_B_ADDR)
249
250#define S_DMA_DSCRB_B_SIZE _SB_MAKE64(40)
251#define M_DMA_DSCRB_B_SIZE _SB_MAKEMASK(9, S_DMA_DSCRB_B_SIZE)
252#define V_DMA_DSCRB_B_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_B_SIZE)
253#define G_DMA_DSCRB_B_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_B_SIZE, M_DMA_DSCRB_B_SIZE)
254
255#define M_DMA_DSCRB_B_VALID _SB_MAKEMASK1(49)
256
257#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
258#define S_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKE64(48)
259#define M_DMA_DSCRB_PKT_SIZE_MSB _SB_MAKEMASK(2, S_DMA_DSCRB_PKT_SIZE_MSB)
260#define V_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_PKT_SIZE_MSB)
261#define G_DMA_DSCRB_PKT_SIZE_MSB(x) _SB_GETVALUE(x, S_DMA_DSCRB_PKT_SIZE_MSB, M_DMA_DSCRB_PKT_SIZE_MSB)
262#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
263
264#define S_DMA_DSCRB_PKT_SIZE _SB_MAKE64(50)
265#define M_DMA_DSCRB_PKT_SIZE _SB_MAKEMASK(14, S_DMA_DSCRB_PKT_SIZE)
266#define V_DMA_DSCRB_PKT_SIZE(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_PKT_SIZE)
267#define G_DMA_DSCRB_PKT_SIZE(x) _SB_GETVALUE(x, S_DMA_DSCRB_PKT_SIZE, M_DMA_DSCRB_PKT_SIZE)
268
269/*
270 * from pass2 some bits in dscr_b are also used for rx status
271 */
272#define S_DMA_DSCRB_STATUS _SB_MAKE64(0)
273#define M_DMA_DSCRB_STATUS _SB_MAKEMASK(1, S_DMA_DSCRB_STATUS)
274#define V_DMA_DSCRB_STATUS(x) _SB_MAKEVALUE(x, S_DMA_DSCRB_STATUS)
275#define G_DMA_DSCRB_STATUS(x) _SB_GETVALUE(x, S_DMA_DSCRB_STATUS, M_DMA_DSCRB_STATUS)
276
277/*
278 * Ethernet Descriptor Status Bits (Table 7-15)
279 */
280
281#define M_DMA_ETHRX_BADIP4CS _SB_MAKEMASK1(51)
282#define M_DMA_ETHRX_DSCRERR _SB_MAKEMASK1(52)
283
284#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
285/* Note: This bit is in the DSCR_B options field */
286#define M_DMA_ETHRX_BADTCPCS _SB_MAKEMASK1(0)
287#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
288
289#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
290/* Note: These bits are in the DSCR_B options field */
291#define M_DMA_ETH_VLAN_FLAG _SB_MAKEMASK1(1)
292#define M_DMA_ETH_CRC_FLAG _SB_MAKEMASK1(2)
293#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
294
295#define S_DMA_ETHRX_RXCH 53
296#define M_DMA_ETHRX_RXCH _SB_MAKEMASK(2, S_DMA_ETHRX_RXCH)
297#define V_DMA_ETHRX_RXCH(x) _SB_MAKEVALUE(x, S_DMA_ETHRX_RXCH)
298#define G_DMA_ETHRX_RXCH(x) _SB_GETVALUE(x, S_DMA_ETHRX_RXCH, M_DMA_ETHRX_RXCH)
299
300#define S_DMA_ETHRX_PKTTYPE 55
301#define M_DMA_ETHRX_PKTTYPE _SB_MAKEMASK(3, S_DMA_ETHRX_PKTTYPE)
302#define V_DMA_ETHRX_PKTTYPE(x) _SB_MAKEVALUE(x, S_DMA_ETHRX_PKTTYPE)
303#define G_DMA_ETHRX_PKTTYPE(x) _SB_GETVALUE(x, S_DMA_ETHRX_PKTTYPE, M_DMA_ETHRX_PKTTYPE)
304
305#define K_DMA_ETHRX_PKTTYPE_IPV4 0
306#define K_DMA_ETHRX_PKTTYPE_ARPV4 1
307#define K_DMA_ETHRX_PKTTYPE_802 2
308#define K_DMA_ETHRX_PKTTYPE_OTHER 3
309#define K_DMA_ETHRX_PKTTYPE_USER0 4
310#define K_DMA_ETHRX_PKTTYPE_USER1 5
311#define K_DMA_ETHRX_PKTTYPE_USER2 6
312#define K_DMA_ETHRX_PKTTYPE_USER3 7
313
314#define M_DMA_ETHRX_MATCH_HASH _SB_MAKEMASK1(58)
315#define M_DMA_ETHRX_MATCH_EXACT _SB_MAKEMASK1(59)
316#define M_DMA_ETHRX_BCAST _SB_MAKEMASK1(60)
317#define M_DMA_ETHRX_MCAST _SB_MAKEMASK1(61)
318#define M_DMA_ETHRX_BAD _SB_MAKEMASK1(62)
319#define M_DMA_ETHRX_SOP _SB_MAKEMASK1(63)
320
321/*
322 * Ethernet Transmit Status Bits (Table 7-16)
323 */
324
325#define M_DMA_ETHTX_SOP _SB_MAKEMASK1(63)
326
327/*
328 * Ethernet Transmit Options (Table 7-17)
329 */
330
331#define K_DMA_ETHTX_NOTSOP _SB_MAKE64(0x00)
332#define K_DMA_ETHTX_APPENDCRC _SB_MAKE64(0x01)
333#define K_DMA_ETHTX_REPLACECRC _SB_MAKE64(0x02)
334#define K_DMA_ETHTX_APPENDCRC_APPENDPAD _SB_MAKE64(0x03)
335#define K_DMA_ETHTX_APPENDVLAN_REPLACECRC _SB_MAKE64(0x04)
336#define K_DMA_ETHTX_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x05)
337#define K_DMA_ETHTX_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x6)
338#define K_DMA_ETHTX_NOMODS _SB_MAKE64(0x07)
339#define K_DMA_ETHTX_RESERVED1 _SB_MAKE64(0x08)
340#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC _SB_MAKE64(0x09)
341#define K_DMA_ETHTX_REPLACESADDR_REPLACECRC _SB_MAKE64(0x0A)
342#define K_DMA_ETHTX_REPLACESADDR_APPENDCRC_APPENDPAD _SB_MAKE64(0x0B)
343#define K_DMA_ETHTX_REPLACESADDR_APPENDVLAN_REPLACECRC _SB_MAKE64(0x0C)
344#define K_DMA_ETHTX_REPLACESADDR_REMOVEVLAN_REPLACECRC _SB_MAKE64(0x0D)
345#define K_DMA_ETHTX_REPLACESADDR_REPLACEVLAN_REPLACECRC _SB_MAKE64(0x0E)
346#define K_DMA_ETHTX_RESERVED2 _SB_MAKE64(0x0F)
347
348/*
349 * Serial Receive Options (Table 7-18)
350 */
351#define M_DMA_SERRX_CRC_ERROR _SB_MAKEMASK1(56)
352#define M_DMA_SERRX_ABORT _SB_MAKEMASK1(57)
353#define M_DMA_SERRX_OCTET_ERROR _SB_MAKEMASK1(58)
354#define M_DMA_SERRX_LONGFRAME_ERROR _SB_MAKEMASK1(59)
355#define M_DMA_SERRX_SHORTFRAME_ERROR _SB_MAKEMASK1(60)
356#define M_DMA_SERRX_OVERRUN_ERROR _SB_MAKEMASK1(61)
357#define M_DMA_SERRX_GOOD _SB_MAKEMASK1(62)
358#define M_DMA_SERRX_SOP _SB_MAKEMASK1(63)
359
360/*
361 * Serial Transmit Status Bits (Table 7-20)
362 */
363
364#define M_DMA_SERTX_FLAG _SB_MAKEMASK1(63)
365
366/*
367 * Serial Transmit Options (Table 7-21)
368 */
369
370#define K_DMA_SERTX_RESERVED _SB_MAKEMASK1(0)
371#define K_DMA_SERTX_APPENDCRC _SB_MAKEMASK1(1)
372#define K_DMA_SERTX_APPENDPAD _SB_MAKEMASK1(2)
373#define K_DMA_SERTX_ABORT _SB_MAKEMASK1(3)
374
375
376/* *********************************************************************
377 * Data Mover Registers
378 ********************************************************************* */
379
380/*
381 * Data Mover Descriptor Base Address Register (Table 7-22)
382 * Register: DM_DSCR_BASE_0
383 * Register: DM_DSCR_BASE_1
384 * Register: DM_DSCR_BASE_2
385 * Register: DM_DSCR_BASE_3
386 */
387
388#define M_DM_DSCR_BASE_MBZ _SB_MAKEMASK(4, 0)
389
390/* Note: Just mask the base address and then OR it in. */
391#define S_DM_DSCR_BASE_ADDR _SB_MAKE64(4)
392#define M_DM_DSCR_BASE_ADDR _SB_MAKEMASK(36, S_DM_DSCR_BASE_ADDR)
393
394#define S_DM_DSCR_BASE_RINGSZ _SB_MAKE64(40)
395#define M_DM_DSCR_BASE_RINGSZ _SB_MAKEMASK(16, S_DM_DSCR_BASE_RINGSZ)
396#define V_DM_DSCR_BASE_RINGSZ(x) _SB_MAKEVALUE(x, S_DM_DSCR_BASE_RINGSZ)
397#define G_DM_DSCR_BASE_RINGSZ(x) _SB_GETVALUE(x, S_DM_DSCR_BASE_RINGSZ, M_DM_DSCR_BASE_RINGSZ)
398
399#define S_DM_DSCR_BASE_PRIORITY _SB_MAKE64(56)
400#define M_DM_DSCR_BASE_PRIORITY _SB_MAKEMASK(3, S_DM_DSCR_BASE_PRIORITY)
401#define V_DM_DSCR_BASE_PRIORITY(x) _SB_MAKEVALUE(x, S_DM_DSCR_BASE_PRIORITY)
402#define G_DM_DSCR_BASE_PRIORITY(x) _SB_GETVALUE(x, S_DM_DSCR_BASE_PRIORITY, M_DM_DSCR_BASE_PRIORITY)
403
404#define K_DM_DSCR_BASE_PRIORITY_1 0
405#define K_DM_DSCR_BASE_PRIORITY_2 1
406#define K_DM_DSCR_BASE_PRIORITY_4 2
407#define K_DM_DSCR_BASE_PRIORITY_8 3
408#define K_DM_DSCR_BASE_PRIORITY_16 4
409
410#define M_DM_DSCR_BASE_ACTIVE _SB_MAKEMASK1(59)
411#define M_DM_DSCR_BASE_INTERRUPT _SB_MAKEMASK1(60)
412#define M_DM_DSCR_BASE_RESET _SB_MAKEMASK1(61) /* write register */
413#define M_DM_DSCR_BASE_ERROR _SB_MAKEMASK1(61) /* read register */
414#define M_DM_DSCR_BASE_ABORT _SB_MAKEMASK1(62)
415#define M_DM_DSCR_BASE_ENABL _SB_MAKEMASK1(63)
416
417/*
418 * Data Mover Descriptor Count Register (Table 7-25)
419 */
420
421/* no bitfields */
422
423/*
424 * Data Mover Current Descriptor Address (Table 7-24)
425 * Register: DM_CUR_DSCR_ADDR_0
426 * Register: DM_CUR_DSCR_ADDR_1
427 * Register: DM_CUR_DSCR_ADDR_2
428 * Register: DM_CUR_DSCR_ADDR_3
429 */
430
431#define S_DM_CUR_DSCR_DSCR_ADDR _SB_MAKE64(0)
432#define M_DM_CUR_DSCR_DSCR_ADDR _SB_MAKEMASK(40, S_DM_CUR_DSCR_DSCR_ADDR)
433
434#define S_DM_CUR_DSCR_DSCR_COUNT _SB_MAKE64(48)
435#define M_DM_CUR_DSCR_DSCR_COUNT _SB_MAKEMASK(16, S_DM_CUR_DSCR_DSCR_COUNT)
436#define V_DM_CUR_DSCR_DSCR_COUNT(r) _SB_MAKEVALUE(r, S_DM_CUR_DSCR_DSCR_COUNT)
437#define G_DM_CUR_DSCR_DSCR_COUNT(r) _SB_GETVALUE(r, S_DM_CUR_DSCR_DSCR_COUNT,\
438 M_DM_CUR_DSCR_DSCR_COUNT)
439
440
441#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
442/*
443 * Data Mover Channel Partial Result Registers
444 * Register: DM_PARTIAL_0
445 * Register: DM_PARTIAL_1
446 * Register: DM_PARTIAL_2
447 * Register: DM_PARTIAL_3
448 */
449#define S_DM_PARTIAL_CRC_PARTIAL _SB_MAKE64(0)
450#define M_DM_PARTIAL_CRC_PARTIAL _SB_MAKEMASK(32, S_DM_PARTIAL_CRC_PARTIAL)
451#define V_DM_PARTIAL_CRC_PARTIAL(r) _SB_MAKEVALUE(r, S_DM_PARTIAL_CRC_PARTIAL)
452#define G_DM_PARTIAL_CRC_PARTIAL(r) _SB_GETVALUE(r, S_DM_PARTIAL_CRC_PARTIAL,\
453 M_DM_PARTIAL_CRC_PARTIAL)
454
455#define S_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKE64(32)
456#define M_DM_PARTIAL_TCPCS_PARTIAL _SB_MAKEMASK(16, S_DM_PARTIAL_TCPCS_PARTIAL)
457#define V_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_MAKEVALUE(r, S_DM_PARTIAL_TCPCS_PARTIAL)
458#define G_DM_PARTIAL_TCPCS_PARTIAL(r) _SB_GETVALUE(r, S_DM_PARTIAL_TCPCS_PARTIAL,\
459 M_DM_PARTIAL_TCPCS_PARTIAL)
460
461#define M_DM_PARTIAL_ODD_BYTE _SB_MAKEMASK1(48)
462#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
463
464
465#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
466/*
467 * Data Mover CRC Definition Registers
468 * Register: CRC_DEF_0
469 * Register: CRC_DEF_1
470 */
471#define S_CRC_DEF_CRC_INIT _SB_MAKE64(0)
472#define M_CRC_DEF_CRC_INIT _SB_MAKEMASK(32, S_CRC_DEF_CRC_INIT)
473#define V_CRC_DEF_CRC_INIT(r) _SB_MAKEVALUE(r, S_CRC_DEF_CRC_INIT)
474#define G_CRC_DEF_CRC_INIT(r) _SB_GETVALUE(r, S_CRC_DEF_CRC_INIT,\
475 M_CRC_DEF_CRC_INIT)
476
477#define S_CRC_DEF_CRC_POLY _SB_MAKE64(32)
478#define M_CRC_DEF_CRC_POLY _SB_MAKEMASK(32, S_CRC_DEF_CRC_POLY)
479#define V_CRC_DEF_CRC_POLY(r) _SB_MAKEVALUE(r, S_CRC_DEF_CRC_POLY)
480#define G_CRC_DEF_CRC_POLY(r) _SB_GETVALUE(r, S_CRC_DEF_CRC_POLY,\
481 M_CRC_DEF_CRC_POLY)
482#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
483
484
485#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
486/*
487 * Data Mover CRC/Checksum Definition Registers
488 * Register: CTCP_DEF_0
489 * Register: CTCP_DEF_1
490 */
491#define S_CTCP_DEF_CRC_TXOR _SB_MAKE64(0)
492#define M_CTCP_DEF_CRC_TXOR _SB_MAKEMASK(32, S_CTCP_DEF_CRC_TXOR)
493#define V_CTCP_DEF_CRC_TXOR(r) _SB_MAKEVALUE(r, S_CTCP_DEF_CRC_TXOR)
494#define G_CTCP_DEF_CRC_TXOR(r) _SB_GETVALUE(r, S_CTCP_DEF_CRC_TXOR,\
495 M_CTCP_DEF_CRC_TXOR)
496
497#define S_CTCP_DEF_TCPCS_INIT _SB_MAKE64(32)
498#define M_CTCP_DEF_TCPCS_INIT _SB_MAKEMASK(16, S_CTCP_DEF_TCPCS_INIT)
499#define V_CTCP_DEF_TCPCS_INIT(r) _SB_MAKEVALUE(r, S_CTCP_DEF_TCPCS_INIT)
500#define G_CTCP_DEF_TCPCS_INIT(r) _SB_GETVALUE(r, S_CTCP_DEF_TCPCS_INIT,\
501 M_CTCP_DEF_TCPCS_INIT)
502
503#define S_CTCP_DEF_CRC_WIDTH _SB_MAKE64(48)
504#define M_CTCP_DEF_CRC_WIDTH _SB_MAKEMASK(2, S_CTCP_DEF_CRC_WIDTH)
505#define V_CTCP_DEF_CRC_WIDTH(r) _SB_MAKEVALUE(r, S_CTCP_DEF_CRC_WIDTH)
506#define G_CTCP_DEF_CRC_WIDTH(r) _SB_GETVALUE(r, S_CTCP_DEF_CRC_WIDTH,\
507 M_CTCP_DEF_CRC_WIDTH)
508
509#define K_CTCP_DEF_CRC_WIDTH_4 0
510#define K_CTCP_DEF_CRC_WIDTH_2 1
511#define K_CTCP_DEF_CRC_WIDTH_1 2
512
513#define M_CTCP_DEF_CRC_BIT_ORDER _SB_MAKEMASK1(50)
514#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
515
516
517/*
518 * Data Mover Descriptor Doubleword "A" (Table 7-26)
519 */
520
521#define S_DM_DSCRA_DST_ADDR _SB_MAKE64(0)
522#define M_DM_DSCRA_DST_ADDR _SB_MAKEMASK(40, S_DM_DSCRA_DST_ADDR)
523
524#define M_DM_DSCRA_UN_DEST _SB_MAKEMASK1(40)
525#define M_DM_DSCRA_UN_SRC _SB_MAKEMASK1(41)
526#define M_DM_DSCRA_INTERRUPT _SB_MAKEMASK1(42)
527#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
528#define M_DM_DSCRA_THROTTLE _SB_MAKEMASK1(43)
529#endif /* up to 1250 PASS1 */
530
531#define S_DM_DSCRA_DIR_DEST _SB_MAKE64(44)
532#define M_DM_DSCRA_DIR_DEST _SB_MAKEMASK(2, S_DM_DSCRA_DIR_DEST)
533#define V_DM_DSCRA_DIR_DEST(x) _SB_MAKEVALUE(x, S_DM_DSCRA_DIR_DEST)
534#define G_DM_DSCRA_DIR_DEST(x) _SB_GETVALUE(x, S_DM_DSCRA_DIR_DEST, M_DM_DSCRA_DIR_DEST)
535
536#define K_DM_DSCRA_DIR_DEST_INCR 0
537#define K_DM_DSCRA_DIR_DEST_DECR 1
538#define K_DM_DSCRA_DIR_DEST_CONST 2
539
540#define V_DM_DSCRA_DIR_DEST_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_INCR, S_DM_DSCRA_DIR_DEST)
541#define V_DM_DSCRA_DIR_DEST_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_DECR, S_DM_DSCRA_DIR_DEST)
542#define V_DM_DSCRA_DIR_DEST_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_DEST_CONST, S_DM_DSCRA_DIR_DEST)
543
544#define S_DM_DSCRA_DIR_SRC _SB_MAKE64(46)
545#define M_DM_DSCRA_DIR_SRC _SB_MAKEMASK(2, S_DM_DSCRA_DIR_SRC)
546#define V_DM_DSCRA_DIR_SRC(x) _SB_MAKEVALUE(x, S_DM_DSCRA_DIR_SRC)
547#define G_DM_DSCRA_DIR_SRC(x) _SB_GETVALUE(x, S_DM_DSCRA_DIR_SRC, M_DM_DSCRA_DIR_SRC)
548
549#define K_DM_DSCRA_DIR_SRC_INCR 0
550#define K_DM_DSCRA_DIR_SRC_DECR 1
551#define K_DM_DSCRA_DIR_SRC_CONST 2
552
553#define V_DM_DSCRA_DIR_SRC_INCR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_INCR, S_DM_DSCRA_DIR_SRC)
554#define V_DM_DSCRA_DIR_SRC_DECR _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_DECR, S_DM_DSCRA_DIR_SRC)
555#define V_DM_DSCRA_DIR_SRC_CONST _SB_MAKEVALUE(K_DM_DSCRA_DIR_SRC_CONST, S_DM_DSCRA_DIR_SRC)
556
557
558#define M_DM_DSCRA_ZERO_MEM _SB_MAKEMASK1(48)
559#define M_DM_DSCRA_PREFETCH _SB_MAKEMASK1(49)
560#define M_DM_DSCRA_L2C_DEST _SB_MAKEMASK1(50)
561#define M_DM_DSCRA_L2C_SRC _SB_MAKEMASK1(51)
562
563#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
564#define M_DM_DSCRA_RD_BKOFF _SB_MAKEMASK1(52)
565#define M_DM_DSCRA_WR_BKOFF _SB_MAKEMASK1(53)
566#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
567
568#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
569#define M_DM_DSCRA_TCPCS_EN _SB_MAKEMASK1(54)
570#define M_DM_DSCRA_TCPCS_RES _SB_MAKEMASK1(55)
571#define M_DM_DSCRA_TCPCS_AP _SB_MAKEMASK1(56)
572#define M_DM_DSCRA_CRC_EN _SB_MAKEMASK1(57)
573#define M_DM_DSCRA_CRC_RES _SB_MAKEMASK1(58)
574#define M_DM_DSCRA_CRC_AP _SB_MAKEMASK1(59)
575#define M_DM_DSCRA_CRC_DFN _SB_MAKEMASK1(60)
576#define M_DM_DSCRA_CRC_XBIT _SB_MAKEMASK1(61)
577#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
578
579#define M_DM_DSCRA_RESERVED2 _SB_MAKEMASK(3, 61)
580
581/*
582 * Data Mover Descriptor Doubleword "B" (Table 7-25)
583 */
584
585#define S_DM_DSCRB_SRC_ADDR _SB_MAKE64(0)
586#define M_DM_DSCRB_SRC_ADDR _SB_MAKEMASK(40, S_DM_DSCRB_SRC_ADDR)
587
588#define S_DM_DSCRB_SRC_LENGTH _SB_MAKE64(40)
589#define M_DM_DSCRB_SRC_LENGTH _SB_MAKEMASK(20, S_DM_DSCRB_SRC_LENGTH)
590#define V_DM_DSCRB_SRC_LENGTH(x) _SB_MAKEVALUE(x, S_DM_DSCRB_SRC_LENGTH)
591#define G_DM_DSCRB_SRC_LENGTH(x) _SB_GETVALUE(x, S_DM_DSCRB_SRC_LENGTH, M_DM_DSCRB_SRC_LENGTH)
592
593
594#endif
diff --git a/include/asm-mips/sibyte/sb1250_genbus.h b/include/asm-mips/sibyte/sb1250_genbus.h
deleted file mode 100644
index 94e9c7c8e783..000000000000
--- a/include/asm-mips/sibyte/sb1250_genbus.h
+++ /dev/null
@@ -1,474 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Generic Bus Constants File: sb1250_genbus.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Generic Bus interface
8 *
9 * SB1250 specification level: User's manual 10/21/02
10 * BCM1280 specification level: User's Manual 11/14/03
11 *
12 *********************************************************************
13 *
14 * Copyright 2000, 2001, 2002, 2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 ********************************************************************* */
32
33
34#ifndef _SB1250_GENBUS_H
35#define _SB1250_GENBUS_H
36
37#include "sb1250_defs.h"
38
39/*
40 * Generic Bus Region Configuration Registers (Table 11-4)
41 */
42
43#define S_IO_RDY_ACTIVE 0
44#define M_IO_RDY_ACTIVE _SB_MAKEMASK1(S_IO_RDY_ACTIVE)
45
46#define S_IO_ENA_RDY 1
47#define M_IO_ENA_RDY _SB_MAKEMASK1(S_IO_ENA_RDY)
48
49#define S_IO_WIDTH_SEL 2
50#define M_IO_WIDTH_SEL _SB_MAKEMASK(2, S_IO_WIDTH_SEL)
51#define K_IO_WIDTH_SEL_1 0
52#define K_IO_WIDTH_SEL_2 1
53#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
54 || SIBYTE_HDR_FEATURE_CHIP(1480)
55#define K_IO_WIDTH_SEL_1L 2
56#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
57#define K_IO_WIDTH_SEL_4 3
58#define V_IO_WIDTH_SEL(x) _SB_MAKEVALUE(x, S_IO_WIDTH_SEL)
59#define G_IO_WIDTH_SEL(x) _SB_GETVALUE(x, S_IO_WIDTH_SEL, M_IO_WIDTH_SEL)
60
61#define S_IO_PARITY_ENA 4
62#define M_IO_PARITY_ENA _SB_MAKEMASK1(S_IO_PARITY_ENA)
63#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
64 || SIBYTE_HDR_FEATURE_CHIP(1480)
65#define S_IO_BURST_EN 5
66#define M_IO_BURST_EN _SB_MAKEMASK1(S_IO_BURST_EN)
67#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
68#define S_IO_PARITY_ODD 6
69#define M_IO_PARITY_ODD _SB_MAKEMASK1(S_IO_PARITY_ODD)
70#define S_IO_NONMUX 7
71#define M_IO_NONMUX _SB_MAKEMASK1(S_IO_NONMUX)
72
73#define S_IO_TIMEOUT 8
74#define M_IO_TIMEOUT _SB_MAKEMASK(8, S_IO_TIMEOUT)
75#define V_IO_TIMEOUT(x) _SB_MAKEVALUE(x, S_IO_TIMEOUT)
76#define G_IO_TIMEOUT(x) _SB_GETVALUE(x, S_IO_TIMEOUT, M_IO_TIMEOUT)
77
78/*
79 * Generic Bus Region Size register (Table 11-5)
80 */
81
82#define S_IO_MULT_SIZE 0
83#define M_IO_MULT_SIZE _SB_MAKEMASK(12, S_IO_MULT_SIZE)
84#define V_IO_MULT_SIZE(x) _SB_MAKEVALUE(x, S_IO_MULT_SIZE)
85#define G_IO_MULT_SIZE(x) _SB_GETVALUE(x, S_IO_MULT_SIZE, M_IO_MULT_SIZE)
86
87#define S_IO_REGSIZE 16 /* # bits to shift size for this reg */
88
89/*
90 * Generic Bus Region Address (Table 11-6)
91 */
92
93#define S_IO_START_ADDR 0
94#define M_IO_START_ADDR _SB_MAKEMASK(14, S_IO_START_ADDR)
95#define V_IO_START_ADDR(x) _SB_MAKEVALUE(x, S_IO_START_ADDR)
96#define G_IO_START_ADDR(x) _SB_GETVALUE(x, S_IO_START_ADDR, M_IO_START_ADDR)
97
98#define S_IO_ADDRBASE 16 /* # bits to shift addr for this reg */
99
100#define M_IO_BLK_CACHE _SB_MAKEMASK1(15)
101
102
103/*
104 * Generic Bus Timing 0 Registers (Table 11-7)
105 */
106
107#define S_IO_ALE_WIDTH 0
108#define M_IO_ALE_WIDTH _SB_MAKEMASK(3, S_IO_ALE_WIDTH)
109#define V_IO_ALE_WIDTH(x) _SB_MAKEVALUE(x, S_IO_ALE_WIDTH)
110#define G_IO_ALE_WIDTH(x) _SB_GETVALUE(x, S_IO_ALE_WIDTH, M_IO_ALE_WIDTH)
111
112#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
113 || SIBYTE_HDR_FEATURE_CHIP(1480)
114#define M_IO_EARLY_CS _SB_MAKEMASK1(3)
115#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
116
117#define S_IO_ALE_TO_CS 4
118#define M_IO_ALE_TO_CS _SB_MAKEMASK(2, S_IO_ALE_TO_CS)
119#define V_IO_ALE_TO_CS(x) _SB_MAKEVALUE(x, S_IO_ALE_TO_CS)
120#define G_IO_ALE_TO_CS(x) _SB_GETVALUE(x, S_IO_ALE_TO_CS, M_IO_ALE_TO_CS)
121
122#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
123 || SIBYTE_HDR_FEATURE_CHIP(1480)
124#define S_IO_BURST_WIDTH _SB_MAKE64(6)
125#define M_IO_BURST_WIDTH _SB_MAKEMASK(2, S_IO_BURST_WIDTH)
126#define V_IO_BURST_WIDTH(x) _SB_MAKEVALUE(x, S_IO_BURST_WIDTH)
127#define G_IO_BURST_WIDTH(x) _SB_GETVALUE(x, S_IO_BURST_WIDTH, M_IO_BURST_WIDTH)
128#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
129
130#define S_IO_CS_WIDTH 8
131#define M_IO_CS_WIDTH _SB_MAKEMASK(5, S_IO_CS_WIDTH)
132#define V_IO_CS_WIDTH(x) _SB_MAKEVALUE(x, S_IO_CS_WIDTH)
133#define G_IO_CS_WIDTH(x) _SB_GETVALUE(x, S_IO_CS_WIDTH, M_IO_CS_WIDTH)
134
135#define S_IO_RDY_SMPLE 13
136#define M_IO_RDY_SMPLE _SB_MAKEMASK(3, S_IO_RDY_SMPLE)
137#define V_IO_RDY_SMPLE(x) _SB_MAKEVALUE(x, S_IO_RDY_SMPLE)
138#define G_IO_RDY_SMPLE(x) _SB_GETVALUE(x, S_IO_RDY_SMPLE, M_IO_RDY_SMPLE)
139
140
141/*
142 * Generic Bus Timing 1 Registers (Table 11-8)
143 */
144
145#define S_IO_ALE_TO_WRITE 0
146#define M_IO_ALE_TO_WRITE _SB_MAKEMASK(3, S_IO_ALE_TO_WRITE)
147#define V_IO_ALE_TO_WRITE(x) _SB_MAKEVALUE(x, S_IO_ALE_TO_WRITE)
148#define G_IO_ALE_TO_WRITE(x) _SB_GETVALUE(x, S_IO_ALE_TO_WRITE, M_IO_ALE_TO_WRITE)
149
150#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) \
151 || SIBYTE_HDR_FEATURE_CHIP(1480)
152#define M_IO_RDY_SYNC _SB_MAKEMASK1(3)
153#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
154
155#define S_IO_WRITE_WIDTH 4
156#define M_IO_WRITE_WIDTH _SB_MAKEMASK(4, S_IO_WRITE_WIDTH)
157#define V_IO_WRITE_WIDTH(x) _SB_MAKEVALUE(x, S_IO_WRITE_WIDTH)
158#define G_IO_WRITE_WIDTH(x) _SB_GETVALUE(x, S_IO_WRITE_WIDTH, M_IO_WRITE_WIDTH)
159
160#define S_IO_IDLE_CYCLE 8
161#define M_IO_IDLE_CYCLE _SB_MAKEMASK(4, S_IO_IDLE_CYCLE)
162#define V_IO_IDLE_CYCLE(x) _SB_MAKEVALUE(x, S_IO_IDLE_CYCLE)
163#define G_IO_IDLE_CYCLE(x) _SB_GETVALUE(x, S_IO_IDLE_CYCLE, M_IO_IDLE_CYCLE)
164
165#define S_IO_OE_TO_CS 12
166#define M_IO_OE_TO_CS _SB_MAKEMASK(2, S_IO_OE_TO_CS)
167#define V_IO_OE_TO_CS(x) _SB_MAKEVALUE(x, S_IO_OE_TO_CS)
168#define G_IO_OE_TO_CS(x) _SB_GETVALUE(x, S_IO_OE_TO_CS, M_IO_OE_TO_CS)
169
170#define S_IO_CS_TO_OE 14
171#define M_IO_CS_TO_OE _SB_MAKEMASK(2, S_IO_CS_TO_OE)
172#define V_IO_CS_TO_OE(x) _SB_MAKEVALUE(x, S_IO_CS_TO_OE)
173#define G_IO_CS_TO_OE(x) _SB_GETVALUE(x, S_IO_CS_TO_OE, M_IO_CS_TO_OE)
174
175/*
176 * Generic Bus Interrupt Status Register (Table 11-9)
177 */
178
179#define M_IO_CS_ERR_INT _SB_MAKEMASK(0, 8)
180#define M_IO_CS0_ERR_INT _SB_MAKEMASK1(0)
181#define M_IO_CS1_ERR_INT _SB_MAKEMASK1(1)
182#define M_IO_CS2_ERR_INT _SB_MAKEMASK1(2)
183#define M_IO_CS3_ERR_INT _SB_MAKEMASK1(3)
184#define M_IO_CS4_ERR_INT _SB_MAKEMASK1(4)
185#define M_IO_CS5_ERR_INT _SB_MAKEMASK1(5)
186#define M_IO_CS6_ERR_INT _SB_MAKEMASK1(6)
187#define M_IO_CS7_ERR_INT _SB_MAKEMASK1(7)
188
189#define M_IO_RD_PAR_INT _SB_MAKEMASK1(9)
190#define M_IO_TIMEOUT_INT _SB_MAKEMASK1(10)
191#define M_IO_ILL_ADDR_INT _SB_MAKEMASK1(11)
192#define M_IO_MULT_CS_INT _SB_MAKEMASK1(12)
193#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
194#define M_IO_COH_ERR _SB_MAKEMASK1(14)
195#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
196
197
198/*
199 * Generic Bus Output Drive Control Register 0 (Table 14-18)
200 */
201
202#define S_IO_SLEW0 0
203#define M_IO_SLEW0 _SB_MAKEMASK(2, S_IO_SLEW0)
204#define V_IO_SLEW0(x) _SB_MAKEVALUE(x, S_IO_SLEW0)
205#define G_IO_SLEW0(x) _SB_GETVALUE(x, S_IO_SLEW0, M_IO_SLEW0)
206
207#define S_IO_DRV_A 2
208#define M_IO_DRV_A _SB_MAKEMASK(2, S_IO_DRV_A)
209#define V_IO_DRV_A(x) _SB_MAKEVALUE(x, S_IO_DRV_A)
210#define G_IO_DRV_A(x) _SB_GETVALUE(x, S_IO_DRV_A, M_IO_DRV_A)
211
212#define S_IO_DRV_B 6
213#define M_IO_DRV_B _SB_MAKEMASK(2, S_IO_DRV_B)
214#define V_IO_DRV_B(x) _SB_MAKEVALUE(x, S_IO_DRV_B)
215#define G_IO_DRV_B(x) _SB_GETVALUE(x, S_IO_DRV_B, M_IO_DRV_B)
216
217#define S_IO_DRV_C 10
218#define M_IO_DRV_C _SB_MAKEMASK(2, S_IO_DRV_C)
219#define V_IO_DRV_C(x) _SB_MAKEVALUE(x, S_IO_DRV_C)
220#define G_IO_DRV_C(x) _SB_GETVALUE(x, S_IO_DRV_C, M_IO_DRV_C)
221
222#define S_IO_DRV_D 14
223#define M_IO_DRV_D _SB_MAKEMASK(2, S_IO_DRV_D)
224#define V_IO_DRV_D(x) _SB_MAKEVALUE(x, S_IO_DRV_D)
225#define G_IO_DRV_D(x) _SB_GETVALUE(x, S_IO_DRV_D, M_IO_DRV_D)
226
227/*
228 * Generic Bus Output Drive Control Register 1 (Table 14-19)
229 */
230
231#define S_IO_DRV_E 2
232#define M_IO_DRV_E _SB_MAKEMASK(2, S_IO_DRV_E)
233#define V_IO_DRV_E(x) _SB_MAKEVALUE(x, S_IO_DRV_E)
234#define G_IO_DRV_E(x) _SB_GETVALUE(x, S_IO_DRV_E, M_IO_DRV_E)
235
236#define S_IO_DRV_F 6
237#define M_IO_DRV_F _SB_MAKEMASK(2, S_IO_DRV_F)
238#define V_IO_DRV_F(x) _SB_MAKEVALUE(x, S_IO_DRV_F)
239#define G_IO_DRV_F(x) _SB_GETVALUE(x, S_IO_DRV_F, M_IO_DRV_F)
240
241#define S_IO_SLEW1 8
242#define M_IO_SLEW1 _SB_MAKEMASK(2, S_IO_SLEW1)
243#define V_IO_SLEW1(x) _SB_MAKEVALUE(x, S_IO_SLEW1)
244#define G_IO_SLEW1(x) _SB_GETVALUE(x, S_IO_SLEW1, M_IO_SLEW1)
245
246#define S_IO_DRV_G 10
247#define M_IO_DRV_G _SB_MAKEMASK(2, S_IO_DRV_G)
248#define V_IO_DRV_G(x) _SB_MAKEVALUE(x, S_IO_DRV_G)
249#define G_IO_DRV_G(x) _SB_GETVALUE(x, S_IO_DRV_G, M_IO_DRV_G)
250
251#define S_IO_SLEW2 12
252#define M_IO_SLEW2 _SB_MAKEMASK(2, S_IO_SLEW2)
253#define V_IO_SLEW2(x) _SB_MAKEVALUE(x, S_IO_SLEW2)
254#define G_IO_SLEW2(x) _SB_GETVALUE(x, S_IO_SLEW2, M_IO_SLEW2)
255
256#define S_IO_DRV_H 14
257#define M_IO_DRV_H _SB_MAKEMASK(2, S_IO_DRV_H)
258#define V_IO_DRV_H(x) _SB_MAKEVALUE(x, S_IO_DRV_H)
259#define G_IO_DRV_H(x) _SB_GETVALUE(x, S_IO_DRV_H, M_IO_DRV_H)
260
261/*
262 * Generic Bus Output Drive Control Register 2 (Table 14-20)
263 */
264
265#define S_IO_DRV_J 2
266#define M_IO_DRV_J _SB_MAKEMASK(2, S_IO_DRV_J)
267#define V_IO_DRV_J(x) _SB_MAKEVALUE(x, S_IO_DRV_J)
268#define G_IO_DRV_J(x) _SB_GETVALUE(x, S_IO_DRV_J, M_IO_DRV_J)
269
270#define S_IO_DRV_K 6
271#define M_IO_DRV_K _SB_MAKEMASK(2, S_IO_DRV_K)
272#define V_IO_DRV_K(x) _SB_MAKEVALUE(x, S_IO_DRV_K)
273#define G_IO_DRV_K(x) _SB_GETVALUE(x, S_IO_DRV_K, M_IO_DRV_K)
274
275#define S_IO_DRV_L 10
276#define M_IO_DRV_L _SB_MAKEMASK(2, S_IO_DRV_L)
277#define V_IO_DRV_L(x) _SB_MAKEVALUE(x, S_IO_DRV_L)
278#define G_IO_DRV_L(x) _SB_GETVALUE(x, S_IO_DRV_L, M_IO_DRV_L)
279
280#define S_IO_DRV_M 14
281#define M_IO_DRV_M _SB_MAKEMASK(2, S_IO_DRV_M)
282#define V_IO_DRV_M(x) _SB_MAKEVALUE(x, S_IO_DRV_M)
283#define G_IO_DRV_M(x) _SB_GETVALUE(x, S_IO_DRV_M, M_IO_DRV_M)
284
285/*
286 * Generic Bus Output Drive Control Register 3 (Table 14-21)
287 */
288
289#define S_IO_SLEW3 0
290#define M_IO_SLEW3 _SB_MAKEMASK(2, S_IO_SLEW3)
291#define V_IO_SLEW3(x) _SB_MAKEVALUE(x, S_IO_SLEW3)
292#define G_IO_SLEW3(x) _SB_GETVALUE(x, S_IO_SLEW3, M_IO_SLEW3)
293
294#define S_IO_DRV_N 2
295#define M_IO_DRV_N _SB_MAKEMASK(2, S_IO_DRV_N)
296#define V_IO_DRV_N(x) _SB_MAKEVALUE(x, S_IO_DRV_N)
297#define G_IO_DRV_N(x) _SB_GETVALUE(x, S_IO_DRV_N, M_IO_DRV_N)
298
299#define S_IO_DRV_P 6
300#define M_IO_DRV_P _SB_MAKEMASK(2, S_IO_DRV_P)
301#define V_IO_DRV_P(x) _SB_MAKEVALUE(x, S_IO_DRV_P)
302#define G_IO_DRV_P(x) _SB_GETVALUE(x, S_IO_DRV_P, M_IO_DRV_P)
303
304#define S_IO_DRV_Q 10
305#define M_IO_DRV_Q _SB_MAKEMASK(2, S_IO_DRV_Q)
306#define V_IO_DRV_Q(x) _SB_MAKEVALUE(x, S_IO_DRV_Q)
307#define G_IO_DRV_Q(x) _SB_GETVALUE(x, S_IO_DRV_Q, M_IO_DRV_Q)
308
309#define S_IO_DRV_R 14
310#define M_IO_DRV_R _SB_MAKEMASK(2, S_IO_DRV_R)
311#define V_IO_DRV_R(x) _SB_MAKEVALUE(x, S_IO_DRV_R)
312#define G_IO_DRV_R(x) _SB_GETVALUE(x, S_IO_DRV_R, M_IO_DRV_R)
313
314
315/*
316 * PCMCIA configuration register (Table 12-6)
317 */
318
319#define M_PCMCIA_CFG_ATTRMEM _SB_MAKEMASK1(0)
320#define M_PCMCIA_CFG_3VEN _SB_MAKEMASK1(1)
321#define M_PCMCIA_CFG_5VEN _SB_MAKEMASK1(2)
322#define M_PCMCIA_CFG_VPPEN _SB_MAKEMASK1(3)
323#define M_PCMCIA_CFG_RESET _SB_MAKEMASK1(4)
324#define M_PCMCIA_CFG_APWRONEN _SB_MAKEMASK1(5)
325#define M_PCMCIA_CFG_CDMASK _SB_MAKEMASK1(6)
326#define M_PCMCIA_CFG_WPMASK _SB_MAKEMASK1(7)
327#define M_PCMCIA_CFG_RDYMASK _SB_MAKEMASK1(8)
328#define M_PCMCIA_CFG_PWRCTL _SB_MAKEMASK1(9)
329
330#if SIBYTE_HDR_FEATURE_CHIP(1480)
331#define S_PCMCIA_MODE 16
332#define M_PCMCIA_MODE _SB_MAKEMASK(3, S_PCMCIA_MODE)
333#define V_PCMCIA_MODE(x) _SB_MAKEVALUE(x, S_PCMCIA_MODE)
334#define G_PCMCIA_MODE(x) _SB_GETVALUE(x, S_PCMCIA_MODE, M_PCMCIA_MODE)
335
336#define K_PCMCIA_MODE_PCMA_NOB 0 /* standard PCMCIA "A", no "B" */
337#define K_PCMCIA_MODE_IDEA_NOB 1 /* IDE "A", no "B" */
338#define K_PCMCIA_MODE_PCMIOA_NOB 2 /* PCMCIA with I/O "A", no "B" */
339#define K_PCMCIA_MODE_PCMA_PCMB 4 /* standard PCMCIA "A", standard PCMCIA "B" */
340#define K_PCMCIA_MODE_IDEA_PCMB 5 /* IDE "A", standard PCMCIA "B" */
341#define K_PCMCIA_MODE_PCMA_IDEB 6 /* standard PCMCIA "A", IDE "B" */
342#define K_PCMCIA_MODE_IDEA_IDEB 7 /* IDE "A", IDE "B" */
343#endif
344
345
346/*
347 * PCMCIA status register (Table 12-7)
348 */
349
350#define M_PCMCIA_STATUS_CD1 _SB_MAKEMASK1(0)
351#define M_PCMCIA_STATUS_CD2 _SB_MAKEMASK1(1)
352#define M_PCMCIA_STATUS_VS1 _SB_MAKEMASK1(2)
353#define M_PCMCIA_STATUS_VS2 _SB_MAKEMASK1(3)
354#define M_PCMCIA_STATUS_WP _SB_MAKEMASK1(4)
355#define M_PCMCIA_STATUS_RDY _SB_MAKEMASK1(5)
356#define M_PCMCIA_STATUS_3VEN _SB_MAKEMASK1(6)
357#define M_PCMCIA_STATUS_5VEN _SB_MAKEMASK1(7)
358#define M_PCMCIA_STATUS_CDCHG _SB_MAKEMASK1(8)
359#define M_PCMCIA_STATUS_WPCHG _SB_MAKEMASK1(9)
360#define M_PCMCIA_STATUS_RDYCHG _SB_MAKEMASK1(10)
361
362/*
363 * GPIO Interrupt Type Register (table 13-3)
364 */
365
366#define K_GPIO_INTR_DISABLE 0
367#define K_GPIO_INTR_EDGE 1
368#define K_GPIO_INTR_LEVEL 2
369#define K_GPIO_INTR_SPLIT 3
370
371#define S_GPIO_INTR_TYPEX(n) (((n)/2)*2)
372#define M_GPIO_INTR_TYPEX(n) _SB_MAKEMASK(2, S_GPIO_INTR_TYPEX(n))
373#define V_GPIO_INTR_TYPEX(n, x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPEX(n))
374#define G_GPIO_INTR_TYPEX(n, x) _SB_GETVALUE(x, S_GPIO_INTR_TYPEX(n), M_GPIO_INTR_TYPEX(n))
375
376#define S_GPIO_INTR_TYPE0 0
377#define M_GPIO_INTR_TYPE0 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE0)
378#define V_GPIO_INTR_TYPE0(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE0)
379#define G_GPIO_INTR_TYPE0(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE0, M_GPIO_INTR_TYPE0)
380
381#define S_GPIO_INTR_TYPE2 2
382#define M_GPIO_INTR_TYPE2 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE2)
383#define V_GPIO_INTR_TYPE2(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE2)
384#define G_GPIO_INTR_TYPE2(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE2, M_GPIO_INTR_TYPE2)
385
386#define S_GPIO_INTR_TYPE4 4
387#define M_GPIO_INTR_TYPE4 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE4)
388#define V_GPIO_INTR_TYPE4(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE4)
389#define G_GPIO_INTR_TYPE4(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE4, M_GPIO_INTR_TYPE4)
390
391#define S_GPIO_INTR_TYPE6 6
392#define M_GPIO_INTR_TYPE6 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE6)
393#define V_GPIO_INTR_TYPE6(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE6)
394#define G_GPIO_INTR_TYPE6(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE6, M_GPIO_INTR_TYPE6)
395
396#define S_GPIO_INTR_TYPE8 8
397#define M_GPIO_INTR_TYPE8 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE8)
398#define V_GPIO_INTR_TYPE8(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE8)
399#define G_GPIO_INTR_TYPE8(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE8, M_GPIO_INTR_TYPE8)
400
401#define S_GPIO_INTR_TYPE10 10
402#define M_GPIO_INTR_TYPE10 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE10)
403#define V_GPIO_INTR_TYPE10(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE10)
404#define G_GPIO_INTR_TYPE10(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE10, M_GPIO_INTR_TYPE10)
405
406#define S_GPIO_INTR_TYPE12 12
407#define M_GPIO_INTR_TYPE12 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE12)
408#define V_GPIO_INTR_TYPE12(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE12)
409#define G_GPIO_INTR_TYPE12(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE12, M_GPIO_INTR_TYPE12)
410
411#define S_GPIO_INTR_TYPE14 14
412#define M_GPIO_INTR_TYPE14 _SB_MAKEMASK(2, S_GPIO_INTR_TYPE14)
413#define V_GPIO_INTR_TYPE14(x) _SB_MAKEVALUE(x, S_GPIO_INTR_TYPE14)
414#define G_GPIO_INTR_TYPE14(x) _SB_GETVALUE(x, S_GPIO_INTR_TYPE14, M_GPIO_INTR_TYPE14)
415
416#if SIBYTE_HDR_FEATURE_CHIP(1480)
417
418/*
419 * GPIO Interrupt Additional Type Register
420 */
421
422#define K_GPIO_INTR_BOTHEDGE 0
423#define K_GPIO_INTR_RISEEDGE 1
424#define K_GPIO_INTR_UNPRED1 2
425#define K_GPIO_INTR_UNPRED2 3
426
427#define S_GPIO_INTR_ATYPEX(n) (((n)/2)*2)
428#define M_GPIO_INTR_ATYPEX(n) _SB_MAKEMASK(2, S_GPIO_INTR_ATYPEX(n))
429#define V_GPIO_INTR_ATYPEX(n, x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPEX(n))
430#define G_GPIO_INTR_ATYPEX(n, x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPEX(n), M_GPIO_INTR_ATYPEX(n))
431
432#define S_GPIO_INTR_ATYPE0 0
433#define M_GPIO_INTR_ATYPE0 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE0)
434#define V_GPIO_INTR_ATYPE0(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE0)
435#define G_GPIO_INTR_ATYPE0(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE0, M_GPIO_INTR_ATYPE0)
436
437#define S_GPIO_INTR_ATYPE2 2
438#define M_GPIO_INTR_ATYPE2 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE2)
439#define V_GPIO_INTR_ATYPE2(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE2)
440#define G_GPIO_INTR_ATYPE2(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE2, M_GPIO_INTR_ATYPE2)
441
442#define S_GPIO_INTR_ATYPE4 4
443#define M_GPIO_INTR_ATYPE4 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE4)
444#define V_GPIO_INTR_ATYPE4(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE4)
445#define G_GPIO_INTR_ATYPE4(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE4, M_GPIO_INTR_ATYPE4)
446
447#define S_GPIO_INTR_ATYPE6 6
448#define M_GPIO_INTR_ATYPE6 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE6)
449#define V_GPIO_INTR_ATYPE6(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE6)
450#define G_GPIO_INTR_ATYPE6(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE6, M_GPIO_INTR_ATYPE6)
451
452#define S_GPIO_INTR_ATYPE8 8
453#define M_GPIO_INTR_ATYPE8 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE8)
454#define V_GPIO_INTR_ATYPE8(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE8)
455#define G_GPIO_INTR_ATYPE8(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE8, M_GPIO_INTR_ATYPE8)
456
457#define S_GPIO_INTR_ATYPE10 10
458#define M_GPIO_INTR_ATYPE10 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE10)
459#define V_GPIO_INTR_ATYPE10(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE10)
460#define G_GPIO_INTR_ATYPE10(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE10, M_GPIO_INTR_ATYPE10)
461
462#define S_GPIO_INTR_ATYPE12 12
463#define M_GPIO_INTR_ATYPE12 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE12)
464#define V_GPIO_INTR_ATYPE12(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE12)
465#define G_GPIO_INTR_ATYPE12(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE12, M_GPIO_INTR_ATYPE12)
466
467#define S_GPIO_INTR_ATYPE14 14
468#define M_GPIO_INTR_ATYPE14 _SB_MAKEMASK(2, S_GPIO_INTR_ATYPE14)
469#define V_GPIO_INTR_ATYPE14(x) _SB_MAKEVALUE(x, S_GPIO_INTR_ATYPE14)
470#define G_GPIO_INTR_ATYPE14(x) _SB_GETVALUE(x, S_GPIO_INTR_ATYPE14, M_GPIO_INTR_ATYPE14)
471#endif
472
473
474#endif
diff --git a/include/asm-mips/sibyte/sb1250_int.h b/include/asm-mips/sibyte/sb1250_int.h
deleted file mode 100644
index f2850b4bcfd4..000000000000
--- a/include/asm-mips/sibyte/sb1250_int.h
+++ /dev/null
@@ -1,248 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Interrupt Mapper definitions File: sb1250_int.h
5 *
6 * This module contains constants for manipulating the SB1250's
7 * interrupt mapper and definitions for the interrupt sources.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000, 2001, 2002, 2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_INT_H
34#define _SB1250_INT_H
35
36#include "sb1250_defs.h"
37
38/* *********************************************************************
39 * Interrupt Mapper Constants
40 ********************************************************************* */
41
42/*
43 * Interrupt sources (Table 4-8, UM 0.2)
44 *
45 * First, the interrupt numbers.
46 */
47
48#define K_INT_SOURCES 64
49
50#define K_INT_WATCHDOG_TIMER_0 0
51#define K_INT_WATCHDOG_TIMER_1 1
52#define K_INT_TIMER_0 2
53#define K_INT_TIMER_1 3
54#define K_INT_TIMER_2 4
55#define K_INT_TIMER_3 5
56#define K_INT_SMB_0 6
57#define K_INT_SMB_1 7
58#define K_INT_UART_0 8
59#define K_INT_UART_1 9
60#define K_INT_SER_0 10
61#define K_INT_SER_1 11
62#define K_INT_PCMCIA 12
63#define K_INT_ADDR_TRAP 13
64#define K_INT_PERF_CNT 14
65#define K_INT_TRACE_FREEZE 15
66#define K_INT_BAD_ECC 16
67#define K_INT_COR_ECC 17
68#define K_INT_IO_BUS 18
69#define K_INT_MAC_0 19
70#define K_INT_MAC_1 20
71#define K_INT_MAC_2 21
72#define K_INT_DM_CH_0 22
73#define K_INT_DM_CH_1 23
74#define K_INT_DM_CH_2 24
75#define K_INT_DM_CH_3 25
76#define K_INT_MBOX_0 26
77#define K_INT_MBOX_1 27
78#define K_INT_MBOX_2 28
79#define K_INT_MBOX_3 29
80#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
81#define K_INT_CYCLE_CP0_INT 30
82#define K_INT_CYCLE_CP1_INT 31
83#endif /* 1250 PASS2 || 112x PASS1 */
84#define K_INT_GPIO_0 32
85#define K_INT_GPIO_1 33
86#define K_INT_GPIO_2 34
87#define K_INT_GPIO_3 35
88#define K_INT_GPIO_4 36
89#define K_INT_GPIO_5 37
90#define K_INT_GPIO_6 38
91#define K_INT_GPIO_7 39
92#define K_INT_GPIO_8 40
93#define K_INT_GPIO_9 41
94#define K_INT_GPIO_10 42
95#define K_INT_GPIO_11 43
96#define K_INT_GPIO_12 44
97#define K_INT_GPIO_13 45
98#define K_INT_GPIO_14 46
99#define K_INT_GPIO_15 47
100#define K_INT_LDT_FATAL 48
101#define K_INT_LDT_NONFATAL 49
102#define K_INT_LDT_SMI 50
103#define K_INT_LDT_NMI 51
104#define K_INT_LDT_INIT 52
105#define K_INT_LDT_STARTUP 53
106#define K_INT_LDT_EXT 54
107#define K_INT_PCI_ERROR 55
108#define K_INT_PCI_INTA 56
109#define K_INT_PCI_INTB 57
110#define K_INT_PCI_INTC 58
111#define K_INT_PCI_INTD 59
112#define K_INT_SPARE_2 60
113#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
114#define K_INT_MAC_0_CH1 61
115#define K_INT_MAC_1_CH1 62
116#define K_INT_MAC_2_CH1 63
117#endif /* 1250 PASS2 || 112x PASS1 */
118
119/*
120 * Mask values for each interrupt
121 */
122
123#define M_INT_WATCHDOG_TIMER_0 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_0)
124#define M_INT_WATCHDOG_TIMER_1 _SB_MAKEMASK1(K_INT_WATCHDOG_TIMER_1)
125#define M_INT_TIMER_0 _SB_MAKEMASK1(K_INT_TIMER_0)
126#define M_INT_TIMER_1 _SB_MAKEMASK1(K_INT_TIMER_1)
127#define M_INT_TIMER_2 _SB_MAKEMASK1(K_INT_TIMER_2)
128#define M_INT_TIMER_3 _SB_MAKEMASK1(K_INT_TIMER_3)
129#define M_INT_SMB_0 _SB_MAKEMASK1(K_INT_SMB_0)
130#define M_INT_SMB_1 _SB_MAKEMASK1(K_INT_SMB_1)
131#define M_INT_UART_0 _SB_MAKEMASK1(K_INT_UART_0)
132#define M_INT_UART_1 _SB_MAKEMASK1(K_INT_UART_1)
133#define M_INT_SER_0 _SB_MAKEMASK1(K_INT_SER_0)
134#define M_INT_SER_1 _SB_MAKEMASK1(K_INT_SER_1)
135#define M_INT_PCMCIA _SB_MAKEMASK1(K_INT_PCMCIA)
136#define M_INT_ADDR_TRAP _SB_MAKEMASK1(K_INT_ADDR_TRAP)
137#define M_INT_PERF_CNT _SB_MAKEMASK1(K_INT_PERF_CNT)
138#define M_INT_TRACE_FREEZE _SB_MAKEMASK1(K_INT_TRACE_FREEZE)
139#define M_INT_BAD_ECC _SB_MAKEMASK1(K_INT_BAD_ECC)
140#define M_INT_COR_ECC _SB_MAKEMASK1(K_INT_COR_ECC)
141#define M_INT_IO_BUS _SB_MAKEMASK1(K_INT_IO_BUS)
142#define M_INT_MAC_0 _SB_MAKEMASK1(K_INT_MAC_0)
143#define M_INT_MAC_1 _SB_MAKEMASK1(K_INT_MAC_1)
144#define M_INT_MAC_2 _SB_MAKEMASK1(K_INT_MAC_2)
145#define M_INT_DM_CH_0 _SB_MAKEMASK1(K_INT_DM_CH_0)
146#define M_INT_DM_CH_1 _SB_MAKEMASK1(K_INT_DM_CH_1)
147#define M_INT_DM_CH_2 _SB_MAKEMASK1(K_INT_DM_CH_2)
148#define M_INT_DM_CH_3 _SB_MAKEMASK1(K_INT_DM_CH_3)
149#define M_INT_MBOX_0 _SB_MAKEMASK1(K_INT_MBOX_0)
150#define M_INT_MBOX_1 _SB_MAKEMASK1(K_INT_MBOX_1)
151#define M_INT_MBOX_2 _SB_MAKEMASK1(K_INT_MBOX_2)
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)
154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
155#define M_INT_CYCLE_CP0_INT _SB_MAKEMASK1(K_INT_CYCLE_CP0_INT)
156#define M_INT_CYCLE_CP1_INT _SB_MAKEMASK1(K_INT_CYCLE_CP1_INT)
157#endif /* 1250 PASS2 || 112x PASS1 */
158#define M_INT_GPIO_0 _SB_MAKEMASK1(K_INT_GPIO_0)
159#define M_INT_GPIO_1 _SB_MAKEMASK1(K_INT_GPIO_1)
160#define M_INT_GPIO_2 _SB_MAKEMASK1(K_INT_GPIO_2)
161#define M_INT_GPIO_3 _SB_MAKEMASK1(K_INT_GPIO_3)
162#define M_INT_GPIO_4 _SB_MAKEMASK1(K_INT_GPIO_4)
163#define M_INT_GPIO_5 _SB_MAKEMASK1(K_INT_GPIO_5)
164#define M_INT_GPIO_6 _SB_MAKEMASK1(K_INT_GPIO_6)
165#define M_INT_GPIO_7 _SB_MAKEMASK1(K_INT_GPIO_7)
166#define M_INT_GPIO_8 _SB_MAKEMASK1(K_INT_GPIO_8)
167#define M_INT_GPIO_9 _SB_MAKEMASK1(K_INT_GPIO_9)
168#define M_INT_GPIO_10 _SB_MAKEMASK1(K_INT_GPIO_10)
169#define M_INT_GPIO_11 _SB_MAKEMASK1(K_INT_GPIO_11)
170#define M_INT_GPIO_12 _SB_MAKEMASK1(K_INT_GPIO_12)
171#define M_INT_GPIO_13 _SB_MAKEMASK1(K_INT_GPIO_13)
172#define M_INT_GPIO_14 _SB_MAKEMASK1(K_INT_GPIO_14)
173#define M_INT_GPIO_15 _SB_MAKEMASK1(K_INT_GPIO_15)
174#define M_INT_LDT_FATAL _SB_MAKEMASK1(K_INT_LDT_FATAL)
175#define M_INT_LDT_NONFATAL _SB_MAKEMASK1(K_INT_LDT_NONFATAL)
176#define M_INT_LDT_SMI _SB_MAKEMASK1(K_INT_LDT_SMI)
177#define M_INT_LDT_NMI _SB_MAKEMASK1(K_INT_LDT_NMI)
178#define M_INT_LDT_INIT _SB_MAKEMASK1(K_INT_LDT_INIT)
179#define M_INT_LDT_STARTUP _SB_MAKEMASK1(K_INT_LDT_STARTUP)
180#define M_INT_LDT_EXT _SB_MAKEMASK1(K_INT_LDT_EXT)
181#define M_INT_PCI_ERROR _SB_MAKEMASK1(K_INT_PCI_ERROR)
182#define M_INT_PCI_INTA _SB_MAKEMASK1(K_INT_PCI_INTA)
183#define M_INT_PCI_INTB _SB_MAKEMASK1(K_INT_PCI_INTB)
184#define M_INT_PCI_INTC _SB_MAKEMASK1(K_INT_PCI_INTC)
185#define M_INT_PCI_INTD _SB_MAKEMASK1(K_INT_PCI_INTD)
186#define M_INT_SPARE_2 _SB_MAKEMASK1(K_INT_SPARE_2)
187#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
188#define M_INT_MAC_0_CH1 _SB_MAKEMASK1(K_INT_MAC_0_CH1)
189#define M_INT_MAC_1_CH1 _SB_MAKEMASK1(K_INT_MAC_1_CH1)
190#define M_INT_MAC_2_CH1 _SB_MAKEMASK1(K_INT_MAC_2_CH1)
191#endif /* 1250 PASS2 || 112x PASS1 */
192
193/*
194 * Interrupt mappings
195 */
196
197#define K_INT_MAP_I0 0 /* interrupt pins on processor */
198#define K_INT_MAP_I1 1
199#define K_INT_MAP_I2 2
200#define K_INT_MAP_I3 3
201#define K_INT_MAP_I4 4
202#define K_INT_MAP_I5 5
203#define K_INT_MAP_NMI 6 /* nonmaskable */
204#define K_INT_MAP_DINT 7 /* debug interrupt */
205
206/*
207 * LDT Interrupt Set Register (table 4-5)
208 */
209
210#define S_INT_LDT_INTMSG 0
211#define M_INT_LDT_INTMSG _SB_MAKEMASK(3, S_INT_LDT_INTMSG)
212#define V_INT_LDT_INTMSG(x) _SB_MAKEVALUE(x, S_INT_LDT_INTMSG)
213#define G_INT_LDT_INTMSG(x) _SB_GETVALUE(x, S_INT_LDT_INTMSG, M_INT_LDT_INTMSG)
214
215#define K_INT_LDT_INTMSG_FIXED 0
216#define K_INT_LDT_INTMSG_ARBITRATED 1
217#define K_INT_LDT_INTMSG_SMI 2
218#define K_INT_LDT_INTMSG_NMI 3
219#define K_INT_LDT_INTMSG_INIT 4
220#define K_INT_LDT_INTMSG_STARTUP 5
221#define K_INT_LDT_INTMSG_EXTINT 6
222#define K_INT_LDT_INTMSG_RESERVED 7
223
224#define M_INT_LDT_EDGETRIGGER 0
225#define M_INT_LDT_LEVELTRIGGER _SB_MAKEMASK1(3)
226
227#define M_INT_LDT_PHYSICALDEST 0
228#define M_INT_LDT_LOGICALDEST _SB_MAKEMASK1(4)
229
230#define S_INT_LDT_INTDEST 5
231#define M_INT_LDT_INTDEST _SB_MAKEMASK(10, S_INT_LDT_INTDEST)
232#define V_INT_LDT_INTDEST(x) _SB_MAKEVALUE(x, S_INT_LDT_INTDEST)
233#define G_INT_LDT_INTDEST(x) _SB_GETVALUE(x, S_INT_LDT_INTDEST, M_INT_LDT_INTDEST)
234
235#define S_INT_LDT_VECTOR 13
236#define M_INT_LDT_VECTOR _SB_MAKEMASK(8, S_INT_LDT_VECTOR)
237#define V_INT_LDT_VECTOR(x) _SB_MAKEVALUE(x, S_INT_LDT_VECTOR)
238#define G_INT_LDT_VECTOR(x) _SB_GETVALUE(x, S_INT_LDT_VECTOR, M_INT_LDT_VECTOR)
239
240/*
241 * Vector format (Table 4-6)
242 */
243
244#define M_LDTVECT_RAISEINT 0x00
245#define M_LDTVECT_RAISEMBOX 0x40
246
247
248#endif /* 1250/112x */
diff --git a/include/asm-mips/sibyte/sb1250_l2c.h b/include/asm-mips/sibyte/sb1250_l2c.h
deleted file mode 100644
index 6554dcf05cfe..000000000000
--- a/include/asm-mips/sibyte/sb1250_l2c.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * L2 Cache constants and macros File: sb1250_l2c.h
5 *
6 * This module contains constants useful for manipulating the
7 * level 2 cache.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_L2C_H
34#define _SB1250_L2C_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Level 2 Cache Tag register (Table 5-3)
40 */
41
42#define S_L2C_TAG_MBZ 0
43#define M_L2C_TAG_MBZ _SB_MAKEMASK(5, S_L2C_TAG_MBZ)
44
45#define S_L2C_TAG_INDEX 5
46#define M_L2C_TAG_INDEX _SB_MAKEMASK(12, S_L2C_TAG_INDEX)
47#define V_L2C_TAG_INDEX(x) _SB_MAKEVALUE(x, S_L2C_TAG_INDEX)
48#define G_L2C_TAG_INDEX(x) _SB_GETVALUE(x, S_L2C_TAG_INDEX, M_L2C_TAG_INDEX)
49
50#define S_L2C_TAG_TAG 17
51#define M_L2C_TAG_TAG _SB_MAKEMASK(23, S_L2C_TAG_TAG)
52#define V_L2C_TAG_TAG(x) _SB_MAKEVALUE(x, S_L2C_TAG_TAG)
53#define G_L2C_TAG_TAG(x) _SB_GETVALUE(x, S_L2C_TAG_TAG, M_L2C_TAG_TAG)
54
55#define S_L2C_TAG_ECC 40
56#define M_L2C_TAG_ECC _SB_MAKEMASK(6, S_L2C_TAG_ECC)
57#define V_L2C_TAG_ECC(x) _SB_MAKEVALUE(x, S_L2C_TAG_ECC)
58#define G_L2C_TAG_ECC(x) _SB_GETVALUE(x, S_L2C_TAG_ECC, M_L2C_TAG_ECC)
59
60#define S_L2C_TAG_WAY 46
61#define M_L2C_TAG_WAY _SB_MAKEMASK(2, S_L2C_TAG_WAY)
62#define V_L2C_TAG_WAY(x) _SB_MAKEVALUE(x, S_L2C_TAG_WAY)
63#define G_L2C_TAG_WAY(x) _SB_GETVALUE(x, S_L2C_TAG_WAY, M_L2C_TAG_WAY)
64
65#define M_L2C_TAG_DIRTY _SB_MAKEMASK1(48)
66#define M_L2C_TAG_VALID _SB_MAKEMASK1(49)
67
68/*
69 * Format of level 2 cache management address (table 5-2)
70 */
71
72#define S_L2C_MGMT_INDEX 5
73#define M_L2C_MGMT_INDEX _SB_MAKEMASK(12, S_L2C_MGMT_INDEX)
74#define V_L2C_MGMT_INDEX(x) _SB_MAKEVALUE(x, S_L2C_MGMT_INDEX)
75#define G_L2C_MGMT_INDEX(x) _SB_GETVALUE(x, S_L2C_MGMT_INDEX, M_L2C_MGMT_INDEX)
76
77#define S_L2C_MGMT_QUADRANT 15
78#define M_L2C_MGMT_QUADRANT _SB_MAKEMASK(2, S_L2C_MGMT_QUADRANT)
79#define V_L2C_MGMT_QUADRANT(x) _SB_MAKEVALUE(x, S_L2C_MGMT_QUADRANT)
80#define G_L2C_MGMT_QUADRANT(x) _SB_GETVALUE(x, S_L2C_MGMT_QUADRANT, M_L2C_MGMT_QUADRANT)
81
82#define S_L2C_MGMT_HALF 16
83#define M_L2C_MGMT_HALF _SB_MAKEMASK(1, S_L2C_MGMT_HALF)
84
85#define S_L2C_MGMT_WAY 17
86#define M_L2C_MGMT_WAY _SB_MAKEMASK(2, S_L2C_MGMT_WAY)
87#define V_L2C_MGMT_WAY(x) _SB_MAKEVALUE(x, S_L2C_MGMT_WAY)
88#define G_L2C_MGMT_WAY(x) _SB_GETVALUE(x, S_L2C_MGMT_WAY, M_L2C_MGMT_WAY)
89
90#define S_L2C_MGMT_ECC_DIAG 21
91#define M_L2C_MGMT_ECC_DIAG _SB_MAKEMASK(2, S_L2C_MGMT_ECC_DIAG)
92#define V_L2C_MGMT_ECC_DIAG(x) _SB_MAKEVALUE(x, S_L2C_MGMT_ECC_DIAG)
93#define G_L2C_MGMT_ECC_DIAG(x) _SB_GETVALUE(x, S_L2C_MGMT_ECC_DIAG, M_L2C_MGMT_ECC_DIAG)
94
95#define S_L2C_MGMT_TAG 23
96#define M_L2C_MGMT_TAG _SB_MAKEMASK(4, S_L2C_MGMT_TAG)
97#define V_L2C_MGMT_TAG(x) _SB_MAKEVALUE(x, S_L2C_MGMT_TAG)
98#define G_L2C_MGMT_TAG(x) _SB_GETVALUE(x, S_L2C_MGMT_TAG, M_L2C_MGMT_TAG)
99
100#define M_L2C_MGMT_DIRTY _SB_MAKEMASK1(19)
101#define M_L2C_MGMT_VALID _SB_MAKEMASK1(20)
102
103#define A_L2C_MGMT_TAG_BASE 0x00D0000000
104
105#define L2C_ENTRIES_PER_WAY 4096
106#define L2C_NUM_WAYS 4
107
108
109#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
110/*
111 * L2 Read Misc. register (A_L2_READ_MISC)
112 */
113#define S_L2C_MISC_NO_WAY 10
114#define M_L2C_MISC_NO_WAY _SB_MAKEMASK(4, S_L2C_MISC_NO_WAY)
115#define V_L2C_MISC_NO_WAY(x) _SB_MAKEVALUE(x, S_L2C_MISC_NO_WAY)
116#define G_L2C_MISC_NO_WAY(x) _SB_GETVALUE(x, S_L2C_MISC_NO_WAY, M_L2C_MISC_NO_WAY)
117
118#define M_L2C_MISC_ECC_CLEANUP_DIS _SB_MAKEMASK1(9)
119#define M_L2C_MISC_MC_PRIO_LOW _SB_MAKEMASK1(8)
120#define M_L2C_MISC_SOFT_DISABLE_T _SB_MAKEMASK1(7)
121#define M_L2C_MISC_SOFT_DISABLE_B _SB_MAKEMASK1(6)
122#define M_L2C_MISC_SOFT_DISABLE_R _SB_MAKEMASK1(5)
123#define M_L2C_MISC_SOFT_DISABLE_L _SB_MAKEMASK1(4)
124#define M_L2C_MISC_SCACHE_DISABLE_T _SB_MAKEMASK1(3)
125#define M_L2C_MISC_SCACHE_DISABLE_B _SB_MAKEMASK1(2)
126#define M_L2C_MISC_SCACHE_DISABLE_R _SB_MAKEMASK1(1)
127#define M_L2C_MISC_SCACHE_DISABLE_L _SB_MAKEMASK1(0)
128#endif /* 1250 PASS3 || 112x PASS1 */
129
130
131#endif
diff --git a/include/asm-mips/sibyte/sb1250_ldt.h b/include/asm-mips/sibyte/sb1250_ldt.h
deleted file mode 100644
index 081e8b1c4ad0..000000000000
--- a/include/asm-mips/sibyte/sb1250_ldt.h
+++ /dev/null
@@ -1,423 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * LDT constants File: sb1250_ldt.h
5 *
6 * This module contains constants and macros to describe
7 * the LDT interface on the SB1250.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000, 2001, 2002, 2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_LDT_H
34#define _SB1250_LDT_H
35
36#include "sb1250_defs.h"
37
38#define K_LDT_VENDOR_SIBYTE 0x166D
39#define K_LDT_DEVICE_SB1250 0x0002
40
41/*
42 * LDT Interface Type 1 (bridge) configuration header
43 */
44
45#define R_LDT_TYPE1_DEVICEID 0x0000
46#define R_LDT_TYPE1_CMDSTATUS 0x0004
47#define R_LDT_TYPE1_CLASSREV 0x0008
48#define R_LDT_TYPE1_DEVHDR 0x000C
49#define R_LDT_TYPE1_BAR0 0x0010 /* not used */
50#define R_LDT_TYPE1_BAR1 0x0014 /* not used */
51
52#define R_LDT_TYPE1_BUSID 0x0018 /* bus ID register */
53#define R_LDT_TYPE1_SECSTATUS 0x001C /* secondary status / I/O base/limit */
54#define R_LDT_TYPE1_MEMLIMIT 0x0020
55#define R_LDT_TYPE1_PREFETCH 0x0024
56#define R_LDT_TYPE1_PREF_BASE 0x0028
57#define R_LDT_TYPE1_PREF_LIMIT 0x002C
58#define R_LDT_TYPE1_IOLIMIT 0x0030
59#define R_LDT_TYPE1_CAPPTR 0x0034
60#define R_LDT_TYPE1_ROMADDR 0x0038
61#define R_LDT_TYPE1_BRCTL 0x003C
62#define R_LDT_TYPE1_CMD 0x0040
63#define R_LDT_TYPE1_LINKCTRL 0x0044
64#define R_LDT_TYPE1_LINKFREQ 0x0048
65#define R_LDT_TYPE1_RESERVED1 0x004C
66#define R_LDT_TYPE1_SRICMD 0x0050
67#define R_LDT_TYPE1_SRITXNUM 0x0054
68#define R_LDT_TYPE1_SRIRXNUM 0x0058
69#define R_LDT_TYPE1_ERRSTATUS 0x0068
70#define R_LDT_TYPE1_SRICTRL 0x006C
71#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
72#define R_LDT_TYPE1_ADDSTATUS 0x0070
73#endif /* 1250 PASS2 || 112x PASS1 */
74#define R_LDT_TYPE1_TXBUFCNT 0x00C8
75#define R_LDT_TYPE1_EXPCRC 0x00DC
76#define R_LDT_TYPE1_RXCRC 0x00F0
77
78
79/*
80 * LDT Device ID register
81 */
82
83#define S_LDT_DEVICEID_VENDOR 0
84#define M_LDT_DEVICEID_VENDOR _SB_MAKEMASK_32(16, S_LDT_DEVICEID_VENDOR)
85#define V_LDT_DEVICEID_VENDOR(x) _SB_MAKEVALUE_32(x, S_LDT_DEVICEID_VENDOR)
86#define G_LDT_DEVICEID_VENDOR(x) _SB_GETVALUE_32(x, S_LDT_DEVICEID_VENDOR, M_LDT_DEVICEID_VENDOR)
87
88#define S_LDT_DEVICEID_DEVICEID 16
89#define M_LDT_DEVICEID_DEVICEID _SB_MAKEMASK_32(16, S_LDT_DEVICEID_DEVICEID)
90#define V_LDT_DEVICEID_DEVICEID(x) _SB_MAKEVALUE_32(x, S_LDT_DEVICEID_DEVICEID)
91#define G_LDT_DEVICEID_DEVICEID(x) _SB_GETVALUE_32(x, S_LDT_DEVICEID_DEVICEID, M_LDT_DEVICEID_DEVICEID)
92
93
94/*
95 * LDT Command Register (Table 8-13)
96 */
97
98#define M_LDT_CMD_IOSPACE_EN _SB_MAKEMASK1_32(0)
99#define M_LDT_CMD_MEMSPACE_EN _SB_MAKEMASK1_32(1)
100#define M_LDT_CMD_MASTER_EN _SB_MAKEMASK1_32(2)
101#define M_LDT_CMD_SPECCYC_EN _SB_MAKEMASK1_32(3)
102#define M_LDT_CMD_MEMWRINV_EN _SB_MAKEMASK1_32(4)
103#define M_LDT_CMD_VGAPALSNP_EN _SB_MAKEMASK1_32(5)
104#define M_LDT_CMD_PARERRRESP _SB_MAKEMASK1_32(6)
105#define M_LDT_CMD_WAITCYCCTRL _SB_MAKEMASK1_32(7)
106#define M_LDT_CMD_SERR_EN _SB_MAKEMASK1_32(8)
107#define M_LDT_CMD_FASTB2B_EN _SB_MAKEMASK1_32(9)
108
109/*
110 * LDT class and revision registers
111 */
112
113#define S_LDT_CLASSREV_REV 0
114#define M_LDT_CLASSREV_REV _SB_MAKEMASK_32(8, S_LDT_CLASSREV_REV)
115#define V_LDT_CLASSREV_REV(x) _SB_MAKEVALUE_32(x, S_LDT_CLASSREV_REV)
116#define G_LDT_CLASSREV_REV(x) _SB_GETVALUE_32(x, S_LDT_CLASSREV_REV, M_LDT_CLASSREV_REV)
117
118#define S_LDT_CLASSREV_CLASS 8
119#define M_LDT_CLASSREV_CLASS _SB_MAKEMASK_32(24, S_LDT_CLASSREV_CLASS)
120#define V_LDT_CLASSREV_CLASS(x) _SB_MAKEVALUE_32(x, S_LDT_CLASSREV_CLASS)
121#define G_LDT_CLASSREV_CLASS(x) _SB_GETVALUE_32(x, S_LDT_CLASSREV_CLASS, M_LDT_CLASSREV_CLASS)
122
123#define K_LDT_REV 0x01
124#define K_LDT_CLASS 0x060000
125
126/*
127 * Device Header (offset 0x0C)
128 */
129
130#define S_LDT_DEVHDR_CLINESZ 0
131#define M_LDT_DEVHDR_CLINESZ _SB_MAKEMASK_32(8, S_LDT_DEVHDR_CLINESZ)
132#define V_LDT_DEVHDR_CLINESZ(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_CLINESZ)
133#define G_LDT_DEVHDR_CLINESZ(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_CLINESZ, M_LDT_DEVHDR_CLINESZ)
134
135#define S_LDT_DEVHDR_LATTMR 8
136#define M_LDT_DEVHDR_LATTMR _SB_MAKEMASK_32(8, S_LDT_DEVHDR_LATTMR)
137#define V_LDT_DEVHDR_LATTMR(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_LATTMR)
138#define G_LDT_DEVHDR_LATTMR(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_LATTMR, M_LDT_DEVHDR_LATTMR)
139
140#define S_LDT_DEVHDR_HDRTYPE 16
141#define M_LDT_DEVHDR_HDRTYPE _SB_MAKEMASK_32(8, S_LDT_DEVHDR_HDRTYPE)
142#define V_LDT_DEVHDR_HDRTYPE(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_HDRTYPE)
143#define G_LDT_DEVHDR_HDRTYPE(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_HDRTYPE, M_LDT_DEVHDR_HDRTYPE)
144
145#define K_LDT_DEVHDR_HDRTYPE_TYPE1 1
146
147#define S_LDT_DEVHDR_BIST 24
148#define M_LDT_DEVHDR_BIST _SB_MAKEMASK_32(8, S_LDT_DEVHDR_BIST)
149#define V_LDT_DEVHDR_BIST(x) _SB_MAKEVALUE_32(x, S_LDT_DEVHDR_BIST)
150#define G_LDT_DEVHDR_BIST(x) _SB_GETVALUE_32(x, S_LDT_DEVHDR_BIST, M_LDT_DEVHDR_BIST)
151
152
153
154/*
155 * LDT Status Register (Table 8-14). Note that these constants
156 * assume you've read the command and status register
157 * together (32-bit read at offset 0x04)
158 *
159 * These bits also apply to the secondary status
160 * register (Table 8-15), offset 0x1C
161 */
162
163#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
164#define M_LDT_STATUS_VGAEN _SB_MAKEMASK1_32(3)
165#endif /* 1250 PASS2 || 112x PASS1 */
166#define M_LDT_STATUS_CAPLIST _SB_MAKEMASK1_32(20)
167#define M_LDT_STATUS_66MHZCAP _SB_MAKEMASK1_32(21)
168#define M_LDT_STATUS_RESERVED2 _SB_MAKEMASK1_32(22)
169#define M_LDT_STATUS_FASTB2BCAP _SB_MAKEMASK1_32(23)
170#define M_LDT_STATUS_MSTRDPARERR _SB_MAKEMASK1_32(24)
171
172#define S_LDT_STATUS_DEVSELTIMING 25
173#define M_LDT_STATUS_DEVSELTIMING _SB_MAKEMASK_32(2, S_LDT_STATUS_DEVSELTIMING)
174#define V_LDT_STATUS_DEVSELTIMING(x) _SB_MAKEVALUE_32(x, S_LDT_STATUS_DEVSELTIMING)
175#define G_LDT_STATUS_DEVSELTIMING(x) _SB_GETVALUE_32(x, S_LDT_STATUS_DEVSELTIMING, M_LDT_STATUS_DEVSELTIMING)
176
177#define M_LDT_STATUS_SIGDTGTABORT _SB_MAKEMASK1_32(27)
178#define M_LDT_STATUS_RCVDTGTABORT _SB_MAKEMASK1_32(28)
179#define M_LDT_STATUS_RCVDMSTRABORT _SB_MAKEMASK1_32(29)
180#define M_LDT_STATUS_SIGDSERR _SB_MAKEMASK1_32(30)
181#define M_LDT_STATUS_DETPARERR _SB_MAKEMASK1_32(31)
182
183/*
184 * Bridge Control Register (Table 8-16). Note that these
185 * constants assume you've read the register as a 32-bit
186 * read (offset 0x3C)
187 */
188
189#define M_LDT_BRCTL_PARERRRESP_EN _SB_MAKEMASK1_32(16)
190#define M_LDT_BRCTL_SERR_EN _SB_MAKEMASK1_32(17)
191#define M_LDT_BRCTL_ISA_EN _SB_MAKEMASK1_32(18)
192#define M_LDT_BRCTL_VGA_EN _SB_MAKEMASK1_32(19)
193#define M_LDT_BRCTL_MSTRABORTMODE _SB_MAKEMASK1_32(21)
194#define M_LDT_BRCTL_SECBUSRESET _SB_MAKEMASK1_32(22)
195#define M_LDT_BRCTL_FASTB2B_EN _SB_MAKEMASK1_32(23)
196#define M_LDT_BRCTL_PRIDISCARD _SB_MAKEMASK1_32(24)
197#define M_LDT_BRCTL_SECDISCARD _SB_MAKEMASK1_32(25)
198#define M_LDT_BRCTL_DISCARDSTAT _SB_MAKEMASK1_32(26)
199#define M_LDT_BRCTL_DISCARDSERR_EN _SB_MAKEMASK1_32(27)
200
201/*
202 * LDT Command Register (Table 8-17). Note that these constants
203 * assume you've read the command and status register together
204 * 32-bit read at offset 0x40
205 */
206
207#define M_LDT_CMD_WARMRESET _SB_MAKEMASK1_32(16)
208#define M_LDT_CMD_DOUBLEENDED _SB_MAKEMASK1_32(17)
209
210#define S_LDT_CMD_CAPTYPE 29
211#define M_LDT_CMD_CAPTYPE _SB_MAKEMASK_32(3, S_LDT_CMD_CAPTYPE)
212#define V_LDT_CMD_CAPTYPE(x) _SB_MAKEVALUE_32(x, S_LDT_CMD_CAPTYPE)
213#define G_LDT_CMD_CAPTYPE(x) _SB_GETVALUE_32(x, S_LDT_CMD_CAPTYPE, M_LDT_CMD_CAPTYPE)
214
215/*
216 * LDT link control register (Table 8-18), and (Table 8-19)
217 */
218
219#define M_LDT_LINKCTRL_CAPSYNCFLOOD_EN _SB_MAKEMASK1_32(1)
220#define M_LDT_LINKCTRL_CRCSTARTTEST _SB_MAKEMASK1_32(2)
221#define M_LDT_LINKCTRL_CRCFORCEERR _SB_MAKEMASK1_32(3)
222#define M_LDT_LINKCTRL_LINKFAIL _SB_MAKEMASK1_32(4)
223#define M_LDT_LINKCTRL_INITDONE _SB_MAKEMASK1_32(5)
224#define M_LDT_LINKCTRL_EOC _SB_MAKEMASK1_32(6)
225#define M_LDT_LINKCTRL_XMITOFF _SB_MAKEMASK1_32(7)
226
227#define S_LDT_LINKCTRL_CRCERR 8
228#define M_LDT_LINKCTRL_CRCERR _SB_MAKEMASK_32(4, S_LDT_LINKCTRL_CRCERR)
229#define V_LDT_LINKCTRL_CRCERR(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_CRCERR)
230#define G_LDT_LINKCTRL_CRCERR(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_CRCERR, M_LDT_LINKCTRL_CRCERR)
231
232#define S_LDT_LINKCTRL_MAXIN 16
233#define M_LDT_LINKCTRL_MAXIN _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_MAXIN)
234#define V_LDT_LINKCTRL_MAXIN(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_MAXIN)
235#define G_LDT_LINKCTRL_MAXIN(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_MAXIN, M_LDT_LINKCTRL_MAXIN)
236
237#define M_LDT_LINKCTRL_DWFCLN _SB_MAKEMASK1_32(19)
238
239#define S_LDT_LINKCTRL_MAXOUT 20
240#define M_LDT_LINKCTRL_MAXOUT _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_MAXOUT)
241#define V_LDT_LINKCTRL_MAXOUT(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_MAXOUT)
242#define G_LDT_LINKCTRL_MAXOUT(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_MAXOUT, M_LDT_LINKCTRL_MAXOUT)
243
244#define M_LDT_LINKCTRL_DWFCOUT _SB_MAKEMASK1_32(23)
245
246#define S_LDT_LINKCTRL_WIDTHIN 24
247#define M_LDT_LINKCTRL_WIDTHIN _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_WIDTHIN)
248#define V_LDT_LINKCTRL_WIDTHIN(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_WIDTHIN)
249#define G_LDT_LINKCTRL_WIDTHIN(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_WIDTHIN, M_LDT_LINKCTRL_WIDTHIN)
250
251#define M_LDT_LINKCTRL_DWFCLIN_EN _SB_MAKEMASK1_32(27)
252
253#define S_LDT_LINKCTRL_WIDTHOUT 28
254#define M_LDT_LINKCTRL_WIDTHOUT _SB_MAKEMASK_32(3, S_LDT_LINKCTRL_WIDTHOUT)
255#define V_LDT_LINKCTRL_WIDTHOUT(x) _SB_MAKEVALUE_32(x, S_LDT_LINKCTRL_WIDTHOUT)
256#define G_LDT_LINKCTRL_WIDTHOUT(x) _SB_GETVALUE_32(x, S_LDT_LINKCTRL_WIDTHOUT, M_LDT_LINKCTRL_WIDTHOUT)
257
258#define M_LDT_LINKCTRL_DWFCOUT_EN _SB_MAKEMASK1_32(31)
259
260/*
261 * LDT Link frequency register (Table 8-20) offset 0x48
262 */
263
264#define S_LDT_LINKFREQ_FREQ 8
265#define M_LDT_LINKFREQ_FREQ _SB_MAKEMASK_32(4, S_LDT_LINKFREQ_FREQ)
266#define V_LDT_LINKFREQ_FREQ(x) _SB_MAKEVALUE_32(x, S_LDT_LINKFREQ_FREQ)
267#define G_LDT_LINKFREQ_FREQ(x) _SB_GETVALUE_32(x, S_LDT_LINKFREQ_FREQ, M_LDT_LINKFREQ_FREQ)
268
269#define K_LDT_LINKFREQ_200MHZ 0
270#define K_LDT_LINKFREQ_300MHZ 1
271#define K_LDT_LINKFREQ_400MHZ 2
272#define K_LDT_LINKFREQ_500MHZ 3
273#define K_LDT_LINKFREQ_600MHZ 4
274#define K_LDT_LINKFREQ_800MHZ 5
275#define K_LDT_LINKFREQ_1000MHZ 6
276
277/*
278 * LDT SRI Command Register (Table 8-21). Note that these constants
279 * assume you've read the command and status register together
280 * 32-bit read at offset 0x50
281 */
282
283#define M_LDT_SRICMD_SIPREADY _SB_MAKEMASK1_32(16)
284#define M_LDT_SRICMD_SYNCPTRCTL _SB_MAKEMASK1_32(17)
285#define M_LDT_SRICMD_REDUCESYNCZERO _SB_MAKEMASK1_32(18)
286#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
287#define M_LDT_SRICMD_DISSTARVATIONCNT _SB_MAKEMASK1_32(19) /* PASS1 */
288#endif /* up to 1250 PASS1 */
289#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
290#define M_LDT_SRICMD_DISMULTTXVLD _SB_MAKEMASK1_32(19)
291#define M_LDT_SRICMD_EXPENDIAN _SB_MAKEMASK1_32(26)
292#endif /* 1250 PASS2 || 112x PASS1 */
293
294
295#define S_LDT_SRICMD_RXMARGIN 20
296#define M_LDT_SRICMD_RXMARGIN _SB_MAKEMASK_32(5, S_LDT_SRICMD_RXMARGIN)
297#define V_LDT_SRICMD_RXMARGIN(x) _SB_MAKEVALUE_32(x, S_LDT_SRICMD_RXMARGIN)
298#define G_LDT_SRICMD_RXMARGIN(x) _SB_GETVALUE_32(x, S_LDT_SRICMD_RXMARGIN, M_LDT_SRICMD_RXMARGIN)
299
300#define M_LDT_SRICMD_LDTPLLCOMPAT _SB_MAKEMASK1_32(25)
301
302#define S_LDT_SRICMD_TXINITIALOFFSET 28
303#define M_LDT_SRICMD_TXINITIALOFFSET _SB_MAKEMASK_32(3, S_LDT_SRICMD_TXINITIALOFFSET)
304#define V_LDT_SRICMD_TXINITIALOFFSET(x) _SB_MAKEVALUE_32(x, S_LDT_SRICMD_TXINITIALOFFSET)
305#define G_LDT_SRICMD_TXINITIALOFFSET(x) _SB_GETVALUE_32(x, S_LDT_SRICMD_TXINITIALOFFSET, M_LDT_SRICMD_TXINITIALOFFSET)
306
307#define M_LDT_SRICMD_LINKFREQDIRECT _SB_MAKEMASK1_32(31)
308
309/*
310 * LDT Error control and status register (Table 8-22) (Table 8-23)
311 */
312
313#define M_LDT_ERRCTL_PROTFATAL_EN _SB_MAKEMASK1_32(0)
314#define M_LDT_ERRCTL_PROTNONFATAL_EN _SB_MAKEMASK1_32(1)
315#define M_LDT_ERRCTL_PROTSYNCFLOOD_EN _SB_MAKEMASK1_32(2)
316#define M_LDT_ERRCTL_OVFFATAL_EN _SB_MAKEMASK1_32(3)
317#define M_LDT_ERRCTL_OVFNONFATAL_EN _SB_MAKEMASK1_32(4)
318#define M_LDT_ERRCTL_OVFSYNCFLOOD_EN _SB_MAKEMASK1_32(5)
319#define M_LDT_ERRCTL_EOCNXAFATAL_EN _SB_MAKEMASK1_32(6)
320#define M_LDT_ERRCTL_EOCNXANONFATAL_EN _SB_MAKEMASK1_32(7)
321#define M_LDT_ERRCTL_EOCNXASYNCFLOOD_EN _SB_MAKEMASK1_32(8)
322#define M_LDT_ERRCTL_CRCFATAL_EN _SB_MAKEMASK1_32(9)
323#define M_LDT_ERRCTL_CRCNONFATAL_EN _SB_MAKEMASK1_32(10)
324#define M_LDT_ERRCTL_SERRFATAL_EN _SB_MAKEMASK1_32(11)
325#define M_LDT_ERRCTL_SRCTAGFATAL_EN _SB_MAKEMASK1_32(12)
326#define M_LDT_ERRCTL_SRCTAGNONFATAL_EN _SB_MAKEMASK1_32(13)
327#define M_LDT_ERRCTL_SRCTAGSYNCFLOOD_EN _SB_MAKEMASK1_32(14)
328#define M_LDT_ERRCTL_MAPNXAFATAL_EN _SB_MAKEMASK1_32(15)
329#define M_LDT_ERRCTL_MAPNXANONFATAL_EN _SB_MAKEMASK1_32(16)
330#define M_LDT_ERRCTL_MAPNXASYNCFLOOD_EN _SB_MAKEMASK1_32(17)
331
332#define M_LDT_ERRCTL_PROTOERR _SB_MAKEMASK1_32(24)
333#define M_LDT_ERRCTL_OVFERR _SB_MAKEMASK1_32(25)
334#define M_LDT_ERRCTL_EOCNXAERR _SB_MAKEMASK1_32(26)
335#define M_LDT_ERRCTL_SRCTAGERR _SB_MAKEMASK1_32(27)
336#define M_LDT_ERRCTL_MAPNXAERR _SB_MAKEMASK1_32(28)
337
338/*
339 * SRI Control register (Table 8-24, 8-25) Offset 0x6C
340 */
341
342#define S_LDT_SRICTRL_NEEDRESP 0
343#define M_LDT_SRICTRL_NEEDRESP _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDRESP)
344#define V_LDT_SRICTRL_NEEDRESP(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDRESP)
345#define G_LDT_SRICTRL_NEEDRESP(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDRESP, M_LDT_SRICTRL_NEEDRESP)
346
347#define S_LDT_SRICTRL_NEEDNPREQ 2
348#define M_LDT_SRICTRL_NEEDNPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDNPREQ)
349#define V_LDT_SRICTRL_NEEDNPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDNPREQ)
350#define G_LDT_SRICTRL_NEEDNPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDNPREQ, M_LDT_SRICTRL_NEEDNPREQ)
351
352#define S_LDT_SRICTRL_NEEDPREQ 4
353#define M_LDT_SRICTRL_NEEDPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_NEEDPREQ)
354#define V_LDT_SRICTRL_NEEDPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_NEEDPREQ)
355#define G_LDT_SRICTRL_NEEDPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_NEEDPREQ, M_LDT_SRICTRL_NEEDPREQ)
356
357#define S_LDT_SRICTRL_WANTRESP 8
358#define M_LDT_SRICTRL_WANTRESP _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTRESP)
359#define V_LDT_SRICTRL_WANTRESP(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTRESP)
360#define G_LDT_SRICTRL_WANTRESP(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTRESP, M_LDT_SRICTRL_WANTRESP)
361
362#define S_LDT_SRICTRL_WANTNPREQ 10
363#define M_LDT_SRICTRL_WANTNPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTNPREQ)
364#define V_LDT_SRICTRL_WANTNPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTNPREQ)
365#define G_LDT_SRICTRL_WANTNPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTNPREQ, M_LDT_SRICTRL_WANTNPREQ)
366
367#define S_LDT_SRICTRL_WANTPREQ 12
368#define M_LDT_SRICTRL_WANTPREQ _SB_MAKEMASK_32(2, S_LDT_SRICTRL_WANTPREQ)
369#define V_LDT_SRICTRL_WANTPREQ(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_WANTPREQ)
370#define G_LDT_SRICTRL_WANTPREQ(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_WANTPREQ, M_LDT_SRICTRL_WANTPREQ)
371
372#define S_LDT_SRICTRL_BUFRELSPACE 16
373#define M_LDT_SRICTRL_BUFRELSPACE _SB_MAKEMASK_32(4, S_LDT_SRICTRL_BUFRELSPACE)
374#define V_LDT_SRICTRL_BUFRELSPACE(x) _SB_MAKEVALUE_32(x, S_LDT_SRICTRL_BUFRELSPACE)
375#define G_LDT_SRICTRL_BUFRELSPACE(x) _SB_GETVALUE_32(x, S_LDT_SRICTRL_BUFRELSPACE, M_LDT_SRICTRL_BUFRELSPACE)
376
377/*
378 * LDT SRI Transmit Buffer Count register (Table 8-26)
379 */
380
381#define S_LDT_TXBUFCNT_PCMD 0
382#define M_LDT_TXBUFCNT_PCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_PCMD)
383#define V_LDT_TXBUFCNT_PCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_PCMD)
384#define G_LDT_TXBUFCNT_PCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_PCMD, M_LDT_TXBUFCNT_PCMD)
385
386#define S_LDT_TXBUFCNT_PDATA 4
387#define M_LDT_TXBUFCNT_PDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_PDATA)
388#define V_LDT_TXBUFCNT_PDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_PDATA)
389#define G_LDT_TXBUFCNT_PDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_PDATA, M_LDT_TXBUFCNT_PDATA)
390
391#define S_LDT_TXBUFCNT_NPCMD 8
392#define M_LDT_TXBUFCNT_NPCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_NPCMD)
393#define V_LDT_TXBUFCNT_NPCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_NPCMD)
394#define G_LDT_TXBUFCNT_NPCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_NPCMD, M_LDT_TXBUFCNT_NPCMD)
395
396#define S_LDT_TXBUFCNT_NPDATA 12
397#define M_LDT_TXBUFCNT_NPDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_NPDATA)
398#define V_LDT_TXBUFCNT_NPDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_NPDATA)
399#define G_LDT_TXBUFCNT_NPDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_NPDATA, M_LDT_TXBUFCNT_NPDATA)
400
401#define S_LDT_TXBUFCNT_RCMD 16
402#define M_LDT_TXBUFCNT_RCMD _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_RCMD)
403#define V_LDT_TXBUFCNT_RCMD(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_RCMD)
404#define G_LDT_TXBUFCNT_RCMD(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_RCMD, M_LDT_TXBUFCNT_RCMD)
405
406#define S_LDT_TXBUFCNT_RDATA 20
407#define M_LDT_TXBUFCNT_RDATA _SB_MAKEMASK_32(4, S_LDT_TXBUFCNT_RDATA)
408#define V_LDT_TXBUFCNT_RDATA(x) _SB_MAKEVALUE_32(x, S_LDT_TXBUFCNT_RDATA)
409#define G_LDT_TXBUFCNT_RDATA(x) _SB_GETVALUE_32(x, S_LDT_TXBUFCNT_RDATA, M_LDT_TXBUFCNT_RDATA)
410
411#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
412/*
413 * Additional Status Register
414 */
415
416#define S_LDT_ADDSTATUS_TGTDONE 0
417#define M_LDT_ADDSTATUS_TGTDONE _SB_MAKEMASK_32(8, S_LDT_ADDSTATUS_TGTDONE)
418#define V_LDT_ADDSTATUS_TGTDONE(x) _SB_MAKEVALUE_32(x, S_LDT_ADDSTATUS_TGTDONE)
419#define G_LDT_ADDSTATUS_TGTDONE(x) _SB_GETVALUE_32(x, S_LDT_ADDSTATUS_TGTDONE, M_LDT_ADDSTATUS_TGTDONE)
420#endif /* 1250 PASS2 || 112x PASS1 */
421
422#endif
423
diff --git a/include/asm-mips/sibyte/sb1250_mac.h b/include/asm-mips/sibyte/sb1250_mac.h
deleted file mode 100644
index b6faf08ca81d..000000000000
--- a/include/asm-mips/sibyte/sb1250_mac.h
+++ /dev/null
@@ -1,656 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * MAC constants and macros File: sb1250_mac.h
5 *
6 * This module contains constants and macros for the SB1250's
7 * ethernet controllers.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_MAC_H
34#define _SB1250_MAC_H
35
36#include "sb1250_defs.h"
37
38/* *********************************************************************
39 * Ethernet MAC Registers
40 ********************************************************************* */
41
42/*
43 * MAC Configuration Register (Table 9-13)
44 * Register: MAC_CFG_0
45 * Register: MAC_CFG_1
46 * Register: MAC_CFG_2
47 */
48
49
50#define M_MAC_RESERVED0 _SB_MAKEMASK1(0)
51#define M_MAC_TX_HOLD_SOP_EN _SB_MAKEMASK1(1)
52#define M_MAC_RETRY_EN _SB_MAKEMASK1(2)
53#define M_MAC_RET_DRPREQ_EN _SB_MAKEMASK1(3)
54#define M_MAC_RET_UFL_EN _SB_MAKEMASK1(4)
55#define M_MAC_BURST_EN _SB_MAKEMASK1(5)
56
57#define S_MAC_TX_PAUSE _SB_MAKE64(6)
58#define M_MAC_TX_PAUSE_CNT _SB_MAKEMASK(3, S_MAC_TX_PAUSE)
59#define V_MAC_TX_PAUSE_CNT(x) _SB_MAKEVALUE(x, S_MAC_TX_PAUSE)
60
61#define K_MAC_TX_PAUSE_CNT_512 0
62#define K_MAC_TX_PAUSE_CNT_1K 1
63#define K_MAC_TX_PAUSE_CNT_2K 2
64#define K_MAC_TX_PAUSE_CNT_4K 3
65#define K_MAC_TX_PAUSE_CNT_8K 4
66#define K_MAC_TX_PAUSE_CNT_16K 5
67#define K_MAC_TX_PAUSE_CNT_32K 6
68#define K_MAC_TX_PAUSE_CNT_64K 7
69
70#define V_MAC_TX_PAUSE_CNT_512 V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_512)
71#define V_MAC_TX_PAUSE_CNT_1K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_1K)
72#define V_MAC_TX_PAUSE_CNT_2K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_2K)
73#define V_MAC_TX_PAUSE_CNT_4K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_4K)
74#define V_MAC_TX_PAUSE_CNT_8K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_8K)
75#define V_MAC_TX_PAUSE_CNT_16K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_16K)
76#define V_MAC_TX_PAUSE_CNT_32K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_32K)
77#define V_MAC_TX_PAUSE_CNT_64K V_MAC_TX_PAUSE_CNT(K_MAC_TX_PAUSE_CNT_64K)
78
79#define M_MAC_RESERVED1 _SB_MAKEMASK(8, 9)
80
81#define M_MAC_AP_STAT_EN _SB_MAKEMASK1(17)
82
83#if SIBYTE_HDR_FEATURE_CHIP(1480)
84#define M_MAC_TIMESTAMP _SB_MAKEMASK1(18)
85#endif
86#define M_MAC_DRP_ERRPKT_EN _SB_MAKEMASK1(19)
87#define M_MAC_DRP_FCSERRPKT_EN _SB_MAKEMASK1(20)
88#define M_MAC_DRP_CODEERRPKT_EN _SB_MAKEMASK1(21)
89#define M_MAC_DRP_DRBLERRPKT_EN _SB_MAKEMASK1(22)
90#define M_MAC_DRP_RNTPKT_EN _SB_MAKEMASK1(23)
91#define M_MAC_DRP_OSZPKT_EN _SB_MAKEMASK1(24)
92#define M_MAC_DRP_LENERRPKT_EN _SB_MAKEMASK1(25)
93
94#define M_MAC_RESERVED3 _SB_MAKEMASK(6, 26)
95
96#define M_MAC_BYPASS_SEL _SB_MAKEMASK1(32)
97#define M_MAC_HDX_EN _SB_MAKEMASK1(33)
98
99#define S_MAC_SPEED_SEL _SB_MAKE64(34)
100#define M_MAC_SPEED_SEL _SB_MAKEMASK(2, S_MAC_SPEED_SEL)
101#define V_MAC_SPEED_SEL(x) _SB_MAKEVALUE(x, S_MAC_SPEED_SEL)
102#define G_MAC_SPEED_SEL(x) _SB_GETVALUE(x, S_MAC_SPEED_SEL, M_MAC_SPEED_SEL)
103
104#define K_MAC_SPEED_SEL_10MBPS 0
105#define K_MAC_SPEED_SEL_100MBPS 1
106#define K_MAC_SPEED_SEL_1000MBPS 2
107#define K_MAC_SPEED_SEL_RESERVED 3
108
109#define V_MAC_SPEED_SEL_10MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_10MBPS)
110#define V_MAC_SPEED_SEL_100MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_100MBPS)
111#define V_MAC_SPEED_SEL_1000MBPS V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_1000MBPS)
112#define V_MAC_SPEED_SEL_RESERVED V_MAC_SPEED_SEL(K_MAC_SPEED_SEL_RESERVED)
113
114#define M_MAC_TX_CLK_EDGE_SEL _SB_MAKEMASK1(36)
115#define M_MAC_LOOPBACK_SEL _SB_MAKEMASK1(37)
116#define M_MAC_FAST_SYNC _SB_MAKEMASK1(38)
117#define M_MAC_SS_EN _SB_MAKEMASK1(39)
118
119#define S_MAC_BYPASS_CFG _SB_MAKE64(40)
120#define M_MAC_BYPASS_CFG _SB_MAKEMASK(2, S_MAC_BYPASS_CFG)
121#define V_MAC_BYPASS_CFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_CFG)
122#define G_MAC_BYPASS_CFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_CFG, M_MAC_BYPASS_CFG)
123
124#define K_MAC_BYPASS_GMII 0
125#define K_MAC_BYPASS_ENCODED 1
126#define K_MAC_BYPASS_SOP 2
127#define K_MAC_BYPASS_EOP 3
128
129#define M_MAC_BYPASS_16 _SB_MAKEMASK1(42)
130#define M_MAC_BYPASS_FCS_CHK _SB_MAKEMASK1(43)
131
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)
134#endif /* 1250 PASS2 || 112x PASS1 || 1480*/
135
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)
138#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
139
140#define S_MAC_BYPASS_IFG _SB_MAKE64(46)
141#define M_MAC_BYPASS_IFG _SB_MAKEMASK(8, S_MAC_BYPASS_IFG)
142#define V_MAC_BYPASS_IFG(x) _SB_MAKEVALUE(x, S_MAC_BYPASS_IFG)
143#define G_MAC_BYPASS_IFG(x) _SB_GETVALUE(x, S_MAC_BYPASS_IFG, M_MAC_BYPASS_IFG)
144
145#define K_MAC_FC_CMD_DISABLED 0
146#define K_MAC_FC_CMD_ENABLED 1
147#define K_MAC_FC_CMD_ENAB_FALSECARR 2
148
149#define V_MAC_FC_CMD_DISABLED V_MAC_FC_CMD(K_MAC_FC_CMD_DISABLED)
150#define V_MAC_FC_CMD_ENABLED V_MAC_FC_CMD(K_MAC_FC_CMD_ENABLED)
151#define V_MAC_FC_CMD_ENAB_FALSECARR V_MAC_FC_CMD(K_MAC_FC_CMD_ENAB_FALSECARR)
152
153#define M_MAC_FC_SEL _SB_MAKEMASK1(54)
154
155#define S_MAC_FC_CMD _SB_MAKE64(55)
156#define M_MAC_FC_CMD _SB_MAKEMASK(2, S_MAC_FC_CMD)
157#define V_MAC_FC_CMD(x) _SB_MAKEVALUE(x, S_MAC_FC_CMD)
158#define G_MAC_FC_CMD(x) _SB_GETVALUE(x, S_MAC_FC_CMD, M_MAC_FC_CMD)
159
160#define S_MAC_RX_CH_SEL _SB_MAKE64(57)
161#define M_MAC_RX_CH_SEL _SB_MAKEMASK(7, S_MAC_RX_CH_SEL)
162#define V_MAC_RX_CH_SEL(x) _SB_MAKEVALUE(x, S_MAC_RX_CH_SEL)
163#define G_MAC_RX_CH_SEL(x) _SB_GETVALUE(x, S_MAC_RX_CH_SEL, M_MAC_RX_CH_SEL)
164
165
166/*
167 * MAC Enable Registers
168 * Register: MAC_ENABLE_0
169 * Register: MAC_ENABLE_1
170 * Register: MAC_ENABLE_2
171 */
172
173#define M_MAC_RXDMA_EN0 _SB_MAKEMASK1(0)
174#define M_MAC_RXDMA_EN1 _SB_MAKEMASK1(1)
175#define M_MAC_TXDMA_EN0 _SB_MAKEMASK1(4)
176#define M_MAC_TXDMA_EN1 _SB_MAKEMASK1(5)
177
178#define M_MAC_PORT_RESET _SB_MAKEMASK1(8)
179
180#if (SIBYTE_HDR_FEATURE_CHIP(1250) || SIBYTE_HDR_FEATURE_CHIP(112x))
181#define M_MAC_RX_ENABLE _SB_MAKEMASK1(10)
182#define M_MAC_TX_ENABLE _SB_MAKEMASK1(11)
183#define M_MAC_BYP_RX_ENABLE _SB_MAKEMASK1(12)
184#define M_MAC_BYP_TX_ENABLE _SB_MAKEMASK1(13)
185#endif
186
187/*
188 * MAC reset information register (1280/1255)
189 */
190#if SIBYTE_HDR_FEATURE_CHIP(1480)
191#define M_MAC_RX_CH0_PAUSE_ON _SB_MAKEMASK1(8)
192#define M_MAC_RX_CH1_PAUSE_ON _SB_MAKEMASK1(16)
193#define M_MAC_TX_CH0_PAUSE_ON _SB_MAKEMASK1(24)
194#define M_MAC_TX_CH1_PAUSE_ON _SB_MAKEMASK1(32)
195#endif
196
197/*
198 * MAC DMA Control Register
199 * Register: MAC_TXD_CTL_0
200 * Register: MAC_TXD_CTL_1
201 * Register: MAC_TXD_CTL_2
202 */
203
204#define S_MAC_TXD_WEIGHT0 _SB_MAKE64(0)
205#define M_MAC_TXD_WEIGHT0 _SB_MAKEMASK(4, S_MAC_TXD_WEIGHT0)
206#define V_MAC_TXD_WEIGHT0(x) _SB_MAKEVALUE(x, S_MAC_TXD_WEIGHT0)
207#define G_MAC_TXD_WEIGHT0(x) _SB_GETVALUE(x, S_MAC_TXD_WEIGHT0, M_MAC_TXD_WEIGHT0)
208
209#define S_MAC_TXD_WEIGHT1 _SB_MAKE64(4)
210#define M_MAC_TXD_WEIGHT1 _SB_MAKEMASK(4, S_MAC_TXD_WEIGHT1)
211#define V_MAC_TXD_WEIGHT1(x) _SB_MAKEVALUE(x, S_MAC_TXD_WEIGHT1)
212#define G_MAC_TXD_WEIGHT1(x) _SB_GETVALUE(x, S_MAC_TXD_WEIGHT1, M_MAC_TXD_WEIGHT1)
213
214/*
215 * MAC Fifo Threshhold registers (Table 9-14)
216 * Register: MAC_THRSH_CFG_0
217 * Register: MAC_THRSH_CFG_1
218 * Register: MAC_THRSH_CFG_2
219 */
220
221#define S_MAC_TX_WR_THRSH _SB_MAKE64(0)
222#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
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) */
225#endif /* up to 1250 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)
228#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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)
231
232#define S_MAC_TX_RD_THRSH _SB_MAKE64(8)
233#if SIBYTE_HDR_FEATURE_UP_TO(1250, PASS1)
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) */
236#endif /* up to 1250 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)
239#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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)
242
243#define S_MAC_TX_RL_THRSH _SB_MAKE64(16)
244#define M_MAC_TX_RL_THRSH _SB_MAKEMASK(4, S_MAC_TX_RL_THRSH)
245#define V_MAC_TX_RL_THRSH(x) _SB_MAKEVALUE(x, S_MAC_TX_RL_THRSH)
246#define G_MAC_TX_RL_THRSH(x) _SB_GETVALUE(x, S_MAC_TX_RL_THRSH, M_MAC_TX_RL_THRSH)
247
248#define S_MAC_RX_PL_THRSH _SB_MAKE64(24)
249#define M_MAC_RX_PL_THRSH _SB_MAKEMASK(6, S_MAC_RX_PL_THRSH)
250#define V_MAC_RX_PL_THRSH(x) _SB_MAKEVALUE(x, S_MAC_RX_PL_THRSH)
251#define G_MAC_RX_PL_THRSH(x) _SB_GETVALUE(x, S_MAC_RX_PL_THRSH, M_MAC_RX_PL_THRSH)
252
253#define S_MAC_RX_RD_THRSH _SB_MAKE64(32)
254#define M_MAC_RX_RD_THRSH _SB_MAKEMASK(6, S_MAC_RX_RD_THRSH)
255#define V_MAC_RX_RD_THRSH(x) _SB_MAKEVALUE(x, S_MAC_RX_RD_THRSH)
256#define G_MAC_RX_RD_THRSH(x) _SB_GETVALUE(x, S_MAC_RX_RD_THRSH, M_MAC_RX_RD_THRSH)
257
258#define S_MAC_RX_RL_THRSH _SB_MAKE64(40)
259#define M_MAC_RX_RL_THRSH _SB_MAKEMASK(6, 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)
262
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)
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)
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 || 1480 */
269
270/*
271 * MAC Frame Configuration Registers (Table 9-15)
272 * Register: MAC_FRAME_CFG_0
273 * Register: MAC_FRAME_CFG_1
274 * Register: MAC_FRAME_CFG_2
275 */
276
277/* XXXCGD: ??? Unused in pass2? */
278#define S_MAC_IFG_RX _SB_MAKE64(0)
279#define M_MAC_IFG_RX _SB_MAKEMASK(6, S_MAC_IFG_RX)
280#define V_MAC_IFG_RX(x) _SB_MAKEVALUE(x, S_MAC_IFG_RX)
281#define G_MAC_IFG_RX(x) _SB_GETVALUE(x, S_MAC_IFG_RX, M_MAC_IFG_RX)
282
283#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
284#define S_MAC_PRE_LEN _SB_MAKE64(0)
285#define M_MAC_PRE_LEN _SB_MAKEMASK(6, S_MAC_PRE_LEN)
286#define V_MAC_PRE_LEN(x) _SB_MAKEVALUE(x, S_MAC_PRE_LEN)
287#define G_MAC_PRE_LEN(x) _SB_GETVALUE(x, S_MAC_PRE_LEN, M_MAC_PRE_LEN)
288#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
289
290#define S_MAC_IFG_TX _SB_MAKE64(6)
291#define M_MAC_IFG_TX _SB_MAKEMASK(6, S_MAC_IFG_TX)
292#define V_MAC_IFG_TX(x) _SB_MAKEVALUE(x, S_MAC_IFG_TX)
293#define G_MAC_IFG_TX(x) _SB_GETVALUE(x, S_MAC_IFG_TX, M_MAC_IFG_TX)
294
295#define S_MAC_IFG_THRSH _SB_MAKE64(12)
296#define M_MAC_IFG_THRSH _SB_MAKEMASK(6, S_MAC_IFG_THRSH)
297#define V_MAC_IFG_THRSH(x) _SB_MAKEVALUE(x, S_MAC_IFG_THRSH)
298#define G_MAC_IFG_THRSH(x) _SB_GETVALUE(x, S_MAC_IFG_THRSH, M_MAC_IFG_THRSH)
299
300#define S_MAC_BACKOFF_SEL _SB_MAKE64(18)
301#define M_MAC_BACKOFF_SEL _SB_MAKEMASK(4, S_MAC_BACKOFF_SEL)
302#define V_MAC_BACKOFF_SEL(x) _SB_MAKEVALUE(x, S_MAC_BACKOFF_SEL)
303#define G_MAC_BACKOFF_SEL(x) _SB_GETVALUE(x, S_MAC_BACKOFF_SEL, M_MAC_BACKOFF_SEL)
304
305#define S_MAC_LFSR_SEED _SB_MAKE64(22)
306#define M_MAC_LFSR_SEED _SB_MAKEMASK(8, S_MAC_LFSR_SEED)
307#define V_MAC_LFSR_SEED(x) _SB_MAKEVALUE(x, S_MAC_LFSR_SEED)
308#define G_MAC_LFSR_SEED(x) _SB_GETVALUE(x, S_MAC_LFSR_SEED, M_MAC_LFSR_SEED)
309
310#define S_MAC_SLOT_SIZE _SB_MAKE64(30)
311#define M_MAC_SLOT_SIZE _SB_MAKEMASK(10, S_MAC_SLOT_SIZE)
312#define V_MAC_SLOT_SIZE(x) _SB_MAKEVALUE(x, S_MAC_SLOT_SIZE)
313#define G_MAC_SLOT_SIZE(x) _SB_GETVALUE(x, S_MAC_SLOT_SIZE, M_MAC_SLOT_SIZE)
314
315#define S_MAC_MIN_FRAMESZ _SB_MAKE64(40)
316#define M_MAC_MIN_FRAMESZ _SB_MAKEMASK(8, S_MAC_MIN_FRAMESZ)
317#define V_MAC_MIN_FRAMESZ(x) _SB_MAKEVALUE(x, S_MAC_MIN_FRAMESZ)
318#define G_MAC_MIN_FRAMESZ(x) _SB_GETVALUE(x, S_MAC_MIN_FRAMESZ, M_MAC_MIN_FRAMESZ)
319
320#define S_MAC_MAX_FRAMESZ _SB_MAKE64(48)
321#define M_MAC_MAX_FRAMESZ _SB_MAKEMASK(16, S_MAC_MAX_FRAMESZ)
322#define V_MAC_MAX_FRAMESZ(x) _SB_MAKEVALUE(x, S_MAC_MAX_FRAMESZ)
323#define G_MAC_MAX_FRAMESZ(x) _SB_GETVALUE(x, S_MAC_MAX_FRAMESZ, M_MAC_MAX_FRAMESZ)
324
325/*
326 * These constants are used to configure the fields within the Frame
327 * Configuration Register.
328 */
329
330#define K_MAC_IFG_RX_10 _SB_MAKE64(0) /* See table 176, not used */
331#define K_MAC_IFG_RX_100 _SB_MAKE64(0)
332#define K_MAC_IFG_RX_1000 _SB_MAKE64(0)
333
334#define K_MAC_IFG_TX_10 _SB_MAKE64(20)
335#define K_MAC_IFG_TX_100 _SB_MAKE64(20)
336#define K_MAC_IFG_TX_1000 _SB_MAKE64(8)
337
338#define K_MAC_IFG_THRSH_10 _SB_MAKE64(4)
339#define K_MAC_IFG_THRSH_100 _SB_MAKE64(4)
340#define K_MAC_IFG_THRSH_1000 _SB_MAKE64(0)
341
342#define K_MAC_SLOT_SIZE_10 _SB_MAKE64(0)
343#define K_MAC_SLOT_SIZE_100 _SB_MAKE64(0)
344#define K_MAC_SLOT_SIZE_1000 _SB_MAKE64(0)
345
346#define V_MAC_IFG_RX_10 V_MAC_IFG_RX(K_MAC_IFG_RX_10)
347#define V_MAC_IFG_RX_100 V_MAC_IFG_RX(K_MAC_IFG_RX_100)
348#define V_MAC_IFG_RX_1000 V_MAC_IFG_RX(K_MAC_IFG_RX_1000)
349
350#define V_MAC_IFG_TX_10 V_MAC_IFG_TX(K_MAC_IFG_TX_10)
351#define V_MAC_IFG_TX_100 V_MAC_IFG_TX(K_MAC_IFG_TX_100)
352#define V_MAC_IFG_TX_1000 V_MAC_IFG_TX(K_MAC_IFG_TX_1000)
353
354#define V_MAC_IFG_THRSH_10 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_10)
355#define V_MAC_IFG_THRSH_100 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_100)
356#define V_MAC_IFG_THRSH_1000 V_MAC_IFG_THRSH(K_MAC_IFG_THRSH_1000)
357
358#define V_MAC_SLOT_SIZE_10 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_10)
359#define V_MAC_SLOT_SIZE_100 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_100)
360#define V_MAC_SLOT_SIZE_1000 V_MAC_SLOT_SIZE(K_MAC_SLOT_SIZE_1000)
361
362#define K_MAC_MIN_FRAMESZ_FIFO _SB_MAKE64(9)
363#define K_MAC_MIN_FRAMESZ_DEFAULT _SB_MAKE64(64)
364#define K_MAC_MAX_FRAMESZ_DEFAULT _SB_MAKE64(1518)
365#define K_MAC_MAX_FRAMESZ_JUMBO _SB_MAKE64(9216)
366
367#define V_MAC_MIN_FRAMESZ_FIFO V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_FIFO)
368#define V_MAC_MIN_FRAMESZ_DEFAULT V_MAC_MIN_FRAMESZ(K_MAC_MIN_FRAMESZ_DEFAULT)
369#define V_MAC_MAX_FRAMESZ_DEFAULT V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_DEFAULT)
370#define V_MAC_MAX_FRAMESZ_JUMBO V_MAC_MAX_FRAMESZ(K_MAC_MAX_FRAMESZ_JUMBO)
371
372/*
373 * MAC VLAN Tag Registers (Table 9-16)
374 * Register: MAC_VLANTAG_0
375 * Register: MAC_VLANTAG_1
376 * Register: MAC_VLANTAG_2
377 */
378
379#define S_MAC_VLAN_TAG _SB_MAKE64(0)
380#define M_MAC_VLAN_TAG _SB_MAKEMASK(32, S_MAC_VLAN_TAG)
381#define V_MAC_VLAN_TAG(x) _SB_MAKEVALUE(x, S_MAC_VLAN_TAG)
382#define G_MAC_VLAN_TAG(x) _SB_GETVALUE(x, S_MAC_VLAN_TAG, M_MAC_VLAN_TAG)
383
384#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
385#define S_MAC_TX_PKT_OFFSET _SB_MAKE64(32)
386#define M_MAC_TX_PKT_OFFSET _SB_MAKEMASK(8, S_MAC_TX_PKT_OFFSET)
387#define V_MAC_TX_PKT_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_TX_PKT_OFFSET)
388#define G_MAC_TX_PKT_OFFSET(x) _SB_GETVALUE(x, S_MAC_TX_PKT_OFFSET, M_MAC_TX_PKT_OFFSET)
389
390#define S_MAC_TX_CRC_OFFSET _SB_MAKE64(40)
391#define M_MAC_TX_CRC_OFFSET _SB_MAKEMASK(8, S_MAC_TX_CRC_OFFSET)
392#define V_MAC_TX_CRC_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_TX_CRC_OFFSET)
393#define G_MAC_TX_CRC_OFFSET(x) _SB_GETVALUE(x, S_MAC_TX_CRC_OFFSET, M_MAC_TX_CRC_OFFSET)
394
395#define M_MAC_CH_BASE_FC_EN _SB_MAKEMASK1(48)
396#endif /* 1250 PASS3 || 112x PASS1 */
397
398/*
399 * MAC Status Registers (Table 9-17)
400 * Also used for the MAC Interrupt Mask Register (Table 9-18)
401 * Register: MAC_STATUS_0
402 * Register: MAC_STATUS_1
403 * Register: MAC_STATUS_2
404 * Register: MAC_INT_MASK_0
405 * Register: MAC_INT_MASK_1
406 * Register: MAC_INT_MASK_2
407 */
408
409/*
410 * Use these constants to shift the appropriate channel
411 * into the CH0 position so the same tests can be used
412 * on each channel.
413 */
414
415#define S_MAC_RX_CH0 _SB_MAKE64(0)
416#define S_MAC_RX_CH1 _SB_MAKE64(8)
417#define S_MAC_TX_CH0 _SB_MAKE64(16)
418#define S_MAC_TX_CH1 _SB_MAKE64(24)
419
420#define S_MAC_TXCHANNELS _SB_MAKE64(16) /* this is 1st TX chan */
421#define S_MAC_CHANWIDTH _SB_MAKE64(8) /* bits between channels */
422
423/*
424 * These are the same as RX channel 0. The idea here
425 * is that you'll use one of the "S_" things above
426 * and pass just the six bits to a DMA-channel-specific ISR
427 */
428#define M_MAC_INT_CHANNEL _SB_MAKEMASK(8, 0)
429#define M_MAC_INT_EOP_COUNT _SB_MAKEMASK1(0)
430#define M_MAC_INT_EOP_TIMER _SB_MAKEMASK1(1)
431#define M_MAC_INT_EOP_SEEN _SB_MAKEMASK1(2)
432#define M_MAC_INT_HWM _SB_MAKEMASK1(3)
433#define M_MAC_INT_LWM _SB_MAKEMASK1(4)
434#define M_MAC_INT_DSCR _SB_MAKEMASK1(5)
435#define M_MAC_INT_ERR _SB_MAKEMASK1(6)
436#define M_MAC_INT_DZERO _SB_MAKEMASK1(7) /* only for TX channels */
437#define M_MAC_INT_DROP _SB_MAKEMASK1(7) /* only for RX channels */
438
439/*
440 * In the following definitions we use ch (0/1) and txrx (TX=1, RX=0, see
441 * also DMA_TX/DMA_RX in sb_regs.h).
442 */
443#define S_MAC_STATUS_CH_OFFSET(ch, txrx) _SB_MAKE64(((ch) + 2 * (txrx)) * S_MAC_CHANWIDTH)
444
445#define M_MAC_STATUS_CHANNEL(ch, txrx) _SB_MAKEVALUE(_SB_MAKEMASK(8, 0), S_MAC_STATUS_CH_OFFSET(ch, txrx))
446#define M_MAC_STATUS_EOP_COUNT(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_COUNT, S_MAC_STATUS_CH_OFFSET(ch, txrx))
447#define M_MAC_STATUS_EOP_TIMER(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_TIMER, S_MAC_STATUS_CH_OFFSET(ch, txrx))
448#define M_MAC_STATUS_EOP_SEEN(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_EOP_SEEN, S_MAC_STATUS_CH_OFFSET(ch, txrx))
449#define M_MAC_STATUS_HWM(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_HWM, S_MAC_STATUS_CH_OFFSET(ch, txrx))
450#define M_MAC_STATUS_LWM(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_LWM, S_MAC_STATUS_CH_OFFSET(ch, txrx))
451#define M_MAC_STATUS_DSCR(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DSCR, S_MAC_STATUS_CH_OFFSET(ch, txrx))
452#define M_MAC_STATUS_ERR(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_ERR, S_MAC_STATUS_CH_OFFSET(ch, txrx))
453#define M_MAC_STATUS_DZERO(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DZERO, S_MAC_STATUS_CH_OFFSET(ch, txrx))
454#define M_MAC_STATUS_DROP(ch, txrx) _SB_MAKEVALUE(M_MAC_INT_DROP, S_MAC_STATUS_CH_OFFSET(ch, txrx))
455#define M_MAC_STATUS_OTHER_ERR _SB_MAKEVALUE(_SB_MAKEMASK(7, 0), 40)
456
457
458#define M_MAC_RX_UNDRFL _SB_MAKEMASK1(40)
459#define M_MAC_RX_OVRFL _SB_MAKEMASK1(41)
460#define M_MAC_TX_UNDRFL _SB_MAKEMASK1(42)
461#define M_MAC_TX_OVRFL _SB_MAKEMASK1(43)
462#define M_MAC_LTCOL_ERR _SB_MAKEMASK1(44)
463#define M_MAC_EXCOL_ERR _SB_MAKEMASK1(45)
464#define M_MAC_CNTR_OVRFL_ERR _SB_MAKEMASK1(46)
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 */
467#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
468
469#define S_MAC_COUNTER_ADDR _SB_MAKE64(47)
470#define M_MAC_COUNTER_ADDR _SB_MAKEMASK(5, S_MAC_COUNTER_ADDR)
471#define V_MAC_COUNTER_ADDR(x) _SB_MAKEVALUE(x, S_MAC_COUNTER_ADDR)
472#define G_MAC_COUNTER_ADDR(x) _SB_GETVALUE(x, S_MAC_COUNTER_ADDR, M_MAC_COUNTER_ADDR)
473
474#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
475#define M_MAC_TX_PAUSE_ON _SB_MAKEMASK1(52)
476#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
477
478/*
479 * MAC Fifo Pointer Registers (Table 9-19) [Debug register]
480 * Register: MAC_FIFO_PTRS_0
481 * Register: MAC_FIFO_PTRS_1
482 * Register: MAC_FIFO_PTRS_2
483 */
484
485#define S_MAC_TX_WRPTR _SB_MAKE64(0)
486#define M_MAC_TX_WRPTR _SB_MAKEMASK(6, S_MAC_TX_WRPTR)
487#define V_MAC_TX_WRPTR(x) _SB_MAKEVALUE(x, S_MAC_TX_WRPTR)
488#define G_MAC_TX_WRPTR(x) _SB_GETVALUE(x, S_MAC_TX_WRPTR, M_MAC_TX_WRPTR)
489
490#define S_MAC_TX_RDPTR _SB_MAKE64(8)
491#define M_MAC_TX_RDPTR _SB_MAKEMASK(6, S_MAC_TX_RDPTR)
492#define V_MAC_TX_RDPTR(x) _SB_MAKEVALUE(x, S_MAC_TX_RDPTR)
493#define G_MAC_TX_RDPTR(x) _SB_GETVALUE(x, S_MAC_TX_RDPTR, M_MAC_TX_RDPTR)
494
495#define S_MAC_RX_WRPTR _SB_MAKE64(16)
496#define M_MAC_RX_WRPTR _SB_MAKEMASK(6, S_MAC_RX_WRPTR)
497#define V_MAC_RX_WRPTR(x) _SB_MAKEVALUE(x, S_MAC_RX_WRPTR)
498#define G_MAC_RX_WRPTR(x) _SB_GETVALUE(x, S_MAC_RX_WRPTR, M_MAC_TX_WRPTR)
499
500#define S_MAC_RX_RDPTR _SB_MAKE64(24)
501#define M_MAC_RX_RDPTR _SB_MAKEMASK(6, S_MAC_RX_RDPTR)
502#define V_MAC_RX_RDPTR(x) _SB_MAKEVALUE(x, S_MAC_RX_RDPTR)
503#define G_MAC_RX_RDPTR(x) _SB_GETVALUE(x, S_MAC_RX_RDPTR, M_MAC_TX_RDPTR)
504
505/*
506 * MAC Fifo End Of Packet Count Registers (Table 9-20) [Debug register]
507 * Register: MAC_EOPCNT_0
508 * Register: MAC_EOPCNT_1
509 * Register: MAC_EOPCNT_2
510 */
511
512#define S_MAC_TX_EOP_COUNTER _SB_MAKE64(0)
513#define M_MAC_TX_EOP_COUNTER _SB_MAKEMASK(6, S_MAC_TX_EOP_COUNTER)
514#define V_MAC_TX_EOP_COUNTER(x) _SB_MAKEVALUE(x, S_MAC_TX_EOP_COUNTER)
515#define G_MAC_TX_EOP_COUNTER(x) _SB_GETVALUE(x, S_MAC_TX_EOP_COUNTER, M_MAC_TX_EOP_COUNTER)
516
517#define S_MAC_RX_EOP_COUNTER _SB_MAKE64(8)
518#define M_MAC_RX_EOP_COUNTER _SB_MAKEMASK(6, S_MAC_RX_EOP_COUNTER)
519#define V_MAC_RX_EOP_COUNTER(x) _SB_MAKEVALUE(x, S_MAC_RX_EOP_COUNTER)
520#define G_MAC_RX_EOP_COUNTER(x) _SB_GETVALUE(x, S_MAC_RX_EOP_COUNTER, M_MAC_RX_EOP_COUNTER)
521
522/*
523 * MAC Recieve Address Filter Exact Match Registers (Table 9-21)
524 * Registers: MAC_ADDR0_0 through MAC_ADDR7_0
525 * Registers: MAC_ADDR0_1 through MAC_ADDR7_1
526 * Registers: MAC_ADDR0_2 through MAC_ADDR7_2
527 */
528
529/* No bitfields */
530
531/*
532 * MAC Receive Address Filter Mask Registers
533 * Registers: MAC_ADDRMASK0_0 and MAC_ADDRMASK0_1
534 * Registers: MAC_ADDRMASK1_0 and MAC_ADDRMASK1_1
535 * Registers: MAC_ADDRMASK2_0 and MAC_ADDRMASK2_1
536 */
537
538/* No bitfields */
539
540/*
541 * MAC Recieve Address Filter Hash Match Registers (Table 9-22)
542 * Registers: MAC_HASH0_0 through MAC_HASH7_0
543 * Registers: MAC_HASH0_1 through MAC_HASH7_1
544 * Registers: MAC_HASH0_2 through MAC_HASH7_2
545 */
546
547/* No bitfields */
548
549/*
550 * MAC Transmit Source Address Registers (Table 9-23)
551 * Register: MAC_ETHERNET_ADDR_0
552 * Register: MAC_ETHERNET_ADDR_1
553 * Register: MAC_ETHERNET_ADDR_2
554 */
555
556/* No bitfields */
557
558/*
559 * MAC Packet Type Configuration Register
560 * Register: MAC_TYPE_CFG_0
561 * Register: MAC_TYPE_CFG_1
562 * Register: MAC_TYPE_CFG_2
563 */
564
565#define S_TYPECFG_TYPESIZE _SB_MAKE64(16)
566
567#define S_TYPECFG_TYPE0 _SB_MAKE64(0)
568#define M_TYPECFG_TYPE0 _SB_MAKEMASK(16, S_TYPECFG_TYPE0)
569#define V_TYPECFG_TYPE0(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE0)
570#define G_TYPECFG_TYPE0(x) _SB_GETVALUE(x, S_TYPECFG_TYPE0, M_TYPECFG_TYPE0)
571
572#define S_TYPECFG_TYPE1 _SB_MAKE64(0)
573#define M_TYPECFG_TYPE1 _SB_MAKEMASK(16, S_TYPECFG_TYPE1)
574#define V_TYPECFG_TYPE1(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE1)
575#define G_TYPECFG_TYPE1(x) _SB_GETVALUE(x, S_TYPECFG_TYPE1, M_TYPECFG_TYPE1)
576
577#define S_TYPECFG_TYPE2 _SB_MAKE64(0)
578#define M_TYPECFG_TYPE2 _SB_MAKEMASK(16, S_TYPECFG_TYPE2)
579#define V_TYPECFG_TYPE2(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE2)
580#define G_TYPECFG_TYPE2(x) _SB_GETVALUE(x, S_TYPECFG_TYPE2, M_TYPECFG_TYPE2)
581
582#define S_TYPECFG_TYPE3 _SB_MAKE64(0)
583#define M_TYPECFG_TYPE3 _SB_MAKEMASK(16, S_TYPECFG_TYPE3)
584#define V_TYPECFG_TYPE3(x) _SB_MAKEVALUE(x, S_TYPECFG_TYPE3)
585#define G_TYPECFG_TYPE3(x) _SB_GETVALUE(x, S_TYPECFG_TYPE3, M_TYPECFG_TYPE3)
586
587/*
588 * MAC Receive Address Filter Control Registers (Table 9-24)
589 * Register: MAC_ADFILTER_CFG_0
590 * Register: MAC_ADFILTER_CFG_1
591 * Register: MAC_ADFILTER_CFG_2
592 */
593
594#define M_MAC_ALLPKT_EN _SB_MAKEMASK1(0)
595#define M_MAC_UCAST_EN _SB_MAKEMASK1(1)
596#define M_MAC_UCAST_INV _SB_MAKEMASK1(2)
597#define M_MAC_MCAST_EN _SB_MAKEMASK1(3)
598#define M_MAC_MCAST_INV _SB_MAKEMASK1(4)
599#define M_MAC_BCAST_EN _SB_MAKEMASK1(5)
600#define M_MAC_DIRECT_INV _SB_MAKEMASK1(6)
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)
603#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
604
605#define S_MAC_IPHDR_OFFSET _SB_MAKE64(8)
606#define M_MAC_IPHDR_OFFSET _SB_MAKEMASK(8, S_MAC_IPHDR_OFFSET)
607#define V_MAC_IPHDR_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_IPHDR_OFFSET)
608#define G_MAC_IPHDR_OFFSET(x) _SB_GETVALUE(x, S_MAC_IPHDR_OFFSET, M_MAC_IPHDR_OFFSET)
609
610#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
611#define S_MAC_RX_CRC_OFFSET _SB_MAKE64(16)
612#define M_MAC_RX_CRC_OFFSET _SB_MAKEMASK(8, S_MAC_RX_CRC_OFFSET)
613#define V_MAC_RX_CRC_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_RX_CRC_OFFSET)
614#define G_MAC_RX_CRC_OFFSET(x) _SB_GETVALUE(x, S_MAC_RX_CRC_OFFSET, M_MAC_RX_CRC_OFFSET)
615
616#define S_MAC_RX_PKT_OFFSET _SB_MAKE64(24)
617#define M_MAC_RX_PKT_OFFSET _SB_MAKEMASK(8, S_MAC_RX_PKT_OFFSET)
618#define V_MAC_RX_PKT_OFFSET(x) _SB_MAKEVALUE(x, S_MAC_RX_PKT_OFFSET)
619#define G_MAC_RX_PKT_OFFSET(x) _SB_GETVALUE(x, S_MAC_RX_PKT_OFFSET, M_MAC_RX_PKT_OFFSET)
620
621#define M_MAC_FWDPAUSE_EN _SB_MAKEMASK1(32)
622#define M_MAC_VLAN_DET_EN _SB_MAKEMASK1(33)
623
624#define S_MAC_RX_CH_MSN_SEL _SB_MAKE64(34)
625#define M_MAC_RX_CH_MSN_SEL _SB_MAKEMASK(8, S_MAC_RX_CH_MSN_SEL)
626#define V_MAC_RX_CH_MSN_SEL(x) _SB_MAKEVALUE(x, S_MAC_RX_CH_MSN_SEL)
627#define G_MAC_RX_CH_MSN_SEL(x) _SB_GETVALUE(x, S_MAC_RX_CH_MSN_SEL, M_MAC_RX_CH_MSN_SEL)
628#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
629
630/*
631 * MAC Receive Channel Select Registers (Table 9-25)
632 */
633
634/* no bitfields */
635
636/*
637 * MAC MII Management Interface Registers (Table 9-26)
638 * Register: MAC_MDIO_0
639 * Register: MAC_MDIO_1
640 * Register: MAC_MDIO_2
641 */
642
643#define S_MAC_MDC 0
644#define S_MAC_MDIO_DIR 1
645#define S_MAC_MDIO_OUT 2
646#define S_MAC_GENC 3
647#define S_MAC_MDIO_IN 4
648
649#define M_MAC_MDC _SB_MAKEMASK1(S_MAC_MDC)
650#define M_MAC_MDIO_DIR _SB_MAKEMASK1(S_MAC_MDIO_DIR)
651#define M_MAC_MDIO_DIR_INPUT _SB_MAKEMASK1(S_MAC_MDIO_DIR)
652#define M_MAC_MDIO_OUT _SB_MAKEMASK1(S_MAC_MDIO_OUT)
653#define M_MAC_GENC _SB_MAKEMASK1(S_MAC_GENC)
654#define M_MAC_MDIO_IN _SB_MAKEMASK1(S_MAC_MDIO_IN)
655
656#endif
diff --git a/include/asm-mips/sibyte/sb1250_mc.h b/include/asm-mips/sibyte/sb1250_mc.h
deleted file mode 100644
index 1eb1b5a88736..000000000000
--- a/include/asm-mips/sibyte/sb1250_mc.h
+++ /dev/null
@@ -1,550 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Memory Controller constants File: sb1250_mc.h
5 *
6 * This module contains constants and macros useful for
7 * programming the memory controller.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000, 2001, 2002, 2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_MC_H
34#define _SB1250_MC_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Memory Channel Config Register (table 6-14)
40 */
41
42#define S_MC_RESERVED0 0
43#define M_MC_RESERVED0 _SB_MAKEMASK(8, S_MC_RESERVED0)
44
45#define S_MC_CHANNEL_SEL 8
46#define M_MC_CHANNEL_SEL _SB_MAKEMASK(8, S_MC_CHANNEL_SEL)
47#define V_MC_CHANNEL_SEL(x) _SB_MAKEVALUE(x, S_MC_CHANNEL_SEL)
48#define G_MC_CHANNEL_SEL(x) _SB_GETVALUE(x, S_MC_CHANNEL_SEL, M_MC_CHANNEL_SEL)
49
50#define S_MC_BANK0_MAP 16
51#define M_MC_BANK0_MAP _SB_MAKEMASK(4, S_MC_BANK0_MAP)
52#define V_MC_BANK0_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK0_MAP)
53#define G_MC_BANK0_MAP(x) _SB_GETVALUE(x, S_MC_BANK0_MAP, M_MC_BANK0_MAP)
54
55#define K_MC_BANK0_MAP_DEFAULT 0x00
56#define V_MC_BANK0_MAP_DEFAULT V_MC_BANK0_MAP(K_MC_BANK0_MAP_DEFAULT)
57
58#define S_MC_BANK1_MAP 20
59#define M_MC_BANK1_MAP _SB_MAKEMASK(4, S_MC_BANK1_MAP)
60#define V_MC_BANK1_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK1_MAP)
61#define G_MC_BANK1_MAP(x) _SB_GETVALUE(x, S_MC_BANK1_MAP, M_MC_BANK1_MAP)
62
63#define K_MC_BANK1_MAP_DEFAULT 0x08
64#define V_MC_BANK1_MAP_DEFAULT V_MC_BANK1_MAP(K_MC_BANK1_MAP_DEFAULT)
65
66#define S_MC_BANK2_MAP 24
67#define M_MC_BANK2_MAP _SB_MAKEMASK(4, S_MC_BANK2_MAP)
68#define V_MC_BANK2_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK2_MAP)
69#define G_MC_BANK2_MAP(x) _SB_GETVALUE(x, S_MC_BANK2_MAP, M_MC_BANK2_MAP)
70
71#define K_MC_BANK2_MAP_DEFAULT 0x09
72#define V_MC_BANK2_MAP_DEFAULT V_MC_BANK2_MAP(K_MC_BANK2_MAP_DEFAULT)
73
74#define S_MC_BANK3_MAP 28
75#define M_MC_BANK3_MAP _SB_MAKEMASK(4, S_MC_BANK3_MAP)
76#define V_MC_BANK3_MAP(x) _SB_MAKEVALUE(x, S_MC_BANK3_MAP)
77#define G_MC_BANK3_MAP(x) _SB_GETVALUE(x, S_MC_BANK3_MAP, M_MC_BANK3_MAP)
78
79#define K_MC_BANK3_MAP_DEFAULT 0x0C
80#define V_MC_BANK3_MAP_DEFAULT V_MC_BANK3_MAP(K_MC_BANK3_MAP_DEFAULT)
81
82#define M_MC_RESERVED1 _SB_MAKEMASK(8, 32)
83
84#define S_MC_QUEUE_SIZE 40
85#define M_MC_QUEUE_SIZE _SB_MAKEMASK(4, S_MC_QUEUE_SIZE)
86#define V_MC_QUEUE_SIZE(x) _SB_MAKEVALUE(x, S_MC_QUEUE_SIZE)
87#define G_MC_QUEUE_SIZE(x) _SB_GETVALUE(x, S_MC_QUEUE_SIZE, M_MC_QUEUE_SIZE)
88#define V_MC_QUEUE_SIZE_DEFAULT V_MC_QUEUE_SIZE(0x0A)
89
90#define S_MC_AGE_LIMIT 44
91#define M_MC_AGE_LIMIT _SB_MAKEMASK(4, S_MC_AGE_LIMIT)
92#define V_MC_AGE_LIMIT(x) _SB_MAKEVALUE(x, S_MC_AGE_LIMIT)
93#define G_MC_AGE_LIMIT(x) _SB_GETVALUE(x, S_MC_AGE_LIMIT, M_MC_AGE_LIMIT)
94#define V_MC_AGE_LIMIT_DEFAULT V_MC_AGE_LIMIT(8)
95
96#define S_MC_WR_LIMIT 48
97#define M_MC_WR_LIMIT _SB_MAKEMASK(4, S_MC_WR_LIMIT)
98#define V_MC_WR_LIMIT(x) _SB_MAKEVALUE(x, S_MC_WR_LIMIT)
99#define G_MC_WR_LIMIT(x) _SB_GETVALUE(x, S_MC_WR_LIMIT, M_MC_WR_LIMIT)
100#define V_MC_WR_LIMIT_DEFAULT V_MC_WR_LIMIT(5)
101
102#define M_MC_IOB1HIGHPRIORITY _SB_MAKEMASK1(52)
103
104#define M_MC_RESERVED2 _SB_MAKEMASK(3, 53)
105
106#define S_MC_CS_MODE 56
107#define M_MC_CS_MODE _SB_MAKEMASK(4, S_MC_CS_MODE)
108#define V_MC_CS_MODE(x) _SB_MAKEVALUE(x, S_MC_CS_MODE)
109#define G_MC_CS_MODE(x) _SB_GETVALUE(x, S_MC_CS_MODE, M_MC_CS_MODE)
110
111#define K_MC_CS_MODE_MSB_CS 0
112#define K_MC_CS_MODE_INTLV_CS 15
113#define K_MC_CS_MODE_MIXED_CS_10 12
114#define K_MC_CS_MODE_MIXED_CS_30 6
115#define K_MC_CS_MODE_MIXED_CS_32 3
116
117#define V_MC_CS_MODE_MSB_CS V_MC_CS_MODE(K_MC_CS_MODE_MSB_CS)
118#define V_MC_CS_MODE_INTLV_CS V_MC_CS_MODE(K_MC_CS_MODE_INTLV_CS)
119#define V_MC_CS_MODE_MIXED_CS_10 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_10)
120#define V_MC_CS_MODE_MIXED_CS_30 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_30)
121#define V_MC_CS_MODE_MIXED_CS_32 V_MC_CS_MODE(K_MC_CS_MODE_MIXED_CS_32)
122
123#define M_MC_ECC_DISABLE _SB_MAKEMASK1(60)
124#define M_MC_BERR_DISABLE _SB_MAKEMASK1(61)
125#define M_MC_FORCE_SEQ _SB_MAKEMASK1(62)
126#define M_MC_DEBUG _SB_MAKEMASK1(63)
127
128#define V_MC_CONFIG_DEFAULT V_MC_WR_LIMIT_DEFAULT | V_MC_AGE_LIMIT_DEFAULT | \
129 V_MC_BANK0_MAP_DEFAULT | V_MC_BANK1_MAP_DEFAULT | \
130 V_MC_BANK2_MAP_DEFAULT | V_MC_BANK3_MAP_DEFAULT | V_MC_CHANNEL_SEL(0) | \
131 M_MC_IOB1HIGHPRIORITY | V_MC_QUEUE_SIZE_DEFAULT
132
133
134/*
135 * Memory clock config register (Table 6-15)
136 *
137 * Note: this field has been updated to be consistent with the errata to 0.2
138 */
139
140#define S_MC_CLK_RATIO 0
141#define M_MC_CLK_RATIO _SB_MAKEMASK(4, S_MC_CLK_RATIO)
142#define V_MC_CLK_RATIO(x) _SB_MAKEVALUE(x, S_MC_CLK_RATIO)
143#define G_MC_CLK_RATIO(x) _SB_GETVALUE(x, S_MC_CLK_RATIO, M_MC_CLK_RATIO)
144
145#define K_MC_CLK_RATIO_2X 4
146#define K_MC_CLK_RATIO_25X 5
147#define K_MC_CLK_RATIO_3X 6
148#define K_MC_CLK_RATIO_35X 7
149#define K_MC_CLK_RATIO_4X 8
150#define K_MC_CLK_RATIO_45X 9
151
152#define V_MC_CLK_RATIO_2X V_MC_CLK_RATIO(K_MC_CLK_RATIO_2X)
153#define V_MC_CLK_RATIO_25X V_MC_CLK_RATIO(K_MC_CLK_RATIO_25X)
154#define V_MC_CLK_RATIO_3X V_MC_CLK_RATIO(K_MC_CLK_RATIO_3X)
155#define V_MC_CLK_RATIO_35X V_MC_CLK_RATIO(K_MC_CLK_RATIO_35X)
156#define V_MC_CLK_RATIO_4X V_MC_CLK_RATIO(K_MC_CLK_RATIO_4X)
157#define V_MC_CLK_RATIO_45X V_MC_CLK_RATIO(K_MC_CLK_RATIO_45X)
158#define V_MC_CLK_RATIO_DEFAULT V_MC_CLK_RATIO_25X
159
160#define S_MC_REF_RATE 8
161#define M_MC_REF_RATE _SB_MAKEMASK(8, S_MC_REF_RATE)
162#define V_MC_REF_RATE(x) _SB_MAKEVALUE(x, S_MC_REF_RATE)
163#define G_MC_REF_RATE(x) _SB_GETVALUE(x, S_MC_REF_RATE, M_MC_REF_RATE)
164
165#define K_MC_REF_RATE_100MHz 0x62
166#define K_MC_REF_RATE_133MHz 0x81
167#define K_MC_REF_RATE_200MHz 0xC4
168
169#define V_MC_REF_RATE_100MHz V_MC_REF_RATE(K_MC_REF_RATE_100MHz)
170#define V_MC_REF_RATE_133MHz V_MC_REF_RATE(K_MC_REF_RATE_133MHz)
171#define V_MC_REF_RATE_200MHz V_MC_REF_RATE(K_MC_REF_RATE_200MHz)
172#define V_MC_REF_RATE_DEFAULT V_MC_REF_RATE_100MHz
173
174#define S_MC_CLOCK_DRIVE 16
175#define M_MC_CLOCK_DRIVE _SB_MAKEMASK(4, S_MC_CLOCK_DRIVE)
176#define V_MC_CLOCK_DRIVE(x) _SB_MAKEVALUE(x, S_MC_CLOCK_DRIVE)
177#define G_MC_CLOCK_DRIVE(x) _SB_GETVALUE(x, S_MC_CLOCK_DRIVE, M_MC_CLOCK_DRIVE)
178#define V_MC_CLOCK_DRIVE_DEFAULT V_MC_CLOCK_DRIVE(0xF)
179
180#define S_MC_DATA_DRIVE 20
181#define M_MC_DATA_DRIVE _SB_MAKEMASK(4, S_MC_DATA_DRIVE)
182#define V_MC_DATA_DRIVE(x) _SB_MAKEVALUE(x, S_MC_DATA_DRIVE)
183#define G_MC_DATA_DRIVE(x) _SB_GETVALUE(x, S_MC_DATA_DRIVE, M_MC_DATA_DRIVE)
184#define V_MC_DATA_DRIVE_DEFAULT V_MC_DATA_DRIVE(0x0)
185
186#define S_MC_ADDR_DRIVE 24
187#define M_MC_ADDR_DRIVE _SB_MAKEMASK(4, S_MC_ADDR_DRIVE)
188#define V_MC_ADDR_DRIVE(x) _SB_MAKEVALUE(x, S_MC_ADDR_DRIVE)
189#define G_MC_ADDR_DRIVE(x) _SB_GETVALUE(x, S_MC_ADDR_DRIVE, M_MC_ADDR_DRIVE)
190#define V_MC_ADDR_DRIVE_DEFAULT V_MC_ADDR_DRIVE(0x0)
191
192#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
193#define M_MC_REF_DISABLE _SB_MAKEMASK1(30)
194#endif /* 1250 PASS3 || 112x PASS1 */
195
196#define M_MC_DLL_BYPASS _SB_MAKEMASK1(31)
197
198#define S_MC_DQI_SKEW 32
199#define M_MC_DQI_SKEW _SB_MAKEMASK(8, S_MC_DQI_SKEW)
200#define V_MC_DQI_SKEW(x) _SB_MAKEVALUE(x, S_MC_DQI_SKEW)
201#define G_MC_DQI_SKEW(x) _SB_GETVALUE(x, S_MC_DQI_SKEW, M_MC_DQI_SKEW)
202#define V_MC_DQI_SKEW_DEFAULT V_MC_DQI_SKEW(0)
203
204#define S_MC_DQO_SKEW 40
205#define M_MC_DQO_SKEW _SB_MAKEMASK(8, S_MC_DQO_SKEW)
206#define V_MC_DQO_SKEW(x) _SB_MAKEVALUE(x, S_MC_DQO_SKEW)
207#define G_MC_DQO_SKEW(x) _SB_GETVALUE(x, S_MC_DQO_SKEW, M_MC_DQO_SKEW)
208#define V_MC_DQO_SKEW_DEFAULT V_MC_DQO_SKEW(0)
209
210#define S_MC_ADDR_SKEW 48
211#define M_MC_ADDR_SKEW _SB_MAKEMASK(8, S_MC_ADDR_SKEW)
212#define V_MC_ADDR_SKEW(x) _SB_MAKEVALUE(x, S_MC_ADDR_SKEW)
213#define G_MC_ADDR_SKEW(x) _SB_GETVALUE(x, S_MC_ADDR_SKEW, M_MC_ADDR_SKEW)
214#define V_MC_ADDR_SKEW_DEFAULT V_MC_ADDR_SKEW(0x0F)
215
216#define S_MC_DLL_DEFAULT 56
217#define M_MC_DLL_DEFAULT _SB_MAKEMASK(8, S_MC_DLL_DEFAULT)
218#define V_MC_DLL_DEFAULT(x) _SB_MAKEVALUE(x, S_MC_DLL_DEFAULT)
219#define G_MC_DLL_DEFAULT(x) _SB_GETVALUE(x, S_MC_DLL_DEFAULT, M_MC_DLL_DEFAULT)
220#define V_MC_DLL_DEFAULT_DEFAULT V_MC_DLL_DEFAULT(0x10)
221
222#define V_MC_CLKCONFIG_DEFAULT V_MC_DLL_DEFAULT_DEFAULT | \
223 V_MC_ADDR_SKEW_DEFAULT | \
224 V_MC_DQO_SKEW_DEFAULT | \
225 V_MC_DQI_SKEW_DEFAULT | \
226 V_MC_ADDR_DRIVE_DEFAULT | \
227 V_MC_DATA_DRIVE_DEFAULT | \
228 V_MC_CLOCK_DRIVE_DEFAULT | \
229 V_MC_REF_RATE_DEFAULT
230
231
232
233/*
234 * DRAM Command Register (Table 6-13)
235 */
236
237#define S_MC_COMMAND 0
238#define M_MC_COMMAND _SB_MAKEMASK(4, S_MC_COMMAND)
239#define V_MC_COMMAND(x) _SB_MAKEVALUE(x, S_MC_COMMAND)
240#define G_MC_COMMAND(x) _SB_GETVALUE(x, S_MC_COMMAND, M_MC_COMMAND)
241
242#define K_MC_COMMAND_EMRS 0
243#define K_MC_COMMAND_MRS 1
244#define K_MC_COMMAND_PRE 2
245#define K_MC_COMMAND_AR 3
246#define K_MC_COMMAND_SETRFSH 4
247#define K_MC_COMMAND_CLRRFSH 5
248#define K_MC_COMMAND_SETPWRDN 6
249#define K_MC_COMMAND_CLRPWRDN 7
250
251#define V_MC_COMMAND_EMRS V_MC_COMMAND(K_MC_COMMAND_EMRS)
252#define V_MC_COMMAND_MRS V_MC_COMMAND(K_MC_COMMAND_MRS)
253#define V_MC_COMMAND_PRE V_MC_COMMAND(K_MC_COMMAND_PRE)
254#define V_MC_COMMAND_AR V_MC_COMMAND(K_MC_COMMAND_AR)
255#define V_MC_COMMAND_SETRFSH V_MC_COMMAND(K_MC_COMMAND_SETRFSH)
256#define V_MC_COMMAND_CLRRFSH V_MC_COMMAND(K_MC_COMMAND_CLRRFSH)
257#define V_MC_COMMAND_SETPWRDN V_MC_COMMAND(K_MC_COMMAND_SETPWRDN)
258#define V_MC_COMMAND_CLRPWRDN V_MC_COMMAND(K_MC_COMMAND_CLRPWRDN)
259
260#define M_MC_CS0 _SB_MAKEMASK1(4)
261#define M_MC_CS1 _SB_MAKEMASK1(5)
262#define M_MC_CS2 _SB_MAKEMASK1(6)
263#define M_MC_CS3 _SB_MAKEMASK1(7)
264
265/*
266 * DRAM Mode Register (Table 6-14)
267 */
268
269#define S_MC_EMODE 0
270#define M_MC_EMODE _SB_MAKEMASK(15, S_MC_EMODE)
271#define V_MC_EMODE(x) _SB_MAKEVALUE(x, S_MC_EMODE)
272#define G_MC_EMODE(x) _SB_GETVALUE(x, S_MC_EMODE, M_MC_EMODE)
273#define V_MC_EMODE_DEFAULT V_MC_EMODE(0)
274
275#define S_MC_MODE 16
276#define M_MC_MODE _SB_MAKEMASK(15, S_MC_MODE)
277#define V_MC_MODE(x) _SB_MAKEVALUE(x, S_MC_MODE)
278#define G_MC_MODE(x) _SB_GETVALUE(x, S_MC_MODE, M_MC_MODE)
279#define V_MC_MODE_DEFAULT V_MC_MODE(0x22)
280
281#define S_MC_DRAM_TYPE 32
282#define M_MC_DRAM_TYPE _SB_MAKEMASK(3, S_MC_DRAM_TYPE)
283#define V_MC_DRAM_TYPE(x) _SB_MAKEVALUE(x, S_MC_DRAM_TYPE)
284#define G_MC_DRAM_TYPE(x) _SB_GETVALUE(x, S_MC_DRAM_TYPE, M_MC_DRAM_TYPE)
285
286#define K_MC_DRAM_TYPE_JEDEC 0
287#define K_MC_DRAM_TYPE_FCRAM 1
288#define K_MC_DRAM_TYPE_SGRAM 2
289
290#define V_MC_DRAM_TYPE_JEDEC V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_JEDEC)
291#define V_MC_DRAM_TYPE_FCRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_FCRAM)
292#define V_MC_DRAM_TYPE_SGRAM V_MC_DRAM_TYPE(K_MC_DRAM_TYPE_SGRAM)
293
294#define M_MC_EXTERNALDECODE _SB_MAKEMASK1(35)
295
296#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
297#define M_MC_PRE_ON_A8 _SB_MAKEMASK1(36)
298#define M_MC_RAM_WITH_A13 _SB_MAKEMASK1(37)
299#endif /* 1250 PASS3 || 112x PASS1 */
300
301
302
303/*
304 * SDRAM Timing Register (Table 6-15)
305 */
306
307#define M_MC_w2rIDLE_TWOCYCLES _SB_MAKEMASK1(60)
308#define M_MC_r2wIDLE_TWOCYCLES _SB_MAKEMASK1(61)
309#define M_MC_r2rIDLE_TWOCYCLES _SB_MAKEMASK1(62)
310
311#define S_MC_tFIFO 56
312#define M_MC_tFIFO _SB_MAKEMASK(4, S_MC_tFIFO)
313#define V_MC_tFIFO(x) _SB_MAKEVALUE(x, S_MC_tFIFO)
314#define G_MC_tFIFO(x) _SB_GETVALUE(x, S_MC_tFIFO, M_MC_tFIFO)
315#define K_MC_tFIFO_DEFAULT 1
316#define V_MC_tFIFO_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT)
317
318#define S_MC_tRFC 52
319#define M_MC_tRFC _SB_MAKEMASK(4, S_MC_tRFC)
320#define V_MC_tRFC(x) _SB_MAKEVALUE(x, S_MC_tRFC)
321#define G_MC_tRFC(x) _SB_GETVALUE(x, S_MC_tRFC, M_MC_tRFC)
322#define K_MC_tRFC_DEFAULT 12
323#define V_MC_tRFC_DEFAULT V_MC_tRFC(K_MC_tRFC_DEFAULT)
324
325#if SIBYTE_HDR_FEATURE(1250, PASS3)
326#define M_MC_tRFC_PLUS16 _SB_MAKEMASK1(51) /* 1250C3 and later. */
327#endif
328
329#define S_MC_tCwCr 40
330#define M_MC_tCwCr _SB_MAKEMASK(4, S_MC_tCwCr)
331#define V_MC_tCwCr(x) _SB_MAKEVALUE(x, S_MC_tCwCr)
332#define G_MC_tCwCr(x) _SB_GETVALUE(x, S_MC_tCwCr, M_MC_tCwCr)
333#define K_MC_tCwCr_DEFAULT 4
334#define V_MC_tCwCr_DEFAULT V_MC_tCwCr(K_MC_tCwCr_DEFAULT)
335
336#define S_MC_tRCr 28
337#define M_MC_tRCr _SB_MAKEMASK(4, S_MC_tRCr)
338#define V_MC_tRCr(x) _SB_MAKEVALUE(x, S_MC_tRCr)
339#define G_MC_tRCr(x) _SB_GETVALUE(x, S_MC_tRCr, M_MC_tRCr)
340#define K_MC_tRCr_DEFAULT 9
341#define V_MC_tRCr_DEFAULT V_MC_tRCr(K_MC_tRCr_DEFAULT)
342
343#define S_MC_tRCw 24
344#define M_MC_tRCw _SB_MAKEMASK(4, S_MC_tRCw)
345#define V_MC_tRCw(x) _SB_MAKEVALUE(x, S_MC_tRCw)
346#define G_MC_tRCw(x) _SB_GETVALUE(x, S_MC_tRCw, M_MC_tRCw)
347#define K_MC_tRCw_DEFAULT 10
348#define V_MC_tRCw_DEFAULT V_MC_tRCw(K_MC_tRCw_DEFAULT)
349
350#define S_MC_tRRD 20
351#define M_MC_tRRD _SB_MAKEMASK(4, S_MC_tRRD)
352#define V_MC_tRRD(x) _SB_MAKEVALUE(x, S_MC_tRRD)
353#define G_MC_tRRD(x) _SB_GETVALUE(x, S_MC_tRRD, M_MC_tRRD)
354#define K_MC_tRRD_DEFAULT 2
355#define V_MC_tRRD_DEFAULT V_MC_tRRD(K_MC_tRRD_DEFAULT)
356
357#define S_MC_tRP 16
358#define M_MC_tRP _SB_MAKEMASK(4, S_MC_tRP)
359#define V_MC_tRP(x) _SB_MAKEVALUE(x, S_MC_tRP)
360#define G_MC_tRP(x) _SB_GETVALUE(x, S_MC_tRP, M_MC_tRP)
361#define K_MC_tRP_DEFAULT 4
362#define V_MC_tRP_DEFAULT V_MC_tRP(K_MC_tRP_DEFAULT)
363
364#define S_MC_tCwD 8
365#define M_MC_tCwD _SB_MAKEMASK(4, S_MC_tCwD)
366#define V_MC_tCwD(x) _SB_MAKEVALUE(x, S_MC_tCwD)
367#define G_MC_tCwD(x) _SB_GETVALUE(x, S_MC_tCwD, M_MC_tCwD)
368#define K_MC_tCwD_DEFAULT 1
369#define V_MC_tCwD_DEFAULT V_MC_tCwD(K_MC_tCwD_DEFAULT)
370
371#define M_tCrDh _SB_MAKEMASK1(7)
372#define M_MC_tCrDh M_tCrDh
373
374#define S_MC_tCrD 4
375#define M_MC_tCrD _SB_MAKEMASK(3, S_MC_tCrD)
376#define V_MC_tCrD(x) _SB_MAKEVALUE(x, S_MC_tCrD)
377#define G_MC_tCrD(x) _SB_GETVALUE(x, S_MC_tCrD, M_MC_tCrD)
378#define K_MC_tCrD_DEFAULT 2
379#define V_MC_tCrD_DEFAULT V_MC_tCrD(K_MC_tCrD_DEFAULT)
380
381#define S_MC_tRCD 0
382#define M_MC_tRCD _SB_MAKEMASK(4, S_MC_tRCD)
383#define V_MC_tRCD(x) _SB_MAKEVALUE(x, S_MC_tRCD)
384#define G_MC_tRCD(x) _SB_GETVALUE(x, S_MC_tRCD, M_MC_tRCD)
385#define K_MC_tRCD_DEFAULT 3
386#define V_MC_tRCD_DEFAULT V_MC_tRCD(K_MC_tRCD_DEFAULT)
387
388#define V_MC_TIMING_DEFAULT V_MC_tFIFO(K_MC_tFIFO_DEFAULT) | \
389 V_MC_tRFC(K_MC_tRFC_DEFAULT) | \
390 V_MC_tCwCr(K_MC_tCwCr_DEFAULT) | \
391 V_MC_tRCr(K_MC_tRCr_DEFAULT) | \
392 V_MC_tRCw(K_MC_tRCw_DEFAULT) | \
393 V_MC_tRRD(K_MC_tRRD_DEFAULT) | \
394 V_MC_tRP(K_MC_tRP_DEFAULT) | \
395 V_MC_tCwD(K_MC_tCwD_DEFAULT) | \
396 V_MC_tCrD(K_MC_tCrD_DEFAULT) | \
397 V_MC_tRCD(K_MC_tRCD_DEFAULT) | \
398 M_MC_r2rIDLE_TWOCYCLES
399
400/*
401 * Errata says these are not the default
402 * M_MC_w2rIDLE_TWOCYCLES | \
403 * M_MC_r2wIDLE_TWOCYCLES | \
404 */
405
406
407/*
408 * Chip Select Start Address Register (Table 6-17)
409 */
410
411#define S_MC_CS0_START 0
412#define M_MC_CS0_START _SB_MAKEMASK(16, S_MC_CS0_START)
413#define V_MC_CS0_START(x) _SB_MAKEVALUE(x, S_MC_CS0_START)
414#define G_MC_CS0_START(x) _SB_GETVALUE(x, S_MC_CS0_START, M_MC_CS0_START)
415
416#define S_MC_CS1_START 16
417#define M_MC_CS1_START _SB_MAKEMASK(16, S_MC_CS1_START)
418#define V_MC_CS1_START(x) _SB_MAKEVALUE(x, S_MC_CS1_START)
419#define G_MC_CS1_START(x) _SB_GETVALUE(x, S_MC_CS1_START, M_MC_CS1_START)
420
421#define S_MC_CS2_START 32
422#define M_MC_CS2_START _SB_MAKEMASK(16, S_MC_CS2_START)
423#define V_MC_CS2_START(x) _SB_MAKEVALUE(x, S_MC_CS2_START)
424#define G_MC_CS2_START(x) _SB_GETVALUE(x, S_MC_CS2_START, M_MC_CS2_START)
425
426#define S_MC_CS3_START 48
427#define M_MC_CS3_START _SB_MAKEMASK(16, S_MC_CS3_START)
428#define V_MC_CS3_START(x) _SB_MAKEVALUE(x, S_MC_CS3_START)
429#define G_MC_CS3_START(x) _SB_GETVALUE(x, S_MC_CS3_START, M_MC_CS3_START)
430
431/*
432 * Chip Select End Address Register (Table 6-18)
433 */
434
435#define S_MC_CS0_END 0
436#define M_MC_CS0_END _SB_MAKEMASK(16, S_MC_CS0_END)
437#define V_MC_CS0_END(x) _SB_MAKEVALUE(x, S_MC_CS0_END)
438#define G_MC_CS0_END(x) _SB_GETVALUE(x, S_MC_CS0_END, M_MC_CS0_END)
439
440#define S_MC_CS1_END 16
441#define M_MC_CS1_END _SB_MAKEMASK(16, S_MC_CS1_END)
442#define V_MC_CS1_END(x) _SB_MAKEVALUE(x, S_MC_CS1_END)
443#define G_MC_CS1_END(x) _SB_GETVALUE(x, S_MC_CS1_END, M_MC_CS1_END)
444
445#define S_MC_CS2_END 32
446#define M_MC_CS2_END _SB_MAKEMASK(16, S_MC_CS2_END)
447#define V_MC_CS2_END(x) _SB_MAKEVALUE(x, S_MC_CS2_END)
448#define G_MC_CS2_END(x) _SB_GETVALUE(x, S_MC_CS2_END, M_MC_CS2_END)
449
450#define S_MC_CS3_END 48
451#define M_MC_CS3_END _SB_MAKEMASK(16, S_MC_CS3_END)
452#define V_MC_CS3_END(x) _SB_MAKEVALUE(x, S_MC_CS3_END)
453#define G_MC_CS3_END(x) _SB_GETVALUE(x, S_MC_CS3_END, M_MC_CS3_END)
454
455/*
456 * Chip Select Interleave Register (Table 6-19)
457 */
458
459#define S_MC_INTLV_RESERVED 0
460#define M_MC_INTLV_RESERVED _SB_MAKEMASK(5, S_MC_INTLV_RESERVED)
461
462#define S_MC_INTERLEAVE 7
463#define M_MC_INTERLEAVE _SB_MAKEMASK(18, S_MC_INTERLEAVE)
464#define V_MC_INTERLEAVE(x) _SB_MAKEVALUE(x, S_MC_INTERLEAVE)
465
466#define S_MC_INTLV_MBZ 25
467#define M_MC_INTLV_MBZ _SB_MAKEMASK(39, S_MC_INTLV_MBZ)
468
469/*
470 * Row Address Bits Register (Table 6-20)
471 */
472
473#define S_MC_RAS_RESERVED 0
474#define M_MC_RAS_RESERVED _SB_MAKEMASK(5, S_MC_RAS_RESERVED)
475
476#define S_MC_RAS_SELECT 12
477#define M_MC_RAS_SELECT _SB_MAKEMASK(25, S_MC_RAS_SELECT)
478#define V_MC_RAS_SELECT(x) _SB_MAKEVALUE(x, S_MC_RAS_SELECT)
479
480#define S_MC_RAS_MBZ 37
481#define M_MC_RAS_MBZ _SB_MAKEMASK(27, S_MC_RAS_MBZ)
482
483
484/*
485 * Column Address Bits Register (Table 6-21)
486 */
487
488#define S_MC_CAS_RESERVED 0
489#define M_MC_CAS_RESERVED _SB_MAKEMASK(5, S_MC_CAS_RESERVED)
490
491#define S_MC_CAS_SELECT 5
492#define M_MC_CAS_SELECT _SB_MAKEMASK(18, S_MC_CAS_SELECT)
493#define V_MC_CAS_SELECT(x) _SB_MAKEVALUE(x, S_MC_CAS_SELECT)
494
495#define S_MC_CAS_MBZ 23
496#define M_MC_CAS_MBZ _SB_MAKEMASK(41, S_MC_CAS_MBZ)
497
498
499/*
500 * Bank Address Address Bits Register (Table 6-22)
501 */
502
503#define S_MC_BA_RESERVED 0
504#define M_MC_BA_RESERVED _SB_MAKEMASK(5, S_MC_BA_RESERVED)
505
506#define S_MC_BA_SELECT 5
507#define M_MC_BA_SELECT _SB_MAKEMASK(20, S_MC_BA_SELECT)
508#define V_MC_BA_SELECT(x) _SB_MAKEVALUE(x, S_MC_BA_SELECT)
509
510#define S_MC_BA_MBZ 25
511#define M_MC_BA_MBZ _SB_MAKEMASK(39, S_MC_BA_MBZ)
512
513/*
514 * Chip Select Attribute Register (Table 6-23)
515 */
516
517#define K_MC_CS_ATTR_CLOSED 0
518#define K_MC_CS_ATTR_CASCHECK 1
519#define K_MC_CS_ATTR_HINT 2
520#define K_MC_CS_ATTR_OPEN 3
521
522#define S_MC_CS0_PAGE 0
523#define M_MC_CS0_PAGE _SB_MAKEMASK(2, S_MC_CS0_PAGE)
524#define V_MC_CS0_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS0_PAGE)
525#define G_MC_CS0_PAGE(x) _SB_GETVALUE(x, S_MC_CS0_PAGE, M_MC_CS0_PAGE)
526
527#define S_MC_CS1_PAGE 16
528#define M_MC_CS1_PAGE _SB_MAKEMASK(2, S_MC_CS1_PAGE)
529#define V_MC_CS1_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS1_PAGE)
530#define G_MC_CS1_PAGE(x) _SB_GETVALUE(x, S_MC_CS1_PAGE, M_MC_CS1_PAGE)
531
532#define S_MC_CS2_PAGE 32
533#define M_MC_CS2_PAGE _SB_MAKEMASK(2, S_MC_CS2_PAGE)
534#define V_MC_CS2_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS2_PAGE)
535#define G_MC_CS2_PAGE(x) _SB_GETVALUE(x, S_MC_CS2_PAGE, M_MC_CS2_PAGE)
536
537#define S_MC_CS3_PAGE 48
538#define M_MC_CS3_PAGE _SB_MAKEMASK(2, S_MC_CS3_PAGE)
539#define V_MC_CS3_PAGE(x) _SB_MAKEVALUE(x, S_MC_CS3_PAGE)
540#define G_MC_CS3_PAGE(x) _SB_GETVALUE(x, S_MC_CS3_PAGE, M_MC_CS3_PAGE)
541
542/*
543 * ECC Test ECC Register (Table 6-25)
544 */
545
546#define S_MC_ECC_INVERT 0
547#define M_MC_ECC_INVERT _SB_MAKEMASK(8, S_MC_ECC_INVERT)
548
549
550#endif
diff --git a/include/asm-mips/sibyte/sb1250_regs.h b/include/asm-mips/sibyte/sb1250_regs.h
deleted file mode 100644
index 8f53ec817a5e..000000000000
--- a/include/asm-mips/sibyte/sb1250_regs.h
+++ /dev/null
@@ -1,893 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Register Definitions File: sb1250_regs.h
5 *
6 * This module contains the addresses of the on-chip peripherals
7 * on the SB1250.
8 *
9 * SB1250 specification level: 01/02/2002
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_REGS_H
34#define _SB1250_REGS_H
35
36#include "sb1250_defs.h"
37
38
39/* *********************************************************************
40 * Some general notes:
41 *
42 * For the most part, when there is more than one peripheral
43 * of the same type on the SOC, the constants below will be
44 * offsets from the base of each peripheral. For example,
45 * the MAC registers are described as offsets from the first
46 * MAC register, and there will be a MAC_REGISTER() macro
47 * to calculate the base address of a given MAC.
48 *
49 * The information in this file is based on the SB1250 SOC
50 * manual version 0.2, July 2000.
51 ********************************************************************* */
52
53
54/* *********************************************************************
55 * Memory Controller Registers
56 ********************************************************************* */
57
58/*
59 * XXX: can't remove MC base 0 if 112x, since it's used by other macros,
60 * since there is one reg there (but it could get its addr/offset constant).
61 */
62
63#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
64#define A_MC_BASE_0 0x0010051000
65#define A_MC_BASE_1 0x0010052000
66#define MC_REGISTER_SPACING 0x1000
67
68#define A_MC_BASE(ctlid) ((ctlid)*MC_REGISTER_SPACING+A_MC_BASE_0)
69#define A_MC_REGISTER(ctlid, reg) (A_MC_BASE(ctlid)+(reg))
70
71#define R_MC_CONFIG 0x0000000100
72#define R_MC_DRAMCMD 0x0000000120
73#define R_MC_DRAMMODE 0x0000000140
74#define R_MC_TIMING1 0x0000000160
75#define R_MC_TIMING2 0x0000000180
76#define R_MC_CS_START 0x00000001A0
77#define R_MC_CS_END 0x00000001C0
78#define R_MC_CS_INTERLEAVE 0x00000001E0
79#define S_MC_CS_STARTEND 16
80
81#define R_MC_CSX_BASE 0x0000000200
82#define R_MC_CSX_ROW 0x0000000000 /* relative to CSX_BASE, above */
83#define R_MC_CSX_COL 0x0000000020 /* relative to CSX_BASE, above */
84#define R_MC_CSX_BA 0x0000000040 /* relative to CSX_BASE, above */
85#define MC_CSX_SPACING 0x0000000060 /* relative to CSX_BASE, above */
86
87#define R_MC_CS0_ROW 0x0000000200
88#define R_MC_CS0_COL 0x0000000220
89#define R_MC_CS0_BA 0x0000000240
90#define R_MC_CS1_ROW 0x0000000260
91#define R_MC_CS1_COL 0x0000000280
92#define R_MC_CS1_BA 0x00000002A0
93#define R_MC_CS2_ROW 0x00000002C0
94#define R_MC_CS2_COL 0x00000002E0
95#define R_MC_CS2_BA 0x0000000300
96#define R_MC_CS3_ROW 0x0000000320
97#define R_MC_CS3_COL 0x0000000340
98#define R_MC_CS3_BA 0x0000000360
99#define R_MC_CS_ATTR 0x0000000380
100#define R_MC_TEST_DATA 0x0000000400
101#define R_MC_TEST_ECC 0x0000000420
102#define R_MC_MCLK_CFG 0x0000000500
103
104#endif /* 1250 & 112x */
105
106/* *********************************************************************
107 * L2 Cache Control Registers
108 ********************************************************************* */
109
110#if SIBYTE_HDR_FEATURE_1250_112x /* This L2C only on 1250/112x */
111
112#define A_L2_READ_TAG 0x0010040018
113#define A_L2_ECC_TAG 0x0010040038
114#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
115#define A_L2_READ_MISC 0x0010040058
116#endif /* 1250 PASS3 || 112x PASS1 */
117#define A_L2_WAY_DISABLE 0x0010041000
118#define A_L2_MAKEDISABLE(x) (A_L2_WAY_DISABLE | (((~(x))&0x0F) << 8))
119#define A_L2_MGMT_TAG_BASE 0x00D0000000
120
121#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
122#define A_L2_CACHE_DISABLE 0x0010042000
123#define A_L2_MAKECACHEDISABLE(x) (A_L2_CACHE_DISABLE | (((x)&0x0F) << 8))
124#define A_L2_MISC_CONFIG 0x0010043000
125#endif /* 1250 PASS2 || 112x PASS1 */
126
127/* Backward-compatibility definitions. */
128/* XXX: discourage people from using these constants. */
129#define A_L2_READ_ADDRESS A_L2_READ_TAG
130#define A_L2_EEC_ADDRESS A_L2_ECC_TAG
131
132#endif
133
134
135/* *********************************************************************
136 * PCI Interface Registers
137 ********************************************************************* */
138
139#if SIBYTE_HDR_FEATURE_1250_112x /* This PCI/HT only on 1250/112x */
140#define A_PCI_TYPE00_HEADER 0x00DE000000
141#define A_PCI_TYPE01_HEADER 0x00DE000800
142#endif
143
144
145/* *********************************************************************
146 * Ethernet DMA and MACs
147 ********************************************************************* */
148
149#define A_MAC_BASE_0 0x0010064000
150#define A_MAC_BASE_1 0x0010065000
151#if SIBYTE_HDR_FEATURE_CHIP(1250)
152#define A_MAC_BASE_2 0x0010066000
153#endif /* 1250 */
154
155#define MAC_SPACING 0x1000
156#define MAC_DMA_TXRX_SPACING 0x0400
157#define MAC_DMA_CHANNEL_SPACING 0x0100
158#define DMA_RX 0
159#define DMA_TX 1
160#define MAC_NUM_DMACHAN 2 /* channels per direction */
161
162/* XXX: not correct; depends on SOC type. */
163#define MAC_NUM_PORTS 3
164
165#define A_MAC_CHANNEL_BASE(macnum) \
166 (A_MAC_BASE_0 + \
167 MAC_SPACING*(macnum))
168
169#define A_MAC_REGISTER(macnum,reg) \
170 (A_MAC_BASE_0 + \
171 MAC_SPACING*(macnum) + (reg))
172
173
174#define R_MAC_DMA_CHANNELS 0x800 /* Relative to A_MAC_CHANNEL_BASE */
175
176#define A_MAC_DMA_CHANNEL_BASE(macnum, txrx, chan) \
177 ((A_MAC_CHANNEL_BASE(macnum)) + \
178 R_MAC_DMA_CHANNELS + \
179 (MAC_DMA_TXRX_SPACING*(txrx)) + \
180 (MAC_DMA_CHANNEL_SPACING*(chan)))
181
182#define R_MAC_DMA_CHANNEL_BASE(txrx, chan) \
183 (R_MAC_DMA_CHANNELS + \
184 (MAC_DMA_TXRX_SPACING*(txrx)) + \
185 (MAC_DMA_CHANNEL_SPACING*(chan)))
186
187#define A_MAC_DMA_REGISTER(macnum, txrx, chan, reg) \
188 (A_MAC_DMA_CHANNEL_BASE(macnum, txrx, chan) + \
189 (reg))
190
191#define R_MAC_DMA_REGISTER(txrx, chan, reg) \
192 (R_MAC_DMA_CHANNEL_BASE(txrx, chan) + \
193 (reg))
194
195/*
196 * DMA channel registers, relative to A_MAC_DMA_CHANNEL_BASE
197 */
198
199#define R_MAC_DMA_CONFIG0 0x00000000
200#define R_MAC_DMA_CONFIG1 0x00000008
201#define R_MAC_DMA_DSCR_BASE 0x00000010
202#define R_MAC_DMA_DSCR_CNT 0x00000018
203#define R_MAC_DMA_CUR_DSCRA 0x00000020
204#define R_MAC_DMA_CUR_DSCRB 0x00000028
205#define R_MAC_DMA_CUR_DSCRADDR 0x00000030
206#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
207#define R_MAC_DMA_OODPKTLOST_RX 0x00000038 /* rx only */
208#endif /* 1250 PASS3 || 112x PASS1 */
209
210/*
211 * RMON Counters
212 */
213
214#define R_MAC_RMON_TX_BYTES 0x00000000
215#define R_MAC_RMON_COLLISIONS 0x00000008
216#define R_MAC_RMON_LATE_COL 0x00000010
217#define R_MAC_RMON_EX_COL 0x00000018
218#define R_MAC_RMON_FCS_ERROR 0x00000020
219#define R_MAC_RMON_TX_ABORT 0x00000028
220/* Counter #6 (0x30) now reserved */
221#define R_MAC_RMON_TX_BAD 0x00000038
222#define R_MAC_RMON_TX_GOOD 0x00000040
223#define R_MAC_RMON_TX_RUNT 0x00000048
224#define R_MAC_RMON_TX_OVERSIZE 0x00000050
225#define R_MAC_RMON_RX_BYTES 0x00000080
226#define R_MAC_RMON_RX_MCAST 0x00000088
227#define R_MAC_RMON_RX_BCAST 0x00000090
228#define R_MAC_RMON_RX_BAD 0x00000098
229#define R_MAC_RMON_RX_GOOD 0x000000A0
230#define R_MAC_RMON_RX_RUNT 0x000000A8
231#define R_MAC_RMON_RX_OVERSIZE 0x000000B0
232#define R_MAC_RMON_RX_FCS_ERROR 0x000000B8
233#define R_MAC_RMON_RX_LENGTH_ERROR 0x000000C0
234#define R_MAC_RMON_RX_CODE_ERROR 0x000000C8
235#define R_MAC_RMON_RX_ALIGN_ERROR 0x000000D0
236
237/* Updated to spec 0.2 */
238#define R_MAC_CFG 0x00000100
239#define R_MAC_THRSH_CFG 0x00000108
240#define R_MAC_VLANTAG 0x00000110
241#define R_MAC_FRAMECFG 0x00000118
242#define R_MAC_EOPCNT 0x00000120
243#define R_MAC_FIFO_PTRS 0x00000128
244#define R_MAC_ADFILTER_CFG 0x00000200
245#define R_MAC_ETHERNET_ADDR 0x00000208
246#define R_MAC_PKT_TYPE 0x00000210
247#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
248#define R_MAC_ADMASK0 0x00000218
249#define R_MAC_ADMASK1 0x00000220
250#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
251#define R_MAC_HASH_BASE 0x00000240
252#define R_MAC_ADDR_BASE 0x00000280
253#define R_MAC_CHLO0_BASE 0x00000300
254#define R_MAC_CHUP0_BASE 0x00000320
255#define R_MAC_ENABLE 0x00000400
256#define R_MAC_STATUS 0x00000408
257#define R_MAC_INT_MASK 0x00000410
258#define R_MAC_TXD_CTL 0x00000420
259#define R_MAC_MDIO 0x00000428
260#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
261#define R_MAC_STATUS1 0x00000430
262#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
263#define R_MAC_DEBUG_STATUS 0x00000448
264
265#define MAC_HASH_COUNT 8
266#define MAC_ADDR_COUNT 8
267#define MAC_CHMAP_COUNT 4
268
269
270/* *********************************************************************
271 * DUART Registers
272 ********************************************************************* */
273
274
275#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
276#define R_DUART_NUM_PORTS 2
277
278#define A_DUART 0x0010060000
279
280#define DUART_CHANREG_SPACING 0x100
281
282#define A_DUART_CHANREG(chan, reg) \
283 (A_DUART + DUART_CHANREG_SPACING * ((chan) + 1) + (reg))
284#endif /* 1250 & 112x */
285
286#define R_DUART_MODE_REG_1 0x000
287#define R_DUART_MODE_REG_2 0x010
288#define R_DUART_STATUS 0x020
289#define R_DUART_CLK_SEL 0x030
290#define R_DUART_CMD 0x050
291#define R_DUART_RX_HOLD 0x060
292#define R_DUART_TX_HOLD 0x070
293
294#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
295#define R_DUART_FULL_CTL 0x040
296#define R_DUART_OPCR_X 0x080
297#define R_DUART_AUXCTL_X 0x090
298#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
299
300
301/*
302 * The IMR and ISR can't be addressed with A_DUART_CHANREG,
303 * so use these macros instead.
304 */
305
306#if SIBYTE_HDR_FEATURE_1250_112x /* This MC only on 1250 & 112x */
307#define DUART_IMRISR_SPACING 0x20
308#define DUART_INCHNG_SPACING 0x10
309
310#define A_DUART_CTRLREG(reg) \
311 (A_DUART + DUART_CHANREG_SPACING * 3 + (reg))
312
313#define R_DUART_IMRREG(chan) \
314 (R_DUART_IMR_A + (chan) * DUART_IMRISR_SPACING)
315#define R_DUART_ISRREG(chan) \
316 (R_DUART_ISR_A + (chan) * DUART_IMRISR_SPACING)
317#define R_DUART_INCHREG(chan) \
318 (R_DUART_IN_CHNG_A + (chan) * DUART_INCHNG_SPACING)
319
320#define A_DUART_IMRREG(chan) A_DUART_CTRLREG(R_DUART_IMRREG(chan))
321#define A_DUART_ISRREG(chan) A_DUART_CTRLREG(R_DUART_ISRREG(chan))
322#define A_DUART_INCHREG(chan) A_DUART_CTRLREG(R_DUART_INCHREG(chan))
323#endif /* 1250 & 112x */
324
325#define R_DUART_AUX_CTRL 0x010
326#define R_DUART_ISR_A 0x020
327#define R_DUART_IMR_A 0x030
328#define R_DUART_ISR_B 0x040
329#define R_DUART_IMR_B 0x050
330#define R_DUART_OUT_PORT 0x060
331#define R_DUART_OPCR 0x070
332#define R_DUART_IN_PORT 0x080
333
334#define R_DUART_SET_OPR 0x0B0
335#define R_DUART_CLEAR_OPR 0x0C0
336#define R_DUART_IN_CHNG_A 0x0D0
337#define R_DUART_IN_CHNG_B 0x0E0
338
339
340/*
341 * These constants are the absolute addresses.
342 */
343
344#define A_DUART_MODE_REG_1_A 0x0010060100
345#define A_DUART_MODE_REG_2_A 0x0010060110
346#define A_DUART_STATUS_A 0x0010060120
347#define A_DUART_CLK_SEL_A 0x0010060130
348#define A_DUART_CMD_A 0x0010060150
349#define A_DUART_RX_HOLD_A 0x0010060160
350#define A_DUART_TX_HOLD_A 0x0010060170
351
352#define A_DUART_MODE_REG_1_B 0x0010060200
353#define A_DUART_MODE_REG_2_B 0x0010060210
354#define A_DUART_STATUS_B 0x0010060220
355#define A_DUART_CLK_SEL_B 0x0010060230
356#define A_DUART_CMD_B 0x0010060250
357#define A_DUART_RX_HOLD_B 0x0010060260
358#define A_DUART_TX_HOLD_B 0x0010060270
359
360#define A_DUART_INPORT_CHNG 0x0010060300
361#define A_DUART_AUX_CTRL 0x0010060310
362#define A_DUART_ISR_A 0x0010060320
363#define A_DUART_IMR_A 0x0010060330
364#define A_DUART_ISR_B 0x0010060340
365#define A_DUART_IMR_B 0x0010060350
366#define A_DUART_OUT_PORT 0x0010060360
367#define A_DUART_OPCR 0x0010060370
368#define A_DUART_IN_PORT 0x0010060380
369#define A_DUART_ISR 0x0010060390
370#define A_DUART_IMR 0x00100603A0
371#define A_DUART_SET_OPR 0x00100603B0
372#define A_DUART_CLEAR_OPR 0x00100603C0
373#define A_DUART_INPORT_CHNG_A 0x00100603D0
374#define A_DUART_INPORT_CHNG_B 0x00100603E0
375
376#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
377#define A_DUART_FULL_CTL_A 0x0010060140
378#define A_DUART_FULL_CTL_B 0x0010060240
379
380#define A_DUART_OPCR_A 0x0010060180
381#define A_DUART_OPCR_B 0x0010060280
382
383#define A_DUART_INPORT_CHNG_DEBUG 0x00100603F0
384#endif /* 1250 PASS2 || 112x PASS1 */
385
386
387/* *********************************************************************
388 * Synchronous Serial Registers
389 ********************************************************************* */
390
391
392#if SIBYTE_HDR_FEATURE_1250_112x /* sync serial only on 1250/112x */
393
394#define A_SER_BASE_0 0x0010060400
395#define A_SER_BASE_1 0x0010060800
396#define SER_SPACING 0x400
397
398#define SER_DMA_TXRX_SPACING 0x80
399
400#define SER_NUM_PORTS 2
401
402#define A_SER_CHANNEL_BASE(sernum) \
403 (A_SER_BASE_0 + \
404 SER_SPACING*(sernum))
405
406#define A_SER_REGISTER(sernum,reg) \
407 (A_SER_BASE_0 + \
408 SER_SPACING*(sernum) + (reg))
409
410
411#define R_SER_DMA_CHANNELS 0 /* Relative to A_SER_BASE_x */
412
413#define A_SER_DMA_CHANNEL_BASE(sernum,txrx) \
414 ((A_SER_CHANNEL_BASE(sernum)) + \
415 R_SER_DMA_CHANNELS + \
416 (SER_DMA_TXRX_SPACING*(txrx)))
417
418#define A_SER_DMA_REGISTER(sernum, txrx, reg) \
419 (A_SER_DMA_CHANNEL_BASE(sernum, txrx) + \
420 (reg))
421
422
423/*
424 * DMA channel registers, relative to A_SER_DMA_CHANNEL_BASE
425 */
426
427#define R_SER_DMA_CONFIG0 0x00000000
428#define R_SER_DMA_CONFIG1 0x00000008
429#define R_SER_DMA_DSCR_BASE 0x00000010
430#define R_SER_DMA_DSCR_CNT 0x00000018
431#define R_SER_DMA_CUR_DSCRA 0x00000020
432#define R_SER_DMA_CUR_DSCRB 0x00000028
433#define R_SER_DMA_CUR_DSCRADDR 0x00000030
434
435#define R_SER_DMA_CONFIG0_RX 0x00000000
436#define R_SER_DMA_CONFIG1_RX 0x00000008
437#define R_SER_DMA_DSCR_BASE_RX 0x00000010
438#define R_SER_DMA_DSCR_COUNT_RX 0x00000018
439#define R_SER_DMA_CUR_DSCR_A_RX 0x00000020
440#define R_SER_DMA_CUR_DSCR_B_RX 0x00000028
441#define R_SER_DMA_CUR_DSCR_ADDR_RX 0x00000030
442
443#define R_SER_DMA_CONFIG0_TX 0x00000080
444#define R_SER_DMA_CONFIG1_TX 0x00000088
445#define R_SER_DMA_DSCR_BASE_TX 0x00000090
446#define R_SER_DMA_DSCR_COUNT_TX 0x00000098
447#define R_SER_DMA_CUR_DSCR_A_TX 0x000000A0
448#define R_SER_DMA_CUR_DSCR_B_TX 0x000000A8
449#define R_SER_DMA_CUR_DSCR_ADDR_TX 0x000000B0
450
451#define R_SER_MODE 0x00000100
452#define R_SER_MINFRM_SZ 0x00000108
453#define R_SER_MAXFRM_SZ 0x00000110
454#define R_SER_ADDR 0x00000118
455#define R_SER_USR0_ADDR 0x00000120
456#define R_SER_USR1_ADDR 0x00000128
457#define R_SER_USR2_ADDR 0x00000130
458#define R_SER_USR3_ADDR 0x00000138
459#define R_SER_CMD 0x00000140
460#define R_SER_TX_RD_THRSH 0x00000160
461#define R_SER_TX_WR_THRSH 0x00000168
462#define R_SER_RX_RD_THRSH 0x00000170
463#define R_SER_LINE_MODE 0x00000178
464#define R_SER_DMA_ENABLE 0x00000180
465#define R_SER_INT_MASK 0x00000190
466#define R_SER_STATUS 0x00000188
467#define R_SER_STATUS_DEBUG 0x000001A8
468#define R_SER_RX_TABLE_BASE 0x00000200
469#define SER_RX_TABLE_COUNT 16
470#define R_SER_TX_TABLE_BASE 0x00000300
471#define SER_TX_TABLE_COUNT 16
472
473/* RMON Counters */
474#define R_SER_RMON_TX_BYTE_LO 0x000001C0
475#define R_SER_RMON_TX_BYTE_HI 0x000001C8
476#define R_SER_RMON_RX_BYTE_LO 0x000001D0
477#define R_SER_RMON_RX_BYTE_HI 0x000001D8
478#define R_SER_RMON_TX_UNDERRUN 0x000001E0
479#define R_SER_RMON_RX_OVERFLOW 0x000001E8
480#define R_SER_RMON_RX_ERRORS 0x000001F0
481#define R_SER_RMON_RX_BADADDR 0x000001F8
482
483#endif /* 1250/112x */
484
485/* *********************************************************************
486 * Generic Bus Registers
487 ********************************************************************* */
488
489#define IO_EXT_CFG_COUNT 8
490
491#define A_IO_EXT_BASE 0x0010061000
492#define A_IO_EXT_REG(r) (A_IO_EXT_BASE + (r))
493
494#define A_IO_EXT_CFG_BASE 0x0010061000
495#define A_IO_EXT_MULT_SIZE_BASE 0x0010061100
496#define A_IO_EXT_START_ADDR_BASE 0x0010061200
497#define A_IO_EXT_TIME_CFG0_BASE 0x0010061600
498#define A_IO_EXT_TIME_CFG1_BASE 0x0010061700
499
500#define IO_EXT_REGISTER_SPACING 8
501#define A_IO_EXT_CS_BASE(cs) (A_IO_EXT_CFG_BASE+IO_EXT_REGISTER_SPACING*(cs))
502#define R_IO_EXT_REG(reg, cs) ((cs)*IO_EXT_REGISTER_SPACING + (reg))
503
504#define R_IO_EXT_CFG 0x0000
505#define R_IO_EXT_MULT_SIZE 0x0100
506#define R_IO_EXT_START_ADDR 0x0200
507#define R_IO_EXT_TIME_CFG0 0x0600
508#define R_IO_EXT_TIME_CFG1 0x0700
509
510
511#define A_IO_INTERRUPT_STATUS 0x0010061A00
512#define A_IO_INTERRUPT_DATA0 0x0010061A10
513#define A_IO_INTERRUPT_DATA1 0x0010061A18
514#define A_IO_INTERRUPT_DATA2 0x0010061A20
515#define A_IO_INTERRUPT_DATA3 0x0010061A28
516#define A_IO_INTERRUPT_ADDR0 0x0010061A30
517#define A_IO_INTERRUPT_ADDR1 0x0010061A40
518#define A_IO_INTERRUPT_PARITY 0x0010061A50
519#define A_IO_PCMCIA_CFG 0x0010061A60
520#define A_IO_PCMCIA_STATUS 0x0010061A70
521#define A_IO_DRIVE_0 0x0010061300
522#define A_IO_DRIVE_1 0x0010061308
523#define A_IO_DRIVE_2 0x0010061310
524#define A_IO_DRIVE_3 0x0010061318
525#define A_IO_DRIVE_BASE A_IO_DRIVE_0
526#define IO_DRIVE_REGISTER_SPACING 8
527#define R_IO_DRIVE(x) ((x)*IO_DRIVE_REGISTER_SPACING)
528#define A_IO_DRIVE(x) (A_IO_DRIVE_BASE + R_IO_DRIVE(x))
529
530#define R_IO_INTERRUPT_STATUS 0x0A00
531#define R_IO_INTERRUPT_DATA0 0x0A10
532#define R_IO_INTERRUPT_DATA1 0x0A18
533#define R_IO_INTERRUPT_DATA2 0x0A20
534#define R_IO_INTERRUPT_DATA3 0x0A28
535#define R_IO_INTERRUPT_ADDR0 0x0A30
536#define R_IO_INTERRUPT_ADDR1 0x0A40
537#define R_IO_INTERRUPT_PARITY 0x0A50
538#define R_IO_PCMCIA_CFG 0x0A60
539#define R_IO_PCMCIA_STATUS 0x0A70
540
541/* *********************************************************************
542 * GPIO Registers
543 ********************************************************************* */
544
545#define A_GPIO_CLR_EDGE 0x0010061A80
546#define A_GPIO_INT_TYPE 0x0010061A88
547#define A_GPIO_INPUT_INVERT 0x0010061A90
548#define A_GPIO_GLITCH 0x0010061A98
549#define A_GPIO_READ 0x0010061AA0
550#define A_GPIO_DIRECTION 0x0010061AA8
551#define A_GPIO_PIN_CLR 0x0010061AB0
552#define A_GPIO_PIN_SET 0x0010061AB8
553
554#define A_GPIO_BASE 0x0010061A80
555
556#define R_GPIO_CLR_EDGE 0x00
557#define R_GPIO_INT_TYPE 0x08
558#define R_GPIO_INPUT_INVERT 0x10
559#define R_GPIO_GLITCH 0x18
560#define R_GPIO_READ 0x20
561#define R_GPIO_DIRECTION 0x28
562#define R_GPIO_PIN_CLR 0x30
563#define R_GPIO_PIN_SET 0x38
564
565/* *********************************************************************
566 * SMBus Registers
567 ********************************************************************* */
568
569#define A_SMB_XTRA_0 0x0010060000
570#define A_SMB_XTRA_1 0x0010060008
571#define A_SMB_FREQ_0 0x0010060010
572#define A_SMB_FREQ_1 0x0010060018
573#define A_SMB_STATUS_0 0x0010060020
574#define A_SMB_STATUS_1 0x0010060028
575#define A_SMB_CMD_0 0x0010060030
576#define A_SMB_CMD_1 0x0010060038
577#define A_SMB_START_0 0x0010060040
578#define A_SMB_START_1 0x0010060048
579#define A_SMB_DATA_0 0x0010060050
580#define A_SMB_DATA_1 0x0010060058
581#define A_SMB_CONTROL_0 0x0010060060
582#define A_SMB_CONTROL_1 0x0010060068
583#define A_SMB_PEC_0 0x0010060070
584#define A_SMB_PEC_1 0x0010060078
585
586#define A_SMB_0 0x0010060000
587#define A_SMB_1 0x0010060008
588#define SMB_REGISTER_SPACING 0x8
589#define A_SMB_BASE(idx) (A_SMB_0+(idx)*SMB_REGISTER_SPACING)
590#define A_SMB_REGISTER(idx, reg) (A_SMB_BASE(idx)+(reg))
591
592#define R_SMB_XTRA 0x0000000000
593#define R_SMB_FREQ 0x0000000010
594#define R_SMB_STATUS 0x0000000020
595#define R_SMB_CMD 0x0000000030
596#define R_SMB_START 0x0000000040
597#define R_SMB_DATA 0x0000000050
598#define R_SMB_CONTROL 0x0000000060
599#define R_SMB_PEC 0x0000000070
600
601/* *********************************************************************
602 * Timer Registers
603 ********************************************************************* */
604
605/*
606 * Watchdog timers
607 */
608
609#define A_SCD_WDOG_0 0x0010020050
610#define A_SCD_WDOG_1 0x0010020150
611#define SCD_WDOG_SPACING 0x100
612#define SCD_NUM_WDOGS 2
613#define A_SCD_WDOG_BASE(w) (A_SCD_WDOG_0+SCD_WDOG_SPACING*(w))
614#define A_SCD_WDOG_REGISTER(w, r) (A_SCD_WDOG_BASE(w) + (r))
615
616#define R_SCD_WDOG_INIT 0x0000000000
617#define R_SCD_WDOG_CNT 0x0000000008
618#define R_SCD_WDOG_CFG 0x0000000010
619
620#define A_SCD_WDOG_INIT_0 0x0010020050
621#define A_SCD_WDOG_CNT_0 0x0010020058
622#define A_SCD_WDOG_CFG_0 0x0010020060
623
624#define A_SCD_WDOG_INIT_1 0x0010020150
625#define A_SCD_WDOG_CNT_1 0x0010020158
626#define A_SCD_WDOG_CFG_1 0x0010020160
627
628/*
629 * Generic timers
630 */
631
632#define A_SCD_TIMER_0 0x0010020070
633#define A_SCD_TIMER_1 0x0010020078
634#define A_SCD_TIMER_2 0x0010020170
635#define A_SCD_TIMER_3 0x0010020178
636#define SCD_NUM_TIMERS 4
637#define A_SCD_TIMER_BASE(w) (A_SCD_TIMER_0+0x08*((w)&1)+0x100*(((w)&2)>>1))
638#define A_SCD_TIMER_REGISTER(w, r) (A_SCD_TIMER_BASE(w) + (r))
639
640#define R_SCD_TIMER_INIT 0x0000000000
641#define R_SCD_TIMER_CNT 0x0000000010
642#define R_SCD_TIMER_CFG 0x0000000020
643
644#define A_SCD_TIMER_INIT_0 0x0010020070
645#define A_SCD_TIMER_CNT_0 0x0010020080
646#define A_SCD_TIMER_CFG_0 0x0010020090
647
648#define A_SCD_TIMER_INIT_1 0x0010020078
649#define A_SCD_TIMER_CNT_1 0x0010020088
650#define A_SCD_TIMER_CFG_1 0x0010020098
651
652#define A_SCD_TIMER_INIT_2 0x0010020170
653#define A_SCD_TIMER_CNT_2 0x0010020180
654#define A_SCD_TIMER_CFG_2 0x0010020190
655
656#define A_SCD_TIMER_INIT_3 0x0010020178
657#define A_SCD_TIMER_CNT_3 0x0010020188
658#define A_SCD_TIMER_CFG_3 0x0010020198
659
660#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
661#define A_SCD_SCRATCH 0x0010020C10
662#endif /* 1250 PASS2 || 112x PASS1 */
663
664#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
665#define A_SCD_ZBBUS_CYCLE_COUNT 0x0010030000
666#define A_SCD_ZBBUS_CYCLE_CP0 0x0010020C00
667#define A_SCD_ZBBUS_CYCLE_CP1 0x0010020C08
668#endif
669
670/* *********************************************************************
671 * System Control Registers
672 ********************************************************************* */
673
674#define A_SCD_SYSTEM_REVISION 0x0010020000
675#define A_SCD_SYSTEM_CFG 0x0010020008
676#define A_SCD_SYSTEM_MANUF 0x0010038000
677
678/* *********************************************************************
679 * System Address Trap Registers
680 ********************************************************************* */
681
682#define A_ADDR_TRAP_INDEX 0x00100200B0
683#define A_ADDR_TRAP_REG 0x00100200B8
684#define A_ADDR_TRAP_UP_0 0x0010020400
685#define A_ADDR_TRAP_UP_1 0x0010020408
686#define A_ADDR_TRAP_UP_2 0x0010020410
687#define A_ADDR_TRAP_UP_3 0x0010020418
688#define A_ADDR_TRAP_DOWN_0 0x0010020420
689#define A_ADDR_TRAP_DOWN_1 0x0010020428
690#define A_ADDR_TRAP_DOWN_2 0x0010020430
691#define A_ADDR_TRAP_DOWN_3 0x0010020438
692#define A_ADDR_TRAP_CFG_0 0x0010020440
693#define A_ADDR_TRAP_CFG_1 0x0010020448
694#define A_ADDR_TRAP_CFG_2 0x0010020450
695#define A_ADDR_TRAP_CFG_3 0x0010020458
696#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
697#define A_ADDR_TRAP_REG_DEBUG 0x0010020460
698#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
699
700#define ADDR_TRAP_SPACING 8
701#define NUM_ADDR_TRAP 4
702#define A_ADDR_TRAP_UP(n) (A_ADDR_TRAP_UP_0 + ((n) * ADDR_TRAP_SPACING))
703#define A_ADDR_TRAP_DOWN(n) (A_ADDR_TRAP_DOWN_0 + ((n) * ADDR_TRAP_SPACING))
704#define A_ADDR_TRAP_CFG(n) (A_ADDR_TRAP_CFG_0 + ((n) * ADDR_TRAP_SPACING))
705
706
707/* *********************************************************************
708 * System Interrupt Mapper Registers
709 ********************************************************************* */
710
711#define A_IMR_CPU0_BASE 0x0010020000
712#define A_IMR_CPU1_BASE 0x0010022000
713#define IMR_REGISTER_SPACING 0x2000
714#define IMR_REGISTER_SPACING_SHIFT 13
715
716#define A_IMR_MAPPER(cpu) (A_IMR_CPU0_BASE+(cpu)*IMR_REGISTER_SPACING)
717#define A_IMR_REGISTER(cpu, reg) (A_IMR_MAPPER(cpu)+(reg))
718
719#define R_IMR_INTERRUPT_DIAG 0x0010
720#define R_IMR_INTERRUPT_LDT 0x0018
721#define R_IMR_INTERRUPT_MASK 0x0028
722#define R_IMR_INTERRUPT_TRACE 0x0038
723#define R_IMR_INTERRUPT_SOURCE_STATUS 0x0040
724#define R_IMR_LDT_INTERRUPT_SET 0x0048
725#define R_IMR_LDT_INTERRUPT 0x0018
726#define R_IMR_LDT_INTERRUPT_CLR 0x0020
727#define R_IMR_MAILBOX_CPU 0x00c0
728#define R_IMR_ALIAS_MAILBOX_CPU 0x1000
729#define R_IMR_MAILBOX_SET_CPU 0x00C8
730#define R_IMR_ALIAS_MAILBOX_SET_CPU 0x1008
731#define R_IMR_MAILBOX_CLR_CPU 0x00D0
732#define R_IMR_INTERRUPT_STATUS_BASE 0x0100
733#define R_IMR_INTERRUPT_STATUS_COUNT 7
734#define R_IMR_INTERRUPT_MAP_BASE 0x0200
735#define R_IMR_INTERRUPT_MAP_COUNT 64
736
737/*
738 * these macros work together to build the address of a mailbox
739 * register, e.g., A_MAILBOX_REGISTER(R_IMR_MAILBOX_SET_CPU,1)
740 * for mbox_0_set_cpu2 returns 0x00100240C8
741 */
742#define A_MAILBOX_REGISTER(reg,cpu) \
743 (A_IMR_CPU0_BASE + (cpu * IMR_REGISTER_SPACING) + reg)
744
745/* *********************************************************************
746 * System Performance Counter Registers
747 ********************************************************************* */
748
749#define A_SCD_PERF_CNT_CFG 0x00100204C0
750#define A_SCD_PERF_CNT_0 0x00100204D0
751#define A_SCD_PERF_CNT_1 0x00100204D8
752#define A_SCD_PERF_CNT_2 0x00100204E0
753#define A_SCD_PERF_CNT_3 0x00100204E8
754
755#define SCD_NUM_PERF_CNT 4
756#define SCD_PERF_CNT_SPACING 8
757#define A_SCD_PERF_CNT(n) (A_SCD_PERF_CNT_0+(n*SCD_PERF_CNT_SPACING))
758
759/* *********************************************************************
760 * System Bus Watcher Registers
761 ********************************************************************* */
762
763#define A_SCD_BUS_ERR_STATUS 0x0010020880
764#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
765#define A_SCD_BUS_ERR_STATUS_DEBUG 0x00100208D0
766#define A_BUS_ERR_STATUS_DEBUG 0x00100208D0
767#endif /* 1250 PASS2 || 112x PASS1 */
768#define A_BUS_ERR_DATA_0 0x00100208A0
769#define A_BUS_ERR_DATA_1 0x00100208A8
770#define A_BUS_ERR_DATA_2 0x00100208B0
771#define A_BUS_ERR_DATA_3 0x00100208B8
772#define A_BUS_L2_ERRORS 0x00100208C0
773#define A_BUS_MEM_IO_ERRORS 0x00100208C8
774
775/* *********************************************************************
776 * System Debug Controller Registers
777 ********************************************************************* */
778
779#define A_SCD_JTAG_BASE 0x0010000000
780
781/* *********************************************************************
782 * System Trace Buffer Registers
783 ********************************************************************* */
784
785#define A_SCD_TRACE_CFG 0x0010020A00
786#define A_SCD_TRACE_READ 0x0010020A08
787#define A_SCD_TRACE_EVENT_0 0x0010020A20
788#define A_SCD_TRACE_EVENT_1 0x0010020A28
789#define A_SCD_TRACE_EVENT_2 0x0010020A30
790#define A_SCD_TRACE_EVENT_3 0x0010020A38
791#define A_SCD_TRACE_SEQUENCE_0 0x0010020A40
792#define A_SCD_TRACE_SEQUENCE_1 0x0010020A48
793#define A_SCD_TRACE_SEQUENCE_2 0x0010020A50
794#define A_SCD_TRACE_SEQUENCE_3 0x0010020A58
795#define A_SCD_TRACE_EVENT_4 0x0010020A60
796#define A_SCD_TRACE_EVENT_5 0x0010020A68
797#define A_SCD_TRACE_EVENT_6 0x0010020A70
798#define A_SCD_TRACE_EVENT_7 0x0010020A78
799#define A_SCD_TRACE_SEQUENCE_4 0x0010020A80
800#define A_SCD_TRACE_SEQUENCE_5 0x0010020A88
801#define A_SCD_TRACE_SEQUENCE_6 0x0010020A90
802#define A_SCD_TRACE_SEQUENCE_7 0x0010020A98
803
804#define TRACE_REGISTER_SPACING 8
805#define TRACE_NUM_REGISTERS 8
806#define A_SCD_TRACE_EVENT(n) (((n) & 4) ? \
807 (A_SCD_TRACE_EVENT_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
808 (A_SCD_TRACE_EVENT_0 + ((n) * TRACE_REGISTER_SPACING)))
809#define A_SCD_TRACE_SEQUENCE(n) (((n) & 4) ? \
810 (A_SCD_TRACE_SEQUENCE_4 + (((n) & 3) * TRACE_REGISTER_SPACING)) : \
811 (A_SCD_TRACE_SEQUENCE_0 + ((n) * TRACE_REGISTER_SPACING)))
812
813/* *********************************************************************
814 * System Generic DMA Registers
815 ********************************************************************* */
816
817#define A_DM_0 0x0010020B00
818#define A_DM_1 0x0010020B20
819#define A_DM_2 0x0010020B40
820#define A_DM_3 0x0010020B60
821#define DM_REGISTER_SPACING 0x20
822#define DM_NUM_CHANNELS 4
823#define A_DM_BASE(idx) (A_DM_0 + ((idx) * DM_REGISTER_SPACING))
824#define A_DM_REGISTER(idx, reg) (A_DM_BASE(idx) + (reg))
825
826#define R_DM_DSCR_BASE 0x0000000000
827#define R_DM_DSCR_COUNT 0x0000000008
828#define R_DM_CUR_DSCR_ADDR 0x0000000010
829#define R_DM_DSCR_BASE_DEBUG 0x0000000018
830
831#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
832#define A_DM_PARTIAL_0 0x0010020ba0
833#define A_DM_PARTIAL_1 0x0010020ba8
834#define A_DM_PARTIAL_2 0x0010020bb0
835#define A_DM_PARTIAL_3 0x0010020bb8
836#define DM_PARTIAL_REGISTER_SPACING 0x8
837#define A_DM_PARTIAL(idx) (A_DM_PARTIAL_0 + ((idx) * DM_PARTIAL_REGISTER_SPACING))
838#endif /* 1250 PASS3 || 112x PASS1 */
839
840#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1)
841#define A_DM_CRC_0 0x0010020b80
842#define A_DM_CRC_1 0x0010020b90
843#define DM_CRC_REGISTER_SPACING 0x10
844#define DM_CRC_NUM_CHANNELS 2
845#define A_DM_CRC_BASE(idx) (A_DM_CRC_0 + ((idx) * DM_CRC_REGISTER_SPACING))
846#define A_DM_CRC_REGISTER(idx, reg) (A_DM_CRC_BASE(idx) + (reg))
847
848#define R_CRC_DEF_0 0x00
849#define R_CTCP_DEF_0 0x08
850#endif /* 1250 PASS3 || 112x PASS1 */
851
852/* *********************************************************************
853 * Physical Address Map
854 ********************************************************************* */
855
856#if SIBYTE_HDR_FEATURE_1250_112x
857#define A_PHYS_MEMORY_0 _SB_MAKE64(0x0000000000)
858#define A_PHYS_MEMORY_SIZE _SB_MAKE64((256*1024*1024))
859#define A_PHYS_SYSTEM_CTL _SB_MAKE64(0x0010000000)
860#define A_PHYS_IO_SYSTEM _SB_MAKE64(0x0010060000)
861#define A_PHYS_GENBUS _SB_MAKE64(0x0010090000)
862#define A_PHYS_GENBUS_END _SB_MAKE64(0x0040000000)
863#define A_PHYS_LDTPCI_IO_MATCH_BYTES_32 _SB_MAKE64(0x0040000000)
864#define A_PHYS_LDTPCI_IO_MATCH_BITS_32 _SB_MAKE64(0x0060000000)
865#define A_PHYS_MEMORY_1 _SB_MAKE64(0x0080000000)
866#define A_PHYS_MEMORY_2 _SB_MAKE64(0x0090000000)
867#define A_PHYS_MEMORY_3 _SB_MAKE64(0x00C0000000)
868#define A_PHYS_L2_CACHE_TEST _SB_MAKE64(0x00D0000000)
869#define A_PHYS_LDT_SPECIAL_MATCH_BYTES _SB_MAKE64(0x00D8000000)
870#define A_PHYS_LDTPCI_IO_MATCH_BYTES _SB_MAKE64(0x00DC000000)
871#define A_PHYS_LDTPCI_CFG_MATCH_BYTES _SB_MAKE64(0x00DE000000)
872#define A_PHYS_LDT_SPECIAL_MATCH_BITS _SB_MAKE64(0x00F8000000)
873#define A_PHYS_LDTPCI_IO_MATCH_BITS _SB_MAKE64(0x00FC000000)
874#define A_PHYS_LDTPCI_CFG_MATCH_BITS _SB_MAKE64(0x00FE000000)
875#define A_PHYS_MEMORY_EXP _SB_MAKE64(0x0100000000)
876#define A_PHYS_MEMORY_EXP_SIZE _SB_MAKE64((508*1024*1024*1024))
877#define A_PHYS_LDT_EXP _SB_MAKE64(0x8000000000)
878#define A_PHYS_PCI_FULLACCESS_BYTES _SB_MAKE64(0xF000000000)
879#define A_PHYS_PCI_FULLACCESS_BITS _SB_MAKE64(0xF100000000)
880#define A_PHYS_RESERVED _SB_MAKE64(0xF200000000)
881#define A_PHYS_RESERVED_SPECIAL_LDT _SB_MAKE64(0xFD00000000)
882
883#define A_PHYS_L2CACHE_WAY_SIZE _SB_MAKE64(0x0000020000)
884#define PHYS_L2CACHE_NUM_WAYS 4
885#define A_PHYS_L2CACHE_TOTAL_SIZE _SB_MAKE64(0x0000080000)
886#define A_PHYS_L2CACHE_WAY0 _SB_MAKE64(0x00D0180000)
887#define A_PHYS_L2CACHE_WAY1 _SB_MAKE64(0x00D01A0000)
888#define A_PHYS_L2CACHE_WAY2 _SB_MAKE64(0x00D01C0000)
889#define A_PHYS_L2CACHE_WAY3 _SB_MAKE64(0x00D01E0000)
890#endif
891
892
893#endif
diff --git a/include/asm-mips/sibyte/sb1250_scd.h b/include/asm-mips/sibyte/sb1250_scd.h
deleted file mode 100644
index e49c3e89b5ee..000000000000
--- a/include/asm-mips/sibyte/sb1250_scd.h
+++ /dev/null
@@ -1,654 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * SCD Constants and Macros File: sb1250_scd.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the System Control and Debug module on the 1250.
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003,2004,2005
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32#ifndef _SB1250_SCD_H
33#define _SB1250_SCD_H
34
35#include "sb1250_defs.h"
36
37/* *********************************************************************
38 * System control/debug registers
39 ********************************************************************* */
40
41/*
42 * System Revision Register (Table 4-1)
43 */
44
45#define M_SYS_RESERVED _SB_MAKEMASK(8, 0)
46
47#define S_SYS_REVISION _SB_MAKE64(8)
48#define M_SYS_REVISION _SB_MAKEMASK(8, S_SYS_REVISION)
49#define V_SYS_REVISION(x) _SB_MAKEVALUE(x, S_SYS_REVISION)
50#define G_SYS_REVISION(x) _SB_GETVALUE(x, S_SYS_REVISION, M_SYS_REVISION)
51
52#define K_SYS_REVISION_BCM1250_PASS1 0x01
53
54#define K_SYS_REVISION_BCM1250_PASS2 0x03
55#define K_SYS_REVISION_BCM1250_A1 0x03 /* Pass 2.0 WB */
56#define K_SYS_REVISION_BCM1250_A2 0x04 /* Pass 2.0 FC */
57#define K_SYS_REVISION_BCM1250_A3 0x05 /* Pass 2.1 FC */
58#define K_SYS_REVISION_BCM1250_A4 0x06 /* Pass 2.1 WB */
59#define K_SYS_REVISION_BCM1250_A6 0x07 /* OR 0x04 (A2) w/WID != 0 */
60#define K_SYS_REVISION_BCM1250_A8 0x0b /* A8/A10 */
61#define K_SYS_REVISION_BCM1250_A9 0x08
62#define K_SYS_REVISION_BCM1250_A10 K_SYS_REVISION_BCM1250_A8
63
64#define K_SYS_REVISION_BCM1250_PASS2_2 0x10
65#define K_SYS_REVISION_BCM1250_B0 K_SYS_REVISION_BCM1250_B1
66#define K_SYS_REVISION_BCM1250_B1 0x10
67#define K_SYS_REVISION_BCM1250_B2 0x11
68
69#define K_SYS_REVISION_BCM1250_C0 0x20
70#define K_SYS_REVISION_BCM1250_C1 0x21
71#define K_SYS_REVISION_BCM1250_C2 0x22
72#define K_SYS_REVISION_BCM1250_C3 0x23
73
74#if SIBYTE_HDR_FEATURE_CHIP(1250)
75/* XXX: discourage people from using these constants. */
76#define K_SYS_REVISION_PASS1 K_SYS_REVISION_BCM1250_PASS1
77#define K_SYS_REVISION_PASS2 K_SYS_REVISION_BCM1250_PASS2
78#define K_SYS_REVISION_PASS2_2 K_SYS_REVISION_BCM1250_PASS2_2
79#define K_SYS_REVISION_PASS3 K_SYS_REVISION_BCM1250_PASS3
80#define K_SYS_REVISION_BCM1250_PASS3 K_SYS_REVISION_BCM1250_C0
81#endif /* 1250 */
82
83#define K_SYS_REVISION_BCM112x_A1 0x20
84#define K_SYS_REVISION_BCM112x_A2 0x21
85#define K_SYS_REVISION_BCM112x_A3 0x22
86#define K_SYS_REVISION_BCM112x_A4 0x23
87#define K_SYS_REVISION_BCM112x_B0 0x30
88
89#define K_SYS_REVISION_BCM1480_S0 0x01
90#define K_SYS_REVISION_BCM1480_A1 0x02
91#define K_SYS_REVISION_BCM1480_A2 0x03
92#define K_SYS_REVISION_BCM1480_A3 0x04
93#define K_SYS_REVISION_BCM1480_B0 0x11
94
95/*Cache size - 23:20 of revision register*/
96#define S_SYS_L2C_SIZE _SB_MAKE64(20)
97#define M_SYS_L2C_SIZE _SB_MAKEMASK(4, S_SYS_L2C_SIZE)
98#define V_SYS_L2C_SIZE(x) _SB_MAKEVALUE(x, S_SYS_L2C_SIZE)
99#define G_SYS_L2C_SIZE(x) _SB_GETVALUE(x, S_SYS_L2C_SIZE, M_SYS_L2C_SIZE)
100
101#define K_SYS_L2C_SIZE_1MB 0
102#define K_SYS_L2C_SIZE_512KB 5
103#define K_SYS_L2C_SIZE_256KB 2
104#define K_SYS_L2C_SIZE_128KB 1
105
106#define K_SYS_L2C_SIZE_BCM1250 K_SYS_L2C_SIZE_512KB
107#define K_SYS_L2C_SIZE_BCM1125 K_SYS_L2C_SIZE_256KB
108#define K_SYS_L2C_SIZE_BCM1122 K_SYS_L2C_SIZE_128KB
109
110
111/* Number of CPU cores, bits 27:24 of revision register*/
112#define S_SYS_NUM_CPUS _SB_MAKE64(24)
113#define M_SYS_NUM_CPUS _SB_MAKEMASK(4, S_SYS_NUM_CPUS)
114#define V_SYS_NUM_CPUS(x) _SB_MAKEVALUE(x, S_SYS_NUM_CPUS)
115#define G_SYS_NUM_CPUS(x) _SB_GETVALUE(x, S_SYS_NUM_CPUS, M_SYS_NUM_CPUS)
116
117
118/* XXX: discourage people from using these constants. */
119#define S_SYS_PART _SB_MAKE64(16)
120#define M_SYS_PART _SB_MAKEMASK(16, S_SYS_PART)
121#define V_SYS_PART(x) _SB_MAKEVALUE(x, S_SYS_PART)
122#define G_SYS_PART(x) _SB_GETVALUE(x, S_SYS_PART, M_SYS_PART)
123
124/* XXX: discourage people from using these constants. */
125#define K_SYS_PART_SB1250 0x1250
126#define K_SYS_PART_BCM1120 0x1121
127#define K_SYS_PART_BCM1125 0x1123
128#define K_SYS_PART_BCM1125H 0x1124
129#define K_SYS_PART_BCM1122 0x1113
130
131
132/* The "peripheral set" (SOC type) is the low 4 bits of the "part" field. */
133#define S_SYS_SOC_TYPE _SB_MAKE64(16)
134#define M_SYS_SOC_TYPE _SB_MAKEMASK(4, S_SYS_SOC_TYPE)
135#define V_SYS_SOC_TYPE(x) _SB_MAKEVALUE(x, S_SYS_SOC_TYPE)
136#define G_SYS_SOC_TYPE(x) _SB_GETVALUE(x, S_SYS_SOC_TYPE, M_SYS_SOC_TYPE)
137
138#define K_SYS_SOC_TYPE_BCM1250 0x0
139#define K_SYS_SOC_TYPE_BCM1120 0x1
140#define K_SYS_SOC_TYPE_BCM1250_ALT 0x2 /* 1250pass2 w/ 1/4 L2. */
141#define K_SYS_SOC_TYPE_BCM1125 0x3
142#define K_SYS_SOC_TYPE_BCM1125H 0x4
143#define K_SYS_SOC_TYPE_BCM1250_ALT2 0x5 /* 1250pass2 w/ 1/2 L2. */
144#define K_SYS_SOC_TYPE_BCM1x80 0x6
145#define K_SYS_SOC_TYPE_BCM1x55 0x7
146
147/*
148 * Calculate correct SOC type given a copy of system revision register.
149 *
150 * (For the assembler version, sysrev and dest may be the same register.
151 * Also, it clobbers AT.)
152 */
153#ifdef __ASSEMBLER__
154#define SYS_SOC_TYPE(dest, sysrev) \
155 .set push ; \
156 .set reorder ; \
157 dsrl dest, sysrev, S_SYS_SOC_TYPE ; \
158 andi dest, dest, (M_SYS_SOC_TYPE >> S_SYS_SOC_TYPE); \
159 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT, 991f ; \
160 beq dest, K_SYS_SOC_TYPE_BCM1250_ALT2, 991f ; \
161 b 992f ; \
162991: li dest, K_SYS_SOC_TYPE_BCM1250 ; \
163992: \
164 .set pop
165#else
166#define SYS_SOC_TYPE(sysrev) \
167 ((G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT \
168 || G_SYS_SOC_TYPE(sysrev) == K_SYS_SOC_TYPE_BCM1250_ALT2) \
169 ? K_SYS_SOC_TYPE_BCM1250 : G_SYS_SOC_TYPE(sysrev))
170#endif
171
172#define S_SYS_WID _SB_MAKE64(32)
173#define M_SYS_WID _SB_MAKEMASK(32, S_SYS_WID)
174#define V_SYS_WID(x) _SB_MAKEVALUE(x, S_SYS_WID)
175#define G_SYS_WID(x) _SB_GETVALUE(x, S_SYS_WID, M_SYS_WID)
176
177/*
178 * System Manufacturing Register
179 * Register: SCD_SYSTEM_MANUF
180 */
181
182#if SIBYTE_HDR_FEATURE_1250_112x
183/* Wafer ID: bits 31:0 */
184#define S_SYS_WAFERID1_200 _SB_MAKE64(0)
185#define M_SYS_WAFERID1_200 _SB_MAKEMASK(32, S_SYS_WAFERID1_200)
186#define V_SYS_WAFERID1_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID1_200)
187#define G_SYS_WAFERID1_200(x) _SB_GETVALUE(x, S_SYS_WAFERID1_200, M_SYS_WAFERID1_200)
188
189#define S_SYS_BIN _SB_MAKE64(32)
190#define M_SYS_BIN _SB_MAKEMASK(4, S_SYS_BIN)
191#define V_SYS_BIN(x) _SB_MAKEVALUE(x, S_SYS_BIN)
192#define G_SYS_BIN(x) _SB_GETVALUE(x, S_SYS_BIN, M_SYS_BIN)
193
194/* Wafer ID: bits 39:36 */
195#define S_SYS_WAFERID2_200 _SB_MAKE64(36)
196#define M_SYS_WAFERID2_200 _SB_MAKEMASK(4, S_SYS_WAFERID2_200)
197#define V_SYS_WAFERID2_200(x) _SB_MAKEVALUE(x, S_SYS_WAFERID2_200)
198#define G_SYS_WAFERID2_200(x) _SB_GETVALUE(x, S_SYS_WAFERID2_200, M_SYS_WAFERID2_200)
199
200/* Wafer ID: bits 39:0 */
201#define S_SYS_WAFERID_300 _SB_MAKE64(0)
202#define M_SYS_WAFERID_300 _SB_MAKEMASK(40, S_SYS_WAFERID_300)
203#define V_SYS_WAFERID_300(x) _SB_MAKEVALUE(x, S_SYS_WAFERID_300)
204#define G_SYS_WAFERID_300(x) _SB_GETVALUE(x, S_SYS_WAFERID_300, M_SYS_WAFERID_300)
205
206#define S_SYS_XPOS _SB_MAKE64(40)
207#define M_SYS_XPOS _SB_MAKEMASK(6, S_SYS_XPOS)
208#define V_SYS_XPOS(x) _SB_MAKEVALUE(x, S_SYS_XPOS)
209#define G_SYS_XPOS(x) _SB_GETVALUE(x, S_SYS_XPOS, M_SYS_XPOS)
210
211#define S_SYS_YPOS _SB_MAKE64(46)
212#define M_SYS_YPOS _SB_MAKEMASK(6, S_SYS_YPOS)
213#define V_SYS_YPOS(x) _SB_MAKEVALUE(x, S_SYS_YPOS)
214#define G_SYS_YPOS(x) _SB_GETVALUE(x, S_SYS_YPOS, M_SYS_YPOS)
215#endif
216
217
218/*
219 * System Config Register (Table 4-2)
220 * Register: SCD_SYSTEM_CFG
221 */
222
223#if SIBYTE_HDR_FEATURE_1250_112x
224#define M_SYS_LDT_PLL_BYP _SB_MAKEMASK1(3)
225#define M_SYS_PCI_SYNC_TEST_MODE _SB_MAKEMASK1(4)
226#define M_SYS_IOB0_DIV _SB_MAKEMASK1(5)
227#define M_SYS_IOB1_DIV _SB_MAKEMASK1(6)
228
229#define S_SYS_PLL_DIV _SB_MAKE64(7)
230#define M_SYS_PLL_DIV _SB_MAKEMASK(5, S_SYS_PLL_DIV)
231#define V_SYS_PLL_DIV(x) _SB_MAKEVALUE(x, S_SYS_PLL_DIV)
232#define G_SYS_PLL_DIV(x) _SB_GETVALUE(x, S_SYS_PLL_DIV, M_SYS_PLL_DIV)
233
234#define M_SYS_SER0_ENABLE _SB_MAKEMASK1(12)
235#define M_SYS_SER0_RSTB_EN _SB_MAKEMASK1(13)
236#define M_SYS_SER1_ENABLE _SB_MAKEMASK1(14)
237#define M_SYS_SER1_RSTB_EN _SB_MAKEMASK1(15)
238#define M_SYS_PCMCIA_ENABLE _SB_MAKEMASK1(16)
239
240#define S_SYS_BOOT_MODE _SB_MAKE64(17)
241#define M_SYS_BOOT_MODE _SB_MAKEMASK(2, S_SYS_BOOT_MODE)
242#define V_SYS_BOOT_MODE(x) _SB_MAKEVALUE(x, S_SYS_BOOT_MODE)
243#define G_SYS_BOOT_MODE(x) _SB_GETVALUE(x, S_SYS_BOOT_MODE, M_SYS_BOOT_MODE)
244#define K_SYS_BOOT_MODE_ROM32 0
245#define K_SYS_BOOT_MODE_ROM8 1
246#define K_SYS_BOOT_MODE_SMBUS_SMALL 2
247#define K_SYS_BOOT_MODE_SMBUS_BIG 3
248
249#define M_SYS_PCI_HOST _SB_MAKEMASK1(19)
250#define M_SYS_PCI_ARBITER _SB_MAKEMASK1(20)
251#define M_SYS_SOUTH_ON_LDT _SB_MAKEMASK1(21)
252#define M_SYS_BIG_ENDIAN _SB_MAKEMASK1(22)
253#define M_SYS_GENCLK_EN _SB_MAKEMASK1(23)
254#define M_SYS_LDT_TEST_EN _SB_MAKEMASK1(24)
255#define M_SYS_GEN_PARITY_EN _SB_MAKEMASK1(25)
256
257#define S_SYS_CONFIG 26
258#define M_SYS_CONFIG _SB_MAKEMASK(6, S_SYS_CONFIG)
259#define V_SYS_CONFIG(x) _SB_MAKEVALUE(x, S_SYS_CONFIG)
260#define G_SYS_CONFIG(x) _SB_GETVALUE(x, S_SYS_CONFIG, M_SYS_CONFIG)
261
262/* The following bits are writeable by JTAG only. */
263
264#define M_SYS_CLKSTOP _SB_MAKEMASK1(32)
265#define M_SYS_CLKSTEP _SB_MAKEMASK1(33)
266
267#define S_SYS_CLKCOUNT 34
268#define M_SYS_CLKCOUNT _SB_MAKEMASK(8, S_SYS_CLKCOUNT)
269#define V_SYS_CLKCOUNT(x) _SB_MAKEVALUE(x, S_SYS_CLKCOUNT)
270#define G_SYS_CLKCOUNT(x) _SB_GETVALUE(x, S_SYS_CLKCOUNT, M_SYS_CLKCOUNT)
271
272#define M_SYS_PLL_BYPASS _SB_MAKEMASK1(42)
273
274#define S_SYS_PLL_IREF 43
275#define M_SYS_PLL_IREF _SB_MAKEMASK(2, S_SYS_PLL_IREF)
276
277#define S_SYS_PLL_VCO 45
278#define M_SYS_PLL_VCO _SB_MAKEMASK(2, S_SYS_PLL_VCO)
279
280#define S_SYS_PLL_VREG 47
281#define M_SYS_PLL_VREG _SB_MAKEMASK(2, S_SYS_PLL_VREG)
282
283#define M_SYS_MEM_RESET _SB_MAKEMASK1(49)
284#define M_SYS_L2C_RESET _SB_MAKEMASK1(50)
285#define M_SYS_IO_RESET_0 _SB_MAKEMASK1(51)
286#define M_SYS_IO_RESET_1 _SB_MAKEMASK1(52)
287#define M_SYS_SCD_RESET _SB_MAKEMASK1(53)
288
289/* End of bits writable by JTAG only. */
290
291#define M_SYS_CPU_RESET_0 _SB_MAKEMASK1(54)
292#define M_SYS_CPU_RESET_1 _SB_MAKEMASK1(55)
293
294#define M_SYS_UNICPU0 _SB_MAKEMASK1(56)
295#define M_SYS_UNICPU1 _SB_MAKEMASK1(57)
296
297#define M_SYS_SB_SOFTRES _SB_MAKEMASK1(58)
298#define M_SYS_EXT_RESET _SB_MAKEMASK1(59)
299#define M_SYS_SYSTEM_RESET _SB_MAKEMASK1(60)
300
301#define M_SYS_MISR_MODE _SB_MAKEMASK1(61)
302#define M_SYS_MISR_RESET _SB_MAKEMASK1(62)
303
304#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1)
305#define M_SYS_SW_FLAG _SB_MAKEMASK1(63)
306#endif /* 1250 PASS2 || 112x PASS1 */
307
308#endif
309
310
311/*
312 * Mailbox Registers (Table 4-3)
313 * Registers: SCD_MBOX_CPU_x
314 */
315
316#define S_MBOX_INT_3 0
317#define M_MBOX_INT_3 _SB_MAKEMASK(16, S_MBOX_INT_3)
318#define S_MBOX_INT_2 16
319#define M_MBOX_INT_2 _SB_MAKEMASK(16, S_MBOX_INT_2)
320#define S_MBOX_INT_1 32
321#define M_MBOX_INT_1 _SB_MAKEMASK(16, S_MBOX_INT_1)
322#define S_MBOX_INT_0 48
323#define M_MBOX_INT_0 _SB_MAKEMASK(16, S_MBOX_INT_0)
324
325/*
326 * Watchdog Registers (Table 4-8) (Table 4-9) (Table 4-10)
327 * Registers: SCD_WDOG_INIT_CNT_x
328 */
329
330#define V_SCD_WDOG_FREQ 1000000
331
332#define S_SCD_WDOG_INIT 0
333#define M_SCD_WDOG_INIT _SB_MAKEMASK(23, S_SCD_WDOG_INIT)
334
335#define S_SCD_WDOG_CNT 0
336#define M_SCD_WDOG_CNT _SB_MAKEMASK(23, S_SCD_WDOG_CNT)
337
338#define S_SCD_WDOG_ENABLE 0
339#define M_SCD_WDOG_ENABLE _SB_MAKEMASK1(S_SCD_WDOG_ENABLE)
340
341#define S_SCD_WDOG_RESET_TYPE 2
342#define M_SCD_WDOG_RESET_TYPE _SB_MAKEMASK(3, S_SCD_WDOG_RESET_TYPE)
343#define V_SCD_WDOG_RESET_TYPE(x) _SB_MAKEVALUE(x, S_SCD_WDOG_RESET_TYPE)
344#define G_SCD_WDOG_RESET_TYPE(x) _SB_GETVALUE(x, S_SCD_WDOG_RESET_TYPE, M_SCD_WDOG_RESET_TYPE)
345
346#define K_SCD_WDOG_RESET_FULL 0 /* actually, (x & 1) == 0 */
347#define K_SCD_WDOG_RESET_SOFT 1
348#define K_SCD_WDOG_RESET_CPU0 3
349#define K_SCD_WDOG_RESET_CPU1 5
350#define K_SCD_WDOG_RESET_BOTH_CPUS 7
351
352/* This feature is present in 1250 C0 and later, but *not* in 112x A revs. */
353#if SIBYTE_HDR_FEATURE(1250, PASS3)
354#define S_SCD_WDOG_HAS_RESET 8
355#define M_SCD_WDOG_HAS_RESET _SB_MAKEMASK1(S_SCD_WDOG_HAS_RESET)
356#endif
357
358
359/*
360 * Timer Registers (Table 4-11) (Table 4-12) (Table 4-13)
361 */
362
363#define V_SCD_TIMER_FREQ 1000000
364
365#define S_SCD_TIMER_INIT 0
366#define M_SCD_TIMER_INIT _SB_MAKEMASK(23, S_SCD_TIMER_INIT)
367#define V_SCD_TIMER_INIT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_INIT)
368#define G_SCD_TIMER_INIT(x) _SB_GETVALUE(x, S_SCD_TIMER_INIT, M_SCD_TIMER_INIT)
369
370#define V_SCD_TIMER_WIDTH 23
371#define S_SCD_TIMER_CNT 0
372#define M_SCD_TIMER_CNT _SB_MAKEMASK(V_SCD_TIMER_WIDTH, S_SCD_TIMER_CNT)
373#define V_SCD_TIMER_CNT(x) _SB_MAKEVALUE(x, S_SCD_TIMER_CNT)
374#define G_SCD_TIMER_CNT(x) _SB_GETVALUE(x, S_SCD_TIMER_CNT, M_SCD_TIMER_CNT)
375
376#define M_SCD_TIMER_ENABLE _SB_MAKEMASK1(0)
377#define M_SCD_TIMER_MODE _SB_MAKEMASK1(1)
378#define M_SCD_TIMER_MODE_CONTINUOUS M_SCD_TIMER_MODE
379
380/*
381 * System Performance Counters
382 */
383
384#define S_SPC_CFG_SRC0 0
385#define M_SPC_CFG_SRC0 _SB_MAKEMASK(8, S_SPC_CFG_SRC0)
386#define V_SPC_CFG_SRC0(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC0)
387#define G_SPC_CFG_SRC0(x) _SB_GETVALUE(x, S_SPC_CFG_SRC0, M_SPC_CFG_SRC0)
388
389#define S_SPC_CFG_SRC1 8
390#define M_SPC_CFG_SRC1 _SB_MAKEMASK(8, S_SPC_CFG_SRC1)
391#define V_SPC_CFG_SRC1(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC1)
392#define G_SPC_CFG_SRC1(x) _SB_GETVALUE(x, S_SPC_CFG_SRC1, M_SPC_CFG_SRC1)
393
394#define S_SPC_CFG_SRC2 16
395#define M_SPC_CFG_SRC2 _SB_MAKEMASK(8, S_SPC_CFG_SRC2)
396#define V_SPC_CFG_SRC2(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC2)
397#define G_SPC_CFG_SRC2(x) _SB_GETVALUE(x, S_SPC_CFG_SRC2, M_SPC_CFG_SRC2)
398
399#define S_SPC_CFG_SRC3 24
400#define M_SPC_CFG_SRC3 _SB_MAKEMASK(8, S_SPC_CFG_SRC3)
401#define V_SPC_CFG_SRC3(x) _SB_MAKEVALUE(x, S_SPC_CFG_SRC3)
402#define G_SPC_CFG_SRC3(x) _SB_GETVALUE(x, S_SPC_CFG_SRC3, M_SPC_CFG_SRC3)
403
404#if SIBYTE_HDR_FEATURE_1250_112x
405#define M_SPC_CFG_CLEAR _SB_MAKEMASK1(32)
406#define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
407#endif
408
409
410/*
411 * Bus Watcher
412 */
413
414#define S_SCD_BERR_TID 8
415#define M_SCD_BERR_TID _SB_MAKEMASK(10, S_SCD_BERR_TID)
416#define V_SCD_BERR_TID(x) _SB_MAKEVALUE(x, S_SCD_BERR_TID)
417#define G_SCD_BERR_TID(x) _SB_GETVALUE(x, S_SCD_BERR_TID, M_SCD_BERR_TID)
418
419#define S_SCD_BERR_RID 18
420#define M_SCD_BERR_RID _SB_MAKEMASK(4, S_SCD_BERR_RID)
421#define V_SCD_BERR_RID(x) _SB_MAKEVALUE(x, S_SCD_BERR_RID)
422#define G_SCD_BERR_RID(x) _SB_GETVALUE(x, S_SCD_BERR_RID, M_SCD_BERR_RID)
423
424#define S_SCD_BERR_DCODE 22
425#define M_SCD_BERR_DCODE _SB_MAKEMASK(3, S_SCD_BERR_DCODE)
426#define V_SCD_BERR_DCODE(x) _SB_MAKEVALUE(x, S_SCD_BERR_DCODE)
427#define G_SCD_BERR_DCODE(x) _SB_GETVALUE(x, S_SCD_BERR_DCODE, M_SCD_BERR_DCODE)
428
429#define M_SCD_BERR_MULTERRS _SB_MAKEMASK1(30)
430
431
432#define S_SCD_L2ECC_CORR_D 0
433#define M_SCD_L2ECC_CORR_D _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_D)
434#define V_SCD_L2ECC_CORR_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_D)
435#define G_SCD_L2ECC_CORR_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_D, M_SCD_L2ECC_CORR_D)
436
437#define S_SCD_L2ECC_BAD_D 8
438#define M_SCD_L2ECC_BAD_D _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_D)
439#define V_SCD_L2ECC_BAD_D(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_D)
440#define G_SCD_L2ECC_BAD_D(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_D, M_SCD_L2ECC_BAD_D)
441
442#define S_SCD_L2ECC_CORR_T 16
443#define M_SCD_L2ECC_CORR_T _SB_MAKEMASK(8, S_SCD_L2ECC_CORR_T)
444#define V_SCD_L2ECC_CORR_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_CORR_T)
445#define G_SCD_L2ECC_CORR_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_CORR_T, M_SCD_L2ECC_CORR_T)
446
447#define S_SCD_L2ECC_BAD_T 24
448#define M_SCD_L2ECC_BAD_T _SB_MAKEMASK(8, S_SCD_L2ECC_BAD_T)
449#define V_SCD_L2ECC_BAD_T(x) _SB_MAKEVALUE(x, S_SCD_L2ECC_BAD_T)
450#define G_SCD_L2ECC_BAD_T(x) _SB_GETVALUE(x, S_SCD_L2ECC_BAD_T, M_SCD_L2ECC_BAD_T)
451
452#define S_SCD_MEM_ECC_CORR 0
453#define M_SCD_MEM_ECC_CORR _SB_MAKEMASK(8, S_SCD_MEM_ECC_CORR)
454#define V_SCD_MEM_ECC_CORR(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_CORR)
455#define G_SCD_MEM_ECC_CORR(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_CORR, M_SCD_MEM_ECC_CORR)
456
457#define S_SCD_MEM_ECC_BAD 8
458#define M_SCD_MEM_ECC_BAD _SB_MAKEMASK(8, S_SCD_MEM_ECC_BAD)
459#define V_SCD_MEM_ECC_BAD(x) _SB_MAKEVALUE(x, S_SCD_MEM_ECC_BAD)
460#define G_SCD_MEM_ECC_BAD(x) _SB_GETVALUE(x, S_SCD_MEM_ECC_BAD, M_SCD_MEM_ECC_BAD)
461
462#define S_SCD_MEM_BUSERR 16
463#define M_SCD_MEM_BUSERR _SB_MAKEMASK(8, S_SCD_MEM_BUSERR)
464#define V_SCD_MEM_BUSERR(x) _SB_MAKEVALUE(x, S_SCD_MEM_BUSERR)
465#define G_SCD_MEM_BUSERR(x) _SB_GETVALUE(x, S_SCD_MEM_BUSERR, M_SCD_MEM_BUSERR)
466
467
468/*
469 * Address Trap Registers
470 */
471
472#if SIBYTE_HDR_FEATURE_1250_112x
473#define M_ATRAP_INDEX _SB_MAKEMASK(4, 0)
474#define M_ATRAP_ADDRESS _SB_MAKEMASK(40, 0)
475
476#define S_ATRAP_CFG_CNT 0
477#define M_ATRAP_CFG_CNT _SB_MAKEMASK(3, S_ATRAP_CFG_CNT)
478#define V_ATRAP_CFG_CNT(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CNT)
479#define G_ATRAP_CFG_CNT(x) _SB_GETVALUE(x, S_ATRAP_CFG_CNT, M_ATRAP_CFG_CNT)
480
481#define M_ATRAP_CFG_WRITE _SB_MAKEMASK1(3)
482#define M_ATRAP_CFG_ALL _SB_MAKEMASK1(4)
483#define M_ATRAP_CFG_INV _SB_MAKEMASK1(5)
484#define M_ATRAP_CFG_USESRC _SB_MAKEMASK1(6)
485#define M_ATRAP_CFG_SRCINV _SB_MAKEMASK1(7)
486
487#define S_ATRAP_CFG_AGENTID 8
488#define M_ATRAP_CFG_AGENTID _SB_MAKEMASK(4, S_ATRAP_CFG_AGENTID)
489#define V_ATRAP_CFG_AGENTID(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_AGENTID)
490#define G_ATRAP_CFG_AGENTID(x) _SB_GETVALUE(x, S_ATRAP_CFG_AGENTID, M_ATRAP_CFG_AGENTID)
491
492#define K_BUS_AGENT_CPU0 0
493#define K_BUS_AGENT_CPU1 1
494#define K_BUS_AGENT_IOB0 2
495#define K_BUS_AGENT_IOB1 3
496#define K_BUS_AGENT_SCD 4
497#define K_BUS_AGENT_L2C 6
498#define K_BUS_AGENT_MC 7
499
500#define S_ATRAP_CFG_CATTR 12
501#define M_ATRAP_CFG_CATTR _SB_MAKEMASK(3, S_ATRAP_CFG_CATTR)
502#define V_ATRAP_CFG_CATTR(x) _SB_MAKEVALUE(x, S_ATRAP_CFG_CATTR)
503#define G_ATRAP_CFG_CATTR(x) _SB_GETVALUE(x, S_ATRAP_CFG_CATTR, M_ATRAP_CFG_CATTR)
504
505#define K_ATRAP_CFG_CATTR_IGNORE 0
506#define K_ATRAP_CFG_CATTR_UNC 1
507#define K_ATRAP_CFG_CATTR_CACHEABLE 2
508#define K_ATRAP_CFG_CATTR_NONCOH 3
509#define K_ATRAP_CFG_CATTR_COHERENT 4
510#define K_ATRAP_CFG_CATTR_NOTUNC 5
511#define K_ATRAP_CFG_CATTR_NOTNONCOH 6
512#define K_ATRAP_CFG_CATTR_NOTCOHERENT 7
513
514#endif /* 1250/112x */
515
516/*
517 * Trace Buffer Config register
518 */
519
520#define M_SCD_TRACE_CFG_RESET _SB_MAKEMASK1(0)
521#define M_SCD_TRACE_CFG_START_READ _SB_MAKEMASK1(1)
522#define M_SCD_TRACE_CFG_START _SB_MAKEMASK1(2)
523#define M_SCD_TRACE_CFG_STOP _SB_MAKEMASK1(3)
524#define M_SCD_TRACE_CFG_FREEZE _SB_MAKEMASK1(4)
525#define M_SCD_TRACE_CFG_FREEZE_FULL _SB_MAKEMASK1(5)
526#define M_SCD_TRACE_CFG_DEBUG_FULL _SB_MAKEMASK1(6)
527#define M_SCD_TRACE_CFG_FULL _SB_MAKEMASK1(7)
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)
530#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
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
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
544#define M_SCD_TRACE_CFG_CUR_ADDR _SB_MAKEMASK(8, S_SCD_TRACE_CFG_CUR_ADDR)
545#define V_SCD_TRACE_CFG_CUR_ADDR(x) _SB_MAKEVALUE(x, S_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)
547
548/*
549 * Trace Event registers
550 */
551
552#define S_SCD_TREVT_ADDR_MATCH 0
553#define M_SCD_TREVT_ADDR_MATCH _SB_MAKEMASK(4, S_SCD_TREVT_ADDR_MATCH)
554#define V_SCD_TREVT_ADDR_MATCH(x) _SB_MAKEVALUE(x, S_SCD_TREVT_ADDR_MATCH)
555#define G_SCD_TREVT_ADDR_MATCH(x) _SB_GETVALUE(x, S_SCD_TREVT_ADDR_MATCH, M_SCD_TREVT_ADDR_MATCH)
556
557#define M_SCD_TREVT_REQID_MATCH _SB_MAKEMASK1(4)
558#define M_SCD_TREVT_DATAID_MATCH _SB_MAKEMASK1(5)
559#define M_SCD_TREVT_RESPID_MATCH _SB_MAKEMASK1(6)
560#define M_SCD_TREVT_INTERRUPT _SB_MAKEMASK1(7)
561#define M_SCD_TREVT_DEBUG_PIN _SB_MAKEMASK1(9)
562#define M_SCD_TREVT_WRITE _SB_MAKEMASK1(10)
563#define M_SCD_TREVT_READ _SB_MAKEMASK1(11)
564
565#define S_SCD_TREVT_REQID 12
566#define M_SCD_TREVT_REQID _SB_MAKEMASK(4, S_SCD_TREVT_REQID)
567#define V_SCD_TREVT_REQID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_REQID)
568#define G_SCD_TREVT_REQID(x) _SB_GETVALUE(x, S_SCD_TREVT_REQID, M_SCD_TREVT_REQID)
569
570#define S_SCD_TREVT_RESPID 16
571#define M_SCD_TREVT_RESPID _SB_MAKEMASK(4, S_SCD_TREVT_RESPID)
572#define V_SCD_TREVT_RESPID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_RESPID)
573#define G_SCD_TREVT_RESPID(x) _SB_GETVALUE(x, S_SCD_TREVT_RESPID, M_SCD_TREVT_RESPID)
574
575#define S_SCD_TREVT_DATAID 20
576#define M_SCD_TREVT_DATAID _SB_MAKEMASK(4, S_SCD_TREVT_DATAID)
577#define V_SCD_TREVT_DATAID(x) _SB_MAKEVALUE(x, S_SCD_TREVT_DATAID)
578#define G_SCD_TREVT_DATAID(x) _SB_GETVALUE(x, S_SCD_TREVT_DATAID, M_SCD_TREVT_DATID)
579
580#define S_SCD_TREVT_COUNT 24
581#define M_SCD_TREVT_COUNT _SB_MAKEMASK(8, S_SCD_TREVT_COUNT)
582#define V_SCD_TREVT_COUNT(x) _SB_MAKEVALUE(x, S_SCD_TREVT_COUNT)
583#define G_SCD_TREVT_COUNT(x) _SB_GETVALUE(x, S_SCD_TREVT_COUNT, M_SCD_TREVT_COUNT)
584
585/*
586 * Trace Sequence registers
587 */
588
589#define S_SCD_TRSEQ_EVENT4 0
590#define M_SCD_TRSEQ_EVENT4 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT4)
591#define V_SCD_TRSEQ_EVENT4(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT4)
592#define G_SCD_TRSEQ_EVENT4(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT4, M_SCD_TRSEQ_EVENT4)
593
594#define S_SCD_TRSEQ_EVENT3 4
595#define M_SCD_TRSEQ_EVENT3 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT3)
596#define V_SCD_TRSEQ_EVENT3(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT3)
597#define G_SCD_TRSEQ_EVENT3(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT3, M_SCD_TRSEQ_EVENT3)
598
599#define S_SCD_TRSEQ_EVENT2 8
600#define M_SCD_TRSEQ_EVENT2 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT2)
601#define V_SCD_TRSEQ_EVENT2(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT2)
602#define G_SCD_TRSEQ_EVENT2(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT2, M_SCD_TRSEQ_EVENT2)
603
604#define S_SCD_TRSEQ_EVENT1 12
605#define M_SCD_TRSEQ_EVENT1 _SB_MAKEMASK(4, S_SCD_TRSEQ_EVENT1)
606#define V_SCD_TRSEQ_EVENT1(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_EVENT1)
607#define G_SCD_TRSEQ_EVENT1(x) _SB_GETVALUE(x, S_SCD_TRSEQ_EVENT1, M_SCD_TRSEQ_EVENT1)
608
609#define K_SCD_TRSEQ_E0 0
610#define K_SCD_TRSEQ_E1 1
611#define K_SCD_TRSEQ_E2 2
612#define K_SCD_TRSEQ_E3 3
613#define K_SCD_TRSEQ_E0_E1 4
614#define K_SCD_TRSEQ_E1_E2 5
615#define K_SCD_TRSEQ_E2_E3 6
616#define K_SCD_TRSEQ_E0_E1_E2 7
617#define K_SCD_TRSEQ_E0_E1_E2_E3 8
618#define K_SCD_TRSEQ_E0E1 9
619#define K_SCD_TRSEQ_E0E1E2 10
620#define K_SCD_TRSEQ_E0E1E2E3 11
621#define K_SCD_TRSEQ_E0E1_E2 12
622#define K_SCD_TRSEQ_E0E1_E2E3 13
623#define K_SCD_TRSEQ_E0E1_E2_E3 14
624#define K_SCD_TRSEQ_IGNORED 15
625
626#define K_SCD_TRSEQ_TRIGGER_ALL (V_SCD_TRSEQ_EVENT1(K_SCD_TRSEQ_IGNORED) | \
627 V_SCD_TRSEQ_EVENT2(K_SCD_TRSEQ_IGNORED) | \
628 V_SCD_TRSEQ_EVENT3(K_SCD_TRSEQ_IGNORED) | \
629 V_SCD_TRSEQ_EVENT4(K_SCD_TRSEQ_IGNORED))
630
631#define S_SCD_TRSEQ_FUNCTION 16
632#define M_SCD_TRSEQ_FUNCTION _SB_MAKEMASK(4, S_SCD_TRSEQ_FUNCTION)
633#define V_SCD_TRSEQ_FUNCTION(x) _SB_MAKEVALUE(x, S_SCD_TRSEQ_FUNCTION)
634#define G_SCD_TRSEQ_FUNCTION(x) _SB_GETVALUE(x, S_SCD_TRSEQ_FUNCTION, M_SCD_TRSEQ_FUNCTION)
635
636#define K_SCD_TRSEQ_FUNC_NOP 0
637#define K_SCD_TRSEQ_FUNC_START 1
638#define K_SCD_TRSEQ_FUNC_STOP 2
639#define K_SCD_TRSEQ_FUNC_FREEZE 3
640
641#define V_SCD_TRSEQ_FUNC_NOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_NOP)
642#define V_SCD_TRSEQ_FUNC_START V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_START)
643#define V_SCD_TRSEQ_FUNC_STOP V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_STOP)
644#define V_SCD_TRSEQ_FUNC_FREEZE V_SCD_TRSEQ_FUNCTION(K_SCD_TRSEQ_FUNC_FREEZE)
645
646#define M_SCD_TRSEQ_ASAMPLE _SB_MAKEMASK1(18)
647#define M_SCD_TRSEQ_DSAMPLE _SB_MAKEMASK1(19)
648#define M_SCD_TRSEQ_DEBUGPIN _SB_MAKEMASK1(20)
649#define M_SCD_TRSEQ_DEBUGCPU _SB_MAKEMASK1(21)
650#define M_SCD_TRSEQ_CLEARUSE _SB_MAKEMASK1(22)
651#define M_SCD_TRSEQ_ALLD_A _SB_MAKEMASK1(23)
652#define M_SCD_TRSEQ_ALL_A _SB_MAKEMASK1(24)
653
654#endif
diff --git a/include/asm-mips/sibyte/sb1250_smbus.h b/include/asm-mips/sibyte/sb1250_smbus.h
deleted file mode 100644
index 04769923cf1e..000000000000
--- a/include/asm-mips/sibyte/sb1250_smbus.h
+++ /dev/null
@@ -1,204 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * SMBUS Constants File: sb1250_smbus.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's SMbus devices.
8 *
9 * SB1250 specification level: 10/21/02
10 * BCM1280 specification level: 11/24/03
11 *
12 *********************************************************************
13 *
14 * Copyright 2000,2001,2002,2003
15 * Broadcom Corporation. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 ********************************************************************* */
32
33
34#ifndef _SB1250_SMBUS_H
35#define _SB1250_SMBUS_H
36
37#include "sb1250_defs.h"
38
39/*
40 * SMBus Clock Frequency Register (Table 14-2)
41 */
42
43#define S_SMB_FREQ_DIV 0
44#define M_SMB_FREQ_DIV _SB_MAKEMASK(13, S_SMB_FREQ_DIV)
45#define V_SMB_FREQ_DIV(x) _SB_MAKEVALUE(x, S_SMB_FREQ_DIV)
46
47#define K_SMB_FREQ_400KHZ 0x1F
48#define K_SMB_FREQ_100KHZ 0x7D
49#define K_SMB_FREQ_10KHZ 1250
50
51#define S_SMB_CMD 0
52#define M_SMB_CMD _SB_MAKEMASK(8, S_SMB_CMD)
53#define V_SMB_CMD(x) _SB_MAKEVALUE(x, S_SMB_CMD)
54
55/*
56 * SMBus control register (Table 14-4)
57 */
58
59#define M_SMB_ERR_INTR _SB_MAKEMASK1(0)
60#define M_SMB_FINISH_INTR _SB_MAKEMASK1(1)
61
62#define S_SMB_DATA_OUT 4
63#define M_SMB_DATA_OUT _SB_MAKEMASK1(S_SMB_DATA_OUT)
64#define V_SMB_DATA_OUT(x) _SB_MAKEVALUE(x, S_SMB_DATA_OUT)
65
66#define M_SMB_DATA_DIR _SB_MAKEMASK1(5)
67#define M_SMB_DATA_DIR_OUTPUT M_SMB_DATA_DIR
68#define M_SMB_CLK_OUT _SB_MAKEMASK1(6)
69#define M_SMB_DIRECT_ENABLE _SB_MAKEMASK1(7)
70
71/*
72 * SMBus status registers (Table 14-5)
73 */
74
75#define M_SMB_BUSY _SB_MAKEMASK1(0)
76#define M_SMB_ERROR _SB_MAKEMASK1(1)
77#define M_SMB_ERROR_TYPE _SB_MAKEMASK1(2)
78
79#if SIBYTE_HDR_FEATURE(1250, PASS3) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
80#define S_SMB_SCL_IN 5
81#define M_SMB_SCL_IN _SB_MAKEMASK1(S_SMB_SCL_IN)
82#define V_SMB_SCL_IN(x) _SB_MAKEVALUE(x, S_SMB_SCL_IN)
83#define G_SMB_SCL_IN(x) _SB_GETVALUE(x, S_SMB_SCL_IN, M_SMB_SCL_IN)
84#endif /* 1250 PASS3 || 112x PASS1 || 1480 */
85
86#define S_SMB_REF 6
87#define M_SMB_REF _SB_MAKEMASK1(S_SMB_REF)
88#define V_SMB_REF(x) _SB_MAKEVALUE(x, S_SMB_REF)
89#define G_SMB_REF(x) _SB_GETVALUE(x, S_SMB_REF, M_SMB_REF)
90
91#define S_SMB_DATA_IN 7
92#define M_SMB_DATA_IN _SB_MAKEMASK1(S_SMB_DATA_IN)
93#define V_SMB_DATA_IN(x) _SB_MAKEVALUE(x, S_SMB_DATA_IN)
94#define G_SMB_DATA_IN(x) _SB_GETVALUE(x, S_SMB_DATA_IN, M_SMB_DATA_IN)
95
96/*
97 * SMBus Start/Command registers (Table 14-9)
98 */
99
100#define S_SMB_ADDR 0
101#define M_SMB_ADDR _SB_MAKEMASK(7, S_SMB_ADDR)
102#define V_SMB_ADDR(x) _SB_MAKEVALUE(x, S_SMB_ADDR)
103#define G_SMB_ADDR(x) _SB_GETVALUE(x, S_SMB_ADDR, M_SMB_ADDR)
104
105#define M_SMB_QDATA _SB_MAKEMASK1(7)
106
107#define S_SMB_TT 8
108#define M_SMB_TT _SB_MAKEMASK(3, S_SMB_TT)
109#define V_SMB_TT(x) _SB_MAKEVALUE(x, S_SMB_TT)
110#define G_SMB_TT(x) _SB_GETVALUE(x, S_SMB_TT, M_SMB_TT)
111
112#define K_SMB_TT_WR1BYTE 0
113#define K_SMB_TT_WR2BYTE 1
114#define K_SMB_TT_WR3BYTE 2
115#define K_SMB_TT_CMD_RD1BYTE 3
116#define K_SMB_TT_CMD_RD2BYTE 4
117#define K_SMB_TT_RD1BYTE 5
118#define K_SMB_TT_QUICKCMD 6
119#define K_SMB_TT_EEPROMREAD 7
120
121#define V_SMB_TT_WR1BYTE V_SMB_TT(K_SMB_TT_WR1BYTE)
122#define V_SMB_TT_WR2BYTE V_SMB_TT(K_SMB_TT_WR2BYTE)
123#define V_SMB_TT_WR3BYTE V_SMB_TT(K_SMB_TT_WR3BYTE)
124#define V_SMB_TT_CMD_RD1BYTE V_SMB_TT(K_SMB_TT_CMD_RD1BYTE)
125#define V_SMB_TT_CMD_RD2BYTE V_SMB_TT(K_SMB_TT_CMD_RD2BYTE)
126#define V_SMB_TT_RD1BYTE V_SMB_TT(K_SMB_TT_RD1BYTE)
127#define V_SMB_TT_QUICKCMD V_SMB_TT(K_SMB_TT_QUICKCMD)
128#define V_SMB_TT_EEPROMREAD V_SMB_TT(K_SMB_TT_EEPROMREAD)
129
130#define M_SMB_PEC _SB_MAKEMASK1(15)
131
132/*
133 * SMBus Data Register (Table 14-6) and SMBus Extra Register (Table 14-7)
134 */
135
136#define S_SMB_LB 0
137#define M_SMB_LB _SB_MAKEMASK(8, S_SMB_LB)
138#define V_SMB_LB(x) _SB_MAKEVALUE(x, S_SMB_LB)
139
140#define S_SMB_MB 8
141#define M_SMB_MB _SB_MAKEMASK(8, S_SMB_MB)
142#define V_SMB_MB(x) _SB_MAKEVALUE(x, S_SMB_MB)
143
144
145/*
146 * SMBus Packet Error Check register (Table 14-8)
147 */
148
149#define S_SPEC_PEC 0
150#define M_SPEC_PEC _SB_MAKEMASK(8, S_SPEC_PEC)
151#define V_SPEC_MB(x) _SB_MAKEVALUE(x, S_SPEC_PEC)
152
153
154#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
155
156#define S_SMB_CMDH 8
157#define M_SMB_CMDH _SB_MAKEMASK(8, S_SMB_CMDH)
158#define V_SMB_CMDH(x) _SB_MAKEVALUE(x, S_SMB_CMDH)
159
160#define M_SMB_EXTEND _SB_MAKEMASK1(14)
161
162#define S_SMB_DFMT 8
163#define M_SMB_DFMT _SB_MAKEMASK(3, S_SMB_DFMT)
164#define V_SMB_DFMT(x) _SB_MAKEVALUE(x, S_SMB_DFMT)
165#define G_SMB_DFMT(x) _SB_GETVALUE(x, S_SMB_DFMT, M_SMB_DFMT)
166
167#define K_SMB_DFMT_1BYTE 0
168#define K_SMB_DFMT_2BYTE 1
169#define K_SMB_DFMT_3BYTE 2
170#define K_SMB_DFMT_4BYTE 3
171#define K_SMB_DFMT_NODATA 4
172#define K_SMB_DFMT_CMD4BYTE 5
173#define K_SMB_DFMT_CMD5BYTE 6
174#define K_SMB_DFMT_RESERVED 7
175
176#define V_SMB_DFMT_1BYTE V_SMB_DFMT(K_SMB_DFMT_1BYTE)
177#define V_SMB_DFMT_2BYTE V_SMB_DFMT(K_SMB_DFMT_2BYTE)
178#define V_SMB_DFMT_3BYTE V_SMB_DFMT(K_SMB_DFMT_3BYTE)
179#define V_SMB_DFMT_4BYTE V_SMB_DFMT(K_SMB_DFMT_4BYTE)
180#define V_SMB_DFMT_NODATA V_SMB_DFMT(K_SMB_DFMT_NODATA)
181#define V_SMB_DFMT_CMD4BYTE V_SMB_DFMT(K_SMB_DFMT_CMD4BYTE)
182#define V_SMB_DFMT_CMD5BYTE V_SMB_DFMT(K_SMB_DFMT_CMD5BYTE)
183#define V_SMB_DFMT_RESERVED V_SMB_DFMT(K_SMB_DFMT_RESERVED)
184
185#define S_SMB_AFMT 11
186#define M_SMB_AFMT _SB_MAKEMASK(2, S_SMB_AFMT)
187#define V_SMB_AFMT(x) _SB_MAKEVALUE(x, S_SMB_AFMT)
188#define G_SMB_AFMT(x) _SB_GETVALUE(x, S_SMB_AFMT, M_SMB_AFMT)
189
190#define K_SMB_AFMT_NONE 0
191#define K_SMB_AFMT_ADDR 1
192#define K_SMB_AFMT_ADDR_CMD1BYTE 2
193#define K_SMB_AFMT_ADDR_CMD2BYTE 3
194
195#define V_SMB_AFMT_NONE V_SMB_AFMT(K_SMB_AFMT_NONE)
196#define V_SMB_AFMT_ADDR V_SMB_AFMT(K_SMB_AFMT_ADDR)
197#define V_SMB_AFMT_ADDR_CMD1BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD1BYTE)
198#define V_SMB_AFMT_ADDR_CMD2BYTE V_SMB_AFMT(K_SMB_AFMT_ADDR_CMD2BYTE)
199
200#define M_SMB_DIR _SB_MAKEMASK1(13)
201
202#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
203
204#endif
diff --git a/include/asm-mips/sibyte/sb1250_syncser.h b/include/asm-mips/sibyte/sb1250_syncser.h
deleted file mode 100644
index d4b8558e0bf1..000000000000
--- a/include/asm-mips/sibyte/sb1250_syncser.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * Synchronous Serial Constants File: sb1250_syncser.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's Synchronous Serial
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_SYNCSER_H
34#define _SB1250_SYNCSER_H
35
36#include "sb1250_defs.h"
37
38/*
39 * Serial Mode Configuration Register
40 */
41
42#define M_SYNCSER_CRC_MODE _SB_MAKEMASK1(0)
43#define M_SYNCSER_MSB_FIRST _SB_MAKEMASK1(1)
44
45#define S_SYNCSER_FLAG_NUM 2
46#define M_SYNCSER_FLAG_NUM _SB_MAKEMASK(4, S_SYNCSER_FLAG_NUM)
47#define V_SYNCSER_FLAG_NUM _SB_MAKEVALUE(x, S_SYNCSER_FLAG_NUM)
48
49#define M_SYNCSER_FLAG_EN _SB_MAKEMASK1(6)
50#define M_SYNCSER_HDLC_EN _SB_MAKEMASK1(7)
51#define M_SYNCSER_LOOP_MODE _SB_MAKEMASK1(8)
52#define M_SYNCSER_LOOPBACK _SB_MAKEMASK1(9)
53
54/*
55 * Serial Clock Source and Line Interface Mode Register
56 */
57
58#define M_SYNCSER_RXCLK_INV _SB_MAKEMASK1(0)
59#define M_SYNCSER_RXCLK_EXT _SB_MAKEMASK1(1)
60
61#define S_SYNCSER_RXSYNC_DLY 2
62#define M_SYNCSER_RXSYNC_DLY _SB_MAKEMASK(2, S_SYNCSER_RXSYNC_DLY)
63#define V_SYNCSER_RXSYNC_DLY(x) _SB_MAKEVALUE(x, S_SYNCSER_RXSYNC_DLY)
64
65#define M_SYNCSER_RXSYNC_LOW _SB_MAKEMASK1(4)
66#define M_SYNCSER_RXSTRB_LOW _SB_MAKEMASK1(5)
67
68#define M_SYNCSER_RXSYNC_EDGE _SB_MAKEMASK1(6)
69#define M_SYNCSER_RXSYNC_INT _SB_MAKEMASK1(7)
70
71#define M_SYNCSER_TXCLK_INV _SB_MAKEMASK1(8)
72#define M_SYNCSER_TXCLK_EXT _SB_MAKEMASK1(9)
73
74#define S_SYNCSER_TXSYNC_DLY 10
75#define M_SYNCSER_TXSYNC_DLY _SB_MAKEMASK(2, S_SYNCSER_TXSYNC_DLY)
76#define V_SYNCSER_TXSYNC_DLY(x) _SB_MAKEVALUE(x, S_SYNCSER_TXSYNC_DLY)
77
78#define M_SYNCSER_TXSYNC_LOW _SB_MAKEMASK1(12)
79#define M_SYNCSER_TXSTRB_LOW _SB_MAKEMASK1(13)
80
81#define M_SYNCSER_TXSYNC_EDGE _SB_MAKEMASK1(14)
82#define M_SYNCSER_TXSYNC_INT _SB_MAKEMASK1(15)
83
84/*
85 * Serial Command Register
86 */
87
88#define M_SYNCSER_CMD_RX_EN _SB_MAKEMASK1(0)
89#define M_SYNCSER_CMD_TX_EN _SB_MAKEMASK1(1)
90#define M_SYNCSER_CMD_RX_RESET _SB_MAKEMASK1(2)
91#define M_SYNCSER_CMD_TX_RESET _SB_MAKEMASK1(3)
92#define M_SYNCSER_CMD_TX_PAUSE _SB_MAKEMASK1(5)
93
94/*
95 * Serial DMA Enable Register
96 */
97
98#define M_SYNCSER_DMA_RX_EN _SB_MAKEMASK1(0)
99#define M_SYNCSER_DMA_TX_EN _SB_MAKEMASK1(4)
100
101/*
102 * Serial Status Register
103 */
104
105#define M_SYNCSER_RX_CRCERR _SB_MAKEMASK1(0)
106#define M_SYNCSER_RX_ABORT _SB_MAKEMASK1(1)
107#define M_SYNCSER_RX_OCTET _SB_MAKEMASK1(2)
108#define M_SYNCSER_RX_LONGFRM _SB_MAKEMASK1(3)
109#define M_SYNCSER_RX_SHORTFRM _SB_MAKEMASK1(4)
110#define M_SYNCSER_RX_OVERRUN _SB_MAKEMASK1(5)
111#define M_SYNCSER_RX_SYNC_ERR _SB_MAKEMASK1(6)
112#define M_SYNCSER_TX_CRCERR _SB_MAKEMASK1(8)
113#define M_SYNCSER_TX_UNDERRUN _SB_MAKEMASK1(9)
114#define M_SYNCSER_TX_SYNC_ERR _SB_MAKEMASK1(10)
115#define M_SYNCSER_TX_PAUSE_COMPLETE _SB_MAKEMASK1(11)
116#define M_SYNCSER_RX_EOP_COUNT _SB_MAKEMASK1(16)
117#define M_SYNCSER_RX_EOP_TIMER _SB_MAKEMASK1(17)
118#define M_SYNCSER_RX_EOP_SEEN _SB_MAKEMASK1(18)
119#define M_SYNCSER_RX_HWM _SB_MAKEMASK1(19)
120#define M_SYNCSER_RX_LWM _SB_MAKEMASK1(20)
121#define M_SYNCSER_RX_DSCR _SB_MAKEMASK1(21)
122#define M_SYNCSER_RX_DERR _SB_MAKEMASK1(22)
123#define M_SYNCSER_TX_EOP_COUNT _SB_MAKEMASK1(24)
124#define M_SYNCSER_TX_EOP_TIMER _SB_MAKEMASK1(25)
125#define M_SYNCSER_TX_EOP_SEEN _SB_MAKEMASK1(26)
126#define M_SYNCSER_TX_HWM _SB_MAKEMASK1(27)
127#define M_SYNCSER_TX_LWM _SB_MAKEMASK1(28)
128#define M_SYNCSER_TX_DSCR _SB_MAKEMASK1(29)
129#define M_SYNCSER_TX_DERR _SB_MAKEMASK1(30)
130#define M_SYNCSER_TX_DZERO _SB_MAKEMASK1(31)
131
132/*
133 * Sequencer Table Entry format
134 */
135
136#define M_SYNCSER_SEQ_LAST _SB_MAKEMASK1(0)
137#define M_SYNCSER_SEQ_BYTE _SB_MAKEMASK1(1)
138
139#define S_SYNCSER_SEQ_COUNT 2
140#define M_SYNCSER_SEQ_COUNT _SB_MAKEMASK(4, S_SYNCSER_SEQ_COUNT)
141#define V_SYNCSER_SEQ_COUNT(x) _SB_MAKEVALUE(x, S_SYNCSER_SEQ_COUNT)
142
143#define M_SYNCSER_SEQ_ENABLE _SB_MAKEMASK1(6)
144#define M_SYNCSER_SEQ_STROBE _SB_MAKEMASK1(7)
145
146#endif
diff --git a/include/asm-mips/sibyte/sb1250_uart.h b/include/asm-mips/sibyte/sb1250_uart.h
deleted file mode 100644
index d835bf280140..000000000000
--- a/include/asm-mips/sibyte/sb1250_uart.h
+++ /dev/null
@@ -1,362 +0,0 @@
1/* *********************************************************************
2 * SB1250 Board Support Package
3 *
4 * UART Constants File: sb1250_uart.h
5 *
6 * This module contains constants and macros useful for
7 * manipulating the SB1250's UARTs
8 *
9 * SB1250 specification level: User's manual 1/02/02
10 *
11 *********************************************************************
12 *
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 ********************************************************************* */
31
32
33#ifndef _SB1250_UART_H
34#define _SB1250_UART_H
35
36#include "sb1250_defs.h"
37
38/* **********************************************************************
39 * DUART Registers
40 ********************************************************************** */
41
42/*
43 * DUART Mode Register #1 (Table 10-3)
44 * Register: DUART_MODE_REG_1_A
45 * Register: DUART_MODE_REG_1_B
46 */
47
48#define S_DUART_BITS_PER_CHAR 0
49#define M_DUART_BITS_PER_CHAR _SB_MAKEMASK(2, S_DUART_BITS_PER_CHAR)
50#define V_DUART_BITS_PER_CHAR(x) _SB_MAKEVALUE(x, S_DUART_BITS_PER_CHAR)
51
52#define K_DUART_BITS_PER_CHAR_RSV0 0
53#define K_DUART_BITS_PER_CHAR_RSV1 1
54#define K_DUART_BITS_PER_CHAR_7 2
55#define K_DUART_BITS_PER_CHAR_8 3
56
57#define V_DUART_BITS_PER_CHAR_RSV0 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV0)
58#define V_DUART_BITS_PER_CHAR_RSV1 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV1)
59#define V_DUART_BITS_PER_CHAR_7 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_7)
60#define V_DUART_BITS_PER_CHAR_8 V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_8)
61
62
63#define M_DUART_PARITY_TYPE_EVEN 0x00
64#define M_DUART_PARITY_TYPE_ODD _SB_MAKEMASK1(2)
65
66#define S_DUART_PARITY_MODE 3
67#define M_DUART_PARITY_MODE _SB_MAKEMASK(2, S_DUART_PARITY_MODE)
68#define V_DUART_PARITY_MODE(x) _SB_MAKEVALUE(x, S_DUART_PARITY_MODE)
69
70#define K_DUART_PARITY_MODE_ADD 0
71#define K_DUART_PARITY_MODE_ADD_FIXED 1
72#define K_DUART_PARITY_MODE_NONE 2
73
74#define V_DUART_PARITY_MODE_ADD V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD)
75#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED)
76#define V_DUART_PARITY_MODE_NONE V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE)
77
78#define M_DUART_TX_IRQ_SEL_TXRDY 0
79#define M_DUART_TX_IRQ_SEL_TXEMPT _SB_MAKEMASK1(5)
80
81#define M_DUART_RX_IRQ_SEL_RXRDY 0
82#define M_DUART_RX_IRQ_SEL_RXFULL _SB_MAKEMASK1(6)
83
84#define M_DUART_RX_RTS_ENA _SB_MAKEMASK1(7)
85
86/*
87 * DUART Mode Register #2 (Table 10-4)
88 * Register: DUART_MODE_REG_2_A
89 * Register: DUART_MODE_REG_2_B
90 */
91
92#define M_DUART_MODE_RESERVED1 _SB_MAKEMASK(3, 0) /* ignored */
93
94#define M_DUART_STOP_BIT_LEN_2 _SB_MAKEMASK1(3)
95#define M_DUART_STOP_BIT_LEN_1 0
96
97#define M_DUART_TX_CTS_ENA _SB_MAKEMASK1(4)
98
99
100#define M_DUART_MODE_RESERVED2 _SB_MAKEMASK1(5) /* must be zero */
101
102#define S_DUART_CHAN_MODE 6
103#define M_DUART_CHAN_MODE _SB_MAKEMASK(2, S_DUART_CHAN_MODE)
104#define V_DUART_CHAN_MODE(x) _SB_MAKEVALUE(x, S_DUART_CHAN_MODE)
105
106#define K_DUART_CHAN_MODE_NORMAL 0
107#define K_DUART_CHAN_MODE_LCL_LOOP 2
108#define K_DUART_CHAN_MODE_REM_LOOP 3
109
110#define V_DUART_CHAN_MODE_NORMAL V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_NORMAL)
111#define V_DUART_CHAN_MODE_LCL_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_LCL_LOOP)
112#define V_DUART_CHAN_MODE_REM_LOOP V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_REM_LOOP)
113
114/*
115 * DUART Command Register (Table 10-5)
116 * Register: DUART_CMD_A
117 * Register: DUART_CMD_B
118 */
119
120#define M_DUART_RX_EN _SB_MAKEMASK1(0)
121#define M_DUART_RX_DIS _SB_MAKEMASK1(1)
122#define M_DUART_TX_EN _SB_MAKEMASK1(2)
123#define M_DUART_TX_DIS _SB_MAKEMASK1(3)
124
125#define S_DUART_MISC_CMD 4
126#define M_DUART_MISC_CMD _SB_MAKEMASK(3, S_DUART_MISC_CMD)
127#define V_DUART_MISC_CMD(x) _SB_MAKEVALUE(x, S_DUART_MISC_CMD)
128
129#define K_DUART_MISC_CMD_NOACTION0 0
130#define K_DUART_MISC_CMD_NOACTION1 1
131#define K_DUART_MISC_CMD_RESET_RX 2
132#define K_DUART_MISC_CMD_RESET_TX 3
133#define K_DUART_MISC_CMD_NOACTION4 4
134#define K_DUART_MISC_CMD_RESET_BREAK_INT 5
135#define K_DUART_MISC_CMD_START_BREAK 6
136#define K_DUART_MISC_CMD_STOP_BREAK 7
137
138#define V_DUART_MISC_CMD_NOACTION0 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION0)
139#define V_DUART_MISC_CMD_NOACTION1 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION1)
140#define V_DUART_MISC_CMD_RESET_RX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_RX)
141#define V_DUART_MISC_CMD_RESET_TX V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_TX)
142#define V_DUART_MISC_CMD_NOACTION4 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION4)
143#define V_DUART_MISC_CMD_RESET_BREAK_INT V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_BREAK_INT)
144#define V_DUART_MISC_CMD_START_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK)
145#define V_DUART_MISC_CMD_STOP_BREAK V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK)
146
147#define M_DUART_CMD_RESERVED _SB_MAKEMASK1(7)
148
149/*
150 * DUART Status Register (Table 10-6)
151 * Register: DUART_STATUS_A
152 * Register: DUART_STATUS_B
153 * READ-ONLY
154 */
155
156#define M_DUART_RX_RDY _SB_MAKEMASK1(0)
157#define M_DUART_RX_FFUL _SB_MAKEMASK1(1)
158#define M_DUART_TX_RDY _SB_MAKEMASK1(2)
159#define M_DUART_TX_EMT _SB_MAKEMASK1(3)
160#define M_DUART_OVRUN_ERR _SB_MAKEMASK1(4)
161#define M_DUART_PARITY_ERR _SB_MAKEMASK1(5)
162#define M_DUART_FRM_ERR _SB_MAKEMASK1(6)
163#define M_DUART_RCVD_BRK _SB_MAKEMASK1(7)
164
165/*
166 * DUART Baud Rate Register (Table 10-7)
167 * Register: DUART_CLK_SEL_A
168 * Register: DUART_CLK_SEL_B
169 */
170
171#define M_DUART_CLK_COUNTER _SB_MAKEMASK(12, 0)
172#define V_DUART_BAUD_RATE(x) (100000000/((x)*20)-1)
173
174/*
175 * DUART Data Registers (Table 10-8 and 10-9)
176 * Register: DUART_RX_HOLD_A
177 * Register: DUART_RX_HOLD_B
178 * Register: DUART_TX_HOLD_A
179 * Register: DUART_TX_HOLD_B
180 */
181
182#define M_DUART_RX_DATA _SB_MAKEMASK(8, 0)
183#define M_DUART_TX_DATA _SB_MAKEMASK(8, 0)
184
185/*
186 * DUART Input Port Register (Table 10-10)
187 * Register: DUART_IN_PORT
188 */
189
190#define M_DUART_IN_PIN0_VAL _SB_MAKEMASK1(0)
191#define M_DUART_IN_PIN1_VAL _SB_MAKEMASK1(1)
192#define M_DUART_IN_PIN2_VAL _SB_MAKEMASK1(2)
193#define M_DUART_IN_PIN3_VAL _SB_MAKEMASK1(3)
194#define M_DUART_IN_PIN4_VAL _SB_MAKEMASK1(4)
195#define M_DUART_IN_PIN5_VAL _SB_MAKEMASK1(5)
196#define M_DUART_RIN0_PIN _SB_MAKEMASK1(6)
197#define M_DUART_RIN1_PIN _SB_MAKEMASK1(7)
198
199/*
200 * DUART Input Port Change Status Register (Tables 10-11, 10-12, and 10-13)
201 * Register: DUART_INPORT_CHNG
202 */
203
204#define S_DUART_IN_PIN_VAL 0
205#define M_DUART_IN_PIN_VAL _SB_MAKEMASK(4, S_DUART_IN_PIN_VAL)
206
207#define S_DUART_IN_PIN_CHNG 4
208#define M_DUART_IN_PIN_CHNG _SB_MAKEMASK(4, S_DUART_IN_PIN_CHNG)
209
210
211/*
212 * DUART Output port control register (Table 10-14)
213 * Register: DUART_OPCR
214 */
215
216#define M_DUART_OPCR_RESERVED0 _SB_MAKEMASK1(0) /* must be zero */
217#define M_DUART_OPC2_SEL _SB_MAKEMASK1(1)
218#define M_DUART_OPCR_RESERVED1 _SB_MAKEMASK1(2) /* must be zero */
219#define M_DUART_OPC3_SEL _SB_MAKEMASK1(3)
220#define M_DUART_OPCR_RESERVED2 _SB_MAKEMASK(4, 4) /* must be zero */
221
222/*
223 * DUART Aux Control Register (Table 10-15)
224 * Register: DUART_AUX_CTRL
225 */
226
227#define M_DUART_IP0_CHNG_ENA _SB_MAKEMASK1(0)
228#define M_DUART_IP1_CHNG_ENA _SB_MAKEMASK1(1)
229#define M_DUART_IP2_CHNG_ENA _SB_MAKEMASK1(2)
230#define M_DUART_IP3_CHNG_ENA _SB_MAKEMASK1(3)
231#define M_DUART_ACR_RESERVED _SB_MAKEMASK(4, 4)
232
233#define M_DUART_CTS_CHNG_ENA _SB_MAKEMASK1(0)
234#define M_DUART_CIN_CHNG_ENA _SB_MAKEMASK1(2)
235
236/*
237 * DUART Interrupt Status Register (Table 10-16)
238 * Register: DUART_ISR
239 */
240
241#define M_DUART_ISR_TX_A _SB_MAKEMASK1(0)
242
243#define S_DUART_ISR_RX_A 1
244#define M_DUART_ISR_RX_A _SB_MAKEMASK1(S_DUART_ISR_RX_A)
245#define V_DUART_ISR_RX_A(x) _SB_MAKEVALUE(x, S_DUART_ISR_RX_A)
246#define G_DUART_ISR_RX_A(x) _SB_GETVALUE(x, S_DUART_ISR_RX_A, M_DUART_ISR_RX_A)
247
248#define M_DUART_ISR_BRK_A _SB_MAKEMASK1(2)
249#define M_DUART_ISR_IN_A _SB_MAKEMASK1(3)
250#define M_DUART_ISR_ALL_A _SB_MAKEMASK(4, 0)
251
252#define M_DUART_ISR_TX_B _SB_MAKEMASK1(4)
253#define M_DUART_ISR_RX_B _SB_MAKEMASK1(5)
254#define M_DUART_ISR_BRK_B _SB_MAKEMASK1(6)
255#define M_DUART_ISR_IN_B _SB_MAKEMASK1(7)
256#define M_DUART_ISR_ALL_B _SB_MAKEMASK(4, 4)
257
258/*
259 * DUART Channel A Interrupt Status Register (Table 10-17)
260 * DUART Channel B Interrupt Status Register (Table 10-18)
261 * Register: DUART_ISR_A
262 * Register: DUART_ISR_B
263 */
264
265#define M_DUART_ISR_TX _SB_MAKEMASK1(0)
266#define M_DUART_ISR_RX _SB_MAKEMASK1(1)
267#define M_DUART_ISR_BRK _SB_MAKEMASK1(2)
268#define M_DUART_ISR_IN _SB_MAKEMASK1(3)
269#define M_DUART_ISR_ALL _SB_MAKEMASK(4, 0)
270#define M_DUART_ISR_RESERVED _SB_MAKEMASK(4, 4)
271
272/*
273 * DUART Interrupt Mask Register (Table 10-19)
274 * Register: DUART_IMR
275 */
276
277#define M_DUART_IMR_TX_A _SB_MAKEMASK1(0)
278#define M_DUART_IMR_RX_A _SB_MAKEMASK1(1)
279#define M_DUART_IMR_BRK_A _SB_MAKEMASK1(2)
280#define M_DUART_IMR_IN_A _SB_MAKEMASK1(3)
281#define M_DUART_IMR_ALL_A _SB_MAKEMASK(4, 0)
282
283#define M_DUART_IMR_TX_B _SB_MAKEMASK1(4)
284#define M_DUART_IMR_RX_B _SB_MAKEMASK1(5)
285#define M_DUART_IMR_BRK_B _SB_MAKEMASK1(6)
286#define M_DUART_IMR_IN_B _SB_MAKEMASK1(7)
287#define M_DUART_IMR_ALL_B _SB_MAKEMASK(4, 4)
288
289/*
290 * DUART Channel A Interrupt Mask Register (Table 10-20)
291 * DUART Channel B Interrupt Mask Register (Table 10-21)
292 * Register: DUART_IMR_A
293 * Register: DUART_IMR_B
294 */
295
296#define M_DUART_IMR_TX _SB_MAKEMASK1(0)
297#define M_DUART_IMR_RX _SB_MAKEMASK1(1)
298#define M_DUART_IMR_BRK _SB_MAKEMASK1(2)
299#define M_DUART_IMR_IN _SB_MAKEMASK1(3)
300#define M_DUART_IMR_ALL _SB_MAKEMASK(4, 0)
301#define M_DUART_IMR_RESERVED _SB_MAKEMASK(4, 4)
302
303
304/*
305 * DUART Output Port Set Register (Table 10-22)
306 * Register: DUART_SET_OPR
307 */
308
309#define M_DUART_SET_OPR0 _SB_MAKEMASK1(0)
310#define M_DUART_SET_OPR1 _SB_MAKEMASK1(1)
311#define M_DUART_SET_OPR2 _SB_MAKEMASK1(2)
312#define M_DUART_SET_OPR3 _SB_MAKEMASK1(3)
313#define M_DUART_OPSR_RESERVED _SB_MAKEMASK(4, 4)
314
315/*
316 * DUART Output Port Clear Register (Table 10-23)
317 * Register: DUART_CLEAR_OPR
318 */
319
320#define M_DUART_CLR_OPR0 _SB_MAKEMASK1(0)
321#define M_DUART_CLR_OPR1 _SB_MAKEMASK1(1)
322#define M_DUART_CLR_OPR2 _SB_MAKEMASK1(2)
323#define M_DUART_CLR_OPR3 _SB_MAKEMASK1(3)
324#define M_DUART_OPCR_RESERVED _SB_MAKEMASK(4, 4)
325
326/*
327 * DUART Output Port RTS Register (Table 10-24)
328 * Register: DUART_OUT_PORT
329 */
330
331#define M_DUART_OUT_PIN_SET0 _SB_MAKEMASK1(0)
332#define M_DUART_OUT_PIN_SET1 _SB_MAKEMASK1(1)
333#define M_DUART_OUT_PIN_CLR0 _SB_MAKEMASK1(2)
334#define M_DUART_OUT_PIN_CLR1 _SB_MAKEMASK1(3)
335#define M_DUART_OPRR_RESERVED _SB_MAKEMASK(4, 4)
336
337#define M_DUART_OUT_PIN_SET(chan) \
338 (chan == 0 ? M_DUART_OUT_PIN_SET0 : M_DUART_OUT_PIN_SET1)
339#define M_DUART_OUT_PIN_CLR(chan) \
340 (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
341
342#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
343/*
344 * Full Interrupt Control Register
345 */
346
347#define S_DUART_SIG_FULL _SB_MAKE64(0)
348#define M_DUART_SIG_FULL _SB_MAKEMASK(4, S_DUART_SIG_FULL)
349#define V_DUART_SIG_FULL(x) _SB_MAKEVALUE(x, S_DUART_SIG_FULL)
350#define G_DUART_SIG_FULL(x) _SB_GETVALUE(x, S_DUART_SIG_FULL, M_DUART_SIG_FULL)
351
352#define S_DUART_INT_TIME _SB_MAKE64(4)
353#define M_DUART_INT_TIME _SB_MAKEMASK(4, S_DUART_INT_TIME)
354#define V_DUART_INT_TIME(x) _SB_MAKEVALUE(x, S_DUART_INT_TIME)
355#define G_DUART_INT_TIME(x) _SB_GETVALUE(x, S_DUART_INT_TIME, M_DUART_INT_TIME)
356#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
357
358
359/* ********************************************************************** */
360
361
362#endif
diff --git a/include/asm-mips/sibyte/sentosa.h b/include/asm-mips/sibyte/sentosa.h
deleted file mode 100644
index 64c47874f32d..000000000000
--- a/include/asm-mips/sibyte/sentosa.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * Copyright (C) 2000, 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#ifndef __ASM_SIBYTE_SENTOSA_H
19#define __ASM_SIBYTE_SENTOSA_H
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/sb1250_int.h>
23
24#ifdef CONFIG_SIBYTE_SENTOSA
25#define SIBYTE_BOARD_NAME "BCM91250E (Sentosa)"
26#endif
27#ifdef CONFIG_SIBYTE_RHONE
28#define SIBYTE_BOARD_NAME "BCM91125E (Rhone)"
29#endif
30
31/* Generic bus chip selects */
32#ifdef CONFIG_SIBYTE_RHONE
33#define LEDS_CS 6
34#define LEDS_PHYS 0x1d0a0000
35#endif
36
37/* GPIOs */
38#define K_GPIO_DBG_LED 0
39
40#endif /* __ASM_SIBYTE_SENTOSA_H */
diff --git a/include/asm-mips/sibyte/swarm.h b/include/asm-mips/sibyte/swarm.h
deleted file mode 100644
index 114d9d29ca9d..000000000000
--- a/include/asm-mips/sibyte/swarm.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#ifndef __ASM_SIBYTE_SWARM_H
19#define __ASM_SIBYTE_SWARM_H
20
21#include <asm/sibyte/sb1250.h>
22#include <asm/sibyte/sb1250_int.h>
23
24#ifdef CONFIG_SIBYTE_SWARM
25#define SIBYTE_BOARD_NAME "BCM91250A (SWARM)"
26#define SIBYTE_HAVE_PCMCIA 1
27#define SIBYTE_HAVE_IDE 1
28#endif
29#ifdef CONFIG_SIBYTE_LITTLESUR
30#define SIBYTE_BOARD_NAME "BCM91250C2 (LittleSur)"
31#define SIBYTE_HAVE_PCMCIA 0
32#define SIBYTE_HAVE_IDE 1
33#define SIBYTE_DEFAULT_CONSOLE "cfe0"
34#endif
35#ifdef CONFIG_SIBYTE_CRHONE
36#define SIBYTE_BOARD_NAME "BCM91125C (CRhone)"
37#define SIBYTE_HAVE_PCMCIA 0
38#define SIBYTE_HAVE_IDE 0
39#endif
40#ifdef CONFIG_SIBYTE_CRHINE
41#define SIBYTE_BOARD_NAME "BCM91120C (CRhine)"
42#define SIBYTE_HAVE_PCMCIA 0
43#define SIBYTE_HAVE_IDE 0
44#endif
45
46/* Generic bus chip selects */
47#define LEDS_CS 3
48#define LEDS_PHYS 0x100a0000
49
50#ifdef SIBYTE_HAVE_IDE
51#define IDE_CS 4
52#define IDE_PHYS 0x100b0000
53#define K_GPIO_GB_IDE 4
54#define K_INT_GB_IDE (K_INT_GPIO_0 + K_GPIO_GB_IDE)
55#endif
56
57#ifdef SIBYTE_HAVE_PCMCIA
58#define PCMCIA_CS 6
59#define PCMCIA_PHYS 0x11000000
60#define K_GPIO_PC_READY 9
61#define K_INT_PC_READY (K_INT_GPIO_0 + K_GPIO_PC_READY)
62#endif
63
64#endif /* __ASM_SIBYTE_SWARM_H */
diff --git a/include/asm-mips/sigcontext.h b/include/asm-mips/sigcontext.h
deleted file mode 100644
index 9ce0607d7a4e..000000000000
--- a/include/asm-mips/sigcontext.h
+++ /dev/null
@@ -1,100 +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) 1996, 1997, 1999 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGCONTEXT_H
10#define _ASM_SIGCONTEXT_H
11
12#include <asm/sgidefs.h>
13
14#if _MIPS_SIM == _MIPS_SIM_ABI32
15
16/*
17 * Keep this struct definition in sync with the sigcontext fragment
18 * in arch/mips/tools/offset.c
19 */
20struct sigcontext {
21 unsigned int sc_regmask; /* Unused */
22 unsigned int sc_status; /* Unused */
23 unsigned long long sc_pc;
24 unsigned long long sc_regs[32];
25 unsigned long long sc_fpregs[32];
26 unsigned int sc_acx; /* Was sc_ownedfp */
27 unsigned int sc_fpc_csr;
28 unsigned int sc_fpc_eir; /* Unused */
29 unsigned int sc_used_math;
30 unsigned int sc_dsp; /* dsp status, was sc_ssflags */
31 unsigned long long sc_mdhi;
32 unsigned long long sc_mdlo;
33 unsigned long sc_hi1; /* Was sc_cause */
34 unsigned long sc_lo1; /* Was sc_badvaddr */
35 unsigned long sc_hi2; /* Was sc_sigset[4] */
36 unsigned long sc_lo2;
37 unsigned long sc_hi3;
38 unsigned long sc_lo3;
39};
40
41#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
42
43#if _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32
44
45#include <linux/posix_types.h>
46/*
47 * Keep this struct definition in sync with the sigcontext fragment
48 * in arch/mips/tools/offset.c
49 *
50 * Warning: this structure illdefined with sc_badvaddr being just an unsigned
51 * int so it was changed to unsigned long in 2.6.0-test1. This may break
52 * binary compatibility - no prisoners.
53 * DSP ASE in 2.6.12-rc4. Turn sc_mdhi and sc_mdlo into an array of four
54 * entries, add sc_dsp and sc_reserved for padding. No prisoners.
55 */
56struct sigcontext {
57 __u64 sc_regs[32];
58 __u64 sc_fpregs[32];
59 __u64 sc_mdhi;
60 __u64 sc_hi1;
61 __u64 sc_hi2;
62 __u64 sc_hi3;
63 __u64 sc_mdlo;
64 __u64 sc_lo1;
65 __u64 sc_lo2;
66 __u64 sc_lo3;
67 __u64 sc_pc;
68 __u32 sc_fpc_csr;
69 __u32 sc_used_math;
70 __u32 sc_dsp;
71 __u32 sc_reserved;
72};
73
74#ifdef __KERNEL__
75
76struct sigcontext32 {
77 __u32 sc_regmask; /* Unused */
78 __u32 sc_status; /* Unused */
79 __u64 sc_pc;
80 __u64 sc_regs[32];
81 __u64 sc_fpregs[32];
82 __u32 sc_acx; /* Only MIPS32; was sc_ownedfp */
83 __u32 sc_fpc_csr;
84 __u32 sc_fpc_eir; /* Unused */
85 __u32 sc_used_math;
86 __u32 sc_dsp; /* dsp status, was sc_ssflags */
87 __u64 sc_mdhi;
88 __u64 sc_mdlo;
89 __u32 sc_hi1; /* Was sc_cause */
90 __u32 sc_lo1; /* Was sc_badvaddr */
91 __u32 sc_hi2; /* Was sc_sigset[4] */
92 __u32 sc_lo2;
93 __u32 sc_hi3;
94 __u32 sc_lo3;
95};
96#endif /* __KERNEL__ */
97
98#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 */
99
100#endif /* _ASM_SIGCONTEXT_H */
diff --git a/include/asm-mips/siginfo.h b/include/asm-mips/siginfo.h
deleted file mode 100644
index 96e28f18dad1..000000000000
--- a/include/asm-mips/siginfo.h
+++ /dev/null
@@ -1,130 +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) 1998, 1999, 2001, 2003 Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGINFO_H
10#define _ASM_SIGINFO_H
11
12
13#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
14#undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
15
16#define HAVE_ARCH_SIGINFO_T
17
18/*
19 * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
20 * by design ...
21 */
22#define HAVE_ARCH_COPY_SIGINFO
23struct siginfo;
24
25/*
26 * Careful to keep union _sifields from shifting ...
27 */
28#ifdef CONFIG_32BIT
29#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
30#endif
31#ifdef CONFIG_64BIT
32#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
33#endif
34
35#include <asm-generic/siginfo.h>
36
37typedef struct siginfo {
38 int si_signo;
39 int si_code;
40 int si_errno;
41 int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
42
43 union {
44 int _pad[SI_PAD_SIZE];
45
46 /* kill() */
47 struct {
48 pid_t _pid; /* sender's pid */
49 __ARCH_SI_UID_T _uid; /* sender's uid */
50 } _kill;
51
52 /* POSIX.1b timers */
53 struct {
54 timer_t _tid; /* timer id */
55 int _overrun; /* overrun count */
56 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
57 sigval_t _sigval; /* same as below */
58 int _sys_private; /* not to be passed to user */
59 } _timer;
60
61 /* POSIX.1b signals */
62 struct {
63 pid_t _pid; /* sender's pid */
64 __ARCH_SI_UID_T _uid; /* sender's uid */
65 sigval_t _sigval;
66 } _rt;
67
68 /* SIGCHLD */
69 struct {
70 pid_t _pid; /* which child */
71 __ARCH_SI_UID_T _uid; /* sender's uid */
72 int _status; /* exit code */
73 clock_t _utime;
74 clock_t _stime;
75 } _sigchld;
76
77 /* IRIX SIGCHLD */
78 struct {
79 pid_t _pid; /* which child */
80 clock_t _utime;
81 int _status; /* exit code */
82 clock_t _stime;
83 } _irix_sigchld;
84
85 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
86 struct {
87 void __user *_addr; /* faulting insn/memory ref. */
88#ifdef __ARCH_SI_TRAPNO
89 int _trapno; /* TRAP # which caused the signal */
90#endif
91 } _sigfault;
92
93 /* SIGPOLL, SIGXFSZ (To do ...) */
94 struct {
95 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
96 int _fd;
97 } _sigpoll;
98 } _sifields;
99} siginfo_t;
100
101/*
102 * si_code values
103 * Again these have been choosen to be IRIX compatible.
104 */
105#undef SI_ASYNCIO
106#undef SI_TIMER
107#undef SI_MESGQ
108#define SI_ASYNCIO -2 /* sent by AIO completion */
109#define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */
110#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */
111
112#ifdef __KERNEL__
113
114/*
115 * Duplicated here because of <asm-generic/siginfo.h> braindamage ...
116 */
117#include <linux/string.h>
118
119static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
120{
121 if (from->si_code < 0)
122 memcpy(to, from, sizeof(*to));
123 else
124 /* _sigchld is currently the largest know union member */
125 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
126}
127
128#endif
129
130#endif /* _ASM_SIGINFO_H */
diff --git a/include/asm-mips/signal.h b/include/asm-mips/signal.h
deleted file mode 100644
index bee5153aca48..000000000000
--- a/include/asm-mips/signal.h
+++ /dev/null
@@ -1,139 +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) 1995, 96, 97, 98, 99, 2003 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIGNAL_H
10#define _ASM_SIGNAL_H
11
12#include <linux/types.h>
13
14#define _NSIG 128
15#define _NSIG_BPW (sizeof(unsigned long) * 8)
16#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
17
18typedef struct {
19 unsigned long sig[_NSIG_WORDS];
20} sigset_t;
21
22typedef unsigned long old_sigset_t; /* at least 32 bits */
23
24#define SIGHUP 1 /* Hangup (POSIX). */
25#define SIGINT 2 /* Interrupt (ANSI). */
26#define SIGQUIT 3 /* Quit (POSIX). */
27#define SIGILL 4 /* Illegal instruction (ANSI). */
28#define SIGTRAP 5 /* Trace trap (POSIX). */
29#define SIGIOT 6 /* IOT trap (4.2 BSD). */
30#define SIGABRT SIGIOT /* Abort (ANSI). */
31#define SIGEMT 7
32#define SIGFPE 8 /* Floating-point exception (ANSI). */
33#define SIGKILL 9 /* Kill, unblockable (POSIX). */
34#define SIGBUS 10 /* BUS error (4.2 BSD). */
35#define SIGSEGV 11 /* Segmentation violation (ANSI). */
36#define SIGSYS 12
37#define SIGPIPE 13 /* Broken pipe (POSIX). */
38#define SIGALRM 14 /* Alarm clock (POSIX). */
39#define SIGTERM 15 /* Termination (ANSI). */
40#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */
41#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */
42#define SIGCHLD 18 /* Child status has changed (POSIX). */
43#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */
44#define SIGPWR 19 /* Power failure restart (System V). */
45#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
46#define SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
47#define SIGIO 22 /* I/O now possible (4.2 BSD). */
48#define SIGPOLL SIGIO /* Pollable event occurred (System V). */
49#define SIGSTOP 23 /* Stop, unblockable (POSIX). */
50#define SIGTSTP 24 /* Keyboard stop (POSIX). */
51#define SIGCONT 25 /* Continue (POSIX). */
52#define SIGTTIN 26 /* Background read from tty (POSIX). */
53#define SIGTTOU 27 /* Background write to tty (POSIX). */
54#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
55#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
56#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
57#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
58
59/* These should not be considered constants from userland. */
60#define SIGRTMIN 32
61#define SIGRTMAX _NSIG
62
63/*
64 * SA_FLAGS values:
65 *
66 * SA_ONSTACK indicates that a registered stack_t will be used.
67 * SA_RESTART flag to get restarting signals (which were the default long ago)
68 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
69 * SA_RESETHAND clears the handler when the signal is delivered.
70 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
71 * SA_NODEFER prevents the current signal from being masked in the handler.
72 *
73 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
74 * Unix names RESETHAND and NODEFER respectively.
75 */
76#define SA_ONSTACK 0x08000000
77#define SA_RESETHAND 0x80000000
78#define SA_RESTART 0x10000000
79#define SA_SIGINFO 0x00000008
80#define SA_NODEFER 0x40000000
81#define SA_NOCLDWAIT 0x00010000
82#define SA_NOCLDSTOP 0x00000001
83
84#define SA_NOMASK SA_NODEFER
85#define SA_ONESHOT SA_RESETHAND
86
87#define SA_RESTORER 0x04000000 /* Only for o32 */
88
89/*
90 * sigaltstack controls
91 */
92#define SS_ONSTACK 1
93#define SS_DISABLE 2
94
95#define MINSIGSTKSZ 2048
96#define SIGSTKSZ 8192
97
98#ifdef __KERNEL__
99
100#ifdef CONFIG_TRAD_SIGNALS
101#define sig_uses_siginfo(ka) ((ka)->sa.sa_flags & SA_SIGINFO)
102#else
103#define sig_uses_siginfo(ka) (1)
104#endif
105
106#endif /* __KERNEL__ */
107
108#define SIG_BLOCK 1 /* for blocking signals */
109#define SIG_UNBLOCK 2 /* for unblocking signals */
110#define SIG_SETMASK 3 /* for setting the signal mask */
111
112#include <asm-generic/signal.h>
113
114struct sigaction {
115 unsigned int sa_flags;
116 __sighandler_t sa_handler;
117 sigset_t sa_mask;
118};
119
120struct k_sigaction {
121 struct sigaction sa;
122};
123
124/* IRIX compatible stack_t */
125typedef struct sigaltstack {
126 void __user *ss_sp;
127 size_t ss_size;
128 int ss_flags;
129} stack_t;
130
131#ifdef __KERNEL__
132#include <asm/sigcontext.h>
133#include <asm/siginfo.h>
134
135#define ptrace_signal_deliver(regs, cookie) do { } while (0)
136
137#endif /* __KERNEL__ */
138
139#endif /* _ASM_SIGNAL_H */
diff --git a/include/asm-mips/sim.h b/include/asm-mips/sim.h
deleted file mode 100644
index 0cd719fabb51..000000000000
--- a/include/asm-mips/sim.h
+++ /dev/null
@@ -1,82 +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) 1999, 2000, 2003 Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SIM_H
10#define _ASM_SIM_H
11
12
13#include <asm/asm-offsets.h>
14
15#define __str2(x) #x
16#define __str(x) __str2(x)
17
18#ifdef CONFIG_32BIT
19
20#define save_static_function(symbol) \
21__asm__( \
22 ".text\n\t" \
23 ".globl\t" #symbol "\n\t" \
24 ".align\t2\n\t" \
25 ".type\t" #symbol ", @function\n\t" \
26 ".ent\t" #symbol ", 0\n" \
27 #symbol":\n\t" \
28 ".frame\t$29, 0, $31\n\t" \
29 "sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
30 "sw\t$17,"__str(PT_R17)"($29)\n\t" \
31 "sw\t$18,"__str(PT_R18)"($29)\n\t" \
32 "sw\t$19,"__str(PT_R19)"($29)\n\t" \
33 "sw\t$20,"__str(PT_R20)"($29)\n\t" \
34 "sw\t$21,"__str(PT_R21)"($29)\n\t" \
35 "sw\t$22,"__str(PT_R22)"($29)\n\t" \
36 "sw\t$23,"__str(PT_R23)"($29)\n\t" \
37 "sw\t$30,"__str(PT_R30)"($29)\n\t" \
38 "j\t_" #symbol "\n\t" \
39 ".end\t" #symbol "\n\t" \
40 ".size\t" #symbol",. - " #symbol)
41
42#define nabi_no_regargs
43
44#endif /* CONFIG_32BIT */
45
46#ifdef CONFIG_64BIT
47
48#define save_static_function(symbol) \
49__asm__( \
50 ".text\n\t" \
51 ".globl\t" #symbol "\n\t" \
52 ".align\t2\n\t" \
53 ".type\t" #symbol ", @function\n\t" \
54 ".ent\t" #symbol ", 0\n" \
55 #symbol":\n\t" \
56 ".frame\t$29, 0, $31\n\t" \
57 "sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t" \
58 "sd\t$17,"__str(PT_R17)"($29)\n\t" \
59 "sd\t$18,"__str(PT_R18)"($29)\n\t" \
60 "sd\t$19,"__str(PT_R19)"($29)\n\t" \
61 "sd\t$20,"__str(PT_R20)"($29)\n\t" \
62 "sd\t$21,"__str(PT_R21)"($29)\n\t" \
63 "sd\t$22,"__str(PT_R22)"($29)\n\t" \
64 "sd\t$23,"__str(PT_R23)"($29)\n\t" \
65 "sd\t$30,"__str(PT_R30)"($29)\n\t" \
66 "j\t_" #symbol "\n\t" \
67 ".end\t" #symbol "\n\t" \
68 ".size\t" #symbol",. - " #symbol)
69
70#define nabi_no_regargs \
71 unsigned long __dummy0, \
72 unsigned long __dummy1, \
73 unsigned long __dummy2, \
74 unsigned long __dummy3, \
75 unsigned long __dummy4, \
76 unsigned long __dummy5, \
77 unsigned long __dummy6, \
78 unsigned long __dummy7,
79
80#endif /* CONFIG_64BIT */
81
82#endif /* _ASM_SIM_H */
diff --git a/include/asm-mips/smp-ops.h b/include/asm-mips/smp-ops.h
deleted file mode 100644
index 43c207e72a63..000000000000
--- a/include/asm-mips/smp-ops.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
10 */
11#ifndef __ASM_SMP_OPS_H
12#define __ASM_SMP_OPS_H
13
14#ifdef CONFIG_SMP
15
16#include <linux/cpumask.h>
17
18struct plat_smp_ops {
19 void (*send_ipi_single)(int cpu, unsigned int action);
20 void (*send_ipi_mask)(cpumask_t mask, unsigned int action);
21 void (*init_secondary)(void);
22 void (*smp_finish)(void);
23 void (*cpus_done)(void);
24 void (*boot_secondary)(int cpu, struct task_struct *idle);
25 void (*smp_setup)(void);
26 void (*prepare_cpus)(unsigned int max_cpus);
27};
28
29extern void register_smp_ops(struct plat_smp_ops *ops);
30
31static inline void plat_smp_setup(void)
32{
33 extern struct plat_smp_ops *mp_ops; /* private */
34
35 mp_ops->smp_setup();
36}
37
38#else /* !CONFIG_SMP */
39
40struct plat_smp_ops;
41
42static inline void plat_smp_setup(void)
43{
44 /* UP, nothing to do ... */
45}
46
47static inline void register_smp_ops(struct plat_smp_ops *ops)
48{
49}
50
51#endif /* !CONFIG_SMP */
52
53extern struct plat_smp_ops up_smp_ops;
54extern struct plat_smp_ops cmp_smp_ops;
55extern struct plat_smp_ops vsmp_smp_ops;
56
57#endif /* __ASM_SMP_OPS_H */
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
deleted file mode 100644
index 0ff5b523ea77..000000000000
--- a/include/asm-mips/smp.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General
3 * Public License. See the file "COPYING" in the main directory of this
4 * archive for more details.
5 *
6 * Copyright (C) 2000 - 2001 by Kanoj Sarcar (kanoj@sgi.com)
7 * Copyright (C) 2000 - 2001 by Silicon Graphics, Inc.
8 * Copyright (C) 2000, 2001, 2002 Ralf Baechle
9 * Copyright (C) 2000, 2001 Broadcom Corporation
10 */
11#ifndef __ASM_SMP_H
12#define __ASM_SMP_H
13
14#include <linux/bitops.h>
15#include <linux/linkage.h>
16#include <linux/threads.h>
17#include <linux/cpumask.h>
18
19#include <asm/atomic.h>
20#include <asm/smp-ops.h>
21
22extern int smp_num_siblings;
23extern cpumask_t cpu_sibling_map[];
24
25#define raw_smp_processor_id() (current_thread_info()->cpu)
26
27/* Map from cpu id to sequential logical cpu number. This will only
28 not be idempotent when cpus failed to come on-line. */
29extern int __cpu_number_map[NR_CPUS];
30#define cpu_number_map(cpu) __cpu_number_map[cpu]
31
32/* The reverse map from sequential logical cpu number to cpu id. */
33extern int __cpu_logical_map[NR_CPUS];
34#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
35
36#define NO_PROC_ID (-1)
37
38#define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */
39#define SMP_CALL_FUNCTION 0x2
40
41extern cpumask_t phys_cpu_present_map;
42#define cpu_possible_map phys_cpu_present_map
43
44extern void asmlinkage smp_bootstrap(void);
45
46/*
47 * this function sends a 'reschedule' IPI to another CPU.
48 * it goes straight through and wastes no time serializing
49 * anything. Worst case is that we lose a reschedule ...
50 */
51static inline void smp_send_reschedule(int cpu)
52{
53 extern struct plat_smp_ops *mp_ops; /* private */
54
55 mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF);
56}
57
58extern asmlinkage void smp_call_function_interrupt(void);
59
60extern void arch_send_call_function_single_ipi(int cpu);
61extern void arch_send_call_function_ipi(cpumask_t mask);
62
63#endif /* __ASM_SMP_H */
diff --git a/include/asm-mips/smtc.h b/include/asm-mips/smtc.h
deleted file mode 100644
index ea60bf08dcb0..000000000000
--- a/include/asm-mips/smtc.h
+++ /dev/null
@@ -1,71 +0,0 @@
1#ifndef _ASM_SMTC_MT_H
2#define _ASM_SMTC_MT_H
3
4/*
5 * Definitions for SMTC multitasking on MIPS MT cores
6 */
7
8#include <asm/mips_mt.h>
9#include <asm/smtc_ipi.h>
10
11/*
12 * System-wide SMTC status information
13 */
14
15extern unsigned int smtc_status;
16
17#define SMTC_TLB_SHARED 0x00000001
18#define SMTC_MTC_ACTIVE 0x00000002
19
20/*
21 * TLB/ASID Management information
22 */
23
24#define MAX_SMTC_TLBS 2
25#define MAX_SMTC_ASIDS 256
26#if NR_CPUS <= 8
27typedef char asiduse;
28#else
29#if NR_CPUS <= 16
30typedef short asiduse;
31#else
32typedef long asiduse;
33#endif
34#endif
35
36extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
37
38struct mm_struct;
39struct task_struct;
40
41void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
42void self_ipi(struct smtc_ipi *);
43void smtc_flush_tlb_asid(unsigned long asid);
44extern int smtc_build_cpu_map(int startslot);
45extern void smtc_prepare_cpus(int cpus);
46extern void smtc_smp_finish(void);
47extern void smtc_boot_secondary(int cpu, struct task_struct *t);
48extern void smtc_cpus_done(void);
49
50
51/*
52 * Sharing the TLB between multiple VPEs means that the
53 * "random" index selection function is not allowed to
54 * select the current value of the Index register. To
55 * avoid additional TLB pressure, the Index registers
56 * are "parked" with an non-Valid value.
57 */
58
59#define PARKED_INDEX ((unsigned int)0x80000000)
60
61/*
62 * Define low-level interrupt mask for IPIs, if necessary.
63 * By default, use SW interrupt 1, which requires no external
64 * hardware support, but which works only for single-core
65 * MIPS MT systems.
66 */
67#ifndef MIPS_CPU_IPI_IRQ
68#define MIPS_CPU_IPI_IRQ 1
69#endif
70
71#endif /* _ASM_SMTC_MT_H */
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
deleted file mode 100644
index 8ce517574340..000000000000
--- a/include/asm-mips/smtc_ipi.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * Definitions used in MIPS MT SMTC "Interprocessor Interrupt" code.
3 */
4#ifndef __ASM_SMTC_IPI_H
5#define __ASM_SMTC_IPI_H
6
7#include <linux/spinlock.h>
8
9//#define SMTC_IPI_DEBUG
10
11#ifdef SMTC_IPI_DEBUG
12#include <asm/mipsregs.h>
13#include <asm/mipsmtregs.h>
14#endif /* SMTC_IPI_DEBUG */
15
16/*
17 * An IPI "message"
18 */
19
20struct smtc_ipi {
21 struct smtc_ipi *flink;
22 int type;
23 void *arg;
24 int dest;
25#ifdef SMTC_IPI_DEBUG
26 int sender;
27 long stamp;
28#endif /* SMTC_IPI_DEBUG */
29};
30
31/*
32 * Defined IPI Types
33 */
34
35#define LINUX_SMP_IPI 1
36#define SMTC_CLOCK_TICK 2
37#define IRQ_AFFINITY_IPI 3
38
39/*
40 * A queue of IPI messages
41 */
42
43struct smtc_ipi_q {
44 struct smtc_ipi *head;
45 spinlock_t lock;
46 struct smtc_ipi *tail;
47 int depth;
48};
49
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51{
52 unsigned long flags;
53
54 spin_lock_irqsave(&q->lock, flags);
55 if (q->head == NULL)
56 q->head = q->tail = p;
57 else
58 q->tail->flink = p;
59 p->flink = NULL;
60 q->tail = p;
61 q->depth++;
62#ifdef SMTC_IPI_DEBUG
63 p->sender = read_c0_tcbind();
64 p->stamp = read_c0_count();
65#endif /* SMTC_IPI_DEBUG */
66 spin_unlock_irqrestore(&q->lock, flags);
67}
68
69static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
70{
71 struct smtc_ipi *p;
72
73 if (q->head == NULL)
74 p = NULL;
75 else {
76 p = q->head;
77 q->head = q->head->flink;
78 q->depth--;
79 /* Arguably unnecessary, but leaves queue cleaner */
80 if (q->head == NULL)
81 q->tail = NULL;
82 }
83
84 return p;
85}
86
87static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
88{
89 unsigned long flags;
90 struct smtc_ipi *p;
91
92 spin_lock_irqsave(&q->lock, flags);
93 p = __smtc_ipi_dq(q);
94 spin_unlock_irqrestore(&q->lock, flags);
95
96 return p;
97}
98
99static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
100{
101 unsigned long flags;
102
103 spin_lock_irqsave(&q->lock, flags);
104 if (q->head == NULL) {
105 q->head = q->tail = p;
106 p->flink = NULL;
107 } else {
108 p->flink = q->head;
109 q->head = p;
110 }
111 q->depth++;
112 spin_unlock_irqrestore(&q->lock, flags);
113}
114
115static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
116{
117 unsigned long flags;
118 int retval;
119
120 spin_lock_irqsave(&q->lock, flags);
121 retval = q->depth;
122 spin_unlock_irqrestore(&q->lock, flags);
123 return retval;
124}
125
126extern void smtc_send_ipi(int cpu, int type, unsigned int action);
127
128#endif /* __ASM_SMTC_IPI_H */
diff --git a/include/asm-mips/smtc_proc.h b/include/asm-mips/smtc_proc.h
deleted file mode 100644
index 25da651f1f5f..000000000000
--- a/include/asm-mips/smtc_proc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Definitions for SMTC /proc entries
3 * Copyright(C) 2005 MIPS Technologies Inc.
4 */
5#ifndef __ASM_SMTC_PROC_H
6#define __ASM_SMTC_PROC_H
7
8/*
9 * per-"CPU" statistics
10 */
11
12struct smtc_cpu_proc {
13 unsigned long timerints;
14 unsigned long selfipis;
15};
16
17extern struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
18
19/* Count of number of recoveries of "stolen" FPU access rights on 34K */
20
21extern atomic_t smtc_fpu_recoveries;
22
23#endif /* __ASM_SMTC_PROC_H */
diff --git a/include/asm-mips/smvp.h b/include/asm-mips/smvp.h
deleted file mode 100644
index 0d0e80a39e8a..000000000000
--- a/include/asm-mips/smvp.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_SMVP_H
2#define _ASM_SMVP_H
3
4/*
5 * Definitions for SMVP multitasking on MIPS MT cores
6 */
7struct task_struct;
8
9extern void smvp_smp_setup(void);
10extern void smvp_smp_finish(void);
11extern void smvp_boot_secondary(int cpu, struct task_struct *t);
12extern void smvp_init_secondary(void);
13extern void smvp_smp_finish(void);
14extern void smvp_cpus_done(void);
15extern void smvp_prepare_cpus(unsigned int max_cpus);
16
17/* This is platform specific */
18extern void smvp_send_ipi(int cpu, unsigned int action);
19#endif /* _ASM_SMVP_H */
diff --git a/include/asm-mips/sn/addrs.h b/include/asm-mips/sn/addrs.h
deleted file mode 100644
index fec9bdd34913..000000000000
--- a/include/asm-mips/sn/addrs.h
+++ /dev/null
@@ -1,430 +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) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
7 * Copyright (C) 1999, 2000 by Ralf Baechle
8 */
9#ifndef _ASM_SN_ADDRS_H
10#define _ASM_SN_ADDRS_H
11
12
13#ifndef __ASSEMBLY__
14#include <linux/types.h>
15#endif /* !__ASSEMBLY__ */
16
17#include <asm/addrspace.h>
18#include <asm/sn/kldir.h>
19
20#if defined(CONFIG_SGI_IP27)
21#include <asm/sn/sn0/addrs.h>
22#elif defined(CONFIG_SGI_IP35)
23#include <asm/sn/sn1/addrs.h>
24#endif
25
26
27#ifndef __ASSEMBLY__
28
29#define PS_UINT_CAST (unsigned long)
30#define UINT64_CAST (unsigned long)
31
32#define HUBREG_CAST (volatile hubreg_t *)
33
34#else /* __ASSEMBLY__ */
35
36#define PS_UINT_CAST
37#define UINT64_CAST
38#define HUBREG_CAST
39
40#endif /* __ASSEMBLY__ */
41
42
43#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
44#ifdef CONFIG_SGI_IP27
45#define NASID_GET_LOCAL(_n) ((_n) & 0xf)
46#endif
47#define NASID_MAKE(_m, _l) (((_m) << NASID_LOCAL_BITS) | (_l))
48
49#define NODE_ADDRSPACE_MASK (NODE_ADDRSPACE_SIZE - 1)
50#define TO_NODE_ADDRSPACE(_pa) (UINT64_CAST (_pa) & NODE_ADDRSPACE_MASK)
51
52#define CHANGE_ADDR_NASID(_pa, _nasid) \
53 ((UINT64_CAST(_pa) & ~NASID_MASK) | \
54 (UINT64_CAST(_nasid) << NASID_SHFT))
55
56
57/*
58 * The following macros are used to index to the beginning of a specific
59 * node's address space.
60 */
61
62#define NODE_OFFSET(_n) (UINT64_CAST (_n) << NODE_SIZE_BITS)
63
64#define NODE_CAC_BASE(_n) (CAC_BASE + NODE_OFFSET(_n))
65#define NODE_HSPEC_BASE(_n) (HSPEC_BASE + NODE_OFFSET(_n))
66#define NODE_IO_BASE(_n) (IO_BASE + NODE_OFFSET(_n))
67#define NODE_MSPEC_BASE(_n) (MSPEC_BASE + NODE_OFFSET(_n))
68#define NODE_UNCAC_BASE(_n) (UNCAC_BASE + NODE_OFFSET(_n))
69
70#define TO_NODE(_n, _x) (NODE_OFFSET(_n) | ((_x) ))
71#define TO_NODE_CAC(_n, _x) (NODE_CAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
72#define TO_NODE_UNCAC(_n, _x) (NODE_UNCAC_BASE(_n) | ((_x) & TO_PHYS_MASK))
73#define TO_NODE_MSPEC(_n, _x) (NODE_MSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
74#define TO_NODE_HSPEC(_n, _x) (NODE_HSPEC_BASE(_n) | ((_x) & TO_PHYS_MASK))
75
76
77#define RAW_NODE_SWIN_BASE(nasid, widget) \
78 (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
79
80#define WIDGETID_GET(addr) ((unsigned char)((addr >> SWIN_SIZE_BITS) & 0xff))
81
82/*
83 * The following definitions pertain to the IO special address
84 * space. They define the location of the big and little windows
85 * of any given node.
86 */
87
88#define SWIN_SIZE_BITS 24
89#define SWIN_SIZE (UINT64_CAST 1 << 24)
90#define SWIN_SIZEMASK (SWIN_SIZE - 1)
91#define SWIN_WIDGET_MASK 0xF
92
93/*
94 * Convert smallwindow address to xtalk address.
95 *
96 * 'addr' can be physical or virtual address, but will be converted
97 * to Xtalk address in the range 0 -> SWINZ_SIZEMASK
98 */
99#define SWIN_WIDGETADDR(addr) ((addr) & SWIN_SIZEMASK)
100#define SWIN_WIDGETNUM(addr) (((addr) >> SWIN_SIZE_BITS) & SWIN_WIDGET_MASK)
101/*
102 * Verify if addr belongs to small window address on node with "nasid"
103 *
104 *
105 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
106 * address
107 *
108 *
109 */
110#define NODE_SWIN_ADDR(nasid, addr) \
111 (((addr) >= NODE_SWIN_BASE(nasid, 0)) && \
112 ((addr) < (NODE_SWIN_BASE(nasid, HUB_NUM_WIDGET) + SWIN_SIZE)\
113 ))
114
115/*
116 * The following define the major position-independent aliases used
117 * in SN.
118 * UALIAS -- 256MB in size, reads in the UALIAS result in
119 * uncached references to the memory of the reader's node.
120 * CPU_UALIAS -- 128kb in size, the bottom part of UALIAS is flipped
121 * depending on which CPU does the access to provide
122 * all CPUs with unique uncached memory at low addresses.
123 * LBOOT -- 256MB in size, reads in the LBOOT area result in
124 * uncached references to the local hub's boot prom and
125 * other directory-bus connected devices.
126 * IALIAS -- 8MB in size, reads in the IALIAS result in uncached
127 * references to the local hub's registers.
128 */
129
130#define UALIAS_BASE HSPEC_BASE
131#define UALIAS_SIZE 0x10000000 /* 256 Megabytes */
132#define UALIAS_LIMIT (UALIAS_BASE + UALIAS_SIZE)
133
134/*
135 * The bottom of ualias space is flipped depending on whether you're
136 * processor 0 or 1 within a node.
137 */
138#ifdef CONFIG_SGI_IP27
139#define UALIAS_FLIP_BASE UALIAS_BASE
140#define UALIAS_FLIP_SIZE 0x20000
141#define UALIAS_FLIP_BIT 0x10000
142#define UALIAS_FLIP_ADDR(_x) (cputoslice(smp_processor_id()) ? \
143 (_x) ^ UALIAS_FLIP_BIT : (_x))
144
145#define LBOOT_BASE (HSPEC_BASE + 0x10000000)
146#define LBOOT_SIZE 0x10000000
147#define LBOOT_LIMIT (LBOOT_BASE + LBOOT_SIZE)
148#define LBOOT_STRIDE 0 /* IP27 has only one CPU PROM */
149
150#endif
151
152#define HUB_REGISTER_WIDGET 1
153#define IALIAS_BASE NODE_SWIN_BASE(0, HUB_REGISTER_WIDGET)
154#define IALIAS_SIZE 0x800000 /* 8 Megabytes */
155#define IS_IALIAS(_a) (((_a) >= IALIAS_BASE) && \
156 ((_a) < (IALIAS_BASE + IALIAS_SIZE)))
157
158/*
159 * Macro for referring to Hub's RBOOT space
160 */
161
162#ifdef CONFIG_SGI_IP27
163#define RBOOT_SIZE 0x10000000 /* 256 Megabytes */
164#define NODE_RBOOT_BASE(_n) (NODE_HSPEC_BASE(_n) + 0x30000000)
165#define NODE_RBOOT_LIMIT(_n) (NODE_RBOOT_BASE(_n) + RBOOT_SIZE)
166
167#endif
168
169/*
170 * Macros for referring the Hub's back door space
171 *
172 * These macros correctly process addresses in any node's space.
173 * WARNING: They won't work in assembler.
174 *
175 * BDDIR_ENTRY_LO returns the address of the low double-word of the dir
176 * entry corresponding to a physical (Cac or Uncac) address.
177 * BDDIR_ENTRY_HI returns the address of the high double-word of the entry.
178 * BDPRT_ENTRY returns the address of the double-word protection entry
179 * corresponding to the page containing the physical address.
180 * BDPRT_ENTRY_S Stores the value into the protection entry.
181 * BDPRT_ENTRY_L Load the value from the protection entry.
182 * BDECC_ENTRY returns the address of the ECC byte corresponding to a
183 * double-word at a specified physical address.
184 * BDECC_ENTRY_H returns the address of the two ECC bytes corresponding to a
185 * quad-word at a specified physical address.
186 */
187#define NODE_BDOOR_BASE(_n) (NODE_HSPEC_BASE(_n) + (NODE_ADDRSPACE_SIZE/2))
188
189#define NODE_BDECC_BASE(_n) (NODE_BDOOR_BASE(_n))
190#define NODE_BDDIR_BASE(_n) (NODE_BDOOR_BASE(_n) + (NODE_ADDRSPACE_SIZE/4))
191#ifdef CONFIG_SGI_IP27
192#define BDDIR_ENTRY_LO(_pa) ((HSPEC_BASE + \
193 NODE_ADDRSPACE_SIZE * 3 / 4 + \
194 0x200) | \
195 UINT64_CAST(_pa) & NASID_MASK | \
196 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
197 UINT64_CAST(_pa) >> 3 & 0x1f << 4)
198
199#define BDDIR_ENTRY_HI(_pa) ((HSPEC_BASE + \
200 NODE_ADDRSPACE_SIZE * 3 / 4 + \
201 0x208) | \
202 UINT64_CAST(_pa) & NASID_MASK | \
203 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
204 UINT64_CAST(_pa) >> 3 & 0x1f << 4)
205
206#define BDPRT_ENTRY(_pa, _rgn) ((HSPEC_BASE + \
207 NODE_ADDRSPACE_SIZE * 3 / 4) | \
208 UINT64_CAST(_pa) & NASID_MASK | \
209 UINT64_CAST(_pa) >> 2 & BDDIR_UPPER_MASK | \
210 (_rgn) << 3)
211#define BDPRT_ENTRY_ADDR(_pa, _rgn) (BDPRT_ENTRY((_pa), (_rgn)))
212#define BDPRT_ENTRY_S(_pa, _rgn, _val) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn))=(_val))
213#define BDPRT_ENTRY_L(_pa, _rgn) (*(__psunsigned_t *)BDPRT_ENTRY((_pa), (_rgn)))
214
215#define BDECC_ENTRY(_pa) ((HSPEC_BASE + \
216 NODE_ADDRSPACE_SIZE / 2) | \
217 UINT64_CAST(_pa) & NASID_MASK | \
218 UINT64_CAST(_pa) >> 2 & BDECC_UPPER_MASK | \
219 UINT64_CAST(_pa) >> 3 & 3)
220
221/*
222 * Macro to convert a back door directory or protection address into the
223 * raw physical address of the associated cache line or protection page.
224 */
225#define BDADDR_IS_DIR(_ba) ((UINT64_CAST (_ba) & 0x200) != 0)
226#define BDADDR_IS_PRT(_ba) ((UINT64_CAST (_ba) & 0x200) == 0)
227
228#define BDDIR_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
229 (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2 | \
230 (UINT64_CAST(_ba) & 0x1f << 4) << 3)
231
232#define BDPRT_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
233 (UINT64_CAST(_ba) & BDDIR_UPPER_MASK)<<2)
234
235#define BDECC_TO_MEM(_ba) (UINT64_CAST (_ba) & NASID_MASK | \
236 (UINT64_CAST(_ba) & BDECC_UPPER_MASK)<<2 | \
237 (UINT64_CAST(_ba) & 3) << 3)
238#endif /* CONFIG_SGI_IP27 */
239
240
241/*
242 * The following macros produce the correct base virtual address for
243 * the hub registers. The LOCAL_HUB_* macros produce the appropriate
244 * address for the local registers. The REMOTE_HUB_* macro produce
245 * the address for the specified hub's registers. The intent is
246 * that the appropriate PI, MD, NI, or II register would be substituted
247 * for _x.
248 */
249
250/*
251 * WARNING:
252 * When certain Hub chip workaround are defined, it's not sufficient
253 * to dereference the *_HUB_ADDR() macros. You should instead use
254 * HUB_L() and HUB_S() if you must deal with pointers to hub registers.
255 * Otherwise, the recommended approach is to use *_HUB_L() and *_HUB_S().
256 * They're always safe.
257 */
258#define LOCAL_HUB_ADDR(_x) (HUBREG_CAST (IALIAS_BASE + (_x)))
259#define REMOTE_HUB_ADDR(_n, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
260 0x800000 + (_x)))
261#ifdef CONFIG_SGI_IP27
262#define REMOTE_HUB_PI_ADDR(_n, _sn, _x) (HUBREG_CAST (NODE_SWIN_BASE(_n, 1) + \
263 0x800000 + (_x)))
264#endif /* CONFIG_SGI_IP27 */
265
266#ifndef __ASSEMBLY__
267
268#define HUB_L(_a) *(_a)
269#define HUB_S(_a, _d) *(_a) = (_d)
270
271#define LOCAL_HUB_L(_r) HUB_L(LOCAL_HUB_ADDR(_r))
272#define LOCAL_HUB_S(_r, _d) HUB_S(LOCAL_HUB_ADDR(_r), (_d))
273#define REMOTE_HUB_L(_n, _r) HUB_L(REMOTE_HUB_ADDR((_n), (_r)))
274#define REMOTE_HUB_S(_n, _r, _d) HUB_S(REMOTE_HUB_ADDR((_n), (_r)), (_d))
275#define REMOTE_HUB_PI_L(_n, _sn, _r) HUB_L(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)))
276#define REMOTE_HUB_PI_S(_n, _sn, _r, _d) HUB_S(REMOTE_HUB_PI_ADDR((_n), (_sn), (_r)), (_d))
277
278#endif /* !__ASSEMBLY__ */
279
280/*
281 * The following macros are used to get to a hub/bridge register, given
282 * the base of the register space.
283 */
284#define HUB_REG_PTR(_base, _off) \
285 (HUBREG_CAST((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
286
287#define HUB_REG_PTR_L(_base, _off) \
288 HUB_L(HUB_REG_PTR((_base), (_off)))
289
290#define HUB_REG_PTR_S(_base, _off, _data) \
291 HUB_S(HUB_REG_PTR((_base), (_off)), (_data))
292
293/*
294 * Software structure locations -- permanently fixed
295 * See diagram in kldir.h
296 */
297
298#define PHYS_RAMBASE 0x0
299#define K0_RAMBASE PHYS_TO_K0(PHYS_RAMBASE)
300
301#define EX_HANDLER_OFFSET(slice) ((slice) << 16)
302#define EX_HANDLER_ADDR(nasid, slice) \
303 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_HANDLER_OFFSET(slice))
304#define EX_HANDLER_SIZE 0x0400
305
306#define EX_FRAME_OFFSET(slice) ((slice) << 16 | 0x400)
307#define EX_FRAME_ADDR(nasid, slice) \
308 PHYS_TO_K0(NODE_OFFSET(nasid) | EX_FRAME_OFFSET(slice))
309#define EX_FRAME_SIZE 0x0c00
310
311#define ARCS_SPB_OFFSET 0x1000
312#define ARCS_SPB_ADDR(nasid) \
313 PHYS_TO_K0(NODE_OFFSET(nasid) | ARCS_SPB_OFFSET)
314#define ARCS_SPB_SIZE 0x0400
315
316#define KLDIR_OFFSET 0x2000
317#define KLDIR_ADDR(nasid) \
318 TO_NODE_UNCAC((nasid), KLDIR_OFFSET)
319#define KLDIR_SIZE 0x0400
320
321
322/*
323 * Software structure locations -- indirected through KLDIR
324 * See diagram in kldir.h
325 *
326 * Important: All low memory structures must only be accessed
327 * uncached, except for the symmon stacks.
328 */
329
330#define KLI_LAUNCH 0 /* Dir. entries */
331#define KLI_KLCONFIG 1
332#define KLI_NMI 2
333#define KLI_GDA 3
334#define KLI_FREEMEM 4
335#define KLI_SYMMON_STK 5
336#define KLI_PI_ERROR 6
337#define KLI_KERN_VARS 7
338#define KLI_KERN_XP 8
339#define KLI_KERN_PARTID 9
340
341#ifndef __ASSEMBLY__
342
343#define KLD_BASE(nasid) ((kldir_ent_t *) KLDIR_ADDR(nasid))
344#define KLD_LAUNCH(nasid) (KLD_BASE(nasid) + KLI_LAUNCH)
345#define KLD_NMI(nasid) (KLD_BASE(nasid) + KLI_NMI)
346#define KLD_KLCONFIG(nasid) (KLD_BASE(nasid) + KLI_KLCONFIG)
347#define KLD_PI_ERROR(nasid) (KLD_BASE(nasid) + KLI_PI_ERROR)
348#define KLD_GDA(nasid) (KLD_BASE(nasid) + KLI_GDA)
349#define KLD_SYMMON_STK(nasid) (KLD_BASE(nasid) + KLI_SYMMON_STK)
350#define KLD_FREEMEM(nasid) (KLD_BASE(nasid) + KLI_FREEMEM)
351#define KLD_KERN_VARS(nasid) (KLD_BASE(nasid) + KLI_KERN_VARS)
352#define KLD_KERN_XP(nasid) (KLD_BASE(nasid) + KLI_KERN_XP)
353#define KLD_KERN_PARTID(nasid) (KLD_BASE(nasid) + KLI_KERN_PARTID)
354
355#define LAUNCH_OFFSET(nasid, slice) \
356 (KLD_LAUNCH(nasid)->offset + \
357 KLD_LAUNCH(nasid)->stride * (slice))
358#define LAUNCH_ADDR(nasid, slice) \
359 TO_NODE_UNCAC((nasid), LAUNCH_OFFSET(nasid, slice))
360#define LAUNCH_SIZE(nasid) KLD_LAUNCH(nasid)->size
361
362#define NMI_OFFSET(nasid, slice) \
363 (KLD_NMI(nasid)->offset + \
364 KLD_NMI(nasid)->stride * (slice))
365#define NMI_ADDR(nasid, slice) \
366 TO_NODE_UNCAC((nasid), NMI_OFFSET(nasid, slice))
367#define NMI_SIZE(nasid) KLD_NMI(nasid)->size
368
369#define KLCONFIG_OFFSET(nasid) KLD_KLCONFIG(nasid)->offset
370#define KLCONFIG_ADDR(nasid) \
371 TO_NODE_UNCAC((nasid), KLCONFIG_OFFSET(nasid))
372#define KLCONFIG_SIZE(nasid) KLD_KLCONFIG(nasid)->size
373
374#define GDA_ADDR(nasid) KLD_GDA(nasid)->pointer
375#define GDA_SIZE(nasid) KLD_GDA(nasid)->size
376
377#define SYMMON_STK_OFFSET(nasid, slice) \
378 (KLD_SYMMON_STK(nasid)->offset + \
379 KLD_SYMMON_STK(nasid)->stride * (slice))
380#define SYMMON_STK_STRIDE(nasid) KLD_SYMMON_STK(nasid)->stride
381
382#define SYMMON_STK_ADDR(nasid, slice) \
383 TO_NODE_CAC((nasid), SYMMON_STK_OFFSET(nasid, slice))
384
385#define SYMMON_STK_SIZE(nasid) KLD_SYMMON_STK(nasid)->stride
386
387#define SYMMON_STK_END(nasid) (SYMMON_STK_ADDR(nasid, 0) + KLD_SYMMON_STK(nasid)->size)
388
389/* loading symmon 4k below UNIX. the arcs loader needs the topaddr for a
390 * relocatable program
391 */
392#define UNIX_DEBUG_LOADADDR 0x300000
393#define SYMMON_LOADADDR(nasid) \
394 TO_NODE(nasid, PHYS_TO_K0(UNIX_DEBUG_LOADADDR - 0x1000))
395
396#define FREEMEM_OFFSET(nasid) KLD_FREEMEM(nasid)->offset
397#define FREEMEM_ADDR(nasid) SYMMON_STK_END(nasid)
398/*
399 * XXX
400 * Fix this. FREEMEM_ADDR should be aware of if symmon is loaded.
401 * Also, it should take into account what prom thinks to be a safe
402 * address
403 PHYS_TO_K0(NODE_OFFSET(nasid) + FREEMEM_OFFSET(nasid))
404 */
405#define FREEMEM_SIZE(nasid) KLD_FREEMEM(nasid)->size
406
407#define PI_ERROR_OFFSET(nasid) KLD_PI_ERROR(nasid)->offset
408#define PI_ERROR_ADDR(nasid) \
409 TO_NODE_UNCAC((nasid), PI_ERROR_OFFSET(nasid))
410#define PI_ERROR_SIZE(nasid) KLD_PI_ERROR(nasid)->size
411
412#define NODE_OFFSET_TO_K0(_nasid, _off) \
413 PHYS_TO_K0((NODE_OFFSET(_nasid) + (_off)) | CAC_BASE)
414#define NODE_OFFSET_TO_K1(_nasid, _off) \
415 TO_UNCAC((NODE_OFFSET(_nasid) + (_off)) | UNCAC_BASE)
416#define K0_TO_NODE_OFFSET(_k0addr) \
417 ((__psunsigned_t)(_k0addr) & NODE_ADDRSPACE_MASK)
418
419#define KERN_VARS_ADDR(nasid) KLD_KERN_VARS(nasid)->pointer
420#define KERN_VARS_SIZE(nasid) KLD_KERN_VARS(nasid)->size
421
422#define KERN_XP_ADDR(nasid) KLD_KERN_XP(nasid)->pointer
423#define KERN_XP_SIZE(nasid) KLD_KERN_XP(nasid)->size
424
425#define GPDA_ADDR(nasid) TO_NODE_CAC(nasid, GPDA_OFFSET)
426
427#endif /* !__ASSEMBLY__ */
428
429
430#endif /* _ASM_SN_ADDRS_H */
diff --git a/include/asm-mips/sn/agent.h b/include/asm-mips/sn/agent.h
deleted file mode 100644
index ac4ea85c3a5c..000000000000
--- a/include/asm-mips/sn/agent.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * This file has definitions for the hub and snac interfaces.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silcon Graphics, Inc.
9 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SGI_SN_AGENT_H
12#define _ASM_SGI_SN_AGENT_H
13
14#include <linux/topology.h>
15#include <asm/sn/addrs.h>
16#include <asm/sn/arch.h>
17
18#if defined(CONFIG_SGI_IP27)
19#include <asm/sn/sn0/hub.h>
20#elif defined(CONFIG_SGI_IP35)
21#include <asm/sn/sn1/hub.h>
22#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
23
24/*
25 * NIC register macros
26 */
27
28#if defined(CONFIG_SGI_IP27)
29#define HUB_NIC_ADDR(_cpuid) \
30 REMOTE_HUB_ADDR(COMPACT_TO_NASID_NODEID(cpu_to_node(_cpuid)), \
31 MD_MLAN_CTL)
32#endif
33
34#define SET_HUB_NIC(_my_cpuid, _val) \
35 (HUB_S(HUB_NIC_ADDR(_my_cpuid), (_val)))
36
37#define SET_MY_HUB_NIC(_v) \
38 SET_HUB_NIC(cpuid(), (_v))
39
40#define GET_HUB_NIC(_my_cpuid) \
41 (HUB_L(HUB_NIC_ADDR(_my_cpuid)))
42
43#define GET_MY_HUB_NIC() \
44 GET_HUB_NIC(cpuid())
45
46#endif /* _ASM_SGI_SN_AGENT_H */
diff --git a/include/asm-mips/sn/arch.h b/include/asm-mips/sn/arch.h
deleted file mode 100644
index bd75945e10ff..000000000000
--- a/include/asm-mips/sn/arch.h
+++ /dev/null
@@ -1,64 +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 * SGI specific setup.
7 *
8 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_ARCH_H
12#define _ASM_SN_ARCH_H
13
14#include <linux/types.h>
15#include <asm/sn/types.h>
16#ifdef CONFIG_SGI_IP27
17#include <asm/sn/sn0/arch.h>
18#endif
19
20typedef u64 hubreg_t;
21
22#define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
23#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
24#define makespnum(_nasid, _slice) \
25 (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
26
27#define INVALID_NASID (nasid_t)-1
28#define INVALID_CNODEID (cnodeid_t)-1
29#define INVALID_PNODEID (pnodeid_t)-1
30#define INVALID_MODULE (moduleid_t)-1
31#define INVALID_PARTID (partid_t)-1
32
33extern nasid_t get_nasid(void);
34extern cnodeid_t get_cpu_cnode(cpuid_t);
35extern int get_cpu_slice(cpuid_t);
36
37/*
38 * NO ONE should access these arrays directly. The only reason we refer to
39 * them here is to avoid the procedure call that would be required in the
40 * macros below. (Really want private data members here :-)
41 */
42extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
43extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
44
45/*
46 * These macros are used by various parts of the kernel to convert
47 * between the three different kinds of node numbering. At least some
48 * of them may change to procedure calls in the future, but the macros
49 * will continue to work. Don't use the arrays above directly.
50 */
51
52#define NASID_TO_REGION(nnode) \
53 ((nnode) >> \
54 (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
55
56extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
57extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
58extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
59
60#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
61#define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
62#define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
63
64#endif /* _ASM_SN_ARCH_H */
diff --git a/include/asm-mips/sn/fru.h b/include/asm-mips/sn/fru.h
deleted file mode 100644
index b3e3606723b7..000000000000
--- a/include/asm-mips/sn/fru.h
+++ /dev/null
@@ -1,44 +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 * Derived from IRIX <sys/SN/SN0/sn0_fru.h>
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999, 2006 Ralf Baechle (ralf@linux-mips)
10 */
11#ifndef __ASM_SN_FRU_H
12#define __ASM_SN_FRU_H
13
14#define MAX_DIMMS 8 /* max # of dimm banks */
15#define MAX_PCIDEV 8 /* max # of pci devices on a pci bus */
16
17typedef unsigned char confidence_t;
18
19typedef struct kf_mem_s {
20 confidence_t km_confidence; /* confidence level that the memory is bad
21 * is this necessary ?
22 */
23 confidence_t km_dimm[MAX_DIMMS];
24 /* confidence level that dimm[i] is bad
25 *I think this is the right number
26 */
27
28} kf_mem_t;
29
30typedef struct kf_cpu_s {
31 confidence_t kc_confidence; /* confidence level that cpu is bad */
32 confidence_t kc_icache; /* confidence level that instr. cache is bad */
33 confidence_t kc_dcache; /* confidence level that data cache is bad */
34 confidence_t kc_scache; /* confidence level that sec. cache is bad */
35 confidence_t kc_sysbus; /* confidence level that sysad/cmd/state bus is bad */
36} kf_cpu_t;
37
38typedef struct kf_pci_bus_s {
39 confidence_t kpb_belief; /* confidence level that the pci bus is bad */
40 confidence_t kpb_pcidev_belief[MAX_PCIDEV];
41 /* confidence level that the pci dev is bad */
42} kf_pci_bus_t;
43
44#endif /* __ASM_SN_FRU_H */
diff --git a/include/asm-mips/sn/gda.h b/include/asm-mips/sn/gda.h
deleted file mode 100644
index 9cb6ff770915..000000000000
--- a/include/asm-mips/sn/gda.h
+++ /dev/null
@@ -1,107 +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 * Derived from IRIX <sys/SN/gda.h>.
7 *
8 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
9 *
10 * gda.h -- Contains the data structure for the global data area,
11 * The GDA contains information communicated between the
12 * PROM, SYMMON, and the kernel.
13 */
14#ifndef _ASM_SN_GDA_H
15#define _ASM_SN_GDA_H
16
17#include <asm/sn/addrs.h>
18
19#define GDA_MAGIC 0x58464552
20
21/*
22 * GDA Version History
23 *
24 * Version # | Change
25 * -------------+-------------------------------------------------------
26 * 1 | Initial SN0 version
27 * 2 | Prom sets g_partid field to the partition number. 0 IS
28 * | a valid partition #.
29 */
30
31#define GDA_VERSION 2 /* Current GDA version # */
32
33#define G_MAGICOFF 0
34#define G_VERSIONOFF 4
35#define G_PROMOPOFF 6
36#define G_MASTEROFF 8
37#define G_VDSOFF 12
38#define G_HKDNORMOFF 16
39#define G_HKDUTLBOFF 24
40#define G_HKDXUTLBOFF 32
41#define G_PARTIDOFF 40
42#define G_TABLEOFF 128
43
44#ifndef __ASSEMBLY__
45
46typedef struct gda {
47 u32 g_magic; /* GDA magic number */
48 u16 g_version; /* Version of this structure */
49 u16 g_masterid; /* The NASID:CPUNUM of the master cpu */
50 u32 g_promop; /* Passes requests from the kernel to prom */
51 u32 g_vds; /* Store the virtual dipswitches here */
52 void **g_hooked_norm;/* ptr to pda loc for norm hndlr */
53 void **g_hooked_utlb;/* ptr to pda loc for utlb hndlr */
54 void **g_hooked_xtlb;/* ptr to pda loc for xtlb hndlr */
55 int g_partid; /* partition id */
56 int g_symmax; /* Max symbols in name table. */
57 void *g_dbstab; /* Address of idbg symbol table */
58 char *g_nametab; /* Address of idbg name table */
59 void *g_ktext_repmask;
60 /* Pointer to a mask of nodes with copies
61 * of the kernel. */
62 char g_padding[56]; /* pad out to 128 bytes */
63 nasid_t g_nasidtable[MAX_COMPACT_NODES]; /* NASID of each node,
64 * indexed by cnodeid.
65 */
66} gda_t;
67
68#define GDA ((gda_t*) GDA_ADDR(get_nasid()))
69
70#endif /* !__ASSEMBLY__ */
71/*
72 * Define: PART_GDA_VERSION
73 * Purpose: Define the minimum version of the GDA required, lower
74 * revisions assume GDA is NOT set up, and read partition
75 * information from the board info.
76 */
77#define PART_GDA_VERSION 2
78
79/*
80 * The following requests can be sent to the PROM during startup.
81 */
82
83#define PROMOP_MAGIC 0x0ead0000
84#define PROMOP_MAGIC_MASK 0x0fff0000
85
86#define PROMOP_BIST_SHIFT 11
87#define PROMOP_BIST_MASK (0x3 << 11)
88
89#define PROMOP_REG PI_ERR_STACK_ADDR_A
90
91#define PROMOP_INVALID (PROMOP_MAGIC | 0x00)
92#define PROMOP_HALT (PROMOP_MAGIC | 0x10)
93#define PROMOP_POWERDOWN (PROMOP_MAGIC | 0x20)
94#define PROMOP_RESTART (PROMOP_MAGIC | 0x30)
95#define PROMOP_REBOOT (PROMOP_MAGIC | 0x40)
96#define PROMOP_IMODE (PROMOP_MAGIC | 0x50)
97
98#define PROMOP_CMD_MASK 0x00f0
99#define PROMOP_OPTIONS_MASK 0xfff0
100
101#define PROMOP_SKIP_DIAGS 0x0100 /* don't bother running diags */
102#define PROMOP_SKIP_MEMINIT 0x0200 /* don't bother initing memory */
103#define PROMOP_SKIP_DEVINIT 0x0400 /* don't bother initing devices */
104#define PROMOP_BIST1 0x0800 /* keep track of which BIST ran */
105#define PROMOP_BIST2 0x1000 /* keep track of which BIST ran */
106
107#endif /* _ASM_SN_GDA_H */
diff --git a/include/asm-mips/sn/hub.h b/include/asm-mips/sn/hub.h
deleted file mode 100644
index 1992d9254a08..000000000000
--- a/include/asm-mips/sn/hub.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_SN_HUB_H
2#define __ASM_SN_HUB_H
3
4#include <linux/types.h>
5#include <linux/cpumask.h>
6#include <asm/sn/types.h>
7#include <asm/sn/io.h>
8#include <asm/sn/klkernvars.h>
9#include <asm/xtalk/xtalk.h>
10
11/* ip27-hubio.c */
12extern unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
13 unsigned long xtalk_addr, size_t size);
14extern void hub_pio_init(cnodeid_t cnode);
15
16#endif /* __ASM_SN_HUB_H */
diff --git a/include/asm-mips/sn/intr.h b/include/asm-mips/sn/intr.h
deleted file mode 100644
index 6718b644b970..000000000000
--- a/include/asm-mips/sn/intr.h
+++ /dev/null
@@ -1,129 +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) 1992 - 1997 Silicon Graphics, Inc.
7 */
8#ifndef __ASM_SN_INTR_H
9#define __ASM_SN_INTR_H
10
11/* Number of interrupt levels associated with each interrupt register. */
12#define N_INTPEND_BITS 64
13
14#define INT_PEND0_BASELVL 0
15#define INT_PEND1_BASELVL 64
16
17#define N_INTPENDJUNK_BITS 8
18#define INTPENDJUNK_CLRBIT 0x80
19
20/*
21 * Macros to manipulate the interrupt register on the calling hub chip.
22 */
23
24#define LOCAL_HUB_SEND_INTR(level) \
25 LOCAL_HUB_S(PI_INT_PEND_MOD, (0x100 | (level)))
26#define REMOTE_HUB_SEND_INTR(hub, level) \
27 REMOTE_HUB_S((hub), PI_INT_PEND_MOD, (0x100 | (level)))
28
29/*
30 * When clearing the interrupt, make sure this clear does make it
31 * to the hub. Otherwise we could end up losing interrupts.
32 * We do an uncached load of the int_pend0 register to ensure this.
33 */
34
35#define LOCAL_HUB_CLR_INTR(level) \
36do { \
37 LOCAL_HUB_S(PI_INT_PEND_MOD, (level)); \
38 LOCAL_HUB_L(PI_INT_PEND0); \
39} while (0);
40
41#define REMOTE_HUB_CLR_INTR(hub, level) \
42do { \
43 nasid_t __hub = (hub); \
44 \
45 REMOTE_HUB_S(__hub, PI_INT_PEND_MOD, (level)); \
46 REMOTE_HUB_L(__hub, PI_INT_PEND0); \
47} while (0);
48
49/*
50 * Hard-coded interrupt levels:
51 */
52
53/*
54 * L0 = SW1
55 * L1 = SW2
56 * L2 = INT_PEND0
57 * L3 = INT_PEND1
58 * L4 = RTC
59 * L5 = Profiling Timer
60 * L6 = Hub Errors
61 * L7 = Count/Compare (T5 counters)
62 */
63
64
65/*
66 * INT_PEND0 hard-coded bits.
67 */
68
69/*
70 * INT_PEND0 bits determined by hardware:
71 */
72#define RESERVED_INTR 0 /* What is this bit? */
73#define GFX_INTR_A 1
74#define GFX_INTR_B 2
75#define PG_MIG_INTR 3
76#define UART_INTR 4
77#define CC_PEND_A 5
78#define CC_PEND_B 6
79
80/*
81 * INT_PEND0 used by the kernel for itself ...
82 */
83#define CPU_RESCHED_A_IRQ 7
84#define CPU_RESCHED_B_IRQ 8
85#define CPU_CALL_A_IRQ 9
86#define CPU_CALL_B_IRQ 10
87#define MSC_MESG_INTR 11
88#define BASE_PCI_IRQ 12
89
90/*
91 * INT_PEND0 again, bits determined by hardware / hardcoded:
92 */
93#define SDISK_INTR 63 /* SABLE name */
94#define IP_PEND0_6_63 63 /* What is this bit? */
95
96/*
97 * INT_PEND1 hard-coded bits:
98 */
99#define NI_BRDCAST_ERR_A 39
100#define NI_BRDCAST_ERR_B 40
101
102#define LLP_PFAIL_INTR_A 41 /* see ml/SN/SN0/sysctlr.c */
103#define LLP_PFAIL_INTR_B 42
104
105#define TLB_INTR_A 43 /* used for tlb flush random */
106#define TLB_INTR_B 44
107
108#define IP27_INTR_0 45 /* Reserved for PROM use */
109#define IP27_INTR_1 46 /* do not use in Kernel */
110#define IP27_INTR_2 47
111#define IP27_INTR_3 48
112#define IP27_INTR_4 49
113#define IP27_INTR_5 50
114#define IP27_INTR_6 51
115#define IP27_INTR_7 52
116
117#define BRIDGE_ERROR_INTR 53 /* Setup by PROM to catch */
118 /* Bridge Errors */
119#define DEBUG_INTR_A 54
120#define DEBUG_INTR_B 55 /* Used by symmon to stop all cpus */
121#define IO_ERROR_INTR 57 /* Setup by PROM */
122#define CLK_ERR_INTR 58
123#define COR_ERR_INTR_A 59
124#define COR_ERR_INTR_B 60
125#define MD_COR_ERR_INTR 61
126#define NI_ERROR_INTR 62
127#define MSC_PANIC_INTR 63
128
129#endif /* __ASM_SN_INTR_H */
diff --git a/include/asm-mips/sn/io.h b/include/asm-mips/sn/io.h
deleted file mode 100644
index 24c6775fbb0f..000000000000
--- a/include/asm-mips/sn/io.h
+++ /dev/null
@@ -1,59 +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) 2000, 2003 Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SN_IO_H
10#define _ASM_SN_IO_H
11
12#if defined(CONFIG_SGI_IP27)
13#include <asm/sn/sn0/hubio.h>
14#endif
15
16
17#define IIO_ITTE_BASE 0x400160 /* base of translation table entries */
18#define IIO_ITTE(bigwin) (IIO_ITTE_BASE + 8*(bigwin))
19
20#define IIO_ITTE_OFFSET_BITS 5 /* size of offset field */
21#define IIO_ITTE_OFFSET_MASK ((1<<IIO_ITTE_OFFSET_BITS)-1)
22#define IIO_ITTE_OFFSET_SHIFT 0
23
24#define IIO_ITTE_WIDGET_BITS 4 /* size of widget field */
25#define IIO_ITTE_WIDGET_MASK ((1<<IIO_ITTE_WIDGET_BITS)-1)
26#define IIO_ITTE_WIDGET_SHIFT 8
27
28#define IIO_ITTE_IOSP 1 /* I/O Space bit */
29#define IIO_ITTE_IOSP_MASK 1
30#define IIO_ITTE_IOSP_SHIFT 12
31#define HUB_PIO_MAP_TO_MEM 0
32#define HUB_PIO_MAP_TO_IO 1
33
34#define IIO_ITTE_INVALID_WIDGET 3 /* an invalid widget */
35
36#define IIO_ITTE_PUT(nasid, bigwin, io_or_mem, widget, addr) \
37 REMOTE_HUB_S((nasid), IIO_ITTE(bigwin), \
38 (((((addr) >> BWIN_SIZE_BITS) & \
39 IIO_ITTE_OFFSET_MASK) << IIO_ITTE_OFFSET_SHIFT) | \
40 (io_or_mem << IIO_ITTE_IOSP_SHIFT) | \
41 (((widget) & IIO_ITTE_WIDGET_MASK) << IIO_ITTE_WIDGET_SHIFT)))
42
43#define IIO_ITTE_DISABLE(nasid, bigwin) \
44 IIO_ITTE_PUT((nasid), HUB_PIO_MAP_TO_MEM, \
45 (bigwin), IIO_ITTE_INVALID_WIDGET, 0)
46
47#define IIO_ITTE_GET(nasid, bigwin) REMOTE_HUB_ADDR((nasid), IIO_ITTE(bigwin))
48
49/*
50 * Macro which takes the widget number, and returns the
51 * IO PRB address of that widget.
52 * value _x is expected to be a widget number in the range
53 * 0, 8 - 0xF
54 */
55#define IIO_IOPRB(_x) (IIO_IOPRB_0 + ( ( (_x) < HUB_WIDGET_ID_MIN ? \
56 (_x) : \
57 (_x) - (HUB_WIDGET_ID_MIN-1)) << 3) )
58
59#endif /* _ASM_SN_IO_H */
diff --git a/include/asm-mips/sn/ioc3.h b/include/asm-mips/sn/ioc3.h
deleted file mode 100644
index 099677774d71..000000000000
--- a/include/asm-mips/sn/ioc3.h
+++ /dev/null
@@ -1,663 +0,0 @@
1/*
2 * Copyright (C) 1999, 2000 Ralf Baechle
3 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
4 */
5#ifndef _IOC3_H
6#define _IOC3_H
7
8#include <linux/types.h>
9
10/* SUPERIO uart register map */
11typedef volatile struct ioc3_uartregs {
12 union {
13 volatile u8 rbr; /* read only, DLAB == 0 */
14 volatile u8 thr; /* write only, DLAB == 0 */
15 volatile u8 dll; /* DLAB == 1 */
16 } u1;
17 union {
18 volatile u8 ier; /* DLAB == 0 */
19 volatile u8 dlm; /* DLAB == 1 */
20 } u2;
21 union {
22 volatile u8 iir; /* read only */
23 volatile u8 fcr; /* write only */
24 } u3;
25 volatile u8 iu_lcr;
26 volatile u8 iu_mcr;
27 volatile u8 iu_lsr;
28 volatile u8 iu_msr;
29 volatile u8 iu_scr;
30} ioc3_uregs_t;
31
32#define iu_rbr u1.rbr
33#define iu_thr u1.thr
34#define iu_dll u1.dll
35#define iu_ier u2.ier
36#define iu_dlm u2.dlm
37#define iu_iir u3.iir
38#define iu_fcr u3.fcr
39
40struct ioc3_sioregs {
41 volatile u8 fill[0x141]; /* starts at 0x141 */
42
43 volatile u8 uartc;
44 volatile u8 kbdcg;
45
46 volatile u8 fill0[0x150 - 0x142 - 1];
47
48 volatile u8 pp_data;
49 volatile u8 pp_dsr;
50 volatile u8 pp_dcr;
51
52 volatile u8 fill1[0x158 - 0x152 - 1];
53
54 volatile u8 pp_fifa;
55 volatile u8 pp_cfgb;
56 volatile u8 pp_ecr;
57
58 volatile u8 fill2[0x168 - 0x15a - 1];
59
60 volatile u8 rtcad;
61 volatile u8 rtcdat;
62
63 volatile u8 fill3[0x170 - 0x169 - 1];
64
65 struct ioc3_uartregs uartb; /* 0x20170 */
66 struct ioc3_uartregs uarta; /* 0x20178 */
67};
68
69/* Register layout of IOC3 in configuration space. */
70struct ioc3 {
71 volatile u32 pad0[7]; /* 0x00000 */
72 volatile u32 sio_ir; /* 0x0001c */
73 volatile u32 sio_ies; /* 0x00020 */
74 volatile u32 sio_iec; /* 0x00024 */
75 volatile u32 sio_cr; /* 0x00028 */
76 volatile u32 int_out; /* 0x0002c */
77 volatile u32 mcr; /* 0x00030 */
78
79 /* General Purpose I/O registers */
80 volatile u32 gpcr_s; /* 0x00034 */
81 volatile u32 gpcr_c; /* 0x00038 */
82 volatile u32 gpdr; /* 0x0003c */
83 volatile u32 gppr_0; /* 0x00040 */
84 volatile u32 gppr_1; /* 0x00044 */
85 volatile u32 gppr_2; /* 0x00048 */
86 volatile u32 gppr_3; /* 0x0004c */
87 volatile u32 gppr_4; /* 0x00050 */
88 volatile u32 gppr_5; /* 0x00054 */
89 volatile u32 gppr_6; /* 0x00058 */
90 volatile u32 gppr_7; /* 0x0005c */
91 volatile u32 gppr_8; /* 0x00060 */
92 volatile u32 gppr_9; /* 0x00064 */
93 volatile u32 gppr_10; /* 0x00068 */
94 volatile u32 gppr_11; /* 0x0006c */
95 volatile u32 gppr_12; /* 0x00070 */
96 volatile u32 gppr_13; /* 0x00074 */
97 volatile u32 gppr_14; /* 0x00078 */
98 volatile u32 gppr_15; /* 0x0007c */
99
100 /* Parallel Port Registers */
101 volatile u32 ppbr_h_a; /* 0x00080 */
102 volatile u32 ppbr_l_a; /* 0x00084 */
103 volatile u32 ppcr_a; /* 0x00088 */
104 volatile u32 ppcr; /* 0x0008c */
105 volatile u32 ppbr_h_b; /* 0x00090 */
106 volatile u32 ppbr_l_b; /* 0x00094 */
107 volatile u32 ppcr_b; /* 0x00098 */
108
109 /* Keyboard and Mouse Registers */
110 volatile u32 km_csr; /* 0x0009c */
111 volatile u32 k_rd; /* 0x000a0 */
112 volatile u32 m_rd; /* 0x000a4 */
113 volatile u32 k_wd; /* 0x000a8 */
114 volatile u32 m_wd; /* 0x000ac */
115
116 /* Serial Port Registers */
117 volatile u32 sbbr_h; /* 0x000b0 */
118 volatile u32 sbbr_l; /* 0x000b4 */
119 volatile u32 sscr_a; /* 0x000b8 */
120 volatile u32 stpir_a; /* 0x000bc */
121 volatile u32 stcir_a; /* 0x000c0 */
122 volatile u32 srpir_a; /* 0x000c4 */
123 volatile u32 srcir_a; /* 0x000c8 */
124 volatile u32 srtr_a; /* 0x000cc */
125 volatile u32 shadow_a; /* 0x000d0 */
126 volatile u32 sscr_b; /* 0x000d4 */
127 volatile u32 stpir_b; /* 0x000d8 */
128 volatile u32 stcir_b; /* 0x000dc */
129 volatile u32 srpir_b; /* 0x000e0 */
130 volatile u32 srcir_b; /* 0x000e4 */
131 volatile u32 srtr_b; /* 0x000e8 */
132 volatile u32 shadow_b; /* 0x000ec */
133
134 /* Ethernet Registers */
135 volatile u32 emcr; /* 0x000f0 */
136 volatile u32 eisr; /* 0x000f4 */
137 volatile u32 eier; /* 0x000f8 */
138 volatile u32 ercsr; /* 0x000fc */
139 volatile u32 erbr_h; /* 0x00100 */
140 volatile u32 erbr_l; /* 0x00104 */
141 volatile u32 erbar; /* 0x00108 */
142 volatile u32 ercir; /* 0x0010c */
143 volatile u32 erpir; /* 0x00110 */
144 volatile u32 ertr; /* 0x00114 */
145 volatile u32 etcsr; /* 0x00118 */
146 volatile u32 ersr; /* 0x0011c */
147 volatile u32 etcdc; /* 0x00120 */
148 volatile u32 ebir; /* 0x00124 */
149 volatile u32 etbr_h; /* 0x00128 */
150 volatile u32 etbr_l; /* 0x0012c */
151 volatile u32 etcir; /* 0x00130 */
152 volatile u32 etpir; /* 0x00134 */
153 volatile u32 emar_h; /* 0x00138 */
154 volatile u32 emar_l; /* 0x0013c */
155 volatile u32 ehar_h; /* 0x00140 */
156 volatile u32 ehar_l; /* 0x00144 */
157 volatile u32 micr; /* 0x00148 */
158 volatile u32 midr_r; /* 0x0014c */
159 volatile u32 midr_w; /* 0x00150 */
160 volatile u32 pad1[(0x20000 - 0x00154) / 4];
161
162 /* SuperIO Registers XXX */
163 struct ioc3_sioregs sregs; /* 0x20000 */
164 volatile u32 pad2[(0x40000 - 0x20180) / 4];
165
166 /* SSRAM Diagnostic Access */
167 volatile u32 ssram[(0x80000 - 0x40000) / 4];
168
169 /* Bytebus device offsets
170 0x80000 - Access to the generic devices selected with DEV0
171 0x9FFFF bytebus DEV_SEL_0
172 0xA0000 - Access to the generic devices selected with DEV1
173 0xBFFFF bytebus DEV_SEL_1
174 0xC0000 - Access to the generic devices selected with DEV2
175 0xDFFFF bytebus DEV_SEL_2
176 0xE0000 - Access to the generic devices selected with DEV3
177 0xFFFFF bytebus DEV_SEL_3 */
178};
179
180/*
181 * Ethernet RX Buffer
182 */
183struct ioc3_erxbuf {
184 u32 w0; /* first word (valid,bcnt,cksum) */
185 u32 err; /* second word various errors */
186 /* next comes n bytes of padding */
187 /* then the received ethernet frame itself */
188};
189
190#define ERXBUF_IPCKSUM_MASK 0x0000ffff
191#define ERXBUF_BYTECNT_MASK 0x07ff0000
192#define ERXBUF_BYTECNT_SHIFT 16
193#define ERXBUF_V 0x80000000
194
195#define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
196#define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
197#define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
198#define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
199#define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
200#define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
201#define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
202#define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
203#define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
204#define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
205#define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
206#define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
207
208/*
209 * Ethernet TX Descriptor
210 */
211#define ETXD_DATALEN 104
212struct ioc3_etxd {
213 u32 cmd; /* command field */
214 u32 bufcnt; /* buffer counts field */
215 u64 p1; /* buffer pointer 1 */
216 u64 p2; /* buffer pointer 2 */
217 u8 data[ETXD_DATALEN]; /* opt. tx data */
218};
219
220#define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
221#define ETXD_INTWHENDONE 0x00001000 /* intr when done */
222#define ETXD_D0V 0x00010000 /* data 0 valid */
223#define ETXD_B1V 0x00020000 /* buf 1 valid */
224#define ETXD_B2V 0x00040000 /* buf 2 valid */
225#define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
226#define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
227#define ETXD_CHKOFF_SHIFT 20
228
229#define ETXD_D0CNT_MASK 0x0000007f
230#define ETXD_B1CNT_MASK 0x0007ff00
231#define ETXD_B1CNT_SHIFT 8
232#define ETXD_B2CNT_MASK 0x7ff00000
233#define ETXD_B2CNT_SHIFT 20
234
235/*
236 * Bytebus device space
237 */
238#define IOC3_BYTEBUS_DEV0 0x80000L
239#define IOC3_BYTEBUS_DEV1 0xa0000L
240#define IOC3_BYTEBUS_DEV2 0xc0000L
241#define IOC3_BYTEBUS_DEV3 0xe0000L
242
243/* ------------------------------------------------------------------------- */
244
245/* Superio Registers (PIO Access) */
246#define IOC3_SIO_BASE 0x20000
247#define IOC3_SIO_UARTC (IOC3_SIO_BASE+0x141) /* UART Config */
248#define IOC3_SIO_KBDCG (IOC3_SIO_BASE+0x142) /* KBD Config */
249#define IOC3_SIO_PP_BASE (IOC3_SIO_BASE+PP_BASE) /* Parallel Port */
250#define IOC3_SIO_RTC_BASE (IOC3_SIO_BASE+0x168) /* Real Time Clock */
251#define IOC3_SIO_UB_BASE (IOC3_SIO_BASE+UARTB_BASE) /* UART B */
252#define IOC3_SIO_UA_BASE (IOC3_SIO_BASE+UARTA_BASE) /* UART A */
253
254/* SSRAM Diagnostic Access */
255#define IOC3_SSRAM IOC3_RAM_OFF /* base of SSRAM diagnostic access */
256#define IOC3_SSRAM_LEN 0x40000 /* 256kb (address space size, may not be fully populated) */
257#define IOC3_SSRAM_DM 0x0000ffff /* data mask */
258#define IOC3_SSRAM_PM 0x00010000 /* parity mask */
259
260/* bitmasks for PCI_SCR */
261#define PCI_SCR_PAR_RESP_EN 0x00000040 /* enb PCI parity checking */
262#define PCI_SCR_SERR_EN 0x00000100 /* enable the SERR# driver */
263#define PCI_SCR_DROP_MODE_EN 0x00008000 /* drop pios on parity err */
264#define PCI_SCR_RX_SERR (0x1 << 16)
265#define PCI_SCR_DROP_MODE (0x1 << 17)
266#define PCI_SCR_SIG_PAR_ERR (0x1 << 24)
267#define PCI_SCR_SIG_TAR_ABRT (0x1 << 27)
268#define PCI_SCR_RX_TAR_ABRT (0x1 << 28)
269#define PCI_SCR_SIG_MST_ABRT (0x1 << 29)
270#define PCI_SCR_SIG_SERR (0x1 << 30)
271#define PCI_SCR_PAR_ERR (0x1 << 31)
272
273/* bitmasks for IOC3_KM_CSR */
274#define KM_CSR_K_WRT_PEND 0x00000001 /* kbd port xmitting or resetting */
275#define KM_CSR_M_WRT_PEND 0x00000002 /* mouse port xmitting or resetting */
276#define KM_CSR_K_LCB 0x00000004 /* Line Cntrl Bit for last KBD write */
277#define KM_CSR_M_LCB 0x00000008 /* same for mouse */
278#define KM_CSR_K_DATA 0x00000010 /* state of kbd data line */
279#define KM_CSR_K_CLK 0x00000020 /* state of kbd clock line */
280#define KM_CSR_K_PULL_DATA 0x00000040 /* pull kbd data line low */
281#define KM_CSR_K_PULL_CLK 0x00000080 /* pull kbd clock line low */
282#define KM_CSR_M_DATA 0x00000100 /* state of ms data line */
283#define KM_CSR_M_CLK 0x00000200 /* state of ms clock line */
284#define KM_CSR_M_PULL_DATA 0x00000400 /* pull ms data line low */
285#define KM_CSR_M_PULL_CLK 0x00000800 /* pull ms clock line low */
286#define KM_CSR_EMM_MODE 0x00001000 /* emulation mode */
287#define KM_CSR_SIM_MODE 0x00002000 /* clock X8 */
288#define KM_CSR_K_SM_IDLE 0x00004000 /* Keyboard is idle */
289#define KM_CSR_M_SM_IDLE 0x00008000 /* Mouse is idle */
290#define KM_CSR_K_TO 0x00010000 /* Keyboard trying to send/receive */
291#define KM_CSR_M_TO 0x00020000 /* Mouse trying to send/receive */
292#define KM_CSR_K_TO_EN 0x00040000 /* KM_CSR_K_TO + KM_CSR_K_TO_EN = cause
293 SIO_IR to assert */
294#define KM_CSR_M_TO_EN 0x00080000 /* KM_CSR_M_TO + KM_CSR_M_TO_EN = cause
295 SIO_IR to assert */
296#define KM_CSR_K_CLAMP_ONE 0x00100000 /* Pull K_CLK low after rec. one char */
297#define KM_CSR_M_CLAMP_ONE 0x00200000 /* Pull M_CLK low after rec. one char */
298#define KM_CSR_K_CLAMP_THREE 0x00400000 /* Pull K_CLK low after rec. three chars */
299#define KM_CSR_M_CLAMP_THREE 0x00800000 /* Pull M_CLK low after rec. three char */
300
301/* bitmasks for IOC3_K_RD and IOC3_M_RD */
302#define KM_RD_DATA_2 0x000000ff /* 3rd char recvd since last read */
303#define KM_RD_DATA_2_SHIFT 0
304#define KM_RD_DATA_1 0x0000ff00 /* 2nd char recvd since last read */
305#define KM_RD_DATA_1_SHIFT 8
306#define KM_RD_DATA_0 0x00ff0000 /* 1st char recvd since last read */
307#define KM_RD_DATA_0_SHIFT 16
308#define KM_RD_FRAME_ERR_2 0x01000000 /* framing or parity error in byte 2 */
309#define KM_RD_FRAME_ERR_1 0x02000000 /* same for byte 1 */
310#define KM_RD_FRAME_ERR_0 0x04000000 /* same for byte 0 */
311
312#define KM_RD_KBD_MSE 0x08000000 /* 0 if from kbd, 1 if from mouse */
313#define KM_RD_OFLO 0x10000000 /* 4th char recvd before this read */
314#define KM_RD_VALID_2 0x20000000 /* DATA_2 valid */
315#define KM_RD_VALID_1 0x40000000 /* DATA_1 valid */
316#define KM_RD_VALID_0 0x80000000 /* DATA_0 valid */
317#define KM_RD_VALID_ALL (KM_RD_VALID_0|KM_RD_VALID_1|KM_RD_VALID_2)
318
319/* bitmasks for IOC3_K_WD & IOC3_M_WD */
320#define KM_WD_WRT_DATA 0x000000ff /* write to keyboard/mouse port */
321#define KM_WD_WRT_DATA_SHIFT 0
322
323/* bitmasks for serial RX status byte */
324#define RXSB_OVERRUN 0x01 /* char(s) lost */
325#define RXSB_PAR_ERR 0x02 /* parity error */
326#define RXSB_FRAME_ERR 0x04 /* framing error */
327#define RXSB_BREAK 0x08 /* break character */
328#define RXSB_CTS 0x10 /* state of CTS */
329#define RXSB_DCD 0x20 /* state of DCD */
330#define RXSB_MODEM_VALID 0x40 /* DCD, CTS and OVERRUN are valid */
331#define RXSB_DATA_VALID 0x80 /* data byte, FRAME_ERR PAR_ERR & BREAK valid */
332
333/* bitmasks for serial TX control byte */
334#define TXCB_INT_WHEN_DONE 0x20 /* interrupt after this byte is sent */
335#define TXCB_INVALID 0x00 /* byte is invalid */
336#define TXCB_VALID 0x40 /* byte is valid */
337#define TXCB_MCR 0x80 /* data<7:0> to modem control register */
338#define TXCB_DELAY 0xc0 /* delay data<7:0> mSec */
339
340/* bitmasks for IOC3_SBBR_L */
341#define SBBR_L_SIZE 0x00000001 /* 0 == 1KB rings, 1 == 4KB rings */
342#define SBBR_L_BASE 0xfffff000 /* lower serial ring base addr */
343
344/* bitmasks for IOC3_SSCR_<A:B> */
345#define SSCR_RX_THRESHOLD 0x000001ff /* hiwater mark */
346#define SSCR_TX_TIMER_BUSY 0x00010000 /* TX timer in progress */
347#define SSCR_HFC_EN 0x00020000 /* hardware flow control enabled */
348#define SSCR_RX_RING_DCD 0x00040000 /* post RX record on delta-DCD */
349#define SSCR_RX_RING_CTS 0x00080000 /* post RX record on delta-CTS */
350#define SSCR_HIGH_SPD 0x00100000 /* 4X speed */
351#define SSCR_DIAG 0x00200000 /* bypass clock divider for sim */
352#define SSCR_RX_DRAIN 0x08000000 /* drain RX buffer to memory */
353#define SSCR_DMA_EN 0x10000000 /* enable ring buffer DMA */
354#define SSCR_DMA_PAUSE 0x20000000 /* pause DMA */
355#define SSCR_PAUSE_STATE 0x40000000 /* sets when PAUSE takes effect */
356#define SSCR_RESET 0x80000000 /* reset DMA channels */
357
358/* all producer/comsumer pointers are the same bitfield */
359#define PROD_CONS_PTR_4K 0x00000ff8 /* for 4K buffers */
360#define PROD_CONS_PTR_1K 0x000003f8 /* for 1K buffers */
361#define PROD_CONS_PTR_OFF 3
362
363/* bitmasks for IOC3_SRCIR_<A:B> */
364#define SRCIR_ARM 0x80000000 /* arm RX timer */
365
366/* bitmasks for IOC3_SRPIR_<A:B> */
367#define SRPIR_BYTE_CNT 0x07000000 /* bytes in packer */
368#define SRPIR_BYTE_CNT_SHIFT 24
369
370/* bitmasks for IOC3_STCIR_<A:B> */
371#define STCIR_BYTE_CNT 0x0f000000 /* bytes in unpacker */
372#define STCIR_BYTE_CNT_SHIFT 24
373
374/* bitmasks for IOC3_SHADOW_<A:B> */
375#define SHADOW_DR 0x00000001 /* data ready */
376#define SHADOW_OE 0x00000002 /* overrun error */
377#define SHADOW_PE 0x00000004 /* parity error */
378#define SHADOW_FE 0x00000008 /* framing error */
379#define SHADOW_BI 0x00000010 /* break interrupt */
380#define SHADOW_THRE 0x00000020 /* transmit holding register empty */
381#define SHADOW_TEMT 0x00000040 /* transmit shift register empty */
382#define SHADOW_RFCE 0x00000080 /* char in RX fifo has an error */
383#define SHADOW_DCTS 0x00010000 /* delta clear to send */
384#define SHADOW_DDCD 0x00080000 /* delta data carrier detect */
385#define SHADOW_CTS 0x00100000 /* clear to send */
386#define SHADOW_DCD 0x00800000 /* data carrier detect */
387#define SHADOW_DTR 0x01000000 /* data terminal ready */
388#define SHADOW_RTS 0x02000000 /* request to send */
389#define SHADOW_OUT1 0x04000000 /* 16550 OUT1 bit */
390#define SHADOW_OUT2 0x08000000 /* 16550 OUT2 bit */
391#define SHADOW_LOOP 0x10000000 /* loopback enabled */
392
393/* bitmasks for IOC3_SRTR_<A:B> */
394#define SRTR_CNT 0x00000fff /* reload value for RX timer */
395#define SRTR_CNT_VAL 0x0fff0000 /* current value of RX timer */
396#define SRTR_CNT_VAL_SHIFT 16
397#define SRTR_HZ 16000 /* SRTR clock frequency */
398
399/* bitmasks for IOC3_SIO_IR, IOC3_SIO_IEC and IOC3_SIO_IES */
400#define SIO_IR_SA_TX_MT 0x00000001 /* Serial port A TX empty */
401#define SIO_IR_SA_RX_FULL 0x00000002 /* port A RX buf full */
402#define SIO_IR_SA_RX_HIGH 0x00000004 /* port A RX hiwat */
403#define SIO_IR_SA_RX_TIMER 0x00000008 /* port A RX timeout */
404#define SIO_IR_SA_DELTA_DCD 0x00000010 /* port A delta DCD */
405#define SIO_IR_SA_DELTA_CTS 0x00000020 /* port A delta CTS */
406#define SIO_IR_SA_INT 0x00000040 /* port A pass-thru intr */
407#define SIO_IR_SA_TX_EXPLICIT 0x00000080 /* port A explicit TX thru */
408#define SIO_IR_SA_MEMERR 0x00000100 /* port A PCI error */
409#define SIO_IR_SB_TX_MT 0x00000200 /* */
410#define SIO_IR_SB_RX_FULL 0x00000400 /* */
411#define SIO_IR_SB_RX_HIGH 0x00000800 /* */
412#define SIO_IR_SB_RX_TIMER 0x00001000 /* */
413#define SIO_IR_SB_DELTA_DCD 0x00002000 /* */
414#define SIO_IR_SB_DELTA_CTS 0x00004000 /* */
415#define SIO_IR_SB_INT 0x00008000 /* */
416#define SIO_IR_SB_TX_EXPLICIT 0x00010000 /* */
417#define SIO_IR_SB_MEMERR 0x00020000 /* */
418#define SIO_IR_PP_INT 0x00040000 /* P port pass-thru intr */
419#define SIO_IR_PP_INTA 0x00080000 /* PP context A thru */
420#define SIO_IR_PP_INTB 0x00100000 /* PP context B thru */
421#define SIO_IR_PP_MEMERR 0x00200000 /* PP PCI error */
422#define SIO_IR_KBD_INT 0x00400000 /* kbd/mouse intr */
423#define SIO_IR_RT_INT 0x08000000 /* RT output pulse */
424#define SIO_IR_GEN_INT1 0x10000000 /* RT input pulse */
425#define SIO_IR_GEN_INT_SHIFT 28
426
427/* per device interrupt masks */
428#define SIO_IR_SA (SIO_IR_SA_TX_MT | SIO_IR_SA_RX_FULL | \
429 SIO_IR_SA_RX_HIGH | SIO_IR_SA_RX_TIMER | \
430 SIO_IR_SA_DELTA_DCD | SIO_IR_SA_DELTA_CTS | \
431 SIO_IR_SA_INT | SIO_IR_SA_TX_EXPLICIT | \
432 SIO_IR_SA_MEMERR)
433#define SIO_IR_SB (SIO_IR_SB_TX_MT | SIO_IR_SB_RX_FULL | \
434 SIO_IR_SB_RX_HIGH | SIO_IR_SB_RX_TIMER | \
435 SIO_IR_SB_DELTA_DCD | SIO_IR_SB_DELTA_CTS | \
436 SIO_IR_SB_INT | SIO_IR_SB_TX_EXPLICIT | \
437 SIO_IR_SB_MEMERR)
438#define SIO_IR_PP (SIO_IR_PP_INT | SIO_IR_PP_INTA | \
439 SIO_IR_PP_INTB | SIO_IR_PP_MEMERR)
440#define SIO_IR_RT (SIO_IR_RT_INT | SIO_IR_GEN_INT1)
441
442/* macro to load pending interrupts */
443#define IOC3_PENDING_INTRS(mem) (PCI_INW(&((mem)->sio_ir)) & \
444 PCI_INW(&((mem)->sio_ies_ro)))
445
446/* bitmasks for SIO_CR */
447#define SIO_CR_SIO_RESET 0x00000001 /* reset the SIO */
448#define SIO_CR_SER_A_BASE 0x000000fe /* DMA poll addr port A */
449#define SIO_CR_SER_A_BASE_SHIFT 1
450#define SIO_CR_SER_B_BASE 0x00007f00 /* DMA poll addr port B */
451#define SIO_CR_SER_B_BASE_SHIFT 8
452#define SIO_SR_CMD_PULSE 0x00078000 /* byte bus strobe length */
453#define SIO_CR_CMD_PULSE_SHIFT 15
454#define SIO_CR_ARB_DIAG 0x00380000 /* cur !enet PCI requet (ro) */
455#define SIO_CR_ARB_DIAG_TXA 0x00000000
456#define SIO_CR_ARB_DIAG_RXA 0x00080000
457#define SIO_CR_ARB_DIAG_TXB 0x00100000
458#define SIO_CR_ARB_DIAG_RXB 0x00180000
459#define SIO_CR_ARB_DIAG_PP 0x00200000
460#define SIO_CR_ARB_DIAG_IDLE 0x00400000 /* 0 -> active request (ro) */
461
462/* bitmasks for INT_OUT */
463#define INT_OUT_COUNT 0x0000ffff /* pulse interval timer */
464#define INT_OUT_MODE 0x00070000 /* mode mask */
465#define INT_OUT_MODE_0 0x00000000 /* set output to 0 */
466#define INT_OUT_MODE_1 0x00040000 /* set output to 1 */
467#define INT_OUT_MODE_1PULSE 0x00050000 /* send 1 pulse */
468#define INT_OUT_MODE_PULSES 0x00060000 /* send 1 pulse every interval */
469#define INT_OUT_MODE_SQW 0x00070000 /* toggle output every interval */
470#define INT_OUT_DIAG 0x40000000 /* diag mode */
471#define INT_OUT_INT_OUT 0x80000000 /* current state of INT_OUT */
472
473/* time constants for INT_OUT */
474#define INT_OUT_NS_PER_TICK (30 * 260) /* 30 ns PCI clock, divisor=260 */
475#define INT_OUT_TICKS_PER_PULSE 3 /* outgoing pulse lasts 3 ticks */
476#define INT_OUT_US_TO_COUNT(x) /* convert uS to a count value */ \
477 (((x) * 10 + INT_OUT_NS_PER_TICK / 200) * \
478 100 / INT_OUT_NS_PER_TICK - 1)
479#define INT_OUT_COUNT_TO_US(x) /* convert count value to uS */ \
480 (((x) + 1) * INT_OUT_NS_PER_TICK / 1000)
481#define INT_OUT_MIN_TICKS 3 /* min period is width of pulse in "ticks" */
482#define INT_OUT_MAX_TICKS INT_OUT_COUNT /* largest possible count */
483
484/* bitmasks for GPCR */
485#define GPCR_DIR 0x000000ff /* tristate pin input or output */
486#define GPCR_DIR_PIN(x) (1<<(x)) /* access one of the DIR bits */
487#define GPCR_EDGE 0x000f0000 /* extint edge or level sensitive */
488#define GPCR_EDGE_PIN(x) (1<<((x)+15)) /* access one of the EDGE bits */
489
490/* values for GPCR */
491#define GPCR_INT_OUT_EN 0x00100000 /* enable INT_OUT to pin 0 */
492#define GPCR_MLAN_EN 0x00200000 /* enable MCR to pin 8 */
493#define GPCR_DIR_SERA_XCVR 0x00000080 /* Port A Transceiver select enable */
494#define GPCR_DIR_SERB_XCVR 0x00000040 /* Port B Transceiver select enable */
495#define GPCR_DIR_PHY_RST 0x00000020 /* ethernet PHY reset enable */
496
497/* defs for some of the generic I/O pins */
498#define GPCR_PHY_RESET 0x20 /* pin is output to PHY reset */
499#define GPCR_UARTB_MODESEL 0x40 /* pin is output to port B mode sel */
500#define GPCR_UARTA_MODESEL 0x80 /* pin is output to port A mode sel */
501
502#define GPPR_PHY_RESET_PIN 5 /* GIO pin controlling phy reset */
503#define GPPR_UARTB_MODESEL_PIN 6 /* GIO pin controlling uart b mode select */
504#define GPPR_UARTA_MODESEL_PIN 7 /* GIO pin controlling uart a mode select */
505
506#define EMCR_DUPLEX 0x00000001
507#define EMCR_PROMISC 0x00000002
508#define EMCR_PADEN 0x00000004
509#define EMCR_RXOFF_MASK 0x000001f8
510#define EMCR_RXOFF_SHIFT 3
511#define EMCR_RAMPAR 0x00000200
512#define EMCR_BADPAR 0x00000800
513#define EMCR_BUFSIZ 0x00001000
514#define EMCR_TXDMAEN 0x00002000
515#define EMCR_TXEN 0x00004000
516#define EMCR_RXDMAEN 0x00008000
517#define EMCR_RXEN 0x00010000
518#define EMCR_LOOPBACK 0x00020000
519#define EMCR_ARB_DIAG 0x001c0000
520#define EMCR_ARB_DIAG_IDLE 0x00200000
521#define EMCR_RST 0x80000000
522
523#define EISR_RXTIMERINT 0x00000001
524#define EISR_RXTHRESHINT 0x00000002
525#define EISR_RXOFLO 0x00000004
526#define EISR_RXBUFOFLO 0x00000008
527#define EISR_RXMEMERR 0x00000010
528#define EISR_RXPARERR 0x00000020
529#define EISR_TXEMPTY 0x00010000
530#define EISR_TXRTRY 0x00020000
531#define EISR_TXEXDEF 0x00040000
532#define EISR_TXLCOL 0x00080000
533#define EISR_TXGIANT 0x00100000
534#define EISR_TXBUFUFLO 0x00200000
535#define EISR_TXEXPLICIT 0x00400000
536#define EISR_TXCOLLWRAP 0x00800000
537#define EISR_TXDEFERWRAP 0x01000000
538#define EISR_TXMEMERR 0x02000000
539#define EISR_TXPARERR 0x04000000
540
541#define ERCSR_THRESH_MASK 0x000001ff /* enet RX threshold */
542#define ERCSR_RX_TMR 0x40000000 /* simulation only */
543#define ERCSR_DIAG_OFLO 0x80000000 /* simulation only */
544
545#define ERBR_ALIGNMENT 4096
546#define ERBR_L_RXRINGBASE_MASK 0xfffff000
547
548#define ERBAR_BARRIER_BIT 0x0100
549#define ERBAR_RXBARR_MASK 0xffff0000
550#define ERBAR_RXBARR_SHIFT 16
551
552#define ERCIR_RXCONSUME_MASK 0x00000fff
553
554#define ERPIR_RXPRODUCE_MASK 0x00000fff
555#define ERPIR_ARM 0x80000000
556
557#define ERTR_CNT_MASK 0x000007ff
558
559#define ETCSR_IPGT_MASK 0x0000007f
560#define ETCSR_IPGR1_MASK 0x00007f00
561#define ETCSR_IPGR1_SHIFT 8
562#define ETCSR_IPGR2_MASK 0x007f0000
563#define ETCSR_IPGR2_SHIFT 16
564#define ETCSR_NOTXCLK 0x80000000
565
566#define ETCDC_COLLCNT_MASK 0x0000ffff
567#define ETCDC_DEFERCNT_MASK 0xffff0000
568#define ETCDC_DEFERCNT_SHIFT 16
569
570#define ETBR_ALIGNMENT (64*1024)
571#define ETBR_L_RINGSZ_MASK 0x00000001
572#define ETBR_L_RINGSZ128 0
573#define ETBR_L_RINGSZ512 1
574#define ETBR_L_TXRINGBASE_MASK 0xffffc000
575
576#define ETCIR_TXCONSUME_MASK 0x0000ffff
577#define ETCIR_IDLE 0x80000000
578
579#define ETPIR_TXPRODUCE_MASK 0x0000ffff
580
581#define EBIR_TXBUFPROD_MASK 0x0000001f
582#define EBIR_TXBUFCONS_MASK 0x00001f00
583#define EBIR_TXBUFCONS_SHIFT 8
584#define EBIR_RXBUFPROD_MASK 0x007fc000
585#define EBIR_RXBUFPROD_SHIFT 14
586#define EBIR_RXBUFCONS_MASK 0xff800000
587#define EBIR_RXBUFCONS_SHIFT 23
588
589#define MICR_REGADDR_MASK 0x0000001f
590#define MICR_PHYADDR_MASK 0x000003e0
591#define MICR_PHYADDR_SHIFT 5
592#define MICR_READTRIG 0x00000400
593#define MICR_BUSY 0x00000800
594
595#define MIDR_DATA_MASK 0x0000ffff
596
597#define ERXBUF_IPCKSUM_MASK 0x0000ffff
598#define ERXBUF_BYTECNT_MASK 0x07ff0000
599#define ERXBUF_BYTECNT_SHIFT 16
600#define ERXBUF_V 0x80000000
601
602#define ERXBUF_CRCERR 0x00000001 /* aka RSV15 */
603#define ERXBUF_FRAMERR 0x00000002 /* aka RSV14 */
604#define ERXBUF_CODERR 0x00000004 /* aka RSV13 */
605#define ERXBUF_INVPREAMB 0x00000008 /* aka RSV18 */
606#define ERXBUF_LOLEN 0x00007000 /* aka RSV2_0 */
607#define ERXBUF_HILEN 0x03ff0000 /* aka RSV12_3 */
608#define ERXBUF_MULTICAST 0x04000000 /* aka RSV16 */
609#define ERXBUF_BROADCAST 0x08000000 /* aka RSV17 */
610#define ERXBUF_LONGEVENT 0x10000000 /* aka RSV19 */
611#define ERXBUF_BADPKT 0x20000000 /* aka RSV20 */
612#define ERXBUF_GOODPKT 0x40000000 /* aka RSV21 */
613#define ERXBUF_CARRIER 0x80000000 /* aka RSV22 */
614
615#define ETXD_BYTECNT_MASK 0x000007ff /* total byte count */
616#define ETXD_INTWHENDONE 0x00001000 /* intr when done */
617#define ETXD_D0V 0x00010000 /* data 0 valid */
618#define ETXD_B1V 0x00020000 /* buf 1 valid */
619#define ETXD_B2V 0x00040000 /* buf 2 valid */
620#define ETXD_DOCHECKSUM 0x00080000 /* insert ip cksum */
621#define ETXD_CHKOFF_MASK 0x07f00000 /* cksum byte offset */
622#define ETXD_CHKOFF_SHIFT 20
623
624#define ETXD_D0CNT_MASK 0x0000007f
625#define ETXD_B1CNT_MASK 0x0007ff00
626#define ETXD_B1CNT_SHIFT 8
627#define ETXD_B2CNT_MASK 0x7ff00000
628#define ETXD_B2CNT_SHIFT 20
629
630typedef enum ioc3_subdevs_e {
631 ioc3_subdev_ether,
632 ioc3_subdev_generic,
633 ioc3_subdev_nic,
634 ioc3_subdev_kbms,
635 ioc3_subdev_ttya,
636 ioc3_subdev_ttyb,
637 ioc3_subdev_ecpp,
638 ioc3_subdev_rt,
639 ioc3_nsubdevs
640} ioc3_subdev_t;
641
642/* subdevice disable bits,
643 * from the standard INFO_LBL_SUBDEVS
644 */
645#define IOC3_SDB_ETHER (1<<ioc3_subdev_ether)
646#define IOC3_SDB_GENERIC (1<<ioc3_subdev_generic)
647#define IOC3_SDB_NIC (1<<ioc3_subdev_nic)
648#define IOC3_SDB_KBMS (1<<ioc3_subdev_kbms)
649#define IOC3_SDB_TTYA (1<<ioc3_subdev_ttya)
650#define IOC3_SDB_TTYB (1<<ioc3_subdev_ttyb)
651#define IOC3_SDB_ECPP (1<<ioc3_subdev_ecpp)
652#define IOC3_SDB_RT (1<<ioc3_subdev_rt)
653
654#define IOC3_ALL_SUBDEVS ((1<<ioc3_nsubdevs)-1)
655
656#define IOC3_SDB_SERIAL (IOC3_SDB_TTYA|IOC3_SDB_TTYB)
657
658#define IOC3_STD_SUBDEVS IOC3_ALL_SUBDEVS
659
660#define IOC3_INTA_SUBDEVS IOC3_SDB_ETHER
661#define IOC3_INTB_SUBDEVS (IOC3_SDB_GENERIC|IOC3_SDB_KBMS|IOC3_SDB_SERIAL|IOC3_SDB_ECPP|IOC3_SDB_RT)
662
663#endif /* _IOC3_H */
diff --git a/include/asm-mips/sn/klconfig.h b/include/asm-mips/sn/klconfig.h
deleted file mode 100644
index 96cfd2ab1bcd..000000000000
--- a/include/asm-mips/sn/klconfig.h
+++ /dev/null
@@ -1,898 +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 * Derived from IRIX <sys/SN/klconfig.h>.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2000 by Ralf Baechle
10 */
11#ifndef _ASM_SN_KLCONFIG_H
12#define _ASM_SN_KLCONFIG_H
13
14/*
15 * The KLCONFIG structures store info about the various BOARDs found
16 * during Hardware Discovery. In addition, it stores info about the
17 * components found on the BOARDs.
18 */
19
20/*
21 * WARNING:
22 * Certain assembly language routines (notably xxxxx.s) in the IP27PROM
23 * will depend on the format of the data structures in this file. In
24 * most cases, rearranging the fields can seriously break things.
25 * Adding fields in the beginning or middle can also break things.
26 * Add fields if necessary, to the end of a struct in such a way
27 * that offsets of existing fields do not change.
28 */
29
30#include <linux/types.h>
31#include <asm/sn/types.h>
32
33#if defined(CONFIG_SGI_IP27)
34
35#include <asm/sn/sn0/addrs.h>
36//#include <sys/SN/router.h>
37// XXX Stolen from <sys/SN/router.h>:
38#define MAX_ROUTER_PORTS (6) /* Max. number of ports on a router */
39#include <asm/sn/fru.h>
40//#include <sys/graph.h>
41//#include <sys/xtalk/xbow.h>
42
43#elif defined(CONFIG_SGI_IP35)
44
45#include <asm/sn/sn1/addrs.h>
46#include <sys/sn/router.h>
47#include <sys/graph.h>
48#include <asm/xtalk/xbow.h>
49
50#endif /* !CONFIG_SGI_IP27 && !CONFIG_SGI_IP35 */
51
52#if defined(CONFIG_SGI_IP27) || defined(CONFIG_SGI_IP35)
53#include <asm/sn/agent.h>
54#include <asm/fw/arc/types.h>
55#include <asm/fw/arc/hinv.h>
56#if defined(CONFIG_SGI_IP35)
57// The hack file has to be before vector and after sn0_fru....
58#include <asm/hack.h>
59#include <asm/sn/vector.h>
60#include <asm/xtalk/xtalk.h>
61#endif /* CONFIG_SGI_IP35 */
62#endif /* CONFIG_SGI_IP27 || CONFIG_SGI_IP35 */
63
64typedef u64 nic_t;
65
66#define KLCFGINFO_MAGIC 0xbeedbabe
67
68typedef s32 klconf_off_t;
69
70/*
71 * Some IMPORTANT OFFSETS. These are the offsets on all NODES.
72 */
73#define MAX_MODULE_ID 255
74#define SIZE_PAD 4096 /* 4k padding for structures */
75/*
76 * 1 NODE brd, 2 Router brd (1 8p, 1 meta), 6 Widgets,
77 * 2 Midplanes assuming no pci card cages
78 */
79#define MAX_SLOTS_PER_NODE (1 + 2 + 6 + 2)
80
81/* XXX if each node is guranteed to have some memory */
82
83#define MAX_PCI_DEVS 8
84
85/* lboard_t->brd_flags fields */
86/* All bits in this field are currently used. Try the pad fields if
87 you need more flag bits */
88
89#define ENABLE_BOARD 0x01
90#define FAILED_BOARD 0x02
91#define DUPLICATE_BOARD 0x04 /* Boards like midplanes/routers which
92 are discovered twice. Use one of them */
93#define VISITED_BOARD 0x08 /* Used for compact hub numbering. */
94#define LOCAL_MASTER_IO6 0x10 /* master io6 for that node */
95#define GLOBAL_MASTER_IO6 0x20
96#define THIRD_NIC_PRESENT 0x40 /* for future use */
97#define SECOND_NIC_PRESENT 0x80 /* addons like MIO are present */
98
99/* klinfo->flags fields */
100
101#define KLINFO_ENABLE 0x01 /* This component is enabled */
102#define KLINFO_FAILED 0x02 /* This component failed */
103#define KLINFO_DEVICE 0x04 /* This component is a device */
104#define KLINFO_VISITED 0x08 /* This component has been visited */
105#define KLINFO_CONTROLLER 0x10 /* This component is a device controller */
106#define KLINFO_INSTALL 0x20 /* Install a driver */
107#define KLINFO_HEADLESS 0x40 /* Headless (or hubless) component */
108#define IS_CONSOLE_IOC3(i) ((((klinfo_t *)i)->flags) & KLINFO_INSTALL)
109
110#define GB2 0x80000000
111
112#define MAX_RSV_PTRS 32
113
114/* Structures to manage various data storage areas */
115/* The numbers must be contiguous since the array index i
116 is used in the code to allocate various areas.
117*/
118
119#define BOARD_STRUCT 0
120#define COMPONENT_STRUCT 1
121#define ERRINFO_STRUCT 2
122#define KLMALLOC_TYPE_MAX (ERRINFO_STRUCT + 1)
123#define DEVICE_STRUCT 3
124
125
126typedef struct console_s {
127 unsigned long uart_base;
128 unsigned long config_base;
129 unsigned long memory_base;
130 short baud;
131 short flag;
132 int type;
133 nasid_t nasid;
134 char wid;
135 char npci;
136 nic_t baseio_nic;
137} console_t;
138
139typedef struct klc_malloc_hdr {
140 klconf_off_t km_base;
141 klconf_off_t km_limit;
142 klconf_off_t km_current;
143} klc_malloc_hdr_t;
144
145/* Functions/macros needed to use this structure */
146
147typedef struct kl_config_hdr {
148 u64 ch_magic; /* set this to KLCFGINFO_MAGIC */
149 u32 ch_version; /* structure version number */
150 klconf_off_t ch_malloc_hdr_off; /* offset of ch_malloc_hdr */
151 klconf_off_t ch_cons_off; /* offset of ch_cons */
152 klconf_off_t ch_board_info; /* the link list of boards */
153 console_t ch_cons_info; /* address info of the console */
154 klc_malloc_hdr_t ch_malloc_hdr[KLMALLOC_TYPE_MAX];
155 confidence_t ch_sw_belief; /* confidence that software is bad*/
156 confidence_t ch_sn0net_belief; /* confidence that sn0net is bad */
157} kl_config_hdr_t;
158
159
160#define KL_CONFIG_HDR(_nasid) ((kl_config_hdr_t *)(KLCONFIG_ADDR(_nasid)))
161#define KL_CONFIG_INFO_OFFSET(_nasid) \
162 (KL_CONFIG_HDR(_nasid)->ch_board_info)
163#define KL_CONFIG_INFO_SET_OFFSET(_nasid, _off) \
164 (KL_CONFIG_HDR(_nasid)->ch_board_info = (_off))
165
166#define KL_CONFIG_INFO(_nasid) \
167 (lboard_t *)((KL_CONFIG_HDR(_nasid)->ch_board_info) ? \
168 NODE_OFFSET_TO_K1((_nasid), KL_CONFIG_HDR(_nasid)->ch_board_info) : \
169 0)
170#define KL_CONFIG_MAGIC(_nasid) (KL_CONFIG_HDR(_nasid)->ch_magic)
171
172#define KL_CONFIG_CHECK_MAGIC(_nasid) \
173 (KL_CONFIG_HDR(_nasid)->ch_magic == KLCFGINFO_MAGIC)
174
175#define KL_CONFIG_HDR_INIT_MAGIC(_nasid) \
176 (KL_CONFIG_HDR(_nasid)->ch_magic = KLCFGINFO_MAGIC)
177
178/* --- New Macros for the changed kl_config_hdr_t structure --- */
179
180#define PTR_CH_MALLOC_HDR(_k) ((klc_malloc_hdr_t *)\
181 ((unsigned long)_k + (_k->ch_malloc_hdr_off)))
182
183#define KL_CONFIG_CH_MALLOC_HDR(_n) PTR_CH_MALLOC_HDR(KL_CONFIG_HDR(_n))
184
185#define PTR_CH_CONS_INFO(_k) ((console_t *)\
186 ((unsigned long)_k + (_k->ch_cons_off)))
187
188#define KL_CONFIG_CH_CONS_INFO(_n) PTR_CH_CONS_INFO(KL_CONFIG_HDR(_n))
189
190/* ------------------------------------------------------------- */
191
192#define KL_CONFIG_INFO_START(_nasid) \
193 (klconf_off_t)(KLCONFIG_OFFSET(_nasid) + sizeof(kl_config_hdr_t))
194
195#define KL_CONFIG_BOARD_NASID(_brd) ((_brd)->brd_nasid)
196#define KL_CONFIG_BOARD_SET_NEXT(_brd, _off) ((_brd)->brd_next = (_off))
197
198#define KL_CONFIG_DUPLICATE_BOARD(_brd) ((_brd)->brd_flags & DUPLICATE_BOARD)
199
200#define XBOW_PORT_TYPE_HUB(_xbowp, _link) \
201 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_HUB)
202#define XBOW_PORT_TYPE_IO(_xbowp, _link) \
203 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_IO)
204
205#define XBOW_PORT_IS_ENABLED(_xbowp, _link) \
206 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_flag & XBOW_PORT_ENABLE)
207#define XBOW_PORT_NASID(_xbowp, _link) \
208 ((_xbowp)->xbow_port_info[(_link) - BASE_XBOW_PORT].port_nasid)
209
210#define XBOW_PORT_IO 0x1
211#define XBOW_PORT_HUB 0x2
212#define XBOW_PORT_ENABLE 0x4
213
214#define SN0_PORT_FENCE_SHFT 0
215#define SN0_PORT_FENCE_MASK (1 << SN0_PORT_FENCE_SHFT)
216
217/*
218 * The KLCONFIG area is organized as a LINKED LIST of BOARDs. A BOARD
219 * can be either 'LOCAL' or 'REMOTE'. LOCAL means it is attached to
220 * the LOCAL/current NODE. REMOTE means it is attached to a different
221 * node.(TBD - Need a way to treat ROUTER boards.)
222 *
223 * There are 2 different structures to represent these boards -
224 * lboard - Local board, rboard - remote board. These 2 structures
225 * can be arbitrarily mixed in the LINKED LIST of BOARDs. (Refer
226 * Figure below). The first byte of the rboard or lboard structure
227 * is used to find out its type - no unions are used.
228 * If it is a lboard, then the config info of this board will be found
229 * on the local node. (LOCAL NODE BASE + offset value gives pointer to
230 * the structure.
231 * If it is a rboard, the local structure contains the node number
232 * and the offset of the beginning of the LINKED LIST on the remote node.
233 * The details of the hardware on a remote node can be built locally,
234 * if required, by reading the LINKED LIST on the remote node and
235 * ignoring all the rboards on that node.
236 *
237 * The local node uses the REMOTE NODE NUMBER + OFFSET to point to the
238 * First board info on the remote node. The remote node list is
239 * traversed as the local list, using the REMOTE BASE ADDRESS and not
240 * the local base address and ignoring all rboard values.
241 *
242 *
243 KLCONFIG
244
245 +------------+ +------------+ +------------+ +------------+
246 | lboard | +-->| lboard | +-->| rboard | +-->| lboard |
247 +------------+ | +------------+ | +------------+ | +------------+
248 | board info | | | board info | | |errinfo,bptr| | | board info |
249 +------------+ | +------------+ | +------------+ | +------------+
250 | offset |--+ | offset |--+ | offset |--+ |offset=NULL |
251 +------------+ +------------+ +------------+ +------------+
252
253
254 +------------+
255 | board info |
256 +------------+ +--------------------------------+
257 | compt 1 |------>| type, rev, diaginfo, size ... | (CPU)
258 +------------+ +--------------------------------+
259 | compt 2 |--+
260 +------------+ | +--------------------------------+
261 | ... | +--->| type, rev, diaginfo, size ... | (MEM_BANK)
262 +------------+ +--------------------------------+
263 | errinfo |--+
264 +------------+ | +--------------------------------+
265 +--->|r/l brd errinfo,compt err flags |
266 +--------------------------------+
267
268 *
269 * Each BOARD consists of COMPONENTs and the BOARD structure has
270 * pointers (offsets) to its COMPONENT structure.
271 * The COMPONENT structure has version info, size and speed info, revision,
272 * error info and the NIC info. This structure can accommodate any
273 * BOARD with arbitrary COMPONENT composition.
274 *
275 * The ERRORINFO part of each BOARD has error information
276 * that describes errors about the BOARD itself. It also has flags to
277 * indicate the COMPONENT(s) on the board that have errors. The error
278 * information specific to the COMPONENT is present in the respective
279 * COMPONENT structure.
280 *
281 * The ERRORINFO structure is also treated like a COMPONENT, ie. the
282 * BOARD has pointers(offset) to the ERRORINFO structure. The rboard
283 * structure also has a pointer to the ERRORINFO structure. This is
284 * the place to store ERRORINFO about a REMOTE NODE, if the HUB on
285 * that NODE is not working or if the REMOTE MEMORY is BAD. In cases where
286 * only the CPU of the REMOTE NODE is disabled, the ERRORINFO pointer can
287 * be a NODE NUMBER, REMOTE OFFSET combination, pointing to error info
288 * which is present on the REMOTE NODE.(TBD)
289 * REMOTE ERRINFO can be stored on any of the nearest nodes
290 * or on all the nearest nodes.(TBD)
291 * Like BOARD structures, REMOTE ERRINFO structures can be built locally
292 * using the rboard errinfo pointer.
293 *
294 * In order to get useful information from this Data organization, a set of
295 * interface routines are provided (TBD). The important thing to remember while
296 * manipulating the structures, is that, the NODE number information should
297 * be used. If the NODE is non-zero (remote) then each offset should
298 * be added to the REMOTE BASE ADDR else it should be added to the LOCAL BASE ADDR.
299 * This includes offsets for BOARDS, COMPONENTS and ERRORINFO.
300 *
301 * Note that these structures do not provide much info about connectivity.
302 * That info will be part of HWGRAPH, which is an extension of the cfg_t
303 * data structure. (ref IP27prom/cfg.h) It has to be extended to include
304 * the IO part of the Network(TBD).
305 *
306 * The data structures below define the above concepts.
307 */
308
309/*
310 * Values for CPU types
311 */
312#define KL_CPU_R4000 0x1 /* Standard R4000 */
313#define KL_CPU_TFP 0x2 /* TFP processor */
314#define KL_CPU_R10000 0x3 /* R10000 (T5) */
315#define KL_CPU_NONE (-1) /* no cpu present in slot */
316
317/*
318 * IP27 BOARD classes
319 */
320
321#define KLCLASS_MASK 0xf0
322#define KLCLASS_NONE 0x00
323#define KLCLASS_NODE 0x10 /* CPU, Memory and HUB board */
324#define KLCLASS_CPU KLCLASS_NODE
325#define KLCLASS_IO 0x20 /* BaseIO, 4 ch SCSI, ethernet, FDDI
326 and the non-graphics widget boards */
327#define KLCLASS_ROUTER 0x30 /* Router board */
328#define KLCLASS_MIDPLANE 0x40 /* We need to treat this as a board
329 so that we can record error info */
330#define KLCLASS_GFX 0x50 /* graphics boards */
331
332#define KLCLASS_PSEUDO_GFX 0x60 /* HDTV type cards that use a gfx
333 * hw ifc to xtalk and are not gfx
334 * class for sw purposes */
335
336#define KLCLASS_MAX 7 /* Bump this if a new CLASS is added */
337#define KLTYPE_MAX 10 /* Bump this if a new CLASS is added */
338
339#define KLCLASS_UNKNOWN 0xf0
340
341#define KLCLASS(_x) ((_x) & KLCLASS_MASK)
342
343/*
344 * IP27 board types
345 */
346
347#define KLTYPE_MASK 0x0f
348#define KLTYPE_NONE 0x00
349#define KLTYPE_EMPTY 0x00
350
351#define KLTYPE_WEIRDCPU (KLCLASS_CPU | 0x0)
352#define KLTYPE_IP27 (KLCLASS_CPU | 0x1) /* 2 CPUs(R10K) per board */
353
354#define KLTYPE_WEIRDIO (KLCLASS_IO | 0x0)
355#define KLTYPE_BASEIO (KLCLASS_IO | 0x1) /* IOC3, SuperIO, Bridge, SCSI */
356#define KLTYPE_IO6 KLTYPE_BASEIO /* Additional name */
357#define KLTYPE_4CHSCSI (KLCLASS_IO | 0x2)
358#define KLTYPE_MSCSI KLTYPE_4CHSCSI /* Additional name */
359#define KLTYPE_ETHERNET (KLCLASS_IO | 0x3)
360#define KLTYPE_MENET KLTYPE_ETHERNET /* Additional name */
361#define KLTYPE_FDDI (KLCLASS_IO | 0x4)
362#define KLTYPE_UNUSED (KLCLASS_IO | 0x5) /* XXX UNUSED */
363#define KLTYPE_HAROLD (KLCLASS_IO | 0x6) /* PCI SHOE BOX */
364#define KLTYPE_PCI KLTYPE_HAROLD
365#define KLTYPE_VME (KLCLASS_IO | 0x7) /* Any 3rd party VME card */
366#define KLTYPE_MIO (KLCLASS_IO | 0x8)
367#define KLTYPE_FC (KLCLASS_IO | 0x9)
368#define KLTYPE_LINC (KLCLASS_IO | 0xA)
369#define KLTYPE_TPU (KLCLASS_IO | 0xB) /* Tensor Processing Unit */
370#define KLTYPE_GSN_A (KLCLASS_IO | 0xC) /* Main GSN board */
371#define KLTYPE_GSN_B (KLCLASS_IO | 0xD) /* Auxiliary GSN board */
372
373#define KLTYPE_GFX (KLCLASS_GFX | 0x0) /* unknown graphics type */
374#define KLTYPE_GFX_KONA (KLCLASS_GFX | 0x1) /* KONA graphics on IP27 */
375#define KLTYPE_GFX_MGRA (KLCLASS_GFX | 0x3) /* MGRAS graphics on IP27 */
376
377#define KLTYPE_WEIRDROUTER (KLCLASS_ROUTER | 0x0)
378#define KLTYPE_ROUTER (KLCLASS_ROUTER | 0x1)
379#define KLTYPE_ROUTER2 KLTYPE_ROUTER /* Obsolete! */
380#define KLTYPE_NULL_ROUTER (KLCLASS_ROUTER | 0x2)
381#define KLTYPE_META_ROUTER (KLCLASS_ROUTER | 0x3)
382
383#define KLTYPE_WEIRDMIDPLANE (KLCLASS_MIDPLANE | 0x0)
384#define KLTYPE_MIDPLANE8 (KLCLASS_MIDPLANE | 0x1) /* 8 slot backplane */
385#define KLTYPE_MIDPLANE KLTYPE_MIDPLANE8
386#define KLTYPE_PBRICK_XBOW (KLCLASS_MIDPLANE | 0x2)
387
388#define KLTYPE_IOBRICK (KLCLASS_IOBRICK | 0x0)
389#define KLTYPE_IBRICK (KLCLASS_IOBRICK | 0x1)
390#define KLTYPE_PBRICK (KLCLASS_IOBRICK | 0x2)
391#define KLTYPE_XBRICK (KLCLASS_IOBRICK | 0x3)
392
393#define KLTYPE_PBRICK_BRIDGE KLTYPE_PBRICK
394
395/* The value of type should be more than 8 so that hinv prints
396 * out the board name from the NIC string. For values less than
397 * 8 the name of the board needs to be hard coded in a few places.
398 * When bringup started nic names had not standardized and so we
399 * had to hard code. (For people interested in history.)
400 */
401#define KLTYPE_XTHD (KLCLASS_PSEUDO_GFX | 0x9)
402
403#define KLTYPE_UNKNOWN (KLCLASS_UNKNOWN | 0xf)
404
405#define KLTYPE(_x) ((_x) & KLTYPE_MASK)
406#define IS_MIO_PRESENT(l) ((l->brd_type == KLTYPE_BASEIO) && \
407 (l->brd_flags & SECOND_NIC_PRESENT))
408#define IS_MIO_IOC3(l, n) (IS_MIO_PRESENT(l) && (n > 2))
409
410/*
411 * board structures
412 */
413
414#define MAX_COMPTS_PER_BRD 24
415
416#define LOCAL_BOARD 1
417#define REMOTE_BOARD 2
418
419#define LBOARD_STRUCT_VERSION 2
420
421typedef struct lboard_s {
422 klconf_off_t brd_next; /* Next BOARD */
423 unsigned char struct_type; /* type of structure, local or remote */
424 unsigned char brd_type; /* type+class */
425 unsigned char brd_sversion; /* version of this structure */
426 unsigned char brd_brevision; /* board revision */
427 unsigned char brd_promver; /* board prom version, if any */
428 unsigned char brd_flags; /* Enabled, Disabled etc */
429 unsigned char brd_slot; /* slot number */
430 unsigned short brd_debugsw; /* Debug switches */
431 moduleid_t brd_module; /* module to which it belongs */
432 partid_t brd_partition; /* Partition number */
433 unsigned short brd_diagval; /* diagnostic value */
434 unsigned short brd_diagparm; /* diagnostic parameter */
435 unsigned char brd_inventory; /* inventory history */
436 unsigned char brd_numcompts; /* Number of components */
437 nic_t brd_nic; /* Number in CAN */
438 nasid_t brd_nasid; /* passed parameter */
439 klconf_off_t brd_compts[MAX_COMPTS_PER_BRD]; /* pointers to COMPONENTS */
440 klconf_off_t brd_errinfo; /* Board's error information */
441 struct lboard_s *brd_parent; /* Logical parent for this brd */
442 vertex_hdl_t brd_graph_link; /* vertex hdl to connect extern compts */
443 confidence_t brd_confidence; /* confidence that the board is bad */
444 nasid_t brd_owner; /* who owns this board */
445 unsigned char brd_nic_flags; /* To handle 8 more NICs */
446 char brd_name[32];
447} lboard_t;
448
449
450/*
451 * Make sure we pass back the calias space address for local boards.
452 * klconfig board traversal and error structure extraction defines.
453 */
454
455#define BOARD_SLOT(_brd) ((_brd)->brd_slot)
456
457#define KLCF_CLASS(_brd) KLCLASS((_brd)->brd_type)
458#define KLCF_TYPE(_brd) KLTYPE((_brd)->brd_type)
459#define KLCF_REMOTE(_brd) (((_brd)->struct_type & LOCAL_BOARD) ? 0 : 1)
460#define KLCF_NUM_COMPS(_brd) ((_brd)->brd_numcompts)
461#define KLCF_MODULE_ID(_brd) ((_brd)->brd_module)
462
463#define KLCF_NEXT(_brd) \
464 ((_brd)->brd_next ? \
465 (lboard_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), (_brd)->brd_next)):\
466 NULL)
467#define KLCF_COMP(_brd, _ndx) \
468 (klinfo_t *)(NODE_OFFSET_TO_K1(NASID_GET(_brd), \
469 (_brd)->brd_compts[(_ndx)]))
470
471#define KLCF_COMP_ERROR(_brd, _comp) \
472 (NODE_OFFSET_TO_K1(NASID_GET(_brd), (_comp)->errinfo))
473
474#define KLCF_COMP_TYPE(_comp) ((_comp)->struct_type)
475#define KLCF_BRIDGE_W_ID(_comp) ((_comp)->physid) /* Widget ID */
476
477
478
479/*
480 * Generic info structure. This stores common info about a
481 * component.
482 */
483
484typedef struct klinfo_s { /* Generic info */
485 unsigned char struct_type; /* type of this structure */
486 unsigned char struct_version; /* version of this structure */
487 unsigned char flags; /* Enabled, disabled etc */
488 unsigned char revision; /* component revision */
489 unsigned short diagval; /* result of diagnostics */
490 unsigned short diagparm; /* diagnostic parameter */
491 unsigned char inventory; /* previous inventory status */
492 nic_t nic; /* MUst be aligned properly */
493 unsigned char physid; /* physical id of component */
494 unsigned int virtid; /* virtual id as seen by system */
495 unsigned char widid; /* Widget id - if applicable */
496 nasid_t nasid; /* node number - from parent */
497 char pad1; /* pad out structure. */
498 char pad2; /* pad out structure. */
499 COMPONENT *arcs_compt; /* ptr to the arcs struct for ease*/
500 klconf_off_t errinfo; /* component specific errors */
501 unsigned short pad3; /* pci fields have moved over to */
502 unsigned short pad4; /* klbri_t */
503} klinfo_t ;
504
505#define KLCONFIG_INFO_ENABLED(_i) ((_i)->flags & KLINFO_ENABLE)
506/*
507 * Component structures.
508 * Following are the currently identified components:
509 * CPU, HUB, MEM_BANK,
510 * XBOW(consists of 16 WIDGETs, each of which can be HUB or GRAPHICS or BRIDGE)
511 * BRIDGE, IOC3, SuperIO, SCSI, FDDI
512 * ROUTER
513 * GRAPHICS
514 */
515#define KLSTRUCT_UNKNOWN 0
516#define KLSTRUCT_CPU 1
517#define KLSTRUCT_HUB 2
518#define KLSTRUCT_MEMBNK 3
519#define KLSTRUCT_XBOW 4
520#define KLSTRUCT_BRI 5
521#define KLSTRUCT_IOC3 6
522#define KLSTRUCT_PCI 7
523#define KLSTRUCT_VME 8
524#define KLSTRUCT_ROU 9
525#define KLSTRUCT_GFX 10
526#define KLSTRUCT_SCSI 11
527#define KLSTRUCT_FDDI 12
528#define KLSTRUCT_MIO 13
529#define KLSTRUCT_DISK 14
530#define KLSTRUCT_TAPE 15
531#define KLSTRUCT_CDROM 16
532#define KLSTRUCT_HUB_UART 17
533#define KLSTRUCT_IOC3ENET 18
534#define KLSTRUCT_IOC3UART 19
535#define KLSTRUCT_UNUSED 20 /* XXX UNUSED */
536#define KLSTRUCT_IOC3PCKM 21
537#define KLSTRUCT_RAD 22
538#define KLSTRUCT_HUB_TTY 23
539#define KLSTRUCT_IOC3_TTY 24
540
541/* Early Access IO proms are compatible
542 only with KLSTRUCT values upto 24. */
543
544#define KLSTRUCT_FIBERCHANNEL 25
545#define KLSTRUCT_MOD_SERIAL_NUM 26
546#define KLSTRUCT_IOC3MS 27
547#define KLSTRUCT_TPU 28
548#define KLSTRUCT_GSN_A 29
549#define KLSTRUCT_GSN_B 30
550#define KLSTRUCT_XTHD 31
551
552/*
553 * These are the indices of various components within a lboard structure.
554 */
555
556#define IP27_CPU0_INDEX 0
557#define IP27_CPU1_INDEX 1
558#define IP27_HUB_INDEX 2
559#define IP27_MEM_INDEX 3
560
561#define BASEIO_BRIDGE_INDEX 0
562#define BASEIO_IOC3_INDEX 1
563#define BASEIO_SCSI1_INDEX 2
564#define BASEIO_SCSI2_INDEX 3
565
566#define MIDPLANE_XBOW_INDEX 0
567#define ROUTER_COMPONENT_INDEX 0
568
569#define CH4SCSI_BRIDGE_INDEX 0
570
571/* Info holders for various hardware components */
572
573typedef u64 *pci_t;
574typedef u64 *vmeb_t;
575typedef u64 *vmed_t;
576typedef u64 *fddi_t;
577typedef u64 *scsi_t;
578typedef u64 *mio_t;
579typedef u64 *graphics_t;
580typedef u64 *router_t;
581
582/*
583 * The port info in ip27_cfg area translates to a lboart_t in the
584 * KLCONFIG area. But since KLCONFIG does not use pointers, lboart_t
585 * is stored in terms of a nasid and a offset from start of KLCONFIG
586 * area on that nasid.
587 */
588typedef struct klport_s {
589 nasid_t port_nasid;
590 unsigned char port_flag;
591 klconf_off_t port_offset;
592} klport_t;
593
594typedef struct klcpu_s { /* CPU */
595 klinfo_t cpu_info;
596 unsigned short cpu_prid; /* Processor PRID value */
597 unsigned short cpu_fpirr; /* FPU IRR value */
598 unsigned short cpu_speed; /* Speed in MHZ */
599 unsigned short cpu_scachesz; /* secondary cache size in MB */
600 unsigned short cpu_scachespeed;/* secondary cache speed in MHz */
601} klcpu_t ;
602
603#define CPU_STRUCT_VERSION 2
604
605typedef struct klhub_s { /* HUB */
606 klinfo_t hub_info;
607 unsigned int hub_flags; /* PCFG_HUB_xxx flags */
608 klport_t hub_port; /* hub is connected to this */
609 nic_t hub_box_nic; /* nic of containing box */
610 klconf_off_t hub_mfg_nic; /* MFG NIC string */
611 u64 hub_speed; /* Speed of hub in HZ */
612} klhub_t ;
613
614typedef struct klhub_uart_s { /* HUB */
615 klinfo_t hubuart_info;
616 unsigned int hubuart_flags; /* PCFG_HUB_xxx flags */
617 nic_t hubuart_box_nic; /* nic of containing box */
618} klhub_uart_t ;
619
620#define MEMORY_STRUCT_VERSION 2
621
622typedef struct klmembnk_s { /* MEMORY BANK */
623 klinfo_t membnk_info;
624 short membnk_memsz; /* Total memory in megabytes */
625 short membnk_dimm_select; /* bank to physical addr mapping*/
626 short membnk_bnksz[MD_MEM_BANKS]; /* Memory bank sizes */
627 short membnk_attr;
628} klmembnk_t ;
629
630#define KLCONFIG_MEMBNK_SIZE(_info, _bank) \
631 ((_info)->membnk_bnksz[(_bank)])
632
633
634#define MEMBNK_PREMIUM 1
635#define KLCONFIG_MEMBNK_PREMIUM(_info, _bank) \
636 ((_info)->membnk_attr & (MEMBNK_PREMIUM << (_bank)))
637
638#define MAX_SERIAL_NUM_SIZE 10
639
640typedef struct klmod_serial_num_s {
641 klinfo_t snum_info;
642 union {
643 char snum_str[MAX_SERIAL_NUM_SIZE];
644 unsigned long long snum_int;
645 } snum;
646} klmod_serial_num_t;
647
648/* Macros needed to access serial number structure in lboard_t.
649 Hard coded values are necessary since we cannot treat
650 serial number struct as a component without losing compatibility
651 between prom versions. */
652
653#define GET_SNUM_COMP(_l) ((klmod_serial_num_t *)\
654 KLCF_COMP(_l, _l->brd_numcompts))
655
656#define MAX_XBOW_LINKS 16
657
658typedef struct klxbow_s { /* XBOW */
659 klinfo_t xbow_info ;
660 klport_t xbow_port_info[MAX_XBOW_LINKS] ; /* Module number */
661 int xbow_master_hub_link;
662 /* type of brd connected+component struct ptr+flags */
663} klxbow_t ;
664
665#define MAX_PCI_SLOTS 8
666
667typedef struct klpci_device_s {
668 s32 pci_device_id; /* 32 bits of vendor/device ID. */
669 s32 pci_device_pad; /* 32 bits of padding. */
670} klpci_device_t;
671
672#define BRIDGE_STRUCT_VERSION 2
673
674typedef struct klbri_s { /* BRIDGE */
675 klinfo_t bri_info ;
676 unsigned char bri_eprominfo ; /* IO6prom connected to bridge */
677 unsigned char bri_bustype ; /* PCI/VME BUS bridge/GIO */
678 pci_t pci_specific ; /* PCI Board config info */
679 klpci_device_t bri_devices[MAX_PCI_DEVS] ; /* PCI IDs */
680 klconf_off_t bri_mfg_nic ;
681} klbri_t ;
682
683#define MAX_IOC3_TTY 2
684
685typedef struct klioc3_s { /* IOC3 */
686 klinfo_t ioc3_info ;
687 unsigned char ioc3_ssram ; /* Info about ssram */
688 unsigned char ioc3_nvram ; /* Info about nvram */
689 klinfo_t ioc3_superio ; /* Info about superio */
690 klconf_off_t ioc3_tty_off ;
691 klinfo_t ioc3_enet ;
692 klconf_off_t ioc3_enet_off ;
693 klconf_off_t ioc3_kbd_off ;
694} klioc3_t ;
695
696#define MAX_VME_SLOTS 8
697
698typedef struct klvmeb_s { /* VME BRIDGE - PCI CTLR */
699 klinfo_t vmeb_info ;
700 vmeb_t vmeb_specific ;
701 klconf_off_t vmeb_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
702} klvmeb_t ;
703
704typedef struct klvmed_s { /* VME DEVICE - VME BOARD */
705 klinfo_t vmed_info ;
706 vmed_t vmed_specific ;
707 klconf_off_t vmed_brdinfo[MAX_VME_SLOTS] ; /* VME Board config info */
708} klvmed_t ;
709
710#define ROUTER_VECTOR_VERS 2
711
712/* XXX - Don't we need the number of ports here?!? */
713typedef struct klrou_s { /* ROUTER */
714 klinfo_t rou_info ;
715 unsigned int rou_flags ; /* PCFG_ROUTER_xxx flags */
716 nic_t rou_box_nic ; /* nic of the containing module */
717 klport_t rou_port[MAX_ROUTER_PORTS + 1] ; /* array index 1 to 6 */
718 klconf_off_t rou_mfg_nic ; /* MFG NIC string */
719 u64 rou_vector; /* vector from master node */
720} klrou_t ;
721
722/*
723 * Graphics Controller/Device
724 *
725 * (IP27/IO6) Prom versions 6.13 (and 6.5.1 kernels) and earlier
726 * used a couple different structures to store graphics information.
727 * For compatibility reasons, the newer data structure preserves some
728 * of the layout so that fields that are used in the old versions remain
729 * in the same place (with the same info). Determination of what version
730 * of this structure we have is done by checking the cookie field.
731 */
732#define KLGFX_COOKIE 0x0c0de000
733
734typedef struct klgfx_s { /* GRAPHICS Device */
735 klinfo_t gfx_info;
736 klconf_off_t old_gndevs; /* for compatibility with older proms */
737 klconf_off_t old_gdoff0; /* for compatibility with older proms */
738 unsigned int cookie; /* for compatibility with older proms */
739 unsigned int moduleslot;
740 struct klgfx_s *gfx_next_pipe;
741 graphics_t gfx_specific;
742 klconf_off_t pad0; /* for compatibility with older proms */
743 klconf_off_t gfx_mfg_nic;
744} klgfx_t;
745
746typedef struct klxthd_s {
747 klinfo_t xthd_info ;
748 klconf_off_t xthd_mfg_nic ; /* MFG NIC string */
749} klxthd_t ;
750
751typedef struct kltpu_s { /* TPU board */
752 klinfo_t tpu_info ;
753 klconf_off_t tpu_mfg_nic ; /* MFG NIC string */
754} kltpu_t ;
755
756typedef struct klgsn_s { /* GSN board */
757 klinfo_t gsn_info ;
758 klconf_off_t gsn_mfg_nic ; /* MFG NIC string */
759} klgsn_t ;
760
761#define MAX_SCSI_DEVS 16
762
763/*
764 * NOTE: THis is the max sized kl* structure and is used in klmalloc.c
765 * to allocate space of type COMPONENT. Make sure that if the size of
766 * any other component struct becomes more than this, then redefine
767 * that as the size to be klmalloced.
768 */
769
770typedef struct klscsi_s { /* SCSI Controller */
771 klinfo_t scsi_info ;
772 scsi_t scsi_specific ;
773 unsigned char scsi_numdevs ;
774 klconf_off_t scsi_devinfo[MAX_SCSI_DEVS] ;
775} klscsi_t ;
776
777typedef struct klscdev_s { /* SCSI device */
778 klinfo_t scdev_info ;
779 struct scsidisk_data *scdev_cfg ; /* driver fills up this */
780} klscdev_t ;
781
782typedef struct klttydev_s { /* TTY device */
783 klinfo_t ttydev_info ;
784 struct terminal_data *ttydev_cfg ; /* driver fills up this */
785} klttydev_t ;
786
787typedef struct klenetdev_s { /* ENET device */
788 klinfo_t enetdev_info ;
789 struct net_data *enetdev_cfg ; /* driver fills up this */
790} klenetdev_t ;
791
792typedef struct klkbddev_s { /* KBD device */
793 klinfo_t kbddev_info ;
794 struct keyboard_data *kbddev_cfg ; /* driver fills up this */
795} klkbddev_t ;
796
797typedef struct klmsdev_s { /* mouse device */
798 klinfo_t msdev_info ;
799 void *msdev_cfg ;
800} klmsdev_t ;
801
802#define MAX_FDDI_DEVS 10 /* XXX Is this true */
803
804typedef struct klfddi_s { /* FDDI */
805 klinfo_t fddi_info ;
806 fddi_t fddi_specific ;
807 klconf_off_t fddi_devinfo[MAX_FDDI_DEVS] ;
808} klfddi_t ;
809
810typedef struct klmio_s { /* MIO */
811 klinfo_t mio_info ;
812 mio_t mio_specific ;
813} klmio_t ;
814
815
816typedef union klcomp_s {
817 klcpu_t kc_cpu;
818 klhub_t kc_hub;
819 klmembnk_t kc_mem;
820 klxbow_t kc_xbow;
821 klbri_t kc_bri;
822 klioc3_t kc_ioc3;
823 klvmeb_t kc_vmeb;
824 klvmed_t kc_vmed;
825 klrou_t kc_rou;
826 klgfx_t kc_gfx;
827 klscsi_t kc_scsi;
828 klscdev_t kc_scsi_dev;
829 klfddi_t kc_fddi;
830 klmio_t kc_mio;
831 klmod_serial_num_t kc_snum ;
832} klcomp_t;
833
834typedef union kldev_s { /* for device structure allocation */
835 klscdev_t kc_scsi_dev ;
836 klttydev_t kc_tty_dev ;
837 klenetdev_t kc_enet_dev ;
838 klkbddev_t kc_kbd_dev ;
839} kldev_t ;
840
841/* Data structure interface routines. TBD */
842
843/* Include launch info in this file itself? TBD */
844
845/*
846 * TBD - Can the ARCS and device driver related info also be included in the
847 * KLCONFIG area. On the IO4PROM, prom device driver info is part of cfgnode_t
848 * structure, viz private to the IO4prom.
849 */
850
851/*
852 * TBD - Allocation issues.
853 *
854 * Do we need to Mark off sepatate heaps for lboard_t, rboard_t, component,
855 * errinfo and allocate from them, or have a single heap and allocate all
856 * structures from it. Debug is easier in the former method since we can
857 * dump all similar structs in one command, but there will be lots of holes,
858 * in memory and max limits are needed for number of structures.
859 * Another way to make it organized, is to have a union of all components
860 * and allocate a aligned chunk of memory greater than the biggest
861 * component.
862 */
863
864typedef union {
865 lboard_t *lbinfo ;
866} biptr_t ;
867
868
869#define BRI_PER_XBOW 6
870#define PCI_PER_BRI 8
871#define DEV_PER_PCI 16
872
873
874/* Virtual dipswitch values (starting from switch "7"): */
875
876#define VDS_NOGFX 0x8000 /* Don't enable gfx and autoboot */
877#define VDS_NOMP 0x100 /* Don't start slave processors */
878#define VDS_MANUMODE 0x80 /* Manufacturing mode */
879#define VDS_NOARB 0x40 /* No bootmaster arbitration */
880#define VDS_PODMODE 0x20 /* Go straight to POD mode */
881#define VDS_NO_DIAGS 0x10 /* Don't run any diags after BM arb */
882#define VDS_DEFAULTS 0x08 /* Use default environment values */
883#define VDS_NOMEMCLEAR 0x04 /* Don't run mem cfg code */
884#define VDS_2ND_IO4 0x02 /* Boot from the second IO4 */
885#define VDS_DEBUG_PROM 0x01 /* Print PROM debugging messages */
886
887/* external declarations of Linux kernel functions. */
888
889extern lboard_t *find_lboard(lboard_t *start, unsigned char type);
890extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type);
891extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type);
892extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int);
893extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class);
894
895
896extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu);
897
898#endif /* _ASM_SN_KLCONFIG_H */
diff --git a/include/asm-mips/sn/kldir.h b/include/asm-mips/sn/kldir.h
deleted file mode 100644
index 1327e12e9645..000000000000
--- a/include/asm-mips/sn/kldir.h
+++ /dev/null
@@ -1,217 +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 * Derived from IRIX <sys/SN/kldir.h>, revision 1.21.
7 *
8 * Copyright (C) 1992 - 1997, 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2000 by Ralf Baechle
10 */
11#ifndef _ASM_SN_KLDIR_H
12#define _ASM_SN_KLDIR_H
13
14
15/*
16 * The kldir memory area resides at a fixed place in each node's memory and
17 * provides pointers to most other IP27 memory areas. This allows us to
18 * resize and/or relocate memory areas at a later time without breaking all
19 * firmware and kernels that use them. Indices in the array are
20 * permanently dedicated to areas listed below. Some memory areas (marked
21 * below) reside at a permanently fixed location, but are included in the
22 * directory for completeness.
23 */
24
25#define KLDIR_MAGIC 0x434d5f53505f5357
26
27/*
28 * The upper portion of the memory map applies during boot
29 * only and is overwritten by IRIX/SYMMON.
30 *
31 * MEMORY MAP PER NODE
32 *
33 * 0x2000000 (32M) +-----------------------------------------+
34 * | IO6 BUFFERS FOR FLASH ENET IOC3 |
35 * 0x1F80000 (31.5M) +-----------------------------------------+
36 * | IO6 TEXT/DATA/BSS/stack |
37 * 0x1C00000 (30M) +-----------------------------------------+
38 * | IO6 PROM DEBUG TEXT/DATA/BSS/stack |
39 * 0x0800000 (28M) +-----------------------------------------+
40 * | IP27 PROM TEXT/DATA/BSS/stack |
41 * 0x1B00000 (27M) +-----------------------------------------+
42 * | IP27 CFG |
43 * 0x1A00000 (26M) +-----------------------------------------+
44 * | Graphics PROM |
45 * 0x1800000 (24M) +-----------------------------------------+
46 * | 3rd Party PROM drivers |
47 * 0x1600000 (22M) +-----------------------------------------+
48 * | |
49 * | Free |
50 * | |
51 * +-----------------------------------------+
52 * | UNIX DEBUG Version |
53 * 0x190000 (2M--) +-----------------------------------------+
54 * | SYMMON |
55 * | (For UNIX Debug only) |
56 * 0x34000 (208K) +-----------------------------------------+
57 * | SYMMON STACK [NUM_CPU_PER_NODE] |
58 * | (For UNIX Debug only) |
59 * 0x25000 (148K) +-----------------------------------------+
60 * | KLCONFIG - II (temp) |
61 * | |
62 * | ---------------------------- |
63 * | |
64 * | UNIX NON-DEBUG Version |
65 * 0x19000 (100K) +-----------------------------------------+
66 *
67 *
68 * The lower portion of the memory map contains information that is
69 * permanent and is used by the IP27PROM, IO6PROM and IRIX.
70 *
71 * 0x19000 (100K) +-----------------------------------------+
72 * | |
73 * | PI Error Spools (32K) |
74 * | |
75 * 0x12000 (72K) +-----------------------------------------+
76 * | Unused |
77 * 0x11c00 (71K) +-----------------------------------------+
78 * | CPU 1 NMI Eframe area |
79 * 0x11a00 (70.5K) +-----------------------------------------+
80 * | CPU 0 NMI Eframe area |
81 * 0x11800 (70K) +-----------------------------------------+
82 * | CPU 1 NMI Register save area |
83 * 0x11600 (69.5K) +-----------------------------------------+
84 * | CPU 0 NMI Register save area |
85 * 0x11400 (69K) +-----------------------------------------+
86 * | GDA (1k) |
87 * 0x11000 (68K) +-----------------------------------------+
88 * | Early cache Exception stack |
89 * | and/or |
90 * | kernel/io6prom nmi registers |
91 * 0x10800 (66k) +-----------------------------------------+
92 * | cache error eframe |
93 * 0x10400 (65K) +-----------------------------------------+
94 * | Exception Handlers (UALIAS copy) |
95 * 0x10000 (64K) +-----------------------------------------+
96 * | |
97 * | |
98 * | KLCONFIG - I (permanent) (48K) |
99 * | |
100 * | |
101 * | |
102 * 0x4000 (16K) +-----------------------------------------+
103 * | NMI Handler (Protected Page) |
104 * 0x3000 (12K) +-----------------------------------------+
105 * | ARCS PVECTORS (master node only) |
106 * 0x2c00 (11K) +-----------------------------------------+
107 * | ARCS TVECTORS (master node only) |
108 * 0x2800 (10K) +-----------------------------------------+
109 * | LAUNCH [NUM_CPU] |
110 * 0x2400 (9K) +-----------------------------------------+
111 * | Low memory directory (KLDIR) |
112 * 0x2000 (8K) +-----------------------------------------+
113 * | ARCS SPB (1K) |
114 * 0x1000 (4K) +-----------------------------------------+
115 * | Early cache Exception stack |
116 * | and/or |
117 * | kernel/io6prom nmi registers |
118 * 0x800 (2k) +-----------------------------------------+
119 * | cache error eframe |
120 * 0x400 (1K) +-----------------------------------------+
121 * | Exception Handlers |
122 * 0x0 (0K) +-----------------------------------------+
123 */
124
125#ifdef __ASSEMBLY__
126#define KLDIR_OFF_MAGIC 0x00
127#define KLDIR_OFF_OFFSET 0x08
128#define KLDIR_OFF_POINTER 0x10
129#define KLDIR_OFF_SIZE 0x18
130#define KLDIR_OFF_COUNT 0x20
131#define KLDIR_OFF_STRIDE 0x28
132#endif /* __ASSEMBLY__ */
133
134/*
135 * This is defined here because IP27_SYMMON_STK_SIZE must be at least what
136 * we define here. Since it's set up in the prom. We can't redefine it later
137 * and expect more space to be allocated. The way to find out the true size
138 * of the symmon stacks is to divide SYMMON_STK_SIZE by SYMMON_STK_STRIDE
139 * for a particular node.
140 */
141#define SYMMON_STACK_SIZE 0x8000
142
143#if defined(PROM)
144
145/*
146 * These defines are prom version dependent. No code other than the IP27
147 * prom should attempt to use these values.
148 */
149#define IP27_LAUNCH_OFFSET 0x2400
150#define IP27_LAUNCH_SIZE 0x400
151#define IP27_LAUNCH_COUNT 2
152#define IP27_LAUNCH_STRIDE 0x200
153
154#define IP27_KLCONFIG_OFFSET 0x4000
155#define IP27_KLCONFIG_SIZE 0xc000
156#define IP27_KLCONFIG_COUNT 1
157#define IP27_KLCONFIG_STRIDE 0
158
159#define IP27_NMI_OFFSET 0x3000
160#define IP27_NMI_SIZE 0x40
161#define IP27_NMI_COUNT 2
162#define IP27_NMI_STRIDE 0x40
163
164#define IP27_PI_ERROR_OFFSET 0x12000
165#define IP27_PI_ERROR_SIZE 0x4000
166#define IP27_PI_ERROR_COUNT 1
167#define IP27_PI_ERROR_STRIDE 0
168
169#define IP27_SYMMON_STK_OFFSET 0x25000
170#define IP27_SYMMON_STK_SIZE 0xe000
171#define IP27_SYMMON_STK_COUNT 2
172/* IP27_SYMMON_STK_STRIDE must be >= SYMMON_STACK_SIZE */
173#define IP27_SYMMON_STK_STRIDE 0x7000
174
175#define IP27_FREEMEM_OFFSET 0x19000
176#define IP27_FREEMEM_SIZE -1
177#define IP27_FREEMEM_COUNT 1
178#define IP27_FREEMEM_STRIDE 0
179
180#endif /* PROM */
181/*
182 * There will be only one of these in a partition so the IO6 must set it up.
183 */
184#define IO6_GDA_OFFSET 0x11000
185#define IO6_GDA_SIZE 0x400
186#define IO6_GDA_COUNT 1
187#define IO6_GDA_STRIDE 0
188
189/*
190 * save area of kernel nmi regs in the prom format
191 */
192#define IP27_NMI_KREGS_OFFSET 0x11400
193#define IP27_NMI_KREGS_CPU_SIZE 0x200
194/*
195 * save area of kernel nmi regs in eframe format
196 */
197#define IP27_NMI_EFRAME_OFFSET 0x11800
198#define IP27_NMI_EFRAME_SIZE 0x200
199
200#define KLDIR_ENT_SIZE 0x40
201#define KLDIR_MAX_ENTRIES (0x400 / 0x40)
202
203#ifndef __ASSEMBLY__
204typedef struct kldir_ent_s {
205 u64 magic; /* Indicates validity of entry */
206 off_t offset; /* Offset from start of node space */
207 unsigned long pointer; /* Pointer to area in some cases */
208 size_t size; /* Size in bytes */
209 u64 count; /* Repeat count if array, 1 if not */
210 size_t stride; /* Stride if array, 0 if not */
211 char rsvd[16]; /* Pad entry to 0x40 bytes */
212 /* NOTE: These 16 bytes are used in the Partition KLDIR
213 entry to store partition info. Refer to klpart.h for this. */
214} kldir_ent_t;
215#endif /* !__ASSEMBLY__ */
216
217#endif /* _ASM_SN_KLDIR_H */
diff --git a/include/asm-mips/sn/klkernvars.h b/include/asm-mips/sn/klkernvars.h
deleted file mode 100644
index 5de4c5e8ab30..000000000000
--- a/include/asm-mips/sn/klkernvars.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * File ported from IRIX to Linux by Kanoj Sarcar, 06/08/00.
3 * Copyright 2000 Silicon Graphics, Inc.
4 */
5#ifndef __ASM_SN_KLKERNVARS_H
6#define __ASM_SN_KLKERNVARS_H
7
8#define KV_MAGIC_OFFSET 0x0
9#define KV_RO_NASID_OFFSET 0x4
10#define KV_RW_NASID_OFFSET 0x6
11
12#define KV_MAGIC 0x5f4b565f
13
14#ifndef __ASSEMBLY__
15
16#include <asm/sn/types.h>
17
18typedef struct kern_vars_s {
19 int kv_magic;
20 nasid_t kv_ro_nasid;
21 nasid_t kv_rw_nasid;
22 unsigned long kv_ro_baseaddr;
23 unsigned long kv_rw_baseaddr;
24} kern_vars_t;
25
26#endif /* !__ASSEMBLY__ */
27
28#endif /* __ASM_SN_KLKERNVARS_H */
29
diff --git a/include/asm-mips/sn/launch.h b/include/asm-mips/sn/launch.h
deleted file mode 100644
index b7c2226312c6..000000000000
--- a/include/asm-mips/sn/launch.h
+++ /dev/null
@@ -1,106 +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) 1992 - 1997, 2000 Silicon Graphics, Inc.
7 * Copyright (C) 2000 by Colin Ngam
8 */
9#ifndef _ASM_SN_LAUNCH_H
10#define _ASM_SN_LAUNCH_H
11
12#include <asm/sn/types.h>
13#include <asm/sn/addrs.h>
14
15/*
16 * The launch data structure resides at a fixed place in each node's memory
17 * and is used to communicate between the master processor and the slave
18 * processors.
19 *
20 * The master stores launch parameters in the launch structure
21 * corresponding to a target processor that is in a slave loop, then sends
22 * an interrupt to the slave processor. The slave calls the desired
23 * function, then returns to the slave loop. The master may poll or wait
24 * for the slaves to finish.
25 *
26 * There is an array of launch structures, one per CPU on the node. One
27 * interrupt level is used per local CPU.
28 */
29
30#define LAUNCH_MAGIC 0xaddbead2addbead3
31#ifdef CONFIG_SGI_IP27
32#define LAUNCH_SIZEOF 0x100
33#define LAUNCH_PADSZ 0xa0
34#endif
35
36#define LAUNCH_OFF_MAGIC 0x00 /* Struct offsets for assembly */
37#define LAUNCH_OFF_BUSY 0x08
38#define LAUNCH_OFF_CALL 0x10
39#define LAUNCH_OFF_CALLC 0x18
40#define LAUNCH_OFF_CALLPARM 0x20
41#define LAUNCH_OFF_STACK 0x28
42#define LAUNCH_OFF_GP 0x30
43#define LAUNCH_OFF_BEVUTLB 0x38
44#define LAUNCH_OFF_BEVNORMAL 0x40
45#define LAUNCH_OFF_BEVECC 0x48
46
47#define LAUNCH_STATE_DONE 0 /* Return value of LAUNCH_POLL */
48#define LAUNCH_STATE_SENT 1
49#define LAUNCH_STATE_RECD 2
50
51/*
52 * The launch routine is called only if the complement address is correct.
53 *
54 * Before control is transferred to a routine, the complement address
55 * is zeroed (invalidated) to prevent an accidental call from a spurious
56 * interrupt.
57 *
58 * The slave_launch routine turns on the BUSY flag, and the slave loop
59 * clears the BUSY flag after control is returned to it.
60 */
61
62#ifndef __ASSEMBLY__
63
64typedef int launch_state_t;
65typedef void (*launch_proc_t)(u64 call_parm);
66
67typedef struct launch_s {
68 volatile u64 magic; /* Magic number */
69 volatile u64 busy; /* Slave currently active */
70 volatile launch_proc_t call_addr; /* Func. for slave to call */
71 volatile u64 call_addr_c; /* 1's complement of call_addr*/
72 volatile u64 call_parm; /* Single parm passed to call*/
73 volatile void *stack_addr; /* Stack pointer for slave function */
74 volatile void *gp_addr; /* Global pointer for slave func. */
75 volatile char *bevutlb;/* Address of bev utlb ex handler */
76 volatile char *bevnormal;/*Address of bev normal ex handler */
77 volatile char *bevecc;/* Address of bev cache err handler */
78 volatile char pad[160]; /* Pad to LAUNCH_SIZEOF */
79} launch_t;
80
81/*
82 * PROM entry points for launch routines are determined by IPxxprom/start.s
83 */
84
85#define LAUNCH_SLAVE (*(void (*)(int nasid, int cpu, \
86 launch_proc_t call_addr, \
87 u64 call_parm, \
88 void *stack_addr, \
89 void *gp_addr)) \
90 IP27PROM_LAUNCHSLAVE)
91
92#define LAUNCH_WAIT (*(void (*)(int nasid, int cpu, int timeout_msec)) \
93 IP27PROM_WAITSLAVE)
94
95#define LAUNCH_POLL (*(launch_state_t (*)(int nasid, int cpu)) \
96 IP27PROM_POLLSLAVE)
97
98#define LAUNCH_LOOP (*(void (*)(void)) \
99 IP27PROM_SLAVELOOP)
100
101#define LAUNCH_FLASH (*(void (*)(void)) \
102 IP27PROM_FLASHLEDS)
103
104#endif /* !__ASSEMBLY__ */
105
106#endif /* _ASM_SN_LAUNCH_H */
diff --git a/include/asm-mips/sn/mapped_kernel.h b/include/asm-mips/sn/mapped_kernel.h
deleted file mode 100644
index 721496a0bb92..000000000000
--- a/include/asm-mips/sn/mapped_kernel.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * File created by Kanoj Sarcar 06/06/00.
3 * Copyright 2000 Silicon Graphics, Inc.
4 */
5#ifndef __ASM_SN_MAPPED_KERNEL_H
6#define __ASM_SN_MAPPED_KERNEL_H
7
8#include <linux/mmzone.h>
9
10/*
11 * Note on how mapped kernels work: the text and data section is
12 * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
13 * init/setup/data section gets a 16M virtual address bump in the
14 * ld.script file (so that tlblo0 and tlblo1 maps the sections).
15 * The vmlinux.64 section addresses are put in the xkseg range
16 * using the change-addresses makefile option. Use elfdump -of
17 * on IRIX to see where the sections go. The Origin loader loads
18 * the two sections contiguously in physical memory. The loader
19 * sets the entry point into kernel_entry using a xkphys address,
20 * but instead of using 0xa800000001160000, it uses the address
21 * 0xa800000000160000, which is where it physically loaded that
22 * code. So no jumps can be done before we have switched to using
23 * cksseg addresses.
24 */
25#include <asm/addrspace.h>
26
27#define REP_BASE CAC_BASE
28
29#ifdef CONFIG_MAPPED_KERNEL
30
31#define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE)
32#define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216)
33
34#define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
35#define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
36
37#define MAPPED_KERN_RO_TO_PHYS(x) \
38 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
39 MAPPED_KERN_RO_PHYSBASE(get_compact_nodeid()))
40#define MAPPED_KERN_RW_TO_PHYS(x) \
41 ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \
42 MAPPED_KERN_RW_PHYSBASE(get_compact_nodeid()))
43
44#else /* CONFIG_MAPPED_KERNEL */
45
46#define MAPPED_KERN_RO_TO_PHYS(x) (x - REP_BASE)
47#define MAPPED_KERN_RW_TO_PHYS(x) (x - REP_BASE)
48
49#endif /* CONFIG_MAPPED_KERNEL */
50
51#define MAPPED_KERN_RO_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RO_TO_PHYS(x))
52#define MAPPED_KERN_RW_TO_K0(x) PHYS_TO_K0(MAPPED_KERN_RW_TO_PHYS(x))
53
54#endif /* __ASM_SN_MAPPED_KERNEL_H */
diff --git a/include/asm-mips/sn/nmi.h b/include/asm-mips/sn/nmi.h
deleted file mode 100644
index 6b7b0b5f3729..000000000000
--- a/include/asm-mips/sn/nmi.h
+++ /dev/null
@@ -1,125 +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) 1992 - 1997 Silicon Graphics, Inc.
7 */
8#ifndef __ASM_SN_NMI_H
9#define __ASM_SN_NMI_H
10
11#ident "$Revision: 1.5 $"
12
13#include <asm/sn/addrs.h>
14
15/*
16 * The launch data structure resides at a fixed place in each node's memory
17 * and is used to communicate between the master processor and the slave
18 * processors.
19 *
20 * The master stores launch parameters in the launch structure
21 * corresponding to a target processor that is in a slave loop, then sends
22 * an interrupt to the slave processor. The slave calls the desired
23 * function, followed by an optional rendezvous function, then returns to
24 * the slave loop. The master does not wait for the slaves before
25 * returning.
26 *
27 * There is an array of launch structures, one per CPU on the node. One
28 * interrupt level is used per CPU.
29 */
30
31#define NMI_MAGIC 0x48414d4d455201
32#define NMI_SIZEOF 0x40
33
34#define NMI_OFF_MAGIC 0x00 /* Struct offsets for assembly */
35#define NMI_OFF_FLAGS 0x08
36#define NMI_OFF_CALL 0x10
37#define NMI_OFF_CALLC 0x18
38#define NMI_OFF_CALLPARM 0x20
39#define NMI_OFF_GMASTER 0x28
40
41/*
42 * The NMI routine is called only if the complement address is
43 * correct.
44 *
45 * Before control is transferred to a routine, the complement address
46 * is zeroed (invalidated) to prevent an accidental call from a spurious
47 * interrupt.
48 *
49 */
50
51#ifndef __ASSEMBLY__
52
53typedef struct nmi_s {
54 volatile unsigned long magic; /* Magic number */
55 volatile unsigned long flags; /* Combination of flags above */
56 volatile void *call_addr; /* Routine for slave to call */
57 volatile void *call_addr_c; /* 1's complement of address */
58 volatile void *call_parm; /* Single parm passed to call */
59 volatile unsigned long gmaster; /* Flag true only on global master*/
60} nmi_t;
61
62#endif /* !__ASSEMBLY__ */
63
64/* Following definitions are needed both in the prom & the kernel
65 * to identify the format of the nmi cpu register save area in the
66 * low memory on each node.
67 */
68#ifndef __ASSEMBLY__
69
70struct reg_struct {
71 unsigned long gpr[32];
72 unsigned long sr;
73 unsigned long cause;
74 unsigned long epc;
75 unsigned long badva;
76 unsigned long error_epc;
77 unsigned long cache_err;
78 unsigned long nmi_sr;
79};
80
81#endif /* !__ASSEMBLY__ */
82
83/* These are the assembly language offsets into the reg_struct structure */
84
85#define R0_OFF 0x0
86#define R1_OFF 0x8
87#define R2_OFF 0x10
88#define R3_OFF 0x18
89#define R4_OFF 0x20
90#define R5_OFF 0x28
91#define R6_OFF 0x30
92#define R7_OFF 0x38
93#define R8_OFF 0x40
94#define R9_OFF 0x48
95#define R10_OFF 0x50
96#define R11_OFF 0x58
97#define R12_OFF 0x60
98#define R13_OFF 0x68
99#define R14_OFF 0x70
100#define R15_OFF 0x78
101#define R16_OFF 0x80
102#define R17_OFF 0x88
103#define R18_OFF 0x90
104#define R19_OFF 0x98
105#define R20_OFF 0xa0
106#define R21_OFF 0xa8
107#define R22_OFF 0xb0
108#define R23_OFF 0xb8
109#define R24_OFF 0xc0
110#define R25_OFF 0xc8
111#define R26_OFF 0xd0
112#define R27_OFF 0xd8
113#define R28_OFF 0xe0
114#define R29_OFF 0xe8
115#define R30_OFF 0xf0
116#define R31_OFF 0xf8
117#define SR_OFF 0x100
118#define CAUSE_OFF 0x108
119#define EPC_OFF 0x110
120#define BADVA_OFF 0x118
121#define ERROR_EPC_OFF 0x120
122#define CACHE_ERR_OFF 0x128
123#define NMISR_OFF 0x130
124
125#endif /* __ASM_SN_NMI_H */
diff --git a/include/asm-mips/sn/sn0/addrs.h b/include/asm-mips/sn/sn0/addrs.h
deleted file mode 100644
index b06190093bbc..000000000000
--- a/include/asm-mips/sn/sn0/addrs.h
+++ /dev/null
@@ -1,288 +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 * Derived from IRIX <sys/SN/SN0/addrs.h>, revision 1.126.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_ADDRS_H
12#define _ASM_SN_SN0_ADDRS_H
13
14
15/*
16 * SN0 (on a T5) Address map
17 *
18 * This file contains a set of definitions and macros which are used
19 * to reference into the major address spaces (CAC, HSPEC, IO, MSPEC,
20 * and UNCAC) used by the SN0 architecture. It also contains addresses
21 * for "major" statically locatable PROM/Kernel data structures, such as
22 * the partition table, the configuration data structure, etc.
23 * We make an implicit assumption that the processor using this file
24 * follows the R10K's provisions for specifying uncached attributes;
25 * should this change, the base registers may very well become processor-
26 * dependent.
27 *
28 * For more information on the address spaces, see the "Local Resources"
29 * chapter of the Hub specification.
30 *
31 * NOTE: This header file is included both by C and by assembler source
32 * files. Please bracket any language-dependent definitions
33 * appropriately.
34 */
35
36/*
37 * Some of the macros here need to be casted to appropriate types when used
38 * from C. They definitely must not be casted from assembly language so we
39 * use some new ANSI preprocessor stuff to paste these on where needed.
40 */
41
42/*
43 * The following couple of definitions will eventually need to be variables,
44 * since the amount of address space assigned to each node depends on
45 * whether the system is running in N-mode (more nodes with less memory)
46 * or M-mode (fewer nodes with more memory). We expect that it will
47 * be a while before we need to make this decision dynamically, though,
48 * so for now we just use defines bracketed by an ifdef.
49 */
50
51#ifdef CONFIG_SGI_SN_N_MODE
52
53#define NODE_SIZE_BITS 31
54#define BWIN_SIZE_BITS 28
55
56#define NASID_BITS 9
57#define NASID_BITMASK (0x1ffLL)
58#define NASID_SHFT 31
59#define NASID_META_BITS 5
60#define NASID_LOCAL_BITS 4
61
62#define BDDIR_UPPER_MASK (UINT64_CAST 0x7ffff << 10)
63#define BDECC_UPPER_MASK (UINT64_CAST 0x3ffffff << 3)
64
65#else /* !defined(CONFIG_SGI_SN_N_MODE), assume that M-mode is desired */
66
67#define NODE_SIZE_BITS 32
68#define BWIN_SIZE_BITS 29
69
70#define NASID_BITMASK (0xffLL)
71#define NASID_BITS 8
72#define NASID_SHFT 32
73#define NASID_META_BITS 4
74#define NASID_LOCAL_BITS 4
75
76#define BDDIR_UPPER_MASK (UINT64_CAST 0xfffff << 10)
77#define BDECC_UPPER_MASK (UINT64_CAST 0x7ffffff << 3)
78
79#endif /* !defined(CONFIG_SGI_SN_N_MODE) */
80
81#define NODE_ADDRSPACE_SIZE (UINT64_CAST 1 << NODE_SIZE_BITS)
82
83#define NASID_MASK (UINT64_CAST NASID_BITMASK << NASID_SHFT)
84#define NASID_GET(_pa) (int) ((UINT64_CAST (_pa) >> \
85 NASID_SHFT) & NASID_BITMASK)
86
87#if !defined(__ASSEMBLY__)
88
89#define NODE_SWIN_BASE(nasid, widget) \
90 ((widget == 0) ? NODE_BWIN_BASE((nasid), SWIN0_BIGWIN) \
91 : RAW_NODE_SWIN_BASE(nasid, widget))
92#else /* __ASSEMBLY__ */
93#define NODE_SWIN_BASE(nasid, widget) \
94 (NODE_IO_BASE(nasid) + (UINT64_CAST(widget) << SWIN_SIZE_BITS))
95#endif /* __ASSEMBLY__ */
96
97/*
98 * The following definitions pertain to the IO special address
99 * space. They define the location of the big and little windows
100 * of any given node.
101 */
102
103#define BWIN_INDEX_BITS 3
104#define BWIN_SIZE (UINT64_CAST 1 << BWIN_SIZE_BITS)
105#define BWIN_SIZEMASK (BWIN_SIZE - 1)
106#define BWIN_WIDGET_MASK 0x7
107#define NODE_BWIN_BASE0(nasid) (NODE_IO_BASE(nasid) + BWIN_SIZE)
108#define NODE_BWIN_BASE(nasid, bigwin) (NODE_BWIN_BASE0(nasid) + \
109 (UINT64_CAST(bigwin) << BWIN_SIZE_BITS))
110
111#define BWIN_WIDGETADDR(addr) ((addr) & BWIN_SIZEMASK)
112#define BWIN_WINDOWNUM(addr) (((addr) >> BWIN_SIZE_BITS) & BWIN_WIDGET_MASK)
113/*
114 * Verify if addr belongs to large window address of node with "nasid"
115 *
116 *
117 * NOTE: "addr" is expected to be XKPHYS address, and NOT physical
118 * address
119 *
120 *
121 */
122
123#define NODE_BWIN_ADDR(nasid, addr) \
124 (((addr) >= NODE_BWIN_BASE0(nasid)) && \
125 ((addr) < (NODE_BWIN_BASE(nasid, HUB_NUM_BIG_WINDOW) + \
126 BWIN_SIZE)))
127
128/*
129 * The following define the major position-independent aliases used
130 * in SN0.
131 * CALIAS -- Varies in size, points to the first n bytes of memory
132 * on the reader's node.
133 */
134
135#define CALIAS_BASE CAC_BASE
136
137
138
139#define BRIDGE_REG_PTR(_base, _off) ((volatile bridgereg_t *) \
140 ((__psunsigned_t)(_base) + (__psunsigned_t)(_off)))
141
142#define SN0_WIDGET_BASE(_nasid, _wid) (NODE_SWIN_BASE((_nasid), (_wid)))
143
144/* Turn on sable logging for the processors whose bits are set. */
145#define SABLE_LOG_TRIGGER(_map)
146
147#ifndef __ASSEMBLY__
148#define KERN_NMI_ADDR(nasid, slice) \
149 TO_NODE_UNCAC((nasid), IP27_NMI_KREGS_OFFSET + \
150 (IP27_NMI_KREGS_CPU_SIZE * (slice)))
151#endif /* !__ASSEMBLY__ */
152
153#ifdef PROM
154
155#define MISC_PROM_BASE PHYS_TO_K0(0x01300000)
156#define MISC_PROM_SIZE 0x200000
157
158#define DIAG_BASE PHYS_TO_K0(0x01500000)
159#define DIAG_SIZE 0x300000
160
161#define ROUTE_BASE PHYS_TO_K0(0x01800000)
162#define ROUTE_SIZE 0x200000
163
164#define IP27PROM_FLASH_HDR PHYS_TO_K0(0x01300000)
165#define IP27PROM_FLASH_DATA PHYS_TO_K0(0x01301000)
166#define IP27PROM_CORP_MAX 32
167#define IP27PROM_CORP PHYS_TO_K0(0x01800000)
168#define IP27PROM_CORP_SIZE 0x10000
169#define IP27PROM_CORP_STK PHYS_TO_K0(0x01810000)
170#define IP27PROM_CORP_STKSIZE 0x2000
171#define IP27PROM_DECOMP_BUF PHYS_TO_K0(0x01900000)
172#define IP27PROM_DECOMP_SIZE 0xfff00
173
174#define IP27PROM_BASE PHYS_TO_K0(0x01a00000)
175#define IP27PROM_BASE_MAPPED (UNCAC_BASE | 0x1fc00000)
176#define IP27PROM_SIZE_MAX 0x100000
177
178#define IP27PROM_PCFG PHYS_TO_K0(0x01b00000)
179#define IP27PROM_PCFG_SIZE 0xd0000
180#define IP27PROM_ERRDMP PHYS_TO_K1(0x01bd0000)
181#define IP27PROM_ERRDMP_SIZE 0xf000
182
183#define IP27PROM_INIT_START PHYS_TO_K1(0x01bd0000)
184#define IP27PROM_CONSOLE PHYS_TO_K1(0x01bdf000)
185#define IP27PROM_CONSOLE_SIZE 0x200
186#define IP27PROM_NETUART PHYS_TO_K1(0x01bdf200)
187#define IP27PROM_NETUART_SIZE 0x100
188#define IP27PROM_UNUSED1 PHYS_TO_K1(0x01bdf300)
189#define IP27PROM_UNUSED1_SIZE 0x500
190#define IP27PROM_ELSC_BASE_A PHYS_TO_K0(0x01bdf800)
191#define IP27PROM_ELSC_BASE_B PHYS_TO_K0(0x01bdfc00)
192#define IP27PROM_STACK_A PHYS_TO_K0(0x01be0000)
193#define IP27PROM_STACK_B PHYS_TO_K0(0x01bf0000)
194#define IP27PROM_STACK_SHFT 16
195#define IP27PROM_STACK_SIZE (1 << IP27PROM_STACK_SHFT)
196#define IP27PROM_INIT_END PHYS_TO_K0(0x01c00000)
197
198#define SLAVESTACK_BASE PHYS_TO_K0(0x01580000)
199#define SLAVESTACK_SIZE 0x40000
200
201#define ENETBUFS_BASE PHYS_TO_K0(0x01f80000)
202#define ENETBUFS_SIZE 0x20000
203
204#define IO6PROM_BASE PHYS_TO_K0(0x01c00000)
205#define IO6PROM_SIZE 0x400000
206#define IO6PROM_BASE_MAPPED (UNCAC_BASE | 0x11c00000)
207#define IO6DPROM_BASE PHYS_TO_K0(0x01c00000)
208#define IO6DPROM_SIZE 0x200000
209
210#define NODEBUGUNIX_ADDR PHYS_TO_K0(0x00019000)
211#define DEBUGUNIX_ADDR PHYS_TO_K0(0x00100000)
212
213#define IP27PROM_INT_LAUNCH 10 /* and 11 */
214#define IP27PROM_INT_NETUART 12 /* through 17 */
215
216#endif /* PROM */
217
218/*
219 * needed by symmon so it needs to be outside #if PROM
220 */
221#define IP27PROM_ELSC_SHFT 10
222#define IP27PROM_ELSC_SIZE (1 << IP27PROM_ELSC_SHFT)
223
224/*
225 * This address is used by IO6PROM to build MemoryDescriptors of
226 * free memory. This address is important since unix gets loaded
227 * at this address, and this memory has to be FREE if unix is to
228 * be loaded.
229 */
230
231#define FREEMEM_BASE PHYS_TO_K0(0x2000000)
232
233#define IO6PROM_STACK_SHFT 14 /* stack per cpu */
234#define IO6PROM_STACK_SIZE (1 << IO6PROM_STACK_SHFT)
235
236/*
237 * IP27 PROM vectors
238 */
239
240#define IP27PROM_ENTRY PHYS_TO_COMPATK1(0x1fc00000)
241#define IP27PROM_RESTART PHYS_TO_COMPATK1(0x1fc00008)
242#define IP27PROM_SLAVELOOP PHYS_TO_COMPATK1(0x1fc00010)
243#define IP27PROM_PODMODE PHYS_TO_COMPATK1(0x1fc00018)
244#define IP27PROM_IOC3UARTPOD PHYS_TO_COMPATK1(0x1fc00020)
245#define IP27PROM_FLASHLEDS PHYS_TO_COMPATK1(0x1fc00028)
246#define IP27PROM_REPOD PHYS_TO_COMPATK1(0x1fc00030)
247#define IP27PROM_LAUNCHSLAVE PHYS_TO_COMPATK1(0x1fc00038)
248#define IP27PROM_WAITSLAVE PHYS_TO_COMPATK1(0x1fc00040)
249#define IP27PROM_POLLSLAVE PHYS_TO_COMPATK1(0x1fc00048)
250
251#define KL_UART_BASE LOCAL_HUB_ADDR(MD_UREG0_0) /* base of UART regs */
252#define KL_UART_CMD LOCAL_HUB_ADDR(MD_UREG0_0) /* UART command reg */
253#define KL_UART_DATA LOCAL_HUB_ADDR(MD_UREG0_1) /* UART data reg */
254#define KL_I2C_REG MD_UREG0_0 /* I2C reg */
255
256#ifndef __ASSEMBLY__
257
258/* Address 0x400 to 0x1000 ualias points to cache error eframe + misc
259 * CACHE_ERR_SP_PTR could either contain an address to the stack, or
260 * the stack could start at CACHE_ERR_SP_PTR
261 */
262#if defined(HUB_ERR_STS_WAR)
263#define CACHE_ERR_EFRAME 0x480
264#else /* HUB_ERR_STS_WAR */
265#define CACHE_ERR_EFRAME 0x400
266#endif /* HUB_ERR_STS_WAR */
267
268#define CACHE_ERR_ECCFRAME (CACHE_ERR_EFRAME + EF_SIZE)
269#define CACHE_ERR_SP_PTR (0x1000 - 32) /* why -32? TBD */
270#define CACHE_ERR_IBASE_PTR (0x1000 - 40)
271#define CACHE_ERR_SP (CACHE_ERR_SP_PTR - 16)
272#define CACHE_ERR_AREA_SIZE (ARCS_SPB_OFFSET - CACHE_ERR_EFRAME)
273
274#endif /* !__ASSEMBLY__ */
275
276#define _ARCSPROM
277
278#if defined(HUB_ERR_STS_WAR)
279
280#define ERR_STS_WAR_REGISTER IIO_IIBUSERR
281#define ERR_STS_WAR_ADDR LOCAL_HUB_ADDR(IIO_IIBUSERR)
282#define ERR_STS_WAR_PHYSADDR TO_PHYS((__psunsigned_t)ERR_STS_WAR_ADDR)
283 /* Used to match addr in error reg. */
284#define OLD_ERR_STS_WAR_OFFSET ((MD_MEM_BANKS * MD_BANK_SIZE) - 0x100)
285
286#endif /* HUB_ERR_STS_WAR */
287
288#endif /* _ASM_SN_SN0_ADDRS_H */
diff --git a/include/asm-mips/sn/sn0/arch.h b/include/asm-mips/sn/sn0/arch.h
deleted file mode 100644
index f734f2007f24..000000000000
--- a/include/asm-mips/sn/sn0/arch.h
+++ /dev/null
@@ -1,72 +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 * SGI IP27 specific setup.
7 *
8 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_SN0_ARCH_H
12#define _ASM_SN_SN0_ARCH_H
13
14
15#ifndef SN0XXL /* 128 cpu SMP max */
16/*
17 * This is the maximum number of nodes that can be part of a kernel.
18 * Effectively, it's the maximum number of compact node ids (cnodeid_t).
19 */
20#define MAX_COMPACT_NODES 64
21
22/*
23 * MAXCPUS refers to the maximum number of CPUs in a single kernel.
24 * This is not necessarily the same as MAXNODES * CPUS_PER_NODE
25 */
26#define MAXCPUS 128
27
28#else /* SN0XXL system */
29
30#define MAX_COMPACT_NODES 128
31#define MAXCPUS 256
32
33#endif /* SN0XXL */
34
35/*
36 * This is the maximum number of NASIDS that can be present in a system.
37 * (Highest NASID plus one.)
38 */
39#define MAX_NASIDS 256
40
41/*
42 * MAX_REGIONS refers to the maximum number of hardware partitioned regions.
43 */
44#define MAX_REGIONS 64
45#define MAX_NONPREMIUM_REGIONS 16
46#define MAX_PREMIUM_REGIONS MAX_REGIONS
47
48/*
49 * MAX_PARITIONS refers to the maximum number of logically defined
50 * partitions the system can support.
51 */
52#define MAX_PARTITIONS MAX_REGIONS
53
54#define NASID_MASK_BYTES ((MAX_NASIDS + 7) / 8)
55
56/*
57 * Slot constants for SN0
58 */
59#ifdef CONFIG_SGI_SN_N_MODE
60#define MAX_MEM_SLOTS 16 /* max slots per node */
61#else /* !CONFIG_SGI_SN_N_MODE, assume CONFIG_SGI_SN_M_MODE */
62#define MAX_MEM_SLOTS 32 /* max slots per node */
63#endif /* CONFIG_SGI_SN_M_MODE */
64
65#define SLOT_SHIFT (27)
66#define SLOT_MIN_MEM_SIZE (32*1024*1024)
67
68#define CPUS_PER_NODE 2 /* CPUs on a single hub */
69#define CPUS_PER_NODE_SHFT 1 /* Bits to shift in the node number */
70#define CPUS_PER_SUBNODE 2 /* CPUs on a single hub PI */
71
72#endif /* _ASM_SN_SN0_ARCH_H */
diff --git a/include/asm-mips/sn/sn0/hub.h b/include/asm-mips/sn/sn0/hub.h
deleted file mode 100644
index 3e228f8e7969..000000000000
--- a/include/asm-mips/sn/sn0/hub.h
+++ /dev/null
@@ -1,40 +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) 1992 - 1997, 1999 Silicon Graphics, Inc.
7 * Copyright (C) 1999 by Ralf Baechle
8 */
9#ifndef _ASM_SN_SN0_HUB_H
10#define _ASM_SN_SN0_HUB_H
11
12/* The secret password; used to release protection */
13#define HUB_PASSWORD 0x53474972756c6573ull
14
15#define CHIPID_HUB 0
16#define CHIPID_ROUTER 1
17
18#define HUB_REV_1_0 1
19#define HUB_REV_2_0 2
20#define HUB_REV_2_1 3
21#define HUB_REV_2_2 4
22#define HUB_REV_2_3 5
23#define HUB_REV_2_4 6
24
25#define MAX_HUB_PATH 80
26
27#include <asm/sn/sn0/addrs.h>
28#include <asm/sn/sn0/hubpi.h>
29#include <asm/sn/sn0/hubmd.h>
30#include <asm/sn/sn0/hubio.h>
31#include <asm/sn/sn0/hubni.h>
32//#include <asm/sn/sn0/hubcore.h>
33
34/* Translation of uncached attributes */
35#define UATTR_HSPEC 0
36#define UATTR_IO 1
37#define UATTR_MSPEC 2
38#define UATTR_UNCAC 3
39
40#endif /* _ASM_SN_SN0_HUB_H */
diff --git a/include/asm-mips/sn/sn0/hubio.h b/include/asm-mips/sn/sn0/hubio.h
deleted file mode 100644
index 0187895e556c..000000000000
--- a/include/asm-mips/sn/sn0/hubio.h
+++ /dev/null
@@ -1,972 +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 * Derived from IRIX <sys/SN/SN0/hubio.h>, Revision 1.80.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SGI_SN_SN0_HUBIO_H
12#define _ASM_SGI_SN_SN0_HUBIO_H
13
14/*
15 * Hub I/O interface registers
16 *
17 * All registers in this file are subject to change until Hub chip tapeout.
18 * In general, the longer software name should be used when available.
19 */
20
21/*
22 * Slightly friendlier names for some common registers.
23 * The hardware definitions follow.
24 */
25#define IIO_WIDGET IIO_WID /* Widget identification */
26#define IIO_WIDGET_STAT IIO_WSTAT /* Widget status register */
27#define IIO_WIDGET_CTRL IIO_WCR /* Widget control register */
28#define IIO_WIDGET_TOUT IIO_WRTO /* Widget request timeout */
29#define IIO_WIDGET_FLUSH IIO_WTFR /* Widget target flush */
30#define IIO_PROTECT IIO_ILAPR /* IO interface protection */
31#define IIO_PROTECT_OVRRD IIO_ILAPO /* IO protect override */
32#define IIO_OUTWIDGET_ACCESS IIO_IOWA /* Outbound widget access */
33#define IIO_INWIDGET_ACCESS IIO_IIWA /* Inbound widget access */
34#define IIO_INDEV_ERR_MASK IIO_IIDEM /* Inbound device error mask */
35#define IIO_LLP_CSR IIO_ILCSR /* LLP control and status */
36#define IIO_LLP_LOG IIO_ILLR /* LLP log */
37#define IIO_XTALKCC_TOUT IIO_IXCC /* Xtalk credit count timeout*/
38#define IIO_XTALKTT_TOUT IIO_IXTT /* Xtalk tail timeout */
39#define IIO_IO_ERR_CLR IIO_IECLR /* IO error clear */
40#define IIO_BTE_CRB_CNT IIO_IBCN /* IO BTE CRB count */
41
42#define IIO_LLP_CSR_IS_UP 0x00002000
43#define IIO_LLP_CSR_LLP_STAT_MASK 0x00003000
44#define IIO_LLP_CSR_LLP_STAT_SHFT 12
45
46/* key to IIO_PROTECT_OVRRD */
47#define IIO_PROTECT_OVRRD_KEY 0x53474972756c6573ull /* "SGIrules" */
48
49/* BTE register names */
50#define IIO_BTE_STAT_0 IIO_IBLS_0 /* Also BTE length/status 0 */
51#define IIO_BTE_SRC_0 IIO_IBSA_0 /* Also BTE source address 0 */
52#define IIO_BTE_DEST_0 IIO_IBDA_0 /* Also BTE dest. address 0 */
53#define IIO_BTE_CTRL_0 IIO_IBCT_0 /* Also BTE control/terminate 0 */
54#define IIO_BTE_NOTIFY_0 IIO_IBNA_0 /* Also BTE notification 0 */
55#define IIO_BTE_INT_0 IIO_IBIA_0 /* Also BTE interrupt 0 */
56#define IIO_BTE_OFF_0 0 /* Base offset from BTE 0 regs. */
57#define IIO_BTE_OFF_1 IIO_IBLS_1 - IIO_IBLS_0 /* Offset from base to BTE 1 */
58
59/* BTE register offsets from base */
60#define BTEOFF_STAT 0
61#define BTEOFF_SRC (IIO_BTE_SRC_0 - IIO_BTE_STAT_0)
62#define BTEOFF_DEST (IIO_BTE_DEST_0 - IIO_BTE_STAT_0)
63#define BTEOFF_CTRL (IIO_BTE_CTRL_0 - IIO_BTE_STAT_0)
64#define BTEOFF_NOTIFY (IIO_BTE_NOTIFY_0 - IIO_BTE_STAT_0)
65#define BTEOFF_INT (IIO_BTE_INT_0 - IIO_BTE_STAT_0)
66
67
68/*
69 * The following definitions use the names defined in the IO interface
70 * document for ease of reference. When possible, software should
71 * generally use the longer but clearer names defined above.
72 */
73
74#define IIO_BASE 0x400000
75#define IIO_BASE_BTE0 0x410000
76#define IIO_BASE_BTE1 0x420000
77#define IIO_BASE_PERF 0x430000
78#define IIO_PERF_CNT 0x430008
79
80#define IO_PERF_SETS 32
81
82#define IIO_WID 0x400000 /* Widget identification */
83#define IIO_WSTAT 0x400008 /* Widget status */
84#define IIO_WCR 0x400020 /* Widget control */
85
86#define IIO_WSTAT_ECRAZY (1ULL << 32) /* Hub gone crazy */
87#define IIO_WSTAT_TXRETRY (1ULL << 9) /* Hub Tx Retry timeout */
88#define IIO_WSTAT_TXRETRY_MASK (0x7F)
89#define IIO_WSTAT_TXRETRY_SHFT (16)
90#define IIO_WSTAT_TXRETRY_CNT(w) (((w) >> IIO_WSTAT_TXRETRY_SHFT) & \
91 IIO_WSTAT_TXRETRY_MASK)
92
93#define IIO_ILAPR 0x400100 /* Local Access Protection */
94#define IIO_ILAPO 0x400108 /* Protection override */
95#define IIO_IOWA 0x400110 /* outbound widget access */
96#define IIO_IIWA 0x400118 /* inbound widget access */
97#define IIO_IIDEM 0x400120 /* Inbound Device Error Mask */
98#define IIO_ILCSR 0x400128 /* LLP control and status */
99#define IIO_ILLR 0x400130 /* LLP Log */
100#define IIO_IIDSR 0x400138 /* Interrupt destination */
101
102#define IIO_IIBUSERR 0x1400208 /* Reads here cause a bus error. */
103
104/* IO Interrupt Destination Register */
105#define IIO_IIDSR_SENT_SHIFT 28
106#define IIO_IIDSR_SENT_MASK 0x10000000
107#define IIO_IIDSR_ENB_SHIFT 24
108#define IIO_IIDSR_ENB_MASK 0x01000000
109#define IIO_IIDSR_NODE_SHIFT 8
110#define IIO_IIDSR_NODE_MASK 0x0000ff00
111#define IIO_IIDSR_LVL_SHIFT 0
112#define IIO_IIDSR_LVL_MASK 0x0000003f
113
114
115/* GFX Flow Control Node/Widget Register */
116#define IIO_IGFX_0 0x400140 /* gfx node/widget register 0 */
117#define IIO_IGFX_1 0x400148 /* gfx node/widget register 1 */
118#define IIO_IGFX_W_NUM_BITS 4 /* size of widget num field */
119#define IIO_IGFX_W_NUM_MASK ((1<<IIO_IGFX_W_NUM_BITS)-1)
120#define IIO_IGFX_W_NUM_SHIFT 0
121#define IIO_IGFX_N_NUM_BITS 9 /* size of node num field */
122#define IIO_IGFX_N_NUM_MASK ((1<<IIO_IGFX_N_NUM_BITS)-1)
123#define IIO_IGFX_N_NUM_SHIFT 4
124#define IIO_IGFX_P_NUM_BITS 1 /* size of processor num field */
125#define IIO_IGFX_P_NUM_MASK ((1<<IIO_IGFX_P_NUM_BITS)-1)
126#define IIO_IGFX_P_NUM_SHIFT 16
127#define IIO_IGFX_VLD_BITS 1 /* size of valid field */
128#define IIO_IGFX_VLD_MASK ((1<<IIO_IGFX_VLD_BITS)-1)
129#define IIO_IGFX_VLD_SHIFT 20
130#define IIO_IGFX_INIT(widget, node, cpu, valid) (\
131 (((widget) & IIO_IGFX_W_NUM_MASK) << IIO_IGFX_W_NUM_SHIFT) | \
132 (((node) & IIO_IGFX_N_NUM_MASK) << IIO_IGFX_N_NUM_SHIFT) | \
133 (((cpu) & IIO_IGFX_P_NUM_MASK) << IIO_IGFX_P_NUM_SHIFT) | \
134 (((valid) & IIO_IGFX_VLD_MASK) << IIO_IGFX_VLD_SHIFT) )
135
136/* Scratch registers (not all bits available) */
137#define IIO_SCRATCH_REG0 0x400150
138#define IIO_SCRATCH_REG1 0x400158
139#define IIO_SCRATCH_MASK 0x0000000f00f11fff
140
141#define IIO_SCRATCH_BIT0_0 0x0000000800000000
142#define IIO_SCRATCH_BIT0_1 0x0000000400000000
143#define IIO_SCRATCH_BIT0_2 0x0000000200000000
144#define IIO_SCRATCH_BIT0_3 0x0000000100000000
145#define IIO_SCRATCH_BIT0_4 0x0000000000800000
146#define IIO_SCRATCH_BIT0_5 0x0000000000400000
147#define IIO_SCRATCH_BIT0_6 0x0000000000200000
148#define IIO_SCRATCH_BIT0_7 0x0000000000100000
149#define IIO_SCRATCH_BIT0_8 0x0000000000010000
150#define IIO_SCRATCH_BIT0_9 0x0000000000001000
151#define IIO_SCRATCH_BIT0_R 0x0000000000000fff
152
153/* IO Translation Table Entries */
154#define IIO_NUM_ITTES 7 /* ITTEs numbered 0..6 */
155 /* Hw manuals number them 1..7! */
156
157/*
158 * As a permanent workaround for a bug in the PI side of the hub, we've
159 * redefined big window 7 as small window 0.
160 */
161#define HUB_NUM_BIG_WINDOW IIO_NUM_ITTES - 1
162
163/*
164 * Use the top big window as a surrogate for the first small window
165 */
166#define SWIN0_BIGWIN HUB_NUM_BIG_WINDOW
167
168#define ILCSR_WARM_RESET 0x100
169/*
170 * The IO LLP control status register and widget control register
171 */
172#ifndef __ASSEMBLY__
173
174typedef union hubii_wid_u {
175 u64 wid_reg_value;
176 struct {
177 u64 wid_rsvd: 32, /* unused */
178 wid_rev_num: 4, /* revision number */
179 wid_part_num: 16, /* the widget type: hub=c101 */
180 wid_mfg_num: 11, /* Manufacturer id (IBM) */
181 wid_rsvd1: 1; /* Reserved */
182 } wid_fields_s;
183} hubii_wid_t;
184
185
186typedef union hubii_wcr_u {
187 u64 wcr_reg_value;
188 struct {
189 u64 wcr_rsvd: 41, /* unused */
190 wcr_e_thresh: 5, /* elasticity threshold */
191 wcr_dir_con: 1, /* widget direct connect */
192 wcr_f_bad_pkt: 1, /* Force bad llp pkt enable */
193 wcr_xbar_crd: 3, /* LLP crossbar credit */
194 wcr_rsvd1: 8, /* Reserved */
195 wcr_tag_mode: 1, /* Tag mode */
196 wcr_widget_id: 4; /* LLP crossbar credit */
197 } wcr_fields_s;
198} hubii_wcr_t;
199
200#define iwcr_dir_con wcr_fields_s.wcr_dir_con
201
202typedef union hubii_wstat_u {
203 u64 reg_value;
204 struct {
205 u64 rsvd1: 31,
206 crazy: 1, /* Crazy bit */
207 rsvd2: 8,
208 llp_tx_cnt: 8, /* LLP Xmit retry counter */
209 rsvd3: 6,
210 tx_max_rtry: 1, /* LLP Retry Timeout Signal */
211 rsvd4: 2,
212 xt_tail_to: 1, /* Xtalk Tail Timeout */
213 xt_crd_to: 1, /* Xtalk Credit Timeout */
214 pending: 4; /* Pending Requests */
215 } wstat_fields_s;
216} hubii_wstat_t;
217
218
219typedef union hubii_ilcsr_u {
220 u64 icsr_reg_value;
221 struct {
222 u64 icsr_rsvd: 22, /* unused */
223 icsr_max_burst: 10, /* max burst */
224 icsr_rsvd4: 6, /* reserved */
225 icsr_max_retry: 10, /* max retry */
226 icsr_rsvd3: 2, /* reserved */
227 icsr_lnk_stat: 2, /* link status */
228 icsr_bm8: 1, /* Bit mode 8 */
229 icsr_llp_en: 1, /* LLP enable bit */
230 icsr_rsvd2: 1, /* reserver */
231 icsr_wrm_reset: 1, /* Warm reset bit */
232 icsr_rsvd1: 2, /* Data ready offset */
233 icsr_null_to: 6; /* Null timeout */
234
235 } icsr_fields_s;
236} hubii_ilcsr_t;
237
238
239typedef union hubii_iowa_u {
240 u64 iowa_reg_value;
241 struct {
242 u64 iowa_rsvd: 48, /* unused */
243 iowa_wxoac: 8, /* xtalk widget access bits */
244 iowa_rsvd1: 7, /* xtalk widget access bits */
245 iowa_w0oac: 1; /* xtalk widget access bits */
246 } iowa_fields_s;
247} hubii_iowa_t;
248
249typedef union hubii_iiwa_u {
250 u64 iiwa_reg_value;
251 struct {
252 u64 iiwa_rsvd: 48, /* unused */
253 iiwa_wxiac: 8, /* hub wid access bits */
254 iiwa_rsvd1: 7, /* reserved */
255 iiwa_w0iac: 1; /* hub wid0 access */
256 } iiwa_fields_s;
257} hubii_iiwa_t;
258
259typedef union hubii_illr_u {
260 u64 illr_reg_value;
261 struct {
262 u64 illr_rsvd: 32, /* unused */
263 illr_cb_cnt: 16, /* checkbit error count */
264 illr_sn_cnt: 16; /* sequence number count */
265 } illr_fields_s;
266} hubii_illr_t;
267
268/* The structures below are defined to extract and modify the ii
269performance registers */
270
271/* io_perf_sel allows the caller to specify what tests will be
272 performed */
273typedef union io_perf_sel {
274 u64 perf_sel_reg;
275 struct {
276 u64 perf_rsvd : 48,
277 perf_icct : 8,
278 perf_ippr1 : 4,
279 perf_ippr0 : 4;
280 } perf_sel_bits;
281} io_perf_sel_t;
282
283/* io_perf_cnt is to extract the count from the hub registers. Due to
284 hardware problems there is only one counter, not two. */
285
286typedef union io_perf_cnt {
287 u64 perf_cnt;
288 struct {
289 u64 perf_rsvd1 : 32,
290 perf_rsvd2 : 12,
291 perf_cnt : 20;
292 } perf_cnt_bits;
293} io_perf_cnt_t;
294
295#endif /* !__ASSEMBLY__ */
296
297
298#define LNK_STAT_WORKING 0x2
299
300#define IIO_LLP_CB_MAX 0xffff
301#define IIO_LLP_SN_MAX 0xffff
302
303/* IO PRB Entries */
304#define IIO_NUM_IPRBS (9)
305#define IIO_IOPRB_0 0x400198 /* PRB entry 0 */
306#define IIO_IOPRB_8 0x4001a0 /* PRB entry 8 */
307#define IIO_IOPRB_9 0x4001a8 /* PRB entry 9 */
308#define IIO_IOPRB_A 0x4001b0 /* PRB entry a */
309#define IIO_IOPRB_B 0x4001b8 /* PRB entry b */
310#define IIO_IOPRB_C 0x4001c0 /* PRB entry c */
311#define IIO_IOPRB_D 0x4001c8 /* PRB entry d */
312#define IIO_IOPRB_E 0x4001d0 /* PRB entry e */
313#define IIO_IOPRB_F 0x4001d8 /* PRB entry f */
314
315
316#define IIO_IXCC 0x4001e0 /* Crosstalk credit count timeout */
317#define IIO_IXTCC IIO_IXCC
318#define IIO_IMEM 0x4001e8 /* Miscellaneous Enable Mask */
319#define IIO_IXTT 0x4001f0 /* Crosstalk tail timeout */
320#define IIO_IECLR 0x4001f8 /* IO error clear */
321#define IIO_IBCN 0x400200 /* IO BTE CRB count */
322
323/*
324 * IIO_IMEM Register fields.
325 */
326#define IIO_IMEM_W0ESD 0x1 /* Widget 0 shut down due to error */
327#define IIO_IMEM_B0ESD (1 << 4) /* BTE 0 shut down due to error */
328#define IIO_IMEM_B1ESD (1 << 8) /* BTE 1 Shut down due to error */
329
330/* PIO Read address Table Entries */
331#define IIO_IPCA 0x400300 /* PRB Counter adjust */
332#define IIO_NUM_PRTES 8 /* Total number of PRB table entries */
333#define IIO_PRTE_0 0x400308 /* PIO Read address table entry 0 */
334#define IIO_PRTE(_x) (IIO_PRTE_0 + (8 * (_x)))
335#define IIO_WIDPRTE(x) IIO_PRTE(((x) - 8)) /* widget ID to its PRTE num */
336#define IIO_IPDR 0x400388 /* PIO table entry deallocation */
337#define IIO_ICDR 0x400390 /* CRB Entry Deallocation */
338#define IIO_IFDR 0x400398 /* IOQ FIFO Depth */
339#define IIO_IIAP 0x4003a0 /* IIQ Arbitration Parameters */
340#define IIO_IMMR IIO_IIAP
341#define IIO_ICMR 0x4003a8 /* CRB Management Register */
342#define IIO_ICCR 0x4003b0 /* CRB Control Register */
343#define IIO_ICTO 0x4003b8 /* CRB Time Out Register */
344#define IIO_ICTP 0x4003c0 /* CRB Time Out Prescalar */
345
346
347/*
348 * ICMR register fields
349 */
350#define IIO_ICMR_PC_VLD_SHFT 36
351#define IIO_ICMR_PC_VLD_MASK (0x7fffUL << IIO_ICMR_PC_VLD_SHFT)
352
353#define IIO_ICMR_CRB_VLD_SHFT 20
354#define IIO_ICMR_CRB_VLD_MASK (0x7fffUL << IIO_ICMR_CRB_VLD_SHFT)
355
356#define IIO_ICMR_FC_CNT_SHFT 16
357#define IIO_ICMR_FC_CNT_MASK (0xf << IIO_ICMR_FC_CNT_SHFT)
358
359#define IIO_ICMR_C_CNT_SHFT 4
360#define IIO_ICMR_C_CNT_MASK (0xf << IIO_ICMR_C_CNT_SHFT)
361
362#define IIO_ICMR_P_CNT_SHFT 0
363#define IIO_ICMR_P_CNT_MASK (0xf << IIO_ICMR_P_CNT_SHFT)
364
365#define IIO_ICMR_PRECISE (1UL << 52)
366#define IIO_ICMR_CLR_RPPD (1UL << 13)
367#define IIO_ICMR_CLR_RQPD (1UL << 12)
368
369/*
370 * IIO PIO Deallocation register field masks : (IIO_IPDR)
371 */
372#define IIO_IPDR_PND (1 << 4)
373
374/*
375 * IIO CRB deallocation register field masks: (IIO_ICDR)
376 */
377#define IIO_ICDR_PND (1 << 4)
378
379/*
380 * IIO CRB control register Fields: IIO_ICCR
381 */
382#define IIO_ICCR_PENDING (0x10000)
383#define IIO_ICCR_CMD_MASK (0xFF)
384#define IIO_ICCR_CMD_SHFT (7)
385#define IIO_ICCR_CMD_NOP (0x0) /* No Op */
386#define IIO_ICCR_CMD_WAKE (0x100) /* Reactivate CRB entry and process */
387#define IIO_ICCR_CMD_TIMEOUT (0x200) /* Make CRB timeout & mark invalid */
388#define IIO_ICCR_CMD_EJECT (0x400) /* Contents of entry written to memory
389 * via a WB
390 */
391#define IIO_ICCR_CMD_FLUSH (0x800)
392
393/*
394 * CRB manipulation macros
395 * The CRB macros are slightly complicated, since there are up to
396 * four registers associated with each CRB entry.
397 */
398#define IIO_NUM_CRBS 15 /* Number of CRBs */
399#define IIO_NUM_NORMAL_CRBS 12 /* Number of regular CRB entries */
400#define IIO_NUM_PC_CRBS 4 /* Number of partial cache CRBs */
401#define IIO_ICRB_OFFSET 8
402#define IIO_ICRB_0 0x400400
403/* XXX - This is now tuneable:
404 #define IIO_FIRST_PC_ENTRY 12
405 */
406
407#define IIO_ICRB_A(_x) (IIO_ICRB_0 + (4 * IIO_ICRB_OFFSET * (_x)))
408#define IIO_ICRB_B(_x) (IIO_ICRB_A(_x) + 1*IIO_ICRB_OFFSET)
409#define IIO_ICRB_C(_x) (IIO_ICRB_A(_x) + 2*IIO_ICRB_OFFSET)
410#define IIO_ICRB_D(_x) (IIO_ICRB_A(_x) + 3*IIO_ICRB_OFFSET)
411
412/* XXX - IBUE register coming for Hub 2 */
413
414/*
415 *
416 * CRB Register description.
417 *
418 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
419 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
420 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
421 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
422 * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING * WARNING
423 *
424 * Many of the fields in CRB are status bits used by hardware
425 * for implementation of the protocol. It's very dangerous to
426 * mess around with the CRB registers.
427 *
428 * It's OK to read the CRB registers and try to make sense out of the
429 * fields in CRB.
430 *
431 * Updating CRB requires all activities in Hub IIO to be quiesced.
432 * otherwise, a write to CRB could corrupt other CRB entries.
433 * CRBs are here only as a back door peek to hub IIO's status.
434 * Quiescing implies no dmas no PIOs
435 * either directly from the cpu or from sn0net.
436 * this is not something that can be done easily. So, AVOID updating
437 * CRBs.
438 */
439
440/*
441 * Fields in CRB Register A
442 */
443#ifndef __ASSEMBLY__
444typedef union icrba_u {
445 u64 reg_value;
446 struct {
447 u64 resvd: 6,
448 stall_bte0: 1, /* Stall BTE 0 */
449 stall_bte1: 1, /* Stall BTE 1 */
450 error: 1, /* CRB has an error */
451 ecode: 3, /* Error Code */
452 lnetuce: 1, /* SN0net Uncorrectable error */
453 mark: 1, /* CRB Has been marked */
454 xerr: 1, /* Error bit set in xtalk header */
455 sidn: 4, /* SIDN field from xtalk */
456 tnum: 5, /* TNUM field in xtalk */
457 addr: 38, /* Address of request */
458 valid: 1, /* Valid status */
459 iow: 1; /* IO Write operation */
460 } icrba_fields_s;
461} icrba_t;
462
463/* This is an alternate typedef for the HUB1 CRB A in order to allow
464 runtime selection of the format based on the REV_ID field of the
465 NI_STATUS_REV_ID register. */
466typedef union h1_icrba_u {
467 u64 reg_value;
468
469 struct {
470 u64 resvd: 6,
471 unused: 1, /* Unused but RW!! */
472 error: 1, /* CRB has an error */
473 ecode: 4, /* Error Code */
474 lnetuce: 1, /* SN0net Uncorrectable error */
475 mark: 1, /* CRB Has been marked */
476 xerr: 1, /* Error bit set in xtalk header */
477 sidn: 4, /* SIDN field from xtalk */
478 tnum: 5, /* TNUM field in xtalk */
479 addr: 38, /* Address of request */
480 valid: 1, /* Valid status */
481 iow: 1; /* IO Write operation */
482 } h1_icrba_fields_s;
483} h1_icrba_t;
484
485/* XXX - Is this still right? Check the spec. */
486#define ICRBN_A_CERR_SHFT 54
487#define ICRBN_A_ERR_MASK 0x3ff
488
489#endif /* !__ASSEMBLY__ */
490
491#define IIO_ICRB_ADDR_SHFT 2 /* Shift to get proper address */
492
493/*
494 * values for "ecode" field
495 */
496#define IIO_ICRB_ECODE_DERR 0 /* Directory error due to IIO access */
497#define IIO_ICRB_ECODE_PERR 1 /* Poison error on IO access */
498#define IIO_ICRB_ECODE_WERR 2 /* Write error by IIO access
499 * e.g. WINV to a Read only line.
500 */
501#define IIO_ICRB_ECODE_AERR 3 /* Access error caused by IIO access */
502#define IIO_ICRB_ECODE_PWERR 4 /* Error on partial write */
503#define IIO_ICRB_ECODE_PRERR 5 /* Error on partial read */
504#define IIO_ICRB_ECODE_TOUT 6 /* CRB timeout before deallocating */
505#define IIO_ICRB_ECODE_XTERR 7 /* Incoming xtalk pkt had error bit */
506
507
508
509/*
510 * Fields in CRB Register B
511 */
512#ifndef __ASSEMBLY__
513typedef union icrbb_u {
514 u64 reg_value;
515 struct {
516 u64 rsvd1: 5,
517 btenum: 1, /* BTE to which entry belongs to */
518 cohtrans: 1, /* Coherent transaction */
519 xtsize: 2, /* Xtalk operation size
520 * 0: Double Word
521 * 1: 32 Bytes.
522 * 2: 128 Bytes,
523 * 3: Reserved.
524 */
525 srcnode: 9, /* Source Node ID */
526 srcinit: 2, /* Source Initiator:
527 * See below for field values.
528 */
529 useold: 1, /* Use OLD command for processing */
530 imsgtype: 2, /* Incoming message type
531 * see below for field values
532 */
533 imsg: 8, /* Incoming message */
534 initator: 3, /* Initiator of original request
535 * See below for field values.
536 */
537 reqtype: 5, /* Identifies type of request
538 * See below for field values.
539 */
540 rsvd2: 7,
541 ackcnt: 11, /* Invalidate ack count */
542 resp: 1, /* data response given to processor */
543 ack: 1, /* indicates data ack received */
544 hold: 1, /* entry is gathering inval acks */
545 wb_pend:1, /* waiting for writeback to complete */
546 intvn: 1, /* Intervention */
547 stall_ib: 1, /* Stall Ibuf (from crosstalk) */
548 stall_intr: 1; /* Stall internal interrupts */
549 } icrbb_field_s;
550} icrbb_t;
551
552/* This is an alternate typedef for the HUB1 CRB B in order to allow
553 runtime selection of the format based on the REV_ID field of the
554 NI_STATUS_REV_ID register. */
555typedef union h1_icrbb_u {
556 u64 reg_value;
557 struct {
558 u64 rsvd1: 5,
559 btenum: 1, /* BTE to which entry belongs to */
560 cohtrans: 1, /* Coherent transaction */
561 xtsize: 2, /* Xtalk operation size
562 * 0: Double Word
563 * 1: 32 Bytes.
564 * 2: 128 Bytes,
565 * 3: Reserved.
566 */
567 srcnode: 9, /* Source Node ID */
568 srcinit: 2, /* Source Initiator:
569 * See below for field values.
570 */
571 useold: 1, /* Use OLD command for processing */
572 imsgtype: 2, /* Incoming message type
573 * see below for field values
574 */
575 imsg: 8, /* Incoming message */
576 initator: 3, /* Initiator of original request
577 * See below for field values.
578 */
579 rsvd2: 1,
580 pcache: 1, /* entry belongs to partial cache */
581 reqtype: 5, /* Identifies type of request
582 * See below for field values.
583 */
584 stl_ib: 1, /* stall Ibus coming from xtalk */
585 stl_intr: 1, /* Stall internal interrupts */
586 stl_bte0: 1, /* Stall BTE 0 */
587 stl_bte1: 1, /* Stall BTE 1 */
588 intrvn: 1, /* Req was target of intervention */
589 ackcnt: 11, /* Invalidate ack count */
590 resp: 1, /* data response given to processor */
591 ack: 1, /* indicates data ack received */
592 hold: 1, /* entry is gathering inval acks */
593 wb_pend:1, /* waiting for writeback to complete */
594 sleep: 1, /* xtalk req sleeping till IO-sync */
595 pnd_reply: 1, /* replies not issed due to IOQ full */
596 pnd_req: 1; /* reqs not issued due to IOQ full */
597 } h1_icrbb_field_s;
598} h1_icrbb_t;
599
600
601#define b_imsgtype icrbb_field_s.imsgtype
602#define b_btenum icrbb_field_s.btenum
603#define b_cohtrans icrbb_field_s.cohtrans
604#define b_xtsize icrbb_field_s.xtsize
605#define b_srcnode icrbb_field_s.srcnode
606#define b_srcinit icrbb_field_s.srcinit
607#define b_imsgtype icrbb_field_s.imsgtype
608#define b_imsg icrbb_field_s.imsg
609#define b_initiator icrbb_field_s.initiator
610
611#endif /* !__ASSEMBLY__ */
612
613/*
614 * values for field xtsize
615 */
616#define IIO_ICRB_XTSIZE_DW 0 /* Xtalk operation size is 8 bytes */
617#define IIO_ICRB_XTSIZE_32 1 /* Xtalk operation size is 32 bytes */
618#define IIO_ICRB_XTSIZE_128 2 /* Xtalk operation size is 128 bytes */
619
620/*
621 * values for field srcinit
622 */
623#define IIO_ICRB_PROC0 0 /* Source of request is Proc 0 */
624#define IIO_ICRB_PROC1 1 /* Source of request is Proc 1 */
625#define IIO_ICRB_GB_REQ 2 /* Source is Guranteed BW request */
626#define IIO_ICRB_IO_REQ 3 /* Source is Normal IO request */
627
628/*
629 * Values for field imsgtype
630 */
631#define IIO_ICRB_IMSGT_XTALK 0 /* Incoming Meessage from Xtalk */
632#define IIO_ICRB_IMSGT_BTE 1 /* Incoming message from BTE */
633#define IIO_ICRB_IMSGT_SN0NET 2 /* Incoming message from SN0 net */
634#define IIO_ICRB_IMSGT_CRB 3 /* Incoming message from CRB ??? */
635
636/*
637 * values for field initiator.
638 */
639#define IIO_ICRB_INIT_XTALK 0 /* Message originated in xtalk */
640#define IIO_ICRB_INIT_BTE0 0x1 /* Message originated in BTE 0 */
641#define IIO_ICRB_INIT_SN0NET 0x2 /* Message originated in SN0net */
642#define IIO_ICRB_INIT_CRB 0x3 /* Message originated in CRB ? */
643#define IIO_ICRB_INIT_BTE1 0x5 /* MEssage originated in BTE 1 */
644
645/*
646 * Values for field reqtype.
647 */
648/* XXX - Need to fix this for Hub 2 */
649#define IIO_ICRB_REQ_DWRD 0 /* Request type double word */
650#define IIO_ICRB_REQ_QCLRD 1 /* Request is Qrtr Caceh line Rd */
651#define IIO_ICRB_REQ_BLKRD 2 /* Request is block read */
652#define IIO_ICRB_REQ_RSHU 6 /* Request is BTE block read */
653#define IIO_ICRB_REQ_REXU 7 /* request is BTE Excl Read */
654#define IIO_ICRB_REQ_RDEX 8 /* Request is Read Exclusive */
655#define IIO_ICRB_REQ_WINC 9 /* Request is Write Invalidate */
656#define IIO_ICRB_REQ_BWINV 10 /* Request is BTE Winv */
657#define IIO_ICRB_REQ_PIORD 11 /* Request is PIO read */
658#define IIO_ICRB_REQ_PIOWR 12 /* Request is PIO Write */
659#define IIO_ICRB_REQ_PRDM 13 /* Request is Fetch&Op */
660#define IIO_ICRB_REQ_PWRM 14 /* Request is Store &Op */
661#define IIO_ICRB_REQ_PTPWR 15 /* Request is Peer to peer */
662#define IIO_ICRB_REQ_WB 16 /* Request is Write back */
663#define IIO_ICRB_REQ_DEX 17 /* Retained DEX Cache line */
664
665/*
666 * Fields in CRB Register C
667 */
668
669#ifndef __ASSEMBLY__
670
671typedef union icrbc_s {
672 u64 reg_value;
673 struct {
674 u64 rsvd: 6,
675 sleep: 1,
676 pricnt: 4, /* Priority count sent with Read req */
677 pripsc: 4, /* Priority Pre scalar */
678 bteop: 1, /* BTE Operation */
679 push_be: 34, /* Push address Byte enable
680 * Holds push addr, if CRB is for BTE
681 * If CRB belongs to Partial cache,
682 * this contains byte enables bits
683 * ([47:46] = 0)
684 */
685 suppl: 11, /* Supplemental field */
686 barrop: 1, /* Barrier Op bit set in xtalk req */
687 doresp: 1, /* Xtalk req needs a response */
688 gbr: 1; /* GBR bit set in xtalk packet */
689 } icrbc_field_s;
690} icrbc_t;
691
692#define c_pricnt icrbc_field_s.pricnt
693#define c_pripsc icrbc_field_s.pripsc
694#define c_bteop icrbc_field_s.bteop
695#define c_bteaddr icrbc_field_s.push_be /* push_be field has 2 names */
696#define c_benable icrbc_field_s.push_be /* push_be field has 2 names */
697#define c_suppl icrbc_field_s.suppl
698#define c_barrop icrbc_field_s.barrop
699#define c_doresp icrbc_field_s.doresp
700#define c_gbr icrbc_field_s.gbr
701#endif /* !__ASSEMBLY__ */
702
703/*
704 * Fields in CRB Register D
705 */
706
707#ifndef __ASSEMBLY__
708typedef union icrbd_s {
709 u64 reg_value;
710 struct {
711 u64 rsvd: 38,
712 toutvld: 1, /* Timeout in progress for this CRB */
713 ctxtvld: 1, /* Context field below is valid */
714 rsvd2: 1,
715 context: 15, /* Bit vector:
716 * Has a bit set for each CRB entry
717 * which needs to be deallocated
718 * before this CRB entry is processed.
719 * Set only for barrier operations.
720 */
721 timeout: 8; /* Timeout Upper 8 bits */
722 } icrbd_field_s;
723} icrbd_t;
724
725#define icrbd_toutvld icrbd_field_s.toutvld
726#define icrbd_ctxtvld icrbd_field_s.ctxtvld
727#define icrbd_context icrbd_field_s.context
728
729
730typedef union hubii_ifdr_u {
731 u64 hi_ifdr_value;
732 struct {
733 u64 ifdr_rsvd: 49,
734 ifdr_maxrp: 7,
735 ifdr_rsvd1: 1,
736 ifdr_maxrq: 7;
737 } hi_ifdr_fields;
738} hubii_ifdr_t;
739
740#endif /* !__ASSEMBLY__ */
741
742/*
743 * Hardware designed names for the BTE control registers.
744 */
745#define IIO_IBLS_0 0x410000 /* BTE length/status 0 */
746#define IIO_IBSA_0 0x410008 /* BTE source address 0 */
747#define IIO_IBDA_0 0x410010 /* BTE destination address 0 */
748#define IIO_IBCT_0 0x410018 /* BTE control/terminate 0 */
749#define IIO_IBNA_0 0x410020 /* BTE notification address 0 */
750#define IIO_IBNR_0 IIO_IBNA_0
751#define IIO_IBIA_0 0x410028 /* BTE interrupt address 0 */
752
753#define IIO_IBLS_1 0x420000 /* BTE length/status 1 */
754#define IIO_IBSA_1 0x420008 /* BTE source address 1 */
755#define IIO_IBDA_1 0x420010 /* BTE destination address 1 */
756#define IIO_IBCT_1 0x420018 /* BTE control/terminate 1 */
757#define IIO_IBNA_1 0x420020 /* BTE notification address 1 */
758#define IIO_IBNR_1 IIO_IBNA_1
759#define IIO_IBIA_1 0x420028 /* BTE interrupt address 1 */
760
761/*
762 * More miscellaneous registers
763 */
764#define IIO_IPCR 0x430000 /* Performance Control */
765#define IIO_IPPR 0x430008 /* Performance Profiling */
766
767/*
768 * IO Error Clear register bit field definitions
769 */
770#define IECLR_BTE1 (1 << 18) /* clear bte error 1 ??? */
771#define IECLR_BTE0 (1 << 17) /* clear bte error 0 ??? */
772#define IECLR_CRAZY (1 << 16) /* clear crazy bit in wstat reg */
773#define IECLR_PRB_F (1 << 15) /* clear err bit in PRB_F reg */
774#define IECLR_PRB_E (1 << 14) /* clear err bit in PRB_E reg */
775#define IECLR_PRB_D (1 << 13) /* clear err bit in PRB_D reg */
776#define IECLR_PRB_C (1 << 12) /* clear err bit in PRB_C reg */
777#define IECLR_PRB_B (1 << 11) /* clear err bit in PRB_B reg */
778#define IECLR_PRB_A (1 << 10) /* clear err bit in PRB_A reg */
779#define IECLR_PRB_9 (1 << 9) /* clear err bit in PRB_9 reg */
780#define IECLR_PRB_8 (1 << 8) /* clear err bit in PRB_8 reg */
781#define IECLR_PRB_0 (1 << 0) /* clear err bit in PRB_0 reg */
782
783/*
784 * IO PIO Read Table Entry format
785 */
786
787#ifndef __ASSEMBLY__
788
789typedef union iprte_a {
790 u64 entry;
791 struct {
792 u64 rsvd1 : 7, /* Reserved field */
793 valid : 1, /* Maps to a timeout entry */
794 rsvd2 : 1,
795 srcnode : 9, /* Node which did this PIO */
796 initiator : 2, /* If T5A or T5B or IO */
797 rsvd3 : 3,
798 addr : 38, /* Physical address of PIO */
799 rsvd4 : 3;
800 } iprte_fields;
801} iprte_a_t;
802
803#define iprte_valid iprte_fields.valid
804#define iprte_timeout iprte_fields.timeout
805#define iprte_srcnode iprte_fields.srcnode
806#define iprte_init iprte_fields.initiator
807#define iprte_addr iprte_fields.addr
808
809#endif /* !__ASSEMBLY__ */
810
811#define IPRTE_ADDRSHFT 3
812
813/*
814 * Hub IIO PRB Register format.
815 */
816
817#ifndef __ASSEMBLY__
818/*
819 * Note: Fields bnakctr, anakctr, xtalkctrmode, ovflow fields are
820 * "Status" fields, and should only be used in case of clean up after errors.
821 */
822
823typedef union iprb_u {
824 u64 reg_value;
825 struct {
826 u64 rsvd1: 15,
827 error: 1, /* Widget rcvd wr resp pkt w/ error */
828 ovflow: 5, /* Over flow count. perf measurement */
829 fire_and_forget: 1, /* Launch Write without response */
830 mode: 2, /* Widget operation Mode */
831 rsvd2: 2,
832 bnakctr: 14,
833 rsvd3: 2,
834 anakctr: 14,
835 xtalkctr: 8;
836 } iprb_fields_s;
837} iprb_t;
838
839#define iprb_regval reg_value
840
841#define iprb_error iprb_fields_s.error
842#define iprb_ovflow iprb_fields_s.ovflow
843#define iprb_ff iprb_fields_s.fire_and_forget
844#define iprb_mode iprb_fields_s.mode
845#define iprb_bnakctr iprb_fields_s.bnakctr
846#define iprb_anakctr iprb_fields_s.anakctr
847#define iprb_xtalkctr iprb_fields_s.xtalkctr
848
849#endif /* !__ASSEMBLY__ */
850
851/*
852 * values for mode field in iprb_t.
853 * For details of the meanings of NAK and Accept, refer the PIO flow
854 * document
855 */
856#define IPRB_MODE_NORMAL (0)
857#define IPRB_MODE_COLLECT_A (1) /* PRB in collect A mode */
858#define IPRB_MODE_SERVICE_A (2) /* NAK B and Accept A */
859#define IPRB_MODE_SERVICE_B (3) /* NAK A and Accept B */
860
861/*
862 * IO CRB entry C_A to E_A : Partial (cache) CRBS
863 */
864#ifndef __ASSEMBLY__
865typedef union icrbp_a {
866 u64 ip_reg; /* the entire register value */
867 struct {
868 u64 error: 1, /* 63, error occurred */
869 ln_uce: 1, /* 62: uncorrectable memory */
870 ln_ae: 1, /* 61: protection violation */
871 ln_werr:1, /* 60: write access error */
872 ln_aerr:1, /* 59: sn0net: Address error */
873 ln_perr:1, /* 58: sn0net: poison error */
874 timeout:1, /* 57: CRB timed out */
875 l_bdpkt:1, /* 56: truncated pkt on sn0net */
876 c_bdpkt:1, /* 55: truncated pkt on xtalk */
877 c_err: 1, /* 54: incoming xtalk req, err set*/
878 rsvd1: 12, /* 53-42: reserved */
879 valid: 1, /* 41: Valid status */
880 sidn: 4, /* 40-37: SIDN field of xtalk rqst */
881 tnum: 5, /* 36-32: TNUM of xtalk request */
882 bo: 1, /* 31: barrier op set in xtalk rqst*/
883 resprqd:1, /* 30: xtalk rqst requires response*/
884 gbr: 1, /* 29: gbr bit set in xtalk rqst */
885 size: 2, /* 28-27: size of xtalk request */
886 excl: 4, /* 26-23: exclusive bit(s) */
887 stall: 3, /* 22-20: stall (xtalk, bte 0/1) */
888 intvn: 1, /* 19: rqst target of intervention*/
889 resp: 1, /* 18: Data response given to t5 */
890 ack: 1, /* 17: Data ack received. */
891 hold: 1, /* 16: crb gathering invalidate acks*/
892 wb: 1, /* 15: writeback pending. */
893 ack_cnt:11, /* 14-04: counter of invalidate acks*/
894 tscaler:4; /* 03-00: Timeout prescaler */
895 } ip_fmt;
896} icrbp_a_t;
897
898#endif /* !__ASSEMBLY__ */
899
900/*
901 * A couple of defines to go with the above structure.
902 */
903#define ICRBP_A_CERR_SHFT 54
904#define ICRBP_A_ERR_MASK 0x3ff
905
906#ifndef __ASSEMBLY__
907typedef union hubii_idsr {
908 u64 iin_reg;
909 struct {
910 u64 rsvd1 : 35,
911 isent : 1,
912 rsvd2 : 3,
913 ienable: 1,
914 rsvd : 7,
915 node : 9,
916 rsvd4 : 1,
917 level : 7;
918 } iin_fmt;
919} hubii_idsr_t;
920#endif /* !__ASSEMBLY__ */
921
922/*
923 * IO BTE Length/Status (IIO_IBLS) register bit field definitions
924 */
925#define IBLS_BUSY (0x1 << 20)
926#define IBLS_ERROR_SHFT 16
927#define IBLS_ERROR (0x1 << IBLS_ERROR_SHFT)
928#define IBLS_LENGTH_MASK 0xffff
929
930/*
931 * IO BTE Control/Terminate register (IBCT) register bit field definitions
932 */
933#define IBCT_POISON (0x1 << 8)
934#define IBCT_NOTIFY (0x1 << 4)
935#define IBCT_ZFIL_MODE (0x1 << 0)
936
937/*
938 * IO BTE Interrupt Address Register (IBIA) register bit field definitions
939 */
940#define IBIA_LEVEL_SHFT 16
941#define IBIA_LEVEL_MASK (0x7f << IBIA_LEVEL_SHFT)
942#define IBIA_NODE_ID_SHFT 0
943#define IBIA_NODE_ID_MASK (0x1ff)
944
945/*
946 * Miscellaneous hub constants
947 */
948
949/* Number of widgets supported by hub */
950#define HUB_NUM_WIDGET 9
951#define HUB_WIDGET_ID_MIN 0x8
952#define HUB_WIDGET_ID_MAX 0xf
953
954#define HUB_WIDGET_PART_NUM 0xc101
955#define MAX_HUBS_PER_XBOW 2
956
957/*
958 * Get a hub's widget id from widget control register
959 */
960#define IIO_WCR_WID_GET(nasid) (REMOTE_HUB_L(nasid, III_WCR) & 0xf)
961#define IIO_WST_ERROR_MASK (UINT64_CAST 1 << 32) /* Widget status error */
962
963/*
964 * Number of credits Hub widget has while sending req/response to
965 * xbow.
966 * Value of 3 is required by Xbow 1.1
967 * We may be able to increase this to 4 with Xbow 1.2.
968 */
969#define HUBII_XBOW_CREDIT 3
970#define HUBII_XBOW_REV2_CREDIT 4
971
972#endif /* _ASM_SGI_SN_SN0_HUBIO_H */
diff --git a/include/asm-mips/sn/sn0/hubmd.h b/include/asm-mips/sn/sn0/hubmd.h
deleted file mode 100644
index 14c225d80664..000000000000
--- a/include/asm-mips/sn/sn0/hubmd.h
+++ /dev/null
@@ -1,789 +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 * Derived from IRIX <sys/SN/SN0/hubmd.h>, revision 1.59.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_HUBMD_H
12#define _ASM_SN_SN0_HUBMD_H
13
14
15/*
16 * Hub Memory/Directory interface registers
17 */
18#define CACHE_SLINE_SIZE 128 /* Secondary cache line size on SN0 */
19
20#define MAX_REGIONS 64
21
22/* Hardware page size and shift */
23
24#define MD_PAGE_SIZE 4096 /* Page size in bytes */
25#define MD_PAGE_NUM_SHFT 12 /* Address to page number shift */
26
27/* Register offsets from LOCAL_HUB or REMOTE_HUB */
28
29#define MD_BASE 0x200000
30#define MD_BASE_PERF 0x210000
31#define MD_BASE_JUNK 0x220000
32
33#define MD_IO_PROTECT 0x200000 /* MD and core register protection */
34#define MD_IO_PROT_OVRRD 0x200008 /* Clear my bit in MD_IO_PROTECT */
35#define MD_HSPEC_PROTECT 0x200010 /* BDDIR, LBOOT, RBOOT protection */
36#define MD_MEMORY_CONFIG 0x200018 /* Memory/Directory DIMM control */
37#define MD_REFRESH_CONTROL 0x200020 /* Memory/Directory refresh ctrl */
38#define MD_FANDOP_CAC_STAT 0x200028 /* Fetch-and-op cache status */
39#define MD_MIG_DIFF_THRESH 0x200030 /* Page migr. count diff thresh. */
40#define MD_MIG_VALUE_THRESH 0x200038 /* Page migr. count abs. thresh. */
41#define MD_MIG_CANDIDATE 0x200040 /* Latest page migration candidate */
42#define MD_MIG_CANDIDATE_CLR 0x200048 /* Clear page migration candidate */
43#define MD_DIR_ERROR 0x200050 /* Directory DIMM error */
44#define MD_DIR_ERROR_CLR 0x200058 /* Directory DIMM error clear */
45#define MD_PROTOCOL_ERROR 0x200060 /* Directory protocol error */
46#define MD_PROTOCOL_ERROR_CLR 0x200068 /* Directory protocol error clear */
47#define MD_MEM_ERROR 0x200070 /* Memory DIMM error */
48#define MD_MEM_ERROR_CLR 0x200078 /* Memory DIMM error clear */
49#define MD_MISC_ERROR 0x200080 /* Miscellaneous MD error */
50#define MD_MISC_ERROR_CLR 0x200088 /* Miscellaneous MD error clear */
51#define MD_MEM_DIMM_INIT 0x200090 /* Memory DIMM mode initization. */
52#define MD_DIR_DIMM_INIT 0x200098 /* Directory DIMM mode init. */
53#define MD_MOQ_SIZE 0x2000a0 /* MD outgoing queue size */
54#define MD_MLAN_CTL 0x2000a8 /* NIC (Microlan) control register */
55
56#define MD_PERF_SEL 0x210000 /* Select perf monitor events */
57#define MD_PERF_CNT0 0x210010 /* Performance counter 0 */
58#define MD_PERF_CNT1 0x210018 /* Performance counter 1 */
59#define MD_PERF_CNT2 0x210020 /* Performance counter 2 */
60#define MD_PERF_CNT3 0x210028 /* Performance counter 3 */
61#define MD_PERF_CNT4 0x210030 /* Performance counter 4 */
62#define MD_PERF_CNT5 0x210038 /* Performance counter 5 */
63
64#define MD_UREG0_0 0x220000 /* uController/UART 0 register */
65#define MD_UREG0_1 0x220008 /* uController/UART 0 register */
66#define MD_UREG0_2 0x220010 /* uController/UART 0 register */
67#define MD_UREG0_3 0x220018 /* uController/UART 0 register */
68#define MD_UREG0_4 0x220020 /* uController/UART 0 register */
69#define MD_UREG0_5 0x220028 /* uController/UART 0 register */
70#define MD_UREG0_6 0x220030 /* uController/UART 0 register */
71#define MD_UREG0_7 0x220038 /* uController/UART 0 register */
72
73#define MD_SLOTID_USTAT 0x220048 /* Hub slot ID & UART/uCtlr status */
74#define MD_LED0 0x220050 /* Eight-bit LED for CPU A */
75#define MD_LED1 0x220058 /* Eight-bit LED for CPU B */
76
77#define MD_UREG1_0 0x220080 /* uController/UART 1 register */
78#define MD_UREG1_1 0x220088 /* uController/UART 1 register */
79#define MD_UREG1_2 0x220090 /* uController/UART 1 register */
80#define MD_UREG1_3 0x220098 /* uController/UART 1 register */
81#define MD_UREG1_4 0x2200a0 /* uController/UART 1 register */
82#define MD_UREG1_5 0x2200a8 /* uController/UART 1 register */
83#define MD_UREG1_6 0x2200b0 /* uController/UART 1 register */
84#define MD_UREG1_7 0x2200b8 /* uController/UART 1 register */
85#define MD_UREG1_8 0x2200c0 /* uController/UART 1 register */
86#define MD_UREG1_9 0x2200c8 /* uController/UART 1 register */
87#define MD_UREG1_10 0x2200d0 /* uController/UART 1 register */
88#define MD_UREG1_11 0x2200d8 /* uController/UART 1 register */
89#define MD_UREG1_12 0x2200e0 /* uController/UART 1 register */
90#define MD_UREG1_13 0x2200e8 /* uController/UART 1 register */
91#define MD_UREG1_14 0x2200f0 /* uController/UART 1 register */
92#define MD_UREG1_15 0x2200f8 /* uController/UART 1 register */
93
94#ifdef CONFIG_SGI_SN_N_MODE
95#define MD_MEM_BANKS 4 /* 4 banks of memory max in N mode */
96#else
97#define MD_MEM_BANKS 8 /* 8 banks of memory max in M mode */
98#endif
99
100/*
101 * MD_MEMORY_CONFIG fields
102 *
103 * MD_SIZE_xxx are useful for representing the size of a SIMM or bank
104 * (SIMM pair). They correspond to the values needed for the bit
105 * triplets (MMC_BANK_MASK) in the MD_MEMORY_CONFIG register for bank size.
106 * Bits not used by the MD are used by software.
107 */
108
109#define MD_SIZE_EMPTY 0 /* Valid in MEMORY_CONFIG */
110#define MD_SIZE_8MB 1
111#define MD_SIZE_16MB 2
112#define MD_SIZE_32MB 3 /* Broken in Hub 1 */
113#define MD_SIZE_64MB 4 /* Valid in MEMORY_CONFIG */
114#define MD_SIZE_128MB 5 /* Valid in MEMORY_CONFIG */
115#define MD_SIZE_256MB 6
116#define MD_SIZE_512MB 7 /* Valid in MEMORY_CONFIG */
117#define MD_SIZE_1GB 8
118#define MD_SIZE_2GB 9
119#define MD_SIZE_4GB 10
120
121#define MD_SIZE_BYTES(size) ((size) == 0 ? 0 : 0x400000L << (size))
122#define MD_SIZE_MBYTES(size) ((size) == 0 ? 0 : 4 << (size))
123
124#define MMC_FPROM_CYC_SHFT 49 /* Have to use UINT64_CAST, instead */
125#define MMC_FPROM_CYC_MASK (UINT64_CAST 31 << 49) /* of 'L' suffix, */
126#define MMC_FPROM_WR_SHFT 44 /* for assembler */
127#define MMC_FPROM_WR_MASK (UINT64_CAST 31 << 44)
128#define MMC_UCTLR_CYC_SHFT 39
129#define MMC_UCTLR_CYC_MASK (UINT64_CAST 31 << 39)
130#define MMC_UCTLR_WR_SHFT 34
131#define MMC_UCTLR_WR_MASK (UINT64_CAST 31 << 34)
132#define MMC_DIMM0_SEL_SHFT 32
133#define MMC_DIMM0_SEL_MASK (UINT64_CAST 3 << 32)
134#define MMC_IO_PROT_EN_SHFT 31
135#define MMC_IO_PROT_EN_MASK (UINT64_CAST 1 << 31)
136#define MMC_IO_PROT (UINT64_CAST 1 << 31)
137#define MMC_ARB_MLSS_SHFT 30
138#define MMC_ARB_MLSS_MASK (UINT64_CAST 1 << 30)
139#define MMC_ARB_MLSS (UINT64_CAST 1 << 30)
140#define MMC_IGNORE_ECC_SHFT 29
141#define MMC_IGNORE_ECC_MASK (UINT64_CAST 1 << 29)
142#define MMC_IGNORE_ECC (UINT64_CAST 1 << 29)
143#define MMC_DIR_PREMIUM_SHFT 28
144#define MMC_DIR_PREMIUM_MASK (UINT64_CAST 1 << 28)
145#define MMC_DIR_PREMIUM (UINT64_CAST 1 << 28)
146#define MMC_REPLY_GUAR_SHFT 24
147#define MMC_REPLY_GUAR_MASK (UINT64_CAST 15 << 24)
148#define MMC_BANK_SHFT(_b) ((_b) * 3)
149#define MMC_BANK_MASK(_b) (UINT64_CAST 7 << MMC_BANK_SHFT(_b))
150#define MMC_BANK_ALL_MASK 0xffffff
151#define MMC_RESET_DEFAULTS (UINT64_CAST 0x0f << MMC_FPROM_CYC_SHFT | \
152 UINT64_CAST 0x07 << MMC_FPROM_WR_SHFT | \
153 UINT64_CAST 0x1f << MMC_UCTLR_CYC_SHFT | \
154 UINT64_CAST 0x0f << MMC_UCTLR_WR_SHFT | \
155 MMC_IGNORE_ECC | MMC_DIR_PREMIUM | \
156 UINT64_CAST 0x0f << MMC_REPLY_GUAR_SHFT | \
157 MMC_BANK_ALL_MASK)
158
159/* MD_REFRESH_CONTROL fields */
160
161#define MRC_ENABLE_SHFT 63
162#define MRC_ENABLE_MASK (UINT64_CAST 1 << 63)
163#define MRC_ENABLE (UINT64_CAST 1 << 63)
164#define MRC_COUNTER_SHFT 12
165#define MRC_COUNTER_MASK (UINT64_CAST 0xfff << 12)
166#define MRC_CNT_THRESH_MASK 0xfff
167#define MRC_RESET_DEFAULTS (UINT64_CAST 0x400)
168
169/* MD_MEM_DIMM_INIT and MD_DIR_DIMM_INIT fields */
170
171#define MDI_SELECT_SHFT 32
172#define MDI_SELECT_MASK (UINT64_CAST 0x0f << 32)
173#define MDI_DIMM_MODE_MASK (UINT64_CAST 0xfff)
174
175/* MD_MOQ_SIZE fields */
176
177#define MMS_RP_SIZE_SHFT 8
178#define MMS_RP_SIZE_MASK (UINT64_CAST 0x3f << 8)
179#define MMS_RQ_SIZE_SHFT 0
180#define MMS_RQ_SIZE_MASK (UINT64_CAST 0x1f)
181#define MMS_RESET_DEFAULTS (0x32 << 8 | 0x12)
182
183/* MD_FANDOP_CAC_STAT fields */
184
185#define MFC_VALID_SHFT 63
186#define MFC_VALID_MASK (UINT64_CAST 1 << 63)
187#define MFC_VALID (UINT64_CAST 1 << 63)
188#define MFC_ADDR_SHFT 6
189#define MFC_ADDR_MASK (UINT64_CAST 0x3ffffff)
190
191/* MD_MLAN_CTL fields */
192
193#define MLAN_PHI1_SHFT 27
194#define MLAN_PHI1_MASK (UINT64_CAST 0x7f << 27)
195#define MLAN_PHI0_SHFT 20
196#define MLAN_PHI0_MASK (UINT64_CAST 0x7f << 27)
197#define MLAN_PULSE_SHFT 10
198#define MLAN_PULSE_MASK (UINT64_CAST 0x3ff << 10)
199#define MLAN_SAMPLE_SHFT 2
200#define MLAN_SAMPLE_MASK (UINT64_CAST 0xff << 2)
201#define MLAN_DONE_SHFT 1
202#define MLAN_DONE_MASK 2
203#define MLAN_DONE (UINT64_CAST 0x02)
204#define MLAN_RD_DATA (UINT64_CAST 0x01)
205#define MLAN_RESET_DEFAULTS (UINT64_CAST 0x31 << MLAN_PHI1_SHFT | \
206 UINT64_CAST 0x31 << MLAN_PHI0_SHFT)
207
208/* MD_SLOTID_USTAT bit definitions */
209
210#define MSU_CORECLK_TST_SHFT 7 /* You don't wanna know */
211#define MSU_CORECLK_TST_MASK (UINT64_CAST 1 << 7)
212#define MSU_CORECLK_TST (UINT64_CAST 1 << 7)
213#define MSU_CORECLK_SHFT 6 /* You don't wanna know */
214#define MSU_CORECLK_MASK (UINT64_CAST 1 << 6)
215#define MSU_CORECLK (UINT64_CAST 1 << 6)
216#define MSU_NETSYNC_SHFT 5 /* You don't wanna know */
217#define MSU_NETSYNC_MASK (UINT64_CAST 1 << 5)
218#define MSU_NETSYNC (UINT64_CAST 1 << 5)
219#define MSU_FPROMRDY_SHFT 4 /* Flash PROM ready bit */
220#define MSU_FPROMRDY_MASK (UINT64_CAST 1 << 4)
221#define MSU_FPROMRDY (UINT64_CAST 1 << 4)
222#define MSU_I2CINTR_SHFT 3 /* I2C interrupt bit */
223#define MSU_I2CINTR_MASK (UINT64_CAST 1 << 3)
224#define MSU_I2CINTR (UINT64_CAST 1 << 3)
225#define MSU_SLOTID_MASK 0xff
226#define MSU_SN0_SLOTID_SHFT 0 /* Slot ID */
227#define MSU_SN0_SLOTID_MASK (UINT64_CAST 7)
228#define MSU_SN00_SLOTID_SHFT 7
229#define MSU_SN00_SLOTID_MASK (UINT64_CAST 0x80)
230
231#define MSU_PIMM_PSC_SHFT 4
232#define MSU_PIMM_PSC_MASK (0xf << MSU_PIMM_PSC_SHFT)
233
234/* MD_MIG_DIFF_THRESH bit definitions */
235
236#define MD_MIG_DIFF_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
237#define MD_MIG_DIFF_THRES_VALID_SHFT 63
238#define MD_MIG_DIFF_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
239
240/* MD_MIG_VALUE_THRESH bit definitions */
241
242#define MD_MIG_VALUE_THRES_VALID_MASK (UINT64_CAST 0x1 << 63)
243#define MD_MIG_VALUE_THRES_VALID_SHFT 63
244#define MD_MIG_VALUE_THRES_VALUE_MASK (UINT64_CAST 0xfffff)
245
246/* MD_MIG_CANDIDATE bit definitions */
247
248#define MD_MIG_CANDIDATE_VALID_MASK (UINT64_CAST 0x1 << 63)
249#define MD_MIG_CANDIDATE_VALID_SHFT 63
250#define MD_MIG_CANDIDATE_TYPE_MASK (UINT64_CAST 0x1 << 30)
251#define MD_MIG_CANDIDATE_TYPE_SHFT 30
252#define MD_MIG_CANDIDATE_OVERRUN_MASK (UINT64_CAST 0x1 << 29)
253#define MD_MIG_CANDIDATE_OVERRUN_SHFT 29
254#define MD_MIG_CANDIDATE_INITIATOR_MASK (UINT64_CAST 0x7ff << 18)
255#define MD_MIG_CANDIDATE_INITIATOR_SHFT 18
256#define MD_MIG_CANDIDATE_NODEID_MASK (UINT64_CAST 0x1ff << 20)
257#define MD_MIG_CANDIDATE_NODEID_SHFT 20
258#define MD_MIG_CANDIDATE_ADDR_MASK (UINT64_CAST 0x3ffff)
259#define MD_MIG_CANDIDATE_ADDR_SHFT 14 /* The address starts at bit 14 */
260
261/* Other MD definitions */
262
263#define MD_BANK_SHFT 29 /* log2(512 MB) */
264#define MD_BANK_MASK (UINT64_CAST 7 << 29)
265#define MD_BANK_SIZE (UINT64_CAST 1 << MD_BANK_SHFT) /* 512 MB */
266#define MD_BANK_OFFSET(_b) (UINT64_CAST (_b) << MD_BANK_SHFT)
267
268/*
269 * The following definitions cover the bit field definitions for the
270 * various MD registers. For multi-bit registers, we define both
271 * a shift amount and a mask value. By convention, if you want to
272 * isolate a field, you should mask the field and then shift it down,
273 * since this makes the masks useful without a shift.
274 */
275
276/* Directory entry states for both premium and standard SIMMs. */
277
278#define MD_DIR_SHARED (UINT64_CAST 0x0) /* 000 */
279#define MD_DIR_POISONED (UINT64_CAST 0x1) /* 001 */
280#define MD_DIR_EXCLUSIVE (UINT64_CAST 0x2) /* 010 */
281#define MD_DIR_BUSY_SHARED (UINT64_CAST 0x3) /* 011 */
282#define MD_DIR_BUSY_EXCL (UINT64_CAST 0x4) /* 100 */
283#define MD_DIR_WAIT (UINT64_CAST 0x5) /* 101 */
284#define MD_DIR_UNOWNED (UINT64_CAST 0x7) /* 111 */
285
286/*
287 * The MD_DIR_FORCE_ECC bit can be added directory entry write data
288 * to forcing the ECC to be written as-is instead of recalculated.
289 */
290
291#define MD_DIR_FORCE_ECC (UINT64_CAST 1 << 63)
292
293/*
294 * Premium SIMM directory entry shifts and masks. Each is valid only in the
295 * context(s) indicated, where A, B, and C indicate the directory entry format
296 * as shown, and low and/or high indicates which double-word of the entry.
297 *
298 * Format A: STATE = shared, FINE = 1
299 * Format B: STATE = shared, FINE = 0
300 * Format C: STATE != shared (FINE must be 0)
301 */
302
303#define MD_PDIR_MASK 0xffffffffffff /* Whole entry */
304#define MD_PDIR_ECC_SHFT 0 /* ABC low or high */
305#define MD_PDIR_ECC_MASK 0x7f
306#define MD_PDIR_PRIO_SHFT 8 /* ABC low */
307#define MD_PDIR_PRIO_MASK (0xf << 8)
308#define MD_PDIR_AX_SHFT 7 /* ABC low */
309#define MD_PDIR_AX_MASK (1 << 7)
310#define MD_PDIR_AX (1 << 7)
311#define MD_PDIR_FINE_SHFT 12 /* ABC low */
312#define MD_PDIR_FINE_MASK (1 << 12)
313#define MD_PDIR_FINE (1 << 12)
314#define MD_PDIR_OCT_SHFT 13 /* A low */
315#define MD_PDIR_OCT_MASK (7 << 13)
316#define MD_PDIR_STATE_SHFT 13 /* BC low */
317#define MD_PDIR_STATE_MASK (7 << 13)
318#define MD_PDIR_ONECNT_SHFT 16 /* BC low */
319#define MD_PDIR_ONECNT_MASK (0x3f << 16)
320#define MD_PDIR_PTR_SHFT 22 /* C low */
321#define MD_PDIR_PTR_MASK (UINT64_CAST 0x7ff << 22)
322#define MD_PDIR_VECMSB_SHFT 22 /* AB low */
323#define MD_PDIR_VECMSB_BITMASK 0x3ffffff
324#define MD_PDIR_VECMSB_BITSHFT 27
325#define MD_PDIR_VECMSB_MASK (UINT64_CAST MD_PDIR_VECMSB_BITMASK << 22)
326#define MD_PDIR_CWOFF_SHFT 7 /* C high */
327#define MD_PDIR_CWOFF_MASK (7 << 7)
328#define MD_PDIR_VECLSB_SHFT 10 /* AB high */
329#define MD_PDIR_VECLSB_BITMASK (UINT64_CAST 0x3fffffffff)
330#define MD_PDIR_VECLSB_BITSHFT 0
331#define MD_PDIR_VECLSB_MASK (MD_PDIR_VECLSB_BITMASK << 10)
332
333/*
334 * Directory initialization values
335 */
336
337#define MD_PDIR_INIT_LO (MD_DIR_UNOWNED << MD_PDIR_STATE_SHFT | \
338 MD_PDIR_AX)
339#define MD_PDIR_INIT_HI 0
340#define MD_PDIR_INIT_PROT (MD_PROT_RW << MD_PPROT_IO_SHFT | \
341 MD_PROT_RW << MD_PPROT_SHFT)
342
343/*
344 * Standard SIMM directory entry shifts and masks. Each is valid only in the
345 * context(s) indicated, where A and C indicate the directory entry format
346 * as shown, and low and/or high indicates which double-word of the entry.
347 *
348 * Format A: STATE == shared
349 * Format C: STATE != shared
350 */
351
352#define MD_SDIR_MASK 0xffff /* Whole entry */
353#define MD_SDIR_ECC_SHFT 0 /* AC low or high */
354#define MD_SDIR_ECC_MASK 0x1f
355#define MD_SDIR_PRIO_SHFT 6 /* AC low */
356#define MD_SDIR_PRIO_MASK (1 << 6)
357#define MD_SDIR_AX_SHFT 5 /* AC low */
358#define MD_SDIR_AX_MASK (1 << 5)
359#define MD_SDIR_AX (1 << 5)
360#define MD_SDIR_STATE_SHFT 7 /* AC low */
361#define MD_SDIR_STATE_MASK (7 << 7)
362#define MD_SDIR_PTR_SHFT 10 /* C low */
363#define MD_SDIR_PTR_MASK (0x3f << 10)
364#define MD_SDIR_CWOFF_SHFT 5 /* C high */
365#define MD_SDIR_CWOFF_MASK (7 << 5)
366#define MD_SDIR_VECMSB_SHFT 11 /* A low */
367#define MD_SDIR_VECMSB_BITMASK 0x1f
368#define MD_SDIR_VECMSB_BITSHFT 7
369#define MD_SDIR_VECMSB_MASK (MD_SDIR_VECMSB_BITMASK << 11)
370#define MD_SDIR_VECLSB_SHFT 5 /* A high */
371#define MD_SDIR_VECLSB_BITMASK 0x7ff
372#define MD_SDIR_VECLSB_BITSHFT 0
373#define MD_SDIR_VECLSB_MASK (MD_SDIR_VECLSB_BITMASK << 5)
374
375/*
376 * Directory initialization values
377 */
378
379#define MD_SDIR_INIT_LO (MD_DIR_UNOWNED << MD_SDIR_STATE_SHFT | \
380 MD_SDIR_AX)
381#define MD_SDIR_INIT_HI 0
382#define MD_SDIR_INIT_PROT (MD_PROT_RW << MD_SPROT_SHFT)
383
384/* Protection and migration field values */
385
386#define MD_PROT_RW (UINT64_CAST 0x6)
387#define MD_PROT_RO (UINT64_CAST 0x3)
388#define MD_PROT_NO (UINT64_CAST 0x0)
389#define MD_PROT_BAD (UINT64_CAST 0x5)
390
391/* Premium SIMM protection entry shifts and masks. */
392
393#define MD_PPROT_SHFT 0 /* Prot. field */
394#define MD_PPROT_MASK 7
395#define MD_PPROT_MIGMD_SHFT 3 /* Migration mode */
396#define MD_PPROT_MIGMD_MASK (3 << 3)
397#define MD_PPROT_REFCNT_SHFT 5 /* Reference count */
398#define MD_PPROT_REFCNT_WIDTH 0x7ffff
399#define MD_PPROT_REFCNT_MASK (MD_PPROT_REFCNT_WIDTH << 5)
400
401#define MD_PPROT_IO_SHFT 45 /* I/O Prot field */
402#define MD_PPROT_IO_MASK (UINT64_CAST 7 << 45)
403
404/* Standard SIMM protection entry shifts and masks. */
405
406#define MD_SPROT_SHFT 0 /* Prot. field */
407#define MD_SPROT_MASK 7
408#define MD_SPROT_MIGMD_SHFT 3 /* Migration mode */
409#define MD_SPROT_MIGMD_MASK (3 << 3)
410#define MD_SPROT_REFCNT_SHFT 5 /* Reference count */
411#define MD_SPROT_REFCNT_WIDTH 0x7ff
412#define MD_SPROT_REFCNT_MASK (MD_SPROT_REFCNT_WIDTH << 5)
413
414/* Migration modes used in protection entries */
415
416#define MD_PROT_MIGMD_IREL (UINT64_CAST 0x3 << 3)
417#define MD_PROT_MIGMD_IABS (UINT64_CAST 0x2 << 3)
418#define MD_PROT_MIGMD_PREL (UINT64_CAST 0x1 << 3)
419#define MD_PROT_MIGMD_OFF (UINT64_CAST 0x0 << 3)
420
421
422/*
423 * Operations on page migration threshold register
424 */
425
426#ifndef __ASSEMBLY__
427
428/*
429 * LED register macros
430 */
431
432#define CPU_LED_ADDR(_nasid, _slice) \
433 (private.p_sn00 ? \
434 REMOTE_HUB_ADDR((_nasid), MD_UREG1_0 + ((_slice) << 5)) : \
435 REMOTE_HUB_ADDR((_nasid), MD_LED0 + ((_slice) << 3)))
436
437#define SET_CPU_LEDS(_nasid, _slice, _val) \
438 (HUB_S(CPU_LED_ADDR(_nasid, _slice), (_val)))
439
440#define SET_MY_LEDS(_v) \
441 SET_CPU_LEDS(get_nasid(), get_slice(), (_v))
442
443/*
444 * Operations on Memory/Directory DIMM control register
445 */
446
447#define DIRTYPE_PREMIUM 1
448#define DIRTYPE_STANDARD 0
449#define MD_MEMORY_CONFIG_DIR_TYPE_GET(region) (\
450 (REMOTE_HUB_L(region, MD_MEMORY_CONFIG) & MMC_DIR_PREMIUM_MASK) >> \
451 MMC_DIR_PREMIUM_SHFT)
452
453
454/*
455 * Operations on page migration count difference and absolute threshold
456 * registers
457 */
458
459#define MD_MIG_DIFF_THRESH_GET(region) ( \
460 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
461 MD_MIG_DIFF_THRES_VALUE_MASK)
462
463#define MD_MIG_DIFF_THRESH_SET(region, value) ( \
464 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
465 MD_MIG_DIFF_THRES_VALID_MASK | (value)))
466
467#define MD_MIG_DIFF_THRESH_DISABLE(region) ( \
468 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
469 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
470 & ~MD_MIG_DIFF_THRES_VALID_MASK))
471
472#define MD_MIG_DIFF_THRESH_ENABLE(region) ( \
473 REMOTE_HUB_S((region), MD_MIG_DIFF_THRESH, \
474 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) \
475 | MD_MIG_DIFF_THRES_VALID_MASK))
476
477#define MD_MIG_DIFF_THRESH_IS_ENABLED(region) ( \
478 REMOTE_HUB_L((region), MD_MIG_DIFF_THRESH) & \
479 MD_MIG_DIFF_THRES_VALID_MASK)
480
481#define MD_MIG_VALUE_THRESH_GET(region) ( \
482 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
483 MD_MIG_VALUE_THRES_VALUE_MASK)
484
485#define MD_MIG_VALUE_THRESH_SET(region, value) ( \
486 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
487 MD_MIG_VALUE_THRES_VALID_MASK | (value)))
488
489#define MD_MIG_VALUE_THRESH_DISABLE(region) ( \
490 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
491 REMOTE_HUB_L(region, MD_MIG_VALUE_THRESH) \
492 & ~MD_MIG_VALUE_THRES_VALID_MASK))
493
494#define MD_MIG_VALUE_THRESH_ENABLE(region) ( \
495 REMOTE_HUB_S((region), MD_MIG_VALUE_THRESH, \
496 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) \
497 | MD_MIG_VALUE_THRES_VALID_MASK))
498
499#define MD_MIG_VALUE_THRESH_IS_ENABLED(region) ( \
500 REMOTE_HUB_L((region), MD_MIG_VALUE_THRESH) & \
501 MD_MIG_VALUE_THRES_VALID_MASK)
502
503/*
504 * Operations on page migration candidate register
505 */
506
507#define MD_MIG_CANDIDATE_GET(my_region_id) ( \
508 REMOTE_HUB_L((my_region_id), MD_MIG_CANDIDATE_CLR))
509
510#define MD_MIG_CANDIDATE_HWPFN(value) ((value) & MD_MIG_CANDIDATE_ADDR_MASK)
511
512#define MD_MIG_CANDIDATE_NODEID(value) ( \
513 ((value) & MD_MIG_CANDIDATE_NODEID_MASK) >> MD_MIG_CANDIDATE_NODEID_SHFT)
514
515#define MD_MIG_CANDIDATE_TYPE(value) ( \
516 ((value) & MD_MIG_CANDIDATE_TYPE_MASK) >> MD_MIG_CANDIDATE_TYPE_SHFT)
517
518#define MD_MIG_CANDIDATE_VALID(value) ( \
519 ((value) & MD_MIG_CANDIDATE_VALID_MASK) >> MD_MIG_CANDIDATE_VALID_SHFT)
520
521/*
522 * Macros to retrieve fields in the protection entry
523 */
524
525/* for Premium SIMM */
526#define MD_PPROT_REFCNT_GET(value) ( \
527 ((value) & MD_PPROT_REFCNT_MASK) >> MD_PPROT_REFCNT_SHFT)
528
529#define MD_PPROT_MIGMD_GET(value) ( \
530 ((value) & MD_PPROT_MIGMD_MASK) >> MD_PPROT_MIGMD_SHFT)
531
532/* for Standard SIMM */
533#define MD_SPROT_REFCNT_GET(value) ( \
534 ((value) & MD_SPROT_REFCNT_MASK) >> MD_SPROT_REFCNT_SHFT)
535
536#define MD_SPROT_MIGMD_GET(value) ( \
537 ((value) & MD_SPROT_MIGMD_MASK) >> MD_SPROT_MIGMD_SHFT)
538
539/*
540 * Format of dir_error, mem_error, protocol_error and misc_error registers
541 */
542
543struct dir_error_reg {
544 u64 uce_vld: 1, /* 63: valid directory uce */
545 ae_vld: 1, /* 62: valid dir prot ecc error */
546 ce_vld: 1, /* 61: valid correctable ECC err*/
547 rsvd1: 19, /* 60-42: reserved */
548 bad_prot: 3, /* 41-39: encoding, bad access rights*/
549 bad_syn: 7, /* 38-32: bad dir syndrome */
550 rsvd2: 2, /* 31-30: reserved */
551 hspec_addr:27, /* 29-03: bddir space bad entry */
552 uce_ovr: 1, /* 2: multiple dir uce's */
553 ae_ovr: 1, /* 1: multiple prot ecc errs*/
554 ce_ovr: 1; /* 0: multiple correctable errs */
555};
556
557typedef union md_dir_error {
558 u64 derr_reg; /* the entire register */
559 struct dir_error_reg derr_fmt; /* the register format */
560} md_dir_error_t;
561
562
563struct mem_error_reg {
564 u64 uce_vld: 1, /* 63: valid memory uce */
565 ce_vld: 1, /* 62: valid correctable ECC err*/
566 rsvd1: 22, /* 61-40: reserved */
567 bad_syn: 8, /* 39-32: bad mem ecc syndrome */
568 address: 29, /* 31-03: bad entry pointer */
569 rsvd2: 1, /* 2: reserved */
570 uce_ovr: 1, /* 1: multiple mem uce's */
571 ce_ovr: 1; /* 0: multiple correctable errs */
572};
573
574
575typedef union md_mem_error {
576 u64 merr_reg; /* the entire register */
577 struct mem_error_reg merr_fmt; /* format of the mem_error reg */
578} md_mem_error_t;
579
580
581struct proto_error_reg {
582 u64 valid: 1, /* 63: valid protocol error */
583 rsvd1: 2, /* 62-61: reserved */
584 initiator:11, /* 60-50: id of request initiator*/
585 backoff: 2, /* 49-48: backoff control */
586 msg_type: 8, /* 47-40: type of request */
587 access: 2, /* 39-38: access rights of initiator*/
588 priority: 1, /* 37: priority level of requestor*/
589 dir_state: 4, /* 36-33: state of directory */
590 pointer_me:1, /* 32: initiator same as dir ptr */
591 address: 29, /* 31-03: request address */
592 rsvd2: 2, /* 02-01: reserved */
593 overrun: 1; /* 0: multiple protocol errs */
594};
595
596typedef union md_proto_error {
597 u64 perr_reg; /* the entire register */
598 struct proto_error_reg perr_fmt; /* format of the register */
599} md_proto_error_t;
600
601
602struct md_sdir_high_fmt {
603 unsigned short sd_hi_bvec : 11,
604 sd_hi_ecc : 5;
605};
606
607
608typedef union md_sdir_high {
609 /* The 16 bits of standard directory, upper word */
610 unsigned short sd_hi_val;
611 struct md_sdir_high_fmt sd_hi_fmt;
612}md_sdir_high_t;
613
614
615struct md_sdir_low_shared_fmt {
616 /* The meaning of lower directory, shared */
617 unsigned short sds_lo_bvec : 5,
618 sds_lo_unused: 1,
619 sds_lo_state : 3,
620 sds_lo_prio : 1,
621 sds_lo_ax : 1,
622 sds_lo_ecc : 5;
623};
624
625struct md_sdir_low_exclusive_fmt {
626 /* The meaning of lower directory, exclusive */
627 unsigned short sde_lo_ptr : 6,
628 sde_lo_state : 3,
629 sde_lo_prio : 1,
630 sde_lo_ax : 1,
631 sde_lo_ecc : 5;
632};
633
634
635typedef union md_sdir_low {
636 /* The 16 bits of standard directory, lower word */
637 unsigned short sd_lo_val;
638 struct md_sdir_low_exclusive_fmt sde_lo_fmt;
639 struct md_sdir_low_shared_fmt sds_lo_fmt;
640}md_sdir_low_t;
641
642
643
644struct md_pdir_high_fmt {
645 u64 pd_hi_unused : 16,
646 pd_hi_bvec : 38,
647 pd_hi_unused1 : 3,
648 pd_hi_ecc : 7;
649};
650
651
652typedef union md_pdir_high {
653 /* The 48 bits of standard directory, upper word */
654 u64 pd_hi_val;
655 struct md_pdir_high_fmt pd_hi_fmt;
656}md_pdir_high_t;
657
658
659struct md_pdir_low_shared_fmt {
660 /* The meaning of lower directory, shared */
661 u64 pds_lo_unused : 16,
662 pds_lo_bvec : 26,
663 pds_lo_cnt : 6,
664 pds_lo_state : 3,
665 pds_lo_ste : 1,
666 pds_lo_prio : 4,
667 pds_lo_ax : 1,
668 pds_lo_ecc : 7;
669};
670
671struct md_pdir_low_exclusive_fmt {
672 /* The meaning of lower directory, exclusive */
673 u64 pde_lo_unused : 31,
674 pde_lo_ptr : 11,
675 pde_lo_unused1 : 6,
676 pde_lo_state : 3,
677 pde_lo_ste : 1,
678 pde_lo_prio : 4,
679 pde_lo_ax : 1,
680 pde_lo_ecc : 7;
681};
682
683
684typedef union md_pdir_loent {
685 /* The 48 bits of premium directory, lower word */
686 u64 pd_lo_val;
687 struct md_pdir_low_exclusive_fmt pde_lo_fmt;
688 struct md_pdir_low_shared_fmt pds_lo_fmt;
689}md_pdir_low_t;
690
691
692/*
693 * the following two "union" definitions and two
694 * "struct" definitions are used in vmdump.c to
695 * represent directory memory information.
696 */
697
698typedef union md_dir_high {
699 md_sdir_high_t md_sdir_high;
700 md_pdir_high_t md_pdir_high;
701} md_dir_high_t;
702
703typedef union md_dir_low {
704 md_sdir_low_t md_sdir_low;
705 md_pdir_low_t md_pdir_low;
706} md_dir_low_t;
707
708typedef struct bddir_entry {
709 md_dir_low_t md_dir_low;
710 md_dir_high_t md_dir_high;
711} bddir_entry_t;
712
713typedef struct dir_mem_entry {
714 u64 prcpf[MAX_REGIONS];
715 bddir_entry_t directory_words[MD_PAGE_SIZE/CACHE_SLINE_SIZE];
716} dir_mem_entry_t;
717
718
719
720typedef union md_perf_sel {
721 u64 perf_sel_reg;
722 struct {
723 u64 perf_rsvd : 60,
724 perf_en : 1,
725 perf_sel : 3;
726 } perf_sel_bits;
727} md_perf_sel_t;
728
729typedef union md_perf_cnt {
730 u64 perf_cnt;
731 struct {
732 u64 perf_rsvd : 44,
733 perf_cnt : 20;
734 } perf_cnt_bits;
735} md_perf_cnt_t;
736
737
738#endif /* !__ASSEMBLY__ */
739
740
741#define DIR_ERROR_VALID_MASK 0xe000000000000000
742#define DIR_ERROR_VALID_SHFT 61
743#define DIR_ERROR_VALID_UCE 0x8000000000000000
744#define DIR_ERROR_VALID_AE 0x4000000000000000
745#define DIR_ERROR_VALID_CE 0x2000000000000000
746
747#define MEM_ERROR_VALID_MASK 0xc000000000000000
748#define MEM_ERROR_VALID_SHFT 62
749#define MEM_ERROR_VALID_UCE 0x8000000000000000
750#define MEM_ERROR_VALID_CE 0x4000000000000000
751
752#define PROTO_ERROR_VALID_MASK 0x8000000000000000
753
754#define MISC_ERROR_VALID_MASK 0x3ff
755
756/*
757 * Mask for hspec address that is stored in the dir error register.
758 * This represents bits 29 through 3.
759 */
760#define DIR_ERR_HSPEC_MASK 0x3ffffff8
761#define ERROR_HSPEC_MASK 0x3ffffff8
762#define ERROR_HSPEC_SHFT 3
763#define ERROR_ADDR_MASK 0xfffffff8
764#define ERROR_ADDR_SHFT 3
765
766/*
767 * MD_MISC_ERROR register defines.
768 */
769
770#define MMCE_VALID_MASK 0x3ff
771#define MMCE_ILL_MSG_SHFT 8
772#define MMCE_ILL_MSG_MASK (UINT64_CAST 0x03 << MMCE_ILL_MSG_SHFT)
773#define MMCE_ILL_REV_SHFT 6
774#define MMCE_ILL_REV_MASK (UINT64_CAST 0x03 << MMCE_ILL_REV_SHFT)
775#define MMCE_LONG_PACK_SHFT 4
776#define MMCE_LONG_PACK_MASK (UINT64_CAST 0x03 << MMCE_lONG_PACK_SHFT)
777#define MMCE_SHORT_PACK_SHFT 2
778#define MMCE_SHORT_PACK_MASK (UINT64_CAST 0x03 << MMCE_SHORT_PACK_SHFT)
779#define MMCE_BAD_DATA_SHFT 0
780#define MMCE_BAD_DATA_MASK (UINT64_CAST 0x03 << MMCE_BAD_DATA_SHFT)
781
782
783#define MD_PERF_COUNTERS 6
784#define MD_PERF_SETS 6
785
786#define MEM_DIMM_MASK 0xe0000000
787#define MEM_DIMM_SHFT 29
788
789#endif /* _ASM_SN_SN0_HUBMD_H */
diff --git a/include/asm-mips/sn/sn0/hubni.h b/include/asm-mips/sn/sn0/hubni.h
deleted file mode 100644
index b40d3ef97a12..000000000000
--- a/include/asm-mips/sn/sn0/hubni.h
+++ /dev/null
@@ -1,255 +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 * Derived from IRIX <sys/SN/SN0/hubni.h>, Revision 1.27.
7 *
8 * Copyright (C) 1992-1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SGI_SN0_HUBNI_H
12#define _ASM_SGI_SN0_HUBNI_H
13
14#ifndef __ASSEMBLY__
15#include <linux/types.h>
16#endif
17
18/*
19 * Hub Network Interface registers
20 *
21 * All registers in this file are subject to change until Hub chip tapeout.
22 */
23
24#define NI_BASE 0x600000
25#define NI_BASE_TABLES 0x630000
26
27#define NI_STATUS_REV_ID 0x600000 /* Hub network status, rev, and ID */
28#define NI_PORT_RESET 0x600008 /* Reset the network interface */
29#define NI_PROTECTION 0x600010 /* NI register access permissions */
30#define NI_GLOBAL_PARMS 0x600018 /* LLP parameters */
31#define NI_SCRATCH_REG0 0x600100 /* Scratch register 0 (64 bits) */
32#define NI_SCRATCH_REG1 0x600108 /* Scratch register 1 (64 bits) */
33#define NI_DIAG_PARMS 0x600110 /* Parameters for diags */
34
35#define NI_VECTOR_PARMS 0x600200 /* Vector PIO routing parameters */
36#define NI_VECTOR 0x600208 /* Vector PIO route */
37#define NI_VECTOR_DATA 0x600210 /* Vector PIO data */
38#define NI_VECTOR_STATUS 0x600300 /* Vector PIO return status */
39#define NI_RETURN_VECTOR 0x600308 /* Vector PIO return vector */
40#define NI_VECTOR_READ_DATA 0x600310 /* Vector PIO read data */
41#define NI_VECTOR_CLEAR 0x600380 /* Vector PIO read & clear status */
42
43#define NI_IO_PROTECT 0x600400 /* PIO protection bits */
44#define NI_IO_PROT_OVRRD 0x600408 /* PIO protection bit override */
45
46#define NI_AGE_CPU0_MEMORY 0x600500 /* CPU 0 memory age control */
47#define NI_AGE_CPU0_PIO 0x600508 /* CPU 0 PIO age control */
48#define NI_AGE_CPU1_MEMORY 0x600510 /* CPU 1 memory age control */
49#define NI_AGE_CPU1_PIO 0x600518 /* CPU 1 PIO age control */
50#define NI_AGE_GBR_MEMORY 0x600520 /* GBR memory age control */
51#define NI_AGE_GBR_PIO 0x600528 /* GBR PIO age control */
52#define NI_AGE_IO_MEMORY 0x600530 /* IO memory age control */
53#define NI_AGE_IO_PIO 0x600538 /* IO PIO age control */
54#define NI_AGE_REG_MIN NI_AGE_CPU0_MEMORY
55#define NI_AGE_REG_MAX NI_AGE_IO_PIO
56
57#define NI_PORT_PARMS 0x608000 /* LLP Parameters */
58#define NI_PORT_ERROR 0x608008 /* LLP Errors */
59#define NI_PORT_ERROR_CLEAR 0x608088 /* Clear the error bits */
60
61#define NI_META_TABLE0 0x638000 /* First meta routing table entry */
62#define NI_META_TABLE(_x) (NI_META_TABLE0 + (8 * (_x)))
63#define NI_META_ENTRIES 32
64
65#define NI_LOCAL_TABLE0 0x638100 /* First local routing table entry */
66#define NI_LOCAL_TABLE(_x) (NI_LOCAL_TABLE0 + (8 * (_x)))
67#define NI_LOCAL_ENTRIES 16
68
69/*
70 * NI_STATUS_REV_ID mask and shift definitions
71 * Have to use UINT64_CAST instead of 'L' suffix, for assembler.
72 */
73
74#define NSRI_8BITMODE_SHFT 30
75#define NSRI_8BITMODE_MASK (UINT64_CAST 0x1 << 30)
76#define NSRI_LINKUP_SHFT 29
77#define NSRI_LINKUP_MASK (UINT64_CAST 0x1 << 29)
78#define NSRI_DOWNREASON_SHFT 28 /* 0=failed, 1=never came */
79#define NSRI_DOWNREASON_MASK (UINT64_CAST 0x1 << 28) /* out of reset. */
80#define NSRI_MORENODES_SHFT 18
81#define NSRI_MORENODES_MASK (UINT64_CAST 1 << 18) /* Max. # of nodes */
82#define MORE_MEMORY 0
83#define MORE_NODES 1
84#define NSRI_REGIONSIZE_SHFT 17
85#define NSRI_REGIONSIZE_MASK (UINT64_CAST 1 << 17) /* Granularity */
86#define REGIONSIZE_FINE 1
87#define REGIONSIZE_COARSE 0
88#define NSRI_NODEID_SHFT 8
89#define NSRI_NODEID_MASK (UINT64_CAST 0x1ff << 8)/* Node (Hub) ID */
90#define NSRI_REV_SHFT 4
91#define NSRI_REV_MASK (UINT64_CAST 0xf << 4) /* Chip Revision */
92#define NSRI_CHIPID_SHFT 0
93#define NSRI_CHIPID_MASK (UINT64_CAST 0xf) /* Chip type ID */
94
95/*
96 * In fine mode, each node is a region. In coarse mode, there are
97 * eight nodes per region.
98 */
99#define NASID_TO_FINEREG_SHFT 0
100#define NASID_TO_COARSEREG_SHFT 3
101
102/* NI_PORT_RESET mask definitions */
103
104#define NPR_PORTRESET (UINT64_CAST 1 << 7) /* Send warm reset */
105#define NPR_LINKRESET (UINT64_CAST 1 << 1) /* Send link reset */
106#define NPR_LOCALRESET (UINT64_CAST 1) /* Reset entire hub */
107
108/* NI_PROTECTION mask and shift definitions */
109
110#define NPROT_RESETOK (UINT64_CAST 1)
111
112/* NI_GLOBAL_PARMS mask and shift definitions */
113
114#define NGP_MAXRETRY_SHFT 48 /* Maximum retries */
115#define NGP_MAXRETRY_MASK (UINT64_CAST 0x3ff << 48)
116#define NGP_TAILTOWRAP_SHFT 32 /* Tail timeout wrap */
117#define NGP_TAILTOWRAP_MASK (UINT64_CAST 0xffff << 32)
118
119#define NGP_CREDITTOVAL_SHFT 16 /* Tail timeout wrap */
120#define NGP_CREDITTOVAL_MASK (UINT64_CAST 0xf << 16)
121#define NGP_TAILTOVAL_SHFT 4 /* Tail timeout value */
122#define NGP_TAILTOVAL_MASK (UINT64_CAST 0xf << 4)
123
124/* NI_DIAG_PARMS mask and shift definitions */
125
126#define NDP_PORTTORESET (UINT64_CAST 1 << 18) /* Port tmout reset */
127#define NDP_LLP8BITMODE (UINT64_CAST 1 << 12) /* LLP 8-bit mode */
128#define NDP_PORTDISABLE (UINT64_CAST 1 << 6) /* Port disable */
129#define NDP_SENDERROR (UINT64_CAST 1) /* Send data error */
130
131/*
132 * NI_VECTOR_PARMS mask and shift definitions.
133 * TYPE may be any of the first four PIOTYPEs defined under NI_VECTOR_STATUS.
134 */
135
136#define NVP_PIOID_SHFT 40
137#define NVP_PIOID_MASK (UINT64_CAST 0x3ff << 40)
138#define NVP_WRITEID_SHFT 32
139#define NVP_WRITEID_MASK (UINT64_CAST 0xff << 32)
140#define NVP_ADDRESS_MASK (UINT64_CAST 0xffff8) /* Bits 19:3 */
141#define NVP_TYPE_SHFT 0
142#define NVP_TYPE_MASK (UINT64_CAST 0x3)
143
144/* NI_VECTOR_STATUS mask and shift definitions */
145
146#define NVS_VALID (UINT64_CAST 1 << 63)
147#define NVS_OVERRUN (UINT64_CAST 1 << 62)
148#define NVS_TARGET_SHFT 51
149#define NVS_TARGET_MASK (UINT64_CAST 0x3ff << 51)
150#define NVS_PIOID_SHFT 40
151#define NVS_PIOID_MASK (UINT64_CAST 0x3ff << 40)
152#define NVS_WRITEID_SHFT 32
153#define NVS_WRITEID_MASK (UINT64_CAST 0xff << 32)
154#define NVS_ADDRESS_MASK (UINT64_CAST 0xfffffff8) /* Bits 31:3 */
155#define NVS_TYPE_SHFT 0
156#define NVS_TYPE_MASK (UINT64_CAST 0x7)
157#define NVS_ERROR_MASK (UINT64_CAST 0x4) /* bit set means error */
158
159
160#define PIOTYPE_READ 0 /* VECTOR_PARMS and VECTOR_STATUS */
161#define PIOTYPE_WRITE 1 /* VECTOR_PARMS and VECTOR_STATUS */
162#define PIOTYPE_UNDEFINED 2 /* VECTOR_PARMS and VECTOR_STATUS */
163#define PIOTYPE_EXCHANGE 3 /* VECTOR_PARMS and VECTOR_STATUS */
164#define PIOTYPE_ADDR_ERR 4 /* VECTOR_STATUS only */
165#define PIOTYPE_CMD_ERR 5 /* VECTOR_STATUS only */
166#define PIOTYPE_PROT_ERR 6 /* VECTOR_STATUS only */
167#define PIOTYPE_UNKNOWN 7 /* VECTOR_STATUS only */
168
169/* NI_AGE_XXX mask and shift definitions */
170
171#define NAGE_VCH_SHFT 10
172#define NAGE_VCH_MASK (UINT64_CAST 3 << 10)
173#define NAGE_CC_SHFT 8
174#define NAGE_CC_MASK (UINT64_CAST 3 << 8)
175#define NAGE_AGE_SHFT 0
176#define NAGE_AGE_MASK (UINT64_CAST 0xff)
177#define NAGE_MASK (NAGE_VCH_MASK | NAGE_CC_MASK | NAGE_AGE_MASK)
178
179#define VCHANNEL_A 0
180#define VCHANNEL_B 1
181#define VCHANNEL_ANY 2
182
183/* NI_PORT_PARMS mask and shift definitions */
184
185#define NPP_NULLTO_SHFT 10
186#define NPP_NULLTO_MASK (UINT64_CAST 0x3f << 16)
187#define NPP_MAXBURST_SHFT 0
188#define NPP_MAXBURST_MASK (UINT64_CAST 0x3ff)
189#define NPP_RESET_DFLT_HUB20 ((UINT64_CAST 1 << NPP_NULLTO_SHFT) | \
190 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
191#define NPP_RESET_DEFAULTS ((UINT64_CAST 6 << NPP_NULLTO_SHFT) | \
192 (UINT64_CAST 0x3f0 << NPP_MAXBURST_SHFT))
193
194
195/* NI_PORT_ERROR mask and shift definitions */
196
197#define NPE_LINKRESET (UINT64_CAST 1 << 37)
198#define NPE_INTERNALERROR (UINT64_CAST 1 << 36)
199#define NPE_BADMESSAGE (UINT64_CAST 1 << 35)
200#define NPE_BADDEST (UINT64_CAST 1 << 34)
201#define NPE_FIFOOVERFLOW (UINT64_CAST 1 << 33)
202#define NPE_CREDITTO_SHFT 28
203#define NPE_CREDITTO_MASK (UINT64_CAST 0xf << 28)
204#define NPE_TAILTO_SHFT 24
205#define NPE_TAILTO_MASK (UINT64_CAST 0xf << 24)
206#define NPE_RETRYCOUNT_SHFT 16
207#define NPE_RETRYCOUNT_MASK (UINT64_CAST 0xff << 16)
208#define NPE_CBERRCOUNT_SHFT 8
209#define NPE_CBERRCOUNT_MASK (UINT64_CAST 0xff << 8)
210#define NPE_SNERRCOUNT_SHFT 0
211#define NPE_SNERRCOUNT_MASK (UINT64_CAST 0xff << 0)
212#define NPE_MASK 0x3effffffff
213
214#define NPE_COUNT_MAX 0xff
215
216#define NPE_FATAL_ERRORS (NPE_LINKRESET | NPE_INTERNALERROR | \
217 NPE_BADMESSAGE | NPE_BADDEST | \
218 NPE_FIFOOVERFLOW | NPE_CREDITTO_MASK | \
219 NPE_TAILTO_MASK)
220
221/* NI_META_TABLE mask and shift definitions */
222
223#define NMT_EXIT_PORT_MASK (UINT64_CAST 0xf)
224
225/* NI_LOCAL_TABLE mask and shift definitions */
226
227#define NLT_EXIT_PORT_MASK (UINT64_CAST 0xf)
228
229#ifndef __ASSEMBLY__
230
231typedef union hubni_port_error_u {
232 u64 nipe_reg_value;
233 struct {
234 u64 nipe_rsvd: 26, /* unused */
235 nipe_lnk_reset: 1, /* link reset */
236 nipe_intl_err: 1, /* internal error */
237 nipe_bad_msg: 1, /* bad message */
238 nipe_bad_dest: 1, /* bad dest */
239 nipe_fifo_ovfl: 1, /* fifo overflow */
240 nipe_rsvd1: 1, /* unused */
241 nipe_credit_to: 4, /* credit timeout */
242 nipe_tail_to: 4, /* tail timeout */
243 nipe_retry_cnt: 8, /* retry error count */
244 nipe_cb_cnt: 8, /* checkbit error count */
245 nipe_sn_cnt: 8; /* sequence number count */
246 } nipe_fields_s;
247} hubni_port_error_t;
248
249#define NI_LLP_RETRY_MAX 0xff
250#define NI_LLP_CB_MAX 0xff
251#define NI_LLP_SN_MAX 0xff
252
253#endif /* !__ASSEMBLY__ */
254
255#endif /* _ASM_SGI_SN0_HUBNI_H */
diff --git a/include/asm-mips/sn/sn0/hubpi.h b/include/asm-mips/sn/sn0/hubpi.h
deleted file mode 100644
index e39f5f9da040..000000000000
--- a/include/asm-mips/sn/sn0/hubpi.h
+++ /dev/null
@@ -1,409 +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 * Derived from IRIX <sys/SN/SN0/hubpi.h>, revision 1.28.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_HUBPI_H
12#define _ASM_SN_SN0_HUBPI_H
13
14#include <linux/types.h>
15
16/*
17 * Hub I/O interface registers
18 *
19 * All registers in this file are subject to change until Hub chip tapeout.
20 * All register "addresses" are actually offsets. Use the LOCAL_HUB
21 * or REMOTE_HUB macros to synthesize an actual address
22 */
23
24#define PI_BASE 0x000000
25
26/* General protection and control registers */
27
28#define PI_CPU_PROTECT 0x000000 /* CPU Protection */
29#define PI_PROT_OVERRD 0x000008 /* Clear CPU Protection bit */
30#define PI_IO_PROTECT 0x000010 /* Interrupt Pending Protection */
31#define PI_REGION_PRESENT 0x000018 /* Indicates whether region exists */
32#define PI_CPU_NUM 0x000020 /* CPU Number ID */
33#define PI_CALIAS_SIZE 0x000028 /* Cached Alias Size */
34#define PI_MAX_CRB_TIMEOUT 0x000030 /* Maximum Timeout for CRB */
35#define PI_CRB_SFACTOR 0x000038 /* Scale factor for CRB timeout */
36
37/* CALIAS values */
38#define PI_CALIAS_SIZE_0 0
39#define PI_CALIAS_SIZE_4K 1
40#define PI_CALIAS_SIZE_8K 2
41#define PI_CALIAS_SIZE_16K 3
42#define PI_CALIAS_SIZE_32K 4
43#define PI_CALIAS_SIZE_64K 5
44#define PI_CALIAS_SIZE_128K 6
45#define PI_CALIAS_SIZE_256K 7
46#define PI_CALIAS_SIZE_512K 8
47#define PI_CALIAS_SIZE_1M 9
48#define PI_CALIAS_SIZE_2M 10
49#define PI_CALIAS_SIZE_4M 11
50#define PI_CALIAS_SIZE_8M 12
51#define PI_CALIAS_SIZE_16M 13
52#define PI_CALIAS_SIZE_32M 14
53#define PI_CALIAS_SIZE_64M 15
54
55/* Processor control and status checking */
56
57#define PI_CPU_PRESENT_A 0x000040 /* CPU Present A */
58#define PI_CPU_PRESENT_B 0x000048 /* CPU Present B */
59#define PI_CPU_ENABLE_A 0x000050 /* CPU Enable A */
60#define PI_CPU_ENABLE_B 0x000058 /* CPU Enable B */
61#define PI_REPLY_LEVEL 0x000060 /* Reply Level */
62#define PI_HARDRESET_BIT 0x020068 /* Bit cleared by s/w on SR */
63#define PI_NMI_A 0x000070 /* NMI to CPU A */
64#define PI_NMI_B 0x000078 /* NMI to CPU B */
65#define PI_NMI_OFFSET (PI_NMI_B - PI_NMI_A)
66#define PI_SOFTRESET 0x000080 /* Softreset (to both CPUs) */
67
68/* Regular Interrupt register checking. */
69
70#define PI_INT_PEND_MOD 0x000090 /* Write to set pending ints */
71#define PI_INT_PEND0 0x000098 /* Read to get pending ints */
72#define PI_INT_PEND1 0x0000a0 /* Read to get pending ints */
73#define PI_INT_MASK0_A 0x0000a8 /* Interrupt Mask 0 for CPU A */
74#define PI_INT_MASK1_A 0x0000b0 /* Interrupt Mask 1 for CPU A */
75#define PI_INT_MASK0_B 0x0000b8 /* Interrupt Mask 0 for CPU B */
76#define PI_INT_MASK1_B 0x0000c0 /* Interrupt Mask 1 for CPU B */
77
78#define PI_INT_MASK_OFFSET 0x10 /* Offset from A to B */
79
80/* Crosscall interrupts */
81
82#define PI_CC_PEND_SET_A 0x0000c8 /* CC Interrupt Pending Set, CPU A */
83#define PI_CC_PEND_SET_B 0x0000d0 /* CC Interrupt Pending Set, CPU B */
84#define PI_CC_PEND_CLR_A 0x0000d8 /* CC Interrupt Pending Clr, CPU A */
85#define PI_CC_PEND_CLR_B 0x0000e0 /* CC Interrupt Pending Clr, CPU B */
86#define PI_CC_MASK 0x0000e8 /* CC Interrupt mask */
87
88#define PI_INT_SET_OFFSET 0x08 /* Offset from A to B */
89
90/* Realtime Counter and Profiler control registers */
91
92#define PI_RT_COUNT 0x030100 /* Real Time Counter */
93#define PI_RT_COMPARE_A 0x000108 /* Real Time Compare A */
94#define PI_RT_COMPARE_B 0x000110 /* Real Time Compare B */
95#define PI_PROFILE_COMPARE 0x000118 /* L5 int to both cpus when == RTC */
96#define PI_RT_PEND_A 0x000120 /* Set if RT int for A pending */
97#define PI_RT_PEND_B 0x000128 /* Set if RT int for B pending */
98#define PI_PROF_PEND_A 0x000130 /* Set if Prof int for A pending */
99#define PI_PROF_PEND_B 0x000138 /* Set if Prof int for B pending */
100#define PI_RT_EN_A 0x000140 /* RT int for CPU A enable */
101#define PI_RT_EN_B 0x000148 /* RT int for CPU B enable */
102#define PI_PROF_EN_A 0x000150 /* PROF int for CPU A enable */
103#define PI_PROF_EN_B 0x000158 /* PROF int for CPU B enable */
104#define PI_RT_LOCAL_CTRL 0x000160 /* RT control register */
105#define PI_RT_FILTER_CTRL 0x000168 /* GCLK Filter control register */
106
107#define PI_COUNT_OFFSET 0x08 /* A to B offset for all counts */
108
109/* Built-In Self Test support */
110
111#define PI_BIST_WRITE_DATA 0x000200 /* BIST write data */
112#define PI_BIST_READ_DATA 0x000208 /* BIST read data */
113#define PI_BIST_COUNT_TARG 0x000210 /* BIST Count and Target */
114#define PI_BIST_READY 0x000218 /* BIST Ready indicator */
115#define PI_BIST_SHIFT_LOAD 0x000220 /* BIST control */
116#define PI_BIST_SHIFT_UNLOAD 0x000228 /* BIST control */
117#define PI_BIST_ENTER_RUN 0x000230 /* BIST control */
118
119/* Graphics control registers */
120
121#define PI_GFX_PAGE_A 0x000300 /* Graphics page A */
122#define PI_GFX_CREDIT_CNTR_A 0x000308 /* Graphics credit counter A */
123#define PI_GFX_BIAS_A 0x000310 /* Graphics bias A */
124#define PI_GFX_INT_CNTR_A 0x000318 /* Graphics interrupt counter A */
125#define PI_GFX_INT_CMP_A 0x000320 /* Graphics interrupt comparator A */
126#define PI_GFX_PAGE_B 0x000328 /* Graphics page B */
127#define PI_GFX_CREDIT_CNTR_B 0x000330 /* Graphics credit counter B */
128#define PI_GFX_BIAS_B 0x000338 /* Graphics bias B */
129#define PI_GFX_INT_CNTR_B 0x000340 /* Graphics interrupt counter B */
130#define PI_GFX_INT_CMP_B 0x000348 /* Graphics interrupt comparator B */
131
132#define PI_GFX_OFFSET (PI_GFX_PAGE_B - PI_GFX_PAGE_A)
133#define PI_GFX_PAGE_ENABLE 0x0000010000000000LL
134
135/* Error and timeout registers */
136#define PI_ERR_INT_PEND 0x000400 /* Error Interrupt Pending */
137#define PI_ERR_INT_MASK_A 0x000408 /* Error Interrupt mask for CPU A */
138#define PI_ERR_INT_MASK_B 0x000410 /* Error Interrupt mask for CPU B */
139#define PI_ERR_STACK_ADDR_A 0x000418 /* Error stack address for CPU A */
140#define PI_ERR_STACK_ADDR_B 0x000420 /* Error stack address for CPU B */
141#define PI_ERR_STACK_SIZE 0x000428 /* Error Stack Size */
142#define PI_ERR_STATUS0_A 0x000430 /* Error Status 0A */
143#define PI_ERR_STATUS0_A_RCLR 0x000438 /* Error Status 0A clear on read */
144#define PI_ERR_STATUS1_A 0x000440 /* Error Status 1A */
145#define PI_ERR_STATUS1_A_RCLR 0x000448 /* Error Status 1A clear on read */
146#define PI_ERR_STATUS0_B 0x000450 /* Error Status 0B */
147#define PI_ERR_STATUS0_B_RCLR 0x000458 /* Error Status 0B clear on read */
148#define PI_ERR_STATUS1_B 0x000460 /* Error Status 1B */
149#define PI_ERR_STATUS1_B_RCLR 0x000468 /* Error Status 1B clear on read */
150#define PI_SPOOL_CMP_A 0x000470 /* Spool compare for CPU A */
151#define PI_SPOOL_CMP_B 0x000478 /* Spool compare for CPU B */
152#define PI_CRB_TIMEOUT_A 0x000480 /* Timed out CRB entries for A */
153#define PI_CRB_TIMEOUT_B 0x000488 /* Timed out CRB entries for B */
154#define PI_SYSAD_ERRCHK_EN 0x000490 /* Enables SYSAD error checking */
155#define PI_BAD_CHECK_BIT_A 0x000498 /* Force SYSAD check bit error */
156#define PI_BAD_CHECK_BIT_B 0x0004a0 /* Force SYSAD check bit error */
157#define PI_NACK_CNT_A 0x0004a8 /* Consecutive NACK counter */
158#define PI_NACK_CNT_B 0x0004b0 /* " " for CPU B */
159#define PI_NACK_CMP 0x0004b8 /* NACK count compare */
160#define PI_STACKADDR_OFFSET (PI_ERR_STACK_ADDR_B - PI_ERR_STACK_ADDR_A)
161#define PI_ERRSTAT_OFFSET (PI_ERR_STATUS0_B - PI_ERR_STATUS0_A)
162#define PI_RDCLR_OFFSET (PI_ERR_STATUS0_A_RCLR - PI_ERR_STATUS0_A)
163
164/* Bits in PI_ERR_INT_PEND */
165#define PI_ERR_SPOOL_CMP_B 0x00000001 /* Spool end hit high water */
166#define PI_ERR_SPOOL_CMP_A 0x00000002
167#define PI_ERR_SPUR_MSG_B 0x00000004 /* Spurious message intr. */
168#define PI_ERR_SPUR_MSG_A 0x00000008
169#define PI_ERR_WRB_TERR_B 0x00000010 /* WRB TERR */
170#define PI_ERR_WRB_TERR_A 0x00000020
171#define PI_ERR_WRB_WERR_B 0x00000040 /* WRB WERR */
172#define PI_ERR_WRB_WERR_A 0x00000080
173#define PI_ERR_SYSSTATE_B 0x00000100 /* SysState parity error */
174#define PI_ERR_SYSSTATE_A 0x00000200
175#define PI_ERR_SYSAD_DATA_B 0x00000400 /* SysAD data parity error */
176#define PI_ERR_SYSAD_DATA_A 0x00000800
177#define PI_ERR_SYSAD_ADDR_B 0x00001000 /* SysAD addr parity error */
178#define PI_ERR_SYSAD_ADDR_A 0x00002000
179#define PI_ERR_SYSCMD_DATA_B 0x00004000 /* SysCmd data parity error */
180#define PI_ERR_SYSCMD_DATA_A 0x00008000
181#define PI_ERR_SYSCMD_ADDR_B 0x00010000 /* SysCmd addr parity error */
182#define PI_ERR_SYSCMD_ADDR_A 0x00020000
183#define PI_ERR_BAD_SPOOL_B 0x00040000 /* Error spooling to memory */
184#define PI_ERR_BAD_SPOOL_A 0x00080000
185#define PI_ERR_UNCAC_UNCORR_B 0x00100000 /* Uncached uncorrectable */
186#define PI_ERR_UNCAC_UNCORR_A 0x00200000
187#define PI_ERR_SYSSTATE_TAG_B 0x00400000 /* SysState tag parity error */
188#define PI_ERR_SYSSTATE_TAG_A 0x00800000
189#define PI_ERR_MD_UNCORR 0x01000000 /* Must be cleared in MD */
190
191#define PI_ERR_CLEAR_ALL_A 0x00aaaaaa
192#define PI_ERR_CLEAR_ALL_B 0x00555555
193
194
195/*
196 * The following three macros define all possible error int pends.
197 */
198
199#define PI_FATAL_ERR_CPU_A (PI_ERR_SYSSTATE_TAG_A | \
200 PI_ERR_BAD_SPOOL_A | \
201 PI_ERR_SYSCMD_ADDR_A | \
202 PI_ERR_SYSCMD_DATA_A | \
203 PI_ERR_SYSAD_ADDR_A | \
204 PI_ERR_SYSAD_DATA_A | \
205 PI_ERR_SYSSTATE_A)
206
207#define PI_MISC_ERR_CPU_A (PI_ERR_UNCAC_UNCORR_A | \
208 PI_ERR_WRB_WERR_A | \
209 PI_ERR_WRB_TERR_A | \
210 PI_ERR_SPUR_MSG_A | \
211 PI_ERR_SPOOL_CMP_A)
212
213#define PI_FATAL_ERR_CPU_B (PI_ERR_SYSSTATE_TAG_B | \
214 PI_ERR_BAD_SPOOL_B | \
215 PI_ERR_SYSCMD_ADDR_B | \
216 PI_ERR_SYSCMD_DATA_B | \
217 PI_ERR_SYSAD_ADDR_B | \
218 PI_ERR_SYSAD_DATA_B | \
219 PI_ERR_SYSSTATE_B)
220
221#define PI_MISC_ERR_CPU_B (PI_ERR_UNCAC_UNCORR_B | \
222 PI_ERR_WRB_WERR_B | \
223 PI_ERR_WRB_TERR_B | \
224 PI_ERR_SPUR_MSG_B | \
225 PI_ERR_SPOOL_CMP_B)
226
227#define PI_ERR_GENERIC (PI_ERR_MD_UNCORR)
228
229/*
230 * Error types for PI_ERR_STATUS0_[AB] and error stack:
231 * Use the write types if WRBRRB is 1 else use the read types
232 */
233
234/* Fields in PI_ERR_STATUS0_[AB] */
235#define PI_ERR_ST0_TYPE_MASK 0x0000000000000007
236#define PI_ERR_ST0_TYPE_SHFT 0
237#define PI_ERR_ST0_REQNUM_MASK 0x0000000000000038
238#define PI_ERR_ST0_REQNUM_SHFT 3
239#define PI_ERR_ST0_SUPPL_MASK 0x000000000001ffc0
240#define PI_ERR_ST0_SUPPL_SHFT 6
241#define PI_ERR_ST0_CMD_MASK 0x0000000001fe0000
242#define PI_ERR_ST0_CMD_SHFT 17
243#define PI_ERR_ST0_ADDR_MASK 0x3ffffffffe000000
244#define PI_ERR_ST0_ADDR_SHFT 25
245#define PI_ERR_ST0_OVERRUN_MASK 0x4000000000000000
246#define PI_ERR_ST0_OVERRUN_SHFT 62
247#define PI_ERR_ST0_VALID_MASK 0x8000000000000000
248#define PI_ERR_ST0_VALID_SHFT 63
249
250/* Fields in PI_ERR_STATUS1_[AB] */
251#define PI_ERR_ST1_SPOOL_MASK 0x00000000001fffff
252#define PI_ERR_ST1_SPOOL_SHFT 0
253#define PI_ERR_ST1_TOUTCNT_MASK 0x000000001fe00000
254#define PI_ERR_ST1_TOUTCNT_SHFT 21
255#define PI_ERR_ST1_INVCNT_MASK 0x0000007fe0000000
256#define PI_ERR_ST1_INVCNT_SHFT 29
257#define PI_ERR_ST1_CRBNUM_MASK 0x0000038000000000
258#define PI_ERR_ST1_CRBNUM_SHFT 39
259#define PI_ERR_ST1_WRBRRB_MASK 0x0000040000000000
260#define PI_ERR_ST1_WRBRRB_SHFT 42
261#define PI_ERR_ST1_CRBSTAT_MASK 0x001ff80000000000
262#define PI_ERR_ST1_CRBSTAT_SHFT 43
263#define PI_ERR_ST1_MSGSRC_MASK 0xffe0000000000000
264#define PI_ERR_ST1_MSGSRC_SHFT 53
265
266/* Fields in the error stack */
267#define PI_ERR_STK_TYPE_MASK 0x0000000000000003
268#define PI_ERR_STK_TYPE_SHFT 0
269#define PI_ERR_STK_SUPPL_MASK 0x0000000000000038
270#define PI_ERR_STK_SUPPL_SHFT 3
271#define PI_ERR_STK_REQNUM_MASK 0x00000000000001c0
272#define PI_ERR_STK_REQNUM_SHFT 6
273#define PI_ERR_STK_CRBNUM_MASK 0x0000000000000e00
274#define PI_ERR_STK_CRBNUM_SHFT 9
275#define PI_ERR_STK_WRBRRB_MASK 0x0000000000001000
276#define PI_ERR_STK_WRBRRB_SHFT 12
277#define PI_ERR_STK_CRBSTAT_MASK 0x00000000007fe000
278#define PI_ERR_STK_CRBSTAT_SHFT 13
279#define PI_ERR_STK_CMD_MASK 0x000000007f800000
280#define PI_ERR_STK_CMD_SHFT 23
281#define PI_ERR_STK_ADDR_MASK 0xffffffff80000000
282#define PI_ERR_STK_ADDR_SHFT 31
283
284/* Error type in the error status or stack on Read CRBs */
285#define PI_ERR_RD_PRERR 1
286#define PI_ERR_RD_DERR 2
287#define PI_ERR_RD_TERR 3
288
289/* Error type in the error status or stack on Write CRBs */
290#define PI_ERR_WR_WERR 0
291#define PI_ERR_WR_PWERR 1
292#define PI_ERR_WR_TERR 3
293
294/* Read or Write CRB in error status or stack */
295#define PI_ERR_RRB 0
296#define PI_ERR_WRB 1
297#define PI_ERR_ANY_CRB 2
298
299/* Address masks in the error status and error stack are not the same */
300#define ERR_STK_ADDR_SHFT 7
301#define ERR_STAT0_ADDR_SHFT 3
302
303#define PI_MIN_STACK_SIZE 4096 /* For figuring out the size to set */
304#define PI_STACK_SIZE_SHFT 12 /* 4k */
305
306#define ERR_STACK_SIZE_BYTES(_sz) \
307 ((_sz) ? (PI_MIN_STACK_SIZE << ((_sz) - 1)) : 0)
308
309#ifndef __ASSEMBLY__
310/*
311 * format of error stack and error status registers.
312 */
313
314struct err_stack_format {
315 u64 sk_addr : 33, /* address */
316 sk_cmd : 8, /* message command */
317 sk_crb_sts : 10, /* status from RRB or WRB */
318 sk_rw_rb : 1, /* RRB == 0, WRB == 1 */
319 sk_crb_num : 3, /* WRB (0 to 7) or RRB (0 to 4) */
320 sk_t5_req : 3, /* RRB T5 request number */
321 sk_suppl : 3, /* lowest 3 bit of supplemental */
322 sk_err_type: 3; /* error type */
323};
324
325typedef union pi_err_stack {
326 u64 pi_stk_word;
327 struct err_stack_format pi_stk_fmt;
328} pi_err_stack_t;
329
330struct err_status0_format {
331 u64 s0_valid : 1, /* Valid */
332 s0_ovr_run : 1, /* Overrun, spooled to memory */
333 s0_addr : 37, /* address */
334 s0_cmd : 8, /* message command */
335 s0_supl : 11, /* message supplemental field */
336 s0_t5_req : 3, /* RRB T5 request number */
337 s0_err_type: 3; /* error type */
338};
339
340typedef union pi_err_stat0 {
341 u64 pi_stat0_word;
342 struct err_status0_format pi_stat0_fmt;
343} pi_err_stat0_t;
344
345struct err_status1_format {
346 u64 s1_src : 11, /* message source */
347 s1_crb_sts : 10, /* status from RRB or WRB */
348 s1_rw_rb : 1, /* RRB == 0, WRB == 1 */
349 s1_crb_num : 3, /* WRB (0 to 7) or RRB (0 to 4) */
350 s1_inval_cnt:10, /* signed invalidate counter RRB */
351 s1_to_cnt : 8, /* crb timeout counter */
352 s1_spl_cnt : 21; /* number spooled to memory */
353};
354
355typedef union pi_err_stat1 {
356 u64 pi_stat1_word;
357 struct err_status1_format pi_stat1_fmt;
358} pi_err_stat1_t;
359
360typedef u64 rtc_time_t;
361
362#endif /* !__ASSEMBLY__ */
363
364
365/* Bits in PI_SYSAD_ERRCHK_EN */
366#define PI_SYSAD_ERRCHK_ECCGEN 0x01 /* Enable ECC generation */
367#define PI_SYSAD_ERRCHK_QUALGEN 0x02 /* Enable data quality signal gen. */
368#define PI_SYSAD_ERRCHK_SADP 0x04 /* Enable SysAD parity checking */
369#define PI_SYSAD_ERRCHK_CMDP 0x08 /* Enable SysCmd parity checking */
370#define PI_SYSAD_ERRCHK_STATE 0x10 /* Enable SysState parity checking */
371#define PI_SYSAD_ERRCHK_QUAL 0x20 /* Enable data quality checking */
372#define PI_SYSAD_CHECK_ALL 0x3f /* Generate and check all signals. */
373
374/* Interrupt pending bits on R10000 */
375
376#define HUB_IP_PEND0 0x0400
377#define HUB_IP_PEND1_CC 0x0800
378#define HUB_IP_RT 0x1000
379#define HUB_IP_PROF 0x2000
380#define HUB_IP_ERROR 0x4000
381#define HUB_IP_MASK 0x7c00
382
383/* PI_RT_LOCAL_CTRL mask and shift definitions */
384
385#define PRLC_USE_INT_SHFT 16
386#define PRLC_USE_INT_MASK (UINT64_CAST 1 << 16)
387#define PRLC_USE_INT (UINT64_CAST 1 << 16)
388#define PRLC_GCLK_SHFT 15
389#define PRLC_GCLK_MASK (UINT64_CAST 1 << 15)
390#define PRLC_GCLK (UINT64_CAST 1 << 15)
391#define PRLC_GCLK_COUNT_SHFT 8
392#define PRLC_GCLK_COUNT_MASK (UINT64_CAST 0x7f << 8)
393#define PRLC_MAX_COUNT_SHFT 1
394#define PRLC_MAX_COUNT_MASK (UINT64_CAST 0x7f << 1)
395#define PRLC_GCLK_EN_SHFT 0
396#define PRLC_GCLK_EN_MASK (UINT64_CAST 1)
397#define PRLC_GCLK_EN (UINT64_CAST 1)
398
399/* PI_RT_FILTER_CTRL mask and shift definitions */
400
401/*
402 * Bits for NACK_CNT_A/B and NACK_CMP
403 */
404#define PI_NACK_CNT_EN_SHFT 20
405#define PI_NACK_CNT_EN_MASK 0x100000
406#define PI_NACK_CNT_MASK 0x0fffff
407#define PI_NACK_CNT_MAX 0x0fffff
408
409#endif /* _ASM_SN_SN0_HUBPI_H */
diff --git a/include/asm-mips/sn/sn0/ip27.h b/include/asm-mips/sn/sn0/ip27.h
deleted file mode 100644
index 3c97e0855c8d..000000000000
--- a/include/asm-mips/sn/sn0/ip27.h
+++ /dev/null
@@ -1,85 +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 * Derived from IRIX <sys/SN/SN0/IP27.h>.
7 *
8 * Copyright (C) 1992 - 1997, 1999 Silicon Graphics, Inc.
9 * Copyright (C) 1999, 2006 by Ralf Baechle
10 */
11#ifndef _ASM_SN_SN0_IP27_H
12#define _ASM_SN_SN0_IP27_H
13
14#include <asm/mipsregs.h>
15
16/*
17 * Simple definitions for the masks which remove SW bits from pte.
18 */
19
20#define TLBLO_HWBITSHIFT 0 /* Shift value, for masking */
21
22#ifndef __ASSEMBLY__
23
24#define CAUSE_BERRINTR IE_IRQ5
25
26#define ECCF_CACHE_ERR 0
27#define ECCF_TAGLO 1
28#define ECCF_ECC 2
29#define ECCF_ERROREPC 3
30#define ECCF_PADDR 4
31#define ECCF_SIZE (5 * sizeof(long))
32
33#endif /* !__ASSEMBLY__ */
34
35#ifdef __ASSEMBLY__
36
37/*
38 * KL_GET_CPUNUM (similar to EV_GET_SPNUM for EVEREST platform) reads
39 * the processor number of the calling processor. The proc parameters
40 * must be a register.
41 */
42#define KL_GET_CPUNUM(proc) \
43 dli proc, LOCAL_HUB(0); \
44 ld proc, PI_CPU_NUM(proc)
45
46#endif /* __ASSEMBLY__ */
47
48/*
49 * R10000 status register interrupt bit mask usage for IP27.
50 */
51#define SRB_SWTIMO IE_SW0 /* 0x0100 */
52#define SRB_NET IE_SW1 /* 0x0200 */
53#define SRB_DEV0 IE_IRQ0 /* 0x0400 */
54#define SRB_DEV1 IE_IRQ1 /* 0x0800 */
55#define SRB_TIMOCLK IE_IRQ2 /* 0x1000 */
56#define SRB_PROFCLK IE_IRQ3 /* 0x2000 */
57#define SRB_ERR IE_IRQ4 /* 0x4000 */
58#define SRB_SCHEDCLK IE_IRQ5 /* 0x8000 */
59
60#define SR_IBIT_HI SRB_DEV0
61#define SR_IBIT_PROF SRB_PROFCLK
62
63#define SRB_SWTIMO_IDX 0
64#define SRB_NET_IDX 1
65#define SRB_DEV0_IDX 2
66#define SRB_DEV1_IDX 3
67#define SRB_TIMOCLK_IDX 4
68#define SRB_PROFCLK_IDX 5
69#define SRB_ERR_IDX 6
70#define SRB_SCHEDCLK_IDX 7
71
72#define NUM_CAUSE_INTRS 8
73
74#define SCACHE_LINESIZE 128
75#define SCACHE_LINEMASK (SCACHE_LINESIZE - 1)
76
77#include <asm/sn/addrs.h>
78
79#define LED_CYCLE_MASK 0x0f
80#define LED_CYCLE_SHFT 4
81
82#define SEND_NMI(_nasid, _slice) \
83 REMOTE_HUB_S((_nasid), (PI_NMI_A + ((_slice) * PI_NMI_OFFSET)), 1)
84
85#endif /* _ASM_SN_SN0_IP27_H */
diff --git a/include/asm-mips/sn/sn_private.h b/include/asm-mips/sn/sn_private.h
deleted file mode 100644
index 1a2c3025bf28..000000000000
--- a/include/asm-mips/sn/sn_private.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef __ASM_SN_SN_PRIVATE_H
2#define __ASM_SN_SN_PRIVATE_H
3
4#include <asm/sn/types.h>
5
6extern nasid_t master_nasid;
7
8extern void cpu_node_probe(void);
9extern cnodeid_t get_compact_nodeid(void);
10extern void hub_rtc_init(cnodeid_t);
11extern void cpu_time_init(void);
12extern void per_cpu_init(void);
13extern void install_cpu_nmi_handler(int slice);
14extern void install_ipi(void);
15extern void setup_replication_mask(void);
16extern void replicate_kernel_text(void);
17extern pfn_t node_getfirstfree(cnodeid_t);
18
19#endif /* __ASM_SN_SN_PRIVATE_H */
diff --git a/include/asm-mips/sn/types.h b/include/asm-mips/sn/types.h
deleted file mode 100644
index 74d0bb260b86..000000000000
--- a/include/asm-mips/sn/types.h
+++ /dev/null
@@ -1,26 +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) 1999 Silicon Graphics, Inc.
7 * Copyright (C) 1999 by Ralf Baechle
8 */
9#ifndef _ASM_SN_TYPES_H
10#define _ASM_SN_TYPES_H
11
12#include <linux/types.h>
13
14typedef unsigned long cpuid_t;
15typedef unsigned long cnodemask_t;
16typedef signed short nasid_t; /* node id in numa-as-id space */
17typedef signed short cnodeid_t; /* node id in compact-id space */
18typedef signed char partid_t; /* partition ID type */
19typedef signed short moduleid_t; /* user-visible module number type */
20typedef signed short cmoduleid_t; /* kernel compact module id type */
21typedef unsigned char clusterid_t; /* Clusterid of the cell */
22typedef unsigned long pfn_t;
23
24typedef dev_t vertex_hdl_t; /* hardware graph vertex handle */
25
26#endif /* _ASM_SN_TYPES_H */
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
deleted file mode 100644
index 8c1eb02c6d16..000000000000
--- a/include/asm-mips/sni.h
+++ /dev/null
@@ -1,244 +0,0 @@
1/*
2 * SNI specific definitions
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) 1997, 1998 by Ralf Baechle
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */
11#ifndef __ASM_SNI_H
12#define __ASM_SNI_H
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
38#define SNI_PORT_BASE CKSEG1ADDR(0xb4000000)
39
40#ifndef __MIPSEL__
41/*
42 * ASIC PCI registers for big endian configuration.
43 */
44#define PCIMT_UCONF CKSEG1ADDR(0xbfff0004)
45#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff000c)
46#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0014)
47#define PCIMT_IOMMU CKSEG1ADDR(0xbfff001c)
48#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0024)
49#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff002c)
50#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0034)
51#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff003c)
52#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0044)
53#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff004c)
54#define PCIMT_ITPEND CKSEG1ADDR(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 CKSEG1ADDR(0xbfff005c)
64#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0064)
65#define PCIMT_ECCREG CKSEG1ADDR(0xbfff006c)
66#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0074)
67#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff007c) /* read */
68#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff007c) /* write */
69#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0084)
70#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff008c)
71#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0094)
72#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff009c)
73#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a4)
74#else
75/*
76 * ASIC PCI registers for little endian configuration.
77 */
78#define PCIMT_UCONF CKSEG1ADDR(0xbfff0000)
79#define PCIMT_IOADTIMEOUT2 CKSEG1ADDR(0xbfff0008)
80#define PCIMT_IOMEMCONF CKSEG1ADDR(0xbfff0010)
81#define PCIMT_IOMMU CKSEG1ADDR(0xbfff0018)
82#define PCIMT_IOADTIMEOUT1 CKSEG1ADDR(0xbfff0020)
83#define PCIMT_DMAACCESS CKSEG1ADDR(0xbfff0028)
84#define PCIMT_DMAHIT CKSEG1ADDR(0xbfff0030)
85#define PCIMT_ERRSTATUS CKSEG1ADDR(0xbfff0038)
86#define PCIMT_ERRADDR CKSEG1ADDR(0xbfff0040)
87#define PCIMT_SYNDROME CKSEG1ADDR(0xbfff0048)
88#define PCIMT_ITPEND CKSEG1ADDR(0xbfff0050)
89#define IT_INT2 0x01
90#define IT_INTD 0x02
91#define IT_INTC 0x04
92#define IT_INTB 0x08
93#define IT_INTA 0x10
94#define IT_EISA 0x20
95#define IT_SCSI 0x40
96#define IT_ETH 0x80
97#define PCIMT_IRQSEL CKSEG1ADDR(0xbfff0058)
98#define PCIMT_TESTMEM CKSEG1ADDR(0xbfff0060)
99#define PCIMT_ECCREG CKSEG1ADDR(0xbfff0068)
100#define PCIMT_CONFIG_ADDRESS CKSEG1ADDR(0xbfff0070)
101#define PCIMT_ASIC_ID CKSEG1ADDR(0xbfff0078) /* read */
102#define PCIMT_SOFT_RESET CKSEG1ADDR(0xbfff0078) /* write */
103#define PCIMT_PIA_OE CKSEG1ADDR(0xbfff0080)
104#define PCIMT_PIA_DATAOUT CKSEG1ADDR(0xbfff0088)
105#define PCIMT_PIA_DATAIN CKSEG1ADDR(0xbfff0090)
106#define PCIMT_CACHECONF CKSEG1ADDR(0xbfff0098)
107#define PCIMT_INVSPACE CKSEG1ADDR(0xbfff00a0)
108#endif
109
110#define PCIMT_PCI_CONF CKSEG1ADDR(0xbfff0100)
111
112/*
113 * Data port for the PCI bus in IO space
114 */
115#define PCIMT_CONFIG_DATA 0x0cfc
116
117/*
118 * Board specific registers
119 */
120#define PCIMT_CSMSR CKSEG1ADDR(0xbfd00000)
121#define PCIMT_CSSWITCH CKSEG1ADDR(0xbfd10000)
122#define PCIMT_CSITPEND CKSEG1ADDR(0xbfd20000)
123#define PCIMT_AUTO_PO_EN CKSEG1ADDR(0xbfd30000)
124#define PCIMT_CLR_TEMP CKSEG1ADDR(0xbfd40000)
125#define PCIMT_AUTO_PO_DIS CKSEG1ADDR(0xbfd50000)
126#define PCIMT_EXMSR CKSEG1ADDR(0xbfd60000)
127#define PCIMT_UNUSED1 CKSEG1ADDR(0xbfd70000)
128#define PCIMT_CSWCSM CKSEG1ADDR(0xbfd80000)
129#define PCIMT_UNUSED2 CKSEG1ADDR(0xbfd90000)
130#define PCIMT_CSLED CKSEG1ADDR(0xbfda0000)
131#define PCIMT_CSMAPISA CKSEG1ADDR(0xbfdb0000)
132#define PCIMT_CSRSTBP CKSEG1ADDR(0xbfdc0000)
133#define PCIMT_CLRPOFF CKSEG1ADDR(0xbfdd0000)
134#define PCIMT_CSTIMER CKSEG1ADDR(0xbfde0000)
135#define PCIMT_PWDN CKSEG1ADDR(0xbfdf0000)
136
137/*
138 * A20R based boards
139 */
140#define A20R_PT_CLOCK_BASE CKSEG1ADDR(0xbc040000)
141#define A20R_PT_TIM0_ACK CKSEG1ADDR(0xbc050000)
142#define A20R_PT_TIM1_ACK CKSEG1ADDR(0xbc060000)
143
144#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
145#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
146
147#define SNI_PCIT_INT_REG CKSEG1ADDR(0xbfff000c)
148
149#define SNI_PCIT_INT_START 24
150#define SNI_PCIT_INT_END 30
151
152#define PCIT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE + 5)
153#define PCIT_IRQ_INTA (SNI_PCIT_INT_START + 0)
154#define PCIT_IRQ_INTB (SNI_PCIT_INT_START + 1)
155#define PCIT_IRQ_INTC (SNI_PCIT_INT_START + 2)
156#define PCIT_IRQ_INTD (SNI_PCIT_INT_START + 3)
157#define PCIT_IRQ_SCSI0 (SNI_PCIT_INT_START + 4)
158#define PCIT_IRQ_SCSI1 (SNI_PCIT_INT_START + 5)
159
160
161/*
162 * Interrupt 0-16 are EISA interrupts. Interrupts from 16 on are assigned
163 * to the other interrupts generated by ASIC PCI.
164 *
165 * INT2 is a wired-or of the push button interrupt, high temperature interrupt
166 * ASIC PCI interrupt.
167 */
168#define PCIMT_KEYBOARD_IRQ 1
169#define PCIMT_IRQ_INT2 24
170#define PCIMT_IRQ_INTD 25
171#define PCIMT_IRQ_INTC 26
172#define PCIMT_IRQ_INTB 27
173#define PCIMT_IRQ_INTA 28
174#define PCIMT_IRQ_EISA 29
175#define PCIMT_IRQ_SCSI 30
176
177#define PCIMT_IRQ_ETHERNET (MIPS_CPU_IRQ_BASE+6)
178
179#if 0
180#define PCIMT_IRQ_TEMPERATURE 24
181#define PCIMT_IRQ_EISA_NMI 25
182#define PCIMT_IRQ_POWER_OFF 26
183#define PCIMT_IRQ_BUTTON 27
184#endif
185
186/*
187 * Base address for the mapped 16mb EISA bus segment.
188 */
189#define PCIMT_EISA_BASE CKSEG1ADDR(0xb0000000)
190
191/* PCI EISA Interrupt acknowledge */
192#define PCIMT_INT_ACKNOWLEDGE CKSEG1ADDR(0xba000000)
193
194/*
195 * SNI ID PROM
196 *
197 * SNI_IDPROM_MEMSIZE Memsize in 16MB quantities
198 * SNI_IDPROM_BRDTYPE Board Type
199 * SNI_IDPROM_CPUTYPE CPU Type on RM400
200 */
201#ifdef CONFIG_CPU_BIG_ENDIAN
202#define __SNI_END 0
203#endif
204#ifdef CONFIG_CPU_LITTLE_ENDIAN
205#define __SNI_END 3
206#endif
207#define SNI_IDPROM_BASE CKSEG1ADDR(0x1ff00000)
208#define SNI_IDPROM_MEMSIZE (SNI_IDPROM_BASE + (0x28 ^ __SNI_END))
209#define SNI_IDPROM_BRDTYPE (SNI_IDPROM_BASE + (0x29 ^ __SNI_END))
210#define SNI_IDPROM_CPUTYPE (SNI_IDPROM_BASE + (0x30 ^ __SNI_END))
211
212#define SNI_IDPROM_SIZE 0x1000
213
214/* board specific init functions */
215extern void sni_a20r_init(void);
216extern void sni_pcit_init(void);
217extern void sni_rm200_init(void);
218extern void sni_pcimt_init(void);
219
220/* board specific irq init functions */
221extern void sni_a20r_irq_init(void);
222extern void sni_pcit_irq_init(void);
223extern void sni_pcit_cplus_irq_init(void);
224extern void sni_rm200_irq_init(void);
225extern void sni_pcimt_irq_init(void);
226
227/* timer inits */
228extern void sni_cpu_time_init(void);
229
230/* eisa init for RM200/400 */
231#ifdef CONFIG_EISA
232extern int sni_eisa_root_init(void);
233#else
234static inline int sni_eisa_root_init(void)
235{
236 return 0;
237}
238#endif
239
240/* common irq stuff */
241extern void (*sni_hwint)(void);
242extern struct irqaction sni_isa_irq;
243
244#endif /* __ASM_SNI_H */
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
deleted file mode 100644
index facc2d7a87ca..000000000000
--- a/include/asm-mips/socket.h
+++ /dev/null
@@ -1,117 +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) 1997, 1999, 2000, 2001 Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SOCKET_H
10#define _ASM_SOCKET_H
11
12#include <asm/sockios.h>
13
14/*
15 * For setsockopt(2)
16 *
17 * This defines are ABI conformant as far as Linux supports these ...
18 */
19#define SOL_SOCKET 0xffff
20
21#define SO_DEBUG 0x0001 /* Record debugging information. */
22#define SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
23#define SO_KEEPALIVE 0x0008 /* Keep connections alive and send
24 SIGPIPE when they die. */
25#define SO_DONTROUTE 0x0010 /* Don't do local routing. */
26#define SO_BROADCAST 0x0020 /* Allow transmission of
27 broadcast messages. */
28#define SO_LINGER 0x0080 /* Block on close of a reliable
29 socket to transmit pending data. */
30#define SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
31#if 0
32To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
33#endif
34
35#define SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
36#define SO_STYLE SO_TYPE /* Synonym */
37#define SO_ERROR 0x1007 /* get error status and clear */
38#define SO_SNDBUF 0x1001 /* Send buffer size. */
39#define SO_RCVBUF 0x1002 /* Receive buffer. */
40#define SO_SNDLOWAT 0x1003 /* send low-water mark */
41#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
42#define SO_SNDTIMEO 0x1005 /* send timeout */
43#define SO_RCVTIMEO 0x1006 /* receive timeout */
44#define SO_ACCEPTCONN 0x1009
45
46/* linux-specific, might as well be the same as on i386 */
47#define SO_NO_CHECK 11
48#define SO_PRIORITY 12
49#define SO_BSDCOMPAT 14
50
51#define SO_PASSCRED 17
52#define SO_PEERCRED 18
53
54/* Security levels - as per NRL IPv6 - don't actually do anything */
55#define SO_SECURITY_AUTHENTICATION 22
56#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
57#define SO_SECURITY_ENCRYPTION_NETWORK 24
58
59#define SO_BINDTODEVICE 25
60
61/* Socket filtering */
62#define SO_ATTACH_FILTER 26
63#define SO_DETACH_FILTER 27
64
65#define SO_PEERNAME 28
66#define SO_TIMESTAMP 29
67#define SCM_TIMESTAMP SO_TIMESTAMP
68
69#define SO_PEERSEC 30
70#define SO_SNDBUFFORCE 31
71#define SO_RCVBUFFORCE 33
72#define SO_PASSSEC 34
73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
75
76#define SO_MARK 36
77
78#ifdef __KERNEL__
79
80/** sock_type - Socket types
81 *
82 * Please notice that for binary compat reasons MIPS has to
83 * override the enum sock_type in include/linux/net.h, so
84 * we define ARCH_HAS_SOCKET_TYPES here.
85 *
86 * @SOCK_DGRAM - datagram (conn.less) socket
87 * @SOCK_STREAM - stream (connection) socket
88 * @SOCK_RAW - raw socket
89 * @SOCK_RDM - reliably-delivered message
90 * @SOCK_SEQPACKET - sequential packet socket
91 * @SOCK_PACKET - linux specific way of getting packets at the dev level.
92 * For writing rarp and other similar things on the user level.
93 */
94enum sock_type {
95 SOCK_DGRAM = 1,
96 SOCK_STREAM = 2,
97 SOCK_RAW = 3,
98 SOCK_RDM = 4,
99 SOCK_SEQPACKET = 5,
100 SOCK_DCCP = 6,
101 SOCK_PACKET = 10,
102};
103
104#define SOCK_MAX (SOCK_PACKET + 1)
105/* Mask which covers at least up to SOCK_MASK-1. The
106 * * remaining bits are used as flags. */
107#define SOCK_TYPE_MASK 0xf
108
109/* Flags for socket, socketpair, paccept */
110#define SOCK_CLOEXEC O_CLOEXEC
111#define SOCK_NONBLOCK O_NONBLOCK
112
113#define ARCH_HAS_SOCKET_TYPES 1
114
115#endif /* __KERNEL__ */
116
117#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-mips/sockios.h b/include/asm-mips/sockios.h
deleted file mode 100644
index ed1a5f78d22f..000000000000
--- a/include/asm-mips/sockios.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Socket-level I/O control calls.
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) 1995 by Ralf Baechle
9 */
10#ifndef _ASM_SOCKIOS_H
11#define _ASM_SOCKIOS_H
12
13#include <asm/ioctl.h>
14
15/* Socket-level I/O control calls. */
16#define FIOGETOWN _IOR('f', 123, int)
17#define FIOSETOWN _IOW('f', 124, int)
18
19#define SIOCATMARK _IOR('s', 7, int)
20#define SIOCSPGRP _IOW('s', 8, pid_t)
21#define SIOCGPGRP _IOR('s', 9, pid_t)
22
23#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
24#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
25
26#endif /* _ASM_SOCKIOS_H */
diff --git a/include/asm-mips/sparsemem.h b/include/asm-mips/sparsemem.h
deleted file mode 100644
index 795ac6c23203..000000000000
--- a/include/asm-mips/sparsemem.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _MIPS_SPARSEMEM_H
2#define _MIPS_SPARSEMEM_H
3#ifdef CONFIG_SPARSEMEM
4
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
8 */
9#define SECTION_SIZE_BITS 28
10#define MAX_PHYSMEM_BITS 35
11
12#endif /* CONFIG_SPARSEMEM */
13#endif /* _MIPS_SPARSEMEM_H */
14
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
deleted file mode 100644
index bb897016c491..000000000000
--- a/include/asm-mips/spinlock.h
+++ /dev/null
@@ -1,376 +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) 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_SPINLOCK_H
10#define _ASM_SPINLOCK_H
11
12#include <asm/barrier.h>
13#include <asm/war.h>
14
15/*
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere
17 */
18
19#define __raw_spin_is_locked(x) ((x)->lock != 0)
20#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
21#define __raw_spin_unlock_wait(x) \
22 do { cpu_relax(); } while ((x)->lock)
23
24/*
25 * Simple spin lock operations. There are two variants, one clears IRQ's
26 * on the local processor, one does not.
27 *
28 * We make no fairness assumptions. They have a cost.
29 */
30
31static inline void __raw_spin_lock(raw_spinlock_t *lock)
32{
33 unsigned int tmp;
34
35 if (R10000_LLSC_WAR) {
36 __asm__ __volatile__(
37 " .set noreorder # __raw_spin_lock \n"
38 "1: ll %1, %2 \n"
39 " bnez %1, 1b \n"
40 " li %1, 1 \n"
41 " sc %1, %0 \n"
42 " beqzl %1, 1b \n"
43 " nop \n"
44 " .set reorder \n"
45 : "=m" (lock->lock), "=&r" (tmp)
46 : "m" (lock->lock)
47 : "memory");
48 } else {
49 __asm__ __volatile__(
50 " .set noreorder # __raw_spin_lock \n"
51 "1: ll %1, %2 \n"
52 " bnez %1, 2f \n"
53 " li %1, 1 \n"
54 " sc %1, %0 \n"
55 " beqz %1, 2f \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"
64 " .set reorder \n"
65 : "=m" (lock->lock), "=&r" (tmp)
66 : "m" (lock->lock)
67 : "memory");
68 }
69
70 smp_llsc_mb();
71}
72
73static inline void __raw_spin_unlock(raw_spinlock_t *lock)
74{
75 smp_mb();
76
77 __asm__ __volatile__(
78 " .set noreorder # __raw_spin_unlock \n"
79 " sw $0, %0 \n"
80 " .set\treorder \n"
81 : "=m" (lock->lock)
82 : "m" (lock->lock)
83 : "memory");
84}
85
86static inline unsigned int __raw_spin_trylock(raw_spinlock_t *lock)
87{
88 unsigned int temp, res;
89
90 if (R10000_LLSC_WAR) {
91 __asm__ __volatile__(
92 " .set noreorder # __raw_spin_trylock \n"
93 "1: ll %0, %3 \n"
94 " ori %2, %0, 1 \n"
95 " sc %2, %1 \n"
96 " beqzl %2, 1b \n"
97 " nop \n"
98 " andi %2, %0, 1 \n"
99 " .set reorder"
100 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
101 : "m" (lock->lock)
102 : "memory");
103 } else {
104 __asm__ __volatile__(
105 " .set noreorder # __raw_spin_trylock \n"
106 "1: ll %0, %3 \n"
107 " ori %2, %0, 1 \n"
108 " sc %2, %1 \n"
109 " beqz %2, 2f \n"
110 " andi %2, %0, 1 \n"
111 " .subsection 2 \n"
112 "2: b 1b \n"
113 " nop \n"
114 " .previous \n"
115 " .set reorder"
116 : "=&r" (temp), "=m" (lock->lock), "=&r" (res)
117 : "m" (lock->lock)
118 : "memory");
119 }
120
121 smp_llsc_mb();
122
123 return res == 0;
124}
125
126/*
127 * Read-write spinlocks, allowing multiple readers but only one writer.
128 *
129 * NOTE! it is quite common to have readers in interrupts but no interrupt
130 * writers. For those circumstances we can "mix" irq-safe locks - any writer
131 * needs to get a irq-safe write-lock, but readers can get non-irqsafe
132 * read-locks.
133 */
134
135/*
136 * read_can_lock - would read_trylock() succeed?
137 * @lock: the rwlock in question.
138 */
139#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
140
141/*
142 * write_can_lock - would write_trylock() succeed?
143 * @lock: the rwlock in question.
144 */
145#define __raw_write_can_lock(rw) (!(rw)->lock)
146
147static inline void __raw_read_lock(raw_rwlock_t *rw)
148{
149 unsigned int tmp;
150
151 if (R10000_LLSC_WAR) {
152 __asm__ __volatile__(
153 " .set noreorder # __raw_read_lock \n"
154 "1: ll %1, %2 \n"
155 " bltz %1, 1b \n"
156 " addu %1, 1 \n"
157 " sc %1, %0 \n"
158 " beqzl %1, 1b \n"
159 " nop \n"
160 " .set reorder \n"
161 : "=m" (rw->lock), "=&r" (tmp)
162 : "m" (rw->lock)
163 : "memory");
164 } else {
165 __asm__ __volatile__(
166 " .set noreorder # __raw_read_lock \n"
167 "1: ll %1, %2 \n"
168 " bltz %1, 2f \n"
169 " addu %1, 1 \n"
170 " sc %1, %0 \n"
171 " beqz %1, 1b \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"
180 " .set reorder \n"
181 : "=m" (rw->lock), "=&r" (tmp)
182 : "m" (rw->lock)
183 : "memory");
184 }
185
186 smp_llsc_mb();
187}
188
189/* Note the use of sub, not subu which will make the kernel die with an
190 overflow exception if we ever try to unlock an rwlock that is already
191 unlocked or is being held by a writer. */
192static inline void __raw_read_unlock(raw_rwlock_t *rw)
193{
194 unsigned int tmp;
195
196 smp_llsc_mb();
197
198 if (R10000_LLSC_WAR) {
199 __asm__ __volatile__(
200 "1: ll %1, %2 # __raw_read_unlock \n"
201 " sub %1, 1 \n"
202 " sc %1, %0 \n"
203 " beqzl %1, 1b \n"
204 : "=m" (rw->lock), "=&r" (tmp)
205 : "m" (rw->lock)
206 : "memory");
207 } else {
208 __asm__ __volatile__(
209 " .set noreorder # __raw_read_unlock \n"
210 "1: ll %1, %2 \n"
211 " sub %1, 1 \n"
212 " sc %1, %0 \n"
213 " beqz %1, 2f \n"
214 " nop \n"
215 " .subsection 2 \n"
216 "2: b 1b \n"
217 " nop \n"
218 " .previous \n"
219 " .set reorder \n"
220 : "=m" (rw->lock), "=&r" (tmp)
221 : "m" (rw->lock)
222 : "memory");
223 }
224}
225
226static inline void __raw_write_lock(raw_rwlock_t *rw)
227{
228 unsigned int tmp;
229
230 if (R10000_LLSC_WAR) {
231 __asm__ __volatile__(
232 " .set noreorder # __raw_write_lock \n"
233 "1: ll %1, %2 \n"
234 " bnez %1, 1b \n"
235 " lui %1, 0x8000 \n"
236 " sc %1, %0 \n"
237 " beqzl %1, 1b \n"
238 " nop \n"
239 " .set reorder \n"
240 : "=m" (rw->lock), "=&r" (tmp)
241 : "m" (rw->lock)
242 : "memory");
243 } else {
244 __asm__ __volatile__(
245 " .set noreorder # __raw_write_lock \n"
246 "1: ll %1, %2 \n"
247 " bnez %1, 2f \n"
248 " lui %1, 0x8000 \n"
249 " sc %1, %0 \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"
257 " nop \n"
258 " .previous \n"
259 " .set reorder \n"
260 : "=m" (rw->lock), "=&r" (tmp)
261 : "m" (rw->lock)
262 : "memory");
263 }
264
265 smp_llsc_mb();
266}
267
268static inline void __raw_write_unlock(raw_rwlock_t *rw)
269{
270 smp_mb();
271
272 __asm__ __volatile__(
273 " # __raw_write_unlock \n"
274 " sw $0, %0 \n"
275 : "=m" (rw->lock)
276 : "m" (rw->lock)
277 : "memory");
278}
279
280static inline int __raw_read_trylock(raw_rwlock_t *rw)
281{
282 unsigned int tmp;
283 int ret;
284
285 if (R10000_LLSC_WAR) {
286 __asm__ __volatile__(
287 " .set noreorder # __raw_read_trylock \n"
288 " li %2, 0 \n"
289 "1: ll %1, %3 \n"
290 " bltz %1, 2f \n"
291 " addu %1, 1 \n"
292 " sc %1, %0 \n"
293 " .set reorder \n"
294 " beqzl %1, 1b \n"
295 " nop \n"
296 __WEAK_LLSC_MB
297 " li %2, 1 \n"
298 "2: \n"
299 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
300 : "m" (rw->lock)
301 : "memory");
302 } else {
303 __asm__ __volatile__(
304 " .set noreorder # __raw_read_trylock \n"
305 " li %2, 0 \n"
306 "1: ll %1, %3 \n"
307 " bltz %1, 2f \n"
308 " addu %1, 1 \n"
309 " sc %1, %0 \n"
310 " beqz %1, 1b \n"
311 " nop \n"
312 " .set reorder \n"
313 __WEAK_LLSC_MB
314 " li %2, 1 \n"
315 "2: \n"
316 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
317 : "m" (rw->lock)
318 : "memory");
319 }
320
321 return ret;
322}
323
324static inline int __raw_write_trylock(raw_rwlock_t *rw)
325{
326 unsigned int tmp;
327 int ret;
328
329 if (R10000_LLSC_WAR) {
330 __asm__ __volatile__(
331 " .set noreorder # __raw_write_trylock \n"
332 " li %2, 0 \n"
333 "1: ll %1, %3 \n"
334 " bnez %1, 2f \n"
335 " lui %1, 0x8000 \n"
336 " sc %1, %0 \n"
337 " beqzl %1, 1b \n"
338 " nop \n"
339 __WEAK_LLSC_MB
340 " li %2, 1 \n"
341 " .set reorder \n"
342 "2: \n"
343 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
344 : "m" (rw->lock)
345 : "memory");
346 } else {
347 __asm__ __volatile__(
348 " .set noreorder # __raw_write_trylock \n"
349 " li %2, 0 \n"
350 "1: ll %1, %3 \n"
351 " bnez %1, 2f \n"
352 " lui %1, 0x8000 \n"
353 " sc %1, %0 \n"
354 " beqz %1, 3f \n"
355 " li %2, 1 \n"
356 "2: \n"
357 __WEAK_LLSC_MB
358 " .subsection 2 \n"
359 "3: b 1b \n"
360 " li %2, 0 \n"
361 " .previous \n"
362 " .set reorder \n"
363 : "=m" (rw->lock), "=&r" (tmp), "=&r" (ret)
364 : "m" (rw->lock)
365 : "memory");
366 }
367
368 return ret;
369}
370
371
372#define _raw_spin_relax(lock) cpu_relax()
373#define _raw_read_relax(lock) cpu_relax()
374#define _raw_write_relax(lock) cpu_relax()
375
376#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/spinlock_types.h b/include/asm-mips/spinlock_types.h
deleted file mode 100644
index ce26c5048b15..000000000000
--- a/include/asm-mips/spinlock_types.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_SPINLOCK_TYPES_H
2#define _ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct {
9 volatile unsigned int lock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 volatile unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { 0 }
19
20#endif
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
deleted file mode 100644
index 4c37c4e5f72e..000000000000
--- a/include/asm-mips/stackframe.h
+++ /dev/null
@@ -1,574 +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) 1994, 95, 96, 99, 2001 Ralf Baechle
7 * Copyright (C) 1994, 1995, 1996 Paul M. Antoine.
8 * Copyright (C) 1999 Silicon Graphics, Inc.
9 * Copyright (C) 2007 Maciej W. Rozycki
10 */
11#ifndef _ASM_STACKFRAME_H
12#define _ASM_STACKFRAME_H
13
14#include <linux/threads.h>
15
16#include <asm/asm.h>
17#include <asm/asmmacro.h>
18#include <asm/mipsregs.h>
19#include <asm/asm-offsets.h>
20
21/*
22 * For SMTC kernel, global IE should be left set, and interrupts
23 * controlled exclusively via IXMT.
24 */
25#ifdef CONFIG_MIPS_MT_SMTC
26#define STATMASK 0x1e
27#elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
28#define STATMASK 0x3f
29#else
30#define STATMASK 0x1f
31#endif
32
33#ifdef CONFIG_MIPS_MT_SMTC
34#include <asm/mipsmtregs.h>
35#endif /* CONFIG_MIPS_MT_SMTC */
36
37 .macro SAVE_AT
38 .set push
39 .set noat
40 LONG_S $1, PT_R1(sp)
41 .set pop
42 .endm
43
44 .macro SAVE_TEMP
45#ifdef CONFIG_CPU_HAS_SMARTMIPS
46 mflhxu v1
47 LONG_S v1, PT_LO(sp)
48 mflhxu v1
49 LONG_S v1, PT_HI(sp)
50 mflhxu v1
51 LONG_S v1, PT_ACX(sp)
52#else
53 mfhi v1
54 LONG_S v1, PT_HI(sp)
55 mflo v1
56 LONG_S v1, PT_LO(sp)
57#endif
58#ifdef CONFIG_32BIT
59 LONG_S $8, PT_R8(sp)
60 LONG_S $9, PT_R9(sp)
61#endif
62 LONG_S $10, PT_R10(sp)
63 LONG_S $11, PT_R11(sp)
64 LONG_S $12, PT_R12(sp)
65 LONG_S $13, PT_R13(sp)
66 LONG_S $14, PT_R14(sp)
67 LONG_S $15, PT_R15(sp)
68 LONG_S $24, PT_R24(sp)
69 .endm
70
71 .macro SAVE_STATIC
72 LONG_S $16, PT_R16(sp)
73 LONG_S $17, PT_R17(sp)
74 LONG_S $18, PT_R18(sp)
75 LONG_S $19, PT_R19(sp)
76 LONG_S $20, PT_R20(sp)
77 LONG_S $21, PT_R21(sp)
78 LONG_S $22, PT_R22(sp)
79 LONG_S $23, PT_R23(sp)
80 LONG_S $30, PT_R30(sp)
81 .endm
82
83#ifdef CONFIG_SMP
84#ifdef CONFIG_MIPS_MT_SMTC
85#define PTEBASE_SHIFT 19 /* TCBIND */
86#else
87#define PTEBASE_SHIFT 23 /* CONTEXT */
88#endif
89 .macro get_saved_sp /* SMP variation */
90#ifdef CONFIG_MIPS_MT_SMTC
91 mfc0 k0, CP0_TCBIND
92#else
93 MFC0 k0, CP0_CONTEXT
94#endif
95#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
96 lui k1, %hi(kernelsp)
97#else
98 lui k1, %highest(kernelsp)
99 daddiu k1, %higher(kernelsp)
100 dsll k1, 16
101 daddiu k1, %hi(kernelsp)
102 dsll k1, 16
103#endif
104 LONG_SRL k0, PTEBASE_SHIFT
105 LONG_ADDU k1, k0
106 LONG_L k1, %lo(kernelsp)(k1)
107 .endm
108
109 .macro set_saved_sp stackp temp temp2
110#ifdef CONFIG_MIPS_MT_SMTC
111 mfc0 \temp, CP0_TCBIND
112#else
113 MFC0 \temp, CP0_CONTEXT
114#endif
115 LONG_SRL \temp, PTEBASE_SHIFT
116 LONG_S \stackp, kernelsp(\temp)
117 .endm
118#else
119 .macro get_saved_sp /* Uniprocessor variation */
120#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32)
121 lui k1, %hi(kernelsp)
122#else
123 lui k1, %highest(kernelsp)
124 daddiu k1, %higher(kernelsp)
125 dsll k1, k1, 16
126 daddiu k1, %hi(kernelsp)
127 dsll k1, k1, 16
128#endif
129 LONG_L k1, %lo(kernelsp)(k1)
130 .endm
131
132 .macro set_saved_sp stackp temp temp2
133 LONG_S \stackp, kernelsp
134 .endm
135#endif
136
137 .macro SAVE_SOME
138 .set push
139 .set noat
140 .set reorder
141 mfc0 k0, CP0_STATUS
142 sll k0, 3 /* extract cu0 bit */
143 .set noreorder
144 bltz k0, 8f
145 move k1, sp
146 .set reorder
147 /* Called from user mode, new stack. */
148 get_saved_sp
149#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
1508: move k0, sp
151 PTR_SUBU sp, k1, PT_SIZE
152#else
153 .set at=k0
1548: PTR_SUBU k1, PT_SIZE
155 .set noat
156 move k0, sp
157 move sp, k1
158#endif
159 LONG_S k0, PT_R29(sp)
160 LONG_S $3, PT_R3(sp)
161 /*
162 * You might think that you don't need to save $0,
163 * but the FPU emulator and gdb remote debug stub
164 * need it to operate correctly
165 */
166 LONG_S $0, PT_R0(sp)
167 mfc0 v1, CP0_STATUS
168 LONG_S $2, PT_R2(sp)
169 LONG_S v1, PT_STATUS(sp)
170#ifdef CONFIG_MIPS_MT_SMTC
171 /*
172 * Ideally, these instructions would be shuffled in
173 * to cover the pipeline delay.
174 */
175 .set mips32
176 mfc0 v1, CP0_TCSTATUS
177 .set mips0
178 LONG_S v1, PT_TCSTATUS(sp)
179#endif /* CONFIG_MIPS_MT_SMTC */
180 LONG_S $4, PT_R4(sp)
181 mfc0 v1, CP0_CAUSE
182 LONG_S $5, PT_R5(sp)
183 LONG_S v1, PT_CAUSE(sp)
184 LONG_S $6, PT_R6(sp)
185 MFC0 v1, CP0_EPC
186 LONG_S $7, PT_R7(sp)
187#ifdef CONFIG_64BIT
188 LONG_S $8, PT_R8(sp)
189 LONG_S $9, PT_R9(sp)
190#endif
191 LONG_S v1, PT_EPC(sp)
192 LONG_S $25, PT_R25(sp)
193 LONG_S $28, PT_R28(sp)
194 LONG_S $31, PT_R31(sp)
195 ori $28, sp, _THREAD_MASK
196 xori $28, _THREAD_MASK
197 .set pop
198 .endm
199
200 .macro SAVE_ALL
201 SAVE_SOME
202 SAVE_AT
203 SAVE_TEMP
204 SAVE_STATIC
205 .endm
206
207 .macro RESTORE_AT
208 .set push
209 .set noat
210 LONG_L $1, PT_R1(sp)
211 .set pop
212 .endm
213
214 .macro RESTORE_TEMP
215#ifdef CONFIG_CPU_HAS_SMARTMIPS
216 LONG_L $24, PT_ACX(sp)
217 mtlhx $24
218 LONG_L $24, PT_HI(sp)
219 mtlhx $24
220 LONG_L $24, PT_LO(sp)
221 mtlhx $24
222#else
223 LONG_L $24, PT_LO(sp)
224 mtlo $24
225 LONG_L $24, PT_HI(sp)
226 mthi $24
227#endif
228#ifdef CONFIG_32BIT
229 LONG_L $8, PT_R8(sp)
230 LONG_L $9, PT_R9(sp)
231#endif
232 LONG_L $10, PT_R10(sp)
233 LONG_L $11, PT_R11(sp)
234 LONG_L $12, PT_R12(sp)
235 LONG_L $13, PT_R13(sp)
236 LONG_L $14, PT_R14(sp)
237 LONG_L $15, PT_R15(sp)
238 LONG_L $24, PT_R24(sp)
239 .endm
240
241 .macro RESTORE_STATIC
242 LONG_L $16, PT_R16(sp)
243 LONG_L $17, PT_R17(sp)
244 LONG_L $18, PT_R18(sp)
245 LONG_L $19, PT_R19(sp)
246 LONG_L $20, PT_R20(sp)
247 LONG_L $21, PT_R21(sp)
248 LONG_L $22, PT_R22(sp)
249 LONG_L $23, PT_R23(sp)
250 LONG_L $30, PT_R30(sp)
251 .endm
252
253#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
254
255 .macro RESTORE_SOME
256 .set push
257 .set reorder
258 .set noat
259 mfc0 a0, CP0_STATUS
260 li v1, 0xff00
261 ori a0, STATMASK
262 xori a0, STATMASK
263 mtc0 a0, CP0_STATUS
264 and a0, v1
265 LONG_L v0, PT_STATUS(sp)
266 nor v1, $0, v1
267 and v0, v1
268 or v0, a0
269 mtc0 v0, CP0_STATUS
270 LONG_L $31, PT_R31(sp)
271 LONG_L $28, PT_R28(sp)
272 LONG_L $25, PT_R25(sp)
273 LONG_L $7, PT_R7(sp)
274 LONG_L $6, PT_R6(sp)
275 LONG_L $5, PT_R5(sp)
276 LONG_L $4, PT_R4(sp)
277 LONG_L $3, PT_R3(sp)
278 LONG_L $2, PT_R2(sp)
279 .set pop
280 .endm
281
282 .macro RESTORE_SP_AND_RET
283 .set push
284 .set noreorder
285 LONG_L k0, PT_EPC(sp)
286 LONG_L sp, PT_R29(sp)
287 jr k0
288 rfe
289 .set pop
290 .endm
291
292#else
293 .macro RESTORE_SOME
294 .set push
295 .set reorder
296 .set noat
297#ifdef CONFIG_MIPS_MT_SMTC
298 .set mips32r2
299 /*
300 * We need to make sure the read-modify-write
301 * of Status below isn't perturbed by an interrupt
302 * or cross-TC access, so we need to do at least a DMT,
303 * protected by an interrupt-inhibit. But setting IXMT
304 * also creates a few-cycle window where an IPI could
305 * be queued and not be detected before potentially
306 * returning to a WAIT or user-mode loop. It must be
307 * replayed.
308 *
309 * We're in the middle of a context switch, and
310 * we can't dispatch it directly without trashing
311 * some registers, so we'll try to detect this unlikely
312 * case and program a software interrupt in the VPE,
313 * as would be done for a cross-VPE IPI. To accomodate
314 * the handling of that case, we're doing a DVPE instead
315 * of just a DMT here to protect against other threads.
316 * This is a lot of cruft to cover a tiny window.
317 * If you can find a better design, implement it!
318 *
319 */
320 mfc0 v0, CP0_TCSTATUS
321 ori v0, TCSTATUS_IXMT
322 mtc0 v0, CP0_TCSTATUS
323 _ehb
324 DVPE 5 # dvpe a1
325 jal mips_ihb
326#endif /* CONFIG_MIPS_MT_SMTC */
327 mfc0 a0, CP0_STATUS
328 ori a0, STATMASK
329 xori a0, STATMASK
330 mtc0 a0, CP0_STATUS
331 li v1, 0xff00
332 and a0, v1
333 LONG_L v0, PT_STATUS(sp)
334 nor v1, $0, v1
335 and v0, v1
336 or v0, a0
337 mtc0 v0, CP0_STATUS
338#ifdef CONFIG_MIPS_MT_SMTC
339/*
340 * Only after EXL/ERL have been restored to status can we
341 * restore TCStatus.IXMT.
342 */
343 LONG_L v1, PT_TCSTATUS(sp)
344 _ehb
345 mfc0 a0, CP0_TCSTATUS
346 andi v1, TCSTATUS_IXMT
347 bnez v1, 0f
348
349/*
350 * We'd like to detect any IPIs queued in the tiny window
351 * above and request an software interrupt to service them
352 * when we ERET.
353 *
354 * Computing the offset into the IPIQ array of the executing
355 * TC's IPI queue in-line would be tedious. We use part of
356 * the TCContext register to hold 16 bits of offset that we
357 * can add in-line to find the queue head.
358 */
359 mfc0 v0, CP0_TCCONTEXT
360 la a2, IPIQ
361 srl v0, v0, 16
362 addu a2, a2, v0
363 LONG_L v0, 0(a2)
364 beqz v0, 0f
365/*
366 * If we have a queue, provoke dispatch within the VPE by setting C_SW1
367 */
368 mfc0 v0, CP0_CAUSE
369 ori v0, v0, C_SW1
370 mtc0 v0, CP0_CAUSE
3710:
372 /*
373 * This test should really never branch but
374 * let's be prudent here. Having atomized
375 * the shared register modifications, we can
376 * now EVPE, and must do so before interrupts
377 * are potentially re-enabled.
378 */
379 andi a1, a1, MVPCONTROL_EVP
380 beqz a1, 1f
381 evpe
3821:
383 /* We know that TCStatua.IXMT should be set from above */
384 xori a0, a0, TCSTATUS_IXMT
385 or a0, a0, v1
386 mtc0 a0, CP0_TCSTATUS
387 _ehb
388
389 .set mips0
390#endif /* CONFIG_MIPS_MT_SMTC */
391 LONG_L v1, PT_EPC(sp)
392 MTC0 v1, CP0_EPC
393 LONG_L $31, PT_R31(sp)
394 LONG_L $28, PT_R28(sp)
395 LONG_L $25, PT_R25(sp)
396#ifdef CONFIG_64BIT
397 LONG_L $8, PT_R8(sp)
398 LONG_L $9, PT_R9(sp)
399#endif
400 LONG_L $7, PT_R7(sp)
401 LONG_L $6, PT_R6(sp)
402 LONG_L $5, PT_R5(sp)
403 LONG_L $4, PT_R4(sp)
404 LONG_L $3, PT_R3(sp)
405 LONG_L $2, PT_R2(sp)
406 .set pop
407 .endm
408
409 .macro RESTORE_SP_AND_RET
410 LONG_L sp, PT_R29(sp)
411 .set mips3
412 eret
413 .set mips0
414 .endm
415
416#endif
417
418 .macro RESTORE_SP
419 LONG_L sp, PT_R29(sp)
420 .endm
421
422 .macro RESTORE_ALL
423 RESTORE_TEMP
424 RESTORE_STATIC
425 RESTORE_AT
426 RESTORE_SOME
427 RESTORE_SP
428 .endm
429
430 .macro RESTORE_ALL_AND_RET
431 RESTORE_TEMP
432 RESTORE_STATIC
433 RESTORE_AT
434 RESTORE_SOME
435 RESTORE_SP_AND_RET
436 .endm
437
438/*
439 * Move to kernel mode and disable interrupts.
440 * Set cp0 enable bit as sign that we're running on the kernel stack
441 */
442 .macro CLI
443#if !defined(CONFIG_MIPS_MT_SMTC)
444 mfc0 t0, CP0_STATUS
445 li t1, ST0_CU0 | STATMASK
446 or t0, t1
447 xori t0, STATMASK
448 mtc0 t0, CP0_STATUS
449#else /* CONFIG_MIPS_MT_SMTC */
450 /*
451 * For SMTC, we need to set privilege
452 * and disable interrupts only for the
453 * current TC, using the TCStatus register.
454 */
455 mfc0 t0, CP0_TCSTATUS
456 /* Fortunately CU 0 is in the same place in both registers */
457 /* Set TCU0, TMX, TKSU (for later inversion) and IXMT */
458 li t1, ST0_CU0 | 0x08001c00
459 or t0, t1
460 /* Clear TKSU, leave IXMT */
461 xori t0, 0x00001800
462 mtc0 t0, CP0_TCSTATUS
463 _ehb
464 /* We need to leave the global IE bit set, but clear EXL...*/
465 mfc0 t0, CP0_STATUS
466 ori t0, ST0_EXL | ST0_ERL
467 xori t0, ST0_EXL | ST0_ERL
468 mtc0 t0, CP0_STATUS
469#endif /* CONFIG_MIPS_MT_SMTC */
470 irq_disable_hazard
471 .endm
472
473/*
474 * Move to kernel mode and enable interrupts.
475 * Set cp0 enable bit as sign that we're running on the kernel stack
476 */
477 .macro STI
478#if !defined(CONFIG_MIPS_MT_SMTC)
479 mfc0 t0, CP0_STATUS
480 li t1, ST0_CU0 | STATMASK
481 or t0, t1
482 xori t0, STATMASK & ~1
483 mtc0 t0, CP0_STATUS
484#else /* CONFIG_MIPS_MT_SMTC */
485 /*
486 * For SMTC, we need to set privilege
487 * and enable interrupts only for the
488 * current TC, using the TCStatus register.
489 */
490 _ehb
491 mfc0 t0, CP0_TCSTATUS
492 /* Fortunately CU 0 is in the same place in both registers */
493 /* Set TCU0, TKSU (for later inversion) and IXMT */
494 li t1, ST0_CU0 | 0x08001c00
495 or t0, t1
496 /* Clear TKSU *and* IXMT */
497 xori t0, 0x00001c00
498 mtc0 t0, CP0_TCSTATUS
499 _ehb
500 /* We need to leave the global IE bit set, but clear EXL...*/
501 mfc0 t0, CP0_STATUS
502 ori t0, ST0_EXL
503 xori t0, ST0_EXL
504 mtc0 t0, CP0_STATUS
505 /* irq_enable_hazard below should expand to EHB for 24K/34K cpus */
506#endif /* CONFIG_MIPS_MT_SMTC */
507 irq_enable_hazard
508 .endm
509
510/*
511 * Just move to kernel mode and leave interrupts as they are. Note
512 * for the R3000 this means copying the previous enable from IEp.
513 * Set cp0 enable bit as sign that we're running on the kernel stack
514 */
515 .macro KMODE
516#ifdef CONFIG_MIPS_MT_SMTC
517 /*
518 * This gets baroque in SMTC. We want to
519 * protect the non-atomic clearing of EXL
520 * with DMT/EMT, but we don't want to take
521 * an interrupt while DMT is still in effect.
522 */
523
524 /* KMODE gets invoked from both reorder and noreorder code */
525 .set push
526 .set mips32r2
527 .set noreorder
528 mfc0 v0, CP0_TCSTATUS
529 andi v1, v0, TCSTATUS_IXMT
530 ori v0, TCSTATUS_IXMT
531 mtc0 v0, CP0_TCSTATUS
532 _ehb
533 DMT 2 # dmt v0
534 /*
535 * We don't know a priori if ra is "live"
536 */
537 move t0, ra
538 jal mips_ihb
539 nop /* delay slot */
540 move ra, t0
541#endif /* CONFIG_MIPS_MT_SMTC */
542 mfc0 t0, CP0_STATUS
543 li t1, ST0_CU0 | (STATMASK & ~1)
544#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
545 andi t2, t0, ST0_IEP
546 srl t2, 2
547 or t0, t2
548#endif
549 or t0, t1
550 xori t0, STATMASK & ~1
551 mtc0 t0, CP0_STATUS
552#ifdef CONFIG_MIPS_MT_SMTC
553 _ehb
554 andi v0, v0, VPECONTROL_TE
555 beqz v0, 2f
556 nop /* delay slot */
557 emt
5582:
559 mfc0 v0, CP0_TCSTATUS
560 /* Clear IXMT, then OR in previous value */
561 ori v0, TCSTATUS_IXMT
562 xori v0, TCSTATUS_IXMT
563 or v0, v1, v0
564 mtc0 v0, CP0_TCSTATUS
565 /*
566 * irq_disable_hazard below should expand to EHB
567 * on 24K/34K CPUS
568 */
569 .set pop
570#endif /* CONFIG_MIPS_MT_SMTC */
571 irq_disable_hazard
572 .endm
573
574#endif /* _ASM_STACKFRAME_H */
diff --git a/include/asm-mips/stacktrace.h b/include/asm-mips/stacktrace.h
deleted file mode 100644
index 0bf82818aa53..000000000000
--- a/include/asm-mips/stacktrace.h
+++ /dev/null
@@ -1,48 +0,0 @@
1#ifndef _ASM_STACKTRACE_H
2#define _ASM_STACKTRACE_H
3
4#include <asm/ptrace.h>
5
6#ifdef CONFIG_KALLSYMS
7extern int raw_show_trace;
8extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
9 unsigned long pc, unsigned long *ra);
10#else
11#define raw_show_trace 1
12static inline unsigned long unwind_stack(struct task_struct *task,
13 unsigned long *sp, unsigned long pc, unsigned long *ra)
14{
15 return 0;
16}
17#endif
18
19static __always_inline void prepare_frametrace(struct pt_regs *regs)
20{
21#ifndef CONFIG_KALLSYMS
22 /*
23 * Remove any garbage that may be in regs (specially func
24 * addresses) to avoid show_raw_backtrace() to report them
25 */
26 memset(regs, 0, sizeof(*regs));
27#endif
28 __asm__ __volatile__(
29 ".set push\n\t"
30 ".set noat\n\t"
31#ifdef CONFIG_64BIT
32 "1: dla $1, 1b\n\t"
33 "sd $1, %0\n\t"
34 "sd $29, %1\n\t"
35 "sd $31, %2\n\t"
36#else
37 "1: la $1, 1b\n\t"
38 "sw $1, %0\n\t"
39 "sw $29, %1\n\t"
40 "sw $31, %2\n\t"
41#endif
42 ".set pop\n\t"
43 : "=m" (regs->cp0_epc),
44 "=m" (regs->regs[29]), "=m" (regs->regs[31])
45 : : "memory");
46}
47
48#endif /* _ASM_STACKTRACE_H */
diff --git a/include/asm-mips/stat.h b/include/asm-mips/stat.h
deleted file mode 100644
index 6e00f751ab6d..000000000000
--- a/include/asm-mips/stat.h
+++ /dev/null
@@ -1,132 +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) 1995, 1999, 2000 Ralf Baechle
7 * Copyright (C) 2000 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_STAT_H
10#define _ASM_STAT_H
11
12#include <linux/types.h>
13
14#include <asm/sgidefs.h>
15
16#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
17
18struct stat {
19 unsigned st_dev;
20 long st_pad1[3]; /* Reserved for network id */
21 ino_t st_ino;
22 mode_t st_mode;
23 nlink_t st_nlink;
24 uid_t st_uid;
25 gid_t st_gid;
26 unsigned st_rdev;
27 long st_pad2[2];
28 off_t st_size;
29 long st_pad3;
30 /*
31 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
32 * but we don't have it under Linux.
33 */
34 time_t st_atime;
35 long st_atime_nsec;
36 time_t st_mtime;
37 long st_mtime_nsec;
38 time_t st_ctime;
39 long st_ctime_nsec;
40 long st_blksize;
41 long st_blocks;
42 long st_pad4[14];
43};
44
45/*
46 * This matches struct stat64 in glibc2.1, hence the absolutely insane
47 * amounts of padding around dev_t's. The memory layout is the same as of
48 * struct stat of the 64-bit kernel.
49 */
50
51struct stat64 {
52 unsigned long st_dev;
53 unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
54
55 unsigned long long st_ino;
56
57 mode_t st_mode;
58 nlink_t st_nlink;
59
60 uid_t st_uid;
61 gid_t st_gid;
62
63 unsigned long st_rdev;
64 unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
65
66 long long st_size;
67
68 /*
69 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
70 * but we don't have it under Linux.
71 */
72 time_t st_atime;
73 unsigned long st_atime_nsec; /* Reserved for st_atime expansion */
74
75 time_t st_mtime;
76 unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */
77
78 time_t st_ctime;
79 unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */
80
81 unsigned long st_blksize;
82 unsigned long st_pad2;
83
84 long long st_blocks;
85};
86
87#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
88
89#if _MIPS_SIM == _MIPS_SIM_ABI64
90
91/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
92struct stat {
93 unsigned int st_dev;
94 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
95
96 unsigned long st_ino;
97
98 mode_t st_mode;
99 nlink_t st_nlink;
100
101 uid_t st_uid;
102 gid_t st_gid;
103
104 unsigned int st_rdev;
105 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
106
107 off_t st_size;
108
109 /*
110 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
111 * but we don't have it under Linux.
112 */
113 unsigned int st_atime;
114 unsigned int st_atime_nsec;
115
116 unsigned int st_mtime;
117 unsigned int st_mtime_nsec;
118
119 unsigned int st_ctime;
120 unsigned int st_ctime_nsec;
121
122 unsigned int st_blksize;
123 unsigned int st_pad2;
124
125 unsigned long st_blocks;
126};
127
128#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
129
130#define STAT_HAVE_NSEC 1
131
132#endif /* _ASM_STAT_H */
diff --git a/include/asm-mips/statfs.h b/include/asm-mips/statfs.h
deleted file mode 100644
index c3ddf973c1c0..000000000000
--- a/include/asm-mips/statfs.h
+++ /dev/null
@@ -1,96 +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) 1995, 1999 by Ralf Baechle
7 */
8#ifndef _ASM_STATFS_H
9#define _ASM_STATFS_H
10
11#include <linux/posix_types.h>
12#include <asm/sgidefs.h>
13
14#ifndef __KERNEL_STRICT_NAMES
15
16#include <linux/types.h>
17
18typedef __kernel_fsid_t fsid_t;
19
20#endif
21
22struct statfs {
23 long f_type;
24#define f_fstyp f_type
25 long f_bsize;
26 long f_frsize; /* Fragment size - unsupported */
27 long f_blocks;
28 long f_bfree;
29 long f_files;
30 long f_ffree;
31 long f_bavail;
32
33 /* Linux specials */
34 __kernel_fsid_t f_fsid;
35 long f_namelen;
36 long f_spare[6];
37};
38
39#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
40
41/*
42 * Unlike the traditional version the LFAPI version has none of the ABI junk
43 */
44struct statfs64 {
45 __u32 f_type;
46 __u32 f_bsize;
47 __u32 f_frsize; /* Fragment size - unsupported */
48 __u32 __pad;
49 __u64 f_blocks;
50 __u64 f_bfree;
51 __u64 f_files;
52 __u64 f_ffree;
53 __u64 f_bavail;
54 __kernel_fsid_t f_fsid;
55 __u32 f_namelen;
56 __u32 f_spare[6];
57};
58
59#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
60
61#if _MIPS_SIM == _MIPS_SIM_ABI64
62
63struct statfs64 { /* Same as struct statfs */
64 long f_type;
65 long f_bsize;
66 long f_frsize; /* Fragment size - unsupported */
67 long f_blocks;
68 long f_bfree;
69 long f_files;
70 long f_ffree;
71 long f_bavail;
72
73 /* Linux specials */
74 __kernel_fsid_t f_fsid;
75 long f_namelen;
76 long f_spare[6];
77};
78
79struct compat_statfs64 {
80 __u32 f_type;
81 __u32 f_bsize;
82 __u32 f_frsize; /* Fragment size - unsupported */
83 __u32 __pad;
84 __u64 f_blocks;
85 __u64 f_bfree;
86 __u64 f_files;
87 __u64 f_ffree;
88 __u64 f_bavail;
89 __kernel_fsid_t f_fsid;
90 __u32 f_namelen;
91 __u32 f_spare[6];
92};
93
94#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
95
96#endif /* _ASM_STATFS_H */
diff --git a/include/asm-mips/string.h b/include/asm-mips/string.h
deleted file mode 100644
index 436e3ad352d9..000000000000
--- a/include/asm-mips/string.h
+++ /dev/null
@@ -1,143 +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) 1994, 95, 96, 97, 98, 2000, 01 Ralf Baechle
7 * Copyright (c) 2000 by Silicon Graphics, Inc.
8 * Copyright (c) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_STRING_H
11#define _ASM_STRING_H
12
13
14/*
15 * Most of the inline functions are rather naive implementations so I just
16 * didn't bother updating them for 64-bit ...
17 */
18#ifdef CONFIG_32BIT
19
20#ifndef IN_STRING_C
21
22#define __HAVE_ARCH_STRCPY
23static __inline__ char *strcpy(char *__dest, __const__ char *__src)
24{
25 char *__xdest = __dest;
26
27 __asm__ __volatile__(
28 ".set\tnoreorder\n\t"
29 ".set\tnoat\n"
30 "1:\tlbu\t$1,(%1)\n\t"
31 "addiu\t%1,1\n\t"
32 "sb\t$1,(%0)\n\t"
33 "bnez\t$1,1b\n\t"
34 "addiu\t%0,1\n\t"
35 ".set\tat\n\t"
36 ".set\treorder"
37 : "=r" (__dest), "=r" (__src)
38 : "0" (__dest), "1" (__src)
39 : "memory");
40
41 return __xdest;
42}
43
44#define __HAVE_ARCH_STRNCPY
45static __inline__ char *strncpy(char *__dest, __const__ char *__src, size_t __n)
46{
47 char *__xdest = __dest;
48
49 if (__n == 0)
50 return __xdest;
51
52 __asm__ __volatile__(
53 ".set\tnoreorder\n\t"
54 ".set\tnoat\n"
55 "1:\tlbu\t$1,(%1)\n\t"
56 "subu\t%2,1\n\t"
57 "sb\t$1,(%0)\n\t"
58 "beqz\t$1,2f\n\t"
59 "addiu\t%0,1\n\t"
60 "bnez\t%2,1b\n\t"
61 "addiu\t%1,1\n"
62 "2:\n\t"
63 ".set\tat\n\t"
64 ".set\treorder"
65 : "=r" (__dest), "=r" (__src), "=r" (__n)
66 : "0" (__dest), "1" (__src), "2" (__n)
67 : "memory");
68
69 return __xdest;
70}
71
72#define __HAVE_ARCH_STRCMP
73static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct)
74{
75 int __res;
76
77 __asm__ __volatile__(
78 ".set\tnoreorder\n\t"
79 ".set\tnoat\n\t"
80 "lbu\t%2,(%0)\n"
81 "1:\tlbu\t$1,(%1)\n\t"
82 "addiu\t%0,1\n\t"
83 "bne\t$1,%2,2f\n\t"
84 "addiu\t%1,1\n\t"
85 "bnez\t%2,1b\n\t"
86 "lbu\t%2,(%0)\n\t"
87#if defined(CONFIG_CPU_R3000)
88 "nop\n\t"
89#endif
90 "move\t%2,$1\n"
91 "2:\tsubu\t%2,$1\n"
92 "3:\t.set\tat\n\t"
93 ".set\treorder"
94 : "=r" (__cs), "=r" (__ct), "=r" (__res)
95 : "0" (__cs), "1" (__ct));
96
97 return __res;
98}
99
100#endif /* !defined(IN_STRING_C) */
101
102#define __HAVE_ARCH_STRNCMP
103static __inline__ int
104strncmp(__const__ char *__cs, __const__ char *__ct, size_t __count)
105{
106 int __res;
107
108 __asm__ __volatile__(
109 ".set\tnoreorder\n\t"
110 ".set\tnoat\n"
111 "1:\tlbu\t%3,(%0)\n\t"
112 "beqz\t%2,2f\n\t"
113 "lbu\t$1,(%1)\n\t"
114 "subu\t%2,1\n\t"
115 "bne\t$1,%3,3f\n\t"
116 "addiu\t%0,1\n\t"
117 "bnez\t%3,1b\n\t"
118 "addiu\t%1,1\n"
119 "2:\n\t"
120#if defined(CONFIG_CPU_R3000)
121 "nop\n\t"
122#endif
123 "move\t%3,$1\n"
124 "3:\tsubu\t%3,$1\n\t"
125 ".set\tat\n\t"
126 ".set\treorder"
127 : "=r" (__cs), "=r" (__ct), "=r" (__count), "=r" (__res)
128 : "0" (__cs), "1" (__ct), "2" (__count));
129
130 return __res;
131}
132#endif /* CONFIG_32BIT */
133
134#define __HAVE_ARCH_MEMSET
135extern void *memset(void *__s, int __c, size_t __count);
136
137#define __HAVE_ARCH_MEMCPY
138extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
139
140#define __HAVE_ARCH_MEMMOVE
141extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
142
143#endif /* _ASM_STRING_H */
diff --git a/include/asm-mips/suspend.h b/include/asm-mips/suspend.h
deleted file mode 100644
index 2562f8f9be0e..000000000000
--- a/include/asm-mips/suspend.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_SUSPEND_H
2#define __ASM_SUSPEND_H
3
4/* Somewhen... Maybe :-) */
5
6#endif /* __ASM_SUSPEND_H */
diff --git a/include/asm-mips/sysmips.h b/include/asm-mips/sysmips.h
deleted file mode 100644
index 4f47b7d6a5f7..000000000000
--- a/include/asm-mips/sysmips.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Definitions for the MIPS sysmips(2) call
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) 1995 by Ralf Baechle
9 */
10#ifndef _ASM_SYSMIPS_H
11#define _ASM_SYSMIPS_H
12
13/*
14 * Commands for the sysmips(2) call
15 *
16 * sysmips(2) is deprecated - though some existing software uses it.
17 * We only support the following commands.
18 */
19#define SETNAME 1 /* set hostname */
20#define FLUSH_CACHE 3 /* writeback and invalidate caches */
21#define MIPS_FIXADE 7 /* control address error fixing */
22#define MIPS_RDNVRAM 10 /* read NVRAM */
23#define MIPS_ATOMIC_SET 2001 /* atomically set variable */
24
25#endif /* _ASM_SYSMIPS_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
deleted file mode 100644
index a944eda4faf5..000000000000
--- a/include/asm-mips/system.h
+++ /dev/null
@@ -1,220 +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) 1994, 95, 96, 97, 98, 99, 2003, 06 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 */
12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H
14
15#include <linux/types.h>
16#include <linux/irqflags.h>
17
18#include <asm/addrspace.h>
19#include <asm/barrier.h>
20#include <asm/cmpxchg.h>
21#include <asm/cpu-features.h>
22#include <asm/dsp.h>
23#include <asm/war.h>
24
25
26/*
27 * switch_to(n) should switch tasks to task nr n, first
28 * checking that n isn't the current task, in which case it does nothing.
29 */
30extern asmlinkage void *resume(void *last, void *next, void *next_ti);
31
32struct task_struct;
33
34#ifdef CONFIG_MIPS_MT_FPAFF
35
36/*
37 * Handle the scheduler resume end of FPU affinity management. We do this
38 * inline to try to keep the overhead down. If we have been forced to run on
39 * a "CPU" with an FPU because of a previous high level of FP computation,
40 * but did not actually use the FPU during the most recent time-slice (CU1
41 * isn't set), we undo the restriction on cpus_allowed.
42 *
43 * We're not calling set_cpus_allowed() here, because we have no need to
44 * force prompt migration - we're already switching the current CPU to a
45 * different thread.
46 */
47
48#define __mips_mt_fpaff_switch_to(prev) \
49do { \
50 struct thread_info *__prev_ti = task_thread_info(prev); \
51 \
52 if (cpu_has_fpu && \
53 test_ti_thread_flag(__prev_ti, TIF_FPUBOUND) && \
54 (!(KSTK_STATUS(prev) & ST0_CU1))) { \
55 clear_ti_thread_flag(__prev_ti, TIF_FPUBOUND); \
56 prev->cpus_allowed = prev->thread.user_cpus_allowed; \
57 } \
58 next->thread.emulated_fp = 0; \
59} while(0)
60
61#else
62#define __mips_mt_fpaff_switch_to(prev) do { (void) (prev); } while (0)
63#endif
64
65#define switch_to(prev, next, last) \
66do { \
67 __mips_mt_fpaff_switch_to(prev); \
68 if (cpu_has_dsp) \
69 __save_dsp(prev); \
70 (last) = resume(prev, next, task_thread_info(next)); \
71} while (0)
72
73#define finish_arch_switch(prev) \
74do { \
75 if (cpu_has_dsp) \
76 __restore_dsp(current); \
77 if (cpu_has_userlocal) \
78 write_c0_userlocal(current_thread_info()->tp_value); \
79} while (0)
80
81static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
82{
83 __u32 retval;
84
85 if (cpu_has_llsc && R10000_LLSC_WAR) {
86 unsigned long dummy;
87
88 __asm__ __volatile__(
89 " .set mips3 \n"
90 "1: ll %0, %3 # xchg_u32 \n"
91 " .set mips0 \n"
92 " move %2, %z4 \n"
93 " .set mips3 \n"
94 " sc %2, %1 \n"
95 " beqzl %2, 1b \n"
96 " .set mips0 \n"
97 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
98 : "R" (*m), "Jr" (val)
99 : "memory");
100 } else if (cpu_has_llsc) {
101 unsigned long dummy;
102
103 __asm__ __volatile__(
104 " .set mips3 \n"
105 "1: ll %0, %3 # xchg_u32 \n"
106 " .set mips0 \n"
107 " move %2, %z4 \n"
108 " .set mips3 \n"
109 " sc %2, %1 \n"
110 " beqz %2, 2f \n"
111 " .subsection 2 \n"
112 "2: b 1b \n"
113 " .previous \n"
114 " .set mips0 \n"
115 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
116 : "R" (*m), "Jr" (val)
117 : "memory");
118 } else {
119 unsigned long flags;
120
121 raw_local_irq_save(flags);
122 retval = *m;
123 *m = val;
124 raw_local_irq_restore(flags); /* implies memory barrier */
125 }
126
127 smp_llsc_mb();
128
129 return retval;
130}
131
132#ifdef CONFIG_64BIT
133static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
134{
135 __u64 retval;
136
137 if (cpu_has_llsc && R10000_LLSC_WAR) {
138 unsigned long dummy;
139
140 __asm__ __volatile__(
141 " .set mips3 \n"
142 "1: lld %0, %3 # xchg_u64 \n"
143 " move %2, %z4 \n"
144 " scd %2, %1 \n"
145 " beqzl %2, 1b \n"
146 " .set mips0 \n"
147 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
148 : "R" (*m), "Jr" (val)
149 : "memory");
150 } else if (cpu_has_llsc) {
151 unsigned long dummy;
152
153 __asm__ __volatile__(
154 " .set mips3 \n"
155 "1: lld %0, %3 # xchg_u64 \n"
156 " move %2, %z4 \n"
157 " scd %2, %1 \n"
158 " beqz %2, 2f \n"
159 " .subsection 2 \n"
160 "2: b 1b \n"
161 " .previous \n"
162 " .set mips0 \n"
163 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
164 : "R" (*m), "Jr" (val)
165 : "memory");
166 } else {
167 unsigned long flags;
168
169 raw_local_irq_save(flags);
170 retval = *m;
171 *m = val;
172 raw_local_irq_restore(flags); /* implies memory barrier */
173 }
174
175 smp_llsc_mb();
176
177 return retval;
178}
179#else
180extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 val);
181#define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
182#endif
183
184/* This function doesn't exist, so you'll get a linker error
185 if something tries to do an invalid xchg(). */
186extern void __xchg_called_with_bad_pointer(void);
187
188static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
189{
190 switch (size) {
191 case 4:
192 return __xchg_u32(ptr, x);
193 case 8:
194 return __xchg_u64(ptr, x);
195 }
196 __xchg_called_with_bad_pointer();
197 return x;
198}
199
200#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
201
202extern void set_handler(unsigned long offset, void *addr, unsigned long len);
203extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);
204
205typedef void (*vi_handler_t)(void);
206extern void *set_vi_handler(int n, vi_handler_t addr);
207
208extern void *set_except_vector(int n, void *addr);
209extern unsigned long ebase;
210extern void per_cpu_trap_init(void);
211
212/*
213 * See include/asm-ia64/system.h; prevents deadlock on SMP
214 * systems.
215 */
216#define __ARCH_WANT_UNLOCKED_CTXSW
217
218extern unsigned long arch_align_stack(unsigned long sp);
219
220#endif /* _ASM_SYSTEM_H */
diff --git a/include/asm-mips/termbits.h b/include/asm-mips/termbits.h
deleted file mode 100644
index c83c68444e86..000000000000
--- a/include/asm-mips/termbits.h
+++ /dev/null
@@ -1,226 +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) 1995, 96, 99, 2001, 06 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2001 MIPS Technologies, Inc.
9 */
10#ifndef _ASM_TERMBITS_H
11#define _ASM_TERMBITS_H
12
13#include <linux/posix_types.h>
14
15typedef unsigned char cc_t;
16typedef unsigned int speed_t;
17typedef unsigned int tcflag_t;
18
19/*
20 * The ABI says nothing about NCC but seems to use NCCS as
21 * replacement for it in struct termio
22 */
23#define NCCS 23
24struct termios {
25 tcflag_t c_iflag; /* input mode flags */
26 tcflag_t c_oflag; /* output mode flags */
27 tcflag_t c_cflag; /* control mode flags */
28 tcflag_t c_lflag; /* local mode flags */
29 cc_t c_line; /* line discipline */
30 cc_t c_cc[NCCS]; /* control characters */
31};
32
33struct termios2 {
34 tcflag_t c_iflag; /* input mode flags */
35 tcflag_t c_oflag; /* output mode flags */
36 tcflag_t c_cflag; /* control mode flags */
37 tcflag_t c_lflag; /* local mode flags */
38 cc_t c_line; /* line discipline */
39 cc_t c_cc[NCCS]; /* control characters */
40 speed_t c_ispeed; /* input speed */
41 speed_t c_ospeed; /* output speed */
42};
43
44struct ktermios {
45 tcflag_t c_iflag; /* input mode flags */
46 tcflag_t c_oflag; /* output mode flags */
47 tcflag_t c_cflag; /* control mode flags */
48 tcflag_t c_lflag; /* local mode flags */
49 cc_t c_line; /* line discipline */
50 cc_t c_cc[NCCS]; /* control characters */
51 speed_t c_ispeed; /* input speed */
52 speed_t c_ospeed; /* output speed */
53};
54
55/* c_cc characters */
56#define VINTR 0 /* Interrupt character [ISIG]. */
57#define VQUIT 1 /* Quit character [ISIG]. */
58#define VERASE 2 /* Erase character [ICANON]. */
59#define VKILL 3 /* Kill-line character [ICANON]. */
60#define VMIN 4 /* Minimum number of bytes read at once [!ICANON]. */
61#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON]. */
62#define VEOL2 6 /* Second EOL character [ICANON]. */
63#define VSWTC 7 /* ??? */
64#define VSWTCH VSWTC
65#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF]. */
66#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF]. */
67#define VSUSP 10 /* Suspend character [ISIG]. */
68#if 0
69/*
70 * VDSUSP is not supported
71 */
72#define VDSUSP 11 /* Delayed suspend character [ISIG]. */
73#endif
74#define VREPRINT 12 /* Reprint-line character [ICANON]. */
75#define VDISCARD 13 /* Discard character [IEXTEN]. */
76#define VWERASE 14 /* Word-erase character [ICANON]. */
77#define VLNEXT 15 /* Literal-next character [IEXTEN]. */
78#define VEOF 16 /* End-of-file character [ICANON]. */
79#define VEOL 17 /* End-of-line character [ICANON]. */
80
81/* c_iflag bits */
82#define IGNBRK 0000001 /* Ignore break condition. */
83#define BRKINT 0000002 /* Signal interrupt on break. */
84#define IGNPAR 0000004 /* Ignore characters with parity errors. */
85#define PARMRK 0000010 /* Mark parity and framing errors. */
86#define INPCK 0000020 /* Enable input parity check. */
87#define ISTRIP 0000040 /* Strip 8th bit off characters. */
88#define INLCR 0000100 /* Map NL to CR on input. */
89#define IGNCR 0000200 /* Ignore CR. */
90#define ICRNL 0000400 /* Map CR to NL on input. */
91#define IUCLC 0001000 /* Map upper case to lower case on input. */
92#define IXON 0002000 /* Enable start/stop output control. */
93#define IXANY 0004000 /* Any character will restart after stop. */
94#define IXOFF 0010000 /* Enable start/stop input control. */
95#define IMAXBEL 0020000 /* Ring bell when input queue is full. */
96#define IUTF8 0040000 /* Input is UTF-8 */
97
98/* c_oflag bits */
99#define OPOST 0000001 /* Perform output processing. */
100#define OLCUC 0000002 /* Map lower case to upper case on output. */
101#define ONLCR 0000004 /* Map NL to CR-NL on output. */
102#define OCRNL 0000010
103#define ONOCR 0000020
104#define ONLRET 0000040
105#define OFILL 0000100
106#define OFDEL 0000200
107#define NLDLY 0000400
108#define NL0 0000000
109#define NL1 0000400
110#define CRDLY 0003000
111#define CR0 0000000
112#define CR1 0001000
113#define CR2 0002000
114#define CR3 0003000
115#define TABDLY 0014000
116#define TAB0 0000000
117#define TAB1 0004000
118#define TAB2 0010000
119#define TAB3 0014000
120#define XTABS 0014000
121#define BSDLY 0020000
122#define BS0 0000000
123#define BS1 0020000
124#define VTDLY 0040000
125#define VT0 0000000
126#define VT1 0040000
127#define FFDLY 0100000
128#define FF0 0000000
129#define FF1 0100000
130/*
131#define PAGEOUT ???
132#define WRAP ???
133 */
134
135/* c_cflag bit meaning */
136#define CBAUD 0010017
137#define B0 0000000 /* hang up */
138#define B50 0000001
139#define B75 0000002
140#define B110 0000003
141#define B134 0000004
142#define B150 0000005
143#define B200 0000006
144#define B300 0000007
145#define B600 0000010
146#define B1200 0000011
147#define B1800 0000012
148#define B2400 0000013
149#define B4800 0000014
150#define B9600 0000015
151#define B19200 0000016
152#define B38400 0000017
153#define EXTA B19200
154#define EXTB B38400
155#define CSIZE 0000060 /* Number of bits per byte (mask). */
156#define CS5 0000000 /* 5 bits per byte. */
157#define CS6 0000020 /* 6 bits per byte. */
158#define CS7 0000040 /* 7 bits per byte. */
159#define CS8 0000060 /* 8 bits per byte. */
160#define CSTOPB 0000100 /* Two stop bits instead of one. */
161#define CREAD 0000200 /* Enable receiver. */
162#define PARENB 0000400 /* Parity enable. */
163#define PARODD 0001000 /* Odd parity instead of even. */
164#define HUPCL 0002000 /* Hang up on last close. */
165#define CLOCAL 0004000 /* Ignore modem status lines. */
166#define CBAUDEX 0010000
167#define BOTHER 0010000
168#define B57600 0010001
169#define B115200 0010002
170#define B230400 0010003
171#define B460800 0010004
172#define B500000 0010005
173#define B576000 0010006
174#define B921600 0010007
175#define B1000000 0010010
176#define B1152000 0010011
177#define B1500000 0010012
178#define B2000000 0010013
179#define B2500000 0010014
180#define B3000000 0010015
181#define B3500000 0010016
182#define B4000000 0010017
183#define CIBAUD 002003600000 /* input baud rate */
184#define CMSPAR 010000000000 /* mark or space (stick) parity */
185#define CRTSCTS 020000000000 /* flow control */
186
187#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
188
189/* c_lflag bits */
190#define ISIG 0000001 /* Enable signals. */
191#define ICANON 0000002 /* Do erase and kill processing. */
192#define XCASE 0000004
193#define ECHO 0000010 /* Enable echo. */
194#define ECHOE 0000020 /* Visual erase for ERASE. */
195#define ECHOK 0000040 /* Echo NL after KILL. */
196#define ECHONL 0000100 /* Echo NL even if ECHO is off. */
197#define NOFLSH 0000200 /* Disable flush after interrupt. */
198#define IEXTEN 0000400 /* Enable DISCARD and LNEXT. */
199#define ECHOCTL 0001000 /* Echo control characters as ^X. */
200#define ECHOPRT 0002000 /* Hardcopy visual erase. */
201#define ECHOKE 0004000 /* Visual erase for KILL. */
202#define FLUSHO 0020000
203#define PENDIN 0040000 /* Retype pending input (state). */
204#define TOSTOP 0100000 /* Send SIGTTOU for background output. */
205#define ITOSTOP TOSTOP
206
207/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
208#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
209
210/* tcflow() and TCXONC use these */
211#define TCOOFF 0 /* Suspend output. */
212#define TCOON 1 /* Restart suspended output. */
213#define TCIOFF 2 /* Send a STOP character. */
214#define TCION 3 /* Send a START character. */
215
216/* tcflush() and TCFLSH use these */
217#define TCIFLUSH 0 /* Discard data received but not yet read. */
218#define TCOFLUSH 1 /* Discard data written but not yet sent. */
219#define TCIOFLUSH 2 /* Discard all pending data. */
220
221/* tcsetattr uses these */
222#define TCSANOW TCSETS /* Change immediately. */
223#define TCSADRAIN TCSETSW /* Change when pending output is written. */
224#define TCSAFLUSH TCSETSF /* Flush pending input before changing. */
225
226#endif /* _ASM_TERMBITS_H */
diff --git a/include/asm-mips/termios.h b/include/asm-mips/termios.h
deleted file mode 100644
index a275661fa7e1..000000000000
--- a/include/asm-mips/termios.h
+++ /dev/null
@@ -1,132 +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) 1995, 1996, 2000, 2001 by Ralf Baechle
7 * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_TERMIOS_H
10#define _ASM_TERMIOS_H
11
12#include <asm/termbits.h>
13#include <asm/ioctls.h>
14
15struct sgttyb {
16 char sg_ispeed;
17 char sg_ospeed;
18 char sg_erase;
19 char sg_kill;
20 int sg_flags; /* SGI special - int, not short */
21};
22
23struct tchars {
24 char t_intrc;
25 char t_quitc;
26 char t_startc;
27 char t_stopc;
28 char t_eofc;
29 char t_brkc;
30};
31
32struct ltchars {
33 char t_suspc; /* stop process signal */
34 char t_dsuspc; /* delayed stop process signal */
35 char t_rprntc; /* reprint line */
36 char t_flushc; /* flush output (toggles) */
37 char t_werasc; /* word erase */
38 char t_lnextc; /* literal next character */
39};
40
41/* TIOCGSIZE, TIOCSSIZE not defined yet. Only needed for SunOS source
42 compatibility anyway ... */
43
44struct winsize {
45 unsigned short ws_row;
46 unsigned short ws_col;
47 unsigned short ws_xpixel;
48 unsigned short ws_ypixel;
49};
50
51#define NCC 8
52struct termio {
53 unsigned short c_iflag; /* input mode flags */
54 unsigned short c_oflag; /* output mode flags */
55 unsigned short c_cflag; /* control mode flags */
56 unsigned short c_lflag; /* local mode flags */
57 char c_line; /* line discipline */
58 unsigned char c_cc[NCCS]; /* control characters */
59};
60
61#ifdef __KERNEL__
62#include <linux/module.h>
63
64/*
65 * intr=^C quit=^\ erase=del kill=^U
66 * vmin=\1 vtime=\0 eol2=\0 swtc=\0
67 * start=^Q stop=^S susp=^Z vdsusp=
68 * reprint=^R discard=^U werase=^W lnext=^V
69 * eof=^D eol=\0
70 */
71#define INIT_C_CC "\003\034\177\025\1\0\0\0\021\023\032\0\022\017\027\026\004\0"
72#endif
73
74/* modem lines */
75#define TIOCM_LE 0x001 /* line enable */
76#define TIOCM_DTR 0x002 /* data terminal ready */
77#define TIOCM_RTS 0x004 /* request to send */
78#define TIOCM_ST 0x010 /* secondary transmit */
79#define TIOCM_SR 0x020 /* secondary receive */
80#define TIOCM_CTS 0x040 /* clear to send */
81#define TIOCM_CAR 0x100 /* carrier detect */
82#define TIOCM_CD TIOCM_CAR
83#define TIOCM_RNG 0x200 /* ring */
84#define TIOCM_RI TIOCM_RNG
85#define TIOCM_DSR 0x400 /* data set ready */
86#define TIOCM_OUT1 0x2000
87#define TIOCM_OUT2 0x4000
88#define TIOCM_LOOP 0x8000
89
90#ifdef __KERNEL__
91
92#include <linux/string.h>
93
94/*
95 * Translate a "termio" structure into a "termios". Ugh.
96 */
97#define user_termio_to_kernel_termios(termios, termio) \
98({ \
99 unsigned short tmp; \
100 get_user(tmp, &(termio)->c_iflag); \
101 (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
102 get_user(tmp, &(termio)->c_oflag); \
103 (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
104 get_user(tmp, &(termio)->c_cflag); \
105 (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
106 get_user(tmp, &(termio)->c_lflag); \
107 (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
108 get_user((termios)->c_line, &(termio)->c_line); \
109 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
110})
111
112/*
113 * Translate a "termios" structure into a "termio". Ugh.
114 */
115#define kernel_termios_to_user_termio(termio, termios) \
116({ \
117 put_user((termios)->c_iflag, &(termio)->c_iflag); \
118 put_user((termios)->c_oflag, &(termio)->c_oflag); \
119 put_user((termios)->c_cflag, &(termio)->c_cflag); \
120 put_user((termios)->c_lflag, &(termio)->c_lflag); \
121 put_user((termios)->c_line, &(termio)->c_line); \
122 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
123})
124
125#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
126#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
127#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
128#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
129
130#endif /* defined(__KERNEL__) */
131
132#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
deleted file mode 100644
index bb3060699df2..000000000000
--- a/include/asm-mips/thread_info.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/* thread_info.h: MIPS low-level thread information
2 *
3 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
4 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
5 */
6
7#ifndef _ASM_THREAD_INFO_H
8#define _ASM_THREAD_INFO_H
9
10#ifdef __KERNEL__
11
12
13#ifndef __ASSEMBLY__
14
15#include <asm/processor.h>
16
17/*
18 * low level task data that entry.S needs immediate access to
19 * - this struct should fit entirely inside of one cache line
20 * - this struct shares the supervisor stack pages
21 * - if the contents of this structure are changed, the assembly constants
22 * must also be changed
23 */
24struct thread_info {
25 struct task_struct *task; /* main task structure */
26 struct exec_domain *exec_domain; /* execution domain */
27 unsigned long flags; /* low level flags */
28 unsigned long tp_value; /* thread pointer */
29 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, <0 => BUG */
31
32 mm_segment_t addr_limit; /* thread address space:
33 0-0xBFFFFFFF for user-thead
34 0-0xFFFFFFFF for kernel-thread
35 */
36 struct restart_block restart_block;
37 struct pt_regs *regs;
38};
39
40/*
41 * macros/functions for gaining access to the thread information structure
42 *
43 * preempt_count needs to be 1 initially, until the scheduler is functional.
44 */
45#define INIT_THREAD_INFO(tsk) \
46{ \
47 .task = &tsk, \
48 .exec_domain = &default_exec_domain, \
49 .flags = _TIF_FIXADE, \
50 .cpu = 0, \
51 .preempt_count = 1, \
52 .addr_limit = KERNEL_DS, \
53 .restart_block = { \
54 .fn = do_no_restart_syscall, \
55 }, \
56}
57
58#define init_thread_info (init_thread_union.thread_info)
59#define init_stack (init_thread_union.stack)
60
61/* How to get the thread information struct from C. */
62register struct thread_info *__current_thread_info __asm__("$28");
63#define current_thread_info() __current_thread_info
64
65/* thread information allocation */
66#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT)
67#define THREAD_SIZE_ORDER (1)
68#endif
69#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_64BIT)
70#define THREAD_SIZE_ORDER (2)
71#endif
72#ifdef CONFIG_PAGE_SIZE_8KB
73#define THREAD_SIZE_ORDER (1)
74#endif
75#ifdef CONFIG_PAGE_SIZE_16KB
76#define THREAD_SIZE_ORDER (0)
77#endif
78#ifdef CONFIG_PAGE_SIZE_64KB
79#define THREAD_SIZE_ORDER (0)
80#endif
81
82#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
83#define THREAD_MASK (THREAD_SIZE - 1UL)
84
85#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
86
87#ifdef CONFIG_DEBUG_STACK_USAGE
88#define alloc_thread_info(tsk) \
89({ \
90 struct thread_info *ret; \
91 \
92 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
93 \
94 ret; \
95})
96#else
97#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
98#endif
99
100#define free_thread_info(info) kfree(info)
101
102#endif /* !__ASSEMBLY__ */
103
104#define PREEMPT_ACTIVE 0x10000000
105
106/*
107 * thread information flags
108 * - these are process state flags that various assembly files may need to
109 * access
110 * - pending work-to-be-done flags are in LSW
111 * - other flags in MSW
112 */
113#define TIF_SIGPENDING 1 /* signal pending */
114#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
115#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */
116#define TIF_SECCOMP 4 /* secure computing */
117#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120#define TIF_MEMDIE 18
121#define TIF_FREEZE 19
122#define TIF_FIXADE 20 /* Fix address errors in software */
123#define TIF_LOGADE 21 /* Log address errors to syslog */
124#define TIF_32BIT_REGS 22 /* also implies 16/32 fprs */
125#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */
126#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */
127#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
128
129#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
130#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
131#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
132#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
133#define _TIF_SECCOMP (1<<TIF_SECCOMP)
134#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
135#define _TIF_USEDFPU (1<<TIF_USEDFPU)
136#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
137#define _TIF_FREEZE (1<<TIF_FREEZE)
138#define _TIF_FIXADE (1<<TIF_FIXADE)
139#define _TIF_LOGADE (1<<TIF_LOGADE)
140#define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS)
141#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR)
142#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
143
144/* work to do on interrupt/exception return */
145#define _TIF_WORK_MASK (0x0000ffef & ~_TIF_SECCOMP)
146/* work to do on any return to u-space */
147#define _TIF_ALLWORK_MASK (0x8000ffff & ~_TIF_SECCOMP)
148
149#endif /* __KERNEL__ */
150
151#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
deleted file mode 100644
index d3bd5c5aa2ec..000000000000
--- a/include/asm-mips/time.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright (C) 2001, 2002, MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (c) 2003 Maciej W. Rozycki
5 *
6 * include/asm-mips/time.h
7 * header file for the new style time.c file and time services.
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_TIME_H
15#define _ASM_TIME_H
16
17#include <linux/rtc.h>
18#include <linux/spinlock.h>
19#include <linux/clockchips.h>
20#include <linux/clocksource.h>
21
22extern spinlock_t rtc_lock;
23
24/*
25 * RTC ops. By default, they point to weak no-op RTC functions.
26 * rtc_mips_set_time - reverse the above translation and set time to RTC.
27 * rtc_mips_set_mmss - similar to rtc_set_time, but only min and sec need
28 * to be set. Used by RTC sync-up.
29 */
30extern int rtc_mips_set_time(unsigned long);
31extern int rtc_mips_set_mmss(unsigned long);
32
33/*
34 * board specific routines required by time_init().
35 */
36extern void plat_time_init(void);
37
38/*
39 * mips_hpt_frequency - must be set if you intend to use an R4k-compatible
40 * counter as a timer interrupt source.
41 */
42extern unsigned int mips_hpt_frequency;
43
44/*
45 * The performance counter IRQ on MIPS is a close relative to the timer IRQ
46 * so it lives here.
47 */
48extern int (*perf_irq)(void);
49
50/*
51 * Initialize the calling CPU's compare interrupt as clockevent device
52 */
53#ifdef CONFIG_CEVT_R4K
54extern int mips_clockevent_init(void);
55extern unsigned int __weak get_c0_compare_int(void);
56#else
57static inline int mips_clockevent_init(void)
58{
59 return -ENXIO;
60}
61#endif
62
63/*
64 * Initialize the count register as a clocksource
65 */
66#ifdef CONFIG_CEVT_R4K
67extern int init_mips_clocksource(void);
68#else
69static inline int init_mips_clocksource(void)
70{
71 return 0;
72}
73#endif
74
75extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock);
76extern void clockevent_set_clock(struct clock_event_device *cd,
77 unsigned int clock);
78
79#endif /* _ASM_TIME_H */
diff --git a/include/asm-mips/timex.h b/include/asm-mips/timex.h
deleted file mode 100644
index 6529704aa73a..000000000000
--- a/include/asm-mips/timex.h
+++ /dev/null
@@ -1,43 +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) 1998, 1999, 2003 by Ralf Baechle
7 */
8#ifndef _ASM_TIMEX_H
9#define _ASM_TIMEX_H
10
11#ifdef __KERNEL__
12
13#include <asm/mipsregs.h>
14
15/*
16 * This is the clock rate of the i8253 PIT. A MIPS system may not have
17 * a PIT by the symbol is used all over the kernel including some APIs.
18 * So keeping it defined to the number for the PIT is the only sane thing
19 * for now.
20 */
21#define CLOCK_TICK_RATE 1193182
22
23/*
24 * Standard way to access the cycle counter.
25 * Currently only used on SMP for scheduling.
26 *
27 * Only the low 32 bits are available as a continuously counting entity.
28 * But this only means we'll force a reschedule every 8 seconds or so,
29 * which isn't an evil thing.
30 *
31 * We know that all SMP capable CPUs have cycle counters.
32 */
33
34typedef unsigned int cycles_t;
35
36static inline cycles_t get_cycles(void)
37{
38 return 0;
39}
40
41#endif /* __KERNEL__ */
42
43#endif /* _ASM_TIMEX_H */
diff --git a/include/asm-mips/titan_dep.h b/include/asm-mips/titan_dep.h
deleted file mode 100644
index fee1908c65d2..000000000000
--- a/include/asm-mips/titan_dep.h
+++ /dev/null
@@ -1,231 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * Board specific definititions for the PMC-Sierra Yosemite
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __TITAN_DEP_H__
14#define __TITAN_DEP_H__
15
16#include <asm/addrspace.h> /* for KSEG1ADDR() */
17#include <asm/byteorder.h> /* for cpu_to_le32() */
18
19#define TITAN_READ(ofs) \
20 (*(volatile u32 *)(ocd_base+(ofs)))
21#define TITAN_READ_16(ofs) \
22 (*(volatile u16 *)(ocd_base+(ofs)))
23#define TITAN_READ_8(ofs) \
24 (*(volatile u8 *)(ocd_base+(ofs)))
25
26#define TITAN_WRITE(ofs, data) \
27 do { *(volatile u32 *)(ocd_base+(ofs)) = (data); } while (0)
28#define TITAN_WRITE_16(ofs, data) \
29 do { *(volatile u16 *)(ocd_base+(ofs)) = (data); } while (0)
30#define TITAN_WRITE_8(ofs, data) \
31 do { *(volatile u8 *)(ocd_base+(ofs)) = (data); } while (0)
32
33/*
34 * PCI specific defines
35 */
36#define TITAN_PCI_0_CONFIG_ADDRESS 0x780
37#define TITAN_PCI_0_CONFIG_DATA 0x784
38
39/*
40 * HT specific defines
41 */
42#define RM9000x2_HTLINK_REG 0xbb000644
43#define RM9000x2_BASE_ADDR 0xbb000000
44
45#define OCD_BASE 0xfb000000UL
46#define OCD_SIZE 0x3000UL
47
48extern unsigned long ocd_base;
49
50/*
51 * OCD Registers
52 */
53#define RM9000x2_OCD_LKB5 0x0128 /* Ethernet */
54#define RM9000x2_OCD_LKM5 0x012c
55
56#define RM9000x2_OCD_LKB7 0x0138 /* HT Region 0 */
57#define RM9000x2_OCD_LKM7 0x013c
58#define RM9000x2_OCD_LKB8 0x0140 /* HT Region 1 */
59#define RM9000x2_OCD_LKM8 0x0144
60
61#define RM9000x2_OCD_LKB9 0x0148 /* Local Bus */
62#define RM9000x2_OCD_LKM9 0x014c
63#define RM9000x2_OCD_LKB10 0x0150
64#define RM9000x2_OCD_LKM10 0x0154
65#define RM9000x2_OCD_LKB11 0x0158
66#define RM9000x2_OCD_LKM11 0x015c
67#define RM9000x2_OCD_LKB12 0x0160
68#define RM9000x2_OCD_LKM12 0x0164
69
70#define RM9000x2_OCD_LKB13 0x0168 /* Scratch RAM */
71#define RM9000x2_OCD_LKM13 0x016c
72
73#define RM9000x2_OCD_LPD0 0x0200 /* Local Bus */
74#define RM9000x2_OCD_LPD1 0x0210
75#define RM9000x2_OCD_LPD2 0x0220
76#define RM9000x2_OCD_LPD3 0x0230
77
78#define RM9000x2_OCD_HTDVID 0x0600 /* HT Device Header */
79#define RM9000x2_OCD_HTSC 0x0604
80#define RM9000x2_OCD_HTCCR 0x0608
81#define RM9000x2_OCD_HTBHL 0x060c
82#define RM9000x2_OCD_HTBAR0 0x0610
83#define RM9000x2_OCD_HTBAR1 0x0614
84#define RM9000x2_OCD_HTBAR2 0x0618
85#define RM9000x2_OCD_HTBAR3 0x061c
86#define RM9000x2_OCD_HTBAR4 0x0620
87#define RM9000x2_OCD_HTBAR5 0x0624
88#define RM9000x2_OCD_HTCBCPT 0x0628
89#define RM9000x2_OCD_HTSDVID 0x062c
90#define RM9000x2_OCD_HTXRA 0x0630
91#define RM9000x2_OCD_HTCAP1 0x0634
92#define RM9000x2_OCD_HTIL 0x063c
93
94#define RM9000x2_OCD_HTLCC 0x0640 /* HT Capability Block */
95#define RM9000x2_OCD_HTLINK 0x0644
96#define RM9000x2_OCD_HTFQREV 0x0648
97
98#define RM9000x2_OCD_HTERCTL 0x0668 /* HT Controller */
99#define RM9000x2_OCD_HTRXDB 0x066c
100#define RM9000x2_OCD_HTIMPED 0x0670
101#define RM9000x2_OCD_HTSWIMP 0x0674
102#define RM9000x2_OCD_HTCAL 0x0678
103
104#define RM9000x2_OCD_HTBAA30 0x0680
105#define RM9000x2_OCD_HTBAA54 0x0684
106#define RM9000x2_OCD_HTMASK0 0x0688
107#define RM9000x2_OCD_HTMASK1 0x068c
108#define RM9000x2_OCD_HTMASK2 0x0690
109#define RM9000x2_OCD_HTMASK3 0x0694
110#define RM9000x2_OCD_HTMASK4 0x0698
111#define RM9000x2_OCD_HTMASK5 0x069c
112
113#define RM9000x2_OCD_HTIFCTL 0x06a0
114#define RM9000x2_OCD_HTPLL 0x06a4
115
116#define RM9000x2_OCD_HTSRI 0x06b0
117#define RM9000x2_OCD_HTRXNUM 0x06b4
118#define RM9000x2_OCD_HTTXNUM 0x06b8
119
120#define RM9000x2_OCD_HTTXCNT 0x06c8
121
122#define RM9000x2_OCD_HTERROR 0x06d8
123#define RM9000x2_OCD_HTRCRCE 0x06dc
124#define RM9000x2_OCD_HTEOI 0x06e0
125
126#define RM9000x2_OCD_CRCR 0x06f0
127
128#define RM9000x2_OCD_HTCFGA 0x06f8
129#define RM9000x2_OCD_HTCFGD 0x06fc
130
131#define RM9000x2_OCD_INTMSG 0x0a00
132
133#define RM9000x2_OCD_INTPIN0 0x0a40
134#define RM9000x2_OCD_INTPIN1 0x0a44
135#define RM9000x2_OCD_INTPIN2 0x0a48
136#define RM9000x2_OCD_INTPIN3 0x0a4c
137#define RM9000x2_OCD_INTPIN4 0x0a50
138#define RM9000x2_OCD_INTPIN5 0x0a54
139#define RM9000x2_OCD_INTPIN6 0x0a58
140#define RM9000x2_OCD_INTPIN7 0x0a5c
141#define RM9000x2_OCD_SEM 0x0a60
142#define RM9000x2_OCD_SEMSET 0x0a64
143#define RM9000x2_OCD_SEMCLR 0x0a68
144
145#define RM9000x2_OCD_TKT 0x0a70
146#define RM9000x2_OCD_TKTINC 0x0a74
147
148#define RM9000x2_OCD_NMICONFIG 0x0ac0 /* Interrupts */
149#define RM9000x2_OCD_INTP0PRI 0x1a80
150#define RM9000x2_OCD_INTP1PRI 0x1a80
151#define RM9000x2_OCD_INTP0STATUS0 0x1b00
152#define RM9000x2_OCD_INTP0MASK0 0x1b04
153#define RM9000x2_OCD_INTP0SET0 0x1b08
154#define RM9000x2_OCD_INTP0CLEAR0 0x1b0c
155#define RM9000x2_OCD_INTP0STATUS1 0x1b10
156#define RM9000x2_OCD_INTP0MASK1 0x1b14
157#define RM9000x2_OCD_INTP0SET1 0x1b18
158#define RM9000x2_OCD_INTP0CLEAR1 0x1b1c
159#define RM9000x2_OCD_INTP0STATUS2 0x1b20
160#define RM9000x2_OCD_INTP0MASK2 0x1b24
161#define RM9000x2_OCD_INTP0SET2 0x1b28
162#define RM9000x2_OCD_INTP0CLEAR2 0x1b2c
163#define RM9000x2_OCD_INTP0STATUS3 0x1b30
164#define RM9000x2_OCD_INTP0MASK3 0x1b34
165#define RM9000x2_OCD_INTP0SET3 0x1b38
166#define RM9000x2_OCD_INTP0CLEAR3 0x1b3c
167#define RM9000x2_OCD_INTP0STATUS4 0x1b40
168#define RM9000x2_OCD_INTP0MASK4 0x1b44
169#define RM9000x2_OCD_INTP0SET4 0x1b48
170#define RM9000x2_OCD_INTP0CLEAR4 0x1b4c
171#define RM9000x2_OCD_INTP0STATUS5 0x1b50
172#define RM9000x2_OCD_INTP0MASK5 0x1b54
173#define RM9000x2_OCD_INTP0SET5 0x1b58
174#define RM9000x2_OCD_INTP0CLEAR5 0x1b5c
175#define RM9000x2_OCD_INTP0STATUS6 0x1b60
176#define RM9000x2_OCD_INTP0MASK6 0x1b64
177#define RM9000x2_OCD_INTP0SET6 0x1b68
178#define RM9000x2_OCD_INTP0CLEAR6 0x1b6c
179#define RM9000x2_OCD_INTP0STATUS7 0x1b70
180#define RM9000x2_OCD_INTP0MASK7 0x1b74
181#define RM9000x2_OCD_INTP0SET7 0x1b78
182#define RM9000x2_OCD_INTP0CLEAR7 0x1b7c
183#define RM9000x2_OCD_INTP1STATUS0 0x2b00
184#define RM9000x2_OCD_INTP1MASK0 0x2b04
185#define RM9000x2_OCD_INTP1SET0 0x2b08
186#define RM9000x2_OCD_INTP1CLEAR0 0x2b0c
187#define RM9000x2_OCD_INTP1STATUS1 0x2b10
188#define RM9000x2_OCD_INTP1MASK1 0x2b14
189#define RM9000x2_OCD_INTP1SET1 0x2b18
190#define RM9000x2_OCD_INTP1CLEAR1 0x2b1c
191#define RM9000x2_OCD_INTP1STATUS2 0x2b20
192#define RM9000x2_OCD_INTP1MASK2 0x2b24
193#define RM9000x2_OCD_INTP1SET2 0x2b28
194#define RM9000x2_OCD_INTP1CLEAR2 0x2b2c
195#define RM9000x2_OCD_INTP1STATUS3 0x2b30
196#define RM9000x2_OCD_INTP1MASK3 0x2b34
197#define RM9000x2_OCD_INTP1SET3 0x2b38
198#define RM9000x2_OCD_INTP1CLEAR3 0x2b3c
199#define RM9000x2_OCD_INTP1STATUS4 0x2b40
200#define RM9000x2_OCD_INTP1MASK4 0x2b44
201#define RM9000x2_OCD_INTP1SET4 0x2b48
202#define RM9000x2_OCD_INTP1CLEAR4 0x2b4c
203#define RM9000x2_OCD_INTP1STATUS5 0x2b50
204#define RM9000x2_OCD_INTP1MASK5 0x2b54
205#define RM9000x2_OCD_INTP1SET5 0x2b58
206#define RM9000x2_OCD_INTP1CLEAR5 0x2b5c
207#define RM9000x2_OCD_INTP1STATUS6 0x2b60
208#define RM9000x2_OCD_INTP1MASK6 0x2b64
209#define RM9000x2_OCD_INTP1SET6 0x2b68
210#define RM9000x2_OCD_INTP1CLEAR6 0x2b6c
211#define RM9000x2_OCD_INTP1STATUS7 0x2b70
212#define RM9000x2_OCD_INTP1MASK7 0x2b74
213#define RM9000x2_OCD_INTP1SET7 0x2b78
214#define RM9000x2_OCD_INTP1CLEAR7 0x2b7c
215
216#define OCD_READ(reg) (*(volatile unsigned int *)(ocd_base + (reg)))
217#define OCD_WRITE(reg, val) \
218 do { *(volatile unsigned int *)(ocd_base + (reg)) = (val); } while (0)
219
220/*
221 * Hypertransport specific macros
222 */
223#define RM9K_WRITE(ofs, data) *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs) = data
224#define RM9K_WRITE_8(ofs, data) *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs) = data
225#define RM9K_WRITE_16(ofs, data) *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs) = data
226
227#define RM9K_READ(ofs, val) *(val) = *(volatile u_int32_t *)(RM9000x2_BASE_ADDR+ofs)
228#define RM9K_READ_8(ofs, val) *(val) = *(volatile u8 *)(RM9000x2_BASE_ADDR+ofs)
229#define RM9K_READ_16(ofs, val) *(val) = *(volatile u16 *)(RM9000x2_BASE_ADDR+ofs)
230
231#endif
diff --git a/include/asm-mips/tlb.h b/include/asm-mips/tlb.h
deleted file mode 100644
index 80d9dfcf1e88..000000000000
--- a/include/asm-mips/tlb.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __ASM_TLB_H
2#define __ASM_TLB_H
3
4/*
5 * MIPS doesn't need any special per-pte or per-vma handling, except
6 * we need to flush cache for area to be unmapped.
7 */
8#define tlb_start_vma(tlb, vma) \
9 do { \
10 if (!tlb->fullmm) \
11 flush_cache_range(vma, vma->vm_start, vma->vm_end); \
12 } while (0)
13#define tlb_end_vma(tlb, vma) do { } while (0)
14#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
15
16/*
17 * .. because we flush the whole mm when it fills up.
18 */
19#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
20
21#include <asm-generic/tlb.h>
22
23#endif /* __ASM_TLB_H */
diff --git a/include/asm-mips/tlbdebug.h b/include/asm-mips/tlbdebug.h
deleted file mode 100644
index bb8f5c29c3d9..000000000000
--- a/include/asm-mips/tlbdebug.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) 2002 by Ralf Baechle
7 */
8#ifndef __ASM_TLBDEBUG_H
9#define __ASM_TLBDEBUG_H
10
11/*
12 * TLB debugging functions:
13 */
14extern void dump_tlb_all(void);
15
16#endif /* __ASM_TLBDEBUG_H */
diff --git a/include/asm-mips/tlbflush.h b/include/asm-mips/tlbflush.h
deleted file mode 100644
index 86b21de12e91..000000000000
--- a/include/asm-mips/tlbflush.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef __ASM_TLBFLUSH_H
2#define __ASM_TLBFLUSH_H
3
4#include <linux/mm.h>
5
6/*
7 * TLB flushing:
8 *
9 * - flush_tlb_all() flushes all processes TLB entries
10 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
11 * - flush_tlb_page(vma, vmaddr) flushes one page
12 * - flush_tlb_range(vma, start, end) flushes a range of pages
13 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
14 */
15extern void local_flush_tlb_all(void);
16extern void local_flush_tlb_mm(struct mm_struct *mm);
17extern void local_flush_tlb_range(struct vm_area_struct *vma,
18 unsigned long start, unsigned long end);
19extern void local_flush_tlb_kernel_range(unsigned long start,
20 unsigned long end);
21extern void local_flush_tlb_page(struct vm_area_struct *vma,
22 unsigned long page);
23extern void local_flush_tlb_one(unsigned long vaddr);
24
25#ifdef CONFIG_SMP
26
27extern void flush_tlb_all(void);
28extern void flush_tlb_mm(struct mm_struct *);
29extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long,
30 unsigned long);
31extern void flush_tlb_kernel_range(unsigned long, unsigned long);
32extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
33extern void flush_tlb_one(unsigned long vaddr);
34
35#else /* CONFIG_SMP */
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_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, end)
40#define flush_tlb_kernel_range(vmaddr,end) \
41 local_flush_tlb_kernel_range(vmaddr, end)
42#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
43#define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr)
44
45#endif /* CONFIG_SMP */
46
47#endif /* __ASM_TLBFLUSH_H */
diff --git a/include/asm-mips/topology.h b/include/asm-mips/topology.h
deleted file mode 100644
index 259145e07e97..000000000000
--- a/include/asm-mips/topology.h
+++ /dev/null
@@ -1,17 +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) 2007 by Ralf Baechle
7 */
8#ifndef __ASM_TOPOLOGY_H
9#define __ASM_TOPOLOGY_H
10
11#include <topology.h>
12
13#ifdef CONFIG_SMP
14#define smt_capable() (smp_num_siblings > 1)
15#endif
16
17#endif /* __ASM_TOPOLOGY_H */
diff --git a/include/asm-mips/traps.h b/include/asm-mips/traps.h
deleted file mode 100644
index 90ff2f497c50..000000000000
--- a/include/asm-mips/traps.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Trap handling definitions.
3 *
4 * Copyright (C) 2002, 2003 Maciej W. Rozycki
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#ifndef _ASM_TRAPS_H
12#define _ASM_TRAPS_H
13
14/*
15 * Possible status responses for a board_be_handler backend.
16 */
17#define MIPS_BE_DISCARD 0 /* return with no action */
18#define MIPS_BE_FIXUP 1 /* return to the fixup code */
19#define MIPS_BE_FATAL 2 /* treat as an unrecoverable error */
20
21extern void (*board_be_init)(void);
22extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
23
24extern void (*board_nmi_handler_setup)(void);
25extern void (*board_ejtag_handler_setup)(void);
26extern void (*board_bind_eic_interrupt)(int irq, int regset);
27
28#endif /* _ASM_TRAPS_H */
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
deleted file mode 100644
index 5b1ccf901c62..000000000000
--- a/include/asm-mips/txx9/generic.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * linux/include/asm-mips/txx9/generic.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#ifndef __ASM_TXX9_GENERIC_H
9#define __ASM_TXX9_GENERIC_H
10
11#include <linux/init.h>
12#include <linux/ioport.h> /* for struct resource */
13
14extern struct resource txx9_ce_res[];
15#define TXX9_CE(n) (unsigned long)(txx9_ce_res[(n)].start)
16extern unsigned int txx9_pcode;
17extern char txx9_pcode_str[8];
18void txx9_reg_res_init(unsigned int pcode, unsigned long base,
19 unsigned long size);
20
21extern unsigned int txx9_master_clock;
22extern unsigned int txx9_cpu_clock;
23extern unsigned int txx9_gbus_clock;
24#define TXX9_IMCLK (txx9_gbus_clock / 2)
25
26extern int txx9_ccfg_toeon;
27struct uart_port;
28int early_serial_txx9_setup(struct uart_port *port);
29
30struct pci_dev;
31struct txx9_board_vec {
32 const char *system;
33 void (*prom_init)(void);
34 void (*mem_setup)(void);
35 void (*irq_setup)(void);
36 void (*time_init)(void);
37 void (*arch_init)(void);
38 void (*device_init)(void);
39#ifdef CONFIG_PCI
40 int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
41#endif
42};
43extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending);
45void prom_init_cmdline(void);
46char *prom_getcmdline(void);
47void txx9_wdt_init(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
50void txx9_sio_init(unsigned long baseaddr, int irq,
51 unsigned int line, unsigned int sclk, int nocts);
52void prom_putchar(char c);
53#ifdef CONFIG_EARLY_PRINTK
54extern void (*txx9_prom_putchar)(char c);
55void txx9_sio_putchar_init(unsigned long baseaddr);
56#else
57static inline void txx9_sio_putchar_init(unsigned long baseaddr)
58{
59}
60#endif
61
62#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/include/asm-mips/txx9/jmr3927.h b/include/asm-mips/txx9/jmr3927.h
deleted file mode 100644
index a409c446bf18..000000000000
--- a/include/asm-mips/txx9/jmr3927.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * Defines for the TJSYS JMR-TX3927
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) 2000-2001 Toshiba Corporation
9 */
10#ifndef __ASM_TXX9_JMR3927_H
11#define __ASM_TXX9_JMR3927_H
12
13#include <asm/txx9/tx3927.h>
14#include <asm/addrspace.h>
15#include <asm/system.h>
16#include <asm/txx9irq.h>
17
18/* CS */
19#define JMR3927_ROMCE0 0x1fc00000 /* 4M */
20#define JMR3927_ROMCE1 0x1e000000 /* 4M */
21#define JMR3927_ROMCE2 0x14000000 /* 16M */
22#define JMR3927_ROMCE3 0x10000000 /* 64M */
23#define JMR3927_ROMCE5 0x1d000000 /* 4M */
24#define JMR3927_SDCS0 0x00000000 /* 32M */
25#define JMR3927_SDCS1 0x02000000 /* 32M */
26/* PCI Direct Mappings */
27
28#define JMR3927_PCIMEM 0x08000000
29#define JMR3927_PCIMEM_SIZE 0x08000000 /* 128M */
30#define JMR3927_PCIIO 0x15000000
31#define JMR3927_PCIIO_SIZE 0x01000000 /* 16M */
32
33#define JMR3927_SDRAM_SIZE 0x02000000 /* 32M */
34#define JMR3927_PORT_BASE KSEG1
35
36/* Address map (virtual address) */
37#define JMR3927_ROM0_BASE (KSEG1 + JMR3927_ROMCE0)
38#define JMR3927_ROM1_BASE (KSEG1 + JMR3927_ROMCE1)
39#define JMR3927_IOC_BASE (KSEG1 + JMR3927_ROMCE2)
40#define JMR3927_PCIMEM_BASE (KSEG1 + JMR3927_PCIMEM)
41#define JMR3927_PCIIO_BASE (KSEG1 + JMR3927_PCIIO)
42
43#define JMR3927_IOC_REV_ADDR (JMR3927_IOC_BASE + 0x00000000)
44#define JMR3927_IOC_NVRAMB_ADDR (JMR3927_IOC_BASE + 0x00010000)
45#define JMR3927_IOC_LED_ADDR (JMR3927_IOC_BASE + 0x00020000)
46#define JMR3927_IOC_DIPSW_ADDR (JMR3927_IOC_BASE + 0x00030000)
47#define JMR3927_IOC_BREV_ADDR (JMR3927_IOC_BASE + 0x00040000)
48#define JMR3927_IOC_DTR_ADDR (JMR3927_IOC_BASE + 0x00050000)
49#define JMR3927_IOC_INTS1_ADDR (JMR3927_IOC_BASE + 0x00080000)
50#define JMR3927_IOC_INTS2_ADDR (JMR3927_IOC_BASE + 0x00090000)
51#define JMR3927_IOC_INTM_ADDR (JMR3927_IOC_BASE + 0x000a0000)
52#define JMR3927_IOC_INTP_ADDR (JMR3927_IOC_BASE + 0x000b0000)
53#define JMR3927_IOC_RESET_ADDR (JMR3927_IOC_BASE + 0x000f0000)
54
55/* Flash ROM */
56#define JMR3927_FLASH_BASE (JMR3927_ROM0_BASE)
57#define JMR3927_FLASH_SIZE 0x00400000
58
59/* bits for IOC_REV/IOC_BREV (high byte) */
60#define JMR3927_IDT_MASK 0xfc
61#define JMR3927_REV_MASK 0x03
62#define JMR3927_IOC_IDT 0xe0
63
64/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
65#define JMR3927_IOC_INTB_PCIA 0
66#define JMR3927_IOC_INTB_PCIB 1
67#define JMR3927_IOC_INTB_PCIC 2
68#define JMR3927_IOC_INTB_PCID 3
69#define JMR3927_IOC_INTB_MODEM 4
70#define JMR3927_IOC_INTB_INT6 5
71#define JMR3927_IOC_INTB_INT7 6
72#define JMR3927_IOC_INTB_SOFT 7
73#define JMR3927_IOC_INTF_PCIA (1 << JMR3927_IOC_INTF_PCIA)
74#define JMR3927_IOC_INTF_PCIB (1 << JMR3927_IOC_INTB_PCIB)
75#define JMR3927_IOC_INTF_PCIC (1 << JMR3927_IOC_INTB_PCIC)
76#define JMR3927_IOC_INTF_PCID (1 << JMR3927_IOC_INTB_PCID)
77#define JMR3927_IOC_INTF_MODEM (1 << JMR3927_IOC_INTB_MODEM)
78#define JMR3927_IOC_INTF_INT6 (1 << JMR3927_IOC_INTB_INT6)
79#define JMR3927_IOC_INTF_INT7 (1 << JMR3927_IOC_INTB_INT7)
80#define JMR3927_IOC_INTF_SOFT (1 << JMR3927_IOC_INTB_SOFT)
81
82/* bits for IOC_RESET (high byte) */
83#define JMR3927_IOC_RESET_CPU 1
84#define JMR3927_IOC_RESET_PCI 2
85
86#if defined(__BIG_ENDIAN)
87#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)(a)) = (d))
88#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)(a))
89#elif defined(__LITTLE_ENDIAN)
90#define jmr3927_ioc_reg_out(d, a) ((*(volatile unsigned char *)((a)^1)) = (d))
91#define jmr3927_ioc_reg_in(a) (*(volatile unsigned char *)((a)^1))
92#else
93#error "No Endian"
94#endif
95
96/* LED macro */
97#define jmr3927_led_set(n/*0-16*/) jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
98
99#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)
100
101/* DIPSW4 macro */
102#define jmr3927_dipsw1() (gpio_get_value(11) == 0)
103#define jmr3927_dipsw2() (gpio_get_value(10) == 0)
104#define jmr3927_dipsw3() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
105#define jmr3927_dipsw4() ((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
106
107/*
108 * IRQ mappings
109 */
110
111/* These are the virtual IRQ numbers, we divide all IRQ's into
112 * 'spaces', the 'space' determines where and how to enable/disable
113 * that particular IRQ on an JMR machine. Add new 'spaces' as new
114 * IRQ hardware is supported.
115 */
116#define JMR3927_NR_IRQ_IRC 16 /* On-Chip IRC */
117#define JMR3927_NR_IRQ_IOC 8 /* PCI/MODEM/INT[6:7] */
118
119#define JMR3927_IRQ_IRC TXX9_IRQ_BASE
120#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
121#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
122
123#define JMR3927_IRQ_IRC_INT0 (JMR3927_IRQ_IRC + TX3927_IR_INT0)
124#define JMR3927_IRQ_IRC_INT1 (JMR3927_IRQ_IRC + TX3927_IR_INT1)
125#define JMR3927_IRQ_IRC_INT2 (JMR3927_IRQ_IRC + TX3927_IR_INT2)
126#define JMR3927_IRQ_IRC_INT3 (JMR3927_IRQ_IRC + TX3927_IR_INT3)
127#define JMR3927_IRQ_IRC_INT4 (JMR3927_IRQ_IRC + TX3927_IR_INT4)
128#define JMR3927_IRQ_IRC_INT5 (JMR3927_IRQ_IRC + TX3927_IR_INT5)
129#define JMR3927_IRQ_IRC_SIO0 (JMR3927_IRQ_IRC + TX3927_IR_SIO0)
130#define JMR3927_IRQ_IRC_SIO1 (JMR3927_IRQ_IRC + TX3927_IR_SIO1)
131#define JMR3927_IRQ_IRC_SIO(ch) (JMR3927_IRQ_IRC + TX3927_IR_SIO(ch))
132#define JMR3927_IRQ_IRC_DMA (JMR3927_IRQ_IRC + TX3927_IR_DMA)
133#define JMR3927_IRQ_IRC_PIO (JMR3927_IRQ_IRC + TX3927_IR_PIO)
134#define JMR3927_IRQ_IRC_PCI (JMR3927_IRQ_IRC + TX3927_IR_PCI)
135#define JMR3927_IRQ_IRC_TMR(ch) (JMR3927_IRQ_IRC + TX3927_IR_TMR(ch))
136#define JMR3927_IRQ_IOC_PCIA (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA)
137#define JMR3927_IRQ_IOC_PCIB (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB)
138#define JMR3927_IRQ_IOC_PCIC (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC)
139#define JMR3927_IRQ_IOC_PCID (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCID)
140#define JMR3927_IRQ_IOC_MODEM (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_MODEM)
141#define JMR3927_IRQ_IOC_INT6 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
142#define JMR3927_IRQ_IOC_INT7 (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
143#define JMR3927_IRQ_IOC_SOFT (JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
144
145/* IOC (PCI, MODEM) */
146#define JMR3927_IRQ_IOCINT JMR3927_IRQ_IRC_INT1
147/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
148#define JMR3927_IRQ_ETHER0 JMR3927_IRQ_IRC_INT3
149
150/* Clocks */
151#define JMR3927_CORECLK 132710400 /* 132.7MHz */
152
153/*
154 * TX3927 Pin Configuration:
155 *
156 * PCFG bits Avail Dead
157 * SELSIO[1:0]:11 RXD[1:0], TXD[1:0] PIO[6:3]
158 * SELSIOC[0]:1 CTS[0], RTS[0] INT[5:4]
159 * SELSIOC[1]:0,SELDSF:0, GSDAO[0],GPCST[3] CTS[1], RTS[1],DSF,
160 * GDBGE* PIO[2:1]
161 * SELDMA[2]:1 DMAREQ[2],DMAACK[2] PIO[13:12]
162 * SELTMR[2:0]:000 TIMER[1:0]
163 * SELCS:0,SELDMA[1]:0 PIO[11;10] SDCS_CE[7:6],
164 * DMAREQ[1],DMAACK[1]
165 * SELDMA[0]:1 DMAREQ[0],DMAACK[0] PIO[9:8]
166 * SELDMA[3]:1 DMAREQ[3],DMAACK[3] PIO[15:14]
167 * SELDONE:1 DMADONE PIO[7]
168 *
169 * Usable pins are:
170 * RXD[1;0],TXD[1:0],CTS[0],RTS[0],
171 * DMAREQ[0,2,3],DMAACK[0,2,3],DMADONE,PIO[0,10,11]
172 * INT[3:0]
173 */
174
175void jmr3927_prom_init(void);
176void jmr3927_irq_setup(void);
177struct pci_dev;
178int jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
179
180#endif /* __ASM_TXX9_JMR3927_H */
diff --git a/include/asm-mips/txx9/pci.h b/include/asm-mips/txx9/pci.h
deleted file mode 100644
index 3d32529060aa..000000000000
--- a/include/asm-mips/txx9/pci.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#ifndef __ASM_TXX9_PCI_H
7#define __ASM_TXX9_PCI_H
8
9#include <linux/pci.h>
10
11extern struct pci_controller txx9_primary_pcic;
12struct pci_controller *
13txx9_alloc_pci_controller(struct pci_controller *pcic,
14 unsigned long mem_base, unsigned long mem_size,
15 unsigned long io_base, unsigned long io_size);
16
17int txx9_pci66_check(struct pci_controller *hose, int top_bus,
18 int current_bus);
19extern int txx9_pci_mem_high __initdata;
20
21extern int txx9_pci_option;
22#define TXX9_PCI_OPT_PICMG 0x0002
23#define TXX9_PCI_OPT_CLK_33 0x0008
24#define TXX9_PCI_OPT_CLK_66 0x0010
25#define TXX9_PCI_OPT_CLK_MASK \
26 (TXX9_PCI_OPT_CLK_33 | TXX9_PCI_OPT_CLK_66)
27#define TXX9_PCI_OPT_CLK_AUTO TXX9_PCI_OPT_CLK_MASK
28
29enum txx9_pci_err_action {
30 TXX9_PCI_ERR_REPORT,
31 TXX9_PCI_ERR_IGNORE,
32 TXX9_PCI_ERR_PANIC,
33};
34extern enum txx9_pci_err_action txx9_pci_err_action;
35
36extern char * (*txx9_board_pcibios_setup)(char *str);
37char *txx9_pcibios_setup(char *str);
38
39#endif /* __ASM_TXX9_PCI_H */
diff --git a/include/asm-mips/txx9/rbtx4927.h b/include/asm-mips/txx9/rbtx4927.h
deleted file mode 100644
index 6fcec912c143..000000000000
--- a/include/asm-mips/txx9/rbtx4927.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2002 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#ifndef __ASM_TXX9_RBTX4927_H
28#define __ASM_TXX9_RBTX4927_H
29
30#include <asm/txx9/tx4927.h>
31
32#define RBTX4927_PCIMEM 0x08000000
33#define RBTX4927_PCIMEM_SIZE 0x08000000
34#define RBTX4927_PCIIO 0x16000000
35#define RBTX4927_PCIIO_SIZE 0x01000000
36
37#define RBTX4927_IMASK_ADDR (IO_BASE + TXX9_CE(2) + 0x00002000)
38#define RBTX4927_IMSTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x00002006)
39#define RBTX4927_SOFTRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f000)
40#define RBTX4927_SOFTRESETLOCK_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f002)
41#define RBTX4927_PCIRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x0000f006)
42#define RBTX4927_BRAMRTC_BASE (IO_BASE + TXX9_CE(2) + 0x00010000)
43#define RBTX4927_ETHER_BASE (IO_BASE + TXX9_CE(2) + 0x00020000)
44
45/* Ethernet port address */
46#define RBTX4927_ETHER_ADDR (RBTX4927_ETHER_BASE + 0x280)
47
48#define rbtx4927_imask_addr ((__u8 __iomem *)RBTX4927_IMASK_ADDR)
49#define rbtx4927_imstat_addr ((__u8 __iomem *)RBTX4927_IMSTAT_ADDR)
50#define rbtx4927_softreset_addr ((__u8 __iomem *)RBTX4927_SOFTRESET_ADDR)
51#define rbtx4927_softresetlock_addr \
52 ((__u8 __iomem *)RBTX4927_SOFTRESETLOCK_ADDR)
53#define rbtx4927_pcireset_addr ((__u8 __iomem *)RBTX4927_PCIRESET_ADDR)
54
55/* bits for ISTAT/IMASK/IMSTAT */
56#define RBTX4927_INTB_PCID 0
57#define RBTX4927_INTB_PCIC 1
58#define RBTX4927_INTB_PCIB 2
59#define RBTX4927_INTB_PCIA 3
60#define RBTX4927_INTF_PCID (1 << RBTX4927_INTB_PCID)
61#define RBTX4927_INTF_PCIC (1 << RBTX4927_INTB_PCIC)
62#define RBTX4927_INTF_PCIB (1 << RBTX4927_INTB_PCIB)
63#define RBTX4927_INTF_PCIA (1 << RBTX4927_INTB_PCIA)
64
65#define RBTX4927_NR_IRQ_IOC 8 /* IOC */
66
67#define RBTX4927_IRQ_IOC (TXX9_IRQ_BASE + TX4927_NUM_IR)
68#define RBTX4927_IRQ_IOC_PCID (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCID)
69#define RBTX4927_IRQ_IOC_PCIC (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIC)
70#define RBTX4927_IRQ_IOC_PCIB (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIB)
71#define RBTX4927_IRQ_IOC_PCIA (RBTX4927_IRQ_IOC + RBTX4927_INTB_PCIA)
72
73#define RBTX4927_IRQ_IOCINT (TXX9_IRQ_BASE + TX4927_IR_INT(1))
74
75#ifdef CONFIG_PCI
76#define RBTX4927_ISA_IO_OFFSET RBTX4927_PCIIO
77#else
78#define RBTX4927_ISA_IO_OFFSET 0
79#endif
80
81#define RBTX4927_RTL_8019_BASE (RBTX4927_ETHER_ADDR - mips_io_port_base)
82#define RBTX4927_RTL_8019_IRQ (TXX9_IRQ_BASE + TX4927_IR_INT(3))
83
84void rbtx4927_prom_init(void);
85void rbtx4927_irq_setup(void);
86struct pci_dev;
87int rbtx4927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
88
89#endif /* __ASM_TXX9_RBTX4927_H */
diff --git a/include/asm-mips/txx9/rbtx4938.h b/include/asm-mips/txx9/rbtx4938.h
deleted file mode 100644
index 9f0441a28126..000000000000
--- a/include/asm-mips/txx9/rbtx4938.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 * Definitions for TX4937/TX4938
3 *
4 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
5 * terms of the GNU General Public License version 2. This program is
6 * licensed "as is" without any warranty of any kind, whether express
7 * or implied.
8 *
9 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
10 */
11#ifndef __ASM_TXX9_RBTX4938_H
12#define __ASM_TXX9_RBTX4938_H
13
14#include <asm/addrspace.h>
15#include <asm/txx9irq.h>
16#include <asm/txx9/tx4938.h>
17
18/* Address map */
19#define RBTX4938_FPGA_REG_ADDR (IO_BASE + TXX9_CE(2) + 0x00000000)
20#define RBTX4938_FPGA_REV_ADDR (IO_BASE + TXX9_CE(2) + 0x00000002)
21#define RBTX4938_CONFIG1_ADDR (IO_BASE + TXX9_CE(2) + 0x00000004)
22#define RBTX4938_CONFIG2_ADDR (IO_BASE + TXX9_CE(2) + 0x00000006)
23#define RBTX4938_CONFIG3_ADDR (IO_BASE + TXX9_CE(2) + 0x00000008)
24#define RBTX4938_LED_ADDR (IO_BASE + TXX9_CE(2) + 0x00001000)
25#define RBTX4938_DIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001002)
26#define RBTX4938_BDIPSW_ADDR (IO_BASE + TXX9_CE(2) + 0x00001004)
27#define RBTX4938_IMASK_ADDR (IO_BASE + TXX9_CE(2) + 0x00002000)
28#define RBTX4938_IMASK2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002002)
29#define RBTX4938_INTPOL_ADDR (IO_BASE + TXX9_CE(2) + 0x00002004)
30#define RBTX4938_ISTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x00002006)
31#define RBTX4938_ISTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x00002008)
32#define RBTX4938_IMSTAT_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200a)
33#define RBTX4938_IMSTAT2_ADDR (IO_BASE + TXX9_CE(2) + 0x0000200c)
34#define RBTX4938_SOFTINT_ADDR (IO_BASE + TXX9_CE(2) + 0x00003000)
35#define RBTX4938_PIOSEL_ADDR (IO_BASE + TXX9_CE(2) + 0x00005000)
36#define RBTX4938_SPICS_ADDR (IO_BASE + TXX9_CE(2) + 0x00005002)
37#define RBTX4938_SFPWR_ADDR (IO_BASE + TXX9_CE(2) + 0x00005008)
38#define RBTX4938_SFVOL_ADDR (IO_BASE + TXX9_CE(2) + 0x0000500a)
39#define RBTX4938_SOFTRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007000)
40#define RBTX4938_SOFTRESETLOCK_ADDR (IO_BASE + TXX9_CE(2) + 0x00007002)
41#define RBTX4938_PCIRESET_ADDR (IO_BASE + TXX9_CE(2) + 0x00007004)
42#define RBTX4938_ETHER_BASE (IO_BASE + TXX9_CE(2) + 0x00020000)
43
44/* Ethernet port address (Jumperless Mode (W12:Open)) */
45#define RBTX4938_ETHER_ADDR (RBTX4938_ETHER_BASE + 0x280)
46
47/* bits for ISTAT/IMASK/IMSTAT */
48#define RBTX4938_INTB_PCID 0
49#define RBTX4938_INTB_PCIC 1
50#define RBTX4938_INTB_PCIB 2
51#define RBTX4938_INTB_PCIA 3
52#define RBTX4938_INTB_RTC 4
53#define RBTX4938_INTB_ATA 5
54#define RBTX4938_INTB_MODEM 6
55#define RBTX4938_INTB_SWINT 7
56#define RBTX4938_INTF_PCID (1 << RBTX4938_INTB_PCID)
57#define RBTX4938_INTF_PCIC (1 << RBTX4938_INTB_PCIC)
58#define RBTX4938_INTF_PCIB (1 << RBTX4938_INTB_PCIB)
59#define RBTX4938_INTF_PCIA (1 << RBTX4938_INTB_PCIA)
60#define RBTX4938_INTF_RTC (1 << RBTX4938_INTB_RTC)
61#define RBTX4938_INTF_ATA (1 << RBTX4938_INTB_ATA)
62#define RBTX4938_INTF_MODEM (1 << RBTX4938_INTB_MODEM)
63#define RBTX4938_INTF_SWINT (1 << RBTX4938_INTB_SWINT)
64
65#define rbtx4938_fpga_rev_addr ((__u8 __iomem *)RBTX4938_FPGA_REV_ADDR)
66#define rbtx4938_led_addr ((__u8 __iomem *)RBTX4938_LED_ADDR)
67#define rbtx4938_dipsw_addr ((__u8 __iomem *)RBTX4938_DIPSW_ADDR)
68#define rbtx4938_bdipsw_addr ((__u8 __iomem *)RBTX4938_BDIPSW_ADDR)
69#define rbtx4938_imask_addr ((__u8 __iomem *)RBTX4938_IMASK_ADDR)
70#define rbtx4938_imask2_addr ((__u8 __iomem *)RBTX4938_IMASK2_ADDR)
71#define rbtx4938_intpol_addr ((__u8 __iomem *)RBTX4938_INTPOL_ADDR)
72#define rbtx4938_istat_addr ((__u8 __iomem *)RBTX4938_ISTAT_ADDR)
73#define rbtx4938_istat2_addr ((__u8 __iomem *)RBTX4938_ISTAT2_ADDR)
74#define rbtx4938_imstat_addr ((__u8 __iomem *)RBTX4938_IMSTAT_ADDR)
75#define rbtx4938_imstat2_addr ((__u8 __iomem *)RBTX4938_IMSTAT2_ADDR)
76#define rbtx4938_softint_addr ((__u8 __iomem *)RBTX4938_SOFTINT_ADDR)
77#define rbtx4938_piosel_addr ((__u8 __iomem *)RBTX4938_PIOSEL_ADDR)
78#define rbtx4938_spics_addr ((__u8 __iomem *)RBTX4938_SPICS_ADDR)
79#define rbtx4938_sfpwr_addr ((__u8 __iomem *)RBTX4938_SFPWR_ADDR)
80#define rbtx4938_sfvol_addr ((__u8 __iomem *)RBTX4938_SFVOL_ADDR)
81#define rbtx4938_softreset_addr ((__u8 __iomem *)RBTX4938_SOFTRESET_ADDR)
82#define rbtx4938_softresetlock_addr \
83 ((__u8 __iomem *)RBTX4938_SOFTRESETLOCK_ADDR)
84#define rbtx4938_pcireset_addr ((__u8 __iomem *)RBTX4938_PCIRESET_ADDR)
85
86/*
87 * IRQ mappings
88 */
89
90#define RBTX4938_SOFT_INT0 0 /* not used */
91#define RBTX4938_SOFT_INT1 1 /* not used */
92#define RBTX4938_IRC_INT 2
93#define RBTX4938_TIMER_INT 7
94
95/* These are the virtual IRQ numbers, we divide all IRQ's into
96 * 'spaces', the 'space' determines where and how to enable/disable
97 * that particular IRQ on an RBTX4938 machine. Add new 'spaces' as new
98 * IRQ hardware is supported.
99 */
100#define RBTX4938_NR_IRQ_IOC 8
101
102#define RBTX4938_IRQ_IRC TXX9_IRQ_BASE
103#define RBTX4938_IRQ_IOC (TXX9_IRQ_BASE + TX4938_NUM_IR)
104#define RBTX4938_IRQ_END (RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC)
105
106#define RBTX4938_IRQ_IRC_ECCERR (RBTX4938_IRQ_IRC + TX4938_IR_ECCERR)
107#define RBTX4938_IRQ_IRC_WTOERR (RBTX4938_IRQ_IRC + TX4938_IR_WTOERR)
108#define RBTX4938_IRQ_IRC_INT(n) (RBTX4938_IRQ_IRC + TX4938_IR_INT(n))
109#define RBTX4938_IRQ_IRC_SIO(n) (RBTX4938_IRQ_IRC + TX4938_IR_SIO(n))
110#define RBTX4938_IRQ_IRC_DMA(ch, n) (RBTX4938_IRQ_IRC + TX4938_IR_DMA(ch, n))
111#define RBTX4938_IRQ_IRC_PIO (RBTX4938_IRQ_IRC + TX4938_IR_PIO)
112#define RBTX4938_IRQ_IRC_PDMAC (RBTX4938_IRQ_IRC + TX4938_IR_PDMAC)
113#define RBTX4938_IRQ_IRC_PCIC (RBTX4938_IRQ_IRC + TX4938_IR_PCIC)
114#define RBTX4938_IRQ_IRC_TMR(n) (RBTX4938_IRQ_IRC + TX4938_IR_TMR(n))
115#define RBTX4938_IRQ_IRC_NDFMC (RBTX4938_IRQ_IRC + TX4938_IR_NDFMC)
116#define RBTX4938_IRQ_IRC_PCIERR (RBTX4938_IRQ_IRC + TX4938_IR_PCIERR)
117#define RBTX4938_IRQ_IRC_PCIPME (RBTX4938_IRQ_IRC + TX4938_IR_PCIPME)
118#define RBTX4938_IRQ_IRC_ACLC (RBTX4938_IRQ_IRC + TX4938_IR_ACLC)
119#define RBTX4938_IRQ_IRC_ACLCPME (RBTX4938_IRQ_IRC + TX4938_IR_ACLCPME)
120#define RBTX4938_IRQ_IRC_PCIC1 (RBTX4938_IRQ_IRC + TX4938_IR_PCIC1)
121#define RBTX4938_IRQ_IRC_SPI (RBTX4938_IRQ_IRC + TX4938_IR_SPI)
122#define RBTX4938_IRQ_IOC_PCID (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCID)
123#define RBTX4938_IRQ_IOC_PCIC (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIC)
124#define RBTX4938_IRQ_IOC_PCIB (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIB)
125#define RBTX4938_IRQ_IOC_PCIA (RBTX4938_IRQ_IOC + RBTX4938_INTB_PCIA)
126#define RBTX4938_IRQ_IOC_RTC (RBTX4938_IRQ_IOC + RBTX4938_INTB_RTC)
127#define RBTX4938_IRQ_IOC_ATA (RBTX4938_IRQ_IOC + RBTX4938_INTB_ATA)
128#define RBTX4938_IRQ_IOC_MODEM (RBTX4938_IRQ_IOC + RBTX4938_INTB_MODEM)
129#define RBTX4938_IRQ_IOC_SWINT (RBTX4938_IRQ_IOC + RBTX4938_INTB_SWINT)
130
131
132/* IOC (PCI, etc) */
133#define RBTX4938_IRQ_IOCINT (TXX9_IRQ_BASE + TX4938_IR_INT(0))
134/* Onboard 10M Ether */
135#define RBTX4938_IRQ_ETHER (TXX9_IRQ_BASE + TX4938_IR_INT(1))
136
137#define RBTX4938_RTL_8019_BASE (RBTX4938_ETHER_ADDR - mips_io_port_base)
138#define RBTX4938_RTL_8019_IRQ (RBTX4938_IRQ_ETHER)
139
140void rbtx4938_prom_init(void);
141void rbtx4938_irq_setup(void);
142struct pci_dev;
143int rbtx4938_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
144
145#endif /* __ASM_TXX9_RBTX4938_H */
diff --git a/include/asm-mips/txx9/smsc_fdc37m81x.h b/include/asm-mips/txx9/smsc_fdc37m81x.h
deleted file mode 100644
index 02e161d0755d..000000000000
--- a/include/asm-mips/txx9/smsc_fdc37m81x.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * Interface for smsc fdc48m81x Super IO chip
3 *
4 * Author: MontaVista Software, Inc. source@mvista.com
5 *
6 * 2001-2003 (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 * Copyright (C) 2004 MontaVista Software Inc.
12 * Manish Lachwani, mlachwani@mvista.com
13 */
14
15#ifndef _SMSC_FDC37M81X_H_
16#define _SMSC_FDC37M81X_H_
17
18/* Common Registers */
19#define SMSC_FDC37M81X_CONFIG_INDEX 0x00
20#define SMSC_FDC37M81X_CONFIG_DATA 0x01
21#define SMSC_FDC37M81X_CONF 0x02
22#define SMSC_FDC37M81X_INDEX 0x03
23#define SMSC_FDC37M81X_DNUM 0x07
24#define SMSC_FDC37M81X_DID 0x20
25#define SMSC_FDC37M81X_DREV 0x21
26#define SMSC_FDC37M81X_PCNT 0x22
27#define SMSC_FDC37M81X_PMGT 0x23
28#define SMSC_FDC37M81X_OSC 0x24
29#define SMSC_FDC37M81X_CONFPA0 0x26
30#define SMSC_FDC37M81X_CONFPA1 0x27
31#define SMSC_FDC37M81X_TEST4 0x2B
32#define SMSC_FDC37M81X_TEST5 0x2C
33#define SMSC_FDC37M81X_TEST1 0x2D
34#define SMSC_FDC37M81X_TEST2 0x2E
35#define SMSC_FDC37M81X_TEST3 0x2F
36
37/* Logical device numbers */
38#define SMSC_FDC37M81X_FDD 0x00
39#define SMSC_FDC37M81X_PARALLEL 0x03
40#define SMSC_FDC37M81X_SERIAL1 0x04
41#define SMSC_FDC37M81X_SERIAL2 0x05
42#define SMSC_FDC37M81X_KBD 0x07
43#define SMSC_FDC37M81X_AUXIO 0x08
44#define SMSC_FDC37M81X_NONE 0xff
45
46/* Logical device Config Registers */
47#define SMSC_FDC37M81X_ACTIVE 0x30
48#define SMSC_FDC37M81X_BASEADDR0 0x60
49#define SMSC_FDC37M81X_BASEADDR1 0x61
50#define SMSC_FDC37M81X_INT 0x70
51#define SMSC_FDC37M81X_INT2 0x72
52#define SMSC_FDC37M81X_LDCR_F0 0xF0
53
54/* Chip Config Values */
55#define SMSC_FDC37M81X_CONFIG_ENTER 0x55
56#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa
57#define SMSC_FDC37M81X_CHIP_ID 0x4d
58
59unsigned long smsc_fdc37m81x_init(unsigned long port);
60
61void smsc_fdc37m81x_config_beg(void);
62
63void smsc_fdc37m81x_config_end(void);
64
65void smsc_fdc37m81x_config_set(u8 reg, u8 val);
66
67#endif
diff --git a/include/asm-mips/txx9/spi.h b/include/asm-mips/txx9/spi.h
deleted file mode 100644
index ddfb2a0dc432..000000000000
--- a/include/asm-mips/txx9/spi.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Definitions for TX4937/TX4938 SPI
3 *
4 * Copyright (C) 2000-2001 Toshiba Corporation
5 *
6 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
7 * terms of the GNU General Public License version 2. This program is
8 * licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
12 */
13#ifndef __ASM_TXX9_SPI_H
14#define __ASM_TXX9_SPI_H
15
16extern int spi_eeprom_register(int chipid);
17extern int spi_eeprom_read(int chipid, int address, unsigned char *buf, int len);
18
19#endif /* __ASM_TXX9_SPI_H */
diff --git a/include/asm-mips/txx9/tx3927.h b/include/asm-mips/txx9/tx3927.h
deleted file mode 100644
index 587deb9592d2..000000000000
--- a/include/asm-mips/txx9/tx3927.h
+++ /dev/null
@@ -1,339 +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) 2000 Toshiba Corporation
7 */
8#ifndef __ASM_TXX9_TX3927_H
9#define __ASM_TXX9_TX3927_H
10
11#define TX3927_REG_BASE 0xfffe0000UL
12#define TX3927_REG_SIZE 0x00010000
13#define TX3927_SDRAMC_REG (TX3927_REG_BASE + 0x8000)
14#define TX3927_ROMC_REG (TX3927_REG_BASE + 0x9000)
15#define TX3927_DMA_REG (TX3927_REG_BASE + 0xb000)
16#define TX3927_IRC_REG (TX3927_REG_BASE + 0xc000)
17#define TX3927_PCIC_REG (TX3927_REG_BASE + 0xd000)
18#define TX3927_CCFG_REG (TX3927_REG_BASE + 0xe000)
19#define TX3927_NR_TMR 3
20#define TX3927_TMR_REG(ch) (TX3927_REG_BASE + 0xf000 + (ch) * 0x100)
21#define TX3927_NR_SIO 2
22#define TX3927_SIO_REG(ch) (TX3927_REG_BASE + 0xf300 + (ch) * 0x100)
23#define TX3927_PIO_REG (TX3927_REG_BASE + 0xf500)
24
25struct tx3927_sdramc_reg {
26 volatile unsigned long cr[8];
27 volatile unsigned long tr[3];
28 volatile unsigned long cmd;
29 volatile unsigned long smrs[2];
30};
31
32struct tx3927_romc_reg {
33 volatile unsigned long cr[8];
34};
35
36struct tx3927_dma_reg {
37 struct tx3927_dma_ch_reg {
38 volatile unsigned long cha;
39 volatile unsigned long sar;
40 volatile unsigned long dar;
41 volatile unsigned long cntr;
42 volatile unsigned long sair;
43 volatile unsigned long dair;
44 volatile unsigned long ccr;
45 volatile unsigned long csr;
46 } ch[4];
47 volatile unsigned long dbr[8];
48 volatile unsigned long tdhr;
49 volatile unsigned long mcr;
50 volatile unsigned long unused0;
51};
52
53#include <asm/byteorder.h>
54
55#ifdef __BIG_ENDIAN
56#define endian_def_s2(e1, e2) \
57 volatile unsigned short e1, e2
58#define endian_def_sb2(e1, e2, e3) \
59 volatile unsigned short e1;volatile unsigned char e2, e3
60#define endian_def_b2s(e1, e2, e3) \
61 volatile unsigned char e1, e2;volatile unsigned short e3
62#define endian_def_b4(e1, e2, e3, e4) \
63 volatile unsigned char e1, e2, e3, e4
64#else
65#define endian_def_s2(e1, e2) \
66 volatile unsigned short e2, e1
67#define endian_def_sb2(e1, e2, e3) \
68 volatile unsigned char e3, e2;volatile unsigned short e1
69#define endian_def_b2s(e1, e2, e3) \
70 volatile unsigned short e3;volatile unsigned char e2, e1
71#define endian_def_b4(e1, e2, e3, e4) \
72 volatile unsigned char e4, e3, e2, e1
73#endif
74
75struct tx3927_pcic_reg {
76 endian_def_s2(did, vid);
77 endian_def_s2(pcistat, pcicmd);
78 endian_def_b4(cc, scc, rpli, rid);
79 endian_def_b4(unused0, ht, mlt, cls);
80 volatile unsigned long ioba; /* +10 */
81 volatile unsigned long mba;
82 volatile unsigned long unused1[5];
83 endian_def_s2(svid, ssvid);
84 volatile unsigned long unused2; /* +30 */
85 endian_def_sb2(unused3, unused4, capptr);
86 volatile unsigned long unused5;
87 endian_def_b4(ml, mg, ip, il);
88 volatile unsigned long unused6; /* +40 */
89 volatile unsigned long istat;
90 volatile unsigned long iim;
91 volatile unsigned long rrt;
92 volatile unsigned long unused7[3]; /* +50 */
93 volatile unsigned long ipbmma;
94 volatile unsigned long ipbioma; /* +60 */
95 volatile unsigned long ilbmma;
96 volatile unsigned long ilbioma;
97 volatile unsigned long unused8[9];
98 volatile unsigned long tc; /* +90 */
99 volatile unsigned long tstat;
100 volatile unsigned long tim;
101 volatile unsigned long tccmd;
102 volatile unsigned long pcirrt; /* +a0 */
103 volatile unsigned long pcirrt_cmd;
104 volatile unsigned long pcirrdt;
105 volatile unsigned long unused9[3];
106 volatile unsigned long tlboap;
107 volatile unsigned long tlbiap;
108 volatile unsigned long tlbmma; /* +c0 */
109 volatile unsigned long tlbioma;
110 volatile unsigned long sc_msg;
111 volatile unsigned long sc_be;
112 volatile unsigned long tbl; /* +d0 */
113 volatile unsigned long unused10[3];
114 volatile unsigned long pwmng; /* +e0 */
115 volatile unsigned long pwmngs;
116 volatile unsigned long unused11[6];
117 volatile unsigned long req_trace; /* +100 */
118 volatile unsigned long pbapmc;
119 volatile unsigned long pbapms;
120 volatile unsigned long pbapmim;
121 volatile unsigned long bm; /* +110 */
122 volatile unsigned long cpcibrs;
123 volatile unsigned long cpcibgs;
124 volatile unsigned long pbacs;
125 volatile unsigned long iobas; /* +120 */
126 volatile unsigned long mbas;
127 volatile unsigned long lbc;
128 volatile unsigned long lbstat;
129 volatile unsigned long lbim; /* +130 */
130 volatile unsigned long pcistatim;
131 volatile unsigned long ica;
132 volatile unsigned long icd;
133 volatile unsigned long iiadp; /* +140 */
134 volatile unsigned long iscdp;
135 volatile unsigned long mmas;
136 volatile unsigned long iomas;
137 volatile unsigned long ipciaddr; /* +150 */
138 volatile unsigned long ipcidata;
139 volatile unsigned long ipcibe;
140};
141
142struct tx3927_ccfg_reg {
143 volatile unsigned long ccfg;
144 volatile unsigned long crir;
145 volatile unsigned long pcfg;
146 volatile unsigned long tear;
147 volatile unsigned long pdcr;
148};
149
150/*
151 * SDRAMC
152 */
153
154/*
155 * ROMC
156 */
157
158/*
159 * DMA
160 */
161/* bits for MCR */
162#define TX3927_DMA_MCR_EIS(ch) (0x10000000<<(ch))
163#define TX3927_DMA_MCR_DIS(ch) (0x01000000<<(ch))
164#define TX3927_DMA_MCR_RSFIF 0x00000080
165#define TX3927_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
166#define TX3927_DMA_MCR_LE 0x00000004
167#define TX3927_DMA_MCR_RPRT 0x00000002
168#define TX3927_DMA_MCR_MSTEN 0x00000001
169
170/* bits for CCRn */
171#define TX3927_DMA_CCR_DBINH 0x04000000
172#define TX3927_DMA_CCR_SBINH 0x02000000
173#define TX3927_DMA_CCR_CHRST 0x01000000
174#define TX3927_DMA_CCR_RVBYTE 0x00800000
175#define TX3927_DMA_CCR_ACKPOL 0x00400000
176#define TX3927_DMA_CCR_REQPL 0x00200000
177#define TX3927_DMA_CCR_EGREQ 0x00100000
178#define TX3927_DMA_CCR_CHDN 0x00080000
179#define TX3927_DMA_CCR_DNCTL 0x00060000
180#define TX3927_DMA_CCR_EXTRQ 0x00010000
181#define TX3927_DMA_CCR_INTRQD 0x0000e000
182#define TX3927_DMA_CCR_INTENE 0x00001000
183#define TX3927_DMA_CCR_INTENC 0x00000800
184#define TX3927_DMA_CCR_INTENT 0x00000400
185#define TX3927_DMA_CCR_CHNEN 0x00000200
186#define TX3927_DMA_CCR_XFACT 0x00000100
187#define TX3927_DMA_CCR_SNOP 0x00000080
188#define TX3927_DMA_CCR_DSTINC 0x00000040
189#define TX3927_DMA_CCR_SRCINC 0x00000020
190#define TX3927_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
191#define TX3927_DMA_CCR_XFSZ_1W TX3927_DMA_CCR_XFSZ(2)
192#define TX3927_DMA_CCR_XFSZ_4W TX3927_DMA_CCR_XFSZ(4)
193#define TX3927_DMA_CCR_XFSZ_8W TX3927_DMA_CCR_XFSZ(5)
194#define TX3927_DMA_CCR_XFSZ_16W TX3927_DMA_CCR_XFSZ(6)
195#define TX3927_DMA_CCR_XFSZ_32W TX3927_DMA_CCR_XFSZ(7)
196#define TX3927_DMA_CCR_MEMIO 0x00000002
197#define TX3927_DMA_CCR_ONEAD 0x00000001
198
199/* bits for CSRn */
200#define TX3927_DMA_CSR_CHNACT 0x00000100
201#define TX3927_DMA_CSR_ABCHC 0x00000080
202#define TX3927_DMA_CSR_NCHNC 0x00000040
203#define TX3927_DMA_CSR_NTRNFC 0x00000020
204#define TX3927_DMA_CSR_EXTDN 0x00000010
205#define TX3927_DMA_CSR_CFERR 0x00000008
206#define TX3927_DMA_CSR_CHERR 0x00000004
207#define TX3927_DMA_CSR_DESERR 0x00000002
208#define TX3927_DMA_CSR_SORERR 0x00000001
209
210/*
211 * IRC
212 */
213#define TX3927_IR_INT0 0
214#define TX3927_IR_INT1 1
215#define TX3927_IR_INT2 2
216#define TX3927_IR_INT3 3
217#define TX3927_IR_INT4 4
218#define TX3927_IR_INT5 5
219#define TX3927_IR_SIO0 6
220#define TX3927_IR_SIO1 7
221#define TX3927_IR_SIO(ch) (6 + (ch))
222#define TX3927_IR_DMA 8
223#define TX3927_IR_PIO 9
224#define TX3927_IR_PCI 10
225#define TX3927_IR_TMR(ch) (13 + (ch))
226#define TX3927_NUM_IR 16
227
228/*
229 * PCIC
230 */
231/* bits for PCICMD */
232/* see PCI_COMMAND_XXX in linux/pci.h */
233
234/* bits for PCISTAT */
235/* see PCI_STATUS_XXX in linux/pci.h */
236#define PCI_STATUS_NEW_CAP 0x0010
237
238/* bits for ISTAT/IIM */
239#define TX3927_PCIC_IIM_ALL 0x00001600
240
241/* bits for TC */
242#define TX3927_PCIC_TC_OF16E 0x00000020
243#define TX3927_PCIC_TC_IF8E 0x00000010
244#define TX3927_PCIC_TC_OF8E 0x00000008
245
246/* bits for TSTAT/TIM */
247#define TX3927_PCIC_TIM_ALL 0x0003ffff
248
249/* bits for IOBA/MBA */
250/* see PCI_BASE_ADDRESS_XXX in linux/pci.h */
251
252/* bits for PBAPMC */
253#define TX3927_PCIC_PBAPMC_RPBA 0x00000004
254#define TX3927_PCIC_PBAPMC_PBAEN 0x00000002
255#define TX3927_PCIC_PBAPMC_BMCEN 0x00000001
256
257/* bits for LBSTAT/LBIM */
258#define TX3927_PCIC_LBIM_ALL 0x0000003e
259
260/* bits for PCISTATIM (see also PCI_STATUS_XXX in linux/pci.h */
261#define TX3927_PCIC_PCISTATIM_ALL 0x0000f900
262
263/* bits for LBC */
264#define TX3927_PCIC_LBC_IBSE 0x00004000
265#define TX3927_PCIC_LBC_TIBSE 0x00002000
266#define TX3927_PCIC_LBC_TMFBSE 0x00001000
267#define TX3927_PCIC_LBC_HRST 0x00000800
268#define TX3927_PCIC_LBC_SRST 0x00000400
269#define TX3927_PCIC_LBC_EPCAD 0x00000200
270#define TX3927_PCIC_LBC_MSDSE 0x00000100
271#define TX3927_PCIC_LBC_CRR 0x00000080
272#define TX3927_PCIC_LBC_ILMDE 0x00000040
273#define TX3927_PCIC_LBC_ILIDE 0x00000020
274
275#define TX3927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
276#define TX3927_PCIC_MAX_DEVNU TX3927_PCIC_IDSEL_AD_TO_SLOT(32)
277
278/*
279 * CCFG
280 */
281/* CCFG : Chip Configuration */
282#define TX3927_CCFG_TLBOFF 0x00020000
283#define TX3927_CCFG_BEOW 0x00010000
284#define TX3927_CCFG_WR 0x00008000
285#define TX3927_CCFG_TOE 0x00004000
286#define TX3927_CCFG_PCIXARB 0x00002000
287#define TX3927_CCFG_PCI3 0x00001000
288#define TX3927_CCFG_PSNP 0x00000800
289#define TX3927_CCFG_PPRI 0x00000400
290#define TX3927_CCFG_PLLM 0x00000030
291#define TX3927_CCFG_ENDIAN 0x00000004
292#define TX3927_CCFG_HALT 0x00000002
293#define TX3927_CCFG_ACEHOLD 0x00000001
294
295/* PCFG : Pin Configuration */
296#define TX3927_PCFG_SYSCLKEN 0x08000000
297#define TX3927_PCFG_SDRCLKEN_ALL 0x07c00000
298#define TX3927_PCFG_SDRCLKEN(ch) (0x00400000<<(ch))
299#define TX3927_PCFG_PCICLKEN_ALL 0x003c0000
300#define TX3927_PCFG_PCICLKEN(ch) (0x00040000<<(ch))
301#define TX3927_PCFG_SELALL 0x0003ffff
302#define TX3927_PCFG_SELCS 0x00020000
303#define TX3927_PCFG_SELDSF 0x00010000
304#define TX3927_PCFG_SELSIOC_ALL 0x0000c000
305#define TX3927_PCFG_SELSIOC(ch) (0x00004000<<(ch))
306#define TX3927_PCFG_SELSIO_ALL 0x00003000
307#define TX3927_PCFG_SELSIO(ch) (0x00001000<<(ch))
308#define TX3927_PCFG_SELTMR_ALL 0x00000e00
309#define TX3927_PCFG_SELTMR(ch) (0x00000200<<(ch))
310#define TX3927_PCFG_SELDONE 0x00000100
311#define TX3927_PCFG_INTDMA_ALL 0x000000f0
312#define TX3927_PCFG_INTDMA(ch) (0x00000010<<(ch))
313#define TX3927_PCFG_SELDMA_ALL 0x0000000f
314#define TX3927_PCFG_SELDMA(ch) (0x00000001<<(ch))
315
316#define tx3927_sdramcptr ((struct tx3927_sdramc_reg *)TX3927_SDRAMC_REG)
317#define tx3927_romcptr ((struct tx3927_romc_reg *)TX3927_ROMC_REG)
318#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
319#define tx3927_pcicptr ((struct tx3927_pcic_reg *)TX3927_PCIC_REG)
320#define tx3927_ccfgptr ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG)
321#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
322#define tx3927_pioptr ((struct txx9_pio_reg __iomem *)TX3927_PIO_REG)
323
324#define TX3927_REV_PCODE() (tx3927_ccfgptr->crir >> 16)
325#define TX3927_ROMC_BA(ch) (tx3927_romcptr->cr[(ch)] & 0xfff00000)
326#define TX3927_ROMC_SIZE(ch) \
327 (0x00100000 << ((tx3927_romcptr->cr[(ch)] >> 8) & 0xf))
328
329void tx3927_wdt_init(void);
330void tx3927_setup(void);
331void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr);
332void tx3927_sio_init(unsigned int sclk, unsigned int cts_mask);
333struct pci_controller;
334void tx3927_pcic_setup(struct pci_controller *channel,
335 unsigned long sdram_size, int extarb);
336void tx3927_setup_pcierr_irq(void);
337void tx3927_irq_init(void);
338
339#endif /* __ASM_TXX9_TX3927_H */
diff --git a/include/asm-mips/txx9/tx4927.h b/include/asm-mips/txx9/tx4927.h
deleted file mode 100644
index 195f6515db9a..000000000000
--- a/include/asm-mips/txx9/tx4927.h
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * source@mvista.com
4 *
5 * Copyright 2001-2006 MontaVista Software Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
17 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
18 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
20 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27#ifndef __ASM_TXX9_TX4927_H
28#define __ASM_TXX9_TX4927_H
29
30#include <linux/types.h>
31#include <linux/io.h>
32#include <asm/txx9irq.h>
33#include <asm/txx9/tx4927pcic.h>
34
35#ifdef CONFIG_64BIT
36#define TX4927_REG_BASE 0xffffffffff1f0000UL
37#else
38#define TX4927_REG_BASE 0xff1f0000UL
39#endif
40#define TX4927_REG_SIZE 0x00010000
41
42#define TX4927_SDRAMC_REG (TX4927_REG_BASE + 0x8000)
43#define TX4927_EBUSC_REG (TX4927_REG_BASE + 0x9000)
44#define TX4927_PCIC_REG (TX4927_REG_BASE + 0xd000)
45#define TX4927_CCFG_REG (TX4927_REG_BASE + 0xe000)
46#define TX4927_IRC_REG (TX4927_REG_BASE + 0xf600)
47#define TX4927_NR_TMR 3
48#define TX4927_TMR_REG(ch) (TX4927_REG_BASE + 0xf000 + (ch) * 0x100)
49#define TX4927_NR_SIO 2
50#define TX4927_SIO_REG(ch) (TX4927_REG_BASE + 0xf300 + (ch) * 0x100)
51#define TX4927_PIO_REG (TX4927_REG_BASE + 0xf500)
52
53#define TX4927_IR_INT(n) (2 + (n))
54#define TX4927_IR_SIO(n) (8 + (n))
55#define TX4927_IR_PCIC 16
56#define TX4927_NUM_IR_TMR 3
57#define TX4927_IR_TMR(n) (17 + (n))
58#define TX4927_IR_PCIERR 22
59#define TX4927_NUM_IR 32
60
61#define TX4927_IRC_INT 2 /* IP[2] in Status register */
62
63#define TX4927_NUM_PIO 16
64
65struct tx4927_sdramc_reg {
66 u64 cr[4];
67 u64 unused0[4];
68 u64 tr;
69 u64 unused1[2];
70 u64 cmd;
71};
72
73struct tx4927_ebusc_reg {
74 u64 cr[8];
75};
76
77struct tx4927_ccfg_reg {
78 u64 ccfg;
79 u64 crir;
80 u64 pcfg;
81 u64 toea;
82 u64 clkctr;
83 u64 unused0;
84 u64 garbc;
85 u64 unused1;
86 u64 unused2;
87 u64 ramp;
88};
89
90/*
91 * CCFG
92 */
93/* CCFG : Chip Configuration */
94#define TX4927_CCFG_WDRST 0x0000020000000000ULL
95#define TX4927_CCFG_WDREXEN 0x0000010000000000ULL
96#define TX4927_CCFG_BCFG_MASK 0x000000ff00000000ULL
97#define TX4927_CCFG_TINTDIS 0x01000000
98#define TX4927_CCFG_PCI66 0x00800000
99#define TX4927_CCFG_PCIMODE 0x00400000
100#define TX4927_CCFG_DIVMODE_MASK 0x000e0000
101#define TX4927_CCFG_DIVMODE_8 (0x0 << 17)
102#define TX4927_CCFG_DIVMODE_12 (0x1 << 17)
103#define TX4927_CCFG_DIVMODE_16 (0x2 << 17)
104#define TX4927_CCFG_DIVMODE_10 (0x3 << 17)
105#define TX4927_CCFG_DIVMODE_2 (0x4 << 17)
106#define TX4927_CCFG_DIVMODE_3 (0x5 << 17)
107#define TX4927_CCFG_DIVMODE_4 (0x6 << 17)
108#define TX4927_CCFG_DIVMODE_2_5 (0x7 << 17)
109#define TX4927_CCFG_BEOW 0x00010000
110#define TX4927_CCFG_WR 0x00008000
111#define TX4927_CCFG_TOE 0x00004000
112#define TX4927_CCFG_PCIARB 0x00002000
113#define TX4927_CCFG_PCIDIVMODE_MASK 0x00001800
114#define TX4927_CCFG_PCIDIVMODE_2_5 0x00000000
115#define TX4927_CCFG_PCIDIVMODE_3 0x00000800
116#define TX4927_CCFG_PCIDIVMODE_5 0x00001000
117#define TX4927_CCFG_PCIDIVMODE_6 0x00001800
118#define TX4927_CCFG_SYSSP_MASK 0x000000c0
119#define TX4927_CCFG_ENDIAN 0x00000004
120#define TX4927_CCFG_HALT 0x00000002
121#define TX4927_CCFG_ACEHOLD 0x00000001
122#define TX4927_CCFG_W1CBITS (TX4927_CCFG_WDRST | TX4927_CCFG_BEOW)
123
124/* PCFG : Pin Configuration */
125#define TX4927_PCFG_SDCLKDLY_MASK 0x30000000
126#define TX4927_PCFG_SDCLKDLY(d) ((d)<<28)
127#define TX4927_PCFG_SYSCLKEN 0x08000000
128#define TX4927_PCFG_SDCLKEN_ALL 0x07800000
129#define TX4927_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
130#define TX4927_PCFG_PCICLKEN_ALL 0x003f0000
131#define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
132#define TX4927_PCFG_SEL2 0x00000200
133#define TX4927_PCFG_SEL1 0x00000100
134#define TX4927_PCFG_DMASEL_ALL 0x000000ff
135#define TX4927_PCFG_DMASEL0_MASK 0x00000003
136#define TX4927_PCFG_DMASEL1_MASK 0x0000000c
137#define TX4927_PCFG_DMASEL2_MASK 0x00000030
138#define TX4927_PCFG_DMASEL3_MASK 0x000000c0
139#define TX4927_PCFG_DMASEL0_DRQ0 0x00000000
140#define TX4927_PCFG_DMASEL0_SIO1 0x00000001
141#define TX4927_PCFG_DMASEL0_ACL0 0x00000002
142#define TX4927_PCFG_DMASEL0_ACL2 0x00000003
143#define TX4927_PCFG_DMASEL1_DRQ1 0x00000000
144#define TX4927_PCFG_DMASEL1_SIO1 0x00000004
145#define TX4927_PCFG_DMASEL1_ACL1 0x00000008
146#define TX4927_PCFG_DMASEL1_ACL3 0x0000000c
147#define TX4927_PCFG_DMASEL2_DRQ2 0x00000000 /* SEL2=0 */
148#define TX4927_PCFG_DMASEL2_SIO0 0x00000010 /* SEL2=0 */
149#define TX4927_PCFG_DMASEL2_ACL1 0x00000000 /* SEL2=1 */
150#define TX4927_PCFG_DMASEL2_ACL2 0x00000020 /* SEL2=1 */
151#define TX4927_PCFG_DMASEL2_ACL0 0x00000030 /* SEL2=1 */
152#define TX4927_PCFG_DMASEL3_DRQ3 0x00000000
153#define TX4927_PCFG_DMASEL3_SIO0 0x00000040
154#define TX4927_PCFG_DMASEL3_ACL3 0x00000080
155#define TX4927_PCFG_DMASEL3_ACL1 0x000000c0
156
157/* CLKCTR : Clock Control */
158#define TX4927_CLKCTR_ACLCKD 0x02000000
159#define TX4927_CLKCTR_PIOCKD 0x01000000
160#define TX4927_CLKCTR_DMACKD 0x00800000
161#define TX4927_CLKCTR_PCICKD 0x00400000
162#define TX4927_CLKCTR_TM0CKD 0x00100000
163#define TX4927_CLKCTR_TM1CKD 0x00080000
164#define TX4927_CLKCTR_TM2CKD 0x00040000
165#define TX4927_CLKCTR_SIO0CKD 0x00020000
166#define TX4927_CLKCTR_SIO1CKD 0x00010000
167#define TX4927_CLKCTR_ACLRST 0x00000200
168#define TX4927_CLKCTR_PIORST 0x00000100
169#define TX4927_CLKCTR_DMARST 0x00000080
170#define TX4927_CLKCTR_PCIRST 0x00000040
171#define TX4927_CLKCTR_TM0RST 0x00000010
172#define TX4927_CLKCTR_TM1RST 0x00000008
173#define TX4927_CLKCTR_TM2RST 0x00000004
174#define TX4927_CLKCTR_SIO0RST 0x00000002
175#define TX4927_CLKCTR_SIO1RST 0x00000001
176
177#define tx4927_sdramcptr \
178 ((struct tx4927_sdramc_reg __iomem *)TX4927_SDRAMC_REG)
179#define tx4927_pcicptr \
180 ((struct tx4927_pcic_reg __iomem *)TX4927_PCIC_REG)
181#define tx4927_ccfgptr \
182 ((struct tx4927_ccfg_reg __iomem *)TX4927_CCFG_REG)
183#define tx4927_ebuscptr \
184 ((struct tx4927_ebusc_reg __iomem *)TX4927_EBUSC_REG)
185#define tx4927_pioptr ((struct txx9_pio_reg __iomem *)TX4927_PIO_REG)
186
187#define TX4927_REV_PCODE() \
188 ((__u32)__raw_readq(&tx4927_ccfgptr->crir) >> 16)
189
190#define TX4927_SDRAMC_CR(ch) __raw_readq(&tx4927_sdramcptr->cr[(ch)])
191#define TX4927_SDRAMC_BA(ch) ((TX4927_SDRAMC_CR(ch) >> 49) << 21)
192#define TX4927_SDRAMC_SIZE(ch) \
193 ((((TX4927_SDRAMC_CR(ch) >> 33) & 0x7fff) + 1) << 21)
194
195#define TX4927_EBUSC_CR(ch) __raw_readq(&tx4927_ebuscptr->cr[(ch)])
196#define TX4927_EBUSC_BA(ch) ((TX4927_EBUSC_CR(ch) >> 48) << 20)
197#define TX4927_EBUSC_SIZE(ch) \
198 (0x00100000 << ((unsigned long)(TX4927_EBUSC_CR(ch) >> 8) & 0xf))
199
200/* utilities */
201static inline void txx9_clear64(__u64 __iomem *adr, __u64 bits)
202{
203#ifdef CONFIG_32BIT
204 unsigned long flags;
205 local_irq_save(flags);
206#endif
207 ____raw_writeq(____raw_readq(adr) & ~bits, adr);
208#ifdef CONFIG_32BIT
209 local_irq_restore(flags);
210#endif
211}
212static inline void txx9_set64(__u64 __iomem *adr, __u64 bits)
213{
214#ifdef CONFIG_32BIT
215 unsigned long flags;
216 local_irq_save(flags);
217#endif
218 ____raw_writeq(____raw_readq(adr) | bits, adr);
219#ifdef CONFIG_32BIT
220 local_irq_restore(flags);
221#endif
222}
223
224/* These functions are not interrupt safe. */
225static inline void tx4927_ccfg_clear(__u64 bits)
226{
227 ____raw_writeq(____raw_readq(&tx4927_ccfgptr->ccfg)
228 & ~(TX4927_CCFG_W1CBITS | bits),
229 &tx4927_ccfgptr->ccfg);
230}
231static inline void tx4927_ccfg_set(__u64 bits)
232{
233 ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
234 & ~TX4927_CCFG_W1CBITS) | bits,
235 &tx4927_ccfgptr->ccfg);
236}
237static inline void tx4927_ccfg_change(__u64 change, __u64 new)
238{
239 ____raw_writeq((____raw_readq(&tx4927_ccfgptr->ccfg)
240 & ~(TX4927_CCFG_W1CBITS | change)) |
241 new,
242 &tx4927_ccfgptr->ccfg);
243}
244
245unsigned int tx4927_get_mem_size(void);
246void tx4927_wdt_init(void);
247void tx4927_setup(void);
248void tx4927_time_init(unsigned int tmrnr);
249void tx4927_sio_init(unsigned int sclk, unsigned int cts_mask);
250int tx4927_report_pciclk(void);
251int tx4927_pciclk66_setup(void);
252void tx4927_setup_pcierr_irq(void);
253void tx4927_irq_init(void);
254
255#endif /* __ASM_TXX9_TX4927_H */
diff --git a/include/asm-mips/txx9/tx4927pcic.h b/include/asm-mips/txx9/tx4927pcic.h
deleted file mode 100644
index c470b8a5fe57..000000000000
--- a/include/asm-mips/txx9/tx4927pcic.h
+++ /dev/null
@@ -1,203 +0,0 @@
1/*
2 * include/asm-mips/txx9/tx4927pcic.h
3 * TX4927 PCI controller definitions.
4 *
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
7 * for more details.
8 */
9#ifndef __ASM_TXX9_TX4927PCIC_H
10#define __ASM_TXX9_TX4927PCIC_H
11
12#include <linux/pci.h>
13#include <linux/irqreturn.h>
14
15struct tx4927_pcic_reg {
16 u32 pciid;
17 u32 pcistatus;
18 u32 pciccrev;
19 u32 pcicfg1;
20 u32 p2gm0plbase; /* +10 */
21 u32 p2gm0pubase;
22 u32 p2gm1plbase;
23 u32 p2gm1pubase;
24 u32 p2gm2pbase; /* +20 */
25 u32 p2giopbase;
26 u32 unused0;
27 u32 pcisid;
28 u32 unused1; /* +30 */
29 u32 pcicapptr;
30 u32 unused2;
31 u32 pcicfg2;
32 u32 g2ptocnt; /* +40 */
33 u32 unused3[15];
34 u32 g2pstatus; /* +80 */
35 u32 g2pmask;
36 u32 pcisstatus;
37 u32 pcimask;
38 u32 p2gcfg; /* +90 */
39 u32 p2gstatus;
40 u32 p2gmask;
41 u32 p2gccmd;
42 u32 unused4[24]; /* +a0 */
43 u32 pbareqport; /* +100 */
44 u32 pbacfg;
45 u32 pbastatus;
46 u32 pbamask;
47 u32 pbabm; /* +110 */
48 u32 pbacreq;
49 u32 pbacgnt;
50 u32 pbacstate;
51 u64 g2pmgbase[3]; /* +120 */
52 u64 g2piogbase;
53 u32 g2pmmask[3]; /* +140 */
54 u32 g2piomask;
55 u64 g2pmpbase[3]; /* +150 */
56 u64 g2piopbase;
57 u32 pciccfg; /* +170 */
58 u32 pcicstatus;
59 u32 pcicmask;
60 u32 unused5;
61 u64 p2gmgbase[3]; /* +180 */
62 u64 p2giogbase;
63 u32 g2pcfgadrs; /* +1a0 */
64 u32 g2pcfgdata;
65 u32 unused6[8];
66 u32 g2pintack;
67 u32 g2pspc;
68 u32 unused7[12]; /* +1d0 */
69 u64 pdmca; /* +200 */
70 u64 pdmga;
71 u64 pdmpa;
72 u64 pdmctr;
73 u64 pdmcfg; /* +220 */
74 u64 pdmsts;
75};
76
77/* bits for PCICMD */
78/* see PCI_COMMAND_XXX in linux/pci_regs.h */
79
80/* bits for PCISTAT */
81/* see PCI_STATUS_XXX in linux/pci_regs.h */
82
83/* bits for IOBA/MBA */
84/* see PCI_BASE_ADDRESS_XXX in linux/pci_regs.h */
85
86/* bits for G2PSTATUS/G2PMASK */
87#define TX4927_PCIC_G2PSTATUS_ALL 0x00000003
88#define TX4927_PCIC_G2PSTATUS_TTOE 0x00000002
89#define TX4927_PCIC_G2PSTATUS_RTOE 0x00000001
90
91/* bits for PCIMASK (see also PCI_STATUS_XXX in linux/pci_regs.h */
92#define TX4927_PCIC_PCISTATUS_ALL 0x0000f900
93
94/* bits for PBACFG */
95#define TX4927_PCIC_PBACFG_FIXPA 0x00000008
96#define TX4927_PCIC_PBACFG_RPBA 0x00000004
97#define TX4927_PCIC_PBACFG_PBAEN 0x00000002
98#define TX4927_PCIC_PBACFG_BMCEN 0x00000001
99
100/* bits for PBASTATUS/PBAMASK */
101#define TX4927_PCIC_PBASTATUS_ALL 0x00000001
102#define TX4927_PCIC_PBASTATUS_BM 0x00000001
103
104/* bits for G2PMnGBASE */
105#define TX4927_PCIC_G2PMnGBASE_BSDIS 0x0000002000000000ULL
106#define TX4927_PCIC_G2PMnGBASE_ECHG 0x0000001000000000ULL
107
108/* bits for G2PIOGBASE */
109#define TX4927_PCIC_G2PIOGBASE_BSDIS 0x0000002000000000ULL
110#define TX4927_PCIC_G2PIOGBASE_ECHG 0x0000001000000000ULL
111
112/* bits for PCICSTATUS/PCICMASK */
113#define TX4927_PCIC_PCICSTATUS_ALL 0x000007b8
114#define TX4927_PCIC_PCICSTATUS_PME 0x00000400
115#define TX4927_PCIC_PCICSTATUS_TLB 0x00000200
116#define TX4927_PCIC_PCICSTATUS_NIB 0x00000100
117#define TX4927_PCIC_PCICSTATUS_ZIB 0x00000080
118#define TX4927_PCIC_PCICSTATUS_PERR 0x00000020
119#define TX4927_PCIC_PCICSTATUS_SERR 0x00000010
120#define TX4927_PCIC_PCICSTATUS_GBE 0x00000008
121#define TX4927_PCIC_PCICSTATUS_IWB 0x00000002
122#define TX4927_PCIC_PCICSTATUS_E2PDONE 0x00000001
123
124/* bits for PCICCFG */
125#define TX4927_PCIC_PCICCFG_GBWC_MASK 0x0fff0000
126#define TX4927_PCIC_PCICCFG_HRST 0x00000800
127#define TX4927_PCIC_PCICCFG_SRST 0x00000400
128#define TX4927_PCIC_PCICCFG_IRBER 0x00000200
129#define TX4927_PCIC_PCICCFG_G2PMEN(ch) (0x00000100>>(ch))
130#define TX4927_PCIC_PCICCFG_G2PM0EN 0x00000100
131#define TX4927_PCIC_PCICCFG_G2PM1EN 0x00000080
132#define TX4927_PCIC_PCICCFG_G2PM2EN 0x00000040
133#define TX4927_PCIC_PCICCFG_G2PIOEN 0x00000020
134#define TX4927_PCIC_PCICCFG_TCAR 0x00000010
135#define TX4927_PCIC_PCICCFG_ICAEN 0x00000008
136
137/* bits for P2GMnGBASE */
138#define TX4927_PCIC_P2GMnGBASE_TMEMEN 0x0000004000000000ULL
139#define TX4927_PCIC_P2GMnGBASE_TBSDIS 0x0000002000000000ULL
140#define TX4927_PCIC_P2GMnGBASE_TECHG 0x0000001000000000ULL
141
142/* bits for P2GIOGBASE */
143#define TX4927_PCIC_P2GIOGBASE_TIOEN 0x0000004000000000ULL
144#define TX4927_PCIC_P2GIOGBASE_TBSDIS 0x0000002000000000ULL
145#define TX4927_PCIC_P2GIOGBASE_TECHG 0x0000001000000000ULL
146
147#define TX4927_PCIC_IDSEL_AD_TO_SLOT(ad) ((ad) - 11)
148#define TX4927_PCIC_MAX_DEVNU TX4927_PCIC_IDSEL_AD_TO_SLOT(32)
149
150/* bits for PDMCFG */
151#define TX4927_PCIC_PDMCFG_RSTFIFO 0x00200000
152#define TX4927_PCIC_PDMCFG_EXFER 0x00100000
153#define TX4927_PCIC_PDMCFG_REQDLY_MASK 0x00003800
154#define TX4927_PCIC_PDMCFG_REQDLY_NONE (0 << 11)
155#define TX4927_PCIC_PDMCFG_REQDLY_16 (1 << 11)
156#define TX4927_PCIC_PDMCFG_REQDLY_32 (2 << 11)
157#define TX4927_PCIC_PDMCFG_REQDLY_64 (3 << 11)
158#define TX4927_PCIC_PDMCFG_REQDLY_128 (4 << 11)
159#define TX4927_PCIC_PDMCFG_REQDLY_256 (5 << 11)
160#define TX4927_PCIC_PDMCFG_REQDLY_512 (6 << 11)
161#define TX4927_PCIC_PDMCFG_REQDLY_1024 (7 << 11)
162#define TX4927_PCIC_PDMCFG_ERRIE 0x00000400
163#define TX4927_PCIC_PDMCFG_NCCMPIE 0x00000200
164#define TX4927_PCIC_PDMCFG_NTCMPIE 0x00000100
165#define TX4927_PCIC_PDMCFG_CHNEN 0x00000080
166#define TX4927_PCIC_PDMCFG_XFRACT 0x00000040
167#define TX4927_PCIC_PDMCFG_BSWAP 0x00000020
168#define TX4927_PCIC_PDMCFG_XFRSIZE_MASK 0x0000000c
169#define TX4927_PCIC_PDMCFG_XFRSIZE_1DW 0x00000000
170#define TX4927_PCIC_PDMCFG_XFRSIZE_1QW 0x00000004
171#define TX4927_PCIC_PDMCFG_XFRSIZE_4QW 0x00000008
172#define TX4927_PCIC_PDMCFG_XFRDIRC 0x00000002
173#define TX4927_PCIC_PDMCFG_CHRST 0x00000001
174
175/* bits for PDMSTS */
176#define TX4927_PCIC_PDMSTS_REQCNT_MASK 0x3f000000
177#define TX4927_PCIC_PDMSTS_FIFOCNT_MASK 0x00f00000
178#define TX4927_PCIC_PDMSTS_FIFOWP_MASK 0x000c0000
179#define TX4927_PCIC_PDMSTS_FIFORP_MASK 0x00030000
180#define TX4927_PCIC_PDMSTS_ERRINT 0x00000800
181#define TX4927_PCIC_PDMSTS_DONEINT 0x00000400
182#define TX4927_PCIC_PDMSTS_CHNEN 0x00000200
183#define TX4927_PCIC_PDMSTS_XFRACT 0x00000100
184#define TX4927_PCIC_PDMSTS_ACCMP 0x00000080
185#define TX4927_PCIC_PDMSTS_NCCMP 0x00000040
186#define TX4927_PCIC_PDMSTS_NTCMP 0x00000020
187#define TX4927_PCIC_PDMSTS_CFGERR 0x00000008
188#define TX4927_PCIC_PDMSTS_PCIERR 0x00000004
189#define TX4927_PCIC_PDMSTS_CHNERR 0x00000002
190#define TX4927_PCIC_PDMSTS_DATAERR 0x00000001
191#define TX4927_PCIC_PDMSTS_ALL_CMP 0x000000e0
192#define TX4927_PCIC_PDMSTS_ALL_ERR 0x0000000f
193
194struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
195 struct pci_controller *channel);
196void tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
197 struct pci_controller *channel, int extarb);
198void tx4927_report_pcic_status(void);
199char *tx4927_pcibios_setup(char *str);
200void tx4927_dump_pcic_settings(void);
201irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id);
202
203#endif /* __ASM_TXX9_TX4927PCIC_H */
diff --git a/include/asm-mips/txx9/tx4938.h b/include/asm-mips/txx9/tx4938.h
deleted file mode 100644
index 8175d4ccbc39..000000000000
--- a/include/asm-mips/txx9/tx4938.h
+++ /dev/null
@@ -1,293 +0,0 @@
1/*
2 * Definitions for TX4937/TX4938
3 * Copyright (C) 2000-2001 Toshiba Corporation
4 *
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
8 * or implied.
9 *
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
11 */
12#ifndef __ASM_TXX9_TX4938_H
13#define __ASM_TXX9_TX4938_H
14
15/* some controllers are compatible with 4927 */
16#include <asm/txx9/tx4927.h>
17
18#ifdef CONFIG_64BIT
19#define TX4938_REG_BASE 0xffffffffff1f0000UL /* == TX4937_REG_BASE */
20#else
21#define TX4938_REG_BASE 0xff1f0000UL /* == TX4937_REG_BASE */
22#endif
23#define TX4938_REG_SIZE 0x00010000 /* == TX4937_REG_SIZE */
24
25/* NDFMC, SRAMC, PCIC1, SPIC: TX4938 only */
26#define TX4938_NDFMC_REG (TX4938_REG_BASE + 0x5000)
27#define TX4938_SRAMC_REG (TX4938_REG_BASE + 0x6000)
28#define TX4938_PCIC1_REG (TX4938_REG_BASE + 0x7000)
29#define TX4938_SDRAMC_REG (TX4938_REG_BASE + 0x8000)
30#define TX4938_EBUSC_REG (TX4938_REG_BASE + 0x9000)
31#define TX4938_DMA_REG(ch) (TX4938_REG_BASE + 0xb000 + (ch) * 0x800)
32#define TX4938_PCIC_REG (TX4938_REG_BASE + 0xd000)
33#define TX4938_CCFG_REG (TX4938_REG_BASE + 0xe000)
34#define TX4938_NR_TMR 3
35#define TX4938_TMR_REG(ch) ((TX4938_REG_BASE + 0xf000) + (ch) * 0x100)
36#define TX4938_NR_SIO 2
37#define TX4938_SIO_REG(ch) ((TX4938_REG_BASE + 0xf300) + (ch) * 0x100)
38#define TX4938_PIO_REG (TX4938_REG_BASE + 0xf500)
39#define TX4938_IRC_REG (TX4938_REG_BASE + 0xf600)
40#define TX4938_ACLC_REG (TX4938_REG_BASE + 0xf700)
41#define TX4938_SPI_REG (TX4938_REG_BASE + 0xf800)
42
43struct tx4938_sramc_reg {
44 u64 cr;
45};
46
47struct tx4938_ccfg_reg {
48 u64 ccfg;
49 u64 crir;
50 u64 pcfg;
51 u64 toea;
52 u64 clkctr;
53 u64 unused0;
54 u64 garbc;
55 u64 unused1;
56 u64 unused2;
57 u64 ramp;
58 u64 unused3;
59 u64 jmpadr;
60};
61
62/*
63 * IRC
64 */
65
66#define TX4938_IR_ECCERR 0
67#define TX4938_IR_WTOERR 1
68#define TX4938_NUM_IR_INT 6
69#define TX4938_IR_INT(n) (2 + (n))
70#define TX4938_NUM_IR_SIO 2
71#define TX4938_IR_SIO(n) (8 + (n))
72#define TX4938_NUM_IR_DMA 4
73#define TX4938_IR_DMA(ch, n) ((ch ? 27 : 10) + (n)) /* 10-13, 27-30 */
74#define TX4938_IR_PIO 14
75#define TX4938_IR_PDMAC 15
76#define TX4938_IR_PCIC 16
77#define TX4938_NUM_IR_TMR 3
78#define TX4938_IR_TMR(n) (17 + (n))
79#define TX4938_IR_NDFMC 21
80#define TX4938_IR_PCIERR 22
81#define TX4938_IR_PCIPME 23
82#define TX4938_IR_ACLC 24
83#define TX4938_IR_ACLCPME 25
84#define TX4938_IR_PCIC1 26
85#define TX4938_IR_SPI 31
86#define TX4938_NUM_IR 32
87/* multiplex */
88#define TX4938_IR_ETH0 TX4938_IR_INT(4)
89#define TX4938_IR_ETH1 TX4938_IR_INT(3)
90
91#define TX4938_IRC_INT 2 /* IP[2] in Status register */
92
93#define TX4938_NUM_PIO 16
94
95/*
96 * CCFG
97 */
98/* CCFG : Chip Configuration */
99#define TX4938_CCFG_WDRST 0x0000020000000000ULL
100#define TX4938_CCFG_WDREXEN 0x0000010000000000ULL
101#define TX4938_CCFG_BCFG_MASK 0x000000ff00000000ULL
102#define TX4938_CCFG_TINTDIS 0x01000000
103#define TX4938_CCFG_PCI66 0x00800000
104#define TX4938_CCFG_PCIMODE 0x00400000
105#define TX4938_CCFG_PCI1_66 0x00200000
106#define TX4938_CCFG_DIVMODE_MASK 0x001e0000
107#define TX4938_CCFG_DIVMODE_2 (0x4 << 17)
108#define TX4938_CCFG_DIVMODE_2_5 (0xf << 17)
109#define TX4938_CCFG_DIVMODE_3 (0x5 << 17)
110#define TX4938_CCFG_DIVMODE_4 (0x6 << 17)
111#define TX4938_CCFG_DIVMODE_4_5 (0xd << 17)
112#define TX4938_CCFG_DIVMODE_8 (0x0 << 17)
113#define TX4938_CCFG_DIVMODE_10 (0xb << 17)
114#define TX4938_CCFG_DIVMODE_12 (0x1 << 17)
115#define TX4938_CCFG_DIVMODE_16 (0x2 << 17)
116#define TX4938_CCFG_DIVMODE_18 (0x9 << 17)
117#define TX4938_CCFG_BEOW 0x00010000
118#define TX4938_CCFG_WR 0x00008000
119#define TX4938_CCFG_TOE 0x00004000
120#define TX4938_CCFG_PCIARB 0x00002000
121#define TX4938_CCFG_PCIDIVMODE_MASK 0x00001c00
122#define TX4938_CCFG_PCIDIVMODE_4 (0x1 << 10)
123#define TX4938_CCFG_PCIDIVMODE_4_5 (0x3 << 10)
124#define TX4938_CCFG_PCIDIVMODE_5 (0x5 << 10)
125#define TX4938_CCFG_PCIDIVMODE_5_5 (0x7 << 10)
126#define TX4938_CCFG_PCIDIVMODE_8 (0x0 << 10)
127#define TX4938_CCFG_PCIDIVMODE_9 (0x2 << 10)
128#define TX4938_CCFG_PCIDIVMODE_10 (0x4 << 10)
129#define TX4938_CCFG_PCIDIVMODE_11 (0x6 << 10)
130#define TX4938_CCFG_PCI1DMD 0x00000100
131#define TX4938_CCFG_SYSSP_MASK 0x000000c0
132#define TX4938_CCFG_ENDIAN 0x00000004
133#define TX4938_CCFG_HALT 0x00000002
134#define TX4938_CCFG_ACEHOLD 0x00000001
135
136/* PCFG : Pin Configuration */
137#define TX4938_PCFG_ETH0_SEL 0x8000000000000000ULL
138#define TX4938_PCFG_ETH1_SEL 0x4000000000000000ULL
139#define TX4938_PCFG_ATA_SEL 0x2000000000000000ULL
140#define TX4938_PCFG_ISA_SEL 0x1000000000000000ULL
141#define TX4938_PCFG_SPI_SEL 0x0800000000000000ULL
142#define TX4938_PCFG_NDF_SEL 0x0400000000000000ULL
143#define TX4938_PCFG_SDCLKDLY_MASK 0x30000000
144#define TX4938_PCFG_SDCLKDLY(d) ((d)<<28)
145#define TX4938_PCFG_SYSCLKEN 0x08000000
146#define TX4938_PCFG_SDCLKEN_ALL 0x07800000
147#define TX4938_PCFG_SDCLKEN(ch) (0x00800000<<(ch))
148#define TX4938_PCFG_PCICLKEN_ALL 0x003f0000
149#define TX4938_PCFG_PCICLKEN(ch) (0x00010000<<(ch))
150#define TX4938_PCFG_SEL2 0x00000200
151#define TX4938_PCFG_SEL1 0x00000100
152#define TX4938_PCFG_DMASEL_ALL 0x0000000f
153#define TX4938_PCFG_DMASEL0_DRQ0 0x00000000
154#define TX4938_PCFG_DMASEL0_SIO1 0x00000001
155#define TX4938_PCFG_DMASEL1_DRQ1 0x00000000
156#define TX4938_PCFG_DMASEL1_SIO1 0x00000002
157#define TX4938_PCFG_DMASEL2_DRQ2 0x00000000
158#define TX4938_PCFG_DMASEL2_SIO0 0x00000004
159#define TX4938_PCFG_DMASEL3_DRQ3 0x00000000
160#define TX4938_PCFG_DMASEL3_SIO0 0x00000008
161
162/* CLKCTR : Clock Control */
163#define TX4938_CLKCTR_NDFCKD 0x0001000000000000ULL
164#define TX4938_CLKCTR_NDFRST 0x0000000100000000ULL
165#define TX4938_CLKCTR_ETH1CKD 0x80000000
166#define TX4938_CLKCTR_ETH0CKD 0x40000000
167#define TX4938_CLKCTR_SPICKD 0x20000000
168#define TX4938_CLKCTR_SRAMCKD 0x10000000
169#define TX4938_CLKCTR_PCIC1CKD 0x08000000
170#define TX4938_CLKCTR_DMA1CKD 0x04000000
171#define TX4938_CLKCTR_ACLCKD 0x02000000
172#define TX4938_CLKCTR_PIOCKD 0x01000000
173#define TX4938_CLKCTR_DMACKD 0x00800000
174#define TX4938_CLKCTR_PCICKD 0x00400000
175#define TX4938_CLKCTR_TM0CKD 0x00100000
176#define TX4938_CLKCTR_TM1CKD 0x00080000
177#define TX4938_CLKCTR_TM2CKD 0x00040000
178#define TX4938_CLKCTR_SIO0CKD 0x00020000
179#define TX4938_CLKCTR_SIO1CKD 0x00010000
180#define TX4938_CLKCTR_ETH1RST 0x00008000
181#define TX4938_CLKCTR_ETH0RST 0x00004000
182#define TX4938_CLKCTR_SPIRST 0x00002000
183#define TX4938_CLKCTR_SRAMRST 0x00001000
184#define TX4938_CLKCTR_PCIC1RST 0x00000800
185#define TX4938_CLKCTR_DMA1RST 0x00000400
186#define TX4938_CLKCTR_ACLRST 0x00000200
187#define TX4938_CLKCTR_PIORST 0x00000100
188#define TX4938_CLKCTR_DMARST 0x00000080
189#define TX4938_CLKCTR_PCIRST 0x00000040
190#define TX4938_CLKCTR_TM0RST 0x00000010
191#define TX4938_CLKCTR_TM1RST 0x00000008
192#define TX4938_CLKCTR_TM2RST 0x00000004
193#define TX4938_CLKCTR_SIO0RST 0x00000002
194#define TX4938_CLKCTR_SIO1RST 0x00000001
195
196/*
197 * DMA
198 */
199/* bits for MCR */
200#define TX4938_DMA_MCR_EIS(ch) (0x10000000<<(ch))
201#define TX4938_DMA_MCR_DIS(ch) (0x01000000<<(ch))
202#define TX4938_DMA_MCR_RSFIF 0x00000080
203#define TX4938_DMA_MCR_FIFUM(ch) (0x00000008<<(ch))
204#define TX4938_DMA_MCR_RPRT 0x00000002
205#define TX4938_DMA_MCR_MSTEN 0x00000001
206
207/* bits for CCRn */
208#define TX4938_DMA_CCR_IMMCHN 0x20000000
209#define TX4938_DMA_CCR_USEXFSZ 0x10000000
210#define TX4938_DMA_CCR_LE 0x08000000
211#define TX4938_DMA_CCR_DBINH 0x04000000
212#define TX4938_DMA_CCR_SBINH 0x02000000
213#define TX4938_DMA_CCR_CHRST 0x01000000
214#define TX4938_DMA_CCR_RVBYTE 0x00800000
215#define TX4938_DMA_CCR_ACKPOL 0x00400000
216#define TX4938_DMA_CCR_REQPL 0x00200000
217#define TX4938_DMA_CCR_EGREQ 0x00100000
218#define TX4938_DMA_CCR_CHDN 0x00080000
219#define TX4938_DMA_CCR_DNCTL 0x00060000
220#define TX4938_DMA_CCR_EXTRQ 0x00010000
221#define TX4938_DMA_CCR_INTRQD 0x0000e000
222#define TX4938_DMA_CCR_INTENE 0x00001000
223#define TX4938_DMA_CCR_INTENC 0x00000800
224#define TX4938_DMA_CCR_INTENT 0x00000400
225#define TX4938_DMA_CCR_CHNEN 0x00000200
226#define TX4938_DMA_CCR_XFACT 0x00000100
227#define TX4938_DMA_CCR_SMPCHN 0x00000020
228#define TX4938_DMA_CCR_XFSZ(order) (((order) << 2) & 0x0000001c)
229#define TX4938_DMA_CCR_XFSZ_1W TX4938_DMA_CCR_XFSZ(2)
230#define TX4938_DMA_CCR_XFSZ_2W TX4938_DMA_CCR_XFSZ(3)
231#define TX4938_DMA_CCR_XFSZ_4W TX4938_DMA_CCR_XFSZ(4)
232#define TX4938_DMA_CCR_XFSZ_8W TX4938_DMA_CCR_XFSZ(5)
233#define TX4938_DMA_CCR_XFSZ_16W TX4938_DMA_CCR_XFSZ(6)
234#define TX4938_DMA_CCR_XFSZ_32W TX4938_DMA_CCR_XFSZ(7)
235#define TX4938_DMA_CCR_MEMIO 0x00000002
236#define TX4938_DMA_CCR_SNGAD 0x00000001
237
238/* bits for CSRn */
239#define TX4938_DMA_CSR_CHNEN 0x00000400
240#define TX4938_DMA_CSR_STLXFER 0x00000200
241#define TX4938_DMA_CSR_CHNACT 0x00000100
242#define TX4938_DMA_CSR_ABCHC 0x00000080
243#define TX4938_DMA_CSR_NCHNC 0x00000040
244#define TX4938_DMA_CSR_NTRNFC 0x00000020
245#define TX4938_DMA_CSR_EXTDN 0x00000010
246#define TX4938_DMA_CSR_CFERR 0x00000008
247#define TX4938_DMA_CSR_CHERR 0x00000004
248#define TX4938_DMA_CSR_DESERR 0x00000002
249#define TX4938_DMA_CSR_SORERR 0x00000001
250
251#define tx4938_sdramcptr tx4927_sdramcptr
252#define tx4938_ebuscptr tx4927_ebuscptr
253#define tx4938_pcicptr tx4927_pcicptr
254#define tx4938_pcic1ptr \
255 ((struct tx4927_pcic_reg __iomem *)TX4938_PCIC1_REG)
256#define tx4938_ccfgptr \
257 ((struct tx4938_ccfg_reg __iomem *)TX4938_CCFG_REG)
258#define tx4938_pioptr ((struct txx9_pio_reg __iomem *)TX4938_PIO_REG)
259#define tx4938_sramcptr \
260 ((struct tx4938_sramc_reg __iomem *)TX4938_SRAMC_REG)
261
262
263#define TX4938_REV_PCODE() \
264 ((__u32)__raw_readq(&tx4938_ccfgptr->crir) >> 16)
265
266#define tx4938_ccfg_clear(bits) tx4927_ccfg_clear(bits)
267#define tx4938_ccfg_set(bits) tx4927_ccfg_set(bits)
268#define tx4938_ccfg_change(change, new) tx4927_ccfg_change(change, new)
269
270#define TX4938_SDRAMC_CR(ch) TX4927_SDRAMC_CR(ch)
271#define TX4938_SDRAMC_BA(ch) TX4927_SDRAMC_BA(ch)
272#define TX4938_SDRAMC_SIZE(ch) TX4927_SDRAMC_SIZE(ch)
273
274#define TX4938_EBUSC_CR(ch) TX4927_EBUSC_CR(ch)
275#define TX4938_EBUSC_BA(ch) TX4927_EBUSC_BA(ch)
276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
277
278#define tx4938_get_mem_size() tx4927_get_mem_size()
279void tx4938_wdt_init(void);
280void tx4938_setup(void);
281void tx4938_time_init(unsigned int tmrnr);
282void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
283void tx4938_spi_init(int busid);
284void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
285int tx4938_report_pciclk(void);
286void tx4938_report_pci1clk(void);
287int tx4938_pciclk66_setup(void);
288struct pci_dev;
289int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
290void tx4938_setup_pcierr_irq(void);
291void tx4938_irq_init(void);
292
293#endif
diff --git a/include/asm-mips/txx9irq.h b/include/asm-mips/txx9irq.h
deleted file mode 100644
index 5620879be37f..000000000000
--- a/include/asm-mips/txx9irq.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * include/asm-mips/txx9irq.h
3 * TX39/TX49 interrupt controller definitions.
4 *
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
7 * for more details.
8 */
9#ifndef __ASM_TXX9IRQ_H
10#define __ASM_TXX9IRQ_H
11
12#include <irq.h>
13
14#ifdef CONFIG_IRQ_CPU
15#define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
16#else
17#ifdef CONFIG_I8259
18#define TXX9_IRQ_BASE (I8259A_IRQ_BASE + 16)
19#else
20#define TXX9_IRQ_BASE 0
21#endif
22#endif
23
24#ifdef CONFIG_CPU_TX39XX
25#define TXx9_MAX_IR 16
26#else
27#define TXx9_MAX_IR 32
28#endif
29
30void txx9_irq_init(unsigned long baseaddr);
31int txx9_irq(void);
32int txx9_irq_set_pri(int irc_irq, int new_pri);
33
34#endif /* __ASM_TXX9IRQ_H */
diff --git a/include/asm-mips/txx9pio.h b/include/asm-mips/txx9pio.h
deleted file mode 100644
index 3d6fa9f8d513..000000000000
--- a/include/asm-mips/txx9pio.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * include/asm-mips/txx9pio.h
3 * TX39/TX49 PIO controller definitions.
4 *
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
7 * for more details.
8 */
9#ifndef __ASM_TXX9PIO_H
10#define __ASM_TXX9PIO_H
11
12#include <linux/types.h>
13
14struct txx9_pio_reg {
15 __u32 dout;
16 __u32 din;
17 __u32 dir;
18 __u32 od;
19 __u32 flag[2];
20 __u32 pol;
21 __u32 intc;
22 __u32 maskcpu;
23 __u32 maskext;
24};
25
26int txx9_gpio_init(unsigned long baseaddr,
27 unsigned int base, unsigned int num);
28
29#endif /* __ASM_TXX9PIO_H */
diff --git a/include/asm-mips/txx9tmr.h b/include/asm-mips/txx9tmr.h
deleted file mode 100644
index 67f70a8f09bd..000000000000
--- a/include/asm-mips/txx9tmr.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * include/asm-mips/txx9tmr.h
3 * TX39/TX49 timer controller definitions.
4 *
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
7 * for more details.
8 */
9#ifndef __ASM_TXX9TMR_H
10#define __ASM_TXX9TMR_H
11
12#include <linux/types.h>
13
14struct txx9_tmr_reg {
15 u32 tcr;
16 u32 tisr;
17 u32 cpra;
18 u32 cprb;
19 u32 itmr;
20 u32 unused0[3];
21 u32 ccdr;
22 u32 unused1[3];
23 u32 pgmr;
24 u32 unused2[3];
25 u32 wtmr;
26 u32 unused3[43];
27 u32 trr;
28};
29
30/* TMTCR : Timer Control */
31#define TXx9_TMTCR_TCE 0x00000080
32#define TXx9_TMTCR_CCDE 0x00000040
33#define TXx9_TMTCR_CRE 0x00000020
34#define TXx9_TMTCR_ECES 0x00000008
35#define TXx9_TMTCR_CCS 0x00000004
36#define TXx9_TMTCR_TMODE_MASK 0x00000003
37#define TXx9_TMTCR_TMODE_ITVL 0x00000000
38#define TXx9_TMTCR_TMODE_PGEN 0x00000001
39#define TXx9_TMTCR_TMODE_WDOG 0x00000002
40
41/* TMTISR : Timer Int. Status */
42#define TXx9_TMTISR_TPIBS 0x00000004
43#define TXx9_TMTISR_TPIAS 0x00000002
44#define TXx9_TMTISR_TIIS 0x00000001
45
46/* TMITMR : Interval Timer Mode */
47#define TXx9_TMITMR_TIIE 0x00008000
48#define TXx9_TMITMR_TZCE 0x00000001
49
50/* TMWTMR : Watchdog Timer Mode */
51#define TXx9_TMWTMR_TWIE 0x00008000
52#define TXx9_TMWTMR_WDIS 0x00000080
53#define TXx9_TMWTMR_TWC 0x00000001
54
55void txx9_clocksource_init(unsigned long baseaddr,
56 unsigned int imbusclk);
57void txx9_clockevent_init(unsigned long baseaddr, int irq,
58 unsigned int imbusclk);
59void txx9_tmr_init(unsigned long baseaddr);
60
61#ifdef CONFIG_CPU_TX39XX
62#define TXX9_TIMER_BITS 24
63#else
64#define TXX9_TIMER_BITS 32
65#endif
66
67#endif /* __ASM_TXX9TMR_H */
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
deleted file mode 100644
index bcbb8d675af5..000000000000
--- a/include/asm-mips/types.h
+++ /dev/null
@@ -1,54 +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) 1994, 1995, 1996, 1999 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */
9#ifndef _ASM_TYPES_H
10#define _ASM_TYPES_H
11
12#if _MIPS_SZLONG == 64
13# include <asm-generic/int-l64.h>
14#else
15# include <asm-generic/int-ll64.h>
16#endif
17
18#ifndef __ASSEMBLY__
19
20typedef unsigned short umode_t;
21
22#endif /* __ASSEMBLY__ */
23
24/*
25 * These aren't exported outside the kernel to avoid name space clashes
26 */
27#ifdef __KERNEL__
28
29#define BITS_PER_LONG _MIPS_SZLONG
30
31#ifndef __ASSEMBLY__
32
33#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
34 || defined(CONFIG_64BIT)
35typedef u64 dma_addr_t;
36#else
37typedef u32 dma_addr_t;
38#endif
39typedef u64 dma64_addr_t;
40
41/*
42 * Don't use phys_t. You've been warned.
43 */
44#ifdef CONFIG_64BIT_PHYS_ADDR
45typedef unsigned long long phys_t;
46#else
47typedef unsigned long phys_t;
48#endif
49
50#endif /* __ASSEMBLY__ */
51
52#endif /* __KERNEL__ */
53
54#endif /* _ASM_TYPES_H */
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
deleted file mode 100644
index 66523d610950..000000000000
--- a/include/asm-mips/uaccess.h
+++ /dev/null
@@ -1,852 +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) 1996, 1997, 1998, 1999, 2000, 03, 04 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2007 Maciej W. Rozycki
9 */
10#ifndef _ASM_UACCESS_H
11#define _ASM_UACCESS_H
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/thread_info.h>
16#include <asm-generic/uaccess.h>
17
18/*
19 * The fs value determines whether argument validity checking should be
20 * performed or not. If get_fs() == USER_DS, checking is performed, with
21 * get_fs() == KERNEL_DS, checking is bypassed.
22 *
23 * For historical reasons, these macros are grossly misnamed.
24 */
25#ifdef CONFIG_32BIT
26
27#define __UA_LIMIT 0x80000000UL
28
29#define __UA_ADDR ".word"
30#define __UA_LA "la"
31#define __UA_ADDU "addu"
32#define __UA_t0 "$8"
33#define __UA_t1 "$9"
34
35#endif /* CONFIG_32BIT */
36
37#ifdef CONFIG_64BIT
38
39#define __UA_LIMIT (- TASK_SIZE)
40
41#define __UA_ADDR ".dword"
42#define __UA_LA "dla"
43#define __UA_ADDU "daddu"
44#define __UA_t0 "$12"
45#define __UA_t1 "$13"
46
47#endif /* CONFIG_64BIT */
48
49/*
50 * USER_DS is a bitmask that has the bits set that may not be set in a valid
51 * userspace address. Note that we limit 32-bit userspace to 0x7fff8000 but
52 * the arithmetic we're doing only works if the limit is a power of two, so
53 * we use 0x80000000 here on 32-bit kernels. If a process passes an invalid
54 * address in this range it's the process's problem, not ours :-)
55 */
56
57#define KERNEL_DS ((mm_segment_t) { 0UL })
58#define USER_DS ((mm_segment_t) { __UA_LIMIT })
59
60#define VERIFY_READ 0
61#define VERIFY_WRITE 1
62
63#define get_ds() (KERNEL_DS)
64#define get_fs() (current_thread_info()->addr_limit)
65#define set_fs(x) (current_thread_info()->addr_limit = (x))
66
67#define segment_eq(a, b) ((a).seg == (b).seg)
68
69
70/*
71 * Is a address valid? This does a straighforward calculation rather
72 * than tests.
73 *
74 * Address valid if:
75 * - "addr" doesn't have any high-bits set
76 * - AND "size" doesn't have any high-bits set
77 * - AND "addr+size" doesn't have any high-bits set
78 * - OR we are in kernel mode.
79 *
80 * __ua_size() is a trick to avoid runtime checking of positive constant
81 * sizes; for those we already know at compile time that the size is ok.
82 */
83#define __ua_size(size) \
84 ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
85
86/*
87 * access_ok: - Checks if a user space pointer is valid
88 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
89 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
90 * to write to a block, it is always safe to read from it.
91 * @addr: User space pointer to start of block to check
92 * @size: Size of block to check
93 *
94 * Context: User context only. This function may sleep.
95 *
96 * Checks if a pointer to a block of memory in user space is valid.
97 *
98 * Returns true (nonzero) if the memory block may be valid, false (zero)
99 * if it is definitely invalid.
100 *
101 * Note that, depending on architecture, this function probably just
102 * checks that the pointer is in the user space range - after calling
103 * this function, memory access functions may still return -EFAULT.
104 */
105
106#define __access_mask get_fs().seg
107
108#define __access_ok(addr, size, mask) \
109 (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)
110
111#define access_ok(type, addr, size) \
112 likely(__access_ok((unsigned long)(addr), (size), __access_mask))
113
114/*
115 * put_user: - Write a simple value into user space.
116 * @x: Value to copy to user space.
117 * @ptr: Destination address, in user space.
118 *
119 * Context: User context only. This function may sleep.
120 *
121 * This macro copies a single simple value from kernel space to user
122 * space. It supports simple types like char and int, but not larger
123 * data types like structures or arrays.
124 *
125 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
126 * to the result of dereferencing @ptr.
127 *
128 * Returns zero on success, or -EFAULT on error.
129 */
130#define put_user(x,ptr) \
131 __put_user_check((x), (ptr), sizeof(*(ptr)))
132
133/*
134 * get_user: - Get a simple variable from user space.
135 * @x: Variable to store result.
136 * @ptr: Source address, in user space.
137 *
138 * Context: User context only. This function may sleep.
139 *
140 * This macro copies a single simple variable from user space to kernel
141 * space. It supports simple types like char and int, but not larger
142 * data types like structures or arrays.
143 *
144 * @ptr must have pointer-to-simple-variable type, and the result of
145 * dereferencing @ptr must be assignable to @x without a cast.
146 *
147 * Returns zero on success, or -EFAULT on error.
148 * On error, the variable @x is set to zero.
149 */
150#define get_user(x,ptr) \
151 __get_user_check((x), (ptr), sizeof(*(ptr)))
152
153/*
154 * __put_user: - Write a simple value into user space, with less checking.
155 * @x: Value to copy to user space.
156 * @ptr: Destination address, in user space.
157 *
158 * Context: User context only. This function may sleep.
159 *
160 * This macro copies a single simple value from kernel space to user
161 * space. It supports simple types like char and int, but not larger
162 * data types like structures or arrays.
163 *
164 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
165 * to the result of dereferencing @ptr.
166 *
167 * Caller must check the pointer with access_ok() before calling this
168 * function.
169 *
170 * Returns zero on success, or -EFAULT on error.
171 */
172#define __put_user(x,ptr) \
173 __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
174
175/*
176 * __get_user: - Get a simple variable from user space, with less checking.
177 * @x: Variable to store result.
178 * @ptr: Source address, in user space.
179 *
180 * Context: User context only. This function may sleep.
181 *
182 * This macro copies a single simple variable from user space to kernel
183 * space. It supports simple types like char and int, but not larger
184 * data types like structures or arrays.
185 *
186 * @ptr must have pointer-to-simple-variable type, and the result of
187 * dereferencing @ptr must be assignable to @x without a cast.
188 *
189 * Caller must check the pointer with access_ok() before calling this
190 * function.
191 *
192 * Returns zero on success, or -EFAULT on error.
193 * On error, the variable @x is set to zero.
194 */
195#define __get_user(x,ptr) \
196 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
197
198struct __large_struct { unsigned long buf[100]; };
199#define __m(x) (*(struct __large_struct __user *)(x))
200
201/*
202 * Yuck. We need two variants, one for 64bit operation and one
203 * for 32 bit mode and old iron.
204 */
205#ifdef CONFIG_32BIT
206#define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr)
207#endif
208#ifdef CONFIG_64BIT
209#define __GET_USER_DW(val, ptr) __get_user_asm(val, "ld", ptr)
210#endif
211
212extern void __get_user_unknown(void);
213
214#define __get_user_common(val, size, ptr) \
215do { \
216 switch (size) { \
217 case 1: __get_user_asm(val, "lb", ptr); break; \
218 case 2: __get_user_asm(val, "lh", ptr); break; \
219 case 4: __get_user_asm(val, "lw", ptr); break; \
220 case 8: __GET_USER_DW(val, ptr); break; \
221 default: __get_user_unknown(); break; \
222 } \
223} while (0)
224
225#define __get_user_nocheck(x, ptr, size) \
226({ \
227 long __gu_err; \
228 \
229 __get_user_common((x), size, ptr); \
230 __gu_err; \
231})
232
233#define __get_user_check(x, ptr, size) \
234({ \
235 long __gu_err = -EFAULT; \
236 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \
237 \
238 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \
239 __get_user_common((x), size, __gu_ptr); \
240 \
241 __gu_err; \
242})
243
244#define __get_user_asm(val, insn, addr) \
245{ \
246 long __gu_tmp; \
247 \
248 __asm__ __volatile__( \
249 "1: " insn " %1, %3 \n" \
250 "2: \n" \
251 " .section .fixup,\"ax\" \n" \
252 "3: li %0, %4 \n" \
253 " j 2b \n" \
254 " .previous \n" \
255 " .section __ex_table,\"a\" \n" \
256 " "__UA_ADDR "\t1b, 3b \n" \
257 " .previous \n" \
258 : "=r" (__gu_err), "=r" (__gu_tmp) \
259 : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); \
260 \
261 (val) = (__typeof__(*(addr))) __gu_tmp; \
262}
263
264/*
265 * Get a long long 64 using 32 bit registers.
266 */
267#define __get_user_asm_ll32(val, addr) \
268{ \
269 union { \
270 unsigned long long l; \
271 __typeof__(*(addr)) t; \
272 } __gu_tmp; \
273 \
274 __asm__ __volatile__( \
275 "1: lw %1, (%3) \n" \
276 "2: lw %D1, 4(%3) \n" \
277 "3: .section .fixup,\"ax\" \n" \
278 "4: li %0, %4 \n" \
279 " move %1, $0 \n" \
280 " move %D1, $0 \n" \
281 " j 3b \n" \
282 " .previous \n" \
283 " .section __ex_table,\"a\" \n" \
284 " " __UA_ADDR " 1b, 4b \n" \
285 " " __UA_ADDR " 2b, 4b \n" \
286 " .previous \n" \
287 : "=r" (__gu_err), "=&r" (__gu_tmp.l) \
288 : "0" (0), "r" (addr), "i" (-EFAULT)); \
289 \
290 (val) = __gu_tmp.t; \
291}
292
293/*
294 * Yuck. We need two variants, one for 64bit operation and one
295 * for 32 bit mode and old iron.
296 */
297#ifdef CONFIG_32BIT
298#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
299#endif
300#ifdef CONFIG_64BIT
301#define __PUT_USER_DW(ptr) __put_user_asm("sd", ptr)
302#endif
303
304#define __put_user_nocheck(x, ptr, size) \
305({ \
306 __typeof__(*(ptr)) __pu_val; \
307 long __pu_err = 0; \
308 \
309 __pu_val = (x); \
310 switch (size) { \
311 case 1: __put_user_asm("sb", ptr); break; \
312 case 2: __put_user_asm("sh", ptr); break; \
313 case 4: __put_user_asm("sw", ptr); break; \
314 case 8: __PUT_USER_DW(ptr); break; \
315 default: __put_user_unknown(); break; \
316 } \
317 __pu_err; \
318})
319
320#define __put_user_check(x, ptr, size) \
321({ \
322 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
323 __typeof__(*(ptr)) __pu_val = (x); \
324 long __pu_err = -EFAULT; \
325 \
326 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \
327 switch (size) { \
328 case 1: __put_user_asm("sb", __pu_addr); break; \
329 case 2: __put_user_asm("sh", __pu_addr); break; \
330 case 4: __put_user_asm("sw", __pu_addr); break; \
331 case 8: __PUT_USER_DW(__pu_addr); break; \
332 default: __put_user_unknown(); break; \
333 } \
334 } \
335 __pu_err; \
336})
337
338#define __put_user_asm(insn, ptr) \
339{ \
340 __asm__ __volatile__( \
341 "1: " insn " %z2, %3 # __put_user_asm\n" \
342 "2: \n" \
343 " .section .fixup,\"ax\" \n" \
344 "3: li %0, %4 \n" \
345 " j 2b \n" \
346 " .previous \n" \
347 " .section __ex_table,\"a\" \n" \
348 " " __UA_ADDR " 1b, 3b \n" \
349 " .previous \n" \
350 : "=r" (__pu_err) \
351 : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)), \
352 "i" (-EFAULT)); \
353}
354
355#define __put_user_asm_ll32(ptr) \
356{ \
357 __asm__ __volatile__( \
358 "1: sw %2, (%3) # __put_user_asm_ll32 \n" \
359 "2: sw %D2, 4(%3) \n" \
360 "3: \n" \
361 " .section .fixup,\"ax\" \n" \
362 "4: li %0, %4 \n" \
363 " j 3b \n" \
364 " .previous \n" \
365 " .section __ex_table,\"a\" \n" \
366 " " __UA_ADDR " 1b, 4b \n" \
367 " " __UA_ADDR " 2b, 4b \n" \
368 " .previous" \
369 : "=r" (__pu_err) \
370 : "0" (0), "r" (__pu_val), "r" (ptr), \
371 "i" (-EFAULT)); \
372}
373
374extern void __put_user_unknown(void);
375
376/*
377 * We're generating jump to subroutines which will be outside the range of
378 * jump instructions
379 */
380#ifdef MODULE
381#define __MODULE_JAL(destination) \
382 ".set\tnoat\n\t" \
383 __UA_LA "\t$1, " #destination "\n\t" \
384 "jalr\t$1\n\t" \
385 ".set\tat\n\t"
386#else
387#define __MODULE_JAL(destination) \
388 "jal\t" #destination "\n\t"
389#endif
390
391#ifndef CONFIG_CPU_DADDI_WORKAROUNDS
392#define DADDI_SCRATCH "$0"
393#else
394#define DADDI_SCRATCH "$3"
395#endif
396
397extern size_t __copy_user(void *__to, const void *__from, size_t __n);
398
399#define __invoke_copy_to_user(to, from, n) \
400({ \
401 register void __user *__cu_to_r __asm__("$4"); \
402 register const void *__cu_from_r __asm__("$5"); \
403 register long __cu_len_r __asm__("$6"); \
404 \
405 __cu_to_r = (to); \
406 __cu_from_r = (from); \
407 __cu_len_r = (n); \
408 __asm__ __volatile__( \
409 __MODULE_JAL(__copy_user) \
410 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
411 : \
412 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
413 DADDI_SCRATCH, "memory"); \
414 __cu_len_r; \
415})
416
417/*
418 * __copy_to_user: - Copy a block of data into user space, with less checking.
419 * @to: Destination address, in user space.
420 * @from: Source address, in kernel space.
421 * @n: Number of bytes to copy.
422 *
423 * Context: User context only. This function may sleep.
424 *
425 * Copy data from kernel space to user space. Caller must check
426 * the specified block with access_ok() before calling this function.
427 *
428 * Returns number of bytes that could not be copied.
429 * On success, this will be zero.
430 */
431#define __copy_to_user(to, from, n) \
432({ \
433 void __user *__cu_to; \
434 const void *__cu_from; \
435 long __cu_len; \
436 \
437 might_sleep(); \
438 __cu_to = (to); \
439 __cu_from = (from); \
440 __cu_len = (n); \
441 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
442 __cu_len; \
443})
444
445extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
446
447#define __copy_to_user_inatomic(to, from, n) \
448({ \
449 void __user *__cu_to; \
450 const void *__cu_from; \
451 long __cu_len; \
452 \
453 __cu_to = (to); \
454 __cu_from = (from); \
455 __cu_len = (n); \
456 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
457 __cu_len; \
458})
459
460#define __copy_from_user_inatomic(to, from, n) \
461({ \
462 void *__cu_to; \
463 const void __user *__cu_from; \
464 long __cu_len; \
465 \
466 __cu_to = (to); \
467 __cu_from = (from); \
468 __cu_len = (n); \
469 __cu_len = __invoke_copy_from_user_inatomic(__cu_to, __cu_from, \
470 __cu_len); \
471 __cu_len; \
472})
473
474/*
475 * copy_to_user: - Copy a block of data into user space.
476 * @to: Destination address, in user space.
477 * @from: Source address, in kernel space.
478 * @n: Number of bytes to copy.
479 *
480 * Context: User context only. This function may sleep.
481 *
482 * Copy data from kernel space to user space.
483 *
484 * Returns number of bytes that could not be copied.
485 * On success, this will be zero.
486 */
487#define copy_to_user(to, from, n) \
488({ \
489 void __user *__cu_to; \
490 const void *__cu_from; \
491 long __cu_len; \
492 \
493 might_sleep(); \
494 __cu_to = (to); \
495 __cu_from = (from); \
496 __cu_len = (n); \
497 if (access_ok(VERIFY_WRITE, __cu_to, __cu_len)) \
498 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, \
499 __cu_len); \
500 __cu_len; \
501})
502
503#define __invoke_copy_from_user(to, from, n) \
504({ \
505 register void *__cu_to_r __asm__("$4"); \
506 register const void __user *__cu_from_r __asm__("$5"); \
507 register long __cu_len_r __asm__("$6"); \
508 \
509 __cu_to_r = (to); \
510 __cu_from_r = (from); \
511 __cu_len_r = (n); \
512 __asm__ __volatile__( \
513 ".set\tnoreorder\n\t" \
514 __MODULE_JAL(__copy_user) \
515 ".set\tnoat\n\t" \
516 __UA_ADDU "\t$1, %1, %2\n\t" \
517 ".set\tat\n\t" \
518 ".set\treorder" \
519 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
520 : \
521 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
522 DADDI_SCRATCH, "memory"); \
523 __cu_len_r; \
524})
525
526#define __invoke_copy_from_user_inatomic(to, from, n) \
527({ \
528 register void *__cu_to_r __asm__("$4"); \
529 register const void __user *__cu_from_r __asm__("$5"); \
530 register long __cu_len_r __asm__("$6"); \
531 \
532 __cu_to_r = (to); \
533 __cu_from_r = (from); \
534 __cu_len_r = (n); \
535 __asm__ __volatile__( \
536 ".set\tnoreorder\n\t" \
537 __MODULE_JAL(__copy_user_inatomic) \
538 ".set\tnoat\n\t" \
539 __UA_ADDU "\t$1, %1, %2\n\t" \
540 ".set\tat\n\t" \
541 ".set\treorder" \
542 : "+r" (__cu_to_r), "+r" (__cu_from_r), "+r" (__cu_len_r) \
543 : \
544 : "$8", "$9", "$10", "$11", "$12", "$15", "$24", "$31", \
545 DADDI_SCRATCH, "memory"); \
546 __cu_len_r; \
547})
548
549/*
550 * __copy_from_user: - Copy a block of data from user space, with less checking.
551 * @to: Destination address, in kernel space.
552 * @from: Source address, in user space.
553 * @n: Number of bytes to copy.
554 *
555 * Context: User context only. This function may sleep.
556 *
557 * Copy data from user space to kernel space. Caller must check
558 * the specified block with access_ok() before calling this function.
559 *
560 * Returns number of bytes that could not be copied.
561 * On success, this will be zero.
562 *
563 * If some data could not be copied, this function will pad the copied
564 * data to the requested size using zero bytes.
565 */
566#define __copy_from_user(to, from, n) \
567({ \
568 void *__cu_to; \
569 const void __user *__cu_from; \
570 long __cu_len; \
571 \
572 might_sleep(); \
573 __cu_to = (to); \
574 __cu_from = (from); \
575 __cu_len = (n); \
576 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
577 __cu_len); \
578 __cu_len; \
579})
580
581/*
582 * copy_from_user: - Copy a block of data from user space.
583 * @to: Destination address, in kernel space.
584 * @from: Source address, in user space.
585 * @n: Number of bytes to copy.
586 *
587 * Context: User context only. This function may sleep.
588 *
589 * Copy data from user space to kernel space.
590 *
591 * Returns number of bytes that could not be copied.
592 * On success, this will be zero.
593 *
594 * If some data could not be copied, this function will pad the copied
595 * data to the requested size using zero bytes.
596 */
597#define copy_from_user(to, from, n) \
598({ \
599 void *__cu_to; \
600 const void __user *__cu_from; \
601 long __cu_len; \
602 \
603 might_sleep(); \
604 __cu_to = (to); \
605 __cu_from = (from); \
606 __cu_len = (n); \
607 if (access_ok(VERIFY_READ, __cu_from, __cu_len)) \
608 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
609 __cu_len); \
610 __cu_len; \
611})
612
613#define __copy_in_user(to, from, n) __copy_from_user(to, from, n)
614
615#define copy_in_user(to, from, n) \
616({ \
617 void __user *__cu_to; \
618 const void __user *__cu_from; \
619 long __cu_len; \
620 \
621 might_sleep(); \
622 __cu_to = (to); \
623 __cu_from = (from); \
624 __cu_len = (n); \
625 if (likely(access_ok(VERIFY_READ, __cu_from, __cu_len) && \
626 access_ok(VERIFY_WRITE, __cu_to, __cu_len))) \
627 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
628 __cu_len); \
629 __cu_len; \
630})
631
632/*
633 * __clear_user: - Zero a block of memory in user space, with less checking.
634 * @to: Destination address, in user space.
635 * @n: Number of bytes to zero.
636 *
637 * Zero a block of memory in user space. Caller must check
638 * the specified block with access_ok() before calling this function.
639 *
640 * Returns number of bytes that could not be cleared.
641 * On success, this will be zero.
642 */
643static inline __kernel_size_t
644__clear_user(void __user *addr, __kernel_size_t size)
645{
646 __kernel_size_t res;
647
648 might_sleep();
649 __asm__ __volatile__(
650 "move\t$4, %1\n\t"
651 "move\t$5, $0\n\t"
652 "move\t$6, %2\n\t"
653 __MODULE_JAL(__bzero)
654 "move\t%0, $6"
655 : "=r" (res)
656 : "r" (addr), "r" (size)
657 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
658
659 return res;
660}
661
662#define clear_user(addr,n) \
663({ \
664 void __user * __cl_addr = (addr); \
665 unsigned long __cl_size = (n); \
666 if (__cl_size && access_ok(VERIFY_WRITE, \
667 ((unsigned long)(__cl_addr)), __cl_size)) \
668 __cl_size = __clear_user(__cl_addr, __cl_size); \
669 __cl_size; \
670})
671
672/*
673 * __strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.
674 * @dst: Destination address, in kernel space. This buffer must be at
675 * least @count bytes long.
676 * @src: Source address, in user space.
677 * @count: Maximum number of bytes to copy, including the trailing NUL.
678 *
679 * Copies a NUL-terminated string from userspace to kernel space.
680 * Caller must check the specified block with access_ok() before calling
681 * this function.
682 *
683 * On success, returns the length of the string (not including the trailing
684 * NUL).
685 *
686 * If access to userspace fails, returns -EFAULT (some data may have been
687 * copied).
688 *
689 * If @count is smaller than the length of the string, copies @count bytes
690 * and returns @count.
691 */
692static inline long
693__strncpy_from_user(char *__to, const char __user *__from, long __len)
694{
695 long res;
696
697 might_sleep();
698 __asm__ __volatile__(
699 "move\t$4, %1\n\t"
700 "move\t$5, %2\n\t"
701 "move\t$6, %3\n\t"
702 __MODULE_JAL(__strncpy_from_user_nocheck_asm)
703 "move\t%0, $2"
704 : "=r" (res)
705 : "r" (__to), "r" (__from), "r" (__len)
706 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
707
708 return res;
709}
710
711/*
712 * strncpy_from_user: - Copy a NUL terminated string from userspace.
713 * @dst: Destination address, in kernel space. This buffer must be at
714 * least @count bytes long.
715 * @src: Source address, in user space.
716 * @count: Maximum number of bytes to copy, including the trailing NUL.
717 *
718 * Copies a NUL-terminated string from userspace to kernel space.
719 *
720 * On success, returns the length of the string (not including the trailing
721 * NUL).
722 *
723 * If access to userspace fails, returns -EFAULT (some data may have been
724 * copied).
725 *
726 * If @count is smaller than the length of the string, copies @count bytes
727 * and returns @count.
728 */
729static inline long
730strncpy_from_user(char *__to, const char __user *__from, long __len)
731{
732 long res;
733
734 might_sleep();
735 __asm__ __volatile__(
736 "move\t$4, %1\n\t"
737 "move\t$5, %2\n\t"
738 "move\t$6, %3\n\t"
739 __MODULE_JAL(__strncpy_from_user_asm)
740 "move\t%0, $2"
741 : "=r" (res)
742 : "r" (__to), "r" (__from), "r" (__len)
743 : "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
744
745 return res;
746}
747
748/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
749static inline long __strlen_user(const char __user *s)
750{
751 long res;
752
753 might_sleep();
754 __asm__ __volatile__(
755 "move\t$4, %1\n\t"
756 __MODULE_JAL(__strlen_user_nocheck_asm)
757 "move\t%0, $2"
758 : "=r" (res)
759 : "r" (s)
760 : "$2", "$4", __UA_t0, "$31");
761
762 return res;
763}
764
765/*
766 * strlen_user: - Get the size of a string in user space.
767 * @str: The string to measure.
768 *
769 * Context: User context only. This function may sleep.
770 *
771 * Get the size of a NUL-terminated string in user space.
772 *
773 * Returns the size of the string INCLUDING the terminating NUL.
774 * On exception, returns 0.
775 *
776 * If there is a limit on the length of a valid string, you may wish to
777 * consider using strnlen_user() instead.
778 */
779static inline long strlen_user(const char __user *s)
780{
781 long res;
782
783 might_sleep();
784 __asm__ __volatile__(
785 "move\t$4, %1\n\t"
786 __MODULE_JAL(__strlen_user_asm)
787 "move\t%0, $2"
788 : "=r" (res)
789 : "r" (s)
790 : "$2", "$4", __UA_t0, "$31");
791
792 return res;
793}
794
795/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
796static inline long __strnlen_user(const char __user *s, long n)
797{
798 long res;
799
800 might_sleep();
801 __asm__ __volatile__(
802 "move\t$4, %1\n\t"
803 "move\t$5, %2\n\t"
804 __MODULE_JAL(__strnlen_user_nocheck_asm)
805 "move\t%0, $2"
806 : "=r" (res)
807 : "r" (s), "r" (n)
808 : "$2", "$4", "$5", __UA_t0, "$31");
809
810 return res;
811}
812
813/*
814 * strlen_user: - Get the size of a string in user space.
815 * @str: The string to measure.
816 *
817 * Context: User context only. This function may sleep.
818 *
819 * Get the size of a NUL-terminated string in user space.
820 *
821 * Returns the size of the string INCLUDING the terminating NUL.
822 * On exception, returns 0.
823 *
824 * If there is a limit on the length of a valid string, you may wish to
825 * consider using strnlen_user() instead.
826 */
827static inline long strnlen_user(const char __user *s, long n)
828{
829 long res;
830
831 might_sleep();
832 __asm__ __volatile__(
833 "move\t$4, %1\n\t"
834 "move\t$5, %2\n\t"
835 __MODULE_JAL(__strnlen_user_asm)
836 "move\t%0, $2"
837 : "=r" (res)
838 : "r" (s), "r" (n)
839 : "$2", "$4", "$5", __UA_t0, "$31");
840
841 return res;
842}
843
844struct exception_table_entry
845{
846 unsigned long insn;
847 unsigned long nextinsn;
848};
849
850extern int fixup_exception(struct pt_regs *regs);
851
852#endif /* _ASM_UACCESS_H */
diff --git a/include/asm-mips/ucontext.h b/include/asm-mips/ucontext.h
deleted file mode 100644
index 8a4b20e88b81..000000000000
--- a/include/asm-mips/ucontext.h
+++ /dev/null
@@ -1,21 +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 * Low level exception handling
7 *
8 * Copyright (C) 1998, 1999 by Ralf Baechle
9 */
10#ifndef _ASM_UCONTEXT_H
11#define _ASM_UCONTEXT_H
12
13struct ucontext {
14 unsigned long uc_flags;
15 struct ucontext *uc_link;
16 stack_t uc_stack;
17 struct sigcontext uc_mcontext;
18 sigset_t uc_sigmask; /* mask last for extensibility */
19};
20
21#endif /* _ASM_UCONTEXT_H */
diff --git a/include/asm-mips/unaligned.h b/include/asm-mips/unaligned.h
deleted file mode 100644
index 792404948571..000000000000
--- a/include/asm-mips/unaligned.h
+++ /dev/null
@@ -1,28 +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) 2007 Ralf Baechle (ralf@linux-mips.org)
7 */
8#ifndef _ASM_MIPS_UNALIGNED_H
9#define _ASM_MIPS_UNALIGNED_H
10
11#include <linux/compiler.h>
12#if defined(__MIPSEB__)
13# include <linux/unaligned/be_struct.h>
14# include <linux/unaligned/le_byteshift.h>
15# include <linux/unaligned/generic.h>
16# define get_unaligned __get_unaligned_be
17# define put_unaligned __put_unaligned_be
18#elif defined(__MIPSEL__)
19# include <linux/unaligned/le_struct.h>
20# include <linux/unaligned/be_byteshift.h>
21# include <linux/unaligned/generic.h>
22# define get_unaligned __get_unaligned_le
23# define put_unaligned __put_unaligned_le
24#else
25# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
26#endif
27
28#endif /* _ASM_MIPS_UNALIGNED_H */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
deleted file mode 100644
index a73e1531e151..000000000000
--- a/include/asm-mips/unistd.h
+++ /dev/null
@@ -1,1037 +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) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle
7 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8 *
9 * Changed system calls macros _syscall5 - _syscall7 to push args 5 to 7 onto
10 * the stack. Robin Farine for ACN S.A, Copyright (C) 1996 by ACN S.A
11 */
12#ifndef _ASM_UNISTD_H
13#define _ASM_UNISTD_H
14
15#include <asm/sgidefs.h>
16
17#if _MIPS_SIM == _MIPS_SIM_ABI32
18
19/*
20 * Linux o32 style syscalls are in the range from 4000 to 4999.
21 */
22#define __NR_Linux 4000
23#define __NR_syscall (__NR_Linux + 0)
24#define __NR_exit (__NR_Linux + 1)
25#define __NR_fork (__NR_Linux + 2)
26#define __NR_read (__NR_Linux + 3)
27#define __NR_write (__NR_Linux + 4)
28#define __NR_open (__NR_Linux + 5)
29#define __NR_close (__NR_Linux + 6)
30#define __NR_waitpid (__NR_Linux + 7)
31#define __NR_creat (__NR_Linux + 8)
32#define __NR_link (__NR_Linux + 9)
33#define __NR_unlink (__NR_Linux + 10)
34#define __NR_execve (__NR_Linux + 11)
35#define __NR_chdir (__NR_Linux + 12)
36#define __NR_time (__NR_Linux + 13)
37#define __NR_mknod (__NR_Linux + 14)
38#define __NR_chmod (__NR_Linux + 15)
39#define __NR_lchown (__NR_Linux + 16)
40#define __NR_break (__NR_Linux + 17)
41#define __NR_unused18 (__NR_Linux + 18)
42#define __NR_lseek (__NR_Linux + 19)
43#define __NR_getpid (__NR_Linux + 20)
44#define __NR_mount (__NR_Linux + 21)
45#define __NR_umount (__NR_Linux + 22)
46#define __NR_setuid (__NR_Linux + 23)
47#define __NR_getuid (__NR_Linux + 24)
48#define __NR_stime (__NR_Linux + 25)
49#define __NR_ptrace (__NR_Linux + 26)
50#define __NR_alarm (__NR_Linux + 27)
51#define __NR_unused28 (__NR_Linux + 28)
52#define __NR_pause (__NR_Linux + 29)
53#define __NR_utime (__NR_Linux + 30)
54#define __NR_stty (__NR_Linux + 31)
55#define __NR_gtty (__NR_Linux + 32)
56#define __NR_access (__NR_Linux + 33)
57#define __NR_nice (__NR_Linux + 34)
58#define __NR_ftime (__NR_Linux + 35)
59#define __NR_sync (__NR_Linux + 36)
60#define __NR_kill (__NR_Linux + 37)
61#define __NR_rename (__NR_Linux + 38)
62#define __NR_mkdir (__NR_Linux + 39)
63#define __NR_rmdir (__NR_Linux + 40)
64#define __NR_dup (__NR_Linux + 41)
65#define __NR_pipe (__NR_Linux + 42)
66#define __NR_times (__NR_Linux + 43)
67#define __NR_prof (__NR_Linux + 44)
68#define __NR_brk (__NR_Linux + 45)
69#define __NR_setgid (__NR_Linux + 46)
70#define __NR_getgid (__NR_Linux + 47)
71#define __NR_signal (__NR_Linux + 48)
72#define __NR_geteuid (__NR_Linux + 49)
73#define __NR_getegid (__NR_Linux + 50)
74#define __NR_acct (__NR_Linux + 51)
75#define __NR_umount2 (__NR_Linux + 52)
76#define __NR_lock (__NR_Linux + 53)
77#define __NR_ioctl (__NR_Linux + 54)
78#define __NR_fcntl (__NR_Linux + 55)
79#define __NR_mpx (__NR_Linux + 56)
80#define __NR_setpgid (__NR_Linux + 57)
81#define __NR_ulimit (__NR_Linux + 58)
82#define __NR_unused59 (__NR_Linux + 59)
83#define __NR_umask (__NR_Linux + 60)
84#define __NR_chroot (__NR_Linux + 61)
85#define __NR_ustat (__NR_Linux + 62)
86#define __NR_dup2 (__NR_Linux + 63)
87#define __NR_getppid (__NR_Linux + 64)
88#define __NR_getpgrp (__NR_Linux + 65)
89#define __NR_setsid (__NR_Linux + 66)
90#define __NR_sigaction (__NR_Linux + 67)
91#define __NR_sgetmask (__NR_Linux + 68)
92#define __NR_ssetmask (__NR_Linux + 69)
93#define __NR_setreuid (__NR_Linux + 70)
94#define __NR_setregid (__NR_Linux + 71)
95#define __NR_sigsuspend (__NR_Linux + 72)
96#define __NR_sigpending (__NR_Linux + 73)
97#define __NR_sethostname (__NR_Linux + 74)
98#define __NR_setrlimit (__NR_Linux + 75)
99#define __NR_getrlimit (__NR_Linux + 76)
100#define __NR_getrusage (__NR_Linux + 77)
101#define __NR_gettimeofday (__NR_Linux + 78)
102#define __NR_settimeofday (__NR_Linux + 79)
103#define __NR_getgroups (__NR_Linux + 80)
104#define __NR_setgroups (__NR_Linux + 81)
105#define __NR_reserved82 (__NR_Linux + 82)
106#define __NR_symlink (__NR_Linux + 83)
107#define __NR_unused84 (__NR_Linux + 84)
108#define __NR_readlink (__NR_Linux + 85)
109#define __NR_uselib (__NR_Linux + 86)
110#define __NR_swapon (__NR_Linux + 87)
111#define __NR_reboot (__NR_Linux + 88)
112#define __NR_readdir (__NR_Linux + 89)
113#define __NR_mmap (__NR_Linux + 90)
114#define __NR_munmap (__NR_Linux + 91)
115#define __NR_truncate (__NR_Linux + 92)
116#define __NR_ftruncate (__NR_Linux + 93)
117#define __NR_fchmod (__NR_Linux + 94)
118#define __NR_fchown (__NR_Linux + 95)
119#define __NR_getpriority (__NR_Linux + 96)
120#define __NR_setpriority (__NR_Linux + 97)
121#define __NR_profil (__NR_Linux + 98)
122#define __NR_statfs (__NR_Linux + 99)
123#define __NR_fstatfs (__NR_Linux + 100)
124#define __NR_ioperm (__NR_Linux + 101)
125#define __NR_socketcall (__NR_Linux + 102)
126#define __NR_syslog (__NR_Linux + 103)
127#define __NR_setitimer (__NR_Linux + 104)
128#define __NR_getitimer (__NR_Linux + 105)
129#define __NR_stat (__NR_Linux + 106)
130#define __NR_lstat (__NR_Linux + 107)
131#define __NR_fstat (__NR_Linux + 108)
132#define __NR_unused109 (__NR_Linux + 109)
133#define __NR_iopl (__NR_Linux + 110)
134#define __NR_vhangup (__NR_Linux + 111)
135#define __NR_idle (__NR_Linux + 112)
136#define __NR_vm86 (__NR_Linux + 113)
137#define __NR_wait4 (__NR_Linux + 114)
138#define __NR_swapoff (__NR_Linux + 115)
139#define __NR_sysinfo (__NR_Linux + 116)
140#define __NR_ipc (__NR_Linux + 117)
141#define __NR_fsync (__NR_Linux + 118)
142#define __NR_sigreturn (__NR_Linux + 119)
143#define __NR_clone (__NR_Linux + 120)
144#define __NR_setdomainname (__NR_Linux + 121)
145#define __NR_uname (__NR_Linux + 122)
146#define __NR_modify_ldt (__NR_Linux + 123)
147#define __NR_adjtimex (__NR_Linux + 124)
148#define __NR_mprotect (__NR_Linux + 125)
149#define __NR_sigprocmask (__NR_Linux + 126)
150#define __NR_create_module (__NR_Linux + 127)
151#define __NR_init_module (__NR_Linux + 128)
152#define __NR_delete_module (__NR_Linux + 129)
153#define __NR_get_kernel_syms (__NR_Linux + 130)
154#define __NR_quotactl (__NR_Linux + 131)
155#define __NR_getpgid (__NR_Linux + 132)
156#define __NR_fchdir (__NR_Linux + 133)
157#define __NR_bdflush (__NR_Linux + 134)
158#define __NR_sysfs (__NR_Linux + 135)
159#define __NR_personality (__NR_Linux + 136)
160#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */
161#define __NR_setfsuid (__NR_Linux + 138)
162#define __NR_setfsgid (__NR_Linux + 139)
163#define __NR__llseek (__NR_Linux + 140)
164#define __NR_getdents (__NR_Linux + 141)
165#define __NR__newselect (__NR_Linux + 142)
166#define __NR_flock (__NR_Linux + 143)
167#define __NR_msync (__NR_Linux + 144)
168#define __NR_readv (__NR_Linux + 145)
169#define __NR_writev (__NR_Linux + 146)
170#define __NR_cacheflush (__NR_Linux + 147)
171#define __NR_cachectl (__NR_Linux + 148)
172#define __NR_sysmips (__NR_Linux + 149)
173#define __NR_unused150 (__NR_Linux + 150)
174#define __NR_getsid (__NR_Linux + 151)
175#define __NR_fdatasync (__NR_Linux + 152)
176#define __NR__sysctl (__NR_Linux + 153)
177#define __NR_mlock (__NR_Linux + 154)
178#define __NR_munlock (__NR_Linux + 155)
179#define __NR_mlockall (__NR_Linux + 156)
180#define __NR_munlockall (__NR_Linux + 157)
181#define __NR_sched_setparam (__NR_Linux + 158)
182#define __NR_sched_getparam (__NR_Linux + 159)
183#define __NR_sched_setscheduler (__NR_Linux + 160)
184#define __NR_sched_getscheduler (__NR_Linux + 161)
185#define __NR_sched_yield (__NR_Linux + 162)
186#define __NR_sched_get_priority_max (__NR_Linux + 163)
187#define __NR_sched_get_priority_min (__NR_Linux + 164)
188#define __NR_sched_rr_get_interval (__NR_Linux + 165)
189#define __NR_nanosleep (__NR_Linux + 166)
190#define __NR_mremap (__NR_Linux + 167)
191#define __NR_accept (__NR_Linux + 168)
192#define __NR_bind (__NR_Linux + 169)
193#define __NR_connect (__NR_Linux + 170)
194#define __NR_getpeername (__NR_Linux + 171)
195#define __NR_getsockname (__NR_Linux + 172)
196#define __NR_getsockopt (__NR_Linux + 173)
197#define __NR_listen (__NR_Linux + 174)
198#define __NR_recv (__NR_Linux + 175)
199#define __NR_recvfrom (__NR_Linux + 176)
200#define __NR_recvmsg (__NR_Linux + 177)
201#define __NR_send (__NR_Linux + 178)
202#define __NR_sendmsg (__NR_Linux + 179)
203#define __NR_sendto (__NR_Linux + 180)
204#define __NR_setsockopt (__NR_Linux + 181)
205#define __NR_shutdown (__NR_Linux + 182)
206#define __NR_socket (__NR_Linux + 183)
207#define __NR_socketpair (__NR_Linux + 184)
208#define __NR_setresuid (__NR_Linux + 185)
209#define __NR_getresuid (__NR_Linux + 186)
210#define __NR_query_module (__NR_Linux + 187)
211#define __NR_poll (__NR_Linux + 188)
212#define __NR_nfsservctl (__NR_Linux + 189)
213#define __NR_setresgid (__NR_Linux + 190)
214#define __NR_getresgid (__NR_Linux + 191)
215#define __NR_prctl (__NR_Linux + 192)
216#define __NR_rt_sigreturn (__NR_Linux + 193)
217#define __NR_rt_sigaction (__NR_Linux + 194)
218#define __NR_rt_sigprocmask (__NR_Linux + 195)
219#define __NR_rt_sigpending (__NR_Linux + 196)
220#define __NR_rt_sigtimedwait (__NR_Linux + 197)
221#define __NR_rt_sigqueueinfo (__NR_Linux + 198)
222#define __NR_rt_sigsuspend (__NR_Linux + 199)
223#define __NR_pread64 (__NR_Linux + 200)
224#define __NR_pwrite64 (__NR_Linux + 201)
225#define __NR_chown (__NR_Linux + 202)
226#define __NR_getcwd (__NR_Linux + 203)
227#define __NR_capget (__NR_Linux + 204)
228#define __NR_capset (__NR_Linux + 205)
229#define __NR_sigaltstack (__NR_Linux + 206)
230#define __NR_sendfile (__NR_Linux + 207)
231#define __NR_getpmsg (__NR_Linux + 208)
232#define __NR_putpmsg (__NR_Linux + 209)
233#define __NR_mmap2 (__NR_Linux + 210)
234#define __NR_truncate64 (__NR_Linux + 211)
235#define __NR_ftruncate64 (__NR_Linux + 212)
236#define __NR_stat64 (__NR_Linux + 213)
237#define __NR_lstat64 (__NR_Linux + 214)
238#define __NR_fstat64 (__NR_Linux + 215)
239#define __NR_pivot_root (__NR_Linux + 216)
240#define __NR_mincore (__NR_Linux + 217)
241#define __NR_madvise (__NR_Linux + 218)
242#define __NR_getdents64 (__NR_Linux + 219)
243#define __NR_fcntl64 (__NR_Linux + 220)
244#define __NR_reserved221 (__NR_Linux + 221)
245#define __NR_gettid (__NR_Linux + 222)
246#define __NR_readahead (__NR_Linux + 223)
247#define __NR_setxattr (__NR_Linux + 224)
248#define __NR_lsetxattr (__NR_Linux + 225)
249#define __NR_fsetxattr (__NR_Linux + 226)
250#define __NR_getxattr (__NR_Linux + 227)
251#define __NR_lgetxattr (__NR_Linux + 228)
252#define __NR_fgetxattr (__NR_Linux + 229)
253#define __NR_listxattr (__NR_Linux + 230)
254#define __NR_llistxattr (__NR_Linux + 231)
255#define __NR_flistxattr (__NR_Linux + 232)
256#define __NR_removexattr (__NR_Linux + 233)
257#define __NR_lremovexattr (__NR_Linux + 234)
258#define __NR_fremovexattr (__NR_Linux + 235)
259#define __NR_tkill (__NR_Linux + 236)
260#define __NR_sendfile64 (__NR_Linux + 237)
261#define __NR_futex (__NR_Linux + 238)
262#define __NR_sched_setaffinity (__NR_Linux + 239)
263#define __NR_sched_getaffinity (__NR_Linux + 240)
264#define __NR_io_setup (__NR_Linux + 241)
265#define __NR_io_destroy (__NR_Linux + 242)
266#define __NR_io_getevents (__NR_Linux + 243)
267#define __NR_io_submit (__NR_Linux + 244)
268#define __NR_io_cancel (__NR_Linux + 245)
269#define __NR_exit_group (__NR_Linux + 246)
270#define __NR_lookup_dcookie (__NR_Linux + 247)
271#define __NR_epoll_create (__NR_Linux + 248)
272#define __NR_epoll_ctl (__NR_Linux + 249)
273#define __NR_epoll_wait (__NR_Linux + 250)
274#define __NR_remap_file_pages (__NR_Linux + 251)
275#define __NR_set_tid_address (__NR_Linux + 252)
276#define __NR_restart_syscall (__NR_Linux + 253)
277#define __NR_fadvise64 (__NR_Linux + 254)
278#define __NR_statfs64 (__NR_Linux + 255)
279#define __NR_fstatfs64 (__NR_Linux + 256)
280#define __NR_timer_create (__NR_Linux + 257)
281#define __NR_timer_settime (__NR_Linux + 258)
282#define __NR_timer_gettime (__NR_Linux + 259)
283#define __NR_timer_getoverrun (__NR_Linux + 260)
284#define __NR_timer_delete (__NR_Linux + 261)
285#define __NR_clock_settime (__NR_Linux + 262)
286#define __NR_clock_gettime (__NR_Linux + 263)
287#define __NR_clock_getres (__NR_Linux + 264)
288#define __NR_clock_nanosleep (__NR_Linux + 265)
289#define __NR_tgkill (__NR_Linux + 266)
290#define __NR_utimes (__NR_Linux + 267)
291#define __NR_mbind (__NR_Linux + 268)
292#define __NR_get_mempolicy (__NR_Linux + 269)
293#define __NR_set_mempolicy (__NR_Linux + 270)
294#define __NR_mq_open (__NR_Linux + 271)
295#define __NR_mq_unlink (__NR_Linux + 272)
296#define __NR_mq_timedsend (__NR_Linux + 273)
297#define __NR_mq_timedreceive (__NR_Linux + 274)
298#define __NR_mq_notify (__NR_Linux + 275)
299#define __NR_mq_getsetattr (__NR_Linux + 276)
300#define __NR_vserver (__NR_Linux + 277)
301#define __NR_waitid (__NR_Linux + 278)
302/* #define __NR_sys_setaltroot (__NR_Linux + 279) */
303#define __NR_add_key (__NR_Linux + 280)
304#define __NR_request_key (__NR_Linux + 281)
305#define __NR_keyctl (__NR_Linux + 282)
306#define __NR_set_thread_area (__NR_Linux + 283)
307#define __NR_inotify_init (__NR_Linux + 284)
308#define __NR_inotify_add_watch (__NR_Linux + 285)
309#define __NR_inotify_rm_watch (__NR_Linux + 286)
310#define __NR_migrate_pages (__NR_Linux + 287)
311#define __NR_openat (__NR_Linux + 288)
312#define __NR_mkdirat (__NR_Linux + 289)
313#define __NR_mknodat (__NR_Linux + 290)
314#define __NR_fchownat (__NR_Linux + 291)
315#define __NR_futimesat (__NR_Linux + 292)
316#define __NR_fstatat64 (__NR_Linux + 293)
317#define __NR_unlinkat (__NR_Linux + 294)
318#define __NR_renameat (__NR_Linux + 295)
319#define __NR_linkat (__NR_Linux + 296)
320#define __NR_symlinkat (__NR_Linux + 297)
321#define __NR_readlinkat (__NR_Linux + 298)
322#define __NR_fchmodat (__NR_Linux + 299)
323#define __NR_faccessat (__NR_Linux + 300)
324#define __NR_pselect6 (__NR_Linux + 301)
325#define __NR_ppoll (__NR_Linux + 302)
326#define __NR_unshare (__NR_Linux + 303)
327#define __NR_splice (__NR_Linux + 304)
328#define __NR_sync_file_range (__NR_Linux + 305)
329#define __NR_tee (__NR_Linux + 306)
330#define __NR_vmsplice (__NR_Linux + 307)
331#define __NR_move_pages (__NR_Linux + 308)
332#define __NR_set_robust_list (__NR_Linux + 309)
333#define __NR_get_robust_list (__NR_Linux + 310)
334#define __NR_kexec_load (__NR_Linux + 311)
335#define __NR_getcpu (__NR_Linux + 312)
336#define __NR_epoll_pwait (__NR_Linux + 313)
337#define __NR_ioprio_set (__NR_Linux + 314)
338#define __NR_ioprio_get (__NR_Linux + 315)
339#define __NR_utimensat (__NR_Linux + 316)
340#define __NR_signalfd (__NR_Linux + 317)
341#define __NR_timerfd (__NR_Linux + 318)
342#define __NR_eventfd (__NR_Linux + 319)
343#define __NR_fallocate (__NR_Linux + 320)
344#define __NR_timerfd_create (__NR_Linux + 321)
345#define __NR_timerfd_gettime (__NR_Linux + 322)
346#define __NR_timerfd_settime (__NR_Linux + 323)
347#define __NR_signalfd4 (__NR_Linux + 324)
348#define __NR_eventfd2 (__NR_Linux + 325)
349#define __NR_epoll_create1 (__NR_Linux + 326)
350#define __NR_dup3 (__NR_Linux + 327)
351#define __NR_pipe2 (__NR_Linux + 328)
352#define __NR_inotify_init1 (__NR_Linux + 329)
353
354/*
355 * Offset of the last Linux o32 flavoured syscall
356 */
357#define __NR_Linux_syscalls 329
358
359#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
360
361#define __NR_O32_Linux 4000
362#define __NR_O32_Linux_syscalls 329
363
364#if _MIPS_SIM == _MIPS_SIM_ABI64
365
366/*
367 * Linux 64-bit syscalls are in the range from 5000 to 5999.
368 */
369#define __NR_Linux 5000
370#define __NR_read (__NR_Linux + 0)
371#define __NR_write (__NR_Linux + 1)
372#define __NR_open (__NR_Linux + 2)
373#define __NR_close (__NR_Linux + 3)
374#define __NR_stat (__NR_Linux + 4)
375#define __NR_fstat (__NR_Linux + 5)
376#define __NR_lstat (__NR_Linux + 6)
377#define __NR_poll (__NR_Linux + 7)
378#define __NR_lseek (__NR_Linux + 8)
379#define __NR_mmap (__NR_Linux + 9)
380#define __NR_mprotect (__NR_Linux + 10)
381#define __NR_munmap (__NR_Linux + 11)
382#define __NR_brk (__NR_Linux + 12)
383#define __NR_rt_sigaction (__NR_Linux + 13)
384#define __NR_rt_sigprocmask (__NR_Linux + 14)
385#define __NR_ioctl (__NR_Linux + 15)
386#define __NR_pread64 (__NR_Linux + 16)
387#define __NR_pwrite64 (__NR_Linux + 17)
388#define __NR_readv (__NR_Linux + 18)
389#define __NR_writev (__NR_Linux + 19)
390#define __NR_access (__NR_Linux + 20)
391#define __NR_pipe (__NR_Linux + 21)
392#define __NR__newselect (__NR_Linux + 22)
393#define __NR_sched_yield (__NR_Linux + 23)
394#define __NR_mremap (__NR_Linux + 24)
395#define __NR_msync (__NR_Linux + 25)
396#define __NR_mincore (__NR_Linux + 26)
397#define __NR_madvise (__NR_Linux + 27)
398#define __NR_shmget (__NR_Linux + 28)
399#define __NR_shmat (__NR_Linux + 29)
400#define __NR_shmctl (__NR_Linux + 30)
401#define __NR_dup (__NR_Linux + 31)
402#define __NR_dup2 (__NR_Linux + 32)
403#define __NR_pause (__NR_Linux + 33)
404#define __NR_nanosleep (__NR_Linux + 34)
405#define __NR_getitimer (__NR_Linux + 35)
406#define __NR_setitimer (__NR_Linux + 36)
407#define __NR_alarm (__NR_Linux + 37)
408#define __NR_getpid (__NR_Linux + 38)
409#define __NR_sendfile (__NR_Linux + 39)
410#define __NR_socket (__NR_Linux + 40)
411#define __NR_connect (__NR_Linux + 41)
412#define __NR_accept (__NR_Linux + 42)
413#define __NR_sendto (__NR_Linux + 43)
414#define __NR_recvfrom (__NR_Linux + 44)
415#define __NR_sendmsg (__NR_Linux + 45)
416#define __NR_recvmsg (__NR_Linux + 46)
417#define __NR_shutdown (__NR_Linux + 47)
418#define __NR_bind (__NR_Linux + 48)
419#define __NR_listen (__NR_Linux + 49)
420#define __NR_getsockname (__NR_Linux + 50)
421#define __NR_getpeername (__NR_Linux + 51)
422#define __NR_socketpair (__NR_Linux + 52)
423#define __NR_setsockopt (__NR_Linux + 53)
424#define __NR_getsockopt (__NR_Linux + 54)
425#define __NR_clone (__NR_Linux + 55)
426#define __NR_fork (__NR_Linux + 56)
427#define __NR_execve (__NR_Linux + 57)
428#define __NR_exit (__NR_Linux + 58)
429#define __NR_wait4 (__NR_Linux + 59)
430#define __NR_kill (__NR_Linux + 60)
431#define __NR_uname (__NR_Linux + 61)
432#define __NR_semget (__NR_Linux + 62)
433#define __NR_semop (__NR_Linux + 63)
434#define __NR_semctl (__NR_Linux + 64)
435#define __NR_shmdt (__NR_Linux + 65)
436#define __NR_msgget (__NR_Linux + 66)
437#define __NR_msgsnd (__NR_Linux + 67)
438#define __NR_msgrcv (__NR_Linux + 68)
439#define __NR_msgctl (__NR_Linux + 69)
440#define __NR_fcntl (__NR_Linux + 70)
441#define __NR_flock (__NR_Linux + 71)
442#define __NR_fsync (__NR_Linux + 72)
443#define __NR_fdatasync (__NR_Linux + 73)
444#define __NR_truncate (__NR_Linux + 74)
445#define __NR_ftruncate (__NR_Linux + 75)
446#define __NR_getdents (__NR_Linux + 76)
447#define __NR_getcwd (__NR_Linux + 77)
448#define __NR_chdir (__NR_Linux + 78)
449#define __NR_fchdir (__NR_Linux + 79)
450#define __NR_rename (__NR_Linux + 80)
451#define __NR_mkdir (__NR_Linux + 81)
452#define __NR_rmdir (__NR_Linux + 82)
453#define __NR_creat (__NR_Linux + 83)
454#define __NR_link (__NR_Linux + 84)
455#define __NR_unlink (__NR_Linux + 85)
456#define __NR_symlink (__NR_Linux + 86)
457#define __NR_readlink (__NR_Linux + 87)
458#define __NR_chmod (__NR_Linux + 88)
459#define __NR_fchmod (__NR_Linux + 89)
460#define __NR_chown (__NR_Linux + 90)
461#define __NR_fchown (__NR_Linux + 91)
462#define __NR_lchown (__NR_Linux + 92)
463#define __NR_umask (__NR_Linux + 93)
464#define __NR_gettimeofday (__NR_Linux + 94)
465#define __NR_getrlimit (__NR_Linux + 95)
466#define __NR_getrusage (__NR_Linux + 96)
467#define __NR_sysinfo (__NR_Linux + 97)
468#define __NR_times (__NR_Linux + 98)
469#define __NR_ptrace (__NR_Linux + 99)
470#define __NR_getuid (__NR_Linux + 100)
471#define __NR_syslog (__NR_Linux + 101)
472#define __NR_getgid (__NR_Linux + 102)
473#define __NR_setuid (__NR_Linux + 103)
474#define __NR_setgid (__NR_Linux + 104)
475#define __NR_geteuid (__NR_Linux + 105)
476#define __NR_getegid (__NR_Linux + 106)
477#define __NR_setpgid (__NR_Linux + 107)
478#define __NR_getppid (__NR_Linux + 108)
479#define __NR_getpgrp (__NR_Linux + 109)
480#define __NR_setsid (__NR_Linux + 110)
481#define __NR_setreuid (__NR_Linux + 111)
482#define __NR_setregid (__NR_Linux + 112)
483#define __NR_getgroups (__NR_Linux + 113)
484#define __NR_setgroups (__NR_Linux + 114)
485#define __NR_setresuid (__NR_Linux + 115)
486#define __NR_getresuid (__NR_Linux + 116)
487#define __NR_setresgid (__NR_Linux + 117)
488#define __NR_getresgid (__NR_Linux + 118)
489#define __NR_getpgid (__NR_Linux + 119)
490#define __NR_setfsuid (__NR_Linux + 120)
491#define __NR_setfsgid (__NR_Linux + 121)
492#define __NR_getsid (__NR_Linux + 122)
493#define __NR_capget (__NR_Linux + 123)
494#define __NR_capset (__NR_Linux + 124)
495#define __NR_rt_sigpending (__NR_Linux + 125)
496#define __NR_rt_sigtimedwait (__NR_Linux + 126)
497#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
498#define __NR_rt_sigsuspend (__NR_Linux + 128)
499#define __NR_sigaltstack (__NR_Linux + 129)
500#define __NR_utime (__NR_Linux + 130)
501#define __NR_mknod (__NR_Linux + 131)
502#define __NR_personality (__NR_Linux + 132)
503#define __NR_ustat (__NR_Linux + 133)
504#define __NR_statfs (__NR_Linux + 134)
505#define __NR_fstatfs (__NR_Linux + 135)
506#define __NR_sysfs (__NR_Linux + 136)
507#define __NR_getpriority (__NR_Linux + 137)
508#define __NR_setpriority (__NR_Linux + 138)
509#define __NR_sched_setparam (__NR_Linux + 139)
510#define __NR_sched_getparam (__NR_Linux + 140)
511#define __NR_sched_setscheduler (__NR_Linux + 141)
512#define __NR_sched_getscheduler (__NR_Linux + 142)
513#define __NR_sched_get_priority_max (__NR_Linux + 143)
514#define __NR_sched_get_priority_min (__NR_Linux + 144)
515#define __NR_sched_rr_get_interval (__NR_Linux + 145)
516#define __NR_mlock (__NR_Linux + 146)
517#define __NR_munlock (__NR_Linux + 147)
518#define __NR_mlockall (__NR_Linux + 148)
519#define __NR_munlockall (__NR_Linux + 149)
520#define __NR_vhangup (__NR_Linux + 150)
521#define __NR_pivot_root (__NR_Linux + 151)
522#define __NR__sysctl (__NR_Linux + 152)
523#define __NR_prctl (__NR_Linux + 153)
524#define __NR_adjtimex (__NR_Linux + 154)
525#define __NR_setrlimit (__NR_Linux + 155)
526#define __NR_chroot (__NR_Linux + 156)
527#define __NR_sync (__NR_Linux + 157)
528#define __NR_acct (__NR_Linux + 158)
529#define __NR_settimeofday (__NR_Linux + 159)
530#define __NR_mount (__NR_Linux + 160)
531#define __NR_umount2 (__NR_Linux + 161)
532#define __NR_swapon (__NR_Linux + 162)
533#define __NR_swapoff (__NR_Linux + 163)
534#define __NR_reboot (__NR_Linux + 164)
535#define __NR_sethostname (__NR_Linux + 165)
536#define __NR_setdomainname (__NR_Linux + 166)
537#define __NR_create_module (__NR_Linux + 167)
538#define __NR_init_module (__NR_Linux + 168)
539#define __NR_delete_module (__NR_Linux + 169)
540#define __NR_get_kernel_syms (__NR_Linux + 170)
541#define __NR_query_module (__NR_Linux + 171)
542#define __NR_quotactl (__NR_Linux + 172)
543#define __NR_nfsservctl (__NR_Linux + 173)
544#define __NR_getpmsg (__NR_Linux + 174)
545#define __NR_putpmsg (__NR_Linux + 175)
546#define __NR_afs_syscall (__NR_Linux + 176)
547#define __NR_reserved177 (__NR_Linux + 177)
548#define __NR_gettid (__NR_Linux + 178)
549#define __NR_readahead (__NR_Linux + 179)
550#define __NR_setxattr (__NR_Linux + 180)
551#define __NR_lsetxattr (__NR_Linux + 181)
552#define __NR_fsetxattr (__NR_Linux + 182)
553#define __NR_getxattr (__NR_Linux + 183)
554#define __NR_lgetxattr (__NR_Linux + 184)
555#define __NR_fgetxattr (__NR_Linux + 185)
556#define __NR_listxattr (__NR_Linux + 186)
557#define __NR_llistxattr (__NR_Linux + 187)
558#define __NR_flistxattr (__NR_Linux + 188)
559#define __NR_removexattr (__NR_Linux + 189)
560#define __NR_lremovexattr (__NR_Linux + 190)
561#define __NR_fremovexattr (__NR_Linux + 191)
562#define __NR_tkill (__NR_Linux + 192)
563#define __NR_reserved193 (__NR_Linux + 193)
564#define __NR_futex (__NR_Linux + 194)
565#define __NR_sched_setaffinity (__NR_Linux + 195)
566#define __NR_sched_getaffinity (__NR_Linux + 196)
567#define __NR_cacheflush (__NR_Linux + 197)
568#define __NR_cachectl (__NR_Linux + 198)
569#define __NR_sysmips (__NR_Linux + 199)
570#define __NR_io_setup (__NR_Linux + 200)
571#define __NR_io_destroy (__NR_Linux + 201)
572#define __NR_io_getevents (__NR_Linux + 202)
573#define __NR_io_submit (__NR_Linux + 203)
574#define __NR_io_cancel (__NR_Linux + 204)
575#define __NR_exit_group (__NR_Linux + 205)
576#define __NR_lookup_dcookie (__NR_Linux + 206)
577#define __NR_epoll_create (__NR_Linux + 207)
578#define __NR_epoll_ctl (__NR_Linux + 208)
579#define __NR_epoll_wait (__NR_Linux + 209)
580#define __NR_remap_file_pages (__NR_Linux + 210)
581#define __NR_rt_sigreturn (__NR_Linux + 211)
582#define __NR_set_tid_address (__NR_Linux + 212)
583#define __NR_restart_syscall (__NR_Linux + 213)
584#define __NR_semtimedop (__NR_Linux + 214)
585#define __NR_fadvise64 (__NR_Linux + 215)
586#define __NR_timer_create (__NR_Linux + 216)
587#define __NR_timer_settime (__NR_Linux + 217)
588#define __NR_timer_gettime (__NR_Linux + 218)
589#define __NR_timer_getoverrun (__NR_Linux + 219)
590#define __NR_timer_delete (__NR_Linux + 220)
591#define __NR_clock_settime (__NR_Linux + 221)
592#define __NR_clock_gettime (__NR_Linux + 222)
593#define __NR_clock_getres (__NR_Linux + 223)
594#define __NR_clock_nanosleep (__NR_Linux + 224)
595#define __NR_tgkill (__NR_Linux + 225)
596#define __NR_utimes (__NR_Linux + 226)
597#define __NR_mbind (__NR_Linux + 227)
598#define __NR_get_mempolicy (__NR_Linux + 228)
599#define __NR_set_mempolicy (__NR_Linux + 229)
600#define __NR_mq_open (__NR_Linux + 230)
601#define __NR_mq_unlink (__NR_Linux + 231)
602#define __NR_mq_timedsend (__NR_Linux + 232)
603#define __NR_mq_timedreceive (__NR_Linux + 233)
604#define __NR_mq_notify (__NR_Linux + 234)
605#define __NR_mq_getsetattr (__NR_Linux + 235)
606#define __NR_vserver (__NR_Linux + 236)
607#define __NR_waitid (__NR_Linux + 237)
608/* #define __NR_sys_setaltroot (__NR_Linux + 238) */
609#define __NR_add_key (__NR_Linux + 239)
610#define __NR_request_key (__NR_Linux + 240)
611#define __NR_keyctl (__NR_Linux + 241)
612#define __NR_set_thread_area (__NR_Linux + 242)
613#define __NR_inotify_init (__NR_Linux + 243)
614#define __NR_inotify_add_watch (__NR_Linux + 244)
615#define __NR_inotify_rm_watch (__NR_Linux + 245)
616#define __NR_migrate_pages (__NR_Linux + 246)
617#define __NR_openat (__NR_Linux + 247)
618#define __NR_mkdirat (__NR_Linux + 248)
619#define __NR_mknodat (__NR_Linux + 249)
620#define __NR_fchownat (__NR_Linux + 250)
621#define __NR_futimesat (__NR_Linux + 251)
622#define __NR_newfstatat (__NR_Linux + 252)
623#define __NR_unlinkat (__NR_Linux + 253)
624#define __NR_renameat (__NR_Linux + 254)
625#define __NR_linkat (__NR_Linux + 255)
626#define __NR_symlinkat (__NR_Linux + 256)
627#define __NR_readlinkat (__NR_Linux + 257)
628#define __NR_fchmodat (__NR_Linux + 258)
629#define __NR_faccessat (__NR_Linux + 259)
630#define __NR_pselect6 (__NR_Linux + 260)
631#define __NR_ppoll (__NR_Linux + 261)
632#define __NR_unshare (__NR_Linux + 262)
633#define __NR_splice (__NR_Linux + 263)
634#define __NR_sync_file_range (__NR_Linux + 264)
635#define __NR_tee (__NR_Linux + 265)
636#define __NR_vmsplice (__NR_Linux + 266)
637#define __NR_move_pages (__NR_Linux + 267)
638#define __NR_set_robust_list (__NR_Linux + 268)
639#define __NR_get_robust_list (__NR_Linux + 269)
640#define __NR_kexec_load (__NR_Linux + 270)
641#define __NR_getcpu (__NR_Linux + 271)
642#define __NR_epoll_pwait (__NR_Linux + 272)
643#define __NR_ioprio_set (__NR_Linux + 273)
644#define __NR_ioprio_get (__NR_Linux + 274)
645#define __NR_utimensat (__NR_Linux + 275)
646#define __NR_signalfd (__NR_Linux + 276)
647#define __NR_timerfd (__NR_Linux + 277)
648#define __NR_eventfd (__NR_Linux + 278)
649#define __NR_fallocate (__NR_Linux + 279)
650#define __NR_timerfd_create (__NR_Linux + 280)
651#define __NR_timerfd_gettime (__NR_Linux + 281)
652#define __NR_timerfd_settime (__NR_Linux + 282)
653#define __NR_signalfd4 (__NR_Linux + 283)
654#define __NR_eventfd2 (__NR_Linux + 284)
655#define __NR_epoll_create1 (__NR_Linux + 285)
656#define __NR_dup3 (__NR_Linux + 286)
657#define __NR_pipe2 (__NR_Linux + 287)
658#define __NR_inotify_init1 (__NR_Linux + 288)
659
660/*
661 * Offset of the last Linux 64-bit flavoured syscall
662 */
663#define __NR_Linux_syscalls 288
664
665#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
666
667#define __NR_64_Linux 5000
668#define __NR_64_Linux_syscalls 288
669
670#if _MIPS_SIM == _MIPS_SIM_NABI32
671
672/*
673 * Linux N32 syscalls are in the range from 6000 to 6999.
674 */
675#define __NR_Linux 6000
676#define __NR_read (__NR_Linux + 0)
677#define __NR_write (__NR_Linux + 1)
678#define __NR_open (__NR_Linux + 2)
679#define __NR_close (__NR_Linux + 3)
680#define __NR_stat (__NR_Linux + 4)
681#define __NR_fstat (__NR_Linux + 5)
682#define __NR_lstat (__NR_Linux + 6)
683#define __NR_poll (__NR_Linux + 7)
684#define __NR_lseek (__NR_Linux + 8)
685#define __NR_mmap (__NR_Linux + 9)
686#define __NR_mprotect (__NR_Linux + 10)
687#define __NR_munmap (__NR_Linux + 11)
688#define __NR_brk (__NR_Linux + 12)
689#define __NR_rt_sigaction (__NR_Linux + 13)
690#define __NR_rt_sigprocmask (__NR_Linux + 14)
691#define __NR_ioctl (__NR_Linux + 15)
692#define __NR_pread64 (__NR_Linux + 16)
693#define __NR_pwrite64 (__NR_Linux + 17)
694#define __NR_readv (__NR_Linux + 18)
695#define __NR_writev (__NR_Linux + 19)
696#define __NR_access (__NR_Linux + 20)
697#define __NR_pipe (__NR_Linux + 21)
698#define __NR__newselect (__NR_Linux + 22)
699#define __NR_sched_yield (__NR_Linux + 23)
700#define __NR_mremap (__NR_Linux + 24)
701#define __NR_msync (__NR_Linux + 25)
702#define __NR_mincore (__NR_Linux + 26)
703#define __NR_madvise (__NR_Linux + 27)
704#define __NR_shmget (__NR_Linux + 28)
705#define __NR_shmat (__NR_Linux + 29)
706#define __NR_shmctl (__NR_Linux + 30)
707#define __NR_dup (__NR_Linux + 31)
708#define __NR_dup2 (__NR_Linux + 32)
709#define __NR_pause (__NR_Linux + 33)
710#define __NR_nanosleep (__NR_Linux + 34)
711#define __NR_getitimer (__NR_Linux + 35)
712#define __NR_setitimer (__NR_Linux + 36)
713#define __NR_alarm (__NR_Linux + 37)
714#define __NR_getpid (__NR_Linux + 38)
715#define __NR_sendfile (__NR_Linux + 39)
716#define __NR_socket (__NR_Linux + 40)
717#define __NR_connect (__NR_Linux + 41)
718#define __NR_accept (__NR_Linux + 42)
719#define __NR_sendto (__NR_Linux + 43)
720#define __NR_recvfrom (__NR_Linux + 44)
721#define __NR_sendmsg (__NR_Linux + 45)
722#define __NR_recvmsg (__NR_Linux + 46)
723#define __NR_shutdown (__NR_Linux + 47)
724#define __NR_bind (__NR_Linux + 48)
725#define __NR_listen (__NR_Linux + 49)
726#define __NR_getsockname (__NR_Linux + 50)
727#define __NR_getpeername (__NR_Linux + 51)
728#define __NR_socketpair (__NR_Linux + 52)
729#define __NR_setsockopt (__NR_Linux + 53)
730#define __NR_getsockopt (__NR_Linux + 54)
731#define __NR_clone (__NR_Linux + 55)
732#define __NR_fork (__NR_Linux + 56)
733#define __NR_execve (__NR_Linux + 57)
734#define __NR_exit (__NR_Linux + 58)
735#define __NR_wait4 (__NR_Linux + 59)
736#define __NR_kill (__NR_Linux + 60)
737#define __NR_uname (__NR_Linux + 61)
738#define __NR_semget (__NR_Linux + 62)
739#define __NR_semop (__NR_Linux + 63)
740#define __NR_semctl (__NR_Linux + 64)
741#define __NR_shmdt (__NR_Linux + 65)
742#define __NR_msgget (__NR_Linux + 66)
743#define __NR_msgsnd (__NR_Linux + 67)
744#define __NR_msgrcv (__NR_Linux + 68)
745#define __NR_msgctl (__NR_Linux + 69)
746#define __NR_fcntl (__NR_Linux + 70)
747#define __NR_flock (__NR_Linux + 71)
748#define __NR_fsync (__NR_Linux + 72)
749#define __NR_fdatasync (__NR_Linux + 73)
750#define __NR_truncate (__NR_Linux + 74)
751#define __NR_ftruncate (__NR_Linux + 75)
752#define __NR_getdents (__NR_Linux + 76)
753#define __NR_getcwd (__NR_Linux + 77)
754#define __NR_chdir (__NR_Linux + 78)
755#define __NR_fchdir (__NR_Linux + 79)
756#define __NR_rename (__NR_Linux + 80)
757#define __NR_mkdir (__NR_Linux + 81)
758#define __NR_rmdir (__NR_Linux + 82)
759#define __NR_creat (__NR_Linux + 83)
760#define __NR_link (__NR_Linux + 84)
761#define __NR_unlink (__NR_Linux + 85)
762#define __NR_symlink (__NR_Linux + 86)
763#define __NR_readlink (__NR_Linux + 87)
764#define __NR_chmod (__NR_Linux + 88)
765#define __NR_fchmod (__NR_Linux + 89)
766#define __NR_chown (__NR_Linux + 90)
767#define __NR_fchown (__NR_Linux + 91)
768#define __NR_lchown (__NR_Linux + 92)
769#define __NR_umask (__NR_Linux + 93)
770#define __NR_gettimeofday (__NR_Linux + 94)
771#define __NR_getrlimit (__NR_Linux + 95)
772#define __NR_getrusage (__NR_Linux + 96)
773#define __NR_sysinfo (__NR_Linux + 97)
774#define __NR_times (__NR_Linux + 98)
775#define __NR_ptrace (__NR_Linux + 99)
776#define __NR_getuid (__NR_Linux + 100)
777#define __NR_syslog (__NR_Linux + 101)
778#define __NR_getgid (__NR_Linux + 102)
779#define __NR_setuid (__NR_Linux + 103)
780#define __NR_setgid (__NR_Linux + 104)
781#define __NR_geteuid (__NR_Linux + 105)
782#define __NR_getegid (__NR_Linux + 106)
783#define __NR_setpgid (__NR_Linux + 107)
784#define __NR_getppid (__NR_Linux + 108)
785#define __NR_getpgrp (__NR_Linux + 109)
786#define __NR_setsid (__NR_Linux + 110)
787#define __NR_setreuid (__NR_Linux + 111)
788#define __NR_setregid (__NR_Linux + 112)
789#define __NR_getgroups (__NR_Linux + 113)
790#define __NR_setgroups (__NR_Linux + 114)
791#define __NR_setresuid (__NR_Linux + 115)
792#define __NR_getresuid (__NR_Linux + 116)
793#define __NR_setresgid (__NR_Linux + 117)
794#define __NR_getresgid (__NR_Linux + 118)
795#define __NR_getpgid (__NR_Linux + 119)
796#define __NR_setfsuid (__NR_Linux + 120)
797#define __NR_setfsgid (__NR_Linux + 121)
798#define __NR_getsid (__NR_Linux + 122)
799#define __NR_capget (__NR_Linux + 123)
800#define __NR_capset (__NR_Linux + 124)
801#define __NR_rt_sigpending (__NR_Linux + 125)
802#define __NR_rt_sigtimedwait (__NR_Linux + 126)
803#define __NR_rt_sigqueueinfo (__NR_Linux + 127)
804#define __NR_rt_sigsuspend (__NR_Linux + 128)
805#define __NR_sigaltstack (__NR_Linux + 129)
806#define __NR_utime (__NR_Linux + 130)
807#define __NR_mknod (__NR_Linux + 131)
808#define __NR_personality (__NR_Linux + 132)
809#define __NR_ustat (__NR_Linux + 133)
810#define __NR_statfs (__NR_Linux + 134)
811#define __NR_fstatfs (__NR_Linux + 135)
812#define __NR_sysfs (__NR_Linux + 136)
813#define __NR_getpriority (__NR_Linux + 137)
814#define __NR_setpriority (__NR_Linux + 138)
815#define __NR_sched_setparam (__NR_Linux + 139)
816#define __NR_sched_getparam (__NR_Linux + 140)
817#define __NR_sched_setscheduler (__NR_Linux + 141)
818#define __NR_sched_getscheduler (__NR_Linux + 142)
819#define __NR_sched_get_priority_max (__NR_Linux + 143)
820#define __NR_sched_get_priority_min (__NR_Linux + 144)
821#define __NR_sched_rr_get_interval (__NR_Linux + 145)
822#define __NR_mlock (__NR_Linux + 146)
823#define __NR_munlock (__NR_Linux + 147)
824#define __NR_mlockall (__NR_Linux + 148)
825#define __NR_munlockall (__NR_Linux + 149)
826#define __NR_vhangup (__NR_Linux + 150)
827#define __NR_pivot_root (__NR_Linux + 151)
828#define __NR__sysctl (__NR_Linux + 152)
829#define __NR_prctl (__NR_Linux + 153)
830#define __NR_adjtimex (__NR_Linux + 154)
831#define __NR_setrlimit (__NR_Linux + 155)
832#define __NR_chroot (__NR_Linux + 156)
833#define __NR_sync (__NR_Linux + 157)
834#define __NR_acct (__NR_Linux + 158)
835#define __NR_settimeofday (__NR_Linux + 159)
836#define __NR_mount (__NR_Linux + 160)
837#define __NR_umount2 (__NR_Linux + 161)
838#define __NR_swapon (__NR_Linux + 162)
839#define __NR_swapoff (__NR_Linux + 163)
840#define __NR_reboot (__NR_Linux + 164)
841#define __NR_sethostname (__NR_Linux + 165)
842#define __NR_setdomainname (__NR_Linux + 166)
843#define __NR_create_module (__NR_Linux + 167)
844#define __NR_init_module (__NR_Linux + 168)
845#define __NR_delete_module (__NR_Linux + 169)
846#define __NR_get_kernel_syms (__NR_Linux + 170)
847#define __NR_query_module (__NR_Linux + 171)
848#define __NR_quotactl (__NR_Linux + 172)
849#define __NR_nfsservctl (__NR_Linux + 173)
850#define __NR_getpmsg (__NR_Linux + 174)
851#define __NR_putpmsg (__NR_Linux + 175)
852#define __NR_afs_syscall (__NR_Linux + 176)
853#define __NR_reserved177 (__NR_Linux + 177)
854#define __NR_gettid (__NR_Linux + 178)
855#define __NR_readahead (__NR_Linux + 179)
856#define __NR_setxattr (__NR_Linux + 180)
857#define __NR_lsetxattr (__NR_Linux + 181)
858#define __NR_fsetxattr (__NR_Linux + 182)
859#define __NR_getxattr (__NR_Linux + 183)
860#define __NR_lgetxattr (__NR_Linux + 184)
861#define __NR_fgetxattr (__NR_Linux + 185)
862#define __NR_listxattr (__NR_Linux + 186)
863#define __NR_llistxattr (__NR_Linux + 187)
864#define __NR_flistxattr (__NR_Linux + 188)
865#define __NR_removexattr (__NR_Linux + 189)
866#define __NR_lremovexattr (__NR_Linux + 190)
867#define __NR_fremovexattr (__NR_Linux + 191)
868#define __NR_tkill (__NR_Linux + 192)
869#define __NR_reserved193 (__NR_Linux + 193)
870#define __NR_futex (__NR_Linux + 194)
871#define __NR_sched_setaffinity (__NR_Linux + 195)
872#define __NR_sched_getaffinity (__NR_Linux + 196)
873#define __NR_cacheflush (__NR_Linux + 197)
874#define __NR_cachectl (__NR_Linux + 198)
875#define __NR_sysmips (__NR_Linux + 199)
876#define __NR_io_setup (__NR_Linux + 200)
877#define __NR_io_destroy (__NR_Linux + 201)
878#define __NR_io_getevents (__NR_Linux + 202)
879#define __NR_io_submit (__NR_Linux + 203)
880#define __NR_io_cancel (__NR_Linux + 204)
881#define __NR_exit_group (__NR_Linux + 205)
882#define __NR_lookup_dcookie (__NR_Linux + 206)
883#define __NR_epoll_create (__NR_Linux + 207)
884#define __NR_epoll_ctl (__NR_Linux + 208)
885#define __NR_epoll_wait (__NR_Linux + 209)
886#define __NR_remap_file_pages (__NR_Linux + 210)
887#define __NR_rt_sigreturn (__NR_Linux + 211)
888#define __NR_fcntl64 (__NR_Linux + 212)
889#define __NR_set_tid_address (__NR_Linux + 213)
890#define __NR_restart_syscall (__NR_Linux + 214)
891#define __NR_semtimedop (__NR_Linux + 215)
892#define __NR_fadvise64 (__NR_Linux + 216)
893#define __NR_statfs64 (__NR_Linux + 217)
894#define __NR_fstatfs64 (__NR_Linux + 218)
895#define __NR_sendfile64 (__NR_Linux + 219)
896#define __NR_timer_create (__NR_Linux + 220)
897#define __NR_timer_settime (__NR_Linux + 221)
898#define __NR_timer_gettime (__NR_Linux + 222)
899#define __NR_timer_getoverrun (__NR_Linux + 223)
900#define __NR_timer_delete (__NR_Linux + 224)
901#define __NR_clock_settime (__NR_Linux + 225)
902#define __NR_clock_gettime (__NR_Linux + 226)
903#define __NR_clock_getres (__NR_Linux + 227)
904#define __NR_clock_nanosleep (__NR_Linux + 228)
905#define __NR_tgkill (__NR_Linux + 229)
906#define __NR_utimes (__NR_Linux + 230)
907#define __NR_mbind (__NR_Linux + 231)
908#define __NR_get_mempolicy (__NR_Linux + 232)
909#define __NR_set_mempolicy (__NR_Linux + 233)
910#define __NR_mq_open (__NR_Linux + 234)
911#define __NR_mq_unlink (__NR_Linux + 235)
912#define __NR_mq_timedsend (__NR_Linux + 236)
913#define __NR_mq_timedreceive (__NR_Linux + 237)
914#define __NR_mq_notify (__NR_Linux + 238)
915#define __NR_mq_getsetattr (__NR_Linux + 239)
916#define __NR_vserver (__NR_Linux + 240)
917#define __NR_waitid (__NR_Linux + 241)
918/* #define __NR_sys_setaltroot (__NR_Linux + 242) */
919#define __NR_add_key (__NR_Linux + 243)
920#define __NR_request_key (__NR_Linux + 244)
921#define __NR_keyctl (__NR_Linux + 245)
922#define __NR_set_thread_area (__NR_Linux + 246)
923#define __NR_inotify_init (__NR_Linux + 247)
924#define __NR_inotify_add_watch (__NR_Linux + 248)
925#define __NR_inotify_rm_watch (__NR_Linux + 249)
926#define __NR_migrate_pages (__NR_Linux + 250)
927#define __NR_openat (__NR_Linux + 251)
928#define __NR_mkdirat (__NR_Linux + 252)
929#define __NR_mknodat (__NR_Linux + 253)
930#define __NR_fchownat (__NR_Linux + 254)
931#define __NR_futimesat (__NR_Linux + 255)
932#define __NR_newfstatat (__NR_Linux + 256)
933#define __NR_unlinkat (__NR_Linux + 257)
934#define __NR_renameat (__NR_Linux + 258)
935#define __NR_linkat (__NR_Linux + 259)
936#define __NR_symlinkat (__NR_Linux + 260)
937#define __NR_readlinkat (__NR_Linux + 261)
938#define __NR_fchmodat (__NR_Linux + 262)
939#define __NR_faccessat (__NR_Linux + 263)
940#define __NR_pselect6 (__NR_Linux + 264)
941#define __NR_ppoll (__NR_Linux + 265)
942#define __NR_unshare (__NR_Linux + 266)
943#define __NR_splice (__NR_Linux + 267)
944#define __NR_sync_file_range (__NR_Linux + 268)
945#define __NR_tee (__NR_Linux + 269)
946#define __NR_vmsplice (__NR_Linux + 270)
947#define __NR_move_pages (__NR_Linux + 271)
948#define __NR_set_robust_list (__NR_Linux + 272)
949#define __NR_get_robust_list (__NR_Linux + 273)
950#define __NR_kexec_load (__NR_Linux + 274)
951#define __NR_getcpu (__NR_Linux + 275)
952#define __NR_epoll_pwait (__NR_Linux + 276)
953#define __NR_ioprio_set (__NR_Linux + 277)
954#define __NR_ioprio_get (__NR_Linux + 278)
955#define __NR_utimensat (__NR_Linux + 279)
956#define __NR_signalfd (__NR_Linux + 280)
957#define __NR_timerfd (__NR_Linux + 281)
958#define __NR_eventfd (__NR_Linux + 282)
959#define __NR_fallocate (__NR_Linux + 283)
960#define __NR_timerfd_create (__NR_Linux + 284)
961#define __NR_timerfd_gettime (__NR_Linux + 285)
962#define __NR_timerfd_settime (__NR_Linux + 286)
963#define __NR_signalfd4 (__NR_Linux + 287)
964#define __NR_eventfd2 (__NR_Linux + 288)
965#define __NR_epoll_create1 (__NR_Linux + 289)
966#define __NR_dup3 (__NR_Linux + 290)
967#define __NR_pipe2 (__NR_Linux + 291)
968#define __NR_inotify_init1 (__NR_Linux + 292)
969
970/*
971 * Offset of the last N32 flavoured syscall
972 */
973#define __NR_Linux_syscalls 292
974
975#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
976
977#define __NR_N32_Linux 6000
978#define __NR_N32_Linux_syscalls 292
979
980#ifdef __KERNEL__
981
982#ifndef __ASSEMBLY__
983
984#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
985#define __ARCH_WANT_IPC_PARSE_VERSION
986#define __ARCH_WANT_OLD_READDIR
987#define __ARCH_WANT_SYS_ALARM
988#define __ARCH_WANT_SYS_GETHOSTNAME
989#define __ARCH_WANT_SYS_PAUSE
990#define __ARCH_WANT_SYS_SGETMASK
991#define __ARCH_WANT_SYS_UTIME
992#define __ARCH_WANT_SYS_WAITPID
993#define __ARCH_WANT_SYS_SOCKETCALL
994#define __ARCH_WANT_SYS_GETPGRP
995#define __ARCH_WANT_SYS_LLSEEK
996#define __ARCH_WANT_SYS_NICE
997#define __ARCH_WANT_SYS_OLD_GETRLIMIT
998#define __ARCH_WANT_SYS_OLDUMOUNT
999#define __ARCH_WANT_SYS_SIGPENDING
1000#define __ARCH_WANT_SYS_SIGPROCMASK
1001#define __ARCH_WANT_SYS_RT_SIGACTION
1002# ifdef CONFIG_32BIT
1003# define __ARCH_WANT_STAT64
1004# define __ARCH_WANT_SYS_TIME
1005# endif
1006# ifdef CONFIG_MIPS32_O32
1007# define __ARCH_WANT_COMPAT_SYS_TIME
1008# endif
1009
1010/* whitelists for checksyscalls */
1011#define __IGNORE_select
1012#define __IGNORE_vfork
1013#define __IGNORE_time
1014#define __IGNORE_uselib
1015#define __IGNORE_fadvise64_64
1016#define __IGNORE_getdents64
1017#if _MIPS_SIM == _MIPS_SIM_NABI32
1018#define __IGNORE_truncate64
1019#define __IGNORE_ftruncate64
1020#define __IGNORE_stat64
1021#define __IGNORE_lstat64
1022#define __IGNORE_fstat64
1023#define __IGNORE_fstatat64
1024#endif
1025
1026#endif /* !__ASSEMBLY__ */
1027
1028/*
1029 * "Conditional" syscalls
1030 *
1031 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
1032 * but it doesn't work on all toolchains, so we just do it by hand
1033 */
1034#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
1035
1036#endif /* __KERNEL__ */
1037#endif /* _ASM_UNISTD_H */
diff --git a/include/asm-mips/user.h b/include/asm-mips/user.h
deleted file mode 100644
index afa83a4c1888..000000000000
--- a/include/asm-mips/user.h
+++ /dev/null
@@ -1,58 +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) 1994, 1995, 1996, 1999 by Ralf Baechle
7 */
8#ifndef _ASM_USER_H
9#define _ASM_USER_H
10
11#include <asm/page.h>
12#include <asm/reg.h>
13
14/*
15 * Core file format: The core file is written in such a way that gdb
16 * can understand it and provide useful information to the user (under
17 * linux we use the `trad-core' bfd, NOT the irix-core). The file
18 * contents are as follows:
19 *
20 * upage: 1 page consisting of a user struct that tells gdb
21 * what is present in the file. Directly after this is a
22 * copy of the task_struct, which is currently not used by gdb,
23 * but it may come in handy at some point. All of the registers
24 * are stored as part of the upage. The upage should always be
25 * only one page long.
26 * data: The data segment follows next. We use current->end_text to
27 * current->brk to pick up all of the user variables, plus any memory
28 * that may have been sbrk'ed. No attempt is made to determine if a
29 * page is demand-zero or if a page is totally unused, we just cover
30 * the entire range. All of the addresses are rounded in such a way
31 * that an integral number of pages is written.
32 * stack: We need the stack information in order to get a meaningful
33 * backtrace. We need to write the data from usp to
34 * current->start_stack, so we round each of these in order to be able
35 * to write an integer number of pages.
36 */
37struct user {
38 unsigned long regs[EF_SIZE / /* integer and fp regs */
39 sizeof(unsigned long) + 64];
40 size_t u_tsize; /* text size (pages) */
41 size_t u_dsize; /* data size (pages) */
42 size_t u_ssize; /* stack size (pages) */
43 unsigned long start_code; /* text starting address */
44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */
47 unsigned long u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */
50};
51
52#define NBPG PAGE_SIZE
53#define UPAGES 1
54#define HOST_TEXT_START_ADDR (u.start_code)
55#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57
58#endif /* _ASM_USER_H */
diff --git a/include/asm-mips/vga.h b/include/asm-mips/vga.h
deleted file mode 100644
index f4cff7e4fa8a..000000000000
--- a/include/asm-mips/vga.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6#ifndef _ASM_VGA_H
7#define _ASM_VGA_H
8
9#include <asm/byteorder.h>
10
11/*
12 * On the PC, we can just recalculate addresses and then
13 * access the videoram directly without any black magic.
14 */
15
16#define VGA_MAP_MEM(x, s) (0xb0000000L + (unsigned long)(x))
17
18#define vga_readb(x) (*(x))
19#define vga_writeb(x, y) (*(y) = (x))
20
21#define VT_BUF_HAVE_RW
22/*
23 * These are only needed for supporting VGA or MDA text mode, which use little
24 * endian byte ordering.
25 * In other cases, we can optimize by using native byte ordering and
26 * <linux/vt_buffer.h> has already done the right job for us.
27 */
28
29#undef scr_writew
30#undef scr_readw
31
32static inline void scr_writew(u16 val, volatile u16 *addr)
33{
34 *addr = cpu_to_le16(val);
35}
36
37static inline u16 scr_readw(volatile const u16 *addr)
38{
39 return le16_to_cpu(*addr);
40}
41
42#define scr_memcpyw(d, s, c) memcpy(d, s, c)
43#define scr_memmovew(d, s, c) memmove(d, s, c)
44#define VT_BUF_HAVE_MEMCPYW
45#define VT_BUF_HAVE_MEMMOVEW
46
47#endif /* _ASM_VGA_H */
diff --git a/include/asm-mips/vpe.h b/include/asm-mips/vpe.h
deleted file mode 100644
index c6e1b961537d..000000000000
--- a/include/asm-mips/vpe.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_VPE_H
20#define _ASM_VPE_H
21
22struct vpe_notifications {
23 void (*start)(int vpe);
24 void (*stop)(int vpe);
25
26 struct list_head list;
27};
28
29
30extern int vpe_notify(int index, struct vpe_notifications *notify);
31
32extern void *vpe_get_shared(int index);
33extern int vpe_getuid(int index);
34extern int vpe_getgid(int index);
35extern char *vpe_getcwd(int index);
36
37#endif /* _ASM_VPE_H */
diff --git a/include/asm-mips/vr41xx/capcella.h b/include/asm-mips/vr41xx/capcella.h
deleted file mode 100644
index e0ee05a3dfcc..000000000000
--- a/include/asm-mips/vr41xx/capcella.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * capcella.h, Include file for ZAO Networks Capcella.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ZAO_CAPCELLA_H
21#define __ZAO_CAPCELLA_H
22
23#include <asm/vr41xx/irq.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define PC104PLUS_INTA_PIN 2
29#define PC104PLUS_INTB_PIN 3
30#define PC104PLUS_INTC_PIN 4
31#define PC104PLUS_INTD_PIN 5
32
33/*
34 * Interrupt Number
35 */
36#define RTL8139_1_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
37#define RTL8139_2_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
38#define PC104PLUS_INTA_IRQ GIU_IRQ(PC104PLUS_INTA_PIN)
39#define PC104PLUS_INTB_IRQ GIU_IRQ(PC104PLUS_INTB_PIN)
40#define PC104PLUS_INTC_IRQ GIU_IRQ(PC104PLUS_INTC_PIN)
41#define PC104PLUS_INTD_IRQ GIU_IRQ(PC104PLUS_INTD_PIN)
42
43#endif /* __ZAO_CAPCELLA_H */
diff --git a/include/asm-mips/vr41xx/giu.h b/include/asm-mips/vr41xx/giu.h
deleted file mode 100644
index 0bcdd3a5c256..000000000000
--- a/include/asm-mips/vr41xx/giu.h
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Include file for NEC VR4100 series General-purpose I/O Unit.
3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __NEC_VR41XX_GIU_H
21#define __NEC_VR41XX_GIU_H
22
23/*
24 * NEC VR4100 series GIU platform device IDs.
25 */
26enum {
27 GPIO_50PINS_PULLUPDOWN,
28 GPIO_36PINS,
29 GPIO_48PINS_EDGE_SELECT,
30};
31
32typedef enum {
33 IRQ_TRIGGER_LEVEL,
34 IRQ_TRIGGER_EDGE,
35 IRQ_TRIGGER_EDGE_FALLING,
36 IRQ_TRIGGER_EDGE_RISING,
37} irq_trigger_t;
38
39typedef enum {
40 IRQ_SIGNAL_THROUGH,
41 IRQ_SIGNAL_HOLD,
42} irq_signal_t;
43
44extern void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_t signal);
45
46typedef enum {
47 IRQ_LEVEL_LOW,
48 IRQ_LEVEL_HIGH,
49} irq_level_t;
50
51extern void vr41xx_set_irq_level(unsigned int pin, irq_level_t level);
52
53typedef enum {
54 GPIO_DATA_LOW,
55 GPIO_DATA_HIGH,
56 GPIO_DATA_INVAL,
57} gpio_data_t;
58
59extern gpio_data_t vr41xx_gpio_get_pin(unsigned int pin);
60extern int vr41xx_gpio_set_pin(unsigned int pin, gpio_data_t data);
61
62typedef enum {
63 GPIO_INPUT,
64 GPIO_OUTPUT,
65 GPIO_OUTPUT_DISABLE,
66} gpio_direction_t;
67
68extern int vr41xx_gpio_set_direction(unsigned int pin, gpio_direction_t dir);
69
70typedef enum {
71 GPIO_PULL_DOWN,
72 GPIO_PULL_UP,
73 GPIO_PULL_DISABLE,
74} gpio_pull_t;
75
76extern int vr41xx_gpio_pullupdown(unsigned int pin, gpio_pull_t pull);
77
78#endif /* __NEC_VR41XX_GIU_H */
diff --git a/include/asm-mips/vr41xx/irq.h b/include/asm-mips/vr41xx/irq.h
deleted file mode 100644
index d315dfbc08f2..000000000000
--- a/include/asm-mips/vr41xx/irq.h
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * include/asm-mips/vr41xx/irq.h
3 *
4 * Interrupt numbers for NEC VR4100 series.
5 *
6 * Copyright (C) 1999 Michael Klar
7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2006 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef __NEC_VR41XX_IRQ_H
18#define __NEC_VR41XX_IRQ_H
19
20/*
21 * CPU core Interrupt Numbers
22 */
23#define MIPS_CPU_IRQ_BASE 0
24#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
25#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
26#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
27#define INT0_IRQ MIPS_CPU_IRQ(2)
28#define INT1_IRQ MIPS_CPU_IRQ(3)
29#define INT2_IRQ MIPS_CPU_IRQ(4)
30#define INT3_IRQ MIPS_CPU_IRQ(5)
31#define INT4_IRQ MIPS_CPU_IRQ(6)
32#define TIMER_IRQ MIPS_CPU_IRQ(7)
33
34/*
35 * SYINT1 Interrupt Numbers
36 */
37#define SYSINT1_IRQ_BASE 8
38#define SYSINT1_IRQ(x) (SYSINT1_IRQ_BASE + (x))
39#define BATTRY_IRQ SYSINT1_IRQ(0)
40#define POWER_IRQ SYSINT1_IRQ(1)
41#define RTCLONG1_IRQ SYSINT1_IRQ(2)
42#define ELAPSEDTIME_IRQ SYSINT1_IRQ(3)
43/* RFU */
44#define PIU_IRQ SYSINT1_IRQ(5)
45#define AIU_IRQ SYSINT1_IRQ(6)
46#define KIU_IRQ SYSINT1_IRQ(7)
47#define GIUINT_IRQ SYSINT1_IRQ(8)
48#define SIU_IRQ SYSINT1_IRQ(9)
49#define BUSERR_IRQ SYSINT1_IRQ(10)
50#define SOFTINT_IRQ SYSINT1_IRQ(11)
51#define CLKRUN_IRQ SYSINT1_IRQ(12)
52#define DOZEPIU_IRQ SYSINT1_IRQ(13)
53#define SYSINT1_IRQ_LAST DOZEPIU_IRQ
54
55/*
56 * SYSINT2 Interrupt Numbers
57 */
58#define SYSINT2_IRQ_BASE 24
59#define SYSINT2_IRQ(x) (SYSINT2_IRQ_BASE + (x))
60#define RTCLONG2_IRQ SYSINT2_IRQ(0)
61#define LED_IRQ SYSINT2_IRQ(1)
62#define HSP_IRQ SYSINT2_IRQ(2)
63#define TCLOCK_IRQ SYSINT2_IRQ(3)
64#define FIR_IRQ SYSINT2_IRQ(4)
65#define CEU_IRQ SYSINT2_IRQ(4) /* same number as FIR_IRQ */
66#define DSIU_IRQ SYSINT2_IRQ(5)
67#define PCI_IRQ SYSINT2_IRQ(6)
68#define SCU_IRQ SYSINT2_IRQ(7)
69#define CSI_IRQ SYSINT2_IRQ(8)
70#define BCU_IRQ SYSINT2_IRQ(9)
71#define ETHERNET_IRQ SYSINT2_IRQ(10)
72#define SYSINT2_IRQ_LAST ETHERNET_IRQ
73
74/*
75 * GIU Interrupt Numbers
76 */
77#define GIU_IRQ_BASE 40
78#define GIU_IRQ(x) (GIU_IRQ_BASE + (x)) /* IRQ 40-71 */
79#define GIU_IRQ_LAST GIU_IRQ(31)
80
81/*
82 * VRC4173 Interrupt Numbers
83 */
84#define VRC4173_IRQ_BASE 72
85#define VRC4173_IRQ(x) (VRC4173_IRQ_BASE + (x))
86#define VRC4173_USB_IRQ VRC4173_IRQ(0)
87#define VRC4173_PCMCIA2_IRQ VRC4173_IRQ(1)
88#define VRC4173_PCMCIA1_IRQ VRC4173_IRQ(2)
89#define VRC4173_PS2CH2_IRQ VRC4173_IRQ(3)
90#define VRC4173_PS2CH1_IRQ VRC4173_IRQ(4)
91#define VRC4173_PIU_IRQ VRC4173_IRQ(5)
92#define VRC4173_AIU_IRQ VRC4173_IRQ(6)
93#define VRC4173_KIU_IRQ VRC4173_IRQ(7)
94#define VRC4173_GIU_IRQ VRC4173_IRQ(8)
95#define VRC4173_AC97_IRQ VRC4173_IRQ(9)
96#define VRC4173_AC97INT1_IRQ VRC4173_IRQ(10)
97/* RFU */
98#define VRC4173_DOZEPIU_IRQ VRC4173_IRQ(13)
99#define VRC4173_IRQ_LAST VRC4173_DOZEPIU_IRQ
100
101#endif /* __NEC_VR41XX_IRQ_H */
diff --git a/include/asm-mips/vr41xx/mpc30x.h b/include/asm-mips/vr41xx/mpc30x.h
deleted file mode 100644
index 1d67df843dc3..000000000000
--- a/include/asm-mips/vr41xx/mpc30x.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * mpc30x.h, Include file for Victor MP-C303/304.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __VICTOR_MPC30X_H
21#define __VICTOR_MPC30X_H
22
23#include <asm/vr41xx/irq.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define VRC4173_PIN 1
29#define MQ200_PIN 4
30
31/*
32 * Interrupt Number
33 */
34#define VRC4173_CASCADE_IRQ GIU_IRQ(VRC4173_PIN)
35#define MQ200_IRQ GIU_IRQ(MQ200_PIN)
36
37#endif /* __VICTOR_MPC30X_H */
diff --git a/include/asm-mips/vr41xx/pci.h b/include/asm-mips/vr41xx/pci.h
deleted file mode 100644
index 6fc01ce19777..000000000000
--- a/include/asm-mips/vr41xx/pci.h
+++ /dev/null
@@ -1,90 +0,0 @@
1/*
2 * Include file for NEC VR4100 series PCI Control Unit.
3 *
4 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __NEC_VR41XX_PCI_H
21#define __NEC_VR41XX_PCI_H
22
23#define PCI_MASTER_ADDRESS_MASK 0x7fffffffU
24
25struct pci_master_address_conversion {
26 uint32_t bus_base_address;
27 uint32_t address_mask;
28 uint32_t pci_base_address;
29};
30
31struct pci_target_address_conversion {
32 uint32_t address_mask;
33 uint32_t bus_base_address;
34};
35
36typedef enum {
37 CANNOT_LOCK_FROM_DEVICE,
38 CAN_LOCK_FROM_DEVICE,
39} pci_exclusive_access_t;
40
41struct pci_mailbox_address {
42 uint32_t base_address;
43};
44
45struct pci_target_address_window {
46 uint32_t base_address;
47};
48
49typedef enum {
50 PCI_ARBITRATION_MODE_FAIR,
51 PCI_ARBITRATION_MODE_ALTERNATE_0,
52 PCI_ARBITRATION_MODE_ALTERNATE_B,
53} pci_arbiter_priority_control_t;
54
55typedef enum {
56 PCI_TAKE_AWAY_GNT_DISABLE,
57 PCI_TAKE_AWAY_GNT_ENABLE,
58} pci_take_away_gnt_mode_t;
59
60struct pci_controller_unit_setup {
61 struct pci_master_address_conversion *master_memory1;
62 struct pci_master_address_conversion *master_memory2;
63
64 struct pci_target_address_conversion *target_memory1;
65 struct pci_target_address_conversion *target_memory2;
66
67 struct pci_master_address_conversion *master_io;
68
69 pci_exclusive_access_t exclusive_access;
70
71 uint32_t pci_clock_max;
72 uint8_t wait_time_limit_from_irdy_to_trdy; /* Only VR4122 is supported */
73
74 struct pci_mailbox_address *mailbox;
75 struct pci_target_address_window *target_window1;
76 struct pci_target_address_window *target_window2;
77
78 uint8_t master_latency_timer;
79 uint8_t retry_limit;
80
81 pci_arbiter_priority_control_t arbiter_priority_control;
82 pci_take_away_gnt_mode_t take_away_gnt_mode;
83
84 struct resource *mem_resource;
85 struct resource *io_resource;
86};
87
88extern void vr41xx_pciu_setup(struct pci_controller_unit_setup *setup);
89
90#endif /* __NEC_VR41XX_PCI_H */
diff --git a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
deleted file mode 100644
index da9f6e373409..000000000000
--- a/include/asm-mips/vr41xx/siu.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Include file for NEC VR4100 series Serial Interface Unit.
3 *
4 * Copyright (C) 2005-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __NEC_VR41XX_SIU_H
21#define __NEC_VR41XX_SIU_H
22
23#define SIU_PORTS_MAX 2
24
25typedef enum {
26 SIU_INTERFACE_RS232C,
27 SIU_INTERFACE_IRDA,
28} siu_interface_t;
29
30extern void vr41xx_select_siu_interface(siu_interface_t interface);
31
32typedef enum {
33 SIU_USE_IRDA,
34 FIR_USE_IRDA,
35} irda_use_t;
36
37extern void vr41xx_use_irda(irda_use_t use);
38
39typedef enum {
40 SHARP_IRDA,
41 TEMIC_IRDA,
42 HP_IRDA,
43} irda_module_t;
44
45typedef enum {
46 IRDA_TX_1_5MBPS,
47 IRDA_TX_4MBPS,
48} irda_speed_t;
49
50extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed);
51
52#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
53extern void vr41xx_siu_early_setup(struct uart_port *port);
54#else
55static inline void vr41xx_siu_early_setup(struct uart_port *port) {}
56#endif
57
58#endif /* __NEC_VR41XX_SIU_H */
diff --git a/include/asm-mips/vr41xx/tb0219.h b/include/asm-mips/vr41xx/tb0219.h
deleted file mode 100644
index dc981b4be0a4..000000000000
--- a/include/asm-mips/vr41xx/tb0219.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * tb0219.h, Include file for TANBAC TB0219.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * Modified for TANBAC TB0219:
7 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
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#ifndef __TANBAC_TB0219_H
24#define __TANBAC_TB0219_H
25
26#include <asm/vr41xx/irq.h>
27
28/*
29 * General-Purpose I/O Pin Number
30 */
31#define TB0219_PCI_SLOT1_PIN 2
32#define TB0219_PCI_SLOT2_PIN 3
33#define TB0219_PCI_SLOT3_PIN 4
34
35/*
36 * Interrupt Number
37 */
38#define TB0219_PCI_SLOT1_IRQ GIU_IRQ(TB0219_PCI_SLOT1_PIN)
39#define TB0219_PCI_SLOT2_IRQ GIU_IRQ(TB0219_PCI_SLOT2_PIN)
40#define TB0219_PCI_SLOT3_IRQ GIU_IRQ(TB0219_PCI_SLOT3_PIN)
41
42#endif /* __TANBAC_TB0219_H */
diff --git a/include/asm-mips/vr41xx/tb0226.h b/include/asm-mips/vr41xx/tb0226.h
deleted file mode 100644
index de527dcfa5f3..000000000000
--- a/include/asm-mips/vr41xx/tb0226.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * tb0226.h, Include file for TANBAC TB0226.
3 *
4 * Copyright (C) 2002-2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __TANBAC_TB0226_H
21#define __TANBAC_TB0226_H
22
23#include <asm/vr41xx/irq.h>
24
25/*
26 * General-Purpose I/O Pin Number
27 */
28#define GD82559_1_PIN 2
29#define GD82559_2_PIN 3
30#define UPD720100_INTA_PIN 4
31#define UPD720100_INTB_PIN 8
32#define UPD720100_INTC_PIN 13
33
34/*
35 * Interrupt Number
36 */
37#define GD82559_1_IRQ GIU_IRQ(GD82559_1_PIN)
38#define GD82559_2_IRQ GIU_IRQ(GD82559_2_PIN)
39#define UPD720100_INTA_IRQ GIU_IRQ(UPD720100_INTA_PIN)
40#define UPD720100_INTB_IRQ GIU_IRQ(UPD720100_INTB_PIN)
41#define UPD720100_INTC_IRQ GIU_IRQ(UPD720100_INTC_PIN)
42
43#endif /* __TANBAC_TB0226_H */
diff --git a/include/asm-mips/vr41xx/tb0287.h b/include/asm-mips/vr41xx/tb0287.h
deleted file mode 100644
index 61bead68abf0..000000000000
--- a/include/asm-mips/vr41xx/tb0287.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * tb0287.h, Include file for TANBAC TB0287 mini-ITX board.
3 *
4 * Copyright (C) 2005 Media Lab Inc. <ito@mlb.co.jp>
5 *
6 * This code is largely based on tb0219.h.
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#ifndef __TANBAC_TB0287_H
23#define __TANBAC_TB0287_H
24
25#include <asm/vr41xx/irq.h>
26
27/*
28 * General-Purpose I/O Pin Number
29 */
30#define TB0287_PCI_SLOT_PIN 2
31#define TB0287_SM501_PIN 3
32#define TB0287_SIL680A_PIN 8
33#define TB0287_RTL8110_PIN 13
34
35/*
36 * Interrupt Number
37 */
38#define TB0287_PCI_SLOT_IRQ GIU_IRQ(TB0287_PCI_SLOT_PIN)
39#define TB0287_SM501_IRQ GIU_IRQ(TB0287_SM501_PIN)
40#define TB0287_SIL680A_IRQ GIU_IRQ(TB0287_SIL680A_PIN)
41#define TB0287_RTL8110_IRQ GIU_IRQ(TB0287_RTL8110_PIN)
42
43#endif /* __TANBAC_TB0287_H */
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
deleted file mode 100644
index 22be64971cc6..000000000000
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2 * include/asm-mips/vr41xx/vr41xx.h
3 *
4 * Include file for NEC VR4100 series.
5 *
6 * Copyright (C) 1999 Michael Klar
7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#ifndef __NEC_VR41XX_H
18#define __NEC_VR41XX_H
19
20#include <linux/interrupt.h>
21
22/*
23 * CPU Revision
24 */
25/* VR4122 0x00000c70-0x00000c72 */
26#define PRID_VR4122_REV1_0 0x00000c70
27#define PRID_VR4122_REV2_0 0x00000c70
28#define PRID_VR4122_REV2_1 0x00000c70
29#define PRID_VR4122_REV3_0 0x00000c71
30#define PRID_VR4122_REV3_1 0x00000c72
31
32/* VR4181A 0x00000c73-0x00000c7f */
33#define PRID_VR4181A_REV1_0 0x00000c73
34#define PRID_VR4181A_REV1_1 0x00000c74
35
36/* VR4131 0x00000c80-0x00000c83 */
37#define PRID_VR4131_REV1_2 0x00000c80
38#define PRID_VR4131_REV2_0 0x00000c81
39#define PRID_VR4131_REV2_1 0x00000c82
40#define PRID_VR4131_REV2_2 0x00000c83
41
42/* VR4133 0x00000c84- */
43#define PRID_VR4133 0x00000c84
44
45/*
46 * Bus Control Uint
47 */
48extern unsigned long vr41xx_calculate_clock_frequency(void);
49extern unsigned long vr41xx_get_vtclock_frequency(void);
50extern unsigned long vr41xx_get_tclock_frequency(void);
51
52/*
53 * Clock Mask Unit
54 */
55typedef enum {
56 PIU_CLOCK,
57 SIU_CLOCK,
58 AIU_CLOCK,
59 KIU_CLOCK,
60 FIR_CLOCK,
61 DSIU_CLOCK,
62 CSI_CLOCK,
63 PCIU_CLOCK,
64 HSP_CLOCK,
65 PCI_CLOCK,
66 CEU_CLOCK,
67 ETHER0_CLOCK,
68 ETHER1_CLOCK
69} vr41xx_clock_t;
70
71extern void vr41xx_supply_clock(vr41xx_clock_t clock);
72extern void vr41xx_mask_clock(vr41xx_clock_t clock);
73
74/*
75 * Interrupt Control Unit
76 */
77extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
78extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int));
79
80#define PIUINT_COMMAND 0x0040
81#define PIUINT_DATA 0x0020
82#define PIUINT_PAGE1 0x0010
83#define PIUINT_PAGE0 0x0008
84#define PIUINT_DATALOST 0x0004
85#define PIUINT_STATUSCHANGE 0x0001
86
87extern void vr41xx_enable_piuint(uint16_t mask);
88extern void vr41xx_disable_piuint(uint16_t mask);
89
90#define AIUINT_INPUT_DMAEND 0x0800
91#define AIUINT_INPUT_DMAHALT 0x0400
92#define AIUINT_INPUT_DATALOST 0x0200
93#define AIUINT_INPUT_DATA 0x0100
94#define AIUINT_OUTPUT_DMAEND 0x0008
95#define AIUINT_OUTPUT_DMAHALT 0x0004
96#define AIUINT_OUTPUT_NODATA 0x0002
97
98extern void vr41xx_enable_aiuint(uint16_t mask);
99extern void vr41xx_disable_aiuint(uint16_t mask);
100
101#define KIUINT_DATALOST 0x0004
102#define KIUINT_DATAREADY 0x0002
103#define KIUINT_SCAN 0x0001
104
105extern void vr41xx_enable_kiuint(uint16_t mask);
106extern void vr41xx_disable_kiuint(uint16_t mask);
107
108#define DSIUINT_CTS 0x0800
109#define DSIUINT_RXERR 0x0400
110#define DSIUINT_RX 0x0200
111#define DSIUINT_TX 0x0100
112#define DSIUINT_ALL 0x0f00
113
114extern void vr41xx_enable_dsiuint(uint16_t mask);
115extern void vr41xx_disable_dsiuint(uint16_t mask);
116
117#define FIRINT_UNIT 0x0010
118#define FIRINT_RX_DMAEND 0x0008
119#define FIRINT_RX_DMAHALT 0x0004
120#define FIRINT_TX_DMAEND 0x0002
121#define FIRINT_TX_DMAHALT 0x0001
122
123extern void vr41xx_enable_firint(uint16_t mask);
124extern void vr41xx_disable_firint(uint16_t mask);
125
126extern void vr41xx_enable_pciint(void);
127extern void vr41xx_disable_pciint(void);
128
129extern void vr41xx_enable_scuint(void);
130extern void vr41xx_disable_scuint(void);
131
132#define CSIINT_TX_DMAEND 0x0040
133#define CSIINT_TX_DMAHALT 0x0020
134#define CSIINT_TX_DATA 0x0010
135#define CSIINT_TX_FIFOEMPTY 0x0008
136#define CSIINT_RX_DMAEND 0x0004
137#define CSIINT_RX_DMAHALT 0x0002
138#define CSIINT_RX_FIFOEMPTY 0x0001
139
140extern void vr41xx_enable_csiint(uint16_t mask);
141extern void vr41xx_disable_csiint(uint16_t mask);
142
143extern void vr41xx_enable_bcuint(void);
144extern void vr41xx_disable_bcuint(void);
145
146#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
147extern void vr41xx_siu_setup(void);
148#else
149static inline void vr41xx_siu_setup(void) {}
150#endif
151
152#endif /* __NEC_VR41XX_H */
diff --git a/include/asm-mips/war.h b/include/asm-mips/war.h
deleted file mode 100644
index 22361d5e3bf0..000000000000
--- a/include/asm-mips/war.h
+++ /dev/null
@@ -1,244 +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) 2002, 2004, 2007 by Ralf Baechle
7 * Copyright (C) 2007 Maciej W. Rozycki
8 */
9#ifndef _ASM_WAR_H
10#define _ASM_WAR_H
11
12#include <war.h>
13
14/*
15 * Work around certain R4000 CPU errata (as implemented by GCC):
16 *
17 * - A double-word or a variable shift may give an incorrect result
18 * if executed immediately after starting an integer division:
19 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
20 * erratum #28
21 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
22 * #19
23 *
24 * - A double-word or a variable shift may give an incorrect result
25 * if executed while an integer multiplication is in progress:
26 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
27 * errata #16 & #28
28 *
29 * - An integer division may give an incorrect result if started in
30 * a delay slot of a taken branch or a jump:
31 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
32 * erratum #52
33 */
34#ifdef CONFIG_CPU_R4000_WORKAROUNDS
35#define R4000_WAR 1
36#else
37#define R4000_WAR 0
38#endif
39
40/*
41 * Work around certain R4400 CPU errata (as implemented by GCC):
42 *
43 * - A double-word or a variable shift may give an incorrect result
44 * if executed immediately after starting an integer division:
45 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #10
46 * "MIPS R4400MC Errata, Processor Revision 2.0 & 3.0", erratum #4
47 */
48#ifdef CONFIG_CPU_R4400_WORKAROUNDS
49#define R4400_WAR 1
50#else
51#define R4400_WAR 0
52#endif
53
54/*
55 * Work around the "daddi" and "daddiu" CPU errata:
56 *
57 * - The `daddi' instruction fails to trap on overflow.
58 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
59 * erratum #23
60 *
61 * - The `daddiu' instruction can produce an incorrect result.
62 * "MIPS R4000PC/SC Errata, Processor Revision 2.2 and 3.0",
63 * erratum #41
64 * "MIPS R4000MC Errata, Processor Revision 2.2 and 3.0", erratum
65 * #15
66 * "MIPS R4400PC/SC Errata, Processor Revision 1.0", erratum #7
67 * "MIPS R4400MC Errata, Processor Revision 1.0", erratum #5
68 */
69#ifdef CONFIG_CPU_DADDI_WORKAROUNDS
70#define DADDI_WAR 1
71#else
72#define DADDI_WAR 0
73#endif
74
75/*
76 * Another R4600 erratum. Due to the lack of errata information the exact
77 * technical details aren't known. I've experimentally found that disabling
78 * interrupts during indexed I-cache flushes seems to be sufficient to deal
79 * with the issue.
80 */
81#ifndef R4600_V1_INDEX_ICACHEOP_WAR
82#error Check setting of R4600_V1_INDEX_ICACHEOP_WAR for your platform
83#endif
84
85/*
86 * Pleasures of the R4600 V1.x. Cite from the IDT R4600 V1.7 errata:
87 *
88 * 18. The CACHE instructions Hit_Writeback_Invalidate_D, Hit_Writeback_D,
89 * Hit_Invalidate_D and Create_Dirty_Excl_D should only be
90 * executed if there is no other dcache activity. If the dcache is
91 * accessed for another instruction immeidately preceding when these
92 * cache instructions are executing, it is possible that the dcache
93 * tag match outputs used by these cache instructions will be
94 * incorrect. These cache instructions should be preceded by at least
95 * four instructions that are not any kind of load or store
96 * instruction.
97 *
98 * This is not allowed: lw
99 * nop
100 * nop
101 * nop
102 * cache Hit_Writeback_Invalidate_D
103 *
104 * This is allowed: lw
105 * nop
106 * nop
107 * nop
108 * nop
109 * cache Hit_Writeback_Invalidate_D
110 */
111#ifndef R4600_V1_HIT_CACHEOP_WAR
112#error Check setting of R4600_V1_HIT_CACHEOP_WAR for your platform
113#endif
114
115
116/*
117 * Writeback and invalidate the primary cache dcache before DMA.
118 *
119 * R4600 v2.0 bug: "The CACHE instructions Hit_Writeback_Inv_D,
120 * Hit_Writeback_D, Hit_Invalidate_D and Create_Dirty_Exclusive_D will only
121 * operate correctly if the internal data cache refill buffer is empty. These
122 * CACHE instructions should be separated from any potential data cache miss
123 * by a load instruction to an uncached address to empty the response buffer."
124 * (Revision 2.0 device errata from IDT available on http://www.idt.com/
125 * in .pdf format.)
126 */
127#ifndef R4600_V2_HIT_CACHEOP_WAR
128#error Check setting of R4600_V2_HIT_CACHEOP_WAR for your platform
129#endif
130
131/*
132 * When an interrupt happens on a CP0 register read instruction, CPU may
133 * lock up or read corrupted values of CP0 registers after it enters
134 * the exception handler.
135 *
136 * This workaround makes sure that we read a "safe" CP0 register as the
137 * first thing in the exception handler, which breaks one of the
138 * pre-conditions for this problem.
139 */
140#ifndef R5432_CP0_INTERRUPT_WAR
141#error Check setting of R5432_CP0_INTERRUPT_WAR for your platform
142#endif
143
144/*
145 * Workaround for the Sibyte M3 errata the text of which can be found at
146 *
147 * http://sibyte.broadcom.com/hw/bcm1250/docs/pass2errata.txt
148 *
149 * This will enable the use of a special TLB refill handler which does a
150 * consistency check on the information in c0_badvaddr and c0_entryhi and
151 * will just return and take the exception again if the information was
152 * found to be inconsistent.
153 */
154#ifndef BCM1250_M3_WAR
155#error Check setting of BCM1250_M3_WAR for your platform
156#endif
157
158/*
159 * This is a DUART workaround related to glitches around register accesses
160 */
161#ifndef SIBYTE_1956_WAR
162#error Check setting of SIBYTE_1956_WAR for your platform
163#endif
164
165/*
166 * Fill buffers not flushed on CACHE instructions
167 *
168 * Hit_Invalidate_I cacheops invalidate an icache line but the refill
169 * for that line can get stale data from the fill buffer instead of
170 * accessing memory if the previous icache miss was also to that line.
171 *
172 * Workaround: generate an icache refill from a different line
173 *
174 * Affects:
175 * MIPS 4K RTL revision <3.0, PRID revision <4
176 */
177#ifndef MIPS4K_ICACHE_REFILL_WAR
178#error Check setting of MIPS4K_ICACHE_REFILL_WAR for your platform
179#endif
180
181/*
182 * Missing implicit forced flush of evictions caused by CACHE
183 * instruction
184 *
185 * Evictions caused by a CACHE instructions are not forced on to the
186 * bus. The BIU gives higher priority to fetches than to the data from
187 * the eviction buffer and no collision detection is performed between
188 * fetches and pending data from the eviction buffer.
189 *
190 * Workaround: Execute a SYNC instruction after the cache instruction
191 *
192 * Affects:
193 * MIPS 5Kc,5Kf RTL revision <2.3, PRID revision <8
194 * MIPS 20Kc RTL revision <4.0, PRID revision <?
195 */
196#ifndef MIPS_CACHE_SYNC_WAR
197#error Check setting of MIPS_CACHE_SYNC_WAR for your platform
198#endif
199
200/*
201 * From TX49/H2 manual: "If the instruction (i.e. CACHE) is issued for
202 * the line which this instruction itself exists, the following
203 * operation is not guaranteed."
204 *
205 * Workaround: do two phase flushing for Index_Invalidate_I
206 */
207#ifndef TX49XX_ICACHE_INDEX_INV_WAR
208#error Check setting of TX49XX_ICACHE_INDEX_INV_WAR for your platform
209#endif
210
211/*
212 * On the RM9000 there is a problem which makes the CreateDirtyExclusive
213 * eache operation unusable on SMP systems.
214 */
215#ifndef RM9000_CDEX_SMP_WAR
216#error Check setting of RM9000_CDEX_SMP_WAR for your platform
217#endif
218
219/*
220 * The RM7000 processors and the E9000 cores have a bug (though PMC-Sierra
221 * opposes it being called that) where invalid instructions in the same
222 * I-cache line worth of instructions being fetched may case spurious
223 * exceptions.
224 */
225#ifndef ICACHE_REFILLS_WORKAROUND_WAR
226#error Check setting of ICACHE_REFILLS_WORKAROUND_WAR for your platform
227#endif
228
229/*
230 * On the R10000 upto version 2.6 (not sure about 2.7) there is a bug that
231 * may cause ll / sc and lld / scd sequences to execute non-atomically.
232 */
233#ifndef R10000_LLSC_WAR
234#error Check setting of R10000_LLSC_WAR for your platform
235#endif
236
237/*
238 * 34K core erratum: "Problems Executing the TLBR Instruction"
239 */
240#ifndef MIPS34K_MISSED_ITLB_WAR
241#error Check setting of MIPS34K_MISSED_ITLB_WAR for your platform
242#endif
243
244#endif /* _ASM_WAR_H */
diff --git a/include/asm-mips/wbflush.h b/include/asm-mips/wbflush.h
deleted file mode 100644
index eadc0ac47e24..000000000000
--- a/include/asm-mips/wbflush.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * Header file for using the wbflush routine
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 * Copyright (C) 2002 Maciej W. Rozycki
10 */
11#ifndef _ASM_WBFLUSH_H
12#define _ASM_WBFLUSH_H
13
14
15#ifdef CONFIG_CPU_HAS_WB
16
17extern void (*__wbflush)(void);
18extern void wbflush_setup(void);
19
20#define wbflush() \
21 do { \
22 __sync(); \
23 __wbflush(); \
24 } while (0)
25
26#else /* !CONFIG_CPU_HAS_WB */
27
28#define wbflush_setup() do { } while (0)
29
30#define wbflush() fast_iob()
31
32#endif /* !CONFIG_CPU_HAS_WB */
33
34#endif /* _ASM_WBFLUSH_H */
diff --git a/include/asm-mips/xor.h b/include/asm-mips/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/include/asm-mips/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/include/asm-mips/xtalk/xtalk.h b/include/asm-mips/xtalk/xtalk.h
deleted file mode 100644
index 79bac882a739..000000000000
--- a/include/asm-mips/xtalk/xtalk.h
+++ /dev/null
@@ -1,52 +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 * xtalk.h -- platform-independent crosstalk interface, derived from
7 * IRIX <sys/PCI/bridge.h>, revision 1.38.
8 *
9 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_XTALK_XTALK_H
13#define _ASM_XTALK_XTALK_H
14
15#ifndef __ASSEMBLY__
16/*
17 * User-level device driver visible types
18 */
19typedef char xwidgetnum_t; /* xtalk widget number (0..15) */
20
21#define XWIDGET_NONE -1
22
23typedef int xwidget_part_num_t; /* xtalk widget part number */
24
25#define XWIDGET_PART_NUM_NONE -1
26
27typedef int xwidget_rev_num_t; /* xtalk widget revision number */
28
29#define XWIDGET_REV_NUM_NONE -1
30
31typedef int xwidget_mfg_num_t; /* xtalk widget manufacturing ID */
32
33#define XWIDGET_MFG_NUM_NONE -1
34
35typedef struct xtalk_piomap_s *xtalk_piomap_t;
36
37/* It is often convenient to fold the XIO target port
38 * number into the XIO address.
39 */
40#define XIO_NOWHERE (0xFFFFFFFFFFFFFFFFull)
41#define XIO_ADDR_BITS (0x0000FFFFFFFFFFFFull)
42#define XIO_PORT_BITS (0xF000000000000000ull)
43#define XIO_PORT_SHIFT (60)
44
45#define XIO_PACKED(x) (((x)&XIO_PORT_BITS) != 0)
46#define XIO_ADDR(x) ((x)&XIO_ADDR_BITS)
47#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
48#define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
49
50#endif /* !__ASSEMBLY__ */
51
52#endif /* _ASM_XTALK_XTALK_H */
diff --git a/include/asm-mips/xtalk/xwidget.h b/include/asm-mips/xtalk/xwidget.h
deleted file mode 100644
index b4a13d7405ee..000000000000
--- a/include/asm-mips/xtalk/xwidget.h
+++ /dev/null
@@ -1,167 +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 * xwidget.h - generic crosstalk widget header file, derived from IRIX
7 * <sys/xtalk/xtalkwidget.h>, revision 1.32.
8 *
9 * Copyright (C) 1996, 1999 Silcon Graphics, Inc.
10 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
11 */
12#ifndef _ASM_XTALK_XWIDGET_H
13#define _ASM_XTALK_XWIDGET_H
14
15#include <linux/types.h>
16#include <asm/xtalk/xtalk.h>
17
18#define WIDGET_ID 0x04
19#define WIDGET_STATUS 0x0c
20#define WIDGET_ERR_UPPER_ADDR 0x14
21#define WIDGET_ERR_LOWER_ADDR 0x1c
22#define WIDGET_CONTROL 0x24
23#define WIDGET_REQ_TIMEOUT 0x2c
24#define WIDGET_INTDEST_UPPER_ADDR 0x34
25#define WIDGET_INTDEST_LOWER_ADDR 0x3c
26#define WIDGET_ERR_CMD_WORD 0x44
27#define WIDGET_LLP_CFG 0x4c
28#define WIDGET_TFLUSH 0x54
29
30/* WIDGET_ID */
31#define WIDGET_REV_NUM 0xf0000000
32#define WIDGET_PART_NUM 0x0ffff000
33#define WIDGET_MFG_NUM 0x00000ffe
34#define WIDGET_REV_NUM_SHFT 28
35#define WIDGET_PART_NUM_SHFT 12
36#define WIDGET_MFG_NUM_SHFT 1
37
38#define XWIDGET_PART_NUM(widgetid) (((widgetid) & WIDGET_PART_NUM) >> WIDGET_PART_NUM_SHFT)
39#define XWIDGET_REV_NUM(widgetid) (((widgetid) & WIDGET_REV_NUM) >> WIDGET_REV_NUM_SHFT)
40#define XWIDGET_MFG_NUM(widgetid) (((widgetid) & WIDGET_MFG_NUM) >> WIDGET_MFG_NUM_SHFT)
41
42/* WIDGET_STATUS */
43#define WIDGET_LLP_REC_CNT 0xff000000
44#define WIDGET_LLP_TX_CNT 0x00ff0000
45#define WIDGET_PENDING 0x0000001f
46
47/* WIDGET_ERR_UPPER_ADDR */
48#define WIDGET_ERR_UPPER_ADDR_ONLY 0x0000ffff
49
50/* WIDGET_CONTROL */
51#define WIDGET_F_BAD_PKT 0x00010000
52#define WIDGET_LLP_XBAR_CRD 0x0000f000
53#define WIDGET_LLP_XBAR_CRD_SHFT 12
54#define WIDGET_CLR_RLLP_CNT 0x00000800
55#define WIDGET_CLR_TLLP_CNT 0x00000400
56#define WIDGET_SYS_END 0x00000200
57#define WIDGET_MAX_TRANS 0x000001f0
58#define WIDGET_WIDGET_ID 0x0000000f
59
60/* WIDGET_INTDEST_UPPER_ADDR */
61#define WIDGET_INT_VECTOR 0xff000000
62#define WIDGET_INT_VECTOR_SHFT 24
63#define WIDGET_TARGET_ID 0x000f0000
64#define WIDGET_TARGET_ID_SHFT 16
65#define WIDGET_UPP_ADDR 0x0000ffff
66
67/* WIDGET_ERR_CMD_WORD */
68#define WIDGET_DIDN 0xf0000000
69#define WIDGET_SIDN 0x0f000000
70#define WIDGET_PACTYP 0x00f00000
71#define WIDGET_TNUM 0x000f8000
72#define WIDGET_COHERENT 0x00004000
73#define WIDGET_DS 0x00003000
74#define WIDGET_GBR 0x00000800
75#define WIDGET_VBPM 0x00000400
76#define WIDGET_ERROR 0x00000200
77#define WIDGET_BARRIER 0x00000100
78
79/* WIDGET_LLP_CFG */
80#define WIDGET_LLP_MAXRETRY 0x03ff0000
81#define WIDGET_LLP_MAXRETRY_SHFT 16
82#define WIDGET_LLP_NULLTIMEOUT 0x0000fc00
83#define WIDGET_LLP_NULLTIMEOUT_SHFT 10
84#define WIDGET_LLP_MAXBURST 0x000003ff
85#define WIDGET_LLP_MAXBURST_SHFT 0
86
87/*
88 * according to the crosstalk spec, only 32-bits access to the widget
89 * configuration registers is allowed. some widgets may allow 64-bits
90 * access but software should not depend on it. registers beyond the
91 * widget target flush register are widget dependent thus will not be
92 * defined here
93 */
94#ifndef __ASSEMBLY__
95typedef u32 widgetreg_t;
96
97/* widget configuration registers */
98typedef volatile struct widget_cfg {
99 widgetreg_t w_pad_0; /* 0x00 */
100 widgetreg_t w_id; /* 0x04 */
101 widgetreg_t w_pad_1; /* 0x08 */
102 widgetreg_t w_status; /* 0x0c */
103 widgetreg_t w_pad_2; /* 0x10 */
104 widgetreg_t w_err_upper_addr; /* 0x14 */
105 widgetreg_t w_pad_3; /* 0x18 */
106 widgetreg_t w_err_lower_addr; /* 0x1c */
107 widgetreg_t w_pad_4; /* 0x20 */
108 widgetreg_t w_control; /* 0x24 */
109 widgetreg_t w_pad_5; /* 0x28 */
110 widgetreg_t w_req_timeout; /* 0x2c */
111 widgetreg_t w_pad_6; /* 0x30 */
112 widgetreg_t w_intdest_upper_addr; /* 0x34 */
113 widgetreg_t w_pad_7; /* 0x38 */
114 widgetreg_t w_intdest_lower_addr; /* 0x3c */
115 widgetreg_t w_pad_8; /* 0x40 */
116 widgetreg_t w_err_cmd_word; /* 0x44 */
117 widgetreg_t w_pad_9; /* 0x48 */
118 widgetreg_t w_llp_cfg; /* 0x4c */
119 widgetreg_t w_pad_10; /* 0x50 */
120 widgetreg_t w_tflush; /* 0x54 */
121} widget_cfg_t;
122
123typedef struct {
124 unsigned didn:4;
125 unsigned sidn:4;
126 unsigned pactyp:4;
127 unsigned tnum:5;
128 unsigned ct:1;
129 unsigned ds:2;
130 unsigned gbr:1;
131 unsigned vbpm:1;
132 unsigned error:1;
133 unsigned bo:1;
134 unsigned other:8;
135} w_err_cmd_word_f;
136
137typedef union {
138 widgetreg_t r;
139 w_err_cmd_word_f f;
140} w_err_cmd_word_u;
141
142typedef struct xwidget_info_s *xwidget_info_t;
143
144/*
145 * Crosstalk Widget Hardware Identification, as defined in the Crosstalk spec.
146 */
147typedef struct xwidget_hwid_s {
148 xwidget_part_num_t part_num;
149 xwidget_rev_num_t rev_num;
150 xwidget_mfg_num_t mfg_num;
151} *xwidget_hwid_t;
152
153
154/*
155 * Returns 1 if a driver that handles devices described by hwid1 is able
156 * to manage a device with hardwareid hwid2. NOTE: We don't check rev
157 * numbers at all.
158 */
159#define XWIDGET_HARDWARE_ID_MATCH(hwid1, hwid2) \
160 (((hwid1)->part_num == (hwid2)->part_num) && \
161 (((hwid1)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
162 ((hwid2)->mfg_num == XWIDGET_MFG_NUM_NONE) || \
163 ((hwid1)->mfg_num == (hwid2)->mfg_num)))
164
165#endif /* !__ASSEMBLY__ */
166
167#endif /* _ASM_XTALK_XWIDGET_H */
diff --git a/include/asm-mn10300/elf.h b/include/asm-mn10300/elf.h
index 256a70466ca4..bf09f8bb392e 100644
--- a/include/asm-mn10300/elf.h
+++ b/include/asm-mn10300/elf.h
@@ -141,7 +141,7 @@ do { \
141#define ELF_PLATFORM (NULL) 141#define ELF_PLATFORM (NULL)
142 142
143#ifdef __KERNEL__ 143#ifdef __KERNEL__
144#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX) 144#define SET_PERSONALITY(ex) set_personality(PER_LINUX)
145#endif 145#endif
146 146
147#endif /* _ASM_ELF_H */ 147#endif /* _ASM_ELF_H */
diff --git a/include/asm-parisc/Kbuild b/include/asm-parisc/Kbuild
deleted file mode 100644
index f88b252e419c..000000000000
--- a/include/asm-parisc/Kbuild
+++ /dev/null
@@ -1,3 +0,0 @@
1include include/asm-generic/Kbuild.asm
2
3unifdef-y += pdc.h
diff --git a/include/asm-parisc/a.out.h b/include/asm-parisc/a.out.h
deleted file mode 100644
index eb04e34c5bb1..000000000000
--- a/include/asm-parisc/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __PARISC_A_OUT_H__
2#define __PARISC_A_OUT_H__
3
4struct exec
5{
6 unsigned int a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-parisc/agp.h b/include/asm-parisc/agp.h
deleted file mode 100644
index 9651660da639..000000000000
--- a/include/asm-parisc/agp.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _ASM_PARISC_AGP_H
2#define _ASM_PARISC_AGP_H
3
4/*
5 * PARISC specific AGP definitions.
6 * Copyright (c) 2006 Kyle McMartin <kyle@parisc-linux.org>
7 *
8 */
9
10#define map_page_into_agp(page) /* nothing */
11#define unmap_page_from_agp(page) /* nothing */
12#define flush_agp_cache() mb()
13
14/* Convert a physical address to an address suitable for the GART. */
15#define phys_to_gart(x) (x)
16#define gart_to_phys(x) (x)
17
18/* GATT allocation. Returns/accepts GATT kernel virtual address. */
19#define alloc_gatt_pages(order) \
20 ((char *)__get_free_pages(GFP_KERNEL, (order)))
21#define free_gatt_pages(table, order) \
22 free_pages((unsigned long)(table), (order))
23
24#endif /* _ASM_PARISC_AGP_H */
diff --git a/include/asm-parisc/asmregs.h b/include/asm-parisc/asmregs.h
deleted file mode 100644
index d93c646e1887..000000000000
--- a/include/asm-parisc/asmregs.h
+++ /dev/null
@@ -1,183 +0,0 @@
1/*
2 * Copyright (C) 1999 Hewlett-Packard (Frank Rowand)
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, or (at your option)
7 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _PARISC_ASMREGS_H
20#define _PARISC_ASMREGS_H
21
22;! General Registers
23
24rp: .reg %r2
25arg3: .reg %r23
26arg2: .reg %r24
27arg1: .reg %r25
28arg0: .reg %r26
29dp: .reg %r27
30ret0: .reg %r28
31ret1: .reg %r29
32sl: .reg %r29
33sp: .reg %r30
34
35#if 0
36/* PA20_REVISIT */
37arg7: .reg r19
38arg6: .reg r20
39arg5: .reg r21
40arg4: .reg r22
41gp: .reg r27
42ap: .reg r29
43#endif
44
45
46r0: .reg %r0
47r1: .reg %r1
48r2: .reg %r2
49r3: .reg %r3
50r4: .reg %r4
51r5: .reg %r5
52r6: .reg %r6
53r7: .reg %r7
54r8: .reg %r8
55r9: .reg %r9
56r10: .reg %r10
57r11: .reg %r11
58r12: .reg %r12
59r13: .reg %r13
60r14: .reg %r14
61r15: .reg %r15
62r16: .reg %r16
63r17: .reg %r17
64r18: .reg %r18
65r19: .reg %r19
66r20: .reg %r20
67r21: .reg %r21
68r22: .reg %r22
69r23: .reg %r23
70r24: .reg %r24
71r25: .reg %r25
72r26: .reg %r26
73r27: .reg %r27
74r28: .reg %r28
75r29: .reg %r29
76r30: .reg %r30
77r31: .reg %r31
78
79
80;! Space Registers
81
82sr0: .reg %sr0
83sr1: .reg %sr1
84sr2: .reg %sr2
85sr3: .reg %sr3
86sr4: .reg %sr4
87sr5: .reg %sr5
88sr6: .reg %sr6
89sr7: .reg %sr7
90
91
92;! Floating Point Registers
93
94fr0: .reg %fr0
95fr1: .reg %fr1
96fr2: .reg %fr2
97fr3: .reg %fr3
98fr4: .reg %fr4
99fr5: .reg %fr5
100fr6: .reg %fr6
101fr7: .reg %fr7
102fr8: .reg %fr8
103fr9: .reg %fr9
104fr10: .reg %fr10
105fr11: .reg %fr11
106fr12: .reg %fr12
107fr13: .reg %fr13
108fr14: .reg %fr14
109fr15: .reg %fr15
110fr16: .reg %fr16
111fr17: .reg %fr17
112fr18: .reg %fr18
113fr19: .reg %fr19
114fr20: .reg %fr20
115fr21: .reg %fr21
116fr22: .reg %fr22
117fr23: .reg %fr23
118fr24: .reg %fr24
119fr25: .reg %fr25
120fr26: .reg %fr26
121fr27: .reg %fr27
122fr28: .reg %fr28
123fr29: .reg %fr29
124fr30: .reg %fr30
125fr31: .reg %fr31
126
127
128;! Control Registers
129
130rctr: .reg %cr0
131pidr1: .reg %cr8
132pidr2: .reg %cr9
133ccr: .reg %cr10
134sar: .reg %cr11
135pidr3: .reg %cr12
136pidr4: .reg %cr13
137iva: .reg %cr14
138eiem: .reg %cr15
139itmr: .reg %cr16
140pcsq: .reg %cr17
141pcoq: .reg %cr18
142iir: .reg %cr19
143isr: .reg %cr20
144ior: .reg %cr21
145ipsw: .reg %cr22
146eirr: .reg %cr23
147tr0: .reg %cr24
148tr1: .reg %cr25
149tr2: .reg %cr26
150tr3: .reg %cr27
151tr4: .reg %cr28
152tr5: .reg %cr29
153tr6: .reg %cr30
154tr7: .reg %cr31
155
156
157cr0: .reg %cr0
158cr8: .reg %cr8
159cr9: .reg %cr9
160cr10: .reg %cr10
161cr11: .reg %cr11
162cr12: .reg %cr12
163cr13: .reg %cr13
164cr14: .reg %cr14
165cr15: .reg %cr15
166cr16: .reg %cr16
167cr17: .reg %cr17
168cr18: .reg %cr18
169cr19: .reg %cr19
170cr20: .reg %cr20
171cr21: .reg %cr21
172cr22: .reg %cr22
173cr23: .reg %cr23
174cr24: .reg %cr24
175cr25: .reg %cr25
176cr26: .reg %cr26
177cr27: .reg %cr27
178cr28: .reg %cr28
179cr29: .reg %cr29
180cr30: .reg %cr30
181cr31: .reg %cr31
182
183#endif
diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h
deleted file mode 100644
index ffb208840ecc..000000000000
--- a/include/asm-parisc/assembly.h
+++ /dev/null
@@ -1,519 +0,0 @@
1/*
2 * Copyright (C) 1999 Hewlett-Packard (Frank Rowand)
3 * Copyright (C) 1999 Philipp Rumpf <prumpf@tux.org>
4 * Copyright (C) 1999 SuSE GmbH
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, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _PARISC_ASSEMBLY_H
22#define _PARISC_ASSEMBLY_H
23
24#define CALLEE_FLOAT_FRAME_SIZE 80
25
26#ifdef CONFIG_64BIT
27#define LDREG ldd
28#define STREG std
29#define LDREGX ldd,s
30#define LDREGM ldd,mb
31#define STREGM std,ma
32#define SHRREG shrd
33#define SHLREG shld
34#define ANDCM andcm,*
35#define COND(x) * ## x
36#define RP_OFFSET 16
37#define FRAME_SIZE 128
38#define CALLEE_REG_FRAME_SIZE 144
39#define ASM_ULONG_INSN .dword
40#else /* CONFIG_64BIT */
41#define LDREG ldw
42#define STREG stw
43#define LDREGX ldwx,s
44#define LDREGM ldwm
45#define STREGM stwm
46#define SHRREG shr
47#define SHLREG shlw
48#define ANDCM andcm
49#define COND(x) x
50#define RP_OFFSET 20
51#define FRAME_SIZE 64
52#define CALLEE_REG_FRAME_SIZE 128
53#define ASM_ULONG_INSN .word
54#endif
55
56#define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE)
57
58#ifdef CONFIG_PA20
59#define LDCW ldcw,co
60#define BL b,l
61# ifdef CONFIG_64BIT
62# define LEVEL 2.0w
63# else
64# define LEVEL 2.0
65# endif
66#else
67#define LDCW ldcw
68#define BL bl
69#define LEVEL 1.1
70#endif
71
72#ifdef __ASSEMBLY__
73
74#ifdef CONFIG_64BIT
75/* the 64-bit pa gnu assembler unfortunately defaults to .level 1.1 or 2.0 so
76 * work around that for now... */
77 .level 2.0w
78#endif
79
80#include <asm/asm-offsets.h>
81#include <asm/page.h>
82
83#include <asm/asmregs.h>
84
85 sp = 30
86 gp = 27
87 ipsw = 22
88
89 /*
90 * We provide two versions of each macro to convert from physical
91 * to virtual and vice versa. The "_r1" versions take one argument
92 * register, but trashes r1 to do the conversion. The other
93 * version takes two arguments: a src and destination register.
94 * However, the source and destination registers can not be
95 * the same register.
96 */
97
98 .macro tophys grvirt, grphys
99 ldil L%(__PAGE_OFFSET), \grphys
100 sub \grvirt, \grphys, \grphys
101 .endm
102
103 .macro tovirt grphys, grvirt
104 ldil L%(__PAGE_OFFSET), \grvirt
105 add \grphys, \grvirt, \grvirt
106 .endm
107
108 .macro tophys_r1 gr
109 ldil L%(__PAGE_OFFSET), %r1
110 sub \gr, %r1, \gr
111 .endm
112
113 .macro tovirt_r1 gr
114 ldil L%(__PAGE_OFFSET), %r1
115 add \gr, %r1, \gr
116 .endm
117
118 .macro delay value
119 ldil L%\value, 1
120 ldo R%\value(1), 1
121 addib,UV,n -1,1,.
122 addib,NUV,n -1,1,.+8
123 nop
124 .endm
125
126 .macro debug value
127 .endm
128
129
130 /* Shift Left - note the r and t can NOT be the same! */
131 .macro shl r, sa, t
132 dep,z \r, 31-\sa, 32-\sa, \t
133 .endm
134
135 /* The PA 2.0 shift left */
136 .macro shlw r, sa, t
137 depw,z \r, 31-\sa, 32-\sa, \t
138 .endm
139
140 /* And the PA 2.0W shift left */
141 .macro shld r, sa, t
142 depd,z \r, 63-\sa, 64-\sa, \t
143 .endm
144
145 /* Shift Right - note the r and t can NOT be the same! */
146 .macro shr r, sa, t
147 extru \r, 31-\sa, 32-\sa, \t
148 .endm
149
150 /* pa20w version of shift right */
151 .macro shrd r, sa, t
152 extrd,u \r, 63-\sa, 64-\sa, \t
153 .endm
154
155 /* load 32-bit 'value' into 'reg' compensating for the ldil
156 * sign-extension when running in wide mode.
157 * WARNING!! neither 'value' nor 'reg' can be expressions
158 * containing '.'!!!! */
159 .macro load32 value, reg
160 ldil L%\value, \reg
161 ldo R%\value(\reg), \reg
162 .endm
163
164 .macro loadgp
165#ifdef CONFIG_64BIT
166 ldil L%__gp, %r27
167 ldo R%__gp(%r27), %r27
168#else
169 ldil L%$global$, %r27
170 ldo R%$global$(%r27), %r27
171#endif
172 .endm
173
174#define SAVE_SP(r, where) mfsp r, %r1 ! STREG %r1, where
175#define REST_SP(r, where) LDREG where, %r1 ! mtsp %r1, r
176#define SAVE_CR(r, where) mfctl r, %r1 ! STREG %r1, where
177#define REST_CR(r, where) LDREG where, %r1 ! mtctl %r1, r
178
179 .macro save_general regs
180 STREG %r1, PT_GR1 (\regs)
181 STREG %r2, PT_GR2 (\regs)
182 STREG %r3, PT_GR3 (\regs)
183 STREG %r4, PT_GR4 (\regs)
184 STREG %r5, PT_GR5 (\regs)
185 STREG %r6, PT_GR6 (\regs)
186 STREG %r7, PT_GR7 (\regs)
187 STREG %r8, PT_GR8 (\regs)
188 STREG %r9, PT_GR9 (\regs)
189 STREG %r10, PT_GR10(\regs)
190 STREG %r11, PT_GR11(\regs)
191 STREG %r12, PT_GR12(\regs)
192 STREG %r13, PT_GR13(\regs)
193 STREG %r14, PT_GR14(\regs)
194 STREG %r15, PT_GR15(\regs)
195 STREG %r16, PT_GR16(\regs)
196 STREG %r17, PT_GR17(\regs)
197 STREG %r18, PT_GR18(\regs)
198 STREG %r19, PT_GR19(\regs)
199 STREG %r20, PT_GR20(\regs)
200 STREG %r21, PT_GR21(\regs)
201 STREG %r22, PT_GR22(\regs)
202 STREG %r23, PT_GR23(\regs)
203 STREG %r24, PT_GR24(\regs)
204 STREG %r25, PT_GR25(\regs)
205 /* r26 is saved in get_stack and used to preserve a value across virt_map */
206 STREG %r27, PT_GR27(\regs)
207 STREG %r28, PT_GR28(\regs)
208 /* r29 is saved in get_stack and used to point to saved registers */
209 /* r30 stack pointer saved in get_stack */
210 STREG %r31, PT_GR31(\regs)
211 .endm
212
213 .macro rest_general regs
214 /* r1 used as a temp in rest_stack and is restored there */
215 LDREG PT_GR2 (\regs), %r2
216 LDREG PT_GR3 (\regs), %r3
217 LDREG PT_GR4 (\regs), %r4
218 LDREG PT_GR5 (\regs), %r5
219 LDREG PT_GR6 (\regs), %r6
220 LDREG PT_GR7 (\regs), %r7
221 LDREG PT_GR8 (\regs), %r8
222 LDREG PT_GR9 (\regs), %r9
223 LDREG PT_GR10(\regs), %r10
224 LDREG PT_GR11(\regs), %r11
225 LDREG PT_GR12(\regs), %r12
226 LDREG PT_GR13(\regs), %r13
227 LDREG PT_GR14(\regs), %r14
228 LDREG PT_GR15(\regs), %r15
229 LDREG PT_GR16(\regs), %r16
230 LDREG PT_GR17(\regs), %r17
231 LDREG PT_GR18(\regs), %r18
232 LDREG PT_GR19(\regs), %r19
233 LDREG PT_GR20(\regs), %r20
234 LDREG PT_GR21(\regs), %r21
235 LDREG PT_GR22(\regs), %r22
236 LDREG PT_GR23(\regs), %r23
237 LDREG PT_GR24(\regs), %r24
238 LDREG PT_GR25(\regs), %r25
239 LDREG PT_GR26(\regs), %r26
240 LDREG PT_GR27(\regs), %r27
241 LDREG PT_GR28(\regs), %r28
242 /* r29 points to register save area, and is restored in rest_stack */
243 /* r30 stack pointer restored in rest_stack */
244 LDREG PT_GR31(\regs), %r31
245 .endm
246
247 .macro save_fp regs
248 fstd,ma %fr0, 8(\regs)
249 fstd,ma %fr1, 8(\regs)
250 fstd,ma %fr2, 8(\regs)
251 fstd,ma %fr3, 8(\regs)
252 fstd,ma %fr4, 8(\regs)
253 fstd,ma %fr5, 8(\regs)
254 fstd,ma %fr6, 8(\regs)
255 fstd,ma %fr7, 8(\regs)
256 fstd,ma %fr8, 8(\regs)
257 fstd,ma %fr9, 8(\regs)
258 fstd,ma %fr10, 8(\regs)
259 fstd,ma %fr11, 8(\regs)
260 fstd,ma %fr12, 8(\regs)
261 fstd,ma %fr13, 8(\regs)
262 fstd,ma %fr14, 8(\regs)
263 fstd,ma %fr15, 8(\regs)
264 fstd,ma %fr16, 8(\regs)
265 fstd,ma %fr17, 8(\regs)
266 fstd,ma %fr18, 8(\regs)
267 fstd,ma %fr19, 8(\regs)
268 fstd,ma %fr20, 8(\regs)
269 fstd,ma %fr21, 8(\regs)
270 fstd,ma %fr22, 8(\regs)
271 fstd,ma %fr23, 8(\regs)
272 fstd,ma %fr24, 8(\regs)
273 fstd,ma %fr25, 8(\regs)
274 fstd,ma %fr26, 8(\regs)
275 fstd,ma %fr27, 8(\regs)
276 fstd,ma %fr28, 8(\regs)
277 fstd,ma %fr29, 8(\regs)
278 fstd,ma %fr30, 8(\regs)
279 fstd %fr31, 0(\regs)
280 .endm
281
282 .macro rest_fp regs
283 fldd 0(\regs), %fr31
284 fldd,mb -8(\regs), %fr30
285 fldd,mb -8(\regs), %fr29
286 fldd,mb -8(\regs), %fr28
287 fldd,mb -8(\regs), %fr27
288 fldd,mb -8(\regs), %fr26
289 fldd,mb -8(\regs), %fr25
290 fldd,mb -8(\regs), %fr24
291 fldd,mb -8(\regs), %fr23
292 fldd,mb -8(\regs), %fr22
293 fldd,mb -8(\regs), %fr21
294 fldd,mb -8(\regs), %fr20
295 fldd,mb -8(\regs), %fr19
296 fldd,mb -8(\regs), %fr18
297 fldd,mb -8(\regs), %fr17
298 fldd,mb -8(\regs), %fr16
299 fldd,mb -8(\regs), %fr15
300 fldd,mb -8(\regs), %fr14
301 fldd,mb -8(\regs), %fr13
302 fldd,mb -8(\regs), %fr12
303 fldd,mb -8(\regs), %fr11
304 fldd,mb -8(\regs), %fr10
305 fldd,mb -8(\regs), %fr9
306 fldd,mb -8(\regs), %fr8
307 fldd,mb -8(\regs), %fr7
308 fldd,mb -8(\regs), %fr6
309 fldd,mb -8(\regs), %fr5
310 fldd,mb -8(\regs), %fr4
311 fldd,mb -8(\regs), %fr3
312 fldd,mb -8(\regs), %fr2
313 fldd,mb -8(\regs), %fr1
314 fldd,mb -8(\regs), %fr0
315 .endm
316
317 .macro callee_save_float
318 fstd,ma %fr12, 8(%r30)
319 fstd,ma %fr13, 8(%r30)
320 fstd,ma %fr14, 8(%r30)
321 fstd,ma %fr15, 8(%r30)
322 fstd,ma %fr16, 8(%r30)
323 fstd,ma %fr17, 8(%r30)
324 fstd,ma %fr18, 8(%r30)
325 fstd,ma %fr19, 8(%r30)
326 fstd,ma %fr20, 8(%r30)
327 fstd,ma %fr21, 8(%r30)
328 .endm
329
330 .macro callee_rest_float
331 fldd,mb -8(%r30), %fr21
332 fldd,mb -8(%r30), %fr20
333 fldd,mb -8(%r30), %fr19
334 fldd,mb -8(%r30), %fr18
335 fldd,mb -8(%r30), %fr17
336 fldd,mb -8(%r30), %fr16
337 fldd,mb -8(%r30), %fr15
338 fldd,mb -8(%r30), %fr14
339 fldd,mb -8(%r30), %fr13
340 fldd,mb -8(%r30), %fr12
341 .endm
342
343#ifdef CONFIG_64BIT
344 .macro callee_save
345 std,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
346 mfctl %cr27, %r3
347 std %r4, -136(%r30)
348 std %r5, -128(%r30)
349 std %r6, -120(%r30)
350 std %r7, -112(%r30)
351 std %r8, -104(%r30)
352 std %r9, -96(%r30)
353 std %r10, -88(%r30)
354 std %r11, -80(%r30)
355 std %r12, -72(%r30)
356 std %r13, -64(%r30)
357 std %r14, -56(%r30)
358 std %r15, -48(%r30)
359 std %r16, -40(%r30)
360 std %r17, -32(%r30)
361 std %r18, -24(%r30)
362 std %r3, -16(%r30)
363 .endm
364
365 .macro callee_rest
366 ldd -16(%r30), %r3
367 ldd -24(%r30), %r18
368 ldd -32(%r30), %r17
369 ldd -40(%r30), %r16
370 ldd -48(%r30), %r15
371 ldd -56(%r30), %r14
372 ldd -64(%r30), %r13
373 ldd -72(%r30), %r12
374 ldd -80(%r30), %r11
375 ldd -88(%r30), %r10
376 ldd -96(%r30), %r9
377 ldd -104(%r30), %r8
378 ldd -112(%r30), %r7
379 ldd -120(%r30), %r6
380 ldd -128(%r30), %r5
381 ldd -136(%r30), %r4
382 mtctl %r3, %cr27
383 ldd,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
384 .endm
385
386#else /* ! CONFIG_64BIT */
387
388 .macro callee_save
389 stw,ma %r3, CALLEE_REG_FRAME_SIZE(%r30)
390 mfctl %cr27, %r3
391 stw %r4, -124(%r30)
392 stw %r5, -120(%r30)
393 stw %r6, -116(%r30)
394 stw %r7, -112(%r30)
395 stw %r8, -108(%r30)
396 stw %r9, -104(%r30)
397 stw %r10, -100(%r30)
398 stw %r11, -96(%r30)
399 stw %r12, -92(%r30)
400 stw %r13, -88(%r30)
401 stw %r14, -84(%r30)
402 stw %r15, -80(%r30)
403 stw %r16, -76(%r30)
404 stw %r17, -72(%r30)
405 stw %r18, -68(%r30)
406 stw %r3, -64(%r30)
407 .endm
408
409 .macro callee_rest
410 ldw -64(%r30), %r3
411 ldw -68(%r30), %r18
412 ldw -72(%r30), %r17
413 ldw -76(%r30), %r16
414 ldw -80(%r30), %r15
415 ldw -84(%r30), %r14
416 ldw -88(%r30), %r13
417 ldw -92(%r30), %r12
418 ldw -96(%r30), %r11
419 ldw -100(%r30), %r10
420 ldw -104(%r30), %r9
421 ldw -108(%r30), %r8
422 ldw -112(%r30), %r7
423 ldw -116(%r30), %r6
424 ldw -120(%r30), %r5
425 ldw -124(%r30), %r4
426 mtctl %r3, %cr27
427 ldw,mb -CALLEE_REG_FRAME_SIZE(%r30), %r3
428 .endm
429#endif /* ! CONFIG_64BIT */
430
431 .macro save_specials regs
432
433 SAVE_SP (%sr0, PT_SR0 (\regs))
434 SAVE_SP (%sr1, PT_SR1 (\regs))
435 SAVE_SP (%sr2, PT_SR2 (\regs))
436 SAVE_SP (%sr3, PT_SR3 (\regs))
437 SAVE_SP (%sr4, PT_SR4 (\regs))
438 SAVE_SP (%sr5, PT_SR5 (\regs))
439 SAVE_SP (%sr6, PT_SR6 (\regs))
440 SAVE_SP (%sr7, PT_SR7 (\regs))
441
442 SAVE_CR (%cr17, PT_IASQ0(\regs))
443 mtctl %r0, %cr17
444 SAVE_CR (%cr17, PT_IASQ1(\regs))
445
446 SAVE_CR (%cr18, PT_IAOQ0(\regs))
447 mtctl %r0, %cr18
448 SAVE_CR (%cr18, PT_IAOQ1(\regs))
449
450#ifdef CONFIG_64BIT
451 /* cr11 (sar) is a funny one. 5 bits on PA1.1 and 6 bit on PA2.0
452 * For PA2.0 mtsar or mtctl always write 6 bits, but mfctl only
453 * reads 5 bits. Use mfctl,w to read all six bits. Otherwise
454 * we lose the 6th bit on a save/restore over interrupt.
455 */
456 mfctl,w %cr11, %r1
457 STREG %r1, PT_SAR (\regs)
458#else
459 SAVE_CR (%cr11, PT_SAR (\regs))
460#endif
461 SAVE_CR (%cr19, PT_IIR (\regs))
462
463 /*
464 * Code immediately following this macro (in intr_save) relies
465 * on r8 containing ipsw.
466 */
467 mfctl %cr22, %r8
468 STREG %r8, PT_PSW(\regs)
469 .endm
470
471 .macro rest_specials regs
472
473 REST_SP (%sr0, PT_SR0 (\regs))
474 REST_SP (%sr1, PT_SR1 (\regs))
475 REST_SP (%sr2, PT_SR2 (\regs))
476 REST_SP (%sr3, PT_SR3 (\regs))
477 REST_SP (%sr4, PT_SR4 (\regs))
478 REST_SP (%sr5, PT_SR5 (\regs))
479 REST_SP (%sr6, PT_SR6 (\regs))
480 REST_SP (%sr7, PT_SR7 (\regs))
481
482 REST_CR (%cr17, PT_IASQ0(\regs))
483 REST_CR (%cr17, PT_IASQ1(\regs))
484
485 REST_CR (%cr18, PT_IAOQ0(\regs))
486 REST_CR (%cr18, PT_IAOQ1(\regs))
487
488 REST_CR (%cr11, PT_SAR (\regs))
489
490 REST_CR (%cr22, PT_PSW (\regs))
491 .endm
492
493
494 /* First step to create a "relied upon translation"
495 * See PA 2.0 Arch. page F-4 and F-5.
496 *
497 * The ssm was originally necessary due to a "PCxT bug".
498 * But someone decided it needed to be added to the architecture
499 * and this "feature" went into rev3 of PA-RISC 1.1 Arch Manual.
500 * It's been carried forward into PA 2.0 Arch as well. :^(
501 *
502 * "ssm 0,%r0" is a NOP with side effects (prefetch barrier).
503 * rsm/ssm prevents the ifetch unit from speculatively fetching
504 * instructions past this line in the code stream.
505 * PA 2.0 processor will single step all insn in the same QUAD (4 insn).
506 */
507 .macro pcxt_ssm_bug
508 rsm PSW_SM_I,%r0
509 nop /* 1 */
510 nop /* 2 */
511 nop /* 3 */
512 nop /* 4 */
513 nop /* 5 */
514 nop /* 6 */
515 nop /* 7 */
516 .endm
517
518#endif /* __ASSEMBLY__ */
519#endif
diff --git a/include/asm-parisc/atomic.h b/include/asm-parisc/atomic.h
deleted file mode 100644
index 57fcc4a5ebb4..000000000000
--- a/include/asm-parisc/atomic.h
+++ /dev/null
@@ -1,348 +0,0 @@
1/* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
2 * Copyright (C) 2006 Kyle McMartin <kyle@parisc-linux.org>
3 */
4
5#ifndef _ASM_PARISC_ATOMIC_H_
6#define _ASM_PARISC_ATOMIC_H_
7
8#include <linux/types.h>
9#include <asm/system.h>
10
11/*
12 * Atomic operations that C can't guarantee us. Useful for
13 * resource counting etc..
14 *
15 * And probably incredibly slow on parisc. OTOH, we don't
16 * have to write any serious assembly. prumpf
17 */
18
19#ifdef CONFIG_SMP
20#include <asm/spinlock.h>
21#include <asm/cache.h> /* we use L1_CACHE_BYTES */
22
23/* Use an array of spinlocks for our atomic_ts.
24 * Hash function to index into a different SPINLOCK.
25 * Since "a" is usually an address, use one spinlock per cacheline.
26 */
27# define ATOMIC_HASH_SIZE 4
28# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ]))
29
30extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
31
32/* Can't use raw_spin_lock_irq because of #include problems, so
33 * this is the substitute */
34#define _atomic_spin_lock_irqsave(l,f) do { \
35 raw_spinlock_t *s = ATOMIC_HASH(l); \
36 local_irq_save(f); \
37 __raw_spin_lock(s); \
38} while(0)
39
40#define _atomic_spin_unlock_irqrestore(l,f) do { \
41 raw_spinlock_t *s = ATOMIC_HASH(l); \
42 __raw_spin_unlock(s); \
43 local_irq_restore(f); \
44} while(0)
45
46
47#else
48# define _atomic_spin_lock_irqsave(l,f) do { local_irq_save(f); } while (0)
49# define _atomic_spin_unlock_irqrestore(l,f) do { local_irq_restore(f); } while (0)
50#endif
51
52/* This should get optimized out since it's never called.
53** Or get a link error if xchg is used "wrong".
54*/
55extern void __xchg_called_with_bad_pointer(void);
56
57
58/* __xchg32/64 defined in arch/parisc/lib/bitops.c */
59extern unsigned long __xchg8(char, char *);
60extern unsigned long __xchg32(int, int *);
61#ifdef CONFIG_64BIT
62extern unsigned long __xchg64(unsigned long, unsigned long *);
63#endif
64
65/* optimizer better get rid of switch since size is a constant */
66static __inline__ unsigned long
67__xchg(unsigned long x, __volatile__ void * ptr, int size)
68{
69 switch(size) {
70#ifdef CONFIG_64BIT
71 case 8: return __xchg64(x,(unsigned long *) ptr);
72#endif
73 case 4: return __xchg32((int) x, (int *) ptr);
74 case 1: return __xchg8((char) x, (char *) ptr);
75 }
76 __xchg_called_with_bad_pointer();
77 return x;
78}
79
80
81/*
82** REVISIT - Abandoned use of LDCW in xchg() for now:
83** o need to test sizeof(*ptr) to avoid clearing adjacent bytes
84** o and while we are at it, could CONFIG_64BIT code use LDCD too?
85**
86** if (__builtin_constant_p(x) && (x == NULL))
87** if (((unsigned long)p & 0xf) == 0)
88** return __ldcw(p);
89*/
90#define xchg(ptr,x) \
91 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
92
93
94#define __HAVE_ARCH_CMPXCHG 1
95
96/* bug catcher for when unsupported size is used - won't link */
97extern void __cmpxchg_called_with_bad_pointer(void);
98
99/* __cmpxchg_u32/u64 defined in arch/parisc/lib/bitops.c */
100extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old, unsigned int new_);
101extern unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new_);
102
103/* don't worry...optimizer will get rid of most of this */
104static __inline__ unsigned long
105__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
106{
107 switch(size) {
108#ifdef CONFIG_64BIT
109 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
110#endif
111 case 4: return __cmpxchg_u32((unsigned int *)ptr, (unsigned int) old, (unsigned int) new_);
112 }
113 __cmpxchg_called_with_bad_pointer();
114 return old;
115}
116
117#define cmpxchg(ptr,o,n) \
118 ({ \
119 __typeof__(*(ptr)) _o_ = (o); \
120 __typeof__(*(ptr)) _n_ = (n); \
121 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
122 (unsigned long)_n_, sizeof(*(ptr))); \
123 })
124
125#include <asm-generic/cmpxchg-local.h>
126
127static inline unsigned long __cmpxchg_local(volatile void *ptr,
128 unsigned long old,
129 unsigned long new_, int size)
130{
131 switch (size) {
132#ifdef CONFIG_64BIT
133 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_);
134#endif
135 case 4: return __cmpxchg_u32(ptr, old, new_);
136 default:
137 return __cmpxchg_local_generic(ptr, old, new_, size);
138 }
139}
140
141/*
142 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
143 * them available.
144 */
145#define cmpxchg_local(ptr, o, n) \
146 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
147 (unsigned long)(n), sizeof(*(ptr))))
148#ifdef CONFIG_64BIT
149#define cmpxchg64_local(ptr, o, n) \
150 ({ \
151 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
152 cmpxchg_local((ptr), (o), (n)); \
153 })
154#else
155#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
156#endif
157
158/* Note that we need not lock read accesses - aligned word writes/reads
159 * are atomic, so a reader never sees unconsistent values.
160 *
161 * Cache-line alignment would conflict with, for example, linux/module.h
162 */
163
164typedef struct { volatile int counter; } atomic_t;
165
166/* It's possible to reduce all atomic operations to either
167 * __atomic_add_return, atomic_set and atomic_read (the latter
168 * is there only for consistency).
169 */
170
171static __inline__ int __atomic_add_return(int i, atomic_t *v)
172{
173 int ret;
174 unsigned long flags;
175 _atomic_spin_lock_irqsave(v, flags);
176
177 ret = (v->counter += i);
178
179 _atomic_spin_unlock_irqrestore(v, flags);
180 return ret;
181}
182
183static __inline__ void atomic_set(atomic_t *v, int i)
184{
185 unsigned long flags;
186 _atomic_spin_lock_irqsave(v, flags);
187
188 v->counter = i;
189
190 _atomic_spin_unlock_irqrestore(v, flags);
191}
192
193static __inline__ int atomic_read(const atomic_t *v)
194{
195 return v->counter;
196}
197
198/* exported interface */
199#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
200#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
201
202/**
203 * atomic_add_unless - add unless the number is a given value
204 * @v: pointer of type atomic_t
205 * @a: the amount to add to v...
206 * @u: ...unless v is equal to u.
207 *
208 * Atomically adds @a to @v, so long as it was not @u.
209 * Returns non-zero if @v was not @u, and zero otherwise.
210 */
211static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
212{
213 int c, old;
214 c = atomic_read(v);
215 for (;;) {
216 if (unlikely(c == (u)))
217 break;
218 old = atomic_cmpxchg((v), c, c + (a));
219 if (likely(old == c))
220 break;
221 c = old;
222 }
223 return c != (u);
224}
225
226#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
227
228#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)i),(v))))
229#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)i),(v))))
230#define atomic_inc(v) ((void)(__atomic_add_return( 1,(v))))
231#define atomic_dec(v) ((void)(__atomic_add_return( -1,(v))))
232
233#define atomic_add_return(i,v) (__atomic_add_return( ((int)i),(v)))
234#define atomic_sub_return(i,v) (__atomic_add_return(-((int)i),(v)))
235#define atomic_inc_return(v) (__atomic_add_return( 1,(v)))
236#define atomic_dec_return(v) (__atomic_add_return( -1,(v)))
237
238#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
239
240/*
241 * atomic_inc_and_test - increment and test
242 * @v: pointer of type atomic_t
243 *
244 * Atomically increments @v by 1
245 * and returns true if the result is zero, or false for all
246 * other cases.
247 */
248#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
249
250#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
251
252#define atomic_sub_and_test(i,v) (atomic_sub_return((i),(v)) == 0)
253
254#define ATOMIC_INIT(i) ((atomic_t) { (i) })
255
256#define smp_mb__before_atomic_dec() smp_mb()
257#define smp_mb__after_atomic_dec() smp_mb()
258#define smp_mb__before_atomic_inc() smp_mb()
259#define smp_mb__after_atomic_inc() smp_mb()
260
261#ifdef CONFIG_64BIT
262
263typedef struct { volatile s64 counter; } atomic64_t;
264
265#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
266
267static __inline__ int
268__atomic64_add_return(s64 i, atomic64_t *v)
269{
270 int ret;
271 unsigned long flags;
272 _atomic_spin_lock_irqsave(v, flags);
273
274 ret = (v->counter += i);
275
276 _atomic_spin_unlock_irqrestore(v, flags);
277 return ret;
278}
279
280static __inline__ void
281atomic64_set(atomic64_t *v, s64 i)
282{
283 unsigned long flags;
284 _atomic_spin_lock_irqsave(v, flags);
285
286 v->counter = i;
287
288 _atomic_spin_unlock_irqrestore(v, flags);
289}
290
291static __inline__ s64
292atomic64_read(const atomic64_t *v)
293{
294 return v->counter;
295}
296
297#define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)i),(v))))
298#define atomic64_sub(i,v) ((void)(__atomic64_add_return(-((s64)i),(v))))
299#define atomic64_inc(v) ((void)(__atomic64_add_return( 1,(v))))
300#define atomic64_dec(v) ((void)(__atomic64_add_return( -1,(v))))
301
302#define atomic64_add_return(i,v) (__atomic64_add_return( ((s64)i),(v)))
303#define atomic64_sub_return(i,v) (__atomic64_add_return(-((s64)i),(v)))
304#define atomic64_inc_return(v) (__atomic64_add_return( 1,(v)))
305#define atomic64_dec_return(v) (__atomic64_add_return( -1,(v)))
306
307#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
308
309#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
310#define atomic64_dec_and_test(v) (atomic64_dec_return(v) == 0)
311#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i),(v)) == 0)
312
313/* exported interface */
314#define atomic64_cmpxchg(v, o, n) \
315 ((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
316#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
317
318/**
319 * atomic64_add_unless - add unless the number is a given value
320 * @v: pointer of type atomic64_t
321 * @a: the amount to add to v...
322 * @u: ...unless v is equal to u.
323 *
324 * Atomically adds @a to @v, so long as it was not @u.
325 * Returns non-zero if @v was not @u, and zero otherwise.
326 */
327static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
328{
329 long c, old;
330 c = atomic64_read(v);
331 for (;;) {
332 if (unlikely(c == (u)))
333 break;
334 old = atomic64_cmpxchg((v), c, c + (a));
335 if (likely(old == c))
336 break;
337 c = old;
338 }
339 return c != (u);
340}
341
342#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
343
344#endif /* CONFIG_64BIT */
345
346#include <asm-generic/atomic.h>
347
348#endif /* _ASM_PARISC_ATOMIC_H_ */
diff --git a/include/asm-parisc/auxvec.h b/include/asm-parisc/auxvec.h
deleted file mode 100644
index 9c3ac4b89dc9..000000000000
--- a/include/asm-parisc/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMPARISC_AUXVEC_H
2#define __ASMPARISC_AUXVEC_H
3
4#endif
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
deleted file mode 100644
index 7a6ea10bd231..000000000000
--- a/include/asm-parisc/bitops.h
+++ /dev/null
@@ -1,239 +0,0 @@
1#ifndef _PARISC_BITOPS_H
2#define _PARISC_BITOPS_H
3
4#ifndef _LINUX_BITOPS_H
5#error only <linux/bitops.h> can be included directly
6#endif
7
8#include <linux/compiler.h>
9#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */
10#include <asm/byteorder.h>
11#include <asm/atomic.h>
12
13/*
14 * HP-PARISC specific bit operations
15 * for a detailed description of the functions please refer
16 * to include/asm-i386/bitops.h or kerneldoc
17 */
18
19#define CHOP_SHIFTCOUNT(x) (((unsigned long) (x)) & (BITS_PER_LONG - 1))
20
21
22#define smp_mb__before_clear_bit() smp_mb()
23#define smp_mb__after_clear_bit() smp_mb()
24
25/* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
26 * on use of volatile and __*_bit() (set/clear/change):
27 * *_bit() want use of volatile.
28 * __*_bit() are "relaxed" and don't use spinlock or volatile.
29 */
30
31static __inline__ void set_bit(int nr, volatile unsigned long * addr)
32{
33 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
34 unsigned long flags;
35
36 addr += (nr >> SHIFT_PER_LONG);
37 _atomic_spin_lock_irqsave(addr, flags);
38 *addr |= mask;
39 _atomic_spin_unlock_irqrestore(addr, flags);
40}
41
42static __inline__ void clear_bit(int nr, volatile unsigned long * addr)
43{
44 unsigned long mask = ~(1UL << CHOP_SHIFTCOUNT(nr));
45 unsigned long flags;
46
47 addr += (nr >> SHIFT_PER_LONG);
48 _atomic_spin_lock_irqsave(addr, flags);
49 *addr &= mask;
50 _atomic_spin_unlock_irqrestore(addr, flags);
51}
52
53static __inline__ void change_bit(int nr, volatile unsigned long * addr)
54{
55 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
56 unsigned long flags;
57
58 addr += (nr >> SHIFT_PER_LONG);
59 _atomic_spin_lock_irqsave(addr, flags);
60 *addr ^= mask;
61 _atomic_spin_unlock_irqrestore(addr, flags);
62}
63
64static __inline__ int test_and_set_bit(int nr, volatile unsigned long * addr)
65{
66 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
67 unsigned long old;
68 unsigned long flags;
69 int set;
70
71 addr += (nr >> SHIFT_PER_LONG);
72 _atomic_spin_lock_irqsave(addr, flags);
73 old = *addr;
74 set = (old & mask) ? 1 : 0;
75 if (!set)
76 *addr = old | mask;
77 _atomic_spin_unlock_irqrestore(addr, flags);
78
79 return set;
80}
81
82static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * addr)
83{
84 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
85 unsigned long old;
86 unsigned long flags;
87 int set;
88
89 addr += (nr >> SHIFT_PER_LONG);
90 _atomic_spin_lock_irqsave(addr, flags);
91 old = *addr;
92 set = (old & mask) ? 1 : 0;
93 if (set)
94 *addr = old & ~mask;
95 _atomic_spin_unlock_irqrestore(addr, flags);
96
97 return set;
98}
99
100static __inline__ int test_and_change_bit(int nr, volatile unsigned long * addr)
101{
102 unsigned long mask = 1UL << CHOP_SHIFTCOUNT(nr);
103 unsigned long oldbit;
104 unsigned long flags;
105
106 addr += (nr >> SHIFT_PER_LONG);
107 _atomic_spin_lock_irqsave(addr, flags);
108 oldbit = *addr;
109 *addr = oldbit ^ mask;
110 _atomic_spin_unlock_irqrestore(addr, flags);
111
112 return (oldbit & mask) ? 1 : 0;
113}
114
115#include <asm-generic/bitops/non-atomic.h>
116
117#ifdef __KERNEL__
118
119/**
120 * __ffs - find first bit in word. returns 0 to "BITS_PER_LONG-1".
121 * @word: The word to search
122 *
123 * __ffs() return is undefined if no bit is set.
124 *
125 * 32-bit fast __ffs by LaMont Jones "lamont At hp com".
126 * 64-bit enhancement by Grant Grundler "grundler At parisc-linux org".
127 * (with help from willy/jejb to get the semantics right)
128 *
129 * This algorithm avoids branches by making use of nullification.
130 * One side effect of "extr" instructions is it sets PSW[N] bit.
131 * How PSW[N] (nullify next insn) gets set is determined by the
132 * "condition" field (eg "<>" or "TR" below) in the extr* insn.
133 * Only the 1st and one of either the 2cd or 3rd insn will get executed.
134 * Each set of 3 insn will get executed in 2 cycles on PA8x00 vs 16 or so
135 * cycles for each mispredicted branch.
136 */
137
138static __inline__ unsigned long __ffs(unsigned long x)
139{
140 unsigned long ret;
141
142 __asm__(
143#ifdef CONFIG_64BIT
144 " ldi 63,%1\n"
145 " extrd,u,*<> %0,63,32,%%r0\n"
146 " extrd,u,*TR %0,31,32,%0\n" /* move top 32-bits down */
147 " addi -32,%1,%1\n"
148#else
149 " ldi 31,%1\n"
150#endif
151 " extru,<> %0,31,16,%%r0\n"
152 " extru,TR %0,15,16,%0\n" /* xxxx0000 -> 0000xxxx */
153 " addi -16,%1,%1\n"
154 " extru,<> %0,31,8,%%r0\n"
155 " extru,TR %0,23,8,%0\n" /* 0000xx00 -> 000000xx */
156 " addi -8,%1,%1\n"
157 " extru,<> %0,31,4,%%r0\n"
158 " extru,TR %0,27,4,%0\n" /* 000000x0 -> 0000000x */
159 " addi -4,%1,%1\n"
160 " extru,<> %0,31,2,%%r0\n"
161 " extru,TR %0,29,2,%0\n" /* 0000000y, 1100b -> 0011b */
162 " addi -2,%1,%1\n"
163 " extru,= %0,31,1,%%r0\n" /* check last bit */
164 " addi -1,%1,%1\n"
165 : "+r" (x), "=r" (ret) );
166 return ret;
167}
168
169#include <asm-generic/bitops/ffz.h>
170
171/*
172 * ffs: find first bit set. returns 1 to BITS_PER_LONG or 0 (if none set)
173 * This is defined the same way as the libc and compiler builtin
174 * ffs routines, therefore differs in spirit from the above ffz (man ffs).
175 */
176static __inline__ int ffs(int x)
177{
178 return x ? (__ffs((unsigned long)x) + 1) : 0;
179}
180
181/*
182 * fls: find last (most significant) bit set.
183 * fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
184 */
185
186static __inline__ int fls(int x)
187{
188 int ret;
189 if (!x)
190 return 0;
191
192 __asm__(
193 " ldi 1,%1\n"
194 " extru,<> %0,15,16,%%r0\n"
195 " zdep,TR %0,15,16,%0\n" /* xxxx0000 */
196 " addi 16,%1,%1\n"
197 " extru,<> %0,7,8,%%r0\n"
198 " zdep,TR %0,23,24,%0\n" /* xx000000 */
199 " addi 8,%1,%1\n"
200 " extru,<> %0,3,4,%%r0\n"
201 " zdep,TR %0,27,28,%0\n" /* x0000000 */
202 " addi 4,%1,%1\n"
203 " extru,<> %0,1,2,%%r0\n"
204 " zdep,TR %0,29,30,%0\n" /* y0000000 (y&3 = 0) */
205 " addi 2,%1,%1\n"
206 " extru,= %0,0,1,%%r0\n"
207 " addi 1,%1,%1\n" /* if y & 8, add 1 */
208 : "+r" (x), "=r" (ret) );
209
210 return ret;
211}
212
213#include <asm-generic/bitops/__fls.h>
214#include <asm-generic/bitops/fls64.h>
215#include <asm-generic/bitops/hweight.h>
216#include <asm-generic/bitops/lock.h>
217#include <asm-generic/bitops/sched.h>
218
219#endif /* __KERNEL__ */
220
221#include <asm-generic/bitops/find.h>
222
223#ifdef __KERNEL__
224
225#include <asm-generic/bitops/ext2-non-atomic.h>
226
227/* '3' is bits per byte */
228#define LE_BYTE_ADDR ((sizeof(unsigned long) - 1) << 3)
229
230#define ext2_set_bit_atomic(l,nr,addr) \
231 test_and_set_bit((nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
232#define ext2_clear_bit_atomic(l,nr,addr) \
233 test_and_clear_bit( (nr) ^ LE_BYTE_ADDR, (unsigned long *)addr)
234
235#endif /* __KERNEL__ */
236
237#include <asm-generic/bitops/minix-le.h>
238
239#endif /* _PARISC_BITOPS_H */
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h
deleted file mode 100644
index 8cfc553fc837..000000000000
--- a/include/asm-parisc/bug.h
+++ /dev/null
@@ -1,92 +0,0 @@
1#ifndef _PARISC_BUG_H
2#define _PARISC_BUG_H
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
9#ifdef CONFIG_BUG
10#define HAVE_ARCH_BUG
11#define HAVE_ARCH_WARN_ON
12
13/* the break instruction is used as BUG() marker. */
14#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
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 int __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
88#endif
89
90#include <asm-generic/bug.h>
91#endif
92
diff --git a/include/asm-parisc/bugs.h b/include/asm-parisc/bugs.h
deleted file mode 100644
index 9e6284342a5f..000000000000
--- a/include/asm-parisc/bugs.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-parisc/bugs.h
3 *
4 * Copyright (C) 1999 Mike Shaver
5 */
6
7/*
8 * This is included by init/main.c to check for architecture-dependent bugs.
9 *
10 * Needs:
11 * void check_bugs(void);
12 */
13
14#include <asm/processor.h>
15
16static inline void check_bugs(void)
17{
18// identify_cpu(&boot_cpu_data);
19}
diff --git a/include/asm-parisc/byteorder.h b/include/asm-parisc/byteorder.h
deleted file mode 100644
index db148313de5d..000000000000
--- a/include/asm-parisc/byteorder.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef _PARISC_BYTEORDER_H
2#define _PARISC_BYTEORDER_H
3
4#include <asm/types.h>
5#include <linux/compiler.h>
6
7#ifdef __GNUC__
8
9static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
10{
11 __asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */
12 "shd %%r0, %0, 8, %0" /* shift 000000ab -> 00ba */
13 : "=r" (x)
14 : "0" (x));
15 return x;
16}
17
18static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
19{
20 __asm__("shd %0, %0, 8, %0\n\t" /* shift xabcxabc -> cxab */
21 "dep %0, 15, 8, %0\n\t" /* deposit cxab -> cbab */
22 "shd %%r0, %0, 8, %0" /* shift 0000cbab -> 0cba */
23 : "=r" (x)
24 : "0" (x));
25 return x;
26}
27
28static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
29{
30 unsigned int temp;
31 __asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */
32 "dep %1, 15, 8, %1\n\t" /* deposit cdab -> cbab */
33 "shd %0, %1, 8, %0" /* shift abcdcbab -> dcba */
34 : "=r" (x), "=&r" (temp)
35 : "0" (x));
36 return x;
37}
38
39
40#if BITS_PER_LONG > 32
41/*
42** From "PA-RISC 2.0 Architecture", HP Professional Books.
43** See Appendix I page 8 , "Endian Byte Swapping".
44**
45** Pretty cool algorithm: (* == zero'd bits)
46** PERMH 01234567 -> 67452301 into %0
47** HSHL 67452301 -> 7*5*3*1* into %1
48** HSHR 67452301 -> *6*4*2*0 into %0
49** OR %0 | %1 -> 76543210 into %0 (all done!)
50*/
51static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {
52 __u64 temp;
53 __asm__("permh,3210 %0, %0\n\t"
54 "hshl %0, 8, %1\n\t"
55 "hshr,u %0, 8, %0\n\t"
56 "or %1, %0, %0"
57 : "=r" (x), "=&r" (temp)
58 : "0" (x));
59 return x;
60}
61#define __arch__swab64(x) ___arch__swab64(x)
62#define __BYTEORDER_HAS_U64__
63#elif !defined(__STRICT_ANSI__)
64static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
65{
66 __u32 t1 = ___arch__swab32((__u32) x);
67 __u32 t2 = ___arch__swab32((__u32) (x >> 32));
68 return (((__u64) t1 << 32) | t2);
69}
70#define __arch__swab64(x) ___arch__swab64(x)
71#define __BYTEORDER_HAS_U64__
72#endif
73
74#define __arch__swab16(x) ___arch__swab16(x)
75#define __arch__swab24(x) ___arch__swab24(x)
76#define __arch__swab32(x) ___arch__swab32(x)
77
78#endif /* __GNUC__ */
79
80#include <linux/byteorder/big_endian.h>
81
82#endif /* _PARISC_BYTEORDER_H */
diff --git a/include/asm-parisc/cache.h b/include/asm-parisc/cache.h
deleted file mode 100644
index 32c2cca74345..000000000000
--- a/include/asm-parisc/cache.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * include/asm-parisc/cache.h
3 */
4
5#ifndef __ARCH_PARISC_CACHE_H
6#define __ARCH_PARISC_CACHE_H
7
8
9/*
10 * PA 2.0 processors have 64-byte cachelines; PA 1.1 processors have
11 * 32-byte cachelines. The default configuration is not for SMP anyway,
12 * so if you're building for SMP, you should select the appropriate
13 * processor type. There is a potential livelock danger when running
14 * a machine with this value set too small, but it's more probable you'll
15 * just ruin performance.
16 */
17#ifdef CONFIG_PA20
18#define L1_CACHE_BYTES 64
19#define L1_CACHE_SHIFT 6
20#else
21#define L1_CACHE_BYTES 32
22#define L1_CACHE_SHIFT 5
23#endif
24
25#ifndef __ASSEMBLY__
26
27#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
28
29#define SMP_CACHE_BYTES L1_CACHE_BYTES
30
31#define __read_mostly __attribute__((__section__(".data.read_mostly")))
32
33void parisc_cache_init(void); /* initializes cache-flushing */
34void disable_sr_hashing_asm(int); /* low level support for above */
35void disable_sr_hashing(void); /* turns off space register hashing */
36void free_sid(unsigned long);
37unsigned long alloc_sid(void);
38
39struct seq_file;
40extern void show_cache_info(struct seq_file *m);
41
42extern int split_tlb;
43extern int dcache_stride;
44extern int icache_stride;
45extern struct pdc_cache_info cache_info;
46void parisc_setup_cache_timing(void);
47
48#define pdtlb(addr) asm volatile("pdtlb 0(%%sr1,%0)" : : "r" (addr));
49#define pitlb(addr) asm volatile("pitlb 0(%%sr1,%0)" : : "r" (addr));
50#define pdtlb_kernel(addr) asm volatile("pdtlb 0(%0)" : : "r" (addr));
51
52#endif /* ! __ASSEMBLY__ */
53
54/* Classes of processor wrt: disabling space register hashing */
55
56#define SRHASH_PCXST 0 /* pcxs, pcxt, pcxt_ */
57#define SRHASH_PCXL 1 /* pcxl */
58#define SRHASH_PA20 2 /* pcxu, pcxu_, pcxw, pcxw_ */
59
60#endif
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
deleted file mode 100644
index b7ca6dc7fddc..000000000000
--- a/include/asm-parisc/cacheflush.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifndef _PARISC_CACHEFLUSH_H
2#define _PARISC_CACHEFLUSH_H
3
4#include <linux/mm.h>
5
6/* The usual comment is "Caches aren't brain-dead on the <architecture>".
7 * Unfortunately, that doesn't apply to PA-RISC. */
8
9/* Internal implementation */
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
13void flush_data_cache(void); /* flushes data-cache only (all processors) */
14void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
15#else
16#define flush_data_cache() flush_data_cache_local(NULL)
17#define flush_instruction_cache() flush_instruction_cache_local(NULL)
18#endif
19
20#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
21
22void flush_user_icache_range_asm(unsigned long, unsigned long);
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);
32
33/* Cache flush operations */
34
35void flush_cache_all_local(void);
36void flush_cache_all(void);
37void flush_cache_mm(struct mm_struct *mm);
38
39#define flush_kernel_dcache_range(start,size) \
40 flush_kernel_dcache_range_asm((start), (start)+(size));
41
42#define flush_cache_vmap(start, end) flush_cache_all()
43#define flush_cache_vunmap(start, end) flush_cache_all()
44
45extern void flush_dcache_page(struct page *page);
46
47#define flush_dcache_mmap_lock(mapping) \
48 spin_lock_irq(&(mapping)->tree_lock)
49#define flush_dcache_mmap_unlock(mapping) \
50 spin_unlock_irq(&(mapping)->tree_lock)
51
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)
56
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)
61
62#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
63do { \
64 flush_cache_page(vma, vaddr, page_to_pfn(page)); \
65 memcpy(dst, src, len); \
66 flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \
67} while (0)
68
69#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
70do { \
71 flush_cache_page(vma, vaddr, page_to_pfn(page)); \
72 memcpy(dst, src, len); \
73} while (0)
74
75void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn);
76void flush_cache_range(struct vm_area_struct *vma,
77 unsigned long start, unsigned long end);
78
79#define ARCH_HAS_FLUSH_ANON_PAGE
80static inline void
81flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
82{
83 if (PageAnon(page))
84 flush_user_dcache_page(vmaddr);
85}
86
87#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
88void flush_kernel_dcache_page_addr(void *addr);
89static inline void flush_kernel_dcache_page(struct page *page)
90{
91 flush_kernel_dcache_page_addr(page_address(page));
92}
93
94#ifdef CONFIG_DEBUG_RODATA
95void mark_rodata_ro(void);
96#endif
97
98#ifdef CONFIG_PA8X00
99/* Only pa8800, pa8900 needs this */
100#define ARCH_HAS_KMAP
101
102void kunmap_parisc(void *addr);
103
104static inline void *kmap(struct page *page)
105{
106 might_sleep();
107 return page_address(page);
108}
109
110#define kunmap(page) kunmap_parisc(page_address(page))
111
112#define kmap_atomic(page, idx) page_address(page)
113
114#define kunmap_atomic(addr, idx) kunmap_parisc(addr)
115
116#define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn))
117#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
118#endif
119
120#endif /* _PARISC_CACHEFLUSH_H */
121
diff --git a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
deleted file mode 100644
index e9639ccc3fce..000000000000
--- a/include/asm-parisc/checksum.h
+++ /dev/null
@@ -1,210 +0,0 @@
1#ifndef _PARISC_CHECKSUM_H
2#define _PARISC_CHECKSUM_H
3
4#include <linux/in6.h>
5
6/*
7 * computes the checksum of a memory block at buff, length len,
8 * and adds in "sum" (32-bit)
9 *
10 * returns a 32-bit number suitable for feeding into itself
11 * or csum_tcpudp_magic
12 *
13 * this function must be called with even lengths, except
14 * for the last fragment, which may be odd
15 *
16 * it's best to have buff aligned on a 32-bit boundary
17 */
18extern __wsum csum_partial(const void *, int, __wsum);
19
20/*
21 * The same as csum_partial, but copies from src while it checksums.
22 *
23 * Here even more important to align src and dst on a 32-bit (or even
24 * better 64-bit) boundary
25 */
26extern __wsum csum_partial_copy_nocheck(const void *, void *, int, __wsum);
27
28/*
29 * this is a new version of the above that records errors it finds in *errp,
30 * but continues and zeros the rest of the buffer.
31 */
32extern __wsum csum_partial_copy_from_user(const void __user *src,
33 void *dst, int len, __wsum sum, int *errp);
34
35/*
36 * Optimized for IP headers, which always checksum on 4 octet boundaries.
37 *
38 * Written by Randolph Chung <tausq@debian.org>, and then mucked with by
39 * LaMont Jones <lamont@debian.org>
40 */
41static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
42{
43 unsigned int sum;
44
45 __asm__ __volatile__ (
46" ldws,ma 4(%1), %0\n"
47" addib,<= -4, %2, 2f\n"
48"\n"
49" ldws 4(%1), %%r20\n"
50" ldws 8(%1), %%r21\n"
51" add %0, %%r20, %0\n"
52" ldws,ma 12(%1), %%r19\n"
53" addc %0, %%r21, %0\n"
54" addc %0, %%r19, %0\n"
55"1: ldws,ma 4(%1), %%r19\n"
56" addib,< 0, %2, 1b\n"
57" addc %0, %%r19, %0\n"
58"\n"
59" extru %0, 31, 16, %%r20\n"
60" extru %0, 15, 16, %%r21\n"
61" addc %%r20, %%r21, %0\n"
62" extru %0, 15, 16, %%r21\n"
63" add %0, %%r21, %0\n"
64" subi -1, %0, %0\n"
65"2:\n"
66 : "=r" (sum), "=r" (iph), "=r" (ihl)
67 : "1" (iph), "2" (ihl)
68 : "r19", "r20", "r21", "memory");
69
70 return (__force __sum16)sum;
71}
72
73/*
74 * Fold a partial checksum
75 */
76static inline __sum16 csum_fold(__wsum csum)
77{
78 u32 sum = (__force u32)csum;
79 /* add the swapped two 16-bit halves of sum,
80 a possible carry from adding the two 16-bit halves,
81 will carry from the lower half into the upper half,
82 giving us the correct sum in the upper half. */
83 sum += (sum << 16) + (sum >> 16);
84 return (__force __sum16)(~sum >> 16);
85}
86
87static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
88 unsigned short len,
89 unsigned short proto,
90 __wsum sum)
91{
92 __asm__(
93 " add %1, %0, %0\n"
94 " addc %2, %0, %0\n"
95 " addc %3, %0, %0\n"
96 " addc %%r0, %0, %0\n"
97 : "=r" (sum)
98 : "r" (daddr), "r"(saddr), "r"(proto+len), "0"(sum));
99 return sum;
100}
101
102/*
103 * computes the checksum of the TCP/UDP pseudo-header
104 * returns a 16-bit checksum, already complemented
105 */
106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
107 unsigned short len,
108 unsigned short proto,
109 __wsum sum)
110{
111 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
112}
113
114/*
115 * this routine is used for miscellaneous IP-like checksums, mainly
116 * in icmp.c
117 */
118static inline __sum16 ip_compute_csum(const void *buf, int len)
119{
120 return csum_fold (csum_partial(buf, len, 0));
121}
122
123
124#define _HAVE_ARCH_IPV6_CSUM
125static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
126 const struct in6_addr *daddr,
127 __u32 len, unsigned short proto,
128 __wsum sum)
129{
130 __asm__ __volatile__ (
131
132#if BITS_PER_LONG > 32
133
134 /*
135 ** We can execute two loads and two adds per cycle on PA 8000.
136 ** But add insn's get serialized waiting for the carry bit.
137 ** Try to keep 4 registers with "live" values ahead of the ALU.
138 */
139
140" ldd,ma 8(%1), %%r19\n" /* get 1st saddr word */
141" ldd,ma 8(%2), %%r20\n" /* get 1st daddr word */
142" add %8, %3, %3\n"/* add 16-bit proto + len */
143" add %%r19, %0, %0\n"
144" ldd,ma 8(%1), %%r21\n" /* 2cd saddr */
145" ldd,ma 8(%2), %%r22\n" /* 2cd daddr */
146" add,dc %%r20, %0, %0\n"
147" add,dc %%r21, %0, %0\n"
148" add,dc %%r22, %0, %0\n"
149" add,dc %3, %0, %0\n" /* fold in proto+len | carry bit */
150" extrd,u %0, 31, 32, %%r19\n" /* copy upper half down */
151" depdi 0, 31, 32, %0\n" /* clear upper half */
152" add %%r19, %0, %0\n" /* fold into 32-bits */
153" addc 0, %0, %0\n" /* add carry */
154
155#else
156
157 /*
158 ** For PA 1.x, the insn order doesn't matter as much.
159 ** Insn stream is serialized on the carry bit here too.
160 ** result from the previous operation (eg r0 + x)
161 */
162
163" ldw,ma 4(%1), %%r19\n" /* get 1st saddr word */
164" ldw,ma 4(%2), %%r20\n" /* get 1st daddr word */
165" add %8, %3, %3\n" /* add 16-bit proto + len */
166" add %%r19, %0, %0\n"
167" ldw,ma 4(%1), %%r21\n" /* 2cd saddr */
168" addc %%r20, %0, %0\n"
169" ldw,ma 4(%2), %%r22\n" /* 2cd daddr */
170" addc %%r21, %0, %0\n"
171" ldw,ma 4(%1), %%r19\n" /* 3rd saddr */
172" addc %%r22, %0, %0\n"
173" ldw,ma 4(%2), %%r20\n" /* 3rd daddr */
174" addc %%r19, %0, %0\n"
175" ldw,ma 4(%1), %%r21\n" /* 4th saddr */
176" addc %%r20, %0, %0\n"
177" ldw,ma 4(%2), %%r22\n" /* 4th daddr */
178" addc %%r21, %0, %0\n"
179" addc %%r22, %0, %0\n"
180" addc %3, %0, %0\n" /* fold in proto+len, catch carry */
181
182#endif
183 : "=r" (sum), "=r" (saddr), "=r" (daddr), "=r" (len)
184 : "0" (sum), "1" (saddr), "2" (daddr), "3" (len), "r" (proto)
185 : "r19", "r20", "r21", "r22");
186 return csum_fold(sum);
187}
188
189/*
190 * Copy and checksum to user
191 */
192#define HAVE_CSUM_COPY_USER
193static __inline__ __wsum csum_and_copy_to_user(const void *src,
194 void __user *dst,
195 int len, __wsum sum,
196 int *err_ptr)
197{
198 /* code stolen from include/asm-mips64 */
199 sum = csum_partial(src, len, sum);
200
201 if (copy_to_user(dst, src, len)) {
202 *err_ptr = -EFAULT;
203 return (__force __wsum)-1;
204 }
205
206 return sum;
207}
208
209#endif
210
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
deleted file mode 100644
index 7f32611a7a5e..000000000000
--- a/include/asm-parisc/compat.h
+++ /dev/null
@@ -1,165 +0,0 @@
1#ifndef _ASM_PARISC_COMPAT_H
2#define _ASM_PARISC_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <linux/sched.h>
8#include <linux/thread_info.h>
9
10#define COMPAT_USER_HZ 100
11
12typedef u32 compat_size_t;
13typedef s32 compat_ssize_t;
14typedef s32 compat_time_t;
15typedef s32 compat_clock_t;
16typedef s32 compat_pid_t;
17typedef u32 __compat_uid_t;
18typedef u32 __compat_gid_t;
19typedef u32 __compat_uid32_t;
20typedef u32 __compat_gid32_t;
21typedef u16 compat_mode_t;
22typedef u32 compat_ino_t;
23typedef u32 compat_dev_t;
24typedef s32 compat_off_t;
25typedef s64 compat_loff_t;
26typedef u16 compat_nlink_t;
27typedef u16 compat_ipc_pid_t;
28typedef s32 compat_daddr_t;
29typedef u32 compat_caddr_t;
30typedef s32 compat_timer_t;
31
32typedef s32 compat_int_t;
33typedef s32 compat_long_t;
34typedef s64 compat_s64;
35typedef u32 compat_uint_t;
36typedef u32 compat_ulong_t;
37typedef u64 compat_u64;
38
39struct compat_timespec {
40 compat_time_t tv_sec;
41 s32 tv_nsec;
42};
43
44struct compat_timeval {
45 compat_time_t tv_sec;
46 s32 tv_usec;
47};
48
49struct compat_stat {
50 compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
51 compat_ino_t st_ino; /* 32 bits */
52 compat_mode_t st_mode; /* 16 bits */
53 compat_nlink_t st_nlink; /* 16 bits */
54 u16 st_reserved1; /* old st_uid */
55 u16 st_reserved2; /* old st_gid */
56 compat_dev_t st_rdev;
57 compat_off_t st_size;
58 compat_time_t st_atime;
59 u32 st_atime_nsec;
60 compat_time_t st_mtime;
61 u32 st_mtime_nsec;
62 compat_time_t st_ctime;
63 u32 st_ctime_nsec;
64 s32 st_blksize;
65 s32 st_blocks;
66 u32 __unused1; /* ACL stuff */
67 compat_dev_t __unused2; /* network */
68 compat_ino_t __unused3; /* network */
69 u32 __unused4; /* cnodes */
70 u16 __unused5; /* netsite */
71 short st_fstype;
72 compat_dev_t st_realdev;
73 u16 st_basemode;
74 u16 st_spareshort;
75 __compat_uid32_t st_uid;
76 __compat_gid32_t st_gid;
77 u32 st_spare4[3];
78};
79
80struct compat_flock {
81 short l_type;
82 short l_whence;
83 compat_off_t l_start;
84 compat_off_t l_len;
85 compat_pid_t l_pid;
86};
87
88struct compat_flock64 {
89 short l_type;
90 short l_whence;
91 compat_loff_t l_start;
92 compat_loff_t l_len;
93 compat_pid_t l_pid;
94};
95
96struct compat_statfs {
97 s32 f_type;
98 s32 f_bsize;
99 s32 f_blocks;
100 s32 f_bfree;
101 s32 f_bavail;
102 s32 f_files;
103 s32 f_ffree;
104 __kernel_fsid_t f_fsid;
105 s32 f_namelen;
106 s32 f_frsize;
107 s32 f_spare[5];
108};
109
110struct compat_sigcontext {
111 compat_int_t sc_flags;
112 compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
113 u64 sc_fr[32];
114 compat_int_t sc_iasq[2];
115 compat_int_t sc_iaoq[2];
116 compat_int_t sc_sar; /* cr11 */
117};
118
119#define COMPAT_RLIM_INFINITY 0xffffffff
120
121typedef u32 compat_old_sigset_t; /* at least 32 bits */
122
123#define _COMPAT_NSIG 64
124#define _COMPAT_NSIG_BPW 32
125
126typedef u32 compat_sigset_word;
127
128#define COMPAT_OFF_T_MAX 0x7fffffff
129#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
130
131/*
132 * A pointer passed in from user mode. This should not
133 * be used for syscall parameters, just declare them
134 * as pointers because the syscall entry code will have
135 * appropriately converted them already.
136 */
137typedef u32 compat_uptr_t;
138
139static inline void __user *compat_ptr(compat_uptr_t uptr)
140{
141 return (void __user *)(unsigned long)uptr;
142}
143
144static inline compat_uptr_t ptr_to_compat(void __user *uptr)
145{
146 return (u32)(unsigned long)uptr;
147}
148
149static __inline__ void __user *compat_alloc_user_space(long len)
150{
151 struct pt_regs *regs = &current->thread.regs;
152 return (void __user *)regs->gr[30];
153}
154
155static inline int __is_compat_task(struct task_struct *t)
156{
157 return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
158}
159
160static inline int is_compat_task(void)
161{
162 return __is_compat_task(current);
163}
164
165#endif /* _ASM_PARISC_COMPAT_H */
diff --git a/include/asm-parisc/compat_rt_sigframe.h b/include/asm-parisc/compat_rt_sigframe.h
deleted file mode 100644
index 81bec28bdc48..000000000000
--- a/include/asm-parisc/compat_rt_sigframe.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#include<linux/compat.h>
2#include<linux/compat_siginfo.h>
3#include<asm/compat_ucontext.h>
4
5#ifndef _ASM_PARISC_COMPAT_RT_SIGFRAME_H
6#define _ASM_PARISC_COMPAT_RT_SIGFRAME_H
7
8/* In a deft move of uber-hackery, we decide to carry the top half of all
9 * 64-bit registers in a non-portable, non-ABI, hidden structure.
10 * Userspace can read the hidden structure if it *wants* but is never
11 * guaranteed to be in the same place. Infact the uc_sigmask from the
12 * ucontext_t structure may push the hidden register file downards
13 */
14struct compat_regfile {
15 /* Upper half of all the 64-bit registers that were truncated
16 on a copy to a 32-bit userspace */
17 compat_int_t rf_gr[32];
18 compat_int_t rf_iasq[2];
19 compat_int_t rf_iaoq[2];
20 compat_int_t rf_sar;
21};
22
23#define COMPAT_SIGRETURN_TRAMP 4
24#define COMPAT_SIGRESTARTBLOCK_TRAMP 5
25#define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + COMPAT_SIGRESTARTBLOCK_TRAMP)
26
27struct compat_rt_sigframe {
28 /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c
29 Secondary to that it must protect the ERESTART_RESTARTBLOCK
30 trampoline we left on the stack (we were bad and didn't
31 change sp so we could run really fast.) */
32 compat_uint_t tramp[COMPAT_TRAMP_SIZE];
33 compat_siginfo_t info;
34 struct compat_ucontext uc;
35 /* Hidden location of truncated registers, *must* be last. */
36 struct compat_regfile regs;
37};
38
39/*
40 * The 32-bit ABI wants at least 48 bytes for a function call frame:
41 * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of
42 * which Linux/parisc uses is sp-20 for the saved return pointer...)
43 * Then, the stack pointer must be rounded to a cache line (64 bytes).
44 */
45#define SIGFRAME32 64
46#define FUNCTIONCALLFRAME32 48
47#define PARISC_RT_SIGFRAME_SIZE32 \
48 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32)
49
50#endif
diff --git a/include/asm-parisc/compat_signal.h b/include/asm-parisc/compat_signal.h
deleted file mode 100644
index 6ad02c360b21..000000000000
--- a/include/asm-parisc/compat_signal.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Use generic */
2#include <asm-generic/compat_signal.h>
diff --git a/include/asm-parisc/compat_ucontext.h b/include/asm-parisc/compat_ucontext.h
deleted file mode 100644
index 2f7292afde3c..000000000000
--- a/include/asm-parisc/compat_ucontext.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_PARISC_COMPAT_UCONTEXT_H
2#define _ASM_PARISC_COMPAT_UCONTEXT_H
3
4#include <linux/compat.h>
5
6/* 32-bit ucontext as seen from an 64-bit kernel */
7struct compat_ucontext {
8 compat_uint_t uc_flags;
9 compat_uptr_t uc_link;
10 compat_stack_t uc_stack; /* struct compat_sigaltstack (12 bytes)*/
11 /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */
12 compat_uint_t pad[1];
13 struct compat_sigcontext uc_mcontext;
14 compat_sigset_t uc_sigmask; /* mask last for extensibility */
15};
16
17#endif /* !_ASM_PARISC_COMPAT_UCONTEXT_H */
diff --git a/include/asm-parisc/cputime.h b/include/asm-parisc/cputime.h
deleted file mode 100644
index dcdf2fbd7e72..000000000000
--- a/include/asm-parisc/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PARISC_CPUTIME_H
2#define __PARISC_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __PARISC_CPUTIME_H */
diff --git a/include/asm-parisc/current.h b/include/asm-parisc/current.h
deleted file mode 100644
index 0fb9338e3bf2..000000000000
--- a/include/asm-parisc/current.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _PARISC_CURRENT_H
2#define _PARISC_CURRENT_H
3
4#include <linux/thread_info.h>
5
6struct task_struct;
7
8static inline struct task_struct * get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current get_current()
14
15#endif /* !(_PARISC_CURRENT_H) */
diff --git a/include/asm-parisc/delay.h b/include/asm-parisc/delay.h
deleted file mode 100644
index 7a75e984674b..000000000000
--- a/include/asm-parisc/delay.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef _PARISC_DELAY_H
2#define _PARISC_DELAY_H
3
4#include <asm/system.h> /* for mfctl() */
5#include <asm/processor.h> /* for boot_cpu_data */
6
7
8/*
9 * Copyright (C) 1993 Linus Torvalds
10 *
11 * Delay routines
12 */
13
14static __inline__ void __delay(unsigned long loops) {
15 asm volatile(
16 " .balignl 64,0x34000034\n"
17 " addib,UV -1,%0,.\n"
18 " nop\n"
19 : "=r" (loops) : "0" (loops));
20}
21
22static __inline__ void __cr16_delay(unsigned long clocks) {
23 unsigned long start;
24
25 /*
26 * Note: Due to unsigned math, cr16 rollovers shouldn't be
27 * a problem here. However, on 32 bit, we need to make sure
28 * we don't pass in too big a value. The current default
29 * value of MAX_UDELAY_MS should help prevent this.
30 */
31
32 start = mfctl(16);
33 while ((mfctl(16) - start) < clocks)
34 ;
35}
36
37static __inline__ void __udelay(unsigned long usecs) {
38 __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
39}
40
41#define udelay(n) __udelay(n)
42
43#endif /* defined(_PARISC_DELAY_H) */
diff --git a/include/asm-parisc/device.h b/include/asm-parisc/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-parisc/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-parisc/div64.h b/include/asm-parisc/div64.h
deleted file mode 100644
index 6cd978cefb28..000000000000
--- a/include/asm-parisc/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/div64.h>
diff --git a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
deleted file mode 100644
index 53af696f23d2..000000000000
--- a/include/asm-parisc/dma-mapping.h
+++ /dev/null
@@ -1,253 +0,0 @@
1#ifndef _PARISC_DMA_MAPPING_H
2#define _PARISC_DMA_MAPPING_H
3
4#include <linux/mm.h>
5#include <asm/cacheflush.h>
6#include <asm/scatterlist.h>
7
8/* See Documentation/DMA-mapping.txt */
9struct hppa_dma_ops {
10 int (*dma_supported)(struct device *dev, u64 mask);
11 void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag);
12 void *(*alloc_noncoherent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag);
13 void (*free_consistent)(struct device *dev, size_t size, void *vaddr, dma_addr_t iova);
14 dma_addr_t (*map_single)(struct device *dev, void *addr, size_t size, enum dma_data_direction direction);
15 void (*unmap_single)(struct device *dev, dma_addr_t iova, size_t size, enum dma_data_direction direction);
16 int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction);
17 void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nhwents, enum dma_data_direction direction);
18 void (*dma_sync_single_for_cpu)(struct device *dev, dma_addr_t iova, unsigned long offset, size_t size, enum dma_data_direction direction);
19 void (*dma_sync_single_for_device)(struct device *dev, dma_addr_t iova, unsigned long offset, size_t size, enum dma_data_direction direction);
20 void (*dma_sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction);
21 void (*dma_sync_sg_for_device)(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction direction);
22};
23
24/*
25** We could live without the hppa_dma_ops indirection if we didn't want
26** to support 4 different coherent dma models with one binary (they will
27** someday be loadable modules):
28** I/O MMU consistent method dma_sync behavior
29** ============= ====================== =======================
30** a) PA-7x00LC uncachable host memory flush/purge
31** b) U2/Uturn cachable host memory NOP
32** c) Ike/Astro cachable host memory NOP
33** d) EPIC/SAGA memory on EPIC/SAGA flush/reset DMA channel
34**
35** PA-7[13]00LC processors have a GSC bus interface and no I/O MMU.
36**
37** Systems (eg PCX-T workstations) that don't fall into the above
38** categories will need to modify the needed drivers to perform
39** flush/purge and allocate "regular" cacheable pages for everything.
40*/
41
42#ifdef CONFIG_PA11
43extern struct hppa_dma_ops pcxl_dma_ops;
44extern struct hppa_dma_ops pcx_dma_ops;
45#endif
46
47extern struct hppa_dma_ops *hppa_dma_ops;
48
49static inline void *
50dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
51 gfp_t flag)
52{
53 return hppa_dma_ops->alloc_consistent(dev, size, dma_handle, flag);
54}
55
56static inline void *
57dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
58 gfp_t flag)
59{
60 return hppa_dma_ops->alloc_noncoherent(dev, size, dma_handle, flag);
61}
62
63static inline void
64dma_free_coherent(struct device *dev, size_t size,
65 void *vaddr, dma_addr_t dma_handle)
66{
67 hppa_dma_ops->free_consistent(dev, size, vaddr, dma_handle);
68}
69
70static inline void
71dma_free_noncoherent(struct device *dev, size_t size,
72 void *vaddr, dma_addr_t dma_handle)
73{
74 hppa_dma_ops->free_consistent(dev, size, vaddr, dma_handle);
75}
76
77static inline dma_addr_t
78dma_map_single(struct device *dev, void *ptr, size_t size,
79 enum dma_data_direction direction)
80{
81 return hppa_dma_ops->map_single(dev, ptr, size, direction);
82}
83
84static inline void
85dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
86 enum dma_data_direction direction)
87{
88 hppa_dma_ops->unmap_single(dev, dma_addr, size, direction);
89}
90
91static inline int
92dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
93 enum dma_data_direction direction)
94{
95 return hppa_dma_ops->map_sg(dev, sg, nents, direction);
96}
97
98static inline void
99dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
100 enum dma_data_direction direction)
101{
102 hppa_dma_ops->unmap_sg(dev, sg, nhwentries, direction);
103}
104
105static inline dma_addr_t
106dma_map_page(struct device *dev, struct page *page, unsigned long offset,
107 size_t size, enum dma_data_direction direction)
108{
109 return dma_map_single(dev, (page_address(page) + (offset)), size, direction);
110}
111
112static inline void
113dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
114 enum dma_data_direction direction)
115{
116 dma_unmap_single(dev, dma_address, size, direction);
117}
118
119
120static inline void
121dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
122 enum dma_data_direction direction)
123{
124 if(hppa_dma_ops->dma_sync_single_for_cpu)
125 hppa_dma_ops->dma_sync_single_for_cpu(dev, dma_handle, 0, size, direction);
126}
127
128static inline void
129dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
130 enum dma_data_direction direction)
131{
132 if(hppa_dma_ops->dma_sync_single_for_device)
133 hppa_dma_ops->dma_sync_single_for_device(dev, dma_handle, 0, size, direction);
134}
135
136static inline void
137dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
138 unsigned long offset, size_t size,
139 enum dma_data_direction direction)
140{
141 if(hppa_dma_ops->dma_sync_single_for_cpu)
142 hppa_dma_ops->dma_sync_single_for_cpu(dev, dma_handle, offset, size, direction);
143}
144
145static inline void
146dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
147 unsigned long offset, size_t size,
148 enum dma_data_direction direction)
149{
150 if(hppa_dma_ops->dma_sync_single_for_device)
151 hppa_dma_ops->dma_sync_single_for_device(dev, dma_handle, offset, size, direction);
152}
153
154static inline void
155dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
156 enum dma_data_direction direction)
157{
158 if(hppa_dma_ops->dma_sync_sg_for_cpu)
159 hppa_dma_ops->dma_sync_sg_for_cpu(dev, sg, nelems, direction);
160}
161
162static inline void
163dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
164 enum dma_data_direction direction)
165{
166 if(hppa_dma_ops->dma_sync_sg_for_device)
167 hppa_dma_ops->dma_sync_sg_for_device(dev, sg, nelems, direction);
168}
169
170static inline int
171dma_supported(struct device *dev, u64 mask)
172{
173 return hppa_dma_ops->dma_supported(dev, mask);
174}
175
176static inline int
177dma_set_mask(struct device *dev, u64 mask)
178{
179 if(!dev->dma_mask || !dma_supported(dev, mask))
180 return -EIO;
181
182 *dev->dma_mask = mask;
183
184 return 0;
185}
186
187static inline int
188dma_get_cache_alignment(void)
189{
190 return dcache_stride;
191}
192
193static inline int
194dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
195{
196 return (hppa_dma_ops->dma_sync_single_for_cpu == NULL);
197}
198
199static inline void
200dma_cache_sync(struct device *dev, void *vaddr, size_t size,
201 enum dma_data_direction direction)
202{
203 if(hppa_dma_ops->dma_sync_single_for_cpu)
204 flush_kernel_dcache_range((unsigned long)vaddr, size);
205}
206
207static inline void *
208parisc_walk_tree(struct device *dev)
209{
210 struct device *otherdev;
211 if(likely(dev->platform_data != NULL))
212 return dev->platform_data;
213 /* OK, just traverse the bus to find it */
214 for(otherdev = dev->parent; otherdev;
215 otherdev = otherdev->parent) {
216 if(otherdev->platform_data) {
217 dev->platform_data = otherdev->platform_data;
218 break;
219 }
220 }
221 BUG_ON(!dev->platform_data);
222 return dev->platform_data;
223}
224
225#define GET_IOC(dev) (HBA_DATA(parisc_walk_tree(dev))->iommu);
226
227
228#ifdef CONFIG_IOMMU_CCIO
229struct parisc_device;
230struct ioc;
231void * ccio_get_iommu(const struct parisc_device *dev);
232int ccio_request_resource(const struct parisc_device *dev,
233 struct resource *res);
234int ccio_allocate_resource(const struct parisc_device *dev,
235 struct resource *res, unsigned long size,
236 unsigned long min, unsigned long max, unsigned long align);
237#else /* !CONFIG_IOMMU_CCIO */
238#define ccio_get_iommu(dev) NULL
239#define ccio_request_resource(dev, res) insert_resource(&iomem_resource, res)
240#define ccio_allocate_resource(dev, res, size, min, max, align) \
241 allocate_resource(&iomem_resource, res, size, min, max, \
242 align, NULL, NULL)
243#endif /* !CONFIG_IOMMU_CCIO */
244
245#ifdef CONFIG_IOMMU_SBA
246struct parisc_device;
247void * sba_get_iommu(struct parisc_device *dev);
248#endif
249
250/* At the moment, we panic on error for IOMMU resource exaustion */
251#define dma_mapping_error(dev, x) 0
252
253#endif
diff --git a/include/asm-parisc/dma.h b/include/asm-parisc/dma.h
deleted file mode 100644
index 31ad0f05af3d..000000000000
--- a/include/asm-parisc/dma.h
+++ /dev/null
@@ -1,186 +0,0 @@
1/* $Id: dma.h,v 1.2 1999/04/27 00:46:18 deller Exp $
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen
5 * and John Boyd, Nov. 1992.
6 * (c) Copyright 2000, Grant Grundler
7 */
8
9#ifndef _ASM_DMA_H
10#define _ASM_DMA_H
11
12#include <asm/io.h> /* need byte IO */
13#include <asm/system.h>
14
15#define dma_outb outb
16#define dma_inb inb
17
18/*
19** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up
20** (or rather not merge) DMAs into manageable chunks.
21** On parisc, this is more of the software/tuning constraint
22** rather than the HW. I/O MMU allocation algorithms can be
23** faster with smaller sizes (to some degree).
24*/
25#define DMA_CHUNK_SIZE (BITS_PER_LONG*PAGE_SIZE)
26
27/* The maximum address that we can perform a DMA transfer to on this platform
28** New dynamic DMA interfaces should obsolete this....
29*/
30#define MAX_DMA_ADDRESS (~0UL)
31
32/*
33** We don't have DMA channels... well V-class does but the
34** Dynamic DMA Mapping interface will support them... right? :^)
35** Note: this is not relevant right now for PA-RISC, but we cannot
36** leave this as undefined because some things (e.g. sound)
37** won't compile :-(
38*/
39#define MAX_DMA_CHANNELS 8
40#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
41#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
42#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
43
44#define DMA_AUTOINIT 0x10
45
46/* 8237 DMA controllers */
47#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
48#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
49
50/* DMA controller registers */
51#define DMA1_CMD_REG 0x08 /* command register (w) */
52#define DMA1_STAT_REG 0x08 /* status register (r) */
53#define DMA1_REQ_REG 0x09 /* request register (w) */
54#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
55#define DMA1_MODE_REG 0x0B /* mode register (w) */
56#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
57#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
58#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
59#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
60#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
61#define DMA1_EXT_MODE_REG (0x400 | DMA1_MODE_REG)
62
63#define DMA2_CMD_REG 0xD0 /* command register (w) */
64#define DMA2_STAT_REG 0xD0 /* status register (r) */
65#define DMA2_REQ_REG 0xD2 /* request register (w) */
66#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
67#define DMA2_MODE_REG 0xD6 /* mode register (w) */
68#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
69#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
70#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
71#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
72#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
73#define DMA2_EXT_MODE_REG (0x400 | DMA2_MODE_REG)
74
75static __inline__ unsigned long claim_dma_lock(void)
76{
77 return 0;
78}
79
80static __inline__ void release_dma_lock(unsigned long flags)
81{
82}
83
84
85/* Get DMA residue count. After a DMA transfer, this
86 * should return zero. Reading this while a DMA transfer is
87 * still in progress will return unpredictable results.
88 * If called before the channel has been used, it may return 1.
89 * Otherwise, it returns the number of _bytes_ left to transfer.
90 *
91 * Assumes DMA flip-flop is clear.
92 */
93static __inline__ int get_dma_residue(unsigned int dmanr)
94{
95 unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
96 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
97
98 /* using short to get 16-bit wrap around */
99 unsigned short count;
100
101 count = 1 + dma_inb(io_port);
102 count += dma_inb(io_port) << 8;
103
104 return (dmanr<=3)? count : (count<<1);
105}
106
107/* enable/disable a specific DMA channel */
108static __inline__ void enable_dma(unsigned int dmanr)
109{
110#ifdef CONFIG_SUPERIO
111 if (dmanr<=3)
112 dma_outb(dmanr, DMA1_MASK_REG);
113 else
114 dma_outb(dmanr & 3, DMA2_MASK_REG);
115#endif
116}
117
118static __inline__ void disable_dma(unsigned int dmanr)
119{
120#ifdef CONFIG_SUPERIO
121 if (dmanr<=3)
122 dma_outb(dmanr | 4, DMA1_MASK_REG);
123 else
124 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
125#endif
126}
127
128/* reserve a DMA channel */
129#define request_dma(dmanr, device_id) (0)
130
131/* Clear the 'DMA Pointer Flip Flop'.
132 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
133 * Use this once to initialize the FF to a known state.
134 * After that, keep track of it. :-)
135 * --- In order to do that, the DMA routines below should ---
136 * --- only be used while holding the DMA lock ! ---
137 */
138static __inline__ void clear_dma_ff(unsigned int dmanr)
139{
140}
141
142/* set mode (above) for a specific DMA channel */
143static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
144{
145}
146
147/* Set only the page register bits of the transfer address.
148 * This is used for successive transfers when we know the contents of
149 * the lower 16 bits of the DMA current address register, but a 64k boundary
150 * may have been crossed.
151 */
152static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
153{
154}
155
156
157/* Set transfer address & page bits for specific DMA channel.
158 * Assumes dma flipflop is clear.
159 */
160static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
161{
162}
163
164
165/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
166 * a specific DMA channel.
167 * You must ensure the parameters are valid.
168 * NOTE: from a manual: "the number of transfers is one more
169 * than the initial word count"! This is taken into account.
170 * Assumes dma flip-flop is clear.
171 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
172 */
173static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
174{
175}
176
177
178#define free_dma(dmanr)
179
180#ifdef CONFIG_PCI
181extern int isa_dma_bridge_buggy;
182#else
183#define isa_dma_bridge_buggy (0)
184#endif
185
186#endif /* _ASM_DMA_H */
diff --git a/include/asm-parisc/eisa_bus.h b/include/asm-parisc/eisa_bus.h
deleted file mode 100644
index 201085f83dd5..000000000000
--- a/include/asm-parisc/eisa_bus.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * eisa_bus.h interface between the eisa BA driver and the bus enumerator
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
7 * 2 of the License, or (at your option) any later version.
8 *
9 * Copyright (c) 2002 Daniel Engstrom <5116@telia.com>
10 *
11 */
12
13#ifndef ASM_EISA_H
14#define ASM_EISA_H
15
16extern void eisa_make_irq_level(int num);
17extern void eisa_make_irq_edge(int num);
18extern int eisa_enumerator(unsigned long eeprom_addr,
19 struct resource *io_parent,
20 struct resource *mem_parent);
21extern int eisa_eeprom_init(unsigned long addr);
22
23#endif
diff --git a/include/asm-parisc/eisa_eeprom.h b/include/asm-parisc/eisa_eeprom.h
deleted file mode 100644
index 9c9da980402a..000000000000
--- a/include/asm-parisc/eisa_eeprom.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * eisa_eeprom.h - provide support for EISA adapters in PA-RISC machines
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
7 * 2 of the License, or (at your option) any later version.
8 *
9 * Copyright (c) 2001, 2002 Daniel Engstrom <5116@telia.com>
10 *
11 */
12
13#ifndef ASM_EISA_EEPROM_H
14#define ASM_EISA_EEPROM_H
15
16extern void __iomem *eisa_eeprom_addr;
17
18#define HPEE_MAX_LENGTH 0x2000 /* maximum eeprom length */
19
20#define HPEE_SLOT_INFO(slot) (20+(48*slot))
21
22struct eeprom_header
23{
24
25 u_int32_t num_writes; /* number of writes */
26 u_int8_t flags; /* flags, usage? */
27 u_int8_t ver_maj;
28 u_int8_t ver_min;
29 u_int8_t num_slots; /* number of EISA slots in system */
30 u_int16_t csum; /* checksum, I don't know how to calulate this */
31 u_int8_t pad[10];
32} __attribute__ ((packed));
33
34
35struct eeprom_eisa_slot_info
36{
37 u_int32_t eisa_slot_id;
38 u_int32_t config_data_offset;
39 u_int32_t num_writes;
40 u_int16_t csum;
41 u_int16_t num_functions;
42 u_int16_t config_data_length;
43
44 /* bits 0..3 are the duplicate slot id */
45#define HPEE_SLOT_INFO_EMBEDDED 0x10
46#define HPEE_SLOT_INFO_VIRTUAL 0x20
47#define HPEE_SLOT_INFO_NO_READID 0x40
48#define HPEE_SLOT_INFO_DUPLICATE 0x80
49 u_int8_t slot_info;
50
51#define HPEE_SLOT_FEATURES_ENABLE 0x01
52#define HPEE_SLOT_FEATURES_IOCHK 0x02
53#define HPEE_SLOT_FEATURES_CFG_INCOMPLETE 0x80
54 u_int8_t slot_features;
55
56 u_int8_t ver_min;
57 u_int8_t ver_maj;
58
59#define HPEE_FUNCTION_INFO_HAVE_TYPE 0x01
60#define HPEE_FUNCTION_INFO_HAVE_MEMORY 0x02
61#define HPEE_FUNCTION_INFO_HAVE_IRQ 0x04
62#define HPEE_FUNCTION_INFO_HAVE_DMA 0x08
63#define HPEE_FUNCTION_INFO_HAVE_PORT 0x10
64#define HPEE_FUNCTION_INFO_HAVE_PORT_INIT 0x20
65/* I think there are two slighty different
66 * versions of the function_info field
67 * one int the fixed header and one optional
68 * in the parsed slot data area */
69#define HPEE_FUNCTION_INFO_HAVE_FUNCTION 0x01
70#define HPEE_FUNCTION_INFO_F_DISABLED 0x80
71#define HPEE_FUNCTION_INFO_CFG_FREE_FORM 0x40
72 u_int8_t function_info;
73
74#define HPEE_FLAG_BOARD_IS_ISA 0x01 /* flag and minor version for isa board */
75 u_int8_t flags;
76 u_int8_t pad[24];
77} __attribute__ ((packed));
78
79
80#define HPEE_MEMORY_MAX_ENT 9
81/* memory descriptor: byte 0 */
82#define HPEE_MEMORY_WRITABLE 0x01
83#define HPEE_MEMORY_CACHABLE 0x02
84#define HPEE_MEMORY_TYPE_MASK 0x18
85#define HPEE_MEMORY_TYPE_SYS 0x00
86#define HPEE_MEMORY_TYPE_EXP 0x08
87#define HPEE_MEMORY_TYPE_VIR 0x10
88#define HPEE_MEMORY_TYPE_OTH 0x18
89#define HPEE_MEMORY_SHARED 0x20
90#define HPEE_MEMORY_MORE 0x80
91
92/* memory descriptor: byte 1 */
93#define HPEE_MEMORY_WIDTH_MASK 0x03
94#define HPEE_MEMORY_WIDTH_BYTE 0x00
95#define HPEE_MEMORY_WIDTH_WORD 0x01
96#define HPEE_MEMORY_WIDTH_DWORD 0x02
97#define HPEE_MEMORY_DECODE_MASK 0x0c
98#define HPEE_MEMORY_DECODE_20BITS 0x00
99#define HPEE_MEMORY_DECODE_24BITS 0x04
100#define HPEE_MEMORY_DECODE_32BITS 0x08
101/* byte 2 and 3 are a 16bit LE value
102 * containging the memory size in kilobytes */
103/* byte 4,5,6 are a 24bit LE value
104 * containing the memory base address */
105
106
107#define HPEE_IRQ_MAX_ENT 7
108/* Interrupt entry: byte 0 */
109#define HPEE_IRQ_CHANNEL_MASK 0xf
110#define HPEE_IRQ_TRIG_LEVEL 0x20
111#define HPEE_IRQ_MORE 0x80
112/* byte 1 seems to be unused */
113
114#define HPEE_DMA_MAX_ENT 4
115
116/* dma entry: byte 0 */
117#define HPEE_DMA_CHANNEL_MASK 7
118#define HPEE_DMA_SIZE_MASK 0xc
119#define HPEE_DMA_SIZE_BYTE 0x0
120#define HPEE_DMA_SIZE_WORD 0x4
121#define HPEE_DMA_SIZE_DWORD 0x8
122#define HPEE_DMA_SHARED 0x40
123#define HPEE_DMA_MORE 0x80
124
125/* dma entry: byte 1 */
126#define HPEE_DMA_TIMING_MASK 0x30
127#define HPEE_DMA_TIMING_ISA 0x0
128#define HPEE_DMA_TIMING_TYPEA 0x10
129#define HPEE_DMA_TIMING_TYPEB 0x20
130#define HPEE_DMA_TIMING_TYPEC 0x30
131
132#define HPEE_PORT_MAX_ENT 20
133/* port entry byte 0 */
134#define HPEE_PORT_SIZE_MASK 0x1f
135#define HPEE_PORT_SHARED 0x40
136#define HPEE_PORT_MORE 0x80
137/* byte 1 and 2 is a 16bit LE value
138 * conating the start port number */
139
140#define HPEE_PORT_INIT_MAX_LEN 60 /* in bytes here */
141/* port init entry byte 0 */
142#define HPEE_PORT_INIT_WIDTH_MASK 0x3
143#define HPEE_PORT_INIT_WIDTH_BYTE 0x0
144#define HPEE_PORT_INIT_WIDTH_WORD 0x1
145#define HPEE_PORT_INIT_WIDTH_DWORD 0x2
146#define HPEE_PORT_INIT_MASK 0x4
147#define HPEE_PORT_INIT_MORE 0x80
148
149#define HPEE_SELECTION_MAX_ENT 26
150
151#define HPEE_TYPE_MAX_LEN 80
152
153#endif
diff --git a/include/asm-parisc/elf.h b/include/asm-parisc/elf.h
deleted file mode 100644
index d0a4a8262818..000000000000
--- a/include/asm-parisc/elf.h
+++ /dev/null
@@ -1,342 +0,0 @@
1#ifndef __ASMPARISC_ELF_H
2#define __ASMPARISC_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9
10#define EM_PARISC 15
11
12/* HPPA specific definitions. */
13
14/* Legal values for e_flags field of Elf32_Ehdr. */
15
16#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
17#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
18#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
19#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
20#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
21 prediction. */
22#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
23#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
24
25/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
26
27#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
28#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
29#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
30
31/* Additional section indices. */
32
33#define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared
34 symbols in ANSI C. */
35#define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */
36
37/* Legal values for sh_type field of Elf32_Shdr. */
38
39#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
40#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
41#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
42
43/* Legal values for sh_flags field of Elf32_Shdr. */
44
45#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
46#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
47#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
48
49/* Legal values for ST_TYPE subfield of st_info (symbol type). */
50
51#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
52
53#define STT_HP_OPAQUE (STT_LOOS + 0x1)
54#define STT_HP_STUB (STT_LOOS + 0x2)
55
56/* HPPA relocs. */
57
58#define R_PARISC_NONE 0 /* No reloc. */
59#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
60#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
61#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
62#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
63#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
64#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
65#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
66#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
67#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
68#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
69#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
70#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
71#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
72#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
73#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
74#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
75#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
76#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
77#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
78#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
79#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
80#define R_PARISC_LTOFF_FPTR32 57 /* 32 bits LT-rel. function pointer. */
81#define R_PARISC_LTOFF_FPTR21L 58 /* LT-rel. fct ptr, left 21 bits. */
82#define R_PARISC_LTOFF_FPTR14R 62 /* LT-rel. fct ptr, right 14 bits. */
83#define R_PARISC_FPTR64 64 /* 64 bits function address. */
84#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
85#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
86#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
87#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
88#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
89#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
90#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
91#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
92#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
93#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
94#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
95#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
96#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
97#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
98#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
99#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
100#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
101#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
102#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
103#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
104#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
105#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
106#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
107#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
108#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
109#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
110#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
111#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
112#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
113#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
114#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
115#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
116#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
117#define R_PARISC_LTOFF_FPTR64 120 /* 64 bits LT-rel. function ptr. */
118#define R_PARISC_LTOFF_FPTR14WR 123 /* LT-rel. fct. ptr., right 14 bits. */
119#define R_PARISC_LTOFF_FPTR14DR 124 /* LT-rel. fct. ptr., right 14 bits. */
120#define R_PARISC_LTOFF_FPTR16F 125 /* 16 bits LT-rel. function ptr. */
121#define R_PARISC_LTOFF_FPTR16WF 126 /* 16 bits LT-rel. function ptr. */
122#define R_PARISC_LTOFF_FPTR16DF 127 /* 16 bits LT-rel. function ptr. */
123#define R_PARISC_LORESERVE 128
124#define R_PARISC_COPY 128 /* Copy relocation. */
125#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
126#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
127#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
128#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
129#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
130#define R_PARISC_LTOFF_TP21L 162 /* LT-TP-rel. address, left 21 bits. */
131#define R_PARISC_LTOFF_TP14R 166 /* LT-TP-rel. address, right 14 bits.*/
132#define R_PARISC_LTOFF_TP14F 167 /* 14 bits LT-TP-rel. address. */
133#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
134#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
135#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
136#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
137#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
138#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
139#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
140#define R_PARISC_LTOFF_TP14WR 227 /* LT-TP-rel. address, right 14 bits.*/
141#define R_PARISC_LTOFF_TP14DR 228 /* LT-TP-rel. address, right 14 bits.*/
142#define R_PARISC_LTOFF_TP16F 229 /* 16 bits LT-TP-rel. address. */
143#define R_PARISC_LTOFF_TP16WF 230 /* 16 bits LT-TP-rel. address. */
144#define R_PARISC_LTOFF_TP16DF 231 /* 16 bits LT-TP-rel. address. */
145#define R_PARISC_HIRESERVE 255
146
147#define PA_PLABEL_FDESC 0x02 /* bit set if PLABEL points to
148 * a function descriptor, not
149 * an address */
150
151/* The following are PA function descriptors
152 *
153 * addr: the absolute address of the function
154 * gp: either the data pointer (r27) for non-PIC code or the
155 * the PLT pointer (r19) for PIC code */
156
157/* Format for the Elf32 Function descriptor */
158typedef struct elf32_fdesc {
159 __u32 addr;
160 __u32 gp;
161} Elf32_Fdesc;
162
163/* Format for the Elf64 Function descriptor */
164typedef struct elf64_fdesc {
165 __u64 dummy[2]; /* FIXME: nothing uses these, why waste
166 * the space */
167 __u64 addr;
168 __u64 gp;
169} Elf64_Fdesc;
170
171/* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */
172
173#define PT_HP_TLS (PT_LOOS + 0x0)
174#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
175#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
176#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
177#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
178#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
179#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
180#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
181#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
182#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
183#define PT_HP_PARALLEL (PT_LOOS + 0x10)
184#define PT_HP_FASTBIND (PT_LOOS + 0x11)
185#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
186#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
187#define PT_HP_STACK (PT_LOOS + 0x14)
188
189#define PT_PARISC_ARCHEXT 0x70000000
190#define PT_PARISC_UNWIND 0x70000001
191
192/* Legal values for p_flags field of Elf32_Phdr/Elf64_Phdr. */
193
194#define PF_PARISC_SBP 0x08000000
195
196#define PF_HP_PAGE_SIZE 0x00100000
197#define PF_HP_FAR_SHARED 0x00200000
198#define PF_HP_NEAR_SHARED 0x00400000
199#define PF_HP_CODE 0x01000000
200#define PF_HP_MODIFY 0x02000000
201#define PF_HP_LAZYSWAP 0x04000000
202#define PF_HP_SBP 0x08000000
203
204/*
205 * The following definitions are those for 32-bit ELF binaries on a 32-bit
206 * kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries
207 * on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these
208 * macros appropriately and then #includes binfmt_elf.c, which then includes
209 * this file.
210 */
211#ifndef ELF_CLASS
212
213/*
214 * This is used to ensure we don't load something for the wrong architecture.
215 *
216 * Note that this header file is used by default in fs/binfmt_elf.c. So
217 * the following macros are for the default case. However, for the 64
218 * bit kernel we also support 32 bit parisc binaries. To do that
219 * arch/parisc/kernel/binfmt_elf32.c defines its own set of these
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).
222 */
223#ifdef CONFIG_64BIT
224#define ELF_CLASS ELFCLASS64
225#else
226#define ELF_CLASS ELFCLASS32
227#endif
228
229typedef unsigned long elf_greg_t;
230
231/*
232 * This yields a string that ld.so will use to load implementation
233 * specific libraries for optimization. This is more specific in
234 * intent than poking at uname or /proc/cpuinfo.
235 */
236
237#define ELF_PLATFORM ("PARISC\0")
238
239#define SET_PERSONALITY(ex, ibcs2) \
240 current->personality = PER_LINUX; \
241 current->thread.map_base = DEFAULT_MAP_BASE; \
242 current->thread.task_size = DEFAULT_TASK_SIZE \
243
244/*
245 * Fill in general registers in a core dump. This saves pretty
246 * much the same registers as hp-ux, although in a different order.
247 * Registers marked # below are not currently saved in pt_regs, so
248 * we use their current values here.
249 *
250 * gr0..gr31
251 * sr0..sr7
252 * iaoq0..iaoq1
253 * iasq0..iasq1
254 * cr11 (sar)
255 * cr19 (iir)
256 * cr20 (isr)
257 * cr21 (ior)
258 * # cr22 (ipsw)
259 * # cr0 (recovery counter)
260 * # cr24..cr31 (temporary registers)
261 * # cr8,9,12,13 (protection IDs)
262 * # cr10 (scr/ccr)
263 * # cr15 (ext int enable mask)
264 *
265 */
266
267#define ELF_CORE_COPY_REGS(dst, pt) \
268 memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
269 memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \
270 memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \
271 memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \
272 memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \
273 dst[44] = pt->sar; dst[45] = pt->iir; \
274 dst[46] = pt->isr; dst[47] = pt->ior; \
275 dst[48] = mfctl(22); dst[49] = mfctl(0); \
276 dst[50] = mfctl(24); dst[51] = mfctl(25); \
277 dst[52] = mfctl(26); dst[53] = mfctl(27); \
278 dst[54] = mfctl(28); dst[55] = mfctl(29); \
279 dst[56] = mfctl(30); dst[57] = mfctl(31); \
280 dst[58] = mfctl( 8); dst[59] = mfctl( 9); \
281 dst[60] = mfctl(12); dst[61] = mfctl(13); \
282 dst[62] = mfctl(10); dst[63] = mfctl(15);
283
284#endif /* ! ELF_CLASS */
285
286#define ELF_NGREG 80 /* We only need 64 at present, but leave space
287 for expansion. */
288typedef elf_greg_t elf_gregset_t[ELF_NGREG];
289
290#define ELF_NFPREG 32
291typedef double elf_fpreg_t;
292typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
293
294struct task_struct;
295
296extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
297#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
298
299struct pt_regs; /* forward declaration... */
300
301
302#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
303
304/*
305 * These are used to set parameters in the core dumps.
306 */
307#define ELF_DATA ELFDATA2MSB
308#define ELF_ARCH EM_PARISC
309#define ELF_OSABI ELFOSABI_LINUX
310
311/* %r23 is set by ld.so to a pointer to a function which might be
312 registered using atexit. This provides a means for the dynamic
313 linker to call DT_FINI functions for shared libraries that have
314 been loaded before the code runs.
315
316 So that we can use the same startup file with static executables,
317 we start programs with a value of 0 to indicate that there is no
318 such function. */
319#define ELF_PLAT_INIT(_r, load_addr) _r->gr[23] = 0
320
321#define USE_ELF_CORE_DUMP
322#define ELF_EXEC_PAGESIZE 4096
323
324/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
325 use of this is to invoke "./ld.so someprog" to test out a new version of
326 the loader. We need to make sure that it is out of the way of the program
327 that it will "exec", and that there is sufficient room for the brk.
328
329 (2 * TASK_SIZE / 3) turns into something undefined when run through a
330 32 bit preprocessor and in some cases results in the kernel trying to map
331 ld.so to the kernel virtual base. Use a sane value instead. /Jes
332 */
333
334#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x01000000)
335
336/* This yields a mask that user programs can use to figure out what
337 instruction set this CPU supports. This could be done in user space,
338 but it's not easy, and we've already done it here. */
339
340#define ELF_HWCAP 0
341
342#endif
diff --git a/include/asm-parisc/emergency-restart.h b/include/asm-parisc/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-parisc/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-parisc/errno.h b/include/asm-parisc/errno.h
deleted file mode 100644
index e2f3ddc796be..000000000000
--- a/include/asm-parisc/errno.h
+++ /dev/null
@@ -1,124 +0,0 @@
1#ifndef _PARISC_ERRNO_H
2#define _PARISC_ERRNO_H
3
4#include <asm-generic/errno-base.h>
5
6#define ENOMSG 35 /* No message of desired type */
7#define EIDRM 36 /* Identifier removed */
8#define ECHRNG 37 /* Channel number out of range */
9#define EL2NSYNC 38 /* Level 2 not synchronized */
10#define EL3HLT 39 /* Level 3 halted */
11#define EL3RST 40 /* Level 3 reset */
12#define ELNRNG 41 /* Link number out of range */
13#define EUNATCH 42 /* Protocol driver not attached */
14#define ENOCSI 43 /* No CSI structure available */
15#define EL2HLT 44 /* Level 2 halted */
16#define EDEADLK 45 /* Resource deadlock would occur */
17#define EDEADLOCK EDEADLK
18#define ENOLCK 46 /* No record locks available */
19#define EILSEQ 47 /* Illegal byte sequence */
20
21#define ENONET 50 /* Machine is not on the network */
22#define ENODATA 51 /* No data available */
23#define ETIME 52 /* Timer expired */
24#define ENOSR 53 /* Out of streams resources */
25#define ENOSTR 54 /* Device not a stream */
26#define ENOPKG 55 /* Package not installed */
27
28#define ENOLINK 57 /* Link has been severed */
29#define EADV 58 /* Advertise error */
30#define ESRMNT 59 /* Srmount error */
31#define ECOMM 60 /* Communication error on send */
32#define EPROTO 61 /* Protocol error */
33
34#define EMULTIHOP 64 /* Multihop attempted */
35
36#define EDOTDOT 66 /* RFS specific error */
37#define EBADMSG 67 /* Not a data message */
38#define EUSERS 68 /* Too many users */
39#define EDQUOT 69 /* Quota exceeded */
40#define ESTALE 70 /* Stale NFS file handle */
41#define EREMOTE 71 /* Object is remote */
42#define EOVERFLOW 72 /* Value too large for defined data type */
43
44/* these errnos are defined by Linux but not HPUX. */
45
46#define EBADE 160 /* Invalid exchange */
47#define EBADR 161 /* Invalid request descriptor */
48#define EXFULL 162 /* Exchange full */
49#define ENOANO 163 /* No anode */
50#define EBADRQC 164 /* Invalid request code */
51#define EBADSLT 165 /* Invalid slot */
52#define EBFONT 166 /* Bad font file format */
53#define ENOTUNIQ 167 /* Name not unique on network */
54#define EBADFD 168 /* File descriptor in bad state */
55#define EREMCHG 169 /* Remote address changed */
56#define ELIBACC 170 /* Can not access a needed shared library */
57#define ELIBBAD 171 /* Accessing a corrupted shared library */
58#define ELIBSCN 172 /* .lib section in a.out corrupted */
59#define ELIBMAX 173 /* Attempting to link in too many shared libraries */
60#define ELIBEXEC 174 /* Cannot exec a shared library directly */
61#define ERESTART 175 /* Interrupted system call should be restarted */
62#define ESTRPIPE 176 /* Streams pipe error */
63#define EUCLEAN 177 /* Structure needs cleaning */
64#define ENOTNAM 178 /* Not a XENIX named type file */
65#define ENAVAIL 179 /* No XENIX semaphores available */
66#define EISNAM 180 /* Is a named type file */
67#define EREMOTEIO 181 /* Remote I/O error */
68#define ENOMEDIUM 182 /* No medium found */
69#define EMEDIUMTYPE 183 /* Wrong medium type */
70#define ENOKEY 184 /* Required key not available */
71#define EKEYEXPIRED 185 /* Key has expired */
72#define EKEYREVOKED 186 /* Key has been revoked */
73#define EKEYREJECTED 187 /* Key was rejected by service */
74
75/* We now return you to your regularly scheduled HPUX. */
76
77#define ENOSYM 215 /* symbol does not exist in executable */
78#define ENOTSOCK 216 /* Socket operation on non-socket */
79#define EDESTADDRREQ 217 /* Destination address required */
80#define EMSGSIZE 218 /* Message too long */
81#define EPROTOTYPE 219 /* Protocol wrong type for socket */
82#define ENOPROTOOPT 220 /* Protocol not available */
83#define EPROTONOSUPPORT 221 /* Protocol not supported */
84#define ESOCKTNOSUPPORT 222 /* Socket type not supported */
85#define EOPNOTSUPP 223 /* Operation not supported on transport endpoint */
86#define EPFNOSUPPORT 224 /* Protocol family not supported */
87#define EAFNOSUPPORT 225 /* Address family not supported by protocol */
88#define EADDRINUSE 226 /* Address already in use */
89#define EADDRNOTAVAIL 227 /* Cannot assign requested address */
90#define ENETDOWN 228 /* Network is down */
91#define ENETUNREACH 229 /* Network is unreachable */
92#define ENETRESET 230 /* Network dropped connection because of reset */
93#define ECONNABORTED 231 /* Software caused connection abort */
94#define ECONNRESET 232 /* Connection reset by peer */
95#define ENOBUFS 233 /* No buffer space available */
96#define EISCONN 234 /* Transport endpoint is already connected */
97#define ENOTCONN 235 /* Transport endpoint is not connected */
98#define ESHUTDOWN 236 /* Cannot send after transport endpoint shutdown */
99#define ETOOMANYREFS 237 /* Too many references: cannot splice */
100#define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
101#define ETIMEDOUT 238 /* Connection timed out */
102#define ECONNREFUSED 239 /* Connection refused */
103#define EREMOTERELEASE 240 /* Remote peer released connection */
104#define EHOSTDOWN 241 /* Host is down */
105#define EHOSTUNREACH 242 /* No route to host */
106
107#define EALREADY 244 /* Operation already in progress */
108#define EINPROGRESS 245 /* Operation now in progress */
109#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */
110#define ENOTEMPTY 247 /* Directory not empty */
111#define ENAMETOOLONG 248 /* File name too long */
112#define ELOOP 249 /* Too many symbolic links encountered */
113#define ENOSYS 251 /* Function not implemented */
114
115#define ENOTSUP 252 /* Function not implemented (POSIX.4 / HPUX) */
116#define ECANCELLED 253 /* aio request was canceled before complete (POSIX.4 / HPUX) */
117#define ECANCELED ECANCELLED /* SuSv3 and Solaris wants one 'L' */
118
119/* for robust mutexes */
120#define EOWNERDEAD 254 /* Owner died */
121#define ENOTRECOVERABLE 255 /* State not recoverable */
122
123
124#endif
diff --git a/include/asm-parisc/fb.h b/include/asm-parisc/fb.h
deleted file mode 100644
index 4d503a023ab2..000000000000
--- a/include/asm-parisc/fb.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
12}
13
14static inline int fb_is_primary_device(struct fb_info *info)
15{
16 return 0;
17}
18
19#endif /* _ASM_FB_H_ */
diff --git a/include/asm-parisc/fcntl.h b/include/asm-parisc/fcntl.h
deleted file mode 100644
index 1e1c824764ee..000000000000
--- a/include/asm-parisc/fcntl.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _PARISC_FCNTL_H
2#define _PARISC_FCNTL_H
3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_APPEND 000000010
7#define O_BLKSEEK 000000100 /* HPUX only */
8#define O_CREAT 000000400 /* not fcntl */
9#define O_EXCL 000002000 /* not fcntl */
10#define O_LARGEFILE 000004000
11#define O_SYNC 000100000
12#define O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */
13#define O_NOCTTY 000400000 /* not fcntl */
14#define O_DSYNC 001000000 /* HPUX only */
15#define O_RSYNC 002000000 /* HPUX only */
16#define O_NOATIME 004000000
17#define O_CLOEXEC 010000000 /* set close_on_exec */
18
19#define O_DIRECTORY 000010000 /* must be a directory */
20#define O_NOFOLLOW 000000200 /* don't follow links */
21#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */
22
23#define F_GETLK64 8
24#define F_SETLK64 9
25#define F_SETLKW64 10
26
27#define F_GETOWN 11 /* for sockets. */
28#define F_SETOWN 12 /* for sockets. */
29#define F_SETSIG 13 /* for sockets. */
30#define F_GETSIG 14 /* for sockets. */
31
32/* for posix fcntl() and lockf() */
33#define F_RDLCK 01
34#define F_WRLCK 02
35#define F_UNLCK 03
36
37#include <asm-generic/fcntl.h>
38
39#endif
diff --git a/include/asm-parisc/fixmap.h b/include/asm-parisc/fixmap.h
deleted file mode 100644
index de3fe3a18229..000000000000
--- a/include/asm-parisc/fixmap.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _ASM_FIXMAP_H
2#define _ASM_FIXMAP_H
3
4/*
5 * This file defines the locations of the fixed mappings on parisc.
6 *
7 * All of the values in this file are machine virtual addresses.
8 *
9 * All of the values in this file must be <4GB (because of assembly
10 * loading restrictions). If you place this region anywhere above
11 * __PAGE_OFFSET, you must adjust the memory map accordingly */
12
13/* The alias region is used in kernel space to do copy/clear to or
14 * from areas congruently mapped with user space. It is 8MB large
15 * and must be 16MB aligned */
16#define TMPALIAS_MAP_START ((__PAGE_OFFSET) - 16*1024*1024)
17/* This is the kernel area for all maps (vmalloc, dma etc.) most
18 * usually, it extends up to TMPALIAS_MAP_START. Virtual addresses
19 * 0..GATEWAY_PAGE_SIZE are reserved for the gateway page */
20#define KERNEL_MAP_START (GATEWAY_PAGE_SIZE)
21#define KERNEL_MAP_END (TMPALIAS_MAP_START)
22
23#ifndef __ASSEMBLY__
24extern void *vmalloc_start;
25#define PCXL_DMA_MAP_SIZE (8*1024*1024)
26#define VMALLOC_START ((unsigned long)vmalloc_start)
27#define VMALLOC_END (KERNEL_MAP_END)
28#endif /*__ASSEMBLY__*/
29
30#endif /*_ASM_FIXMAP_H*/
diff --git a/include/asm-parisc/floppy.h b/include/asm-parisc/floppy.h
deleted file mode 100644
index 4ca69f558fae..000000000000
--- a/include/asm-parisc/floppy.h
+++ /dev/null
@@ -1,271 +0,0 @@
1/* Architecture specific parts of the Floppy driver
2 *
3 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
4 * Copyright (C) 2000 Matthew Wilcox (willy a debian . org)
5 * Copyright (C) 2000 Dave Kennedy
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef __ASM_PARISC_FLOPPY_H
22#define __ASM_PARISC_FLOPPY_H
23
24#include <linux/vmalloc.h>
25
26
27/*
28 * The DMA channel used by the floppy controller cannot access data at
29 * addresses >= 16MB
30 *
31 * Went back to the 1MB limit, as some people had problems with the floppy
32 * driver otherwise. It doesn't matter much for performance anyway, as most
33 * floppy accesses go through the track buffer.
34 */
35#define _CROSS_64KB(a,s,vdma) \
36(!vdma && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
37
38#define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1)
39
40
41#define SW fd_routine[use_virtual_dma&1]
42#define CSW fd_routine[can_use_virtual_dma & 1]
43
44
45#define fd_inb(port) readb(port)
46#define fd_outb(value, port) writeb(value, port)
47
48#define fd_request_dma() CSW._request_dma(FLOPPY_DMA,"floppy")
49#define fd_free_dma() CSW._free_dma(FLOPPY_DMA)
50#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
51#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
52#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
53#define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA)
54#define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size)
55#define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io)
56
57#define FLOPPY_CAN_FALLBACK_ON_NODMA
58
59static int virtual_dma_count=0;
60static int virtual_dma_residue=0;
61static char *virtual_dma_addr=0;
62static int virtual_dma_mode=0;
63static int doing_pdma=0;
64
65static void floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
66{
67 register unsigned char st;
68
69#undef TRACE_FLPY_INT
70
71#ifdef TRACE_FLPY_INT
72 static int calls=0;
73 static int bytes=0;
74 static int dma_wait=0;
75#endif
76 if (!doing_pdma) {
77 floppy_interrupt(irq, dev_id, regs);
78 return;
79 }
80
81#ifdef TRACE_FLPY_INT
82 if(!calls)
83 bytes = virtual_dma_count;
84#endif
85
86 {
87 register int lcount;
88 register char *lptr = virtual_dma_addr;
89
90 for (lcount = virtual_dma_count; lcount; lcount--) {
91 st = fd_inb(virtual_dma_port+4) & 0xa0 ;
92 if (st != 0xa0)
93 break;
94 if (virtual_dma_mode) {
95 fd_outb(*lptr, virtual_dma_port+5);
96 } else {
97 *lptr = fd_inb(virtual_dma_port+5);
98 }
99 lptr++;
100 }
101 virtual_dma_count = lcount;
102 virtual_dma_addr = lptr;
103 st = fd_inb(virtual_dma_port+4);
104 }
105
106#ifdef TRACE_FLPY_INT
107 calls++;
108#endif
109 if (st == 0x20)
110 return;
111 if (!(st & 0x20)) {
112 virtual_dma_residue += virtual_dma_count;
113 virtual_dma_count = 0;
114#ifdef TRACE_FLPY_INT
115 printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
116 virtual_dma_count, virtual_dma_residue, calls, bytes,
117 dma_wait);
118 calls = 0;
119 dma_wait=0;
120#endif
121 doing_pdma = 0;
122 floppy_interrupt(irq, dev_id, regs);
123 return;
124 }
125#ifdef TRACE_FLPY_INT
126 if (!virtual_dma_count)
127 dma_wait++;
128#endif
129}
130
131static void fd_disable_dma(void)
132{
133 if(! (can_use_virtual_dma & 1))
134 disable_dma(FLOPPY_DMA);
135 doing_pdma = 0;
136 virtual_dma_residue += virtual_dma_count;
137 virtual_dma_count=0;
138}
139
140static int vdma_request_dma(unsigned int dmanr, const char * device_id)
141{
142 return 0;
143}
144
145static void vdma_nop(unsigned int dummy)
146{
147}
148
149
150static int vdma_get_dma_residue(unsigned int dummy)
151{
152 return virtual_dma_count + virtual_dma_residue;
153}
154
155
156static int fd_request_irq(void)
157{
158 if(can_use_virtual_dma)
159 return request_irq(FLOPPY_IRQ, floppy_hardint,
160 IRQF_DISABLED, "floppy", NULL);
161 else
162 return request_irq(FLOPPY_IRQ, floppy_interrupt,
163 IRQF_DISABLED, "floppy", NULL);
164}
165
166static unsigned long dma_mem_alloc(unsigned long size)
167{
168 return __get_dma_pages(GFP_KERNEL, get_order(size));
169}
170
171
172static unsigned long vdma_mem_alloc(unsigned long size)
173{
174 return (unsigned long) vmalloc(size);
175
176}
177
178#define nodma_mem_alloc(size) vdma_mem_alloc(size)
179
180static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
181{
182 if((unsigned int) addr >= (unsigned int) high_memory)
183 return vfree((void *)addr);
184 else
185 free_pages(addr, get_order(size));
186}
187
188#define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size)
189
190static void _fd_chose_dma_mode(char *addr, unsigned long size)
191{
192 if(can_use_virtual_dma == 2) {
193 if((unsigned int) addr >= (unsigned int) high_memory ||
194 virt_to_bus(addr) >= 0x1000000 ||
195 _CROSS_64KB(addr, size, 0))
196 use_virtual_dma = 1;
197 else
198 use_virtual_dma = 0;
199 } else {
200 use_virtual_dma = can_use_virtual_dma & 1;
201 }
202}
203
204#define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size)
205
206
207static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
208{
209 doing_pdma = 1;
210 virtual_dma_port = io;
211 virtual_dma_mode = (mode == DMA_MODE_WRITE);
212 virtual_dma_addr = addr;
213 virtual_dma_count = size;
214 virtual_dma_residue = 0;
215 return 0;
216}
217
218static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
219{
220#ifdef FLOPPY_SANITY_CHECK
221 if (CROSS_64KB(addr, size)) {
222 printk("DMA crossing 64-K boundary %p-%p\n", addr, addr+size);
223 return -1;
224 }
225#endif
226 /* actual, physical DMA */
227 doing_pdma = 0;
228 clear_dma_ff(FLOPPY_DMA);
229 set_dma_mode(FLOPPY_DMA,mode);
230 set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
231 set_dma_count(FLOPPY_DMA,size);
232 enable_dma(FLOPPY_DMA);
233 return 0;
234}
235
236static struct fd_routine_l {
237 int (*_request_dma)(unsigned int dmanr, const char * device_id);
238 void (*_free_dma)(unsigned int dmanr);
239 int (*_get_dma_residue)(unsigned int dummy);
240 unsigned long (*_dma_mem_alloc) (unsigned long size);
241 int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
242} fd_routine[] = {
243 {
244 request_dma,
245 free_dma,
246 get_dma_residue,
247 dma_mem_alloc,
248 hard_dma_setup
249 },
250 {
251 vdma_request_dma,
252 vdma_nop,
253 vdma_get_dma_residue,
254 vdma_mem_alloc,
255 vdma_dma_setup
256 }
257};
258
259
260static int FDC1 = 0x3f0; /* Lies. Floppy controller is memory mapped, not io mapped */
261static int FDC2 = -1;
262
263#define FLOPPY0_TYPE 0
264#define FLOPPY1_TYPE 0
265
266#define N_FDC 1
267#define N_DRIVE 8
268
269#define EXTRA_FLOPPY_PARAMS
270
271#endif /* __ASM_PARISC_FLOPPY_H */
diff --git a/include/asm-parisc/futex.h b/include/asm-parisc/futex.h
deleted file mode 100644
index 0c705c3a55ef..000000000000
--- a/include/asm-parisc/futex.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef _ASM_PARISC_FUTEX_H
2#define _ASM_PARISC_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <linux/uaccess.h>
8#include <asm/errno.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 pagefault_disable();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 pagefault_enable();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52/* Non-atomic version */
53static inline int
54futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
55{
56 int err = 0;
57 int uval;
58
59 /* futex.c wants to do a cmpxchg_inatomic on kernel NULL, which is
60 * our gateway page, and causes no end of trouble...
61 */
62 if (segment_eq(KERNEL_DS, get_fs()) && !uaddr)
63 return -EFAULT;
64
65 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
66 return -EFAULT;
67
68 err = get_user(uval, uaddr);
69 if (err) return -EFAULT;
70 if (uval == oldval)
71 err = put_user(newval, uaddr);
72 if (err) return -EFAULT;
73 return uval;
74}
75
76#endif /*__KERNEL__*/
77#endif /*_ASM_PARISC_FUTEX_H*/
diff --git a/include/asm-parisc/grfioctl.h b/include/asm-parisc/grfioctl.h
deleted file mode 100644
index 671e06042b40..000000000000
--- a/include/asm-parisc/grfioctl.h
+++ /dev/null
@@ -1,113 +0,0 @@
1/* Architecture specific parts of HP's STI (framebuffer) driver.
2 * Structures are HP-UX compatible for XFree86 usage.
3 *
4 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
5 * Copyright (C) 2001 Helge Deller (deller a parisc-linux org)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_PARISC_GRFIOCTL_H
23#define __ASM_PARISC_GRFIOCTL_H
24
25/* upper 32 bits of graphics id (HP/UX identifier) */
26
27#define GRFGATOR 8
28#define S9000_ID_S300 9
29#define GRFBOBCAT 9
30#define GRFCATSEYE 9
31#define S9000_ID_98720 10
32#define GRFRBOX 10
33#define S9000_ID_98550 11
34#define GRFFIREEYE 11
35#define S9000_ID_A1096A 12
36#define GRFHYPERION 12
37#define S9000_ID_FRI 13
38#define S9000_ID_98730 14
39#define GRFDAVINCI 14
40#define S9000_ID_98705 0x26C08070 /* Tigershark */
41#define S9000_ID_98736 0x26D148AB
42#define S9000_ID_A1659A 0x26D1482A /* CRX 8 plane color (=ELK) */
43#define S9000_ID_ELK S9000_ID_A1659A
44#define S9000_ID_A1439A 0x26D148EE /* CRX24 = CRX+ (24-plane color) */
45#define S9000_ID_A1924A 0x26D1488C /* GRX gray-scale */
46#define S9000_ID_ELM S9000_ID_A1924A
47#define S9000_ID_98765 0x27480DEF
48#define S9000_ID_ELK_768 0x27482101
49#define S9000_ID_STINGER 0x27A4A402
50#define S9000_ID_TIMBER 0x27F12392 /* Bushmaster (710) Graphics */
51#define S9000_ID_TOMCAT 0x27FCCB6D /* dual-headed ELK (Dual CRX) */
52#define S9000_ID_ARTIST 0x2B4DED6D /* Artist (Gecko/712 & 715) onboard Graphics */
53#define S9000_ID_HCRX 0x2BCB015A /* Hyperdrive/Hyperbowl (A4071A) Graphics */
54#define CRX24_OVERLAY_PLANES 0x920825AA /* Overlay planes on CRX24 */
55
56#define CRT_ID_ELK_1024 S9000_ID_ELK_768 /* Elk 1024x768 CRX */
57#define CRT_ID_ELK_1280 S9000_ID_A1659A /* Elk 1280x1024 CRX */
58#define CRT_ID_ELK_1024DB 0x27849CA5 /* Elk 1024x768 double buffer */
59#define CRT_ID_ELK_GS S9000_ID_A1924A /* Elk 1280x1024 GreyScale */
60#define CRT_ID_CRX24 S9000_ID_A1439A /* Piranha */
61#define CRT_ID_VISUALIZE_EG 0x2D08C0A7 /* Graffiti, A4450A (built-in B132+/B160L) */
62#define CRT_ID_THUNDER 0x2F23E5FC /* Thunder 1 VISUALIZE 48*/
63#define CRT_ID_THUNDER2 0x2F8D570E /* Thunder 2 VISUALIZE 48 XP*/
64#define CRT_ID_HCRX S9000_ID_HCRX /* Hyperdrive HCRX */
65#define CRT_ID_CRX48Z S9000_ID_STINGER /* Stinger */
66#define CRT_ID_DUAL_CRX S9000_ID_TOMCAT /* Tomcat */
67#define CRT_ID_PVRX S9000_ID_98705 /* Tigershark */
68#define CRT_ID_TIMBER S9000_ID_TIMBER /* Timber (710 builtin) */
69#define CRT_ID_TVRX S9000_ID_98765 /* TVRX (gto/falcon) */
70#define CRT_ID_ARTIST S9000_ID_ARTIST /* Artist */
71#define CRT_ID_SUMMIT 0x2FC1066B /* Summit FX2, FX4, FX6 ... */
72#define CRT_ID_LEGO 0x35ACDA30 /* Lego FX5, FX10 ... */
73#define CRT_ID_PINNACLE 0x35ACDA16 /* Pinnacle FXe */
74
75/* structure for ioctl(GCDESCRIBE) */
76
77#define gaddr_t unsigned long /* FIXME: PA2.0 (64bit) portable ? */
78
79struct grf_fbinfo {
80 unsigned int id; /* upper 32 bits of graphics id */
81 unsigned int mapsize; /* mapped size of framebuffer */
82 unsigned int dwidth, dlength;/* x and y sizes */
83 unsigned int width, length; /* total x and total y size */
84 unsigned int xlen; /* x pitch size */
85 unsigned int bpp, bppu; /* bits per pixel and used bpp */
86 unsigned int npl, nplbytes; /* # of planes and bytes per plane */
87 char name[32]; /* name of the device (from ROM) */
88 unsigned int attr; /* attributes */
89 gaddr_t fbbase, regbase;/* framebuffer and register base addr */
90 gaddr_t regions[6]; /* region bases */
91};
92
93#define GCID _IOR('G', 0, int)
94#define GCON _IO('G', 1)
95#define GCOFF _IO('G', 2)
96#define GCAON _IO('G', 3)
97#define GCAOFF _IO('G', 4)
98#define GCMAP _IOWR('G', 5, int)
99#define GCUNMAP _IOWR('G', 6, int)
100#define GCMAP_HPUX _IO('G', 5)
101#define GCUNMAP_HPUX _IO('G', 6)
102#define GCLOCK _IO('G', 7)
103#define GCUNLOCK _IO('G', 8)
104#define GCLOCK_MINIMUM _IO('G', 9)
105#define GCUNLOCK_MINIMUM _IO('G', 10)
106#define GCSTATIC_CMAP _IO('G', 11)
107#define GCVARIABLE_CMAP _IO('G', 12)
108#define GCTERM _IOWR('G',20,int) /* multi-headed Tomcat */
109#define GCDESCRIBE _IOR('G', 21, struct grf_fbinfo)
110#define GCFASTLOCK _IO('G', 26)
111
112#endif /* __ASM_PARISC_GRFIOCTL_H */
113
diff --git a/include/asm-parisc/hardirq.h b/include/asm-parisc/hardirq.h
deleted file mode 100644
index ce93133d5112..000000000000
--- a/include/asm-parisc/hardirq.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* hardirq.h: PA-RISC hard IRQ support.
2 *
3 * Copyright (C) 2001 Matthew Wilcox <matthew@wil.cx>
4 *
5 * The locking is really quite interesting. There's a cpu-local
6 * count of how many interrupts are being handled, and a global
7 * lock. An interrupt can only be serviced if the global lock
8 * is free. You can't be sure no more interrupts are being
9 * serviced until you've acquired the lock and then checked
10 * all the per-cpu interrupt counts are all zero. It's a specialised
11 * br_lock, and that's exactly how Sparc does it. We don't because
12 * it's more locking for us. This way is lock-free in the interrupt path.
13 */
14
15#ifndef _PARISC_HARDIRQ_H
16#define _PARISC_HARDIRQ_H
17
18#include <linux/threads.h>
19#include <linux/irq.h>
20
21typedef struct {
22 unsigned long __softirq_pending; /* set_bit is used on this */
23} ____cacheline_aligned irq_cpustat_t;
24
25#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
26
27void ack_bad_irq(unsigned int irq);
28
29#endif /* _PARISC_HARDIRQ_H */
diff --git a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
deleted file mode 100644
index 4e9626836bab..000000000000
--- a/include/asm-parisc/hardware.h
+++ /dev/null
@@ -1,127 +0,0 @@
1#ifndef _PARISC_HARDWARE_H
2#define _PARISC_HARDWARE_H
3
4#include <linux/mod_devicetable.h>
5#include <asm/pdc.h>
6
7#define HWTYPE_ANY_ID PA_HWTYPE_ANY_ID
8#define HVERSION_ANY_ID PA_HVERSION_ANY_ID
9#define HVERSION_REV_ANY_ID PA_HVERSION_REV_ANY_ID
10#define SVERSION_ANY_ID PA_SVERSION_ANY_ID
11
12struct hp_hardware {
13 unsigned short hw_type:5; /* HPHW_xxx */
14 unsigned short hversion;
15 unsigned long sversion:28;
16 unsigned short opt;
17 const char name[80]; /* The hardware description */
18};
19
20struct parisc_device;
21
22enum cpu_type {
23 pcx = 0, /* pa7000 pa 1.0 */
24 pcxs = 1, /* pa7000 pa 1.1a */
25 pcxt = 2, /* pa7100 pa 1.1b */
26 pcxt_ = 3, /* pa7200 (t') pa 1.1c */
27 pcxl = 4, /* pa7100lc pa 1.1d */
28 pcxl2 = 5, /* pa7300lc pa 1.1e */
29 pcxu = 6, /* pa8000 pa 2.0 */
30 pcxu_ = 7, /* pa8200 (u+) pa 2.0 */
31 pcxw = 8, /* pa8500 pa 2.0 */
32 pcxw_ = 9, /* pa8600 (w+) pa 2.0 */
33 pcxw2 = 10, /* pa8700 pa 2.0 */
34 mako = 11, /* pa8800 pa 2.0 */
35 mako2 = 12 /* pa8900 pa 2.0 */
36};
37
38extern const char * const cpu_name_version[][2]; /* mapping from enum cpu_type to strings */
39
40struct parisc_driver;
41
42struct io_module {
43 volatile uint32_t nothing; /* reg 0 */
44 volatile uint32_t io_eim;
45 volatile uint32_t io_dc_adata;
46 volatile uint32_t io_ii_cdata;
47 volatile uint32_t io_dma_link; /* reg 4 */
48 volatile uint32_t io_dma_command;
49 volatile uint32_t io_dma_address;
50 volatile uint32_t io_dma_count;
51 volatile uint32_t io_flex; /* reg 8 */
52 volatile uint32_t io_spa_address;
53 volatile uint32_t reserved1[2];
54 volatile uint32_t io_command; /* reg 12 */
55 volatile uint32_t io_status;
56 volatile uint32_t io_control;
57 volatile uint32_t io_data;
58 volatile uint32_t reserved2; /* reg 16 */
59 volatile uint32_t chain_addr;
60 volatile uint32_t sub_mask_clr;
61 volatile uint32_t reserved3[13];
62 volatile uint32_t undefined[480];
63 volatile uint32_t unpriv[512];
64};
65
66struct bc_module {
67 volatile uint32_t unused1[12];
68 volatile uint32_t io_command;
69 volatile uint32_t io_status;
70 volatile uint32_t io_control;
71 volatile uint32_t unused2[1];
72 volatile uint32_t io_err_resp;
73 volatile uint32_t io_err_info;
74 volatile uint32_t io_err_req;
75 volatile uint32_t unused3[11];
76 volatile uint32_t io_io_low;
77 volatile uint32_t io_io_high;
78};
79
80#define HPHW_NPROC 0
81#define HPHW_MEMORY 1
82#define HPHW_B_DMA 2
83#define HPHW_OBSOLETE 3
84#define HPHW_A_DMA 4
85#define HPHW_A_DIRECT 5
86#define HPHW_OTHER 6
87#define HPHW_BCPORT 7
88#define HPHW_CIO 8
89#define HPHW_CONSOLE 9
90#define HPHW_FIO 10
91#define HPHW_BA 11
92#define HPHW_IOA 12
93#define HPHW_BRIDGE 13
94#define HPHW_FABRIC 14
95#define HPHW_MC 15
96#define HPHW_FAULTY 31
97
98
99/* hardware.c: */
100extern const char *parisc_hardware_description(struct parisc_device_id *id);
101extern enum cpu_type parisc_get_cpu_type(unsigned long hversion);
102
103struct pci_dev;
104
105/* drivers.c: */
106extern struct parisc_device *alloc_pa_dev(unsigned long hpa,
107 struct hardware_path *path);
108extern int register_parisc_device(struct parisc_device *dev);
109extern int register_parisc_driver(struct parisc_driver *driver);
110extern int count_parisc_driver(struct parisc_driver *driver);
111extern int unregister_parisc_driver(struct parisc_driver *driver);
112extern void walk_central_bus(void);
113extern const struct parisc_device *find_pa_parent_type(const struct parisc_device *, int);
114extern void print_parisc_devices(void);
115extern char *print_pa_hwpath(struct parisc_device *dev, char *path);
116extern char *print_pci_hwpath(struct pci_dev *dev, char *path);
117extern void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path);
118extern void init_parisc_bus(void);
119extern struct device *hwpath_to_device(struct hardware_path *modpath);
120extern void device_to_hwpath(struct device *dev, struct hardware_path *path);
121
122
123/* inventory.c: */
124extern void do_memory_inventory(void);
125extern void do_device_inventory(void);
126
127#endif /* _PARISC_HARDWARE_H */
diff --git a/include/asm-parisc/hw_irq.h b/include/asm-parisc/hw_irq.h
deleted file mode 100644
index 6707f7df3921..000000000000
--- a/include/asm-parisc/hw_irq.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4/*
5 * linux/include/asm/hw_irq.h
6 */
7
8#endif
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
deleted file mode 100644
index c246ef75017d..000000000000
--- a/include/asm-parisc/ide.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * linux/include/asm-parisc/ide.h
3 *
4 * Copyright (C) 1994-1996 Linus Torvalds & authors
5 */
6
7/*
8 * This file contains the PARISC architecture specific IDE code.
9 */
10
11#ifndef __ASM_PARISC_IDE_H
12#define __ASM_PARISC_IDE_H
13
14#ifdef __KERNEL__
15
16#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
17#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
18#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
19#define ide_release_region(from,extent) release_region((from), (extent))
20/* Generic I/O and MEMIO string operations. */
21
22#define __ide_insw insw
23#define __ide_insl insl
24#define __ide_outsw outsw
25#define __ide_outsl outsl
26
27static __inline__ void __ide_mm_insw(void __iomem *port, void *addr, u32 count)
28{
29 while (count--) {
30 *(u16 *)addr = __raw_readw(port);
31 addr += 2;
32 }
33}
34
35static __inline__ void __ide_mm_insl(void __iomem *port, void *addr, u32 count)
36{
37 while (count--) {
38 *(u32 *)addr = __raw_readl(port);
39 addr += 4;
40 }
41}
42
43static __inline__ void __ide_mm_outsw(void __iomem *port, void *addr, u32 count)
44{
45 while (count--) {
46 __raw_writew(*(u16 *)addr, port);
47 addr += 2;
48 }
49}
50
51static __inline__ void __ide_mm_outsl(void __iomem *port, void *addr, u32 count)
52{
53 while (count--) {
54 __raw_writel(*(u32 *)addr, port);
55 addr += 4;
56 }
57}
58
59#endif /* __KERNEL__ */
60
61#endif /* __ASM_PARISC_IDE_H */
diff --git a/include/asm-parisc/io.h b/include/asm-parisc/io.h
deleted file mode 100644
index 55ddb1842107..000000000000
--- a/include/asm-parisc/io.h
+++ /dev/null
@@ -1,293 +0,0 @@
1#ifndef _ASM_IO_H
2#define _ASM_IO_H
3
4#include <linux/types.h>
5#include <asm/pgtable.h>
6
7extern unsigned long parisc_vmerge_boundary;
8extern unsigned long parisc_vmerge_max_size;
9
10#define BIO_VMERGE_BOUNDARY parisc_vmerge_boundary
11#define BIO_VMERGE_MAX_SIZE parisc_vmerge_max_size
12
13#define virt_to_phys(a) ((unsigned long)__pa(a))
14#define phys_to_virt(a) __va(a)
15#define virt_to_bus virt_to_phys
16#define bus_to_virt phys_to_virt
17
18static inline unsigned long isa_bus_to_virt(unsigned long addr) {
19 BUG();
20 return 0;
21}
22
23static inline unsigned long isa_virt_to_bus(void *addr) {
24 BUG();
25 return 0;
26}
27
28/*
29 * Memory mapped I/O
30 *
31 * readX()/writeX() do byteswapping and take an ioremapped address
32 * __raw_readX()/__raw_writeX() don't byteswap and take an ioremapped address.
33 * gsc_*() don't byteswap and operate on physical addresses;
34 * eg dev->hpa or 0xfee00000.
35 */
36
37static inline unsigned char gsc_readb(unsigned long addr)
38{
39 long flags;
40 unsigned char ret;
41
42 __asm__ __volatile__(
43 " rsm 2,%0\n"
44 " ldbx 0(%2),%1\n"
45 " mtsm %0\n"
46 : "=&r" (flags), "=r" (ret) : "r" (addr) );
47
48 return ret;
49}
50
51static inline unsigned short gsc_readw(unsigned long addr)
52{
53 long flags;
54 unsigned short ret;
55
56 __asm__ __volatile__(
57 " rsm 2,%0\n"
58 " ldhx 0(%2),%1\n"
59 " mtsm %0\n"
60 : "=&r" (flags), "=r" (ret) : "r" (addr) );
61
62 return ret;
63}
64
65static inline unsigned int gsc_readl(unsigned long addr)
66{
67 u32 ret;
68
69 __asm__ __volatile__(
70 " ldwax 0(%1),%0\n"
71 : "=r" (ret) : "r" (addr) );
72
73 return ret;
74}
75
76static inline unsigned long long gsc_readq(unsigned long addr)
77{
78 unsigned long long ret;
79
80#ifdef CONFIG_64BIT
81 __asm__ __volatile__(
82 " ldda 0(%1),%0\n"
83 : "=r" (ret) : "r" (addr) );
84#else
85 /* two reads may have side effects.. */
86 ret = ((u64) gsc_readl(addr)) << 32;
87 ret |= gsc_readl(addr+4);
88#endif
89 return ret;
90}
91
92static inline void gsc_writeb(unsigned char val, unsigned long addr)
93{
94 long flags;
95 __asm__ __volatile__(
96 " rsm 2,%0\n"
97 " stbs %1,0(%2)\n"
98 " mtsm %0\n"
99 : "=&r" (flags) : "r" (val), "r" (addr) );
100}
101
102static inline void gsc_writew(unsigned short val, unsigned long addr)
103{
104 long flags;
105 __asm__ __volatile__(
106 " rsm 2,%0\n"
107 " sths %1,0(%2)\n"
108 " mtsm %0\n"
109 : "=&r" (flags) : "r" (val), "r" (addr) );
110}
111
112static inline void gsc_writel(unsigned int val, unsigned long addr)
113{
114 __asm__ __volatile__(
115 " stwas %0,0(%1)\n"
116 : : "r" (val), "r" (addr) );
117}
118
119static inline void gsc_writeq(unsigned long long val, unsigned long addr)
120{
121#ifdef CONFIG_64BIT
122 __asm__ __volatile__(
123 " stda %0,0(%1)\n"
124 : : "r" (val), "r" (addr) );
125#else
126 /* two writes may have side effects.. */
127 gsc_writel(val >> 32, addr);
128 gsc_writel(val, addr+4);
129#endif
130}
131
132/*
133 * The standard PCI ioremap interfaces
134 */
135
136extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
137
138/* Most machines react poorly to I/O-space being cacheable... Instead let's
139 * define ioremap() in terms of ioremap_nocache().
140 */
141static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
142{
143 return __ioremap(offset, size, _PAGE_NO_CACHE);
144}
145#define ioremap_nocache(off, sz) ioremap((off), (sz))
146
147extern void iounmap(const volatile void __iomem *addr);
148
149static inline unsigned char __raw_readb(const volatile void __iomem *addr)
150{
151 return (*(volatile unsigned char __force *) (addr));
152}
153static inline unsigned short __raw_readw(const volatile void __iomem *addr)
154{
155 return *(volatile unsigned short __force *) addr;
156}
157static inline unsigned int __raw_readl(const volatile void __iomem *addr)
158{
159 return *(volatile unsigned int __force *) addr;
160}
161static inline unsigned long long __raw_readq(const volatile void __iomem *addr)
162{
163 return *(volatile unsigned long long __force *) addr;
164}
165
166static inline void __raw_writeb(unsigned char b, volatile void __iomem *addr)
167{
168 *(volatile unsigned char __force *) addr = b;
169}
170static inline void __raw_writew(unsigned short b, volatile void __iomem *addr)
171{
172 *(volatile unsigned short __force *) addr = b;
173}
174static inline void __raw_writel(unsigned int b, volatile void __iomem *addr)
175{
176 *(volatile unsigned int __force *) addr = b;
177}
178static inline void __raw_writeq(unsigned long long b, volatile void __iomem *addr)
179{
180 *(volatile unsigned long long __force *) addr = b;
181}
182
183/* readb can never be const, so use __fswab instead of le*_to_cpu */
184#define readb(addr) __raw_readb(addr)
185#define readw(addr) __fswab16(__raw_readw(addr))
186#define readl(addr) __fswab32(__raw_readl(addr))
187#define readq(addr) __fswab64(__raw_readq(addr))
188#define writeb(b, addr) __raw_writeb(b, addr)
189#define writew(b, addr) __raw_writew(cpu_to_le16(b), addr)
190#define writel(b, addr) __raw_writel(cpu_to_le32(b), addr)
191#define writeq(b, addr) __raw_writeq(cpu_to_le64(b), addr)
192
193#define readb_relaxed(addr) readb(addr)
194#define readw_relaxed(addr) readw(addr)
195#define readl_relaxed(addr) readl(addr)
196#define readq_relaxed(addr) readq(addr)
197
198#define mmiowb() do { } while (0)
199
200void memset_io(volatile void __iomem *addr, unsigned char val, int count);
201void memcpy_fromio(void *dst, const volatile void __iomem *src, int count);
202void memcpy_toio(volatile void __iomem *dst, const void *src, int count);
203
204/* Port-space IO */
205
206#define inb_p inb
207#define inw_p inw
208#define inl_p inl
209#define outb_p outb
210#define outw_p outw
211#define outl_p outl
212
213extern unsigned char eisa_in8(unsigned short port);
214extern unsigned short eisa_in16(unsigned short port);
215extern unsigned int eisa_in32(unsigned short port);
216extern void eisa_out8(unsigned char data, unsigned short port);
217extern void eisa_out16(unsigned short data, unsigned short port);
218extern void eisa_out32(unsigned int data, unsigned short port);
219
220#if defined(CONFIG_PCI)
221extern unsigned char inb(int addr);
222extern unsigned short inw(int addr);
223extern unsigned int inl(int addr);
224
225extern void outb(unsigned char b, int addr);
226extern void outw(unsigned short b, int addr);
227extern void outl(unsigned int b, int addr);
228#elif defined(CONFIG_EISA)
229#define inb eisa_in8
230#define inw eisa_in16
231#define inl eisa_in32
232#define outb eisa_out8
233#define outw eisa_out16
234#define outl eisa_out32
235#else
236static inline char inb(unsigned long addr)
237{
238 BUG();
239 return -1;
240}
241
242static inline short inw(unsigned long addr)
243{
244 BUG();
245 return -1;
246}
247
248static inline int inl(unsigned long addr)
249{
250 BUG();
251 return -1;
252}
253
254#define outb(x, y) BUG()
255#define outw(x, y) BUG()
256#define outl(x, y) BUG()
257#endif
258
259/*
260 * String versions of in/out ops:
261 */
262extern void insb (unsigned long port, void *dst, unsigned long count);
263extern void insw (unsigned long port, void *dst, unsigned long count);
264extern void insl (unsigned long port, void *dst, unsigned long count);
265extern void outsb (unsigned long port, const void *src, unsigned long count);
266extern void outsw (unsigned long port, const void *src, unsigned long count);
267extern void outsl (unsigned long port, const void *src, unsigned long count);
268
269
270/* IO Port space is : BBiiii where BB is HBA number. */
271#define IO_SPACE_LIMIT 0x00ffffff
272
273/* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32
274 * bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit
275 * mode (essentially just sign extending. This macro takes in a 32
276 * bit I/O address (still with the leading f) and outputs the correct
277 * value for either 32 or 64 bit mode */
278#define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL)))
279
280#include <asm-generic/iomap.h>
281
282/*
283 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
284 * access
285 */
286#define xlate_dev_mem_ptr(p) __va(p)
287
288/*
289 * Convert a virtual cached pointer to an uncached pointer
290 */
291#define xlate_dev_kmem_ptr(p) p
292
293#endif
diff --git a/include/asm-parisc/ioctl.h b/include/asm-parisc/ioctl.h
deleted file mode 100644
index ec8efa02beda..000000000000
--- a/include/asm-parisc/ioctl.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
3 * Copyright (C) 1999,2003 Matthew Wilcox < willy at debian . org >
4 * portions from "linux/ioctl.h for Linux" by H.H. Bergman.
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 _ASM_PARISC_IOCTL_H
23#define _ASM_PARISC_IOCTL_H
24
25/* ioctl command encoding: 32 bits total, command in lower 16 bits,
26 * size of the parameter structure in the lower 14 bits of the
27 * upper 16 bits.
28 * Encoding the size of the parameter structure in the ioctl request
29 * is useful for catching programs compiled with old versions
30 * and to avoid overwriting user space outside the user buffer area.
31 * The highest 2 bits are reserved for indicating the ``access mode''.
32 * NOTE: This limits the max parameter size to 16kB -1 !
33 */
34
35/*
36 * Direction bits.
37 */
38#define _IOC_NONE 0U
39#define _IOC_WRITE 2U
40#define _IOC_READ 1U
41
42#include <asm-generic/ioctl.h>
43
44#endif /* _ASM_PARISC_IOCTL_H */
diff --git a/include/asm-parisc/ioctls.h b/include/asm-parisc/ioctls.h
deleted file mode 100644
index 6747fad07a3e..000000000000
--- a/include/asm-parisc/ioctls.h
+++ /dev/null
@@ -1,90 +0,0 @@
1#ifndef __ARCH_PARISC_IOCTLS_H__
2#define __ARCH_PARISC_IOCTLS_H__
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS _IOR('T', 16, struct termios) /* TCGETATTR */
9#define TCSETS _IOW('T', 17, struct termios) /* TCSETATTR */
10#define TCSETSW _IOW('T', 18, struct termios) /* TCSETATTRD */
11#define TCSETSF _IOW('T', 19, struct termios) /* TCSETATTRF */
12#define TCGETA _IOR('T', 1, struct termio)
13#define TCSETA _IOW('T', 2, struct termio)
14#define TCSETAW _IOW('T', 3, struct termio)
15#define TCSETAF _IOW('T', 4, struct termio)
16#define TCSBRK _IO('T', 5)
17#define TCXONC _IO('T', 6)
18#define TCFLSH _IO('T', 7)
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP _IOR('T', 30, int)
23#define TIOCSPGRP _IOW('T', 29, int)
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46#define TIOCSBRK 0x5427 /* BSD compatibility */
47#define TIOCCBRK 0x5428 /* BSD compatibility */
48#define TIOCGSID _IOR('T', 20, int) /* Return the session ID of FD */
49#define TCGETS2 _IOR('T',0x2A, struct termios2)
50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
55
56#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
57#define FIOCLEX 0x5451
58#define FIOASYNC 0x5452
59#define TIOCSERCONFIG 0x5453
60#define TIOCSERGWILD 0x5454
61#define TIOCSERSWILD 0x5455
62#define TIOCGLCKTRMIOS 0x5456
63#define TIOCSLCKTRMIOS 0x5457
64#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
65#define TIOCSERGETLSR 0x5459 /* Get line status register */
66#define TIOCSERGETMULTI 0x545A /* Get multiport config */
67#define TIOCSERSETMULTI 0x545B /* Set multiport config */
68
69#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
70#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
71#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
72#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
73#define FIOQSIZE 0x5460 /* Get exact space used by quota */
74
75#define TIOCSTART 0x5461
76#define TIOCSTOP 0x5462
77#define TIOCSLTC 0x5462
78
79/* Used for packet mode */
80#define TIOCPKT_DATA 0
81#define TIOCPKT_FLUSHREAD 1
82#define TIOCPKT_FLUSHWRITE 2
83#define TIOCPKT_STOP 4
84#define TIOCPKT_START 8
85#define TIOCPKT_NOSTOP 16
86#define TIOCPKT_DOSTOP 32
87
88#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
89
90#endif /* _ASM_PARISC_IOCTLS_H */
diff --git a/include/asm-parisc/ipcbuf.h b/include/asm-parisc/ipcbuf.h
deleted file mode 100644
index bd956c425785..000000000000
--- a/include/asm-parisc/ipcbuf.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef __PARISC_IPCBUF_H__
2#define __PARISC_IPCBUF_H__
3
4/*
5 * The ipc64_perm structure for PA-RISC is almost identical to
6 * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the kernel.
7 * 'seq' has been changed from long to int so that it's the same size
8 * on 64-bit kernels as on 32-bit ones.
9 */
10
11struct ipc64_perm
12{
13 key_t key;
14 uid_t uid;
15 gid_t gid;
16 uid_t cuid;
17 gid_t cgid;
18 unsigned short int __pad1;
19 mode_t mode;
20 unsigned short int __pad2;
21 unsigned short int seq;
22 unsigned int __pad3;
23 unsigned long long int __unused1;
24 unsigned long long int __unused2;
25};
26
27#endif /* __PARISC_IPCBUF_H__ */
diff --git a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
deleted file mode 100644
index 399c81981ed5..000000000000
--- a/include/asm-parisc/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * include/asm-parisc/irq.h
3 *
4 * Copyright 2005 Matthew Wilcox <matthew@wil.cx>
5 */
6
7#ifndef _ASM_PARISC_IRQ_H
8#define _ASM_PARISC_IRQ_H
9
10#include <linux/cpumask.h>
11#include <asm/types.h>
12
13#define NO_IRQ (-1)
14
15#ifdef CONFIG_GSC
16#define GSC_IRQ_BASE 16
17#define GSC_IRQ_MAX 63
18#define CPU_IRQ_BASE 64
19#else
20#define CPU_IRQ_BASE 16
21#endif
22
23#define TIMER_IRQ (CPU_IRQ_BASE + 0)
24#define IPI_IRQ (CPU_IRQ_BASE + 1)
25#define CPU_IRQ_MAX (CPU_IRQ_BASE + (BITS_PER_LONG - 1))
26
27#define NR_IRQS (CPU_IRQ_MAX + 1)
28
29static __inline__ int irq_canonicalize(int irq)
30{
31 return (irq == 2) ? 9 : irq;
32}
33
34struct irq_chip;
35
36/*
37 * Some useful "we don't have to do anything here" handlers. Should
38 * probably be provided by the generic code.
39 */
40void no_ack_irq(unsigned int irq);
41void no_end_irq(unsigned int irq);
42void cpu_ack_irq(unsigned int irq);
43void cpu_end_irq(unsigned int irq);
44
45extern int txn_alloc_irq(unsigned int nbits);
46extern int txn_claim_irq(int);
47extern unsigned int txn_alloc_data(unsigned int);
48extern unsigned long txn_alloc_addr(unsigned int);
49extern unsigned long txn_affinity_addr(unsigned int irq, int cpu);
50
51extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *);
52extern int cpu_check_affinity(unsigned int irq, cpumask_t *dest);
53
54/* soft power switch support (power.c) */
55extern struct tasklet_struct power_tasklet;
56
57#endif /* _ASM_PARISC_IRQ_H */
diff --git a/include/asm-parisc/irq_regs.h b/include/asm-parisc/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-parisc/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-parisc/kdebug.h b/include/asm-parisc/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/include/asm-parisc/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/include/asm-parisc/kmap_types.h b/include/asm-parisc/kmap_types.h
deleted file mode 100644
index 806aae3c5338..000000000000
--- a/include/asm-parisc/kmap_types.h
+++ /dev/null
@@ -1,30 +0,0 @@
1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H
3
4
5#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n ,
7#else
8# define D(n)
9#endif
10
11enum km_type {
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27
28#undef D
29
30#endif
diff --git a/include/asm-parisc/led.h b/include/asm-parisc/led.h
deleted file mode 100644
index c3405ab9d60a..000000000000
--- a/include/asm-parisc/led.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef LED_H
2#define LED_H
3
4#define LED7 0x80 /* top (or furthest right) LED */
5#define LED6 0x40
6#define LED5 0x20
7#define LED4 0x10
8#define LED3 0x08
9#define LED2 0x04
10#define LED1 0x02
11#define LED0 0x01 /* bottom (or furthest left) LED */
12
13#define LED_LAN_TX LED0 /* for LAN transmit activity */
14#define LED_LAN_RCV LED1 /* for LAN receive activity */
15#define LED_DISK_IO LED2 /* for disk activity */
16#define LED_HEARTBEAT LED3 /* heartbeat */
17
18/* values for pdc_chassis_lcd_info_ret_block.model: */
19#define DISPLAY_MODEL_LCD 0 /* KittyHawk LED or LCD */
20#define DISPLAY_MODEL_NONE 1 /* no LED or LCD */
21#define DISPLAY_MODEL_LASI 2 /* LASI style 8 bit LED */
22#define DISPLAY_MODEL_OLD_ASP 0x7F /* faked: ASP style 8 x 1 bit LED (only very old ASP versions) */
23
24#define LED_CMD_REG_NONE 0 /* NULL == no addr for the cmd register */
25
26/* register_led_driver() */
27int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long data_reg);
28
29/* registers the LED regions for procfs */
30void __init register_led_regions(void);
31
32#ifdef CONFIG_CHASSIS_LCD_LED
33/* writes a string to the LCD display (if possible on this h/w) */
34int lcd_print(const char *str);
35#else
36#define lcd_print(str)
37#endif
38
39/* main LED initialization function (uses PDC) */
40int __init led_init(void);
41
42#endif /* LED_H */
diff --git a/include/asm-parisc/linkage.h b/include/asm-parisc/linkage.h
deleted file mode 100644
index 0b19a7242d0c..000000000000
--- a/include/asm-parisc/linkage.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef __ASM_PARISC_LINKAGE_H
2#define __ASM_PARISC_LINKAGE_H
3
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 separate independent lines.
12 */
13#ifdef __ASSEMBLY__
14
15#define ENTRY(name) \
16 .export name !\
17 ALIGN !\
18name:
19
20#ifdef CONFIG_64BIT
21#define ENDPROC(name) \
22 END(name)
23#else
24#define ENDPROC(name) \
25 .type name, @function !\
26 END(name)
27#endif
28
29#endif /* __ASSEMBLY__ */
30
31#endif /* __ASM_PARISC_LINKAGE_H */
diff --git a/include/asm-parisc/local.h b/include/asm-parisc/local.h
deleted file mode 100644
index c11c530f74d0..000000000000
--- a/include/asm-parisc/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/include/asm-parisc/machdep.h b/include/asm-parisc/machdep.h
deleted file mode 100644
index a231c97d703e..000000000000
--- a/include/asm-parisc/machdep.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _PARISC_MACHDEP_H
2#define _PARISC_MACHDEP_H
3
4#include <linux/notifier.h>
5
6#define MACH_RESTART 1
7#define MACH_HALT 2
8#define MACH_POWER_ON 3
9#define MACH_POWER_OFF 4
10
11extern struct notifier_block *mach_notifier;
12extern void pa7300lc_init(void);
13
14extern void (*cpu_lpmc)(int, struct pt_regs *);
15
16#endif
diff --git a/include/asm-parisc/mc146818rtc.h b/include/asm-parisc/mc146818rtc.h
deleted file mode 100644
index adf41631449f..000000000000
--- a/include/asm-parisc/mc146818rtc.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H
6
7/* empty include file to satisfy the include in genrtc.c */
8
9#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-parisc/mckinley.h b/include/asm-parisc/mckinley.h
deleted file mode 100644
index d1ea6f12915e..000000000000
--- a/include/asm-parisc/mckinley.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef ASM_PARISC_MCKINLEY_H
2#define ASM_PARISC_MCKINLEY_H
3#ifdef __KERNEL__
4
5/* declared in arch/parisc/kernel/setup.c */
6extern struct proc_dir_entry * proc_mckinley_root;
7
8#endif /*__KERNEL__*/
9#endif /*ASM_PARISC_MCKINLEY_H*/
diff --git a/include/asm-parisc/mman.h b/include/asm-parisc/mman.h
deleted file mode 100644
index defe752cc996..000000000000
--- a/include/asm-parisc/mman.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef __PARISC_MMAN_H__
2#define __PARISC_MMAN_H__
3
4#define PROT_READ 0x1 /* page can be read */
5#define PROT_WRITE 0x2 /* page can be written */
6#define PROT_EXEC 0x4 /* page can be executed */
7#define PROT_SEM 0x8 /* page may be used for atomic ops */
8#define PROT_NONE 0x0 /* page can not be accessed */
9#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
10#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
11
12#define MAP_SHARED 0x01 /* Share changes */
13#define MAP_PRIVATE 0x02 /* Changes are private */
14#define MAP_TYPE 0x03 /* Mask for type of mapping */
15#define MAP_FIXED 0x04 /* Interpret addr exactly */
16#define MAP_ANONYMOUS 0x10 /* don't use a file */
17
18#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
19#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
20#define MAP_LOCKED 0x2000 /* pages are locked */
21#define MAP_NORESERVE 0x4000 /* don't check for reservations */
22#define MAP_GROWSDOWN 0x8000 /* stack-like segment */
23#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
24#define MAP_NONBLOCK 0x20000 /* do not block on IO */
25
26#define MS_SYNC 1 /* synchronous memory sync */
27#define MS_ASYNC 2 /* sync memory asynchronously */
28#define MS_INVALIDATE 4 /* invalidate the caches */
29
30#define MCL_CURRENT 1 /* lock all current mappings */
31#define MCL_FUTURE 2 /* lock all future mappings */
32
33#define MADV_NORMAL 0 /* no further special treatment */
34#define MADV_RANDOM 1 /* expect random page references */
35#define MADV_SEQUENTIAL 2 /* expect sequential page references */
36#define MADV_WILLNEED 3 /* will need these pages */
37#define MADV_DONTNEED 4 /* don't need these pages */
38#define MADV_SPACEAVAIL 5 /* insure that resources are reserved */
39#define MADV_VPS_PURGE 6 /* Purge pages from VM page cache */
40#define MADV_VPS_INHERIT 7 /* Inherit parents page size */
41
42/* common/generic parameters */
43#define MADV_REMOVE 9 /* remove these pages & resources */
44#define MADV_DONTFORK 10 /* don't inherit across fork */
45#define MADV_DOFORK 11 /* do inherit across fork */
46
47/* The range 12-64 is reserved for page size specification. */
48#define MADV_4K_PAGES 12 /* Use 4K pages */
49#define MADV_16K_PAGES 14 /* Use 16K pages */
50#define MADV_64K_PAGES 16 /* Use 64K pages */
51#define MADV_256K_PAGES 18 /* Use 256K pages */
52#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */
53#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */
54#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */
55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */
56
57/* compatibility flags */
58#define MAP_FILE 0
59#define MAP_VARIABLE 0
60
61#endif /* __PARISC_MMAN_H__ */
diff --git a/include/asm-parisc/mmu.h b/include/asm-parisc/mmu.h
deleted file mode 100644
index 6a310cf8b734..000000000000
--- a/include/asm-parisc/mmu.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _PARISC_MMU_H_
2#define _PARISC_MMU_H_
3
4/* On parisc, we store the space id here */
5typedef unsigned long mm_context_t;
6
7#endif /* _PARISC_MMU_H_ */
diff --git a/include/asm-parisc/mmu_context.h b/include/asm-parisc/mmu_context.h
deleted file mode 100644
index 85856c74ad1d..000000000000
--- a/include/asm-parisc/mmu_context.h
+++ /dev/null
@@ -1,75 +0,0 @@
1#ifndef __PARISC_MMU_CONTEXT_H
2#define __PARISC_MMU_CONTEXT_H
3
4#include <linux/mm.h>
5#include <linux/sched.h>
6#include <asm/atomic.h>
7#include <asm/pgalloc.h>
8#include <asm/pgtable.h>
9#include <asm-generic/mm_hooks.h>
10
11static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
12{
13}
14
15/* on PA-RISC, we actually have enough contexts to justify an allocator
16 * for them. prumpf */
17
18extern unsigned long alloc_sid(void);
19extern void free_sid(unsigned long);
20
21static inline int
22init_new_context(struct task_struct *tsk, struct mm_struct *mm)
23{
24 BUG_ON(atomic_read(&mm->mm_users) != 1);
25
26 mm->context = alloc_sid();
27 return 0;
28}
29
30static inline void
31destroy_context(struct mm_struct *mm)
32{
33 free_sid(mm->context);
34 mm->context = 0;
35}
36
37static inline void load_context(mm_context_t context)
38{
39 mtsp(context, 3);
40#if SPACEID_SHIFT == 0
41 mtctl(context << 1,8);
42#else
43 mtctl(context >> (SPACEID_SHIFT - 1),8);
44#endif
45}
46
47static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
48{
49
50 if (prev != next) {
51 mtctl(__pa(next->pgd), 25);
52 load_context(next->context);
53 }
54}
55
56#define deactivate_mm(tsk,mm) do { } while (0)
57
58static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
59{
60 /*
61 * Activate_mm is our one chance to allocate a space id
62 * for a new mm created in the exec path. There's also
63 * some lazy tlb stuff, which is currently dead code, but
64 * we only allocate a space id if one hasn't been allocated
65 * already, so we should be OK.
66 */
67
68 BUG_ON(next == &init_mm); /* Should never happen */
69
70 if (next->context == 0)
71 next->context = alloc_sid();
72
73 switch_mm(prev,next,current);
74}
75#endif
diff --git a/include/asm-parisc/mmzone.h b/include/asm-parisc/mmzone.h
deleted file mode 100644
index 9608d2cf214a..000000000000
--- a/include/asm-parisc/mmzone.h
+++ /dev/null
@@ -1,73 +0,0 @@
1#ifndef _PARISC_MMZONE_H
2#define _PARISC_MMZONE_H
3
4#ifdef CONFIG_DISCONTIGMEM
5
6#define MAX_PHYSMEM_RANGES 8 /* Fix the size for now (current known max is 3) */
7extern int npmem_ranges;
8
9struct node_map_data {
10 pg_data_t pg_data;
11};
12
13extern struct node_map_data node_data[];
14
15#define NODE_DATA(nid) (&node_data[nid].pg_data)
16
17#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
18#define node_end_pfn(nid) \
19({ \
20 pg_data_t *__pgdat = NODE_DATA(nid); \
21 __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \
22})
23
24/* We have these possible memory map layouts:
25 * Astro: 0-3.75, 67.75-68, 4-64
26 * zx1: 0-1, 257-260, 4-256
27 * Stretch (N-class): 0-2, 4-32, 34-xxx
28 */
29
30/* Since each 1GB can only belong to one region (node), we can create
31 * an index table for pfn to nid lookup; each entry in pfnnid_map
32 * represents 1GB, and contains the node that the memory belongs to. */
33
34#define PFNNID_SHIFT (30 - PAGE_SHIFT)
35#define PFNNID_MAP_MAX 512 /* support 512GB */
36extern unsigned char pfnnid_map[PFNNID_MAP_MAX];
37
38#ifndef CONFIG_64BIT
39#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT))
40#else
41/* io can be 0xf0f0f0f0f0xxxxxx or 0xfffffffff0000000 */
42#define pfn_is_io(pfn) ((pfn & (0xf000000000000000UL >> PAGE_SHIFT)) == (0xf000000000000000UL >> PAGE_SHIFT))
43#endif
44
45static inline int pfn_to_nid(unsigned long pfn)
46{
47 unsigned int i;
48 unsigned char r;
49
50 if (unlikely(pfn_is_io(pfn)))
51 return 0;
52
53 i = pfn >> PFNNID_SHIFT;
54 BUG_ON(i >= sizeof(pfnnid_map) / sizeof(pfnnid_map[0]));
55 r = pfnnid_map[i];
56 BUG_ON(r == 0xff);
57
58 return (int)r;
59}
60
61static inline int pfn_valid(int pfn)
62{
63 int nid = pfn_to_nid(pfn);
64
65 if (nid >= 0)
66 return (pfn < node_end_pfn(nid));
67 return 0;
68}
69
70#else /* !CONFIG_DISCONTIGMEM */
71#define MAX_PHYSMEM_RANGES 1
72#endif
73#endif /* _PARISC_MMZONE_H */
diff --git a/include/asm-parisc/module.h b/include/asm-parisc/module.h
deleted file mode 100644
index c2cb49e934c1..000000000000
--- a/include/asm-parisc/module.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _ASM_PARISC_MODULE_H
2#define _ASM_PARISC_MODULE_H
3/*
4 * This file contains the parisc architecture specific module code.
5 */
6#ifdef CONFIG_64BIT
7#define Elf_Shdr Elf64_Shdr
8#define Elf_Sym Elf64_Sym
9#define Elf_Ehdr Elf64_Ehdr
10#define Elf_Addr Elf64_Addr
11#define Elf_Rela Elf64_Rela
12#else
13#define Elf_Shdr Elf32_Shdr
14#define Elf_Sym Elf32_Sym
15#define Elf_Ehdr Elf32_Ehdr
16#define Elf_Addr Elf32_Addr
17#define Elf_Rela Elf32_Rela
18#endif
19
20struct unwind_table;
21
22struct mod_arch_specific
23{
24 unsigned long got_offset, got_count, got_max;
25 unsigned long fdesc_offset, fdesc_count, fdesc_max;
26 unsigned long stub_offset, stub_count, stub_max;
27 unsigned long init_stub_offset, init_stub_count, init_stub_max;
28 int unwind_section;
29 struct unwind_table *unwind;
30};
31
32#endif /* _ASM_PARISC_MODULE_H */
diff --git a/include/asm-parisc/msgbuf.h b/include/asm-parisc/msgbuf.h
deleted file mode 100644
index fe88f2649418..000000000000
--- a/include/asm-parisc/msgbuf.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef _PARISC_MSGBUF_H
2#define _PARISC_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for parisc architecture, copied from sparc.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16#ifndef CONFIG_64BIT
17 unsigned int __pad1;
18#endif
19 __kernel_time_t msg_stime; /* last msgsnd time */
20#ifndef CONFIG_64BIT
21 unsigned int __pad2;
22#endif
23 __kernel_time_t msg_rtime; /* last msgrcv time */
24#ifndef CONFIG_64BIT
25 unsigned int __pad3;
26#endif
27 __kernel_time_t msg_ctime; /* last change time */
28 unsigned int msg_cbytes; /* current number of bytes on queue */
29 unsigned int msg_qnum; /* number of messages in queue */
30 unsigned int msg_qbytes; /* max number of bytes on queue */
31 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
32 __kernel_pid_t msg_lrpid; /* last receive pid */
33 unsigned int __unused1;
34 unsigned int __unused2;
35};
36
37#endif /* _PARISC_MSGBUF_H */
diff --git a/include/asm-parisc/mutex.h b/include/asm-parisc/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-parisc/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-parisc/page.h b/include/asm-parisc/page.h
deleted file mode 100644
index c3941f09a878..000000000000
--- a/include/asm-parisc/page.h
+++ /dev/null
@@ -1,173 +0,0 @@
1#ifndef _PARISC_PAGE_H
2#define _PARISC_PAGE_H
3
4#include <linux/const.h>
5
6#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
7# define PAGE_SHIFT 12
8#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
9# define PAGE_SHIFT 14
10#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
11# define PAGE_SHIFT 16
12#else
13# error "unknown default kernel page size"
14#endif
15#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17
18
19#ifndef __ASSEMBLY__
20
21#include <asm/types.h>
22#include <asm/cache.h>
23
24#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
25#define copy_page(to,from) copy_user_page_asm((void *)(to), (void *)(from))
26
27struct page;
28
29void copy_user_page_asm(void *to, void *from);
30void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
31 struct page *pg);
32void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
33
34/*
35 * These are used to make use of C type-checking..
36 */
37#define STRICT_MM_TYPECHECKS
38#ifdef STRICT_MM_TYPECHECKS
39typedef struct { unsigned long pte;
40#if !defined(CONFIG_64BIT)
41 unsigned long future_flags;
42 /* XXX: it's possible to remove future_flags and change BITS_PER_PTE_ENTRY
43 to 2, but then strangely the identical 32bit kernel boots on a
44 c3000(pa20), but not any longer on a 715(pa11).
45 Still investigating... HelgeD.
46 */
47#endif
48} pte_t; /* either 32 or 64bit */
49
50/* NOTE: even on 64 bits, these entries are __u32 because we allocate
51 * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */
52typedef struct { __u32 pmd; } pmd_t;
53typedef struct { __u32 pgd; } pgd_t;
54typedef struct { unsigned long pgprot; } pgprot_t;
55
56#define pte_val(x) ((x).pte)
57/* These do not work lvalues, so make sure we don't use them as such. */
58#define pmd_val(x) ((x).pmd + 0)
59#define pgd_val(x) ((x).pgd + 0)
60#define pgprot_val(x) ((x).pgprot)
61
62#define __pte(x) ((pte_t) { (x) } )
63#define __pmd(x) ((pmd_t) { (x) } )
64#define __pgd(x) ((pgd_t) { (x) } )
65#define __pgprot(x) ((pgprot_t) { (x) } )
66
67#define __pmd_val_set(x,n) (x).pmd = (n)
68#define __pgd_val_set(x,n) (x).pgd = (n)
69
70#else
71/*
72 * .. while these make it easier on the compiler
73 */
74typedef unsigned long pte_t;
75typedef __u32 pmd_t;
76typedef __u32 pgd_t;
77typedef unsigned long pgprot_t;
78
79#define pte_val(x) (x)
80#define pmd_val(x) (x)
81#define pgd_val(x) (x)
82#define pgprot_val(x) (x)
83
84#define __pte(x) (x)
85#define __pmd(x) (x)
86#define __pgd(x) (x)
87#define __pgprot(x) (x)
88
89#define __pmd_val_set(x,n) (x) = (n)
90#define __pgd_val_set(x,n) (x) = (n)
91
92#endif /* STRICT_MM_TYPECHECKS */
93
94typedef struct page *pgtable_t;
95
96typedef struct __physmem_range {
97 unsigned long start_pfn;
98 unsigned long pages; /* PAGE_SIZE pages */
99} physmem_range_t;
100
101extern physmem_range_t pmem_ranges[];
102extern int npmem_ranges;
103
104#endif /* !__ASSEMBLY__ */
105
106/* WARNING: The definitions below must match exactly to sizeof(pte_t)
107 * etc
108 */
109#ifdef CONFIG_64BIT
110#define BITS_PER_PTE_ENTRY 3
111#define BITS_PER_PMD_ENTRY 2
112#define BITS_PER_PGD_ENTRY 2
113#else
114#define BITS_PER_PTE_ENTRY 3
115#define BITS_PER_PMD_ENTRY 2
116#define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY
117#endif
118#define PGD_ENTRY_SIZE (1UL << BITS_PER_PGD_ENTRY)
119#define PMD_ENTRY_SIZE (1UL << BITS_PER_PMD_ENTRY)
120#define PTE_ENTRY_SIZE (1UL << BITS_PER_PTE_ENTRY)
121
122#define LINUX_GATEWAY_SPACE 0
123
124/* This governs the relationship between virtual and physical addresses.
125 * If you alter it, make sure to take care of our various fixed mapping
126 * segments in fixmap.h */
127#ifdef CONFIG_64BIT
128#define __PAGE_OFFSET (0x40000000) /* 1GB */
129#else
130#define __PAGE_OFFSET (0x10000000) /* 256MB */
131#endif
132
133#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
134
135/* The size of the gateway page (we leave lots of room for expansion) */
136#define GATEWAY_PAGE_SIZE 0x4000
137
138/* The start of the actual kernel binary---used in vmlinux.lds.S
139 * Leave some space after __PAGE_OFFSET for detecting kernel null
140 * ptr derefs */
141#define KERNEL_BINARY_TEXT_START (__PAGE_OFFSET + 0x100000)
142
143/* These macros don't work for 64-bit C code -- don't allow in C at all */
144#ifdef __ASSEMBLY__
145# define PA(x) ((x)-__PAGE_OFFSET)
146# define VA(x) ((x)+__PAGE_OFFSET)
147#endif
148#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
149#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
150
151#ifndef CONFIG_DISCONTIGMEM
152#define pfn_valid(pfn) ((pfn) < max_mapnr)
153#endif /* CONFIG_DISCONTIGMEM */
154
155#ifdef CONFIG_HUGETLB_PAGE
156#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */
157#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
158#define HPAGE_MASK (~(HPAGE_SIZE - 1))
159#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
160#endif
161
162#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
163
164#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
165#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
166
167#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
168 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
169
170#include <asm-generic/memory_model.h>
171#include <asm-generic/page.h>
172
173#endif /* _PARISC_PAGE_H */
diff --git a/include/asm-parisc/param.h b/include/asm-parisc/param.h
deleted file mode 100644
index 32e03d877858..000000000000
--- a/include/asm-parisc/param.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASMPARISC_PARAM_H
2#define _ASMPARISC_PARAM_H
3
4#ifdef __KERNEL__
5#define HZ CONFIG_HZ
6#define USER_HZ 100 /* some user API use "ticks" */
7#define CLOCKS_PER_SEC (USER_HZ) /* like times() */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 4096
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif
diff --git a/include/asm-parisc/parisc-device.h b/include/asm-parisc/parisc-device.h
deleted file mode 100644
index 7aa13f2add7a..000000000000
--- a/include/asm-parisc/parisc-device.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef _ASM_PARISC_PARISC_DEVICE_H_
2#define _ASM_PARISC_PARISC_DEVICE_H_
3
4#include <linux/device.h>
5
6struct parisc_device {
7 struct resource hpa; /* Hard Physical Address */
8 struct parisc_device_id id;
9 struct parisc_driver *driver; /* Driver for this device */
10 char name[80]; /* The hardware description */
11 int irq;
12 int aux_irq; /* Some devices have a second IRQ */
13
14 char hw_path; /* The module number on this bus */
15 unsigned int num_addrs; /* some devices have additional address ranges. */
16 unsigned long *addr; /* which will be stored here */
17
18#ifdef CONFIG_64BIT
19 /* parms for pdc_pat_cell_module() call */
20 unsigned long pcell_loc; /* Physical Cell location */
21 unsigned long mod_index; /* PAT specific - Misc Module info */
22
23 /* generic info returned from pdc_pat_cell_module() */
24 unsigned long mod_info; /* PAT specific - Misc Module info */
25 unsigned long pmod_loc; /* physical Module location */
26#endif
27 u64 dma_mask; /* DMA mask for I/O */
28 struct device dev;
29};
30
31struct parisc_driver {
32 struct parisc_driver *next;
33 char *name;
34 const struct parisc_device_id *id_table;
35 int (*probe) (struct parisc_device *dev); /* New device discovered */
36 int (*remove) (struct parisc_device *dev);
37 struct device_driver drv;
38};
39
40
41#define to_parisc_device(d) container_of(d, struct parisc_device, dev)
42#define to_parisc_driver(d) container_of(d, struct parisc_driver, drv)
43#define parisc_parent(d) to_parisc_device(d->dev.parent)
44
45static inline char *parisc_pathname(struct parisc_device *d)
46{
47 return d->dev.bus_id;
48}
49
50static inline void
51parisc_set_drvdata(struct parisc_device *d, void *p)
52{
53 dev_set_drvdata(&d->dev, p);
54}
55
56static inline void *
57parisc_get_drvdata(struct parisc_device *d)
58{
59 return dev_get_drvdata(&d->dev);
60}
61
62extern struct bus_type parisc_bus_type;
63
64#endif /*_ASM_PARISC_PARISC_DEVICE_H_*/
diff --git a/include/asm-parisc/parport.h b/include/asm-parisc/parport.h
deleted file mode 100644
index 00d9cc3e7b97..000000000000
--- a/include/asm-parisc/parport.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 *
3 * parport.h: ia32-compatible parport initialisation
4 *
5 * This file should only be included by drivers/parport/parport_pc.c.
6 */
7#ifndef _ASM_PARPORT_H
8#define _ASM_PARPORT_H 1
9
10
11static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
12{
13 /* nothing ! */
14 return 0;
15}
16
17
18#endif /* !(_ASM_PARPORT_H) */
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
deleted file mode 100644
index 4ba868f44a5e..000000000000
--- a/include/asm-parisc/pci.h
+++ /dev/null
@@ -1,294 +0,0 @@
1#ifndef __ASM_PARISC_PCI_H
2#define __ASM_PARISC_PCI_H
3
4#include <asm/scatterlist.h>
5
6
7
8/*
9** HP PCI platforms generally support multiple bus adapters.
10** (workstations 1-~4, servers 2-~32)
11**
12** Newer platforms number the busses across PCI bus adapters *sparsely*.
13** E.g. 0, 8, 16, ...
14**
15** Under a PCI bus, most HP platforms support PPBs up to two or three
16** levels deep. See "Bit3" product line.
17*/
18#define PCI_MAX_BUSSES 256
19
20
21/* To be used as: mdelay(pci_post_reset_delay);
22 *
23 * post_reset is the time the kernel should stall to prevent anyone from
24 * accessing the PCI bus once #RESET is de-asserted.
25 * PCI spec somewhere says 1 second but with multi-PCI bus systems,
26 * this makes the boot time much longer than necessary.
27 * 20ms seems to work for all the HP PCI implementations to date.
28 */
29#define pci_post_reset_delay 50
30
31
32/*
33** pci_hba_data (aka H2P_OBJECT in HP/UX)
34**
35** This is the "common" or "base" data structure which HBA drivers
36** (eg Dino or LBA) are required to place at the top of their own
37** platform_data structure. I've heard this called "C inheritance" too.
38**
39** Data needed by pcibios layer belongs here.
40*/
41struct pci_hba_data {
42 void __iomem *base_addr; /* aka Host Physical Address */
43 const struct parisc_device *dev; /* device from PA bus walk */
44 struct pci_bus *hba_bus; /* primary PCI bus below HBA */
45 int hba_num; /* I/O port space access "key" */
46 struct resource bus_num; /* PCI bus numbers */
47 struct resource io_space; /* PIOP */
48 struct resource lmmio_space; /* bus addresses < 4Gb */
49 struct resource elmmio_space; /* additional bus addresses < 4Gb */
50 struct resource gmmio_space; /* bus addresses > 4Gb */
51
52 /* NOTE: Dino code assumes it can use *all* of the lmmio_space,
53 * elmmio_space and gmmio_space as a contiguous array of
54 * resources. This #define represents the array size */
55 #define DINO_MAX_LMMIO_RESOURCES 3
56
57 unsigned long lmmio_space_offset; /* CPU view - PCI view */
58 void * iommu; /* IOMMU this device is under */
59 /* REVISIT - spinlock to protect resources? */
60
61 #define HBA_NAME_SIZE 16
62 char io_name[HBA_NAME_SIZE];
63 char lmmio_name[HBA_NAME_SIZE];
64 char elmmio_name[HBA_NAME_SIZE];
65 char gmmio_name[HBA_NAME_SIZE];
66};
67
68#define HBA_DATA(d) ((struct pci_hba_data *) (d))
69
70/*
71** We support 2^16 I/O ports per HBA. These are set up in the form
72** 0xbbxxxx, where bb is the bus number and xxxx is the I/O port
73** space address.
74*/
75#define HBA_PORT_SPACE_BITS 16
76
77#define HBA_PORT_BASE(h) ((h) << HBA_PORT_SPACE_BITS)
78#define HBA_PORT_SPACE_SIZE (1UL << HBA_PORT_SPACE_BITS)
79
80#define PCI_PORT_HBA(a) ((a) >> HBA_PORT_SPACE_BITS)
81#define PCI_PORT_ADDR(a) ((a) & (HBA_PORT_SPACE_SIZE - 1))
82
83#ifdef CONFIG_64BIT
84#define PCI_F_EXTEND 0xffffffff00000000UL
85#define PCI_IS_LMMIO(hba,a) pci_is_lmmio(hba,a)
86
87/* We need to know if an address is LMMMIO or GMMIO.
88 * LMMIO requires mangling and GMMIO we must use as-is.
89 */
90static __inline__ int pci_is_lmmio(struct pci_hba_data *hba, unsigned long a)
91{
92 return(((a) & PCI_F_EXTEND) == PCI_F_EXTEND);
93}
94
95/*
96** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses.
97** See pci.c for more conversions used by Generic PCI code.
98**
99** Platform characteristics/firmware guarantee that
100** (1) PA_VIEW - IO_VIEW = lmmio_offset for both LMMIO and ELMMIO
101** (2) PA_VIEW == IO_VIEW for GMMIO
102*/
103#define PCI_BUS_ADDR(hba,a) (PCI_IS_LMMIO(hba,a) \
104 ? ((a) - hba->lmmio_space_offset) /* mangle LMMIO */ \
105 : (a)) /* GMMIO */
106#define PCI_HOST_ADDR(hba,a) (((a) & PCI_F_EXTEND) == 0 \
107 ? (a) + hba->lmmio_space_offset \
108 : (a))
109
110#else /* !CONFIG_64BIT */
111
112#define PCI_BUS_ADDR(hba,a) (a)
113#define PCI_HOST_ADDR(hba,a) (a)
114#define PCI_F_EXTEND 0UL
115#define PCI_IS_LMMIO(hba,a) (1) /* 32-bit doesn't support GMMIO */
116
117#endif /* !CONFIG_64BIT */
118
119/*
120** KLUGE: linux/pci.h include asm/pci.h BEFORE declaring struct pci_bus
121** (This eliminates some of the warnings).
122*/
123struct pci_bus;
124struct pci_dev;
125
126/*
127 * If the PCI device's view of memory is the same as the CPU's view of memory,
128 * PCI_DMA_BUS_IS_PHYS is true. The networking and block device layers use
129 * this boolean for bounce buffer decisions.
130 */
131#ifdef CONFIG_PA20
132/* All PA-2.0 machines have an IOMMU. */
133#define PCI_DMA_BUS_IS_PHYS 0
134#define parisc_has_iommu() do { } while (0)
135#else
136
137#if defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)
138extern int parisc_bus_is_phys; /* in arch/parisc/kernel/setup.c */
139#define PCI_DMA_BUS_IS_PHYS parisc_bus_is_phys
140#define parisc_has_iommu() do { parisc_bus_is_phys = 0; } while (0)
141#else
142#define PCI_DMA_BUS_IS_PHYS 1
143#define parisc_has_iommu() do { } while (0)
144#endif
145
146#endif /* !CONFIG_PA20 */
147
148
149/*
150** Most PCI devices (eg Tulip, NCR720) also export the same registers
151** to both MMIO and I/O port space. Due to poor performance of I/O Port
152** access under HP PCI bus adapters, strongly recommend the use of MMIO
153** address space.
154**
155** While I'm at it more PA programming notes:
156**
157** 1) MMIO stores (writes) are posted operations. This means the processor
158** gets an "ACK" before the write actually gets to the device. A read
159** to the same device (or typically the bus adapter above it) will
160** force in-flight write transaction(s) out to the targeted device
161** before the read can complete.
162**
163** 2) The Programmed I/O (PIO) data may not always be strongly ordered with
164** respect to DMA on all platforms. Ie PIO data can reach the processor
165** before in-flight DMA reaches memory. Since most SMP PA platforms
166** are I/O coherent, it generally doesn't matter...but sometimes
167** it does.
168**
169** I've helped device driver writers debug both types of problems.
170*/
171struct pci_port_ops {
172 u8 (*inb) (struct pci_hba_data *hba, u16 port);
173 u16 (*inw) (struct pci_hba_data *hba, u16 port);
174 u32 (*inl) (struct pci_hba_data *hba, u16 port);
175 void (*outb) (struct pci_hba_data *hba, u16 port, u8 data);
176 void (*outw) (struct pci_hba_data *hba, u16 port, u16 data);
177 void (*outl) (struct pci_hba_data *hba, u16 port, u32 data);
178};
179
180
181struct pci_bios_ops {
182 void (*init)(void);
183 void (*fixup_bus)(struct pci_bus *bus);
184};
185
186/* pci_unmap_{single,page} is not a nop, thus... */
187#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
188 dma_addr_t ADDR_NAME;
189#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
190 __u32 LEN_NAME;
191#define pci_unmap_addr(PTR, ADDR_NAME) \
192 ((PTR)->ADDR_NAME)
193#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
194 (((PTR)->ADDR_NAME) = (VAL))
195#define pci_unmap_len(PTR, LEN_NAME) \
196 ((PTR)->LEN_NAME)
197#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
198 (((PTR)->LEN_NAME) = (VAL))
199
200/*
201** Stuff declared in arch/parisc/kernel/pci.c
202*/
203extern struct pci_port_ops *pci_port;
204extern struct pci_bios_ops *pci_bios;
205
206#ifdef CONFIG_PCI
207extern void pcibios_register_hba(struct pci_hba_data *);
208extern void pcibios_set_master(struct pci_dev *);
209#else
210static inline void pcibios_register_hba(struct pci_hba_data *x)
211{
212}
213#endif
214
215/*
216 * pcibios_assign_all_busses() is used in drivers/pci/pci.c:pci_do_scan_bus()
217 * 0 == check if bridge is numbered before re-numbering.
218 * 1 == pci_do_scan_bus() should automatically number all PCI-PCI bridges.
219 *
220 * We *should* set this to zero for "legacy" platforms and one
221 * for PAT platforms.
222 *
223 * But legacy platforms also need to renumber the busses below a Host
224 * Bus controller. Adding a 4-port Tulip card on the first PCI root
225 * bus of a C200 resulted in the secondary bus being numbered as 1.
226 * The second PCI host bus controller's root bus had already been
227 * assigned bus number 1 by firmware and sysfs complained.
228 *
229 * Firmware isn't doing anything wrong here since each controller
230 * is its own PCI domain. It's simpler and easier for us to renumber
231 * the busses rather than treat each Dino as a separate PCI domain.
232 * Eventually, we may want to introduce PCI domains for Superdome or
233 * rp7420/8420 boxes and then revisit this issue.
234 */
235#define pcibios_assign_all_busses() (1)
236#define pcibios_scan_all_fns(a, b) (0)
237
238#define PCIBIOS_MIN_IO 0x10
239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */
240
241/* export the pci_ DMA API in terms of the dma_ one */
242#include <asm-generic/pci-dma-compat.h>
243
244#ifdef CONFIG_PCI
245static inline void pci_dma_burst_advice(struct pci_dev *pdev,
246 enum pci_dma_burst_strategy *strat,
247 unsigned long *strategy_parameter)
248{
249 unsigned long cacheline_size;
250 u8 byte;
251
252 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &byte);
253 if (byte == 0)
254 cacheline_size = 1024;
255 else
256 cacheline_size = (int) byte * 4;
257
258 *strat = PCI_DMA_BURST_MULTIPLE;
259 *strategy_parameter = cacheline_size;
260}
261#endif
262
263extern void
264pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
265 struct resource *res);
266
267extern void
268pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
269 struct pci_bus_region *region);
270
271static inline struct resource *
272pcibios_select_root(struct pci_dev *pdev, struct resource *res)
273{
274 struct resource *root = NULL;
275
276 if (res->flags & IORESOURCE_IO)
277 root = &ioport_resource;
278 if (res->flags & IORESOURCE_MEM)
279 root = &iomem_resource;
280
281 return root;
282}
283
284static inline void pcibios_penalize_isa_irq(int irq, int active)
285{
286 /* We don't need to penalize isa irq's */
287}
288
289static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
290{
291 return channel ? 15 : 14;
292}
293
294#endif /* __ASM_PARISC_PCI_H */
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
deleted file mode 100644
index 9eaa794c3e4a..000000000000
--- a/include/asm-parisc/pdc.h
+++ /dev/null
@@ -1,757 +0,0 @@
1#ifndef _PARISC_PDC_H
2#define _PARISC_PDC_H
3
4/*
5 * PDC return values ...
6 * All PDC calls return a subset of these errors.
7 */
8
9#define PDC_WARN 3 /* Call completed with a warning */
10#define PDC_REQ_ERR_1 2 /* See above */
11#define PDC_REQ_ERR_0 1 /* Call would generate a requestor error */
12#define PDC_OK 0 /* Call completed successfully */
13#define PDC_BAD_PROC -1 /* Called non-existent procedure*/
14#define PDC_BAD_OPTION -2 /* Called with non-existent option */
15#define PDC_ERROR -3 /* Call could not complete without an error */
16#define PDC_NE_MOD -5 /* Module not found */
17#define PDC_NE_CELL_MOD -7 /* Cell module not found */
18#define PDC_INVALID_ARG -10 /* Called with an invalid argument */
19#define PDC_BUS_POW_WARN -12 /* Call could not complete in allowed power budget */
20#define PDC_NOT_NARROW -17 /* Narrow mode not supported */
21
22/*
23 * PDC entry points...
24 */
25
26#define PDC_POW_FAIL 1 /* perform a power-fail */
27#define PDC_POW_FAIL_PREPARE 0 /* prepare for powerfail */
28
29#define PDC_CHASSIS 2 /* PDC-chassis functions */
30#define PDC_CHASSIS_DISP 0 /* update chassis display */
31#define PDC_CHASSIS_WARN 1 /* return chassis warnings */
32#define PDC_CHASSIS_DISPWARN 2 /* update&return chassis status */
33#define PDC_RETURN_CHASSIS_INFO 128 /* HVERSION dependent: return chassis LED/LCD info */
34
35#define PDC_PIM 3 /* Get PIM data */
36#define PDC_PIM_HPMC 0 /* Transfer HPMC data */
37#define PDC_PIM_RETURN_SIZE 1 /* Get Max buffer needed for PIM*/
38#define PDC_PIM_LPMC 2 /* Transfer HPMC data */
39#define PDC_PIM_SOFT_BOOT 3 /* Transfer Soft Boot data */
40#define PDC_PIM_TOC 4 /* Transfer TOC data */
41
42#define PDC_MODEL 4 /* PDC model information call */
43#define PDC_MODEL_INFO 0 /* returns information */
44#define PDC_MODEL_BOOTID 1 /* set the BOOT_ID */
45#define PDC_MODEL_VERSIONS 2 /* returns cpu-internal versions*/
46#define PDC_MODEL_SYSMODEL 3 /* return system model info */
47#define PDC_MODEL_ENSPEC 4 /* enable specific option */
48#define PDC_MODEL_DISPEC 5 /* disable specific option */
49#define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */
50#define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */
51/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
52#define PDC_MODEL_IOPDIR_FDC (1 << 2)
53#define PDC_MODEL_NVA_MASK (3 << 4)
54#define PDC_MODEL_NVA_SUPPORTED (0 << 4)
55#define PDC_MODEL_NVA_SLOW (1 << 4)
56#define PDC_MODEL_NVA_UNSUPPORTED (3 << 4)
57#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */
58#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */
59
60#define PA89_INSTRUCTION_SET 0x4 /* capatibilies returned */
61#define PA90_INSTRUCTION_SET 0x8
62
63#define PDC_CACHE 5 /* return/set cache (& TLB) info*/
64#define PDC_CACHE_INFO 0 /* returns information */
65#define PDC_CACHE_SET_COH 1 /* set coherence state */
66#define PDC_CACHE_RET_SPID 2 /* returns space-ID bits */
67
68#define PDC_HPA 6 /* return HPA of processor */
69#define PDC_HPA_PROCESSOR 0
70#define PDC_HPA_MODULES 1
71
72#define PDC_COPROC 7 /* Co-Processor (usually FP unit(s)) */
73#define PDC_COPROC_CFG 0 /* Co-Processor Cfg (FP unit(s) enabled?) */
74
75#define PDC_IODC 8 /* talk to IODC */
76#define PDC_IODC_READ 0 /* read IODC entry point */
77/* PDC_IODC_RI_ * INDEX parameter of PDC_IODC_READ */
78#define PDC_IODC_RI_DATA_BYTES 0 /* IODC Data Bytes */
79/* 1, 2 obsolete - HVERSION dependent*/
80#define PDC_IODC_RI_INIT 3 /* Initialize module */
81#define PDC_IODC_RI_IO 4 /* Module input/output */
82#define PDC_IODC_RI_SPA 5 /* Module input/output */
83#define PDC_IODC_RI_CONFIG 6 /* Module input/output */
84/* 7 obsolete - HVERSION dependent */
85#define PDC_IODC_RI_TEST 8 /* Module input/output */
86#define PDC_IODC_RI_TLB 9 /* Module input/output */
87#define PDC_IODC_NINIT 2 /* non-destructive init */
88#define PDC_IODC_DINIT 3 /* destructive init */
89#define PDC_IODC_MEMERR 4 /* check for memory errors */
90#define PDC_IODC_INDEX_DATA 0 /* get first 16 bytes from mod IODC */
91#define PDC_IODC_BUS_ERROR -4 /* bus error return value */
92#define PDC_IODC_INVALID_INDEX -5 /* invalid index return value */
93#define PDC_IODC_COUNT -6 /* count is too small */
94
95#define PDC_TOD 9 /* time-of-day clock (TOD) */
96#define PDC_TOD_READ 0 /* read TOD */
97#define PDC_TOD_WRITE 1 /* write TOD */
98
99
100#define PDC_STABLE 10 /* stable storage (sprockets) */
101#define PDC_STABLE_READ 0
102#define PDC_STABLE_WRITE 1
103#define PDC_STABLE_RETURN_SIZE 2
104#define PDC_STABLE_VERIFY_CONTENTS 3
105#define PDC_STABLE_INITIALIZE 4
106
107#define PDC_NVOLATILE 11 /* often not implemented */
108
109#define PDC_ADD_VALID 12 /* Memory validation PDC call */
110#define PDC_ADD_VALID_VERIFY 0 /* Make PDC_ADD_VALID verify region */
111
112#define PDC_INSTR 15 /* get instr to invoke PDCE_CHECK() */
113
114#define PDC_PROC 16 /* (sprockets) */
115
116#define PDC_CONFIG 16 /* (sprockets) */
117#define PDC_CONFIG_DECONFIG 0
118#define PDC_CONFIG_DRECONFIG 1
119#define PDC_CONFIG_DRETURN_CONFIG 2
120
121#define PDC_BLOCK_TLB 18 /* manage hardware block-TLB */
122#define PDC_BTLB_INFO 0 /* returns parameter */
123#define PDC_BTLB_INSERT 1 /* insert BTLB entry */
124#define PDC_BTLB_PURGE 2 /* purge BTLB entries */
125#define PDC_BTLB_PURGE_ALL 3 /* purge all BTLB entries */
126
127#define PDC_TLB 19 /* manage hardware TLB miss handling */
128#define PDC_TLB_INFO 0 /* returns parameter */
129#define PDC_TLB_SETUP 1 /* set up miss handling */
130
131#define PDC_MEM 20 /* Manage memory */
132#define PDC_MEM_MEMINFO 0
133#define PDC_MEM_ADD_PAGE 1
134#define PDC_MEM_CLEAR_PDT 2
135#define PDC_MEM_READ_PDT 3
136#define PDC_MEM_RESET_CLEAR 4
137#define PDC_MEM_GOODMEM 5
138#define PDC_MEM_TABLE 128 /* Non contig mem map (sprockets) */
139#define PDC_MEM_RETURN_ADDRESS_TABLE PDC_MEM_TABLE
140#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES_SIZE 131
141#define PDC_MEM_GET_MEMORY_SYSTEM_TABLES 132
142#define PDC_MEM_GET_PHYSICAL_LOCATION_FROM_MEMORY_ADDRESS 133
143
144#define PDC_MEM_RET_SBE_REPLACED 5 /* PDC_MEM return values */
145#define PDC_MEM_RET_DUPLICATE_ENTRY 4
146#define PDC_MEM_RET_BUF_SIZE_SMALL 1
147#define PDC_MEM_RET_PDT_FULL -11
148#define PDC_MEM_RET_INVALID_PHYSICAL_LOCATION ~0ULL
149
150#define PDC_PSW 21 /* Get/Set default System Mask */
151#define PDC_PSW_MASK 0 /* Return mask */
152#define PDC_PSW_GET_DEFAULTS 1 /* Return defaults */
153#define PDC_PSW_SET_DEFAULTS 2 /* Set default */
154#define PDC_PSW_ENDIAN_BIT 1 /* set for big endian */
155#define PDC_PSW_WIDE_BIT 2 /* set for wide mode */
156
157#define PDC_SYSTEM_MAP 22 /* find system modules */
158#define PDC_FIND_MODULE 0
159#define PDC_FIND_ADDRESS 1
160#define PDC_TRANSLATE_PATH 2
161
162#define PDC_SOFT_POWER 23 /* soft power switch */
163#define PDC_SOFT_POWER_INFO 0 /* return info about the soft power switch */
164#define PDC_SOFT_POWER_ENABLE 1 /* enable/disable soft power switch */
165
166
167/* HVERSION dependent */
168
169/* The PDC_MEM_MAP calls */
170#define PDC_MEM_MAP 128 /* on s700: return page info */
171#define PDC_MEM_MAP_HPA 0 /* returns hpa of a module */
172
173#define PDC_EEPROM 129 /* EEPROM access */
174#define PDC_EEPROM_READ_WORD 0
175#define PDC_EEPROM_WRITE_WORD 1
176#define PDC_EEPROM_READ_BYTE 2
177#define PDC_EEPROM_WRITE_BYTE 3
178#define PDC_EEPROM_EEPROM_PASSWORD -1000
179
180#define PDC_NVM 130 /* NVM (non-volatile memory) access */
181#define PDC_NVM_READ_WORD 0
182#define PDC_NVM_WRITE_WORD 1
183#define PDC_NVM_READ_BYTE 2
184#define PDC_NVM_WRITE_BYTE 3
185
186#define PDC_SEED_ERROR 132 /* (sprockets) */
187
188#define PDC_IO 135 /* log error info, reset IO system */
189#define PDC_IO_READ_AND_CLEAR_ERRORS 0
190#define PDC_IO_RESET 1
191#define PDC_IO_RESET_DEVICES 2
192/* sets bits 6&7 (little endian) of the HcControl Register */
193#define PDC_IO_USB_SUSPEND 0xC000000000000000
194#define PDC_IO_EEPROM_IO_ERR_TABLE_FULL -5 /* return value */
195#define PDC_IO_NO_SUSPEND -6 /* return value */
196
197#define PDC_BROADCAST_RESET 136 /* reset all processors */
198#define PDC_DO_RESET 0 /* option: perform a broadcast reset */
199#define PDC_DO_FIRM_TEST_RESET 1 /* Do broadcast reset with bitmap */
200#define PDC_BR_RECONFIGURATION 2 /* reset w/reconfiguration */
201#define PDC_FIRM_TEST_MAGIC 0xab9ec36fUL /* for this reboot only */
202
203#define PDC_LAN_STATION_ID 138 /* Hversion dependent mechanism for */
204#define PDC_LAN_STATION_ID_READ 0 /* getting the lan station address */
205
206#define PDC_LAN_STATION_ID_SIZE 6
207
208#define PDC_CHECK_RANGES 139 /* (sprockets) */
209
210#define PDC_NV_SECTIONS 141 /* (sprockets) */
211
212#define PDC_PERFORMANCE 142 /* performance monitoring */
213
214#define PDC_SYSTEM_INFO 143 /* system information */
215#define PDC_SYSINFO_RETURN_INFO_SIZE 0
216#define PDC_SYSINFO_RRETURN_SYS_INFO 1
217#define PDC_SYSINFO_RRETURN_ERRORS 2
218#define PDC_SYSINFO_RRETURN_WARNINGS 3
219#define PDC_SYSINFO_RETURN_REVISIONS 4
220#define PDC_SYSINFO_RRETURN_DIAGNOSE 5
221#define PDC_SYSINFO_RRETURN_HV_DIAGNOSE 1005
222
223#define PDC_RDR 144 /* (sprockets) */
224#define PDC_RDR_READ_BUFFER 0
225#define PDC_RDR_READ_SINGLE 1
226#define PDC_RDR_WRITE_SINGLE 2
227
228#define PDC_INTRIGUE 145 /* (sprockets) */
229#define PDC_INTRIGUE_WRITE_BUFFER 0
230#define PDC_INTRIGUE_GET_SCRATCH_BUFSIZE 1
231#define PDC_INTRIGUE_START_CPU_COUNTERS 2
232#define PDC_INTRIGUE_STOP_CPU_COUNTERS 3
233
234#define PDC_STI 146 /* STI access */
235/* same as PDC_PCI_XXX values (see below) */
236
237/* Legacy PDC definitions for same stuff */
238#define PDC_PCI_INDEX 147
239#define PDC_PCI_INTERFACE_INFO 0
240#define PDC_PCI_SLOT_INFO 1
241#define PDC_PCI_INFLIGHT_BYTES 2
242#define PDC_PCI_READ_CONFIG 3
243#define PDC_PCI_WRITE_CONFIG 4
244#define PDC_PCI_READ_PCI_IO 5
245#define PDC_PCI_WRITE_PCI_IO 6
246#define PDC_PCI_READ_CONFIG_DELAY 7
247#define PDC_PCI_UPDATE_CONFIG_DELAY 8
248#define PDC_PCI_PCI_PATH_TO_PCI_HPA 9
249#define PDC_PCI_PCI_HPA_TO_PCI_PATH 10
250#define PDC_PCI_PCI_PATH_TO_PCI_BUS 11
251#define PDC_PCI_PCI_RESERVED 12
252#define PDC_PCI_PCI_INT_ROUTE_SIZE 13
253#define PDC_PCI_GET_INT_TBL_SIZE PDC_PCI_PCI_INT_ROUTE_SIZE
254#define PDC_PCI_PCI_INT_ROUTE 14
255#define PDC_PCI_GET_INT_TBL PDC_PCI_PCI_INT_ROUTE
256#define PDC_PCI_READ_MON_TYPE 15
257#define PDC_PCI_WRITE_MON_TYPE 16
258
259
260/* Get SCSI Interface Card info: SDTR, SCSI ID, mode (SE vs LVD) */
261#define PDC_INITIATOR 163
262#define PDC_GET_INITIATOR 0
263#define PDC_SET_INITIATOR 1
264#define PDC_DELETE_INITIATOR 2
265#define PDC_RETURN_TABLE_SIZE 3
266#define PDC_RETURN_TABLE 4
267
268#define PDC_LINK 165 /* (sprockets) */
269#define PDC_LINK_PCI_ENTRY_POINTS 0 /* list (Arg1) = 0 */
270#define PDC_LINK_USB_ENTRY_POINTS 1 /* list (Arg1) = 1 */
271
272/* cl_class
273 * page 3-33 of IO-Firmware ARS
274 * IODC ENTRY_INIT(Search first) RET[1]
275 */
276#define CL_NULL 0 /* invalid */
277#define CL_RANDOM 1 /* random access (as disk) */
278#define CL_SEQU 2 /* sequential access (as tape) */
279#define CL_DUPLEX 7 /* full-duplex point-to-point (RS-232, Net) */
280#define CL_KEYBD 8 /* half-duplex console (HIL Keyboard) */
281#define CL_DISPL 9 /* half-duplex console (display) */
282#define CL_FC 10 /* FiberChannel access media */
283
284/* IODC ENTRY_INIT() */
285#define ENTRY_INIT_SRCH_FRST 2
286#define ENTRY_INIT_SRCH_NEXT 3
287#define ENTRY_INIT_MOD_DEV 4
288#define ENTRY_INIT_DEV 5
289#define ENTRY_INIT_MOD 6
290#define ENTRY_INIT_MSG 9
291
292/* IODC ENTRY_IO() */
293#define ENTRY_IO_BOOTIN 0
294#define ENTRY_IO_BOOTOUT 1
295#define ENTRY_IO_CIN 2
296#define ENTRY_IO_COUT 3
297#define ENTRY_IO_CLOSE 4
298#define ENTRY_IO_GETMSG 9
299#define ENTRY_IO_BBLOCK_IN 16
300#define ENTRY_IO_BBLOCK_OUT 17
301
302/* IODC ENTRY_SPA() */
303
304/* IODC ENTRY_CONFIG() */
305
306/* IODC ENTRY_TEST() */
307
308/* IODC ENTRY_TLB() */
309
310/* constants for OS (NVM...) */
311#define OS_ID_NONE 0 /* Undefined OS ID */
312#define OS_ID_HPUX 1 /* HP-UX OS */
313#define OS_ID_MPEXL 2 /* MPE XL OS */
314#define OS_ID_OSF 3 /* OSF OS */
315#define OS_ID_HPRT 4 /* HP-RT OS */
316#define OS_ID_NOVEL 5 /* NOVELL OS */
317#define OS_ID_LINUX 6 /* Linux */
318
319
320/* constants for PDC_CHASSIS */
321#define OSTAT_OFF 0
322#define OSTAT_FLT 1
323#define OSTAT_TEST 2
324#define OSTAT_INIT 3
325#define OSTAT_SHUT 4
326#define OSTAT_WARN 5
327#define OSTAT_RUN 6
328#define OSTAT_ON 7
329
330/* Page Zero constant offsets used by the HPMC handler */
331#define BOOT_CONSOLE_HPA_OFFSET 0x3c0
332#define BOOT_CONSOLE_SPA_OFFSET 0x3c4
333#define BOOT_CONSOLE_PATH_OFFSET 0x3a8
334
335#if !defined(__ASSEMBLY__)
336#ifdef __KERNEL__
337
338#include <linux/types.h>
339
340extern int pdc_type;
341
342/* Values for pdc_type */
343#define PDC_TYPE_ILLEGAL -1
344#define PDC_TYPE_PAT 0 /* 64-bit PAT-PDC */
345#define PDC_TYPE_SYSTEM_MAP 1 /* 32-bit, but supports PDC_SYSTEM_MAP */
346#define PDC_TYPE_SNAKE 2 /* Doesn't support SYSTEM_MAP */
347
348struct pdc_chassis_info { /* for PDC_CHASSIS_INFO */
349 unsigned long actcnt; /* actual number of bytes returned */
350 unsigned long maxcnt; /* maximum number of bytes that could be returned */
351};
352
353struct pdc_coproc_cfg { /* for PDC_COPROC_CFG */
354 unsigned long ccr_functional;
355 unsigned long ccr_present;
356 unsigned long revision;
357 unsigned long model;
358};
359
360struct pdc_model { /* for PDC_MODEL */
361 unsigned long hversion;
362 unsigned long sversion;
363 unsigned long hw_id;
364 unsigned long boot_id;
365 unsigned long sw_id;
366 unsigned long sw_cap;
367 unsigned long arch_rev;
368 unsigned long pot_key;
369 unsigned long curr_key;
370};
371
372struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
373 unsigned long
374#ifdef CONFIG_64BIT
375 cc_padW:32,
376#endif
377 cc_alias: 4, /* alias boundaries for virtual addresses */
378 cc_block: 4, /* to determine most efficient stride */
379 cc_line : 3, /* maximum amount written back as a result of store (multiple of 16 bytes) */
380 cc_shift: 2, /* how much to shift cc_block left */
381 cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */
382 cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */
383 cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */
384 cc_pad1 : 10, /* reserved */
385 cc_hv : 3; /* hversion dependent */
386};
387
388struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */
389 unsigned long tc_pad0:12, /* reserved */
390#ifdef CONFIG_64BIT
391 tc_padW:32,
392#endif
393 tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */
394 tc_hv : 1, /* HV */
395 tc_page : 1, /* 0 = 2K page-size-machine, 1 = 4k page size */
396 tc_cst : 3, /* 0 = incoherent operations, else coherent operations */
397 tc_aid : 5, /* ITLB: width of access ids of processor (encoded!) */
398 tc_pad1 : 8; /* ITLB: width of space-registers (encoded) */
399};
400
401struct pdc_cache_info { /* main-PDC_CACHE-structure (caches & TLB's) */
402 /* I-cache */
403 unsigned long ic_size; /* size in bytes */
404 struct pdc_cache_cf ic_conf; /* configuration */
405 unsigned long ic_base; /* base-addr */
406 unsigned long ic_stride;
407 unsigned long ic_count;
408 unsigned long ic_loop;
409 /* D-cache */
410 unsigned long dc_size; /* size in bytes */
411 struct pdc_cache_cf dc_conf; /* configuration */
412 unsigned long dc_base; /* base-addr */
413 unsigned long dc_stride;
414 unsigned long dc_count;
415 unsigned long dc_loop;
416 /* Instruction-TLB */
417 unsigned long it_size; /* number of entries in I-TLB */
418 struct pdc_tlb_cf it_conf; /* I-TLB-configuration */
419 unsigned long it_sp_base;
420 unsigned long it_sp_stride;
421 unsigned long it_sp_count;
422 unsigned long it_off_base;
423 unsigned long it_off_stride;
424 unsigned long it_off_count;
425 unsigned long it_loop;
426 /* data-TLB */
427 unsigned long dt_size; /* number of entries in D-TLB */
428 struct pdc_tlb_cf dt_conf; /* D-TLB-configuration */
429 unsigned long dt_sp_base;
430 unsigned long dt_sp_stride;
431 unsigned long dt_sp_count;
432 unsigned long dt_off_base;
433 unsigned long dt_off_stride;
434 unsigned long dt_off_count;
435 unsigned long dt_loop;
436};
437
438#if 0
439/* If you start using the next struct, you'll have to adjust it to
440 * work with 64-bit firmware I think -PB
441 */
442struct pdc_iodc { /* PDC_IODC */
443 unsigned char hversion_model;
444 unsigned char hversion;
445 unsigned char spa;
446 unsigned char type;
447 unsigned int sversion_rev:4;
448 unsigned int sversion_model:19;
449 unsigned int sversion_opt:8;
450 unsigned char rev;
451 unsigned char dep;
452 unsigned char features;
453 unsigned char pad1;
454 unsigned int checksum:16;
455 unsigned int length:16;
456 unsigned int pad[15];
457} __attribute__((aligned(8))) ;
458#endif
459
460#ifndef CONFIG_PA20
461/* no BLTBs in pa2.0 processors */
462struct pdc_btlb_info_range {
463 __u8 res00;
464 __u8 num_i;
465 __u8 num_d;
466 __u8 num_comb;
467};
468
469struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */
470 unsigned int min_size; /* minimum size of BTLB in pages */
471 unsigned int max_size; /* maximum size of BTLB in pages */
472 struct pdc_btlb_info_range fixed_range_info;
473 struct pdc_btlb_info_range variable_range_info;
474};
475
476#endif /* !CONFIG_PA20 */
477
478#ifdef CONFIG_64BIT
479struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */
480 unsigned long entries_returned;
481 unsigned long entries_total;
482};
483
484struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */
485 unsigned long paddr;
486 unsigned int pages;
487 unsigned int reserved;
488};
489#endif /* CONFIG_64BIT */
490
491struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
492 unsigned long mod_addr;
493 unsigned long mod_pgs;
494 unsigned long add_addrs;
495};
496
497struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */
498 unsigned long mod_addr;
499 unsigned long mod_pgs;
500};
501
502struct pdc_initiator { /* PDC_INITIATOR */
503 int host_id;
504 int factor;
505 int width;
506 int mode;
507};
508
509struct hardware_path {
510 char flags; /* see bit definitions below */
511 char bc[6]; /* Bus Converter routing info to a specific */
512 /* I/O adaptor (< 0 means none, > 63 resvd) */
513 char mod; /* fixed field of specified module */
514};
515
516/*
517 * Device path specifications used by PDC.
518 */
519struct pdc_module_path {
520 struct hardware_path path;
521 unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
522};
523
524#ifndef CONFIG_PA20
525/* Only used on some pre-PA2.0 boxes */
526struct pdc_memory_map { /* PDC_MEMORY_MAP */
527 unsigned long hpa; /* mod's register set address */
528 unsigned long more_pgs; /* number of additional I/O pgs */
529};
530#endif
531
532struct pdc_tod {
533 unsigned long tod_sec;
534 unsigned long tod_usec;
535};
536
537/* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */
538
539struct pdc_hpmc_pim_11 { /* PDC_PIM */
540 __u32 gr[32];
541 __u32 cr[32];
542 __u32 sr[8];
543 __u32 iasq_back;
544 __u32 iaoq_back;
545 __u32 check_type;
546 __u32 cpu_state;
547 __u32 rsvd1;
548 __u32 cache_check;
549 __u32 tlb_check;
550 __u32 bus_check;
551 __u32 assists_check;
552 __u32 rsvd2;
553 __u32 assist_state;
554 __u32 responder_addr;
555 __u32 requestor_addr;
556 __u32 path_info;
557 __u64 fr[32];
558};
559
560/*
561 * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine
562 *
563 * Note that PDC_PIM doesn't care whether or not wide mode was enabled
564 * so the results are different on PA1.1 vs. PA2.0 when in narrow mode.
565 *
566 * Note also that there are unarchitected results available, which
567 * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since
568 * the firmware is probably the best way of printing hversion dependent
569 * data.
570 */
571
572struct pdc_hpmc_pim_20 { /* PDC_PIM */
573 __u64 gr[32];
574 __u64 cr[32];
575 __u64 sr[8];
576 __u64 iasq_back;
577 __u64 iaoq_back;
578 __u32 check_type;
579 __u32 cpu_state;
580 __u32 cache_check;
581 __u32 tlb_check;
582 __u32 bus_check;
583 __u32 assists_check;
584 __u32 assist_state;
585 __u32 path_info;
586 __u64 responder_addr;
587 __u64 requestor_addr;
588 __u64 fr[32];
589};
590
591void pdc_console_init(void); /* in pdc_console.c */
592void pdc_console_restart(void);
593
594void setup_pdc(void); /* in inventory.c */
595
596/* wrapper-functions from pdc.c */
597
598int pdc_add_valid(unsigned long address);
599int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
600int pdc_chassis_disp(unsigned long disp);
601int pdc_chassis_warn(unsigned long *warn);
602int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
603int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
604 void *iodc_data, unsigned int iodc_data_size);
605int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
606 struct pdc_module_path *mod_path, long mod_index);
607int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
608 long mod_index, long addr_index);
609int pdc_model_info(struct pdc_model *model);
610int pdc_model_sysmodel(char *name);
611int pdc_model_cpuid(unsigned long *cpu_id);
612int pdc_model_versions(unsigned long *versions, int id);
613int pdc_model_capabilities(unsigned long *capabilities);
614int pdc_cache_info(struct pdc_cache_info *cache);
615int pdc_spaceid_bits(unsigned long *space_bits);
616#ifndef CONFIG_PA20
617int pdc_btlb_info(struct pdc_btlb_info *btlb);
618int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
619#endif /* !CONFIG_PA20 */
620int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
621
622int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);
623int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count);
624int pdc_stable_get_size(unsigned long *size);
625int pdc_stable_verify_contents(void);
626int pdc_stable_initialize(void);
627
628int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
629int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
630
631int pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
632int pdc_tod_read(struct pdc_tod *tod);
633int pdc_tod_set(unsigned long sec, unsigned long usec);
634
635#ifdef CONFIG_64BIT
636int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
637 struct pdc_memory_table *tbl, unsigned long entries);
638#endif
639
640void set_firmware_width(void);
641int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
642int pdc_do_reset(void);
643int pdc_soft_power_info(unsigned long *power_reg);
644int pdc_soft_power_button(int sw_control);
645void pdc_io_reset(void);
646void pdc_io_reset_devices(void);
647int pdc_iodc_getc(void);
648int pdc_iodc_print(const unsigned char *str, unsigned count);
649
650void pdc_emergency_unlock(void);
651int pdc_sti_call(unsigned long func, unsigned long flags,
652 unsigned long inptr, unsigned long outputr,
653 unsigned long glob_cfg);
654
655static inline char * os_id_to_string(u16 os_id) {
656 switch(os_id) {
657 case OS_ID_NONE: return "No OS";
658 case OS_ID_HPUX: return "HP-UX";
659 case OS_ID_MPEXL: return "MPE-iX";
660 case OS_ID_OSF: return "OSF";
661 case OS_ID_HPRT: return "HP-RT";
662 case OS_ID_NOVEL: return "Novell Netware";
663 case OS_ID_LINUX: return "Linux";
664 default: return "Unknown";
665 }
666}
667
668#endif /* __KERNEL__ */
669
670#define PAGE0 ((struct zeropage *)__PAGE_OFFSET)
671
672/* DEFINITION OF THE ZERO-PAGE (PAG0) */
673/* based on work by Jason Eckhardt (jason@equator.com) */
674
675/* flags of the device_path */
676#define PF_AUTOBOOT 0x80
677#define PF_AUTOSEARCH 0x40
678#define PF_TIMER 0x0F
679
680struct device_path { /* page 1-69 */
681 unsigned char flags; /* flags see above! */
682 unsigned char bc[6]; /* bus converter routing info */
683 unsigned char mod;
684 unsigned int layers[6];/* device-specific layer-info */
685} __attribute__((aligned(8))) ;
686
687struct pz_device {
688 struct device_path dp; /* see above */
689 /* struct iomod *hpa; */
690 unsigned int hpa; /* HPA base address */
691 /* char *spa; */
692 unsigned int spa; /* SPA base address */
693 /* int (*iodc_io)(struct iomod*, ...); */
694 unsigned int iodc_io; /* device entry point */
695 short pad; /* reserved */
696 unsigned short cl_class;/* see below */
697} __attribute__((aligned(8))) ;
698
699struct zeropage {
700 /* [0x000] initialize vectors (VEC) */
701 unsigned int vec_special; /* must be zero */
702 /* int (*vec_pow_fail)(void);*/
703 unsigned int vec_pow_fail; /* power failure handler */
704 /* int (*vec_toc)(void); */
705 unsigned int vec_toc;
706 unsigned int vec_toclen;
707 /* int (*vec_rendz)(void); */
708 unsigned int vec_rendz;
709 int vec_pow_fail_flen;
710 int vec_pad[10];
711
712 /* [0x040] reserved processor dependent */
713 int pad0[112];
714
715 /* [0x200] reserved */
716 int pad1[84];
717
718 /* [0x350] memory configuration (MC) */
719 int memc_cont; /* contiguous mem size (bytes) */
720 int memc_phsize; /* physical memory size */
721 int memc_adsize; /* additional mem size, bytes of SPA space used by PDC */
722 unsigned int mem_pdc_hi; /* used for 64-bit */
723
724 /* [0x360] various parameters for the boot-CPU */
725 /* unsigned int *mem_booterr[8]; */
726 unsigned int mem_booterr[8]; /* ptr to boot errors */
727 unsigned int mem_free; /* first location, where OS can be loaded */
728 /* struct iomod *mem_hpa; */
729 unsigned int mem_hpa; /* HPA of the boot-CPU */
730 /* int (*mem_pdc)(int, ...); */
731 unsigned int mem_pdc; /* PDC entry point */
732 unsigned int mem_10msec; /* number of clock ticks in 10msec */
733
734 /* [0x390] initial memory module (IMM) */
735 /* struct iomod *imm_hpa; */
736 unsigned int imm_hpa; /* HPA of the IMM */
737 int imm_soft_boot; /* 0 = was hard boot, 1 = was soft boot */
738 unsigned int imm_spa_size; /* SPA size of the IMM in bytes */
739 unsigned int imm_max_mem; /* bytes of mem in IMM */
740
741 /* [0x3A0] boot console, display device and keyboard */
742 struct pz_device mem_cons; /* description of console device */
743 struct pz_device mem_boot; /* description of boot device */
744 struct pz_device mem_kbd; /* description of keyboard device */
745
746 /* [0x430] reserved */
747 int pad430[116];
748
749 /* [0x600] processor dependent */
750 __u32 pad600[1];
751 __u32 proc_sti; /* pointer to STI ROM */
752 __u32 pad608[126];
753};
754
755#endif /* !defined(__ASSEMBLY__) */
756
757#endif /* _PARISC_PDC_H */
diff --git a/include/asm-parisc/pdc_chassis.h b/include/asm-parisc/pdc_chassis.h
deleted file mode 100644
index a609273dc6bf..000000000000
--- a/include/asm-parisc/pdc_chassis.h
+++ /dev/null
@@ -1,381 +0,0 @@
1/*
2 * include/asm-parisc/pdc_chassis.h
3 *
4 * Copyright (C) 2002 Laurent Canet <canetl@esiee.fr>
5 * Copyright (C) 2002 Thibaut Varene <varenet@parisc-linux.org>
6 *
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * TODO: - handle processor number on SMP systems (Reporting Entity ID)
22 * - handle message ID
23 * - handle timestamps
24 */
25
26
27#ifndef _PARISC_PDC_CHASSIS_H
28#define _PARISC_PDC_CHASSIS_H
29
30/*
31 * ----------
32 * Prototypes
33 * ----------
34 */
35
36int pdc_chassis_send_status(int message);
37void parisc_pdc_chassis_init(void);
38
39
40/*
41 * -----------------
42 * Direct call names
43 * -----------------
44 * They setup everything for you, the Log message and the corresponding LED state
45 */
46
47#define PDC_CHASSIS_DIRECT_BSTART 0
48#define PDC_CHASSIS_DIRECT_BCOMPLETE 1
49#define PDC_CHASSIS_DIRECT_SHUTDOWN 2
50#define PDC_CHASSIS_DIRECT_PANIC 3
51#define PDC_CHASSIS_DIRECT_HPMC 4
52#define PDC_CHASSIS_DIRECT_LPMC 5
53#define PDC_CHASSIS_DIRECT_DUMP 6 /* not yet implemented */
54#define PDC_CHASSIS_DIRECT_OOPS 7 /* not yet implemented */
55
56
57/*
58 * ------------
59 * LEDs control
60 * ------------
61 * Set the three LEDs -- Run, Attn, and Fault.
62 */
63
64/* Old PDC LED control */
65#define PDC_CHASSIS_DISP_DATA(v) ((unsigned long)(v) << 17)
66
67/*
68 * Available PDC PAT LED states
69 */
70
71#define PDC_CHASSIS_LED_RUN_OFF (0ULL << 4)
72#define PDC_CHASSIS_LED_RUN_FLASH (1ULL << 4)
73#define PDC_CHASSIS_LED_RUN_ON (2ULL << 4)
74#define PDC_CHASSIS_LED_RUN_NC (3ULL << 4)
75#define PDC_CHASSIS_LED_ATTN_OFF (0ULL << 6)
76#define PDC_CHASSIS_LED_ATTN_FLASH (1ULL << 6)
77#define PDC_CHASSIS_LED_ATTN_NC (3ULL << 6) /* ATTN ON is invalid */
78#define PDC_CHASSIS_LED_FAULT_OFF (0ULL << 8)
79#define PDC_CHASSIS_LED_FAULT_FLASH (1ULL << 8)
80#define PDC_CHASSIS_LED_FAULT_ON (2ULL << 8)
81#define PDC_CHASSIS_LED_FAULT_NC (3ULL << 8)
82#define PDC_CHASSIS_LED_VALID (1ULL << 10)
83
84/*
85 * Valid PDC PAT LED states combinations
86 */
87
88/* System running normally */
89#define PDC_CHASSIS_LSTATE_RUN_NORMAL (PDC_CHASSIS_LED_RUN_ON | \
90 PDC_CHASSIS_LED_ATTN_OFF | \
91 PDC_CHASSIS_LED_FAULT_OFF | \
92 PDC_CHASSIS_LED_VALID )
93/* System crashed and rebooted itself successfully */
94#define PDC_CHASSIS_LSTATE_RUN_CRASHREC (PDC_CHASSIS_LED_RUN_ON | \
95 PDC_CHASSIS_LED_ATTN_OFF | \
96 PDC_CHASSIS_LED_FAULT_FLASH | \
97 PDC_CHASSIS_LED_VALID )
98/* There was a system interruption that did not take the system down */
99#define PDC_CHASSIS_LSTATE_RUN_SYSINT (PDC_CHASSIS_LED_RUN_ON | \
100 PDC_CHASSIS_LED_ATTN_FLASH | \
101 PDC_CHASSIS_LED_FAULT_OFF | \
102 PDC_CHASSIS_LED_VALID )
103/* System running and unexpected reboot or non-critical error detected */
104#define PDC_CHASSIS_LSTATE_RUN_NCRIT (PDC_CHASSIS_LED_RUN_ON | \
105 PDC_CHASSIS_LED_ATTN_FLASH | \
106 PDC_CHASSIS_LED_FAULT_FLASH | \
107 PDC_CHASSIS_LED_VALID )
108/* Executing non-OS code */
109#define PDC_CHASSIS_LSTATE_NONOS (PDC_CHASSIS_LED_RUN_FLASH | \
110 PDC_CHASSIS_LED_ATTN_OFF | \
111 PDC_CHASSIS_LED_FAULT_OFF | \
112 PDC_CHASSIS_LED_VALID )
113/* Boot failed - Executing non-OS code */
114#define PDC_CHASSIS_LSTATE_NONOS_BFAIL (PDC_CHASSIS_LED_RUN_FLASH | \
115 PDC_CHASSIS_LED_ATTN_OFF | \
116 PDC_CHASSIS_LED_FAULT_ON | \
117 PDC_CHASSIS_LED_VALID )
118/* Unexpected reboot occurred - Executing non-OS code */
119#define PDC_CHASSIS_LSTATE_NONOS_UNEXP (PDC_CHASSIS_LED_RUN_FLASH | \
120 PDC_CHASSIS_LED_ATTN_OFF | \
121 PDC_CHASSIS_LED_FAULT_FLASH | \
122 PDC_CHASSIS_LED_VALID )
123/* Executing non-OS code - Non-critical error detected */
124#define PDC_CHASSIS_LSTATE_NONOS_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
125 PDC_CHASSIS_LED_ATTN_FLASH | \
126 PDC_CHASSIS_LED_FAULT_OFF | \
127 PDC_CHASSIS_LED_VALID )
128/* Boot failed - Executing non-OS code - Non-critical error detected */
129#define PDC_CHASSIS_LSTATE_BFAIL_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
130 PDC_CHASSIS_LED_ATTN_FLASH | \
131 PDC_CHASSIS_LED_FAULT_ON | \
132 PDC_CHASSIS_LED_VALID )
133/* Unexpected reboot/recovering - Executing non-OS code - Non-critical error detected */
134#define PDC_CHASSIS_LSTATE_UNEXP_NCRIT (PDC_CHASSIS_LED_RUN_FLASH | \
135 PDC_CHASSIS_LED_ATTN_FLASH | \
136 PDC_CHASSIS_LED_FAULT_FLASH | \
137 PDC_CHASSIS_LED_VALID )
138/* Cannot execute PDC */
139#define PDC_CHASSIS_LSTATE_CANNOT_PDC (PDC_CHASSIS_LED_RUN_OFF | \
140 PDC_CHASSIS_LED_ATTN_OFF | \
141 PDC_CHASSIS_LED_FAULT_OFF | \
142 PDC_CHASSIS_LED_VALID )
143/* Boot failed - OS not up - PDC has detected a failure that prevents boot */
144#define PDC_CHASSIS_LSTATE_FATAL_BFAIL (PDC_CHASSIS_LED_RUN_OFF | \
145 PDC_CHASSIS_LED_ATTN_OFF | \
146 PDC_CHASSIS_LED_FAULT_ON | \
147 PDC_CHASSIS_LED_VALID )
148/* No code running - Non-critical error detected (double fault situation) */
149#define PDC_CHASSIS_LSTATE_NOCODE_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
150 PDC_CHASSIS_LED_ATTN_FLASH | \
151 PDC_CHASSIS_LED_FAULT_OFF | \
152 PDC_CHASSIS_LED_VALID )
153/* Boot failed - OS not up - Fatal failure detected - Non-critical error detected */
154#define PDC_CHASSIS_LSTATE_FATAL_NCRIT (PDC_CHASSIS_LED_RUN_OFF | \
155 PDC_CHASSIS_LED_ATTN_FLASH | \
156 PDC_CHASSIS_LED_FAULT_ON | \
157 PDC_CHASSIS_LED_VALID )
158/* All other states are invalid */
159
160
161/*
162 * --------------
163 * PDC Log events
164 * --------------
165 * Here follows bits needed to fill up the log event sent to PDC_CHASSIS
166 * The log message contains: Alert level, Source, Source detail,
167 * Source ID, Problem detail, Caller activity, Activity status,
168 * Caller subactivity, Reporting entity type, Reporting entity ID,
169 * Data type, Unique message ID and EOM.
170 */
171
172/* Alert level */
173#define PDC_CHASSIS_ALERT_FORWARD (0ULL << 36) /* no failure detected */
174#define PDC_CHASSIS_ALERT_SERPROC (1ULL << 36) /* service proc - no failure */
175#define PDC_CHASSIS_ALERT_NURGENT (2ULL << 36) /* non-urgent operator attn */
176#define PDC_CHASSIS_ALERT_BLOCKED (3ULL << 36) /* system blocked */
177#define PDC_CHASSIS_ALERT_CONF_CHG (4ULL << 36) /* unexpected configuration change */
178#define PDC_CHASSIS_ALERT_ENV_PB (5ULL << 36) /* boot possible, environmental pb */
179#define PDC_CHASSIS_ALERT_PENDING (6ULL << 36) /* boot possible, pending failure */
180#define PDC_CHASSIS_ALERT_PERF_IMP (8ULL << 36) /* boot possible, performance impaired */
181#define PDC_CHASSIS_ALERT_FUNC_IMP (10ULL << 36) /* boot possible, functionality impaired */
182#define PDC_CHASSIS_ALERT_SOFT_FAIL (12ULL << 36) /* software failure */
183#define PDC_CHASSIS_ALERT_HANG (13ULL << 36) /* system hang */
184#define PDC_CHASSIS_ALERT_ENV_FATAL (14ULL << 36) /* fatal power or environmental pb */
185#define PDC_CHASSIS_ALERT_HW_FATAL (15ULL << 36) /* fatal hardware problem */
186
187/* Source */
188#define PDC_CHASSIS_SRC_NONE (0ULL << 28) /* unknown, no source stated */
189#define PDC_CHASSIS_SRC_PROC (1ULL << 28) /* processor */
190/* For later use ? */
191#define PDC_CHASSIS_SRC_PROC_CACHE (2ULL << 28) /* processor cache*/
192#define PDC_CHASSIS_SRC_PDH (3ULL << 28) /* processor dependent hardware */
193#define PDC_CHASSIS_SRC_PWR (4ULL << 28) /* power */
194#define PDC_CHASSIS_SRC_FAB (5ULL << 28) /* fabric connector */
195#define PDC_CHASSIS_SRC_PLATi (6ULL << 28) /* platform */
196#define PDC_CHASSIS_SRC_MEM (7ULL << 28) /* memory */
197#define PDC_CHASSIS_SRC_IO (8ULL << 28) /* I/O */
198#define PDC_CHASSIS_SRC_CELL (9ULL << 28) /* cell */
199#define PDC_CHASSIS_SRC_PD (10ULL << 28) /* protected domain */
200
201/* Source detail field */
202#define PDC_CHASSIS_SRC_D_PROC (1ULL << 24) /* processor general */
203
204/* Source ID - platform dependent */
205#define PDC_CHASSIS_SRC_ID_UNSPEC (0ULL << 16)
206
207/* Problem detail - problem source dependent */
208#define PDC_CHASSIS_PB_D_PROC_NONE (0ULL << 32) /* no problem detail */
209#define PDC_CHASSIS_PB_D_PROC_TIMEOUT (4ULL << 32) /* timeout */
210
211/* Caller activity */
212#define PDC_CHASSIS_CALL_ACT_HPUX_BL (7ULL << 12) /* Boot Loader */
213#define PDC_CHASSIS_CALL_ACT_HPUX_PD (8ULL << 12) /* SAL_PD activities */
214#define PDC_CHASSIS_CALL_ACT_HPUX_EVENT (9ULL << 12) /* SAL_EVENTS activities */
215#define PDC_CHASSIS_CALL_ACT_HPUX_IO (10ULL << 12) /* SAL_IO activities */
216#define PDC_CHASSIS_CALL_ACT_HPUX_PANIC (11ULL << 12) /* System panic */
217#define PDC_CHASSIS_CALL_ACT_HPUX_INIT (12ULL << 12) /* System initialization */
218#define PDC_CHASSIS_CALL_ACT_HPUX_SHUT (13ULL << 12) /* System shutdown */
219#define PDC_CHASSIS_CALL_ACT_HPUX_WARN (14ULL << 12) /* System warning */
220#define PDC_CHASSIS_CALL_ACT_HPUX_DU (15ULL << 12) /* Display_Activity() update */
221
222/* Activity status - implementation dependent */
223#define PDC_CHASSIS_ACT_STATUS_UNSPEC (0ULL << 0)
224
225/* Caller subactivity - implementation dependent */
226/* FIXME: other subactivities ? */
227#define PDC_CHASSIS_CALL_SACT_UNSPEC (0ULL << 4) /* implementation dependent */
228
229/* Reporting entity type */
230#define PDC_CHASSIS_RET_GENERICOS (12ULL << 52) /* generic OSes */
231#define PDC_CHASSIS_RET_IA64_NT (13ULL << 52) /* IA-64 NT */
232#define PDC_CHASSIS_RET_HPUX (14ULL << 52) /* HP-UX */
233#define PDC_CHASSIS_RET_DIAG (15ULL << 52) /* offline diagnostics & utilities */
234
235/* Reporting entity ID */
236#define PDC_CHASSIS_REID_UNSPEC (0ULL << 44)
237
238/* Data type */
239#define PDC_CHASSIS_DT_NONE (0ULL << 59) /* data field unused */
240/* For later use ? Do we need these ? */
241#define PDC_CHASSIS_DT_PHYS_ADDR (1ULL << 59) /* physical address */
242#define PDC_CHASSIS_DT_DATA_EXPECT (2ULL << 59) /* expected data */
243#define PDC_CHASSIS_DT_ACTUAL (3ULL << 59) /* actual data */
244#define PDC_CHASSIS_DT_PHYS_LOC (4ULL << 59) /* physical location */
245#define PDC_CHASSIS_DT_PHYS_LOC_EXT (5ULL << 59) /* physical location extension */
246#define PDC_CHASSIS_DT_TAG (6ULL << 59) /* tag */
247#define PDC_CHASSIS_DT_SYNDROME (7ULL << 59) /* syndrome */
248#define PDC_CHASSIS_DT_CODE_ADDR (8ULL << 59) /* code address */
249#define PDC_CHASSIS_DT_ASCII_MSG (9ULL << 59) /* ascii message */
250#define PDC_CHASSIS_DT_POST (10ULL << 59) /* POST code */
251#define PDC_CHASSIS_DT_TIMESTAMP (11ULL << 59) /* timestamp */
252#define PDC_CHASSIS_DT_DEV_STAT (12ULL << 59) /* device status */
253#define PDC_CHASSIS_DT_DEV_TYPE (13ULL << 59) /* device type */
254#define PDC_CHASSIS_DT_PB_DET (14ULL << 59) /* problem detail */
255#define PDC_CHASSIS_DT_ACT_LEV (15ULL << 59) /* activity level/timeout */
256#define PDC_CHASSIS_DT_SER_NUM (16ULL << 59) /* serial number */
257#define PDC_CHASSIS_DT_REV_NUM (17ULL << 59) /* revision number */
258#define PDC_CHASSIS_DT_INTERRUPT (18ULL << 59) /* interruption information */
259#define PDC_CHASSIS_DT_TEST_NUM (19ULL << 59) /* test number */
260#define PDC_CHASSIS_DT_STATE_CHG (20ULL << 59) /* major changes in system state */
261#define PDC_CHASSIS_DT_PROC_DEALLOC (21ULL << 59) /* processor deallocate */
262#define PDC_CHASSIS_DT_RESET (30ULL << 59) /* reset type and cause */
263#define PDC_CHASSIS_DT_PA_LEGACY (31ULL << 59) /* legacy PA hex chassis code */
264
265/* System states - part of major changes in system state data field */
266#define PDC_CHASSIS_SYSTATE_BSTART (0ULL << 0) /* boot start */
267#define PDC_CHASSIS_SYSTATE_BCOMP (1ULL << 0) /* boot complete */
268#define PDC_CHASSIS_SYSTATE_CHANGE (2ULL << 0) /* major change */
269#define PDC_CHASSIS_SYSTATE_LED (3ULL << 0) /* LED change */
270#define PDC_CHASSIS_SYSTATE_PANIC (9ULL << 0) /* OS Panic */
271#define PDC_CHASSIS_SYSTATE_DUMP (10ULL << 0) /* memory dump */
272#define PDC_CHASSIS_SYSTATE_HPMC (11ULL << 0) /* processing HPMC */
273#define PDC_CHASSIS_SYSTATE_HALT (15ULL << 0) /* system halted */
274
275/* Message ID */
276#define PDC_CHASSIS_MSG_ID (0ULL << 40) /* we do not handle msg IDs atm */
277
278/* EOM - separates log entries */
279#define PDC_CHASSIS_EOM_CLEAR (0ULL << 43)
280#define PDC_CHASSIS_EOM_SET (1ULL << 43)
281
282/*
283 * Preformated well known messages
284 */
285
286/* Boot started */
287#define PDC_CHASSIS_PMSG_BSTART (PDC_CHASSIS_ALERT_SERPROC | \
288 PDC_CHASSIS_SRC_PROC | \
289 PDC_CHASSIS_SRC_D_PROC | \
290 PDC_CHASSIS_SRC_ID_UNSPEC | \
291 PDC_CHASSIS_PB_D_PROC_NONE | \
292 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
293 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
294 PDC_CHASSIS_CALL_SACT_UNSPEC | \
295 PDC_CHASSIS_RET_HPUX | \
296 PDC_CHASSIS_REID_UNSPEC | \
297 PDC_CHASSIS_DT_STATE_CHG | \
298 PDC_CHASSIS_SYSTATE_BSTART | \
299 PDC_CHASSIS_MSG_ID | \
300 PDC_CHASSIS_EOM_SET )
301
302/* Boot complete */
303#define PDC_CHASSIS_PMSG_BCOMPLETE (PDC_CHASSIS_ALERT_SERPROC | \
304 PDC_CHASSIS_SRC_PROC | \
305 PDC_CHASSIS_SRC_D_PROC | \
306 PDC_CHASSIS_SRC_ID_UNSPEC | \
307 PDC_CHASSIS_PB_D_PROC_NONE | \
308 PDC_CHASSIS_CALL_ACT_HPUX_INIT | \
309 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
310 PDC_CHASSIS_CALL_SACT_UNSPEC | \
311 PDC_CHASSIS_RET_HPUX | \
312 PDC_CHASSIS_REID_UNSPEC | \
313 PDC_CHASSIS_DT_STATE_CHG | \
314 PDC_CHASSIS_SYSTATE_BCOMP | \
315 PDC_CHASSIS_MSG_ID | \
316 PDC_CHASSIS_EOM_SET )
317
318/* Shutdown */
319#define PDC_CHASSIS_PMSG_SHUTDOWN (PDC_CHASSIS_ALERT_SERPROC | \
320 PDC_CHASSIS_SRC_PROC | \
321 PDC_CHASSIS_SRC_D_PROC | \
322 PDC_CHASSIS_SRC_ID_UNSPEC | \
323 PDC_CHASSIS_PB_D_PROC_NONE | \
324 PDC_CHASSIS_CALL_ACT_HPUX_SHUT | \
325 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
326 PDC_CHASSIS_CALL_SACT_UNSPEC | \
327 PDC_CHASSIS_RET_HPUX | \
328 PDC_CHASSIS_REID_UNSPEC | \
329 PDC_CHASSIS_DT_STATE_CHG | \
330 PDC_CHASSIS_SYSTATE_HALT | \
331 PDC_CHASSIS_MSG_ID | \
332 PDC_CHASSIS_EOM_SET )
333
334/* Panic */
335#define PDC_CHASSIS_PMSG_PANIC (PDC_CHASSIS_ALERT_SOFT_FAIL | \
336 PDC_CHASSIS_SRC_PROC | \
337 PDC_CHASSIS_SRC_D_PROC | \
338 PDC_CHASSIS_SRC_ID_UNSPEC | \
339 PDC_CHASSIS_PB_D_PROC_NONE | \
340 PDC_CHASSIS_CALL_ACT_HPUX_PANIC| \
341 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
342 PDC_CHASSIS_CALL_SACT_UNSPEC | \
343 PDC_CHASSIS_RET_HPUX | \
344 PDC_CHASSIS_REID_UNSPEC | \
345 PDC_CHASSIS_DT_STATE_CHG | \
346 PDC_CHASSIS_SYSTATE_PANIC | \
347 PDC_CHASSIS_MSG_ID | \
348 PDC_CHASSIS_EOM_SET )
349
350// FIXME: extrapolated data
351/* HPMC */
352#define PDC_CHASSIS_PMSG_HPMC (PDC_CHASSIS_ALERT_CONF_CHG /*?*/ | \
353 PDC_CHASSIS_SRC_PROC | \
354 PDC_CHASSIS_SRC_D_PROC | \
355 PDC_CHASSIS_SRC_ID_UNSPEC | \
356 PDC_CHASSIS_PB_D_PROC_NONE | \
357 PDC_CHASSIS_CALL_ACT_HPUX_WARN | \
358 PDC_CHASSIS_RET_HPUX | \
359 PDC_CHASSIS_DT_STATE_CHG | \
360 PDC_CHASSIS_SYSTATE_HPMC | \
361 PDC_CHASSIS_MSG_ID | \
362 PDC_CHASSIS_EOM_SET )
363
364/* LPMC */
365#define PDC_CHASSIS_PMSG_LPMC (PDC_CHASSIS_ALERT_BLOCKED /*?*/| \
366 PDC_CHASSIS_SRC_PROC | \
367 PDC_CHASSIS_SRC_D_PROC | \
368 PDC_CHASSIS_SRC_ID_UNSPEC | \
369 PDC_CHASSIS_PB_D_PROC_NONE | \
370 PDC_CHASSIS_CALL_ACT_HPUX_WARN | \
371 PDC_CHASSIS_ACT_STATUS_UNSPEC | \
372 PDC_CHASSIS_CALL_SACT_UNSPEC | \
373 PDC_CHASSIS_RET_HPUX | \
374 PDC_CHASSIS_REID_UNSPEC | \
375 PDC_CHASSIS_DT_STATE_CHG | \
376 PDC_CHASSIS_SYSTATE_CHANGE | \
377 PDC_CHASSIS_MSG_ID | \
378 PDC_CHASSIS_EOM_SET )
379
380#endif /* _PARISC_PDC_CHASSIS_H */
381/* vim: set ts=8 */
diff --git a/include/asm-parisc/pdcpat.h b/include/asm-parisc/pdcpat.h
deleted file mode 100644
index 47539f117958..000000000000
--- a/include/asm-parisc/pdcpat.h
+++ /dev/null
@@ -1,308 +0,0 @@
1#ifndef __PARISC_PATPDC_H
2#define __PARISC_PATPDC_H
3
4/*
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
7 * for more details.
8 *
9 * Copyright 2000 (c) Hewlett Packard (Paul Bame <bame()spam.parisc-linux.org>)
10 * Copyright 2000,2004 (c) Grant Grundler <grundler()nahspam.parisc-linux.org>
11 */
12
13
14#define PDC_PAT_CELL 64L /* Interface for gaining and
15 * manipulatin g cell state within PD */
16#define PDC_PAT_CELL_GET_NUMBER 0L /* Return Cell number */
17#define PDC_PAT_CELL_GET_INFO 1L /* Returns info about Cell */
18#define PDC_PAT_CELL_MODULE 2L /* Returns info about Module */
19#define PDC_PAT_CELL_SET_ATTENTION 9L /* Set Cell Attention indicator */
20#define PDC_PAT_CELL_NUMBER_TO_LOC 10L /* Cell Number -> Location */
21#define PDC_PAT_CELL_WALK_FABRIC 11L /* Walk the Fabric */
22#define PDC_PAT_CELL_GET_RDT_SIZE 12L /* Return Route Distance Table Sizes */
23#define PDC_PAT_CELL_GET_RDT 13L /* Return Route Distance Tables */
24#define PDC_PAT_CELL_GET_LOCAL_PDH_SZ 14L /* Read Local PDH Buffer Size */
25#define PDC_PAT_CELL_SET_LOCAL_PDH 15L /* Write Local PDH Buffer */
26#define PDC_PAT_CELL_GET_REMOTE_PDH_SZ 16L /* Return Remote PDH Buffer Size */
27#define PDC_PAT_CELL_GET_REMOTE_PDH 17L /* Read Remote PDH Buffer */
28#define PDC_PAT_CELL_GET_DBG_INFO 128L /* Return DBG Buffer Info */
29#define PDC_PAT_CELL_CHANGE_ALIAS 129L /* Change Non-Equivalent Alias Chacking */
30
31
32/*
33** Arg to PDC_PAT_CELL_MODULE memaddr[4]
34**
35** Addresses on the Merced Bus != all Runway Bus addresses.
36** This is intended for programming SBA/LBA chips range registers.
37*/
38#define IO_VIEW 0UL
39#define PA_VIEW 1UL
40
41/* PDC_PAT_CELL_MODULE entity type values */
42#define PAT_ENTITY_CA 0 /* central agent */
43#define PAT_ENTITY_PROC 1 /* processor */
44#define PAT_ENTITY_MEM 2 /* memory controller */
45#define PAT_ENTITY_SBA 3 /* system bus adapter */
46#define PAT_ENTITY_LBA 4 /* local bus adapter */
47#define PAT_ENTITY_PBC 5 /* processor bus converter */
48#define PAT_ENTITY_XBC 6 /* crossbar fabric connect */
49#define PAT_ENTITY_RC 7 /* fabric interconnect */
50
51/* PDC_PAT_CELL_MODULE address range type values */
52#define PAT_PBNUM 0 /* PCI Bus Number */
53#define PAT_LMMIO 1 /* < 4G MMIO Space */
54#define PAT_GMMIO 2 /* > 4G MMIO Space */
55#define PAT_NPIOP 3 /* Non Postable I/O Port Space */
56#define PAT_PIOP 4 /* Postable I/O Port Space */
57#define PAT_AHPA 5 /* Addional HPA Space */
58#define PAT_UFO 6 /* HPA Space (UFO for Mariposa) */
59#define PAT_GNIP 7 /* GNI Reserved Space */
60
61
62
63/* PDC PAT CHASSIS LOG -- Platform logging & forward progress functions */
64
65#define PDC_PAT_CHASSIS_LOG 65L
66#define PDC_PAT_CHASSIS_WRITE_LOG 0L /* Write Log Entry */
67#define PDC_PAT_CHASSIS_READ_LOG 1L /* Read Log Entry */
68
69
70/* PDC PAT CPU -- CPU configuration within the protection domain */
71
72#define PDC_PAT_CPU 67L
73#define PDC_PAT_CPU_INFO 0L /* Return CPU config info */
74#define PDC_PAT_CPU_DELETE 1L /* Delete CPU */
75#define PDC_PAT_CPU_ADD 2L /* Add CPU */
76#define PDC_PAT_CPU_GET_NUMBER 3L /* Return CPU Number */
77#define PDC_PAT_CPU_GET_HPA 4L /* Return CPU HPA */
78#define PDC_PAT_CPU_STOP 5L /* Stop CPU */
79#define PDC_PAT_CPU_RENDEZVOUS 6L /* Rendezvous CPU */
80#define PDC_PAT_CPU_GET_CLOCK_INFO 7L /* Return CPU Clock info */
81#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
82#define PDC_PAT_CPU_PLUNGE_FABRIC 128L /* Plunge Fabric */
83#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache
84 * Cleansing Mode */
85/* PDC PAT EVENT -- Platform Events */
86
87#define PDC_PAT_EVENT 68L
88#define PDC_PAT_EVENT_GET_CAPS 0L /* Get Capabilities */
89#define PDC_PAT_EVENT_SET_MODE 1L /* Set Notification Mode */
90#define PDC_PAT_EVENT_SCAN 2L /* Scan Event */
91#define PDC_PAT_EVENT_HANDLE 3L /* Handle Event */
92#define PDC_PAT_EVENT_GET_NB_CALL 4L /* Get Non-Blocking call Args */
93
94/* PDC PAT HPMC -- Cause processor to go into spin loop, and wait
95 * for wake up from Monarch Processor.
96 */
97
98#define PDC_PAT_HPMC 70L
99#define PDC_PAT_HPMC_RENDEZ_CPU 0L /* go into spin loop */
100#define PDC_PAT_HPMC_SET_PARAMS 1L /* Allows OS to specify intr which PDC
101 * will use to interrupt OS during
102 * machine check rendezvous */
103
104/* parameters for PDC_PAT_HPMC_SET_PARAMS: */
105#define HPMC_SET_PARAMS_INTR 1L /* Rendezvous Interrupt */
106#define HPMC_SET_PARAMS_WAKE 2L /* Wake up processor */
107
108
109/* PDC PAT IO -- On-line services for I/O modules */
110
111#define PDC_PAT_IO 71L
112#define PDC_PAT_IO_GET_SLOT_STATUS 5L /* Get Slot Status Info*/
113#define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */
114 /* Hardware Path */
115#define PDC_PAT_IO_GET_HARDWARE_FROM_LOC 7L /* Get Hardware Path from
116 * Physical Location */
117#define PDC_PAT_IO_GET_PCI_CONFIG_FROM_HW 11L /* Get PCI Configuration
118 * Address from Hardware Path */
119#define PDC_PAT_IO_GET_HW_FROM_PCI_CONFIG 12L /* Get Hardware Path
120 * from PCI Configuration Address */
121#define PDC_PAT_IO_READ_HOST_BRIDGE_INFO 13L /* Read Host Bridge State Info */
122#define PDC_PAT_IO_CLEAR_HOST_BRIDGE_INFO 14L /* Clear Host Bridge State Info*/
123#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE 15L /* Get PCI INT Routing Table
124 * Size */
125#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE 16L /* Get PCI INT Routing Table */
126#define PDC_PAT_IO_GET_HINT_TABLE_SIZE 17L /* Get Hint Table Size */
127#define PDC_PAT_IO_GET_HINT_TABLE 18L /* Get Hint Table */
128#define PDC_PAT_IO_PCI_CONFIG_READ 19L /* PCI Config Read */
129#define PDC_PAT_IO_PCI_CONFIG_WRITE 20L /* PCI Config Write */
130#define PDC_PAT_IO_GET_NUM_IO_SLOTS 21L /* Get Number of I/O Bay Slots in
131 * Cabinet */
132#define PDC_PAT_IO_GET_LOC_IO_SLOTS 22L /* Get Physical Location of I/O */
133 /* Bay Slots in Cabinet */
134#define PDC_PAT_IO_BAY_STATUS_INFO 28L /* Get I/O Bay Slot Status Info */
135#define PDC_PAT_IO_GET_PROC_VIEW 29L /* Get Processor view of IO address */
136#define PDC_PAT_IO_PROG_SBA_DIR_RANGE 30L /* Program directed range */
137
138
139/* PDC PAT MEM -- Manage memory page deallocation */
140
141#define PDC_PAT_MEM 72L
142#define PDC_PAT_MEM_PD_INFO 0L /* Return PDT info for PD */
143#define PDC_PAT_MEM_PD_CLEAR 1L /* Clear PDT for PD */
144#define PDC_PAT_MEM_PD_READ 2L /* Read PDT entries for PD */
145#define PDC_PAT_MEM_PD_RESET 3L /* Reset clear bit for PD */
146#define PDC_PAT_MEM_CELL_INFO 5L /* Return PDT info For Cell */
147#define PDC_PAT_MEM_CELL_CLEAR 6L /* Clear PDT For Cell */
148#define PDC_PAT_MEM_CELL_READ 7L /* Read PDT entries For Cell */
149#define PDC_PAT_MEM_CELL_RESET 8L /* Reset clear bit For Cell */
150#define PDC_PAT_MEM_SETGM 9L /* Set Golden Memory value */
151#define PDC_PAT_MEM_ADD_PAGE 10L /* ADDs a page to the cell */
152#define PDC_PAT_MEM_ADDRESS 11L /* Get Physical Location From */
153 /* Memory Address */
154#define PDC_PAT_MEM_GET_TXT_SIZE 12L /* Get Formatted Text Size */
155#define PDC_PAT_MEM_GET_PD_TXT 13L /* Get PD Formatted Text */
156#define PDC_PAT_MEM_GET_CELL_TXT 14L /* Get Cell Formatted Text */
157#define PDC_PAT_MEM_RD_STATE_INFO 15L /* Read Mem Module State Info*/
158#define PDC_PAT_MEM_CLR_STATE_INFO 16L /*Clear Mem Module State Info*/
159#define PDC_PAT_MEM_CLEAN_RANGE 128L /*Clean Mem in specific range*/
160#define PDC_PAT_MEM_GET_TBL_SIZE 131L /* Get Memory Table Size */
161#define PDC_PAT_MEM_GET_TBL 132L /* Get Memory Table */
162
163
164/* PDC PAT NVOLATILE -- Access Non-Volatile Memory */
165
166#define PDC_PAT_NVOLATILE 73L
167#define PDC_PAT_NVOLATILE_READ 0L /* Read Non-Volatile Memory */
168#define PDC_PAT_NVOLATILE_WRITE 1L /* Write Non-Volatile Memory */
169#define PDC_PAT_NVOLATILE_GET_SIZE 2L /* Return size of NVM */
170#define PDC_PAT_NVOLATILE_VERIFY 3L /* Verify contents of NVM */
171#define PDC_PAT_NVOLATILE_INIT 4L /* Initialize NVM */
172
173/* PDC PAT PD */
174#define PDC_PAT_PD 74L /* Protection Domain Info */
175#define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */
176
177/* PDC_PAT_PD_GET_ADDR_MAP entry types */
178#define PAT_MEMORY_DESCRIPTOR 1
179
180/* PDC_PAT_PD_GET_ADDR_MAP memory types */
181#define PAT_MEMTYPE_MEMORY 0
182#define PAT_MEMTYPE_FIRMWARE 4
183
184/* PDC_PAT_PD_GET_ADDR_MAP memory usage */
185#define PAT_MEMUSE_GENERAL 0
186#define PAT_MEMUSE_GI 128
187#define PAT_MEMUSE_GNI 129
188
189
190#ifndef __ASSEMBLY__
191#include <linux/types.h>
192
193#ifdef CONFIG_64BIT
194#define is_pdc_pat() (PDC_TYPE_PAT == pdc_type)
195extern int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num);
196extern int pdc_pat_get_irt(void *r_addr, unsigned long cell_num);
197#else /* ! CONFIG_64BIT */
198/* No PAT support for 32-bit kernels...sorry */
199#define is_pdc_pat() (0)
200#define pdc_pat_get_irt_size(num_entries, cell_numn) PDC_BAD_PROC
201#define pdc_pat_get_irt(r_addr, cell_num) PDC_BAD_PROC
202#endif /* ! CONFIG_64BIT */
203
204
205struct pdc_pat_cell_num {
206 unsigned long cell_num;
207 unsigned long cell_loc;
208};
209
210struct pdc_pat_cpu_num {
211 unsigned long cpu_num;
212 unsigned long cpu_loc;
213};
214
215struct pdc_pat_pd_addr_map_entry {
216 unsigned char entry_type; /* 1 = Memory Descriptor Entry Type */
217 unsigned char reserve1[5];
218 unsigned char memory_type;
219 unsigned char memory_usage;
220 unsigned long paddr;
221 unsigned int pages; /* Length in 4K pages */
222 unsigned int reserve2;
223 unsigned long cell_map;
224};
225
226/********************************************************************
227* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
228* ----------------------------------------------------------
229* Bit 0 to 51 - conf_base_addr
230* Bit 52 to 62 - reserved
231* Bit 63 - endianess bit
232********************************************************************/
233#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
234
235/********************************************************************
236* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
237* ----------------------------------------------------
238* Bit 0 to 7 - entity type
239* 0 = central agent, 1 = processor,
240* 2 = memory controller, 3 = system bus adapter,
241* 4 = local bus adapter, 5 = processor bus converter,
242* 6 = crossbar fabric connect, 7 = fabric interconnect,
243* 8 to 254 reserved, 255 = unknown.
244* Bit 8 to 15 - DVI
245* Bit 16 to 23 - IOC functions
246* Bit 24 to 39 - reserved
247* Bit 40 to 63 - mod_pages
248* number of 4K pages a module occupies starting at conf_base_addr
249********************************************************************/
250#define PAT_GET_ENTITY(value) (((value) >> 56) & 0xffUL)
251#define PAT_GET_DVI(value) (((value) >> 48) & 0xffUL)
252#define PAT_GET_IOC(value) (((value) >> 40) & 0xffUL)
253#define PAT_GET_MOD_PAGES(value) ((value) & 0xffffffUL)
254
255
256/*
257** PDC_PAT_CELL_GET_INFO return block
258*/
259typedef struct pdc_pat_cell_info_rtn_block {
260 unsigned long cpu_info;
261 unsigned long cell_info;
262 unsigned long cell_location;
263 unsigned long reo_location;
264 unsigned long mem_size;
265 unsigned long dimm_status;
266 unsigned long pdc_rev;
267 unsigned long fabric_info0;
268 unsigned long fabric_info1;
269 unsigned long fabric_info2;
270 unsigned long fabric_info3;
271 unsigned long reserved[21];
272} pdc_pat_cell_info_rtn_block_t;
273
274
275/* FIXME: mod[508] should really be a union of the various mod components */
276struct pdc_pat_cell_mod_maddr_block { /* PDC_PAT_CELL_MODULE */
277 unsigned long cba; /* func 0 cfg space address */
278 unsigned long mod_info; /* module information */
279 unsigned long mod_location; /* physical location of the module */
280 struct hardware_path mod_path; /* module path (device path - layers) */
281 unsigned long mod[508]; /* PAT cell module components */
282} __attribute__((aligned(8))) ;
283
284typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
285
286
287extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
288extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
289extern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long mod, unsigned long view_type, void *mem_addr);
290extern int pdc_pat_cell_num_to_loc(void *, unsigned long);
291
292extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
293
294extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset);
295
296
297extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
298extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
299
300
301/* Flag to indicate this is a PAT box...don't use this unless you
302** really have to...it might go away some day.
303*/
304extern int pdc_pat; /* arch/parisc/kernel/inventory.c */
305
306#endif /* __ASSEMBLY__ */
307
308#endif /* ! __PARISC_PATPDC_H */
diff --git a/include/asm-parisc/percpu.h b/include/asm-parisc/percpu.h
deleted file mode 100644
index a0dcd1970128..000000000000
--- a/include/asm-parisc/percpu.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _PARISC_PERCPU_H
2#define _PARISC_PERCPU_H
3
4#include <asm-generic/percpu.h>
5
6#endif
7
diff --git a/include/asm-parisc/perf.h b/include/asm-parisc/perf.h
deleted file mode 100644
index a18e11972c09..000000000000
--- a/include/asm-parisc/perf.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef _ASM_PERF_H_
2#define _ASM_PERF_H_
3
4/* ioctls */
5#define PA_PERF_ON _IO('p', 1)
6#define PA_PERF_OFF _IOR('p', 2, unsigned int)
7#define PA_PERF_VERSION _IOR('p', 3, int)
8
9#define PA_PERF_DEV "perf"
10#define PA_PERF_MINOR 146
11
12/* Interface types */
13#define UNKNOWN_INTF 255
14#define ONYX_INTF 0
15#define CUDA_INTF 1
16
17/* Common Onyx and Cuda images */
18#define CPI 0
19#define BUSUTIL 1
20#define TLBMISS 2
21#define TLBHANDMISS 3
22#define PTKN 4
23#define PNTKN 5
24#define IMISS 6
25#define DMISS 7
26#define DMISS_ACCESS 8
27#define BIG_CPI 9
28#define BIG_LS 10
29#define BR_ABORT 11
30#define ISNT 12
31#define QUADRANT 13
32#define RW_PDFET 14
33#define RW_WDFET 15
34#define SHLIB_CPI 16
35
36/* Cuda only Images */
37#define FLOPS 17
38#define CACHEMISS 18
39#define BRANCHES 19
40#define CRSTACK 20
41#define I_CACHE_SPEC 21
42#define MAX_CUDA_IMAGES 22
43
44/* Onyx only Images */
45#define ADDR_INV_ABORT_ALU 17
46#define BRAD_STALL 18
47#define CNTL_IN_PIPEL 19
48#define DSNT_XFH 20
49#define FET_SIG1 21
50#define FET_SIG2 22
51#define G7_1 23
52#define G7_2 24
53#define G7_3 25
54#define G7_4 26
55#define MPB_LABORT 27
56#define PANIC 28
57#define RARE_INST 29
58#define RW_DFET 30
59#define RW_IFET 31
60#define RW_SDFET 32
61#define SPEC_IFET 33
62#define ST_COND0 34
63#define ST_COND1 35
64#define ST_COND2 36
65#define ST_COND3 37
66#define ST_COND4 38
67#define ST_UNPRED0 39
68#define ST_UNPRED1 40
69#define UNPRED 41
70#define GO_STORE 42
71#define SHLIB_CALL 43
72#define MAX_ONYX_IMAGES 44
73
74#endif
diff --git a/include/asm-parisc/pgalloc.h b/include/asm-parisc/pgalloc.h
deleted file mode 100644
index fc987a1c12a8..000000000000
--- a/include/asm-parisc/pgalloc.h
+++ /dev/null
@@ -1,149 +0,0 @@
1#ifndef _ASM_PGALLOC_H
2#define _ASM_PGALLOC_H
3
4#include <linux/gfp.h>
5#include <linux/mm.h>
6#include <linux/threads.h>
7#include <asm/processor.h>
8#include <asm/fixmap.h>
9
10#include <asm/cache.h>
11
12/* Allocate the top level pgd (page directory)
13 *
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
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 64-bit
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
20 * kernel for machines with under 4GB of memory) */
21static inline pgd_t *pgd_alloc(struct mm_struct *mm)
22{
23 pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL,
24 PGD_ALLOC_ORDER);
25 pgd_t *actual_pgd = pgd;
26
27 if (likely(pgd != NULL)) {
28 memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
29#ifdef CONFIG_64BIT
30 actual_pgd += PTRS_PER_PGD;
31 /* Populate first pmd with allocated memory. We mark it
32 * with PxD_FLAG_ATTACHED as a signal to the system that this
33 * pmd entry may not be cleared. */
34 __pgd_val_set(*actual_pgd, (PxD_FLAG_PRESENT |
35 PxD_FLAG_VALID |
36 PxD_FLAG_ATTACHED)
37 + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));
38 /* The first pmd entry also is marked with _PAGE_GATEWAY as
39 * a signal that this pmd may not be freed */
40 __pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
41#endif
42 }
43 return actual_pgd;
44}
45
46static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
47{
48#ifdef CONFIG_64BIT
49 pgd -= PTRS_PER_PGD;
50#endif
51 free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
52}
53
54#if PT_NLEVELS == 3
55
56/* Three Level Page Table Support for pmd's */
57
58static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
59{
60 __pgd_val_set(*pgd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID) +
61 (__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT));
62}
63
64static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
65{
66 pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT,
67 PMD_ORDER);
68 if (pmd)
69 memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
70 return pmd;
71}
72
73static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
74{
75#ifdef CONFIG_64BIT
76 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
77 /* This is the permanent pmd attached to the pgd;
78 * cannot free it */
79 return;
80#endif
81 free_pages((unsigned long)pmd, PMD_ORDER);
82}
83
84#else
85
86/* Two Level Page Table Support for pmd's */
87
88/*
89 * allocating and freeing a pmd is trivial: the 1-entry pmd is
90 * inside the pgd, so has no extra memory associated with it.
91 */
92
93#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
94#define pmd_free(mm, x) do { } while (0)
95#define pgd_populate(mm, pmd, pte) BUG()
96
97#endif
98
99static inline void
100pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
101{
102#ifdef CONFIG_64BIT
103 /* preserve the gateway marker if this is the beginning of
104 * the permanent pmd */
105 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
106 __pmd_val_set(*pmd, (PxD_FLAG_PRESENT |
107 PxD_FLAG_VALID |
108 PxD_FLAG_ATTACHED)
109 + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
110 else
111#endif
112 __pmd_val_set(*pmd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID)
113 + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
114}
115
116#define pmd_populate(mm, pmd, pte_page) \
117 pmd_populate_kernel(mm, pmd, page_address(pte_page))
118#define pmd_pgtable(pmd) pmd_page(pmd)
119
120static inline pgtable_t
121pte_alloc_one(struct mm_struct *mm, unsigned long address)
122{
123 struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
124 if (page)
125 pgtable_page_ctor(page);
126 return page;
127}
128
129static inline pte_t *
130pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
131{
132 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
133 return pte;
134}
135
136static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
137{
138 free_page((unsigned long)pte);
139}
140
141static inline void pte_free(struct mm_struct *mm, struct page *pte)
142{
143 pgtable_page_dtor(pte);
144 pte_free_kernel(mm, page_address(pte));
145}
146
147#define check_pgt_cache() do { } while (0)
148
149#endif
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
deleted file mode 100644
index 470a4b88124d..000000000000
--- a/include/asm-parisc/pgtable.h
+++ /dev/null
@@ -1,508 +0,0 @@
1#ifndef _PARISC_PGTABLE_H
2#define _PARISC_PGTABLE_H
3
4#include <asm-generic/4level-fixup.h>
5
6#include <asm/fixmap.h>
7
8#ifndef __ASSEMBLY__
9/*
10 * we simulate an x86-style page table for the linux mm code
11 */
12
13#include <linux/mm.h> /* for vm_area_struct */
14#include <linux/bitops.h>
15#include <asm/processor.h>
16#include <asm/cache.h>
17
18/*
19 * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
20 * memory. For the return value to be meaningful, ADDR must be >=
21 * PAGE_OFFSET. This operation can be relatively expensive (e.g.,
22 * require a hash-, or multi-level tree-lookup or something of that
23 * sort) but it guarantees to return TRUE only if accessing the page
24 * at that address does not cause an error. Note that there may be
25 * addresses for which kern_addr_valid() returns FALSE even though an
26 * access would not cause an error (e.g., this is typically true for
27 * memory mapped I/O regions.
28 *
29 * XXX Need to implement this for parisc.
30 */
31#define kern_addr_valid(addr) (1)
32
33/* Certain architectures need to do special things when PTEs
34 * within a page table are directly modified. Thus, the following
35 * hook is made available.
36 */
37#define set_pte(pteptr, pteval) \
38 do{ \
39 *(pteptr) = (pteval); \
40 } while(0)
41#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
42
43#endif /* !__ASSEMBLY__ */
44
45#define pte_ERROR(e) \
46 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
47#define pmd_ERROR(e) \
48 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, (unsigned long)pmd_val(e))
49#define pgd_ERROR(e) \
50 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
51
52/* This is the size of the initially mapped kernel memory */
53#ifdef CONFIG_64BIT
54#define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */
55#else
56#define KERNEL_INITIAL_ORDER 23 /* 0 to 1<<23 = 8MB */
57#endif
58#define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
59
60#if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB)
61#define PT_NLEVELS 3
62#define PGD_ORDER 1 /* Number of pages per pgd */
63#define PMD_ORDER 1 /* Number of pages per pmd */
64#define PGD_ALLOC_ORDER 2 /* first pgd contains pmd */
65#else
66#define PT_NLEVELS 2
67#define PGD_ORDER 1 /* Number of pages per pgd */
68#define PGD_ALLOC_ORDER PGD_ORDER
69#endif
70
71/* Definitions for 3rd level (we use PLD here for Page Lower directory
72 * because PTE_SHIFT is used lower down to mean shift that has to be
73 * done to get usable bits out of the PTE) */
74#define PLD_SHIFT PAGE_SHIFT
75#define PLD_SIZE PAGE_SIZE
76#define BITS_PER_PTE (PAGE_SHIFT - BITS_PER_PTE_ENTRY)
77#define PTRS_PER_PTE (1UL << BITS_PER_PTE)
78
79/* Definitions for 2nd level */
80#define pgtable_cache_init() do { } while (0)
81
82#define PMD_SHIFT (PLD_SHIFT + BITS_PER_PTE)
83#define PMD_SIZE (1UL << PMD_SHIFT)
84#define PMD_MASK (~(PMD_SIZE-1))
85#if PT_NLEVELS == 3
86#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)
87#else
88#define BITS_PER_PMD 0
89#endif
90#define PTRS_PER_PMD (1UL << BITS_PER_PMD)
91
92/* Definitions for 1st level */
93#define PGDIR_SHIFT (PMD_SHIFT + BITS_PER_PMD)
94#define BITS_PER_PGD (PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY)
95#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
96#define PGDIR_MASK (~(PGDIR_SIZE-1))
97#define PTRS_PER_PGD (1UL << BITS_PER_PGD)
98#define USER_PTRS_PER_PGD PTRS_PER_PGD
99
100#define MAX_ADDRBITS (PGDIR_SHIFT + BITS_PER_PGD)
101#define MAX_ADDRESS (1UL << MAX_ADDRBITS)
102
103#define SPACEID_SHIFT (MAX_ADDRBITS - 32)
104
105/* This calculates the number of initial pages we need for the initial
106 * page tables */
107#if (KERNEL_INITIAL_ORDER) >= (PMD_SHIFT)
108# define PT_INITIAL (1 << (KERNEL_INITIAL_ORDER - PMD_SHIFT))
109#else
110# define PT_INITIAL (1) /* all initial PTEs fit into one page */
111#endif
112
113/*
114 * pgd entries used up by user/kernel:
115 */
116
117#define FIRST_USER_ADDRESS 0
118
119/* NB: The tlb miss handlers make certain assumptions about the order */
120/* of the following bits, so be careful (One example, bits 25-31 */
121/* are moved together in one instruction). */
122
123#define _PAGE_READ_BIT 31 /* (0x001) read access allowed */
124#define _PAGE_WRITE_BIT 30 /* (0x002) write access allowed */
125#define _PAGE_EXEC_BIT 29 /* (0x004) execute access allowed */
126#define _PAGE_GATEWAY_BIT 28 /* (0x008) privilege promotion allowed */
127#define _PAGE_DMB_BIT 27 /* (0x010) Data Memory Break enable (B bit) */
128#define _PAGE_DIRTY_BIT 26 /* (0x020) Page Dirty (D bit) */
129#define _PAGE_FILE_BIT _PAGE_DIRTY_BIT /* overload this bit */
130#define _PAGE_REFTRAP_BIT 25 /* (0x040) Page Ref. Trap enable (T bit) */
131#define _PAGE_NO_CACHE_BIT 24 /* (0x080) Uncached Page (U bit) */
132#define _PAGE_ACCESSED_BIT 23 /* (0x100) Software: Page Accessed */
133#define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */
134#define _PAGE_FLUSH_BIT 21 /* (0x400) Software: translation valid */
135 /* for cache flushing only */
136#define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */
137
138/* N.B. The bits are defined in terms of a 32 bit word above, so the */
139/* following macro is ok for both 32 and 64 bit. */
140
141#define xlate_pabit(x) (31 - x)
142
143/* this defines the shift to the usable bits in the PTE it is set so
144 * that the valid bits _PAGE_PRESENT_BIT and _PAGE_USER_BIT are set
145 * to zero */
146#define PTE_SHIFT xlate_pabit(_PAGE_USER_BIT)
147
148/* PFN_PTE_SHIFT defines the shift of a PTE value to access the PFN field */
149#define PFN_PTE_SHIFT 12
150
151
152/* this is how many bits may be used by the file functions */
153#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT)
154
155#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT)
156#define pgoff_to_pte(off) ((pte_t) { ((off) << PTE_SHIFT) | _PAGE_FILE })
157
158#define _PAGE_READ (1 << xlate_pabit(_PAGE_READ_BIT))
159#define _PAGE_WRITE (1 << xlate_pabit(_PAGE_WRITE_BIT))
160#define _PAGE_RW (_PAGE_READ | _PAGE_WRITE)
161#define _PAGE_EXEC (1 << xlate_pabit(_PAGE_EXEC_BIT))
162#define _PAGE_GATEWAY (1 << xlate_pabit(_PAGE_GATEWAY_BIT))
163#define _PAGE_DMB (1 << xlate_pabit(_PAGE_DMB_BIT))
164#define _PAGE_DIRTY (1 << xlate_pabit(_PAGE_DIRTY_BIT))
165#define _PAGE_REFTRAP (1 << xlate_pabit(_PAGE_REFTRAP_BIT))
166#define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
167#define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
168#define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT))
169#define _PAGE_FLUSH (1 << xlate_pabit(_PAGE_FLUSH_BIT))
170#define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT))
171#define _PAGE_FILE (1 << xlate_pabit(_PAGE_FILE_BIT))
172
173#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
174#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
175#define _PAGE_KERNEL (_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
176
177/* The pgd/pmd contains a ptr (in phys addr space); since all pgds/pmds
178 * are page-aligned, we don't care about the PAGE_OFFSET bits, except
179 * for a few meta-information bits, so we shift the address to be
180 * able to effectively address 40/42/44-bits of physical address space
181 * depending on 4k/16k/64k PAGE_SIZE */
182#define _PxD_PRESENT_BIT 31
183#define _PxD_ATTACHED_BIT 30
184#define _PxD_VALID_BIT 29
185
186#define PxD_FLAG_PRESENT (1 << xlate_pabit(_PxD_PRESENT_BIT))
187#define PxD_FLAG_ATTACHED (1 << xlate_pabit(_PxD_ATTACHED_BIT))
188#define PxD_FLAG_VALID (1 << xlate_pabit(_PxD_VALID_BIT))
189#define PxD_FLAG_MASK (0xf)
190#define PxD_FLAG_SHIFT (4)
191#define PxD_VALUE_SHIFT (8) /* (PAGE_SHIFT-PxD_FLAG_SHIFT) */
192
193#ifndef __ASSEMBLY__
194
195#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
196#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_WRITE | _PAGE_ACCESSED)
197/* Others seem to make this executable, I don't know if that's correct
198 or not. The stack is mapped this way though so this is necessary
199 in the short term - dhd@linuxcare.com, 2000-08-08 */
200#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_ACCESSED)
201#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_WRITE | _PAGE_ACCESSED)
202#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_EXEC |_PAGE_ACCESSED)
203#define PAGE_COPY PAGE_EXECREAD
204#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_READ | _PAGE_WRITE | _PAGE_EXEC |_PAGE_ACCESSED)
205#define PAGE_KERNEL __pgprot(_PAGE_KERNEL)
206#define PAGE_KERNEL_RO __pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)
207#define PAGE_KERNEL_UNC __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
208#define PAGE_GATEWAY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_GATEWAY| _PAGE_READ)
209#define PAGE_FLUSH __pgprot(_PAGE_FLUSH)
210
211
212/*
213 * We could have an execute only page using "gateway - promote to priv
214 * level 3", but that is kind of silly. So, the way things are defined
215 * now, we must always have read permission for pages with execute
216 * permission. For the fun of it we'll go ahead and support write only
217 * pages.
218 */
219
220 /*xwr*/
221#define __P000 PAGE_NONE
222#define __P001 PAGE_READONLY
223#define __P010 __P000 /* copy on write */
224#define __P011 __P001 /* copy on write */
225#define __P100 PAGE_EXECREAD
226#define __P101 PAGE_EXECREAD
227#define __P110 __P100 /* copy on write */
228#define __P111 __P101 /* copy on write */
229
230#define __S000 PAGE_NONE
231#define __S001 PAGE_READONLY
232#define __S010 PAGE_WRITEONLY
233#define __S011 PAGE_SHARED
234#define __S100 PAGE_EXECREAD
235#define __S101 PAGE_EXECREAD
236#define __S110 PAGE_RWX
237#define __S111 PAGE_RWX
238
239
240extern pgd_t swapper_pg_dir[]; /* declared in init_task.c */
241
242/* initial page tables for 0-8MB for kernel */
243
244extern pte_t pg0[];
245
246/* zero page used for uninitialized stuff */
247
248extern unsigned long *empty_zero_page;
249
250/*
251 * ZERO_PAGE is a global shared page that is always zero: used
252 * for zero-mapped memory areas etc..
253 */
254
255#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
256
257#define pte_none(x) ((pte_val(x) == 0) || (pte_val(x) & _PAGE_FLUSH))
258#define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
259#define pte_clear(mm,addr,xp) do { pte_val(*(xp)) = 0; } while (0)
260
261#define pmd_flag(x) (pmd_val(x) & PxD_FLAG_MASK)
262#define pmd_address(x) ((unsigned long)(pmd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
263#define pgd_flag(x) (pgd_val(x) & PxD_FLAG_MASK)
264#define pgd_address(x) ((unsigned long)(pgd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
265
266#if PT_NLEVELS == 3
267/* The first entry of the permanent pmd is not there if it contains
268 * the gateway marker */
269#define pmd_none(x) (!pmd_val(x) || pmd_flag(x) == PxD_FLAG_ATTACHED)
270#else
271#define pmd_none(x) (!pmd_val(x))
272#endif
273#define pmd_bad(x) (!(pmd_flag(x) & PxD_FLAG_VALID))
274#define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT)
275static inline void pmd_clear(pmd_t *pmd) {
276#if PT_NLEVELS == 3
277 if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
278 /* This is the entry pointing to the permanent pmd
279 * attached to the pgd; cannot clear it */
280 __pmd_val_set(*pmd, PxD_FLAG_ATTACHED);
281 else
282#endif
283 __pmd_val_set(*pmd, 0);
284}
285
286
287
288#if PT_NLEVELS == 3
289#define pgd_page_vaddr(pgd) ((unsigned long) __va(pgd_address(pgd)))
290#define pgd_page(pgd) virt_to_page((void *)pgd_page_vaddr(pgd))
291
292/* For 64 bit we have three level tables */
293
294#define pgd_none(x) (!pgd_val(x))
295#define pgd_bad(x) (!(pgd_flag(x) & PxD_FLAG_VALID))
296#define pgd_present(x) (pgd_flag(x) & PxD_FLAG_PRESENT)
297static inline void pgd_clear(pgd_t *pgd) {
298#if PT_NLEVELS == 3
299 if(pgd_flag(*pgd) & PxD_FLAG_ATTACHED)
300 /* This is the permanent pmd attached to the pgd; cannot
301 * free it */
302 return;
303#endif
304 __pgd_val_set(*pgd, 0);
305}
306#else
307/*
308 * The "pgd_xxx()" functions here are trivial for a folded two-level
309 * setup: the pgd is never bad, and a pmd always exists (as it's folded
310 * into the pgd entry)
311 */
312static inline int pgd_none(pgd_t pgd) { return 0; }
313static inline int pgd_bad(pgd_t pgd) { return 0; }
314static inline int pgd_present(pgd_t pgd) { return 1; }
315static inline void pgd_clear(pgd_t * pgdp) { }
316#endif
317
318/*
319 * The following only work if pte_present() is true.
320 * Undefined behaviour if not..
321 */
322static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
323static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
324static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
325static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
326static inline int pte_special(pte_t pte) { return 0; }
327
328static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
329static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
330static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; return pte; }
331static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
332static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
333static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }
334static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
335
336/*
337 * Conversion functions: convert a page and protection to a page entry,
338 * and a page entry and page directory to the page they refer to.
339 */
340#define __mk_pte(addr,pgprot) \
341({ \
342 pte_t __pte; \
343 \
344 pte_val(__pte) = ((((addr)>>PAGE_SHIFT)<<PFN_PTE_SHIFT) + pgprot_val(pgprot)); \
345 \
346 __pte; \
347})
348
349#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
350
351static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
352{
353 pte_t pte;
354 pte_val(pte) = (pfn << PFN_PTE_SHIFT) | pgprot_val(pgprot);
355 return pte;
356}
357
358static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
359{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; }
360
361/* Permanent address of a page. On parisc we don't have highmem. */
362
363#define pte_pfn(x) (pte_val(x) >> PFN_PTE_SHIFT)
364
365#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
366
367#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_address(pmd)))
368
369#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd)))
370#define pmd_page(pmd) virt_to_page((void *)__pmd_page(pmd))
371
372#define pgd_index(address) ((address) >> PGDIR_SHIFT)
373
374/* to find an entry in a page-table-directory */
375#define pgd_offset(mm, address) \
376((mm)->pgd + ((address) >> PGDIR_SHIFT))
377
378/* to find an entry in a kernel page-table-directory */
379#define pgd_offset_k(address) pgd_offset(&init_mm, address)
380
381/* Find an entry in the second-level page table.. */
382
383#if PT_NLEVELS == 3
384#define pmd_offset(dir,address) \
385((pmd_t *) pgd_page_vaddr(*(dir)) + (((address)>>PMD_SHIFT) & (PTRS_PER_PMD-1)))
386#else
387#define pmd_offset(dir,addr) ((pmd_t *) dir)
388#endif
389
390/* Find an entry in the third-level page table.. */
391#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
392#define pte_offset_kernel(pmd, address) \
393 ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address))
394#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
395#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
396#define pte_unmap(pte) do { } while (0)
397#define pte_unmap_nested(pte) do { } while (0)
398
399#define pte_unmap(pte) do { } while (0)
400#define pte_unmap_nested(pte) do { } while (0)
401
402extern void paging_init (void);
403
404/* Used for deferring calls to flush_dcache_page() */
405
406#define PG_dcache_dirty PG_arch_1
407
408extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
409
410/* Encode and de-code a swap entry */
411
412#define __swp_type(x) ((x).val & 0x1f)
413#define __swp_offset(x) ( (((x).val >> 6) & 0x7) | \
414 (((x).val >> 8) & ~0x7) )
415#define __swp_entry(type, offset) ((swp_entry_t) { (type) | \
416 ((offset & 0x7) << 6) | \
417 ((offset & ~0x7) << 8) })
418#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
419#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
420
421static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
422{
423#ifdef CONFIG_SMP
424 if (!pte_young(*ptep))
425 return 0;
426 return test_and_clear_bit(xlate_pabit(_PAGE_ACCESSED_BIT), &pte_val(*ptep));
427#else
428 pte_t pte = *ptep;
429 if (!pte_young(pte))
430 return 0;
431 set_pte_at(vma->vm_mm, addr, ptep, pte_mkold(pte));
432 return 1;
433#endif
434}
435
436extern spinlock_t pa_dbit_lock;
437
438struct mm_struct;
439static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
440{
441 pte_t old_pte;
442 pte_t pte;
443
444 spin_lock(&pa_dbit_lock);
445 pte = old_pte = *ptep;
446 pte_val(pte) &= ~_PAGE_PRESENT;
447 pte_val(pte) |= _PAGE_FLUSH;
448 set_pte_at(mm,addr,ptep,pte);
449 spin_unlock(&pa_dbit_lock);
450
451 return old_pte;
452}
453
454static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
455{
456#ifdef CONFIG_SMP
457 unsigned long new, old;
458
459 do {
460 old = pte_val(*ptep);
461 new = pte_val(pte_wrprotect(__pte (old)));
462 } while (cmpxchg((unsigned long *) ptep, old, new) != old);
463#else
464 pte_t old_pte = *ptep;
465 set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
466#endif
467}
468
469#define pte_same(A,B) (pte_val(A) == pte_val(B))
470
471#endif /* !__ASSEMBLY__ */
472
473
474/* TLB page size encoding - see table 3-1 in parisc20.pdf */
475#define _PAGE_SIZE_ENCODING_4K 0
476#define _PAGE_SIZE_ENCODING_16K 1
477#define _PAGE_SIZE_ENCODING_64K 2
478#define _PAGE_SIZE_ENCODING_256K 3
479#define _PAGE_SIZE_ENCODING_1M 4
480#define _PAGE_SIZE_ENCODING_4M 5
481#define _PAGE_SIZE_ENCODING_16M 6
482#define _PAGE_SIZE_ENCODING_64M 7
483
484#if defined(CONFIG_PARISC_PAGE_SIZE_4KB)
485# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K
486#elif defined(CONFIG_PARISC_PAGE_SIZE_16KB)
487# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_16K
488#elif defined(CONFIG_PARISC_PAGE_SIZE_64KB)
489# define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_64K
490#endif
491
492
493#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
494 remap_pfn_range(vma, vaddr, pfn, size, prot)
495
496#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_NO_CACHE)
497
498/* We provide our own get_unmapped_area to provide cache coherency */
499
500#define HAVE_ARCH_UNMAPPED_AREA
501
502#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
503#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
504#define __HAVE_ARCH_PTEP_SET_WRPROTECT
505#define __HAVE_ARCH_PTE_SAME
506#include <asm-generic/pgtable.h>
507
508#endif /* _PARISC_PGTABLE_H */
diff --git a/include/asm-parisc/poll.h b/include/asm-parisc/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/include/asm-parisc/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/include/asm-parisc/posix_types.h b/include/asm-parisc/posix_types.h
deleted file mode 100644
index bb725a6630bb..000000000000
--- a/include/asm-parisc/posix_types.h
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifndef __ARCH_PARISC_POSIX_TYPES_H
2#define __ARCH_PARISC_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9typedef unsigned long __kernel_ino_t;
10typedef unsigned short __kernel_mode_t;
11typedef unsigned short __kernel_nlink_t;
12typedef long __kernel_off_t;
13typedef int __kernel_pid_t;
14typedef unsigned short __kernel_ipc_pid_t;
15typedef unsigned int __kernel_uid_t;
16typedef unsigned int __kernel_gid_t;
17typedef int __kernel_suseconds_t;
18typedef long __kernel_clock_t;
19typedef int __kernel_timer_t;
20typedef int __kernel_clockid_t;
21typedef int __kernel_daddr_t;
22/* Note these change from narrow to wide kernels */
23#ifdef CONFIG_64BIT
24typedef unsigned long __kernel_size_t;
25typedef long __kernel_ssize_t;
26typedef long __kernel_ptrdiff_t;
27typedef long __kernel_time_t;
28#else
29typedef unsigned int __kernel_size_t;
30typedef int __kernel_ssize_t;
31typedef int __kernel_ptrdiff_t;
32typedef long __kernel_time_t;
33#endif
34typedef char * __kernel_caddr_t;
35
36typedef unsigned short __kernel_uid16_t;
37typedef unsigned short __kernel_gid16_t;
38typedef unsigned int __kernel_uid32_t;
39typedef unsigned int __kernel_gid32_t;
40
41#ifdef __GNUC__
42typedef long long __kernel_loff_t;
43typedef long long __kernel_off64_t;
44typedef unsigned long long __kernel_ino64_t;
45#endif
46
47typedef unsigned int __kernel_old_dev_t;
48
49typedef struct {
50 int val[2];
51} __kernel_fsid_t;
52
53/* compatibility stuff */
54typedef __kernel_uid_t __kernel_old_uid_t;
55typedef __kernel_gid_t __kernel_old_gid_t;
56
57#if defined(__KERNEL__)
58
59#undef __FD_SET
60static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
61{
62 unsigned long __tmp = __fd / __NFDBITS;
63 unsigned long __rem = __fd % __NFDBITS;
64 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
65}
66
67#undef __FD_CLR
68static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
69{
70 unsigned long __tmp = __fd / __NFDBITS;
71 unsigned long __rem = __fd % __NFDBITS;
72 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
73}
74
75#undef __FD_ISSET
76static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
77{
78 unsigned long __tmp = __fd / __NFDBITS;
79 unsigned long __rem = __fd % __NFDBITS;
80 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
81}
82
83/*
84 * This will unroll the loop for the normal constant case (8 ints,
85 * for a 256-bit fd_set)
86 */
87#undef __FD_ZERO
88static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
89{
90 unsigned long *__tmp = __p->fds_bits;
91 int __i;
92
93 if (__builtin_constant_p(__FDSET_LONGS)) {
94 switch (__FDSET_LONGS) {
95 case 16:
96 __tmp[ 0] = 0; __tmp[ 1] = 0;
97 __tmp[ 2] = 0; __tmp[ 3] = 0;
98 __tmp[ 4] = 0; __tmp[ 5] = 0;
99 __tmp[ 6] = 0; __tmp[ 7] = 0;
100 __tmp[ 8] = 0; __tmp[ 9] = 0;
101 __tmp[10] = 0; __tmp[11] = 0;
102 __tmp[12] = 0; __tmp[13] = 0;
103 __tmp[14] = 0; __tmp[15] = 0;
104 return;
105
106 case 8:
107 __tmp[ 0] = 0; __tmp[ 1] = 0;
108 __tmp[ 2] = 0; __tmp[ 3] = 0;
109 __tmp[ 4] = 0; __tmp[ 5] = 0;
110 __tmp[ 6] = 0; __tmp[ 7] = 0;
111 return;
112
113 case 4:
114 __tmp[ 0] = 0; __tmp[ 1] = 0;
115 __tmp[ 2] = 0; __tmp[ 3] = 0;
116 return;
117 }
118 }
119 __i = __FDSET_LONGS;
120 while (__i) {
121 __i--;
122 *__tmp = 0;
123 __tmp++;
124 }
125}
126
127#endif /* defined(__KERNEL__) */
128
129#endif
diff --git a/include/asm-parisc/prefetch.h b/include/asm-parisc/prefetch.h
deleted file mode 100644
index c5edc60c059f..000000000000
--- a/include/asm-parisc/prefetch.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-parisc/prefetch.h
3 *
4 * PA 2.0 defines data prefetch instructions on page 6-11 of the Kane book.
5 * In addition, many implementations do hardware prefetching of both
6 * instructions and data.
7 *
8 * PA7300LC (page 14-4 of the ERS) also implements prefetching by a load
9 * to gr0 but not in a way that Linux can use. If the load would cause an
10 * interruption (eg due to prefetching 0), it is suppressed on PA2.0
11 * processors, but not on 7300LC.
12 *
13 */
14
15#ifndef __ASM_PARISC_PREFETCH_H
16#define __ASM_PARISC_PREFETCH_H
17
18#ifndef __ASSEMBLY__
19#ifdef CONFIG_PREFETCH
20
21#define ARCH_HAS_PREFETCH
22static inline void prefetch(const void *addr)
23{
24 __asm__("ldw 0(%0), %%r0" : : "r" (addr));
25}
26
27/* LDD is a PA2.0 addition. */
28#ifdef CONFIG_PA20
29#define ARCH_HAS_PREFETCHW
30static inline void prefetchw(const void *addr)
31{
32 __asm__("ldd 0(%0), %%r0" : : "r" (addr));
33}
34#endif /* CONFIG_PA20 */
35
36#endif /* CONFIG_PREFETCH */
37#endif /* __ASSEMBLY__ */
38
39#endif /* __ASM_PARISC_PROCESSOR_H */
diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h
deleted file mode 100644
index 3c9d34844c83..000000000000
--- a/include/asm-parisc/processor.h
+++ /dev/null
@@ -1,357 +0,0 @@
1/*
2 * include/asm-parisc/processor.h
3 *
4 * Copyright (C) 1994 Linus Torvalds
5 * Copyright (C) 2001 Grant Grundler
6 */
7
8#ifndef __ASM_PARISC_PROCESSOR_H
9#define __ASM_PARISC_PROCESSOR_H
10
11#ifndef __ASSEMBLY__
12#include <linux/threads.h>
13
14#include <asm/prefetch.h>
15#include <asm/hardware.h>
16#include <asm/pdc.h>
17#include <asm/ptrace.h>
18#include <asm/types.h>
19#include <asm/system.h>
20#endif /* __ASSEMBLY__ */
21
22#define KERNEL_STACK_SIZE (4*PAGE_SIZE)
23
24/*
25 * Default implementation of macro that returns current
26 * instruction pointer ("program counter").
27 */
28#ifdef CONFIG_PA20
29#define current_ia(x) __asm__("mfia %0" : "=r"(x))
30#else /* mfia added in pa2.0 */
31#define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x))
32#endif
33#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
34
35#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
36#define TASK_SIZE TASK_SIZE_OF(current)
37#define TASK_UNMAPPED_BASE (current->thread.map_base)
38
39#define DEFAULT_TASK_SIZE32 (0xFFF00000UL)
40#define DEFAULT_MAP_BASE32 (0x40000000UL)
41
42#ifdef CONFIG_64BIT
43#define DEFAULT_TASK_SIZE (MAX_ADDRESS-0xf000000)
44#define DEFAULT_MAP_BASE (0x200000000UL)
45#else
46#define DEFAULT_TASK_SIZE DEFAULT_TASK_SIZE32
47#define DEFAULT_MAP_BASE DEFAULT_MAP_BASE32
48#endif
49
50#ifdef __KERNEL__
51
52/* XXX: STACK_TOP actually should be STACK_BOTTOM for parisc.
53 * prumpf */
54
55#define STACK_TOP TASK_SIZE
56#define STACK_TOP_MAX DEFAULT_TASK_SIZE
57
58#endif
59
60#ifndef __ASSEMBLY__
61
62/*
63 * Data detected about CPUs at boot time which is the same for all CPU's.
64 * HP boxes are SMP - ie identical processors.
65 *
66 * FIXME: some CPU rev info may be processor specific...
67 */
68struct system_cpuinfo_parisc {
69 unsigned int cpu_count;
70 unsigned int cpu_hz;
71 unsigned int hversion;
72 unsigned int sversion;
73 enum cpu_type cpu_type;
74
75 struct {
76 struct pdc_model model;
77 unsigned long versions;
78 unsigned long cpuid;
79 unsigned long capabilities;
80 char sys_model_name[81]; /* PDC-ROM returnes this model name */
81 } pdc;
82
83 const char *cpu_name; /* e.g. "PA7300LC (PCX-L2)" */
84 const char *family_name; /* e.g. "1.1e" */
85};
86
87
88/* Per CPU data structure - ie varies per CPU. */
89struct cpuinfo_parisc {
90 unsigned long it_value; /* Interval Timer at last timer Intr */
91 unsigned long it_delta; /* Interval delta (tic_10ms / HZ * 100) */
92 unsigned long irq_count; /* number of IRQ's since boot */
93 unsigned long irq_max_cr16; /* longest time to handle a single IRQ */
94 unsigned long cpuid; /* aka slot_number or set to NO_PROC_ID */
95 unsigned long hpa; /* Host Physical address */
96 unsigned long txn_addr; /* MMIO addr of EIR or id_eid */
97#ifdef CONFIG_SMP
98 unsigned long pending_ipi; /* bitmap of type ipi_message_type */
99 unsigned long ipi_count; /* number ipi Interrupts */
100#endif
101 unsigned long bh_count; /* number of times bh was invoked */
102 unsigned long prof_counter; /* per CPU profiling support */
103 unsigned long prof_multiplier; /* per CPU profiling support */
104 unsigned long fp_rev;
105 unsigned long fp_model;
106 unsigned int state;
107 struct parisc_device *dev;
108 unsigned long loops_per_jiffy;
109};
110
111extern struct system_cpuinfo_parisc boot_cpu_data;
112extern struct cpuinfo_parisc cpu_data[NR_CPUS];
113#define current_cpu_data cpu_data[smp_processor_id()]
114
115#define CPU_HVERSION ((boot_cpu_data.hversion >> 4) & 0x0FFF)
116
117typedef struct {
118 int seg;
119} mm_segment_t;
120
121#define ARCH_MIN_TASKALIGN 8
122
123struct thread_struct {
124 struct pt_regs regs;
125 unsigned long task_size;
126 unsigned long map_base;
127 unsigned long flags;
128};
129
130/* Thread struct flags. */
131#define PARISC_UAC_NOPRINT (1UL << 0) /* see prctl and unaligned.c */
132#define PARISC_UAC_SIGBUS (1UL << 1)
133#define PARISC_KERNEL_DEATH (1UL << 31) /* see die_if_kernel()... */
134
135#define PARISC_UAC_SHIFT 0
136#define PARISC_UAC_MASK (PARISC_UAC_NOPRINT|PARISC_UAC_SIGBUS)
137
138#define SET_UNALIGN_CTL(task,value) \
139 ({ \
140 (task)->thread.flags = (((task)->thread.flags & ~PARISC_UAC_MASK) \
141 | (((value) << PARISC_UAC_SHIFT) & \
142 PARISC_UAC_MASK)); \
143 0; \
144 })
145
146#define GET_UNALIGN_CTL(task,addr) \
147 ({ \
148 put_user(((task)->thread.flags & PARISC_UAC_MASK) \
149 >> PARISC_UAC_SHIFT, (int __user *) (addr)); \
150 })
151
152#define INIT_THREAD { \
153 .regs = { .gr = { 0, }, \
154 .fr = { 0, }, \
155 .sr = { 0, }, \
156 .iasq = { 0, }, \
157 .iaoq = { 0, }, \
158 .cr27 = 0, \
159 }, \
160 .task_size = DEFAULT_TASK_SIZE, \
161 .map_base = DEFAULT_MAP_BASE, \
162 .flags = 0 \
163 }
164
165/*
166 * Return saved PC of a blocked thread. This is used by ps mostly.
167 */
168
169unsigned long thread_saved_pc(struct task_struct *t);
170void show_trace(struct task_struct *task, unsigned long *stack);
171
172/*
173 * Start user thread in another space.
174 *
175 * Note that we set both the iaoq and r31 to the new pc. When
176 * the kernel initially calls execve it will return through an
177 * rfi path that will use the values in the iaoq. The execve
178 * syscall path will return through the gateway page, and
179 * that uses r31 to branch to.
180 *
181 * For ELF we clear r23, because the dynamic linker uses it to pass
182 * the address of the finalizer function.
183 *
184 * We also initialize sr3 to an illegal value (illegal for our
185 * implementation, not for the architecture).
186 */
187typedef unsigned int elf_caddr_t;
188
189#define start_thread_som(regs, new_pc, new_sp) do { \
190 unsigned long *sp = (unsigned long *)new_sp; \
191 __u32 spaceid = (__u32)current->mm->context; \
192 unsigned long pc = (unsigned long)new_pc; \
193 /* offset pc for priv. level */ \
194 pc |= 3; \
195 \
196 set_fs(USER_DS); \
197 regs->iasq[0] = spaceid; \
198 regs->iasq[1] = spaceid; \
199 regs->iaoq[0] = pc; \
200 regs->iaoq[1] = pc + 4; \
201 regs->sr[2] = LINUX_GATEWAY_SPACE; \
202 regs->sr[3] = 0xffff; \
203 regs->sr[4] = spaceid; \
204 regs->sr[5] = spaceid; \
205 regs->sr[6] = spaceid; \
206 regs->sr[7] = spaceid; \
207 regs->gr[ 0] = USER_PSW; \
208 regs->gr[30] = ((new_sp)+63)&~63; \
209 regs->gr[31] = pc; \
210 \
211 get_user(regs->gr[26],&sp[0]); \
212 get_user(regs->gr[25],&sp[-1]); \
213 get_user(regs->gr[24],&sp[-2]); \
214 get_user(regs->gr[23],&sp[-3]); \
215} while(0)
216
217/* The ELF abi wants things done a "wee bit" differently than
218 * som does. Supporting this behavior here avoids
219 * having our own version of create_elf_tables.
220 *
221 * Oh, and yes, that is not a typo, we are really passing argc in r25
222 * and argv in r24 (rather than r26 and r25). This is because that's
223 * where __libc_start_main wants them.
224 *
225 * Duplicated from dl-machine.h for the benefit of readers:
226 *
227 * Our initial stack layout is rather different from everyone else's
228 * due to the unique PA-RISC ABI. As far as I know it looks like
229 * this:
230
231 ----------------------------------- (user startup code creates this frame)
232 | 32 bytes of magic |
233 |---------------------------------|
234 | 32 bytes argument/sp save area |
235 |---------------------------------| (bprm->p)
236 | ELF auxiliary info |
237 | (up to 28 words) |
238 |---------------------------------|
239 | NULL |
240 |---------------------------------|
241 | Environment pointers |
242 |---------------------------------|
243 | NULL |
244 |---------------------------------|
245 | Argument pointers |
246 |---------------------------------| <- argv
247 | argc (1 word) |
248 |---------------------------------| <- bprm->exec (HACK!)
249 | N bytes of slack |
250 |---------------------------------|
251 | filename passed to execve |
252 |---------------------------------| (mm->env_end)
253 | env strings |
254 |---------------------------------| (mm->env_start, mm->arg_end)
255 | arg strings |
256 |---------------------------------|
257 | additional faked arg strings if |
258 | we're invoked via binfmt_script |
259 |---------------------------------| (mm->arg_start)
260 stack base is at TASK_SIZE - rlim_max.
261
262on downward growing arches, it looks like this:
263 stack base at TASK_SIZE
264 | filename passed to execve
265 | env strings
266 | arg strings
267 | faked arg strings
268 | slack
269 | ELF
270 | envps
271 | argvs
272 | argc
273
274 * The pleasant part of this is that if we need to skip arguments we
275 * can just decrement argc and move argv, because the stack pointer
276 * is utterly unrelated to the location of the environment and
277 * argument vectors.
278 *
279 * Note that the S/390 people took the easy way out and hacked their
280 * GCC to make the stack grow downwards.
281 *
282 * Final Note: For entry from syscall, the W (wide) bit of the PSW
283 * is stuffed into the lowest bit of the user sp (%r30), so we fill
284 * it in here from the current->personality
285 */
286
287#ifdef CONFIG_64BIT
288#define USER_WIDE_MODE (!test_thread_flag(TIF_32BIT))
289#else
290#define USER_WIDE_MODE 0
291#endif
292
293#define start_thread(regs, new_pc, new_sp) do { \
294 elf_addr_t *sp = (elf_addr_t *)new_sp; \
295 __u32 spaceid = (__u32)current->mm->context; \
296 elf_addr_t pc = (elf_addr_t)new_pc | 3; \
297 elf_caddr_t *argv = (elf_caddr_t *)bprm->exec + 1; \
298 \
299 set_fs(USER_DS); \
300 regs->iasq[0] = spaceid; \
301 regs->iasq[1] = spaceid; \
302 regs->iaoq[0] = pc; \
303 regs->iaoq[1] = pc + 4; \
304 regs->sr[2] = LINUX_GATEWAY_SPACE; \
305 regs->sr[3] = 0xffff; \
306 regs->sr[4] = spaceid; \
307 regs->sr[5] = spaceid; \
308 regs->sr[6] = spaceid; \
309 regs->sr[7] = spaceid; \
310 regs->gr[ 0] = USER_PSW | (USER_WIDE_MODE ? PSW_W : 0); \
311 regs->fr[ 0] = 0LL; \
312 regs->fr[ 1] = 0LL; \
313 regs->fr[ 2] = 0LL; \
314 regs->fr[ 3] = 0LL; \
315 regs->gr[30] = (((unsigned long)sp + 63) &~ 63) | (USER_WIDE_MODE ? 1 : 0); \
316 regs->gr[31] = pc; \
317 \
318 get_user(regs->gr[25], (argv - 1)); \
319 regs->gr[24] = (long) argv; \
320 regs->gr[23] = 0; \
321} while(0)
322
323struct task_struct;
324struct mm_struct;
325
326/* Free all resources held by a thread. */
327extern void release_thread(struct task_struct *);
328extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
329
330/* Prepare to copy thread state - unlazy all lazy status */
331#define prepare_to_copy(tsk) do { } while (0)
332
333extern void map_hpux_gateway_page(struct task_struct *tsk, struct mm_struct *mm);
334
335extern unsigned long get_wchan(struct task_struct *p);
336
337#define KSTK_EIP(tsk) ((tsk)->thread.regs.iaoq[0])
338#define KSTK_ESP(tsk) ((tsk)->thread.regs.gr[30])
339
340#define cpu_relax() barrier()
341
342/* Used as a macro to identify the combined VIPT/PIPT cached
343 * CPUs which require a guarantee of coherency (no inequivalent
344 * aliases with different data, whether clean or not) to operate */
345static inline int parisc_requires_coherency(void)
346{
347#ifdef CONFIG_PA8X00
348 return (boot_cpu_data.cpu_type == mako) ||
349 (boot_cpu_data.cpu_type == mako2);
350#else
351 return 0;
352#endif
353}
354
355#endif /* __ASSEMBLY__ */
356
357#endif /* __ASM_PARISC_PROCESSOR_H */
diff --git a/include/asm-parisc/psw.h b/include/asm-parisc/psw.h
deleted file mode 100644
index 5a3e23c9ce63..000000000000
--- a/include/asm-parisc/psw.h
+++ /dev/null
@@ -1,62 +0,0 @@
1#ifndef _PARISC_PSW_H
2
3
4#define PSW_I 0x00000001
5#define PSW_D 0x00000002
6#define PSW_P 0x00000004
7#define PSW_Q 0x00000008
8
9#define PSW_R 0x00000010
10#define PSW_F 0x00000020
11#define PSW_G 0x00000040 /* PA1.x only */
12#define PSW_O 0x00000080 /* PA2.0 only */
13
14/* ssm/rsm instructions number PSW_W and PSW_E differently */
15#define PSW_SM_I PSW_I /* Enable External Interrupts */
16#define PSW_SM_D PSW_D
17#define PSW_SM_P PSW_P
18#define PSW_SM_Q PSW_Q /* Enable Interrupt State Collection */
19#define PSW_SM_R PSW_R /* Enable Recover Counter Trap */
20#define PSW_SM_W 0x200 /* PA2.0 only : Enable Wide Mode */
21
22#define PSW_SM_QUIET PSW_SM_R+PSW_SM_Q+PSW_SM_P+PSW_SM_D+PSW_SM_I
23
24#define PSW_CB 0x0000ff00
25
26#define PSW_M 0x00010000
27#define PSW_V 0x00020000
28#define PSW_C 0x00040000
29#define PSW_B 0x00080000
30
31#define PSW_X 0x00100000
32#define PSW_N 0x00200000
33#define PSW_L 0x00400000
34#define PSW_H 0x00800000
35
36#define PSW_T 0x01000000
37#define PSW_S 0x02000000
38#define PSW_E 0x04000000
39#define PSW_W 0x08000000 /* PA2.0 only */
40#define PSW_W_BIT 36 /* PA2.0 only */
41
42#define PSW_Z 0x40000000 /* PA1.x only */
43#define PSW_Y 0x80000000 /* PA1.x only */
44
45#ifdef CONFIG_64BIT
46# define PSW_HI_CB 0x000000ff /* PA2.0 only */
47#endif
48
49#ifdef CONFIG_64BIT
50# define USER_PSW_HI_MASK PSW_HI_CB
51# define WIDE_PSW PSW_W
52#else
53# define WIDE_PSW 0
54#endif
55
56/* Used when setting up for rfi */
57#define KERNEL_PSW (WIDE_PSW | PSW_C | PSW_Q | PSW_P | PSW_D)
58#define REAL_MODE_PSW (WIDE_PSW | PSW_Q)
59#define USER_PSW_MASK (WIDE_PSW | PSW_T | PSW_N | PSW_X | PSW_B | PSW_V | PSW_CB)
60#define USER_PSW (PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I)
61
62#endif
diff --git a/include/asm-parisc/ptrace.h b/include/asm-parisc/ptrace.h
deleted file mode 100644
index 3e94c5d85ff5..000000000000
--- a/include/asm-parisc/ptrace.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PARISC_PTRACE_H
2#define _PARISC_PTRACE_H
3
4/* written by Philipp Rumpf, Copyright (C) 1999 SuSE GmbH Nuernberg
5** Copyright (C) 2000 Grant Grundler, Hewlett-Packard
6*/
7
8#include <linux/types.h>
9
10/* This struct defines the way the registers are stored on the
11 * stack during a system call.
12 *
13 * N.B. gdb/strace care about the size and offsets within this
14 * structure. If you change things, you may break object compatibility
15 * for those applications.
16 */
17
18struct pt_regs {
19 unsigned long gr[32]; /* PSW is in gr[0] */
20 __u64 fr[32];
21 unsigned long sr[ 8];
22 unsigned long iasq[2];
23 unsigned long iaoq[2];
24 unsigned long cr27;
25 unsigned long pad0; /* available for other uses */
26 unsigned long orig_r28;
27 unsigned long ksp;
28 unsigned long kpc;
29 unsigned long sar; /* CR11 */
30 unsigned long iir; /* CR19 */
31 unsigned long isr; /* CR20 */
32 unsigned long ior; /* CR21 */
33 unsigned long ipsw; /* CR22 */
34};
35
36/*
37 * The numbers chosen here are somewhat arbitrary but absolutely MUST
38 * not overlap with any of the number assigned in <linux/ptrace.h>.
39 *
40 * These ones are taken from IA-64 on the assumption that theirs are
41 * the most correct (and we also want to support PTRACE_SINGLEBLOCK
42 * since we have taken branch traps too)
43 */
44#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
45
46#ifdef __KERNEL__
47
48#define task_regs(task) ((struct pt_regs *) ((char *)(task) + TASK_REGS))
49
50/* XXX should we use iaoq[1] or iaoq[0] ? */
51#define user_mode(regs) (((regs)->iaoq[0] & 3) ? 1 : 0)
52#define user_space(regs) (((regs)->iasq[1] != 0) ? 1 : 0)
53#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3)
54unsigned long profile_pc(struct pt_regs *);
55extern void show_regs(struct pt_regs *);
56#endif
57
58#endif
diff --git a/include/asm-parisc/real.h b/include/asm-parisc/real.h
deleted file mode 100644
index 82acb25db395..000000000000
--- a/include/asm-parisc/real.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifndef _PARISC_REAL_H
2#define _PARISC_REAL_H
3
4
5#endif
diff --git a/include/asm-parisc/resource.h b/include/asm-parisc/resource.h
deleted file mode 100644
index 8b06343b62ed..000000000000
--- a/include/asm-parisc/resource.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_PARISC_RESOURCE_H
2#define _ASM_PARISC_RESOURCE_H
3
4#define _STK_LIM_MAX 10 * _STK_LIM
5#include <asm-generic/resource.h>
6
7#endif
diff --git a/include/asm-parisc/ropes.h b/include/asm-parisc/ropes.h
deleted file mode 100644
index 007a880615eb..000000000000
--- a/include/asm-parisc/ropes.h
+++ /dev/null
@@ -1,322 +0,0 @@
1#ifndef _ASM_PARISC_ROPES_H_
2#define _ASM_PARISC_ROPES_H_
3
4#include <asm-parisc/parisc-device.h>
5
6#ifdef CONFIG_64BIT
7/* "low end" PA8800 machines use ZX1 chipset: PAT PDC and only run 64-bit */
8#define ZX1_SUPPORT
9#endif
10
11#ifdef CONFIG_PROC_FS
12/* depends on proc fs support. But costs CPU performance */
13#undef SBA_COLLECT_STATS
14#endif
15
16/*
17** The number of pdir entries to "free" before issuing
18** a read to PCOM register to flush out PCOM writes.
19** Interacts with allocation granularity (ie 4 or 8 entries
20** allocated and free'd/purged at a time might make this
21** less interesting).
22*/
23#define DELAYED_RESOURCE_CNT 16
24
25#define MAX_IOC 2 /* per Ike. Pluto/Astro only have 1. */
26#define ROPES_PER_IOC 8 /* per Ike half or Pluto/Astro */
27
28struct ioc {
29 void __iomem *ioc_hpa; /* I/O MMU base address */
30 char *res_map; /* resource map, bit == pdir entry */
31 u64 *pdir_base; /* physical base address */
32 unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */
33 unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */
34#ifdef ZX1_SUPPORT
35 unsigned long iovp_mask; /* help convert IOVA to IOVP */
36#endif
37 unsigned long *res_hint; /* next avail IOVP - circular search */
38 spinlock_t res_lock;
39 unsigned int res_bitshift; /* from the LEFT! */
40 unsigned int res_size; /* size of resource map in bytes */
41#ifdef SBA_HINT_SUPPORT
42/* FIXME : DMA HINTs not used */
43 unsigned long hint_mask_pdir; /* bits used for DMA hints */
44 unsigned int hint_shift_pdir;
45#endif
46#if DELAYED_RESOURCE_CNT > 0
47 int saved_cnt;
48 struct sba_dma_pair {
49 dma_addr_t iova;
50 size_t size;
51 } saved[DELAYED_RESOURCE_CNT];
52#endif
53
54#ifdef SBA_COLLECT_STATS
55#define SBA_SEARCH_SAMPLE 0x100
56 unsigned long avg_search[SBA_SEARCH_SAMPLE];
57 unsigned long avg_idx; /* current index into avg_search */
58 unsigned long used_pages;
59 unsigned long msingle_calls;
60 unsigned long msingle_pages;
61 unsigned long msg_calls;
62 unsigned long msg_pages;
63 unsigned long usingle_calls;
64 unsigned long usingle_pages;
65 unsigned long usg_calls;
66 unsigned long usg_pages;
67#endif
68 /* STUFF We don't need in performance path */
69 unsigned int pdir_size; /* in bytes, determined by IOV Space size */
70};
71
72struct sba_device {
73 struct sba_device *next; /* list of SBA's in system */
74 struct parisc_device *dev; /* dev found in bus walk */
75 const char *name;
76 void __iomem *sba_hpa; /* base address */
77 spinlock_t sba_lock;
78 unsigned int flags; /* state/functionality enabled */
79 unsigned int hw_rev; /* HW revision of chip */
80
81 struct resource chip_resv; /* MMIO reserved for chip */
82 struct resource iommu_resv; /* MMIO reserved for iommu */
83
84 unsigned int num_ioc; /* number of on-board IOC's */
85 struct ioc ioc[MAX_IOC];
86};
87
88#define ASTRO_RUNWAY_PORT 0x582
89#define IKE_MERCED_PORT 0x803
90#define REO_MERCED_PORT 0x804
91#define REOG_MERCED_PORT 0x805
92#define PLUTO_MCKINLEY_PORT 0x880
93
94static inline int IS_ASTRO(struct parisc_device *d) {
95 return d->id.hversion == ASTRO_RUNWAY_PORT;
96}
97
98static inline int IS_IKE(struct parisc_device *d) {
99 return d->id.hversion == IKE_MERCED_PORT;
100}
101
102static inline int IS_PLUTO(struct parisc_device *d) {
103 return d->id.hversion == PLUTO_MCKINLEY_PORT;
104}
105
106#define PLUTO_IOVA_BASE (1UL*1024*1024*1024) /* 1GB */
107#define PLUTO_IOVA_SIZE (1UL*1024*1024*1024) /* 1GB */
108#define PLUTO_GART_SIZE (PLUTO_IOVA_SIZE / 2)
109
110#define SBA_PDIR_VALID_BIT 0x8000000000000000ULL
111
112#define SBA_AGPGART_COOKIE 0x0000badbadc0ffeeULL
113
114#define SBA_FUNC_ID 0x0000 /* function id */
115#define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */
116
117#define SBA_FUNC_SIZE 4096 /* SBA configuration function reg set */
118
119#define ASTRO_IOC_OFFSET (32 * SBA_FUNC_SIZE)
120#define PLUTO_IOC_OFFSET (1 * SBA_FUNC_SIZE)
121/* Ike's IOC's occupy functions 2 and 3 */
122#define IKE_IOC_OFFSET(p) ((p+2) * SBA_FUNC_SIZE)
123
124#define IOC_CTRL 0x8 /* IOC_CTRL offset */
125#define IOC_CTRL_TC (1 << 0) /* TOC Enable */
126#define IOC_CTRL_CE (1 << 1) /* Coalesce Enable */
127#define IOC_CTRL_DE (1 << 2) /* Dillon Enable */
128#define IOC_CTRL_RM (1 << 8) /* Real Mode */
129#define IOC_CTRL_NC (1 << 9) /* Non Coherent Mode */
130#define IOC_CTRL_D4 (1 << 11) /* Disable 4-byte coalescing */
131#define IOC_CTRL_DD (1 << 13) /* Disable distr. LMMIO range coalescing */
132
133/*
134** Offsets into MBIB (Function 0 on Ike and hopefully Astro)
135** Firmware programs this stuff. Don't touch it.
136*/
137#define LMMIO_DIRECT0_BASE 0x300
138#define LMMIO_DIRECT0_MASK 0x308
139#define LMMIO_DIRECT0_ROUTE 0x310
140
141#define LMMIO_DIST_BASE 0x360
142#define LMMIO_DIST_MASK 0x368
143#define LMMIO_DIST_ROUTE 0x370
144
145#define IOS_DIST_BASE 0x390
146#define IOS_DIST_MASK 0x398
147#define IOS_DIST_ROUTE 0x3A0
148
149#define IOS_DIRECT_BASE 0x3C0
150#define IOS_DIRECT_MASK 0x3C8
151#define IOS_DIRECT_ROUTE 0x3D0
152
153/*
154** Offsets into I/O TLB (Function 2 and 3 on Ike)
155*/
156#define ROPE0_CTL 0x200 /* "regbus pci0" */
157#define ROPE1_CTL 0x208
158#define ROPE2_CTL 0x210
159#define ROPE3_CTL 0x218
160#define ROPE4_CTL 0x220
161#define ROPE5_CTL 0x228
162#define ROPE6_CTL 0x230
163#define ROPE7_CTL 0x238
164
165#define IOC_ROPE0_CFG 0x500 /* pluto only */
166#define IOC_ROPE_AO 0x10 /* Allow "Relaxed Ordering" */
167
168#define HF_ENABLE 0x40
169
170#define IOC_IBASE 0x300 /* IO TLB */
171#define IOC_IMASK 0x308
172#define IOC_PCOM 0x310
173#define IOC_TCNFG 0x318
174#define IOC_PDIR_BASE 0x320
175
176/*
177** IOC supports 4/8/16/64KB page sizes (see TCNFG register)
178** It's safer (avoid memory corruption) to keep DMA page mappings
179** equivalently sized to VM PAGE_SIZE.
180**
181** We really can't avoid generating a new mapping for each
182** page since the Virtual Coherence Index has to be generated
183** and updated for each page.
184**
185** PAGE_SIZE could be greater than IOVP_SIZE. But not the inverse.
186*/
187#define IOVP_SIZE PAGE_SIZE
188#define IOVP_SHIFT PAGE_SHIFT
189#define IOVP_MASK PAGE_MASK
190
191#define SBA_PERF_CFG 0x708 /* Performance Counter stuff */
192#define SBA_PERF_MASK1 0x718
193#define SBA_PERF_MASK2 0x730
194
195/*
196** Offsets into PCI Performance Counters (functions 12 and 13)
197** Controlled by PERF registers in function 2 & 3 respectively.
198*/
199#define SBA_PERF_CNT1 0x200
200#define SBA_PERF_CNT2 0x208
201#define SBA_PERF_CNT3 0x210
202
203/*
204** lba_device: Per instance Elroy data structure
205*/
206struct lba_device {
207 struct pci_hba_data hba;
208
209 spinlock_t lba_lock;
210 void *iosapic_obj;
211
212#ifdef CONFIG_64BIT
213 void __iomem *iop_base; /* PA_VIEW - for IO port accessor funcs */
214#endif
215
216 int flags; /* state/functionality enabled */
217 int hw_rev; /* HW revision of chip */
218};
219
220#define ELROY_HVERS 0x782
221#define MERCURY_HVERS 0x783
222#define QUICKSILVER_HVERS 0x784
223
224static inline int IS_ELROY(struct parisc_device *d) {
225 return (d->id.hversion == ELROY_HVERS);
226}
227
228static inline int IS_MERCURY(struct parisc_device *d) {
229 return (d->id.hversion == MERCURY_HVERS);
230}
231
232static inline int IS_QUICKSILVER(struct parisc_device *d) {
233 return (d->id.hversion == QUICKSILVER_HVERS);
234}
235
236static inline int agp_mode_mercury(void __iomem *hpa) {
237 u64 bus_mode;
238
239 bus_mode = readl(hpa + 0x0620);
240 if (bus_mode & 1)
241 return 1;
242
243 return 0;
244}
245
246/*
247** I/O SAPIC init function
248** Caller knows where an I/O SAPIC is. LBA has an integrated I/O SAPIC.
249** Call setup as part of per instance initialization.
250** (ie *not* init_module() function unless only one is present.)
251** fixup_irq is to initialize PCI IRQ line support and
252** virtualize pcidev->irq value. To be called by pci_fixup_bus().
253*/
254extern void *iosapic_register(unsigned long hpa);
255extern int iosapic_fixup_irq(void *obj, struct pci_dev *pcidev);
256
257#define LBA_FUNC_ID 0x0000 /* function id */
258#define LBA_FCLASS 0x0008 /* function class, bist, header, rev... */
259#define LBA_CAPABLE 0x0030 /* capabilities register */
260
261#define LBA_PCI_CFG_ADDR 0x0040 /* poke CFG address here */
262#define LBA_PCI_CFG_DATA 0x0048 /* read or write data here */
263
264#define LBA_PMC_MTLT 0x0050 /* Firmware sets this - read only. */
265#define LBA_FW_SCRATCH 0x0058 /* Firmware writes the PCI bus number here. */
266#define LBA_ERROR_ADDR 0x0070 /* On error, address gets logged here */
267
268#define LBA_ARB_MASK 0x0080 /* bit 0 enable arbitration. PAT/PDC enables */
269#define LBA_ARB_PRI 0x0088 /* firmware sets this. */
270#define LBA_ARB_MODE 0x0090 /* firmware sets this. */
271#define LBA_ARB_MTLT 0x0098 /* firmware sets this. */
272
273#define LBA_MOD_ID 0x0100 /* Module ID. PDC_PAT_CELL reports 4 */
274
275#define LBA_STAT_CTL 0x0108 /* Status & Control */
276#define LBA_BUS_RESET 0x01 /* Deassert PCI Bus Reset Signal */
277#define CLEAR_ERRLOG 0x10 /* "Clear Error Log" cmd */
278#define CLEAR_ERRLOG_ENABLE 0x20 /* "Clear Error Log" Enable */
279#define HF_ENABLE 0x40 /* enable HF mode (default is -1 mode) */
280
281#define LBA_LMMIO_BASE 0x0200 /* < 4GB I/O address range */
282#define LBA_LMMIO_MASK 0x0208
283
284#define LBA_GMMIO_BASE 0x0210 /* > 4GB I/O address range */
285#define LBA_GMMIO_MASK 0x0218
286
287#define LBA_WLMMIO_BASE 0x0220 /* All < 4GB ranges under the same *SBA* */
288#define LBA_WLMMIO_MASK 0x0228
289
290#define LBA_WGMMIO_BASE 0x0230 /* All > 4GB ranges under the same *SBA* */
291#define LBA_WGMMIO_MASK 0x0238
292
293#define LBA_IOS_BASE 0x0240 /* I/O port space for this LBA */
294#define LBA_IOS_MASK 0x0248
295
296#define LBA_ELMMIO_BASE 0x0250 /* Extra LMMIO range */
297#define LBA_ELMMIO_MASK 0x0258
298
299#define LBA_EIOS_BASE 0x0260 /* Extra I/O port space */
300#define LBA_EIOS_MASK 0x0268
301
302#define LBA_GLOBAL_MASK 0x0270 /* Mercury only: Global Address Mask */
303#define LBA_DMA_CTL 0x0278 /* firmware sets this */
304
305#define LBA_IBASE 0x0300 /* SBA DMA support */
306#define LBA_IMASK 0x0308
307
308/* FIXME: ignore DMA Hint stuff until we can measure performance */
309#define LBA_HINT_CFG 0x0310
310#define LBA_HINT_BASE 0x0380 /* 14 registers at every 8 bytes. */
311
312#define LBA_BUS_MODE 0x0620
313
314/* ERROR regs are needed for config cycle kluges */
315#define LBA_ERROR_CONFIG 0x0680
316#define LBA_SMART_MODE 0x20
317#define LBA_ERROR_STATUS 0x0688
318#define LBA_ROPE_CTL 0x06A0
319
320#define LBA_IOSAPIC_BASE 0x800 /* Offset of IRQ logic */
321
322#endif /*_ASM_PARISC_ROPES_H_*/
diff --git a/include/asm-parisc/rt_sigframe.h b/include/asm-parisc/rt_sigframe.h
deleted file mode 100644
index f0dd3b30f6c4..000000000000
--- a/include/asm-parisc/rt_sigframe.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _ASM_PARISC_RT_SIGFRAME_H
2#define _ASM_PARISC_RT_SIGFRAME_H
3
4#define SIGRETURN_TRAMP 4
5#define SIGRESTARTBLOCK_TRAMP 5
6#define TRAMP_SIZE (SIGRETURN_TRAMP + SIGRESTARTBLOCK_TRAMP)
7
8struct rt_sigframe {
9 /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c
10 Secondary to that it must protect the ERESTART_RESTARTBLOCK
11 trampoline we left on the stack (we were bad and didn't
12 change sp so we could run really fast.) */
13 unsigned int tramp[TRAMP_SIZE];
14 struct siginfo info;
15 struct ucontext uc;
16};
17
18#define SIGFRAME 128
19#define FUNCTIONCALLFRAME 96
20#define PARISC_RT_SIGFRAME_SIZE \
21 (((sizeof(struct rt_sigframe) + FUNCTIONCALLFRAME) + SIGFRAME) & -SIGFRAME)
22
23#endif
diff --git a/include/asm-parisc/rtc.h b/include/asm-parisc/rtc.h
deleted file mode 100644
index 099d641a42c2..000000000000
--- a/include/asm-parisc/rtc.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * include/asm-parisc/rtc.h
3 *
4 * Copyright 2002 Randolph CHung <tausq@debian.org>
5 *
6 * Based on: include/asm-ppc/rtc.h and the genrtc driver in the
7 * 2.4 parisc linux tree
8 */
9
10#ifndef __ASM_RTC_H__
11#define __ASM_RTC_H__
12
13#ifdef __KERNEL__
14
15#include <linux/rtc.h>
16
17#include <asm/pdc.h>
18
19#define SECS_PER_HOUR (60 * 60)
20#define SECS_PER_DAY (SECS_PER_HOUR * 24)
21
22
23#define RTC_PIE 0x40 /* periodic interrupt enable */
24#define RTC_AIE 0x20 /* alarm interrupt enable */
25#define RTC_UIE 0x10 /* update-finished interrupt enable */
26
27#define RTC_BATT_BAD 0x100 /* battery bad */
28
29/* some dummy definitions */
30#define RTC_SQWE 0x08 /* enable square-wave output */
31#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
32#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
33#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
34
35# define __isleap(year) \
36 ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
37
38/* How many days come before each month (0-12). */
39static const unsigned short int __mon_yday[2][13] =
40{
41 /* Normal years. */
42 { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
43 /* Leap years. */
44 { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
45};
46
47static inline unsigned int get_rtc_time(struct rtc_time *wtime)
48{
49 struct pdc_tod tod_data;
50 long int days, rem, y;
51 const unsigned short int *ip;
52
53 memset(wtime, 0, sizeof(*wtime));
54 if (pdc_tod_read(&tod_data) < 0)
55 return RTC_24H | RTC_BATT_BAD;
56
57 // most of the remainder of this function is:
58// Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
59// This was originally a part of the GNU C Library.
60// It is distributed under the GPL, and was swiped from offtime.c
61
62
63 days = tod_data.tod_sec / SECS_PER_DAY;
64 rem = tod_data.tod_sec % SECS_PER_DAY;
65
66 wtime->tm_hour = rem / SECS_PER_HOUR;
67 rem %= SECS_PER_HOUR;
68 wtime->tm_min = rem / 60;
69 wtime->tm_sec = rem % 60;
70
71 y = 1970;
72
73#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
74#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
75
76 while (days < 0 || days >= (__isleap (y) ? 366 : 365))
77 {
78 /* Guess a corrected year, assuming 365 days per year. */
79 long int yg = y + days / 365 - (days % 365 < 0);
80
81 /* Adjust DAYS and Y to match the guessed year. */
82 days -= ((yg - y) * 365
83 + LEAPS_THRU_END_OF (yg - 1)
84 - LEAPS_THRU_END_OF (y - 1));
85 y = yg;
86 }
87 wtime->tm_year = y - 1900;
88
89 ip = __mon_yday[__isleap(y)];
90 for (y = 11; days < (long int) ip[y]; --y)
91 continue;
92 days -= ip[y];
93 wtime->tm_mon = y;
94 wtime->tm_mday = days + 1;
95
96 return RTC_24H;
97}
98
99static int set_rtc_time(struct rtc_time *wtime)
100{
101 u_int32_t secs;
102
103 secs = mktime(wtime->tm_year + 1900, wtime->tm_mon + 1, wtime->tm_mday,
104 wtime->tm_hour, wtime->tm_min, wtime->tm_sec);
105
106 if(pdc_tod_set(secs, 0) < 0)
107 return -1;
108 else
109 return 0;
110
111}
112
113static inline unsigned int get_rtc_ss(void)
114{
115 struct rtc_time h;
116
117 get_rtc_time(&h);
118 return h.tm_sec;
119}
120
121static inline int get_rtc_pll(struct rtc_pll_info *pll)
122{
123 return -EINVAL;
124}
125static inline int set_rtc_pll(struct rtc_pll_info *pll)
126{
127 return -EINVAL;
128}
129
130#endif /* __KERNEL__ */
131#endif /* __ASM_RTC_H__ */
diff --git a/include/asm-parisc/runway.h b/include/asm-parisc/runway.h
deleted file mode 100644
index 5bea02da7e22..000000000000
--- a/include/asm-parisc/runway.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef ASM_PARISC_RUNWAY_H
2#define ASM_PARISC_RUNWAY_H
3#ifdef __KERNEL__
4
5/* declared in arch/parisc/kernel/setup.c */
6extern struct proc_dir_entry * proc_runway_root;
7
8#define RUNWAY_STATUS 0x10
9#define RUNWAY_DEBUG 0x40
10
11#endif /* __KERNEL__ */
12#endif /* ASM_PARISC_RUNWAY_H */
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h
deleted file mode 100644
index 62269b31ebf4..000000000000
--- a/include/asm-parisc/scatterlist.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASM_PARISC_SCATTERLIST_H
2#define _ASM_PARISC_SCATTERLIST_H
3
4#include <asm/page.h>
5#include <asm/types.h>
6
7struct scatterlist {
8#ifdef CONFIG_DEBUG_SG
9 unsigned long sg_magic;
10#endif
11 unsigned long page_link;
12 unsigned int offset;
13
14 unsigned int length;
15
16 /* an IOVA can be 64-bits on some PA-Risc platforms. */
17 dma_addr_t iova; /* I/O Virtual Address */
18 __u32 iova_length; /* bytes mapped */
19};
20
21#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))
22#define sg_dma_address(sg) ((sg)->iova)
23#define sg_dma_len(sg) ((sg)->iova_length)
24
25#define ISA_DMA_THRESHOLD (~0UL)
26
27#endif /* _ASM_PARISC_SCATTERLIST_H */
diff --git a/include/asm-parisc/sections.h b/include/asm-parisc/sections.h
deleted file mode 100644
index 9d13c3507ad6..000000000000
--- a/include/asm-parisc/sections.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _PARISC_SECTIONS_H
2#define _PARISC_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#ifdef CONFIG_64BIT
8#undef dereference_function_descriptor
9void *dereference_function_descriptor(void *);
10#endif
11
12#endif
diff --git a/include/asm-parisc/segment.h b/include/asm-parisc/segment.h
deleted file mode 100644
index 26794ddb6524..000000000000
--- a/include/asm-parisc/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PARISC_SEGMENT_H
2#define __PARISC_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif
diff --git a/include/asm-parisc/sembuf.h b/include/asm-parisc/sembuf.h
deleted file mode 100644
index 1e59ffd3bd1e..000000000000
--- a/include/asm-parisc/sembuf.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _PARISC_SEMBUF_H
2#define _PARISC_SEMBUF_H
3
4/*
5 * The semid64_ds structure for parisc architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16#ifndef CONFIG_64BIT
17 unsigned int __pad1;
18#endif
19 __kernel_time_t sem_otime; /* last semop time */
20#ifndef CONFIG_64BIT
21 unsigned int __pad2;
22#endif
23 __kernel_time_t sem_ctime; /* last change time */
24 unsigned int sem_nsems; /* no. of semaphores in array */
25 unsigned int __unused1;
26 unsigned int __unused2;
27};
28
29#endif /* _PARISC_SEMBUF_H */
diff --git a/include/asm-parisc/serial.h b/include/asm-parisc/serial.h
deleted file mode 100644
index d7e3cc60dbc3..000000000000
--- a/include/asm-parisc/serial.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * include/asm-parisc/serial.h
3 */
4
5/*
6 * This is used for 16550-compatible UARTs
7 */
8#define BASE_BAUD ( 1843200 / 16 )
9
10#define SERIAL_PORT_DFNS
diff --git a/include/asm-parisc/setup.h b/include/asm-parisc/setup.h
deleted file mode 100644
index 7da2e5b8747e..000000000000
--- a/include/asm-parisc/setup.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PARISC_SETUP_H
2#define _PARISC_SETUP_H
3
4#define COMMAND_LINE_SIZE 1024
5
6#endif /* _PARISC_SETUP_H */
diff --git a/include/asm-parisc/shmbuf.h b/include/asm-parisc/shmbuf.h
deleted file mode 100644
index 0a3eada1863b..000000000000
--- a/include/asm-parisc/shmbuf.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PARISC_SHMBUF_H
2#define _PARISC_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for parisc architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16#ifndef CONFIG_64BIT
17 unsigned int __pad1;
18#endif
19 __kernel_time_t shm_atime; /* last attach time */
20#ifndef CONFIG_64BIT
21 unsigned int __pad2;
22#endif
23 __kernel_time_t shm_dtime; /* last detach time */
24#ifndef CONFIG_64BIT
25 unsigned int __pad3;
26#endif
27 __kernel_time_t shm_ctime; /* last change time */
28#ifndef CONFIG_64BIT
29 unsigned int __pad4;
30#endif
31 size_t shm_segsz; /* size of segment (bytes) */
32 __kernel_pid_t shm_cpid; /* pid of creator */
33 __kernel_pid_t shm_lpid; /* pid of last operator */
34 unsigned int shm_nattch; /* no. of current attaches */
35 unsigned int __unused1;
36 unsigned int __unused2;
37};
38
39#ifdef CONFIG_64BIT
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
42 * a wide kernel, but if some of these values are meant to contain pointers
43 * they may need to be 'long long' instead. -PB XXX FIXME
44 */
45#endif
46struct shminfo64 {
47 unsigned int shmmax;
48 unsigned int shmmin;
49 unsigned int shmmni;
50 unsigned int shmseg;
51 unsigned int shmall;
52 unsigned int __unused1;
53 unsigned int __unused2;
54 unsigned int __unused3;
55 unsigned int __unused4;
56};
57
58#endif /* _PARISC_SHMBUF_H */
diff --git a/include/asm-parisc/shmparam.h b/include/asm-parisc/shmparam.h
deleted file mode 100644
index 628ddc22faa8..000000000000
--- a/include/asm-parisc/shmparam.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASMPARISC_SHMPARAM_H
2#define _ASMPARISC_SHMPARAM_H
3
4#define __ARCH_FORCE_SHMLBA 1
5
6#define SHMLBA 0x00400000 /* attach addr needs to be 4 Mb aligned */
7
8#endif /* _ASMPARISC_SHMPARAM_H */
diff --git a/include/asm-parisc/sigcontext.h b/include/asm-parisc/sigcontext.h
deleted file mode 100644
index 27ef31bb3b6e..000000000000
--- a/include/asm-parisc/sigcontext.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASMPARISC_SIGCONTEXT_H
2#define _ASMPARISC_SIGCONTEXT_H
3
4#define PARISC_SC_FLAG_ONSTACK 1<<0
5#define PARISC_SC_FLAG_IN_SYSCALL 1<<1
6
7/* We will add more stuff here as it becomes necessary, until we know
8 it works. */
9struct sigcontext {
10 unsigned long sc_flags;
11
12 unsigned long sc_gr[32]; /* PSW in sc_gr[0] */
13 unsigned long long sc_fr[32]; /* FIXME, do we need other state info? */
14 unsigned long sc_iasq[2];
15 unsigned long sc_iaoq[2];
16 unsigned long sc_sar; /* cr11 */
17};
18
19
20#endif
diff --git a/include/asm-parisc/siginfo.h b/include/asm-parisc/siginfo.h
deleted file mode 100644
index d4909f55fe35..000000000000
--- a/include/asm-parisc/siginfo.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _PARISC_SIGINFO_H
2#define _PARISC_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6/*
7 * SIGTRAP si_codes
8 */
9#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
10#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */
11#undef NSIGTRAP
12#define NSIGTRAP 4
13
14#endif
diff --git a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h
deleted file mode 100644
index c20356375d1d..000000000000
--- a/include/asm-parisc/signal.h
+++ /dev/null
@@ -1,153 +0,0 @@
1#ifndef _ASM_PARISC_SIGNAL_H
2#define _ASM_PARISC_SIGNAL_H
3
4#define SIGHUP 1
5#define SIGINT 2
6#define SIGQUIT 3
7#define SIGILL 4
8#define SIGTRAP 5
9#define SIGABRT 6
10#define SIGIOT 6
11#define SIGEMT 7
12#define SIGFPE 8
13#define SIGKILL 9
14#define SIGBUS 10
15#define SIGSEGV 11
16#define SIGSYS 12 /* Linux doesn't use this */
17#define SIGPIPE 13
18#define SIGALRM 14
19#define SIGTERM 15
20#define SIGUSR1 16
21#define SIGUSR2 17
22#define SIGCHLD 18
23#define SIGPWR 19
24#define SIGVTALRM 20
25#define SIGPROF 21
26#define SIGIO 22
27#define SIGPOLL SIGIO
28#define SIGWINCH 23
29#define SIGSTOP 24
30#define SIGTSTP 25
31#define SIGCONT 26
32#define SIGTTIN 27
33#define SIGTTOU 28
34#define SIGURG 29
35#define SIGLOST 30 /* Linux doesn't use this either */
36#define SIGUNUSED 31
37#define SIGRESERVE SIGUNUSED
38
39#define SIGXCPU 33
40#define SIGXFSZ 34
41#define SIGSTKFLT 36
42
43/* These should not be considered constants from userland. */
44#define SIGRTMIN 37
45#define SIGRTMAX _NSIG /* it's 44 under HP/UX */
46
47/*
48 * SA_FLAGS values:
49 *
50 * SA_ONSTACK indicates that a registered stack_t will be used.
51 * SA_RESTART flag to get restarting signals (which were the default long ago)
52 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
53 * SA_RESETHAND clears the handler when the signal is delivered.
54 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
55 * SA_NODEFER prevents the current signal from being masked in the handler.
56 *
57 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
58 * Unix names RESETHAND and NODEFER respectively.
59 */
60#define SA_ONSTACK 0x00000001
61#define SA_RESETHAND 0x00000004
62#define SA_NOCLDSTOP 0x00000008
63#define SA_SIGINFO 0x00000010
64#define SA_NODEFER 0x00000020
65#define SA_RESTART 0x00000040
66#define SA_NOCLDWAIT 0x00000080
67#define _SA_SIGGFAULT 0x00000100 /* HPUX */
68
69#define SA_NOMASK SA_NODEFER
70#define SA_ONESHOT SA_RESETHAND
71
72#define SA_RESTORER 0x04000000 /* obsolete -- ignored */
73
74/*
75 * sigaltstack controls
76 */
77#define SS_ONSTACK 1
78#define SS_DISABLE 2
79
80#define MINSIGSTKSZ 2048
81#define SIGSTKSZ 8192
82
83#ifdef __KERNEL__
84
85#define _NSIG 64
86/* bits-per-word, where word apparently means 'long' not 'int' */
87#define _NSIG_BPW BITS_PER_LONG
88#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
89
90#endif /* __KERNEL__ */
91
92#define SIG_BLOCK 0 /* for blocking signals */
93#define SIG_UNBLOCK 1 /* for unblocking signals */
94#define SIG_SETMASK 2 /* for setting the signal mask */
95
96#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
97#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
98#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
99
100# ifndef __ASSEMBLY__
101
102# include <linux/types.h>
103
104/* Avoid too many header ordering problems. */
105struct siginfo;
106
107/* Type of a signal handler. */
108#ifdef CONFIG_64BIT
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
111 * the function in the little struct. This is really ugly -PB
112 */
113typedef char __user *__sighandler_t;
114#else
115typedef void __signalfn_t(int);
116typedef __signalfn_t __user *__sighandler_t;
117#endif
118
119typedef struct sigaltstack {
120 void __user *ss_sp;
121 int ss_flags;
122 size_t ss_size;
123} stack_t;
124
125#ifdef __KERNEL__
126
127/* Most things should be clean enough to redefine this at will, if care
128 is taken to make libc match. */
129
130typedef unsigned long old_sigset_t; /* at least 32 bits */
131
132typedef struct {
133 /* next_signal() assumes this is a long - no choice */
134 unsigned long sig[_NSIG_WORDS];
135} sigset_t;
136
137struct sigaction {
138 __sighandler_t sa_handler;
139 unsigned long sa_flags;
140 sigset_t sa_mask; /* mask last for extensibility */
141};
142
143struct k_sigaction {
144 struct sigaction sa;
145};
146
147#define ptrace_signal_deliver(regs, cookie) do { } while (0)
148
149#include <asm/sigcontext.h>
150
151#endif /* __KERNEL__ */
152#endif /* !__ASSEMBLY */
153#endif /* _ASM_PARISC_SIGNAL_H */
diff --git a/include/asm-parisc/smp.h b/include/asm-parisc/smp.h
deleted file mode 100644
index 398cdbaf4e54..000000000000
--- a/include/asm-parisc/smp.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef __ASM_SMP_H
2#define __ASM_SMP_H
3
4
5#if defined(CONFIG_SMP)
6
7/* Page Zero Location PDC will look for the address to branch to when we poke
8** slave CPUs still in "Icache loop".
9*/
10#define PDC_OS_BOOT_RENDEZVOUS 0x10
11#define PDC_OS_BOOT_RENDEZVOUS_HI 0x28
12
13#ifndef ASSEMBLY
14#include <linux/bitops.h>
15#include <linux/threads.h> /* for NR_CPUS */
16#include <linux/cpumask.h>
17typedef unsigned long address_t;
18
19extern cpumask_t cpu_online_map;
20
21
22/*
23 * Private routines/data
24 *
25 * physical and logical are equivalent until we support CPU hotplug.
26 */
27#define cpu_number_map(cpu) (cpu)
28#define cpu_logical_map(cpu) (cpu)
29
30extern void smp_send_reschedule(int cpu);
31extern void smp_send_all_nop(void);
32
33extern void arch_send_call_function_single_ipi(int cpu);
34extern void arch_send_call_function_ipi(cpumask_t mask);
35
36#endif /* !ASSEMBLY */
37
38/*
39 * This magic constant controls our willingness to transfer
40 * a process across CPUs. Such a transfer incurs cache and tlb
41 * misses. The current value is inherited from i386. Still needs
42 * to be tuned for parisc.
43 */
44
45#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */
46
47extern unsigned long cpu_present_mask;
48
49#define raw_smp_processor_id() (current_thread_info()->cpu)
50
51#else /* CONFIG_SMP */
52
53static inline void smp_send_all_nop(void) { return; }
54
55#endif
56
57#define NO_PROC_ID 0xFF /* No processor magic marker */
58#define ANY_PROC_ID 0xFF /* Any processor magic marker */
59static inline int __cpu_disable (void) {
60 return 0;
61}
62static inline void __cpu_die (unsigned int cpu) {
63 while(1)
64 ;
65}
66extern int __cpu_up (unsigned int cpu);
67
68#endif /* __ASM_SMP_H */
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
deleted file mode 100644
index fba402c95ac2..000000000000
--- a/include/asm-parisc/socket.h
+++ /dev/null
@@ -1,62 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 0xffff
8
9#define SO_DEBUG 0x0001
10#define SO_REUSEADDR 0x0004
11#define SO_KEEPALIVE 0x0008
12#define SO_DONTROUTE 0x0010
13#define SO_BROADCAST 0x0020
14#define SO_LINGER 0x0080
15#define SO_OOBINLINE 0x0100
16/* To add :#define SO_REUSEPORT 0x0200 */
17#define SO_SNDBUF 0x1001
18#define SO_RCVBUF 0x1002
19#define SO_SNDBUFFORCE 0x100a
20#define SO_RCVBUFFORCE 0x100b
21#define SO_SNDLOWAT 0x1003
22#define SO_RCVLOWAT 0x1004
23#define SO_SNDTIMEO 0x1005
24#define SO_RCVTIMEO 0x1006
25#define SO_ERROR 0x1007
26#define SO_TYPE 0x1008
27#define SO_PEERNAME 0x2000
28
29#define SO_NO_CHECK 0x400b
30#define SO_PRIORITY 0x400c
31#define SO_BSDCOMPAT 0x400e
32#define SO_PASSCRED 0x4010
33#define SO_PEERCRED 0x4011
34#define SO_TIMESTAMP 0x4012
35#define SCM_TIMESTAMP SO_TIMESTAMP
36#define SO_TIMESTAMPNS 0x4013
37#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
38
39/* Security levels - as per NRL IPv6 - don't actually do anything */
40#define SO_SECURITY_AUTHENTICATION 0x4016
41#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017
42#define SO_SECURITY_ENCRYPTION_NETWORK 0x4018
43
44#define SO_BINDTODEVICE 0x4019
45
46/* Socket filtering */
47#define SO_ATTACH_FILTER 0x401a
48#define SO_DETACH_FILTER 0x401b
49
50#define SO_ACCEPTCONN 0x401c
51
52#define SO_PEERSEC 0x401d
53#define SO_PASSSEC 0x401e
54
55#define SO_MARK 0x401f
56
57/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
58 * have to define SOCK_NONBLOCK to a different value here.
59 */
60#define SOCK_NONBLOCK 0x40000000
61
62#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-parisc/sockios.h b/include/asm-parisc/sockios.h
deleted file mode 100644
index dabfbc7483f6..000000000000
--- a/include/asm-parisc/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_PARISC_SOCKIOS__
2#define __ARCH_PARISC_SOCKIOS__
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif
diff --git a/include/asm-parisc/spinlock.h b/include/asm-parisc/spinlock.h
deleted file mode 100644
index f3d2090a18dc..000000000000
--- a/include/asm-parisc/spinlock.h
+++ /dev/null
@@ -1,194 +0,0 @@
1#ifndef __ASM_SPINLOCK_H
2#define __ASM_SPINLOCK_H
3
4#include <asm/system.h>
5#include <asm/processor.h>
6#include <asm/spinlock_types.h>
7
8static inline int __raw_spin_is_locked(raw_spinlock_t *x)
9{
10 volatile unsigned int *a = __ldcw_align(x);
11 return *a == 0;
12}
13
14#define __raw_spin_lock(lock) __raw_spin_lock_flags(lock, 0)
15#define __raw_spin_unlock_wait(x) \
16 do { cpu_relax(); } while (__raw_spin_is_locked(x))
17
18static inline void __raw_spin_lock_flags(raw_spinlock_t *x,
19 unsigned long flags)
20{
21 volatile unsigned int *a;
22
23 mb();
24 a = __ldcw_align(x);
25 while (__ldcw(a) == 0)
26 while (*a == 0)
27 if (flags & PSW_SM_I) {
28 local_irq_enable();
29 cpu_relax();
30 local_irq_disable();
31 } else
32 cpu_relax();
33 mb();
34}
35
36static inline void __raw_spin_unlock(raw_spinlock_t *x)
37{
38 volatile unsigned int *a;
39 mb();
40 a = __ldcw_align(x);
41 *a = 1;
42 mb();
43}
44
45static inline int __raw_spin_trylock(raw_spinlock_t *x)
46{
47 volatile unsigned int *a;
48 int ret;
49
50 mb();
51 a = __ldcw_align(x);
52 ret = __ldcw(a) != 0;
53 mb();
54
55 return ret;
56}
57
58/*
59 * Read-write spinlocks, allowing multiple readers but only one writer.
60 * Linux rwlocks are unfair to writers; they can be starved for an indefinite
61 * time by readers. With care, they can also be taken in interrupt context.
62 *
63 * In the PA-RISC implementation, we have a spinlock and a counter.
64 * Readers use the lock to serialise their access to the counter (which
65 * records how many readers currently hold the lock).
66 * Writers hold the spinlock, preventing any readers or other writers from
67 * grabbing the rwlock.
68 */
69
70/* Note that we have to ensure interrupts are disabled in case we're
71 * interrupted by some other code that wants to grab the same read lock */
72static __inline__ void __raw_read_lock(raw_rwlock_t *rw)
73{
74 unsigned long flags;
75 local_irq_save(flags);
76 __raw_spin_lock_flags(&rw->lock, flags);
77 rw->counter++;
78 __raw_spin_unlock(&rw->lock);
79 local_irq_restore(flags);
80}
81
82/* Note that we have to ensure interrupts are disabled in case we're
83 * interrupted by some other code that wants to grab the same read lock */
84static __inline__ void __raw_read_unlock(raw_rwlock_t *rw)
85{
86 unsigned long flags;
87 local_irq_save(flags);
88 __raw_spin_lock_flags(&rw->lock, flags);
89 rw->counter--;
90 __raw_spin_unlock(&rw->lock);
91 local_irq_restore(flags);
92}
93
94/* Note that we have to ensure interrupts are disabled in case we're
95 * interrupted by some other code that wants to grab the same read lock */
96static __inline__ int __raw_read_trylock(raw_rwlock_t *rw)
97{
98 unsigned long flags;
99 retry:
100 local_irq_save(flags);
101 if (__raw_spin_trylock(&rw->lock)) {
102 rw->counter++;
103 __raw_spin_unlock(&rw->lock);
104 local_irq_restore(flags);
105 return 1;
106 }
107
108 local_irq_restore(flags);
109 /* If write-locked, we fail to acquire the lock */
110 if (rw->counter < 0)
111 return 0;
112
113 /* Wait until we have a realistic chance at the lock */
114 while (__raw_spin_is_locked(&rw->lock) && rw->counter >= 0)
115 cpu_relax();
116
117 goto retry;
118}
119
120/* Note that we have to ensure interrupts are disabled in case we're
121 * interrupted by some other code that wants to read_trylock() this lock */
122static __inline__ void __raw_write_lock(raw_rwlock_t *rw)
123{
124 unsigned long flags;
125retry:
126 local_irq_save(flags);
127 __raw_spin_lock_flags(&rw->lock, flags);
128
129 if (rw->counter != 0) {
130 __raw_spin_unlock(&rw->lock);
131 local_irq_restore(flags);
132
133 while (rw->counter != 0)
134 cpu_relax();
135
136 goto retry;
137 }
138
139 rw->counter = -1; /* mark as write-locked */
140 mb();
141 local_irq_restore(flags);
142}
143
144static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
145{
146 rw->counter = 0;
147 __raw_spin_unlock(&rw->lock);
148}
149
150/* Note that we have to ensure interrupts are disabled in case we're
151 * interrupted by some other code that wants to read_trylock() this lock */
152static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
153{
154 unsigned long flags;
155 int result = 0;
156
157 local_irq_save(flags);
158 if (__raw_spin_trylock(&rw->lock)) {
159 if (rw->counter == 0) {
160 rw->counter = -1;
161 result = 1;
162 } else {
163 /* Read-locked. Oh well. */
164 __raw_spin_unlock(&rw->lock);
165 }
166 }
167 local_irq_restore(flags);
168
169 return result;
170}
171
172/*
173 * read_can_lock - would read_trylock() succeed?
174 * @lock: the rwlock in question.
175 */
176static __inline__ int __raw_read_can_lock(raw_rwlock_t *rw)
177{
178 return rw->counter >= 0;
179}
180
181/*
182 * write_can_lock - would write_trylock() succeed?
183 * @lock: the rwlock in question.
184 */
185static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw)
186{
187 return !rw->counter;
188}
189
190#define _raw_spin_relax(lock) cpu_relax()
191#define _raw_read_relax(lock) cpu_relax()
192#define _raw_write_relax(lock) cpu_relax()
193
194#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-parisc/spinlock_types.h b/include/asm-parisc/spinlock_types.h
deleted file mode 100644
index 3f72f47cf4b2..000000000000
--- a/include/asm-parisc/spinlock_types.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4typedef struct {
5#ifdef CONFIG_PA20
6 volatile unsigned int slock;
7# define __RAW_SPIN_LOCK_UNLOCKED { 1 }
8#else
9 volatile unsigned int lock[4];
10# define __RAW_SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } }
11#endif
12} raw_spinlock_t;
13
14typedef struct {
15 raw_spinlock_t lock;
16 volatile int counter;
17} raw_rwlock_t;
18
19#define __RAW_RW_LOCK_UNLOCKED { __RAW_SPIN_LOCK_UNLOCKED, 0 }
20
21#endif
diff --git a/include/asm-parisc/stat.h b/include/asm-parisc/stat.h
deleted file mode 100644
index 9d5fbbc5c31f..000000000000
--- a/include/asm-parisc/stat.h
+++ /dev/null
@@ -1,100 +0,0 @@
1#ifndef _PARISC_STAT_H
2#define _PARISC_STAT_H
3
4#include <linux/types.h>
5
6struct stat {
7 unsigned int st_dev; /* dev_t is 32 bits on parisc */
8 ino_t st_ino; /* 32 bits */
9 mode_t st_mode; /* 16 bits */
10 nlink_t st_nlink; /* 16 bits */
11 unsigned short st_reserved1; /* old st_uid */
12 unsigned short st_reserved2; /* old st_gid */
13 unsigned int st_rdev;
14 off_t st_size;
15 time_t st_atime;
16 unsigned int st_atime_nsec;
17 time_t st_mtime;
18 unsigned int st_mtime_nsec;
19 time_t st_ctime;
20 unsigned int st_ctime_nsec;
21 int st_blksize;
22 int st_blocks;
23 unsigned int __unused1; /* ACL stuff */
24 unsigned int __unused2; /* network */
25 ino_t __unused3; /* network */
26 unsigned int __unused4; /* cnodes */
27 unsigned short __unused5; /* netsite */
28 short st_fstype;
29 unsigned int st_realdev;
30 unsigned short st_basemode;
31 unsigned short st_spareshort;
32 uid_t st_uid;
33 gid_t st_gid;
34 unsigned int st_spare4[3];
35};
36
37#define STAT_HAVE_NSEC
38
39typedef __kernel_off64_t off64_t;
40
41struct hpux_stat64 {
42 unsigned int st_dev; /* dev_t is 32 bits on parisc */
43 ino_t st_ino; /* 32 bits */
44 mode_t st_mode; /* 16 bits */
45 nlink_t st_nlink; /* 16 bits */
46 unsigned short st_reserved1; /* old st_uid */
47 unsigned short st_reserved2; /* old st_gid */
48 unsigned int st_rdev;
49 off64_t st_size;
50 time_t st_atime;
51 unsigned int st_spare1;
52 time_t st_mtime;
53 unsigned int st_spare2;
54 time_t st_ctime;
55 unsigned int st_spare3;
56 int st_blksize;
57 __u64 st_blocks;
58 unsigned int __unused1; /* ACL stuff */
59 unsigned int __unused2; /* network */
60 ino_t __unused3; /* network */
61 unsigned int __unused4; /* cnodes */
62 unsigned short __unused5; /* netsite */
63 short st_fstype;
64 unsigned int st_realdev;
65 unsigned short st_basemode;
66 unsigned short st_spareshort;
67 uid_t st_uid;
68 gid_t st_gid;
69 unsigned int st_spare4[3];
70};
71
72/* This is the struct that 32-bit userspace applications are expecting.
73 * How 64-bit apps are going to be compiled, I have no idea. But at least
74 * this way, we don't have a wrapper in the kernel.
75 */
76struct stat64 {
77 unsigned long long st_dev;
78 unsigned int __pad1;
79
80 unsigned int __st_ino; /* Not actually filled in */
81 unsigned int st_mode;
82 unsigned int st_nlink;
83 unsigned int st_uid;
84 unsigned int st_gid;
85 unsigned long long st_rdev;
86 unsigned int __pad2;
87 signed long long st_size;
88 signed int st_blksize;
89
90 signed long long st_blocks;
91 signed int st_atime;
92 unsigned int st_atime_nsec;
93 signed int st_mtime;
94 unsigned int st_mtime_nsec;
95 signed int st_ctime;
96 unsigned int st_ctime_nsec;
97 unsigned long long st_ino;
98};
99
100#endif
diff --git a/include/asm-parisc/statfs.h b/include/asm-parisc/statfs.h
deleted file mode 100644
index 1d2b8130b23d..000000000000
--- a/include/asm-parisc/statfs.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PARISC_STATFS_H
2#define _PARISC_STATFS_H
3
4#ifndef __KERNEL_STRICT_NAMES
5
6#include <linux/types.h>
7
8typedef __kernel_fsid_t fsid_t;
9
10#endif
11
12/*
13 * It appears that PARISC could be 64 _or_ 32 bit.
14 * 64-bit fields must be explicitly 64-bit in statfs64.
15 */
16struct statfs {
17 long f_type;
18 long f_bsize;
19 long f_blocks;
20 long f_bfree;
21 long f_bavail;
22 long f_files;
23 long f_ffree;
24 __kernel_fsid_t f_fsid;
25 long f_namelen;
26 long f_frsize;
27 long f_spare[5];
28};
29
30struct statfs64 {
31 long f_type;
32 long f_bsize;
33 __u64 f_blocks;
34 __u64 f_bfree;
35 __u64 f_bavail;
36 __u64 f_files;
37 __u64 f_ffree;
38 __kernel_fsid_t f_fsid;
39 long f_namelen;
40 long f_frsize;
41 long f_spare[5];
42};
43
44struct compat_statfs64 {
45 __u32 f_type;
46 __u32 f_bsize;
47 __u64 f_blocks;
48 __u64 f_bfree;
49 __u64 f_bavail;
50 __u64 f_files;
51 __u64 f_ffree;
52 __kernel_fsid_t f_fsid;
53 __u32 f_namelen;
54 __u32 f_frsize;
55 __u32 f_spare[5];
56};
57
58#endif
diff --git a/include/asm-parisc/string.h b/include/asm-parisc/string.h
deleted file mode 100644
index eda01be65e35..000000000000
--- a/include/asm-parisc/string.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _PA_STRING_H_
2#define _PA_STRING_H_
3
4#define __HAVE_ARCH_MEMSET
5extern void * memset(void *, int, size_t);
6
7#define __HAVE_ARCH_MEMCPY
8void * memcpy(void * dest,const void *src,size_t count);
9
10#endif
diff --git a/include/asm-parisc/superio.h b/include/asm-parisc/superio.h
deleted file mode 100644
index 6598acb4d46d..000000000000
--- a/include/asm-parisc/superio.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#ifndef _PARISC_SUPERIO_H
2#define _PARISC_SUPERIO_H
3
4#define IC_PIC1 0x20 /* PCI I/O address of master 8259 */
5#define IC_PIC2 0xA0 /* PCI I/O address of slave */
6
7/* Config Space Offsets to configuration and base address registers */
8#define SIO_CR 0x5A /* Configuration Register */
9#define SIO_ACPIBAR 0x88 /* ACPI BAR */
10#define SIO_FDCBAR 0x90 /* Floppy Disk Controller BAR */
11#define SIO_SP1BAR 0x94 /* Serial 1 BAR */
12#define SIO_SP2BAR 0x98 /* Serial 2 BAR */
13#define SIO_PPBAR 0x9C /* Parallel BAR */
14
15#define TRIGGER_1 0x67 /* Edge/level trigger register 1 */
16#define TRIGGER_2 0x68 /* Edge/level trigger register 2 */
17
18/* Interrupt Routing Control registers */
19#define CFG_IR_SER 0x69 /* Serial 1 [0:3] and Serial 2 [4:7] */
20#define CFG_IR_PFD 0x6a /* Parallel [0:3] and Floppy [4:7] */
21#define CFG_IR_IDE 0x6b /* IDE1 [0:3] and IDE2 [4:7] */
22#define CFG_IR_INTAB 0x6c /* PCI INTA [0:3] and INT B [4:7] */
23#define CFG_IR_INTCD 0x6d /* PCI INTC [0:3] and INT D [4:7] */
24#define CFG_IR_PS2 0x6e /* PS/2 KBINT [0:3] and Mouse [4:7] */
25#define CFG_IR_FXBUS 0x6f /* FXIRQ[0] [0:3] and FXIRQ[1] [4:7] */
26#define CFG_IR_USB 0x70 /* FXIRQ[2] [0:3] and USB [4:7] */
27#define CFG_IR_ACPI 0x71 /* ACPI SCI [0:3] and reserved [4:7] */
28
29#define CFG_IR_LOW CFG_IR_SER /* Lowest interrupt routing reg */
30#define CFG_IR_HIGH CFG_IR_ACPI /* Highest interrupt routing reg */
31
32/* 8259 operational control words */
33#define OCW2_EOI 0x20 /* Non-specific EOI */
34#define OCW2_SEOI 0x60 /* Specific EOI */
35#define OCW3_IIR 0x0A /* Read request register */
36#define OCW3_ISR 0x0B /* Read service register */
37#define OCW3_POLL 0x0C /* Poll the PIC for an interrupt vector */
38
39/* Interrupt lines. Only PIC1 is used */
40#define USB_IRQ 1 /* USB */
41#define SP1_IRQ 3 /* Serial port 1 */
42#define SP2_IRQ 4 /* Serial port 2 */
43#define PAR_IRQ 5 /* Parallel port */
44#define FDC_IRQ 6 /* Floppy controller */
45#define IDE_IRQ 7 /* IDE (pri+sec) */
46
47/* ACPI registers */
48#define USB_REG_CR 0x1f /* USB Regulator Control Register */
49
50#define SUPERIO_NIRQS 8
51
52struct superio_device {
53 u32 fdc_base;
54 u32 sp1_base;
55 u32 sp2_base;
56 u32 pp_base;
57 u32 acpi_base;
58 int suckyio_irq_enabled;
59 struct pci_dev *lio_pdev; /* pci device for legacy IO (fn 1) */
60 struct pci_dev *usb_pdev; /* pci device for USB (fn 2) */
61};
62
63/*
64 * Does NS make a 87415 based plug in PCI card? If so, because of this
65 * macro we currently don't support it being plugged into a machine
66 * that contains a SuperIO chip AND has CONFIG_SUPERIO enabled.
67 *
68 * This could be fixed by checking to see if function 1 exists, and
69 * if it is SuperIO Legacy IO; but really now, is this combination
70 * going to EVER happen?
71 */
72
73#define SUPERIO_IDE_FN 0 /* Function number of IDE controller */
74#define SUPERIO_LIO_FN 1 /* Function number of Legacy IO controller */
75#define SUPERIO_USB_FN 2 /* Function number of USB controller */
76
77#define is_superio_device(x) \
78 (((x)->vendor == PCI_VENDOR_ID_NS) && \
79 ( ((x)->device == PCI_DEVICE_ID_NS_87415) \
80 || ((x)->device == PCI_DEVICE_ID_NS_87560_LIO) \
81 || ((x)->device == PCI_DEVICE_ID_NS_87560_USB) ) )
82
83extern int superio_fixup_irq(struct pci_dev *pcidev); /* called by iosapic */
84
85#endif /* _PARISC_SUPERIO_H */
diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h
deleted file mode 100644
index ee80c920b464..000000000000
--- a/include/asm-parisc/system.h
+++ /dev/null
@@ -1,182 +0,0 @@
1#ifndef __PARISC_SYSTEM_H
2#define __PARISC_SYSTEM_H
3
4#include <asm/psw.h>
5
6/* The program status word as bitfields. */
7struct pa_psw {
8 unsigned int y:1;
9 unsigned int z:1;
10 unsigned int rv:2;
11 unsigned int w:1;
12 unsigned int e:1;
13 unsigned int s:1;
14 unsigned int t:1;
15
16 unsigned int h:1;
17 unsigned int l:1;
18 unsigned int n:1;
19 unsigned int x:1;
20 unsigned int b:1;
21 unsigned int c:1;
22 unsigned int v:1;
23 unsigned int m:1;
24
25 unsigned int cb:8;
26
27 unsigned int o:1;
28 unsigned int g:1;
29 unsigned int f:1;
30 unsigned int r:1;
31 unsigned int q:1;
32 unsigned int p:1;
33 unsigned int d:1;
34 unsigned int i:1;
35};
36
37#ifdef CONFIG_64BIT
38#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW + 4))
39#else
40#define pa_psw(task) ((struct pa_psw *) ((char *) (task) + TASK_PT_PSW))
41#endif
42
43struct task_struct;
44
45extern struct task_struct *_switch_to(struct task_struct *, struct task_struct *);
46
47#define switch_to(prev, next, last) do { \
48 (last) = _switch_to(prev, next); \
49} while(0)
50
51/* interrupt control */
52#define local_save_flags(x) __asm__ __volatile__("ssm 0, %0" : "=r" (x) : : "memory")
53#define local_irq_disable() __asm__ __volatile__("rsm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
54#define local_irq_enable() __asm__ __volatile__("ssm %0,%%r0\n" : : "i" (PSW_I) : "memory" )
55
56#define local_irq_save(x) \
57 __asm__ __volatile__("rsm %1,%0" : "=r" (x) :"i" (PSW_I) : "memory" )
58#define local_irq_restore(x) \
59 __asm__ __volatile__("mtsm %0" : : "r" (x) : "memory" )
60
61#define irqs_disabled() \
62({ \
63 unsigned long flags; \
64 local_save_flags(flags); \
65 (flags & PSW_I) == 0; \
66})
67
68#define mfctl(reg) ({ \
69 unsigned long cr; \
70 __asm__ __volatile__( \
71 "mfctl " #reg ",%0" : \
72 "=r" (cr) \
73 ); \
74 cr; \
75})
76
77#define mtctl(gr, cr) \
78 __asm__ __volatile__("mtctl %0,%1" \
79 : /* no outputs */ \
80 : "r" (gr), "i" (cr) : "memory")
81
82/* these are here to de-mystefy the calling code, and to provide hooks */
83/* which I needed for debugging EIEM problems -PB */
84#define get_eiem() mfctl(15)
85static inline void set_eiem(unsigned long val)
86{
87 mtctl(val, 15);
88}
89
90#define mfsp(reg) ({ \
91 unsigned long cr; \
92 __asm__ __volatile__( \
93 "mfsp " #reg ",%0" : \
94 "=r" (cr) \
95 ); \
96 cr; \
97})
98
99#define mtsp(gr, cr) \
100 __asm__ __volatile__("mtsp %0,%1" \
101 : /* no outputs */ \
102 : "r" (gr), "i" (cr) : "memory")
103
104
105/*
106** This is simply the barrier() macro from linux/kernel.h but when serial.c
107** uses tqueue.h uses smp_mb() defined using barrier(), linux/kernel.h
108** hasn't yet been included yet so it fails, thus repeating the macro here.
109**
110** PA-RISC architecture allows for weakly ordered memory accesses although
111** none of the processors use it. There is a strong ordered bit that is
112** set in the O-bit of the page directory entry. Operating systems that
113** can not tolerate out of order accesses should set this bit when mapping
114** pages. The O-bit of the PSW should also be set to 1 (I don't believe any
115** of the processor implemented the PSW O-bit). The PCX-W ERS states that
116** the TLB O-bit is not implemented so the page directory does not need to
117** have the O-bit set when mapping pages (section 3.1). This section also
118** states that the PSW Y, Z, G, and O bits are not implemented.
119** So it looks like nothing needs to be done for parisc-linux (yet).
120** (thanks to chada for the above comment -ggg)
121**
122** The __asm__ op below simple prevents gcc/ld from reordering
123** instructions across the mb() "call".
124*/
125#define mb() __asm__ __volatile__("":::"memory") /* barrier() */
126#define rmb() mb()
127#define wmb() mb()
128#define smp_mb() mb()
129#define smp_rmb() mb()
130#define smp_wmb() mb()
131#define smp_read_barrier_depends() do { } while(0)
132#define read_barrier_depends() do { } while(0)
133
134#define set_mb(var, value) do { var = value; mb(); } while (0)
135
136#ifndef CONFIG_PA20
137/* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
138 and GCC only guarantees 8-byte alignment for stack locals, we can't
139 be assured of 16-byte alignment for atomic lock data even if we
140 specify "__attribute ((aligned(16)))" in the type declaration. So,
141 we use a struct containing an array of four ints for the atomic lock
142 type and dynamically select the 16-byte aligned int from the array
143 for the semaphore. */
144
145#define __PA_LDCW_ALIGNMENT 16
146#define __ldcw_align(a) ({ \
147 unsigned long __ret = (unsigned long) &(a)->lock[0]; \
148 __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \
149 & ~(__PA_LDCW_ALIGNMENT - 1); \
150 (volatile unsigned int *) __ret; \
151})
152#define __LDCW "ldcw"
153
154#else /*CONFIG_PA20*/
155/* From: "Jim Hull" <jim.hull of hp.com>
156 I've attached a summary of the change, but basically, for PA 2.0, as
157 long as the ",CO" (coherent operation) completer is specified, then the
158 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead
159 they only require "natural" alignment (4-byte for ldcw, 8-byte for
160 ldcd). */
161
162#define __PA_LDCW_ALIGNMENT 4
163#define __ldcw_align(a) ((volatile unsigned int *)a)
164#define __LDCW "ldcw,co"
165
166#endif /*!CONFIG_PA20*/
167
168/* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */
169#define __ldcw(a) ({ \
170 unsigned __ret; \
171 __asm__ __volatile__(__LDCW " 0(%1),%0" \
172 : "=r" (__ret) : "r" (a)); \
173 __ret; \
174})
175
176#ifdef CONFIG_SMP
177# define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
178#endif
179
180#define arch_align_stack(x) (x)
181
182#endif
diff --git a/include/asm-parisc/termbits.h b/include/asm-parisc/termbits.h
deleted file mode 100644
index d8bbc73b16b7..000000000000
--- a/include/asm-parisc/termbits.h
+++ /dev/null
@@ -1,200 +0,0 @@
1#ifndef __ARCH_PARISC_TERMBITS_H__
2#define __ARCH_PARISC_TERMBITS_H__
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61
62/* c_iflag bits */
63#define IGNBRK 0000001
64#define BRKINT 0000002
65#define IGNPAR 0000004
66#define PARMRK 0000010
67#define INPCK 0000020
68#define ISTRIP 0000040
69#define INLCR 0000100
70#define IGNCR 0000200
71#define ICRNL 0000400
72#define IUCLC 0001000
73#define IXON 0002000
74#define IXANY 0004000
75#define IXOFF 0010000
76#define IMAXBEL 0040000
77#define IUTF8 0100000
78
79/* c_oflag bits */
80#define OPOST 0000001
81#define OLCUC 0000002
82#define ONLCR 0000004
83#define OCRNL 0000010
84#define ONOCR 0000020
85#define ONLRET 0000040
86#define OFILL 0000100
87#define OFDEL 0000200
88#define NLDLY 0000400
89#define NL0 0000000
90#define NL1 0000400
91#define CRDLY 0003000
92#define CR0 0000000
93#define CR1 0001000
94#define CR2 0002000
95#define CR3 0003000
96#define TABDLY 0014000
97#define TAB0 0000000
98#define TAB1 0004000
99#define TAB2 0010000
100#define TAB3 0014000
101#define XTABS 0014000
102#define BSDLY 0020000
103#define BS0 0000000
104#define BS1 0020000
105#define VTDLY 0040000
106#define VT0 0000000
107#define VT1 0040000
108#define FFDLY 0100000
109#define FF0 0000000
110#define FF1 0100000
111
112/* c_cflag bit meaning */
113#define CBAUD 0010017
114#define B0 0000000 /* hang up */
115#define B50 0000001
116#define B75 0000002
117#define B110 0000003
118#define B134 0000004
119#define B150 0000005
120#define B200 0000006
121#define B300 0000007
122#define B600 0000010
123#define B1200 0000011
124#define B1800 0000012
125#define B2400 0000013
126#define B4800 0000014
127#define B9600 0000015
128#define B19200 0000016
129#define B38400 0000017
130#define EXTA B19200
131#define EXTB B38400
132#define CSIZE 0000060
133#define CS5 0000000
134#define CS6 0000020
135#define CS7 0000040
136#define CS8 0000060
137#define CSTOPB 0000100
138#define CREAD 0000200
139#define PARENB 0000400
140#define PARODD 0001000
141#define HUPCL 0002000
142#define CLOCAL 0004000
143#define CBAUDEX 0010000
144#define BOTHER 0010000
145#define B57600 0010001
146#define B115200 0010002
147#define B230400 0010003
148#define B460800 0010004
149#define B500000 0010005
150#define B576000 0010006
151#define B921600 0010007
152#define B1000000 0010010
153#define B1152000 0010011
154#define B1500000 0010012
155#define B2000000 0010013
156#define B2500000 0010014
157#define B3000000 0010015
158#define B3500000 0010016
159#define B4000000 0010017
160#define CIBAUD 002003600000 /* input baud rate */
161#define CMSPAR 010000000000 /* mark or space (stick) parity */
162#define CRTSCTS 020000000000 /* flow control */
163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
166
167/* c_lflag bits */
168#define ISIG 0000001
169#define ICANON 0000002
170#define XCASE 0000004
171#define ECHO 0000010
172#define ECHOE 0000020
173#define ECHOK 0000040
174#define ECHONL 0000100
175#define NOFLSH 0000200
176#define TOSTOP 0000400
177#define ECHOCTL 0001000
178#define ECHOPRT 0002000
179#define ECHOKE 0004000
180#define FLUSHO 0010000
181#define PENDIN 0040000
182#define IEXTEN 0100000
183
184/* tcflow() and TCXONC use these */
185#define TCOOFF 0
186#define TCOON 1
187#define TCIOFF 2
188#define TCION 3
189
190/* tcflush() and TCFLSH use these */
191#define TCIFLUSH 0
192#define TCOFLUSH 1
193#define TCIOFLUSH 2
194
195/* tcsetattr uses these */
196#define TCSANOW 0
197#define TCSADRAIN 1
198#define TCSAFLUSH 2
199
200#endif
diff --git a/include/asm-parisc/termios.h b/include/asm-parisc/termios.h
deleted file mode 100644
index a2a57a4548af..000000000000
--- a/include/asm-parisc/termios.h
+++ /dev/null
@@ -1,90 +0,0 @@
1#ifndef _PARISC_TERMIOS_H
2#define _PARISC_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42#ifdef __KERNEL__
43
44/* intr=^C quit=^\ erase=del kill=^U
45 eof=^D vtime=\0 vmin=\1 sxtc=\0
46 start=^Q stop=^S susp=^Z eol=\0
47 reprint=^R discard=^U werase=^W lnext=^V
48 eol2=\0
49*/
50#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
51
52/*
53 * Translate a "termio" structure into a "termios". Ugh.
54 */
55#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
56 unsigned short __tmp; \
57 get_user(__tmp,&(termio)->x); \
58 *(unsigned short *) &(termios)->x = __tmp; \
59}
60
61#define user_termio_to_kernel_termios(termios, termio) \
62({ \
63 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
64 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
67 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
68})
69
70/*
71 * Translate a "termios" structure into a "termio". Ugh.
72 */
73#define kernel_termios_to_user_termio(termio, termios) \
74({ \
75 put_user((termios)->c_iflag, &(termio)->c_iflag); \
76 put_user((termios)->c_oflag, &(termio)->c_oflag); \
77 put_user((termios)->c_cflag, &(termio)->c_cflag); \
78 put_user((termios)->c_lflag, &(termio)->c_lflag); \
79 put_user((termios)->c_line, &(termio)->c_line); \
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81})
82
83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87
88#endif /* __KERNEL__ */
89
90#endif /* _PARISC_TERMIOS_H */
diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h
deleted file mode 100644
index 9f812741c355..000000000000
--- a/include/asm-parisc/thread_info.h
+++ /dev/null
@@ -1,74 +0,0 @@
1#ifndef _ASM_PARISC_THREAD_INFO_H
2#define _ASM_PARISC_THREAD_INFO_H
3
4#ifdef __KERNEL__
5
6#ifndef __ASSEMBLY__
7#include <asm/processor.h>
8
9struct thread_info {
10 struct task_struct *task; /* main task structure */
11 struct exec_domain *exec_domain;/* execution domain */
12 unsigned long flags; /* thread_info flags (see TIF_*) */
13 mm_segment_t addr_limit; /* user-level address space limit */
14 __u32 cpu; /* current CPU */
15 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
16 struct restart_block restart_block;
17};
18
19#define INIT_THREAD_INFO(tsk) \
20{ \
21 .task = &tsk, \
22 .exec_domain = &default_exec_domain, \
23 .flags = 0, \
24 .cpu = 0, \
25 .addr_limit = KERNEL_DS, \
26 .preempt_count = 1, \
27 .restart_block = { \
28 .fn = do_no_restart_syscall \
29 } \
30}
31
32#define init_thread_info (init_thread_union.thread_info)
33#define init_stack (init_thread_union.stack)
34
35/* thread information allocation */
36
37#define THREAD_SIZE_ORDER 2
38/* Be sure to hunt all references to this down when you change the size of
39 * the kernel stack */
40#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
41#define THREAD_SHIFT (PAGE_SHIFT + THREAD_SIZE_ORDER)
42
43/* how to get the thread information struct from C */
44#define current_thread_info() ((struct thread_info *)mfctl(30))
45
46#endif /* !__ASSEMBLY */
47
48#define PREEMPT_ACTIVE_BIT 28
49#define PREEMPT_ACTIVE (1 << PREEMPT_ACTIVE_BIT)
50
51/*
52 * thread information flags
53 */
54#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
55#define TIF_SIGPENDING 1 /* signal pending */
56#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
57#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling TIF_NEED_RESCHED */
58#define TIF_32BIT 4 /* 32 bit binary */
59#define TIF_MEMDIE 5
60#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
61
62#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
63#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
64#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
65#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
66#define _TIF_32BIT (1 << TIF_32BIT)
67#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
68
69#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | \
70 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
71
72#endif /* __KERNEL__ */
73
74#endif /* _ASM_PARISC_THREAD_INFO_H */
diff --git a/include/asm-parisc/timex.h b/include/asm-parisc/timex.h
deleted file mode 100644
index 3b68d77273d9..000000000000
--- a/include/asm-parisc/timex.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * linux/include/asm-parisc/timex.h
3 *
4 * PARISC architecture timex specifications
5 */
6#ifndef _ASMPARISC_TIMEX_H
7#define _ASMPARISC_TIMEX_H
8
9#include <asm/system.h>
10
11#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
12
13typedef unsigned long cycles_t;
14
15static inline cycles_t get_cycles (void)
16{
17 return mfctl(16);
18}
19
20#endif
diff --git a/include/asm-parisc/tlb.h b/include/asm-parisc/tlb.h
deleted file mode 100644
index 383b1db310ee..000000000000
--- a/include/asm-parisc/tlb.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _PARISC_TLB_H
2#define _PARISC_TLB_H
3
4#define tlb_flush(tlb) \
5do { if ((tlb)->fullmm) \
6 flush_tlb_mm((tlb)->mm);\
7} while (0)
8
9#define tlb_start_vma(tlb, vma) \
10do { if (!(tlb)->fullmm) \
11 flush_cache_range(vma, vma->vm_start, vma->vm_end); \
12} while (0)
13
14#define tlb_end_vma(tlb, vma) \
15do { if (!(tlb)->fullmm) \
16 flush_tlb_range(vma, vma->vm_start, vma->vm_end); \
17} while (0)
18
19#define __tlb_remove_tlb_entry(tlb, pte, address) \
20 do { } while (0)
21
22#include <asm-generic/tlb.h>
23
24#define __pmd_free_tlb(tlb, pmd) pmd_free((tlb)->mm, pmd)
25#define __pte_free_tlb(tlb, pte) pte_free((tlb)->mm, pte)
26
27#endif
diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h
deleted file mode 100644
index b72ec66db699..000000000000
--- a/include/asm-parisc/tlbflush.h
+++ /dev/null
@@ -1,80 +0,0 @@
1#ifndef _PARISC_TLBFLUSH_H
2#define _PARISC_TLBFLUSH_H
3
4/* TLB flushing routines.... */
5
6#include <linux/mm.h>
7#include <linux/sched.h>
8#include <asm/mmu_context.h>
9
10
11/* This is for the serialisation of PxTLB broadcasts. At least on the
12 * N class systems, only one PxTLB inter processor broadcast can be
13 * active at any one time on the Merced bus. This tlb purge
14 * synchronisation is fairly lightweight and harmless so we activate
15 * it on all SMP systems not just the N class. We also need to have
16 * preemption disabled on uniprocessor machines, and spin_lock does that
17 * nicely.
18 */
19extern spinlock_t pa_tlb_lock;
20
21#define purge_tlb_start(x) spin_lock(&pa_tlb_lock)
22#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
23
24extern void flush_tlb_all(void);
25extern void flush_tlb_all_local(void *);
26
27/*
28 * flush_tlb_mm()
29 *
30 * XXX This code is NOT valid for HP-UX compatibility processes,
31 * (although it will probably work 99% of the time). HP-UX
32 * processes are free to play with the space id's and save them
33 * over long periods of time, etc. so we have to preserve the
34 * space and just flush the entire tlb. We need to check the
35 * personality in order to do that, but the personality is not
36 * currently being set correctly.
37 *
38 * Of course, Linux processes could do the same thing, but
39 * we don't support that (and the compilers, dynamic linker,
40 * etc. do not do that).
41 */
42
43static inline void flush_tlb_mm(struct mm_struct *mm)
44{
45 BUG_ON(mm == &init_mm); /* Should never happen */
46
47#ifdef CONFIG_SMP
48 flush_tlb_all();
49#else
50 if (mm) {
51 if (mm->context != 0)
52 free_sid(mm->context);
53 mm->context = alloc_sid();
54 if (mm == current->active_mm)
55 load_context(mm->context);
56 }
57#endif
58}
59
60static inline void flush_tlb_page(struct vm_area_struct *vma,
61 unsigned long addr)
62{
63 /* For one page, it's not worth testing the split_tlb variable */
64
65 mb();
66 mtsp(vma->vm_mm->context,1);
67 purge_tlb_start();
68 pdtlb(addr);
69 pitlb(addr);
70 purge_tlb_end();
71}
72
73void __flush_tlb_range(unsigned long sid,
74 unsigned long start, unsigned long end);
75
76#define flush_tlb_range(vma,start,end) __flush_tlb_range((vma)->vm_mm->context,start,end)
77
78#define flush_tlb_kernel_range(start, end) __flush_tlb_range(0,start,end)
79
80#endif
diff --git a/include/asm-parisc/topology.h b/include/asm-parisc/topology.h
deleted file mode 100644
index d8133eb0b1e7..000000000000
--- a/include/asm-parisc/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_PARISC_TOPOLOGY_H
2#define _ASM_PARISC_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_PARISC_TOPOLOGY_H */
diff --git a/include/asm-parisc/traps.h b/include/asm-parisc/traps.h
deleted file mode 100644
index 1945f995f2df..000000000000
--- a/include/asm-parisc/traps.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_TRAPS_H
2#define __ASM_TRAPS_H
3
4#ifdef __KERNEL__
5struct pt_regs;
6
7/* traps.c */
8void parisc_terminate(char *msg, struct pt_regs *regs,
9 int code, unsigned long offset);
10
11/* mm/fault.c */
12void do_page_fault(struct pt_regs *regs, unsigned long code,
13 unsigned long address);
14#endif
15
16#endif
diff --git a/include/asm-parisc/types.h b/include/asm-parisc/types.h
deleted file mode 100644
index 7f5a39bfb4ce..000000000000
--- a/include/asm-parisc/types.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _PARISC_TYPES_H
2#define _PARISC_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/*
13 * These aren't exported outside the kernel to avoid name space clashes
14 */
15#ifdef __KERNEL__
16
17#ifdef CONFIG_64BIT
18#define BITS_PER_LONG 64
19#define SHIFT_PER_LONG 6
20#else
21#define BITS_PER_LONG 32
22#define SHIFT_PER_LONG 5
23#endif
24
25#ifndef __ASSEMBLY__
26
27/* Dma addresses are 32-bits wide. */
28
29typedef u32 dma_addr_t;
30typedef u64 dma64_addr_t;
31
32#endif /* __ASSEMBLY__ */
33
34#endif /* __KERNEL__ */
35
36#endif
diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h
deleted file mode 100644
index 4878b9501f24..000000000000
--- a/include/asm-parisc/uaccess.h
+++ /dev/null
@@ -1,244 +0,0 @@
1#ifndef __PARISC_UACCESS_H
2#define __PARISC_UACCESS_H
3
4/*
5 * User space memory access functions
6 */
7#include <asm/page.h>
8#include <asm/system.h>
9#include <asm/cache.h>
10#include <asm-generic/uaccess.h>
11
12#define VERIFY_READ 0
13#define VERIFY_WRITE 1
14
15#define KERNEL_DS ((mm_segment_t){0})
16#define USER_DS ((mm_segment_t){1})
17
18#define segment_eq(a,b) ((a).seg == (b).seg)
19
20#define get_ds() (KERNEL_DS)
21#define get_fs() (current_thread_info()->addr_limit)
22#define set_fs(x) (current_thread_info()->addr_limit = (x))
23
24/*
25 * Note that since kernel addresses are in a separate address space on
26 * parisc, we don't need to do anything for access_ok().
27 * We just let the page fault handler do the right thing. This also means
28 * that put_user is the same as __put_user, etc.
29 */
30
31extern int __get_kernel_bad(void);
32extern int __get_user_bad(void);
33extern int __put_kernel_bad(void);
34extern int __put_user_bad(void);
35
36static inline long access_ok(int type, const void __user * addr,
37 unsigned long size)
38{
39 return 1;
40}
41
42#define put_user __put_user
43#define get_user __get_user
44
45#if !defined(CONFIG_64BIT)
46#define LDD_KERNEL(ptr) __get_kernel_bad();
47#define LDD_USER(ptr) __get_user_bad();
48#define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr)
49#define STD_USER(x, ptr) __put_user_asm64(x,ptr)
50#define ASM_WORD_INSN ".word\t"
51#else
52#define LDD_KERNEL(ptr) __get_kernel_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)
55#define STD_USER(x, ptr) __put_user_asm("std",x,ptr)
56#define ASM_WORD_INSN ".dword\t"
57#endif
58
59/*
60 * The exception table contains two values: the first is an address
61 * for an instruction that is allowed to fault, and the second is
62 * the address to the fixup routine.
63 */
64
65struct exception_table_entry {
66 unsigned long insn; /* address of insn that is allowed to fault. */
67 long fixup; /* fixup routine */
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
75/*
76 * The page fault handler stores, in a per-cpu area, the following information
77 * if a fixup routine is available.
78 */
79struct exception_data {
80 unsigned long fault_ip;
81 unsigned long fault_space;
82 unsigned long fault_addr;
83};
84
85#define __get_user(x,ptr) \
86({ \
87 register long __gu_err __asm__ ("r8") = 0; \
88 register long __gu_val __asm__ ("r9") = 0; \
89 \
90 if (segment_eq(get_fs(),KERNEL_DS)) { \
91 switch (sizeof(*(ptr))) { \
92 case 1: __get_kernel_asm("ldb",ptr); break; \
93 case 2: __get_kernel_asm("ldh",ptr); break; \
94 case 4: __get_kernel_asm("ldw",ptr); break; \
95 case 8: LDD_KERNEL(ptr); break; \
96 default: __get_kernel_bad(); break; \
97 } \
98 } \
99 else { \
100 switch (sizeof(*(ptr))) { \
101 case 1: __get_user_asm("ldb",ptr); break; \
102 case 2: __get_user_asm("ldh",ptr); break; \
103 case 4: __get_user_asm("ldw",ptr); break; \
104 case 8: LDD_USER(ptr); break; \
105 default: __get_user_bad(); break; \
106 } \
107 } \
108 \
109 (x) = (__typeof__(*(ptr))) __gu_val; \
110 __gu_err; \
111})
112
113#define __get_kernel_asm(ldx,ptr) \
114 __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \
115 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
116 : "=r"(__gu_val), "=r"(__gu_err) \
117 : "r"(ptr), "1"(__gu_err) \
118 : "r1");
119
120#define __get_user_asm(ldx,ptr) \
121 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \
122 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_get_user_skip_1)\
123 : "=r"(__gu_val), "=r"(__gu_err) \
124 : "r"(ptr), "1"(__gu_err) \
125 : "r1");
126
127#define __put_user(x,ptr) \
128({ \
129 register long __pu_err __asm__ ("r8") = 0; \
130 __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
131 \
132 if (segment_eq(get_fs(),KERNEL_DS)) { \
133 switch (sizeof(*(ptr))) { \
134 case 1: __put_kernel_asm("stb",__x,ptr); break; \
135 case 2: __put_kernel_asm("sth",__x,ptr); break; \
136 case 4: __put_kernel_asm("stw",__x,ptr); break; \
137 case 8: STD_KERNEL(__x,ptr); break; \
138 default: __put_kernel_bad(); break; \
139 } \
140 } \
141 else { \
142 switch (sizeof(*(ptr))) { \
143 case 1: __put_user_asm("stb",__x,ptr); break; \
144 case 2: __put_user_asm("sth",__x,ptr); break; \
145 case 4: __put_user_asm("stw",__x,ptr); break; \
146 case 8: STD_USER(__x,ptr); break; \
147 default: __put_user_bad(); break; \
148 } \
149 } \
150 \
151 __pu_err; \
152})
153
154/*
155 * The "__put_user/kernel_asm()" macros tell gcc they read from memory
156 * instead of writing. This is because they do not write to any memory
157 * gcc knows about, so there are no aliasing issues. These macros must
158 * also be aware that "fixup_put_user_skip_[12]" are executed in the
159 * context of the fault, and any registers used there must be listed
160 * as clobbers. In this case only "r1" is used by the current routines.
161 * r8/r9 are already listed as err/val.
162 */
163
164#define __put_kernel_asm(stx,x,ptr) \
165 __asm__ __volatile__ ( \
166 "\n1:\t" stx "\t%2,0(%1)\n\t" \
167 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
168 : "=r"(__pu_err) \
169 : "r"(ptr), "r"(x), "0"(__pu_err) \
170 : "r1")
171
172#define __put_user_asm(stx,x,ptr) \
173 __asm__ __volatile__ ( \
174 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \
175 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_1)\
176 : "=r"(__pu_err) \
177 : "r"(ptr), "r"(x), "0"(__pu_err) \
178 : "r1")
179
180
181#if !defined(CONFIG_64BIT)
182
183#define __put_kernel_asm64(__val,ptr) do { \
184 u64 __val64 = (u64)(__val); \
185 u32 hi = (__val64) >> 32; \
186 u32 lo = (__val64) & 0xffffffff; \
187 __asm__ __volatile__ ( \
188 "\n1:\tstw %2,0(%1)" \
189 "\n2:\tstw %3,4(%1)\n\t" \
190 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
191 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
192 : "=r"(__pu_err) \
193 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
194 : "r1"); \
195} while (0)
196
197#define __put_user_asm64(__val,ptr) do { \
198 u64 __val64 = (u64)(__val); \
199 u32 hi = (__val64) >> 32; \
200 u32 lo = (__val64) & 0xffffffff; \
201 __asm__ __volatile__ ( \
202 "\n1:\tstw %2,0(%%sr3,%1)" \
203 "\n2:\tstw %3,4(%%sr3,%1)\n\t" \
204 ASM_EXCEPTIONTABLE_ENTRY(1b,fixup_put_user_skip_2)\
205 ASM_EXCEPTIONTABLE_ENTRY(2b,fixup_put_user_skip_1)\
206 : "=r"(__pu_err) \
207 : "r"(ptr), "r"(hi), "r"(lo), "0"(__pu_err) \
208 : "r1"); \
209} while (0)
210
211#endif /* !defined(CONFIG_64BIT) */
212
213
214/*
215 * Complex access routines -- external declarations
216 */
217
218extern unsigned long lcopy_to_user(void __user *, const void *, unsigned long);
219extern unsigned long lcopy_from_user(void *, const void __user *, unsigned long);
220extern unsigned long lcopy_in_user(void __user *, const void __user *, unsigned long);
221extern long lstrncpy_from_user(char *, const char __user *, long);
222extern unsigned lclear_user(void __user *,unsigned long);
223extern long lstrnlen_user(const char __user *,long);
224
225/*
226 * Complex access routines -- macros
227 */
228
229#define strncpy_from_user lstrncpy_from_user
230#define strnlen_user lstrnlen_user
231#define strlen_user(str) lstrnlen_user(str, 0x7fffffffL)
232#define clear_user lclear_user
233#define __clear_user lclear_user
234
235unsigned long copy_to_user(void __user *dst, const void *src, unsigned long len);
236#define __copy_to_user copy_to_user
237unsigned long copy_from_user(void *dst, const void __user *src, unsigned long len);
238#define __copy_from_user copy_from_user
239unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned long len);
240#define __copy_in_user copy_in_user
241#define __copy_to_user_inatomic __copy_to_user
242#define __copy_from_user_inatomic __copy_from_user
243
244#endif /* __PARISC_UACCESS_H */
diff --git a/include/asm-parisc/ucontext.h b/include/asm-parisc/ucontext.h
deleted file mode 100644
index 6c8883e4b0bd..000000000000
--- a/include/asm-parisc/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_PARISC_UCONTEXT_H
2#define _ASM_PARISC_UCONTEXT_H
3
4struct ucontext {
5 unsigned int uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* !_ASM_PARISC_UCONTEXT_H */
diff --git a/include/asm-parisc/unaligned.h b/include/asm-parisc/unaligned.h
deleted file mode 100644
index dfc5d3321a54..000000000000
--- a/include/asm-parisc/unaligned.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_PARISC_UNALIGNED_H
2#define _ASM_PARISC_UNALIGNED_H
3
4#include <linux/unaligned/be_struct.h>
5#include <linux/unaligned/le_byteshift.h>
6#include <linux/unaligned/generic.h>
7#define get_unaligned __get_unaligned_be
8#define put_unaligned __put_unaligned_be
9
10#ifdef __KERNEL__
11struct pt_regs;
12void handle_unaligned(struct pt_regs *regs);
13int check_unaligned(struct pt_regs *regs);
14#endif
15
16#endif /* _ASM_PARISC_UNALIGNED_H */
diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h
deleted file mode 100644
index a7d857f0e4f4..000000000000
--- a/include/asm-parisc/unistd.h
+++ /dev/null
@@ -1,991 +0,0 @@
1#ifndef _ASM_PARISC_UNISTD_H_
2#define _ASM_PARISC_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8/*
9 * HP-UX system calls get their native numbers for binary compatibility.
10 */
11
12#define __NR_HPUX_exit 1
13#define __NR_HPUX_fork 2
14#define __NR_HPUX_read 3
15#define __NR_HPUX_write 4
16#define __NR_HPUX_open 5
17#define __NR_HPUX_close 6
18#define __NR_HPUX_wait 7
19#define __NR_HPUX_creat 8
20#define __NR_HPUX_link 9
21#define __NR_HPUX_unlink 10
22#define __NR_HPUX_execv 11
23#define __NR_HPUX_chdir 12
24#define __NR_HPUX_time 13
25#define __NR_HPUX_mknod 14
26#define __NR_HPUX_chmod 15
27#define __NR_HPUX_chown 16
28#define __NR_HPUX_break 17
29#define __NR_HPUX_lchmod 18
30#define __NR_HPUX_lseek 19
31#define __NR_HPUX_getpid 20
32#define __NR_HPUX_mount 21
33#define __NR_HPUX_umount 22
34#define __NR_HPUX_setuid 23
35#define __NR_HPUX_getuid 24
36#define __NR_HPUX_stime 25
37#define __NR_HPUX_ptrace 26
38#define __NR_HPUX_alarm 27
39#define __NR_HPUX_oldfstat 28
40#define __NR_HPUX_pause 29
41#define __NR_HPUX_utime 30
42#define __NR_HPUX_stty 31
43#define __NR_HPUX_gtty 32
44#define __NR_HPUX_access 33
45#define __NR_HPUX_nice 34
46#define __NR_HPUX_ftime 35
47#define __NR_HPUX_sync 36
48#define __NR_HPUX_kill 37
49#define __NR_HPUX_stat 38
50#define __NR_HPUX_setpgrp3 39
51#define __NR_HPUX_lstat 40
52#define __NR_HPUX_dup 41
53#define __NR_HPUX_pipe 42
54#define __NR_HPUX_times 43
55#define __NR_HPUX_profil 44
56#define __NR_HPUX_ki_call 45
57#define __NR_HPUX_setgid 46
58#define __NR_HPUX_getgid 47
59#define __NR_HPUX_sigsys 48
60#define __NR_HPUX_reserved1 49
61#define __NR_HPUX_reserved2 50
62#define __NR_HPUX_acct 51
63#define __NR_HPUX_set_userthreadid 52
64#define __NR_HPUX_oldlock 53
65#define __NR_HPUX_ioctl 54
66#define __NR_HPUX_reboot 55
67#define __NR_HPUX_symlink 56
68#define __NR_HPUX_utssys 57
69#define __NR_HPUX_readlink 58
70#define __NR_HPUX_execve 59
71#define __NR_HPUX_umask 60
72#define __NR_HPUX_chroot 61
73#define __NR_HPUX_fcntl 62
74#define __NR_HPUX_ulimit 63
75#define __NR_HPUX_getpagesize 64
76#define __NR_HPUX_mremap 65
77#define __NR_HPUX_vfork 66
78#define __NR_HPUX_vread 67
79#define __NR_HPUX_vwrite 68
80#define __NR_HPUX_sbrk 69
81#define __NR_HPUX_sstk 70
82#define __NR_HPUX_mmap 71
83#define __NR_HPUX_vadvise 72
84#define __NR_HPUX_munmap 73
85#define __NR_HPUX_mprotect 74
86#define __NR_HPUX_madvise 75
87#define __NR_HPUX_vhangup 76
88#define __NR_HPUX_swapoff 77
89#define __NR_HPUX_mincore 78
90#define __NR_HPUX_getgroups 79
91#define __NR_HPUX_setgroups 80
92#define __NR_HPUX_getpgrp2 81
93#define __NR_HPUX_setpgrp2 82
94#define __NR_HPUX_setitimer 83
95#define __NR_HPUX_wait3 84
96#define __NR_HPUX_swapon 85
97#define __NR_HPUX_getitimer 86
98#define __NR_HPUX_gethostname42 87
99#define __NR_HPUX_sethostname42 88
100#define __NR_HPUX_getdtablesize 89
101#define __NR_HPUX_dup2 90
102#define __NR_HPUX_getdopt 91
103#define __NR_HPUX_fstat 92
104#define __NR_HPUX_select 93
105#define __NR_HPUX_setdopt 94
106#define __NR_HPUX_fsync 95
107#define __NR_HPUX_setpriority 96
108#define __NR_HPUX_socket_old 97
109#define __NR_HPUX_connect_old 98
110#define __NR_HPUX_accept_old 99
111#define __NR_HPUX_getpriority 100
112#define __NR_HPUX_send_old 101
113#define __NR_HPUX_recv_old 102
114#define __NR_HPUX_socketaddr_old 103
115#define __NR_HPUX_bind_old 104
116#define __NR_HPUX_setsockopt_old 105
117#define __NR_HPUX_listen_old 106
118#define __NR_HPUX_vtimes_old 107
119#define __NR_HPUX_sigvector 108
120#define __NR_HPUX_sigblock 109
121#define __NR_HPUX_siggetmask 110
122#define __NR_HPUX_sigpause 111
123#define __NR_HPUX_sigstack 112
124#define __NR_HPUX_recvmsg_old 113
125#define __NR_HPUX_sendmsg_old 114
126#define __NR_HPUX_vtrace_old 115
127#define __NR_HPUX_gettimeofday 116
128#define __NR_HPUX_getrusage 117
129#define __NR_HPUX_getsockopt_old 118
130#define __NR_HPUX_resuba_old 119
131#define __NR_HPUX_readv 120
132#define __NR_HPUX_writev 121
133#define __NR_HPUX_settimeofday 122
134#define __NR_HPUX_fchown 123
135#define __NR_HPUX_fchmod 124
136#define __NR_HPUX_recvfrom_old 125
137#define __NR_HPUX_setresuid 126
138#define __NR_HPUX_setresgid 127
139#define __NR_HPUX_rename 128
140#define __NR_HPUX_truncate 129
141#define __NR_HPUX_ftruncate 130
142#define __NR_HPUX_flock_old 131
143#define __NR_HPUX_sysconf 132
144#define __NR_HPUX_sendto_old 133
145#define __NR_HPUX_shutdown_old 134
146#define __NR_HPUX_socketpair_old 135
147#define __NR_HPUX_mkdir 136
148#define __NR_HPUX_rmdir 137
149#define __NR_HPUX_utimes_old 138
150#define __NR_HPUX_sigcleanup_old 139
151#define __NR_HPUX_setcore 140
152#define __NR_HPUX_getpeername_old 141
153#define __NR_HPUX_gethostid 142
154#define __NR_HPUX_sethostid 143
155#define __NR_HPUX_getrlimit 144
156#define __NR_HPUX_setrlimit 145
157#define __NR_HPUX_killpg_old 146
158#define __NR_HPUX_cachectl 147
159#define __NR_HPUX_quotactl 148
160#define __NR_HPUX_get_sysinfo 149
161#define __NR_HPUX_getsockname_old 150
162#define __NR_HPUX_privgrp 151
163#define __NR_HPUX_rtprio 152
164#define __NR_HPUX_plock 153
165#define __NR_HPUX_reserved3 154
166#define __NR_HPUX_lockf 155
167#define __NR_HPUX_semget 156
168#define __NR_HPUX_osemctl 157
169#define __NR_HPUX_semop 158
170#define __NR_HPUX_msgget 159
171#define __NR_HPUX_omsgctl 160
172#define __NR_HPUX_msgsnd 161
173#define __NR_HPUX_msgrecv 162
174#define __NR_HPUX_shmget 163
175#define __NR_HPUX_oshmctl 164
176#define __NR_HPUX_shmat 165
177#define __NR_HPUX_shmdt 166
178#define __NR_HPUX_m68020_advise 167
179/* [168,189] are for Discless/DUX */
180#define __NR_HPUX_csp 168
181#define __NR_HPUX_cluster 169
182#define __NR_HPUX_mkrnod 170
183#define __NR_HPUX_test 171
184#define __NR_HPUX_unsp_open 172
185#define __NR_HPUX_reserved4 173
186#define __NR_HPUX_getcontext_old 174
187#define __NR_HPUX_osetcontext 175
188#define __NR_HPUX_bigio 176
189#define __NR_HPUX_pipenode 177
190#define __NR_HPUX_lsync 178
191#define __NR_HPUX_getmachineid 179
192#define __NR_HPUX_cnodeid 180
193#define __NR_HPUX_cnodes 181
194#define __NR_HPUX_swapclients 182
195#define __NR_HPUX_rmt_process 183
196#define __NR_HPUX_dskless_stats 184
197#define __NR_HPUX_sigprocmask 185
198#define __NR_HPUX_sigpending 186
199#define __NR_HPUX_sigsuspend 187
200#define __NR_HPUX_sigaction 188
201#define __NR_HPUX_reserved5 189
202#define __NR_HPUX_nfssvc 190
203#define __NR_HPUX_getfh 191
204#define __NR_HPUX_getdomainname 192
205#define __NR_HPUX_setdomainname 193
206#define __NR_HPUX_async_daemon 194
207#define __NR_HPUX_getdirentries 195
208#define __NR_HPUX_statfs 196
209#define __NR_HPUX_fstatfs 197
210#define __NR_HPUX_vfsmount 198
211#define __NR_HPUX_reserved6 199
212#define __NR_HPUX_waitpid 200
213/* 201 - 223 missing */
214#define __NR_HPUX_sigsetreturn 224
215#define __NR_HPUX_sigsetstatemask 225
216/* 226 missing */
217#define __NR_HPUX_cs 227
218#define __NR_HPUX_cds 228
219#define __NR_HPUX_set_no_trunc 229
220#define __NR_HPUX_pathconf 230
221#define __NR_HPUX_fpathconf 231
222/* 232, 233 missing */
223#define __NR_HPUX_nfs_fcntl 234
224#define __NR_HPUX_ogetacl 235
225#define __NR_HPUX_ofgetacl 236
226#define __NR_HPUX_osetacl 237
227#define __NR_HPUX_ofsetacl 238
228#define __NR_HPUX_pstat 239
229#define __NR_HPUX_getaudid 240
230#define __NR_HPUX_setaudid 241
231#define __NR_HPUX_getaudproc 242
232#define __NR_HPUX_setaudproc 243
233#define __NR_HPUX_getevent 244
234#define __NR_HPUX_setevent 245
235#define __NR_HPUX_audwrite 246
236#define __NR_HPUX_audswitch 247
237#define __NR_HPUX_audctl 248
238#define __NR_HPUX_ogetaccess 249
239#define __NR_HPUX_fsctl 250
240/* 251 - 258 missing */
241#define __NR_HPUX_swapfs 259
242#define __NR_HPUX_fss 260
243/* 261 - 266 missing */
244#define __NR_HPUX_tsync 267
245#define __NR_HPUX_getnumfds 268
246#define __NR_HPUX_poll 269
247#define __NR_HPUX_getmsg 270
248#define __NR_HPUX_putmsg 271
249#define __NR_HPUX_fchdir 272
250#define __NR_HPUX_getmount_cnt 273
251#define __NR_HPUX_getmount_entry 274
252#define __NR_HPUX_accept 275
253#define __NR_HPUX_bind 276
254#define __NR_HPUX_connect 277
255#define __NR_HPUX_getpeername 278
256#define __NR_HPUX_getsockname 279
257#define __NR_HPUX_getsockopt 280
258#define __NR_HPUX_listen 281
259#define __NR_HPUX_recv 282
260#define __NR_HPUX_recvfrom 283
261#define __NR_HPUX_recvmsg 284
262#define __NR_HPUX_send 285
263#define __NR_HPUX_sendmsg 286
264#define __NR_HPUX_sendto 287
265#define __NR_HPUX_setsockopt 288
266#define __NR_HPUX_shutdown 289
267#define __NR_HPUX_socket 290
268#define __NR_HPUX_socketpair 291
269#define __NR_HPUX_proc_open 292
270#define __NR_HPUX_proc_close 293
271#define __NR_HPUX_proc_send 294
272#define __NR_HPUX_proc_recv 295
273#define __NR_HPUX_proc_sendrecv 296
274#define __NR_HPUX_proc_syscall 297
275/* 298 - 311 missing */
276#define __NR_HPUX_semctl 312
277#define __NR_HPUX_msgctl 313
278#define __NR_HPUX_shmctl 314
279#define __NR_HPUX_mpctl 315
280#define __NR_HPUX_exportfs 316
281#define __NR_HPUX_getpmsg 317
282#define __NR_HPUX_putpmsg 318
283/* 319 missing */
284#define __NR_HPUX_msync 320
285#define __NR_HPUX_msleep 321
286#define __NR_HPUX_mwakeup 322
287#define __NR_HPUX_msem_init 323
288#define __NR_HPUX_msem_remove 324
289#define __NR_HPUX_adjtime 325
290#define __NR_HPUX_kload 326
291#define __NR_HPUX_fattach 327
292#define __NR_HPUX_fdetach 328
293#define __NR_HPUX_serialize 329
294#define __NR_HPUX_statvfs 330
295#define __NR_HPUX_fstatvfs 331
296#define __NR_HPUX_lchown 332
297#define __NR_HPUX_getsid 333
298#define __NR_HPUX_sysfs 334
299/* 335, 336 missing */
300#define __NR_HPUX_sched_setparam 337
301#define __NR_HPUX_sched_getparam 338
302#define __NR_HPUX_sched_setscheduler 339
303#define __NR_HPUX_sched_getscheduler 340
304#define __NR_HPUX_sched_yield 341
305#define __NR_HPUX_sched_get_priority_max 342
306#define __NR_HPUX_sched_get_priority_min 343
307#define __NR_HPUX_sched_rr_get_interval 344
308#define __NR_HPUX_clock_settime 345
309#define __NR_HPUX_clock_gettime 346
310#define __NR_HPUX_clock_getres 347
311#define __NR_HPUX_timer_create 348
312#define __NR_HPUX_timer_delete 349
313#define __NR_HPUX_timer_settime 350
314#define __NR_HPUX_timer_gettime 351
315#define __NR_HPUX_timer_getoverrun 352
316#define __NR_HPUX_nanosleep 353
317#define __NR_HPUX_toolbox 354
318/* 355 missing */
319#define __NR_HPUX_getdents 356
320#define __NR_HPUX_getcontext 357
321#define __NR_HPUX_sysinfo 358
322#define __NR_HPUX_fcntl64 359
323#define __NR_HPUX_ftruncate64 360
324#define __NR_HPUX_fstat64 361
325#define __NR_HPUX_getdirentries64 362
326#define __NR_HPUX_getrlimit64 363
327#define __NR_HPUX_lockf64 364
328#define __NR_HPUX_lseek64 365
329#define __NR_HPUX_lstat64 366
330#define __NR_HPUX_mmap64 367
331#define __NR_HPUX_setrlimit64 368
332#define __NR_HPUX_stat64 369
333#define __NR_HPUX_truncate64 370
334#define __NR_HPUX_ulimit64 371
335#define __NR_HPUX_pread 372
336#define __NR_HPUX_preadv 373
337#define __NR_HPUX_pwrite 374
338#define __NR_HPUX_pwritev 375
339#define __NR_HPUX_pread64 376
340#define __NR_HPUX_preadv64 377
341#define __NR_HPUX_pwrite64 378
342#define __NR_HPUX_pwritev64 379
343#define __NR_HPUX_setcontext 380
344#define __NR_HPUX_sigaltstack 381
345#define __NR_HPUX_waitid 382
346#define __NR_HPUX_setpgrp 383
347#define __NR_HPUX_recvmsg2 384
348#define __NR_HPUX_sendmsg2 385
349#define __NR_HPUX_socket2 386
350#define __NR_HPUX_socketpair2 387
351#define __NR_HPUX_setregid 388
352#define __NR_HPUX_lwp_create 389
353#define __NR_HPUX_lwp_terminate 390
354#define __NR_HPUX_lwp_wait 391
355#define __NR_HPUX_lwp_suspend 392
356#define __NR_HPUX_lwp_resume 393
357/* 394 missing */
358#define __NR_HPUX_lwp_abort_syscall 395
359#define __NR_HPUX_lwp_info 396
360#define __NR_HPUX_lwp_kill 397
361#define __NR_HPUX_ksleep 398
362#define __NR_HPUX_kwakeup 399
363/* 400 missing */
364#define __NR_HPUX_pstat_getlwp 401
365#define __NR_HPUX_lwp_exit 402
366#define __NR_HPUX_lwp_continue 403
367#define __NR_HPUX_getacl 404
368#define __NR_HPUX_fgetacl 405
369#define __NR_HPUX_setacl 406
370#define __NR_HPUX_fsetacl 407
371#define __NR_HPUX_getaccess 408
372#define __NR_HPUX_lwp_mutex_init 409
373#define __NR_HPUX_lwp_mutex_lock_sys 410
374#define __NR_HPUX_lwp_mutex_unlock 411
375#define __NR_HPUX_lwp_cond_init 412
376#define __NR_HPUX_lwp_cond_signal 413
377#define __NR_HPUX_lwp_cond_broadcast 414
378#define __NR_HPUX_lwp_cond_wait_sys 415
379#define __NR_HPUX_lwp_getscheduler 416
380#define __NR_HPUX_lwp_setscheduler 417
381#define __NR_HPUX_lwp_getstate 418
382#define __NR_HPUX_lwp_setstate 419
383#define __NR_HPUX_lwp_detach 420
384#define __NR_HPUX_mlock 421
385#define __NR_HPUX_munlock 422
386#define __NR_HPUX_mlockall 423
387#define __NR_HPUX_munlockall 424
388#define __NR_HPUX_shm_open 425
389#define __NR_HPUX_shm_unlink 426
390#define __NR_HPUX_sigqueue 427
391#define __NR_HPUX_sigwaitinfo 428
392#define __NR_HPUX_sigtimedwait 429
393#define __NR_HPUX_sigwait 430
394#define __NR_HPUX_aio_read 431
395#define __NR_HPUX_aio_write 432
396#define __NR_HPUX_lio_listio 433
397#define __NR_HPUX_aio_error 434
398#define __NR_HPUX_aio_return 435
399#define __NR_HPUX_aio_cancel 436
400#define __NR_HPUX_aio_suspend 437
401#define __NR_HPUX_aio_fsync 438
402#define __NR_HPUX_mq_open 439
403#define __NR_HPUX_mq_close 440
404#define __NR_HPUX_mq_unlink 441
405#define __NR_HPUX_mq_send 442
406#define __NR_HPUX_mq_receive 443
407#define __NR_HPUX_mq_notify 444
408#define __NR_HPUX_mq_setattr 445
409#define __NR_HPUX_mq_getattr 446
410#define __NR_HPUX_ksem_open 447
411#define __NR_HPUX_ksem_unlink 448
412#define __NR_HPUX_ksem_close 449
413#define __NR_HPUX_ksem_post 450
414#define __NR_HPUX_ksem_wait 451
415#define __NR_HPUX_ksem_read 452
416#define __NR_HPUX_ksem_trywait 453
417#define __NR_HPUX_lwp_rwlock_init 454
418#define __NR_HPUX_lwp_rwlock_destroy 455
419#define __NR_HPUX_lwp_rwlock_rdlock_sys 456
420#define __NR_HPUX_lwp_rwlock_wrlock_sys 457
421#define __NR_HPUX_lwp_rwlock_tryrdlock 458
422#define __NR_HPUX_lwp_rwlock_trywrlock 459
423#define __NR_HPUX_lwp_rwlock_unlock 460
424#define __NR_HPUX_ttrace 461
425#define __NR_HPUX_ttrace_wait 462
426#define __NR_HPUX_lf_wire_mem 463
427#define __NR_HPUX_lf_unwire_mem 464
428#define __NR_HPUX_lf_send_pin_map 465
429#define __NR_HPUX_lf_free_buf 466
430#define __NR_HPUX_lf_wait_nq 467
431#define __NR_HPUX_lf_wakeup_conn_q 468
432#define __NR_HPUX_lf_unused 469
433#define __NR_HPUX_lwp_sema_init 470
434#define __NR_HPUX_lwp_sema_post 471
435#define __NR_HPUX_lwp_sema_wait 472
436#define __NR_HPUX_lwp_sema_trywait 473
437#define __NR_HPUX_lwp_sema_destroy 474
438#define __NR_HPUX_statvfs64 475
439#define __NR_HPUX_fstatvfs64 476
440#define __NR_HPUX_msh_register 477
441#define __NR_HPUX_ptrace64 478
442#define __NR_HPUX_sendfile 479
443#define __NR_HPUX_sendpath 480
444#define __NR_HPUX_sendfile64 481
445#define __NR_HPUX_sendpath64 482
446#define __NR_HPUX_modload 483
447#define __NR_HPUX_moduload 484
448#define __NR_HPUX_modpath 485
449#define __NR_HPUX_getksym 486
450#define __NR_HPUX_modadm 487
451#define __NR_HPUX_modstat 488
452#define __NR_HPUX_lwp_detached_exit 489
453#define __NR_HPUX_crashconf 490
454#define __NR_HPUX_siginhibit 491
455#define __NR_HPUX_sigenable 492
456#define __NR_HPUX_spuctl 493
457#define __NR_HPUX_zerokernelsum 494
458#define __NR_HPUX_nfs_kstat 495
459#define __NR_HPUX_aio_read64 496
460#define __NR_HPUX_aio_write64 497
461#define __NR_HPUX_aio_error64 498
462#define __NR_HPUX_aio_return64 499
463#define __NR_HPUX_aio_cancel64 500
464#define __NR_HPUX_aio_suspend64 501
465#define __NR_HPUX_aio_fsync64 502
466#define __NR_HPUX_lio_listio64 503
467#define __NR_HPUX_recv2 504
468#define __NR_HPUX_recvfrom2 505
469#define __NR_HPUX_send2 506
470#define __NR_HPUX_sendto2 507
471#define __NR_HPUX_acl 508
472#define __NR_HPUX___cnx_p2p_ctl 509
473#define __NR_HPUX___cnx_gsched_ctl 510
474#define __NR_HPUX___cnx_pmon_ctl 511
475
476#define __NR_HPUX_syscalls 512
477
478/*
479 * Linux system call numbers.
480 *
481 * Cary Coutant says that we should just use another syscall gateway
482 * page to avoid clashing with the HPUX space, and I think he's right:
483 * it will would keep a branch out of our syscall entry path, at the
484 * very least. If we decide to change it later, we can ``just'' tweak
485 * the LINUX_GATEWAY_ADDR define at the bottom and make __NR_Linux be
486 * 1024 or something. Oh, and recompile libc. =)
487 *
488 * 64-bit HPUX binaries get the syscall gateway address passed in a register
489 * from the kernel at startup, which seems a sane strategy.
490 */
491
492#define __NR_Linux 0
493#define __NR_restart_syscall (__NR_Linux + 0)
494#define __NR_exit (__NR_Linux + 1)
495#define __NR_fork (__NR_Linux + 2)
496#define __NR_read (__NR_Linux + 3)
497#define __NR_write (__NR_Linux + 4)
498#define __NR_open (__NR_Linux + 5)
499#define __NR_close (__NR_Linux + 6)
500#define __NR_waitpid (__NR_Linux + 7)
501#define __NR_creat (__NR_Linux + 8)
502#define __NR_link (__NR_Linux + 9)
503#define __NR_unlink (__NR_Linux + 10)
504#define __NR_execve (__NR_Linux + 11)
505#define __NR_chdir (__NR_Linux + 12)
506#define __NR_time (__NR_Linux + 13)
507#define __NR_mknod (__NR_Linux + 14)
508#define __NR_chmod (__NR_Linux + 15)
509#define __NR_lchown (__NR_Linux + 16)
510#define __NR_socket (__NR_Linux + 17)
511#define __NR_stat (__NR_Linux + 18)
512#define __NR_lseek (__NR_Linux + 19)
513#define __NR_getpid (__NR_Linux + 20)
514#define __NR_mount (__NR_Linux + 21)
515#define __NR_bind (__NR_Linux + 22)
516#define __NR_setuid (__NR_Linux + 23)
517#define __NR_getuid (__NR_Linux + 24)
518#define __NR_stime (__NR_Linux + 25)
519#define __NR_ptrace (__NR_Linux + 26)
520#define __NR_alarm (__NR_Linux + 27)
521#define __NR_fstat (__NR_Linux + 28)
522#define __NR_pause (__NR_Linux + 29)
523#define __NR_utime (__NR_Linux + 30)
524#define __NR_connect (__NR_Linux + 31)
525#define __NR_listen (__NR_Linux + 32)
526#define __NR_access (__NR_Linux + 33)
527#define __NR_nice (__NR_Linux + 34)
528#define __NR_accept (__NR_Linux + 35)
529#define __NR_sync (__NR_Linux + 36)
530#define __NR_kill (__NR_Linux + 37)
531#define __NR_rename (__NR_Linux + 38)
532#define __NR_mkdir (__NR_Linux + 39)
533#define __NR_rmdir (__NR_Linux + 40)
534#define __NR_dup (__NR_Linux + 41)
535#define __NR_pipe (__NR_Linux + 42)
536#define __NR_times (__NR_Linux + 43)
537#define __NR_getsockname (__NR_Linux + 44)
538#define __NR_brk (__NR_Linux + 45)
539#define __NR_setgid (__NR_Linux + 46)
540#define __NR_getgid (__NR_Linux + 47)
541#define __NR_signal (__NR_Linux + 48)
542#define __NR_geteuid (__NR_Linux + 49)
543#define __NR_getegid (__NR_Linux + 50)
544#define __NR_acct (__NR_Linux + 51)
545#define __NR_umount2 (__NR_Linux + 52)
546#define __NR_getpeername (__NR_Linux + 53)
547#define __NR_ioctl (__NR_Linux + 54)
548#define __NR_fcntl (__NR_Linux + 55)
549#define __NR_socketpair (__NR_Linux + 56)
550#define __NR_setpgid (__NR_Linux + 57)
551#define __NR_send (__NR_Linux + 58)
552#define __NR_uname (__NR_Linux + 59)
553#define __NR_umask (__NR_Linux + 60)
554#define __NR_chroot (__NR_Linux + 61)
555#define __NR_ustat (__NR_Linux + 62)
556#define __NR_dup2 (__NR_Linux + 63)
557#define __NR_getppid (__NR_Linux + 64)
558#define __NR_getpgrp (__NR_Linux + 65)
559#define __NR_setsid (__NR_Linux + 66)
560#define __NR_pivot_root (__NR_Linux + 67)
561#define __NR_sgetmask (__NR_Linux + 68)
562#define __NR_ssetmask (__NR_Linux + 69)
563#define __NR_setreuid (__NR_Linux + 70)
564#define __NR_setregid (__NR_Linux + 71)
565#define __NR_mincore (__NR_Linux + 72)
566#define __NR_sigpending (__NR_Linux + 73)
567#define __NR_sethostname (__NR_Linux + 74)
568#define __NR_setrlimit (__NR_Linux + 75)
569#define __NR_getrlimit (__NR_Linux + 76)
570#define __NR_getrusage (__NR_Linux + 77)
571#define __NR_gettimeofday (__NR_Linux + 78)
572#define __NR_settimeofday (__NR_Linux + 79)
573#define __NR_getgroups (__NR_Linux + 80)
574#define __NR_setgroups (__NR_Linux + 81)
575#define __NR_sendto (__NR_Linux + 82)
576#define __NR_symlink (__NR_Linux + 83)
577#define __NR_lstat (__NR_Linux + 84)
578#define __NR_readlink (__NR_Linux + 85)
579#define __NR_uselib (__NR_Linux + 86)
580#define __NR_swapon (__NR_Linux + 87)
581#define __NR_reboot (__NR_Linux + 88)
582#define __NR_mmap2 (__NR_Linux + 89)
583#define __NR_mmap (__NR_Linux + 90)
584#define __NR_munmap (__NR_Linux + 91)
585#define __NR_truncate (__NR_Linux + 92)
586#define __NR_ftruncate (__NR_Linux + 93)
587#define __NR_fchmod (__NR_Linux + 94)
588#define __NR_fchown (__NR_Linux + 95)
589#define __NR_getpriority (__NR_Linux + 96)
590#define __NR_setpriority (__NR_Linux + 97)
591#define __NR_recv (__NR_Linux + 98)
592#define __NR_statfs (__NR_Linux + 99)
593#define __NR_fstatfs (__NR_Linux + 100)
594#define __NR_stat64 (__NR_Linux + 101)
595/* #define __NR_socketcall (__NR_Linux + 102) */
596#define __NR_syslog (__NR_Linux + 103)
597#define __NR_setitimer (__NR_Linux + 104)
598#define __NR_getitimer (__NR_Linux + 105)
599#define __NR_capget (__NR_Linux + 106)
600#define __NR_capset (__NR_Linux + 107)
601#define __NR_pread64 (__NR_Linux + 108)
602#define __NR_pwrite64 (__NR_Linux + 109)
603#define __NR_getcwd (__NR_Linux + 110)
604#define __NR_vhangup (__NR_Linux + 111)
605#define __NR_fstat64 (__NR_Linux + 112)
606#define __NR_vfork (__NR_Linux + 113)
607#define __NR_wait4 (__NR_Linux + 114)
608#define __NR_swapoff (__NR_Linux + 115)
609#define __NR_sysinfo (__NR_Linux + 116)
610#define __NR_shutdown (__NR_Linux + 117)
611#define __NR_fsync (__NR_Linux + 118)
612#define __NR_madvise (__NR_Linux + 119)
613#define __NR_clone (__NR_Linux + 120)
614#define __NR_setdomainname (__NR_Linux + 121)
615#define __NR_sendfile (__NR_Linux + 122)
616#define __NR_recvfrom (__NR_Linux + 123)
617#define __NR_adjtimex (__NR_Linux + 124)
618#define __NR_mprotect (__NR_Linux + 125)
619#define __NR_sigprocmask (__NR_Linux + 126)
620#define __NR_create_module (__NR_Linux + 127)
621#define __NR_init_module (__NR_Linux + 128)
622#define __NR_delete_module (__NR_Linux + 129)
623#define __NR_get_kernel_syms (__NR_Linux + 130)
624#define __NR_quotactl (__NR_Linux + 131)
625#define __NR_getpgid (__NR_Linux + 132)
626#define __NR_fchdir (__NR_Linux + 133)
627#define __NR_bdflush (__NR_Linux + 134)
628#define __NR_sysfs (__NR_Linux + 135)
629#define __NR_personality (__NR_Linux + 136)
630#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */
631#define __NR_setfsuid (__NR_Linux + 138)
632#define __NR_setfsgid (__NR_Linux + 139)
633#define __NR__llseek (__NR_Linux + 140)
634#define __NR_getdents (__NR_Linux + 141)
635#define __NR__newselect (__NR_Linux + 142)
636#define __NR_flock (__NR_Linux + 143)
637#define __NR_msync (__NR_Linux + 144)
638#define __NR_readv (__NR_Linux + 145)
639#define __NR_writev (__NR_Linux + 146)
640#define __NR_getsid (__NR_Linux + 147)
641#define __NR_fdatasync (__NR_Linux + 148)
642#define __NR__sysctl (__NR_Linux + 149)
643#define __NR_mlock (__NR_Linux + 150)
644#define __NR_munlock (__NR_Linux + 151)
645#define __NR_mlockall (__NR_Linux + 152)
646#define __NR_munlockall (__NR_Linux + 153)
647#define __NR_sched_setparam (__NR_Linux + 154)
648#define __NR_sched_getparam (__NR_Linux + 155)
649#define __NR_sched_setscheduler (__NR_Linux + 156)
650#define __NR_sched_getscheduler (__NR_Linux + 157)
651#define __NR_sched_yield (__NR_Linux + 158)
652#define __NR_sched_get_priority_max (__NR_Linux + 159)
653#define __NR_sched_get_priority_min (__NR_Linux + 160)
654#define __NR_sched_rr_get_interval (__NR_Linux + 161)
655#define __NR_nanosleep (__NR_Linux + 162)
656#define __NR_mremap (__NR_Linux + 163)
657#define __NR_setresuid (__NR_Linux + 164)
658#define __NR_getresuid (__NR_Linux + 165)
659#define __NR_sigaltstack (__NR_Linux + 166)
660#define __NR_query_module (__NR_Linux + 167)
661#define __NR_poll (__NR_Linux + 168)
662#define __NR_nfsservctl (__NR_Linux + 169)
663#define __NR_setresgid (__NR_Linux + 170)
664#define __NR_getresgid (__NR_Linux + 171)
665#define __NR_prctl (__NR_Linux + 172)
666#define __NR_rt_sigreturn (__NR_Linux + 173)
667#define __NR_rt_sigaction (__NR_Linux + 174)
668#define __NR_rt_sigprocmask (__NR_Linux + 175)
669#define __NR_rt_sigpending (__NR_Linux + 176)
670#define __NR_rt_sigtimedwait (__NR_Linux + 177)
671#define __NR_rt_sigqueueinfo (__NR_Linux + 178)
672#define __NR_rt_sigsuspend (__NR_Linux + 179)
673#define __NR_chown (__NR_Linux + 180)
674#define __NR_setsockopt (__NR_Linux + 181)
675#define __NR_getsockopt (__NR_Linux + 182)
676#define __NR_sendmsg (__NR_Linux + 183)
677#define __NR_recvmsg (__NR_Linux + 184)
678#define __NR_semop (__NR_Linux + 185)
679#define __NR_semget (__NR_Linux + 186)
680#define __NR_semctl (__NR_Linux + 187)
681#define __NR_msgsnd (__NR_Linux + 188)
682#define __NR_msgrcv (__NR_Linux + 189)
683#define __NR_msgget (__NR_Linux + 190)
684#define __NR_msgctl (__NR_Linux + 191)
685#define __NR_shmat (__NR_Linux + 192)
686#define __NR_shmdt (__NR_Linux + 193)
687#define __NR_shmget (__NR_Linux + 194)
688#define __NR_shmctl (__NR_Linux + 195)
689
690#define __NR_getpmsg (__NR_Linux + 196) /* Somebody *wants* streams? */
691#define __NR_putpmsg (__NR_Linux + 197)
692
693#define __NR_lstat64 (__NR_Linux + 198)
694#define __NR_truncate64 (__NR_Linux + 199)
695#define __NR_ftruncate64 (__NR_Linux + 200)
696#define __NR_getdents64 (__NR_Linux + 201)
697#define __NR_fcntl64 (__NR_Linux + 202)
698#define __NR_attrctl (__NR_Linux + 203)
699#define __NR_acl_get (__NR_Linux + 204)
700#define __NR_acl_set (__NR_Linux + 205)
701#define __NR_gettid (__NR_Linux + 206)
702#define __NR_readahead (__NR_Linux + 207)
703#define __NR_tkill (__NR_Linux + 208)
704#define __NR_sendfile64 (__NR_Linux + 209)
705#define __NR_futex (__NR_Linux + 210)
706#define __NR_sched_setaffinity (__NR_Linux + 211)
707#define __NR_sched_getaffinity (__NR_Linux + 212)
708#define __NR_set_thread_area (__NR_Linux + 213)
709#define __NR_get_thread_area (__NR_Linux + 214)
710#define __NR_io_setup (__NR_Linux + 215)
711#define __NR_io_destroy (__NR_Linux + 216)
712#define __NR_io_getevents (__NR_Linux + 217)
713#define __NR_io_submit (__NR_Linux + 218)
714#define __NR_io_cancel (__NR_Linux + 219)
715#define __NR_alloc_hugepages (__NR_Linux + 220)
716#define __NR_free_hugepages (__NR_Linux + 221)
717#define __NR_exit_group (__NR_Linux + 222)
718#define __NR_lookup_dcookie (__NR_Linux + 223)
719#define __NR_epoll_create (__NR_Linux + 224)
720#define __NR_epoll_ctl (__NR_Linux + 225)
721#define __NR_epoll_wait (__NR_Linux + 226)
722#define __NR_remap_file_pages (__NR_Linux + 227)
723#define __NR_semtimedop (__NR_Linux + 228)
724#define __NR_mq_open (__NR_Linux + 229)
725#define __NR_mq_unlink (__NR_Linux + 230)
726#define __NR_mq_timedsend (__NR_Linux + 231)
727#define __NR_mq_timedreceive (__NR_Linux + 232)
728#define __NR_mq_notify (__NR_Linux + 233)
729#define __NR_mq_getsetattr (__NR_Linux + 234)
730#define __NR_waitid (__NR_Linux + 235)
731#define __NR_fadvise64_64 (__NR_Linux + 236)
732#define __NR_set_tid_address (__NR_Linux + 237)
733#define __NR_setxattr (__NR_Linux + 238)
734#define __NR_lsetxattr (__NR_Linux + 239)
735#define __NR_fsetxattr (__NR_Linux + 240)
736#define __NR_getxattr (__NR_Linux + 241)
737#define __NR_lgetxattr (__NR_Linux + 242)
738#define __NR_fgetxattr (__NR_Linux + 243)
739#define __NR_listxattr (__NR_Linux + 244)
740#define __NR_llistxattr (__NR_Linux + 245)
741#define __NR_flistxattr (__NR_Linux + 246)
742#define __NR_removexattr (__NR_Linux + 247)
743#define __NR_lremovexattr (__NR_Linux + 248)
744#define __NR_fremovexattr (__NR_Linux + 249)
745#define __NR_timer_create (__NR_Linux + 250)
746#define __NR_timer_settime (__NR_Linux + 251)
747#define __NR_timer_gettime (__NR_Linux + 252)
748#define __NR_timer_getoverrun (__NR_Linux + 253)
749#define __NR_timer_delete (__NR_Linux + 254)
750#define __NR_clock_settime (__NR_Linux + 255)
751#define __NR_clock_gettime (__NR_Linux + 256)
752#define __NR_clock_getres (__NR_Linux + 257)
753#define __NR_clock_nanosleep (__NR_Linux + 258)
754#define __NR_tgkill (__NR_Linux + 259)
755#define __NR_mbind (__NR_Linux + 260)
756#define __NR_get_mempolicy (__NR_Linux + 261)
757#define __NR_set_mempolicy (__NR_Linux + 262)
758#define __NR_vserver (__NR_Linux + 263)
759#define __NR_add_key (__NR_Linux + 264)
760#define __NR_request_key (__NR_Linux + 265)
761#define __NR_keyctl (__NR_Linux + 266)
762#define __NR_ioprio_set (__NR_Linux + 267)
763#define __NR_ioprio_get (__NR_Linux + 268)
764#define __NR_inotify_init (__NR_Linux + 269)
765#define __NR_inotify_add_watch (__NR_Linux + 270)
766#define __NR_inotify_rm_watch (__NR_Linux + 271)
767#define __NR_migrate_pages (__NR_Linux + 272)
768#define __NR_pselect6 (__NR_Linux + 273)
769#define __NR_ppoll (__NR_Linux + 274)
770#define __NR_openat (__NR_Linux + 275)
771#define __NR_mkdirat (__NR_Linux + 276)
772#define __NR_mknodat (__NR_Linux + 277)
773#define __NR_fchownat (__NR_Linux + 278)
774#define __NR_futimesat (__NR_Linux + 279)
775#define __NR_fstatat64 (__NR_Linux + 280)
776#define __NR_unlinkat (__NR_Linux + 281)
777#define __NR_renameat (__NR_Linux + 282)
778#define __NR_linkat (__NR_Linux + 283)
779#define __NR_symlinkat (__NR_Linux + 284)
780#define __NR_readlinkat (__NR_Linux + 285)
781#define __NR_fchmodat (__NR_Linux + 286)
782#define __NR_faccessat (__NR_Linux + 287)
783#define __NR_unshare (__NR_Linux + 288)
784#define __NR_set_robust_list (__NR_Linux + 289)
785#define __NR_get_robust_list (__NR_Linux + 290)
786#define __NR_splice (__NR_Linux + 291)
787#define __NR_sync_file_range (__NR_Linux + 292)
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)
795#define __NR_kexec_load (__NR_Linux + 300)
796#define __NR_utimensat (__NR_Linux + 301)
797#define __NR_signalfd (__NR_Linux + 302)
798#define __NR_timerfd (__NR_Linux + 303)
799#define __NR_eventfd (__NR_Linux + 304)
800#define __NR_fallocate (__NR_Linux + 305)
801#define __NR_timerfd_create (__NR_Linux + 306)
802#define __NR_timerfd_settime (__NR_Linux + 307)
803#define __NR_timerfd_gettime (__NR_Linux + 308)
804
805#define __NR_Linux_syscalls (__NR_timerfd_gettime + 1)
806
807
808#define __IGNORE_select /* newselect */
809#define __IGNORE_fadvise64 /* fadvise64_64 */
810#define __IGNORE_utimes /* utime */
811
812
813#define HPUX_GATEWAY_ADDR 0xC0000004
814#define LINUX_GATEWAY_ADDR 0x100
815
816#ifdef __KERNEL__
817#ifndef __ASSEMBLY__
818
819#define SYS_ify(syscall_name) __NR_##syscall_name
820
821#ifndef ASM_LINE_SEP
822# define ASM_LINE_SEP ;
823#endif
824
825/* Definition taken from glibc 2.3.3
826 * sysdeps/unix/sysv/linux/hppa/sysdep.h
827 */
828
829#ifdef PIC
830/* WARNING: CANNOT BE USED IN A NOP! */
831# define K_STW_ASM_PIC " copy %%r19, %%r4\n"
832# define K_LDW_ASM_PIC " copy %%r4, %%r19\n"
833# define K_USING_GR4 "%r4",
834#else
835# define K_STW_ASM_PIC " \n"
836# define K_LDW_ASM_PIC " \n"
837# define K_USING_GR4
838#endif
839
840/* GCC has to be warned that a syscall may clobber all the ABI
841 registers listed as "caller-saves", see page 8, Table 2
842 in section 2.2.6 of the PA-RISC RUN-TIME architecture
843 document. However! r28 is the result and will conflict with
844 the clobber list so it is left out. Also the input arguments
845 registers r20 -> r26 will conflict with the list so they
846 are treated specially. Although r19 is clobbered by the syscall
847 we cannot say this because it would violate ABI, thus we say
848 r4 is clobbered and use that register to save/restore r19
849 across the syscall. */
850
851#define K_CALL_CLOB_REGS "%r1", "%r2", K_USING_GR4 \
852 "%r20", "%r29", "%r31"
853
854#undef K_INLINE_SYSCALL
855#define K_INLINE_SYSCALL(name, nr, args...) ({ \
856 long __sys_res; \
857 { \
858 register unsigned long __res __asm__("r28"); \
859 K_LOAD_ARGS_##nr(args) \
860 /* FIXME: HACK stw/ldw r19 around syscall */ \
861 __asm__ volatile( \
862 K_STW_ASM_PIC \
863 " ble 0x100(%%sr2, %%r0)\n" \
864 " ldi %1, %%r20\n" \
865 K_LDW_ASM_PIC \
866 : "=r" (__res) \
867 : "i" (SYS_ify(name)) K_ASM_ARGS_##nr \
868 : "memory", K_CALL_CLOB_REGS K_CLOB_ARGS_##nr \
869 ); \
870 __sys_res = (long)__res; \
871 } \
872 if ( (unsigned long)__sys_res >= (unsigned long)-4095 ){ \
873 errno = -__sys_res; \
874 __sys_res = -1; \
875 } \
876 __sys_res; \
877})
878
879#define K_LOAD_ARGS_0()
880#define K_LOAD_ARGS_1(r26) \
881 register unsigned long __r26 __asm__("r26") = (unsigned long)(r26); \
882 K_LOAD_ARGS_0()
883#define K_LOAD_ARGS_2(r26,r25) \
884 register unsigned long __r25 __asm__("r25") = (unsigned long)(r25); \
885 K_LOAD_ARGS_1(r26)
886#define K_LOAD_ARGS_3(r26,r25,r24) \
887 register unsigned long __r24 __asm__("r24") = (unsigned long)(r24); \
888 K_LOAD_ARGS_2(r26,r25)
889#define K_LOAD_ARGS_4(r26,r25,r24,r23) \
890 register unsigned long __r23 __asm__("r23") = (unsigned long)(r23); \
891 K_LOAD_ARGS_3(r26,r25,r24)
892#define K_LOAD_ARGS_5(r26,r25,r24,r23,r22) \
893 register unsigned long __r22 __asm__("r22") = (unsigned long)(r22); \
894 K_LOAD_ARGS_4(r26,r25,r24,r23)
895#define K_LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \
896 register unsigned long __r21 __asm__("r21") = (unsigned long)(r21); \
897 K_LOAD_ARGS_5(r26,r25,r24,r23,r22)
898
899/* Even with zero args we use r20 for the syscall number */
900#define K_ASM_ARGS_0
901#define K_ASM_ARGS_1 K_ASM_ARGS_0, "r" (__r26)
902#define K_ASM_ARGS_2 K_ASM_ARGS_1, "r" (__r25)
903#define K_ASM_ARGS_3 K_ASM_ARGS_2, "r" (__r24)
904#define K_ASM_ARGS_4 K_ASM_ARGS_3, "r" (__r23)
905#define K_ASM_ARGS_5 K_ASM_ARGS_4, "r" (__r22)
906#define K_ASM_ARGS_6 K_ASM_ARGS_5, "r" (__r21)
907
908/* The registers not listed as inputs but clobbered */
909#define K_CLOB_ARGS_6
910#define K_CLOB_ARGS_5 K_CLOB_ARGS_6, "%r21"
911#define K_CLOB_ARGS_4 K_CLOB_ARGS_5, "%r22"
912#define K_CLOB_ARGS_3 K_CLOB_ARGS_4, "%r23"
913#define K_CLOB_ARGS_2 K_CLOB_ARGS_3, "%r24"
914#define K_CLOB_ARGS_1 K_CLOB_ARGS_2, "%r25"
915#define K_CLOB_ARGS_0 K_CLOB_ARGS_1, "%r26"
916
917#define _syscall0(type,name) \
918type name(void) \
919{ \
920 return K_INLINE_SYSCALL(name, 0); \
921}
922
923#define _syscall1(type,name,type1,arg1) \
924type name(type1 arg1) \
925{ \
926 return K_INLINE_SYSCALL(name, 1, arg1); \
927}
928
929#define _syscall2(type,name,type1,arg1,type2,arg2) \
930type name(type1 arg1, type2 arg2) \
931{ \
932 return K_INLINE_SYSCALL(name, 2, arg1, arg2); \
933}
934
935#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
936type name(type1 arg1, type2 arg2, type3 arg3) \
937{ \
938 return K_INLINE_SYSCALL(name, 3, arg1, arg2, arg3); \
939}
940
941#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
942type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
943{ \
944 return K_INLINE_SYSCALL(name, 4, arg1, arg2, arg3, arg4); \
945}
946
947/* select takes 5 arguments */
948#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
949type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
950{ \
951 return K_INLINE_SYSCALL(name, 5, arg1, arg2, arg3, arg4, arg5); \
952}
953
954#define __ARCH_WANT_OLD_READDIR
955#define __ARCH_WANT_STAT64
956#define __ARCH_WANT_SYS_ALARM
957#define __ARCH_WANT_SYS_GETHOSTNAME
958#define __ARCH_WANT_SYS_PAUSE
959#define __ARCH_WANT_SYS_SGETMASK
960#define __ARCH_WANT_SYS_SIGNAL
961#define __ARCH_WANT_SYS_TIME
962#define __ARCH_WANT_COMPAT_SYS_TIME
963#define __ARCH_WANT_SYS_UTIME
964#define __ARCH_WANT_SYS_WAITPID
965#define __ARCH_WANT_SYS_SOCKETCALL
966#define __ARCH_WANT_SYS_FADVISE64
967#define __ARCH_WANT_SYS_GETPGRP
968#define __ARCH_WANT_SYS_LLSEEK
969#define __ARCH_WANT_SYS_NICE
970#define __ARCH_WANT_SYS_OLD_GETRLIMIT
971#define __ARCH_WANT_SYS_OLDUMOUNT
972#define __ARCH_WANT_SYS_SIGPENDING
973#define __ARCH_WANT_SYS_SIGPROCMASK
974#define __ARCH_WANT_SYS_RT_SIGACTION
975#define __ARCH_WANT_SYS_RT_SIGSUSPEND
976#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
977
978#endif /* __ASSEMBLY__ */
979
980#undef STR
981
982/*
983 * "Conditional" syscalls
984 *
985 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
986 * but it doesn't work on all toolchains, so we just do it by hand
987 */
988#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
989
990#endif /* __KERNEL__ */
991#endif /* _ASM_PARISC_UNISTD_H_ */
diff --git a/include/asm-parisc/unwind.h b/include/asm-parisc/unwind.h
deleted file mode 100644
index 2f7e6e50a158..000000000000
--- a/include/asm-parisc/unwind.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef _UNWIND_H_
2#define _UNWIND_H_
3
4#include <linux/list.h>
5
6/* From ABI specifications */
7struct unwind_table_entry {
8 unsigned int region_start;
9 unsigned int region_end;
10 unsigned int Cannot_unwind:1; /* 0 */
11 unsigned int Millicode:1; /* 1 */
12 unsigned int Millicode_save_sr0:1; /* 2 */
13 unsigned int Region_description:2; /* 3..4 */
14 unsigned int reserved1:1; /* 5 */
15 unsigned int Entry_SR:1; /* 6 */
16 unsigned int Entry_FR:4; /* number saved *//* 7..10 */
17 unsigned int Entry_GR:5; /* number saved *//* 11..15 */
18 unsigned int Args_stored:1; /* 16 */
19 unsigned int Variable_Frame:1; /* 17 */
20 unsigned int Separate_Package_Body:1; /* 18 */
21 unsigned int Frame_Extension_Millicode:1; /* 19 */
22 unsigned int Stack_Overflow_Check:1; /* 20 */
23 unsigned int Two_Instruction_SP_Increment:1; /* 21 */
24 unsigned int Ada_Region:1; /* 22 */
25 unsigned int cxx_info:1; /* 23 */
26 unsigned int cxx_try_catch:1; /* 24 */
27 unsigned int sched_entry_seq:1; /* 25 */
28 unsigned int reserved2:1; /* 26 */
29 unsigned int Save_SP:1; /* 27 */
30 unsigned int Save_RP:1; /* 28 */
31 unsigned int Save_MRP_in_frame:1; /* 29 */
32 unsigned int extn_ptr_defined:1; /* 30 */
33 unsigned int Cleanup_defined:1; /* 31 */
34
35 unsigned int MPE_XL_interrupt_marker:1; /* 0 */
36 unsigned int HP_UX_interrupt_marker:1; /* 1 */
37 unsigned int Large_frame:1; /* 2 */
38 unsigned int Pseudo_SP_Set:1; /* 3 */
39 unsigned int reserved4:1; /* 4 */
40 unsigned int Total_frame_size:27; /* 5..31 */
41};
42
43struct unwind_table {
44 struct list_head list;
45 const char *name;
46 unsigned long gp;
47 unsigned long base_addr;
48 unsigned long start;
49 unsigned long end;
50 const struct unwind_table_entry *table;
51 unsigned long length;
52};
53
54struct unwind_frame_info {
55 struct task_struct *t;
56 /* Eventually we would like to be able to get at any of the registers
57 available; but for now we only try to get the sp and ip for each
58 frame */
59 /* struct pt_regs regs; */
60 unsigned long sp, ip, rp, r31;
61 unsigned long prev_sp, prev_ip;
62};
63
64struct unwind_table *
65unwind_table_add(const char *name, unsigned long base_addr,
66 unsigned long gp, void *start, void *end);
67void
68unwind_table_remove(struct unwind_table *table);
69
70void unwind_frame_init(struct unwind_frame_info *info, struct task_struct *t,
71 struct pt_regs *regs);
72void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct task_struct *t);
73void unwind_frame_init_running(struct unwind_frame_info *info, struct pt_regs *regs);
74int unwind_once(struct unwind_frame_info *info);
75int unwind_to_user(struct unwind_frame_info *info);
76
77#endif
diff --git a/include/asm-parisc/user.h b/include/asm-parisc/user.h
deleted file mode 100644
index 80224753e508..000000000000
--- a/include/asm-parisc/user.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* This file should not exist, but lots of generic code still includes
2 it. It's a hangover from old a.out days and the traditional core
3 dump format. We are ELF-only, and so are our core dumps. If we
4 need to support HP/UX core format then we'll do it here
5 eventually. */
diff --git a/include/asm-parisc/vga.h b/include/asm-parisc/vga.h
deleted file mode 100644
index 171399a88ca6..000000000000
--- a/include/asm-parisc/vga.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_PARISC_VGA_H__
2#define __ASM_PARISC_VGA_H__
3
4/* nothing */
5
6#endif /* __ASM_PARISC_VGA_H__ */
diff --git a/include/asm-parisc/xor.h b/include/asm-parisc/xor.h
deleted file mode 100644
index c82eb12a5b18..000000000000
--- a/include/asm-parisc/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/xor.h>
diff --git a/include/asm-um/a.out-core.h b/include/asm-um/a.out-core.h
deleted file mode 100644
index 995643b18309..000000000000
--- a/include/asm-um/a.out-core.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* a.out coredump register dumper
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 Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef __UM_A_OUT_CORE_H
13#define __UM_A_OUT_CORE_H
14
15#ifdef __KERNEL__
16
17#include <linux/user.h>
18
19/*
20 * fill in the user structure for an a.out core dump
21 */
22static inline void aout_dump_thread(struct pt_regs *regs, struct user *u)
23{
24}
25
26#endif /* __KERNEL__ */
27#endif /* __UM_A_OUT_CORE_H */
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h
deleted file mode 100644
index 754181ee8683..000000000000
--- a/include/asm-um/a.out.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * Copyright (C) 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_A_OUT_H
7#define __UM_A_OUT_H
8
9#include "asm/arch/a.out.h"
10
11#endif
diff --git a/include/asm-um/alternative-asm.h b/include/asm-um/alternative-asm.h
deleted file mode 100644
index 9aa9fa2402a4..000000000000
--- a/include/asm-um/alternative-asm.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_ALTERNATIVE_ASM_I
2#define __UM_ALTERNATIVE_ASM_I
3
4#include "asm/arch/alternative-asm.h"
5
6#endif
diff --git a/include/asm-um/alternative.h b/include/asm-um/alternative.h
deleted file mode 100644
index b6434396bd42..000000000000
--- a/include/asm-um/alternative.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_ALTERNATIVE_H
2#define __UM_ALTERNATIVE_H
3
4#include "asm/arch/alternative.h"
5
6#endif
diff --git a/include/asm-um/apic.h b/include/asm-um/apic.h
deleted file mode 100644
index 876dee84ab11..000000000000
--- a/include/asm-um/apic.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __UM_APIC_H
2#define __UM_APIC_H
3
4#endif
diff --git a/include/asm-um/archparam-i386.h b/include/asm-um/archparam-i386.h
deleted file mode 100644
index 49e89b8d7e58..000000000000
--- a/include/asm-um/archparam-i386.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_ARCHPARAM_I386_H
7#define __UM_ARCHPARAM_I386_H
8
9/********* Nothing for asm-um/hardirq.h **********/
10
11/********* Nothing for asm-um/hw_irq.h **********/
12
13/********* Nothing for asm-um/string.h **********/
14
15#endif
16
17/*
18 * Overrides for Emacs so that we follow Linus's tabbing style.
19 * Emacs will notice this stuff at the end of the file and automatically
20 * adjust the settings for this buffer only. This must remain at the end
21 * of the file.
22 * ---------------------------------------------------------------------------
23 * Local variables:
24 * c-file-style: "linux"
25 * End:
26 */
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h
deleted file mode 100644
index 4269d8a37b4f..000000000000
--- a/include/asm-um/archparam-ppc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __UM_ARCHPARAM_PPC_H
2#define __UM_ARCHPARAM_PPC_H
3
4/********* Bits for asm-um/string.h **********/
5
6#define __HAVE_ARCH_STRRCHR
7
8#endif
diff --git a/include/asm-um/archparam-x86_64.h b/include/asm-um/archparam-x86_64.h
deleted file mode 100644
index 270ed9586b68..000000000000
--- a/include/asm-um/archparam-x86_64.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_ARCHPARAM_X86_64_H
8#define __UM_ARCHPARAM_X86_64_H
9
10
11/* No user-accessible fixmap addresses, i.e. vsyscall */
12#define FIXADDR_USER_START 0
13#define FIXADDR_USER_END 0
14
15#endif
16
17/*
18 * Overrides for Emacs so that we follow Linus's tabbing style.
19 * Emacs will notice this stuff at the end of the file and automatically
20 * adjust the settings for this buffer only. This must remain at the end
21 * of the file.
22 * ---------------------------------------------------------------------------
23 * Local variables:
24 * c-file-style: "linux"
25 * End:
26 */
diff --git a/include/asm-um/asm.h b/include/asm-um/asm.h
deleted file mode 100644
index af1269a1e9eb..000000000000
--- a/include/asm-um/asm.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_ASM_H
2#define __UM_ASM_H
3
4#include "asm/arch/asm.h"
5
6#endif
diff --git a/include/asm-um/atomic.h b/include/asm-um/atomic.h
deleted file mode 100644
index b683f1034d1e..000000000000
--- a/include/asm-um/atomic.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __UM_ATOMIC_H
2#define __UM_ATOMIC_H
3
4/* The i386 atomic.h calls printk, but doesn't include kernel.h, so we
5 * include it here.
6 */
7#include "linux/kernel.h"
8
9#include "asm/arch/atomic.h"
10
11#endif
diff --git a/include/asm-um/auxvec.h b/include/asm-um/auxvec.h
deleted file mode 100644
index 1e5e1c2fc9b1..000000000000
--- a/include/asm-um/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __UM_AUXVEC_H
2#define __UM_AUXVEC_H
3
4#endif
diff --git a/include/asm-um/bitops.h b/include/asm-um/bitops.h
deleted file mode 100644
index e4d38d437b97..000000000000
--- a/include/asm-um/bitops.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __UM_BITOPS_H
2#define __UM_BITOPS_H
3
4#ifndef _LINUX_BITOPS_H
5#error only <linux/bitops.h> can be included directly
6#endif
7
8#include "asm/arch/bitops.h"
9
10#endif
diff --git a/include/asm-um/boot.h b/include/asm-um/boot.h
deleted file mode 100644
index 09548c3e784e..000000000000
--- a/include/asm-um/boot.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_BOOT_H
2#define __UM_BOOT_H
3
4#include "asm/arch/boot.h"
5
6#endif
diff --git a/include/asm-um/bug.h b/include/asm-um/bug.h
deleted file mode 100644
index 9e33b864c359..000000000000
--- a/include/asm-um/bug.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_BUG_H
2#define __UM_BUG_H
3
4#include <asm-generic/bug.h>
5
6#endif
diff --git a/include/asm-um/bugs.h b/include/asm-um/bugs.h
deleted file mode 100644
index 6a72e240d5fc..000000000000
--- a/include/asm-um/bugs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_BUGS_H
2#define __UM_BUGS_H
3
4void check_bugs(void);
5
6#endif
diff --git a/include/asm-um/byteorder.h b/include/asm-um/byteorder.h
deleted file mode 100644
index eee0a834f447..000000000000
--- a/include/asm-um/byteorder.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_BYTEORDER_H
2#define __UM_BYTEORDER_H
3
4#include "asm/arch/byteorder.h"
5
6#endif
diff --git a/include/asm-um/cache.h b/include/asm-um/cache.h
deleted file mode 100644
index 19e1bdd67416..000000000000
--- a/include/asm-um/cache.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __UM_CACHE_H
2#define __UM_CACHE_H
3
4
5#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT)
6# define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
7#elif defined(CONFIG_UML_X86) /* 64-bit */
8# define L1_CACHE_SHIFT 6 /* Should be 7 on Intel */
9#else
10/* XXX: this was taken from x86, now it's completely random. Luckily only
11 * affects SMP padding. */
12# define L1_CACHE_SHIFT 5
13#endif
14
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#endif
diff --git a/include/asm-um/cacheflush.h b/include/asm-um/cacheflush.h
deleted file mode 100644
index 12e9d4b74c8f..000000000000
--- a/include/asm-um/cacheflush.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_CACHEFLUSH_H
2#define __UM_CACHEFLUSH_H
3
4#include "asm/arch/cacheflush.h"
5
6#endif
diff --git a/include/asm-um/calling.h b/include/asm-um/calling.h
deleted file mode 100644
index 0b2384cc99fd..000000000000
--- a/include/asm-um/calling.h
+++ /dev/null
@@ -1,9 +0,0 @@
1# Copyright 2003 - 2004 Pathscale, Inc
2# Released under the GPL
3
4#ifndef __UM_CALLING_H /* XXX x86_64 */
5#define __UM_CALLING_H
6
7#include "asm/arch/calling.h"
8
9#endif
diff --git a/include/asm-um/checksum.h b/include/asm-um/checksum.h
deleted file mode 100644
index 5b501361e361..000000000000
--- a/include/asm-um/checksum.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_CHECKSUM_H
2#define __UM_CHECKSUM_H
3
4#include "sysdep/checksum.h"
5
6#endif
diff --git a/include/asm-um/cmpxchg.h b/include/asm-um/cmpxchg.h
deleted file mode 100644
index 529376a99885..000000000000
--- a/include/asm-um/cmpxchg.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_CMPXCHG_H
2#define __UM_CMPXCHG_H
3
4#include "asm/arch/cmpxchg.h"
5
6#endif
diff --git a/include/asm-um/cobalt.h b/include/asm-um/cobalt.h
deleted file mode 100644
index f813a684be98..000000000000
--- a/include/asm-um/cobalt.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_COBALT_H
2#define __UM_COBALT_H
3
4#include "asm/arch/cobalt.h"
5
6#endif
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S
deleted file mode 100644
index cb0248616d49..000000000000
--- a/include/asm-um/common.lds.S
+++ /dev/null
@@ -1,130 +0,0 @@
1#include <asm-generic/vmlinux.lds.h>
2
3 .fini : { *(.fini) } =0x9090
4 _etext = .;
5 PROVIDE (etext = .);
6
7 . = ALIGN(4096);
8 _sdata = .;
9 PROVIDE (sdata = .);
10
11 RODATA
12
13 .unprotected : { *(.unprotected) }
14 . = ALIGN(4096);
15 PROVIDE (_unprotected_end = .);
16
17 . = ALIGN(4096);
18 .note : { *(.note.*) }
19 __ex_table : {
20 __start___ex_table = .;
21 *(__ex_table)
22 __stop___ex_table = .;
23 }
24
25 BUG_TABLE
26
27 .uml.setup.init : {
28 __uml_setup_start = .;
29 *(.uml.setup.init)
30 __uml_setup_end = .;
31 }
32
33 .uml.help.init : {
34 __uml_help_start = .;
35 *(.uml.help.init)
36 __uml_help_end = .;
37 }
38
39 .uml.postsetup.init : {
40 __uml_postsetup_start = .;
41 *(.uml.postsetup.init)
42 __uml_postsetup_end = .;
43 }
44
45 .init.setup : {
46 __setup_start = .;
47 *(.init.setup)
48 __setup_end = .;
49 }
50
51 . = ALIGN(32);
52 .data.percpu : {
53 __per_cpu_start = . ;
54 *(.data.percpu)
55 __per_cpu_end = . ;
56 }
57
58 .initcall.init : {
59 __initcall_start = .;
60 INITCALLS
61 __initcall_end = .;
62 }
63
64 .con_initcall.init : {
65 __con_initcall_start = .;
66 *(.con_initcall.init)
67 __con_initcall_end = .;
68 }
69
70 .uml.initcall.init : {
71 __uml_initcall_start = .;
72 *(.uml.initcall.init)
73 __uml_initcall_end = .;
74 }
75 __init_end = .;
76
77 SECURITY_INIT
78
79 .exitcall : {
80 __exitcall_begin = .;
81 *(.exitcall.exit)
82 __exitcall_end = .;
83 }
84
85 .uml.exitcall : {
86 __uml_exitcall_begin = .;
87 *(.uml.exitcall.exit)
88 __uml_exitcall_end = .;
89 }
90
91 . = ALIGN(4);
92 .altinstructions : {
93 __alt_instructions = .;
94 *(.altinstructions)
95 __alt_instructions_end = .;
96 }
97 .altinstr_replacement : { *(.altinstr_replacement) }
98 /* .exit.text is discard at runtime, not link time, to deal with references
99 from .altinstructions and .eh_frame */
100 .exit.text : { *(.exit.text) }
101 .exit.data : { *(.exit.data) }
102
103 .preinit_array : {
104 __preinit_array_start = .;
105 *(.preinit_array)
106 __preinit_array_end = .;
107 }
108 .init_array : {
109 __init_array_start = .;
110 *(.init_array)
111 __init_array_end = .;
112 }
113 .fini_array : {
114 __fini_array_start = .;
115 *(.fini_array)
116 __fini_array_end = .;
117 }
118
119 . = ALIGN(4096);
120 .init.ramfs : {
121 __initramfs_start = .;
122 *(.init.ramfs)
123 __initramfs_end = .;
124 }
125
126 /* Sections to be discarded */
127 /DISCARD/ : {
128 *(.exitcall.exit)
129 }
130
diff --git a/include/asm-um/cpufeature.h b/include/asm-um/cpufeature.h
deleted file mode 100644
index fb7bd42a4d96..000000000000
--- a/include/asm-um/cpufeature.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_CPUFEATURE_H
2#define __UM_CPUFEATURE_H
3
4#include "asm/arch/cpufeature.h"
5
6#endif
diff --git a/include/asm-um/cputime.h b/include/asm-um/cputime.h
deleted file mode 100644
index c84acbadfa2f..000000000000
--- a/include/asm-um/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_CPUTIME_H
2#define __UM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __UM_CPUTIME_H */
diff --git a/include/asm-um/current.h b/include/asm-um/current.h
deleted file mode 100644
index c2191d9aa03d..000000000000
--- a/include/asm-um/current.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_CURRENT_H
7#define __UM_CURRENT_H
8
9#include "linux/thread_info.h"
10
11#define current (current_thread_info()->task)
12
13#endif
diff --git a/include/asm-um/delay.h b/include/asm-um/delay.h
deleted file mode 100644
index c71e32b6741e..000000000000
--- a/include/asm-um/delay.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __UM_DELAY_H
2#define __UM_DELAY_H
3
4#define MILLION 1000000
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
20#endif
diff --git a/include/asm-um/desc.h b/include/asm-um/desc.h
deleted file mode 100644
index 4ec34a51b62c..000000000000
--- a/include/asm-um/desc.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __UM_DESC_H
2#define __UM_DESC_H
3
4/* Taken from asm-i386/desc.h, it's the only thing we need. The rest wouldn't
5 * compile, and has never been used. */
6#define LDT_empty(info) (\
7 (info)->base_addr == 0 && \
8 (info)->limit == 0 && \
9 (info)->contents == 0 && \
10 (info)->read_exec_only == 1 && \
11 (info)->seg_32bit == 0 && \
12 (info)->limit_in_pages == 0 && \
13 (info)->seg_not_present == 1 && \
14 (info)->useable == 0 )
15
16#endif
diff --git a/include/asm-um/device.h b/include/asm-um/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-um/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h
deleted file mode 100644
index 1e17f7409cab..000000000000
--- a/include/asm-um/div64.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _UM_DIV64_H
2#define _UM_DIV64_H
3
4#include "asm/arch/div64.h"
5
6#endif
diff --git a/include/asm-um/dma-mapping.h b/include/asm-um/dma-mapping.h
deleted file mode 100644
index f0ee4fb55911..000000000000
--- a/include/asm-um/dma-mapping.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5
6static inline int
7dma_supported(struct device *dev, u64 mask)
8{
9 BUG();
10 return(0);
11}
12
13static inline int
14dma_set_mask(struct device *dev, u64 dma_mask)
15{
16 BUG();
17 return(0);
18}
19
20static inline void *
21dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
22 gfp_t flag)
23{
24 BUG();
25 return((void *) 0);
26}
27
28static inline void
29dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
30 dma_addr_t dma_handle)
31{
32 BUG();
33}
34
35static inline dma_addr_t
36dma_map_single(struct device *dev, void *cpu_addr, size_t size,
37 enum dma_data_direction direction)
38{
39 BUG();
40 return(0);
41}
42
43static inline void
44dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
45 enum dma_data_direction direction)
46{
47 BUG();
48}
49
50static inline dma_addr_t
51dma_map_page(struct device *dev, struct page *page,
52 unsigned long offset, size_t size,
53 enum dma_data_direction direction)
54{
55 BUG();
56 return(0);
57}
58
59static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
61 enum dma_data_direction direction)
62{
63 BUG();
64}
65
66static inline int
67dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
68 enum dma_data_direction direction)
69{
70 BUG();
71 return(0);
72}
73
74static inline void
75dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
76 enum dma_data_direction direction)
77{
78 BUG();
79}
80
81static inline void
82dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
83 enum dma_data_direction direction)
84{
85 BUG();
86}
87
88static inline void
89dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
90 enum dma_data_direction direction)
91{
92 BUG();
93}
94
95#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
96#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
97#define dma_is_consistent(d, h) (1)
98
99static inline int
100dma_get_cache_alignment(void)
101{
102 BUG();
103 return(0);
104}
105
106static inline void
107dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
108 unsigned long offset, size_t size,
109 enum dma_data_direction direction)
110{
111 BUG();
112}
113
114static inline void
115dma_cache_sync(struct device *dev, void *vaddr, size_t size,
116 enum dma_data_direction direction)
117{
118 BUG();
119}
120
121#endif
diff --git a/include/asm-um/dma.h b/include/asm-um/dma.h
deleted file mode 100644
index 9f6139a8a525..000000000000
--- a/include/asm-um/dma.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __UM_DMA_H
2#define __UM_DMA_H
3
4#include "asm/io.h"
5
6extern unsigned long uml_physmem;
7
8#define MAX_DMA_ADDRESS (uml_physmem)
9
10#endif
diff --git a/include/asm-um/dwarf2.h b/include/asm-um/dwarf2.h
deleted file mode 100644
index d1a02e762931..000000000000
--- a/include/asm-um/dwarf2.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* Copyright 2003 - 2004 Pathscale, Inc
2 * Released under the GPL
3 */
4
5/* Needed on x86_64 by thunk.S */
6#ifndef __UM_DWARF2_H
7#define __UM_DWARF2_H
8
9#include "asm/arch/dwarf2.h"
10
11#endif
diff --git a/include/asm-um/elf-i386.h b/include/asm-um/elf-i386.h
deleted file mode 100644
index 23d6893e8617..000000000000
--- a/include/asm-um/elf-i386.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5#ifndef __UM_ELF_I386_H
6#define __UM_ELF_I386_H
7
8#include <asm/user.h>
9#include "skas.h"
10
11#define R_386_NONE 0
12#define R_386_32 1
13#define R_386_PC32 2
14#define R_386_GOT32 3
15#define R_386_PLT32 4
16#define R_386_COPY 5
17#define R_386_GLOB_DAT 6
18#define R_386_JMP_SLOT 7
19#define R_386_RELATIVE 8
20#define R_386_GOTOFF 9
21#define R_386_GOTPC 10
22#define R_386_NUM 11
23
24typedef unsigned long elf_greg_t;
25
26#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
27typedef elf_greg_t elf_gregset_t[ELF_NGREG];
28
29typedef struct user_i387_struct elf_fpregset_t;
30
31/*
32 * This is used to ensure we don't load something for the wrong architecture.
33 */
34#define elf_check_arch(x) \
35 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
36
37#define ELF_CLASS ELFCLASS32
38#define ELF_DATA ELFDATA2LSB
39#define ELF_ARCH EM_386
40
41#define ELF_PLAT_INIT(regs, load_addr) do { \
42 PT_REGS_EBX(regs) = 0; \
43 PT_REGS_ECX(regs) = 0; \
44 PT_REGS_EDX(regs) = 0; \
45 PT_REGS_ESI(regs) = 0; \
46 PT_REGS_EDI(regs) = 0; \
47 PT_REGS_EBP(regs) = 0; \
48 PT_REGS_EAX(regs) = 0; \
49} while (0)
50
51#define USE_ELF_CORE_DUMP
52#define ELF_EXEC_PAGESIZE 4096
53
54#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
55
56/* Shamelessly stolen from include/asm-i386/elf.h */
57
58#define ELF_CORE_COPY_REGS(pr_reg, regs) do { \
59 pr_reg[0] = PT_REGS_EBX(regs); \
60 pr_reg[1] = PT_REGS_ECX(regs); \
61 pr_reg[2] = PT_REGS_EDX(regs); \
62 pr_reg[3] = PT_REGS_ESI(regs); \
63 pr_reg[4] = PT_REGS_EDI(regs); \
64 pr_reg[5] = PT_REGS_EBP(regs); \
65 pr_reg[6] = PT_REGS_EAX(regs); \
66 pr_reg[7] = PT_REGS_DS(regs); \
67 pr_reg[8] = PT_REGS_ES(regs); \
68 /* fake once used fs and gs selectors? */ \
69 pr_reg[9] = PT_REGS_DS(regs); \
70 pr_reg[10] = PT_REGS_DS(regs); \
71 pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \
72 pr_reg[12] = PT_REGS_IP(regs); \
73 pr_reg[13] = PT_REGS_CS(regs); \
74 pr_reg[14] = PT_REGS_EFLAGS(regs); \
75 pr_reg[15] = PT_REGS_SP(regs); \
76 pr_reg[16] = PT_REGS_SS(regs); \
77} while (0);
78
79extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
80
81#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
82
83extern long elf_aux_hwcap;
84#define ELF_HWCAP (elf_aux_hwcap)
85
86extern char * elf_aux_platform;
87#define ELF_PLATFORM (elf_aux_platform)
88
89#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
90
91extern unsigned long vsyscall_ehdr;
92extern unsigned long vsyscall_end;
93extern unsigned long __kernel_vsyscall;
94
95#define VSYSCALL_BASE vsyscall_ehdr
96#define VSYSCALL_END vsyscall_end
97
98/*
99 * This is the range that is readable by user mode, and things
100 * acting like user mode such as get_user_pages.
101 */
102#define FIXADDR_USER_START VSYSCALL_BASE
103#define FIXADDR_USER_END VSYSCALL_END
104
105/*
106 * Architecture-neutral AT_ values in 0-17, leave some room
107 * for more of them, start the x86-specific ones at 32.
108 */
109#define AT_SYSINFO 32
110#define AT_SYSINFO_EHDR 33
111
112#define ARCH_DLINFO \
113do { \
114 if ( vsyscall_ehdr ) { \
115 NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \
116 NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \
117 } \
118} while (0)
119
120/*
121 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
122 * extra segments containing the vsyscall DSO contents. Dumping its
123 * contents makes post-mortem fully interpretable later without matching up
124 * the same kernel and hardware config to see what PC values meant.
125 * Dumping its extra ELF program headers includes all the other information
126 * a debugger needs to easily find how the vsyscall DSO was being used.
127 */
128#define ELF_CORE_EXTRA_PHDRS \
129 (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 )
130
131#define ELF_CORE_WRITE_EXTRA_PHDRS \
132if ( vsyscall_ehdr ) { \
133 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
134 const struct elf_phdr *const phdrp = \
135 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
136 int i; \
137 Elf32_Off ofs = 0; \
138 for (i = 0; i < ehdrp->e_phnum; ++i) { \
139 struct elf_phdr phdr = phdrp[i]; \
140 if (phdr.p_type == PT_LOAD) { \
141 ofs = phdr.p_offset = offset; \
142 offset += phdr.p_filesz; \
143 } \
144 else \
145 phdr.p_offset += ofs; \
146 phdr.p_paddr = 0; /* match other core phdrs */ \
147 DUMP_WRITE(&phdr, sizeof(phdr)); \
148 } \
149}
150#define ELF_CORE_WRITE_EXTRA_DATA \
151if ( vsyscall_ehdr ) { \
152 const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \
153 const struct elf_phdr *const phdrp = \
154 (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \
155 int i; \
156 for (i = 0; i < ehdrp->e_phnum; ++i) { \
157 if (phdrp[i].p_type == PT_LOAD) \
158 DUMP_WRITE((void *) phdrp[i].p_vaddr, \
159 phdrp[i].p_filesz); \
160 } \
161}
162
163#endif
diff --git a/include/asm-um/elf-ppc.h b/include/asm-um/elf-ppc.h
deleted file mode 100644
index d3b90b7ac3e9..000000000000
--- a/include/asm-um/elf-ppc.h
+++ /dev/null
@@ -1,53 +0,0 @@
1#ifndef __UM_ELF_PPC_H
2#define __UM_ELF_PPC_H
3
4
5extern long elf_aux_hwcap;
6#define ELF_HWCAP (elf_aux_hwcap)
7
8#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
9
10#define ELF_EXEC_PAGESIZE 4096
11
12#define elf_check_arch(x) (1)
13
14#ifdef CONFIG_64BIT
15#define ELF_CLASS ELFCLASS64
16#else
17#define ELF_CLASS ELFCLASS32
18#endif
19
20#define USE_ELF_CORE_DUMP
21
22#define R_386_NONE 0
23#define R_386_32 1
24#define R_386_PC32 2
25#define R_386_GOT32 3
26#define R_386_PLT32 4
27#define R_386_COPY 5
28#define R_386_GLOB_DAT 6
29#define R_386_JMP_SLOT 7
30#define R_386_RELATIVE 8
31#define R_386_GOTOFF 9
32#define R_386_GOTPC 10
33#define R_386_NUM 11
34
35#define ELF_PLATFORM (0)
36
37#define ELF_ET_DYN_BASE (0x08000000)
38
39/* the following stolen from asm-ppc/elf.h */
40#define ELF_NGREG 48 /* includes nip, msr, lr, etc. */
41#define ELF_NFPREG 33 /* includes fpscr */
42/* General registers */
43typedef unsigned long elf_greg_t;
44typedef elf_greg_t elf_gregset_t[ELF_NGREG];
45
46/* Floating point registers */
47typedef double elf_fpreg_t;
48typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
49
50#define ELF_DATA ELFDATA2MSB
51#define ELF_ARCH EM_PPC
52
53#endif
diff --git a/include/asm-um/elf-x86_64.h b/include/asm-um/elf-x86_64.h
deleted file mode 100644
index 3b2d5224a7e1..000000000000
--- a/include/asm-um/elf-x86_64.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 *
5 * Licensed under the GPL
6 */
7#ifndef __UM_ELF_X86_64_H
8#define __UM_ELF_X86_64_H
9
10#include <asm/user.h>
11#include "skas.h"
12
13/* x86-64 relocation types, taken from asm-x86_64/elf.h */
14#define R_X86_64_NONE 0 /* No reloc */
15#define R_X86_64_64 1 /* Direct 64 bit */
16#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
17#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
18#define R_X86_64_PLT32 4 /* 32 bit PLT address */
19#define R_X86_64_COPY 5 /* Copy symbol at runtime */
20#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
21#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
22#define R_X86_64_RELATIVE 8 /* Adjust by program base */
23#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
24 offset to GOT */
25#define R_X86_64_32 10 /* Direct 32 bit zero extended */
26#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
27#define R_X86_64_16 12 /* Direct 16 bit zero extended */
28#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
29#define R_X86_64_8 14 /* Direct 8 bit sign extended */
30#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
31
32#define R_X86_64_NUM 16
33
34typedef unsigned long elf_greg_t;
35
36#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
37typedef elf_greg_t elf_gregset_t[ELF_NGREG];
38
39typedef struct user_i387_struct elf_fpregset_t;
40
41/*
42 * This is used to ensure we don't load something for the wrong architecture.
43 */
44#define elf_check_arch(x) \
45 ((x)->e_machine == EM_X86_64)
46
47#define ELF_CLASS ELFCLASS64
48#define ELF_DATA ELFDATA2LSB
49#define ELF_ARCH EM_X86_64
50
51#define ELF_PLAT_INIT(regs, load_addr) do { \
52 PT_REGS_RBX(regs) = 0; \
53 PT_REGS_RCX(regs) = 0; \
54 PT_REGS_RDX(regs) = 0; \
55 PT_REGS_RSI(regs) = 0; \
56 PT_REGS_RDI(regs) = 0; \
57 PT_REGS_RBP(regs) = 0; \
58 PT_REGS_RAX(regs) = 0; \
59 PT_REGS_R8(regs) = 0; \
60 PT_REGS_R9(regs) = 0; \
61 PT_REGS_R10(regs) = 0; \
62 PT_REGS_R11(regs) = 0; \
63 PT_REGS_R12(regs) = 0; \
64 PT_REGS_R13(regs) = 0; \
65 PT_REGS_R14(regs) = 0; \
66 PT_REGS_R15(regs) = 0; \
67} while (0)
68
69#define ELF_CORE_COPY_REGS(pr_reg, regs) \
70 (pr_reg)[0] = (regs)->regs.gp[0]; \
71 (pr_reg)[1] = (regs)->regs.gp[1]; \
72 (pr_reg)[2] = (regs)->regs.gp[2]; \
73 (pr_reg)[3] = (regs)->regs.gp[3]; \
74 (pr_reg)[4] = (regs)->regs.gp[4]; \
75 (pr_reg)[5] = (regs)->regs.gp[5]; \
76 (pr_reg)[6] = (regs)->regs.gp[6]; \
77 (pr_reg)[7] = (regs)->regs.gp[7]; \
78 (pr_reg)[8] = (regs)->regs.gp[8]; \
79 (pr_reg)[9] = (regs)->regs.gp[9]; \
80 (pr_reg)[10] = (regs)->regs.gp[10]; \
81 (pr_reg)[11] = (regs)->regs.gp[11]; \
82 (pr_reg)[12] = (regs)->regs.gp[12]; \
83 (pr_reg)[13] = (regs)->regs.gp[13]; \
84 (pr_reg)[14] = (regs)->regs.gp[14]; \
85 (pr_reg)[15] = (regs)->regs.gp[15]; \
86 (pr_reg)[16] = (regs)->regs.gp[16]; \
87 (pr_reg)[17] = (regs)->regs.gp[17]; \
88 (pr_reg)[18] = (regs)->regs.gp[18]; \
89 (pr_reg)[19] = (regs)->regs.gp[19]; \
90 (pr_reg)[20] = (regs)->regs.gp[20]; \
91 (pr_reg)[21] = current->thread.arch.fs; \
92 (pr_reg)[22] = 0; \
93 (pr_reg)[23] = 0; \
94 (pr_reg)[24] = 0; \
95 (pr_reg)[25] = 0; \
96 (pr_reg)[26] = 0;
97
98extern int elf_core_copy_fpregs(struct task_struct *t, elf_fpregset_t *fpu);
99
100#define ELF_CORE_COPY_FPREGS(t, fpu) elf_core_copy_fpregs(t, fpu)
101
102#ifdef TIF_IA32 /* XXX */
103#error XXX, indeed
104 clear_thread_flag(TIF_IA32);
105#endif
106
107#define USE_ELF_CORE_DUMP
108#define ELF_EXEC_PAGESIZE 4096
109
110#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
111
112extern long elf_aux_hwcap;
113#define ELF_HWCAP (elf_aux_hwcap)
114
115#define ELF_PLATFORM "x86_64"
116
117#define SET_PERSONALITY(ex, ibcs2) do ; while(0)
118
119#endif
diff --git a/include/asm-um/emergency-restart.h b/include/asm-um/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/include/asm-um/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-um/errno.h b/include/asm-um/errno.h
deleted file mode 100644
index b7a9e37fd8d8..000000000000
--- a/include/asm-um/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_ERRNO_H
2#define __UM_ERRNO_H
3
4#include "asm/arch/errno.h"
5
6#endif
diff --git a/include/asm-um/fcntl.h b/include/asm-um/fcntl.h
deleted file mode 100644
index 812a65446d92..000000000000
--- a/include/asm-um/fcntl.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_FCNTL_H
2#define __UM_FCNTL_H
3
4#include "asm/arch/fcntl.h"
5
6#endif
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h
deleted file mode 100644
index 9d2be52b8655..000000000000
--- a/include/asm-um/fixmap.h
+++ /dev/null
@@ -1,98 +0,0 @@
1#ifndef __UM_FIXMAP_H
2#define __UM_FIXMAP_H
3
4#include <asm/processor.h>
5#include <asm/system.h>
6#include <asm/kmap_types.h>
7#include <asm/archparam.h>
8#include <asm/page.h>
9
10/*
11 * Here we define all the compile-time 'special' virtual
12 * addresses. The point is to have a constant address at
13 * compile time, but to set the physical address only
14 * in the boot process. We allocate these special addresses
15 * from the end of virtual memory (0xfffff000) backwards.
16 * Also this lets us do fail-safe vmalloc(), we
17 * can guarantee that these special addresses and
18 * vmalloc()-ed addresses never overlap.
19 *
20 * these 'compile-time allocated' memory buffers are
21 * fixed-size 4k pages. (or larger if used with an increment
22 * highger than 1) use fixmap_set(idx,phys) to associate
23 * physical memory with fixmap indices.
24 *
25 * TLB entries of such buffers will not be flushed across
26 * task switches.
27 */
28
29/*
30 * on UP currently we will have no trace of the fixmap mechanizm,
31 * no page table allocations, etc. This might change in the
32 * future, say framebuffers for the console driver(s) could be
33 * fix-mapped?
34 */
35enum fixed_addresses {
36#ifdef CONFIG_HIGHMEM
37 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
38 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
39#endif
40 __end_of_fixed_addresses
41};
42
43extern void __set_fixmap (enum fixed_addresses idx,
44 unsigned long phys, pgprot_t flags);
45
46#define set_fixmap(idx, phys) \
47 __set_fixmap(idx, phys, PAGE_KERNEL)
48/*
49 * Some hardware wants to get fixmapped without caching.
50 */
51#define set_fixmap_nocache(idx, phys) \
52 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
53/*
54 * used by vmalloc.c.
55 *
56 * Leave one empty page between vmalloc'ed areas and
57 * the start of the fixmap, and leave one page empty
58 * at the top of mem..
59 */
60
61#define FIXADDR_TOP (TASK_SIZE - 2 * PAGE_SIZE)
62#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
63#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
64
65#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
66#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
67
68extern void __this_fixmap_does_not_exist(void);
69
70/*
71 * 'index to address' translation. If anyone tries to use the idx
72 * directly without tranlation, we catch the bug with a NULL-deference
73 * kernel oops. Illegal ranges of incoming indices are caught too.
74 */
75static inline unsigned long fix_to_virt(const unsigned int idx)
76{
77 /*
78 * this branch gets completely eliminated after inlining,
79 * except when someone tries to use fixaddr indices in an
80 * illegal way. (such as mixing up address types or using
81 * out-of-range indices).
82 *
83 * If it doesn't get removed, the linker will complain
84 * loudly with a reasonably clear error message..
85 */
86 if (idx >= __end_of_fixed_addresses)
87 __this_fixmap_does_not_exist();
88
89 return __fix_to_virt(idx);
90}
91
92static inline unsigned long virt_to_fix(const unsigned long vaddr)
93{
94 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
95 return __virt_to_fix(vaddr);
96}
97
98#endif
diff --git a/include/asm-um/floppy.h b/include/asm-um/floppy.h
deleted file mode 100644
index 453e7415fb6f..000000000000
--- a/include/asm-um/floppy.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_FLOPPY_H
2#define __UM_FLOPPY_H
3
4#include "asm/arch/floppy.h"
5
6#endif
diff --git a/include/asm-um/frame.h b/include/asm-um/frame.h
deleted file mode 100644
index 8a8c1cb415b4..000000000000
--- a/include/asm-um/frame.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_FRAME_I
2#define __UM_FRAME_I
3
4#include "asm/arch/frame.h"
5
6#endif
diff --git a/include/asm-um/futex.h b/include/asm-um/futex.h
deleted file mode 100644
index 6a332a9f099c..000000000000
--- a/include/asm-um/futex.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/include/asm-um/hardirq.h b/include/asm-um/hardirq.h
deleted file mode 100644
index 313ebb8a2566..000000000000
--- a/include/asm-um/hardirq.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* (c) 2004 cw@f00f.org, GPLv2 blah blah */
2
3#ifndef __ASM_UM_HARDIRQ_H
4#define __ASM_UM_HARDIRQ_H
5
6#include <linux/threads.h>
7#include <linux/irq.h>
8
9/* NOTE: When SMP works again we might want to make this
10 * ____cacheline_aligned or maybe use per_cpu state? --cw */
11typedef struct {
12 unsigned int __softirq_pending;
13} irq_cpustat_t;
14
15#include <linux/irq_cpustat.h>
16
17/* As this would be very strange for UML to get we BUG() after the
18 * printk. */
19static inline void ack_bad_irq(unsigned int irq)
20{
21 printk(KERN_ERR "unexpected IRQ %02x\n", irq);
22 BUG();
23}
24
25#endif /* __ASM_UM_HARDIRQ_H */
diff --git a/include/asm-um/highmem.h b/include/asm-um/highmem.h
deleted file mode 100644
index 36974cb8abc7..000000000000
--- a/include/asm-um/highmem.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __UM_HIGHMEM_H
2#define __UM_HIGHMEM_H
3
4#include "asm/page.h"
5#include "asm/fixmap.h"
6#include "asm/arch/highmem.h"
7
8#undef PKMAP_BASE
9
10#define PKMAP_BASE ((FIXADDR_START - LAST_PKMAP * PAGE_SIZE) & PMD_MASK)
11
12#endif
diff --git a/include/asm-um/host_ldt-i386.h b/include/asm-um/host_ldt-i386.h
deleted file mode 100644
index b27cb0a9dd30..000000000000
--- a/include/asm-um/host_ldt-i386.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __ASM_HOST_LDT_I386_H
2#define __ASM_HOST_LDT_I386_H
3
4#include "asm/arch/ldt.h"
5
6/*
7 * macros stolen from include/asm-i386/desc.h
8 */
9#define LDT_entry_a(info) \
10 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
11
12#define LDT_entry_b(info) \
13 (((info)->base_addr & 0xff000000) | \
14 (((info)->base_addr & 0x00ff0000) >> 16) | \
15 ((info)->limit & 0xf0000) | \
16 (((info)->read_exec_only ^ 1) << 9) | \
17 ((info)->contents << 10) | \
18 (((info)->seg_not_present ^ 1) << 15) | \
19 ((info)->seg_32bit << 22) | \
20 ((info)->limit_in_pages << 23) | \
21 ((info)->useable << 20) | \
22 0x7000)
23
24#define LDT_empty(info) (\
25 (info)->base_addr == 0 && \
26 (info)->limit == 0 && \
27 (info)->contents == 0 && \
28 (info)->read_exec_only == 1 && \
29 (info)->seg_32bit == 0 && \
30 (info)->limit_in_pages == 0 && \
31 (info)->seg_not_present == 1 && \
32 (info)->useable == 0 )
33
34#endif
diff --git a/include/asm-um/host_ldt-x86_64.h b/include/asm-um/host_ldt-x86_64.h
deleted file mode 100644
index 74a63f7d9a90..000000000000
--- a/include/asm-um/host_ldt-x86_64.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef __ASM_HOST_LDT_X86_64_H
2#define __ASM_HOST_LDT_X86_64_H
3
4#include "asm/arch/ldt.h"
5
6/*
7 * macros stolen from include/asm-x86_64/desc.h
8 */
9#define LDT_entry_a(info) \
10 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
11
12/* Don't allow setting of the lm bit. It is useless anyways because
13 * 64bit system calls require __USER_CS. */
14#define LDT_entry_b(info) \
15 (((info)->base_addr & 0xff000000) | \
16 (((info)->base_addr & 0x00ff0000) >> 16) | \
17 ((info)->limit & 0xf0000) | \
18 (((info)->read_exec_only ^ 1) << 9) | \
19 ((info)->contents << 10) | \
20 (((info)->seg_not_present ^ 1) << 15) | \
21 ((info)->seg_32bit << 22) | \
22 ((info)->limit_in_pages << 23) | \
23 ((info)->useable << 20) | \
24 /* ((info)->lm << 21) | */ \
25 0x7000)
26
27#define LDT_empty(info) (\
28 (info)->base_addr == 0 && \
29 (info)->limit == 0 && \
30 (info)->contents == 0 && \
31 (info)->read_exec_only == 1 && \
32 (info)->seg_32bit == 0 && \
33 (info)->limit_in_pages == 0 && \
34 (info)->seg_not_present == 1 && \
35 (info)->useable == 0 && \
36 (info)->lm == 0)
37
38#endif
diff --git a/include/asm-um/hw_irq.h b/include/asm-um/hw_irq.h
deleted file mode 100644
index 1cf84cf5f21a..000000000000
--- a/include/asm-um/hw_irq.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_UM_HW_IRQ_H
2#define _ASM_UM_HW_IRQ_H
3
4#include "asm/irq.h"
5#include "asm/archparam.h"
6
7#endif
diff --git a/include/asm-um/ide.h b/include/asm-um/ide.h
deleted file mode 100644
index 3d1ccebcfbaf..000000000000
--- a/include/asm-um/ide.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_IDE_H
2#define __UM_IDE_H
3
4#include "asm/arch/ide.h"
5
6#endif
diff --git a/include/asm-um/io.h b/include/asm-um/io.h
deleted file mode 100644
index 44e8b8c772ae..000000000000
--- a/include/asm-um/io.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef __UM_IO_H
2#define __UM_IO_H
3
4#include "asm/page.h"
5
6#define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */
7
8static inline int inb(unsigned long i) { return(0); }
9static inline void outb(char c, unsigned long i) { }
10
11/*
12 * Change virtual addresses to physical addresses and vv.
13 * These are pretty trivial
14 */
15static inline unsigned long virt_to_phys(volatile void * address)
16{
17 return __pa((void *) address);
18}
19
20static inline void * phys_to_virt(unsigned long address)
21{
22 return __va(address);
23}
24
25/*
26 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
27 * access
28 */
29#define xlate_dev_mem_ptr(p) __va(p)
30
31/*
32 * Convert a virtual cached pointer to an uncached pointer
33 */
34#define xlate_dev_kmem_ptr(p) p
35
36static inline void writeb(unsigned char b, volatile void __iomem *addr)
37{
38 *(volatile unsigned char __force *) addr = b;
39}
40static inline void writew(unsigned short b, volatile void __iomem *addr)
41{
42 *(volatile unsigned short __force *) addr = b;
43}
44static inline void writel(unsigned int b, volatile void __iomem *addr)
45{
46 *(volatile unsigned int __force *) addr = b;
47}
48static inline void writeq(unsigned int b, volatile void __iomem *addr)
49{
50 *(volatile unsigned long long __force *) addr = b;
51}
52#define __raw_writeb writeb
53#define __raw_writew writew
54#define __raw_writel writel
55#define __raw_writeq writeq
56
57#endif
diff --git a/include/asm-um/ioctl.h b/include/asm-um/ioctl.h
deleted file mode 100644
index cc22157346db..000000000000
--- a/include/asm-um/ioctl.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_IOCTL_H
2#define __UM_IOCTL_H
3
4#include "asm/arch/ioctl.h"
5
6#endif
diff --git a/include/asm-um/ioctls.h b/include/asm-um/ioctls.h
deleted file mode 100644
index 9a1a017de6a7..000000000000
--- a/include/asm-um/ioctls.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_IOCTLS_H
2#define __UM_IOCTLS_H
3
4#include "asm/arch/ioctls.h"
5
6#endif
diff --git a/include/asm-um/ipcbuf.h b/include/asm-um/ipcbuf.h
deleted file mode 100644
index bb2ad31dc434..000000000000
--- a/include/asm-um/ipcbuf.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_IPCBUF_H
2#define __UM_IPCBUF_H
3
4#include "asm/arch/ipcbuf.h"
5
6#endif
diff --git a/include/asm-um/irq.h b/include/asm-um/irq.h
deleted file mode 100644
index 4a2037f8204b..000000000000
--- a/include/asm-um/irq.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __UM_IRQ_H
2#define __UM_IRQ_H
3
4#define TIMER_IRQ 0
5#define UMN_IRQ 1
6#define CONSOLE_IRQ 2
7#define CONSOLE_WRITE_IRQ 3
8#define UBD_IRQ 4
9#define UM_ETH_IRQ 5
10#define SSL_IRQ 6
11#define SSL_WRITE_IRQ 7
12#define ACCEPT_IRQ 8
13#define MCONSOLE_IRQ 9
14#define WINCH_IRQ 10
15#define SIGIO_WRITE_IRQ 11
16#define TELNETD_IRQ 12
17#define XTERM_IRQ 13
18#define RANDOM_IRQ 14
19
20#define LAST_IRQ RANDOM_IRQ
21#define NR_IRQS (LAST_IRQ + 1)
22
23#endif
diff --git a/include/asm-um/irq_regs.h b/include/asm-um/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-um/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-um/irq_vectors.h b/include/asm-um/irq_vectors.h
deleted file mode 100644
index 62ddba6fc733..000000000000
--- a/include/asm-um/irq_vectors.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_IRQ_VECTORS_H
7#define __UM_IRQ_VECTORS_H
8
9#endif
10
11/*
12 * Overrides for Emacs so that we follow Linus's tabbing style.
13 * Emacs will notice this stuff at the end of the file and automatically
14 * adjust the settings for this buffer only. This must remain at the end
15 * of the file.
16 * ---------------------------------------------------------------------------
17 * Local variables:
18 * c-file-style: "linux"
19 * End:
20 */
diff --git a/include/asm-um/irqflags.h b/include/asm-um/irqflags.h
deleted file mode 100644
index 659b9abdfdba..000000000000
--- a/include/asm-um/irqflags.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_IRQFLAGS_H
2#define __UM_IRQFLAGS_H
3
4/* Empty for now */
5
6#endif
diff --git a/include/asm-um/kdebug.h b/include/asm-um/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/include/asm-um/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/include/asm-um/kmap_types.h b/include/asm-um/kmap_types.h
deleted file mode 100644
index 6c03acdb4405..000000000000
--- a/include/asm-um/kmap_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_KMAP_TYPES_H
7#define __UM_KMAP_TYPES_H
8
9/* No more #include "asm/arch/kmap_types.h" ! */
10
11enum km_type {
12 KM_BOUNCE_READ,
13 KM_SKB_SUNRPC_DATA,
14 KM_SKB_DATA_SOFTIRQ,
15 KM_USER0,
16 KM_USER1,
17 KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR
27};
28
29#endif
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h
deleted file mode 100644
index 52af512f5e7d..000000000000
--- a/include/asm-um/ldt.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H
10
11#include <linux/mutex.h>
12#include "asm/host_ldt.h"
13
14extern void ldt_host_info(void);
15
16#define LDT_PAGES_MAX \
17 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
18#define LDT_ENTRIES_PER_PAGE \
19 (PAGE_SIZE/LDT_ENTRY_SIZE)
20#define LDT_DIRECT_ENTRIES \
21 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
22
23struct ldt_entry {
24 __u32 a;
25 __u32 b;
26};
27
28typedef struct uml_ldt {
29 int entry_count;
30 struct mutex lock;
31 union {
32 struct ldt_entry * pages[LDT_PAGES_MAX];
33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
34 } u;
35} uml_ldt_t;
36
37#endif
diff --git a/include/asm-um/linkage.h b/include/asm-um/linkage.h
deleted file mode 100644
index 7dfce37adc8b..000000000000
--- a/include/asm-um/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_UM_LINKAGE_H
2#define __ASM_UM_LINKAGE_H
3
4#include "asm/arch/linkage.h"
5
6#endif
diff --git a/include/asm-um/local.h b/include/asm-um/local.h
deleted file mode 100644
index 9a280c5bb609..000000000000
--- a/include/asm-um/local.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_LOCAL_H
2#define __UM_LOCAL_H
3
4#include "asm/arch/local.h"
5
6#endif
diff --git a/include/asm-um/locks.h b/include/asm-um/locks.h
deleted file mode 100644
index f80030a3ef5a..000000000000
--- a/include/asm-um/locks.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_LOCKS_H
2#define __UM_LOCKS_H
3
4#include "asm/arch/locks.h"
5
6#endif
diff --git a/include/asm-um/mca_dma.h b/include/asm-um/mca_dma.h
deleted file mode 100644
index e492e4ec1392..000000000000
--- a/include/asm-um/mca_dma.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef mca___UM_DMA_H
2#define mca___UM_DMA_H
3
4#include "asm/arch/mca_dma.h"
5
6#endif
diff --git a/include/asm-um/mman.h b/include/asm-um/mman.h
deleted file mode 100644
index b09ed523019b..000000000000
--- a/include/asm-um/mman.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_MMAN_H
2#define __UM_MMAN_H
3
4#include "asm/arch/mman.h"
5
6#endif
diff --git a/include/asm-um/mmu.h b/include/asm-um/mmu.h
deleted file mode 100644
index 2cf35c21d694..000000000000
--- a/include/asm-um/mmu.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MMU_H
7#define __MMU_H
8
9#include "um_mmu.h"
10
11#endif
12
13/*
14 * Overrides for Emacs so that we follow Linus's tabbing style.
15 * Emacs will notice this stuff at the end of the file and automatically
16 * adjust the settings for this buffer only. This must remain at the end
17 * of the file.
18 * ---------------------------------------------------------------------------
19 * Local variables:
20 * c-file-style: "linux"
21 * End:
22 */
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
deleted file mode 100644
index 54f42e8b0105..000000000000
--- a/include/asm-um/mmu_context.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H
8
9#include "linux/sched.h"
10#include "um_mmu.h"
11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm);
14
15#define get_mmu_context(task) do ; while(0)
16#define activate_context(tsk) do ; while(0)
17
18#define deactivate_mm(tsk,mm) do { } while (0)
19
20extern void force_flush_all(void);
21
22static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23{
24 /*
25 * This is called by fs/exec.c and sys_unshare()
26 * when the new ->mm is used for the first time.
27 */
28 __switch_mm(&new->context.id);
29 arch_dup_mmap(old, new);
30}
31
32static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
33 struct task_struct *tsk)
34{
35 unsigned cpu = smp_processor_id();
36
37 if(prev != next){
38 cpu_clear(cpu, prev->cpu_vm_mask);
39 cpu_set(cpu, next->cpu_vm_mask);
40 if(next != &init_mm)
41 __switch_mm(&next->context.id);
42 }
43}
44
45static inline void enter_lazy_tlb(struct mm_struct *mm,
46 struct task_struct *tsk)
47{
48}
49
50extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
51
52extern void destroy_context(struct mm_struct *mm);
53
54#endif
diff --git a/include/asm-um/module-generic.h b/include/asm-um/module-generic.h
deleted file mode 100644
index 5a265f56b174..000000000000
--- a/include/asm-um/module-generic.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_MODULE_GENERIC_H
2#define __UM_MODULE_GENERIC_H
3
4#include "asm/arch/module.h"
5
6#endif
diff --git a/include/asm-um/module-i386.h b/include/asm-um/module-i386.h
deleted file mode 100644
index 5ead4a0b2e35..000000000000
--- a/include/asm-um/module-i386.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __UM_MODULE_I386_H
2#define __UM_MODULE_I386_H
3
4/* UML is simple */
5struct mod_arch_specific
6{
7};
8
9#define Elf_Shdr Elf32_Shdr
10#define Elf_Sym Elf32_Sym
11#define Elf_Ehdr Elf32_Ehdr
12
13#endif
diff --git a/include/asm-um/module-x86_64.h b/include/asm-um/module-x86_64.h
deleted file mode 100644
index 35b5491d3e96..000000000000
--- a/include/asm-um/module-x86_64.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_MODULE_X86_64_H
8#define __UM_MODULE_X86_64_H
9
10/* UML is simple */
11struct mod_arch_specific
12{
13};
14
15#define Elf_Shdr Elf64_Shdr
16#define Elf_Sym Elf64_Sym
17#define Elf_Ehdr Elf64_Ehdr
18
19#endif
20
21/*
22 * Overrides for Emacs so that we follow Linus's tabbing style.
23 * Emacs will notice this stuff at the end of the file and automatically
24 * adjust the settings for this buffer only. This must remain at the end
25 * of the file.
26 * ---------------------------------------------------------------------------
27 * Local variables:
28 * c-file-style: "linux"
29 * End:
30 */
diff --git a/include/asm-um/msgbuf.h b/include/asm-um/msgbuf.h
deleted file mode 100644
index 8ce8c30d5377..000000000000
--- a/include/asm-um/msgbuf.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_MSGBUF_H
2#define __UM_MSGBUF_H
3
4#include "asm/arch/msgbuf.h"
5
6#endif
diff --git a/include/asm-um/mtrr.h b/include/asm-um/mtrr.h
deleted file mode 100644
index 5e9cd12c578d..000000000000
--- a/include/asm-um/mtrr.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_MTRR_H
2#define __UM_MTRR_H
3
4#include "asm/arch/mtrr.h"
5
6#endif
diff --git a/include/asm-um/mutex.h b/include/asm-um/mutex.h
deleted file mode 100644
index 458c1f7fbc18..000000000000
--- a/include/asm-um/mutex.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/include/asm-um/nops.h b/include/asm-um/nops.h
deleted file mode 100644
index 814e9bf5dea6..000000000000
--- a/include/asm-um/nops.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_NOPS_H
2#define __UM_NOPS_H
3
4#include "asm/arch/nops.h"
5
6#endif
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
deleted file mode 100644
index a6df1f13d732..000000000000
--- a/include/asm-um/page.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PAGE_H
8#define __UM_PAGE_H
9
10#include <linux/const.h>
11
12/* PAGE_SHIFT determines the page size */
13#define PAGE_SHIFT 12
14#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
15#define PAGE_MASK (~(PAGE_SIZE-1))
16
17#ifndef __ASSEMBLY__
18
19struct page;
20
21#include <linux/types.h>
22#include <asm/vm-flags.h>
23
24/*
25 * These are used to make use of C type-checking..
26 */
27
28#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
29#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
30
31#define clear_user_page(page, vaddr, pg) clear_page(page)
32#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
33
34#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
35
36typedef struct { unsigned long pte_low, pte_high; } pte_t;
37typedef struct { unsigned long pmd; } pmd_t;
38typedef struct { unsigned long pgd; } pgd_t;
39#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32))
40
41#define pte_get_bits(pte, bits) ((pte).pte_low & (bits))
42#define pte_set_bits(pte, bits) ((pte).pte_low |= (bits))
43#define pte_clear_bits(pte, bits) ((pte).pte_low &= ~(bits))
44#define pte_copy(to, from) ({ (to).pte_high = (from).pte_high; \
45 smp_wmb(); \
46 (to).pte_low = (from).pte_low; })
47#define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high)
48#define pte_set_val(pte, phys, prot) \
49 ({ (pte).pte_high = (phys) >> 32; \
50 (pte).pte_low = (phys) | pgprot_val(prot); })
51
52#define pmd_val(x) ((x).pmd)
53#define __pmd(x) ((pmd_t) { (x) } )
54
55typedef unsigned long long pfn_t;
56typedef unsigned long long phys_t;
57
58#else
59
60typedef struct { unsigned long pte; } pte_t;
61typedef struct { unsigned long pgd; } pgd_t;
62
63#ifdef CONFIG_3_LEVEL_PGTABLES
64typedef struct { unsigned long pmd; } pmd_t;
65#define pmd_val(x) ((x).pmd)
66#define __pmd(x) ((pmd_t) { (x) } )
67#endif
68
69#define pte_val(x) ((x).pte)
70
71
72#define pte_get_bits(p, bits) ((p).pte & (bits))
73#define pte_set_bits(p, bits) ((p).pte |= (bits))
74#define pte_clear_bits(p, bits) ((p).pte &= ~(bits))
75#define pte_copy(to, from) ((to).pte = (from).pte)
76#define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE))
77#define pte_set_val(p, phys, prot) (p).pte = (phys | pgprot_val(prot))
78
79typedef unsigned long pfn_t;
80typedef unsigned long phys_t;
81
82#endif
83
84typedef struct { unsigned long pgprot; } pgprot_t;
85
86typedef struct page *pgtable_t;
87
88#define pgd_val(x) ((x).pgd)
89#define pgprot_val(x) ((x).pgprot)
90
91#define __pte(x) ((pte_t) { (x) } )
92#define __pgd(x) ((pgd_t) { (x) } )
93#define __pgprot(x) ((pgprot_t) { (x) } )
94
95extern unsigned long uml_physmem;
96
97#define PAGE_OFFSET (uml_physmem)
98#define KERNELBASE PAGE_OFFSET
99
100#define __va_space (8*1024*1024)
101
102#include "mem.h"
103
104/* Cast to unsigned long before casting to void * to avoid a warning from
105 * mmap_kmem about cutting a long long down to a void *. Not sure that
106 * casting is the right thing, but 32-bit UML can't have 64-bit virtual
107 * addresses
108 */
109#define __pa(virt) to_phys((void *) (unsigned long) (virt))
110#define __va(phys) to_virt((unsigned long) (phys))
111
112#define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT))
113#define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT))
114
115#define pfn_valid(pfn) ((pfn) < max_mapnr)
116#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
117
118#include <asm-generic/memory_model.h>
119#include <asm-generic/page.h>
120
121#endif /* __ASSEMBLY__ */
122#endif /* __UM_PAGE_H */
diff --git a/include/asm-um/page_offset.h b/include/asm-um/page_offset.h
deleted file mode 100644
index 1c168dfbf359..000000000000
--- a/include/asm-um/page_offset.h
+++ /dev/null
@@ -1 +0,0 @@
1#define PAGE_OFFSET_RAW (uml_physmem)
diff --git a/include/asm-um/param.h b/include/asm-um/param.h
deleted file mode 100644
index e44f4e60d16d..000000000000
--- a/include/asm-um/param.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _UM_PARAM_H
2#define _UM_PARAM_H
3
4#define EXEC_PAGESIZE 4096
5
6#ifndef NOGROUP
7#define NOGROUP (-1)
8#endif
9
10#define MAXHOSTNAMELEN 64 /* max length of hostname */
11
12#ifdef __KERNEL__
13#define HZ CONFIG_HZ
14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
16#else
17#define HZ 100
18#endif
19
20#endif
diff --git a/include/asm-um/paravirt.h b/include/asm-um/paravirt.h
deleted file mode 100644
index 9d6aaad80b5f..000000000000
--- a/include/asm-um/paravirt.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_PARAVIRT_H
2#define __UM_PARAVIRT_H
3
4#include "asm/arch/paravirt.h"
5
6#endif
diff --git a/include/asm-um/pci.h b/include/asm-um/pci.h
deleted file mode 100644
index 59923199cdc3..000000000000
--- a/include/asm-um/pci.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __UM_PCI_H
2#define __UM_PCI_H
3
4#define PCI_DMA_BUS_IS_PHYS (1)
5#define pcibios_scan_all_fns(a, b) 0
6
7#endif
diff --git a/include/asm-um/pda.h b/include/asm-um/pda.h
deleted file mode 100644
index 0d8bf33ffd42..000000000000
--- a/include/asm-um/pda.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PDA_X86_64_H
8#define __UM_PDA_X86_64_H
9
10/* XXX */
11struct foo {
12 unsigned int __softirq_pending;
13 unsigned int __nmi_count;
14};
15
16extern struct foo me;
17
18#define read_pda(me) (&me)
19
20#endif
21
22/*
23 * Overrides for Emacs so that we follow Linus's tabbing style.
24 * Emacs will notice this stuff at the end of the file and automatically
25 * adjust the settings for this buffer only. This must remain at the end
26 * of the file.
27 * ---------------------------------------------------------------------------
28 * Local variables:
29 * c-file-style: "linux"
30 * End:
31 */
diff --git a/include/asm-um/percpu.h b/include/asm-um/percpu.h
deleted file mode 100644
index 5723e2aab8e7..000000000000
--- a/include/asm-um/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_PERCPU_H
2#define __UM_PERCPU_H
3
4#include "asm/arch/percpu.h"
5
6#endif
diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h
deleted file mode 100644
index 9062a6e72241..000000000000
--- a/include/asm-um/pgalloc.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGALLOC_H
9#define __UM_PGALLOC_H
10
11#include "linux/mm.h"
12#include "asm/fixmap.h"
13
14#define pmd_populate_kernel(mm, pmd, pte) \
15 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
16
17#define pmd_populate(mm, pmd, pte) \
18 set_pmd(pmd, __pmd(_PAGE_TABLE + \
19 ((unsigned long long)page_to_pfn(pte) << \
20 (unsigned long long) PAGE_SHIFT)))
21#define pmd_pgtable(pmd) pmd_page(pmd)
22
23/*
24 * Allocate and free page tables.
25 */
26extern pgd_t *pgd_alloc(struct mm_struct *);
27extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
28
29extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
30extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
31
32static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
33{
34 free_page((unsigned long) pte);
35}
36
37static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
38{
39 pgtable_page_dtor(pte);
40 __free_page(pte);
41}
42
43#define __pte_free_tlb(tlb,pte) \
44do { \
45 pgtable_page_dtor(pte); \
46 tlb_remove_page((tlb),(pte)); \
47} while (0)
48
49#ifdef CONFIG_3_LEVEL_PGTABLES
50
51static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
52{
53 free_page((unsigned long)pmd);
54}
55
56#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
57#endif
58
59#define check_pgt_cache() do { } while (0)
60
61#endif
62
63/*
64 * Overrides for Emacs so that we follow Linus's tabbing style.
65 * Emacs will notice this stuff at the end of the file and automatically
66 * adjust the settings for this buffer only. This must remain at the end
67 * of the file.
68 * ---------------------------------------------------------------------------
69 * Local variables:
70 * c-file-style: "linux"
71 * End:
72 */
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
deleted file mode 100644
index f534b73e753e..000000000000
--- a/include/asm-um/pgtable-2level.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGTABLE_2LEVEL_H
9#define __UM_PGTABLE_2LEVEL_H
10
11#include <asm-generic/pgtable-nopmd.h>
12
13/* PGDIR_SHIFT determines what a third-level page table entry can map */
14
15#define PGDIR_SHIFT 22
16#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
17#define PGDIR_MASK (~(PGDIR_SIZE-1))
18
19/*
20 * entries per page directory level: the i386 is two-level, so
21 * we don't really have any PMD directory physically.
22 */
23#define PTRS_PER_PTE 1024
24#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
25#define PTRS_PER_PGD 1024
26#define FIRST_USER_ADDRESS 0
27
28#define pte_ERROR(e) \
29 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \
30 pte_val(e))
31#define pgd_ERROR(e) \
32 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \
33 pgd_val(e))
34
35static inline int pgd_newpage(pgd_t pgd) { return 0; }
36static inline void pgd_mkuptodate(pgd_t pgd) { }
37
38#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
39
40#define pte_pfn(x) phys_to_pfn(pte_val(x))
41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
43
44/*
45 * Bits 0 through 4 are taken
46 */
47#define PTE_FILE_MAX_BITS 27
48
49#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
50
51#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
52
53#endif
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
deleted file mode 100644
index 0446f456b428..000000000000
--- a/include/asm-um/pgtable-3level.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * Copyright 2003 PathScale Inc
3 * Derived from include/asm-i386/pgtable.h
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PGTABLE_3LEVEL_H
8#define __UM_PGTABLE_3LEVEL_H
9
10#include <asm-generic/pgtable-nopud.h>
11
12/* PGDIR_SHIFT determines what a third-level page table entry can map */
13
14#ifdef CONFIG_64BIT
15#define PGDIR_SHIFT 30
16#else
17#define PGDIR_SHIFT 31
18#endif
19#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
20#define PGDIR_MASK (~(PGDIR_SIZE-1))
21
22/* PMD_SHIFT determines the size of the area a second-level page table can
23 * map
24 */
25
26#define PMD_SHIFT 21
27#define PMD_SIZE (1UL << PMD_SHIFT)
28#define PMD_MASK (~(PMD_SIZE-1))
29
30/*
31 * entries per page directory level
32 */
33
34#define PTRS_PER_PTE 512
35#ifdef CONFIG_64BIT
36#define PTRS_PER_PMD 512
37#define PTRS_PER_PGD 512
38#else
39#define PTRS_PER_PMD 1024
40#define PTRS_PER_PGD 1024
41#endif
42
43#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
44#define FIRST_USER_ADDRESS 0
45
46#define pte_ERROR(e) \
47 printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \
48 pte_val(e))
49#define pmd_ERROR(e) \
50 printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \
51 pmd_val(e))
52#define pgd_ERROR(e) \
53 printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \
54 pgd_val(e))
55
56#define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE))
57#define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
58#define pud_present(x) (pud_val(x) & _PAGE_PRESENT)
59#define pud_populate(mm, pud, pmd) \
60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
61
62#ifdef CONFIG_64BIT
63#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval))
64#else
65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
66#endif
67
68static inline int pgd_newpage(pgd_t pgd)
69{
70 return(pgd_val(pgd) & _PAGE_NEWPAGE);
71}
72
73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
74
75#ifdef CONFIG_64BIT
76#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
77#else
78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
79#endif
80
81struct mm_struct;
82extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
83
84static inline void pud_clear (pud_t *pud)
85{
86 set_pud(pud, __pud(_PAGE_NEWPAGE));
87}
88
89#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
90#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK))
91
92/* Find an entry in the second-level page table.. */
93#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \
94 pmd_index(address))
95
96static inline unsigned long pte_pfn(pte_t pte)
97{
98 return phys_to_pfn(pte_val(pte));
99}
100
101static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot)
102{
103 pte_t pte;
104 phys_t phys = pfn_to_phys(page_nr);
105
106 pte_set_val(pte, phys, pgprot);
107 return pte;
108}
109
110static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot)
111{
112 return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
113}
114
115/*
116 * Bits 0 through 3 are taken in the low part of the pte,
117 * put the 32 bits of offset into the high part.
118 */
119#define PTE_FILE_MAX_BITS 32
120
121#ifdef CONFIG_64BIT
122
123#define pte_to_pgoff(p) ((p).pte >> 32)
124
125#define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE })
126
127#else
128
129#define pte_to_pgoff(pte) ((pte).pte_high)
130
131#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
132
133#endif
134
135#endif
136
137/*
138 * Overrides for Emacs so that we follow Linus's tabbing style.
139 * Emacs will notice this stuff at the end of the file and automatically
140 * adjust the settings for this buffer only. This must remain at the end
141 * of the file.
142 * ---------------------------------------------------------------------------
143 * Local variables:
144 * c-file-style: "linux"
145 * End:
146 */
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
deleted file mode 100644
index 02db81b7b86e..000000000000
--- a/include/asm-um/pgtable.h
+++ /dev/null
@@ -1,358 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGTABLE_H
9#define __UM_PGTABLE_H
10
11#include <asm/fixmap.h>
12
13#define _PAGE_PRESENT 0x001
14#define _PAGE_NEWPAGE 0x002
15#define _PAGE_NEWPROT 0x004
16#define _PAGE_RW 0x020
17#define _PAGE_USER 0x040
18#define _PAGE_ACCESSED 0x080
19#define _PAGE_DIRTY 0x100
20/* If _PAGE_PRESENT is clear, we use these: */
21#define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */
22#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE;
23 pte_present gives true */
24
25#ifdef CONFIG_3_LEVEL_PGTABLES
26#include "asm/pgtable-3level.h"
27#else
28#include "asm/pgtable-2level.h"
29#endif
30
31extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
32
33/* zero page used for uninitialized stuff */
34extern unsigned long *empty_zero_page;
35
36#define pgtable_cache_init() do ; while (0)
37
38/* Just any arbitrary offset to the start of the vmalloc VM area: the
39 * current 8MB value just means that there will be a 8MB "hole" after the
40 * physical memory until the kernel virtual memory starts. That means that
41 * any out-of-bounds memory accesses will hopefully be caught.
42 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
43 * area for the same reason. ;)
44 */
45
46extern unsigned long end_iomem;
47
48#define VMALLOC_OFFSET (__va_space)
49#define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
50#ifdef CONFIG_HIGHMEM
51# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
52#else
53# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
54#endif
55
56#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
57#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
58#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
59
60#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
61#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
62#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
63#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
64#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
65
66/*
67 * The i386 can't do page protection for execute, and considers that the same
68 * are read.
69 * Also, write permissions imply read permissions. This is the closest we can
70 * get..
71 */
72#define __P000 PAGE_NONE
73#define __P001 PAGE_READONLY
74#define __P010 PAGE_COPY
75#define __P011 PAGE_COPY
76#define __P100 PAGE_READONLY
77#define __P101 PAGE_READONLY
78#define __P110 PAGE_COPY
79#define __P111 PAGE_COPY
80
81#define __S000 PAGE_NONE
82#define __S001 PAGE_READONLY
83#define __S010 PAGE_SHARED
84#define __S011 PAGE_SHARED
85#define __S100 PAGE_READONLY
86#define __S101 PAGE_READONLY
87#define __S110 PAGE_SHARED
88#define __S111 PAGE_SHARED
89
90/*
91 * ZERO_PAGE is a global shared page that is always zero: used
92 * for zero-mapped memory areas etc..
93 */
94#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
95
96#define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE))
97
98#define pmd_none(x) (!((unsigned long)pmd_val(x) & ~_PAGE_NEWPAGE))
99#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
100
101#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
102#define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0)
103
104#define pmd_newpage(x) (pmd_val(x) & _PAGE_NEWPAGE)
105#define pmd_mkuptodate(x) (pmd_val(x) &= ~_PAGE_NEWPAGE)
106
107#define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE)
108#define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE)
109
110#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
111
112#define pte_page(x) pfn_to_page(pte_pfn(x))
113
114#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
115
116/*
117 * =================================
118 * Flags checking section.
119 * =================================
120 */
121
122static inline int pte_none(pte_t pte)
123{
124 return pte_is_zero(pte);
125}
126
127/*
128 * The following only work if pte_present() is true.
129 * Undefined behaviour if not..
130 */
131static inline int pte_read(pte_t pte)
132{
133 return((pte_get_bits(pte, _PAGE_USER)) &&
134 !(pte_get_bits(pte, _PAGE_PROTNONE)));
135}
136
137static inline int pte_exec(pte_t pte){
138 return((pte_get_bits(pte, _PAGE_USER)) &&
139 !(pte_get_bits(pte, _PAGE_PROTNONE)));
140}
141
142static inline int pte_write(pte_t pte)
143{
144 return((pte_get_bits(pte, _PAGE_RW)) &&
145 !(pte_get_bits(pte, _PAGE_PROTNONE)));
146}
147
148/*
149 * The following only works if pte_present() is not true.
150 */
151static inline int pte_file(pte_t pte)
152{
153 return pte_get_bits(pte, _PAGE_FILE);
154}
155
156static inline int pte_dirty(pte_t pte)
157{
158 return pte_get_bits(pte, _PAGE_DIRTY);
159}
160
161static inline int pte_young(pte_t pte)
162{
163 return pte_get_bits(pte, _PAGE_ACCESSED);
164}
165
166static inline int pte_newpage(pte_t pte)
167{
168 return pte_get_bits(pte, _PAGE_NEWPAGE);
169}
170
171static inline int pte_newprot(pte_t pte)
172{
173 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT)));
174}
175
176static inline int pte_special(pte_t pte)
177{
178 return 0;
179}
180
181/*
182 * =================================
183 * Flags setting section.
184 * =================================
185 */
186
187static inline pte_t pte_mknewprot(pte_t pte)
188{
189 pte_set_bits(pte, _PAGE_NEWPROT);
190 return(pte);
191}
192
193static inline pte_t pte_mkclean(pte_t pte)
194{
195 pte_clear_bits(pte, _PAGE_DIRTY);
196 return(pte);
197}
198
199static inline pte_t pte_mkold(pte_t pte)
200{
201 pte_clear_bits(pte, _PAGE_ACCESSED);
202 return(pte);
203}
204
205static inline pte_t pte_wrprotect(pte_t pte)
206{
207 pte_clear_bits(pte, _PAGE_RW);
208 return(pte_mknewprot(pte));
209}
210
211static inline pte_t pte_mkread(pte_t pte)
212{
213 pte_set_bits(pte, _PAGE_USER);
214 return(pte_mknewprot(pte));
215}
216
217static inline pte_t pte_mkdirty(pte_t pte)
218{
219 pte_set_bits(pte, _PAGE_DIRTY);
220 return(pte);
221}
222
223static inline pte_t pte_mkyoung(pte_t pte)
224{
225 pte_set_bits(pte, _PAGE_ACCESSED);
226 return(pte);
227}
228
229static inline pte_t pte_mkwrite(pte_t pte)
230{
231 pte_set_bits(pte, _PAGE_RW);
232 return(pte_mknewprot(pte));
233}
234
235static inline pte_t pte_mkuptodate(pte_t pte)
236{
237 pte_clear_bits(pte, _PAGE_NEWPAGE);
238 if(pte_present(pte))
239 pte_clear_bits(pte, _PAGE_NEWPROT);
240 return(pte);
241}
242
243static inline pte_t pte_mknewpage(pte_t pte)
244{
245 pte_set_bits(pte, _PAGE_NEWPAGE);
246 return(pte);
247}
248
249static inline pte_t pte_mkspecial(pte_t pte)
250{
251 return(pte);
252}
253
254static inline void set_pte(pte_t *pteptr, pte_t pteval)
255{
256 pte_copy(*pteptr, pteval);
257
258 /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
259 * fix_range knows to unmap it. _PAGE_NEWPROT is specific to
260 * mapped pages.
261 */
262
263 *pteptr = pte_mknewpage(*pteptr);
264 if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
265}
266#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
267
268/*
269 * Conversion functions: convert a page and protection to a page entry,
270 * and a page entry and page directory to the page they refer to.
271 */
272
273#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
274#define __virt_to_page(virt) phys_to_page(__pa(virt))
275#define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page))
276#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
277
278#define mk_pte(page, pgprot) \
279 ({ pte_t pte; \
280 \
281 pte_set_val(pte, page_to_phys(page), (pgprot)); \
282 if (pte_present(pte)) \
283 pte_mknewprot(pte_mknewpage(pte)); \
284 pte;})
285
286static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
287{
288 pte_set_val(pte, (pte_val(pte) & _PAGE_CHG_MASK), newprot);
289 return pte;
290}
291
292/*
293 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
294 *
295 * this macro returns the index of the entry in the pgd page which would
296 * control the given virtual address
297 */
298#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
299
300/*
301 * pgd_offset() returns a (pgd_t *)
302 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
303 */
304#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
305
306/*
307 * a shortcut which implies the use of the kernel's pgd, instead
308 * of a process's
309 */
310#define pgd_offset_k(address) pgd_offset(&init_mm, address)
311
312/*
313 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
314 *
315 * this macro returns the index of the entry in the pmd page which would
316 * control the given virtual address
317 */
318#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
319#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
320
321#define pmd_page_vaddr(pmd) \
322 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
323
324/*
325 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
326 *
327 * this macro returns the index of the entry in the pte page which would
328 * control the given virtual address
329 */
330#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
331#define pte_offset_kernel(dir, address) \
332 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
333#define pte_offset_map(dir, address) \
334 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
335#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
336#define pte_unmap(pte) do { } while (0)
337#define pte_unmap_nested(pte) do { } while (0)
338
339struct mm_struct;
340extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
341
342#define update_mmu_cache(vma,address,pte) do ; while (0)
343
344/* Encode and de-code a swap entry */
345#define __swp_type(x) (((x).val >> 4) & 0x3f)
346#define __swp_offset(x) ((x).val >> 11)
347
348#define __swp_entry(type, offset) \
349 ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
350#define __pte_to_swp_entry(pte) \
351 ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
352#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
353
354#define kern_addr_valid(addr) (1)
355
356#include <asm-generic/pgtable.h>
357
358#endif
diff --git a/include/asm-um/poll.h b/include/asm-um/poll.h
deleted file mode 100644
index 1eb4e1bc6383..000000000000
--- a/include/asm-um/poll.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_POLL_H
2#define __UM_POLL_H
3
4#include "asm/arch/poll.h"
5
6#endif
diff --git a/include/asm-um/posix_types.h b/include/asm-um/posix_types.h
deleted file mode 100644
index 32fb4198f644..000000000000
--- a/include/asm-um/posix_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_POSIX_TYPES_H
2#define __UM_POSIX_TYPES_H
3
4#include "asm/arch/posix_types.h"
5
6#endif
diff --git a/include/asm-um/prctl.h b/include/asm-um/prctl.h
deleted file mode 100644
index 64b6d099bdd5..000000000000
--- a/include/asm-um/prctl.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_PRCTL_H
2#define __UM_PRCTL_H
3
4#include "asm/arch/prctl.h"
5
6#endif
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
deleted file mode 100644
index bed668824b5f..000000000000
--- a/include/asm-um/processor-generic.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PROCESSOR_GENERIC_H
7#define __UM_PROCESSOR_GENERIC_H
8
9struct pt_regs;
10
11struct task_struct;
12
13#include "asm/ptrace.h"
14#include "registers.h"
15#include "sysdep/archsetjmp.h"
16
17struct mm_struct;
18
19struct thread_struct {
20 struct task_struct *saved_task;
21 /*
22 * This flag is set to 1 before calling do_fork (and analyzed in
23 * copy_thread) to mark that we are begin called from userspace (fork /
24 * vfork / clone), and reset to 0 after. It is left to 0 when called
25 * from kernelspace (i.e. kernel_thread() or fork_idle(),
26 * as of 2.6.11).
27 */
28 int forking;
29 struct pt_regs regs;
30 int singlestep_syscall;
31 void *fault_addr;
32 jmp_buf *fault_catcher;
33 struct task_struct *prev_sched;
34 unsigned long temp_stack;
35 jmp_buf *exec_buf;
36 struct arch_thread arch;
37 jmp_buf switch_buf;
38 int mm_count;
39 struct {
40 int op;
41 union {
42 struct {
43 int pid;
44 } fork, exec;
45 struct {
46 int (*proc)(void *);
47 void *arg;
48 } thread;
49 struct {
50 void (*proc)(void *);
51 void *arg;
52 } cb;
53 } u;
54 } request;
55};
56
57#define INIT_THREAD \
58{ \
59 .forking = 0, \
60 .regs = EMPTY_REGS, \
61 .fault_addr = NULL, \
62 .prev_sched = NULL, \
63 .temp_stack = 0, \
64 .exec_buf = NULL, \
65 .arch = INIT_ARCH_THREAD, \
66 .request = { 0 } \
67}
68
69extern struct task_struct *alloc_task_struct(void);
70
71static inline void release_thread(struct task_struct *task)
72{
73}
74
75extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
76
77static inline void prepare_to_copy(struct task_struct *tsk)
78{
79}
80
81
82extern unsigned long thread_saved_pc(struct task_struct *t);
83
84static inline void mm_copy_segments(struct mm_struct *from_mm,
85 struct mm_struct *new_mm)
86{
87}
88
89#define init_stack (init_thread_union.stack)
90
91/*
92 * User space process size: 3GB (default).
93 */
94extern unsigned long task_size;
95
96#define TASK_SIZE (task_size)
97
98#undef STACK_TOP
99#undef STACK_TOP_MAX
100
101extern unsigned long stacksizelim;
102
103#define STACK_ROOM (stacksizelim)
104#define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
105#define STACK_TOP_MAX STACK_TOP
106
107/* This decides where the kernel will search for a free chunk of vm
108 * space during mmap's.
109 */
110#define TASK_UNMAPPED_BASE (0x40000000)
111
112extern void start_thread(struct pt_regs *regs, unsigned long entry,
113 unsigned long stack);
114
115struct cpuinfo_um {
116 unsigned long loops_per_jiffy;
117 int ipi_pipe[2];
118};
119
120extern struct cpuinfo_um boot_cpu_data;
121
122#define my_cpu_data cpu_data[smp_processor_id()]
123
124#ifdef CONFIG_SMP
125extern struct cpuinfo_um cpu_data[];
126#define current_cpu_data cpu_data[smp_processor_id()]
127#else
128#define cpu_data (&boot_cpu_data)
129#define current_cpu_data boot_cpu_data
130#endif
131
132
133#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
134extern unsigned long get_wchan(struct task_struct *p);
135
136#endif
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h
deleted file mode 100644
index a2b7fe13fe1e..000000000000
--- a/include/asm-um/processor-i386.h
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PROCESSOR_I386_H
7#define __UM_PROCESSOR_I386_H
8
9#include "linux/string.h"
10#include "asm/host_ldt.h"
11#include "asm/segment.h"
12
13extern int host_has_cmov;
14
15/* include faultinfo structure */
16#include "sysdep/faultinfo.h"
17
18struct uml_tls_struct {
19 struct user_desc tls;
20 unsigned flushed:1;
21 unsigned present:1;
22};
23
24struct arch_thread {
25 struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
26 unsigned long debugregs[8];
27 int debugregs_seq;
28 struct faultinfo faultinfo;
29};
30
31#define INIT_ARCH_THREAD { \
32 .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \
33 { .present = 0, .flushed = 0 } }, \
34 .debugregs = { [ 0 ... 7 ] = 0 }, \
35 .debugregs_seq = 0, \
36 .faultinfo = { 0, 0, 0 } \
37}
38
39static inline void arch_flush_thread(struct arch_thread *thread)
40{
41 /* Clear any TLS still hanging */
42 memset(&thread->tls_array, 0, sizeof(thread->tls_array));
43}
44
45static inline void arch_copy_thread(struct arch_thread *from,
46 struct arch_thread *to)
47{
48 memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
49}
50
51#include "asm/arch/user.h"
52
53/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
54static inline void rep_nop(void)
55{
56 __asm__ __volatile__("rep;nop": : :"memory");
57}
58
59#define cpu_relax() rep_nop()
60
61/*
62 * Default implementation of macro that returns current
63 * instruction pointer ("program counter"). Stolen
64 * from asm-i386/processor.h
65 */
66#define current_text_addr() \
67 ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
68
69#define ARCH_IS_STACKGROW(address) \
70 (address + 32 >= UPT_SP(&current->thread.regs.regs))
71
72#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)
73#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)
74#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)
75
76#include "asm/processor-generic.h"
77
78#endif
diff --git a/include/asm-um/processor-ppc.h b/include/asm-um/processor-ppc.h
deleted file mode 100644
index 959323151229..000000000000
--- a/include/asm-um/processor-ppc.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef __UM_PROCESSOR_PPC_H
2#define __UM_PROCESSOR_PPC_H
3
4#if defined(__ASSEMBLY__)
5
6#define CONFIG_PPC_MULTIPLATFORM
7#include "arch/processor.h"
8
9#else
10
11#include "asm/processor-generic.h"
12
13#endif
14
15#endif
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h
deleted file mode 100644
index e50933175e91..000000000000
--- a/include/asm-um/processor-x86_64.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PROCESSOR_X86_64_H
8#define __UM_PROCESSOR_X86_64_H
9
10/* include faultinfo structure */
11#include "sysdep/faultinfo.h"
12
13struct arch_thread {
14 unsigned long debugregs[8];
15 int debugregs_seq;
16 unsigned long fs;
17 struct faultinfo faultinfo;
18};
19
20/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
21static inline void rep_nop(void)
22{
23 __asm__ __volatile__("rep;nop": : :"memory");
24}
25
26#define cpu_relax() rep_nop()
27
28#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \
29 .debugregs_seq = 0, \
30 .fs = 0, \
31 .faultinfo = { 0, 0, 0 } }
32
33static inline void arch_flush_thread(struct arch_thread *thread)
34{
35}
36
37static inline void arch_copy_thread(struct arch_thread *from,
38 struct arch_thread *to)
39{
40 to->fs = from->fs;
41}
42
43#include "asm/arch/user.h"
44
45#define current_text_addr() \
46 ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; })
47
48#define ARCH_IS_STACKGROW(address) \
49 (address + 128 >= UPT_SP(&current->thread.regs.regs))
50
51#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP)
52#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP)
53
54#include "asm/processor-generic.h"
55
56#endif
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h
deleted file mode 100644
index 315749705ea1..000000000000
--- a/include/asm-um/ptrace-generic.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PTRACE_GENERIC_H
7#define __UM_PTRACE_GENERIC_H
8
9#ifndef __ASSEMBLY__
10
11#include "asm/arch/ptrace-abi.h"
12#include <asm/user.h>
13#include "sysdep/ptrace.h"
14
15struct pt_regs {
16 struct uml_pt_regs regs;
17};
18
19#define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }
20
21#define PT_REGS_IP(r) UPT_IP(&(r)->regs)
22#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
23
24#define PT_REG(r, reg) UPT_REG(&(r)->regs, reg)
25#define PT_REGS_SET(r, reg, val) UPT_SET(&(r)->regs, reg, val)
26
27#define PT_REGS_SET_SYSCALL_RETURN(r, res) \
28 UPT_SET_SYSCALL_RETURN(&(r)->regs, res)
29#define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs)
30
31#define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs)
32
33#define PT_REGS_SC(r) UPT_SC(&(r)->regs)
34
35#define instruction_pointer(regs) PT_REGS_IP(regs)
36
37struct task_struct;
38
39extern long subarch_ptrace(struct task_struct *child, long request, long addr,
40 long data);
41extern unsigned long getreg(struct task_struct *child, int regno);
42extern int putreg(struct task_struct *child, int regno, unsigned long value);
43extern int get_fpregs(struct user_i387_struct __user *buf,
44 struct task_struct *child);
45extern int set_fpregs(struct user_i387_struct __user *buf,
46 struct task_struct *child);
47
48extern void show_regs(struct pt_regs *regs);
49
50extern int arch_copy_tls(struct task_struct *new);
51extern void clear_flushed_tls(struct task_struct *task);
52
53#endif
54
55#endif
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h
deleted file mode 100644
index b2d24c5ea2c3..000000000000
--- a/include/asm-um/ptrace-i386.h
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PTRACE_I386_H
7#define __UM_PTRACE_I386_H
8
9#define HOST_AUDIT_ARCH AUDIT_ARCH_I386
10
11#include "linux/compiler.h"
12#include "asm/ptrace-generic.h"
13#include <asm/user.h>
14#include "sysdep/ptrace.h"
15
16#define PT_REGS_EAX(r) UPT_EAX(&(r)->regs)
17#define PT_REGS_EBX(r) UPT_EBX(&(r)->regs)
18#define PT_REGS_ECX(r) UPT_ECX(&(r)->regs)
19#define PT_REGS_EDX(r) UPT_EDX(&(r)->regs)
20#define PT_REGS_ESI(r) UPT_ESI(&(r)->regs)
21#define PT_REGS_EDI(r) UPT_EDI(&(r)->regs)
22#define PT_REGS_EBP(r) UPT_EBP(&(r)->regs)
23
24#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
25#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
26#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
27#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
28#define PT_REGS_FS(r) UPT_FS(&(r)->regs)
29#define PT_REGS_GS(r) UPT_GS(&(r)->regs)
30
31#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
32
33#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r)
34#define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r)
35#define PT_FIX_EXEC_STACK(sp) do ; while(0)
36
37/* Cope with a conditional i386 definition. */
38#undef profile_pc
39#define profile_pc(regs) PT_REGS_IP(regs)
40
41#define user_mode(r) UPT_IS_USER(&(r)->regs)
42
43/*
44 * Forward declaration to avoid including sysdep/tls.h, which causes a
45 * circular include, and compilation failures.
46 */
47struct user_desc;
48
49extern int get_fpxregs(struct user_fxsr_struct __user *buf,
50 struct task_struct *child);
51extern int set_fpxregs(struct user_fxsr_struct __user *buf,
52 struct task_struct *tsk);
53
54extern int ptrace_get_thread_area(struct task_struct *child, int idx,
55 struct user_desc __user *user_desc);
56
57extern int ptrace_set_thread_area(struct task_struct *child, int idx,
58 struct user_desc __user *user_desc);
59
60#endif
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h
deleted file mode 100644
index 4c475350dcf0..000000000000
--- a/include/asm-um/ptrace-x86_64.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PTRACE_X86_64_H
8#define __UM_PTRACE_X86_64_H
9
10#include "linux/compiler.h"
11#include "asm/errno.h"
12#include "asm/host_ldt.h"
13
14#define __FRAME_OFFSETS /* Needed to get the R* macros */
15#include "asm/ptrace-generic.h"
16
17#define HOST_AUDIT_ARCH AUDIT_ARCH_X86_64
18
19/* Also defined in sysdep/ptrace.h, so may already be defined. */
20#ifndef FS_BASE
21#define FS_BASE (21 * sizeof(unsigned long))
22#define GS_BASE (22 * sizeof(unsigned long))
23#define DS (23 * sizeof(unsigned long))
24#define ES (24 * sizeof(unsigned long))
25#define FS (25 * sizeof(unsigned long))
26#define GS (26 * sizeof(unsigned long))
27#endif
28
29#define PT_REGS_RBX(r) UPT_RBX(&(r)->regs)
30#define PT_REGS_RCX(r) UPT_RCX(&(r)->regs)
31#define PT_REGS_RDX(r) UPT_RDX(&(r)->regs)
32#define PT_REGS_RSI(r) UPT_RSI(&(r)->regs)
33#define PT_REGS_RDI(r) UPT_RDI(&(r)->regs)
34#define PT_REGS_RBP(r) UPT_RBP(&(r)->regs)
35#define PT_REGS_RAX(r) UPT_RAX(&(r)->regs)
36#define PT_REGS_R8(r) UPT_R8(&(r)->regs)
37#define PT_REGS_R9(r) UPT_R9(&(r)->regs)
38#define PT_REGS_R10(r) UPT_R10(&(r)->regs)
39#define PT_REGS_R11(r) UPT_R11(&(r)->regs)
40#define PT_REGS_R12(r) UPT_R12(&(r)->regs)
41#define PT_REGS_R13(r) UPT_R13(&(r)->regs)
42#define PT_REGS_R14(r) UPT_R14(&(r)->regs)
43#define PT_REGS_R15(r) UPT_R15(&(r)->regs)
44
45#define PT_REGS_FS(r) UPT_FS(&(r)->regs)
46#define PT_REGS_GS(r) UPT_GS(&(r)->regs)
47#define PT_REGS_DS(r) UPT_DS(&(r)->regs)
48#define PT_REGS_ES(r) UPT_ES(&(r)->regs)
49#define PT_REGS_SS(r) UPT_SS(&(r)->regs)
50#define PT_REGS_CS(r) UPT_CS(&(r)->regs)
51
52#define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs)
53#define PT_REGS_RIP(r) UPT_IP(&(r)->regs)
54#define PT_REGS_RSP(r) UPT_SP(&(r)->regs)
55
56#define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs)
57
58/* XXX */
59#define user_mode(r) UPT_IS_USER(&(r)->regs)
60#define PT_REGS_ORIG_SYSCALL(r) PT_REGS_RAX(r)
61#define PT_REGS_SYSCALL_RET(r) PT_REGS_RAX(r)
62
63#define PT_FIX_EXEC_STACK(sp) do ; while(0)
64
65#define profile_pc(regs) PT_REGS_IP(regs)
66
67static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
68 struct user_desc __user *user_desc)
69{
70 return -ENOSYS;
71}
72
73static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
74 struct user_desc __user *user_desc)
75{
76 return -ENOSYS;
77}
78
79extern long arch_prctl(struct task_struct *task, int code,
80 unsigned long __user *addr);
81#endif
diff --git a/include/asm-um/required-features.h b/include/asm-um/required-features.h
deleted file mode 100644
index dfb967b2d2f3..000000000000
--- a/include/asm-um/required-features.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __UM_REQUIRED_FEATURES_H
2#define __UM_REQUIRED_FEATURES_H
3
4/*
5 * Nothing to see, just need something for the i386 and x86_64 asm
6 * headers to include.
7 */
8
9#endif
diff --git a/include/asm-um/resource.h b/include/asm-um/resource.h
deleted file mode 100644
index c9b074001252..000000000000
--- a/include/asm-um/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_RESOURCE_H
2#define __UM_RESOURCE_H
3
4#include "asm/arch/resource.h"
5
6#endif
diff --git a/include/asm-um/rwlock.h b/include/asm-um/rwlock.h
deleted file mode 100644
index ff383aafc9fe..000000000000
--- a/include/asm-um/rwlock.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_RWLOCK_H
2#define __UM_RWLOCK_H
3
4#include "asm/arch/rwlock.h"
5
6#endif
diff --git a/include/asm-um/rwsem.h b/include/asm-um/rwsem.h
deleted file mode 100644
index b5fc449dc86b..000000000000
--- a/include/asm-um/rwsem.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_RWSEM_H__
2#define __UM_RWSEM_H__
3
4#include "asm/arch/rwsem.h"
5
6#endif
diff --git a/include/asm-um/scatterlist.h b/include/asm-um/scatterlist.h
deleted file mode 100644
index e92016aa2079..000000000000
--- a/include/asm-um/scatterlist.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SCATTERLIST_H
2#define __UM_SCATTERLIST_H
3
4#include "asm/arch/scatterlist.h"
5
6#endif
diff --git a/include/asm-um/sections.h b/include/asm-um/sections.h
deleted file mode 100644
index 6b0231eefea8..000000000000
--- a/include/asm-um/sections.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _UM_SECTIONS_H
2#define _UM_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif
diff --git a/include/asm-um/segment.h b/include/asm-um/segment.h
deleted file mode 100644
index 45183fcd10b6..000000000000
--- a/include/asm-um/segment.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __UM_SEGMENT_H
2#define __UM_SEGMENT_H
3
4extern int host_gdt_entry_tls_min;
5
6#define GDT_ENTRY_TLS_ENTRIES 3
7#define GDT_ENTRY_TLS_MIN host_gdt_entry_tls_min
8#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
9
10#endif
diff --git a/include/asm-um/sembuf.h b/include/asm-um/sembuf.h
deleted file mode 100644
index 1ae82c14ff86..000000000000
--- a/include/asm-um/sembuf.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SEMBUF_H
2#define __UM_SEMBUF_H
3
4#include "asm/arch/sembuf.h"
5
6#endif
diff --git a/include/asm-um/serial.h b/include/asm-um/serial.h
deleted file mode 100644
index 61ad07cfd2d5..000000000000
--- a/include/asm-um/serial.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SERIAL_H
2#define __UM_SERIAL_H
3
4#include "asm/arch/serial.h"
5
6#endif
diff --git a/include/asm-um/setup.h b/include/asm-um/setup.h
deleted file mode 100644
index 99f086301f4c..000000000000
--- a/include/asm-um/setup.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef SETUP_H_INCLUDED
2#define SETUP_H_INCLUDED
3
4/* POSIX mandated with _POSIX_ARG_MAX that we can rely on 4096 chars in the
5 * command line, so this choice is ok.
6 */
7
8#define COMMAND_LINE_SIZE 4096
9
10#endif /* SETUP_H_INCLUDED */
diff --git a/include/asm-um/shmbuf.h b/include/asm-um/shmbuf.h
deleted file mode 100644
index 9684d4a284a6..000000000000
--- a/include/asm-um/shmbuf.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SHMBUF_H
2#define __UM_SHMBUF_H
3
4#include "asm/arch/shmbuf.h"
5
6#endif
diff --git a/include/asm-um/shmparam.h b/include/asm-um/shmparam.h
deleted file mode 100644
index 124c00174f6a..000000000000
--- a/include/asm-um/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SHMPARAM_H
2#define __UM_SHMPARAM_H
3
4#include "asm/arch/shmparam.h"
5
6#endif
diff --git a/include/asm-um/sigcontext-generic.h b/include/asm-um/sigcontext-generic.h
deleted file mode 100644
index 164587014c61..000000000000
--- a/include/asm-um/sigcontext-generic.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SIGCONTEXT_GENERIC_H
2#define __UM_SIGCONTEXT_GENERIC_H
3
4#include "asm/arch/sigcontext.h"
5
6#endif
diff --git a/include/asm-um/sigcontext-i386.h b/include/asm-um/sigcontext-i386.h
deleted file mode 100644
index b88333f488bb..000000000000
--- a/include/asm-um/sigcontext-i386.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SIGCONTEXT_I386_H
2#define __UM_SIGCONTEXT_I386_H
3
4#include "asm/sigcontext-generic.h"
5
6#endif
diff --git a/include/asm-um/sigcontext-ppc.h b/include/asm-um/sigcontext-ppc.h
deleted file mode 100644
index 2467f20eda99..000000000000
--- a/include/asm-um/sigcontext-ppc.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __UM_SIGCONTEXT_PPC_H
2#define __UM_SIGCONTEXT_PPC_H
3
4#define pt_regs sys_pt_regs
5
6#include "asm/sigcontext-generic.h"
7
8#undef pt_regs
9
10#endif
diff --git a/include/asm-um/sigcontext-x86_64.h b/include/asm-um/sigcontext-x86_64.h
deleted file mode 100644
index b600e0b01e48..000000000000
--- a/include/asm-um/sigcontext-x86_64.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/* Copyright 2003 PathScale, Inc.
2 *
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_SIGCONTEXT_X86_64_H
7#define __UM_SIGCONTEXT_X86_64_H
8
9#include "asm/sigcontext-generic.h"
10
11#endif
12
13/*
14 * Overrides for Emacs so that we follow Linus's tabbing style.
15 * Emacs will notice this stuff at the end of the file and automatically
16 * adjust the settings for this buffer only. This must remain at the end
17 * of the file.
18 * ---------------------------------------------------------------------------
19 * Local variables:
20 * c-file-style: "linux"
21 * End:
22 */
diff --git a/include/asm-um/siginfo.h b/include/asm-um/siginfo.h
deleted file mode 100644
index bec6124c36d0..000000000000
--- a/include/asm-um/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SIGINFO_H
2#define __UM_SIGINFO_H
3
4#include "asm/arch/siginfo.h"
5
6#endif
diff --git a/include/asm-um/signal.h b/include/asm-um/signal.h
deleted file mode 100644
index 52ed92cbce4c..000000000000
--- a/include/asm-um/signal.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_SIGNAL_H
7#define __UM_SIGNAL_H
8
9/* Need to kill the do_signal() declaration in the i386 signal.h */
10
11#define do_signal do_signal_renamed
12#include "asm/arch/signal.h"
13#undef do_signal
14#undef ptrace_signal_deliver
15
16#define ptrace_signal_deliver(regs, cookie) do {} while(0)
17
18#endif
19
20/*
21 * Overrides for Emacs so that we follow Linus's tabbing style.
22 * Emacs will notice this stuff at the end of the file and automatically
23 * adjust the settings for this buffer only. This must remain at the end
24 * of the file.
25 * ---------------------------------------------------------------------------
26 * Local variables:
27 * c-file-style: "linux"
28 * End:
29 */
diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h
deleted file mode 100644
index f27a96313174..000000000000
--- a/include/asm-um/smp.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef __UM_SMP_H
2#define __UM_SMP_H
3
4#ifdef CONFIG_SMP
5
6#include "linux/bitops.h"
7#include "asm/current.h"
8#include "linux/cpumask.h"
9
10#define raw_smp_processor_id() (current_thread->cpu)
11
12#define cpu_logical_map(n) (n)
13#define cpu_number_map(n) (n)
14#define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */
15extern int hard_smp_processor_id(void);
16#define NO_PROC_ID -1
17
18extern int ncpus;
19
20
21static inline void smp_cpus_done(unsigned int maxcpus)
22{
23}
24
25extern struct task_struct *idle_threads[NR_CPUS];
26
27#else
28
29#define hard_smp_processor_id() 0
30
31#endif
32
33#endif
diff --git a/include/asm-um/socket.h b/include/asm-um/socket.h
deleted file mode 100644
index 67886e42ef04..000000000000
--- a/include/asm-um/socket.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SOCKET_H
2#define __UM_SOCKET_H
3
4#include "asm/arch/socket.h"
5
6#endif
diff --git a/include/asm-um/sockios.h b/include/asm-um/sockios.h
deleted file mode 100644
index 93ee1c55c4d6..000000000000
--- a/include/asm-um/sockios.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SOCKIOS_H
2#define __UM_SOCKIOS_H
3
4#include "asm/arch/sockios.h"
5
6#endif
diff --git a/include/asm-um/spinlock.h b/include/asm-um/spinlock.h
deleted file mode 100644
index f18c82886992..000000000000
--- a/include/asm-um/spinlock.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SPINLOCK_H
2#define __UM_SPINLOCK_H
3
4#include "asm/arch/spinlock.h"
5
6#endif
diff --git a/include/asm-um/spinlock_types.h b/include/asm-um/spinlock_types.h
deleted file mode 100644
index e5a94294bf82..000000000000
--- a/include/asm-um/spinlock_types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SPINLOCK_TYPES_H
2#define __UM_SPINLOCK_TYPES_H
3
4#include "asm/arch/spinlock_types.h"
5
6#endif
diff --git a/include/asm-um/stat.h b/include/asm-um/stat.h
deleted file mode 100644
index 83ed85ad2539..000000000000
--- a/include/asm-um/stat.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_STAT_H
2#define __UM_STAT_H
3
4#include "asm/arch/stat.h"
5
6#endif
diff --git a/include/asm-um/statfs.h b/include/asm-um/statfs.h
deleted file mode 100644
index ba6fb53e7f87..000000000000
--- a/include/asm-um/statfs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _UM_STATFS_H
2#define _UM_STATFS_H
3
4#include "asm/arch/statfs.h"
5
6#endif
diff --git a/include/asm-um/string.h b/include/asm-um/string.h
deleted file mode 100644
index 9a0571f6dd61..000000000000
--- a/include/asm-um/string.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __UM_STRING_H
2#define __UM_STRING_H
3
4#include "asm/arch/string.h"
5#include "asm/archparam.h"
6
7#endif
diff --git a/include/asm-um/suspend.h b/include/asm-um/suspend.h
deleted file mode 100644
index f4e8e007f468..000000000000
--- a/include/asm-um/suspend.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __UM_SUSPEND_H
2#define __UM_SUSPEND_H
3
4#endif
diff --git a/include/asm-um/system-generic.h b/include/asm-um/system-generic.h
deleted file mode 100644
index 5bcfa35e7a22..000000000000
--- a/include/asm-um/system-generic.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef __UM_SYSTEM_GENERIC_H
2#define __UM_SYSTEM_GENERIC_H
3
4#include "asm/arch/system.h"
5
6#undef switch_to
7#undef local_irq_save
8#undef local_irq_restore
9#undef local_irq_disable
10#undef local_irq_enable
11#undef local_save_flags
12#undef local_irq_restore
13#undef local_irq_enable
14#undef local_irq_disable
15#undef local_irq_save
16#undef irqs_disabled
17
18extern void *switch_to(void *prev, void *next, void *last);
19
20extern int get_signals(void);
21extern int set_signals(int enable);
22extern int get_signals(void);
23extern void block_signals(void);
24extern void unblock_signals(void);
25
26#define local_save_flags(flags) do { typecheck(unsigned long, flags); \
27 (flags) = get_signals(); } while(0)
28#define local_irq_restore(flags) do { typecheck(unsigned long, flags); \
29 set_signals(flags); } while(0)
30
31#define local_irq_save(flags) do { local_save_flags(flags); \
32 local_irq_disable(); } while(0)
33
34#define local_irq_enable() unblock_signals()
35#define local_irq_disable() block_signals()
36
37#define irqs_disabled() \
38({ \
39 unsigned long flags; \
40 local_save_flags(flags); \
41 (flags == 0); \
42})
43
44extern void *_switch_to(void *prev, void *next, void *last);
45#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
46
47#endif
diff --git a/include/asm-um/system-i386.h b/include/asm-um/system-i386.h
deleted file mode 100644
index c436263e67ba..000000000000
--- a/include/asm-um/system-i386.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_SYSTEM_I386_H
2#define __UM_SYSTEM_I386_H
3
4#include "asm/system-generic.h"
5
6#endif
diff --git a/include/asm-um/system-ppc.h b/include/asm-um/system-ppc.h
deleted file mode 100644
index 17cde6640bf5..000000000000
--- a/include/asm-um/system-ppc.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __UM_SYSTEM_PPC_H
2#define __UM_SYSTEM_PPC_H
3
4#define _switch_to _ppc_switch_to
5
6#include "asm/arch/system.h"
7
8#undef _switch_to
9
10#include "asm/system-generic.h"
11
12#endif
diff --git a/include/asm-um/system-x86_64.h b/include/asm-um/system-x86_64.h
deleted file mode 100644
index e1b61b580734..000000000000
--- a/include/asm-um/system-x86_64.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_SYSTEM_X86_64_H
8#define __UM_SYSTEM_X86_64_H
9
10#include "asm/system-generic.h"
11
12#endif
13
14/*
15 * Overrides for Emacs so that we follow Linus's tabbing style.
16 * Emacs will notice this stuff at the end of the file and automatically
17 * adjust the settings for this buffer only. This must remain at the end
18 * of the file.
19 * ---------------------------------------------------------------------------
20 * Local variables:
21 * c-file-style: "linux"
22 * End:
23 */
diff --git a/include/asm-um/termbits.h b/include/asm-um/termbits.h
deleted file mode 100644
index 5739c608a2cb..000000000000
--- a/include/asm-um/termbits.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_TERMBITS_H
2#define __UM_TERMBITS_H
3
4#include "asm/arch/termbits.h"
5
6#endif
diff --git a/include/asm-um/termios.h b/include/asm-um/termios.h
deleted file mode 100644
index d9f97b303311..000000000000
--- a/include/asm-um/termios.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_TERMIOS_H
2#define __UM_TERMIOS_H
3
4#include "asm/arch/termios.h"
5
6#endif
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h
deleted file mode 100644
index e07e72846c7a..000000000000
--- a/include/asm-um/thread_info.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_THREAD_INFO_H
7#define __UM_THREAD_INFO_H
8
9#ifndef __ASSEMBLY__
10
11#include <asm/types.h>
12#include <asm/page.h>
13#include <asm/uaccess.h>
14
15struct thread_info {
16 struct task_struct *task; /* main task structure */
17 struct exec_domain *exec_domain; /* execution domain */
18 unsigned long flags; /* low level flags */
19 __u32 cpu; /* current CPU */
20 int preempt_count; /* 0 => preemptable,
21 <0 => BUG */
22 mm_segment_t addr_limit; /* thread address space:
23 0-0xBFFFFFFF for user
24 0-0xFFFFFFFF for kernel */
25 struct restart_block restart_block;
26 struct thread_info *real_thread; /* Points to non-IRQ stack */
27};
28
29#define INIT_THREAD_INFO(tsk) \
30{ \
31 .task = &tsk, \
32 .exec_domain = &default_exec_domain, \
33 .flags = 0, \
34 .cpu = 0, \
35 .preempt_count = 1, \
36 .addr_limit = KERNEL_DS, \
37 .restart_block = { \
38 .fn = do_no_restart_syscall, \
39 }, \
40 .real_thread = NULL, \
41}
42
43#define init_thread_info (init_thread_union.thread_info)
44#define init_stack (init_thread_union.stack)
45
46#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
47/* how to get the thread information struct from C */
48static inline struct thread_info *current_thread_info(void)
49{
50 struct thread_info *ti;
51 unsigned long mask = THREAD_SIZE - 1;
52 ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
53 return ti;
54}
55
56#define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
57
58#endif
59
60#define PREEMPT_ACTIVE 0x10000000
61
62#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
63#define TIF_SIGPENDING 1 /* signal pending */
64#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
65#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
66 * TIF_NEED_RESCHED
67 */
68#define TIF_RESTART_BLOCK 4
69#define TIF_MEMDIE 5
70#define TIF_SYSCALL_AUDIT 6
71#define TIF_RESTORE_SIGMASK 7
72
73#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
74#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
75#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
76#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
77#define _TIF_MEMDIE (1 << TIF_MEMDIE)
78#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
79#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
80
81#endif
diff --git a/include/asm-um/timex.h b/include/asm-um/timex.h
deleted file mode 100644
index 0f4ada08f748..000000000000
--- a/include/asm-um/timex.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __UM_TIMEX_H
2#define __UM_TIMEX_H
3
4typedef unsigned long cycles_t;
5
6static inline cycles_t get_cycles (void)
7{
8 return 0;
9}
10
11#define CLOCK_TICK_RATE (HZ)
12
13#endif
diff --git a/include/asm-um/tlb.h b/include/asm-um/tlb.h
deleted file mode 100644
index 5240fa1c5e08..000000000000
--- a/include/asm-um/tlb.h
+++ /dev/null
@@ -1,127 +0,0 @@
1#ifndef __UM_TLB_H
2#define __UM_TLB_H
3
4#include <linux/pagemap.h>
5#include <linux/swap.h>
6#include <asm/percpu.h>
7#include <asm/pgalloc.h>
8#include <asm/tlbflush.h>
9
10#define tlb_start_vma(tlb, vma) do { } while (0)
11#define tlb_end_vma(tlb, vma) do { } while (0)
12#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
13
14/* struct mmu_gather is an opaque type used by the mm code for passing around
15 * any data needed by arch specific code for tlb_remove_page.
16 */
17struct mmu_gather {
18 struct mm_struct *mm;
19 unsigned int need_flush; /* Really unmapped some ptes? */
20 unsigned long start;
21 unsigned long end;
22 unsigned int fullmm; /* non-zero means full mm flush */
23};
24
25/* Users of the generic TLB shootdown code must declare this storage space. */
26DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
27
28static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
29 unsigned long address)
30{
31 if (tlb->start > address)
32 tlb->start = address;
33 if (tlb->end < address + PAGE_SIZE)
34 tlb->end = address + PAGE_SIZE;
35}
36
37static inline void init_tlb_gather(struct mmu_gather *tlb)
38{
39 tlb->need_flush = 0;
40
41 tlb->start = TASK_SIZE;
42 tlb->end = 0;
43
44 if (tlb->fullmm) {
45 tlb->start = 0;
46 tlb->end = TASK_SIZE;
47 }
48}
49
50/* tlb_gather_mmu
51 * Return a pointer to an initialized struct mmu_gather.
52 */
53static inline struct mmu_gather *
54tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
55{
56 struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
57
58 tlb->mm = mm;
59 tlb->fullmm = full_mm_flush;
60
61 init_tlb_gather(tlb);
62
63 return tlb;
64}
65
66extern void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
67 unsigned long end);
68
69static inline void
70tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
71{
72 if (!tlb->need_flush)
73 return;
74
75 flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end);
76 init_tlb_gather(tlb);
77}
78
79/* tlb_finish_mmu
80 * Called at the end of the shootdown operation to free up any resources
81 * that were required.
82 */
83static inline void
84tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
85{
86 tlb_flush_mmu(tlb, start, end);
87
88 /* keep the page table cache within bounds */
89 check_pgt_cache();
90
91 put_cpu_var(mmu_gathers);
92}
93
94/* tlb_remove_page
95 * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)),
96 * while handling the additional races in SMP caused by other CPUs
97 * caching valid mappings in their TLBs.
98 */
99static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
100{
101 tlb->need_flush = 1;
102 free_page_and_swap_cache(page);
103 return;
104}
105
106/**
107 * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
108 *
109 * Record the fact that pte's were really umapped in ->need_flush, so we can
110 * later optimise away the tlb invalidate. This helps when userspace is
111 * unmapping already-unmapped pages, which happens quite a lot.
112 */
113#define tlb_remove_tlb_entry(tlb, ptep, address) \
114 do { \
115 tlb->need_flush = 1; \
116 __tlb_remove_tlb_entry(tlb, ptep, address); \
117 } while (0)
118
119#define pte_free_tlb(tlb, ptep) __pte_free_tlb(tlb, ptep)
120
121#define pud_free_tlb(tlb, pudp) __pud_free_tlb(tlb, pudp)
122
123#define pmd_free_tlb(tlb, pmdp) __pmd_free_tlb(tlb, pmdp)
124
125#define tlb_migrate_finish(mm) do {} while (0)
126
127#endif
diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h
deleted file mode 100644
index 614f2c091178..000000000000
--- a/include/asm-um/tlbflush.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_TLBFLUSH_H
7#define __UM_TLBFLUSH_H
8
9#include <linux/mm.h>
10
11/*
12 * TLB flushing:
13 *
14 * - flush_tlb() flushes the current mm struct TLBs
15 * - flush_tlb_all() flushes all processes TLBs
16 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
17 * - flush_tlb_page(vma, vmaddr) flushes one page
18 * - flush_tlb_kernel_vm() flushes the kernel vm area
19 * - flush_tlb_range(vma, start, end) flushes a range of pages
20 */
21
22extern void flush_tlb_all(void);
23extern void flush_tlb_mm(struct mm_struct *mm);
24extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
25 unsigned long end);
26extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long address);
27extern void flush_tlb_kernel_vm(void);
28extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
29extern void __flush_tlb_one(unsigned long addr);
30
31#endif
diff --git a/include/asm-um/topology.h b/include/asm-um/topology.h
deleted file mode 100644
index 0905e4f21d42..000000000000
--- a/include/asm-um/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_UM_TOPOLOGY_H
2#define _ASM_UM_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif
diff --git a/include/asm-um/types.h b/include/asm-um/types.h
deleted file mode 100644
index 816e9590fc73..000000000000
--- a/include/asm-um/types.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_TYPES_H
2#define __UM_TYPES_H
3
4#include "asm/arch/types.h"
5
6#endif
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h
deleted file mode 100644
index b9a895d6fa1d..000000000000
--- a/include/asm-um/uaccess.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_UACCESS_H
7#define __UM_UACCESS_H
8
9#include <asm/errno.h>
10#include <asm/processor.h>
11
12/* thread_info has a mm_segment_t in it, so put the definition up here */
13typedef struct {
14 unsigned long seg;
15} mm_segment_t;
16
17#include "linux/thread_info.h"
18
19#define VERIFY_READ 0
20#define VERIFY_WRITE 1
21
22/*
23 * The fs value determines whether argument validity checking should be
24 * performed or not. If get_fs() == USER_DS, checking is performed, with
25 * get_fs() == KERNEL_DS, checking is bypassed.
26 *
27 * For historical reasons, these macros are grossly misnamed.
28 */
29
30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
31
32#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
33#define USER_DS MAKE_MM_SEG(TASK_SIZE)
34
35#define get_ds() (KERNEL_DS)
36#define get_fs() (current_thread_info()->addr_limit)
37#define set_fs(x) (current_thread_info()->addr_limit = (x))
38
39#define segment_eq(a, b) ((a).seg == (b).seg)
40
41#include "um_uaccess.h"
42
43#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
44
45#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
46
47#define __copy_to_user_inatomic __copy_to_user
48#define __copy_from_user_inatomic __copy_from_user
49
50#define __get_user(x, ptr) \
51({ \
52 const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \
53 __typeof__(x) __private_val; \
54 int __private_ret = -EFAULT; \
55 (x) = (__typeof__(*(__private_ptr)))0; \
56 if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\
57 sizeof(*(__private_ptr))) == 0) { \
58 (x) = (__typeof__(*(__private_ptr))) __private_val; \
59 __private_ret = 0; \
60 } \
61 __private_ret; \
62})
63
64#define get_user(x, ptr) \
65({ \
66 const __typeof__((*(ptr))) __user *private_ptr = (ptr); \
67 (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
68 __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \
69})
70
71#define __put_user(x, ptr) \
72({ \
73 __typeof__(*(ptr)) __user *__private_ptr = ptr; \
74 __typeof__(*(__private_ptr)) __private_val; \
75 int __private_ret = -EFAULT; \
76 __private_val = (__typeof__(*(__private_ptr))) (x); \
77 if (__copy_to_user((__private_ptr), &__private_val, \
78 sizeof(*(__private_ptr))) == 0) { \
79 __private_ret = 0; \
80 } \
81 __private_ret; \
82})
83
84#define put_user(x, ptr) \
85({ \
86 __typeof__(*(ptr)) __user *private_ptr = (ptr); \
87 (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \
88 __put_user(x, private_ptr) : -EFAULT); \
89})
90
91#define strlen_user(str) strnlen_user(str, ~0U >> 1)
92
93struct exception_table_entry
94{
95 unsigned long insn;
96 unsigned long fixup;
97};
98
99#endif
diff --git a/include/asm-um/ucontext.h b/include/asm-um/ucontext.h
deleted file mode 100644
index 5c96c0e607f0..000000000000
--- a/include/asm-um/ucontext.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_UM_UCONTEXT_H
2#define _ASM_UM_UCONTEXT_H
3
4#include "asm/arch/ucontext.h"
5
6#endif
diff --git a/include/asm-um/unaligned.h b/include/asm-um/unaligned.h
deleted file mode 100644
index a47196974e39..000000000000
--- a/include/asm-um/unaligned.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_UM_UNALIGNED_H
2#define _ASM_UM_UNALIGNED_H
3
4#include "asm/arch/unaligned.h"
5
6#endif /* _ASM_UM_UNALIGNED_H */
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
deleted file mode 100644
index 38bd9d94ee46..000000000000
--- a/include/asm-um/unistd.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2004 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef _UM_UNISTD_H_
7#define _UM_UNISTD_H_
8
9#include <linux/syscalls.h>
10#include "linux/resource.h"
11#include "asm/uaccess.h"
12
13extern int um_execve(const char *file, char *const argv[], char *const env[]);
14
15#ifdef __KERNEL__
16/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */
17#define __ARCH_WANT_OLD_READDIR
18#define __ARCH_WANT_SYS_ALARM
19#define __ARCH_WANT_SYS_GETHOSTNAME
20#define __ARCH_WANT_SYS_PAUSE
21#define __ARCH_WANT_SYS_SGETMASK
22#define __ARCH_WANT_SYS_SIGNAL
23#define __ARCH_WANT_SYS_TIME
24#define __ARCH_WANT_SYS_UTIME
25#define __ARCH_WANT_SYS_WAITPID
26#define __ARCH_WANT_SYS_SOCKETCALL
27#define __ARCH_WANT_SYS_FADVISE64
28#define __ARCH_WANT_SYS_GETPGRP
29#define __ARCH_WANT_SYS_LLSEEK
30#define __ARCH_WANT_SYS_NICE
31#define __ARCH_WANT_SYS_OLD_GETRLIMIT
32#define __ARCH_WANT_SYS_OLDUMOUNT
33#define __ARCH_WANT_SYS_SIGPENDING
34#define __ARCH_WANT_SYS_SIGPROCMASK
35#define __ARCH_WANT_SYS_RT_SIGACTION
36#define __ARCH_WANT_SYS_RT_SIGSUSPEND
37#endif
38
39#include "asm/arch/unistd.h"
40
41#endif /* _UM_UNISTD_H_*/
diff --git a/include/asm-um/user.h b/include/asm-um/user.h
deleted file mode 100644
index aae414ee1f5e..000000000000
--- a/include/asm-um/user.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_USER_H
2#define __UM_USER_H
3
4#include "asm/arch/user.h"
5
6#endif
diff --git a/include/asm-um/vga.h b/include/asm-um/vga.h
deleted file mode 100644
index 903a592b00d0..000000000000
--- a/include/asm-um/vga.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_VGA_H
2#define __UM_VGA_H
3
4#include "asm/arch/vga.h"
5
6#endif
diff --git a/include/asm-um/vm-flags-i386.h b/include/asm-um/vm-flags-i386.h
deleted file mode 100644
index e0d24c568dbc..000000000000
--- a/include/asm-um/vm-flags-i386.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __VM_FLAGS_I386_H
7#define __VM_FLAGS_I386_H
8
9#define VM_DATA_DEFAULT_FLAGS \
10 (VM_READ | VM_WRITE | \
11 ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
12 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
13
14#endif
diff --git a/include/asm-um/vm-flags-x86_64.h b/include/asm-um/vm-flags-x86_64.h
deleted file mode 100644
index 3213edfa7888..000000000000
--- a/include/asm-um/vm-flags-x86_64.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#ifndef __VM_FLAGS_X86_64_H
8#define __VM_FLAGS_X86_64_H
9
10#define __VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
11 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
12#define __VM_STACK_FLAGS (VM_GROWSDOWN | VM_READ | VM_WRITE | \
13 VM_EXEC | VM_MAYREAD | VM_MAYWRITE | \
14 VM_MAYEXEC)
15
16extern unsigned long vm_stack_flags, vm_stack_flags32;
17extern unsigned long vm_data_default_flags, vm_data_default_flags32;
18extern unsigned long vm_force_exec32;
19
20#ifdef TIF_IA32
21#define VM_DATA_DEFAULT_FLAGS \
22 (test_thread_flag(TIF_IA32) ? vm_data_default_flags32 : \
23 vm_data_default_flags)
24
25#define VM_STACK_DEFAULT_FLAGS \
26 (test_thread_flag(TIF_IA32) ? vm_stack_flags32 : vm_stack_flags)
27#endif
28
29#define VM_DATA_DEFAULT_FLAGS vm_data_default_flags
30
31#define VM_STACK_DEFAULT_FLAGS vm_stack_flags
32
33#endif
diff --git a/include/asm-um/vm86.h b/include/asm-um/vm86.h
deleted file mode 100644
index 7801f82de1f4..000000000000
--- a/include/asm-um/vm86.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_VM86_H
2#define __UM_VM86_H
3
4#include "asm/arch/vm86.h"
5
6#endif
diff --git a/include/asm-um/xor.h b/include/asm-um/xor.h
deleted file mode 100644
index a19db3e17241..000000000000
--- a/include/asm-um/xor.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __UM_XOR_H
2#define __UM_XOR_H
3
4#include "asm-generic/xor.h"
5
6#endif
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
deleted file mode 100644
index 4a8e80cdcfa5..000000000000
--- a/include/asm-x86/Kbuild
+++ /dev/null
@@ -1,24 +0,0 @@
1include include/asm-generic/Kbuild.asm
2
3header-y += boot.h
4header-y += bootparam.h
5header-y += debugreg.h
6header-y += ldt.h
7header-y += msr-index.h
8header-y += prctl.h
9header-y += ptrace-abi.h
10header-y += sigcontext32.h
11header-y += ucontext.h
12header-y += processor-flags.h
13
14unifdef-y += e820.h
15unifdef-y += ist.h
16unifdef-y += mce.h
17unifdef-y += msr.h
18unifdef-y += mtrr.h
19unifdef-y += posix_types_32.h
20unifdef-y += posix_types_64.h
21unifdef-y += unistd_32.h
22unifdef-y += unistd_64.h
23unifdef-y += vm86.h
24unifdef-y += vsyscall.h
diff --git a/include/asm-x86/a.out-core.h b/include/asm-x86/a.out-core.h
deleted file mode 100644
index 714207a1c387..000000000000
--- a/include/asm-x86/a.out-core.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* a.out coredump register dumper
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 Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _ASM_A_OUT_CORE_H
13#define _ASM_A_OUT_CORE_H
14
15#ifdef __KERNEL__
16#ifdef CONFIG_X86_32
17
18#include <linux/user.h>
19#include <linux/elfcore.h>
20
21/*
22 * fill in the user structure for an a.out core dump
23 */
24static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
25{
26 u16 gs;
27
28/* changed the size calculations - should hopefully work better. lbt */
29 dump->magic = CMAGIC;
30 dump->start_code = 0;
31 dump->start_stack = regs->sp & ~(PAGE_SIZE - 1);
32 dump->u_tsize = ((unsigned long)current->mm->end_code) >> PAGE_SHIFT;
33 dump->u_dsize = ((unsigned long)(current->mm->brk + (PAGE_SIZE - 1)))
34 >> PAGE_SHIFT;
35 dump->u_dsize -= dump->u_tsize;
36 dump->u_ssize = 0;
37 dump->u_debugreg[0] = current->thread.debugreg0;
38 dump->u_debugreg[1] = current->thread.debugreg1;
39 dump->u_debugreg[2] = current->thread.debugreg2;
40 dump->u_debugreg[3] = current->thread.debugreg3;
41 dump->u_debugreg[4] = 0;
42 dump->u_debugreg[5] = 0;
43 dump->u_debugreg[6] = current->thread.debugreg6;
44 dump->u_debugreg[7] = current->thread.debugreg7;
45
46 if (dump->start_stack < TASK_SIZE)
47 dump->u_ssize = ((unsigned long)(TASK_SIZE - dump->start_stack))
48 >> PAGE_SHIFT;
49
50 dump->regs.bx = regs->bx;
51 dump->regs.cx = regs->cx;
52 dump->regs.dx = regs->dx;
53 dump->regs.si = regs->si;
54 dump->regs.di = regs->di;
55 dump->regs.bp = regs->bp;
56 dump->regs.ax = regs->ax;
57 dump->regs.ds = (u16)regs->ds;
58 dump->regs.es = (u16)regs->es;
59 dump->regs.fs = (u16)regs->fs;
60 savesegment(gs, gs);
61 dump->regs.orig_ax = regs->orig_ax;
62 dump->regs.ip = regs->ip;
63 dump->regs.cs = (u16)regs->cs;
64 dump->regs.flags = regs->flags;
65 dump->regs.sp = regs->sp;
66 dump->regs.ss = (u16)regs->ss;
67
68 dump->u_fpvalid = dump_fpu(regs, &dump->i387);
69}
70
71#endif /* CONFIG_X86_32 */
72#endif /* __KERNEL__ */
73#endif /* _ASM_A_OUT_CORE_H */
diff --git a/include/asm-x86/a.out.h b/include/asm-x86/a.out.h
deleted file mode 100644
index 4684f97a5bbd..000000000000
--- a/include/asm-x86/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_X86_A_OUT_H
2#define _ASM_X86_A_OUT_H
3
4struct exec
5{
6 unsigned int a_info; /* Use macros N_MAGIC, etc for access */
7 unsigned a_text; /* length of text, in bytes */
8 unsigned a_data; /* length of data, in bytes */
9 unsigned a_bss; /* length of uninitialized data area for file, in bytes */
10 unsigned a_syms; /* length of symbol table data in file, in bytes */
11 unsigned a_entry; /* start address */
12 unsigned a_trsize; /* length of relocation info for text, in bytes */
13 unsigned a_drsize; /* length of relocation info for data, in bytes */
14};
15
16#define N_TRSIZE(a) ((a).a_trsize)
17#define N_DRSIZE(a) ((a).a_drsize)
18#define N_SYMSIZE(a) ((a).a_syms)
19
20#endif /* _ASM_X86_A_OUT_H */
diff --git a/include/asm-x86/acpi.h b/include/asm-x86/acpi.h
deleted file mode 100644
index 35d1743b57ac..000000000000
--- a/include/asm-x86/acpi.h
+++ /dev/null
@@ -1,178 +0,0 @@
1#ifndef _ASM_X86_ACPI_H
2#define _ASM_X86_ACPI_H
3
4/*
5 * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2001 Patrick Mochel <mochel@osdl.org>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 */
26#include <acpi/pdc_intel.h>
27
28#include <asm/numa.h>
29#include <asm/processor.h>
30#include <asm/mmu.h>
31#include <asm/mpspec.h>
32
33#define COMPILER_DEPENDENT_INT64 long long
34#define COMPILER_DEPENDENT_UINT64 unsigned long long
35
36/*
37 * Calling conventions:
38 *
39 * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads)
40 * ACPI_EXTERNAL_XFACE - External ACPI interfaces
41 * ACPI_INTERNAL_XFACE - Internal ACPI interfaces
42 * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces
43 */
44#define ACPI_SYSTEM_XFACE
45#define ACPI_EXTERNAL_XFACE
46#define ACPI_INTERNAL_XFACE
47#define ACPI_INTERNAL_VAR_XFACE
48
49/* Asm macros */
50
51#define ACPI_ASM_MACROS
52#define BREAKPOINT3
53#define ACPI_DISABLE_IRQS() local_irq_disable()
54#define ACPI_ENABLE_IRQS() local_irq_enable()
55#define ACPI_FLUSH_CPU_CACHE() wbinvd()
56
57int __acpi_acquire_global_lock(unsigned int *lock);
58int __acpi_release_global_lock(unsigned int *lock);
59
60#define ACPI_ACQUIRE_GLOBAL_LOCK(facs, Acq) \
61 ((Acq) = __acpi_acquire_global_lock(&facs->global_lock))
62
63#define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
64 ((Acq) = __acpi_release_global_lock(&facs->global_lock))
65
66/*
67 * Math helper asm macros
68 */
69#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
70 asm("divl %2;" \
71 : "=a"(q32), "=d"(r32) \
72 : "r"(d32), \
73 "0"(n_lo), "1"(n_hi))
74
75
76#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
77 asm("shrl $1,%2 ;" \
78 "rcrl $1,%3;" \
79 : "=r"(n_hi), "=r"(n_lo) \
80 : "0"(n_hi), "1"(n_lo))
81
82#ifdef CONFIG_ACPI
83extern int acpi_lapic;
84extern int acpi_ioapic;
85extern int acpi_noirq;
86extern int acpi_strict;
87extern int acpi_disabled;
88extern int acpi_ht;
89extern int acpi_pci_disabled;
90extern int acpi_skip_timer_override;
91extern int acpi_use_timer_override;
92
93extern u8 acpi_sci_flags;
94extern int acpi_sci_override_gsi;
95void acpi_pic_sci_set_trigger(unsigned int, u16);
96
97static inline void disable_acpi(void)
98{
99 acpi_disabled = 1;
100 acpi_ht = 0;
101 acpi_pci_disabled = 1;
102 acpi_noirq = 1;
103}
104
105/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
106#define FIX_ACPI_PAGES 4
107
108extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
109
110static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
111static inline void acpi_disable_pci(void)
112{
113 acpi_pci_disabled = 1;
114 acpi_noirq_set();
115}
116extern int acpi_irq_balance_set(char *str);
117
118/* routines for saving/restoring kernel state */
119extern int acpi_save_state_mem(void);
120extern void acpi_restore_state_mem(void);
121
122extern unsigned long acpi_wakeup_address;
123
124/* early initialization routine */
125extern void acpi_reserve_bootmem(void);
126
127/*
128 * Check if the CPU can handle C2 and deeper
129 */
130static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
131{
132 /*
133 * Early models (<=5) of AMD Opterons are not supposed to go into
134 * C2 state.
135 *
136 * Steppings 0x0A and later are good
137 */
138 if (boot_cpu_data.x86 == 0x0F &&
139 boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
140 boot_cpu_data.x86_model <= 0x05 &&
141 boot_cpu_data.x86_mask < 0x0A)
142 return 1;
143 else if (boot_cpu_has(X86_FEATURE_AMDC1E))
144 return 1;
145 else
146 return max_cstate;
147}
148
149#else /* !CONFIG_ACPI */
150
151#define acpi_lapic 0
152#define acpi_ioapic 0
153static inline void acpi_noirq_set(void) { }
154static inline void acpi_disable_pci(void) { }
155static inline void disable_acpi(void) { }
156
157#endif /* !CONFIG_ACPI */
158
159#define ARCH_HAS_POWER_INIT 1
160
161struct bootnode;
162
163#ifdef CONFIG_ACPI_NUMA
164extern int acpi_numa;
165extern int acpi_scan_nodes(unsigned long start, unsigned long end);
166#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
167extern void acpi_fake_nodes(const struct bootnode *fake_nodes,
168 int num_nodes);
169#else
170static inline void acpi_fake_nodes(const struct bootnode *fake_nodes,
171 int num_nodes)
172{
173}
174#endif
175
176#define acpi_unlazy_tlb(x) leave_mm(x)
177
178#endif /*__X86_ASM_ACPI_H*/
diff --git a/include/asm-x86/agp.h b/include/asm-x86/agp.h
deleted file mode 100644
index e4004a9f6a9a..000000000000
--- a/include/asm-x86/agp.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef _ASM_X86_AGP_H
2#define _ASM_X86_AGP_H
3
4#include <asm/pgtable.h>
5#include <asm/cacheflush.h>
6
7/*
8 * Functions to keep the agpgart mappings coherent with the MMU. The
9 * GART gives the CPU a physical alias of pages in memory. The alias
10 * region is mapped uncacheable. Make sure there are no conflicting
11 * mappings with different cachability attributes for the same
12 * page. This avoids data corruption on some CPUs.
13 */
14
15#define map_page_into_agp(page) set_pages_uc(page, 1)
16#define unmap_page_from_agp(page) set_pages_wb(page, 1)
17
18/*
19 * Could use CLFLUSH here if the cpu supports it. But then it would
20 * need to be called for each cacheline of the whole page so it may
21 * not be worth it. Would need a page for it.
22 */
23#define flush_agp_cache() wbinvd()
24
25/* Convert a physical address to an address suitable for the GART. */
26#define phys_to_gart(x) (x)
27#define gart_to_phys(x) (x)
28
29/* GATT allocation. Returns/accepts GATT kernel virtual address. */
30#define alloc_gatt_pages(order) \
31 ((char *)__get_free_pages(GFP_KERNEL, (order)))
32#define free_gatt_pages(table, order) \
33 free_pages((unsigned long)(table), (order))
34
35#endif
diff --git a/include/asm-x86/alternative-asm.h b/include/asm-x86/alternative-asm.h
deleted file mode 100644
index e2077d343c33..000000000000
--- a/include/asm-x86/alternative-asm.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifdef __ASSEMBLY__
2
3#ifdef CONFIG_X86_32
4# define X86_ALIGN .long
5#else
6# define X86_ALIGN .quad
7#endif
8
9#ifdef CONFIG_SMP
10 .macro LOCK_PREFIX
111: lock
12 .section .smp_locks,"a"
13 .align 4
14 X86_ALIGN 1b
15 .previous
16 .endm
17#else
18 .macro LOCK_PREFIX
19 .endm
20#endif
21
22#endif /* __ASSEMBLY__ */
diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h
deleted file mode 100644
index f6aa18eadf71..000000000000
--- a/include/asm-x86/alternative.h
+++ /dev/null
@@ -1,183 +0,0 @@
1#ifndef _ASM_X86_ALTERNATIVE_H
2#define _ASM_X86_ALTERNATIVE_H
3
4#include <linux/types.h>
5#include <linux/stddef.h>
6#include <asm/asm.h>
7
8/*
9 * Alternative inline assembly for SMP.
10 *
11 * The LOCK_PREFIX macro defined here replaces the LOCK and
12 * LOCK_PREFIX macros used everywhere in the source tree.
13 *
14 * SMP alternatives use the same data structures as the other
15 * alternatives and the X86_FEATURE_UP flag to indicate the case of a
16 * UP system running a SMP kernel. The existing apply_alternatives()
17 * works fine for patching a SMP kernel for UP.
18 *
19 * The SMP alternative tables can be kept after boot and contain both
20 * UP and SMP versions of the instructions to allow switching back to
21 * SMP at runtime, when hotplugging in a new CPU, which is especially
22 * useful in virtualized environments.
23 *
24 * The very common lock prefix is handled as special case in a
25 * separate table which is a pure address list without replacement ptr
26 * and size information. That keeps the table sizes small.
27 */
28
29#ifdef CONFIG_SMP
30#define LOCK_PREFIX \
31 ".section .smp_locks,\"a\"\n" \
32 _ASM_ALIGN "\n" \
33 _ASM_PTR "661f\n" /* address */ \
34 ".previous\n" \
35 "661:\n\tlock; "
36
37#else /* ! CONFIG_SMP */
38#define LOCK_PREFIX ""
39#endif
40
41/* This must be included *after* the definition of LOCK_PREFIX */
42#include <asm/cpufeature.h>
43
44struct alt_instr {
45 u8 *instr; /* original instruction */
46 u8 *replacement;
47 u8 cpuid; /* cpuid bit set for replacement */
48 u8 instrlen; /* length of original instruction */
49 u8 replacementlen; /* length of new instruction, <= instrlen */
50 u8 pad1;
51#ifdef CONFIG_X86_64
52 u32 pad2;
53#endif
54};
55
56extern void alternative_instructions(void);
57extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
58
59struct module;
60
61#ifdef CONFIG_SMP
62extern void alternatives_smp_module_add(struct module *mod, char *name,
63 void *locks, void *locks_end,
64 void *text, void *text_end);
65extern void alternatives_smp_module_del(struct module *mod);
66extern void alternatives_smp_switch(int smp);
67#else
68static inline void alternatives_smp_module_add(struct module *mod, char *name,
69 void *locks, void *locks_end,
70 void *text, void *text_end) {}
71static inline void alternatives_smp_module_del(struct module *mod) {}
72static inline void alternatives_smp_switch(int smp) {}
73#endif /* CONFIG_SMP */
74
75const unsigned char *const *find_nop_table(void);
76
77/*
78 * Alternative instructions for different CPU types or capabilities.
79 *
80 * This allows to use optimized instructions even on generic binary
81 * kernels.
82 *
83 * length of oldinstr must be longer or equal the length of newinstr
84 * It can be padded with nops as needed.
85 *
86 * For non barrier like inlines please define new variants
87 * without volatile and memory clobber.
88 */
89#define alternative(oldinstr, newinstr, feature) \
90 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
91 ".section .altinstructions,\"a\"\n" \
92 _ASM_ALIGN "\n" \
93 _ASM_PTR "661b\n" /* label */ \
94 _ASM_PTR "663f\n" /* new instruction */ \
95 " .byte %c0\n" /* feature bit */ \
96 " .byte 662b-661b\n" /* sourcelen */ \
97 " .byte 664f-663f\n" /* replacementlen */ \
98 ".previous\n" \
99 ".section .altinstr_replacement,\"ax\"\n" \
100 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
101 ".previous" :: "i" (feature) : "memory")
102
103/*
104 * Alternative inline assembly with input.
105 *
106 * Pecularities:
107 * No memory clobber here.
108 * Argument numbers start with 1.
109 * Best is to use constraints that are fixed size (like (%1) ... "r")
110 * If you use variable sized constraints like "m" or "g" in the
111 * replacement make sure to pad to the worst case length.
112 */
113#define alternative_input(oldinstr, newinstr, feature, input...) \
114 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
115 ".section .altinstructions,\"a\"\n" \
116 _ASM_ALIGN "\n" \
117 _ASM_PTR "661b\n" /* label */ \
118 _ASM_PTR "663f\n" /* new instruction */ \
119 " .byte %c0\n" /* feature bit */ \
120 " .byte 662b-661b\n" /* sourcelen */ \
121 " .byte 664f-663f\n" /* replacementlen */ \
122 ".previous\n" \
123 ".section .altinstr_replacement,\"ax\"\n" \
124 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
125 ".previous" :: "i" (feature), ##input)
126
127/* Like alternative_input, but with a single output argument */
128#define alternative_io(oldinstr, newinstr, feature, output, input...) \
129 asm volatile ("661:\n\t" oldinstr "\n662:\n" \
130 ".section .altinstructions,\"a\"\n" \
131 _ASM_ALIGN "\n" \
132 _ASM_PTR "661b\n" /* label */ \
133 _ASM_PTR "663f\n" /* new instruction */ \
134 " .byte %c[feat]\n" /* feature bit */ \
135 " .byte 662b-661b\n" /* sourcelen */ \
136 " .byte 664f-663f\n" /* replacementlen */ \
137 ".previous\n" \
138 ".section .altinstr_replacement,\"ax\"\n" \
139 "663:\n\t" newinstr "\n664:\n" /* replacement */ \
140 ".previous" : output : [feat] "i" (feature), ##input)
141
142/*
143 * use this macro(s) if you need more than one output parameter
144 * in alternative_io
145 */
146#define ASM_OUTPUT2(a, b) a, b
147
148struct paravirt_patch_site;
149#ifdef CONFIG_PARAVIRT
150void apply_paravirt(struct paravirt_patch_site *start,
151 struct paravirt_patch_site *end);
152#else
153static inline void apply_paravirt(struct paravirt_patch_site *start,
154 struct paravirt_patch_site *end)
155{}
156#define __parainstructions NULL
157#define __parainstructions_end NULL
158#endif
159
160extern void add_nops(void *insns, unsigned int len);
161
162/*
163 * Clear and restore the kernel write-protection flag on the local CPU.
164 * Allows the kernel to edit read-only pages.
165 * Side-effect: any interrupt handler running between save and restore will have
166 * the ability to write to read-only pages.
167 *
168 * Warning:
169 * Code patching in the UP case is safe if NMIs and MCE handlers are stopped and
170 * no thread can be preempted in the instructions being modified (no iret to an
171 * invalid instruction possible) or if the instructions are changed from a
172 * consistent state to another consistent state atomically.
173 * More care must be taken when modifying code in the SMP case because of
174 * Intel's errata.
175 * On the local CPU you need to be protected again NMI or MCE handlers seeing an
176 * inconsistent instruction while you patch.
177 * The _early version expects the memory to already be RW.
178 */
179
180extern void *text_poke(void *addr, const void *opcode, size_t len);
181extern void *text_poke_early(void *addr, const void *opcode, size_t len);
182
183#endif /* _ASM_X86_ALTERNATIVE_H */
diff --git a/include/asm-x86/amd_iommu.h b/include/asm-x86/amd_iommu.h
deleted file mode 100644
index 30a12049353b..000000000000
--- a/include/asm-x86/amd_iommu.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 * Leo Duran <leo.duran@amd.com>
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
8 * 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_X86_AMD_IOMMU_H
21#define _ASM_X86_AMD_IOMMU_H
22
23#ifdef CONFIG_AMD_IOMMU
24extern int amd_iommu_init(void);
25extern int amd_iommu_init_dma_ops(void);
26extern void amd_iommu_detect(void);
27#else
28static inline int amd_iommu_init(void) { return -ENODEV; }
29static inline void amd_iommu_detect(void) { }
30#endif
31
32#endif
diff --git a/include/asm-x86/amd_iommu_types.h b/include/asm-x86/amd_iommu_types.h
deleted file mode 100644
index dcc812067394..000000000000
--- a/include/asm-x86/amd_iommu_types.h
+++ /dev/null
@@ -1,344 +0,0 @@
1/*
2 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 * Leo Duran <leo.duran@amd.com>
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
8 * 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 __AMD_IOMMU_TYPES_H__
21#define __AMD_IOMMU_TYPES_H__
22
23#include <linux/types.h>
24#include <linux/list.h>
25#include <linux/spinlock.h>
26
27/*
28 * some size calculation constants
29 */
30#define DEV_TABLE_ENTRY_SIZE 32
31#define ALIAS_TABLE_ENTRY_SIZE 2
32#define RLOOKUP_TABLE_ENTRY_SIZE (sizeof(void *))
33
34/* Length of the MMIO region for the AMD IOMMU */
35#define MMIO_REGION_LENGTH 0x4000
36
37/* Capability offsets used by the driver */
38#define MMIO_CAP_HDR_OFFSET 0x00
39#define MMIO_RANGE_OFFSET 0x0c
40
41/* Masks, shifts and macros to parse the device range capability */
42#define MMIO_RANGE_LD_MASK 0xff000000
43#define MMIO_RANGE_FD_MASK 0x00ff0000
44#define MMIO_RANGE_BUS_MASK 0x0000ff00
45#define MMIO_RANGE_LD_SHIFT 24
46#define MMIO_RANGE_FD_SHIFT 16
47#define MMIO_RANGE_BUS_SHIFT 8
48#define MMIO_GET_LD(x) (((x) & MMIO_RANGE_LD_MASK) >> MMIO_RANGE_LD_SHIFT)
49#define MMIO_GET_FD(x) (((x) & MMIO_RANGE_FD_MASK) >> MMIO_RANGE_FD_SHIFT)
50#define MMIO_GET_BUS(x) (((x) & MMIO_RANGE_BUS_MASK) >> MMIO_RANGE_BUS_SHIFT)
51
52/* Flag masks for the AMD IOMMU exclusion range */
53#define MMIO_EXCL_ENABLE_MASK 0x01ULL
54#define MMIO_EXCL_ALLOW_MASK 0x02ULL
55
56/* Used offsets into the MMIO space */
57#define MMIO_DEV_TABLE_OFFSET 0x0000
58#define MMIO_CMD_BUF_OFFSET 0x0008
59#define MMIO_EVT_BUF_OFFSET 0x0010
60#define MMIO_CONTROL_OFFSET 0x0018
61#define MMIO_EXCL_BASE_OFFSET 0x0020
62#define MMIO_EXCL_LIMIT_OFFSET 0x0028
63#define MMIO_CMD_HEAD_OFFSET 0x2000
64#define MMIO_CMD_TAIL_OFFSET 0x2008
65#define MMIO_EVT_HEAD_OFFSET 0x2010
66#define MMIO_EVT_TAIL_OFFSET 0x2018
67#define MMIO_STATUS_OFFSET 0x2020
68
69/* MMIO status bits */
70#define MMIO_STATUS_COM_WAIT_INT_MASK 0x04
71
72/* feature control bits */
73#define CONTROL_IOMMU_EN 0x00ULL
74#define CONTROL_HT_TUN_EN 0x01ULL
75#define CONTROL_EVT_LOG_EN 0x02ULL
76#define CONTROL_EVT_INT_EN 0x03ULL
77#define CONTROL_COMWAIT_EN 0x04ULL
78#define CONTROL_PASSPW_EN 0x08ULL
79#define CONTROL_RESPASSPW_EN 0x09ULL
80#define CONTROL_COHERENT_EN 0x0aULL
81#define CONTROL_ISOC_EN 0x0bULL
82#define CONTROL_CMDBUF_EN 0x0cULL
83#define CONTROL_PPFLOG_EN 0x0dULL
84#define CONTROL_PPFINT_EN 0x0eULL
85
86/* command specific defines */
87#define CMD_COMPL_WAIT 0x01
88#define CMD_INV_DEV_ENTRY 0x02
89#define CMD_INV_IOMMU_PAGES 0x03
90
91#define CMD_COMPL_WAIT_STORE_MASK 0x01
92#define CMD_COMPL_WAIT_INT_MASK 0x02
93#define CMD_INV_IOMMU_PAGES_SIZE_MASK 0x01
94#define CMD_INV_IOMMU_PAGES_PDE_MASK 0x02
95
96#define CMD_INV_IOMMU_ALL_PAGES_ADDRESS 0x7fffffffffffffffULL
97
98/* macros and definitions for device table entries */
99#define DEV_ENTRY_VALID 0x00
100#define DEV_ENTRY_TRANSLATION 0x01
101#define DEV_ENTRY_IR 0x3d
102#define DEV_ENTRY_IW 0x3e
103#define DEV_ENTRY_NO_PAGE_FAULT 0x62
104#define DEV_ENTRY_EX 0x67
105#define DEV_ENTRY_SYSMGT1 0x68
106#define DEV_ENTRY_SYSMGT2 0x69
107#define DEV_ENTRY_INIT_PASS 0xb8
108#define DEV_ENTRY_EINT_PASS 0xb9
109#define DEV_ENTRY_NMI_PASS 0xba
110#define DEV_ENTRY_LINT0_PASS 0xbe
111#define DEV_ENTRY_LINT1_PASS 0xbf
112
113/* constants to configure the command buffer */
114#define CMD_BUFFER_SIZE 8192
115#define CMD_BUFFER_ENTRIES 512
116#define MMIO_CMD_SIZE_SHIFT 56
117#define MMIO_CMD_SIZE_512 (0x9ULL << MMIO_CMD_SIZE_SHIFT)
118
119#define PAGE_MODE_1_LEVEL 0x01
120#define PAGE_MODE_2_LEVEL 0x02
121#define PAGE_MODE_3_LEVEL 0x03
122
123#define IOMMU_PDE_NL_0 0x000ULL
124#define IOMMU_PDE_NL_1 0x200ULL
125#define IOMMU_PDE_NL_2 0x400ULL
126#define IOMMU_PDE_NL_3 0x600ULL
127
128#define IOMMU_PTE_L2_INDEX(address) (((address) >> 30) & 0x1ffULL)
129#define IOMMU_PTE_L1_INDEX(address) (((address) >> 21) & 0x1ffULL)
130#define IOMMU_PTE_L0_INDEX(address) (((address) >> 12) & 0x1ffULL)
131
132#define IOMMU_MAP_SIZE_L1 (1ULL << 21)
133#define IOMMU_MAP_SIZE_L2 (1ULL << 30)
134#define IOMMU_MAP_SIZE_L3 (1ULL << 39)
135
136#define IOMMU_PTE_P (1ULL << 0)
137#define IOMMU_PTE_U (1ULL << 59)
138#define IOMMU_PTE_FC (1ULL << 60)
139#define IOMMU_PTE_IR (1ULL << 61)
140#define IOMMU_PTE_IW (1ULL << 62)
141
142#define IOMMU_L1_PDE(address) \
143 ((address) | IOMMU_PDE_NL_1 | IOMMU_PTE_P | IOMMU_PTE_IR | IOMMU_PTE_IW)
144#define IOMMU_L2_PDE(address) \
145 ((address) | IOMMU_PDE_NL_2 | IOMMU_PTE_P | IOMMU_PTE_IR | IOMMU_PTE_IW)
146
147#define IOMMU_PAGE_MASK (((1ULL << 52) - 1) & ~0xfffULL)
148#define IOMMU_PTE_PRESENT(pte) ((pte) & IOMMU_PTE_P)
149#define IOMMU_PTE_PAGE(pte) (phys_to_virt((pte) & IOMMU_PAGE_MASK))
150#define IOMMU_PTE_MODE(pte) (((pte) >> 9) & 0x07)
151
152#define IOMMU_PROT_MASK 0x03
153#define IOMMU_PROT_IR 0x01
154#define IOMMU_PROT_IW 0x02
155
156/* IOMMU capabilities */
157#define IOMMU_CAP_IOTLB 24
158#define IOMMU_CAP_NPCACHE 26
159
160#define MAX_DOMAIN_ID 65536
161
162/*
163 * This structure contains generic data for IOMMU protection domains
164 * independent of their use.
165 */
166struct protection_domain {
167 spinlock_t lock; /* mostly used to lock the page table*/
168 u16 id; /* the domain id written to the device table */
169 int mode; /* paging mode (0-6 levels) */
170 u64 *pt_root; /* page table root pointer */
171 void *priv; /* private data */
172};
173
174/*
175 * Data container for a dma_ops specific protection domain
176 */
177struct dma_ops_domain {
178 struct list_head list;
179
180 /* generic protection domain information */
181 struct protection_domain domain;
182
183 /* size of the aperture for the mappings */
184 unsigned long aperture_size;
185
186 /* address we start to search for free addresses */
187 unsigned long next_bit;
188
189 /* address allocation bitmap */
190 unsigned long *bitmap;
191
192 /*
193 * Array of PTE pages for the aperture. In this array we save all the
194 * leaf pages of the domain page table used for the aperture. This way
195 * we don't need to walk the page table to find a specific PTE. We can
196 * just calculate its address in constant time.
197 */
198 u64 **pte_pages;
199};
200
201/*
202 * Structure where we save information about one hardware AMD IOMMU in the
203 * system.
204 */
205struct amd_iommu {
206 struct list_head list;
207
208 /* locks the accesses to the hardware */
209 spinlock_t lock;
210
211 /* device id of this IOMMU */
212 u16 devid;
213 /*
214 * Capability pointer. There could be more than one IOMMU per PCI
215 * device function if there are more than one AMD IOMMU capability
216 * pointers.
217 */
218 u16 cap_ptr;
219
220 /* physical address of MMIO space */
221 u64 mmio_phys;
222 /* virtual address of MMIO space */
223 u8 *mmio_base;
224
225 /* capabilities of that IOMMU read from ACPI */
226 u32 cap;
227
228 /* first device this IOMMU handles. read from PCI */
229 u16 first_device;
230 /* last device this IOMMU handles. read from PCI */
231 u16 last_device;
232
233 /* start of exclusion range of that IOMMU */
234 u64 exclusion_start;
235 /* length of exclusion range of that IOMMU */
236 u64 exclusion_length;
237
238 /* command buffer virtual address */
239 u8 *cmd_buf;
240 /* size of command buffer */
241 u32 cmd_buf_size;
242
243 /* if one, we need to send a completion wait command */
244 int need_sync;
245
246 /* default dma_ops domain for that IOMMU */
247 struct dma_ops_domain *default_dom;
248};
249
250/*
251 * List with all IOMMUs in the system. This list is not locked because it is
252 * only written and read at driver initialization or suspend time
253 */
254extern struct list_head amd_iommu_list;
255
256/*
257 * Structure defining one entry in the device table
258 */
259struct dev_table_entry {
260 u32 data[8];
261};
262
263/*
264 * One entry for unity mappings parsed out of the ACPI table.
265 */
266struct unity_map_entry {
267 struct list_head list;
268
269 /* starting device id this entry is used for (including) */
270 u16 devid_start;
271 /* end device id this entry is used for (including) */
272 u16 devid_end;
273
274 /* start address to unity map (including) */
275 u64 address_start;
276 /* end address to unity map (including) */
277 u64 address_end;
278
279 /* required protection */
280 int prot;
281};
282
283/*
284 * List of all unity mappings. It is not locked because as runtime it is only
285 * read. It is created at ACPI table parsing time.
286 */
287extern struct list_head amd_iommu_unity_map;
288
289/*
290 * Data structures for device handling
291 */
292
293/*
294 * Device table used by hardware. Read and write accesses by software are
295 * locked with the amd_iommu_pd_table lock.
296 */
297extern struct dev_table_entry *amd_iommu_dev_table;
298
299/*
300 * Alias table to find requestor ids to device ids. Not locked because only
301 * read on runtime.
302 */
303extern u16 *amd_iommu_alias_table;
304
305/*
306 * Reverse lookup table to find the IOMMU which translates a specific device.
307 */
308extern struct amd_iommu **amd_iommu_rlookup_table;
309
310/* size of the dma_ops aperture as power of 2 */
311extern unsigned amd_iommu_aperture_order;
312
313/* largest PCI device id we expect translation requests for */
314extern u16 amd_iommu_last_bdf;
315
316/* data structures for protection domain handling */
317extern struct protection_domain **amd_iommu_pd_table;
318
319/* allocation bitmap for domain ids */
320extern unsigned long *amd_iommu_pd_alloc_bitmap;
321
322/* will be 1 if device isolation is enabled */
323extern int amd_iommu_isolate;
324
325/* takes a PCI device id and prints it out in a readable form */
326static inline void print_devid(u16 devid, int nl)
327{
328 int bus = devid >> 8;
329 int dev = devid >> 3 & 0x1f;
330 int fn = devid & 0x07;
331
332 printk("%02x:%02x.%x", bus, dev, fn);
333 if (nl)
334 printk("\n");
335}
336
337/* takes bus and device/function and returns the device id
338 * FIXME: should that be in generic PCI code? */
339static inline u16 calc_devid(u8 bus, u8 devfn)
340{
341 return (((u16)bus) << 8) | devfn;
342}
343
344#endif
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
deleted file mode 100644
index 133c998161ca..000000000000
--- a/include/asm-x86/apic.h
+++ /dev/null
@@ -1,131 +0,0 @@
1#ifndef _ASM_X86_APIC_H
2#define _ASM_X86_APIC_H
3
4#include <linux/pm.h>
5#include <linux/delay.h>
6
7#include <asm/alternative.h>
8#include <asm/fixmap.h>
9#include <asm/apicdef.h>
10#include <asm/processor.h>
11#include <asm/system.h>
12
13#define ARCH_APICTIMER_STOPS_ON_C3 1
14
15/*
16 * Debugging macros
17 */
18#define APIC_QUIET 0
19#define APIC_VERBOSE 1
20#define APIC_DEBUG 2
21
22/*
23 * Define the default level of output to be very little
24 * This can be turned up by using apic=verbose for more
25 * information and apic=debug for _lots_ of information.
26 * apic_verbosity is defined in apic.c
27 */
28#define apic_printk(v, s, a...) do { \
29 if ((v) <= apic_verbosity) \
30 printk(s, ##a); \
31 } while (0)
32
33
34extern void generic_apic_probe(void);
35
36#ifdef CONFIG_X86_LOCAL_APIC
37
38extern unsigned int apic_verbosity;
39extern int local_apic_timer_c2_ok;
40
41extern int ioapic_force;
42
43extern int disable_apic;
44/*
45 * Basic functions accessing APICs.
46 */
47#ifdef CONFIG_PARAVIRT
48#include <asm/paravirt.h>
49#else
50#define apic_write native_apic_write
51#define apic_read native_apic_read
52#define setup_boot_clock setup_boot_APIC_clock
53#define setup_secondary_clock setup_secondary_APIC_clock
54#endif
55
56extern int is_vsmp_box(void);
57
58static inline void native_apic_write(unsigned long reg, u32 v)
59{
60 volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
61
62 alternative_io("movl %0, %1", "xchgl %0, %1", X86_FEATURE_11AP,
63 ASM_OUTPUT2("=r" (v), "=m" (*addr)),
64 ASM_OUTPUT2("0" (v), "m" (*addr)));
65}
66
67static inline u32 native_apic_read(unsigned long reg)
68{
69 return *((volatile u32 *)(APIC_BASE + reg));
70}
71
72extern void apic_wait_icr_idle(void);
73extern u32 safe_apic_wait_icr_idle(void);
74extern int get_physical_broadcast(void);
75
76static inline void ack_APIC_irq(void)
77{
78 /*
79 * ack_APIC_irq() actually gets compiled as a single instruction:
80 * - a single rmw on Pentium/82489DX
81 * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
82 * ... yummie.
83 */
84
85 /* Docs say use 0 for future compatibility */
86 apic_write(APIC_EOI, 0);
87}
88
89extern int lapic_get_maxlvt(void);
90extern void clear_local_APIC(void);
91extern void connect_bsp_APIC(void);
92extern void disconnect_bsp_APIC(int virt_wire_setup);
93extern void disable_local_APIC(void);
94extern void lapic_shutdown(void);
95extern int verify_local_APIC(void);
96extern void cache_APIC_registers(void);
97extern void sync_Arb_IDs(void);
98extern void init_bsp_APIC(void);
99extern void setup_local_APIC(void);
100extern void end_local_APIC_setup(void);
101extern void init_apic_mappings(void);
102extern void setup_boot_APIC_clock(void);
103extern void setup_secondary_APIC_clock(void);
104extern int APIC_init_uniprocessor(void);
105extern void enable_NMI_through_LVT0(void);
106
107/*
108 * On 32bit this is mach-xxx local
109 */
110#ifdef CONFIG_X86_64
111extern void early_init_lapic_mapping(void);
112extern int apic_is_clustered_box(void);
113#else
114static inline int apic_is_clustered_box(void)
115{
116 return 0;
117}
118#endif
119
120extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
121extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
122
123
124#else /* !CONFIG_X86_LOCAL_APIC */
125static inline void lapic_shutdown(void) { }
126#define local_apic_timer_c2_ok 1
127static inline void init_apic_mappings(void) { }
128
129#endif /* !CONFIG_X86_LOCAL_APIC */
130
131#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86/apicdef.h b/include/asm-x86/apicdef.h
deleted file mode 100644
index 6b9008c78731..000000000000
--- a/include/asm-x86/apicdef.h
+++ /dev/null
@@ -1,414 +0,0 @@
1#ifndef _ASM_X86_APICDEF_H
2#define _ASM_X86_APICDEF_H
3
4/*
5 * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
6 *
7 * Alan Cox <Alan.Cox@linux.org>, 1995.
8 * Ingo Molnar <mingo@redhat.com>, 1999, 2000
9 */
10
11#define APIC_DEFAULT_PHYS_BASE 0xfee00000
12
13#define APIC_ID 0x20
14
15#define APIC_LVR 0x30
16#define APIC_LVR_MASK 0xFF00FF
17#define GET_APIC_VERSION(x) ((x) & 0xFFu)
18#define GET_APIC_MAXLVT(x) (((x) >> 16) & 0xFFu)
19#ifdef CONFIG_X86_32
20# define APIC_INTEGRATED(x) ((x) & 0xF0u)
21#else
22# define APIC_INTEGRATED(x) (1)
23#endif
24#define APIC_XAPIC(x) ((x) >= 0x14)
25#define APIC_TASKPRI 0x80
26#define APIC_TPRI_MASK 0xFFu
27#define APIC_ARBPRI 0x90
28#define APIC_ARBPRI_MASK 0xFFu
29#define APIC_PROCPRI 0xA0
30#define APIC_EOI 0xB0
31#define APIC_EIO_ACK 0x0
32#define APIC_RRR 0xC0
33#define APIC_LDR 0xD0
34#define APIC_LDR_MASK (0xFFu << 24)
35#define GET_APIC_LOGICAL_ID(x) (((x) >> 24) & 0xFFu)
36#define SET_APIC_LOGICAL_ID(x) (((x) << 24))
37#define APIC_ALL_CPUS 0xFFu
38#define APIC_DFR 0xE0
39#define APIC_DFR_CLUSTER 0x0FFFFFFFul
40#define APIC_DFR_FLAT 0xFFFFFFFFul
41#define APIC_SPIV 0xF0
42#define APIC_SPIV_FOCUS_DISABLED (1 << 9)
43#define APIC_SPIV_APIC_ENABLED (1 << 8)
44#define APIC_ISR 0x100
45#define APIC_ISR_NR 0x8 /* Number of 32 bit ISR registers. */
46#define APIC_TMR 0x180
47#define APIC_IRR 0x200
48#define APIC_ESR 0x280
49#define APIC_ESR_SEND_CS 0x00001
50#define APIC_ESR_RECV_CS 0x00002
51#define APIC_ESR_SEND_ACC 0x00004
52#define APIC_ESR_RECV_ACC 0x00008
53#define APIC_ESR_SENDILL 0x00020
54#define APIC_ESR_RECVILL 0x00040
55#define APIC_ESR_ILLREGA 0x00080
56#define APIC_ICR 0x300
57#define APIC_DEST_SELF 0x40000
58#define APIC_DEST_ALLINC 0x80000
59#define APIC_DEST_ALLBUT 0xC0000
60#define APIC_ICR_RR_MASK 0x30000
61#define APIC_ICR_RR_INVALID 0x00000
62#define APIC_ICR_RR_INPROG 0x10000
63#define APIC_ICR_RR_VALID 0x20000
64#define APIC_INT_LEVELTRIG 0x08000
65#define APIC_INT_ASSERT 0x04000
66#define APIC_ICR_BUSY 0x01000
67#define APIC_DEST_LOGICAL 0x00800
68#define APIC_DEST_PHYSICAL 0x00000
69#define APIC_DM_FIXED 0x00000
70#define APIC_DM_LOWEST 0x00100
71#define APIC_DM_SMI 0x00200
72#define APIC_DM_REMRD 0x00300
73#define APIC_DM_NMI 0x00400
74#define APIC_DM_INIT 0x00500
75#define APIC_DM_STARTUP 0x00600
76#define APIC_DM_EXTINT 0x00700
77#define APIC_VECTOR_MASK 0x000FF
78#define APIC_ICR2 0x310
79#define GET_APIC_DEST_FIELD(x) (((x) >> 24) & 0xFF)
80#define SET_APIC_DEST_FIELD(x) ((x) << 24)
81#define APIC_LVTT 0x320
82#define APIC_LVTTHMR 0x330
83#define APIC_LVTPC 0x340
84#define APIC_LVT0 0x350
85#define APIC_LVT_TIMER_BASE_MASK (0x3 << 18)
86#define GET_APIC_TIMER_BASE(x) (((x) >> 18) & 0x3)
87#define SET_APIC_TIMER_BASE(x) (((x) << 18))
88#define APIC_TIMER_BASE_CLKIN 0x0
89#define APIC_TIMER_BASE_TMBASE 0x1
90#define APIC_TIMER_BASE_DIV 0x2
91#define APIC_LVT_TIMER_PERIODIC (1 << 17)
92#define APIC_LVT_MASKED (1 << 16)
93#define APIC_LVT_LEVEL_TRIGGER (1 << 15)
94#define APIC_LVT_REMOTE_IRR (1 << 14)
95#define APIC_INPUT_POLARITY (1 << 13)
96#define APIC_SEND_PENDING (1 << 12)
97#define APIC_MODE_MASK 0x700
98#define GET_APIC_DELIVERY_MODE(x) (((x) >> 8) & 0x7)
99#define SET_APIC_DELIVERY_MODE(x, y) (((x) & ~0x700) | ((y) << 8))
100#define APIC_MODE_FIXED 0x0
101#define APIC_MODE_NMI 0x4
102#define APIC_MODE_EXTINT 0x7
103#define APIC_LVT1 0x360
104#define APIC_LVTERR 0x370
105#define APIC_TMICT 0x380
106#define APIC_TMCCT 0x390
107#define APIC_TDCR 0x3E0
108#define APIC_TDR_DIV_TMBASE (1 << 2)
109#define APIC_TDR_DIV_1 0xB
110#define APIC_TDR_DIV_2 0x0
111#define APIC_TDR_DIV_4 0x1
112#define APIC_TDR_DIV_8 0x2
113#define APIC_TDR_DIV_16 0x3
114#define APIC_TDR_DIV_32 0x8
115#define APIC_TDR_DIV_64 0x9
116#define APIC_TDR_DIV_128 0xA
117#define APIC_EILVT0 0x500
118#define APIC_EILVT_NR_AMD_K8 1 /* # of extended interrupts */
119#define APIC_EILVT_NR_AMD_10H 4
120#define APIC_EILVT_LVTOFF(x) (((x) >> 4) & 0xF)
121#define APIC_EILVT_MSG_FIX 0x0
122#define APIC_EILVT_MSG_SMI 0x2
123#define APIC_EILVT_MSG_NMI 0x4
124#define APIC_EILVT_MSG_EXT 0x7
125#define APIC_EILVT_MASKED (1 << 16)
126#define APIC_EILVT1 0x510
127#define APIC_EILVT2 0x520
128#define APIC_EILVT3 0x530
129
130#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
131
132#ifdef CONFIG_X86_32
133# define MAX_IO_APICS 64
134#else
135# define MAX_IO_APICS 128
136# define MAX_LOCAL_APIC 32768
137#endif
138
139/*
140 * All x86-64 systems are xAPIC compatible.
141 * In the following, "apicid" is a physical APIC ID.
142 */
143#define XAPIC_DEST_CPUS_SHIFT 4
144#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1)
145#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT)
146#define APIC_CLUSTER(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
147#define APIC_CLUSTERID(apicid) (APIC_CLUSTER(apicid) >> XAPIC_DEST_CPUS_SHIFT)
148#define APIC_CPUID(apicid) ((apicid) & XAPIC_DEST_CPUS_MASK)
149#define NUM_APIC_CLUSTERS ((BAD_APICID + 1) >> XAPIC_DEST_CPUS_SHIFT)
150
151/*
152 * the local APIC register structure, memory mapped. Not terribly well
153 * tested, but we might eventually use this one in the future - the
154 * problem why we cannot use it right now is the P5 APIC, it has an
155 * errata which cannot take 8-bit reads and writes, only 32-bit ones ...
156 */
157#define u32 unsigned int
158
159struct local_apic {
160
161/*000*/ struct { u32 __reserved[4]; } __reserved_01;
162
163/*010*/ struct { u32 __reserved[4]; } __reserved_02;
164
165/*020*/ struct { /* APIC ID Register */
166 u32 __reserved_1 : 24,
167 phys_apic_id : 4,
168 __reserved_2 : 4;
169 u32 __reserved[3];
170 } id;
171
172/*030*/ const
173 struct { /* APIC Version Register */
174 u32 version : 8,
175 __reserved_1 : 8,
176 max_lvt : 8,
177 __reserved_2 : 8;
178 u32 __reserved[3];
179 } version;
180
181/*040*/ struct { u32 __reserved[4]; } __reserved_03;
182
183/*050*/ struct { u32 __reserved[4]; } __reserved_04;
184
185/*060*/ struct { u32 __reserved[4]; } __reserved_05;
186
187/*070*/ struct { u32 __reserved[4]; } __reserved_06;
188
189/*080*/ struct { /* Task Priority Register */
190 u32 priority : 8,
191 __reserved_1 : 24;
192 u32 __reserved_2[3];
193 } tpr;
194
195/*090*/ const
196 struct { /* Arbitration Priority Register */
197 u32 priority : 8,
198 __reserved_1 : 24;
199 u32 __reserved_2[3];
200 } apr;
201
202/*0A0*/ const
203 struct { /* Processor Priority Register */
204 u32 priority : 8,
205 __reserved_1 : 24;
206 u32 __reserved_2[3];
207 } ppr;
208
209/*0B0*/ struct { /* End Of Interrupt Register */
210 u32 eoi;
211 u32 __reserved[3];
212 } eoi;
213
214/*0C0*/ struct { u32 __reserved[4]; } __reserved_07;
215
216/*0D0*/ struct { /* Logical Destination Register */
217 u32 __reserved_1 : 24,
218 logical_dest : 8;
219 u32 __reserved_2[3];
220 } ldr;
221
222/*0E0*/ struct { /* Destination Format Register */
223 u32 __reserved_1 : 28,
224 model : 4;
225 u32 __reserved_2[3];
226 } dfr;
227
228/*0F0*/ struct { /* Spurious Interrupt Vector Register */
229 u32 spurious_vector : 8,
230 apic_enabled : 1,
231 focus_cpu : 1,
232 __reserved_2 : 22;
233 u32 __reserved_3[3];
234 } svr;
235
236/*100*/ struct { /* In Service Register */
237/*170*/ u32 bitfield;
238 u32 __reserved[3];
239 } isr [8];
240
241/*180*/ struct { /* Trigger Mode Register */
242/*1F0*/ u32 bitfield;
243 u32 __reserved[3];
244 } tmr [8];
245
246/*200*/ struct { /* Interrupt Request Register */
247/*270*/ u32 bitfield;
248 u32 __reserved[3];
249 } irr [8];
250
251/*280*/ union { /* Error Status Register */
252 struct {
253 u32 send_cs_error : 1,
254 receive_cs_error : 1,
255 send_accept_error : 1,
256 receive_accept_error : 1,
257 __reserved_1 : 1,
258 send_illegal_vector : 1,
259 receive_illegal_vector : 1,
260 illegal_register_address : 1,
261 __reserved_2 : 24;
262 u32 __reserved_3[3];
263 } error_bits;
264 struct {
265 u32 errors;
266 u32 __reserved_3[3];
267 } all_errors;
268 } esr;
269
270/*290*/ struct { u32 __reserved[4]; } __reserved_08;
271
272/*2A0*/ struct { u32 __reserved[4]; } __reserved_09;
273
274/*2B0*/ struct { u32 __reserved[4]; } __reserved_10;
275
276/*2C0*/ struct { u32 __reserved[4]; } __reserved_11;
277
278/*2D0*/ struct { u32 __reserved[4]; } __reserved_12;
279
280/*2E0*/ struct { u32 __reserved[4]; } __reserved_13;
281
282/*2F0*/ struct { u32 __reserved[4]; } __reserved_14;
283
284/*300*/ struct { /* Interrupt Command Register 1 */
285 u32 vector : 8,
286 delivery_mode : 3,
287 destination_mode : 1,
288 delivery_status : 1,
289 __reserved_1 : 1,
290 level : 1,
291 trigger : 1,
292 __reserved_2 : 2,
293 shorthand : 2,
294 __reserved_3 : 12;
295 u32 __reserved_4[3];
296 } icr1;
297
298/*310*/ struct { /* Interrupt Command Register 2 */
299 union {
300 u32 __reserved_1 : 24,
301 phys_dest : 4,
302 __reserved_2 : 4;
303 u32 __reserved_3 : 24,
304 logical_dest : 8;
305 } dest;
306 u32 __reserved_4[3];
307 } icr2;
308
309/*320*/ struct { /* LVT - Timer */
310 u32 vector : 8,
311 __reserved_1 : 4,
312 delivery_status : 1,
313 __reserved_2 : 3,
314 mask : 1,
315 timer_mode : 1,
316 __reserved_3 : 14;
317 u32 __reserved_4[3];
318 } lvt_timer;
319
320/*330*/ struct { /* LVT - Thermal Sensor */
321 u32 vector : 8,
322 delivery_mode : 3,
323 __reserved_1 : 1,
324 delivery_status : 1,
325 __reserved_2 : 3,
326 mask : 1,
327 __reserved_3 : 15;
328 u32 __reserved_4[3];
329 } lvt_thermal;
330
331/*340*/ struct { /* LVT - Performance Counter */
332 u32 vector : 8,
333 delivery_mode : 3,
334 __reserved_1 : 1,
335 delivery_status : 1,
336 __reserved_2 : 3,
337 mask : 1,
338 __reserved_3 : 15;
339 u32 __reserved_4[3];
340 } lvt_pc;
341
342/*350*/ struct { /* LVT - LINT0 */
343 u32 vector : 8,
344 delivery_mode : 3,
345 __reserved_1 : 1,
346 delivery_status : 1,
347 polarity : 1,
348 remote_irr : 1,
349 trigger : 1,
350 mask : 1,
351 __reserved_2 : 15;
352 u32 __reserved_3[3];
353 } lvt_lint0;
354
355/*360*/ struct { /* LVT - LINT1 */
356 u32 vector : 8,
357 delivery_mode : 3,
358 __reserved_1 : 1,
359 delivery_status : 1,
360 polarity : 1,
361 remote_irr : 1,
362 trigger : 1,
363 mask : 1,
364 __reserved_2 : 15;
365 u32 __reserved_3[3];
366 } lvt_lint1;
367
368/*370*/ struct { /* LVT - Error */
369 u32 vector : 8,
370 __reserved_1 : 4,
371 delivery_status : 1,
372 __reserved_2 : 3,
373 mask : 1,
374 __reserved_3 : 15;
375 u32 __reserved_4[3];
376 } lvt_error;
377
378/*380*/ struct { /* Timer Initial Count Register */
379 u32 initial_count;
380 u32 __reserved_2[3];
381 } timer_icr;
382
383/*390*/ const
384 struct { /* Timer Current Count Register */
385 u32 curr_count;
386 u32 __reserved_2[3];
387 } timer_ccr;
388
389/*3A0*/ struct { u32 __reserved[4]; } __reserved_16;
390
391/*3B0*/ struct { u32 __reserved[4]; } __reserved_17;
392
393/*3C0*/ struct { u32 __reserved[4]; } __reserved_18;
394
395/*3D0*/ struct { u32 __reserved[4]; } __reserved_19;
396
397/*3E0*/ struct { /* Timer Divide Configuration Register */
398 u32 divisor : 4,
399 __reserved_1 : 28;
400 u32 __reserved_2[3];
401 } timer_dcr;
402
403/*3F0*/ struct { u32 __reserved[4]; } __reserved_20;
404
405} __attribute__ ((packed));
406
407#undef u32
408
409#ifdef CONFIG_X86_32
410 #define BAD_APICID 0xFFu
411#else
412 #define BAD_APICID 0xFFFFu
413#endif
414#endif
diff --git a/include/asm-x86/arch_hooks.h b/include/asm-x86/arch_hooks.h
deleted file mode 100644
index 8411750ceb63..000000000000
--- a/include/asm-x86/arch_hooks.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_ARCH_HOOKS_H
2#define _ASM_ARCH_HOOKS_H
3
4#include <linux/interrupt.h>
5
6/*
7 * linux/include/asm/arch_hooks.h
8 *
9 * define the architecture specific hooks
10 */
11
12/* these aren't arch hooks, they are generic routines
13 * that can be used by the hooks */
14extern void init_ISA_irqs(void);
15extern void apic_intr_init(void);
16extern void smp_intr_init(void);
17extern irqreturn_t timer_interrupt(int irq, void *dev_id);
18
19/* these are the defined hooks */
20extern void intr_init_hook(void);
21extern void pre_intr_init_hook(void);
22extern void pre_setup_arch_hook(void);
23extern void trap_init_hook(void);
24extern void pre_time_init_hook(void);
25extern void time_init_hook(void);
26extern void mca_nmi_hook(void);
27
28#endif
diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h
deleted file mode 100644
index 97220321f39d..000000000000
--- a/include/asm-x86/asm.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASM_X86_ASM_H
2#define _ASM_X86_ASM_H
3
4#ifdef __ASSEMBLY__
5# define __ASM_FORM(x) x
6# define __ASM_EX_SEC .section __ex_table
7#else
8# define __ASM_FORM(x) " " #x " "
9# define __ASM_EX_SEC " .section __ex_table,\"a\"\n"
10#endif
11
12#ifdef CONFIG_X86_32
13# define __ASM_SEL(a,b) __ASM_FORM(a)
14#else
15# define __ASM_SEL(a,b) __ASM_FORM(b)
16#endif
17
18#define __ASM_SIZE(inst) __ASM_SEL(inst##l, inst##q)
19#define __ASM_REG(reg) __ASM_SEL(e##reg, r##reg)
20
21#define _ASM_PTR __ASM_SEL(.long, .quad)
22#define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8)
23#define _ASM_MOV_UL __ASM_SIZE(mov)
24
25#define _ASM_INC __ASM_SIZE(inc)
26#define _ASM_DEC __ASM_SIZE(dec)
27#define _ASM_ADD __ASM_SIZE(add)
28#define _ASM_SUB __ASM_SIZE(sub)
29#define _ASM_XADD __ASM_SIZE(xadd)
30#define _ASM_AX __ASM_REG(ax)
31#define _ASM_BX __ASM_REG(bx)
32#define _ASM_CX __ASM_REG(cx)
33#define _ASM_DX __ASM_REG(dx)
34
35/* Exception table entry */
36# define _ASM_EXTABLE(from,to) \
37 __ASM_EX_SEC \
38 _ASM_ALIGN "\n" \
39 _ASM_PTR #from "," #to "\n" \
40 " .previous\n"
41
42#endif /* _ASM_X86_ASM_H */
diff --git a/include/asm-x86/atomic.h b/include/asm-x86/atomic.h
deleted file mode 100644
index 4e1b8873c474..000000000000
--- a/include/asm-x86/atomic.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "atomic_32.h"
3#else
4# include "atomic_64.h"
5#endif
diff --git a/include/asm-x86/atomic_32.h b/include/asm-x86/atomic_32.h
deleted file mode 100644
index 21a4825148c0..000000000000
--- a/include/asm-x86/atomic_32.h
+++ /dev/null
@@ -1,259 +0,0 @@
1#ifndef __ARCH_I386_ATOMIC__
2#define __ARCH_I386_ATOMIC__
3
4#include <linux/compiler.h>
5#include <asm/processor.h>
6#include <asm/cmpxchg.h>
7
8/*
9 * Atomic operations that C can't guarantee us. Useful for
10 * resource counting etc..
11 */
12
13/*
14 * Make sure gcc doesn't try to be clever and move things around
15 * on us. We need to use _exactly_ the address the user gave us,
16 * not some alias that contains the same information.
17 */
18typedef struct {
19 int counter;
20} atomic_t;
21
22#define ATOMIC_INIT(i) { (i) }
23
24/**
25 * atomic_read - read atomic variable
26 * @v: pointer of type atomic_t
27 *
28 * Atomically reads the value of @v.
29 */
30#define atomic_read(v) ((v)->counter)
31
32/**
33 * atomic_set - set atomic variable
34 * @v: pointer of type atomic_t
35 * @i: required value
36 *
37 * Atomically sets the value of @v to @i.
38 */
39#define atomic_set(v, i) (((v)->counter) = (i))
40
41/**
42 * atomic_add - add integer to atomic variable
43 * @i: integer value to add
44 * @v: pointer of type atomic_t
45 *
46 * Atomically adds @i to @v.
47 */
48static inline void atomic_add(int i, atomic_t *v)
49{
50 asm volatile(LOCK_PREFIX "addl %1,%0"
51 : "+m" (v->counter)
52 : "ir" (i));
53}
54
55/**
56 * atomic_sub - subtract integer from atomic variable
57 * @i: integer value to subtract
58 * @v: pointer of type atomic_t
59 *
60 * Atomically subtracts @i from @v.
61 */
62static inline void atomic_sub(int i, atomic_t *v)
63{
64 asm volatile(LOCK_PREFIX "subl %1,%0"
65 : "+m" (v->counter)
66 : "ir" (i));
67}
68
69/**
70 * atomic_sub_and_test - subtract value from variable and test result
71 * @i: integer value to subtract
72 * @v: pointer of type atomic_t
73 *
74 * Atomically subtracts @i from @v and returns
75 * true if the result is zero, or false for all
76 * other cases.
77 */
78static inline int atomic_sub_and_test(int i, atomic_t *v)
79{
80 unsigned char c;
81
82 asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
83 : "+m" (v->counter), "=qm" (c)
84 : "ir" (i) : "memory");
85 return c;
86}
87
88/**
89 * atomic_inc - increment atomic variable
90 * @v: pointer of type atomic_t
91 *
92 * Atomically increments @v by 1.
93 */
94static inline void atomic_inc(atomic_t *v)
95{
96 asm volatile(LOCK_PREFIX "incl %0"
97 : "+m" (v->counter));
98}
99
100/**
101 * atomic_dec - decrement atomic variable
102 * @v: pointer of type atomic_t
103 *
104 * Atomically decrements @v by 1.
105 */
106static inline void atomic_dec(atomic_t *v)
107{
108 asm volatile(LOCK_PREFIX "decl %0"
109 : "+m" (v->counter));
110}
111
112/**
113 * atomic_dec_and_test - decrement and test
114 * @v: pointer of type atomic_t
115 *
116 * Atomically decrements @v by 1 and
117 * returns true if the result is 0, or false for all other
118 * cases.
119 */
120static inline int atomic_dec_and_test(atomic_t *v)
121{
122 unsigned char c;
123
124 asm volatile(LOCK_PREFIX "decl %0; sete %1"
125 : "+m" (v->counter), "=qm" (c)
126 : : "memory");
127 return c != 0;
128}
129
130/**
131 * atomic_inc_and_test - increment and test
132 * @v: pointer of type atomic_t
133 *
134 * Atomically increments @v by 1
135 * and returns true if the result is zero, or false for all
136 * other cases.
137 */
138static inline int atomic_inc_and_test(atomic_t *v)
139{
140 unsigned char c;
141
142 asm volatile(LOCK_PREFIX "incl %0; sete %1"
143 : "+m" (v->counter), "=qm" (c)
144 : : "memory");
145 return c != 0;
146}
147
148/**
149 * atomic_add_negative - add and test if negative
150 * @v: pointer of type atomic_t
151 * @i: integer value to add
152 *
153 * Atomically adds @i to @v and returns true
154 * if the result is negative, or false when
155 * result is greater than or equal to zero.
156 */
157static inline int atomic_add_negative(int i, atomic_t *v)
158{
159 unsigned char c;
160
161 asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
162 : "+m" (v->counter), "=qm" (c)
163 : "ir" (i) : "memory");
164 return c;
165}
166
167/**
168 * atomic_add_return - add integer and return
169 * @v: pointer of type atomic_t
170 * @i: integer value to add
171 *
172 * Atomically adds @i to @v and returns @i + @v
173 */
174static inline int atomic_add_return(int i, atomic_t *v)
175{
176 int __i;
177#ifdef CONFIG_M386
178 unsigned long flags;
179 if (unlikely(boot_cpu_data.x86 <= 3))
180 goto no_xadd;
181#endif
182 /* Modern 486+ processor */
183 __i = i;
184 asm volatile(LOCK_PREFIX "xaddl %0, %1"
185 : "+r" (i), "+m" (v->counter)
186 : : "memory");
187 return i + __i;
188
189#ifdef CONFIG_M386
190no_xadd: /* Legacy 386 processor */
191 local_irq_save(flags);
192 __i = atomic_read(v);
193 atomic_set(v, i + __i);
194 local_irq_restore(flags);
195 return i + __i;
196#endif
197}
198
199/**
200 * atomic_sub_return - subtract integer and return
201 * @v: pointer of type atomic_t
202 * @i: integer value to subtract
203 *
204 * Atomically subtracts @i from @v and returns @v - @i
205 */
206static inline int atomic_sub_return(int i, atomic_t *v)
207{
208 return atomic_add_return(-i, v);
209}
210
211#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
212#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
213
214/**
215 * atomic_add_unless - add unless the number is already a given value
216 * @v: pointer of type atomic_t
217 * @a: the amount to add to v...
218 * @u: ...unless v is equal to u.
219 *
220 * Atomically adds @a to @v, so long as @v was not already @u.
221 * Returns non-zero if @v was not @u, and zero otherwise.
222 */
223static inline int atomic_add_unless(atomic_t *v, int a, int u)
224{
225 int c, old;
226 c = atomic_read(v);
227 for (;;) {
228 if (unlikely(c == (u)))
229 break;
230 old = atomic_cmpxchg((v), c, c + (a));
231 if (likely(old == c))
232 break;
233 c = old;
234 }
235 return c != (u);
236}
237
238#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
239
240#define atomic_inc_return(v) (atomic_add_return(1, v))
241#define atomic_dec_return(v) (atomic_sub_return(1, v))
242
243/* These are x86-specific, used by some header files */
244#define atomic_clear_mask(mask, addr) \
245 asm volatile(LOCK_PREFIX "andl %0,%1" \
246 : : "r" (~(mask)), "m" (*(addr)) : "memory")
247
248#define atomic_set_mask(mask, addr) \
249 asm volatile(LOCK_PREFIX "orl %0,%1" \
250 : : "r" (mask), "m" (*(addr)) : "memory")
251
252/* Atomic operations are already serializing on x86 */
253#define smp_mb__before_atomic_dec() barrier()
254#define smp_mb__after_atomic_dec() barrier()
255#define smp_mb__before_atomic_inc() barrier()
256#define smp_mb__after_atomic_inc() barrier()
257
258#include <asm-generic/atomic.h>
259#endif
diff --git a/include/asm-x86/atomic_64.h b/include/asm-x86/atomic_64.h
deleted file mode 100644
index 91c7d03e65bc..000000000000
--- a/include/asm-x86/atomic_64.h
+++ /dev/null
@@ -1,473 +0,0 @@
1#ifndef __ARCH_X86_64_ATOMIC__
2#define __ARCH_X86_64_ATOMIC__
3
4#include <asm/alternative.h>
5#include <asm/cmpxchg.h>
6
7/* atomic_t should be 32 bit signed type */
8
9/*
10 * Atomic operations that C can't guarantee us. Useful for
11 * resource counting etc..
12 */
13
14/*
15 * Make sure gcc doesn't try to be clever and move things around
16 * on us. We need to use _exactly_ the address the user gave us,
17 * not some alias that contains the same information.
18 */
19typedef struct {
20 int counter;
21} atomic_t;
22
23#define ATOMIC_INIT(i) { (i) }
24
25/**
26 * atomic_read - read atomic variable
27 * @v: pointer of type atomic_t
28 *
29 * Atomically reads the value of @v.
30 */
31#define atomic_read(v) ((v)->counter)
32
33/**
34 * atomic_set - set atomic variable
35 * @v: pointer of type atomic_t
36 * @i: required value
37 *
38 * Atomically sets the value of @v to @i.
39 */
40#define atomic_set(v, i) (((v)->counter) = (i))
41
42/**
43 * atomic_add - add integer to atomic variable
44 * @i: integer value to add
45 * @v: pointer of type atomic_t
46 *
47 * Atomically adds @i to @v.
48 */
49static inline void atomic_add(int i, atomic_t *v)
50{
51 asm volatile(LOCK_PREFIX "addl %1,%0"
52 : "=m" (v->counter)
53 : "ir" (i), "m" (v->counter));
54}
55
56/**
57 * atomic_sub - subtract the atomic variable
58 * @i: integer value to subtract
59 * @v: pointer of type atomic_t
60 *
61 * Atomically subtracts @i from @v.
62 */
63static inline void atomic_sub(int i, atomic_t *v)
64{
65 asm volatile(LOCK_PREFIX "subl %1,%0"
66 : "=m" (v->counter)
67 : "ir" (i), "m" (v->counter));
68}
69
70/**
71 * atomic_sub_and_test - subtract value from variable and test result
72 * @i: integer value to subtract
73 * @v: pointer of type atomic_t
74 *
75 * Atomically subtracts @i from @v and returns
76 * true if the result is zero, or false for all
77 * other cases.
78 */
79static inline int atomic_sub_and_test(int i, atomic_t *v)
80{
81 unsigned char c;
82
83 asm volatile(LOCK_PREFIX "subl %2,%0; sete %1"
84 : "=m" (v->counter), "=qm" (c)
85 : "ir" (i), "m" (v->counter) : "memory");
86 return c;
87}
88
89/**
90 * atomic_inc - increment atomic variable
91 * @v: pointer of type atomic_t
92 *
93 * Atomically increments @v by 1.
94 */
95static inline void atomic_inc(atomic_t *v)
96{
97 asm volatile(LOCK_PREFIX "incl %0"
98 : "=m" (v->counter)
99 : "m" (v->counter));
100}
101
102/**
103 * atomic_dec - decrement atomic variable
104 * @v: pointer of type atomic_t
105 *
106 * Atomically decrements @v by 1.
107 */
108static inline void atomic_dec(atomic_t *v)
109{
110 asm volatile(LOCK_PREFIX "decl %0"
111 : "=m" (v->counter)
112 : "m" (v->counter));
113}
114
115/**
116 * atomic_dec_and_test - decrement and test
117 * @v: pointer of type atomic_t
118 *
119 * Atomically decrements @v by 1 and
120 * returns true if the result is 0, or false for all other
121 * cases.
122 */
123static inline int atomic_dec_and_test(atomic_t *v)
124{
125 unsigned char c;
126
127 asm volatile(LOCK_PREFIX "decl %0; sete %1"
128 : "=m" (v->counter), "=qm" (c)
129 : "m" (v->counter) : "memory");
130 return c != 0;
131}
132
133/**
134 * atomic_inc_and_test - increment and test
135 * @v: pointer of type atomic_t
136 *
137 * Atomically increments @v by 1
138 * and returns true if the result is zero, or false for all
139 * other cases.
140 */
141static inline int atomic_inc_and_test(atomic_t *v)
142{
143 unsigned char c;
144
145 asm volatile(LOCK_PREFIX "incl %0; sete %1"
146 : "=m" (v->counter), "=qm" (c)
147 : "m" (v->counter) : "memory");
148 return c != 0;
149}
150
151/**
152 * atomic_add_negative - add and test if negative
153 * @i: integer value to add
154 * @v: pointer of type atomic_t
155 *
156 * Atomically adds @i to @v and returns true
157 * if the result is negative, or false when
158 * result is greater than or equal to zero.
159 */
160static inline int atomic_add_negative(int i, atomic_t *v)
161{
162 unsigned char c;
163
164 asm volatile(LOCK_PREFIX "addl %2,%0; sets %1"
165 : "=m" (v->counter), "=qm" (c)
166 : "ir" (i), "m" (v->counter) : "memory");
167 return c;
168}
169
170/**
171 * atomic_add_return - add and return
172 * @i: integer value to add
173 * @v: pointer of type atomic_t
174 *
175 * Atomically adds @i to @v and returns @i + @v
176 */
177static inline int atomic_add_return(int i, atomic_t *v)
178{
179 int __i = i;
180 asm volatile(LOCK_PREFIX "xaddl %0, %1"
181 : "+r" (i), "+m" (v->counter)
182 : : "memory");
183 return i + __i;
184}
185
186static inline int atomic_sub_return(int i, atomic_t *v)
187{
188 return atomic_add_return(-i, v);
189}
190
191#define atomic_inc_return(v) (atomic_add_return(1, v))
192#define atomic_dec_return(v) (atomic_sub_return(1, v))
193
194/* An 64bit atomic type */
195
196typedef struct {
197 long counter;
198} atomic64_t;
199
200#define ATOMIC64_INIT(i) { (i) }
201
202/**
203 * atomic64_read - read atomic64 variable
204 * @v: pointer of type atomic64_t
205 *
206 * Atomically reads the value of @v.
207 * Doesn't imply a read memory barrier.
208 */
209#define atomic64_read(v) ((v)->counter)
210
211/**
212 * atomic64_set - set atomic64 variable
213 * @v: pointer to type atomic64_t
214 * @i: required value
215 *
216 * Atomically sets the value of @v to @i.
217 */
218#define atomic64_set(v, i) (((v)->counter) = (i))
219
220/**
221 * atomic64_add - add integer to atomic64 variable
222 * @i: integer value to add
223 * @v: pointer to type atomic64_t
224 *
225 * Atomically adds @i to @v.
226 */
227static inline void atomic64_add(long i, atomic64_t *v)
228{
229 asm volatile(LOCK_PREFIX "addq %1,%0"
230 : "=m" (v->counter)
231 : "er" (i), "m" (v->counter));
232}
233
234/**
235 * atomic64_sub - subtract the atomic64 variable
236 * @i: integer value to subtract
237 * @v: pointer to type atomic64_t
238 *
239 * Atomically subtracts @i from @v.
240 */
241static inline void atomic64_sub(long i, atomic64_t *v)
242{
243 asm volatile(LOCK_PREFIX "subq %1,%0"
244 : "=m" (v->counter)
245 : "er" (i), "m" (v->counter));
246}
247
248/**
249 * atomic64_sub_and_test - subtract value from variable and test result
250 * @i: integer value to subtract
251 * @v: pointer to type atomic64_t
252 *
253 * Atomically subtracts @i from @v and returns
254 * true if the result is zero, or false for all
255 * other cases.
256 */
257static inline int atomic64_sub_and_test(long i, atomic64_t *v)
258{
259 unsigned char c;
260
261 asm volatile(LOCK_PREFIX "subq %2,%0; sete %1"
262 : "=m" (v->counter), "=qm" (c)
263 : "er" (i), "m" (v->counter) : "memory");
264 return c;
265}
266
267/**
268 * atomic64_inc - increment atomic64 variable
269 * @v: pointer to type atomic64_t
270 *
271 * Atomically increments @v by 1.
272 */
273static inline void atomic64_inc(atomic64_t *v)
274{
275 asm volatile(LOCK_PREFIX "incq %0"
276 : "=m" (v->counter)
277 : "m" (v->counter));
278}
279
280/**
281 * atomic64_dec - decrement atomic64 variable
282 * @v: pointer to type atomic64_t
283 *
284 * Atomically decrements @v by 1.
285 */
286static inline void atomic64_dec(atomic64_t *v)
287{
288 asm volatile(LOCK_PREFIX "decq %0"
289 : "=m" (v->counter)
290 : "m" (v->counter));
291}
292
293/**
294 * atomic64_dec_and_test - decrement and test
295 * @v: pointer to type atomic64_t
296 *
297 * Atomically decrements @v by 1 and
298 * returns true if the result is 0, or false for all other
299 * cases.
300 */
301static inline int atomic64_dec_and_test(atomic64_t *v)
302{
303 unsigned char c;
304
305 asm volatile(LOCK_PREFIX "decq %0; sete %1"
306 : "=m" (v->counter), "=qm" (c)
307 : "m" (v->counter) : "memory");
308 return c != 0;
309}
310
311/**
312 * atomic64_inc_and_test - increment and test
313 * @v: pointer to type atomic64_t
314 *
315 * Atomically increments @v by 1
316 * and returns true if the result is zero, or false for all
317 * other cases.
318 */
319static inline int atomic64_inc_and_test(atomic64_t *v)
320{
321 unsigned char c;
322
323 asm volatile(LOCK_PREFIX "incq %0; sete %1"
324 : "=m" (v->counter), "=qm" (c)
325 : "m" (v->counter) : "memory");
326 return c != 0;
327}
328
329/**
330 * atomic64_add_negative - add and test if negative
331 * @i: integer value to add
332 * @v: pointer to type atomic64_t
333 *
334 * Atomically adds @i to @v and returns true
335 * if the result is negative, or false when
336 * result is greater than or equal to zero.
337 */
338static inline int atomic64_add_negative(long i, atomic64_t *v)
339{
340 unsigned char c;
341
342 asm volatile(LOCK_PREFIX "addq %2,%0; sets %1"
343 : "=m" (v->counter), "=qm" (c)
344 : "er" (i), "m" (v->counter) : "memory");
345 return c;
346}
347
348/**
349 * atomic64_add_return - add and return
350 * @i: integer value to add
351 * @v: pointer to type atomic64_t
352 *
353 * Atomically adds @i to @v and returns @i + @v
354 */
355static inline long atomic64_add_return(long i, atomic64_t *v)
356{
357 long __i = i;
358 asm volatile(LOCK_PREFIX "xaddq %0, %1;"
359 : "+r" (i), "+m" (v->counter)
360 : : "memory");
361 return i + __i;
362}
363
364static inline long atomic64_sub_return(long i, atomic64_t *v)
365{
366 return atomic64_add_return(-i, v);
367}
368
369#define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
370#define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
371
372#define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
373#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
374
375#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
376#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
377
378/**
379 * atomic_add_unless - add unless the number is a given value
380 * @v: pointer of type atomic_t
381 * @a: the amount to add to v...
382 * @u: ...unless v is equal to u.
383 *
384 * Atomically adds @a to @v, so long as it was not @u.
385 * Returns non-zero if @v was not @u, and zero otherwise.
386 */
387static inline int atomic_add_unless(atomic_t *v, int a, int u)
388{
389 int c, old;
390 c = atomic_read(v);
391 for (;;) {
392 if (unlikely(c == (u)))
393 break;
394 old = atomic_cmpxchg((v), c, c + (a));
395 if (likely(old == c))
396 break;
397 c = old;
398 }
399 return c != (u);
400}
401
402#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
403
404/**
405 * atomic64_add_unless - add unless the number is a given value
406 * @v: pointer of type atomic64_t
407 * @a: the amount to add to v...
408 * @u: ...unless v is equal to u.
409 *
410 * Atomically adds @a to @v, so long as it was not @u.
411 * Returns non-zero if @v was not @u, and zero otherwise.
412 */
413static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
414{
415 long c, old;
416 c = atomic64_read(v);
417 for (;;) {
418 if (unlikely(c == (u)))
419 break;
420 old = atomic64_cmpxchg((v), c, c + (a));
421 if (likely(old == c))
422 break;
423 c = old;
424 }
425 return c != (u);
426}
427
428/**
429 * atomic_inc_short - increment of a short integer
430 * @v: pointer to type int
431 *
432 * Atomically adds 1 to @v
433 * Returns the new value of @u
434 */
435static inline short int atomic_inc_short(short int *v)
436{
437 asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
438 return *v;
439}
440
441/**
442 * atomic_or_long - OR of two long integers
443 * @v1: pointer to type unsigned long
444 * @v2: pointer to type unsigned long
445 *
446 * Atomically ORs @v1 and @v2
447 * Returns the result of the OR
448 */
449static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
450{
451 asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
452}
453
454#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
455
456/* These are x86-specific, used by some header files */
457#define atomic_clear_mask(mask, addr) \
458 asm volatile(LOCK_PREFIX "andl %0,%1" \
459 : : "r" (~(mask)), "m" (*(addr)) : "memory")
460
461#define atomic_set_mask(mask, addr) \
462 asm volatile(LOCK_PREFIX "orl %0,%1" \
463 : : "r" ((unsigned)(mask)), "m" (*(addr)) \
464 : "memory")
465
466/* Atomic operations are already serializing on x86 */
467#define smp_mb__before_atomic_dec() barrier()
468#define smp_mb__after_atomic_dec() barrier()
469#define smp_mb__before_atomic_inc() barrier()
470#define smp_mb__after_atomic_inc() barrier()
471
472#include <asm-generic/atomic.h>
473#endif
diff --git a/include/asm-x86/auxvec.h b/include/asm-x86/auxvec.h
deleted file mode 100644
index 87f5e6d5a020..000000000000
--- a/include/asm-x86/auxvec.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_X86_AUXVEC_H
2#define _ASM_X86_AUXVEC_H
3/*
4 * Architecture-neutral AT_ values in 0-17, leave some room
5 * for more of them, start the x86-specific ones at 32.
6 */
7#ifdef __i386__
8#define AT_SYSINFO 32
9#endif
10#define AT_SYSINFO_EHDR 33
11
12#endif
diff --git a/include/asm-x86/bios_ebda.h b/include/asm-x86/bios_ebda.h
deleted file mode 100644
index 0033e50c13b2..000000000000
--- a/include/asm-x86/bios_ebda.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _MACH_BIOS_EBDA_H
2#define _MACH_BIOS_EBDA_H
3
4#include <asm/io.h>
5
6/*
7 * there is a real-mode segmented pointer pointing to the
8 * 4K EBDA area at 0x40E.
9 */
10static inline unsigned int get_bios_ebda(void)
11{
12 unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
13 address <<= 4;
14 return address; /* 0 means none */
15}
16
17void reserve_ebda_region(void);
18
19#endif /* _MACH_BIOS_EBDA_H */
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h
deleted file mode 100644
index cfb2b64f76e7..000000000000
--- a/include/asm-x86/bitops.h
+++ /dev/null
@@ -1,461 +0,0 @@
1#ifndef _ASM_X86_BITOPS_H
2#define _ASM_X86_BITOPS_H
3
4/*
5 * Copyright 1992, Linus Torvalds.
6 */
7
8#ifndef _LINUX_BITOPS_H
9#error only <linux/bitops.h> can be included directly
10#endif
11
12#include <linux/compiler.h>
13#include <asm/alternative.h>
14
15/*
16 * These have to be done with inline assembly: that way the bit-setting
17 * is guaranteed to be atomic. All bit operations return 0 if the bit
18 * was cleared before the operation and != 0 if it was not.
19 *
20 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
21 */
22
23#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
24/* Technically wrong, but this avoids compilation errors on some gcc
25 versions. */
26#define BITOP_ADDR(x) "=m" (*(volatile long *) (x))
27#else
28#define BITOP_ADDR(x) "+m" (*(volatile long *) (x))
29#endif
30
31#define ADDR BITOP_ADDR(addr)
32
33/*
34 * We do the locked ops that don't return the old value as
35 * a mask operation on a byte.
36 */
37#define IS_IMMEDIATE(nr) (__builtin_constant_p(nr))
38#define CONST_MASK_ADDR(nr, addr) BITOP_ADDR((void *)(addr) + ((nr)>>3))
39#define CONST_MASK(nr) (1 << ((nr) & 7))
40
41/**
42 * set_bit - Atomically set a bit in memory
43 * @nr: the bit to set
44 * @addr: the address to start counting from
45 *
46 * This function is atomic and may not be reordered. See __set_bit()
47 * if you do not require the atomic guarantees.
48 *
49 * Note: there are no guarantees that this function will not be reordered
50 * on non x86 architectures, so if you are writing portable code,
51 * make sure not to rely on its reordering guarantees.
52 *
53 * Note that @nr may be almost arbitrarily large; this function is not
54 * restricted to acting on a single-word quantity.
55 */
56static inline void set_bit(unsigned int nr, volatile unsigned long *addr)
57{
58 if (IS_IMMEDIATE(nr)) {
59 asm volatile(LOCK_PREFIX "orb %1,%0"
60 : CONST_MASK_ADDR(nr, addr)
61 : "iq" ((u8)CONST_MASK(nr))
62 : "memory");
63 } else {
64 asm volatile(LOCK_PREFIX "bts %1,%0"
65 : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
66 }
67}
68
69/**
70 * __set_bit - Set a bit in memory
71 * @nr: the bit to set
72 * @addr: the address to start counting from
73 *
74 * Unlike set_bit(), this function is non-atomic and may be reordered.
75 * If it's called on the same region of memory simultaneously, the effect
76 * may be that only one operation succeeds.
77 */
78static inline void __set_bit(int nr, volatile unsigned long *addr)
79{
80 asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
81}
82
83/**
84 * clear_bit - Clears a bit in memory
85 * @nr: Bit to clear
86 * @addr: Address to start counting from
87 *
88 * clear_bit() is atomic and may not be reordered. However, it does
89 * not contain a memory barrier, so if it is used for locking purposes,
90 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
91 * in order to ensure changes are visible on other processors.
92 */
93static inline void clear_bit(int nr, volatile unsigned long *addr)
94{
95 if (IS_IMMEDIATE(nr)) {
96 asm volatile(LOCK_PREFIX "andb %1,%0"
97 : CONST_MASK_ADDR(nr, addr)
98 : "iq" ((u8)~CONST_MASK(nr)));
99 } else {
100 asm volatile(LOCK_PREFIX "btr %1,%0"
101 : BITOP_ADDR(addr)
102 : "Ir" (nr));
103 }
104}
105
106/*
107 * clear_bit_unlock - Clears a bit in memory
108 * @nr: Bit to clear
109 * @addr: Address to start counting from
110 *
111 * clear_bit() is atomic and implies release semantics before the memory
112 * operation. It can be used for an unlock.
113 */
114static inline void clear_bit_unlock(unsigned nr, volatile unsigned long *addr)
115{
116 barrier();
117 clear_bit(nr, addr);
118}
119
120static inline void __clear_bit(int nr, volatile unsigned long *addr)
121{
122 asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
123}
124
125/*
126 * __clear_bit_unlock - Clears a bit in memory
127 * @nr: Bit to clear
128 * @addr: Address to start counting from
129 *
130 * __clear_bit() is non-atomic and implies release semantics before the memory
131 * operation. It can be used for an unlock if no other CPUs can concurrently
132 * modify other bits in the word.
133 *
134 * No memory barrier is required here, because x86 cannot reorder stores past
135 * older loads. Same principle as spin_unlock.
136 */
137static inline void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr)
138{
139 barrier();
140 __clear_bit(nr, addr);
141}
142
143#define smp_mb__before_clear_bit() barrier()
144#define smp_mb__after_clear_bit() barrier()
145
146/**
147 * __change_bit - Toggle a bit in memory
148 * @nr: the bit to change
149 * @addr: the address to start counting from
150 *
151 * Unlike change_bit(), this function is non-atomic and may be reordered.
152 * If it's called on the same region of memory simultaneously, the effect
153 * may be that only one operation succeeds.
154 */
155static inline void __change_bit(int nr, volatile unsigned long *addr)
156{
157 asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
158}
159
160/**
161 * change_bit - Toggle a bit in memory
162 * @nr: Bit to change
163 * @addr: Address to start counting from
164 *
165 * change_bit() is atomic and may not be reordered.
166 * Note that @nr may be almost arbitrarily large; this function is not
167 * restricted to acting on a single-word quantity.
168 */
169static inline void change_bit(int nr, volatile unsigned long *addr)
170{
171 asm volatile(LOCK_PREFIX "btc %1,%0" : ADDR : "Ir" (nr));
172}
173
174/**
175 * test_and_set_bit - Set a bit and return its old value
176 * @nr: Bit to set
177 * @addr: Address to count from
178 *
179 * This operation is atomic and cannot be reordered.
180 * It also implies a memory barrier.
181 */
182static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
183{
184 int oldbit;
185
186 asm volatile(LOCK_PREFIX "bts %2,%1\n\t"
187 "sbb %0,%0" : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
188
189 return oldbit;
190}
191
192/**
193 * test_and_set_bit_lock - Set a bit and return its old value for lock
194 * @nr: Bit to set
195 * @addr: Address to count from
196 *
197 * This is the same as test_and_set_bit on x86.
198 */
199static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr)
200{
201 return test_and_set_bit(nr, addr);
202}
203
204/**
205 * __test_and_set_bit - Set a bit and return its old value
206 * @nr: Bit to set
207 * @addr: Address to count from
208 *
209 * This operation is non-atomic and can be reordered.
210 * If two examples of this operation race, one can appear to succeed
211 * but actually fail. You must protect multiple accesses with a lock.
212 */
213static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
214{
215 int oldbit;
216
217 asm("bts %2,%1\n\t"
218 "sbb %0,%0"
219 : "=r" (oldbit), ADDR
220 : "Ir" (nr));
221 return oldbit;
222}
223
224/**
225 * test_and_clear_bit - Clear a bit and return its old value
226 * @nr: Bit to clear
227 * @addr: Address to count from
228 *
229 * This operation is atomic and cannot be reordered.
230 * It also implies a memory barrier.
231 */
232static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
233{
234 int oldbit;
235
236 asm volatile(LOCK_PREFIX "btr %2,%1\n\t"
237 "sbb %0,%0"
238 : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
239
240 return oldbit;
241}
242
243/**
244 * __test_and_clear_bit - Clear a bit and return its old value
245 * @nr: Bit to clear
246 * @addr: Address to count from
247 *
248 * This operation is non-atomic and can be reordered.
249 * If two examples of this operation race, one can appear to succeed
250 * but actually fail. You must protect multiple accesses with a lock.
251 */
252static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
253{
254 int oldbit;
255
256 asm volatile("btr %2,%1\n\t"
257 "sbb %0,%0"
258 : "=r" (oldbit), ADDR
259 : "Ir" (nr));
260 return oldbit;
261}
262
263/* WARNING: non atomic and it can be reordered! */
264static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
265{
266 int oldbit;
267
268 asm volatile("btc %2,%1\n\t"
269 "sbb %0,%0"
270 : "=r" (oldbit), ADDR
271 : "Ir" (nr) : "memory");
272
273 return oldbit;
274}
275
276/**
277 * test_and_change_bit - Change a bit and return its old value
278 * @nr: Bit to change
279 * @addr: Address to count from
280 *
281 * This operation is atomic and cannot be reordered.
282 * It also implies a memory barrier.
283 */
284static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
285{
286 int oldbit;
287
288 asm volatile(LOCK_PREFIX "btc %2,%1\n\t"
289 "sbb %0,%0"
290 : "=r" (oldbit), ADDR : "Ir" (nr) : "memory");
291
292 return oldbit;
293}
294
295static inline int constant_test_bit(int nr, const volatile unsigned long *addr)
296{
297 return ((1UL << (nr % BITS_PER_LONG)) &
298 (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
299}
300
301static inline int variable_test_bit(int nr, volatile const unsigned long *addr)
302{
303 int oldbit;
304
305 asm volatile("bt %2,%1\n\t"
306 "sbb %0,%0"
307 : "=r" (oldbit)
308 : "m" (*(unsigned long *)addr), "Ir" (nr));
309
310 return oldbit;
311}
312
313#if 0 /* Fool kernel-doc since it doesn't do macros yet */
314/**
315 * test_bit - Determine whether a bit is set
316 * @nr: bit number to test
317 * @addr: Address to start counting from
318 */
319static int test_bit(int nr, const volatile unsigned long *addr);
320#endif
321
322#define test_bit(nr, addr) \
323 (__builtin_constant_p((nr)) \
324 ? constant_test_bit((nr), (addr)) \
325 : variable_test_bit((nr), (addr)))
326
327/**
328 * __ffs - find first set bit in word
329 * @word: The word to search
330 *
331 * Undefined if no bit exists, so code should check against 0 first.
332 */
333static inline unsigned long __ffs(unsigned long word)
334{
335 asm("bsf %1,%0"
336 : "=r" (word)
337 : "rm" (word));
338 return word;
339}
340
341/**
342 * ffz - find first zero bit in word
343 * @word: The word to search
344 *
345 * Undefined if no zero exists, so code should check against ~0UL first.
346 */
347static inline unsigned long ffz(unsigned long word)
348{
349 asm("bsf %1,%0"
350 : "=r" (word)
351 : "r" (~word));
352 return word;
353}
354
355/*
356 * __fls: find last set bit in word
357 * @word: The word to search
358 *
359 * Undefined if no set bit exists, so code should check against 0 first.
360 */
361static inline unsigned long __fls(unsigned long word)
362{
363 asm("bsr %1,%0"
364 : "=r" (word)
365 : "rm" (word));
366 return word;
367}
368
369#ifdef __KERNEL__
370/**
371 * ffs - find first set bit in word
372 * @x: the word to search
373 *
374 * This is defined the same way as the libc and compiler builtin ffs
375 * routines, therefore differs in spirit from the other bitops.
376 *
377 * ffs(value) returns 0 if value is 0 or the position of the first
378 * set bit if value is nonzero. The first (least significant) bit
379 * is at position 1.
380 */
381static inline int ffs(int x)
382{
383 int r;
384#ifdef CONFIG_X86_CMOV
385 asm("bsfl %1,%0\n\t"
386 "cmovzl %2,%0"
387 : "=r" (r) : "rm" (x), "r" (-1));
388#else
389 asm("bsfl %1,%0\n\t"
390 "jnz 1f\n\t"
391 "movl $-1,%0\n"
392 "1:" : "=r" (r) : "rm" (x));
393#endif
394 return r + 1;
395}
396
397/**
398 * fls - find last set bit in word
399 * @x: the word to search
400 *
401 * This is defined in a similar way as the libc and compiler builtin
402 * ffs, but returns the position of the most significant set bit.
403 *
404 * fls(value) returns 0 if value is 0 or the position of the last
405 * set bit if value is nonzero. The last (most significant) bit is
406 * at position 32.
407 */
408static inline int fls(int x)
409{
410 int r;
411#ifdef CONFIG_X86_CMOV
412 asm("bsrl %1,%0\n\t"
413 "cmovzl %2,%0"
414 : "=&r" (r) : "rm" (x), "rm" (-1));
415#else
416 asm("bsrl %1,%0\n\t"
417 "jnz 1f\n\t"
418 "movl $-1,%0\n"
419 "1:" : "=r" (r) : "rm" (x));
420#endif
421 return r + 1;
422}
423#endif /* __KERNEL__ */
424
425#undef ADDR
426
427static inline void set_bit_string(unsigned long *bitmap,
428 unsigned long i, int len)
429{
430 unsigned long end = i + len;
431 while (i < end) {
432 __set_bit(i, bitmap);
433 i++;
434 }
435}
436
437#ifdef __KERNEL__
438
439#include <asm-generic/bitops/sched.h>
440
441#define ARCH_HAS_FAST_MULTIPLIER 1
442
443#include <asm-generic/bitops/hweight.h>
444
445#endif /* __KERNEL__ */
446
447#include <asm-generic/bitops/fls64.h>
448
449#ifdef __KERNEL__
450
451#include <asm-generic/bitops/ext2-non-atomic.h>
452
453#define ext2_set_bit_atomic(lock, nr, addr) \
454 test_and_set_bit((nr), (unsigned long *)(addr))
455#define ext2_clear_bit_atomic(lock, nr, addr) \
456 test_and_clear_bit((nr), (unsigned long *)(addr))
457
458#include <asm-generic/bitops/minix.h>
459
460#endif /* __KERNEL__ */
461#endif /* _ASM_X86_BITOPS_H */
diff --git a/include/asm-x86/boot.h b/include/asm-x86/boot.h
deleted file mode 100644
index 2faed7ecb092..000000000000
--- a/include/asm-x86/boot.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_BOOT_H
2#define _ASM_BOOT_H
3
4/* Don't touch these, unless you really know what you're doing. */
5#define DEF_INITSEG 0x9000
6#define DEF_SYSSEG 0x1000
7#define DEF_SETUPSEG 0x9020
8#define DEF_SYSSIZE 0x7F00
9
10/* Internal svga startup constants */
11#define NORMAL_VGA 0xffff /* 80x25 mode */
12#define EXTENDED_VGA 0xfffe /* 80x50 mode */
13#define ASK_VGA 0xfffd /* ask for it at bootup */
14
15/* Physical address where kernel should be loaded. */
16#define LOAD_PHYSICAL_ADDR ((CONFIG_PHYSICAL_START \
17 + (CONFIG_PHYSICAL_ALIGN - 1)) \
18 & ~(CONFIG_PHYSICAL_ALIGN - 1))
19
20#ifdef CONFIG_X86_64
21#define BOOT_HEAP_SIZE 0x7000
22#define BOOT_STACK_SIZE 0x4000
23#else
24#define BOOT_HEAP_SIZE 0x4000
25#define BOOT_STACK_SIZE 0x1000
26#endif
27
28#endif /* _ASM_BOOT_H */
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h
deleted file mode 100644
index ae22bdf0ab14..000000000000
--- a/include/asm-x86/bootparam.h
+++ /dev/null
@@ -1,111 +0,0 @@
1#ifndef _ASM_BOOTPARAM_H
2#define _ASM_BOOTPARAM_H
3
4#include <linux/types.h>
5#include <linux/screen_info.h>
6#include <linux/apm_bios.h>
7#include <linux/edd.h>
8#include <asm/e820.h>
9#include <asm/ist.h>
10#include <video/edid.h>
11
12/* setup data types */
13#define SETUP_NONE 0
14#define SETUP_E820_EXT 1
15
16/* extensible setup data list node */
17struct setup_data {
18 __u64 next;
19 __u32 type;
20 __u32 len;
21 __u8 data[0];
22};
23
24struct setup_header {
25 __u8 setup_sects;
26 __u16 root_flags;
27 __u32 syssize;
28 __u16 ram_size;
29#define RAMDISK_IMAGE_START_MASK 0x07FF
30#define RAMDISK_PROMPT_FLAG 0x8000
31#define RAMDISK_LOAD_FLAG 0x4000
32 __u16 vid_mode;
33 __u16 root_dev;
34 __u16 boot_flag;
35 __u16 jump;
36 __u32 header;
37 __u16 version;
38 __u32 realmode_swtch;
39 __u16 start_sys;
40 __u16 kernel_version;
41 __u8 type_of_loader;
42 __u8 loadflags;
43#define LOADED_HIGH (1<<0)
44#define QUIET_FLAG (1<<5)
45#define KEEP_SEGMENTS (1<<6)
46#define CAN_USE_HEAP (1<<7)
47 __u16 setup_move_size;
48 __u32 code32_start;
49 __u32 ramdisk_image;
50 __u32 ramdisk_size;
51 __u32 bootsect_kludge;
52 __u16 heap_end_ptr;
53 __u16 _pad1;
54 __u32 cmd_line_ptr;
55 __u32 initrd_addr_max;
56 __u32 kernel_alignment;
57 __u8 relocatable_kernel;
58 __u8 _pad2[3];
59 __u32 cmdline_size;
60 __u32 hardware_subarch;
61 __u64 hardware_subarch_data;
62 __u32 payload_offset;
63 __u32 payload_length;
64 __u64 setup_data;
65} __attribute__((packed));
66
67struct sys_desc_table {
68 __u16 length;
69 __u8 table[14];
70};
71
72struct efi_info {
73 __u32 efi_loader_signature;
74 __u32 efi_systab;
75 __u32 efi_memdesc_size;
76 __u32 efi_memdesc_version;
77 __u32 efi_memmap;
78 __u32 efi_memmap_size;
79 __u32 efi_systab_hi;
80 __u32 efi_memmap_hi;
81};
82
83/* The so-called "zeropage" */
84struct boot_params {
85 struct screen_info screen_info; /* 0x000 */
86 struct apm_bios_info apm_bios_info; /* 0x040 */
87 __u8 _pad2[12]; /* 0x054 */
88 struct ist_info ist_info; /* 0x060 */
89 __u8 _pad3[16]; /* 0x070 */
90 __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
91 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
92 struct sys_desc_table sys_desc_table; /* 0x0a0 */
93 __u8 _pad4[144]; /* 0x0b0 */
94 struct edid_info edid_info; /* 0x140 */
95 struct efi_info efi_info; /* 0x1c0 */
96 __u32 alt_mem_k; /* 0x1e0 */
97 __u32 scratch; /* Scratch field! */ /* 0x1e4 */
98 __u8 e820_entries; /* 0x1e8 */
99 __u8 eddbuf_entries; /* 0x1e9 */
100 __u8 edd_mbr_sig_buf_entries; /* 0x1ea */
101 __u8 _pad6[6]; /* 0x1eb */
102 struct setup_header hdr; /* setup header */ /* 0x1f1 */
103 __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
104 __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
105 struct e820entry e820_map[E820MAX]; /* 0x2d0 */
106 __u8 _pad8[48]; /* 0xcd0 */
107 struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */
108 __u8 _pad9[276]; /* 0xeec */
109} __attribute__((packed));
110
111#endif /* _ASM_BOOTPARAM_H */
diff --git a/include/asm-x86/bug.h b/include/asm-x86/bug.h
deleted file mode 100644
index b69aa64b82a4..000000000000
--- a/include/asm-x86/bug.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _ASM_X86_BUG_H
2#define _ASM_X86_BUG_H
3
4#ifdef CONFIG_BUG
5#define HAVE_ARCH_BUG
6
7#ifdef CONFIG_DEBUG_BUGVERBOSE
8
9#ifdef CONFIG_X86_32
10# define __BUG_C0 "2:\t.long 1b, %c0\n"
11#else
12# define __BUG_C0 "2:\t.quad 1b, %c0\n"
13#endif
14
15#define BUG() \
16do { \
17 asm volatile("1:\tud2\n" \
18 ".pushsection __bug_table,\"a\"\n" \
19 __BUG_C0 \
20 "\t.word %c1, 0\n" \
21 "\t.org 2b+%c2\n" \
22 ".popsection" \
23 : : "i" (__FILE__), "i" (__LINE__), \
24 "i" (sizeof(struct bug_entry))); \
25 for (;;) ; \
26} while (0)
27
28#else
29#define BUG() \
30do { \
31 asm volatile("ud2"); \
32 for (;;) ; \
33} while (0)
34#endif
35
36#endif /* !CONFIG_BUG */
37
38#include <asm-generic/bug.h>
39#endif
diff --git a/include/asm-x86/bugs.h b/include/asm-x86/bugs.h
deleted file mode 100644
index 021cbdd5f258..000000000000
--- a/include/asm-x86/bugs.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_X86_BUGS_H
2#define _ASM_X86_BUGS_H
3
4extern void check_bugs(void);
5int ppro_with_ram_bug(void);
6
7#endif /* _ASM_X86_BUGS_H */
diff --git a/include/asm-x86/byteorder.h b/include/asm-x86/byteorder.h
deleted file mode 100644
index e02ae2d89acf..000000000000
--- a/include/asm-x86/byteorder.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef _ASM_X86_BYTEORDER_H
2#define _ASM_X86_BYTEORDER_H
3
4#include <asm/types.h>
5#include <linux/compiler.h>
6
7#ifdef __GNUC__
8
9#ifdef __i386__
10
11static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
12{
13#ifdef CONFIG_X86_BSWAP
14 asm("bswap %0" : "=r" (x) : "0" (x));
15#else
16 asm("xchgb %b0,%h0\n\t" /* swap lower bytes */
17 "rorl $16,%0\n\t" /* swap words */
18 "xchgb %b0,%h0" /* swap higher bytes */
19 : "=q" (x)
20 : "0" (x));
21#endif
22 return x;
23}
24
25static inline __attribute_const__ __u64 ___arch__swab64(__u64 val)
26{
27 union {
28 struct {
29 __u32 a;
30 __u32 b;
31 } s;
32 __u64 u;
33 } v;
34 v.u = val;
35#ifdef CONFIG_X86_BSWAP
36 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
37 : "=r" (v.s.a), "=r" (v.s.b)
38 : "0" (v.s.a), "1" (v.s.b));
39#else
40 v.s.a = ___arch__swab32(v.s.a);
41 v.s.b = ___arch__swab32(v.s.b);
42 asm("xchgl %0,%1"
43 : "=r" (v.s.a), "=r" (v.s.b)
44 : "0" (v.s.a), "1" (v.s.b));
45#endif
46 return v.u;
47}
48
49#else /* __i386__ */
50
51static inline __attribute_const__ __u64 ___arch__swab64(__u64 x)
52{
53 asm("bswapq %0"
54 : "=r" (x)
55 : "0" (x));
56 return x;
57}
58
59static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
60{
61 asm("bswapl %0"
62 : "=r" (x)
63 : "0" (x));
64 return x;
65}
66
67#endif
68
69/* Do not define swab16. Gcc is smart enough to recognize "C" version and
70 convert it into rotation or exhange. */
71
72#define __arch__swab64(x) ___arch__swab64(x)
73#define __arch__swab32(x) ___arch__swab32(x)
74
75#define __BYTEORDER_HAS_U64__
76
77#endif /* __GNUC__ */
78
79#include <linux/byteorder/little_endian.h>
80
81#endif /* _ASM_X86_BYTEORDER_H */
diff --git a/include/asm-x86/cache.h b/include/asm-x86/cache.h
deleted file mode 100644
index 1e0bac86f38f..000000000000
--- a/include/asm-x86/cache.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ARCH_X86_CACHE_H
2#define _ARCH_X86_CACHE_H
3
4/* L1 cache line size */
5#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
6#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
7
8#define __read_mostly __attribute__((__section__(".data.read_mostly")))
9
10#ifdef CONFIG_X86_VSMP
11/* vSMP Internode cacheline shift */
12#define INTERNODE_CACHE_SHIFT (12)
13#ifdef CONFIG_SMP
14#define __cacheline_aligned_in_smp \
15 __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT)))) \
16 __attribute__((__section__(".data.page_aligned")))
17#endif
18#endif
19
20#endif
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h
deleted file mode 100644
index f4c0ab50d2c2..000000000000
--- a/include/asm-x86/cacheflush.h
+++ /dev/null
@@ -1,115 +0,0 @@
1#ifndef _ASM_X86_CACHEFLUSH_H
2#define _ASM_X86_CACHEFLUSH_H
3
4/* Keep includes the same across arches. */
5#include <linux/mm.h>
6
7/* Caches aren't brain-dead on the intel. */
8#define flush_cache_all() do { } while (0)
9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) do { } while (0)
12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
13#define flush_dcache_page(page) do { } while (0)
14#define flush_dcache_mmap_lock(mapping) do { } while (0)
15#define flush_dcache_mmap_unlock(mapping) do { } while (0)
16#define flush_icache_range(start, end) do { } while (0)
17#define flush_icache_page(vma, pg) do { } while (0)
18#define flush_icache_user_range(vma, pg, adr, len) do { } while (0)
19#define flush_cache_vmap(start, end) do { } while (0)
20#define flush_cache_vunmap(start, end) do { } while (0)
21
22#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
23 memcpy((dst), (src), (len))
24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
25 memcpy((dst), (src), (len))
26
27
28/*
29 * The set_memory_* API can be used to change various attributes of a virtual
30 * address range. The attributes include:
31 * Cachability : UnCached, WriteCombining, WriteBack
32 * Executability : eXeutable, NoteXecutable
33 * Read/Write : ReadOnly, ReadWrite
34 * Presence : NotPresent
35 *
36 * Within a catagory, the attributes are mutually exclusive.
37 *
38 * The implementation of this API will take care of various aspects that
39 * are associated with changing such attributes, such as:
40 * - Flushing TLBs
41 * - Flushing CPU caches
42 * - Making sure aliases of the memory behind the mapping don't violate
43 * coherency rules as defined by the CPU in the system.
44 *
45 * What this API does not do:
46 * - Provide exclusion between various callers - including callers that
47 * operation on other mappings of the same physical page
48 * - Restore default attributes when a page is freed
49 * - Guarantee that mappings other than the requested one are
50 * in any state, other than that these do not violate rules for
51 * the CPU you have. Do not depend on any effects on other mappings,
52 * CPUs other than the one you have may have more relaxed rules.
53 * The caller is required to take care of these.
54 */
55
56int _set_memory_uc(unsigned long addr, int numpages);
57int _set_memory_wc(unsigned long addr, int numpages);
58int _set_memory_wb(unsigned long addr, int numpages);
59int set_memory_uc(unsigned long addr, int numpages);
60int set_memory_wc(unsigned long addr, int numpages);
61int set_memory_wb(unsigned long addr, int numpages);
62int set_memory_x(unsigned long addr, int numpages);
63int set_memory_nx(unsigned long addr, int numpages);
64int set_memory_ro(unsigned long addr, int numpages);
65int set_memory_rw(unsigned long addr, int numpages);
66int set_memory_np(unsigned long addr, int numpages);
67int set_memory_4k(unsigned long addr, int numpages);
68
69/*
70 * For legacy compatibility with the old APIs, a few functions
71 * are provided that work on a "struct page".
72 * These functions operate ONLY on the 1:1 kernel mapping of the
73 * memory that the struct page represents, and internally just
74 * call the set_memory_* function. See the description of the
75 * set_memory_* function for more details on conventions.
76 *
77 * These APIs should be considered *deprecated* and are likely going to
78 * be removed in the future.
79 * The reason for this is the implicit operation on the 1:1 mapping only,
80 * making this not a generally useful API.
81 *
82 * Specifically, many users of the old APIs had a virtual address,
83 * called virt_to_page() or vmalloc_to_page() on that address to
84 * get a struct page* that the old API required.
85 * To convert these cases, use set_memory_*() on the original
86 * virtual address, do not use these functions.
87 */
88
89int set_pages_uc(struct page *page, int numpages);
90int set_pages_wb(struct page *page, int numpages);
91int set_pages_x(struct page *page, int numpages);
92int set_pages_nx(struct page *page, int numpages);
93int set_pages_ro(struct page *page, int numpages);
94int set_pages_rw(struct page *page, int numpages);
95
96
97void clflush_cache_range(void *addr, unsigned int size);
98
99void cpa_init(void);
100
101#ifdef CONFIG_DEBUG_RODATA
102void mark_rodata_ro(void);
103extern const int rodata_test_data;
104#endif
105
106#ifdef CONFIG_DEBUG_RODATA_TEST
107int rodata_test(void);
108#else
109static inline int rodata_test(void)
110{
111 return 0;
112}
113#endif
114
115#endif
diff --git a/include/asm-x86/calgary.h b/include/asm-x86/calgary.h
deleted file mode 100644
index 67f60406e2d8..000000000000
--- a/include/asm-x86/calgary.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Derived from include/asm-powerpc/iommu.h
3 *
4 * Copyright IBM Corporation, 2006-2007
5 *
6 * Author: Jon Mason <jdmason@us.ibm.com>
7 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _ASM_X86_64_CALGARY_H
25#define _ASM_X86_64_CALGARY_H
26
27#include <linux/spinlock.h>
28#include <linux/device.h>
29#include <linux/dma-mapping.h>
30#include <linux/timer.h>
31#include <asm/types.h>
32
33struct iommu_table {
34 struct cal_chipset_ops *chip_ops; /* chipset specific funcs */
35 unsigned long it_base; /* mapped address of tce table */
36 unsigned long it_hint; /* Hint for next alloc */
37 unsigned long *it_map; /* A simple allocation bitmap for now */
38 void __iomem *bbar; /* Bridge BAR */
39 u64 tar_val; /* Table Address Register */
40 struct timer_list watchdog_timer;
41 spinlock_t it_lock; /* Protects it_map */
42 unsigned int it_size; /* Size of iommu table in entries */
43 unsigned char it_busno; /* Bus number this table belongs to */
44};
45
46struct cal_chipset_ops {
47 void (*handle_quirks)(struct iommu_table *tbl, struct pci_dev *dev);
48 void (*tce_cache_blast)(struct iommu_table *tbl);
49 void (*dump_error_regs)(struct iommu_table *tbl);
50};
51
52#define TCE_TABLE_SIZE_UNSPECIFIED ~0
53#define TCE_TABLE_SIZE_64K 0
54#define TCE_TABLE_SIZE_128K 1
55#define TCE_TABLE_SIZE_256K 2
56#define TCE_TABLE_SIZE_512K 3
57#define TCE_TABLE_SIZE_1M 4
58#define TCE_TABLE_SIZE_2M 5
59#define TCE_TABLE_SIZE_4M 6
60#define TCE_TABLE_SIZE_8M 7
61
62extern int use_calgary;
63
64#ifdef CONFIG_CALGARY_IOMMU
65extern int calgary_iommu_init(void);
66extern void detect_calgary(void);
67#else
68static inline int calgary_iommu_init(void) { return 1; }
69static inline void detect_calgary(void) { return; }
70#endif
71
72#endif /* _ASM_X86_64_CALGARY_H */
diff --git a/include/asm-x86/calling.h b/include/asm-x86/calling.h
deleted file mode 100644
index 2bc162e0ec6e..000000000000
--- a/include/asm-x86/calling.h
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2 * Some macros to handle stack frames in assembly.
3 */
4
5#define R15 0
6#define R14 8
7#define R13 16
8#define R12 24
9#define RBP 32
10#define RBX 40
11
12/* arguments: interrupts/non tracing syscalls only save upto here*/
13#define R11 48
14#define R10 56
15#define R9 64
16#define R8 72
17#define RAX 80
18#define RCX 88
19#define RDX 96
20#define RSI 104
21#define RDI 112
22#define ORIG_RAX 120 /* + error_code */
23/* end of arguments */
24
25/* cpu exception frame or undefined in case of fast syscall. */
26#define RIP 128
27#define CS 136
28#define EFLAGS 144
29#define RSP 152
30#define SS 160
31
32#define ARGOFFSET R11
33#define SWFRAME ORIG_RAX
34
35 .macro SAVE_ARGS addskip=0, norcx=0, nor891011=0
36 subq $9*8+\addskip, %rsp
37 CFI_ADJUST_CFA_OFFSET 9*8+\addskip
38 movq %rdi, 8*8(%rsp)
39 CFI_REL_OFFSET rdi, 8*8
40 movq %rsi, 7*8(%rsp)
41 CFI_REL_OFFSET rsi, 7*8
42 movq %rdx, 6*8(%rsp)
43 CFI_REL_OFFSET rdx, 6*8
44 .if \norcx
45 .else
46 movq %rcx, 5*8(%rsp)
47 CFI_REL_OFFSET rcx, 5*8
48 .endif
49 movq %rax, 4*8(%rsp)
50 CFI_REL_OFFSET rax, 4*8
51 .if \nor891011
52 .else
53 movq %r8, 3*8(%rsp)
54 CFI_REL_OFFSET r8, 3*8
55 movq %r9, 2*8(%rsp)
56 CFI_REL_OFFSET r9, 2*8
57 movq %r10, 1*8(%rsp)
58 CFI_REL_OFFSET r10, 1*8
59 movq %r11, (%rsp)
60 CFI_REL_OFFSET r11, 0*8
61 .endif
62 .endm
63
64#define ARG_SKIP 9*8
65
66 .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \
67 skipr8910=0, skiprdx=0
68 .if \skipr11
69 .else
70 movq (%rsp), %r11
71 CFI_RESTORE r11
72 .endif
73 .if \skipr8910
74 .else
75 movq 1*8(%rsp), %r10
76 CFI_RESTORE r10
77 movq 2*8(%rsp), %r9
78 CFI_RESTORE r9
79 movq 3*8(%rsp), %r8
80 CFI_RESTORE r8
81 .endif
82 .if \skiprax
83 .else
84 movq 4*8(%rsp), %rax
85 CFI_RESTORE rax
86 .endif
87 .if \skiprcx
88 .else
89 movq 5*8(%rsp), %rcx
90 CFI_RESTORE rcx
91 .endif
92 .if \skiprdx
93 .else
94 movq 6*8(%rsp), %rdx
95 CFI_RESTORE rdx
96 .endif
97 movq 7*8(%rsp), %rsi
98 CFI_RESTORE rsi
99 movq 8*8(%rsp), %rdi
100 CFI_RESTORE rdi
101 .if ARG_SKIP+\addskip > 0
102 addq $ARG_SKIP+\addskip, %rsp
103 CFI_ADJUST_CFA_OFFSET -(ARG_SKIP+\addskip)
104 .endif
105 .endm
106
107 .macro LOAD_ARGS offset, skiprax=0
108 movq \offset(%rsp), %r11
109 movq \offset+8(%rsp), %r10
110 movq \offset+16(%rsp), %r9
111 movq \offset+24(%rsp), %r8
112 movq \offset+40(%rsp), %rcx
113 movq \offset+48(%rsp), %rdx
114 movq \offset+56(%rsp), %rsi
115 movq \offset+64(%rsp), %rdi
116 .if \skiprax
117 .else
118 movq \offset+72(%rsp), %rax
119 .endif
120 .endm
121
122#define REST_SKIP 6*8
123
124 .macro SAVE_REST
125 subq $REST_SKIP, %rsp
126 CFI_ADJUST_CFA_OFFSET REST_SKIP
127 movq %rbx, 5*8(%rsp)
128 CFI_REL_OFFSET rbx, 5*8
129 movq %rbp, 4*8(%rsp)
130 CFI_REL_OFFSET rbp, 4*8
131 movq %r12, 3*8(%rsp)
132 CFI_REL_OFFSET r12, 3*8
133 movq %r13, 2*8(%rsp)
134 CFI_REL_OFFSET r13, 2*8
135 movq %r14, 1*8(%rsp)
136 CFI_REL_OFFSET r14, 1*8
137 movq %r15, (%rsp)
138 CFI_REL_OFFSET r15, 0*8
139 .endm
140
141 .macro RESTORE_REST
142 movq (%rsp), %r15
143 CFI_RESTORE r15
144 movq 1*8(%rsp), %r14
145 CFI_RESTORE r14
146 movq 2*8(%rsp), %r13
147 CFI_RESTORE r13
148 movq 3*8(%rsp), %r12
149 CFI_RESTORE r12
150 movq 4*8(%rsp), %rbp
151 CFI_RESTORE rbp
152 movq 5*8(%rsp), %rbx
153 CFI_RESTORE rbx
154 addq $REST_SKIP, %rsp
155 CFI_ADJUST_CFA_OFFSET -(REST_SKIP)
156 .endm
157
158 .macro SAVE_ALL
159 SAVE_ARGS
160 SAVE_REST
161 .endm
162
163 .macro RESTORE_ALL addskip=0
164 RESTORE_REST
165 RESTORE_ARGS 0, \addskip
166 .endm
167
168 .macro icebp
169 .byte 0xf1
170 .endm
diff --git a/include/asm-x86/checksum.h b/include/asm-x86/checksum.h
deleted file mode 100644
index 848850fd7d62..000000000000
--- a/include/asm-x86/checksum.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "checksum_32.h"
3#else
4# include "checksum_64.h"
5#endif
diff --git a/include/asm-x86/checksum_32.h b/include/asm-x86/checksum_32.h
deleted file mode 100644
index 52bbb0d8c4c1..000000000000
--- a/include/asm-x86/checksum_32.h
+++ /dev/null
@@ -1,189 +0,0 @@
1#ifndef _I386_CHECKSUM_H
2#define _I386_CHECKSUM_H
3
4#include <linux/in6.h>
5
6#include <asm/uaccess.h>
7
8/*
9 * computes the checksum of a memory block at buff, length len,
10 * and adds in "sum" (32-bit)
11 *
12 * returns a 32-bit number suitable for feeding into itself
13 * or csum_tcpudp_magic
14 *
15 * this function must be called with even lengths, except
16 * for the last fragment, which may be odd
17 *
18 * it's best to have buff aligned on a 32-bit boundary
19 */
20asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
21
22/*
23 * the same as csum_partial, but copies from src while it
24 * checksums, and handles user-space pointer exceptions correctly, when needed.
25 *
26 * here even more important to align src and dst on a 32-bit (or even
27 * better 64-bit) boundary
28 */
29
30asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
31 int len, __wsum sum,
32 int *src_err_ptr, int *dst_err_ptr);
33
34/*
35 * Note: when you get a NULL pointer exception here this means someone
36 * passed in an incorrect kernel address to one of these functions.
37 *
38 * If you use these functions directly please don't forget the
39 * access_ok().
40 */
41static inline __wsum csum_partial_copy_nocheck(const void *src, void *dst,
42 int len, __wsum sum)
43{
44 return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
45}
46
47static inline __wsum csum_partial_copy_from_user(const void __user *src,
48 void *dst,
49 int len, __wsum sum,
50 int *err_ptr)
51{
52 might_sleep();
53 return csum_partial_copy_generic((__force void *)src, dst,
54 len, sum, err_ptr, NULL);
55}
56
57/*
58 * This is a version of ip_compute_csum() optimized for IP headers,
59 * which always checksum on 4 octet boundaries.
60 *
61 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
62 * Arnt Gulbrandsen.
63 */
64static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
65{
66 unsigned int sum;
67
68 asm volatile("movl (%1), %0 ;\n"
69 "subl $4, %2 ;\n"
70 "jbe 2f ;\n"
71 "addl 4(%1), %0 ;\n"
72 "adcl 8(%1), %0 ;\n"
73 "adcl 12(%1), %0;\n"
74 "1: adcl 16(%1), %0 ;\n"
75 "lea 4(%1), %1 ;\n"
76 "decl %2 ;\n"
77 "jne 1b ;\n"
78 "adcl $0, %0 ;\n"
79 "movl %0, %2 ;\n"
80 "shrl $16, %0 ;\n"
81 "addw %w2, %w0 ;\n"
82 "adcl $0, %0 ;\n"
83 "notl %0 ;\n"
84 "2: ;\n"
85 /* Since the input registers which are loaded with iph and ihl
86 are modified, we must also specify them as outputs, or gcc
87 will assume they contain their original values. */
88 : "=r" (sum), "=r" (iph), "=r" (ihl)
89 : "1" (iph), "2" (ihl)
90 : "memory");
91 return (__force __sum16)sum;
92}
93
94/*
95 * Fold a partial checksum
96 */
97
98static inline __sum16 csum_fold(__wsum sum)
99{
100 asm("addl %1, %0 ;\n"
101 "adcl $0xffff, %0 ;\n"
102 : "=r" (sum)
103 : "r" ((__force u32)sum << 16),
104 "0" ((__force u32)sum & 0xffff0000));
105 return (__force __sum16)(~(__force u32)sum >> 16);
106}
107
108static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
109 unsigned short len,
110 unsigned short proto,
111 __wsum sum)
112{
113 asm("addl %1, %0 ;\n"
114 "adcl %2, %0 ;\n"
115 "adcl %3, %0 ;\n"
116 "adcl $0, %0 ;\n"
117 : "=r" (sum)
118 : "g" (daddr), "g"(saddr),
119 "g" ((len + proto) << 8), "0" (sum));
120 return sum;
121}
122
123/*
124 * computes the checksum of the TCP/UDP pseudo-header
125 * returns a 16-bit checksum, already complemented
126 */
127static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
128 unsigned short len,
129 unsigned short proto,
130 __wsum sum)
131{
132 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
133}
134
135/*
136 * this routine is used for miscellaneous IP-like checksums, mainly
137 * in icmp.c
138 */
139
140static inline __sum16 ip_compute_csum(const void *buff, int len)
141{
142 return csum_fold(csum_partial(buff, len, 0));
143}
144
145#define _HAVE_ARCH_IPV6_CSUM
146static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
147 const struct in6_addr *daddr,
148 __u32 len, unsigned short proto,
149 __wsum sum)
150{
151 asm("addl 0(%1), %0 ;\n"
152 "adcl 4(%1), %0 ;\n"
153 "adcl 8(%1), %0 ;\n"
154 "adcl 12(%1), %0 ;\n"
155 "adcl 0(%2), %0 ;\n"
156 "adcl 4(%2), %0 ;\n"
157 "adcl 8(%2), %0 ;\n"
158 "adcl 12(%2), %0 ;\n"
159 "adcl %3, %0 ;\n"
160 "adcl %4, %0 ;\n"
161 "adcl $0, %0 ;\n"
162 : "=&r" (sum)
163 : "r" (saddr), "r" (daddr),
164 "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
165
166 return csum_fold(sum);
167}
168
169/*
170 * Copy and checksum to user
171 */
172#define HAVE_CSUM_COPY_USER
173static inline __wsum csum_and_copy_to_user(const void *src,
174 void __user *dst,
175 int len, __wsum sum,
176 int *err_ptr)
177{
178 might_sleep();
179 if (access_ok(VERIFY_WRITE, dst, len))
180 return csum_partial_copy_generic(src, (__force void *)dst,
181 len, sum, NULL, err_ptr);
182
183 if (len)
184 *err_ptr = -EFAULT;
185
186 return (__force __wsum)-1; /* invalid checksum */
187}
188
189#endif
diff --git a/include/asm-x86/checksum_64.h b/include/asm-x86/checksum_64.h
deleted file mode 100644
index 8bd861cc5267..000000000000
--- a/include/asm-x86/checksum_64.h
+++ /dev/null
@@ -1,191 +0,0 @@
1#ifndef _X86_64_CHECKSUM_H
2#define _X86_64_CHECKSUM_H
3
4/*
5 * Checksums for x86-64
6 * Copyright 2002 by Andi Kleen, SuSE Labs
7 * with some code from asm-x86/checksum.h
8 */
9
10#include <linux/compiler.h>
11#include <asm/uaccess.h>
12#include <asm/byteorder.h>
13
14/**
15 * csum_fold - Fold and invert a 32bit checksum.
16 * sum: 32bit unfolded sum
17 *
18 * Fold a 32bit running checksum to 16bit and invert it. This is usually
19 * the last step before putting a checksum into a packet.
20 * Make sure not to mix with 64bit checksums.
21 */
22static inline __sum16 csum_fold(__wsum sum)
23{
24 asm(" addl %1,%0\n"
25 " adcl $0xffff,%0"
26 : "=r" (sum)
27 : "r" ((__force u32)sum << 16),
28 "0" ((__force u32)sum & 0xffff0000));
29 return (__force __sum16)(~(__force u32)sum >> 16);
30}
31
32/*
33 * This is a version of ip_compute_csum() optimized for IP headers,
34 * which always checksum on 4 octet boundaries.
35 *
36 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
37 * Arnt Gulbrandsen.
38 */
39
40/**
41 * ip_fast_csum - Compute the IPv4 header checksum efficiently.
42 * iph: ipv4 header
43 * ihl: length of header / 4
44 */
45static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
46{
47 unsigned int sum;
48
49 asm(" movl (%1), %0\n"
50 " subl $4, %2\n"
51 " jbe 2f\n"
52 " addl 4(%1), %0\n"
53 " adcl 8(%1), %0\n"
54 " adcl 12(%1), %0\n"
55 "1: adcl 16(%1), %0\n"
56 " lea 4(%1), %1\n"
57 " decl %2\n"
58 " jne 1b\n"
59 " adcl $0, %0\n"
60 " movl %0, %2\n"
61 " shrl $16, %0\n"
62 " addw %w2, %w0\n"
63 " adcl $0, %0\n"
64 " notl %0\n"
65 "2:"
66 /* Since the input registers which are loaded with iph and ihl
67 are modified, we must also specify them as outputs, or gcc
68 will assume they contain their original values. */
69 : "=r" (sum), "=r" (iph), "=r" (ihl)
70 : "1" (iph), "2" (ihl)
71 : "memory");
72 return (__force __sum16)sum;
73}
74
75/**
76 * csum_tcpup_nofold - Compute an IPv4 pseudo header checksum.
77 * @saddr: source address
78 * @daddr: destination address
79 * @len: length of packet
80 * @proto: ip protocol of packet
81 * @sum: initial sum to be added in (32bit unfolded)
82 *
83 * Returns the pseudo header checksum the input data. Result is
84 * 32bit unfolded.
85 */
86static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
88 unsigned short proto, __wsum sum)
89{
90 asm(" addl %1, %0\n"
91 " adcl %2, %0\n"
92 " adcl %3, %0\n"
93 " adcl $0, %0\n"
94 : "=r" (sum)
95 : "g" (daddr), "g" (saddr),
96 "g" ((len + proto)<<8), "0" (sum));
97 return sum;
98}
99
100
101/**
102 * csum_tcpup_magic - Compute an IPv4 pseudo header checksum.
103 * @saddr: source address
104 * @daddr: destination address
105 * @len: length of packet
106 * @proto: ip protocol of packet
107 * @sum: initial sum to be added in (32bit unfolded)
108 *
109 * Returns the 16bit pseudo header checksum the input data already
110 * complemented and ready to be filled in.
111 */
112static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
113 unsigned short len,
114 unsigned short proto, __wsum sum)
115{
116 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
117}
118
119/**
120 * csum_partial - Compute an internet checksum.
121 * @buff: buffer to be checksummed
122 * @len: length of buffer.
123 * @sum: initial sum to be added in (32bit unfolded)
124 *
125 * Returns the 32bit unfolded internet checksum of the buffer.
126 * Before filling it in it needs to be csum_fold()'ed.
127 * buff should be aligned to a 64bit boundary if possible.
128 */
129extern __wsum csum_partial(const void *buff, int len, __wsum sum);
130
131#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER 1
132#define HAVE_CSUM_COPY_USER 1
133
134
135/* Do not call this directly. Use the wrappers below */
136extern __wsum csum_partial_copy_generic(const void *src, const void *dst,
137 int len, __wsum sum,
138 int *src_err_ptr, int *dst_err_ptr);
139
140
141extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
142 int len, __wsum isum, int *errp);
143extern __wsum csum_partial_copy_to_user(const void *src, void __user *dst,
144 int len, __wsum isum, int *errp);
145extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,
146 int len, __wsum sum);
147
148/* Old names. To be removed. */
149#define csum_and_copy_to_user csum_partial_copy_to_user
150#define csum_and_copy_from_user csum_partial_copy_from_user
151
152/**
153 * ip_compute_csum - Compute an 16bit IP checksum.
154 * @buff: buffer address.
155 * @len: length of buffer.
156 *
157 * Returns the 16bit folded/inverted checksum of the passed buffer.
158 * Ready to fill in.
159 */
160extern __sum16 ip_compute_csum(const void *buff, int len);
161
162/**
163 * csum_ipv6_magic - Compute checksum of an IPv6 pseudo header.
164 * @saddr: source address
165 * @daddr: destination address
166 * @len: length of packet
167 * @proto: protocol of packet
168 * @sum: initial sum (32bit unfolded) to be added in
169 *
170 * Computes an IPv6 pseudo header checksum. This sum is added the checksum
171 * into UDP/TCP packets and contains some link layer information.
172 * Returns the unfolded 32bit checksum.
173 */
174
175struct in6_addr;
176
177#define _HAVE_ARCH_IPV6_CSUM 1
178extern __sum16
179csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
180 __u32 len, unsigned short proto, __wsum sum);
181
182static inline unsigned add32_with_carry(unsigned a, unsigned b)
183{
184 asm("addl %2,%0\n\t"
185 "adcl $0,%0"
186 : "=r" (a)
187 : "0" (a), "r" (b));
188 return a;
189}
190
191#endif
diff --git a/include/asm-x86/cmpxchg.h b/include/asm-x86/cmpxchg.h
deleted file mode 100644
index a460fa088d4c..000000000000
--- a/include/asm-x86/cmpxchg.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "cmpxchg_32.h"
3#else
4# include "cmpxchg_64.h"
5#endif
diff --git a/include/asm-x86/cmpxchg_32.h b/include/asm-x86/cmpxchg_32.h
deleted file mode 100644
index bf5a69d1329e..000000000000
--- a/include/asm-x86/cmpxchg_32.h
+++ /dev/null
@@ -1,344 +0,0 @@
1#ifndef __ASM_CMPXCHG_H
2#define __ASM_CMPXCHG_H
3
4#include <linux/bitops.h> /* for LOCK_PREFIX */
5
6/*
7 * Note: if you use set64_bit(), __cmpxchg64(), or their variants, you
8 * you need to test for the feature in boot_cpu_data.
9 */
10
11#define xchg(ptr, v) \
12 ((__typeof__(*(ptr)))__xchg((unsigned long)(v), (ptr), sizeof(*(ptr))))
13
14struct __xchg_dummy {
15 unsigned long a[100];
16};
17#define __xg(x) ((struct __xchg_dummy *)(x))
18
19/*
20 * The semantics of XCHGCMP8B are a bit strange, this is why
21 * there is a loop and the loading of %%eax and %%edx has to
22 * be inside. This inlines well in most cases, the cached
23 * cost is around ~38 cycles. (in the future we might want
24 * to do an SIMD/3DNOW!/MMX/FPU 64-bit store here, but that
25 * might have an implicit FPU-save as a cost, so it's not
26 * clear which path to go.)
27 *
28 * cmpxchg8b must be used with the lock prefix here to allow
29 * the instruction to be executed atomically, see page 3-102
30 * of the instruction set reference 24319102.pdf. We need
31 * the reader side to see the coherent 64bit value.
32 */
33static inline void __set_64bit(unsigned long long *ptr,
34 unsigned int low, unsigned int high)
35{
36 asm volatile("\n1:\t"
37 "movl (%0), %%eax\n\t"
38 "movl 4(%0), %%edx\n\t"
39 LOCK_PREFIX "cmpxchg8b (%0)\n\t"
40 "jnz 1b"
41 : /* no outputs */
42 : "D"(ptr),
43 "b"(low),
44 "c"(high)
45 : "ax", "dx", "memory");
46}
47
48static inline void __set_64bit_constant(unsigned long long *ptr,
49 unsigned long long value)
50{
51 __set_64bit(ptr, (unsigned int)value, (unsigned int)(value >> 32));
52}
53
54#define ll_low(x) *(((unsigned int *)&(x)) + 0)
55#define ll_high(x) *(((unsigned int *)&(x)) + 1)
56
57static inline void __set_64bit_var(unsigned long long *ptr,
58 unsigned long long value)
59{
60 __set_64bit(ptr, ll_low(value), ll_high(value));
61}
62
63#define set_64bit(ptr, value) \
64 (__builtin_constant_p((value)) \
65 ? __set_64bit_constant((ptr), (value)) \
66 : __set_64bit_var((ptr), (value)))
67
68#define _set_64bit(ptr, value) \
69 (__builtin_constant_p(value) \
70 ? __set_64bit(ptr, (unsigned int)(value), \
71 (unsigned int)((value) >> 32)) \
72 : __set_64bit(ptr, ll_low((value)), ll_high((value))))
73
74/*
75 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway
76 * Note 2: xchg has side effect, so that attribute volatile is necessary,
77 * but generally the primitive is invalid, *ptr is output argument. --ANK
78 */
79static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
80 int size)
81{
82 switch (size) {
83 case 1:
84 asm volatile("xchgb %b0,%1"
85 : "=q" (x)
86 : "m" (*__xg(ptr)), "0" (x)
87 : "memory");
88 break;
89 case 2:
90 asm volatile("xchgw %w0,%1"
91 : "=r" (x)
92 : "m" (*__xg(ptr)), "0" (x)
93 : "memory");
94 break;
95 case 4:
96 asm volatile("xchgl %0,%1"
97 : "=r" (x)
98 : "m" (*__xg(ptr)), "0" (x)
99 : "memory");
100 break;
101 }
102 return x;
103}
104
105/*
106 * Atomic compare and exchange. Compare OLD with MEM, if identical,
107 * store NEW in MEM. Return the initial value in MEM. Success is
108 * indicated by comparing RETURN with OLD.
109 */
110
111#ifdef CONFIG_X86_CMPXCHG
112#define __HAVE_ARCH_CMPXCHG 1
113#define cmpxchg(ptr, o, n) \
114 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
115 (unsigned long)(n), \
116 sizeof(*(ptr))))
117#define sync_cmpxchg(ptr, o, n) \
118 ((__typeof__(*(ptr)))__sync_cmpxchg((ptr), (unsigned long)(o), \
119 (unsigned long)(n), \
120 sizeof(*(ptr))))
121#define cmpxchg_local(ptr, o, n) \
122 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
123 (unsigned long)(n), \
124 sizeof(*(ptr))))
125#endif
126
127#ifdef CONFIG_X86_CMPXCHG64
128#define cmpxchg64(ptr, o, n) \
129 ((__typeof__(*(ptr)))__cmpxchg64((ptr), (unsigned long long)(o), \
130 (unsigned long long)(n)))
131#define cmpxchg64_local(ptr, o, n) \
132 ((__typeof__(*(ptr)))__cmpxchg64_local((ptr), (unsigned long long)(o), \
133 (unsigned long long)(n)))
134#endif
135
136static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
137 unsigned long new, int size)
138{
139 unsigned long prev;
140 switch (size) {
141 case 1:
142 asm volatile(LOCK_PREFIX "cmpxchgb %b1,%2"
143 : "=a"(prev)
144 : "q"(new), "m"(*__xg(ptr)), "0"(old)
145 : "memory");
146 return prev;
147 case 2:
148 asm volatile(LOCK_PREFIX "cmpxchgw %w1,%2"
149 : "=a"(prev)
150 : "r"(new), "m"(*__xg(ptr)), "0"(old)
151 : "memory");
152 return prev;
153 case 4:
154 asm volatile(LOCK_PREFIX "cmpxchgl %1,%2"
155 : "=a"(prev)
156 : "r"(new), "m"(*__xg(ptr)), "0"(old)
157 : "memory");
158 return prev;
159 }
160 return old;
161}
162
163/*
164 * Always use locked operations when touching memory shared with a
165 * hypervisor, since the system may be SMP even if the guest kernel
166 * isn't.
167 */
168static inline unsigned long __sync_cmpxchg(volatile void *ptr,
169 unsigned long old,
170 unsigned long new, int size)
171{
172 unsigned long prev;
173 switch (size) {
174 case 1:
175 asm volatile("lock; cmpxchgb %b1,%2"
176 : "=a"(prev)
177 : "q"(new), "m"(*__xg(ptr)), "0"(old)
178 : "memory");
179 return prev;
180 case 2:
181 asm volatile("lock; cmpxchgw %w1,%2"
182 : "=a"(prev)
183 : "r"(new), "m"(*__xg(ptr)), "0"(old)
184 : "memory");
185 return prev;
186 case 4:
187 asm volatile("lock; cmpxchgl %1,%2"
188 : "=a"(prev)
189 : "r"(new), "m"(*__xg(ptr)), "0"(old)
190 : "memory");
191 return prev;
192 }
193 return old;
194}
195
196static inline unsigned long __cmpxchg_local(volatile void *ptr,
197 unsigned long old,
198 unsigned long new, int size)
199{
200 unsigned long prev;
201 switch (size) {
202 case 1:
203 asm volatile("cmpxchgb %b1,%2"
204 : "=a"(prev)
205 : "q"(new), "m"(*__xg(ptr)), "0"(old)
206 : "memory");
207 return prev;
208 case 2:
209 asm volatile("cmpxchgw %w1,%2"
210 : "=a"(prev)
211 : "r"(new), "m"(*__xg(ptr)), "0"(old)
212 : "memory");
213 return prev;
214 case 4:
215 asm volatile("cmpxchgl %1,%2"
216 : "=a"(prev)
217 : "r"(new), "m"(*__xg(ptr)), "0"(old)
218 : "memory");
219 return prev;
220 }
221 return old;
222}
223
224static inline unsigned long long __cmpxchg64(volatile void *ptr,
225 unsigned long long old,
226 unsigned long long new)
227{
228 unsigned long long prev;
229 asm volatile(LOCK_PREFIX "cmpxchg8b %3"
230 : "=A"(prev)
231 : "b"((unsigned long)new),
232 "c"((unsigned long)(new >> 32)),
233 "m"(*__xg(ptr)),
234 "0"(old)
235 : "memory");
236 return prev;
237}
238
239static inline unsigned long long __cmpxchg64_local(volatile void *ptr,
240 unsigned long long old,
241 unsigned long long new)
242{
243 unsigned long long prev;
244 asm volatile("cmpxchg8b %3"
245 : "=A"(prev)
246 : "b"((unsigned long)new),
247 "c"((unsigned long)(new >> 32)),
248 "m"(*__xg(ptr)),
249 "0"(old)
250 : "memory");
251 return prev;
252}
253
254#ifndef CONFIG_X86_CMPXCHG
255/*
256 * Building a kernel capable running on 80386. It may be necessary to
257 * simulate the cmpxchg on the 80386 CPU. For that purpose we define
258 * a function for each of the sizes we support.
259 */
260
261extern unsigned long cmpxchg_386_u8(volatile void *, u8, u8);
262extern unsigned long cmpxchg_386_u16(volatile void *, u16, u16);
263extern unsigned long cmpxchg_386_u32(volatile void *, u32, u32);
264
265static inline unsigned long cmpxchg_386(volatile void *ptr, unsigned long old,
266 unsigned long new, int size)
267{
268 switch (size) {
269 case 1:
270 return cmpxchg_386_u8(ptr, old, new);
271 case 2:
272 return cmpxchg_386_u16(ptr, old, new);
273 case 4:
274 return cmpxchg_386_u32(ptr, old, new);
275 }
276 return old;
277}
278
279#define cmpxchg(ptr, o, n) \
280({ \
281 __typeof__(*(ptr)) __ret; \
282 if (likely(boot_cpu_data.x86 > 3)) \
283 __ret = (__typeof__(*(ptr)))__cmpxchg((ptr), \
284 (unsigned long)(o), (unsigned long)(n), \
285 sizeof(*(ptr))); \
286 else \
287 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
288 (unsigned long)(o), (unsigned long)(n), \
289 sizeof(*(ptr))); \
290 __ret; \
291})
292#define cmpxchg_local(ptr, o, n) \
293({ \
294 __typeof__(*(ptr)) __ret; \
295 if (likely(boot_cpu_data.x86 > 3)) \
296 __ret = (__typeof__(*(ptr)))__cmpxchg_local((ptr), \
297 (unsigned long)(o), (unsigned long)(n), \
298 sizeof(*(ptr))); \
299 else \
300 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
301 (unsigned long)(o), (unsigned long)(n), \
302 sizeof(*(ptr))); \
303 __ret; \
304})
305#endif
306
307#ifndef CONFIG_X86_CMPXCHG64
308/*
309 * Building a kernel capable running on 80386 and 80486. It may be necessary
310 * to simulate the cmpxchg8b on the 80386 and 80486 CPU.
311 */
312
313extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
314
315#define cmpxchg64(ptr, o, n) \
316({ \
317 __typeof__(*(ptr)) __ret; \
318 if (likely(boot_cpu_data.x86 > 4)) \
319 __ret = (__typeof__(*(ptr)))__cmpxchg64((ptr), \
320 (unsigned long long)(o), \
321 (unsigned long long)(n)); \
322 else \
323 __ret = (__typeof__(*(ptr)))cmpxchg_486_u64((ptr), \
324 (unsigned long long)(o), \
325 (unsigned long long)(n)); \
326 __ret; \
327})
328#define cmpxchg64_local(ptr, o, n) \
329({ \
330 __typeof__(*(ptr)) __ret; \
331 if (likely(boot_cpu_data.x86 > 4)) \
332 __ret = (__typeof__(*(ptr)))__cmpxchg64_local((ptr), \
333 (unsigned long long)(o), \
334 (unsigned long long)(n)); \
335 else \
336 __ret = (__typeof__(*(ptr)))cmpxchg_486_u64((ptr), \
337 (unsigned long long)(o), \
338 (unsigned long long)(n)); \
339 __ret; \
340})
341
342#endif
343
344#endif
diff --git a/include/asm-x86/cmpxchg_64.h b/include/asm-x86/cmpxchg_64.h
deleted file mode 100644
index 17463ccf8166..000000000000
--- a/include/asm-x86/cmpxchg_64.h
+++ /dev/null
@@ -1,185 +0,0 @@
1#ifndef __ASM_CMPXCHG_H
2#define __ASM_CMPXCHG_H
3
4#include <asm/alternative.h> /* Provides LOCK_PREFIX */
5
6#define xchg(ptr, v) ((__typeof__(*(ptr)))__xchg((unsigned long)(v), \
7 (ptr), sizeof(*(ptr))))
8
9#define __xg(x) ((volatile long *)(x))
10
11static inline void set_64bit(volatile unsigned long *ptr, unsigned long val)
12{
13 *ptr = val;
14}
15
16#define _set_64bit set_64bit
17
18/*
19 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway
20 * Note 2: xchg has side effect, so that attribute volatile is necessary,
21 * but generally the primitive is invalid, *ptr is output argument. --ANK
22 */
23static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
24 int size)
25{
26 switch (size) {
27 case 1:
28 asm volatile("xchgb %b0,%1"
29 : "=q" (x)
30 : "m" (*__xg(ptr)), "0" (x)
31 : "memory");
32 break;
33 case 2:
34 asm volatile("xchgw %w0,%1"
35 : "=r" (x)
36 : "m" (*__xg(ptr)), "0" (x)
37 : "memory");
38 break;
39 case 4:
40 asm volatile("xchgl %k0,%1"
41 : "=r" (x)
42 : "m" (*__xg(ptr)), "0" (x)
43 : "memory");
44 break;
45 case 8:
46 asm volatile("xchgq %0,%1"
47 : "=r" (x)
48 : "m" (*__xg(ptr)), "0" (x)
49 : "memory");
50 break;
51 }
52 return x;
53}
54
55/*
56 * Atomic compare and exchange. Compare OLD with MEM, if identical,
57 * store NEW in MEM. Return the initial value in MEM. Success is
58 * indicated by comparing RETURN with OLD.
59 */
60
61#define __HAVE_ARCH_CMPXCHG 1
62
63static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
64 unsigned long new, int size)
65{
66 unsigned long prev;
67 switch (size) {
68 case 1:
69 asm volatile(LOCK_PREFIX "cmpxchgb %b1,%2"
70 : "=a"(prev)
71 : "q"(new), "m"(*__xg(ptr)), "0"(old)
72 : "memory");
73 return prev;
74 case 2:
75 asm volatile(LOCK_PREFIX "cmpxchgw %w1,%2"
76 : "=a"(prev)
77 : "r"(new), "m"(*__xg(ptr)), "0"(old)
78 : "memory");
79 return prev;
80 case 4:
81 asm volatile(LOCK_PREFIX "cmpxchgl %k1,%2"
82 : "=a"(prev)
83 : "r"(new), "m"(*__xg(ptr)), "0"(old)
84 : "memory");
85 return prev;
86 case 8:
87 asm volatile(LOCK_PREFIX "cmpxchgq %1,%2"
88 : "=a"(prev)
89 : "r"(new), "m"(*__xg(ptr)), "0"(old)
90 : "memory");
91 return prev;
92 }
93 return old;
94}
95
96/*
97 * Always use locked operations when touching memory shared with a
98 * hypervisor, since the system may be SMP even if the guest kernel
99 * isn't.
100 */
101static inline unsigned long __sync_cmpxchg(volatile void *ptr,
102 unsigned long old,
103 unsigned long new, int size)
104{
105 unsigned long prev;
106 switch (size) {
107 case 1:
108 asm volatile("lock; cmpxchgb %b1,%2"
109 : "=a"(prev)
110 : "q"(new), "m"(*__xg(ptr)), "0"(old)
111 : "memory");
112 return prev;
113 case 2:
114 asm volatile("lock; cmpxchgw %w1,%2"
115 : "=a"(prev)
116 : "r"(new), "m"(*__xg(ptr)), "0"(old)
117 : "memory");
118 return prev;
119 case 4:
120 asm volatile("lock; cmpxchgl %1,%2"
121 : "=a"(prev)
122 : "r"(new), "m"(*__xg(ptr)), "0"(old)
123 : "memory");
124 return prev;
125 }
126 return old;
127}
128
129static inline unsigned long __cmpxchg_local(volatile void *ptr,
130 unsigned long old,
131 unsigned long new, int size)
132{
133 unsigned long prev;
134 switch (size) {
135 case 1:
136 asm volatile("cmpxchgb %b1,%2"
137 : "=a"(prev)
138 : "q"(new), "m"(*__xg(ptr)), "0"(old)
139 : "memory");
140 return prev;
141 case 2:
142 asm volatile("cmpxchgw %w1,%2"
143 : "=a"(prev)
144 : "r"(new), "m"(*__xg(ptr)), "0"(old)
145 : "memory");
146 return prev;
147 case 4:
148 asm volatile("cmpxchgl %k1,%2"
149 : "=a"(prev)
150 : "r"(new), "m"(*__xg(ptr)), "0"(old)
151 : "memory");
152 return prev;
153 case 8:
154 asm volatile("cmpxchgq %1,%2"
155 : "=a"(prev)
156 : "r"(new), "m"(*__xg(ptr)), "0"(old)
157 : "memory");
158 return prev;
159 }
160 return old;
161}
162
163#define cmpxchg(ptr, o, n) \
164 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
165 (unsigned long)(n), sizeof(*(ptr))))
166#define cmpxchg64(ptr, o, n) \
167({ \
168 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
169 cmpxchg((ptr), (o), (n)); \
170})
171#define cmpxchg_local(ptr, o, n) \
172 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
173 (unsigned long)(n), \
174 sizeof(*(ptr))))
175#define sync_cmpxchg(ptr, o, n) \
176 ((__typeof__(*(ptr)))__sync_cmpxchg((ptr), (unsigned long)(o), \
177 (unsigned long)(n), \
178 sizeof(*(ptr))))
179#define cmpxchg64_local(ptr, o, n) \
180({ \
181 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
182 cmpxchg_local((ptr), (o), (n)); \
183})
184
185#endif
diff --git a/include/asm-x86/compat.h b/include/asm-x86/compat.h
deleted file mode 100644
index 1793ac317a30..000000000000
--- a/include/asm-x86/compat.h
+++ /dev/null
@@ -1,218 +0,0 @@
1#ifndef _ASM_X86_64_COMPAT_H
2#define _ASM_X86_64_COMPAT_H
3
4/*
5 * Architecture specific compatibility types
6 */
7#include <linux/types.h>
8#include <linux/sched.h>
9#include <asm/user32.h>
10
11#define COMPAT_USER_HZ 100
12
13typedef u32 compat_size_t;
14typedef s32 compat_ssize_t;
15typedef s32 compat_time_t;
16typedef s32 compat_clock_t;
17typedef s32 compat_pid_t;
18typedef u16 __compat_uid_t;
19typedef u16 __compat_gid_t;
20typedef u32 __compat_uid32_t;
21typedef u32 __compat_gid32_t;
22typedef u16 compat_mode_t;
23typedef u32 compat_ino_t;
24typedef u16 compat_dev_t;
25typedef s32 compat_off_t;
26typedef s64 compat_loff_t;
27typedef u16 compat_nlink_t;
28typedef u16 compat_ipc_pid_t;
29typedef s32 compat_daddr_t;
30typedef u32 compat_caddr_t;
31typedef __kernel_fsid_t compat_fsid_t;
32typedef s32 compat_timer_t;
33typedef s32 compat_key_t;
34
35typedef s32 compat_int_t;
36typedef s32 compat_long_t;
37typedef s64 __attribute__((aligned(4))) compat_s64;
38typedef u32 compat_uint_t;
39typedef u32 compat_ulong_t;
40typedef u64 __attribute__((aligned(4))) compat_u64;
41
42struct compat_timespec {
43 compat_time_t tv_sec;
44 s32 tv_nsec;
45};
46
47struct compat_timeval {
48 compat_time_t tv_sec;
49 s32 tv_usec;
50};
51
52struct compat_stat {
53 compat_dev_t st_dev;
54 u16 __pad1;
55 compat_ino_t st_ino;
56 compat_mode_t st_mode;
57 compat_nlink_t st_nlink;
58 __compat_uid_t st_uid;
59 __compat_gid_t st_gid;
60 compat_dev_t st_rdev;
61 u16 __pad2;
62 u32 st_size;
63 u32 st_blksize;
64 u32 st_blocks;
65 u32 st_atime;
66 u32 st_atime_nsec;
67 u32 st_mtime;
68 u32 st_mtime_nsec;
69 u32 st_ctime;
70 u32 st_ctime_nsec;
71 u32 __unused4;
72 u32 __unused5;
73};
74
75struct compat_flock {
76 short l_type;
77 short l_whence;
78 compat_off_t l_start;
79 compat_off_t l_len;
80 compat_pid_t l_pid;
81};
82
83#define F_GETLK64 12 /* using 'struct flock64' */
84#define F_SETLK64 13
85#define F_SETLKW64 14
86
87/*
88 * IA32 uses 4 byte alignment for 64 bit quantities,
89 * so we need to pack this structure.
90 */
91struct compat_flock64 {
92 short l_type;
93 short l_whence;
94 compat_loff_t l_start;
95 compat_loff_t l_len;
96 compat_pid_t l_pid;
97} __attribute__((packed));
98
99struct compat_statfs {
100 int f_type;
101 int f_bsize;
102 int f_blocks;
103 int f_bfree;
104 int f_bavail;
105 int f_files;
106 int f_ffree;
107 compat_fsid_t f_fsid;
108 int f_namelen; /* SunOS ignores this field. */
109 int f_frsize;
110 int f_spare[5];
111};
112
113#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
114#define COMPAT_RLIM_INFINITY 0xffffffff
115
116typedef u32 compat_old_sigset_t; /* at least 32 bits */
117
118#define _COMPAT_NSIG 64
119#define _COMPAT_NSIG_BPW 32
120
121typedef u32 compat_sigset_word;
122
123#define COMPAT_OFF_T_MAX 0x7fffffff
124#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
125
126struct compat_ipc64_perm {
127 compat_key_t key;
128 __compat_uid32_t uid;
129 __compat_gid32_t gid;
130 __compat_uid32_t cuid;
131 __compat_gid32_t cgid;
132 unsigned short mode;
133 unsigned short __pad1;
134 unsigned short seq;
135 unsigned short __pad2;
136 compat_ulong_t unused1;
137 compat_ulong_t unused2;
138};
139
140struct compat_semid64_ds {
141 struct compat_ipc64_perm sem_perm;
142 compat_time_t sem_otime;
143 compat_ulong_t __unused1;
144 compat_time_t sem_ctime;
145 compat_ulong_t __unused2;
146 compat_ulong_t sem_nsems;
147 compat_ulong_t __unused3;
148 compat_ulong_t __unused4;
149};
150
151struct compat_msqid64_ds {
152 struct compat_ipc64_perm msg_perm;
153 compat_time_t msg_stime;
154 compat_ulong_t __unused1;
155 compat_time_t msg_rtime;
156 compat_ulong_t __unused2;
157 compat_time_t msg_ctime;
158 compat_ulong_t __unused3;
159 compat_ulong_t msg_cbytes;
160 compat_ulong_t msg_qnum;
161 compat_ulong_t msg_qbytes;
162 compat_pid_t msg_lspid;
163 compat_pid_t msg_lrpid;
164 compat_ulong_t __unused4;
165 compat_ulong_t __unused5;
166};
167
168struct compat_shmid64_ds {
169 struct compat_ipc64_perm shm_perm;
170 compat_size_t shm_segsz;
171 compat_time_t shm_atime;
172 compat_ulong_t __unused1;
173 compat_time_t shm_dtime;
174 compat_ulong_t __unused2;
175 compat_time_t shm_ctime;
176 compat_ulong_t __unused3;
177 compat_pid_t shm_cpid;
178 compat_pid_t shm_lpid;
179 compat_ulong_t shm_nattch;
180 compat_ulong_t __unused4;
181 compat_ulong_t __unused5;
182};
183
184/*
185 * The type of struct elf_prstatus.pr_reg in compatible core dumps.
186 */
187typedef struct user_regs_struct32 compat_elf_gregset_t;
188
189/*
190 * A pointer passed in from user mode. This should not
191 * be used for syscall parameters, just declare them
192 * as pointers because the syscall entry code will have
193 * appropriately converted them already.
194 */
195typedef u32 compat_uptr_t;
196
197static inline void __user *compat_ptr(compat_uptr_t uptr)
198{
199 return (void __user *)(unsigned long)uptr;
200}
201
202static inline compat_uptr_t ptr_to_compat(void __user *uptr)
203{
204 return (u32)(unsigned long)uptr;
205}
206
207static inline void __user *compat_alloc_user_space(long len)
208{
209 struct pt_regs *regs = task_pt_regs(current);
210 return (void __user *)regs->sp - len;
211}
212
213static inline int is_compat_task(void)
214{
215 return current_thread_info()->status & TS_COMPAT;
216}
217
218#endif /* _ASM_X86_64_COMPAT_H */
diff --git a/include/asm-x86/cpu.h b/include/asm-x86/cpu.h
deleted file mode 100644
index 73f2ea84fd74..000000000000
--- a/include/asm-x86/cpu.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_I386_CPU_H_
2#define _ASM_I386_CPU_H_
3
4#include <linux/device.h>
5#include <linux/cpu.h>
6#include <linux/topology.h>
7#include <linux/nodemask.h>
8#include <linux/percpu.h>
9
10struct x86_cpu {
11 struct cpu cpu;
12};
13
14#ifdef CONFIG_HOTPLUG_CPU
15extern int arch_register_cpu(int num);
16extern void arch_unregister_cpu(int);
17#endif
18
19DECLARE_PER_CPU(int, cpu_state);
20#endif /* _ASM_I386_CPU_H_ */
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
deleted file mode 100644
index cfcfb0a806ba..000000000000
--- a/include/asm-x86/cpufeature.h
+++ /dev/null
@@ -1,227 +0,0 @@
1/*
2 * Defines x86 CPU feature bits
3 */
4#ifndef _ASM_X86_CPUFEATURE_H
5#define _ASM_X86_CPUFEATURE_H
6
7#include <asm/required-features.h>
8
9#define NCAPINTS 8 /* N 32-bit words worth of info */
10
11/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */
12#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */
13#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */
14#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */
15#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */
16#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */
17#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */
18#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */
19#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */
20#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */
21#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */
22#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */
23#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */
24#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */
25#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */
26#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
27#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */
28#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
29#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
30#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */
31#define X86_FEATURE_DS (0*32+21) /* Debug Store */
32#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
33#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
34#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */
35 /* of FPU context), and CR4.OSFXSR available */
36#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
37#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
38#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */
39#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */
40#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */
41#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */
42
43/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */
44/* Don't duplicate feature flags which are redundant with Intel! */
45#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */
46#define X86_FEATURE_MP (1*32+19) /* MP Capable. */
47#define X86_FEATURE_NX (1*32+20) /* Execute Disable */
48#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
49#define X86_FEATURE_GBPAGES (1*32+26) /* GB pages */
50#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */
51#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */
52#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */
53#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */
54
55/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */
56#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */
57#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */
58#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */
59
60/* Other features, Linux-defined mapping, word 3 */
61/* This range is used for feature bits which conflict or are synthesized */
62#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */
63#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
64#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
65#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
66/* cpu types for specific tunings: */
67#define X86_FEATURE_K8 (3*32+ 4) /* Opteron, Athlon64 */
68#define X86_FEATURE_K7 (3*32+ 5) /* Athlon */
69#define X86_FEATURE_P3 (3*32+ 6) /* P3 */
70#define X86_FEATURE_P4 (3*32+ 7) /* P4 */
71#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
72#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
73#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* FXSAVE leaks FOP/FIP/FOP */
74#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
75#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
76#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
77#define X86_FEATURE_SYSCALL32 (3*32+14) /* syscall in ia32 userspace */
78#define X86_FEATURE_SYSENTER32 (3*32+15) /* sysenter in ia32 userspace */
79#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
80#define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */
81#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
82#define X86_FEATURE_11AP (3*32+19) /* Bad local APIC aka 11AP */
83#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
84#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */
85
86/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
87#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
88#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */
89#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */
90#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */
91#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */
92#define X86_FEATURE_CID (4*32+10) /* Context ID */
93#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
94#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
95#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */
96#define X86_FEATURE_XMM4_2 (4*32+20) /* Streaming SIMD Extensions-4.2 */
97
98/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
99#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */
100#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */
101#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */
102#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */
103#define X86_FEATURE_ACE2 (5*32+ 8) /* Advanced Cryptography Engine v2 */
104#define X86_FEATURE_ACE2_EN (5*32+ 9) /* ACE v2 enabled */
105#define X86_FEATURE_PHE (5*32+ 10) /* PadLock Hash Engine */
106#define X86_FEATURE_PHE_EN (5*32+ 11) /* PHE enabled */
107#define X86_FEATURE_PMM (5*32+ 12) /* PadLock Montgomery Multiplier */
108#define X86_FEATURE_PMM_EN (5*32+ 13) /* PMM enabled */
109
110/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */
111#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */
112#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */
113#define X86_FEATURE_IBS (6*32+ 10) /* Instruction Based Sampling */
114
115/*
116 * Auxiliary flags: Linux defined - For features scattered in various
117 * CPUID levels like 0x6, 0xA etc
118 */
119#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
120
121#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
122
123#include <linux/bitops.h>
124
125extern const char * const x86_cap_flags[NCAPINTS*32];
126extern const char * const x86_power_flags[32];
127
128#define test_cpu_cap(c, bit) \
129 test_bit(bit, (unsigned long *)((c)->x86_capability))
130
131#define cpu_has(c, bit) \
132 (__builtin_constant_p(bit) && \
133 ( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
134 (((bit)>>5)==1 && (1UL<<((bit)&31) & REQUIRED_MASK1)) || \
135 (((bit)>>5)==2 && (1UL<<((bit)&31) & REQUIRED_MASK2)) || \
136 (((bit)>>5)==3 && (1UL<<((bit)&31) & REQUIRED_MASK3)) || \
137 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
138 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
139 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
140 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
141 ? 1 : \
142 test_cpu_cap(c, bit))
143
144#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)
145
146#define set_cpu_cap(c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability))
147#define clear_cpu_cap(c, bit) clear_bit(bit, (unsigned long *)((c)->x86_capability))
148#define setup_clear_cpu_cap(bit) do { \
149 clear_cpu_cap(&boot_cpu_data, bit); \
150 set_bit(bit, (unsigned long *)cleared_cpu_caps); \
151} while (0)
152#define setup_force_cpu_cap(bit) do { \
153 set_cpu_cap(&boot_cpu_data, bit); \
154 clear_bit(bit, (unsigned long *)cleared_cpu_caps); \
155} while (0)
156
157#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
158#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)
159#define cpu_has_de boot_cpu_has(X86_FEATURE_DE)
160#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE)
161#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)
162#define cpu_has_pae boot_cpu_has(X86_FEATURE_PAE)
163#define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE)
164#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
165#define cpu_has_sep boot_cpu_has(X86_FEATURE_SEP)
166#define cpu_has_mtrr boot_cpu_has(X86_FEATURE_MTRR)
167#define cpu_has_mmx boot_cpu_has(X86_FEATURE_MMX)
168#define cpu_has_fxsr boot_cpu_has(X86_FEATURE_FXSR)
169#define cpu_has_xmm boot_cpu_has(X86_FEATURE_XMM)
170#define cpu_has_xmm2 boot_cpu_has(X86_FEATURE_XMM2)
171#define cpu_has_xmm3 boot_cpu_has(X86_FEATURE_XMM3)
172#define cpu_has_ht boot_cpu_has(X86_FEATURE_HT)
173#define cpu_has_mp boot_cpu_has(X86_FEATURE_MP)
174#define cpu_has_nx boot_cpu_has(X86_FEATURE_NX)
175#define cpu_has_k6_mtrr boot_cpu_has(X86_FEATURE_K6_MTRR)
176#define cpu_has_cyrix_arr boot_cpu_has(X86_FEATURE_CYRIX_ARR)
177#define cpu_has_centaur_mcr boot_cpu_has(X86_FEATURE_CENTAUR_MCR)
178#define cpu_has_xstore boot_cpu_has(X86_FEATURE_XSTORE)
179#define cpu_has_xstore_enabled boot_cpu_has(X86_FEATURE_XSTORE_EN)
180#define cpu_has_xcrypt boot_cpu_has(X86_FEATURE_XCRYPT)
181#define cpu_has_xcrypt_enabled boot_cpu_has(X86_FEATURE_XCRYPT_EN)
182#define cpu_has_ace2 boot_cpu_has(X86_FEATURE_ACE2)
183#define cpu_has_ace2_enabled boot_cpu_has(X86_FEATURE_ACE2_EN)
184#define cpu_has_phe boot_cpu_has(X86_FEATURE_PHE)
185#define cpu_has_phe_enabled boot_cpu_has(X86_FEATURE_PHE_EN)
186#define cpu_has_pmm boot_cpu_has(X86_FEATURE_PMM)
187#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN)
188#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
189#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
190#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
191#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
192#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
193#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
194#define cpu_has_pat boot_cpu_has(X86_FEATURE_PAT)
195#define cpu_has_xmm4_2 boot_cpu_has(X86_FEATURE_XMM4_2)
196
197#if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64)
198# define cpu_has_invlpg 1
199#else
200# define cpu_has_invlpg (boot_cpu_data.x86 > 3)
201#endif
202
203#ifdef CONFIG_X86_64
204
205#undef cpu_has_vme
206#define cpu_has_vme 0
207
208#undef cpu_has_pae
209#define cpu_has_pae ___BUG___
210
211#undef cpu_has_mp
212#define cpu_has_mp 1
213
214#undef cpu_has_k6_mtrr
215#define cpu_has_k6_mtrr 0
216
217#undef cpu_has_cyrix_arr
218#define cpu_has_cyrix_arr 0
219
220#undef cpu_has_centaur_mcr
221#define cpu_has_centaur_mcr 0
222
223#endif /* CONFIG_X86_64 */
224
225#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
226
227#endif /* _ASM_X86_CPUFEATURE_H */
diff --git a/include/asm-x86/cputime.h b/include/asm-x86/cputime.h
deleted file mode 100644
index 6d68ad7e0ea3..000000000000
--- a/include/asm-x86/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/include/asm-x86/current.h b/include/asm-x86/current.h
deleted file mode 100644
index 7515c19d4988..000000000000
--- a/include/asm-x86/current.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _X86_CURRENT_H
2#define _X86_CURRENT_H
3
4#ifdef CONFIG_X86_32
5#include <linux/compiler.h>
6#include <asm/percpu.h>
7
8struct task_struct;
9
10DECLARE_PER_CPU(struct task_struct *, current_task);
11static __always_inline struct task_struct *get_current(void)
12{
13 return x86_read_percpu(current_task);
14}
15
16#else /* X86_32 */
17
18#ifndef __ASSEMBLY__
19#include <asm/pda.h>
20
21struct task_struct;
22
23static __always_inline struct task_struct *get_current(void)
24{
25 return read_pda(pcurrent);
26}
27
28#else /* __ASSEMBLY__ */
29
30#include <asm/asm-offsets.h>
31#define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg
32
33#endif /* __ASSEMBLY__ */
34
35#endif /* X86_32 */
36
37#define current get_current()
38
39#endif /* X86_CURRENT_H */
diff --git a/include/asm-x86/debugreg.h b/include/asm-x86/debugreg.h
deleted file mode 100644
index c6344d572b03..000000000000
--- a/include/asm-x86/debugreg.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef _ASM_X86_DEBUGREG_H
2#define _ASM_X86_DEBUGREG_H
3
4
5/* Indicate the register numbers for a number of the specific
6 debug registers. Registers 0-3 contain the addresses we wish to trap on */
7#define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */
8#define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */
9
10#define DR_STATUS 6 /* u_debugreg[DR_STATUS] */
11#define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */
12
13/* Define a few things for the status register. We can use this to determine
14 which debugging register was responsible for the trap. The other bits
15 are either reserved or not of interest to us. */
16
17#define DR_TRAP0 (0x1) /* db0 */
18#define DR_TRAP1 (0x2) /* db1 */
19#define DR_TRAP2 (0x4) /* db2 */
20#define DR_TRAP3 (0x8) /* db3 */
21
22#define DR_STEP (0x4000) /* single-step */
23#define DR_SWITCH (0x8000) /* task switch */
24
25/* Now define a bunch of things for manipulating the control register.
26 The top two bytes of the control register consist of 4 fields of 4
27 bits - each field corresponds to one of the four debug registers,
28 and indicates what types of access we trap on, and how large the data
29 field is that we are looking at */
30
31#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */
32#define DR_CONTROL_SIZE 4 /* 4 control bits per register */
33
34#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */
35#define DR_RW_WRITE (0x1)
36#define DR_RW_READ (0x3)
37
38#define DR_LEN_1 (0x0) /* Settings for data length to trap on */
39#define DR_LEN_2 (0x4)
40#define DR_LEN_4 (0xC)
41#define DR_LEN_8 (0x8)
42
43/* The low byte to the control register determine which registers are
44 enabled. There are 4 fields of two bits. One bit is "local", meaning
45 that the processor will reset the bit after a task switch and the other
46 is global meaning that we have to explicitly reset the bit. With linux,
47 you can use either one, since we explicitly zero the register when we enter
48 kernel mode. */
49
50#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */
51#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */
52#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */
53
54#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */
55#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */
56
57/* The second byte to the control register has a few special things.
58 We can slow the instruction pipeline for instructions coming via the
59 gdt or the ldt if we want to. I am not sure why this is an advantage */
60
61#ifdef __i386__
62#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */
63#else
64#define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */
65#endif
66
67#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */
68#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */
69
70#endif
diff --git a/include/asm-x86/delay.h b/include/asm-x86/delay.h
deleted file mode 100644
index 409a649204aa..000000000000
--- a/include/asm-x86/delay.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_X86_DELAY_H
2#define _ASM_X86_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines calling functions in arch/x86/lib/delay.c
8 */
9
10/* Undefined functions to get compile-time errors */
11extern void __bad_udelay(void);
12extern void __bad_ndelay(void);
13
14extern void __udelay(unsigned long usecs);
15extern void __ndelay(unsigned long nsecs);
16extern void __const_udelay(unsigned long xloops);
17extern void __delay(unsigned long loops);
18
19/* 0x10c7 is 2**32 / 1000000 (rounded up) */
20#define udelay(n) (__builtin_constant_p(n) ? \
21 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
22 __udelay(n))
23
24/* 0x5 is 2**32 / 1000000000 (rounded up) */
25#define ndelay(n) (__builtin_constant_p(n) ? \
26 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
27 __ndelay(n))
28
29void use_tsc_delay(void);
30
31#endif /* _ASM_X86_DELAY_H */
diff --git a/include/asm-x86/desc.h b/include/asm-x86/desc.h
deleted file mode 100644
index a44c4dc70590..000000000000
--- a/include/asm-x86/desc.h
+++ /dev/null
@@ -1,400 +0,0 @@
1#ifndef _ASM_DESC_H_
2#define _ASM_DESC_H_
3
4#ifndef __ASSEMBLY__
5#include <asm/desc_defs.h>
6#include <asm/ldt.h>
7#include <asm/mmu.h>
8#include <linux/smp.h>
9
10static inline void fill_ldt(struct desc_struct *desc,
11 const struct user_desc *info)
12{
13 desc->limit0 = info->limit & 0x0ffff;
14 desc->base0 = info->base_addr & 0x0000ffff;
15
16 desc->base1 = (info->base_addr & 0x00ff0000) >> 16;
17 desc->type = (info->read_exec_only ^ 1) << 1;
18 desc->type |= info->contents << 2;
19 desc->s = 1;
20 desc->dpl = 0x3;
21 desc->p = info->seg_not_present ^ 1;
22 desc->limit = (info->limit & 0xf0000) >> 16;
23 desc->avl = info->useable;
24 desc->d = info->seg_32bit;
25 desc->g = info->limit_in_pages;
26 desc->base2 = (info->base_addr & 0xff000000) >> 24;
27}
28
29extern struct desc_ptr idt_descr;
30extern gate_desc idt_table[];
31
32struct gdt_page {
33 struct desc_struct gdt[GDT_ENTRIES];
34} __attribute__((aligned(PAGE_SIZE)));
35DECLARE_PER_CPU(struct gdt_page, gdt_page);
36
37static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
38{
39 return per_cpu(gdt_page, cpu).gdt;
40}
41
42#ifdef CONFIG_X86_64
43
44static inline void pack_gate(gate_desc *gate, unsigned type, unsigned long func,
45 unsigned dpl, unsigned ist, unsigned seg)
46{
47 gate->offset_low = PTR_LOW(func);
48 gate->segment = __KERNEL_CS;
49 gate->ist = ist;
50 gate->p = 1;
51 gate->dpl = dpl;
52 gate->zero0 = 0;
53 gate->zero1 = 0;
54 gate->type = type;
55 gate->offset_middle = PTR_MIDDLE(func);
56 gate->offset_high = PTR_HIGH(func);
57}
58
59#else
60static inline void pack_gate(gate_desc *gate, unsigned char type,
61 unsigned long base, unsigned dpl, unsigned flags,
62 unsigned short seg)
63{
64 gate->a = (seg << 16) | (base & 0xffff);
65 gate->b = (base & 0xffff0000) |
66 (((0x80 | type | (dpl << 5)) & 0xff) << 8);
67}
68
69#endif
70
71static inline int desc_empty(const void *ptr)
72{
73 const u32 *desc = ptr;
74 return !(desc[0] | desc[1]);
75}
76
77#ifdef CONFIG_PARAVIRT
78#include <asm/paravirt.h>
79#else
80#define load_TR_desc() native_load_tr_desc()
81#define load_gdt(dtr) native_load_gdt(dtr)
82#define load_idt(dtr) native_load_idt(dtr)
83#define load_tr(tr) asm volatile("ltr %0"::"m" (tr))
84#define load_ldt(ldt) asm volatile("lldt %0"::"m" (ldt))
85
86#define store_gdt(dtr) native_store_gdt(dtr)
87#define store_idt(dtr) native_store_idt(dtr)
88#define store_tr(tr) (tr = native_store_tr())
89#define store_ldt(ldt) asm("sldt %0":"=m" (ldt))
90
91#define load_TLS(t, cpu) native_load_tls(t, cpu)
92#define set_ldt native_set_ldt
93
94#define write_ldt_entry(dt, entry, desc) \
95 native_write_ldt_entry(dt, entry, desc)
96#define write_gdt_entry(dt, entry, desc, type) \
97 native_write_gdt_entry(dt, entry, desc, type)
98#define write_idt_entry(dt, entry, g) \
99 native_write_idt_entry(dt, entry, g)
100#endif
101
102static inline void native_write_idt_entry(gate_desc *idt, int entry,
103 const gate_desc *gate)
104{
105 memcpy(&idt[entry], gate, sizeof(*gate));
106}
107
108static inline void native_write_ldt_entry(struct desc_struct *ldt, int entry,
109 const void *desc)
110{
111 memcpy(&ldt[entry], desc, 8);
112}
113
114static inline void native_write_gdt_entry(struct desc_struct *gdt, int entry,
115 const void *desc, int type)
116{
117 unsigned int size;
118 switch (type) {
119 case DESC_TSS:
120 size = sizeof(tss_desc);
121 break;
122 case DESC_LDT:
123 size = sizeof(ldt_desc);
124 break;
125 default:
126 size = sizeof(struct desc_struct);
127 break;
128 }
129 memcpy(&gdt[entry], desc, size);
130}
131
132static inline void pack_descriptor(struct desc_struct *desc, unsigned long base,
133 unsigned long limit, unsigned char type,
134 unsigned char flags)
135{
136 desc->a = ((base & 0xffff) << 16) | (limit & 0xffff);
137 desc->b = (base & 0xff000000) | ((base & 0xff0000) >> 16) |
138 (limit & 0x000f0000) | ((type & 0xff) << 8) |
139 ((flags & 0xf) << 20);
140 desc->p = 1;
141}
142
143
144static inline void set_tssldt_descriptor(void *d, unsigned long addr,
145 unsigned type, unsigned size)
146{
147#ifdef CONFIG_X86_64
148 struct ldttss_desc64 *desc = d;
149 memset(desc, 0, sizeof(*desc));
150 desc->limit0 = size & 0xFFFF;
151 desc->base0 = PTR_LOW(addr);
152 desc->base1 = PTR_MIDDLE(addr) & 0xFF;
153 desc->type = type;
154 desc->p = 1;
155 desc->limit1 = (size >> 16) & 0xF;
156 desc->base2 = (PTR_MIDDLE(addr) >> 8) & 0xFF;
157 desc->base3 = PTR_HIGH(addr);
158#else
159 pack_descriptor((struct desc_struct *)d, addr, size, 0x80 | type, 0);
160#endif
161}
162
163static inline void __set_tss_desc(unsigned cpu, unsigned int entry, void *addr)
164{
165 struct desc_struct *d = get_cpu_gdt_table(cpu);
166 tss_desc tss;
167
168 /*
169 * sizeof(unsigned long) coming from an extra "long" at the end
170 * of the iobitmap. See tss_struct definition in processor.h
171 *
172 * -1? seg base+limit should be pointing to the address of the
173 * last valid byte
174 */
175 set_tssldt_descriptor(&tss, (unsigned long)addr, DESC_TSS,
176 IO_BITMAP_OFFSET + IO_BITMAP_BYTES +
177 sizeof(unsigned long) - 1);
178 write_gdt_entry(d, entry, &tss, DESC_TSS);
179}
180
181#define set_tss_desc(cpu, addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)
182
183static inline void native_set_ldt(const void *addr, unsigned int entries)
184{
185 if (likely(entries == 0))
186 asm volatile("lldt %w0"::"q" (0));
187 else {
188 unsigned cpu = smp_processor_id();
189 ldt_desc ldt;
190
191 set_tssldt_descriptor(&ldt, (unsigned long)addr, DESC_LDT,
192 entries * LDT_ENTRY_SIZE - 1);
193 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT,
194 &ldt, DESC_LDT);
195 asm volatile("lldt %w0"::"q" (GDT_ENTRY_LDT*8));
196 }
197}
198
199static inline void native_load_tr_desc(void)
200{
201 asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8));
202}
203
204static inline void native_load_gdt(const struct desc_ptr *dtr)
205{
206 asm volatile("lgdt %0"::"m" (*dtr));
207}
208
209static inline void native_load_idt(const struct desc_ptr *dtr)
210{
211 asm volatile("lidt %0"::"m" (*dtr));
212}
213
214static inline void native_store_gdt(struct desc_ptr *dtr)
215{
216 asm volatile("sgdt %0":"=m" (*dtr));
217}
218
219static inline void native_store_idt(struct desc_ptr *dtr)
220{
221 asm volatile("sidt %0":"=m" (*dtr));
222}
223
224static inline unsigned long native_store_tr(void)
225{
226 unsigned long tr;
227 asm volatile("str %0":"=r" (tr));
228 return tr;
229}
230
231static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
232{
233 unsigned int i;
234 struct desc_struct *gdt = get_cpu_gdt_table(cpu);
235
236 for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
237 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i];
238}
239
240#define _LDT_empty(info) \
241 ((info)->base_addr == 0 && \
242 (info)->limit == 0 && \
243 (info)->contents == 0 && \
244 (info)->read_exec_only == 1 && \
245 (info)->seg_32bit == 0 && \
246 (info)->limit_in_pages == 0 && \
247 (info)->seg_not_present == 1 && \
248 (info)->useable == 0)
249
250#ifdef CONFIG_X86_64
251#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
252#else
253#define LDT_empty(info) (_LDT_empty(info))
254#endif
255
256static inline void clear_LDT(void)
257{
258 set_ldt(NULL, 0);
259}
260
261/*
262 * load one particular LDT into the current CPU
263 */
264static inline void load_LDT_nolock(mm_context_t *pc)
265{
266 set_ldt(pc->ldt, pc->size);
267}
268
269static inline void load_LDT(mm_context_t *pc)
270{
271 preempt_disable();
272 load_LDT_nolock(pc);
273 preempt_enable();
274}
275
276static inline unsigned long get_desc_base(const struct desc_struct *desc)
277{
278 return desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24);
279}
280
281static inline unsigned long get_desc_limit(const struct desc_struct *desc)
282{
283 return desc->limit0 | (desc->limit << 16);
284}
285
286static inline void _set_gate(int gate, unsigned type, void *addr,
287 unsigned dpl, unsigned ist, unsigned seg)
288{
289 gate_desc s;
290 pack_gate(&s, type, (unsigned long)addr, dpl, ist, seg);
291 /*
292 * does not need to be atomic because it is only done once at
293 * setup time
294 */
295 write_idt_entry(idt_table, gate, &s);
296}
297
298/*
299 * This needs to use 'idt_table' rather than 'idt', and
300 * thus use the _nonmapped_ version of the IDT, as the
301 * Pentium F0 0F bugfix can have resulted in the mapped
302 * IDT being write-protected.
303 */
304static inline void set_intr_gate(unsigned int n, void *addr)
305{
306 BUG_ON((unsigned)n > 0xFF);
307 _set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS);
308}
309
310#define SYS_VECTOR_FREE 0
311#define SYS_VECTOR_ALLOCED 1
312
313extern int first_system_vector;
314extern char system_vectors[];
315
316static inline void alloc_system_vector(int vector)
317{
318 if (system_vectors[vector] == SYS_VECTOR_FREE) {
319 system_vectors[vector] = SYS_VECTOR_ALLOCED;
320 if (first_system_vector > vector)
321 first_system_vector = vector;
322 } else
323 BUG();
324}
325
326static inline void alloc_intr_gate(unsigned int n, void *addr)
327{
328 alloc_system_vector(n);
329 set_intr_gate(n, addr);
330}
331
332/*
333 * This routine sets up an interrupt gate at directory privilege level 3.
334 */
335static inline void set_system_intr_gate(unsigned int n, void *addr)
336{
337 BUG_ON((unsigned)n > 0xFF);
338 _set_gate(n, GATE_INTERRUPT, addr, 0x3, 0, __KERNEL_CS);
339}
340
341static inline void set_trap_gate(unsigned int n, void *addr)
342{
343 BUG_ON((unsigned)n > 0xFF);
344 _set_gate(n, GATE_TRAP, addr, 0, 0, __KERNEL_CS);
345}
346
347static inline void set_system_gate(unsigned int n, void *addr)
348{
349 BUG_ON((unsigned)n > 0xFF);
350#ifdef CONFIG_X86_32
351 _set_gate(n, GATE_TRAP, addr, 0x3, 0, __KERNEL_CS);
352#else
353 _set_gate(n, GATE_INTERRUPT, addr, 0x3, 0, __KERNEL_CS);
354#endif
355}
356
357static inline void set_task_gate(unsigned int n, unsigned int gdt_entry)
358{
359 BUG_ON((unsigned)n > 0xFF);
360 _set_gate(n, GATE_TASK, (void *)0, 0, 0, (gdt_entry<<3));
361}
362
363static inline void set_intr_gate_ist(int n, void *addr, unsigned ist)
364{
365 BUG_ON((unsigned)n > 0xFF);
366 _set_gate(n, GATE_INTERRUPT, addr, 0, ist, __KERNEL_CS);
367}
368
369static inline void set_system_gate_ist(int n, void *addr, unsigned ist)
370{
371 BUG_ON((unsigned)n > 0xFF);
372 _set_gate(n, GATE_INTERRUPT, addr, 0x3, ist, __KERNEL_CS);
373}
374
375#else
376/*
377 * GET_DESC_BASE reads the descriptor base of the specified segment.
378 *
379 * Args:
380 * idx - descriptor index
381 * gdt - GDT pointer
382 * base - 32bit register to which the base will be written
383 * lo_w - lo word of the "base" register
384 * lo_b - lo byte of the "base" register
385 * hi_b - hi byte of the low word of the "base" register
386 *
387 * Example:
388 * GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah)
389 * Will read the base address of GDT_ENTRY_ESPFIX_SS and put it into %eax.
390 */
391#define GET_DESC_BASE(idx, gdt, base, lo_w, lo_b, hi_b) \
392 movb idx * 8 + 4(gdt), lo_b; \
393 movb idx * 8 + 7(gdt), hi_b; \
394 shll $16, base; \
395 movw idx * 8 + 2(gdt), lo_w;
396
397
398#endif /* __ASSEMBLY__ */
399
400#endif
diff --git a/include/asm-x86/desc_defs.h b/include/asm-x86/desc_defs.h
deleted file mode 100644
index f7bacf357dac..000000000000
--- a/include/asm-x86/desc_defs.h
+++ /dev/null
@@ -1,95 +0,0 @@
1/* Written 2000 by Andi Kleen */
2#ifndef __ARCH_DESC_DEFS_H
3#define __ARCH_DESC_DEFS_H
4
5/*
6 * Segment descriptor structure definitions, usable from both x86_64 and i386
7 * archs.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14/*
15 * FIXME: Acessing the desc_struct through its fields is more elegant,
16 * and should be the one valid thing to do. However, a lot of open code
17 * still touches the a and b acessors, and doing this allow us to do it
18 * incrementally. We keep the signature as a struct, rather than an union,
19 * so we can get rid of it transparently in the future -- glommer
20 */
21/* 8 byte segment descriptor */
22struct desc_struct {
23 union {
24 struct {
25 unsigned int a;
26 unsigned int b;
27 };
28 struct {
29 u16 limit0;
30 u16 base0;
31 unsigned base1: 8, type: 4, s: 1, dpl: 2, p: 1;
32 unsigned limit: 4, avl: 1, l: 1, d: 1, g: 1, base2: 8;
33 };
34 };
35} __attribute__((packed));
36
37enum {
38 GATE_INTERRUPT = 0xE,
39 GATE_TRAP = 0xF,
40 GATE_CALL = 0xC,
41 GATE_TASK = 0x5,
42};
43
44/* 16byte gate */
45struct gate_struct64 {
46 u16 offset_low;
47 u16 segment;
48 unsigned ist : 3, zero0 : 5, type : 5, dpl : 2, p : 1;
49 u16 offset_middle;
50 u32 offset_high;
51 u32 zero1;
52} __attribute__((packed));
53
54#define PTR_LOW(x) ((unsigned long long)(x) & 0xFFFF)
55#define PTR_MIDDLE(x) (((unsigned long long)(x) >> 16) & 0xFFFF)
56#define PTR_HIGH(x) ((unsigned long long)(x) >> 32)
57
58enum {
59 DESC_TSS = 0x9,
60 DESC_LDT = 0x2,
61 DESCTYPE_S = 0x10, /* !system */
62};
63
64/* LDT or TSS descriptor in the GDT. 16 bytes. */
65struct ldttss_desc64 {
66 u16 limit0;
67 u16 base0;
68 unsigned base1 : 8, type : 5, dpl : 2, p : 1;
69 unsigned limit1 : 4, zero0 : 3, g : 1, base2 : 8;
70 u32 base3;
71 u32 zero1;
72} __attribute__((packed));
73
74#ifdef CONFIG_X86_64
75typedef struct gate_struct64 gate_desc;
76typedef struct ldttss_desc64 ldt_desc;
77typedef struct ldttss_desc64 tss_desc;
78#define gate_offset(g) ((g).offset_low | ((unsigned long)(g).offset_middle << 16) | ((unsigned long)(g).offset_high << 32))
79#define gate_segment(g) ((g).segment)
80#else
81typedef struct desc_struct gate_desc;
82typedef struct desc_struct ldt_desc;
83typedef struct desc_struct tss_desc;
84#define gate_offset(g) (((g).b & 0xffff0000) | ((g).a & 0x0000ffff))
85#define gate_segment(g) ((g).a >> 16)
86#endif
87
88struct desc_ptr {
89 unsigned short size;
90 unsigned long address;
91} __attribute__((packed)) ;
92
93#endif /* !__ASSEMBLY__ */
94
95#endif
diff --git a/include/asm-x86/device.h b/include/asm-x86/device.h
deleted file mode 100644
index 3c034f48fdb0..000000000000
--- a/include/asm-x86/device.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_X86_DEVICE_H
2#define _ASM_X86_DEVICE_H
3
4struct dev_archdata {
5#ifdef CONFIG_ACPI
6 void *acpi_handle;
7#endif
8#ifdef CONFIG_X86_64
9struct dma_mapping_ops *dma_ops;
10#endif
11#ifdef CONFIG_DMAR
12 void *iommu; /* hook for IOMMU specific extension */
13#endif
14};
15
16#endif /* _ASM_X86_DEVICE_H */
diff --git a/include/asm-x86/div64.h b/include/asm-x86/div64.h
deleted file mode 100644
index 9a2d644c08ef..000000000000
--- a/include/asm-x86/div64.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _ASM_X86_DIV64_H
2#define _ASM_X86_DIV64_H
3
4#ifdef CONFIG_X86_32
5
6#include <linux/types.h>
7
8/*
9 * do_div() is NOT a C function. It wants to return
10 * two values (the quotient and the remainder), but
11 * since that doesn't work very well in C, what it
12 * does is:
13 *
14 * - modifies the 64-bit dividend _in_place_
15 * - returns the 32-bit remainder
16 *
17 * This ends up being the most efficient "calling
18 * convention" on x86.
19 */
20#define do_div(n, base) \
21({ \
22 unsigned long __upper, __low, __high, __mod, __base; \
23 __base = (base); \
24 asm("":"=a" (__low), "=d" (__high) : "A" (n)); \
25 __upper = __high; \
26 if (__high) { \
27 __upper = __high % (__base); \
28 __high = __high / (__base); \
29 } \
30 asm("divl %2":"=a" (__low), "=d" (__mod) \
31 : "rm" (__base), "0" (__low), "1" (__upper)); \
32 asm("":"=A" (n) : "a" (__low), "d" (__high)); \
33 __mod; \
34})
35
36static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
37{
38 union {
39 u64 v64;
40 u32 v32[2];
41 } d = { dividend };
42 u32 upper;
43
44 upper = d.v32[1];
45 d.v32[1] = 0;
46 if (upper >= divisor) {
47 d.v32[1] = upper / divisor;
48 upper %= divisor;
49 }
50 asm ("divl %2" : "=a" (d.v32[0]), "=d" (*remainder) :
51 "rm" (divisor), "0" (d.v32[0]), "1" (upper));
52 return d.v64;
53}
54#define div_u64_rem div_u64_rem
55
56#else
57# include <asm-generic/div64.h>
58#endif /* CONFIG_X86_32 */
59
60#endif /* _ASM_X86_DIV64_H */
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
deleted file mode 100644
index ad9cd6d49bfc..000000000000
--- a/include/asm-x86/dma-mapping.h
+++ /dev/null
@@ -1,253 +0,0 @@
1#ifndef _ASM_DMA_MAPPING_H_
2#define _ASM_DMA_MAPPING_H_
3
4/*
5 * IOMMU interface. See Documentation/DMA-mapping.txt and DMA-API.txt for
6 * documentation.
7 */
8
9#include <linux/scatterlist.h>
10#include <asm/io.h>
11#include <asm/swiotlb.h>
12
13extern dma_addr_t bad_dma_address;
14extern int iommu_merge;
15extern struct device fallback_dev;
16extern int panic_on_overflow;
17extern int force_iommu;
18
19struct dma_mapping_ops {
20 int (*mapping_error)(struct device *dev,
21 dma_addr_t dma_addr);
22 void* (*alloc_coherent)(struct device *dev, size_t size,
23 dma_addr_t *dma_handle, gfp_t gfp);
24 void (*free_coherent)(struct device *dev, size_t size,
25 void *vaddr, dma_addr_t dma_handle);
26 dma_addr_t (*map_single)(struct device *hwdev, phys_addr_t ptr,
27 size_t size, int direction);
28 /* like map_single, but doesn't check the device mask */
29 dma_addr_t (*map_simple)(struct device *hwdev, phys_addr_t ptr,
30 size_t size, int direction);
31 void (*unmap_single)(struct device *dev, dma_addr_t addr,
32 size_t size, int direction);
33 void (*sync_single_for_cpu)(struct device *hwdev,
34 dma_addr_t dma_handle, size_t size,
35 int direction);
36 void (*sync_single_for_device)(struct device *hwdev,
37 dma_addr_t dma_handle, size_t size,
38 int direction);
39 void (*sync_single_range_for_cpu)(struct device *hwdev,
40 dma_addr_t dma_handle, unsigned long offset,
41 size_t size, int direction);
42 void (*sync_single_range_for_device)(struct device *hwdev,
43 dma_addr_t dma_handle, unsigned long offset,
44 size_t size, int direction);
45 void (*sync_sg_for_cpu)(struct device *hwdev,
46 struct scatterlist *sg, int nelems,
47 int direction);
48 void (*sync_sg_for_device)(struct device *hwdev,
49 struct scatterlist *sg, int nelems,
50 int direction);
51 int (*map_sg)(struct device *hwdev, struct scatterlist *sg,
52 int nents, int direction);
53 void (*unmap_sg)(struct device *hwdev,
54 struct scatterlist *sg, int nents,
55 int direction);
56 int (*dma_supported)(struct device *hwdev, u64 mask);
57 int is_phys;
58};
59
60extern struct dma_mapping_ops *dma_ops;
61
62static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
63{
64#ifdef CONFIG_X86_32
65 return dma_ops;
66#else
67 if (unlikely(!dev) || !dev->archdata.dma_ops)
68 return dma_ops;
69 else
70 return dev->archdata.dma_ops;
71#endif
72}
73
74/* Make sure we keep the same behaviour */
75static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
76{
77#ifdef CONFIG_X86_32
78 return 0;
79#else
80 struct dma_mapping_ops *ops = get_dma_ops(dev);
81 if (ops->mapping_error)
82 return ops->mapping_error(dev, dma_addr);
83
84 return (dma_addr == bad_dma_address);
85#endif
86}
87
88#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
89#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
90
91void *dma_alloc_coherent(struct device *dev, size_t size,
92 dma_addr_t *dma_handle, gfp_t flag);
93
94void dma_free_coherent(struct device *dev, size_t size,
95 void *vaddr, dma_addr_t dma_handle);
96
97
98extern int dma_supported(struct device *hwdev, u64 mask);
99extern int dma_set_mask(struct device *dev, u64 mask);
100
101static inline dma_addr_t
102dma_map_single(struct device *hwdev, void *ptr, size_t size,
103 int direction)
104{
105 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
106
107 BUG_ON(!valid_dma_direction(direction));
108 return ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
109}
110
111static inline void
112dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size,
113 int direction)
114{
115 struct dma_mapping_ops *ops = get_dma_ops(dev);
116
117 BUG_ON(!valid_dma_direction(direction));
118 if (ops->unmap_single)
119 ops->unmap_single(dev, addr, size, direction);
120}
121
122static inline int
123dma_map_sg(struct device *hwdev, struct scatterlist *sg,
124 int nents, int direction)
125{
126 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
127
128 BUG_ON(!valid_dma_direction(direction));
129 return ops->map_sg(hwdev, sg, nents, direction);
130}
131
132static inline void
133dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
134 int direction)
135{
136 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
137
138 BUG_ON(!valid_dma_direction(direction));
139 if (ops->unmap_sg)
140 ops->unmap_sg(hwdev, sg, nents, direction);
141}
142
143static inline void
144dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
145 size_t size, int direction)
146{
147 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
148
149 BUG_ON(!valid_dma_direction(direction));
150 if (ops->sync_single_for_cpu)
151 ops->sync_single_for_cpu(hwdev, dma_handle, size, direction);
152 flush_write_buffers();
153}
154
155static inline void
156dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
157 size_t size, int direction)
158{
159 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
160
161 BUG_ON(!valid_dma_direction(direction));
162 if (ops->sync_single_for_device)
163 ops->sync_single_for_device(hwdev, dma_handle, size, direction);
164 flush_write_buffers();
165}
166
167static inline void
168dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
169 unsigned long offset, size_t size, int direction)
170{
171 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
172
173 BUG_ON(!valid_dma_direction(direction));
174 if (ops->sync_single_range_for_cpu)
175 ops->sync_single_range_for_cpu(hwdev, dma_handle, offset,
176 size, direction);
177 flush_write_buffers();
178}
179
180static inline void
181dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
182 unsigned long offset, size_t size,
183 int direction)
184{
185 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
186
187 BUG_ON(!valid_dma_direction(direction));
188 if (ops->sync_single_range_for_device)
189 ops->sync_single_range_for_device(hwdev, dma_handle,
190 offset, size, direction);
191 flush_write_buffers();
192}
193
194static inline void
195dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
196 int nelems, int direction)
197{
198 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
199
200 BUG_ON(!valid_dma_direction(direction));
201 if (ops->sync_sg_for_cpu)
202 ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
203 flush_write_buffers();
204}
205
206static inline void
207dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
208 int nelems, int direction)
209{
210 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
211
212 BUG_ON(!valid_dma_direction(direction));
213 if (ops->sync_sg_for_device)
214 ops->sync_sg_for_device(hwdev, sg, nelems, direction);
215
216 flush_write_buffers();
217}
218
219static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
220 size_t offset, size_t size,
221 int direction)
222{
223 struct dma_mapping_ops *ops = get_dma_ops(dev);
224
225 BUG_ON(!valid_dma_direction(direction));
226 return ops->map_single(dev, page_to_phys(page) + offset,
227 size, direction);
228}
229
230static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
231 size_t size, int direction)
232{
233 dma_unmap_single(dev, addr, size, direction);
234}
235
236static inline void
237dma_cache_sync(struct device *dev, void *vaddr, size_t size,
238 enum dma_data_direction dir)
239{
240 flush_write_buffers();
241}
242
243static inline int dma_get_cache_alignment(void)
244{
245 /* no easy way to get cache size on all x86, so return the
246 * maximum possible, to be safe */
247 return boot_cpu_data.x86_clflush_size;
248}
249
250#define dma_is_consistent(d, h) (1)
251
252#include <asm-generic/dma-coherent.h>
253#endif
diff --git a/include/asm-x86/dma.h b/include/asm-x86/dma.h
deleted file mode 100644
index ca1098a7e580..000000000000
--- a/include/asm-x86/dma.h
+++ /dev/null
@@ -1,318 +0,0 @@
1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen
5 * and John Boyd, Nov. 1992.
6 */
7
8#ifndef _ASM_X86_DMA_H
9#define _ASM_X86_DMA_H
10
11#include <linux/spinlock.h> /* And spinlocks */
12#include <asm/io.h> /* need byte IO */
13#include <linux/delay.h>
14
15#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
16#define dma_outb outb_p
17#else
18#define dma_outb outb
19#endif
20
21#define dma_inb inb
22
23/*
24 * NOTES about DMA transfers:
25 *
26 * controller 1: channels 0-3, byte operations, ports 00-1F
27 * controller 2: channels 4-7, word operations, ports C0-DF
28 *
29 * - ALL registers are 8 bits only, regardless of transfer size
30 * - channel 4 is not used - cascades 1 into 2.
31 * - channels 0-3 are byte - addresses/counts are for physical bytes
32 * - channels 5-7 are word - addresses/counts are for physical words
33 * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
34 * - transfer count loaded to registers is 1 less than actual count
35 * - controller 2 offsets are all even (2x offsets for controller 1)
36 * - page registers for 5-7 don't use data bit 0, represent 128K pages
37 * - page registers for 0-3 use bit 0, represent 64K pages
38 *
39 * DMA transfers are limited to the lower 16MB of _physical_ memory.
40 * Note that addresses loaded into registers must be _physical_ addresses,
41 * not logical addresses (which may differ if paging is active).
42 *
43 * Address mapping for channels 0-3:
44 *
45 * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
46 * | ... | | ... | | ... |
47 * | ... | | ... | | ... |
48 * | ... | | ... | | ... |
49 * P7 ... P0 A7 ... A0 A7 ... A0
50 * | Page | Addr MSB | Addr LSB | (DMA registers)
51 *
52 * Address mapping for channels 5-7:
53 *
54 * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
55 * | ... | \ \ ... \ \ \ ... \ \
56 * | ... | \ \ ... \ \ \ ... \ (not used)
57 * | ... | \ \ ... \ \ \ ... \
58 * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
59 * | Page | Addr MSB | Addr LSB | (DMA registers)
60 *
61 * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
62 * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
63 * the hardware level, so odd-byte transfers aren't possible).
64 *
65 * Transfer count (_not # bytes_) is limited to 64K, represented as actual
66 * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
67 * and up to 128K bytes may be transferred on channels 5-7 in one operation.
68 *
69 */
70
71#define MAX_DMA_CHANNELS 8
72
73#ifdef CONFIG_X86_32
74
75/* The maximum address that we can perform a DMA transfer to on this platform */
76#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x1000000)
77
78#else
79
80/* 16MB ISA DMA zone */
81#define MAX_DMA_PFN ((16 * 1024 * 1024) >> PAGE_SHIFT)
82
83/* 4GB broken PCI/AGP hardware bus master zone */
84#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
85
86/* Compat define for old dma zone */
87#define MAX_DMA_ADDRESS ((unsigned long)__va(MAX_DMA_PFN << PAGE_SHIFT))
88
89#endif
90
91/* 8237 DMA controllers */
92#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
93#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
94
95/* DMA controller registers */
96#define DMA1_CMD_REG 0x08 /* command register (w) */
97#define DMA1_STAT_REG 0x08 /* status register (r) */
98#define DMA1_REQ_REG 0x09 /* request register (w) */
99#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
100#define DMA1_MODE_REG 0x0B /* mode register (w) */
101#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
102#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
103#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
104#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
105#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
106
107#define DMA2_CMD_REG 0xD0 /* command register (w) */
108#define DMA2_STAT_REG 0xD0 /* status register (r) */
109#define DMA2_REQ_REG 0xD2 /* request register (w) */
110#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
111#define DMA2_MODE_REG 0xD6 /* mode register (w) */
112#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
113#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
114#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
115#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
116#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
117
118#define DMA_ADDR_0 0x00 /* DMA address registers */
119#define DMA_ADDR_1 0x02
120#define DMA_ADDR_2 0x04
121#define DMA_ADDR_3 0x06
122#define DMA_ADDR_4 0xC0
123#define DMA_ADDR_5 0xC4
124#define DMA_ADDR_6 0xC8
125#define DMA_ADDR_7 0xCC
126
127#define DMA_CNT_0 0x01 /* DMA count registers */
128#define DMA_CNT_1 0x03
129#define DMA_CNT_2 0x05
130#define DMA_CNT_3 0x07
131#define DMA_CNT_4 0xC2
132#define DMA_CNT_5 0xC6
133#define DMA_CNT_6 0xCA
134#define DMA_CNT_7 0xCE
135
136#define DMA_PAGE_0 0x87 /* DMA page registers */
137#define DMA_PAGE_1 0x83
138#define DMA_PAGE_2 0x81
139#define DMA_PAGE_3 0x82
140#define DMA_PAGE_5 0x8B
141#define DMA_PAGE_6 0x89
142#define DMA_PAGE_7 0x8A
143
144/* I/O to memory, no autoinit, increment, single mode */
145#define DMA_MODE_READ 0x44
146/* memory to I/O, no autoinit, increment, single mode */
147#define DMA_MODE_WRITE 0x48
148/* pass thru DREQ->HRQ, DACK<-HLDA only */
149#define DMA_MODE_CASCADE 0xC0
150
151#define DMA_AUTOINIT 0x10
152
153
154extern spinlock_t dma_spin_lock;
155
156static inline unsigned long claim_dma_lock(void)
157{
158 unsigned long flags;
159 spin_lock_irqsave(&dma_spin_lock, flags);
160 return flags;
161}
162
163static inline void release_dma_lock(unsigned long flags)
164{
165 spin_unlock_irqrestore(&dma_spin_lock, flags);
166}
167
168/* enable/disable a specific DMA channel */
169static inline void enable_dma(unsigned int dmanr)
170{
171 if (dmanr <= 3)
172 dma_outb(dmanr, DMA1_MASK_REG);
173 else
174 dma_outb(dmanr & 3, DMA2_MASK_REG);
175}
176
177static inline void disable_dma(unsigned int dmanr)
178{
179 if (dmanr <= 3)
180 dma_outb(dmanr | 4, DMA1_MASK_REG);
181 else
182 dma_outb((dmanr & 3) | 4, DMA2_MASK_REG);
183}
184
185/* Clear the 'DMA Pointer Flip Flop'.
186 * Write 0 for LSB/MSB, 1 for MSB/LSB access.
187 * Use this once to initialize the FF to a known state.
188 * After that, keep track of it. :-)
189 * --- In order to do that, the DMA routines below should ---
190 * --- only be used while holding the DMA lock ! ---
191 */
192static inline void clear_dma_ff(unsigned int dmanr)
193{
194 if (dmanr <= 3)
195 dma_outb(0, DMA1_CLEAR_FF_REG);
196 else
197 dma_outb(0, DMA2_CLEAR_FF_REG);
198}
199
200/* set mode (above) for a specific DMA channel */
201static inline void set_dma_mode(unsigned int dmanr, char mode)
202{
203 if (dmanr <= 3)
204 dma_outb(mode | dmanr, DMA1_MODE_REG);
205 else
206 dma_outb(mode | (dmanr & 3), DMA2_MODE_REG);
207}
208
209/* Set only the page register bits of the transfer address.
210 * This is used for successive transfers when we know the contents of
211 * the lower 16 bits of the DMA current address register, but a 64k boundary
212 * may have been crossed.
213 */
214static inline void set_dma_page(unsigned int dmanr, char pagenr)
215{
216 switch (dmanr) {
217 case 0:
218 dma_outb(pagenr, DMA_PAGE_0);
219 break;
220 case 1:
221 dma_outb(pagenr, DMA_PAGE_1);
222 break;
223 case 2:
224 dma_outb(pagenr, DMA_PAGE_2);
225 break;
226 case 3:
227 dma_outb(pagenr, DMA_PAGE_3);
228 break;
229 case 5:
230 dma_outb(pagenr & 0xfe, DMA_PAGE_5);
231 break;
232 case 6:
233 dma_outb(pagenr & 0xfe, DMA_PAGE_6);
234 break;
235 case 7:
236 dma_outb(pagenr & 0xfe, DMA_PAGE_7);
237 break;
238 }
239}
240
241
242/* Set transfer address & page bits for specific DMA channel.
243 * Assumes dma flipflop is clear.
244 */
245static inline void set_dma_addr(unsigned int dmanr, unsigned int a)
246{
247 set_dma_page(dmanr, a>>16);
248 if (dmanr <= 3) {
249 dma_outb(a & 0xff, ((dmanr & 3) << 1) + IO_DMA1_BASE);
250 dma_outb((a >> 8) & 0xff, ((dmanr & 3) << 1) + IO_DMA1_BASE);
251 } else {
252 dma_outb((a >> 1) & 0xff, ((dmanr & 3) << 2) + IO_DMA2_BASE);
253 dma_outb((a >> 9) & 0xff, ((dmanr & 3) << 2) + IO_DMA2_BASE);
254 }
255}
256
257
258/* Set transfer size (max 64k for DMA0..3, 128k for DMA5..7) for
259 * a specific DMA channel.
260 * You must ensure the parameters are valid.
261 * NOTE: from a manual: "the number of transfers is one more
262 * than the initial word count"! This is taken into account.
263 * Assumes dma flip-flop is clear.
264 * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
265 */
266static inline void set_dma_count(unsigned int dmanr, unsigned int count)
267{
268 count--;
269 if (dmanr <= 3) {
270 dma_outb(count & 0xff, ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
271 dma_outb((count >> 8) & 0xff,
272 ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE);
273 } else {
274 dma_outb((count >> 1) & 0xff,
275 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
276 dma_outb((count >> 9) & 0xff,
277 ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE);
278 }
279}
280
281
282/* Get DMA residue count. After a DMA transfer, this
283 * should return zero. Reading this while a DMA transfer is
284 * still in progress will return unpredictable results.
285 * If called before the channel has been used, it may return 1.
286 * Otherwise, it returns the number of _bytes_ left to transfer.
287 *
288 * Assumes DMA flip-flop is clear.
289 */
290static inline int get_dma_residue(unsigned int dmanr)
291{
292 unsigned int io_port;
293 /* using short to get 16-bit wrap around */
294 unsigned short count;
295
296 io_port = (dmanr <= 3) ? ((dmanr & 3) << 1) + 1 + IO_DMA1_BASE
297 : ((dmanr & 3) << 2) + 2 + IO_DMA2_BASE;
298
299 count = 1 + dma_inb(io_port);
300 count += dma_inb(io_port) << 8;
301
302 return (dmanr <= 3) ? count : (count << 1);
303}
304
305
306/* These are in kernel/dma.c: */
307extern int request_dma(unsigned int dmanr, const char *device_id);
308extern void free_dma(unsigned int dmanr);
309
310/* From PCI */
311
312#ifdef CONFIG_PCI
313extern int isa_dma_bridge_buggy;
314#else
315#define isa_dma_bridge_buggy (0)
316#endif
317
318#endif /* _ASM_X86_DMA_H */
diff --git a/include/asm-x86/dmi.h b/include/asm-x86/dmi.h
deleted file mode 100644
index 58a86571fe0f..000000000000
--- a/include/asm-x86/dmi.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _ASM_X86_DMI_H
2#define _ASM_X86_DMI_H
3
4#include <asm/io.h>
5
6#define DMI_MAX_DATA 2048
7
8extern int dmi_alloc_index;
9extern char dmi_alloc_data[DMI_MAX_DATA];
10
11/* This is so early that there is no good way to allocate dynamic memory.
12 Allocate data in an BSS array. */
13static inline void *dmi_alloc(unsigned len)
14{
15 int idx = dmi_alloc_index;
16 if ((dmi_alloc_index + len) > DMI_MAX_DATA)
17 return NULL;
18 dmi_alloc_index += len;
19 return dmi_alloc_data + idx;
20}
21
22/* Use early IO mappings for DMI because it's initialized early */
23#define dmi_ioremap early_ioremap
24#define dmi_iounmap early_iounmap
25
26#endif
diff --git a/include/asm-x86/ds.h b/include/asm-x86/ds.h
deleted file mode 100644
index 7881368142fa..000000000000
--- a/include/asm-x86/ds.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Debug Store (DS) support
3 *
4 * This provides a low-level interface to the hardware's Debug Store
5 * feature that is used for last branch recording (LBR) and
6 * precise-event based sampling (PEBS).
7 *
8 * Different architectures use a different DS layout/pointer size.
9 * The below functions therefore work on a void*.
10 *
11 *
12 * Since there is no user for PEBS, yet, only LBR (or branch
13 * trace store, BTS) is supported.
14 *
15 *
16 * Copyright (C) 2007 Intel Corporation.
17 * Markus Metzger <markus.t.metzger@intel.com>, Dec 2007
18 */
19
20#ifndef _ASM_X86_DS_H
21#define _ASM_X86_DS_H
22
23#include <linux/types.h>
24#include <linux/init.h>
25
26struct cpuinfo_x86;
27
28
29/* a branch trace record entry
30 *
31 * In order to unify the interface between various processor versions,
32 * we use the below data structure for all processors.
33 */
34enum bts_qualifier {
35 BTS_INVALID = 0,
36 BTS_BRANCH,
37 BTS_TASK_ARRIVES,
38 BTS_TASK_DEPARTS
39};
40
41struct bts_struct {
42 u64 qualifier;
43 union {
44 /* BTS_BRANCH */
45 struct {
46 u64 from_ip;
47 u64 to_ip;
48 } lbr;
49 /* BTS_TASK_ARRIVES or
50 BTS_TASK_DEPARTS */
51 u64 jiffies;
52 } variant;
53};
54
55/* Overflow handling mechanisms */
56#define DS_O_SIGNAL 1 /* send overflow signal */
57#define DS_O_WRAP 2 /* wrap around */
58
59extern int ds_allocate(void **, size_t);
60extern int ds_free(void **);
61extern int ds_get_bts_size(void *);
62extern int ds_get_bts_end(void *);
63extern int ds_get_bts_index(void *);
64extern int ds_set_overflow(void *, int);
65extern int ds_get_overflow(void *);
66extern int ds_clear(void *);
67extern int ds_read_bts(void *, int, struct bts_struct *);
68extern int ds_write_bts(void *, const struct bts_struct *);
69extern unsigned long ds_debugctl_mask(void);
70extern void __cpuinit ds_init_intel(struct cpuinfo_x86 *c);
71
72#endif /* _ASM_X86_DS_H */
diff --git a/include/asm-x86/dwarf2.h b/include/asm-x86/dwarf2.h
deleted file mode 100644
index 738bb9fb3e53..000000000000
--- a/include/asm-x86/dwarf2.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _DWARF2_H
2#define _DWARF2_H
3
4#ifndef __ASSEMBLY__
5#warning "asm/dwarf2.h should be only included in pure assembly files"
6#endif
7
8/*
9 Macros for dwarf2 CFI unwind table entries.
10 See "as.info" for details on these pseudo ops. Unfortunately
11 they are only supported in very new binutils, so define them
12 away for older version.
13 */
14
15#ifdef CONFIG_AS_CFI
16
17#define CFI_STARTPROC .cfi_startproc
18#define CFI_ENDPROC .cfi_endproc
19#define CFI_DEF_CFA .cfi_def_cfa
20#define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register
21#define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
22#define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
23#define CFI_OFFSET .cfi_offset
24#define CFI_REL_OFFSET .cfi_rel_offset
25#define CFI_REGISTER .cfi_register
26#define CFI_RESTORE .cfi_restore
27#define CFI_REMEMBER_STATE .cfi_remember_state
28#define CFI_RESTORE_STATE .cfi_restore_state
29#define CFI_UNDEFINED .cfi_undefined
30
31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
32#define CFI_SIGNAL_FRAME .cfi_signal_frame
33#else
34#define CFI_SIGNAL_FRAME
35#endif
36
37#else
38
39/* Due to the structure of pre-exisiting code, don't use assembler line
40 comment character # to ignore the arguments. Instead, use a dummy macro. */
41.macro cfi_ignore a=0, b=0, c=0, d=0
42.endm
43
44#define CFI_STARTPROC cfi_ignore
45#define CFI_ENDPROC cfi_ignore
46#define CFI_DEF_CFA cfi_ignore
47#define CFI_DEF_CFA_REGISTER cfi_ignore
48#define CFI_DEF_CFA_OFFSET cfi_ignore
49#define CFI_ADJUST_CFA_OFFSET cfi_ignore
50#define CFI_OFFSET cfi_ignore
51#define CFI_REL_OFFSET cfi_ignore
52#define CFI_REGISTER cfi_ignore
53#define CFI_RESTORE cfi_ignore
54#define CFI_REMEMBER_STATE cfi_ignore
55#define CFI_RESTORE_STATE cfi_ignore
56#define CFI_UNDEFINED cfi_ignore
57#define CFI_SIGNAL_FRAME cfi_ignore
58
59#endif
60
61#endif
diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h
deleted file mode 100644
index 16a31e2c7c57..000000000000
--- a/include/asm-x86/e820.h
+++ /dev/null
@@ -1,143 +0,0 @@
1#ifndef __ASM_E820_H
2#define __ASM_E820_H
3#define E820MAP 0x2d0 /* our map */
4#define E820MAX 128 /* number of entries in E820MAP */
5
6/*
7 * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the
8 * constrained space in the zeropage. If we have more nodes than
9 * that, and if we've booted off EFI firmware, then the EFI tables
10 * passed us from the EFI firmware can list more nodes. Size our
11 * internal memory map tables to have room for these additional
12 * nodes, based on up to three entries per node for which the
13 * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT),
14 * plus E820MAX, allowing space for the possible duplicate E820
15 * entries that might need room in the same arrays, prior to the
16 * call to sanitize_e820_map() to remove duplicates. The allowance
17 * of three memory map entries per node is "enough" entries for
18 * the initial hardware platform motivating this mechanism to make
19 * use of additional EFI map entries. Future platforms may want
20 * to allow more than three entries per node or otherwise refine
21 * this size.
22 */
23
24/*
25 * Odd: 'make headers_check' complains about numa.h if I try
26 * to collapse the next two #ifdef lines to a single line:
27 * #if defined(__KERNEL__) && defined(CONFIG_EFI)
28 */
29#ifdef __KERNEL__
30#ifdef CONFIG_EFI
31#include <linux/numa.h>
32#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
33#else /* ! CONFIG_EFI */
34#define E820_X_MAX E820MAX
35#endif
36#else /* ! __KERNEL__ */
37#define E820_X_MAX E820MAX
38#endif
39
40#define E820NR 0x1e8 /* # entries in E820MAP */
41
42#define E820_RAM 1
43#define E820_RESERVED 2
44#define E820_ACPI 3
45#define E820_NVS 4
46
47/* reserved RAM used by kernel itself */
48#define E820_RESERVED_KERN 128
49
50#ifndef __ASSEMBLY__
51struct e820entry {
52 __u64 addr; /* start of memory segment */
53 __u64 size; /* size of memory segment */
54 __u32 type; /* type of memory segment */
55} __attribute__((packed));
56
57struct e820map {
58 __u32 nr_map;
59 struct e820entry map[E820_X_MAX];
60};
61
62#ifdef __KERNEL__
63/* see comment in arch/x86/kernel/e820.c */
64extern struct e820map e820;
65extern struct e820map e820_saved;
66
67extern int e820_any_mapped(u64 start, u64 end, unsigned type);
68extern int e820_all_mapped(u64 start, u64 end, unsigned type);
69extern void e820_add_region(u64 start, u64 size, int type);
70extern void e820_print_map(char *who);
71extern int
72sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, int *pnr_map);
73extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
74 unsigned new_type);
75extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
76 int checktype);
77extern void update_e820(void);
78extern void e820_setup_gap(void);
79extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
80 unsigned long start_addr, unsigned long long end_addr);
81struct setup_data;
82extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
83
84#if defined(CONFIG_X86_64) || \
85 (defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
86extern void e820_mark_nosave_regions(unsigned long limit_pfn);
87#else
88static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
89{
90}
91#endif
92
93#ifdef CONFIG_MEMTEST
94extern void early_memtest(unsigned long start, unsigned long end);
95#else
96static inline void early_memtest(unsigned long start, unsigned long end)
97{
98}
99#endif
100
101extern unsigned long end_user_pfn;
102
103extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
104extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
105extern void reserve_early(u64 start, u64 end, char *name);
106extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
107extern void free_early(u64 start, u64 end);
108extern void early_res_to_bootmem(u64 start, u64 end);
109extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
110
111extern unsigned long e820_end_of_ram_pfn(void);
112extern unsigned long e820_end_of_low_ram_pfn(void);
113extern int e820_find_active_region(const struct e820entry *ei,
114 unsigned long start_pfn,
115 unsigned long last_pfn,
116 unsigned long *ei_startpfn,
117 unsigned long *ei_endpfn);
118extern void e820_register_active_regions(int nid, unsigned long start_pfn,
119 unsigned long end_pfn);
120extern u64 e820_hole_size(u64 start, u64 end);
121extern void finish_e820_parsing(void);
122extern void e820_reserve_resources(void);
123extern void setup_memory_map(void);
124extern char *default_machine_specific_memory_setup(void);
125extern char *machine_specific_memory_setup(void);
126extern char *memory_setup(void);
127#endif /* __KERNEL__ */
128#endif /* __ASSEMBLY__ */
129
130#define ISA_START_ADDRESS 0xa0000
131#define ISA_END_ADDRESS 0x100000
132#define is_ISA_range(s, e) ((s) >= ISA_START_ADDRESS && (e) < ISA_END_ADDRESS)
133
134#define BIOS_BEGIN 0x000a0000
135#define BIOS_END 0x00100000
136
137#ifdef __KERNEL__
138#include <linux/ioport.h>
139
140#define HIGH_MEMORY (1024*1024)
141#endif /* __KERNEL__ */
142
143#endif /* __ASM_E820_H */
diff --git a/include/asm-x86/edac.h b/include/asm-x86/edac.h
deleted file mode 100644
index a8088f63a30e..000000000000
--- a/include/asm-x86/edac.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_X86_EDAC_H
2#define _ASM_X86_EDAC_H
3
4/* ECC atomic, DMA, SMP and interrupt safe scrub function */
5
6static inline void atomic_scrub(void *va, u32 size)
7{
8 u32 i, *virt_addr = va;
9
10 /*
11 * Very carefully read and write to memory atomically so we
12 * are interrupt, DMA and SMP safe.
13 */
14 for (i = 0; i < size / 4; i++, virt_addr++)
15 asm volatile("lock; addl $0, %0"::"m" (*virt_addr));
16}
17
18#endif
diff --git a/include/asm-x86/efi.h b/include/asm-x86/efi.h
deleted file mode 100644
index d4f2b0abe929..000000000000
--- a/include/asm-x86/efi.h
+++ /dev/null
@@ -1,97 +0,0 @@
1#ifndef _ASM_X86_EFI_H
2#define _ASM_X86_EFI_H
3
4#ifdef CONFIG_X86_32
5
6extern unsigned long asmlinkage efi_call_phys(void *, ...);
7
8#define efi_call_phys0(f) efi_call_phys(f)
9#define efi_call_phys1(f, a1) efi_call_phys(f, a1)
10#define efi_call_phys2(f, a1, a2) efi_call_phys(f, a1, a2)
11#define efi_call_phys3(f, a1, a2, a3) efi_call_phys(f, a1, a2, a3)
12#define efi_call_phys4(f, a1, a2, a3, a4) \
13 efi_call_phys(f, a1, a2, a3, a4)
14#define efi_call_phys5(f, a1, a2, a3, a4, a5) \
15 efi_call_phys(f, a1, a2, a3, a4, a5)
16#define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \
17 efi_call_phys(f, a1, a2, a3, a4, a5, a6)
18/*
19 * Wrap all the virtual calls in a way that forces the parameters on the stack.
20 */
21
22#define efi_call_virt(f, args...) \
23 ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
24
25#define efi_call_virt0(f) efi_call_virt(f)
26#define efi_call_virt1(f, a1) efi_call_virt(f, a1)
27#define efi_call_virt2(f, a1, a2) efi_call_virt(f, a1, a2)
28#define efi_call_virt3(f, a1, a2, a3) efi_call_virt(f, a1, a2, a3)
29#define efi_call_virt4(f, a1, a2, a3, a4) \
30 efi_call_virt(f, a1, a2, a3, a4)
31#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
32 efi_call_virt(f, a1, a2, a3, a4, a5)
33#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
34 efi_call_virt(f, a1, a2, a3, a4, a5, a6)
35
36#define efi_ioremap(addr, size) ioremap_cache(addr, size)
37
38#else /* !CONFIG_X86_32 */
39
40#define MAX_EFI_IO_PAGES 100
41
42extern u64 efi_call0(void *fp);
43extern u64 efi_call1(void *fp, u64 arg1);
44extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
45extern u64 efi_call3(void *fp, u64 arg1, u64 arg2, u64 arg3);
46extern u64 efi_call4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4);
47extern u64 efi_call5(void *fp, u64 arg1, u64 arg2, u64 arg3,
48 u64 arg4, u64 arg5);
49extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
50 u64 arg4, u64 arg5, u64 arg6);
51
52#define efi_call_phys0(f) \
53 efi_call0((void *)(f))
54#define efi_call_phys1(f, a1) \
55 efi_call1((void *)(f), (u64)(a1))
56#define efi_call_phys2(f, a1, a2) \
57 efi_call2((void *)(f), (u64)(a1), (u64)(a2))
58#define efi_call_phys3(f, a1, a2, a3) \
59 efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3))
60#define efi_call_phys4(f, a1, a2, a3, a4) \
61 efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
62 (u64)(a4))
63#define efi_call_phys5(f, a1, a2, a3, a4, a5) \
64 efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
65 (u64)(a4), (u64)(a5))
66#define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \
67 efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
68 (u64)(a4), (u64)(a5), (u64)(a6))
69
70#define efi_call_virt0(f) \
71 efi_call0((void *)(efi.systab->runtime->f))
72#define efi_call_virt1(f, a1) \
73 efi_call1((void *)(efi.systab->runtime->f), (u64)(a1))
74#define efi_call_virt2(f, a1, a2) \
75 efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2))
76#define efi_call_virt3(f, a1, a2, a3) \
77 efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
78 (u64)(a3))
79#define efi_call_virt4(f, a1, a2, a3, a4) \
80 efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
81 (u64)(a3), (u64)(a4))
82#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
83 efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
84 (u64)(a3), (u64)(a4), (u64)(a5))
85#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
86 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
87 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
88
89extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size);
90
91#endif /* CONFIG_X86_32 */
92
93extern void efi_reserve_early(void);
94extern void efi_call_phys_prelog(void);
95extern void efi_call_phys_epilog(void);
96
97#endif
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
deleted file mode 100644
index 7be4733c793e..000000000000
--- a/include/asm-x86/elf.h
+++ /dev/null
@@ -1,335 +0,0 @@
1#ifndef _ASM_X86_ELF_H
2#define _ASM_X86_ELF_H
3
4/*
5 * ELF register definitions..
6 */
7
8#include <asm/ptrace.h>
9#include <asm/user.h>
10#include <asm/auxvec.h>
11
12typedef unsigned long elf_greg_t;
13
14#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
15typedef elf_greg_t elf_gregset_t[ELF_NGREG];
16
17typedef struct user_i387_struct elf_fpregset_t;
18
19#ifdef __i386__
20
21typedef struct user_fxsr_struct elf_fpxregset_t;
22
23#define R_386_NONE 0
24#define R_386_32 1
25#define R_386_PC32 2
26#define R_386_GOT32 3
27#define R_386_PLT32 4
28#define R_386_COPY 5
29#define R_386_GLOB_DAT 6
30#define R_386_JMP_SLOT 7
31#define R_386_RELATIVE 8
32#define R_386_GOTOFF 9
33#define R_386_GOTPC 10
34#define R_386_NUM 11
35
36/*
37 * These are used to set parameters in the core dumps.
38 */
39#define ELF_CLASS ELFCLASS32
40#define ELF_DATA ELFDATA2LSB
41#define ELF_ARCH EM_386
42
43#else
44
45/* x86-64 relocation types */
46#define R_X86_64_NONE 0 /* No reloc */
47#define R_X86_64_64 1 /* Direct 64 bit */
48#define R_X86_64_PC32 2 /* PC relative 32 bit signed */
49#define R_X86_64_GOT32 3 /* 32 bit GOT entry */
50#define R_X86_64_PLT32 4 /* 32 bit PLT address */
51#define R_X86_64_COPY 5 /* Copy symbol at runtime */
52#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */
53#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */
54#define R_X86_64_RELATIVE 8 /* Adjust by program base */
55#define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative
56 offset to GOT */
57#define R_X86_64_32 10 /* Direct 32 bit zero extended */
58#define R_X86_64_32S 11 /* Direct 32 bit sign extended */
59#define R_X86_64_16 12 /* Direct 16 bit zero extended */
60#define R_X86_64_PC16 13 /* 16 bit sign extended pc relative */
61#define R_X86_64_8 14 /* Direct 8 bit sign extended */
62#define R_X86_64_PC8 15 /* 8 bit sign extended pc relative */
63
64#define R_X86_64_NUM 16
65
66/*
67 * These are used to set parameters in the core dumps.
68 */
69#define ELF_CLASS ELFCLASS64
70#define ELF_DATA ELFDATA2LSB
71#define ELF_ARCH EM_X86_64
72
73#endif
74
75#include <asm/vdso.h>
76
77extern unsigned int vdso_enabled;
78
79/*
80 * This is used to ensure we don't load something for the wrong architecture.
81 */
82#define elf_check_arch_ia32(x) \
83 (((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
84
85#include <asm/processor.h>
86#include <asm/system.h>
87
88#ifdef CONFIG_X86_32
89#include <asm/desc.h>
90
91#define elf_check_arch(x) elf_check_arch_ia32(x)
92
93/* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx
94 contains a pointer to a function which might be registered using `atexit'.
95 This provides a mean for the dynamic linker to call DT_FINI functions for
96 shared libraries that have been loaded before the code runs.
97
98 A value of 0 tells we have no such handler.
99
100 We might as well make sure everything else is cleared too (except for %esp),
101 just to make things more deterministic.
102 */
103#define ELF_PLAT_INIT(_r, load_addr) \
104 do { \
105 _r->bx = 0; _r->cx = 0; _r->dx = 0; \
106 _r->si = 0; _r->di = 0; _r->bp = 0; \
107 _r->ax = 0; \
108} while (0)
109
110/*
111 * regs is struct pt_regs, pr_reg is elf_gregset_t (which is
112 * now struct_user_regs, they are different)
113 */
114
115#define ELF_CORE_COPY_REGS(pr_reg, regs) \
116do { \
117 pr_reg[0] = regs->bx; \
118 pr_reg[1] = regs->cx; \
119 pr_reg[2] = regs->dx; \
120 pr_reg[3] = regs->si; \
121 pr_reg[4] = regs->di; \
122 pr_reg[5] = regs->bp; \
123 pr_reg[6] = regs->ax; \
124 pr_reg[7] = regs->ds & 0xffff; \
125 pr_reg[8] = regs->es & 0xffff; \
126 pr_reg[9] = regs->fs & 0xffff; \
127 savesegment(gs, pr_reg[10]); \
128 pr_reg[11] = regs->orig_ax; \
129 pr_reg[12] = regs->ip; \
130 pr_reg[13] = regs->cs & 0xffff; \
131 pr_reg[14] = regs->flags; \
132 pr_reg[15] = regs->sp; \
133 pr_reg[16] = regs->ss & 0xffff; \
134} while (0);
135
136#define ELF_PLATFORM (utsname()->machine)
137#define set_personality_64bit() do { } while (0)
138
139#else /* CONFIG_X86_32 */
140
141/*
142 * This is used to ensure we don't load something for the wrong architecture.
143 */
144#define elf_check_arch(x) \
145 ((x)->e_machine == EM_X86_64)
146
147#define compat_elf_check_arch(x) elf_check_arch_ia32(x)
148
149static inline void start_ia32_thread(struct pt_regs *regs, u32 ip, u32 sp)
150{
151 asm volatile("movl %0,%%fs" :: "r" (0));
152 asm volatile("movl %0,%%es; movl %0,%%ds" : : "r" (__USER32_DS));
153 load_gs_index(0);
154 regs->ip = ip;
155 regs->sp = sp;
156 regs->flags = X86_EFLAGS_IF;
157 regs->cs = __USER32_CS;
158 regs->ss = __USER32_DS;
159}
160
161static inline void elf_common_init(struct thread_struct *t,
162 struct pt_regs *regs, const u16 ds)
163{
164 regs->ax = regs->bx = regs->cx = regs->dx = 0;
165 regs->si = regs->di = regs->bp = 0;
166 regs->r8 = regs->r9 = regs->r10 = regs->r11 = 0;
167 regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0;
168 t->fs = t->gs = 0;
169 t->fsindex = t->gsindex = 0;
170 t->ds = t->es = ds;
171}
172
173#define ELF_PLAT_INIT(_r, load_addr) \
174do { \
175 elf_common_init(&current->thread, _r, 0); \
176 clear_thread_flag(TIF_IA32); \
177} while (0)
178
179#define COMPAT_ELF_PLAT_INIT(regs, load_addr) \
180 elf_common_init(&current->thread, regs, __USER_DS)
181
182#define compat_start_thread(regs, ip, sp) \
183do { \
184 start_ia32_thread(regs, ip, sp); \
185 set_fs(USER_DS); \
186} while (0)
187
188#define COMPAT_SET_PERSONALITY(ex, ibcs2) \
189do { \
190 if (test_thread_flag(TIF_IA32)) \
191 clear_thread_flag(TIF_ABI_PENDING); \
192 else \
193 set_thread_flag(TIF_ABI_PENDING); \
194 current->personality |= force_personality32; \
195} while (0)
196
197#define COMPAT_ELF_PLATFORM ("i686")
198
199/*
200 * regs is struct pt_regs, pr_reg is elf_gregset_t (which is
201 * now struct_user_regs, they are different). Assumes current is the process
202 * getting dumped.
203 */
204
205#define ELF_CORE_COPY_REGS(pr_reg, regs) \
206do { \
207 unsigned v; \
208 (pr_reg)[0] = (regs)->r15; \
209 (pr_reg)[1] = (regs)->r14; \
210 (pr_reg)[2] = (regs)->r13; \
211 (pr_reg)[3] = (regs)->r12; \
212 (pr_reg)[4] = (regs)->bp; \
213 (pr_reg)[5] = (regs)->bx; \
214 (pr_reg)[6] = (regs)->r11; \
215 (pr_reg)[7] = (regs)->r10; \
216 (pr_reg)[8] = (regs)->r9; \
217 (pr_reg)[9] = (regs)->r8; \
218 (pr_reg)[10] = (regs)->ax; \
219 (pr_reg)[11] = (regs)->cx; \
220 (pr_reg)[12] = (regs)->dx; \
221 (pr_reg)[13] = (regs)->si; \
222 (pr_reg)[14] = (regs)->di; \
223 (pr_reg)[15] = (regs)->orig_ax; \
224 (pr_reg)[16] = (regs)->ip; \
225 (pr_reg)[17] = (regs)->cs; \
226 (pr_reg)[18] = (regs)->flags; \
227 (pr_reg)[19] = (regs)->sp; \
228 (pr_reg)[20] = (regs)->ss; \
229 (pr_reg)[21] = current->thread.fs; \
230 (pr_reg)[22] = current->thread.gs; \
231 asm("movl %%ds,%0" : "=r" (v)); (pr_reg)[23] = v; \
232 asm("movl %%es,%0" : "=r" (v)); (pr_reg)[24] = v; \
233 asm("movl %%fs,%0" : "=r" (v)); (pr_reg)[25] = v; \
234 asm("movl %%gs,%0" : "=r" (v)); (pr_reg)[26] = v; \
235} while (0);
236
237/* I'm not sure if we can use '-' here */
238#define ELF_PLATFORM ("x86_64")
239extern void set_personality_64bit(void);
240extern unsigned int sysctl_vsyscall32;
241extern int force_personality32;
242
243#endif /* !CONFIG_X86_32 */
244
245#define CORE_DUMP_USE_REGSET
246#define USE_ELF_CORE_DUMP
247#define ELF_EXEC_PAGESIZE 4096
248
249/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
250 use of this is to invoke "./ld.so someprog" to test out a new version of
251 the loader. We need to make sure that it is out of the way of the program
252 that it will "exec", and that there is sufficient room for the brk. */
253
254#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
255
256/* This yields a mask that user programs can use to figure out what
257 instruction set this CPU supports. This could be done in user space,
258 but it's not easy, and we've already done it here. */
259
260#define ELF_HWCAP (boot_cpu_data.x86_capability[0])
261
262/* This yields a string that ld.so will use to load implementation
263 specific libraries for optimization. This is more specific in
264 intent than poking at uname or /proc/cpuinfo.
265
266 For the moment, we have only optimizations for the Intel generations,
267 but that could change... */
268
269#define SET_PERSONALITY(ex, ibcs2) set_personality_64bit()
270
271/*
272 * An executable for which elf_read_implies_exec() returns TRUE will
273 * have the READ_IMPLIES_EXEC personality flag set automatically.
274 */
275#define elf_read_implies_exec(ex, executable_stack) \
276 (executable_stack != EXSTACK_DISABLE_X)
277
278struct task_struct;
279
280#define ARCH_DLINFO_IA32(vdso_enabled) \
281do { \
282 if (vdso_enabled) { \
283 NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \
284 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE); \
285 } \
286} while (0)
287
288#ifdef CONFIG_X86_32
289
290#define VDSO_HIGH_BASE (__fix_to_virt(FIX_VDSO))
291
292#define ARCH_DLINFO ARCH_DLINFO_IA32(vdso_enabled)
293
294/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
295
296#else /* CONFIG_X86_32 */
297
298#define VDSO_HIGH_BASE 0xffffe000U /* CONFIG_COMPAT_VDSO address */
299
300/* 1GB for 64bit, 8MB for 32bit */
301#define STACK_RND_MASK (test_thread_flag(TIF_IA32) ? 0x7ff : 0x3fffff)
302
303#define ARCH_DLINFO \
304do { \
305 if (vdso_enabled) \
306 NEW_AUX_ENT(AT_SYSINFO_EHDR, \
307 (unsigned long)current->mm->context.vdso); \
308} while (0)
309
310#define AT_SYSINFO 32
311
312#define COMPAT_ARCH_DLINFO ARCH_DLINFO_IA32(sysctl_vsyscall32)
313
314#define COMPAT_ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
315
316#endif /* !CONFIG_X86_32 */
317
318#define VDSO_CURRENT_BASE ((unsigned long)current->mm->context.vdso)
319
320#define VDSO_ENTRY \
321 ((unsigned long)VDSO32_SYMBOL(VDSO_CURRENT_BASE, vsyscall))
322
323struct linux_binprm;
324
325#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
326extern int arch_setup_additional_pages(struct linux_binprm *bprm,
327 int executable_stack);
328
329extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
330#define compat_arch_setup_additional_pages syscall32_setup_pages
331
332extern unsigned long arch_randomize_brk(struct mm_struct *mm);
333#define arch_randomize_brk arch_randomize_brk
334
335#endif
diff --git a/include/asm-x86/emergency-restart.h b/include/asm-x86/emergency-restart.h
deleted file mode 100644
index 8e6aef19f8f0..000000000000
--- a/include/asm-x86/emergency-restart.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4enum reboot_type {
5 BOOT_TRIPLE = 't',
6 BOOT_KBD = 'k',
7#ifdef CONFIG_X86_32
8 BOOT_BIOS = 'b',
9#endif
10 BOOT_ACPI = 'a',
11 BOOT_EFI = 'e'
12};
13
14extern enum reboot_type reboot_type;
15
16extern void machine_emergency_restart(void);
17
18#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-x86/errno.h b/include/asm-x86/errno.h
deleted file mode 100644
index 4c82b503d92f..000000000000
--- a/include/asm-x86/errno.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/errno.h>
diff --git a/include/asm-x86/fb.h b/include/asm-x86/fb.h
deleted file mode 100644
index 53018464aea6..000000000000
--- a/include/asm-x86/fb.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_X86_FB_H
2#define _ASM_X86_FB_H
3
4#include <linux/fb.h>
5#include <linux/fs.h>
6#include <asm/page.h>
7
8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
9 unsigned long off)
10{
11 if (boot_cpu_data.x86 > 3)
12 pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
13}
14
15#ifdef CONFIG_X86_32
16extern int fb_is_primary_device(struct fb_info *info);
17#else
18static inline int fb_is_primary_device(struct fb_info *info) { return 0; }
19#endif
20
21#endif /* _ASM_X86_FB_H */
diff --git a/include/asm-x86/fcntl.h b/include/asm-x86/fcntl.h
deleted file mode 100644
index 46ab12db5739..000000000000
--- a/include/asm-x86/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/fcntl.h>
diff --git a/include/asm-x86/fixmap.h b/include/asm-x86/fixmap.h
deleted file mode 100644
index 44d4f8217349..000000000000
--- a/include/asm-x86/fixmap.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef _ASM_FIXMAP_H
2#define _ASM_FIXMAP_H
3
4#ifdef CONFIG_X86_32
5# include "fixmap_32.h"
6#else
7# include "fixmap_64.h"
8#endif
9
10extern int fixmaps_set;
11
12void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
13void native_set_fixmap(enum fixed_addresses idx,
14 unsigned long phys, pgprot_t flags);
15
16#ifndef CONFIG_PARAVIRT
17static inline void __set_fixmap(enum fixed_addresses idx,
18 unsigned long phys, pgprot_t flags)
19{
20 native_set_fixmap(idx, phys, flags);
21}
22#endif
23
24#define set_fixmap(idx, phys) \
25 __set_fixmap(idx, phys, PAGE_KERNEL)
26
27/*
28 * Some hardware wants to get fixmapped without caching.
29 */
30#define set_fixmap_nocache(idx, phys) \
31 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
32
33#define clear_fixmap(idx) \
34 __set_fixmap(idx, 0, __pgprot(0))
35
36#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
37#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
38
39extern void __this_fixmap_does_not_exist(void);
40
41/*
42 * 'index to address' translation. If anyone tries to use the idx
43 * directly without translation, we catch the bug with a NULL-deference
44 * kernel oops. Illegal ranges of incoming indices are caught too.
45 */
46static __always_inline unsigned long fix_to_virt(const unsigned int idx)
47{
48 /*
49 * this branch gets completely eliminated after inlining,
50 * except when someone tries to use fixaddr indices in an
51 * illegal way. (such as mixing up address types or using
52 * out-of-range indices).
53 *
54 * If it doesn't get removed, the linker will complain
55 * loudly with a reasonably clear error message..
56 */
57 if (idx >= __end_of_fixed_addresses)
58 __this_fixmap_does_not_exist();
59
60 return __fix_to_virt(idx);
61}
62
63static inline unsigned long virt_to_fix(const unsigned long vaddr)
64{
65 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
66 return __virt_to_fix(vaddr);
67}
68#endif
diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
deleted file mode 100644
index f1ac2b2167d7..000000000000
--- a/include/asm-x86/fixmap_32.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
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 Ingo Molnar
9 *
10 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
11 */
12
13#ifndef _ASM_FIXMAP_32_H
14#define _ASM_FIXMAP_32_H
15
16
17/* used by vmalloc.c, vsyscall.lds.S.
18 *
19 * Leave one empty page between vmalloc'ed areas and
20 * the start of the fixmap.
21 */
22extern unsigned long __FIXADDR_TOP;
23#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
24#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
25
26#ifndef __ASSEMBLY__
27#include <linux/kernel.h>
28#include <asm/acpi.h>
29#include <asm/apicdef.h>
30#include <asm/page.h>
31#ifdef CONFIG_HIGHMEM
32#include <linux/threads.h>
33#include <asm/kmap_types.h>
34#endif
35
36/*
37 * Here we define all the compile-time 'special' virtual
38 * addresses. The point is to have a constant address at
39 * compile time, but to set the physical address only
40 * in the boot process. We allocate these special addresses
41 * from the end of virtual memory (0xfffff000) backwards.
42 * Also this lets us do fail-safe vmalloc(), we
43 * can guarantee that these special addresses and
44 * vmalloc()-ed addresses never overlap.
45 *
46 * these 'compile-time allocated' memory buffers are
47 * fixed-size 4k pages. (or larger if used with an increment
48 * highger than 1) use fixmap_set(idx,phys) to associate
49 * physical memory with fixmap indices.
50 *
51 * TLB entries of such buffers will not be flushed across
52 * task switches.
53 */
54enum fixed_addresses {
55 FIX_HOLE,
56 FIX_VDSO,
57 FIX_DBGP_BASE,
58 FIX_EARLYCON_MEM_BASE,
59#ifdef CONFIG_X86_LOCAL_APIC
60 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
61#endif
62#ifdef CONFIG_X86_IO_APIC
63 FIX_IO_APIC_BASE_0,
64 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
65#endif
66#ifdef CONFIG_X86_VISWS_APIC
67 FIX_CO_CPU, /* Cobalt timer */
68 FIX_CO_APIC, /* Cobalt APIC Redirection Table */
69 FIX_LI_PCIA, /* Lithium PCI Bridge A */
70 FIX_LI_PCIB, /* Lithium PCI Bridge B */
71#endif
72#ifdef CONFIG_X86_F00F_BUG
73 FIX_F00F_IDT, /* Virtual mapping for IDT */
74#endif
75#ifdef CONFIG_X86_CYCLONE_TIMER
76 FIX_CYCLONE_TIMER, /*cyclone timer register*/
77#endif
78#ifdef CONFIG_HIGHMEM
79 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
80 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
81#endif
82#ifdef CONFIG_PCI_MMCONFIG
83 FIX_PCIE_MCFG,
84#endif
85#ifdef CONFIG_PARAVIRT
86 FIX_PARAVIRT_BOOTMAP,
87#endif
88 __end_of_permanent_fixed_addresses,
89 /*
90 * 256 temporary boot-time mappings, used by early_ioremap(),
91 * before ioremap() is functional.
92 *
93 * We round it up to the next 256 pages boundary so that we
94 * can have a single pgd entry and a single pte table:
95 */
96#define NR_FIX_BTMAPS 64
97#define FIX_BTMAPS_NESTING 4
98 FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
99 (__end_of_permanent_fixed_addresses & 255),
100 FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_NESTING - 1,
101 FIX_WP_TEST,
102#ifdef CONFIG_ACPI
103 FIX_ACPI_BEGIN,
104 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
105#endif
106#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
107 FIX_OHCI1394_BASE,
108#endif
109 __end_of_fixed_addresses
110};
111
112extern void reserve_top_address(unsigned long reserve);
113
114
115#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
116
117#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
118#define __FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
119#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
120#define FIXADDR_BOOT_START (FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
121
122#endif /* !__ASSEMBLY__ */
123#endif
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h
deleted file mode 100644
index 00f3d74a0524..000000000000
--- a/include/asm-x86/fixmap_64.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * fixmap.h: compile-time virtual memory allocation
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 Ingo Molnar
9 */
10
11#ifndef _ASM_FIXMAP_64_H
12#define _ASM_FIXMAP_64_H
13
14#include <linux/kernel.h>
15#include <asm/acpi.h>
16#include <asm/apicdef.h>
17#include <asm/page.h>
18#include <asm/vsyscall.h>
19#include <asm/efi.h>
20
21/*
22 * Here we define all the compile-time 'special' virtual
23 * addresses. The point is to have a constant address at
24 * compile time, but to set the physical address only
25 * in the boot process.
26 *
27 * These 'compile-time allocated' memory buffers are
28 * fixed-size 4k pages (or larger if used with an increment
29 * higher than 1). Use set_fixmap(idx,phys) to associate
30 * physical memory with fixmap indices.
31 *
32 * TLB entries of such buffers will not be flushed across
33 * task switches.
34 */
35
36enum fixed_addresses {
37 VSYSCALL_LAST_PAGE,
38 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
39 + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
40 VSYSCALL_HPET,
41 FIX_DBGP_BASE,
42 FIX_EARLYCON_MEM_BASE,
43 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
44 FIX_IO_APIC_BASE_0,
45 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
46 FIX_EFI_IO_MAP_LAST_PAGE,
47 FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE
48 + MAX_EFI_IO_PAGES - 1,
49#ifdef CONFIG_PARAVIRT
50 FIX_PARAVIRT_BOOTMAP,
51#endif
52#ifdef CONFIG_ACPI
53 FIX_ACPI_BEGIN,
54 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
55#endif
56#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
57 FIX_OHCI1394_BASE,
58#endif
59 __end_of_permanent_fixed_addresses,
60 /*
61 * 256 temporary boot-time mappings, used by early_ioremap(),
62 * before ioremap() is functional.
63 *
64 * We round it up to the next 512 pages boundary so that we
65 * can have a single pgd entry and a single pte table:
66 */
67#define NR_FIX_BTMAPS 64
68#define FIX_BTMAPS_NESTING 4
69 FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 512 -
70 (__end_of_permanent_fixed_addresses & 511),
71 FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_NESTING - 1,
72 __end_of_fixed_addresses
73};
74
75#define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE)
76#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
77#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
78
79/* Only covers 32bit vsyscalls currently. Need another set for 64bit. */
80#define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL)
81#define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE)
82
83#endif
diff --git a/include/asm-x86/floppy.h b/include/asm-x86/floppy.h
deleted file mode 100644
index dbe82a5c5eac..000000000000
--- a/include/asm-x86/floppy.h
+++ /dev/null
@@ -1,281 +0,0 @@
1/*
2 * Architecture specific parts of the Floppy driver
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) 1995
9 */
10#ifndef _ASM_X86_FLOPPY_H
11#define _ASM_X86_FLOPPY_H
12
13#include <linux/vmalloc.h>
14
15/*
16 * The DMA channel used by the floppy controller cannot access data at
17 * addresses >= 16MB
18 *
19 * Went back to the 1MB limit, as some people had problems with the floppy
20 * driver otherwise. It doesn't matter much for performance anyway, as most
21 * floppy accesses go through the track buffer.
22 */
23#define _CROSS_64KB(a, s, vdma) \
24 (!(vdma) && \
25 ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
26
27#define CROSS_64KB(a, s) _CROSS_64KB(a, s, use_virtual_dma & 1)
28
29
30#define SW fd_routine[use_virtual_dma & 1]
31#define CSW fd_routine[can_use_virtual_dma & 1]
32
33
34#define fd_inb(port) inb_p(port)
35#define fd_outb(value, port) outb_p(value, port)
36
37#define fd_request_dma() CSW._request_dma(FLOPPY_DMA, "floppy")
38#define fd_free_dma() CSW._free_dma(FLOPPY_DMA)
39#define fd_enable_irq() enable_irq(FLOPPY_IRQ)
40#define fd_disable_irq() disable_irq(FLOPPY_IRQ)
41#define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
42#define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA)
43#define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size)
44#define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io)
45
46#define FLOPPY_CAN_FALLBACK_ON_NODMA
47
48static int virtual_dma_count;
49static int virtual_dma_residue;
50static char *virtual_dma_addr;
51static int virtual_dma_mode;
52static int doing_pdma;
53
54static irqreturn_t floppy_hardint(int irq, void *dev_id)
55{
56 unsigned char st;
57
58#undef TRACE_FLPY_INT
59
60#ifdef TRACE_FLPY_INT
61 static int calls;
62 static int bytes;
63 static int dma_wait;
64#endif
65 if (!doing_pdma)
66 return floppy_interrupt(irq, dev_id);
67
68#ifdef TRACE_FLPY_INT
69 if (!calls)
70 bytes = virtual_dma_count;
71#endif
72
73 {
74 int lcount;
75 char *lptr;
76
77 st = 1;
78 for (lcount = virtual_dma_count, lptr = virtual_dma_addr;
79 lcount; lcount--, lptr++) {
80 st = inb(virtual_dma_port + 4) & 0xa0;
81 if (st != 0xa0)
82 break;
83 if (virtual_dma_mode)
84 outb_p(*lptr, virtual_dma_port + 5);
85 else
86 *lptr = inb_p(virtual_dma_port + 5);
87 }
88 virtual_dma_count = lcount;
89 virtual_dma_addr = lptr;
90 st = inb(virtual_dma_port + 4);
91 }
92
93#ifdef TRACE_FLPY_INT
94 calls++;
95#endif
96 if (st == 0x20)
97 return IRQ_HANDLED;
98 if (!(st & 0x20)) {
99 virtual_dma_residue += virtual_dma_count;
100 virtual_dma_count = 0;
101#ifdef TRACE_FLPY_INT
102 printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
103 virtual_dma_count, virtual_dma_residue, calls, bytes,
104 dma_wait);
105 calls = 0;
106 dma_wait = 0;
107#endif
108 doing_pdma = 0;
109 floppy_interrupt(irq, dev_id);
110 return IRQ_HANDLED;
111 }
112#ifdef TRACE_FLPY_INT
113 if (!virtual_dma_count)
114 dma_wait++;
115#endif
116 return IRQ_HANDLED;
117}
118
119static void fd_disable_dma(void)
120{
121 if (!(can_use_virtual_dma & 1))
122 disable_dma(FLOPPY_DMA);
123 doing_pdma = 0;
124 virtual_dma_residue += virtual_dma_count;
125 virtual_dma_count = 0;
126}
127
128static int vdma_request_dma(unsigned int dmanr, const char *device_id)
129{
130 return 0;
131}
132
133static void vdma_nop(unsigned int dummy)
134{
135}
136
137
138static int vdma_get_dma_residue(unsigned int dummy)
139{
140 return virtual_dma_count + virtual_dma_residue;
141}
142
143
144static int fd_request_irq(void)
145{
146 if (can_use_virtual_dma)
147 return request_irq(FLOPPY_IRQ, floppy_hardint,
148 IRQF_DISABLED, "floppy", NULL);
149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt,
151 IRQF_DISABLED, "floppy", NULL);
152}
153
154static unsigned long dma_mem_alloc(unsigned long size)
155{
156 return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY, get_order(size));
157}
158
159
160static unsigned long vdma_mem_alloc(unsigned long size)
161{
162 return (unsigned long)vmalloc(size);
163
164}
165
166#define nodma_mem_alloc(size) vdma_mem_alloc(size)
167
168static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
169{
170 if ((unsigned long)addr >= (unsigned long)high_memory)
171 vfree((void *)addr);
172 else
173 free_pages(addr, get_order(size));
174}
175
176#define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size)
177
178static void _fd_chose_dma_mode(char *addr, unsigned long size)
179{
180 if (can_use_virtual_dma == 2) {
181 if ((unsigned long)addr >= (unsigned long)high_memory ||
182 isa_virt_to_bus(addr) >= 0x1000000 ||
183 _CROSS_64KB(addr, size, 0))
184 use_virtual_dma = 1;
185 else
186 use_virtual_dma = 0;
187 } else {
188 use_virtual_dma = can_use_virtual_dma & 1;
189 }
190}
191
192#define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size)
193
194
195static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
196{
197 doing_pdma = 1;
198 virtual_dma_port = io;
199 virtual_dma_mode = (mode == DMA_MODE_WRITE);
200 virtual_dma_addr = addr;
201 virtual_dma_count = size;
202 virtual_dma_residue = 0;
203 return 0;
204}
205
206static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
207{
208#ifdef FLOPPY_SANITY_CHECK
209 if (CROSS_64KB(addr, size)) {
210 printk("DMA crossing 64-K boundary %p-%p\n", addr, addr+size);
211 return -1;
212 }
213#endif
214 /* actual, physical DMA */
215 doing_pdma = 0;
216 clear_dma_ff(FLOPPY_DMA);
217 set_dma_mode(FLOPPY_DMA, mode);
218 set_dma_addr(FLOPPY_DMA, isa_virt_to_bus(addr));
219 set_dma_count(FLOPPY_DMA, size);
220 enable_dma(FLOPPY_DMA);
221 return 0;
222}
223
224static struct fd_routine_l {
225 int (*_request_dma)(unsigned int dmanr, const char *device_id);
226 void (*_free_dma)(unsigned int dmanr);
227 int (*_get_dma_residue)(unsigned int dummy);
228 unsigned long (*_dma_mem_alloc)(unsigned long size);
229 int (*_dma_setup)(char *addr, unsigned long size, int mode, int io);
230} fd_routine[] = {
231 {
232 request_dma,
233 free_dma,
234 get_dma_residue,
235 dma_mem_alloc,
236 hard_dma_setup
237 },
238 {
239 vdma_request_dma,
240 vdma_nop,
241 vdma_get_dma_residue,
242 vdma_mem_alloc,
243 vdma_dma_setup
244 }
245};
246
247
248static int FDC1 = 0x3f0;
249static int FDC2 = -1;
250
251/*
252 * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock
253 * is needed to prevent corrupted CMOS RAM in case "insmod floppy"
254 * coincides with another rtc CMOS user. Paul G.
255 */
256#define FLOPPY0_TYPE \
257({ \
258 unsigned long flags; \
259 unsigned char val; \
260 spin_lock_irqsave(&rtc_lock, flags); \
261 val = (CMOS_READ(0x10) >> 4) & 15; \
262 spin_unlock_irqrestore(&rtc_lock, flags); \
263 val; \
264})
265
266#define FLOPPY1_TYPE \
267({ \
268 unsigned long flags; \
269 unsigned char val; \
270 spin_lock_irqsave(&rtc_lock, flags); \
271 val = CMOS_READ(0x10) & 15; \
272 spin_unlock_irqrestore(&rtc_lock, flags); \
273 val; \
274})
275
276#define N_FDC 2
277#define N_DRIVE 8
278
279#define EXTRA_FLOPPY_PARAMS
280
281#endif /* _ASM_X86_FLOPPY_H */
diff --git a/include/asm-x86/frame.h b/include/asm-x86/frame.h
deleted file mode 100644
index 06850a7194e1..000000000000
--- a/include/asm-x86/frame.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifdef __ASSEMBLY__
2
3#include <asm/dwarf2.h>
4
5/* The annotation hides the frame from the unwinder and makes it look
6 like a ordinary ebp save/restore. This avoids some special cases for
7 frame pointer later */
8#ifdef CONFIG_FRAME_POINTER
9 .macro FRAME
10 pushl %ebp
11 CFI_ADJUST_CFA_OFFSET 4
12 CFI_REL_OFFSET ebp,0
13 movl %esp,%ebp
14 .endm
15 .macro ENDFRAME
16 popl %ebp
17 CFI_ADJUST_CFA_OFFSET -4
18 CFI_RESTORE ebp
19 .endm
20#else
21 .macro FRAME
22 .endm
23 .macro ENDFRAME
24 .endm
25#endif
26
27#endif /* __ASSEMBLY__ */
diff --git a/include/asm-x86/ftrace.h b/include/asm-x86/ftrace.h
deleted file mode 100644
index 5c68b32ee1c8..000000000000
--- a/include/asm-x86/ftrace.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_X86_FTRACE
2#define _ASM_X86_FTRACE
3
4#ifdef CONFIG_FTRACE
5#define MCOUNT_ADDR ((long)(mcount))
6#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
7
8#ifndef __ASSEMBLY__
9extern void mcount(void);
10#endif
11
12#endif /* CONFIG_FTRACE */
13
14#endif /* _ASM_X86_FTRACE */
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h
deleted file mode 100644
index e7a76b37b333..000000000000
--- a/include/asm-x86/futex.h
+++ /dev/null
@@ -1,140 +0,0 @@
1#ifndef _ASM_X86_FUTEX_H
2#define _ASM_X86_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <linux/uaccess.h>
8
9#include <asm/asm.h>
10#include <asm/errno.h>
11#include <asm/processor.h>
12#include <asm/system.h>
13
14#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
15 asm volatile("1:\t" insn "\n" \
16 "2:\t.section .fixup,\"ax\"\n" \
17 "3:\tmov\t%3, %1\n" \
18 "\tjmp\t2b\n" \
19 "\t.previous\n" \
20 _ASM_EXTABLE(1b, 3b) \
21 : "=r" (oldval), "=r" (ret), "+m" (*uaddr) \
22 : "i" (-EFAULT), "0" (oparg), "1" (0))
23
24#define __futex_atomic_op2(insn, ret, oldval, uaddr, oparg) \
25 asm volatile("1:\tmovl %2, %0\n" \
26 "\tmovl\t%0, %3\n" \
27 "\t" insn "\n" \
28 "2:\tlock; cmpxchgl %3, %2\n" \
29 "\tjnz\t1b\n" \
30 "3:\t.section .fixup,\"ax\"\n" \
31 "4:\tmov\t%5, %1\n" \
32 "\tjmp\t3b\n" \
33 "\t.previous\n" \
34 _ASM_EXTABLE(1b, 4b) \
35 _ASM_EXTABLE(2b, 4b) \
36 : "=&a" (oldval), "=&r" (ret), \
37 "+m" (*uaddr), "=&r" (tem) \
38 : "r" (oparg), "i" (-EFAULT), "1" (0))
39
40static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
41{
42 int op = (encoded_op >> 28) & 7;
43 int cmp = (encoded_op >> 24) & 15;
44 int oparg = (encoded_op << 8) >> 20;
45 int cmparg = (encoded_op << 20) >> 20;
46 int oldval = 0, ret, tem;
47
48 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
49 oparg = 1 << oparg;
50
51 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
52 return -EFAULT;
53
54#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
55 /* Real i386 machines can only support FUTEX_OP_SET */
56 if (op != FUTEX_OP_SET && boot_cpu_data.x86 == 3)
57 return -ENOSYS;
58#endif
59
60 pagefault_disable();
61
62 switch (op) {
63 case FUTEX_OP_SET:
64 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
65 break;
66 case FUTEX_OP_ADD:
67 __futex_atomic_op1("lock; xaddl %0, %2", ret, oldval,
68 uaddr, oparg);
69 break;
70 case FUTEX_OP_OR:
71 __futex_atomic_op2("orl %4, %3", ret, oldval, uaddr, oparg);
72 break;
73 case FUTEX_OP_ANDN:
74 __futex_atomic_op2("andl %4, %3", ret, oldval, uaddr, ~oparg);
75 break;
76 case FUTEX_OP_XOR:
77 __futex_atomic_op2("xorl %4, %3", ret, oldval, uaddr, oparg);
78 break;
79 default:
80 ret = -ENOSYS;
81 }
82
83 pagefault_enable();
84
85 if (!ret) {
86 switch (cmp) {
87 case FUTEX_OP_CMP_EQ:
88 ret = (oldval == cmparg);
89 break;
90 case FUTEX_OP_CMP_NE:
91 ret = (oldval != cmparg);
92 break;
93 case FUTEX_OP_CMP_LT:
94 ret = (oldval < cmparg);
95 break;
96 case FUTEX_OP_CMP_GE:
97 ret = (oldval >= cmparg);
98 break;
99 case FUTEX_OP_CMP_LE:
100 ret = (oldval <= cmparg);
101 break;
102 case FUTEX_OP_CMP_GT:
103 ret = (oldval > cmparg);
104 break;
105 default:
106 ret = -ENOSYS;
107 }
108 }
109 return ret;
110}
111
112static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
113 int newval)
114{
115
116#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP)
117 /* Real i386 machines have no cmpxchg instruction */
118 if (boot_cpu_data.x86 == 3)
119 return -ENOSYS;
120#endif
121
122 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
123 return -EFAULT;
124
125 asm volatile("1:\tlock; cmpxchgl %3, %1\n"
126 "2:\t.section .fixup, \"ax\"\n"
127 "3:\tmov %2, %0\n"
128 "\tjmp 2b\n"
129 "\t.previous\n"
130 _ASM_EXTABLE(1b, 3b)
131 : "=a" (oldval), "+m" (*uaddr)
132 : "i" (-EFAULT), "r" (newval), "0" (oldval)
133 : "memory"
134 );
135
136 return oldval;
137}
138
139#endif
140#endif
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
deleted file mode 100644
index 3f62a83887f3..000000000000
--- a/include/asm-x86/gart.h
+++ /dev/null
@@ -1,71 +0,0 @@
1#ifndef _ASM_X8664_GART_H
2#define _ASM_X8664_GART_H 1
3
4#include <asm/e820.h>
5
6extern void set_up_gart_resume(u32, u32);
7
8extern int fallback_aper_order;
9extern int fallback_aper_force;
10extern int fix_aperture;
11
12/* PTE bits. */
13#define GPTE_VALID 1
14#define GPTE_COHERENT 2
15
16/* Aperture control register bits. */
17#define GARTEN (1<<0)
18#define DISGARTCPU (1<<4)
19#define DISGARTIO (1<<5)
20
21/* GART cache control register bits. */
22#define INVGART (1<<0)
23#define GARTPTEERR (1<<1)
24
25/* K8 On-cpu GART registers */
26#define AMD64_GARTAPERTURECTL 0x90
27#define AMD64_GARTAPERTUREBASE 0x94
28#define AMD64_GARTTABLEBASE 0x98
29#define AMD64_GARTCACHECTL 0x9c
30#define AMD64_GARTEN (1<<0)
31
32static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
33{
34 u32 tmp, ctl;
35
36 /* address of the mappings table */
37 addr >>= 12;
38 tmp = (u32) addr<<4;
39 tmp &= ~0xf;
40 pci_write_config_dword(dev, AMD64_GARTTABLEBASE, tmp);
41
42 /* Enable GART translation for this hammer. */
43 pci_read_config_dword(dev, AMD64_GARTAPERTURECTL, &ctl);
44 ctl |= GARTEN;
45 ctl &= ~(DISGARTCPU | DISGARTIO);
46 pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
47}
48
49static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
50{
51 if (!aper_base)
52 return 0;
53
54 if (aper_base + aper_size > 0x100000000ULL) {
55 printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n");
56 return 0;
57 }
58 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
59 printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n");
60 return 0;
61 }
62 if (aper_size < min_size) {
63 printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n",
64 aper_size>>20, min_size>>20);
65 return 0;
66 }
67
68 return 1;
69}
70
71#endif
diff --git a/include/asm-x86/genapic.h b/include/asm-x86/genapic.h
deleted file mode 100644
index d48bee663a6f..000000000000
--- a/include/asm-x86/genapic.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "genapic_32.h"
3#else
4# include "genapic_64.h"
5#endif
diff --git a/include/asm-x86/genapic_32.h b/include/asm-x86/genapic_32.h
deleted file mode 100644
index 754d635f90ff..000000000000
--- a/include/asm-x86/genapic_32.h
+++ /dev/null
@@ -1,124 +0,0 @@
1#ifndef _ASM_GENAPIC_H
2#define _ASM_GENAPIC_H 1
3
4#include <asm/mpspec.h>
5
6/*
7 * Generic APIC driver interface.
8 *
9 * An straight forward mapping of the APIC related parts of the
10 * x86 subarchitecture interface to a dynamic object.
11 *
12 * This is used by the "generic" x86 subarchitecture.
13 *
14 * Copyright 2003 Andi Kleen, SuSE Labs.
15 */
16
17struct mpc_config_bus;
18struct mp_config_table;
19struct mpc_config_processor;
20
21struct genapic {
22 char *name;
23 int (*probe)(void);
24
25 int (*apic_id_registered)(void);
26 cpumask_t (*target_cpus)(void);
27 int int_delivery_mode;
28 int int_dest_mode;
29 int ESR_DISABLE;
30 int apic_destination_logical;
31 unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
32 unsigned long (*check_apicid_present)(int apicid);
33 int no_balance_irq;
34 int no_ioapic_check;
35 void (*init_apic_ldr)(void);
36 physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
37
38 void (*setup_apic_routing)(void);
39 int (*multi_timer_check)(int apic, int irq);
40 int (*apicid_to_node)(int logical_apicid);
41 int (*cpu_to_logical_apicid)(int cpu);
42 int (*cpu_present_to_apicid)(int mps_cpu);
43 physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
44 void (*setup_portio_remap)(void);
45 int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
46 void (*enable_apic_mode)(void);
47 u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
48
49 /* mpparse */
50 /* When one of the next two hooks returns 1 the genapic
51 is switched to this. Essentially they are additional probe
52 functions. */
53 int (*mps_oem_check)(struct mp_config_table *mpc, char *oem,
54 char *productid);
55 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
56
57 unsigned (*get_apic_id)(unsigned long x);
58 unsigned long apic_id_mask;
59 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
60
61#ifdef CONFIG_SMP
62 /* ipi */
63 void (*send_IPI_mask)(cpumask_t mask, int vector);
64 void (*send_IPI_allbutself)(int vector);
65 void (*send_IPI_all)(int vector);
66#endif
67};
68
69#define APICFUNC(x) .x = x,
70
71/* More functions could be probably marked IPIFUNC and save some space
72 in UP GENERICARCH kernels, but I don't have the nerve right now
73 to untangle this mess. -AK */
74#ifdef CONFIG_SMP
75#define IPIFUNC(x) APICFUNC(x)
76#else
77#define IPIFUNC(x)
78#endif
79
80#define APIC_INIT(aname, aprobe) \
81{ \
82 .name = aname, \
83 .probe = aprobe, \
84 .int_delivery_mode = INT_DELIVERY_MODE, \
85 .int_dest_mode = INT_DEST_MODE, \
86 .no_balance_irq = NO_BALANCE_IRQ, \
87 .ESR_DISABLE = esr_disable, \
88 .apic_destination_logical = APIC_DEST_LOGICAL, \
89 APICFUNC(apic_id_registered) \
90 APICFUNC(target_cpus) \
91 APICFUNC(check_apicid_used) \
92 APICFUNC(check_apicid_present) \
93 APICFUNC(init_apic_ldr) \
94 APICFUNC(ioapic_phys_id_map) \
95 APICFUNC(setup_apic_routing) \
96 APICFUNC(multi_timer_check) \
97 APICFUNC(apicid_to_node) \
98 APICFUNC(cpu_to_logical_apicid) \
99 APICFUNC(cpu_present_to_apicid) \
100 APICFUNC(apicid_to_cpu_present) \
101 APICFUNC(setup_portio_remap) \
102 APICFUNC(check_phys_apicid_present) \
103 APICFUNC(mps_oem_check) \
104 APICFUNC(get_apic_id) \
105 .apic_id_mask = APIC_ID_MASK, \
106 APICFUNC(cpu_mask_to_apicid) \
107 APICFUNC(acpi_madt_oem_check) \
108 IPIFUNC(send_IPI_mask) \
109 IPIFUNC(send_IPI_allbutself) \
110 IPIFUNC(send_IPI_all) \
111 APICFUNC(enable_apic_mode) \
112 APICFUNC(phys_pkg_id) \
113}
114
115extern struct genapic *genapic;
116
117enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
118#define get_uv_system_type() UV_NONE
119#define is_uv_system() 0
120#define uv_wakeup_secondary(a, b) 1
121#define uv_system_init() do {} while (0)
122
123
124#endif
diff --git a/include/asm-x86/genapic_64.h b/include/asm-x86/genapic_64.h
deleted file mode 100644
index a47d63129135..000000000000
--- a/include/asm-x86/genapic_64.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _ASM_GENAPIC_H
2#define _ASM_GENAPIC_H 1
3
4/*
5 * Copyright 2004 James Cleverdon, IBM.
6 * Subject to the GNU Public License, v.2
7 *
8 * Generic APIC sub-arch data struct.
9 *
10 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
11 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
12 * James Cleverdon.
13 */
14
15struct genapic {
16 char *name;
17 u32 int_delivery_mode;
18 u32 int_dest_mode;
19 int (*apic_id_registered)(void);
20 cpumask_t (*target_cpus)(void);
21 cpumask_t (*vector_allocation_domain)(int cpu);
22 void (*init_apic_ldr)(void);
23 /* ipi */
24 void (*send_IPI_mask)(cpumask_t mask, int vector);
25 void (*send_IPI_allbutself)(int vector);
26 void (*send_IPI_all)(int vector);
27 /* */
28 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
29 unsigned int (*phys_pkg_id)(int index_msb);
30};
31
32extern struct genapic *genapic;
33
34extern struct genapic apic_flat;
35extern struct genapic apic_physflat;
36extern int acpi_madt_oem_check(char *, char *);
37
38enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
39extern enum uv_system_type get_uv_system_type(void);
40extern int is_uv_system(void);
41
42extern struct genapic apic_x2apic_uv_x;
43DECLARE_PER_CPU(int, x2apic_extra_bits);
44extern void uv_cpu_init(void);
45extern void uv_system_init(void);
46extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
47
48extern void setup_apic_routing(void);
49
50#endif
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h
deleted file mode 100644
index 2c1cda0b8a86..000000000000
--- a/include/asm-x86/geode.h
+++ /dev/null
@@ -1,253 +0,0 @@
1/*
2 * AMD Geode definitions
3 * Copyright (C) 2006, Advanced Micro Devices, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
8 */
9
10#ifndef _ASM_GEODE_H_
11#define _ASM_GEODE_H_
12
13#include <asm/processor.h>
14#include <linux/io.h>
15
16/* Generic southbridge functions */
17
18#define GEODE_DEV_PMS 0
19#define GEODE_DEV_ACPI 1
20#define GEODE_DEV_GPIO 2
21#define GEODE_DEV_MFGPT 3
22
23extern int geode_get_dev_base(unsigned int dev);
24
25/* Useful macros */
26#define geode_pms_base() geode_get_dev_base(GEODE_DEV_PMS)
27#define geode_acpi_base() geode_get_dev_base(GEODE_DEV_ACPI)
28#define geode_gpio_base() geode_get_dev_base(GEODE_DEV_GPIO)
29#define geode_mfgpt_base() geode_get_dev_base(GEODE_DEV_MFGPT)
30
31/* MSRS */
32
33#define MSR_GLIU_P2D_RO0 0x10000029
34
35#define MSR_LX_GLD_MSR_CONFIG 0x48002001
36#define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data
37 * sheet has the wrong value */
38#define MSR_GLCP_SYS_RSTPLL 0x4C000014
39#define MSR_GLCP_DOTPLL 0x4C000015
40
41#define MSR_LBAR_SMB 0x5140000B
42#define MSR_LBAR_GPIO 0x5140000C
43#define MSR_LBAR_MFGPT 0x5140000D
44#define MSR_LBAR_ACPI 0x5140000E
45#define MSR_LBAR_PMS 0x5140000F
46
47#define MSR_DIVIL_SOFT_RESET 0x51400017
48
49#define MSR_PIC_YSEL_LOW 0x51400020
50#define MSR_PIC_YSEL_HIGH 0x51400021
51#define MSR_PIC_ZSEL_LOW 0x51400022
52#define MSR_PIC_ZSEL_HIGH 0x51400023
53#define MSR_PIC_IRQM_LPC 0x51400025
54
55#define MSR_MFGPT_IRQ 0x51400028
56#define MSR_MFGPT_NR 0x51400029
57#define MSR_MFGPT_SETUP 0x5140002B
58
59#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
60
61#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
62#define MSR_GX_MSR_PADSEL 0xC0002011
63
64/* Resource Sizes */
65
66#define LBAR_GPIO_SIZE 0xFF
67#define LBAR_MFGPT_SIZE 0x40
68#define LBAR_ACPI_SIZE 0x40
69#define LBAR_PMS_SIZE 0x80
70
71/* ACPI registers (PMS block) */
72
73/*
74 * PM1_EN is only valid when VSA is enabled for 16 bit reads.
75 * When VSA is not enabled, *always* read both PM1_STS and PM1_EN
76 * with a 32 bit read at offset 0x0
77 */
78
79#define PM1_STS 0x00
80#define PM1_EN 0x02
81#define PM1_CNT 0x08
82#define PM2_CNT 0x0C
83#define PM_TMR 0x10
84#define PM_GPE0_STS 0x18
85#define PM_GPE0_EN 0x1C
86
87/* PMC registers (PMS block) */
88
89#define PM_SSD 0x00
90#define PM_SCXA 0x04
91#define PM_SCYA 0x08
92#define PM_OUT_SLPCTL 0x0C
93#define PM_SCLK 0x10
94#define PM_SED 0x1
95#define PM_SCXD 0x18
96#define PM_SCYD 0x1C
97#define PM_IN_SLPCTL 0x20
98#define PM_WKD 0x30
99#define PM_WKXD 0x34
100#define PM_RD 0x38
101#define PM_WKXA 0x3C
102#define PM_FSD 0x40
103#define PM_TSD 0x44
104#define PM_PSD 0x48
105#define PM_NWKD 0x4C
106#define PM_AWKD 0x50
107#define PM_SSC 0x54
108
109/* VSA2 magic values */
110
111#define VSA_VRC_INDEX 0xAC1C
112#define VSA_VRC_DATA 0xAC1E
113#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
114#define VSA_VR_SIGNATURE 0x0003
115#define VSA_VR_MEM_SIZE 0x0200
116#define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
117#define GSW_VSA_SIG 0x534d /* General Software signature */
118/* GPIO */
119
120#define GPIO_OUTPUT_VAL 0x00
121#define GPIO_OUTPUT_ENABLE 0x04
122#define GPIO_OUTPUT_OPEN_DRAIN 0x08
123#define GPIO_OUTPUT_INVERT 0x0C
124#define GPIO_OUTPUT_AUX1 0x10
125#define GPIO_OUTPUT_AUX2 0x14
126#define GPIO_PULL_UP 0x18
127#define GPIO_PULL_DOWN 0x1C
128#define GPIO_INPUT_ENABLE 0x20
129#define GPIO_INPUT_INVERT 0x24
130#define GPIO_INPUT_FILTER 0x28
131#define GPIO_INPUT_EVENT_COUNT 0x2C
132#define GPIO_READ_BACK 0x30
133#define GPIO_INPUT_AUX1 0x34
134#define GPIO_EVENTS_ENABLE 0x38
135#define GPIO_LOCK_ENABLE 0x3C
136#define GPIO_POSITIVE_EDGE_EN 0x40
137#define GPIO_NEGATIVE_EDGE_EN 0x44
138#define GPIO_POSITIVE_EDGE_STS 0x48
139#define GPIO_NEGATIVE_EDGE_STS 0x4C
140
141#define GPIO_MAP_X 0xE0
142#define GPIO_MAP_Y 0xE4
143#define GPIO_MAP_Z 0xE8
144#define GPIO_MAP_W 0xEC
145
146static inline u32 geode_gpio(unsigned int nr)
147{
148 BUG_ON(nr > 28);
149 return 1 << nr;
150}
151
152extern void geode_gpio_set(u32, unsigned int);
153extern void geode_gpio_clear(u32, unsigned int);
154extern int geode_gpio_isset(u32, unsigned int);
155extern void geode_gpio_setup_event(unsigned int, int, int);
156extern void geode_gpio_set_irq(unsigned int, unsigned int);
157
158static inline void geode_gpio_event_irq(unsigned int gpio, int pair)
159{
160 geode_gpio_setup_event(gpio, pair, 0);
161}
162
163static inline void geode_gpio_event_pme(unsigned int gpio, int pair)
164{
165 geode_gpio_setup_event(gpio, pair, 1);
166}
167
168/* Specific geode tests */
169
170static inline int is_geode_gx(void)
171{
172 return ((boot_cpu_data.x86_vendor == X86_VENDOR_NSC) &&
173 (boot_cpu_data.x86 == 5) &&
174 (boot_cpu_data.x86_model == 5));
175}
176
177static inline int is_geode_lx(void)
178{
179 return ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
180 (boot_cpu_data.x86 == 5) &&
181 (boot_cpu_data.x86_model == 10));
182}
183
184static inline int is_geode(void)
185{
186 return (is_geode_gx() || is_geode_lx());
187}
188
189#ifdef CONFIG_MGEODE_LX
190extern int geode_has_vsa2(void);
191#else
192static inline int geode_has_vsa2(void)
193{
194 return 0;
195}
196#endif
197
198/* MFGPTs */
199
200#define MFGPT_MAX_TIMERS 8
201#define MFGPT_TIMER_ANY (-1)
202
203#define MFGPT_DOMAIN_WORKING 1
204#define MFGPT_DOMAIN_STANDBY 2
205#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
206
207#define MFGPT_CMP1 0
208#define MFGPT_CMP2 1
209
210#define MFGPT_EVENT_IRQ 0
211#define MFGPT_EVENT_NMI 1
212#define MFGPT_EVENT_RESET 3
213
214#define MFGPT_REG_CMP1 0
215#define MFGPT_REG_CMP2 2
216#define MFGPT_REG_COUNTER 4
217#define MFGPT_REG_SETUP 6
218
219#define MFGPT_SETUP_CNTEN (1 << 15)
220#define MFGPT_SETUP_CMP2 (1 << 14)
221#define MFGPT_SETUP_CMP1 (1 << 13)
222#define MFGPT_SETUP_SETUP (1 << 12)
223#define MFGPT_SETUP_STOPEN (1 << 11)
224#define MFGPT_SETUP_EXTEN (1 << 10)
225#define MFGPT_SETUP_REVEN (1 << 5)
226#define MFGPT_SETUP_CLKSEL (1 << 4)
227
228static inline void geode_mfgpt_write(int timer, u16 reg, u16 value)
229{
230 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);
231 outw(value, base + reg + (timer * 8));
232}
233
234static inline u16 geode_mfgpt_read(int timer, u16 reg)
235{
236 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);
237 return inw(base + reg + (timer * 8));
238}
239
240extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable);
241extern int geode_mfgpt_set_irq(int timer, int cmp, int *irq, int enable);
242extern int geode_mfgpt_alloc_timer(int timer, int domain);
243
244#define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
245#define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0)
246
247#ifdef CONFIG_GEODE_MFGPT_TIMER
248extern int __init mfgpt_timer_setup(void);
249#else
250static inline int mfgpt_timer_setup(void) { return 0; }
251#endif
252
253#endif
diff --git a/include/asm-x86/gpio.h b/include/asm-x86/gpio.h
deleted file mode 100644
index c4c91b37c104..000000000000
--- a/include/asm-x86/gpio.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Generic GPIO API implementation for x86.
3 *
4 * Derived from the generic GPIO API for powerpc:
5 *
6 * Copyright (c) 2007-2008 MontaVista Software, Inc.
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License 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 _ASM_I386_GPIO_H
17#define _ASM_I386_GPIO_H
18
19#include <asm-generic/gpio.h>
20
21#ifdef CONFIG_GPIOLIB
22
23/*
24 * Just call gpiolib.
25 */
26static inline int gpio_get_value(unsigned int gpio)
27{
28 return __gpio_get_value(gpio);
29}
30
31static inline void gpio_set_value(unsigned int gpio, int value)
32{
33 __gpio_set_value(gpio, value);
34}
35
36static inline int gpio_cansleep(unsigned int gpio)
37{
38 return __gpio_cansleep(gpio);
39}
40
41/*
42 * Not implemented, yet.
43 */
44static inline int gpio_to_irq(unsigned int gpio)
45{
46 return -ENOSYS;
47}
48
49static inline int irq_to_gpio(unsigned int irq)
50{
51 return -EINVAL;
52}
53
54#endif /* CONFIG_GPIOLIB */
55
56#endif /* _ASM_I386_GPIO_H */
diff --git a/include/asm-x86/hardirq.h b/include/asm-x86/hardirq.h
deleted file mode 100644
index 000787df66e6..000000000000
--- a/include/asm-x86/hardirq.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "hardirq_32.h"
3#else
4# include "hardirq_64.h"
5#endif
6
7extern u64 arch_irq_stat_cpu(unsigned int cpu);
8#define arch_irq_stat_cpu arch_irq_stat_cpu
9
10extern u64 arch_irq_stat(void);
11#define arch_irq_stat arch_irq_stat
diff --git a/include/asm-x86/hardirq_32.h b/include/asm-x86/hardirq_32.h
deleted file mode 100644
index 4f85f0f4b563..000000000000
--- a/include/asm-x86/hardirq_32.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef __ASM_HARDIRQ_H
2#define __ASM_HARDIRQ_H
3
4#include <linux/threads.h>
5#include <linux/irq.h>
6
7typedef struct {
8 unsigned int __softirq_pending;
9 unsigned long idle_timestamp;
10 unsigned int __nmi_count; /* arch dependent */
11 unsigned int apic_timer_irqs; /* arch dependent */
12 unsigned int irq0_irqs;
13 unsigned int irq_resched_count;
14 unsigned int irq_call_count;
15 unsigned int irq_tlb_count;
16 unsigned int irq_thermal_count;
17 unsigned int irq_spurious_count;
18} ____cacheline_aligned irq_cpustat_t;
19
20DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
21
22#define __ARCH_IRQ_STAT
23#define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member)
24
25void ack_bad_irq(unsigned int irq);
26#include <linux/irq_cpustat.h>
27
28#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-x86/hardirq_64.h b/include/asm-x86/hardirq_64.h
deleted file mode 100644
index 95d5e090ed89..000000000000
--- a/include/asm-x86/hardirq_64.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __ASM_HARDIRQ_H
2#define __ASM_HARDIRQ_H
3
4#include <linux/threads.h>
5#include <linux/irq.h>
6#include <asm/pda.h>
7#include <asm/apic.h>
8
9/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
10#define MAX_HARDIRQS_PER_CPU NR_VECTORS
11
12#define __ARCH_IRQ_STAT 1
13
14#define local_softirq_pending() read_pda(__softirq_pending)
15
16#define __ARCH_SET_SOFTIRQ_PENDING 1
17
18#define set_softirq_pending(x) write_pda(__softirq_pending, (x))
19#define or_softirq_pending(x) or_pda(__softirq_pending, (x))
20
21extern void ack_bad_irq(unsigned int irq);
22
23#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-x86/highmem.h b/include/asm-x86/highmem.h
deleted file mode 100644
index 4514b16cc723..000000000000
--- a/include/asm-x86/highmem.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * highmem.h: virtual kernel memory mappings for high memory
3 *
4 * Used in CONFIG_HIGHMEM systems for memory pages which
5 * are not addressable by direct kernel virtual addresses.
6 *
7 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
8 * Gerhard.Wichert@pdb.siemens.de
9 *
10 *
11 * Redesigned the x86 32-bit VM architecture to deal with
12 * up to 16 Terabyte physical memory. With current x86 CPUs
13 * we now support up to 64 Gigabytes physical RAM.
14 *
15 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
16 */
17
18#ifndef _ASM_HIGHMEM_H
19#define _ASM_HIGHMEM_H
20
21#ifdef __KERNEL__
22
23#include <linux/interrupt.h>
24#include <linux/threads.h>
25#include <asm/kmap_types.h>
26#include <asm/tlbflush.h>
27#include <asm/paravirt.h>
28
29/* declarations for highmem.c */
30extern unsigned long highstart_pfn, highend_pfn;
31
32extern pte_t *kmap_pte;
33extern pgprot_t kmap_prot;
34extern pte_t *pkmap_page_table;
35
36/*
37 * Right now we initialize only a single pte table. It can be extended
38 * easily, subsequent pte tables have to be allocated in one physical
39 * chunk of RAM.
40 */
41/*
42 * Ordering is:
43 *
44 * FIXADDR_TOP
45 * fixed_addresses
46 * FIXADDR_START
47 * temp fixed addresses
48 * FIXADDR_BOOT_START
49 * Persistent kmap area
50 * PKMAP_BASE
51 * VMALLOC_END
52 * Vmalloc area
53 * VMALLOC_START
54 * high_memory
55 */
56#define LAST_PKMAP_MASK (LAST_PKMAP-1)
57#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
58#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
59
60extern void *kmap_high(struct page *page);
61extern void kunmap_high(struct page *page);
62
63void *kmap(struct page *page);
64void kunmap(struct page *page);
65void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot);
66void *kmap_atomic(struct page *page, enum km_type type);
67void kunmap_atomic(void *kvaddr, enum km_type type);
68void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
69struct page *kmap_atomic_to_page(void *ptr);
70
71#ifndef CONFIG_PARAVIRT
72#define kmap_atomic_pte(page, type) kmap_atomic(page, type)
73#endif
74
75#define flush_cache_kmaps() do { } while (0)
76
77extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,
78 unsigned long end_pfn);
79
80#endif /* __KERNEL__ */
81
82#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-x86/hpet.h b/include/asm-x86/hpet.h
deleted file mode 100644
index 82f1ac641bd7..000000000000
--- a/include/asm-x86/hpet.h
+++ /dev/null
@@ -1,93 +0,0 @@
1#ifndef ASM_X86_HPET_H
2#define ASM_X86_HPET_H
3
4#ifdef CONFIG_HPET_TIMER
5
6#define HPET_MMAP_SIZE 1024
7
8#define HPET_ID 0x000
9#define HPET_PERIOD 0x004
10#define HPET_CFG 0x010
11#define HPET_STATUS 0x020
12#define HPET_COUNTER 0x0f0
13#define HPET_T0_CFG 0x100
14#define HPET_T0_CMP 0x108
15#define HPET_T0_ROUTE 0x110
16#define HPET_T1_CFG 0x120
17#define HPET_T1_CMP 0x128
18#define HPET_T1_ROUTE 0x130
19#define HPET_T2_CFG 0x140
20#define HPET_T2_CMP 0x148
21#define HPET_T2_ROUTE 0x150
22
23#define HPET_ID_REV 0x000000ff
24#define HPET_ID_NUMBER 0x00001f00
25#define HPET_ID_64BIT 0x00002000
26#define HPET_ID_LEGSUP 0x00008000
27#define HPET_ID_VENDOR 0xffff0000
28#define HPET_ID_NUMBER_SHIFT 8
29#define HPET_ID_VENDOR_SHIFT 16
30
31#define HPET_ID_VENDOR_8086 0x8086
32
33#define HPET_CFG_ENABLE 0x001
34#define HPET_CFG_LEGACY 0x002
35#define HPET_LEGACY_8254 2
36#define HPET_LEGACY_RTC 8
37
38#define HPET_TN_LEVEL 0x0002
39#define HPET_TN_ENABLE 0x0004
40#define HPET_TN_PERIODIC 0x0008
41#define HPET_TN_PERIODIC_CAP 0x0010
42#define HPET_TN_64BIT_CAP 0x0020
43#define HPET_TN_SETVAL 0x0040
44#define HPET_TN_32BIT 0x0100
45#define HPET_TN_ROUTE 0x3e00
46#define HPET_TN_FSB 0x4000
47#define HPET_TN_FSB_CAP 0x8000
48#define HPET_TN_ROUTE_SHIFT 9
49
50/* Max HPET Period is 10^8 femto sec as in HPET spec */
51#define HPET_MAX_PERIOD 100000000UL
52/*
53 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
54 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
55 */
56#define HPET_MIN_PERIOD 100000UL
57
58/* hpet memory map physical address */
59extern unsigned long hpet_address;
60extern unsigned long force_hpet_address;
61extern int hpet_force_user;
62extern int is_hpet_enabled(void);
63extern int hpet_enable(void);
64extern void hpet_disable(void);
65extern unsigned long hpet_readl(unsigned long a);
66extern void force_hpet_resume(void);
67
68#ifdef CONFIG_HPET_EMULATE_RTC
69
70#include <linux/interrupt.h>
71
72typedef irqreturn_t (*rtc_irq_handler)(int interrupt, void *cookie);
73extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
74extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
75extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min,
76 unsigned char sec);
77extern int hpet_set_periodic_freq(unsigned long freq);
78extern int hpet_rtc_dropped_irq(void);
79extern int hpet_rtc_timer_init(void);
80extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
81extern int hpet_register_irq_handler(rtc_irq_handler handler);
82extern void hpet_unregister_irq_handler(rtc_irq_handler handler);
83
84#endif /* CONFIG_HPET_EMULATE_RTC */
85
86#else /* CONFIG_HPET_TIMER */
87
88static inline int hpet_enable(void) { return 0; }
89static inline int is_hpet_enabled(void) { return 0; }
90#define hpet_readl(a) 0
91
92#endif
93#endif /* ASM_X86_HPET_H */
diff --git a/include/asm-x86/hugetlb.h b/include/asm-x86/hugetlb.h
deleted file mode 100644
index 439a9acc132d..000000000000
--- a/include/asm-x86/hugetlb.h
+++ /dev/null
@@ -1,93 +0,0 @@
1#ifndef _ASM_X86_HUGETLB_H
2#define _ASM_X86_HUGETLB_H
3
4#include <asm/page.h>
5
6
7static inline int is_hugepage_only_range(struct mm_struct *mm,
8 unsigned long addr,
9 unsigned long len) {
10 return 0;
11}
12
13/*
14 * If the arch doesn't supply something else, assume that hugepage
15 * size aligned regions are ok without further preparation.
16 */
17static inline int prepare_hugepage_range(struct file *file,
18 unsigned long addr, unsigned long len)
19{
20 struct hstate *h = hstate_file(file);
21 if (len & ~huge_page_mask(h))
22 return -EINVAL;
23 if (addr & ~huge_page_mask(h))
24 return -EINVAL;
25 return 0;
26}
27
28static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) {
29}
30
31static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
32 unsigned long addr, unsigned long end,
33 unsigned long floor,
34 unsigned long ceiling)
35{
36 free_pgd_range(tlb, addr, end, floor, ceiling);
37}
38
39static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
40 pte_t *ptep, pte_t pte)
41{
42 set_pte_at(mm, addr, ptep, pte);
43}
44
45static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
46 unsigned long addr, pte_t *ptep)
47{
48 return ptep_get_and_clear(mm, addr, ptep);
49}
50
51static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
52 unsigned long addr, pte_t *ptep)
53{
54}
55
56static inline int huge_pte_none(pte_t pte)
57{
58 return pte_none(pte);
59}
60
61static inline pte_t huge_pte_wrprotect(pte_t pte)
62{
63 return pte_wrprotect(pte);
64}
65
66static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
67 unsigned long addr, pte_t *ptep)
68{
69 ptep_set_wrprotect(mm, addr, ptep);
70}
71
72static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
73 unsigned long addr, pte_t *ptep,
74 pte_t pte, int dirty)
75{
76 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
77}
78
79static inline pte_t huge_ptep_get(pte_t *ptep)
80{
81 return *ptep;
82}
83
84static inline int arch_prepare_hugepage(struct page *page)
85{
86 return 0;
87}
88
89static inline void arch_release_hugepage(struct page *page)
90{
91}
92
93#endif /* _ASM_X86_HUGETLB_H */
diff --git a/include/asm-x86/hw_irq.h b/include/asm-x86/hw_irq.h
deleted file mode 100644
index edd0b95f14d0..000000000000
--- a/include/asm-x86/hw_irq.h
+++ /dev/null
@@ -1,115 +0,0 @@
1#ifndef _ASM_HW_IRQ_H
2#define _ASM_HW_IRQ_H
3
4/*
5 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
6 *
7 * moved some of the old arch/i386/kernel/irq.h to here. VY
8 *
9 * IRQ/IPI changes taken from work by Thomas Radke
10 * <tomsoft@informatik.tu-chemnitz.de>
11 *
12 * hacked by Andi Kleen for x86-64.
13 * unified by tglx
14 */
15
16#include <asm/irq_vectors.h>
17
18#ifndef __ASSEMBLY__
19
20#include <linux/percpu.h>
21#include <linux/profile.h>
22#include <linux/smp.h>
23
24#include <asm/atomic.h>
25#include <asm/irq.h>
26#include <asm/sections.h>
27
28#define platform_legacy_irq(irq) ((irq) < 16)
29
30/* Interrupt handlers registered during init_IRQ */
31extern void apic_timer_interrupt(void);
32extern void error_interrupt(void);
33extern void spurious_interrupt(void);
34extern void thermal_interrupt(void);
35extern void reschedule_interrupt(void);
36
37extern void invalidate_interrupt(void);
38extern void invalidate_interrupt0(void);
39extern void invalidate_interrupt1(void);
40extern void invalidate_interrupt2(void);
41extern void invalidate_interrupt3(void);
42extern void invalidate_interrupt4(void);
43extern void invalidate_interrupt5(void);
44extern void invalidate_interrupt6(void);
45extern void invalidate_interrupt7(void);
46
47extern void irq_move_cleanup_interrupt(void);
48extern void threshold_interrupt(void);
49
50extern void call_function_interrupt(void);
51extern void call_function_single_interrupt(void);
52
53/* PIC specific functions */
54extern void disable_8259A_irq(unsigned int irq);
55extern void enable_8259A_irq(unsigned int irq);
56extern int i8259A_irq_pending(unsigned int irq);
57extern void make_8259A_irq(unsigned int irq);
58extern void init_8259A(int aeoi);
59
60/* IOAPIC */
61#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
62extern unsigned long io_apic_irqs;
63
64extern void init_VISWS_APIC_irqs(void);
65extern void setup_IO_APIC(void);
66extern void disable_IO_APIC(void);
67extern void print_IO_APIC(void);
68extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
69extern void setup_ioapic_dest(void);
70
71#ifdef CONFIG_X86_64
72extern void enable_IO_APIC(void);
73#endif
74
75/* IPI functions */
76extern void send_IPI_self(int vector);
77extern void send_IPI(int dest, int vector);
78
79/* Statistics */
80extern atomic_t irq_err_count;
81extern atomic_t irq_mis_count;
82
83/* EISA */
84extern void eisa_set_level_irq(unsigned int irq);
85
86/* Voyager functions */
87extern asmlinkage void vic_cpi_interrupt(void);
88extern asmlinkage void vic_sys_interrupt(void);
89extern asmlinkage void vic_cmn_interrupt(void);
90extern asmlinkage void qic_timer_interrupt(void);
91extern asmlinkage void qic_invalidate_interrupt(void);
92extern asmlinkage void qic_reschedule_interrupt(void);
93extern asmlinkage void qic_enable_irq_interrupt(void);
94extern asmlinkage void qic_call_function_interrupt(void);
95
96#ifdef CONFIG_X86_32
97extern void (*const interrupt[NR_IRQS])(void);
98#else
99typedef int vector_irq_t[NR_VECTORS];
100DECLARE_PER_CPU(vector_irq_t, vector_irq);
101#endif
102
103#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_X86_64)
104extern void lock_vector_lock(void);
105extern void unlock_vector_lock(void);
106extern void __setup_vector_irq(int cpu);
107#else
108static inline void lock_vector_lock(void) {}
109static inline void unlock_vector_lock(void) {}
110static inline void __setup_vector_irq(int cpu) {}
111#endif
112
113#endif /* !ASSEMBLY_ */
114
115#endif
diff --git a/include/asm-x86/hypertransport.h b/include/asm-x86/hypertransport.h
deleted file mode 100644
index d2bbd238b3e1..000000000000
--- a/include/asm-x86/hypertransport.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef ASM_HYPERTRANSPORT_H
2#define ASM_HYPERTRANSPORT_H
3
4/*
5 * Constants for x86 Hypertransport Interrupts.
6 */
7
8#define HT_IRQ_LOW_BASE 0xf8000000
9
10#define HT_IRQ_LOW_VECTOR_SHIFT 16
11#define HT_IRQ_LOW_VECTOR_MASK 0x00ff0000
12#define HT_IRQ_LOW_VECTOR(v) \
13 (((v) << HT_IRQ_LOW_VECTOR_SHIFT) & HT_IRQ_LOW_VECTOR_MASK)
14
15#define HT_IRQ_LOW_DEST_ID_SHIFT 8
16#define HT_IRQ_LOW_DEST_ID_MASK 0x0000ff00
17#define HT_IRQ_LOW_DEST_ID(v) \
18 (((v) << HT_IRQ_LOW_DEST_ID_SHIFT) & HT_IRQ_LOW_DEST_ID_MASK)
19
20#define HT_IRQ_LOW_DM_PHYSICAL 0x0000000
21#define HT_IRQ_LOW_DM_LOGICAL 0x0000040
22
23#define HT_IRQ_LOW_RQEOI_EDGE 0x0000000
24#define HT_IRQ_LOW_RQEOI_LEVEL 0x0000020
25
26
27#define HT_IRQ_LOW_MT_FIXED 0x0000000
28#define HT_IRQ_LOW_MT_ARBITRATED 0x0000004
29#define HT_IRQ_LOW_MT_SMI 0x0000008
30#define HT_IRQ_LOW_MT_NMI 0x000000c
31#define HT_IRQ_LOW_MT_INIT 0x0000010
32#define HT_IRQ_LOW_MT_STARTUP 0x0000014
33#define HT_IRQ_LOW_MT_EXTINT 0x0000018
34#define HT_IRQ_LOW_MT_LINT1 0x000008c
35#define HT_IRQ_LOW_MT_LINT0 0x0000098
36
37#define HT_IRQ_LOW_IRQ_MASKED 0x0000001
38
39
40#define HT_IRQ_HIGH_DEST_ID_SHIFT 0
41#define HT_IRQ_HIGH_DEST_ID_MASK 0x00ffffff
42#define HT_IRQ_HIGH_DEST_ID(v) \
43 ((((v) >> 8) << HT_IRQ_HIGH_DEST_ID_SHIFT) & HT_IRQ_HIGH_DEST_ID_MASK)
44
45#endif /* ASM_HYPERTRANSPORT_H */
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h
deleted file mode 100644
index 56d00e31aec0..000000000000
--- a/include/asm-x86/i387.h
+++ /dev/null
@@ -1,339 +0,0 @@
1/*
2 * Copyright (C) 1994 Linus Torvalds
3 *
4 * Pentium III FXSR, SSE support
5 * General FPU state handling cleanups
6 * Gareth Hughes <gareth@valinux.com>, May 2000
7 * x86-64 work by Andi Kleen 2002
8 */
9
10#ifndef _ASM_X86_I387_H
11#define _ASM_X86_I387_H
12
13#include <linux/sched.h>
14#include <linux/kernel_stat.h>
15#include <linux/regset.h>
16#include <linux/hardirq.h>
17#include <asm/asm.h>
18#include <asm/processor.h>
19#include <asm/sigcontext.h>
20#include <asm/user.h>
21#include <asm/uaccess.h>
22
23extern void fpu_init(void);
24extern void mxcsr_feature_mask_init(void);
25extern int init_fpu(struct task_struct *child);
26extern asmlinkage void math_state_restore(void);
27extern void init_thread_xstate(void);
28
29extern user_regset_active_fn fpregs_active, xfpregs_active;
30extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get;
31extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set;
32
33#ifdef CONFIG_IA32_EMULATION
34struct _fpstate_ia32;
35extern int save_i387_ia32(struct _fpstate_ia32 __user *buf);
36extern int restore_i387_ia32(struct _fpstate_ia32 __user *buf);
37#endif
38
39#ifdef CONFIG_X86_64
40
41/* Ignore delayed exceptions from user space */
42static inline void tolerant_fwait(void)
43{
44 asm volatile("1: fwait\n"
45 "2:\n"
46 _ASM_EXTABLE(1b, 2b));
47}
48
49static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
50{
51 int err;
52
53 asm volatile("1: rex64/fxrstor (%[fx])\n\t"
54 "2:\n"
55 ".section .fixup,\"ax\"\n"
56 "3: movl $-1,%[err]\n"
57 " jmp 2b\n"
58 ".previous\n"
59 _ASM_EXTABLE(1b, 3b)
60 : [err] "=r" (err)
61#if 0 /* See comment in __save_init_fpu() below. */
62 : [fx] "r" (fx), "m" (*fx), "0" (0));
63#else
64 : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
65#endif
66 return err;
67}
68
69#define X87_FSW_ES (1 << 7) /* Exception Summary */
70
71/* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
72 is pending. Clear the x87 state here by setting it to fixed
73 values. The kernel data segment can be sometimes 0 and sometimes
74 new user value. Both should be ok.
75 Use the PDA as safe address because it should be already in L1. */
76static inline void clear_fpu_state(struct i387_fxsave_struct *fx)
77{
78 if (unlikely(fx->swd & X87_FSW_ES))
79 asm volatile("fnclex");
80 alternative_input(ASM_NOP8 ASM_NOP2,
81 " emms\n" /* clear stack tags */
82 " fildl %%gs:0", /* load to clear state */
83 X86_FEATURE_FXSAVE_LEAK);
84}
85
86static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
87{
88 int err;
89
90 asm volatile("1: rex64/fxsave (%[fx])\n\t"
91 "2:\n"
92 ".section .fixup,\"ax\"\n"
93 "3: movl $-1,%[err]\n"
94 " jmp 2b\n"
95 ".previous\n"
96 _ASM_EXTABLE(1b, 3b)
97 : [err] "=r" (err), "=m" (*fx)
98#if 0 /* See comment in __fxsave_clear() below. */
99 : [fx] "r" (fx), "0" (0));
100#else
101 : [fx] "cdaSDb" (fx), "0" (0));
102#endif
103 if (unlikely(err) &&
104 __clear_user(fx, sizeof(struct i387_fxsave_struct)))
105 err = -EFAULT;
106 /* No need to clear here because the caller clears USED_MATH */
107 return err;
108}
109
110static inline void __save_init_fpu(struct task_struct *tsk)
111{
112 /* Using "rex64; fxsave %0" is broken because, if the memory operand
113 uses any extended registers for addressing, a second REX prefix
114 will be generated (to the assembler, rex64 followed by semicolon
115 is a separate instruction), and hence the 64-bitness is lost. */
116#if 0
117 /* Using "fxsaveq %0" would be the ideal choice, but is only supported
118 starting with gas 2.16. */
119 __asm__ __volatile__("fxsaveq %0"
120 : "=m" (tsk->thread.xstate->fxsave));
121#elif 0
122 /* Using, as a workaround, the properly prefixed form below isn't
123 accepted by any binutils version so far released, complaining that
124 the same type of prefix is used twice if an extended register is
125 needed for addressing (fix submitted to mainline 2005-11-21). */
126 __asm__ __volatile__("rex64/fxsave %0"
127 : "=m" (tsk->thread.xstate->fxsave));
128#else
129 /* This, however, we can work around by forcing the compiler to select
130 an addressing mode that doesn't require extended registers. */
131 __asm__ __volatile__("rex64/fxsave (%1)"
132 : "=m" (tsk->thread.xstate->fxsave)
133 : "cdaSDb" (&tsk->thread.xstate->fxsave));
134#endif
135 clear_fpu_state(&tsk->thread.xstate->fxsave);
136 task_thread_info(tsk)->status &= ~TS_USEDFPU;
137}
138
139#else /* CONFIG_X86_32 */
140
141extern void finit(void);
142
143static inline void tolerant_fwait(void)
144{
145 asm volatile("fnclex ; fwait");
146}
147
148static inline void restore_fpu(struct task_struct *tsk)
149{
150 /*
151 * The "nop" is needed to make the instructions the same
152 * length.
153 */
154 alternative_input(
155 "nop ; frstor %1",
156 "fxrstor %1",
157 X86_FEATURE_FXSR,
158 "m" (tsk->thread.xstate->fxsave));
159}
160
161/* We need a safe address that is cheap to find and that is already
162 in L1 during context switch. The best choices are unfortunately
163 different for UP and SMP */
164#ifdef CONFIG_SMP
165#define safe_address (__per_cpu_offset[0])
166#else
167#define safe_address (kstat_cpu(0).cpustat.user)
168#endif
169
170/*
171 * These must be called with preempt disabled
172 */
173static inline void __save_init_fpu(struct task_struct *tsk)
174{
175 /* Use more nops than strictly needed in case the compiler
176 varies code */
177 alternative_input(
178 "fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4,
179 "fxsave %[fx]\n"
180 "bt $7,%[fsw] ; jnc 1f ; fnclex\n1:",
181 X86_FEATURE_FXSR,
182 [fx] "m" (tsk->thread.xstate->fxsave),
183 [fsw] "m" (tsk->thread.xstate->fxsave.swd) : "memory");
184 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
185 is pending. Clear the x87 state here by setting it to fixed
186 values. safe_address is a random variable that should be in L1 */
187 alternative_input(
188 GENERIC_NOP8 GENERIC_NOP2,
189 "emms\n\t" /* clear stack tags */
190 "fildl %[addr]", /* set F?P to defined value */
191 X86_FEATURE_FXSAVE_LEAK,
192 [addr] "m" (safe_address));
193 task_thread_info(tsk)->status &= ~TS_USEDFPU;
194}
195
196/*
197 * Signal frame handlers...
198 */
199extern int save_i387(struct _fpstate __user *buf);
200extern int restore_i387(struct _fpstate __user *buf);
201
202#endif /* CONFIG_X86_64 */
203
204static inline void __unlazy_fpu(struct task_struct *tsk)
205{
206 if (task_thread_info(tsk)->status & TS_USEDFPU) {
207 __save_init_fpu(tsk);
208 stts();
209 } else
210 tsk->fpu_counter = 0;
211}
212
213static inline void __clear_fpu(struct task_struct *tsk)
214{
215 if (task_thread_info(tsk)->status & TS_USEDFPU) {
216 tolerant_fwait();
217 task_thread_info(tsk)->status &= ~TS_USEDFPU;
218 stts();
219 }
220}
221
222static inline void kernel_fpu_begin(void)
223{
224 struct thread_info *me = current_thread_info();
225 preempt_disable();
226 if (me->status & TS_USEDFPU)
227 __save_init_fpu(me->task);
228 else
229 clts();
230}
231
232static inline void kernel_fpu_end(void)
233{
234 stts();
235 preempt_enable();
236}
237
238/*
239 * Some instructions like VIA's padlock instructions generate a spurious
240 * DNA fault but don't modify SSE registers. And these instructions
241 * get used from interrupt context aswell. To prevent these kernel instructions
242 * in interrupt context interact wrongly with other user/kernel fpu usage, we
243 * should use them only in the context of irq_ts_save/restore()
244 */
245static inline int irq_ts_save(void)
246{
247 /*
248 * If we are in process context, we are ok to take a spurious DNA fault.
249 * Otherwise, doing clts() in process context require pre-emption to
250 * be disabled or some heavy lifting like kernel_fpu_begin()
251 */
252 if (!in_interrupt())
253 return 0;
254
255 if (read_cr0() & X86_CR0_TS) {
256 clts();
257 return 1;
258 }
259
260 return 0;
261}
262
263static inline void irq_ts_restore(int TS_state)
264{
265 if (TS_state)
266 stts();
267}
268
269#ifdef CONFIG_X86_64
270
271static inline void save_init_fpu(struct task_struct *tsk)
272{
273 __save_init_fpu(tsk);
274 stts();
275}
276
277#define unlazy_fpu __unlazy_fpu
278#define clear_fpu __clear_fpu
279
280#else /* CONFIG_X86_32 */
281
282/*
283 * These disable preemption on their own and are safe
284 */
285static inline void save_init_fpu(struct task_struct *tsk)
286{
287 preempt_disable();
288 __save_init_fpu(tsk);
289 stts();
290 preempt_enable();
291}
292
293static inline void unlazy_fpu(struct task_struct *tsk)
294{
295 preempt_disable();
296 __unlazy_fpu(tsk);
297 preempt_enable();
298}
299
300static inline void clear_fpu(struct task_struct *tsk)
301{
302 preempt_disable();
303 __clear_fpu(tsk);
304 preempt_enable();
305}
306
307#endif /* CONFIG_X86_64 */
308
309/*
310 * i387 state interaction
311 */
312static inline unsigned short get_fpu_cwd(struct task_struct *tsk)
313{
314 if (cpu_has_fxsr) {
315 return tsk->thread.xstate->fxsave.cwd;
316 } else {
317 return (unsigned short)tsk->thread.xstate->fsave.cwd;
318 }
319}
320
321static inline unsigned short get_fpu_swd(struct task_struct *tsk)
322{
323 if (cpu_has_fxsr) {
324 return tsk->thread.xstate->fxsave.swd;
325 } else {
326 return (unsigned short)tsk->thread.xstate->fsave.swd;
327 }
328}
329
330static inline unsigned short get_fpu_mxcsr(struct task_struct *tsk)
331{
332 if (cpu_has_xmm) {
333 return tsk->thread.xstate->fxsave.mxcsr;
334 } else {
335 return MXCSR_DEFAULT;
336 }
337}
338
339#endif /* _ASM_X86_I387_H */
diff --git a/include/asm-x86/i8253.h b/include/asm-x86/i8253.h
deleted file mode 100644
index b51c0487fc41..000000000000
--- a/include/asm-x86/i8253.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef __ASM_I8253_H__
2#define __ASM_I8253_H__
3
4/* i8253A PIT registers */
5#define PIT_MODE 0x43
6#define PIT_CH0 0x40
7#define PIT_CH2 0x42
8
9extern spinlock_t i8253_lock;
10
11extern struct clock_event_device *global_clock_event;
12
13extern void setup_pit_timer(void);
14
15#define inb_pit inb_p
16#define outb_pit outb_p
17
18#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86/i8259.h b/include/asm-x86/i8259.h
deleted file mode 100644
index 2f98df91f1f2..000000000000
--- a/include/asm-x86/i8259.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef __ASM_I8259_H__
2#define __ASM_I8259_H__
3
4#include <linux/delay.h>
5
6extern unsigned int cached_irq_mask;
7
8#define __byte(x, y) (((unsigned char *)&(y))[x])
9#define cached_master_mask (__byte(0, cached_irq_mask))
10#define cached_slave_mask (__byte(1, cached_irq_mask))
11
12/* i8259A PIC registers */
13#define PIC_MASTER_CMD 0x20
14#define PIC_MASTER_IMR 0x21
15#define PIC_MASTER_ISR PIC_MASTER_CMD
16#define PIC_MASTER_POLL PIC_MASTER_ISR
17#define PIC_MASTER_OCW3 PIC_MASTER_ISR
18#define PIC_SLAVE_CMD 0xa0
19#define PIC_SLAVE_IMR 0xa1
20
21/* i8259A PIC related value */
22#define PIC_CASCADE_IR 2
23#define MASTER_ICW4_DEFAULT 0x01
24#define SLAVE_ICW4_DEFAULT 0x01
25#define PIC_ICW4_AEOI 2
26
27extern spinlock_t i8259A_lock;
28
29extern void init_8259A(int auto_eoi);
30extern void enable_8259A_irq(unsigned int irq);
31extern void disable_8259A_irq(unsigned int irq);
32extern unsigned int startup_8259A_irq(unsigned int irq);
33
34/* the PIC may need a careful delay on some platforms, hence specific calls */
35static inline unsigned char inb_pic(unsigned int port)
36{
37 unsigned char value = inb(port);
38
39 /*
40 * delay for some accesses to PIC on motherboard or in chipset
41 * must be at least one microsecond, so be safe here:
42 */
43 udelay(2);
44
45 return value;
46}
47
48static inline void outb_pic(unsigned char value, unsigned int port)
49{
50 outb(value, port);
51 /*
52 * delay for some accesses to PIC on motherboard or in chipset
53 * must be at least one microsecond, so be safe here:
54 */
55 udelay(2);
56}
57
58extern struct irq_chip i8259A_chip;
59
60#endif /* __ASM_I8259_H__ */
diff --git a/include/asm-x86/ia32.h b/include/asm-x86/ia32.h
deleted file mode 100644
index 55d3abe5276f..000000000000
--- a/include/asm-x86/ia32.h
+++ /dev/null
@@ -1,170 +0,0 @@
1#ifndef _ASM_X86_64_IA32_H
2#define _ASM_X86_64_IA32_H
3
4
5#ifdef CONFIG_IA32_EMULATION
6
7#include <linux/compat.h>
8
9/*
10 * 32 bit structures for IA32 support.
11 */
12
13#include <asm/sigcontext32.h>
14
15/* signal.h */
16struct sigaction32 {
17 unsigned int sa_handler; /* Really a pointer, but need to deal
18 with 32 bits */
19 unsigned int sa_flags;
20 unsigned int sa_restorer; /* Another 32 bit pointer */
21 compat_sigset_t sa_mask; /* A 32 bit mask */
22};
23
24struct old_sigaction32 {
25 unsigned int sa_handler; /* Really a pointer, but need to deal
26 with 32 bits */
27 compat_old_sigset_t sa_mask; /* A 32 bit mask */
28 unsigned int sa_flags;
29 unsigned int sa_restorer; /* Another 32 bit pointer */
30};
31
32typedef struct sigaltstack_ia32 {
33 unsigned int ss_sp;
34 int ss_flags;
35 unsigned int ss_size;
36} stack_ia32_t;
37
38struct ucontext_ia32 {
39 unsigned int uc_flags;
40 unsigned int uc_link;
41 stack_ia32_t uc_stack;
42 struct sigcontext_ia32 uc_mcontext;
43 compat_sigset_t uc_sigmask; /* mask last for extensibility */
44};
45
46/* This matches struct stat64 in glibc2.2, hence the absolutely
47 * insane amounts of padding around dev_t's.
48 */
49struct stat64 {
50 unsigned long long st_dev;
51 unsigned char __pad0[4];
52
53#define STAT64_HAS_BROKEN_ST_INO 1
54 unsigned int __st_ino;
55
56 unsigned int st_mode;
57 unsigned int st_nlink;
58
59 unsigned int st_uid;
60 unsigned int st_gid;
61
62 unsigned long long st_rdev;
63 unsigned char __pad3[4];
64
65 long long st_size;
66 unsigned int st_blksize;
67
68 long long st_blocks;/* Number 512-byte blocks allocated */
69
70 unsigned st_atime;
71 unsigned st_atime_nsec;
72 unsigned st_mtime;
73 unsigned st_mtime_nsec;
74 unsigned st_ctime;
75 unsigned st_ctime_nsec;
76
77 unsigned long long st_ino;
78} __attribute__((packed));
79
80typedef struct compat_siginfo {
81 int si_signo;
82 int si_errno;
83 int si_code;
84
85 union {
86 int _pad[((128 / sizeof(int)) - 3)];
87
88 /* kill() */
89 struct {
90 unsigned int _pid; /* sender's pid */
91 unsigned int _uid; /* sender's uid */
92 } _kill;
93
94 /* POSIX.1b timers */
95 struct {
96 compat_timer_t _tid; /* timer id */
97 int _overrun; /* overrun count */
98 compat_sigval_t _sigval; /* same as below */
99 int _sys_private; /* not to be passed to user */
100 int _overrun_incr; /* amount to add to overrun */
101 } _timer;
102
103 /* POSIX.1b signals */
104 struct {
105 unsigned int _pid; /* sender's pid */
106 unsigned int _uid; /* sender's uid */
107 compat_sigval_t _sigval;
108 } _rt;
109
110 /* SIGCHLD */
111 struct {
112 unsigned int _pid; /* which child */
113 unsigned int _uid; /* sender's uid */
114 int _status; /* exit code */
115 compat_clock_t _utime;
116 compat_clock_t _stime;
117 } _sigchld;
118
119 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
120 struct {
121 unsigned int _addr; /* faulting insn/memory ref. */
122 } _sigfault;
123
124 /* SIGPOLL */
125 struct {
126 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
127 int _fd;
128 } _sigpoll;
129 } _sifields;
130} compat_siginfo_t;
131
132struct sigframe32 {
133 u32 pretcode;
134 int sig;
135 struct sigcontext_ia32 sc;
136 struct _fpstate_ia32 fpstate;
137 unsigned int extramask[_COMPAT_NSIG_WORDS-1];
138};
139
140struct rt_sigframe32 {
141 u32 pretcode;
142 int sig;
143 u32 pinfo;
144 u32 puc;
145 compat_siginfo_t info;
146 struct ucontext_ia32 uc;
147 struct _fpstate_ia32 fpstate;
148};
149
150struct ustat32 {
151 __u32 f_tfree;
152 compat_ino_t f_tinode;
153 char f_fname[6];
154 char f_fpack[6];
155};
156
157#define IA32_STACK_TOP IA32_PAGE_OFFSET
158
159#ifdef __KERNEL__
160struct linux_binprm;
161extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
162 unsigned long stack_top, int exec_stack);
163struct mm_struct;
164extern void ia32_pick_mmap_layout(struct mm_struct *mm);
165
166#endif
167
168#endif /* !CONFIG_IA32_SUPPORT */
169
170#endif
diff --git a/include/asm-x86/ia32_unistd.h b/include/asm-x86/ia32_unistd.h
deleted file mode 100644
index 61cea9e7c5c1..000000000000
--- a/include/asm-x86/ia32_unistd.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_X86_64_IA32_UNISTD_H_
2#define _ASM_X86_64_IA32_UNISTD_H_
3
4/*
5 * This file contains the system call numbers of the ia32 port,
6 * this is for the kernel only.
7 * Only add syscalls here where some part of the kernel needs to know
8 * the number. This should be otherwise in sync with asm-x86/unistd_32.h. -AK
9 */
10
11#define __NR_ia32_restart_syscall 0
12#define __NR_ia32_exit 1
13#define __NR_ia32_read 3
14#define __NR_ia32_write 4
15#define __NR_ia32_sigreturn 119
16#define __NR_ia32_rt_sigreturn 173
17
18#endif /* _ASM_X86_64_IA32_UNISTD_H_ */
diff --git a/include/asm-x86/idle.h b/include/asm-x86/idle.h
deleted file mode 100644
index cbb649123612..000000000000
--- a/include/asm-x86/idle.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_X86_64_IDLE_H
2#define _ASM_X86_64_IDLE_H 1
3
4#define IDLE_START 1
5#define IDLE_END 2
6
7struct notifier_block;
8void idle_notifier_register(struct notifier_block *n);
9
10void enter_idle(void);
11void exit_idle(void);
12
13void c1e_remove_cpu(int cpu);
14
15#endif
diff --git a/include/asm-x86/intel_arch_perfmon.h b/include/asm-x86/intel_arch_perfmon.h
deleted file mode 100644
index fa0fd068bc2e..000000000000
--- a/include/asm-x86/intel_arch_perfmon.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_X86_INTEL_ARCH_PERFMON_H
2#define _ASM_X86_INTEL_ARCH_PERFMON_H
3
4#define MSR_ARCH_PERFMON_PERFCTR0 0xc1
5#define MSR_ARCH_PERFMON_PERFCTR1 0xc2
6
7#define MSR_ARCH_PERFMON_EVENTSEL0 0x186
8#define MSR_ARCH_PERFMON_EVENTSEL1 0x187
9
10#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22)
11#define ARCH_PERFMON_EVENTSEL_INT (1 << 20)
12#define ARCH_PERFMON_EVENTSEL_OS (1 << 17)
13#define ARCH_PERFMON_EVENTSEL_USR (1 << 16)
14
15#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c)
16#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
17#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0)
18#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
19 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
20
21union cpuid10_eax {
22 struct {
23 unsigned int version_id:8;
24 unsigned int num_counters:8;
25 unsigned int bit_width:8;
26 unsigned int mask_length:8;
27 } split;
28 unsigned int full;
29};
30
31#endif /* _ASM_X86_INTEL_ARCH_PERFMON_H */
diff --git a/include/asm-x86/io.h b/include/asm-x86/io.h
deleted file mode 100644
index 0f954dc89cb3..000000000000
--- a/include/asm-x86/io.h
+++ /dev/null
@@ -1,102 +0,0 @@
1#ifndef _ASM_X86_IO_H
2#define _ASM_X86_IO_H
3
4#define ARCH_HAS_IOREMAP_WC
5
6#include <linux/compiler.h>
7
8/*
9 * early_ioremap() and early_iounmap() are for temporary early boot-time
10 * mappings, before the real ioremap() is functional.
11 * A boot-time mapping is currently limited to at most 16 pages.
12 */
13#ifndef __ASSEMBLY__
14extern void early_ioremap_init(void);
15extern void early_ioremap_clear(void);
16extern void early_ioremap_reset(void);
17extern void *early_ioremap(unsigned long offset, unsigned long size);
18extern void early_iounmap(void *addr, unsigned long size);
19extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
20#endif
21
22#define build_mmio_read(name, size, type, reg, barrier) \
23static inline type name(const volatile void __iomem *addr) \
24{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \
25:"m" (*(volatile type __force *)addr) barrier); return ret; }
26
27#define build_mmio_write(name, size, type, reg, barrier) \
28static inline void name(type val, volatile void __iomem *addr) \
29{ asm volatile("mov" size " %0,%1": :reg (val), \
30"m" (*(volatile type __force *)addr) barrier); }
31
32build_mmio_read(readb, "b", unsigned char, "=q", :"memory")
33build_mmio_read(readw, "w", unsigned short, "=r", :"memory")
34build_mmio_read(readl, "l", unsigned int, "=r", :"memory")
35
36build_mmio_read(__readb, "b", unsigned char, "=q", )
37build_mmio_read(__readw, "w", unsigned short, "=r", )
38build_mmio_read(__readl, "l", unsigned int, "=r", )
39
40build_mmio_write(writeb, "b", unsigned char, "q", :"memory")
41build_mmio_write(writew, "w", unsigned short, "r", :"memory")
42build_mmio_write(writel, "l", unsigned int, "r", :"memory")
43
44build_mmio_write(__writeb, "b", unsigned char, "q", )
45build_mmio_write(__writew, "w", unsigned short, "r", )
46build_mmio_write(__writel, "l", unsigned int, "r", )
47
48#define readb_relaxed(a) __readb(a)
49#define readw_relaxed(a) __readw(a)
50#define readl_relaxed(a) __readl(a)
51#define __raw_readb __readb
52#define __raw_readw __readw
53#define __raw_readl __readl
54
55#define __raw_writeb __writeb
56#define __raw_writew __writew
57#define __raw_writel __writel
58
59#define mmiowb() barrier()
60
61#ifdef CONFIG_X86_64
62build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
63build_mmio_read(__readq, "q", unsigned long, "=r", )
64build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
65build_mmio_write(__writeq, "q", unsigned long, "r", )
66
67#define readq_relaxed(a) __readq(a)
68#define __raw_readq __readq
69#define __raw_writeq writeq
70
71/* Let people know we have them */
72#define readq readq
73#define writeq writeq
74#endif
75
76#ifdef CONFIG_X86_32
77# include "io_32.h"
78#else
79# include "io_64.h"
80#endif
81
82extern void *xlate_dev_mem_ptr(unsigned long phys);
83extern void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
84
85extern int ioremap_change_attr(unsigned long vaddr, unsigned long size,
86 unsigned long prot_val);
87extern void __iomem *ioremap_wc(unsigned long offset, unsigned long size);
88
89/*
90 * early_ioremap() and early_iounmap() are for temporary early boot-time
91 * mappings, before the real ioremap() is functional.
92 * A boot-time mapping is currently limited to at most 16 pages.
93 */
94extern void early_ioremap_init(void);
95extern void early_ioremap_clear(void);
96extern void early_ioremap_reset(void);
97extern void *early_ioremap(unsigned long offset, unsigned long size);
98extern void early_iounmap(void *addr, unsigned long size);
99extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
100
101
102#endif /* _ASM_X86_IO_H */
diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h
deleted file mode 100644
index e876d89ac156..000000000000
--- a/include/asm-x86/io_32.h
+++ /dev/null
@@ -1,284 +0,0 @@
1#ifndef _ASM_IO_H
2#define _ASM_IO_H
3
4#include <linux/string.h>
5#include <linux/compiler.h>
6
7/*
8 * This file contains the definitions for the x86 IO instructions
9 * inb/inw/inl/outb/outw/outl and the "string versions" of the same
10 * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
11 * versions of the single-IO instructions (inb_p/inw_p/..).
12 *
13 * This file is not meant to be obfuscating: it's just complicated
14 * to (a) handle it all in a way that makes gcc able to optimize it
15 * as well as possible and (b) trying to avoid writing the same thing
16 * over and over again with slight variations and possibly making a
17 * mistake somewhere.
18 */
19
20/*
21 * Thanks to James van Artsdalen for a better timing-fix than
22 * the two short jumps: using outb's to a nonexistent port seems
23 * to guarantee better timings even on fast machines.
24 *
25 * On the other hand, I'd like to be sure of a non-existent port:
26 * I feel a bit unsafe about using 0x80 (should be safe, though)
27 *
28 * Linus
29 */
30
31 /*
32 * Bit simplified and optimized by Jan Hubicka
33 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
34 *
35 * isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
36 * isa_read[wl] and isa_write[wl] fixed
37 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
38 */
39
40#define IO_SPACE_LIMIT 0xffff
41
42#define XQUAD_PORTIO_BASE 0xfe400000
43#define XQUAD_PORTIO_QUAD 0x40000 /* 256k per quad. */
44
45#ifdef __KERNEL__
46
47#include <asm-generic/iomap.h>
48
49#include <linux/vmalloc.h>
50
51/*
52 * Convert a virtual cached pointer to an uncached pointer
53 */
54#define xlate_dev_kmem_ptr(p) p
55
56/**
57 * virt_to_phys - map virtual addresses to physical
58 * @address: address to remap
59 *
60 * The returned physical address is the physical (CPU) mapping for
61 * the memory address given. It is only valid to use this function on
62 * addresses directly mapped or allocated via kmalloc.
63 *
64 * This function does not give bus mappings for DMA transfers. In
65 * almost all conceivable cases a device driver should not be using
66 * this function
67 */
68
69static inline unsigned long virt_to_phys(volatile void *address)
70{
71 return __pa(address);
72}
73
74/**
75 * phys_to_virt - map physical address to virtual
76 * @address: address to remap
77 *
78 * The returned virtual address is a current CPU mapping for
79 * the memory address given. It is only valid to use this function on
80 * addresses that have a kernel mapping
81 *
82 * This function does not handle bus mappings for DMA transfers. In
83 * almost all conceivable cases a device driver should not be using
84 * this function
85 */
86
87static inline void *phys_to_virt(unsigned long address)
88{
89 return __va(address);
90}
91
92/*
93 * Change "struct page" to physical address.
94 */
95#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
96
97/**
98 * ioremap - map bus memory into CPU space
99 * @offset: bus address of the memory
100 * @size: size of the resource to map
101 *
102 * ioremap performs a platform specific sequence of operations to
103 * make bus memory CPU accessible via the readb/readw/readl/writeb/
104 * writew/writel functions and the other mmio helpers. The returned
105 * address is not guaranteed to be usable directly as a virtual
106 * address.
107 *
108 * If the area you are trying to map is a PCI BAR you should have a
109 * look at pci_iomap().
110 */
111extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
112extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
113extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
114 unsigned long prot_val);
115
116/*
117 * The default ioremap() behavior is non-cached:
118 */
119static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
120{
121 return ioremap_nocache(offset, size);
122}
123
124extern void iounmap(volatile void __iomem *addr);
125
126/*
127 * ISA I/O bus memory addresses are 1:1 with the physical address.
128 */
129#define isa_virt_to_bus virt_to_phys
130#define isa_page_to_bus page_to_phys
131#define isa_bus_to_virt phys_to_virt
132
133/*
134 * However PCI ones are not necessarily 1:1 and therefore these interfaces
135 * are forbidden in portable PCI drivers.
136 *
137 * Allow them on x86 for legacy drivers, though.
138 */
139#define virt_to_bus virt_to_phys
140#define bus_to_virt phys_to_virt
141
142static inline void
143memset_io(volatile void __iomem *addr, unsigned char val, int count)
144{
145 memset((void __force *)addr, val, count);
146}
147
148static inline void
149memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
150{
151 __memcpy(dst, (const void __force *)src, count);
152}
153
154static inline void
155memcpy_toio(volatile void __iomem *dst, const void *src, int count)
156{
157 __memcpy((void __force *)dst, src, count);
158}
159
160/*
161 * ISA space is 'always mapped' on a typical x86 system, no need to
162 * explicitly ioremap() it. The fact that the ISA IO space is mapped
163 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
164 * are physical addresses. The following constant pointer can be
165 * used as the IO-area pointer (it can be iounmapped as well, so the
166 * analogy with PCI is quite large):
167 */
168#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
169
170/*
171 * Cache management
172 *
173 * This needed for two cases
174 * 1. Out of order aware processors
175 * 2. Accidentally out of order processors (PPro errata #51)
176 */
177
178#if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)
179
180static inline void flush_write_buffers(void)
181{
182 asm volatile("lock; addl $0,0(%%esp)": : :"memory");
183}
184
185#else
186
187#define flush_write_buffers() do { } while (0)
188
189#endif
190
191#endif /* __KERNEL__ */
192
193extern void native_io_delay(void);
194
195extern int io_delay_type;
196extern void io_delay_init(void);
197
198#if defined(CONFIG_PARAVIRT)
199#include <asm/paravirt.h>
200#else
201
202static inline void slow_down_io(void)
203{
204 native_io_delay();
205#ifdef REALLY_SLOW_IO
206 native_io_delay();
207 native_io_delay();
208 native_io_delay();
209#endif
210}
211
212#endif
213
214#define __BUILDIO(bwl, bw, type) \
215static inline void out##bwl(unsigned type value, int port) \
216{ \
217 out##bwl##_local(value, port); \
218} \
219 \
220static inline unsigned type in##bwl(int port) \
221{ \
222 return in##bwl##_local(port); \
223}
224
225#define BUILDIO(bwl, bw, type) \
226static inline void out##bwl##_local(unsigned type value, int port) \
227{ \
228 asm volatile("out" #bwl " %" #bw "0, %w1" \
229 : : "a"(value), "Nd"(port)); \
230} \
231 \
232static inline unsigned type in##bwl##_local(int port) \
233{ \
234 unsigned type value; \
235 asm volatile("in" #bwl " %w1, %" #bw "0" \
236 : "=a"(value) : "Nd"(port)); \
237 return value; \
238} \
239 \
240static inline void out##bwl##_local_p(unsigned type value, int port) \
241{ \
242 out##bwl##_local(value, port); \
243 slow_down_io(); \
244} \
245 \
246static inline unsigned type in##bwl##_local_p(int port) \
247{ \
248 unsigned type value = in##bwl##_local(port); \
249 slow_down_io(); \
250 return value; \
251} \
252 \
253__BUILDIO(bwl, bw, type) \
254 \
255static inline void out##bwl##_p(unsigned type value, int port) \
256{ \
257 out##bwl(value, port); \
258 slow_down_io(); \
259} \
260 \
261static inline unsigned type in##bwl##_p(int port) \
262{ \
263 unsigned type value = in##bwl(port); \
264 slow_down_io(); \
265 return value; \
266} \
267 \
268static inline void outs##bwl(int port, const void *addr, unsigned long count) \
269{ \
270 asm volatile("rep; outs" #bwl \
271 : "+S"(addr), "+c"(count) : "d"(port)); \
272} \
273 \
274static inline void ins##bwl(int port, void *addr, unsigned long count) \
275{ \
276 asm volatile("rep; ins" #bwl \
277 : "+D"(addr), "+c"(count) : "d"(port)); \
278}
279
280BUILDIO(b, b, char)
281BUILDIO(w, w, short)
282BUILDIO(l, , int)
283
284#endif
diff --git a/include/asm-x86/io_64.h b/include/asm-x86/io_64.h
deleted file mode 100644
index 22995c5c5adc..000000000000
--- a/include/asm-x86/io_64.h
+++ /dev/null
@@ -1,248 +0,0 @@
1#ifndef _ASM_IO_H
2#define _ASM_IO_H
3
4
5/*
6 * This file contains the definitions for the x86 IO instructions
7 * inb/inw/inl/outb/outw/outl and the "string versions" of the same
8 * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
9 * versions of the single-IO instructions (inb_p/inw_p/..).
10 *
11 * This file is not meant to be obfuscating: it's just complicated
12 * to (a) handle it all in a way that makes gcc able to optimize it
13 * as well as possible and (b) trying to avoid writing the same thing
14 * over and over again with slight variations and possibly making a
15 * mistake somewhere.
16 */
17
18/*
19 * Thanks to James van Artsdalen for a better timing-fix than
20 * the two short jumps: using outb's to a nonexistent port seems
21 * to guarantee better timings even on fast machines.
22 *
23 * On the other hand, I'd like to be sure of a non-existent port:
24 * I feel a bit unsafe about using 0x80 (should be safe, though)
25 *
26 * Linus
27 */
28
29 /*
30 * Bit simplified and optimized by Jan Hubicka
31 * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
32 *
33 * isa_memset_io, isa_memcpy_fromio, isa_memcpy_toio added,
34 * isa_read[wl] and isa_write[wl] fixed
35 * - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
36 */
37
38extern void native_io_delay(void);
39
40extern int io_delay_type;
41extern void io_delay_init(void);
42
43#if defined(CONFIG_PARAVIRT)
44#include <asm/paravirt.h>
45#else
46
47static inline void slow_down_io(void)
48{
49 native_io_delay();
50#ifdef REALLY_SLOW_IO
51 native_io_delay();
52 native_io_delay();
53 native_io_delay();
54#endif
55}
56#endif
57
58/*
59 * Talk about misusing macros..
60 */
61#define __OUT1(s, x) \
62static inline void out##s(unsigned x value, unsigned short port) {
63
64#define __OUT2(s, s1, s2) \
65asm volatile ("out" #s " %" s1 "0,%" s2 "1"
66
67#ifndef REALLY_SLOW_IO
68#define REALLY_SLOW_IO
69#define UNSET_REALLY_SLOW_IO
70#endif
71
72#define __OUT(s, s1, x) \
73 __OUT1(s, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port)); \
74 } \
75 __OUT1(s##_p, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port)); \
76 slow_down_io(); \
77}
78
79#define __IN1(s) \
80static inline RETURN_TYPE in##s(unsigned short port) \
81{ \
82 RETURN_TYPE _v;
83
84#define __IN2(s, s1, s2) \
85 asm volatile ("in" #s " %" s2 "1,%" s1 "0"
86
87#define __IN(s, s1, i...) \
88 __IN1(s) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); \
89 return _v; \
90 } \
91 __IN1(s##_p) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); \
92 slow_down_io(); \
93 return _v; }
94
95#ifdef UNSET_REALLY_SLOW_IO
96#undef REALLY_SLOW_IO
97#endif
98
99#define __INS(s) \
100static inline void ins##s(unsigned short port, void *addr, \
101 unsigned long count) \
102{ \
103 asm volatile ("rep ; ins" #s \
104 : "=D" (addr), "=c" (count) \
105 : "d" (port), "0" (addr), "1" (count)); \
106}
107
108#define __OUTS(s) \
109static inline void outs##s(unsigned short port, const void *addr, \
110 unsigned long count) \
111{ \
112 asm volatile ("rep ; outs" #s \
113 : "=S" (addr), "=c" (count) \
114 : "d" (port), "0" (addr), "1" (count)); \
115}
116
117#define RETURN_TYPE unsigned char
118__IN(b, "")
119#undef RETURN_TYPE
120#define RETURN_TYPE unsigned short
121__IN(w, "")
122#undef RETURN_TYPE
123#define RETURN_TYPE unsigned int
124__IN(l, "")
125#undef RETURN_TYPE
126
127__OUT(b, "b", char)
128__OUT(w, "w", short)
129__OUT(l, , int)
130
131__INS(b)
132__INS(w)
133__INS(l)
134
135__OUTS(b)
136__OUTS(w)
137__OUTS(l)
138
139#define IO_SPACE_LIMIT 0xffff
140
141#if defined(__KERNEL__) && defined(__x86_64__)
142
143#include <linux/vmalloc.h>
144
145#ifndef __i386__
146/*
147 * Change virtual addresses to physical addresses and vv.
148 * These are pretty trivial
149 */
150static inline unsigned long virt_to_phys(volatile void *address)
151{
152 return __pa(address);
153}
154
155static inline void *phys_to_virt(unsigned long address)
156{
157 return __va(address);
158}
159#endif
160
161/*
162 * Change "struct page" to physical address.
163 */
164#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
165
166#include <asm-generic/iomap.h>
167
168extern void *early_ioremap(unsigned long addr, unsigned long size);
169extern void early_iounmap(void *addr, unsigned long size);
170
171/*
172 * This one maps high address device memory and turns off caching for that area.
173 * it's useful if some control registers are in such an area and write combining
174 * or read caching is not desirable:
175 */
176extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
177extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
178extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
179 unsigned long prot_val);
180
181/*
182 * The default ioremap() behavior is non-cached:
183 */
184static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
185{
186 return ioremap_nocache(offset, size);
187}
188
189extern void iounmap(volatile void __iomem *addr);
190
191extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
192
193/*
194 * ISA I/O bus memory addresses are 1:1 with the physical address.
195 */
196#define isa_virt_to_bus virt_to_phys
197#define isa_page_to_bus page_to_phys
198#define isa_bus_to_virt phys_to_virt
199
200/*
201 * However PCI ones are not necessarily 1:1 and therefore these interfaces
202 * are forbidden in portable PCI drivers.
203 *
204 * Allow them on x86 for legacy drivers, though.
205 */
206#define virt_to_bus virt_to_phys
207#define bus_to_virt phys_to_virt
208
209void __memcpy_fromio(void *, unsigned long, unsigned);
210void __memcpy_toio(unsigned long, const void *, unsigned);
211
212static inline void memcpy_fromio(void *to, const volatile void __iomem *from,
213 unsigned len)
214{
215 __memcpy_fromio(to, (unsigned long)from, len);
216}
217
218static inline void memcpy_toio(volatile void __iomem *to, const void *from,
219 unsigned len)
220{
221 __memcpy_toio((unsigned long)to, from, len);
222}
223
224void memset_io(volatile void __iomem *a, int b, size_t c);
225
226/*
227 * ISA space is 'always mapped' on a typical x86 system, no need to
228 * explicitly ioremap() it. The fact that the ISA IO space is mapped
229 * to PAGE_OFFSET is pure coincidence - it does not mean ISA values
230 * are physical addresses. The following constant pointer can be
231 * used as the IO-area pointer (it can be iounmapped as well, so the
232 * analogy with PCI is quite large):
233 */
234#define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
235
236#define flush_write_buffers()
237
238extern int iommu_bio_merge;
239#define BIO_VMERGE_BOUNDARY iommu_bio_merge
240
241/*
242 * Convert a virtual cached pointer to an uncached pointer
243 */
244#define xlate_dev_kmem_ptr(p) p
245
246#endif /* __KERNEL__ */
247
248#endif
diff --git a/include/asm-x86/io_apic.h b/include/asm-x86/io_apic.h
deleted file mode 100644
index 14f82bbcb5fd..000000000000
--- a/include/asm-x86/io_apic.h
+++ /dev/null
@@ -1,192 +0,0 @@
1#ifndef __ASM_IO_APIC_H
2#define __ASM_IO_APIC_H
3
4#include <linux/types.h>
5#include <asm/mpspec.h>
6#include <asm/apicdef.h>
7
8/*
9 * Intel IO-APIC support for SMP and UP systems.
10 *
11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
12 */
13
14/* I/O Unit Redirection Table */
15#define IO_APIC_REDIR_VECTOR_MASK 0x000FF
16#define IO_APIC_REDIR_DEST_LOGICAL 0x00800
17#define IO_APIC_REDIR_DEST_PHYSICAL 0x00000
18#define IO_APIC_REDIR_SEND_PENDING (1 << 12)
19#define IO_APIC_REDIR_REMOTE_IRR (1 << 14)
20#define IO_APIC_REDIR_LEVEL_TRIGGER (1 << 15)
21#define IO_APIC_REDIR_MASKED (1 << 16)
22
23/*
24 * The structure of the IO-APIC:
25 */
26union IO_APIC_reg_00 {
27 u32 raw;
28 struct {
29 u32 __reserved_2 : 14,
30 LTS : 1,
31 delivery_type : 1,
32 __reserved_1 : 8,
33 ID : 8;
34 } __attribute__ ((packed)) bits;
35};
36
37union IO_APIC_reg_01 {
38 u32 raw;
39 struct {
40 u32 version : 8,
41 __reserved_2 : 7,
42 PRQ : 1,
43 entries : 8,
44 __reserved_1 : 8;
45 } __attribute__ ((packed)) bits;
46};
47
48union IO_APIC_reg_02 {
49 u32 raw;
50 struct {
51 u32 __reserved_2 : 24,
52 arbitration : 4,
53 __reserved_1 : 4;
54 } __attribute__ ((packed)) bits;
55};
56
57union IO_APIC_reg_03 {
58 u32 raw;
59 struct {
60 u32 boot_DT : 1,
61 __reserved_1 : 31;
62 } __attribute__ ((packed)) bits;
63};
64
65enum ioapic_irq_destination_types {
66 dest_Fixed = 0,
67 dest_LowestPrio = 1,
68 dest_SMI = 2,
69 dest__reserved_1 = 3,
70 dest_NMI = 4,
71 dest_INIT = 5,
72 dest__reserved_2 = 6,
73 dest_ExtINT = 7
74};
75
76struct IO_APIC_route_entry {
77 __u32 vector : 8,
78 delivery_mode : 3, /* 000: FIXED
79 * 001: lowest prio
80 * 111: ExtINT
81 */
82 dest_mode : 1, /* 0: physical, 1: logical */
83 delivery_status : 1,
84 polarity : 1,
85 irr : 1,
86 trigger : 1, /* 0: edge, 1: level */
87 mask : 1, /* 0: enabled, 1: disabled */
88 __reserved_2 : 15;
89
90#ifdef CONFIG_X86_32
91 union {
92 struct {
93 __u32 __reserved_1 : 24,
94 physical_dest : 4,
95 __reserved_2 : 4;
96 } physical;
97
98 struct {
99 __u32 __reserved_1 : 24,
100 logical_dest : 8;
101 } logical;
102 } dest;
103#else
104 __u32 __reserved_3 : 24,
105 dest : 8;
106#endif
107
108} __attribute__ ((packed));
109
110#ifdef CONFIG_X86_IO_APIC
111
112/*
113 * # of IO-APICs and # of IRQ routing registers
114 */
115extern int nr_ioapics;
116extern int nr_ioapic_registers[MAX_IO_APICS];
117
118/*
119 * MP-BIOS irq configuration table structures:
120 */
121
122#define MP_MAX_IOAPIC_PIN 127
123
124struct mp_config_ioapic {
125 unsigned long mp_apicaddr;
126 unsigned int mp_apicid;
127 unsigned char mp_type;
128 unsigned char mp_apicver;
129 unsigned char mp_flags;
130};
131
132struct mp_config_intsrc {
133 unsigned int mp_dstapic;
134 unsigned char mp_type;
135 unsigned char mp_irqtype;
136 unsigned short mp_irqflag;
137 unsigned char mp_srcbus;
138 unsigned char mp_srcbusirq;
139 unsigned char mp_dstirq;
140};
141
142/* I/O APIC entries */
143extern struct mp_config_ioapic mp_ioapics[MAX_IO_APICS];
144
145/* # of MP IRQ source entries */
146extern int mp_irq_entries;
147
148/* MP IRQ source entries */
149extern struct mp_config_intsrc mp_irqs[MAX_IRQ_SOURCES];
150
151/* non-0 if default (table-less) MP configuration */
152extern int mpc_default_type;
153
154/* Older SiS APIC requires we rewrite the index register */
155extern int sis_apic_bug;
156
157/* 1 if "noapic" boot option passed */
158extern int skip_ioapic_setup;
159
160/* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */
161extern int timer_through_8259;
162
163static inline void disable_ioapic_setup(void)
164{
165 skip_ioapic_setup = 1;
166}
167
168/*
169 * If we use the IO-APIC for IRQ routing, disable automatic
170 * assignment of PCI IRQ's.
171 */
172#define io_apic_assign_pci_irqs \
173 (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs)
174
175#ifdef CONFIG_ACPI
176extern int io_apic_get_unique_id(int ioapic, int apic_id);
177extern int io_apic_get_version(int ioapic);
178extern int io_apic_get_redir_entries(int ioapic);
179extern int io_apic_set_pci_routing(int ioapic, int pin, int irq,
180 int edge_level, int active_high_low);
181#endif /* CONFIG_ACPI */
182
183extern int (*ioapic_renumber_irq)(int ioapic, int irq);
184extern void ioapic_init_mappings(void);
185
186#else /* !CONFIG_X86_IO_APIC */
187#define io_apic_assign_pci_irqs 0
188static const int timer_through_8259 = 0;
189static inline void ioapic_init_mappings(void) { }
190#endif
191
192#endif
diff --git a/include/asm-x86/ioctl.h b/include/asm-x86/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/include/asm-x86/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/include/asm-x86/ioctls.h b/include/asm-x86/ioctls.h
deleted file mode 100644
index c0c338bd4068..000000000000
--- a/include/asm-x86/ioctls.h
+++ /dev/null
@@ -1,88 +0,0 @@
1#ifndef _ASM_X86_IOCTLS_H
2#define _ASM_X86_IOCTLS_H
3
4#include <asm/ioctl.h>
5
6/* 0x54 is just a magic number to make these relatively unique ('T') */
7
8#define TCGETS 0x5401
9#define TCSETS 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
10#define TCSETSW 0x5403
11#define TCSETSF 0x5404
12#define TCGETA 0x5405
13#define TCSETA 0x5406
14#define TCSETAW 0x5407
15#define TCSETAF 0x5408
16#define TCSBRK 0x5409
17#define TCXONC 0x540A
18#define TCFLSH 0x540B
19#define TIOCEXCL 0x540C
20#define TIOCNXCL 0x540D
21#define TIOCSCTTY 0x540E
22#define TIOCGPGRP 0x540F
23#define TIOCSPGRP 0x5410
24#define TIOCOUTQ 0x5411
25#define TIOCSTI 0x5412
26#define TIOCGWINSZ 0x5413
27#define TIOCSWINSZ 0x5414
28#define TIOCMGET 0x5415
29#define TIOCMBIS 0x5416
30#define TIOCMBIC 0x5417
31#define TIOCMSET 0x5418
32#define TIOCGSOFTCAR 0x5419
33#define TIOCSSOFTCAR 0x541A
34#define FIONREAD 0x541B
35#define TIOCINQ FIONREAD
36#define TIOCLINUX 0x541C
37#define TIOCCONS 0x541D
38#define TIOCGSERIAL 0x541E
39#define TIOCSSERIAL 0x541F
40#define TIOCPKT 0x5420
41#define FIONBIO 0x5421
42#define TIOCNOTTY 0x5422
43#define TIOCSETD 0x5423
44#define TIOCGETD 0x5424
45#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
46/* #define TIOCTTYGSTRUCT 0x5426 - Former debugging-only ioctl */
47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T', 0x2A, struct termios2)
51#define TCSETS2 _IOW('T', 0x2B, struct termios2)
52#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
53#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
54#define TIOCGPTN _IOR('T', 0x30, unsigned int)
55 /* Get Pty Number (of pty-mux device) */
56#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
57
58#define FIONCLEX 0x5450
59#define FIOCLEX 0x5451
60#define FIOASYNC 0x5452
61#define TIOCSERCONFIG 0x5453
62#define TIOCSERGWILD 0x5454
63#define TIOCSERSWILD 0x5455
64#define TIOCGLCKTRMIOS 0x5456
65#define TIOCSLCKTRMIOS 0x5457
66#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
67#define TIOCSERGETLSR 0x5459 /* Get line status register */
68#define TIOCSERGETMULTI 0x545A /* Get multiport config */
69#define TIOCSERSETMULTI 0x545B /* Set multiport config */
70
71#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
72#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
73#define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
74#define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
75#define FIOQSIZE 0x5460
76
77/* Used for packet mode */
78#define TIOCPKT_DATA 0
79#define TIOCPKT_FLUSHREAD 1
80#define TIOCPKT_FLUSHWRITE 2
81#define TIOCPKT_STOP 4
82#define TIOCPKT_START 8
83#define TIOCPKT_NOSTOP 16
84#define TIOCPKT_DOSTOP 32
85
86#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
87
88#endif
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
deleted file mode 100644
index 5f888cc5be49..000000000000
--- a/include/asm-x86/iommu.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef _ASM_X8664_IOMMU_H
2#define _ASM_X8664_IOMMU_H 1
3
4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void);
6extern struct dma_mapping_ops nommu_dma_ops;
7extern int force_iommu, no_iommu;
8extern int iommu_detected;
9
10extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
11
12#ifdef CONFIG_GART_IOMMU
13extern int gart_iommu_aperture;
14extern int gart_iommu_aperture_allowed;
15extern int gart_iommu_aperture_disabled;
16
17extern void early_gart_iommu_check(void);
18extern void gart_iommu_init(void);
19extern void gart_iommu_shutdown(void);
20extern void __init gart_parse_options(char *);
21extern void gart_iommu_hole_init(void);
22
23#else
24#define gart_iommu_aperture 0
25#define gart_iommu_aperture_allowed 0
26#define gart_iommu_aperture_disabled 1
27
28static inline void early_gart_iommu_check(void)
29{
30}
31static inline void gart_iommu_init(void)
32{
33}
34static inline void gart_iommu_shutdown(void)
35{
36}
37static inline void gart_parse_options(char *options)
38{
39}
40static inline void gart_iommu_hole_init(void)
41{
42}
43#endif
44
45#endif
diff --git a/include/asm-x86/ipcbuf.h b/include/asm-x86/ipcbuf.h
deleted file mode 100644
index ee678fd51594..000000000000
--- a/include/asm-x86/ipcbuf.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _ASM_X86_IPCBUF_H
2#define _ASM_X86_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for x86 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm {
15 __kernel_key_t key;
16 __kernel_uid32_t uid;
17 __kernel_gid32_t gid;
18 __kernel_uid32_t cuid;
19 __kernel_gid32_t cgid;
20 __kernel_mode_t mode;
21 unsigned short __pad1;
22 unsigned short seq;
23 unsigned short __pad2;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _ASM_X86_IPCBUF_H */
diff --git a/include/asm-x86/ipi.h b/include/asm-x86/ipi.h
deleted file mode 100644
index bb1c09f7a76c..000000000000
--- a/include/asm-x86/ipi.h
+++ /dev/null
@@ -1,132 +0,0 @@
1#ifndef __ASM_IPI_H
2#define __ASM_IPI_H
3
4/*
5 * Copyright 2004 James Cleverdon, IBM.
6 * Subject to the GNU Public License, v.2
7 *
8 * Generic APIC InterProcessor Interrupt code.
9 *
10 * Moved to include file by James Cleverdon from
11 * arch/x86-64/kernel/smp.c
12 *
13 * Copyrights from kernel/smp.c:
14 *
15 * (c) 1995 Alan Cox, Building #3 <alan@redhat.com>
16 * (c) 1998-99, 2000 Ingo Molnar <mingo@redhat.com>
17 * (c) 2002,2003 Andi Kleen, SuSE Labs.
18 * Subject to the GNU Public License, v.2
19 */
20
21#include <asm/hw_irq.h>
22#include <asm/apic.h>
23#include <asm/smp.h>
24
25/*
26 * the following functions deal with sending IPIs between CPUs.
27 *
28 * We use 'broadcast', CPU->CPU IPIs and self-IPIs too.
29 */
30
31static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
32 unsigned int dest)
33{
34 unsigned int icr = shortcut | dest;
35
36 switch (vector) {
37 default:
38 icr |= APIC_DM_FIXED | vector;
39 break;
40 case NMI_VECTOR:
41 icr |= APIC_DM_NMI;
42 break;
43 }
44 return icr;
45}
46
47static inline int __prepare_ICR2(unsigned int mask)
48{
49 return SET_APIC_DEST_FIELD(mask);
50}
51
52static inline void __send_IPI_shortcut(unsigned int shortcut, int vector,
53 unsigned int dest)
54{
55 /*
56 * Subtle. In the case of the 'never do double writes' workaround
57 * we have to lock out interrupts to be safe. As we don't care
58 * of the value read we use an atomic rmw access to avoid costly
59 * cli/sti. Otherwise we use an even cheaper single atomic write
60 * to the APIC.
61 */
62 unsigned int cfg;
63
64 /*
65 * Wait for idle.
66 */
67 apic_wait_icr_idle();
68
69 /*
70 * No need to touch the target chip field
71 */
72 cfg = __prepare_ICR(shortcut, vector, dest);
73
74 /*
75 * Send the IPI. The write to APIC_ICR fires this off.
76 */
77 apic_write(APIC_ICR, cfg);
78}
79
80/*
81 * This is used to send an IPI with no shorthand notation (the destination is
82 * specified in bits 56 to 63 of the ICR).
83 */
84static inline void __send_IPI_dest_field(unsigned int mask, int vector,
85 unsigned int dest)
86{
87 unsigned long cfg;
88
89 /*
90 * Wait for idle.
91 */
92 if (unlikely(vector == NMI_VECTOR))
93 safe_apic_wait_icr_idle();
94 else
95 apic_wait_icr_idle();
96
97 /*
98 * prepare target chip field
99 */
100 cfg = __prepare_ICR2(mask);
101 apic_write(APIC_ICR2, cfg);
102
103 /*
104 * program the ICR
105 */
106 cfg = __prepare_ICR(0, vector, dest);
107
108 /*
109 * Send the IPI. The write to APIC_ICR fires this off.
110 */
111 apic_write(APIC_ICR, cfg);
112}
113
114static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
115{
116 unsigned long flags;
117 unsigned long query_cpu;
118
119 /*
120 * Hack. The clustered APIC addressing mode doesn't allow us to send
121 * to an arbitrary mask, so I do a unicast to each CPU instead.
122 * - mbligh
123 */
124 local_irq_save(flags);
125 for_each_cpu_mask_nr(query_cpu, mask) {
126 __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu),
127 vector, APIC_DEST_PHYSICAL);
128 }
129 local_irq_restore(flags);
130}
131
132#endif /* __ASM_IPI_H */
diff --git a/include/asm-x86/irq.h b/include/asm-x86/irq.h
deleted file mode 100644
index 1a2925757317..000000000000
--- a/include/asm-x86/irq.h
+++ /dev/null
@@ -1,50 +0,0 @@
1#ifndef _ASM_IRQ_H
2#define _ASM_IRQ_H
3/*
4 * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
5 *
6 * IRQ/IPI changes taken from work by Thomas Radke
7 * <tomsoft@informatik.tu-chemnitz.de>
8 */
9
10#include <asm/apicdef.h>
11#include <asm/irq_vectors.h>
12
13static inline int irq_canonicalize(int irq)
14{
15 return ((irq == 2) ? 9 : irq);
16}
17
18#ifdef CONFIG_X86_LOCAL_APIC
19# define ARCH_HAS_NMI_WATCHDOG
20#endif
21
22#ifdef CONFIG_4KSTACKS
23 extern void irq_ctx_init(int cpu);
24 extern void irq_ctx_exit(int cpu);
25# define __ARCH_HAS_DO_SOFTIRQ
26#else
27# define irq_ctx_init(cpu) do { } while (0)
28# define irq_ctx_exit(cpu) do { } while (0)
29# ifdef CONFIG_X86_64
30# define __ARCH_HAS_DO_SOFTIRQ
31# endif
32#endif
33
34#ifdef CONFIG_IRQBALANCE
35extern int irqbalance_disable(char *str);
36#endif
37
38#ifdef CONFIG_HOTPLUG_CPU
39#include <linux/cpumask.h>
40extern void fixup_irqs(cpumask_t map);
41#endif
42
43extern unsigned int do_IRQ(struct pt_regs *regs);
44extern void init_IRQ(void);
45extern void native_init_IRQ(void);
46
47/* Interrupt vector management */
48extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
49
50#endif /* _ASM_IRQ_H */
diff --git a/include/asm-x86/irq_regs.h b/include/asm-x86/irq_regs.h
deleted file mode 100644
index 89c898ab298b..000000000000
--- a/include/asm-x86/irq_regs.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "irq_regs_32.h"
3#else
4# include "irq_regs_64.h"
5#endif
diff --git a/include/asm-x86/irq_regs_32.h b/include/asm-x86/irq_regs_32.h
deleted file mode 100644
index 3368b20c0b48..000000000000
--- a/include/asm-x86/irq_regs_32.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Per-cpu current frame pointer - the location of the last exception frame on
3 * the stack, stored in the per-cpu area.
4 *
5 * Jeremy Fitzhardinge <jeremy@goop.org>
6 */
7#ifndef _ASM_I386_IRQ_REGS_H
8#define _ASM_I386_IRQ_REGS_H
9
10#include <asm/percpu.h>
11
12DECLARE_PER_CPU(struct pt_regs *, irq_regs);
13
14static inline struct pt_regs *get_irq_regs(void)
15{
16 return x86_read_percpu(irq_regs);
17}
18
19static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs)
20{
21 struct pt_regs *old_regs;
22
23 old_regs = get_irq_regs();
24 x86_write_percpu(irq_regs, new_regs);
25
26 return old_regs;
27}
28
29#endif /* _ASM_I386_IRQ_REGS_H */
diff --git a/include/asm-x86/irq_regs_64.h b/include/asm-x86/irq_regs_64.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/include/asm-x86/irq_regs_64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/include/asm-x86/irq_vectors.h b/include/asm-x86/irq_vectors.h
deleted file mode 100644
index a48c7f2dbdc0..000000000000
--- a/include/asm-x86/irq_vectors.h
+++ /dev/null
@@ -1,182 +0,0 @@
1#ifndef _ASM_IRQ_VECTORS_H
2#define _ASM_IRQ_VECTORS_H
3
4#include <linux/threads.h>
5
6#define NMI_VECTOR 0x02
7
8/*
9 * IDT vectors usable for external interrupt sources start
10 * at 0x20:
11 */
12#define FIRST_EXTERNAL_VECTOR 0x20
13
14#ifdef CONFIG_X86_32
15# define SYSCALL_VECTOR 0x80
16#else
17# define IA32_SYSCALL_VECTOR 0x80
18#endif
19
20/*
21 * Reserve the lowest usable priority level 0x20 - 0x2f for triggering
22 * cleanup after irq migration on 64 bit.
23 */
24#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
25
26/*
27 * Vectors 0x20-0x2f are used for ISA interrupts on 32 bit.
28 * Vectors 0x30-0x3f are used for ISA interrupts on 64 bit.
29 */
30#ifdef CONFIG_X86_32
31#define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR)
32#else
33#define IRQ0_VECTOR (FIRST_EXTERNAL_VECTOR + 0x10)
34#endif
35#define IRQ1_VECTOR (IRQ0_VECTOR + 1)
36#define IRQ2_VECTOR (IRQ0_VECTOR + 2)
37#define IRQ3_VECTOR (IRQ0_VECTOR + 3)
38#define IRQ4_VECTOR (IRQ0_VECTOR + 4)
39#define IRQ5_VECTOR (IRQ0_VECTOR + 5)
40#define IRQ6_VECTOR (IRQ0_VECTOR + 6)
41#define IRQ7_VECTOR (IRQ0_VECTOR + 7)
42#define IRQ8_VECTOR (IRQ0_VECTOR + 8)
43#define IRQ9_VECTOR (IRQ0_VECTOR + 9)
44#define IRQ10_VECTOR (IRQ0_VECTOR + 10)
45#define IRQ11_VECTOR (IRQ0_VECTOR + 11)
46#define IRQ12_VECTOR (IRQ0_VECTOR + 12)
47#define IRQ13_VECTOR (IRQ0_VECTOR + 13)
48#define IRQ14_VECTOR (IRQ0_VECTOR + 14)
49#define IRQ15_VECTOR (IRQ0_VECTOR + 15)
50
51/*
52 * Special IRQ vectors used by the SMP architecture, 0xf0-0xff
53 *
54 * some of the following vectors are 'rare', they are merged
55 * into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
56 * TLB, reschedule and local APIC vectors are performance-critical.
57 *
58 * Vectors 0xf0-0xfa are free (reserved for future Linux use).
59 */
60#ifdef CONFIG_X86_32
61
62# define SPURIOUS_APIC_VECTOR 0xff
63# define ERROR_APIC_VECTOR 0xfe
64# define INVALIDATE_TLB_VECTOR 0xfd
65# define RESCHEDULE_VECTOR 0xfc
66# define CALL_FUNCTION_VECTOR 0xfb
67# define CALL_FUNCTION_SINGLE_VECTOR 0xfa
68# define THERMAL_APIC_VECTOR 0xf0
69
70#else
71
72#define SPURIOUS_APIC_VECTOR 0xff
73#define ERROR_APIC_VECTOR 0xfe
74#define RESCHEDULE_VECTOR 0xfd
75#define CALL_FUNCTION_VECTOR 0xfc
76#define CALL_FUNCTION_SINGLE_VECTOR 0xfb
77#define THERMAL_APIC_VECTOR 0xfa
78#define THRESHOLD_APIC_VECTOR 0xf9
79#define UV_BAU_MESSAGE 0xf8
80#define INVALIDATE_TLB_VECTOR_END 0xf7
81#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
82
83#define NUM_INVALIDATE_TLB_VECTORS 8
84
85#endif
86
87/*
88 * Local APIC timer IRQ vector is on a different priority level,
89 * to work around the 'lost local interrupt if more than 2 IRQ
90 * sources per level' errata.
91 */
92#define LOCAL_TIMER_VECTOR 0xef
93
94/*
95 * First APIC vector available to drivers: (vectors 0x30-0xee) we
96 * start at 0x31(0x41) to spread out vectors evenly between priority
97 * levels. (0x80 is the syscall vector)
98 */
99#ifdef CONFIG_X86_32
100# define FIRST_DEVICE_VECTOR 0x31
101#else
102# define FIRST_DEVICE_VECTOR (IRQ15_VECTOR + 2)
103#endif
104
105#define NR_VECTORS 256
106
107#define FPU_IRQ 13
108
109#define FIRST_VM86_IRQ 3
110#define LAST_VM86_IRQ 15
111#define invalid_vm86_irq(irq) ((irq) < 3 || (irq) > 15)
112
113#ifdef CONFIG_X86_64
114# if NR_CPUS < MAX_IO_APICS
115# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
116# else
117# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
118# endif
119# define NR_IRQ_VECTORS NR_IRQS
120
121#elif !defined(CONFIG_X86_VOYAGER)
122
123# if defined(CONFIG_X86_IO_APIC) || defined(CONFIG_PARAVIRT) || defined(CONFIG_X86_VISWS)
124
125# define NR_IRQS 224
126
127# if (224 >= 32 * NR_CPUS)
128# define NR_IRQ_VECTORS NR_IRQS
129# else
130# define NR_IRQ_VECTORS (32 * NR_CPUS)
131# endif
132
133# else /* IO_APIC || PARAVIRT */
134
135# define NR_IRQS 16
136# define NR_IRQ_VECTORS NR_IRQS
137
138# endif
139
140#else /* !VISWS && !VOYAGER */
141
142# define NR_IRQS 224
143# define NR_IRQ_VECTORS NR_IRQS
144
145#endif /* VISWS */
146
147/* Voyager specific defines */
148/* These define the CPIs we use in linux */
149#define VIC_CPI_LEVEL0 0
150#define VIC_CPI_LEVEL1 1
151/* now the fake CPIs */
152#define VIC_TIMER_CPI 2
153#define VIC_INVALIDATE_CPI 3
154#define VIC_RESCHEDULE_CPI 4
155#define VIC_ENABLE_IRQ_CPI 5
156#define VIC_CALL_FUNCTION_CPI 6
157#define VIC_CALL_FUNCTION_SINGLE_CPI 7
158
159/* Now the QIC CPIs: Since we don't need the two initial levels,
160 * these are 2 less than the VIC CPIs */
161#define QIC_CPI_OFFSET 1
162#define QIC_TIMER_CPI (VIC_TIMER_CPI - QIC_CPI_OFFSET)
163#define QIC_INVALIDATE_CPI (VIC_INVALIDATE_CPI - QIC_CPI_OFFSET)
164#define QIC_RESCHEDULE_CPI (VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET)
165#define QIC_ENABLE_IRQ_CPI (VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET)
166#define QIC_CALL_FUNCTION_CPI (VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET)
167#define QIC_CALL_FUNCTION_SINGLE_CPI (VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET)
168
169#define VIC_START_FAKE_CPI VIC_TIMER_CPI
170#define VIC_END_FAKE_CPI VIC_CALL_FUNCTION_SINGLE_CPI
171
172/* this is the SYS_INT CPI. */
173#define VIC_SYS_INT 8
174#define VIC_CMN_INT 15
175
176/* This is the boot CPI for alternate processors. It gets overwritten
177 * by the above once the system has activated all available processors */
178#define VIC_CPU_BOOT_CPI VIC_CPI_LEVEL0
179#define VIC_CPU_BOOT_ERRATA_CPI (VIC_CPI_LEVEL0 + 8)
180
181
182#endif /* _ASM_IRQ_VECTORS_H */
diff --git a/include/asm-x86/irqflags.h b/include/asm-x86/irqflags.h
deleted file mode 100644
index 424acb48cd61..000000000000
--- a/include/asm-x86/irqflags.h
+++ /dev/null
@@ -1,232 +0,0 @@
1#ifndef _X86_IRQFLAGS_H_
2#define _X86_IRQFLAGS_H_
3
4#include <asm/processor-flags.h>
5
6#ifndef __ASSEMBLY__
7/*
8 * Interrupt control:
9 */
10
11static inline unsigned long native_save_fl(void)
12{
13 unsigned long flags;
14
15 asm volatile("# __raw_save_flags\n\t"
16 "pushf ; pop %0"
17 : "=g" (flags)
18 : /* no input */
19 : "memory");
20
21 return flags;
22}
23
24static inline void native_restore_fl(unsigned long flags)
25{
26 asm volatile("push %0 ; popf"
27 : /* no output */
28 :"g" (flags)
29 :"memory", "cc");
30}
31
32static inline void native_irq_disable(void)
33{
34 asm volatile("cli": : :"memory");
35}
36
37static inline void native_irq_enable(void)
38{
39 asm volatile("sti": : :"memory");
40}
41
42static inline void native_safe_halt(void)
43{
44 asm volatile("sti; hlt": : :"memory");
45}
46
47static inline void native_halt(void)
48{
49 asm volatile("hlt": : :"memory");
50}
51
52#endif
53
54#ifdef CONFIG_PARAVIRT
55#include <asm/paravirt.h>
56#else
57#ifndef __ASSEMBLY__
58
59static inline unsigned long __raw_local_save_flags(void)
60{
61 return native_save_fl();
62}
63
64static inline void raw_local_irq_restore(unsigned long flags)
65{
66 native_restore_fl(flags);
67}
68
69static inline void raw_local_irq_disable(void)
70{
71 native_irq_disable();
72}
73
74static inline void raw_local_irq_enable(void)
75{
76 native_irq_enable();
77}
78
79/*
80 * Used in the idle loop; sti takes one instruction cycle
81 * to complete:
82 */
83static inline void raw_safe_halt(void)
84{
85 native_safe_halt();
86}
87
88/*
89 * Used when interrupts are already enabled or to
90 * shutdown the processor:
91 */
92static inline void halt(void)
93{
94 native_halt();
95}
96
97/*
98 * For spinlocks, etc:
99 */
100static inline unsigned long __raw_local_irq_save(void)
101{
102 unsigned long flags = __raw_local_save_flags();
103
104 raw_local_irq_disable();
105
106 return flags;
107}
108#else
109
110#define ENABLE_INTERRUPTS(x) sti
111#define DISABLE_INTERRUPTS(x) cli
112
113#ifdef CONFIG_X86_64
114#define SWAPGS swapgs
115/*
116 * Currently paravirt can't handle swapgs nicely when we
117 * don't have a stack we can rely on (such as a user space
118 * stack). So we either find a way around these or just fault
119 * and emulate if a guest tries to call swapgs directly.
120 *
121 * Either way, this is a good way to document that we don't
122 * have a reliable stack. x86_64 only.
123 */
124#define SWAPGS_UNSAFE_STACK swapgs
125
126#define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */
127
128#define INTERRUPT_RETURN iretq
129#define USERGS_SYSRET64 \
130 swapgs; \
131 sysretq;
132#define USERGS_SYSRET32 \
133 swapgs; \
134 sysretl
135#define ENABLE_INTERRUPTS_SYSEXIT32 \
136 swapgs; \
137 sti; \
138 sysexit
139
140#else
141#define INTERRUPT_RETURN iret
142#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
143#define GET_CR0_INTO_EAX movl %cr0, %eax
144#endif
145
146
147#endif /* __ASSEMBLY__ */
148#endif /* CONFIG_PARAVIRT */
149
150#ifndef __ASSEMBLY__
151#define raw_local_save_flags(flags) \
152 do { (flags) = __raw_local_save_flags(); } while (0)
153
154#define raw_local_irq_save(flags) \
155 do { (flags) = __raw_local_irq_save(); } while (0)
156
157static inline int raw_irqs_disabled_flags(unsigned long flags)
158{
159 return !(flags & X86_EFLAGS_IF);
160}
161
162static inline int raw_irqs_disabled(void)
163{
164 unsigned long flags = __raw_local_save_flags();
165
166 return raw_irqs_disabled_flags(flags);
167}
168
169/*
170 * makes the traced hardirq state match with the machine state
171 *
172 * should be a rarely used function, only in places where its
173 * otherwise impossible to know the irq state, like in traps.
174 */
175static inline void trace_hardirqs_fixup_flags(unsigned long flags)
176{
177 if (raw_irqs_disabled_flags(flags))
178 trace_hardirqs_off();
179 else
180 trace_hardirqs_on();
181}
182
183static inline void trace_hardirqs_fixup(void)
184{
185 unsigned long flags = __raw_local_save_flags();
186
187 trace_hardirqs_fixup_flags(flags);
188}
189
190#else
191
192#ifdef CONFIG_X86_64
193#define ARCH_LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk
194#define ARCH_LOCKDEP_SYS_EXIT_IRQ \
195 TRACE_IRQS_ON; \
196 sti; \
197 SAVE_REST; \
198 LOCKDEP_SYS_EXIT; \
199 RESTORE_REST; \
200 cli; \
201 TRACE_IRQS_OFF;
202
203#else
204#define ARCH_LOCKDEP_SYS_EXIT \
205 pushl %eax; \
206 pushl %ecx; \
207 pushl %edx; \
208 call lockdep_sys_exit; \
209 popl %edx; \
210 popl %ecx; \
211 popl %eax;
212
213#define ARCH_LOCKDEP_SYS_EXIT_IRQ
214#endif
215
216#ifdef CONFIG_TRACE_IRQFLAGS
217# define TRACE_IRQS_ON call trace_hardirqs_on_thunk;
218# define TRACE_IRQS_OFF call trace_hardirqs_off_thunk;
219#else
220# define TRACE_IRQS_ON
221# define TRACE_IRQS_OFF
222#endif
223#ifdef CONFIG_DEBUG_LOCK_ALLOC
224# define LOCKDEP_SYS_EXIT ARCH_LOCKDEP_SYS_EXIT
225# define LOCKDEP_SYS_EXIT_IRQ ARCH_LOCKDEP_SYS_EXIT_IRQ
226# else
227# define LOCKDEP_SYS_EXIT
228# define LOCKDEP_SYS_EXIT_IRQ
229# endif
230
231#endif /* __ASSEMBLY__ */
232#endif
diff --git a/include/asm-x86/ist.h b/include/asm-x86/ist.h
deleted file mode 100644
index 6ec6ceed95a7..000000000000
--- a/include/asm-x86/ist.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef _ASM_IST_H
2#define _ASM_IST_H
3
4/*
5 * Include file for the interface to IST BIOS
6 * Copyright 2002 Andy Grover <andrew.grover@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */
18
19
20#include <linux/types.h>
21
22struct ist_info {
23 __u32 signature;
24 __u32 command;
25 __u32 event;
26 __u32 perf_level;
27};
28
29#ifdef __KERNEL__
30
31extern struct ist_info ist_info;
32
33#endif /* __KERNEL__ */
34#endif /* _ASM_IST_H */
diff --git a/include/asm-x86/k8.h b/include/asm-x86/k8.h
deleted file mode 100644
index 452e2b696ff4..000000000000
--- a/include/asm-x86/k8.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_K8_H
2#define _ASM_K8_H 1
3
4#include <linux/pci.h>
5
6extern struct pci_device_id k8_nb_ids[];
7
8extern int early_is_k8_nb(u32 value);
9extern struct pci_dev **k8_northbridges;
10extern int num_k8_northbridges;
11extern int cache_k8_northbridges(void);
12extern void k8_flush_garts(void);
13extern int k8_scan_nodes(unsigned long start, unsigned long end);
14
15#endif
diff --git a/include/asm-x86/kdebug.h b/include/asm-x86/kdebug.h
deleted file mode 100644
index 96651bb59ba1..000000000000
--- a/include/asm-x86/kdebug.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_X86_KDEBUG_H
2#define _ASM_X86_KDEBUG_H
3
4#include <linux/notifier.h>
5
6struct pt_regs;
7
8/* Grossly misnamed. */
9enum die_val {
10 DIE_OOPS = 1,
11 DIE_INT3,
12 DIE_DEBUG,
13 DIE_PANIC,
14 DIE_NMI,
15 DIE_DIE,
16 DIE_NMIWATCHDOG,
17 DIE_KERNELDEBUG,
18 DIE_TRAP,
19 DIE_GPF,
20 DIE_CALL,
21 DIE_NMI_IPI,
22 DIE_PAGE_FAULT,
23 DIE_NMIUNKNOWN,
24};
25
26extern void printk_address(unsigned long address, int reliable);
27extern void die(const char *, struct pt_regs *,long);
28extern int __must_check __die(const char *, struct pt_regs *, long);
29extern void show_registers(struct pt_regs *regs);
30extern void __show_registers(struct pt_regs *, int all);
31extern void show_trace(struct task_struct *t, struct pt_regs *regs,
32 unsigned long *sp, unsigned long bp);
33extern void __show_regs(struct pt_regs *regs);
34extern void show_regs(struct pt_regs *regs);
35extern unsigned long oops_begin(void);
36extern void oops_end(unsigned long, struct pt_regs *, int signr);
37
38#endif
diff --git a/include/asm-x86/kexec.h b/include/asm-x86/kexec.h
deleted file mode 100644
index 4246ab7dc988..000000000000
--- a/include/asm-x86/kexec.h
+++ /dev/null
@@ -1,175 +0,0 @@
1#ifndef _KEXEC_H
2#define _KEXEC_H
3
4#ifdef CONFIG_X86_32
5# define PA_CONTROL_PAGE 0
6# define VA_CONTROL_PAGE 1
7# define PA_PGD 2
8# define VA_PGD 3
9# define PA_PTE_0 4
10# define VA_PTE_0 5
11# define PA_PTE_1 6
12# define VA_PTE_1 7
13# define PA_SWAP_PAGE 8
14# ifdef CONFIG_X86_PAE
15# define PA_PMD_0 9
16# define VA_PMD_0 10
17# define PA_PMD_1 11
18# define VA_PMD_1 12
19# define PAGES_NR 13
20# else
21# define PAGES_NR 9
22# endif
23#else
24# define PA_CONTROL_PAGE 0
25# define VA_CONTROL_PAGE 1
26# define PA_PGD 2
27# define VA_PGD 3
28# define PA_PUD_0 4
29# define VA_PUD_0 5
30# define PA_PMD_0 6
31# define VA_PMD_0 7
32# define PA_PTE_0 8
33# define VA_PTE_0 9
34# define PA_PUD_1 10
35# define VA_PUD_1 11
36# define PA_PMD_1 12
37# define VA_PMD_1 13
38# define PA_PTE_1 14
39# define VA_PTE_1 15
40# define PA_TABLE_PAGE 16
41# define PAGES_NR 17
42#endif
43
44#ifdef CONFIG_X86_32
45# define KEXEC_CONTROL_CODE_MAX_SIZE 2048
46#endif
47
48#ifndef __ASSEMBLY__
49
50#include <linux/string.h>
51
52#include <asm/page.h>
53#include <asm/ptrace.h>
54
55/*
56 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
57 * I.e. Maximum page that is mapped directly into kernel memory,
58 * and kmap is not required.
59 *
60 * So far x86_64 is limited to 40 physical address bits.
61 */
62#ifdef CONFIG_X86_32
63/* Maximum physical address we can use pages from */
64# define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
65/* Maximum address we can reach in physical address mode */
66# define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
67/* Maximum address we can use for the control code buffer */
68# define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
69
70# define KEXEC_CONTROL_PAGE_SIZE 4096
71
72/* The native architecture */
73# define KEXEC_ARCH KEXEC_ARCH_386
74
75/* We can also handle crash dumps from 64 bit kernel. */
76# define vmcore_elf_check_arch_cross(x) ((x)->e_machine == EM_X86_64)
77#else
78/* Maximum physical address we can use pages from */
79# define KEXEC_SOURCE_MEMORY_LIMIT (0xFFFFFFFFFFUL)
80/* Maximum address we can reach in physical address mode */
81# define KEXEC_DESTINATION_MEMORY_LIMIT (0xFFFFFFFFFFUL)
82/* Maximum address we can use for the control pages */
83# define KEXEC_CONTROL_MEMORY_LIMIT (0xFFFFFFFFFFUL)
84
85/* Allocate one page for the pdp and the second for the code */
86# define KEXEC_CONTROL_PAGE_SIZE (4096UL + 4096UL)
87
88/* The native architecture */
89# define KEXEC_ARCH KEXEC_ARCH_X86_64
90#endif
91
92/*
93 * CPU does not save ss and sp on stack if execution is already
94 * running in kernel mode at the time of NMI occurrence. This code
95 * fixes it.
96 */
97static inline void crash_fixup_ss_esp(struct pt_regs *newregs,
98 struct pt_regs *oldregs)
99{
100#ifdef CONFIG_X86_32
101 newregs->sp = (unsigned long)&(oldregs->sp);
102 asm volatile("xorl %%eax, %%eax\n\t"
103 "movw %%ss, %%ax\n\t"
104 :"=a"(newregs->ss));
105#endif
106}
107
108/*
109 * This function is responsible for capturing register states if coming
110 * via panic otherwise just fix up the ss and sp if coming via kernel
111 * mode exception.
112 */
113static inline void crash_setup_regs(struct pt_regs *newregs,
114 struct pt_regs *oldregs)
115{
116 if (oldregs) {
117 memcpy(newregs, oldregs, sizeof(*newregs));
118 crash_fixup_ss_esp(newregs, oldregs);
119 } else {
120#ifdef CONFIG_X86_32
121 asm volatile("movl %%ebx,%0" : "=m"(newregs->bx));
122 asm volatile("movl %%ecx,%0" : "=m"(newregs->cx));
123 asm volatile("movl %%edx,%0" : "=m"(newregs->dx));
124 asm volatile("movl %%esi,%0" : "=m"(newregs->si));
125 asm volatile("movl %%edi,%0" : "=m"(newregs->di));
126 asm volatile("movl %%ebp,%0" : "=m"(newregs->bp));
127 asm volatile("movl %%eax,%0" : "=m"(newregs->ax));
128 asm volatile("movl %%esp,%0" : "=m"(newregs->sp));
129 asm volatile("movl %%ss, %%eax;" :"=a"(newregs->ss));
130 asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs));
131 asm volatile("movl %%ds, %%eax;" :"=a"(newregs->ds));
132 asm volatile("movl %%es, %%eax;" :"=a"(newregs->es));
133 asm volatile("pushfl; popl %0" :"=m"(newregs->flags));
134#else
135 asm volatile("movq %%rbx,%0" : "=m"(newregs->bx));
136 asm volatile("movq %%rcx,%0" : "=m"(newregs->cx));
137 asm volatile("movq %%rdx,%0" : "=m"(newregs->dx));
138 asm volatile("movq %%rsi,%0" : "=m"(newregs->si));
139 asm volatile("movq %%rdi,%0" : "=m"(newregs->di));
140 asm volatile("movq %%rbp,%0" : "=m"(newregs->bp));
141 asm volatile("movq %%rax,%0" : "=m"(newregs->ax));
142 asm volatile("movq %%rsp,%0" : "=m"(newregs->sp));
143 asm volatile("movq %%r8,%0" : "=m"(newregs->r8));
144 asm volatile("movq %%r9,%0" : "=m"(newregs->r9));
145 asm volatile("movq %%r10,%0" : "=m"(newregs->r10));
146 asm volatile("movq %%r11,%0" : "=m"(newregs->r11));
147 asm volatile("movq %%r12,%0" : "=m"(newregs->r12));
148 asm volatile("movq %%r13,%0" : "=m"(newregs->r13));
149 asm volatile("movq %%r14,%0" : "=m"(newregs->r14));
150 asm volatile("movq %%r15,%0" : "=m"(newregs->r15));
151 asm volatile("movl %%ss, %%eax;" :"=a"(newregs->ss));
152 asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs));
153 asm volatile("pushfq; popq %0" :"=m"(newregs->flags));
154#endif
155 newregs->ip = (unsigned long)current_text_addr();
156 }
157}
158
159#ifdef CONFIG_X86_32
160asmlinkage unsigned long
161relocate_kernel(unsigned long indirection_page,
162 unsigned long control_page,
163 unsigned long start_address,
164 unsigned int has_pae,
165 unsigned int preserve_context);
166#else
167NORET_TYPE void
168relocate_kernel(unsigned long indirection_page,
169 unsigned long page_list,
170 unsigned long start_address) ATTRIB_NORET;
171#endif
172
173#endif /* __ASSEMBLY__ */
174
175#endif /* _KEXEC_H */
diff --git a/include/asm-x86/kgdb.h b/include/asm-x86/kgdb.h
deleted file mode 100644
index 94d63db10365..000000000000
--- a/include/asm-x86/kgdb.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _ASM_KGDB_H_
2#define _ASM_KGDB_H_
3
4/*
5 * Copyright (C) 2001-2004 Amit S. Kale
6 * Copyright (C) 2008 Wind River Systems, Inc.
7 */
8
9/*
10 * BUFMAX defines the maximum number of characters in inbound/outbound
11 * buffers at least NUMREGBYTES*2 are needed for register packets
12 * Longer buffer is needed to list all threads
13 */
14#define BUFMAX 1024
15
16/*
17 * Note that this register image is in a different order than
18 * the register image that Linux produces at interrupt time.
19 *
20 * Linux's register image is defined by struct pt_regs in ptrace.h.
21 * Just why GDB uses a different order is a historical mystery.
22 */
23#ifdef CONFIG_X86_32
24enum regnames {
25 GDB_AX, /* 0 */
26 GDB_CX, /* 1 */
27 GDB_DX, /* 2 */
28 GDB_BX, /* 3 */
29 GDB_SP, /* 4 */
30 GDB_BP, /* 5 */
31 GDB_SI, /* 6 */
32 GDB_DI, /* 7 */
33 GDB_PC, /* 8 also known as eip */
34 GDB_PS, /* 9 also known as eflags */
35 GDB_CS, /* 10 */
36 GDB_SS, /* 11 */
37 GDB_DS, /* 12 */
38 GDB_ES, /* 13 */
39 GDB_FS, /* 14 */
40 GDB_GS, /* 15 */
41};
42#define NUMREGBYTES ((GDB_GS+1)*4)
43#else /* ! CONFIG_X86_32 */
44enum regnames64 {
45 GDB_AX, /* 0 */
46 GDB_BX, /* 1 */
47 GDB_CX, /* 2 */
48 GDB_DX, /* 3 */
49 GDB_SI, /* 4 */
50 GDB_DI, /* 5 */
51 GDB_BP, /* 6 */
52 GDB_SP, /* 7 */
53 GDB_R8, /* 8 */
54 GDB_R9, /* 9 */
55 GDB_R10, /* 10 */
56 GDB_R11, /* 11 */
57 GDB_R12, /* 12 */
58 GDB_R13, /* 13 */
59 GDB_R14, /* 14 */
60 GDB_R15, /* 15 */
61 GDB_PC, /* 16 */
62};
63
64enum regnames32 {
65 GDB_PS = 34,
66 GDB_CS,
67 GDB_SS,
68};
69#define NUMREGBYTES ((GDB_SS+1)*4)
70#endif /* CONFIG_X86_32 */
71
72static inline void arch_kgdb_breakpoint(void)
73{
74 asm(" int $3");
75}
76#define BREAK_INSTR_SIZE 1
77#define CACHE_FLUSH_IS_SAFE 1
78
79#endif /* _ASM_KGDB_H_ */
diff --git a/include/asm-x86/kmap_types.h b/include/asm-x86/kmap_types.h
deleted file mode 100644
index 5f4174132a22..000000000000
--- a/include/asm-x86/kmap_types.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_X86_KMAP_TYPES_H
2#define _ASM_X86_KMAP_TYPES_H
3
4#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_TYPE_NR
25};
26
27#undef D
28
29#endif
diff --git a/include/asm-x86/kprobes.h b/include/asm-x86/kprobes.h
deleted file mode 100644
index 54980b0b3892..000000000000
--- a/include/asm-x86/kprobes.h
+++ /dev/null
@@ -1,97 +0,0 @@
1#ifndef _ASM_KPROBES_H
2#define _ASM_KPROBES_H
3/*
4 * Kernel Probes (KProbes)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright (C) IBM Corporation, 2002, 2004
21 *
22 * See arch/x86/kernel/kprobes.c for x86 kprobes history.
23 */
24#include <linux/types.h>
25#include <linux/ptrace.h>
26#include <linux/percpu.h>
27
28#define __ARCH_WANT_KPROBES_INSN_SLOT
29
30struct pt_regs;
31struct kprobe;
32
33typedef u8 kprobe_opcode_t;
34#define BREAKPOINT_INSTRUCTION 0xcc
35#define RELATIVEJUMP_INSTRUCTION 0xe9
36#define MAX_INSN_SIZE 16
37#define MAX_STACK_SIZE 64
38#define MIN_STACK_SIZE(ADDR) \
39 (((MAX_STACK_SIZE) < (((unsigned long)current_thread_info()) + \
40 THREAD_SIZE - (unsigned long)(ADDR))) \
41 ? (MAX_STACK_SIZE) \
42 : (((unsigned long)current_thread_info()) + \
43 THREAD_SIZE - (unsigned long)(ADDR)))
44
45#define flush_insn_slot(p) do { } while (0)
46
47extern const int kretprobe_blacklist_size;
48
49void arch_remove_kprobe(struct kprobe *p);
50void kretprobe_trampoline(void);
51
52/* Architecture specific copy of original instruction*/
53struct arch_specific_insn {
54 /* copy of the original instruction */
55 kprobe_opcode_t *insn;
56 /*
57 * boostable = -1: This instruction type is not boostable.
58 * boostable = 0: This instruction type is boostable.
59 * boostable = 1: This instruction has been boosted: we have
60 * added a relative jump after the instruction copy in insn,
61 * so no single-step and fixup are needed (unless there's
62 * a post_handler or break_handler).
63 */
64 int boostable;
65};
66
67struct prev_kprobe {
68 struct kprobe *kp;
69 unsigned long status;
70 unsigned long old_flags;
71 unsigned long saved_flags;
72};
73
74/* per-cpu kprobe control block */
75struct kprobe_ctlblk {
76 unsigned long kprobe_status;
77 unsigned long kprobe_old_flags;
78 unsigned long kprobe_saved_flags;
79 unsigned long *jprobe_saved_sp;
80 struct pt_regs jprobe_saved_regs;
81 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
82 struct prev_kprobe prev_kprobe;
83};
84
85/* trap3/1 are intr gates for kprobes. So, restore the status of IF,
86 * if necessary, before executing the original int3/1 (trap) handler.
87 */
88static inline void restore_interrupts(struct pt_regs *regs)
89{
90 if (regs->flags & X86_EFLAGS_IF)
91 local_irq_enable();
92}
93
94extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
95extern int kprobe_exceptions_notify(struct notifier_block *self,
96 unsigned long val, void *data);
97#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-x86/kvm.h b/include/asm-x86/kvm.h
deleted file mode 100644
index 6f1840812e59..000000000000
--- a/include/asm-x86/kvm.h
+++ /dev/null
@@ -1,233 +0,0 @@
1#ifndef __LINUX_KVM_X86_H
2#define __LINUX_KVM_X86_H
3
4/*
5 * KVM x86 specific structures and definitions
6 *
7 */
8
9#include <asm/types.h>
10#include <linux/ioctl.h>
11
12/* Architectural interrupt line count. */
13#define KVM_NR_INTERRUPTS 256
14
15struct kvm_memory_alias {
16 __u32 slot; /* this has a different namespace than memory slots */
17 __u32 flags;
18 __u64 guest_phys_addr;
19 __u64 memory_size;
20 __u64 target_phys_addr;
21};
22
23/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
24struct kvm_pic_state {
25 __u8 last_irr; /* edge detection */
26 __u8 irr; /* interrupt request register */
27 __u8 imr; /* interrupt mask register */
28 __u8 isr; /* interrupt service register */
29 __u8 priority_add; /* highest irq priority */
30 __u8 irq_base;
31 __u8 read_reg_select;
32 __u8 poll;
33 __u8 special_mask;
34 __u8 init_state;
35 __u8 auto_eoi;
36 __u8 rotate_on_auto_eoi;
37 __u8 special_fully_nested_mode;
38 __u8 init4; /* true if 4 byte init */
39 __u8 elcr; /* PIIX edge/trigger selection */
40 __u8 elcr_mask;
41};
42
43#define KVM_IOAPIC_NUM_PINS 24
44struct kvm_ioapic_state {
45 __u64 base_address;
46 __u32 ioregsel;
47 __u32 id;
48 __u32 irr;
49 __u32 pad;
50 union {
51 __u64 bits;
52 struct {
53 __u8 vector;
54 __u8 delivery_mode:3;
55 __u8 dest_mode:1;
56 __u8 delivery_status:1;
57 __u8 polarity:1;
58 __u8 remote_irr:1;
59 __u8 trig_mode:1;
60 __u8 mask:1;
61 __u8 reserve:7;
62 __u8 reserved[4];
63 __u8 dest_id;
64 } fields;
65 } redirtbl[KVM_IOAPIC_NUM_PINS];
66};
67
68#define KVM_IRQCHIP_PIC_MASTER 0
69#define KVM_IRQCHIP_PIC_SLAVE 1
70#define KVM_IRQCHIP_IOAPIC 2
71
72/* for KVM_GET_REGS and KVM_SET_REGS */
73struct kvm_regs {
74 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
75 __u64 rax, rbx, rcx, rdx;
76 __u64 rsi, rdi, rsp, rbp;
77 __u64 r8, r9, r10, r11;
78 __u64 r12, r13, r14, r15;
79 __u64 rip, rflags;
80};
81
82/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
83#define KVM_APIC_REG_SIZE 0x400
84struct kvm_lapic_state {
85 char regs[KVM_APIC_REG_SIZE];
86};
87
88struct kvm_segment {
89 __u64 base;
90 __u32 limit;
91 __u16 selector;
92 __u8 type;
93 __u8 present, dpl, db, s, l, g, avl;
94 __u8 unusable;
95 __u8 padding;
96};
97
98struct kvm_dtable {
99 __u64 base;
100 __u16 limit;
101 __u16 padding[3];
102};
103
104
105/* for KVM_GET_SREGS and KVM_SET_SREGS */
106struct kvm_sregs {
107 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
108 struct kvm_segment cs, ds, es, fs, gs, ss;
109 struct kvm_segment tr, ldt;
110 struct kvm_dtable gdt, idt;
111 __u64 cr0, cr2, cr3, cr4, cr8;
112 __u64 efer;
113 __u64 apic_base;
114 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
115};
116
117/* for KVM_GET_FPU and KVM_SET_FPU */
118struct kvm_fpu {
119 __u8 fpr[8][16];
120 __u16 fcw;
121 __u16 fsw;
122 __u8 ftwx; /* in fxsave format */
123 __u8 pad1;
124 __u16 last_opcode;
125 __u64 last_ip;
126 __u64 last_dp;
127 __u8 xmm[16][16];
128 __u32 mxcsr;
129 __u32 pad2;
130};
131
132struct kvm_msr_entry {
133 __u32 index;
134 __u32 reserved;
135 __u64 data;
136};
137
138/* for KVM_GET_MSRS and KVM_SET_MSRS */
139struct kvm_msrs {
140 __u32 nmsrs; /* number of msrs in entries */
141 __u32 pad;
142
143 struct kvm_msr_entry entries[0];
144};
145
146/* for KVM_GET_MSR_INDEX_LIST */
147struct kvm_msr_list {
148 __u32 nmsrs; /* number of msrs in entries */
149 __u32 indices[0];
150};
151
152
153struct kvm_cpuid_entry {
154 __u32 function;
155 __u32 eax;
156 __u32 ebx;
157 __u32 ecx;
158 __u32 edx;
159 __u32 padding;
160};
161
162/* for KVM_SET_CPUID */
163struct kvm_cpuid {
164 __u32 nent;
165 __u32 padding;
166 struct kvm_cpuid_entry entries[0];
167};
168
169struct kvm_cpuid_entry2 {
170 __u32 function;
171 __u32 index;
172 __u32 flags;
173 __u32 eax;
174 __u32 ebx;
175 __u32 ecx;
176 __u32 edx;
177 __u32 padding[3];
178};
179
180#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
181#define KVM_CPUID_FLAG_STATEFUL_FUNC 2
182#define KVM_CPUID_FLAG_STATE_READ_NEXT 4
183
184/* for KVM_SET_CPUID2 */
185struct kvm_cpuid2 {
186 __u32 nent;
187 __u32 padding;
188 struct kvm_cpuid_entry2 entries[0];
189};
190
191/* for KVM_GET_PIT and KVM_SET_PIT */
192struct kvm_pit_channel_state {
193 __u32 count; /* can be 65536 */
194 __u16 latched_count;
195 __u8 count_latched;
196 __u8 status_latched;
197 __u8 status;
198 __u8 read_state;
199 __u8 write_state;
200 __u8 write_latch;
201 __u8 rw_mode;
202 __u8 mode;
203 __u8 bcd;
204 __u8 gate;
205 __s64 count_load_time;
206};
207
208struct kvm_pit_state {
209 struct kvm_pit_channel_state channels[3];
210};
211
212#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
213#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
214#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
215#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
216#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
217#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
218#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
219#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
220#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
221#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
222#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
223#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
224#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
225#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
226#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
227#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
228#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
229#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
230#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
231#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
232
233#endif
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
deleted file mode 100644
index c2e34c275900..000000000000
--- a/include/asm-x86/kvm_host.h
+++ /dev/null
@@ -1,738 +0,0 @@
1#/*
2 * Kernel-based Virtual Machine driver for Linux
3 *
4 * This header defines architecture specific interfaces, x86 version
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2. See
7 * the COPYING file in the top-level directory.
8 *
9 */
10
11#ifndef ASM_KVM_HOST_H
12#define ASM_KVM_HOST_H
13
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/mmu_notifier.h>
17
18#include <linux/kvm.h>
19#include <linux/kvm_para.h>
20#include <linux/kvm_types.h>
21
22#include <asm/pvclock-abi.h>
23#include <asm/desc.h>
24
25#define KVM_MAX_VCPUS 16
26#define KVM_MEMORY_SLOTS 32
27/* memory slots that does not exposed to userspace */
28#define KVM_PRIVATE_MEM_SLOTS 4
29
30#define KVM_PIO_PAGE_OFFSET 1
31#define KVM_COALESCED_MMIO_PAGE_OFFSET 2
32
33#define CR3_PAE_RESERVED_BITS ((X86_CR3_PWT | X86_CR3_PCD) - 1)
34#define CR3_NONPAE_RESERVED_BITS ((PAGE_SIZE-1) & ~(X86_CR3_PWT | X86_CR3_PCD))
35#define CR3_L_MODE_RESERVED_BITS (CR3_NONPAE_RESERVED_BITS | \
36 0xFFFFFF0000000000ULL)
37
38#define KVM_GUEST_CR0_MASK \
39 (X86_CR0_PG | X86_CR0_PE | X86_CR0_WP | X86_CR0_NE \
40 | X86_CR0_NW | X86_CR0_CD)
41#define KVM_VM_CR0_ALWAYS_ON \
42 (X86_CR0_PG | X86_CR0_PE | X86_CR0_WP | X86_CR0_NE | X86_CR0_TS \
43 | X86_CR0_MP)
44#define KVM_GUEST_CR4_MASK \
45 (X86_CR4_VME | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_PGE | X86_CR4_VMXE)
46#define KVM_PMODE_VM_CR4_ALWAYS_ON (X86_CR4_PAE | X86_CR4_VMXE)
47#define KVM_RMODE_VM_CR4_ALWAYS_ON (X86_CR4_VME | X86_CR4_PAE | X86_CR4_VMXE)
48
49#define INVALID_PAGE (~(hpa_t)0)
50#define UNMAPPED_GVA (~(gpa_t)0)
51
52/* shadow tables are PAE even on non-PAE hosts */
53#define KVM_HPAGE_SHIFT 21
54#define KVM_HPAGE_SIZE (1UL << KVM_HPAGE_SHIFT)
55#define KVM_HPAGE_MASK (~(KVM_HPAGE_SIZE - 1))
56
57#define KVM_PAGES_PER_HPAGE (KVM_HPAGE_SIZE / PAGE_SIZE)
58
59#define DE_VECTOR 0
60#define UD_VECTOR 6
61#define NM_VECTOR 7
62#define DF_VECTOR 8
63#define TS_VECTOR 10
64#define NP_VECTOR 11
65#define SS_VECTOR 12
66#define GP_VECTOR 13
67#define PF_VECTOR 14
68#define MC_VECTOR 18
69
70#define SELECTOR_TI_MASK (1 << 2)
71#define SELECTOR_RPL_MASK 0x03
72
73#define IOPL_SHIFT 12
74
75#define KVM_ALIAS_SLOTS 4
76
77#define KVM_PERMILLE_MMU_PAGES 20
78#define KVM_MIN_ALLOC_MMU_PAGES 64
79#define KVM_MMU_HASH_SHIFT 10
80#define KVM_NUM_MMU_PAGES (1 << KVM_MMU_HASH_SHIFT)
81#define KVM_MIN_FREE_MMU_PAGES 5
82#define KVM_REFILL_PAGES 25
83#define KVM_MAX_CPUID_ENTRIES 40
84#define KVM_NR_VAR_MTRR 8
85
86extern spinlock_t kvm_lock;
87extern struct list_head vm_list;
88
89struct kvm_vcpu;
90struct kvm;
91
92enum {
93 VCPU_REGS_RAX = 0,
94 VCPU_REGS_RCX = 1,
95 VCPU_REGS_RDX = 2,
96 VCPU_REGS_RBX = 3,
97 VCPU_REGS_RSP = 4,
98 VCPU_REGS_RBP = 5,
99 VCPU_REGS_RSI = 6,
100 VCPU_REGS_RDI = 7,
101#ifdef CONFIG_X86_64
102 VCPU_REGS_R8 = 8,
103 VCPU_REGS_R9 = 9,
104 VCPU_REGS_R10 = 10,
105 VCPU_REGS_R11 = 11,
106 VCPU_REGS_R12 = 12,
107 VCPU_REGS_R13 = 13,
108 VCPU_REGS_R14 = 14,
109 VCPU_REGS_R15 = 15,
110#endif
111 NR_VCPU_REGS
112};
113
114enum {
115 VCPU_SREG_ES,
116 VCPU_SREG_CS,
117 VCPU_SREG_SS,
118 VCPU_SREG_DS,
119 VCPU_SREG_FS,
120 VCPU_SREG_GS,
121 VCPU_SREG_TR,
122 VCPU_SREG_LDTR,
123};
124
125#include <asm/kvm_x86_emulate.h>
126
127#define KVM_NR_MEM_OBJS 40
128
129struct kvm_guest_debug {
130 int enabled;
131 unsigned long bp[4];
132 int singlestep;
133};
134
135/*
136 * We don't want allocation failures within the mmu code, so we preallocate
137 * enough memory for a single page fault in a cache.
138 */
139struct kvm_mmu_memory_cache {
140 int nobjs;
141 void *objects[KVM_NR_MEM_OBJS];
142};
143
144#define NR_PTE_CHAIN_ENTRIES 5
145
146struct kvm_pte_chain {
147 u64 *parent_ptes[NR_PTE_CHAIN_ENTRIES];
148 struct hlist_node link;
149};
150
151/*
152 * kvm_mmu_page_role, below, is defined as:
153 *
154 * bits 0:3 - total guest paging levels (2-4, or zero for real mode)
155 * bits 4:7 - page table level for this shadow (1-4)
156 * bits 8:9 - page table quadrant for 2-level guests
157 * bit 16 - "metaphysical" - gfn is not a real page (huge page/real mode)
158 * bits 17:19 - common access permissions for all ptes in this shadow page
159 */
160union kvm_mmu_page_role {
161 unsigned word;
162 struct {
163 unsigned glevels:4;
164 unsigned level:4;
165 unsigned quadrant:2;
166 unsigned pad_for_nice_hex_output:6;
167 unsigned metaphysical:1;
168 unsigned access:3;
169 unsigned invalid:1;
170 };
171};
172
173struct kvm_mmu_page {
174 struct list_head link;
175 struct hlist_node hash_link;
176
177 /*
178 * The following two entries are used to key the shadow page in the
179 * hash table.
180 */
181 gfn_t gfn;
182 union kvm_mmu_page_role role;
183
184 u64 *spt;
185 /* hold the gfn of each spte inside spt */
186 gfn_t *gfns;
187 unsigned long slot_bitmap; /* One bit set per slot which has memory
188 * in this shadow page.
189 */
190 int multimapped; /* More than one parent_pte? */
191 int root_count; /* Currently serving as active root */
192 union {
193 u64 *parent_pte; /* !multimapped */
194 struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */
195 };
196};
197
198/*
199 * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
200 * 32-bit). The kvm_mmu structure abstracts the details of the current mmu
201 * mode.
202 */
203struct kvm_mmu {
204 void (*new_cr3)(struct kvm_vcpu *vcpu);
205 int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err);
206 void (*free)(struct kvm_vcpu *vcpu);
207 gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva);
208 void (*prefetch_page)(struct kvm_vcpu *vcpu,
209 struct kvm_mmu_page *page);
210 hpa_t root_hpa;
211 int root_level;
212 int shadow_root_level;
213
214 u64 *pae_root;
215};
216
217struct kvm_vcpu_arch {
218 u64 host_tsc;
219 int interrupt_window_open;
220 unsigned long irq_summary; /* bit vector: 1 per word in irq_pending */
221 DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
222 unsigned long regs[NR_VCPU_REGS]; /* for rsp: vcpu_load_rsp_rip() */
223 unsigned long rip; /* needs vcpu_load_rsp_rip() */
224
225 unsigned long cr0;
226 unsigned long cr2;
227 unsigned long cr3;
228 unsigned long cr4;
229 unsigned long cr8;
230 u64 pdptrs[4]; /* pae */
231 u64 shadow_efer;
232 u64 apic_base;
233 struct kvm_lapic *apic; /* kernel irqchip context */
234 int mp_state;
235 int sipi_vector;
236 u64 ia32_misc_enable_msr;
237 bool tpr_access_reporting;
238
239 struct kvm_mmu mmu;
240
241 struct kvm_mmu_memory_cache mmu_pte_chain_cache;
242 struct kvm_mmu_memory_cache mmu_rmap_desc_cache;
243 struct kvm_mmu_memory_cache mmu_page_cache;
244 struct kvm_mmu_memory_cache mmu_page_header_cache;
245
246 gfn_t last_pt_write_gfn;
247 int last_pt_write_count;
248 u64 *last_pte_updated;
249 gfn_t last_pte_gfn;
250
251 struct {
252 gfn_t gfn; /* presumed gfn during guest pte update */
253 pfn_t pfn; /* pfn corresponding to that gfn */
254 int largepage;
255 unsigned long mmu_seq;
256 } update_pte;
257
258 struct i387_fxsave_struct host_fx_image;
259 struct i387_fxsave_struct guest_fx_image;
260
261 gva_t mmio_fault_cr2;
262 struct kvm_pio_request pio;
263 void *pio_data;
264
265 struct kvm_queued_exception {
266 bool pending;
267 bool has_error_code;
268 u8 nr;
269 u32 error_code;
270 } exception;
271
272 struct {
273 int active;
274 u8 save_iopl;
275 struct kvm_save_segment {
276 u16 selector;
277 unsigned long base;
278 u32 limit;
279 u32 ar;
280 } tr, es, ds, fs, gs;
281 } rmode;
282 int halt_request; /* real mode on Intel only */
283
284 int cpuid_nent;
285 struct kvm_cpuid_entry2 cpuid_entries[KVM_MAX_CPUID_ENTRIES];
286 /* emulate context */
287
288 struct x86_emulate_ctxt emulate_ctxt;
289
290 gpa_t time;
291 struct pvclock_vcpu_time_info hv_clock;
292 unsigned int hv_clock_tsc_khz;
293 unsigned int time_offset;
294 struct page *time_page;
295
296 bool nmi_pending;
297
298 u64 mtrr[0x100];
299};
300
301struct kvm_mem_alias {
302 gfn_t base_gfn;
303 unsigned long npages;
304 gfn_t target_gfn;
305};
306
307struct kvm_arch{
308 int naliases;
309 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
310
311 unsigned int n_free_mmu_pages;
312 unsigned int n_requested_mmu_pages;
313 unsigned int n_alloc_mmu_pages;
314 struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
315 /*
316 * Hash table of struct kvm_mmu_page.
317 */
318 struct list_head active_mmu_pages;
319 struct kvm_pic *vpic;
320 struct kvm_ioapic *vioapic;
321 struct kvm_pit *vpit;
322
323 int round_robin_prev_vcpu;
324 unsigned int tss_addr;
325 struct page *apic_access_page;
326
327 gpa_t wall_clock;
328
329 struct page *ept_identity_pagetable;
330 bool ept_identity_pagetable_done;
331};
332
333struct kvm_vm_stat {
334 u32 mmu_shadow_zapped;
335 u32 mmu_pte_write;
336 u32 mmu_pte_updated;
337 u32 mmu_pde_zapped;
338 u32 mmu_flooded;
339 u32 mmu_recycled;
340 u32 mmu_cache_miss;
341 u32 remote_tlb_flush;
342 u32 lpages;
343};
344
345struct kvm_vcpu_stat {
346 u32 pf_fixed;
347 u32 pf_guest;
348 u32 tlb_flush;
349 u32 invlpg;
350
351 u32 exits;
352 u32 io_exits;
353 u32 mmio_exits;
354 u32 signal_exits;
355 u32 irq_window_exits;
356 u32 nmi_window_exits;
357 u32 halt_exits;
358 u32 halt_wakeup;
359 u32 request_irq_exits;
360 u32 irq_exits;
361 u32 host_state_reload;
362 u32 efer_reload;
363 u32 fpu_reload;
364 u32 insn_emulation;
365 u32 insn_emulation_fail;
366 u32 hypercalls;
367};
368
369struct descriptor_table {
370 u16 limit;
371 unsigned long base;
372} __attribute__((packed));
373
374struct kvm_x86_ops {
375 int (*cpu_has_kvm_support)(void); /* __init */
376 int (*disabled_by_bios)(void); /* __init */
377 void (*hardware_enable)(void *dummy); /* __init */
378 void (*hardware_disable)(void *dummy);
379 void (*check_processor_compatibility)(void *rtn);
380 int (*hardware_setup)(void); /* __init */
381 void (*hardware_unsetup)(void); /* __exit */
382 bool (*cpu_has_accelerated_tpr)(void);
383
384 /* Create, but do not attach this VCPU */
385 struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id);
386 void (*vcpu_free)(struct kvm_vcpu *vcpu);
387 int (*vcpu_reset)(struct kvm_vcpu *vcpu);
388
389 void (*prepare_guest_switch)(struct kvm_vcpu *vcpu);
390 void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
391 void (*vcpu_put)(struct kvm_vcpu *vcpu);
392
393 int (*set_guest_debug)(struct kvm_vcpu *vcpu,
394 struct kvm_debug_guest *dbg);
395 void (*guest_debug_pre)(struct kvm_vcpu *vcpu);
396 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
397 int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
398 u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
399 void (*get_segment)(struct kvm_vcpu *vcpu,
400 struct kvm_segment *var, int seg);
401 int (*get_cpl)(struct kvm_vcpu *vcpu);
402 void (*set_segment)(struct kvm_vcpu *vcpu,
403 struct kvm_segment *var, int seg);
404 void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
405 void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu);
406 void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
407 void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
408 void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
409 void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
410 void (*get_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
411 void (*set_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
412 void (*get_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
413 void (*set_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
414 unsigned long (*get_dr)(struct kvm_vcpu *vcpu, int dr);
415 void (*set_dr)(struct kvm_vcpu *vcpu, int dr, unsigned long value,
416 int *exception);
417 void (*cache_regs)(struct kvm_vcpu *vcpu);
418 void (*decache_regs)(struct kvm_vcpu *vcpu);
419 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
420 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags);
421
422 void (*tlb_flush)(struct kvm_vcpu *vcpu);
423
424 void (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run);
425 int (*handle_exit)(struct kvm_run *run, struct kvm_vcpu *vcpu);
426 void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
427 void (*patch_hypercall)(struct kvm_vcpu *vcpu,
428 unsigned char *hypercall_addr);
429 int (*get_irq)(struct kvm_vcpu *vcpu);
430 void (*set_irq)(struct kvm_vcpu *vcpu, int vec);
431 void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr,
432 bool has_error_code, u32 error_code);
433 bool (*exception_injected)(struct kvm_vcpu *vcpu);
434 void (*inject_pending_irq)(struct kvm_vcpu *vcpu);
435 void (*inject_pending_vectors)(struct kvm_vcpu *vcpu,
436 struct kvm_run *run);
437
438 int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
439 int (*get_tdp_level)(void);
440};
441
442extern struct kvm_x86_ops *kvm_x86_ops;
443
444int kvm_mmu_module_init(void);
445void kvm_mmu_module_exit(void);
446
447void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
448int kvm_mmu_create(struct kvm_vcpu *vcpu);
449int kvm_mmu_setup(struct kvm_vcpu *vcpu);
450void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte);
451void kvm_mmu_set_base_ptes(u64 base_pte);
452void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
453 u64 dirty_mask, u64 nx_mask, u64 x_mask);
454
455int kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
456void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot);
457void kvm_mmu_zap_all(struct kvm *kvm);
458unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm);
459void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages);
460
461int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
462
463int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
464 const void *val, int bytes);
465int kvm_pv_mmu_op(struct kvm_vcpu *vcpu, unsigned long bytes,
466 gpa_t addr, unsigned long *ret);
467
468extern bool tdp_enabled;
469
470enum emulation_result {
471 EMULATE_DONE, /* no further processing */
472 EMULATE_DO_MMIO, /* kvm_run filled with mmio request */
473 EMULATE_FAIL, /* can't emulate this instruction */
474};
475
476#define EMULTYPE_NO_DECODE (1 << 0)
477#define EMULTYPE_TRAP_UD (1 << 1)
478int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run,
479 unsigned long cr2, u16 error_code, int emulation_type);
480void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
481void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
482void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
483void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw,
484 unsigned long *rflags);
485
486unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr);
487void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value,
488 unsigned long *rflags);
489void kvm_enable_efer_bits(u64);
490int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data);
491int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
492
493struct x86_emulate_ctxt;
494
495int kvm_emulate_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
496 int size, unsigned port);
497int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in,
498 int size, unsigned long count, int down,
499 gva_t address, int rep, unsigned port);
500void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
501int kvm_emulate_halt(struct kvm_vcpu *vcpu);
502int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address);
503int emulate_clts(struct kvm_vcpu *vcpu);
504int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr,
505 unsigned long *dest);
506int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr,
507 unsigned long value);
508
509void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
510int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector,
511 int type_bits, int seg);
512
513int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason);
514
515void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
516void kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3);
517void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4);
518void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8);
519unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu);
520void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw);
521void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l);
522
523int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);
524int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data);
525
526void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr);
527void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
528void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
529 u32 error_code);
530
531void kvm_inject_nmi(struct kvm_vcpu *vcpu);
532
533void fx_init(struct kvm_vcpu *vcpu);
534
535int emulator_read_std(unsigned long addr,
536 void *val,
537 unsigned int bytes,
538 struct kvm_vcpu *vcpu);
539int emulator_write_emulated(unsigned long addr,
540 const void *val,
541 unsigned int bytes,
542 struct kvm_vcpu *vcpu);
543
544unsigned long segment_base(u16 selector);
545
546void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu);
547void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
548 const u8 *new, int bytes);
549int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva);
550void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu);
551int kvm_mmu_load(struct kvm_vcpu *vcpu);
552void kvm_mmu_unload(struct kvm_vcpu *vcpu);
553
554int kvm_emulate_hypercall(struct kvm_vcpu *vcpu);
555
556int kvm_fix_hypercall(struct kvm_vcpu *vcpu);
557
558int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code);
559
560void kvm_enable_tdp(void);
561void kvm_disable_tdp(void);
562
563int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
564int complete_pio(struct kvm_vcpu *vcpu);
565
566static inline struct kvm_mmu_page *page_header(hpa_t shadow_page)
567{
568 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT);
569
570 return (struct kvm_mmu_page *)page_private(page);
571}
572
573static inline u16 kvm_read_fs(void)
574{
575 u16 seg;
576 asm("mov %%fs, %0" : "=g"(seg));
577 return seg;
578}
579
580static inline u16 kvm_read_gs(void)
581{
582 u16 seg;
583 asm("mov %%gs, %0" : "=g"(seg));
584 return seg;
585}
586
587static inline u16 kvm_read_ldt(void)
588{
589 u16 ldt;
590 asm("sldt %0" : "=g"(ldt));
591 return ldt;
592}
593
594static inline void kvm_load_fs(u16 sel)
595{
596 asm("mov %0, %%fs" : : "rm"(sel));
597}
598
599static inline void kvm_load_gs(u16 sel)
600{
601 asm("mov %0, %%gs" : : "rm"(sel));
602}
603
604static inline void kvm_load_ldt(u16 sel)
605{
606 asm("lldt %0" : : "rm"(sel));
607}
608
609static inline void kvm_get_idt(struct descriptor_table *table)
610{
611 asm("sidt %0" : "=m"(*table));
612}
613
614static inline void kvm_get_gdt(struct descriptor_table *table)
615{
616 asm("sgdt %0" : "=m"(*table));
617}
618
619static inline unsigned long kvm_read_tr_base(void)
620{
621 u16 tr;
622 asm("str %0" : "=g"(tr));
623 return segment_base(tr);
624}
625
626#ifdef CONFIG_X86_64
627static inline unsigned long read_msr(unsigned long msr)
628{
629 u64 value;
630
631 rdmsrl(msr, value);
632 return value;
633}
634#endif
635
636static inline void kvm_fx_save(struct i387_fxsave_struct *image)
637{
638 asm("fxsave (%0)":: "r" (image));
639}
640
641static inline void kvm_fx_restore(struct i387_fxsave_struct *image)
642{
643 asm("fxrstor (%0)":: "r" (image));
644}
645
646static inline void kvm_fx_finit(void)
647{
648 asm("finit");
649}
650
651static inline u32 get_rdx_init_val(void)
652{
653 return 0x600; /* P6 family */
654}
655
656static inline void kvm_inject_gp(struct kvm_vcpu *vcpu, u32 error_code)
657{
658 kvm_queue_exception_e(vcpu, GP_VECTOR, error_code);
659}
660
661#define ASM_VMX_VMCLEAR_RAX ".byte 0x66, 0x0f, 0xc7, 0x30"
662#define ASM_VMX_VMLAUNCH ".byte 0x0f, 0x01, 0xc2"
663#define ASM_VMX_VMRESUME ".byte 0x0f, 0x01, 0xc3"
664#define ASM_VMX_VMPTRLD_RAX ".byte 0x0f, 0xc7, 0x30"
665#define ASM_VMX_VMREAD_RDX_RAX ".byte 0x0f, 0x78, 0xd0"
666#define ASM_VMX_VMWRITE_RAX_RDX ".byte 0x0f, 0x79, 0xd0"
667#define ASM_VMX_VMWRITE_RSP_RDX ".byte 0x0f, 0x79, 0xd4"
668#define ASM_VMX_VMXOFF ".byte 0x0f, 0x01, 0xc4"
669#define ASM_VMX_VMXON_RAX ".byte 0xf3, 0x0f, 0xc7, 0x30"
670#define ASM_VMX_INVEPT ".byte 0x66, 0x0f, 0x38, 0x80, 0x08"
671#define ASM_VMX_INVVPID ".byte 0x66, 0x0f, 0x38, 0x81, 0x08"
672
673#define MSR_IA32_TIME_STAMP_COUNTER 0x010
674
675#define TSS_IOPB_BASE_OFFSET 0x66
676#define TSS_BASE_SIZE 0x68
677#define TSS_IOPB_SIZE (65536 / 8)
678#define TSS_REDIRECTION_SIZE (256 / 8)
679#define RMODE_TSS_SIZE \
680 (TSS_BASE_SIZE + TSS_REDIRECTION_SIZE + TSS_IOPB_SIZE + 1)
681
682enum {
683 TASK_SWITCH_CALL = 0,
684 TASK_SWITCH_IRET = 1,
685 TASK_SWITCH_JMP = 2,
686 TASK_SWITCH_GATE = 3,
687};
688
689#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
690 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
691 vcpu, 5, d1, d2, d3, d4, d5)
692#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
693 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
694 vcpu, 4, d1, d2, d3, d4, 0)
695#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
696 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
697 vcpu, 3, d1, d2, d3, 0, 0)
698#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
699 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
700 vcpu, 2, d1, d2, 0, 0, 0)
701#define KVMTRACE_1D(evt, vcpu, d1, name) \
702 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
703 vcpu, 1, d1, 0, 0, 0, 0)
704#define KVMTRACE_0D(evt, vcpu, name) \
705 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
706 vcpu, 0, 0, 0, 0, 0, 0)
707
708#ifdef CONFIG_64BIT
709# define KVM_EX_ENTRY ".quad"
710# define KVM_EX_PUSH "pushq"
711#else
712# define KVM_EX_ENTRY ".long"
713# define KVM_EX_PUSH "pushl"
714#endif
715
716/*
717 * Hardware virtualization extension instructions may fault if a
718 * reboot turns off virtualization while processes are running.
719 * Trap the fault and ignore the instruction if that happens.
720 */
721asmlinkage void kvm_handle_fault_on_reboot(void);
722
723#define __kvm_handle_fault_on_reboot(insn) \
724 "666: " insn "\n\t" \
725 ".pushsection .fixup, \"ax\" \n" \
726 "667: \n\t" \
727 KVM_EX_PUSH " $666b \n\t" \
728 "jmp kvm_handle_fault_on_reboot \n\t" \
729 ".popsection \n\t" \
730 ".pushsection __ex_table, \"a\" \n\t" \
731 KVM_EX_ENTRY " 666b, 667b \n\t" \
732 ".popsection"
733
734#define KVM_ARCH_WANT_MMU_NOTIFIER
735int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
736int kvm_age_hva(struct kvm *kvm, unsigned long hva);
737
738#endif
diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h
deleted file mode 100644
index 76f392146daa..000000000000
--- a/include/asm-x86/kvm_para.h
+++ /dev/null
@@ -1,147 +0,0 @@
1#ifndef __X86_KVM_PARA_H
2#define __X86_KVM_PARA_H
3
4/* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
5 * should be used to determine that a VM is running under KVM.
6 */
7#define KVM_CPUID_SIGNATURE 0x40000000
8
9/* This CPUID returns a feature bitmap in eax. Before enabling a particular
10 * paravirtualization, the appropriate feature bit should be checked.
11 */
12#define KVM_CPUID_FEATURES 0x40000001
13#define KVM_FEATURE_CLOCKSOURCE 0
14#define KVM_FEATURE_NOP_IO_DELAY 1
15#define KVM_FEATURE_MMU_OP 2
16
17#define MSR_KVM_WALL_CLOCK 0x11
18#define MSR_KVM_SYSTEM_TIME 0x12
19
20#define KVM_MAX_MMU_OP_BATCH 32
21
22/* Operations for KVM_HC_MMU_OP */
23#define KVM_MMU_OP_WRITE_PTE 1
24#define KVM_MMU_OP_FLUSH_TLB 2
25#define KVM_MMU_OP_RELEASE_PT 3
26
27/* Payload for KVM_HC_MMU_OP */
28struct kvm_mmu_op_header {
29 __u32 op;
30 __u32 pad;
31};
32
33struct kvm_mmu_op_write_pte {
34 struct kvm_mmu_op_header header;
35 __u64 pte_phys;
36 __u64 pte_val;
37};
38
39struct kvm_mmu_op_flush_tlb {
40 struct kvm_mmu_op_header header;
41};
42
43struct kvm_mmu_op_release_pt {
44 struct kvm_mmu_op_header header;
45 __u64 pt_phys;
46};
47
48#ifdef __KERNEL__
49#include <asm/processor.h>
50
51extern void kvmclock_init(void);
52
53
54/* This instruction is vmcall. On non-VT architectures, it will generate a
55 * trap that we will then rewrite to the appropriate instruction.
56 */
57#define KVM_HYPERCALL ".byte 0x0f,0x01,0xc1"
58
59/* For KVM hypercalls, a three-byte sequence of either the vmrun or the vmmrun
60 * instruction. The hypervisor may replace it with something else but only the
61 * instructions are guaranteed to be supported.
62 *
63 * Up to four arguments may be passed in rbx, rcx, rdx, and rsi respectively.
64 * The hypercall number should be placed in rax and the return value will be
65 * placed in rax. No other registers will be clobbered unless explicited
66 * noted by the particular hypercall.
67 */
68
69static inline long kvm_hypercall0(unsigned int nr)
70{
71 long ret;
72 asm volatile(KVM_HYPERCALL
73 : "=a"(ret)
74 : "a"(nr)
75 : "memory");
76 return ret;
77}
78
79static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
80{
81 long ret;
82 asm volatile(KVM_HYPERCALL
83 : "=a"(ret)
84 : "a"(nr), "b"(p1)
85 : "memory");
86 return ret;
87}
88
89static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
90 unsigned long p2)
91{
92 long ret;
93 asm volatile(KVM_HYPERCALL
94 : "=a"(ret)
95 : "a"(nr), "b"(p1), "c"(p2)
96 : "memory");
97 return ret;
98}
99
100static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
101 unsigned long p2, unsigned long p3)
102{
103 long ret;
104 asm volatile(KVM_HYPERCALL
105 : "=a"(ret)
106 : "a"(nr), "b"(p1), "c"(p2), "d"(p3)
107 : "memory");
108 return ret;
109}
110
111static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
112 unsigned long p2, unsigned long p3,
113 unsigned long p4)
114{
115 long ret;
116 asm volatile(KVM_HYPERCALL
117 : "=a"(ret)
118 : "a"(nr), "b"(p1), "c"(p2), "d"(p3), "S"(p4)
119 : "memory");
120 return ret;
121}
122
123static inline int kvm_para_available(void)
124{
125 unsigned int eax, ebx, ecx, edx;
126 char signature[13];
127
128 cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
129 memcpy(signature + 0, &ebx, 4);
130 memcpy(signature + 4, &ecx, 4);
131 memcpy(signature + 8, &edx, 4);
132 signature[12] = 0;
133
134 if (strcmp(signature, "KVMKVMKVM") == 0)
135 return 1;
136
137 return 0;
138}
139
140static inline unsigned int kvm_arch_para_features(void)
141{
142 return cpuid_eax(KVM_CPUID_FEATURES);
143}
144
145#endif
146
147#endif
diff --git a/include/asm-x86/kvm_x86_emulate.h b/include/asm-x86/kvm_x86_emulate.h
deleted file mode 100644
index 4e8c1e48d91d..000000000000
--- a/include/asm-x86/kvm_x86_emulate.h
+++ /dev/null
@@ -1,184 +0,0 @@
1/******************************************************************************
2 * x86_emulate.h
3 *
4 * Generic x86 (32-bit and 64-bit) instruction decoder and emulator.
5 *
6 * Copyright (c) 2005 Keir Fraser
7 *
8 * From: xen-unstable 10676:af9809f51f81a3c43f276f00c81a52ef558afda4
9 */
10
11#ifndef __X86_EMULATE_H__
12#define __X86_EMULATE_H__
13
14struct x86_emulate_ctxt;
15
16/*
17 * x86_emulate_ops:
18 *
19 * These operations represent the instruction emulator's interface to memory.
20 * There are two categories of operation: those that act on ordinary memory
21 * regions (*_std), and those that act on memory regions known to require
22 * special treatment or emulation (*_emulated).
23 *
24 * The emulator assumes that an instruction accesses only one 'emulated memory'
25 * location, that this location is the given linear faulting address (cr2), and
26 * that this is one of the instruction's data operands. Instruction fetches and
27 * stack operations are assumed never to access emulated memory. The emulator
28 * automatically deduces which operand of a string-move operation is accessing
29 * emulated memory, and assumes that the other operand accesses normal memory.
30 *
31 * NOTES:
32 * 1. The emulator isn't very smart about emulated vs. standard memory.
33 * 'Emulated memory' access addresses should be checked for sanity.
34 * 'Normal memory' accesses may fault, and the caller must arrange to
35 * detect and handle reentrancy into the emulator via recursive faults.
36 * Accesses may be unaligned and may cross page boundaries.
37 * 2. If the access fails (cannot emulate, or a standard access faults) then
38 * it is up to the memop to propagate the fault to the guest VM via
39 * some out-of-band mechanism, unknown to the emulator. The memop signals
40 * failure by returning X86EMUL_PROPAGATE_FAULT to the emulator, which will
41 * then immediately bail.
42 * 3. Valid access sizes are 1, 2, 4 and 8 bytes. On x86/32 systems only
43 * cmpxchg8b_emulated need support 8-byte accesses.
44 * 4. The emulator cannot handle 64-bit mode emulation on an x86/32 system.
45 */
46/* Access completed successfully: continue emulation as normal. */
47#define X86EMUL_CONTINUE 0
48/* Access is unhandleable: bail from emulation and return error to caller. */
49#define X86EMUL_UNHANDLEABLE 1
50/* Terminate emulation but return success to the caller. */
51#define X86EMUL_PROPAGATE_FAULT 2 /* propagate a generated fault to guest */
52#define X86EMUL_RETRY_INSTR 2 /* retry the instruction for some reason */
53#define X86EMUL_CMPXCHG_FAILED 2 /* cmpxchg did not see expected value */
54struct x86_emulate_ops {
55 /*
56 * read_std: Read bytes of standard (non-emulated/special) memory.
57 * Used for instruction fetch, stack operations, and others.
58 * @addr: [IN ] Linear address from which to read.
59 * @val: [OUT] Value read from memory, zero-extended to 'u_long'.
60 * @bytes: [IN ] Number of bytes to read from memory.
61 */
62 int (*read_std)(unsigned long addr, void *val,
63 unsigned int bytes, struct kvm_vcpu *vcpu);
64
65 /*
66 * read_emulated: Read bytes from emulated/special memory area.
67 * @addr: [IN ] Linear address from which to read.
68 * @val: [OUT] Value read from memory, zero-extended to 'u_long'.
69 * @bytes: [IN ] Number of bytes to read from memory.
70 */
71 int (*read_emulated)(unsigned long addr,
72 void *val,
73 unsigned int bytes,
74 struct kvm_vcpu *vcpu);
75
76 /*
77 * write_emulated: Read bytes from emulated/special memory area.
78 * @addr: [IN ] Linear address to which to write.
79 * @val: [IN ] Value to write to memory (low-order bytes used as
80 * required).
81 * @bytes: [IN ] Number of bytes to write to memory.
82 */
83 int (*write_emulated)(unsigned long addr,
84 const void *val,
85 unsigned int bytes,
86 struct kvm_vcpu *vcpu);
87
88 /*
89 * cmpxchg_emulated: Emulate an atomic (LOCKed) CMPXCHG operation on an
90 * emulated/special memory area.
91 * @addr: [IN ] Linear address to access.
92 * @old: [IN ] Value expected to be current at @addr.
93 * @new: [IN ] Value to write to @addr.
94 * @bytes: [IN ] Number of bytes to access using CMPXCHG.
95 */
96 int (*cmpxchg_emulated)(unsigned long addr,
97 const void *old,
98 const void *new,
99 unsigned int bytes,
100 struct kvm_vcpu *vcpu);
101
102};
103
104/* Type, address-of, and value of an instruction's operand. */
105struct operand {
106 enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type;
107 unsigned int bytes;
108 unsigned long val, orig_val, *ptr;
109};
110
111struct fetch_cache {
112 u8 data[15];
113 unsigned long start;
114 unsigned long end;
115};
116
117struct decode_cache {
118 u8 twobyte;
119 u8 b;
120 u8 lock_prefix;
121 u8 rep_prefix;
122 u8 op_bytes;
123 u8 ad_bytes;
124 u8 rex_prefix;
125 struct operand src;
126 struct operand dst;
127 bool has_seg_override;
128 u8 seg_override;
129 unsigned int d;
130 unsigned long regs[NR_VCPU_REGS];
131 unsigned long eip;
132 /* modrm */
133 u8 modrm;
134 u8 modrm_mod;
135 u8 modrm_reg;
136 u8 modrm_rm;
137 u8 use_modrm_ea;
138 bool rip_relative;
139 unsigned long modrm_ea;
140 void *modrm_ptr;
141 unsigned long modrm_val;
142 struct fetch_cache fetch;
143};
144
145struct x86_emulate_ctxt {
146 /* Register state before/after emulation. */
147 struct kvm_vcpu *vcpu;
148
149 /* Linear faulting address (if emulating a page-faulting instruction) */
150 unsigned long eflags;
151
152 /* Emulated execution mode, represented by an X86EMUL_MODE value. */
153 int mode;
154
155 u32 cs_base;
156
157 /* decode cache */
158
159 struct decode_cache decode;
160};
161
162/* Repeat String Operation Prefix */
163#define REPE_PREFIX 1
164#define REPNE_PREFIX 2
165
166/* Execution mode, passed to the emulator. */
167#define X86EMUL_MODE_REAL 0 /* Real mode. */
168#define X86EMUL_MODE_PROT16 2 /* 16-bit protected mode. */
169#define X86EMUL_MODE_PROT32 4 /* 32-bit protected mode. */
170#define X86EMUL_MODE_PROT64 8 /* 64-bit (long) mode. */
171
172/* Host execution mode. */
173#if defined(__i386__)
174#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT32
175#elif defined(CONFIG_X86_64)
176#define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
177#endif
178
179int x86_decode_insn(struct x86_emulate_ctxt *ctxt,
180 struct x86_emulate_ops *ops);
181int x86_emulate_insn(struct x86_emulate_ctxt *ctxt,
182 struct x86_emulate_ops *ops);
183
184#endif /* __X86_EMULATE_H__ */
diff --git a/include/asm-x86/ldt.h b/include/asm-x86/ldt.h
deleted file mode 100644
index 20c597242b53..000000000000
--- a/include/asm-x86/ldt.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * ldt.h
3 *
4 * Definitions of structures used with the modify_ldt system call.
5 */
6#ifndef _ASM_X86_LDT_H
7#define _ASM_X86_LDT_H
8
9/* Maximum number of LDT entries supported. */
10#define LDT_ENTRIES 8192
11/* The size of each LDT entry. */
12#define LDT_ENTRY_SIZE 8
13
14#ifndef __ASSEMBLY__
15/*
16 * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS
17 * not to the default values if you still want to do syscalls. This
18 * call is more for 32bit mode therefore.
19 */
20struct user_desc {
21 unsigned int entry_number;
22 unsigned int base_addr;
23 unsigned int limit;
24 unsigned int seg_32bit:1;
25 unsigned int contents:2;
26 unsigned int read_exec_only:1;
27 unsigned int limit_in_pages:1;
28 unsigned int seg_not_present:1;
29 unsigned int useable:1;
30#ifdef __x86_64__
31 unsigned int lm:1;
32#endif
33};
34
35#define MODIFY_LDT_CONTENTS_DATA 0
36#define MODIFY_LDT_CONTENTS_STACK 1
37#define MODIFY_LDT_CONTENTS_CODE 2
38
39#endif /* !__ASSEMBLY__ */
40#endif
diff --git a/include/asm-x86/lguest.h b/include/asm-x86/lguest.h
deleted file mode 100644
index be4a7247fa2b..000000000000
--- a/include/asm-x86/lguest.h
+++ /dev/null
@@ -1,94 +0,0 @@
1#ifndef _X86_LGUEST_H
2#define _X86_LGUEST_H
3
4#define GDT_ENTRY_LGUEST_CS 10
5#define GDT_ENTRY_LGUEST_DS 11
6#define LGUEST_CS (GDT_ENTRY_LGUEST_CS * 8)
7#define LGUEST_DS (GDT_ENTRY_LGUEST_DS * 8)
8
9#ifndef __ASSEMBLY__
10#include <asm/desc.h>
11
12#define GUEST_PL 1
13
14/* Every guest maps the core switcher code. */
15#define SHARED_SWITCHER_PAGES \
16 DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE)
17/* Pages for switcher itself, then two pages per cpu */
18#define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * NR_CPUS)
19
20/* We map at -4M for ease of mapping into the guest (one PTE page). */
21#define SWITCHER_ADDR 0xFFC00000
22
23/* Found in switcher.S */
24extern unsigned long default_idt_entries[];
25
26/* Declarations for definitions in lguest_guest.S */
27extern char lguest_noirq_start[], lguest_noirq_end[];
28extern const char lgstart_cli[], lgend_cli[];
29extern const char lgstart_sti[], lgend_sti[];
30extern const char lgstart_popf[], lgend_popf[];
31extern const char lgstart_pushf[], lgend_pushf[];
32extern const char lgstart_iret[], lgend_iret[];
33
34extern void lguest_iret(void);
35extern void lguest_init(void);
36
37struct lguest_regs {
38 /* Manually saved part. */
39 unsigned long eax, ebx, ecx, edx;
40 unsigned long esi, edi, ebp;
41 unsigned long gs;
42 unsigned long fs, ds, es;
43 unsigned long trapnum, errcode;
44 /* Trap pushed part */
45 unsigned long eip;
46 unsigned long cs;
47 unsigned long eflags;
48 unsigned long esp;
49 unsigned long ss;
50};
51
52/* This is a guest-specific page (mapped ro) into the guest. */
53struct lguest_ro_state {
54 /* Host information we need to restore when we switch back. */
55 u32 host_cr3;
56 struct desc_ptr host_idt_desc;
57 struct desc_ptr host_gdt_desc;
58 u32 host_sp;
59
60 /* Fields which are used when guest is running. */
61 struct desc_ptr guest_idt_desc;
62 struct desc_ptr guest_gdt_desc;
63 struct x86_hw_tss guest_tss;
64 struct desc_struct guest_idt[IDT_ENTRIES];
65 struct desc_struct guest_gdt[GDT_ENTRIES];
66};
67
68struct lg_cpu_arch {
69 /* The GDT entries copied into lguest_ro_state when running. */
70 struct desc_struct gdt[GDT_ENTRIES];
71
72 /* The IDT entries: some copied into lguest_ro_state when running. */
73 struct desc_struct idt[IDT_ENTRIES];
74
75 /* The address of the last guest-visible pagefault (ie. cr2). */
76 unsigned long last_pagefault;
77};
78
79static inline void lguest_set_ts(void)
80{
81 u32 cr0;
82
83 cr0 = read_cr0();
84 if (!(cr0 & 8))
85 write_cr0(cr0 | 8);
86}
87
88/* Full 4G segment descriptors, suitable for CS and DS. */
89#define FULL_EXEC_SEGMENT ((struct desc_struct){ { {0x0000ffff, 0x00cf9b00} } })
90#define FULL_SEGMENT ((struct desc_struct){ { {0x0000ffff, 0x00cf9300} } })
91
92#endif /* __ASSEMBLY__ */
93
94#endif
diff --git a/include/asm-x86/lguest_hcall.h b/include/asm-x86/lguest_hcall.h
deleted file mode 100644
index a3241f28e34a..000000000000
--- a/include/asm-x86/lguest_hcall.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/* Architecture specific portion of the lguest hypercalls */
2#ifndef _X86_LGUEST_HCALL_H
3#define _X86_LGUEST_HCALL_H
4
5#define LHCALL_FLUSH_ASYNC 0
6#define LHCALL_LGUEST_INIT 1
7#define LHCALL_SHUTDOWN 2
8#define LHCALL_LOAD_GDT 3
9#define LHCALL_NEW_PGTABLE 4
10#define LHCALL_FLUSH_TLB 5
11#define LHCALL_LOAD_IDT_ENTRY 6
12#define LHCALL_SET_STACK 7
13#define LHCALL_TS 8
14#define LHCALL_SET_CLOCKEVENT 9
15#define LHCALL_HALT 10
16#define LHCALL_SET_PTE 14
17#define LHCALL_SET_PMD 15
18#define LHCALL_LOAD_TLS 16
19#define LHCALL_NOTIFY 17
20
21#define LGUEST_TRAP_ENTRY 0x1F
22
23/* Argument number 3 to LHCALL_LGUEST_SHUTDOWN */
24#define LGUEST_SHUTDOWN_POWEROFF 1
25#define LGUEST_SHUTDOWN_RESTART 2
26
27#ifndef __ASSEMBLY__
28#include <asm/hw_irq.h>
29
30/*G:031 But first, how does our Guest contact the Host to ask for privileged
31 * operations? There are two ways: the direct way is to make a "hypercall",
32 * to make requests of the Host Itself.
33 *
34 * Our hypercall mechanism uses the highest unused trap code (traps 32 and
35 * above are used by real hardware interrupts). Fifteen hypercalls are
36 * available: the hypercall number is put in the %eax register, and the
37 * arguments (when required) are placed in %edx, %ebx and %ecx. If a return
38 * value makes sense, it's returned in %eax.
39 *
40 * Grossly invalid calls result in Sudden Death at the hands of the vengeful
41 * Host, rather than returning failure. This reflects Winston Churchill's
42 * definition of a gentleman: "someone who is only rude intentionally". */
43static inline unsigned long
44hcall(unsigned long call,
45 unsigned long arg1, unsigned long arg2, unsigned long arg3)
46{
47 /* "int" is the Intel instruction to trigger a trap. */
48 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
49 /* The call in %eax (aka "a") might be overwritten */
50 : "=a"(call)
51 /* The arguments are in %eax, %edx, %ebx & %ecx */
52 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
53 /* "memory" means this might write somewhere in memory.
54 * This isn't true for all calls, but it's safe to tell
55 * gcc that it might happen so it doesn't get clever. */
56 : "memory");
57 return call;
58}
59/*:*/
60
61/* Can't use our min() macro here: needs to be a constant */
62#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32)
63
64#define LHCALL_RING_SIZE 64
65struct hcall_args {
66 /* These map directly onto eax, ebx, ecx, edx in struct lguest_regs */
67 unsigned long arg0, arg2, arg3, arg1;
68};
69
70#endif /* !__ASSEMBLY__ */
71#endif /* _I386_LGUEST_HCALL_H */
diff --git a/include/asm-x86/linkage.h b/include/asm-x86/linkage.h
deleted file mode 100644
index 64e444f8e85b..000000000000
--- a/include/asm-x86/linkage.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4#undef notrace
5#define notrace __attribute__((no_instrument_function))
6
7#ifdef CONFIG_X86_64
8#define __ALIGN .p2align 4,,15
9#define __ALIGN_STR ".p2align 4,,15"
10#endif
11
12#ifdef CONFIG_X86_32
13#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
14/*
15 * For 32-bit UML - mark functions implemented in assembly that use
16 * regparm input parameters:
17 */
18#define asmregparm __attribute__((regparm(3)))
19
20/*
21 * Make sure the compiler doesn't do anything stupid with the
22 * arguments on the stack - they are owned by the *caller*, not
23 * the callee. This just fools gcc into not spilling into them,
24 * and keeps it from doing tailcall recursion and/or using the
25 * stack slots for temporaries, since they are live and "used"
26 * all the way to the end of the function.
27 *
28 * NOTE! On x86-64, all the arguments are in registers, so this
29 * only matters on a 32-bit kernel.
30 */
31#define asmlinkage_protect(n, ret, args...) \
32 __asmlinkage_protect##n(ret, ##args)
33#define __asmlinkage_protect_n(ret, args...) \
34 __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
35#define __asmlinkage_protect0(ret) \
36 __asmlinkage_protect_n(ret)
37#define __asmlinkage_protect1(ret, arg1) \
38 __asmlinkage_protect_n(ret, "g" (arg1))
39#define __asmlinkage_protect2(ret, arg1, arg2) \
40 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2))
41#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
42 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3))
43#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
44 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
45 "g" (arg4))
46#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
47 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
48 "g" (arg4), "g" (arg5))
49#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
50 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
51 "g" (arg4), "g" (arg5), "g" (arg6))
52
53#endif
54
55#ifdef CONFIG_X86_ALIGNMENT_16
56#define __ALIGN .align 16,0x90
57#define __ALIGN_STR ".align 16,0x90"
58#endif
59
60#endif
61
diff --git a/include/asm-x86/local.h b/include/asm-x86/local.h
deleted file mode 100644
index 330a72496abd..000000000000
--- a/include/asm-x86/local.h
+++ /dev/null
@@ -1,235 +0,0 @@
1#ifndef _ARCH_LOCAL_H
2#define _ARCH_LOCAL_H
3
4#include <linux/percpu.h>
5
6#include <asm/system.h>
7#include <asm/atomic.h>
8#include <asm/asm.h>
9
10typedef struct {
11 atomic_long_t a;
12} local_t;
13
14#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
15
16#define local_read(l) atomic_long_read(&(l)->a)
17#define local_set(l, i) atomic_long_set(&(l)->a, (i))
18
19static inline void local_inc(local_t *l)
20{
21 asm volatile(_ASM_INC "%0"
22 : "+m" (l->a.counter));
23}
24
25static inline void local_dec(local_t *l)
26{
27 asm volatile(_ASM_DEC "%0"
28 : "+m" (l->a.counter));
29}
30
31static inline void local_add(long i, local_t *l)
32{
33 asm volatile(_ASM_ADD "%1,%0"
34 : "+m" (l->a.counter)
35 : "ir" (i));
36}
37
38static inline void local_sub(long i, local_t *l)
39{
40 asm volatile(_ASM_SUB "%1,%0"
41 : "+m" (l->a.counter)
42 : "ir" (i));
43}
44
45/**
46 * local_sub_and_test - subtract value from variable and test result
47 * @i: integer value to subtract
48 * @l: pointer to type local_t
49 *
50 * Atomically subtracts @i from @l and returns
51 * true if the result is zero, or false for all
52 * other cases.
53 */
54static inline int local_sub_and_test(long i, local_t *l)
55{
56 unsigned char c;
57
58 asm volatile(_ASM_SUB "%2,%0; sete %1"
59 : "+m" (l->a.counter), "=qm" (c)
60 : "ir" (i) : "memory");
61 return c;
62}
63
64/**
65 * local_dec_and_test - decrement and test
66 * @l: pointer to type local_t
67 *
68 * Atomically decrements @l by 1 and
69 * returns true if the result is 0, or false for all other
70 * cases.
71 */
72static inline int local_dec_and_test(local_t *l)
73{
74 unsigned char c;
75
76 asm volatile(_ASM_DEC "%0; sete %1"
77 : "+m" (l->a.counter), "=qm" (c)
78 : : "memory");
79 return c != 0;
80}
81
82/**
83 * local_inc_and_test - increment and test
84 * @l: pointer to type local_t
85 *
86 * Atomically increments @l by 1
87 * and returns true if the result is zero, or false for all
88 * other cases.
89 */
90static inline int local_inc_and_test(local_t *l)
91{
92 unsigned char c;
93
94 asm volatile(_ASM_INC "%0; sete %1"
95 : "+m" (l->a.counter), "=qm" (c)
96 : : "memory");
97 return c != 0;
98}
99
100/**
101 * local_add_negative - add and test if negative
102 * @i: integer value to add
103 * @l: pointer to type local_t
104 *
105 * Atomically adds @i to @l and returns true
106 * if the result is negative, or false when
107 * result is greater than or equal to zero.
108 */
109static inline int local_add_negative(long i, local_t *l)
110{
111 unsigned char c;
112
113 asm volatile(_ASM_ADD "%2,%0; sets %1"
114 : "+m" (l->a.counter), "=qm" (c)
115 : "ir" (i) : "memory");
116 return c;
117}
118
119/**
120 * local_add_return - add and return
121 * @i: integer value to add
122 * @l: pointer to type local_t
123 *
124 * Atomically adds @i to @l and returns @i + @l
125 */
126static inline long local_add_return(long i, local_t *l)
127{
128 long __i;
129#ifdef CONFIG_M386
130 unsigned long flags;
131 if (unlikely(boot_cpu_data.x86 <= 3))
132 goto no_xadd;
133#endif
134 /* Modern 486+ processor */
135 __i = i;
136 asm volatile(_ASM_XADD "%0, %1;"
137 : "+r" (i), "+m" (l->a.counter)
138 : : "memory");
139 return i + __i;
140
141#ifdef CONFIG_M386
142no_xadd: /* Legacy 386 processor */
143 local_irq_save(flags);
144 __i = local_read(l);
145 local_set(l, i + __i);
146 local_irq_restore(flags);
147 return i + __i;
148#endif
149}
150
151static inline long local_sub_return(long i, local_t *l)
152{
153 return local_add_return(-i, l);
154}
155
156#define local_inc_return(l) (local_add_return(1, l))
157#define local_dec_return(l) (local_sub_return(1, l))
158
159#define local_cmpxchg(l, o, n) \
160 (cmpxchg_local(&((l)->a.counter), (o), (n)))
161/* Always has a lock prefix */
162#define local_xchg(l, n) (xchg(&((l)->a.counter), (n)))
163
164/**
165 * local_add_unless - add unless the number is a given value
166 * @l: pointer of type local_t
167 * @a: the amount to add to l...
168 * @u: ...unless l is equal to u.
169 *
170 * Atomically adds @a to @l, so long as it was not @u.
171 * Returns non-zero if @l was not @u, and zero otherwise.
172 */
173#define local_add_unless(l, a, u) \
174({ \
175 long c, old; \
176 c = local_read((l)); \
177 for (;;) { \
178 if (unlikely(c == (u))) \
179 break; \
180 old = local_cmpxchg((l), c, c + (a)); \
181 if (likely(old == c)) \
182 break; \
183 c = old; \
184 } \
185 c != (u); \
186})
187#define local_inc_not_zero(l) local_add_unless((l), 1, 0)
188
189/* On x86_32, these are no better than the atomic variants.
190 * On x86-64 these are better than the atomic variants on SMP kernels
191 * because they dont use a lock prefix.
192 */
193#define __local_inc(l) local_inc(l)
194#define __local_dec(l) local_dec(l)
195#define __local_add(i, l) local_add((i), (l))
196#define __local_sub(i, l) local_sub((i), (l))
197
198/* Use these for per-cpu local_t variables: on some archs they are
199 * much more efficient than these naive implementations. Note they take
200 * a variable, not an address.
201 *
202 * X86_64: This could be done better if we moved the per cpu data directly
203 * after GS.
204 */
205
206/* Need to disable preemption for the cpu local counters otherwise we could
207 still access a variable of a previous CPU in a non atomic way. */
208#define cpu_local_wrap_v(l) \
209({ \
210 local_t res__; \
211 preempt_disable(); \
212 res__ = (l); \
213 preempt_enable(); \
214 res__; \
215})
216#define cpu_local_wrap(l) \
217({ \
218 preempt_disable(); \
219 (l); \
220 preempt_enable(); \
221}) \
222
223#define cpu_local_read(l) cpu_local_wrap_v(local_read(&__get_cpu_var((l))))
224#define cpu_local_set(l, i) cpu_local_wrap(local_set(&__get_cpu_var((l)), (i)))
225#define cpu_local_inc(l) cpu_local_wrap(local_inc(&__get_cpu_var((l))))
226#define cpu_local_dec(l) cpu_local_wrap(local_dec(&__get_cpu_var((l))))
227#define cpu_local_add(i, l) cpu_local_wrap(local_add((i), &__get_cpu_var((l))))
228#define cpu_local_sub(i, l) cpu_local_wrap(local_sub((i), &__get_cpu_var((l))))
229
230#define __cpu_local_inc(l) cpu_local_inc((l))
231#define __cpu_local_dec(l) cpu_local_dec((l))
232#define __cpu_local_add(i, l) cpu_local_add((i), (l))
233#define __cpu_local_sub(i, l) cpu_local_sub((i), (l))
234
235#endif /* _ARCH_LOCAL_H */
diff --git a/include/asm-x86/mach-bigsmp/mach_apic.h b/include/asm-x86/mach-bigsmp/mach_apic.h
deleted file mode 100644
index c3b9dc6970c9..000000000000
--- a/include/asm-x86/mach-bigsmp/mach_apic.h
+++ /dev/null
@@ -1,144 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
5#define esr_disable (1)
6
7static inline int apic_id_registered(void)
8{
9 return (1);
10}
11
12/* Round robin the irqs amoung the online cpus */
13static inline cpumask_t target_cpus(void)
14{
15 static unsigned long cpu = NR_CPUS;
16 do {
17 if (cpu >= NR_CPUS)
18 cpu = first_cpu(cpu_online_map);
19 else
20 cpu = next_cpu(cpu, cpu_online_map);
21 } while (cpu >= NR_CPUS);
22 return cpumask_of_cpu(cpu);
23}
24
25#undef APIC_DEST_LOGICAL
26#define APIC_DEST_LOGICAL 0
27#define TARGET_CPUS (target_cpus())
28#define APIC_DFR_VALUE (APIC_DFR_FLAT)
29#define INT_DELIVERY_MODE (dest_Fixed)
30#define INT_DEST_MODE (0) /* phys delivery to target proc */
31#define NO_BALANCE_IRQ (0)
32#define WAKE_SECONDARY_VIA_INIT
33
34
35static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
36{
37 return (0);
38}
39
40static inline unsigned long check_apicid_present(int bit)
41{
42 return (1);
43}
44
45static inline unsigned long calculate_ldr(int cpu)
46{
47 unsigned long val, id;
48 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
49 id = xapic_phys_to_log_apicid(cpu);
50 val |= SET_APIC_LOGICAL_ID(id);
51 return val;
52}
53
54/*
55 * Set up the logical destination ID.
56 *
57 * Intel recommends to set DFR, LDR and TPR before enabling
58 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
59 * document number 292116). So here it goes...
60 */
61static inline void init_apic_ldr(void)
62{
63 unsigned long val;
64 int cpu = smp_processor_id();
65
66 apic_write(APIC_DFR, APIC_DFR_VALUE);
67 val = calculate_ldr(cpu);
68 apic_write(APIC_LDR, val);
69}
70
71static inline void setup_apic_routing(void)
72{
73 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
74 "Physflat", nr_ioapics);
75}
76
77static inline int multi_timer_check(int apic, int irq)
78{
79 return (0);
80}
81
82static inline int apicid_to_node(int logical_apicid)
83{
84 return apicid_2_node[hard_smp_processor_id()];
85}
86
87static inline int cpu_present_to_apicid(int mps_cpu)
88{
89 if (mps_cpu < NR_CPUS)
90 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
91
92 return BAD_APICID;
93}
94
95static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
96{
97 return physid_mask_of_physid(phys_apicid);
98}
99
100extern u8 cpu_2_logical_apicid[];
101/* Mapping from cpu number to logical apicid */
102static inline int cpu_to_logical_apicid(int cpu)
103{
104 if (cpu >= NR_CPUS)
105 return BAD_APICID;
106 return cpu_physical_id(cpu);
107}
108
109static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
110{
111 /* For clustered we don't have a good way to do this yet - hack */
112 return physids_promote(0xFFL);
113}
114
115static inline void setup_portio_remap(void)
116{
117}
118
119static inline void enable_apic_mode(void)
120{
121}
122
123static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
124{
125 return (1);
126}
127
128/* As we are using single CPU as destination, pick only one CPU here */
129static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
130{
131 int cpu;
132 int apicid;
133
134 cpu = first_cpu(cpumask);
135 apicid = cpu_to_logical_apicid(cpu);
136 return apicid;
137}
138
139static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
140{
141 return cpuid_apic >> index_msb;
142}
143
144#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-bigsmp/mach_apicdef.h b/include/asm-x86/mach-bigsmp/mach_apicdef.h
deleted file mode 100644
index a58ab5a75c8c..000000000000
--- a/include/asm-x86/mach-bigsmp/mach_apicdef.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4#define APIC_ID_MASK (0xFF<<24)
5
6static inline unsigned get_apic_id(unsigned long x)
7{
8 return (((x)>>24)&0xFF);
9}
10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif
diff --git a/include/asm-x86/mach-bigsmp/mach_ipi.h b/include/asm-x86/mach-bigsmp/mach_ipi.h
deleted file mode 100644
index 9404c535b7ec..000000000000
--- a/include/asm-x86/mach-bigsmp/mach_ipi.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4void send_IPI_mask_sequence(cpumask_t mask, int vector);
5
6static inline void send_IPI_mask(cpumask_t mask, int vector)
7{
8 send_IPI_mask_sequence(mask, vector);
9}
10
11static inline void send_IPI_allbutself(int vector)
12{
13 cpumask_t mask = cpu_online_map;
14 cpu_clear(smp_processor_id(), mask);
15
16 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector);
18}
19
20static inline void send_IPI_all(int vector)
21{
22 send_IPI_mask(cpu_online_map, vector);
23}
24
25#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-x86/mach-default/apm.h b/include/asm-x86/mach-default/apm.h
deleted file mode 100644
index 989f34c37d32..000000000000
--- a/include/asm-x86/mach-default/apm.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * Machine specific APM BIOS functions for generic.
3 * Split out from apm.c by Osamu Tomita <tomita@cinet.co.jp>
4 */
5
6#ifndef _ASM_APM_H
7#define _ASM_APM_H
8
9#ifdef APM_ZERO_SEGS
10# define APM_DO_ZERO_SEGS \
11 "pushl %%ds\n\t" \
12 "pushl %%es\n\t" \
13 "xorl %%edx, %%edx\n\t" \
14 "mov %%dx, %%ds\n\t" \
15 "mov %%dx, %%es\n\t" \
16 "mov %%dx, %%fs\n\t" \
17 "mov %%dx, %%gs\n\t"
18# define APM_DO_POP_SEGS \
19 "popl %%es\n\t" \
20 "popl %%ds\n\t"
21#else
22# define APM_DO_ZERO_SEGS
23# define APM_DO_POP_SEGS
24#endif
25
26static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,
27 u32 *eax, u32 *ebx, u32 *ecx,
28 u32 *edx, u32 *esi)
29{
30 /*
31 * N.B. We do NOT need a cld after the BIOS call
32 * because we always save and restore the flags.
33 */
34 __asm__ __volatile__(APM_DO_ZERO_SEGS
35 "pushl %%edi\n\t"
36 "pushl %%ebp\n\t"
37 "lcall *%%cs:apm_bios_entry\n\t"
38 "setc %%al\n\t"
39 "popl %%ebp\n\t"
40 "popl %%edi\n\t"
41 APM_DO_POP_SEGS
42 : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx),
43 "=S" (*esi)
44 : "a" (func), "b" (ebx_in), "c" (ecx_in)
45 : "memory", "cc");
46}
47
48static inline u8 apm_bios_call_simple_asm(u32 func, u32 ebx_in,
49 u32 ecx_in, u32 *eax)
50{
51 int cx, dx, si;
52 u8 error;
53
54 /*
55 * N.B. We do NOT need a cld after the BIOS call
56 * because we always save and restore the flags.
57 */
58 __asm__ __volatile__(APM_DO_ZERO_SEGS
59 "pushl %%edi\n\t"
60 "pushl %%ebp\n\t"
61 "lcall *%%cs:apm_bios_entry\n\t"
62 "setc %%bl\n\t"
63 "popl %%ebp\n\t"
64 "popl %%edi\n\t"
65 APM_DO_POP_SEGS
66 : "=a" (*eax), "=b" (error), "=c" (cx), "=d" (dx),
67 "=S" (si)
68 : "a" (func), "b" (ebx_in), "c" (ecx_in)
69 : "memory", "cc");
70 return error;
71}
72
73#endif /* _ASM_APM_H */
diff --git a/include/asm-x86/mach-default/do_timer.h b/include/asm-x86/mach-default/do_timer.h
deleted file mode 100644
index 23ecda0b28a0..000000000000
--- a/include/asm-x86/mach-default/do_timer.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/* defines for inline arch setup functions */
2#include <linux/clockchips.h>
3
4#include <asm/i8259.h>
5#include <asm/i8253.h>
6
7/**
8 * do_timer_interrupt_hook - hook into timer tick
9 *
10 * Call the pit clock event handler. see asm/i8253.h
11 **/
12
13static inline void do_timer_interrupt_hook(void)
14{
15 global_clock_event->event_handler(global_clock_event);
16}
diff --git a/include/asm-x86/mach-default/entry_arch.h b/include/asm-x86/mach-default/entry_arch.h
deleted file mode 100644
index 9283b60a1dd2..000000000000
--- a/include/asm-x86/mach-default/entry_arch.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * This file is designed to contain the BUILD_INTERRUPT specifications for
3 * all of the extra named interrupt vectors used by the architecture.
4 * Usually this is the Inter Process Interrupts (IPIs)
5 */
6
7/*
8 * The following vectors are part of the Linux architecture, there
9 * is no hardware IRQ pin equivalent for them, they are triggered
10 * through the ICC by us (IPIs)
11 */
12#ifdef CONFIG_X86_SMP
13BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
14BUILD_INTERRUPT(invalidate_interrupt,INVALIDATE_TLB_VECTOR)
15BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
16BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
17#endif
18
19/*
20 * every pentium local APIC has two 'local interrupts', with a
21 * soft-definable vector attached to both interrupts, one of
22 * which is a timer interrupt, the other one is error counter
23 * overflow. Linux uses the local APIC timer interrupt to get
24 * a much simpler SMP time architecture:
25 */
26#ifdef CONFIG_X86_LOCAL_APIC
27BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR)
28BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR)
29BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
30
31#ifdef CONFIG_X86_MCE_P4THERMAL
32BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
33#endif
34
35#endif
diff --git a/include/asm-x86/mach-default/mach_apic.h b/include/asm-x86/mach-default/mach_apic.h
deleted file mode 100644
index f3226b9a6b82..000000000000
--- a/include/asm-x86/mach-default/mach_apic.h
+++ /dev/null
@@ -1,141 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#ifdef CONFIG_X86_LOCAL_APIC
5
6#include <mach_apicdef.h>
7#include <asm/smp.h>
8
9#define APIC_DFR_VALUE (APIC_DFR_FLAT)
10
11static inline cpumask_t target_cpus(void)
12{
13#ifdef CONFIG_SMP
14 return cpu_online_map;
15#else
16 return cpumask_of_cpu(0);
17#endif
18}
19
20#define NO_BALANCE_IRQ (0)
21#define esr_disable (0)
22
23#ifdef CONFIG_X86_64
24#include <asm/genapic.h>
25#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
26#define INT_DEST_MODE (genapic->int_dest_mode)
27#define TARGET_CPUS (genapic->target_cpus())
28#define apic_id_registered (genapic->apic_id_registered)
29#define init_apic_ldr (genapic->init_apic_ldr)
30#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
31#define phys_pkg_id (genapic->phys_pkg_id)
32#define vector_allocation_domain (genapic->vector_allocation_domain)
33extern void setup_apic_routing(void);
34#else
35#define INT_DELIVERY_MODE dest_LowestPrio
36#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
37#define TARGET_CPUS (target_cpus())
38/*
39 * Set up the logical destination ID.
40 *
41 * Intel recommends to set DFR, LDR and TPR before enabling
42 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
43 * document number 292116). So here it goes...
44 */
45static inline void init_apic_ldr(void)
46{
47 unsigned long val;
48
49 apic_write(APIC_DFR, APIC_DFR_VALUE);
50 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
51 val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
52 apic_write(APIC_LDR, val);
53}
54
55static inline int apic_id_registered(void)
56{
57 return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
58}
59
60static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
61{
62 return cpus_addr(cpumask)[0];
63}
64
65static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
66{
67 return cpuid_apic >> index_msb;
68}
69
70static inline void setup_apic_routing(void)
71{
72#ifdef CONFIG_X86_IO_APIC
73 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
74 "Flat", nr_ioapics);
75#endif
76}
77
78static inline int apicid_to_node(int logical_apicid)
79{
80#ifdef CONFIG_SMP
81 return apicid_2_node[hard_smp_processor_id()];
82#else
83 return 0;
84#endif
85}
86#endif
87
88static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
89{
90 return physid_isset(apicid, bitmap);
91}
92
93static inline unsigned long check_apicid_present(int bit)
94{
95 return physid_isset(bit, phys_cpu_present_map);
96}
97
98static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
99{
100 return phys_map;
101}
102
103static inline int multi_timer_check(int apic, int irq)
104{
105 return 0;
106}
107
108/* Mapping from cpu number to logical apicid */
109static inline int cpu_to_logical_apicid(int cpu)
110{
111 return 1 << cpu;
112}
113
114static inline int cpu_present_to_apicid(int mps_cpu)
115{
116 if (mps_cpu < NR_CPUS && cpu_present(mps_cpu))
117 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
118 else
119 return BAD_APICID;
120}
121
122static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
123{
124 return physid_mask_of_physid(phys_apicid);
125}
126
127static inline void setup_portio_remap(void)
128{
129}
130
131static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
132{
133 return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
134}
135
136static inline void enable_apic_mode(void)
137{
138}
139
140#endif /* CONFIG_X86_LOCAL_APIC */
141#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-default/mach_apicdef.h b/include/asm-x86/mach-default/mach_apicdef.h
deleted file mode 100644
index e4b29ba37de6..000000000000
--- a/include/asm-x86/mach-default/mach_apicdef.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4#include <asm/apic.h>
5
6#ifdef CONFIG_X86_64
7#define APIC_ID_MASK (0xFFu<<24)
8#define GET_APIC_ID(x) (((x)>>24)&0xFFu)
9#define SET_APIC_ID(x) (((x)<<24))
10#else
11#define APIC_ID_MASK (0xF<<24)
12static inline unsigned get_apic_id(unsigned long x)
13{
14 unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
15 if (APIC_XAPIC(ver))
16 return (((x)>>24)&0xFF);
17 else
18 return (((x)>>24)&0xF);
19}
20
21#define GET_APIC_ID(x) get_apic_id(x)
22#endif
23
24#endif
diff --git a/include/asm-x86/mach-default/mach_ipi.h b/include/asm-x86/mach-default/mach_ipi.h
deleted file mode 100644
index be323364e68f..000000000000
--- a/include/asm-x86/mach-default/mach_ipi.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4/* Avoid include hell */
5#define NMI_VECTOR 0x02
6
7void send_IPI_mask_bitmask(cpumask_t mask, int vector);
8void __send_IPI_shortcut(unsigned int shortcut, int vector);
9
10extern int no_broadcast;
11
12#ifdef CONFIG_X86_64
13#include <asm/genapic.h>
14#define send_IPI_mask (genapic->send_IPI_mask)
15#else
16static inline void send_IPI_mask(cpumask_t mask, int vector)
17{
18 send_IPI_mask_bitmask(mask, vector);
19}
20#endif
21
22static inline void __local_send_IPI_allbutself(int vector)
23{
24 if (no_broadcast || vector == NMI_VECTOR) {
25 cpumask_t mask = cpu_online_map;
26
27 cpu_clear(smp_processor_id(), mask);
28 send_IPI_mask(mask, vector);
29 } else
30 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
31}
32
33static inline void __local_send_IPI_all(int vector)
34{
35 if (no_broadcast || vector == NMI_VECTOR)
36 send_IPI_mask(cpu_online_map, vector);
37 else
38 __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
39}
40
41#ifdef CONFIG_X86_64
42#define send_IPI_allbutself (genapic->send_IPI_allbutself)
43#define send_IPI_all (genapic->send_IPI_all)
44#else
45static inline void send_IPI_allbutself(int vector)
46{
47 /*
48 * if there are no other CPUs in the system then we get an APIC send
49 * error if we try to broadcast, thus avoid sending IPIs in this case.
50 */
51 if (!(num_online_cpus() > 1))
52 return;
53
54 __local_send_IPI_allbutself(vector);
55 return;
56}
57
58static inline void send_IPI_all(int vector)
59{
60 __local_send_IPI_all(vector);
61}
62#endif
63
64#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-x86/mach-default/mach_mpparse.h b/include/asm-x86/mach-default/mach_mpparse.h
deleted file mode 100644
index d14108505bb8..000000000000
--- a/include/asm-x86/mach-default/mach_mpparse.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H
3
4static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
5 char *productid)
6{
7 return 0;
8}
9
10/* Hook from generic ACPI tables.c */
11static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
12{
13 return 0;
14}
15
16
17#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-x86/mach-default/mach_mpspec.h b/include/asm-x86/mach-default/mach_mpspec.h
deleted file mode 100644
index 51c9a9775932..000000000000
--- a/include/asm-x86/mach-default/mach_mpspec.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __ASM_MACH_MPSPEC_H
2#define __ASM_MACH_MPSPEC_H
3
4#define MAX_IRQ_SOURCES 256
5
6#if CONFIG_BASE_SMALL == 0
7#define MAX_MP_BUSSES 256
8#else
9#define MAX_MP_BUSSES 32
10#endif
11
12#endif /* __ASM_MACH_MPSPEC_H */
diff --git a/include/asm-x86/mach-default/mach_timer.h b/include/asm-x86/mach-default/mach_timer.h
deleted file mode 100644
index 4b76e536cd98..000000000000
--- a/include/asm-x86/mach-default/mach_timer.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Machine specific calibrate_tsc() for generic.
3 * Split out from timer_tsc.c by Osamu Tomita <tomita@cinet.co.jp>
4 */
5/* ------ Calibrate the TSC -------
6 * Return 2^32 * (1 / (TSC clocks per usec)) for do_fast_gettimeoffset().
7 * Too much 64-bit arithmetic here to do this cleanly in C, and for
8 * accuracy's sake we want to keep the overhead on the CTC speaker (channel 2)
9 * output busy loop as low as possible. We avoid reading the CTC registers
10 * directly because of the awkward 8-bit access mechanism of the 82C54
11 * device.
12 */
13#ifndef _MACH_TIMER_H
14#define _MACH_TIMER_H
15
16#define CALIBRATE_TIME_MSEC 30 /* 30 msecs */
17#define CALIBRATE_LATCH \
18 ((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)
19
20static inline void mach_prepare_counter(void)
21{
22 /* Set the Gate high, disable speaker */
23 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
24
25 /*
26 * Now let's take care of CTC channel 2
27 *
28 * Set the Gate high, program CTC channel 2 for mode 0,
29 * (interrupt on terminal count mode), binary count,
30 * load 5 * LATCH count, (LSB and MSB) to begin countdown.
31 *
32 * Some devices need a delay here.
33 */
34 outb(0xb0, 0x43); /* binary, mode 0, LSB/MSB, Ch 2 */
35 outb_p(CALIBRATE_LATCH & 0xff, 0x42); /* LSB of count */
36 outb_p(CALIBRATE_LATCH >> 8, 0x42); /* MSB of count */
37}
38
39static inline void mach_countup(unsigned long *count_p)
40{
41 unsigned long count = 0;
42 do {
43 count++;
44 } while ((inb_p(0x61) & 0x20) == 0);
45 *count_p = count;
46}
47
48#endif /* !_MACH_TIMER_H */
diff --git a/include/asm-x86/mach-default/mach_traps.h b/include/asm-x86/mach-default/mach_traps.h
deleted file mode 100644
index 2fe7705c0484..000000000000
--- a/include/asm-x86/mach-default/mach_traps.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Machine specific NMI handling for generic.
3 * Split out from traps.c by Osamu Tomita <tomita@cinet.co.jp>
4 */
5#ifndef _MACH_TRAPS_H
6#define _MACH_TRAPS_H
7
8#include <asm/mc146818rtc.h>
9
10static inline void clear_mem_error(unsigned char reason)
11{
12 reason = (reason & 0xf) | 4;
13 outb(reason, 0x61);
14}
15
16static inline unsigned char get_nmi_reason(void)
17{
18 return inb(0x61);
19}
20
21static inline void reassert_nmi(void)
22{
23 int old_reg = -1;
24
25 if (do_i_have_lock_cmos())
26 old_reg = current_lock_cmos_reg();
27 else
28 lock_cmos(0); /* register doesn't matter here */
29 outb(0x8f, 0x70);
30 inb(0x71); /* dummy */
31 outb(0x0f, 0x70);
32 inb(0x71); /* dummy */
33 if (old_reg >= 0)
34 outb(old_reg, 0x70);
35 else
36 unlock_cmos();
37}
38
39#endif /* !_MACH_TRAPS_H */
diff --git a/include/asm-x86/mach-default/mach_wakecpu.h b/include/asm-x86/mach-default/mach_wakecpu.h
deleted file mode 100644
index 3ebb17893aa5..000000000000
--- a/include/asm-x86/mach-default/mach_wakecpu.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef __ASM_MACH_WAKECPU_H
2#define __ASM_MACH_WAKECPU_H
3
4/*
5 * This file copes with machines that wakeup secondary CPUs by the
6 * INIT, INIT, STARTUP sequence.
7 */
8
9#define WAKE_SECONDARY_VIA_INIT
10
11#define TRAMPOLINE_LOW phys_to_virt(0x467)
12#define TRAMPOLINE_HIGH phys_to_virt(0x469)
13
14#define boot_cpu_apicid boot_cpu_physical_apicid
15
16static inline void wait_for_init_deassert(atomic_t *deassert)
17{
18 while (!atomic_read(deassert))
19 cpu_relax();
20 return;
21}
22
23/* Nothing to do for most platforms, since cleared by the INIT cycle */
24static inline void smp_callin_clear_local_apic(void)
25{
26}
27
28static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
29{
30}
31
32static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
33{
34}
35
36#if APIC_DEBUG
37 #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
38#else
39 #define inquire_remote_apic(apicid) {}
40#endif
41
42#endif /* __ASM_MACH_WAKECPU_H */
diff --git a/include/asm-x86/mach-default/pci-functions.h b/include/asm-x86/mach-default/pci-functions.h
deleted file mode 100644
index ed0bab427354..000000000000
--- a/include/asm-x86/mach-default/pci-functions.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * PCI BIOS function numbering for conventional PCI BIOS
3 * systems
4 */
5
6#define PCIBIOS_PCI_FUNCTION_ID 0xb1XX
7#define PCIBIOS_PCI_BIOS_PRESENT 0xb101
8#define PCIBIOS_FIND_PCI_DEVICE 0xb102
9#define PCIBIOS_FIND_PCI_CLASS_CODE 0xb103
10#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0xb106
11#define PCIBIOS_READ_CONFIG_BYTE 0xb108
12#define PCIBIOS_READ_CONFIG_WORD 0xb109
13#define PCIBIOS_READ_CONFIG_DWORD 0xb10a
14#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b
15#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c
16#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d
17#define PCIBIOS_GET_ROUTING_OPTIONS 0xb10e
18#define PCIBIOS_SET_PCI_HW_INT 0xb10f
19
diff --git a/include/asm-x86/mach-default/setup_arch.h b/include/asm-x86/mach-default/setup_arch.h
deleted file mode 100644
index 38846208b548..000000000000
--- a/include/asm-x86/mach-default/setup_arch.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/* Hook to call BIOS initialisation function */
2
3/* no action for generic */
diff --git a/include/asm-x86/mach-default/smpboot_hooks.h b/include/asm-x86/mach-default/smpboot_hooks.h
deleted file mode 100644
index dbab36d64d48..000000000000
--- a/include/asm-x86/mach-default/smpboot_hooks.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/* two abstractions specific to kernel/smpboot.c, mainly to cater to visws
2 * which needs to alter them. */
3
4static inline void smpboot_clear_io_apic_irqs(void)
5{
6#ifdef CONFIG_X86_IO_APIC
7 io_apic_irqs = 0;
8#endif
9}
10
11static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
12{
13 CMOS_WRITE(0xa, 0xf);
14 local_flush_tlb();
15 pr_debug("1.\n");
16 *((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
17 pr_debug("2.\n");
18 *((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
19 pr_debug("3.\n");
20}
21
22static inline void smpboot_restore_warm_reset_vector(void)
23{
24 /*
25 * Install writable page 0 entry to set BIOS data area.
26 */
27 local_flush_tlb();
28
29 /*
30 * Paranoid: Set warm reset code and vector here back
31 * to default values.
32 */
33 CMOS_WRITE(0, 0xf);
34
35 *((volatile long *) phys_to_virt(0x467)) = 0;
36}
37
38static inline void __init smpboot_setup_io_apic(void)
39{
40#ifdef CONFIG_X86_IO_APIC
41 /*
42 * Here we can be sure that there is an IO-APIC in the system. Let's
43 * go and set it up:
44 */
45 if (!skip_ioapic_setup && nr_ioapics)
46 setup_IO_APIC();
47 else {
48 nr_ioapics = 0;
49 localise_nmi_watchdog();
50 }
51#endif
52}
53
54static inline void smpboot_clear_io_apic(void)
55{
56#ifdef CONFIG_X86_IO_APIC
57 nr_ioapics = 0;
58#endif
59}
diff --git a/include/asm-x86/mach-es7000/mach_apic.h b/include/asm-x86/mach-es7000/mach_apic.h
deleted file mode 100644
index 0a3fdf930672..000000000000
--- a/include/asm-x86/mach-es7000/mach_apic.h
+++ /dev/null
@@ -1,194 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
5#define esr_disable (1)
6
7static inline int apic_id_registered(void)
8{
9 return (1);
10}
11
12static inline cpumask_t target_cpus(void)
13{
14#if defined CONFIG_ES7000_CLUSTERED_APIC
15 return CPU_MASK_ALL;
16#else
17 return cpumask_of_cpu(smp_processor_id());
18#endif
19}
20#define TARGET_CPUS (target_cpus())
21
22#if defined CONFIG_ES7000_CLUSTERED_APIC
23#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
24#define INT_DELIVERY_MODE (dest_LowestPrio)
25#define INT_DEST_MODE (1) /* logical delivery broadcast to all procs */
26#define NO_BALANCE_IRQ (1)
27#undef WAKE_SECONDARY_VIA_INIT
28#define WAKE_SECONDARY_VIA_MIP
29#else
30#define APIC_DFR_VALUE (APIC_DFR_FLAT)
31#define INT_DELIVERY_MODE (dest_Fixed)
32#define INT_DEST_MODE (0) /* phys delivery to target procs */
33#define NO_BALANCE_IRQ (0)
34#undef APIC_DEST_LOGICAL
35#define APIC_DEST_LOGICAL 0x0
36#define WAKE_SECONDARY_VIA_INIT
37#endif
38
39static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
40{
41 return 0;
42}
43static inline unsigned long check_apicid_present(int bit)
44{
45 return physid_isset(bit, phys_cpu_present_map);
46}
47
48#define apicid_cluster(apicid) (apicid & 0xF0)
49
50static inline unsigned long calculate_ldr(int cpu)
51{
52 unsigned long id;
53 id = xapic_phys_to_log_apicid(cpu);
54 return (SET_APIC_LOGICAL_ID(id));
55}
56
57/*
58 * Set up the logical destination ID.
59 *
60 * Intel recommends to set DFR, LdR and TPR before enabling
61 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
62 * document number 292116). So here it goes...
63 */
64static inline void init_apic_ldr(void)
65{
66 unsigned long val;
67 int cpu = smp_processor_id();
68
69 apic_write(APIC_DFR, APIC_DFR_VALUE);
70 val = calculate_ldr(cpu);
71 apic_write(APIC_LDR, val);
72}
73
74#ifndef CONFIG_X86_GENERICARCH
75extern void enable_apic_mode(void);
76#endif
77
78extern int apic_version [MAX_APICS];
79static inline void setup_apic_routing(void)
80{
81 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
82 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
83 (apic_version[apic] == 0x14) ?
84 "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]);
85}
86
87static inline int multi_timer_check(int apic, int irq)
88{
89 return 0;
90}
91
92static inline int apicid_to_node(int logical_apicid)
93{
94 return 0;
95}
96
97
98static inline int cpu_present_to_apicid(int mps_cpu)
99{
100 if (!mps_cpu)
101 return boot_cpu_physical_apicid;
102 else if (mps_cpu < NR_CPUS)
103 return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
104 else
105 return BAD_APICID;
106}
107
108static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
109{
110 static int id = 0;
111 physid_mask_t mask;
112 mask = physid_mask_of_physid(id);
113 ++id;
114 return mask;
115}
116
117extern u8 cpu_2_logical_apicid[];
118/* Mapping from cpu number to logical apicid */
119static inline int cpu_to_logical_apicid(int cpu)
120{
121#ifdef CONFIG_SMP
122 if (cpu >= NR_CPUS)
123 return BAD_APICID;
124 return (int)cpu_2_logical_apicid[cpu];
125#else
126 return logical_smp_processor_id();
127#endif
128}
129
130static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
131{
132 /* For clustered we don't have a good way to do this yet - hack */
133 return physids_promote(0xff);
134}
135
136
137static inline void setup_portio_remap(void)
138{
139}
140
141extern unsigned int boot_cpu_physical_apicid;
142static inline int check_phys_apicid_present(int cpu_physical_apicid)
143{
144 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
145 return (1);
146}
147
148static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
149{
150 int num_bits_set;
151 int cpus_found = 0;
152 int cpu;
153 int apicid;
154
155 num_bits_set = cpus_weight(cpumask);
156 /* Return id to all */
157 if (num_bits_set == NR_CPUS)
158#if defined CONFIG_ES7000_CLUSTERED_APIC
159 return 0xFF;
160#else
161 return cpu_to_logical_apicid(0);
162#endif
163 /*
164 * The cpus in the mask must all be on the apic cluster. If are not
165 * on the same apicid cluster return default value of TARGET_CPUS.
166 */
167 cpu = first_cpu(cpumask);
168 apicid = cpu_to_logical_apicid(cpu);
169 while (cpus_found < num_bits_set) {
170 if (cpu_isset(cpu, cpumask)) {
171 int new_apicid = cpu_to_logical_apicid(cpu);
172 if (apicid_cluster(apicid) !=
173 apicid_cluster(new_apicid)){
174 printk ("%s: Not a valid mask!\n",__FUNCTION__);
175#if defined CONFIG_ES7000_CLUSTERED_APIC
176 return 0xFF;
177#else
178 return cpu_to_logical_apicid(0);
179#endif
180 }
181 apicid = new_apicid;
182 cpus_found++;
183 }
184 cpu++;
185 }
186 return apicid;
187}
188
189static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
190{
191 return cpuid_apic >> index_msb;
192}
193
194#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-es7000/mach_apicdef.h b/include/asm-x86/mach-es7000/mach_apicdef.h
deleted file mode 100644
index a58ab5a75c8c..000000000000
--- a/include/asm-x86/mach-es7000/mach_apicdef.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4#define APIC_ID_MASK (0xFF<<24)
5
6static inline unsigned get_apic_id(unsigned long x)
7{
8 return (((x)>>24)&0xFF);
9}
10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif
diff --git a/include/asm-x86/mach-es7000/mach_ipi.h b/include/asm-x86/mach-es7000/mach_ipi.h
deleted file mode 100644
index 5e61bd220b06..000000000000
--- a/include/asm-x86/mach-es7000/mach_ipi.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4void send_IPI_mask_sequence(cpumask_t mask, int vector);
5
6static inline void send_IPI_mask(cpumask_t mask, int vector)
7{
8 send_IPI_mask_sequence(mask, vector);
9}
10
11static inline void send_IPI_allbutself(int vector)
12{
13 cpumask_t mask = cpu_online_map;
14 cpu_clear(smp_processor_id(), mask);
15 if (!cpus_empty(mask))
16 send_IPI_mask(mask, vector);
17}
18
19static inline void send_IPI_all(int vector)
20{
21 send_IPI_mask(cpu_online_map, vector);
22}
23
24#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h b/include/asm-x86/mach-es7000/mach_mpparse.h
deleted file mode 100644
index ef26d3523625..000000000000
--- a/include/asm-x86/mach-es7000/mach_mpparse.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H
3
4#include <linux/acpi.h>
5
6extern int parse_unisys_oem (char *oemptr);
7extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
8extern void setup_unisys(void);
9
10#ifndef CONFIG_X86_GENERICARCH
11extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
12extern int mps_oem_check(struct mp_config_table *mpc, char *oem,
13 char *productid);
14#endif
15
16#ifdef CONFIG_ACPI
17
18static inline int es7000_check_dsdt(void)
19{
20 struct acpi_table_header header;
21
22 if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
23 !strncmp(header.oem_id, "UNISYS", 6))
24 return 1;
25 return 0;
26}
27#endif
28
29#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-x86/mach-es7000/mach_wakecpu.h b/include/asm-x86/mach-es7000/mach_wakecpu.h
deleted file mode 100644
index 84ff58314501..000000000000
--- a/include/asm-x86/mach-es7000/mach_wakecpu.h
+++ /dev/null
@@ -1,59 +0,0 @@
1#ifndef __ASM_MACH_WAKECPU_H
2#define __ASM_MACH_WAKECPU_H
3
4/*
5 * This file copes with machines that wakeup secondary CPUs by the
6 * INIT, INIT, STARTUP sequence.
7 */
8
9#ifdef CONFIG_ES7000_CLUSTERED_APIC
10#define WAKE_SECONDARY_VIA_MIP
11#else
12#define WAKE_SECONDARY_VIA_INIT
13#endif
14
15#ifdef WAKE_SECONDARY_VIA_MIP
16extern int es7000_start_cpu(int cpu, unsigned long eip);
17static inline int
18wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
19{
20 int boot_error = 0;
21 boot_error = es7000_start_cpu(phys_apicid, start_eip);
22 return boot_error;
23}
24#endif
25
26#define TRAMPOLINE_LOW phys_to_virt(0x467)
27#define TRAMPOLINE_HIGH phys_to_virt(0x469)
28
29#define boot_cpu_apicid boot_cpu_physical_apicid
30
31static inline void wait_for_init_deassert(atomic_t *deassert)
32{
33#ifdef WAKE_SECONDARY_VIA_INIT
34 while (!atomic_read(deassert))
35 cpu_relax();
36#endif
37 return;
38}
39
40/* Nothing to do for most platforms, since cleared by the INIT cycle */
41static inline void smp_callin_clear_local_apic(void)
42{
43}
44
45static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
46{
47}
48
49static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
50{
51}
52
53#if APIC_DEBUG
54 #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
55#else
56 #define inquire_remote_apic(apicid) {}
57#endif
58
59#endif /* __ASM_MACH_WAKECPU_H */
diff --git a/include/asm-x86/mach-generic/gpio.h b/include/asm-x86/mach-generic/gpio.h
deleted file mode 100644
index 5305dcb96df2..000000000000
--- a/include/asm-x86/mach-generic/gpio.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef __ASM_MACH_GENERIC_GPIO_H
2#define __ASM_MACH_GENERIC_GPIO_H
3
4int gpio_request(unsigned gpio, const char *label);
5void gpio_free(unsigned gpio);
6int gpio_direction_input(unsigned gpio);
7int gpio_direction_output(unsigned gpio, int value);
8int gpio_get_value(unsigned gpio);
9void gpio_set_value(unsigned gpio, int value);
10int gpio_to_irq(unsigned gpio);
11int irq_to_gpio(unsigned irq);
12
13#include <asm-generic/gpio.h> /* cansleep wrappers */
14
15#endif /* __ASM_MACH_GENERIC_GPIO_H */
diff --git a/include/asm-x86/mach-generic/irq_vectors_limits.h b/include/asm-x86/mach-generic/irq_vectors_limits.h
deleted file mode 100644
index 890ce3f5e09a..000000000000
--- a/include/asm-x86/mach-generic/irq_vectors_limits.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_IRQ_VECTORS_LIMITS_H
2#define _ASM_IRQ_VECTORS_LIMITS_H
3
4/*
5 * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs,
6 * even with uni-proc kernels, so use a big array.
7 *
8 * This value should be the same in both the generic and summit subarches.
9 * Change one, change 'em both.
10 */
11#define NR_IRQS 224
12#define NR_IRQ_VECTORS 1024
13
14#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
diff --git a/include/asm-x86/mach-generic/mach_apic.h b/include/asm-x86/mach-generic/mach_apic.h
deleted file mode 100644
index 6eff343e1233..000000000000
--- a/include/asm-x86/mach-generic/mach_apic.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#include <asm/genapic.h>
5
6#define esr_disable (genapic->ESR_DISABLE)
7#define NO_BALANCE_IRQ (genapic->no_balance_irq)
8#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
9#define INT_DEST_MODE (genapic->int_dest_mode)
10#undef APIC_DEST_LOGICAL
11#define APIC_DEST_LOGICAL (genapic->apic_destination_logical)
12#define TARGET_CPUS (genapic->target_cpus())
13#define apic_id_registered (genapic->apic_id_registered)
14#define init_apic_ldr (genapic->init_apic_ldr)
15#define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
16#define setup_apic_routing (genapic->setup_apic_routing)
17#define multi_timer_check (genapic->multi_timer_check)
18#define apicid_to_node (genapic->apicid_to_node)
19#define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid)
20#define cpu_present_to_apicid (genapic->cpu_present_to_apicid)
21#define apicid_to_cpu_present (genapic->apicid_to_cpu_present)
22#define setup_portio_remap (genapic->setup_portio_remap)
23#define check_apicid_present (genapic->check_apicid_present)
24#define check_phys_apicid_present (genapic->check_phys_apicid_present)
25#define check_apicid_used (genapic->check_apicid_used)
26#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
27#define enable_apic_mode (genapic->enable_apic_mode)
28#define phys_pkg_id (genapic->phys_pkg_id)
29
30extern void generic_bigsmp_probe(void);
31
32#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-generic/mach_apicdef.h b/include/asm-x86/mach-generic/mach_apicdef.h
deleted file mode 100644
index 28ed98972ca8..000000000000
--- a/include/asm-x86/mach-generic/mach_apicdef.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _GENAPIC_MACH_APICDEF_H
2#define _GENAPIC_MACH_APICDEF_H 1
3
4#ifndef APIC_DEFINITION
5#include <asm/genapic.h>
6
7#define GET_APIC_ID (genapic->get_apic_id)
8#define APIC_ID_MASK (genapic->apic_id_mask)
9#endif
10
11#endif
diff --git a/include/asm-x86/mach-generic/mach_ipi.h b/include/asm-x86/mach-generic/mach_ipi.h
deleted file mode 100644
index 441b0fe3ed1d..000000000000
--- a/include/asm-x86/mach-generic/mach_ipi.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _MACH_IPI_H
2#define _MACH_IPI_H 1
3
4#include <asm/genapic.h>
5
6#define send_IPI_mask (genapic->send_IPI_mask)
7#define send_IPI_allbutself (genapic->send_IPI_allbutself)
8#define send_IPI_all (genapic->send_IPI_all)
9
10#endif
diff --git a/include/asm-x86/mach-generic/mach_mpparse.h b/include/asm-x86/mach-generic/mach_mpparse.h
deleted file mode 100644
index 586cadbf3787..000000000000
--- a/include/asm-x86/mach-generic/mach_mpparse.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _MACH_MPPARSE_H
2#define _MACH_MPPARSE_H 1
3
4
5extern int mps_oem_check(struct mp_config_table *mpc, char *oem,
6 char *productid);
7
8extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
9
10#endif
diff --git a/include/asm-x86/mach-generic/mach_mpspec.h b/include/asm-x86/mach-generic/mach_mpspec.h
deleted file mode 100644
index c83c120be538..000000000000
--- a/include/asm-x86/mach-generic/mach_mpspec.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef __ASM_MACH_MPSPEC_H
2#define __ASM_MACH_MPSPEC_H
3
4#define MAX_IRQ_SOURCES 256
5
6/* Summit or generic (i.e. installer) kernels need lots of bus entries. */
7/* Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets. */
8#define MAX_MP_BUSSES 260
9
10extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
11 char *productid);
12#endif /* __ASM_MACH_MPSPEC_H */
diff --git a/include/asm-x86/mach-numaq/mach_apic.h b/include/asm-x86/mach-numaq/mach_apic.h
deleted file mode 100644
index d802465e026a..000000000000
--- a/include/asm-x86/mach-numaq/mach_apic.h
+++ /dev/null
@@ -1,138 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#include <asm/io.h>
5#include <linux/mmzone.h>
6#include <linux/nodemask.h>
7
8#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
9
10static inline cpumask_t target_cpus(void)
11{
12 return CPU_MASK_ALL;
13}
14
15#define TARGET_CPUS (target_cpus())
16
17#define NO_BALANCE_IRQ (1)
18#define esr_disable (1)
19
20#define INT_DELIVERY_MODE dest_LowestPrio
21#define INT_DEST_MODE 0 /* physical delivery on LOCAL quad */
22
23static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
24{
25 return physid_isset(apicid, bitmap);
26}
27static inline unsigned long check_apicid_present(int bit)
28{
29 return physid_isset(bit, phys_cpu_present_map);
30}
31#define apicid_cluster(apicid) (apicid & 0xF0)
32
33static inline int apic_id_registered(void)
34{
35 return 1;
36}
37
38static inline void init_apic_ldr(void)
39{
40 /* Already done in NUMA-Q firmware */
41}
42
43static inline void setup_apic_routing(void)
44{
45 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
46 "NUMA-Q", nr_ioapics);
47}
48
49/*
50 * Skip adding the timer int on secondary nodes, which causes
51 * a small but painful rift in the time-space continuum.
52 */
53static inline int multi_timer_check(int apic, int irq)
54{
55 return apic != 0 && irq == 0;
56}
57
58static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
59{
60 /* We don't have a good way to do this yet - hack */
61 return physids_promote(0xFUL);
62}
63
64/* Mapping from cpu number to logical apicid */
65extern u8 cpu_2_logical_apicid[];
66static inline int cpu_to_logical_apicid(int cpu)
67{
68 if (cpu >= NR_CPUS)
69 return BAD_APICID;
70 return (int)cpu_2_logical_apicid[cpu];
71}
72
73/*
74 * Supporting over 60 cpus on NUMA-Q requires a locality-dependent
75 * cpu to APIC ID relation to properly interact with the intelligent
76 * mode of the cluster controller.
77 */
78static inline int cpu_present_to_apicid(int mps_cpu)
79{
80 if (mps_cpu < 60)
81 return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
82 else
83 return BAD_APICID;
84}
85
86static inline int apicid_to_node(int logical_apicid)
87{
88 return logical_apicid >> 4;
89}
90
91static inline physid_mask_t apicid_to_cpu_present(int logical_apicid)
92{
93 int node = apicid_to_node(logical_apicid);
94 int cpu = __ffs(logical_apicid & 0xf);
95
96 return physid_mask_of_physid(cpu + 4*node);
97}
98
99extern void *xquad_portio;
100
101static inline void setup_portio_remap(void)
102{
103 int num_quads = num_online_nodes();
104
105 if (num_quads <= 1)
106 return;
107
108 printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
109 xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
110 printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
111 (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
112}
113
114static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
115{
116 return (1);
117}
118
119static inline void enable_apic_mode(void)
120{
121}
122
123/*
124 * We use physical apicids here, not logical, so just return the default
125 * physical broadcast to stop people from breaking us
126 */
127static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
128{
129 return (int) 0xF;
130}
131
132/* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
133static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
134{
135 return cpuid_apic >> index_msb;
136}
137
138#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-numaq/mach_apicdef.h b/include/asm-x86/mach-numaq/mach_apicdef.h
deleted file mode 100644
index bf439d0690f5..000000000000
--- a/include/asm-x86/mach-numaq/mach_apicdef.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4
5#define APIC_ID_MASK (0xF<<24)
6
7static inline unsigned get_apic_id(unsigned long x)
8{
9 return (((x)>>24)&0x0F);
10}
11
12#define GET_APIC_ID(x) get_apic_id(x)
13
14#endif
diff --git a/include/asm-x86/mach-numaq/mach_ipi.h b/include/asm-x86/mach-numaq/mach_ipi.h
deleted file mode 100644
index c6044488e9e6..000000000000
--- a/include/asm-x86/mach-numaq/mach_ipi.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4void send_IPI_mask_sequence(cpumask_t, int vector);
5
6static inline void send_IPI_mask(cpumask_t mask, int vector)
7{
8 send_IPI_mask_sequence(mask, vector);
9}
10
11static inline void send_IPI_allbutself(int vector)
12{
13 cpumask_t mask = cpu_online_map;
14 cpu_clear(smp_processor_id(), mask);
15
16 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector);
18}
19
20static inline void send_IPI_all(int vector)
21{
22 send_IPI_mask(cpu_online_map, vector);
23}
24
25#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-x86/mach-numaq/mach_mpparse.h b/include/asm-x86/mach-numaq/mach_mpparse.h
deleted file mode 100644
index 626aef6b155f..000000000000
--- a/include/asm-x86/mach-numaq/mach_mpparse.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H
3
4extern void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem,
5 char *productid);
6
7#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-x86/mach-numaq/mach_wakecpu.h b/include/asm-x86/mach-numaq/mach_wakecpu.h
deleted file mode 100644
index 00530041a991..000000000000
--- a/include/asm-x86/mach-numaq/mach_wakecpu.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef __ASM_MACH_WAKECPU_H
2#define __ASM_MACH_WAKECPU_H
3
4/* This file copes with machines that wakeup secondary CPUs by NMIs */
5
6#define WAKE_SECONDARY_VIA_NMI
7
8#define TRAMPOLINE_LOW phys_to_virt(0x8)
9#define TRAMPOLINE_HIGH phys_to_virt(0xa)
10
11#define boot_cpu_apicid boot_cpu_logical_apicid
12
13/* We don't do anything here because we use NMI's to boot instead */
14static inline void wait_for_init_deassert(atomic_t *deassert)
15{
16}
17
18/*
19 * Because we use NMIs rather than the INIT-STARTUP sequence to
20 * bootstrap the CPUs, the APIC may be in a weird state. Kick it.
21 */
22static inline void smp_callin_clear_local_apic(void)
23{
24 clear_local_APIC();
25}
26
27static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
28{
29 printk("Storing NMI vector\n");
30 *high = *((volatile unsigned short *) TRAMPOLINE_HIGH);
31 *low = *((volatile unsigned short *) TRAMPOLINE_LOW);
32}
33
34static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
35{
36 printk("Restoring NMI vector\n");
37 *((volatile unsigned short *) TRAMPOLINE_HIGH) = *high;
38 *((volatile unsigned short *) TRAMPOLINE_LOW) = *low;
39}
40
41#define inquire_remote_apic(apicid) {}
42
43#endif /* __ASM_MACH_WAKECPU_H */
diff --git a/include/asm-x86/mach-rdc321x/gpio.h b/include/asm-x86/mach-rdc321x/gpio.h
deleted file mode 100644
index acce0b7d397b..000000000000
--- a/include/asm-x86/mach-rdc321x/gpio.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _RDC321X_GPIO_H
2#define _RDC321X_GPIO_H
3
4extern int rdc_gpio_get_value(unsigned gpio);
5extern void rdc_gpio_set_value(unsigned gpio, int value);
6extern int rdc_gpio_direction_input(unsigned gpio);
7extern int rdc_gpio_direction_output(unsigned gpio, int value);
8extern int rdc_gpio_request(unsigned gpio, const char *label);
9extern void rdc_gpio_free(unsigned gpio);
10extern void __init rdc321x_gpio_setup(void);
11
12/* Wrappers for the arch-neutral GPIO API */
13
14static inline int gpio_request(unsigned gpio, const char *label)
15{
16 return rdc_gpio_request(gpio, label);
17}
18
19static inline void gpio_free(unsigned gpio)
20{
21 rdc_gpio_free(gpio);
22}
23
24static inline int gpio_direction_input(unsigned gpio)
25{
26 return rdc_gpio_direction_input(gpio);
27}
28
29static inline int gpio_direction_output(unsigned gpio, int value)
30{
31 return rdc_gpio_direction_output(gpio, value);
32}
33
34static inline int gpio_get_value(unsigned gpio)
35{
36 return rdc_gpio_get_value(gpio);
37}
38
39static inline void gpio_set_value(unsigned gpio, int value)
40{
41 rdc_gpio_set_value(gpio, value);
42}
43
44static inline int gpio_to_irq(unsigned gpio)
45{
46 return gpio;
47}
48
49static inline int irq_to_gpio(unsigned irq)
50{
51 return irq;
52}
53
54/* For cansleep */
55#include <asm-generic/gpio.h>
56
57#endif /* _RDC321X_GPIO_H_ */
diff --git a/include/asm-x86/mach-rdc321x/rdc321x_defs.h b/include/asm-x86/mach-rdc321x/rdc321x_defs.h
deleted file mode 100644
index c8e9c8bed3d0..000000000000
--- a/include/asm-x86/mach-rdc321x/rdc321x_defs.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#define PFX "rdc321x: "
2
3/* General purpose configuration and data registers */
4#define RDC3210_CFGREG_ADDR 0x0CF8
5#define RDC3210_CFGREG_DATA 0x0CFC
6
7#define RDC321X_GPIO_CTRL_REG1 0x48
8#define RDC321X_GPIO_CTRL_REG2 0x84
9#define RDC321X_GPIO_DATA_REG1 0x4c
10#define RDC321X_GPIO_DATA_REG2 0x88
11
12#define RDC321X_MAX_GPIO 58
diff --git a/include/asm-x86/mach-summit/irq_vectors_limits.h b/include/asm-x86/mach-summit/irq_vectors_limits.h
deleted file mode 100644
index 890ce3f5e09a..000000000000
--- a/include/asm-x86/mach-summit/irq_vectors_limits.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_IRQ_VECTORS_LIMITS_H
2#define _ASM_IRQ_VECTORS_LIMITS_H
3
4/*
5 * For Summit or generic (i.e. installer) kernels, we have lots of I/O APICs,
6 * even with uni-proc kernels, so use a big array.
7 *
8 * This value should be the same in both the generic and summit subarches.
9 * Change one, change 'em both.
10 */
11#define NR_IRQS 224
12#define NR_IRQ_VECTORS 1024
13
14#endif /* _ASM_IRQ_VECTORS_LIMITS_H */
diff --git a/include/asm-x86/mach-summit/mach_apic.h b/include/asm-x86/mach-summit/mach_apic.h
deleted file mode 100644
index c47e2ab5c5ca..000000000000
--- a/include/asm-x86/mach-summit/mach_apic.h
+++ /dev/null
@@ -1,185 +0,0 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4#include <asm/smp.h>
5
6#define esr_disable (1)
7#define NO_BALANCE_IRQ (0)
8
9/* In clustered mode, the high nibble of APIC ID is a cluster number.
10 * The low nibble is a 4-bit bitmap. */
11#define XAPIC_DEST_CPUS_SHIFT 4
12#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1)
13#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT)
14
15#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
16
17static inline cpumask_t target_cpus(void)
18{
19 /* CPU_MASK_ALL (0xff) has undefined behaviour with
20 * dest_LowestPrio mode logical clustered apic interrupt routing
21 * Just start on cpu 0. IRQ balancing will spread load
22 */
23 return cpumask_of_cpu(0);
24}
25#define TARGET_CPUS (target_cpus())
26
27#define INT_DELIVERY_MODE (dest_LowestPrio)
28#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
29
30static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
31{
32 return 0;
33}
34
35/* we don't use the phys_cpu_present_map to indicate apicid presence */
36static inline unsigned long check_apicid_present(int bit)
37{
38 return 1;
39}
40
41#define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
42
43extern u8 cpu_2_logical_apicid[];
44
45static inline void init_apic_ldr(void)
46{
47 unsigned long val, id;
48 int count = 0;
49 u8 my_id = (u8)hard_smp_processor_id();
50 u8 my_cluster = (u8)apicid_cluster(my_id);
51#ifdef CONFIG_SMP
52 u8 lid;
53 int i;
54
55 /* Create logical APIC IDs by counting CPUs already in cluster. */
56 for (count = 0, i = NR_CPUS; --i >= 0; ) {
57 lid = cpu_2_logical_apicid[i];
58 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster)
59 ++count;
60 }
61#endif
62 /* We only have a 4 wide bitmap in cluster mode. If a deranged
63 * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */
64 BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT);
65 id = my_cluster | (1UL << count);
66 apic_write(APIC_DFR, APIC_DFR_VALUE);
67 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
68 val |= SET_APIC_LOGICAL_ID(id);
69 apic_write(APIC_LDR, val);
70}
71
72static inline int multi_timer_check(int apic, int irq)
73{
74 return 0;
75}
76
77static inline int apic_id_registered(void)
78{
79 return 1;
80}
81
82static inline void setup_apic_routing(void)
83{
84 printk("Enabling APIC mode: Summit. Using %d I/O APICs\n",
85 nr_ioapics);
86}
87
88static inline int apicid_to_node(int logical_apicid)
89{
90#ifdef CONFIG_SMP
91 return apicid_2_node[hard_smp_processor_id()];
92#else
93 return 0;
94#endif
95}
96
97/* Mapping from cpu number to logical apicid */
98static inline int cpu_to_logical_apicid(int cpu)
99{
100#ifdef CONFIG_SMP
101 if (cpu >= NR_CPUS)
102 return BAD_APICID;
103 return (int)cpu_2_logical_apicid[cpu];
104#else
105 return logical_smp_processor_id();
106#endif
107}
108
109static inline int cpu_present_to_apicid(int mps_cpu)
110{
111 if (mps_cpu < NR_CPUS)
112 return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
113 else
114 return BAD_APICID;
115}
116
117static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map)
118{
119 /* For clustered we don't have a good way to do this yet - hack */
120 return physids_promote(0x0F);
121}
122
123static inline physid_mask_t apicid_to_cpu_present(int apicid)
124{
125 return physid_mask_of_physid(apicid);
126}
127
128static inline void setup_portio_remap(void)
129{
130}
131
132static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
133{
134 return 1;
135}
136
137static inline void enable_apic_mode(void)
138{
139}
140
141static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
142{
143 int num_bits_set;
144 int cpus_found = 0;
145 int cpu;
146 int apicid;
147
148 num_bits_set = cpus_weight(cpumask);
149 /* Return id to all */
150 if (num_bits_set == NR_CPUS)
151 return (int) 0xFF;
152 /*
153 * The cpus in the mask must all be on the apic cluster. If are not
154 * on the same apicid cluster return default value of TARGET_CPUS.
155 */
156 cpu = first_cpu(cpumask);
157 apicid = cpu_to_logical_apicid(cpu);
158 while (cpus_found < num_bits_set) {
159 if (cpu_isset(cpu, cpumask)) {
160 int new_apicid = cpu_to_logical_apicid(cpu);
161 if (apicid_cluster(apicid) !=
162 apicid_cluster(new_apicid)){
163 printk ("%s: Not a valid mask!\n",__FUNCTION__);
164 return 0xFF;
165 }
166 apicid = apicid | new_apicid;
167 cpus_found++;
168 }
169 cpu++;
170 }
171 return apicid;
172}
173
174/* cpuid returns the value latched in the HW at reset, not the APIC ID
175 * register's value. For any box whose BIOS changes APIC IDs, like
176 * clustered APIC systems, we must use hard_smp_processor_id.
177 *
178 * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
179 */
180static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
181{
182 return hard_smp_processor_id() >> index_msb;
183}
184
185#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-x86/mach-summit/mach_apicdef.h b/include/asm-x86/mach-summit/mach_apicdef.h
deleted file mode 100644
index a58ab5a75c8c..000000000000
--- a/include/asm-x86/mach-summit/mach_apicdef.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4#define APIC_ID_MASK (0xFF<<24)
5
6static inline unsigned get_apic_id(unsigned long x)
7{
8 return (((x)>>24)&0xFF);
9}
10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif
diff --git a/include/asm-x86/mach-summit/mach_ipi.h b/include/asm-x86/mach-summit/mach_ipi.h
deleted file mode 100644
index 9404c535b7ec..000000000000
--- a/include/asm-x86/mach-summit/mach_ipi.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4void send_IPI_mask_sequence(cpumask_t mask, int vector);
5
6static inline void send_IPI_mask(cpumask_t mask, int vector)
7{
8 send_IPI_mask_sequence(mask, vector);
9}
10
11static inline void send_IPI_allbutself(int vector)
12{
13 cpumask_t mask = cpu_online_map;
14 cpu_clear(smp_processor_id(), mask);
15
16 if (!cpus_empty(mask))
17 send_IPI_mask(mask, vector);
18}
19
20static inline void send_IPI_all(int vector)
21{
22 send_IPI_mask(cpu_online_map, vector);
23}
24
25#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-x86/mach-summit/mach_mpparse.h b/include/asm-x86/mach-summit/mach_mpparse.h
deleted file mode 100644
index fdf591701339..000000000000
--- a/include/asm-x86/mach-summit/mach_mpparse.h
+++ /dev/null
@@ -1,110 +0,0 @@
1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H
3
4#include <mach_apic.h>
5#include <asm/tsc.h>
6
7extern int use_cyclone;
8
9#ifdef CONFIG_X86_SUMMIT_NUMA
10extern void setup_summit(void);
11#else
12#define setup_summit() {}
13#endif
14
15static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
16 char *productid)
17{
18 if (!strncmp(oem, "IBM ENSW", 8) &&
19 (!strncmp(productid, "VIGIL SMP", 9)
20 || !strncmp(productid, "EXA", 3)
21 || !strncmp(productid, "RUTHLESS SMP", 12))){
22 mark_tsc_unstable("Summit based system");
23 use_cyclone = 1; /*enable cyclone-timer*/
24 setup_summit();
25 return 1;
26 }
27 return 0;
28}
29
30/* Hook from generic ACPI tables.c */
31static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
32{
33 if (!strncmp(oem_id, "IBM", 3) &&
34 (!strncmp(oem_table_id, "SERVIGIL", 8)
35 || !strncmp(oem_table_id, "EXA", 3))){
36 mark_tsc_unstable("Summit based system");
37 use_cyclone = 1; /*enable cyclone-timer*/
38 setup_summit();
39 return 1;
40 }
41 return 0;
42}
43
44struct rio_table_hdr {
45 unsigned char version; /* Version number of this data structure */
46 /* Version 3 adds chassis_num & WP_index */
47 unsigned char num_scal_dev; /* # of Scalability devices (Twisters for Vigil) */
48 unsigned char num_rio_dev; /* # of RIO I/O devices (Cyclones and Winnipegs) */
49} __attribute__((packed));
50
51struct scal_detail {
52 unsigned char node_id; /* Scalability Node ID */
53 unsigned long CBAR; /* Address of 1MB register space */
54 unsigned char port0node; /* Node ID port connected to: 0xFF=None */
55 unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */
56 unsigned char port1node; /* Node ID port connected to: 0xFF = None */
57 unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */
58 unsigned char port2node; /* Node ID port connected to: 0xFF = None */
59 unsigned char port2port; /* Port num port connected to: 0,1,2, or 0xFF=None */
60 unsigned char chassis_num; /* 1 based Chassis number (1 = boot node) */
61} __attribute__((packed));
62
63struct rio_detail {
64 unsigned char node_id; /* RIO Node ID */
65 unsigned long BBAR; /* Address of 1MB register space */
66 unsigned char type; /* Type of device */
67 unsigned char owner_id; /* For WPEG: Node ID of Cyclone that owns this WPEG*/
68 /* For CYC: Node ID of Twister that owns this CYC */
69 unsigned char port0node; /* Node ID port connected to: 0xFF=None */
70 unsigned char port0port; /* Port num port connected to: 0,1,2, or 0xFF=None */
71 unsigned char port1node; /* Node ID port connected to: 0xFF=None */
72 unsigned char port1port; /* Port num port connected to: 0,1,2, or 0xFF=None */
73 unsigned char first_slot; /* For WPEG: Lowest slot number below this WPEG */
74 /* For CYC: 0 */
75 unsigned char status; /* For WPEG: Bit 0 = 1 : the XAPIC is used */
76 /* = 0 : the XAPIC is not used, ie:*/
77 /* ints fwded to another XAPIC */
78 /* Bits1:7 Reserved */
79 /* For CYC: Bits0:7 Reserved */
80 unsigned char WP_index; /* For WPEG: WPEG instance index - lower ones have */
81 /* lower slot numbers/PCI bus numbers */
82 /* For CYC: No meaning */
83 unsigned char chassis_num; /* 1 based Chassis number */
84 /* For LookOut WPEGs this field indicates the */
85 /* Expansion Chassis #, enumerated from Boot */
86 /* Node WPEG external port, then Boot Node CYC */
87 /* external port, then Next Vigil chassis WPEG */
88 /* external port, etc. */
89 /* Shared Lookouts have only 1 chassis number (the */
90 /* first one assigned) */
91} __attribute__((packed));
92
93
94typedef enum {
95 CompatTwister = 0, /* Compatibility Twister */
96 AltTwister = 1, /* Alternate Twister of internal 8-way */
97 CompatCyclone = 2, /* Compatibility Cyclone */
98 AltCyclone = 3, /* Alternate Cyclone of internal 8-way */
99 CompatWPEG = 4, /* Compatibility WPEG */
100 AltWPEG = 5, /* Second Planar WPEG */
101 LookOutAWPEG = 6, /* LookOut WPEG */
102 LookOutBWPEG = 7, /* LookOut WPEG */
103} node_type;
104
105static inline int is_WPEG(struct rio_detail *rio){
106 return (rio->type == CompatWPEG || rio->type == AltWPEG ||
107 rio->type == LookOutAWPEG || rio->type == LookOutBWPEG);
108}
109
110#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-x86/mach-voyager/do_timer.h b/include/asm-x86/mach-voyager/do_timer.h
deleted file mode 100644
index 9e5a459fd15b..000000000000
--- a/include/asm-x86/mach-voyager/do_timer.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/* defines for inline arch setup functions */
2#include <linux/clockchips.h>
3
4#include <asm/voyager.h>
5#include <asm/i8253.h>
6
7/**
8 * do_timer_interrupt_hook - hook into timer tick
9 *
10 * Call the pit clock event handler. see asm/i8253.h
11 **/
12static inline void do_timer_interrupt_hook(void)
13{
14 global_clock_event->event_handler(global_clock_event);
15 voyager_timer_interrupt();
16}
17
diff --git a/include/asm-x86/mach-voyager/entry_arch.h b/include/asm-x86/mach-voyager/entry_arch.h
deleted file mode 100644
index ae52624b5937..000000000000
--- a/include/asm-x86/mach-voyager/entry_arch.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* Copyright (C) 2002
4 *
5 * Author: James.Bottomley@HansenPartnership.com
6 *
7 * linux/arch/i386/voyager/entry_arch.h
8 *
9 * This file builds the VIC and QIC CPI gates
10 */
11
12/* initialise the voyager interrupt gates
13 *
14 * This uses the macros in irq.h to set up assembly jump gates. The
15 * calls are then redirected to the same routine with smp_ prefixed */
16BUILD_INTERRUPT(vic_sys_interrupt, VIC_SYS_INT)
17BUILD_INTERRUPT(vic_cmn_interrupt, VIC_CMN_INT)
18BUILD_INTERRUPT(vic_cpi_interrupt, VIC_CPI_LEVEL0);
19
20/* do all the QIC interrupts */
21BUILD_INTERRUPT(qic_timer_interrupt, QIC_TIMER_CPI);
22BUILD_INTERRUPT(qic_invalidate_interrupt, QIC_INVALIDATE_CPI);
23BUILD_INTERRUPT(qic_reschedule_interrupt, QIC_RESCHEDULE_CPI);
24BUILD_INTERRUPT(qic_enable_irq_interrupt, QIC_ENABLE_IRQ_CPI);
25BUILD_INTERRUPT(qic_call_function_interrupt, QIC_CALL_FUNCTION_CPI);
26BUILD_INTERRUPT(qic_call_function_single_interrupt, QIC_CALL_FUNCTION_SINGLE_CPI);
diff --git a/include/asm-x86/mach-voyager/setup_arch.h b/include/asm-x86/mach-voyager/setup_arch.h
deleted file mode 100644
index 71729ca05cd7..000000000000
--- a/include/asm-x86/mach-voyager/setup_arch.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#include <asm/voyager.h>
2#include <asm/setup.h>
3#define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \
4 (&boot_params.apm_bios_info))
5
6/* Hook to call BIOS initialisation function */
7
8/* for voyager, pass the voyager BIOS/SUS info area to the detection
9 * routines */
10
11#define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO);
12
diff --git a/include/asm-x86/math_emu.h b/include/asm-x86/math_emu.h
deleted file mode 100644
index 9bf4ae93ab10..000000000000
--- a/include/asm-x86/math_emu.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _I386_MATH_EMU_H
2#define _I386_MATH_EMU_H
3
4/* This structure matches the layout of the data saved to the stack
5 following a device-not-present interrupt, part of it saved
6 automatically by the 80386/80486.
7 */
8struct info {
9 long ___orig_eip;
10 long ___ebx;
11 long ___ecx;
12 long ___edx;
13 long ___esi;
14 long ___edi;
15 long ___ebp;
16 long ___eax;
17 long ___ds;
18 long ___es;
19 long ___fs;
20 long ___orig_eax;
21 long ___eip;
22 long ___cs;
23 long ___eflags;
24 long ___esp;
25 long ___ss;
26 long ___vm86_es; /* This and the following only in vm86 mode */
27 long ___vm86_ds;
28 long ___vm86_fs;
29 long ___vm86_gs;
30};
31#endif
diff --git a/include/asm-x86/mc146818rtc.h b/include/asm-x86/mc146818rtc.h
deleted file mode 100644
index daf1ccde77af..000000000000
--- a/include/asm-x86/mc146818rtc.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 * Machine dependent access functions for RTC registers.
3 */
4#ifndef _ASM_MC146818RTC_H
5#define _ASM_MC146818RTC_H
6
7#include <asm/io.h>
8#include <asm/system.h>
9#include <asm/processor.h>
10#include <linux/mc146818rtc.h>
11
12#ifndef RTC_PORT
13#define RTC_PORT(x) (0x70 + (x))
14#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
15#endif
16
17#if defined(CONFIG_X86_32) && defined(__HAVE_ARCH_CMPXCHG)
18/*
19 * This lock provides nmi access to the CMOS/RTC registers. It has some
20 * special properties. It is owned by a CPU and stores the index register
21 * currently being accessed (if owned). The idea here is that it works
22 * like a normal lock (normally). However, in an NMI, the NMI code will
23 * first check to see if its CPU owns the lock, meaning that the NMI
24 * interrupted during the read/write of the device. If it does, it goes ahead
25 * and performs the access and then restores the index register. If it does
26 * not, it locks normally.
27 *
28 * Note that since we are working with NMIs, we need this lock even in
29 * a non-SMP machine just to mark that the lock is owned.
30 *
31 * This only works with compare-and-swap. There is no other way to
32 * atomically claim the lock and set the owner.
33 */
34#include <linux/smp.h>
35extern volatile unsigned long cmos_lock;
36
37/*
38 * All of these below must be called with interrupts off, preempt
39 * disabled, etc.
40 */
41
42static inline void lock_cmos(unsigned char reg)
43{
44 unsigned long new;
45 new = ((smp_processor_id() + 1) << 8) | reg;
46 for (;;) {
47 if (cmos_lock) {
48 cpu_relax();
49 continue;
50 }
51 if (__cmpxchg(&cmos_lock, 0, new, sizeof(cmos_lock)) == 0)
52 return;
53 }
54}
55
56static inline void unlock_cmos(void)
57{
58 cmos_lock = 0;
59}
60
61static inline int do_i_have_lock_cmos(void)
62{
63 return (cmos_lock >> 8) == (smp_processor_id() + 1);
64}
65
66static inline unsigned char current_lock_cmos_reg(void)
67{
68 return cmos_lock & 0xff;
69}
70
71#define lock_cmos_prefix(reg) \
72 do { \
73 unsigned long cmos_flags; \
74 local_irq_save(cmos_flags); \
75 lock_cmos(reg)
76
77#define lock_cmos_suffix(reg) \
78 unlock_cmos(); \
79 local_irq_restore(cmos_flags); \
80 } while (0)
81#else
82#define lock_cmos_prefix(reg) do {} while (0)
83#define lock_cmos_suffix(reg) do {} while (0)
84#define lock_cmos(reg)
85#define unlock_cmos()
86#define do_i_have_lock_cmos() 0
87#define current_lock_cmos_reg() 0
88#endif
89
90/*
91 * The yet supported machines all access the RTC index register via
92 * an ISA port access but the way to access the date register differs ...
93 */
94#define CMOS_READ(addr) rtc_cmos_read(addr)
95#define CMOS_WRITE(val, addr) rtc_cmos_write(val, addr)
96unsigned char rtc_cmos_read(unsigned char addr);
97void rtc_cmos_write(unsigned char val, unsigned char addr);
98
99extern int mach_set_rtc_mmss(unsigned long nowtime);
100extern unsigned long mach_get_cmos_time(void);
101
102#define RTC_IRQ 8
103
104#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-x86/mca.h b/include/asm-x86/mca.h
deleted file mode 100644
index 09adf2eac4dc..000000000000
--- a/include/asm-x86/mca.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* Platform specific MCA defines */
4#ifndef _ASM_MCA_H
5#define _ASM_MCA_H
6
7/* Maximal number of MCA slots - actually, some machines have less, but
8 * they all have sufficient number of POS registers to cover 8.
9 */
10#define MCA_MAX_SLOT_NR 8
11
12/* Most machines have only one MCA bus. The only multiple bus machines
13 * I know have at most two */
14#define MAX_MCA_BUSSES 2
15
16#define MCA_PRIMARY_BUS 0
17#define MCA_SECONDARY_BUS 1
18
19/* Dummy slot numbers on primary MCA for integrated functions */
20#define MCA_INTEGSCSI (MCA_MAX_SLOT_NR)
21#define MCA_INTEGVIDEO (MCA_MAX_SLOT_NR+1)
22#define MCA_MOTHERBOARD (MCA_MAX_SLOT_NR+2)
23
24/* Dummy POS values for integrated functions */
25#define MCA_DUMMY_POS_START 0x10000
26#define MCA_INTEGSCSI_POS (MCA_DUMMY_POS_START+1)
27#define MCA_INTEGVIDEO_POS (MCA_DUMMY_POS_START+2)
28#define MCA_MOTHERBOARD_POS (MCA_DUMMY_POS_START+3)
29
30/* MCA registers */
31
32#define MCA_MOTHERBOARD_SETUP_REG 0x94
33#define MCA_ADAPTER_SETUP_REG 0x96
34#define MCA_POS_REG(n) (0x100+(n))
35
36#define MCA_ENABLED 0x01 /* POS 2, set if adapter enabled */
37
38/* Max number of adapters, including both slots and various integrated
39 * things.
40 */
41#define MCA_NUMADAPTERS (MCA_MAX_SLOT_NR+3)
42
43#endif
diff --git a/include/asm-x86/mca_dma.h b/include/asm-x86/mca_dma.h
deleted file mode 100644
index c3dca6edc6b1..000000000000
--- a/include/asm-x86/mca_dma.h
+++ /dev/null
@@ -1,201 +0,0 @@
1#ifndef MCA_DMA_H
2#define MCA_DMA_H
3
4#include <asm/io.h>
5#include <linux/ioport.h>
6
7/*
8 * Microchannel specific DMA stuff. DMA on an MCA machine is fairly similar to
9 * standard PC dma, but it certainly has its quirks. DMA register addresses
10 * are in a different place and there are some added functions. Most of this
11 * should be pretty obvious on inspection. Note that the user must divide
12 * count by 2 when using 16-bit dma; that is not handled by these functions.
13 *
14 * Ramen Noodles are yummy.
15 *
16 * 1998 Tymm Twillman <tymm@computer.org>
17 */
18
19/*
20 * Registers that are used by the DMA controller; FN is the function register
21 * (tell the controller what to do) and EXE is the execution register (how
22 * to do it)
23 */
24
25#define MCA_DMA_REG_FN 0x18
26#define MCA_DMA_REG_EXE 0x1A
27
28/*
29 * Functions that the DMA controller can do
30 */
31
32#define MCA_DMA_FN_SET_IO 0x00
33#define MCA_DMA_FN_SET_ADDR 0x20
34#define MCA_DMA_FN_GET_ADDR 0x30
35#define MCA_DMA_FN_SET_COUNT 0x40
36#define MCA_DMA_FN_GET_COUNT 0x50
37#define MCA_DMA_FN_GET_STATUS 0x60
38#define MCA_DMA_FN_SET_MODE 0x70
39#define MCA_DMA_FN_SET_ARBUS 0x80
40#define MCA_DMA_FN_MASK 0x90
41#define MCA_DMA_FN_RESET_MASK 0xA0
42#define MCA_DMA_FN_MASTER_CLEAR 0xD0
43
44/*
45 * Modes (used by setting MCA_DMA_FN_MODE in the function register)
46 *
47 * Note that the MODE_READ is read from memory (write to device), and
48 * MODE_WRITE is vice-versa.
49 */
50
51#define MCA_DMA_MODE_XFER 0x04 /* read by default */
52#define MCA_DMA_MODE_READ 0x04 /* same as XFER */
53#define MCA_DMA_MODE_WRITE 0x08 /* OR with MODE_XFER to use */
54#define MCA_DMA_MODE_IO 0x01 /* DMA from IO register */
55#define MCA_DMA_MODE_16 0x40 /* 16 bit xfers */
56
57
58/**
59 * mca_enable_dma - channel to enable DMA on
60 * @dmanr: DMA channel
61 *
62 * Enable the MCA bus DMA on a channel. This can be called from
63 * IRQ context.
64 */
65
66static inline void mca_enable_dma(unsigned int dmanr)
67{
68 outb(MCA_DMA_FN_RESET_MASK | dmanr, MCA_DMA_REG_FN);
69}
70
71/**
72 * mca_disble_dma - channel to disable DMA on
73 * @dmanr: DMA channel
74 *
75 * Enable the MCA bus DMA on a channel. This can be called from
76 * IRQ context.
77 */
78
79static inline void mca_disable_dma(unsigned int dmanr)
80{
81 outb(MCA_DMA_FN_MASK | dmanr, MCA_DMA_REG_FN);
82}
83
84/**
85 * mca_set_dma_addr - load a 24bit DMA address
86 * @dmanr: DMA channel
87 * @a: 24bit bus address
88 *
89 * Load the address register in the DMA controller. This has a 24bit
90 * limitation (16Mb).
91 */
92
93static inline void mca_set_dma_addr(unsigned int dmanr, unsigned int a)
94{
95 outb(MCA_DMA_FN_SET_ADDR | dmanr, MCA_DMA_REG_FN);
96 outb(a & 0xff, MCA_DMA_REG_EXE);
97 outb((a >> 8) & 0xff, MCA_DMA_REG_EXE);
98 outb((a >> 16) & 0xff, MCA_DMA_REG_EXE);
99}
100
101/**
102 * mca_get_dma_addr - load a 24bit DMA address
103 * @dmanr: DMA channel
104 *
105 * Read the address register in the DMA controller. This has a 24bit
106 * limitation (16Mb). The return is a bus address.
107 */
108
109static inline unsigned int mca_get_dma_addr(unsigned int dmanr)
110{
111 unsigned int addr;
112
113 outb(MCA_DMA_FN_GET_ADDR | dmanr, MCA_DMA_REG_FN);
114 addr = inb(MCA_DMA_REG_EXE);
115 addr |= inb(MCA_DMA_REG_EXE) << 8;
116 addr |= inb(MCA_DMA_REG_EXE) << 16;
117
118 return addr;
119}
120
121/**
122 * mca_set_dma_count - load a 16bit transfer count
123 * @dmanr: DMA channel
124 * @count: count
125 *
126 * Set the DMA count for this channel. This can be up to 64Kbytes.
127 * Setting a count of zero will not do what you expect.
128 */
129
130static inline void mca_set_dma_count(unsigned int dmanr, unsigned int count)
131{
132 count--; /* transfers one more than count -- correct for this */
133
134 outb(MCA_DMA_FN_SET_COUNT | dmanr, MCA_DMA_REG_FN);
135 outb(count & 0xff, MCA_DMA_REG_EXE);
136 outb((count >> 8) & 0xff, MCA_DMA_REG_EXE);
137}
138
139/**
140 * mca_get_dma_residue - get the remaining bytes to transfer
141 * @dmanr: DMA channel
142 *
143 * This function returns the number of bytes left to transfer
144 * on this DMA channel.
145 */
146
147static inline unsigned int mca_get_dma_residue(unsigned int dmanr)
148{
149 unsigned short count;
150
151 outb(MCA_DMA_FN_GET_COUNT | dmanr, MCA_DMA_REG_FN);
152 count = 1 + inb(MCA_DMA_REG_EXE);
153 count += inb(MCA_DMA_REG_EXE) << 8;
154
155 return count;
156}
157
158/**
159 * mca_set_dma_io - set the port for an I/O transfer
160 * @dmanr: DMA channel
161 * @io_addr: an I/O port number
162 *
163 * Unlike the ISA bus DMA controllers the DMA on MCA bus can transfer
164 * with an I/O port target.
165 */
166
167static inline void mca_set_dma_io(unsigned int dmanr, unsigned int io_addr)
168{
169 /*
170 * DMA from a port address -- set the io address
171 */
172
173 outb(MCA_DMA_FN_SET_IO | dmanr, MCA_DMA_REG_FN);
174 outb(io_addr & 0xff, MCA_DMA_REG_EXE);
175 outb((io_addr >> 8) & 0xff, MCA_DMA_REG_EXE);
176}
177
178/**
179 * mca_set_dma_mode - set the DMA mode
180 * @dmanr: DMA channel
181 * @mode: mode to set
182 *
183 * The DMA controller supports several modes. The mode values you can
184 * set are-
185 *
186 * %MCA_DMA_MODE_READ when reading from the DMA device.
187 *
188 * %MCA_DMA_MODE_WRITE to writing to the DMA device.
189 *
190 * %MCA_DMA_MODE_IO to do DMA to or from an I/O port.
191 *
192 * %MCA_DMA_MODE_16 to do 16bit transfers.
193 */
194
195static inline void mca_set_dma_mode(unsigned int dmanr, unsigned int mode)
196{
197 outb(MCA_DMA_FN_SET_MODE | dmanr, MCA_DMA_REG_FN);
198 outb(mode, MCA_DMA_REG_EXE);
199}
200
201#endif /* MCA_DMA_H */
diff --git a/include/asm-x86/mce.h b/include/asm-x86/mce.h
deleted file mode 100644
index 531eaa587455..000000000000
--- a/include/asm-x86/mce.h
+++ /dev/null
@@ -1,130 +0,0 @@
1#ifndef _ASM_X86_MCE_H
2#define _ASM_X86_MCE_H
3
4#ifdef __x86_64__
5
6#include <asm/ioctls.h>
7#include <asm/types.h>
8
9/*
10 * Machine Check support for x86
11 */
12
13#define MCG_CTL_P (1UL<<8) /* MCG_CAP register available */
14
15#define MCG_STATUS_RIPV (1UL<<0) /* restart ip valid */
16#define MCG_STATUS_EIPV (1UL<<1) /* ip points to correct instruction */
17#define MCG_STATUS_MCIP (1UL<<2) /* machine check in progress */
18
19#define MCI_STATUS_VAL (1UL<<63) /* valid error */
20#define MCI_STATUS_OVER (1UL<<62) /* previous errors lost */
21#define MCI_STATUS_UC (1UL<<61) /* uncorrected error */
22#define MCI_STATUS_EN (1UL<<60) /* error enabled */
23#define MCI_STATUS_MISCV (1UL<<59) /* misc error reg. valid */
24#define MCI_STATUS_ADDRV (1UL<<58) /* addr reg. valid */
25#define MCI_STATUS_PCC (1UL<<57) /* processor context corrupt */
26
27/* Fields are zero when not available */
28struct mce {
29 __u64 status;
30 __u64 misc;
31 __u64 addr;
32 __u64 mcgstatus;
33 __u64 ip;
34 __u64 tsc; /* cpu time stamp counter */
35 __u64 res1; /* for future extension */
36 __u64 res2; /* dito. */
37 __u8 cs; /* code segment */
38 __u8 bank; /* machine check bank */
39 __u8 cpu; /* cpu that raised the error */
40 __u8 finished; /* entry is valid */
41 __u32 pad;
42};
43
44/*
45 * This structure contains all data related to the MCE log. Also
46 * carries a signature to make it easier to find from external
47 * debugging tools. Each entry is only valid when its finished flag
48 * is set.
49 */
50
51#define MCE_LOG_LEN 32
52
53struct mce_log {
54 char signature[12]; /* "MACHINECHECK" */
55 unsigned len; /* = MCE_LOG_LEN */
56 unsigned next;
57 unsigned flags;
58 unsigned pad0;
59 struct mce entry[MCE_LOG_LEN];
60};
61
62#define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */
63
64#define MCE_LOG_SIGNATURE "MACHINECHECK"
65
66#define MCE_GET_RECORD_LEN _IOR('M', 1, int)
67#define MCE_GET_LOG_LEN _IOR('M', 2, int)
68#define MCE_GETCLEAR_FLAGS _IOR('M', 3, int)
69
70/* Software defined banks */
71#define MCE_EXTENDED_BANK 128
72#define MCE_THERMAL_BANK MCE_EXTENDED_BANK + 0
73
74#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) /* MCE_AMD */
75#define K8_MCE_THRESHOLD_BANK_0 (MCE_THRESHOLD_BASE + 0 * 9)
76#define K8_MCE_THRESHOLD_BANK_1 (MCE_THRESHOLD_BASE + 1 * 9)
77#define K8_MCE_THRESHOLD_BANK_2 (MCE_THRESHOLD_BASE + 2 * 9)
78#define K8_MCE_THRESHOLD_BANK_3 (MCE_THRESHOLD_BASE + 3 * 9)
79#define K8_MCE_THRESHOLD_BANK_4 (MCE_THRESHOLD_BASE + 4 * 9)
80#define K8_MCE_THRESHOLD_BANK_5 (MCE_THRESHOLD_BASE + 5 * 9)
81#define K8_MCE_THRESHOLD_DRAM_ECC (MCE_THRESHOLD_BANK_4 + 0)
82
83#endif /* __x86_64__ */
84
85#ifdef __KERNEL__
86
87#ifdef CONFIG_X86_32
88extern int mce_disabled;
89#else /* CONFIG_X86_32 */
90
91#include <asm/atomic.h>
92
93void mce_log(struct mce *m);
94DECLARE_PER_CPU(struct sys_device, device_mce);
95extern void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
96
97#ifdef CONFIG_X86_MCE_INTEL
98void mce_intel_feature_init(struct cpuinfo_x86 *c);
99#else
100static inline void mce_intel_feature_init(struct cpuinfo_x86 *c) { }
101#endif
102
103#ifdef CONFIG_X86_MCE_AMD
104void mce_amd_feature_init(struct cpuinfo_x86 *c);
105#else
106static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { }
107#endif
108
109void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
110
111extern atomic_t mce_entry;
112
113extern void do_machine_check(struct pt_regs *, long);
114extern int mce_notify_user(void);
115
116#endif /* !CONFIG_X86_32 */
117
118
119
120#ifdef CONFIG_X86_MCE
121extern void mcheck_init(struct cpuinfo_x86 *c);
122#else
123#define mcheck_init(c) do { } while (0)
124#endif
125extern void stop_mce(void);
126extern void restart_mce(void);
127
128#endif /* __KERNEL__ */
129
130#endif
diff --git a/include/asm-x86/mman.h b/include/asm-x86/mman.h
deleted file mode 100644
index 90bc4108a4fd..000000000000
--- a/include/asm-x86/mman.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_X86_MMAN_H
2#define _ASM_X86_MMAN_H
3
4#include <asm-generic/mman.h>
5
6#define MAP_32BIT 0x40 /* only give out 32bit addresses */
7
8#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
9#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
10#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
11#define MAP_LOCKED 0x2000 /* pages are locked */
12#define MAP_NORESERVE 0x4000 /* don't check for reservations */
13#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
14#define MAP_NONBLOCK 0x10000 /* do not block on IO */
15#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
16
17#define MCL_CURRENT 1 /* lock all current mappings */
18#define MCL_FUTURE 2 /* lock all future mappings */
19
20#endif /* _ASM_X86_MMAN_H */
diff --git a/include/asm-x86/mmconfig.h b/include/asm-x86/mmconfig.h
deleted file mode 100644
index e293ab81e850..000000000000
--- a/include/asm-x86/mmconfig.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_MMCONFIG_H
2#define _ASM_MMCONFIG_H
3
4#ifdef CONFIG_PCI_MMCONFIG
5extern void __cpuinit fam10h_check_enable_mmcfg(void);
6extern void __cpuinit check_enable_amd_mmconf_dmi(void);
7#else
8static inline void fam10h_check_enable_mmcfg(void) { }
9static inline void check_enable_amd_mmconf_dmi(void) { }
10#endif
11
12#endif
diff --git a/include/asm-x86/mmu.h b/include/asm-x86/mmu.h
deleted file mode 100644
index 00e88679e11f..000000000000
--- a/include/asm-x86/mmu.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_X86_MMU_H
2#define _ASM_X86_MMU_H
3
4#include <linux/spinlock.h>
5#include <linux/mutex.h>
6
7/*
8 * The x86 doesn't have a mmu context, but
9 * we put the segment information here.
10 *
11 * cpu_vm_mask is used to optimize ldt flushing.
12 */
13typedef struct {
14 void *ldt;
15#ifdef CONFIG_X86_64
16 rwlock_t ldtlock;
17#endif
18 int size;
19 struct mutex lock;
20 void *vdso;
21} mm_context_t;
22
23#ifdef CONFIG_SMP
24void leave_mm(int cpu);
25#else
26static inline void leave_mm(int cpu)
27{
28}
29#endif
30
31#endif /* _ASM_X86_MMU_H */
diff --git a/include/asm-x86/mmu_context.h b/include/asm-x86/mmu_context.h
deleted file mode 100644
index fac57014e7c6..000000000000
--- a/include/asm-x86/mmu_context.h
+++ /dev/null
@@ -1,37 +0,0 @@
1#ifndef __ASM_X86_MMU_CONTEXT_H
2#define __ASM_X86_MMU_CONTEXT_H
3
4#include <asm/desc.h>
5#include <asm/atomic.h>
6#include <asm/pgalloc.h>
7#include <asm/tlbflush.h>
8#include <asm/paravirt.h>
9#ifndef CONFIG_PARAVIRT
10#include <asm-generic/mm_hooks.h>
11
12static inline void paravirt_activate_mm(struct mm_struct *prev,
13 struct mm_struct *next)
14{
15}
16#endif /* !CONFIG_PARAVIRT */
17
18/*
19 * Used for LDT copy/destruction.
20 */
21int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
22void destroy_context(struct mm_struct *mm);
23
24#ifdef CONFIG_X86_32
25# include "mmu_context_32.h"
26#else
27# include "mmu_context_64.h"
28#endif
29
30#define activate_mm(prev, next) \
31do { \
32 paravirt_activate_mm((prev), (next)); \
33 switch_mm((prev), (next), NULL); \
34} while (0);
35
36
37#endif /* __ASM_X86_MMU_CONTEXT_H */
diff --git a/include/asm-x86/mmu_context_32.h b/include/asm-x86/mmu_context_32.h
deleted file mode 100644
index 824fc575c6d8..000000000000
--- a/include/asm-x86/mmu_context_32.h
+++ /dev/null
@@ -1,56 +0,0 @@
1#ifndef __I386_SCHED_H
2#define __I386_SCHED_H
3
4static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
5{
6#ifdef CONFIG_SMP
7 unsigned cpu = smp_processor_id();
8 if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
9 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
10#endif
11}
12
13static inline void switch_mm(struct mm_struct *prev,
14 struct mm_struct *next,
15 struct task_struct *tsk)
16{
17 int cpu = smp_processor_id();
18
19 if (likely(prev != next)) {
20 /* stop flush ipis for the previous mm */
21 cpu_clear(cpu, prev->cpu_vm_mask);
22#ifdef CONFIG_SMP
23 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
24 per_cpu(cpu_tlbstate, cpu).active_mm = next;
25#endif
26 cpu_set(cpu, next->cpu_vm_mask);
27
28 /* Re-load page tables */
29 load_cr3(next->pgd);
30
31 /*
32 * load the LDT, if the LDT is different:
33 */
34 if (unlikely(prev->context.ldt != next->context.ldt))
35 load_LDT_nolock(&next->context);
36 }
37#ifdef CONFIG_SMP
38 else {
39 per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
40 BUG_ON(per_cpu(cpu_tlbstate, cpu).active_mm != next);
41
42 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
43 /* We were in lazy tlb mode and leave_mm disabled
44 * tlb flush IPI delivery. We must reload %cr3.
45 */
46 load_cr3(next->pgd);
47 load_LDT_nolock(&next->context);
48 }
49 }
50#endif
51}
52
53#define deactivate_mm(tsk, mm) \
54 asm("movl %0,%%gs": :"r" (0));
55
56#endif
diff --git a/include/asm-x86/mmu_context_64.h b/include/asm-x86/mmu_context_64.h
deleted file mode 100644
index c7000634ccae..000000000000
--- a/include/asm-x86/mmu_context_64.h
+++ /dev/null
@@ -1,54 +0,0 @@
1#ifndef __X86_64_MMU_CONTEXT_H
2#define __X86_64_MMU_CONTEXT_H
3
4#include <asm/pda.h>
5
6static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
7{
8#ifdef CONFIG_SMP
9 if (read_pda(mmu_state) == TLBSTATE_OK)
10 write_pda(mmu_state, TLBSTATE_LAZY);
11#endif
12}
13
14static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
15 struct task_struct *tsk)
16{
17 unsigned cpu = smp_processor_id();
18 if (likely(prev != next)) {
19 /* stop flush ipis for the previous mm */
20 cpu_clear(cpu, prev->cpu_vm_mask);
21#ifdef CONFIG_SMP
22 write_pda(mmu_state, TLBSTATE_OK);
23 write_pda(active_mm, next);
24#endif
25 cpu_set(cpu, next->cpu_vm_mask);
26 load_cr3(next->pgd);
27
28 if (unlikely(next->context.ldt != prev->context.ldt))
29 load_LDT_nolock(&next->context);
30 }
31#ifdef CONFIG_SMP
32 else {
33 write_pda(mmu_state, TLBSTATE_OK);
34 if (read_pda(active_mm) != next)
35 BUG();
36 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
37 /* We were in lazy tlb mode and leave_mm disabled
38 * tlb flush IPI delivery. We must reload CR3
39 * to make sure to use no freed page tables.
40 */
41 load_cr3(next->pgd);
42 load_LDT_nolock(&next->context);
43 }
44 }
45#endif
46}
47
48#define deactivate_mm(tsk, mm) \
49do { \
50 load_gs_index(0); \
51 asm volatile("movl %0,%%fs"::"r"(0)); \
52} while (0)
53
54#endif
diff --git a/include/asm-x86/mmx.h b/include/asm-x86/mmx.h
deleted file mode 100644
index 940881218ff8..000000000000
--- a/include/asm-x86/mmx.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_MMX_H
2#define _ASM_MMX_H
3
4/*
5 * MMX 3Dnow! helper operations
6 */
7
8#include <linux/types.h>
9
10extern void *_mmx_memcpy(void *to, const void *from, size_t size);
11extern void mmx_clear_page(void *page);
12extern void mmx_copy_page(void *to, void *from);
13
14#endif
diff --git a/include/asm-x86/mmzone.h b/include/asm-x86/mmzone.h
deleted file mode 100644
index 64217ea16a36..000000000000
--- a/include/asm-x86/mmzone.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "mmzone_32.h"
3#else
4# include "mmzone_64.h"
5#endif
diff --git a/include/asm-x86/mmzone_32.h b/include/asm-x86/mmzone_32.h
deleted file mode 100644
index 5862e6460658..000000000000
--- a/include/asm-x86/mmzone_32.h
+++ /dev/null
@@ -1,134 +0,0 @@
1/*
2 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
3 *
4 */
5
6#ifndef _ASM_MMZONE_H_
7#define _ASM_MMZONE_H_
8
9#include <asm/smp.h>
10
11#ifdef CONFIG_NUMA
12extern struct pglist_data *node_data[];
13#define NODE_DATA(nid) (node_data[nid])
14
15#include <asm/numaq.h>
16/* summit or generic arch */
17#include <asm/srat.h>
18
19extern int get_memcfg_numa_flat(void);
20/*
21 * This allows any one NUMA architecture to be compiled
22 * for, and still fall back to the flat function if it
23 * fails.
24 */
25static inline void get_memcfg_numa(void)
26{
27
28 if (get_memcfg_numaq())
29 return;
30 if (get_memcfg_from_srat())
31 return;
32 get_memcfg_numa_flat();
33}
34
35extern int early_pfn_to_nid(unsigned long pfn);
36
37#else /* !CONFIG_NUMA */
38
39#define get_memcfg_numa get_memcfg_numa_flat
40
41#endif /* CONFIG_NUMA */
42
43#ifdef CONFIG_DISCONTIGMEM
44
45/*
46 * generic node memory support, the following assumptions apply:
47 *
48 * 1) memory comes in 64Mb contigious chunks which are either present or not
49 * 2) we will not have more than 64Gb in total
50 *
51 * for now assume that 64Gb is max amount of RAM for whole system
52 * 64Gb / 4096bytes/page = 16777216 pages
53 */
54#define MAX_NR_PAGES 16777216
55#define MAX_ELEMENTS 1024
56#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
57
58extern s8 physnode_map[];
59
60static inline int pfn_to_nid(unsigned long pfn)
61{
62#ifdef CONFIG_NUMA
63 return((int) physnode_map[(pfn) / PAGES_PER_ELEMENT]);
64#else
65 return 0;
66#endif
67}
68
69/*
70 * Following are macros that each numa implmentation must define.
71 */
72
73#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
74#define node_end_pfn(nid) \
75({ \
76 pg_data_t *__pgdat = NODE_DATA(nid); \
77 __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \
78})
79
80static inline int pfn_valid(int pfn)
81{
82 int nid = pfn_to_nid(pfn);
83
84 if (nid >= 0)
85 return (pfn < node_end_pfn(nid));
86 return 0;
87}
88
89#endif /* CONFIG_DISCONTIGMEM */
90
91#ifdef CONFIG_NEED_MULTIPLE_NODES
92
93/*
94 * Following are macros that are specific to this numa platform.
95 */
96#define reserve_bootmem(addr, size, flags) \
97 reserve_bootmem_node(NODE_DATA(0), (addr), (size), (flags))
98#define alloc_bootmem(x) \
99 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
100#define alloc_bootmem_nopanic(x) \
101 __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
102 __pa(MAX_DMA_ADDRESS))
103#define alloc_bootmem_low(x) \
104 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, 0)
105#define alloc_bootmem_pages(x) \
106 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
107#define alloc_bootmem_pages_nopanic(x) \
108 __alloc_bootmem_node_nopanic(NODE_DATA(0), (x), PAGE_SIZE, \
109 __pa(MAX_DMA_ADDRESS))
110#define alloc_bootmem_low_pages(x) \
111 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0)
112#define alloc_bootmem_node(pgdat, x) \
113({ \
114 struct pglist_data __maybe_unused \
115 *__alloc_bootmem_node__pgdat = (pgdat); \
116 __alloc_bootmem_node(NODE_DATA(0), (x), SMP_CACHE_BYTES, \
117 __pa(MAX_DMA_ADDRESS)); \
118})
119#define alloc_bootmem_pages_node(pgdat, x) \
120({ \
121 struct pglist_data __maybe_unused \
122 *__alloc_bootmem_node__pgdat = (pgdat); \
123 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, \
124 __pa(MAX_DMA_ADDRESS)); \
125})
126#define alloc_bootmem_low_pages_node(pgdat, x) \
127({ \
128 struct pglist_data __maybe_unused \
129 *__alloc_bootmem_node__pgdat = (pgdat); \
130 __alloc_bootmem_node(NODE_DATA(0), (x), PAGE_SIZE, 0); \
131})
132#endif /* CONFIG_NEED_MULTIPLE_NODES */
133
134#endif /* _ASM_MMZONE_H_ */
diff --git a/include/asm-x86/mmzone_64.h b/include/asm-x86/mmzone_64.h
deleted file mode 100644
index 594bd0dc1d08..000000000000
--- a/include/asm-x86/mmzone_64.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/* K8 NUMA support */
2/* Copyright 2002,2003 by Andi Kleen, SuSE Labs */
3/* 2.5 Version loosely based on the NUMAQ Code by Pat Gaughen. */
4#ifndef _ASM_X86_64_MMZONE_H
5#define _ASM_X86_64_MMZONE_H 1
6
7
8#ifdef CONFIG_NUMA
9
10#define VIRTUAL_BUG_ON(x)
11
12#include <asm/smp.h>
13
14/* Simple perfect hash to map physical addresses to node numbers */
15struct memnode {
16 int shift;
17 unsigned int mapsize;
18 s16 *map;
19 s16 embedded_map[64 - 8];
20} ____cacheline_aligned; /* total size = 128 bytes */
21extern struct memnode memnode;
22#define memnode_shift memnode.shift
23#define memnodemap memnode.map
24#define memnodemapsize memnode.mapsize
25
26extern struct pglist_data *node_data[];
27
28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
29{
30 unsigned nid;
31 VIRTUAL_BUG_ON(!memnodemap);
32 VIRTUAL_BUG_ON((addr >> memnode_shift) >= memnodemapsize);
33 nid = memnodemap[addr >> memnode_shift];
34 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
35 return nid;
36}
37
38#define NODE_DATA(nid) (node_data[nid])
39
40#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
41#define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \
42 NODE_DATA(nid)->node_spanned_pages)
43
44extern int early_pfn_to_nid(unsigned long pfn);
45
46#ifdef CONFIG_NUMA_EMU
47#define FAKE_NODE_MIN_SIZE (64 * 1024 * 1024)
48#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
49#endif
50
51#endif
52#endif
diff --git a/include/asm-x86/module.h b/include/asm-x86/module.h
deleted file mode 100644
index bfedb247871c..000000000000
--- a/include/asm-x86/module.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef _ASM_MODULE_H
2#define _ASM_MODULE_H
3
4/* x86_32/64 are simple */
5struct mod_arch_specific {};
6
7#ifdef CONFIG_X86_32
8# define Elf_Shdr Elf32_Shdr
9# define Elf_Sym Elf32_Sym
10# define Elf_Ehdr Elf32_Ehdr
11#else
12# define Elf_Shdr Elf64_Shdr
13# define Elf_Sym Elf64_Sym
14# define Elf_Ehdr Elf64_Ehdr
15#endif
16
17#ifdef CONFIG_X86_64
18/* X86_64 does not define MODULE_PROC_FAMILY */
19#elif defined CONFIG_M386
20#define MODULE_PROC_FAMILY "386 "
21#elif defined CONFIG_M486
22#define MODULE_PROC_FAMILY "486 "
23#elif defined CONFIG_M586
24#define MODULE_PROC_FAMILY "586 "
25#elif defined CONFIG_M586TSC
26#define MODULE_PROC_FAMILY "586TSC "
27#elif defined CONFIG_M586MMX
28#define MODULE_PROC_FAMILY "586MMX "
29#elif defined CONFIG_MCORE2
30#define MODULE_PROC_FAMILY "CORE2 "
31#elif defined CONFIG_M686
32#define MODULE_PROC_FAMILY "686 "
33#elif defined CONFIG_MPENTIUMII
34#define MODULE_PROC_FAMILY "PENTIUMII "
35#elif defined CONFIG_MPENTIUMIII
36#define MODULE_PROC_FAMILY "PENTIUMIII "
37#elif defined CONFIG_MPENTIUMM
38#define MODULE_PROC_FAMILY "PENTIUMM "
39#elif defined CONFIG_MPENTIUM4
40#define MODULE_PROC_FAMILY "PENTIUM4 "
41#elif defined CONFIG_MK6
42#define MODULE_PROC_FAMILY "K6 "
43#elif defined CONFIG_MK7
44#define MODULE_PROC_FAMILY "K7 "
45#elif defined CONFIG_MK8
46#define MODULE_PROC_FAMILY "K8 "
47#elif defined CONFIG_X86_ELAN
48#define MODULE_PROC_FAMILY "ELAN "
49#elif defined CONFIG_MCRUSOE
50#define MODULE_PROC_FAMILY "CRUSOE "
51#elif defined CONFIG_MEFFICEON
52#define MODULE_PROC_FAMILY "EFFICEON "
53#elif defined CONFIG_MWINCHIPC6
54#define MODULE_PROC_FAMILY "WINCHIPC6 "
55#elif defined CONFIG_MWINCHIP2
56#define MODULE_PROC_FAMILY "WINCHIP2 "
57#elif defined CONFIG_MWINCHIP3D
58#define MODULE_PROC_FAMILY "WINCHIP3D "
59#elif defined CONFIG_MCYRIXIII
60#define MODULE_PROC_FAMILY "CYRIXIII "
61#elif defined CONFIG_MVIAC3_2
62#define MODULE_PROC_FAMILY "VIAC3-2 "
63#elif defined CONFIG_MVIAC7
64#define MODULE_PROC_FAMILY "VIAC7 "
65#elif defined CONFIG_MGEODEGX1
66#define MODULE_PROC_FAMILY "GEODEGX1 "
67#elif defined CONFIG_MGEODE_LX
68#define MODULE_PROC_FAMILY "GEODE "
69#else
70#error unknown processor family
71#endif
72
73#ifdef CONFIG_X86_32
74# ifdef CONFIG_4KSTACKS
75# define MODULE_STACKSIZE "4KSTACKS "
76# else
77# define MODULE_STACKSIZE ""
78# endif
79# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE
80#endif
81
82#endif /* _ASM_MODULE_H */
diff --git a/include/asm-x86/mpspec.h b/include/asm-x86/mpspec.h
deleted file mode 100644
index b6995e567fcc..000000000000
--- a/include/asm-x86/mpspec.h
+++ /dev/null
@@ -1,144 +0,0 @@
1#ifndef _AM_X86_MPSPEC_H
2#define _AM_X86_MPSPEC_H
3
4#include <linux/init.h>
5
6#include <asm/mpspec_def.h>
7
8#ifdef CONFIG_X86_32
9#include <mach_mpspec.h>
10
11extern unsigned int def_to_bigsmp;
12extern int apic_version[MAX_APICS];
13extern u8 apicid_2_node[];
14extern int pic_mode;
15
16#ifdef CONFIG_X86_NUMAQ
17extern int mp_bus_id_to_node[MAX_MP_BUSSES];
18extern int mp_bus_id_to_local[MAX_MP_BUSSES];
19extern int quad_local_to_mp_bus_id [NR_CPUS/4][4];
20#endif
21
22#define MAX_APICID 256
23
24#else
25
26#define MAX_MP_BUSSES 256
27/* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
28#define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
29
30#endif
31
32extern void early_find_smp_config(void);
33extern void early_get_smp_config(void);
34
35#if defined(CONFIG_MCA) || defined(CONFIG_EISA)
36extern int mp_bus_id_to_type[MAX_MP_BUSSES];
37#endif
38
39extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
40
41extern unsigned int boot_cpu_physical_apicid;
42extern unsigned int max_physical_apicid;
43extern int smp_found_config;
44extern int mpc_default_type;
45extern unsigned long mp_lapic_addr;
46
47extern void find_smp_config(void);
48extern void get_smp_config(void);
49#ifdef CONFIG_X86_MPPARSE
50extern void early_reserve_e820_mpc_new(void);
51#else
52static inline void early_reserve_e820_mpc_new(void) { }
53#endif
54
55void __cpuinit generic_processor_info(int apicid, int version);
56#ifdef CONFIG_ACPI
57extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
58extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
59 u32 gsi);
60extern void mp_config_acpi_legacy_irqs(void);
61extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
62#ifdef CONFIG_X86_IO_APIC
63extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
64 u32 gsi, int triggering, int polarity);
65#else
66static inline int
67mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
68 u32 gsi, int triggering, int polarity)
69{
70 return 0;
71}
72#endif
73#endif /* CONFIG_ACPI */
74
75#define PHYSID_ARRAY_SIZE BITS_TO_LONGS(MAX_APICS)
76
77struct physid_mask {
78 unsigned long mask[PHYSID_ARRAY_SIZE];
79};
80
81typedef struct physid_mask physid_mask_t;
82
83#define physid_set(physid, map) set_bit(physid, (map).mask)
84#define physid_clear(physid, map) clear_bit(physid, (map).mask)
85#define physid_isset(physid, map) test_bit(physid, (map).mask)
86#define physid_test_and_set(physid, map) \
87 test_and_set_bit(physid, (map).mask)
88
89#define physids_and(dst, src1, src2) \
90 bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
91
92#define physids_or(dst, src1, src2) \
93 bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
94
95#define physids_clear(map) \
96 bitmap_zero((map).mask, MAX_APICS)
97
98#define physids_complement(dst, src) \
99 bitmap_complement((dst).mask, (src).mask, MAX_APICS)
100
101#define physids_empty(map) \
102 bitmap_empty((map).mask, MAX_APICS)
103
104#define physids_equal(map1, map2) \
105 bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
106
107#define physids_weight(map) \
108 bitmap_weight((map).mask, MAX_APICS)
109
110#define physids_shift_right(d, s, n) \
111 bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS)
112
113#define physids_shift_left(d, s, n) \
114 bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS)
115
116#define physids_coerce(map) ((map).mask[0])
117
118#define physids_promote(physids) \
119 ({ \
120 physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
121 __physid_mask.mask[0] = physids; \
122 __physid_mask; \
123 })
124
125/* Note: will create very large stack frames if physid_mask_t is big */
126#define physid_mask_of_physid(physid) \
127 ({ \
128 physid_mask_t __physid_mask = PHYSID_MASK_NONE; \
129 physid_set(physid, __physid_mask); \
130 __physid_mask; \
131 })
132
133static inline void physid_set_mask_of_physid(int physid, physid_mask_t *map)
134{
135 physids_clear(*map);
136 physid_set(physid, *map);
137}
138
139#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
140#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
141
142extern physid_mask_t phys_cpu_present_map;
143
144#endif
diff --git a/include/asm-x86/mpspec_def.h b/include/asm-x86/mpspec_def.h
deleted file mode 100644
index 38d1e73b49e4..000000000000
--- a/include/asm-x86/mpspec_def.h
+++ /dev/null
@@ -1,180 +0,0 @@
1#ifndef __ASM_MPSPEC_DEF_H
2#define __ASM_MPSPEC_DEF_H
3
4/*
5 * Structure definitions for SMP machines following the
6 * Intel Multiprocessing Specification 1.1 and 1.4.
7 */
8
9/*
10 * This tag identifies where the SMP configuration
11 * information is.
12 */
13
14#define SMP_MAGIC_IDENT (('_'<<24) | ('P'<<16) | ('M'<<8) | '_')
15
16#ifdef CONFIG_X86_32
17# define MAX_MPC_ENTRY 1024
18# define MAX_APICS 256
19#else
20# if NR_CPUS <= 255
21# define MAX_APICS 255
22# else
23# define MAX_APICS 32768
24# endif
25#endif
26
27struct intel_mp_floating {
28 char mpf_signature[4]; /* "_MP_" */
29 unsigned int mpf_physptr; /* Configuration table address */
30 unsigned char mpf_length; /* Our length (paragraphs) */
31 unsigned char mpf_specification;/* Specification version */
32 unsigned char mpf_checksum; /* Checksum (makes sum 0) */
33 unsigned char mpf_feature1; /* Standard or configuration ? */
34 unsigned char mpf_feature2; /* Bit7 set for IMCR|PIC */
35 unsigned char mpf_feature3; /* Unused (0) */
36 unsigned char mpf_feature4; /* Unused (0) */
37 unsigned char mpf_feature5; /* Unused (0) */
38};
39
40#define MPC_SIGNATURE "PCMP"
41
42struct mp_config_table {
43 char mpc_signature[4];
44 unsigned short mpc_length; /* Size of table */
45 char mpc_spec; /* 0x01 */
46 char mpc_checksum;
47 char mpc_oem[8];
48 char mpc_productid[12];
49 unsigned int mpc_oemptr; /* 0 if not present */
50 unsigned short mpc_oemsize; /* 0 if not present */
51 unsigned short mpc_oemcount;
52 unsigned int mpc_lapic; /* APIC address */
53 unsigned int reserved;
54};
55
56/* Followed by entries */
57
58#define MP_PROCESSOR 0
59#define MP_BUS 1
60#define MP_IOAPIC 2
61#define MP_INTSRC 3
62#define MP_LINTSRC 4
63/* Used by IBM NUMA-Q to describe node locality */
64#define MP_TRANSLATION 192
65
66#define CPU_ENABLED 1 /* Processor is available */
67#define CPU_BOOTPROCESSOR 2 /* Processor is the BP */
68
69#define CPU_STEPPING_MASK 0x000F
70#define CPU_MODEL_MASK 0x00F0
71#define CPU_FAMILY_MASK 0x0F00
72
73struct mpc_config_processor {
74 unsigned char mpc_type;
75 unsigned char mpc_apicid; /* Local APIC number */
76 unsigned char mpc_apicver; /* Its versions */
77 unsigned char mpc_cpuflag;
78 unsigned int mpc_cpufeature;
79 unsigned int mpc_featureflag; /* CPUID feature value */
80 unsigned int mpc_reserved[2];
81};
82
83struct mpc_config_bus {
84 unsigned char mpc_type;
85 unsigned char mpc_busid;
86 unsigned char mpc_bustype[6];
87};
88
89/* List of Bus Type string values, Intel MP Spec. */
90#define BUSTYPE_EISA "EISA"
91#define BUSTYPE_ISA "ISA"
92#define BUSTYPE_INTERN "INTERN" /* Internal BUS */
93#define BUSTYPE_MCA "MCA"
94#define BUSTYPE_VL "VL" /* Local bus */
95#define BUSTYPE_PCI "PCI"
96#define BUSTYPE_PCMCIA "PCMCIA"
97#define BUSTYPE_CBUS "CBUS"
98#define BUSTYPE_CBUSII "CBUSII"
99#define BUSTYPE_FUTURE "FUTURE"
100#define BUSTYPE_MBI "MBI"
101#define BUSTYPE_MBII "MBII"
102#define BUSTYPE_MPI "MPI"
103#define BUSTYPE_MPSA "MPSA"
104#define BUSTYPE_NUBUS "NUBUS"
105#define BUSTYPE_TC "TC"
106#define BUSTYPE_VME "VME"
107#define BUSTYPE_XPRESS "XPRESS"
108
109#define MPC_APIC_USABLE 0x01
110
111struct mpc_config_ioapic {
112 unsigned char mpc_type;
113 unsigned char mpc_apicid;
114 unsigned char mpc_apicver;
115 unsigned char mpc_flags;
116 unsigned int mpc_apicaddr;
117};
118
119struct mpc_config_intsrc {
120 unsigned char mpc_type;
121 unsigned char mpc_irqtype;
122 unsigned short mpc_irqflag;
123 unsigned char mpc_srcbus;
124 unsigned char mpc_srcbusirq;
125 unsigned char mpc_dstapic;
126 unsigned char mpc_dstirq;
127};
128
129enum mp_irq_source_types {
130 mp_INT = 0,
131 mp_NMI = 1,
132 mp_SMI = 2,
133 mp_ExtINT = 3
134};
135
136#define MP_IRQDIR_DEFAULT 0
137#define MP_IRQDIR_HIGH 1
138#define MP_IRQDIR_LOW 3
139
140#define MP_APIC_ALL 0xFF
141
142struct mpc_config_lintsrc {
143 unsigned char mpc_type;
144 unsigned char mpc_irqtype;
145 unsigned short mpc_irqflag;
146 unsigned char mpc_srcbusid;
147 unsigned char mpc_srcbusirq;
148 unsigned char mpc_destapic;
149 unsigned char mpc_destapiclint;
150};
151
152#define MPC_OEM_SIGNATURE "_OEM"
153
154struct mp_config_oemtable {
155 char oem_signature[4];
156 unsigned short oem_length; /* Size of table */
157 char oem_rev; /* 0x01 */
158 char oem_checksum;
159 char mpc_oem[8];
160};
161
162/*
163 * Default configurations
164 *
165 * 1 2 CPU ISA 82489DX
166 * 2 2 CPU EISA 82489DX neither IRQ 0 timer nor IRQ 13 DMA chaining
167 * 3 2 CPU EISA 82489DX
168 * 4 2 CPU MCA 82489DX
169 * 5 2 CPU ISA+PCI
170 * 6 2 CPU EISA+PCI
171 * 7 2 CPU MCA+PCI
172 */
173
174enum mp_bustype {
175 MP_BUS_ISA = 1,
176 MP_BUS_EISA,
177 MP_BUS_PCI,
178 MP_BUS_MCA,
179};
180#endif
diff --git a/include/asm-x86/msgbuf.h b/include/asm-x86/msgbuf.h
deleted file mode 100644
index 7e4e9481f51c..000000000000
--- a/include/asm-x86/msgbuf.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#ifndef _ASM_X86_MSGBUF_H
2#define _ASM_X86_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space on i386 is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 *
13 * Pad space on x8664 is left for:
14 * - 2 miscellaneous 64-bit values
15 */
16struct msqid64_ds {
17 struct ipc64_perm msg_perm;
18 __kernel_time_t msg_stime; /* last msgsnd time */
19#ifdef __i386__
20 unsigned long __unused1;
21#endif
22 __kernel_time_t msg_rtime; /* last msgrcv time */
23#ifdef __i386__
24 unsigned long __unused2;
25#endif
26 __kernel_time_t msg_ctime; /* last change time */
27#ifdef __i386__
28 unsigned long __unused3;
29#endif
30 unsigned long msg_cbytes; /* current number of bytes on queue */
31 unsigned long msg_qnum; /* number of messages in queue */
32 unsigned long msg_qbytes; /* max number of bytes on queue */
33 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
34 __kernel_pid_t msg_lrpid; /* last receive pid */
35 unsigned long __unused4;
36 unsigned long __unused5;
37};
38
39#endif /* _ASM_X86_MSGBUF_H */
diff --git a/include/asm-x86/msidef.h b/include/asm-x86/msidef.h
deleted file mode 100644
index 296f29ce426d..000000000000
--- a/include/asm-x86/msidef.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef ASM_MSIDEF_H
2#define ASM_MSIDEF_H
3
4/*
5 * Constants for Intel APIC based MSI messages.
6 */
7
8/*
9 * Shifts for MSI data
10 */
11
12#define MSI_DATA_VECTOR_SHIFT 0
13#define MSI_DATA_VECTOR_MASK 0x000000ff
14#define MSI_DATA_VECTOR(v) (((v) << MSI_DATA_VECTOR_SHIFT) & \
15 MSI_DATA_VECTOR_MASK)
16
17#define MSI_DATA_DELIVERY_MODE_SHIFT 8
18#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_MODE_SHIFT)
19#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_MODE_SHIFT)
20
21#define MSI_DATA_LEVEL_SHIFT 14
22#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT)
23#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT)
24
25#define MSI_DATA_TRIGGER_SHIFT 15
26#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT)
27#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT)
28
29/*
30 * Shift/mask fields for msi address
31 */
32
33#define MSI_ADDR_BASE_HI 0
34#define MSI_ADDR_BASE_LO 0xfee00000
35
36#define MSI_ADDR_DEST_MODE_SHIFT 2
37#define MSI_ADDR_DEST_MODE_PHYSICAL (0 << MSI_ADDR_DEST_MODE_SHIFT)
38#define MSI_ADDR_DEST_MODE_LOGICAL (1 << MSI_ADDR_DEST_MODE_SHIFT)
39
40#define MSI_ADDR_REDIRECTION_SHIFT 3
41#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT)
42 /* dedicated cpu */
43#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT)
44 /* lowest priority */
45
46#define MSI_ADDR_DEST_ID_SHIFT 12
47#define MSI_ADDR_DEST_ID_MASK 0x00ffff0
48#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & \
49 MSI_ADDR_DEST_ID_MASK)
50
51#endif /* ASM_MSIDEF_H */
diff --git a/include/asm-x86/msr-index.h b/include/asm-x86/msr-index.h
deleted file mode 100644
index 44bce773012e..000000000000
--- a/include/asm-x86/msr-index.h
+++ /dev/null
@@ -1,313 +0,0 @@
1#ifndef __ASM_MSR_INDEX_H
2#define __ASM_MSR_INDEX_H
3
4/* CPU model specific register (MSR) numbers */
5
6/* x86-64 specific MSRs */
7#define MSR_EFER 0xc0000080 /* extended feature register */
8#define MSR_STAR 0xc0000081 /* legacy mode SYSCALL target */
9#define MSR_LSTAR 0xc0000082 /* long mode SYSCALL target */
10#define MSR_CSTAR 0xc0000083 /* compat mode SYSCALL target */
11#define MSR_SYSCALL_MASK 0xc0000084 /* EFLAGS mask for syscall */
12#define MSR_FS_BASE 0xc0000100 /* 64bit FS base */
13#define MSR_GS_BASE 0xc0000101 /* 64bit GS base */
14#define MSR_KERNEL_GS_BASE 0xc0000102 /* SwapGS GS shadow */
15
16/* EFER bits: */
17#define _EFER_SCE 0 /* SYSCALL/SYSRET */
18#define _EFER_LME 8 /* Long mode enable */
19#define _EFER_LMA 10 /* Long mode active (read-only) */
20#define _EFER_NX 11 /* No execute enable */
21
22#define EFER_SCE (1<<_EFER_SCE)
23#define EFER_LME (1<<_EFER_LME)
24#define EFER_LMA (1<<_EFER_LMA)
25#define EFER_NX (1<<_EFER_NX)
26
27/* Intel MSRs. Some also available on other CPUs */
28#define MSR_IA32_PERFCTR0 0x000000c1
29#define MSR_IA32_PERFCTR1 0x000000c2
30#define MSR_FSB_FREQ 0x000000cd
31
32#define MSR_MTRRcap 0x000000fe
33#define MSR_IA32_BBL_CR_CTL 0x00000119
34
35#define MSR_IA32_SYSENTER_CS 0x00000174
36#define MSR_IA32_SYSENTER_ESP 0x00000175
37#define MSR_IA32_SYSENTER_EIP 0x00000176
38
39#define MSR_IA32_MCG_CAP 0x00000179
40#define MSR_IA32_MCG_STATUS 0x0000017a
41#define MSR_IA32_MCG_CTL 0x0000017b
42
43#define MSR_IA32_PEBS_ENABLE 0x000003f1
44#define MSR_IA32_DS_AREA 0x00000600
45#define MSR_IA32_PERF_CAPABILITIES 0x00000345
46
47#define MSR_MTRRfix64K_00000 0x00000250
48#define MSR_MTRRfix16K_80000 0x00000258
49#define MSR_MTRRfix16K_A0000 0x00000259
50#define MSR_MTRRfix4K_C0000 0x00000268
51#define MSR_MTRRfix4K_C8000 0x00000269
52#define MSR_MTRRfix4K_D0000 0x0000026a
53#define MSR_MTRRfix4K_D8000 0x0000026b
54#define MSR_MTRRfix4K_E0000 0x0000026c
55#define MSR_MTRRfix4K_E8000 0x0000026d
56#define MSR_MTRRfix4K_F0000 0x0000026e
57#define MSR_MTRRfix4K_F8000 0x0000026f
58#define MSR_MTRRdefType 0x000002ff
59
60#define MSR_IA32_CR_PAT 0x00000277
61
62#define MSR_IA32_DEBUGCTLMSR 0x000001d9
63#define MSR_IA32_LASTBRANCHFROMIP 0x000001db
64#define MSR_IA32_LASTBRANCHTOIP 0x000001dc
65#define MSR_IA32_LASTINTFROMIP 0x000001dd
66#define MSR_IA32_LASTINTTOIP 0x000001de
67
68/* DEBUGCTLMSR bits (others vary by model): */
69#define _DEBUGCTLMSR_LBR 0 /* last branch recording */
70#define _DEBUGCTLMSR_BTF 1 /* single-step on branches */
71
72#define DEBUGCTLMSR_LBR (1UL << _DEBUGCTLMSR_LBR)
73#define DEBUGCTLMSR_BTF (1UL << _DEBUGCTLMSR_BTF)
74
75#define MSR_IA32_MC0_CTL 0x00000400
76#define MSR_IA32_MC0_STATUS 0x00000401
77#define MSR_IA32_MC0_ADDR 0x00000402
78#define MSR_IA32_MC0_MISC 0x00000403
79
80#define MSR_P6_PERFCTR0 0x000000c1
81#define MSR_P6_PERFCTR1 0x000000c2
82#define MSR_P6_EVNTSEL0 0x00000186
83#define MSR_P6_EVNTSEL1 0x00000187
84
85/* AMD64 MSRs. Not complete. See the architecture manual for a more
86 complete list. */
87
88#define MSR_AMD64_NB_CFG 0xc001001f
89#define MSR_AMD64_IBSFETCHCTL 0xc0011030
90#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
91#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
92#define MSR_AMD64_IBSOPCTL 0xc0011033
93#define MSR_AMD64_IBSOPRIP 0xc0011034
94#define MSR_AMD64_IBSOPDATA 0xc0011035
95#define MSR_AMD64_IBSOPDATA2 0xc0011036
96#define MSR_AMD64_IBSOPDATA3 0xc0011037
97#define MSR_AMD64_IBSDCLINAD 0xc0011038
98#define MSR_AMD64_IBSDCPHYSAD 0xc0011039
99#define MSR_AMD64_IBSCTL 0xc001103a
100
101/* Fam 10h MSRs */
102#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058
103#define FAM10H_MMIO_CONF_ENABLE (1<<0)
104#define FAM10H_MMIO_CONF_BUSRANGE_MASK 0xf
105#define FAM10H_MMIO_CONF_BUSRANGE_SHIFT 2
106#define FAM10H_MMIO_CONF_BASE_MASK 0xfffffff
107#define FAM10H_MMIO_CONF_BASE_SHIFT 20
108
109/* K8 MSRs */
110#define MSR_K8_TOP_MEM1 0xc001001a
111#define MSR_K8_TOP_MEM2 0xc001001d
112#define MSR_K8_SYSCFG 0xc0010010
113#define MSR_K8_HWCR 0xc0010015
114#define MSR_K8_INT_PENDING_MSG 0xc0010055
115/* C1E active bits in int pending message */
116#define K8_INTP_C1E_ACTIVE_MASK 0x18000000
117#define MSR_K8_TSEG_ADDR 0xc0010112
118#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */
119#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */
120#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */
121
122/* K7 MSRs */
123#define MSR_K7_EVNTSEL0 0xc0010000
124#define MSR_K7_PERFCTR0 0xc0010004
125#define MSR_K7_EVNTSEL1 0xc0010001
126#define MSR_K7_PERFCTR1 0xc0010005
127#define MSR_K7_EVNTSEL2 0xc0010002
128#define MSR_K7_PERFCTR2 0xc0010006
129#define MSR_K7_EVNTSEL3 0xc0010003
130#define MSR_K7_PERFCTR3 0xc0010007
131#define MSR_K7_CLK_CTL 0xc001001b
132#define MSR_K7_HWCR 0xc0010015
133#define MSR_K7_FID_VID_CTL 0xc0010041
134#define MSR_K7_FID_VID_STATUS 0xc0010042
135
136/* K6 MSRs */
137#define MSR_K6_EFER 0xc0000080
138#define MSR_K6_STAR 0xc0000081
139#define MSR_K6_WHCR 0xc0000082
140#define MSR_K6_UWCCR 0xc0000085
141#define MSR_K6_EPMR 0xc0000086
142#define MSR_K6_PSOR 0xc0000087
143#define MSR_K6_PFIR 0xc0000088
144
145/* Centaur-Hauls/IDT defined MSRs. */
146#define MSR_IDT_FCR1 0x00000107
147#define MSR_IDT_FCR2 0x00000108
148#define MSR_IDT_FCR3 0x00000109
149#define MSR_IDT_FCR4 0x0000010a
150
151#define MSR_IDT_MCR0 0x00000110
152#define MSR_IDT_MCR1 0x00000111
153#define MSR_IDT_MCR2 0x00000112
154#define MSR_IDT_MCR3 0x00000113
155#define MSR_IDT_MCR4 0x00000114
156#define MSR_IDT_MCR5 0x00000115
157#define MSR_IDT_MCR6 0x00000116
158#define MSR_IDT_MCR7 0x00000117
159#define MSR_IDT_MCR_CTRL 0x00000120
160
161/* VIA Cyrix defined MSRs*/
162#define MSR_VIA_FCR 0x00001107
163#define MSR_VIA_LONGHAUL 0x0000110a
164#define MSR_VIA_RNG 0x0000110b
165#define MSR_VIA_BCR2 0x00001147
166
167/* Transmeta defined MSRs */
168#define MSR_TMTA_LONGRUN_CTRL 0x80868010
169#define MSR_TMTA_LONGRUN_FLAGS 0x80868011
170#define MSR_TMTA_LRTI_READOUT 0x80868018
171#define MSR_TMTA_LRTI_VOLT_MHZ 0x8086801a
172
173/* Intel defined MSRs. */
174#define MSR_IA32_P5_MC_ADDR 0x00000000
175#define MSR_IA32_P5_MC_TYPE 0x00000001
176#define MSR_IA32_TSC 0x00000010
177#define MSR_IA32_PLATFORM_ID 0x00000017
178#define MSR_IA32_EBL_CR_POWERON 0x0000002a
179
180#define MSR_IA32_APICBASE 0x0000001b
181#define MSR_IA32_APICBASE_BSP (1<<8)
182#define MSR_IA32_APICBASE_ENABLE (1<<11)
183#define MSR_IA32_APICBASE_BASE (0xfffff<<12)
184
185#define MSR_IA32_UCODE_WRITE 0x00000079
186#define MSR_IA32_UCODE_REV 0x0000008b
187
188#define MSR_IA32_PERF_STATUS 0x00000198
189#define MSR_IA32_PERF_CTL 0x00000199
190
191#define MSR_IA32_MPERF 0x000000e7
192#define MSR_IA32_APERF 0x000000e8
193
194#define MSR_IA32_THERM_CONTROL 0x0000019a
195#define MSR_IA32_THERM_INTERRUPT 0x0000019b
196#define MSR_IA32_THERM_STATUS 0x0000019c
197#define MSR_IA32_MISC_ENABLE 0x000001a0
198
199/* Intel Model 6 */
200#define MSR_P6_EVNTSEL0 0x00000186
201#define MSR_P6_EVNTSEL1 0x00000187
202
203/* P4/Xeon+ specific */
204#define MSR_IA32_MCG_EAX 0x00000180
205#define MSR_IA32_MCG_EBX 0x00000181
206#define MSR_IA32_MCG_ECX 0x00000182
207#define MSR_IA32_MCG_EDX 0x00000183
208#define MSR_IA32_MCG_ESI 0x00000184
209#define MSR_IA32_MCG_EDI 0x00000185
210#define MSR_IA32_MCG_EBP 0x00000186
211#define MSR_IA32_MCG_ESP 0x00000187
212#define MSR_IA32_MCG_EFLAGS 0x00000188
213#define MSR_IA32_MCG_EIP 0x00000189
214#define MSR_IA32_MCG_RESERVED 0x0000018a
215
216/* Pentium IV performance counter MSRs */
217#define MSR_P4_BPU_PERFCTR0 0x00000300
218#define MSR_P4_BPU_PERFCTR1 0x00000301
219#define MSR_P4_BPU_PERFCTR2 0x00000302
220#define MSR_P4_BPU_PERFCTR3 0x00000303
221#define MSR_P4_MS_PERFCTR0 0x00000304
222#define MSR_P4_MS_PERFCTR1 0x00000305
223#define MSR_P4_MS_PERFCTR2 0x00000306
224#define MSR_P4_MS_PERFCTR3 0x00000307
225#define MSR_P4_FLAME_PERFCTR0 0x00000308
226#define MSR_P4_FLAME_PERFCTR1 0x00000309
227#define MSR_P4_FLAME_PERFCTR2 0x0000030a
228#define MSR_P4_FLAME_PERFCTR3 0x0000030b
229#define MSR_P4_IQ_PERFCTR0 0x0000030c
230#define MSR_P4_IQ_PERFCTR1 0x0000030d
231#define MSR_P4_IQ_PERFCTR2 0x0000030e
232#define MSR_P4_IQ_PERFCTR3 0x0000030f
233#define MSR_P4_IQ_PERFCTR4 0x00000310
234#define MSR_P4_IQ_PERFCTR5 0x00000311
235#define MSR_P4_BPU_CCCR0 0x00000360
236#define MSR_P4_BPU_CCCR1 0x00000361
237#define MSR_P4_BPU_CCCR2 0x00000362
238#define MSR_P4_BPU_CCCR3 0x00000363
239#define MSR_P4_MS_CCCR0 0x00000364
240#define MSR_P4_MS_CCCR1 0x00000365
241#define MSR_P4_MS_CCCR2 0x00000366
242#define MSR_P4_MS_CCCR3 0x00000367
243#define MSR_P4_FLAME_CCCR0 0x00000368
244#define MSR_P4_FLAME_CCCR1 0x00000369
245#define MSR_P4_FLAME_CCCR2 0x0000036a
246#define MSR_P4_FLAME_CCCR3 0x0000036b
247#define MSR_P4_IQ_CCCR0 0x0000036c
248#define MSR_P4_IQ_CCCR1 0x0000036d
249#define MSR_P4_IQ_CCCR2 0x0000036e
250#define MSR_P4_IQ_CCCR3 0x0000036f
251#define MSR_P4_IQ_CCCR4 0x00000370
252#define MSR_P4_IQ_CCCR5 0x00000371
253#define MSR_P4_ALF_ESCR0 0x000003ca
254#define MSR_P4_ALF_ESCR1 0x000003cb
255#define MSR_P4_BPU_ESCR0 0x000003b2
256#define MSR_P4_BPU_ESCR1 0x000003b3
257#define MSR_P4_BSU_ESCR0 0x000003a0
258#define MSR_P4_BSU_ESCR1 0x000003a1
259#define MSR_P4_CRU_ESCR0 0x000003b8
260#define MSR_P4_CRU_ESCR1 0x000003b9
261#define MSR_P4_CRU_ESCR2 0x000003cc
262#define MSR_P4_CRU_ESCR3 0x000003cd
263#define MSR_P4_CRU_ESCR4 0x000003e0
264#define MSR_P4_CRU_ESCR5 0x000003e1
265#define MSR_P4_DAC_ESCR0 0x000003a8
266#define MSR_P4_DAC_ESCR1 0x000003a9
267#define MSR_P4_FIRM_ESCR0 0x000003a4
268#define MSR_P4_FIRM_ESCR1 0x000003a5
269#define MSR_P4_FLAME_ESCR0 0x000003a6
270#define MSR_P4_FLAME_ESCR1 0x000003a7
271#define MSR_P4_FSB_ESCR0 0x000003a2
272#define MSR_P4_FSB_ESCR1 0x000003a3
273#define MSR_P4_IQ_ESCR0 0x000003ba
274#define MSR_P4_IQ_ESCR1 0x000003bb
275#define MSR_P4_IS_ESCR0 0x000003b4
276#define MSR_P4_IS_ESCR1 0x000003b5
277#define MSR_P4_ITLB_ESCR0 0x000003b6
278#define MSR_P4_ITLB_ESCR1 0x000003b7
279#define MSR_P4_IX_ESCR0 0x000003c8
280#define MSR_P4_IX_ESCR1 0x000003c9
281#define MSR_P4_MOB_ESCR0 0x000003aa
282#define MSR_P4_MOB_ESCR1 0x000003ab
283#define MSR_P4_MS_ESCR0 0x000003c0
284#define MSR_P4_MS_ESCR1 0x000003c1
285#define MSR_P4_PMH_ESCR0 0x000003ac
286#define MSR_P4_PMH_ESCR1 0x000003ad
287#define MSR_P4_RAT_ESCR0 0x000003bc
288#define MSR_P4_RAT_ESCR1 0x000003bd
289#define MSR_P4_SAAT_ESCR0 0x000003ae
290#define MSR_P4_SAAT_ESCR1 0x000003af
291#define MSR_P4_SSU_ESCR0 0x000003be
292#define MSR_P4_SSU_ESCR1 0x000003bf /* guess: not in manual */
293
294#define MSR_P4_TBPU_ESCR0 0x000003c2
295#define MSR_P4_TBPU_ESCR1 0x000003c3
296#define MSR_P4_TC_ESCR0 0x000003c4
297#define MSR_P4_TC_ESCR1 0x000003c5
298#define MSR_P4_U2L_ESCR0 0x000003b0
299#define MSR_P4_U2L_ESCR1 0x000003b1
300
301/* Intel Core-based CPU performance counters */
302#define MSR_CORE_PERF_FIXED_CTR0 0x00000309
303#define MSR_CORE_PERF_FIXED_CTR1 0x0000030a
304#define MSR_CORE_PERF_FIXED_CTR2 0x0000030b
305#define MSR_CORE_PERF_FIXED_CTR_CTRL 0x0000038d
306#define MSR_CORE_PERF_GLOBAL_STATUS 0x0000038e
307#define MSR_CORE_PERF_GLOBAL_CTRL 0x0000038f
308#define MSR_CORE_PERF_GLOBAL_OVF_CTRL 0x00000390
309
310/* Geode defined MSRs */
311#define MSR_GEODE_BUSCONT_CONF0 0x00001900
312
313#endif /* __ASM_MSR_INDEX_H */
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
deleted file mode 100644
index 2362cfda1fbc..000000000000
--- a/include/asm-x86/msr.h
+++ /dev/null
@@ -1,224 +0,0 @@
1#ifndef __ASM_X86_MSR_H_
2#define __ASM_X86_MSR_H_
3
4#include <asm/msr-index.h>
5
6#ifndef __ASSEMBLY__
7# include <linux/types.h>
8#endif
9
10#ifdef __KERNEL__
11#ifndef __ASSEMBLY__
12
13#include <asm/asm.h>
14#include <asm/errno.h>
15
16static inline unsigned long long native_read_tscp(unsigned int *aux)
17{
18 unsigned long low, high;
19 asm volatile(".byte 0x0f,0x01,0xf9"
20 : "=a" (low), "=d" (high), "=c" (*aux));
21 return low | ((u64)high << 32);
22}
23
24/*
25 * i386 calling convention returns 64-bit value in edx:eax, while
26 * x86_64 returns at rax. Also, the "A" constraint does not really
27 * mean rdx:rax in x86_64, so we need specialized behaviour for each
28 * architecture
29 */
30#ifdef CONFIG_X86_64
31#define DECLARE_ARGS(val, low, high) unsigned low, high
32#define EAX_EDX_VAL(val, low, high) ((low) | ((u64)(high) << 32))
33#define EAX_EDX_ARGS(val, low, high) "a" (low), "d" (high)
34#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
35#else
36#define DECLARE_ARGS(val, low, high) unsigned long long val
37#define EAX_EDX_VAL(val, low, high) (val)
38#define EAX_EDX_ARGS(val, low, high) "A" (val)
39#define EAX_EDX_RET(val, low, high) "=A" (val)
40#endif
41
42static inline unsigned long long native_read_msr(unsigned int msr)
43{
44 DECLARE_ARGS(val, low, high);
45
46 asm volatile("rdmsr" : EAX_EDX_RET(val, low, high) : "c" (msr));
47 return EAX_EDX_VAL(val, low, high);
48}
49
50static inline unsigned long long native_read_msr_safe(unsigned int msr,
51 int *err)
52{
53 DECLARE_ARGS(val, low, high);
54
55 asm volatile("2: rdmsr ; xor %[err],%[err]\n"
56 "1:\n\t"
57 ".section .fixup,\"ax\"\n\t"
58 "3: mov %[fault],%[err] ; jmp 1b\n\t"
59 ".previous\n\t"
60 _ASM_EXTABLE(2b, 3b)
61 : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
62 : "c" (msr), [fault] "i" (-EFAULT));
63 return EAX_EDX_VAL(val, low, high);
64}
65
66static inline void native_write_msr(unsigned int msr,
67 unsigned low, unsigned high)
68{
69 asm volatile("wrmsr" : : "c" (msr), "a"(low), "d" (high) : "memory");
70}
71
72static inline int native_write_msr_safe(unsigned int msr,
73 unsigned low, unsigned high)
74{
75 int err;
76 asm volatile("2: wrmsr ; xor %[err],%[err]\n"
77 "1:\n\t"
78 ".section .fixup,\"ax\"\n\t"
79 "3: mov %[fault],%[err] ; jmp 1b\n\t"
80 ".previous\n\t"
81 _ASM_EXTABLE(2b, 3b)
82 : [err] "=a" (err)
83 : "c" (msr), "0" (low), "d" (high),
84 [fault] "i" (-EFAULT)
85 : "memory");
86 return err;
87}
88
89extern unsigned long long native_read_tsc(void);
90
91static __always_inline unsigned long long __native_read_tsc(void)
92{
93 DECLARE_ARGS(val, low, high);
94
95 rdtsc_barrier();
96 asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
97 rdtsc_barrier();
98
99 return EAX_EDX_VAL(val, low, high);
100}
101
102static inline unsigned long long native_read_pmc(int counter)
103{
104 DECLARE_ARGS(val, low, high);
105
106 asm volatile("rdpmc" : EAX_EDX_RET(val, low, high) : "c" (counter));
107 return EAX_EDX_VAL(val, low, high);
108}
109
110#ifdef CONFIG_PARAVIRT
111#include <asm/paravirt.h>
112#else
113#include <linux/errno.h>
114/*
115 * Access to machine-specific registers (available on 586 and better only)
116 * Note: the rd* operations modify the parameters directly (without using
117 * pointer indirection), this allows gcc to optimize better
118 */
119
120#define rdmsr(msr, val1, val2) \
121do { \
122 u64 __val = native_read_msr((msr)); \
123 (val1) = (u32)__val; \
124 (val2) = (u32)(__val >> 32); \
125} while (0)
126
127static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
128{
129 native_write_msr(msr, low, high);
130}
131
132#define rdmsrl(msr, val) \
133 ((val) = native_read_msr((msr)))
134
135#define wrmsrl(msr, val) \
136 native_write_msr((msr), (u32)((u64)(val)), (u32)((u64)(val) >> 32))
137
138/* wrmsr with exception handling */
139static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high)
140{
141 return native_write_msr_safe(msr, low, high);
142}
143
144/* rdmsr with exception handling */
145#define rdmsr_safe(msr, p1, p2) \
146({ \
147 int __err; \
148 u64 __val = native_read_msr_safe((msr), &__err); \
149 (*p1) = (u32)__val; \
150 (*p2) = (u32)(__val >> 32); \
151 __err; \
152})
153
154static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
155{
156 int err;
157
158 *p = native_read_msr_safe(msr, &err);
159 return err;
160}
161
162#define rdtscl(low) \
163 ((low) = (u32)native_read_tsc())
164
165#define rdtscll(val) \
166 ((val) = native_read_tsc())
167
168#define rdpmc(counter, low, high) \
169do { \
170 u64 _l = native_read_pmc((counter)); \
171 (low) = (u32)_l; \
172 (high) = (u32)(_l >> 32); \
173} while (0)
174
175#define rdtscp(low, high, aux) \
176do { \
177 unsigned long long _val = native_read_tscp(&(aux)); \
178 (low) = (u32)_val; \
179 (high) = (u32)(_val >> 32); \
180} while (0)
181
182#define rdtscpll(val, aux) (val) = native_read_tscp(&(aux))
183
184#endif /* !CONFIG_PARAVIRT */
185
186
187#define checking_wrmsrl(msr, val) wrmsr_safe((msr), (u32)(val), \
188 (u32)((val) >> 32))
189
190#define write_tsc(val1, val2) wrmsr(0x10, (val1), (val2))
191
192#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
193
194#ifdef CONFIG_SMP
195int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
196int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
197int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
198int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
199#else /* CONFIG_SMP */
200static inline int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
201{
202 rdmsr(msr_no, *l, *h);
203 return 0;
204}
205static inline int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
206{
207 wrmsr(msr_no, l, h);
208 return 0;
209}
210static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no,
211 u32 *l, u32 *h)
212{
213 return rdmsr_safe(msr_no, l, h);
214}
215static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
216{
217 return wrmsr_safe(msr_no, l, h);
218}
219#endif /* CONFIG_SMP */
220#endif /* __ASSEMBLY__ */
221#endif /* __KERNEL__ */
222
223
224#endif
diff --git a/include/asm-x86/mtrr.h b/include/asm-x86/mtrr.h
deleted file mode 100644
index a69a01a51729..000000000000
--- a/include/asm-x86/mtrr.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/* Generic MTRR (Memory Type Range Register) ioctls.
2
3 Copyright (C) 1997-1999 Richard Gooch
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 Richard Gooch may be reached by email at rgooch@atnf.csiro.au
20 The postal address is:
21 Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
22*/
23#ifndef _ASM_X86_MTRR_H
24#define _ASM_X86_MTRR_H
25
26#include <linux/ioctl.h>
27#include <linux/errno.h>
28
29#define MTRR_IOCTL_BASE 'M'
30
31struct mtrr_sentry {
32 unsigned long base; /* Base address */
33 unsigned int size; /* Size of region */
34 unsigned int type; /* Type of region */
35};
36
37/* Warning: this structure has a different order from i386
38 on x86-64. The 32bit emulation code takes care of that.
39 But you need to use this for 64bit, otherwise your X server
40 will break. */
41
42#ifdef __i386__
43struct mtrr_gentry {
44 unsigned int regnum; /* Register number */
45 unsigned long base; /* Base address */
46 unsigned int size; /* Size of region */
47 unsigned int type; /* Type of region */
48};
49
50#else /* __i386__ */
51
52struct mtrr_gentry {
53 unsigned long base; /* Base address */
54 unsigned int size; /* Size of region */
55 unsigned int regnum; /* Register number */
56 unsigned int type; /* Type of region */
57};
58#endif /* !__i386__ */
59
60/* These are the various ioctls */
61#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
62#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
63#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)
64#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
65#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)
66#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)
67#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)
68#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)
69#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
70#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)
71
72/* These are the region types */
73#define MTRR_TYPE_UNCACHABLE 0
74#define MTRR_TYPE_WRCOMB 1
75/*#define MTRR_TYPE_ 2*/
76/*#define MTRR_TYPE_ 3*/
77#define MTRR_TYPE_WRTHROUGH 4
78#define MTRR_TYPE_WRPROT 5
79#define MTRR_TYPE_WRBACK 6
80#define MTRR_NUM_TYPES 7
81
82#ifdef __KERNEL__
83
84/* The following functions are for use by other drivers */
85# ifdef CONFIG_MTRR
86extern u8 mtrr_type_lookup(u64 addr, u64 end);
87extern void mtrr_save_fixed_ranges(void *);
88extern void mtrr_save_state(void);
89extern int mtrr_add(unsigned long base, unsigned long size,
90 unsigned int type, bool increment);
91extern int mtrr_add_page(unsigned long base, unsigned long size,
92 unsigned int type, bool increment);
93extern int mtrr_del(int reg, unsigned long base, unsigned long size);
94extern int mtrr_del_page(int reg, unsigned long base, unsigned long size);
95extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
96extern void mtrr_ap_init(void);
97extern void mtrr_bp_init(void);
98extern int mtrr_trim_uncached_memory(unsigned long end_pfn);
99extern int amd_special_default_mtrr(void);
100# else
101static inline u8 mtrr_type_lookup(u64 addr, u64 end)
102{
103 /*
104 * Return no-MTRRs:
105 */
106 return 0xff;
107}
108#define mtrr_save_fixed_ranges(arg) do {} while (0)
109#define mtrr_save_state() do {} while (0)
110static inline int mtrr_add(unsigned long base, unsigned long size,
111 unsigned int type, bool increment)
112{
113 return -ENODEV;
114}
115static inline int mtrr_add_page(unsigned long base, unsigned long size,
116 unsigned int type, bool increment)
117{
118 return -ENODEV;
119}
120static inline int mtrr_del(int reg, unsigned long base, unsigned long size)
121{
122 return -ENODEV;
123}
124static inline int mtrr_del_page(int reg, unsigned long base, unsigned long size)
125{
126 return -ENODEV;
127}
128static inline int mtrr_trim_uncached_memory(unsigned long end_pfn)
129{
130 return 0;
131}
132static inline void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi)
133{
134}
135
136#define mtrr_ap_init() do {} while (0)
137#define mtrr_bp_init() do {} while (0)
138# endif
139
140#ifdef CONFIG_COMPAT
141#include <linux/compat.h>
142
143struct mtrr_sentry32 {
144 compat_ulong_t base; /* Base address */
145 compat_uint_t size; /* Size of region */
146 compat_uint_t type; /* Type of region */
147};
148
149struct mtrr_gentry32 {
150 compat_ulong_t regnum; /* Register number */
151 compat_uint_t base; /* Base address */
152 compat_uint_t size; /* Size of region */
153 compat_uint_t type; /* Type of region */
154};
155
156#define MTRR_IOCTL_BASE 'M'
157
158#define MTRRIOC32_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry32)
159#define MTRRIOC32_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry32)
160#define MTRRIOC32_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry32)
161#define MTRRIOC32_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry32)
162#define MTRRIOC32_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry32)
163#define MTRRIOC32_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry32)
164#define MTRRIOC32_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry32)
165#define MTRRIOC32_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry32)
166#define MTRRIOC32_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry32)
167#define MTRRIOC32_KILL_PAGE_ENTRY \
168 _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry32)
169#endif /* CONFIG_COMPAT */
170
171#endif /* __KERNEL__ */
172
173#endif /* _ASM_X86_MTRR_H */
diff --git a/include/asm-x86/mutex.h b/include/asm-x86/mutex.h
deleted file mode 100644
index a731b9c573a6..000000000000
--- a/include/asm-x86/mutex.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "mutex_32.h"
3#else
4# include "mutex_64.h"
5#endif
diff --git a/include/asm-x86/mutex_32.h b/include/asm-x86/mutex_32.h
deleted file mode 100644
index 73e928ef5f03..000000000000
--- a/include/asm-x86/mutex_32.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/*
2 * Assembly implementation of the mutex fastpath, based on atomic
3 * decrement/increment.
4 *
5 * started by Ingo Molnar:
6 *
7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
8 */
9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H
11
12#include <asm/alternative.h>
13
14/**
15 * __mutex_fastpath_lock - try to take the lock by moving the count
16 * from 1 to a 0 value
17 * @count: pointer of type atomic_t
18 * @fn: function to call if the original value was not 1
19 *
20 * Change the count from 1 to a value lower than 1, and call <fn> if it
21 * wasn't 1 originally. This function MUST leave the value lower than 1
22 * even when the "1" assertion wasn't true.
23 */
24#define __mutex_fastpath_lock(count, fail_fn) \
25do { \
26 unsigned int dummy; \
27 \
28 typecheck(atomic_t *, count); \
29 typecheck_fn(void (*)(atomic_t *), fail_fn); \
30 \
31 asm volatile(LOCK_PREFIX " decl (%%eax)\n" \
32 " jns 1f \n" \
33 " call " #fail_fn "\n" \
34 "1:\n" \
35 : "=a" (dummy) \
36 : "a" (count) \
37 : "memory", "ecx", "edx"); \
38} while (0)
39
40
41/**
42 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
43 * from 1 to a 0 value
44 * @count: pointer of type atomic_t
45 * @fail_fn: function to call if the original value was not 1
46 *
47 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it
48 * wasn't 1 originally. This function returns 0 if the fastpath succeeds,
49 * or anything the slow path function returns
50 */
51static inline int __mutex_fastpath_lock_retval(atomic_t *count,
52 int (*fail_fn)(atomic_t *))
53{
54 if (unlikely(atomic_dec_return(count) < 0))
55 return fail_fn(count);
56 else
57 return 0;
58}
59
60/**
61 * __mutex_fastpath_unlock - try to promote the mutex from 0 to 1
62 * @count: pointer of type atomic_t
63 * @fail_fn: function to call if the original value was not 0
64 *
65 * try to promote the mutex from 0 to 1. if it wasn't 0, call <fail_fn>.
66 * In the failure case, this function is allowed to either set the value
67 * to 1, or to set it to a value lower than 1.
68 *
69 * If the implementation sets it to a value of lower than 1, the
70 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
71 * to return 0 otherwise.
72 */
73#define __mutex_fastpath_unlock(count, fail_fn) \
74do { \
75 unsigned int dummy; \
76 \
77 typecheck(atomic_t *, count); \
78 typecheck_fn(void (*)(atomic_t *), fail_fn); \
79 \
80 asm volatile(LOCK_PREFIX " incl (%%eax)\n" \
81 " jg 1f\n" \
82 " call " #fail_fn "\n" \
83 "1:\n" \
84 : "=a" (dummy) \
85 : "a" (count) \
86 : "memory", "ecx", "edx"); \
87} while (0)
88
89#define __mutex_slowpath_needs_to_unlock() 1
90
91/**
92 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
93 *
94 * @count: pointer of type atomic_t
95 * @fail_fn: fallback function
96 *
97 * Change the count from 1 to a value lower than 1, and return 0 (failure)
98 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
99 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
100 * Additionally, if the value was < 0 originally, this function must not leave
101 * it to 0 on failure.
102 */
103static inline int __mutex_fastpath_trylock(atomic_t *count,
104 int (*fail_fn)(atomic_t *))
105{
106 /*
107 * We have two variants here. The cmpxchg based one is the best one
108 * because it never induce a false contention state. It is included
109 * here because architectures using the inc/dec algorithms over the
110 * xchg ones are much more likely to support cmpxchg natively.
111 *
112 * If not we fall back to the spinlock based variant - that is
113 * just as efficient (and simpler) as a 'destructive' probing of
114 * the mutex state would be.
115 */
116#ifdef __HAVE_ARCH_CMPXCHG
117 if (likely(atomic_cmpxchg(count, 1, 0) == 1))
118 return 1;
119 return 0;
120#else
121 return fail_fn(count);
122#endif
123}
124
125#endif
diff --git a/include/asm-x86/mutex_64.h b/include/asm-x86/mutex_64.h
deleted file mode 100644
index f3fae9becb38..000000000000
--- a/include/asm-x86/mutex_64.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * Assembly implementation of the mutex fastpath, based on atomic
3 * decrement/increment.
4 *
5 * started by Ingo Molnar:
6 *
7 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
8 */
9#ifndef _ASM_MUTEX_H
10#define _ASM_MUTEX_H
11
12/**
13 * __mutex_fastpath_lock - decrement and call function if negative
14 * @v: pointer of type atomic_t
15 * @fail_fn: function to call if the result is negative
16 *
17 * Atomically decrements @v and calls <fail_fn> if the result is negative.
18 */
19#define __mutex_fastpath_lock(v, fail_fn) \
20do { \
21 unsigned long dummy; \
22 \
23 typecheck(atomic_t *, v); \
24 typecheck_fn(void (*)(atomic_t *), fail_fn); \
25 \
26 asm volatile(LOCK_PREFIX " decl (%%rdi)\n" \
27 " jns 1f \n" \
28 " call " #fail_fn "\n" \
29 "1:" \
30 : "=D" (dummy) \
31 : "D" (v) \
32 : "rax", "rsi", "rdx", "rcx", \
33 "r8", "r9", "r10", "r11", "memory"); \
34} while (0)
35
36/**
37 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
38 * from 1 to a 0 value
39 * @count: pointer of type atomic_t
40 * @fail_fn: function to call if the original value was not 1
41 *
42 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
43 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
44 * or anything the slow path function returns
45 */
46static inline int __mutex_fastpath_lock_retval(atomic_t *count,
47 int (*fail_fn)(atomic_t *))
48{
49 if (unlikely(atomic_dec_return(count) < 0))
50 return fail_fn(count);
51 else
52 return 0;
53}
54
55/**
56 * __mutex_fastpath_unlock - increment and call function if nonpositive
57 * @v: pointer of type atomic_t
58 * @fail_fn: function to call if the result is nonpositive
59 *
60 * Atomically increments @v and calls <fail_fn> if the result is nonpositive.
61 */
62#define __mutex_fastpath_unlock(v, fail_fn) \
63do { \
64 unsigned long dummy; \
65 \
66 typecheck(atomic_t *, v); \
67 typecheck_fn(void (*)(atomic_t *), fail_fn); \
68 \
69 asm volatile(LOCK_PREFIX " incl (%%rdi)\n" \
70 " jg 1f\n" \
71 " call " #fail_fn "\n" \
72 "1:" \
73 : "=D" (dummy) \
74 : "D" (v) \
75 : "rax", "rsi", "rdx", "rcx", \
76 "r8", "r9", "r10", "r11", "memory"); \
77} while (0)
78
79#define __mutex_slowpath_needs_to_unlock() 1
80
81/**
82 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
83 *
84 * @count: pointer of type atomic_t
85 * @fail_fn: fallback function
86 *
87 * Change the count from 1 to 0 and return 1 (success), or return 0 (failure)
88 * if it wasn't 1 originally. [the fallback function is never used on
89 * x86_64, because all x86_64 CPUs have a CMPXCHG instruction.]
90 */
91static inline int __mutex_fastpath_trylock(atomic_t *count,
92 int (*fail_fn)(atomic_t *))
93{
94 if (likely(atomic_cmpxchg(count, 1, 0) == 1))
95 return 1;
96 else
97 return 0;
98}
99
100#endif
diff --git a/include/asm-x86/nmi.h b/include/asm-x86/nmi.h
deleted file mode 100644
index 21f8d0202a82..000000000000
--- a/include/asm-x86/nmi.h
+++ /dev/null
@@ -1,84 +0,0 @@
1#ifndef _ASM_X86_NMI_H_
2#define _ASM_X86_NMI_H_
3
4#include <linux/pm.h>
5#include <asm/irq.h>
6#include <asm/io.h>
7
8#ifdef ARCH_HAS_NMI_WATCHDOG
9
10/**
11 * do_nmi_callback
12 *
13 * Check to see if a callback exists and execute it. Return 1
14 * if the handler exists and was handled successfully.
15 */
16int do_nmi_callback(struct pt_regs *regs, int cpu);
17
18#ifdef CONFIG_X86_64
19extern void default_do_nmi(struct pt_regs *);
20#endif
21
22extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
23extern int check_nmi_watchdog(void);
24extern int nmi_watchdog_enabled;
25extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
26extern int avail_to_resrv_perfctr_nmi(unsigned int);
27extern int reserve_perfctr_nmi(unsigned int);
28extern void release_perfctr_nmi(unsigned int);
29extern int reserve_evntsel_nmi(unsigned int);
30extern void release_evntsel_nmi(unsigned int);
31
32extern void setup_apic_nmi_watchdog(void *);
33extern void stop_apic_nmi_watchdog(void *);
34extern void disable_timer_nmi_watchdog(void);
35extern void enable_timer_nmi_watchdog(void);
36extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
37
38extern atomic_t nmi_active;
39extern unsigned int nmi_watchdog;
40#define NMI_NONE 0
41#define NMI_IO_APIC 1
42#define NMI_LOCAL_APIC 2
43#define NMI_INVALID 3
44
45struct ctl_table;
46struct file;
47extern int proc_nmi_enabled(struct ctl_table *, int , struct file *,
48 void __user *, size_t *, loff_t *);
49extern int unknown_nmi_panic;
50
51void __trigger_all_cpu_backtrace(void);
52#define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace()
53
54static inline void localise_nmi_watchdog(void)
55{
56 if (nmi_watchdog == NMI_IO_APIC)
57 nmi_watchdog = NMI_LOCAL_APIC;
58}
59
60/* check if nmi_watchdog is active (ie was specified at boot) */
61static inline int nmi_watchdog_active(void)
62{
63 /*
64 * actually it should be:
65 * return (nmi_watchdog == NMI_LOCAL_APIC ||
66 * nmi_watchdog == NMI_IO_APIC)
67 * but since they are power of two we could use a
68 * cheaper way --cvg
69 */
70 return nmi_watchdog & 0x3;
71}
72#endif
73
74void lapic_watchdog_stop(void);
75int lapic_watchdog_init(unsigned nmi_hz);
76int lapic_wd_event(unsigned nmi_hz);
77unsigned lapic_adjust_nmi_hz(unsigned hz);
78int lapic_watchdog_ok(void);
79void disable_lapic_nmi_watchdog(void);
80void enable_lapic_nmi_watchdog(void);
81void stop_nmi(void);
82void restart_nmi(void);
83
84#endif
diff --git a/include/asm-x86/nops.h b/include/asm-x86/nops.h
deleted file mode 100644
index ad0bedd10b89..000000000000
--- a/include/asm-x86/nops.h
+++ /dev/null
@@ -1,118 +0,0 @@
1#ifndef _ASM_NOPS_H
2#define _ASM_NOPS_H 1
3
4/* Define nops for use with alternative() */
5
6/* generic versions from gas
7 1: nop
8 the following instructions are NOT nops in 64-bit mode,
9 for 64-bit mode use K8 or P6 nops instead
10 2: movl %esi,%esi
11 3: leal 0x00(%esi),%esi
12 4: leal 0x00(,%esi,1),%esi
13 6: leal 0x00000000(%esi),%esi
14 7: leal 0x00000000(,%esi,1),%esi
15*/
16#define GENERIC_NOP1 ".byte 0x90\n"
17#define GENERIC_NOP2 ".byte 0x89,0xf6\n"
18#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n"
19#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n"
20#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4
21#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n"
22#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n"
23#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7
24
25/* Opteron 64bit nops
26 1: nop
27 2: osp nop
28 3: osp osp nop
29 4: osp osp osp nop
30*/
31#define K8_NOP1 GENERIC_NOP1
32#define K8_NOP2 ".byte 0x66,0x90\n"
33#define K8_NOP3 ".byte 0x66,0x66,0x90\n"
34#define K8_NOP4 ".byte 0x66,0x66,0x66,0x90\n"
35#define K8_NOP5 K8_NOP3 K8_NOP2
36#define K8_NOP6 K8_NOP3 K8_NOP3
37#define K8_NOP7 K8_NOP4 K8_NOP3
38#define K8_NOP8 K8_NOP4 K8_NOP4
39
40/* K7 nops
41 uses eax dependencies (arbitary choice)
42 1: nop
43 2: movl %eax,%eax
44 3: leal (,%eax,1),%eax
45 4: leal 0x00(,%eax,1),%eax
46 6: leal 0x00000000(%eax),%eax
47 7: leal 0x00000000(,%eax,1),%eax
48*/
49#define K7_NOP1 GENERIC_NOP1
50#define K7_NOP2 ".byte 0x8b,0xc0\n"
51#define K7_NOP3 ".byte 0x8d,0x04,0x20\n"
52#define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n"
53#define K7_NOP5 K7_NOP4 ASM_NOP1
54#define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n"
55#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n"
56#define K7_NOP8 K7_NOP7 ASM_NOP1
57
58/* P6 nops
59 uses eax dependencies (Intel-recommended choice)
60 1: nop
61 2: osp nop
62 3: nopl (%eax)
63 4: nopl 0x00(%eax)
64 5: nopl 0x00(%eax,%eax,1)
65 6: osp nopl 0x00(%eax,%eax,1)
66 7: nopl 0x00000000(%eax)
67 8: nopl 0x00000000(%eax,%eax,1)
68*/
69#define P6_NOP1 GENERIC_NOP1
70#define P6_NOP2 ".byte 0x66,0x90\n"
71#define P6_NOP3 ".byte 0x0f,0x1f,0x00\n"
72#define P6_NOP4 ".byte 0x0f,0x1f,0x40,0\n"
73#define P6_NOP5 ".byte 0x0f,0x1f,0x44,0x00,0\n"
74#define P6_NOP6 ".byte 0x66,0x0f,0x1f,0x44,0x00,0\n"
75#define P6_NOP7 ".byte 0x0f,0x1f,0x80,0,0,0,0\n"
76#define P6_NOP8 ".byte 0x0f,0x1f,0x84,0x00,0,0,0,0\n"
77
78#if defined(CONFIG_MK7)
79#define ASM_NOP1 K7_NOP1
80#define ASM_NOP2 K7_NOP2
81#define ASM_NOP3 K7_NOP3
82#define ASM_NOP4 K7_NOP4
83#define ASM_NOP5 K7_NOP5
84#define ASM_NOP6 K7_NOP6
85#define ASM_NOP7 K7_NOP7
86#define ASM_NOP8 K7_NOP8
87#elif defined(CONFIG_X86_P6_NOP)
88#define ASM_NOP1 P6_NOP1
89#define ASM_NOP2 P6_NOP2
90#define ASM_NOP3 P6_NOP3
91#define ASM_NOP4 P6_NOP4
92#define ASM_NOP5 P6_NOP5
93#define ASM_NOP6 P6_NOP6
94#define ASM_NOP7 P6_NOP7
95#define ASM_NOP8 P6_NOP8
96#elif defined(CONFIG_X86_64)
97#define ASM_NOP1 K8_NOP1
98#define ASM_NOP2 K8_NOP2
99#define ASM_NOP3 K8_NOP3
100#define ASM_NOP4 K8_NOP4
101#define ASM_NOP5 K8_NOP5
102#define ASM_NOP6 K8_NOP6
103#define ASM_NOP7 K8_NOP7
104#define ASM_NOP8 K8_NOP8
105#else
106#define ASM_NOP1 GENERIC_NOP1
107#define ASM_NOP2 GENERIC_NOP2
108#define ASM_NOP3 GENERIC_NOP3
109#define ASM_NOP4 GENERIC_NOP4
110#define ASM_NOP5 GENERIC_NOP5
111#define ASM_NOP6 GENERIC_NOP6
112#define ASM_NOP7 GENERIC_NOP7
113#define ASM_NOP8 GENERIC_NOP8
114#endif
115
116#define ASM_NOP_MAX 8
117
118#endif
diff --git a/include/asm-x86/numa.h b/include/asm-x86/numa.h
deleted file mode 100644
index 27da400d3138..000000000000
--- a/include/asm-x86/numa.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "numa_32.h"
3#else
4# include "numa_64.h"
5#endif
diff --git a/include/asm-x86/numa_32.h b/include/asm-x86/numa_32.h
deleted file mode 100644
index 220d7b7707a0..000000000000
--- a/include/asm-x86/numa_32.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ASM_X86_32_NUMA_H
2#define _ASM_X86_32_NUMA_H 1
3
4extern int pxm_to_nid(int pxm);
5extern void numa_remove_cpu(int cpu);
6
7#ifdef CONFIG_NUMA
8extern void set_highmem_pages_init(void);
9#endif
10
11#endif /* _ASM_X86_32_NUMA_H */
diff --git a/include/asm-x86/numa_64.h b/include/asm-x86/numa_64.h
deleted file mode 100644
index 3830094434a9..000000000000
--- a/include/asm-x86/numa_64.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef _ASM_X8664_NUMA_H
2#define _ASM_X8664_NUMA_H 1
3
4#include <linux/nodemask.h>
5#include <asm/apicdef.h>
6
7struct bootnode {
8 u64 start;
9 u64 end;
10};
11
12extern int compute_hash_shift(struct bootnode *nodes, int numblks,
13 int *nodeids);
14
15#define ZONE_ALIGN (1UL << (MAX_ORDER+PAGE_SHIFT))
16
17extern void numa_init_array(void);
18extern int numa_off;
19
20extern void srat_reserve_add_area(int nodeid);
21extern int hotadd_percent;
22
23extern s16 apicid_to_node[MAX_LOCAL_APIC];
24
25extern unsigned long numa_free_all_bootmem(void);
26extern void setup_node_bootmem(int nodeid, unsigned long start,
27 unsigned long end);
28
29#ifdef CONFIG_NUMA
30extern void __init init_cpu_to_node(void);
31extern void __cpuinit numa_set_node(int cpu, int node);
32extern void __cpuinit numa_clear_node(int cpu);
33extern void __cpuinit numa_add_cpu(int cpu);
34extern void __cpuinit numa_remove_cpu(int cpu);
35#else
36static inline void init_cpu_to_node(void) { }
37static inline void numa_set_node(int cpu, int node) { }
38static inline void numa_clear_node(int cpu) { }
39static inline void numa_add_cpu(int cpu, int node) { }
40static inline void numa_remove_cpu(int cpu) { }
41#endif
42
43#endif
diff --git a/include/asm-x86/numaq.h b/include/asm-x86/numaq.h
deleted file mode 100644
index 34b92d581fa3..000000000000
--- a/include/asm-x86/numaq.h
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * Written by: Patricia Gaughen, IBM Corporation
3 *
4 * Copyright (C) 2002, IBM Corp.
5 *
6 * All rights reserved.
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, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
16 * NON INFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * Send feedback to <gone@us.ibm.com>
24 */
25
26#ifndef NUMAQ_H
27#define NUMAQ_H
28
29#ifdef CONFIG_X86_NUMAQ
30
31extern int found_numaq;
32extern int get_memcfg_numaq(void);
33
34/*
35 * SYS_CFG_DATA_PRIV_ADDR, struct eachquadmem, and struct sys_cfg_data are the
36 */
37#define SYS_CFG_DATA_PRIV_ADDR 0x0009d000 /* place for scd in private
38 quad space */
39
40/*
41 * Communication area for each processor on lynxer-processor tests.
42 *
43 * NOTE: If you change the size of this eachproc structure you need
44 * to change the definition for EACH_QUAD_SIZE.
45 */
46struct eachquadmem {
47 unsigned int priv_mem_start; /* Starting address of this */
48 /* quad's private memory. */
49 /* This is always 0. */
50 /* In MB. */
51 unsigned int priv_mem_size; /* Size of this quad's */
52 /* private memory. */
53 /* In MB. */
54 unsigned int low_shrd_mem_strp_start;/* Starting address of this */
55 /* quad's low shared block */
56 /* (untranslated). */
57 /* In MB. */
58 unsigned int low_shrd_mem_start; /* Starting address of this */
59 /* quad's low shared memory */
60 /* (untranslated). */
61 /* In MB. */
62 unsigned int low_shrd_mem_size; /* Size of this quad's low */
63 /* shared memory. */
64 /* In MB. */
65 unsigned int lmmio_copb_start; /* Starting address of this */
66 /* quad's local memory */
67 /* mapped I/O in the */
68 /* compatibility OPB. */
69 /* In MB. */
70 unsigned int lmmio_copb_size; /* Size of this quad's local */
71 /* memory mapped I/O in the */
72 /* compatibility OPB. */
73 /* In MB. */
74 unsigned int lmmio_nopb_start; /* Starting address of this */
75 /* quad's local memory */
76 /* mapped I/O in the */
77 /* non-compatibility OPB. */
78 /* In MB. */
79 unsigned int lmmio_nopb_size; /* Size of this quad's local */
80 /* memory mapped I/O in the */
81 /* non-compatibility OPB. */
82 /* In MB. */
83 unsigned int io_apic_0_start; /* Starting address of I/O */
84 /* APIC 0. */
85 unsigned int io_apic_0_sz; /* Size I/O APIC 0. */
86 unsigned int io_apic_1_start; /* Starting address of I/O */
87 /* APIC 1. */
88 unsigned int io_apic_1_sz; /* Size I/O APIC 1. */
89 unsigned int hi_shrd_mem_start; /* Starting address of this */
90 /* quad's high shared memory.*/
91 /* In MB. */
92 unsigned int hi_shrd_mem_size; /* Size of this quad's high */
93 /* shared memory. */
94 /* In MB. */
95 unsigned int mps_table_addr; /* Address of this quad's */
96 /* MPS tables from BIOS, */
97 /* in system space.*/
98 unsigned int lcl_MDC_pio_addr; /* Port-I/O address for */
99 /* local access of MDC. */
100 unsigned int rmt_MDC_mmpio_addr; /* MM-Port-I/O address for */
101 /* remote access of MDC. */
102 unsigned int mm_port_io_start; /* Starting address of this */
103 /* quad's memory mapped Port */
104 /* I/O space. */
105 unsigned int mm_port_io_size; /* Size of this quad's memory*/
106 /* mapped Port I/O space. */
107 unsigned int mm_rmt_io_apic_start; /* Starting address of this */
108 /* quad's memory mapped */
109 /* remote I/O APIC space. */
110 unsigned int mm_rmt_io_apic_size; /* Size of this quad's memory*/
111 /* mapped remote I/O APIC */
112 /* space. */
113 unsigned int mm_isa_start; /* Starting address of this */
114 /* quad's memory mapped ISA */
115 /* space (contains MDC */
116 /* memory space). */
117 unsigned int mm_isa_size; /* Size of this quad's memory*/
118 /* mapped ISA space (contains*/
119 /* MDC memory space). */
120 unsigned int rmt_qmi_addr; /* Remote addr to access QMI.*/
121 unsigned int lcl_qmi_addr; /* Local addr to access QMI. */
122};
123
124/*
125 * Note: This structure must be NOT be changed unless the multiproc and
126 * OS are changed to reflect the new structure.
127 */
128struct sys_cfg_data {
129 unsigned int quad_id;
130 unsigned int bsp_proc_id; /* Boot Strap Processor in this quad. */
131 unsigned int scd_version; /* Version number of this table. */
132 unsigned int first_quad_id;
133 unsigned int quads_present31_0; /* 1 bit for each quad */
134 unsigned int quads_present63_32; /* 1 bit for each quad */
135 unsigned int config_flags;
136 unsigned int boot_flags;
137 unsigned int csr_start_addr; /* Absolute value (not in MB) */
138 unsigned int csr_size; /* Absolute value (not in MB) */
139 unsigned int lcl_apic_start_addr; /* Absolute value (not in MB) */
140 unsigned int lcl_apic_size; /* Absolute value (not in MB) */
141 unsigned int low_shrd_mem_base; /* 0 or 512MB or 1GB */
142 unsigned int low_shrd_mem_quad_offset; /* 0,128M,256M,512M,1G */
143 /* may not be totally populated */
144 unsigned int split_mem_enbl; /* 0 for no low shared memory */
145 unsigned int mmio_sz; /* Size of total system memory mapped I/O */
146 /* (in MB). */
147 unsigned int quad_spin_lock; /* Spare location used for quad */
148 /* bringup. */
149 unsigned int nonzero55; /* For checksumming. */
150 unsigned int nonzeroaa; /* For checksumming. */
151 unsigned int scd_magic_number;
152 unsigned int system_type;
153 unsigned int checksum;
154 /*
155 * memory configuration area for each quad
156 */
157 struct eachquadmem eq[MAX_NUMNODES]; /* indexed by quad id */
158};
159
160void numaq_tsc_disable(void);
161
162#else
163static inline int get_memcfg_numaq(void)
164{
165 return 0;
166}
167#endif /* CONFIG_X86_NUMAQ */
168#endif /* NUMAQ_H */
169
diff --git a/include/asm-x86/olpc.h b/include/asm-x86/olpc.h
deleted file mode 100644
index 97d47133486f..000000000000
--- a/include/asm-x86/olpc.h
+++ /dev/null
@@ -1,132 +0,0 @@
1/* OLPC machine specific definitions */
2
3#ifndef ASM_OLPC_H_
4#define ASM_OLPC_H_
5
6#include <asm/geode.h>
7
8struct olpc_platform_t {
9 int flags;
10 uint32_t boardrev;
11 int ecver;
12};
13
14#define OLPC_F_PRESENT 0x01
15#define OLPC_F_DCON 0x02
16#define OLPC_F_VSA 0x04
17
18#ifdef CONFIG_OLPC
19
20extern struct olpc_platform_t olpc_platform_info;
21
22/*
23 * OLPC board IDs contain the major build number within the mask 0x0ff0,
24 * and the minor build number withing 0x000f. Pre-builds have a minor
25 * number less than 8, and normal builds start at 8. For example, 0x0B10
26 * is a PreB1, and 0x0C18 is a C1.
27 */
28
29static inline uint32_t olpc_board(uint8_t id)
30{
31 return (id << 4) | 0x8;
32}
33
34static inline uint32_t olpc_board_pre(uint8_t id)
35{
36 return id << 4;
37}
38
39static inline int machine_is_olpc(void)
40{
41 return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
42}
43
44/*
45 * The DCON is OLPC's Display Controller. It has a number of unique
46 * features that we might want to take advantage of..
47 */
48static inline int olpc_has_dcon(void)
49{
50 return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
51}
52
53/*
54 * The VSA is software from AMD that typical Geode bioses will include.
55 * It is used to emulate the PCI bus, VGA, etc. OLPC's Open Firmware does
56 * not include the VSA; instead, PCI is emulated by the kernel.
57 *
58 * The VSA is described further in arch/x86/pci/olpc.c.
59 */
60static inline int olpc_has_vsa(void)
61{
62 return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0;
63}
64
65/*
66 * The "Mass Production" version of OLPC's XO is identified as being model
67 * C2. During the prototype phase, the following models (in chronological
68 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models
69 * were based on Geode GX CPUs, and models after that were based upon
70 * Geode LX CPUs. There were also some hand-assembled models floating
71 * around, referred to as PreB1, PreB2, etc.
72 */
73static inline int olpc_board_at_least(uint32_t rev)
74{
75 return olpc_platform_info.boardrev >= rev;
76}
77
78#else
79
80static inline int machine_is_olpc(void)
81{
82 return 0;
83}
84
85static inline int olpc_has_dcon(void)
86{
87 return 0;
88}
89
90static inline int olpc_has_vsa(void)
91{
92 return 0;
93}
94
95#endif
96
97/* EC related functions */
98
99extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
100 unsigned char *outbuf, size_t outlen);
101
102extern int olpc_ec_mask_set(uint8_t bits);
103extern int olpc_ec_mask_unset(uint8_t bits);
104
105/* EC commands */
106
107#define EC_FIRMWARE_REV 0x08
108
109/* SCI source values */
110
111#define EC_SCI_SRC_EMPTY 0x00
112#define EC_SCI_SRC_GAME 0x01
113#define EC_SCI_SRC_BATTERY 0x02
114#define EC_SCI_SRC_BATSOC 0x04
115#define EC_SCI_SRC_BATERR 0x08
116#define EC_SCI_SRC_EBOOK 0x10
117#define EC_SCI_SRC_WLAN 0x20
118#define EC_SCI_SRC_ACPWR 0x40
119#define EC_SCI_SRC_ALL 0x7F
120
121/* GPIO assignments */
122
123#define OLPC_GPIO_MIC_AC geode_gpio(1)
124#define OLPC_GPIO_DCON_IRQ geode_gpio(7)
125#define OLPC_GPIO_THRM_ALRM geode_gpio(10)
126#define OLPC_GPIO_SMB_CLK geode_gpio(14)
127#define OLPC_GPIO_SMB_DATA geode_gpio(15)
128#define OLPC_GPIO_WORKAUX geode_gpio(24)
129#define OLPC_GPIO_LID geode_gpio(26)
130#define OLPC_GPIO_ECSCI geode_gpio(27)
131
132#endif
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
deleted file mode 100644
index 49982110e4d9..000000000000
--- a/include/asm-x86/page.h
+++ /dev/null
@@ -1,202 +0,0 @@
1#ifndef _ASM_X86_PAGE_H
2#define _ASM_X86_PAGE_H
3
4#include <linux/const.h>
5
6/* PAGE_SHIFT determines the page size */
7#define PAGE_SHIFT 12
8#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9#define PAGE_MASK (~(PAGE_SIZE-1))
10
11#ifdef __KERNEL__
12
13#define __PHYSICAL_MASK ((phys_addr_t)(1ULL << __PHYSICAL_MASK_SHIFT) - 1)
14#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1)
15
16/* Cast PAGE_MASK to a signed type so that it is sign-extended if
17 virtual addresses are 32-bits but physical addresses are larger
18 (ie, 32-bit PAE). */
19#define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK)
20
21/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */
22#define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK)
23
24/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */
25#define PTE_FLAGS_MASK (~PTE_PFN_MASK)
26
27#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)
28#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1))
29
30#define HPAGE_SHIFT PMD_SHIFT
31#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
32#define HPAGE_MASK (~(HPAGE_SIZE - 1))
33#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
34
35#define HUGE_MAX_HSTATE 2
36
37#ifndef __ASSEMBLY__
38#include <linux/types.h>
39#endif
40
41#ifdef CONFIG_X86_64
42#include <asm/page_64.h>
43#else
44#include <asm/page_32.h>
45#endif /* CONFIG_X86_64 */
46
47#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
48
49#define VM_DATA_DEFAULT_FLAGS \
50 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
51 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
52
53
54#ifndef __ASSEMBLY__
55
56typedef struct { pgdval_t pgd; } pgd_t;
57typedef struct { pgprotval_t pgprot; } pgprot_t;
58
59extern int page_is_ram(unsigned long pagenr);
60extern int devmem_is_allowed(unsigned long pagenr);
61extern void map_devmem(unsigned long pfn, unsigned long size,
62 pgprot_t vma_prot);
63extern void unmap_devmem(unsigned long pfn, unsigned long size,
64 pgprot_t vma_prot);
65
66extern unsigned long max_low_pfn_mapped;
67extern unsigned long max_pfn_mapped;
68
69struct page;
70
71static inline void clear_user_page(void *page, unsigned long vaddr,
72 struct page *pg)
73{
74 clear_page(page);
75}
76
77static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
78 struct page *topage)
79{
80 copy_page(to, from);
81}
82
83#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
84 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
85#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
86
87static inline pgd_t native_make_pgd(pgdval_t val)
88{
89 return (pgd_t) { val };
90}
91
92static inline pgdval_t native_pgd_val(pgd_t pgd)
93{
94 return pgd.pgd;
95}
96
97#if PAGETABLE_LEVELS >= 3
98#if PAGETABLE_LEVELS == 4
99typedef struct { pudval_t pud; } pud_t;
100
101static inline pud_t native_make_pud(pmdval_t val)
102{
103 return (pud_t) { val };
104}
105
106static inline pudval_t native_pud_val(pud_t pud)
107{
108 return pud.pud;
109}
110#else /* PAGETABLE_LEVELS == 3 */
111#include <asm-generic/pgtable-nopud.h>
112
113static inline pudval_t native_pud_val(pud_t pud)
114{
115 return native_pgd_val(pud.pgd);
116}
117#endif /* PAGETABLE_LEVELS == 4 */
118
119typedef struct { pmdval_t pmd; } pmd_t;
120
121static inline pmd_t native_make_pmd(pmdval_t val)
122{
123 return (pmd_t) { val };
124}
125
126static inline pmdval_t native_pmd_val(pmd_t pmd)
127{
128 return pmd.pmd;
129}
130#else /* PAGETABLE_LEVELS == 2 */
131#include <asm-generic/pgtable-nopmd.h>
132
133static inline pmdval_t native_pmd_val(pmd_t pmd)
134{
135 return native_pgd_val(pmd.pud.pgd);
136}
137#endif /* PAGETABLE_LEVELS >= 3 */
138
139static inline pte_t native_make_pte(pteval_t val)
140{
141 return (pte_t) { .pte = val };
142}
143
144static inline pteval_t native_pte_val(pte_t pte)
145{
146 return pte.pte;
147}
148
149static inline pteval_t native_pte_flags(pte_t pte)
150{
151 return native_pte_val(pte) & PTE_FLAGS_MASK;
152}
153
154#define pgprot_val(x) ((x).pgprot)
155#define __pgprot(x) ((pgprot_t) { (x) } )
156
157#ifdef CONFIG_PARAVIRT
158#include <asm/paravirt.h>
159#else /* !CONFIG_PARAVIRT */
160
161#define pgd_val(x) native_pgd_val(x)
162#define __pgd(x) native_make_pgd(x)
163
164#ifndef __PAGETABLE_PUD_FOLDED
165#define pud_val(x) native_pud_val(x)
166#define __pud(x) native_make_pud(x)
167#endif
168
169#ifndef __PAGETABLE_PMD_FOLDED
170#define pmd_val(x) native_pmd_val(x)
171#define __pmd(x) native_make_pmd(x)
172#endif
173
174#define pte_val(x) native_pte_val(x)
175#define pte_flags(x) native_pte_flags(x)
176#define __pte(x) native_make_pte(x)
177
178#endif /* CONFIG_PARAVIRT */
179
180#define __pa(x) __phys_addr((unsigned long)(x))
181/* __pa_symbol should be used for C visible symbols.
182 This seems to be the official gcc blessed way to do such arithmetic. */
183#define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x)))
184
185#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
186
187#define __boot_va(x) __va(x)
188#define __boot_pa(x) __pa(x)
189
190#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
191#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
192#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
193
194#endif /* __ASSEMBLY__ */
195
196#include <asm-generic/memory_model.h>
197#include <asm-generic/page.h>
198
199#define __HAVE_ARCH_GATE_AREA 1
200
201#endif /* __KERNEL__ */
202#endif /* _ASM_X86_PAGE_H */
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
deleted file mode 100644
index ab8528793f08..000000000000
--- a/include/asm-x86/page_32.h
+++ /dev/null
@@ -1,129 +0,0 @@
1#ifndef _ASM_X86_PAGE_32_H
2#define _ASM_X86_PAGE_32_H
3
4/*
5 * This handles the memory map.
6 *
7 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
8 * a virtual address space of one gigabyte, which limits the
9 * amount of physical memory you can use to about 950MB.
10 *
11 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
12 * and CONFIG_HIGHMEM64G options in the kernel configuration.
13 */
14#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
15
16#ifdef CONFIG_4KSTACKS
17#define THREAD_ORDER 0
18#else
19#define THREAD_ORDER 1
20#endif
21#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
22
23
24#ifdef CONFIG_X86_PAE
25/* 44=32+12, the limit we can fit into an unsigned long pfn */
26#define __PHYSICAL_MASK_SHIFT 44
27#define __VIRTUAL_MASK_SHIFT 32
28#define PAGETABLE_LEVELS 3
29
30#ifndef __ASSEMBLY__
31typedef u64 pteval_t;
32typedef u64 pmdval_t;
33typedef u64 pudval_t;
34typedef u64 pgdval_t;
35typedef u64 pgprotval_t;
36typedef u64 phys_addr_t;
37
38typedef union {
39 struct {
40 unsigned long pte_low, pte_high;
41 };
42 pteval_t pte;
43} pte_t;
44#endif /* __ASSEMBLY__
45 */
46#else /* !CONFIG_X86_PAE */
47#define __PHYSICAL_MASK_SHIFT 32
48#define __VIRTUAL_MASK_SHIFT 32
49#define PAGETABLE_LEVELS 2
50
51#ifndef __ASSEMBLY__
52typedef unsigned long pteval_t;
53typedef unsigned long pmdval_t;
54typedef unsigned long pudval_t;
55typedef unsigned long pgdval_t;
56typedef unsigned long pgprotval_t;
57typedef unsigned long phys_addr_t;
58
59typedef union {
60 pteval_t pte;
61 pteval_t pte_low;
62} pte_t;
63
64#endif /* __ASSEMBLY__ */
65#endif /* CONFIG_X86_PAE */
66
67#ifndef __ASSEMBLY__
68typedef struct page *pgtable_t;
69#endif
70
71#ifdef CONFIG_HUGETLB_PAGE
72#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
73#endif
74
75#ifndef __ASSEMBLY__
76#define __phys_addr(x) ((x) - PAGE_OFFSET)
77#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
78
79#ifdef CONFIG_FLATMEM
80#define pfn_valid(pfn) ((pfn) < max_mapnr)
81#endif /* CONFIG_FLATMEM */
82
83extern int nx_enabled;
84
85/*
86 * This much address space is reserved for vmalloc() and iomap()
87 * as well as fixmap mappings.
88 */
89extern unsigned int __VMALLOC_RESERVE;
90extern int sysctl_legacy_va_layout;
91
92#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
93#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
94
95extern void find_low_pfn_range(void);
96extern unsigned long init_memory_mapping(unsigned long start,
97 unsigned long end);
98extern void initmem_init(unsigned long, unsigned long);
99extern void setup_bootmem_allocator(void);
100
101
102#ifdef CONFIG_X86_USE_3DNOW
103#include <asm/mmx.h>
104
105static inline void clear_page(void *page)
106{
107 mmx_clear_page(page);
108}
109
110static inline void copy_page(void *to, void *from)
111{
112 mmx_copy_page(to, from);
113}
114#else /* !CONFIG_X86_USE_3DNOW */
115#include <linux/string.h>
116
117static inline void clear_page(void *page)
118{
119 memset(page, 0, PAGE_SIZE);
120}
121
122static inline void copy_page(void *to, void *from)
123{
124 memcpy(to, from, PAGE_SIZE);
125}
126#endif /* CONFIG_X86_3DNOW */
127#endif /* !__ASSEMBLY__ */
128
129#endif /* _ASM_X86_PAGE_32_H */
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
deleted file mode 100644
index c6916c83e6b1..000000000000
--- a/include/asm-x86/page_64.h
+++ /dev/null
@@ -1,105 +0,0 @@
1#ifndef _X86_64_PAGE_H
2#define _X86_64_PAGE_H
3
4#define PAGETABLE_LEVELS 4
5
6#define THREAD_ORDER 1
7#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
8#define CURRENT_MASK (~(THREAD_SIZE - 1))
9
10#define EXCEPTION_STACK_ORDER 0
11#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
12
13#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
14#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
15
16#define IRQSTACK_ORDER 2
17#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
18
19#define STACKFAULT_STACK 1
20#define DOUBLEFAULT_STACK 2
21#define NMI_STACK 3
22#define DEBUG_STACK 4
23#define MCE_STACK 5
24#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
25
26#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
27#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
28
29/*
30 * Set __PAGE_OFFSET to the most negative possible address +
31 * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a
32 * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's
33 * what Xen requires.
34 */
35#define __PAGE_OFFSET _AC(0xffff880000000000, UL)
36
37#define __PHYSICAL_START CONFIG_PHYSICAL_START
38#define __KERNEL_ALIGN 0x200000
39
40/*
41 * Make sure kernel is aligned to 2MB address. Catching it at compile
42 * time is better. Change your config file and compile the kernel
43 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
44 */
45#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
46#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
47#endif
48
49#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
50#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
51
52/* See Documentation/x86_64/mm.txt for a description of the memory map. */
53#define __PHYSICAL_MASK_SHIFT 46
54#define __VIRTUAL_MASK_SHIFT 48
55
56/*
57 * Kernel image size is limited to 512 MB (see level2_kernel_pgt in
58 * arch/x86/kernel/head_64.S), and it is mapped here:
59 */
60#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
61#define KERNEL_IMAGE_START _AC(0xffffffff80000000, UL)
62
63#ifndef __ASSEMBLY__
64void clear_page(void *page);
65void copy_page(void *to, void *from);
66
67/* duplicated to the one in bootmem.h */
68extern unsigned long max_pfn;
69extern unsigned long phys_base;
70
71extern unsigned long __phys_addr(unsigned long);
72#define __phys_reloc_hide(x) (x)
73
74/*
75 * These are used to make use of C type-checking..
76 */
77typedef unsigned long pteval_t;
78typedef unsigned long pmdval_t;
79typedef unsigned long pudval_t;
80typedef unsigned long pgdval_t;
81typedef unsigned long pgprotval_t;
82typedef unsigned long phys_addr_t;
83
84typedef struct page *pgtable_t;
85
86typedef struct { pteval_t pte; } pte_t;
87
88#define vmemmap ((struct page *)VMEMMAP_START)
89
90extern unsigned long init_memory_mapping(unsigned long start,
91 unsigned long end);
92
93extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn);
94
95extern void init_extra_mapping_uc(unsigned long phys, unsigned long size);
96extern void init_extra_mapping_wb(unsigned long phys, unsigned long size);
97
98#endif /* !__ASSEMBLY__ */
99
100#ifdef CONFIG_FLATMEM
101#define pfn_valid(pfn) ((pfn) < max_pfn)
102#endif
103
104
105#endif /* _X86_64_PAGE_H */
diff --git a/include/asm-x86/param.h b/include/asm-x86/param.h
deleted file mode 100644
index 6f0d0422f4ca..000000000000
--- a/include/asm-x86/param.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_X86_PARAM_H
2#define _ASM_X86_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
6# define USER_HZ 100 /* some user interfaces are */
7# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 4096
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif /* _ASM_X86_PARAM_H */
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
deleted file mode 100644
index fbbde93f12d6..000000000000
--- a/include/asm-x86/paravirt.h
+++ /dev/null
@@ -1,1637 +0,0 @@
1#ifndef __ASM_PARAVIRT_H
2#define __ASM_PARAVIRT_H
3/* Various instructions on x86 need to be replaced for
4 * para-virtualization: those hooks are defined here. */
5
6#ifdef CONFIG_PARAVIRT
7#include <asm/page.h>
8#include <asm/asm.h>
9
10/* Bitmask of what can be clobbered: usually at least eax. */
11#define CLBR_NONE 0
12#define CLBR_EAX (1 << 0)
13#define CLBR_ECX (1 << 1)
14#define CLBR_EDX (1 << 2)
15
16#ifdef CONFIG_X86_64
17#define CLBR_RSI (1 << 3)
18#define CLBR_RDI (1 << 4)
19#define CLBR_R8 (1 << 5)
20#define CLBR_R9 (1 << 6)
21#define CLBR_R10 (1 << 7)
22#define CLBR_R11 (1 << 8)
23#define CLBR_ANY ((1 << 9) - 1)
24#include <asm/desc_defs.h>
25#else
26/* CLBR_ANY should match all regs platform has. For i386, that's just it */
27#define CLBR_ANY ((1 << 3) - 1)
28#endif /* X86_64 */
29
30#ifndef __ASSEMBLY__
31#include <linux/types.h>
32#include <linux/cpumask.h>
33#include <asm/kmap_types.h>
34#include <asm/desc_defs.h>
35
36struct page;
37struct thread_struct;
38struct desc_ptr;
39struct tss_struct;
40struct mm_struct;
41struct desc_struct;
42
43/* general info */
44struct pv_info {
45 unsigned int kernel_rpl;
46 int shared_kernel_pmd;
47 int paravirt_enabled;
48 const char *name;
49};
50
51struct pv_init_ops {
52 /*
53 * Patch may replace one of the defined code sequences with
54 * arbitrary code, subject to the same register constraints.
55 * This generally means the code is not free to clobber any
56 * registers other than EAX. The patch function should return
57 * the number of bytes of code generated, as we nop pad the
58 * rest in generic code.
59 */
60 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
61 unsigned long addr, unsigned len);
62
63 /* Basic arch-specific setup */
64 void (*arch_setup)(void);
65 char *(*memory_setup)(void);
66 void (*post_allocator_init)(void);
67
68 /* Print a banner to identify the environment */
69 void (*banner)(void);
70};
71
72
73struct pv_lazy_ops {
74 /* Set deferred update mode, used for batching operations. */
75 void (*enter)(void);
76 void (*leave)(void);
77};
78
79struct pv_time_ops {
80 void (*time_init)(void);
81
82 /* Set and set time of day */
83 unsigned long (*get_wallclock)(void);
84 int (*set_wallclock)(unsigned long);
85
86 unsigned long long (*sched_clock)(void);
87 unsigned long (*get_tsc_khz)(void);
88};
89
90struct pv_cpu_ops {
91 /* hooks for various privileged instructions */
92 unsigned long (*get_debugreg)(int regno);
93 void (*set_debugreg)(int regno, unsigned long value);
94
95 void (*clts)(void);
96
97 unsigned long (*read_cr0)(void);
98 void (*write_cr0)(unsigned long);
99
100 unsigned long (*read_cr4_safe)(void);
101 unsigned long (*read_cr4)(void);
102 void (*write_cr4)(unsigned long);
103
104#ifdef CONFIG_X86_64
105 unsigned long (*read_cr8)(void);
106 void (*write_cr8)(unsigned long);
107#endif
108
109 /* Segment descriptor handling */
110 void (*load_tr_desc)(void);
111 void (*load_gdt)(const struct desc_ptr *);
112 void (*load_idt)(const struct desc_ptr *);
113 void (*store_gdt)(struct desc_ptr *);
114 void (*store_idt)(struct desc_ptr *);
115 void (*set_ldt)(const void *desc, unsigned entries);
116 unsigned long (*store_tr)(void);
117 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
118#ifdef CONFIG_X86_64
119 void (*load_gs_index)(unsigned int idx);
120#endif
121 void (*write_ldt_entry)(struct desc_struct *ldt, int entrynum,
122 const void *desc);
123 void (*write_gdt_entry)(struct desc_struct *,
124 int entrynum, const void *desc, int size);
125 void (*write_idt_entry)(gate_desc *,
126 int entrynum, const gate_desc *gate);
127 void (*load_sp0)(struct tss_struct *tss, struct thread_struct *t);
128
129 void (*set_iopl_mask)(unsigned mask);
130
131 void (*wbinvd)(void);
132 void (*io_delay)(void);
133
134 /* cpuid emulation, mostly so that caps bits can be disabled */
135 void (*cpuid)(unsigned int *eax, unsigned int *ebx,
136 unsigned int *ecx, unsigned int *edx);
137
138 /* MSR, PMC and TSR operations.
139 err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
140 u64 (*read_msr)(unsigned int msr, int *err);
141 int (*write_msr)(unsigned int msr, unsigned low, unsigned high);
142
143 u64 (*read_tsc)(void);
144 u64 (*read_pmc)(int counter);
145 unsigned long long (*read_tscp)(unsigned int *aux);
146
147 /*
148 * Atomically enable interrupts and return to userspace. This
149 * is only ever used to return to 32-bit processes; in a
150 * 64-bit kernel, it's used for 32-on-64 compat processes, but
151 * never native 64-bit processes. (Jump, not call.)
152 */
153 void (*irq_enable_sysexit)(void);
154
155 /*
156 * Switch to usermode gs and return to 64-bit usermode using
157 * sysret. Only used in 64-bit kernels to return to 64-bit
158 * processes. Usermode register state, including %rsp, must
159 * already be restored.
160 */
161 void (*usergs_sysret64)(void);
162
163 /*
164 * Switch to usermode gs and return to 32-bit usermode using
165 * sysret. Used to return to 32-on-64 compat processes.
166 * Other usermode register state, including %esp, must already
167 * be restored.
168 */
169 void (*usergs_sysret32)(void);
170
171 /* Normal iret. Jump to this with the standard iret stack
172 frame set up. */
173 void (*iret)(void);
174
175 void (*swapgs)(void);
176
177 struct pv_lazy_ops lazy_mode;
178};
179
180struct pv_irq_ops {
181 void (*init_IRQ)(void);
182
183 /*
184 * Get/set interrupt state. save_fl and restore_fl are only
185 * expected to use X86_EFLAGS_IF; all other bits
186 * returned from save_fl are undefined, and may be ignored by
187 * restore_fl.
188 */
189 unsigned long (*save_fl)(void);
190 void (*restore_fl)(unsigned long);
191 void (*irq_disable)(void);
192 void (*irq_enable)(void);
193 void (*safe_halt)(void);
194 void (*halt)(void);
195
196#ifdef CONFIG_X86_64
197 void (*adjust_exception_frame)(void);
198#endif
199};
200
201struct pv_apic_ops {
202#ifdef CONFIG_X86_LOCAL_APIC
203 /*
204 * Direct APIC operations, principally for VMI. Ideally
205 * these shouldn't be in this interface.
206 */
207 void (*apic_write)(unsigned long reg, u32 v);
208 u32 (*apic_read)(unsigned long reg);
209 void (*setup_boot_clock)(void);
210 void (*setup_secondary_clock)(void);
211
212 void (*startup_ipi_hook)(int phys_apicid,
213 unsigned long start_eip,
214 unsigned long start_esp);
215#endif
216};
217
218struct pv_mmu_ops {
219 /*
220 * Called before/after init_mm pagetable setup. setup_start
221 * may reset %cr3, and may pre-install parts of the pagetable;
222 * pagetable setup is expected to preserve any existing
223 * mapping.
224 */
225 void (*pagetable_setup_start)(pgd_t *pgd_base);
226 void (*pagetable_setup_done)(pgd_t *pgd_base);
227
228 unsigned long (*read_cr2)(void);
229 void (*write_cr2)(unsigned long);
230
231 unsigned long (*read_cr3)(void);
232 void (*write_cr3)(unsigned long);
233
234 /*
235 * Hooks for intercepting the creation/use/destruction of an
236 * mm_struct.
237 */
238 void (*activate_mm)(struct mm_struct *prev,
239 struct mm_struct *next);
240 void (*dup_mmap)(struct mm_struct *oldmm,
241 struct mm_struct *mm);
242 void (*exit_mmap)(struct mm_struct *mm);
243
244
245 /* TLB operations */
246 void (*flush_tlb_user)(void);
247 void (*flush_tlb_kernel)(void);
248 void (*flush_tlb_single)(unsigned long addr);
249 void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
250 unsigned long va);
251
252 /* Hooks for allocating and freeing a pagetable top-level */
253 int (*pgd_alloc)(struct mm_struct *mm);
254 void (*pgd_free)(struct mm_struct *mm, pgd_t *pgd);
255
256 /*
257 * Hooks for allocating/releasing pagetable pages when they're
258 * attached to a pagetable
259 */
260 void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
261 void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
262 void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
263 void (*alloc_pud)(struct mm_struct *mm, u32 pfn);
264 void (*release_pte)(u32 pfn);
265 void (*release_pmd)(u32 pfn);
266 void (*release_pud)(u32 pfn);
267
268 /* Pagetable manipulation functions */
269 void (*set_pte)(pte_t *ptep, pte_t pteval);
270 void (*set_pte_at)(struct mm_struct *mm, unsigned long addr,
271 pte_t *ptep, pte_t pteval);
272 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
273 void (*pte_update)(struct mm_struct *mm, unsigned long addr,
274 pte_t *ptep);
275 void (*pte_update_defer)(struct mm_struct *mm,
276 unsigned long addr, pte_t *ptep);
277
278 pte_t (*ptep_modify_prot_start)(struct mm_struct *mm, unsigned long addr,
279 pte_t *ptep);
280 void (*ptep_modify_prot_commit)(struct mm_struct *mm, unsigned long addr,
281 pte_t *ptep, pte_t pte);
282
283 pteval_t (*pte_val)(pte_t);
284 pteval_t (*pte_flags)(pte_t);
285 pte_t (*make_pte)(pteval_t pte);
286
287 pgdval_t (*pgd_val)(pgd_t);
288 pgd_t (*make_pgd)(pgdval_t pgd);
289
290#if PAGETABLE_LEVELS >= 3
291#ifdef CONFIG_X86_PAE
292 void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
293 void (*set_pte_present)(struct mm_struct *mm, unsigned long addr,
294 pte_t *ptep, pte_t pte);
295 void (*pte_clear)(struct mm_struct *mm, unsigned long addr,
296 pte_t *ptep);
297 void (*pmd_clear)(pmd_t *pmdp);
298
299#endif /* CONFIG_X86_PAE */
300
301 void (*set_pud)(pud_t *pudp, pud_t pudval);
302
303 pmdval_t (*pmd_val)(pmd_t);
304 pmd_t (*make_pmd)(pmdval_t pmd);
305
306#if PAGETABLE_LEVELS == 4
307 pudval_t (*pud_val)(pud_t);
308 pud_t (*make_pud)(pudval_t pud);
309
310 void (*set_pgd)(pgd_t *pudp, pgd_t pgdval);
311#endif /* PAGETABLE_LEVELS == 4 */
312#endif /* PAGETABLE_LEVELS >= 3 */
313
314#ifdef CONFIG_HIGHPTE
315 void *(*kmap_atomic_pte)(struct page *page, enum km_type type);
316#endif
317
318 struct pv_lazy_ops lazy_mode;
319
320 /* dom0 ops */
321
322 /* Sometimes the physical address is a pfn, and sometimes its
323 an mfn. We can tell which is which from the index. */
324 void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
325 unsigned long phys, pgprot_t flags);
326};
327
328struct raw_spinlock;
329struct pv_lock_ops {
330 int (*spin_is_locked)(struct raw_spinlock *lock);
331 int (*spin_is_contended)(struct raw_spinlock *lock);
332 void (*spin_lock)(struct raw_spinlock *lock);
333 int (*spin_trylock)(struct raw_spinlock *lock);
334 void (*spin_unlock)(struct raw_spinlock *lock);
335};
336
337/* This contains all the paravirt structures: we get a convenient
338 * number for each function using the offset which we use to indicate
339 * what to patch. */
340struct paravirt_patch_template {
341 struct pv_init_ops pv_init_ops;
342 struct pv_time_ops pv_time_ops;
343 struct pv_cpu_ops pv_cpu_ops;
344 struct pv_irq_ops pv_irq_ops;
345 struct pv_apic_ops pv_apic_ops;
346 struct pv_mmu_ops pv_mmu_ops;
347 struct pv_lock_ops pv_lock_ops;
348};
349
350extern struct pv_info pv_info;
351extern struct pv_init_ops pv_init_ops;
352extern struct pv_time_ops pv_time_ops;
353extern struct pv_cpu_ops pv_cpu_ops;
354extern struct pv_irq_ops pv_irq_ops;
355extern struct pv_apic_ops pv_apic_ops;
356extern struct pv_mmu_ops pv_mmu_ops;
357extern struct pv_lock_ops pv_lock_ops;
358
359#define PARAVIRT_PATCH(x) \
360 (offsetof(struct paravirt_patch_template, x) / sizeof(void *))
361
362#define paravirt_type(op) \
363 [paravirt_typenum] "i" (PARAVIRT_PATCH(op)), \
364 [paravirt_opptr] "m" (op)
365#define paravirt_clobber(clobber) \
366 [paravirt_clobber] "i" (clobber)
367
368/*
369 * Generate some code, and mark it as patchable by the
370 * apply_paravirt() alternate instruction patcher.
371 */
372#define _paravirt_alt(insn_string, type, clobber) \
373 "771:\n\t" insn_string "\n" "772:\n" \
374 ".pushsection .parainstructions,\"a\"\n" \
375 _ASM_ALIGN "\n" \
376 _ASM_PTR " 771b\n" \
377 " .byte " type "\n" \
378 " .byte 772b-771b\n" \
379 " .short " clobber "\n" \
380 ".popsection\n"
381
382/* Generate patchable code, with the default asm parameters. */
383#define paravirt_alt(insn_string) \
384 _paravirt_alt(insn_string, "%c[paravirt_typenum]", "%c[paravirt_clobber]")
385
386/* Simple instruction patching code. */
387#define DEF_NATIVE(ops, name, code) \
388 extern const char start_##ops##_##name[], end_##ops##_##name[]; \
389 asm("start_" #ops "_" #name ": " code "; end_" #ops "_" #name ":")
390
391unsigned paravirt_patch_nop(void);
392unsigned paravirt_patch_ignore(unsigned len);
393unsigned paravirt_patch_call(void *insnbuf,
394 const void *target, u16 tgt_clobbers,
395 unsigned long addr, u16 site_clobbers,
396 unsigned len);
397unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
398 unsigned long addr, unsigned len);
399unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
400 unsigned long addr, unsigned len);
401
402unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
403 const char *start, const char *end);
404
405unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
406 unsigned long addr, unsigned len);
407
408int paravirt_disable_iospace(void);
409
410/*
411 * This generates an indirect call based on the operation type number.
412 * The type number, computed in PARAVIRT_PATCH, is derived from the
413 * offset into the paravirt_patch_template structure, and can therefore be
414 * freely converted back into a structure offset.
415 */
416#define PARAVIRT_CALL "call *%[paravirt_opptr];"
417
418/*
419 * These macros are intended to wrap calls through one of the paravirt
420 * ops structs, so that they can be later identified and patched at
421 * runtime.
422 *
423 * Normally, a call to a pv_op function is a simple indirect call:
424 * (pv_op_struct.operations)(args...).
425 *
426 * Unfortunately, this is a relatively slow operation for modern CPUs,
427 * because it cannot necessarily determine what the destination
428 * address is. In this case, the address is a runtime constant, so at
429 * the very least we can patch the call to e a simple direct call, or
430 * ideally, patch an inline implementation into the callsite. (Direct
431 * calls are essentially free, because the call and return addresses
432 * are completely predictable.)
433 *
434 * For i386, these macros rely on the standard gcc "regparm(3)" calling
435 * convention, in which the first three arguments are placed in %eax,
436 * %edx, %ecx (in that order), and the remaining arguments are placed
437 * on the stack. All caller-save registers (eax,edx,ecx) are expected
438 * to be modified (either clobbered or used for return values).
439 * X86_64, on the other hand, already specifies a register-based calling
440 * conventions, returning at %rax, with parameteres going on %rdi, %rsi,
441 * %rdx, and %rcx. Note that for this reason, x86_64 does not need any
442 * special handling for dealing with 4 arguments, unlike i386.
443 * However, x86_64 also have to clobber all caller saved registers, which
444 * unfortunately, are quite a bit (r8 - r11)
445 *
446 * The call instruction itself is marked by placing its start address
447 * and size into the .parainstructions section, so that
448 * apply_paravirt() in arch/i386/kernel/alternative.c can do the
449 * appropriate patching under the control of the backend pv_init_ops
450 * implementation.
451 *
452 * Unfortunately there's no way to get gcc to generate the args setup
453 * for the call, and then allow the call itself to be generated by an
454 * inline asm. Because of this, we must do the complete arg setup and
455 * return value handling from within these macros. This is fairly
456 * cumbersome.
457 *
458 * There are 5 sets of PVOP_* macros for dealing with 0-4 arguments.
459 * It could be extended to more arguments, but there would be little
460 * to be gained from that. For each number of arguments, there are
461 * the two VCALL and CALL variants for void and non-void functions.
462 *
463 * When there is a return value, the invoker of the macro must specify
464 * the return type. The macro then uses sizeof() on that type to
465 * determine whether its a 32 or 64 bit value, and places the return
466 * in the right register(s) (just %eax for 32-bit, and %edx:%eax for
467 * 64-bit). For x86_64 machines, it just returns at %rax regardless of
468 * the return value size.
469 *
470 * 64-bit arguments are passed as a pair of adjacent 32-bit arguments
471 * i386 also passes 64-bit arguments as a pair of adjacent 32-bit arguments
472 * in low,high order
473 *
474 * Small structures are passed and returned in registers. The macro
475 * calling convention can't directly deal with this, so the wrapper
476 * functions must do this.
477 *
478 * These PVOP_* macros are only defined within this header. This
479 * means that all uses must be wrapped in inline functions. This also
480 * makes sure the incoming and outgoing types are always correct.
481 */
482#ifdef CONFIG_X86_32
483#define PVOP_VCALL_ARGS unsigned long __eax, __edx, __ecx
484#define PVOP_CALL_ARGS PVOP_VCALL_ARGS
485#define PVOP_VCALL_CLOBBERS "=a" (__eax), "=d" (__edx), \
486 "=c" (__ecx)
487#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS
488#define EXTRA_CLOBBERS
489#define VEXTRA_CLOBBERS
490#else
491#define PVOP_VCALL_ARGS unsigned long __edi, __esi, __edx, __ecx
492#define PVOP_CALL_ARGS PVOP_VCALL_ARGS, __eax
493#define PVOP_VCALL_CLOBBERS "=D" (__edi), \
494 "=S" (__esi), "=d" (__edx), \
495 "=c" (__ecx)
496
497#define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax)
498
499#define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11"
500#define VEXTRA_CLOBBERS , "rax", "r8", "r9", "r10", "r11"
501#endif
502
503#ifdef CONFIG_PARAVIRT_DEBUG
504#define PVOP_TEST_NULL(op) BUG_ON(op == NULL)
505#else
506#define PVOP_TEST_NULL(op) ((void)op)
507#endif
508
509#define __PVOP_CALL(rettype, op, pre, post, ...) \
510 ({ \
511 rettype __ret; \
512 PVOP_CALL_ARGS; \
513 PVOP_TEST_NULL(op); \
514 /* This is 32-bit specific, but is okay in 64-bit */ \
515 /* since this condition will never hold */ \
516 if (sizeof(rettype) > sizeof(unsigned long)) { \
517 asm volatile(pre \
518 paravirt_alt(PARAVIRT_CALL) \
519 post \
520 : PVOP_CALL_CLOBBERS \
521 : paravirt_type(op), \
522 paravirt_clobber(CLBR_ANY), \
523 ##__VA_ARGS__ \
524 : "memory", "cc" EXTRA_CLOBBERS); \
525 __ret = (rettype)((((u64)__edx) << 32) | __eax); \
526 } else { \
527 asm volatile(pre \
528 paravirt_alt(PARAVIRT_CALL) \
529 post \
530 : PVOP_CALL_CLOBBERS \
531 : paravirt_type(op), \
532 paravirt_clobber(CLBR_ANY), \
533 ##__VA_ARGS__ \
534 : "memory", "cc" EXTRA_CLOBBERS); \
535 __ret = (rettype)__eax; \
536 } \
537 __ret; \
538 })
539#define __PVOP_VCALL(op, pre, post, ...) \
540 ({ \
541 PVOP_VCALL_ARGS; \
542 PVOP_TEST_NULL(op); \
543 asm volatile(pre \
544 paravirt_alt(PARAVIRT_CALL) \
545 post \
546 : PVOP_VCALL_CLOBBERS \
547 : paravirt_type(op), \
548 paravirt_clobber(CLBR_ANY), \
549 ##__VA_ARGS__ \
550 : "memory", "cc" VEXTRA_CLOBBERS); \
551 })
552
553#define PVOP_CALL0(rettype, op) \
554 __PVOP_CALL(rettype, op, "", "")
555#define PVOP_VCALL0(op) \
556 __PVOP_VCALL(op, "", "")
557
558#define PVOP_CALL1(rettype, op, arg1) \
559 __PVOP_CALL(rettype, op, "", "", "0" ((unsigned long)(arg1)))
560#define PVOP_VCALL1(op, arg1) \
561 __PVOP_VCALL(op, "", "", "0" ((unsigned long)(arg1)))
562
563#define PVOP_CALL2(rettype, op, arg1, arg2) \
564 __PVOP_CALL(rettype, op, "", "", "0" ((unsigned long)(arg1)), \
565 "1" ((unsigned long)(arg2)))
566#define PVOP_VCALL2(op, arg1, arg2) \
567 __PVOP_VCALL(op, "", "", "0" ((unsigned long)(arg1)), \
568 "1" ((unsigned long)(arg2)))
569
570#define PVOP_CALL3(rettype, op, arg1, arg2, arg3) \
571 __PVOP_CALL(rettype, op, "", "", "0" ((unsigned long)(arg1)), \
572 "1"((unsigned long)(arg2)), "2"((unsigned long)(arg3)))
573#define PVOP_VCALL3(op, arg1, arg2, arg3) \
574 __PVOP_VCALL(op, "", "", "0" ((unsigned long)(arg1)), \
575 "1"((unsigned long)(arg2)), "2"((unsigned long)(arg3)))
576
577/* This is the only difference in x86_64. We can make it much simpler */
578#ifdef CONFIG_X86_32
579#define PVOP_CALL4(rettype, op, arg1, arg2, arg3, arg4) \
580 __PVOP_CALL(rettype, op, \
581 "push %[_arg4];", "lea 4(%%esp),%%esp;", \
582 "0" ((u32)(arg1)), "1" ((u32)(arg2)), \
583 "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
584#define PVOP_VCALL4(op, arg1, arg2, arg3, arg4) \
585 __PVOP_VCALL(op, \
586 "push %[_arg4];", "lea 4(%%esp),%%esp;", \
587 "0" ((u32)(arg1)), "1" ((u32)(arg2)), \
588 "2" ((u32)(arg3)), [_arg4] "mr" ((u32)(arg4)))
589#else
590#define PVOP_CALL4(rettype, op, arg1, arg2, arg3, arg4) \
591 __PVOP_CALL(rettype, op, "", "", "0" ((unsigned long)(arg1)), \
592 "1"((unsigned long)(arg2)), "2"((unsigned long)(arg3)), \
593 "3"((unsigned long)(arg4)))
594#define PVOP_VCALL4(op, arg1, arg2, arg3, arg4) \
595 __PVOP_VCALL(op, "", "", "0" ((unsigned long)(arg1)), \
596 "1"((unsigned long)(arg2)), "2"((unsigned long)(arg3)), \
597 "3"((unsigned long)(arg4)))
598#endif
599
600static inline int paravirt_enabled(void)
601{
602 return pv_info.paravirt_enabled;
603}
604
605static inline void load_sp0(struct tss_struct *tss,
606 struct thread_struct *thread)
607{
608 PVOP_VCALL2(pv_cpu_ops.load_sp0, tss, thread);
609}
610
611#define ARCH_SETUP pv_init_ops.arch_setup();
612static inline unsigned long get_wallclock(void)
613{
614 return PVOP_CALL0(unsigned long, pv_time_ops.get_wallclock);
615}
616
617static inline int set_wallclock(unsigned long nowtime)
618{
619 return PVOP_CALL1(int, pv_time_ops.set_wallclock, nowtime);
620}
621
622static inline void (*choose_time_init(void))(void)
623{
624 return pv_time_ops.time_init;
625}
626
627/* The paravirtualized CPUID instruction. */
628static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
629 unsigned int *ecx, unsigned int *edx)
630{
631 PVOP_VCALL4(pv_cpu_ops.cpuid, eax, ebx, ecx, edx);
632}
633
634/*
635 * These special macros can be used to get or set a debugging register
636 */
637static inline unsigned long paravirt_get_debugreg(int reg)
638{
639 return PVOP_CALL1(unsigned long, pv_cpu_ops.get_debugreg, reg);
640}
641#define get_debugreg(var, reg) var = paravirt_get_debugreg(reg)
642static inline void set_debugreg(unsigned long val, int reg)
643{
644 PVOP_VCALL2(pv_cpu_ops.set_debugreg, reg, val);
645}
646
647static inline void clts(void)
648{
649 PVOP_VCALL0(pv_cpu_ops.clts);
650}
651
652static inline unsigned long read_cr0(void)
653{
654 return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr0);
655}
656
657static inline void write_cr0(unsigned long x)
658{
659 PVOP_VCALL1(pv_cpu_ops.write_cr0, x);
660}
661
662static inline unsigned long read_cr2(void)
663{
664 return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr2);
665}
666
667static inline void write_cr2(unsigned long x)
668{
669 PVOP_VCALL1(pv_mmu_ops.write_cr2, x);
670}
671
672static inline unsigned long read_cr3(void)
673{
674 return PVOP_CALL0(unsigned long, pv_mmu_ops.read_cr3);
675}
676
677static inline void write_cr3(unsigned long x)
678{
679 PVOP_VCALL1(pv_mmu_ops.write_cr3, x);
680}
681
682static inline unsigned long read_cr4(void)
683{
684 return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4);
685}
686static inline unsigned long read_cr4_safe(void)
687{
688 return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4_safe);
689}
690
691static inline void write_cr4(unsigned long x)
692{
693 PVOP_VCALL1(pv_cpu_ops.write_cr4, x);
694}
695
696#ifdef CONFIG_X86_64
697static inline unsigned long read_cr8(void)
698{
699 return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr8);
700}
701
702static inline void write_cr8(unsigned long x)
703{
704 PVOP_VCALL1(pv_cpu_ops.write_cr8, x);
705}
706#endif
707
708static inline void raw_safe_halt(void)
709{
710 PVOP_VCALL0(pv_irq_ops.safe_halt);
711}
712
713static inline void halt(void)
714{
715 PVOP_VCALL0(pv_irq_ops.safe_halt);
716}
717
718static inline void wbinvd(void)
719{
720 PVOP_VCALL0(pv_cpu_ops.wbinvd);
721}
722
723#define get_kernel_rpl() (pv_info.kernel_rpl)
724
725static inline u64 paravirt_read_msr(unsigned msr, int *err)
726{
727 return PVOP_CALL2(u64, pv_cpu_ops.read_msr, msr, err);
728}
729static inline int paravirt_write_msr(unsigned msr, unsigned low, unsigned high)
730{
731 return PVOP_CALL3(int, pv_cpu_ops.write_msr, msr, low, high);
732}
733
734/* These should all do BUG_ON(_err), but our headers are too tangled. */
735#define rdmsr(msr, val1, val2) \
736do { \
737 int _err; \
738 u64 _l = paravirt_read_msr(msr, &_err); \
739 val1 = (u32)_l; \
740 val2 = _l >> 32; \
741} while (0)
742
743#define wrmsr(msr, val1, val2) \
744do { \
745 paravirt_write_msr(msr, val1, val2); \
746} while (0)
747
748#define rdmsrl(msr, val) \
749do { \
750 int _err; \
751 val = paravirt_read_msr(msr, &_err); \
752} while (0)
753
754#define wrmsrl(msr, val) wrmsr(msr, (u32)((u64)(val)), ((u64)(val))>>32)
755#define wrmsr_safe(msr, a, b) paravirt_write_msr(msr, a, b)
756
757/* rdmsr with exception handling */
758#define rdmsr_safe(msr, a, b) \
759({ \
760 int _err; \
761 u64 _l = paravirt_read_msr(msr, &_err); \
762 (*a) = (u32)_l; \
763 (*b) = _l >> 32; \
764 _err; \
765})
766
767static inline int rdmsrl_safe(unsigned msr, unsigned long long *p)
768{
769 int err;
770
771 *p = paravirt_read_msr(msr, &err);
772 return err;
773}
774
775static inline u64 paravirt_read_tsc(void)
776{
777 return PVOP_CALL0(u64, pv_cpu_ops.read_tsc);
778}
779
780#define rdtscl(low) \
781do { \
782 u64 _l = paravirt_read_tsc(); \
783 low = (int)_l; \
784} while (0)
785
786#define rdtscll(val) (val = paravirt_read_tsc())
787
788static inline unsigned long long paravirt_sched_clock(void)
789{
790 return PVOP_CALL0(unsigned long long, pv_time_ops.sched_clock);
791}
792#define calibrate_tsc() (pv_time_ops.get_tsc_khz())
793
794static inline unsigned long long paravirt_read_pmc(int counter)
795{
796 return PVOP_CALL1(u64, pv_cpu_ops.read_pmc, counter);
797}
798
799#define rdpmc(counter, low, high) \
800do { \
801 u64 _l = paravirt_read_pmc(counter); \
802 low = (u32)_l; \
803 high = _l >> 32; \
804} while (0)
805
806static inline unsigned long long paravirt_rdtscp(unsigned int *aux)
807{
808 return PVOP_CALL1(u64, pv_cpu_ops.read_tscp, aux);
809}
810
811#define rdtscp(low, high, aux) \
812do { \
813 int __aux; \
814 unsigned long __val = paravirt_rdtscp(&__aux); \
815 (low) = (u32)__val; \
816 (high) = (u32)(__val >> 32); \
817 (aux) = __aux; \
818} while (0)
819
820#define rdtscpll(val, aux) \
821do { \
822 unsigned long __aux; \
823 val = paravirt_rdtscp(&__aux); \
824 (aux) = __aux; \
825} while (0)
826
827static inline void load_TR_desc(void)
828{
829 PVOP_VCALL0(pv_cpu_ops.load_tr_desc);
830}
831static inline void load_gdt(const struct desc_ptr *dtr)
832{
833 PVOP_VCALL1(pv_cpu_ops.load_gdt, dtr);
834}
835static inline void load_idt(const struct desc_ptr *dtr)
836{
837 PVOP_VCALL1(pv_cpu_ops.load_idt, dtr);
838}
839static inline void set_ldt(const void *addr, unsigned entries)
840{
841 PVOP_VCALL2(pv_cpu_ops.set_ldt, addr, entries);
842}
843static inline void store_gdt(struct desc_ptr *dtr)
844{
845 PVOP_VCALL1(pv_cpu_ops.store_gdt, dtr);
846}
847static inline void store_idt(struct desc_ptr *dtr)
848{
849 PVOP_VCALL1(pv_cpu_ops.store_idt, dtr);
850}
851static inline unsigned long paravirt_store_tr(void)
852{
853 return PVOP_CALL0(unsigned long, pv_cpu_ops.store_tr);
854}
855#define store_tr(tr) ((tr) = paravirt_store_tr())
856static inline void load_TLS(struct thread_struct *t, unsigned cpu)
857{
858 PVOP_VCALL2(pv_cpu_ops.load_tls, t, cpu);
859}
860
861#ifdef CONFIG_X86_64
862static inline void load_gs_index(unsigned int gs)
863{
864 PVOP_VCALL1(pv_cpu_ops.load_gs_index, gs);
865}
866#endif
867
868static inline void write_ldt_entry(struct desc_struct *dt, int entry,
869 const void *desc)
870{
871 PVOP_VCALL3(pv_cpu_ops.write_ldt_entry, dt, entry, desc);
872}
873
874static inline void write_gdt_entry(struct desc_struct *dt, int entry,
875 void *desc, int type)
876{
877 PVOP_VCALL4(pv_cpu_ops.write_gdt_entry, dt, entry, desc, type);
878}
879
880static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
881{
882 PVOP_VCALL3(pv_cpu_ops.write_idt_entry, dt, entry, g);
883}
884static inline void set_iopl_mask(unsigned mask)
885{
886 PVOP_VCALL1(pv_cpu_ops.set_iopl_mask, mask);
887}
888
889/* The paravirtualized I/O functions */
890static inline void slow_down_io(void)
891{
892 pv_cpu_ops.io_delay();
893#ifdef REALLY_SLOW_IO
894 pv_cpu_ops.io_delay();
895 pv_cpu_ops.io_delay();
896 pv_cpu_ops.io_delay();
897#endif
898}
899
900#ifdef CONFIG_X86_LOCAL_APIC
901/*
902 * Basic functions accessing APICs.
903 */
904static inline void apic_write(unsigned long reg, u32 v)
905{
906 PVOP_VCALL2(pv_apic_ops.apic_write, reg, v);
907}
908
909static inline u32 apic_read(unsigned long reg)
910{
911 return PVOP_CALL1(unsigned long, pv_apic_ops.apic_read, reg);
912}
913
914static inline void setup_boot_clock(void)
915{
916 PVOP_VCALL0(pv_apic_ops.setup_boot_clock);
917}
918
919static inline void setup_secondary_clock(void)
920{
921 PVOP_VCALL0(pv_apic_ops.setup_secondary_clock);
922}
923#endif
924
925static inline void paravirt_post_allocator_init(void)
926{
927 if (pv_init_ops.post_allocator_init)
928 (*pv_init_ops.post_allocator_init)();
929}
930
931static inline void paravirt_pagetable_setup_start(pgd_t *base)
932{
933 (*pv_mmu_ops.pagetable_setup_start)(base);
934}
935
936static inline void paravirt_pagetable_setup_done(pgd_t *base)
937{
938 (*pv_mmu_ops.pagetable_setup_done)(base);
939}
940
941#ifdef CONFIG_SMP
942static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
943 unsigned long start_esp)
944{
945 PVOP_VCALL3(pv_apic_ops.startup_ipi_hook,
946 phys_apicid, start_eip, start_esp);
947}
948#endif
949
950static inline void paravirt_activate_mm(struct mm_struct *prev,
951 struct mm_struct *next)
952{
953 PVOP_VCALL2(pv_mmu_ops.activate_mm, prev, next);
954}
955
956static inline void arch_dup_mmap(struct mm_struct *oldmm,
957 struct mm_struct *mm)
958{
959 PVOP_VCALL2(pv_mmu_ops.dup_mmap, oldmm, mm);
960}
961
962static inline void arch_exit_mmap(struct mm_struct *mm)
963{
964 PVOP_VCALL1(pv_mmu_ops.exit_mmap, mm);
965}
966
967static inline void __flush_tlb(void)
968{
969 PVOP_VCALL0(pv_mmu_ops.flush_tlb_user);
970}
971static inline void __flush_tlb_global(void)
972{
973 PVOP_VCALL0(pv_mmu_ops.flush_tlb_kernel);
974}
975static inline void __flush_tlb_single(unsigned long addr)
976{
977 PVOP_VCALL1(pv_mmu_ops.flush_tlb_single, addr);
978}
979
980static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
981 unsigned long va)
982{
983 PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va);
984}
985
986static inline int paravirt_pgd_alloc(struct mm_struct *mm)
987{
988 return PVOP_CALL1(int, pv_mmu_ops.pgd_alloc, mm);
989}
990
991static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
992{
993 PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
994}
995
996static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
997{
998 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
999}
1000static inline void paravirt_release_pte(unsigned pfn)
1001{
1002 PVOP_VCALL1(pv_mmu_ops.release_pte, pfn);
1003}
1004
1005static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn)
1006{
1007 PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn);
1008}
1009
1010static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn,
1011 unsigned start, unsigned count)
1012{
1013 PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count);
1014}
1015static inline void paravirt_release_pmd(unsigned pfn)
1016{
1017 PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn);
1018}
1019
1020static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn)
1021{
1022 PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn);
1023}
1024static inline void paravirt_release_pud(unsigned pfn)
1025{
1026 PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
1027}
1028
1029#ifdef CONFIG_HIGHPTE
1030static inline void *kmap_atomic_pte(struct page *page, enum km_type type)
1031{
1032 unsigned long ret;
1033 ret = PVOP_CALL2(unsigned long, pv_mmu_ops.kmap_atomic_pte, page, type);
1034 return (void *)ret;
1035}
1036#endif
1037
1038static inline void pte_update(struct mm_struct *mm, unsigned long addr,
1039 pte_t *ptep)
1040{
1041 PVOP_VCALL3(pv_mmu_ops.pte_update, mm, addr, ptep);
1042}
1043
1044static inline void pte_update_defer(struct mm_struct *mm, unsigned long addr,
1045 pte_t *ptep)
1046{
1047 PVOP_VCALL3(pv_mmu_ops.pte_update_defer, mm, addr, ptep);
1048}
1049
1050static inline pte_t __pte(pteval_t val)
1051{
1052 pteval_t ret;
1053
1054 if (sizeof(pteval_t) > sizeof(long))
1055 ret = PVOP_CALL2(pteval_t,
1056 pv_mmu_ops.make_pte,
1057 val, (u64)val >> 32);
1058 else
1059 ret = PVOP_CALL1(pteval_t,
1060 pv_mmu_ops.make_pte,
1061 val);
1062
1063 return (pte_t) { .pte = ret };
1064}
1065
1066static inline pteval_t pte_val(pte_t pte)
1067{
1068 pteval_t ret;
1069
1070 if (sizeof(pteval_t) > sizeof(long))
1071 ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_val,
1072 pte.pte, (u64)pte.pte >> 32);
1073 else
1074 ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_val,
1075 pte.pte);
1076
1077 return ret;
1078}
1079
1080static inline pteval_t pte_flags(pte_t pte)
1081{
1082 pteval_t ret;
1083
1084 if (sizeof(pteval_t) > sizeof(long))
1085 ret = PVOP_CALL2(pteval_t, pv_mmu_ops.pte_flags,
1086 pte.pte, (u64)pte.pte >> 32);
1087 else
1088 ret = PVOP_CALL1(pteval_t, pv_mmu_ops.pte_flags,
1089 pte.pte);
1090
1091#ifdef CONFIG_PARAVIRT_DEBUG
1092 BUG_ON(ret & PTE_PFN_MASK);
1093#endif
1094 return ret;
1095}
1096
1097static inline pgd_t __pgd(pgdval_t val)
1098{
1099 pgdval_t ret;
1100
1101 if (sizeof(pgdval_t) > sizeof(long))
1102 ret = PVOP_CALL2(pgdval_t, pv_mmu_ops.make_pgd,
1103 val, (u64)val >> 32);
1104 else
1105 ret = PVOP_CALL1(pgdval_t, pv_mmu_ops.make_pgd,
1106 val);
1107
1108 return (pgd_t) { ret };
1109}
1110
1111static inline pgdval_t pgd_val(pgd_t pgd)
1112{
1113 pgdval_t ret;
1114
1115 if (sizeof(pgdval_t) > sizeof(long))
1116 ret = PVOP_CALL2(pgdval_t, pv_mmu_ops.pgd_val,
1117 pgd.pgd, (u64)pgd.pgd >> 32);
1118 else
1119 ret = PVOP_CALL1(pgdval_t, pv_mmu_ops.pgd_val,
1120 pgd.pgd);
1121
1122 return ret;
1123}
1124
1125#define __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION
1126static inline pte_t ptep_modify_prot_start(struct mm_struct *mm, unsigned long addr,
1127 pte_t *ptep)
1128{
1129 pteval_t ret;
1130
1131 ret = PVOP_CALL3(pteval_t, pv_mmu_ops.ptep_modify_prot_start,
1132 mm, addr, ptep);
1133
1134 return (pte_t) { .pte = ret };
1135}
1136
1137static inline void ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
1138 pte_t *ptep, pte_t pte)
1139{
1140 if (sizeof(pteval_t) > sizeof(long))
1141 /* 5 arg words */
1142 pv_mmu_ops.ptep_modify_prot_commit(mm, addr, ptep, pte);
1143 else
1144 PVOP_VCALL4(pv_mmu_ops.ptep_modify_prot_commit,
1145 mm, addr, ptep, pte.pte);
1146}
1147
1148static inline void set_pte(pte_t *ptep, pte_t pte)
1149{
1150 if (sizeof(pteval_t) > sizeof(long))
1151 PVOP_VCALL3(pv_mmu_ops.set_pte, ptep,
1152 pte.pte, (u64)pte.pte >> 32);
1153 else
1154 PVOP_VCALL2(pv_mmu_ops.set_pte, ptep,
1155 pte.pte);
1156}
1157
1158static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
1159 pte_t *ptep, pte_t pte)
1160{
1161 if (sizeof(pteval_t) > sizeof(long))
1162 /* 5 arg words */
1163 pv_mmu_ops.set_pte_at(mm, addr, ptep, pte);
1164 else
1165 PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte);
1166}
1167
1168static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
1169{
1170 pmdval_t val = native_pmd_val(pmd);
1171
1172 if (sizeof(pmdval_t) > sizeof(long))
1173 PVOP_VCALL3(pv_mmu_ops.set_pmd, pmdp, val, (u64)val >> 32);
1174 else
1175 PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, val);
1176}
1177
1178#if PAGETABLE_LEVELS >= 3
1179static inline pmd_t __pmd(pmdval_t val)
1180{
1181 pmdval_t ret;
1182
1183 if (sizeof(pmdval_t) > sizeof(long))
1184 ret = PVOP_CALL2(pmdval_t, pv_mmu_ops.make_pmd,
1185 val, (u64)val >> 32);
1186 else
1187 ret = PVOP_CALL1(pmdval_t, pv_mmu_ops.make_pmd,
1188 val);
1189
1190 return (pmd_t) { ret };
1191}
1192
1193static inline pmdval_t pmd_val(pmd_t pmd)
1194{
1195 pmdval_t ret;
1196
1197 if (sizeof(pmdval_t) > sizeof(long))
1198 ret = PVOP_CALL2(pmdval_t, pv_mmu_ops.pmd_val,
1199 pmd.pmd, (u64)pmd.pmd >> 32);
1200 else
1201 ret = PVOP_CALL1(pmdval_t, pv_mmu_ops.pmd_val,
1202 pmd.pmd);
1203
1204 return ret;
1205}
1206
1207static inline void set_pud(pud_t *pudp, pud_t pud)
1208{
1209 pudval_t val = native_pud_val(pud);
1210
1211 if (sizeof(pudval_t) > sizeof(long))
1212 PVOP_VCALL3(pv_mmu_ops.set_pud, pudp,
1213 val, (u64)val >> 32);
1214 else
1215 PVOP_VCALL2(pv_mmu_ops.set_pud, pudp,
1216 val);
1217}
1218#if PAGETABLE_LEVELS == 4
1219static inline pud_t __pud(pudval_t val)
1220{
1221 pudval_t ret;
1222
1223 if (sizeof(pudval_t) > sizeof(long))
1224 ret = PVOP_CALL2(pudval_t, pv_mmu_ops.make_pud,
1225 val, (u64)val >> 32);
1226 else
1227 ret = PVOP_CALL1(pudval_t, pv_mmu_ops.make_pud,
1228 val);
1229
1230 return (pud_t) { ret };
1231}
1232
1233static inline pudval_t pud_val(pud_t pud)
1234{
1235 pudval_t ret;
1236
1237 if (sizeof(pudval_t) > sizeof(long))
1238 ret = PVOP_CALL2(pudval_t, pv_mmu_ops.pud_val,
1239 pud.pud, (u64)pud.pud >> 32);
1240 else
1241 ret = PVOP_CALL1(pudval_t, pv_mmu_ops.pud_val,
1242 pud.pud);
1243
1244 return ret;
1245}
1246
1247static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
1248{
1249 pgdval_t val = native_pgd_val(pgd);
1250
1251 if (sizeof(pgdval_t) > sizeof(long))
1252 PVOP_VCALL3(pv_mmu_ops.set_pgd, pgdp,
1253 val, (u64)val >> 32);
1254 else
1255 PVOP_VCALL2(pv_mmu_ops.set_pgd, pgdp,
1256 val);
1257}
1258
1259static inline void pgd_clear(pgd_t *pgdp)
1260{
1261 set_pgd(pgdp, __pgd(0));
1262}
1263
1264static inline void pud_clear(pud_t *pudp)
1265{
1266 set_pud(pudp, __pud(0));
1267}
1268
1269#endif /* PAGETABLE_LEVELS == 4 */
1270
1271#endif /* PAGETABLE_LEVELS >= 3 */
1272
1273#ifdef CONFIG_X86_PAE
1274/* Special-case pte-setting operations for PAE, which can't update a
1275 64-bit pte atomically */
1276static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
1277{
1278 PVOP_VCALL3(pv_mmu_ops.set_pte_atomic, ptep,
1279 pte.pte, pte.pte >> 32);
1280}
1281
1282static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1283 pte_t *ptep, pte_t pte)
1284{
1285 /* 5 arg words */
1286 pv_mmu_ops.set_pte_present(mm, addr, ptep, pte);
1287}
1288
1289static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
1290 pte_t *ptep)
1291{
1292 PVOP_VCALL3(pv_mmu_ops.pte_clear, mm, addr, ptep);
1293}
1294
1295static inline void pmd_clear(pmd_t *pmdp)
1296{
1297 PVOP_VCALL1(pv_mmu_ops.pmd_clear, pmdp);
1298}
1299#else /* !CONFIG_X86_PAE */
1300static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
1301{
1302 set_pte(ptep, pte);
1303}
1304
1305static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1306 pte_t *ptep, pte_t pte)
1307{
1308 set_pte(ptep, pte);
1309}
1310
1311static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
1312 pte_t *ptep)
1313{
1314 set_pte_at(mm, addr, ptep, __pte(0));
1315}
1316
1317static inline void pmd_clear(pmd_t *pmdp)
1318{
1319 set_pmd(pmdp, __pmd(0));
1320}
1321#endif /* CONFIG_X86_PAE */
1322
1323/* Lazy mode for batching updates / context switch */
1324enum paravirt_lazy_mode {
1325 PARAVIRT_LAZY_NONE,
1326 PARAVIRT_LAZY_MMU,
1327 PARAVIRT_LAZY_CPU,
1328};
1329
1330enum paravirt_lazy_mode paravirt_get_lazy_mode(void);
1331void paravirt_enter_lazy_cpu(void);
1332void paravirt_leave_lazy_cpu(void);
1333void paravirt_enter_lazy_mmu(void);
1334void paravirt_leave_lazy_mmu(void);
1335void paravirt_leave_lazy(enum paravirt_lazy_mode mode);
1336
1337#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
1338static inline void arch_enter_lazy_cpu_mode(void)
1339{
1340 PVOP_VCALL0(pv_cpu_ops.lazy_mode.enter);
1341}
1342
1343static inline void arch_leave_lazy_cpu_mode(void)
1344{
1345 PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave);
1346}
1347
1348static inline void arch_flush_lazy_cpu_mode(void)
1349{
1350 if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) {
1351 arch_leave_lazy_cpu_mode();
1352 arch_enter_lazy_cpu_mode();
1353 }
1354}
1355
1356
1357#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
1358static inline void arch_enter_lazy_mmu_mode(void)
1359{
1360 PVOP_VCALL0(pv_mmu_ops.lazy_mode.enter);
1361}
1362
1363static inline void arch_leave_lazy_mmu_mode(void)
1364{
1365 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
1366}
1367
1368static inline void arch_flush_lazy_mmu_mode(void)
1369{
1370 if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) {
1371 arch_leave_lazy_mmu_mode();
1372 arch_enter_lazy_mmu_mode();
1373 }
1374}
1375
1376static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
1377 unsigned long phys, pgprot_t flags)
1378{
1379 pv_mmu_ops.set_fixmap(idx, phys, flags);
1380}
1381
1382void _paravirt_nop(void);
1383#define paravirt_nop ((void *)_paravirt_nop)
1384
1385void paravirt_use_bytelocks(void);
1386
1387#ifdef CONFIG_SMP
1388
1389static inline int __raw_spin_is_locked(struct raw_spinlock *lock)
1390{
1391 return PVOP_CALL1(int, pv_lock_ops.spin_is_locked, lock);
1392}
1393
1394static inline int __raw_spin_is_contended(struct raw_spinlock *lock)
1395{
1396 return PVOP_CALL1(int, pv_lock_ops.spin_is_contended, lock);
1397}
1398
1399static __always_inline void __raw_spin_lock(struct raw_spinlock *lock)
1400{
1401 PVOP_VCALL1(pv_lock_ops.spin_lock, lock);
1402}
1403
1404static __always_inline int __raw_spin_trylock(struct raw_spinlock *lock)
1405{
1406 return PVOP_CALL1(int, pv_lock_ops.spin_trylock, lock);
1407}
1408
1409static __always_inline void __raw_spin_unlock(struct raw_spinlock *lock)
1410{
1411 PVOP_VCALL1(pv_lock_ops.spin_unlock, lock);
1412}
1413
1414#endif
1415
1416/* These all sit in the .parainstructions section to tell us what to patch. */
1417struct paravirt_patch_site {
1418 u8 *instr; /* original instructions */
1419 u8 instrtype; /* type of this instruction */
1420 u8 len; /* length of original instruction */
1421 u16 clobbers; /* what registers you may clobber */
1422};
1423
1424extern struct paravirt_patch_site __parainstructions[],
1425 __parainstructions_end[];
1426
1427#ifdef CONFIG_X86_32
1428#define PV_SAVE_REGS "pushl %%ecx; pushl %%edx;"
1429#define PV_RESTORE_REGS "popl %%edx; popl %%ecx"
1430#define PV_FLAGS_ARG "0"
1431#define PV_EXTRA_CLOBBERS
1432#define PV_VEXTRA_CLOBBERS
1433#else
1434/* We save some registers, but all of them, that's too much. We clobber all
1435 * caller saved registers but the argument parameter */
1436#define PV_SAVE_REGS "pushq %%rdi;"
1437#define PV_RESTORE_REGS "popq %%rdi;"
1438#define PV_EXTRA_CLOBBERS EXTRA_CLOBBERS, "rcx" , "rdx", "rsi"
1439#define PV_VEXTRA_CLOBBERS EXTRA_CLOBBERS, "rdi", "rcx" , "rdx", "rsi"
1440#define PV_FLAGS_ARG "D"
1441#endif
1442
1443static inline unsigned long __raw_local_save_flags(void)
1444{
1445 unsigned long f;
1446
1447 asm volatile(paravirt_alt(PV_SAVE_REGS
1448 PARAVIRT_CALL
1449 PV_RESTORE_REGS)
1450 : "=a"(f)
1451 : paravirt_type(pv_irq_ops.save_fl),
1452 paravirt_clobber(CLBR_EAX)
1453 : "memory", "cc" PV_VEXTRA_CLOBBERS);
1454 return f;
1455}
1456
1457static inline void raw_local_irq_restore(unsigned long f)
1458{
1459 asm volatile(paravirt_alt(PV_SAVE_REGS
1460 PARAVIRT_CALL
1461 PV_RESTORE_REGS)
1462 : "=a"(f)
1463 : PV_FLAGS_ARG(f),
1464 paravirt_type(pv_irq_ops.restore_fl),
1465 paravirt_clobber(CLBR_EAX)
1466 : "memory", "cc" PV_EXTRA_CLOBBERS);
1467}
1468
1469static inline void raw_local_irq_disable(void)
1470{
1471 asm volatile(paravirt_alt(PV_SAVE_REGS
1472 PARAVIRT_CALL
1473 PV_RESTORE_REGS)
1474 :
1475 : paravirt_type(pv_irq_ops.irq_disable),
1476 paravirt_clobber(CLBR_EAX)
1477 : "memory", "eax", "cc" PV_EXTRA_CLOBBERS);
1478}
1479
1480static inline void raw_local_irq_enable(void)
1481{
1482 asm volatile(paravirt_alt(PV_SAVE_REGS
1483 PARAVIRT_CALL
1484 PV_RESTORE_REGS)
1485 :
1486 : paravirt_type(pv_irq_ops.irq_enable),
1487 paravirt_clobber(CLBR_EAX)
1488 : "memory", "eax", "cc" PV_EXTRA_CLOBBERS);
1489}
1490
1491static inline unsigned long __raw_local_irq_save(void)
1492{
1493 unsigned long f;
1494
1495 f = __raw_local_save_flags();
1496 raw_local_irq_disable();
1497 return f;
1498}
1499
1500
1501/* Make sure as little as possible of this mess escapes. */
1502#undef PARAVIRT_CALL
1503#undef __PVOP_CALL
1504#undef __PVOP_VCALL
1505#undef PVOP_VCALL0
1506#undef PVOP_CALL0
1507#undef PVOP_VCALL1
1508#undef PVOP_CALL1
1509#undef PVOP_VCALL2
1510#undef PVOP_CALL2
1511#undef PVOP_VCALL3
1512#undef PVOP_CALL3
1513#undef PVOP_VCALL4
1514#undef PVOP_CALL4
1515
1516#else /* __ASSEMBLY__ */
1517
1518#define _PVSITE(ptype, clobbers, ops, word, algn) \
1519771:; \
1520 ops; \
1521772:; \
1522 .pushsection .parainstructions,"a"; \
1523 .align algn; \
1524 word 771b; \
1525 .byte ptype; \
1526 .byte 772b-771b; \
1527 .short clobbers; \
1528 .popsection
1529
1530
1531#ifdef CONFIG_X86_64
1532#define PV_SAVE_REGS \
1533 push %rax; \
1534 push %rcx; \
1535 push %rdx; \
1536 push %rsi; \
1537 push %rdi; \
1538 push %r8; \
1539 push %r9; \
1540 push %r10; \
1541 push %r11
1542#define PV_RESTORE_REGS \
1543 pop %r11; \
1544 pop %r10; \
1545 pop %r9; \
1546 pop %r8; \
1547 pop %rdi; \
1548 pop %rsi; \
1549 pop %rdx; \
1550 pop %rcx; \
1551 pop %rax
1552#define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 8)
1553#define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .quad, 8)
1554#define PARA_INDIRECT(addr) *addr(%rip)
1555#else
1556#define PV_SAVE_REGS pushl %eax; pushl %edi; pushl %ecx; pushl %edx
1557#define PV_RESTORE_REGS popl %edx; popl %ecx; popl %edi; popl %eax
1558#define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4)
1559#define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4)
1560#define PARA_INDIRECT(addr) *%cs:addr
1561#endif
1562
1563#define INTERRUPT_RETURN \
1564 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \
1565 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret))
1566
1567#define DISABLE_INTERRUPTS(clobbers) \
1568 PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \
1569 PV_SAVE_REGS; \
1570 call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \
1571 PV_RESTORE_REGS;) \
1572
1573#define ENABLE_INTERRUPTS(clobbers) \
1574 PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \
1575 PV_SAVE_REGS; \
1576 call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \
1577 PV_RESTORE_REGS;)
1578
1579#define USERGS_SYSRET32 \
1580 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret32), \
1581 CLBR_NONE, \
1582 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret32))
1583
1584#ifdef CONFIG_X86_32
1585#define GET_CR0_INTO_EAX \
1586 push %ecx; push %edx; \
1587 call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0); \
1588 pop %edx; pop %ecx
1589
1590#define ENABLE_INTERRUPTS_SYSEXIT \
1591 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_irq_enable_sysexit), \
1592 CLBR_NONE, \
1593 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_irq_enable_sysexit))
1594
1595
1596#else /* !CONFIG_X86_32 */
1597
1598/*
1599 * If swapgs is used while the userspace stack is still current,
1600 * there's no way to call a pvop. The PV replacement *must* be
1601 * inlined, or the swapgs instruction must be trapped and emulated.
1602 */
1603#define SWAPGS_UNSAFE_STACK \
1604 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \
1605 swapgs)
1606
1607#define SWAPGS \
1608 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \
1609 PV_SAVE_REGS; \
1610 call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \
1611 PV_RESTORE_REGS \
1612 )
1613
1614#define GET_CR2_INTO_RCX \
1615 call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2); \
1616 movq %rax, %rcx; \
1617 xorq %rax, %rax;
1618
1619#define PARAVIRT_ADJUST_EXCEPTION_FRAME \
1620 PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_adjust_exception_frame), \
1621 CLBR_NONE, \
1622 call PARA_INDIRECT(pv_irq_ops+PV_IRQ_adjust_exception_frame))
1623
1624#define USERGS_SYSRET64 \
1625 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \
1626 CLBR_NONE, \
1627 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64))
1628
1629#define ENABLE_INTERRUPTS_SYSEXIT32 \
1630 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_irq_enable_sysexit), \
1631 CLBR_NONE, \
1632 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_irq_enable_sysexit))
1633#endif /* CONFIG_X86_32 */
1634
1635#endif /* __ASSEMBLY__ */
1636#endif /* CONFIG_PARAVIRT */
1637#endif /* __ASM_PARAVIRT_H */
diff --git a/include/asm-x86/parport.h b/include/asm-x86/parport.h
deleted file mode 100644
index 3c4ffeb467e9..000000000000
--- a/include/asm-x86/parport.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_X86_PARPORT_H
2#define _ASM_X86_PARPORT_H
3
4static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
5static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
6{
7 return parport_pc_find_isa_ports(autoirq, autodma);
8}
9
10#endif /* _ASM_X86_PARPORT_H */
diff --git a/include/asm-x86/pat.h b/include/asm-x86/pat.h
deleted file mode 100644
index 7edc47307217..000000000000
--- a/include/asm-x86/pat.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_PAT_H
2#define _ASM_PAT_H
3
4#include <linux/types.h>
5
6#ifdef CONFIG_X86_PAT
7extern int pat_enabled;
8extern void validate_pat_support(struct cpuinfo_x86 *c);
9#else
10static const int pat_enabled;
11static inline void validate_pat_support(struct cpuinfo_x86 *c) { }
12#endif
13
14extern void pat_init(void);
15
16extern int reserve_memtype(u64 start, u64 end,
17 unsigned long req_type, unsigned long *ret_type);
18extern int free_memtype(u64 start, u64 end);
19
20extern void pat_disable(char *reason);
21
22#endif
diff --git a/include/asm-x86/pci-direct.h b/include/asm-x86/pci-direct.h
deleted file mode 100644
index 80c775d9fe20..000000000000
--- a/include/asm-x86/pci-direct.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef ASM_PCI_DIRECT_H
2#define ASM_PCI_DIRECT_H 1
3
4#include <linux/types.h>
5
6/* Direct PCI access. This is used for PCI accesses in early boot before
7 the PCI subsystem works. */
8
9extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset);
10extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset);
11extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset);
12extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val);
13extern void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val);
14extern void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val);
15
16extern int early_pci_allowed(void);
17
18extern unsigned int pci_early_dump_regs;
19extern void early_dump_pci_device(u8 bus, u8 slot, u8 func);
20extern void early_dump_pci_devices(void);
21#endif
diff --git a/include/asm-x86/pci.h b/include/asm-x86/pci.h
deleted file mode 100644
index 2db14cf17db8..000000000000
--- a/include/asm-x86/pci.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef __x86_PCI_H
2#define __x86_PCI_H
3
4#include <linux/mm.h> /* for struct page */
5#include <linux/types.h>
6#include <linux/slab.h>
7#include <linux/string.h>
8#include <asm/scatterlist.h>
9#include <asm/io.h>
10
11#ifdef __KERNEL__
12
13struct pci_sysdata {
14 int domain; /* PCI domain */
15 int node; /* NUMA node */
16#ifdef CONFIG_X86_64
17 void *iommu; /* IOMMU private data */
18#endif
19};
20
21extern int pci_routeirq;
22
23/* scan a bus after allocating a pci_sysdata for it */
24extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
25 int node);
26extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
27
28static inline int pci_domain_nr(struct pci_bus *bus)
29{
30 struct pci_sysdata *sd = bus->sysdata;
31 return sd->domain;
32}
33
34static inline int pci_proc_domain(struct pci_bus *bus)
35{
36 return pci_domain_nr(bus);
37}
38
39
40/* Can be used to override the logic in pci_scan_bus for skipping
41 already-configured bus numbers - to be used for buggy BIOSes
42 or architectures with incomplete PCI setup by the loader */
43
44#ifdef CONFIG_PCI
45extern unsigned int pcibios_assign_all_busses(void);
46#else
47#define pcibios_assign_all_busses() 0
48#endif
49#define pcibios_scan_all_fns(a, b) 0
50
51extern unsigned long pci_mem_start;
52#define PCIBIOS_MIN_IO 0x1000
53#define PCIBIOS_MIN_MEM (pci_mem_start)
54
55#define PCIBIOS_MIN_CARDBUS_IO 0x4000
56
57void pcibios_config_init(void);
58struct pci_bus *pcibios_scan_root(int bus);
59
60void pcibios_set_master(struct pci_dev *dev);
61void pcibios_penalize_isa_irq(int irq, int active);
62struct irq_routing_table *pcibios_get_irq_routing_table(void);
63int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
64
65
66#define HAVE_PCI_MMAP
67extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
68 enum pci_mmap_state mmap_state,
69 int write_combine);
70
71
72#ifdef CONFIG_PCI
73extern void early_quirks(void);
74static inline void pci_dma_burst_advice(struct pci_dev *pdev,
75 enum pci_dma_burst_strategy *strat,
76 unsigned long *strategy_parameter)
77{
78 *strat = PCI_DMA_BURST_INFINITY;
79 *strategy_parameter = ~0UL;
80}
81#else
82static inline void early_quirks(void) { }
83#endif
84
85#endif /* __KERNEL__ */
86
87#ifdef CONFIG_X86_32
88# include "pci_32.h"
89#else
90# include "pci_64.h"
91#endif
92
93/* implement the pci_ DMA API in terms of the generic device dma_ one */
94#include <asm-generic/pci-dma-compat.h>
95
96/* generic pci stuff */
97#include <asm-generic/pci.h>
98
99#ifdef CONFIG_NUMA
100/* Returns the node based on pci bus */
101static inline int __pcibus_to_node(struct pci_bus *bus)
102{
103 struct pci_sysdata *sd = bus->sysdata;
104
105 return sd->node;
106}
107
108static inline cpumask_t __pcibus_to_cpumask(struct pci_bus *bus)
109{
110 return node_to_cpumask(__pcibus_to_node(bus));
111}
112#endif
113
114#endif
diff --git a/include/asm-x86/pci_32.h b/include/asm-x86/pci_32.h
deleted file mode 100644
index a50d46851285..000000000000
--- a/include/asm-x86/pci_32.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __i386_PCI_H
2#define __i386_PCI_H
3
4
5#ifdef __KERNEL__
6
7
8/* Dynamic DMA mapping stuff.
9 * i386 has everything mapped statically.
10 */
11
12struct pci_dev;
13
14/* The PCI address space does equal the physical memory
15 * address space. The networking and block device layers use
16 * this boolean for bounce buffer decisions.
17 */
18#define PCI_DMA_BUS_IS_PHYS (1)
19
20/* pci_unmap_{page,single} is a nop so... */
21#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME[0];
22#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) unsigned LEN_NAME[0];
23#define pci_unmap_addr(PTR, ADDR_NAME) sizeof((PTR)->ADDR_NAME)
24#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
25 do { break; } while (pci_unmap_addr(PTR, ADDR_NAME))
26#define pci_unmap_len(PTR, LEN_NAME) sizeof((PTR)->LEN_NAME)
27#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
28 do { break; } while (pci_unmap_len(PTR, LEN_NAME))
29
30
31#endif /* __KERNEL__ */
32
33
34#endif /* __i386_PCI_H */
diff --git a/include/asm-x86/pci_64.h b/include/asm-x86/pci_64.h
deleted file mode 100644
index f330234ffa5c..000000000000
--- a/include/asm-x86/pci_64.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#ifndef __x8664_PCI_H
2#define __x8664_PCI_H
3
4#ifdef __KERNEL__
5
6#ifdef CONFIG_CALGARY_IOMMU
7static inline void *pci_iommu(struct pci_bus *bus)
8{
9 struct pci_sysdata *sd = bus->sysdata;
10 return sd->iommu;
11}
12
13static inline void set_pci_iommu(struct pci_bus *bus, void *val)
14{
15 struct pci_sysdata *sd = bus->sysdata;
16 sd->iommu = val;
17}
18#endif /* CONFIG_CALGARY_IOMMU */
19
20extern int (*pci_config_read)(int seg, int bus, int dev, int fn,
21 int reg, int len, u32 *value);
22extern int (*pci_config_write)(int seg, int bus, int dev, int fn,
23 int reg, int len, u32 value);
24
25extern void dma32_reserve_bootmem(void);
26extern void pci_iommu_alloc(void);
27
28/* The PCI address space does equal the physical memory
29 * address space. The networking and block device layers use
30 * this boolean for bounce buffer decisions
31 *
32 * On AMD64 it mostly equals, but we set it to zero if a hardware
33 * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
34 */
35#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
36
37#if defined(CONFIG_GART_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
38
39#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
40 dma_addr_t ADDR_NAME;
41#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
42 __u32 LEN_NAME;
43#define pci_unmap_addr(PTR, ADDR_NAME) \
44 ((PTR)->ADDR_NAME)
45#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
46 (((PTR)->ADDR_NAME) = (VAL))
47#define pci_unmap_len(PTR, LEN_NAME) \
48 ((PTR)->LEN_NAME)
49#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
50 (((PTR)->LEN_NAME) = (VAL))
51
52#else
53/* No IOMMU */
54
55#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
56#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
57#define pci_unmap_addr(PTR, ADDR_NAME) (0)
58#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
59#define pci_unmap_len(PTR, LEN_NAME) (0)
60#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
61
62#endif
63
64#endif /* __KERNEL__ */
65
66#endif /* __x8664_PCI_H */
diff --git a/include/asm-x86/pda.h b/include/asm-x86/pda.h
deleted file mode 100644
index b34e9a7cc80b..000000000000
--- a/include/asm-x86/pda.h
+++ /dev/null
@@ -1,137 +0,0 @@
1#ifndef X86_64_PDA_H
2#define X86_64_PDA_H
3
4#ifndef __ASSEMBLY__
5#include <linux/stddef.h>
6#include <linux/types.h>
7#include <linux/cache.h>
8#include <asm/page.h>
9
10/* Per processor datastructure. %gs points to it while the kernel runs */
11struct x8664_pda {
12 struct task_struct *pcurrent; /* 0 Current process */
13 unsigned long data_offset; /* 8 Per cpu data offset from linker
14 address */
15 unsigned long kernelstack; /* 16 top of kernel stack for current */
16 unsigned long oldrsp; /* 24 user rsp for system call */
17 int irqcount; /* 32 Irq nesting counter. Starts -1 */
18 unsigned int cpunumber; /* 36 Logical CPU number */
19#ifdef CONFIG_CC_STACKPROTECTOR
20 unsigned long stack_canary; /* 40 stack canary value */
21 /* gcc-ABI: this canary MUST be at
22 offset 40!!! */
23#endif
24 char *irqstackptr;
25 short nodenumber; /* number of current node (32k max) */
26 short in_bootmem; /* pda lives in bootmem */
27 unsigned int __softirq_pending;
28 unsigned int __nmi_count; /* number of NMI on this CPUs */
29 short mmu_state;
30 short isidle;
31 struct mm_struct *active_mm;
32 unsigned apic_timer_irqs;
33 unsigned irq0_irqs;
34 unsigned irq_resched_count;
35 unsigned irq_call_count;
36 unsigned irq_tlb_count;
37 unsigned irq_thermal_count;
38 unsigned irq_threshold_count;
39 unsigned irq_spurious_count;
40} ____cacheline_aligned_in_smp;
41
42extern struct x8664_pda **_cpu_pda;
43extern void pda_init(int);
44
45#define cpu_pda(i) (_cpu_pda[i])
46
47/*
48 * There is no fast way to get the base address of the PDA, all the accesses
49 * have to mention %fs/%gs. So it needs to be done this Torvaldian way.
50 */
51extern void __bad_pda_field(void) __attribute__((noreturn));
52
53/*
54 * proxy_pda doesn't actually exist, but tell gcc it is accessed for
55 * all PDA accesses so it gets read/write dependencies right.
56 */
57extern struct x8664_pda _proxy_pda;
58
59#define pda_offset(field) offsetof(struct x8664_pda, field)
60
61#define pda_to_op(op, field, val) \
62do { \
63 typedef typeof(_proxy_pda.field) T__; \
64 if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \
65 switch (sizeof(_proxy_pda.field)) { \
66 case 2: \
67 asm(op "w %1,%%gs:%c2" : \
68 "+m" (_proxy_pda.field) : \
69 "ri" ((T__)val), \
70 "i"(pda_offset(field))); \
71 break; \
72 case 4: \
73 asm(op "l %1,%%gs:%c2" : \
74 "+m" (_proxy_pda.field) : \
75 "ri" ((T__)val), \
76 "i" (pda_offset(field))); \
77 break; \
78 case 8: \
79 asm(op "q %1,%%gs:%c2": \
80 "+m" (_proxy_pda.field) : \
81 "ri" ((T__)val), \
82 "i"(pda_offset(field))); \
83 break; \
84 default: \
85 __bad_pda_field(); \
86 } \
87} while (0)
88
89#define pda_from_op(op, field) \
90({ \
91 typeof(_proxy_pda.field) ret__; \
92 switch (sizeof(_proxy_pda.field)) { \
93 case 2: \
94 asm(op "w %%gs:%c1,%0" : \
95 "=r" (ret__) : \
96 "i" (pda_offset(field)), \
97 "m" (_proxy_pda.field)); \
98 break; \
99 case 4: \
100 asm(op "l %%gs:%c1,%0": \
101 "=r" (ret__): \
102 "i" (pda_offset(field)), \
103 "m" (_proxy_pda.field)); \
104 break; \
105 case 8: \
106 asm(op "q %%gs:%c1,%0": \
107 "=r" (ret__) : \
108 "i" (pda_offset(field)), \
109 "m" (_proxy_pda.field)); \
110 break; \
111 default: \
112 __bad_pda_field(); \
113 } \
114 ret__; \
115})
116
117#define read_pda(field) pda_from_op("mov", field)
118#define write_pda(field, val) pda_to_op("mov", field, val)
119#define add_pda(field, val) pda_to_op("add", field, val)
120#define sub_pda(field, val) pda_to_op("sub", field, val)
121#define or_pda(field, val) pda_to_op("or", field, val)
122
123/* This is not atomic against other CPUs -- CPU preemption needs to be off */
124#define test_and_clear_bit_pda(bit, field) \
125({ \
126 int old__; \
127 asm volatile("btr %2,%%gs:%c3\n\tsbbl %0,%0" \
128 : "=r" (old__), "+m" (_proxy_pda.field) \
129 : "dIr" (bit), "i" (pda_offset(field)) : "memory");\
130 old__; \
131})
132
133#endif
134
135#define PDA_STACKOFFSET (5*8)
136
137#endif
diff --git a/include/asm-x86/percpu.h b/include/asm-x86/percpu.h
deleted file mode 100644
index f643a3a92da0..000000000000
--- a/include/asm-x86/percpu.h
+++ /dev/null
@@ -1,218 +0,0 @@
1#ifndef _ASM_X86_PERCPU_H_
2#define _ASM_X86_PERCPU_H_
3
4#ifdef CONFIG_X86_64
5#include <linux/compiler.h>
6
7/* Same as asm-generic/percpu.h, except that we store the per cpu offset
8 in the PDA. Longer term the PDA and every per cpu variable
9 should be just put into a single section and referenced directly
10 from %gs */
11
12#ifdef CONFIG_SMP
13#include <asm/pda.h>
14
15#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
16#define __my_cpu_offset read_pda(data_offset)
17
18#define per_cpu_offset(x) (__per_cpu_offset(x))
19
20#endif
21#include <asm-generic/percpu.h>
22
23DECLARE_PER_CPU(struct x8664_pda, pda);
24
25/*
26 * These are supposed to be implemented as a single instruction which
27 * operates on the per-cpu data base segment. x86-64 doesn't have
28 * that yet, so this is a fairly inefficient workaround for the
29 * meantime. The single instruction is atomic with respect to
30 * preemption and interrupts, so we need to explicitly disable
31 * interrupts here to achieve the same effect. However, because it
32 * can be used from within interrupt-disable/enable, we can't actually
33 * disable interrupts; disabling preemption is enough.
34 */
35#define x86_read_percpu(var) \
36 ({ \
37 typeof(per_cpu_var(var)) __tmp; \
38 preempt_disable(); \
39 __tmp = __get_cpu_var(var); \
40 preempt_enable(); \
41 __tmp; \
42 })
43
44#define x86_write_percpu(var, val) \
45 do { \
46 preempt_disable(); \
47 __get_cpu_var(var) = (val); \
48 preempt_enable(); \
49 } while(0)
50
51#else /* CONFIG_X86_64 */
52
53#ifdef __ASSEMBLY__
54
55/*
56 * PER_CPU finds an address of a per-cpu variable.
57 *
58 * Args:
59 * var - variable name
60 * reg - 32bit register
61 *
62 * The resulting address is stored in the "reg" argument.
63 *
64 * Example:
65 * PER_CPU(cpu_gdt_descr, %ebx)
66 */
67#ifdef CONFIG_SMP
68#define PER_CPU(var, reg) \
69 movl %fs:per_cpu__##this_cpu_off, reg; \
70 lea per_cpu__##var(reg), reg
71#define PER_CPU_VAR(var) %fs:per_cpu__##var
72#else /* ! SMP */
73#define PER_CPU(var, reg) \
74 movl $per_cpu__##var, reg
75#define PER_CPU_VAR(var) per_cpu__##var
76#endif /* SMP */
77
78#else /* ...!ASSEMBLY */
79
80/*
81 * PER_CPU finds an address of a per-cpu variable.
82 *
83 * Args:
84 * var - variable name
85 * cpu - 32bit register containing the current CPU number
86 *
87 * The resulting address is stored in the "cpu" argument.
88 *
89 * Example:
90 * PER_CPU(cpu_gdt_descr, %ebx)
91 */
92#ifdef CONFIG_SMP
93
94#define __my_cpu_offset x86_read_percpu(this_cpu_off)
95
96/* fs segment starts at (positive) offset == __per_cpu_offset[cpu] */
97#define __percpu_seg "%%fs:"
98
99#else /* !SMP */
100
101#define __percpu_seg ""
102
103#endif /* SMP */
104
105#include <asm-generic/percpu.h>
106
107/* We can use this directly for local CPU (faster). */
108DECLARE_PER_CPU(unsigned long, this_cpu_off);
109
110/* For arch-specific code, we can use direct single-insn ops (they
111 * don't give an lvalue though). */
112extern void __bad_percpu_size(void);
113
114#define percpu_to_op(op, var, val) \
115do { \
116 typedef typeof(var) T__; \
117 if (0) { \
118 T__ tmp__; \
119 tmp__ = (val); \
120 } \
121 switch (sizeof(var)) { \
122 case 1: \
123 asm(op "b %1,"__percpu_seg"%0" \
124 : "+m" (var) \
125 : "ri" ((T__)val)); \
126 break; \
127 case 2: \
128 asm(op "w %1,"__percpu_seg"%0" \
129 : "+m" (var) \
130 : "ri" ((T__)val)); \
131 break; \
132 case 4: \
133 asm(op "l %1,"__percpu_seg"%0" \
134 : "+m" (var) \
135 : "ri" ((T__)val)); \
136 break; \
137 default: __bad_percpu_size(); \
138 } \
139} while (0)
140
141#define percpu_from_op(op, var) \
142({ \
143 typeof(var) ret__; \
144 switch (sizeof(var)) { \
145 case 1: \
146 asm(op "b "__percpu_seg"%1,%0" \
147 : "=r" (ret__) \
148 : "m" (var)); \
149 break; \
150 case 2: \
151 asm(op "w "__percpu_seg"%1,%0" \
152 : "=r" (ret__) \
153 : "m" (var)); \
154 break; \
155 case 4: \
156 asm(op "l "__percpu_seg"%1,%0" \
157 : "=r" (ret__) \
158 : "m" (var)); \
159 break; \
160 default: __bad_percpu_size(); \
161 } \
162 ret__; \
163})
164
165#define x86_read_percpu(var) percpu_from_op("mov", per_cpu__##var)
166#define x86_write_percpu(var, val) percpu_to_op("mov", per_cpu__##var, val)
167#define x86_add_percpu(var, val) percpu_to_op("add", per_cpu__##var, val)
168#define x86_sub_percpu(var, val) percpu_to_op("sub", per_cpu__##var, val)
169#define x86_or_percpu(var, val) percpu_to_op("or", per_cpu__##var, val)
170#endif /* !__ASSEMBLY__ */
171#endif /* !CONFIG_X86_64 */
172
173#ifdef CONFIG_SMP
174
175/*
176 * Define the "EARLY_PER_CPU" macros. These are used for some per_cpu
177 * variables that are initialized and accessed before there are per_cpu
178 * areas allocated.
179 */
180
181#define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \
182 DEFINE_PER_CPU(_type, _name) = _initvalue; \
183 __typeof__(_type) _name##_early_map[NR_CPUS] __initdata = \
184 { [0 ... NR_CPUS-1] = _initvalue }; \
185 __typeof__(_type) *_name##_early_ptr __refdata = _name##_early_map
186
187#define EXPORT_EARLY_PER_CPU_SYMBOL(_name) \
188 EXPORT_PER_CPU_SYMBOL(_name)
189
190#define DECLARE_EARLY_PER_CPU(_type, _name) \
191 DECLARE_PER_CPU(_type, _name); \
192 extern __typeof__(_type) *_name##_early_ptr; \
193 extern __typeof__(_type) _name##_early_map[]
194
195#define early_per_cpu_ptr(_name) (_name##_early_ptr)
196#define early_per_cpu_map(_name, _idx) (_name##_early_map[_idx])
197#define early_per_cpu(_name, _cpu) \
198 (early_per_cpu_ptr(_name) ? \
199 early_per_cpu_ptr(_name)[_cpu] : \
200 per_cpu(_name, _cpu))
201
202#else /* !CONFIG_SMP */
203#define DEFINE_EARLY_PER_CPU(_type, _name, _initvalue) \
204 DEFINE_PER_CPU(_type, _name) = _initvalue
205
206#define EXPORT_EARLY_PER_CPU_SYMBOL(_name) \
207 EXPORT_PER_CPU_SYMBOL(_name)
208
209#define DECLARE_EARLY_PER_CPU(_type, _name) \
210 DECLARE_PER_CPU(_type, _name)
211
212#define early_per_cpu(_name, _cpu) per_cpu(_name, _cpu)
213#define early_per_cpu_ptr(_name) NULL
214/* no early_per_cpu_map() */
215
216#endif /* !CONFIG_SMP */
217
218#endif /* _ASM_X86_PERCPU_H_ */
diff --git a/include/asm-x86/pgalloc.h b/include/asm-x86/pgalloc.h
deleted file mode 100644
index d63ea431cb3b..000000000000
--- a/include/asm-x86/pgalloc.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _ASM_X86_PGALLOC_H
2#define _ASM_X86_PGALLOC_H
3
4#include <linux/threads.h>
5#include <linux/mm.h> /* for struct page */
6#include <linux/pagemap.h>
7
8static inline int __paravirt_pgd_alloc(struct mm_struct *mm) { return 0; }
9
10#ifdef CONFIG_PARAVIRT
11#include <asm/paravirt.h>
12#else
13#define paravirt_pgd_alloc(mm) __paravirt_pgd_alloc(mm)
14static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) {}
15static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) {}
16static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) {}
17static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,
18 unsigned long start, unsigned long count) {}
19static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn) {}
20static inline void paravirt_release_pte(unsigned long pfn) {}
21static inline void paravirt_release_pmd(unsigned long pfn) {}
22static inline void paravirt_release_pud(unsigned long pfn) {}
23#endif
24
25/*
26 * Allocate and free page tables.
27 */
28extern pgd_t *pgd_alloc(struct mm_struct *);
29extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
30
31extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
32extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
33
34/* Should really implement gc for free page table pages. This could be
35 done with a reference count in struct page. */
36
37static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
38{
39 BUG_ON((unsigned long)pte & (PAGE_SIZE-1));
40 free_page((unsigned long)pte);
41}
42
43static inline void pte_free(struct mm_struct *mm, struct page *pte)
44{
45 __free_page(pte);
46}
47
48extern void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte);
49
50static inline void pmd_populate_kernel(struct mm_struct *mm,
51 pmd_t *pmd, pte_t *pte)
52{
53 paravirt_alloc_pte(mm, __pa(pte) >> PAGE_SHIFT);
54 set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
55}
56
57static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
58 struct page *pte)
59{
60 unsigned long pfn = page_to_pfn(pte);
61
62 paravirt_alloc_pte(mm, pfn);
63 set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE));
64}
65
66#define pmd_pgtable(pmd) pmd_page(pmd)
67
68#if PAGETABLE_LEVELS > 2
69static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
70{
71 return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
72}
73
74static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
75{
76 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
77 free_page((unsigned long)pmd);
78}
79
80extern void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd);
81
82#ifdef CONFIG_X86_PAE
83extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
84#else /* !CONFIG_X86_PAE */
85static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
86{
87 paravirt_alloc_pmd(mm, __pa(pmd) >> PAGE_SHIFT);
88 set_pud(pud, __pud(_PAGE_TABLE | __pa(pmd)));
89}
90#endif /* CONFIG_X86_PAE */
91
92#if PAGETABLE_LEVELS > 3
93static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
94{
95 paravirt_alloc_pud(mm, __pa(pud) >> PAGE_SHIFT);
96 set_pgd(pgd, __pgd(_PAGE_TABLE | __pa(pud)));
97}
98
99static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
100{
101 return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
102}
103
104static inline void pud_free(struct mm_struct *mm, pud_t *pud)
105{
106 BUG_ON((unsigned long)pud & (PAGE_SIZE-1));
107 free_page((unsigned long)pud);
108}
109
110extern void __pud_free_tlb(struct mmu_gather *tlb, pud_t *pud);
111#endif /* PAGETABLE_LEVELS > 3 */
112#endif /* PAGETABLE_LEVELS > 2 */
113
114#endif /* _ASM_X86_PGALLOC_H */
diff --git a/include/asm-x86/pgtable-2level-defs.h b/include/asm-x86/pgtable-2level-defs.h
deleted file mode 100644
index 0f71c9f13da4..000000000000
--- a/include/asm-x86/pgtable-2level-defs.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _I386_PGTABLE_2LEVEL_DEFS_H
2#define _I386_PGTABLE_2LEVEL_DEFS_H
3
4#define SHARED_KERNEL_PMD 0
5
6/*
7 * traditional i386 two-level paging structure:
8 */
9
10#define PGDIR_SHIFT 22
11#define PTRS_PER_PGD 1024
12
13/*
14 * the i386 is two-level, so we don't really have any
15 * PMD directory physically.
16 */
17
18#define PTRS_PER_PTE 1024
19
20#endif /* _I386_PGTABLE_2LEVEL_DEFS_H */
diff --git a/include/asm-x86/pgtable-2level.h b/include/asm-x86/pgtable-2level.h
deleted file mode 100644
index 46bc52c0eae1..000000000000
--- a/include/asm-x86/pgtable-2level.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef _I386_PGTABLE_2LEVEL_H
2#define _I386_PGTABLE_2LEVEL_H
3
4#define pte_ERROR(e) \
5 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
6#define pgd_ERROR(e) \
7 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
8
9/*
10 * Certain architectures need to do special things when PTEs
11 * within a page table are directly modified. Thus, the following
12 * hook is made available.
13 */
14static inline void native_set_pte(pte_t *ptep , pte_t pte)
15{
16 *ptep = pte;
17}
18
19static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
20{
21 *pmdp = pmd;
22}
23
24static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
25{
26 native_set_pte(ptep, pte);
27}
28
29static inline void native_set_pte_present(struct mm_struct *mm,
30 unsigned long addr,
31 pte_t *ptep, pte_t pte)
32{
33 native_set_pte(ptep, pte);
34}
35
36static inline void native_pmd_clear(pmd_t *pmdp)
37{
38 native_set_pmd(pmdp, __pmd(0));
39}
40
41static inline void native_pte_clear(struct mm_struct *mm,
42 unsigned long addr, pte_t *xp)
43{
44 *xp = native_make_pte(0);
45}
46
47#ifdef CONFIG_SMP
48static inline pte_t native_ptep_get_and_clear(pte_t *xp)
49{
50 return __pte(xchg(&xp->pte_low, 0));
51}
52#else
53#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
54#endif
55
56#define pte_page(x) pfn_to_page(pte_pfn(x))
57#define pte_none(x) (!(x).pte_low)
58#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
59
60/*
61 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset
62 * into this range:
63 */
64#define PTE_FILE_MAX_BITS 29
65
66#define pte_to_pgoff(pte) \
67 ((((pte).pte_low >> 1) & 0x1f) + (((pte).pte_low >> 8) << 5))
68
69#define pgoff_to_pte(off) \
70 ((pte_t) { .pte_low = (((off) & 0x1f) << 1) + \
71 (((off) >> 5) << 8) + _PAGE_FILE })
72
73/* Encode and de-code a swap entry */
74#define __swp_type(x) (((x).val >> 1) & 0x1f)
75#define __swp_offset(x) ((x).val >> 8)
76#define __swp_entry(type, offset) \
77 ((swp_entry_t) { ((type) << 1) | ((offset) << 8) })
78#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_low })
79#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
80
81#endif /* _I386_PGTABLE_2LEVEL_H */
diff --git a/include/asm-x86/pgtable-3level-defs.h b/include/asm-x86/pgtable-3level-defs.h
deleted file mode 100644
index 448ac9516314..000000000000
--- a/include/asm-x86/pgtable-3level-defs.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _I386_PGTABLE_3LEVEL_DEFS_H
2#define _I386_PGTABLE_3LEVEL_DEFS_H
3
4#ifdef CONFIG_PARAVIRT
5#define SHARED_KERNEL_PMD (pv_info.shared_kernel_pmd)
6#else
7#define SHARED_KERNEL_PMD 1
8#endif
9
10/*
11 * PGDIR_SHIFT determines what a top-level page table entry can map
12 */
13#define PGDIR_SHIFT 30
14#define PTRS_PER_PGD 4
15
16/*
17 * PMD_SHIFT determines the size of the area a middle-level
18 * page table can map
19 */
20#define PMD_SHIFT 21
21#define PTRS_PER_PMD 512
22
23/*
24 * entries per page directory level
25 */
26#define PTRS_PER_PTE 512
27
28#endif /* _I386_PGTABLE_3LEVEL_DEFS_H */
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h
deleted file mode 100644
index 105057f34032..000000000000
--- a/include/asm-x86/pgtable-3level.h
+++ /dev/null
@@ -1,182 +0,0 @@
1#ifndef _I386_PGTABLE_3LEVEL_H
2#define _I386_PGTABLE_3LEVEL_H
3
4/*
5 * Intel Physical Address Extension (PAE) Mode - three-level page
6 * tables on PPro+ CPUs.
7 *
8 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
9 */
10
11#define pte_ERROR(e) \
12 printk("%s:%d: bad pte %p(%08lx%08lx).\n", \
13 __FILE__, __LINE__, &(e), (e).pte_high, (e).pte_low)
14#define pmd_ERROR(e) \
15 printk("%s:%d: bad pmd %p(%016Lx).\n", \
16 __FILE__, __LINE__, &(e), pmd_val(e))
17#define pgd_ERROR(e) \
18 printk("%s:%d: bad pgd %p(%016Lx).\n", \
19 __FILE__, __LINE__, &(e), pgd_val(e))
20
21static inline int pud_none(pud_t pud)
22{
23 return pud_val(pud) == 0;
24}
25
26static inline int pud_bad(pud_t pud)
27{
28 return (pud_val(pud) & ~(PTE_PFN_MASK | _KERNPG_TABLE | _PAGE_USER)) != 0;
29}
30
31static inline int pud_present(pud_t pud)
32{
33 return pud_val(pud) & _PAGE_PRESENT;
34}
35
36/* Rules for using set_pte: the pte being assigned *must* be
37 * either not present or in a state where the hardware will
38 * not attempt to update the pte. In places where this is
39 * not possible, use pte_get_and_clear to obtain the old pte
40 * value and then use set_pte to update it. -ben
41 */
42static inline void native_set_pte(pte_t *ptep, pte_t pte)
43{
44 ptep->pte_high = pte.pte_high;
45 smp_wmb();
46 ptep->pte_low = pte.pte_low;
47}
48
49/*
50 * Since this is only called on user PTEs, and the page fault handler
51 * must handle the already racy situation of simultaneous page faults,
52 * we are justified in merely clearing the PTE present bit, followed
53 * by a set. The ordering here is important.
54 */
55static inline void native_set_pte_present(struct mm_struct *mm,
56 unsigned long addr,
57 pte_t *ptep, pte_t pte)
58{
59 ptep->pte_low = 0;
60 smp_wmb();
61 ptep->pte_high = pte.pte_high;
62 smp_wmb();
63 ptep->pte_low = pte.pte_low;
64}
65
66static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
67{
68 set_64bit((unsigned long long *)(ptep), native_pte_val(pte));
69}
70
71static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
72{
73 set_64bit((unsigned long long *)(pmdp), native_pmd_val(pmd));
74}
75
76static inline void native_set_pud(pud_t *pudp, pud_t pud)
77{
78 set_64bit((unsigned long long *)(pudp), native_pud_val(pud));
79}
80
81/*
82 * For PTEs and PDEs, we must clear the P-bit first when clearing a page table
83 * entry, so clear the bottom half first and enforce ordering with a compiler
84 * barrier.
85 */
86static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
87 pte_t *ptep)
88{
89 ptep->pte_low = 0;
90 smp_wmb();
91 ptep->pte_high = 0;
92}
93
94static inline void native_pmd_clear(pmd_t *pmd)
95{
96 u32 *tmp = (u32 *)pmd;
97 *tmp = 0;
98 smp_wmb();
99 *(tmp + 1) = 0;
100}
101
102static inline void pud_clear(pud_t *pudp)
103{
104 unsigned long pgd;
105
106 set_pud(pudp, __pud(0));
107
108 /*
109 * According to Intel App note "TLBs, Paging-Structure Caches,
110 * and Their Invalidation", April 2007, document 317080-001,
111 * section 8.1: in PAE mode we explicitly have to flush the
112 * TLB via cr3 if the top-level pgd is changed...
113 *
114 * Make sure the pud entry we're updating is within the
115 * current pgd to avoid unnecessary TLB flushes.
116 */
117 pgd = read_cr3();
118 if (__pa(pudp) >= pgd && __pa(pudp) <
119 (pgd + sizeof(pgd_t)*PTRS_PER_PGD))
120 write_cr3(pgd);
121}
122
123#define pud_page(pud) ((struct page *) __va(pud_val(pud) & PTE_PFN_MASK))
124
125#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PTE_PFN_MASK))
126
127
128/* Find an entry in the second-level page table.. */
129#define pmd_offset(pud, address) ((pmd_t *)pud_page(*(pud)) + \
130 pmd_index(address))
131
132#ifdef CONFIG_SMP
133static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
134{
135 pte_t res;
136
137 /* xchg acts as a barrier before the setting of the high bits */
138 res.pte_low = xchg(&ptep->pte_low, 0);
139 res.pte_high = ptep->pte_high;
140 ptep->pte_high = 0;
141
142 return res;
143}
144#else
145#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
146#endif
147
148#define __HAVE_ARCH_PTE_SAME
149static inline int pte_same(pte_t a, pte_t b)
150{
151 return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
152}
153
154#define pte_page(x) pfn_to_page(pte_pfn(x))
155
156static inline int pte_none(pte_t pte)
157{
158 return !pte.pte_low && !pte.pte_high;
159}
160
161static inline unsigned long pte_pfn(pte_t pte)
162{
163 return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
164}
165
166/*
167 * Bits 0, 6 and 7 are taken in the low part of the pte,
168 * put the 32 bits of offset into the high part.
169 */
170#define pte_to_pgoff(pte) ((pte).pte_high)
171#define pgoff_to_pte(off) \
172 ((pte_t) { { .pte_low = _PAGE_FILE, .pte_high = (off) } })
173#define PTE_FILE_MAX_BITS 32
174
175/* Encode and de-code a swap entry */
176#define __swp_type(x) (((x).val) & 0x1f)
177#define __swp_offset(x) ((x).val >> 5)
178#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) << 5})
179#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
180#define __swp_entry_to_pte(x) ((pte_t){ { .pte_high = (x).val } })
181
182#endif /* _I386_PGTABLE_3LEVEL_H */
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
deleted file mode 100644
index 04caa2f544df..000000000000
--- a/include/asm-x86/pgtable.h
+++ /dev/null
@@ -1,524 +0,0 @@
1#ifndef _ASM_X86_PGTABLE_H
2#define _ASM_X86_PGTABLE_H
3
4#define FIRST_USER_ADDRESS 0
5
6#define _PAGE_BIT_PRESENT 0 /* is present */
7#define _PAGE_BIT_RW 1 /* writeable */
8#define _PAGE_BIT_USER 2 /* userspace addressable */
9#define _PAGE_BIT_PWT 3 /* page write through */
10#define _PAGE_BIT_PCD 4 /* page cache disabled */
11#define _PAGE_BIT_ACCESSED 5 /* was accessed (raised by CPU) */
12#define _PAGE_BIT_DIRTY 6 /* was written to (raised by CPU) */
13#define _PAGE_BIT_FILE 6
14#define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page */
15#define _PAGE_BIT_PAT 7 /* on 4KB pages */
16#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
17#define _PAGE_BIT_UNUSED1 9 /* available for programmer */
18#define _PAGE_BIT_UNUSED2 10
19#define _PAGE_BIT_UNUSED3 11
20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
21#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1
22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
23
24#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
25#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
26#define _PAGE_USER (_AT(pteval_t, 1) << _PAGE_BIT_USER)
27#define _PAGE_PWT (_AT(pteval_t, 1) << _PAGE_BIT_PWT)
28#define _PAGE_PCD (_AT(pteval_t, 1) << _PAGE_BIT_PCD)
29#define _PAGE_ACCESSED (_AT(pteval_t, 1) << _PAGE_BIT_ACCESSED)
30#define _PAGE_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_DIRTY)
31#define _PAGE_PSE (_AT(pteval_t, 1) << _PAGE_BIT_PSE)
32#define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL)
33#define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1)
34#define _PAGE_UNUSED2 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED2)
35#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3)
36#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
37#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
38#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
39#define __HAVE_ARCH_PTE_SPECIAL
40
41#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
42#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
43#else
44#define _PAGE_NX (_AT(pteval_t, 0))
45#endif
46
47/* If _PAGE_PRESENT is clear, we use these: */
48#define _PAGE_FILE _PAGE_DIRTY /* nonlinear file mapping,
49 * saved PTE; unset:swap */
50#define _PAGE_PROTNONE _PAGE_PSE /* if the user mapped it with PROT_NONE;
51 pte_present gives true */
52
53#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
54 _PAGE_ACCESSED | _PAGE_DIRTY)
55#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \
56 _PAGE_DIRTY)
57
58/* Set of bits not changed in pte_modify */
59#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
60 _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY)
61
62#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
63#define _PAGE_CACHE_WB (0)
64#define _PAGE_CACHE_WC (_PAGE_PWT)
65#define _PAGE_CACHE_UC_MINUS (_PAGE_PCD)
66#define _PAGE_CACHE_UC (_PAGE_PCD | _PAGE_PWT)
67
68#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
69#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
70 _PAGE_ACCESSED | _PAGE_NX)
71
72#define PAGE_SHARED_EXEC __pgprot(_PAGE_PRESENT | _PAGE_RW | \
73 _PAGE_USER | _PAGE_ACCESSED)
74#define PAGE_COPY_NOEXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
75 _PAGE_ACCESSED | _PAGE_NX)
76#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
77 _PAGE_ACCESSED)
78#define PAGE_COPY PAGE_COPY_NOEXEC
79#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | \
80 _PAGE_ACCESSED | _PAGE_NX)
81#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
82 _PAGE_ACCESSED)
83
84#define __PAGE_KERNEL_EXEC \
85 (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
86#define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
87
88#define __PAGE_KERNEL_RO (__PAGE_KERNEL & ~_PAGE_RW)
89#define __PAGE_KERNEL_RX (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
90#define __PAGE_KERNEL_EXEC_NOCACHE (__PAGE_KERNEL_EXEC | _PAGE_PCD | _PAGE_PWT)
91#define __PAGE_KERNEL_WC (__PAGE_KERNEL | _PAGE_CACHE_WC)
92#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
93#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
94#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
95#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
96#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
97#define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE)
98#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
99
100#define PAGE_KERNEL __pgprot(__PAGE_KERNEL)
101#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO)
102#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
103#define PAGE_KERNEL_RX __pgprot(__PAGE_KERNEL_RX)
104#define PAGE_KERNEL_WC __pgprot(__PAGE_KERNEL_WC)
105#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE)
106#define PAGE_KERNEL_UC_MINUS __pgprot(__PAGE_KERNEL_UC_MINUS)
107#define PAGE_KERNEL_EXEC_NOCACHE __pgprot(__PAGE_KERNEL_EXEC_NOCACHE)
108#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE)
109#define PAGE_KERNEL_LARGE_NOCACHE __pgprot(__PAGE_KERNEL_LARGE_NOCACHE)
110#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
111#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
112#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE)
113
114/* xwr */
115#define __P000 PAGE_NONE
116#define __P001 PAGE_READONLY
117#define __P010 PAGE_COPY
118#define __P011 PAGE_COPY
119#define __P100 PAGE_READONLY_EXEC
120#define __P101 PAGE_READONLY_EXEC
121#define __P110 PAGE_COPY_EXEC
122#define __P111 PAGE_COPY_EXEC
123
124#define __S000 PAGE_NONE
125#define __S001 PAGE_READONLY
126#define __S010 PAGE_SHARED
127#define __S011 PAGE_SHARED
128#define __S100 PAGE_READONLY_EXEC
129#define __S101 PAGE_READONLY_EXEC
130#define __S110 PAGE_SHARED_EXEC
131#define __S111 PAGE_SHARED_EXEC
132
133#ifndef __ASSEMBLY__
134
135/*
136 * ZERO_PAGE is a global shared page that is always zero: used
137 * for zero-mapped memory areas etc..
138 */
139extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
140#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
141
142extern spinlock_t pgd_lock;
143extern struct list_head pgd_list;
144
145/*
146 * The following only work if pte_present() is true.
147 * Undefined behaviour if not..
148 */
149static inline int pte_dirty(pte_t pte)
150{
151 return pte_flags(pte) & _PAGE_DIRTY;
152}
153
154static inline int pte_young(pte_t pte)
155{
156 return pte_flags(pte) & _PAGE_ACCESSED;
157}
158
159static inline int pte_write(pte_t pte)
160{
161 return pte_flags(pte) & _PAGE_RW;
162}
163
164static inline int pte_file(pte_t pte)
165{
166 return pte_flags(pte) & _PAGE_FILE;
167}
168
169static inline int pte_huge(pte_t pte)
170{
171 return pte_flags(pte) & _PAGE_PSE;
172}
173
174static inline int pte_global(pte_t pte)
175{
176 return pte_flags(pte) & _PAGE_GLOBAL;
177}
178
179static inline int pte_exec(pte_t pte)
180{
181 return !(pte_flags(pte) & _PAGE_NX);
182}
183
184static inline int pte_special(pte_t pte)
185{
186 return pte_val(pte) & _PAGE_SPECIAL;
187}
188
189static inline int pmd_large(pmd_t pte)
190{
191 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
192 (_PAGE_PSE | _PAGE_PRESENT);
193}
194
195static inline pte_t pte_mkclean(pte_t pte)
196{
197 return __pte(pte_val(pte) & ~_PAGE_DIRTY);
198}
199
200static inline pte_t pte_mkold(pte_t pte)
201{
202 return __pte(pte_val(pte) & ~_PAGE_ACCESSED);
203}
204
205static inline pte_t pte_wrprotect(pte_t pte)
206{
207 return __pte(pte_val(pte) & ~_PAGE_RW);
208}
209
210static inline pte_t pte_mkexec(pte_t pte)
211{
212 return __pte(pte_val(pte) & ~_PAGE_NX);
213}
214
215static inline pte_t pte_mkdirty(pte_t pte)
216{
217 return __pte(pte_val(pte) | _PAGE_DIRTY);
218}
219
220static inline pte_t pte_mkyoung(pte_t pte)
221{
222 return __pte(pte_val(pte) | _PAGE_ACCESSED);
223}
224
225static inline pte_t pte_mkwrite(pte_t pte)
226{
227 return __pte(pte_val(pte) | _PAGE_RW);
228}
229
230static inline pte_t pte_mkhuge(pte_t pte)
231{
232 return __pte(pte_val(pte) | _PAGE_PSE);
233}
234
235static inline pte_t pte_clrhuge(pte_t pte)
236{
237 return __pte(pte_val(pte) & ~_PAGE_PSE);
238}
239
240static inline pte_t pte_mkglobal(pte_t pte)
241{
242 return __pte(pte_val(pte) | _PAGE_GLOBAL);
243}
244
245static inline pte_t pte_clrglobal(pte_t pte)
246{
247 return __pte(pte_val(pte) & ~_PAGE_GLOBAL);
248}
249
250static inline pte_t pte_mkspecial(pte_t pte)
251{
252 return __pte(pte_val(pte) | _PAGE_SPECIAL);
253}
254
255extern pteval_t __supported_pte_mask;
256
257static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
258{
259 return __pte((((phys_addr_t)page_nr << PAGE_SHIFT) |
260 pgprot_val(pgprot)) & __supported_pte_mask);
261}
262
263static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
264{
265 return __pmd((((phys_addr_t)page_nr << PAGE_SHIFT) |
266 pgprot_val(pgprot)) & __supported_pte_mask);
267}
268
269static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
270{
271 pteval_t val = pte_val(pte);
272
273 /*
274 * Chop off the NX bit (if present), and add the NX portion of
275 * the newprot (if present):
276 */
277 val &= _PAGE_CHG_MASK;
278 val |= pgprot_val(newprot) & (~_PAGE_CHG_MASK) & __supported_pte_mask;
279
280 return __pte(val);
281}
282
283/* mprotect needs to preserve PAT bits when updating vm_page_prot */
284#define pgprot_modify pgprot_modify
285static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
286{
287 pgprotval_t preservebits = pgprot_val(oldprot) & _PAGE_CHG_MASK;
288 pgprotval_t addbits = pgprot_val(newprot);
289 return __pgprot(preservebits | addbits);
290}
291
292#define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)
293
294#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
295
296#ifndef __ASSEMBLY__
297#define __HAVE_PHYS_MEM_ACCESS_PROT
298struct file;
299pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
300 unsigned long size, pgprot_t vma_prot);
301int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
302 unsigned long size, pgprot_t *vma_prot);
303#endif
304
305/* Install a pte for a particular vaddr in kernel space. */
306void set_pte_vaddr(unsigned long vaddr, pte_t pte);
307
308#ifdef CONFIG_X86_32
309extern void native_pagetable_setup_start(pgd_t *base);
310extern void native_pagetable_setup_done(pgd_t *base);
311#else
312static inline void native_pagetable_setup_start(pgd_t *base) {}
313static inline void native_pagetable_setup_done(pgd_t *base) {}
314#endif
315
316#ifdef CONFIG_PARAVIRT
317#include <asm/paravirt.h>
318#else /* !CONFIG_PARAVIRT */
319#define set_pte(ptep, pte) native_set_pte(ptep, pte)
320#define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, ptep, pte)
321
322#define set_pte_present(mm, addr, ptep, pte) \
323 native_set_pte_present(mm, addr, ptep, pte)
324#define set_pte_atomic(ptep, pte) \
325 native_set_pte_atomic(ptep, pte)
326
327#define set_pmd(pmdp, pmd) native_set_pmd(pmdp, pmd)
328
329#ifndef __PAGETABLE_PUD_FOLDED
330#define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd)
331#define pgd_clear(pgd) native_pgd_clear(pgd)
332#endif
333
334#ifndef set_pud
335# define set_pud(pudp, pud) native_set_pud(pudp, pud)
336#endif
337
338#ifndef __PAGETABLE_PMD_FOLDED
339#define pud_clear(pud) native_pud_clear(pud)
340#endif
341
342#define pte_clear(mm, addr, ptep) native_pte_clear(mm, addr, ptep)
343#define pmd_clear(pmd) native_pmd_clear(pmd)
344
345#define pte_update(mm, addr, ptep) do { } while (0)
346#define pte_update_defer(mm, addr, ptep) do { } while (0)
347
348static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
349{
350 native_pagetable_setup_start(base);
351}
352
353static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
354{
355 native_pagetable_setup_done(base);
356}
357#endif /* CONFIG_PARAVIRT */
358
359#endif /* __ASSEMBLY__ */
360
361#ifdef CONFIG_X86_32
362# include "pgtable_32.h"
363#else
364# include "pgtable_64.h"
365#endif
366
367/*
368 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
369 *
370 * this macro returns the index of the entry in the pgd page which would
371 * control the given virtual address
372 */
373#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
374
375/*
376 * pgd_offset() returns a (pgd_t *)
377 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
378 */
379#define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address)))
380/*
381 * a shortcut which implies the use of the kernel's pgd, instead
382 * of a process's
383 */
384#define pgd_offset_k(address) pgd_offset(&init_mm, (address))
385
386
387#define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)
388#define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY)
389
390#ifndef __ASSEMBLY__
391
392enum {
393 PG_LEVEL_NONE,
394 PG_LEVEL_4K,
395 PG_LEVEL_2M,
396 PG_LEVEL_1G,
397 PG_LEVEL_NUM
398};
399
400#ifdef CONFIG_PROC_FS
401extern void update_page_count(int level, unsigned long pages);
402#else
403static inline void update_page_count(int level, unsigned long pages) { }
404#endif
405
406/*
407 * Helper function that returns the kernel pagetable entry controlling
408 * the virtual address 'address'. NULL means no pagetable entry present.
409 * NOTE: the return type is pte_t but if the pmd is PSE then we return it
410 * as a pte too.
411 */
412extern pte_t *lookup_address(unsigned long address, unsigned int *level);
413
414/* local pte updates need not use xchg for locking */
415static inline pte_t native_local_ptep_get_and_clear(pte_t *ptep)
416{
417 pte_t res = *ptep;
418
419 /* Pure native function needs no input for mm, addr */
420 native_pte_clear(NULL, 0, ptep);
421 return res;
422}
423
424static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr,
425 pte_t *ptep , pte_t pte)
426{
427 native_set_pte(ptep, pte);
428}
429
430#ifndef CONFIG_PARAVIRT
431/*
432 * Rules for using pte_update - it must be called after any PTE update which
433 * has not been done using the set_pte / clear_pte interfaces. It is used by
434 * shadow mode hypervisors to resynchronize the shadow page tables. Kernel PTE
435 * updates should either be sets, clears, or set_pte_atomic for P->P
436 * transitions, which means this hook should only be called for user PTEs.
437 * This hook implies a P->P protection or access change has taken place, which
438 * requires a subsequent TLB flush. The notification can optionally be delayed
439 * until the TLB flush event by using the pte_update_defer form of the
440 * interface, but care must be taken to assure that the flush happens while
441 * still holding the same page table lock so that the shadow and primary pages
442 * do not become out of sync on SMP.
443 */
444#define pte_update(mm, addr, ptep) do { } while (0)
445#define pte_update_defer(mm, addr, ptep) do { } while (0)
446#endif
447
448/*
449 * We only update the dirty/accessed state if we set
450 * the dirty bit by hand in the kernel, since the hardware
451 * will do the accessed bit for us, and we don't want to
452 * race with other CPU's that might be updating the dirty
453 * bit at the same time.
454 */
455struct vm_area_struct;
456
457#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
458extern int ptep_set_access_flags(struct vm_area_struct *vma,
459 unsigned long address, pte_t *ptep,
460 pte_t entry, int dirty);
461
462#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
463extern int ptep_test_and_clear_young(struct vm_area_struct *vma,
464 unsigned long addr, pte_t *ptep);
465
466#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
467extern int ptep_clear_flush_young(struct vm_area_struct *vma,
468 unsigned long address, pte_t *ptep);
469
470#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
471static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
472 pte_t *ptep)
473{
474 pte_t pte = native_ptep_get_and_clear(ptep);
475 pte_update(mm, addr, ptep);
476 return pte;
477}
478
479#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
480static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
481 unsigned long addr, pte_t *ptep,
482 int full)
483{
484 pte_t pte;
485 if (full) {
486 /*
487 * Full address destruction in progress; paravirt does not
488 * care about updates and native needs no locking
489 */
490 pte = native_local_ptep_get_and_clear(ptep);
491 } else {
492 pte = ptep_get_and_clear(mm, addr, ptep);
493 }
494 return pte;
495}
496
497#define __HAVE_ARCH_PTEP_SET_WRPROTECT
498static inline void ptep_set_wrprotect(struct mm_struct *mm,
499 unsigned long addr, pte_t *ptep)
500{
501 clear_bit(_PAGE_BIT_RW, (unsigned long *)&ptep->pte);
502 pte_update(mm, addr, ptep);
503}
504
505/*
506 * clone_pgd_range(pgd_t *dst, pgd_t *src, int count);
507 *
508 * dst - pointer to pgd range anwhere on a pgd page
509 * src - ""
510 * count - the number of pgds to copy.
511 *
512 * dst and src can be on the same page, but the range must not overlap,
513 * and must not cross a page boundary.
514 */
515static inline void clone_pgd_range(pgd_t *dst, pgd_t *src, int count)
516{
517 memcpy(dst, src, count * sizeof(pgd_t));
518}
519
520
521#include <asm-generic/pgtable.h>
522#endif /* __ASSEMBLY__ */
523
524#endif /* _ASM_X86_PGTABLE_H */
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
deleted file mode 100644
index 5c3b26567a95..000000000000
--- a/include/asm-x86/pgtable_32.h
+++ /dev/null
@@ -1,189 +0,0 @@
1#ifndef _I386_PGTABLE_H
2#define _I386_PGTABLE_H
3
4
5/*
6 * The Linux memory management assumes a three-level page table setup. On
7 * the i386, we use that, but "fold" the mid level into the top-level page
8 * table, so that we physically have the same two-level page table as the
9 * i386 mmu expects.
10 *
11 * This file contains the functions and defines necessary to modify and use
12 * the i386 page table tree.
13 */
14#ifndef __ASSEMBLY__
15#include <asm/processor.h>
16#include <asm/fixmap.h>
17#include <linux/threads.h>
18#include <asm/paravirt.h>
19
20#include <linux/bitops.h>
21#include <linux/slab.h>
22#include <linux/list.h>
23#include <linux/spinlock.h>
24
25struct mm_struct;
26struct vm_area_struct;
27
28extern pgd_t swapper_pg_dir[1024];
29
30static inline void pgtable_cache_init(void) { }
31static inline void check_pgt_cache(void) { }
32void paging_init(void);
33
34
35/*
36 * The Linux x86 paging architecture is 'compile-time dual-mode', it
37 * implements both the traditional 2-level x86 page tables and the
38 * newer 3-level PAE-mode page tables.
39 */
40#ifdef CONFIG_X86_PAE
41# include <asm/pgtable-3level-defs.h>
42# define PMD_SIZE (1UL << PMD_SHIFT)
43# define PMD_MASK (~(PMD_SIZE - 1))
44#else
45# include <asm/pgtable-2level-defs.h>
46#endif
47
48#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
49#define PGDIR_MASK (~(PGDIR_SIZE - 1))
50
51/* Just any arbitrary offset to the start of the vmalloc VM area: the
52 * current 8MB value just means that there will be a 8MB "hole" after the
53 * physical memory until the kernel virtual memory starts. That means that
54 * any out-of-bounds memory accesses will hopefully be caught.
55 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
56 * area for the same reason. ;)
57 */
58#define VMALLOC_OFFSET (8 * 1024 * 1024)
59#define VMALLOC_START (((unsigned long)high_memory + 2 * VMALLOC_OFFSET - 1) \
60 & ~(VMALLOC_OFFSET - 1))
61#ifdef CONFIG_X86_PAE
62#define LAST_PKMAP 512
63#else
64#define LAST_PKMAP 1024
65#endif
66
67#define PKMAP_BASE ((FIXADDR_BOOT_START - PAGE_SIZE * (LAST_PKMAP + 1)) \
68 & PMD_MASK)
69
70#ifdef CONFIG_HIGHMEM
71# define VMALLOC_END (PKMAP_BASE - 2 * PAGE_SIZE)
72#else
73# define VMALLOC_END (FIXADDR_START - 2 * PAGE_SIZE)
74#endif
75
76/*
77 * Define this if things work differently on an i386 and an i486:
78 * it will (on an i486) warn about kernel memory accesses that are
79 * done without a 'access_ok(VERIFY_WRITE,..)'
80 */
81#undef TEST_ACCESS_OK
82
83/* The boot page tables (all created as a single array) */
84extern unsigned long pg0[];
85
86#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
87
88/* To avoid harmful races, pmd_none(x) should check only the lower when PAE */
89#define pmd_none(x) (!(unsigned long)pmd_val((x)))
90#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
91#define pmd_bad(x) ((pmd_val(x) & (PTE_FLAGS_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
92
93#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
94
95#ifdef CONFIG_X86_PAE
96# include <asm/pgtable-3level.h>
97#else
98# include <asm/pgtable-2level.h>
99#endif
100
101/*
102 * Macro to mark a page protection value as "uncacheable".
103 * On processors which do not support it, this is a no-op.
104 */
105#define pgprot_noncached(prot) \
106 ((boot_cpu_data.x86 > 3) \
107 ? (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) \
108 : (prot))
109
110/*
111 * Conversion functions: convert a page and protection to a page entry,
112 * and a page entry and page directory to the page they refer to.
113 */
114#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
115
116
117static inline int pud_large(pud_t pud) { return 0; }
118
119/*
120 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
121 *
122 * this macro returns the index of the entry in the pmd page which would
123 * control the given virtual address
124 */
125#define pmd_index(address) \
126 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
127
128/*
129 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
130 *
131 * this macro returns the index of the entry in the pte page which would
132 * control the given virtual address
133 */
134#define pte_index(address) \
135 (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
136#define pte_offset_kernel(dir, address) \
137 ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index((address)))
138
139#define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
140
141#define pmd_page_vaddr(pmd) \
142 ((unsigned long)__va(pmd_val((pmd)) & PTE_PFN_MASK))
143
144#if defined(CONFIG_HIGHPTE)
145#define pte_offset_map(dir, address) \
146 ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \
147 pte_index((address)))
148#define pte_offset_map_nested(dir, address) \
149 ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \
150 pte_index((address)))
151#define pte_unmap(pte) kunmap_atomic((pte), KM_PTE0)
152#define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
153#else
154#define pte_offset_map(dir, address) \
155 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
156#define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address))
157#define pte_unmap(pte) do { } while (0)
158#define pte_unmap_nested(pte) do { } while (0)
159#endif
160
161/* Clear a kernel PTE and flush it from the TLB */
162#define kpte_clear_flush(ptep, vaddr) \
163do { \
164 pte_clear(&init_mm, (vaddr), (ptep)); \
165 __flush_tlb_one((vaddr)); \
166} while (0)
167
168/*
169 * The i386 doesn't have any external MMU info: the kernel page
170 * tables contain all the necessary information.
171 */
172#define update_mmu_cache(vma, address, pte) do { } while (0)
173
174#endif /* !__ASSEMBLY__ */
175
176/*
177 * kern_addr_valid() is (1) for FLATMEM and (0) for
178 * SPARSEMEM and DISCONTIGMEM
179 */
180#ifdef CONFIG_FLATMEM
181#define kern_addr_valid(addr) (1)
182#else
183#define kern_addr_valid(kaddr) (0)
184#endif
185
186#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
187 remap_pfn_range(vma, vaddr, pfn, size, prot)
188
189#endif /* _I386_PGTABLE_H */
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
deleted file mode 100644
index 549144d03d99..000000000000
--- a/include/asm-x86/pgtable_64.h
+++ /dev/null
@@ -1,287 +0,0 @@
1#ifndef _X86_64_PGTABLE_H
2#define _X86_64_PGTABLE_H
3
4#include <linux/const.h>
5#ifndef __ASSEMBLY__
6
7/*
8 * This file contains the functions and defines necessary to modify and use
9 * the x86-64 page table tree.
10 */
11#include <asm/processor.h>
12#include <linux/bitops.h>
13#include <linux/threads.h>
14#include <asm/pda.h>
15
16extern pud_t level3_kernel_pgt[512];
17extern pud_t level3_ident_pgt[512];
18extern pmd_t level2_kernel_pgt[512];
19extern pmd_t level2_fixmap_pgt[512];
20extern pmd_t level2_ident_pgt[512];
21extern pgd_t init_level4_pgt[];
22
23#define swapper_pg_dir init_level4_pgt
24
25extern void paging_init(void);
26
27#endif /* !__ASSEMBLY__ */
28
29#define SHARED_KERNEL_PMD 0
30
31/*
32 * PGDIR_SHIFT determines what a top-level page table entry can map
33 */
34#define PGDIR_SHIFT 39
35#define PTRS_PER_PGD 512
36
37/*
38 * 3rd level page
39 */
40#define PUD_SHIFT 30
41#define PTRS_PER_PUD 512
42
43/*
44 * PMD_SHIFT determines the size of the area a middle-level
45 * page table can map
46 */
47#define PMD_SHIFT 21
48#define PTRS_PER_PMD 512
49
50/*
51 * entries per page directory level
52 */
53#define PTRS_PER_PTE 512
54
55#ifndef __ASSEMBLY__
56
57#define pte_ERROR(e) \
58 printk("%s:%d: bad pte %p(%016lx).\n", \
59 __FILE__, __LINE__, &(e), pte_val(e))
60#define pmd_ERROR(e) \
61 printk("%s:%d: bad pmd %p(%016lx).\n", \
62 __FILE__, __LINE__, &(e), pmd_val(e))
63#define pud_ERROR(e) \
64 printk("%s:%d: bad pud %p(%016lx).\n", \
65 __FILE__, __LINE__, &(e), pud_val(e))
66#define pgd_ERROR(e) \
67 printk("%s:%d: bad pgd %p(%016lx).\n", \
68 __FILE__, __LINE__, &(e), pgd_val(e))
69
70#define pgd_none(x) (!pgd_val(x))
71#define pud_none(x) (!pud_val(x))
72
73struct mm_struct;
74
75void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
76
77
78static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
79 pte_t *ptep)
80{
81 *ptep = native_make_pte(0);
82}
83
84static inline void native_set_pte(pte_t *ptep, pte_t pte)
85{
86 *ptep = pte;
87}
88
89static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
90{
91 native_set_pte(ptep, pte);
92}
93
94static inline pte_t native_ptep_get_and_clear(pte_t *xp)
95{
96#ifdef CONFIG_SMP
97 return native_make_pte(xchg(&xp->pte, 0));
98#else
99 /* native_local_ptep_get_and_clear,
100 but duplicated because of cyclic dependency */
101 pte_t ret = *xp;
102 native_pte_clear(NULL, 0, xp);
103 return ret;
104#endif
105}
106
107static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
108{
109 *pmdp = pmd;
110}
111
112static inline void native_pmd_clear(pmd_t *pmd)
113{
114 native_set_pmd(pmd, native_make_pmd(0));
115}
116
117static inline void native_set_pud(pud_t *pudp, pud_t pud)
118{
119 *pudp = pud;
120}
121
122static inline void native_pud_clear(pud_t *pud)
123{
124 native_set_pud(pud, native_make_pud(0));
125}
126
127static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
128{
129 *pgdp = pgd;
130}
131
132static inline void native_pgd_clear(pgd_t *pgd)
133{
134 native_set_pgd(pgd, native_make_pgd(0));
135}
136
137#define pte_same(a, b) ((a).pte == (b).pte)
138
139#endif /* !__ASSEMBLY__ */
140
141#define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)
142#define PMD_MASK (~(PMD_SIZE - 1))
143#define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)
144#define PUD_MASK (~(PUD_SIZE - 1))
145#define PGDIR_SIZE (_AC(1, UL) << PGDIR_SHIFT)
146#define PGDIR_MASK (~(PGDIR_SIZE - 1))
147
148
149#define MAXMEM _AC(0x00003fffffffffff, UL)
150#define VMALLOC_START _AC(0xffffc20000000000, UL)
151#define VMALLOC_END _AC(0xffffe1ffffffffff, UL)
152#define VMEMMAP_START _AC(0xffffe20000000000, UL)
153#define MODULES_VADDR _AC(0xffffffffa0000000, UL)
154#define MODULES_END _AC(0xffffffffff000000, UL)
155#define MODULES_LEN (MODULES_END - MODULES_VADDR)
156
157#ifndef __ASSEMBLY__
158
159static inline int pgd_bad(pgd_t pgd)
160{
161 return (pgd_val(pgd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
162}
163
164static inline int pud_bad(pud_t pud)
165{
166 return (pud_val(pud) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
167}
168
169static inline int pmd_bad(pmd_t pmd)
170{
171 return (pmd_val(pmd) & ~(PTE_PFN_MASK | _PAGE_USER)) != _KERNPG_TABLE;
172}
173
174#define pte_none(x) (!pte_val((x)))
175#define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE))
176
177#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */
178#define pte_page(x) pfn_to_page(pte_pfn((x)))
179#define pte_pfn(x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
180
181/*
182 * Macro to mark a page protection value as "uncacheable".
183 */
184#define pgprot_noncached(prot) \
185 (__pgprot(pgprot_val((prot)) | _PAGE_PCD | _PAGE_PWT))
186
187/*
188 * Conversion functions: convert a page and protection to a page entry,
189 * and a page entry and page directory to the page they refer to.
190 */
191
192/*
193 * Level 4 access.
194 */
195#define pgd_page_vaddr(pgd) \
196 ((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_PFN_MASK))
197#define pgd_page(pgd) (pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))
198#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
199static inline int pgd_large(pgd_t pgd) { return 0; }
200#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
201
202/* PUD - Level3 access */
203/* to find an entry in a page-table-directory. */
204#define pud_page_vaddr(pud) \
205 ((unsigned long)__va(pud_val((pud)) & PHYSICAL_PAGE_MASK))
206#define pud_page(pud) (pfn_to_page(pud_val((pud)) >> PAGE_SHIFT))
207#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
208#define pud_offset(pgd, address) \
209 ((pud_t *)pgd_page_vaddr(*(pgd)) + pud_index((address)))
210#define pud_present(pud) (pud_val((pud)) & _PAGE_PRESENT)
211
212static inline int pud_large(pud_t pte)
213{
214 return (pud_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
215 (_PAGE_PSE | _PAGE_PRESENT);
216}
217
218/* PMD - Level 2 access */
219#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val((pmd)) & PTE_PFN_MASK))
220#define pmd_page(pmd) (pfn_to_page(pmd_val((pmd)) >> PAGE_SHIFT))
221
222#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
223#define pmd_offset(dir, address) ((pmd_t *)pud_page_vaddr(*(dir)) + \
224 pmd_index(address))
225#define pmd_none(x) (!pmd_val((x)))
226#define pmd_present(x) (pmd_val((x)) & _PAGE_PRESENT)
227#define pfn_pmd(nr, prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val((prot))))
228#define pmd_pfn(x) ((pmd_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
229
230#define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
231#define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \
232 _PAGE_FILE })
233#define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT
234
235/* PTE - Level 1 access. */
236
237/* page, protection -> pte */
238#define mk_pte(page, pgprot) pfn_pte(page_to_pfn((page)), (pgprot))
239
240#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
241#define pte_offset_kernel(dir, address) ((pte_t *) pmd_page_vaddr(*(dir)) + \
242 pte_index((address)))
243
244/* x86-64 always has all page tables mapped. */
245#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
246#define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address))
247#define pte_unmap(pte) /* NOP */
248#define pte_unmap_nested(pte) /* NOP */
249
250#define update_mmu_cache(vma, address, pte) do { } while (0)
251
252extern int direct_gbpages;
253
254/* Encode and de-code a swap entry */
255#define __swp_type(x) (((x).val >> 1) & 0x3f)
256#define __swp_offset(x) ((x).val >> 8)
257#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | \
258 ((offset) << 8) })
259#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) })
260#define __swp_entry_to_pte(x) ((pte_t) { .pte = (x).val })
261
262extern int kern_addr_valid(unsigned long addr);
263extern void cleanup_highmap(void);
264
265#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
266 remap_pfn_range(vma, vaddr, pfn, size, prot)
267
268#define HAVE_ARCH_UNMAPPED_AREA
269#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
270
271#define pgtable_cache_init() do { } while (0)
272#define check_pgt_cache() do { } while (0)
273
274#define PAGE_AGP PAGE_KERNEL_NOCACHE
275#define HAVE_PAGE_AGP 1
276
277/* fs/proc/kcore.c */
278#define kc_vaddr_to_offset(v) ((v) & __VIRTUAL_MASK)
279#define kc_offset_to_vaddr(o) \
280 (((o) & (1UL << (__VIRTUAL_MASK_SHIFT - 1))) \
281 ? ((o) | ~__VIRTUAL_MASK) \
282 : (o))
283
284#define __HAVE_ARCH_PTE_SAME
285#endif /* !__ASSEMBLY__ */
286
287#endif /* _X86_64_PGTABLE_H */
diff --git a/include/asm-x86/poll.h b/include/asm-x86/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/include/asm-x86/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/include/asm-x86/posix_types.h b/include/asm-x86/posix_types.h
deleted file mode 100644
index bb7133dc155d..000000000000
--- a/include/asm-x86/posix_types.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifdef __KERNEL__
2# ifdef CONFIG_X86_32
3# include "posix_types_32.h"
4# else
5# include "posix_types_64.h"
6# endif
7#else
8# ifdef __i386__
9# include "posix_types_32.h"
10# else
11# include "posix_types_64.h"
12# endif
13#endif
diff --git a/include/asm-x86/posix_types_32.h b/include/asm-x86/posix_types_32.h
deleted file mode 100644
index b031efda37ec..000000000000
--- a/include/asm-x86/posix_types_32.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#ifndef __ARCH_I386_POSIX_TYPES_H
2#define __ARCH_I386_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned short __kernel_mode_t;
12typedef unsigned short __kernel_nlink_t;
13typedef long __kernel_off_t;
14typedef int __kernel_pid_t;
15typedef unsigned short __kernel_ipc_pid_t;
16typedef unsigned short __kernel_uid_t;
17typedef unsigned short __kernel_gid_t;
18typedef unsigned int __kernel_size_t;
19typedef int __kernel_ssize_t;
20typedef int __kernel_ptrdiff_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef unsigned int __kernel_uid32_t;
31typedef unsigned int __kernel_gid32_t;
32
33typedef unsigned short __kernel_old_uid_t;
34typedef unsigned short __kernel_old_gid_t;
35typedef unsigned short __kernel_old_dev_t;
36
37#ifdef __GNUC__
38typedef long long __kernel_loff_t;
39#endif
40
41typedef struct {
42 int val[2];
43} __kernel_fsid_t;
44
45#if defined(__KERNEL__)
46
47#undef __FD_SET
48#define __FD_SET(fd,fdsetp) \
49 asm volatile("btsl %1,%0": \
50 "+m" (*(__kernel_fd_set *)(fdsetp)) \
51 : "r" ((int)(fd)))
52
53#undef __FD_CLR
54#define __FD_CLR(fd,fdsetp) \
55 asm volatile("btrl %1,%0": \
56 "+m" (*(__kernel_fd_set *)(fdsetp)) \
57 : "r" ((int) (fd)))
58
59#undef __FD_ISSET
60#define __FD_ISSET(fd,fdsetp) \
61 (__extension__ \
62 ({ \
63 unsigned char __result; \
64 asm volatile("btl %1,%2 ; setb %0" \
65 : "=q" (__result) \
66 : "r" ((int)(fd)), \
67 "m" (*(__kernel_fd_set *)(fdsetp))); \
68 __result; \
69}))
70
71#undef __FD_ZERO
72#define __FD_ZERO(fdsetp) \
73do { \
74 int __d0, __d1; \
75 asm volatile("cld ; rep ; stosl" \
76 : "=m" (*(__kernel_fd_set *)(fdsetp)), \
77 "=&c" (__d0), "=&D" (__d1) \
78 : "a" (0), "1" (__FDSET_LONGS), \
79 "2" ((__kernel_fd_set *)(fdsetp)) \
80 : "memory"); \
81} while (0)
82
83#endif /* defined(__KERNEL__) */
84
85#endif
diff --git a/include/asm-x86/posix_types_64.h b/include/asm-x86/posix_types_64.h
deleted file mode 100644
index d6624c95854a..000000000000
--- a/include/asm-x86/posix_types_64.h
+++ /dev/null
@@ -1,119 +0,0 @@
1#ifndef _ASM_X86_64_POSIX_TYPES_H
2#define _ASM_X86_64_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned int __kernel_mode_t;
12typedef unsigned long __kernel_nlink_t;
13typedef long __kernel_off_t;
14typedef int __kernel_pid_t;
15typedef int __kernel_ipc_pid_t;
16typedef unsigned int __kernel_uid_t;
17typedef unsigned int __kernel_gid_t;
18typedef unsigned long __kernel_size_t;
19typedef long __kernel_ssize_t;
20typedef long __kernel_ptrdiff_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30
31#ifdef __GNUC__
32typedef long long __kernel_loff_t;
33#endif
34
35typedef struct {
36 int val[2];
37} __kernel_fsid_t;
38
39typedef unsigned short __kernel_old_uid_t;
40typedef unsigned short __kernel_old_gid_t;
41typedef __kernel_uid_t __kernel_uid32_t;
42typedef __kernel_gid_t __kernel_gid32_t;
43
44typedef unsigned long __kernel_old_dev_t;
45
46#ifdef __KERNEL__
47
48#undef __FD_SET
49static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
50{
51 unsigned long _tmp = fd / __NFDBITS;
52 unsigned long _rem = fd % __NFDBITS;
53 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
54}
55
56#undef __FD_CLR
57static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
58{
59 unsigned long _tmp = fd / __NFDBITS;
60 unsigned long _rem = fd % __NFDBITS;
61 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
62}
63
64#undef __FD_ISSET
65static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
66{
67 unsigned long _tmp = fd / __NFDBITS;
68 unsigned long _rem = fd % __NFDBITS;
69 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
70}
71
72/*
73 * This will unroll the loop for the normal constant cases (8 or 32 longs,
74 * for 256 and 1024-bit fd_sets respectively)
75 */
76#undef __FD_ZERO
77static inline void __FD_ZERO(__kernel_fd_set *p)
78{
79 unsigned long *tmp = p->fds_bits;
80 int i;
81
82 if (__builtin_constant_p(__FDSET_LONGS)) {
83 switch (__FDSET_LONGS) {
84 case 32:
85 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
86 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
87 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
88 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
89 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
90 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
91 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
92 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
93 return;
94 case 16:
95 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
96 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
97 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
98 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
99 return;
100 case 8:
101 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
102 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
103 return;
104 case 4:
105 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
106 return;
107 }
108 }
109 i = __FDSET_LONGS;
110 while (i) {
111 i--;
112 *tmp = 0;
113 tmp++;
114 }
115}
116
117#endif /* defined(__KERNEL__) */
118
119#endif
diff --git a/include/asm-x86/prctl.h b/include/asm-x86/prctl.h
deleted file mode 100644
index 52952adef1ca..000000000000
--- a/include/asm-x86/prctl.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef X86_64_PRCTL_H
2#define X86_64_PRCTL_H 1
3
4#define ARCH_SET_GS 0x1001
5#define ARCH_SET_FS 0x1002
6#define ARCH_GET_FS 0x1003
7#define ARCH_GET_GS 0x1004
8
9
10#endif
diff --git a/include/asm-x86/processor-cyrix.h b/include/asm-x86/processor-cyrix.h
deleted file mode 100644
index 97568ada1f97..000000000000
--- a/include/asm-x86/processor-cyrix.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * NSC/Cyrix CPU indexed register access. Must be inlined instead of
3 * macros to ensure correct access ordering
4 * Access order is always 0x22 (=offset), 0x23 (=value)
5 *
6 * When using the old macros a line like
7 * setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
8 * gets expanded to:
9 * do {
10 * outb((CX86_CCR2), 0x22);
11 * outb((({
12 * outb((CX86_CCR2), 0x22);
13 * inb(0x23);
14 * }) | 0x88), 0x23);
15 * } while (0);
16 *
17 * which in fact violates the access order (= 0x22, 0x22, 0x23, 0x23).
18 */
19
20static inline u8 getCx86(u8 reg)
21{
22 outb(reg, 0x22);
23 return inb(0x23);
24}
25
26static inline void setCx86(u8 reg, u8 data)
27{
28 outb(reg, 0x22);
29 outb(data, 0x23);
30}
diff --git a/include/asm-x86/processor-flags.h b/include/asm-x86/processor-flags.h
deleted file mode 100644
index eff2ecd7fff0..000000000000
--- a/include/asm-x86/processor-flags.h
+++ /dev/null
@@ -1,99 +0,0 @@
1#ifndef __ASM_I386_PROCESSOR_FLAGS_H
2#define __ASM_I386_PROCESSOR_FLAGS_H
3/* Various flags defined: can be included from assembler. */
4
5/*
6 * EFLAGS bits
7 */
8#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */
9#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */
10#define X86_EFLAGS_AF 0x00000010 /* Auxillary carry Flag */
11#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */
12#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */
13#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */
14#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */
15#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */
16#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */
17#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */
18#define X86_EFLAGS_NT 0x00004000 /* Nested Task */
19#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */
20#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
21#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */
22#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */
23#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
24#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
25
26/*
27 * Basic CPU control in CR0
28 */
29#define X86_CR0_PE 0x00000001 /* Protection Enable */
30#define X86_CR0_MP 0x00000002 /* Monitor Coprocessor */
31#define X86_CR0_EM 0x00000004 /* Emulation */
32#define X86_CR0_TS 0x00000008 /* Task Switched */
33#define X86_CR0_ET 0x00000010 /* Extension Type */
34#define X86_CR0_NE 0x00000020 /* Numeric Error */
35#define X86_CR0_WP 0x00010000 /* Write Protect */
36#define X86_CR0_AM 0x00040000 /* Alignment Mask */
37#define X86_CR0_NW 0x20000000 /* Not Write-through */
38#define X86_CR0_CD 0x40000000 /* Cache Disable */
39#define X86_CR0_PG 0x80000000 /* Paging */
40
41/*
42 * Paging options in CR3
43 */
44#define X86_CR3_PWT 0x00000008 /* Page Write Through */
45#define X86_CR3_PCD 0x00000010 /* Page Cache Disable */
46
47/*
48 * Intel CPU features in CR4
49 */
50#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */
51#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */
52#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */
53#define X86_CR4_DE 0x00000008 /* enable debugging extensions */
54#define X86_CR4_PSE 0x00000010 /* enable page size extensions */
55#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */
56#define X86_CR4_MCE 0x00000040 /* Machine check enable */
57#define X86_CR4_PGE 0x00000080 /* enable global pages */
58#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */
59#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */
60#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */
61#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */
62
63/*
64 * x86-64 Task Priority Register, CR8
65 */
66#define X86_CR8_TPR 0x0000000F /* task priority register */
67
68/*
69 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>
70 */
71
72/*
73 * NSC/Cyrix CPU configuration register indexes
74 */
75#define CX86_PCR0 0x20
76#define CX86_GCR 0xb8
77#define CX86_CCR0 0xc0
78#define CX86_CCR1 0xc1
79#define CX86_CCR2 0xc2
80#define CX86_CCR3 0xc3
81#define CX86_CCR4 0xe8
82#define CX86_CCR5 0xe9
83#define CX86_CCR6 0xea
84#define CX86_CCR7 0xeb
85#define CX86_PCR1 0xf0
86#define CX86_DIR0 0xfe
87#define CX86_DIR1 0xff
88#define CX86_ARR_BASE 0xc4
89#define CX86_RCR_BASE 0xdc
90
91#ifdef __KERNEL__
92#ifdef CONFIG_VM86
93#define X86_VM_MASK X86_EFLAGS_VM
94#else
95#define X86_VM_MASK 0 /* No VM86 support */
96#endif
97#endif
98
99#endif /* __ASM_I386_PROCESSOR_FLAGS_H */
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
deleted file mode 100644
index 4df3e2f6fb56..000000000000
--- a/include/asm-x86/processor.h
+++ /dev/null
@@ -1,946 +0,0 @@
1#ifndef __ASM_X86_PROCESSOR_H
2#define __ASM_X86_PROCESSOR_H
3
4#include <asm/processor-flags.h>
5
6/* Forward declaration, a strange C thing */
7struct task_struct;
8struct mm_struct;
9
10#include <asm/vm86.h>
11#include <asm/math_emu.h>
12#include <asm/segment.h>
13#include <asm/types.h>
14#include <asm/sigcontext.h>
15#include <asm/current.h>
16#include <asm/cpufeature.h>
17#include <asm/system.h>
18#include <asm/page.h>
19#include <asm/percpu.h>
20#include <asm/msr.h>
21#include <asm/desc_defs.h>
22#include <asm/nops.h>
23
24#include <linux/personality.h>
25#include <linux/cpumask.h>
26#include <linux/cache.h>
27#include <linux/threads.h>
28#include <linux/init.h>
29
30/*
31 * Default implementation of macro that returns current
32 * instruction pointer ("program counter").
33 */
34static inline void *current_text_addr(void)
35{
36 void *pc;
37
38 asm volatile("mov $1f, %0; 1:":"=r" (pc));
39
40 return pc;
41}
42
43#ifdef CONFIG_X86_VSMP
44# define ARCH_MIN_TASKALIGN (1 << INTERNODE_CACHE_SHIFT)
45# define ARCH_MIN_MMSTRUCT_ALIGN (1 << INTERNODE_CACHE_SHIFT)
46#else
47# define ARCH_MIN_TASKALIGN 16
48# define ARCH_MIN_MMSTRUCT_ALIGN 0
49#endif
50
51/*
52 * CPU type and hardware bug flags. Kept separately for each CPU.
53 * Members of this structure are referenced in head.S, so think twice
54 * before touching them. [mj]
55 */
56
57struct cpuinfo_x86 {
58 __u8 x86; /* CPU family */
59 __u8 x86_vendor; /* CPU vendor */
60 __u8 x86_model;
61 __u8 x86_mask;
62#ifdef CONFIG_X86_32
63 char wp_works_ok; /* It doesn't on 386's */
64
65 /* Problems on some 486Dx4's and old 386's: */
66 char hlt_works_ok;
67 char hard_math;
68 char rfu;
69 char fdiv_bug;
70 char f00f_bug;
71 char coma_bug;
72 char pad0;
73#else
74 /* Number of 4K pages in DTLB/ITLB combined(in pages): */
75 int x86_tlbsize;
76 __u8 x86_virt_bits;
77 __u8 x86_phys_bits;
78 /* CPUID returned core id bits: */
79 __u8 x86_coreid_bits;
80 /* Max extended CPUID function supported: */
81 __u32 extended_cpuid_level;
82#endif
83 /* Maximum supported CPUID level, -1=no CPUID: */
84 int cpuid_level;
85 __u32 x86_capability[NCAPINTS];
86 char x86_vendor_id[16];
87 char x86_model_id[64];
88 /* in KB - valid for CPUS which support this call: */
89 int x86_cache_size;
90 int x86_cache_alignment; /* In bytes */
91 int x86_power;
92 unsigned long loops_per_jiffy;
93#ifdef CONFIG_SMP
94 /* cpus sharing the last level cache: */
95 cpumask_t llc_shared_map;
96#endif
97 /* cpuid returned max cores value: */
98 u16 x86_max_cores;
99 u16 apicid;
100 u16 initial_apicid;
101 u16 x86_clflush_size;
102#ifdef CONFIG_SMP
103 /* number of cores as seen by the OS: */
104 u16 booted_cores;
105 /* Physical processor id: */
106 u16 phys_proc_id;
107 /* Core id: */
108 u16 cpu_core_id;
109 /* Index into per_cpu list: */
110 u16 cpu_index;
111#endif
112} __attribute__((__aligned__(SMP_CACHE_BYTES)));
113
114#define X86_VENDOR_INTEL 0
115#define X86_VENDOR_CYRIX 1
116#define X86_VENDOR_AMD 2
117#define X86_VENDOR_UMC 3
118#define X86_VENDOR_CENTAUR 5
119#define X86_VENDOR_TRANSMETA 7
120#define X86_VENDOR_NSC 8
121#define X86_VENDOR_NUM 9
122
123#define X86_VENDOR_UNKNOWN 0xff
124
125/*
126 * capabilities of CPUs
127 */
128extern struct cpuinfo_x86 boot_cpu_data;
129extern struct cpuinfo_x86 new_cpu_data;
130
131extern struct tss_struct doublefault_tss;
132extern __u32 cleared_cpu_caps[NCAPINTS];
133
134#ifdef CONFIG_SMP
135DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
136#define cpu_data(cpu) per_cpu(cpu_info, cpu)
137#define current_cpu_data __get_cpu_var(cpu_info)
138#else
139#define cpu_data(cpu) boot_cpu_data
140#define current_cpu_data boot_cpu_data
141#endif
142
143static inline int hlt_works(int cpu)
144{
145#ifdef CONFIG_X86_32
146 return cpu_data(cpu).hlt_works_ok;
147#else
148 return 1;
149#endif
150}
151
152#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
153
154extern void cpu_detect(struct cpuinfo_x86 *c);
155
156extern void early_cpu_init(void);
157extern void identify_boot_cpu(void);
158extern void identify_secondary_cpu(struct cpuinfo_x86 *);
159extern void print_cpu_info(struct cpuinfo_x86 *);
160extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
161extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
162extern unsigned short num_cache_leaves;
163
164#if defined(CONFIG_X86_HT) || defined(CONFIG_X86_64)
165extern void detect_ht(struct cpuinfo_x86 *c);
166#else
167static inline void detect_ht(struct cpuinfo_x86 *c) {}
168#endif
169
170static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
171 unsigned int *ecx, unsigned int *edx)
172{
173 /* ecx is often an input as well as an output. */
174 asm("cpuid"
175 : "=a" (*eax),
176 "=b" (*ebx),
177 "=c" (*ecx),
178 "=d" (*edx)
179 : "0" (*eax), "2" (*ecx));
180}
181
182static inline void load_cr3(pgd_t *pgdir)
183{
184 write_cr3(__pa(pgdir));
185}
186
187#ifdef CONFIG_X86_32
188/* This is the TSS defined by the hardware. */
189struct x86_hw_tss {
190 unsigned short back_link, __blh;
191 unsigned long sp0;
192 unsigned short ss0, __ss0h;
193 unsigned long sp1;
194 /* ss1 caches MSR_IA32_SYSENTER_CS: */
195 unsigned short ss1, __ss1h;
196 unsigned long sp2;
197 unsigned short ss2, __ss2h;
198 unsigned long __cr3;
199 unsigned long ip;
200 unsigned long flags;
201 unsigned long ax;
202 unsigned long cx;
203 unsigned long dx;
204 unsigned long bx;
205 unsigned long sp;
206 unsigned long bp;
207 unsigned long si;
208 unsigned long di;
209 unsigned short es, __esh;
210 unsigned short cs, __csh;
211 unsigned short ss, __ssh;
212 unsigned short ds, __dsh;
213 unsigned short fs, __fsh;
214 unsigned short gs, __gsh;
215 unsigned short ldt, __ldth;
216 unsigned short trace;
217 unsigned short io_bitmap_base;
218
219} __attribute__((packed));
220#else
221struct x86_hw_tss {
222 u32 reserved1;
223 u64 sp0;
224 u64 sp1;
225 u64 sp2;
226 u64 reserved2;
227 u64 ist[7];
228 u32 reserved3;
229 u32 reserved4;
230 u16 reserved5;
231 u16 io_bitmap_base;
232
233} __attribute__((packed)) ____cacheline_aligned;
234#endif
235
236/*
237 * IO-bitmap sizes:
238 */
239#define IO_BITMAP_BITS 65536
240#define IO_BITMAP_BYTES (IO_BITMAP_BITS/8)
241#define IO_BITMAP_LONGS (IO_BITMAP_BYTES/sizeof(long))
242#define IO_BITMAP_OFFSET offsetof(struct tss_struct, io_bitmap)
243#define INVALID_IO_BITMAP_OFFSET 0x8000
244#define INVALID_IO_BITMAP_OFFSET_LAZY 0x9000
245
246struct tss_struct {
247 /*
248 * The hardware state:
249 */
250 struct x86_hw_tss x86_tss;
251
252 /*
253 * The extra 1 is there because the CPU will access an
254 * additional byte beyond the end of the IO permission
255 * bitmap. The extra byte must be all 1 bits, and must
256 * be within the limit.
257 */
258 unsigned long io_bitmap[IO_BITMAP_LONGS + 1];
259 /*
260 * Cache the current maximum and the last task that used the bitmap:
261 */
262 unsigned long io_bitmap_max;
263 struct thread_struct *io_bitmap_owner;
264
265 /*
266 * .. and then another 0x100 bytes for the emergency kernel stack:
267 */
268 unsigned long stack[64];
269
270} ____cacheline_aligned;
271
272DECLARE_PER_CPU(struct tss_struct, init_tss);
273
274/*
275 * Save the original ist values for checking stack pointers during debugging
276 */
277struct orig_ist {
278 unsigned long ist[7];
279};
280
281#define MXCSR_DEFAULT 0x1f80
282
283struct i387_fsave_struct {
284 u32 cwd; /* FPU Control Word */
285 u32 swd; /* FPU Status Word */
286 u32 twd; /* FPU Tag Word */
287 u32 fip; /* FPU IP Offset */
288 u32 fcs; /* FPU IP Selector */
289 u32 foo; /* FPU Operand Pointer Offset */
290 u32 fos; /* FPU Operand Pointer Selector */
291
292 /* 8*10 bytes for each FP-reg = 80 bytes: */
293 u32 st_space[20];
294
295 /* Software status information [not touched by FSAVE ]: */
296 u32 status;
297};
298
299struct i387_fxsave_struct {
300 u16 cwd; /* Control Word */
301 u16 swd; /* Status Word */
302 u16 twd; /* Tag Word */
303 u16 fop; /* Last Instruction Opcode */
304 union {
305 struct {
306 u64 rip; /* Instruction Pointer */
307 u64 rdp; /* Data Pointer */
308 };
309 struct {
310 u32 fip; /* FPU IP Offset */
311 u32 fcs; /* FPU IP Selector */
312 u32 foo; /* FPU Operand Offset */
313 u32 fos; /* FPU Operand Selector */
314 };
315 };
316 u32 mxcsr; /* MXCSR Register State */
317 u32 mxcsr_mask; /* MXCSR Mask */
318
319 /* 8*16 bytes for each FP-reg = 128 bytes: */
320 u32 st_space[32];
321
322 /* 16*16 bytes for each XMM-reg = 256 bytes: */
323 u32 xmm_space[64];
324
325 u32 padding[24];
326
327} __attribute__((aligned(16)));
328
329struct i387_soft_struct {
330 u32 cwd;
331 u32 swd;
332 u32 twd;
333 u32 fip;
334 u32 fcs;
335 u32 foo;
336 u32 fos;
337 /* 8*10 bytes for each FP-reg = 80 bytes: */
338 u32 st_space[20];
339 u8 ftop;
340 u8 changed;
341 u8 lookahead;
342 u8 no_update;
343 u8 rm;
344 u8 alimit;
345 struct info *info;
346 u32 entry_eip;
347};
348
349union thread_xstate {
350 struct i387_fsave_struct fsave;
351 struct i387_fxsave_struct fxsave;
352 struct i387_soft_struct soft;
353};
354
355#ifdef CONFIG_X86_64
356DECLARE_PER_CPU(struct orig_ist, orig_ist);
357#endif
358
359extern void print_cpu_info(struct cpuinfo_x86 *);
360extern unsigned int xstate_size;
361extern void free_thread_xstate(struct task_struct *);
362extern struct kmem_cache *task_xstate_cachep;
363extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
364extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
365extern unsigned short num_cache_leaves;
366
367struct thread_struct {
368 /* Cached TLS descriptors: */
369 struct desc_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
370 unsigned long sp0;
371 unsigned long sp;
372#ifdef CONFIG_X86_32
373 unsigned long sysenter_cs;
374#else
375 unsigned long usersp; /* Copy from PDA */
376 unsigned short es;
377 unsigned short ds;
378 unsigned short fsindex;
379 unsigned short gsindex;
380#endif
381 unsigned long ip;
382 unsigned long fs;
383 unsigned long gs;
384 /* Hardware debugging registers: */
385 unsigned long debugreg0;
386 unsigned long debugreg1;
387 unsigned long debugreg2;
388 unsigned long debugreg3;
389 unsigned long debugreg6;
390 unsigned long debugreg7;
391 /* Fault info: */
392 unsigned long cr2;
393 unsigned long trap_no;
394 unsigned long error_code;
395 /* floating point and extended processor state */
396 union thread_xstate *xstate;
397#ifdef CONFIG_X86_32
398 /* Virtual 86 mode info */
399 struct vm86_struct __user *vm86_info;
400 unsigned long screen_bitmap;
401 unsigned long v86flags;
402 unsigned long v86mask;
403 unsigned long saved_sp0;
404 unsigned int saved_fs;
405 unsigned int saved_gs;
406#endif
407 /* IO permissions: */
408 unsigned long *io_bitmap_ptr;
409 unsigned long iopl;
410 /* Max allowed port in the bitmap, in bytes: */
411 unsigned io_bitmap_max;
412/* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set. */
413 unsigned long debugctlmsr;
414/* Debug Store - if not 0 points to a DS Save Area configuration;
415 * goes into MSR_IA32_DS_AREA */
416 unsigned long ds_area_msr;
417};
418
419static inline unsigned long native_get_debugreg(int regno)
420{
421 unsigned long val = 0; /* Damn you, gcc! */
422
423 switch (regno) {
424 case 0:
425 asm("mov %%db0, %0" :"=r" (val));
426 break;
427 case 1:
428 asm("mov %%db1, %0" :"=r" (val));
429 break;
430 case 2:
431 asm("mov %%db2, %0" :"=r" (val));
432 break;
433 case 3:
434 asm("mov %%db3, %0" :"=r" (val));
435 break;
436 case 6:
437 asm("mov %%db6, %0" :"=r" (val));
438 break;
439 case 7:
440 asm("mov %%db7, %0" :"=r" (val));
441 break;
442 default:
443 BUG();
444 }
445 return val;
446}
447
448static inline void native_set_debugreg(int regno, unsigned long value)
449{
450 switch (regno) {
451 case 0:
452 asm("mov %0, %%db0" ::"r" (value));
453 break;
454 case 1:
455 asm("mov %0, %%db1" ::"r" (value));
456 break;
457 case 2:
458 asm("mov %0, %%db2" ::"r" (value));
459 break;
460 case 3:
461 asm("mov %0, %%db3" ::"r" (value));
462 break;
463 case 6:
464 asm("mov %0, %%db6" ::"r" (value));
465 break;
466 case 7:
467 asm("mov %0, %%db7" ::"r" (value));
468 break;
469 default:
470 BUG();
471 }
472}
473
474/*
475 * Set IOPL bits in EFLAGS from given mask
476 */
477static inline void native_set_iopl_mask(unsigned mask)
478{
479#ifdef CONFIG_X86_32
480 unsigned int reg;
481
482 asm volatile ("pushfl;"
483 "popl %0;"
484 "andl %1, %0;"
485 "orl %2, %0;"
486 "pushl %0;"
487 "popfl"
488 : "=&r" (reg)
489 : "i" (~X86_EFLAGS_IOPL), "r" (mask));
490#endif
491}
492
493static inline void
494native_load_sp0(struct tss_struct *tss, struct thread_struct *thread)
495{
496 tss->x86_tss.sp0 = thread->sp0;
497#ifdef CONFIG_X86_32
498 /* Only happens when SEP is enabled, no need to test "SEP"arately: */
499 if (unlikely(tss->x86_tss.ss1 != thread->sysenter_cs)) {
500 tss->x86_tss.ss1 = thread->sysenter_cs;
501 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
502 }
503#endif
504}
505
506static inline void native_swapgs(void)
507{
508#ifdef CONFIG_X86_64
509 asm volatile("swapgs" ::: "memory");
510#endif
511}
512
513#ifdef CONFIG_PARAVIRT
514#include <asm/paravirt.h>
515#else
516#define __cpuid native_cpuid
517#define paravirt_enabled() 0
518
519/*
520 * These special macros can be used to get or set a debugging register
521 */
522#define get_debugreg(var, register) \
523 (var) = native_get_debugreg(register)
524#define set_debugreg(value, register) \
525 native_set_debugreg(register, value)
526
527static inline void load_sp0(struct tss_struct *tss,
528 struct thread_struct *thread)
529{
530 native_load_sp0(tss, thread);
531}
532
533#define set_iopl_mask native_set_iopl_mask
534#endif /* CONFIG_PARAVIRT */
535
536/*
537 * Save the cr4 feature set we're using (ie
538 * Pentium 4MB enable and PPro Global page
539 * enable), so that any CPU's that boot up
540 * after us can get the correct flags.
541 */
542extern unsigned long mmu_cr4_features;
543
544static inline void set_in_cr4(unsigned long mask)
545{
546 unsigned cr4;
547
548 mmu_cr4_features |= mask;
549 cr4 = read_cr4();
550 cr4 |= mask;
551 write_cr4(cr4);
552}
553
554static inline void clear_in_cr4(unsigned long mask)
555{
556 unsigned cr4;
557
558 mmu_cr4_features &= ~mask;
559 cr4 = read_cr4();
560 cr4 &= ~mask;
561 write_cr4(cr4);
562}
563
564struct microcode_header {
565 unsigned int hdrver;
566 unsigned int rev;
567 unsigned int date;
568 unsigned int sig;
569 unsigned int cksum;
570 unsigned int ldrver;
571 unsigned int pf;
572 unsigned int datasize;
573 unsigned int totalsize;
574 unsigned int reserved[3];
575};
576
577struct microcode {
578 struct microcode_header hdr;
579 unsigned int bits[0];
580};
581
582typedef struct microcode microcode_t;
583typedef struct microcode_header microcode_header_t;
584
585/* microcode format is extended from prescott processors */
586struct extended_signature {
587 unsigned int sig;
588 unsigned int pf;
589 unsigned int cksum;
590};
591
592struct extended_sigtable {
593 unsigned int count;
594 unsigned int cksum;
595 unsigned int reserved[3];
596 struct extended_signature sigs[0];
597};
598
599typedef struct {
600 unsigned long seg;
601} mm_segment_t;
602
603
604/*
605 * create a kernel thread without removing it from tasklists
606 */
607extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
608
609/* Free all resources held by a thread. */
610extern void release_thread(struct task_struct *);
611
612/* Prepare to copy thread state - unlazy all lazy state */
613extern void prepare_to_copy(struct task_struct *tsk);
614
615unsigned long get_wchan(struct task_struct *p);
616
617/*
618 * Generic CPUID function
619 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
620 * resulting in stale register contents being returned.
621 */
622static inline void cpuid(unsigned int op,
623 unsigned int *eax, unsigned int *ebx,
624 unsigned int *ecx, unsigned int *edx)
625{
626 *eax = op;
627 *ecx = 0;
628 __cpuid(eax, ebx, ecx, edx);
629}
630
631/* Some CPUID calls want 'count' to be placed in ecx */
632static inline void cpuid_count(unsigned int op, int count,
633 unsigned int *eax, unsigned int *ebx,
634 unsigned int *ecx, unsigned int *edx)
635{
636 *eax = op;
637 *ecx = count;
638 __cpuid(eax, ebx, ecx, edx);
639}
640
641/*
642 * CPUID functions returning a single datum
643 */
644static inline unsigned int cpuid_eax(unsigned int op)
645{
646 unsigned int eax, ebx, ecx, edx;
647
648 cpuid(op, &eax, &ebx, &ecx, &edx);
649
650 return eax;
651}
652
653static inline unsigned int cpuid_ebx(unsigned int op)
654{
655 unsigned int eax, ebx, ecx, edx;
656
657 cpuid(op, &eax, &ebx, &ecx, &edx);
658
659 return ebx;
660}
661
662static inline unsigned int cpuid_ecx(unsigned int op)
663{
664 unsigned int eax, ebx, ecx, edx;
665
666 cpuid(op, &eax, &ebx, &ecx, &edx);
667
668 return ecx;
669}
670
671static inline unsigned int cpuid_edx(unsigned int op)
672{
673 unsigned int eax, ebx, ecx, edx;
674
675 cpuid(op, &eax, &ebx, &ecx, &edx);
676
677 return edx;
678}
679
680/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
681static inline void rep_nop(void)
682{
683 asm volatile("rep; nop" ::: "memory");
684}
685
686static inline void cpu_relax(void)
687{
688 rep_nop();
689}
690
691/* Stop speculative execution: */
692static inline void sync_core(void)
693{
694 int tmp;
695
696 asm volatile("cpuid" : "=a" (tmp) : "0" (1)
697 : "ebx", "ecx", "edx", "memory");
698}
699
700static inline void __monitor(const void *eax, unsigned long ecx,
701 unsigned long edx)
702{
703 /* "monitor %eax, %ecx, %edx;" */
704 asm volatile(".byte 0x0f, 0x01, 0xc8;"
705 :: "a" (eax), "c" (ecx), "d"(edx));
706}
707
708static inline void __mwait(unsigned long eax, unsigned long ecx)
709{
710 /* "mwait %eax, %ecx;" */
711 asm volatile(".byte 0x0f, 0x01, 0xc9;"
712 :: "a" (eax), "c" (ecx));
713}
714
715static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
716{
717 trace_hardirqs_on();
718 /* "mwait %eax, %ecx;" */
719 asm volatile("sti; .byte 0x0f, 0x01, 0xc9;"
720 :: "a" (eax), "c" (ecx));
721}
722
723extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
724
725extern void select_idle_routine(const struct cpuinfo_x86 *c);
726
727extern unsigned long boot_option_idle_override;
728extern unsigned long idle_halt;
729extern unsigned long idle_nomwait;
730
731/*
732 * on systems with caches, caches must be flashed as the absolute
733 * last instruction before going into a suspended halt. Otherwise,
734 * dirty data can linger in the cache and become stale on resume,
735 * leading to strange errors.
736 *
737 * perform a variety of operations to guarantee that the compiler
738 * will not reorder instructions. wbinvd itself is serializing
739 * so the processor will not reorder.
740 *
741 * Systems without cache can just go into halt.
742 */
743static inline void wbinvd_halt(void)
744{
745 mb();
746 /* check for clflush to determine if wbinvd is legal */
747 if (cpu_has_clflush)
748 asm volatile("cli; wbinvd; 1: hlt; jmp 1b" : : : "memory");
749 else
750 while (1)
751 halt();
752}
753
754extern void enable_sep_cpu(void);
755extern int sysenter_setup(void);
756
757/* Defined in head.S */
758extern struct desc_ptr early_gdt_descr;
759
760extern void cpu_set_gdt(int);
761extern void switch_to_new_gdt(void);
762extern void cpu_init(void);
763extern void init_gdt(int cpu);
764
765static inline void update_debugctlmsr(unsigned long debugctlmsr)
766{
767#ifndef CONFIG_X86_DEBUGCTLMSR
768 if (boot_cpu_data.x86 < 6)
769 return;
770#endif
771 wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctlmsr);
772}
773
774/*
775 * from system description table in BIOS. Mostly for MCA use, but
776 * others may find it useful:
777 */
778extern unsigned int machine_id;
779extern unsigned int machine_submodel_id;
780extern unsigned int BIOS_revision;
781
782/* Boot loader type from the setup header: */
783extern int bootloader_type;
784
785extern char ignore_fpu_irq;
786
787#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
788#define ARCH_HAS_PREFETCHW
789#define ARCH_HAS_SPINLOCK_PREFETCH
790
791#ifdef CONFIG_X86_32
792# define BASE_PREFETCH ASM_NOP4
793# define ARCH_HAS_PREFETCH
794#else
795# define BASE_PREFETCH "prefetcht0 (%1)"
796#endif
797
798/*
799 * Prefetch instructions for Pentium III (+) and AMD Athlon (+)
800 *
801 * It's not worth to care about 3dnow prefetches for the K6
802 * because they are microcoded there and very slow.
803 */
804static inline void prefetch(const void *x)
805{
806 alternative_input(BASE_PREFETCH,
807 "prefetchnta (%1)",
808 X86_FEATURE_XMM,
809 "r" (x));
810}
811
812/*
813 * 3dnow prefetch to get an exclusive cache line.
814 * Useful for spinlocks to avoid one state transition in the
815 * cache coherency protocol:
816 */
817static inline void prefetchw(const void *x)
818{
819 alternative_input(BASE_PREFETCH,
820 "prefetchw (%1)",
821 X86_FEATURE_3DNOW,
822 "r" (x));
823}
824
825static inline void spin_lock_prefetch(const void *x)
826{
827 prefetchw(x);
828}
829
830#ifdef CONFIG_X86_32
831/*
832 * User space process size: 3GB (default).
833 */
834#define TASK_SIZE PAGE_OFFSET
835#define STACK_TOP TASK_SIZE
836#define STACK_TOP_MAX STACK_TOP
837
838#define INIT_THREAD { \
839 .sp0 = sizeof(init_stack) + (long)&init_stack, \
840 .vm86_info = NULL, \
841 .sysenter_cs = __KERNEL_CS, \
842 .io_bitmap_ptr = NULL, \
843 .fs = __KERNEL_PERCPU, \
844}
845
846/*
847 * Note that the .io_bitmap member must be extra-big. This is because
848 * the CPU will access an additional byte beyond the end of the IO
849 * permission bitmap. The extra byte must be all 1 bits, and must
850 * be within the limit.
851 */
852#define INIT_TSS { \
853 .x86_tss = { \
854 .sp0 = sizeof(init_stack) + (long)&init_stack, \
855 .ss0 = __KERNEL_DS, \
856 .ss1 = __KERNEL_CS, \
857 .io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
858 }, \
859 .io_bitmap = { [0 ... IO_BITMAP_LONGS] = ~0 }, \
860}
861
862extern unsigned long thread_saved_pc(struct task_struct *tsk);
863
864#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
865#define KSTK_TOP(info) \
866({ \
867 unsigned long *__ptr = (unsigned long *)(info); \
868 (unsigned long)(&__ptr[THREAD_SIZE_LONGS]); \
869})
870
871/*
872 * The below -8 is to reserve 8 bytes on top of the ring0 stack.
873 * This is necessary to guarantee that the entire "struct pt_regs"
874 * is accessable even if the CPU haven't stored the SS/ESP registers
875 * on the stack (interrupt gate does not save these registers
876 * when switching to the same priv ring).
877 * Therefore beware: accessing the ss/esp fields of the
878 * "struct pt_regs" is possible, but they may contain the
879 * completely wrong values.
880 */
881#define task_pt_regs(task) \
882({ \
883 struct pt_regs *__regs__; \
884 __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task))-8); \
885 __regs__ - 1; \
886})
887
888#define KSTK_ESP(task) (task_pt_regs(task)->sp)
889
890#else
891/*
892 * User space process size. 47bits minus one guard page.
893 */
894#define TASK_SIZE64 ((1UL << 47) - PAGE_SIZE)
895
896/* This decides where the kernel will search for a free chunk of vm
897 * space during mmap's.
898 */
899#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? \
900 0xc0000000 : 0xFFFFe000)
901
902#define TASK_SIZE (test_thread_flag(TIF_IA32) ? \
903 IA32_PAGE_OFFSET : TASK_SIZE64)
904#define TASK_SIZE_OF(child) ((test_tsk_thread_flag(child, TIF_IA32)) ? \
905 IA32_PAGE_OFFSET : TASK_SIZE64)
906
907#define STACK_TOP TASK_SIZE
908#define STACK_TOP_MAX TASK_SIZE64
909
910#define INIT_THREAD { \
911 .sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
912}
913
914#define INIT_TSS { \
915 .x86_tss.sp0 = (unsigned long)&init_stack + sizeof(init_stack) \
916}
917
918/*
919 * Return saved PC of a blocked thread.
920 * What is this good for? it will be always the scheduler or ret_from_fork.
921 */
922#define thread_saved_pc(t) (*(unsigned long *)((t)->thread.sp - 8))
923
924#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.sp0 - 1)
925#define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
926#endif /* CONFIG_X86_64 */
927
928extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
929 unsigned long new_sp);
930
931/*
932 * This decides where the kernel will search for a free chunk of vm
933 * space during mmap's.
934 */
935#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
936
937#define KSTK_EIP(task) (task_pt_regs(task)->ip)
938
939/* Get/set a process' ability to use the timestamp counter instruction */
940#define GET_TSC_CTL(adr) get_tsc_mode((adr))
941#define SET_TSC_CTL(val) set_tsc_mode((val))
942
943extern int get_tsc_mode(unsigned long adr);
944extern int set_tsc_mode(unsigned int val);
945
946#endif
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h
deleted file mode 100644
index 3dd458c385c0..000000000000
--- a/include/asm-x86/proto.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _ASM_X8664_PROTO_H
2#define _ASM_X8664_PROTO_H 1
3
4#include <asm/ldt.h>
5
6/* misc architecture specific prototypes */
7
8extern void early_idt_handler(void);
9
10extern void system_call(void);
11extern void syscall_init(void);
12
13extern void ia32_syscall(void);
14extern void ia32_cstar_target(void);
15extern void ia32_sysenter_target(void);
16
17extern void syscall32_cpu_init(void);
18
19extern void check_efer(void);
20
21#ifdef CONFIG_X86_BIOS_REBOOT
22extern int reboot_force;
23#else
24static const int reboot_force = 0;
25#endif
26
27long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
28
29#define round_up(x, y) (((x) + (y) - 1) & ~((y) - 1))
30#define round_down(x, y) ((x) & ~((y) - 1))
31
32#endif
diff --git a/include/asm-x86/ptrace-abi.h b/include/asm-x86/ptrace-abi.h
deleted file mode 100644
index 72e7b9db29bb..000000000000
--- a/include/asm-x86/ptrace-abi.h
+++ /dev/null
@@ -1,143 +0,0 @@
1#ifndef _ASM_X86_PTRACE_ABI_H
2#define _ASM_X86_PTRACE_ABI_H
3
4#ifdef __i386__
5
6#define EBX 0
7#define ECX 1
8#define EDX 2
9#define ESI 3
10#define EDI 4
11#define EBP 5
12#define EAX 6
13#define DS 7
14#define ES 8
15#define FS 9
16#define GS 10
17#define ORIG_EAX 11
18#define EIP 12
19#define CS 13
20#define EFL 14
21#define UESP 15
22#define SS 16
23#define FRAME_SIZE 17
24
25#else /* __i386__ */
26
27#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
28#define R15 0
29#define R14 8
30#define R13 16
31#define R12 24
32#define RBP 32
33#define RBX 40
34/* arguments: interrupts/non tracing syscalls only save upto here*/
35#define R11 48
36#define R10 56
37#define R9 64
38#define R8 72
39#define RAX 80
40#define RCX 88
41#define RDX 96
42#define RSI 104
43#define RDI 112
44#define ORIG_RAX 120 /* = ERROR */
45/* end of arguments */
46/* cpu exception frame or undefined in case of fast syscall. */
47#define RIP 128
48#define CS 136
49#define EFLAGS 144
50#define RSP 152
51#define SS 160
52#define ARGOFFSET R11
53#endif /* __ASSEMBLY__ */
54
55/* top of stack page */
56#define FRAME_SIZE 168
57
58#endif /* !__i386__ */
59
60/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
61#define PTRACE_GETREGS 12
62#define PTRACE_SETREGS 13
63#define PTRACE_GETFPREGS 14
64#define PTRACE_SETFPREGS 15
65#define PTRACE_GETFPXREGS 18
66#define PTRACE_SETFPXREGS 19
67
68#define PTRACE_OLDSETOPTIONS 21
69
70/* only useful for access 32bit programs / kernels */
71#define PTRACE_GET_THREAD_AREA 25
72#define PTRACE_SET_THREAD_AREA 26
73
74#ifdef __x86_64__
75# define PTRACE_ARCH_PRCTL 30
76#endif
77
78#define PTRACE_SYSEMU 31
79#define PTRACE_SYSEMU_SINGLESTEP 32
80
81#define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */
82
83#ifndef __ASSEMBLY__
84
85#include <asm/types.h>
86
87/* configuration/status structure used in PTRACE_BTS_CONFIG and
88 PTRACE_BTS_STATUS commands.
89*/
90struct ptrace_bts_config {
91 /* requested or actual size of BTS buffer in bytes */
92 __u32 size;
93 /* bitmask of below flags */
94 __u32 flags;
95 /* buffer overflow signal */
96 __u32 signal;
97 /* actual size of bts_struct in bytes */
98 __u32 bts_size;
99};
100#endif
101
102#define PTRACE_BTS_O_TRACE 0x1 /* branch trace */
103#define PTRACE_BTS_O_SCHED 0x2 /* scheduling events w/ jiffies */
104#define PTRACE_BTS_O_SIGNAL 0x4 /* send SIG<signal> on buffer overflow
105 instead of wrapping around */
106#define PTRACE_BTS_O_CUT_SIZE 0x8 /* cut requested size to max available
107 instead of failing */
108
109#define PTRACE_BTS_CONFIG 40
110/* Configure branch trace recording.
111 ADDR points to a struct ptrace_bts_config.
112 DATA gives the size of that buffer.
113 A new buffer is allocated, iff the size changes.
114 Returns the number of bytes read.
115*/
116#define PTRACE_BTS_STATUS 41
117/* Return the current configuration in a struct ptrace_bts_config
118 pointed to by ADDR; DATA gives the size of that buffer.
119 Returns the number of bytes written.
120*/
121#define PTRACE_BTS_SIZE 42
122/* Return the number of available BTS records.
123 DATA and ADDR are ignored.
124*/
125#define PTRACE_BTS_GET 43
126/* Get a single BTS record.
127 DATA defines the index into the BTS array, where 0 is the newest
128 entry, and higher indices refer to older entries.
129 ADDR is pointing to struct bts_struct (see asm/ds.h).
130*/
131#define PTRACE_BTS_CLEAR 44
132/* Clear the BTS buffer.
133 DATA and ADDR are ignored.
134*/
135#define PTRACE_BTS_DRAIN 45
136/* Read all available BTS records and clear the buffer.
137 ADDR points to an array of struct bts_struct.
138 DATA gives the size of that buffer.
139 BTS records are read from oldest to newest.
140 Returns number of BTS records drained.
141*/
142
143#endif
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
deleted file mode 100644
index 8a71db803da6..000000000000
--- a/include/asm-x86/ptrace.h
+++ /dev/null
@@ -1,242 +0,0 @@
1#ifndef _ASM_X86_PTRACE_H
2#define _ASM_X86_PTRACE_H
3
4#include <linux/compiler.h> /* For __user */
5#include <asm/ptrace-abi.h>
6#include <asm/processor-flags.h>
7
8#ifdef __KERNEL__
9#include <asm/ds.h> /* the DS BTS struct is used for ptrace too */
10#include <asm/segment.h>
11#endif
12
13#ifndef __ASSEMBLY__
14
15#ifdef __i386__
16/* this struct defines the way the registers are stored on the
17 stack during a system call. */
18
19#ifndef __KERNEL__
20
21struct pt_regs {
22 long ebx;
23 long ecx;
24 long edx;
25 long esi;
26 long edi;
27 long ebp;
28 long eax;
29 int xds;
30 int xes;
31 int xfs;
32 /* int gs; */
33 long orig_eax;
34 long eip;
35 int xcs;
36 long eflags;
37 long esp;
38 int xss;
39};
40
41#else /* __KERNEL__ */
42
43struct pt_regs {
44 unsigned long bx;
45 unsigned long cx;
46 unsigned long dx;
47 unsigned long si;
48 unsigned long di;
49 unsigned long bp;
50 unsigned long ax;
51 unsigned long ds;
52 unsigned long es;
53 unsigned long fs;
54 /* int gs; */
55 unsigned long orig_ax;
56 unsigned long ip;
57 unsigned long cs;
58 unsigned long flags;
59 unsigned long sp;
60 unsigned long ss;
61};
62
63#endif /* __KERNEL__ */
64
65#else /* __i386__ */
66
67#ifndef __KERNEL__
68
69struct pt_regs {
70 unsigned long r15;
71 unsigned long r14;
72 unsigned long r13;
73 unsigned long r12;
74 unsigned long rbp;
75 unsigned long rbx;
76/* arguments: non interrupts/non tracing syscalls only save upto here*/
77 unsigned long r11;
78 unsigned long r10;
79 unsigned long r9;
80 unsigned long r8;
81 unsigned long rax;
82 unsigned long rcx;
83 unsigned long rdx;
84 unsigned long rsi;
85 unsigned long rdi;
86 unsigned long orig_rax;
87/* end of arguments */
88/* cpu exception frame or undefined */
89 unsigned long rip;
90 unsigned long cs;
91 unsigned long eflags;
92 unsigned long rsp;
93 unsigned long ss;
94/* top of stack page */
95};
96
97#else /* __KERNEL__ */
98
99struct pt_regs {
100 unsigned long r15;
101 unsigned long r14;
102 unsigned long r13;
103 unsigned long r12;
104 unsigned long bp;
105 unsigned long bx;
106/* arguments: non interrupts/non tracing syscalls only save upto here*/
107 unsigned long r11;
108 unsigned long r10;
109 unsigned long r9;
110 unsigned long r8;
111 unsigned long ax;
112 unsigned long cx;
113 unsigned long dx;
114 unsigned long si;
115 unsigned long di;
116 unsigned long orig_ax;
117/* end of arguments */
118/* cpu exception frame or undefined */
119 unsigned long ip;
120 unsigned long cs;
121 unsigned long flags;
122 unsigned long sp;
123 unsigned long ss;
124/* top of stack page */
125};
126
127#endif /* __KERNEL__ */
128#endif /* !__i386__ */
129
130#ifdef __KERNEL__
131
132/* the DS BTS struct is used for ptrace as well */
133#include <asm/ds.h>
134
135struct task_struct;
136
137extern void ptrace_bts_take_timestamp(struct task_struct *, enum bts_qualifier);
138
139extern unsigned long profile_pc(struct pt_regs *regs);
140
141extern unsigned long
142convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
143
144#ifdef CONFIG_X86_32
145extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
146 int error_code);
147#else
148void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
149#endif
150
151static inline unsigned long regs_return_value(struct pt_regs *regs)
152{
153 return regs->ax;
154}
155
156/*
157 * user_mode_vm(regs) determines whether a register set came from user mode.
158 * This is true if V8086 mode was enabled OR if the register set was from
159 * protected mode with RPL-3 CS value. This tricky test checks that with
160 * one comparison. Many places in the kernel can bypass this full check
161 * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
162 */
163static inline int user_mode(struct pt_regs *regs)
164{
165#ifdef CONFIG_X86_32
166 return (regs->cs & SEGMENT_RPL_MASK) == USER_RPL;
167#else
168 return !!(regs->cs & 3);
169#endif
170}
171
172static inline int user_mode_vm(struct pt_regs *regs)
173{
174#ifdef CONFIG_X86_32
175 return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >=
176 USER_RPL;
177#else
178 return user_mode(regs);
179#endif
180}
181
182static inline int v8086_mode(struct pt_regs *regs)
183{
184#ifdef CONFIG_X86_32
185 return (regs->flags & X86_VM_MASK);
186#else
187 return 0; /* No V86 mode support in long mode */
188#endif
189}
190
191/*
192 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
193 * when it traps. So regs will be the current sp.
194 *
195 * This is valid only for kernel mode traps.
196 */
197static inline unsigned long kernel_trap_sp(struct pt_regs *regs)
198{
199#ifdef CONFIG_X86_32
200 return (unsigned long)regs;
201#else
202 return regs->sp;
203#endif
204}
205
206static inline unsigned long instruction_pointer(struct pt_regs *regs)
207{
208 return regs->ip;
209}
210
211static inline unsigned long frame_pointer(struct pt_regs *regs)
212{
213 return regs->bp;
214}
215
216/*
217 * These are defined as per linux/ptrace.h, which see.
218 */
219#define arch_has_single_step() (1)
220extern void user_enable_single_step(struct task_struct *);
221extern void user_disable_single_step(struct task_struct *);
222
223extern void user_enable_block_step(struct task_struct *);
224#ifdef CONFIG_X86_DEBUGCTLMSR
225#define arch_has_block_step() (1)
226#else
227#define arch_has_block_step() (boot_cpu_data.x86 >= 6)
228#endif
229
230struct user_desc;
231extern int do_get_thread_area(struct task_struct *p, int idx,
232 struct user_desc __user *info);
233extern int do_set_thread_area(struct task_struct *p, int idx,
234 struct user_desc __user *info, int can_allocate);
235
236#define __ARCH_WANT_COMPAT_SYS_PTRACE
237
238#endif /* __KERNEL__ */
239
240#endif /* !__ASSEMBLY__ */
241
242#endif
diff --git a/include/asm-x86/pvclock-abi.h b/include/asm-x86/pvclock-abi.h
deleted file mode 100644
index 6857f840b243..000000000000
--- a/include/asm-x86/pvclock-abi.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASM_X86_PVCLOCK_ABI_H_
2#define _ASM_X86_PVCLOCK_ABI_H_
3#ifndef __ASSEMBLY__
4
5/*
6 * These structs MUST NOT be changed.
7 * They are the ABI between hypervisor and guest OS.
8 * Both Xen and KVM are using this.
9 *
10 * pvclock_vcpu_time_info holds the system time and the tsc timestamp
11 * of the last update. So the guest can use the tsc delta to get a
12 * more precise system time. There is one per virtual cpu.
13 *
14 * pvclock_wall_clock references the point in time when the system
15 * time was zero (usually boot time), thus the guest calculates the
16 * current wall clock by adding the system time.
17 *
18 * Protocol for the "version" fields is: hypervisor raises it (making
19 * it uneven) before it starts updating the fields and raises it again
20 * (making it even) when it is done. Thus the guest can make sure the
21 * time values it got are consistent by checking the version before
22 * and after reading them.
23 */
24
25struct pvclock_vcpu_time_info {
26 u32 version;
27 u32 pad0;
28 u64 tsc_timestamp;
29 u64 system_time;
30 u32 tsc_to_system_mul;
31 s8 tsc_shift;
32 u8 pad[3];
33} __attribute__((__packed__)); /* 32 bytes */
34
35struct pvclock_wall_clock {
36 u32 version;
37 u32 sec;
38 u32 nsec;
39} __attribute__((__packed__));
40
41#endif /* __ASSEMBLY__ */
42#endif /* _ASM_X86_PVCLOCK_ABI_H_ */
diff --git a/include/asm-x86/pvclock.h b/include/asm-x86/pvclock.h
deleted file mode 100644
index 85b1bba8e0a3..000000000000
--- a/include/asm-x86/pvclock.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_X86_PVCLOCK_H_
2#define _ASM_X86_PVCLOCK_H_
3
4#include <linux/clocksource.h>
5#include <asm/pvclock-abi.h>
6
7/* some helper functions for xen and kvm pv clock sources */
8cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src);
9void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
10 struct pvclock_vcpu_time_info *vcpu,
11 struct timespec *ts);
12
13#endif /* _ASM_X86_PVCLOCK_H_ */
diff --git a/include/asm-x86/reboot.h b/include/asm-x86/reboot.h
deleted file mode 100644
index 206f355786dc..000000000000
--- a/include/asm-x86/reboot.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_REBOOT_H
2#define _ASM_REBOOT_H
3
4struct pt_regs;
5
6struct machine_ops {
7 void (*restart)(char *cmd);
8 void (*halt)(void);
9 void (*power_off)(void);
10 void (*shutdown)(void);
11 void (*crash_shutdown)(struct pt_regs *);
12 void (*emergency_restart)(void);
13};
14
15extern struct machine_ops machine_ops;
16
17void native_machine_crash_shutdown(struct pt_regs *regs);
18void native_machine_shutdown(void);
19void machine_real_restart(const unsigned char *code, int length);
20
21#endif /* _ASM_REBOOT_H */
diff --git a/include/asm-x86/reboot_fixups.h b/include/asm-x86/reboot_fixups.h
deleted file mode 100644
index 0cb7d87c2b68..000000000000
--- a/include/asm-x86/reboot_fixups.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _LINUX_REBOOT_FIXUPS_H
2#define _LINUX_REBOOT_FIXUPS_H
3
4extern void mach_reboot_fixups(void);
5
6#endif /* _LINUX_REBOOT_FIXUPS_H */
diff --git a/include/asm-x86/required-features.h b/include/asm-x86/required-features.h
deleted file mode 100644
index 5c2ff4bc2980..000000000000
--- a/include/asm-x86/required-features.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef _ASM_REQUIRED_FEATURES_H
2#define _ASM_REQUIRED_FEATURES_H 1
3
4/* Define minimum CPUID feature set for kernel These bits are checked
5 really early to actually display a visible error message before the
6 kernel dies. Make sure to assign features to the proper mask!
7
8 Some requirements that are not in CPUID yet are also in the
9 CONFIG_X86_MINIMUM_CPU_FAMILY which is checked too.
10
11 The real information is in arch/x86/Kconfig.cpu, this just converts
12 the CONFIGs into a bitmask */
13
14#ifndef CONFIG_MATH_EMULATION
15# define NEED_FPU (1<<(X86_FEATURE_FPU & 31))
16#else
17# define NEED_FPU 0
18#endif
19
20#if defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
21# define NEED_PAE (1<<(X86_FEATURE_PAE & 31))
22#else
23# define NEED_PAE 0
24#endif
25
26#ifdef CONFIG_X86_CMPXCHG64
27# define NEED_CX8 (1<<(X86_FEATURE_CX8 & 31))
28#else
29# define NEED_CX8 0
30#endif
31
32#if defined(CONFIG_X86_CMOV) || defined(CONFIG_X86_64)
33# define NEED_CMOV (1<<(X86_FEATURE_CMOV & 31))
34#else
35# define NEED_CMOV 0
36#endif
37
38#ifdef CONFIG_X86_USE_3DNOW
39# define NEED_3DNOW (1<<(X86_FEATURE_3DNOW & 31))
40#else
41# define NEED_3DNOW 0
42#endif
43
44#if defined(CONFIG_X86_P6_NOP) || defined(CONFIG_X86_64)
45# define NEED_NOPL (1<<(X86_FEATURE_NOPL & 31))
46#else
47# define NEED_NOPL 0
48#endif
49
50#ifdef CONFIG_X86_64
51#define NEED_PSE 0
52#define NEED_MSR (1<<(X86_FEATURE_MSR & 31))
53#define NEED_PGE (1<<(X86_FEATURE_PGE & 31))
54#define NEED_FXSR (1<<(X86_FEATURE_FXSR & 31))
55#define NEED_XMM (1<<(X86_FEATURE_XMM & 31))
56#define NEED_XMM2 (1<<(X86_FEATURE_XMM2 & 31))
57#define NEED_LM (1<<(X86_FEATURE_LM & 31))
58#else
59#define NEED_PSE 0
60#define NEED_MSR 0
61#define NEED_PGE 0
62#define NEED_FXSR 0
63#define NEED_XMM 0
64#define NEED_XMM2 0
65#define NEED_LM 0
66#endif
67
68#define REQUIRED_MASK0 (NEED_FPU|NEED_PSE|NEED_MSR|NEED_PAE|\
69 NEED_CX8|NEED_PGE|NEED_FXSR|NEED_CMOV|\
70 NEED_XMM|NEED_XMM2)
71#define SSE_MASK (NEED_XMM|NEED_XMM2)
72
73#define REQUIRED_MASK1 (NEED_LM|NEED_3DNOW)
74
75#define REQUIRED_MASK2 0
76#define REQUIRED_MASK3 (NEED_NOPL)
77#define REQUIRED_MASK4 0
78#define REQUIRED_MASK5 0
79#define REQUIRED_MASK6 0
80#define REQUIRED_MASK7 0
81
82#endif
diff --git a/include/asm-x86/resource.h b/include/asm-x86/resource.h
deleted file mode 100644
index 04bc4db8921b..000000000000
--- a/include/asm-x86/resource.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/resource.h>
diff --git a/include/asm-x86/resume-trace.h b/include/asm-x86/resume-trace.h
deleted file mode 100644
index 8d9f0b41ee86..000000000000
--- a/include/asm-x86/resume-trace.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_X86_RESUME_TRACE_H
2#define _ASM_X86_RESUME_TRACE_H
3
4#include <asm/asm.h>
5
6#define TRACE_RESUME(user) \
7do { \
8 if (pm_trace_enabled) { \
9 const void *tracedata; \
10 asm volatile(_ASM_MOV_UL " $1f,%0\n" \
11 ".section .tracedata,\"a\"\n" \
12 "1:\t.word %c1\n\t" \
13 _ASM_PTR " %c2\n" \
14 ".previous" \
15 :"=r" (tracedata) \
16 : "i" (__LINE__), "i" (__FILE__)); \
17 generate_resume_trace(tracedata, user); \
18 } \
19} while (0)
20
21#endif
diff --git a/include/asm-x86/rio.h b/include/asm-x86/rio.h
deleted file mode 100644
index c9448bd8968f..000000000000
--- a/include/asm-x86/rio.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Derived from include/asm-x86/mach-summit/mach_mpparse.h
3 * and include/asm-x86/mach-default/bios_ebda.h
4 *
5 * Author: Laurent Vivier <Laurent.Vivier@bull.net>
6 */
7
8#ifndef __ASM_RIO_H
9#define __ASM_RIO_H
10
11#define RIO_TABLE_VERSION 3
12
13struct rio_table_hdr {
14 u8 version; /* Version number of this data structure */
15 u8 num_scal_dev; /* # of Scalability devices */
16 u8 num_rio_dev; /* # of RIO I/O devices */
17} __attribute__((packed));
18
19struct scal_detail {
20 u8 node_id; /* Scalability Node ID */
21 u32 CBAR; /* Address of 1MB register space */
22 u8 port0node; /* Node ID port connected to: 0xFF=None */
23 u8 port0port; /* Port num port connected to: 0,1,2, or */
24 /* 0xFF=None */
25 u8 port1node; /* Node ID port connected to: 0xFF = None */
26 u8 port1port; /* Port num port connected to: 0,1,2, or */
27 /* 0xFF=None */
28 u8 port2node; /* Node ID port connected to: 0xFF = None */
29 u8 port2port; /* Port num port connected to: 0,1,2, or */
30 /* 0xFF=None */
31 u8 chassis_num; /* 1 based Chassis number (1 = boot node) */
32} __attribute__((packed));
33
34struct rio_detail {
35 u8 node_id; /* RIO Node ID */
36 u32 BBAR; /* Address of 1MB register space */
37 u8 type; /* Type of device */
38 u8 owner_id; /* Node ID of Hurricane that owns this */
39 /* node */
40 u8 port0node; /* Node ID port connected to: 0xFF=None */
41 u8 port0port; /* Port num port connected to: 0,1,2, or */
42 /* 0xFF=None */
43 u8 port1node; /* Node ID port connected to: 0xFF=None */
44 u8 port1port; /* Port num port connected to: 0,1,2, or */
45 /* 0xFF=None */
46 u8 first_slot; /* Lowest slot number below this Calgary */
47 u8 status; /* Bit 0 = 1 : the XAPIC is used */
48 /* = 0 : the XAPIC is not used, ie: */
49 /* ints fwded to another XAPIC */
50 /* Bits1:7 Reserved */
51 u8 WP_index; /* instance index - lower ones have */
52 /* lower slot numbers/PCI bus numbers */
53 u8 chassis_num; /* 1 based Chassis number */
54} __attribute__((packed));
55
56enum {
57 HURR_SCALABILTY = 0, /* Hurricane Scalability info */
58 HURR_RIOIB = 2, /* Hurricane RIOIB info */
59 COMPAT_CALGARY = 4, /* Compatibility Calgary */
60 ALT_CALGARY = 5, /* Second Planar Calgary */
61};
62
63#endif /* __ASM_RIO_H */
diff --git a/include/asm-x86/rtc.h b/include/asm-x86/rtc.h
deleted file mode 100644
index f71c3b0ed360..000000000000
--- a/include/asm-x86/rtc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/rtc.h>
diff --git a/include/asm-x86/rwlock.h b/include/asm-x86/rwlock.h
deleted file mode 100644
index 6a8c0d645108..000000000000
--- a/include/asm-x86/rwlock.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_X86_RWLOCK_H
2#define _ASM_X86_RWLOCK_H
3
4#define RW_LOCK_BIAS 0x01000000
5
6/* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */
7
8#endif /* _ASM_X86_RWLOCK_H */
diff --git a/include/asm-x86/rwsem.h b/include/asm-x86/rwsem.h
deleted file mode 100644
index 750f2a3542b3..000000000000
--- a/include/asm-x86/rwsem.h
+++ /dev/null
@@ -1,265 +0,0 @@
1/* rwsem.h: R/W semaphores implemented using XADD/CMPXCHG for i486+
2 *
3 * Written by David Howells (dhowells@redhat.com).
4 *
5 * Derived from asm-x86/semaphore.h
6 *
7 *
8 * The MSW of the count is the negated number of active writers and waiting
9 * lockers, and the LSW is the total number of active locks
10 *
11 * The lock count is initialized to 0 (no active and no waiting lockers).
12 *
13 * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case of an
14 * uncontended lock. This can be determined because XADD returns the old value.
15 * Readers increment by 1 and see a positive value when uncontended, negative
16 * if there are writers (and maybe) readers waiting (in which case it goes to
17 * sleep).
18 *
19 * The value of WAITING_BIAS supports up to 32766 waiting processes. This can
20 * be extended to 65534 by manually checking the whole MSW rather than relying
21 * on the S flag.
22 *
23 * The value of ACTIVE_BIAS supports up to 65535 active processes.
24 *
25 * This should be totally fair - if anything is waiting, a process that wants a
26 * lock will go to the back of the queue. When the currently active lock is
27 * released, if there's a writer at the front of the queue, then that and only
28 * that will be woken up; if there's a bunch of consequtive readers at the
29 * front, then they'll all be woken up, but no other readers will be.
30 */
31
32#ifndef _I386_RWSEM_H
33#define _I386_RWSEM_H
34
35#ifndef _LINUX_RWSEM_H
36#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
37#endif
38
39#ifdef __KERNEL__
40
41#include <linux/list.h>
42#include <linux/spinlock.h>
43#include <linux/lockdep.h>
44
45struct rwsem_waiter;
46
47extern asmregparm struct rw_semaphore *
48 rwsem_down_read_failed(struct rw_semaphore *sem);
49extern asmregparm struct rw_semaphore *
50 rwsem_down_write_failed(struct rw_semaphore *sem);
51extern asmregparm struct rw_semaphore *
52 rwsem_wake(struct rw_semaphore *);
53extern asmregparm struct rw_semaphore *
54 rwsem_downgrade_wake(struct rw_semaphore *sem);
55
56/*
57 * the semaphore definition
58 */
59
60#define RWSEM_UNLOCKED_VALUE 0x00000000
61#define RWSEM_ACTIVE_BIAS 0x00000001
62#define RWSEM_ACTIVE_MASK 0x0000ffff
63#define RWSEM_WAITING_BIAS (-0x00010000)
64#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
65#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
66
67struct rw_semaphore {
68 signed long count;
69 spinlock_t wait_lock;
70 struct list_head wait_list;
71#ifdef CONFIG_DEBUG_LOCK_ALLOC
72 struct lockdep_map dep_map;
73#endif
74};
75
76#ifdef CONFIG_DEBUG_LOCK_ALLOC
77# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
78#else
79# define __RWSEM_DEP_MAP_INIT(lockname)
80#endif
81
82
83#define __RWSEM_INITIALIZER(name) \
84{ \
85 RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
86 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) \
87}
88
89#define DECLARE_RWSEM(name) \
90 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
91
92extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
93 struct lock_class_key *key);
94
95#define init_rwsem(sem) \
96do { \
97 static struct lock_class_key __key; \
98 \
99 __init_rwsem((sem), #sem, &__key); \
100} while (0)
101
102/*
103 * lock for reading
104 */
105static inline void __down_read(struct rw_semaphore *sem)
106{
107 asm volatile("# beginning down_read\n\t"
108 LOCK_PREFIX " incl (%%eax)\n\t"
109 /* adds 0x00000001, returns the old value */
110 " jns 1f\n"
111 " call call_rwsem_down_read_failed\n"
112 "1:\n\t"
113 "# ending down_read\n\t"
114 : "+m" (sem->count)
115 : "a" (sem)
116 : "memory", "cc");
117}
118
119/*
120 * trylock for reading -- returns 1 if successful, 0 if contention
121 */
122static inline int __down_read_trylock(struct rw_semaphore *sem)
123{
124 __s32 result, tmp;
125 asm volatile("# beginning __down_read_trylock\n\t"
126 " movl %0,%1\n\t"
127 "1:\n\t"
128 " movl %1,%2\n\t"
129 " addl %3,%2\n\t"
130 " jle 2f\n\t"
131 LOCK_PREFIX " cmpxchgl %2,%0\n\t"
132 " jnz 1b\n\t"
133 "2:\n\t"
134 "# ending __down_read_trylock\n\t"
135 : "+m" (sem->count), "=&a" (result), "=&r" (tmp)
136 : "i" (RWSEM_ACTIVE_READ_BIAS)
137 : "memory", "cc");
138 return result >= 0 ? 1 : 0;
139}
140
141/*
142 * lock for writing
143 */
144static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
145{
146 int tmp;
147
148 tmp = RWSEM_ACTIVE_WRITE_BIAS;
149 asm volatile("# beginning down_write\n\t"
150 LOCK_PREFIX " xadd %%edx,(%%eax)\n\t"
151 /* subtract 0x0000ffff, returns the old value */
152 " testl %%edx,%%edx\n\t"
153 /* was the count 0 before? */
154 " jz 1f\n"
155 " call call_rwsem_down_write_failed\n"
156 "1:\n"
157 "# ending down_write"
158 : "+m" (sem->count), "=d" (tmp)
159 : "a" (sem), "1" (tmp)
160 : "memory", "cc");
161}
162
163static inline void __down_write(struct rw_semaphore *sem)
164{
165 __down_write_nested(sem, 0);
166}
167
168/*
169 * trylock for writing -- returns 1 if successful, 0 if contention
170 */
171static inline int __down_write_trylock(struct rw_semaphore *sem)
172{
173 signed long ret = cmpxchg(&sem->count,
174 RWSEM_UNLOCKED_VALUE,
175 RWSEM_ACTIVE_WRITE_BIAS);
176 if (ret == RWSEM_UNLOCKED_VALUE)
177 return 1;
178 return 0;
179}
180
181/*
182 * unlock after reading
183 */
184static inline void __up_read(struct rw_semaphore *sem)
185{
186 __s32 tmp = -RWSEM_ACTIVE_READ_BIAS;
187 asm volatile("# beginning __up_read\n\t"
188 LOCK_PREFIX " xadd %%edx,(%%eax)\n\t"
189 /* subtracts 1, returns the old value */
190 " jns 1f\n\t"
191 " call call_rwsem_wake\n"
192 "1:\n"
193 "# ending __up_read\n"
194 : "+m" (sem->count), "=d" (tmp)
195 : "a" (sem), "1" (tmp)
196 : "memory", "cc");
197}
198
199/*
200 * unlock after writing
201 */
202static inline void __up_write(struct rw_semaphore *sem)
203{
204 asm volatile("# beginning __up_write\n\t"
205 " movl %2,%%edx\n\t"
206 LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t"
207 /* tries to transition
208 0xffff0001 -> 0x00000000 */
209 " jz 1f\n"
210 " call call_rwsem_wake\n"
211 "1:\n\t"
212 "# ending __up_write\n"
213 : "+m" (sem->count)
214 : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS)
215 : "memory", "cc", "edx");
216}
217
218/*
219 * downgrade write lock to read lock
220 */
221static inline void __downgrade_write(struct rw_semaphore *sem)
222{
223 asm volatile("# beginning __downgrade_write\n\t"
224 LOCK_PREFIX " addl %2,(%%eax)\n\t"
225 /* transitions 0xZZZZ0001 -> 0xYYYY0001 */
226 " jns 1f\n\t"
227 " call call_rwsem_downgrade_wake\n"
228 "1:\n\t"
229 "# ending __downgrade_write\n"
230 : "+m" (sem->count)
231 : "a" (sem), "i" (-RWSEM_WAITING_BIAS)
232 : "memory", "cc");
233}
234
235/*
236 * implement atomic add functionality
237 */
238static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
239{
240 asm volatile(LOCK_PREFIX "addl %1,%0"
241 : "+m" (sem->count)
242 : "ir" (delta));
243}
244
245/*
246 * implement exchange and add functionality
247 */
248static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
249{
250 int tmp = delta;
251
252 asm volatile(LOCK_PREFIX "xadd %0,%1"
253 : "+r" (tmp), "+m" (sem->count)
254 : : "memory");
255
256 return tmp + delta;
257}
258
259static inline int rwsem_is_locked(struct rw_semaphore *sem)
260{
261 return (sem->count != 0);
262}
263
264#endif /* __KERNEL__ */
265#endif /* _I386_RWSEM_H */
diff --git a/include/asm-x86/scatterlist.h b/include/asm-x86/scatterlist.h
deleted file mode 100644
index c0432061f81a..000000000000
--- a/include/asm-x86/scatterlist.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _ASM_X86_SCATTERLIST_H
2#define _ASM_X86_SCATTERLIST_H
3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13 dma_addr_t dma_address;
14 unsigned int dma_length;
15};
16
17#define ARCH_HAS_SG_CHAIN
18#define ISA_DMA_THRESHOLD (0x00ffffff)
19
20/*
21 * These macros should be used after a pci_map_sg call has been done
22 * to get bus addresses of each of the SG entries and their lengths.
23 * You should only work with the number of sg entries pci_map_sg
24 * returns.
25 */
26#define sg_dma_address(sg) ((sg)->dma_address)
27#ifdef CONFIG_X86_32
28# define sg_dma_len(sg) ((sg)->length)
29#else
30# define sg_dma_len(sg) ((sg)->dma_length)
31#endif
32
33#endif
diff --git a/include/asm-x86/seccomp.h b/include/asm-x86/seccomp.h
deleted file mode 100644
index c62e58a5a90d..000000000000
--- a/include/asm-x86/seccomp.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "seccomp_32.h"
3#else
4# include "seccomp_64.h"
5#endif
diff --git a/include/asm-x86/seccomp_32.h b/include/asm-x86/seccomp_32.h
deleted file mode 100644
index 36e71c5f306f..000000000000
--- a/include/asm-x86/seccomp_32.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_SECCOMP_H
2#define _ASM_SECCOMP_H
3
4#include <linux/thread_info.h>
5
6#ifdef TIF_32BIT
7#error "unexpected TIF_32BIT on i386"
8#endif
9
10#include <linux/unistd.h>
11
12#define __NR_seccomp_read __NR_read
13#define __NR_seccomp_write __NR_write
14#define __NR_seccomp_exit __NR_exit
15#define __NR_seccomp_sigreturn __NR_sigreturn
16
17#endif /* _ASM_SECCOMP_H */
diff --git a/include/asm-x86/seccomp_64.h b/include/asm-x86/seccomp_64.h
deleted file mode 100644
index 76cfe69aa63c..000000000000
--- a/include/asm-x86/seccomp_64.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_SECCOMP_H
2#define _ASM_SECCOMP_H
3
4#include <linux/thread_info.h>
5
6#ifdef TIF_32BIT
7#error "unexpected TIF_32BIT on x86_64"
8#else
9#define TIF_32BIT TIF_IA32
10#endif
11
12#include <linux/unistd.h>
13#include <asm/ia32_unistd.h>
14
15#define __NR_seccomp_read __NR_read
16#define __NR_seccomp_write __NR_write
17#define __NR_seccomp_exit __NR_exit
18#define __NR_seccomp_sigreturn __NR_rt_sigreturn
19
20#define __NR_seccomp_read_32 __NR_ia32_read
21#define __NR_seccomp_write_32 __NR_ia32_write
22#define __NR_seccomp_exit_32 __NR_ia32_exit
23#define __NR_seccomp_sigreturn_32 __NR_ia32_sigreturn
24
25#endif /* _ASM_SECCOMP_H */
diff --git a/include/asm-x86/sections.h b/include/asm-x86/sections.h
deleted file mode 100644
index 2b8c5160388f..000000000000
--- a/include/asm-x86/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sections.h>
diff --git a/include/asm-x86/segment.h b/include/asm-x86/segment.h
deleted file mode 100644
index 646452ea9ea3..000000000000
--- a/include/asm-x86/segment.h
+++ /dev/null
@@ -1,215 +0,0 @@
1#ifndef _ASM_X86_SEGMENT_H_
2#define _ASM_X86_SEGMENT_H_
3
4/* Constructor for a conventional segment GDT (or LDT) entry */
5/* This is a macro so it can be used in initializers */
6#define GDT_ENTRY(flags, base, limit) \
7 ((((base) & 0xff000000ULL) << (56-24)) | \
8 (((flags) & 0x0000f0ffULL) << 40) | \
9 (((limit) & 0x000f0000ULL) << (48-16)) | \
10 (((base) & 0x00ffffffULL) << 16) | \
11 (((limit) & 0x0000ffffULL)))
12
13/* Simple and small GDT entries for booting only */
14
15#define GDT_ENTRY_BOOT_CS 2
16#define __BOOT_CS (GDT_ENTRY_BOOT_CS * 8)
17
18#define GDT_ENTRY_BOOT_DS (GDT_ENTRY_BOOT_CS + 1)
19#define __BOOT_DS (GDT_ENTRY_BOOT_DS * 8)
20
21#define GDT_ENTRY_BOOT_TSS (GDT_ENTRY_BOOT_CS + 2)
22#define __BOOT_TSS (GDT_ENTRY_BOOT_TSS * 8)
23
24#ifdef CONFIG_X86_32
25/*
26 * The layout of the per-CPU GDT under Linux:
27 *
28 * 0 - null
29 * 1 - reserved
30 * 2 - reserved
31 * 3 - reserved
32 *
33 * 4 - unused <==== new cacheline
34 * 5 - unused
35 *
36 * ------- start of TLS (Thread-Local Storage) segments:
37 *
38 * 6 - TLS segment #1 [ glibc's TLS segment ]
39 * 7 - TLS segment #2 [ Wine's %fs Win32 segment ]
40 * 8 - TLS segment #3
41 * 9 - reserved
42 * 10 - reserved
43 * 11 - reserved
44 *
45 * ------- start of kernel segments:
46 *
47 * 12 - kernel code segment <==== new cacheline
48 * 13 - kernel data segment
49 * 14 - default user CS
50 * 15 - default user DS
51 * 16 - TSS
52 * 17 - LDT
53 * 18 - PNPBIOS support (16->32 gate)
54 * 19 - PNPBIOS support
55 * 20 - PNPBIOS support
56 * 21 - PNPBIOS support
57 * 22 - PNPBIOS support
58 * 23 - APM BIOS support
59 * 24 - APM BIOS support
60 * 25 - APM BIOS support
61 *
62 * 26 - ESPFIX small SS
63 * 27 - per-cpu [ offset to per-cpu data area ]
64 * 28 - unused
65 * 29 - unused
66 * 30 - unused
67 * 31 - TSS for double fault handler
68 */
69#define GDT_ENTRY_TLS_MIN 6
70#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
71
72#define GDT_ENTRY_DEFAULT_USER_CS 14
73
74#define GDT_ENTRY_DEFAULT_USER_DS 15
75
76#define GDT_ENTRY_KERNEL_BASE 12
77
78#define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0)
79
80#define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1)
81
82#define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4)
83#define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5)
84
85#define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 6)
86#define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 11)
87
88#define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14)
89#define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
90
91#define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE + 15)
92#ifdef CONFIG_SMP
93#define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8)
94#else
95#define __KERNEL_PERCPU 0
96#endif
97
98#define GDT_ENTRY_DOUBLEFAULT_TSS 31
99
100/*
101 * The GDT has 32 entries
102 */
103#define GDT_ENTRIES 32
104
105/* The PnP BIOS entries in the GDT */
106#define GDT_ENTRY_PNPBIOS_CS32 (GDT_ENTRY_PNPBIOS_BASE + 0)
107#define GDT_ENTRY_PNPBIOS_CS16 (GDT_ENTRY_PNPBIOS_BASE + 1)
108#define GDT_ENTRY_PNPBIOS_DS (GDT_ENTRY_PNPBIOS_BASE + 2)
109#define GDT_ENTRY_PNPBIOS_TS1 (GDT_ENTRY_PNPBIOS_BASE + 3)
110#define GDT_ENTRY_PNPBIOS_TS2 (GDT_ENTRY_PNPBIOS_BASE + 4)
111
112/* The PnP BIOS selectors */
113#define PNP_CS32 (GDT_ENTRY_PNPBIOS_CS32 * 8) /* segment for calling fn */
114#define PNP_CS16 (GDT_ENTRY_PNPBIOS_CS16 * 8) /* code segment for BIOS */
115#define PNP_DS (GDT_ENTRY_PNPBIOS_DS * 8) /* data segment for BIOS */
116#define PNP_TS1 (GDT_ENTRY_PNPBIOS_TS1 * 8) /* transfer data segment */
117#define PNP_TS2 (GDT_ENTRY_PNPBIOS_TS2 * 8) /* another data segment */
118
119/* Bottom two bits of selector give the ring privilege level */
120#define SEGMENT_RPL_MASK 0x3
121/* Bit 2 is table indicator (LDT/GDT) */
122#define SEGMENT_TI_MASK 0x4
123
124/* User mode is privilege level 3 */
125#define USER_RPL 0x3
126/* LDT segment has TI set, GDT has it cleared */
127#define SEGMENT_LDT 0x4
128#define SEGMENT_GDT 0x0
129
130/*
131 * Matching rules for certain types of segments.
132 */
133
134/* Matches only __KERNEL_CS, ignoring PnP / USER / APM segments */
135#define SEGMENT_IS_KERNEL_CODE(x) (((x) & 0xfc) == GDT_ENTRY_KERNEL_CS * 8)
136
137/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
138#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
139
140/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
141#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
142
143
144#else
145#include <asm/cache.h>
146
147#define GDT_ENTRY_KERNEL32_CS 1
148#define GDT_ENTRY_KERNEL_CS 2
149#define GDT_ENTRY_KERNEL_DS 3
150
151#define __KERNEL32_CS (GDT_ENTRY_KERNEL32_CS * 8)
152
153/*
154 * we cannot use the same code segment descriptor for user and kernel
155 * -- not even in the long flat mode, because of different DPL /kkeil
156 * The segment offset needs to contain a RPL. Grr. -AK
157 * GDT layout to get 64bit syscall right (sysret hardcodes gdt offsets)
158 */
159#define GDT_ENTRY_DEFAULT_USER32_CS 4
160#define GDT_ENTRY_DEFAULT_USER_DS 5
161#define GDT_ENTRY_DEFAULT_USER_CS 6
162#define __USER32_CS (GDT_ENTRY_DEFAULT_USER32_CS * 8 + 3)
163#define __USER32_DS __USER_DS
164
165#define GDT_ENTRY_TSS 8 /* needs two entries */
166#define GDT_ENTRY_LDT 10 /* needs two entries */
167#define GDT_ENTRY_TLS_MIN 12
168#define GDT_ENTRY_TLS_MAX 14
169
170#define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */
171#define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3)
172
173/* TLS indexes for 64bit - hardcoded in arch_prctl */
174#define FS_TLS 0
175#define GS_TLS 1
176
177#define GS_TLS_SEL ((GDT_ENTRY_TLS_MIN+GS_TLS)*8 + 3)
178#define FS_TLS_SEL ((GDT_ENTRY_TLS_MIN+FS_TLS)*8 + 3)
179
180#define GDT_ENTRIES 16
181
182#endif
183
184#define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8)
185#define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8)
186#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3)
187#define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS* 8 + 3)
188#ifndef CONFIG_PARAVIRT
189#define get_kernel_rpl() 0
190#endif
191
192/* User mode is privilege level 3 */
193#define USER_RPL 0x3
194/* LDT segment has TI set, GDT has it cleared */
195#define SEGMENT_LDT 0x4
196#define SEGMENT_GDT 0x0
197
198/* Bottom two bits of selector give the ring privilege level */
199#define SEGMENT_RPL_MASK 0x3
200/* Bit 2 is table indicator (LDT/GDT) */
201#define SEGMENT_TI_MASK 0x4
202
203#define IDT_ENTRIES 256
204#define NUM_EXCEPTION_VECTORS 32
205#define GDT_SIZE (GDT_ENTRIES * 8)
206#define GDT_ENTRY_TLS_ENTRIES 3
207#define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
208
209#ifdef __KERNEL__
210#ifndef __ASSEMBLY__
211extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][10];
212#endif
213#endif
214
215#endif
diff --git a/include/asm-x86/sembuf.h b/include/asm-x86/sembuf.h
deleted file mode 100644
index ee50c801f7b7..000000000000
--- a/include/asm-x86/sembuf.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _ASM_X86_SEMBUF_H
2#define _ASM_X86_SEMBUF_H
3
4/*
5 * The semid64_ds structure for x86 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13struct semid64_ds {
14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
15 __kernel_time_t sem_otime; /* last semop time */
16 unsigned long __unused1;
17 __kernel_time_t sem_ctime; /* last change time */
18 unsigned long __unused2;
19 unsigned long sem_nsems; /* no. of semaphores in array */
20 unsigned long __unused3;
21 unsigned long __unused4;
22};
23
24#endif /* _ASM_X86_SEMBUF_H */
diff --git a/include/asm-x86/serial.h b/include/asm-x86/serial.h
deleted file mode 100644
index 628c801535ea..000000000000
--- a/include/asm-x86/serial.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_X86_SERIAL_H
2#define _ASM_X86_SERIAL_H
3
4/*
5 * This assumes you have a 1.8432 MHz clock for your UART.
6 *
7 * It'd be nice if someone built a serial card with a 24.576 MHz
8 * clock, since the 16550A is capable of handling a top speed of 1.5
9 * megabits/second; but this requires the faster clock.
10 */
11#define BASE_BAUD ( 1843200 / 16 )
12
13/* Standard COM flags (except for COM4, because of the 8514 problem) */
14#ifdef CONFIG_SERIAL_DETECT_IRQ
15#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
16#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
17#else
18#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
19#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
20#endif
21
22#define SERIAL_PORT_DFNS \
23 /* UART CLK PORT IRQ FLAGS */ \
24 { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */ \
25 { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */ \
26 { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */ \
27 { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
28
29#endif /* _ASM_X86_SERIAL_H */
diff --git a/include/asm-x86/setup.h b/include/asm-x86/setup.h
deleted file mode 100644
index a07c6f1c01e1..000000000000
--- a/include/asm-x86/setup.h
+++ /dev/null
@@ -1,103 +0,0 @@
1#ifndef _ASM_X86_SETUP_H
2#define _ASM_X86_SETUP_H
3
4#define COMMAND_LINE_SIZE 2048
5
6#ifndef __ASSEMBLY__
7
8/* Interrupt control for vSMPowered x86_64 systems */
9void vsmp_init(void);
10
11#ifdef CONFIG_X86_VISWS
12extern void visws_early_detect(void);
13extern int is_visws_box(void);
14#else
15static inline void visws_early_detect(void) { }
16static inline int is_visws_box(void) { return 0; }
17#endif
18
19/*
20 * Any setup quirks to be performed?
21 */
22struct mpc_config_processor;
23struct mpc_config_bus;
24struct mp_config_oemtable;
25struct x86_quirks {
26 int (*arch_pre_time_init)(void);
27 int (*arch_time_init)(void);
28 int (*arch_pre_intr_init)(void);
29 int (*arch_intr_init)(void);
30 int (*arch_trap_init)(void);
31 char * (*arch_memory_setup)(void);
32 int (*mach_get_smp_config)(unsigned int early);
33 int (*mach_find_smp_config)(unsigned int reserve);
34
35 int *mpc_record;
36 int (*mpc_apic_id)(struct mpc_config_processor *m);
37 void (*mpc_oem_bus_info)(struct mpc_config_bus *m, char *name);
38 void (*mpc_oem_pci_bus)(struct mpc_config_bus *m);
39 void (*smp_read_mpc_oem)(struct mp_config_oemtable *oemtable,
40 unsigned short oemsize);
41};
42
43extern struct x86_quirks *x86_quirks;
44
45#ifndef CONFIG_PARAVIRT
46#define paravirt_post_allocator_init() do {} while (0)
47#endif
48#endif /* __ASSEMBLY__ */
49
50#ifdef __KERNEL__
51
52#ifdef __i386__
53
54#include <linux/pfn.h>
55/*
56 * Reserved space for vmalloc and iomap - defined in asm/page.h
57 */
58#define MAXMEM_PFN PFN_DOWN(MAXMEM)
59#define MAX_NONPAE_PFN (1 << 20)
60
61#endif /* __i386__ */
62
63#define PARAM_SIZE 4096 /* sizeof(struct boot_params) */
64
65#define OLD_CL_MAGIC 0xA33F
66#define OLD_CL_ADDRESS 0x020 /* Relative to real mode data */
67#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
68
69#ifndef __ASSEMBLY__
70#include <asm/bootparam.h>
71
72#ifndef _SETUP
73
74/*
75 * This is set up by the setup-routine at boot-time
76 */
77extern struct boot_params boot_params;
78
79/*
80 * Do NOT EVER look at the BIOS memory size location.
81 * It does not work on many machines.
82 */
83#define LOWMEMSIZE() (0x9f000)
84
85#ifdef __i386__
86
87void __init i386_start_kernel(void);
88extern void probe_roms(void);
89
90extern unsigned long init_pg_tables_start;
91extern unsigned long init_pg_tables_end;
92
93#else
94void __init x86_64_init_pda(void);
95void __init x86_64_start_kernel(char *real_mode);
96void __init x86_64_start_reservations(char *real_mode_data);
97
98#endif /* __i386__ */
99#endif /* _SETUP */
100#endif /* __ASSEMBLY__ */
101#endif /* __KERNEL__ */
102
103#endif /* _ASM_X86_SETUP_H */
diff --git a/include/asm-x86/shmbuf.h b/include/asm-x86/shmbuf.h
deleted file mode 100644
index b51413b74971..000000000000
--- a/include/asm-x86/shmbuf.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef _ASM_X86_SHMBUF_H
2#define _ASM_X86_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for x86 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space on 32 bit is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 *
13 * Pad space on 64 bit is left for:
14 * - 2 miscellaneous 64-bit values
15 */
16
17struct shmid64_ds {
18 struct ipc64_perm shm_perm; /* operation perms */
19 size_t shm_segsz; /* size of segment (bytes) */
20 __kernel_time_t shm_atime; /* last attach time */
21#ifdef __i386__
22 unsigned long __unused1;
23#endif
24 __kernel_time_t shm_dtime; /* last detach time */
25#ifdef __i386__
26 unsigned long __unused2;
27#endif
28 __kernel_time_t shm_ctime; /* last change time */
29#ifdef __i386__
30 unsigned long __unused3;
31#endif
32 __kernel_pid_t shm_cpid; /* pid of creator */
33 __kernel_pid_t shm_lpid; /* pid of last operator */
34 unsigned long shm_nattch; /* no. of current attaches */
35 unsigned long __unused4;
36 unsigned long __unused5;
37};
38
39struct shminfo64 {
40 unsigned long shmmax;
41 unsigned long shmmin;
42 unsigned long shmmni;
43 unsigned long shmseg;
44 unsigned long shmall;
45 unsigned long __unused1;
46 unsigned long __unused2;
47 unsigned long __unused3;
48 unsigned long __unused4;
49};
50
51#endif /* _ASM_X86_SHMBUF_H */
diff --git a/include/asm-x86/shmparam.h b/include/asm-x86/shmparam.h
deleted file mode 100644
index 0880cf0917b9..000000000000
--- a/include/asm-x86/shmparam.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_X86_SHMPARAM_H
2#define _ASM_X86_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_X86_SHMPARAM_H */
diff --git a/include/asm-x86/sigcontext.h b/include/asm-x86/sigcontext.h
deleted file mode 100644
index 2f9c884d2c0f..000000000000
--- a/include/asm-x86/sigcontext.h
+++ /dev/null
@@ -1,205 +0,0 @@
1#ifndef _ASM_X86_SIGCONTEXT_H
2#define _ASM_X86_SIGCONTEXT_H
3
4#include <linux/compiler.h>
5#include <asm/types.h>
6
7#ifdef __i386__
8/*
9 * As documented in the iBCS2 standard..
10 *
11 * The first part of "struct _fpstate" is just the normal i387
12 * hardware setup, the extra "status" word is used to save the
13 * coprocessor status word before entering the handler.
14 *
15 * Pentium III FXSR, SSE support
16 * Gareth Hughes <gareth@valinux.com>, May 2000
17 *
18 * The FPU state data structure has had to grow to accommodate the
19 * extended FPU state required by the Streaming SIMD Extensions.
20 * There is no documented standard to accomplish this at the moment.
21 */
22struct _fpreg {
23 unsigned short significand[4];
24 unsigned short exponent;
25};
26
27struct _fpxreg {
28 unsigned short significand[4];
29 unsigned short exponent;
30 unsigned short padding[3];
31};
32
33struct _xmmreg {
34 unsigned long element[4];
35};
36
37struct _fpstate {
38 /* Regular FPU environment */
39 unsigned long cw;
40 unsigned long sw;
41 unsigned long tag;
42 unsigned long ipoff;
43 unsigned long cssel;
44 unsigned long dataoff;
45 unsigned long datasel;
46 struct _fpreg _st[8];
47 unsigned short status;
48 unsigned short magic; /* 0xffff = regular FPU data only */
49
50 /* FXSR FPU environment */
51 unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
52 unsigned long mxcsr;
53 unsigned long reserved;
54 struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
55 struct _xmmreg _xmm[8];
56 unsigned long padding[56];
57};
58
59#define X86_FXSR_MAGIC 0x0000
60
61#ifdef __KERNEL__
62struct sigcontext {
63 unsigned short gs, __gsh;
64 unsigned short fs, __fsh;
65 unsigned short es, __esh;
66 unsigned short ds, __dsh;
67 unsigned long di;
68 unsigned long si;
69 unsigned long bp;
70 unsigned long sp;
71 unsigned long bx;
72 unsigned long dx;
73 unsigned long cx;
74 unsigned long ax;
75 unsigned long trapno;
76 unsigned long err;
77 unsigned long ip;
78 unsigned short cs, __csh;
79 unsigned long flags;
80 unsigned long sp_at_signal;
81 unsigned short ss, __ssh;
82 struct _fpstate __user *fpstate;
83 unsigned long oldmask;
84 unsigned long cr2;
85};
86#else /* __KERNEL__ */
87/*
88 * User-space might still rely on the old definition:
89 */
90struct sigcontext {
91 unsigned short gs, __gsh;
92 unsigned short fs, __fsh;
93 unsigned short es, __esh;
94 unsigned short ds, __dsh;
95 unsigned long edi;
96 unsigned long esi;
97 unsigned long ebp;
98 unsigned long esp;
99 unsigned long ebx;
100 unsigned long edx;
101 unsigned long ecx;
102 unsigned long eax;
103 unsigned long trapno;
104 unsigned long err;
105 unsigned long eip;
106 unsigned short cs, __csh;
107 unsigned long eflags;
108 unsigned long esp_at_signal;
109 unsigned short ss, __ssh;
110 struct _fpstate __user *fpstate;
111 unsigned long oldmask;
112 unsigned long cr2;
113};
114#endif /* !__KERNEL__ */
115
116#else /* __i386__ */
117
118/* FXSAVE frame */
119/* Note: reserved1/2 may someday contain valuable data. Always save/restore
120 them when you change signal frames. */
121struct _fpstate {
122 __u16 cwd;
123 __u16 swd;
124 __u16 twd; /* Note this is not the same as the
125 32bit/x87/FSAVE twd */
126 __u16 fop;
127 __u64 rip;
128 __u64 rdp;
129 __u32 mxcsr;
130 __u32 mxcsr_mask;
131 __u32 st_space[32]; /* 8*16 bytes for each FP-reg */
132 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg */
133 __u32 reserved2[24];
134};
135
136#ifdef __KERNEL__
137struct sigcontext {
138 unsigned long r8;
139 unsigned long r9;
140 unsigned long r10;
141 unsigned long r11;
142 unsigned long r12;
143 unsigned long r13;
144 unsigned long r14;
145 unsigned long r15;
146 unsigned long di;
147 unsigned long si;
148 unsigned long bp;
149 unsigned long bx;
150 unsigned long dx;
151 unsigned long ax;
152 unsigned long cx;
153 unsigned long sp;
154 unsigned long ip;
155 unsigned long flags;
156 unsigned short cs;
157 unsigned short gs;
158 unsigned short fs;
159 unsigned short __pad0;
160 unsigned long err;
161 unsigned long trapno;
162 unsigned long oldmask;
163 unsigned long cr2;
164 struct _fpstate __user *fpstate; /* zero when no FPU context */
165 unsigned long reserved1[8];
166};
167#else /* __KERNEL__ */
168/*
169 * User-space might still rely on the old definition:
170 */
171struct sigcontext {
172 unsigned long r8;
173 unsigned long r9;
174 unsigned long r10;
175 unsigned long r11;
176 unsigned long r12;
177 unsigned long r13;
178 unsigned long r14;
179 unsigned long r15;
180 unsigned long rdi;
181 unsigned long rsi;
182 unsigned long rbp;
183 unsigned long rbx;
184 unsigned long rdx;
185 unsigned long rax;
186 unsigned long rcx;
187 unsigned long rsp;
188 unsigned long rip;
189 unsigned long eflags; /* RFLAGS */
190 unsigned short cs;
191 unsigned short gs;
192 unsigned short fs;
193 unsigned short __pad0;
194 unsigned long err;
195 unsigned long trapno;
196 unsigned long oldmask;
197 unsigned long cr2;
198 struct _fpstate __user *fpstate; /* zero when no FPU context */
199 unsigned long reserved1[8];
200};
201#endif /* !__KERNEL__ */
202
203#endif /* !__i386__ */
204
205#endif
diff --git a/include/asm-x86/sigcontext32.h b/include/asm-x86/sigcontext32.h
deleted file mode 100644
index 57a9686fb491..000000000000
--- a/include/asm-x86/sigcontext32.h
+++ /dev/null
@@ -1,71 +0,0 @@
1#ifndef _SIGCONTEXT32_H
2#define _SIGCONTEXT32_H 1
3
4/* signal context for 32bit programs. */
5
6#define X86_FXSR_MAGIC 0x0000
7
8struct _fpreg {
9 unsigned short significand[4];
10 unsigned short exponent;
11};
12
13struct _fpxreg {
14 unsigned short significand[4];
15 unsigned short exponent;
16 unsigned short padding[3];
17};
18
19struct _xmmreg {
20 __u32 element[4];
21};
22
23/* FSAVE frame with extensions */
24struct _fpstate_ia32 {
25 /* Regular FPU environment */
26 __u32 cw;
27 __u32 sw;
28 __u32 tag; /* not compatible to 64bit twd */
29 __u32 ipoff;
30 __u32 cssel;
31 __u32 dataoff;
32 __u32 datasel;
33 struct _fpreg _st[8];
34 unsigned short status;
35 unsigned short magic; /* 0xffff = regular FPU data only */
36
37 /* FXSR FPU environment */
38 __u32 _fxsr_env[6];
39 __u32 mxcsr;
40 __u32 reserved;
41 struct _fpxreg _fxsr_st[8];
42 struct _xmmreg _xmm[8]; /* It's actually 16 */
43 __u32 padding[56];
44};
45
46struct sigcontext_ia32 {
47 unsigned short gs, __gsh;
48 unsigned short fs, __fsh;
49 unsigned short es, __esh;
50 unsigned short ds, __dsh;
51 unsigned int di;
52 unsigned int si;
53 unsigned int bp;
54 unsigned int sp;
55 unsigned int bx;
56 unsigned int dx;
57 unsigned int cx;
58 unsigned int ax;
59 unsigned int trapno;
60 unsigned int err;
61 unsigned int ip;
62 unsigned short cs, __csh;
63 unsigned int flags;
64 unsigned int sp_at_signal;
65 unsigned short ss, __ssh;
66 unsigned int fpstate; /* really (struct _fpstate_ia32 *) */
67 unsigned int oldmask;
68 unsigned int cr2;
69};
70
71#endif
diff --git a/include/asm-x86/siginfo.h b/include/asm-x86/siginfo.h
deleted file mode 100644
index a477bea0c2a1..000000000000
--- a/include/asm-x86/siginfo.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef _ASM_X86_SIGINFO_H
2#define _ASM_X86_SIGINFO_H
3
4#ifdef __x86_64__
5# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
6#endif
7
8#include <asm-generic/siginfo.h>
9
10#endif
diff --git a/include/asm-x86/signal.h b/include/asm-x86/signal.h
deleted file mode 100644
index 6dac49364e95..000000000000
--- a/include/asm-x86/signal.h
+++ /dev/null
@@ -1,259 +0,0 @@
1#ifndef _ASM_X86_SIGNAL_H
2#define _ASM_X86_SIGNAL_H
3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#include <linux/time.h>
7#include <linux/compiler.h>
8
9/* Avoid too many header ordering problems. */
10struct siginfo;
11
12#ifdef __KERNEL__
13#include <linux/linkage.h>
14
15/* Most things should be clean enough to redefine this at will, if care
16 is taken to make libc match. */
17
18#define _NSIG 64
19
20#ifdef __i386__
21# define _NSIG_BPW 32
22#else
23# define _NSIG_BPW 64
24#endif
25
26#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
27
28typedef unsigned long old_sigset_t; /* at least 32 bits */
29
30typedef struct {
31 unsigned long sig[_NSIG_WORDS];
32} sigset_t;
33
34#else
35/* Here we must cater to libcs that poke about in kernel headers. */
36
37#define NSIG 32
38typedef unsigned long sigset_t;
39
40#endif /* __KERNEL__ */
41#endif /* __ASSEMBLY__ */
42
43#define SIGHUP 1
44#define SIGINT 2
45#define SIGQUIT 3
46#define SIGILL 4
47#define SIGTRAP 5
48#define SIGABRT 6
49#define SIGIOT 6
50#define SIGBUS 7
51#define SIGFPE 8
52#define SIGKILL 9
53#define SIGUSR1 10
54#define SIGSEGV 11
55#define SIGUSR2 12
56#define SIGPIPE 13
57#define SIGALRM 14
58#define SIGTERM 15
59#define SIGSTKFLT 16
60#define SIGCHLD 17
61#define SIGCONT 18
62#define SIGSTOP 19
63#define SIGTSTP 20
64#define SIGTTIN 21
65#define SIGTTOU 22
66#define SIGURG 23
67#define SIGXCPU 24
68#define SIGXFSZ 25
69#define SIGVTALRM 26
70#define SIGPROF 27
71#define SIGWINCH 28
72#define SIGIO 29
73#define SIGPOLL SIGIO
74/*
75#define SIGLOST 29
76*/
77#define SIGPWR 30
78#define SIGSYS 31
79#define SIGUNUSED 31
80
81/* These should not be considered constants from userland. */
82#define SIGRTMIN 32
83#define SIGRTMAX _NSIG
84
85/*
86 * SA_FLAGS values:
87 *
88 * SA_ONSTACK indicates that a registered stack_t will be used.
89 * SA_RESTART flag to get restarting signals (which were the default long ago)
90 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
91 * SA_RESETHAND clears the handler when the signal is delivered.
92 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
93 * SA_NODEFER prevents the current signal from being masked in the handler.
94 *
95 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
96 * Unix names RESETHAND and NODEFER respectively.
97 */
98#define SA_NOCLDSTOP 0x00000001u
99#define SA_NOCLDWAIT 0x00000002u
100#define SA_SIGINFO 0x00000004u
101#define SA_ONSTACK 0x08000000u
102#define SA_RESTART 0x10000000u
103#define SA_NODEFER 0x40000000u
104#define SA_RESETHAND 0x80000000u
105
106#define SA_NOMASK SA_NODEFER
107#define SA_ONESHOT SA_RESETHAND
108
109#define SA_RESTORER 0x04000000
110
111/*
112 * sigaltstack controls
113 */
114#define SS_ONSTACK 1
115#define SS_DISABLE 2
116
117#define MINSIGSTKSZ 2048
118#define SIGSTKSZ 8192
119
120#include <asm-generic/signal.h>
121
122#ifndef __ASSEMBLY__
123
124#ifdef __i386__
125# ifdef __KERNEL__
126struct old_sigaction {
127 __sighandler_t sa_handler;
128 old_sigset_t sa_mask;
129 unsigned long sa_flags;
130 __sigrestore_t sa_restorer;
131};
132
133struct sigaction {
134 __sighandler_t sa_handler;
135 unsigned long sa_flags;
136 __sigrestore_t sa_restorer;
137 sigset_t sa_mask; /* mask last for extensibility */
138};
139
140struct k_sigaction {
141 struct sigaction sa;
142};
143# else /* __KERNEL__ */
144/* Here we must cater to libcs that poke about in kernel headers. */
145
146struct sigaction {
147 union {
148 __sighandler_t _sa_handler;
149 void (*_sa_sigaction)(int, struct siginfo *, void *);
150 } _u;
151 sigset_t sa_mask;
152 unsigned long sa_flags;
153 void (*sa_restorer)(void);
154};
155
156#define sa_handler _u._sa_handler
157#define sa_sigaction _u._sa_sigaction
158
159# endif /* ! __KERNEL__ */
160#else /* __i386__ */
161
162struct sigaction {
163 __sighandler_t sa_handler;
164 unsigned long sa_flags;
165 __sigrestore_t sa_restorer;
166 sigset_t sa_mask; /* mask last for extensibility */
167};
168
169struct k_sigaction {
170 struct sigaction sa;
171};
172
173#endif /* !__i386__ */
174
175typedef struct sigaltstack {
176 void __user *ss_sp;
177 int ss_flags;
178 size_t ss_size;
179} stack_t;
180
181#ifdef __KERNEL__
182#include <asm/sigcontext.h>
183
184#ifdef __i386__
185
186#define __HAVE_ARCH_SIG_BITOPS
187
188#define sigaddset(set,sig) \
189 (__builtin_constant_p(sig) \
190 ? __const_sigaddset((set), (sig)) \
191 : __gen_sigaddset((set), (sig)))
192
193static inline void __gen_sigaddset(sigset_t *set, int _sig)
194{
195 asm("btsl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
196}
197
198static inline void __const_sigaddset(sigset_t *set, int _sig)
199{
200 unsigned long sig = _sig - 1;
201 set->sig[sig / _NSIG_BPW] |= 1 << (sig % _NSIG_BPW);
202}
203
204#define sigdelset(set, sig) \
205 (__builtin_constant_p(sig) \
206 ? __const_sigdelset((set), (sig)) \
207 : __gen_sigdelset((set), (sig)))
208
209
210static inline void __gen_sigdelset(sigset_t *set, int _sig)
211{
212 asm("btrl %1,%0" : "+m"(*set) : "Ir"(_sig - 1) : "cc");
213}
214
215static inline void __const_sigdelset(sigset_t *set, int _sig)
216{
217 unsigned long sig = _sig - 1;
218 set->sig[sig / _NSIG_BPW] &= ~(1 << (sig % _NSIG_BPW));
219}
220
221static inline int __const_sigismember(sigset_t *set, int _sig)
222{
223 unsigned long sig = _sig - 1;
224 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
225}
226
227static inline int __gen_sigismember(sigset_t *set, int _sig)
228{
229 int ret;
230 asm("btl %2,%1\n\tsbbl %0,%0"
231 : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
232 return ret;
233}
234
235#define sigismember(set, sig) \
236 (__builtin_constant_p(sig) \
237 ? __const_sigismember((set), (sig)) \
238 : __gen_sigismember((set), (sig)))
239
240static inline int sigfindinword(unsigned long word)
241{
242 asm("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc");
243 return word;
244}
245
246struct pt_regs;
247
248#else /* __i386__ */
249
250#undef __HAVE_ARCH_SIG_BITOPS
251
252#endif /* !__i386__ */
253
254#define ptrace_signal_deliver(regs, cookie) do { } while (0)
255
256#endif /* __KERNEL__ */
257#endif /* __ASSEMBLY__ */
258
259#endif
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
deleted file mode 100644
index 3c877f74f279..000000000000
--- a/include/asm-x86/smp.h
+++ /dev/null
@@ -1,208 +0,0 @@
1#ifndef _ASM_X86_SMP_H_
2#define _ASM_X86_SMP_H_
3#ifndef __ASSEMBLY__
4#include <linux/cpumask.h>
5#include <linux/init.h>
6#include <asm/percpu.h>
7
8/*
9 * We need the APIC definitions automatically as part of 'smp.h'
10 */
11#ifdef CONFIG_X86_LOCAL_APIC
12# include <asm/mpspec.h>
13# include <asm/apic.h>
14# ifdef CONFIG_X86_IO_APIC
15# include <asm/io_apic.h>
16# endif
17#endif
18#include <asm/pda.h>
19#include <asm/thread_info.h>
20
21extern cpumask_t cpu_callout_map;
22extern cpumask_t cpu_initialized;
23extern cpumask_t cpu_callin_map;
24
25extern void (*mtrr_hook)(void);
26extern void zap_low_mappings(void);
27
28extern int __cpuinit get_local_pda(int cpu);
29
30extern int smp_num_siblings;
31extern unsigned int num_processors;
32extern cpumask_t cpu_initialized;
33
34DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
35DECLARE_PER_CPU(cpumask_t, cpu_core_map);
36DECLARE_PER_CPU(u16, cpu_llc_id);
37
38DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
39DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
40
41/* Static state in head.S used to set up a CPU */
42extern struct {
43 void *sp;
44 unsigned short ss;
45} stack_start;
46
47struct smp_ops {
48 void (*smp_prepare_boot_cpu)(void);
49 void (*smp_prepare_cpus)(unsigned max_cpus);
50 int (*cpu_up)(unsigned cpu);
51 void (*smp_cpus_done)(unsigned max_cpus);
52
53 void (*smp_send_stop)(void);
54 void (*smp_send_reschedule)(int cpu);
55
56 void (*send_call_func_ipi)(cpumask_t mask);
57 void (*send_call_func_single_ipi)(int cpu);
58};
59
60/* Globals due to paravirt */
61extern void set_cpu_sibling_map(int cpu);
62
63#ifdef CONFIG_SMP
64#ifndef CONFIG_PARAVIRT
65#define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
66#endif
67extern struct smp_ops smp_ops;
68
69static inline void smp_send_stop(void)
70{
71 smp_ops.smp_send_stop();
72}
73
74static inline void smp_prepare_boot_cpu(void)
75{
76 smp_ops.smp_prepare_boot_cpu();
77}
78
79static inline void smp_prepare_cpus(unsigned int max_cpus)
80{
81 smp_ops.smp_prepare_cpus(max_cpus);
82}
83
84static inline void smp_cpus_done(unsigned int max_cpus)
85{
86 smp_ops.smp_cpus_done(max_cpus);
87}
88
89static inline int __cpu_up(unsigned int cpu)
90{
91 return smp_ops.cpu_up(cpu);
92}
93
94static inline void smp_send_reschedule(int cpu)
95{
96 smp_ops.smp_send_reschedule(cpu);
97}
98
99static inline void arch_send_call_function_single_ipi(int cpu)
100{
101 smp_ops.send_call_func_single_ipi(cpu);
102}
103
104static inline void arch_send_call_function_ipi(cpumask_t mask)
105{
106 smp_ops.send_call_func_ipi(mask);
107}
108
109void native_smp_prepare_boot_cpu(void);
110void native_smp_prepare_cpus(unsigned int max_cpus);
111void native_smp_cpus_done(unsigned int max_cpus);
112int native_cpu_up(unsigned int cpunum);
113void native_send_call_func_ipi(cpumask_t mask);
114void native_send_call_func_single_ipi(int cpu);
115
116extern int __cpu_disable(void);
117extern void __cpu_die(unsigned int cpu);
118
119void smp_store_cpu_info(int id);
120#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
121
122/* We don't mark CPUs online until __cpu_up(), so we need another measure */
123static inline int num_booting_cpus(void)
124{
125 return cpus_weight(cpu_callout_map);
126}
127#endif /* CONFIG_SMP */
128
129#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_CPU)
130extern void prefill_possible_map(void);
131#else
132static inline void prefill_possible_map(void)
133{
134}
135#endif
136
137extern unsigned disabled_cpus __cpuinitdata;
138
139#ifdef CONFIG_X86_32_SMP
140/*
141 * This function is needed by all SMP systems. It must _always_ be valid
142 * from the initial startup. We map APIC_BASE very early in page_setup(),
143 * so this is correct in the x86 case.
144 */
145DECLARE_PER_CPU(int, cpu_number);
146#define raw_smp_processor_id() (x86_read_percpu(cpu_number))
147extern int safe_smp_processor_id(void);
148
149#elif defined(CONFIG_X86_64_SMP)
150#define raw_smp_processor_id() read_pda(cpunumber)
151
152#define stack_smp_processor_id() \
153({ \
154 struct thread_info *ti; \
155 __asm__("andq %%rsp,%0; ":"=r" (ti) : "0" (CURRENT_MASK)); \
156 ti->cpu; \
157})
158#define safe_smp_processor_id() smp_processor_id()
159
160#else /* !CONFIG_X86_32_SMP && !CONFIG_X86_64_SMP */
161#define cpu_physical_id(cpu) boot_cpu_physical_apicid
162#define safe_smp_processor_id() 0
163#define stack_smp_processor_id() 0
164#endif
165
166#ifdef CONFIG_X86_LOCAL_APIC
167
168static inline int logical_smp_processor_id(void)
169{
170 /* we don't want to mark this access volatile - bad code generation */
171 return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
172}
173
174#ifndef CONFIG_X86_64
175static inline unsigned int read_apic_id(void)
176{
177 return *(u32 *)(APIC_BASE + APIC_ID);
178}
179#else
180extern unsigned int read_apic_id(void);
181#endif
182
183
184# ifdef APIC_DEFINITION
185extern int hard_smp_processor_id(void);
186# else
187# include <mach_apicdef.h>
188static inline int hard_smp_processor_id(void)
189{
190 /* we don't want to mark this access volatile - bad code generation */
191 return GET_APIC_ID(read_apic_id());
192}
193# endif /* APIC_DEFINITION */
194
195#else /* CONFIG_X86_LOCAL_APIC */
196
197# ifndef CONFIG_SMP
198# define hard_smp_processor_id() 0
199# endif
200
201#endif /* CONFIG_X86_LOCAL_APIC */
202
203#ifdef CONFIG_HOTPLUG_CPU
204extern void cpu_uninit(void);
205#endif
206
207#endif /* __ASSEMBLY__ */
208#endif
diff --git a/include/asm-x86/socket.h b/include/asm-x86/socket.h
deleted file mode 100644
index 80af9c4ccad7..000000000000
--- a/include/asm-x86/socket.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _ASM_SOCKET_H
2#define _ASM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86/sockios.h b/include/asm-x86/sockios.h
deleted file mode 100644
index 49cc72b5d3c9..000000000000
--- a/include/asm-x86/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_X86_SOCKIOS_H
2#define _ASM_X86_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* _ASM_X86_SOCKIOS_H */
diff --git a/include/asm-x86/sparsemem.h b/include/asm-x86/sparsemem.h
deleted file mode 100644
index 9bd48b0a534b..000000000000
--- a/include/asm-x86/sparsemem.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef _ASM_X86_SPARSEMEM_H
2#define _ASM_X86_SPARSEMEM_H
3
4#ifdef CONFIG_SPARSEMEM
5/*
6 * generic non-linear memory support:
7 *
8 * 1) we will not split memory into more chunks than will fit into the flags
9 * field of the struct page
10 *
11 * SECTION_SIZE_BITS 2^n: size of each section
12 * MAX_PHYSADDR_BITS 2^n: max size of physical address space
13 * MAX_PHYSMEM_BITS 2^n: how much memory we can have in that space
14 *
15 */
16
17#ifdef CONFIG_X86_32
18# ifdef CONFIG_X86_PAE
19# define SECTION_SIZE_BITS 29
20# define MAX_PHYSADDR_BITS 36
21# define MAX_PHYSMEM_BITS 36
22# else
23# define SECTION_SIZE_BITS 26
24# define MAX_PHYSADDR_BITS 32
25# define MAX_PHYSMEM_BITS 32
26# endif
27#else /* CONFIG_X86_32 */
28# define SECTION_SIZE_BITS 27 /* matt - 128 is convenient right now */
29# define MAX_PHYSADDR_BITS 44
30# define MAX_PHYSMEM_BITS 44
31#endif
32
33#endif /* CONFIG_SPARSEMEM */
34#endif
diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
deleted file mode 100644
index e39c790dbfd2..000000000000
--- a/include/asm-x86/spinlock.h
+++ /dev/null
@@ -1,369 +0,0 @@
1#ifndef _X86_SPINLOCK_H_
2#define _X86_SPINLOCK_H_
3
4#include <asm/atomic.h>
5#include <asm/rwlock.h>
6#include <asm/page.h>
7#include <asm/processor.h>
8#include <linux/compiler.h>
9#include <asm/paravirt.h>
10/*
11 * Your basic SMP spinlocks, allowing only a single CPU anywhere
12 *
13 * Simple spin lock operations. There are two variants, one clears IRQ's
14 * on the local processor, one does not.
15 *
16 * These are fair FIFO ticket locks, which are currently limited to 256
17 * CPUs.
18 *
19 * (the type definitions are in asm/spinlock_types.h)
20 */
21
22#ifdef CONFIG_X86_32
23# define LOCK_PTR_REG "a"
24#else
25# define LOCK_PTR_REG "D"
26#endif
27
28#if defined(CONFIG_X86_32) && \
29 (defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE))
30/*
31 * On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock
32 * (PPro errata 66, 92)
33 */
34# define UNLOCK_LOCK_PREFIX LOCK_PREFIX
35#else
36# define UNLOCK_LOCK_PREFIX
37#endif
38
39/*
40 * Ticket locks are conceptually two parts, one indicating the current head of
41 * the queue, and the other indicating the current tail. The lock is acquired
42 * by atomically noting the tail and incrementing it by one (thus adding
43 * ourself to the queue and noting our position), then waiting until the head
44 * becomes equal to the the initial value of the tail.
45 *
46 * We use an xadd covering *both* parts of the lock, to increment the tail and
47 * also load the position of the head, which takes care of memory ordering
48 * issues and should be optimal for the uncontended case. Note the tail must be
49 * in the high part, because a wide xadd increment of the low part would carry
50 * up and contaminate the high part.
51 *
52 * With fewer than 2^8 possible CPUs, we can use x86's partial registers to
53 * save some instructions and make the code more elegant. There really isn't
54 * much between them in performance though, especially as locks are out of line.
55 */
56#if (NR_CPUS < 256)
57static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
58{
59 int tmp = ACCESS_ONCE(lock->slock);
60
61 return (((tmp >> 8) & 0xff) != (tmp & 0xff));
62}
63
64static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
65{
66 int tmp = ACCESS_ONCE(lock->slock);
67
68 return (((tmp >> 8) - tmp) & 0xff) > 1;
69}
70
71static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
72{
73 short inc = 0x0100;
74
75 asm volatile (
76 LOCK_PREFIX "xaddw %w0, %1\n"
77 "1:\t"
78 "cmpb %h0, %b0\n\t"
79 "je 2f\n\t"
80 "rep ; nop\n\t"
81 "movb %1, %b0\n\t"
82 /* don't need lfence here, because loads are in-order */
83 "jmp 1b\n"
84 "2:"
85 : "+Q" (inc), "+m" (lock->slock)
86 :
87 : "memory", "cc");
88}
89
90static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
91{
92 int tmp;
93 short new;
94
95 asm volatile("movw %2,%w0\n\t"
96 "cmpb %h0,%b0\n\t"
97 "jne 1f\n\t"
98 "movw %w0,%w1\n\t"
99 "incb %h1\n\t"
100 "lock ; cmpxchgw %w1,%2\n\t"
101 "1:"
102 "sete %b1\n\t"
103 "movzbl %b1,%0\n\t"
104 : "=&a" (tmp), "=Q" (new), "+m" (lock->slock)
105 :
106 : "memory", "cc");
107
108 return tmp;
109}
110
111static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock)
112{
113 asm volatile(UNLOCK_LOCK_PREFIX "incb %0"
114 : "+m" (lock->slock)
115 :
116 : "memory", "cc");
117}
118#else
119static inline int __ticket_spin_is_locked(raw_spinlock_t *lock)
120{
121 int tmp = ACCESS_ONCE(lock->slock);
122
123 return (((tmp >> 16) & 0xffff) != (tmp & 0xffff));
124}
125
126static inline int __ticket_spin_is_contended(raw_spinlock_t *lock)
127{
128 int tmp = ACCESS_ONCE(lock->slock);
129
130 return (((tmp >> 16) - tmp) & 0xffff) > 1;
131}
132
133static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
134{
135 int inc = 0x00010000;
136 int tmp;
137
138 asm volatile("lock ; xaddl %0, %1\n"
139 "movzwl %w0, %2\n\t"
140 "shrl $16, %0\n\t"
141 "1:\t"
142 "cmpl %0, %2\n\t"
143 "je 2f\n\t"
144 "rep ; nop\n\t"
145 "movzwl %1, %2\n\t"
146 /* don't need lfence here, because loads are in-order */
147 "jmp 1b\n"
148 "2:"
149 : "+Q" (inc), "+m" (lock->slock), "=r" (tmp)
150 :
151 : "memory", "cc");
152}
153
154static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
155{
156 int tmp;
157 int new;
158
159 asm volatile("movl %2,%0\n\t"
160 "movl %0,%1\n\t"
161 "roll $16, %0\n\t"
162 "cmpl %0,%1\n\t"
163 "jne 1f\n\t"
164 "addl $0x00010000, %1\n\t"
165 "lock ; cmpxchgl %1,%2\n\t"
166 "1:"
167 "sete %b1\n\t"
168 "movzbl %b1,%0\n\t"
169 : "=&a" (tmp), "=r" (new), "+m" (lock->slock)
170 :
171 : "memory", "cc");
172
173 return tmp;
174}
175
176static __always_inline void __ticket_spin_unlock(raw_spinlock_t *lock)
177{
178 asm volatile(UNLOCK_LOCK_PREFIX "incw %0"
179 : "+m" (lock->slock)
180 :
181 : "memory", "cc");
182}
183#endif
184
185#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
186
187#ifdef CONFIG_PARAVIRT
188/*
189 * Define virtualization-friendly old-style lock byte lock, for use in
190 * pv_lock_ops if desired.
191 *
192 * This differs from the pre-2.6.24 spinlock by always using xchgb
193 * rather than decb to take the lock; this allows it to use a
194 * zero-initialized lock structure. It also maintains a 1-byte
195 * contention counter, so that we can implement
196 * __byte_spin_is_contended.
197 */
198struct __byte_spinlock {
199 s8 lock;
200 s8 spinners;
201};
202
203static inline int __byte_spin_is_locked(raw_spinlock_t *lock)
204{
205 struct __byte_spinlock *bl = (struct __byte_spinlock *)lock;
206 return bl->lock != 0;
207}
208
209static inline int __byte_spin_is_contended(raw_spinlock_t *lock)
210{
211 struct __byte_spinlock *bl = (struct __byte_spinlock *)lock;
212 return bl->spinners != 0;
213}
214
215static inline void __byte_spin_lock(raw_spinlock_t *lock)
216{
217 struct __byte_spinlock *bl = (struct __byte_spinlock *)lock;
218 s8 val = 1;
219
220 asm("1: xchgb %1, %0\n"
221 " test %1,%1\n"
222 " jz 3f\n"
223 " " LOCK_PREFIX "incb %2\n"
224 "2: rep;nop\n"
225 " cmpb $1, %0\n"
226 " je 2b\n"
227 " " LOCK_PREFIX "decb %2\n"
228 " jmp 1b\n"
229 "3:"
230 : "+m" (bl->lock), "+q" (val), "+m" (bl->spinners): : "memory");
231}
232
233static inline int __byte_spin_trylock(raw_spinlock_t *lock)
234{
235 struct __byte_spinlock *bl = (struct __byte_spinlock *)lock;
236 u8 old = 1;
237
238 asm("xchgb %1,%0"
239 : "+m" (bl->lock), "+q" (old) : : "memory");
240
241 return old == 0;
242}
243
244static inline void __byte_spin_unlock(raw_spinlock_t *lock)
245{
246 struct __byte_spinlock *bl = (struct __byte_spinlock *)lock;
247 smp_wmb();
248 bl->lock = 0;
249}
250#else /* !CONFIG_PARAVIRT */
251static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
252{
253 return __ticket_spin_is_locked(lock);
254}
255
256static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
257{
258 return __ticket_spin_is_contended(lock);
259}
260
261static __always_inline void __raw_spin_lock(raw_spinlock_t *lock)
262{
263 __ticket_spin_lock(lock);
264}
265
266static __always_inline int __raw_spin_trylock(raw_spinlock_t *lock)
267{
268 return __ticket_spin_trylock(lock);
269}
270
271static __always_inline void __raw_spin_unlock(raw_spinlock_t *lock)
272{
273 __ticket_spin_unlock(lock);
274}
275#endif /* CONFIG_PARAVIRT */
276
277static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock)
278{
279 while (__raw_spin_is_locked(lock))
280 cpu_relax();
281}
282
283/*
284 * Read-write spinlocks, allowing multiple readers
285 * but only one writer.
286 *
287 * NOTE! it is quite common to have readers in interrupts
288 * but no interrupt writers. For those circumstances we
289 * can "mix" irq-safe locks - any writer needs to get a
290 * irq-safe write-lock, but readers can get non-irqsafe
291 * read-locks.
292 *
293 * On x86, we implement read-write locks as a 32-bit counter
294 * with the high bit (sign) being the "contended" bit.
295 */
296
297/**
298 * read_can_lock - would read_trylock() succeed?
299 * @lock: the rwlock in question.
300 */
301static inline int __raw_read_can_lock(raw_rwlock_t *lock)
302{
303 return (int)(lock)->lock > 0;
304}
305
306/**
307 * write_can_lock - would write_trylock() succeed?
308 * @lock: the rwlock in question.
309 */
310static inline int __raw_write_can_lock(raw_rwlock_t *lock)
311{
312 return (lock)->lock == RW_LOCK_BIAS;
313}
314
315static inline void __raw_read_lock(raw_rwlock_t *rw)
316{
317 asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t"
318 "jns 1f\n"
319 "call __read_lock_failed\n\t"
320 "1:\n"
321 ::LOCK_PTR_REG (rw) : "memory");
322}
323
324static inline void __raw_write_lock(raw_rwlock_t *rw)
325{
326 asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t"
327 "jz 1f\n"
328 "call __write_lock_failed\n\t"
329 "1:\n"
330 ::LOCK_PTR_REG (rw), "i" (RW_LOCK_BIAS) : "memory");
331}
332
333static inline int __raw_read_trylock(raw_rwlock_t *lock)
334{
335 atomic_t *count = (atomic_t *)lock;
336
337 atomic_dec(count);
338 if (atomic_read(count) >= 0)
339 return 1;
340 atomic_inc(count);
341 return 0;
342}
343
344static inline int __raw_write_trylock(raw_rwlock_t *lock)
345{
346 atomic_t *count = (atomic_t *)lock;
347
348 if (atomic_sub_and_test(RW_LOCK_BIAS, count))
349 return 1;
350 atomic_add(RW_LOCK_BIAS, count);
351 return 0;
352}
353
354static inline void __raw_read_unlock(raw_rwlock_t *rw)
355{
356 asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory");
357}
358
359static inline void __raw_write_unlock(raw_rwlock_t *rw)
360{
361 asm volatile(LOCK_PREFIX "addl %1, %0"
362 : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory");
363}
364
365#define _raw_spin_relax(lock) cpu_relax()
366#define _raw_read_relax(lock) cpu_relax()
367#define _raw_write_relax(lock) cpu_relax()
368
369#endif
diff --git a/include/asm-x86/spinlock_types.h b/include/asm-x86/spinlock_types.h
deleted file mode 100644
index 06c071c9eee9..000000000000
--- a/include/asm-x86/spinlock_types.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef __ASM_SPINLOCK_TYPES_H
2#define __ASM_SPINLOCK_TYPES_H
3
4#ifndef __LINUX_SPINLOCK_TYPES_H
5# error "please don't include this file directly"
6#endif
7
8typedef struct raw_spinlock {
9 unsigned int slock;
10} raw_spinlock_t;
11
12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
13
14typedef struct {
15 unsigned int lock;
16} raw_rwlock_t;
17
18#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
19
20#endif
diff --git a/include/asm-x86/srat.h b/include/asm-x86/srat.h
deleted file mode 100644
index 774c919dc232..000000000000
--- a/include/asm-x86/srat.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Some of the code in this file has been gleaned from the 64 bit
3 * discontigmem support code base.
4 *
5 * Copyright (C) 2002, IBM Corp.
6 *
7 * All rights reserved.
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, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
17 * NON INFRINGEMENT. See the GNU General Public License for more
18 * 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 * Send feedback to Pat Gaughen <gone@us.ibm.com>
25 */
26
27#ifndef _ASM_SRAT_H_
28#define _ASM_SRAT_H_
29
30#ifdef CONFIG_ACPI_NUMA
31extern int get_memcfg_from_srat(void);
32#else
33static inline int get_memcfg_from_srat(void)
34{
35 return 0;
36}
37#endif
38
39#endif /* _ASM_SRAT_H_ */
diff --git a/include/asm-x86/stacktrace.h b/include/asm-x86/stacktrace.h
deleted file mode 100644
index 30f82526a8e2..000000000000
--- a/include/asm-x86/stacktrace.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef _ASM_STACKTRACE_H
2#define _ASM_STACKTRACE_H 1
3
4extern int kstack_depth_to_print;
5
6/* Generic stack tracer with callbacks */
7
8struct stacktrace_ops {
9 void (*warning)(void *data, char *msg);
10 /* msg must contain %s for the symbol */
11 void (*warning_symbol)(void *data, char *msg, unsigned long symbol);
12 void (*address)(void *data, unsigned long address, int reliable);
13 /* On negative return stop dumping */
14 int (*stack)(void *data, char *name);
15};
16
17void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
18 unsigned long *stack, unsigned long bp,
19 const struct stacktrace_ops *ops, void *data);
20
21#endif
diff --git a/include/asm-x86/stat.h b/include/asm-x86/stat.h
deleted file mode 100644
index 5c22dcb5d17e..000000000000
--- a/include/asm-x86/stat.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _ASM_X86_STAT_H
2#define _ASM_X86_STAT_H
3
4#define STAT_HAVE_NSEC 1
5
6#ifdef __i386__
7struct stat {
8 unsigned long st_dev;
9 unsigned long st_ino;
10 unsigned short st_mode;
11 unsigned short st_nlink;
12 unsigned short st_uid;
13 unsigned short st_gid;
14 unsigned long st_rdev;
15 unsigned long st_size;
16 unsigned long st_blksize;
17 unsigned long st_blocks;
18 unsigned long st_atime;
19 unsigned long st_atime_nsec;
20 unsigned long st_mtime;
21 unsigned long st_mtime_nsec;
22 unsigned long st_ctime;
23 unsigned long st_ctime_nsec;
24 unsigned long __unused4;
25 unsigned long __unused5;
26};
27
28#define STAT64_HAS_BROKEN_ST_INO 1
29
30/* This matches struct stat64 in glibc2.1, hence the absolutely
31 * insane amounts of padding around dev_t's.
32 */
33struct stat64 {
34 unsigned long long st_dev;
35 unsigned char __pad0[4];
36
37 unsigned long __st_ino;
38
39 unsigned int st_mode;
40 unsigned int st_nlink;
41
42 unsigned long st_uid;
43 unsigned long st_gid;
44
45 unsigned long long st_rdev;
46 unsigned char __pad3[4];
47
48 long long st_size;
49 unsigned long st_blksize;
50
51 /* Number 512-byte blocks allocated. */
52 unsigned long long st_blocks;
53
54 unsigned long st_atime;
55 unsigned long st_atime_nsec;
56
57 unsigned long st_mtime;
58 unsigned int st_mtime_nsec;
59
60 unsigned long st_ctime;
61 unsigned long st_ctime_nsec;
62
63 unsigned long long st_ino;
64};
65
66#else /* __i386__ */
67
68struct stat {
69 unsigned long st_dev;
70 unsigned long st_ino;
71 unsigned long st_nlink;
72
73 unsigned int st_mode;
74 unsigned int st_uid;
75 unsigned int st_gid;
76 unsigned int __pad0;
77 unsigned long st_rdev;
78 long st_size;
79 long st_blksize;
80 long st_blocks; /* Number 512-byte blocks allocated. */
81
82 unsigned long st_atime;
83 unsigned long st_atime_nsec;
84 unsigned long st_mtime;
85 unsigned long st_mtime_nsec;
86 unsigned long st_ctime;
87 unsigned long st_ctime_nsec;
88 long __unused[3];
89};
90#endif
91
92/* for 32bit emulation and 32 bit kernels */
93struct __old_kernel_stat {
94 unsigned short st_dev;
95 unsigned short st_ino;
96 unsigned short st_mode;
97 unsigned short st_nlink;
98 unsigned short st_uid;
99 unsigned short st_gid;
100 unsigned short st_rdev;
101#ifdef __i386__
102 unsigned long st_size;
103 unsigned long st_atime;
104 unsigned long st_mtime;
105 unsigned long st_ctime;
106#else
107 unsigned int st_size;
108 unsigned int st_atime;
109 unsigned int st_mtime;
110 unsigned int st_ctime;
111#endif
112};
113
114#endif
diff --git a/include/asm-x86/statfs.h b/include/asm-x86/statfs.h
deleted file mode 100644
index 7c651aa97252..000000000000
--- a/include/asm-x86/statfs.h
+++ /dev/null
@@ -1,63 +0,0 @@
1#ifndef _ASM_X86_STATFS_H
2#define _ASM_X86_STATFS_H
3
4#ifdef __i386__
5#include <asm-generic/statfs.h>
6#else
7
8#ifndef __KERNEL_STRICT_NAMES
9
10#include <linux/types.h>
11
12typedef __kernel_fsid_t fsid_t;
13
14#endif
15
16/*
17 * This is ugly -- we're already 64-bit clean, so just duplicate the
18 * definitions.
19 */
20struct statfs {
21 long f_type;
22 long f_bsize;
23 long f_blocks;
24 long f_bfree;
25 long f_bavail;
26 long f_files;
27 long f_ffree;
28 __kernel_fsid_t f_fsid;
29 long f_namelen;
30 long f_frsize;
31 long f_spare[5];
32};
33
34struct statfs64 {
35 long f_type;
36 long f_bsize;
37 long f_blocks;
38 long f_bfree;
39 long f_bavail;
40 long f_files;
41 long f_ffree;
42 __kernel_fsid_t f_fsid;
43 long f_namelen;
44 long f_frsize;
45 long f_spare[5];
46};
47
48struct compat_statfs64 {
49 __u32 f_type;
50 __u32 f_bsize;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_bavail;
54 __u64 f_files;
55 __u64 f_ffree;
56 __kernel_fsid_t f_fsid;
57 __u32 f_namelen;
58 __u32 f_frsize;
59 __u32 f_spare[5];
60} __attribute__((packed));
61
62#endif /* !__i386__ */
63#endif
diff --git a/include/asm-x86/string.h b/include/asm-x86/string.h
deleted file mode 100644
index 6dfd6d9373a0..000000000000
--- a/include/asm-x86/string.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "string_32.h"
3#else
4# include "string_64.h"
5#endif
diff --git a/include/asm-x86/string_32.h b/include/asm-x86/string_32.h
deleted file mode 100644
index 193578cd1fd9..000000000000
--- a/include/asm-x86/string_32.h
+++ /dev/null
@@ -1,326 +0,0 @@
1#ifndef _I386_STRING_H_
2#define _I386_STRING_H_
3
4#ifdef __KERNEL__
5
6/* Let gcc decide whether to inline or use the out of line functions */
7
8#define __HAVE_ARCH_STRCPY
9extern char *strcpy(char *dest, const char *src);
10
11#define __HAVE_ARCH_STRNCPY
12extern char *strncpy(char *dest, const char *src, size_t count);
13
14#define __HAVE_ARCH_STRCAT
15extern char *strcat(char *dest, const char *src);
16
17#define __HAVE_ARCH_STRNCAT
18extern char *strncat(char *dest, const char *src, size_t count);
19
20#define __HAVE_ARCH_STRCMP
21extern int strcmp(const char *cs, const char *ct);
22
23#define __HAVE_ARCH_STRNCMP
24extern int strncmp(const char *cs, const char *ct, size_t count);
25
26#define __HAVE_ARCH_STRCHR
27extern char *strchr(const char *s, int c);
28
29#define __HAVE_ARCH_STRLEN
30extern size_t strlen(const char *s);
31
32static __always_inline void *__memcpy(void *to, const void *from, size_t n)
33{
34 int d0, d1, d2;
35 asm volatile("rep ; movsl\n\t"
36 "movl %4,%%ecx\n\t"
37 "andl $3,%%ecx\n\t"
38 "jz 1f\n\t"
39 "rep ; movsb\n\t"
40 "1:"
41 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
42 : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
43 : "memory");
44 return to;
45}
46
47/*
48 * This looks ugly, but the compiler can optimize it totally,
49 * as the count is constant.
50 */
51static __always_inline void *__constant_memcpy(void *to, const void *from,
52 size_t n)
53{
54 long esi, edi;
55 if (!n)
56 return to;
57
58 switch (n) {
59 case 1:
60 *(char *)to = *(char *)from;
61 return to;
62 case 2:
63 *(short *)to = *(short *)from;
64 return to;
65 case 4:
66 *(int *)to = *(int *)from;
67 return to;
68
69 case 3:
70 *(short *)to = *(short *)from;
71 *((char *)to + 2) = *((char *)from + 2);
72 return to;
73 case 5:
74 *(int *)to = *(int *)from;
75 *((char *)to + 4) = *((char *)from + 4);
76 return to;
77 case 6:
78 *(int *)to = *(int *)from;
79 *((short *)to + 2) = *((short *)from + 2);
80 return to;
81 case 8:
82 *(int *)to = *(int *)from;
83 *((int *)to + 1) = *((int *)from + 1);
84 return to;
85 }
86
87 esi = (long)from;
88 edi = (long)to;
89 if (n >= 5 * 4) {
90 /* large block: use rep prefix */
91 int ecx;
92 asm volatile("rep ; movsl"
93 : "=&c" (ecx), "=&D" (edi), "=&S" (esi)
94 : "0" (n / 4), "1" (edi), "2" (esi)
95 : "memory"
96 );
97 } else {
98 /* small block: don't clobber ecx + smaller code */
99 if (n >= 4 * 4)
100 asm volatile("movsl"
101 : "=&D"(edi), "=&S"(esi)
102 : "0"(edi), "1"(esi)
103 : "memory");
104 if (n >= 3 * 4)
105 asm volatile("movsl"
106 : "=&D"(edi), "=&S"(esi)
107 : "0"(edi), "1"(esi)
108 : "memory");
109 if (n >= 2 * 4)
110 asm volatile("movsl"
111 : "=&D"(edi), "=&S"(esi)
112 : "0"(edi), "1"(esi)
113 : "memory");
114 if (n >= 1 * 4)
115 asm volatile("movsl"
116 : "=&D"(edi), "=&S"(esi)
117 : "0"(edi), "1"(esi)
118 : "memory");
119 }
120 switch (n % 4) {
121 /* tail */
122 case 0:
123 return to;
124 case 1:
125 asm volatile("movsb"
126 : "=&D"(edi), "=&S"(esi)
127 : "0"(edi), "1"(esi)
128 : "memory");
129 return to;
130 case 2:
131 asm volatile("movsw"
132 : "=&D"(edi), "=&S"(esi)
133 : "0"(edi), "1"(esi)
134 : "memory");
135 return to;
136 default:
137 asm volatile("movsw\n\tmovsb"
138 : "=&D"(edi), "=&S"(esi)
139 : "0"(edi), "1"(esi)
140 : "memory");
141 return to;
142 }
143}
144
145#define __HAVE_ARCH_MEMCPY
146
147#ifdef CONFIG_X86_USE_3DNOW
148
149#include <asm/mmx.h>
150
151/*
152 * This CPU favours 3DNow strongly (eg AMD Athlon)
153 */
154
155static inline void *__constant_memcpy3d(void *to, const void *from, size_t len)
156{
157 if (len < 512)
158 return __constant_memcpy(to, from, len);
159 return _mmx_memcpy(to, from, len);
160}
161
162static inline void *__memcpy3d(void *to, const void *from, size_t len)
163{
164 if (len < 512)
165 return __memcpy(to, from, len);
166 return _mmx_memcpy(to, from, len);
167}
168
169#define memcpy(t, f, n) \
170 (__builtin_constant_p((n)) \
171 ? __constant_memcpy3d((t), (f), (n)) \
172 : __memcpy3d((t), (f), (n)))
173
174#else
175
176/*
177 * No 3D Now!
178 */
179
180#define memcpy(t, f, n) \
181 (__builtin_constant_p((n)) \
182 ? __constant_memcpy((t), (f), (n)) \
183 : __memcpy((t), (f), (n)))
184
185#endif
186
187#define __HAVE_ARCH_MEMMOVE
188void *memmove(void *dest, const void *src, size_t n);
189
190#define memcmp __builtin_memcmp
191
192#define __HAVE_ARCH_MEMCHR
193extern void *memchr(const void *cs, int c, size_t count);
194
195static inline void *__memset_generic(void *s, char c, size_t count)
196{
197 int d0, d1;
198 asm volatile("rep\n\t"
199 "stosb"
200 : "=&c" (d0), "=&D" (d1)
201 : "a" (c), "1" (s), "0" (count)
202 : "memory");
203 return s;
204}
205
206/* we might want to write optimized versions of these later */
207#define __constant_count_memset(s, c, count) __memset_generic((s), (c), (count))
208
209/*
210 * memset(x, 0, y) is a reasonably common thing to do, so we want to fill
211 * things 32 bits at a time even when we don't know the size of the
212 * area at compile-time..
213 */
214static __always_inline
215void *__constant_c_memset(void *s, unsigned long c, size_t count)
216{
217 int d0, d1;
218 asm volatile("rep ; stosl\n\t"
219 "testb $2,%b3\n\t"
220 "je 1f\n\t"
221 "stosw\n"
222 "1:\ttestb $1,%b3\n\t"
223 "je 2f\n\t"
224 "stosb\n"
225 "2:"
226 : "=&c" (d0), "=&D" (d1)
227 : "a" (c), "q" (count), "0" (count/4), "1" ((long)s)
228 : "memory");
229 return s;
230}
231
232/* Added by Gertjan van Wingerde to make minix and sysv module work */
233#define __HAVE_ARCH_STRNLEN
234extern size_t strnlen(const char *s, size_t count);
235/* end of additional stuff */
236
237#define __HAVE_ARCH_STRSTR
238extern char *strstr(const char *cs, const char *ct);
239
240/*
241 * This looks horribly ugly, but the compiler can optimize it totally,
242 * as we by now know that both pattern and count is constant..
243 */
244static __always_inline
245void *__constant_c_and_count_memset(void *s, unsigned long pattern,
246 size_t count)
247{
248 switch (count) {
249 case 0:
250 return s;
251 case 1:
252 *(unsigned char *)s = pattern & 0xff;
253 return s;
254 case 2:
255 *(unsigned short *)s = pattern & 0xffff;
256 return s;
257 case 3:
258 *(unsigned short *)s = pattern & 0xffff;
259 *((unsigned char *)s + 2) = pattern & 0xff;
260 return s;
261 case 4:
262 *(unsigned long *)s = pattern;
263 return s;
264 }
265
266#define COMMON(x) \
267 asm volatile("rep ; stosl" \
268 x \
269 : "=&c" (d0), "=&D" (d1) \
270 : "a" (eax), "0" (count/4), "1" ((long)s) \
271 : "memory")
272
273 {
274 int d0, d1;
275#if __GNUC__ == 4 && __GNUC_MINOR__ == 0
276 /* Workaround for broken gcc 4.0 */
277 register unsigned long eax asm("%eax") = pattern;
278#else
279 unsigned long eax = pattern;
280#endif
281
282 switch (count % 4) {
283 case 0:
284 COMMON("");
285 return s;
286 case 1:
287 COMMON("\n\tstosb");
288 return s;
289 case 2:
290 COMMON("\n\tstosw");
291 return s;
292 default:
293 COMMON("\n\tstosw\n\tstosb");
294 return s;
295 }
296 }
297
298#undef COMMON
299}
300
301#define __constant_c_x_memset(s, c, count) \
302 (__builtin_constant_p(count) \
303 ? __constant_c_and_count_memset((s), (c), (count)) \
304 : __constant_c_memset((s), (c), (count)))
305
306#define __memset(s, c, count) \
307 (__builtin_constant_p(count) \
308 ? __constant_count_memset((s), (c), (count)) \
309 : __memset_generic((s), (c), (count)))
310
311#define __HAVE_ARCH_MEMSET
312#define memset(s, c, count) \
313 (__builtin_constant_p(c) \
314 ? __constant_c_x_memset((s), (0x01010101UL * (unsigned char)(c)), \
315 (count)) \
316 : __memset((s), (c), (count)))
317
318/*
319 * find the first occurrence of byte 'c', or 1 past the area if none
320 */
321#define __HAVE_ARCH_MEMSCAN
322extern void *memscan(void *addr, int c, size_t size);
323
324#endif /* __KERNEL__ */
325
326#endif
diff --git a/include/asm-x86/string_64.h b/include/asm-x86/string_64.h
deleted file mode 100644
index 52b5ab383395..000000000000
--- a/include/asm-x86/string_64.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _X86_64_STRING_H_
2#define _X86_64_STRING_H_
3
4#ifdef __KERNEL__
5
6/* Written 2002 by Andi Kleen */
7
8/* Only used for special circumstances. Stolen from i386/string.h */
9static __always_inline void *__inline_memcpy(void *to, const void *from, size_t n)
10{
11 unsigned long d0, d1, d2;
12 asm volatile("rep ; movsl\n\t"
13 "testb $2,%b4\n\t"
14 "je 1f\n\t"
15 "movsw\n"
16 "1:\ttestb $1,%b4\n\t"
17 "je 2f\n\t"
18 "movsb\n"
19 "2:"
20 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
21 : "0" (n / 4), "q" (n), "1" ((long)to), "2" ((long)from)
22 : "memory");
23 return to;
24}
25
26/* Even with __builtin_ the compiler may decide to use the out of line
27 function. */
28
29#define __HAVE_ARCH_MEMCPY 1
30#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
31extern void *memcpy(void *to, const void *from, size_t len);
32#else
33extern void *__memcpy(void *to, const void *from, size_t len);
34#define memcpy(dst, src, len) \
35({ \
36 size_t __len = (len); \
37 void *__ret; \
38 if (__builtin_constant_p(len) && __len >= 64) \
39 __ret = __memcpy((dst), (src), __len); \
40 else \
41 __ret = __builtin_memcpy((dst), (src), __len); \
42 __ret; \
43})
44#endif
45
46#define __HAVE_ARCH_MEMSET
47void *memset(void *s, int c, size_t n);
48
49#define __HAVE_ARCH_MEMMOVE
50void *memmove(void *dest, const void *src, size_t count);
51
52int memcmp(const void *cs, const void *ct, size_t count);
53size_t strlen(const char *s);
54char *strcpy(char *dest, const char *src);
55char *strcat(char *dest, const char *src);
56int strcmp(const char *cs, const char *ct);
57
58#endif /* __KERNEL__ */
59
60#endif
diff --git a/include/asm-x86/suspend.h b/include/asm-x86/suspend.h
deleted file mode 100644
index 9bd521fe4570..000000000000
--- a/include/asm-x86/suspend.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "suspend_32.h"
3#else
4# include "suspend_64.h"
5#endif
diff --git a/include/asm-x86/suspend_32.h b/include/asm-x86/suspend_32.h
deleted file mode 100644
index 8675c6782a7d..000000000000
--- a/include/asm-x86/suspend_32.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright 2001-2002 Pavel Machek <pavel@suse.cz>
3 * Based on code
4 * Copyright 2001 Patrick Mochel <mochel@osdl.org>
5 */
6#ifndef __ASM_X86_32_SUSPEND_H
7#define __ASM_X86_32_SUSPEND_H
8
9#include <asm/desc.h>
10#include <asm/i387.h>
11
12static inline int arch_prepare_suspend(void) { return 0; }
13
14/* image of the saved processor state */
15struct saved_context {
16 u16 es, fs, gs, ss;
17 unsigned long cr0, cr2, cr3, cr4;
18 struct desc_ptr gdt;
19 struct desc_ptr idt;
20 u16 ldt;
21 u16 tss;
22 unsigned long tr;
23 unsigned long safety;
24 unsigned long return_address;
25} __attribute__((packed));
26
27#ifdef CONFIG_ACPI
28extern unsigned long saved_eip;
29extern unsigned long saved_esp;
30extern unsigned long saved_ebp;
31extern unsigned long saved_ebx;
32extern unsigned long saved_esi;
33extern unsigned long saved_edi;
34
35static inline void acpi_save_register_state(unsigned long return_point)
36{
37 saved_eip = return_point;
38 asm volatile("movl %%esp,%0" : "=m" (saved_esp));
39 asm volatile("movl %%ebp,%0" : "=m" (saved_ebp));
40 asm volatile("movl %%ebx,%0" : "=m" (saved_ebx));
41 asm volatile("movl %%edi,%0" : "=m" (saved_edi));
42 asm volatile("movl %%esi,%0" : "=m" (saved_esi));
43}
44
45#define acpi_restore_register_state() do {} while (0)
46
47/* routines for saving/restoring kernel state */
48extern int acpi_save_state_mem(void);
49#endif
50
51#endif /* __ASM_X86_32_SUSPEND_H */
diff --git a/include/asm-x86/suspend_64.h b/include/asm-x86/suspend_64.h
deleted file mode 100644
index dc3262b43072..000000000000
--- a/include/asm-x86/suspend_64.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright 2001-2003 Pavel Machek <pavel@suse.cz>
3 * Based on code
4 * Copyright 2001 Patrick Mochel <mochel@osdl.org>
5 */
6#ifndef __ASM_X86_64_SUSPEND_H
7#define __ASM_X86_64_SUSPEND_H
8
9#include <asm/desc.h>
10#include <asm/i387.h>
11
12static inline int arch_prepare_suspend(void)
13{
14 return 0;
15}
16
17/*
18 * Image of the saved processor state, used by the low level ACPI suspend to
19 * RAM code and by the low level hibernation code.
20 *
21 * If you modify it, fix arch/x86/kernel/acpi/wakeup_64.S and make sure that
22 * __save/__restore_processor_state(), defined in arch/x86/kernel/suspend_64.c,
23 * still work as required.
24 */
25struct saved_context {
26 struct pt_regs regs;
27 u16 ds, es, fs, gs, ss;
28 unsigned long gs_base, gs_kernel_base, fs_base;
29 unsigned long cr0, cr2, cr3, cr4, cr8;
30 unsigned long efer;
31 u16 gdt_pad;
32 u16 gdt_limit;
33 unsigned long gdt_base;
34 u16 idt_pad;
35 u16 idt_limit;
36 unsigned long idt_base;
37 u16 ldt;
38 u16 tss;
39 unsigned long tr;
40 unsigned long safety;
41 unsigned long return_address;
42} __attribute__((packed));
43
44#define loaddebug(thread,register) \
45 set_debugreg((thread)->debugreg##register, register)
46
47/* routines for saving/restoring kernel state */
48extern int acpi_save_state_mem(void);
49extern char core_restore_code;
50extern char restore_registers;
51
52#endif /* __ASM_X86_64_SUSPEND_H */
diff --git a/include/asm-x86/swiotlb.h b/include/asm-x86/swiotlb.h
deleted file mode 100644
index 2730b351afcf..000000000000
--- a/include/asm-x86/swiotlb.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _ASM_SWIOTLB_H
2#define _ASM_SWIOTLB_H 1
3
4#include <asm/dma-mapping.h>
5
6/* SWIOTLB interface */
7
8extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
9 size_t size, int dir);
10extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
11 dma_addr_t *dma_handle, gfp_t flags);
12extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
13 size_t size, int dir);
14extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
15 dma_addr_t dev_addr,
16 size_t size, int dir);
17extern void swiotlb_sync_single_for_device(struct device *hwdev,
18 dma_addr_t dev_addr,
19 size_t size, int dir);
20extern void swiotlb_sync_single_range_for_cpu(struct device *hwdev,
21 dma_addr_t dev_addr,
22 unsigned long offset,
23 size_t size, int dir);
24extern void swiotlb_sync_single_range_for_device(struct device *hwdev,
25 dma_addr_t dev_addr,
26 unsigned long offset,
27 size_t size, int dir);
28extern void swiotlb_sync_sg_for_cpu(struct device *hwdev,
29 struct scatterlist *sg, int nelems,
30 int dir);
31extern void swiotlb_sync_sg_for_device(struct device *hwdev,
32 struct scatterlist *sg, int nelems,
33 int dir);
34extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
39extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle);
41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
42extern void swiotlb_init(void);
43
44extern int swiotlb_force;
45
46#ifdef CONFIG_SWIOTLB
47extern int swiotlb;
48extern void pci_swiotlb_init(void);
49#else
50#define swiotlb 0
51static inline void pci_swiotlb_init(void)
52{
53}
54#endif
55
56static inline void dma_mark_clean(void *addr, size_t size) {}
57
58#endif /* _ASM_SWIOTLB_H */
diff --git a/include/asm-x86/sync_bitops.h b/include/asm-x86/sync_bitops.h
deleted file mode 100644
index b47a1d0b8a83..000000000000
--- a/include/asm-x86/sync_bitops.h
+++ /dev/null
@@ -1,130 +0,0 @@
1#ifndef _I386_SYNC_BITOPS_H
2#define _I386_SYNC_BITOPS_H
3
4/*
5 * Copyright 1992, Linus Torvalds.
6 */
7
8/*
9 * These have to be done with inline assembly: that way the bit-setting
10 * is guaranteed to be atomic. All bit operations return 0 if the bit
11 * was cleared before the operation and != 0 if it was not.
12 *
13 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
14 */
15
16#define ADDR (*(volatile long *)addr)
17
18/**
19 * sync_set_bit - Atomically set a bit in memory
20 * @nr: the bit to set
21 * @addr: the address to start counting from
22 *
23 * This function is atomic and may not be reordered. See __set_bit()
24 * if you do not require the atomic guarantees.
25 *
26 * Note that @nr may be almost arbitrarily large; this function is not
27 * restricted to acting on a single-word quantity.
28 */
29static inline void sync_set_bit(int nr, volatile unsigned long *addr)
30{
31 asm volatile("lock; btsl %1,%0"
32 : "+m" (ADDR)
33 : "Ir" (nr)
34 : "memory");
35}
36
37/**
38 * sync_clear_bit - Clears a bit in memory
39 * @nr: Bit to clear
40 * @addr: Address to start counting from
41 *
42 * sync_clear_bit() is atomic and may not be reordered. However, it does
43 * not contain a memory barrier, so if it is used for locking purposes,
44 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
45 * in order to ensure changes are visible on other processors.
46 */
47static inline void sync_clear_bit(int nr, volatile unsigned long *addr)
48{
49 asm volatile("lock; btrl %1,%0"
50 : "+m" (ADDR)
51 : "Ir" (nr)
52 : "memory");
53}
54
55/**
56 * sync_change_bit - Toggle a bit in memory
57 * @nr: Bit to change
58 * @addr: Address to start counting from
59 *
60 * sync_change_bit() is atomic and may not be reordered.
61 * Note that @nr may be almost arbitrarily large; this function is not
62 * restricted to acting on a single-word quantity.
63 */
64static inline void sync_change_bit(int nr, volatile unsigned long *addr)
65{
66 asm volatile("lock; btcl %1,%0"
67 : "+m" (ADDR)
68 : "Ir" (nr)
69 : "memory");
70}
71
72/**
73 * sync_test_and_set_bit - Set a bit and return its old value
74 * @nr: Bit to set
75 * @addr: Address to count from
76 *
77 * This operation is atomic and cannot be reordered.
78 * It also implies a memory barrier.
79 */
80static inline int sync_test_and_set_bit(int nr, volatile unsigned long *addr)
81{
82 int oldbit;
83
84 asm volatile("lock; btsl %2,%1\n\tsbbl %0,%0"
85 : "=r" (oldbit), "+m" (ADDR)
86 : "Ir" (nr) : "memory");
87 return oldbit;
88}
89
90/**
91 * sync_test_and_clear_bit - Clear a bit and return its old value
92 * @nr: Bit to clear
93 * @addr: Address to count from
94 *
95 * This operation is atomic and cannot be reordered.
96 * It also implies a memory barrier.
97 */
98static inline int sync_test_and_clear_bit(int nr, volatile unsigned long *addr)
99{
100 int oldbit;
101
102 asm volatile("lock; btrl %2,%1\n\tsbbl %0,%0"
103 : "=r" (oldbit), "+m" (ADDR)
104 : "Ir" (nr) : "memory");
105 return oldbit;
106}
107
108/**
109 * sync_test_and_change_bit - Change a bit and return its old value
110 * @nr: Bit to change
111 * @addr: Address to count from
112 *
113 * This operation is atomic and cannot be reordered.
114 * It also implies a memory barrier.
115 */
116static inline int sync_test_and_change_bit(int nr, volatile unsigned long *addr)
117{
118 int oldbit;
119
120 asm volatile("lock; btcl %2,%1\n\tsbbl %0,%0"
121 : "=r" (oldbit), "+m" (ADDR)
122 : "Ir" (nr) : "memory");
123 return oldbit;
124}
125
126#define sync_test_bit(nr, addr) test_bit(nr, addr)
127
128#undef ADDR
129
130#endif /* _I386_SYNC_BITOPS_H */
diff --git a/include/asm-x86/system.h b/include/asm-x86/system.h
deleted file mode 100644
index 983ce37c491f..000000000000
--- a/include/asm-x86/system.h
+++ /dev/null
@@ -1,422 +0,0 @@
1#ifndef _ASM_X86_SYSTEM_H_
2#define _ASM_X86_SYSTEM_H_
3
4#include <asm/asm.h>
5#include <asm/segment.h>
6#include <asm/cpufeature.h>
7#include <asm/cmpxchg.h>
8#include <asm/nops.h>
9
10#include <linux/kernel.h>
11#include <linux/irqflags.h>
12
13/* entries in ARCH_DLINFO: */
14#ifdef CONFIG_IA32_EMULATION
15# define AT_VECTOR_SIZE_ARCH 2
16#else
17# define AT_VECTOR_SIZE_ARCH 1
18#endif
19
20#ifdef CONFIG_X86_32
21
22struct task_struct; /* one of the stranger aspects of C forward declarations */
23struct task_struct *__switch_to(struct task_struct *prev,
24 struct task_struct *next);
25
26/*
27 * Saving eflags is important. It switches not only IOPL between tasks,
28 * it also protects other tasks from NT leaking through sysenter etc.
29 */
30#define switch_to(prev, next, last) \
31do { \
32 /* \
33 * Context-switching clobbers all registers, so we clobber \
34 * them explicitly, via unused output variables. \
35 * (EAX and EBP is not listed because EBP is saved/restored \
36 * explicitly for wchan access and EAX is the return value of \
37 * __switch_to()) \
38 */ \
39 unsigned long ebx, ecx, edx, esi, edi; \
40 \
41 asm volatile("pushfl\n\t" /* save flags */ \
42 "pushl %%ebp\n\t" /* save EBP */ \
43 "movl %%esp,%[prev_sp]\n\t" /* save ESP */ \
44 "movl %[next_sp],%%esp\n\t" /* restore ESP */ \
45 "movl $1f,%[prev_ip]\n\t" /* save EIP */ \
46 "pushl %[next_ip]\n\t" /* restore EIP */ \
47 "jmp __switch_to\n" /* regparm call */ \
48 "1:\t" \
49 "popl %%ebp\n\t" /* restore EBP */ \
50 "popfl\n" /* restore flags */ \
51 \
52 /* output parameters */ \
53 : [prev_sp] "=m" (prev->thread.sp), \
54 [prev_ip] "=m" (prev->thread.ip), \
55 "=a" (last), \
56 \
57 /* clobbered output registers: */ \
58 "=b" (ebx), "=c" (ecx), "=d" (edx), \
59 "=S" (esi), "=D" (edi) \
60 \
61 /* input parameters: */ \
62 : [next_sp] "m" (next->thread.sp), \
63 [next_ip] "m" (next->thread.ip), \
64 \
65 /* regparm parameters for __switch_to(): */ \
66 [prev] "a" (prev), \
67 [next] "d" (next)); \
68} while (0)
69
70/*
71 * disable hlt during certain critical i/o operations
72 */
73#define HAVE_DISABLE_HLT
74#else
75#define __SAVE(reg, offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
76#define __RESTORE(reg, offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
77
78/* frame pointer must be last for get_wchan */
79#define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
80#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t"
81
82#define __EXTRA_CLOBBER \
83 , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \
84 "r12", "r13", "r14", "r15"
85
86/* Save restore flags to clear handle leaking NT */
87#define switch_to(prev, next, last) \
88 asm volatile(SAVE_CONTEXT \
89 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
90 "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */ \
91 "call __switch_to\n\t" \
92 ".globl thread_return\n" \
93 "thread_return:\n\t" \
94 "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \
95 "movq %P[thread_info](%%rsi),%%r8\n\t" \
96 LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \
97 "movq %%rax,%%rdi\n\t" \
98 "jc ret_from_fork\n\t" \
99 RESTORE_CONTEXT \
100 : "=a" (last) \
101 : [next] "S" (next), [prev] "D" (prev), \
102 [threadrsp] "i" (offsetof(struct task_struct, thread.sp)), \
103 [ti_flags] "i" (offsetof(struct thread_info, flags)), \
104 [tif_fork] "i" (TIF_FORK), \
105 [thread_info] "i" (offsetof(struct task_struct, stack)), \
106 [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \
107 : "memory", "cc" __EXTRA_CLOBBER)
108#endif
109
110#ifdef __KERNEL__
111#define _set_base(addr, base) do { unsigned long __pr; \
112__asm__ __volatile__ ("movw %%dx,%1\n\t" \
113 "rorl $16,%%edx\n\t" \
114 "movb %%dl,%2\n\t" \
115 "movb %%dh,%3" \
116 :"=&d" (__pr) \
117 :"m" (*((addr)+2)), \
118 "m" (*((addr)+4)), \
119 "m" (*((addr)+7)), \
120 "0" (base) \
121 ); } while (0)
122
123#define _set_limit(addr, limit) do { unsigned long __lr; \
124__asm__ __volatile__ ("movw %%dx,%1\n\t" \
125 "rorl $16,%%edx\n\t" \
126 "movb %2,%%dh\n\t" \
127 "andb $0xf0,%%dh\n\t" \
128 "orb %%dh,%%dl\n\t" \
129 "movb %%dl,%2" \
130 :"=&d" (__lr) \
131 :"m" (*(addr)), \
132 "m" (*((addr)+6)), \
133 "0" (limit) \
134 ); } while (0)
135
136#define set_base(ldt, base) _set_base(((char *)&(ldt)) , (base))
137#define set_limit(ldt, limit) _set_limit(((char *)&(ldt)) , ((limit)-1))
138
139extern void native_load_gs_index(unsigned);
140
141/*
142 * Load a segment. Fall back on loading the zero
143 * segment if something goes wrong..
144 */
145#define loadsegment(seg, value) \
146 asm volatile("\n" \
147 "1:\t" \
148 "movl %k0,%%" #seg "\n" \
149 "2:\n" \
150 ".section .fixup,\"ax\"\n" \
151 "3:\t" \
152 "movl %k1, %%" #seg "\n\t" \
153 "jmp 2b\n" \
154 ".previous\n" \
155 _ASM_EXTABLE(1b,3b) \
156 : :"r" (value), "r" (0) : "memory")
157
158
159/*
160 * Save a segment register away
161 */
162#define savesegment(seg, value) \
163 asm("mov %%" #seg ",%0":"=r" (value) : : "memory")
164
165static inline unsigned long get_limit(unsigned long segment)
166{
167 unsigned long __limit;
168 asm("lsll %1,%0" : "=r" (__limit) : "r" (segment));
169 return __limit + 1;
170}
171
172static inline void native_clts(void)
173{
174 asm volatile("clts");
175}
176
177/*
178 * Volatile isn't enough to prevent the compiler from reordering the
179 * read/write functions for the control registers and messing everything up.
180 * A memory clobber would solve the problem, but would prevent reordering of
181 * all loads stores around it, which can hurt performance. Solution is to
182 * use a variable and mimic reads and writes to it to enforce serialization
183 */
184static unsigned long __force_order;
185
186static inline unsigned long native_read_cr0(void)
187{
188 unsigned long val;
189 asm volatile("mov %%cr0,%0\n\t" : "=r" (val), "=m" (__force_order));
190 return val;
191}
192
193static inline void native_write_cr0(unsigned long val)
194{
195 asm volatile("mov %0,%%cr0": : "r" (val), "m" (__force_order));
196}
197
198static inline unsigned long native_read_cr2(void)
199{
200 unsigned long val;
201 asm volatile("mov %%cr2,%0\n\t" : "=r" (val), "=m" (__force_order));
202 return val;
203}
204
205static inline void native_write_cr2(unsigned long val)
206{
207 asm volatile("mov %0,%%cr2": : "r" (val), "m" (__force_order));
208}
209
210static inline unsigned long native_read_cr3(void)
211{
212 unsigned long val;
213 asm volatile("mov %%cr3,%0\n\t" : "=r" (val), "=m" (__force_order));
214 return val;
215}
216
217static inline void native_write_cr3(unsigned long val)
218{
219 asm volatile("mov %0,%%cr3": : "r" (val), "m" (__force_order));
220}
221
222static inline unsigned long native_read_cr4(void)
223{
224 unsigned long val;
225 asm volatile("mov %%cr4,%0\n\t" : "=r" (val), "=m" (__force_order));
226 return val;
227}
228
229static inline unsigned long native_read_cr4_safe(void)
230{
231 unsigned long val;
232 /* This could fault if %cr4 does not exist. In x86_64, a cr4 always
233 * exists, so it will never fail. */
234#ifdef CONFIG_X86_32
235 asm volatile("1: mov %%cr4, %0\n"
236 "2:\n"
237 _ASM_EXTABLE(1b, 2b)
238 : "=r" (val), "=m" (__force_order) : "0" (0));
239#else
240 val = native_read_cr4();
241#endif
242 return val;
243}
244
245static inline void native_write_cr4(unsigned long val)
246{
247 asm volatile("mov %0,%%cr4": : "r" (val), "m" (__force_order));
248}
249
250#ifdef CONFIG_X86_64
251static inline unsigned long native_read_cr8(void)
252{
253 unsigned long cr8;
254 asm volatile("movq %%cr8,%0" : "=r" (cr8));
255 return cr8;
256}
257
258static inline void native_write_cr8(unsigned long val)
259{
260 asm volatile("movq %0,%%cr8" :: "r" (val) : "memory");
261}
262#endif
263
264static inline void native_wbinvd(void)
265{
266 asm volatile("wbinvd": : :"memory");
267}
268
269#ifdef CONFIG_PARAVIRT
270#include <asm/paravirt.h>
271#else
272#define read_cr0() (native_read_cr0())
273#define write_cr0(x) (native_write_cr0(x))
274#define read_cr2() (native_read_cr2())
275#define write_cr2(x) (native_write_cr2(x))
276#define read_cr3() (native_read_cr3())
277#define write_cr3(x) (native_write_cr3(x))
278#define read_cr4() (native_read_cr4())
279#define read_cr4_safe() (native_read_cr4_safe())
280#define write_cr4(x) (native_write_cr4(x))
281#define wbinvd() (native_wbinvd())
282#ifdef CONFIG_X86_64
283#define read_cr8() (native_read_cr8())
284#define write_cr8(x) (native_write_cr8(x))
285#define load_gs_index native_load_gs_index
286#endif
287
288/* Clear the 'TS' bit */
289#define clts() (native_clts())
290
291#endif/* CONFIG_PARAVIRT */
292
293#define stts() write_cr0(read_cr0() | X86_CR0_TS)
294
295#endif /* __KERNEL__ */
296
297static inline void clflush(volatile void *__p)
298{
299 asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
300}
301
302#define nop() asm volatile ("nop")
303
304void disable_hlt(void);
305void enable_hlt(void);
306
307void cpu_idle_wait(void);
308
309extern unsigned long arch_align_stack(unsigned long sp);
310extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
311
312void default_idle(void);
313
314/*
315 * Force strict CPU ordering.
316 * And yes, this is required on UP too when we're talking
317 * to devices.
318 */
319#ifdef CONFIG_X86_32
320/*
321 * Some non-Intel clones support out of order store. wmb() ceases to be a
322 * nop for these.
323 */
324#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
325#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
326#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
327#else
328#define mb() asm volatile("mfence":::"memory")
329#define rmb() asm volatile("lfence":::"memory")
330#define wmb() asm volatile("sfence" ::: "memory")
331#endif
332
333/**
334 * read_barrier_depends - Flush all pending reads that subsequents reads
335 * depend on.
336 *
337 * No data-dependent reads from memory-like regions are ever reordered
338 * over this barrier. All reads preceding this primitive are guaranteed
339 * to access memory (but not necessarily other CPUs' caches) before any
340 * reads following this primitive that depend on the data return by
341 * any of the preceding reads. This primitive is much lighter weight than
342 * rmb() on most CPUs, and is never heavier weight than is
343 * rmb().
344 *
345 * These ordering constraints are respected by both the local CPU
346 * and the compiler.
347 *
348 * Ordering is not guaranteed by anything other than these primitives,
349 * not even by data dependencies. See the documentation for
350 * memory_barrier() for examples and URLs to more information.
351 *
352 * For example, the following code would force ordering (the initial
353 * value of "a" is zero, "b" is one, and "p" is "&a"):
354 *
355 * <programlisting>
356 * CPU 0 CPU 1
357 *
358 * b = 2;
359 * memory_barrier();
360 * p = &b; q = p;
361 * read_barrier_depends();
362 * d = *q;
363 * </programlisting>
364 *
365 * because the read of "*q" depends on the read of "p" and these
366 * two reads are separated by a read_barrier_depends(). However,
367 * the following code, with the same initial values for "a" and "b":
368 *
369 * <programlisting>
370 * CPU 0 CPU 1
371 *
372 * a = 2;
373 * memory_barrier();
374 * b = 3; y = b;
375 * read_barrier_depends();
376 * x = a;
377 * </programlisting>
378 *
379 * does not enforce ordering, since there is no data dependency between
380 * the read of "a" and the read of "b". Therefore, on some CPUs, such
381 * as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
382 * in cases like this where there are no data dependencies.
383 **/
384
385#define read_barrier_depends() do { } while (0)
386
387#ifdef CONFIG_SMP
388#define smp_mb() mb()
389#ifdef CONFIG_X86_PPRO_FENCE
390# define smp_rmb() rmb()
391#else
392# define smp_rmb() barrier()
393#endif
394#ifdef CONFIG_X86_OOSTORE
395# define smp_wmb() wmb()
396#else
397# define smp_wmb() barrier()
398#endif
399#define smp_read_barrier_depends() read_barrier_depends()
400#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
401#else
402#define smp_mb() barrier()
403#define smp_rmb() barrier()
404#define smp_wmb() barrier()
405#define smp_read_barrier_depends() do { } while (0)
406#define set_mb(var, value) do { var = value; barrier(); } while (0)
407#endif
408
409/*
410 * Stop RDTSC speculation. This is needed when you need to use RDTSC
411 * (or get_cycles or vread that possibly accesses the TSC) in a defined
412 * code region.
413 *
414 * (Could use an alternative three way for this if there was one.)
415 */
416static inline void rdtsc_barrier(void)
417{
418 alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
419 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
420}
421
422#endif
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h
deleted file mode 100644
index 97fa251ccb2b..000000000000
--- a/include/asm-x86/system_64.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef __ASM_SYSTEM_H
2#define __ASM_SYSTEM_H
3
4#include <asm/segment.h>
5#include <asm/cmpxchg.h>
6
7
8static inline unsigned long read_cr8(void)
9{
10 unsigned long cr8;
11 asm volatile("movq %%cr8,%0" : "=r" (cr8));
12 return cr8;
13}
14
15static inline void write_cr8(unsigned long val)
16{
17 asm volatile("movq %0,%%cr8" :: "r" (val) : "memory");
18}
19
20#include <linux/irqflags.h>
21
22#endif
diff --git a/include/asm-x86/tce.h b/include/asm-x86/tce.h
deleted file mode 100644
index b1a4ea00df78..000000000000
--- a/include/asm-x86/tce.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * This file is derived from asm-powerpc/tce.h.
3 *
4 * Copyright (C) IBM Corporation, 2006
5 *
6 * Author: Muli Ben-Yehuda <muli@il.ibm.com>
7 * Author: Jon Mason <jdmason@us.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _ASM_X86_64_TCE_H
25#define _ASM_X86_64_TCE_H
26
27extern unsigned int specified_table_size;
28struct iommu_table;
29
30#define TCE_ENTRY_SIZE 8 /* in bytes */
31
32#define TCE_READ_SHIFT 0
33#define TCE_WRITE_SHIFT 1
34#define TCE_HUBID_SHIFT 2 /* unused */
35#define TCE_RSVD_SHIFT 8 /* unused */
36#define TCE_RPN_SHIFT 12
37#define TCE_UNUSED_SHIFT 48 /* unused */
38
39#define TCE_RPN_MASK 0x0000fffffffff000ULL
40
41extern void tce_build(struct iommu_table *tbl, unsigned long index,
42 unsigned int npages, unsigned long uaddr, int direction);
43extern void tce_free(struct iommu_table *tbl, long index, unsigned int npages);
44extern void * __init alloc_tce_table(void);
45extern void __init free_tce_table(void *tbl);
46extern int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar);
47
48#endif /* _ASM_X86_64_TCE_H */
diff --git a/include/asm-x86/termbits.h b/include/asm-x86/termbits.h
deleted file mode 100644
index af1b70ea440f..000000000000
--- a/include/asm-x86/termbits.h
+++ /dev/null
@@ -1,198 +0,0 @@
1#ifndef _ASM_X86_TERMBITS_H
2#define _ASM_X86_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000 /* non standard rate */
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */
162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
165/* c_lflag bits */
166#define ISIG 0000001
167#define ICANON 0000002
168#define XCASE 0000004
169#define ECHO 0000010
170#define ECHOE 0000020
171#define ECHOK 0000040
172#define ECHONL 0000100
173#define NOFLSH 0000200
174#define TOSTOP 0000400
175#define ECHOCTL 0001000
176#define ECHOPRT 0002000
177#define ECHOKE 0004000
178#define FLUSHO 0010000
179#define PENDIN 0040000
180#define IEXTEN 0100000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* _ASM_X86_TERMBITS_H */
diff --git a/include/asm-x86/termios.h b/include/asm-x86/termios.h
deleted file mode 100644
index f72956331c49..000000000000
--- a/include/asm-x86/termios.h
+++ /dev/null
@@ -1,113 +0,0 @@
1#ifndef _ASM_X86_TERMIOS_H
2#define _ASM_X86_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42#ifdef __KERNEL__
43
44#include <asm/uaccess.h>
45
46/* intr=^C quit=^\ erase=del kill=^U
47 eof=^D vtime=\0 vmin=\1 sxtc=\0
48 start=^Q stop=^S susp=^Z eol=\0
49 reprint=^R discard=^U werase=^W lnext=^V
50 eol2=\0
51*/
52#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
53
54/*
55 * Translate a "termio" structure into a "termios". Ugh.
56 */
57#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
58 unsigned short __tmp; \
59 get_user(__tmp,&(termio)->x); \
60 *(unsigned short *) &(termios)->x = __tmp; \
61}
62
63static inline int user_termio_to_kernel_termios(struct ktermios *termios,
64 struct termio __user *termio)
65{
66 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag);
67 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag);
68 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag);
69 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag);
70 return copy_from_user(termios->c_cc, termio->c_cc, NCC);
71}
72
73/*
74 * Translate a "termios" structure into a "termio". Ugh.
75 */
76static inline int kernel_termios_to_user_termio(struct termio __user *termio,
77 struct ktermios *termios)
78{
79 put_user((termios)->c_iflag, &(termio)->c_iflag);
80 put_user((termios)->c_oflag, &(termio)->c_oflag);
81 put_user((termios)->c_cflag, &(termio)->c_cflag);
82 put_user((termios)->c_lflag, &(termio)->c_lflag);
83 put_user((termios)->c_line, &(termio)->c_line);
84 return copy_to_user((termio)->c_cc, (termios)->c_cc, NCC);
85}
86
87static inline int user_termios_to_kernel_termios(struct ktermios *k,
88 struct termios2 __user *u)
89{
90 return copy_from_user(k, u, sizeof(struct termios2));
91}
92
93static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
94 struct ktermios *k)
95{
96 return copy_to_user(u, k, sizeof(struct termios2));
97}
98
99static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
100 struct termios __user *u)
101{
102 return copy_from_user(k, u, sizeof(struct termios));
103}
104
105static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
106 struct ktermios *k)
107{
108 return copy_to_user(u, k, sizeof(struct termios));
109}
110
111#endif /* __KERNEL__ */
112
113#endif /* _ASM_X86_TERMIOS_H */
diff --git a/include/asm-x86/therm_throt.h b/include/asm-x86/therm_throt.h
deleted file mode 100644
index 399bf6026b16..000000000000
--- a/include/asm-x86/therm_throt.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_I386_THERM_THROT_H__
2#define __ASM_I386_THERM_THROT_H__ 1
3
4#include <asm/atomic.h>
5
6extern atomic_t therm_throt_en;
7int therm_throt_process(int curr);
8
9#endif /* __ASM_I386_THERM_THROT_H__ */
diff --git a/include/asm-x86/thread_info.h b/include/asm-x86/thread_info.h
deleted file mode 100644
index da0a675adf94..000000000000
--- a/include/asm-x86/thread_info.h
+++ /dev/null
@@ -1,261 +0,0 @@
1/* thread_info.h: low-level thread information
2 *
3 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
4 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
5 */
6
7#ifndef _ASM_X86_THREAD_INFO_H
8#define _ASM_X86_THREAD_INFO_H
9
10#include <linux/compiler.h>
11#include <asm/page.h>
12#include <asm/types.h>
13
14/*
15 * low level task data that entry.S needs immediate access to
16 * - this struct should fit entirely inside of one cache line
17 * - this struct shares the supervisor stack pages
18 */
19#ifndef __ASSEMBLY__
20struct task_struct;
21struct exec_domain;
22#include <asm/processor.h>
23
24struct thread_info {
25 struct task_struct *task; /* main task structure */
26 struct exec_domain *exec_domain; /* execution domain */
27 unsigned long flags; /* low level flags */
28 __u32 status; /* thread synchronous flags */
29 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable,
31 <0 => BUG */
32 mm_segment_t addr_limit;
33 struct restart_block restart_block;
34 void __user *sysenter_return;
35#ifdef CONFIG_X86_32
36 unsigned long previous_esp; /* ESP of the previous stack in
37 case of nested (IRQ) stacks
38 */
39 __u8 supervisor_stack[0];
40#endif
41};
42
43#define INIT_THREAD_INFO(tsk) \
44{ \
45 .task = &tsk, \
46 .exec_domain = &default_exec_domain, \
47 .flags = 0, \
48 .cpu = 0, \
49 .preempt_count = 1, \
50 .addr_limit = KERNEL_DS, \
51 .restart_block = { \
52 .fn = do_no_restart_syscall, \
53 }, \
54}
55
56#define init_thread_info (init_thread_union.thread_info)
57#define init_stack (init_thread_union.stack)
58
59#else /* !__ASSEMBLY__ */
60
61#include <asm/asm-offsets.h>
62
63#endif
64
65/*
66 * thread information flags
67 * - these are process state flags that various assembly files
68 * may need to access
69 * - pending work-to-be-done flags are in LSW
70 * - other flags in MSW
71 * Warning: layout of LSW is hardcoded in entry.S
72 */
73#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
74#define TIF_SIGPENDING 2 /* signal pending */
75#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
76#define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/
77#define TIF_IRET 5 /* force IRET */
78#define TIF_SYSCALL_EMU 6 /* syscall emulation active */
79#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
80#define TIF_SECCOMP 8 /* secure computing */
81#define TIF_MCE_NOTIFY 10 /* notify userspace of an MCE */
82#define TIF_NOTSC 16 /* TSC is not accessible in userland */
83#define TIF_IA32 17 /* 32bit process */
84#define TIF_FORK 18 /* ret_from_fork */
85#define TIF_ABI_PENDING 19
86#define TIF_MEMDIE 20
87#define TIF_DEBUG 21 /* uses debug registers */
88#define TIF_IO_BITMAP 22 /* uses I/O bitmap */
89#define TIF_FREEZE 23 /* is freezing for suspend */
90#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
91#define TIF_DEBUGCTLMSR 25 /* uses thread_struct.debugctlmsr */
92#define TIF_DS_AREA_MSR 26 /* uses thread_struct.ds_area_msr */
93#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */
94
95#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
96#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
97#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
98#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
99#define _TIF_IRET (1 << TIF_IRET)
100#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
101#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
102#define _TIF_SECCOMP (1 << TIF_SECCOMP)
103#define _TIF_MCE_NOTIFY (1 << TIF_MCE_NOTIFY)
104#define _TIF_NOTSC (1 << TIF_NOTSC)
105#define _TIF_IA32 (1 << TIF_IA32)
106#define _TIF_FORK (1 << TIF_FORK)
107#define _TIF_ABI_PENDING (1 << TIF_ABI_PENDING)
108#define _TIF_DEBUG (1 << TIF_DEBUG)
109#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
110#define _TIF_FREEZE (1 << TIF_FREEZE)
111#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
112#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR)
113#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)
114#define _TIF_BTS_TRACE_TS (1 << TIF_BTS_TRACE_TS)
115
116/* work to do in syscall_trace_enter() */
117#define _TIF_WORK_SYSCALL_ENTRY \
118 (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
119 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
120
121/* work to do in syscall_trace_leave() */
122#define _TIF_WORK_SYSCALL_EXIT \
123 (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)
124
125/* work to do on interrupt/exception return */
126#define _TIF_WORK_MASK \
127 (0x0000FFFF & \
128 ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT| \
129 _TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))
130
131/* work to do on any return to user space */
132#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
133
134/* Only used for 64 bit */
135#define _TIF_DO_NOTIFY_MASK \
136 (_TIF_SIGPENDING|_TIF_MCE_NOTIFY)
137
138/* flags to check in __switch_to() */
139#define _TIF_WORK_CTXSW \
140 (_TIF_IO_BITMAP|_TIF_DEBUGCTLMSR|_TIF_DS_AREA_MSR|_TIF_BTS_TRACE_TS| \
141 _TIF_NOTSC)
142
143#define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW
144#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG)
145
146#define PREEMPT_ACTIVE 0x10000000
147
148/* thread information allocation */
149#ifdef CONFIG_DEBUG_STACK_USAGE
150#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
151#else
152#define THREAD_FLAGS GFP_KERNEL
153#endif
154
155#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
156
157#define alloc_thread_info(tsk) \
158 ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))
159
160#ifdef CONFIG_X86_32
161
162#define STACK_WARN (THREAD_SIZE/8)
163/*
164 * macros/functions for gaining access to the thread information structure
165 *
166 * preempt_count needs to be 1 initially, until the scheduler is functional.
167 */
168#ifndef __ASSEMBLY__
169
170
171/* how to get the current stack pointer from C */
172register unsigned long current_stack_pointer asm("esp") __used;
173
174/* how to get the thread information struct from C */
175static inline struct thread_info *current_thread_info(void)
176{
177 return (struct thread_info *)
178 (current_stack_pointer & ~(THREAD_SIZE - 1));
179}
180
181#else /* !__ASSEMBLY__ */
182
183/* how to get the thread information struct from ASM */
184#define GET_THREAD_INFO(reg) \
185 movl $-THREAD_SIZE, reg; \
186 andl %esp, reg
187
188/* use this one if reg already contains %esp */
189#define GET_THREAD_INFO_WITH_ESP(reg) \
190 andl $-THREAD_SIZE, reg
191
192#endif
193
194#else /* X86_32 */
195
196#include <asm/pda.h>
197
198/*
199 * macros/functions for gaining access to the thread information structure
200 * preempt_count needs to be 1 initially, until the scheduler is functional.
201 */
202#ifndef __ASSEMBLY__
203static inline struct thread_info *current_thread_info(void)
204{
205 struct thread_info *ti;
206 ti = (void *)(read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE);
207 return ti;
208}
209
210/* do not use in interrupt context */
211static inline struct thread_info *stack_thread_info(void)
212{
213 struct thread_info *ti;
214 asm("andq %%rsp,%0; " : "=r" (ti) : "0" (~(THREAD_SIZE - 1)));
215 return ti;
216}
217
218#else /* !__ASSEMBLY__ */
219
220/* how to get the thread information struct from ASM */
221#define GET_THREAD_INFO(reg) \
222 movq %gs:pda_kernelstack,reg ; \
223 subq $(THREAD_SIZE-PDA_STACKOFFSET),reg
224
225#endif
226
227#endif /* !X86_32 */
228
229/*
230 * Thread-synchronous status.
231 *
232 * This is different from the flags in that nobody else
233 * ever touches our thread-synchronous status, so we don't
234 * have to worry about atomic accesses.
235 */
236#define TS_USEDFPU 0x0001 /* FPU was used by this task
237 this quantum (SMP) */
238#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/
239#define TS_POLLING 0x0004 /* true if in idle loop
240 and not sleeping */
241#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */
242
243#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
244
245#ifndef __ASSEMBLY__
246#define HAVE_SET_RESTORE_SIGMASK 1
247static inline void set_restore_sigmask(void)
248{
249 struct thread_info *ti = current_thread_info();
250 ti->status |= TS_RESTORE_SIGMASK;
251 set_bit(TIF_SIGPENDING, (unsigned long *)&ti->flags);
252}
253#endif /* !__ASSEMBLY__ */
254
255#ifndef __ASSEMBLY__
256extern void arch_task_cache_init(void);
257extern void free_thread_info(struct thread_info *ti);
258extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
259#define arch_task_cache_init arch_task_cache_init
260#endif
261#endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/include/asm-x86/time.h b/include/asm-x86/time.h
deleted file mode 100644
index a17fa473e91d..000000000000
--- a/include/asm-x86/time.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _ASMX86_TIME_H
2#define _ASMX86_TIME_H
3
4extern void hpet_time_init(void);
5
6#include <asm/mc146818rtc.h>
7#ifdef CONFIG_X86_32
8#include <linux/efi.h>
9
10static inline unsigned long native_get_wallclock(void)
11{
12 unsigned long retval;
13
14 if (efi_enabled)
15 retval = efi_get_time();
16 else
17 retval = mach_get_cmos_time();
18
19 return retval;
20}
21
22static inline int native_set_wallclock(unsigned long nowtime)
23{
24 int retval;
25
26 if (efi_enabled)
27 retval = efi_set_rtc_mmss(nowtime);
28 else
29 retval = mach_set_rtc_mmss(nowtime);
30
31 return retval;
32}
33
34#else
35extern void native_time_init_hook(void);
36
37static inline unsigned long native_get_wallclock(void)
38{
39 return mach_get_cmos_time();
40}
41
42static inline int native_set_wallclock(unsigned long nowtime)
43{
44 return mach_set_rtc_mmss(nowtime);
45}
46
47#endif
48
49#ifdef CONFIG_PARAVIRT
50#include <asm/paravirt.h>
51#else /* !CONFIG_PARAVIRT */
52
53#define get_wallclock() native_get_wallclock()
54#define set_wallclock(x) native_set_wallclock(x)
55#define choose_time_init() hpet_time_init
56
57#endif /* CONFIG_PARAVIRT */
58
59extern unsigned long __init calibrate_cpu(void);
60
61#endif
diff --git a/include/asm-x86/timer.h b/include/asm-x86/timer.h
deleted file mode 100644
index fb2a4ddddf3d..000000000000
--- a/include/asm-x86/timer.h
+++ /dev/null
@@ -1,63 +0,0 @@
1#ifndef _ASMi386_TIMER_H
2#define _ASMi386_TIMER_H
3#include <linux/init.h>
4#include <linux/pm.h>
5#include <linux/percpu.h>
6
7#define TICK_SIZE (tick_nsec / 1000)
8
9unsigned long long native_sched_clock(void);
10unsigned long native_calibrate_tsc(void);
11
12extern int timer_ack;
13extern int no_timer_check;
14extern int recalibrate_cpu_khz(void);
15
16#ifndef CONFIG_PARAVIRT
17#define calibrate_tsc() native_calibrate_tsc()
18#endif
19
20/* Accelerators for sched_clock()
21 * convert from cycles(64bits) => nanoseconds (64bits)
22 * basic equation:
23 * ns = cycles / (freq / ns_per_sec)
24 * ns = cycles * (ns_per_sec / freq)
25 * ns = cycles * (10^9 / (cpu_khz * 10^3))
26 * ns = cycles * (10^6 / cpu_khz)
27 *
28 * Then we use scaling math (suggested by george@mvista.com) to get:
29 * ns = cycles * (10^6 * SC / cpu_khz) / SC
30 * ns = cycles * cyc2ns_scale / SC
31 *
32 * And since SC is a constant power of two, we can convert the div
33 * into a shift.
34 *
35 * We can use khz divisor instead of mhz to keep a better precision, since
36 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
37 * (mathieu.desnoyers@polymtl.ca)
38 *
39 * -johnstul@us.ibm.com "math is hard, lets go shopping!"
40 */
41
42DECLARE_PER_CPU(unsigned long, cyc2ns);
43
44#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
45
46static inline unsigned long long __cycles_2_ns(unsigned long long cyc)
47{
48 return cyc * per_cpu(cyc2ns, smp_processor_id()) >> CYC2NS_SCALE_FACTOR;
49}
50
51static inline unsigned long long cycles_2_ns(unsigned long long cyc)
52{
53 unsigned long long ns;
54 unsigned long flags;
55
56 local_irq_save(flags);
57 ns = __cycles_2_ns(cyc);
58 local_irq_restore(flags);
59
60 return ns;
61}
62
63#endif
diff --git a/include/asm-x86/timex.h b/include/asm-x86/timex.h
deleted file mode 100644
index 43e5a78500c5..000000000000
--- a/include/asm-x86/timex.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* x86 architecture timex specifications */
2#ifndef _ASM_X86_TIMEX_H
3#define _ASM_X86_TIMEX_H
4
5#include <asm/processor.h>
6#include <asm/tsc.h>
7
8#ifdef CONFIG_X86_ELAN
9# define PIT_TICK_RATE 1189200 /* AMD Elan has different frequency! */
10#elif defined(CONFIG_X86_RDC321X)
11# define PIT_TICK_RATE 1041667 /* Underlying HZ for R8610 */
12#else
13# define PIT_TICK_RATE 1193182 /* Underlying HZ */
14#endif
15#define CLOCK_TICK_RATE PIT_TICK_RATE
16
17#define ARCH_HAS_READ_CURRENT_TIMER
18
19#endif
diff --git a/include/asm-x86/tlb.h b/include/asm-x86/tlb.h
deleted file mode 100644
index e4e9e2d07a93..000000000000
--- a/include/asm-x86/tlb.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _ASM_X86_TLB_H
2#define _ASM_X86_TLB_H
3
4#define tlb_start_vma(tlb, vma) do { } while (0)
5#define tlb_end_vma(tlb, vma) do { } while (0)
6#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
7#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
8
9#include <asm-generic/tlb.h>
10
11#endif
diff --git a/include/asm-x86/tlbflush.h b/include/asm-x86/tlbflush.h
deleted file mode 100644
index 35c76ceb9f40..000000000000
--- a/include/asm-x86/tlbflush.h
+++ /dev/null
@@ -1,168 +0,0 @@
1#ifndef _ASM_X86_TLBFLUSH_H
2#define _ASM_X86_TLBFLUSH_H
3
4#include <linux/mm.h>
5#include <linux/sched.h>
6
7#include <asm/processor.h>
8#include <asm/system.h>
9
10#ifdef CONFIG_PARAVIRT
11#include <asm/paravirt.h>
12#else
13#define __flush_tlb() __native_flush_tlb()
14#define __flush_tlb_global() __native_flush_tlb_global()
15#define __flush_tlb_single(addr) __native_flush_tlb_single(addr)
16#endif
17
18static inline void __native_flush_tlb(void)
19{
20 write_cr3(read_cr3());
21}
22
23static inline void __native_flush_tlb_global(void)
24{
25 unsigned long flags;
26 unsigned long cr4;
27
28 /*
29 * Read-modify-write to CR4 - protect it from preemption and
30 * from interrupts. (Use the raw variant because this code can
31 * be called from deep inside debugging code.)
32 */
33 raw_local_irq_save(flags);
34
35 cr4 = read_cr4();
36 /* clear PGE */
37 write_cr4(cr4 & ~X86_CR4_PGE);
38 /* write old PGE again and flush TLBs */
39 write_cr4(cr4);
40
41 raw_local_irq_restore(flags);
42}
43
44static inline void __native_flush_tlb_single(unsigned long addr)
45{
46 asm volatile("invlpg (%0)" ::"r" (addr) : "memory");
47}
48
49static inline void __flush_tlb_all(void)
50{
51 if (cpu_has_pge)
52 __flush_tlb_global();
53 else
54 __flush_tlb();
55}
56
57static inline void __flush_tlb_one(unsigned long addr)
58{
59 if (cpu_has_invlpg)
60 __flush_tlb_single(addr);
61 else
62 __flush_tlb();
63}
64
65#ifdef CONFIG_X86_32
66# define TLB_FLUSH_ALL 0xffffffff
67#else
68# define TLB_FLUSH_ALL -1ULL
69#endif
70
71/*
72 * TLB flushing:
73 *
74 * - flush_tlb() flushes the current mm struct TLBs
75 * - flush_tlb_all() flushes all processes TLBs
76 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
77 * - flush_tlb_page(vma, vmaddr) flushes one page
78 * - flush_tlb_range(vma, start, end) flushes a range of pages
79 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
80 * - flush_tlb_others(cpumask, mm, va) flushes TLBs on other cpus
81 *
82 * ..but the i386 has somewhat limited tlb flushing capabilities,
83 * and page-granular flushes are available only on i486 and up.
84 *
85 * x86-64 can only flush individual pages or full VMs. For a range flush
86 * we always do the full VM. Might be worth trying if for a small
87 * range a few INVLPGs in a row are a win.
88 */
89
90#ifndef CONFIG_SMP
91
92#define flush_tlb() __flush_tlb()
93#define flush_tlb_all() __flush_tlb_all()
94#define local_flush_tlb() __flush_tlb()
95
96static inline void flush_tlb_mm(struct mm_struct *mm)
97{
98 if (mm == current->active_mm)
99 __flush_tlb();
100}
101
102static inline void flush_tlb_page(struct vm_area_struct *vma,
103 unsigned long addr)
104{
105 if (vma->vm_mm == current->active_mm)
106 __flush_tlb_one(addr);
107}
108
109static inline void flush_tlb_range(struct vm_area_struct *vma,
110 unsigned long start, unsigned long end)
111{
112 if (vma->vm_mm == current->active_mm)
113 __flush_tlb();
114}
115
116static inline void native_flush_tlb_others(const cpumask_t *cpumask,
117 struct mm_struct *mm,
118 unsigned long va)
119{
120}
121
122#else /* SMP */
123
124#include <asm/smp.h>
125
126#define local_flush_tlb() __flush_tlb()
127
128extern void flush_tlb_all(void);
129extern void flush_tlb_current_task(void);
130extern void flush_tlb_mm(struct mm_struct *);
131extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
132
133#define flush_tlb() flush_tlb_current_task()
134
135static inline void flush_tlb_range(struct vm_area_struct *vma,
136 unsigned long start, unsigned long end)
137{
138 flush_tlb_mm(vma->vm_mm);
139}
140
141void native_flush_tlb_others(const cpumask_t *cpumask, struct mm_struct *mm,
142 unsigned long va);
143
144#define TLBSTATE_OK 1
145#define TLBSTATE_LAZY 2
146
147#ifdef CONFIG_X86_32
148struct tlb_state {
149 struct mm_struct *active_mm;
150 int state;
151 char __cacheline_padding[L1_CACHE_BYTES-8];
152};
153DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
154#endif
155
156#endif /* SMP */
157
158#ifndef CONFIG_PARAVIRT
159#define flush_tlb_others(mask, mm, va) native_flush_tlb_others(&mask, mm, va)
160#endif
161
162static inline void flush_tlb_kernel_range(unsigned long start,
163 unsigned long end)
164{
165 flush_tlb_all();
166}
167
168#endif /* _ASM_X86_TLBFLUSH_H */
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
deleted file mode 100644
index 90ac7718469a..000000000000
--- a/include/asm-x86/topology.h
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * Written by: Matthew Dobson, IBM Corporation
3 *
4 * Copyright (C) 2002, IBM Corp.
5 *
6 * All rights reserved.
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, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
16 * NON INFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * Send feedback to <colpatch@us.ibm.com>
24 */
25#ifndef _ASM_X86_TOPOLOGY_H
26#define _ASM_X86_TOPOLOGY_H
27
28#ifdef CONFIG_X86_32
29# ifdef CONFIG_X86_HT
30# define ENABLE_TOPO_DEFINES
31# endif
32#else
33# ifdef CONFIG_SMP
34# define ENABLE_TOPO_DEFINES
35# endif
36#endif
37
38/* Node not present */
39#define NUMA_NO_NODE (-1)
40
41#ifdef CONFIG_NUMA
42#include <linux/cpumask.h>
43#include <asm/mpspec.h>
44
45#ifdef CONFIG_X86_32
46
47/* Mappings between node number and cpus on that node. */
48extern cpumask_t node_to_cpumask_map[];
49
50/* Mappings between logical cpu number and node number */
51extern int cpu_to_node_map[];
52
53/* Returns the number of the node containing CPU 'cpu' */
54static inline int cpu_to_node(int cpu)
55{
56 return cpu_to_node_map[cpu];
57}
58#define early_cpu_to_node(cpu) cpu_to_node(cpu)
59
60/* Returns a bitmask of CPUs on Node 'node'.
61 *
62 * Side note: this function creates the returned cpumask on the stack
63 * so with a high NR_CPUS count, excessive stack space is used. The
64 * node_to_cpumask_ptr function should be used whenever possible.
65 */
66static inline cpumask_t node_to_cpumask(int node)
67{
68 return node_to_cpumask_map[node];
69}
70
71#else /* CONFIG_X86_64 */
72
73/* Mappings between node number and cpus on that node. */
74extern cpumask_t *node_to_cpumask_map;
75
76/* Mappings between logical cpu number and node number */
77DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
78
79/* Returns the number of the current Node. */
80#define numa_node_id() read_pda(nodenumber)
81
82#ifdef CONFIG_DEBUG_PER_CPU_MAPS
83extern int cpu_to_node(int cpu);
84extern int early_cpu_to_node(int cpu);
85extern const cpumask_t *_node_to_cpumask_ptr(int node);
86extern cpumask_t node_to_cpumask(int node);
87
88#else /* !CONFIG_DEBUG_PER_CPU_MAPS */
89
90/* Returns the number of the node containing CPU 'cpu' */
91static inline int cpu_to_node(int cpu)
92{
93 return per_cpu(x86_cpu_to_node_map, cpu);
94}
95
96/* Same function but used if called before per_cpu areas are setup */
97static inline int early_cpu_to_node(int cpu)
98{
99 if (early_per_cpu_ptr(x86_cpu_to_node_map))
100 return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
101
102 return per_cpu(x86_cpu_to_node_map, cpu);
103}
104
105/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
106static inline const cpumask_t *_node_to_cpumask_ptr(int node)
107{
108 return &node_to_cpumask_map[node];
109}
110
111/* Returns a bitmask of CPUs on Node 'node'. */
112static inline cpumask_t node_to_cpumask(int node)
113{
114 return node_to_cpumask_map[node];
115}
116
117#endif /* !CONFIG_DEBUG_PER_CPU_MAPS */
118
119/* Replace default node_to_cpumask_ptr with optimized version */
120#define node_to_cpumask_ptr(v, node) \
121 const cpumask_t *v = _node_to_cpumask_ptr(node)
122
123#define node_to_cpumask_ptr_next(v, node) \
124 v = _node_to_cpumask_ptr(node)
125
126#endif /* CONFIG_X86_64 */
127
128/*
129 * Returns the number of the node containing Node 'node'. This
130 * architecture is flat, so it is a pretty simple function!
131 */
132#define parent_node(node) (node)
133
134#define pcibus_to_node(bus) __pcibus_to_node(bus)
135#define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
136
137#ifdef CONFIG_X86_32
138extern unsigned long node_start_pfn[];
139extern unsigned long node_end_pfn[];
140extern unsigned long node_remap_size[];
141#define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
142
143# define SD_CACHE_NICE_TRIES 1
144# define SD_IDLE_IDX 1
145# define SD_NEWIDLE_IDX 2
146# define SD_FORKEXEC_IDX 0
147
148#else
149
150# define SD_CACHE_NICE_TRIES 2
151# define SD_IDLE_IDX 2
152# define SD_NEWIDLE_IDX 2
153# define SD_FORKEXEC_IDX 1
154
155#endif
156
157/* sched_domains SD_NODE_INIT for NUMAQ machines */
158#define SD_NODE_INIT (struct sched_domain) { \
159 .min_interval = 8, \
160 .max_interval = 32, \
161 .busy_factor = 32, \
162 .imbalance_pct = 125, \
163 .cache_nice_tries = SD_CACHE_NICE_TRIES, \
164 .busy_idx = 3, \
165 .idle_idx = SD_IDLE_IDX, \
166 .newidle_idx = SD_NEWIDLE_IDX, \
167 .wake_idx = 1, \
168 .forkexec_idx = SD_FORKEXEC_IDX, \
169 .flags = SD_LOAD_BALANCE \
170 | SD_BALANCE_EXEC \
171 | SD_BALANCE_FORK \
172 | SD_SERIALIZE \
173 | SD_WAKE_BALANCE, \
174 .last_balance = jiffies, \
175 .balance_interval = 1, \
176}
177
178#ifdef CONFIG_X86_64_ACPI_NUMA
179extern int __node_distance(int, int);
180#define node_distance(a, b) __node_distance(a, b)
181#endif
182
183#else /* !CONFIG_NUMA */
184
185#define numa_node_id() 0
186#define cpu_to_node(cpu) 0
187#define early_cpu_to_node(cpu) 0
188
189static inline const cpumask_t *_node_to_cpumask_ptr(int node)
190{
191 return &cpu_online_map;
192}
193static inline cpumask_t node_to_cpumask(int node)
194{
195 return cpu_online_map;
196}
197static inline int node_to_first_cpu(int node)
198{
199 return first_cpu(cpu_online_map);
200}
201
202/* Replace default node_to_cpumask_ptr with optimized version */
203#define node_to_cpumask_ptr(v, node) \
204 const cpumask_t *v = _node_to_cpumask_ptr(node)
205
206#define node_to_cpumask_ptr_next(v, node) \
207 v = _node_to_cpumask_ptr(node)
208#endif
209
210#include <asm-generic/topology.h>
211
212#ifdef CONFIG_NUMA
213/* Returns the number of the first CPU on Node 'node'. */
214static inline int node_to_first_cpu(int node)
215{
216 node_to_cpumask_ptr(mask, node);
217 return first_cpu(*mask);
218}
219#endif
220
221extern cpumask_t cpu_coregroup_map(int cpu);
222
223#ifdef ENABLE_TOPO_DEFINES
224#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
225#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
226#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
227#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
228
229/* indicates that pointers to the topology cpumask_t maps are valid */
230#define arch_provides_topology_pointers yes
231#endif
232
233static inline void arch_fix_phys_package_id(int num, u32 slot)
234{
235}
236
237struct pci_bus;
238void set_pci_bus_resources_arch_default(struct pci_bus *b);
239
240#ifdef CONFIG_SMP
241#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
242#define smt_capable() (smp_num_siblings > 1)
243#endif
244
245#ifdef CONFIG_NUMA
246extern int get_mp_bus_to_node(int busnum);
247extern void set_mp_bus_to_node(int busnum, int node);
248#else
249static inline int get_mp_bus_to_node(int busnum)
250{
251 return 0;
252}
253static inline void set_mp_bus_to_node(int busnum, int node)
254{
255}
256#endif
257
258#endif /* _ASM_X86_TOPOLOGY_H */
diff --git a/include/asm-x86/trampoline.h b/include/asm-x86/trampoline.h
deleted file mode 100644
index b156b08d0131..000000000000
--- a/include/asm-x86/trampoline.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef __TRAMPOLINE_HEADER
2#define __TRAMPOLINE_HEADER
3
4#ifndef __ASSEMBLY__
5
6/*
7 * Trampoline 80x86 program as an array.
8 */
9extern const unsigned char trampoline_data [];
10extern const unsigned char trampoline_end [];
11extern unsigned char *trampoline_base;
12
13extern unsigned long init_rsp;
14extern unsigned long initial_code;
15
16#define TRAMPOLINE_BASE 0x6000
17extern unsigned long setup_trampoline(void);
18
19#endif /* __ASSEMBLY__ */
20
21#endif /* __TRAMPOLINE_HEADER */
diff --git a/include/asm-x86/traps.h b/include/asm-x86/traps.h
deleted file mode 100644
index a4b65a71bd66..000000000000
--- a/include/asm-x86/traps.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#ifndef _ASM_X86_TRAPS_H
2#define _ASM_X86_TRAPS_H
3
4/* Common in X86_32 and X86_64 */
5asmlinkage void divide_error(void);
6asmlinkage void debug(void);
7asmlinkage void nmi(void);
8asmlinkage void int3(void);
9asmlinkage void overflow(void);
10asmlinkage void bounds(void);
11asmlinkage void invalid_op(void);
12asmlinkage void device_not_available(void);
13asmlinkage void coprocessor_segment_overrun(void);
14asmlinkage void invalid_TSS(void);
15asmlinkage void segment_not_present(void);
16asmlinkage void stack_segment(void);
17asmlinkage void general_protection(void);
18asmlinkage void page_fault(void);
19asmlinkage void coprocessor_error(void);
20asmlinkage void simd_coprocessor_error(void);
21asmlinkage void alignment_check(void);
22asmlinkage void spurious_interrupt_bug(void);
23#ifdef CONFIG_X86_MCE
24asmlinkage void machine_check(void);
25#endif /* CONFIG_X86_MCE */
26
27void do_divide_error(struct pt_regs *, long);
28void do_overflow(struct pt_regs *, long);
29void do_bounds(struct pt_regs *, long);
30void do_coprocessor_segment_overrun(struct pt_regs *, long);
31void do_invalid_TSS(struct pt_regs *, long);
32void do_segment_not_present(struct pt_regs *, long);
33void do_stack_segment(struct pt_regs *, long);
34void do_alignment_check(struct pt_regs *, long);
35void do_invalid_op(struct pt_regs *, long);
36void do_general_protection(struct pt_regs *, long);
37void do_nmi(struct pt_regs *, long);
38
39extern int panic_on_unrecovered_nmi;
40extern int kstack_depth_to_print;
41
42#ifdef CONFIG_X86_32
43
44void do_iret_error(struct pt_regs *, long);
45void do_int3(struct pt_regs *, long);
46void do_debug(struct pt_regs *, long);
47void math_error(void __user *);
48void do_coprocessor_error(struct pt_regs *, long);
49void do_simd_coprocessor_error(struct pt_regs *, long);
50void do_spurious_interrupt_bug(struct pt_regs *, long);
51unsigned long patch_espfix_desc(unsigned long, unsigned long);
52asmlinkage void math_emulate(long);
53
54#else /* CONFIG_X86_32 */
55
56asmlinkage void double_fault(void);
57
58asmlinkage void do_int3(struct pt_regs *, long);
59asmlinkage void do_stack_segment(struct pt_regs *, long);
60asmlinkage void do_debug(struct pt_regs *, unsigned long);
61asmlinkage void do_coprocessor_error(struct pt_regs *);
62asmlinkage void do_simd_coprocessor_error(struct pt_regs *);
63asmlinkage void do_spurious_interrupt_bug(struct pt_regs *);
64
65#endif /* CONFIG_X86_32 */
66#endif /* _ASM_X86_TRAPS_H */
diff --git a/include/asm-x86/tsc.h b/include/asm-x86/tsc.h
deleted file mode 100644
index cb6f6ee45b8f..000000000000
--- a/include/asm-x86/tsc.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * x86 TSC related functions
3 */
4#ifndef _ASM_X86_TSC_H
5#define _ASM_X86_TSC_H
6
7#include <asm/processor.h>
8
9#define NS_SCALE 10 /* 2^10, carefully chosen */
10#define US_SCALE 32 /* 2^32, arbitralrily chosen */
11
12/*
13 * Standard way to access the cycle counter.
14 */
15typedef unsigned long long cycles_t;
16
17extern unsigned int cpu_khz;
18extern unsigned int tsc_khz;
19
20extern void disable_TSC(void);
21
22static inline cycles_t get_cycles(void)
23{
24 unsigned long long ret = 0;
25
26#ifndef CONFIG_X86_TSC
27 if (!cpu_has_tsc)
28 return 0;
29#endif
30 rdtscll(ret);
31
32 return ret;
33}
34
35static __always_inline cycles_t vget_cycles(void)
36{
37 /*
38 * We only do VDSOs on TSC capable CPUs, so this shouldnt
39 * access boot_cpu_data (which is not VDSO-safe):
40 */
41#ifndef CONFIG_X86_TSC
42 if (!cpu_has_tsc)
43 return 0;
44#endif
45 return (cycles_t)__native_read_tsc();
46}
47
48extern void tsc_init(void);
49extern void mark_tsc_unstable(char *reason);
50extern int unsynchronized_tsc(void);
51int check_tsc_unstable(void);
52
53/*
54 * Boot-time check whether the TSCs are synchronized across
55 * all CPUs/cores:
56 */
57extern void check_tsc_sync_source(int cpu);
58extern void check_tsc_sync_target(void);
59
60extern int notsc_setup(char *);
61
62#endif
diff --git a/include/asm-x86/types.h b/include/asm-x86/types.h
deleted file mode 100644
index 1ac80cd9acf8..000000000000
--- a/include/asm-x86/types.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef _ASM_X86_TYPES_H
2#define _ASM_X86_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11
12/*
13 * These aren't exported outside the kernel to avoid name space clashes
14 */
15#ifdef __KERNEL__
16
17#ifdef CONFIG_X86_32
18# define BITS_PER_LONG 32
19#else
20# define BITS_PER_LONG 64
21#endif
22
23#ifndef __ASSEMBLY__
24
25typedef u64 dma64_addr_t;
26#if defined(CONFIG_X86_64) || defined(CONFIG_HIGHMEM64G)
27/* DMA addresses come in 32-bit and 64-bit flavours. */
28typedef u64 dma_addr_t;
29#else
30typedef u32 dma_addr_t;
31#endif
32
33#endif /* __ASSEMBLY__ */
34#endif /* __KERNEL__ */
35
36#endif
diff --git a/include/asm-x86/uaccess.h b/include/asm-x86/uaccess.h
deleted file mode 100644
index 5f702d1d5218..000000000000
--- a/include/asm-x86/uaccess.h
+++ /dev/null
@@ -1,454 +0,0 @@
1#ifndef _ASM_UACCES_H_
2#define _ASM_UACCES_H_
3/*
4 * User space memory access functions
5 */
6#include <linux/errno.h>
7#include <linux/compiler.h>
8#include <linux/thread_info.h>
9#include <linux/prefetch.h>
10#include <linux/string.h>
11#include <asm/asm.h>
12#include <asm/page.h>
13
14#define VERIFY_READ 0
15#define VERIFY_WRITE 1
16
17/*
18 * The fs value determines whether argument validity checking should be
19 * performed or not. If get_fs() == USER_DS, checking is performed, with
20 * get_fs() == KERNEL_DS, checking is bypassed.
21 *
22 * For historical reasons, these macros are grossly misnamed.
23 */
24
25#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
26
27#define KERNEL_DS MAKE_MM_SEG(-1UL)
28#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
29
30#define get_ds() (KERNEL_DS)
31#define get_fs() (current_thread_info()->addr_limit)
32#define set_fs(x) (current_thread_info()->addr_limit = (x))
33
34#define segment_eq(a, b) ((a).seg == (b).seg)
35
36#define __addr_ok(addr) \
37 ((unsigned long __force)(addr) < \
38 (current_thread_info()->addr_limit.seg))
39
40/*
41 * Test whether a block of memory is a valid user space address.
42 * Returns 0 if the range is valid, nonzero otherwise.
43 *
44 * This is equivalent to the following test:
45 * (u33)addr + (u33)size >= (u33)current->addr_limit.seg (u65 for x86_64)
46 *
47 * This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry...
48 */
49
50#define __range_not_ok(addr, size) \
51({ \
52 unsigned long flag, roksum; \
53 __chk_user_ptr(addr); \
54 asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \
55 : "=&r" (flag), "=r" (roksum) \
56 : "1" (addr), "g" ((long)(size)), \
57 "rm" (current_thread_info()->addr_limit.seg)); \
58 flag; \
59})
60
61/**
62 * access_ok: - Checks if a user space pointer is valid
63 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
64 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
65 * to write to a block, it is always safe to read from it.
66 * @addr: User space pointer to start of block to check
67 * @size: Size of block to check
68 *
69 * Context: User context only. This function may sleep.
70 *
71 * Checks if a pointer to a block of memory in user space is valid.
72 *
73 * Returns true (nonzero) if the memory block may be valid, false (zero)
74 * if it is definitely invalid.
75 *
76 * Note that, depending on architecture, this function probably just
77 * checks that the pointer is in the user space range - after calling
78 * this function, memory access functions may still return -EFAULT.
79 */
80#define access_ok(type, addr, size) (likely(__range_not_ok(addr, size) == 0))
81
82/*
83 * The exception table consists of pairs of addresses: the first is the
84 * address of an instruction that is allowed to fault, and the second is
85 * the address at which the program should continue. No registers are
86 * modified, so it is entirely up to the continuation code to figure out
87 * what to do.
88 *
89 * All the routines below use bits of fixup code that are out of line
90 * with the main instruction path. This means when everything is well,
91 * we don't even have to jump over them. Further, they do not intrude
92 * on our cache or tlb entries.
93 */
94
95struct exception_table_entry {
96 unsigned long insn, fixup;
97};
98
99extern int fixup_exception(struct pt_regs *regs);
100
101/*
102 * These are the main single-value transfer routines. They automatically
103 * use the right size if we just have the right pointer type.
104 *
105 * This gets kind of ugly. We want to return _two_ values in "get_user()"
106 * and yet we don't want to do any pointers, because that is too much
107 * of a performance impact. Thus we have a few rather ugly macros here,
108 * and hide all the ugliness from the user.
109 *
110 * The "__xxx" versions of the user access functions are versions that
111 * do not verify the address space, that must have been done previously
112 * with a separate "access_ok()" call (this is used when we do multiple
113 * accesses to the same area of user memory).
114 */
115
116extern int __get_user_1(void);
117extern int __get_user_2(void);
118extern int __get_user_4(void);
119extern int __get_user_8(void);
120extern int __get_user_bad(void);
121
122#define __get_user_x(size, ret, x, ptr) \
123 asm volatile("call __get_user_" #size \
124 : "=a" (ret),"=d" (x) \
125 : "0" (ptr)) \
126
127/* Careful: we have to cast the result to the type of the pointer
128 * for sign reasons */
129
130/**
131 * get_user: - Get a simple variable from user space.
132 * @x: Variable to store result.
133 * @ptr: Source address, in user space.
134 *
135 * Context: User context only. This function may sleep.
136 *
137 * This macro copies a single simple variable from user space to kernel
138 * space. It supports simple types like char and int, but not larger
139 * data types like structures or arrays.
140 *
141 * @ptr must have pointer-to-simple-variable type, and the result of
142 * dereferencing @ptr must be assignable to @x without a cast.
143 *
144 * Returns zero on success, or -EFAULT on error.
145 * On error, the variable @x is set to zero.
146 */
147#ifdef CONFIG_X86_32
148#define __get_user_8(__ret_gu, __val_gu, ptr) \
149 __get_user_x(X, __ret_gu, __val_gu, ptr)
150#else
151#define __get_user_8(__ret_gu, __val_gu, ptr) \
152 __get_user_x(8, __ret_gu, __val_gu, ptr)
153#endif
154
155#define get_user(x, ptr) \
156({ \
157 int __ret_gu; \
158 unsigned long __val_gu; \
159 __chk_user_ptr(ptr); \
160 switch (sizeof(*(ptr))) { \
161 case 1: \
162 __get_user_x(1, __ret_gu, __val_gu, ptr); \
163 break; \
164 case 2: \
165 __get_user_x(2, __ret_gu, __val_gu, ptr); \
166 break; \
167 case 4: \
168 __get_user_x(4, __ret_gu, __val_gu, ptr); \
169 break; \
170 case 8: \
171 __get_user_8(__ret_gu, __val_gu, ptr); \
172 break; \
173 default: \
174 __get_user_x(X, __ret_gu, __val_gu, ptr); \
175 break; \
176 } \
177 (x) = (__typeof__(*(ptr)))__val_gu; \
178 __ret_gu; \
179})
180
181#define __put_user_x(size, x, ptr, __ret_pu) \
182 asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
183 :"0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
184
185
186
187#ifdef CONFIG_X86_32
188#define __put_user_u64(x, addr, err) \
189 asm volatile("1: movl %%eax,0(%2)\n" \
190 "2: movl %%edx,4(%2)\n" \
191 "3:\n" \
192 ".section .fixup,\"ax\"\n" \
193 "4: movl %3,%0\n" \
194 " jmp 3b\n" \
195 ".previous\n" \
196 _ASM_EXTABLE(1b, 4b) \
197 _ASM_EXTABLE(2b, 4b) \
198 : "=r" (err) \
199 : "A" (x), "r" (addr), "i" (-EFAULT), "0" (err))
200
201#define __put_user_x8(x, ptr, __ret_pu) \
202 asm volatile("call __put_user_8" : "=a" (__ret_pu) \
203 : "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
204#else
205#define __put_user_u64(x, ptr, retval) \
206 __put_user_asm(x, ptr, retval, "q", "", "Zr", -EFAULT)
207#define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu)
208#endif
209
210extern void __put_user_bad(void);
211
212/*
213 * Strange magic calling convention: pointer in %ecx,
214 * value in %eax(:%edx), return value in %eax. clobbers %rbx
215 */
216extern void __put_user_1(void);
217extern void __put_user_2(void);
218extern void __put_user_4(void);
219extern void __put_user_8(void);
220
221#ifdef CONFIG_X86_WP_WORKS_OK
222
223/**
224 * put_user: - Write a simple value into user space.
225 * @x: Value to copy to user space.
226 * @ptr: Destination address, in user space.
227 *
228 * Context: User context only. This function may sleep.
229 *
230 * This macro copies a single simple value from kernel space to user
231 * space. It supports simple types like char and int, but not larger
232 * data types like structures or arrays.
233 *
234 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
235 * to the result of dereferencing @ptr.
236 *
237 * Returns zero on success, or -EFAULT on error.
238 */
239#define put_user(x, ptr) \
240({ \
241 int __ret_pu; \
242 __typeof__(*(ptr)) __pu_val; \
243 __chk_user_ptr(ptr); \
244 __pu_val = x; \
245 switch (sizeof(*(ptr))) { \
246 case 1: \
247 __put_user_x(1, __pu_val, ptr, __ret_pu); \
248 break; \
249 case 2: \
250 __put_user_x(2, __pu_val, ptr, __ret_pu); \
251 break; \
252 case 4: \
253 __put_user_x(4, __pu_val, ptr, __ret_pu); \
254 break; \
255 case 8: \
256 __put_user_x8(__pu_val, ptr, __ret_pu); \
257 break; \
258 default: \
259 __put_user_x(X, __pu_val, ptr, __ret_pu); \
260 break; \
261 } \
262 __ret_pu; \
263})
264
265#define __put_user_size(x, ptr, size, retval, errret) \
266do { \
267 retval = 0; \
268 __chk_user_ptr(ptr); \
269 switch (size) { \
270 case 1: \
271 __put_user_asm(x, ptr, retval, "b", "b", "iq", errret); \
272 break; \
273 case 2: \
274 __put_user_asm(x, ptr, retval, "w", "w", "ir", errret); \
275 break; \
276 case 4: \
277 __put_user_asm(x, ptr, retval, "l", "k", "ir", errret);\
278 break; \
279 case 8: \
280 __put_user_u64((__typeof__(*ptr))(x), ptr, retval); \
281 break; \
282 default: \
283 __put_user_bad(); \
284 } \
285} while (0)
286
287#else
288
289#define __put_user_size(x, ptr, size, retval, errret) \
290do { \
291 __typeof__(*(ptr))__pus_tmp = x; \
292 retval = 0; \
293 \
294 if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, size) != 0)) \
295 retval = errret; \
296} while (0)
297
298#define put_user(x, ptr) \
299({ \
300 int __ret_pu; \
301 __typeof__(*(ptr))__pus_tmp = x; \
302 __ret_pu = 0; \
303 if (unlikely(__copy_to_user_ll(ptr, &__pus_tmp, \
304 sizeof(*(ptr))) != 0)) \
305 __ret_pu = -EFAULT; \
306 __ret_pu; \
307})
308#endif
309
310#ifdef CONFIG_X86_32
311#define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad()
312#else
313#define __get_user_asm_u64(x, ptr, retval, errret) \
314 __get_user_asm(x, ptr, retval, "q", "", "=r", errret)
315#endif
316
317#define __get_user_size(x, ptr, size, retval, errret) \
318do { \
319 retval = 0; \
320 __chk_user_ptr(ptr); \
321 switch (size) { \
322 case 1: \
323 __get_user_asm(x, ptr, retval, "b", "b", "=q", errret); \
324 break; \
325 case 2: \
326 __get_user_asm(x, ptr, retval, "w", "w", "=r", errret); \
327 break; \
328 case 4: \
329 __get_user_asm(x, ptr, retval, "l", "k", "=r", errret); \
330 break; \
331 case 8: \
332 __get_user_asm_u64(x, ptr, retval, errret); \
333 break; \
334 default: \
335 (x) = __get_user_bad(); \
336 } \
337} while (0)
338
339#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
340 asm volatile("1: mov"itype" %2,%"rtype"1\n" \
341 "2:\n" \
342 ".section .fixup,\"ax\"\n" \
343 "3: mov %3,%0\n" \
344 " xor"itype" %"rtype"1,%"rtype"1\n" \
345 " jmp 2b\n" \
346 ".previous\n" \
347 _ASM_EXTABLE(1b, 3b) \
348 : "=r" (err), ltype(x) \
349 : "m" (__m(addr)), "i" (errret), "0" (err))
350
351#define __put_user_nocheck(x, ptr, size) \
352({ \
353 long __pu_err; \
354 __put_user_size((x), (ptr), (size), __pu_err, -EFAULT); \
355 __pu_err; \
356})
357
358#define __get_user_nocheck(x, ptr, size) \
359({ \
360 long __gu_err; \
361 unsigned long __gu_val; \
362 __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
363 (x) = (__force __typeof__(*(ptr)))__gu_val; \
364 __gu_err; \
365})
366
367/* FIXME: this hack is definitely wrong -AK */
368struct __large_struct { unsigned long buf[100]; };
369#define __m(x) (*(struct __large_struct __user *)(x))
370
371/*
372 * Tell gcc we read from memory instead of writing: this is because
373 * we do not write to any memory gcc knows about, so there are no
374 * aliasing issues.
375 */
376#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \
377 asm volatile("1: mov"itype" %"rtype"1,%2\n" \
378 "2:\n" \
379 ".section .fixup,\"ax\"\n" \
380 "3: mov %3,%0\n" \
381 " jmp 2b\n" \
382 ".previous\n" \
383 _ASM_EXTABLE(1b, 3b) \
384 : "=r"(err) \
385 : ltype(x), "m" (__m(addr)), "i" (errret), "0" (err))
386/**
387 * __get_user: - Get a simple variable from user space, with less checking.
388 * @x: Variable to store result.
389 * @ptr: Source address, in user space.
390 *
391 * Context: User context only. This function may sleep.
392 *
393 * This macro copies a single simple variable from user space to kernel
394 * space. It supports simple types like char and int, but not larger
395 * data types like structures or arrays.
396 *
397 * @ptr must have pointer-to-simple-variable type, and the result of
398 * dereferencing @ptr must be assignable to @x without a cast.
399 *
400 * Caller must check the pointer with access_ok() before calling this
401 * function.
402 *
403 * Returns zero on success, or -EFAULT on error.
404 * On error, the variable @x is set to zero.
405 */
406
407#define __get_user(x, ptr) \
408 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
409/**
410 * __put_user: - Write a simple value into user space, with less checking.
411 * @x: Value to copy to user space.
412 * @ptr: Destination address, in user space.
413 *
414 * Context: User context only. This function may sleep.
415 *
416 * This macro copies a single simple value from kernel space to user
417 * space. It supports simple types like char and int, but not larger
418 * data types like structures or arrays.
419 *
420 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
421 * to the result of dereferencing @ptr.
422 *
423 * Caller must check the pointer with access_ok() before calling this
424 * function.
425 *
426 * Returns zero on success, or -EFAULT on error.
427 */
428
429#define __put_user(x, ptr) \
430 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
431
432#define __get_user_unaligned __get_user
433#define __put_user_unaligned __put_user
434
435/*
436 * movsl can be slow when source and dest are not both 8-byte aligned
437 */
438#ifdef CONFIG_X86_INTEL_USERCOPY
439extern struct movsl_mask {
440 int mask;
441} ____cacheline_aligned_in_smp movsl_mask;
442#endif
443
444#define ARCH_HAS_NOCACHE_UACCESS 1
445
446#ifdef CONFIG_X86_32
447# include "uaccess_32.h"
448#else
449# define ARCH_HAS_SEARCH_EXTABLE
450# include "uaccess_64.h"
451#endif
452
453#endif
454
diff --git a/include/asm-x86/uaccess_32.h b/include/asm-x86/uaccess_32.h
deleted file mode 100644
index 6fdef39a0bcb..000000000000
--- a/include/asm-x86/uaccess_32.h
+++ /dev/null
@@ -1,218 +0,0 @@
1#ifndef __i386_UACCESS_H
2#define __i386_UACCESS_H
3
4/*
5 * User space memory access functions
6 */
7#include <linux/errno.h>
8#include <linux/thread_info.h>
9#include <linux/prefetch.h>
10#include <linux/string.h>
11#include <asm/asm.h>
12#include <asm/page.h>
13
14unsigned long __must_check __copy_to_user_ll
15 (void __user *to, const void *from, unsigned long n);
16unsigned long __must_check __copy_from_user_ll
17 (void *to, const void __user *from, unsigned long n);
18unsigned long __must_check __copy_from_user_ll_nozero
19 (void *to, const void __user *from, unsigned long n);
20unsigned long __must_check __copy_from_user_ll_nocache
21 (void *to, const void __user *from, unsigned long n);
22unsigned long __must_check __copy_from_user_ll_nocache_nozero
23 (void *to, const void __user *from, unsigned long n);
24
25/**
26 * __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.
27 * @to: Destination address, in user space.
28 * @from: Source address, in kernel space.
29 * @n: Number of bytes to copy.
30 *
31 * Context: User context only.
32 *
33 * Copy data from kernel space to user space. Caller must check
34 * the specified block with access_ok() before calling this function.
35 * The caller should also make sure he pins the user space address
36 * so that the we don't result in page fault and sleep.
37 *
38 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
39 * we return the initial request size (1, 2 or 4), as copy_*_user should do.
40 * If a store crosses a page boundary and gets a fault, the x86 will not write
41 * anything, so this is accurate.
42 */
43
44static __always_inline unsigned long __must_check
45__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
46{
47 if (__builtin_constant_p(n)) {
48 unsigned long ret;
49
50 switch (n) {
51 case 1:
52 __put_user_size(*(u8 *)from, (u8 __user *)to,
53 1, ret, 1);
54 return ret;
55 case 2:
56 __put_user_size(*(u16 *)from, (u16 __user *)to,
57 2, ret, 2);
58 return ret;
59 case 4:
60 __put_user_size(*(u32 *)from, (u32 __user *)to,
61 4, ret, 4);
62 return ret;
63 }
64 }
65 return __copy_to_user_ll(to, from, n);
66}
67
68/**
69 * __copy_to_user: - Copy a block of data into user space, with less checking.
70 * @to: Destination address, in user space.
71 * @from: Source address, in kernel space.
72 * @n: Number of bytes to copy.
73 *
74 * Context: User context only. This function may sleep.
75 *
76 * Copy data from kernel space to user space. Caller must check
77 * the specified block with access_ok() before calling this function.
78 *
79 * Returns number of bytes that could not be copied.
80 * On success, this will be zero.
81 */
82static __always_inline unsigned long __must_check
83__copy_to_user(void __user *to, const void *from, unsigned long n)
84{
85 might_sleep();
86 return __copy_to_user_inatomic(to, from, n);
87}
88
89static __always_inline unsigned long
90__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
91{
92 /* Avoid zeroing the tail if the copy fails..
93 * If 'n' is constant and 1, 2, or 4, we do still zero on a failure,
94 * but as the zeroing behaviour is only significant when n is not
95 * constant, that shouldn't be a problem.
96 */
97 if (__builtin_constant_p(n)) {
98 unsigned long ret;
99
100 switch (n) {
101 case 1:
102 __get_user_size(*(u8 *)to, from, 1, ret, 1);
103 return ret;
104 case 2:
105 __get_user_size(*(u16 *)to, from, 2, ret, 2);
106 return ret;
107 case 4:
108 __get_user_size(*(u32 *)to, from, 4, ret, 4);
109 return ret;
110 }
111 }
112 return __copy_from_user_ll_nozero(to, from, n);
113}
114
115/**
116 * __copy_from_user: - Copy a block of data from user space, with less checking.
117 * @to: Destination address, in kernel space.
118 * @from: Source address, in user space.
119 * @n: Number of bytes to copy.
120 *
121 * Context: User context only. This function may sleep.
122 *
123 * Copy data from user space to kernel space. Caller must check
124 * the specified block with access_ok() before calling this function.
125 *
126 * Returns number of bytes that could not be copied.
127 * On success, this will be zero.
128 *
129 * If some data could not be copied, this function will pad the copied
130 * data to the requested size using zero bytes.
131 *
132 * An alternate version - __copy_from_user_inatomic() - may be called from
133 * atomic context and will fail rather than sleep. In this case the
134 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
135 * for explanation of why this is needed.
136 */
137static __always_inline unsigned long
138__copy_from_user(void *to, const void __user *from, unsigned long n)
139{
140 might_sleep();
141 if (__builtin_constant_p(n)) {
142 unsigned long ret;
143
144 switch (n) {
145 case 1:
146 __get_user_size(*(u8 *)to, from, 1, ret, 1);
147 return ret;
148 case 2:
149 __get_user_size(*(u16 *)to, from, 2, ret, 2);
150 return ret;
151 case 4:
152 __get_user_size(*(u32 *)to, from, 4, ret, 4);
153 return ret;
154 }
155 }
156 return __copy_from_user_ll(to, from, n);
157}
158
159static __always_inline unsigned long __copy_from_user_nocache(void *to,
160 const void __user *from, unsigned long n)
161{
162 might_sleep();
163 if (__builtin_constant_p(n)) {
164 unsigned long ret;
165
166 switch (n) {
167 case 1:
168 __get_user_size(*(u8 *)to, from, 1, ret, 1);
169 return ret;
170 case 2:
171 __get_user_size(*(u16 *)to, from, 2, ret, 2);
172 return ret;
173 case 4:
174 __get_user_size(*(u32 *)to, from, 4, ret, 4);
175 return ret;
176 }
177 }
178 return __copy_from_user_ll_nocache(to, from, n);
179}
180
181static __always_inline unsigned long
182__copy_from_user_inatomic_nocache(void *to, const void __user *from,
183 unsigned long n)
184{
185 return __copy_from_user_ll_nocache_nozero(to, from, n);
186}
187
188unsigned long __must_check copy_to_user(void __user *to,
189 const void *from, unsigned long n);
190unsigned long __must_check copy_from_user(void *to,
191 const void __user *from,
192 unsigned long n);
193long __must_check strncpy_from_user(char *dst, const char __user *src,
194 long count);
195long __must_check __strncpy_from_user(char *dst,
196 const char __user *src, long count);
197
198/**
199 * strlen_user: - Get the size of a string in user space.
200 * @str: The string to measure.
201 *
202 * Context: User context only. This function may sleep.
203 *
204 * Get the size of a NUL-terminated string in user space.
205 *
206 * Returns the size of the string INCLUDING the terminating NUL.
207 * On exception, returns 0.
208 *
209 * If there is a limit on the length of a valid string, you may wish to
210 * consider using strnlen_user() instead.
211 */
212#define strlen_user(str) strnlen_user(str, LONG_MAX)
213
214long strnlen_user(const char __user *str, long n);
215unsigned long __must_check clear_user(void __user *mem, unsigned long len);
216unsigned long __must_check __clear_user(void __user *mem, unsigned long len);
217
218#endif /* __i386_UACCESS_H */
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h
deleted file mode 100644
index 45806d60bcbe..000000000000
--- a/include/asm-x86/uaccess_64.h
+++ /dev/null
@@ -1,202 +0,0 @@
1#ifndef __X86_64_UACCESS_H
2#define __X86_64_UACCESS_H
3
4/*
5 * User space memory access functions
6 */
7#include <linux/compiler.h>
8#include <linux/errno.h>
9#include <linux/prefetch.h>
10#include <linux/lockdep.h>
11#include <asm/page.h>
12
13/*
14 * Copy To/From Userspace
15 */
16
17/* Handles exceptions in both to and from, but doesn't do access_ok */
18__must_check unsigned long
19copy_user_generic(void *to, const void *from, unsigned len);
20
21__must_check unsigned long
22copy_to_user(void __user *to, const void *from, unsigned len);
23__must_check unsigned long
24copy_from_user(void *to, const void __user *from, unsigned len);
25__must_check unsigned long
26copy_in_user(void __user *to, const void __user *from, unsigned len);
27
28static __always_inline __must_check
29int __copy_from_user(void *dst, const void __user *src, unsigned size)
30{
31 int ret = 0;
32 if (!__builtin_constant_p(size))
33 return copy_user_generic(dst, (__force void *)src, size);
34 switch (size) {
35 case 1:__get_user_asm(*(u8 *)dst, (u8 __user *)src,
36 ret, "b", "b", "=q", 1);
37 return ret;
38 case 2:__get_user_asm(*(u16 *)dst, (u16 __user *)src,
39 ret, "w", "w", "=r", 2);
40 return ret;
41 case 4:__get_user_asm(*(u32 *)dst, (u32 __user *)src,
42 ret, "l", "k", "=r", 4);
43 return ret;
44 case 8:__get_user_asm(*(u64 *)dst, (u64 __user *)src,
45 ret, "q", "", "=r", 8);
46 return ret;
47 case 10:
48 __get_user_asm(*(u64 *)dst, (u64 __user *)src,
49 ret, "q", "", "=r", 16);
50 if (unlikely(ret))
51 return ret;
52 __get_user_asm(*(u16 *)(8 + (char *)dst),
53 (u16 __user *)(8 + (char __user *)src),
54 ret, "w", "w", "=r", 2);
55 return ret;
56 case 16:
57 __get_user_asm(*(u64 *)dst, (u64 __user *)src,
58 ret, "q", "", "=r", 16);
59 if (unlikely(ret))
60 return ret;
61 __get_user_asm(*(u64 *)(8 + (char *)dst),
62 (u64 __user *)(8 + (char __user *)src),
63 ret, "q", "", "=r", 8);
64 return ret;
65 default:
66 return copy_user_generic(dst, (__force void *)src, size);
67 }
68}
69
70static __always_inline __must_check
71int __copy_to_user(void __user *dst, const void *src, unsigned size)
72{
73 int ret = 0;
74 if (!__builtin_constant_p(size))
75 return copy_user_generic((__force void *)dst, src, size);
76 switch (size) {
77 case 1:__put_user_asm(*(u8 *)src, (u8 __user *)dst,
78 ret, "b", "b", "iq", 1);
79 return ret;
80 case 2:__put_user_asm(*(u16 *)src, (u16 __user *)dst,
81 ret, "w", "w", "ir", 2);
82 return ret;
83 case 4:__put_user_asm(*(u32 *)src, (u32 __user *)dst,
84 ret, "l", "k", "ir", 4);
85 return ret;
86 case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
87 ret, "q", "", "ir", 8);
88 return ret;
89 case 10:
90 __put_user_asm(*(u64 *)src, (u64 __user *)dst,
91 ret, "q", "", "ir", 10);
92 if (unlikely(ret))
93 return ret;
94 asm("":::"memory");
95 __put_user_asm(4[(u16 *)src], 4 + (u16 __user *)dst,
96 ret, "w", "w", "ir", 2);
97 return ret;
98 case 16:
99 __put_user_asm(*(u64 *)src, (u64 __user *)dst,
100 ret, "q", "", "ir", 16);
101 if (unlikely(ret))
102 return ret;
103 asm("":::"memory");
104 __put_user_asm(1[(u64 *)src], 1 + (u64 __user *)dst,
105 ret, "q", "", "ir", 8);
106 return ret;
107 default:
108 return copy_user_generic((__force void *)dst, src, size);
109 }
110}
111
112static __always_inline __must_check
113int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
114{
115 int ret = 0;
116 if (!__builtin_constant_p(size))
117 return copy_user_generic((__force void *)dst,
118 (__force void *)src, size);
119 switch (size) {
120 case 1: {
121 u8 tmp;
122 __get_user_asm(tmp, (u8 __user *)src,
123 ret, "b", "b", "=q", 1);
124 if (likely(!ret))
125 __put_user_asm(tmp, (u8 __user *)dst,
126 ret, "b", "b", "iq", 1);
127 return ret;
128 }
129 case 2: {
130 u16 tmp;
131 __get_user_asm(tmp, (u16 __user *)src,
132 ret, "w", "w", "=r", 2);
133 if (likely(!ret))
134 __put_user_asm(tmp, (u16 __user *)dst,
135 ret, "w", "w", "ir", 2);
136 return ret;
137 }
138
139 case 4: {
140 u32 tmp;
141 __get_user_asm(tmp, (u32 __user *)src,
142 ret, "l", "k", "=r", 4);
143 if (likely(!ret))
144 __put_user_asm(tmp, (u32 __user *)dst,
145 ret, "l", "k", "ir", 4);
146 return ret;
147 }
148 case 8: {
149 u64 tmp;
150 __get_user_asm(tmp, (u64 __user *)src,
151 ret, "q", "", "=r", 8);
152 if (likely(!ret))
153 __put_user_asm(tmp, (u64 __user *)dst,
154 ret, "q", "", "ir", 8);
155 return ret;
156 }
157 default:
158 return copy_user_generic((__force void *)dst,
159 (__force void *)src, size);
160 }
161}
162
163__must_check long
164strncpy_from_user(char *dst, const char __user *src, long count);
165__must_check long
166__strncpy_from_user(char *dst, const char __user *src, long count);
167__must_check long strnlen_user(const char __user *str, long n);
168__must_check long __strnlen_user(const char __user *str, long n);
169__must_check long strlen_user(const char __user *str);
170__must_check unsigned long clear_user(void __user *mem, unsigned long len);
171__must_check unsigned long __clear_user(void __user *mem, unsigned long len);
172
173__must_check long __copy_from_user_inatomic(void *dst, const void __user *src,
174 unsigned size);
175
176static __must_check __always_inline int
177__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
178{
179 return copy_user_generic((__force void *)dst, src, size);
180}
181
182extern long __copy_user_nocache(void *dst, const void __user *src,
183 unsigned size, int zerorest);
184
185static inline int __copy_from_user_nocache(void *dst, const void __user *src,
186 unsigned size)
187{
188 might_sleep();
189 return __copy_user_nocache(dst, src, size, 1);
190}
191
192static inline int __copy_from_user_inatomic_nocache(void *dst,
193 const void __user *src,
194 unsigned size)
195{
196 return __copy_user_nocache(dst, src, size, 0);
197}
198
199unsigned long
200copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest);
201
202#endif /* __X86_64_UACCESS_H */
diff --git a/include/asm-x86/ucontext.h b/include/asm-x86/ucontext.h
deleted file mode 100644
index 50a79f7fcde9..000000000000
--- a/include/asm-x86/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_X86_UCONTEXT_H
2#define _ASM_X86_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* _ASM_X86_UCONTEXT_H */
diff --git a/include/asm-x86/unaligned.h b/include/asm-x86/unaligned.h
deleted file mode 100644
index a7bd416b4763..000000000000
--- a/include/asm-x86/unaligned.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef _ASM_X86_UNALIGNED_H
2#define _ASM_X86_UNALIGNED_H
3
4/*
5 * The x86 can do unaligned accesses itself.
6 */
7
8#include <linux/unaligned/access_ok.h>
9#include <linux/unaligned/generic.h>
10
11#define get_unaligned __get_unaligned_le
12#define put_unaligned __put_unaligned_le
13
14#endif /* _ASM_X86_UNALIGNED_H */
diff --git a/include/asm-x86/unistd.h b/include/asm-x86/unistd.h
deleted file mode 100644
index 2a58ed3e51d8..000000000000
--- a/include/asm-x86/unistd.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifdef __KERNEL__
2# ifdef CONFIG_X86_32
3# include "unistd_32.h"
4# else
5# include "unistd_64.h"
6# endif
7#else
8# ifdef __i386__
9# include "unistd_32.h"
10# else
11# include "unistd_64.h"
12# endif
13#endif
diff --git a/include/asm-x86/unistd_32.h b/include/asm-x86/unistd_32.h
deleted file mode 100644
index d7394673b772..000000000000
--- a/include/asm-x86/unistd_32.h
+++ /dev/null
@@ -1,379 +0,0 @@
1#ifndef _ASM_I386_UNISTD_H_
2#define _ASM_I386_UNISTD_H_
3
4/*
5 * This file contains the system call numbers.
6 */
7
8#define __NR_restart_syscall 0
9#define __NR_exit 1
10#define __NR_fork 2
11#define __NR_read 3
12#define __NR_write 4
13#define __NR_open 5
14#define __NR_close 6
15#define __NR_waitpid 7
16#define __NR_creat 8
17#define __NR_link 9
18#define __NR_unlink 10
19#define __NR_execve 11
20#define __NR_chdir 12
21#define __NR_time 13
22#define __NR_mknod 14
23#define __NR_chmod 15
24#define __NR_lchown 16
25#define __NR_break 17
26#define __NR_oldstat 18
27#define __NR_lseek 19
28#define __NR_getpid 20
29#define __NR_mount 21
30#define __NR_umount 22
31#define __NR_setuid 23
32#define __NR_getuid 24
33#define __NR_stime 25
34#define __NR_ptrace 26
35#define __NR_alarm 27
36#define __NR_oldfstat 28
37#define __NR_pause 29
38#define __NR_utime 30
39#define __NR_stty 31
40#define __NR_gtty 32
41#define __NR_access 33
42#define __NR_nice 34
43#define __NR_ftime 35
44#define __NR_sync 36
45#define __NR_kill 37
46#define __NR_rename 38
47#define __NR_mkdir 39
48#define __NR_rmdir 40
49#define __NR_dup 41
50#define __NR_pipe 42
51#define __NR_times 43
52#define __NR_prof 44
53#define __NR_brk 45
54#define __NR_setgid 46
55#define __NR_getgid 47
56#define __NR_signal 48
57#define __NR_geteuid 49
58#define __NR_getegid 50
59#define __NR_acct 51
60#define __NR_umount2 52
61#define __NR_lock 53
62#define __NR_ioctl 54
63#define __NR_fcntl 55
64#define __NR_mpx 56
65#define __NR_setpgid 57
66#define __NR_ulimit 58
67#define __NR_oldolduname 59
68#define __NR_umask 60
69#define __NR_chroot 61
70#define __NR_ustat 62
71#define __NR_dup2 63
72#define __NR_getppid 64
73#define __NR_getpgrp 65
74#define __NR_setsid 66
75#define __NR_sigaction 67
76#define __NR_sgetmask 68
77#define __NR_ssetmask 69
78#define __NR_setreuid 70
79#define __NR_setregid 71
80#define __NR_sigsuspend 72
81#define __NR_sigpending 73
82#define __NR_sethostname 74
83#define __NR_setrlimit 75
84#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
85#define __NR_getrusage 77
86#define __NR_gettimeofday 78
87#define __NR_settimeofday 79
88#define __NR_getgroups 80
89#define __NR_setgroups 81
90#define __NR_select 82
91#define __NR_symlink 83
92#define __NR_oldlstat 84
93#define __NR_readlink 85
94#define __NR_uselib 86
95#define __NR_swapon 87
96#define __NR_reboot 88
97#define __NR_readdir 89
98#define __NR_mmap 90
99#define __NR_munmap 91
100#define __NR_truncate 92
101#define __NR_ftruncate 93
102#define __NR_fchmod 94
103#define __NR_fchown 95
104#define __NR_getpriority 96
105#define __NR_setpriority 97
106#define __NR_profil 98
107#define __NR_statfs 99
108#define __NR_fstatfs 100
109#define __NR_ioperm 101
110#define __NR_socketcall 102
111#define __NR_syslog 103
112#define __NR_setitimer 104
113#define __NR_getitimer 105
114#define __NR_stat 106
115#define __NR_lstat 107
116#define __NR_fstat 108
117#define __NR_olduname 109
118#define __NR_iopl 110
119#define __NR_vhangup 111
120#define __NR_idle 112
121#define __NR_vm86old 113
122#define __NR_wait4 114
123#define __NR_swapoff 115
124#define __NR_sysinfo 116
125#define __NR_ipc 117
126#define __NR_fsync 118
127#define __NR_sigreturn 119
128#define __NR_clone 120
129#define __NR_setdomainname 121
130#define __NR_uname 122
131#define __NR_modify_ldt 123
132#define __NR_adjtimex 124
133#define __NR_mprotect 125
134#define __NR_sigprocmask 126
135#define __NR_create_module 127
136#define __NR_init_module 128
137#define __NR_delete_module 129
138#define __NR_get_kernel_syms 130
139#define __NR_quotactl 131
140#define __NR_getpgid 132
141#define __NR_fchdir 133
142#define __NR_bdflush 134
143#define __NR_sysfs 135
144#define __NR_personality 136
145#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
146#define __NR_setfsuid 138
147#define __NR_setfsgid 139
148#define __NR__llseek 140
149#define __NR_getdents 141
150#define __NR__newselect 142
151#define __NR_flock 143
152#define __NR_msync 144
153#define __NR_readv 145
154#define __NR_writev 146
155#define __NR_getsid 147
156#define __NR_fdatasync 148
157#define __NR__sysctl 149
158#define __NR_mlock 150
159#define __NR_munlock 151
160#define __NR_mlockall 152
161#define __NR_munlockall 153
162#define __NR_sched_setparam 154
163#define __NR_sched_getparam 155
164#define __NR_sched_setscheduler 156
165#define __NR_sched_getscheduler 157
166#define __NR_sched_yield 158
167#define __NR_sched_get_priority_max 159
168#define __NR_sched_get_priority_min 160
169#define __NR_sched_rr_get_interval 161
170#define __NR_nanosleep 162
171#define __NR_mremap 163
172#define __NR_setresuid 164
173#define __NR_getresuid 165
174#define __NR_vm86 166
175#define __NR_query_module 167
176#define __NR_poll 168
177#define __NR_nfsservctl 169
178#define __NR_setresgid 170
179#define __NR_getresgid 171
180#define __NR_prctl 172
181#define __NR_rt_sigreturn 173
182#define __NR_rt_sigaction 174
183#define __NR_rt_sigprocmask 175
184#define __NR_rt_sigpending 176
185#define __NR_rt_sigtimedwait 177
186#define __NR_rt_sigqueueinfo 178
187#define __NR_rt_sigsuspend 179
188#define __NR_pread64 180
189#define __NR_pwrite64 181
190#define __NR_chown 182
191#define __NR_getcwd 183
192#define __NR_capget 184
193#define __NR_capset 185
194#define __NR_sigaltstack 186
195#define __NR_sendfile 187
196#define __NR_getpmsg 188 /* some people actually want streams */
197#define __NR_putpmsg 189 /* some people actually want streams */
198#define __NR_vfork 190
199#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
200#define __NR_mmap2 192
201#define __NR_truncate64 193
202#define __NR_ftruncate64 194
203#define __NR_stat64 195
204#define __NR_lstat64 196
205#define __NR_fstat64 197
206#define __NR_lchown32 198
207#define __NR_getuid32 199
208#define __NR_getgid32 200
209#define __NR_geteuid32 201
210#define __NR_getegid32 202
211#define __NR_setreuid32 203
212#define __NR_setregid32 204
213#define __NR_getgroups32 205
214#define __NR_setgroups32 206
215#define __NR_fchown32 207
216#define __NR_setresuid32 208
217#define __NR_getresuid32 209
218#define __NR_setresgid32 210
219#define __NR_getresgid32 211
220#define __NR_chown32 212
221#define __NR_setuid32 213
222#define __NR_setgid32 214
223#define __NR_setfsuid32 215
224#define __NR_setfsgid32 216
225#define __NR_pivot_root 217
226#define __NR_mincore 218
227#define __NR_madvise 219
228#define __NR_madvise1 219 /* delete when C lib stub is removed */
229#define __NR_getdents64 220
230#define __NR_fcntl64 221
231/* 223 is unused */
232#define __NR_gettid 224
233#define __NR_readahead 225
234#define __NR_setxattr 226
235#define __NR_lsetxattr 227
236#define __NR_fsetxattr 228
237#define __NR_getxattr 229
238#define __NR_lgetxattr 230
239#define __NR_fgetxattr 231
240#define __NR_listxattr 232
241#define __NR_llistxattr 233
242#define __NR_flistxattr 234
243#define __NR_removexattr 235
244#define __NR_lremovexattr 236
245#define __NR_fremovexattr 237
246#define __NR_tkill 238
247#define __NR_sendfile64 239
248#define __NR_futex 240
249#define __NR_sched_setaffinity 241
250#define __NR_sched_getaffinity 242
251#define __NR_set_thread_area 243
252#define __NR_get_thread_area 244
253#define __NR_io_setup 245
254#define __NR_io_destroy 246
255#define __NR_io_getevents 247
256#define __NR_io_submit 248
257#define __NR_io_cancel 249
258#define __NR_fadvise64 250
259/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
260#define __NR_exit_group 252
261#define __NR_lookup_dcookie 253
262#define __NR_epoll_create 254
263#define __NR_epoll_ctl 255
264#define __NR_epoll_wait 256
265#define __NR_remap_file_pages 257
266#define __NR_set_tid_address 258
267#define __NR_timer_create 259
268#define __NR_timer_settime (__NR_timer_create+1)
269#define __NR_timer_gettime (__NR_timer_create+2)
270#define __NR_timer_getoverrun (__NR_timer_create+3)
271#define __NR_timer_delete (__NR_timer_create+4)
272#define __NR_clock_settime (__NR_timer_create+5)
273#define __NR_clock_gettime (__NR_timer_create+6)
274#define __NR_clock_getres (__NR_timer_create+7)
275#define __NR_clock_nanosleep (__NR_timer_create+8)
276#define __NR_statfs64 268
277#define __NR_fstatfs64 269
278#define __NR_tgkill 270
279#define __NR_utimes 271
280#define __NR_fadvise64_64 272
281#define __NR_vserver 273
282#define __NR_mbind 274
283#define __NR_get_mempolicy 275
284#define __NR_set_mempolicy 276
285#define __NR_mq_open 277
286#define __NR_mq_unlink (__NR_mq_open+1)
287#define __NR_mq_timedsend (__NR_mq_open+2)
288#define __NR_mq_timedreceive (__NR_mq_open+3)
289#define __NR_mq_notify (__NR_mq_open+4)
290#define __NR_mq_getsetattr (__NR_mq_open+5)
291#define __NR_kexec_load 283
292#define __NR_waitid 284
293/* #define __NR_sys_setaltroot 285 */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_fstatat64 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_splice 313
322#define __NR_sync_file_range 314
323#define __NR_tee 315
324#define __NR_vmsplice 316
325#define __NR_move_pages 317
326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320
329#define __NR_signalfd 321
330#define __NR_timerfd_create 322
331#define __NR_eventfd 323
332#define __NR_fallocate 324
333#define __NR_timerfd_settime 325
334#define __NR_timerfd_gettime 326
335#define __NR_signalfd4 327
336#define __NR_eventfd2 328
337#define __NR_epoll_create1 329
338#define __NR_dup3 330
339#define __NR_pipe2 331
340#define __NR_inotify_init1 332
341
342#ifdef __KERNEL__
343
344#define __ARCH_WANT_IPC_PARSE_VERSION
345#define __ARCH_WANT_OLD_READDIR
346#define __ARCH_WANT_OLD_STAT
347#define __ARCH_WANT_STAT64
348#define __ARCH_WANT_SYS_ALARM
349#define __ARCH_WANT_SYS_GETHOSTNAME
350#define __ARCH_WANT_SYS_PAUSE
351#define __ARCH_WANT_SYS_SGETMASK
352#define __ARCH_WANT_SYS_SIGNAL
353#define __ARCH_WANT_SYS_TIME
354#define __ARCH_WANT_SYS_UTIME
355#define __ARCH_WANT_SYS_WAITPID
356#define __ARCH_WANT_SYS_SOCKETCALL
357#define __ARCH_WANT_SYS_FADVISE64
358#define __ARCH_WANT_SYS_GETPGRP
359#define __ARCH_WANT_SYS_LLSEEK
360#define __ARCH_WANT_SYS_NICE
361#define __ARCH_WANT_SYS_OLD_GETRLIMIT
362#define __ARCH_WANT_SYS_OLDUMOUNT
363#define __ARCH_WANT_SYS_SIGPENDING
364#define __ARCH_WANT_SYS_SIGPROCMASK
365#define __ARCH_WANT_SYS_RT_SIGACTION
366#define __ARCH_WANT_SYS_RT_SIGSUSPEND
367
368/*
369 * "Conditional" syscalls
370 *
371 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
372 * but it doesn't work on all toolchains, so we just do it by hand
373 */
374#ifndef cond_syscall
375#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
376#endif
377
378#endif /* __KERNEL__ */
379#endif /* _ASM_I386_UNISTD_H_ */
diff --git a/include/asm-x86/unistd_64.h b/include/asm-x86/unistd_64.h
deleted file mode 100644
index 3a341d791792..000000000000
--- a/include/asm-x86/unistd_64.h
+++ /dev/null
@@ -1,693 +0,0 @@
1#ifndef _ASM_X86_64_UNISTD_H_
2#define _ASM_X86_64_UNISTD_H_
3
4#ifndef __SYSCALL
5#define __SYSCALL(a, b)
6#endif
7
8/*
9 * This file contains the system call numbers.
10 *
11 * Note: holes are not allowed.
12 */
13
14/* at least 8 syscall per cacheline */
15#define __NR_read 0
16__SYSCALL(__NR_read, sys_read)
17#define __NR_write 1
18__SYSCALL(__NR_write, sys_write)
19#define __NR_open 2
20__SYSCALL(__NR_open, sys_open)
21#define __NR_close 3
22__SYSCALL(__NR_close, sys_close)
23#define __NR_stat 4
24__SYSCALL(__NR_stat, sys_newstat)
25#define __NR_fstat 5
26__SYSCALL(__NR_fstat, sys_newfstat)
27#define __NR_lstat 6
28__SYSCALL(__NR_lstat, sys_newlstat)
29#define __NR_poll 7
30__SYSCALL(__NR_poll, sys_poll)
31
32#define __NR_lseek 8
33__SYSCALL(__NR_lseek, sys_lseek)
34#define __NR_mmap 9
35__SYSCALL(__NR_mmap, sys_mmap)
36#define __NR_mprotect 10
37__SYSCALL(__NR_mprotect, sys_mprotect)
38#define __NR_munmap 11
39__SYSCALL(__NR_munmap, sys_munmap)
40#define __NR_brk 12
41__SYSCALL(__NR_brk, sys_brk)
42#define __NR_rt_sigaction 13
43__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction)
44#define __NR_rt_sigprocmask 14
45__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
46#define __NR_rt_sigreturn 15
47__SYSCALL(__NR_rt_sigreturn, stub_rt_sigreturn)
48
49#define __NR_ioctl 16
50__SYSCALL(__NR_ioctl, sys_ioctl)
51#define __NR_pread64 17
52__SYSCALL(__NR_pread64, sys_pread64)
53#define __NR_pwrite64 18
54__SYSCALL(__NR_pwrite64, sys_pwrite64)
55#define __NR_readv 19
56__SYSCALL(__NR_readv, sys_readv)
57#define __NR_writev 20
58__SYSCALL(__NR_writev, sys_writev)
59#define __NR_access 21
60__SYSCALL(__NR_access, sys_access)
61#define __NR_pipe 22
62__SYSCALL(__NR_pipe, sys_pipe)
63#define __NR_select 23
64__SYSCALL(__NR_select, sys_select)
65
66#define __NR_sched_yield 24
67__SYSCALL(__NR_sched_yield, sys_sched_yield)
68#define __NR_mremap 25
69__SYSCALL(__NR_mremap, sys_mremap)
70#define __NR_msync 26
71__SYSCALL(__NR_msync, sys_msync)
72#define __NR_mincore 27
73__SYSCALL(__NR_mincore, sys_mincore)
74#define __NR_madvise 28
75__SYSCALL(__NR_madvise, sys_madvise)
76#define __NR_shmget 29
77__SYSCALL(__NR_shmget, sys_shmget)
78#define __NR_shmat 30
79__SYSCALL(__NR_shmat, sys_shmat)
80#define __NR_shmctl 31
81__SYSCALL(__NR_shmctl, sys_shmctl)
82
83#define __NR_dup 32
84__SYSCALL(__NR_dup, sys_dup)
85#define __NR_dup2 33
86__SYSCALL(__NR_dup2, sys_dup2)
87#define __NR_pause 34
88__SYSCALL(__NR_pause, sys_pause)
89#define __NR_nanosleep 35
90__SYSCALL(__NR_nanosleep, sys_nanosleep)
91#define __NR_getitimer 36
92__SYSCALL(__NR_getitimer, sys_getitimer)
93#define __NR_alarm 37
94__SYSCALL(__NR_alarm, sys_alarm)
95#define __NR_setitimer 38
96__SYSCALL(__NR_setitimer, sys_setitimer)
97#define __NR_getpid 39
98__SYSCALL(__NR_getpid, sys_getpid)
99
100#define __NR_sendfile 40
101__SYSCALL(__NR_sendfile, sys_sendfile64)
102#define __NR_socket 41
103__SYSCALL(__NR_socket, sys_socket)
104#define __NR_connect 42
105__SYSCALL(__NR_connect, sys_connect)
106#define __NR_accept 43
107__SYSCALL(__NR_accept, sys_accept)
108#define __NR_sendto 44
109__SYSCALL(__NR_sendto, sys_sendto)
110#define __NR_recvfrom 45
111__SYSCALL(__NR_recvfrom, sys_recvfrom)
112#define __NR_sendmsg 46
113__SYSCALL(__NR_sendmsg, sys_sendmsg)
114#define __NR_recvmsg 47
115__SYSCALL(__NR_recvmsg, sys_recvmsg)
116
117#define __NR_shutdown 48
118__SYSCALL(__NR_shutdown, sys_shutdown)
119#define __NR_bind 49
120__SYSCALL(__NR_bind, sys_bind)
121#define __NR_listen 50
122__SYSCALL(__NR_listen, sys_listen)
123#define __NR_getsockname 51
124__SYSCALL(__NR_getsockname, sys_getsockname)
125#define __NR_getpeername 52
126__SYSCALL(__NR_getpeername, sys_getpeername)
127#define __NR_socketpair 53
128__SYSCALL(__NR_socketpair, sys_socketpair)
129#define __NR_setsockopt 54
130__SYSCALL(__NR_setsockopt, sys_setsockopt)
131#define __NR_getsockopt 55
132__SYSCALL(__NR_getsockopt, sys_getsockopt)
133
134#define __NR_clone 56
135__SYSCALL(__NR_clone, stub_clone)
136#define __NR_fork 57
137__SYSCALL(__NR_fork, stub_fork)
138#define __NR_vfork 58
139__SYSCALL(__NR_vfork, stub_vfork)
140#define __NR_execve 59
141__SYSCALL(__NR_execve, stub_execve)
142#define __NR_exit 60
143__SYSCALL(__NR_exit, sys_exit)
144#define __NR_wait4 61
145__SYSCALL(__NR_wait4, sys_wait4)
146#define __NR_kill 62
147__SYSCALL(__NR_kill, sys_kill)
148#define __NR_uname 63
149__SYSCALL(__NR_uname, sys_uname)
150
151#define __NR_semget 64
152__SYSCALL(__NR_semget, sys_semget)
153#define __NR_semop 65
154__SYSCALL(__NR_semop, sys_semop)
155#define __NR_semctl 66
156__SYSCALL(__NR_semctl, sys_semctl)
157#define __NR_shmdt 67
158__SYSCALL(__NR_shmdt, sys_shmdt)
159#define __NR_msgget 68
160__SYSCALL(__NR_msgget, sys_msgget)
161#define __NR_msgsnd 69
162__SYSCALL(__NR_msgsnd, sys_msgsnd)
163#define __NR_msgrcv 70
164__SYSCALL(__NR_msgrcv, sys_msgrcv)
165#define __NR_msgctl 71
166__SYSCALL(__NR_msgctl, sys_msgctl)
167
168#define __NR_fcntl 72
169__SYSCALL(__NR_fcntl, sys_fcntl)
170#define __NR_flock 73
171__SYSCALL(__NR_flock, sys_flock)
172#define __NR_fsync 74
173__SYSCALL(__NR_fsync, sys_fsync)
174#define __NR_fdatasync 75
175__SYSCALL(__NR_fdatasync, sys_fdatasync)
176#define __NR_truncate 76
177__SYSCALL(__NR_truncate, sys_truncate)
178#define __NR_ftruncate 77
179__SYSCALL(__NR_ftruncate, sys_ftruncate)
180#define __NR_getdents 78
181__SYSCALL(__NR_getdents, sys_getdents)
182#define __NR_getcwd 79
183__SYSCALL(__NR_getcwd, sys_getcwd)
184
185#define __NR_chdir 80
186__SYSCALL(__NR_chdir, sys_chdir)
187#define __NR_fchdir 81
188__SYSCALL(__NR_fchdir, sys_fchdir)
189#define __NR_rename 82
190__SYSCALL(__NR_rename, sys_rename)
191#define __NR_mkdir 83
192__SYSCALL(__NR_mkdir, sys_mkdir)
193#define __NR_rmdir 84
194__SYSCALL(__NR_rmdir, sys_rmdir)
195#define __NR_creat 85
196__SYSCALL(__NR_creat, sys_creat)
197#define __NR_link 86
198__SYSCALL(__NR_link, sys_link)
199#define __NR_unlink 87
200__SYSCALL(__NR_unlink, sys_unlink)
201
202#define __NR_symlink 88
203__SYSCALL(__NR_symlink, sys_symlink)
204#define __NR_readlink 89
205__SYSCALL(__NR_readlink, sys_readlink)
206#define __NR_chmod 90
207__SYSCALL(__NR_chmod, sys_chmod)
208#define __NR_fchmod 91
209__SYSCALL(__NR_fchmod, sys_fchmod)
210#define __NR_chown 92
211__SYSCALL(__NR_chown, sys_chown)
212#define __NR_fchown 93
213__SYSCALL(__NR_fchown, sys_fchown)
214#define __NR_lchown 94
215__SYSCALL(__NR_lchown, sys_lchown)
216#define __NR_umask 95
217__SYSCALL(__NR_umask, sys_umask)
218
219#define __NR_gettimeofday 96
220__SYSCALL(__NR_gettimeofday, sys_gettimeofday)
221#define __NR_getrlimit 97
222__SYSCALL(__NR_getrlimit, sys_getrlimit)
223#define __NR_getrusage 98
224__SYSCALL(__NR_getrusage, sys_getrusage)
225#define __NR_sysinfo 99
226__SYSCALL(__NR_sysinfo, sys_sysinfo)
227#define __NR_times 100
228__SYSCALL(__NR_times, sys_times)
229#define __NR_ptrace 101
230__SYSCALL(__NR_ptrace, sys_ptrace)
231#define __NR_getuid 102
232__SYSCALL(__NR_getuid, sys_getuid)
233#define __NR_syslog 103
234__SYSCALL(__NR_syslog, sys_syslog)
235
236/* at the very end the stuff that never runs during the benchmarks */
237#define __NR_getgid 104
238__SYSCALL(__NR_getgid, sys_getgid)
239#define __NR_setuid 105
240__SYSCALL(__NR_setuid, sys_setuid)
241#define __NR_setgid 106
242__SYSCALL(__NR_setgid, sys_setgid)
243#define __NR_geteuid 107
244__SYSCALL(__NR_geteuid, sys_geteuid)
245#define __NR_getegid 108
246__SYSCALL(__NR_getegid, sys_getegid)
247#define __NR_setpgid 109
248__SYSCALL(__NR_setpgid, sys_setpgid)
249#define __NR_getppid 110
250__SYSCALL(__NR_getppid, sys_getppid)
251#define __NR_getpgrp 111
252__SYSCALL(__NR_getpgrp, sys_getpgrp)
253
254#define __NR_setsid 112
255__SYSCALL(__NR_setsid, sys_setsid)
256#define __NR_setreuid 113
257__SYSCALL(__NR_setreuid, sys_setreuid)
258#define __NR_setregid 114
259__SYSCALL(__NR_setregid, sys_setregid)
260#define __NR_getgroups 115
261__SYSCALL(__NR_getgroups, sys_getgroups)
262#define __NR_setgroups 116
263__SYSCALL(__NR_setgroups, sys_setgroups)
264#define __NR_setresuid 117
265__SYSCALL(__NR_setresuid, sys_setresuid)
266#define __NR_getresuid 118
267__SYSCALL(__NR_getresuid, sys_getresuid)
268#define __NR_setresgid 119
269__SYSCALL(__NR_setresgid, sys_setresgid)
270
271#define __NR_getresgid 120
272__SYSCALL(__NR_getresgid, sys_getresgid)
273#define __NR_getpgid 121
274__SYSCALL(__NR_getpgid, sys_getpgid)
275#define __NR_setfsuid 122
276__SYSCALL(__NR_setfsuid, sys_setfsuid)
277#define __NR_setfsgid 123
278__SYSCALL(__NR_setfsgid, sys_setfsgid)
279#define __NR_getsid 124
280__SYSCALL(__NR_getsid, sys_getsid)
281#define __NR_capget 125
282__SYSCALL(__NR_capget, sys_capget)
283#define __NR_capset 126
284__SYSCALL(__NR_capset, sys_capset)
285
286#define __NR_rt_sigpending 127
287__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
288#define __NR_rt_sigtimedwait 128
289__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait)
290#define __NR_rt_sigqueueinfo 129
291__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo)
292#define __NR_rt_sigsuspend 130
293__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend)
294#define __NR_sigaltstack 131
295__SYSCALL(__NR_sigaltstack, stub_sigaltstack)
296#define __NR_utime 132
297__SYSCALL(__NR_utime, sys_utime)
298#define __NR_mknod 133
299__SYSCALL(__NR_mknod, sys_mknod)
300
301/* Only needed for a.out */
302#define __NR_uselib 134
303__SYSCALL(__NR_uselib, sys_ni_syscall)
304#define __NR_personality 135
305__SYSCALL(__NR_personality, sys_personality)
306
307#define __NR_ustat 136
308__SYSCALL(__NR_ustat, sys_ustat)
309#define __NR_statfs 137
310__SYSCALL(__NR_statfs, sys_statfs)
311#define __NR_fstatfs 138
312__SYSCALL(__NR_fstatfs, sys_fstatfs)
313#define __NR_sysfs 139
314__SYSCALL(__NR_sysfs, sys_sysfs)
315
316#define __NR_getpriority 140
317__SYSCALL(__NR_getpriority, sys_getpriority)
318#define __NR_setpriority 141
319__SYSCALL(__NR_setpriority, sys_setpriority)
320#define __NR_sched_setparam 142
321__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
322#define __NR_sched_getparam 143
323__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
324#define __NR_sched_setscheduler 144
325__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
326#define __NR_sched_getscheduler 145
327__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
328#define __NR_sched_get_priority_max 146
329__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
330#define __NR_sched_get_priority_min 147
331__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
332#define __NR_sched_rr_get_interval 148
333__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
334
335#define __NR_mlock 149
336__SYSCALL(__NR_mlock, sys_mlock)
337#define __NR_munlock 150
338__SYSCALL(__NR_munlock, sys_munlock)
339#define __NR_mlockall 151
340__SYSCALL(__NR_mlockall, sys_mlockall)
341#define __NR_munlockall 152
342__SYSCALL(__NR_munlockall, sys_munlockall)
343
344#define __NR_vhangup 153
345__SYSCALL(__NR_vhangup, sys_vhangup)
346
347#define __NR_modify_ldt 154
348__SYSCALL(__NR_modify_ldt, sys_modify_ldt)
349
350#define __NR_pivot_root 155
351__SYSCALL(__NR_pivot_root, sys_pivot_root)
352
353#define __NR__sysctl 156
354__SYSCALL(__NR__sysctl, sys_sysctl)
355
356#define __NR_prctl 157
357__SYSCALL(__NR_prctl, sys_prctl)
358#define __NR_arch_prctl 158
359__SYSCALL(__NR_arch_prctl, sys_arch_prctl)
360
361#define __NR_adjtimex 159
362__SYSCALL(__NR_adjtimex, sys_adjtimex)
363
364#define __NR_setrlimit 160
365__SYSCALL(__NR_setrlimit, sys_setrlimit)
366
367#define __NR_chroot 161
368__SYSCALL(__NR_chroot, sys_chroot)
369
370#define __NR_sync 162
371__SYSCALL(__NR_sync, sys_sync)
372
373#define __NR_acct 163
374__SYSCALL(__NR_acct, sys_acct)
375
376#define __NR_settimeofday 164
377__SYSCALL(__NR_settimeofday, sys_settimeofday)
378
379#define __NR_mount 165
380__SYSCALL(__NR_mount, sys_mount)
381#define __NR_umount2 166
382__SYSCALL(__NR_umount2, sys_umount)
383
384#define __NR_swapon 167
385__SYSCALL(__NR_swapon, sys_swapon)
386#define __NR_swapoff 168
387__SYSCALL(__NR_swapoff, sys_swapoff)
388
389#define __NR_reboot 169
390__SYSCALL(__NR_reboot, sys_reboot)
391
392#define __NR_sethostname 170
393__SYSCALL(__NR_sethostname, sys_sethostname)
394#define __NR_setdomainname 171
395__SYSCALL(__NR_setdomainname, sys_setdomainname)
396
397#define __NR_iopl 172
398__SYSCALL(__NR_iopl, stub_iopl)
399#define __NR_ioperm 173
400__SYSCALL(__NR_ioperm, sys_ioperm)
401
402#define __NR_create_module 174
403__SYSCALL(__NR_create_module, sys_ni_syscall)
404#define __NR_init_module 175
405__SYSCALL(__NR_init_module, sys_init_module)
406#define __NR_delete_module 176
407__SYSCALL(__NR_delete_module, sys_delete_module)
408#define __NR_get_kernel_syms 177
409__SYSCALL(__NR_get_kernel_syms, sys_ni_syscall)
410#define __NR_query_module 178
411__SYSCALL(__NR_query_module, sys_ni_syscall)
412
413#define __NR_quotactl 179
414__SYSCALL(__NR_quotactl, sys_quotactl)
415
416#define __NR_nfsservctl 180
417__SYSCALL(__NR_nfsservctl, sys_nfsservctl)
418
419/* reserved for LiS/STREAMS */
420#define __NR_getpmsg 181
421__SYSCALL(__NR_getpmsg, sys_ni_syscall)
422#define __NR_putpmsg 182
423__SYSCALL(__NR_putpmsg, sys_ni_syscall)
424
425/* reserved for AFS */
426#define __NR_afs_syscall 183
427__SYSCALL(__NR_afs_syscall, sys_ni_syscall)
428
429/* reserved for tux */
430#define __NR_tuxcall 184
431__SYSCALL(__NR_tuxcall, sys_ni_syscall)
432
433#define __NR_security 185
434__SYSCALL(__NR_security, sys_ni_syscall)
435
436#define __NR_gettid 186
437__SYSCALL(__NR_gettid, sys_gettid)
438
439#define __NR_readahead 187
440__SYSCALL(__NR_readahead, sys_readahead)
441#define __NR_setxattr 188
442__SYSCALL(__NR_setxattr, sys_setxattr)
443#define __NR_lsetxattr 189
444__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
445#define __NR_fsetxattr 190
446__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
447#define __NR_getxattr 191
448__SYSCALL(__NR_getxattr, sys_getxattr)
449#define __NR_lgetxattr 192
450__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
451#define __NR_fgetxattr 193
452__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
453#define __NR_listxattr 194
454__SYSCALL(__NR_listxattr, sys_listxattr)
455#define __NR_llistxattr 195
456__SYSCALL(__NR_llistxattr, sys_llistxattr)
457#define __NR_flistxattr 196
458__SYSCALL(__NR_flistxattr, sys_flistxattr)
459#define __NR_removexattr 197
460__SYSCALL(__NR_removexattr, sys_removexattr)
461#define __NR_lremovexattr 198
462__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
463#define __NR_fremovexattr 199
464__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
465#define __NR_tkill 200
466__SYSCALL(__NR_tkill, sys_tkill)
467#define __NR_time 201
468__SYSCALL(__NR_time, sys_time)
469#define __NR_futex 202
470__SYSCALL(__NR_futex, sys_futex)
471#define __NR_sched_setaffinity 203
472__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
473#define __NR_sched_getaffinity 204
474__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
475#define __NR_set_thread_area 205
476__SYSCALL(__NR_set_thread_area, sys_ni_syscall) /* use arch_prctl */
477#define __NR_io_setup 206
478__SYSCALL(__NR_io_setup, sys_io_setup)
479#define __NR_io_destroy 207
480__SYSCALL(__NR_io_destroy, sys_io_destroy)
481#define __NR_io_getevents 208
482__SYSCALL(__NR_io_getevents, sys_io_getevents)
483#define __NR_io_submit 209
484__SYSCALL(__NR_io_submit, sys_io_submit)
485#define __NR_io_cancel 210
486__SYSCALL(__NR_io_cancel, sys_io_cancel)
487#define __NR_get_thread_area 211
488__SYSCALL(__NR_get_thread_area, sys_ni_syscall) /* use arch_prctl */
489#define __NR_lookup_dcookie 212
490__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
491#define __NR_epoll_create 213
492__SYSCALL(__NR_epoll_create, sys_epoll_create)
493#define __NR_epoll_ctl_old 214
494__SYSCALL(__NR_epoll_ctl_old, sys_ni_syscall)
495#define __NR_epoll_wait_old 215
496__SYSCALL(__NR_epoll_wait_old, sys_ni_syscall)
497#define __NR_remap_file_pages 216
498__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
499#define __NR_getdents64 217
500__SYSCALL(__NR_getdents64, sys_getdents64)
501#define __NR_set_tid_address 218
502__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
503#define __NR_restart_syscall 219
504__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
505#define __NR_semtimedop 220
506__SYSCALL(__NR_semtimedop, sys_semtimedop)
507#define __NR_fadvise64 221
508__SYSCALL(__NR_fadvise64, sys_fadvise64)
509#define __NR_timer_create 222
510__SYSCALL(__NR_timer_create, sys_timer_create)
511#define __NR_timer_settime 223
512__SYSCALL(__NR_timer_settime, sys_timer_settime)
513#define __NR_timer_gettime 224
514__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
515#define __NR_timer_getoverrun 225
516__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
517#define __NR_timer_delete 226
518__SYSCALL(__NR_timer_delete, sys_timer_delete)
519#define __NR_clock_settime 227
520__SYSCALL(__NR_clock_settime, sys_clock_settime)
521#define __NR_clock_gettime 228
522__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
523#define __NR_clock_getres 229
524__SYSCALL(__NR_clock_getres, sys_clock_getres)
525#define __NR_clock_nanosleep 230
526__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
527#define __NR_exit_group 231
528__SYSCALL(__NR_exit_group, sys_exit_group)
529#define __NR_epoll_wait 232
530__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
531#define __NR_epoll_ctl 233
532__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
533#define __NR_tgkill 234
534__SYSCALL(__NR_tgkill, sys_tgkill)
535#define __NR_utimes 235
536__SYSCALL(__NR_utimes, sys_utimes)
537#define __NR_vserver 236
538__SYSCALL(__NR_vserver, sys_ni_syscall)
539#define __NR_mbind 237
540__SYSCALL(__NR_mbind, sys_mbind)
541#define __NR_set_mempolicy 238
542__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
543#define __NR_get_mempolicy 239
544__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
545#define __NR_mq_open 240
546__SYSCALL(__NR_mq_open, sys_mq_open)
547#define __NR_mq_unlink 241
548__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
549#define __NR_mq_timedsend 242
550__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
551#define __NR_mq_timedreceive 243
552__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
553#define __NR_mq_notify 244
554__SYSCALL(__NR_mq_notify, sys_mq_notify)
555#define __NR_mq_getsetattr 245
556__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
557#define __NR_kexec_load 246
558__SYSCALL(__NR_kexec_load, sys_kexec_load)
559#define __NR_waitid 247
560__SYSCALL(__NR_waitid, sys_waitid)
561#define __NR_add_key 248
562__SYSCALL(__NR_add_key, sys_add_key)
563#define __NR_request_key 249
564__SYSCALL(__NR_request_key, sys_request_key)
565#define __NR_keyctl 250
566__SYSCALL(__NR_keyctl, sys_keyctl)
567#define __NR_ioprio_set 251
568__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
569#define __NR_ioprio_get 252
570__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
571#define __NR_inotify_init 253
572__SYSCALL(__NR_inotify_init, sys_inotify_init)
573#define __NR_inotify_add_watch 254
574__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
575#define __NR_inotify_rm_watch 255
576__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
577#define __NR_migrate_pages 256
578__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
579#define __NR_openat 257
580__SYSCALL(__NR_openat, sys_openat)
581#define __NR_mkdirat 258
582__SYSCALL(__NR_mkdirat, sys_mkdirat)
583#define __NR_mknodat 259
584__SYSCALL(__NR_mknodat, sys_mknodat)
585#define __NR_fchownat 260
586__SYSCALL(__NR_fchownat, sys_fchownat)
587#define __NR_futimesat 261
588__SYSCALL(__NR_futimesat, sys_futimesat)
589#define __NR_newfstatat 262
590__SYSCALL(__NR_newfstatat, sys_newfstatat)
591#define __NR_unlinkat 263
592__SYSCALL(__NR_unlinkat, sys_unlinkat)
593#define __NR_renameat 264
594__SYSCALL(__NR_renameat, sys_renameat)
595#define __NR_linkat 265
596__SYSCALL(__NR_linkat, sys_linkat)
597#define __NR_symlinkat 266
598__SYSCALL(__NR_symlinkat, sys_symlinkat)
599#define __NR_readlinkat 267
600__SYSCALL(__NR_readlinkat, sys_readlinkat)
601#define __NR_fchmodat 268
602__SYSCALL(__NR_fchmodat, sys_fchmodat)
603#define __NR_faccessat 269
604__SYSCALL(__NR_faccessat, sys_faccessat)
605#define __NR_pselect6 270
606__SYSCALL(__NR_pselect6, sys_pselect6)
607#define __NR_ppoll 271
608__SYSCALL(__NR_ppoll, sys_ppoll)
609#define __NR_unshare 272
610__SYSCALL(__NR_unshare, sys_unshare)
611#define __NR_set_robust_list 273
612__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
613#define __NR_get_robust_list 274
614__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
615#define __NR_splice 275
616__SYSCALL(__NR_splice, sys_splice)
617#define __NR_tee 276
618__SYSCALL(__NR_tee, sys_tee)
619#define __NR_sync_file_range 277
620__SYSCALL(__NR_sync_file_range, sys_sync_file_range)
621#define __NR_vmsplice 278
622__SYSCALL(__NR_vmsplice, sys_vmsplice)
623#define __NR_move_pages 279
624__SYSCALL(__NR_move_pages, sys_move_pages)
625#define __NR_utimensat 280
626__SYSCALL(__NR_utimensat, sys_utimensat)
627#define __IGNORE_getcpu /* implemented as a vsyscall */
628#define __NR_epoll_pwait 281
629__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
630#define __NR_signalfd 282
631__SYSCALL(__NR_signalfd, sys_signalfd)
632#define __NR_timerfd_create 283
633__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
634#define __NR_eventfd 284
635__SYSCALL(__NR_eventfd, sys_eventfd)
636#define __NR_fallocate 285
637__SYSCALL(__NR_fallocate, sys_fallocate)
638#define __NR_timerfd_settime 286
639__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
640#define __NR_timerfd_gettime 287
641__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
642#define __NR_paccept 288
643__SYSCALL(__NR_paccept, sys_paccept)
644#define __NR_signalfd4 289
645__SYSCALL(__NR_signalfd4, sys_signalfd4)
646#define __NR_eventfd2 290
647__SYSCALL(__NR_eventfd2, sys_eventfd2)
648#define __NR_epoll_create1 291
649__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
650#define __NR_dup3 292
651__SYSCALL(__NR_dup3, sys_dup3)
652#define __NR_pipe2 293
653__SYSCALL(__NR_pipe2, sys_pipe2)
654#define __NR_inotify_init1 294
655__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
656
657
658#ifndef __NO_STUBS
659#define __ARCH_WANT_OLD_READDIR
660#define __ARCH_WANT_OLD_STAT
661#define __ARCH_WANT_SYS_ALARM
662#define __ARCH_WANT_SYS_GETHOSTNAME
663#define __ARCH_WANT_SYS_PAUSE
664#define __ARCH_WANT_SYS_SGETMASK
665#define __ARCH_WANT_SYS_SIGNAL
666#define __ARCH_WANT_SYS_UTIME
667#define __ARCH_WANT_SYS_WAITPID
668#define __ARCH_WANT_SYS_SOCKETCALL
669#define __ARCH_WANT_SYS_FADVISE64
670#define __ARCH_WANT_SYS_GETPGRP
671#define __ARCH_WANT_SYS_LLSEEK
672#define __ARCH_WANT_SYS_NICE
673#define __ARCH_WANT_SYS_OLD_GETRLIMIT
674#define __ARCH_WANT_SYS_OLDUMOUNT
675#define __ARCH_WANT_SYS_SIGPENDING
676#define __ARCH_WANT_SYS_SIGPROCMASK
677#define __ARCH_WANT_SYS_RT_SIGACTION
678#define __ARCH_WANT_SYS_RT_SIGSUSPEND
679#define __ARCH_WANT_SYS_TIME
680#define __ARCH_WANT_COMPAT_SYS_TIME
681#endif /* __NO_STUBS */
682
683#ifdef __KERNEL__
684/*
685 * "Conditional" syscalls
686 *
687 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
688 * but it doesn't work on all toolchains, so we just do it by hand
689 */
690#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
691#endif /* __KERNEL__ */
692
693#endif /* _ASM_X86_64_UNISTD_H_ */
diff --git a/include/asm-x86/unwind.h b/include/asm-x86/unwind.h
deleted file mode 100644
index 8b064bd9c553..000000000000
--- a/include/asm-x86/unwind.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_X86_UNWIND_H
2#define _ASM_X86_UNWIND_H
3
4#define UNW_PC(frame) ((void)(frame), 0UL)
5#define UNW_SP(frame) ((void)(frame), 0UL)
6#define UNW_FP(frame) ((void)(frame), 0UL)
7
8static inline int arch_unw_user_mode(const void *info)
9{
10 return 0;
11}
12
13#endif /* _ASM_X86_UNWIND_H */
diff --git a/include/asm-x86/user.h b/include/asm-x86/user.h
deleted file mode 100644
index 999873b22e7f..000000000000
--- a/include/asm-x86/user.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "user_32.h"
3#else
4# include "user_64.h"
5#endif
diff --git a/include/asm-x86/user32.h b/include/asm-x86/user32.h
deleted file mode 100644
index a3d910047879..000000000000
--- a/include/asm-x86/user32.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef USER32_H
2#define USER32_H 1
3
4/* IA32 compatible user structures for ptrace.
5 * These should be used for 32bit coredumps too. */
6
7struct user_i387_ia32_struct {
8 u32 cwd;
9 u32 swd;
10 u32 twd;
11 u32 fip;
12 u32 fcs;
13 u32 foo;
14 u32 fos;
15 u32 st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
16};
17
18/* FSAVE frame with extensions */
19struct user32_fxsr_struct {
20 unsigned short cwd;
21 unsigned short swd;
22 unsigned short twd; /* not compatible to 64bit twd */
23 unsigned short fop;
24 int fip;
25 int fcs;
26 int foo;
27 int fos;
28 int mxcsr;
29 int reserved;
30 int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
31 int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
32 int padding[56];
33};
34
35struct user_regs_struct32 {
36 __u32 ebx, ecx, edx, esi, edi, ebp, eax;
37 unsigned short ds, __ds, es, __es;
38 unsigned short fs, __fs, gs, __gs;
39 __u32 orig_eax, eip;
40 unsigned short cs, __cs;
41 __u32 eflags, esp;
42 unsigned short ss, __ss;
43};
44
45struct user32 {
46 struct user_regs_struct32 regs; /* Where the registers are actually stored */
47 int u_fpvalid; /* True if math co-processor being used. */
48 /* for this mess. Not yet used. */
49 struct user_i387_ia32_struct i387; /* Math Co-processor registers. */
50/* The rest of this junk is to help gdb figure out what goes where */
51 __u32 u_tsize; /* Text segment size (pages). */
52 __u32 u_dsize; /* Data segment size (pages). */
53 __u32 u_ssize; /* Stack segment size (pages). */
54 __u32 start_code; /* Starting virtual address of text. */
55 __u32 start_stack; /* Starting virtual address of stack area.
56 This is actually the bottom of the stack,
57 the top of the stack is always found in the
58 esp register. */
59 __u32 signal; /* Signal that caused the core dump. */
60 int reserved; /* No __u32er used */
61 __u32 u_ar0; /* Used by gdb to help find the values for */
62 /* the registers. */
63 __u32 u_fpstate; /* Math Co-processor pointer. */
64 __u32 magic; /* To uniquely identify a core file */
65 char u_comm[32]; /* User command that was responsible */
66 int u_debugreg[8];
67};
68
69
70#endif
diff --git a/include/asm-x86/user_32.h b/include/asm-x86/user_32.h
deleted file mode 100644
index d6e51edc259d..000000000000
--- a/include/asm-x86/user_32.h
+++ /dev/null
@@ -1,131 +0,0 @@
1#ifndef _I386_USER_H
2#define _I386_USER_H
3
4#include <asm/page.h>
5/* Core file format: The core file is written in such a way that gdb
6 can understand it and provide useful information to the user (under
7 linux we use the 'trad-core' bfd). There are quite a number of
8 obstacles to being able to view the contents of the floating point
9 registers, and until these are solved you will not be able to view the
10 contents of them. Actually, you can read in the core file and look at
11 the contents of the user struct to find out what the floating point
12 registers contain.
13 The actual file contents are as follows:
14 UPAGE: 1 page consisting of a user struct that tells gdb what is present
15 in the file. Directly after this is a copy of the task_struct, which
16 is currently not used by gdb, but it may come in useful at some point.
17 All of the registers are stored as part of the upage. The upage should
18 always be only one page.
19 DATA: The data area is stored. We use current->end_text to
20 current->brk to pick up all of the user variables, plus any memory
21 that may have been malloced. No attempt is made to determine if a page
22 is demand-zero or if a page is totally unused, we just cover the entire
23 range. All of the addresses are rounded in such a way that an integral
24 number of pages is written.
25 STACK: We need the stack information in order to get a meaningful
26 backtrace. We need to write the data from (esp) to
27 current->start_stack, so we round each of these off in order to be able
28 to write an integer number of pages.
29 The minimum core file size is 3 pages, or 12288 bytes.
30*/
31
32/*
33 * Pentium III FXSR, SSE support
34 * Gareth Hughes <gareth@valinux.com>, May 2000
35 *
36 * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for
37 * interacting with the FXSR-format floating point environment. Floating
38 * point data can be accessed in the regular format in the usual manner,
39 * and both the standard and SIMD floating point data can be accessed via
40 * the new ptrace requests. In either case, changes to the FPU environment
41 * will be reflected in the task's state as expected.
42 */
43
44struct user_i387_struct {
45 long cwd;
46 long swd;
47 long twd;
48 long fip;
49 long fcs;
50 long foo;
51 long fos;
52 long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
53};
54
55struct user_fxsr_struct {
56 unsigned short cwd;
57 unsigned short swd;
58 unsigned short twd;
59 unsigned short fop;
60 long fip;
61 long fcs;
62 long foo;
63 long fos;
64 long mxcsr;
65 long reserved;
66 long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
67 long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
68 long padding[56];
69};
70
71/*
72 * This is the old layout of "struct pt_regs", and
73 * is still the layout used by user mode (the new
74 * pt_regs doesn't have all registers as the kernel
75 * doesn't use the extra segment registers)
76 */
77struct user_regs_struct {
78 unsigned long bx;
79 unsigned long cx;
80 unsigned long dx;
81 unsigned long si;
82 unsigned long di;
83 unsigned long bp;
84 unsigned long ax;
85 unsigned long ds;
86 unsigned long es;
87 unsigned long fs;
88 unsigned long gs;
89 unsigned long orig_ax;
90 unsigned long ip;
91 unsigned long cs;
92 unsigned long flags;
93 unsigned long sp;
94 unsigned long ss;
95};
96
97/* When the kernel dumps core, it starts by dumping the user struct -
98 this will be used by gdb to figure out where the data and stack segments
99 are within the file, and what virtual addresses to use. */
100struct user{
101/* We start with the registers, to mimic the way that "memory" is returned
102 from the ptrace(3,...) function. */
103 struct user_regs_struct regs; /* Where the registers are actually stored */
104/* ptrace does not yet supply these. Someday.... */
105 int u_fpvalid; /* True if math co-processor being used. */
106 /* for this mess. Not yet used. */
107 struct user_i387_struct i387; /* Math Co-processor registers. */
108/* The rest of this junk is to help gdb figure out what goes where */
109 unsigned long int u_tsize; /* Text segment size (pages). */
110 unsigned long int u_dsize; /* Data segment size (pages). */
111 unsigned long int u_ssize; /* Stack segment size (pages). */
112 unsigned long start_code; /* Starting virtual address of text. */
113 unsigned long start_stack; /* Starting virtual address of stack area.
114 This is actually the bottom of the stack,
115 the top of the stack is always found in the
116 esp register. */
117 long int signal; /* Signal that caused the core dump. */
118 int reserved; /* No longer used */
119 unsigned long u_ar0; /* Used by gdb to help find the values for */
120 /* the registers. */
121 struct user_i387_struct *u_fpstate; /* Math Co-processor pointer. */
122 unsigned long magic; /* To uniquely identify a core file */
123 char u_comm[32]; /* User command that was responsible */
124 int u_debugreg[8];
125};
126#define NBPG PAGE_SIZE
127#define UPAGES 1
128#define HOST_TEXT_START_ADDR (u.start_code)
129#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
130
131#endif /* _I386_USER_H */
diff --git a/include/asm-x86/user_64.h b/include/asm-x86/user_64.h
deleted file mode 100644
index 6037b634c77f..000000000000
--- a/include/asm-x86/user_64.h
+++ /dev/null
@@ -1,137 +0,0 @@
1#ifndef _X86_64_USER_H
2#define _X86_64_USER_H
3
4#include <asm/types.h>
5#include <asm/page.h>
6/* 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.
8 There are quite a number of obstacles to being able to view the
9 contents of the floating point registers, and until these are
10 solved you will not be able to view the contents of them.
11 Actually, you can read in the core file and look at the contents of
12 the user struct to find out what the floating point registers
13 contain.
14
15 The actual file contents are as follows:
16 UPAGE: 1 page consisting of a user struct that tells gdb what is present
17 in the file. Directly after this is a copy of the task_struct, which
18 is currently not used by gdb, but it may come in useful at some point.
19 All of the registers are stored as part of the upage. The upage should
20 always be only one page.
21 DATA: The data area is stored. We use current->end_text to
22 current->brk to pick up all of the user variables, plus any memory
23 that may have been malloced. No attempt is made to determine if a page
24 is demand-zero or if a page is totally unused, we just cover the entire
25 range. All of the addresses are rounded in such a way that an integral
26 number of pages is written.
27 STACK: We need the stack information in order to get a meaningful
28 backtrace. We need to write the data from (esp) to
29 current->start_stack, so we round each of these off in order to be able
30 to write an integer number of pages.
31 The minimum core file size is 3 pages, or 12288 bytes. */
32
33/*
34 * Pentium III FXSR, SSE support
35 * Gareth Hughes <gareth@valinux.com>, May 2000
36 *
37 * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for
38 * interacting with the FXSR-format floating point environment. Floating
39 * point data can be accessed in the regular format in the usual manner,
40 * and both the standard and SIMD floating point data can be accessed via
41 * the new ptrace requests. In either case, changes to the FPU environment
42 * will be reflected in the task's state as expected.
43 *
44 * x86-64 support by Andi Kleen.
45 */
46
47/* This matches the 64bit FXSAVE format as defined by AMD. It is the same
48 as the 32bit format defined by Intel, except that the selector:offset pairs
49 for data and eip are replaced with flat 64bit pointers. */
50struct user_i387_struct {
51 unsigned short cwd;
52 unsigned short swd;
53 unsigned short twd; /* Note this is not the same as
54 the 32bit/x87/FSAVE twd */
55 unsigned short fop;
56 __u64 rip;
57 __u64 rdp;
58 __u32 mxcsr;
59 __u32 mxcsr_mask;
60 __u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
61 __u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
62 __u32 padding[24];
63};
64
65/*
66 * Segment register layout in coredumps.
67 */
68struct user_regs_struct {
69 unsigned long r15;
70 unsigned long r14;
71 unsigned long r13;
72 unsigned long r12;
73 unsigned long bp;
74 unsigned long bx;
75 unsigned long r11;
76 unsigned long r10;
77 unsigned long r9;
78 unsigned long r8;
79 unsigned long ax;
80 unsigned long cx;
81 unsigned long dx;
82 unsigned long si;
83 unsigned long di;
84 unsigned long orig_ax;
85 unsigned long ip;
86 unsigned long cs;
87 unsigned long flags;
88 unsigned long sp;
89 unsigned long ss;
90 unsigned long fs_base;
91 unsigned long gs_base;
92 unsigned long ds;
93 unsigned long es;
94 unsigned long fs;
95 unsigned long gs;
96};
97
98/* When the kernel dumps core, it starts by dumping the user struct -
99 this will be used by gdb to figure out where the data and stack segments
100 are within the file, and what virtual addresses to use. */
101
102struct user {
103/* We start with the registers, to mimic the way that "memory" is returned
104 from the ptrace(3,...) function. */
105 struct user_regs_struct regs; /* Where the registers are actually stored */
106/* ptrace does not yet supply these. Someday.... */
107 int u_fpvalid; /* True if math co-processor being used. */
108 /* for this mess. Not yet used. */
109 int pad0;
110 struct user_i387_struct i387; /* Math Co-processor registers. */
111/* The rest of this junk is to help gdb figure out what goes where */
112 unsigned long int u_tsize; /* Text segment size (pages). */
113 unsigned long int u_dsize; /* Data segment size (pages). */
114 unsigned long int u_ssize; /* Stack segment size (pages). */
115 unsigned long start_code; /* Starting virtual address of text. */
116 unsigned long start_stack; /* Starting virtual address of stack area.
117 This is actually the bottom of the stack,
118 the top of the stack is always found in the
119 esp register. */
120 long int signal; /* Signal that caused the core dump. */
121 int reserved; /* No longer used */
122 int pad1;
123 unsigned long u_ar0; /* Used by gdb to help find the values for */
124 /* the registers. */
125 struct user_i387_struct *u_fpstate; /* Math Co-processor pointer. */
126 unsigned long magic; /* To uniquely identify a core file */
127 char u_comm[32]; /* User command that was responsible */
128 unsigned long u_debugreg[8];
129 unsigned long error_code; /* CPU error code or 0 */
130 unsigned long fault_address; /* CR3 or 0 */
131};
132#define NBPG PAGE_SIZE
133#define UPAGES 1
134#define HOST_TEXT_START_ADDR (u.start_code)
135#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
136
137#endif /* _X86_64_USER_H */
diff --git a/include/asm-x86/uv/bios.h b/include/asm-x86/uv/bios.h
deleted file mode 100644
index aa73362ff5df..000000000000
--- a/include/asm-x86/uv/bios.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef _ASM_X86_BIOS_H
2#define _ASM_X86_BIOS_H
3
4/*
5 * BIOS layer definitions.
6 *
7 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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#include <linux/rtc.h>
25
26#define BIOS_FREQ_BASE 0x01000001
27
28enum {
29 BIOS_FREQ_BASE_PLATFORM = 0,
30 BIOS_FREQ_BASE_INTERVAL_TIMER = 1,
31 BIOS_FREQ_BASE_REALTIME_CLOCK = 2
32};
33
34# define BIOS_CALL(result, a0, a1, a2, a3, a4, a5, a6, a7) \
35 do { \
36 /* XXX - the real call goes here */ \
37 result.status = BIOS_STATUS_UNIMPLEMENTED; \
38 isrv.v0 = 0; \
39 isrv.v1 = 0; \
40 } while (0)
41
42enum {
43 BIOS_STATUS_SUCCESS = 0,
44 BIOS_STATUS_UNIMPLEMENTED = -1,
45 BIOS_STATUS_EINVAL = -2,
46 BIOS_STATUS_ERROR = -3
47};
48
49struct uv_bios_retval {
50 /*
51 * A zero status value indicates call completed without error.
52 * A negative status value indicates reason of call failure.
53 * A positive status value indicates success but an
54 * informational value should be printed (e.g., "reboot for
55 * change to take effect").
56 */
57 s64 status;
58 u64 v0;
59 u64 v1;
60 u64 v2;
61};
62
63extern long
64x86_bios_freq_base(unsigned long which, unsigned long *ticks_per_second,
65 unsigned long *drift_info);
66extern const char *x86_bios_strerror(long status);
67
68#endif /* _ASM_X86_BIOS_H */
diff --git a/include/asm-x86/uv/uv_bau.h b/include/asm-x86/uv/uv_bau.h
deleted file mode 100644
index 610b6b308e93..000000000000
--- a/include/asm-x86/uv/uv_bau.h
+++ /dev/null
@@ -1,332 +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 * SGI UV Broadcast Assist Unit definitions
7 *
8 * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef __ASM_X86_UV_BAU__
12#define __ASM_X86_UV_BAU__
13
14#include <linux/bitmap.h>
15#define BITSPERBYTE 8
16
17/*
18 * Broadcast Assist Unit messaging structures
19 *
20 * Selective Broadcast activations are induced by software action
21 * specifying a particular 8-descriptor "set" via a 6-bit index written
22 * to an MMR.
23 * Thus there are 64 unique 512-byte sets of SB descriptors - one set for
24 * each 6-bit index value. These descriptor sets are mapped in sequence
25 * starting with set 0 located at the address specified in the
26 * BAU_SB_DESCRIPTOR_BASE register, set 1 is located at BASE + 512,
27 * set 2 is at BASE + 2*512, set 3 at BASE + 3*512, and so on.
28 *
29 * We will use 31 sets, one for sending BAU messages from each of the 32
30 * cpu's on the node.
31 *
32 * TLB shootdown will use the first of the 8 descriptors of each set.
33 * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set).
34 */
35
36#define UV_ITEMS_PER_DESCRIPTOR 8
37#define UV_CPUS_PER_ACT_STATUS 32
38#define UV_ACT_STATUS_MASK 0x3
39#define UV_ACT_STATUS_SIZE 2
40#define UV_ACTIVATION_DESCRIPTOR_SIZE 32
41#define UV_DISTRIBUTION_SIZE 256
42#define UV_SW_ACK_NPENDING 8
43#define UV_NET_ENDPOINT_INTD 0x38
44#define UV_DESC_BASE_PNODE_SHIFT 49
45#define UV_PAYLOADQ_PNODE_SHIFT 49
46#define UV_PTC_BASENAME "sgi_uv/ptc_statistics"
47#define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask))
48
49/*
50 * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1
51 */
52#define DESC_STATUS_IDLE 0
53#define DESC_STATUS_ACTIVE 1
54#define DESC_STATUS_DESTINATION_TIMEOUT 2
55#define DESC_STATUS_SOURCE_TIMEOUT 3
56
57/*
58 * source side threshholds at which message retries print a warning
59 */
60#define SOURCE_TIMEOUT_LIMIT 20
61#define DESTINATION_TIMEOUT_LIMIT 20
62
63/*
64 * number of entries in the destination side payload queue
65 */
66#define DEST_Q_SIZE 17
67/*
68 * number of destination side software ack resources
69 */
70#define DEST_NUM_RESOURCES 8
71#define MAX_CPUS_PER_NODE 32
72/*
73 * completion statuses for sending a TLB flush message
74 */
75#define FLUSH_RETRY 1
76#define FLUSH_GIVEUP 2
77#define FLUSH_COMPLETE 3
78
79/*
80 * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor)
81 * If the 'multilevel' flag in the header portion of the descriptor
82 * has been set to 0, then endpoint multi-unicast mode is selected.
83 * The distribution specification (32 bytes) is interpreted as a 256-bit
84 * distribution vector. Adjacent bits correspond to consecutive even numbered
85 * nodeIDs. The result of adding the index of a given bit to the 15-bit
86 * 'base_dest_nodeid' field of the header corresponds to the
87 * destination nodeID associated with that specified bit.
88 */
89struct bau_target_nodemask {
90 unsigned long bits[BITS_TO_LONGS(256)];
91};
92
93/*
94 * mask of cpu's on a node
95 * (during initialization we need to check that unsigned long has
96 * enough bits for max. cpu's per node)
97 */
98struct bau_local_cpumask {
99 unsigned long bits;
100};
101
102/*
103 * Payload: 16 bytes (128 bits) (bytes 0x20-0x2f of descriptor)
104 * only 12 bytes (96 bits) of the payload area are usable.
105 * An additional 3 bytes (bits 27:4) of the header address are carried
106 * to the next bytes of the destination payload queue.
107 * And an additional 2 bytes of the header Suppl_A field are also
108 * carried to the destination payload queue.
109 * But the first byte of the Suppl_A becomes bits 127:120 (the 16th byte)
110 * of the destination payload queue, which is written by the hardware
111 * with the s/w ack resource bit vector.
112 * [ effective message contents (16 bytes (128 bits) maximum), not counting
113 * the s/w ack bit vector ]
114 */
115
116/*
117 * The payload is software-defined for INTD transactions
118 */
119struct bau_msg_payload {
120 unsigned long address; /* signifies a page or all TLB's
121 of the cpu */
122 /* 64 bits */
123 unsigned short sending_cpu; /* filled in by sender */
124 /* 16 bits */
125 unsigned short acknowledge_count;/* filled in by destination */
126 /* 16 bits */
127 unsigned int reserved1:32; /* not usable */
128};
129
130
131/*
132 * Message header: 16 bytes (128 bits) (bytes 0x30-0x3f of descriptor)
133 * see table 4.2.3.0.1 in broacast_assist spec.
134 */
135struct bau_msg_header {
136 int dest_subnodeid:6; /* must be zero */
137 /* bits 5:0 */
138 int base_dest_nodeid:15; /* nasid>>1 (pnode) of first bit in node_map */
139 /* bits 20:6 */
140 int command:8; /* message type */
141 /* bits 28:21 */
142 /* 0x38: SN3net EndPoint Message */
143 int rsvd_1:3; /* must be zero */
144 /* bits 31:29 */
145 /* int will align on 32 bits */
146 int rsvd_2:9; /* must be zero */
147 /* bits 40:32 */
148 /* Suppl_A is 56-41 */
149 int payload_2a:8; /* becomes byte 16 of msg */
150 /* bits 48:41 */ /* not currently using */
151 int payload_2b:8; /* becomes byte 17 of msg */
152 /* bits 56:49 */ /* not currently using */
153 /* Address field (96:57) is never used as an
154 address (these are address bits 42:3) */
155 int rsvd_3:1; /* must be zero */
156 /* bit 57 */
157 /* address bits 27:4 are payload */
158 /* these 24 bits become bytes 12-14 of msg */
159 int replied_to:1; /* sent as 0 by the source to byte 12 */
160 /* bit 58 */
161
162 int payload_1a:5; /* not currently used */
163 /* bits 63:59 */
164 int payload_1b:8; /* not currently used */
165 /* bits 71:64 */
166 int payload_1c:8; /* not currently used */
167 /* bits 79:72 */
168 int payload_1d:2; /* not currently used */
169 /* bits 81:80 */
170
171 int rsvd_4:7; /* must be zero */
172 /* bits 88:82 */
173 int sw_ack_flag:1; /* software acknowledge flag */
174 /* bit 89 */
175 /* INTD trasactions at destination are to
176 wait for software acknowledge */
177 int rsvd_5:6; /* must be zero */
178 /* bits 95:90 */
179 int rsvd_6:5; /* must be zero */
180 /* bits 100:96 */
181 int int_both:1; /* if 1, interrupt both sockets on the blade */
182 /* bit 101*/
183 int fairness:3; /* usually zero */
184 /* bits 104:102 */
185 int multilevel:1; /* multi-level multicast format */
186 /* bit 105 */
187 /* 0 for TLB: endpoint multi-unicast messages */
188 int chaining:1; /* next descriptor is part of this activation*/
189 /* bit 106 */
190 int rsvd_7:21; /* must be zero */
191 /* bits 127:107 */
192};
193
194/*
195 * The activation descriptor:
196 * The format of the message to send, plus all accompanying control
197 * Should be 64 bytes
198 */
199struct bau_desc {
200 struct bau_target_nodemask distribution;
201 /*
202 * message template, consisting of header and payload:
203 */
204 struct bau_msg_header header;
205 struct bau_msg_payload payload;
206};
207/*
208 * -payload-- ---------header------
209 * bytes 0-11 bits 41-56 bits 58-81
210 * A B (2) C (3)
211 *
212 * A/B/C are moved to:
213 * A C B
214 * bytes 0-11 bytes 12-14 bytes 16-17 (byte 15 filled in by hw as vector)
215 * ------------payload queue-----------
216 */
217
218/*
219 * The payload queue on the destination side is an array of these.
220 * With BAU_MISC_CONTROL set for software acknowledge mode, the messages
221 * are 32 bytes (2 micropackets) (256 bits) in length, but contain only 17
222 * bytes of usable data, including the sw ack vector in byte 15 (bits 127:120)
223 * (12 bytes come from bau_msg_payload, 3 from payload_1, 2 from
224 * sw_ack_vector and payload_2)
225 * "Enabling Software Acknowledgment mode (see Section 4.3.3 Software
226 * Acknowledge Processing) also selects 32 byte (17 bytes usable) payload
227 * operation."
228 */
229struct bau_payload_queue_entry {
230 unsigned long address; /* signifies a page or all TLB's
231 of the cpu */
232 /* 64 bits, bytes 0-7 */
233
234 unsigned short sending_cpu; /* cpu that sent the message */
235 /* 16 bits, bytes 8-9 */
236
237 unsigned short acknowledge_count; /* filled in by destination */
238 /* 16 bits, bytes 10-11 */
239
240 unsigned short replied_to:1; /* sent as 0 by the source */
241 /* 1 bit */
242 unsigned short unused1:7; /* not currently using */
243 /* 7 bits: byte 12) */
244
245 unsigned char unused2[2]; /* not currently using */
246 /* bytes 13-14 */
247
248 unsigned char sw_ack_vector; /* filled in by the hardware */
249 /* byte 15 (bits 127:120) */
250
251 unsigned char unused4[3]; /* not currently using bytes 17-19 */
252 /* bytes 17-19 */
253
254 int number_of_cpus; /* filled in at destination */
255 /* 32 bits, bytes 20-23 (aligned) */
256
257 unsigned char unused5[8]; /* not using */
258 /* bytes 24-31 */
259};
260
261/*
262 * one for every slot in the destination payload queue
263 */
264struct bau_msg_status {
265 struct bau_local_cpumask seen_by; /* map of cpu's */
266};
267
268/*
269 * one for every slot in the destination software ack resources
270 */
271struct bau_sw_ack_status {
272 struct bau_payload_queue_entry *msg; /* associated message */
273 int watcher; /* cpu monitoring, or -1 */
274};
275
276/*
277 * one on every node and per-cpu; to locate the software tables
278 */
279struct bau_control {
280 struct bau_desc *descriptor_base;
281 struct bau_payload_queue_entry *bau_msg_head;
282 struct bau_payload_queue_entry *va_queue_first;
283 struct bau_payload_queue_entry *va_queue_last;
284 struct bau_msg_status *msg_statuses;
285 int *watching; /* pointer to array */
286};
287
288/*
289 * This structure is allocated per_cpu for UV TLB shootdown statistics.
290 */
291struct ptc_stats {
292 unsigned long ptc_i; /* number of IPI-style flushes */
293 unsigned long requestor; /* number of nodes this cpu sent to */
294 unsigned long requestee; /* times cpu was remotely requested */
295 unsigned long alltlb; /* times all tlb's on this cpu were flushed */
296 unsigned long onetlb; /* times just one tlb on this cpu was flushed */
297 unsigned long s_retry; /* retries on source side timeouts */
298 unsigned long d_retry; /* retries on destination side timeouts */
299 unsigned long sflush; /* cycles spent in uv_flush_tlb_others */
300 unsigned long dflush; /* cycles spent on destination side */
301 unsigned long retriesok; /* successes on retries */
302 unsigned long nomsg; /* interrupts with no message */
303 unsigned long multmsg; /* interrupts with multiple messages */
304 unsigned long ntargeted;/* nodes targeted */
305};
306
307static inline int bau_node_isset(int node, struct bau_target_nodemask *dstp)
308{
309 return constant_test_bit(node, &dstp->bits[0]);
310}
311static inline void bau_node_set(int node, struct bau_target_nodemask *dstp)
312{
313 __set_bit(node, &dstp->bits[0]);
314}
315static inline void bau_nodes_clear(struct bau_target_nodemask *dstp, int nbits)
316{
317 bitmap_zero(&dstp->bits[0], nbits);
318}
319
320static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits)
321{
322 bitmap_zero(&dstp->bits, nbits);
323}
324
325#define cpubit_isset(cpu, bau_local_cpumask) \
326 test_bit((cpu), (bau_local_cpumask).bits)
327
328extern int uv_flush_tlb_others(cpumask_t *, struct mm_struct *, unsigned long);
329extern void uv_bau_message_intr1(void);
330extern void uv_bau_timeout_intr1(void);
331
332#endif /* __ASM_X86_UV_BAU__ */
diff --git a/include/asm-x86/uv/uv_hub.h b/include/asm-x86/uv/uv_hub.h
deleted file mode 100644
index a4ef26e5850b..000000000000
--- a/include/asm-x86/uv/uv_hub.h
+++ /dev/null
@@ -1,354 +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 * SGI UV architectural definitions
7 *
8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef __ASM_X86_UV_HUB_H__
12#define __ASM_X86_UV_HUB_H__
13
14#include <linux/numa.h>
15#include <linux/percpu.h>
16#include <asm/types.h>
17#include <asm/percpu.h>
18
19
20/*
21 * Addressing Terminology
22 *
23 * M - The low M bits of a physical address represent the offset
24 * into the blade local memory. RAM memory on a blade is physically
25 * contiguous (although various IO spaces may punch holes in
26 * it)..
27 *
28 * N - Number of bits in the node portion of a socket physical
29 * address.
30 *
31 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
32 * routers always have low bit of 1, C/MBricks have low bit
33 * equal to 0. Most addressing macros that target UV hub chips
34 * right shift the NASID by 1 to exclude the always-zero bit.
35 * NASIDs contain up to 15 bits.
36 *
37 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead
38 * of nasids.
39 *
40 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
41 * of the nasid for socket usage.
42 *
43 *
44 * NumaLink Global Physical Address Format:
45 * +--------------------------------+---------------------+
46 * |00..000| GNODE | NodeOffset |
47 * +--------------------------------+---------------------+
48 * |<-------53 - M bits --->|<--------M bits ----->
49 *
50 * M - number of node offset bits (35 .. 40)
51 *
52 *
53 * Memory/UV-HUB Processor Socket Address Format:
54 * +----------------+---------------+---------------------+
55 * |00..000000000000| PNODE | NodeOffset |
56 * +----------------+---------------+---------------------+
57 * <--- N bits --->|<--------M bits ----->
58 *
59 * M - number of node offset bits (35 .. 40)
60 * N - number of PNODE bits (0 .. 10)
61 *
62 * Note: M + N cannot currently exceed 44 (x86_64) or 46 (IA64).
63 * The actual values are configuration dependent and are set at
64 * boot time. M & N values are set by the hardware/BIOS at boot.
65 *
66 *
67 * APICID format
68 * NOTE!!!!!! This is the current format of the APICID. However, code
69 * should assume that this will change in the future. Use functions
70 * in this file for all APICID bit manipulations and conversion.
71 *
72 * 1111110000000000
73 * 5432109876543210
74 * pppppppppplc0cch
75 * sssssssssss
76 *
77 * p = pnode bits
78 * l = socket number on board
79 * c = core
80 * h = hyperthread
81 * s = bits that are in the SOCKET_ID CSR
82 *
83 * Note: Processor only supports 12 bits in the APICID register. The ACPI
84 * tables hold all 16 bits. Software needs to be aware of this.
85 *
86 * Unless otherwise specified, all references to APICID refer to
87 * the FULL value contained in ACPI tables, not the subset in the
88 * processor APICID register.
89 */
90
91
92/*
93 * Maximum number of bricks in all partitions and in all coherency domains.
94 * This is the total number of bricks accessible in the numalink fabric. It
95 * includes all C & M bricks. Routers are NOT included.
96 *
97 * This value is also the value of the maximum number of non-router NASIDs
98 * in the numalink fabric.
99 *
100 * NOTE: a brick may contain 1 or 2 OS nodes. Don't get these confused.
101 */
102#define UV_MAX_NUMALINK_BLADES 16384
103
104/*
105 * Maximum number of C/Mbricks within a software SSI (hardware may support
106 * more).
107 */
108#define UV_MAX_SSI_BLADES 256
109
110/*
111 * The largest possible NASID of a C or M brick (+ 2)
112 */
113#define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_NODES * 2)
114
115/*
116 * The following defines attributes of the HUB chip. These attributes are
117 * frequently referenced and are kept in the per-cpu data areas of each cpu.
118 * They are kept together in a struct to minimize cache misses.
119 */
120struct uv_hub_info_s {
121 unsigned long global_mmr_base;
122 unsigned long gpa_mask;
123 unsigned long gnode_upper;
124 unsigned long lowmem_remap_top;
125 unsigned long lowmem_remap_base;
126 unsigned short pnode;
127 unsigned short pnode_mask;
128 unsigned short coherency_domain_number;
129 unsigned short numa_blade_id;
130 unsigned char blade_processor_id;
131 unsigned char m_val;
132 unsigned char n_val;
133};
134DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
135#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
136#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
137
138/*
139 * Local & Global MMR space macros.
140 * Note: macros are intended to be used ONLY by inline functions
141 * in this file - not by other kernel code.
142 * n - NASID (full 15-bit global nasid)
143 * g - GNODE (full 15-bit global nasid, right shifted 1)
144 * p - PNODE (local part of nsids, right shifted 1)
145 */
146#define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
147#define UV_PNODE_TO_NASID(p) (((p) << 1) | uv_hub_info->gnode_upper)
148
149#define UV_LOCAL_MMR_BASE 0xf4000000UL
150#define UV_GLOBAL_MMR32_BASE 0xf8000000UL
151#define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base)
152#define UV_LOCAL_MMR_SIZE (64UL * 1024 * 1024)
153#define UV_GLOBAL_MMR32_SIZE (64UL * 1024 * 1024)
154
155#define UV_GLOBAL_MMR32_PNODE_SHIFT 15
156#define UV_GLOBAL_MMR64_PNODE_SHIFT 26
157
158#define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT))
159
160#define UV_GLOBAL_MMR64_PNODE_BITS(p) \
161 ((unsigned long)(p) << UV_GLOBAL_MMR64_PNODE_SHIFT)
162
163#define UV_APIC_PNODE_SHIFT 6
164
165/*
166 * Macros for converting between kernel virtual addresses, socket local physical
167 * addresses, and UV global physical addresses.
168 * Note: use the standard __pa() & __va() macros for converting
169 * between socket virtual and socket physical addresses.
170 */
171
172/* socket phys RAM --> UV global physical address */
173static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
174{
175 if (paddr < uv_hub_info->lowmem_remap_top)
176 paddr += uv_hub_info->lowmem_remap_base;
177 return paddr | uv_hub_info->gnode_upper;
178}
179
180
181/* socket virtual --> UV global physical address */
182static inline unsigned long uv_gpa(void *v)
183{
184 return __pa(v) | uv_hub_info->gnode_upper;
185}
186
187/* socket virtual --> UV global physical address */
188static inline void *uv_vgpa(void *v)
189{
190 return (void *)uv_gpa(v);
191}
192
193/* UV global physical address --> socket virtual */
194static inline void *uv_va(unsigned long gpa)
195{
196 return __va(gpa & uv_hub_info->gpa_mask);
197}
198
199/* pnode, offset --> socket virtual */
200static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
201{
202 return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset);
203}
204
205
206/*
207 * Extract a PNODE from an APICID (full apicid, not processor subset)
208 */
209static inline int uv_apicid_to_pnode(int apicid)
210{
211 return (apicid >> UV_APIC_PNODE_SHIFT);
212}
213
214/*
215 * Access global MMRs using the low memory MMR32 space. This region supports
216 * faster MMR access but not all MMRs are accessible in this space.
217 */
218static inline unsigned long *uv_global_mmr32_address(int pnode,
219 unsigned long offset)
220{
221 return __va(UV_GLOBAL_MMR32_BASE |
222 UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset);
223}
224
225static inline void uv_write_global_mmr32(int pnode, unsigned long offset,
226 unsigned long val)
227{
228 *uv_global_mmr32_address(pnode, offset) = val;
229}
230
231static inline unsigned long uv_read_global_mmr32(int pnode,
232 unsigned long offset)
233{
234 return *uv_global_mmr32_address(pnode, offset);
235}
236
237/*
238 * Access Global MMR space using the MMR space located at the top of physical
239 * memory.
240 */
241static inline unsigned long *uv_global_mmr64_address(int pnode,
242 unsigned long offset)
243{
244 return __va(UV_GLOBAL_MMR64_BASE |
245 UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
246}
247
248static inline void uv_write_global_mmr64(int pnode, unsigned long offset,
249 unsigned long val)
250{
251 *uv_global_mmr64_address(pnode, offset) = val;
252}
253
254static inline unsigned long uv_read_global_mmr64(int pnode,
255 unsigned long offset)
256{
257 return *uv_global_mmr64_address(pnode, offset);
258}
259
260/*
261 * Access hub local MMRs. Faster than using global space but only local MMRs
262 * are accessible.
263 */
264static inline unsigned long *uv_local_mmr_address(unsigned long offset)
265{
266 return __va(UV_LOCAL_MMR_BASE | offset);
267}
268
269static inline unsigned long uv_read_local_mmr(unsigned long offset)
270{
271 return *uv_local_mmr_address(offset);
272}
273
274static inline void uv_write_local_mmr(unsigned long offset, unsigned long val)
275{
276 *uv_local_mmr_address(offset) = val;
277}
278
279/*
280 * Structures and definitions for converting between cpu, node, pnode, and blade
281 * numbers.
282 */
283struct uv_blade_info {
284 unsigned short nr_possible_cpus;
285 unsigned short nr_online_cpus;
286 unsigned short pnode;
287};
288extern struct uv_blade_info *uv_blade_info;
289extern short *uv_node_to_blade;
290extern short *uv_cpu_to_blade;
291extern short uv_possible_blades;
292
293/* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */
294static inline int uv_blade_processor_id(void)
295{
296 return uv_hub_info->blade_processor_id;
297}
298
299/* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
300static inline int uv_numa_blade_id(void)
301{
302 return uv_hub_info->numa_blade_id;
303}
304
305/* Convert a cpu number to the the UV blade number */
306static inline int uv_cpu_to_blade_id(int cpu)
307{
308 return uv_cpu_to_blade[cpu];
309}
310
311/* Convert linux node number to the UV blade number */
312static inline int uv_node_to_blade_id(int nid)
313{
314 return uv_node_to_blade[nid];
315}
316
317/* Convert a blade id to the PNODE of the blade */
318static inline int uv_blade_to_pnode(int bid)
319{
320 return uv_blade_info[bid].pnode;
321}
322
323/* Determine the number of possible cpus on a blade */
324static inline int uv_blade_nr_possible_cpus(int bid)
325{
326 return uv_blade_info[bid].nr_possible_cpus;
327}
328
329/* Determine the number of online cpus on a blade */
330static inline int uv_blade_nr_online_cpus(int bid)
331{
332 return uv_blade_info[bid].nr_online_cpus;
333}
334
335/* Convert a cpu id to the PNODE of the blade containing the cpu */
336static inline int uv_cpu_to_pnode(int cpu)
337{
338 return uv_blade_info[uv_cpu_to_blade_id(cpu)].pnode;
339}
340
341/* Convert a linux node number to the PNODE of the blade */
342static inline int uv_node_to_pnode(int nid)
343{
344 return uv_blade_info[uv_node_to_blade_id(nid)].pnode;
345}
346
347/* Maximum possible number of blades */
348static inline int uv_num_possible_blades(void)
349{
350 return uv_possible_blades;
351}
352
353#endif /* __ASM_X86_UV_HUB__ */
354
diff --git a/include/asm-x86/uv/uv_mmrs.h b/include/asm-x86/uv/uv_mmrs.h
deleted file mode 100644
index 151fd7fcb809..000000000000
--- a/include/asm-x86/uv/uv_mmrs.h
+++ /dev/null
@@ -1,1295 +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 * SGI UV MMR definitions
7 *
8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved.
9 */
10
11#ifndef __ASM_X86_UV_MMRS__
12#define __ASM_X86_UV_MMRS__
13
14#define UV_MMR_ENABLE (1UL << 63)
15
16/* ========================================================================= */
17/* UVH_BAU_DATA_CONFIG */
18/* ========================================================================= */
19#define UVH_BAU_DATA_CONFIG 0x61680UL
20#define UVH_BAU_DATA_CONFIG_32 0x0438
21
22#define UVH_BAU_DATA_CONFIG_VECTOR_SHFT 0
23#define UVH_BAU_DATA_CONFIG_VECTOR_MASK 0x00000000000000ffUL
24#define UVH_BAU_DATA_CONFIG_DM_SHFT 8
25#define UVH_BAU_DATA_CONFIG_DM_MASK 0x0000000000000700UL
26#define UVH_BAU_DATA_CONFIG_DESTMODE_SHFT 11
27#define UVH_BAU_DATA_CONFIG_DESTMODE_MASK 0x0000000000000800UL
28#define UVH_BAU_DATA_CONFIG_STATUS_SHFT 12
29#define UVH_BAU_DATA_CONFIG_STATUS_MASK 0x0000000000001000UL
30#define UVH_BAU_DATA_CONFIG_P_SHFT 13
31#define UVH_BAU_DATA_CONFIG_P_MASK 0x0000000000002000UL
32#define UVH_BAU_DATA_CONFIG_T_SHFT 15
33#define UVH_BAU_DATA_CONFIG_T_MASK 0x0000000000008000UL
34#define UVH_BAU_DATA_CONFIG_M_SHFT 16
35#define UVH_BAU_DATA_CONFIG_M_MASK 0x0000000000010000UL
36#define UVH_BAU_DATA_CONFIG_APIC_ID_SHFT 32
37#define UVH_BAU_DATA_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
38
39union uvh_bau_data_config_u {
40 unsigned long v;
41 struct uvh_bau_data_config_s {
42 unsigned long vector_ : 8; /* RW */
43 unsigned long dm : 3; /* RW */
44 unsigned long destmode : 1; /* RW */
45 unsigned long status : 1; /* RO */
46 unsigned long p : 1; /* RO */
47 unsigned long rsvd_14 : 1; /* */
48 unsigned long t : 1; /* RO */
49 unsigned long m : 1; /* RW */
50 unsigned long rsvd_17_31: 15; /* */
51 unsigned long apic_id : 32; /* RW */
52 } s;
53};
54
55/* ========================================================================= */
56/* UVH_EVENT_OCCURRED0 */
57/* ========================================================================= */
58#define UVH_EVENT_OCCURRED0 0x70000UL
59#define UVH_EVENT_OCCURRED0_32 0x005e8
60
61#define UVH_EVENT_OCCURRED0_LB_HCERR_SHFT 0
62#define UVH_EVENT_OCCURRED0_LB_HCERR_MASK 0x0000000000000001UL
63#define UVH_EVENT_OCCURRED0_GR0_HCERR_SHFT 1
64#define UVH_EVENT_OCCURRED0_GR0_HCERR_MASK 0x0000000000000002UL
65#define UVH_EVENT_OCCURRED0_GR1_HCERR_SHFT 2
66#define UVH_EVENT_OCCURRED0_GR1_HCERR_MASK 0x0000000000000004UL
67#define UVH_EVENT_OCCURRED0_LH_HCERR_SHFT 3
68#define UVH_EVENT_OCCURRED0_LH_HCERR_MASK 0x0000000000000008UL
69#define UVH_EVENT_OCCURRED0_RH_HCERR_SHFT 4
70#define UVH_EVENT_OCCURRED0_RH_HCERR_MASK 0x0000000000000010UL
71#define UVH_EVENT_OCCURRED0_XN_HCERR_SHFT 5
72#define UVH_EVENT_OCCURRED0_XN_HCERR_MASK 0x0000000000000020UL
73#define UVH_EVENT_OCCURRED0_SI_HCERR_SHFT 6
74#define UVH_EVENT_OCCURRED0_SI_HCERR_MASK 0x0000000000000040UL
75#define UVH_EVENT_OCCURRED0_LB_AOERR0_SHFT 7
76#define UVH_EVENT_OCCURRED0_LB_AOERR0_MASK 0x0000000000000080UL
77#define UVH_EVENT_OCCURRED0_GR0_AOERR0_SHFT 8
78#define UVH_EVENT_OCCURRED0_GR0_AOERR0_MASK 0x0000000000000100UL
79#define UVH_EVENT_OCCURRED0_GR1_AOERR0_SHFT 9
80#define UVH_EVENT_OCCURRED0_GR1_AOERR0_MASK 0x0000000000000200UL
81#define UVH_EVENT_OCCURRED0_LH_AOERR0_SHFT 10
82#define UVH_EVENT_OCCURRED0_LH_AOERR0_MASK 0x0000000000000400UL
83#define UVH_EVENT_OCCURRED0_RH_AOERR0_SHFT 11
84#define UVH_EVENT_OCCURRED0_RH_AOERR0_MASK 0x0000000000000800UL
85#define UVH_EVENT_OCCURRED0_XN_AOERR0_SHFT 12
86#define UVH_EVENT_OCCURRED0_XN_AOERR0_MASK 0x0000000000001000UL
87#define UVH_EVENT_OCCURRED0_SI_AOERR0_SHFT 13
88#define UVH_EVENT_OCCURRED0_SI_AOERR0_MASK 0x0000000000002000UL
89#define UVH_EVENT_OCCURRED0_LB_AOERR1_SHFT 14
90#define UVH_EVENT_OCCURRED0_LB_AOERR1_MASK 0x0000000000004000UL
91#define UVH_EVENT_OCCURRED0_GR0_AOERR1_SHFT 15
92#define UVH_EVENT_OCCURRED0_GR0_AOERR1_MASK 0x0000000000008000UL
93#define UVH_EVENT_OCCURRED0_GR1_AOERR1_SHFT 16
94#define UVH_EVENT_OCCURRED0_GR1_AOERR1_MASK 0x0000000000010000UL
95#define UVH_EVENT_OCCURRED0_LH_AOERR1_SHFT 17
96#define UVH_EVENT_OCCURRED0_LH_AOERR1_MASK 0x0000000000020000UL
97#define UVH_EVENT_OCCURRED0_RH_AOERR1_SHFT 18
98#define UVH_EVENT_OCCURRED0_RH_AOERR1_MASK 0x0000000000040000UL
99#define UVH_EVENT_OCCURRED0_XN_AOERR1_SHFT 19
100#define UVH_EVENT_OCCURRED0_XN_AOERR1_MASK 0x0000000000080000UL
101#define UVH_EVENT_OCCURRED0_SI_AOERR1_SHFT 20
102#define UVH_EVENT_OCCURRED0_SI_AOERR1_MASK 0x0000000000100000UL
103#define UVH_EVENT_OCCURRED0_RH_VPI_INT_SHFT 21
104#define UVH_EVENT_OCCURRED0_RH_VPI_INT_MASK 0x0000000000200000UL
105#define UVH_EVENT_OCCURRED0_SYSTEM_SHUTDOWN_INT_SHFT 22
106#define UVH_EVENT_OCCURRED0_SYSTEM_SHUTDOWN_INT_MASK 0x0000000000400000UL
107#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_0_SHFT 23
108#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_0_MASK 0x0000000000800000UL
109#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_1_SHFT 24
110#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_1_MASK 0x0000000001000000UL
111#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_2_SHFT 25
112#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_2_MASK 0x0000000002000000UL
113#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_3_SHFT 26
114#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_3_MASK 0x0000000004000000UL
115#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_4_SHFT 27
116#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_4_MASK 0x0000000008000000UL
117#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_5_SHFT 28
118#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_5_MASK 0x0000000010000000UL
119#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_6_SHFT 29
120#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_6_MASK 0x0000000020000000UL
121#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_7_SHFT 30
122#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_7_MASK 0x0000000040000000UL
123#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_8_SHFT 31
124#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_8_MASK 0x0000000080000000UL
125#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_9_SHFT 32
126#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_9_MASK 0x0000000100000000UL
127#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_10_SHFT 33
128#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_10_MASK 0x0000000200000000UL
129#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_11_SHFT 34
130#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_11_MASK 0x0000000400000000UL
131#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_12_SHFT 35
132#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_12_MASK 0x0000000800000000UL
133#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_13_SHFT 36
134#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_13_MASK 0x0000001000000000UL
135#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_14_SHFT 37
136#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_14_MASK 0x0000002000000000UL
137#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_15_SHFT 38
138#define UVH_EVENT_OCCURRED0_LB_IRQ_INT_15_MASK 0x0000004000000000UL
139#define UVH_EVENT_OCCURRED0_L1_NMI_INT_SHFT 39
140#define UVH_EVENT_OCCURRED0_L1_NMI_INT_MASK 0x0000008000000000UL
141#define UVH_EVENT_OCCURRED0_STOP_CLOCK_SHFT 40
142#define UVH_EVENT_OCCURRED0_STOP_CLOCK_MASK 0x0000010000000000UL
143#define UVH_EVENT_OCCURRED0_ASIC_TO_L1_SHFT 41
144#define UVH_EVENT_OCCURRED0_ASIC_TO_L1_MASK 0x0000020000000000UL
145#define UVH_EVENT_OCCURRED0_L1_TO_ASIC_SHFT 42
146#define UVH_EVENT_OCCURRED0_L1_TO_ASIC_MASK 0x0000040000000000UL
147#define UVH_EVENT_OCCURRED0_LTC_INT_SHFT 43
148#define UVH_EVENT_OCCURRED0_LTC_INT_MASK 0x0000080000000000UL
149#define UVH_EVENT_OCCURRED0_LA_SEQ_TRIGGER_SHFT 44
150#define UVH_EVENT_OCCURRED0_LA_SEQ_TRIGGER_MASK 0x0000100000000000UL
151#define UVH_EVENT_OCCURRED0_IPI_INT_SHFT 45
152#define UVH_EVENT_OCCURRED0_IPI_INT_MASK 0x0000200000000000UL
153#define UVH_EVENT_OCCURRED0_EXTIO_INT0_SHFT 46
154#define UVH_EVENT_OCCURRED0_EXTIO_INT0_MASK 0x0000400000000000UL
155#define UVH_EVENT_OCCURRED0_EXTIO_INT1_SHFT 47
156#define UVH_EVENT_OCCURRED0_EXTIO_INT1_MASK 0x0000800000000000UL
157#define UVH_EVENT_OCCURRED0_EXTIO_INT2_SHFT 48
158#define UVH_EVENT_OCCURRED0_EXTIO_INT2_MASK 0x0001000000000000UL
159#define UVH_EVENT_OCCURRED0_EXTIO_INT3_SHFT 49
160#define UVH_EVENT_OCCURRED0_EXTIO_INT3_MASK 0x0002000000000000UL
161#define UVH_EVENT_OCCURRED0_PROFILE_INT_SHFT 50
162#define UVH_EVENT_OCCURRED0_PROFILE_INT_MASK 0x0004000000000000UL
163#define UVH_EVENT_OCCURRED0_RTC0_SHFT 51
164#define UVH_EVENT_OCCURRED0_RTC0_MASK 0x0008000000000000UL
165#define UVH_EVENT_OCCURRED0_RTC1_SHFT 52
166#define UVH_EVENT_OCCURRED0_RTC1_MASK 0x0010000000000000UL
167#define UVH_EVENT_OCCURRED0_RTC2_SHFT 53
168#define UVH_EVENT_OCCURRED0_RTC2_MASK 0x0020000000000000UL
169#define UVH_EVENT_OCCURRED0_RTC3_SHFT 54
170#define UVH_EVENT_OCCURRED0_RTC3_MASK 0x0040000000000000UL
171#define UVH_EVENT_OCCURRED0_BAU_DATA_SHFT 55
172#define UVH_EVENT_OCCURRED0_BAU_DATA_MASK 0x0080000000000000UL
173#define UVH_EVENT_OCCURRED0_POWER_MANAGEMENT_REQ_SHFT 56
174#define UVH_EVENT_OCCURRED0_POWER_MANAGEMENT_REQ_MASK 0x0100000000000000UL
175union uvh_event_occurred0_u {
176 unsigned long v;
177 struct uvh_event_occurred0_s {
178 unsigned long lb_hcerr : 1; /* RW, W1C */
179 unsigned long gr0_hcerr : 1; /* RW, W1C */
180 unsigned long gr1_hcerr : 1; /* RW, W1C */
181 unsigned long lh_hcerr : 1; /* RW, W1C */
182 unsigned long rh_hcerr : 1; /* RW, W1C */
183 unsigned long xn_hcerr : 1; /* RW, W1C */
184 unsigned long si_hcerr : 1; /* RW, W1C */
185 unsigned long lb_aoerr0 : 1; /* RW, W1C */
186 unsigned long gr0_aoerr0 : 1; /* RW, W1C */
187 unsigned long gr1_aoerr0 : 1; /* RW, W1C */
188 unsigned long lh_aoerr0 : 1; /* RW, W1C */
189 unsigned long rh_aoerr0 : 1; /* RW, W1C */
190 unsigned long xn_aoerr0 : 1; /* RW, W1C */
191 unsigned long si_aoerr0 : 1; /* RW, W1C */
192 unsigned long lb_aoerr1 : 1; /* RW, W1C */
193 unsigned long gr0_aoerr1 : 1; /* RW, W1C */
194 unsigned long gr1_aoerr1 : 1; /* RW, W1C */
195 unsigned long lh_aoerr1 : 1; /* RW, W1C */
196 unsigned long rh_aoerr1 : 1; /* RW, W1C */
197 unsigned long xn_aoerr1 : 1; /* RW, W1C */
198 unsigned long si_aoerr1 : 1; /* RW, W1C */
199 unsigned long rh_vpi_int : 1; /* RW, W1C */
200 unsigned long system_shutdown_int : 1; /* RW, W1C */
201 unsigned long lb_irq_int_0 : 1; /* RW, W1C */
202 unsigned long lb_irq_int_1 : 1; /* RW, W1C */
203 unsigned long lb_irq_int_2 : 1; /* RW, W1C */
204 unsigned long lb_irq_int_3 : 1; /* RW, W1C */
205 unsigned long lb_irq_int_4 : 1; /* RW, W1C */
206 unsigned long lb_irq_int_5 : 1; /* RW, W1C */
207 unsigned long lb_irq_int_6 : 1; /* RW, W1C */
208 unsigned long lb_irq_int_7 : 1; /* RW, W1C */
209 unsigned long lb_irq_int_8 : 1; /* RW, W1C */
210 unsigned long lb_irq_int_9 : 1; /* RW, W1C */
211 unsigned long lb_irq_int_10 : 1; /* RW, W1C */
212 unsigned long lb_irq_int_11 : 1; /* RW, W1C */
213 unsigned long lb_irq_int_12 : 1; /* RW, W1C */
214 unsigned long lb_irq_int_13 : 1; /* RW, W1C */
215 unsigned long lb_irq_int_14 : 1; /* RW, W1C */
216 unsigned long lb_irq_int_15 : 1; /* RW, W1C */
217 unsigned long l1_nmi_int : 1; /* RW, W1C */
218 unsigned long stop_clock : 1; /* RW, W1C */
219 unsigned long asic_to_l1 : 1; /* RW, W1C */
220 unsigned long l1_to_asic : 1; /* RW, W1C */
221 unsigned long ltc_int : 1; /* RW, W1C */
222 unsigned long la_seq_trigger : 1; /* RW, W1C */
223 unsigned long ipi_int : 1; /* RW, W1C */
224 unsigned long extio_int0 : 1; /* RW, W1C */
225 unsigned long extio_int1 : 1; /* RW, W1C */
226 unsigned long extio_int2 : 1; /* RW, W1C */
227 unsigned long extio_int3 : 1; /* RW, W1C */
228 unsigned long profile_int : 1; /* RW, W1C */
229 unsigned long rtc0 : 1; /* RW, W1C */
230 unsigned long rtc1 : 1; /* RW, W1C */
231 unsigned long rtc2 : 1; /* RW, W1C */
232 unsigned long rtc3 : 1; /* RW, W1C */
233 unsigned long bau_data : 1; /* RW, W1C */
234 unsigned long power_management_req : 1; /* RW, W1C */
235 unsigned long rsvd_57_63 : 7; /* */
236 } s;
237};
238
239/* ========================================================================= */
240/* UVH_EVENT_OCCURRED0_ALIAS */
241/* ========================================================================= */
242#define UVH_EVENT_OCCURRED0_ALIAS 0x0000000000070008UL
243#define UVH_EVENT_OCCURRED0_ALIAS_32 0x005f0
244
245/* ========================================================================= */
246/* UVH_INT_CMPB */
247/* ========================================================================= */
248#define UVH_INT_CMPB 0x22080UL
249
250#define UVH_INT_CMPB_REAL_TIME_CMPB_SHFT 0
251#define UVH_INT_CMPB_REAL_TIME_CMPB_MASK 0x00ffffffffffffffUL
252
253union uvh_int_cmpb_u {
254 unsigned long v;
255 struct uvh_int_cmpb_s {
256 unsigned long real_time_cmpb : 56; /* RW */
257 unsigned long rsvd_56_63 : 8; /* */
258 } s;
259};
260
261/* ========================================================================= */
262/* UVH_INT_CMPC */
263/* ========================================================================= */
264#define UVH_INT_CMPC 0x22100UL
265
266#define UVH_INT_CMPC_REAL_TIME_CMPC_SHFT 0
267#define UVH_INT_CMPC_REAL_TIME_CMPC_MASK 0x00ffffffffffffffUL
268
269union uvh_int_cmpc_u {
270 unsigned long v;
271 struct uvh_int_cmpc_s {
272 unsigned long real_time_cmpc : 56; /* RW */
273 unsigned long rsvd_56_63 : 8; /* */
274 } s;
275};
276
277/* ========================================================================= */
278/* UVH_INT_CMPD */
279/* ========================================================================= */
280#define UVH_INT_CMPD 0x22180UL
281
282#define UVH_INT_CMPD_REAL_TIME_CMPD_SHFT 0
283#define UVH_INT_CMPD_REAL_TIME_CMPD_MASK 0x00ffffffffffffffUL
284
285union uvh_int_cmpd_u {
286 unsigned long v;
287 struct uvh_int_cmpd_s {
288 unsigned long real_time_cmpd : 56; /* RW */
289 unsigned long rsvd_56_63 : 8; /* */
290 } s;
291};
292
293/* ========================================================================= */
294/* UVH_IPI_INT */
295/* ========================================================================= */
296#define UVH_IPI_INT 0x60500UL
297#define UVH_IPI_INT_32 0x0348
298
299#define UVH_IPI_INT_VECTOR_SHFT 0
300#define UVH_IPI_INT_VECTOR_MASK 0x00000000000000ffUL
301#define UVH_IPI_INT_DELIVERY_MODE_SHFT 8
302#define UVH_IPI_INT_DELIVERY_MODE_MASK 0x0000000000000700UL
303#define UVH_IPI_INT_DESTMODE_SHFT 11
304#define UVH_IPI_INT_DESTMODE_MASK 0x0000000000000800UL
305#define UVH_IPI_INT_APIC_ID_SHFT 16
306#define UVH_IPI_INT_APIC_ID_MASK 0x0000ffffffff0000UL
307#define UVH_IPI_INT_SEND_SHFT 63
308#define UVH_IPI_INT_SEND_MASK 0x8000000000000000UL
309
310union uvh_ipi_int_u {
311 unsigned long v;
312 struct uvh_ipi_int_s {
313 unsigned long vector_ : 8; /* RW */
314 unsigned long delivery_mode : 3; /* RW */
315 unsigned long destmode : 1; /* RW */
316 unsigned long rsvd_12_15 : 4; /* */
317 unsigned long apic_id : 32; /* RW */
318 unsigned long rsvd_48_62 : 15; /* */
319 unsigned long send : 1; /* WP */
320 } s;
321};
322
323/* ========================================================================= */
324/* UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST */
325/* ========================================================================= */
326#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST 0x320050UL
327#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST_32 0x009c0
328
329#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST_ADDRESS_SHFT 4
330#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST_ADDRESS_MASK 0x000007fffffffff0UL
331#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST_NODE_ID_SHFT 49
332#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST_NODE_ID_MASK 0x7ffe000000000000UL
333
334union uvh_lb_bau_intd_payload_queue_first_u {
335 unsigned long v;
336 struct uvh_lb_bau_intd_payload_queue_first_s {
337 unsigned long rsvd_0_3: 4; /* */
338 unsigned long address : 39; /* RW */
339 unsigned long rsvd_43_48: 6; /* */
340 unsigned long node_id : 14; /* RW */
341 unsigned long rsvd_63 : 1; /* */
342 } s;
343};
344
345/* ========================================================================= */
346/* UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST */
347/* ========================================================================= */
348#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST 0x320060UL
349#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST_32 0x009c8
350
351#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST_ADDRESS_SHFT 4
352#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST_ADDRESS_MASK 0x000007fffffffff0UL
353
354union uvh_lb_bau_intd_payload_queue_last_u {
355 unsigned long v;
356 struct uvh_lb_bau_intd_payload_queue_last_s {
357 unsigned long rsvd_0_3: 4; /* */
358 unsigned long address : 39; /* RW */
359 unsigned long rsvd_43_63: 21; /* */
360 } s;
361};
362
363/* ========================================================================= */
364/* UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL */
365/* ========================================================================= */
366#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL 0x320070UL
367#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL_32 0x009d0
368
369#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL_ADDRESS_SHFT 4
370#define UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL_ADDRESS_MASK 0x000007fffffffff0UL
371
372union uvh_lb_bau_intd_payload_queue_tail_u {
373 unsigned long v;
374 struct uvh_lb_bau_intd_payload_queue_tail_s {
375 unsigned long rsvd_0_3: 4; /* */
376 unsigned long address : 39; /* RW */
377 unsigned long rsvd_43_63: 21; /* */
378 } s;
379};
380
381/* ========================================================================= */
382/* UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE */
383/* ========================================================================= */
384#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE 0x320080UL
385#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_32 0x0a68
386
387#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_0_SHFT 0
388#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_0_MASK 0x0000000000000001UL
389#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_1_SHFT 1
390#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_1_MASK 0x0000000000000002UL
391#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_2_SHFT 2
392#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_2_MASK 0x0000000000000004UL
393#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_3_SHFT 3
394#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_3_MASK 0x0000000000000008UL
395#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_4_SHFT 4
396#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_4_MASK 0x0000000000000010UL
397#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_5_SHFT 5
398#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_5_MASK 0x0000000000000020UL
399#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_6_SHFT 6
400#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_6_MASK 0x0000000000000040UL
401#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_7_SHFT 7
402#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_PENDING_7_MASK 0x0000000000000080UL
403#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_0_SHFT 8
404#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_0_MASK 0x0000000000000100UL
405#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_1_SHFT 9
406#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_1_MASK 0x0000000000000200UL
407#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_2_SHFT 10
408#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_2_MASK 0x0000000000000400UL
409#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_3_SHFT 11
410#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_3_MASK 0x0000000000000800UL
411#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_4_SHFT 12
412#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_4_MASK 0x0000000000001000UL
413#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_5_SHFT 13
414#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_5_MASK 0x0000000000002000UL
415#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_6_SHFT 14
416#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_6_MASK 0x0000000000004000UL
417#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_7_SHFT 15
418#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_TIMEOUT_7_MASK 0x0000000000008000UL
419union uvh_lb_bau_intd_software_acknowledge_u {
420 unsigned long v;
421 struct uvh_lb_bau_intd_software_acknowledge_s {
422 unsigned long pending_0 : 1; /* RW, W1C */
423 unsigned long pending_1 : 1; /* RW, W1C */
424 unsigned long pending_2 : 1; /* RW, W1C */
425 unsigned long pending_3 : 1; /* RW, W1C */
426 unsigned long pending_4 : 1; /* RW, W1C */
427 unsigned long pending_5 : 1; /* RW, W1C */
428 unsigned long pending_6 : 1; /* RW, W1C */
429 unsigned long pending_7 : 1; /* RW, W1C */
430 unsigned long timeout_0 : 1; /* RW, W1C */
431 unsigned long timeout_1 : 1; /* RW, W1C */
432 unsigned long timeout_2 : 1; /* RW, W1C */
433 unsigned long timeout_3 : 1; /* RW, W1C */
434 unsigned long timeout_4 : 1; /* RW, W1C */
435 unsigned long timeout_5 : 1; /* RW, W1C */
436 unsigned long timeout_6 : 1; /* RW, W1C */
437 unsigned long timeout_7 : 1; /* RW, W1C */
438 unsigned long rsvd_16_63: 48; /* */
439 } s;
440};
441
442/* ========================================================================= */
443/* UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS */
444/* ========================================================================= */
445#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS 0x0000000000320088UL
446#define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS_32 0x0a70
447
448/* ========================================================================= */
449/* UVH_LB_BAU_SB_ACTIVATION_CONTROL */
450/* ========================================================================= */
451#define UVH_LB_BAU_SB_ACTIVATION_CONTROL 0x320020UL
452#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_32 0x009a8
453
454#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_INDEX_SHFT 0
455#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_INDEX_MASK 0x000000000000003fUL
456#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT 62
457#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_MASK 0x4000000000000000UL
458#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_INIT_SHFT 63
459#define UVH_LB_BAU_SB_ACTIVATION_CONTROL_INIT_MASK 0x8000000000000000UL
460
461union uvh_lb_bau_sb_activation_control_u {
462 unsigned long v;
463 struct uvh_lb_bau_sb_activation_control_s {
464 unsigned long index : 6; /* RW */
465 unsigned long rsvd_6_61: 56; /* */
466 unsigned long push : 1; /* WP */
467 unsigned long init : 1; /* WP */
468 } s;
469};
470
471/* ========================================================================= */
472/* UVH_LB_BAU_SB_ACTIVATION_STATUS_0 */
473/* ========================================================================= */
474#define UVH_LB_BAU_SB_ACTIVATION_STATUS_0 0x320030UL
475#define UVH_LB_BAU_SB_ACTIVATION_STATUS_0_32 0x009b0
476
477#define UVH_LB_BAU_SB_ACTIVATION_STATUS_0_STATUS_SHFT 0
478#define UVH_LB_BAU_SB_ACTIVATION_STATUS_0_STATUS_MASK 0xffffffffffffffffUL
479
480union uvh_lb_bau_sb_activation_status_0_u {
481 unsigned long v;
482 struct uvh_lb_bau_sb_activation_status_0_s {
483 unsigned long status : 64; /* RW */
484 } s;
485};
486
487/* ========================================================================= */
488/* UVH_LB_BAU_SB_ACTIVATION_STATUS_1 */
489/* ========================================================================= */
490#define UVH_LB_BAU_SB_ACTIVATION_STATUS_1 0x320040UL
491#define UVH_LB_BAU_SB_ACTIVATION_STATUS_1_32 0x009b8
492
493#define UVH_LB_BAU_SB_ACTIVATION_STATUS_1_STATUS_SHFT 0
494#define UVH_LB_BAU_SB_ACTIVATION_STATUS_1_STATUS_MASK 0xffffffffffffffffUL
495
496union uvh_lb_bau_sb_activation_status_1_u {
497 unsigned long v;
498 struct uvh_lb_bau_sb_activation_status_1_s {
499 unsigned long status : 64; /* RW */
500 } s;
501};
502
503/* ========================================================================= */
504/* UVH_LB_BAU_SB_DESCRIPTOR_BASE */
505/* ========================================================================= */
506#define UVH_LB_BAU_SB_DESCRIPTOR_BASE 0x320010UL
507#define UVH_LB_BAU_SB_DESCRIPTOR_BASE_32 0x009a0
508
509#define UVH_LB_BAU_SB_DESCRIPTOR_BASE_PAGE_ADDRESS_SHFT 12
510#define UVH_LB_BAU_SB_DESCRIPTOR_BASE_PAGE_ADDRESS_MASK 0x000007fffffff000UL
511#define UVH_LB_BAU_SB_DESCRIPTOR_BASE_NODE_ID_SHFT 49
512#define UVH_LB_BAU_SB_DESCRIPTOR_BASE_NODE_ID_MASK 0x7ffe000000000000UL
513
514union uvh_lb_bau_sb_descriptor_base_u {
515 unsigned long v;
516 struct uvh_lb_bau_sb_descriptor_base_s {
517 unsigned long rsvd_0_11 : 12; /* */
518 unsigned long page_address : 31; /* RW */
519 unsigned long rsvd_43_48 : 6; /* */
520 unsigned long node_id : 14; /* RW */
521 unsigned long rsvd_63 : 1; /* */
522 } s;
523};
524
525/* ========================================================================= */
526/* UVH_LB_MCAST_AOERR0_RPT_ENABLE */
527/* ========================================================================= */
528#define UVH_LB_MCAST_AOERR0_RPT_ENABLE 0x50b20UL
529
530#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_SHFT 0
531#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_MASK 0x0000000000000001UL
532#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_SHFT 1
533#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_MASK 0x0000000000000002UL
534#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_SHFT 2
535#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_MASK 0x0000000000000004UL
536#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_SHFT 3
537#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_MASK 0x0000000000000008UL
538#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_SHFT 4
539#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_MASK 0x0000000000000010UL
540#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_SHFT 5
541#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_MASK 0x0000000000000020UL
542#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_SHFT 6
543#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_MASK 0x0000000000000040UL
544#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_SHFT 7
545#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_MASK 0x0000000000000080UL
546#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_SHFT 8
547#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_MASK 0x0000000000000100UL
548#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_SHFT 9
549#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_MASK 0x0000000000000200UL
550#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_SHFT 10
551#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_MASK 0x0000000000000400UL
552#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_SHFT 11
553#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_MASK 0x0000000000000800UL
554#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_SHFT 12
555#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_MASK 0x0000000000001000UL
556#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_SHFT 13
557#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_MASK 0x0000000000002000UL
558#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_SHFT 14
559#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_MASK 0x0000000000004000UL
560#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_SHFT 15
561#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_MASK 0x0000000000008000UL
562#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_SHFT 16
563#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_MASK 0x0000000000010000UL
564#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_SHFT 17
565#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_MASK 0x0000000000020000UL
566#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_SHFT 18
567#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_MASK 0x0000000000040000UL
568#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_SHFT 19
569#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_MASK 0x0000000000080000UL
570#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_SHFT 20
571#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_MASK 0x0000000000100000UL
572#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_SHFT 21
573#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_MASK 0x0000000000200000UL
574#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_SHFT 22
575#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_MASK 0x0000000000400000UL
576#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_SHFT 23
577#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_MASK 0x0000000000800000UL
578#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_SHFT 24
579#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_MASK 0x0000000001000000UL
580#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_SHFT 25
581#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_MASK 0x0000000002000000UL
582#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_SHFT 26
583#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_MASK 0x0000000004000000UL
584#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_SHFT 27
585#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_MASK 0x0000000008000000UL
586#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_SHFT 28
587#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_MASK 0x0000000010000000UL
588#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_SHFT 29
589#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_MASK 0x0000000020000000UL
590#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_SHFT 30
591#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_MASK 0x0000000040000000UL
592#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_SHFT 31
593#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_MASK 0x0000000080000000UL
594#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_SHFT 32
595#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_MASK 0x0000000100000000UL
596#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_SHFT 33
597#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_MASK 0x0000000200000000UL
598#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_SHFT 34
599#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_MASK 0x0000000400000000UL
600#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_SHFT 35
601#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_MASK 0x0000000800000000UL
602#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_SHFT 36
603#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_MASK 0x0000001000000000UL
604#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_SHFT 37
605#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_MASK 0x0000002000000000UL
606#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_SHFT 38
607#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_MASK 0x0000004000000000UL
608#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_SHFT 39
609#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_MASK 0x0000008000000000UL
610#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_SHFT 40
611#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_MASK 0x0000010000000000UL
612#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_SHFT 41
613#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_MASK 0x0000020000000000UL
614#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_SHFT 42
615#define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_MASK 0x0000040000000000UL
616
617union uvh_lb_mcast_aoerr0_rpt_enable_u {
618 unsigned long v;
619 struct uvh_lb_mcast_aoerr0_rpt_enable_s {
620 unsigned long mcast_obese_msg : 1; /* RW */
621 unsigned long mcast_data_sb_err : 1; /* RW */
622 unsigned long mcast_nack_buff_parity : 1; /* RW */
623 unsigned long mcast_timeout : 1; /* RW */
624 unsigned long mcast_inactive_reply : 1; /* RW */
625 unsigned long mcast_upgrade_error : 1; /* RW */
626 unsigned long mcast_reg_count_underflow : 1; /* RW */
627 unsigned long mcast_rep_obese_msg : 1; /* RW */
628 unsigned long ucache_req_runt_msg : 1; /* RW */
629 unsigned long ucache_req_obese_msg : 1; /* RW */
630 unsigned long ucache_req_data_sb_err : 1; /* RW */
631 unsigned long ucache_rep_runt_msg : 1; /* RW */
632 unsigned long ucache_rep_obese_msg : 1; /* RW */
633 unsigned long ucache_rep_data_sb_err : 1; /* RW */
634 unsigned long ucache_rep_command_err : 1; /* RW */
635 unsigned long ucache_pend_timeout : 1; /* RW */
636 unsigned long macc_req_runt_msg : 1; /* RW */
637 unsigned long macc_req_obese_msg : 1; /* RW */
638 unsigned long macc_req_data_sb_err : 1; /* RW */
639 unsigned long macc_rep_runt_msg : 1; /* RW */
640 unsigned long macc_rep_obese_msg : 1; /* RW */
641 unsigned long macc_rep_data_sb_err : 1; /* RW */
642 unsigned long macc_amo_timeout : 1; /* RW */
643 unsigned long macc_put_timeout : 1; /* RW */
644 unsigned long macc_spurious_event : 1; /* RW */
645 unsigned long ioh_destination_table_parity : 1; /* RW */
646 unsigned long get_had_error_reply : 1; /* RW */
647 unsigned long get_timeout : 1; /* RW */
648 unsigned long lock_manager_had_error_reply : 1; /* RW */
649 unsigned long put_had_error_reply : 1; /* RW */
650 unsigned long put_timeout : 1; /* RW */
651 unsigned long sb_activation_overrun : 1; /* RW */
652 unsigned long completed_gb_activation_had_error_reply : 1; /* RW */
653 unsigned long completed_gb_activation_timeout : 1; /* RW */
654 unsigned long descriptor_buffer_0_parity : 1; /* RW */
655 unsigned long descriptor_buffer_1_parity : 1; /* RW */
656 unsigned long socket_destination_table_parity : 1; /* RW */
657 unsigned long bau_reply_payload_corruption : 1; /* RW */
658 unsigned long io_port_destination_table_parity : 1; /* RW */
659 unsigned long intd_soft_ack_timeout : 1; /* RW */
660 unsigned long int_rep_obese_msg : 1; /* RW */
661 unsigned long int_rep_command_err : 1; /* RW */
662 unsigned long int_timeout : 1; /* RW */
663 unsigned long rsvd_43_63 : 21; /* */
664 } s;
665};
666
667/* ========================================================================= */
668/* UVH_LOCAL_INT0_CONFIG */
669/* ========================================================================= */
670#define UVH_LOCAL_INT0_CONFIG 0x61000UL
671
672#define UVH_LOCAL_INT0_CONFIG_VECTOR_SHFT 0
673#define UVH_LOCAL_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL
674#define UVH_LOCAL_INT0_CONFIG_DM_SHFT 8
675#define UVH_LOCAL_INT0_CONFIG_DM_MASK 0x0000000000000700UL
676#define UVH_LOCAL_INT0_CONFIG_DESTMODE_SHFT 11
677#define UVH_LOCAL_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL
678#define UVH_LOCAL_INT0_CONFIG_STATUS_SHFT 12
679#define UVH_LOCAL_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL
680#define UVH_LOCAL_INT0_CONFIG_P_SHFT 13
681#define UVH_LOCAL_INT0_CONFIG_P_MASK 0x0000000000002000UL
682#define UVH_LOCAL_INT0_CONFIG_T_SHFT 15
683#define UVH_LOCAL_INT0_CONFIG_T_MASK 0x0000000000008000UL
684#define UVH_LOCAL_INT0_CONFIG_M_SHFT 16
685#define UVH_LOCAL_INT0_CONFIG_M_MASK 0x0000000000010000UL
686#define UVH_LOCAL_INT0_CONFIG_APIC_ID_SHFT 32
687#define UVH_LOCAL_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
688
689union uvh_local_int0_config_u {
690 unsigned long v;
691 struct uvh_local_int0_config_s {
692 unsigned long vector_ : 8; /* RW */
693 unsigned long dm : 3; /* RW */
694 unsigned long destmode : 1; /* RW */
695 unsigned long status : 1; /* RO */
696 unsigned long p : 1; /* RO */
697 unsigned long rsvd_14 : 1; /* */
698 unsigned long t : 1; /* RO */
699 unsigned long m : 1; /* RW */
700 unsigned long rsvd_17_31: 15; /* */
701 unsigned long apic_id : 32; /* RW */
702 } s;
703};
704
705/* ========================================================================= */
706/* UVH_LOCAL_INT0_ENABLE */
707/* ========================================================================= */
708#define UVH_LOCAL_INT0_ENABLE 0x65000UL
709
710#define UVH_LOCAL_INT0_ENABLE_LB_HCERR_SHFT 0
711#define UVH_LOCAL_INT0_ENABLE_LB_HCERR_MASK 0x0000000000000001UL
712#define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_SHFT 1
713#define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_MASK 0x0000000000000002UL
714#define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_SHFT 2
715#define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_MASK 0x0000000000000004UL
716#define UVH_LOCAL_INT0_ENABLE_LH_HCERR_SHFT 3
717#define UVH_LOCAL_INT0_ENABLE_LH_HCERR_MASK 0x0000000000000008UL
718#define UVH_LOCAL_INT0_ENABLE_RH_HCERR_SHFT 4
719#define UVH_LOCAL_INT0_ENABLE_RH_HCERR_MASK 0x0000000000000010UL
720#define UVH_LOCAL_INT0_ENABLE_XN_HCERR_SHFT 5
721#define UVH_LOCAL_INT0_ENABLE_XN_HCERR_MASK 0x0000000000000020UL
722#define UVH_LOCAL_INT0_ENABLE_SI_HCERR_SHFT 6
723#define UVH_LOCAL_INT0_ENABLE_SI_HCERR_MASK 0x0000000000000040UL
724#define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_SHFT 7
725#define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_MASK 0x0000000000000080UL
726#define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_SHFT 8
727#define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_MASK 0x0000000000000100UL
728#define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_SHFT 9
729#define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_MASK 0x0000000000000200UL
730#define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_SHFT 10
731#define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_MASK 0x0000000000000400UL
732#define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_SHFT 11
733#define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_MASK 0x0000000000000800UL
734#define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_SHFT 12
735#define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_MASK 0x0000000000001000UL
736#define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_SHFT 13
737#define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_MASK 0x0000000000002000UL
738#define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_SHFT 14
739#define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_MASK 0x0000000000004000UL
740#define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_SHFT 15
741#define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_MASK 0x0000000000008000UL
742#define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_SHFT 16
743#define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_MASK 0x0000000000010000UL
744#define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_SHFT 17
745#define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_MASK 0x0000000000020000UL
746#define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_SHFT 18
747#define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_MASK 0x0000000000040000UL
748#define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_SHFT 19
749#define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_MASK 0x0000000000080000UL
750#define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_SHFT 20
751#define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_MASK 0x0000000000100000UL
752#define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_SHFT 21
753#define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_MASK 0x0000000000200000UL
754#define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_SHFT 22
755#define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_MASK 0x0000000000400000UL
756#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_SHFT 23
757#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_MASK 0x0000000000800000UL
758#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_SHFT 24
759#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_MASK 0x0000000001000000UL
760#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_SHFT 25
761#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_MASK 0x0000000002000000UL
762#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_SHFT 26
763#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_MASK 0x0000000004000000UL
764#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_SHFT 27
765#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_MASK 0x0000000008000000UL
766#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_SHFT 28
767#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_MASK 0x0000000010000000UL
768#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_SHFT 29
769#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_MASK 0x0000000020000000UL
770#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_SHFT 30
771#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_MASK 0x0000000040000000UL
772#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_SHFT 31
773#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_MASK 0x0000000080000000UL
774#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_SHFT 32
775#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_MASK 0x0000000100000000UL
776#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_SHFT 33
777#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_MASK 0x0000000200000000UL
778#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_SHFT 34
779#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_MASK 0x0000000400000000UL
780#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_SHFT 35
781#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_MASK 0x0000000800000000UL
782#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_SHFT 36
783#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_MASK 0x0000001000000000UL
784#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_SHFT 37
785#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_MASK 0x0000002000000000UL
786#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_SHFT 38
787#define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_MASK 0x0000004000000000UL
788#define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_SHFT 39
789#define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_MASK 0x0000008000000000UL
790#define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_SHFT 40
791#define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_MASK 0x0000010000000000UL
792#define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_SHFT 41
793#define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_MASK 0x0000020000000000UL
794#define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_SHFT 42
795#define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_MASK 0x0000040000000000UL
796#define UVH_LOCAL_INT0_ENABLE_LTC_INT_SHFT 43
797#define UVH_LOCAL_INT0_ENABLE_LTC_INT_MASK 0x0000080000000000UL
798#define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_SHFT 44
799#define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_MASK 0x0000100000000000UL
800
801union uvh_local_int0_enable_u {
802 unsigned long v;
803 struct uvh_local_int0_enable_s {
804 unsigned long lb_hcerr : 1; /* RW */
805 unsigned long gr0_hcerr : 1; /* RW */
806 unsigned long gr1_hcerr : 1; /* RW */
807 unsigned long lh_hcerr : 1; /* RW */
808 unsigned long rh_hcerr : 1; /* RW */
809 unsigned long xn_hcerr : 1; /* RW */
810 unsigned long si_hcerr : 1; /* RW */
811 unsigned long lb_aoerr0 : 1; /* RW */
812 unsigned long gr0_aoerr0 : 1; /* RW */
813 unsigned long gr1_aoerr0 : 1; /* RW */
814 unsigned long lh_aoerr0 : 1; /* RW */
815 unsigned long rh_aoerr0 : 1; /* RW */
816 unsigned long xn_aoerr0 : 1; /* RW */
817 unsigned long si_aoerr0 : 1; /* RW */
818 unsigned long lb_aoerr1 : 1; /* RW */
819 unsigned long gr0_aoerr1 : 1; /* RW */
820 unsigned long gr1_aoerr1 : 1; /* RW */
821 unsigned long lh_aoerr1 : 1; /* RW */
822 unsigned long rh_aoerr1 : 1; /* RW */
823 unsigned long xn_aoerr1 : 1; /* RW */
824 unsigned long si_aoerr1 : 1; /* RW */
825 unsigned long rh_vpi_int : 1; /* RW */
826 unsigned long system_shutdown_int : 1; /* RW */
827 unsigned long lb_irq_int_0 : 1; /* RW */
828 unsigned long lb_irq_int_1 : 1; /* RW */
829 unsigned long lb_irq_int_2 : 1; /* RW */
830 unsigned long lb_irq_int_3 : 1; /* RW */
831 unsigned long lb_irq_int_4 : 1; /* RW */
832 unsigned long lb_irq_int_5 : 1; /* RW */
833 unsigned long lb_irq_int_6 : 1; /* RW */
834 unsigned long lb_irq_int_7 : 1; /* RW */
835 unsigned long lb_irq_int_8 : 1; /* RW */
836 unsigned long lb_irq_int_9 : 1; /* RW */
837 unsigned long lb_irq_int_10 : 1; /* RW */
838 unsigned long lb_irq_int_11 : 1; /* RW */
839 unsigned long lb_irq_int_12 : 1; /* RW */
840 unsigned long lb_irq_int_13 : 1; /* RW */
841 unsigned long lb_irq_int_14 : 1; /* RW */
842 unsigned long lb_irq_int_15 : 1; /* RW */
843 unsigned long l1_nmi_int : 1; /* RW */
844 unsigned long stop_clock : 1; /* RW */
845 unsigned long asic_to_l1 : 1; /* RW */
846 unsigned long l1_to_asic : 1; /* RW */
847 unsigned long ltc_int : 1; /* RW */
848 unsigned long la_seq_trigger : 1; /* RW */
849 unsigned long rsvd_45_63 : 19; /* */
850 } s;
851};
852
853/* ========================================================================= */
854/* UVH_NODE_ID */
855/* ========================================================================= */
856#define UVH_NODE_ID 0x0UL
857
858#define UVH_NODE_ID_FORCE1_SHFT 0
859#define UVH_NODE_ID_FORCE1_MASK 0x0000000000000001UL
860#define UVH_NODE_ID_MANUFACTURER_SHFT 1
861#define UVH_NODE_ID_MANUFACTURER_MASK 0x0000000000000ffeUL
862#define UVH_NODE_ID_PART_NUMBER_SHFT 12
863#define UVH_NODE_ID_PART_NUMBER_MASK 0x000000000ffff000UL
864#define UVH_NODE_ID_REVISION_SHFT 28
865#define UVH_NODE_ID_REVISION_MASK 0x00000000f0000000UL
866#define UVH_NODE_ID_NODE_ID_SHFT 32
867#define UVH_NODE_ID_NODE_ID_MASK 0x00007fff00000000UL
868#define UVH_NODE_ID_NODES_PER_BIT_SHFT 48
869#define UVH_NODE_ID_NODES_PER_BIT_MASK 0x007f000000000000UL
870#define UVH_NODE_ID_NI_PORT_SHFT 56
871#define UVH_NODE_ID_NI_PORT_MASK 0x0f00000000000000UL
872
873union uvh_node_id_u {
874 unsigned long v;
875 struct uvh_node_id_s {
876 unsigned long force1 : 1; /* RO */
877 unsigned long manufacturer : 11; /* RO */
878 unsigned long part_number : 16; /* RO */
879 unsigned long revision : 4; /* RO */
880 unsigned long node_id : 15; /* RW */
881 unsigned long rsvd_47 : 1; /* */
882 unsigned long nodes_per_bit : 7; /* RW */
883 unsigned long rsvd_55 : 1; /* */
884 unsigned long ni_port : 4; /* RO */
885 unsigned long rsvd_60_63 : 4; /* */
886 } s;
887};
888
889/* ========================================================================= */
890/* UVH_NODE_PRESENT_TABLE */
891/* ========================================================================= */
892#define UVH_NODE_PRESENT_TABLE 0x1400UL
893#define UVH_NODE_PRESENT_TABLE_DEPTH 16
894
895#define UVH_NODE_PRESENT_TABLE_NODES_SHFT 0
896#define UVH_NODE_PRESENT_TABLE_NODES_MASK 0xffffffffffffffffUL
897
898union uvh_node_present_table_u {
899 unsigned long v;
900 struct uvh_node_present_table_s {
901 unsigned long nodes : 64; /* RW */
902 } s;
903};
904
905/* ========================================================================= */
906/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */
907/* ========================================================================= */
908#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL
909
910#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT 24
911#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_MASK 0x00003fffff000000UL
912
913union uvh_rh_gam_alias210_redirect_config_0_mmr_u {
914 unsigned long v;
915 struct uvh_rh_gam_alias210_redirect_config_0_mmr_s {
916 unsigned long rsvd_0_23 : 24; /* */
917 unsigned long dest_base : 22; /* RW */
918 unsigned long rsvd_46_63: 18; /* */
919 } s;
920};
921
922/* ========================================================================= */
923/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR */
924/* ========================================================================= */
925#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR 0x16000e0UL
926
927#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR_DEST_BASE_SHFT 24
928#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR_DEST_BASE_MASK 0x00003fffff000000UL
929
930union uvh_rh_gam_alias210_redirect_config_1_mmr_u {
931 unsigned long v;
932 struct uvh_rh_gam_alias210_redirect_config_1_mmr_s {
933 unsigned long rsvd_0_23 : 24; /* */
934 unsigned long dest_base : 22; /* RW */
935 unsigned long rsvd_46_63: 18; /* */
936 } s;
937};
938
939/* ========================================================================= */
940/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR */
941/* ========================================================================= */
942#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR 0x16000f0UL
943
944#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR_DEST_BASE_SHFT 24
945#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR_DEST_BASE_MASK 0x00003fffff000000UL
946
947union uvh_rh_gam_alias210_redirect_config_2_mmr_u {
948 unsigned long v;
949 struct uvh_rh_gam_alias210_redirect_config_2_mmr_s {
950 unsigned long rsvd_0_23 : 24; /* */
951 unsigned long dest_base : 22; /* RW */
952 unsigned long rsvd_46_63: 18; /* */
953 } s;
954};
955
956/* ========================================================================= */
957/* UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR */
958/* ========================================================================= */
959#define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR 0x1600020UL
960
961#define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_SHFT 26
962#define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffffc000000UL
963#define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
964#define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
965
966union uvh_rh_gam_cfg_overlay_config_mmr_u {
967 unsigned long v;
968 struct uvh_rh_gam_cfg_overlay_config_mmr_s {
969 unsigned long rsvd_0_25: 26; /* */
970 unsigned long base : 20; /* RW */
971 unsigned long rsvd_46_62: 17; /* */
972 unsigned long enable : 1; /* RW */
973 } s;
974};
975
976/* ========================================================================= */
977/* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */
978/* ========================================================================= */
979#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL
980
981#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT 28
982#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffff0000000UL
983#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_GR4_SHFT 48
984#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_GR4_MASK 0x0001000000000000UL
985#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_N_GRU_SHFT 52
986#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_N_GRU_MASK 0x00f0000000000000UL
987#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
988#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
989
990union uvh_rh_gam_gru_overlay_config_mmr_u {
991 unsigned long v;
992 struct uvh_rh_gam_gru_overlay_config_mmr_s {
993 unsigned long rsvd_0_27: 28; /* */
994 unsigned long base : 18; /* RW */
995 unsigned long rsvd_46_47: 2; /* */
996 unsigned long gr4 : 1; /* RW */
997 unsigned long rsvd_49_51: 3; /* */
998 unsigned long n_gru : 4; /* RW */
999 unsigned long rsvd_56_62: 7; /* */
1000 unsigned long enable : 1; /* RW */
1001 } s;
1002};
1003
1004/* ========================================================================= */
1005/* UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR */
1006/* ========================================================================= */
1007#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR 0x1600030UL
1008
1009#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_BASE_SHFT 30
1010#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003fffc0000000UL
1011#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_M_IO_SHFT 46
1012#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_M_IO_MASK 0x000fc00000000000UL
1013#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_N_IO_SHFT 52
1014#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_N_IO_MASK 0x00f0000000000000UL
1015#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
1016#define UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
1017
1018union uvh_rh_gam_mmioh_overlay_config_mmr_u {
1019 unsigned long v;
1020 struct uvh_rh_gam_mmioh_overlay_config_mmr_s {
1021 unsigned long rsvd_0_29: 30; /* */
1022 unsigned long base : 16; /* RW */
1023 unsigned long m_io : 6; /* RW */
1024 unsigned long n_io : 4; /* RW */
1025 unsigned long rsvd_56_62: 7; /* */
1026 unsigned long enable : 1; /* RW */
1027 } s;
1028};
1029
1030/* ========================================================================= */
1031/* UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR */
1032/* ========================================================================= */
1033#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR 0x1600028UL
1034
1035#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_SHFT 26
1036#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffffc000000UL
1037#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_DUAL_HUB_SHFT 46
1038#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_DUAL_HUB_MASK 0x0000400000000000UL
1039#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63
1040#define UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL
1041
1042union uvh_rh_gam_mmr_overlay_config_mmr_u {
1043 unsigned long v;
1044 struct uvh_rh_gam_mmr_overlay_config_mmr_s {
1045 unsigned long rsvd_0_25: 26; /* */
1046 unsigned long base : 20; /* RW */
1047 unsigned long dual_hub : 1; /* RW */
1048 unsigned long rsvd_47_62: 16; /* */
1049 unsigned long enable : 1; /* RW */
1050 } s;
1051};
1052
1053/* ========================================================================= */
1054/* UVH_RTC */
1055/* ========================================================================= */
1056#define UVH_RTC 0x340000UL
1057
1058#define UVH_RTC_REAL_TIME_CLOCK_SHFT 0
1059#define UVH_RTC_REAL_TIME_CLOCK_MASK 0x00ffffffffffffffUL
1060
1061union uvh_rtc_u {
1062 unsigned long v;
1063 struct uvh_rtc_s {
1064 unsigned long real_time_clock : 56; /* RW */
1065 unsigned long rsvd_56_63 : 8; /* */
1066 } s;
1067};
1068
1069/* ========================================================================= */
1070/* UVH_RTC1_INT_CONFIG */
1071/* ========================================================================= */
1072#define UVH_RTC1_INT_CONFIG 0x615c0UL
1073
1074#define UVH_RTC1_INT_CONFIG_VECTOR_SHFT 0
1075#define UVH_RTC1_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL
1076#define UVH_RTC1_INT_CONFIG_DM_SHFT 8
1077#define UVH_RTC1_INT_CONFIG_DM_MASK 0x0000000000000700UL
1078#define UVH_RTC1_INT_CONFIG_DESTMODE_SHFT 11
1079#define UVH_RTC1_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL
1080#define UVH_RTC1_INT_CONFIG_STATUS_SHFT 12
1081#define UVH_RTC1_INT_CONFIG_STATUS_MASK 0x0000000000001000UL
1082#define UVH_RTC1_INT_CONFIG_P_SHFT 13
1083#define UVH_RTC1_INT_CONFIG_P_MASK 0x0000000000002000UL
1084#define UVH_RTC1_INT_CONFIG_T_SHFT 15
1085#define UVH_RTC1_INT_CONFIG_T_MASK 0x0000000000008000UL
1086#define UVH_RTC1_INT_CONFIG_M_SHFT 16
1087#define UVH_RTC1_INT_CONFIG_M_MASK 0x0000000000010000UL
1088#define UVH_RTC1_INT_CONFIG_APIC_ID_SHFT 32
1089#define UVH_RTC1_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
1090
1091union uvh_rtc1_int_config_u {
1092 unsigned long v;
1093 struct uvh_rtc1_int_config_s {
1094 unsigned long vector_ : 8; /* RW */
1095 unsigned long dm : 3; /* RW */
1096 unsigned long destmode : 1; /* RW */
1097 unsigned long status : 1; /* RO */
1098 unsigned long p : 1; /* RO */
1099 unsigned long rsvd_14 : 1; /* */
1100 unsigned long t : 1; /* RO */
1101 unsigned long m : 1; /* RW */
1102 unsigned long rsvd_17_31: 15; /* */
1103 unsigned long apic_id : 32; /* RW */
1104 } s;
1105};
1106
1107/* ========================================================================= */
1108/* UVH_RTC2_INT_CONFIG */
1109/* ========================================================================= */
1110#define UVH_RTC2_INT_CONFIG 0x61600UL
1111
1112#define UVH_RTC2_INT_CONFIG_VECTOR_SHFT 0
1113#define UVH_RTC2_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL
1114#define UVH_RTC2_INT_CONFIG_DM_SHFT 8
1115#define UVH_RTC2_INT_CONFIG_DM_MASK 0x0000000000000700UL
1116#define UVH_RTC2_INT_CONFIG_DESTMODE_SHFT 11
1117#define UVH_RTC2_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL
1118#define UVH_RTC2_INT_CONFIG_STATUS_SHFT 12
1119#define UVH_RTC2_INT_CONFIG_STATUS_MASK 0x0000000000001000UL
1120#define UVH_RTC2_INT_CONFIG_P_SHFT 13
1121#define UVH_RTC2_INT_CONFIG_P_MASK 0x0000000000002000UL
1122#define UVH_RTC2_INT_CONFIG_T_SHFT 15
1123#define UVH_RTC2_INT_CONFIG_T_MASK 0x0000000000008000UL
1124#define UVH_RTC2_INT_CONFIG_M_SHFT 16
1125#define UVH_RTC2_INT_CONFIG_M_MASK 0x0000000000010000UL
1126#define UVH_RTC2_INT_CONFIG_APIC_ID_SHFT 32
1127#define UVH_RTC2_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
1128
1129union uvh_rtc2_int_config_u {
1130 unsigned long v;
1131 struct uvh_rtc2_int_config_s {
1132 unsigned long vector_ : 8; /* RW */
1133 unsigned long dm : 3; /* RW */
1134 unsigned long destmode : 1; /* RW */
1135 unsigned long status : 1; /* RO */
1136 unsigned long p : 1; /* RO */
1137 unsigned long rsvd_14 : 1; /* */
1138 unsigned long t : 1; /* RO */
1139 unsigned long m : 1; /* RW */
1140 unsigned long rsvd_17_31: 15; /* */
1141 unsigned long apic_id : 32; /* RW */
1142 } s;
1143};
1144
1145/* ========================================================================= */
1146/* UVH_RTC3_INT_CONFIG */
1147/* ========================================================================= */
1148#define UVH_RTC3_INT_CONFIG 0x61640UL
1149
1150#define UVH_RTC3_INT_CONFIG_VECTOR_SHFT 0
1151#define UVH_RTC3_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL
1152#define UVH_RTC3_INT_CONFIG_DM_SHFT 8
1153#define UVH_RTC3_INT_CONFIG_DM_MASK 0x0000000000000700UL
1154#define UVH_RTC3_INT_CONFIG_DESTMODE_SHFT 11
1155#define UVH_RTC3_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL
1156#define UVH_RTC3_INT_CONFIG_STATUS_SHFT 12
1157#define UVH_RTC3_INT_CONFIG_STATUS_MASK 0x0000000000001000UL
1158#define UVH_RTC3_INT_CONFIG_P_SHFT 13
1159#define UVH_RTC3_INT_CONFIG_P_MASK 0x0000000000002000UL
1160#define UVH_RTC3_INT_CONFIG_T_SHFT 15
1161#define UVH_RTC3_INT_CONFIG_T_MASK 0x0000000000008000UL
1162#define UVH_RTC3_INT_CONFIG_M_SHFT 16
1163#define UVH_RTC3_INT_CONFIG_M_MASK 0x0000000000010000UL
1164#define UVH_RTC3_INT_CONFIG_APIC_ID_SHFT 32
1165#define UVH_RTC3_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL
1166
1167union uvh_rtc3_int_config_u {
1168 unsigned long v;
1169 struct uvh_rtc3_int_config_s {
1170 unsigned long vector_ : 8; /* RW */
1171 unsigned long dm : 3; /* RW */
1172 unsigned long destmode : 1; /* RW */
1173 unsigned long status : 1; /* RO */
1174 unsigned long p : 1; /* RO */
1175 unsigned long rsvd_14 : 1; /* */
1176 unsigned long t : 1; /* RO */
1177 unsigned long m : 1; /* RW */
1178 unsigned long rsvd_17_31: 15; /* */
1179 unsigned long apic_id : 32; /* RW */
1180 } s;
1181};
1182
1183/* ========================================================================= */
1184/* UVH_RTC_INC_RATIO */
1185/* ========================================================================= */
1186#define UVH_RTC_INC_RATIO 0x350000UL
1187
1188#define UVH_RTC_INC_RATIO_FRACTION_SHFT 0
1189#define UVH_RTC_INC_RATIO_FRACTION_MASK 0x00000000000fffffUL
1190#define UVH_RTC_INC_RATIO_RATIO_SHFT 20
1191#define UVH_RTC_INC_RATIO_RATIO_MASK 0x0000000000700000UL
1192
1193union uvh_rtc_inc_ratio_u {
1194 unsigned long v;
1195 struct uvh_rtc_inc_ratio_s {
1196 unsigned long fraction : 20; /* RW */
1197 unsigned long ratio : 3; /* RW */
1198 unsigned long rsvd_23_63: 41; /* */
1199 } s;
1200};
1201
1202/* ========================================================================= */
1203/* UVH_SI_ADDR_MAP_CONFIG */
1204/* ========================================================================= */
1205#define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL
1206
1207#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_SHFT 0
1208#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_MASK 0x000000000000003fUL
1209#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_SHFT 8
1210#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_MASK 0x0000000000000f00UL
1211
1212union uvh_si_addr_map_config_u {
1213 unsigned long v;
1214 struct uvh_si_addr_map_config_s {
1215 unsigned long m_skt : 6; /* RW */
1216 unsigned long rsvd_6_7: 2; /* */
1217 unsigned long n_skt : 4; /* RW */
1218 unsigned long rsvd_12_63: 52; /* */
1219 } s;
1220};
1221
1222/* ========================================================================= */
1223/* UVH_SI_ALIAS0_OVERLAY_CONFIG */
1224/* ========================================================================= */
1225#define UVH_SI_ALIAS0_OVERLAY_CONFIG 0xc80008UL
1226
1227#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_SHFT 24
1228#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1229#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1230#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1231#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_SHFT 63
1232#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1233
1234union uvh_si_alias0_overlay_config_u {
1235 unsigned long v;
1236 struct uvh_si_alias0_overlay_config_s {
1237 unsigned long rsvd_0_23: 24; /* */
1238 unsigned long base : 8; /* RW */
1239 unsigned long rsvd_32_47: 16; /* */
1240 unsigned long m_alias : 5; /* RW */
1241 unsigned long rsvd_53_62: 10; /* */
1242 unsigned long enable : 1; /* RW */
1243 } s;
1244};
1245
1246/* ========================================================================= */
1247/* UVH_SI_ALIAS1_OVERLAY_CONFIG */
1248/* ========================================================================= */
1249#define UVH_SI_ALIAS1_OVERLAY_CONFIG 0xc80010UL
1250
1251#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_SHFT 24
1252#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1253#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1254#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1255#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_SHFT 63
1256#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1257
1258union uvh_si_alias1_overlay_config_u {
1259 unsigned long v;
1260 struct uvh_si_alias1_overlay_config_s {
1261 unsigned long rsvd_0_23: 24; /* */
1262 unsigned long base : 8; /* RW */
1263 unsigned long rsvd_32_47: 16; /* */
1264 unsigned long m_alias : 5; /* RW */
1265 unsigned long rsvd_53_62: 10; /* */
1266 unsigned long enable : 1; /* RW */
1267 } s;
1268};
1269
1270/* ========================================================================= */
1271/* UVH_SI_ALIAS2_OVERLAY_CONFIG */
1272/* ========================================================================= */
1273#define UVH_SI_ALIAS2_OVERLAY_CONFIG 0xc80018UL
1274
1275#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_SHFT 24
1276#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1277#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1278#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1279#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_SHFT 63
1280#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1281
1282union uvh_si_alias2_overlay_config_u {
1283 unsigned long v;
1284 struct uvh_si_alias2_overlay_config_s {
1285 unsigned long rsvd_0_23: 24; /* */
1286 unsigned long base : 8; /* RW */
1287 unsigned long rsvd_32_47: 16; /* */
1288 unsigned long m_alias : 5; /* RW */
1289 unsigned long rsvd_53_62: 10; /* */
1290 unsigned long enable : 1; /* RW */
1291 } s;
1292};
1293
1294
1295#endif /* __ASM_X86_UV_MMRS__ */
diff --git a/include/asm-x86/vdso.h b/include/asm-x86/vdso.h
deleted file mode 100644
index 8e18fb80f5e6..000000000000
--- a/include/asm-x86/vdso.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _ASM_X86_VDSO_H
2#define _ASM_X86_VDSO_H 1
3
4#ifdef CONFIG_X86_64
5extern const char VDSO64_PRELINK[];
6
7/*
8 * Given a pointer to the vDSO image, find the pointer to VDSO64_name
9 * as that symbol is defined in the vDSO sources or linker script.
10 */
11#define VDSO64_SYMBOL(base, name) \
12({ \
13 extern const char VDSO64_##name[]; \
14 (void *)(VDSO64_##name - VDSO64_PRELINK + (unsigned long)(base)); \
15})
16#endif
17
18#if defined CONFIG_X86_32 || defined CONFIG_COMPAT
19extern const char VDSO32_PRELINK[];
20
21/*
22 * Given a pointer to the vDSO image, find the pointer to VDSO32_name
23 * as that symbol is defined in the vDSO sources or linker script.
24 */
25#define VDSO32_SYMBOL(base, name) \
26({ \
27 extern const char VDSO32_##name[]; \
28 (void *)(VDSO32_##name - VDSO32_PRELINK + (unsigned long)(base)); \
29})
30#endif
31
32/*
33 * These symbols are defined with the addresses in the vsyscall page.
34 * See vsyscall-sigreturn.S.
35 */
36extern void __user __kernel_sigreturn;
37extern void __user __kernel_rt_sigreturn;
38
39/*
40 * These symbols are defined by vdso32.S to mark the bounds
41 * of the ELF DSO images included therein.
42 */
43extern const char vdso32_int80_start, vdso32_int80_end;
44extern const char vdso32_syscall_start, vdso32_syscall_end;
45extern const char vdso32_sysenter_start, vdso32_sysenter_end;
46
47#endif /* asm-x86/vdso.h */
diff --git a/include/asm-x86/vga.h b/include/asm-x86/vga.h
deleted file mode 100644
index 0ccf804377e6..000000000000
--- a/include/asm-x86/vga.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6
7#ifndef _LINUX_ASM_VGA_H_
8#define _LINUX_ASM_VGA_H_
9
10/*
11 * On the PC, we can just recalculate addresses and then
12 * access the videoram directly without any black magic.
13 */
14
15#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
16
17#define vga_readb(x) (*(x))
18#define vga_writeb(x, y) (*(y) = (x))
19
20#endif
diff --git a/include/asm-x86/vgtod.h b/include/asm-x86/vgtod.h
deleted file mode 100644
index 3301f0929342..000000000000
--- a/include/asm-x86/vgtod.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_VGTOD_H
2#define _ASM_VGTOD_H 1
3
4#include <asm/vsyscall.h>
5#include <linux/clocksource.h>
6
7struct vsyscall_gtod_data {
8 seqlock_t lock;
9
10 /* open coded 'struct timespec' */
11 time_t wall_time_sec;
12 u32 wall_time_nsec;
13
14 int sysctl_enabled;
15 struct timezone sys_tz;
16 struct { /* extract of a clocksource struct */
17 cycle_t (*vread)(void);
18 cycle_t cycle_last;
19 cycle_t mask;
20 u32 mult;
21 u32 shift;
22 } clock;
23 struct timespec wall_to_monotonic;
24};
25extern struct vsyscall_gtod_data __vsyscall_gtod_data
26__section_vsyscall_gtod_data;
27extern struct vsyscall_gtod_data vsyscall_gtod_data;
28
29#endif
diff --git a/include/asm-x86/vic.h b/include/asm-x86/vic.h
deleted file mode 100644
index 53100f353612..000000000000
--- a/include/asm-x86/vic.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/* Copyright (C) 1999,2001
2 *
3 * Author: J.E.J.Bottomley@HansenPartnership.com
4 *
5 * Standard include definitions for the NCR Voyager Interrupt Controller */
6
7/* The eight CPI vectors. To activate a CPI, you write a bit mask
8 * corresponding to the processor set to be interrupted into the
9 * relevant register. That set of CPUs will then be interrupted with
10 * the CPI */
11static const int VIC_CPI_Registers[] =
12 {0xFC00, 0xFC01, 0xFC08, 0xFC09,
13 0xFC10, 0xFC11, 0xFC18, 0xFC19 };
14
15#define VIC_PROC_WHO_AM_I 0xfc29
16# define QUAD_IDENTIFIER 0xC0
17# define EIGHT_SLOT_IDENTIFIER 0xE0
18#define QIC_EXTENDED_PROCESSOR_SELECT 0xFC72
19#define VIC_CPI_BASE_REGISTER 0xFC41
20#define VIC_PROCESSOR_ID 0xFC21
21# define VIC_CPU_MASQUERADE_ENABLE 0x8
22
23#define VIC_CLAIM_REGISTER_0 0xFC38
24#define VIC_CLAIM_REGISTER_1 0xFC39
25#define VIC_REDIRECT_REGISTER_0 0xFC60
26#define VIC_REDIRECT_REGISTER_1 0xFC61
27#define VIC_PRIORITY_REGISTER 0xFC20
28
29#define VIC_PRIMARY_MC_BASE 0xFC48
30#define VIC_SECONDARY_MC_BASE 0xFC49
31
32#define QIC_PROCESSOR_ID 0xFC71
33# define QIC_CPUID_ENABLE 0x08
34
35#define QIC_VIC_CPI_BASE_REGISTER 0xFC79
36#define QIC_CPI_BASE_REGISTER 0xFC7A
37
38#define QIC_MASK_REGISTER0 0xFC80
39/* NOTE: these are masked high, enabled low */
40# define QIC_PERF_TIMER 0x01
41# define QIC_LPE 0x02
42# define QIC_SYS_INT 0x04
43# define QIC_CMN_INT 0x08
44/* at the moment, just enable CMN_INT, disable SYS_INT */
45# define QIC_DEFAULT_MASK0 (~(QIC_CMN_INT /* | VIC_SYS_INT */))
46#define QIC_MASK_REGISTER1 0xFC81
47# define QIC_BOOT_CPI_MASK 0xFE
48/* Enable CPI's 1-6 inclusive */
49# define QIC_CPI_ENABLE 0x81
50
51#define QIC_INTERRUPT_CLEAR0 0xFC8A
52#define QIC_INTERRUPT_CLEAR1 0xFC8B
53
54/* this is where we place the CPI vectors */
55#define VIC_DEFAULT_CPI_BASE 0xC0
56/* this is where we place the QIC CPI vectors */
57#define QIC_DEFAULT_CPI_BASE 0xD0
58
59#define VIC_BOOT_INTERRUPT_MASK 0xfe
60
61extern void smp_vic_timer_interrupt(void);
diff --git a/include/asm-x86/visws/cobalt.h b/include/asm-x86/visws/cobalt.h
deleted file mode 100644
index 995258831b7f..000000000000
--- a/include/asm-x86/visws/cobalt.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef __I386_SGI_COBALT_H
2#define __I386_SGI_COBALT_H
3
4#include <asm/fixmap.h>
5
6/*
7 * Cobalt SGI Visual Workstation system ASIC
8 */
9
10#define CO_CPU_NUM_PHYS 0x1e00
11#define CO_CPU_TAB_PHYS (CO_CPU_NUM_PHYS + 2)
12
13#define CO_CPU_MAX 4
14
15#define CO_CPU_PHYS 0xc2000000
16#define CO_APIC_PHYS 0xc4000000
17
18/* see set_fixmap() and asm/fixmap.h */
19#define CO_CPU_VADDR (fix_to_virt(FIX_CO_CPU))
20#define CO_APIC_VADDR (fix_to_virt(FIX_CO_APIC))
21
22/* Cobalt CPU registers -- relative to CO_CPU_VADDR, use co_cpu_*() */
23#define CO_CPU_REV 0x08
24#define CO_CPU_CTRL 0x10
25#define CO_CPU_STAT 0x20
26#define CO_CPU_TIMEVAL 0x30
27
28/* CO_CPU_CTRL bits */
29#define CO_CTRL_TIMERUN 0x04 /* 0 == disabled */
30#define CO_CTRL_TIMEMASK 0x08 /* 0 == unmasked */
31
32/* CO_CPU_STATUS bits */
33#define CO_STAT_TIMEINTR 0x02 /* (r) 1 == int pend, (w) 0 == clear */
34
35/* CO_CPU_TIMEVAL value */
36#define CO_TIME_HZ 100000000 /* Cobalt core rate */
37
38/* Cobalt APIC registers -- relative to CO_APIC_VADDR, use co_apic_*() */
39#define CO_APIC_HI(n) (((n) * 0x10) + 4)
40#define CO_APIC_LO(n) ((n) * 0x10)
41#define CO_APIC_ID 0x0ffc
42
43/* CO_APIC_ID bits */
44#define CO_APIC_ENABLE 0x00000100
45
46/* CO_APIC_LO bits */
47#define CO_APIC_MASK 0x00010000 /* 0 = enabled */
48#define CO_APIC_LEVEL 0x00008000 /* 0 = edge */
49
50/*
51 * Where things are physically wired to Cobalt
52 * #defines with no board _<type>_<rev>_ are common to all (thus far)
53 */
54#define CO_APIC_IDE0 4
55#define CO_APIC_IDE1 2 /* Only on 320 */
56
57#define CO_APIC_8259 12 /* serial, floppy, par-l-l */
58
59/* Lithium PCI Bridge A -- "the one with 82557 Ethernet" */
60#define CO_APIC_PCIA_BASE0 0 /* and 1 */ /* slot 0, line 0 */
61#define CO_APIC_PCIA_BASE123 5 /* and 6 */ /* slot 0, line 1 */
62
63#define CO_APIC_PIIX4_USB 7 /* this one is weird */
64
65/* Lithium PCI Bridge B -- "the one with PIIX4" */
66#define CO_APIC_PCIB_BASE0 8 /* and 9-12 *//* slot 0, line 0 */
67#define CO_APIC_PCIB_BASE123 13 /* 14.15 */ /* slot 0, line 1 */
68
69#define CO_APIC_VIDOUT0 16
70#define CO_APIC_VIDOUT1 17
71#define CO_APIC_VIDIN0 18
72#define CO_APIC_VIDIN1 19
73
74#define CO_APIC_LI_AUDIO 22
75
76#define CO_APIC_AS 24
77#define CO_APIC_RE 25
78
79#define CO_APIC_CPU 28 /* Timer and Cache interrupt */
80#define CO_APIC_NMI 29
81#define CO_APIC_LAST CO_APIC_NMI
82
83/*
84 * This is how irqs are assigned on the Visual Workstation.
85 * Legacy devices get irq's 1-15 (system clock is 0 and is CO_APIC_CPU).
86 * All other devices (including PCI) go to Cobalt and are irq's 16 on up.
87 */
88#define CO_IRQ_APIC0 16 /* irq of apic entry 0 */
89#define IS_CO_APIC(irq) ((irq) >= CO_IRQ_APIC0)
90#define CO_IRQ(apic) (CO_IRQ_APIC0 + (apic)) /* apic ent to irq */
91#define CO_APIC(irq) ((irq) - CO_IRQ_APIC0) /* irq to apic ent */
92#define CO_IRQ_IDE0 14 /* knowledge of... */
93#define CO_IRQ_IDE1 15 /* ... ide driver defaults! */
94#define CO_IRQ_8259 CO_IRQ(CO_APIC_8259)
95
96#ifdef CONFIG_X86_VISWS_APIC
97static inline void co_cpu_write(unsigned long reg, unsigned long v)
98{
99 *((volatile unsigned long *)(CO_CPU_VADDR+reg))=v;
100}
101
102static inline unsigned long co_cpu_read(unsigned long reg)
103{
104 return *((volatile unsigned long *)(CO_CPU_VADDR+reg));
105}
106
107static inline void co_apic_write(unsigned long reg, unsigned long v)
108{
109 *((volatile unsigned long *)(CO_APIC_VADDR+reg))=v;
110}
111
112static inline unsigned long co_apic_read(unsigned long reg)
113{
114 return *((volatile unsigned long *)(CO_APIC_VADDR+reg));
115}
116#endif
117
118extern char visws_board_type;
119
120#define VISWS_320 0
121#define VISWS_540 1
122
123extern char visws_board_rev;
124
125#endif /* __I386_SGI_COBALT_H */
diff --git a/include/asm-x86/visws/lithium.h b/include/asm-x86/visws/lithium.h
deleted file mode 100644
index dfcd4f07ab85..000000000000
--- a/include/asm-x86/visws/lithium.h
+++ /dev/null
@@ -1,53 +0,0 @@
1#ifndef __I386_SGI_LITHIUM_H
2#define __I386_SGI_LITHIUM_H
3
4#include <asm/fixmap.h>
5
6/*
7 * Lithium is the SGI Visual Workstation I/O ASIC
8 */
9
10#define LI_PCI_A_PHYS 0xfc000000 /* Enet is dev 3 */
11#define LI_PCI_B_PHYS 0xfd000000 /* PIIX4 is here */
12
13/* see set_fixmap() and asm/fixmap.h */
14#define LI_PCIA_VADDR (fix_to_virt(FIX_LI_PCIA))
15#define LI_PCIB_VADDR (fix_to_virt(FIX_LI_PCIB))
16
17/* Not a standard PCI? (not in linux/pci.h) */
18#define LI_PCI_BUSNUM 0x44 /* lo8: primary, hi8: sub */
19#define LI_PCI_INTEN 0x46
20
21/* LI_PCI_INTENT bits */
22#define LI_INTA_0 0x0001
23#define LI_INTA_1 0x0002
24#define LI_INTA_2 0x0004
25#define LI_INTA_3 0x0008
26#define LI_INTA_4 0x0010
27#define LI_INTB 0x0020
28#define LI_INTC 0x0040
29#define LI_INTD 0x0080
30
31/* More special purpose macros... */
32static inline void li_pcia_write16(unsigned long reg, unsigned short v)
33{
34 *((volatile unsigned short *)(LI_PCIA_VADDR+reg))=v;
35}
36
37static inline unsigned short li_pcia_read16(unsigned long reg)
38{
39 return *((volatile unsigned short *)(LI_PCIA_VADDR+reg));
40}
41
42static inline void li_pcib_write16(unsigned long reg, unsigned short v)
43{
44 *((volatile unsigned short *)(LI_PCIB_VADDR+reg))=v;
45}
46
47static inline unsigned short li_pcib_read16(unsigned long reg)
48{
49 return *((volatile unsigned short *)(LI_PCIB_VADDR+reg));
50}
51
52#endif
53
diff --git a/include/asm-x86/visws/piix4.h b/include/asm-x86/visws/piix4.h
deleted file mode 100644
index 83ea4f46e419..000000000000
--- a/include/asm-x86/visws/piix4.h
+++ /dev/null
@@ -1,107 +0,0 @@
1#ifndef __I386_SGI_PIIX_H
2#define __I386_SGI_PIIX_H
3
4/*
5 * PIIX4 as used on SGI Visual Workstations
6 */
7
8#define PIIX_PM_START 0x0F80
9
10#define SIO_GPIO_START 0x0FC0
11
12#define SIO_PM_START 0x0FC8
13
14#define PMBASE PIIX_PM_START
15#define GPIREG0 (PMBASE+0x30)
16#define GPIREG(x) (GPIREG0+((x)/8))
17#define GPIBIT(x) (1 << ((x)%8))
18
19#define PIIX_GPI_BD_ID1 18
20#define PIIX_GPI_BD_ID2 19
21#define PIIX_GPI_BD_ID3 20
22#define PIIX_GPI_BD_ID4 21
23#define PIIX_GPI_BD_REG GPIREG(PIIX_GPI_BD_ID1)
24#define PIIX_GPI_BD_MASK (GPIBIT(PIIX_GPI_BD_ID1) | \
25 GPIBIT(PIIX_GPI_BD_ID2) | \
26 GPIBIT(PIIX_GPI_BD_ID3) | \
27 GPIBIT(PIIX_GPI_BD_ID4) )
28
29#define PIIX_GPI_BD_SHIFT (PIIX_GPI_BD_ID1 % 8)
30
31#define SIO_INDEX 0x2e
32#define SIO_DATA 0x2f
33
34#define SIO_DEV_SEL 0x7
35#define SIO_DEV_ENB 0x30
36#define SIO_DEV_MSB 0x60
37#define SIO_DEV_LSB 0x61
38
39#define SIO_GP_DEV 0x7
40
41#define SIO_GP_BASE SIO_GPIO_START
42#define SIO_GP_MSB (SIO_GP_BASE>>8)
43#define SIO_GP_LSB (SIO_GP_BASE&0xff)
44
45#define SIO_GP_DATA1 (SIO_GP_BASE+0)
46
47#define SIO_PM_DEV 0x8
48
49#define SIO_PM_BASE SIO_PM_START
50#define SIO_PM_MSB (SIO_PM_BASE>>8)
51#define SIO_PM_LSB (SIO_PM_BASE&0xff)
52#define SIO_PM_INDEX (SIO_PM_BASE+0)
53#define SIO_PM_DATA (SIO_PM_BASE+1)
54
55#define SIO_PM_FER2 0x1
56
57#define SIO_PM_GP_EN 0x80
58
59
60
61/*
62 * This is the dev/reg where generating a config cycle will
63 * result in a PCI special cycle.
64 */
65#define SPECIAL_DEV 0xff
66#define SPECIAL_REG 0x00
67
68/*
69 * PIIX4 needs to see a special cycle with the following data
70 * to be convinced the processor has gone into the stop grant
71 * state. PIIX4 insists on seeing this before it will power
72 * down a system.
73 */
74#define PIIX_SPECIAL_STOP 0x00120002
75
76#define PIIX4_RESET_PORT 0xcf9
77#define PIIX4_RESET_VAL 0x6
78
79#define PMSTS_PORT 0xf80 // 2 bytes PM Status
80#define PMEN_PORT 0xf82 // 2 bytes PM Enable
81#define PMCNTRL_PORT 0xf84 // 2 bytes PM Control
82
83#define PM_SUSPEND_ENABLE 0x2000 // start sequence to suspend state
84
85/*
86 * PMSTS and PMEN I/O bit definitions.
87 * (Bits are the same in both registers)
88 */
89#define PM_STS_RSM (1<<15) // Resume Status
90#define PM_STS_PWRBTNOR (1<<11) // Power Button Override
91#define PM_STS_RTC (1<<10) // RTC status
92#define PM_STS_PWRBTN (1<<8) // Power Button Pressed?
93#define PM_STS_GBL (1<<5) // Global Status
94#define PM_STS_BM (1<<4) // Bus Master Status
95#define PM_STS_TMROF (1<<0) // Timer Overflow Status.
96
97/*
98 * Stop clock GPI register
99 */
100#define PIIX_GPIREG0 (0xf80 + 0x30)
101
102/*
103 * Stop clock GPI bit in GPIREG0
104 */
105#define PIIX_GPI_STPCLK 0x4 // STPCLK signal routed back in
106
107#endif
diff --git a/include/asm-x86/visws/sgivw.h b/include/asm-x86/visws/sgivw.h
deleted file mode 100644
index 5fbf63e1003c..000000000000
--- a/include/asm-x86/visws/sgivw.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * Frame buffer position and size:
3 */
4extern unsigned long sgivwfb_mem_phys;
5extern unsigned long sgivwfb_mem_size;
diff --git a/include/asm-x86/vm86.h b/include/asm-x86/vm86.h
deleted file mode 100644
index 5ce351325e01..000000000000
--- a/include/asm-x86/vm86.h
+++ /dev/null
@@ -1,208 +0,0 @@
1#ifndef _LINUX_VM86_H
2#define _LINUX_VM86_H
3
4/*
5 * I'm guessing at the VIF/VIP flag usage, but hope that this is how
6 * the Pentium uses them. Linux will return from vm86 mode when both
7 * VIF and VIP is set.
8 *
9 * On a Pentium, we could probably optimize the virtual flags directly
10 * in the eflags register instead of doing it "by hand" in vflags...
11 *
12 * Linus
13 */
14
15#include <asm/processor-flags.h>
16
17#define BIOSSEG 0x0f000
18
19#define CPU_086 0
20#define CPU_186 1
21#define CPU_286 2
22#define CPU_386 3
23#define CPU_486 4
24#define CPU_586 5
25
26/*
27 * Return values for the 'vm86()' system call
28 */
29#define VM86_TYPE(retval) ((retval) & 0xff)
30#define VM86_ARG(retval) ((retval) >> 8)
31
32#define VM86_SIGNAL 0 /* return due to signal */
33#define VM86_UNKNOWN 1 /* unhandled GP fault
34 - IO-instruction or similar */
35#define VM86_INTx 2 /* int3/int x instruction (ARG = x) */
36#define VM86_STI 3 /* sti/popf/iret instruction enabled
37 virtual interrupts */
38
39/*
40 * Additional return values when invoking new vm86()
41 */
42#define VM86_PICRETURN 4 /* return due to pending PIC request */
43#define VM86_TRAP 6 /* return due to DOS-debugger request */
44
45/*
46 * function codes when invoking new vm86()
47 */
48#define VM86_PLUS_INSTALL_CHECK 0
49#define VM86_ENTER 1
50#define VM86_ENTER_NO_BYPASS 2
51#define VM86_REQUEST_IRQ 3
52#define VM86_FREE_IRQ 4
53#define VM86_GET_IRQ_BITS 5
54#define VM86_GET_AND_RESET_IRQ 6
55
56/*
57 * This is the stack-layout seen by the user space program when we have
58 * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
59 * is 'kernel_vm86_regs' (see below).
60 */
61
62struct vm86_regs {
63/*
64 * normal regs, with special meaning for the segment descriptors..
65 */
66 long ebx;
67 long ecx;
68 long edx;
69 long esi;
70 long edi;
71 long ebp;
72 long eax;
73 long __null_ds;
74 long __null_es;
75 long __null_fs;
76 long __null_gs;
77 long orig_eax;
78 long eip;
79 unsigned short cs, __csh;
80 long eflags;
81 long esp;
82 unsigned short ss, __ssh;
83/*
84 * these are specific to v86 mode:
85 */
86 unsigned short es, __esh;
87 unsigned short ds, __dsh;
88 unsigned short fs, __fsh;
89 unsigned short gs, __gsh;
90};
91
92struct revectored_struct {
93 unsigned long __map[8]; /* 256 bits */
94};
95
96struct vm86_struct {
97 struct vm86_regs regs;
98 unsigned long flags;
99 unsigned long screen_bitmap;
100 unsigned long cpu_type;
101 struct revectored_struct int_revectored;
102 struct revectored_struct int21_revectored;
103};
104
105/*
106 * flags masks
107 */
108#define VM86_SCREEN_BITMAP 0x0001
109
110struct vm86plus_info_struct {
111 unsigned long force_return_for_pic:1;
112 unsigned long vm86dbg_active:1; /* for debugger */
113 unsigned long vm86dbg_TFpendig:1; /* for debugger */
114 unsigned long unused:28;
115 unsigned long is_vm86pus:1; /* for vm86 internal use */
116 unsigned char vm86dbg_intxxtab[32]; /* for debugger */
117};
118struct vm86plus_struct {
119 struct vm86_regs regs;
120 unsigned long flags;
121 unsigned long screen_bitmap;
122 unsigned long cpu_type;
123 struct revectored_struct int_revectored;
124 struct revectored_struct int21_revectored;
125 struct vm86plus_info_struct vm86plus;
126};
127
128#ifdef __KERNEL__
129
130#include <asm/ptrace.h>
131
132/*
133 * This is the (kernel) stack-layout when we have done a "SAVE_ALL" from vm86
134 * mode - the main change is that the old segment descriptors aren't
135 * useful any more and are forced to be zero by the kernel (and the
136 * hardware when a trap occurs), and the real segment descriptors are
137 * at the end of the structure. Look at ptrace.h to see the "normal"
138 * setup. For user space layout see 'struct vm86_regs' above.
139 */
140
141struct kernel_vm86_regs {
142/*
143 * normal regs, with special meaning for the segment descriptors..
144 */
145 struct pt_regs pt;
146/*
147 * these are specific to v86 mode:
148 */
149 unsigned short es, __esh;
150 unsigned short ds, __dsh;
151 unsigned short fs, __fsh;
152 unsigned short gs, __gsh;
153};
154
155struct kernel_vm86_struct {
156 struct kernel_vm86_regs regs;
157/*
158 * the below part remains on the kernel stack while we are in VM86 mode.
159 * 'tss.esp0' then contains the address of VM86_TSS_ESP0 below, and when we
160 * get forced back from VM86, the CPU and "SAVE_ALL" will restore the above
161 * 'struct kernel_vm86_regs' with the then actual values.
162 * Therefore, pt_regs in fact points to a complete 'kernel_vm86_struct'
163 * in kernelspace, hence we need not reget the data from userspace.
164 */
165#define VM86_TSS_ESP0 flags
166 unsigned long flags;
167 unsigned long screen_bitmap;
168 unsigned long cpu_type;
169 struct revectored_struct int_revectored;
170 struct revectored_struct int21_revectored;
171 struct vm86plus_info_struct vm86plus;
172 struct pt_regs *regs32; /* here we save the pointer to the old regs */
173/*
174 * The below is not part of the structure, but the stack layout continues
175 * this way. In front of 'return-eip' may be some data, depending on
176 * compilation, so we don't rely on this and save the pointer to 'oldregs'
177 * in 'regs32' above.
178 * However, with GCC-2.7.2 and the current CFLAGS you see exactly this:
179
180 long return-eip; from call to vm86()
181 struct pt_regs oldregs; user space registers as saved by syscall
182 */
183};
184
185#ifdef CONFIG_VM86
186
187void handle_vm86_fault(struct kernel_vm86_regs *, long);
188int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
189struct pt_regs *save_v86_state(struct kernel_vm86_regs *);
190
191struct task_struct;
192void release_vm86_irqs(struct task_struct *);
193
194#else
195
196#define handle_vm86_fault(a, b)
197#define release_vm86_irqs(a)
198
199static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c)
200{
201 return 0;
202}
203
204#endif /* CONFIG_VM86 */
205
206#endif /* __KERNEL__ */
207
208#endif
diff --git a/include/asm-x86/vmi.h b/include/asm-x86/vmi.h
deleted file mode 100644
index b7c0dea119fe..000000000000
--- a/include/asm-x86/vmi.h
+++ /dev/null
@@ -1,263 +0,0 @@
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-x86/vmi_time.h b/include/asm-x86/vmi_time.h
deleted file mode 100644
index c3118c385156..000000000000
--- a/include/asm-x86/vmi_time.h
+++ /dev/null
@@ -1,98 +0,0 @@
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_sched_clock(void);
53extern unsigned long vmi_tsc_khz(void);
54
55#ifdef CONFIG_X86_LOCAL_APIC
56extern void __devinit vmi_time_bsp_init(void);
57extern void __devinit vmi_time_ap_init(void);
58#endif
59
60/*
61 * When run under a hypervisor, a vcpu is always in one of three states:
62 * running, halted, or ready. The vcpu is in the 'running' state if it
63 * is executing. When the vcpu executes the halt interface, the vcpu
64 * enters the 'halted' state and remains halted until there is some work
65 * pending for the vcpu (e.g. an alarm expires, host I/O completes on
66 * behalf of virtual I/O). At this point, the vcpu enters the 'ready'
67 * state (waiting for the hypervisor to reschedule it). Finally, at any
68 * time when the vcpu is not in the 'running' state nor the 'halted'
69 * state, it is in the 'ready' state.
70 *
71 * Real time is advances while the vcpu is 'running', 'ready', or
72 * 'halted'. Stolen time is the time in which the vcpu is in the
73 * 'ready' state. Available time is the remaining time -- the vcpu is
74 * either 'running' or 'halted'.
75 *
76 * All three views of time are accessible through the VMI cycle
77 * counters.
78 */
79
80/* The cycle counters. */
81#define VMI_CYCLES_REAL 0
82#define VMI_CYCLES_AVAILABLE 1
83#define VMI_CYCLES_STOLEN 2
84
85/* The alarm interface 'flags' bits */
86#define VMI_ALARM_COUNTERS 2
87
88#define VMI_ALARM_COUNTER_MASK 0x000000ff
89
90#define VMI_ALARM_WIRED_IRQ0 0x00000000
91#define VMI_ALARM_WIRED_LVTT 0x00010000
92
93#define VMI_ALARM_IS_ONESHOT 0x00000000
94#define VMI_ALARM_IS_PERIODIC 0x00000100
95
96#define CONFIG_VMI_ALARM_HZ 100
97
98#endif
diff --git a/include/asm-x86/voyager.h b/include/asm-x86/voyager.h
deleted file mode 100644
index 9c811d2e6f91..000000000000
--- a/include/asm-x86/voyager.h
+++ /dev/null
@@ -1,528 +0,0 @@
1/* Copyright (C) 1999,2001
2 *
3 * Author: J.E.J.Bottomley@HansenPartnership.com
4 *
5 * Standard include definitions for the NCR Voyager system */
6
7#undef VOYAGER_DEBUG
8#undef VOYAGER_CAT_DEBUG
9
10#ifdef VOYAGER_DEBUG
11#define VDEBUG(x) printk x
12#else
13#define VDEBUG(x)
14#endif
15
16/* There are three levels of voyager machine: 3,4 and 5. The rule is
17 * if it's less than 3435 it's a Level 3 except for a 3360 which is
18 * a level 4. A 3435 or above is a Level 5 */
19#define VOYAGER_LEVEL5_AND_ABOVE 0x3435
20#define VOYAGER_LEVEL4 0x3360
21
22/* The L4 DINO ASIC */
23#define VOYAGER_DINO 0x43
24
25/* voyager ports in standard I/O space */
26#define VOYAGER_MC_SETUP 0x96
27
28
29#define VOYAGER_CAT_CONFIG_PORT 0x97
30# define VOYAGER_CAT_DESELECT 0xff
31#define VOYAGER_SSPB_RELOCATION_PORT 0x98
32
33/* Valid CAT controller commands */
34/* start instruction register cycle */
35#define VOYAGER_CAT_IRCYC 0x01
36/* start data register cycle */
37#define VOYAGER_CAT_DRCYC 0x02
38/* move to execute state */
39#define VOYAGER_CAT_RUN 0x0F
40/* end operation */
41#define VOYAGER_CAT_END 0x80
42/* hold in idle state */
43#define VOYAGER_CAT_HOLD 0x90
44/* single step an "intest" vector */
45#define VOYAGER_CAT_STEP 0xE0
46/* return cat controller to CLEMSON mode */
47#define VOYAGER_CAT_CLEMSON 0xFF
48
49/* the default cat command header */
50#define VOYAGER_CAT_HEADER 0x7F
51
52/* the range of possible CAT module ids in the system */
53#define VOYAGER_MIN_MODULE 0x10
54#define VOYAGER_MAX_MODULE 0x1f
55
56/* The voyager registers per asic */
57#define VOYAGER_ASIC_ID_REG 0x00
58#define VOYAGER_ASIC_TYPE_REG 0x01
59/* the sub address registers can be made auto incrementing on reads */
60#define VOYAGER_AUTO_INC_REG 0x02
61# define VOYAGER_AUTO_INC 0x04
62# define VOYAGER_NO_AUTO_INC 0xfb
63#define VOYAGER_SUBADDRDATA 0x03
64#define VOYAGER_SCANPATH 0x05
65# define VOYAGER_CONNECT_ASIC 0x01
66# define VOYAGER_DISCONNECT_ASIC 0xfe
67#define VOYAGER_SUBADDRLO 0x06
68#define VOYAGER_SUBADDRHI 0x07
69#define VOYAGER_SUBMODSELECT 0x08
70#define VOYAGER_SUBMODPRESENT 0x09
71
72#define VOYAGER_SUBADDR_LO 0xff
73#define VOYAGER_SUBADDR_HI 0xffff
74
75/* the maximum size of a scan path -- used to form instructions */
76#define VOYAGER_MAX_SCAN_PATH 0x100
77/* the biggest possible register size (in bytes) */
78#define VOYAGER_MAX_REG_SIZE 4
79
80/* Total number of possible modules (including submodules) */
81#define VOYAGER_MAX_MODULES 16
82/* Largest number of asics per module */
83#define VOYAGER_MAX_ASICS_PER_MODULE 7
84
85/* the CAT asic of each module is always the first one */
86#define VOYAGER_CAT_ID 0
87#define VOYAGER_PSI 0x1a
88
89/* voyager instruction operations and registers */
90#define VOYAGER_READ_CONFIG 0x1
91#define VOYAGER_WRITE_CONFIG 0x2
92#define VOYAGER_BYPASS 0xff
93
94typedef struct voyager_asic {
95 __u8 asic_addr; /* ASIC address; Level 4 */
96 __u8 asic_type; /* ASIC type */
97 __u8 asic_id; /* ASIC id */
98 __u8 jtag_id[4]; /* JTAG id */
99 __u8 asic_location; /* Location within scan path; start w/ 0 */
100 __u8 bit_location; /* Location within bit stream; start w/ 0 */
101 __u8 ireg_length; /* Instruction register length */
102 __u16 subaddr; /* Amount of sub address space */
103 struct voyager_asic *next; /* Next asic in linked list */
104} voyager_asic_t;
105
106typedef struct voyager_module {
107 __u8 module_addr; /* Module address */
108 __u8 scan_path_connected; /* Scan path connected */
109 __u16 ee_size; /* Size of the EEPROM */
110 __u16 num_asics; /* Number of Asics */
111 __u16 inst_bits; /* Instruction bits in the scan path */
112 __u16 largest_reg; /* Largest register in the scan path */
113 __u16 smallest_reg; /* Smallest register in the scan path */
114 voyager_asic_t *asic; /* First ASIC in scan path (CAT_I) */
115 struct voyager_module *submodule; /* Submodule pointer */
116 struct voyager_module *next; /* Next module in linked list */
117} voyager_module_t;
118
119typedef struct voyager_eeprom_hdr {
120 __u8 module_id[4];
121 __u8 version_id;
122 __u8 config_id;
123 __u16 boundry_id; /* boundary scan id */
124 __u16 ee_size; /* size of EEPROM */
125 __u8 assembly[11]; /* assembly # */
126 __u8 assembly_rev; /* assembly rev */
127 __u8 tracer[4]; /* tracer number */
128 __u16 assembly_cksum; /* asm checksum */
129 __u16 power_consump; /* pwr requirements */
130 __u16 num_asics; /* number of asics */
131 __u16 bist_time; /* min. bist time */
132 __u16 err_log_offset; /* error log offset */
133 __u16 scan_path_offset;/* scan path offset */
134 __u16 cct_offset;
135 __u16 log_length; /* length of err log */
136 __u16 xsum_end; /* offset to end of
137 checksum */
138 __u8 reserved[4];
139 __u8 sflag; /* starting sentinal */
140 __u8 part_number[13]; /* prom part number */
141 __u8 version[10]; /* version number */
142 __u8 signature[8];
143 __u16 eeprom_chksum;
144 __u32 data_stamp_offset;
145 __u8 eflag ; /* ending sentinal */
146} __attribute__((packed)) voyager_eprom_hdr_t;
147
148
149
150#define VOYAGER_EPROM_SIZE_OFFSET \
151 ((__u16)(&(((voyager_eprom_hdr_t *)0)->ee_size)))
152#define VOYAGER_XSUM_END_OFFSET 0x2a
153
154/* the following three definitions are for internal table layouts
155 * in the module EPROMs. We really only care about the IDs and
156 * offsets */
157typedef struct voyager_sp_table {
158 __u8 asic_id;
159 __u8 bypass_flag;
160 __u16 asic_data_offset;
161 __u16 config_data_offset;
162} __attribute__((packed)) voyager_sp_table_t;
163
164typedef struct voyager_jtag_table {
165 __u8 icode[4];
166 __u8 runbist[4];
167 __u8 intest[4];
168 __u8 samp_preld[4];
169 __u8 ireg_len;
170} __attribute__((packed)) voyager_jtt_t;
171
172typedef struct voyager_asic_data_table {
173 __u8 jtag_id[4];
174 __u16 length_bsr;
175 __u16 length_bist_reg;
176 __u32 bist_clk;
177 __u16 subaddr_bits;
178 __u16 seed_bits;
179 __u16 sig_bits;
180 __u16 jtag_offset;
181} __attribute__((packed)) voyager_at_t;
182
183/* Voyager Interrupt Controller (VIC) registers */
184
185/* Base to add to Cross Processor Interrupts (CPIs) when triggering
186 * the CPU IRQ line */
187/* register defines for the WCBICs (one per processor) */
188#define VOYAGER_WCBIC0 0x41 /* bus A node P1 processor 0 */
189#define VOYAGER_WCBIC1 0x49 /* bus A node P1 processor 1 */
190#define VOYAGER_WCBIC2 0x51 /* bus A node P2 processor 0 */
191#define VOYAGER_WCBIC3 0x59 /* bus A node P2 processor 1 */
192#define VOYAGER_WCBIC4 0x61 /* bus B node P1 processor 0 */
193#define VOYAGER_WCBIC5 0x69 /* bus B node P1 processor 1 */
194#define VOYAGER_WCBIC6 0x71 /* bus B node P2 processor 0 */
195#define VOYAGER_WCBIC7 0x79 /* bus B node P2 processor 1 */
196
197
198/* top of memory registers */
199#define VOYAGER_WCBIC_TOM_L 0x4
200#define VOYAGER_WCBIC_TOM_H 0x5
201
202/* register defines for Voyager Memory Contol (VMC)
203 * these are present on L4 machines only */
204#define VOYAGER_VMC1 0x81
205#define VOYAGER_VMC2 0x91
206#define VOYAGER_VMC3 0xa1
207#define VOYAGER_VMC4 0xb1
208
209/* VMC Ports */
210#define VOYAGER_VMC_MEMORY_SETUP 0x9
211# define VMC_Interleaving 0x01
212# define VMC_4Way 0x02
213# define VMC_EvenCacheLines 0x04
214# define VMC_HighLine 0x08
215# define VMC_Start0_Enable 0x20
216# define VMC_Start1_Enable 0x40
217# define VMC_Vremap 0x80
218#define VOYAGER_VMC_BANK_DENSITY 0xa
219# define VMC_BANK_EMPTY 0
220# define VMC_BANK_4MB 1
221# define VMC_BANK_16MB 2
222# define VMC_BANK_64MB 3
223# define VMC_BANK0_MASK 0x03
224# define VMC_BANK1_MASK 0x0C
225# define VMC_BANK2_MASK 0x30
226# define VMC_BANK3_MASK 0xC0
227
228/* Magellan Memory Controller (MMC) defines - present on L5 */
229#define VOYAGER_MMC_ASIC_ID 1
230/* the two memory modules corresponding to memory cards in the system */
231#define VOYAGER_MMC_MEMORY0_MODULE 0x14
232#define VOYAGER_MMC_MEMORY1_MODULE 0x15
233/* the Magellan Memory Address (MMA) defines */
234#define VOYAGER_MMA_ASIC_ID 2
235
236/* Submodule number for the Quad Baseboard */
237#define VOYAGER_QUAD_BASEBOARD 1
238
239/* ASIC defines for the Quad Baseboard */
240#define VOYAGER_QUAD_QDATA0 1
241#define VOYAGER_QUAD_QDATA1 2
242#define VOYAGER_QUAD_QABC 3
243
244/* Useful areas in extended CMOS */
245#define VOYAGER_PROCESSOR_PRESENT_MASK 0x88a
246#define VOYAGER_MEMORY_CLICKMAP 0xa23
247#define VOYAGER_DUMP_LOCATION 0xb1a
248
249/* SUS In Control bit - used to tell SUS that we don't need to be
250 * babysat anymore */
251#define VOYAGER_SUS_IN_CONTROL_PORT 0x3ff
252# define VOYAGER_IN_CONTROL_FLAG 0x80
253
254/* Voyager PSI defines */
255#define VOYAGER_PSI_STATUS_REG 0x08
256# define PSI_DC_FAIL 0x01
257# define PSI_MON 0x02
258# define PSI_FAULT 0x04
259# define PSI_ALARM 0x08
260# define PSI_CURRENT 0x10
261# define PSI_DVM 0x20
262# define PSI_PSCFAULT 0x40
263# define PSI_STAT_CHG 0x80
264
265#define VOYAGER_PSI_SUPPLY_REG 0x8000
266 /* read */
267# define PSI_FAIL_DC 0x01
268# define PSI_FAIL_AC 0x02
269# define PSI_MON_INT 0x04
270# define PSI_SWITCH_OFF 0x08
271# define PSI_HX_OFF 0x10
272# define PSI_SECURITY 0x20
273# define PSI_CMOS_BATT_LOW 0x40
274# define PSI_CMOS_BATT_FAIL 0x80
275 /* write */
276# define PSI_CLR_SWITCH_OFF 0x13
277# define PSI_CLR_HX_OFF 0x14
278# define PSI_CLR_CMOS_BATT_FAIL 0x17
279
280#define VOYAGER_PSI_MASK 0x8001
281# define PSI_MASK_MASK 0x10
282
283#define VOYAGER_PSI_AC_FAIL_REG 0x8004
284#define AC_FAIL_STAT_CHANGE 0x80
285
286#define VOYAGER_PSI_GENERAL_REG 0x8007
287 /* read */
288# define PSI_SWITCH_ON 0x01
289# define PSI_SWITCH_ENABLED 0x02
290# define PSI_ALARM_ENABLED 0x08
291# define PSI_SECURE_ENABLED 0x10
292# define PSI_COLD_RESET 0x20
293# define PSI_COLD_START 0x80
294 /* write */
295# define PSI_POWER_DOWN 0x10
296# define PSI_SWITCH_DISABLE 0x01
297# define PSI_SWITCH_ENABLE 0x11
298# define PSI_CLEAR 0x12
299# define PSI_ALARM_DISABLE 0x03
300# define PSI_ALARM_ENABLE 0x13
301# define PSI_CLEAR_COLD_RESET 0x05
302# define PSI_SET_COLD_RESET 0x15
303# define PSI_CLEAR_COLD_START 0x07
304# define PSI_SET_COLD_START 0x17
305
306
307
308struct voyager_bios_info {
309 __u8 len;
310 __u8 major;
311 __u8 minor;
312 __u8 debug;
313 __u8 num_classes;
314 __u8 class_1;
315 __u8 class_2;
316};
317
318/* The following structures and definitions are for the Kernel/SUS
319 * interface these are needed to find out how SUS initialised any Quad
320 * boards in the system */
321
322#define NUMBER_OF_MC_BUSSES 2
323#define SLOTS_PER_MC_BUS 8
324#define MAX_CPUS 16 /* 16 way CPU system */
325#define MAX_PROCESSOR_BOARDS 4 /* 4 processor slot system */
326#define MAX_CACHE_LEVELS 4 /* # of cache levels supported */
327#define MAX_SHARED_CPUS 4 /* # of CPUs that can share a LARC */
328#define NUMBER_OF_POS_REGS 8
329
330typedef struct {
331 __u8 MC_Slot;
332 __u8 POS_Values[NUMBER_OF_POS_REGS];
333} __attribute__((packed)) MC_SlotInformation_t;
334
335struct QuadDescription {
336 __u8 Type; /* for type 0 (DYADIC or MONADIC) all fields
337 * will be zero except for slot */
338 __u8 StructureVersion;
339 __u32 CPI_BaseAddress;
340 __u32 LARC_BankSize;
341 __u32 LocalMemoryStateBits;
342 __u8 Slot; /* Processor slots 1 - 4 */
343} __attribute__((packed));
344
345struct ProcBoardInfo {
346 __u8 Type;
347 __u8 StructureVersion;
348 __u8 NumberOfBoards;
349 struct QuadDescription QuadData[MAX_PROCESSOR_BOARDS];
350} __attribute__((packed));
351
352struct CacheDescription {
353 __u8 Level;
354 __u32 TotalSize;
355 __u16 LineSize;
356 __u8 Associativity;
357 __u8 CacheType;
358 __u8 WriteType;
359 __u8 Number_CPUs_SharedBy;
360 __u8 Shared_CPUs_Hardware_IDs[MAX_SHARED_CPUS];
361
362} __attribute__((packed));
363
364struct CPU_Description {
365 __u8 CPU_HardwareId;
366 char *FRU_String;
367 __u8 NumberOfCacheLevels;
368 struct CacheDescription CacheLevelData[MAX_CACHE_LEVELS];
369} __attribute__((packed));
370
371struct CPU_Info {
372 __u8 Type;
373 __u8 StructureVersion;
374 __u8 NumberOf_CPUs;
375 struct CPU_Description CPU_Data[MAX_CPUS];
376} __attribute__((packed));
377
378
379/*
380 * This structure will be used by SUS and the OS.
381 * The assumption about this structure is that no blank space is
382 * packed in it by our friend the compiler.
383 */
384typedef struct {
385 __u8 Mailbox_SUS; /* Written to by SUS to give
386 commands/response to the OS */
387 __u8 Mailbox_OS; /* Written to by the OS to give
388 commands/response to SUS */
389 __u8 SUS_MailboxVersion; /* Tells the OS which iteration of the
390 interface SUS supports */
391 __u8 OS_MailboxVersion; /* Tells SUS which iteration of the
392 interface the OS supports */
393 __u32 OS_Flags; /* Flags set by the OS as info for
394 SUS */
395 __u32 SUS_Flags; /* Flags set by SUS as info
396 for the OS */
397 __u32 WatchDogPeriod; /* Watchdog period (in seconds) which
398 the DP uses to see if the OS
399 is dead */
400 __u32 WatchDogCount; /* Updated by the OS on every tic. */
401 __u32 MemoryFor_SUS_ErrorLog; /* Flat 32 bit address which tells SUS
402 where to stuff the SUS error log
403 on a dump */
404 MC_SlotInformation_t MC_SlotInfo[NUMBER_OF_MC_BUSSES*SLOTS_PER_MC_BUS];
405 /* Storage for MCA POS data */
406 /* All new SECOND_PASS_INTERFACE fields added from this point */
407 struct ProcBoardInfo *BoardData;
408 struct CPU_Info *CPU_Data;
409 /* All new fields must be added from this point */
410} Voyager_KernelSUS_Mbox_t;
411
412/* structure for finding the right memory address to send a QIC CPI to */
413struct voyager_qic_cpi {
414 /* Each cache line (32 bytes) can trigger a cpi. The cpi
415 * read/write may occur anywhere in the cache line---pick the
416 * middle to be safe */
417 struct {
418 __u32 pad1[3];
419 __u32 cpi;
420 __u32 pad2[4];
421 } qic_cpi[8];
422};
423
424struct voyager_status {
425 __u32 power_fail:1;
426 __u32 switch_off:1;
427 __u32 request_from_kernel:1;
428};
429
430struct voyager_psi_regs {
431 __u8 cat_id;
432 __u8 cat_dev;
433 __u8 cat_control;
434 __u8 subaddr;
435 __u8 dummy4;
436 __u8 checkbit;
437 __u8 subaddr_low;
438 __u8 subaddr_high;
439 __u8 intstatus;
440 __u8 stat1;
441 __u8 stat3;
442 __u8 fault;
443 __u8 tms;
444 __u8 gen;
445 __u8 sysconf;
446 __u8 dummy15;
447};
448
449struct voyager_psi_subregs {
450 __u8 supply;
451 __u8 mask;
452 __u8 present;
453 __u8 DCfail;
454 __u8 ACfail;
455 __u8 fail;
456 __u8 UPSfail;
457 __u8 genstatus;
458};
459
460struct voyager_psi {
461 struct voyager_psi_regs regs;
462 struct voyager_psi_subregs subregs;
463};
464
465struct voyager_SUS {
466#define VOYAGER_DUMP_BUTTON_NMI 0x1
467#define VOYAGER_SUS_VALID 0x2
468#define VOYAGER_SYSINT_COMPLETE 0x3
469 __u8 SUS_mbox;
470#define VOYAGER_NO_COMMAND 0x0
471#define VOYAGER_IGNORE_DUMP 0x1
472#define VOYAGER_DO_DUMP 0x2
473#define VOYAGER_SYSINT_HANDSHAKE 0x3
474#define VOYAGER_DO_MEM_DUMP 0x4
475#define VOYAGER_SYSINT_WAS_RECOVERED 0x5
476 __u8 kernel_mbox;
477#define VOYAGER_MAILBOX_VERSION 0x10
478 __u8 SUS_version;
479 __u8 kernel_version;
480#define VOYAGER_OS_HAS_SYSINT 0x1
481#define VOYAGER_OS_IN_PROGRESS 0x2
482#define VOYAGER_UPDATING_WDPERIOD 0x4
483 __u32 kernel_flags;
484#define VOYAGER_SUS_BOOTING 0x1
485#define VOYAGER_SUS_IN_PROGRESS 0x2
486 __u32 SUS_flags;
487 __u32 watchdog_period;
488 __u32 watchdog_count;
489 __u32 SUS_errorlog;
490 /* lots of system configuration stuff under here */
491};
492
493/* Variables exported by voyager_smp */
494extern __u32 voyager_extended_vic_processors;
495extern __u32 voyager_allowed_boot_processors;
496extern __u32 voyager_quad_processors;
497extern struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS];
498extern struct voyager_SUS *voyager_SUS;
499
500/* variables exported always */
501extern struct task_struct *voyager_thread;
502extern int voyager_level;
503extern struct voyager_status voyager_status;
504
505/* functions exported by the voyager and voyager_smp modules */
506extern int voyager_cat_readb(__u8 module, __u8 asic, int reg);
507extern void voyager_cat_init(void);
508extern void voyager_detect(struct voyager_bios_info *);
509extern void voyager_trap_init(void);
510extern void voyager_setup_irqs(void);
511extern int voyager_memory_detect(int region, __u32 *addr, __u32 *length);
512extern void voyager_smp_intr_init(void);
513extern __u8 voyager_extended_cmos_read(__u16 cmos_address);
514extern void voyager_smp_dump(void);
515extern void voyager_timer_interrupt(void);
516extern void smp_local_timer_interrupt(void);
517extern void voyager_power_off(void);
518extern void smp_voyager_power_off(void *dummy);
519extern void voyager_restart(void);
520extern void voyager_cat_power_off(void);
521extern void voyager_cat_do_common_interrupt(void);
522extern void voyager_handle_nmi(void);
523/* Commands for the following are */
524#define VOYAGER_PSI_READ 0
525#define VOYAGER_PSI_WRITE 1
526#define VOYAGER_PSI_SUBREAD 2
527#define VOYAGER_PSI_SUBWRITE 3
528extern void voyager_cat_psi(__u8, __u16, __u8 *);
diff --git a/include/asm-x86/vsyscall.h b/include/asm-x86/vsyscall.h
deleted file mode 100644
index 6b66ff905af0..000000000000
--- a/include/asm-x86/vsyscall.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _ASM_X86_64_VSYSCALL_H_
2#define _ASM_X86_64_VSYSCALL_H_
3
4enum vsyscall_num {
5 __NR_vgettimeofday,
6 __NR_vtime,
7 __NR_vgetcpu,
8};
9
10#define VSYSCALL_START (-10UL << 20)
11#define VSYSCALL_SIZE 1024
12#define VSYSCALL_END (-2UL << 20)
13#define VSYSCALL_MAPPED_PAGES 1
14#define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
15
16#ifdef __KERNEL__
17#include <linux/seqlock.h>
18
19#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))
20#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16)))
21
22/* Definitions for CONFIG_GENERIC_TIME definitions */
23#define __section_vsyscall_gtod_data __attribute__ \
24 ((unused, __section__ (".vsyscall_gtod_data"),aligned(16)))
25#define __section_vsyscall_clock __attribute__ \
26 ((unused, __section__ (".vsyscall_clock"),aligned(16)))
27#define __vsyscall_fn \
28 __attribute__ ((unused, __section__(".vsyscall_fn"))) notrace
29
30#define VGETCPU_RDTSCP 1
31#define VGETCPU_LSL 2
32
33extern int __vgetcpu_mode;
34extern volatile unsigned long __jiffies;
35
36/* kernel space (writeable) */
37extern int vgetcpu_mode;
38extern struct timezone sys_tz;
39
40extern void map_vsyscall(void);
41
42#endif /* __KERNEL__ */
43
44#endif /* _ASM_X86_64_VSYSCALL_H_ */
diff --git a/include/asm-x86/xen/events.h b/include/asm-x86/xen/events.h
deleted file mode 100644
index 8ded74720024..000000000000
--- a/include/asm-x86/xen/events.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __XEN_EVENTS_H
2#define __XEN_EVENTS_H
3
4enum ipi_vector {
5 XEN_RESCHEDULE_VECTOR,
6 XEN_CALL_FUNCTION_VECTOR,
7 XEN_CALL_FUNCTION_SINGLE_VECTOR,
8 XEN_SPIN_UNLOCK_VECTOR,
9
10 XEN_NR_IPIS,
11};
12
13static inline int xen_irqs_disabled(struct pt_regs *regs)
14{
15 return raw_irqs_disabled_flags(regs->flags);
16}
17
18static inline void xen_do_IRQ(int irq, struct pt_regs *regs)
19{
20 regs->orig_ax = ~irq;
21 do_IRQ(regs);
22}
23
24#endif /* __XEN_EVENTS_H */
diff --git a/include/asm-x86/xen/grant_table.h b/include/asm-x86/xen/grant_table.h
deleted file mode 100644
index 2444d4593a3b..000000000000
--- a/include/asm-x86/xen/grant_table.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __XEN_GRANT_TABLE_H
2#define __XEN_GRANT_TABLE_H
3
4#define xen_alloc_vm_area(size) alloc_vm_area(size)
5#define xen_free_vm_area(area) free_vm_area(area)
6
7#endif /* __XEN_GRANT_TABLE_H */
diff --git a/include/asm-x86/xen/hypercall.h b/include/asm-x86/xen/hypercall.h
deleted file mode 100644
index 91cb7fd5c123..000000000000
--- a/include/asm-x86/xen/hypercall.h
+++ /dev/null
@@ -1,527 +0,0 @@
1/******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __HYPERCALL_H__
34#define __HYPERCALL_H__
35
36#include <linux/errno.h>
37#include <linux/string.h>
38
39#include <xen/interface/xen.h>
40#include <xen/interface/sched.h>
41#include <xen/interface/physdev.h>
42
43/*
44 * The hypercall asms have to meet several constraints:
45 * - Work on 32- and 64-bit.
46 * The two architectures put their arguments in different sets of
47 * registers.
48 *
49 * - Work around asm syntax quirks
50 * It isn't possible to specify one of the rNN registers in a
51 * constraint, so we use explicit register variables to get the
52 * args into the right place.
53 *
54 * - Mark all registers as potentially clobbered
55 * Even unused parameters can be clobbered by the hypervisor, so we
56 * need to make sure gcc knows it.
57 *
58 * - Avoid compiler bugs.
59 * This is the tricky part. Because x86_32 has such a constrained
60 * register set, gcc versions below 4.3 have trouble generating
61 * code when all the arg registers and memory are trashed by the
62 * asm. There are syntactically simpler ways of achieving the
63 * semantics below, but they cause the compiler to crash.
64 *
65 * The only combination I found which works is:
66 * - assign the __argX variables first
67 * - list all actually used parameters as "+r" (__argX)
68 * - clobber the rest
69 *
70 * The result certainly isn't pretty, and it really shows up cpp's
71 * weakness as as macro language. Sorry. (But let's just give thanks
72 * there aren't more than 5 arguments...)
73 */
74
75extern struct { char _entry[32]; } hypercall_page[];
76
77#define __HYPERCALL "call hypercall_page+%c[offset]"
78#define __HYPERCALL_ENTRY(x) \
79 [offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0]))
80
81#ifdef CONFIG_X86_32
82#define __HYPERCALL_RETREG "eax"
83#define __HYPERCALL_ARG1REG "ebx"
84#define __HYPERCALL_ARG2REG "ecx"
85#define __HYPERCALL_ARG3REG "edx"
86#define __HYPERCALL_ARG4REG "esi"
87#define __HYPERCALL_ARG5REG "edi"
88#else
89#define __HYPERCALL_RETREG "rax"
90#define __HYPERCALL_ARG1REG "rdi"
91#define __HYPERCALL_ARG2REG "rsi"
92#define __HYPERCALL_ARG3REG "rdx"
93#define __HYPERCALL_ARG4REG "r10"
94#define __HYPERCALL_ARG5REG "r8"
95#endif
96
97#define __HYPERCALL_DECLS \
98 register unsigned long __res asm(__HYPERCALL_RETREG); \
99 register unsigned long __arg1 asm(__HYPERCALL_ARG1REG) = __arg1; \
100 register unsigned long __arg2 asm(__HYPERCALL_ARG2REG) = __arg2; \
101 register unsigned long __arg3 asm(__HYPERCALL_ARG3REG) = __arg3; \
102 register unsigned long __arg4 asm(__HYPERCALL_ARG4REG) = __arg4; \
103 register unsigned long __arg5 asm(__HYPERCALL_ARG5REG) = __arg5;
104
105#define __HYPERCALL_0PARAM "=r" (__res)
106#define __HYPERCALL_1PARAM __HYPERCALL_0PARAM, "+r" (__arg1)
107#define __HYPERCALL_2PARAM __HYPERCALL_1PARAM, "+r" (__arg2)
108#define __HYPERCALL_3PARAM __HYPERCALL_2PARAM, "+r" (__arg3)
109#define __HYPERCALL_4PARAM __HYPERCALL_3PARAM, "+r" (__arg4)
110#define __HYPERCALL_5PARAM __HYPERCALL_4PARAM, "+r" (__arg5)
111
112#define __HYPERCALL_0ARG()
113#define __HYPERCALL_1ARG(a1) \
114 __HYPERCALL_0ARG() __arg1 = (unsigned long)(a1);
115#define __HYPERCALL_2ARG(a1,a2) \
116 __HYPERCALL_1ARG(a1) __arg2 = (unsigned long)(a2);
117#define __HYPERCALL_3ARG(a1,a2,a3) \
118 __HYPERCALL_2ARG(a1,a2) __arg3 = (unsigned long)(a3);
119#define __HYPERCALL_4ARG(a1,a2,a3,a4) \
120 __HYPERCALL_3ARG(a1,a2,a3) __arg4 = (unsigned long)(a4);
121#define __HYPERCALL_5ARG(a1,a2,a3,a4,a5) \
122 __HYPERCALL_4ARG(a1,a2,a3,a4) __arg5 = (unsigned long)(a5);
123
124#define __HYPERCALL_CLOBBER5 "memory"
125#define __HYPERCALL_CLOBBER4 __HYPERCALL_CLOBBER5, __HYPERCALL_ARG5REG
126#define __HYPERCALL_CLOBBER3 __HYPERCALL_CLOBBER4, __HYPERCALL_ARG4REG
127#define __HYPERCALL_CLOBBER2 __HYPERCALL_CLOBBER3, __HYPERCALL_ARG3REG
128#define __HYPERCALL_CLOBBER1 __HYPERCALL_CLOBBER2, __HYPERCALL_ARG2REG
129#define __HYPERCALL_CLOBBER0 __HYPERCALL_CLOBBER1, __HYPERCALL_ARG1REG
130
131#define _hypercall0(type, name) \
132({ \
133 __HYPERCALL_DECLS; \
134 __HYPERCALL_0ARG(); \
135 asm volatile (__HYPERCALL \
136 : __HYPERCALL_0PARAM \
137 : __HYPERCALL_ENTRY(name) \
138 : __HYPERCALL_CLOBBER0); \
139 (type)__res; \
140})
141
142#define _hypercall1(type, name, a1) \
143({ \
144 __HYPERCALL_DECLS; \
145 __HYPERCALL_1ARG(a1); \
146 asm volatile (__HYPERCALL \
147 : __HYPERCALL_1PARAM \
148 : __HYPERCALL_ENTRY(name) \
149 : __HYPERCALL_CLOBBER1); \
150 (type)__res; \
151})
152
153#define _hypercall2(type, name, a1, a2) \
154({ \
155 __HYPERCALL_DECLS; \
156 __HYPERCALL_2ARG(a1, a2); \
157 asm volatile (__HYPERCALL \
158 : __HYPERCALL_2PARAM \
159 : __HYPERCALL_ENTRY(name) \
160 : __HYPERCALL_CLOBBER2); \
161 (type)__res; \
162})
163
164#define _hypercall3(type, name, a1, a2, a3) \
165({ \
166 __HYPERCALL_DECLS; \
167 __HYPERCALL_3ARG(a1, a2, a3); \
168 asm volatile (__HYPERCALL \
169 : __HYPERCALL_3PARAM \
170 : __HYPERCALL_ENTRY(name) \
171 : __HYPERCALL_CLOBBER3); \
172 (type)__res; \
173})
174
175#define _hypercall4(type, name, a1, a2, a3, a4) \
176({ \
177 __HYPERCALL_DECLS; \
178 __HYPERCALL_4ARG(a1, a2, a3, a4); \
179 asm volatile (__HYPERCALL \
180 : __HYPERCALL_4PARAM \
181 : __HYPERCALL_ENTRY(name) \
182 : __HYPERCALL_CLOBBER4); \
183 (type)__res; \
184})
185
186#define _hypercall5(type, name, a1, a2, a3, a4, a5) \
187({ \
188 __HYPERCALL_DECLS; \
189 __HYPERCALL_5ARG(a1, a2, a3, a4, a5); \
190 asm volatile (__HYPERCALL \
191 : __HYPERCALL_5PARAM \
192 : __HYPERCALL_ENTRY(name) \
193 : __HYPERCALL_CLOBBER5); \
194 (type)__res; \
195})
196
197static inline int
198HYPERVISOR_set_trap_table(struct trap_info *table)
199{
200 return _hypercall1(int, set_trap_table, table);
201}
202
203static inline int
204HYPERVISOR_mmu_update(struct mmu_update *req, int count,
205 int *success_count, domid_t domid)
206{
207 return _hypercall4(int, mmu_update, req, count, success_count, domid);
208}
209
210static inline int
211HYPERVISOR_mmuext_op(struct mmuext_op *op, int count,
212 int *success_count, domid_t domid)
213{
214 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
215}
216
217static inline int
218HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
219{
220 return _hypercall2(int, set_gdt, frame_list, entries);
221}
222
223static inline int
224HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
225{
226 return _hypercall2(int, stack_switch, ss, esp);
227}
228
229#ifdef CONFIG_X86_32
230static inline int
231HYPERVISOR_set_callbacks(unsigned long event_selector,
232 unsigned long event_address,
233 unsigned long failsafe_selector,
234 unsigned long failsafe_address)
235{
236 return _hypercall4(int, set_callbacks,
237 event_selector, event_address,
238 failsafe_selector, failsafe_address);
239}
240#else /* CONFIG_X86_64 */
241static inline int
242HYPERVISOR_set_callbacks(unsigned long event_address,
243 unsigned long failsafe_address,
244 unsigned long syscall_address)
245{
246 return _hypercall3(int, set_callbacks,
247 event_address, failsafe_address,
248 syscall_address);
249}
250#endif /* CONFIG_X86_{32,64} */
251
252static inline int
253HYPERVISOR_callback_op(int cmd, void *arg)
254{
255 return _hypercall2(int, callback_op, cmd, arg);
256}
257
258static inline int
259HYPERVISOR_fpu_taskswitch(int set)
260{
261 return _hypercall1(int, fpu_taskswitch, set);
262}
263
264static inline int
265HYPERVISOR_sched_op(int cmd, void *arg)
266{
267 return _hypercall2(int, sched_op_new, cmd, arg);
268}
269
270static inline long
271HYPERVISOR_set_timer_op(u64 timeout)
272{
273 unsigned long timeout_hi = (unsigned long)(timeout>>32);
274 unsigned long timeout_lo = (unsigned long)timeout;
275 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
276}
277
278static inline int
279HYPERVISOR_set_debugreg(int reg, unsigned long value)
280{
281 return _hypercall2(int, set_debugreg, reg, value);
282}
283
284static inline unsigned long
285HYPERVISOR_get_debugreg(int reg)
286{
287 return _hypercall1(unsigned long, get_debugreg, reg);
288}
289
290static inline int
291HYPERVISOR_update_descriptor(u64 ma, u64 desc)
292{
293 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
294}
295
296static inline int
297HYPERVISOR_memory_op(unsigned int cmd, void *arg)
298{
299 return _hypercall2(int, memory_op, cmd, arg);
300}
301
302static inline int
303HYPERVISOR_multicall(void *call_list, int nr_calls)
304{
305 return _hypercall2(int, multicall, call_list, nr_calls);
306}
307
308static inline int
309HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
310 unsigned long flags)
311{
312 if (sizeof(new_val) == sizeof(long))
313 return _hypercall3(int, update_va_mapping, va,
314 new_val.pte, flags);
315 else
316 return _hypercall4(int, update_va_mapping, va,
317 new_val.pte, new_val.pte >> 32, flags);
318}
319
320static inline int
321HYPERVISOR_event_channel_op(int cmd, void *arg)
322{
323 int rc = _hypercall2(int, event_channel_op, cmd, arg);
324 if (unlikely(rc == -ENOSYS)) {
325 struct evtchn_op op;
326 op.cmd = cmd;
327 memcpy(&op.u, arg, sizeof(op.u));
328 rc = _hypercall1(int, event_channel_op_compat, &op);
329 memcpy(arg, &op.u, sizeof(op.u));
330 }
331 return rc;
332}
333
334static inline int
335HYPERVISOR_xen_version(int cmd, void *arg)
336{
337 return _hypercall2(int, xen_version, cmd, arg);
338}
339
340static inline int
341HYPERVISOR_console_io(int cmd, int count, char *str)
342{
343 return _hypercall3(int, console_io, cmd, count, str);
344}
345
346static inline int
347HYPERVISOR_physdev_op(int cmd, void *arg)
348{
349 int rc = _hypercall2(int, physdev_op, cmd, arg);
350 if (unlikely(rc == -ENOSYS)) {
351 struct physdev_op op;
352 op.cmd = cmd;
353 memcpy(&op.u, arg, sizeof(op.u));
354 rc = _hypercall1(int, physdev_op_compat, &op);
355 memcpy(arg, &op.u, sizeof(op.u));
356 }
357 return rc;
358}
359
360static inline int
361HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
362{
363 return _hypercall3(int, grant_table_op, cmd, uop, count);
364}
365
366static inline int
367HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
368 unsigned long flags, domid_t domid)
369{
370 if (sizeof(new_val) == sizeof(long))
371 return _hypercall4(int, update_va_mapping_otherdomain, va,
372 new_val.pte, flags, domid);
373 else
374 return _hypercall5(int, update_va_mapping_otherdomain, va,
375 new_val.pte, new_val.pte >> 32,
376 flags, domid);
377}
378
379static inline int
380HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
381{
382 return _hypercall2(int, vm_assist, cmd, type);
383}
384
385static inline int
386HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
387{
388 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
389}
390
391#ifdef CONFIG_X86_64
392static inline int
393HYPERVISOR_set_segment_base(int reg, unsigned long value)
394{
395 return _hypercall2(int, set_segment_base, reg, value);
396}
397#endif
398
399static inline int
400HYPERVISOR_suspend(unsigned long srec)
401{
402 return _hypercall3(int, sched_op, SCHEDOP_shutdown,
403 SHUTDOWN_suspend, srec);
404}
405
406static inline int
407HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
408{
409 return _hypercall2(int, nmi_op, op, arg);
410}
411
412static inline void
413MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
414{
415 mcl->op = __HYPERVISOR_fpu_taskswitch;
416 mcl->args[0] = set;
417}
418
419static inline void
420MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
421 pte_t new_val, unsigned long flags)
422{
423 mcl->op = __HYPERVISOR_update_va_mapping;
424 mcl->args[0] = va;
425 if (sizeof(new_val) == sizeof(long)) {
426 mcl->args[1] = new_val.pte;
427 mcl->args[2] = flags;
428 } else {
429 mcl->args[1] = new_val.pte;
430 mcl->args[2] = new_val.pte >> 32;
431 mcl->args[3] = flags;
432 }
433}
434
435static inline void
436MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
437 void *uop, unsigned int count)
438{
439 mcl->op = __HYPERVISOR_grant_table_op;
440 mcl->args[0] = cmd;
441 mcl->args[1] = (unsigned long)uop;
442 mcl->args[2] = count;
443}
444
445static inline void
446MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long va,
447 pte_t new_val, unsigned long flags,
448 domid_t domid)
449{
450 mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
451 mcl->args[0] = va;
452 if (sizeof(new_val) == sizeof(long)) {
453 mcl->args[1] = new_val.pte;
454 mcl->args[2] = flags;
455 mcl->args[3] = domid;
456 } else {
457 mcl->args[1] = new_val.pte;
458 mcl->args[2] = new_val.pte >> 32;
459 mcl->args[3] = flags;
460 mcl->args[4] = domid;
461 }
462}
463
464static inline void
465MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
466 struct desc_struct desc)
467{
468 mcl->op = __HYPERVISOR_update_descriptor;
469 if (sizeof(maddr) == sizeof(long)) {
470 mcl->args[0] = maddr;
471 mcl->args[1] = *(unsigned long *)&desc;
472 } else {
473 mcl->args[0] = maddr;
474 mcl->args[1] = maddr >> 32;
475 mcl->args[2] = desc.a;
476 mcl->args[3] = desc.b;
477 }
478}
479
480static inline void
481MULTI_memory_op(struct multicall_entry *mcl, unsigned int cmd, void *arg)
482{
483 mcl->op = __HYPERVISOR_memory_op;
484 mcl->args[0] = cmd;
485 mcl->args[1] = (unsigned long)arg;
486}
487
488static inline void
489MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
490 int count, int *success_count, domid_t domid)
491{
492 mcl->op = __HYPERVISOR_mmu_update;
493 mcl->args[0] = (unsigned long)req;
494 mcl->args[1] = count;
495 mcl->args[2] = (unsigned long)success_count;
496 mcl->args[3] = domid;
497}
498
499static inline void
500MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
501 int *success_count, domid_t domid)
502{
503 mcl->op = __HYPERVISOR_mmuext_op;
504 mcl->args[0] = (unsigned long)op;
505 mcl->args[1] = count;
506 mcl->args[2] = (unsigned long)success_count;
507 mcl->args[3] = domid;
508}
509
510static inline void
511MULTI_set_gdt(struct multicall_entry *mcl, unsigned long *frames, int entries)
512{
513 mcl->op = __HYPERVISOR_set_gdt;
514 mcl->args[0] = (unsigned long)frames;
515 mcl->args[1] = entries;
516}
517
518static inline void
519MULTI_stack_switch(struct multicall_entry *mcl,
520 unsigned long ss, unsigned long esp)
521{
522 mcl->op = __HYPERVISOR_stack_switch;
523 mcl->args[0] = ss;
524 mcl->args[1] = esp;
525}
526
527#endif /* __HYPERCALL_H__ */
diff --git a/include/asm-x86/xen/hypervisor.h b/include/asm-x86/xen/hypervisor.h
deleted file mode 100644
index 04ee0610014a..000000000000
--- a/include/asm-x86/xen/hypervisor.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/******************************************************************************
2 * hypervisor.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __HYPERVISOR_H__
34#define __HYPERVISOR_H__
35
36#include <linux/types.h>
37#include <linux/kernel.h>
38
39#include <xen/interface/xen.h>
40#include <xen/interface/version.h>
41
42#include <asm/ptrace.h>
43#include <asm/page.h>
44#include <asm/desc.h>
45#if defined(__i386__)
46# ifdef CONFIG_X86_PAE
47# include <asm-generic/pgtable-nopud.h>
48# else
49# include <asm-generic/pgtable-nopmd.h>
50# endif
51#endif
52#include <asm/xen/hypercall.h>
53
54/* arch/i386/kernel/setup.c */
55extern struct shared_info *HYPERVISOR_shared_info;
56extern struct start_info *xen_start_info;
57#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
58
59/* arch/i386/mach-xen/evtchn.c */
60/* Force a proper event-channel callback from Xen. */
61extern void force_evtchn_callback(void);
62
63/* Turn jiffies into Xen system time. */
64u64 jiffies_to_st(unsigned long jiffies);
65
66
67#define MULTI_UVMFLAGS_INDEX 3
68#define MULTI_UVMDOMID_INDEX 4
69
70#define is_running_on_xen() (xen_start_info ? 1 : 0)
71
72#endif /* __HYPERVISOR_H__ */
diff --git a/include/asm-x86/xen/interface.h b/include/asm-x86/xen/interface.h
deleted file mode 100644
index 9d810f2538a2..000000000000
--- a/include/asm-x86/xen/interface.h
+++ /dev/null
@@ -1,175 +0,0 @@
1/******************************************************************************
2 * arch-x86_32.h
3 *
4 * Guest OS interface to x86 Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
8
9#ifndef __ASM_X86_XEN_INTERFACE_H
10#define __ASM_X86_XEN_INTERFACE_H
11
12#ifdef __XEN__
13#define __DEFINE_GUEST_HANDLE(name, type) \
14 typedef struct { type *p; } __guest_handle_ ## name
15#else
16#define __DEFINE_GUEST_HANDLE(name, type) \
17 typedef type * __guest_handle_ ## name
18#endif
19
20#define DEFINE_GUEST_HANDLE_STRUCT(name) \
21 __DEFINE_GUEST_HANDLE(name, struct name)
22#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
23#define GUEST_HANDLE(name) __guest_handle_ ## name
24
25#ifdef __XEN__
26#if defined(__i386__)
27#define set_xen_guest_handle(hnd, val) \
28 do { \
29 if (sizeof(hnd) == 8) \
30 *(uint64_t *)&(hnd) = 0; \
31 (hnd).p = val; \
32 } while (0)
33#elif defined(__x86_64__)
34#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
35#endif
36#else
37#if defined(__i386__)
38#define set_xen_guest_handle(hnd, val) \
39 do { \
40 if (sizeof(hnd) == 8) \
41 *(uint64_t *)&(hnd) = 0; \
42 (hnd) = val; \
43 } while (0)
44#elif defined(__x86_64__)
45#define set_xen_guest_handle(hnd, val) do { (hnd) = val; } while (0)
46#endif
47#endif
48
49#ifndef __ASSEMBLY__
50/* Guest handles for primitive C types. */
51__DEFINE_GUEST_HANDLE(uchar, unsigned char);
52__DEFINE_GUEST_HANDLE(uint, unsigned int);
53__DEFINE_GUEST_HANDLE(ulong, unsigned long);
54DEFINE_GUEST_HANDLE(char);
55DEFINE_GUEST_HANDLE(int);
56DEFINE_GUEST_HANDLE(long);
57DEFINE_GUEST_HANDLE(void);
58#endif
59
60#ifndef HYPERVISOR_VIRT_START
61#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
62#endif
63
64#ifndef machine_to_phys_mapping
65#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
66#endif
67
68/* Maximum number of virtual CPUs in multi-processor guests. */
69#define MAX_VIRT_CPUS 32
70
71/*
72 * SEGMENT DESCRIPTOR TABLES
73 */
74/*
75 * A number of GDT entries are reserved by Xen. These are not situated at the
76 * start of the GDT because some stupid OSes export hard-coded selector values
77 * in their ABI. These hard-coded values are always near the start of the GDT,
78 * so Xen places itself out of the way, at the far end of the GDT.
79 */
80#define FIRST_RESERVED_GDT_PAGE 14
81#define FIRST_RESERVED_GDT_BYTE (FIRST_RESERVED_GDT_PAGE * 4096)
82#define FIRST_RESERVED_GDT_ENTRY (FIRST_RESERVED_GDT_BYTE / 8)
83
84/*
85 * Send an array of these to HYPERVISOR_set_trap_table()
86 * The privilege level specifies which modes may enter a trap via a software
87 * interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
88 * privilege levels as follows:
89 * Level == 0: Noone may enter
90 * Level == 1: Kernel may enter
91 * Level == 2: Kernel may enter
92 * Level == 3: Everyone may enter
93 */
94#define TI_GET_DPL(_ti) ((_ti)->flags & 3)
95#define TI_GET_IF(_ti) ((_ti)->flags & 4)
96#define TI_SET_DPL(_ti, _dpl) ((_ti)->flags |= (_dpl))
97#define TI_SET_IF(_ti, _if) ((_ti)->flags |= ((!!(_if))<<2))
98
99#ifndef __ASSEMBLY__
100struct trap_info {
101 uint8_t vector; /* exception vector */
102 uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
103 uint16_t cs; /* code selector */
104 unsigned long address; /* code offset */
105};
106DEFINE_GUEST_HANDLE_STRUCT(trap_info);
107
108struct arch_shared_info {
109 unsigned long max_pfn; /* max pfn that appears in table */
110 /* Frame containing list of mfns containing list of mfns containing p2m. */
111 unsigned long pfn_to_mfn_frame_list_list;
112 unsigned long nmi_reason;
113};
114#endif /* !__ASSEMBLY__ */
115
116#ifdef CONFIG_X86_32
117#include "interface_32.h"
118#else
119#include "interface_64.h"
120#endif
121
122#ifndef __ASSEMBLY__
123/*
124 * The following is all CPU context. Note that the fpu_ctxt block is filled
125 * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
126 */
127struct vcpu_guest_context {
128 /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
129 struct { char x[512]; } fpu_ctxt; /* User-level FPU registers */
130#define VGCF_I387_VALID (1<<0)
131#define VGCF_HVM_GUEST (1<<1)
132#define VGCF_IN_KERNEL (1<<2)
133 unsigned long flags; /* VGCF_* flags */
134 struct cpu_user_regs user_regs; /* User-level CPU registers */
135 struct trap_info trap_ctxt[256]; /* Virtual IDT */
136 unsigned long ldt_base, ldt_ents; /* LDT (linear address, # ents) */
137 unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
138 unsigned long kernel_ss, kernel_sp; /* Virtual TSS (only SS1/SP1) */
139 /* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
140 unsigned long ctrlreg[8]; /* CR0-CR7 (control registers) */
141 unsigned long debugreg[8]; /* DB0-DB7 (debug registers) */
142#ifdef __i386__
143 unsigned long event_callback_cs; /* CS:EIP of event callback */
144 unsigned long event_callback_eip;
145 unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
146 unsigned long failsafe_callback_eip;
147#else
148 unsigned long event_callback_eip;
149 unsigned long failsafe_callback_eip;
150 unsigned long syscall_callback_eip;
151#endif
152 unsigned long vm_assist; /* VMASST_TYPE_* bitmap */
153#ifdef __x86_64__
154 /* Segment base addresses. */
155 uint64_t fs_base;
156 uint64_t gs_base_kernel;
157 uint64_t gs_base_user;
158#endif
159};
160DEFINE_GUEST_HANDLE_STRUCT(vcpu_guest_context);
161#endif /* !__ASSEMBLY__ */
162
163/*
164 * Prefix forces emulation of some non-trapping instructions.
165 * Currently only CPUID.
166 */
167#ifdef __ASSEMBLY__
168#define XEN_EMULATE_PREFIX .byte 0x0f,0x0b,0x78,0x65,0x6e ;
169#define XEN_CPUID XEN_EMULATE_PREFIX cpuid
170#else
171#define XEN_EMULATE_PREFIX ".byte 0x0f,0x0b,0x78,0x65,0x6e ; "
172#define XEN_CPUID XEN_EMULATE_PREFIX "cpuid"
173#endif
174
175#endif /* __ASM_X86_XEN_INTERFACE_H */
diff --git a/include/asm-x86/xen/interface_32.h b/include/asm-x86/xen/interface_32.h
deleted file mode 100644
index d8ac41d5db86..000000000000
--- a/include/asm-x86/xen/interface_32.h
+++ /dev/null
@@ -1,97 +0,0 @@
1/******************************************************************************
2 * arch-x86_32.h
3 *
4 * Guest OS interface to x86 32-bit Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
8
9#ifndef __ASM_X86_XEN_INTERFACE_32_H
10#define __ASM_X86_XEN_INTERFACE_32_H
11
12
13/*
14 * These flat segments are in the Xen-private section of every GDT. Since these
15 * are also present in the initial GDT, many OSes will be able to avoid
16 * installing their own GDT.
17 */
18#define FLAT_RING1_CS 0xe019 /* GDT index 259 */
19#define FLAT_RING1_DS 0xe021 /* GDT index 260 */
20#define FLAT_RING1_SS 0xe021 /* GDT index 260 */
21#define FLAT_RING3_CS 0xe02b /* GDT index 261 */
22#define FLAT_RING3_DS 0xe033 /* GDT index 262 */
23#define FLAT_RING3_SS 0xe033 /* GDT index 262 */
24
25#define FLAT_KERNEL_CS FLAT_RING1_CS
26#define FLAT_KERNEL_DS FLAT_RING1_DS
27#define FLAT_KERNEL_SS FLAT_RING1_SS
28#define FLAT_USER_CS FLAT_RING3_CS
29#define FLAT_USER_DS FLAT_RING3_DS
30#define FLAT_USER_SS FLAT_RING3_SS
31
32/* And the trap vector is... */
33#define TRAP_INSTR "int $0x82"
34
35/*
36 * Virtual addresses beyond this are not modifiable by guest OSes. The
37 * machine->physical mapping table starts at this address, read-only.
38 */
39#define __HYPERVISOR_VIRT_START 0xF5800000
40
41#ifndef __ASSEMBLY__
42
43struct cpu_user_regs {
44 uint32_t ebx;
45 uint32_t ecx;
46 uint32_t edx;
47 uint32_t esi;
48 uint32_t edi;
49 uint32_t ebp;
50 uint32_t eax;
51 uint16_t error_code; /* private */
52 uint16_t entry_vector; /* private */
53 uint32_t eip;
54 uint16_t cs;
55 uint8_t saved_upcall_mask;
56 uint8_t _pad0;
57 uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
58 uint32_t esp;
59 uint16_t ss, _pad1;
60 uint16_t es, _pad2;
61 uint16_t ds, _pad3;
62 uint16_t fs, _pad4;
63 uint16_t gs, _pad5;
64};
65DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
66
67typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
68
69struct arch_vcpu_info {
70 unsigned long cr2;
71 unsigned long pad[5]; /* sizeof(struct vcpu_info) == 64 */
72};
73
74struct xen_callback {
75 unsigned long cs;
76 unsigned long eip;
77};
78typedef struct xen_callback xen_callback_t;
79
80#define XEN_CALLBACK(__cs, __eip) \
81 ((struct xen_callback){ .cs = (__cs), .eip = (unsigned long)(__eip) })
82#endif /* !__ASSEMBLY__ */
83
84
85/*
86 * Page-directory addresses above 4GB do not fit into architectural %cr3.
87 * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
88 * must use the following accessor macros to pack/unpack valid MFNs.
89 *
90 * Note that Xen is using the fact that the pagetable base is always
91 * page-aligned, and putting the 12 MSB of the address into the 12 LSB
92 * of cr3.
93 */
94#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
95#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
96
97#endif /* __ASM_X86_XEN_INTERFACE_32_H */
diff --git a/include/asm-x86/xen/interface_64.h b/include/asm-x86/xen/interface_64.h
deleted file mode 100644
index 842266ce96e6..000000000000
--- a/include/asm-x86/xen/interface_64.h
+++ /dev/null
@@ -1,159 +0,0 @@
1#ifndef __ASM_X86_XEN_INTERFACE_64_H
2#define __ASM_X86_XEN_INTERFACE_64_H
3
4/*
5 * 64-bit segment selectors
6 * These flat segments are in the Xen-private section of every GDT. Since these
7 * are also present in the initial GDT, many OSes will be able to avoid
8 * installing their own GDT.
9 */
10
11#define FLAT_RING3_CS32 0xe023 /* GDT index 260 */
12#define FLAT_RING3_CS64 0xe033 /* GDT index 261 */
13#define FLAT_RING3_DS32 0xe02b /* GDT index 262 */
14#define FLAT_RING3_DS64 0x0000 /* NULL selector */
15#define FLAT_RING3_SS32 0xe02b /* GDT index 262 */
16#define FLAT_RING3_SS64 0xe02b /* GDT index 262 */
17
18#define FLAT_KERNEL_DS64 FLAT_RING3_DS64
19#define FLAT_KERNEL_DS32 FLAT_RING3_DS32
20#define FLAT_KERNEL_DS FLAT_KERNEL_DS64
21#define FLAT_KERNEL_CS64 FLAT_RING3_CS64
22#define FLAT_KERNEL_CS32 FLAT_RING3_CS32
23#define FLAT_KERNEL_CS FLAT_KERNEL_CS64
24#define FLAT_KERNEL_SS64 FLAT_RING3_SS64
25#define FLAT_KERNEL_SS32 FLAT_RING3_SS32
26#define FLAT_KERNEL_SS FLAT_KERNEL_SS64
27
28#define FLAT_USER_DS64 FLAT_RING3_DS64
29#define FLAT_USER_DS32 FLAT_RING3_DS32
30#define FLAT_USER_DS FLAT_USER_DS64
31#define FLAT_USER_CS64 FLAT_RING3_CS64
32#define FLAT_USER_CS32 FLAT_RING3_CS32
33#define FLAT_USER_CS FLAT_USER_CS64
34#define FLAT_USER_SS64 FLAT_RING3_SS64
35#define FLAT_USER_SS32 FLAT_RING3_SS32
36#define FLAT_USER_SS FLAT_USER_SS64
37
38#define __HYPERVISOR_VIRT_START 0xFFFF800000000000
39#define __HYPERVISOR_VIRT_END 0xFFFF880000000000
40#define __MACH2PHYS_VIRT_START 0xFFFF800000000000
41#define __MACH2PHYS_VIRT_END 0xFFFF804000000000
42
43#ifndef HYPERVISOR_VIRT_START
44#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
45#define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END)
46#endif
47
48#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
49#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
50#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3)
51#ifndef machine_to_phys_mapping
52#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START)
53#endif
54
55/*
56 * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
57 * @which == SEGBASE_* ; @base == 64-bit base address
58 * Returns 0 on success.
59 */
60#define SEGBASE_FS 0
61#define SEGBASE_GS_USER 1
62#define SEGBASE_GS_KERNEL 2
63#define SEGBASE_GS_USER_SEL 3 /* Set user %gs specified in base[15:0] */
64
65/*
66 * int HYPERVISOR_iret(void)
67 * All arguments are on the kernel stack, in the following format.
68 * Never returns if successful. Current kernel context is lost.
69 * The saved CS is mapped as follows:
70 * RING0 -> RING3 kernel mode.
71 * RING1 -> RING3 kernel mode.
72 * RING2 -> RING3 kernel mode.
73 * RING3 -> RING3 user mode.
74 * However RING0 indicates that the guest kernel should return to iteself
75 * directly with
76 * orb $3,1*8(%rsp)
77 * iretq
78 * If flags contains VGCF_in_syscall:
79 * Restore RAX, RIP, RFLAGS, RSP.
80 * Discard R11, RCX, CS, SS.
81 * Otherwise:
82 * Restore RAX, R11, RCX, CS:RIP, RFLAGS, SS:RSP.
83 * All other registers are saved on hypercall entry and restored to user.
84 */
85/* Guest exited in SYSCALL context? Return to guest with SYSRET? */
86#define _VGCF_in_syscall 8
87#define VGCF_in_syscall (1<<_VGCF_in_syscall)
88#define VGCF_IN_SYSCALL VGCF_in_syscall
89
90#ifndef __ASSEMBLY__
91
92struct iret_context {
93 /* Top of stack (%rsp at point of hypercall). */
94 uint64_t rax, r11, rcx, flags, rip, cs, rflags, rsp, ss;
95 /* Bottom of iret stack frame. */
96};
97
98#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
99/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
100#define __DECL_REG(name) union { \
101 uint64_t r ## name, e ## name; \
102 uint32_t _e ## name; \
103}
104#else
105/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
106#define __DECL_REG(name) uint64_t r ## name
107#endif
108
109struct cpu_user_regs {
110 uint64_t r15;
111 uint64_t r14;
112 uint64_t r13;
113 uint64_t r12;
114 __DECL_REG(bp);
115 __DECL_REG(bx);
116 uint64_t r11;
117 uint64_t r10;
118 uint64_t r9;
119 uint64_t r8;
120 __DECL_REG(ax);
121 __DECL_REG(cx);
122 __DECL_REG(dx);
123 __DECL_REG(si);
124 __DECL_REG(di);
125 uint32_t error_code; /* private */
126 uint32_t entry_vector; /* private */
127 __DECL_REG(ip);
128 uint16_t cs, _pad0[1];
129 uint8_t saved_upcall_mask;
130 uint8_t _pad1[3];
131 __DECL_REG(flags); /* rflags.IF == !saved_upcall_mask */
132 __DECL_REG(sp);
133 uint16_t ss, _pad2[3];
134 uint16_t es, _pad3[3];
135 uint16_t ds, _pad4[3];
136 uint16_t fs, _pad5[3]; /* Non-zero => takes precedence over fs_base. */
137 uint16_t gs, _pad6[3]; /* Non-zero => takes precedence over gs_base_usr. */
138};
139DEFINE_GUEST_HANDLE_STRUCT(cpu_user_regs);
140
141#undef __DECL_REG
142
143#define xen_pfn_to_cr3(pfn) ((unsigned long)(pfn) << 12)
144#define xen_cr3_to_pfn(cr3) ((unsigned long)(cr3) >> 12)
145
146struct arch_vcpu_info {
147 unsigned long cr2;
148 unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
149};
150
151typedef unsigned long xen_callback_t;
152
153#define XEN_CALLBACK(__cs, __rip) \
154 ((unsigned long)(__rip))
155
156#endif /* !__ASSEMBLY__ */
157
158
159#endif /* __ASM_X86_XEN_INTERFACE_64_H */
diff --git a/include/asm-x86/xen/page.h b/include/asm-x86/xen/page.h
deleted file mode 100644
index 7b3835d3b77d..000000000000
--- a/include/asm-x86/xen/page.h
+++ /dev/null
@@ -1,165 +0,0 @@
1#ifndef __XEN_PAGE_H
2#define __XEN_PAGE_H
3
4#include <linux/pfn.h>
5
6#include <asm/uaccess.h>
7#include <asm/pgtable.h>
8
9#include <xen/features.h>
10
11/* Xen machine address */
12typedef struct xmaddr {
13 phys_addr_t maddr;
14} xmaddr_t;
15
16/* Xen pseudo-physical address */
17typedef struct xpaddr {
18 phys_addr_t paddr;
19} xpaddr_t;
20
21#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
22#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
23
24/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
25#define INVALID_P2M_ENTRY (~0UL)
26#define FOREIGN_FRAME_BIT (1UL<<31)
27#define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT)
28
29/* Maximum amount of memory we can handle in a domain in pages */
30#define MAX_DOMAIN_PAGES \
31 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE))
32
33
34extern unsigned long get_phys_to_machine(unsigned long pfn);
35extern void set_phys_to_machine(unsigned long pfn, unsigned long mfn);
36
37static inline unsigned long pfn_to_mfn(unsigned long pfn)
38{
39 if (xen_feature(XENFEAT_auto_translated_physmap))
40 return pfn;
41
42 return get_phys_to_machine(pfn) & ~FOREIGN_FRAME_BIT;
43}
44
45static inline int phys_to_machine_mapping_valid(unsigned long pfn)
46{
47 if (xen_feature(XENFEAT_auto_translated_physmap))
48 return 1;
49
50 return get_phys_to_machine(pfn) != INVALID_P2M_ENTRY;
51}
52
53static inline unsigned long mfn_to_pfn(unsigned long mfn)
54{
55 unsigned long pfn;
56
57 if (xen_feature(XENFEAT_auto_translated_physmap))
58 return mfn;
59
60#if 0
61 if (unlikely((mfn >> machine_to_phys_order) != 0))
62 return max_mapnr;
63#endif
64
65 pfn = 0;
66 /*
67 * The array access can fail (e.g., device space beyond end of RAM).
68 * In such cases it doesn't matter what we return (we return garbage),
69 * but we must handle the fault without crashing!
70 */
71 __get_user(pfn, &machine_to_phys_mapping[mfn]);
72
73 return pfn;
74}
75
76static inline xmaddr_t phys_to_machine(xpaddr_t phys)
77{
78 unsigned offset = phys.paddr & ~PAGE_MASK;
79 return XMADDR(PFN_PHYS((u64)pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
80}
81
82static inline xpaddr_t machine_to_phys(xmaddr_t machine)
83{
84 unsigned offset = machine.maddr & ~PAGE_MASK;
85 return XPADDR(PFN_PHYS((u64)mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
86}
87
88/*
89 * We detect special mappings in one of two ways:
90 * 1. If the MFN is an I/O page then Xen will set the m2p entry
91 * to be outside our maximum possible pseudophys range.
92 * 2. If the MFN belongs to a different domain then we will certainly
93 * not have MFN in our p2m table. Conversely, if the page is ours,
94 * then we'll have p2m(m2p(MFN))==MFN.
95 * If we detect a special mapping then it doesn't have a 'struct page'.
96 * We force !pfn_valid() by returning an out-of-range pointer.
97 *
98 * NB. These checks require that, for any MFN that is not in our reservation,
99 * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
100 * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
101 * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
102 *
103 * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
104 * use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
105 * require. In all the cases we care about, the FOREIGN_FRAME bit is
106 * masked (e.g., pfn_to_mfn()) so behaviour there is correct.
107 */
108static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
109{
110 extern unsigned long max_mapnr;
111 unsigned long pfn = mfn_to_pfn(mfn);
112 if ((pfn < max_mapnr)
113 && !xen_feature(XENFEAT_auto_translated_physmap)
114 && (get_phys_to_machine(pfn) != mfn))
115 return max_mapnr; /* force !pfn_valid() */
116 /* XXX fixme; not true with sparsemem */
117 return pfn;
118}
119
120/* VIRT <-> MACHINE conversion */
121#define virt_to_machine(v) (phys_to_machine(XPADDR(__pa(v))))
122#define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v))))
123#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
124
125static inline unsigned long pte_mfn(pte_t pte)
126{
127 return (pte.pte & PTE_PFN_MASK) >> PAGE_SHIFT;
128}
129
130static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
131{
132 pte_t pte;
133
134 pte.pte = ((phys_addr_t)page_nr << PAGE_SHIFT) |
135 (pgprot_val(pgprot) & __supported_pte_mask);
136
137 return pte;
138}
139
140static inline pteval_t pte_val_ma(pte_t pte)
141{
142 return pte.pte;
143}
144
145static inline pte_t __pte_ma(pteval_t x)
146{
147 return (pte_t) { .pte = x };
148}
149
150#define pmd_val_ma(v) ((v).pmd)
151#ifdef __PAGETABLE_PUD_FOLDED
152#define pud_val_ma(v) ((v).pgd.pgd)
153#else
154#define pud_val_ma(v) ((v).pud)
155#endif
156#define __pmd_ma(x) ((pmd_t) { (x) } )
157
158#define pgd_val_ma(x) ((x).pgd)
159
160
161xmaddr_t arbitrary_virt_to_machine(void *address);
162void make_lowmem_page_readonly(void *vaddr);
163void make_lowmem_page_readwrite(void *vaddr);
164
165#endif /* __XEN_PAGE_H */
diff --git a/include/asm-x86/xor.h b/include/asm-x86/xor.h
deleted file mode 100644
index 11b3bb86e17b..000000000000
--- a/include/asm-x86/xor.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "xor_32.h"
3#else
4# include "xor_64.h"
5#endif
diff --git a/include/asm-x86/xor_32.h b/include/asm-x86/xor_32.h
deleted file mode 100644
index 921b45840449..000000000000
--- a/include/asm-x86/xor_32.h
+++ /dev/null
@@ -1,888 +0,0 @@
1#ifndef ASM_X86__XOR_32_H
2#define ASM_X86__XOR_32_H
3
4/*
5 * Optimized RAID-5 checksumming functions for MMX and SSE.
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, or (at your option)
10 * any later version.
11 *
12 * You should have received a copy of the GNU General Public License
13 * (for example /usr/src/linux/COPYING); if not, write to the Free
14 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17/*
18 * High-speed RAID5 checksumming functions utilizing MMX instructions.
19 * Copyright (C) 1998 Ingo Molnar.
20 */
21
22#define LD(x, y) " movq 8*("#x")(%1), %%mm"#y" ;\n"
23#define ST(x, y) " movq %%mm"#y", 8*("#x")(%1) ;\n"
24#define XO1(x, y) " pxor 8*("#x")(%2), %%mm"#y" ;\n"
25#define XO2(x, y) " pxor 8*("#x")(%3), %%mm"#y" ;\n"
26#define XO3(x, y) " pxor 8*("#x")(%4), %%mm"#y" ;\n"
27#define XO4(x, y) " pxor 8*("#x")(%5), %%mm"#y" ;\n"
28
29#include <asm/i387.h>
30
31static void
32xor_pII_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
33{
34 unsigned long lines = bytes >> 7;
35
36 kernel_fpu_begin();
37
38 asm volatile(
39#undef BLOCK
40#define BLOCK(i) \
41 LD(i, 0) \
42 LD(i + 1, 1) \
43 LD(i + 2, 2) \
44 LD(i + 3, 3) \
45 XO1(i, 0) \
46 ST(i, 0) \
47 XO1(i+1, 1) \
48 ST(i+1, 1) \
49 XO1(i + 2, 2) \
50 ST(i + 2, 2) \
51 XO1(i + 3, 3) \
52 ST(i + 3, 3)
53
54 " .align 32 ;\n"
55 " 1: ;\n"
56
57 BLOCK(0)
58 BLOCK(4)
59 BLOCK(8)
60 BLOCK(12)
61
62 " addl $128, %1 ;\n"
63 " addl $128, %2 ;\n"
64 " decl %0 ;\n"
65 " jnz 1b ;\n"
66 : "+r" (lines),
67 "+r" (p1), "+r" (p2)
68 :
69 : "memory");
70
71 kernel_fpu_end();
72}
73
74static void
75xor_pII_mmx_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
76 unsigned long *p3)
77{
78 unsigned long lines = bytes >> 7;
79
80 kernel_fpu_begin();
81
82 asm volatile(
83#undef BLOCK
84#define BLOCK(i) \
85 LD(i, 0) \
86 LD(i + 1, 1) \
87 LD(i + 2, 2) \
88 LD(i + 3, 3) \
89 XO1(i, 0) \
90 XO1(i + 1, 1) \
91 XO1(i + 2, 2) \
92 XO1(i + 3, 3) \
93 XO2(i, 0) \
94 ST(i, 0) \
95 XO2(i + 1, 1) \
96 ST(i + 1, 1) \
97 XO2(i + 2, 2) \
98 ST(i + 2, 2) \
99 XO2(i + 3, 3) \
100 ST(i + 3, 3)
101
102 " .align 32 ;\n"
103 " 1: ;\n"
104
105 BLOCK(0)
106 BLOCK(4)
107 BLOCK(8)
108 BLOCK(12)
109
110 " addl $128, %1 ;\n"
111 " addl $128, %2 ;\n"
112 " addl $128, %3 ;\n"
113 " decl %0 ;\n"
114 " jnz 1b ;\n"
115 : "+r" (lines),
116 "+r" (p1), "+r" (p2), "+r" (p3)
117 :
118 : "memory");
119
120 kernel_fpu_end();
121}
122
123static void
124xor_pII_mmx_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
125 unsigned long *p3, unsigned long *p4)
126{
127 unsigned long lines = bytes >> 7;
128
129 kernel_fpu_begin();
130
131 asm volatile(
132#undef BLOCK
133#define BLOCK(i) \
134 LD(i, 0) \
135 LD(i + 1, 1) \
136 LD(i + 2, 2) \
137 LD(i + 3, 3) \
138 XO1(i, 0) \
139 XO1(i + 1, 1) \
140 XO1(i + 2, 2) \
141 XO1(i + 3, 3) \
142 XO2(i, 0) \
143 XO2(i + 1, 1) \
144 XO2(i + 2, 2) \
145 XO2(i + 3, 3) \
146 XO3(i, 0) \
147 ST(i, 0) \
148 XO3(i + 1, 1) \
149 ST(i + 1, 1) \
150 XO3(i + 2, 2) \
151 ST(i + 2, 2) \
152 XO3(i + 3, 3) \
153 ST(i + 3, 3)
154
155 " .align 32 ;\n"
156 " 1: ;\n"
157
158 BLOCK(0)
159 BLOCK(4)
160 BLOCK(8)
161 BLOCK(12)
162
163 " addl $128, %1 ;\n"
164 " addl $128, %2 ;\n"
165 " addl $128, %3 ;\n"
166 " addl $128, %4 ;\n"
167 " decl %0 ;\n"
168 " jnz 1b ;\n"
169 : "+r" (lines),
170 "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
171 :
172 : "memory");
173
174 kernel_fpu_end();
175}
176
177
178static void
179xor_pII_mmx_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
180 unsigned long *p3, unsigned long *p4, unsigned long *p5)
181{
182 unsigned long lines = bytes >> 7;
183
184 kernel_fpu_begin();
185
186 /* Make sure GCC forgets anything it knows about p4 or p5,
187 such that it won't pass to the asm volatile below a
188 register that is shared with any other variable. That's
189 because we modify p4 and p5 there, but we can't mark them
190 as read/write, otherwise we'd overflow the 10-asm-operands
191 limit of GCC < 3.1. */
192 asm("" : "+r" (p4), "+r" (p5));
193
194 asm volatile(
195#undef BLOCK
196#define BLOCK(i) \
197 LD(i, 0) \
198 LD(i + 1, 1) \
199 LD(i + 2, 2) \
200 LD(i + 3, 3) \
201 XO1(i, 0) \
202 XO1(i + 1, 1) \
203 XO1(i + 2, 2) \
204 XO1(i + 3, 3) \
205 XO2(i, 0) \
206 XO2(i + 1, 1) \
207 XO2(i + 2, 2) \
208 XO2(i + 3, 3) \
209 XO3(i, 0) \
210 XO3(i + 1, 1) \
211 XO3(i + 2, 2) \
212 XO3(i + 3, 3) \
213 XO4(i, 0) \
214 ST(i, 0) \
215 XO4(i + 1, 1) \
216 ST(i + 1, 1) \
217 XO4(i + 2, 2) \
218 ST(i + 2, 2) \
219 XO4(i + 3, 3) \
220 ST(i + 3, 3)
221
222 " .align 32 ;\n"
223 " 1: ;\n"
224
225 BLOCK(0)
226 BLOCK(4)
227 BLOCK(8)
228 BLOCK(12)
229
230 " addl $128, %1 ;\n"
231 " addl $128, %2 ;\n"
232 " addl $128, %3 ;\n"
233 " addl $128, %4 ;\n"
234 " addl $128, %5 ;\n"
235 " decl %0 ;\n"
236 " jnz 1b ;\n"
237 : "+r" (lines),
238 "+r" (p1), "+r" (p2), "+r" (p3)
239 : "r" (p4), "r" (p5)
240 : "memory");
241
242 /* p4 and p5 were modified, and now the variables are dead.
243 Clobber them just to be sure nobody does something stupid
244 like assuming they have some legal value. */
245 asm("" : "=r" (p4), "=r" (p5));
246
247 kernel_fpu_end();
248}
249
250#undef LD
251#undef XO1
252#undef XO2
253#undef XO3
254#undef XO4
255#undef ST
256#undef BLOCK
257
258static void
259xor_p5_mmx_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
260{
261 unsigned long lines = bytes >> 6;
262
263 kernel_fpu_begin();
264
265 asm volatile(
266 " .align 32 ;\n"
267 " 1: ;\n"
268 " movq (%1), %%mm0 ;\n"
269 " movq 8(%1), %%mm1 ;\n"
270 " pxor (%2), %%mm0 ;\n"
271 " movq 16(%1), %%mm2 ;\n"
272 " movq %%mm0, (%1) ;\n"
273 " pxor 8(%2), %%mm1 ;\n"
274 " movq 24(%1), %%mm3 ;\n"
275 " movq %%mm1, 8(%1) ;\n"
276 " pxor 16(%2), %%mm2 ;\n"
277 " movq 32(%1), %%mm4 ;\n"
278 " movq %%mm2, 16(%1) ;\n"
279 " pxor 24(%2), %%mm3 ;\n"
280 " movq 40(%1), %%mm5 ;\n"
281 " movq %%mm3, 24(%1) ;\n"
282 " pxor 32(%2), %%mm4 ;\n"
283 " movq 48(%1), %%mm6 ;\n"
284 " movq %%mm4, 32(%1) ;\n"
285 " pxor 40(%2), %%mm5 ;\n"
286 " movq 56(%1), %%mm7 ;\n"
287 " movq %%mm5, 40(%1) ;\n"
288 " pxor 48(%2), %%mm6 ;\n"
289 " pxor 56(%2), %%mm7 ;\n"
290 " movq %%mm6, 48(%1) ;\n"
291 " movq %%mm7, 56(%1) ;\n"
292
293 " addl $64, %1 ;\n"
294 " addl $64, %2 ;\n"
295 " decl %0 ;\n"
296 " jnz 1b ;\n"
297 : "+r" (lines),
298 "+r" (p1), "+r" (p2)
299 :
300 : "memory");
301
302 kernel_fpu_end();
303}
304
305static void
306xor_p5_mmx_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
307 unsigned long *p3)
308{
309 unsigned long lines = bytes >> 6;
310
311 kernel_fpu_begin();
312
313 asm volatile(
314 " .align 32,0x90 ;\n"
315 " 1: ;\n"
316 " movq (%1), %%mm0 ;\n"
317 " movq 8(%1), %%mm1 ;\n"
318 " pxor (%2), %%mm0 ;\n"
319 " movq 16(%1), %%mm2 ;\n"
320 " pxor 8(%2), %%mm1 ;\n"
321 " pxor (%3), %%mm0 ;\n"
322 " pxor 16(%2), %%mm2 ;\n"
323 " movq %%mm0, (%1) ;\n"
324 " pxor 8(%3), %%mm1 ;\n"
325 " pxor 16(%3), %%mm2 ;\n"
326 " movq 24(%1), %%mm3 ;\n"
327 " movq %%mm1, 8(%1) ;\n"
328 " movq 32(%1), %%mm4 ;\n"
329 " movq 40(%1), %%mm5 ;\n"
330 " pxor 24(%2), %%mm3 ;\n"
331 " movq %%mm2, 16(%1) ;\n"
332 " pxor 32(%2), %%mm4 ;\n"
333 " pxor 24(%3), %%mm3 ;\n"
334 " pxor 40(%2), %%mm5 ;\n"
335 " movq %%mm3, 24(%1) ;\n"
336 " pxor 32(%3), %%mm4 ;\n"
337 " pxor 40(%3), %%mm5 ;\n"
338 " movq 48(%1), %%mm6 ;\n"
339 " movq %%mm4, 32(%1) ;\n"
340 " movq 56(%1), %%mm7 ;\n"
341 " pxor 48(%2), %%mm6 ;\n"
342 " movq %%mm5, 40(%1) ;\n"
343 " pxor 56(%2), %%mm7 ;\n"
344 " pxor 48(%3), %%mm6 ;\n"
345 " pxor 56(%3), %%mm7 ;\n"
346 " movq %%mm6, 48(%1) ;\n"
347 " movq %%mm7, 56(%1) ;\n"
348
349 " addl $64, %1 ;\n"
350 " addl $64, %2 ;\n"
351 " addl $64, %3 ;\n"
352 " decl %0 ;\n"
353 " jnz 1b ;\n"
354 : "+r" (lines),
355 "+r" (p1), "+r" (p2), "+r" (p3)
356 :
357 : "memory" );
358
359 kernel_fpu_end();
360}
361
362static void
363xor_p5_mmx_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
364 unsigned long *p3, unsigned long *p4)
365{
366 unsigned long lines = bytes >> 6;
367
368 kernel_fpu_begin();
369
370 asm volatile(
371 " .align 32,0x90 ;\n"
372 " 1: ;\n"
373 " movq (%1), %%mm0 ;\n"
374 " movq 8(%1), %%mm1 ;\n"
375 " pxor (%2), %%mm0 ;\n"
376 " movq 16(%1), %%mm2 ;\n"
377 " pxor 8(%2), %%mm1 ;\n"
378 " pxor (%3), %%mm0 ;\n"
379 " pxor 16(%2), %%mm2 ;\n"
380 " pxor 8(%3), %%mm1 ;\n"
381 " pxor (%4), %%mm0 ;\n"
382 " movq 24(%1), %%mm3 ;\n"
383 " pxor 16(%3), %%mm2 ;\n"
384 " pxor 8(%4), %%mm1 ;\n"
385 " movq %%mm0, (%1) ;\n"
386 " movq 32(%1), %%mm4 ;\n"
387 " pxor 24(%2), %%mm3 ;\n"
388 " pxor 16(%4), %%mm2 ;\n"
389 " movq %%mm1, 8(%1) ;\n"
390 " movq 40(%1), %%mm5 ;\n"
391 " pxor 32(%2), %%mm4 ;\n"
392 " pxor 24(%3), %%mm3 ;\n"
393 " movq %%mm2, 16(%1) ;\n"
394 " pxor 40(%2), %%mm5 ;\n"
395 " pxor 32(%3), %%mm4 ;\n"
396 " pxor 24(%4), %%mm3 ;\n"
397 " movq %%mm3, 24(%1) ;\n"
398 " movq 56(%1), %%mm7 ;\n"
399 " movq 48(%1), %%mm6 ;\n"
400 " pxor 40(%3), %%mm5 ;\n"
401 " pxor 32(%4), %%mm4 ;\n"
402 " pxor 48(%2), %%mm6 ;\n"
403 " movq %%mm4, 32(%1) ;\n"
404 " pxor 56(%2), %%mm7 ;\n"
405 " pxor 40(%4), %%mm5 ;\n"
406 " pxor 48(%3), %%mm6 ;\n"
407 " pxor 56(%3), %%mm7 ;\n"
408 " movq %%mm5, 40(%1) ;\n"
409 " pxor 48(%4), %%mm6 ;\n"
410 " pxor 56(%4), %%mm7 ;\n"
411 " movq %%mm6, 48(%1) ;\n"
412 " movq %%mm7, 56(%1) ;\n"
413
414 " addl $64, %1 ;\n"
415 " addl $64, %2 ;\n"
416 " addl $64, %3 ;\n"
417 " addl $64, %4 ;\n"
418 " decl %0 ;\n"
419 " jnz 1b ;\n"
420 : "+r" (lines),
421 "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
422 :
423 : "memory");
424
425 kernel_fpu_end();
426}
427
428static void
429xor_p5_mmx_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
430 unsigned long *p3, unsigned long *p4, unsigned long *p5)
431{
432 unsigned long lines = bytes >> 6;
433
434 kernel_fpu_begin();
435
436 /* Make sure GCC forgets anything it knows about p4 or p5,
437 such that it won't pass to the asm volatile below a
438 register that is shared with any other variable. That's
439 because we modify p4 and p5 there, but we can't mark them
440 as read/write, otherwise we'd overflow the 10-asm-operands
441 limit of GCC < 3.1. */
442 asm("" : "+r" (p4), "+r" (p5));
443
444 asm volatile(
445 " .align 32,0x90 ;\n"
446 " 1: ;\n"
447 " movq (%1), %%mm0 ;\n"
448 " movq 8(%1), %%mm1 ;\n"
449 " pxor (%2), %%mm0 ;\n"
450 " pxor 8(%2), %%mm1 ;\n"
451 " movq 16(%1), %%mm2 ;\n"
452 " pxor (%3), %%mm0 ;\n"
453 " pxor 8(%3), %%mm1 ;\n"
454 " pxor 16(%2), %%mm2 ;\n"
455 " pxor (%4), %%mm0 ;\n"
456 " pxor 8(%4), %%mm1 ;\n"
457 " pxor 16(%3), %%mm2 ;\n"
458 " movq 24(%1), %%mm3 ;\n"
459 " pxor (%5), %%mm0 ;\n"
460 " pxor 8(%5), %%mm1 ;\n"
461 " movq %%mm0, (%1) ;\n"
462 " pxor 16(%4), %%mm2 ;\n"
463 " pxor 24(%2), %%mm3 ;\n"
464 " movq %%mm1, 8(%1) ;\n"
465 " pxor 16(%5), %%mm2 ;\n"
466 " pxor 24(%3), %%mm3 ;\n"
467 " movq 32(%1), %%mm4 ;\n"
468 " movq %%mm2, 16(%1) ;\n"
469 " pxor 24(%4), %%mm3 ;\n"
470 " pxor 32(%2), %%mm4 ;\n"
471 " movq 40(%1), %%mm5 ;\n"
472 " pxor 24(%5), %%mm3 ;\n"
473 " pxor 32(%3), %%mm4 ;\n"
474 " pxor 40(%2), %%mm5 ;\n"
475 " movq %%mm3, 24(%1) ;\n"
476 " pxor 32(%4), %%mm4 ;\n"
477 " pxor 40(%3), %%mm5 ;\n"
478 " movq 48(%1), %%mm6 ;\n"
479 " movq 56(%1), %%mm7 ;\n"
480 " pxor 32(%5), %%mm4 ;\n"
481 " pxor 40(%4), %%mm5 ;\n"
482 " pxor 48(%2), %%mm6 ;\n"
483 " pxor 56(%2), %%mm7 ;\n"
484 " movq %%mm4, 32(%1) ;\n"
485 " pxor 48(%3), %%mm6 ;\n"
486 " pxor 56(%3), %%mm7 ;\n"
487 " pxor 40(%5), %%mm5 ;\n"
488 " pxor 48(%4), %%mm6 ;\n"
489 " pxor 56(%4), %%mm7 ;\n"
490 " movq %%mm5, 40(%1) ;\n"
491 " pxor 48(%5), %%mm6 ;\n"
492 " pxor 56(%5), %%mm7 ;\n"
493 " movq %%mm6, 48(%1) ;\n"
494 " movq %%mm7, 56(%1) ;\n"
495
496 " addl $64, %1 ;\n"
497 " addl $64, %2 ;\n"
498 " addl $64, %3 ;\n"
499 " addl $64, %4 ;\n"
500 " addl $64, %5 ;\n"
501 " decl %0 ;\n"
502 " jnz 1b ;\n"
503 : "+r" (lines),
504 "+r" (p1), "+r" (p2), "+r" (p3)
505 : "r" (p4), "r" (p5)
506 : "memory");
507
508 /* p4 and p5 were modified, and now the variables are dead.
509 Clobber them just to be sure nobody does something stupid
510 like assuming they have some legal value. */
511 asm("" : "=r" (p4), "=r" (p5));
512
513 kernel_fpu_end();
514}
515
516static struct xor_block_template xor_block_pII_mmx = {
517 .name = "pII_mmx",
518 .do_2 = xor_pII_mmx_2,
519 .do_3 = xor_pII_mmx_3,
520 .do_4 = xor_pII_mmx_4,
521 .do_5 = xor_pII_mmx_5,
522};
523
524static struct xor_block_template xor_block_p5_mmx = {
525 .name = "p5_mmx",
526 .do_2 = xor_p5_mmx_2,
527 .do_3 = xor_p5_mmx_3,
528 .do_4 = xor_p5_mmx_4,
529 .do_5 = xor_p5_mmx_5,
530};
531
532/*
533 * Cache avoiding checksumming functions utilizing KNI instructions
534 * Copyright (C) 1999 Zach Brown (with obvious credit due Ingo)
535 */
536
537#define XMMS_SAVE \
538do { \
539 preempt_disable(); \
540 cr0 = read_cr0(); \
541 clts(); \
542 asm volatile( \
543 "movups %%xmm0,(%0) ;\n\t" \
544 "movups %%xmm1,0x10(%0) ;\n\t" \
545 "movups %%xmm2,0x20(%0) ;\n\t" \
546 "movups %%xmm3,0x30(%0) ;\n\t" \
547 : \
548 : "r" (xmm_save) \
549 : "memory"); \
550} while (0)
551
552#define XMMS_RESTORE \
553do { \
554 asm volatile( \
555 "sfence ;\n\t" \
556 "movups (%0),%%xmm0 ;\n\t" \
557 "movups 0x10(%0),%%xmm1 ;\n\t" \
558 "movups 0x20(%0),%%xmm2 ;\n\t" \
559 "movups 0x30(%0),%%xmm3 ;\n\t" \
560 : \
561 : "r" (xmm_save) \
562 : "memory"); \
563 write_cr0(cr0); \
564 preempt_enable(); \
565} while (0)
566
567#define ALIGN16 __attribute__((aligned(16)))
568
569#define OFFS(x) "16*("#x")"
570#define PF_OFFS(x) "256+16*("#x")"
571#define PF0(x) " prefetchnta "PF_OFFS(x)"(%1) ;\n"
572#define LD(x, y) " movaps "OFFS(x)"(%1), %%xmm"#y" ;\n"
573#define ST(x, y) " movaps %%xmm"#y", "OFFS(x)"(%1) ;\n"
574#define PF1(x) " prefetchnta "PF_OFFS(x)"(%2) ;\n"
575#define PF2(x) " prefetchnta "PF_OFFS(x)"(%3) ;\n"
576#define PF3(x) " prefetchnta "PF_OFFS(x)"(%4) ;\n"
577#define PF4(x) " prefetchnta "PF_OFFS(x)"(%5) ;\n"
578#define PF5(x) " prefetchnta "PF_OFFS(x)"(%6) ;\n"
579#define XO1(x, y) " xorps "OFFS(x)"(%2), %%xmm"#y" ;\n"
580#define XO2(x, y) " xorps "OFFS(x)"(%3), %%xmm"#y" ;\n"
581#define XO3(x, y) " xorps "OFFS(x)"(%4), %%xmm"#y" ;\n"
582#define XO4(x, y) " xorps "OFFS(x)"(%5), %%xmm"#y" ;\n"
583#define XO5(x, y) " xorps "OFFS(x)"(%6), %%xmm"#y" ;\n"
584
585
586static void
587xor_sse_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
588{
589 unsigned long lines = bytes >> 8;
590 char xmm_save[16*4] ALIGN16;
591 int cr0;
592
593 XMMS_SAVE;
594
595 asm volatile(
596#undef BLOCK
597#define BLOCK(i) \
598 LD(i, 0) \
599 LD(i + 1, 1) \
600 PF1(i) \
601 PF1(i + 2) \
602 LD(i + 2, 2) \
603 LD(i + 3, 3) \
604 PF0(i + 4) \
605 PF0(i + 6) \
606 XO1(i, 0) \
607 XO1(i + 1, 1) \
608 XO1(i + 2, 2) \
609 XO1(i + 3, 3) \
610 ST(i, 0) \
611 ST(i + 1, 1) \
612 ST(i + 2, 2) \
613 ST(i + 3, 3) \
614
615
616 PF0(0)
617 PF0(2)
618
619 " .align 32 ;\n"
620 " 1: ;\n"
621
622 BLOCK(0)
623 BLOCK(4)
624 BLOCK(8)
625 BLOCK(12)
626
627 " addl $256, %1 ;\n"
628 " addl $256, %2 ;\n"
629 " decl %0 ;\n"
630 " jnz 1b ;\n"
631 : "+r" (lines),
632 "+r" (p1), "+r" (p2)
633 :
634 : "memory");
635
636 XMMS_RESTORE;
637}
638
639static void
640xor_sse_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
641 unsigned long *p3)
642{
643 unsigned long lines = bytes >> 8;
644 char xmm_save[16*4] ALIGN16;
645 int cr0;
646
647 XMMS_SAVE;
648
649 asm volatile(
650#undef BLOCK
651#define BLOCK(i) \
652 PF1(i) \
653 PF1(i + 2) \
654 LD(i,0) \
655 LD(i + 1, 1) \
656 LD(i + 2, 2) \
657 LD(i + 3, 3) \
658 PF2(i) \
659 PF2(i + 2) \
660 PF0(i + 4) \
661 PF0(i + 6) \
662 XO1(i,0) \
663 XO1(i + 1, 1) \
664 XO1(i + 2, 2) \
665 XO1(i + 3, 3) \
666 XO2(i,0) \
667 XO2(i + 1, 1) \
668 XO2(i + 2, 2) \
669 XO2(i + 3, 3) \
670 ST(i,0) \
671 ST(i + 1, 1) \
672 ST(i + 2, 2) \
673 ST(i + 3, 3) \
674
675
676 PF0(0)
677 PF0(2)
678
679 " .align 32 ;\n"
680 " 1: ;\n"
681
682 BLOCK(0)
683 BLOCK(4)
684 BLOCK(8)
685 BLOCK(12)
686
687 " addl $256, %1 ;\n"
688 " addl $256, %2 ;\n"
689 " addl $256, %3 ;\n"
690 " decl %0 ;\n"
691 " jnz 1b ;\n"
692 : "+r" (lines),
693 "+r" (p1), "+r"(p2), "+r"(p3)
694 :
695 : "memory" );
696
697 XMMS_RESTORE;
698}
699
700static void
701xor_sse_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
702 unsigned long *p3, unsigned long *p4)
703{
704 unsigned long lines = bytes >> 8;
705 char xmm_save[16*4] ALIGN16;
706 int cr0;
707
708 XMMS_SAVE;
709
710 asm volatile(
711#undef BLOCK
712#define BLOCK(i) \
713 PF1(i) \
714 PF1(i + 2) \
715 LD(i,0) \
716 LD(i + 1, 1) \
717 LD(i + 2, 2) \
718 LD(i + 3, 3) \
719 PF2(i) \
720 PF2(i + 2) \
721 XO1(i,0) \
722 XO1(i + 1, 1) \
723 XO1(i + 2, 2) \
724 XO1(i + 3, 3) \
725 PF3(i) \
726 PF3(i + 2) \
727 PF0(i + 4) \
728 PF0(i + 6) \
729 XO2(i,0) \
730 XO2(i + 1, 1) \
731 XO2(i + 2, 2) \
732 XO2(i + 3, 3) \
733 XO3(i,0) \
734 XO3(i + 1, 1) \
735 XO3(i + 2, 2) \
736 XO3(i + 3, 3) \
737 ST(i,0) \
738 ST(i + 1, 1) \
739 ST(i + 2, 2) \
740 ST(i + 3, 3) \
741
742
743 PF0(0)
744 PF0(2)
745
746 " .align 32 ;\n"
747 " 1: ;\n"
748
749 BLOCK(0)
750 BLOCK(4)
751 BLOCK(8)
752 BLOCK(12)
753
754 " addl $256, %1 ;\n"
755 " addl $256, %2 ;\n"
756 " addl $256, %3 ;\n"
757 " addl $256, %4 ;\n"
758 " decl %0 ;\n"
759 " jnz 1b ;\n"
760 : "+r" (lines),
761 "+r" (p1), "+r" (p2), "+r" (p3), "+r" (p4)
762 :
763 : "memory" );
764
765 XMMS_RESTORE;
766}
767
768static void
769xor_sse_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
770 unsigned long *p3, unsigned long *p4, unsigned long *p5)
771{
772 unsigned long lines = bytes >> 8;
773 char xmm_save[16*4] ALIGN16;
774 int cr0;
775
776 XMMS_SAVE;
777
778 /* Make sure GCC forgets anything it knows about p4 or p5,
779 such that it won't pass to the asm volatile below a
780 register that is shared with any other variable. That's
781 because we modify p4 and p5 there, but we can't mark them
782 as read/write, otherwise we'd overflow the 10-asm-operands
783 limit of GCC < 3.1. */
784 asm("" : "+r" (p4), "+r" (p5));
785
786 asm volatile(
787#undef BLOCK
788#define BLOCK(i) \
789 PF1(i) \
790 PF1(i + 2) \
791 LD(i,0) \
792 LD(i + 1, 1) \
793 LD(i + 2, 2) \
794 LD(i + 3, 3) \
795 PF2(i) \
796 PF2(i + 2) \
797 XO1(i,0) \
798 XO1(i + 1, 1) \
799 XO1(i + 2, 2) \
800 XO1(i + 3, 3) \
801 PF3(i) \
802 PF3(i + 2) \
803 XO2(i,0) \
804 XO2(i + 1, 1) \
805 XO2(i + 2, 2) \
806 XO2(i + 3, 3) \
807 PF4(i) \
808 PF4(i + 2) \
809 PF0(i + 4) \
810 PF0(i + 6) \
811 XO3(i,0) \
812 XO3(i + 1, 1) \
813 XO3(i + 2, 2) \
814 XO3(i + 3, 3) \
815 XO4(i,0) \
816 XO4(i + 1, 1) \
817 XO4(i + 2, 2) \
818 XO4(i + 3, 3) \
819 ST(i,0) \
820 ST(i + 1, 1) \
821 ST(i + 2, 2) \
822 ST(i + 3, 3) \
823
824
825 PF0(0)
826 PF0(2)
827
828 " .align 32 ;\n"
829 " 1: ;\n"
830
831 BLOCK(0)
832 BLOCK(4)
833 BLOCK(8)
834 BLOCK(12)
835
836 " addl $256, %1 ;\n"
837 " addl $256, %2 ;\n"
838 " addl $256, %3 ;\n"
839 " addl $256, %4 ;\n"
840 " addl $256, %5 ;\n"
841 " decl %0 ;\n"
842 " jnz 1b ;\n"
843 : "+r" (lines),
844 "+r" (p1), "+r" (p2), "+r" (p3)
845 : "r" (p4), "r" (p5)
846 : "memory");
847
848 /* p4 and p5 were modified, and now the variables are dead.
849 Clobber them just to be sure nobody does something stupid
850 like assuming they have some legal value. */
851 asm("" : "=r" (p4), "=r" (p5));
852
853 XMMS_RESTORE;
854}
855
856static struct xor_block_template xor_block_pIII_sse = {
857 .name = "pIII_sse",
858 .do_2 = xor_sse_2,
859 .do_3 = xor_sse_3,
860 .do_4 = xor_sse_4,
861 .do_5 = xor_sse_5,
862};
863
864/* Also try the generic routines. */
865#include <asm-generic/xor.h>
866
867#undef XOR_TRY_TEMPLATES
868#define XOR_TRY_TEMPLATES \
869do { \
870 xor_speed(&xor_block_8regs); \
871 xor_speed(&xor_block_8regs_p); \
872 xor_speed(&xor_block_32regs); \
873 xor_speed(&xor_block_32regs_p); \
874 if (cpu_has_xmm) \
875 xor_speed(&xor_block_pIII_sse); \
876 if (cpu_has_mmx) { \
877 xor_speed(&xor_block_pII_mmx); \
878 xor_speed(&xor_block_p5_mmx); \
879 } \
880} while (0)
881
882/* We force the use of the SSE xor block because it can write around L2.
883 We may also be able to load into the L1 only depending on how the cpu
884 deals with a load to a line that is being prefetched. */
885#define XOR_SELECT_TEMPLATE(FASTEST) \
886 (cpu_has_xmm ? &xor_block_pIII_sse : FASTEST)
887
888#endif /* ASM_X86__XOR_32_H */
diff --git a/include/asm-x86/xor_64.h b/include/asm-x86/xor_64.h
deleted file mode 100644
index 2d3a18de295b..000000000000
--- a/include/asm-x86/xor_64.h
+++ /dev/null
@@ -1,361 +0,0 @@
1#ifndef ASM_X86__XOR_64_H
2#define ASM_X86__XOR_64_H
3
4/*
5 * Optimized RAID-5 checksumming functions for MMX and SSE.
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, or (at your option)
10 * any later version.
11 *
12 * You should have received a copy of the GNU General Public License
13 * (for example /usr/src/linux/COPYING); if not, write to the Free
14 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15 */
16
17
18/*
19 * Cache avoiding checksumming functions utilizing KNI instructions
20 * Copyright (C) 1999 Zach Brown (with obvious credit due Ingo)
21 */
22
23/*
24 * Based on
25 * High-speed RAID5 checksumming functions utilizing SSE instructions.
26 * Copyright (C) 1998 Ingo Molnar.
27 */
28
29/*
30 * x86-64 changes / gcc fixes from Andi Kleen.
31 * Copyright 2002 Andi Kleen, SuSE Labs.
32 *
33 * This hasn't been optimized for the hammer yet, but there are likely
34 * no advantages to be gotten from x86-64 here anyways.
35 */
36
37typedef struct {
38 unsigned long a, b;
39} __attribute__((aligned(16))) xmm_store_t;
40
41/* Doesn't use gcc to save the XMM registers, because there is no easy way to
42 tell it to do a clts before the register saving. */
43#define XMMS_SAVE \
44do { \
45 preempt_disable(); \
46 asm volatile( \
47 "movq %%cr0,%0 ;\n\t" \
48 "clts ;\n\t" \
49 "movups %%xmm0,(%1) ;\n\t" \
50 "movups %%xmm1,0x10(%1) ;\n\t" \
51 "movups %%xmm2,0x20(%1) ;\n\t" \
52 "movups %%xmm3,0x30(%1) ;\n\t" \
53 : "=&r" (cr0) \
54 : "r" (xmm_save) \
55 : "memory"); \
56} while (0)
57
58#define XMMS_RESTORE \
59do { \
60 asm volatile( \
61 "sfence ;\n\t" \
62 "movups (%1),%%xmm0 ;\n\t" \
63 "movups 0x10(%1),%%xmm1 ;\n\t" \
64 "movups 0x20(%1),%%xmm2 ;\n\t" \
65 "movups 0x30(%1),%%xmm3 ;\n\t" \
66 "movq %0,%%cr0 ;\n\t" \
67 : \
68 : "r" (cr0), "r" (xmm_save) \
69 : "memory"); \
70 preempt_enable(); \
71} while (0)
72
73#define OFFS(x) "16*("#x")"
74#define PF_OFFS(x) "256+16*("#x")"
75#define PF0(x) " prefetchnta "PF_OFFS(x)"(%[p1]) ;\n"
76#define LD(x, y) " movaps "OFFS(x)"(%[p1]), %%xmm"#y" ;\n"
77#define ST(x, y) " movaps %%xmm"#y", "OFFS(x)"(%[p1]) ;\n"
78#define PF1(x) " prefetchnta "PF_OFFS(x)"(%[p2]) ;\n"
79#define PF2(x) " prefetchnta "PF_OFFS(x)"(%[p3]) ;\n"
80#define PF3(x) " prefetchnta "PF_OFFS(x)"(%[p4]) ;\n"
81#define PF4(x) " prefetchnta "PF_OFFS(x)"(%[p5]) ;\n"
82#define PF5(x) " prefetchnta "PF_OFFS(x)"(%[p6]) ;\n"
83#define XO1(x, y) " xorps "OFFS(x)"(%[p2]), %%xmm"#y" ;\n"
84#define XO2(x, y) " xorps "OFFS(x)"(%[p3]), %%xmm"#y" ;\n"
85#define XO3(x, y) " xorps "OFFS(x)"(%[p4]), %%xmm"#y" ;\n"
86#define XO4(x, y) " xorps "OFFS(x)"(%[p5]), %%xmm"#y" ;\n"
87#define XO5(x, y) " xorps "OFFS(x)"(%[p6]), %%xmm"#y" ;\n"
88
89
90static void
91xor_sse_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
92{
93 unsigned int lines = bytes >> 8;
94 unsigned long cr0;
95 xmm_store_t xmm_save[4];
96
97 XMMS_SAVE;
98
99 asm volatile(
100#undef BLOCK
101#define BLOCK(i) \
102 LD(i, 0) \
103 LD(i + 1, 1) \
104 PF1(i) \
105 PF1(i + 2) \
106 LD(i + 2, 2) \
107 LD(i + 3, 3) \
108 PF0(i + 4) \
109 PF0(i + 6) \
110 XO1(i, 0) \
111 XO1(i + 1, 1) \
112 XO1(i + 2, 2) \
113 XO1(i + 3, 3) \
114 ST(i, 0) \
115 ST(i + 1, 1) \
116 ST(i + 2, 2) \
117 ST(i + 3, 3) \
118
119
120 PF0(0)
121 PF0(2)
122
123 " .align 32 ;\n"
124 " 1: ;\n"
125
126 BLOCK(0)
127 BLOCK(4)
128 BLOCK(8)
129 BLOCK(12)
130
131 " addq %[inc], %[p1] ;\n"
132 " addq %[inc], %[p2] ;\n"
133 " decl %[cnt] ; jnz 1b"
134 : [p1] "+r" (p1), [p2] "+r" (p2), [cnt] "+r" (lines)
135 : [inc] "r" (256UL)
136 : "memory");
137
138 XMMS_RESTORE;
139}
140
141static void
142xor_sse_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
143 unsigned long *p3)
144{
145 unsigned int lines = bytes >> 8;
146 xmm_store_t xmm_save[4];
147 unsigned long cr0;
148
149 XMMS_SAVE;
150
151 asm volatile(
152#undef BLOCK
153#define BLOCK(i) \
154 PF1(i) \
155 PF1(i + 2) \
156 LD(i, 0) \
157 LD(i + 1, 1) \
158 LD(i + 2, 2) \
159 LD(i + 3, 3) \
160 PF2(i) \
161 PF2(i + 2) \
162 PF0(i + 4) \
163 PF0(i + 6) \
164 XO1(i, 0) \
165 XO1(i + 1, 1) \
166 XO1(i + 2, 2) \
167 XO1(i + 3, 3) \
168 XO2(i, 0) \
169 XO2(i + 1, 1) \
170 XO2(i + 2, 2) \
171 XO2(i + 3, 3) \
172 ST(i, 0) \
173 ST(i + 1, 1) \
174 ST(i + 2, 2) \
175 ST(i + 3, 3) \
176
177
178 PF0(0)
179 PF0(2)
180
181 " .align 32 ;\n"
182 " 1: ;\n"
183
184 BLOCK(0)
185 BLOCK(4)
186 BLOCK(8)
187 BLOCK(12)
188
189 " addq %[inc], %[p1] ;\n"
190 " addq %[inc], %[p2] ;\n"
191 " addq %[inc], %[p3] ;\n"
192 " decl %[cnt] ; jnz 1b"
193 : [cnt] "+r" (lines),
194 [p1] "+r" (p1), [p2] "+r" (p2), [p3] "+r" (p3)
195 : [inc] "r" (256UL)
196 : "memory");
197 XMMS_RESTORE;
198}
199
200static void
201xor_sse_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
202 unsigned long *p3, unsigned long *p4)
203{
204 unsigned int lines = bytes >> 8;
205 xmm_store_t xmm_save[4];
206 unsigned long cr0;
207
208 XMMS_SAVE;
209
210 asm volatile(
211#undef BLOCK
212#define BLOCK(i) \
213 PF1(i) \
214 PF1(i + 2) \
215 LD(i, 0) \
216 LD(i + 1, 1) \
217 LD(i + 2, 2) \
218 LD(i + 3, 3) \
219 PF2(i) \
220 PF2(i + 2) \
221 XO1(i, 0) \
222 XO1(i + 1, 1) \
223 XO1(i + 2, 2) \
224 XO1(i + 3, 3) \
225 PF3(i) \
226 PF3(i + 2) \
227 PF0(i + 4) \
228 PF0(i + 6) \
229 XO2(i, 0) \
230 XO2(i + 1, 1) \
231 XO2(i + 2, 2) \
232 XO2(i + 3, 3) \
233 XO3(i, 0) \
234 XO3(i + 1, 1) \
235 XO3(i + 2, 2) \
236 XO3(i + 3, 3) \
237 ST(i, 0) \
238 ST(i + 1, 1) \
239 ST(i + 2, 2) \
240 ST(i + 3, 3) \
241
242
243 PF0(0)
244 PF0(2)
245
246 " .align 32 ;\n"
247 " 1: ;\n"
248
249 BLOCK(0)
250 BLOCK(4)
251 BLOCK(8)
252 BLOCK(12)
253
254 " addq %[inc], %[p1] ;\n"
255 " addq %[inc], %[p2] ;\n"
256 " addq %[inc], %[p3] ;\n"
257 " addq %[inc], %[p4] ;\n"
258 " decl %[cnt] ; jnz 1b"
259 : [cnt] "+c" (lines),
260 [p1] "+r" (p1), [p2] "+r" (p2), [p3] "+r" (p3), [p4] "+r" (p4)
261 : [inc] "r" (256UL)
262 : "memory" );
263
264 XMMS_RESTORE;
265}
266
267static void
268xor_sse_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
269 unsigned long *p3, unsigned long *p4, unsigned long *p5)
270{
271 unsigned int lines = bytes >> 8;
272 xmm_store_t xmm_save[4];
273 unsigned long cr0;
274
275 XMMS_SAVE;
276
277 asm volatile(
278#undef BLOCK
279#define BLOCK(i) \
280 PF1(i) \
281 PF1(i + 2) \
282 LD(i, 0) \
283 LD(i + 1, 1) \
284 LD(i + 2, 2) \
285 LD(i + 3, 3) \
286 PF2(i) \
287 PF2(i + 2) \
288 XO1(i, 0) \
289 XO1(i + 1, 1) \
290 XO1(i + 2, 2) \
291 XO1(i + 3, 3) \
292 PF3(i) \
293 PF3(i + 2) \
294 XO2(i, 0) \
295 XO2(i + 1, 1) \
296 XO2(i + 2, 2) \
297 XO2(i + 3, 3) \
298 PF4(i) \
299 PF4(i + 2) \
300 PF0(i + 4) \
301 PF0(i + 6) \
302 XO3(i, 0) \
303 XO3(i + 1, 1) \
304 XO3(i + 2, 2) \
305 XO3(i + 3, 3) \
306 XO4(i, 0) \
307 XO4(i + 1, 1) \
308 XO4(i + 2, 2) \
309 XO4(i + 3, 3) \
310 ST(i, 0) \
311 ST(i + 1, 1) \
312 ST(i + 2, 2) \
313 ST(i + 3, 3) \
314
315
316 PF0(0)
317 PF0(2)
318
319 " .align 32 ;\n"
320 " 1: ;\n"
321
322 BLOCK(0)
323 BLOCK(4)
324 BLOCK(8)
325 BLOCK(12)
326
327 " addq %[inc], %[p1] ;\n"
328 " addq %[inc], %[p2] ;\n"
329 " addq %[inc], %[p3] ;\n"
330 " addq %[inc], %[p4] ;\n"
331 " addq %[inc], %[p5] ;\n"
332 " decl %[cnt] ; jnz 1b"
333 : [cnt] "+c" (lines),
334 [p1] "+r" (p1), [p2] "+r" (p2), [p3] "+r" (p3), [p4] "+r" (p4),
335 [p5] "+r" (p5)
336 : [inc] "r" (256UL)
337 : "memory");
338
339 XMMS_RESTORE;
340}
341
342static struct xor_block_template xor_block_sse = {
343 .name = "generic_sse",
344 .do_2 = xor_sse_2,
345 .do_3 = xor_sse_3,
346 .do_4 = xor_sse_4,
347 .do_5 = xor_sse_5,
348};
349
350#undef XOR_TRY_TEMPLATES
351#define XOR_TRY_TEMPLATES \
352do { \
353 xor_speed(&xor_block_sse); \
354} while (0)
355
356/* We force the use of the SSE xor block because it can write around L2.
357 We may also be able to load into the L1 only depending on how the cpu
358 deals with a load to a line that is being prefetched. */
359#define XOR_SELECT_TEMPLATE(FASTEST) (&xor_block_sse)
360
361#endif /* ASM_X86__XOR_64_H */
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h
deleted file mode 100644
index fdf13702924a..000000000000
--- a/include/asm-xtensa/a.out.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * include/asm-xtensa/a.out.h
3 *
4 * Dummy a.out file. Xtensa does not support the a.out format, but the kernel
5 * seems to depend on it.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (C) 2001 - 2005 Tensilica Inc.
12 */
13
14#ifndef _XTENSA_A_OUT_H
15#define _XTENSA_A_OUT_H
16
17struct exec
18{
19 unsigned long a_info;
20 unsigned a_text;
21 unsigned a_data;
22 unsigned a_bss;
23 unsigned a_syms;
24 unsigned a_entry;
25 unsigned a_trsize;
26 unsigned a_drsize;
27};
28
29#endif /* _XTENSA_A_OUT_H */
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index ca6e5101a2cb..c3f53e755ca5 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -189,7 +189,7 @@ typedef struct {
189#endif 189#endif
190} elf_xtregs_t; 190} elf_xtregs_t;
191 191
192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex) set_personality(PER_LINUX_32BIT)
193 193
194struct task_struct; 194struct task_struct;
195 195
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h
index 47c3616ea9ac..07b7299dab20 100644
--- a/include/asm-xtensa/io.h
+++ b/include/asm-xtensa/io.h
@@ -18,10 +18,12 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20 20
21#define XCHAL_KIO_CACHED_VADDR 0xf0000000 21#define XCHAL_KIO_CACHED_VADDR 0xe0000000
22#define XCHAL_KIO_BYPASS_VADDR 0xf8000000 22#define XCHAL_KIO_BYPASS_VADDR 0xf0000000
23#define XCHAL_KIO_PADDR 0xf0000000 23#define XCHAL_KIO_PADDR 0xf0000000
24#define XCHAL_KIO_SIZE 0x08000000 24#define XCHAL_KIO_SIZE 0x10000000
25
26#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
25 27
26/* 28/*
27 * swap functions to change byte order from little-endian to big-endian and 29 * swap functions to change byte order from little-endian to big-endian and
diff --git a/include/asm-xtensa/rwsem.h b/include/asm-xtensa/rwsem.h
index 0aad3a587551..e39edf5c86f2 100644
--- a/include/asm-xtensa/rwsem.h
+++ b/include/asm-xtensa/rwsem.h
@@ -13,6 +13,10 @@
13#ifndef _XTENSA_RWSEM_H 13#ifndef _XTENSA_RWSEM_H
14#define _XTENSA_RWSEM_H 14#define _XTENSA_RWSEM_H
15 15
16#ifndef _LINUX_RWSEM_H
17#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
18#endif
19
16#include <linux/list.h> 20#include <linux/list.h>
17#include <linux/spinlock.h> 21#include <linux/spinlock.h>
18#include <asm/atomic.h> 22#include <asm/atomic.h>
diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h
index 7e4131dd546c..0f4fe1faf9ba 100644
--- a/include/asm-xtensa/thread_info.h
+++ b/include/asm-xtensa/thread_info.h
@@ -134,6 +134,7 @@ static inline struct thread_info *current_thread_info(void)
134#define TIF_MEMDIE 5 134#define TIF_MEMDIE 5
135#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ 135#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
136#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 136#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
137#define TIF_FREEZE 17 /* is freezing for suspend */
137 138
138#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 139#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
139#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 140#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
@@ -142,6 +143,7 @@ static inline struct thread_info *current_thread_info(void)
142#define _TIF_IRET (1<<TIF_IRET) 143#define _TIF_IRET (1<<TIF_IRET)
143#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 144#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
144#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 145#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
146#define _TIF_FREEZE (1<<TIF_FREEZE)
145 147
146#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 148#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
147#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 149#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
diff --git a/include/asm-xtensa/variant-dc232b/core.h b/include/asm-xtensa/variant-dc232b/core.h
new file mode 100644
index 000000000000..525bd3d90154
--- /dev/null
+++ b/include/asm-xtensa/variant-dc232b/core.h
@@ -0,0 +1,424 @@
1/*
2 * Xtensa processor core configuration information.
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) 1999-2007 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_CORE_CONFIGURATION_H
12#define _XTENSA_CORE_CONFIGURATION_H
13
14
15/****************************************************************************
16 Parameters Useful for Any Code, USER or PRIVILEGED
17 ****************************************************************************/
18
19/*
20 * Note: Macros of the form XCHAL_HAVE_*** have a value of 1 if the option is
21 * configured, and a value of 0 otherwise. These macros are always defined.
22 */
23
24
25/*----------------------------------------------------------------------
26 ISA
27 ----------------------------------------------------------------------*/
28
29#define XCHAL_HAVE_BE 0 /* big-endian byte ordering */
30#define XCHAL_HAVE_WINDOWED 1 /* windowed registers option */
31#define XCHAL_NUM_AREGS 32 /* num of physical addr regs */
32#define XCHAL_NUM_AREGS_LOG2 5 /* log2(XCHAL_NUM_AREGS) */
33#define XCHAL_MAX_INSTRUCTION_SIZE 3 /* max instr bytes (3..8) */
34#define XCHAL_HAVE_DEBUG 1 /* debug option */
35#define XCHAL_HAVE_DENSITY 1 /* 16-bit instructions */
36#define XCHAL_HAVE_LOOPS 1 /* zero-overhead loops */
37#define XCHAL_HAVE_NSA 1 /* NSA/NSAU instructions */
38#define XCHAL_HAVE_MINMAX 1 /* MIN/MAX instructions */
39#define XCHAL_HAVE_SEXT 1 /* SEXT instruction */
40#define XCHAL_HAVE_CLAMPS 1 /* CLAMPS instruction */
41#define XCHAL_HAVE_MUL16 1 /* MUL16S/MUL16U instructions */
42#define XCHAL_HAVE_MUL32 1 /* MULL instruction */
43#define XCHAL_HAVE_MUL32_HIGH 0 /* MULUH/MULSH instructions */
44#define XCHAL_HAVE_DIV32 1 /* QUOS/QUOU/REMS/REMU instructions */
45#define XCHAL_HAVE_L32R 1 /* L32R instruction */
46#define XCHAL_HAVE_ABSOLUTE_LITERALS 1 /* non-PC-rel (extended) L32R */
47#define XCHAL_HAVE_CONST16 0 /* CONST16 instruction */
48#define XCHAL_HAVE_ADDX 1 /* ADDX#/SUBX# instructions */
49#define XCHAL_HAVE_WIDE_BRANCHES 0 /* B*.W18 or B*.W15 instr's */
50#define XCHAL_HAVE_PREDICTED_BRANCHES 0 /* B[EQ/EQZ/NE/NEZ]T instr's */
51#define XCHAL_HAVE_CALL4AND12 1 /* (obsolete option) */
52#define XCHAL_HAVE_ABS 1 /* ABS instruction */
53/*#define XCHAL_HAVE_POPC 0*/ /* POPC instruction */
54/*#define XCHAL_HAVE_CRC 0*/ /* CRC instruction */
55#define XCHAL_HAVE_RELEASE_SYNC 1 /* L32AI/S32RI instructions */
56#define XCHAL_HAVE_S32C1I 1 /* S32C1I instruction */
57#define XCHAL_HAVE_SPECULATION 0 /* speculation */
58#define XCHAL_HAVE_FULL_RESET 1 /* all regs/state reset */
59#define XCHAL_NUM_CONTEXTS 1 /* */
60#define XCHAL_NUM_MISC_REGS 2 /* num of scratch regs (0..4) */
61#define XCHAL_HAVE_TAP_MASTER 0 /* JTAG TAP control instr's */
62#define XCHAL_HAVE_PRID 1 /* processor ID register */
63#define XCHAL_HAVE_THREADPTR 1 /* THREADPTR register */
64#define XCHAL_HAVE_BOOLEANS 0 /* boolean registers */
65#define XCHAL_HAVE_CP 1 /* CPENABLE reg (coprocessor) */
66#define XCHAL_CP_MAXCFG 8 /* max allowed cp id plus one */
67#define XCHAL_HAVE_MAC16 1 /* MAC16 package */
68#define XCHAL_HAVE_VECTORFPU2005 0 /* vector floating-point pkg */
69#define XCHAL_HAVE_FP 0 /* floating point pkg */
70#define XCHAL_HAVE_VECTRA1 0 /* Vectra I pkg */
71#define XCHAL_HAVE_VECTRALX 0 /* Vectra LX pkg */
72#define XCHAL_HAVE_HIFI2 0 /* HiFi2 Audio Engine pkg */
73
74
75/*----------------------------------------------------------------------
76 MISC
77 ----------------------------------------------------------------------*/
78
79#define XCHAL_NUM_WRITEBUFFER_ENTRIES 8 /* size of write buffer */
80#define XCHAL_INST_FETCH_WIDTH 4 /* instr-fetch width in bytes */
81#define XCHAL_DATA_WIDTH 4 /* data width in bytes */
82/* In T1050, applies to selected core load and store instructions (see ISA): */
83#define XCHAL_UNALIGNED_LOAD_EXCEPTION 1 /* unaligned loads cause exc. */
84#define XCHAL_UNALIGNED_STORE_EXCEPTION 1 /* unaligned stores cause exc.*/
85
86#define XCHAL_SW_VERSION 701001 /* sw version of this header */
87
88#define XCHAL_CORE_ID "dc232b" /* alphanum core name
89 (CoreID) set in the Xtensa
90 Processor Generator */
91
92#define XCHAL_CORE_DESCRIPTION "Diamond 232L Standard Core Rev.B (LE)"
93#define XCHAL_BUILD_UNIQUE_ID 0x0000BEEF /* 22-bit sw build ID */
94
95/*
96 * These definitions describe the hardware targeted by this software.
97 */
98#define XCHAL_HW_CONFIGID0 0xC56307FE /* ConfigID hi 32 bits*/
99#define XCHAL_HW_CONFIGID1 0x0D40BEEF /* ConfigID lo 32 bits*/
100#define XCHAL_HW_VERSION_NAME "LX2.1.1" /* full version name */
101#define XCHAL_HW_VERSION_MAJOR 2210 /* major ver# of targeted hw */
102#define XCHAL_HW_VERSION_MINOR 1 /* minor ver# of targeted hw */
103#define XCHAL_HW_VERSION 221001 /* major*100+minor */
104#define XCHAL_HW_REL_LX2 1
105#define XCHAL_HW_REL_LX2_1 1
106#define XCHAL_HW_REL_LX2_1_1 1
107#define XCHAL_HW_CONFIGID_RELIABLE 1
108/* If software targets a *range* of hardware versions, these are the bounds: */
109#define XCHAL_HW_MIN_VERSION_MAJOR 2210 /* major v of earliest tgt hw */
110#define XCHAL_HW_MIN_VERSION_MINOR 1 /* minor v of earliest tgt hw */
111#define XCHAL_HW_MIN_VERSION 221001 /* earliest targeted hw */
112#define XCHAL_HW_MAX_VERSION_MAJOR 2210 /* major v of latest tgt hw */
113#define XCHAL_HW_MAX_VERSION_MINOR 1 /* minor v of latest tgt hw */
114#define XCHAL_HW_MAX_VERSION 221001 /* latest targeted hw */
115
116
117/*----------------------------------------------------------------------
118 CACHE
119 ----------------------------------------------------------------------*/
120
121#define XCHAL_ICACHE_LINESIZE 32 /* I-cache line size in bytes */
122#define XCHAL_DCACHE_LINESIZE 32 /* D-cache line size in bytes */
123#define XCHAL_ICACHE_LINEWIDTH 5 /* log2(I line size in bytes) */
124#define XCHAL_DCACHE_LINEWIDTH 5 /* log2(D line size in bytes) */
125
126#define XCHAL_ICACHE_SIZE 16384 /* I-cache size in bytes or 0 */
127#define XCHAL_DCACHE_SIZE 16384 /* D-cache size in bytes or 0 */
128
129#define XCHAL_DCACHE_IS_WRITEBACK 1 /* writeback feature */
130
131
132
133
134/****************************************************************************
135 Parameters Useful for PRIVILEGED (Supervisory or Non-Virtualized) Code
136 ****************************************************************************/
137
138
139#ifndef XTENSA_HAL_NON_PRIVILEGED_ONLY
140
141/*----------------------------------------------------------------------
142 CACHE
143 ----------------------------------------------------------------------*/
144
145#define XCHAL_HAVE_PIF 1 /* any outbound PIF present */
146
147/* If present, cache size in bytes == (ways * 2^(linewidth + setwidth)). */
148
149/* Number of cache sets in log2(lines per way): */
150#define XCHAL_ICACHE_SETWIDTH 7
151#define XCHAL_DCACHE_SETWIDTH 7
152
153/* Cache set associativity (number of ways): */
154#define XCHAL_ICACHE_WAYS 4
155#define XCHAL_DCACHE_WAYS 4
156
157/* Cache features: */
158#define XCHAL_ICACHE_LINE_LOCKABLE 1
159#define XCHAL_DCACHE_LINE_LOCKABLE 1
160#define XCHAL_ICACHE_ECC_PARITY 0
161#define XCHAL_DCACHE_ECC_PARITY 0
162
163/* Number of encoded cache attr bits (see <xtensa/hal.h> for decoded bits): */
164#define XCHAL_CA_BITS 4
165
166
167/*----------------------------------------------------------------------
168 INTERNAL I/D RAM/ROMs and XLMI
169 ----------------------------------------------------------------------*/
170
171#define XCHAL_NUM_INSTROM 0 /* number of core instr. ROMs */
172#define XCHAL_NUM_INSTRAM 0 /* number of core instr. RAMs */
173#define XCHAL_NUM_DATAROM 0 /* number of core data ROMs */
174#define XCHAL_NUM_DATARAM 0 /* number of core data RAMs */
175#define XCHAL_NUM_URAM 0 /* number of core unified RAMs*/
176#define XCHAL_NUM_XLMI 0 /* number of core XLMI ports */
177
178
179/*----------------------------------------------------------------------
180 INTERRUPTS and TIMERS
181 ----------------------------------------------------------------------*/
182
183#define XCHAL_HAVE_INTERRUPTS 1 /* interrupt option */
184#define XCHAL_HAVE_HIGHPRI_INTERRUPTS 1 /* med/high-pri. interrupts */
185#define XCHAL_HAVE_NMI 1 /* non-maskable interrupt */
186#define XCHAL_HAVE_CCOUNT 1 /* CCOUNT reg. (timer option) */
187#define XCHAL_NUM_TIMERS 3 /* number of CCOMPAREn regs */
188#define XCHAL_NUM_INTERRUPTS 22 /* number of interrupts */
189#define XCHAL_NUM_INTERRUPTS_LOG2 5 /* ceil(log2(NUM_INTERRUPTS)) */
190#define XCHAL_NUM_EXTINTERRUPTS 17 /* num of external interrupts */
191#define XCHAL_NUM_INTLEVELS 6 /* number of interrupt levels
192 (not including level zero) */
193#define XCHAL_EXCM_LEVEL 3 /* level masked by PS.EXCM */
194 /* (always 1 in XEA1; levels 2 .. EXCM_LEVEL are "medium priority") */
195
196/* Masks of interrupts at each interrupt level: */
197#define XCHAL_INTLEVEL1_MASK 0x001F80FF
198#define XCHAL_INTLEVEL2_MASK 0x00000100
199#define XCHAL_INTLEVEL3_MASK 0x00200E00
200#define XCHAL_INTLEVEL4_MASK 0x00001000
201#define XCHAL_INTLEVEL5_MASK 0x00002000
202#define XCHAL_INTLEVEL6_MASK 0x00000000
203#define XCHAL_INTLEVEL7_MASK 0x00004000
204
205/* Masks of interrupts at each range 1..n of interrupt levels: */
206#define XCHAL_INTLEVEL1_ANDBELOW_MASK 0x001F80FF
207#define XCHAL_INTLEVEL2_ANDBELOW_MASK 0x001F81FF
208#define XCHAL_INTLEVEL3_ANDBELOW_MASK 0x003F8FFF
209#define XCHAL_INTLEVEL4_ANDBELOW_MASK 0x003F9FFF
210#define XCHAL_INTLEVEL5_ANDBELOW_MASK 0x003FBFFF
211#define XCHAL_INTLEVEL6_ANDBELOW_MASK 0x003FBFFF
212#define XCHAL_INTLEVEL7_ANDBELOW_MASK 0x003FFFFF
213
214/* Level of each interrupt: */
215#define XCHAL_INT0_LEVEL 1
216#define XCHAL_INT1_LEVEL 1
217#define XCHAL_INT2_LEVEL 1
218#define XCHAL_INT3_LEVEL 1
219#define XCHAL_INT4_LEVEL 1
220#define XCHAL_INT5_LEVEL 1
221#define XCHAL_INT6_LEVEL 1
222#define XCHAL_INT7_LEVEL 1
223#define XCHAL_INT8_LEVEL 2
224#define XCHAL_INT9_LEVEL 3
225#define XCHAL_INT10_LEVEL 3
226#define XCHAL_INT11_LEVEL 3
227#define XCHAL_INT12_LEVEL 4
228#define XCHAL_INT13_LEVEL 5
229#define XCHAL_INT14_LEVEL 7
230#define XCHAL_INT15_LEVEL 1
231#define XCHAL_INT16_LEVEL 1
232#define XCHAL_INT17_LEVEL 1
233#define XCHAL_INT18_LEVEL 1
234#define XCHAL_INT19_LEVEL 1
235#define XCHAL_INT20_LEVEL 1
236#define XCHAL_INT21_LEVEL 3
237#define XCHAL_DEBUGLEVEL 6 /* debug interrupt level */
238#define XCHAL_HAVE_DEBUG_EXTERN_INT 1 /* OCD external db interrupt */
239#define XCHAL_NMILEVEL 7 /* NMI "level" (for use with
240 EXCSAVE/EPS/EPC_n, RFI n) */
241
242/* Type of each interrupt: */
243#define XCHAL_INT0_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
244#define XCHAL_INT1_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
245#define XCHAL_INT2_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
246#define XCHAL_INT3_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
247#define XCHAL_INT4_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
248#define XCHAL_INT5_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
249#define XCHAL_INT6_TYPE XTHAL_INTTYPE_TIMER
250#define XCHAL_INT7_TYPE XTHAL_INTTYPE_SOFTWARE
251#define XCHAL_INT8_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
252#define XCHAL_INT9_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
253#define XCHAL_INT10_TYPE XTHAL_INTTYPE_TIMER
254#define XCHAL_INT11_TYPE XTHAL_INTTYPE_SOFTWARE
255#define XCHAL_INT12_TYPE XTHAL_INTTYPE_EXTERN_LEVEL
256#define XCHAL_INT13_TYPE XTHAL_INTTYPE_TIMER
257#define XCHAL_INT14_TYPE XTHAL_INTTYPE_NMI
258#define XCHAL_INT15_TYPE XTHAL_INTTYPE_EXTERN_EDGE
259#define XCHAL_INT16_TYPE XTHAL_INTTYPE_EXTERN_EDGE
260#define XCHAL_INT17_TYPE XTHAL_INTTYPE_EXTERN_EDGE
261#define XCHAL_INT18_TYPE XTHAL_INTTYPE_EXTERN_EDGE
262#define XCHAL_INT19_TYPE XTHAL_INTTYPE_EXTERN_EDGE
263#define XCHAL_INT20_TYPE XTHAL_INTTYPE_EXTERN_EDGE
264#define XCHAL_INT21_TYPE XTHAL_INTTYPE_EXTERN_EDGE
265
266/* Masks of interrupts for each type of interrupt: */
267#define XCHAL_INTTYPE_MASK_UNCONFIGURED 0xFFC00000
268#define XCHAL_INTTYPE_MASK_SOFTWARE 0x00000880
269#define XCHAL_INTTYPE_MASK_EXTERN_EDGE 0x003F8000
270#define XCHAL_INTTYPE_MASK_EXTERN_LEVEL 0x0000133F
271#define XCHAL_INTTYPE_MASK_TIMER 0x00002440
272#define XCHAL_INTTYPE_MASK_NMI 0x00004000
273#define XCHAL_INTTYPE_MASK_WRITE_ERROR 0x00000000
274
275/* Interrupt numbers assigned to specific interrupt sources: */
276#define XCHAL_TIMER0_INTERRUPT 6 /* CCOMPARE0 */
277#define XCHAL_TIMER1_INTERRUPT 10 /* CCOMPARE1 */
278#define XCHAL_TIMER2_INTERRUPT 13 /* CCOMPARE2 */
279#define XCHAL_TIMER3_INTERRUPT XTHAL_TIMER_UNCONFIGURED
280#define XCHAL_NMI_INTERRUPT 14 /* non-maskable interrupt */
281
282/* Interrupt numbers for levels at which only one interrupt is configured: */
283#define XCHAL_INTLEVEL2_NUM 8
284#define XCHAL_INTLEVEL4_NUM 12
285#define XCHAL_INTLEVEL5_NUM 13
286#define XCHAL_INTLEVEL7_NUM 14
287/* (There are many interrupts each at level(s) 1, 3.) */
288
289
290/*
291 * External interrupt vectors/levels.
292 * These macros describe how Xtensa processor interrupt numbers
293 * (as numbered internally, eg. in INTERRUPT and INTENABLE registers)
294 * map to external BInterrupt<n> pins, for those interrupts
295 * configured as external (level-triggered, edge-triggered, or NMI).
296 * See the Xtensa processor databook for more details.
297 */
298
299/* Core interrupt numbers mapped to each EXTERNAL interrupt number: */
300#define XCHAL_EXTINT0_NUM 0 /* (intlevel 1) */
301#define XCHAL_EXTINT1_NUM 1 /* (intlevel 1) */
302#define XCHAL_EXTINT2_NUM 2 /* (intlevel 1) */
303#define XCHAL_EXTINT3_NUM 3 /* (intlevel 1) */
304#define XCHAL_EXTINT4_NUM 4 /* (intlevel 1) */
305#define XCHAL_EXTINT5_NUM 5 /* (intlevel 1) */
306#define XCHAL_EXTINT6_NUM 8 /* (intlevel 2) */
307#define XCHAL_EXTINT7_NUM 9 /* (intlevel 3) */
308#define XCHAL_EXTINT8_NUM 12 /* (intlevel 4) */
309#define XCHAL_EXTINT9_NUM 14 /* (intlevel 7) */
310#define XCHAL_EXTINT10_NUM 15 /* (intlevel 1) */
311#define XCHAL_EXTINT11_NUM 16 /* (intlevel 1) */
312#define XCHAL_EXTINT12_NUM 17 /* (intlevel 1) */
313#define XCHAL_EXTINT13_NUM 18 /* (intlevel 1) */
314#define XCHAL_EXTINT14_NUM 19 /* (intlevel 1) */
315#define XCHAL_EXTINT15_NUM 20 /* (intlevel 1) */
316#define XCHAL_EXTINT16_NUM 21 /* (intlevel 3) */
317
318
319/*----------------------------------------------------------------------
320 EXCEPTIONS and VECTORS
321 ----------------------------------------------------------------------*/
322
323#define XCHAL_XEA_VERSION 2 /* Xtensa Exception Architecture
324 number: 1 == XEA1 (old)
325 2 == XEA2 (new)
326 0 == XEAX (extern) */
327#define XCHAL_HAVE_XEA1 0 /* Exception Architecture 1 */
328#define XCHAL_HAVE_XEA2 1 /* Exception Architecture 2 */
329#define XCHAL_HAVE_XEAX 0 /* External Exception Arch. */
330#define XCHAL_HAVE_EXCEPTIONS 1 /* exception option */
331#define XCHAL_HAVE_MEM_ECC_PARITY 0 /* local memory ECC/parity */
332#define XCHAL_HAVE_VECTOR_SELECT 1 /* relocatable vectors */
333#define XCHAL_HAVE_VECBASE 1 /* relocatable vectors */
334#define XCHAL_VECBASE_RESET_VADDR 0xD0000000 /* VECBASE reset value */
335#define XCHAL_VECBASE_RESET_PADDR 0x00000000
336#define XCHAL_RESET_VECBASE_OVERLAP 0
337
338#define XCHAL_RESET_VECTOR0_VADDR 0xFE000000
339#define XCHAL_RESET_VECTOR0_PADDR 0xFE000000
340#define XCHAL_RESET_VECTOR1_VADDR 0xD8000500
341#define XCHAL_RESET_VECTOR1_PADDR 0x00000500
342#define XCHAL_RESET_VECTOR_VADDR 0xFE000000
343#define XCHAL_RESET_VECTOR_PADDR 0xFE000000
344#define XCHAL_USER_VECOFS 0x00000340
345#define XCHAL_USER_VECTOR_VADDR 0xD0000340
346#define XCHAL_USER_VECTOR_PADDR 0x00000340
347#define XCHAL_KERNEL_VECOFS 0x00000300
348#define XCHAL_KERNEL_VECTOR_VADDR 0xD0000300
349#define XCHAL_KERNEL_VECTOR_PADDR 0x00000300
350#define XCHAL_DOUBLEEXC_VECOFS 0x000003C0
351#define XCHAL_DOUBLEEXC_VECTOR_VADDR 0xD00003C0
352#define XCHAL_DOUBLEEXC_VECTOR_PADDR 0x000003C0
353#define XCHAL_WINDOW_OF4_VECOFS 0x00000000
354#define XCHAL_WINDOW_UF4_VECOFS 0x00000040
355#define XCHAL_WINDOW_OF8_VECOFS 0x00000080
356#define XCHAL_WINDOW_UF8_VECOFS 0x000000C0
357#define XCHAL_WINDOW_OF12_VECOFS 0x00000100
358#define XCHAL_WINDOW_UF12_VECOFS 0x00000140
359#define XCHAL_WINDOW_VECTORS_VADDR 0xD0000000
360#define XCHAL_WINDOW_VECTORS_PADDR 0x00000000
361#define XCHAL_INTLEVEL2_VECOFS 0x00000180
362#define XCHAL_INTLEVEL2_VECTOR_VADDR 0xD0000180
363#define XCHAL_INTLEVEL2_VECTOR_PADDR 0x00000180
364#define XCHAL_INTLEVEL3_VECOFS 0x000001C0
365#define XCHAL_INTLEVEL3_VECTOR_VADDR 0xD00001C0
366#define XCHAL_INTLEVEL3_VECTOR_PADDR 0x000001C0
367#define XCHAL_INTLEVEL4_VECOFS 0x00000200
368#define XCHAL_INTLEVEL4_VECTOR_VADDR 0xD0000200
369#define XCHAL_INTLEVEL4_VECTOR_PADDR 0x00000200
370#define XCHAL_INTLEVEL5_VECOFS 0x00000240
371#define XCHAL_INTLEVEL5_VECTOR_VADDR 0xD0000240
372#define XCHAL_INTLEVEL5_VECTOR_PADDR 0x00000240
373#define XCHAL_INTLEVEL6_VECOFS 0x00000280
374#define XCHAL_INTLEVEL6_VECTOR_VADDR 0xD0000280
375#define XCHAL_INTLEVEL6_VECTOR_PADDR 0x00000280
376#define XCHAL_DEBUG_VECOFS XCHAL_INTLEVEL6_VECOFS
377#define XCHAL_DEBUG_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR
378#define XCHAL_DEBUG_VECTOR_PADDR XCHAL_INTLEVEL6_VECTOR_PADDR
379#define XCHAL_NMI_VECOFS 0x000002C0
380#define XCHAL_NMI_VECTOR_VADDR 0xD00002C0
381#define XCHAL_NMI_VECTOR_PADDR 0x000002C0
382#define XCHAL_INTLEVEL7_VECOFS XCHAL_NMI_VECOFS
383#define XCHAL_INTLEVEL7_VECTOR_VADDR XCHAL_NMI_VECTOR_VADDR
384#define XCHAL_INTLEVEL7_VECTOR_PADDR XCHAL_NMI_VECTOR_PADDR
385
386
387/*----------------------------------------------------------------------
388 DEBUG
389 ----------------------------------------------------------------------*/
390
391#define XCHAL_HAVE_OCD 1 /* OnChipDebug option */
392#define XCHAL_NUM_IBREAK 2 /* number of IBREAKn regs */
393#define XCHAL_NUM_DBREAK 2 /* number of DBREAKn regs */
394#define XCHAL_HAVE_OCD_DIR_ARRAY 1 /* faster OCD option */
395
396
397/*----------------------------------------------------------------------
398 MMU
399 ----------------------------------------------------------------------*/
400
401/* See core-matmap.h header file for more details. */
402
403#define XCHAL_HAVE_TLBS 1 /* inverse of HAVE_CACHEATTR */
404#define XCHAL_HAVE_SPANNING_WAY 0 /* one way maps I+D 4GB vaddr */
405#define XCHAL_HAVE_IDENTITY_MAP 0 /* vaddr == paddr always */
406#define XCHAL_HAVE_CACHEATTR 0 /* CACHEATTR register present */
407#define XCHAL_HAVE_MIMIC_CACHEATTR 0 /* region protection */
408#define XCHAL_HAVE_XLT_CACHEATTR 0 /* region prot. w/translation */
409#define XCHAL_HAVE_PTP_MMU 1 /* full MMU (with page table
410 [autorefill] and protection)
411 usable for an MMU-based OS */
412/* If none of the above last 4 are set, it's a custom TLB configuration. */
413#define XCHAL_ITLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
414#define XCHAL_DTLB_ARF_ENTRIES_LOG2 2 /* log2(autorefill way size) */
415
416#define XCHAL_MMU_ASID_BITS 8 /* number of bits in ASIDs */
417#define XCHAL_MMU_RINGS 4 /* number of rings (1..4) */
418#define XCHAL_MMU_RING_BITS 2 /* num of bits in RING field */
419
420#endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */
421
422
423#endif /* _XTENSA_CORE_CONFIGURATION_H */
424
diff --git a/include/asm-xtensa/variant-dc232b/tie-asm.h b/include/asm-xtensa/variant-dc232b/tie-asm.h
new file mode 100644
index 000000000000..ed4f53f529db
--- /dev/null
+++ b/include/asm-xtensa/variant-dc232b/tie-asm.h
@@ -0,0 +1,122 @@
1/*
2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_ASM_H
14#define _XTENSA_CORE_TIE_ASM_H
15
16/* Selection parameter values for save-area save/restore macros: */
17/* Option vs. TIE: */
18#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20/* Whether used automatically by compiler: */
21#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23/* ABI handling across function calls: */
24#define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25#define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
27/* Misc */
28#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
29
30
31
32/* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (1 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
36 */
37 .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
38 xchal_sa_start \continue, \ofs
39 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select
40 xchal_sa_align \ptr, 0, 1024-8, 4, 4
41 rsr \at1, ACCLO // MAC16 accumulator
42 rsr \at2, ACCHI
43 s32i \at1, \ptr, .Lxchal_ofs_ + 0
44 s32i \at2, \ptr, .Lxchal_ofs_ + 4
45 .set .Lxchal_ofs_, .Lxchal_ofs_ + 8
46 .endif
47 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
48 xchal_sa_align \ptr, 0, 1024-16, 4, 4
49 rsr \at1, M0 // MAC16 registers
50 rsr \at2, M1
51 s32i \at1, \ptr, .Lxchal_ofs_ + 0
52 s32i \at2, \ptr, .Lxchal_ofs_ + 4
53 rsr \at1, M2
54 rsr \at2, M3
55 s32i \at1, \ptr, .Lxchal_ofs_ + 8
56 s32i \at2, \ptr, .Lxchal_ofs_ + 12
57 .set .Lxchal_ofs_, .Lxchal_ofs_ + 16
58 .endif
59 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
60 xchal_sa_align \ptr, 0, 1024-4, 4, 4
61 rsr \at1, SCOMPARE1 // conditional store option
62 s32i \at1, \ptr, .Lxchal_ofs_ + 0
63 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
64 .endif
65 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
66 xchal_sa_align \ptr, 0, 1024-4, 4, 4
67 rur \at1, THREADPTR // threadptr option
68 s32i \at1, \ptr, .Lxchal_ofs_ + 0
69 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
70 .endif
71 .endm // xchal_ncp_store
72
73/* Macro to save all non-coprocessor (extra) custom TIE and optional state
74 * (not including zero-overhead loop registers).
75 * Save area ptr (clobbered): ptr (1 byte aligned)
76 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
77 */
78 .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
79 xchal_sa_start \continue, \ofs
80 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select
81 xchal_sa_align \ptr, 0, 1024-8, 4, 4
82 l32i \at1, \ptr, .Lxchal_ofs_ + 0
83 l32i \at2, \ptr, .Lxchal_ofs_ + 4
84 wsr \at1, ACCLO // MAC16 accumulator
85 wsr \at2, ACCHI
86 .set .Lxchal_ofs_, .Lxchal_ofs_ + 8
87 .endif
88 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
89 xchal_sa_align \ptr, 0, 1024-16, 4, 4
90 l32i \at1, \ptr, .Lxchal_ofs_ + 0
91 l32i \at2, \ptr, .Lxchal_ofs_ + 4
92 wsr \at1, M0 // MAC16 registers
93 wsr \at2, M1
94 l32i \at1, \ptr, .Lxchal_ofs_ + 8
95 l32i \at2, \ptr, .Lxchal_ofs_ + 12
96 wsr \at1, M2
97 wsr \at2, M3
98 .set .Lxchal_ofs_, .Lxchal_ofs_ + 16
99 .endif
100 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
101 xchal_sa_align \ptr, 0, 1024-4, 4, 4
102 l32i \at1, \ptr, .Lxchal_ofs_ + 0
103 wsr \at1, SCOMPARE1 // conditional store option
104 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
105 .endif
106 .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
107 xchal_sa_align \ptr, 0, 1024-4, 4, 4
108 l32i \at1, \ptr, .Lxchal_ofs_ + 0
109 wur \at1, THREADPTR // threadptr option
110 .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
111 .endif
112 .endm // xchal_ncp_load
113
114
115
116#define XCHAL_NCP_NUM_ATMPS 2
117
118
119#define XCHAL_SA_NUM_ATMPS 2
120
121#endif /*_XTENSA_CORE_TIE_ASM_H*/
122
diff --git a/include/asm-xtensa/variant-dc232b/tie.h b/include/asm-xtensa/variant-dc232b/tie.h
new file mode 100644
index 000000000000..018e81af4393
--- /dev/null
+++ b/include/asm-xtensa/variant-dc232b/tie.h
@@ -0,0 +1,131 @@
1/*
2 * This header file describes this specific Xtensa processor's TIE extensions
3 * that extend basic Xtensa core functionality. It is customized to this
4 * Xtensa processor configuration.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1999-2007 Tensilica Inc.
11 */
12
13#ifndef _XTENSA_CORE_TIE_H
14#define _XTENSA_CORE_TIE_H
15
16#define XCHAL_CP_NUM 1 /* number of coprocessors */
17#define XCHAL_CP_MAX 8 /* max CP ID + 1 (0 if none) */
18#define XCHAL_CP_MASK 0x80 /* bitmask of all CPs by ID */
19#define XCHAL_CP_PORT_MASK 0x80 /* bitmask of only port CPs */
20
21/* Basic parameters of each coprocessor: */
22#define XCHAL_CP7_NAME "XTIOP"
23#define XCHAL_CP7_IDENT XTIOP
24#define XCHAL_CP7_SA_SIZE 0 /* size of state save area */
25#define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */
26#define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */
27
28/* Filler info for unassigned coprocessors, to simplify arrays etc: */
29#define XCHAL_CP0_SA_SIZE 0
30#define XCHAL_CP0_SA_ALIGN 1
31#define XCHAL_CP1_SA_SIZE 0
32#define XCHAL_CP1_SA_ALIGN 1
33#define XCHAL_CP2_SA_SIZE 0
34#define XCHAL_CP2_SA_ALIGN 1
35#define XCHAL_CP3_SA_SIZE 0
36#define XCHAL_CP3_SA_ALIGN 1
37#define XCHAL_CP4_SA_SIZE 0
38#define XCHAL_CP4_SA_ALIGN 1
39#define XCHAL_CP5_SA_SIZE 0
40#define XCHAL_CP5_SA_ALIGN 1
41#define XCHAL_CP6_SA_SIZE 0
42#define XCHAL_CP6_SA_ALIGN 1
43
44/* Save area for non-coprocessor optional and custom (TIE) state: */
45#define XCHAL_NCP_SA_SIZE 32
46#define XCHAL_NCP_SA_ALIGN 4
47
48/* Total save area for optional and custom state (NCP + CPn): */
49#define XCHAL_TOTAL_SA_SIZE 32 /* with 16-byte align padding */
50#define XCHAL_TOTAL_SA_ALIGN 4 /* actual minimum alignment */
51
52/*
53 * Detailed contents of save areas.
54 * NOTE: caller must define the XCHAL_SA_REG macro (not defined here)
55 * before expanding the XCHAL_xxx_SA_LIST() macros.
56 *
57 * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,
58 * dbnum,base,regnum,bitsz,gapsz,reset,x...)
59 *
60 * s = passed from XCHAL_*_LIST(s), eg. to select how to expand
61 * ccused = set if used by compiler without special options or code
62 * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)
63 * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)
64 * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)
65 * name = lowercase reg name (no quotes)
66 * galign = group byte alignment (power of 2) (galign >= align)
67 * align = register byte alignment (power of 2)
68 * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)
69 * (not including any pad bytes required to galign this or next reg)
70 * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)
71 * base = reg shortname w/o index (or sr=special, ur=TIE user reg)
72 * regnum = reg index in regfile, or special/TIE-user reg number
73 * bitsz = number of significant bits (regfile width, or ur/sr mask bits)
74 * gapsz = intervening bits, if bitsz bits not stored contiguously
75 * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)
76 * reset = register reset value (or 0 if undefined at reset)
77 * x = reserved for future use (0 until then)
78 *
79 * To filter out certain registers, e.g. to expand only the non-global
80 * registers used by the compiler, you can do something like this:
81 *
82 * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p)
83 * #define SELCC0(p...)
84 * #define SELCC1(abikind,p...) SELAK##abikind(p)
85 * #define SELAK0(p...) REG(p)
86 * #define SELAK1(p...) REG(p)
87 * #define SELAK2(p...)
88 * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \
89 * ...what you want to expand...
90 */
91
92#define XCHAL_NCP_SA_NUM 8
93#define XCHAL_NCP_SA_LIST(s) \
94 XCHAL_SA_REG(s,1,0,0,1, acclo, 4, 4, 4,0x0210, sr,16 , 32,0,0,0) \
95 XCHAL_SA_REG(s,1,0,0,1, acchi, 4, 4, 4,0x0211, sr,17 , 8,0,0,0) \
96 XCHAL_SA_REG(s,0,0,0,1, m0, 4, 4, 4,0x0220, sr,32 , 32,0,0,0) \
97 XCHAL_SA_REG(s,0,0,0,1, m1, 4, 4, 4,0x0221, sr,33 , 32,0,0,0) \
98 XCHAL_SA_REG(s,0,0,0,1, m2, 4, 4, 4,0x0222, sr,34 , 32,0,0,0) \
99 XCHAL_SA_REG(s,0,0,0,1, m3, 4, 4, 4,0x0223, sr,35 , 32,0,0,0) \
100 XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) \
101 XCHAL_SA_REG(s,1,2,1,1, threadptr, 4, 4, 4,0x03E7, ur,231, 32,0,0,0)
102
103#define XCHAL_CP0_SA_NUM 0
104#define XCHAL_CP0_SA_LIST(s) /* empty */
105
106#define XCHAL_CP1_SA_NUM 0
107#define XCHAL_CP1_SA_LIST(s) /* empty */
108
109#define XCHAL_CP2_SA_NUM 0
110#define XCHAL_CP2_SA_LIST(s) /* empty */
111
112#define XCHAL_CP3_SA_NUM 0
113#define XCHAL_CP3_SA_LIST(s) /* empty */
114
115#define XCHAL_CP4_SA_NUM 0
116#define XCHAL_CP4_SA_LIST(s) /* empty */
117
118#define XCHAL_CP5_SA_NUM 0
119#define XCHAL_CP5_SA_LIST(s) /* empty */
120
121#define XCHAL_CP6_SA_NUM 0
122#define XCHAL_CP6_SA_LIST(s) /* empty */
123
124#define XCHAL_CP7_SA_NUM 0
125#define XCHAL_CP7_SA_LIST(s) /* empty */
126
127/* Byte length of instruction from its first nibble (op0 field), per FLIX. */
128#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
129
130#endif /*_XTENSA_CORE_TIE_H*/
131
diff --git a/include/crypto/internal/rng.h b/include/crypto/internal/rng.h
new file mode 100644
index 000000000000..896973369573
--- /dev/null
+++ b/include/crypto/internal/rng.h
@@ -0,0 +1,26 @@
1/*
2 * RNG: Random Number Generator algorithms under the crypto API
3 *
4 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _CRYPTO_INTERNAL_RNG_H
14#define _CRYPTO_INTERNAL_RNG_H
15
16#include <crypto/algapi.h>
17#include <crypto/rng.h>
18
19extern const struct crypto_type crypto_rng_type;
20
21static inline void *crypto_rng_ctx(struct crypto_rng *tfm)
22{
23 return crypto_tfm_ctx(&tfm->base);
24}
25
26#endif
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index ccc32bad9a89..2ba42cd7d6aa 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -15,7 +15,6 @@
15 15
16#include <crypto/algapi.h> 16#include <crypto/algapi.h>
17#include <crypto/skcipher.h> 17#include <crypto/skcipher.h>
18#include <linux/init.h>
19#include <linux/types.h> 18#include <linux/types.h>
20 19
21struct rtattr; 20struct rtattr;
@@ -65,11 +64,6 @@ void skcipher_geniv_free(struct crypto_instance *inst);
65int skcipher_geniv_init(struct crypto_tfm *tfm); 64int skcipher_geniv_init(struct crypto_tfm *tfm);
66void skcipher_geniv_exit(struct crypto_tfm *tfm); 65void skcipher_geniv_exit(struct crypto_tfm *tfm);
67 66
68int __init eseqiv_module_init(void);
69void __exit eseqiv_module_exit(void);
70int __init chainiv_module_init(void);
71void chainiv_module_exit(void);
72
73static inline struct crypto_ablkcipher *skcipher_geniv_cipher( 67static inline struct crypto_ablkcipher *skcipher_geniv_cipher(
74 struct crypto_ablkcipher *geniv) 68 struct crypto_ablkcipher *geniv)
75{ 69{
diff --git a/include/crypto/rng.h b/include/crypto/rng.h
new file mode 100644
index 000000000000..c93f9b917925
--- /dev/null
+++ b/include/crypto/rng.h
@@ -0,0 +1,75 @@
1/*
2 * RNG: Random Number Generator algorithms under the crypto API
3 *
4 * Copyright (c) 2008 Neil Horman <nhorman@tuxdriver.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 */
12
13#ifndef _CRYPTO_RNG_H
14#define _CRYPTO_RNG_H
15
16#include <linux/crypto.h>
17
18extern struct crypto_rng *crypto_default_rng;
19
20int crypto_get_default_rng(void);
21void crypto_put_default_rng(void);
22
23static inline struct crypto_rng *__crypto_rng_cast(struct crypto_tfm *tfm)
24{
25 return (struct crypto_rng *)tfm;
26}
27
28static inline struct crypto_rng *crypto_alloc_rng(const char *alg_name,
29 u32 type, u32 mask)
30{
31 type &= ~CRYPTO_ALG_TYPE_MASK;
32 type |= CRYPTO_ALG_TYPE_RNG;
33 mask |= CRYPTO_ALG_TYPE_MASK;
34
35 return __crypto_rng_cast(crypto_alloc_base(alg_name, type, mask));
36}
37
38static inline struct crypto_tfm *crypto_rng_tfm(struct crypto_rng *tfm)
39{
40 return &tfm->base;
41}
42
43static inline struct rng_alg *crypto_rng_alg(struct crypto_rng *tfm)
44{
45 return &crypto_rng_tfm(tfm)->__crt_alg->cra_rng;
46}
47
48static inline struct rng_tfm *crypto_rng_crt(struct crypto_rng *tfm)
49{
50 return &crypto_rng_tfm(tfm)->crt_rng;
51}
52
53static inline void crypto_free_rng(struct crypto_rng *tfm)
54{
55 crypto_free_tfm(crypto_rng_tfm(tfm));
56}
57
58static inline int crypto_rng_get_bytes(struct crypto_rng *tfm,
59 u8 *rdata, unsigned int dlen)
60{
61 return crypto_rng_crt(tfm)->rng_gen_random(tfm, rdata, dlen);
62}
63
64static inline int crypto_rng_reset(struct crypto_rng *tfm,
65 u8 *seed, unsigned int slen)
66{
67 return crypto_rng_crt(tfm)->rng_reset(tfm, seed, slen);
68}
69
70static inline int crypto_rng_seedsize(struct crypto_rng *tfm)
71{
72 return crypto_rng_alg(tfm)->seedsize;
73}
74
75#endif
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 38d3c6b8276a..f46ba4b57da4 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -36,7 +36,6 @@
36#ifndef _DRM_H_ 36#ifndef _DRM_H_
37#define _DRM_H_ 37#define _DRM_H_
38 38
39#if defined(__linux__)
40#if defined(__KERNEL__) 39#if defined(__KERNEL__)
41#endif 40#endif
42#include <asm/ioctl.h> /* For _IO* macros */ 41#include <asm/ioctl.h> /* For _IO* macros */
@@ -46,22 +45,6 @@
46#define DRM_IOC_WRITE _IOC_WRITE 45#define DRM_IOC_WRITE _IOC_WRITE
47#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE 46#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
48#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) 47#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
49#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
50#if defined(__FreeBSD__) && defined(IN_MODULE)
51/* Prevent name collision when including sys/ioccom.h */
52#undef ioctl
53#include <sys/ioccom.h>
54#define ioctl(a,b,c) xf86ioctl(a,b,c)
55#else
56#include <sys/ioccom.h>
57#endif /* __FreeBSD__ && xf86ioctl */
58#define DRM_IOCTL_NR(n) ((n) & 0xff)
59#define DRM_IOC_VOID IOC_VOID
60#define DRM_IOC_READ IOC_OUT
61#define DRM_IOC_WRITE IOC_IN
62#define DRM_IOC_READWRITE IOC_INOUT
63#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
64#endif
65 48
66#define DRM_MAJOR 226 49#define DRM_MAJOR 226
67#define DRM_MAX_MINOR 15 50#define DRM_MAX_MINOR 15
@@ -471,6 +454,7 @@ struct drm_irq_busid {
471enum drm_vblank_seq_type { 454enum drm_vblank_seq_type {
472 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 455 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
473 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 456 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
457 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
474 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 458 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
475 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 459 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
476 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ 460 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */
@@ -503,6 +487,19 @@ union drm_wait_vblank {
503 struct drm_wait_vblank_reply reply; 487 struct drm_wait_vblank_reply reply;
504}; 488};
505 489
490#define _DRM_PRE_MODESET 1
491#define _DRM_POST_MODESET 2
492
493/**
494 * DRM_IOCTL_MODESET_CTL ioctl argument type
495 *
496 * \sa drmModesetCtl().
497 */
498struct drm_modeset_ctl {
499 uint32_t crtc;
500 uint32_t cmd;
501};
502
506/** 503/**
507 * DRM_IOCTL_AGP_ENABLE ioctl argument type. 504 * DRM_IOCTL_AGP_ENABLE ioctl argument type.
508 * 505 *
@@ -573,6 +570,34 @@ struct drm_set_version {
573 int drm_dd_minor; 570 int drm_dd_minor;
574}; 571};
575 572
573/** DRM_IOCTL_GEM_CLOSE ioctl argument type */
574struct drm_gem_close {
575 /** Handle of the object to be closed. */
576 uint32_t handle;
577 uint32_t pad;
578};
579
580/** DRM_IOCTL_GEM_FLINK ioctl argument type */
581struct drm_gem_flink {
582 /** Handle for the object being named */
583 uint32_t handle;
584
585 /** Returned global name */
586 uint32_t name;
587};
588
589/** DRM_IOCTL_GEM_OPEN ioctl argument type */
590struct drm_gem_open {
591 /** Name of object being opened */
592 uint32_t name;
593
594 /** Returned handle for the object */
595 uint32_t handle;
596
597 /** Returned size of the object */
598 uint64_t size;
599};
600
576#define DRM_IOCTL_BASE 'd' 601#define DRM_IOCTL_BASE 'd'
577#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 602#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
578#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) 603#define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type)
@@ -587,6 +612,10 @@ struct drm_set_version {
587#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) 612#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client)
588#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 613#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats)
589#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 614#define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version)
615#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl)
616#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
617#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
618#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
590 619
591#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 620#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
592#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 621#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1c1b13e29223..59c796b46ee7 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -104,6 +104,7 @@ struct drm_device;
104#define DRIVER_DMA_QUEUE 0x200 104#define DRIVER_DMA_QUEUE 0x200
105#define DRIVER_FB_DMA 0x400 105#define DRIVER_FB_DMA 0x400
106#define DRIVER_IRQ_VBL2 0x800 106#define DRIVER_IRQ_VBL2 0x800
107#define DRIVER_GEM 0x1000
107 108
108/***********************************************************************/ 109/***********************************************************************/
109/** \name Begin the DRM... */ 110/** \name Begin the DRM... */
@@ -387,6 +388,10 @@ struct drm_file {
387 struct drm_minor *minor; 388 struct drm_minor *minor;
388 int remove_auth_on_close; 389 int remove_auth_on_close;
389 unsigned long lock_count; 390 unsigned long lock_count;
391 /** Mapping of mm object handles to object pointers. */
392 struct idr object_idr;
393 /** Lock for synchronization of access to object_idr. */
394 spinlock_t table_lock;
390 struct file *filp; 395 struct file *filp;
391 void *driver_priv; 396 void *driver_priv;
392}; 397};
@@ -558,6 +563,56 @@ struct drm_ati_pcigart_info {
558}; 563};
559 564
560/** 565/**
566 * This structure defines the drm_mm memory object, which will be used by the
567 * DRM for its buffer objects.
568 */
569struct drm_gem_object {
570 /** Reference count of this object */
571 struct kref refcount;
572
573 /** Handle count of this object. Each handle also holds a reference */
574 struct kref handlecount;
575
576 /** Related drm device */
577 struct drm_device *dev;
578
579 /** File representing the shmem storage */
580 struct file *filp;
581
582 /**
583 * Size of the object, in bytes. Immutable over the object's
584 * lifetime.
585 */
586 size_t size;
587
588 /**
589 * Global name for this object, starts at 1. 0 means unnamed.
590 * Access is covered by the object_name_lock in the related drm_device
591 */
592 int name;
593
594 /**
595 * Memory domains. These monitor which caches contain read/write data
596 * related to the object. When transitioning from one set of domains
597 * to another, the driver is called to ensure that caches are suitably
598 * flushed and invalidated
599 */
600 uint32_t read_domains;
601 uint32_t write_domain;
602
603 /**
604 * While validating an exec operation, the
605 * new read/write domain values are computed here.
606 * They will be transferred to the above values
607 * at the point that any cache flushing occurs
608 */
609 uint32_t pending_read_domains;
610 uint32_t pending_write_domain;
611
612 void *driver_private;
613};
614
615/**
561 * DRM driver structure. This structure represent the common code for 616 * DRM driver structure. This structure represent the common code for
562 * a family of cards. There will one drm_device for each card present 617 * a family of cards. There will one drm_device for each card present
563 * in this family 618 * in this family
@@ -580,11 +635,54 @@ struct drm_driver {
580 int (*kernel_context_switch) (struct drm_device *dev, int old, 635 int (*kernel_context_switch) (struct drm_device *dev, int old,
581 int new); 636 int new);
582 void (*kernel_context_switch_unlock) (struct drm_device *dev); 637 void (*kernel_context_switch_unlock) (struct drm_device *dev);
583 int (*vblank_wait) (struct drm_device *dev, unsigned int *sequence);
584 int (*vblank_wait2) (struct drm_device *dev, unsigned int *sequence);
585 int (*dri_library_name) (struct drm_device *dev, char *buf); 638 int (*dri_library_name) (struct drm_device *dev, char *buf);
586 639
587 /** 640 /**
641 * get_vblank_counter - get raw hardware vblank counter
642 * @dev: DRM device
643 * @crtc: counter to fetch
644 *
645 * Driver callback for fetching a raw hardware vblank counter
646 * for @crtc. If a device doesn't have a hardware counter, the
647 * driver can simply return the value of drm_vblank_count and
648 * make the enable_vblank() and disable_vblank() hooks into no-ops,
649 * leaving interrupts enabled at all times.
650 *
651 * Wraparound handling and loss of events due to modesetting is dealt
652 * with in the DRM core code.
653 *
654 * RETURNS
655 * Raw vblank counter value.
656 */
657 u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);
658
659 /**
660 * enable_vblank - enable vblank interrupt events
661 * @dev: DRM device
662 * @crtc: which irq to enable
663 *
664 * Enable vblank interrupts for @crtc. If the device doesn't have
665 * a hardware vblank counter, this routine should be a no-op, since
666 * interrupts will have to stay on to keep the count accurate.
667 *
668 * RETURNS
669 * Zero on success, appropriate errno if the given @crtc's vblank
670 * interrupt cannot be enabled.
671 */
672 int (*enable_vblank) (struct drm_device *dev, int crtc);
673
674 /**
675 * disable_vblank - disable vblank interrupt events
676 * @dev: DRM device
677 * @crtc: which irq to enable
678 *
679 * Disable vblank interrupts for @crtc. If the device doesn't have
680 * a hardware vblank counter, this routine should be a no-op, since
681 * interrupts will have to stay on to keep the count accurate.
682 */
683 void (*disable_vblank) (struct drm_device *dev, int crtc);
684
685 /**
588 * Called by \c drm_device_is_agp. Typically used to determine if a 686 * Called by \c drm_device_is_agp. Typically used to determine if a
589 * card is really attached to AGP or not. 687 * card is really attached to AGP or not.
590 * 688 *
@@ -601,7 +699,7 @@ struct drm_driver {
601 699
602 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); 700 irqreturn_t(*irq_handler) (DRM_IRQ_ARGS);
603 void (*irq_preinstall) (struct drm_device *dev); 701 void (*irq_preinstall) (struct drm_device *dev);
604 void (*irq_postinstall) (struct drm_device *dev); 702 int (*irq_postinstall) (struct drm_device *dev);
605 void (*irq_uninstall) (struct drm_device *dev); 703 void (*irq_uninstall) (struct drm_device *dev);
606 void (*reclaim_buffers) (struct drm_device *dev, 704 void (*reclaim_buffers) (struct drm_device *dev,
607 struct drm_file * file_priv); 705 struct drm_file * file_priv);
@@ -614,6 +712,18 @@ struct drm_driver {
614 void (*set_version) (struct drm_device *dev, 712 void (*set_version) (struct drm_device *dev,
615 struct drm_set_version *sv); 713 struct drm_set_version *sv);
616 714
715 int (*proc_init)(struct drm_minor *minor);
716 void (*proc_cleanup)(struct drm_minor *minor);
717
718 /**
719 * Driver-specific constructor for drm_gem_objects, to set up
720 * obj->driver_private.
721 *
722 * Returns 0 on success.
723 */
724 int (*gem_init_object) (struct drm_gem_object *obj);
725 void (*gem_free_object) (struct drm_gem_object *obj);
726
617 int major; 727 int major;
618 int minor; 728 int minor;
619 int patchlevel; 729 int patchlevel;
@@ -714,7 +824,6 @@ struct drm_device {
714 824
715 /** \name Context support */ 825 /** \name Context support */
716 /*@{ */ 826 /*@{ */
717 int irq; /**< Interrupt used by board */
718 int irq_enabled; /**< True if irq handler is enabled */ 827 int irq_enabled; /**< True if irq handler is enabled */
719 __volatile__ long context_flag; /**< Context swapping flag */ 828 __volatile__ long context_flag; /**< Context swapping flag */
720 __volatile__ long interrupt_flag; /**< Interruption handler flag */ 829 __volatile__ long interrupt_flag; /**< Interruption handler flag */
@@ -730,13 +839,28 @@ struct drm_device {
730 /** \name VBLANK IRQ support */ 839 /** \name VBLANK IRQ support */
731 /*@{ */ 840 /*@{ */
732 841
733 wait_queue_head_t vbl_queue; /**< VBLANK wait queue */ 842 /*
734 atomic_t vbl_received; 843 * At load time, disabling the vblank interrupt won't be allowed since
735 atomic_t vbl_received2; /**< number of secondary VBLANK interrupts */ 844 * old clients may not call the modeset ioctl and therefore misbehave.
845 * Once the modeset ioctl *has* been called though, we can safely
846 * disable them when unused.
847 */
848 int vblank_disable_allowed;
849
850 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
851 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
736 spinlock_t vbl_lock; 852 spinlock_t vbl_lock;
737 struct list_head vbl_sigs; /**< signal list to send on VBLANK */ 853 struct list_head *vbl_sigs; /**< signal list to send on VBLANK */
738 struct list_head vbl_sigs2; /**< signals to send on secondary VBLANK */ 854 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
739 unsigned int vbl_pending; 855 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
856 u32 *last_vblank; /* protected by dev->vbl_lock, used */
857 /* for wraparound handling */
858 int *vblank_enabled; /* so we don't call enable more than
859 once per disable */
860 int *vblank_inmodeset; /* Display driver is setting mode */
861 struct timer_list vblank_disable_timer;
862
863 u32 max_vblank_count; /**< size of vblank counter register */
740 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */ 864 spinlock_t tasklet_lock; /**< For drm_locked_tasklet */
741 void (*locked_tasklet_func)(struct drm_device *dev); 865 void (*locked_tasklet_func)(struct drm_device *dev);
742 866
@@ -757,6 +881,7 @@ struct drm_device {
757 struct pci_controller *hose; 881 struct pci_controller *hose;
758#endif 882#endif
759 struct drm_sg_mem *sg; /**< Scatter gather memory */ 883 struct drm_sg_mem *sg; /**< Scatter gather memory */
884 int num_crtcs; /**< Number of CRTCs on this device */
760 void *dev_private; /**< device private data */ 885 void *dev_private; /**< device private data */
761 struct drm_sigdata sigdata; /**< For block_all_signals */ 886 struct drm_sigdata sigdata; /**< For block_all_signals */
762 sigset_t sigmask; 887 sigset_t sigmask;
@@ -771,8 +896,29 @@ struct drm_device {
771 spinlock_t drw_lock; 896 spinlock_t drw_lock;
772 struct idr drw_idr; 897 struct idr drw_idr;
773 /*@} */ 898 /*@} */
899
900 /** \name GEM information */
901 /*@{ */
902 spinlock_t object_name_lock;
903 struct idr object_name_idr;
904 atomic_t object_count;
905 atomic_t object_memory;
906 atomic_t pin_count;
907 atomic_t pin_memory;
908 atomic_t gtt_count;
909 atomic_t gtt_memory;
910 uint32_t gtt_total;
911 uint32_t invalidate_domains; /* domains pending invalidation */
912 uint32_t flush_domains; /* domains pending flush */
913 /*@} */
914
774}; 915};
775 916
917static inline int drm_dev_to_irq(struct drm_device *dev)
918{
919 return dev->pdev->irq;
920}
921
776static __inline__ int drm_core_check_feature(struct drm_device *dev, 922static __inline__ int drm_core_check_feature(struct drm_device *dev,
777 int feature) 923 int feature)
778{ 924{
@@ -867,6 +1013,11 @@ extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
867extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type); 1013extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type);
868extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); 1014extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);
869extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1015extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1016extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
1017 struct page **pages,
1018 unsigned long num_pages,
1019 uint32_t gtt_offset,
1020 uint32_t type);
870extern int drm_unbind_agp(DRM_AGP_MEM * handle); 1021extern int drm_unbind_agp(DRM_AGP_MEM * handle);
871 1022
872 /* Misc. IOCTL support (drm_ioctl.h) */ 1023 /* Misc. IOCTL support (drm_ioctl.h) */
@@ -929,6 +1080,9 @@ extern int drm_getmagic(struct drm_device *dev, void *data,
929extern int drm_authmagic(struct drm_device *dev, void *data, 1080extern int drm_authmagic(struct drm_device *dev, void *data,
930 struct drm_file *file_priv); 1081 struct drm_file *file_priv);
931 1082
1083/* Cache management (drm_cache.c) */
1084void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1085
932 /* Locking IOCTL support (drm_lock.h) */ 1086 /* Locking IOCTL support (drm_lock.h) */
933extern int drm_lock(struct drm_device *dev, void *data, 1087extern int drm_lock(struct drm_device *dev, void *data,
934 struct drm_file *file_priv); 1088 struct drm_file *file_priv);
@@ -985,15 +1139,25 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
985extern int drm_control(struct drm_device *dev, void *data, 1139extern int drm_control(struct drm_device *dev, void *data,
986 struct drm_file *file_priv); 1140 struct drm_file *file_priv);
987extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); 1141extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
1142extern int drm_irq_install(struct drm_device *dev);
988extern int drm_irq_uninstall(struct drm_device *dev); 1143extern int drm_irq_uninstall(struct drm_device *dev);
989extern void drm_driver_irq_preinstall(struct drm_device *dev); 1144extern void drm_driver_irq_preinstall(struct drm_device *dev);
990extern void drm_driver_irq_postinstall(struct drm_device *dev); 1145extern void drm_driver_irq_postinstall(struct drm_device *dev);
991extern void drm_driver_irq_uninstall(struct drm_device *dev); 1146extern void drm_driver_irq_uninstall(struct drm_device *dev);
992 1147
1148extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
993extern int drm_wait_vblank(struct drm_device *dev, void *data, 1149extern int drm_wait_vblank(struct drm_device *dev, void *data,
994 struct drm_file *file_priv); 1150 struct drm_file *filp);
995extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); 1151extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
996extern void drm_vbl_send_signals(struct drm_device *dev); 1152extern void drm_locked_tasklet(struct drm_device *dev,
1153 void(*func)(struct drm_device *));
1154extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
1155extern void drm_handle_vblank(struct drm_device *dev, int crtc);
1156extern int drm_vblank_get(struct drm_device *dev, int crtc);
1157extern void drm_vblank_put(struct drm_device *dev, int crtc);
1158/* Modesetting support */
1159extern int drm_modeset_ctl(struct drm_device *dev, void *data,
1160 struct drm_file *file_priv);
997extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*)); 1161extern void drm_locked_tasklet(struct drm_device *dev, void(*func)(struct drm_device*));
998 1162
999 /* AGP/GART support (drm_agpsupport.h) */ 1163 /* AGP/GART support (drm_agpsupport.h) */
@@ -1026,6 +1190,7 @@ extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size
1026extern int drm_agp_free_memory(DRM_AGP_MEM * handle); 1190extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
1027extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); 1191extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
1028extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); 1192extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
1193extern void drm_agp_chipset_flush(struct drm_device *dev);
1029 1194
1030 /* Stub support (drm_stub.h) */ 1195 /* Stub support (drm_stub.h) */
1031extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1196extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
@@ -1088,6 +1253,66 @@ extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
1088extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size); 1253extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
1089extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size); 1254extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1090 1255
1256/* Graphics Execution Manager library functions (drm_gem.c) */
1257int drm_gem_init(struct drm_device *dev);
1258void drm_gem_object_free(struct kref *kref);
1259struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1260 size_t size);
1261void drm_gem_object_handle_free(struct kref *kref);
1262
1263static inline void
1264drm_gem_object_reference(struct drm_gem_object *obj)
1265{
1266 kref_get(&obj->refcount);
1267}
1268
1269static inline void
1270drm_gem_object_unreference(struct drm_gem_object *obj)
1271{
1272 if (obj == NULL)
1273 return;
1274
1275 kref_put(&obj->refcount, drm_gem_object_free);
1276}
1277
1278int drm_gem_handle_create(struct drm_file *file_priv,
1279 struct drm_gem_object *obj,
1280 int *handlep);
1281
1282static inline void
1283drm_gem_object_handle_reference(struct drm_gem_object *obj)
1284{
1285 drm_gem_object_reference(obj);
1286 kref_get(&obj->handlecount);
1287}
1288
1289static inline void
1290drm_gem_object_handle_unreference(struct drm_gem_object *obj)
1291{
1292 if (obj == NULL)
1293 return;
1294
1295 /*
1296 * Must bump handle count first as this may be the last
1297 * ref, in which case the object would disappear before we
1298 * checked for a name
1299 */
1300 kref_put(&obj->handlecount, drm_gem_object_handle_free);
1301 drm_gem_object_unreference(obj);
1302}
1303
1304struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev,
1305 struct drm_file *filp,
1306 int handle);
1307int drm_gem_close_ioctl(struct drm_device *dev, void *data,
1308 struct drm_file *file_priv);
1309int drm_gem_flink_ioctl(struct drm_device *dev, void *data,
1310 struct drm_file *file_priv);
1311int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1312 struct drm_file *file_priv);
1313void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1314void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1315
1091extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1316extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
1092extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1317extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev);
1093extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1318extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 135bd19499fc..da04109741e8 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -84,18 +84,18 @@
84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 84 {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \ 85 {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_IS_MOBILITY}, \
86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 86 {0x1002, 0x5657, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 87 {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 88 {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 89 {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
90 {0x1002, 0x554B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 90 {0x1002, 0x554B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
91 {0x1002, 0x554C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 91 {0x1002, 0x554C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
92 {0x1002, 0x554D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 92 {0x1002, 0x554D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
93 {0x1002, 0x554E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 93 {0x1002, 0x554E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
94 {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 94 {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
95 {0x1002, 0x5550, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 95 {0x1002, 0x5550, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
96 {0x1002, 0x5551, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 96 {0x1002, 0x5551, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
97 {0x1002, 0x5552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 97 {0x1002, 0x5552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
98 {0x1002, 0x5554, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 98 {0x1002, 0x5554, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
99 {0x1002, 0x564A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 99 {0x1002, 0x564A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
100 {0x1002, 0x564B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 100 {0x1002, 0x564B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
101 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 101 {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -113,8 +113,10 @@
113 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 113 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
114 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 114 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
115 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 115 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
116 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 116 {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
117 {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 117 {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_IGPGART}, \
119 {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 120 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
119 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 121 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
120 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 122 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
@@ -122,16 +124,16 @@
122 {0x1002, 0x5b65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 124 {0x1002, 0x5b65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
123 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ 125 {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
124 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ 126 {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \
125 {0x1002, 0x5d48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 127 {0x1002, 0x5d48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
126 {0x1002, 0x5d49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 128 {0x1002, 0x5d49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
127 {0x1002, 0x5d4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 129 {0x1002, 0x5d4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
128 {0x1002, 0x5d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 130 {0x1002, 0x5d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
129 {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 131 {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
130 {0x1002, 0x5d4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 132 {0x1002, 0x5d4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
131 {0x1002, 0x5d4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 133 {0x1002, 0x5d4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
132 {0x1002, 0x5d50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 134 {0x1002, 0x5d50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
133 {0x1002, 0x5d52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 135 {0x1002, 0x5d52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
134 {0x1002, 0x5d57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ 136 {0x1002, 0x5d57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R423|RADEON_NEW_MEMMAP}, \
135 {0x1002, 0x5e48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 137 {0x1002, 0x5e48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
136 {0x1002, 0x5e4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 138 {0x1002, 0x5e4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
137 {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 139 {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
@@ -237,6 +239,10 @@
237 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 239 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
238 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 240 {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
239 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ 241 {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
242 {0x1002, 0x796c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
243 {0x1002, 0x796d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
244 {0x1002, 0x796e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
245 {0x1002, 0x796f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \
240 {0, 0, 0} 246 {0, 0, 0}
241 247
242#define r128_PCI_IDS \ 248#define r128_PCI_IDS \
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 05c66cf03a9e..eb4b35031a55 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -143,6 +143,22 @@ typedef struct _drm_i915_sarea {
143#define DRM_I915_GET_VBLANK_PIPE 0x0e 143#define DRM_I915_GET_VBLANK_PIPE 0x0e
144#define DRM_I915_VBLANK_SWAP 0x0f 144#define DRM_I915_VBLANK_SWAP 0x0f
145#define DRM_I915_HWS_ADDR 0x11 145#define DRM_I915_HWS_ADDR 0x11
146#define DRM_I915_GEM_INIT 0x13
147#define DRM_I915_GEM_EXECBUFFER 0x14
148#define DRM_I915_GEM_PIN 0x15
149#define DRM_I915_GEM_UNPIN 0x16
150#define DRM_I915_GEM_BUSY 0x17
151#define DRM_I915_GEM_THROTTLE 0x18
152#define DRM_I915_GEM_ENTERVT 0x19
153#define DRM_I915_GEM_LEAVEVT 0x1a
154#define DRM_I915_GEM_CREATE 0x1b
155#define DRM_I915_GEM_PREAD 0x1c
156#define DRM_I915_GEM_PWRITE 0x1d
157#define DRM_I915_GEM_MMAP 0x1e
158#define DRM_I915_GEM_SET_DOMAIN 0x1f
159#define DRM_I915_GEM_SW_FINISH 0x20
160#define DRM_I915_GEM_SET_TILING 0x21
161#define DRM_I915_GEM_GET_TILING 0x22
146 162
147#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 163#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
148#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 164#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -160,6 +176,20 @@ typedef struct _drm_i915_sarea {
160#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 176#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
161#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 177#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
162#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 178#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
179#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
180#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
181#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
182#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
183#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
184#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
185#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
186#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
187#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
188#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
189#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
190#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
191#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
192#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
163 193
164/* Allow drivers to submit batchbuffers directly to hardware, relying 194/* Allow drivers to submit batchbuffers directly to hardware, relying
165 * on the security mechanisms provided by hardware. 195 * on the security mechanisms provided by hardware.
@@ -200,6 +230,8 @@ typedef struct drm_i915_irq_wait {
200#define I915_PARAM_IRQ_ACTIVE 1 230#define I915_PARAM_IRQ_ACTIVE 1
201#define I915_PARAM_ALLOW_BATCHBUFFER 2 231#define I915_PARAM_ALLOW_BATCHBUFFER 2
202#define I915_PARAM_LAST_DISPATCH 3 232#define I915_PARAM_LAST_DISPATCH 3
233#define I915_PARAM_CHIPSET_ID 4
234#define I915_PARAM_HAS_GEM 5
203 235
204typedef struct drm_i915_getparam { 236typedef struct drm_i915_getparam {
205 int param; 237 int param;
@@ -267,4 +299,305 @@ typedef struct drm_i915_hws_addr {
267 uint64_t addr; 299 uint64_t addr;
268} drm_i915_hws_addr_t; 300} drm_i915_hws_addr_t;
269 301
302struct drm_i915_gem_init {
303 /**
304 * Beginning offset in the GTT to be managed by the DRM memory
305 * manager.
306 */
307 uint64_t gtt_start;
308 /**
309 * Ending offset in the GTT to be managed by the DRM memory
310 * manager.
311 */
312 uint64_t gtt_end;
313};
314
315struct drm_i915_gem_create {
316 /**
317 * Requested size for the object.
318 *
319 * The (page-aligned) allocated size for the object will be returned.
320 */
321 uint64_t size;
322 /**
323 * Returned handle for the object.
324 *
325 * Object handles are nonzero.
326 */
327 uint32_t handle;
328 uint32_t pad;
329};
330
331struct drm_i915_gem_pread {
332 /** Handle for the object being read. */
333 uint32_t handle;
334 uint32_t pad;
335 /** Offset into the object to read from */
336 uint64_t offset;
337 /** Length of data to read */
338 uint64_t size;
339 /**
340 * Pointer to write the data into.
341 *
342 * This is a fixed-size type for 32/64 compatibility.
343 */
344 uint64_t data_ptr;
345};
346
347struct drm_i915_gem_pwrite {
348 /** Handle for the object being written to. */
349 uint32_t handle;
350 uint32_t pad;
351 /** Offset into the object to write to */
352 uint64_t offset;
353 /** Length of data to write */
354 uint64_t size;
355 /**
356 * Pointer to read the data from.
357 *
358 * This is a fixed-size type for 32/64 compatibility.
359 */
360 uint64_t data_ptr;
361};
362
363struct drm_i915_gem_mmap {
364 /** Handle for the object being mapped. */
365 uint32_t handle;
366 uint32_t pad;
367 /** Offset in the object to map. */
368 uint64_t offset;
369 /**
370 * Length of data to map.
371 *
372 * The value will be page-aligned.
373 */
374 uint64_t size;
375 /**
376 * Returned pointer the data was mapped at.
377 *
378 * This is a fixed-size type for 32/64 compatibility.
379 */
380 uint64_t addr_ptr;
381};
382
383struct drm_i915_gem_set_domain {
384 /** Handle for the object */
385 uint32_t handle;
386
387 /** New read domains */
388 uint32_t read_domains;
389
390 /** New write domain */
391 uint32_t write_domain;
392};
393
394struct drm_i915_gem_sw_finish {
395 /** Handle for the object */
396 uint32_t handle;
397};
398
399struct drm_i915_gem_relocation_entry {
400 /**
401 * Handle of the buffer being pointed to by this relocation entry.
402 *
403 * It's appealing to make this be an index into the mm_validate_entry
404 * list to refer to the buffer, but this allows the driver to create
405 * a relocation list for state buffers and not re-write it per
406 * exec using the buffer.
407 */
408 uint32_t target_handle;
409
410 /**
411 * Value to be added to the offset of the target buffer to make up
412 * the relocation entry.
413 */
414 uint32_t delta;
415
416 /** Offset in the buffer the relocation entry will be written into */
417 uint64_t offset;
418
419 /**
420 * Offset value of the target buffer that the relocation entry was last
421 * written as.
422 *
423 * If the buffer has the same offset as last time, we can skip syncing
424 * and writing the relocation. This value is written back out by
425 * the execbuffer ioctl when the relocation is written.
426 */
427 uint64_t presumed_offset;
428
429 /**
430 * Target memory domains read by this operation.
431 */
432 uint32_t read_domains;
433
434 /**
435 * Target memory domains written by this operation.
436 *
437 * Note that only one domain may be written by the whole
438 * execbuffer operation, so that where there are conflicts,
439 * the application will get -EINVAL back.
440 */
441 uint32_t write_domain;
442};
443
444/** @{
445 * Intel memory domains
446 *
447 * Most of these just align with the various caches in
448 * the system and are used to flush and invalidate as
449 * objects end up cached in different domains.
450 */
451/** CPU cache */
452#define I915_GEM_DOMAIN_CPU 0x00000001
453/** Render cache, used by 2D and 3D drawing */
454#define I915_GEM_DOMAIN_RENDER 0x00000002
455/** Sampler cache, used by texture engine */
456#define I915_GEM_DOMAIN_SAMPLER 0x00000004
457/** Command queue, used to load batch buffers */
458#define I915_GEM_DOMAIN_COMMAND 0x00000008
459/** Instruction cache, used by shader programs */
460#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
461/** Vertex address cache */
462#define I915_GEM_DOMAIN_VERTEX 0x00000020
463/** GTT domain - aperture and scanout */
464#define I915_GEM_DOMAIN_GTT 0x00000040
465/** @} */
466
467struct drm_i915_gem_exec_object {
468 /**
469 * User's handle for a buffer to be bound into the GTT for this
470 * operation.
471 */
472 uint32_t handle;
473
474 /** Number of relocations to be performed on this buffer */
475 uint32_t relocation_count;
476 /**
477 * Pointer to array of struct drm_i915_gem_relocation_entry containing
478 * the relocations to be performed in this buffer.
479 */
480 uint64_t relocs_ptr;
481
482 /** Required alignment in graphics aperture */
483 uint64_t alignment;
484
485 /**
486 * Returned value of the updated offset of the object, for future
487 * presumed_offset writes.
488 */
489 uint64_t offset;
490};
491
492struct drm_i915_gem_execbuffer {
493 /**
494 * List of buffers to be validated with their relocations to be
495 * performend on them.
496 *
497 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
498 *
499 * These buffers must be listed in an order such that all relocations
500 * a buffer is performing refer to buffers that have already appeared
501 * in the validate list.
502 */
503 uint64_t buffers_ptr;
504 uint32_t buffer_count;
505
506 /** Offset in the batchbuffer to start execution from. */
507 uint32_t batch_start_offset;
508 /** Bytes used in batchbuffer from batch_start_offset */
509 uint32_t batch_len;
510 uint32_t DR1;
511 uint32_t DR4;
512 uint32_t num_cliprects;
513 /** This is a struct drm_clip_rect *cliprects */
514 uint64_t cliprects_ptr;
515};
516
517struct drm_i915_gem_pin {
518 /** Handle of the buffer to be pinned. */
519 uint32_t handle;
520 uint32_t pad;
521
522 /** alignment required within the aperture */
523 uint64_t alignment;
524
525 /** Returned GTT offset of the buffer. */
526 uint64_t offset;
527};
528
529struct drm_i915_gem_unpin {
530 /** Handle of the buffer to be unpinned. */
531 uint32_t handle;
532 uint32_t pad;
533};
534
535struct drm_i915_gem_busy {
536 /** Handle of the buffer to check for busy */
537 uint32_t handle;
538
539 /** Return busy status (1 if busy, 0 if idle) */
540 uint32_t busy;
541};
542
543#define I915_TILING_NONE 0
544#define I915_TILING_X 1
545#define I915_TILING_Y 2
546
547#define I915_BIT_6_SWIZZLE_NONE 0
548#define I915_BIT_6_SWIZZLE_9 1
549#define I915_BIT_6_SWIZZLE_9_10 2
550#define I915_BIT_6_SWIZZLE_9_11 3
551#define I915_BIT_6_SWIZZLE_9_10_11 4
552/* Not seen by userland */
553#define I915_BIT_6_SWIZZLE_UNKNOWN 5
554
555struct drm_i915_gem_set_tiling {
556 /** Handle of the buffer to have its tiling state updated */
557 uint32_t handle;
558
559 /**
560 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
561 * I915_TILING_Y).
562 *
563 * This value is to be set on request, and will be updated by the
564 * kernel on successful return with the actual chosen tiling layout.
565 *
566 * The tiling mode may be demoted to I915_TILING_NONE when the system
567 * has bit 6 swizzling that can't be managed correctly by GEM.
568 *
569 * Buffer contents become undefined when changing tiling_mode.
570 */
571 uint32_t tiling_mode;
572
573 /**
574 * Stride in bytes for the object when in I915_TILING_X or
575 * I915_TILING_Y.
576 */
577 uint32_t stride;
578
579 /**
580 * Returned address bit 6 swizzling required for CPU access through
581 * mmap mapping.
582 */
583 uint32_t swizzle_mode;
584};
585
586struct drm_i915_gem_get_tiling {
587 /** Handle of the buffer to get tiling state for. */
588 uint32_t handle;
589
590 /**
591 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
592 * I915_TILING_Y).
593 */
594 uint32_t tiling_mode;
595
596 /**
597 * Returned address bit 6 swizzling required for CPU access through
598 * mmap mapping.
599 */
600 uint32_t swizzle_mode;
601};
602
270#endif /* _I915_DRM_H_ */ 603#endif /* _I915_DRM_H_ */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b68ec09399be..e531783e5d78 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -107,6 +107,7 @@ header-y += keyctl.h
107header-y += limits.h 107header-y += limits.h
108header-y += magic.h 108header-y += magic.h
109header-y += major.h 109header-y += major.h
110header-y += map_to_7segment.h
110header-y += matroxfb.h 111header-y += matroxfb.h
111header-y += meye.h 112header-y += meye.h
112header-y += minix_fs.h 113header-y += minix_fs.h
@@ -126,6 +127,7 @@ header-y += pci_regs.h
126header-y += pfkeyv2.h 127header-y += pfkeyv2.h
127header-y += pg.h 128header-y += pg.h
128header-y += phantom.h 129header-y += phantom.h
130header-y += phonet.h
129header-y += pkt_cls.h 131header-y += pkt_cls.h
130header-y += pkt_sched.h 132header-y += pkt_sched.h
131header-y += posix_types.h 133header-y += posix_types.h
@@ -180,6 +182,8 @@ unifdef-y += audit.h
180unifdef-y += auto_fs.h 182unifdef-y += auto_fs.h
181unifdef-y += auxvec.h 183unifdef-y += auxvec.h
182unifdef-y += binfmts.h 184unifdef-y += binfmts.h
185unifdef-y += blktrace_api.h
186unifdef-y += byteorder.h
183unifdef-y += capability.h 187unifdef-y += capability.h
184unifdef-y += capi.h 188unifdef-y += capi.h
185unifdef-y += cciss_ioctl.h 189unifdef-y += cciss_ioctl.h
@@ -232,6 +236,7 @@ unifdef-y += if_fddi.h
232unifdef-y += if_frad.h 236unifdef-y += if_frad.h
233unifdef-y += if_ltalk.h 237unifdef-y += if_ltalk.h
234unifdef-y += if_link.h 238unifdef-y += if_link.h
239unifdef-y += if_phonet.h
235unifdef-y += if_pppol2tp.h 240unifdef-y += if_pppol2tp.h
236unifdef-y += if_pppox.h 241unifdef-y += if_pppox.h
237unifdef-y += if_tr.h 242unifdef-y += if_tr.h
@@ -336,6 +341,7 @@ unifdef-y += soundcard.h
336unifdef-y += stat.h 341unifdef-y += stat.h
337unifdef-y += stddef.h 342unifdef-y += stddef.h
338unifdef-y += string.h 343unifdef-y += string.h
344unifdef-y += swab.h
339unifdef-y += synclink.h 345unifdef-y += synclink.h
340unifdef-y += sysctl.h 346unifdef-y += sysctl.h
341unifdef-y += tcp.h 347unifdef-y += tcp.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 702f79dad16a..fd6a452b0ceb 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -94,18 +94,10 @@ int acpi_parse_mcfg (struct acpi_table_header *header);
94void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); 94void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
95 95
96/* the following four functions are architecture-dependent */ 96/* the following four functions are architecture-dependent */
97#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
98#define NR_NODE_MEMBLKS MAX_NUMNODES
99#define acpi_numa_slit_init(slit) do {} while (0)
100#define acpi_numa_processor_affinity_init(pa) do {} while (0)
101#define acpi_numa_memory_affinity_init(ma) do {} while (0)
102#define acpi_numa_arch_fixup() do {} while (0)
103#else
104void acpi_numa_slit_init (struct acpi_table_slit *slit); 97void acpi_numa_slit_init (struct acpi_table_slit *slit);
105void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); 98void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
106void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); 99void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
107void acpi_numa_arch_fixup(void); 100void acpi_numa_arch_fixup(void);
108#endif
109 101
110#ifdef CONFIG_ACPI_HOTPLUG_CPU 102#ifdef CONFIG_ACPI_HOTPLUG_CPU
111/* Arch dependent functions for cpu hotplug support */ 103/* Arch dependent functions for cpu hotplug support */
diff --git a/include/linux/aer.h b/include/linux/aer.h
index f2518141de88..f7df1eefc107 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -10,7 +10,6 @@
10#if defined(CONFIG_PCIEAER) 10#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */ 11/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(struct pci_dev *dev);
14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); 13extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 14extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16#else 15#else
@@ -18,10 +17,6 @@ static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
18{ 17{
19 return -EINVAL; 18 return -EINVAL;
20} 19}
21static inline int pci_find_aer_capability(struct pci_dev *dev)
22{
23 return 0;
24}
25static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) 20static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
26{ 21{
27 return -EINVAL; 22 return -EINVAL;
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 09b276c35227..f6b8cf99b596 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -204,12 +204,21 @@ struct kioctx {
204/* prototypes */ 204/* prototypes */
205extern unsigned aio_max_size; 205extern unsigned aio_max_size;
206 206
207#ifdef CONFIG_AIO
207extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb); 208extern ssize_t wait_on_sync_kiocb(struct kiocb *iocb);
208extern int aio_put_req(struct kiocb *iocb); 209extern int aio_put_req(struct kiocb *iocb);
209extern void kick_iocb(struct kiocb *iocb); 210extern void kick_iocb(struct kiocb *iocb);
210extern int aio_complete(struct kiocb *iocb, long res, long res2); 211extern int aio_complete(struct kiocb *iocb, long res, long res2);
211struct mm_struct; 212struct mm_struct;
212extern void exit_aio(struct mm_struct *mm); 213extern void exit_aio(struct mm_struct *mm);
214#else
215static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
216static inline int aio_put_req(struct kiocb *iocb) { return 0; }
217static inline void kick_iocb(struct kiocb *iocb) { }
218static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
219struct mm_struct;
220static inline void exit_aio(struct mm_struct *mm) { }
221#endif /* CONFIG_AIO */
213 222
214#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 223#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
215 224
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 8a12d718c169..a53318b8cbd0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -30,6 +30,7 @@
30#define __LINUX_ATA_H__ 30#define __LINUX_ATA_H__
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <asm/byteorder.h>
33 34
34/* defines only for the constants which don't work well as enums */ 35/* defines only for the constants which don't work well as enums */
35#define ATA_DMA_BOUNDARY 0xffffUL 36#define ATA_DMA_BOUNDARY 0xffffUL
@@ -88,6 +89,7 @@ enum {
88 ATA_ID_DLF = 128, 89 ATA_ID_DLF = 128,
89 ATA_ID_CSFO = 129, 90 ATA_ID_CSFO = 129,
90 ATA_ID_CFA_POWER = 160, 91 ATA_ID_CFA_POWER = 160,
92 ATA_ID_ROT_SPEED = 217,
91 ATA_ID_PIO4 = (1 << 1), 93 ATA_ID_PIO4 = (1 << 1),
92 94
93 ATA_ID_SERNO_LEN = 20, 95 ATA_ID_SERNO_LEN = 20,
@@ -557,6 +559,15 @@ static inline int ata_id_has_flush(const u16 *id)
557 return id[ATA_ID_COMMAND_SET_2] & (1 << 12); 559 return id[ATA_ID_COMMAND_SET_2] & (1 << 12);
558} 560}
559 561
562static inline int ata_id_flush_enabled(const u16 *id)
563{
564 if (ata_id_has_flush(id) == 0)
565 return 0;
566 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
567 return 0;
568 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12);
569}
570
560static inline int ata_id_has_flush_ext(const u16 *id) 571static inline int ata_id_has_flush_ext(const u16 *id)
561{ 572{
562 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 573 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
@@ -564,6 +575,19 @@ static inline int ata_id_has_flush_ext(const u16 *id)
564 return id[ATA_ID_COMMAND_SET_2] & (1 << 13); 575 return id[ATA_ID_COMMAND_SET_2] & (1 << 13);
565} 576}
566 577
578static inline int ata_id_flush_ext_enabled(const u16 *id)
579{
580 if (ata_id_has_flush_ext(id) == 0)
581 return 0;
582 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
583 return 0;
584 /*
585 * some Maxtor disks have bit 13 defined incorrectly
586 * so check bit 10 too
587 */
588 return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
589}
590
567static inline int ata_id_has_lba48(const u16 *id) 591static inline int ata_id_has_lba48(const u16 *id)
568{ 592{
569 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 593 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
@@ -573,6 +597,15 @@ static inline int ata_id_has_lba48(const u16 *id)
573 return id[ATA_ID_COMMAND_SET_2] & (1 << 10); 597 return id[ATA_ID_COMMAND_SET_2] & (1 << 10);
574} 598}
575 599
600static inline int ata_id_lba48_enabled(const u16 *id)
601{
602 if (ata_id_has_lba48(id) == 0)
603 return 0;
604 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
605 return 0;
606 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10);
607}
608
576static inline int ata_id_hpa_enabled(const u16 *id) 609static inline int ata_id_hpa_enabled(const u16 *id)
577{ 610{
578 /* Yes children, word 83 valid bits cover word 82 data */ 611 /* Yes children, word 83 valid bits cover word 82 data */
@@ -644,7 +677,15 @@ static inline unsigned int ata_id_major_version(const u16 *id)
644 677
645static inline int ata_id_is_sata(const u16 *id) 678static inline int ata_id_is_sata(const u16 *id)
646{ 679{
647 return ata_id_major_version(id) >= 5 && id[ATA_ID_HW_CONFIG] == 0; 680 /*
681 * See if word 93 is 0 AND drive is at least ATA-5 compatible
682 * verifying that word 80 by casting it to a signed type --
683 * this trick allows us to filter out the reserved values of
684 * 0x0000 and 0xffff along with the earlier ATA revisions...
685 */
686 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
687 return 1;
688 return 0;
648} 689}
649 690
650static inline int ata_id_has_tpm(const u16 *id) 691static inline int ata_id_has_tpm(const u16 *id)
@@ -667,6 +708,15 @@ static inline int ata_id_has_dword_io(const u16 *id)
667 return 0; 708 return 0;
668} 709}
669 710
711static inline int ata_id_has_unload(const u16 *id)
712{
713 if (ata_id_major_version(id) >= 7 &&
714 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
715 id[ATA_ID_CFSSE] & (1 << 13))
716 return 1;
717 return 0;
718}
719
670static inline int ata_id_current_chs_valid(const u16 *id) 720static inline int ata_id_current_chs_valid(const u16 *id)
671{ 721{
672 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 722 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -691,6 +741,11 @@ static inline int ata_id_is_cfa(const u16 *id)
691 return 0; 741 return 0;
692} 742}
693 743
744static inline int ata_id_is_ssd(const u16 *id)
745{
746 return id[ATA_ID_ROT_SPEED] == 0x01;
747}
748
694static inline int ata_drive_40wire(const u16 *dev_id) 749static inline int ata_drive_40wire(const u16 *dev_id)
695{ 750{
696 if (ata_id_is_sata(dev_id)) 751 if (ata_id_is_sata(dev_id))
@@ -727,6 +782,76 @@ static inline int atapi_id_dmadir(const u16 *dev_id)
727 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); 782 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
728} 783}
729 784
785/*
786 * ata_id_is_lba_capacity_ok() performs a sanity check on
787 * the claimed LBA capacity value for the device.
788 *
789 * Returns 1 if LBA capacity looks sensible, 0 otherwise.
790 *
791 * It is called only once for each device.
792 */
793static inline int ata_id_is_lba_capacity_ok(u16 *id)
794{
795 unsigned long lba_sects, chs_sects, head, tail;
796
797 /* No non-LBA info .. so valid! */
798 if (id[ATA_ID_CYLS] == 0)
799 return 1;
800
801 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
802
803 /*
804 * The ATA spec tells large drives to return
805 * C/H/S = 16383/16/63 independent of their size.
806 * Some drives can be jumpered to use 15 heads instead of 16.
807 * Some drives can be jumpered to use 4092 cyls instead of 16383.
808 */
809 if ((id[ATA_ID_CYLS] == 16383 ||
810 (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) &&
811 id[ATA_ID_SECTORS] == 63 &&
812 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
813 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS]))
814 return 1;
815
816 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
817
818 /* perform a rough sanity check on lba_sects: within 10% is OK */
819 if (lba_sects - chs_sects < chs_sects/10)
820 return 1;
821
822 /* some drives have the word order reversed */
823 head = (lba_sects >> 16) & 0xffff;
824 tail = lba_sects & 0xffff;
825 lba_sects = head | (tail << 16);
826
827 if (lba_sects - chs_sects < chs_sects/10) {
828 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects);
829 return 1; /* LBA capacity is (now) good */
830 }
831
832 return 0; /* LBA capacity value may be bad */
833}
834
835static inline void ata_id_to_hd_driveid(u16 *id)
836{
837#ifdef __BIG_ENDIAN
838 /* accessed in struct hd_driveid as 8-bit values */
839 id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]);
840 id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]);
841 id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]);
842 id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]);
843 id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]);
844
845 /* as 32-bit values */
846 *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
847 *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG);
848
849 /* as 64-bit value */
850 *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] =
851 ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
852#endif
853}
854
730static inline int is_multi_taskfile(struct ata_taskfile *tf) 855static inline int is_multi_taskfile(struct ata_taskfile *tf)
731{ 856{
732 return (tf->command == ATA_CMD_READ_MULTI) || 857 return (tf->command == ATA_CMD_READ_MULTI) ||
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
new file mode 100644
index 000000000000..f4d05ccd731f
--- /dev/null
+++ b/include/linux/auto_dev-ioctl.h
@@ -0,0 +1,157 @@
1/*
2 * Copyright 2008 Red Hat, Inc. All rights reserved.
3 * Copyright 2008 Ian Kent <raven@themaw.net>
4 *
5 * This file is part of the Linux kernel and is made available under
6 * the terms of the GNU General Public License, version 2, or at your
7 * option, any later version, incorporated herein by reference.
8 */
9
10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H
12
13#include <linux/types.h>
14
15#define AUTOFS_DEVICE_NAME "autofs"
16
17#define AUTOFS_DEV_IOCTL_VERSION_MAJOR 1
18#define AUTOFS_DEV_IOCTL_VERSION_MINOR 0
19
20#define AUTOFS_DEVID_LEN 16
21
22#define AUTOFS_DEV_IOCTL_SIZE sizeof(struct autofs_dev_ioctl)
23
24/*
25 * An ioctl interface for autofs mount point control.
26 */
27
28/*
29 * All the ioctls use this structure.
30 * When sending a path size must account for the total length
31 * of the chunk of memory otherwise is is the size of the
32 * structure.
33 */
34
35struct autofs_dev_ioctl {
36 __u32 ver_major;
37 __u32 ver_minor;
38 __u32 size; /* total size of data passed in
39 * including this struct */
40 __s32 ioctlfd; /* automount command fd */
41
42 __u32 arg1; /* Command parameters */
43 __u32 arg2;
44
45 char path[0];
46};
47
48static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
49{
50 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
51 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
52 in->size = sizeof(struct autofs_dev_ioctl);
53 in->ioctlfd = -1;
54 in->arg1 = 0;
55 in->arg2 = 0;
56 return;
57}
58
59/*
60 * If you change this make sure you make the corresponding change
61 * to autofs-dev-ioctl.c:lookup_ioctl()
62 */
63enum {
64 /* Get various version info */
65 AUTOFS_DEV_IOCTL_VERSION_CMD = 0x71,
66 AUTOFS_DEV_IOCTL_PROTOVER_CMD,
67 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD,
68
69 /* Open mount ioctl fd */
70 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD,
71
72 /* Close mount ioctl fd */
73 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD,
74
75 /* Mount/expire status returns */
76 AUTOFS_DEV_IOCTL_READY_CMD,
77 AUTOFS_DEV_IOCTL_FAIL_CMD,
78
79 /* Activate/deactivate autofs mount */
80 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD,
81 AUTOFS_DEV_IOCTL_CATATONIC_CMD,
82
83 /* Expiry timeout */
84 AUTOFS_DEV_IOCTL_TIMEOUT_CMD,
85
86 /* Get mount last requesting uid and gid */
87 AUTOFS_DEV_IOCTL_REQUESTER_CMD,
88
89 /* Check for eligible expire candidates */
90 AUTOFS_DEV_IOCTL_EXPIRE_CMD,
91
92 /* Request busy status */
93 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD,
94
95 /* Check if path is a mountpoint */
96 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD,
97};
98
99#define AUTOFS_IOCTL 0x93
100
101#define AUTOFS_DEV_IOCTL_VERSION \
102 _IOWR(AUTOFS_IOCTL, \
103 AUTOFS_DEV_IOCTL_VERSION_CMD, struct autofs_dev_ioctl)
104
105#define AUTOFS_DEV_IOCTL_PROTOVER \
106 _IOWR(AUTOFS_IOCTL, \
107 AUTOFS_DEV_IOCTL_PROTOVER_CMD, struct autofs_dev_ioctl)
108
109#define AUTOFS_DEV_IOCTL_PROTOSUBVER \
110 _IOWR(AUTOFS_IOCTL, \
111 AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD, struct autofs_dev_ioctl)
112
113#define AUTOFS_DEV_IOCTL_OPENMOUNT \
114 _IOWR(AUTOFS_IOCTL, \
115 AUTOFS_DEV_IOCTL_OPENMOUNT_CMD, struct autofs_dev_ioctl)
116
117#define AUTOFS_DEV_IOCTL_CLOSEMOUNT \
118 _IOWR(AUTOFS_IOCTL, \
119 AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD, struct autofs_dev_ioctl)
120
121#define AUTOFS_DEV_IOCTL_READY \
122 _IOWR(AUTOFS_IOCTL, \
123 AUTOFS_DEV_IOCTL_READY_CMD, struct autofs_dev_ioctl)
124
125#define AUTOFS_DEV_IOCTL_FAIL \
126 _IOWR(AUTOFS_IOCTL, \
127 AUTOFS_DEV_IOCTL_FAIL_CMD, struct autofs_dev_ioctl)
128
129#define AUTOFS_DEV_IOCTL_SETPIPEFD \
130 _IOWR(AUTOFS_IOCTL, \
131 AUTOFS_DEV_IOCTL_SETPIPEFD_CMD, struct autofs_dev_ioctl)
132
133#define AUTOFS_DEV_IOCTL_CATATONIC \
134 _IOWR(AUTOFS_IOCTL, \
135 AUTOFS_DEV_IOCTL_CATATONIC_CMD, struct autofs_dev_ioctl)
136
137#define AUTOFS_DEV_IOCTL_TIMEOUT \
138 _IOWR(AUTOFS_IOCTL, \
139 AUTOFS_DEV_IOCTL_TIMEOUT_CMD, struct autofs_dev_ioctl)
140
141#define AUTOFS_DEV_IOCTL_REQUESTER \
142 _IOWR(AUTOFS_IOCTL, \
143 AUTOFS_DEV_IOCTL_REQUESTER_CMD, struct autofs_dev_ioctl)
144
145#define AUTOFS_DEV_IOCTL_EXPIRE \
146 _IOWR(AUTOFS_IOCTL, \
147 AUTOFS_DEV_IOCTL_EXPIRE_CMD, struct autofs_dev_ioctl)
148
149#define AUTOFS_DEV_IOCTL_ASKUMOUNT \
150 _IOWR(AUTOFS_IOCTL, \
151 AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD, struct autofs_dev_ioctl)
152
153#define AUTOFS_DEV_IOCTL_ISMOUNTPOINT \
154 _IOWR(AUTOFS_IOCTL, \
155 AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD, struct autofs_dev_ioctl)
156
157#endif /* _LINUX_AUTO_DEV_IOCTL_H */
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index b785c6f8644d..2253716d4b92 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -23,12 +23,17 @@
23#define AUTOFS_MIN_PROTO_VERSION 3 23#define AUTOFS_MIN_PROTO_VERSION 3
24#define AUTOFS_MAX_PROTO_VERSION 5 24#define AUTOFS_MAX_PROTO_VERSION 5
25 25
26#define AUTOFS_PROTO_SUBVERSION 0 26#define AUTOFS_PROTO_SUBVERSION 1
27 27
28/* Mask for expire behaviour */ 28/* Mask for expire behaviour */
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32#define AUTOFS_TYPE_ANY 0x0000
33#define AUTOFS_TYPE_INDIRECT 0x0001
34#define AUTOFS_TYPE_DIRECT 0x0002
35#define AUTOFS_TYPE_OFFSET 0x0004
36
32/* Daemon notification packet types */ 37/* Daemon notification packet types */
33enum autofs_notify { 38enum autofs_notify {
34 NFY_NONE, 39 NFY_NONE,
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 0a24d5550eb3..bee52abb8a4d 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -175,6 +175,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
175 * BDI_CAP_READ_MAP: Can be mapped for reading 175 * BDI_CAP_READ_MAP: Can be mapped for reading
176 * BDI_CAP_WRITE_MAP: Can be mapped for writing 176 * BDI_CAP_WRITE_MAP: Can be mapped for writing
177 * BDI_CAP_EXEC_MAP: Can be mapped for execution 177 * BDI_CAP_EXEC_MAP: Can be mapped for execution
178 *
179 * BDI_CAP_SWAP_BACKED: Count shmem/tmpfs objects as swap-backed.
178 */ 180 */
179#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 181#define BDI_CAP_NO_ACCT_DIRTY 0x00000001
180#define BDI_CAP_NO_WRITEBACK 0x00000002 182#define BDI_CAP_NO_WRITEBACK 0x00000002
@@ -184,6 +186,7 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned int max_ratio);
184#define BDI_CAP_WRITE_MAP 0x00000020 186#define BDI_CAP_WRITE_MAP 0x00000020
185#define BDI_CAP_EXEC_MAP 0x00000040 187#define BDI_CAP_EXEC_MAP 0x00000040
186#define BDI_CAP_NO_ACCT_WB 0x00000080 188#define BDI_CAP_NO_ACCT_WB 0x00000080
189#define BDI_CAP_SWAP_BACKED 0x00000100
187 190
188#define BDI_CAP_VMFLAGS \ 191#define BDI_CAP_VMFLAGS \
189 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) 192 (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
@@ -248,6 +251,11 @@ static inline bool bdi_cap_account_writeback(struct backing_dev_info *bdi)
248 BDI_CAP_NO_WRITEBACK)); 251 BDI_CAP_NO_WRITEBACK));
249} 252}
250 253
254static inline bool bdi_cap_swap_backed(struct backing_dev_info *bdi)
255{
256 return bdi->capabilities & BDI_CAP_SWAP_BACKED;
257}
258
251static inline bool mapping_cap_writeback_dirty(struct address_space *mapping) 259static inline bool mapping_cap_writeback_dirty(struct address_space *mapping)
252{ 260{
253 return bdi_cap_writeback_dirty(mapping->backing_dev_info); 261 return bdi_cap_writeback_dirty(mapping->backing_dev_info);
@@ -258,4 +266,9 @@ static inline bool mapping_cap_account_dirty(struct address_space *mapping)
258 return bdi_cap_account_dirty(mapping->backing_dev_info); 266 return bdi_cap_account_dirty(mapping->backing_dev_info);
259} 267}
260 268
269static inline bool mapping_cap_swap_backed(struct address_space *mapping)
270{
271 return bdi_cap_swap_backed(mapping->backing_dev_info);
272}
273
261#endif /* _LINUX_BACKING_DEV_H */ 274#endif /* _LINUX_BACKING_DEV_H */
diff --git a/include/linux/bcd.h b/include/linux/bcd.h
index 7ac518e3c152..22ea563ba3eb 100644
--- a/include/linux/bcd.h
+++ b/include/linux/bcd.h
@@ -1,12 +1,3 @@
1/* Permission is hereby granted to copy, modify and redistribute this code
2 * in terms of the GNU Library General Public License, Version 2 or later,
3 * at your option.
4 */
5
6/* macros to translate to/from binary and binary-coded decimal (frequently
7 * found in RTC chips).
8 */
9
10#ifndef _BCD_H 1#ifndef _BCD_H
11#define _BCD_H 2#define _BCD_H
12 3
@@ -15,11 +6,4 @@
15unsigned bcd2bin(unsigned char val) __attribute_const__; 6unsigned bcd2bin(unsigned char val) __attribute_const__;
16unsigned char bin2bcd(unsigned val) __attribute_const__; 7unsigned char bin2bcd(unsigned val) __attribute_const__;
17 8
18#define BCD2BIN(val) bcd2bin(val)
19#define BIN2BCD(val) bin2bcd(val)
20
21/* backwards compat */
22#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
23#define BIN_TO_BCD(val) ((val)=BIN2BCD(val))
24
25#endif /* _BCD_H */ 9#endif /* _BCD_H */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 826f62350805..7394b5b349ff 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -36,6 +36,10 @@ struct linux_binprm{
36 unsigned long p; /* current top of mem */ 36 unsigned long p; /* current top of mem */
37 unsigned int sh_bang:1, 37 unsigned int sh_bang:1,
38 misc_bang:1; 38 misc_bang:1;
39#ifdef __alpha__
40 unsigned int taso:1;
41#endif
42 unsigned int recursion_depth;
39 struct file * file; 43 struct file * file;
40 int e_uid, e_gid; 44 int e_uid, e_gid;
41 kernel_cap_t cap_post_exec_permitted; 45 kernel_cap_t cap_post_exec_permitted;
@@ -58,6 +62,7 @@ struct linux_binprm{
58#define BINPRM_FLAGS_EXECFD_BIT 1 62#define BINPRM_FLAGS_EXECFD_BIT 1
59#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT) 63#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
60 64
65#define BINPRM_MAX_RECURSION 4
61 66
62/* 67/*
63 * This structure defines the functions that are used to load the binary formats that 68 * This structure defines the functions that are used to load the binary formats that
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 0933a14e6414..1c91a176b9ae 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -26,21 +26,8 @@
26 26
27#ifdef CONFIG_BLOCK 27#ifdef CONFIG_BLOCK
28 28
29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
30#include <asm/io.h> 29#include <asm/io.h>
31 30
32#if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY)
33#define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1))
34#define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE)
35#else
36#define BIOVEC_VIRT_START_SIZE(x) 0
37#define BIOVEC_VIRT_OVERSIZE(x) 0
38#endif
39
40#ifndef BIO_VMERGE_BOUNDARY
41#define BIO_VMERGE_BOUNDARY 0
42#endif
43
44#define BIO_DEBUG 31#define BIO_DEBUG
45 32
46#ifdef BIO_DEBUG 33#ifdef BIO_DEBUG
@@ -88,25 +75,21 @@ struct bio {
88 /* Number of segments in this BIO after 75 /* Number of segments in this BIO after
89 * physical address coalescing is performed. 76 * physical address coalescing is performed.
90 */ 77 */
91 unsigned short bi_phys_segments; 78 unsigned int bi_phys_segments;
92
93 /* Number of segments after physical and DMA remapping
94 * hardware coalescing is performed.
95 */
96 unsigned short bi_hw_segments;
97 79
98 unsigned int bi_size; /* residual I/O count */ 80 unsigned int bi_size; /* residual I/O count */
99 81
100 /* 82 /*
101 * To keep track of the max hw size, we account for the 83 * To keep track of the max segment size, we account for the
102 * sizes of the first and last virtually mergeable segments 84 * sizes of the first and last mergeable segments in this bio.
103 * in this bio
104 */ 85 */
105 unsigned int bi_hw_front_size; 86 unsigned int bi_seg_front_size;
106 unsigned int bi_hw_back_size; 87 unsigned int bi_seg_back_size;
107 88
108 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ 89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
109 90
91 unsigned int bi_comp_cpu; /* completion CPU */
92
110 struct bio_vec *bi_io_vec; /* the actual vec list */ 93 struct bio_vec *bi_io_vec; /* the actual vec list */
111 94
112 bio_end_io_t *bi_end_io; 95 bio_end_io_t *bi_end_io;
@@ -126,11 +109,14 @@ struct bio {
126#define BIO_UPTODATE 0 /* ok after I/O completion */ 109#define BIO_UPTODATE 0 /* ok after I/O completion */
127#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ 110#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
128#define BIO_EOF 2 /* out-out-bounds error */ 111#define BIO_EOF 2 /* out-out-bounds error */
129#define BIO_SEG_VALID 3 /* nr_hw_seg valid */ 112#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
130#define BIO_CLONED 4 /* doesn't own data */ 113#define BIO_CLONED 4 /* doesn't own data */
131#define BIO_BOUNCED 5 /* bio is a bounce bio */ 114#define BIO_BOUNCED 5 /* bio is a bounce bio */
132#define BIO_USER_MAPPED 6 /* contains user pages */ 115#define BIO_USER_MAPPED 6 /* contains user pages */
133#define BIO_EOPNOTSUPP 7 /* not supported */ 116#define BIO_EOPNOTSUPP 7 /* not supported */
117#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
118#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
119#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
134#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 120#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
135 121
136/* 122/*
@@ -144,18 +130,36 @@ struct bio {
144/* 130/*
145 * bio bi_rw flags 131 * bio bi_rw flags
146 * 132 *
147 * bit 0 -- read (not set) or write (set) 133 * bit 0 -- data direction
134 * If not set, bio is a read from device. If set, it's a write to device.
148 * bit 1 -- rw-ahead when set 135 * bit 1 -- rw-ahead when set
149 * bit 2 -- barrier 136 * bit 2 -- barrier
150 * bit 3 -- fail fast, don't want low level driver retries 137 * Insert a serialization point in the IO queue, forcing previously
151 * bit 4 -- synchronous I/O hint: the block layer will unplug immediately 138 * submitted IO to be completed before this oen is issued.
139 * bit 3 -- synchronous I/O hint: the block layer will unplug immediately
140 * Note that this does NOT indicate that the IO itself is sync, just
141 * that the block layer will not postpone issue of this IO by plugging.
142 * bit 4 -- metadata request
143 * Used for tracing to differentiate metadata and data IO. May also
144 * get some preferential treatment in the IO scheduler
145 * bit 5 -- discard sectors
146 * Informs the lower level device that this range of sectors is no longer
147 * used by the file system and may thus be freed by the device. Used
148 * for flash based storage.
149 * bit 6 -- fail fast device errors
150 * bit 7 -- fail fast transport errors
151 * bit 8 -- fail fast driver errors
152 * Don't want driver retries for any fast fail whatever the reason.
152 */ 153 */
153#define BIO_RW 0 154#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
154#define BIO_RW_AHEAD 1 155#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
155#define BIO_RW_BARRIER 2 156#define BIO_RW_BARRIER 2
156#define BIO_RW_FAILFAST 3 157#define BIO_RW_SYNC 3
157#define BIO_RW_SYNC 4 158#define BIO_RW_META 4
158#define BIO_RW_META 5 159#define BIO_RW_DISCARD 5
160#define BIO_RW_FAILFAST_DEV 6
161#define BIO_RW_FAILFAST_TRANSPORT 7
162#define BIO_RW_FAILFAST_DRIVER 8
159 163
160/* 164/*
161 * upper 16 bits of bi_rw define the io priority of this bio 165 * upper 16 bits of bi_rw define the io priority of this bio
@@ -182,17 +186,21 @@ struct bio {
182#define bio_sectors(bio) ((bio)->bi_size >> 9) 186#define bio_sectors(bio) ((bio)->bi_size >> 9)
183#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) 187#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
184#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) 188#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
185#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) 189#define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV))
190#define bio_failfast_transport(bio) \
191 ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT))
192#define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER))
186#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) 193#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
187#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) 194#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
188#define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) 195#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
196#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
189 197
190static inline unsigned int bio_cur_sectors(struct bio *bio) 198static inline unsigned int bio_cur_sectors(struct bio *bio)
191{ 199{
192 if (bio->bi_vcnt) 200 if (bio->bi_vcnt)
193 return bio_iovec(bio)->bv_len >> 9; 201 return bio_iovec(bio)->bv_len >> 9;
194 202 else /* dataless requests such as discard */
195 return 0; 203 return bio->bi_size >> 9;
196} 204}
197 205
198static inline void *bio_data(struct bio *bio) 206static inline void *bio_data(struct bio *bio)
@@ -236,8 +244,6 @@ static inline void *bio_data(struct bio *bio)
236 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) 244 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
237#endif 245#endif
238 246
239#define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \
240 ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0)
241#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ 247#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
242 (((addr1) | (mask)) == (((addr2) - 1) | (mask))) 248 (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
243#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ 249#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
@@ -319,15 +325,14 @@ struct bio_pair {
319 atomic_t cnt; 325 atomic_t cnt;
320 int error; 326 int error;
321}; 327};
322extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, 328extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
323 int first_sectors);
324extern mempool_t *bio_split_pool;
325extern void bio_pair_release(struct bio_pair *dbio); 329extern void bio_pair_release(struct bio_pair *dbio);
326 330
327extern struct bio_set *bioset_create(int, int); 331extern struct bio_set *bioset_create(int, int);
328extern void bioset_free(struct bio_set *); 332extern void bioset_free(struct bio_set *);
329 333
330extern struct bio *bio_alloc(gfp_t, int); 334extern struct bio *bio_alloc(gfp_t, int);
335extern struct bio *bio_kmalloc(gfp_t, int);
331extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 336extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
332extern void bio_put(struct bio *); 337extern void bio_put(struct bio *);
333extern void bio_free(struct bio *, struct bio_set *); 338extern void bio_free(struct bio *, struct bio_set *);
@@ -335,7 +340,6 @@ extern void bio_free(struct bio *, struct bio_set *);
335extern void bio_endio(struct bio *, int); 340extern void bio_endio(struct bio *, int);
336struct request_queue; 341struct request_queue;
337extern int bio_phys_segments(struct request_queue *, struct bio *); 342extern int bio_phys_segments(struct request_queue *, struct bio *);
338extern int bio_hw_segments(struct request_queue *, struct bio *);
339 343
340extern void __bio_clone(struct bio *, struct bio *); 344extern void __bio_clone(struct bio *, struct bio *);
341extern struct bio *bio_clone(struct bio *, gfp_t); 345extern struct bio *bio_clone(struct bio *, gfp_t);
@@ -346,12 +350,14 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
346extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, 350extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
347 unsigned int, unsigned int); 351 unsigned int, unsigned int);
348extern int bio_get_nr_vecs(struct block_device *); 352extern int bio_get_nr_vecs(struct block_device *);
353extern sector_t bio_sector_offset(struct bio *, unsigned short, unsigned int);
349extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 354extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
350 unsigned long, unsigned int, int); 355 unsigned long, unsigned int, int, gfp_t);
351struct sg_iovec; 356struct sg_iovec;
357struct rq_map_data;
352extern struct bio *bio_map_user_iov(struct request_queue *, 358extern struct bio *bio_map_user_iov(struct request_queue *,
353 struct block_device *, 359 struct block_device *,
354 struct sg_iovec *, int, int); 360 struct sg_iovec *, int, int, gfp_t);
355extern void bio_unmap_user(struct bio *); 361extern void bio_unmap_user(struct bio *);
356extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 362extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
357 gfp_t); 363 gfp_t);
@@ -359,15 +365,25 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
359 gfp_t, int); 365 gfp_t, int);
360extern void bio_set_pages_dirty(struct bio *bio); 366extern void bio_set_pages_dirty(struct bio *bio);
361extern void bio_check_pages_dirty(struct bio *bio); 367extern void bio_check_pages_dirty(struct bio *bio);
362extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 368extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
363extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, 369 unsigned long, unsigned int, int, gfp_t);
364 int, int); 370extern struct bio *bio_copy_user_iov(struct request_queue *,
371 struct rq_map_data *, struct sg_iovec *,
372 int, int, gfp_t);
365extern int bio_uncopy_user(struct bio *); 373extern int bio_uncopy_user(struct bio *);
366void zero_fill_bio(struct bio *bio); 374void zero_fill_bio(struct bio *bio);
367extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 375extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
368extern unsigned int bvec_nr_vecs(unsigned short idx); 376extern unsigned int bvec_nr_vecs(unsigned short idx);
369 377
370/* 378/*
379 * Allow queuer to specify a completion CPU for this bio
380 */
381static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu)
382{
383 bio->bi_comp_cpu = cpu;
384}
385
386/*
371 * bio_set is used to allow other portions of the IO system to 387 * bio_set is used to allow other portions of the IO system to
372 * allocate their own private memory pools for bio and iovec structures. 388 * allocate their own private memory pools for bio and iovec structures.
373 * These memory pools in turn all allocate from the bio_slab 389 * These memory pools in turn all allocate from the bio_slab
@@ -445,6 +461,14 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 461 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 462#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
447 463
464/*
465 * Check whether this bio carries any data or not. A NULL bio is allowed.
466 */
467static inline int bio_has_data(struct bio *bio)
468{
469 return bio && bio->bi_io_vec != NULL;
470}
471
448#if defined(CONFIG_BLK_DEV_INTEGRITY) 472#if defined(CONFIG_BLK_DEV_INTEGRITY)
449 473
450#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) 474#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
@@ -458,14 +482,7 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
458#define bip_for_each_vec(bvl, bip, i) \ 482#define bip_for_each_vec(bvl, bip, i) \
459 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) 483 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
460 484
461static inline int bio_integrity(struct bio *bio) 485#define bio_integrity(bio) (bio->bi_integrity != NULL)
462{
463#if defined(CONFIG_BLK_DEV_INTEGRITY)
464 return bio->bi_integrity != NULL;
465#else
466 return 0;
467#endif
468}
469 486
470extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); 487extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
471extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 488extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 89781fd48859..a08c33a26ca9 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -110,7 +110,6 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
110 110
111extern int bitmap_scnprintf(char *buf, unsigned int len, 111extern int bitmap_scnprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 112 const unsigned long *src, int nbits);
113extern int bitmap_scnprintf_len(unsigned int nr_bits);
114extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 113extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
115 unsigned long *dst, int nbits); 114 unsigned long *dst, int nbits);
116extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 115extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
@@ -130,6 +129,7 @@ extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
130extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 129extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
131extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 130extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
132extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 131extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
132extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
133 133
134#define BITMAP_LAST_WORD_MASK(nbits) \ 134#define BITMAP_LAST_WORD_MASK(nbits) \
135( \ 135( \
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 53ea933cf60b..a135256b272c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -16,7 +16,9 @@
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/stringify.h> 18#include <linux/stringify.h>
19#include <linux/gfp.h>
19#include <linux/bsg.h> 20#include <linux/bsg.h>
21#include <linux/smp.h>
20 22
21#include <asm/scatterlist.h> 23#include <asm/scatterlist.h>
22 24
@@ -54,7 +56,6 @@ enum rq_cmd_type_bits {
54 REQ_TYPE_PM_SUSPEND, /* suspend request */ 56 REQ_TYPE_PM_SUSPEND, /* suspend request */
55 REQ_TYPE_PM_RESUME, /* resume request */ 57 REQ_TYPE_PM_RESUME, /* resume request */
56 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 58 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
57 REQ_TYPE_FLUSH, /* flush request */
58 REQ_TYPE_SPECIAL, /* driver defined type */ 59 REQ_TYPE_SPECIAL, /* driver defined type */
59 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ 60 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
60 /* 61 /*
@@ -76,19 +77,20 @@ enum rq_cmd_type_bits {
76 * 77 *
77 */ 78 */
78enum { 79enum {
79 /*
80 * just examples for now
81 */
82 REQ_LB_OP_EJECT = 0x40, /* eject request */ 80 REQ_LB_OP_EJECT = 0x40, /* eject request */
83 REQ_LB_OP_FLUSH = 0x41, /* flush device */ 81 REQ_LB_OP_FLUSH = 0x41, /* flush request */
82 REQ_LB_OP_DISCARD = 0x42, /* discard sectors */
84}; 83};
85 84
86/* 85/*
87 * request type modified bits. first three bits match BIO_RW* bits, important 86 * request type modified bits. first two bits match BIO_RW* bits, important
88 */ 87 */
89enum rq_flag_bits { 88enum rq_flag_bits {
90 __REQ_RW, /* not set, read. set, write */ 89 __REQ_RW, /* not set, read. set, write */
91 __REQ_FAILFAST, /* no low level driver retries */ 90 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
91 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
92 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
93 __REQ_DISCARD, /* request to discard sectors */
92 __REQ_SORTED, /* elevator knows about this request */ 94 __REQ_SORTED, /* elevator knows about this request */
93 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 95 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
94 __REQ_HARDBARRIER, /* may not be passed by drive either */ 96 __REQ_HARDBARRIER, /* may not be passed by drive either */
@@ -111,7 +113,10 @@ enum rq_flag_bits {
111}; 113};
112 114
113#define REQ_RW (1 << __REQ_RW) 115#define REQ_RW (1 << __REQ_RW)
114#define REQ_FAILFAST (1 << __REQ_FAILFAST) 116#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
117#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
118#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
119#define REQ_DISCARD (1 << __REQ_DISCARD)
115#define REQ_SORTED (1 << __REQ_SORTED) 120#define REQ_SORTED (1 << __REQ_SORTED)
116#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 121#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
117#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) 122#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
@@ -140,12 +145,14 @@ enum rq_flag_bits {
140 */ 145 */
141struct request { 146struct request {
142 struct list_head queuelist; 147 struct list_head queuelist;
143 struct list_head donelist; 148 struct call_single_data csd;
149 int cpu;
144 150
145 struct request_queue *q; 151 struct request_queue *q;
146 152
147 unsigned int cmd_flags; 153 unsigned int cmd_flags;
148 enum rq_cmd_type_bits cmd_type; 154 enum rq_cmd_type_bits cmd_type;
155 unsigned long atomic_flags;
149 156
150 /* Maintain bio traversal state for part by part I/O submission. 157 /* Maintain bio traversal state for part by part I/O submission.
151 * hard_* are block layer internals, no driver should touch them! 158 * hard_* are block layer internals, no driver should touch them!
@@ -190,13 +197,6 @@ struct request {
190 */ 197 */
191 unsigned short nr_phys_segments; 198 unsigned short nr_phys_segments;
192 199
193 /* Number of scatter-gather addr+len pairs after
194 * physical and DMA remapping hardware coalescing is performed.
195 * This is the number of scatter-gather entries the driver
196 * will actually have to deal with after DMA mapping is done.
197 */
198 unsigned short nr_hw_segments;
199
200 unsigned short ioprio; 200 unsigned short ioprio;
201 201
202 void *special; 202 void *special;
@@ -220,6 +220,8 @@ struct request {
220 void *data; 220 void *data;
221 void *sense; 221 void *sense;
222 222
223 unsigned long deadline;
224 struct list_head timeout_list;
223 unsigned int timeout; 225 unsigned int timeout;
224 int retries; 226 int retries;
225 227
@@ -233,6 +235,11 @@ struct request {
233 struct request *next_rq; 235 struct request *next_rq;
234}; 236};
235 237
238static inline unsigned short req_get_ioprio(struct request *req)
239{
240 return req->ioprio;
241}
242
236/* 243/*
237 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME 244 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
238 * requests. Some step values could eventually be made generic. 245 * requests. Some step values could eventually be made generic.
@@ -252,6 +259,7 @@ typedef void (request_fn_proc) (struct request_queue *q);
252typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 259typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
253typedef int (prep_rq_fn) (struct request_queue *, struct request *); 260typedef int (prep_rq_fn) (struct request_queue *, struct request *);
254typedef void (unplug_fn) (struct request_queue *); 261typedef void (unplug_fn) (struct request_queue *);
262typedef int (prepare_discard_fn) (struct request_queue *, struct request *);
255 263
256struct bio_vec; 264struct bio_vec;
257struct bvec_merge_data { 265struct bvec_merge_data {
@@ -265,6 +273,15 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
265typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 273typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
266typedef void (softirq_done_fn)(struct request *); 274typedef void (softirq_done_fn)(struct request *);
267typedef int (dma_drain_needed_fn)(struct request *); 275typedef int (dma_drain_needed_fn)(struct request *);
276typedef int (lld_busy_fn) (struct request_queue *q);
277
278enum blk_eh_timer_return {
279 BLK_EH_NOT_HANDLED,
280 BLK_EH_HANDLED,
281 BLK_EH_RESET_TIMER,
282};
283
284typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *);
268 285
269enum blk_queue_state { 286enum blk_queue_state {
270 Queue_down, 287 Queue_down,
@@ -307,10 +324,13 @@ struct request_queue
307 make_request_fn *make_request_fn; 324 make_request_fn *make_request_fn;
308 prep_rq_fn *prep_rq_fn; 325 prep_rq_fn *prep_rq_fn;
309 unplug_fn *unplug_fn; 326 unplug_fn *unplug_fn;
327 prepare_discard_fn *prepare_discard_fn;
310 merge_bvec_fn *merge_bvec_fn; 328 merge_bvec_fn *merge_bvec_fn;
311 prepare_flush_fn *prepare_flush_fn; 329 prepare_flush_fn *prepare_flush_fn;
312 softirq_done_fn *softirq_done_fn; 330 softirq_done_fn *softirq_done_fn;
331 rq_timed_out_fn *rq_timed_out_fn;
313 dma_drain_needed_fn *dma_drain_needed; 332 dma_drain_needed_fn *dma_drain_needed;
333 lld_busy_fn *lld_busy_fn;
314 334
315 /* 335 /*
316 * Dispatch queue sorting 336 * Dispatch queue sorting
@@ -385,6 +405,10 @@ struct request_queue
385 unsigned int nr_sorted; 405 unsigned int nr_sorted;
386 unsigned int in_flight; 406 unsigned int in_flight;
387 407
408 unsigned int rq_timeout;
409 struct timer_list timeout;
410 struct list_head timeout_list;
411
388 /* 412 /*
389 * sg stuff 413 * sg stuff
390 */ 414 */
@@ -421,6 +445,10 @@ struct request_queue
421#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 445#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
422#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 446#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */
423#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ 447#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */
448#define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */
449#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */
450#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
451#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
424 452
425static inline int queue_is_locked(struct request_queue *q) 453static inline int queue_is_locked(struct request_queue *q)
426{ 454{
@@ -526,26 +554,36 @@ enum {
526#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 554#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
527#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 555#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
528#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 556#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
557#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
529#define blk_queue_flushing(q) ((q)->ordseq) 558#define blk_queue_flushing(q) ((q)->ordseq)
559#define blk_queue_stackable(q) \
560 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
530 561
531#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 562#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
532#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 563#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
533#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) 564#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
534#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) 565#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
535 566
536#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) 567#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV)
568#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT)
569#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER)
570#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \
571 blk_failfast_transport(rq) || \
572 blk_failfast_driver(rq))
537#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) 573#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
538 574
539#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) 575#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
540 576
541#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) 577#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
542#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) 578#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
543#define blk_pm_request(rq) \ 579#define blk_pm_request(rq) \
544 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 580 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq))
545 581
582#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
546#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) 583#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
547#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) 584#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
548#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 585#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
586#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
549#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 587#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
550#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) 588#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
551/* rq->queuelist of dequeued request must be list_empty() */ 589/* rq->queuelist of dequeued request must be list_empty() */
@@ -592,7 +630,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw)
592#define RQ_NOMERGE_FLAGS \ 630#define RQ_NOMERGE_FLAGS \
593 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 631 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
594#define rq_mergeable(rq) \ 632#define rq_mergeable(rq) \
595 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) 633 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
634 (blk_discard_rq(rq) || blk_fs_request((rq))))
596 635
597/* 636/*
598 * q->prep_rq_fn return values 637 * q->prep_rq_fn return values
@@ -637,6 +676,12 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
637} 676}
638#endif /* CONFIG_MMU */ 677#endif /* CONFIG_MMU */
639 678
679struct rq_map_data {
680 struct page **pages;
681 int page_order;
682 int nr_entries;
683};
684
640struct req_iterator { 685struct req_iterator {
641 int i; 686 int i;
642 struct bio *bio; 687 struct bio *bio;
@@ -664,14 +709,18 @@ extern void __blk_put_request(struct request_queue *, struct request *);
664extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 709extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
665extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 710extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
666extern void blk_requeue_request(struct request_queue *, struct request *); 711extern void blk_requeue_request(struct request_queue *, struct request *);
712extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
713extern int blk_lld_busy(struct request_queue *q);
714extern int blk_insert_cloned_request(struct request_queue *q,
715 struct request *rq);
667extern void blk_plug_device(struct request_queue *); 716extern void blk_plug_device(struct request_queue *);
668extern void blk_plug_device_unlocked(struct request_queue *); 717extern void blk_plug_device_unlocked(struct request_queue *);
669extern int blk_remove_plug(struct request_queue *); 718extern int blk_remove_plug(struct request_queue *);
670extern void blk_recount_segments(struct request_queue *, struct bio *); 719extern void blk_recount_segments(struct request_queue *, struct bio *);
671extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 720extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
672 struct gendisk *, unsigned int, void __user *); 721 unsigned int, void __user *);
673extern int sg_scsi_ioctl(struct file *, struct request_queue *, 722extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
674 struct gendisk *, struct scsi_ioctl_command __user *); 723 struct scsi_ioctl_command __user *);
675 724
676/* 725/*
677 * Temporary export, until SCSI gets fixed up. 726 * Temporary export, until SCSI gets fixed up.
@@ -705,11 +754,14 @@ extern void __blk_stop_queue(struct request_queue *q);
705extern void __blk_run_queue(struct request_queue *); 754extern void __blk_run_queue(struct request_queue *);
706extern void blk_run_queue(struct request_queue *); 755extern void blk_run_queue(struct request_queue *);
707extern void blk_start_queueing(struct request_queue *); 756extern void blk_start_queueing(struct request_queue *);
708extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); 757extern int blk_rq_map_user(struct request_queue *, struct request *,
758 struct rq_map_data *, void __user *, unsigned long,
759 gfp_t);
709extern int blk_rq_unmap_user(struct bio *); 760extern int blk_rq_unmap_user(struct bio *);
710extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); 761extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t);
711extern int blk_rq_map_user_iov(struct request_queue *, struct request *, 762extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
712 struct sg_iovec *, int, unsigned int); 763 struct rq_map_data *, struct sg_iovec *, int,
764 unsigned int, gfp_t);
713extern int blk_execute_rq(struct request_queue *, struct gendisk *, 765extern int blk_execute_rq(struct request_queue *, struct gendisk *,
714 struct request *, int); 766 struct request *, int);
715extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 767extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
@@ -750,12 +802,15 @@ extern int __blk_end_request(struct request *rq, int error,
750extern int blk_end_bidi_request(struct request *rq, int error, 802extern int blk_end_bidi_request(struct request *rq, int error,
751 unsigned int nr_bytes, unsigned int bidi_bytes); 803 unsigned int nr_bytes, unsigned int bidi_bytes);
752extern void end_request(struct request *, int); 804extern void end_request(struct request *, int);
753extern void end_queued_request(struct request *, int);
754extern void end_dequeued_request(struct request *, int);
755extern int blk_end_request_callback(struct request *rq, int error, 805extern int blk_end_request_callback(struct request *rq, int error,
756 unsigned int nr_bytes, 806 unsigned int nr_bytes,
757 int (drv_callback)(struct request *)); 807 int (drv_callback)(struct request *));
758extern void blk_complete_request(struct request *); 808extern void blk_complete_request(struct request *);
809extern void __blk_complete_request(struct request *);
810extern void blk_abort_request(struct request *);
811extern void blk_abort_queue(struct request_queue *);
812extern void blk_update_request(struct request *rq, int error,
813 unsigned int nr_bytes);
759 814
760/* 815/*
761 * blk_end_request() takes bytes instead of sectors as a complete size. 816 * blk_end_request() takes bytes instead of sectors as a complete size.
@@ -790,12 +845,16 @@ extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
790extern int blk_queue_dma_drain(struct request_queue *q, 845extern int blk_queue_dma_drain(struct request_queue *q,
791 dma_drain_needed_fn *dma_drain_needed, 846 dma_drain_needed_fn *dma_drain_needed,
792 void *buf, unsigned int size); 847 void *buf, unsigned int size);
848extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
793extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 849extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
794extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 850extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
795extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 851extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
796extern void blk_queue_dma_alignment(struct request_queue *, int); 852extern void blk_queue_dma_alignment(struct request_queue *, int);
797extern void blk_queue_update_dma_alignment(struct request_queue *, int); 853extern void blk_queue_update_dma_alignment(struct request_queue *, int);
798extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 854extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
855extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *);
856extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
857extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
799extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 858extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
800extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 859extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
801extern int blk_do_ordered(struct request_queue *, struct request **); 860extern int blk_do_ordered(struct request_queue *, struct request **);
@@ -806,7 +865,6 @@ extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int);
806extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 865extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
807extern void blk_dump_rq_flags(struct request *, char *); 866extern void blk_dump_rq_flags(struct request *, char *);
808extern void generic_unplug_device(struct request_queue *); 867extern void generic_unplug_device(struct request_queue *);
809extern void __generic_unplug_device(struct request_queue *);
810extern long nr_blockdev_pages(void); 868extern long nr_blockdev_pages(void);
811 869
812int blk_get_queue(struct request_queue *); 870int blk_get_queue(struct request_queue *);
@@ -837,12 +895,23 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
837} 895}
838 896
839extern int blkdev_issue_flush(struct block_device *, sector_t *); 897extern int blkdev_issue_flush(struct block_device *, sector_t *);
898extern int blkdev_issue_discard(struct block_device *,
899 sector_t sector, sector_t nr_sects, gfp_t);
900
901static inline int sb_issue_discard(struct super_block *sb,
902 sector_t block, sector_t nr_blocks)
903{
904 block <<= (sb->s_blocksize_bits - 9);
905 nr_blocks <<= (sb->s_blocksize_bits - 9);
906 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL);
907}
840 908
841/* 909/*
842* command filter functions 910* command filter functions
843*/ 911*/
844extern int blk_verify_command(struct blk_cmd_filter *filter, 912extern int blk_verify_command(struct blk_cmd_filter *filter,
845 unsigned char *cmd, int has_write_perm); 913 unsigned char *cmd, fmode_t has_write_perm);
914extern void blk_unregister_filter(struct gendisk *disk);
846extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); 915extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
847 916
848#define MAX_PHYS_SEGMENTS 128 917#define MAX_PHYS_SEGMENTS 128
@@ -874,6 +943,13 @@ static inline int queue_dma_alignment(struct request_queue *q)
874 return q ? q->dma_alignment : 511; 943 return q ? q->dma_alignment : 511;
875} 944}
876 945
946static inline int blk_rq_aligned(struct request_queue *q, void *addr,
947 unsigned int len)
948{
949 unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask;
950 return !((unsigned long)addr & alignment) && !(len & alignment);
951}
952
877/* assumes size > 256 */ 953/* assumes size > 256 */
878static inline unsigned int blksize_bits(unsigned int size) 954static inline unsigned int blksize_bits(unsigned int size)
879{ 955{
@@ -900,7 +976,7 @@ static inline void put_dev_sector(Sector p)
900} 976}
901 977
902struct work_struct; 978struct work_struct;
903int kblockd_schedule_work(struct work_struct *work); 979int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
904void kblockd_flush_work(struct work_struct *work); 980void kblockd_flush_work(struct work_struct *work);
905 981
906#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 982#define MODULE_ALIAS_BLOCKDEV(major,minor) \
@@ -945,49 +1021,19 @@ struct blk_integrity {
945 1021
946extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); 1022extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
947extern void blk_integrity_unregister(struct gendisk *); 1023extern void blk_integrity_unregister(struct gendisk *);
948extern int blk_integrity_compare(struct block_device *, struct block_device *); 1024extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
949extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); 1025extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *);
950extern int blk_rq_count_integrity_sg(struct request *); 1026extern int blk_rq_count_integrity_sg(struct request *);
951 1027
952static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi) 1028static inline
953{ 1029struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
954 if (bi)
955 return bi->tuple_size;
956
957 return 0;
958}
959
960static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
961{ 1030{
962 return bdev->bd_disk->integrity; 1031 return bdev->bd_disk->integrity;
963} 1032}
964 1033
965static inline unsigned int bdev_get_tag_size(struct block_device *bdev) 1034static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
966{
967 struct blk_integrity *bi = bdev_get_integrity(bdev);
968
969 if (bi)
970 return bi->tag_size;
971
972 return 0;
973}
974
975static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
976{ 1035{
977 struct blk_integrity *bi = bdev_get_integrity(bdev); 1036 return disk->integrity;
978
979 if (bi == NULL)
980 return 0;
981
982 if (rw == READ && bi->verify_fn != NULL &&
983 (bi->flags & INTEGRITY_FLAG_READ))
984 return 1;
985
986 if (rw == WRITE && bi->generate_fn != NULL &&
987 (bi->flags & INTEGRITY_FLAG_WRITE))
988 return 1;
989
990 return 0;
991} 1037}
992 1038
993static inline int blk_integrity_rq(struct request *rq) 1039static inline int blk_integrity_rq(struct request *rq)
@@ -1004,13 +1050,29 @@ static inline int blk_integrity_rq(struct request *rq)
1004#define blk_rq_count_integrity_sg(a) (0) 1050#define blk_rq_count_integrity_sg(a) (0)
1005#define blk_rq_map_integrity_sg(a, b) (0) 1051#define blk_rq_map_integrity_sg(a, b) (0)
1006#define bdev_get_integrity(a) (0) 1052#define bdev_get_integrity(a) (0)
1007#define bdev_get_tag_size(a) (0) 1053#define blk_get_integrity(a) (0)
1008#define blk_integrity_compare(a, b) (0) 1054#define blk_integrity_compare(a, b) (0)
1009#define blk_integrity_register(a, b) (0) 1055#define blk_integrity_register(a, b) (0)
1010#define blk_integrity_unregister(a) do { } while (0); 1056#define blk_integrity_unregister(a) do { } while (0);
1011 1057
1012#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1058#endif /* CONFIG_BLK_DEV_INTEGRITY */
1013 1059
1060struct block_device_operations {
1061 int (*open) (struct block_device *, fmode_t);
1062 int (*release) (struct gendisk *, fmode_t);
1063 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1064 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1065 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1066 int (*direct_access) (struct block_device *, sector_t,
1067 void **, unsigned long *);
1068 int (*media_changed) (struct gendisk *);
1069 int (*revalidate_disk) (struct gendisk *);
1070 int (*getgeo)(struct block_device *, struct hd_geometry *);
1071 struct module *owner;
1072};
1073
1074extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
1075 unsigned long);
1014#else /* CONFIG_BLOCK */ 1076#else /* CONFIG_BLOCK */
1015/* 1077/*
1016 * stubs for when the block layer is configured out 1078 * stubs for when the block layer is configured out
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index d084b8d227a5..bdf505d33e77 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -1,8 +1,10 @@
1#ifndef BLKTRACE_H 1#ifndef BLKTRACE_H
2#define BLKTRACE_H 2#define BLKTRACE_H
3 3
4#ifdef __KERNEL__
4#include <linux/blkdev.h> 5#include <linux/blkdev.h>
5#include <linux/relay.h> 6#include <linux/relay.h>
7#endif
6 8
7/* 9/*
8 * Trace categories 10 * Trace categories
@@ -21,6 +23,8 @@ enum blktrace_cat {
21 BLK_TC_NOTIFY = 1 << 10, /* special message */ 23 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */ 24 BLK_TC_AHEAD = 1 << 11, /* readahead */
23 BLK_TC_META = 1 << 12, /* metadata */ 25 BLK_TC_META = 1 << 12, /* metadata */
26 BLK_TC_DISCARD = 1 << 13, /* discard requests */
27 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
24 28
25 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 29 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
26}; 30};
@@ -47,6 +51,8 @@ enum blktrace_act {
47 __BLK_TA_SPLIT, /* bio was split */ 51 __BLK_TA_SPLIT, /* bio was split */
48 __BLK_TA_BOUNCE, /* bio was bounced */ 52 __BLK_TA_BOUNCE, /* bio was bounced */
49 __BLK_TA_REMAP, /* bio was remapped */ 53 __BLK_TA_REMAP, /* bio was remapped */
54 __BLK_TA_ABORT, /* request aborted */
55 __BLK_TA_DRV_DATA, /* driver-specific binary data */
50}; 56};
51 57
52/* 58/*
@@ -77,6 +83,8 @@ enum blktrace_notify {
77#define BLK_TA_SPLIT (__BLK_TA_SPLIT) 83#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
78#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) 84#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
79#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) 85#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
86#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
87#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
80 88
81#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) 89#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
82#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) 90#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
@@ -89,17 +97,17 @@ enum blktrace_notify {
89 * The trace itself 97 * The trace itself
90 */ 98 */
91struct blk_io_trace { 99struct blk_io_trace {
92 u32 magic; /* MAGIC << 8 | version */ 100 __u32 magic; /* MAGIC << 8 | version */
93 u32 sequence; /* event number */ 101 __u32 sequence; /* event number */
94 u64 time; /* in microseconds */ 102 __u64 time; /* in microseconds */
95 u64 sector; /* disk offset */ 103 __u64 sector; /* disk offset */
96 u32 bytes; /* transfer length */ 104 __u32 bytes; /* transfer length */
97 u32 action; /* what happened */ 105 __u32 action; /* what happened */
98 u32 pid; /* who did it */ 106 __u32 pid; /* who did it */
99 u32 device; /* device number */ 107 __u32 device; /* device number */
100 u32 cpu; /* on what cpu did it happen */ 108 __u32 cpu; /* on what cpu did it happen */
101 u16 error; /* completion error */ 109 __u16 error; /* completion error */
102 u16 pdu_len; /* length of data after this trace */ 110 __u16 pdu_len; /* length of data after this trace */
103}; 111};
104 112
105/* 113/*
@@ -117,6 +125,23 @@ enum {
117 Blktrace_stopped, 125 Blktrace_stopped,
118}; 126};
119 127
128#define BLKTRACE_BDEV_SIZE 32
129
130/*
131 * User setup structure passed with BLKTRACESTART
132 */
133struct blk_user_trace_setup {
134 char name[BLKTRACE_BDEV_SIZE]; /* output */
135 __u16 act_mask; /* input */
136 __u32 buf_size; /* input */
137 __u32 buf_nr; /* input */
138 __u64 start_lba;
139 __u64 end_lba;
140 __u32 pid;
141};
142
143#ifdef __KERNEL__
144#if defined(CONFIG_BLK_DEV_IO_TRACE)
120struct blk_trace { 145struct blk_trace {
121 int trace_state; 146 int trace_state;
122 struct rchan *rchan; 147 struct rchan *rchan;
@@ -133,21 +158,6 @@ struct blk_trace {
133 atomic_t dropped; 158 atomic_t dropped;
134}; 159};
135 160
136/*
137 * User setup structure passed with BLKTRACESTART
138 */
139struct blk_user_trace_setup {
140 char name[BDEVNAME_SIZE]; /* output */
141 u16 act_mask; /* input */
142 u32 buf_size; /* input */
143 u32 buf_nr; /* input */
144 u64 start_lba;
145 u64 end_lba;
146 u32 pid;
147};
148
149#ifdef __KERNEL__
150#if defined(CONFIG_BLK_DEV_IO_TRACE)
151extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 161extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
152extern void blk_trace_shutdown(struct request_queue *); 162extern void blk_trace_shutdown(struct request_queue *);
153extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 163extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
@@ -195,6 +205,9 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
195 if (likely(!bt)) 205 if (likely(!bt))
196 return; 206 return;
197 207
208 if (blk_discard_rq(rq))
209 rw |= (1 << BIO_RW_DISCARD);
210
198 if (blk_pc_request(rq)) { 211 if (blk_pc_request(rq)) {
199 what |= BLK_TC_ACT(BLK_TC_PC); 212 what |= BLK_TC_ACT(BLK_TC_PC);
200 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); 213 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
@@ -307,6 +320,34 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
307 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 320 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
308} 321}
309 322
323/**
324 * blk_add_driver_data - Add binary message with driver-specific data
325 * @q: queue the io is for
326 * @rq: io request
327 * @data: driver-specific data
328 * @len: length of driver-specific data
329 *
330 * Description:
331 * Some drivers might want to write driver-specific data per request.
332 *
333 **/
334static inline void blk_add_driver_data(struct request_queue *q,
335 struct request *rq,
336 void *data, size_t len)
337{
338 struct blk_trace *bt = q->blk_trace;
339
340 if (likely(!bt))
341 return;
342
343 if (blk_pc_request(rq))
344 __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA,
345 rq->errors, len, data);
346 else
347 __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9,
348 0, BLK_TA_DRV_DATA, rq->errors, len, data);
349}
350
310extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, 351extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
311 char __user *arg); 352 char __user *arg);
312extern int blk_trace_startstop(struct request_queue *q, int start); 353extern int blk_trace_startstop(struct request_queue *q, int start);
@@ -320,6 +361,7 @@ extern int blk_trace_remove(struct request_queue *q);
320#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 361#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
321#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 362#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
322#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 363#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
364#define blk_add_driver_data(q, rq, data, len) do {} while (0)
323#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) 365#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
324#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 366#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
325#define blk_trace_startstop(q, start) (-ENOTTY) 367#define blk_trace_startstop(q, start) (-ENOTTY)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index eadaab44015f..3ce64b90118c 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -322,7 +322,7 @@ static inline void wait_on_buffer(struct buffer_head *bh)
322 322
323static inline int trylock_buffer(struct buffer_head *bh) 323static inline int trylock_buffer(struct buffer_head *bh)
324{ 324{
325 return likely(!test_and_set_bit(BH_Lock, &bh->b_state)); 325 return likely(!test_and_set_bit_lock(BH_Lock, &bh->b_state));
326} 326}
327 327
328static inline void lock_buffer(struct buffer_head *bh) 328static inline void lock_buffer(struct buffer_head *bh)
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index 1133d5f9d818..fbaa7f9cee32 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,3 +1,4 @@
1unifdef-y += big_endian.h 1unifdef-y += big_endian.h
2unifdef-y += little_endian.h 2unifdef-y += little_endian.h
3unifdef-y += swab.h 3unifdef-y += swab.h
4unifdef-y += swabb.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 44f95b92393b..1cba3f3efe5f 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/byteorder/swab.h>
13#include <linux/byteorder/swabb.h>
13 14
14#define __constant_htonl(x) ((__force __be32)(__u32)(x)) 15#define __constant_htonl(x) ((__force __be32)(__u32)(x))
15#define __constant_ntohl(x) ((__force __u32)(__be32)(x)) 16#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 4cc170a31762..cedc1b5a289c 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/byteorder/swab.h>
13#include <linux/byteorder/swabb.h>
13 14
14#define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) 15#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
15#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) 16#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 5db265ea60f6..0b49e08d3cb0 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -987,11 +987,11 @@ struct cdrom_device_ops {
987}; 987};
988 988
989/* the general block_device operations structure: */ 989/* the general block_device operations structure: */
990extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, 990extern int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
991 struct file *fp); 991 fmode_t mode);
992extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp); 992extern void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode);
993extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi, 993extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
994 struct inode *ip, unsigned int cmd, unsigned long arg); 994 fmode_t mode, unsigned int cmd, unsigned long arg);
995extern int cdrom_media_changed(struct cdrom_device_info *); 995extern int cdrom_media_changed(struct cdrom_device_info *);
996 996
997extern int register_cdrom(struct cdrom_device_info *cdi); 997extern int register_cdrom(struct cdrom_device_info *cdi);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c98dd7cb7076..8b00f6643e93 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -9,12 +9,12 @@
9 */ 9 */
10 10
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/kref.h>
13#include <linux/cpumask.h> 12#include <linux/cpumask.h>
14#include <linux/nodemask.h> 13#include <linux/nodemask.h>
15#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
16#include <linux/cgroupstats.h> 15#include <linux/cgroupstats.h>
17#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h>
18 18
19#ifdef CONFIG_CGROUPS 19#ifdef CONFIG_CGROUPS
20 20
@@ -137,6 +137,15 @@ struct cgroup {
137 * release_list_lock 137 * release_list_lock
138 */ 138 */
139 struct list_head release_list; 139 struct list_head release_list;
140
141 /* pids_mutex protects the fields below */
142 struct rw_semaphore pids_mutex;
143 /* Array of process ids in the cgroup */
144 pid_t *tasks_pids;
145 /* How many files are using the current tasks_pids array */
146 int pids_use_count;
147 /* Length of the current tasks_pids array */
148 int pids_length;
140}; 149};
141 150
142/* A css_set is a structure holding pointers to a set of 151/* A css_set is a structure holding pointers to a set of
@@ -149,7 +158,7 @@ struct cgroup {
149struct css_set { 158struct css_set {
150 159
151 /* Reference count */ 160 /* Reference count */
152 struct kref ref; 161 atomic_t refcount;
153 162
154 /* 163 /*
155 * List running through all cgroup groups in the same hash 164 * List running through all cgroup groups in the same hash
@@ -326,7 +335,8 @@ struct cgroup_subsys {
326 */ 335 */
327 void (*mm_owner_changed)(struct cgroup_subsys *ss, 336 void (*mm_owner_changed)(struct cgroup_subsys *ss,
328 struct cgroup *old, 337 struct cgroup *old,
329 struct cgroup *new); 338 struct cgroup *new,
339 struct task_struct *p);
330 int subsys_id; 340 int subsys_id;
331 int active; 341 int active;
332 int disabled; 342 int disabled;
@@ -393,6 +403,9 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
393int cgroup_scan_tasks(struct cgroup_scanner *scan); 403int cgroup_scan_tasks(struct cgroup_scanner *scan);
394int cgroup_attach_task(struct cgroup *, struct task_struct *); 404int cgroup_attach_task(struct cgroup *, struct task_struct *);
395 405
406void cgroup_mm_owner_callbacks(struct task_struct *old,
407 struct task_struct *new);
408
396#else /* !CONFIG_CGROUPS */ 409#else /* !CONFIG_CGROUPS */
397 410
398static inline int cgroup_init_early(void) { return 0; } 411static inline int cgroup_init_early(void) { return 0; }
@@ -411,15 +424,9 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
411 return -EINVAL; 424 return -EINVAL;
412} 425}
413 426
427static inline void cgroup_mm_owner_callbacks(struct task_struct *old,
428 struct task_struct *new) {}
429
414#endif /* !CONFIG_CGROUPS */ 430#endif /* !CONFIG_CGROUPS */
415 431
416#ifdef CONFIG_MM_OWNER
417extern void
418cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new);
419#else /* !CONFIG_MM_OWNER */
420static inline void
421cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
422{
423}
424#endif /* CONFIG_MM_OWNER */
425#endif /* _LINUX_CGROUP_H */ 432#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index e2877454ec82..9c22396e8b50 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -48,3 +48,9 @@ SUBSYS(devices)
48#endif 48#endif
49 49
50/* */ 50/* */
51
52#ifdef CONFIG_CGROUP_FREEZER
53SUBSYS(freezer)
54#endif
55
56/* */
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 5ca8c6fddb56..778777316ea4 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -35,6 +35,8 @@ struct clk;
35 * clk_get may return different clock producers depending on @dev.) 35 * clk_get may return different clock producers depending on @dev.)
36 * 36 *
37 * Drivers must assume that the clock source is not enabled. 37 * Drivers must assume that the clock source is not enabled.
38 *
39 * clk_get should not be called from within interrupt context.
38 */ 40 */
39struct clk *clk_get(struct device *dev, const char *id); 41struct clk *clk_get(struct device *dev, const char *id);
40 42
@@ -76,6 +78,8 @@ unsigned long clk_get_rate(struct clk *clk);
76 * Note: drivers must ensure that all clk_enable calls made on this 78 * Note: drivers must ensure that all clk_enable calls made on this
77 * clock source are balanced by clk_disable calls prior to calling 79 * clock source are balanced by clk_disable calls prior to calling
78 * this function. 80 * this function.
81 *
82 * clk_put should not be called from within interrupt context.
79 */ 83 */
80void clk_put(struct clk *clk); 84void clk_put(struct clk *clk);
81 85
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 55e434feec99..f88d32f8ff7c 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -45,7 +45,8 @@ struct clocksource;
45 * @read: returns a cycle value 45 * @read: returns a cycle value
46 * @mask: bitmask for two's complement 46 * @mask: bitmask for two's complement
47 * subtraction of non 64 bit counters 47 * subtraction of non 64 bit counters
48 * @mult: cycle to nanosecond multiplier 48 * @mult: cycle to nanosecond multiplier (adjusted by NTP)
49 * @mult_orig: cycle to nanosecond multiplier (unadjusted by NTP)
49 * @shift: cycle to nanosecond divisor (power of two) 50 * @shift: cycle to nanosecond divisor (power of two)
50 * @flags: flags describing special properties 51 * @flags: flags describing special properties
51 * @vread: vsyscall based read 52 * @vread: vsyscall based read
@@ -63,6 +64,7 @@ struct clocksource {
63 cycle_t (*read)(void); 64 cycle_t (*read)(void);
64 cycle_t mask; 65 cycle_t mask;
65 u32 mult; 66 u32 mult;
67 u32 mult_orig;
66 u32 shift; 68 u32 shift;
67 unsigned long flags; 69 unsigned long flags;
68 cycle_t (*vread)(void); 70 cycle_t (*vread)(void);
@@ -77,6 +79,7 @@ struct clocksource {
77 /* timekeeping specific data, ignore */ 79 /* timekeeping specific data, ignore */
78 cycle_t cycle_interval; 80 cycle_t cycle_interval;
79 u64 xtime_interval; 81 u64 xtime_interval;
82 u32 raw_interval;
80 /* 83 /*
81 * Second part is written at each timer interrupt 84 * Second part is written at each timer interrupt
82 * Keep it in a different cache line to dirty no 85 * Keep it in a different cache line to dirty no
@@ -85,6 +88,7 @@ struct clocksource {
85 cycle_t cycle_last ____cacheline_aligned_in_smp; 88 cycle_t cycle_last ____cacheline_aligned_in_smp;
86 u64 xtime_nsec; 89 u64 xtime_nsec;
87 s64 error; 90 s64 error;
91 struct timespec raw_time;
88 92
89#ifdef CONFIG_CLOCKSOURCE_WATCHDOG 93#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
90 /* Watchdog related data, used by the framework */ 94 /* Watchdog related data, used by the framework */
@@ -201,17 +205,19 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
201{ 205{
202 u64 tmp; 206 u64 tmp;
203 207
204 /* XXX - All of this could use a whole lot of optimization */ 208 /* Do the ns -> cycle conversion first, using original mult */
205 tmp = length_nsec; 209 tmp = length_nsec;
206 tmp <<= c->shift; 210 tmp <<= c->shift;
207 tmp += c->mult/2; 211 tmp += c->mult_orig/2;
208 do_div(tmp, c->mult); 212 do_div(tmp, c->mult_orig);
209 213
210 c->cycle_interval = (cycle_t)tmp; 214 c->cycle_interval = (cycle_t)tmp;
211 if (c->cycle_interval == 0) 215 if (c->cycle_interval == 0)
212 c->cycle_interval = 1; 216 c->cycle_interval = 1;
213 217
218 /* Go back from cycles -> shifted ns, this time use ntp adjused mult */
214 c->xtime_interval = (u64)c->cycle_interval * c->mult; 219 c->xtime_interval = (u64)c->cycle_interval * c->mult;
220 c->raw_interval = ((u64)c->cycle_interval * c->mult_orig) >> c->shift;
215} 221}
216 222
217 223
diff --git a/include/linux/compat.h b/include/linux/compat.h
index cf8d11cad5ae..f061a1ea1b74 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -78,7 +78,6 @@ typedef struct {
78 compat_sigset_word sig[_COMPAT_NSIG_WORDS]; 78 compat_sigset_word sig[_COMPAT_NSIG_WORDS];
79} compat_sigset_t; 79} compat_sigset_t;
80 80
81extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
82extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *); 81extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
83extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *); 82extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
84 83
@@ -235,6 +234,11 @@ extern int get_compat_itimerspec(struct itimerspec *dst,
235extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, 234extern int put_compat_itimerspec(struct compat_itimerspec __user *dst,
236 const struct itimerspec *src); 235 const struct itimerspec *src);
237 236
237asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
238 struct timezone __user *tz);
239asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
240 struct timezone __user *tz);
241
238asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 242asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
239 243
240extern int compat_printk(const char *fmt, ...); 244extern int compat_printk(const char *fmt, ...);
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c8bd2daf95ec..98115d9d04da 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -44,6 +44,8 @@ extern void __chk_io_ptr(const volatile void __iomem *);
44# error Sorry, your compiler is too old/not recognized. 44# error Sorry, your compiler is too old/not recognized.
45#endif 45#endif
46 46
47#define notrace __attribute__((no_instrument_function))
48
47/* Intel compiler defines __GNUC__. So we will overwrite implementations 49/* Intel compiler defines __GNUC__. So we will overwrite implementations
48 * coming from above header files here 50 * coming from above header files here
49 */ 51 */
@@ -190,7 +192,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
190 * ACCESS_ONCE() in different C statements. 192 * ACCESS_ONCE() in different C statements.
191 * 193 *
192 * This macro does absolutely -nothing- to prevent the CPU from reordering, 194 * This macro does absolutely -nothing- to prevent the CPU from reordering,
193 * merging, or refetching absolutely anything at any time. 195 * merging, or refetching absolutely anything at any time. Its main intended
196 * use is to mediate communication between process-level code and irq/NMI
197 * handlers, all running on the same CPU.
194 */ 198 */
195#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) 199#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
196 200
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 02ef8835999c..4a6b604ef7e4 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -10,6 +10,18 @@
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
12 12
13/**
14 * struct completion - structure used to maintain state for a "completion"
15 *
16 * This is the opaque structure used to maintain the state for a "completion".
17 * Completions currently use a FIFO to queue threads that have to wait for
18 * the "completion" event.
19 *
20 * See also: complete(), wait_for_completion() (and friends _timeout,
21 * _interruptible, _interruptible_timeout, and _killable), init_completion(),
22 * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and
23 * INIT_COMPLETION().
24 */
13struct completion { 25struct completion {
14 unsigned int done; 26 unsigned int done;
15 wait_queue_head_t wait; 27 wait_queue_head_t wait;
@@ -21,6 +33,14 @@ struct completion {
21#define COMPLETION_INITIALIZER_ONSTACK(work) \ 33#define COMPLETION_INITIALIZER_ONSTACK(work) \
22 ({ init_completion(&work); work; }) 34 ({ init_completion(&work); work; })
23 35
36/**
37 * DECLARE_COMPLETION: - declare and initialize a completion structure
38 * @work: identifier for the completion structure
39 *
40 * This macro declares and initializes a completion structure. Generally used
41 * for static declarations. You should use the _ONSTACK variant for automatic
42 * variables.
43 */
24#define DECLARE_COMPLETION(work) \ 44#define DECLARE_COMPLETION(work) \
25 struct completion work = COMPLETION_INITIALIZER(work) 45 struct completion work = COMPLETION_INITIALIZER(work)
26 46
@@ -29,6 +49,13 @@ struct completion {
29 * completions - so we use the _ONSTACK() variant for those that 49 * completions - so we use the _ONSTACK() variant for those that
30 * are on the kernel stack: 50 * are on the kernel stack:
31 */ 51 */
52/**
53 * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure
54 * @work: identifier for the completion structure
55 *
56 * This macro declares and initializes a completion structure on the kernel
57 * stack.
58 */
32#ifdef CONFIG_LOCKDEP 59#ifdef CONFIG_LOCKDEP
33# define DECLARE_COMPLETION_ONSTACK(work) \ 60# define DECLARE_COMPLETION_ONSTACK(work) \
34 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) 61 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
@@ -36,6 +63,13 @@ struct completion {
36# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) 63# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
37#endif 64#endif
38 65
66/**
67 * init_completion: - Initialize a dynamically allocated completion
68 * @x: completion structure that is to be initialized
69 *
70 * This inline function will initialize a dynamically created completion
71 * structure.
72 */
39static inline void init_completion(struct completion *x) 73static inline void init_completion(struct completion *x)
40{ 74{
41 x->done = 0; 75 x->done = 0;
@@ -55,6 +89,13 @@ extern bool completion_done(struct completion *x);
55extern void complete(struct completion *); 89extern void complete(struct completion *);
56extern void complete_all(struct completion *); 90extern void complete_all(struct completion *);
57 91
92/**
93 * INIT_COMPLETION: - reinitialize a completion structure
94 * @x: completion structure to be reinitialized
95 *
96 * This macro should be used to reinitialize a completion structure so it can
97 * be reused. This is especially important after complete_all() is used.
98 */
58#define INIT_COMPLETION(x) ((x).done = 0) 99#define INIT_COMPLETION(x) ((x).done = 0)
59 100
60 101
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index b03f80a078be..d71f7c0f931b 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -53,7 +53,6 @@ struct vc_data {
53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ 53 unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
54 struct console_font vc_font; /* Current VC font set */ 54 struct console_font vc_font; /* Current VC font set */
55 unsigned short vc_video_erase_char; /* Background erase character */ 55 unsigned short vc_video_erase_char; /* Background erase character */
56 unsigned short vc_scrl_erase_char; /* Erase character for scroll */
57 /* VT terminal data */ 56 /* VT terminal data */
58 unsigned int vc_state; /* Escape sequence parser state */ 57 unsigned int vc_state; /* Escape sequence parser state */
59 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index d7faf8808497..c2747ac2ae43 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,6 +69,7 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
69#endif 69#endif
70 70
71int cpu_up(unsigned int cpu); 71int cpu_up(unsigned int cpu);
72void notify_cpu_starting(unsigned int cpu);
72extern void cpu_hotplug_init(void); 73extern void cpu_hotplug_init(void);
73extern void cpu_maps_update_begin(void); 74extern void cpu_maps_update_begin(void);
74extern void cpu_maps_update_done(void); 75extern void cpu_maps_update_done(void);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 6fd5668aa572..1ee608fd7b77 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -187,7 +187,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
187 unsigned int relation); 187 unsigned int relation);
188 188
189 189
190extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); 190extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
191 unsigned int cpu);
191 192
192int cpufreq_register_governor(struct cpufreq_governor *governor); 193int cpufreq_register_governor(struct cpufreq_governor *governor);
193void cpufreq_unregister_governor(struct cpufreq_governor *governor); 194void cpufreq_unregister_governor(struct cpufreq_governor *governor);
@@ -226,7 +227,9 @@ struct cpufreq_driver {
226 unsigned int (*get) (unsigned int cpu); 227 unsigned int (*get) (unsigned int cpu);
227 228
228 /* optional */ 229 /* optional */
229 unsigned int (*getavg) (unsigned int cpu); 230 unsigned int (*getavg) (struct cpufreq_policy *policy,
231 unsigned int cpu);
232
230 int (*exit) (struct cpufreq_policy *policy); 233 int (*exit) (struct cpufreq_policy *policy);
231 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
232 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 025e4f575103..2dac064d8359 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -8,17 +8,12 @@
8#include <linux/proc_fs.h> 8#include <linux/proc_fs.h>
9 9
10#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
11#define ELFCORE_ADDR_ERR (-2ULL)
11 12
12#ifdef CONFIG_PROC_VMCORE
13extern unsigned long long elfcorehdr_addr; 13extern unsigned long long elfcorehdr_addr;
14#else
15static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
16#endif
17 14
18extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 15extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
19 unsigned long, int); 16 unsigned long, int);
20extern const struct file_operations proc_vmcore_operations;
21extern struct proc_dir_entry *proc_vmcore;
22 17
23/* Architecture code defines this if there are other possible ELF 18/* Architecture code defines this if there are other possible ELF
24 * machine types, e.g. on bi-arch capable hardware. */ 19 * machine types, e.g. on bi-arch capable hardware. */
@@ -28,10 +23,43 @@ extern struct proc_dir_entry *proc_vmcore;
28 23
29#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) 24#define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
30 25
26/*
27 * is_kdump_kernel() checks whether this kernel is booting after a panic of
28 * previous kernel or not. This is determined by checking if previous kernel
29 * has passed the elf core header address on command line.
30 *
31 * This is not just a test if CONFIG_CRASH_DUMP is enabled or not. It will
32 * return 1 if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic of
33 * previous kernel.
34 */
35
31static inline int is_kdump_kernel(void) 36static inline int is_kdump_kernel(void)
32{ 37{
33 return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; 38 return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0;
34} 39}
40
41/* is_vmcore_usable() checks if the kernel is booting after a panic and
42 * the vmcore region is usable.
43 *
44 * This makes use of the fact that due to alignment -2ULL is not
45 * a valid pointer, much in the vain of IS_ERR(), except
46 * dealing directly with an unsigned long long rather than a pointer.
47 */
48
49static inline int is_vmcore_usable(void)
50{
51 return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0;
52}
53
54/* vmcore_unusable() marks the vmcore as unusable,
55 * without disturbing the logic of is_kdump_kernel()
56 */
57
58static inline void vmcore_unusable(void)
59{
60 if (is_kdump_kernel())
61 elfcorehdr_addr = ELFCORE_ADDR_ERR;
62}
35#else /* !CONFIG_CRASH_DUMP */ 63#else /* !CONFIG_CRASH_DUMP */
36static inline int is_kdump_kernel(void) { return 0; } 64static inline int is_kdump_kernel(void) { return 0; }
37#endif /* CONFIG_CRASH_DUMP */ 65#endif /* CONFIG_CRASH_DUMP */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c43dc47fdf75..3d2317e4af2e 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -38,6 +38,7 @@
38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_HASH 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
41#define CRYPTO_ALG_TYPE_RNG 0x0000000c
41 42
42#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 43#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
43#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c 44#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
@@ -61,6 +62,14 @@
61#define CRYPTO_ALG_GENIV 0x00000200 62#define CRYPTO_ALG_GENIV 0x00000200
62 63
63/* 64/*
65 * Set if the algorithm has passed automated run-time testing. Note that
66 * if there is no run-time testing for a given algorithm it is considered
67 * to have passed.
68 */
69
70#define CRYPTO_ALG_TESTED 0x00000400
71
72/*
64 * Transform masks and values (for crt_flags). 73 * Transform masks and values (for crt_flags).
65 */ 74 */
66#define CRYPTO_TFM_REQ_MASK 0x000fff00 75#define CRYPTO_TFM_REQ_MASK 0x000fff00
@@ -105,6 +114,7 @@ struct crypto_aead;
105struct crypto_blkcipher; 114struct crypto_blkcipher;
106struct crypto_hash; 115struct crypto_hash;
107struct crypto_ahash; 116struct crypto_ahash;
117struct crypto_rng;
108struct crypto_tfm; 118struct crypto_tfm;
109struct crypto_type; 119struct crypto_type;
110struct aead_givcrypt_request; 120struct aead_givcrypt_request;
@@ -290,6 +300,15 @@ struct compress_alg {
290 unsigned int slen, u8 *dst, unsigned int *dlen); 300 unsigned int slen, u8 *dst, unsigned int *dlen);
291}; 301};
292 302
303struct rng_alg {
304 int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata,
305 unsigned int dlen);
306 int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen);
307
308 unsigned int seedsize;
309};
310
311
293#define cra_ablkcipher cra_u.ablkcipher 312#define cra_ablkcipher cra_u.ablkcipher
294#define cra_aead cra_u.aead 313#define cra_aead cra_u.aead
295#define cra_blkcipher cra_u.blkcipher 314#define cra_blkcipher cra_u.blkcipher
@@ -298,6 +317,7 @@ struct compress_alg {
298#define cra_hash cra_u.hash 317#define cra_hash cra_u.hash
299#define cra_ahash cra_u.ahash 318#define cra_ahash cra_u.ahash
300#define cra_compress cra_u.compress 319#define cra_compress cra_u.compress
320#define cra_rng cra_u.rng
301 321
302struct crypto_alg { 322struct crypto_alg {
303 struct list_head cra_list; 323 struct list_head cra_list;
@@ -325,6 +345,7 @@ struct crypto_alg {
325 struct hash_alg hash; 345 struct hash_alg hash;
326 struct ahash_alg ahash; 346 struct ahash_alg ahash;
327 struct compress_alg compress; 347 struct compress_alg compress;
348 struct rng_alg rng;
328 } cra_u; 349 } cra_u;
329 350
330 int (*cra_init)(struct crypto_tfm *tfm); 351 int (*cra_init)(struct crypto_tfm *tfm);
@@ -430,6 +451,12 @@ struct compress_tfm {
430 u8 *dst, unsigned int *dlen); 451 u8 *dst, unsigned int *dlen);
431}; 452};
432 453
454struct rng_tfm {
455 int (*rng_gen_random)(struct crypto_rng *tfm, u8 *rdata,
456 unsigned int dlen);
457 int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen);
458};
459
433#define crt_ablkcipher crt_u.ablkcipher 460#define crt_ablkcipher crt_u.ablkcipher
434#define crt_aead crt_u.aead 461#define crt_aead crt_u.aead
435#define crt_blkcipher crt_u.blkcipher 462#define crt_blkcipher crt_u.blkcipher
@@ -437,6 +464,7 @@ struct compress_tfm {
437#define crt_hash crt_u.hash 464#define crt_hash crt_u.hash
438#define crt_ahash crt_u.ahash 465#define crt_ahash crt_u.ahash
439#define crt_compress crt_u.compress 466#define crt_compress crt_u.compress
467#define crt_rng crt_u.rng
440 468
441struct crypto_tfm { 469struct crypto_tfm {
442 470
@@ -450,6 +478,7 @@ struct crypto_tfm {
450 struct hash_tfm hash; 478 struct hash_tfm hash;
451 struct ahash_tfm ahash; 479 struct ahash_tfm ahash;
452 struct compress_tfm compress; 480 struct compress_tfm compress;
481 struct rng_tfm rng;
453 } crt_u; 482 } crt_u;
454 483
455 struct crypto_alg *__crt_alg; 484 struct crypto_alg *__crt_alg;
@@ -481,6 +510,10 @@ struct crypto_hash {
481 struct crypto_tfm base; 510 struct crypto_tfm base;
482}; 511};
483 512
513struct crypto_rng {
514 struct crypto_tfm base;
515};
516
484enum { 517enum {
485 CRYPTOA_UNSPEC, 518 CRYPTOA_UNSPEC,
486 CRYPTOA_ALG, 519 CRYPTOA_ALG,
@@ -515,6 +548,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
515struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 548struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
516void crypto_free_tfm(struct crypto_tfm *tfm); 549void crypto_free_tfm(struct crypto_tfm *tfm);
517 550
551int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
552
518/* 553/*
519 * Transform helpers which query the underlying algorithm. 554 * Transform helpers which query the underlying algorithm.
520 */ 555 */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index efba1de629ac..a37359d0bad1 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -228,9 +228,9 @@ extern void d_delete(struct dentry *);
228 228
229/* allocate/de-allocate */ 229/* allocate/de-allocate */
230extern struct dentry * d_alloc(struct dentry *, const struct qstr *); 230extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
231extern struct dentry * d_alloc_anon(struct inode *);
232extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 231extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
233extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 232extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
233extern struct dentry * d_obtain_alias(struct inode *);
234extern void shrink_dcache_sb(struct super_block *); 234extern void shrink_dcache_sb(struct super_block *);
235extern void shrink_dcache_parent(struct dentry *); 235extern void shrink_dcache_parent(struct dentry *);
236extern void shrink_dcache_for_umount(struct super_block *); 236extern void shrink_dcache_for_umount(struct super_block *);
@@ -287,6 +287,7 @@ static inline struct dentry *d_add_unique(struct dentry *entry, struct inode *in
287 287
288/* used for rename() and baskets */ 288/* used for rename() and baskets */
289extern void d_move(struct dentry *, struct dentry *); 289extern void d_move(struct dentry *, struct dentry *);
290extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
290 291
291/* appendix may either be NULL or be used for transname suffixes */ 292/* appendix may either be NULL or be used for transname suffixes */
292extern struct dentry * d_lookup(struct dentry *, struct qstr *); 293extern struct dentry * d_lookup(struct dentry *, struct qstr *);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index a90222e3297d..c17fd334e574 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -13,7 +13,6 @@
13 13
14struct dm_target; 14struct dm_target;
15struct dm_table; 15struct dm_table;
16struct dm_dev;
17struct mapped_device; 16struct mapped_device;
18struct bio_vec; 17struct bio_vec;
19 18
@@ -70,8 +69,7 @@ typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
70 69
71typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv); 70typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
72 71
73typedef int (*dm_ioctl_fn) (struct dm_target *ti, struct inode *inode, 72typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
74 struct file *filp, unsigned int cmd,
75 unsigned long arg); 73 unsigned long arg);
76 74
77typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 75typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
@@ -84,13 +82,19 @@ void dm_error(const char *message);
84 */ 82 */
85void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); 83void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
86 84
85struct dm_dev {
86 struct block_device *bdev;
87 fmode_t mode;
88 char name[16];
89};
90
87/* 91/*
88 * Constructors should call these functions to ensure destination devices 92 * Constructors should call these functions to ensure destination devices
89 * are opened/closed correctly. 93 * are opened/closed correctly.
90 * FIXME: too many arguments. 94 * FIXME: too many arguments.
91 */ 95 */
92int dm_get_device(struct dm_target *ti, const char *path, sector_t start, 96int dm_get_device(struct dm_target *ti, const char *path, sector_t start,
93 sector_t len, int mode, struct dm_dev **result); 97 sector_t len, fmode_t mode, struct dm_dev **result);
94void dm_put_device(struct dm_target *ti, struct dm_dev *d); 98void dm_put_device(struct dm_target *ti, struct dm_dev *d);
95 99
96/* 100/*
@@ -202,6 +206,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
202struct gendisk *dm_disk(struct mapped_device *md); 206struct gendisk *dm_disk(struct mapped_device *md);
203int dm_suspended(struct mapped_device *md); 207int dm_suspended(struct mapped_device *md);
204int dm_noflush_suspending(struct dm_target *ti); 208int dm_noflush_suspending(struct dm_target *ti);
209union map_info *dm_get_mapinfo(struct bio *bio);
205 210
206/* 211/*
207 * Geometry functions. 212 * Geometry functions.
@@ -217,7 +222,7 @@ int dm_set_geometry(struct mapped_device *md, struct hd_geometry *geo);
217/* 222/*
218 * First create an empty table. 223 * First create an empty table.
219 */ 224 */
220int dm_table_create(struct dm_table **result, int mode, 225int dm_table_create(struct dm_table **result, fmode_t mode,
221 unsigned num_targets, struct mapped_device *md); 226 unsigned num_targets, struct mapped_device *md);
222 227
223/* 228/*
@@ -232,6 +237,11 @@ int dm_table_add_target(struct dm_table *t, const char *type,
232int dm_table_complete(struct dm_table *t); 237int dm_table_complete(struct dm_table *t);
233 238
234/* 239/*
240 * Unplug all devices in a table.
241 */
242void dm_table_unplug_all(struct dm_table *t);
243
244/*
235 * Table reference counting. 245 * Table reference counting.
236 */ 246 */
237struct dm_table *dm_get_table(struct mapped_device *md); 247struct dm_table *dm_get_table(struct mapped_device *md);
@@ -243,7 +253,7 @@ void dm_table_put(struct dm_table *t);
243 */ 253 */
244sector_t dm_table_get_size(struct dm_table *t); 254sector_t dm_table_get_size(struct dm_table *t);
245unsigned int dm_table_get_num_targets(struct dm_table *t); 255unsigned int dm_table_get_num_targets(struct dm_table *t);
246int dm_table_get_mode(struct dm_table *t); 256fmode_t dm_table_get_mode(struct dm_table *t);
247struct mapped_device *dm_table_get_md(struct dm_table *t); 257struct mapped_device *dm_table_get_md(struct dm_table *t);
248 258
249/* 259/*
@@ -256,6 +266,11 @@ void dm_table_event(struct dm_table *t);
256 */ 266 */
257int dm_swap_table(struct mapped_device *md, struct dm_table *t); 267int dm_swap_table(struct mapped_device *md, struct dm_table *t);
258 268
269/*
270 * A wrapper around vmalloc.
271 */
272void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
273
259/*----------------------------------------------------------------- 274/*-----------------------------------------------------------------
260 * Macros. 275 * Macros.
261 *---------------------------------------------------------------*/ 276 *---------------------------------------------------------------*/
@@ -338,6 +353,9 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *t);
338 */ 353 */
339#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz)) 354#define dm_round_up(n, sz) (dm_div_up((n), (sz)) * (sz))
340 355
356#define dm_array_too_big(fixed, obj, num) \
357 ((num) > (UINT_MAX - (fixed)) / (obj))
358
341static inline sector_t to_sector(unsigned long n) 359static inline sector_t to_sector(unsigned long n)
342{ 360{
343 return (n >> SECTOR_SHIFT); 361 return (n >> SECTOR_SHIFT);
diff --git a/include/linux/device.h b/include/linux/device.h
index 4d8372d135df..1a3686d15f98 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -90,6 +90,9 @@ int __must_check bus_for_each_drv(struct bus_type *bus,
90 struct device_driver *start, void *data, 90 struct device_driver *start, void *data,
91 int (*fn)(struct device_driver *, void *)); 91 int (*fn)(struct device_driver *, void *));
92 92
93void bus_sort_breadthfirst(struct bus_type *bus,
94 int (*compare)(const struct device *a,
95 const struct device *b));
93/* 96/*
94 * Bus notifiers: Get notified of addition/removal of devices 97 * Bus notifiers: Get notified of addition/removal of devices
95 * and binding/unbinding of drivers to devices. 98 * and binding/unbinding of drivers to devices.
@@ -199,6 +202,11 @@ struct class {
199 struct class_private *p; 202 struct class_private *p;
200}; 203};
201 204
205struct class_dev_iter {
206 struct klist_iter ki;
207 const struct device_type *type;
208};
209
202extern struct kobject *sysfs_dev_block_kobj; 210extern struct kobject *sysfs_dev_block_kobj;
203extern struct kobject *sysfs_dev_char_kobj; 211extern struct kobject *sysfs_dev_char_kobj;
204extern int __must_check __class_register(struct class *class, 212extern int __must_check __class_register(struct class *class,
@@ -213,6 +221,13 @@ extern void class_unregister(struct class *class);
213 __class_register(class, &__key); \ 221 __class_register(class, &__key); \
214}) 222})
215 223
224extern void class_dev_iter_init(struct class_dev_iter *iter,
225 struct class *class,
226 struct device *start,
227 const struct device_type *type);
228extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
229extern void class_dev_iter_exit(struct class_dev_iter *iter);
230
216extern int class_for_each_device(struct class *class, struct device *start, 231extern int class_for_each_device(struct class *class, struct device *start,
217 void *data, 232 void *data,
218 int (*fn)(struct device *dev, void *data)); 233 int (*fn)(struct device *dev, void *data));
@@ -396,7 +411,7 @@ struct device {
396 spinlock_t devres_lock; 411 spinlock_t devres_lock;
397 struct list_head devres_head; 412 struct list_head devres_head;
398 413
399 struct list_head node; 414 struct klist_node knode_class;
400 struct class *class; 415 struct class *class;
401 dev_t devt; /* dev_t, creates the sysfs "dev" */ 416 dev_t devt; /* dev_t, creates the sysfs "dev" */
402 struct attribute_group **groups; /* optional groups */ 417 struct attribute_group **groups; /* optional groups */
@@ -435,7 +450,7 @@ static inline void set_dev_node(struct device *dev, int node)
435} 450}
436#endif 451#endif
437 452
438static inline void *dev_get_drvdata(struct device *dev) 453static inline void *dev_get_drvdata(const struct device *dev)
439{ 454{
440 return dev->driver_data; 455 return dev->driver_data;
441} 456}
@@ -490,7 +505,6 @@ extern struct device *device_create(struct class *cls, struct device *parent,
490 dev_t devt, void *drvdata, 505 dev_t devt, void *drvdata,
491 const char *fmt, ...) 506 const char *fmt, ...)
492 __attribute__((format(printf, 5, 6))); 507 __attribute__((format(printf, 5, 6)));
493#define device_create_drvdata device_create
494extern void device_destroy(struct class *cls, dev_t devt); 508extern void device_destroy(struct class *cls, dev_t devt);
495 509
496/* 510/*
@@ -539,7 +553,11 @@ extern const char *dev_driver_string(const struct device *dev);
539#define dev_info(dev, format, arg...) \ 553#define dev_info(dev, format, arg...) \
540 dev_printk(KERN_INFO , dev , format , ## arg) 554 dev_printk(KERN_INFO , dev , format , ## arg)
541 555
542#ifdef DEBUG 556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0)
560#elif defined(DEBUG)
543#define dev_dbg(dev, format, arg...) \ 561#define dev_dbg(dev, format, arg...) \
544 dev_printk(KERN_DEBUG , dev , format , ## arg) 562 dev_printk(KERN_DEBUG , dev , format , ## arg)
545#else 563#else
@@ -555,6 +573,14 @@ extern const char *dev_driver_string(const struct device *dev);
555 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 573 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
556#endif 574#endif
557 575
576/*
577 * dev_WARN() acts like dev_printk(), but with the key difference
578 * of using a WARN/WARN_ON to get the message out, including the
579 * file/line information and a backtrace.
580 */
581#define dev_WARN(dev, format, arg...) \
582 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
583
558/* Create alias, so I can be autoloaded. */ 584/* Create alias, so I can be autoloaded. */
559#define MODULE_ALIAS_CHARDEV(major,minor) \ 585#define MODULE_ALIAS_CHARDEV(major,minor) \
560 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 586 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h
index 154769cad3f3..5ce0e5fd712e 100644
--- a/include/linux/devpts_fs.h
+++ b/include/linux/devpts_fs.h
@@ -17,20 +17,31 @@
17 17
18#ifdef CONFIG_UNIX98_PTYS 18#ifdef CONFIG_UNIX98_PTYS
19 19
20int devpts_new_index(void); 20int devpts_new_index(struct inode *ptmx_inode);
21void devpts_kill_index(int idx); 21void devpts_kill_index(struct inode *ptmx_inode, int idx);
22int devpts_pty_new(struct tty_struct *tty); /* mknod in devpts */ 22/* mknod in devpts */
23struct tty_struct *devpts_get_tty(int number); /* get tty structure */ 23int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty);
24void devpts_pty_kill(int number); /* unlink */ 24/* get tty structure */
25struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number);
26/* unlink */
27void devpts_pty_kill(struct tty_struct *tty);
25 28
26#else 29#else
27 30
28/* Dummy stubs in the no-pty case */ 31/* Dummy stubs in the no-pty case */
29static inline int devpts_new_index(void) { return -EINVAL; } 32static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; }
30static inline void devpts_kill_index(int idx) { } 33static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { }
31static inline int devpts_pty_new(struct tty_struct *tty) { return -EINVAL; } 34static inline int devpts_pty_new(struct inode *ptmx_inode,
32static inline struct tty_struct *devpts_get_tty(int number) { return NULL; } 35 struct tty_struct *tty)
33static inline void devpts_pty_kill(int number) { } 36{
37 return -EINVAL;
38}
39static inline struct tty_struct *devpts_get_tty(struct inode *pts_inode,
40 int number)
41{
42 return NULL;
43}
44static inline void devpts_pty_kill(struct tty_struct *tty) { }
34 45
35#endif 46#endif
36 47
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 203a025e30e5..b9cd38603fd8 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -65,9 +65,12 @@ struct dlm_lksb {
65 char * sb_lvbptr; 65 char * sb_lvbptr;
66}; 66};
67 67
68/* dlm_new_lockspace() flags */
69
68#define DLM_LSFL_NODIR 0x00000001 70#define DLM_LSFL_NODIR 0x00000001
69#define DLM_LSFL_TIMEWARN 0x00000002 71#define DLM_LSFL_TIMEWARN 0x00000002
70#define DLM_LSFL_FS 0x00000004 72#define DLM_LSFL_FS 0x00000004
73#define DLM_LSFL_NEWEXCL 0x00000008
71 74
72#ifdef __KERNEL__ 75#ifdef __KERNEL__
73 76
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h
index c6034508fed9..3060783c4191 100644
--- a/include/linux/dlm_device.h
+++ b/include/linux/dlm_device.h
@@ -26,7 +26,7 @@
26/* Version of the device interface */ 26/* Version of the device interface */
27#define DLM_DEVICE_VERSION_MAJOR 6 27#define DLM_DEVICE_VERSION_MAJOR 6
28#define DLM_DEVICE_VERSION_MINOR 0 28#define DLM_DEVICE_VERSION_MINOR 0
29#define DLM_DEVICE_VERSION_PATCH 0 29#define DLM_DEVICE_VERSION_PATCH 1
30 30
31/* struct passed to the lock write */ 31/* struct passed to the lock write */
32struct dlm_lock_params { 32struct dlm_lock_params {
diff --git a/include/linux/dm-region-hash.h b/include/linux/dm-region-hash.h
new file mode 100644
index 000000000000..a9e652a41373
--- /dev/null
+++ b/include/linux/dm-region-hash.h
@@ -0,0 +1,104 @@
1/*
2 * Copyright (C) 2003 Sistina Software Limited.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * Device-Mapper dirty region hash interface.
6 *
7 * This file is released under the GPL.
8 */
9
10#ifndef DM_REGION_HASH_H
11#define DM_REGION_HASH_H
12
13#include <linux/dm-dirty-log.h>
14
15/*-----------------------------------------------------------------
16 * Region hash
17 *----------------------------------------------------------------*/
18struct dm_region_hash;
19struct dm_region;
20
21/*
22 * States a region can have.
23 */
24enum dm_rh_region_states {
25 DM_RH_CLEAN = 0x01, /* No writes in flight. */
26 DM_RH_DIRTY = 0x02, /* Writes in flight. */
27 DM_RH_NOSYNC = 0x04, /* Out of sync. */
28 DM_RH_RECOVERING = 0x08, /* Under resynchronization. */
29};
30
31/*
32 * Region hash create/destroy.
33 */
34struct bio_list;
35struct dm_region_hash *dm_region_hash_create(
36 void *context, void (*dispatch_bios)(void *context,
37 struct bio_list *bios),
38 void (*wakeup_workers)(void *context),
39 void (*wakeup_all_recovery_waiters)(void *context),
40 sector_t target_begin, unsigned max_recovery,
41 struct dm_dirty_log *log, uint32_t region_size,
42 region_t nr_regions);
43void dm_region_hash_destroy(struct dm_region_hash *rh);
44
45struct dm_dirty_log *dm_rh_dirty_log(struct dm_region_hash *rh);
46
47/*
48 * Conversion functions.
49 */
50region_t dm_rh_bio_to_region(struct dm_region_hash *rh, struct bio *bio);
51sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region);
52void *dm_rh_region_context(struct dm_region *reg);
53
54/*
55 * Get region size and key (ie. number of the region).
56 */
57sector_t dm_rh_get_region_size(struct dm_region_hash *rh);
58region_t dm_rh_get_region_key(struct dm_region *reg);
59
60/*
61 * Get/set/update region state (and dirty log).
62 *
63 */
64int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block);
65void dm_rh_set_state(struct dm_region_hash *rh, region_t region,
66 enum dm_rh_region_states state, int may_block);
67
68/* Non-zero errors_handled leaves the state of the region NOSYNC */
69void dm_rh_update_states(struct dm_region_hash *rh, int errors_handled);
70
71/* Flush the region hash and dirty log. */
72int dm_rh_flush(struct dm_region_hash *rh);
73
74/* Inc/dec pending count on regions. */
75void dm_rh_inc_pending(struct dm_region_hash *rh, struct bio_list *bios);
76void dm_rh_dec(struct dm_region_hash *rh, region_t region);
77
78/* Delay bios on regions. */
79void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio);
80
81void dm_rh_mark_nosync(struct dm_region_hash *rh,
82 struct bio *bio, unsigned done, int error);
83
84/*
85 * Region recovery control.
86 */
87
88/* Prepare some regions for recovery by starting to quiesce them. */
89void dm_rh_recovery_prepare(struct dm_region_hash *rh);
90
91/* Try fetching a quiesced region for recovery. */
92struct dm_region *dm_rh_recovery_start(struct dm_region_hash *rh);
93
94/* Report recovery end on a region. */
95void dm_rh_recovery_end(struct dm_region *reg, int error);
96
97/* Returns number of regions with recovery work outstanding. */
98int dm_rh_recovery_in_flight(struct dm_region_hash *rh);
99
100/* Start/stop recovery. */
101void dm_rh_start_recovery(struct dm_region_hash *rh);
102void dm_rh_stop_recovery(struct dm_region_hash *rh);
103
104#endif /* DM_REGION_HASH_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 952e0f857ac9..ba9114ec5d3a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev)
48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
49} 49}
50 50
51static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
52{
53 return addr + size <= mask;
54}
55
51#ifdef CONFIG_HAS_DMA 56#ifdef CONFIG_HAS_DMA
52#include <asm/dma-mapping.h> 57#include <asm/dma-mapping.h>
53#else 58#else
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev)
58#define dma_sync_single dma_sync_single_for_cpu 63#define dma_sync_single dma_sync_single_for_cpu
59#define dma_sync_sg dma_sync_sg_for_cpu 64#define dma_sync_sg dma_sync_sg_for_cpu
60 65
66static inline u64 dma_get_mask(struct device *dev)
67{
68 if (dev && dev->dma_mask && *dev->dma_mask)
69 return *dev->dma_mask;
70 return DMA_32BIT_MASK;
71}
72
61extern u64 dma_get_required_mask(struct device *dev); 73extern u64 dma_get_required_mask(struct device *dev);
62 74
63static inline unsigned int dma_get_max_seg_size(struct device *dev) 75static inline unsigned int dma_get_max_seg_size(struct device *dev)
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
new file mode 100644
index 000000000000..952df39c989d
--- /dev/null
+++ b/include/linux/dma_remapping.h
@@ -0,0 +1,156 @@
1#ifndef _DMA_REMAPPING_H
2#define _DMA_REMAPPING_H
3
4/*
5 * VT-d hardware uses 4KiB page size regardless of host page size.
6 */
7#define VTD_PAGE_SHIFT (12)
8#define VTD_PAGE_SIZE (1UL << VTD_PAGE_SHIFT)
9#define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT)
10#define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
11
12#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT)
13#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK)
14#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK)
15
16
17/*
18 * 0: Present
19 * 1-11: Reserved
20 * 12-63: Context Ptr (12 - (haw-1))
21 * 64-127: Reserved
22 */
23struct root_entry {
24 u64 val;
25 u64 rsvd1;
26};
27#define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
28static inline bool root_present(struct root_entry *root)
29{
30 return (root->val & 1);
31}
32static inline void set_root_present(struct root_entry *root)
33{
34 root->val |= 1;
35}
36static inline void set_root_value(struct root_entry *root, unsigned long value)
37{
38 root->val |= value & VTD_PAGE_MASK;
39}
40
41struct context_entry;
42static inline struct context_entry *
43get_context_addr_from_root(struct root_entry *root)
44{
45 return (struct context_entry *)
46 (root_present(root)?phys_to_virt(
47 root->val & VTD_PAGE_MASK) :
48 NULL);
49}
50
51/*
52 * low 64 bits:
53 * 0: present
54 * 1: fault processing disable
55 * 2-3: translation type
56 * 12-63: address space root
57 * high 64 bits:
58 * 0-2: address width
59 * 3-6: aval
60 * 8-23: domain id
61 */
62struct context_entry {
63 u64 lo;
64 u64 hi;
65};
66#define context_present(c) ((c).lo & 1)
67#define context_fault_disable(c) (((c).lo >> 1) & 1)
68#define context_translation_type(c) (((c).lo >> 2) & 3)
69#define context_address_root(c) ((c).lo & VTD_PAGE_MASK)
70#define context_address_width(c) ((c).hi & 7)
71#define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1))
72
73#define context_set_present(c) do {(c).lo |= 1;} while (0)
74#define context_set_fault_enable(c) \
75 do {(c).lo &= (((u64)-1) << 2) | 1;} while (0)
76#define context_set_translation_type(c, val) \
77 do { \
78 (c).lo &= (((u64)-1) << 4) | 3; \
79 (c).lo |= ((val) & 3) << 2; \
80 } while (0)
81#define CONTEXT_TT_MULTI_LEVEL 0
82#define context_set_address_root(c, val) \
83 do {(c).lo |= (val) & VTD_PAGE_MASK; } while (0)
84#define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0)
85#define context_set_domain_id(c, val) \
86 do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0)
87#define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while (0)
88
89/*
90 * 0: readable
91 * 1: writable
92 * 2-6: reserved
93 * 7: super page
94 * 8-11: available
95 * 12-63: Host physcial address
96 */
97struct dma_pte {
98 u64 val;
99};
100#define dma_clear_pte(p) do {(p).val = 0;} while (0)
101
102#define DMA_PTE_READ (1)
103#define DMA_PTE_WRITE (2)
104
105#define dma_set_pte_readable(p) do {(p).val |= DMA_PTE_READ;} while (0)
106#define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0)
107#define dma_set_pte_prot(p, prot) \
108 do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0)
109#define dma_pte_addr(p) ((p).val & VTD_PAGE_MASK)
110#define dma_set_pte_addr(p, addr) do {\
111 (p).val |= ((addr) & VTD_PAGE_MASK); } while (0)
112#define dma_pte_present(p) (((p).val & 3) != 0)
113
114struct intel_iommu;
115
116struct dmar_domain {
117 int id; /* domain id */
118 struct intel_iommu *iommu; /* back pointer to owning iommu */
119
120 struct list_head devices; /* all devices' list */
121 struct iova_domain iovad; /* iova's that belong to this domain */
122
123 struct dma_pte *pgd; /* virtual address */
124 spinlock_t mapping_lock; /* page table lock */
125 int gaw; /* max guest address width */
126
127 /* adjusted guest address width, 0 is level 2 30-bit */
128 int agaw;
129
130#define DOMAIN_FLAG_MULTIPLE_DEVICES 1
131 int flags;
132};
133
134/* PCI domain-device relationship */
135struct device_domain_info {
136 struct list_head link; /* link to domain siblings */
137 struct list_head global; /* link to global list */
138 u8 bus; /* PCI bus numer */
139 u8 devfn; /* PCI devfn number */
140 struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */
141 struct dmar_domain *domain; /* pointer to domain */
142};
143
144extern int init_dmars(void);
145extern void free_dmar_iommu(struct intel_iommu *iommu);
146
147extern int dmar_disabled;
148
149#ifndef CONFIG_DMAR_GFX_WA
150static inline void iommu_prepare_gfx_mapping(void)
151{
152 return;
153}
154#endif /* !CONFIG_DMAR_GFX_WA */
155
156#endif
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 56c73b847551..f1984fc3e06d 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -25,9 +25,98 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27 27
28#ifdef CONFIG_DMAR 28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30
31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */
34 u64 reg_base_addr; /* register base address*/
35 struct pci_dev **devices; /* target device array */
36 int devices_cnt; /* target device count */
37 u8 ignored:1; /* ignore drhd */
38 u8 include_all:1;
39 struct intel_iommu *iommu;
40};
41
42extern struct list_head dmar_drhd_units;
43
44#define for_each_drhd_unit(drhd) \
45 list_for_each_entry(drhd, &dmar_drhd_units, list)
46
47extern int dmar_table_init(void);
48extern int dmar_dev_scope_init(void);
49
50/* Intel IOMMU detection */
51extern void detect_intel_iommu(void);
52
53
54extern int parse_ioapics_under_ir(void);
55extern int alloc_iommu(struct dmar_drhd_unit *);
56#else
57static inline void detect_intel_iommu(void)
58{
59 return;
60}
61
62static inline int dmar_table_init(void)
63{
64 return -ENODEV;
65}
66#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
67
68#ifdef CONFIG_INTR_REMAP
69extern int intr_remapping_enabled;
70extern int enable_intr_remapping(int);
71
72struct irte {
73 union {
74 struct {
75 __u64 present : 1,
76 fpd : 1,
77 dst_mode : 1,
78 redir_hint : 1,
79 trigger_mode : 1,
80 dlvry_mode : 3,
81 avail : 4,
82 __reserved_1 : 4,
83 vector : 8,
84 __reserved_2 : 8,
85 dest_id : 32;
86 };
87 __u64 low;
88 };
89
90 union {
91 struct {
92 __u64 sid : 16,
93 sq : 2,
94 svt : 2,
95 __reserved_3 : 44;
96 };
97 __u64 high;
98 };
99};
100extern int get_irte(int irq, struct irte *entry);
101extern int modify_irte(int irq, struct irte *irte_modified);
102extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
103extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
104 u16 sub_handle);
105extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
106extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index);
107extern int flush_irte(int irq);
108extern int free_irte(int irq);
109
110extern int irq_remapped(int irq);
111extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
112extern struct intel_iommu *map_ioapic_to_ir(int apic);
113#else
114#define irq_remapped(irq) (0)
115#define enable_intr_remapping(mode) (-1)
116#define intr_remapping_enabled (0)
117#endif
118
119#ifdef CONFIG_DMAR
31extern const char *dmar_get_fault_reason(u8 fault_reason); 120extern const char *dmar_get_fault_reason(u8 fault_reason);
32 121
33/* Can't use the common MSI interrupt functions 122/* Can't use the common MSI interrupt functions
@@ -40,47 +129,30 @@ extern void dmar_msi_write(int irq, struct msi_msg *msg);
40extern int dmar_set_interrupt(struct intel_iommu *iommu); 129extern int dmar_set_interrupt(struct intel_iommu *iommu);
41extern int arch_setup_dmar_msi(unsigned int irq); 130extern int arch_setup_dmar_msi(unsigned int irq);
42 131
43/* Intel IOMMU detection and initialization functions */ 132extern int iommu_detected, no_iommu;
44extern void detect_intel_iommu(void);
45extern int intel_iommu_init(void);
46
47extern int dmar_table_init(void);
48extern int early_dmar_detect(void);
49
50extern struct list_head dmar_drhd_units;
51extern struct list_head dmar_rmrr_units; 133extern struct list_head dmar_rmrr_units;
52
53struct dmar_drhd_unit {
54 struct list_head list; /* list of drhd units */
55 u64 reg_base_addr; /* register base address*/
56 struct pci_dev **devices; /* target device array */
57 int devices_cnt; /* target device count */
58 u8 ignored:1; /* ignore drhd */
59 u8 include_all:1;
60 struct intel_iommu *iommu;
61};
62
63struct dmar_rmrr_unit { 134struct dmar_rmrr_unit {
64 struct list_head list; /* list of rmrr units */ 135 struct list_head list; /* list of rmrr units */
136 struct acpi_dmar_header *hdr; /* ACPI header */
65 u64 base_address; /* reserved base address*/ 137 u64 base_address; /* reserved base address*/
66 u64 end_address; /* reserved end address */ 138 u64 end_address; /* reserved end address */
67 struct pci_dev **devices; /* target devices */ 139 struct pci_dev **devices; /* target devices */
68 int devices_cnt; /* target device count */ 140 int devices_cnt; /* target device count */
69}; 141};
70 142
71#define for_each_drhd_unit(drhd) \
72 list_for_each_entry(drhd, &dmar_drhd_units, list)
73#define for_each_rmrr_units(rmrr) \ 143#define for_each_rmrr_units(rmrr) \
74 list_for_each_entry(rmrr, &dmar_rmrr_units, list) 144 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
145/* Intel DMAR initialization functions */
146extern int intel_iommu_init(void);
147extern int dmar_disabled;
75#else 148#else
76static inline void detect_intel_iommu(void)
77{
78 return;
79}
80static inline int intel_iommu_init(void) 149static inline int intel_iommu_init(void)
81{ 150{
151#ifdef CONFIG_INTR_REMAP
152 return dmar_dev_scope_init();
153#else
82 return -ENODEV; 154 return -ENODEV;
155#endif
83} 156}
84
85#endif /* !CONFIG_DMAR */ 157#endif /* !CONFIG_DMAR */
86#endif /* __DMAR_H__ */ 158#endif /* __DMAR_H__ */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 2a063b64133f..e5084eb5943a 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,29 +2,9 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/mod_devicetable.h>
5 6
6enum dmi_field { 7/* enum dmi_field is in mod_devicetable.h */
7 DMI_NONE,
8 DMI_BIOS_VENDOR,
9 DMI_BIOS_VERSION,
10 DMI_BIOS_DATE,
11 DMI_SYS_VENDOR,
12 DMI_PRODUCT_NAME,
13 DMI_PRODUCT_VERSION,
14 DMI_PRODUCT_SERIAL,
15 DMI_PRODUCT_UUID,
16 DMI_BOARD_VENDOR,
17 DMI_BOARD_NAME,
18 DMI_BOARD_VERSION,
19 DMI_BOARD_SERIAL,
20 DMI_BOARD_ASSET_TAG,
21 DMI_CHASSIS_VENDOR,
22 DMI_CHASSIS_TYPE,
23 DMI_CHASSIS_VERSION,
24 DMI_CHASSIS_SERIAL,
25 DMI_CHASSIS_ASSET_TAG,
26 DMI_STRING_MAX,
27};
28 8
29enum dmi_device_type { 9enum dmi_device_type {
30 DMI_DEV_TYPE_ANY = 0, 10 DMI_DEV_TYPE_ANY = 0,
@@ -48,23 +28,6 @@ struct dmi_header {
48 u16 handle; 28 u16 handle;
49}; 29};
50 30
51/*
52 * DMI callbacks for problem boards
53 */
54struct dmi_strmatch {
55 u8 slot;
56 char *substr;
57};
58
59struct dmi_system_id {
60 int (*callback)(const struct dmi_system_id *);
61 const char *ident;
62 struct dmi_strmatch matches[4];
63 void *driver_data;
64};
65
66#define DMI_MATCH(a, b) { a, b }
67
68struct dmi_device { 31struct dmi_device {
69 struct list_head list; 32 struct list_head list;
70 int type; 33 int type;
diff --git a/include/linux/ds1286.h b/include/linux/ds1286.h
index d8989860e4ce..45ea0aa0aeb9 100644
--- a/include/linux/ds1286.h
+++ b/include/linux/ds1286.h
@@ -8,8 +8,6 @@
8#ifndef __LINUX_DS1286_H 8#ifndef __LINUX_DS1286_H
9#define __LINUX_DS1286_H 9#define __LINUX_DS1286_H
10 10
11#include <asm/ds1286.h>
12
13/********************************************************************** 11/**********************************************************************
14 * register summary 12 * register summary
15 **********************************************************************/ 13 **********************************************************************/
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index c8cbd90ba375..79a8ed8e6a7d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_HIERARCHY_AUTO = 0x100000, 62 FE_CAN_HIERARCHY_AUTO = 0x100000,
63 FE_CAN_8VSB = 0x200000, 63 FE_CAN_8VSB = 0x200000,
64 FE_CAN_16VSB = 0x400000, 64 FE_CAN_16VSB = 0x400000,
65 FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this.
65 FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) 66 FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending)
66 FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically 67 FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically
67 FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output 68 FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output
@@ -147,7 +148,9 @@ typedef enum fe_code_rate {
147 FEC_6_7, 148 FEC_6_7,
148 FEC_7_8, 149 FEC_7_8,
149 FEC_8_9, 150 FEC_8_9,
150 FEC_AUTO 151 FEC_AUTO,
152 FEC_3_5,
153 FEC_9_10,
151} fe_code_rate_t; 154} fe_code_rate_t;
152 155
153 156
@@ -160,7 +163,11 @@ typedef enum fe_modulation {
160 QAM_256, 163 QAM_256,
161 QAM_AUTO, 164 QAM_AUTO,
162 VSB_8, 165 VSB_8,
163 VSB_16 166 VSB_16,
167 PSK_8,
168 APSK_16,
169 APSK_32,
170 DQPSK,
164} fe_modulation_t; 171} fe_modulation_t;
165 172
166typedef enum fe_transmit_mode { 173typedef enum fe_transmit_mode {
@@ -239,6 +246,107 @@ struct dvb_frontend_event {
239 struct dvb_frontend_parameters parameters; 246 struct dvb_frontend_parameters parameters;
240}; 247};
241 248
249/* S2API Commands */
250#define DTV_UNDEFINED 0
251#define DTV_TUNE 1
252#define DTV_CLEAR 2
253#define DTV_FREQUENCY 3
254#define DTV_MODULATION 4
255#define DTV_BANDWIDTH_HZ 5
256#define DTV_INVERSION 6
257#define DTV_DISEQC_MASTER 7
258#define DTV_SYMBOL_RATE 8
259#define DTV_INNER_FEC 9
260#define DTV_VOLTAGE 10
261#define DTV_TONE 11
262#define DTV_PILOT 12
263#define DTV_ROLLOFF 13
264#define DTV_DISEQC_SLAVE_REPLY 14
265
266/* Basic enumeration set for querying unlimited capabilities */
267#define DTV_FE_CAPABILITY_COUNT 15
268#define DTV_FE_CAPABILITY 16
269#define DTV_DELIVERY_SYSTEM 17
270
271#define DTV_API_VERSION 35
272#define DTV_API_VERSION 35
273#define DTV_CODE_RATE_HP 36
274#define DTV_CODE_RATE_LP 37
275#define DTV_GUARD_INTERVAL 38
276#define DTV_TRANSMISSION_MODE 39
277#define DTV_HIERARCHY 40
278
279#define DTV_MAX_COMMAND DTV_HIERARCHY
280
281typedef enum fe_pilot {
282 PILOT_ON,
283 PILOT_OFF,
284 PILOT_AUTO,
285} fe_pilot_t;
286
287typedef enum fe_rolloff {
288 ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */
289 ROLLOFF_20,
290 ROLLOFF_25,
291 ROLLOFF_AUTO,
292} fe_rolloff_t;
293
294typedef enum fe_delivery_system {
295 SYS_UNDEFINED,
296 SYS_DVBC_ANNEX_AC,
297 SYS_DVBC_ANNEX_B,
298 SYS_DVBT,
299 SYS_DSS,
300 SYS_DVBS,
301 SYS_DVBS2,
302 SYS_DVBH,
303 SYS_ISDBT,
304 SYS_ISDBS,
305 SYS_ISDBC,
306 SYS_ATSC,
307 SYS_ATSCMH,
308 SYS_DMBTH,
309 SYS_CMMB,
310 SYS_DAB,
311} fe_delivery_system_t;
312
313struct dtv_cmds_h {
314 char *name; /* A display name for debugging purposes */
315
316 __u32 cmd; /* A unique ID */
317
318 /* Flags */
319 __u32 set:1; /* Either a set or get property */
320 __u32 buffer:1; /* Does this property use the buffer? */
321 __u32 reserved:30; /* Align */
322};
323
324struct dtv_property {
325 __u32 cmd;
326 __u32 reserved[3];
327 union {
328 __u32 data;
329 struct {
330 __u8 data[32];
331 __u32 len;
332 __u32 reserved1[3];
333 void *reserved2;
334 } buffer;
335 } u;
336 int result;
337} __attribute__ ((packed));
338
339/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
340#define DTV_IOCTL_MAX_MSGS 64
341
342struct dtv_properties {
343 __u32 num;
344 struct dtv_property *props;
345};
346
347#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
348#define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
349
242 350
243/** 351/**
244 * When set, this flag will disable any zigzagging or other "normal" tuning 352 * When set, this flag will disable any zigzagging or other "normal" tuning
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 126e0c26cb09..25b823b81734 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -23,7 +23,7 @@
23#ifndef _DVBVERSION_H_ 23#ifndef _DVBVERSION_H_
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 3 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 2 27#define DVB_API_VERSION_MINOR 0
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dynamic_printk.h b/include/linux/dynamic_printk.h
new file mode 100644
index 000000000000..2d528d009074
--- /dev/null
+++ b/include/linux/dynamic_printk.h
@@ -0,0 +1,93 @@
1#ifndef _DYNAMIC_PRINTK_H
2#define _DYNAMIC_PRINTK_H
3
4#define DYNAMIC_DEBUG_HASH_BITS 6
5#define DEBUG_HASH_TABLE_SIZE (1 << DYNAMIC_DEBUG_HASH_BITS)
6
7#define TYPE_BOOLEAN 1
8
9#define DYNAMIC_ENABLED_ALL 0
10#define DYNAMIC_ENABLED_NONE 1
11#define DYNAMIC_ENABLED_SOME 2
12
13extern int dynamic_enabled;
14
15/* dynamic_printk_enabled, and dynamic_printk_enabled2 are bitmasks in which
16 * bit n is set to 1 if any modname hashes into the bucket n, 0 otherwise. They
17 * use independent hash functions, to reduce the chance of false positives.
18 */
19extern long long dynamic_printk_enabled;
20extern long long dynamic_printk_enabled2;
21
22struct mod_debug {
23 char *modname;
24 char *logical_modname;
25 char *flag_names;
26 int type;
27 int hash;
28 int hash2;
29} __attribute__((aligned(8)));
30
31int register_dynamic_debug_module(char *mod_name, int type, char *share_name,
32 char *flags, int hash, int hash2);
33
34#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
35extern int unregister_dynamic_debug_module(char *mod_name);
36extern int __dynamic_dbg_enabled_helper(char *modname, int type,
37 int value, int hash);
38
39#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ \
40 int __ret = 0; \
41 if (unlikely((dynamic_printk_enabled & (1LL << DEBUG_HASH)) && \
42 (dynamic_printk_enabled2 & (1LL << DEBUG_HASH2)))) \
43 __ret = __dynamic_dbg_enabled_helper(module, type, \
44 value, hash);\
45 __ret; })
46
47#define dynamic_pr_debug(fmt, ...) do { \
48 static char mod_name[] \
49 __attribute__((section("__verbose_strings"))) \
50 = KBUILD_MODNAME; \
51 static struct mod_debug descriptor \
52 __used \
53 __attribute__((section("__verbose"), aligned(8))) = \
54 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
55 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
56 0, 0, DEBUG_HASH)) \
57 printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
58 ##__VA_ARGS__); \
59 } while (0)
60
61#define dynamic_dev_dbg(dev, format, ...) do { \
62 static char mod_name[] \
63 __attribute__((section("__verbose_strings"))) \
64 = KBUILD_MODNAME; \
65 static struct mod_debug descriptor \
66 __used \
67 __attribute__((section("__verbose"), aligned(8))) = \
68 { mod_name, mod_name, NULL, TYPE_BOOLEAN, DEBUG_HASH, DEBUG_HASH2 };\
69 if (__dynamic_dbg_enabled(KBUILD_MODNAME, TYPE_BOOLEAN, \
70 0, 0, DEBUG_HASH)) \
71 dev_printk(KERN_DEBUG, dev, \
72 KBUILD_MODNAME ": " format, \
73 ##__VA_ARGS__); \
74 } while (0)
75
76#else
77
78static inline int unregister_dynamic_debug_module(const char *mod_name)
79{
80 return 0;
81}
82static inline int __dynamic_dbg_enabled_helper(char *modname, int type,
83 int value, int hash)
84{
85 return 0;
86}
87
88#define __dynamic_dbg_enabled(module, type, value, level, hash) ({ 0; })
89#define dynamic_pr_debug(fmt, ...) do { } while (0)
90#define dynamic_dev_dbg(dev, format, ...) do { } while (0)
91#endif
92
93#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 807373d467f7..bb66feb164bd 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -208,6 +208,9 @@ typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_siz
208#define EFI_GLOBAL_VARIABLE_GUID \ 208#define EFI_GLOBAL_VARIABLE_GUID \
209 EFI_GUID( 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c ) 209 EFI_GUID( 0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c )
210 210
211#define UV_SYSTEM_TABLE_GUID \
212 EFI_GUID( 0x3b13a7d4, 0x633e, 0x11dd, 0x93, 0xec, 0xda, 0x25, 0x56, 0xd8, 0x95, 0x93 )
213
211typedef struct { 214typedef struct {
212 efi_guid_t guid; 215 efi_guid_t guid;
213 unsigned long table; 216 unsigned long table;
@@ -255,6 +258,7 @@ extern struct efi {
255 unsigned long boot_info; /* boot info table */ 258 unsigned long boot_info; /* boot info table */
256 unsigned long hcdp; /* HCDP table */ 259 unsigned long hcdp; /* HCDP table */
257 unsigned long uga; /* UGA table */ 260 unsigned long uga; /* UGA table */
261 unsigned long uv_systab; /* UV system table */
258 efi_get_time_t *get_time; 262 efi_get_time_t *get_time;
259 efi_set_time_t *set_time; 263 efi_set_time_t *set_time;
260 efi_get_wakeup_time_t *get_wakeup_time; 264 efi_get_wakeup_time_t *get_wakeup_time;
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 639624b55fbe..92f6f634e3e6 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -112,6 +112,7 @@ extern struct request *elv_latter_request(struct request_queue *, struct request
112extern int elv_register_queue(struct request_queue *q); 112extern int elv_register_queue(struct request_queue *q);
113extern void elv_unregister_queue(struct request_queue *q); 113extern void elv_unregister_queue(struct request_queue *q);
114extern int elv_may_queue(struct request_queue *, int); 114extern int elv_may_queue(struct request_queue *, int);
115extern void elv_abort_queue(struct request_queue *);
115extern void elv_completed_request(struct request_queue *, struct request *); 116extern void elv_completed_request(struct request_queue *, struct request *);
116extern int elv_set_request(struct request_queue *, struct request *, gfp_t); 117extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
117extern void elv_put_request(struct request_queue *, struct request *); 118extern void elv_put_request(struct request_queue *, struct request *);
@@ -173,15 +174,15 @@ enum {
173#define rb_entry_rq(node) rb_entry((node), struct request, rb_node) 174#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
174 175
175/* 176/*
176 * Hack to reuse the donelist list_head as the fifo time holder while 177 * Hack to reuse the csd.list list_head as the fifo time holder while
177 * the request is in the io scheduler. Saves an unsigned long in rq. 178 * the request is in the io scheduler. Saves an unsigned long in rq.
178 */ 179 */
179#define rq_fifo_time(rq) ((unsigned long) (rq)->donelist.next) 180#define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next)
180#define rq_set_fifo_time(rq,exp) ((rq)->donelist.next = (void *) (exp)) 181#define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp))
181#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) 182#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
182#define rq_fifo_clear(rq) do { \ 183#define rq_fifo_clear(rq) do { \
183 list_del_init(&(rq)->queuelist); \ 184 list_del_init(&(rq)->queuelist); \
184 INIT_LIST_HEAD(&(rq)->donelist); \ 185 INIT_LIST_HEAD(&(rq)->csd.list); \
185 } while (0) 186 } while (0)
186 187
187/* 188/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index edc3dac3f02f..0b61ca41a044 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -360,6 +360,7 @@ typedef struct elf64_shdr {
360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
363 364
364 365
365/* Note header in a PT_NOTE section */ 366/* Note header in a PT_NOTE section */
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 2efe7b863cff..78c775a83f7c 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -47,7 +47,7 @@
47#ifdef EXT2FS_DEBUG 47#ifdef EXT2FS_DEBUG
48# define ext2_debug(f, a...) { \ 48# define ext2_debug(f, a...) { \
49 printk ("EXT2-fs DEBUG (%s, %d): %s:", \ 49 printk ("EXT2-fs DEBUG (%s, %d): %s:", \
50 __FILE__, __LINE__, __FUNCTION__); \ 50 __FILE__, __LINE__, __func__); \
51 printk (f, ## a); \ 51 printk (f, ## a); \
52 } 52 }
53#else 53#else
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 80171ee89a22..d14f02918483 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -43,7 +43,7 @@
43#define ext3_debug(f, a...) \ 43#define ext3_debug(f, a...) \
44 do { \ 44 do { \
45 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \ 45 printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", \
46 __FILE__, __LINE__, __FUNCTION__); \ 46 __FILE__, __LINE__, __func__); \
47 printk (KERN_DEBUG f, ## a); \ 47 printk (KERN_DEBUG f, ## a); \
48 } while (0) 48 } while (0)
49#else 49#else
@@ -380,6 +380,8 @@ struct ext3_inode {
380#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ 380#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
381#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 381#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
382#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 382#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
383#define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
384 * error in ordered mode */
383 385
384/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */ 386/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
385#ifndef _LINUX_EXT2_FS_H 387#ifndef _LINUX_EXT2_FS_H
@@ -837,6 +839,8 @@ extern void ext3_truncate (struct inode *);
837extern void ext3_set_inode_flags(struct inode *); 839extern void ext3_set_inode_flags(struct inode *);
838extern void ext3_get_inode_flags(struct ext3_inode_info *); 840extern void ext3_get_inode_flags(struct ext3_inode_info *);
839extern void ext3_set_aops(struct inode *inode); 841extern void ext3_set_aops(struct inode *inode);
842extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
843 u64 start, u64 len);
840 844
841/* ioctl.c */ 845/* ioctl.c */
842extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 846extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
@@ -869,7 +873,7 @@ extern void ext3_update_dynamic_rev (struct super_block *sb);
869#define ext3_std_error(sb, errno) \ 873#define ext3_std_error(sb, errno) \
870do { \ 874do { \
871 if ((errno)) \ 875 if ((errno)) \
872 __ext3_std_error((sb), __FUNCTION__, (errno)); \ 876 __ext3_std_error((sb), __func__, (errno)); \
873} while (0) 877} while (0)
874 878
875/* 879/*
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
index 8c43b13a02fe..cf82d519be40 100644
--- a/include/linux/ext3_jbd.h
+++ b/include/linux/ext3_jbd.h
@@ -137,17 +137,17 @@ int __ext3_journal_dirty_metadata(const char *where,
137 handle_t *handle, struct buffer_head *bh); 137 handle_t *handle, struct buffer_head *bh);
138 138
139#define ext3_journal_get_undo_access(handle, bh) \ 139#define ext3_journal_get_undo_access(handle, bh) \
140 __ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh)) 140 __ext3_journal_get_undo_access(__func__, (handle), (bh))
141#define ext3_journal_get_write_access(handle, bh) \ 141#define ext3_journal_get_write_access(handle, bh) \
142 __ext3_journal_get_write_access(__FUNCTION__, (handle), (bh)) 142 __ext3_journal_get_write_access(__func__, (handle), (bh))
143#define ext3_journal_revoke(handle, blocknr, bh) \ 143#define ext3_journal_revoke(handle, blocknr, bh) \
144 __ext3_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh)) 144 __ext3_journal_revoke(__func__, (handle), (blocknr), (bh))
145#define ext3_journal_get_create_access(handle, bh) \ 145#define ext3_journal_get_create_access(handle, bh) \
146 __ext3_journal_get_create_access(__FUNCTION__, (handle), (bh)) 146 __ext3_journal_get_create_access(__func__, (handle), (bh))
147#define ext3_journal_dirty_metadata(handle, bh) \ 147#define ext3_journal_dirty_metadata(handle, bh) \
148 __ext3_journal_dirty_metadata(__FUNCTION__, (handle), (bh)) 148 __ext3_journal_dirty_metadata(__func__, (handle), (bh))
149#define ext3_journal_forget(handle, bh) \ 149#define ext3_journal_forget(handle, bh) \
150 __ext3_journal_forget(__FUNCTION__, (handle), (bh)) 150 __ext3_journal_forget(__func__, (handle), (bh))
151 151
152int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); 152int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh);
153 153
@@ -160,7 +160,7 @@ static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks)
160} 160}
161 161
162#define ext3_journal_stop(handle) \ 162#define ext3_journal_stop(handle) \
163 __ext3_journal_stop(__FUNCTION__, (handle)) 163 __ext3_journal_stop(__func__, (handle))
164 164
165static inline handle_t *ext3_journal_current_handle(void) 165static inline handle_t *ext3_journal_current_handle(void)
166{ 166{
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 531ccd5f5960..75a81eaf3430 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -808,6 +808,7 @@ struct fb_tile_ops {
808struct fb_info { 808struct fb_info {
809 int node; 809 int node;
810 int flags; 810 int flags;
811 struct mutex lock; /* Lock for open/release/ioctl funcs */
811 struct fb_var_screeninfo var; /* Current var */ 812 struct fb_var_screeninfo var; /* Current var */
812 struct fb_fix_screeninfo fix; /* Current fix */ 813 struct fb_fix_screeninfo fix; /* Current fix */
813 struct fb_monspecs monspecs; /* Current Monitor specs */ 814 struct fb_monspecs monspecs; /* Current Monitor specs */
diff --git a/include/linux/fd.h b/include/linux/fd.h
index b6bd41d2b460..f5d194af07a8 100644
--- a/include/linux/fd.h
+++ b/include/linux/fd.h
@@ -15,10 +15,16 @@ struct floppy_struct {
15 sect, /* sectors per track */ 15 sect, /* sectors per track */
16 head, /* nr of heads */ 16 head, /* nr of heads */
17 track, /* nr of tracks */ 17 track, /* nr of tracks */
18 stretch; /* !=0 means double track steps */ 18 stretch; /* bit 0 !=0 means double track steps */
19 /* bit 1 != 0 means swap sides */
20 /* bits 2..9 give the first sector */
21 /* number (the LSB is flipped) */
19#define FD_STRETCH 1 22#define FD_STRETCH 1
20#define FD_SWAPSIDES 2 23#define FD_SWAPSIDES 2
21#define FD_ZEROBASED 4 24#define FD_ZEROBASED 4
25#define FD_SECTBASEMASK 0x3FC
26#define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
27#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
22 28
23 unsigned char gap, /* gap1 size */ 29 unsigned char gap, /* gap1 size */
24 30
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h
new file mode 100644
index 000000000000..671decbd2aeb
--- /dev/null
+++ b/include/linux/fiemap.h
@@ -0,0 +1,64 @@
1/*
2 * FS_IOC_FIEMAP ioctl infrastructure.
3 *
4 * Some portions copyright (C) 2007 Cluster File Systems, Inc
5 *
6 * Authors: Mark Fasheh <mfasheh@suse.com>
7 * Kalpak Shah <kalpak.shah@sun.com>
8 * Andreas Dilger <adilger@sun.com>
9 */
10
11#ifndef _LINUX_FIEMAP_H
12#define _LINUX_FIEMAP_H
13
14struct fiemap_extent {
15 __u64 fe_logical; /* logical offset in bytes for the start of
16 * the extent from the beginning of the file */
17 __u64 fe_physical; /* physical offset in bytes for the start
18 * of the extent from the beginning of the disk */
19 __u64 fe_length; /* length in bytes for this extent */
20 __u64 fe_reserved64[2];
21 __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
22 __u32 fe_reserved[3];
23};
24
25struct fiemap {
26 __u64 fm_start; /* logical offset (inclusive) at
27 * which to start mapping (in) */
28 __u64 fm_length; /* logical length of mapping which
29 * userspace wants (in) */
30 __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */
31 __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
32 __u32 fm_extent_count; /* size of fm_extents array (in) */
33 __u32 fm_reserved;
34 struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
35};
36
37#define FIEMAP_MAX_OFFSET (~0ULL)
38
39#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */
40#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */
41
42#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
43
44#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
45#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
46#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
47 * Sets EXTENT_UNKNOWN. */
48#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
49 * while fs is unmounted */
50#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
51 * Sets EXTENT_NO_BYPASS. */
52#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
53 * block aligned. */
54#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
55 * Sets EXTENT_NOT_ALIGNED.*/
56#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
57 * Sets EXTENT_NOT_ALIGNED.*/
58#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
59 * no data (i.e. zero). */
60#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
61 * support extents. Result
62 * merged for efficiency. */
63
64#endif /* _LINUX_FIEMAP_H */
diff --git a/include/linux/file.h b/include/linux/file.h
index a20259e248a5..335a0a5c316e 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -19,10 +19,10 @@ struct file_operations;
19struct vfsmount; 19struct vfsmount;
20struct dentry; 20struct dentry;
21extern int init_file(struct file *, struct vfsmount *mnt, 21extern int init_file(struct file *, struct vfsmount *mnt,
22 struct dentry *dentry, mode_t mode, 22 struct dentry *dentry, fmode_t mode,
23 const struct file_operations *fop); 23 const struct file_operations *fop);
24extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry, 24extern struct file *alloc_file(struct vfsmount *, struct dentry *dentry,
25 mode_t mode, const struct file_operations *fop); 25 fmode_t mode, const struct file_operations *fop);
26 26
27static inline void fput_light(struct file *file, int fput_needed) 27static inline void fput_light(struct file *file, int fput_needed)
28{ 28{
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index deddeedf3257..8f225339eee9 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -6,7 +6,7 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/wait.h> 7#include <linux/wait.h>
8 8
9#ifdef CONFIG_PM_SLEEP 9#ifdef CONFIG_FREEZER
10/* 10/*
11 * Check if a process has been frozen 11 * Check if a process has been frozen
12 */ 12 */
@@ -39,28 +39,18 @@ static inline void clear_freeze_flag(struct task_struct *p)
39 clear_tsk_thread_flag(p, TIF_FREEZE); 39 clear_tsk_thread_flag(p, TIF_FREEZE);
40} 40}
41 41
42static inline bool should_send_signal(struct task_struct *p)
43{
44 return !(p->flags & PF_FREEZER_NOSIG);
45}
46
42/* 47/*
43 * Wake up a frozen process 48 * Wake up a frozen process
44 *
45 * task_lock() is taken to prevent the race with refrigerator() which may
46 * occur if the freezing of tasks fails. Namely, without the lock, if the
47 * freezing of tasks failed, thaw_tasks() might have run before a task in
48 * refrigerator() could call frozen_process(), in which case the task would be
49 * frozen and no one would thaw it.
50 */ 49 */
51static inline int thaw_process(struct task_struct *p) 50extern int __thaw_process(struct task_struct *p);
52{ 51
53 task_lock(p); 52/* Takes and releases task alloc lock using task_lock() */
54 if (frozen(p)) { 53extern int thaw_process(struct task_struct *p);
55 p->flags &= ~PF_FROZEN;
56 task_unlock(p);
57 wake_up_process(p);
58 return 1;
59 }
60 clear_freeze_flag(p);
61 task_unlock(p);
62 return 0;
63}
64 54
65extern void refrigerator(void); 55extern void refrigerator(void);
66extern int freeze_processes(void); 56extern int freeze_processes(void);
@@ -75,6 +65,15 @@ static inline int try_to_freeze(void)
75 return 0; 65 return 0;
76} 66}
77 67
68extern bool freeze_task(struct task_struct *p, bool sig_only);
69extern void cancel_freezing(struct task_struct *p);
70
71#ifdef CONFIG_CGROUP_FREEZER
72extern int cgroup_frozen(struct task_struct *task);
73#else /* !CONFIG_CGROUP_FREEZER */
74static inline int cgroup_frozen(struct task_struct *task) { return 0; }
75#endif /* !CONFIG_CGROUP_FREEZER */
76
78/* 77/*
79 * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it 78 * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it
80 * calls wait_for_completion(&vfork) and reset right after it returns from this 79 * calls wait_for_completion(&vfork) and reset right after it returns from this
@@ -166,7 +165,7 @@ static inline void set_freezable_with_signal(void)
166 } while (try_to_freeze()); \ 165 } while (try_to_freeze()); \
167 __retval; \ 166 __retval; \
168}) 167})
169#else /* !CONFIG_PM_SLEEP */ 168#else /* !CONFIG_FREEZER */
170static inline int frozen(struct task_struct *p) { return 0; } 169static inline int frozen(struct task_struct *p) { return 0; }
171static inline int freezing(struct task_struct *p) { return 0; } 170static inline int freezing(struct task_struct *p) { return 0; }
172static inline void set_freeze_flag(struct task_struct *p) {} 171static inline void set_freeze_flag(struct task_struct *p) {}
@@ -191,6 +190,6 @@ static inline void set_freezable_with_signal(void) {}
191#define wait_event_freezable_timeout(wq, condition, timeout) \ 190#define wait_event_freezable_timeout(wq, condition, timeout) \
192 wait_event_interruptible_timeout(wq, condition, timeout) 191 wait_event_interruptible_timeout(wq, condition, timeout)
193 192
194#endif /* !CONFIG_PM_SLEEP */ 193#endif /* !CONFIG_FREEZER */
195 194
196#endif /* FREEZER_H_INCLUDED */ 195#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 580b513668fe..5b248d61430c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -63,18 +63,23 @@ extern int dir_notify_enable;
63#define MAY_ACCESS 16 63#define MAY_ACCESS 16
64#define MAY_OPEN 32 64#define MAY_OPEN 32
65 65
66#define FMODE_READ 1 66#define FMODE_READ ((__force fmode_t)1)
67#define FMODE_WRITE 2 67#define FMODE_WRITE ((__force fmode_t)2)
68 68
69/* Internal kernel extensions */ 69/* Internal kernel extensions */
70#define FMODE_LSEEK 4 70#define FMODE_LSEEK ((__force fmode_t)4)
71#define FMODE_PREAD 8 71#define FMODE_PREAD ((__force fmode_t)8)
72#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ 72#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
73 73
74/* File is being opened for execution. Primary users of this flag are 74/* File is being opened for execution. Primary users of this flag are
75 distributed filesystems that can use it to achieve correct ETXTBUSY 75 distributed filesystems that can use it to achieve correct ETXTBUSY
76 behavior for cross-node execution/opening_for_writing of files */ 76 behavior for cross-node execution/opening_for_writing of files */
77#define FMODE_EXEC 16 77#define FMODE_EXEC ((__force fmode_t)16)
78
79#define FMODE_NDELAY ((__force fmode_t)32)
80#define FMODE_EXCL ((__force fmode_t)64)
81#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
82#define FMODE_NDELAY_NOW ((__force fmode_t)256)
78 83
79#define RW_MASK 1 84#define RW_MASK 1
80#define RWA_MASK 2 85#define RWA_MASK 2
@@ -86,7 +91,9 @@ extern int dir_notify_enable;
86#define READ_META (READ | (1 << BIO_RW_META)) 91#define READ_META (READ | (1 << BIO_RW_META))
87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 92#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 93#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
89#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 94#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
95#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
96#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
90 97
91#define SEL_IN 1 98#define SEL_IN 1
92#define SEL_OUT 2 99#define SEL_OUT 2
@@ -134,7 +141,7 @@ extern int dir_notify_enable;
134/* 141/*
135 * Superblock flags that can be altered by MS_REMOUNT 142 * Superblock flags that can be altered by MS_REMOUNT
136 */ 143 */
137#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) 144#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
138 145
139/* 146/*
140 * Old magic mount flag and mask 147 * Old magic mount flag and mask
@@ -222,6 +229,7 @@ extern int dir_notify_enable;
222#define BLKTRACESTART _IO(0x12,116) 229#define BLKTRACESTART _IO(0x12,116)
223#define BLKTRACESTOP _IO(0x12,117) 230#define BLKTRACESTOP _IO(0x12,117)
224#define BLKTRACETEARDOWN _IO(0x12,118) 231#define BLKTRACETEARDOWN _IO(0x12,118)
232#define BLKDISCARD _IO(0x12,119)
225 233
226#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 234#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
227#define FIBMAP _IO(0x00,1) /* bmap access */ 235#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -231,6 +239,7 @@ extern int dir_notify_enable;
231#define FS_IOC_SETFLAGS _IOW('f', 2, long) 239#define FS_IOC_SETFLAGS _IOW('f', 2, long)
232#define FS_IOC_GETVERSION _IOR('v', 1, long) 240#define FS_IOC_GETVERSION _IOR('v', 1, long)
233#define FS_IOC_SETVERSION _IOW('v', 2, long) 241#define FS_IOC_SETVERSION _IOW('v', 2, long)
242#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
234#define FS_IOC32_GETFLAGS _IOR('f', 1, int) 243#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
235#define FS_IOC32_SETFLAGS _IOW('f', 2, int) 244#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
236#define FS_IOC32_GETVERSION _IOR('v', 1, int) 245#define FS_IOC32_GETVERSION _IOR('v', 1, int)
@@ -291,6 +300,7 @@ extern int dir_notify_enable;
291#include <linux/mutex.h> 300#include <linux/mutex.h>
292#include <linux/capability.h> 301#include <linux/capability.h>
293#include <linux/semaphore.h> 302#include <linux/semaphore.h>
303#include <linux/fiemap.h>
294 304
295#include <asm/atomic.h> 305#include <asm/atomic.h>
296#include <asm/byteorder.h> 306#include <asm/byteorder.h>
@@ -820,7 +830,7 @@ struct file {
820 const struct file_operations *f_op; 830 const struct file_operations *f_op;
821 atomic_long_t f_count; 831 atomic_long_t f_count;
822 unsigned int f_flags; 832 unsigned int f_flags;
823 mode_t f_mode; 833 fmode_t f_mode;
824 loff_t f_pos; 834 loff_t f_pos;
825 struct fown_struct f_owner; 835 struct fown_struct f_owner;
826 unsigned int f_uid, f_gid; 836 unsigned int f_uid, f_gid;
@@ -942,6 +952,14 @@ struct lock_manager_operations {
942 int (*fl_change)(struct file_lock **, int); 952 int (*fl_change)(struct file_lock **, int);
943}; 953};
944 954
955struct lock_manager {
956 struct list_head list;
957};
958
959void locks_start_grace(struct lock_manager *);
960void locks_end_grace(struct lock_manager *);
961int locks_in_grace(void);
962
945/* that will die - we need it for nfs_lock_info */ 963/* that will die - we need it for nfs_lock_info */
946#include <linux/nfs_fs_i.h> 964#include <linux/nfs_fs_i.h>
947 965
@@ -983,6 +1001,13 @@ struct file_lock {
983 1001
984#include <linux/fcntl.h> 1002#include <linux/fcntl.h>
985 1003
1004extern void send_sigio(struct fown_struct *fown, int fd, int band);
1005
1006/* fs/sync.c */
1007extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1008 loff_t endbyte, unsigned int flags);
1009
1010#ifdef CONFIG_FILE_LOCKING
986extern int fcntl_getlk(struct file *, struct flock __user *); 1011extern int fcntl_getlk(struct file *, struct flock __user *);
987extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1012extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
988 struct flock __user *); 1013 struct flock __user *);
@@ -993,14 +1018,9 @@ extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
993 struct flock64 __user *); 1018 struct flock64 __user *);
994#endif 1019#endif
995 1020
996extern void send_sigio(struct fown_struct *fown, int fd, int band);
997extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); 1021extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
998extern int fcntl_getlease(struct file *filp); 1022extern int fcntl_getlease(struct file *filp);
999 1023
1000/* fs/sync.c */
1001extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
1002 loff_t endbyte, unsigned int flags);
1003
1004/* fs/locks.c */ 1024/* fs/locks.c */
1005extern void locks_init_lock(struct file_lock *); 1025extern void locks_init_lock(struct file_lock *);
1006extern void locks_copy_lock(struct file_lock *, struct file_lock *); 1026extern void locks_copy_lock(struct file_lock *, struct file_lock *);
@@ -1022,7 +1042,37 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
1022extern int lease_modify(struct file_lock **, int); 1042extern int lease_modify(struct file_lock **, int);
1023extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 1043extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1024extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 1044extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1025extern struct seq_operations locks_seq_operations; 1045#else /* !CONFIG_FILE_LOCKING */
1046#define fcntl_getlk(a, b) ({ -EINVAL; })
1047#define fcntl_setlk(a, b, c, d) ({ -EACCES; })
1048#if BITS_PER_LONG == 32
1049#define fcntl_getlk64(a, b) ({ -EINVAL; })
1050#define fcntl_setlk64(a, b, c, d) ({ -EACCES; })
1051#endif
1052#define fcntl_setlease(a, b, c) ({ 0; })
1053#define fcntl_getlease(a) ({ 0; })
1054#define locks_init_lock(a) ({ })
1055#define __locks_copy_lock(a, b) ({ })
1056#define locks_copy_lock(a, b) ({ })
1057#define locks_remove_posix(a, b) ({ })
1058#define locks_remove_flock(a) ({ })
1059#define posix_test_lock(a, b) ({ 0; })
1060#define posix_lock_file(a, b, c) ({ -ENOLCK; })
1061#define posix_lock_file_wait(a, b) ({ -ENOLCK; })
1062#define posix_unblock_lock(a, b) (-ENOENT)
1063#define vfs_test_lock(a, b) ({ 0; })
1064#define vfs_lock_file(a, b, c, d) (-ENOLCK)
1065#define vfs_cancel_lock(a, b) ({ 0; })
1066#define flock_lock_file_wait(a, b) ({ -ENOLCK; })
1067#define __break_lease(a, b) ({ 0; })
1068#define lease_get_mtime(a, b) ({ })
1069#define generic_setlease(a, b, c) ({ -EINVAL; })
1070#define vfs_setlease(a, b, c) ({ -EINVAL; })
1071#define lease_modify(a, b) ({ -EINVAL; })
1072#define lock_may_read(a, b, c) ({ 1; })
1073#define lock_may_write(a, b, c) ({ 1; })
1074#endif /* !CONFIG_FILE_LOCKING */
1075
1026 1076
1027struct fasync_struct { 1077struct fasync_struct {
1028 int magic; 1078 int magic;
@@ -1106,6 +1156,7 @@ struct super_block {
1106 char s_id[32]; /* Informational name */ 1156 char s_id[32]; /* Informational name */
1107 1157
1108 void *s_fs_info; /* Filesystem private info */ 1158 void *s_fs_info; /* Filesystem private info */
1159 fmode_t s_mode;
1109 1160
1110 /* 1161 /*
1111 * The next field is for VFS *only*. No filesystems have any business 1162 * The next field is for VFS *only*. No filesystems have any business
@@ -1179,6 +1230,20 @@ extern void dentry_unhash(struct dentry *dentry);
1179extern int file_permission(struct file *, int); 1230extern int file_permission(struct file *, int);
1180 1231
1181/* 1232/*
1233 * VFS FS_IOC_FIEMAP helper definitions.
1234 */
1235struct fiemap_extent_info {
1236 unsigned int fi_flags; /* Flags as passed from user */
1237 unsigned int fi_extents_mapped; /* Number of mapped extents */
1238 unsigned int fi_extents_max; /* Size of fiemap_extent array */
1239 struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent
1240 * array */
1241};
1242int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
1243 u64 phys, u64 len, u32 flags);
1244int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1245
1246/*
1182 * File types 1247 * File types
1183 * 1248 *
1184 * NOTE! These match bits 12..15 of stat.st_mode 1249 * NOTE! These match bits 12..15 of stat.st_mode
@@ -1206,20 +1271,7 @@ int generic_osync_inode(struct inode *, struct address_space *, int);
1206 * to have different dirent layouts depending on the binary type. 1271 * to have different dirent layouts depending on the binary type.
1207 */ 1272 */
1208typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); 1273typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
1209 1274struct block_device_operations;
1210struct block_device_operations {
1211 int (*open) (struct inode *, struct file *);
1212 int (*release) (struct inode *, struct file *);
1213 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1214 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1215 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1216 int (*direct_access) (struct block_device *, sector_t,
1217 void **, unsigned long *);
1218 int (*media_changed) (struct gendisk *);
1219 int (*revalidate_disk) (struct gendisk *);
1220 int (*getgeo)(struct block_device *, struct hd_geometry *);
1221 struct module *owner;
1222};
1223 1275
1224/* These macros are for out of kernel modules to test that 1276/* These macros are for out of kernel modules to test that
1225 * the kernel supports the unlocked_ioctl and compat_ioctl 1277 * the kernel supports the unlocked_ioctl and compat_ioctl
@@ -1287,6 +1339,8 @@ struct inode_operations {
1287 void (*truncate_range)(struct inode *, loff_t, loff_t); 1339 void (*truncate_range)(struct inode *, loff_t, loff_t);
1288 long (*fallocate)(struct inode *inode, int mode, loff_t offset, 1340 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1289 loff_t len); 1341 loff_t len);
1342 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1343 u64 len);
1290}; 1344};
1291 1345
1292struct seq_file; 1346struct seq_file;
@@ -1531,7 +1585,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1531 struct vfsmount *mnt); 1585 struct vfsmount *mnt);
1532extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1586extern int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1533int __put_super_and_need_restart(struct super_block *sb); 1587int __put_super_and_need_restart(struct super_block *sb);
1534void unnamed_dev_init(void);
1535 1588
1536/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1589/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1537#define fops_get(fops) \ 1590#define fops_get(fops) \
@@ -1554,9 +1607,12 @@ extern int vfs_statfs(struct dentry *, struct kstatfs *);
1554/* /sys/fs */ 1607/* /sys/fs */
1555extern struct kobject *fs_kobj; 1608extern struct kobject *fs_kobj;
1556 1609
1610extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1611
1557#define FLOCK_VERIFY_READ 1 1612#define FLOCK_VERIFY_READ 1
1558#define FLOCK_VERIFY_WRITE 2 1613#define FLOCK_VERIFY_WRITE 2
1559 1614
1615#ifdef CONFIG_FILE_LOCKING
1560extern int locks_mandatory_locked(struct inode *); 1616extern int locks_mandatory_locked(struct inode *);
1561extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1617extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1562 1618
@@ -1587,8 +1643,6 @@ static inline int locks_verify_locked(struct inode *inode)
1587 return 0; 1643 return 0;
1588} 1644}
1589 1645
1590extern int rw_verify_area(int, struct file *, loff_t *, size_t);
1591
1592static inline int locks_verify_truncate(struct inode *inode, 1646static inline int locks_verify_truncate(struct inode *inode,
1593 struct file *filp, 1647 struct file *filp,
1594 loff_t size) 1648 loff_t size)
@@ -1609,6 +1663,15 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1609 return __break_lease(inode, mode); 1663 return __break_lease(inode, mode);
1610 return 0; 1664 return 0;
1611} 1665}
1666#else /* !CONFIG_FILE_LOCKING */
1667#define locks_mandatory_locked(a) ({ 0; })
1668#define locks_mandatory_area(a, b, c, d, e) ({ 0; })
1669#define __mandatory_lock(a) ({ 0; })
1670#define mandatory_lock(a) ({ 0; })
1671#define locks_verify_locked(a) ({ 0; })
1672#define locks_verify_truncate(a, b, c) ({ 0; })
1673#define break_lease(a, b) ({ 0; })
1674#endif /* CONFIG_FILE_LOCKING */
1612 1675
1613/* fs/open.c */ 1676/* fs/open.c */
1614 1677
@@ -1642,7 +1705,7 @@ extern struct block_device *bdget(dev_t);
1642extern void bd_set_size(struct block_device *, loff_t size); 1705extern void bd_set_size(struct block_device *, loff_t size);
1643extern void bd_forget(struct inode *inode); 1706extern void bd_forget(struct inode *inode);
1644extern void bdput(struct block_device *); 1707extern void bdput(struct block_device *);
1645extern struct block_device *open_by_devnum(dev_t, unsigned); 1708extern struct block_device *open_by_devnum(dev_t, fmode_t);
1646#else 1709#else
1647static inline void bd_forget(struct inode *inode) {} 1710static inline void bd_forget(struct inode *inode) {}
1648#endif 1711#endif
@@ -1652,13 +1715,10 @@ extern const struct file_operations bad_sock_fops;
1652extern const struct file_operations def_fifo_fops; 1715extern const struct file_operations def_fifo_fops;
1653#ifdef CONFIG_BLOCK 1716#ifdef CONFIG_BLOCK
1654extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1717extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1655extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1718extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
1656extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
1657 struct gendisk *disk, unsigned cmd,
1658 unsigned long arg);
1659extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1719extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1660extern int blkdev_get(struct block_device *, mode_t, unsigned); 1720extern int blkdev_get(struct block_device *, fmode_t);
1661extern int blkdev_put(struct block_device *); 1721extern int blkdev_put(struct block_device *, fmode_t);
1662extern int bd_claim(struct block_device *, void *); 1722extern int bd_claim(struct block_device *, void *);
1663extern void bd_release(struct block_device *); 1723extern void bd_release(struct block_device *);
1664#ifdef CONFIG_SYSFS 1724#ifdef CONFIG_SYSFS
@@ -1682,15 +1742,17 @@ extern void chrdev_show(struct seq_file *,off_t);
1682 1742
1683/* fs/block_dev.c */ 1743/* fs/block_dev.c */
1684#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1744#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1745#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */
1685 1746
1686#ifdef CONFIG_BLOCK 1747#ifdef CONFIG_BLOCK
1687#define BLKDEV_MAJOR_HASH_SIZE 255 1748#define BLKDEV_MAJOR_HASH_SIZE 255
1688extern const char *__bdevname(dev_t, char *buffer); 1749extern const char *__bdevname(dev_t, char *buffer);
1689extern const char *bdevname(struct block_device *bdev, char *buffer); 1750extern const char *bdevname(struct block_device *bdev, char *buffer);
1690extern struct block_device *lookup_bdev(const char *); 1751extern struct block_device *lookup_bdev(const char *);
1691extern struct block_device *open_bdev_excl(const char *, int, void *); 1752extern struct block_device *open_bdev_exclusive(const char *, fmode_t, void *);
1692extern void close_bdev_excl(struct block_device *); 1753extern void close_bdev_exclusive(struct block_device *, fmode_t);
1693extern void blkdev_show(struct seq_file *,off_t); 1754extern void blkdev_show(struct seq_file *,off_t);
1755
1694#else 1756#else
1695#define BLKDEV_MAJOR_HASH_SIZE 0 1757#define BLKDEV_MAJOR_HASH_SIZE 0
1696#endif 1758#endif
@@ -1718,6 +1780,9 @@ extern int fs_may_remount_ro(struct super_block *);
1718 */ 1780 */
1719#define bio_data_dir(bio) ((bio)->bi_rw & 1) 1781#define bio_data_dir(bio) ((bio)->bi_rw & 1)
1720 1782
1783extern void check_disk_size_change(struct gendisk *disk,
1784 struct block_device *bdev);
1785extern int revalidate_disk(struct gendisk *);
1721extern int check_disk_change(struct block_device *); 1786extern int check_disk_change(struct block_device *);
1722extern int __invalidate_device(struct block_device *); 1787extern int __invalidate_device(struct block_device *);
1723extern int invalidate_partition(struct gendisk *, int); 1788extern int invalidate_partition(struct gendisk *, int);
@@ -1776,6 +1841,11 @@ extern int inode_permission(struct inode *, int);
1776extern int generic_permission(struct inode *, int, 1841extern int generic_permission(struct inode *, int,
1777 int (*check_acl)(struct inode *, int)); 1842 int (*check_acl)(struct inode *, int));
1778 1843
1844static inline bool execute_ok(struct inode *inode)
1845{
1846 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
1847}
1848
1779extern int get_write_access(struct inode *); 1849extern int get_write_access(struct inode *);
1780extern int deny_write_access(struct file *); 1850extern int deny_write_access(struct file *);
1781static inline void put_write_access(struct inode * inode) 1851static inline void put_write_access(struct inode * inode)
@@ -1980,6 +2050,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
1980 2050
1981extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2051extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1982 unsigned long arg); 2052 unsigned long arg);
2053extern int generic_block_fiemap(struct inode *inode,
2054 struct fiemap_extent_info *fieinfo, u64 start,
2055 u64 len, get_block_t *get_block);
1983 2056
1984extern void get_filesystem(struct file_system_type *fs); 2057extern void get_filesystem(struct file_system_type *fs);
1985extern void put_filesystem(struct file_system_type *fs); 2058extern void put_filesystem(struct file_system_type *fs);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a89513188ce7..00fbd5b245c9 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -188,7 +188,7 @@ static inline void fsnotify_close(struct file *file)
188 struct dentry *dentry = file->f_path.dentry; 188 struct dentry *dentry = file->f_path.dentry;
189 struct inode *inode = dentry->d_inode; 189 struct inode *inode = dentry->d_inode;
190 const char *name = dentry->d_name.name; 190 const char *name = dentry->d_name.name;
191 mode_t mode = file->f_mode; 191 fmode_t mode = file->f_mode;
192 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; 192 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE;
193 193
194 if (S_ISDIR(inode->i_mode)) 194 if (S_ISDIR(inode->i_mode))
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index bb384068272e..a3d46151be19 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1,10 +1,14 @@
1#ifndef _LINUX_FTRACE_H 1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H 2#define _LINUX_FTRACE_H
3 3
4#ifdef CONFIG_FTRACE
5
6#include <linux/linkage.h> 4#include <linux/linkage.h>
7#include <linux/fs.h> 5#include <linux/fs.h>
6#include <linux/ktime.h>
7#include <linux/init.h>
8#include <linux/types.h>
9#include <linux/kallsyms.h>
10
11#ifdef CONFIG_FTRACE
8 12
9extern int ftrace_enabled; 13extern int ftrace_enabled;
10extern int 14extern int
@@ -36,6 +40,7 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1);
36# define register_ftrace_function(ops) do { } while (0) 40# define register_ftrace_function(ops) do { } while (0)
37# define unregister_ftrace_function(ops) do { } while (0) 41# define unregister_ftrace_function(ops) do { } while (0)
38# define clear_ftrace_function(ops) do { } while (0) 42# define clear_ftrace_function(ops) do { } while (0)
43static inline void ftrace_kill_atomic(void) { }
39#endif /* CONFIG_FTRACE */ 44#endif /* CONFIG_FTRACE */
40 45
41#ifdef CONFIG_DYNAMIC_FTRACE 46#ifdef CONFIG_DYNAMIC_FTRACE
@@ -76,8 +81,10 @@ extern void mcount_call(void);
76 81
77extern int skip_trace(unsigned long ip); 82extern int skip_trace(unsigned long ip);
78 83
79void ftrace_disable_daemon(void); 84extern void ftrace_release(void *start, unsigned long size);
80void ftrace_enable_daemon(void); 85
86extern void ftrace_disable_daemon(void);
87extern void ftrace_enable_daemon(void);
81 88
82#else 89#else
83# define skip_trace(ip) ({ 0; }) 90# define skip_trace(ip) ({ 0; })
@@ -85,6 +92,7 @@ void ftrace_enable_daemon(void);
85# define ftrace_set_filter(buf, len, reset) do { } while (0) 92# define ftrace_set_filter(buf, len, reset) do { } while (0)
86# define ftrace_disable_daemon() do { } while (0) 93# define ftrace_disable_daemon() do { } while (0)
87# define ftrace_enable_daemon() do { } while (0) 94# define ftrace_enable_daemon() do { } while (0)
95static inline void ftrace_release(void *start, unsigned long size) { }
88#endif /* CONFIG_DYNAMIC_FTRACE */ 96#endif /* CONFIG_DYNAMIC_FTRACE */
89 97
90/* totally disable ftrace - can not re-enable after this */ 98/* totally disable ftrace - can not re-enable after this */
@@ -98,9 +106,11 @@ static inline void tracer_disable(void)
98#endif 106#endif
99} 107}
100 108
101/* Ftrace disable/restore without lock. Some synchronization mechanism 109/*
110 * Ftrace disable/restore without lock. Some synchronization mechanism
102 * must be used to prevent ftrace_enabled to be changed between 111 * must be used to prevent ftrace_enabled to be changed between
103 * disable/restore. */ 112 * disable/restore.
113 */
104static inline int __ftrace_enabled_save(void) 114static inline int __ftrace_enabled_save(void)
105{ 115{
106#ifdef CONFIG_FTRACE 116#ifdef CONFIG_FTRACE
@@ -157,9 +167,71 @@ static inline void __ftrace_enabled_restore(int enabled)
157#ifdef CONFIG_TRACING 167#ifdef CONFIG_TRACING
158extern void 168extern void
159ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); 169ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
170
171/**
172 * ftrace_printk - printf formatting in the ftrace buffer
173 * @fmt: the printf format for printing
174 *
175 * Note: __ftrace_printk is an internal function for ftrace_printk and
176 * the @ip is passed in via the ftrace_printk macro.
177 *
178 * This function allows a kernel developer to debug fast path sections
179 * that printk is not appropriate for. By scattering in various
180 * printk like tracing in the code, a developer can quickly see
181 * where problems are occurring.
182 *
183 * This is intended as a debugging tool for the developer only.
184 * Please refrain from leaving ftrace_printks scattered around in
185 * your code.
186 */
187# define ftrace_printk(fmt...) __ftrace_printk(_THIS_IP_, fmt)
188extern int
189__ftrace_printk(unsigned long ip, const char *fmt, ...)
190 __attribute__ ((format (printf, 2, 3)));
191extern void ftrace_dump(void);
160#else 192#else
161static inline void 193static inline void
162ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 194ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
195static inline int
196ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0)));
197
198static inline int
199ftrace_printk(const char *fmt, ...)
200{
201 return 0;
202}
203static inline void ftrace_dump(void) { }
163#endif 204#endif
164 205
206#ifdef CONFIG_FTRACE_MCOUNT_RECORD
207extern void ftrace_init(void);
208extern void ftrace_init_module(unsigned long *start, unsigned long *end);
209#else
210static inline void ftrace_init(void) { }
211static inline void
212ftrace_init_module(unsigned long *start, unsigned long *end) { }
213#endif
214
215
216struct boot_trace {
217 pid_t caller;
218 char func[KSYM_NAME_LEN];
219 int result;
220 unsigned long long duration; /* usecs */
221 ktime_t calltime;
222 ktime_t rettime;
223};
224
225#ifdef CONFIG_BOOT_TRACER
226extern void trace_boot(struct boot_trace *it, initcall_t fn);
227extern void start_boot_trace(void);
228extern void stop_boot_trace(void);
229#else
230static inline void trace_boot(struct boot_trace *it, initcall_t fn) { }
231static inline void start_boot_trace(void) { }
232static inline void stop_boot_trace(void) { }
233#endif
234
235
236
165#endif /* _LINUX_FTRACE_H */ 237#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 265635dc9908..350fe9767bbc 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -17,8 +17,14 @@
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr 18 * - add blksize field to fuse_attr
19 * - add file flags field to fuse_read_in and fuse_write_in 19 * - add file flags field to fuse_read_in and fuse_write_in
20 *
21 * 7.10
22 * - add nonseekable open flag
20 */ 23 */
21 24
25#ifndef _LINUX_FUSE_H
26#define _LINUX_FUSE_H
27
22#include <asm/types.h> 28#include <asm/types.h>
23#include <linux/major.h> 29#include <linux/major.h>
24 30
@@ -26,7 +32,7 @@
26#define FUSE_KERNEL_VERSION 7 32#define FUSE_KERNEL_VERSION 7
27 33
28/** Minor version number of this interface */ 34/** Minor version number of this interface */
29#define FUSE_KERNEL_MINOR_VERSION 9 35#define FUSE_KERNEL_MINOR_VERSION 10
30 36
31/** The node ID of the root inode */ 37/** The node ID of the root inode */
32#define FUSE_ROOT_ID 1 38#define FUSE_ROOT_ID 1
@@ -98,9 +104,11 @@ struct fuse_file_lock {
98 * 104 *
99 * FOPEN_DIRECT_IO: bypass page cache for this open file 105 * FOPEN_DIRECT_IO: bypass page cache for this open file
100 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open 106 * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
107 * FOPEN_NONSEEKABLE: the file is not seekable
101 */ 108 */
102#define FOPEN_DIRECT_IO (1 << 0) 109#define FOPEN_DIRECT_IO (1 << 0)
103#define FOPEN_KEEP_CACHE (1 << 1) 110#define FOPEN_KEEP_CACHE (1 << 1)
111#define FOPEN_NONSEEKABLE (1 << 2)
104 112
105/** 113/**
106 * INIT request/reply flags 114 * INIT request/reply flags
@@ -409,3 +417,5 @@ struct fuse_dirent {
409#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) 417#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
410#define FUSE_DIRENT_SIZE(d) \ 418#define FUSE_DIRENT_SIZE(d) \
411 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) 419 FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
420
421#endif /* _LINUX_FUSE_H */
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index f64e29c0ef3f..0cd825f7363a 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -146,10 +146,11 @@ static inline void gameport_unpin_driver(struct gameport *gameport)
146 mutex_unlock(&gameport->drv_mutex); 146 mutex_unlock(&gameport->drv_mutex);
147} 147}
148 148
149void __gameport_register_driver(struct gameport_driver *drv, struct module *owner); 149int __gameport_register_driver(struct gameport_driver *drv,
150static inline void gameport_register_driver(struct gameport_driver *drv) 150 struct module *owner, const char *mod_name);
151static inline int __must_check gameport_register_driver(struct gameport_driver *drv)
151{ 152{
152 __gameport_register_driver(drv, THIS_MODULE); 153 return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
153} 154}
154 155
155void gameport_unregister_driver(struct gameport_driver *drv); 156void gameport_unregister_driver(struct gameport_driver *drv);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index be4f5e5bfe06..e439e6aed832 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -11,20 +11,20 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kdev_t.h> 13#include <linux/kdev_t.h>
14#include <linux/rcupdate.h>
14 15
15#ifdef CONFIG_BLOCK 16#ifdef CONFIG_BLOCK
16 17
17#define kobj_to_dev(k) container_of(k, struct device, kobj) 18#define kobj_to_dev(k) container_of((k), struct device, kobj)
18#define dev_to_disk(device) container_of(device, struct gendisk, dev) 19#define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev)
19#define dev_to_part(device) container_of(device, struct hd_struct, dev) 20#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
21#define disk_to_dev(disk) (&(disk)->part0.__dev)
22#define part_to_dev(part) (&((part)->__dev))
20 23
21extern struct device_type part_type; 24extern struct device_type part_type;
22extern struct kobject *block_depr; 25extern struct kobject *block_depr;
23extern struct class block_class; 26extern struct class block_class;
24 27
25extern const struct seq_operations partitions_op;
26extern const struct seq_operations diskstats_op;
27
28enum { 28enum {
29/* These three have identical behaviour; use the second one if DOS FDISK gets 29/* These three have identical behaviour; use the second one if DOS FDISK gets
30 confused about extended/logical partitions starting past cylinder 1023. */ 30 confused about extended/logical partitions starting past cylinder 1023. */
@@ -55,6 +55,9 @@ enum {
55 UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ 55 UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
56}; 56};
57 57
58#define DISK_MAX_PARTS 256
59#define DISK_NAME_LEN 32
60
58#include <linux/major.h> 61#include <linux/major.h>
59#include <linux/device.h> 62#include <linux/device.h>
60#include <linux/smp.h> 63#include <linux/smp.h>
@@ -87,7 +90,7 @@ struct disk_stats {
87struct hd_struct { 90struct hd_struct {
88 sector_t start_sect; 91 sector_t start_sect;
89 sector_t nr_sects; 92 sector_t nr_sects;
90 struct device dev; 93 struct device __dev;
91 struct kobject *holder_dir; 94 struct kobject *holder_dir;
92 int policy, partno; 95 int policy, partno;
93#ifdef CONFIG_FAIL_MAKE_REQUEST 96#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -100,6 +103,7 @@ struct hd_struct {
100#else 103#else
101 struct disk_stats dkstats; 104 struct disk_stats dkstats;
102#endif 105#endif
106 struct rcu_head rcu_head;
103}; 107};
104 108
105#define GENHD_FL_REMOVABLE 1 109#define GENHD_FL_REMOVABLE 1
@@ -108,100 +112,148 @@ struct hd_struct {
108#define GENHD_FL_CD 8 112#define GENHD_FL_CD 8
109#define GENHD_FL_UP 16 113#define GENHD_FL_UP 16
110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 114#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
111#define GENHD_FL_FAIL 64 115#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
116
117#define BLK_SCSI_MAX_CMDS (256)
118#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
119
120struct blk_scsi_cmd_filter {
121 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
122 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
123 struct kobject kobj;
124};
125
126struct disk_part_tbl {
127 struct rcu_head rcu_head;
128 int len;
129 struct hd_struct *part[];
130};
112 131
113struct gendisk { 132struct gendisk {
133 /* major, first_minor and minors are input parameters only,
134 * don't use directly. Use disk_devt() and disk_max_parts().
135 */
114 int major; /* major number of driver */ 136 int major; /* major number of driver */
115 int first_minor; 137 int first_minor;
116 int minors; /* maximum number of minors, =1 for 138 int minors; /* maximum number of minors, =1 for
117 * disks that can't be partitioned. */ 139 * disks that can't be partitioned. */
118 char disk_name[32]; /* name of major driver */ 140
119 struct hd_struct **part; /* [indexed by minor] */ 141 char disk_name[DISK_NAME_LEN]; /* name of major driver */
142
143 /* Array of pointers to partitions indexed by partno.
144 * Protected with matching bdev lock but stat and other
145 * non-critical accesses use RCU. Always access through
146 * helpers.
147 */
148 struct disk_part_tbl *part_tbl;
149 struct hd_struct part0;
150
120 struct block_device_operations *fops; 151 struct block_device_operations *fops;
121 struct request_queue *queue; 152 struct request_queue *queue;
122 void *private_data; 153 void *private_data;
123 sector_t capacity;
124 154
125 int flags; 155 int flags;
126 struct device *driverfs_dev; // FIXME: remove 156 struct device *driverfs_dev; // FIXME: remove
127 struct device dev;
128 struct kobject *holder_dir;
129 struct kobject *slave_dir; 157 struct kobject *slave_dir;
130 158
131 struct timer_rand_state *random; 159 struct timer_rand_state *random;
132 int policy;
133 160
134 atomic_t sync_io; /* RAID */ 161 atomic_t sync_io; /* RAID */
135 unsigned long stamp;
136 int in_flight;
137#ifdef CONFIG_SMP
138 struct disk_stats *dkstats;
139#else
140 struct disk_stats dkstats;
141#endif
142 struct work_struct async_notify; 162 struct work_struct async_notify;
143#ifdef CONFIG_BLK_DEV_INTEGRITY 163#ifdef CONFIG_BLK_DEV_INTEGRITY
144 struct blk_integrity *integrity; 164 struct blk_integrity *integrity;
145#endif 165#endif
166 int node_id;
146}; 167};
147 168
148/* 169static inline struct gendisk *part_to_disk(struct hd_struct *part)
149 * Macros to operate on percpu disk statistics:
150 *
151 * The __ variants should only be called in critical sections. The full
152 * variants disable/enable preemption.
153 */
154static inline struct hd_struct *get_part(struct gendisk *gendiskp,
155 sector_t sector)
156{ 170{
157 struct hd_struct *part; 171 if (likely(part)) {
158 int i; 172 if (part->partno)
159 for (i = 0; i < gendiskp->minors - 1; i++) { 173 return dev_to_disk(part_to_dev(part)->parent);
160 part = gendiskp->part[i]; 174 else
161 if (part && part->start_sect <= sector 175 return dev_to_disk(part_to_dev(part));
162 && sector < part->start_sect + part->nr_sects)
163 return part;
164 } 176 }
165 return NULL; 177 return NULL;
166} 178}
167 179
168#ifdef CONFIG_SMP 180static inline int disk_max_parts(struct gendisk *disk)
169#define __disk_stat_add(gendiskp, field, addnd) \ 181{
170 (per_cpu_ptr(gendiskp->dkstats, smp_processor_id())->field += addnd) 182 if (disk->flags & GENHD_FL_EXT_DEVT)
183 return DISK_MAX_PARTS;
184 return disk->minors;
185}
171 186
172#define disk_stat_read(gendiskp, field) \ 187static inline bool disk_partitionable(struct gendisk *disk)
173({ \ 188{
174 typeof(gendiskp->dkstats->field) res = 0; \ 189 return disk_max_parts(disk) > 1;
175 int i; \ 190}
176 for_each_possible_cpu(i) \
177 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
178 res; \
179})
180 191
181static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 192static inline dev_t disk_devt(struct gendisk *disk)
182 int i; 193{
194 return disk_to_dev(disk)->devt;
195}
183 196
184 for_each_possible_cpu(i) 197static inline dev_t part_devt(struct hd_struct *part)
185 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 198{
186 sizeof(struct disk_stats)); 199 return part_to_dev(part)->devt;
187} 200}
188 201
189#define __part_stat_add(part, field, addnd) \ 202extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
190 (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd)
191 203
192#define __all_stat_add(gendiskp, part, field, addnd, sector) \ 204static inline void disk_put_part(struct hd_struct *part)
193({ \ 205{
194 if (part) \ 206 if (likely(part))
195 __part_stat_add(part, field, addnd); \ 207 put_device(part_to_dev(part));
196 __disk_stat_add(gendiskp, field, addnd); \ 208}
197}) 209
210/*
211 * Smarter partition iterator without context limits.
212 */
213#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */
214#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */
215#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */
216
217struct disk_part_iter {
218 struct gendisk *disk;
219 struct hd_struct *part;
220 int idx;
221 unsigned int flags;
222};
223
224extern void disk_part_iter_init(struct disk_part_iter *piter,
225 struct gendisk *disk, unsigned int flags);
226extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
227extern void disk_part_iter_exit(struct disk_part_iter *piter);
228
229extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
230 sector_t sector);
231
232/*
233 * Macros to operate on percpu disk statistics:
234 *
235 * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters
236 * and should be called between disk_stat_lock() and
237 * disk_stat_unlock().
238 *
239 * part_stat_read() can be called at any time.
240 *
241 * part_stat_{add|set_all}() and {init|free}_part_stats are for
242 * internal use only.
243 */
244#ifdef CONFIG_SMP
245#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); })
246#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0)
247
248#define __part_stat_add(cpu, part, field, addnd) \
249 (per_cpu_ptr((part)->dkstats, (cpu))->field += (addnd))
198 250
199#define part_stat_read(part, field) \ 251#define part_stat_read(part, field) \
200({ \ 252({ \
201 typeof(part->dkstats->field) res = 0; \ 253 typeof((part)->dkstats->field) res = 0; \
202 int i; \ 254 int i; \
203 for_each_possible_cpu(i) \ 255 for_each_possible_cpu(i) \
204 res += per_cpu_ptr(part->dkstats, i)->field; \ 256 res += per_cpu_ptr((part)->dkstats, i)->field; \
205 res; \ 257 res; \
206}) 258})
207 259
@@ -213,171 +265,107 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
213 memset(per_cpu_ptr(part->dkstats, i), value, 265 memset(per_cpu_ptr(part->dkstats, i), value,
214 sizeof(struct disk_stats)); 266 sizeof(struct disk_stats));
215} 267}
216
217#else /* !CONFIG_SMP */
218#define __disk_stat_add(gendiskp, field, addnd) \
219 (gendiskp->dkstats.field += addnd)
220#define disk_stat_read(gendiskp, field) (gendiskp->dkstats.field)
221 268
222static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) 269static inline int init_part_stats(struct hd_struct *part)
223{ 270{
224 memset(&gendiskp->dkstats, value, sizeof (struct disk_stats)); 271 part->dkstats = alloc_percpu(struct disk_stats);
272 if (!part->dkstats)
273 return 0;
274 return 1;
225} 275}
226 276
227#define __part_stat_add(part, field, addnd) \ 277static inline void free_part_stats(struct hd_struct *part)
228 (part->dkstats.field += addnd)
229
230#define __all_stat_add(gendiskp, part, field, addnd, sector) \
231({ \
232 if (part) \
233 part->dkstats.field += addnd; \
234 __disk_stat_add(gendiskp, field, addnd); \
235})
236
237#define part_stat_read(part, field) (part->dkstats.field)
238
239static inline void part_stat_set_all(struct hd_struct *part, int value)
240{ 278{
241 memset(&part->dkstats, value, sizeof(struct disk_stats)); 279 free_percpu(part->dkstats);
242} 280}
243 281
244#endif /* CONFIG_SMP */ 282#else /* !CONFIG_SMP */
283#define part_stat_lock() ({ rcu_read_lock(); 0; })
284#define part_stat_unlock() rcu_read_unlock()
245 285
246#define disk_stat_add(gendiskp, field, addnd) \ 286#define __part_stat_add(cpu, part, field, addnd) \
247 do { \ 287 ((part)->dkstats.field += addnd)
248 preempt_disable(); \
249 __disk_stat_add(gendiskp, field, addnd); \
250 preempt_enable(); \
251 } while (0)
252
253#define __disk_stat_dec(gendiskp, field) __disk_stat_add(gendiskp, field, -1)
254#define disk_stat_dec(gendiskp, field) disk_stat_add(gendiskp, field, -1)
255
256#define __disk_stat_inc(gendiskp, field) __disk_stat_add(gendiskp, field, 1)
257#define disk_stat_inc(gendiskp, field) disk_stat_add(gendiskp, field, 1)
258
259#define __disk_stat_sub(gendiskp, field, subnd) \
260 __disk_stat_add(gendiskp, field, -subnd)
261#define disk_stat_sub(gendiskp, field, subnd) \
262 disk_stat_add(gendiskp, field, -subnd)
263
264#define part_stat_add(gendiskp, field, addnd) \
265 do { \
266 preempt_disable(); \
267 __part_stat_add(gendiskp, field, addnd);\
268 preempt_enable(); \
269 } while (0)
270
271#define __part_stat_dec(gendiskp, field) __part_stat_add(gendiskp, field, -1)
272#define part_stat_dec(gendiskp, field) part_stat_add(gendiskp, field, -1)
273
274#define __part_stat_inc(gendiskp, field) __part_stat_add(gendiskp, field, 1)
275#define part_stat_inc(gendiskp, field) part_stat_add(gendiskp, field, 1)
276
277#define __part_stat_sub(gendiskp, field, subnd) \
278 __part_stat_add(gendiskp, field, -subnd)
279#define part_stat_sub(gendiskp, field, subnd) \
280 part_stat_add(gendiskp, field, -subnd)
281
282#define all_stat_add(gendiskp, part, field, addnd, sector) \
283 do { \
284 preempt_disable(); \
285 __all_stat_add(gendiskp, part, field, addnd, sector); \
286 preempt_enable(); \
287 } while (0)
288
289#define __all_stat_dec(gendiskp, field, sector) \
290 __all_stat_add(gendiskp, field, -1, sector)
291#define all_stat_dec(gendiskp, field, sector) \
292 all_stat_add(gendiskp, field, -1, sector)
293
294#define __all_stat_inc(gendiskp, part, field, sector) \
295 __all_stat_add(gendiskp, part, field, 1, sector)
296#define all_stat_inc(gendiskp, part, field, sector) \
297 all_stat_add(gendiskp, part, field, 1, sector)
298
299#define __all_stat_sub(gendiskp, part, field, subnd, sector) \
300 __all_stat_add(gendiskp, part, field, -subnd, sector)
301#define all_stat_sub(gendiskp, part, field, subnd, sector) \
302 all_stat_add(gendiskp, part, field, -subnd, sector)
303
304/* Inlines to alloc and free disk stats in struct gendisk */
305#ifdef CONFIG_SMP
306static inline int init_disk_stats(struct gendisk *disk)
307{
308 disk->dkstats = alloc_percpu(struct disk_stats);
309 if (!disk->dkstats)
310 return 0;
311 return 1;
312}
313 288
314static inline void free_disk_stats(struct gendisk *disk) 289#define part_stat_read(part, field) ((part)->dkstats.field)
290
291static inline void part_stat_set_all(struct hd_struct *part, int value)
315{ 292{
316 free_percpu(disk->dkstats); 293 memset(&part->dkstats, value, sizeof(struct disk_stats));
317} 294}
318 295
319static inline int init_part_stats(struct hd_struct *part) 296static inline int init_part_stats(struct hd_struct *part)
320{ 297{
321 part->dkstats = alloc_percpu(struct disk_stats);
322 if (!part->dkstats)
323 return 0;
324 return 1; 298 return 1;
325} 299}
326 300
327static inline void free_part_stats(struct hd_struct *part) 301static inline void free_part_stats(struct hd_struct *part)
328{ 302{
329 free_percpu(part->dkstats);
330}
331
332#else /* CONFIG_SMP */
333static inline int init_disk_stats(struct gendisk *disk)
334{
335 return 1;
336} 303}
337 304
338static inline void free_disk_stats(struct gendisk *disk) 305#endif /* CONFIG_SMP */
339{
340}
341 306
342static inline int init_part_stats(struct hd_struct *part) 307#define part_stat_add(cpu, part, field, addnd) do { \
308 __part_stat_add((cpu), (part), field, addnd); \
309 if ((part)->partno) \
310 __part_stat_add((cpu), &part_to_disk((part))->part0, \
311 field, addnd); \
312} while (0)
313
314#define part_stat_dec(cpu, gendiskp, field) \
315 part_stat_add(cpu, gendiskp, field, -1)
316#define part_stat_inc(cpu, gendiskp, field) \
317 part_stat_add(cpu, gendiskp, field, 1)
318#define part_stat_sub(cpu, gendiskp, field, subnd) \
319 part_stat_add(cpu, gendiskp, field, -subnd)
320
321static inline void part_inc_in_flight(struct hd_struct *part)
343{ 322{
344 return 1; 323 part->in_flight++;
324 if (part->partno)
325 part_to_disk(part)->part0.in_flight++;
345} 326}
346 327
347static inline void free_part_stats(struct hd_struct *part) 328static inline void part_dec_in_flight(struct hd_struct *part)
348{ 329{
330 part->in_flight--;
331 if (part->partno)
332 part_to_disk(part)->part0.in_flight--;
349} 333}
350#endif /* CONFIG_SMP */
351 334
352/* drivers/block/ll_rw_blk.c */ 335/* drivers/block/ll_rw_blk.c */
353extern void disk_round_stats(struct gendisk *disk); 336extern void part_round_stats(int cpu, struct hd_struct *part);
354extern void part_round_stats(struct hd_struct *part);
355 337
356/* drivers/block/genhd.c */ 338/* drivers/block/genhd.c */
357extern int get_blkdev_list(char *, int); 339extern int get_blkdev_list(char *, int);
358extern void add_disk(struct gendisk *disk); 340extern void add_disk(struct gendisk *disk);
359extern void del_gendisk(struct gendisk *gp); 341extern void del_gendisk(struct gendisk *gp);
360extern void unlink_gendisk(struct gendisk *gp); 342extern void unlink_gendisk(struct gendisk *gp);
361extern struct gendisk *get_gendisk(dev_t dev, int *part); 343extern struct gendisk *get_gendisk(dev_t dev, int *partno);
344extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
362 345
363extern void set_device_ro(struct block_device *bdev, int flag); 346extern void set_device_ro(struct block_device *bdev, int flag);
364extern void set_disk_ro(struct gendisk *disk, int flag); 347extern void set_disk_ro(struct gendisk *disk, int flag);
365 348
349static inline int get_disk_ro(struct gendisk *disk)
350{
351 return disk->part0.policy;
352}
353
366/* drivers/char/random.c */ 354/* drivers/char/random.c */
367extern void add_disk_randomness(struct gendisk *disk); 355extern void add_disk_randomness(struct gendisk *disk);
368extern void rand_initialize_disk(struct gendisk *disk); 356extern void rand_initialize_disk(struct gendisk *disk);
369 357
370static inline sector_t get_start_sect(struct block_device *bdev) 358static inline sector_t get_start_sect(struct block_device *bdev)
371{ 359{
372 return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect; 360 return bdev->bd_part->start_sect;
373} 361}
374static inline sector_t get_capacity(struct gendisk *disk) 362static inline sector_t get_capacity(struct gendisk *disk)
375{ 363{
376 return disk->capacity; 364 return disk->part0.nr_sects;
377} 365}
378static inline void set_capacity(struct gendisk *disk, sector_t size) 366static inline void set_capacity(struct gendisk *disk, sector_t size)
379{ 367{
380 disk->capacity = size; 368 disk->part0.nr_sects = size;
381} 369}
382 370
383#ifdef CONFIG_SOLARIS_X86_PARTITION 371#ifdef CONFIG_SOLARIS_X86_PARTITION
@@ -527,9 +515,12 @@ struct unixware_disklabel {
527#define ADDPART_FLAG_RAID 1 515#define ADDPART_FLAG_RAID 1
528#define ADDPART_FLAG_WHOLEDISK 2 516#define ADDPART_FLAG_WHOLEDISK 2
529 517
530extern dev_t blk_lookup_devt(const char *name, int part); 518extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
531extern char *disk_name (struct gendisk *hd, int part, char *buf); 519extern void blk_free_devt(dev_t devt);
520extern dev_t blk_lookup_devt(const char *name, int partno);
521extern char *disk_name (struct gendisk *hd, int partno, char *buf);
532 522
523extern int disk_expand_part_tbl(struct gendisk *disk, int target);
533extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 524extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
534extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); 525extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
535extern void delete_partition(struct gendisk *, int); 526extern void delete_partition(struct gendisk *, int);
@@ -546,16 +537,23 @@ extern void blk_register_region(dev_t devt, unsigned long range,
546 void *data); 537 void *data);
547extern void blk_unregister_region(dev_t devt, unsigned long range); 538extern void blk_unregister_region(dev_t devt, unsigned long range);
548 539
549static inline struct block_device *bdget_disk(struct gendisk *disk, int index) 540extern ssize_t part_size_show(struct device *dev,
550{ 541 struct device_attribute *attr, char *buf);
551 return bdget(MKDEV(disk->major, disk->first_minor) + index); 542extern ssize_t part_stat_show(struct device *dev,
552} 543 struct device_attribute *attr, char *buf);
544#ifdef CONFIG_FAIL_MAKE_REQUEST
545extern ssize_t part_fail_show(struct device *dev,
546 struct device_attribute *attr, char *buf);
547extern ssize_t part_fail_store(struct device *dev,
548 struct device_attribute *attr,
549 const char *buf, size_t count);
550#endif /* CONFIG_FAIL_MAKE_REQUEST */
553 551
554#else /* CONFIG_BLOCK */ 552#else /* CONFIG_BLOCK */
555 553
556static inline void printk_all_partitions(void) { } 554static inline void printk_all_partitions(void) { }
557 555
558static inline dev_t blk_lookup_devt(const char *name, int part) 556static inline dev_t blk_lookup_devt(const char *name, int partno)
559{ 557{
560 dev_t devt = MKDEV(0, 0); 558 dev_t devt = MKDEV(0, 0);
561 return devt; 559 return devt;
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index c3c19f926e6f..14d0df0b5749 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -118,7 +118,11 @@ struct gfs2_sb {
118 118
119 char sb_lockproto[GFS2_LOCKNAME_LEN]; 119 char sb_lockproto[GFS2_LOCKNAME_LEN];
120 char sb_locktable[GFS2_LOCKNAME_LEN]; 120 char sb_locktable[GFS2_LOCKNAME_LEN];
121 /* In gfs1, quota and license dinodes followed */ 121
122 struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
123 struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
124#define GFS2_HAS_UUID 1
125 __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */
122}; 126};
123 127
124/* 128/*
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 730a20b83576..e10c49a5b96e 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,7 @@
8 8
9#else 9#else
10 10
11#include <linux/kernel.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13 14
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
32 33
33static inline void gpio_free(unsigned gpio) 34static inline void gpio_free(unsigned gpio)
34{ 35{
36 might_sleep();
37
35 /* GPIO can never have been requested */ 38 /* GPIO can never have been requested */
36 WARN_ON(1); 39 WARN_ON(1);
37} 40}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ac4e678a04ed..5355ca4b939e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -67,6 +67,7 @@
67#include <linux/types.h> 67#include <linux/types.h>
68#include <linux/slab.h> 68#include <linux/slab.h>
69#include <linux/list.h> 69#include <linux/list.h>
70#include <linux/mod_devicetable.h> /* hid_device_id */
70#include <linux/timer.h> 71#include <linux/timer.h>
71#include <linux/workqueue.h> 72#include <linux/workqueue.h>
72#include <linux/input.h> 73#include <linux/input.h>
@@ -246,6 +247,19 @@ struct hid_item {
246#define HID_FEATURE_REPORT 2 247#define HID_FEATURE_REPORT 2
247 248
248/* 249/*
250 * HID connect requests
251 */
252
253#define HID_CONNECT_HIDINPUT 0x01
254#define HID_CONNECT_HIDINPUT_FORCE 0x02
255#define HID_CONNECT_HIDRAW 0x04
256#define HID_CONNECT_HIDDEV 0x08
257#define HID_CONNECT_HIDDEV_FORCE 0x10
258#define HID_CONNECT_FF 0x20
259#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
260 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
261
262/*
249 * HID device quirks. 263 * HID device quirks.
250 */ 264 */
251 265
@@ -256,48 +270,11 @@ struct hid_item {
256 270
257#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
258#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
259#define HID_QUIRK_IGNORE 0x00000004
260#define HID_QUIRK_NOGET 0x00000008 273#define HID_QUIRK_NOGET 0x00000008
261#define HID_QUIRK_HIDDEV 0x00000010
262#define HID_QUIRK_BADPAD 0x00000020 274#define HID_QUIRK_BADPAD 0x00000020
263#define HID_QUIRK_MULTI_INPUT 0x00000040 275#define HID_QUIRK_MULTI_INPUT 0x00000040
264#define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x00000080
265#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
266#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
267#define HID_QUIRK_MIGHTYMOUSE 0x00000400
268#define HID_QUIRK_APPLE_HAS_FN 0x00000800
269#define HID_QUIRK_APPLE_FN_ON 0x00001000
270#define HID_QUIRK_INVERT_HWHEEL 0x00002000
271#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
272#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
273#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 276#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
274#define HID_QUIRK_IGNORE_MOUSE 0x00020000
275#define HID_QUIRK_SONY_PS3_CONTROLLER 0x00040000
276#define HID_QUIRK_DUPLICATE_USAGES 0x00080000
277#define HID_QUIRK_RESET_LEDS 0x00100000
278#define HID_QUIRK_HIDINPUT 0x00200000
279#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
280#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
281#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
282#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
283#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
284#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
285#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 277#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
286#define HID_QUIRK_APPLE_NUMLOCK_EMULATION 0x20000000
287
288/*
289 * Separate quirks for runtime report descriptor fixup
290 */
291
292#define HID_QUIRK_RDESC_CYMOTION 0x00000001
293#define HID_QUIRK_RDESC_LOGITECH 0x00000002
294#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
295#define HID_QUIRK_RDESC_PETALYNX 0x00000008
296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
299#define HID_QUIRK_RDESC_MICROSOFT_RECV_1028 0x00000080
300#define HID_QUIRK_RDESC_SUNPLUS_WDESKTOP 0x00000100
301 278
302/* 279/*
303 * This is the global environment of the parser. This information is 280 * This is the global environment of the parser. This information is
@@ -411,12 +388,21 @@ struct hid_report_enum {
411struct hid_control_fifo { 388struct hid_control_fifo {
412 unsigned char dir; 389 unsigned char dir;
413 struct hid_report *report; 390 struct hid_report *report;
391 char *raw_report;
392};
393
394struct hid_output_fifo {
395 struct hid_report *report;
396 char *raw_report;
414}; 397};
415 398
416#define HID_CLAIMED_INPUT 1 399#define HID_CLAIMED_INPUT 1
417#define HID_CLAIMED_HIDDEV 2 400#define HID_CLAIMED_HIDDEV 2
418#define HID_CLAIMED_HIDRAW 4 401#define HID_CLAIMED_HIDRAW 4
419 402
403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2
405
420#define HID_CTRL_RUNNING 1 406#define HID_CTRL_RUNNING 1
421#define HID_OUT_RUNNING 2 407#define HID_OUT_RUNNING 2
422#define HID_IN_RUNNING 3 408#define HID_IN_RUNNING 3
@@ -431,22 +417,34 @@ struct hid_input {
431 struct input_dev *input; 417 struct input_dev *input;
432}; 418};
433 419
420enum hid_type {
421 HID_TYPE_OTHER = 0,
422 HID_TYPE_USBMOUSE
423};
424
425struct hid_driver;
426struct hid_ll_driver;
427
434struct hid_device { /* device report descriptor */ 428struct hid_device { /* device report descriptor */
435 __u8 *rdesc; 429 __u8 *rdesc;
436 unsigned rsize; 430 unsigned rsize;
437 struct hid_collection *collection; /* List of HID collections */ 431 struct hid_collection *collection; /* List of HID collections */
438 unsigned collection_size; /* Number of allocated hid_collections */ 432 unsigned collection_size; /* Number of allocated hid_collections */
439 unsigned maxcollection; /* Number of parsed collections */ 433 unsigned maxcollection; /* Number of parsed collections */
440 unsigned maxapplication; /* Number of applications */ 434 unsigned maxapplication; /* Number of applications */
441 unsigned short bus; /* BUS ID */ 435 __u16 bus; /* BUS ID */
442 unsigned short vendor; /* Vendor ID */ 436 __u32 vendor; /* Vendor ID */
443 unsigned short product; /* Product ID */ 437 __u32 product; /* Product ID */
444 unsigned version; /* HID version */ 438 __u32 version; /* HID version */
439 enum hid_type type; /* device type (mouse, kbd, ...) */
445 unsigned country; /* HID country */ 440 unsigned country; /* HID country */
446 struct hid_report_enum report_enum[HID_REPORT_TYPES]; 441 struct hid_report_enum report_enum[HID_REPORT_TYPES];
447 442
448 struct device *dev; /* device */ 443 struct device dev; /* device */
444 struct hid_driver *driver;
445 struct hid_ll_driver *ll_driver;
449 446
447 unsigned int status; /* see STAT flags above */
450 unsigned claimed; /* Claimed by hidinput, hiddev? */ 448 unsigned claimed; /* Claimed by hidinput, hiddev? */
451 unsigned quirks; /* Various quirks the device can pull on us */ 449 unsigned quirks; /* Various quirks the device can pull on us */
452 450
@@ -462,26 +460,29 @@ struct hid_device { /* device report descriptor */
462 460
463 void *driver_data; 461 void *driver_data;
464 462
465 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */ 463 /* temporary hid_ff handling (until moved to the drivers) */
466 464 int (*ff_init)(struct hid_device *);
467 /* device-specific function pointers */
468 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
469 int (*hid_open) (struct hid_device *);
470 void (*hid_close) (struct hid_device *);
471 465
472 /* hiddev event handler */ 466 /* hiddev event handler */
467 int (*hiddev_connect)(struct hid_device *, unsigned int);
473 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 468 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
474 struct hid_usage *, __s32); 469 struct hid_usage *, __s32);
475 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 470 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
476 471
477 /* handler for raw output data, used by hidraw */ 472 /* handler for raw output data, used by hidraw */
478 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 473 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
479#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
480 unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
481 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
482#endif
483}; 474};
484 475
476static inline void *hid_get_drvdata(struct hid_device *hdev)
477{
478 return dev_get_drvdata(&hdev->dev);
479}
480
481static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
482{
483 dev_set_drvdata(&hdev->dev, data);
484}
485
485#define HID_GLOBAL_STACK_SIZE 4 486#define HID_GLOBAL_STACK_SIZE 4
486#define HID_COLLECTION_STACK_SIZE 4 487#define HID_COLLECTION_STACK_SIZE 4
487 488
@@ -510,6 +511,107 @@ struct hid_descriptor {
510 struct hid_class_descriptor desc[1]; 511 struct hid_class_descriptor desc[1];
511} __attribute__ ((packed)); 512} __attribute__ ((packed));
512 513
514#define HID_DEVICE(b, ven, prod) \
515 .bus = (b), \
516 .vendor = (ven), .product = (prod)
517
518#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod)
519#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod)
520
521#define HID_REPORT_ID(rep) \
522 .report_type = (rep)
523#define HID_USAGE_ID(uhid, utype, ucode) \
524 .usage_hid = (uhid), .usage_type = (utype), .usage_code = (ucode)
525/* we don't want to catch types and codes equal to 0 */
526#define HID_TERMINATOR (HID_ANY_ID - 1)
527
528struct hid_report_id {
529 __u32 report_type;
530};
531struct hid_usage_id {
532 __u32 usage_hid;
533 __u32 usage_type;
534 __u32 usage_code;
535};
536
537/**
538 * struct hid_driver
539 * @name: driver name (e.g. "Footech_bar-wheel")
540 * @id_table: which devices is this driver for (must be non-NULL for probe
541 * to be called)
542 * @probe: new device inserted
543 * @remove: device removed (NULL if not a hot-plug capable driver)
544 * @report_table: on which reports to call raw_event (NULL means all)
545 * @raw_event: if report in report_table, this hook is called (NULL means nop)
546 * @usage_table: on which events to call event (NULL means all)
547 * @event: if usage in usage_table, this hook is called (NULL means nop)
548 * @report_fixup: called before report descriptor parsing (NULL means nop)
549 * @input_mapping: invoked on input registering before mapping an usage
550 * @input_mapped: invoked on input registering after mapping an usage
551 *
552 * raw_event and event should return 0 on no action performed, 1 when no
553 * further processing should be done and negative on error
554 *
555 * input_mapping shall return a negative value to completely ignore this usage
556 * (e.g. doubled or invalid usage), zero to continue with parsing of this
557 * usage by generic code (no special handling needed) or positive to skip
558 * generic parsing (needed special handling which was done in the hook already)
559 * input_mapped shall return negative to inform the layer that this usage
560 * should not be considered for further processing or zero to notify that
561 * no processing was performed and should be done in a generic manner
562 * Both these functions may be NULL which means the same behavior as returning
563 * zero from them.
564 */
565struct hid_driver {
566 char *name;
567 const struct hid_device_id *id_table;
568
569 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
570 void (*remove)(struct hid_device *dev);
571
572 const struct hid_report_id *report_table;
573 int (*raw_event)(struct hid_device *hdev, struct hid_report *report,
574 u8 *data, int size);
575 const struct hid_usage_id *usage_table;
576 int (*event)(struct hid_device *hdev, struct hid_field *field,
577 struct hid_usage *usage, __s32 value);
578
579 void (*report_fixup)(struct hid_device *hdev, __u8 *buf,
580 unsigned int size);
581
582 int (*input_mapping)(struct hid_device *hdev,
583 struct hid_input *hidinput, struct hid_field *field,
584 struct hid_usage *usage, unsigned long **bit, int *max);
585 int (*input_mapped)(struct hid_device *hdev,
586 struct hid_input *hidinput, struct hid_field *field,
587 struct hid_usage *usage, unsigned long **bit, int *max);
588/* private: */
589 struct device_driver driver;
590};
591
592/**
593 * hid_ll_driver - low level driver callbacks
594 * @start: called on probe to start the device
595 * @stop: called on remove
596 * @open: called by input layer on open
597 * @close: called by input layer on close
598 * @hidinput_input_event: event input event (e.g. ff or leds)
599 * @parse: this method is called only once to parse the device data,
600 * shouldn't allocate anything to not leak memory
601 */
602struct hid_ll_driver {
603 int (*start)(struct hid_device *hdev);
604 void (*stop)(struct hid_device *hdev);
605
606 int (*open)(struct hid_device *hdev);
607 void (*close)(struct hid_device *hdev);
608
609 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
610 unsigned int code, int value);
611
612 int (*parse)(struct hid_device *hdev);
613};
614
513/* Applications from HID Usage Tables 4/8/99 Version 1.1 */ 615/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
514/* We ignore a few input applications that are not widely used */ 616/* We ignore a few input applications that are not widely used */
515#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) 617#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002))
@@ -520,43 +622,157 @@ struct hid_descriptor {
520extern int hid_debug; 622extern int hid_debug;
521#endif 623#endif
522 624
625extern int hid_add_device(struct hid_device *);
626extern void hid_destroy_device(struct hid_device *);
627
628extern int __must_check __hid_register_driver(struct hid_driver *,
629 struct module *, const char *mod_name);
630static inline int __must_check hid_register_driver(struct hid_driver *driver)
631{
632 return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
633}
634extern void hid_unregister_driver(struct hid_driver *);
635
523extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 636extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
524extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 637extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
525extern int hidinput_connect(struct hid_device *); 638extern int hidinput_connect(struct hid_device *hid, unsigned int force);
526extern void hidinput_disconnect(struct hid_device *); 639extern void hidinput_disconnect(struct hid_device *);
527 640
528int hid_set_field(struct hid_field *, unsigned, __s32); 641int hid_set_field(struct hid_field *, unsigned, __s32);
529int hid_input_report(struct hid_device *, int type, u8 *, int, int); 642int hid_input_report(struct hid_device *, int type, u8 *, int, int);
530int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 643int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
531int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
532int hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
533int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
534void hid_output_report(struct hid_report *report, __u8 *data); 644void hid_output_report(struct hid_report *report, __u8 *data);
535void hid_free_device(struct hid_device *device); 645struct hid_device *hid_allocate_device(void);
536struct hid_device *hid_parse_report(__u8 *start, unsigned size); 646int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
647int hid_connect(struct hid_device *hid, unsigned int connect_mask);
648
649/**
650 * hid_map_usage - map usage input bits
651 *
652 * @hidinput: hidinput which we are interested in
653 * @usage: usage to fill in
654 * @bit: pointer to input->{}bit (out parameter)
655 * @max: maximal valid usage->code to consider later (out parameter)
656 * @type: input event type (EV_KEY, EV_REL, ...)
657 * @c: code which corresponds to this usage and type
658 */
659static inline void hid_map_usage(struct hid_input *hidinput,
660 struct hid_usage *usage, unsigned long **bit, int *max,
661 __u8 type, __u16 c)
662{
663 struct input_dev *input = hidinput->input;
664
665 usage->type = type;
666 usage->code = c;
667
668 switch (type) {
669 case EV_ABS:
670 *bit = input->absbit;
671 *max = ABS_MAX;
672 break;
673 case EV_REL:
674 *bit = input->relbit;
675 *max = REL_MAX;
676 break;
677 case EV_KEY:
678 *bit = input->keybit;
679 *max = KEY_MAX;
680 break;
681 case EV_LED:
682 *bit = input->ledbit;
683 *max = LED_MAX;
684 break;
685 }
686}
687
688/**
689 * hid_map_usage_clear - map usage input bits and clear the input bit
690 *
691 * The same as hid_map_usage, except the @c bit is also cleared in supported
692 * bits (@bit).
693 */
694static inline void hid_map_usage_clear(struct hid_input *hidinput,
695 struct hid_usage *usage, unsigned long **bit, int *max,
696 __u8 type, __u16 c)
697{
698 hid_map_usage(hidinput, usage, bit, max, type, c);
699 clear_bit(c, *bit);
700}
701
702/**
703 * hid_parse - parse HW reports
704 *
705 * @hdev: hid device
706 *
707 * Call this from probe after you set up the device (if needed). Your
708 * report_fixup will be called (if non-NULL) after reading raw report from
709 * device before passing it to hid layer for real parsing.
710 */
711static inline int __must_check hid_parse(struct hid_device *hdev)
712{
713 int ret;
714
715 if (hdev->status & HID_STAT_PARSED)
716 return 0;
717
718 ret = hdev->ll_driver->parse(hdev);
719 if (!ret)
720 hdev->status |= HID_STAT_PARSED;
721
722 return ret;
723}
724
725/**
726 * hid_hw_start - start underlaying HW
727 *
728 * @hdev: hid device
729 * @connect_mask: which outputs to connect, see HID_CONNECT_*
730 *
731 * Call this in probe function *after* hid_parse. This will setup HW buffers
732 * and start the device (if not deffered to device open). hid_hw_stop must be
733 * called if this was successfull.
734 */
735static inline int __must_check hid_hw_start(struct hid_device *hdev,
736 unsigned int connect_mask)
737{
738 int ret = hdev->ll_driver->start(hdev);
739 if (ret || !connect_mask)
740 return ret;
741 ret = hid_connect(hdev, connect_mask);
742 if (ret)
743 hdev->ll_driver->stop(hdev);
744 return ret;
745}
746
747/**
748 * hid_hw_stop - stop underlaying HW
749 *
750 * @hdev: hid device
751 *
752 * This is usually called from remove function or from probe when something
753 * failed and hid_hw_start was called already.
754 */
755static inline void hid_hw_stop(struct hid_device *hdev)
756{
757 hdev->ll_driver->stop(hdev);
758}
759
760void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
761 int interrupt);
762
763extern int hid_generic_init(void);
764extern void hid_generic_exit(void);
537 765
538/* HID quirks API */ 766/* HID quirks API */
539u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct); 767u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);
540int usbhid_quirks_init(char **quirks_param); 768int usbhid_quirks_init(char **quirks_param);
541void usbhid_quirks_exit(void); 769void usbhid_quirks_exit(void);
542void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **); 770void usbhid_set_leds(struct hid_device *hid);
543
544#ifdef CONFIG_HID_FF
545int hid_ff_init(struct hid_device *hid);
546 771
547int hid_lgff_init(struct hid_device *hid);
548int hid_lg2ff_init(struct hid_device *hid);
549int hid_plff_init(struct hid_device *hid);
550int hid_tmff_init(struct hid_device *hid);
551int hid_zpff_init(struct hid_device *hid);
552#ifdef CONFIG_HID_PID 772#ifdef CONFIG_HID_PID
553int hid_pidff_init(struct hid_device *hid); 773int hid_pidff_init(struct hid_device *hid);
554#else 774#else
555static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; } 775#define hid_pidff_init NULL
556#endif
557
558#else
559static inline int hid_ff_init(struct hid_device *hid) { return -1; }
560#endif 776#endif
561 777
562#ifdef CONFIG_HID_DEBUG 778#ifdef CONFIG_HID_DEBUG
@@ -572,10 +788,23 @@ dbg_hid(const char *fmt, ...)
572 return 0; 788 return 0;
573} 789}
574#define dbg_hid_line dbg_hid 790#define dbg_hid_line dbg_hid
575#endif 791#endif /* HID_DEBUG */
576 792
577#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 793#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
578 __FILE__ , ## arg) 794 __FILE__ , ## arg)
579#endif 795#endif /* HID_FF */
796
797#ifdef CONFIG_HID_COMPAT
798#define HID_COMPAT_LOAD_DRIVER(name) \
799void hid_compat_##name(void) { } \
800EXPORT_SYMBOL(hid_compat_##name)
801#else
802#define HID_COMPAT_LOAD_DRIVER(name)
803#endif /* HID_COMPAT */
804#define HID_COMPAT_CALL_DRIVER(name) do { \
805 extern void hid_compat_##name(void); \
806 hid_compat_##name(); \
807} while (0)
808
580#endif 809#endif
581 810
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a416b904ba90..c760ae0eb6a1 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -182,26 +182,28 @@ struct hiddev_usage_ref_multi {
182/* To traverse the input report descriptor info for a HID device, perform the 182/* To traverse the input report descriptor info for a HID device, perform the
183 * following: 183 * following:
184 * 184 *
185 * rinfo.report_type = HID_REPORT_TYPE_INPUT; 185 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
186 * rinfo.report_id = HID_REPORT_ID_FIRST; 186 * rinfo.report_id = HID_REPORT_ID_FIRST;
187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 187 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
188 * 188 *
189 * while (ret >= 0) { 189 * while (ret >= 0) {
190 * for (i = 0; i < rinfo.num_fields; i++) { 190 * for (i = 0; i < rinfo.num_fields; i++) {
191 * finfo.report_type = rinfo.report_type; 191 * finfo.report_type = rinfo.report_type;
192 * finfo.report_id = rinfo.report_id; 192 * finfo.report_id = rinfo.report_id;
193 * finfo.field_index = i; 193 * finfo.field_index = i;
194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo); 194 * ioctl(fd, HIDIOCGFIELDINFO, &finfo);
195 * for (j = 0; j < finfo.maxusage; j++) { 195 * for (j = 0; j < finfo.maxusage; j++) {
196 * uref.field_index = i; 196 * uref.report_type = rinfo.report_type;
197 * uref.usage_index = j; 197 * uref.report_id = rinfo.report_id;
198 * ioctl(fd, HIDIOCGUCODE, &uref); 198 * uref.field_index = i;
199 * ioctl(fd, HIDIOCGUSAGE, &uref); 199 * uref.usage_index = j;
200 * } 200 * ioctl(fd, HIDIOCGUCODE, &uref);
201 * } 201 * ioctl(fd, HIDIOCGUSAGE, &uref);
202 * rinfo.report_id |= HID_REPORT_ID_NEXT; 202 * }
203 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo); 203 * }
204 * } 204 * rinfo.report_id |= HID_REPORT_ID_NEXT;
205 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
206 * }
205 */ 207 */
206 208
207 209
@@ -217,7 +219,7 @@ struct hid_field;
217struct hid_report; 219struct hid_report;
218 220
219#ifdef CONFIG_USB_HIDDEV 221#ifdef CONFIG_USB_HIDDEV
220int hiddev_connect(struct hid_device *); 222int hiddev_connect(struct hid_device *hid, unsigned int force);
221void hiddev_disconnect(struct hid_device *); 223void hiddev_disconnect(struct hid_device *);
222void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 224void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
223 struct hid_usage *usage, __s32 value); 225 struct hid_usage *usage, __s32 value);
@@ -225,7 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report);
225int __init hiddev_init(void); 227int __init hiddev_init(void);
226void hiddev_exit(void); 228void hiddev_exit(void);
227#else 229#else
228static inline int hiddev_connect(struct hid_device *hid) { return -1; } 230static inline int hiddev_connect(struct hid_device *hid,
231 unsigned int force)
232{ return -1; }
229static inline void hiddev_disconnect(struct hid_device *hid) { } 233static inline void hiddev_disconnect(struct hid_device *hid) { }
230static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 234static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
231 struct hid_usage *usage, __s32 value) { } 235 struct hid_usage *usage, __s32 value) { }
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 2dc29ce6c8e4..79f63a27bcef 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -37,6 +37,7 @@ struct hpet {
37#define hpet_compare _u1._hpet_compare 37#define hpet_compare _u1._hpet_compare
38 38
39#define HPET_MAX_TIMERS (32) 39#define HPET_MAX_TIMERS (32)
40#define HPET_MAX_IRQ (32)
40 41
41/* 42/*
42 * HPET general capabilities register 43 * HPET general capabilities register
@@ -64,7 +65,7 @@ struct hpet {
64 */ 65 */
65 66
66#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) 67#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL)
67#define Tn_INI_ROUTE_CAP_SHIFT (32UL) 68#define Tn_INT_ROUTE_CAP_SHIFT (32UL)
68#define Tn_FSB_INT_DELCAP_MASK (0x8000UL) 69#define Tn_FSB_INT_DELCAP_MASK (0x8000UL)
69#define Tn_FSB_INT_DELCAP_SHIFT (15) 70#define Tn_FSB_INT_DELCAP_SHIFT (15)
70#define Tn_FSB_EN_CNF_MASK (0x4000UL) 71#define Tn_FSB_EN_CNF_MASK (0x4000UL)
@@ -91,23 +92,14 @@ struct hpet {
91 * exported interfaces 92 * exported interfaces
92 */ 93 */
93 94
94struct hpet_task {
95 void (*ht_func) (void *);
96 void *ht_data;
97 void *ht_opaque;
98};
99
100struct hpet_data { 95struct hpet_data {
101 unsigned long hd_phys_address; 96 unsigned long hd_phys_address;
102 void __iomem *hd_address; 97 void __iomem *hd_address;
103 unsigned short hd_nirqs; 98 unsigned short hd_nirqs;
104 unsigned short hd_flags;
105 unsigned int hd_state; /* timer allocated */ 99 unsigned int hd_state; /* timer allocated */
106 unsigned int hd_irq[HPET_MAX_TIMERS]; 100 unsigned int hd_irq[HPET_MAX_TIMERS];
107}; 101};
108 102
109#define HPET_DATA_PLATFORM 0x0001 /* platform call to hpet_alloc */
110
111static inline void hpet_reserve_timer(struct hpet_data *hd, int timer) 103static inline void hpet_reserve_timer(struct hpet_data *hd, int timer)
112{ 104{
113 hd->hd_state |= (1 << timer); 105 hd->hd_state |= (1 << timer);
@@ -125,7 +117,7 @@ struct hpet_info {
125 unsigned short hi_timer; 117 unsigned short hi_timer;
126}; 118};
127 119
128#define HPET_INFO_PERIODIC 0x0001 /* timer is periodic */ 120#define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */
129 121
130#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */ 122#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
131#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */ 123#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 2f245fe63bda..2b3645b1acf4 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -20,6 +20,8 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/percpu.h>
24
23 25
24struct hrtimer_clock_base; 26struct hrtimer_clock_base;
25struct hrtimer_cpu_base; 27struct hrtimer_cpu_base;
@@ -101,9 +103,14 @@ enum hrtimer_cb_mode {
101/** 103/**
102 * struct hrtimer - the basic hrtimer structure 104 * struct hrtimer - the basic hrtimer structure
103 * @node: red black tree node for time ordered insertion 105 * @node: red black tree node for time ordered insertion
104 * @expires: the absolute expiry time in the hrtimers internal 106 * @_expires: the absolute expiry time in the hrtimers internal
105 * representation. The time is related to the clock on 107 * representation. The time is related to the clock on
106 * which the timer is based. 108 * which the timer is based. Is setup by adding
109 * slack to the _softexpires value. For non range timers
110 * identical to _softexpires.
111 * @_softexpires: the absolute earliest expiry time of the hrtimer.
112 * The time which was given as expiry time when the timer
113 * was armed.
107 * @function: timer expiry callback function 114 * @function: timer expiry callback function
108 * @base: pointer to the timer base (per cpu and per clock) 115 * @base: pointer to the timer base (per cpu and per clock)
109 * @state: state information (See bit values above) 116 * @state: state information (See bit values above)
@@ -121,16 +128,17 @@ enum hrtimer_cb_mode {
121 */ 128 */
122struct hrtimer { 129struct hrtimer {
123 struct rb_node node; 130 struct rb_node node;
124 ktime_t expires; 131 ktime_t _expires;
132 ktime_t _softexpires;
125 enum hrtimer_restart (*function)(struct hrtimer *); 133 enum hrtimer_restart (*function)(struct hrtimer *);
126 struct hrtimer_clock_base *base; 134 struct hrtimer_clock_base *base;
127 unsigned long state; 135 unsigned long state;
128 enum hrtimer_cb_mode cb_mode;
129 struct list_head cb_entry; 136 struct list_head cb_entry;
137 enum hrtimer_cb_mode cb_mode;
130#ifdef CONFIG_TIMER_STATS 138#ifdef CONFIG_TIMER_STATS
139 int start_pid;
131 void *start_site; 140 void *start_site;
132 char start_comm[16]; 141 char start_comm[16];
133 int start_pid;
134#endif 142#endif
135}; 143};
136 144
@@ -155,10 +163,8 @@ struct hrtimer_sleeper {
155 * @first: pointer to the timer node which expires first 163 * @first: pointer to the timer node which expires first
156 * @resolution: the resolution of the clock, in nanoseconds 164 * @resolution: the resolution of the clock, in nanoseconds
157 * @get_time: function to retrieve the current time of the clock 165 * @get_time: function to retrieve the current time of the clock
158 * @get_softirq_time: function to retrieve the current time from the softirq
159 * @softirq_time: the time when running the hrtimer queue in the softirq 166 * @softirq_time: the time when running the hrtimer queue in the softirq
160 * @offset: offset of this clock to the monotonic base 167 * @offset: offset of this clock to the monotonic base
161 * @reprogram: function to reprogram the timer event
162 */ 168 */
163struct hrtimer_clock_base { 169struct hrtimer_clock_base {
164 struct hrtimer_cpu_base *cpu_base; 170 struct hrtimer_cpu_base *cpu_base;
@@ -167,13 +173,9 @@ struct hrtimer_clock_base {
167 struct rb_node *first; 173 struct rb_node *first;
168 ktime_t resolution; 174 ktime_t resolution;
169 ktime_t (*get_time)(void); 175 ktime_t (*get_time)(void);
170 ktime_t (*get_softirq_time)(void);
171 ktime_t softirq_time; 176 ktime_t softirq_time;
172#ifdef CONFIG_HIGH_RES_TIMERS 177#ifdef CONFIG_HIGH_RES_TIMERS
173 ktime_t offset; 178 ktime_t offset;
174 int (*reprogram)(struct hrtimer *t,
175 struct hrtimer_clock_base *b,
176 ktime_t n);
177#endif 179#endif
178}; 180};
179 181
@@ -207,6 +209,71 @@ struct hrtimer_cpu_base {
207#endif 209#endif
208}; 210};
209 211
212static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
213{
214 timer->_expires = time;
215 timer->_softexpires = time;
216}
217
218static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta)
219{
220 timer->_softexpires = time;
221 timer->_expires = ktime_add_safe(time, delta);
222}
223
224static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta)
225{
226 timer->_softexpires = time;
227 timer->_expires = ktime_add_safe(time, ns_to_ktime(delta));
228}
229
230static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64)
231{
232 timer->_expires.tv64 = tv64;
233 timer->_softexpires.tv64 = tv64;
234}
235
236static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time)
237{
238 timer->_expires = ktime_add_safe(timer->_expires, time);
239 timer->_softexpires = ktime_add_safe(timer->_softexpires, time);
240}
241
242static inline void hrtimer_add_expires_ns(struct hrtimer *timer, unsigned long ns)
243{
244 timer->_expires = ktime_add_ns(timer->_expires, ns);
245 timer->_softexpires = ktime_add_ns(timer->_softexpires, ns);
246}
247
248static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
249{
250 return timer->_expires;
251}
252
253static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
254{
255 return timer->_softexpires;
256}
257
258static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer)
259{
260 return timer->_expires.tv64;
261}
262static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
263{
264 return timer->_softexpires.tv64;
265}
266
267static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer)
268{
269 return ktime_to_ns(timer->_expires);
270}
271
272static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
273{
274 return ktime_sub(timer->_expires, timer->base->get_time());
275}
276
210#ifdef CONFIG_HIGH_RES_TIMERS 277#ifdef CONFIG_HIGH_RES_TIMERS
211struct clock_event_device; 278struct clock_event_device;
212 279
@@ -227,6 +294,8 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
227 return timer->base->cpu_base->hres_active; 294 return timer->base->cpu_base->hres_active;
228} 295}
229 296
297extern void hrtimer_peek_ahead_timers(void);
298
230/* 299/*
231 * The resolution of the clocks. The resolution value is returned in 300 * The resolution of the clocks. The resolution value is returned in
232 * the clock_getres() system call to give application programmers an 301 * the clock_getres() system call to give application programmers an
@@ -249,6 +318,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
249 * is expired in the next softirq when the clock was advanced. 318 * is expired in the next softirq when the clock was advanced.
250 */ 319 */
251static inline void clock_was_set(void) { } 320static inline void clock_was_set(void) { }
321static inline void hrtimer_peek_ahead_timers(void) { }
252 322
253static inline void hres_timers_resume(void) { } 323static inline void hres_timers_resume(void) { }
254 324
@@ -270,6 +340,10 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
270extern ktime_t ktime_get(void); 340extern ktime_t ktime_get(void);
271extern ktime_t ktime_get_real(void); 341extern ktime_t ktime_get_real(void);
272 342
343
344DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
345
346
273/* Exported timer functions: */ 347/* Exported timer functions: */
274 348
275/* Initialize timers: */ 349/* Initialize timers: */
@@ -294,12 +368,25 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
294/* Basic timer operations: */ 368/* Basic timer operations: */
295extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, 369extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
296 const enum hrtimer_mode mode); 370 const enum hrtimer_mode mode);
371extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
372 unsigned long range_ns, const enum hrtimer_mode mode);
297extern int hrtimer_cancel(struct hrtimer *timer); 373extern int hrtimer_cancel(struct hrtimer *timer);
298extern int hrtimer_try_to_cancel(struct hrtimer *timer); 374extern int hrtimer_try_to_cancel(struct hrtimer *timer);
299 375
376static inline int hrtimer_start_expires(struct hrtimer *timer,
377 enum hrtimer_mode mode)
378{
379 unsigned long delta;
380 ktime_t soft, hard;
381 soft = hrtimer_get_softexpires(timer);
382 hard = hrtimer_get_expires(timer);
383 delta = ktime_to_ns(ktime_sub(hard, soft));
384 return hrtimer_start_range_ns(timer, soft, delta, mode);
385}
386
300static inline int hrtimer_restart(struct hrtimer *timer) 387static inline int hrtimer_restart(struct hrtimer *timer)
301{ 388{
302 return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS); 389 return hrtimer_start_expires(timer, HRTIMER_MODE_ABS);
303} 390}
304 391
305/* Query timers: */ 392/* Query timers: */
@@ -356,6 +443,10 @@ extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
356extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, 443extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
357 struct task_struct *tsk); 444 struct task_struct *tsk);
358 445
446extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta,
447 const enum hrtimer_mode mode);
448extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
449
359/* Soft interrupt function to run the hrtimer queues: */ 450/* Soft interrupt function to run the hrtimer queues: */
360extern void hrtimer_run_queues(void); 451extern void hrtimer_run_queues(void);
361extern void hrtimer_run_pending(void); 452extern void hrtimer_run_pending(void);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 32e0ef0f6e1f..e1c8afc002c0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -27,7 +27,7 @@ void unmap_hugepage_range(struct vm_area_struct *,
27void __unmap_hugepage_range(struct vm_area_struct *, 27void __unmap_hugepage_range(struct vm_area_struct *,
28 unsigned long, unsigned long, struct page *); 28 unsigned long, unsigned long, struct page *);
29int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 29int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
30int hugetlb_report_meminfo(char *); 30void hugetlb_report_meminfo(struct seq_file *);
31int hugetlb_report_node_meminfo(int, char *); 31int hugetlb_report_node_meminfo(int, char *);
32unsigned long hugetlb_total_pages(void); 32unsigned long hugetlb_total_pages(void);
33int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 33int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
@@ -79,7 +79,9 @@ static inline unsigned long hugetlb_total_pages(void)
79#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 79#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
80#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 80#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
81#define unmap_hugepage_range(vma, start, end, page) BUG() 81#define unmap_hugepage_range(vma, start, end, page) BUG()
82#define hugetlb_report_meminfo(buf) 0 82static inline void hugetlb_report_meminfo(struct seq_file *m)
83{
84}
83#define hugetlb_report_node_meminfo(n, buf) 0 85#define hugetlb_report_node_meminfo(n, buf) 0
84#define follow_huge_pmd(mm, addr, pmd, write) NULL 86#define follow_huge_pmd(mm, addr, pmd, write) NULL
85#define follow_huge_pud(mm, addr, pud, write) NULL 87#define follow_huge_pud(mm, addr, pud, write) NULL
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h
index 0177d280f733..0f91a957a690 100644
--- a/include/linux/i2c-algo-pcf.h
+++ b/include/linux/i2c-algo-pcf.h
@@ -31,7 +31,10 @@ struct i2c_algo_pcf_data {
31 int (*getpcf) (void *data, int ctl); 31 int (*getpcf) (void *data, int ctl);
32 int (*getown) (void *data); 32 int (*getown) (void *data);
33 int (*getclock) (void *data); 33 int (*getclock) (void *data);
34 void (*waitforpin) (void); 34 void (*waitforpin) (void *data);
35
36 void (*xfer_begin) (void *data);
37 void (*xfer_end) (void *data);
35 38
36 /* Multi-master lost arbitration back-off delay (msecs) 39 /* Multi-master lost arbitration back-off delay (msecs)
37 * This should be set by the bus adapter or knowledgable client 40 * This should be set by the bus adapter or knowledgable client
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index bf34c5f4c051..01d67ba9e985 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -41,7 +41,6 @@
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ 42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
43#define I2C_DRIVERID_PCF8583 25 /* real time clock */ 43#define I2C_DRIVERID_PCF8583 25 /* real time clock */
44#define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */
45#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 44#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
46#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ 45#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
47#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 46#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
@@ -61,7 +60,7 @@
61#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */ 60#define I2C_DRIVERID_WM8775 69 /* wm8775 audio processor */
62#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */ 61#define I2C_DRIVERID_CS53L32A 70 /* cs53l32a audio processor */
63#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */ 62#define I2C_DRIVERID_CX25840 71 /* cx2584x video encoder */
64#define I2C_DRIVERID_SAA7127 72 /* saa7124 video encoder */ 63#define I2C_DRIVERID_SAA7127 72 /* saa7127 video encoder */
65#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */ 64#define I2C_DRIVERID_SAA711X 73 /* saa711x video encoders */
66#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ 65#define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */
67#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ 66#define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 06115128047f..33a5992d4936 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -53,45 +53,44 @@ struct i2c_board_info;
53 * transmit one message at a time, a more complex version can be used to 53 * transmit one message at a time, a more complex version can be used to
54 * transmit an arbitrary number of messages without interruption. 54 * transmit an arbitrary number of messages without interruption.
55 */ 55 */
56extern int i2c_master_send(struct i2c_client *,const char* ,int); 56extern int i2c_master_send(struct i2c_client *client, const char *buf,
57extern int i2c_master_recv(struct i2c_client *,char* ,int); 57 int count);
58extern int i2c_master_recv(struct i2c_client *client, char *buf, int count);
58 59
59/* Transfer num messages. 60/* Transfer num messages.
60 */ 61 */
61extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num); 62extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
62 63 int num);
63 64
64/* This is the very generalized SMBus access routine. You probably do not 65/* This is the very generalized SMBus access routine. You probably do not
65 want to use this, though; one of the functions below may be much easier, 66 want to use this, though; one of the functions below may be much easier,
66 and probably just as fast. 67 and probably just as fast.
67 Note that we use i2c_adapter here, because you do not need a specific 68 Note that we use i2c_adapter here, because you do not need a specific
68 smbus adapter to call this function. */ 69 smbus adapter to call this function. */
69extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, 70extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
70 unsigned short flags, 71 unsigned short flags, char read_write, u8 command,
71 char read_write, u8 command, int size, 72 int size, union i2c_smbus_data *data);
72 union i2c_smbus_data * data);
73 73
74/* Now follow the 'nice' access routines. These also document the calling 74/* Now follow the 'nice' access routines. These also document the calling
75 conventions of i2c_smbus_xfer. */ 75 conventions of i2c_smbus_xfer. */
76 76
77extern s32 i2c_smbus_read_byte(struct i2c_client * client); 77extern s32 i2c_smbus_read_byte(struct i2c_client *client);
78extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); 78extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value);
79extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); 79extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command);
80extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, 80extern s32 i2c_smbus_write_byte_data(struct i2c_client *client,
81 u8 command, u8 value); 81 u8 command, u8 value);
82extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); 82extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command);
83extern s32 i2c_smbus_write_word_data(struct i2c_client * client, 83extern s32 i2c_smbus_write_word_data(struct i2c_client *client,
84 u8 command, u16 value); 84 u8 command, u16 value);
85/* Returns the number of read bytes */ 85/* Returns the number of read bytes */
86extern s32 i2c_smbus_read_block_data(struct i2c_client *client, 86extern s32 i2c_smbus_read_block_data(struct i2c_client *client,
87 u8 command, u8 *values); 87 u8 command, u8 *values);
88extern s32 i2c_smbus_write_block_data(struct i2c_client * client, 88extern s32 i2c_smbus_write_block_data(struct i2c_client *client,
89 u8 command, u8 length, 89 u8 command, u8 length, const u8 *values);
90 const u8 *values);
91/* Returns the number of read bytes */ 90/* Returns the number of read bytes */
92extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 91extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client,
93 u8 command, u8 length, u8 *values); 92 u8 command, u8 length, u8 *values);
94extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, 93extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
95 u8 command, u8 length, 94 u8 command, u8 length,
96 const u8 *values); 95 const u8 *values);
97 96
@@ -169,7 +168,7 @@ struct i2c_driver {
169 /* a ioctl like command that can be used to perform specific functions 168 /* a ioctl like command that can be used to perform specific functions
170 * with the device. 169 * with the device.
171 */ 170 */
172 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 171 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
173 172
174 struct device_driver driver; 173 struct device_driver driver;
175 const struct i2c_device_id *id_table; 174 const struct i2c_device_id *id_table;
@@ -224,14 +223,14 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
224 return to_i2c_client(dev); 223 return to_i2c_client(dev);
225} 224}
226 225
227static inline void *i2c_get_clientdata (struct i2c_client *dev) 226static inline void *i2c_get_clientdata(const struct i2c_client *dev)
228{ 227{
229 return dev_get_drvdata (&dev->dev); 228 return dev_get_drvdata(&dev->dev);
230} 229}
231 230
232static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) 231static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
233{ 232{
234 dev_set_drvdata (&dev->dev, data); 233 dev_set_drvdata(&dev->dev, data);
235} 234}
236 235
237/** 236/**
@@ -240,6 +239,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
240 * @flags: to initialize i2c_client.flags 239 * @flags: to initialize i2c_client.flags
241 * @addr: stored in i2c_client.addr 240 * @addr: stored in i2c_client.addr
242 * @platform_data: stored in i2c_client.dev.platform_data 241 * @platform_data: stored in i2c_client.dev.platform_data
242 * @archdata: copied into i2c_client.dev.archdata
243 * @irq: stored in i2c_client.irq 243 * @irq: stored in i2c_client.irq
244 * 244 *
245 * I2C doesn't actually support hardware probing, although controllers and 245 * I2C doesn't actually support hardware probing, although controllers and
@@ -259,6 +259,7 @@ struct i2c_board_info {
259 unsigned short flags; 259 unsigned short flags;
260 unsigned short addr; 260 unsigned short addr;
261 void *platform_data; 261 void *platform_data;
262 struct dev_archdata *archdata;
262 int irq; 263 int irq;
263}; 264};
264 265
@@ -272,7 +273,7 @@ struct i2c_board_info {
272 * fields (such as associated irq, or device-specific platform_data) 273 * fields (such as associated irq, or device-specific platform_data)
273 * are provided using conventional syntax. 274 * are provided using conventional syntax.
274 */ 275 */
275#define I2C_BOARD_INFO(dev_type,dev_addr) \ 276#define I2C_BOARD_INFO(dev_type, dev_addr) \
276 .type = (dev_type), .addr = (dev_addr) 277 .type = (dev_type), .addr = (dev_addr)
277 278
278 279
@@ -306,10 +307,12 @@ extern void i2c_unregister_device(struct i2c_client *);
306 */ 307 */
307#ifdef CONFIG_I2C_BOARDINFO 308#ifdef CONFIG_I2C_BOARDINFO
308extern int 309extern int
309i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); 310i2c_register_board_info(int busnum, struct i2c_board_info const *info,
311 unsigned n);
310#else 312#else
311static inline int 313static inline int
312i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n) 314i2c_register_board_info(int busnum, struct i2c_board_info const *info,
315 unsigned n)
313{ 316{
314 return 0; 317 return 0;
315} 318}
@@ -328,11 +331,11 @@ struct i2c_algorithm {
328 using common I2C messages */ 331 using common I2C messages */
329 /* master_xfer should return the number of messages successfully 332 /* master_xfer should return the number of messages successfully
330 processed, or a negative value on error */ 333 processed, or a negative value on error */
331 int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, 334 int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs,
332 int num); 335 int num);
333 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, 336 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
334 unsigned short flags, char read_write, 337 unsigned short flags, char read_write,
335 u8 command, int size, union i2c_smbus_data * data); 338 u8 command, int size, union i2c_smbus_data *data);
336 339
337 /* To determine what the adapter supports */ 340 /* To determine what the adapter supports */
338 u32 (*functionality) (struct i2c_adapter *); 341 u32 (*functionality) (struct i2c_adapter *);
@@ -345,7 +348,7 @@ struct i2c_algorithm {
345struct i2c_adapter { 348struct i2c_adapter {
346 struct module *owner; 349 struct module *owner;
347 unsigned int id; 350 unsigned int id;
348 unsigned int class; 351 unsigned int class; /* classes to allow probing for */
349 const struct i2c_algorithm *algo; /* the algorithm to access the bus */ 352 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
350 void *algo_data; 353 void *algo_data;
351 354
@@ -369,14 +372,14 @@ struct i2c_adapter {
369}; 372};
370#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 373#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
371 374
372static inline void *i2c_get_adapdata (struct i2c_adapter *dev) 375static inline void *i2c_get_adapdata(const struct i2c_adapter *dev)
373{ 376{
374 return dev_get_drvdata (&dev->dev); 377 return dev_get_drvdata(&dev->dev);
375} 378}
376 379
377static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) 380static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
378{ 381{
379 dev_set_drvdata (&dev->dev, data); 382 dev_set_drvdata(&dev->dev, data);
380} 383}
381 384
382/*flags for the client struct: */ 385/*flags for the client struct: */
@@ -449,7 +452,7 @@ extern int i2c_probe(struct i2c_adapter *adapter,
449 const struct i2c_client_address_data *address_data, 452 const struct i2c_client_address_data *address_data,
450 int (*found_proc) (struct i2c_adapter *, int, int)); 453 int (*found_proc) (struct i2c_adapter *, int, int));
451 454
452extern struct i2c_adapter* i2c_get_adapter(int id); 455extern struct i2c_adapter *i2c_get_adapter(int id);
453extern void i2c_put_adapter(struct i2c_adapter *adap); 456extern void i2c_put_adapter(struct i2c_adapter *adap);
454 457
455 458
@@ -465,7 +468,7 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
465 return (func & i2c_get_functionality(adap)) == func; 468 return (func & i2c_get_functionality(adap)) == func;
466} 469}
467 470
468/* Return id number for a specific adapter */ 471/* Return the adapter number for a specific adapter */
469static inline int i2c_adapter_id(struct i2c_adapter *adap) 472static inline int i2c_adapter_id(struct i2c_adapter *adap)
470{ 473{
471 return adap->nr; 474 return adap->nr;
@@ -526,7 +529,7 @@ struct i2c_msg {
526 529
527#define I2C_FUNC_I2C 0x00000001 530#define I2C_FUNC_I2C 0x00000001
528#define I2C_FUNC_10BIT_ADDR 0x00000002 531#define I2C_FUNC_10BIT_ADDR 0x00000002
529#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ 532#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */
530#define I2C_FUNC_SMBUS_PEC 0x00000008 533#define I2C_FUNC_SMBUS_PEC 0x00000008
531#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ 534#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
532#define I2C_FUNC_SMBUS_QUICK 0x00010000 535#define I2C_FUNC_SMBUS_QUICK 0x00010000
@@ -541,30 +544,26 @@ struct i2c_msg {
541#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 544#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
542#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ 545#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
543#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ 546#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
544#define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ 547
545#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 /* w/ 2-byte reg. addr. */ 548#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
546 549 I2C_FUNC_SMBUS_WRITE_BYTE)
547#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ 550#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
548 I2C_FUNC_SMBUS_WRITE_BYTE) 551 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
549#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \ 552#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
550 I2C_FUNC_SMBUS_WRITE_BYTE_DATA) 553 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
551#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \ 554#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
552 I2C_FUNC_SMBUS_WRITE_WORD_DATA) 555 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
553#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \ 556#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
554 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) 557 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
555#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \ 558
556 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) 559#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
557#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \ 560 I2C_FUNC_SMBUS_BYTE | \
558 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) 561 I2C_FUNC_SMBUS_BYTE_DATA | \
559 562 I2C_FUNC_SMBUS_WORD_DATA | \
560#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \ 563 I2C_FUNC_SMBUS_PROC_CALL | \
561 I2C_FUNC_SMBUS_BYTE | \ 564 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
562 I2C_FUNC_SMBUS_BYTE_DATA | \ 565 I2C_FUNC_SMBUS_I2C_BLOCK | \
563 I2C_FUNC_SMBUS_WORD_DATA | \ 566 I2C_FUNC_SMBUS_PEC)
564 I2C_FUNC_SMBUS_PROC_CALL | \
565 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
566 I2C_FUNC_SMBUS_I2C_BLOCK | \
567 I2C_FUNC_SMBUS_PEC)
568 567
569/* 568/*
570 * Data for SMBus Messages 569 * Data for SMBus Messages
@@ -574,7 +573,7 @@ union i2c_smbus_data {
574 __u8 byte; 573 __u8 byte;
575 __u16 word; 574 __u16 word;
576 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */ 575 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
577 /* and one more for user-space compatibility */ 576 /* and one more for user-space compatibility */
578}; 577};
579 578
580/* i2c_smbus_xfer read or write markers */ 579/* i2c_smbus_xfer read or write markers */
@@ -602,21 +601,21 @@ union i2c_smbus_data {
602 601
603/* Default fill of many variables */ 602/* Default fill of many variables */
604#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 603#define I2C_CLIENT_DEFAULTS {I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
605 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 604 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
606 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 605 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
607 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 606 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
608 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 607 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
609 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 608 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
610 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 609 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
611 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 610 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
612 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 611 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
613 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 612 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
614 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 613 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
615 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 614 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
616 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 615 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
617 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 616 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
618 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \ 617 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END, \
619 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END} 618 I2C_CLIENT_END, I2C_CLIENT_END, I2C_CLIENT_END}
620 619
621/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the 620/* I2C_CLIENT_MODULE_PARM creates a module parameter, and puts it in the
622 module header */ 621 module header */
@@ -625,7 +624,7 @@ union i2c_smbus_data {
625 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \ 624 static unsigned short var[I2C_CLIENT_MAX_OPTS] = I2C_CLIENT_DEFAULTS; \
626 static unsigned int var##_num; \ 625 static unsigned int var##_num; \
627 module_param_array(var, short, &var##_num, 0); \ 626 module_param_array(var, short, &var##_num, 0); \
628 MODULE_PARM_DESC(var,desc) 627 MODULE_PARM_DESC(var, desc)
629 628
630#define I2C_CLIENT_MODULE_PARM_FORCE(name) \ 629#define I2C_CLIENT_MODULE_PARM_FORCE(name) \
631I2C_CLIENT_MODULE_PARM(force_##name, \ 630I2C_CLIENT_MODULE_PARM(force_##name, \
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
new file mode 100644
index 000000000000..fb604dcd38f1
--- /dev/null
+++ b/include/linux/i2c/twl4030.h
@@ -0,0 +1,343 @@
1/*
2 * twl4030.h - header for TWL4030 PM and audio CODEC device
3 *
4 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 *
6 * Based on tlv320aic23.c:
7 * Copyright (c) by Kai Svahn <kai.svahn@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef __TWL4030_H_
26#define __TWL4030_H_
27
28/*
29 * Using the twl4030 core we address registers using a pair
30 * { module id, relative register offset }
31 * which that core then maps to the relevant
32 * { i2c slave, absolute register address }
33 *
34 * The module IDs are meaningful only to the twl4030 core code,
35 * which uses them as array indices to look up the first register
36 * address each module uses within a given i2c slave.
37 */
38
39/* Slave 0 (i2c address 0x48) */
40#define TWL4030_MODULE_USB 0x00
41
42/* Slave 1 (i2c address 0x49) */
43#define TWL4030_MODULE_AUDIO_VOICE 0x01
44#define TWL4030_MODULE_GPIO 0x02
45#define TWL4030_MODULE_INTBR 0x03
46#define TWL4030_MODULE_PIH 0x04
47#define TWL4030_MODULE_TEST 0x05
48
49/* Slave 2 (i2c address 0x4a) */
50#define TWL4030_MODULE_KEYPAD 0x06
51#define TWL4030_MODULE_MADC 0x07
52#define TWL4030_MODULE_INTERRUPTS 0x08
53#define TWL4030_MODULE_LED 0x09
54#define TWL4030_MODULE_MAIN_CHARGE 0x0A
55#define TWL4030_MODULE_PRECHARGE 0x0B
56#define TWL4030_MODULE_PWM0 0x0C
57#define TWL4030_MODULE_PWM1 0x0D
58#define TWL4030_MODULE_PWMA 0x0E
59#define TWL4030_MODULE_PWMB 0x0F
60
61/* Slave 3 (i2c address 0x4b) */
62#define TWL4030_MODULE_BACKUP 0x10
63#define TWL4030_MODULE_INT 0x11
64#define TWL4030_MODULE_PM_MASTER 0x12
65#define TWL4030_MODULE_PM_RECEIVER 0x13
66#define TWL4030_MODULE_RTC 0x14
67#define TWL4030_MODULE_SECURED_REG 0x15
68
69/*
70 * Read and write single 8-bit registers
71 */
72int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
73int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
74
75/*
76 * Read and write several 8-bit registers at once.
77 *
78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1
79 * for the value, and populate your data starting at offset 1.
80 */
81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes);
82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes);
83
84/*----------------------------------------------------------------------*/
85
86/*
87 * NOTE: at up to 1024 registers, this is a big chip.
88 *
89 * Avoid putting register declarations in this file, instead of into
90 * a driver-private file, unless some of the registers in a block
91 * need to be shared with other drivers. One example is blocks that
92 * have Secondary IRQ Handler (SIH) registers.
93 */
94
95#define TWL4030_SIH_CTRL_EXCLEN_MASK BIT(0)
96#define TWL4030_SIH_CTRL_PENDDIS_MASK BIT(1)
97#define TWL4030_SIH_CTRL_COR_MASK BIT(2)
98
99/*----------------------------------------------------------------------*/
100
101/*
102 * GPIO Block Register offsets (use TWL4030_MODULE_GPIO)
103 */
104
105#define REG_GPIODATAIN1 0x0
106#define REG_GPIODATAIN2 0x1
107#define REG_GPIODATAIN3 0x2
108#define REG_GPIODATADIR1 0x3
109#define REG_GPIODATADIR2 0x4
110#define REG_GPIODATADIR3 0x5
111#define REG_GPIODATAOUT1 0x6
112#define REG_GPIODATAOUT2 0x7
113#define REG_GPIODATAOUT3 0x8
114#define REG_CLEARGPIODATAOUT1 0x9
115#define REG_CLEARGPIODATAOUT2 0xA
116#define REG_CLEARGPIODATAOUT3 0xB
117#define REG_SETGPIODATAOUT1 0xC
118#define REG_SETGPIODATAOUT2 0xD
119#define REG_SETGPIODATAOUT3 0xE
120#define REG_GPIO_DEBEN1 0xF
121#define REG_GPIO_DEBEN2 0x10
122#define REG_GPIO_DEBEN3 0x11
123#define REG_GPIO_CTRL 0x12
124#define REG_GPIOPUPDCTR1 0x13
125#define REG_GPIOPUPDCTR2 0x14
126#define REG_GPIOPUPDCTR3 0x15
127#define REG_GPIOPUPDCTR4 0x16
128#define REG_GPIOPUPDCTR5 0x17
129#define REG_GPIO_ISR1A 0x19
130#define REG_GPIO_ISR2A 0x1A
131#define REG_GPIO_ISR3A 0x1B
132#define REG_GPIO_IMR1A 0x1C
133#define REG_GPIO_IMR2A 0x1D
134#define REG_GPIO_IMR3A 0x1E
135#define REG_GPIO_ISR1B 0x1F
136#define REG_GPIO_ISR2B 0x20
137#define REG_GPIO_ISR3B 0x21
138#define REG_GPIO_IMR1B 0x22
139#define REG_GPIO_IMR2B 0x23
140#define REG_GPIO_IMR3B 0x24
141#define REG_GPIO_EDR1 0x28
142#define REG_GPIO_EDR2 0x29
143#define REG_GPIO_EDR3 0x2A
144#define REG_GPIO_EDR4 0x2B
145#define REG_GPIO_EDR5 0x2C
146#define REG_GPIO_SIH_CTRL 0x2D
147
148/* Up to 18 signals are available as GPIOs, when their
149 * pins are not assigned to another use (such as ULPI/USB).
150 */
151#define TWL4030_GPIO_MAX 18
152
153/*----------------------------------------------------------------------*/
154
155/*
156 * Keypad register offsets (use TWL4030_MODULE_KEYPAD)
157 * ... SIH/interrupt only
158 */
159
160#define TWL4030_KEYPAD_KEYP_ISR1 0x11
161#define TWL4030_KEYPAD_KEYP_IMR1 0x12
162#define TWL4030_KEYPAD_KEYP_ISR2 0x13
163#define TWL4030_KEYPAD_KEYP_IMR2 0x14
164#define TWL4030_KEYPAD_KEYP_SIR 0x15 /* test register */
165#define TWL4030_KEYPAD_KEYP_EDR 0x16
166#define TWL4030_KEYPAD_KEYP_SIH_CTRL 0x17
167
168/*----------------------------------------------------------------------*/
169
170/*
171 * Multichannel ADC register offsets (use TWL4030_MODULE_MADC)
172 * ... SIH/interrupt only
173 */
174
175#define TWL4030_MADC_ISR1 0x61
176#define TWL4030_MADC_IMR1 0x62
177#define TWL4030_MADC_ISR2 0x63
178#define TWL4030_MADC_IMR2 0x64
179#define TWL4030_MADC_SIR 0x65 /* test register */
180#define TWL4030_MADC_EDR 0x66
181#define TWL4030_MADC_SIH_CTRL 0x67
182
183/*----------------------------------------------------------------------*/
184
185/*
186 * Battery charger register offsets (use TWL4030_MODULE_INTERRUPTS)
187 */
188
189#define TWL4030_INTERRUPTS_BCIISR1A 0x0
190#define TWL4030_INTERRUPTS_BCIISR2A 0x1
191#define TWL4030_INTERRUPTS_BCIIMR1A 0x2
192#define TWL4030_INTERRUPTS_BCIIMR2A 0x3
193#define TWL4030_INTERRUPTS_BCIISR1B 0x4
194#define TWL4030_INTERRUPTS_BCIISR2B 0x5
195#define TWL4030_INTERRUPTS_BCIIMR1B 0x6
196#define TWL4030_INTERRUPTS_BCIIMR2B 0x7
197#define TWL4030_INTERRUPTS_BCISIR1 0x8 /* test register */
198#define TWL4030_INTERRUPTS_BCISIR2 0x9 /* test register */
199#define TWL4030_INTERRUPTS_BCIEDR1 0xa
200#define TWL4030_INTERRUPTS_BCIEDR2 0xb
201#define TWL4030_INTERRUPTS_BCIEDR3 0xc
202#define TWL4030_INTERRUPTS_BCISIHCTRL 0xd
203
204/*----------------------------------------------------------------------*/
205
206/*
207 * Power Interrupt block register offsets (use TWL4030_MODULE_INT)
208 */
209
210#define TWL4030_INT_PWR_ISR1 0x0
211#define TWL4030_INT_PWR_IMR1 0x1
212#define TWL4030_INT_PWR_ISR2 0x2
213#define TWL4030_INT_PWR_IMR2 0x3
214#define TWL4030_INT_PWR_SIR 0x4 /* test register */
215#define TWL4030_INT_PWR_EDR1 0x5
216#define TWL4030_INT_PWR_EDR2 0x6
217#define TWL4030_INT_PWR_SIH_CTRL 0x7
218
219/*----------------------------------------------------------------------*/
220
221struct twl4030_bci_platform_data {
222 int *battery_tmp_tbl;
223 unsigned int tblsize;
224};
225
226/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
227struct twl4030_gpio_platform_data {
228 int gpio_base;
229 unsigned irq_base, irq_end;
230
231 /* package the two LED signals as output-only GPIOs? */
232 bool use_leds;
233
234 /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
235 u8 mmc_cd;
236
237 /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
238 * should be enabled. Else, if that bit is set in "pulldowns",
239 * that pulldown is enabled. Don't waste power by letting any
240 * digital inputs float...
241 */
242 u32 pullups;
243 u32 pulldowns;
244
245 int (*setup)(struct device *dev,
246 unsigned gpio, unsigned ngpio);
247 int (*teardown)(struct device *dev,
248 unsigned gpio, unsigned ngpio);
249};
250
251struct twl4030_madc_platform_data {
252 int irq_line;
253};
254
255struct twl4030_keypad_data {
256 int rows;
257 int cols;
258 int *keymap;
259 int irq;
260 unsigned int keymapsize;
261 unsigned int rep:1;
262};
263
264enum twl4030_usb_mode {
265 T2_USB_MODE_ULPI = 1,
266 T2_USB_MODE_CEA2011_3PIN = 2,
267};
268
269struct twl4030_usb_data {
270 enum twl4030_usb_mode usb_mode;
271};
272
273struct twl4030_platform_data {
274 unsigned irq_base, irq_end;
275 struct twl4030_bci_platform_data *bci;
276 struct twl4030_gpio_platform_data *gpio;
277 struct twl4030_madc_platform_data *madc;
278 struct twl4030_keypad_data *keypad;
279 struct twl4030_usb_data *usb;
280
281 /* REVISIT more to come ... _nothing_ should be hard-wired */
282};
283
284/*----------------------------------------------------------------------*/
285
286int twl4030_sih_setup(int module);
287
288/*
289 * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the
290 * IRQ data to subsidiary devices using platform device resources.
291 */
292
293/* IRQ information-need base */
294#include <mach/irqs.h>
295/* TWL4030 interrupts */
296
297/* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */
298#define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1)
299#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)
300#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)
301/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */
302/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */
303
304#define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0)
305/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */
306/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */
307/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */
308/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */
309/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */
310/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */
311/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */
312
313/* Rest are unsued currently*/
314
315/* Offsets to Power Registers */
316#define TWL4030_VDAC_DEV_GRP 0x3B
317#define TWL4030_VDAC_DEDICATED 0x3E
318#define TWL4030_VAUX1_DEV_GRP 0x17
319#define TWL4030_VAUX1_DEDICATED 0x1A
320#define TWL4030_VAUX2_DEV_GRP 0x1B
321#define TWL4030_VAUX2_DEDICATED 0x1E
322#define TWL4030_VAUX3_DEV_GRP 0x1F
323#define TWL4030_VAUX3_DEDICATED 0x22
324
325/* TWL4030 GPIO interrupt definitions */
326
327#define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n))
328
329/*
330 * Exported TWL4030 GPIO APIs
331 *
332 * WARNING -- use standard GPIO and IRQ calls instead; these will vanish.
333 */
334int twl4030_set_gpio_debounce(int gpio, int enable);
335
336#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
337 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
338 extern int twl4030charger_usb_en(int enable);
339#else
340 static inline int twl4030charger_usb_en(int enable) { return 0; }
341#endif
342
343#endif /* End of __TWL4030_H */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 75ae6d8aba4f..4c4e57d1f19d 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -570,7 +570,6 @@ struct i2o_controller {
570#endif 570#endif
571 spinlock_t lock; /* lock for controller 571 spinlock_t lock; /* lock for controller
572 configuration */ 572 configuration */
573
574 void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */ 573 void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */
575}; 574};
576 575
@@ -691,289 +690,22 @@ static inline u32 i2o_dma_high(dma_addr_t dma_addr)
691}; 690};
692#endif 691#endif
693 692
694/** 693extern u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size);
695 * i2o_sg_tablesize - Calculate the maximum number of elements in a SGL 694extern dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
696 * @c: I2O controller for which the calculation should be done
697 * @body_size: maximum body size used for message in 32-bit words.
698 *
699 * Return the maximum number of SG elements in a SG list.
700 */
701static inline u16 i2o_sg_tablesize(struct i2o_controller *c, u16 body_size)
702{
703 i2o_status_block *sb = c->status_block.virt;
704 u16 sg_count =
705 (sb->inbound_frame_size - sizeof(struct i2o_message) / 4) -
706 body_size;
707
708 if (c->pae_support) {
709 /*
710 * for 64-bit a SG attribute element must be added and each
711 * SG element needs 12 bytes instead of 8.
712 */
713 sg_count -= 2;
714 sg_count /= 3;
715 } else
716 sg_count /= 2;
717
718 if (c->short_req && (sg_count > 8))
719 sg_count = 8;
720
721 return sg_count;
722};
723
724/**
725 * i2o_dma_map_single - Map pointer to controller and fill in I2O message.
726 * @c: I2O controller
727 * @ptr: pointer to the data which should be mapped
728 * @size: size of data in bytes
729 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
730 * @sg_ptr: pointer to the SG list inside the I2O message
731 *
732 * This function does all necessary DMA handling and also writes the I2O
733 * SGL elements into the I2O message. For details on DMA handling see also
734 * dma_map_single(). The pointer sg_ptr will only be set to the end of the
735 * SG list if the allocation was successful.
736 *
737 * Returns DMA address which must be checked for failures using
738 * dma_mapping_error().
739 */
740static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
741 size_t size, 695 size_t size,
742 enum dma_data_direction direction, 696 enum dma_data_direction direction,
743 u32 ** sg_ptr) 697 u32 ** sg_ptr);
744{ 698extern int i2o_dma_map_sg(struct i2o_controller *c,
745 u32 sg_flags;
746 u32 *mptr = *sg_ptr;
747 dma_addr_t dma_addr;
748
749 switch (direction) {
750 case DMA_TO_DEVICE:
751 sg_flags = 0xd4000000;
752 break;
753 case DMA_FROM_DEVICE:
754 sg_flags = 0xd0000000;
755 break;
756 default:
757 return 0;
758 }
759
760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
761 if (!dma_mapping_error(&c->pdev->dev, dma_addr)) {
762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
764 *mptr++ = cpu_to_le32(0x7C020002);
765 *mptr++ = cpu_to_le32(PAGE_SIZE);
766 }
767#endif
768
769 *mptr++ = cpu_to_le32(sg_flags | size);
770 *mptr++ = cpu_to_le32(i2o_dma_low(dma_addr));
771#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
772 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
773 *mptr++ = cpu_to_le32(i2o_dma_high(dma_addr));
774#endif
775 *sg_ptr = mptr;
776 }
777 return dma_addr;
778};
779
780/**
781 * i2o_dma_map_sg - Map a SG List to controller and fill in I2O message.
782 * @c: I2O controller
783 * @sg: SG list to be mapped
784 * @sg_count: number of elements in the SG list
785 * @direction: DMA_TO_DEVICE / DMA_FROM_DEVICE
786 * @sg_ptr: pointer to the SG list inside the I2O message
787 *
788 * This function does all necessary DMA handling and also writes the I2O
789 * SGL elements into the I2O message. For details on DMA handling see also
790 * dma_map_sg(). The pointer sg_ptr will only be set to the end of the SG
791 * list if the allocation was successful.
792 *
793 * Returns 0 on failure or 1 on success.
794 */
795static inline int i2o_dma_map_sg(struct i2o_controller *c,
796 struct scatterlist *sg, int sg_count, 699 struct scatterlist *sg, int sg_count,
797 enum dma_data_direction direction, 700 enum dma_data_direction direction,
798 u32 ** sg_ptr) 701 u32 ** sg_ptr);
799{ 702extern int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, size_t len);
800 u32 sg_flags; 703extern void i2o_dma_free(struct device *dev, struct i2o_dma *addr);
801 u32 *mptr = *sg_ptr; 704extern int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
802 705 size_t len);
803 switch (direction) { 706extern int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
804 case DMA_TO_DEVICE: 707 size_t size, int min_nr);
805 sg_flags = 0x14000000; 708extern void i2o_pool_free(struct i2o_pool *pool);
806 break;
807 case DMA_FROM_DEVICE:
808 sg_flags = 0x10000000;
809 break;
810 default:
811 return 0;
812 }
813
814 sg_count = dma_map_sg(&c->pdev->dev, sg, sg_count, direction);
815 if (!sg_count)
816 return 0;
817
818#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
819 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
820 *mptr++ = cpu_to_le32(0x7C020002);
821 *mptr++ = cpu_to_le32(PAGE_SIZE);
822 }
823#endif
824
825 while (sg_count-- > 0) {
826 if (!sg_count)
827 sg_flags |= 0xC0000000;
828 *mptr++ = cpu_to_le32(sg_flags | sg_dma_len(sg));
829 *mptr++ = cpu_to_le32(i2o_dma_low(sg_dma_address(sg)));
830#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
831 if ((sizeof(dma_addr_t) > 4) && c->pae_support)
832 *mptr++ = cpu_to_le32(i2o_dma_high(sg_dma_address(sg)));
833#endif
834 sg = sg_next(sg);
835 }
836 *sg_ptr = mptr;
837
838 return 1;
839};
840
841/**
842 * i2o_dma_alloc - Allocate DMA memory
843 * @dev: struct device pointer to the PCI device of the I2O controller
844 * @addr: i2o_dma struct which should get the DMA buffer
845 * @len: length of the new DMA memory
846 * @gfp_mask: GFP mask
847 *
848 * Allocate a coherent DMA memory and write the pointers into addr.
849 *
850 * Returns 0 on success or -ENOMEM on failure.
851 */
852static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
853 size_t len, gfp_t gfp_mask)
854{
855 struct pci_dev *pdev = to_pci_dev(dev);
856 int dma_64 = 0;
857
858 if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
859 dma_64 = 1;
860 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
861 return -ENOMEM;
862 }
863
864 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
865
866 if ((sizeof(dma_addr_t) > 4) && dma_64)
867 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
868 printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
869
870 if (!addr->virt)
871 return -ENOMEM;
872
873 memset(addr->virt, 0, len);
874 addr->len = len;
875
876 return 0;
877};
878
879/**
880 * i2o_dma_free - Free DMA memory
881 * @dev: struct device pointer to the PCI device of the I2O controller
882 * @addr: i2o_dma struct which contains the DMA buffer
883 *
884 * Free a coherent DMA memory and set virtual address of addr to NULL.
885 */
886static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
887{
888 if (addr->virt) {
889 if (addr->phys)
890 dma_free_coherent(dev, addr->len, addr->virt,
891 addr->phys);
892 else
893 kfree(addr->virt);
894 addr->virt = NULL;
895 }
896};
897
898/**
899 * i2o_dma_realloc - Realloc DMA memory
900 * @dev: struct device pointer to the PCI device of the I2O controller
901 * @addr: pointer to a i2o_dma struct DMA buffer
902 * @len: new length of memory
903 * @gfp_mask: GFP mask
904 *
905 * If there was something allocated in the addr, free it first. If len > 0
906 * than try to allocate it and write the addresses back to the addr
907 * structure. If len == 0 set the virtual address to NULL.
908 *
909 * Returns the 0 on success or negative error code on failure.
910 */
911static inline int i2o_dma_realloc(struct device *dev, struct i2o_dma *addr,
912 size_t len, gfp_t gfp_mask)
913{
914 i2o_dma_free(dev, addr);
915
916 if (len)
917 return i2o_dma_alloc(dev, addr, len, gfp_mask);
918
919 return 0;
920};
921
922/*
923 * i2o_pool_alloc - Allocate an slab cache and mempool
924 * @mempool: pointer to struct i2o_pool to write data into.
925 * @name: name which is used to identify cache
926 * @size: size of each object
927 * @min_nr: minimum number of objects
928 *
929 * First allocates a slab cache with name and size. Then allocates a
930 * mempool which uses the slab cache for allocation and freeing.
931 *
932 * Returns 0 on success or negative error code on failure.
933 */
934static inline int i2o_pool_alloc(struct i2o_pool *pool, const char *name,
935 size_t size, int min_nr)
936{
937 pool->name = kmalloc(strlen(name) + 1, GFP_KERNEL);
938 if (!pool->name)
939 goto exit;
940 strcpy(pool->name, name);
941
942 pool->slab =
943 kmem_cache_create(pool->name, size, 0, SLAB_HWCACHE_ALIGN, NULL);
944 if (!pool->slab)
945 goto free_name;
946
947 pool->mempool = mempool_create_slab_pool(min_nr, pool->slab);
948 if (!pool->mempool)
949 goto free_slab;
950
951 return 0;
952
953 free_slab:
954 kmem_cache_destroy(pool->slab);
955
956 free_name:
957 kfree(pool->name);
958
959 exit:
960 return -ENOMEM;
961};
962
963/*
964 * i2o_pool_free - Free slab cache and mempool again
965 * @mempool: pointer to struct i2o_pool which should be freed
966 *
967 * Note that you have to return all objects to the mempool again before
968 * calling i2o_pool_free().
969 */
970static inline void i2o_pool_free(struct i2o_pool *pool)
971{
972 mempool_destroy(pool->mempool);
973 kmem_cache_destroy(pool->slab);
974 kfree(pool->name);
975};
976
977/* I2O driver (OSM) functions */ 709/* I2O driver (OSM) functions */
978extern int i2o_driver_register(struct i2o_driver *); 710extern int i2o_driver_register(struct i2o_driver *);
979extern void i2o_driver_unregister(struct i2o_driver *); 711extern void i2o_driver_unregister(struct i2o_driver *);
diff --git a/include/linux/i7300_idle.h b/include/linux/i7300_idle.h
new file mode 100644
index 000000000000..05a80c44513c
--- /dev/null
+++ b/include/linux/i7300_idle.h
@@ -0,0 +1,83 @@
1
2#ifndef I7300_IDLE_H
3#define I7300_IDLE_H
4
5#include <linux/pci.h>
6
7/*
8 * I/O AT controls (PCI bus 0 device 8 function 0)
9 * DIMM controls (PCI bus 0 device 16 function 1)
10 */
11#define IOAT_BUS 0
12#define IOAT_DEVFN PCI_DEVFN(8, 0)
13#define MEMCTL_BUS 0
14#define MEMCTL_DEVFN PCI_DEVFN(16, 1)
15
16struct fbd_ioat {
17 unsigned int vendor;
18 unsigned int ioat_dev;
19};
20
21/*
22 * The i5000 chip-set has the same hooks as the i7300
23 * but support is disabled by default because this driver
24 * has not been validated on that platform.
25 */
26#define SUPPORT_I5000 0
27
28static const struct fbd_ioat fbd_ioat_list[] = {
29 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB},
30#if SUPPORT_I5000
31 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT},
32#endif
33 {0, 0}
34};
35
36/* table of devices that work with this driver */
37static const struct pci_device_id pci_tbl[] = {
38 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
39#if SUPPORT_I5000
40 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
41#endif
42 { } /* Terminating entry */
43};
44
45/* Check for known platforms with I/O-AT */
46static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
47 struct pci_dev **ioat_dev)
48{
49 int i;
50 struct pci_dev *memdev, *dmadev;
51
52 memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
53 if (!memdev)
54 return -ENODEV;
55
56 for (i = 0; pci_tbl[i].vendor != 0; i++) {
57 if (memdev->vendor == pci_tbl[i].vendor &&
58 memdev->device == pci_tbl[i].device) {
59 break;
60 }
61 }
62 if (pci_tbl[i].vendor == 0)
63 return -ENODEV;
64
65 dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
66 if (!dmadev)
67 return -ENODEV;
68
69 for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
70 if (dmadev->vendor == fbd_ioat_list[i].vendor &&
71 dmadev->device == fbd_ioat_list[i].ioat_dev) {
72 if (fbd_dev)
73 *fbd_dev = memdev;
74 if (ioat_dev)
75 *ioat_dev = dmadev;
76
77 return 0;
78 }
79 }
80 return -ENODEV;
81}
82
83#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 03067443198a..a93a8dd33118 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -40,16 +40,18 @@ struct icmp6hdr {
40 struct icmpv6_nd_ra { 40 struct icmpv6_nd_ra {
41 __u8 hop_limit; 41 __u8 hop_limit;
42#if defined(__LITTLE_ENDIAN_BITFIELD) 42#if defined(__LITTLE_ENDIAN_BITFIELD)
43 __u8 reserved:4, 43 __u8 reserved:3,
44 router_pref:2, 44 router_pref:2,
45 home_agent:1,
45 other:1, 46 other:1,
46 managed:1; 47 managed:1;
47 48
48#elif defined(__BIG_ENDIAN_BITFIELD) 49#elif defined(__BIG_ENDIAN_BITFIELD)
49 __u8 managed:1, 50 __u8 managed:1,
50 other:1, 51 other:1,
52 home_agent:1,
51 router_pref:2, 53 router_pref:2,
52 reserved:4; 54 reserved:3;
53#else 55#else
54#error "Please fix <asm/byteorder.h>" 56#error "Please fix <asm/byteorder.h>"
55#endif 57#endif
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 6514db8fd2e4..54525be4b5f8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -8,7 +8,7 @@
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/hdreg.h> 11#include <linux/ata.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
@@ -17,6 +17,7 @@
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/pm.h>
20#ifdef CONFIG_BLK_DEV_IDEACPI 21#ifdef CONFIG_BLK_DEV_IDEACPI
21#include <acpi/acpi.h> 22#include <acpi/acpi.h>
22#endif 23#endif
@@ -47,12 +48,6 @@ typedef unsigned char byte; /* used everywhere */
47#define ERROR_RESET 3 /* Reset controller every 4th retry */ 48#define ERROR_RESET 3 /* Reset controller every 4th retry */
48#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 49#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
49 50
50/*
51 * state flags
52 */
53
54#define DMA_PIO_RETRY 1 /* retrying in PIO */
55
56#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif)) 51#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif))
57#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup)) 52#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
58 53
@@ -87,12 +82,13 @@ struct ide_io_ports {
87}; 82};
88 83
89#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 84#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
90#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
91#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
92#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
93#define DRIVE_READY (READY_STAT | SEEK_STAT)
94 85
95#define BAD_CRC (ABRT_ERR | ICRC_ERR) 86#define BAD_R_STAT (ATA_BUSY | ATA_ERR)
87#define BAD_W_STAT (BAD_R_STAT | ATA_DF)
88#define BAD_STAT (BAD_R_STAT | ATA_DRQ)
89#define DRIVE_READY (ATA_DRDY | ATA_DSC)
90
91#define BAD_CRC (ATA_ABORTED | ATA_ICRC)
96 92
97#define SATA_NR_PORTS (3) /* 16 possible ?? */ 93#define SATA_NR_PORTS (3) /* 16 possible ?? */
98 94
@@ -125,24 +121,43 @@ struct ide_io_ports {
125#define PARTN_BITS 6 /* number of minor dev bits for partitions */ 121#define PARTN_BITS 6 /* number of minor dev bits for partitions */
126#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ 122#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
127#define SECTOR_SIZE 512 123#define SECTOR_SIZE 512
128#define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ 124
129#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) 125#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
130 126
131/* 127/*
132 * Timeouts for various operations: 128 * Timeouts for various operations:
133 */ 129 */
134#define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ 130enum {
135#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ 131 /* spec allows up to 20ms */
136#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ 132 WAIT_DRQ = HZ / 10, /* 100ms */
137#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ 133 /* some laptops are very slow */
138#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ 134 WAIT_READY = 5 * HZ, /* 5s */
139#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ 135 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */
136 WAIT_PIDENTIFY = 10 * HZ, /* 10s */
137 /* worst case when spinning up */
138 WAIT_WORSTCASE = 30 * HZ, /* 30s */
139 /* maximum wait for an IRQ to happen */
140 WAIT_CMD = 10 * HZ, /* 10s */
141 /* Some drives require a longer IRQ timeout. */
142 WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */
143 /*
144 * Some drives (for example, Seagate STT3401A Travan) require a very
145 * long timeout, because they don't return an interrupt or clear their
146 * BSY bit until after the command completes (even retension commands).
147 */
148 WAIT_TAPE_CMD = 900 * HZ, /* 900s */
149 /* minimum sleep time */
150 WAIT_MIN_SLEEP = HZ / 50, /* 20ms */
151};
140 152
141/* 153/*
142 * Op codes for special requests to be handled by ide_special_rq(). 154 * Op codes for special requests to be handled by ide_special_rq().
143 * Values should be in the range of 0x20 to 0x3f. 155 * Values should be in the range of 0x20 to 0x3f.
144 */ 156 */
145#define REQ_DRIVE_RESET 0x20 157#define REQ_DRIVE_RESET 0x20
158#define REQ_DEVSET_EXEC 0x21
159#define REQ_PARK_HEADS 0x22
160#define REQ_UNPARK_HEADS 0x23
146 161
147/* 162/*
148 * Check for an interrupt and acknowledge the interrupt status 163 * Check for an interrupt and acknowledge the interrupt status
@@ -249,8 +264,6 @@ static inline int __ide_default_irq(unsigned long base)
249 * set_geometry : respecify drive geometry 264 * set_geometry : respecify drive geometry
250 * recalibrate : seek to cyl 0 265 * recalibrate : seek to cyl 0
251 * set_multmode : set multmode count 266 * set_multmode : set multmode count
252 * set_tune : tune interface for drive
253 * serviced : service command
254 * reserved : unused 267 * reserved : unused
255 */ 268 */
256typedef union { 269typedef union {
@@ -259,43 +272,11 @@ typedef union {
259 unsigned set_geometry : 1; 272 unsigned set_geometry : 1;
260 unsigned recalibrate : 1; 273 unsigned recalibrate : 1;
261 unsigned set_multmode : 1; 274 unsigned set_multmode : 1;
262 unsigned set_tune : 1; 275 unsigned reserved : 5;
263 unsigned serviced : 1;
264 unsigned reserved : 3;
265 } b; 276 } b;
266} special_t; 277} special_t;
267 278
268/* 279/*
269 * ATA-IDE Select Register, aka Device-Head
270 *
271 * head : always zeros here
272 * unit : drive select number: 0/1
273 * bit5 : always 1
274 * lba : using LBA instead of CHS
275 * bit7 : always 1
276 */
277typedef union {
278 unsigned all : 8;
279 struct {
280#if defined(__LITTLE_ENDIAN_BITFIELD)
281 unsigned head : 4;
282 unsigned unit : 1;
283 unsigned bit5 : 1;
284 unsigned lba : 1;
285 unsigned bit7 : 1;
286#elif defined(__BIG_ENDIAN_BITFIELD)
287 unsigned bit7 : 1;
288 unsigned lba : 1;
289 unsigned bit5 : 1;
290 unsigned unit : 1;
291 unsigned head : 4;
292#else
293#error "Please fix <asm/byteorder.h>"
294#endif
295 } b;
296} select_t, ata_select_t;
297
298/*
299 * Status returned from various ide_ functions 280 * Status returned from various ide_ functions
300 */ 281 */
301typedef enum { 282typedef enum {
@@ -303,22 +284,205 @@ typedef enum {
303 ide_started, /* a drive operation was started, handler was set */ 284 ide_started, /* a drive operation was started, handler was set */
304} ide_startstop_t; 285} ide_startstop_t;
305 286
287enum {
288 IDE_TFLAG_LBA48 = (1 << 0),
289 IDE_TFLAG_FLAGGED = (1 << 2),
290 IDE_TFLAG_OUT_DATA = (1 << 3),
291 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
292 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
293 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
294 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
295 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
296 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
297 IDE_TFLAG_OUT_HOB_NSECT |
298 IDE_TFLAG_OUT_HOB_LBAL |
299 IDE_TFLAG_OUT_HOB_LBAM |
300 IDE_TFLAG_OUT_HOB_LBAH,
301 IDE_TFLAG_OUT_FEATURE = (1 << 9),
302 IDE_TFLAG_OUT_NSECT = (1 << 10),
303 IDE_TFLAG_OUT_LBAL = (1 << 11),
304 IDE_TFLAG_OUT_LBAM = (1 << 12),
305 IDE_TFLAG_OUT_LBAH = (1 << 13),
306 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
307 IDE_TFLAG_OUT_NSECT |
308 IDE_TFLAG_OUT_LBAL |
309 IDE_TFLAG_OUT_LBAM |
310 IDE_TFLAG_OUT_LBAH,
311 IDE_TFLAG_OUT_DEVICE = (1 << 14),
312 IDE_TFLAG_WRITE = (1 << 15),
313 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
314 IDE_TFLAG_IN_DATA = (1 << 17),
315 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
316 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
317 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
318 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
319 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
320 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
321 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
322 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
323 IDE_TFLAG_IN_HOB_LBAM |
324 IDE_TFLAG_IN_HOB_LBAH,
325 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
326 IDE_TFLAG_IN_HOB_NSECT |
327 IDE_TFLAG_IN_HOB_LBA,
328 IDE_TFLAG_IN_FEATURE = (1 << 1),
329 IDE_TFLAG_IN_NSECT = (1 << 25),
330 IDE_TFLAG_IN_LBAL = (1 << 26),
331 IDE_TFLAG_IN_LBAM = (1 << 27),
332 IDE_TFLAG_IN_LBAH = (1 << 28),
333 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
334 IDE_TFLAG_IN_LBAM |
335 IDE_TFLAG_IN_LBAH,
336 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
337 IDE_TFLAG_IN_LBA,
338 IDE_TFLAG_IN_DEVICE = (1 << 29),
339 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
340 IDE_TFLAG_IN_HOB,
341 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
342 IDE_TFLAG_IN_TF,
343 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
344 IDE_TFLAG_IN_DEVICE,
345 /* force 16-bit I/O operations */
346 IDE_TFLAG_IO_16BIT = (1 << 30),
347 /* ide_task_t was allocated using kmalloc() */
348 IDE_TFLAG_DYN = (1 << 31),
349};
350
351struct ide_taskfile {
352 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
353
354 u8 hob_feature; /* 1-5: additional data to support LBA48 */
355 u8 hob_nsect;
356 u8 hob_lbal;
357 u8 hob_lbam;
358 u8 hob_lbah;
359
360 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
361
362 union { /*  7: */
363 u8 error; /* read: error */
364 u8 feature; /* write: feature */
365 };
366
367 u8 nsect; /* 8: number of sectors */
368 u8 lbal; /* 9: LBA low */
369 u8 lbam; /* 10: LBA mid */
370 u8 lbah; /* 11: LBA high */
371
372 u8 device; /* 12: device select */
373
374 union { /* 13: */
375 u8 status; /*  read: status  */
376 u8 command; /* write: command */
377 };
378};
379
380typedef struct ide_task_s {
381 union {
382 struct ide_taskfile tf;
383 u8 tf_array[14];
384 };
385 u32 tf_flags;
386 int data_phase;
387 struct request *rq; /* copy of request */
388 void *special; /* valid_t generally */
389} ide_task_t;
390
391/* ATAPI packet command flags */
392enum {
393 /* set when an error is considered normal - no retry (ide-tape) */
394 PC_FLAG_ABORT = (1 << 0),
395 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
396 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
397 PC_FLAG_DMA_OK = (1 << 3),
398 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
399 PC_FLAG_DMA_ERROR = (1 << 5),
400 PC_FLAG_WRITING = (1 << 6),
401 /* command timed out */
402 PC_FLAG_TIMEDOUT = (1 << 7),
403};
404
405/*
406 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
407 * This is used for several packet commands (not for READ/WRITE commands).
408 */
409#define IDE_PC_BUFFER_SIZE 256
410
411struct ide_atapi_pc {
412 /* actual packet bytes */
413 u8 c[12];
414 /* incremented on each retry */
415 int retries;
416 int error;
417
418 /* bytes to transfer */
419 int req_xfer;
420 /* bytes actually transferred */
421 int xferred;
422
423 /* data buffer */
424 u8 *buf;
425 /* current buffer position */
426 u8 *cur_pos;
427 int buf_size;
428 /* missing/available data on the current buffer */
429 int b_count;
430
431 /* the corresponding request */
432 struct request *rq;
433
434 unsigned long flags;
435
436 /*
437 * those are more or less driver-specific and some of them are subject
438 * to change/removal later.
439 */
440 u8 pc_buf[IDE_PC_BUFFER_SIZE];
441
442 /* idetape only */
443 struct idetape_bh *bh;
444 char *b_data;
445
446 /* idescsi only for now */
447 struct scatterlist *sg;
448 unsigned int sg_cnt;
449
450 struct scsi_cmnd *scsi_cmd;
451 void (*done) (struct scsi_cmnd *);
452
453 unsigned long timeout;
454};
455
456struct ide_devset;
306struct ide_driver_s; 457struct ide_driver_s;
307struct ide_settings_s;
308 458
309#ifdef CONFIG_BLK_DEV_IDEACPI 459#ifdef CONFIG_BLK_DEV_IDEACPI
310struct ide_acpi_drive_link; 460struct ide_acpi_drive_link;
311struct ide_acpi_hwif_link; 461struct ide_acpi_hwif_link;
312#endif 462#endif
313 463
464struct ide_drive_s;
465
466struct ide_disk_ops {
467 int (*check)(struct ide_drive_s *, const char *);
468 int (*get_capacity)(struct ide_drive_s *);
469 void (*setup)(struct ide_drive_s *);
470 void (*flush)(struct ide_drive_s *);
471 int (*init_media)(struct ide_drive_s *, struct gendisk *);
472 int (*set_doorlock)(struct ide_drive_s *, struct gendisk *,
473 int);
474 ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *,
475 sector_t);
476 int (*end_request)(struct ide_drive_s *, int, int);
477 int (*ioctl)(struct ide_drive_s *, struct block_device *,
478 fmode_t, unsigned int, unsigned long);
479};
480
314/* ATAPI device flags */ 481/* ATAPI device flags */
315enum { 482enum {
316 IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), 483 IDE_AFLAG_DRQ_INTERRUPT = (1 << 0),
317 IDE_AFLAG_MEDIA_CHANGED = (1 << 1),
318 484
319 /* ide-cd */ 485 /* ide-cd */
320 /* Drive cannot lock the door. */
321 IDE_AFLAG_NO_DOORLOCK = (1 << 2),
322 /* Drive cannot eject the disc. */ 486 /* Drive cannot eject the disc. */
323 IDE_AFLAG_NO_EJECT = (1 << 3), 487 IDE_AFLAG_NO_EJECT = (1 << 3),
324 /* Drive is a pre ATAPI 1.2 drive. */ 488 /* Drive is a pre ATAPI 1.2 drive. */
@@ -348,27 +512,87 @@ enum {
348 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), 512 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17),
349 513
350 /* ide-floppy */ 514 /* ide-floppy */
351 /* Format in progress */
352 IDE_AFLAG_FORMAT_IN_PROGRESS = (1 << 18),
353 /* Avoid commands not supported in Clik drive */ 515 /* Avoid commands not supported in Clik drive */
354 IDE_AFLAG_CLIK_DRIVE = (1 << 19), 516 IDE_AFLAG_CLIK_DRIVE = (1 << 19),
355 /* Requires BH algorithm for packets */ 517 /* Requires BH algorithm for packets */
356 IDE_AFLAG_ZIP_DRIVE = (1 << 20), 518 IDE_AFLAG_ZIP_DRIVE = (1 << 20),
519 /* Supports format progress report */
520 IDE_AFLAG_SRFP = (1 << 22),
357 521
358 /* ide-tape */ 522 /* ide-tape */
359 IDE_AFLAG_IGNORE_DSC = (1 << 21), 523 IDE_AFLAG_IGNORE_DSC = (1 << 23),
360 /* 0 When the tape position is unknown */ 524 /* 0 When the tape position is unknown */
361 IDE_AFLAG_ADDRESS_VALID = (1 << 22), 525 IDE_AFLAG_ADDRESS_VALID = (1 << 24),
362 /* Device already opened */ 526 /* Device already opened */
363 IDE_AFLAG_BUSY = (1 << 23), 527 IDE_AFLAG_BUSY = (1 << 25),
364 /* Attempt to auto-detect the current user block size */ 528 /* Attempt to auto-detect the current user block size */
365 IDE_AFLAG_DETECT_BS = (1 << 24), 529 IDE_AFLAG_DETECT_BS = (1 << 26),
366 /* Currently on a filemark */ 530 /* Currently on a filemark */
367 IDE_AFLAG_FILEMARK = (1 << 25), 531 IDE_AFLAG_FILEMARK = (1 << 27),
368 /* 0 = no tape is loaded, so we don't rewind after ejecting */ 532 /* 0 = no tape is loaded, so we don't rewind after ejecting */
369 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26), 533 IDE_AFLAG_MEDIUM_PRESENT = (1 << 28),
370 534
371 IDE_AFLAG_NO_AUTOCLOSE = (1 << 27), 535 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29),
536};
537
538/* device flags */
539enum {
540 /* restore settings after device reset */
541 IDE_DFLAG_KEEP_SETTINGS = (1 << 0),
542 /* device is using DMA for read/write */
543 IDE_DFLAG_USING_DMA = (1 << 1),
544 /* okay to unmask other IRQs */
545 IDE_DFLAG_UNMASK = (1 << 2),
546 /* don't attempt flushes */
547 IDE_DFLAG_NOFLUSH = (1 << 3),
548 /* DSC overlap */
549 IDE_DFLAG_DSC_OVERLAP = (1 << 4),
550 /* give potential excess bandwidth */
551 IDE_DFLAG_NICE1 = (1 << 5),
552 /* device is physically present */
553 IDE_DFLAG_PRESENT = (1 << 6),
554 /* device ejected hint */
555 IDE_DFLAG_DEAD = (1 << 7),
556 /* id read from device (synthetic if not set) */
557 IDE_DFLAG_ID_READ = (1 << 8),
558 IDE_DFLAG_NOPROBE = (1 << 9),
559 /* need to do check_media_change() */
560 IDE_DFLAG_REMOVABLE = (1 << 10),
561 /* needed for removable devices */
562 IDE_DFLAG_ATTACH = (1 << 11),
563 IDE_DFLAG_FORCED_GEOM = (1 << 12),
564 /* disallow setting unmask bit */
565 IDE_DFLAG_NO_UNMASK = (1 << 13),
566 /* disallow enabling 32-bit I/O */
567 IDE_DFLAG_NO_IO_32BIT = (1 << 14),
568 /* for removable only: door lock/unlock works */
569 IDE_DFLAG_DOORLOCKING = (1 << 15),
570 /* disallow DMA */
571 IDE_DFLAG_NODMA = (1 << 16),
572 /* powermanagment told us not to do anything, so sleep nicely */
573 IDE_DFLAG_BLOCKED = (1 << 17),
574 /* ide-scsi emulation */
575 IDE_DFLAG_SCSI = (1 << 18),
576 /* sleeping & sleep field valid */
577 IDE_DFLAG_SLEEPING = (1 << 19),
578 IDE_DFLAG_POST_RESET = (1 << 20),
579 IDE_DFLAG_UDMA33_WARNED = (1 << 21),
580 IDE_DFLAG_LBA48 = (1 << 22),
581 /* status of write cache */
582 IDE_DFLAG_WCACHE = (1 << 23),
583 /* used for ignoring ATA_DF */
584 IDE_DFLAG_NOWERR = (1 << 24),
585 /* retrying in PIO */
586 IDE_DFLAG_DMA_PIO_RETRY = (1 << 25),
587 IDE_DFLAG_LBA = (1 << 26),
588 /* don't unload heads */
589 IDE_DFLAG_NO_UNLOAD = (1 << 27),
590 /* heads unloaded, please don't reset port */
591 IDE_DFLAG_PARKED = (1 << 28),
592 IDE_DFLAG_MEDIA_CHANGED = (1 << 29),
593 /* write protect */
594 IDE_DFLAG_WP = (1 << 30),
595 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 31),
372}; 596};
373 597
374struct ide_drive_s { 598struct ide_drive_s {
@@ -380,72 +604,49 @@ struct ide_drive_s {
380 struct request *rq; /* current request */ 604 struct request *rq; /* current request */
381 struct ide_drive_s *next; /* circular list of hwgroup drives */ 605 struct ide_drive_s *next; /* circular list of hwgroup drives */
382 void *driver_data; /* extra driver data */ 606 void *driver_data; /* extra driver data */
383 struct hd_driveid *id; /* drive model identification info */ 607 u16 *id; /* identification info */
384#ifdef CONFIG_IDE_PROC_FS 608#ifdef CONFIG_IDE_PROC_FS
385 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 609 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
386 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 610 const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */
387#endif 611#endif
388 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 612 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
389 613
614 const struct ide_disk_ops *disk_ops;
615
616 unsigned long dev_flags;
617
390 unsigned long sleep; /* sleep until this time */ 618 unsigned long sleep; /* sleep until this time */
391 unsigned long service_start; /* time we started last request */ 619 unsigned long service_start; /* time we started last request */
392 unsigned long service_time; /* service time of last request */ 620 unsigned long service_time; /* service time of last request */
393 unsigned long timeout; /* max time to wait for irq */ 621 unsigned long timeout; /* max time to wait for irq */
394 622
395 special_t special; /* special action flags */ 623 special_t special; /* special action flags */
396 select_t select; /* basic drive/head select reg value */
397 624
398 u8 keep_settings; /* restore settings after drive reset */ 625 u8 select; /* basic drive/head select reg value */
399 u8 using_dma; /* disk is using dma for read/write */
400 u8 retry_pio; /* retrying dma capable host in pio */ 626 u8 retry_pio; /* retrying dma capable host in pio */
401 u8 state; /* retry state */
402 u8 waiting_for_dma; /* dma currently in progress */ 627 u8 waiting_for_dma; /* dma currently in progress */
403 u8 unmask; /* okay to unmask other irqs */ 628 u8 dma; /* atapi dma flag */
404 u8 noflush; /* don't attempt flushes */ 629
405 u8 dsc_overlap; /* DSC overlap */
406 u8 nice1; /* give potential excess bandwidth */
407
408 unsigned present : 1; /* drive is physically present */
409 unsigned dead : 1; /* device ejected hint */
410 unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */
411 unsigned noprobe : 1; /* from: hdx=noprobe */
412 unsigned removable : 1; /* 1 if need to do check_media_change */
413 unsigned attach : 1; /* needed for removable devices */
414 unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
415 unsigned no_unmask : 1; /* disallow setting unmask bit */
416 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
417 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
418 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
419 unsigned nodma : 1; /* disallow DMA */
420 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
421 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
422 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
423 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
424 unsigned post_reset : 1;
425 unsigned udma33_warned : 1;
426
427 u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
428 u8 quirk_list; /* considered quirky, set for a specific host */ 630 u8 quirk_list; /* considered quirky, set for a specific host */
429 u8 init_speed; /* transfer rate set at boot */ 631 u8 init_speed; /* transfer rate set at boot */
430 u8 current_speed; /* current transfer rate set */ 632 u8 current_speed; /* current transfer rate set */
431 u8 desired_speed; /* desired transfer rate set */ 633 u8 desired_speed; /* desired transfer rate set */
432 u8 dn; /* now wide spread use */ 634 u8 dn; /* now wide spread use */
433 u8 wcache; /* status of write cache */
434 u8 acoustic; /* acoustic management */ 635 u8 acoustic; /* acoustic management */
435 u8 media; /* disk, cdrom, tape, floppy, ... */ 636 u8 media; /* disk, cdrom, tape, floppy, ... */
436 u8 ready_stat; /* min status value for drive ready */ 637 u8 ready_stat; /* min status value for drive ready */
437 u8 mult_count; /* current multiple sector setting */ 638 u8 mult_count; /* current multiple sector setting */
438 u8 mult_req; /* requested multiple sector setting */ 639 u8 mult_req; /* requested multiple sector setting */
439 u8 tune_req; /* requested drive tuning setting */
440 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ 640 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
441 u8 bad_wstat; /* used for ignoring WRERR_STAT */ 641 u8 bad_wstat; /* used for ignoring ATA_DF */
442 u8 nowerr; /* used for ignoring WRERR_STAT */
443 u8 sect0; /* offset of first sector for DM6:DDO */
444 u8 head; /* "real" number of heads */ 642 u8 head; /* "real" number of heads */
445 u8 sect; /* "real" sectors per track */ 643 u8 sect; /* "real" sectors per track */
446 u8 bios_head; /* BIOS/fdisk/LILO number of heads */ 644 u8 bios_head; /* BIOS/fdisk/LILO number of heads */
447 u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */ 645 u8 bios_sect; /* BIOS/fdisk/LILO sectors per track */
448 646
647 /* delay this long before sending packet command */
648 u8 pc_delay;
649
449 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 650 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
450 unsigned int cyl; /* "real" number of cyls */ 651 unsigned int cyl; /* "real" number of cyls */
451 unsigned int drive_data; /* used by set_pio_mode/selectproc */ 652 unsigned int drive_data; /* used by set_pio_mode/selectproc */
@@ -457,6 +658,9 @@ struct ide_drive_s {
457 658
458 int lun; /* logical unit */ 659 int lun; /* logical unit */
459 int crc_count; /* crc counter to reduce drive speed */ 660 int crc_count; /* crc counter to reduce drive speed */
661
662 unsigned long debug_mask; /* debugging levels switch */
663
460#ifdef CONFIG_BLK_DEV_IDEACPI 664#ifdef CONFIG_BLK_DEV_IDEACPI
461 struct ide_acpi_drive_link *acpidata; 665 struct ide_acpi_drive_link *acpidata;
462#endif 666#endif
@@ -464,21 +668,32 @@ struct ide_drive_s {
464 struct device gendev; 668 struct device gendev;
465 struct completion gendev_rel_comp; /* to deal with device release() */ 669 struct completion gendev_rel_comp; /* to deal with device release() */
466 670
671 /* current packet command */
672 struct ide_atapi_pc *pc;
673
467 /* callback for packet commands */ 674 /* callback for packet commands */
468 void (*pc_callback)(struct ide_drive_s *); 675 void (*pc_callback)(struct ide_drive_s *, int);
676
677 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
678 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
679 unsigned int, int);
469 680
470 unsigned long atapi_flags; 681 unsigned long atapi_flags;
682
683 struct ide_atapi_pc request_sense_pc;
684 struct request request_sense_rq;
471}; 685};
472 686
473typedef struct ide_drive_s ide_drive_t; 687typedef struct ide_drive_s ide_drive_t;
474 688
475#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 689#define to_ide_device(dev) container_of(dev, ide_drive_t, gendev)
476 690
477#define IDE_CHIPSET_PCI_MASK \ 691#define to_ide_drv(obj, cont_type) \
478 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 692 container_of(obj, struct cont_type, kref)
479#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 693
694#define ide_drv_g(disk, cont_type) \
695 container_of((disk)->private_data, struct cont_type, driver)
480 696
481struct ide_task_s;
482struct ide_port_info; 697struct ide_port_info;
483 698
484struct ide_tp_ops { 699struct ide_tp_ops {
@@ -512,6 +727,7 @@ extern const struct ide_tp_ops default_tp_ops;
512 * @resetproc: routine to reset controller after a disk reset 727 * @resetproc: routine to reset controller after a disk reset
513 * @maskproc: special host masking for drive selection 728 * @maskproc: special host masking for drive selection
514 * @quirkproc: check host's drive quirk list 729 * @quirkproc: check host's drive quirk list
730 * @clear_irq: clear IRQ
515 * 731 *
516 * @mdma_filter: filter MDMA modes 732 * @mdma_filter: filter MDMA modes
517 * @udma_filter: filter UDMA modes 733 * @udma_filter: filter UDMA modes
@@ -528,6 +744,7 @@ struct ide_port_ops {
528 void (*resetproc)(ide_drive_t *); 744 void (*resetproc)(ide_drive_t *);
529 void (*maskproc)(ide_drive_t *, int); 745 void (*maskproc)(ide_drive_t *, int);
530 void (*quirkproc)(ide_drive_t *); 746 void (*quirkproc)(ide_drive_t *);
747 void (*clear_irq)(ide_drive_t *);
531 748
532 u8 (*mdma_filter)(ide_drive_t *); 749 u8 (*mdma_filter)(ide_drive_t *);
533 u8 (*udma_filter)(ide_drive_t *); 750 u8 (*udma_filter)(ide_drive_t *);
@@ -567,7 +784,6 @@ typedef struct hwif_s {
567 u8 major; /* our major number */ 784 u8 major; /* our major number */
568 u8 index; /* 0 for ide0; 1 for ide1; ... */ 785 u8 index; /* 0 for ide0; 1 for ide1; ... */
569 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 786 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
570 u8 bus_state; /* power state of the IDE bus */
571 787
572 u32 host_flags; 788 u32 host_flags;
573 789
@@ -591,12 +807,16 @@ typedef struct hwif_s {
591 const struct ide_port_ops *port_ops; 807 const struct ide_port_ops *port_ops;
592 const struct ide_dma_ops *dma_ops; 808 const struct ide_dma_ops *dma_ops;
593 809
594 void (*ide_dma_clear_irq)(ide_drive_t *drive);
595
596 /* dma physical region descriptor table (cpu view) */ 810 /* dma physical region descriptor table (cpu view) */
597 unsigned int *dmatable_cpu; 811 unsigned int *dmatable_cpu;
598 /* dma physical region descriptor table (dma view) */ 812 /* dma physical region descriptor table (dma view) */
599 dma_addr_t dmatable_dma; 813 dma_addr_t dmatable_dma;
814
815 /* maximum number of PRD table entries */
816 int prd_max_nents;
817 /* PRD entry size in bytes */
818 int prd_ent_size;
819
600 /* Scatter-gather list used to build the above */ 820 /* Scatter-gather list used to build the above */
601 struct scatterlist *sg_table; 821 struct scatterlist *sg_table;
602 int sg_max_nents; /* Maximum number of entries in it */ 822 int sg_max_nents; /* Maximum number of entries in it */
@@ -606,6 +826,8 @@ typedef struct hwif_s {
606 /* data phase of the active command (currently only valid for PIO/DMA) */ 826 /* data phase of the active command (currently only valid for PIO/DMA) */
607 int data_phase; 827 int data_phase;
608 828
829 struct ide_task_s task; /* current command */
830
609 unsigned int nsect; 831 unsigned int nsect;
610 unsigned int nleft; 832 unsigned int nleft;
611 struct scatterlist *cursg; 833 struct scatterlist *cursg;
@@ -634,17 +856,18 @@ typedef struct hwif_s {
634 856
635 void *hwif_data; /* extra hwif data */ 857 void *hwif_data; /* extra hwif data */
636 858
637 unsigned dma;
638
639#ifdef CONFIG_BLK_DEV_IDEACPI 859#ifdef CONFIG_BLK_DEV_IDEACPI
640 struct ide_acpi_hwif_link *acpidata; 860 struct ide_acpi_hwif_link *acpidata;
641#endif 861#endif
642} ____cacheline_internodealigned_in_smp ide_hwif_t; 862} ____cacheline_internodealigned_in_smp ide_hwif_t;
643 863
864#define MAX_HOST_PORTS 4
865
644struct ide_host { 866struct ide_host {
645 ide_hwif_t *ports[MAX_HWIFS]; 867 ide_hwif_t *ports[MAX_HOST_PORTS];
646 unsigned int n_ports; 868 unsigned int n_ports;
647 struct device *dev[2]; 869 struct device *dev[2];
870 unsigned int (*init_chipset)(struct pci_dev *);
648 unsigned long host_flags; 871 unsigned long host_flags;
649 void *host_priv; 872 void *host_priv;
650}; 873};
@@ -692,102 +915,116 @@ typedef struct ide_driver_s ide_driver_t;
692 915
693extern struct mutex ide_setting_mtx; 916extern struct mutex ide_setting_mtx;
694 917
695int set_io_32bit(ide_drive_t *, int); 918/*
696int set_pio_mode(ide_drive_t *, int); 919 * configurable drive settings
697int set_using_dma(ide_drive_t *, int); 920 */
698 921
699/* ATAPI packet command flags */ 922#define DS_SYNC (1 << 0)
700enum { 923
701 /* set when an error is considered normal - no retry (ide-tape) */ 924struct ide_devset {
702 PC_FLAG_ABORT = (1 << 0), 925 int (*get)(ide_drive_t *);
703 PC_FLAG_SUPPRESS_ERROR = (1 << 1), 926 int (*set)(ide_drive_t *, int);
704 PC_FLAG_WAIT_FOR_DSC = (1 << 2), 927 unsigned int flags;
705 PC_FLAG_DMA_OK = (1 << 3),
706 PC_FLAG_DMA_IN_PROGRESS = (1 << 4),
707 PC_FLAG_DMA_ERROR = (1 << 5),
708 PC_FLAG_WRITING = (1 << 6),
709 /* command timed out */
710 PC_FLAG_TIMEDOUT = (1 << 7),
711}; 928};
712 929
713struct ide_atapi_pc { 930#define __DEVSET(_flags, _get, _set) { \
714 /* actual packet bytes */ 931 .flags = _flags, \
715 u8 c[12]; 932 .get = _get, \
716 /* incremented on each retry */ 933 .set = _set, \
717 int retries; 934}
718 int error;
719 935
720 /* bytes to transfer */ 936#define ide_devset_get(name, field) \
721 int req_xfer; 937static int get_##name(ide_drive_t *drive) \
722 /* bytes actually transferred */ 938{ \
723 int xferred; 939 return drive->field; \
940}
724 941
725 /* data buffer */ 942#define ide_devset_set(name, field) \
726 u8 *buf; 943static int set_##name(ide_drive_t *drive, int arg) \
727 /* current buffer position */ 944{ \
728 u8 *cur_pos; 945 drive->field = arg; \
729 int buf_size; 946 return 0; \
730 /* missing/available data on the current buffer */ 947}
731 int b_count;
732 948
733 /* the corresponding request */ 949#define ide_devset_get_flag(name, flag) \
734 struct request *rq; 950static int get_##name(ide_drive_t *drive) \
951{ \
952 return !!(drive->dev_flags & flag); \
953}
735 954
736 unsigned long flags; 955#define ide_devset_set_flag(name, flag) \
956static int set_##name(ide_drive_t *drive, int arg) \
957{ \
958 if (arg) \
959 drive->dev_flags |= flag; \
960 else \
961 drive->dev_flags &= ~flag; \
962 return 0; \
963}
737 964
738 /* 965#define __IDE_DEVSET(_name, _flags, _get, _set) \
739 * those are more or less driver-specific and some of them are subject 966const struct ide_devset ide_devset_##_name = \
740 * to change/removal later. 967 __DEVSET(_flags, _get, _set)
741 */
742 u8 pc_buf[256];
743 968
744 /* idetape only */ 969#define IDE_DEVSET(_name, _flags, _get, _set) \
745 struct idetape_bh *bh; 970static __IDE_DEVSET(_name, _flags, _get, _set)
746 char *b_data;
747 971
748 /* idescsi only for now */ 972#define ide_devset_rw(_name, _func) \
749 struct scatterlist *sg; 973IDE_DEVSET(_name, 0, get_##_func, set_##_func)
750 unsigned int sg_cnt;
751 974
752 struct scsi_cmnd *scsi_cmd; 975#define ide_devset_w(_name, _func) \
753 void (*done) (struct scsi_cmnd *); 976IDE_DEVSET(_name, 0, NULL, set_##_func)
754 977
755 unsigned long timeout; 978#define ide_ext_devset_rw(_name, _func) \
756}; 979__IDE_DEVSET(_name, 0, get_##_func, set_##_func)
980
981#define ide_ext_devset_rw_sync(_name, _func) \
982__IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func)
983
984#define ide_decl_devset(_name) \
985extern const struct ide_devset ide_devset_##_name
986
987ide_decl_devset(io_32bit);
988ide_decl_devset(keepsettings);
989ide_decl_devset(pio_mode);
990ide_decl_devset(unmaskirq);
991ide_decl_devset(using_dma);
757 992
758#ifdef CONFIG_IDE_PROC_FS 993#ifdef CONFIG_IDE_PROC_FS
759/* 994/*
760 * configurable drive settings 995 * /proc/ide interface
761 */ 996 */
762 997
763#define TYPE_INT 0 998#define ide_devset_rw_field(_name, _field) \
764#define TYPE_BYTE 1 999ide_devset_get(_name, _field); \
765#define TYPE_SHORT 2 1000ide_devset_set(_name, _field); \
1001IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
1002
1003#define ide_devset_rw_flag(_name, _field) \
1004ide_devset_get_flag(_name, _field); \
1005ide_devset_set_flag(_name, _field); \
1006IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
1007
1008struct ide_proc_devset {
1009 const char *name;
1010 const struct ide_devset *setting;
1011 int min, max;
1012 int (*mulf)(ide_drive_t *);
1013 int (*divf)(ide_drive_t *);
1014};
766 1015
767#define SETTING_READ (1 << 0) 1016#define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \
768#define SETTING_WRITE (1 << 1) 1017 .name = __stringify(_name), \
769#define SETTING_RW (SETTING_READ | SETTING_WRITE) 1018 .setting = &ide_devset_##_name, \
1019 .min = _min, \
1020 .max = _max, \
1021 .mulf = _mulf, \
1022 .divf = _divf, \
1023}
770 1024
771typedef int (ide_procset_t)(ide_drive_t *, int); 1025#define IDE_PROC_DEVSET(_name, _min, _max) \
772typedef struct ide_settings_s { 1026__IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
773 char *name;
774 int rw;
775 int data_type;
776 int min;
777 int max;
778 int mul_factor;
779 int div_factor;
780 void *data;
781 ide_procset_t *set;
782 int auto_remove;
783 struct ide_settings_s *next;
784} ide_settings_t;
785
786int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);
787 1027
788/*
789 * /proc/ide interface
790 */
791typedef struct { 1028typedef struct {
792 const char *name; 1029 const char *name;
793 mode_t mode; 1030 mode_t mode;
@@ -804,8 +1041,6 @@ void ide_proc_unregister_port(ide_hwif_t *);
804void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 1041void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
805void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 1042void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
806 1043
807void ide_add_generic_settings(ide_drive_t *);
808
809read_proc_t proc_ide_read_capacity; 1044read_proc_t proc_ide_read_capacity;
810read_proc_t proc_ide_read_geometry; 1045read_proc_t proc_ide_read_geometry;
811 1046
@@ -833,41 +1068,58 @@ static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
833static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 1068static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
834static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1069static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
835static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1070static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
836static inline void ide_add_generic_settings(ide_drive_t *drive) { ; }
837#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 1071#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
838#endif 1072#endif
839 1073
1074enum {
1075 /* enter/exit functions */
1076 IDE_DBG_FUNC = (1 << 0),
1077 /* sense key/asc handling */
1078 IDE_DBG_SENSE = (1 << 1),
1079 /* packet commands handling */
1080 IDE_DBG_PC = (1 << 2),
1081 /* request handling */
1082 IDE_DBG_RQ = (1 << 3),
1083 /* driver probing/setup */
1084 IDE_DBG_PROBE = (1 << 4),
1085};
1086
1087/* DRV_NAME has to be defined in the driver before using the macro below */
1088#define __ide_debug_log(lvl, fmt, args...) \
1089{ \
1090 if (unlikely(drive->debug_mask & lvl)) \
1091 printk(KERN_INFO DRV_NAME ": " fmt, ## args); \
1092}
1093
840/* 1094/*
841 * Power Management step value (rq->pm->pm_step). 1095 * Power Management state machine (rq->pm->pm_step).
842 *
843 * The step value starts at 0 (ide_pm_state_start_suspend) for a
844 * suspend operation or 1000 (ide_pm_state_start_resume) for a
845 * resume operation.
846 * 1096 *
847 * For each step, the core calls the subdriver start_power_step() first. 1097 * For each step, the core calls ide_start_power_step() first.
848 * This can return: 1098 * This can return:
849 * - ide_stopped : In this case, the core calls us back again unless 1099 * - ide_stopped : In this case, the core calls us back again unless
850 * step have been set to ide_power_state_completed. 1100 * step have been set to ide_power_state_completed.
851 * - ide_started : In this case, the channel is left busy until an 1101 * - ide_started : In this case, the channel is left busy until an
852 * async event (interrupt) occurs. 1102 * async event (interrupt) occurs.
853 * Typically, start_power_step() will issue a taskfile request with 1103 * Typically, ide_start_power_step() will issue a taskfile request with
854 * do_rw_taskfile(). 1104 * do_rw_taskfile().
855 * 1105 *
856 * Upon reception of the interrupt, the core will call complete_power_step() 1106 * Upon reception of the interrupt, the core will call ide_complete_power_step()
857 * with the error code if any. This routine should update the step value 1107 * with the error code if any. This routine should update the step value
858 * and return. It should not start a new request. The core will call 1108 * and return. It should not start a new request. The core will call
859 * start_power_step for the new step value, unless step have been set to 1109 * ide_start_power_step() for the new step value, unless step have been
860 * ide_power_state_completed. 1110 * set to IDE_PM_COMPLETED.
861 *
862 * Subdrivers are expected to define their own additional power
863 * steps from 1..999 for suspend and from 1001..1999 for resume,
864 * other values are reserved for future use.
865 */ 1111 */
866
867enum { 1112enum {
868 ide_pm_state_completed = -1, 1113 IDE_PM_START_SUSPEND,
869 ide_pm_state_start_suspend = 0, 1114 IDE_PM_FLUSH_CACHE = IDE_PM_START_SUSPEND,
870 ide_pm_state_start_resume = 1000, 1115 IDE_PM_STANDBY,
1116
1117 IDE_PM_START_RESUME,
1118 IDE_PM_RESTORE_PIO = IDE_PM_START_RESUME,
1119 IDE_PM_IDLE,
1120 IDE_PM_RESTORE_DMA,
1121
1122 IDE_PM_COMPLETED,
871}; 1123};
872 1124
873/* 1125/*
@@ -878,8 +1130,6 @@ enum {
878 */ 1130 */
879struct ide_driver_s { 1131struct ide_driver_s {
880 const char *version; 1132 const char *version;
881 u8 media;
882 unsigned supports_dsc_overlap : 1;
883 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1133 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
884 int (*end_request)(ide_drive_t *, int, int); 1134 int (*end_request)(ide_drive_t *, int, int);
885 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 1135 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
@@ -889,7 +1139,8 @@ struct ide_driver_s {
889 void (*resume)(ide_drive_t *); 1139 void (*resume)(ide_drive_t *);
890 void (*shutdown)(ide_drive_t *); 1140 void (*shutdown)(ide_drive_t *);
891#ifdef CONFIG_IDE_PROC_FS 1141#ifdef CONFIG_IDE_PROC_FS
892 ide_proc_entry_t *proc; 1142 ide_proc_entry_t * (*proc_entries)(ide_drive_t *);
1143 const struct ide_proc_devset * (*proc_devsets)(ide_drive_t *);
893#endif 1144#endif
894}; 1145};
895 1146
@@ -898,7 +1149,16 @@ struct ide_driver_s {
898int ide_device_get(ide_drive_t *); 1149int ide_device_get(ide_drive_t *);
899void ide_device_put(ide_drive_t *); 1150void ide_device_put(ide_drive_t *);
900 1151
901int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 1152struct ide_ioctl_devset {
1153 unsigned int get_ioctl;
1154 unsigned int set_ioctl;
1155 const struct ide_devset *setting;
1156};
1157
1158int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int,
1159 unsigned long, const struct ide_ioctl_devset *);
1160
1161int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned long);
902 1162
903extern int ide_vlb_clk; 1163extern int ide_vlb_clk;
904extern int ide_pci_clk; 1164extern int ide_pci_clk;
@@ -920,122 +1180,23 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
920 1180
921ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 1181ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
922 1182
923extern void ide_fix_driveid(struct hd_driveid *); 1183void ide_fix_driveid(u16 *);
924 1184
925extern void ide_fixstring(u8 *, const int, const int); 1185extern void ide_fixstring(u8 *, const int, const int);
926 1186
1187int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1188
927int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1189int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
928 1190
929extern ide_startstop_t ide_do_reset (ide_drive_t *); 1191extern ide_startstop_t ide_do_reset (ide_drive_t *);
930 1192
1193extern int ide_devset_execute(ide_drive_t *drive,
1194 const struct ide_devset *setting, int arg);
1195
931extern void ide_do_drive_cmd(ide_drive_t *, struct request *); 1196extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
932 1197
933extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1198extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
934 1199
935enum {
936 IDE_TFLAG_LBA48 = (1 << 0),
937 IDE_TFLAG_FLAGGED = (1 << 2),
938 IDE_TFLAG_OUT_DATA = (1 << 3),
939 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
940 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
941 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
942 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
943 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
944 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
945 IDE_TFLAG_OUT_HOB_NSECT |
946 IDE_TFLAG_OUT_HOB_LBAL |
947 IDE_TFLAG_OUT_HOB_LBAM |
948 IDE_TFLAG_OUT_HOB_LBAH,
949 IDE_TFLAG_OUT_FEATURE = (1 << 9),
950 IDE_TFLAG_OUT_NSECT = (1 << 10),
951 IDE_TFLAG_OUT_LBAL = (1 << 11),
952 IDE_TFLAG_OUT_LBAM = (1 << 12),
953 IDE_TFLAG_OUT_LBAH = (1 << 13),
954 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
955 IDE_TFLAG_OUT_NSECT |
956 IDE_TFLAG_OUT_LBAL |
957 IDE_TFLAG_OUT_LBAM |
958 IDE_TFLAG_OUT_LBAH,
959 IDE_TFLAG_OUT_DEVICE = (1 << 14),
960 IDE_TFLAG_WRITE = (1 << 15),
961 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
962 IDE_TFLAG_IN_DATA = (1 << 17),
963 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
964 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
965 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
966 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
967 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
968 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
969 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
970 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
971 IDE_TFLAG_IN_HOB_LBAM |
972 IDE_TFLAG_IN_HOB_LBAH,
973 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
974 IDE_TFLAG_IN_HOB_NSECT |
975 IDE_TFLAG_IN_HOB_LBA,
976 IDE_TFLAG_IN_FEATURE = (1 << 1),
977 IDE_TFLAG_IN_NSECT = (1 << 25),
978 IDE_TFLAG_IN_LBAL = (1 << 26),
979 IDE_TFLAG_IN_LBAM = (1 << 27),
980 IDE_TFLAG_IN_LBAH = (1 << 28),
981 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
982 IDE_TFLAG_IN_LBAM |
983 IDE_TFLAG_IN_LBAH,
984 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
985 IDE_TFLAG_IN_LBA,
986 IDE_TFLAG_IN_DEVICE = (1 << 29),
987 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
988 IDE_TFLAG_IN_HOB,
989 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
990 IDE_TFLAG_IN_TF,
991 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
992 IDE_TFLAG_IN_DEVICE,
993 /* force 16-bit I/O operations */
994 IDE_TFLAG_IO_16BIT = (1 << 30),
995 /* ide_task_t was allocated using kmalloc() */
996 IDE_TFLAG_DYN = (1 << 31),
997};
998
999struct ide_taskfile {
1000 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
1001
1002 u8 hob_feature; /* 1-5: additional data to support LBA48 */
1003 u8 hob_nsect;
1004 u8 hob_lbal;
1005 u8 hob_lbam;
1006 u8 hob_lbah;
1007
1008 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
1009
1010 union { /*  7: */
1011 u8 error; /* read: error */
1012 u8 feature; /* write: feature */
1013 };
1014
1015 u8 nsect; /* 8: number of sectors */
1016 u8 lbal; /* 9: LBA low */
1017 u8 lbam; /* 10: LBA mid */
1018 u8 lbah; /* 11: LBA high */
1019
1020 u8 device; /* 12: device select */
1021
1022 union { /* 13: */
1023 u8 status; /*  read: status  */
1024 u8 command; /* write: command */
1025 };
1026};
1027
1028typedef struct ide_task_s {
1029 union {
1030 struct ide_taskfile tf;
1031 u8 tf_array[14];
1032 };
1033 u32 tf_flags;
1034 int data_phase;
1035 struct request *rq; /* copy of request */
1036 void *special; /* valid_t generally */
1037} ide_task_t;
1038
1039void ide_tf_dump(const char *, struct ide_taskfile *); 1200void ide_tf_dump(const char *, struct ide_taskfile *);
1040 1201
1041void ide_exec_command(ide_hwif_t *, u8); 1202void ide_exec_command(ide_hwif_t *, u8);
@@ -1051,6 +1212,8 @@ void ide_tf_read(ide_drive_t *, ide_task_t *);
1051void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); 1212void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
1052void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); 1213void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
1053 1214
1215int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1216
1054extern void SELECT_DRIVE(ide_drive_t *); 1217extern void SELECT_DRIVE(ide_drive_t *);
1055void SELECT_MASK(ide_drive_t *, int); 1218void SELECT_MASK(ide_drive_t *, int);
1056 1219
@@ -1061,16 +1224,46 @@ extern int drive_is_ready(ide_drive_t *);
1061 1224
1062void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); 1225void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1063 1226
1064ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, 1227int ide_check_atapi_device(ide_drive_t *, const char *);
1065 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, 1228
1066 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), 1229void ide_init_pc(struct ide_atapi_pc *);
1067 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), 1230
1068 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, 1231/* Disk head parking */
1069 int)); 1232extern wait_queue_head_t ide_park_wq;
1070ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, 1233ssize_t ide_park_show(struct device *dev, struct device_attribute *attr,
1071 ide_handler_t *, unsigned int, ide_expiry_t *); 1234 char *buf);
1072ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_atapi_pc *, 1235ssize_t ide_park_store(struct device *dev, struct device_attribute *attr,
1073 ide_handler_t *, unsigned int, ide_expiry_t *); 1236 const char *buf, size_t len);
1237
1238/*
1239 * Special requests for ide-tape block device strategy routine.
1240 *
1241 * In order to service a character device command, we add special requests to
1242 * the tail of our block device request queue and wait for their completion.
1243 */
1244enum {
1245 REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */
1246 REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */
1247 REQ_IDETAPE_READ = (1 << 2),
1248 REQ_IDETAPE_WRITE = (1 << 3),
1249};
1250
1251int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *);
1252
1253int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1254int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
1255int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1256void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
1257void ide_retry_pc(ide_drive_t *, struct gendisk *);
1258
1259static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc)
1260{
1261 return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
1262}
1263
1264int ide_scsi_expiry(ide_drive_t *);
1265
1266ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *);
1074 1267
1075ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1268ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1076 1269
@@ -1080,8 +1273,6 @@ int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
1080int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1273int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1081 1274
1082int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1275int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1083int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
1084int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
1085 1276
1086extern int ide_driveid_update(ide_drive_t *); 1277extern int ide_driveid_update(ide_drive_t *);
1087extern int ide_config_drive_speed(ide_drive_t *, u8); 1278extern int ide_config_drive_speed(ide_drive_t *, u8);
@@ -1092,7 +1283,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1092 1283
1093extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1284extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1094 1285
1095extern int ide_spin_wait_hwgroup(ide_drive_t *);
1096extern void ide_timer_expiry(unsigned long); 1286extern void ide_timer_expiry(unsigned long);
1097extern irqreturn_t ide_intr(int irq, void *dev_id); 1287extern irqreturn_t ide_intr(int irq, void *dev_id);
1098extern void do_ide_request(struct request_queue *); 1288extern void do_ide_request(struct request_queue *);
@@ -1229,6 +1419,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
1229 const struct ide_port_info *, void *); 1419 const struct ide_port_info *, void *);
1230void ide_pci_remove(struct pci_dev *); 1420void ide_pci_remove(struct pci_dev *);
1231 1421
1422#ifdef CONFIG_PM
1423int ide_pci_suspend(struct pci_dev *, pm_message_t);
1424int ide_pci_resume(struct pci_dev *);
1425#else
1426#define ide_pci_suspend NULL
1427#define ide_pci_resume NULL
1428#endif
1429
1232void ide_map_sg(ide_drive_t *, struct request *); 1430void ide_map_sg(ide_drive_t *, struct request *);
1233void ide_init_sg_cmd(ide_drive_t *, struct request *); 1431void ide_init_sg_cmd(ide_drive_t *, struct request *);
1234 1432
@@ -1240,9 +1438,10 @@ struct drive_list_entry {
1240 const char *id_firmware; 1438 const char *id_firmware;
1241}; 1439};
1242 1440
1243int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1441int ide_in_drive_list(u16 *, const struct drive_list_entry *);
1244 1442
1245#ifdef CONFIG_BLK_DEV_IDEDMA 1443#ifdef CONFIG_BLK_DEV_IDEDMA
1444int ide_dma_good_drive(ide_drive_t *);
1246int __ide_dma_bad_drive(ide_drive_t *); 1445int __ide_dma_bad_drive(ide_drive_t *);
1247int ide_id_dma_bug(ide_drive_t *); 1446int ide_id_dma_bug(ide_drive_t *);
1248 1447
@@ -1260,25 +1459,29 @@ int ide_set_dma(ide_drive_t *);
1260void ide_check_dma_crc(ide_drive_t *); 1459void ide_check_dma_crc(ide_drive_t *);
1261ide_startstop_t ide_dma_intr(ide_drive_t *); 1460ide_startstop_t ide_dma_intr(ide_drive_t *);
1262 1461
1462int ide_allocate_dma_engine(ide_hwif_t *);
1463void ide_release_dma_engine(ide_hwif_t *);
1464
1263int ide_build_sglist(ide_drive_t *, struct request *); 1465int ide_build_sglist(ide_drive_t *, struct request *);
1264void ide_destroy_dmatable(ide_drive_t *); 1466void ide_destroy_dmatable(ide_drive_t *);
1265 1467
1266#ifdef CONFIG_BLK_DEV_IDEDMA_SFF 1468#ifdef CONFIG_BLK_DEV_IDEDMA_SFF
1469int config_drive_for_dma(ide_drive_t *);
1267extern int ide_build_dmatable(ide_drive_t *, struct request *); 1470extern int ide_build_dmatable(ide_drive_t *, struct request *);
1268int ide_allocate_dma_engine(ide_hwif_t *);
1269void ide_release_dma_engine(ide_hwif_t *);
1270
1271void ide_dma_host_set(ide_drive_t *, int); 1471void ide_dma_host_set(ide_drive_t *, int);
1272extern int ide_dma_setup(ide_drive_t *); 1472extern int ide_dma_setup(ide_drive_t *);
1273void ide_dma_exec_cmd(ide_drive_t *, u8); 1473void ide_dma_exec_cmd(ide_drive_t *, u8);
1274extern void ide_dma_start(ide_drive_t *); 1474extern void ide_dma_start(ide_drive_t *);
1275extern int __ide_dma_end(ide_drive_t *); 1475int ide_dma_end(ide_drive_t *);
1276int ide_dma_test_irq(ide_drive_t *); 1476int ide_dma_test_irq(ide_drive_t *);
1277extern void ide_dma_lost_irq(ide_drive_t *);
1278extern void ide_dma_timeout(ide_drive_t *);
1279extern const struct ide_dma_ops sff_dma_ops; 1477extern const struct ide_dma_ops sff_dma_ops;
1478#else
1479static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
1280#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1480#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1281 1481
1482void ide_dma_lost_irq(ide_drive_t *);
1483void ide_dma_timeout(ide_drive_t *);
1484
1282#else 1485#else
1283static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; } 1486static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1284static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1487static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
@@ -1289,11 +1492,8 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; }
1289static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1492static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1290static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1493static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1291static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } 1494static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1292#endif /* CONFIG_BLK_DEV_IDEDMA */
1293
1294#ifndef CONFIG_BLK_DEV_IDEDMA_SFF
1295static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } 1495static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; }
1296#endif 1496#endif /* CONFIG_BLK_DEV_IDEDMA */
1297 1497
1298#ifdef CONFIG_BLK_DEV_IDEACPI 1498#ifdef CONFIG_BLK_DEV_IDEACPI
1299extern int ide_acpi_exec_tfs(ide_drive_t *drive); 1499extern int ide_acpi_exec_tfs(ide_drive_t *drive);
@@ -1321,7 +1521,6 @@ void ide_undecoded_slave(ide_drive_t *);
1321 1521
1322void ide_port_apply_params(ide_hwif_t *); 1522void ide_port_apply_params(ide_hwif_t *);
1323 1523
1324struct ide_host *ide_host_alloc_all(const struct ide_port_info *, hw_regs_t **);
1325struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1524struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
1326void ide_host_free(struct ide_host *); 1525void ide_host_free(struct ide_host *);
1327int ide_host_register(struct ide_host *, const struct ide_port_info *, 1526int ide_host_register(struct ide_host *, const struct ide_port_info *,
@@ -1347,24 +1546,6 @@ const char *ide_xfer_verbose(u8 mode);
1347extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1546extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1348extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1547extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1349 1548
1350static inline int ide_dev_has_iordy(struct hd_driveid *id)
1351{
1352 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
1353}
1354
1355static inline int ide_dev_is_sata(struct hd_driveid *id)
1356{
1357 /*
1358 * See if word 93 is 0 AND drive is at least ATA-5 compatible
1359 * verifying that word 80 by casting it to a signed type --
1360 * this trick allows us to filter out the reserved values of
1361 * 0x0000 and 0xffff along with the earlier ATA revisions...
1362 */
1363 if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
1364 return 1;
1365 return 0;
1366}
1367
1368u64 ide_get_lba_addr(struct ide_taskfile *, int); 1549u64 ide_get_lba_addr(struct ide_taskfile *, int);
1369u8 ide_dump_status(ide_drive_t *, const char *, u8); 1550u8 ide_dump_status(ide_drive_t *, const char *, u8);
1370 1551
@@ -1436,13 +1617,6 @@ extern struct mutex ide_cfg_mtx;
1436extern struct bus_type ide_bus_type; 1617extern struct bus_type ide_bus_type;
1437extern struct class *ide_port_class; 1618extern struct class *ide_port_class;
1438 1619
1439/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
1440#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000)
1441
1442/* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */
1443#define ide_id_has_flush_cache_ext(id) \
1444 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1445
1446static inline void ide_dump_identify(u8 *id) 1620static inline void ide_dump_identify(u8 *id)
1447{ 1621{
1448 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); 1622 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
@@ -1453,10 +1627,10 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
1453 return hwif->dev ? dev_to_node(hwif->dev) : -1; 1627 return hwif->dev ? dev_to_node(hwif->dev) : -1;
1454} 1628}
1455 1629
1456static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) 1630static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1457{ 1631{
1458 ide_hwif_t *hwif = HWIF(drive); 1632 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1];
1459 1633
1460 return &hwif->drives[(drive->dn ^ 1) & 1]; 1634 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1461} 1635}
1462#endif /* _IDE_H */ 1636#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 7f4df7c7659d..14126bc36641 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -471,6 +471,11 @@ struct ieee80211s_hdr {
471 u8 eaddr3[6]; 471 u8 eaddr3[6];
472} __attribute__ ((packed)); 472} __attribute__ ((packed));
473 473
474/* Mesh flags */
475#define MESH_FLAGS_AE_A4 0x1
476#define MESH_FLAGS_AE_A5_A6 0x2
477#define MESH_FLAGS_PS_DEEP 0x4
478
474/** 479/**
475 * struct ieee80211_quiet_ie 480 * struct ieee80211_quiet_ie
476 * 481 *
@@ -643,6 +648,9 @@ struct ieee80211_mgmt {
643 } u; 648 } u;
644} __attribute__ ((packed)); 649} __attribute__ ((packed));
645 650
651/* mgmt header + 1 byte category code */
652#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
653
646 654
647/* Control frames */ 655/* Control frames */
648struct ieee80211_rts { 656struct ieee80211_rts {
@@ -708,12 +716,13 @@ struct ieee80211_ht_addt_info {
708 716
709/* 802.11n HT capabilities masks */ 717/* 802.11n HT capabilities masks */
710#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
711#define IEEE80211_HT_CAP_MIMO_PS 0x000C 719#define IEEE80211_HT_CAP_SM_PS 0x000C
712#define IEEE80211_HT_CAP_GRN_FLD 0x0010 720#define IEEE80211_HT_CAP_GRN_FLD 0x0010
713#define IEEE80211_HT_CAP_SGI_20 0x0020 721#define IEEE80211_HT_CAP_SGI_20 0x0020
714#define IEEE80211_HT_CAP_SGI_40 0x0040 722#define IEEE80211_HT_CAP_SGI_40 0x0040
715#define IEEE80211_HT_CAP_DELAY_BA 0x0400 723#define IEEE80211_HT_CAP_DELAY_BA 0x0400
716#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
717/* 802.11n HT capability AMPDU settings */ 726/* 802.11n HT capability AMPDU settings */
718#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
719#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
@@ -736,11 +745,26 @@ struct ieee80211_ht_addt_info {
736#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
737#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
738 747
739/* MIMO Power Save Modes */ 748/* block-ack parameters */
740#define WLAN_HT_CAP_MIMO_PS_STATIC 0 749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
741#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 750#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
742#define WLAN_HT_CAP_MIMO_PS_INVALID 2 751#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
743#define WLAN_HT_CAP_MIMO_PS_DISABLED 3 752#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
753#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
754
755/*
756 * A-PMDU buffer sizes
757 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
758 */
759#define IEEE80211_MIN_AMPDU_BUF 0x8
760#define IEEE80211_MAX_AMPDU_BUF 0x40
761
762
763/* Spatial Multiplexing Power Save Modes */
764#define WLAN_HT_CAP_SM_PS_STATIC 0
765#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
766#define WLAN_HT_CAP_SM_PS_INVALID 2
767#define WLAN_HT_CAP_SM_PS_DISABLED 3
744 768
745/* Authentication algorithms */ 769/* Authentication algorithms */
746#define WLAN_AUTH_OPEN 0 770#define WLAN_AUTH_OPEN 0
diff --git a/include/linux/if.h b/include/linux/if.h
index 5c9d1fa93fef..65246846c844 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -24,6 +24,7 @@
24#include <linux/compiler.h> /* for "__user" et al */ 24#include <linux/compiler.h> /* for "__user" et al */
25 25
26#define IFNAMSIZ 16 26#define IFNAMSIZ 16
27#define IFALIASZ 256
27#include <linux/hdlc/ioctl.h> 28#include <linux/hdlc/ioctl.h>
28 29
29/* Standard interface flags (netdevice->flags). */ 30/* Standard interface flags (netdevice->flags). */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e157c1399b61..7f3c735f422b 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org> 11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@redhat.com> 12 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 * 14 *
15 * This program is free software; you can redistribute it and/or 15 * This program is free software; you can redistribute it and/or
@@ -56,6 +56,7 @@
56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ 56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
57#define ETH_P_CUST 0x6006 /* DEC Customer use */ 57#define ETH_P_CUST 0x6006 /* DEC Customer use */
58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ 58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
59#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
59#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ 60#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
60#define ETH_P_ATALK 0x809B /* Appletalk DDP */ 61#define ETH_P_ATALK 0x809B /* Appletalk DDP */
61#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ 62#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
@@ -74,8 +75,10 @@
74#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport 75#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
75 * over Ethernet 76 * over Ethernet
76 */ 77 */
78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
77#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
78#define ETH_P_TIPC 0x88CA /* TIPC */ 80#define ETH_P_TIPC 0x88CA /* TIPC */
81#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
79 82
80/* 83/*
81 * Non DIX types. Won't clash for 1500 types. 84 * Non DIX types. Won't clash for 1500 types.
@@ -99,6 +102,9 @@
99#define ETH_P_ECONET 0x0018 /* Acorn Econet */ 102#define ETH_P_ECONET 0x0018 /* Acorn Econet */
100#define ETH_P_HDLC 0x0019 /* HDLC frames */ 103#define ETH_P_HDLC 0x0019 /* HDLC frames */
101#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ 104#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */
105#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
106#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
107#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
102 108
103/* 109/*
104 * This is an Ethernet frame header. 110 * This is an Ethernet frame header.
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index ae77daed6c2f..45de1046dbbf 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -12,7 +12,7 @@
12 * if_fddi.h is based on previous if_ether.h and if_tr.h work by 12 * if_fddi.h is based on previous if_ether.h and if_tr.h work by
13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
14 * Donald Becker, <becker@super.org> 14 * Donald Becker, <becker@super.org>
15 * Alan Cox, <alan@redhat.com> 15 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
16 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 16 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
17 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be> 17 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
18 * 18 *
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index 94d31ca7d71a..f0f23516bb59 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org> 11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@redhat.com> 12 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk> 13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 * Jes Sorensen, <Jes.Sorensen@cern.ch> 14 * Jes Sorensen, <Jes.Sorensen@cern.ch>
15 * 15 *
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 84c3492ae5cb..f9032c88716a 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -79,6 +79,7 @@ enum
79 IFLA_LINKINFO, 79 IFLA_LINKINFO,
80#define IFLA_LINKINFO IFLA_LINKINFO 80#define IFLA_LINKINFO IFLA_LINKINFO
81 IFLA_NET_NS_PID, 81 IFLA_NET_NS_PID,
82 IFLA_IFALIAS,
82 __IFLA_MAX 83 __IFLA_MAX
83}; 84};
84 85
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h
new file mode 100644
index 000000000000..d70034bcec05
--- /dev/null
+++ b/include/linux/if_phonet.h
@@ -0,0 +1,19 @@
1/*
2 * File: if_phonet.h
3 *
4 * Phonet interface kernel definitions
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
7 */
8#ifndef LINUX_IF_PHONET_H
9#define LINUX_IF_PHONET_H
10
11#define PHONET_MIN_MTU 6 /* pn_length = 0 */
12#define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */
13#define PHONET_DEV_MTU PHONET_MAX_MTU
14
15#ifdef __KERNEL__
16extern struct header_ops phonet_header_ops;
17#endif
18
19#endif
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index d4efe4014705..aeab2cb32a9c 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/ip.h>
5 6
6#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) 7#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 8#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
@@ -47,4 +48,22 @@ struct ip_tunnel_prl {
47/* PRL flags */ 48/* PRL flags */
48#define PRL_DEFAULT 0x0001 49#define PRL_DEFAULT 0x0001
49 50
51enum
52{
53 IFLA_GRE_UNSPEC,
54 IFLA_GRE_LINK,
55 IFLA_GRE_IFLAGS,
56 IFLA_GRE_OFLAGS,
57 IFLA_GRE_IKEY,
58 IFLA_GRE_OKEY,
59 IFLA_GRE_LOCAL,
60 IFLA_GRE_REMOTE,
61 IFLA_GRE_TTL,
62 IFLA_GRE_TOS,
63 IFLA_GRE_PMTUDISC,
64 __IFLA_GRE_MAX,
65};
66
67#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
68
50#endif /* _IF_TUNNEL_H_ */ 69#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7bb3c095c15b..f734a0ba0698 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -2,7 +2,7 @@
2 * Linux NET3: Internet Group Management Protocol [IGMP] 2 * Linux NET3: Internet Group Management Protocol [IGMP]
3 * 3 *
4 * Authors: 4 * Authors:
5 * Alan Cox <Alan.Cox@linux.org> 5 * Alan Cox <alan@lxorguk.ukuu.org.uk>
6 * 6 *
7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6 7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6
8 * 8 *
diff --git a/include/linux/in.h b/include/linux/in.h
index 4065313cd7ee..db458beef19d 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -75,6 +75,7 @@ struct in_addr {
75#define IP_IPSEC_POLICY 16 75#define IP_IPSEC_POLICY 16
76#define IP_XFRM_POLICY 17 76#define IP_XFRM_POLICY 17
77#define IP_PASSSEC 18 77#define IP_PASSSEC 18
78#define IP_TRANSPARENT 19
78 79
79/* BSD compatibility */ 80/* BSD compatibility */
80#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index c6f51ad52d5b..06fcdb45106b 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -25,6 +25,7 @@ struct in_device
25 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 25 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
26 rwlock_t mc_list_lock; 26 rwlock_t mc_list_lock;
27 struct ip_mc_list *mc_list; /* IP multicast filter chain */ 27 struct ip_mc_list *mc_list; /* IP multicast filter chain */
28 int mc_count; /* Number of installed mcasts */
28 spinlock_t mc_tomb_lock; 29 spinlock_t mc_tomb_lock;
29 struct ip_mc_list *mc_tomb; 30 struct ip_mc_list *mc_tomb;
30 unsigned long mr_v1_seen; 31 unsigned long mr_v1_seen;
diff --git a/include/linux/init.h b/include/linux/init.h
index 93538b696e3d..0c1264668be0 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,7 +40,7 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __section(.init.text) __cold 43#define __init __section(.init.text) __cold notrace
44#define __initdata __section(.init.data) 44#define __initdata __section(.init.data)
45#define __initconst __section(.init.rodata) 45#define __initconst __section(.init.rodata)
46#define __exitdata __section(.exit.data) 46#define __exitdata __section(.exit.data)
@@ -233,9 +233,6 @@ struct obs_kernel_param {
233 __attribute__((aligned((sizeof(long))))) \ 233 __attribute__((aligned((sizeof(long))))) \
234 = { __setup_str_##unique_id, fn, early } 234 = { __setup_str_##unique_id, fn, early }
235 235
236#define __setup_null_param(str, unique_id) \
237 __setup_param(str, unique_id, NULL, 0)
238
239#define __setup(str, fn) \ 236#define __setup(str, fn) \
240 __setup_param(str, fn, fn, 0) 237 __setup_param(str, fn, fn, 0)
241 238
@@ -296,7 +293,6 @@ void __init parse_early_param(void);
296 void cleanup_module(void) __attribute__((alias(#exitfn))); 293 void cleanup_module(void) __attribute__((alias(#exitfn)));
297 294
298#define __setup_param(str, unique_id, fn) /* nothing */ 295#define __setup_param(str, unique_id, fn) /* nothing */
299#define __setup_null_param(str, unique_id) /* nothing */
300#define __setup(str, func) /* nothing */ 296#define __setup(str, func) /* nothing */
301#endif 297#endif
302 298
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 021d8e720c79..23fd8909b9e5 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -170,6 +170,7 @@ extern struct group_info init_groups;
170 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 170 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
171 .fs_excl = ATOMIC_INIT(0), \ 171 .fs_excl = ATOMIC_INIT(0), \
172 .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ 172 .pi_lock = __SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
173 .timer_slack_ns = 50000, /* 50 usec default slack */ \
173 .pids = { \ 174 .pids = { \
174 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \ 175 [PIDTYPE_PID] = INIT_PID_LINK(PIDTYPE_PID), \
175 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ 176 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
diff --git a/include/linux/input.h b/include/linux/input.h
index a5802c9c81a4..b86fb5581ce6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -577,9 +577,22 @@ struct input_absinfo {
577#define KEY_BRL_DOT9 0x1f9 577#define KEY_BRL_DOT9 0x1f9
578#define KEY_BRL_DOT10 0x1fa 578#define KEY_BRL_DOT10 0x1fa
579 579
580#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
581#define KEY_NUMERIC_1 0x201 /* and other keypads */
582#define KEY_NUMERIC_2 0x202
583#define KEY_NUMERIC_3 0x203
584#define KEY_NUMERIC_4 0x204
585#define KEY_NUMERIC_5 0x205
586#define KEY_NUMERIC_6 0x206
587#define KEY_NUMERIC_7 0x207
588#define KEY_NUMERIC_8 0x208
589#define KEY_NUMERIC_9 0x209
590#define KEY_NUMERIC_STAR 0x20a
591#define KEY_NUMERIC_POUND 0x20b
592
580/* We avoid low common keys in module aliases so they don't get huge. */ 593/* We avoid low common keys in module aliases so they don't get huge. */
581#define KEY_MIN_INTERESTING KEY_MUTE 594#define KEY_MIN_INTERESTING KEY_MUTE
582#define KEY_MAX 0x1ff 595#define KEY_MAX 0x2ff
583#define KEY_CNT (KEY_MAX+1) 596#define KEY_CNT (KEY_MAX+1)
584 597
585/* 598/*
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
new file mode 100644
index 000000000000..3d017cfd245b
--- /dev/null
+++ b/include/linux/intel-iommu.h
@@ -0,0 +1,363 @@
1/*
2 * Copyright (c) 2006, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Copyright (C) 2006-2008 Intel Corporation
18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 */
21
22#ifndef _INTEL_IOMMU_H_
23#define _INTEL_IOMMU_H_
24
25#include <linux/types.h>
26#include <linux/msi.h>
27#include <linux/sysdev.h>
28#include <linux/iova.h>
29#include <linux/io.h>
30#include <linux/dma_remapping.h>
31#include <asm/cacheflush.h>
32#include <asm/iommu.h>
33
34/*
35 * Intel IOMMU register specification per version 1.0 public spec.
36 */
37
38#define DMAR_VER_REG 0x0 /* Arch version supported by this IOMMU */
39#define DMAR_CAP_REG 0x8 /* Hardware supported capabilities */
40#define DMAR_ECAP_REG 0x10 /* Extended capabilities supported */
41#define DMAR_GCMD_REG 0x18 /* Global command register */
42#define DMAR_GSTS_REG 0x1c /* Global status register */
43#define DMAR_RTADDR_REG 0x20 /* Root entry table */
44#define DMAR_CCMD_REG 0x28 /* Context command reg */
45#define DMAR_FSTS_REG 0x34 /* Fault Status register */
46#define DMAR_FECTL_REG 0x38 /* Fault control register */
47#define DMAR_FEDATA_REG 0x3c /* Fault event interrupt data register */
48#define DMAR_FEADDR_REG 0x40 /* Fault event interrupt addr register */
49#define DMAR_FEUADDR_REG 0x44 /* Upper address register */
50#define DMAR_AFLOG_REG 0x58 /* Advanced Fault control */
51#define DMAR_PMEN_REG 0x64 /* Enable Protected Memory Region */
52#define DMAR_PLMBASE_REG 0x68 /* PMRR Low addr */
53#define DMAR_PLMLIMIT_REG 0x6c /* PMRR low limit */
54#define DMAR_PHMBASE_REG 0x70 /* pmrr high base addr */
55#define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */
56#define DMAR_IQH_REG 0x80 /* Invalidation queue head register */
57#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
58#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
59#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */
60#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
61
62#define OFFSET_STRIDE (9)
63/*
64#define dmar_readl(dmar, reg) readl(dmar + reg)
65#define dmar_readq(dmar, reg) ({ \
66 u32 lo, hi; \
67 lo = readl(dmar + reg); \
68 hi = readl(dmar + reg + 4); \
69 (((u64) hi) << 32) + lo; })
70*/
71static inline u64 dmar_readq(void __iomem *addr)
72{
73 u32 lo, hi;
74 lo = readl(addr);
75 hi = readl(addr + 4);
76 return (((u64) hi) << 32) + lo;
77}
78
79static inline void dmar_writeq(void __iomem *addr, u64 val)
80{
81 writel((u32)val, addr);
82 writel((u32)(val >> 32), addr + 4);
83}
84
85#define DMAR_VER_MAJOR(v) (((v) & 0xf0) >> 4)
86#define DMAR_VER_MINOR(v) ((v) & 0x0f)
87
88/*
89 * Decoding Capability Register
90 */
91#define cap_read_drain(c) (((c) >> 55) & 1)
92#define cap_write_drain(c) (((c) >> 54) & 1)
93#define cap_max_amask_val(c) (((c) >> 48) & 0x3f)
94#define cap_num_fault_regs(c) ((((c) >> 40) & 0xff) + 1)
95#define cap_pgsel_inv(c) (((c) >> 39) & 1)
96
97#define cap_super_page_val(c) (((c) >> 34) & 0xf)
98#define cap_super_offset(c) (((find_first_bit(&cap_super_page_val(c), 4)) \
99 * OFFSET_STRIDE) + 21)
100
101#define cap_fault_reg_offset(c) ((((c) >> 24) & 0x3ff) * 16)
102#define cap_max_fault_reg_offset(c) \
103 (cap_fault_reg_offset(c) + cap_num_fault_regs(c) * 16)
104
105#define cap_zlr(c) (((c) >> 22) & 1)
106#define cap_isoch(c) (((c) >> 23) & 1)
107#define cap_mgaw(c) ((((c) >> 16) & 0x3f) + 1)
108#define cap_sagaw(c) (((c) >> 8) & 0x1f)
109#define cap_caching_mode(c) (((c) >> 7) & 1)
110#define cap_phmr(c) (((c) >> 6) & 1)
111#define cap_plmr(c) (((c) >> 5) & 1)
112#define cap_rwbf(c) (((c) >> 4) & 1)
113#define cap_afl(c) (((c) >> 3) & 1)
114#define cap_ndoms(c) (((unsigned long)1) << (4 + 2 * ((c) & 0x7)))
115/*
116 * Extended Capability Register
117 */
118
119#define ecap_niotlb_iunits(e) ((((e) >> 24) & 0xff) + 1)
120#define ecap_iotlb_offset(e) ((((e) >> 8) & 0x3ff) * 16)
121#define ecap_max_iotlb_offset(e) \
122 (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16)
123#define ecap_coherent(e) ((e) & 0x1)
124#define ecap_qis(e) ((e) & 0x2)
125#define ecap_eim_support(e) ((e >> 4) & 0x1)
126#define ecap_ir_support(e) ((e >> 3) & 0x1)
127#define ecap_max_handle_mask(e) ((e >> 20) & 0xf)
128
129
130/* IOTLB_REG */
131#define DMA_TLB_FLUSH_GRANU_OFFSET 60
132#define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60)
133#define DMA_TLB_DSI_FLUSH (((u64)2) << 60)
134#define DMA_TLB_PSI_FLUSH (((u64)3) << 60)
135#define DMA_TLB_IIRG(type) ((type >> 60) & 7)
136#define DMA_TLB_IAIG(val) (((val) >> 57) & 7)
137#define DMA_TLB_READ_DRAIN (((u64)1) << 49)
138#define DMA_TLB_WRITE_DRAIN (((u64)1) << 48)
139#define DMA_TLB_DID(id) (((u64)((id) & 0xffff)) << 32)
140#define DMA_TLB_IVT (((u64)1) << 63)
141#define DMA_TLB_IH_NONLEAF (((u64)1) << 6)
142#define DMA_TLB_MAX_SIZE (0x3f)
143
144/* INVALID_DESC */
145#define DMA_CCMD_INVL_GRANU_OFFSET 61
146#define DMA_ID_TLB_GLOBAL_FLUSH (((u64)1) << 3)
147#define DMA_ID_TLB_DSI_FLUSH (((u64)2) << 3)
148#define DMA_ID_TLB_PSI_FLUSH (((u64)3) << 3)
149#define DMA_ID_TLB_READ_DRAIN (((u64)1) << 7)
150#define DMA_ID_TLB_WRITE_DRAIN (((u64)1) << 6)
151#define DMA_ID_TLB_DID(id) (((u64)((id & 0xffff) << 16)))
152#define DMA_ID_TLB_IH_NONLEAF (((u64)1) << 6)
153#define DMA_ID_TLB_ADDR(addr) (addr)
154#define DMA_ID_TLB_ADDR_MASK(mask) (mask)
155
156/* PMEN_REG */
157#define DMA_PMEN_EPM (((u32)1)<<31)
158#define DMA_PMEN_PRS (((u32)1)<<0)
159
160/* GCMD_REG */
161#define DMA_GCMD_TE (((u32)1) << 31)
162#define DMA_GCMD_SRTP (((u32)1) << 30)
163#define DMA_GCMD_SFL (((u32)1) << 29)
164#define DMA_GCMD_EAFL (((u32)1) << 28)
165#define DMA_GCMD_WBF (((u32)1) << 27)
166#define DMA_GCMD_QIE (((u32)1) << 26)
167#define DMA_GCMD_SIRTP (((u32)1) << 24)
168#define DMA_GCMD_IRE (((u32) 1) << 25)
169
170/* GSTS_REG */
171#define DMA_GSTS_TES (((u32)1) << 31)
172#define DMA_GSTS_RTPS (((u32)1) << 30)
173#define DMA_GSTS_FLS (((u32)1) << 29)
174#define DMA_GSTS_AFLS (((u32)1) << 28)
175#define DMA_GSTS_WBFS (((u32)1) << 27)
176#define DMA_GSTS_QIES (((u32)1) << 26)
177#define DMA_GSTS_IRTPS (((u32)1) << 24)
178#define DMA_GSTS_IRES (((u32)1) << 25)
179
180/* CCMD_REG */
181#define DMA_CCMD_ICC (((u64)1) << 63)
182#define DMA_CCMD_GLOBAL_INVL (((u64)1) << 61)
183#define DMA_CCMD_DOMAIN_INVL (((u64)2) << 61)
184#define DMA_CCMD_DEVICE_INVL (((u64)3) << 61)
185#define DMA_CCMD_FM(m) (((u64)((m) & 0x3)) << 32)
186#define DMA_CCMD_MASK_NOBIT 0
187#define DMA_CCMD_MASK_1BIT 1
188#define DMA_CCMD_MASK_2BIT 2
189#define DMA_CCMD_MASK_3BIT 3
190#define DMA_CCMD_SID(s) (((u64)((s) & 0xffff)) << 16)
191#define DMA_CCMD_DID(d) ((u64)((d) & 0xffff))
192
193/* FECTL_REG */
194#define DMA_FECTL_IM (((u32)1) << 31)
195
196/* FSTS_REG */
197#define DMA_FSTS_PPF ((u32)2)
198#define DMA_FSTS_PFO ((u32)1)
199#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
200
201/* FRCD_REG, 32 bits access */
202#define DMA_FRCD_F (((u32)1) << 31)
203#define dma_frcd_type(d) ((d >> 30) & 1)
204#define dma_frcd_fault_reason(c) (c & 0xff)
205#define dma_frcd_source_id(c) (c & 0xffff)
206/* low 64 bit */
207#define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT))
208
209#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \
210do { \
211 cycles_t start_time = get_cycles(); \
212 while (1) { \
213 sts = op(iommu->reg + offset); \
214 if (cond) \
215 break; \
216 if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\
217 panic("DMAR hardware is malfunctioning\n"); \
218 cpu_relax(); \
219 } \
220} while (0)
221
222#define QI_LENGTH 256 /* queue length */
223
224enum {
225 QI_FREE,
226 QI_IN_USE,
227 QI_DONE
228};
229
230#define QI_CC_TYPE 0x1
231#define QI_IOTLB_TYPE 0x2
232#define QI_DIOTLB_TYPE 0x3
233#define QI_IEC_TYPE 0x4
234#define QI_IWD_TYPE 0x5
235
236#define QI_IEC_SELECTIVE (((u64)1) << 4)
237#define QI_IEC_IIDEX(idx) (((u64)(idx & 0xffff) << 32))
238#define QI_IEC_IM(m) (((u64)(m & 0x1f) << 27))
239
240#define QI_IWD_STATUS_DATA(d) (((u64)d) << 32)
241#define QI_IWD_STATUS_WRITE (((u64)1) << 5)
242
243#define QI_IOTLB_DID(did) (((u64)did) << 16)
244#define QI_IOTLB_DR(dr) (((u64)dr) << 7)
245#define QI_IOTLB_DW(dw) (((u64)dw) << 6)
246#define QI_IOTLB_GRAN(gran) (((u64)gran) >> (DMA_TLB_FLUSH_GRANU_OFFSET-4))
247#define QI_IOTLB_ADDR(addr) (((u64)addr) & VTD_PAGE_MASK)
248#define QI_IOTLB_IH(ih) (((u64)ih) << 6)
249#define QI_IOTLB_AM(am) (((u8)am))
250
251#define QI_CC_FM(fm) (((u64)fm) << 48)
252#define QI_CC_SID(sid) (((u64)sid) << 32)
253#define QI_CC_DID(did) (((u64)did) << 16)
254#define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4))
255
256struct qi_desc {
257 u64 low, high;
258};
259
260struct q_inval {
261 spinlock_t q_lock;
262 struct qi_desc *desc; /* invalidation queue */
263 int *desc_status; /* desc status */
264 int free_head; /* first free entry */
265 int free_tail; /* last free entry */
266 int free_cnt;
267};
268
269#ifdef CONFIG_INTR_REMAP
270/* 1MB - maximum possible interrupt remapping table size */
271#define INTR_REMAP_PAGE_ORDER 8
272#define INTR_REMAP_TABLE_REG_SIZE 0xf
273
274#define INTR_REMAP_TABLE_ENTRIES 65536
275
276struct ir_table {
277 struct irte *base;
278};
279#endif
280
281struct iommu_flush {
282 int (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm,
283 u64 type, int non_present_entry_flush);
284 int (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr,
285 unsigned int size_order, u64 type, int non_present_entry_flush);
286};
287
288struct intel_iommu {
289 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
290 u64 cap;
291 u64 ecap;
292 int seg;
293 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
294 spinlock_t register_lock; /* protect register handling */
295 int seq_id; /* sequence id of the iommu */
296
297#ifdef CONFIG_DMAR
298 unsigned long *domain_ids; /* bitmap of domains */
299 struct dmar_domain **domains; /* ptr to domains */
300 spinlock_t lock; /* protect context, domain ids */
301 struct root_entry *root_entry; /* virtual address */
302
303 unsigned int irq;
304 unsigned char name[7]; /* Device Name */
305 struct msi_msg saved_msg;
306 struct sys_device sysdev;
307 struct iommu_flush flush;
308#endif
309 struct q_inval *qi; /* Queued invalidation info */
310#ifdef CONFIG_INTR_REMAP
311 struct ir_table *ir_table; /* Interrupt remapping info */
312#endif
313};
314
315static inline void __iommu_flush_cache(
316 struct intel_iommu *iommu, void *addr, int size)
317{
318 if (!ecap_coherent(iommu->ecap))
319 clflush_cache_range(addr, size);
320}
321
322extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
323
324extern int alloc_iommu(struct dmar_drhd_unit *drhd);
325extern void free_iommu(struct intel_iommu *iommu);
326extern int dmar_enable_qi(struct intel_iommu *iommu);
327extern void qi_global_iec(struct intel_iommu *iommu);
328
329extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
330 u8 fm, u64 type, int non_present_entry_flush);
331extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
332 unsigned int size_order, u64 type,
333 int non_present_entry_flush);
334
335extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
336
337void intel_iommu_domain_exit(struct dmar_domain *domain);
338struct dmar_domain *intel_iommu_domain_alloc(struct pci_dev *pdev);
339int intel_iommu_context_mapping(struct dmar_domain *domain,
340 struct pci_dev *pdev);
341int intel_iommu_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
342 u64 hpa, size_t size, int prot);
343void intel_iommu_detach_dev(struct dmar_domain *domain, u8 bus, u8 devfn);
344struct dmar_domain *intel_iommu_find_domain(struct pci_dev *pdev);
345u64 intel_iommu_iova_to_pfn(struct dmar_domain *domain, u64 iova);
346
347#ifdef CONFIG_DMAR
348int intel_iommu_found(void);
349#else /* CONFIG_DMAR */
350static inline int intel_iommu_found(void)
351{
352 return 0;
353}
354#endif /* CONFIG_DMAR */
355
356extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
357extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
358extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
359extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
360extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
361extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
362
363#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 58ff4e74b2f3..f58a0cf8929a 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -8,9 +8,12 @@
8#include <linux/preempt.h> 8#include <linux/preempt.h>
9#include <linux/cpumask.h> 9#include <linux/cpumask.h>
10#include <linux/irqreturn.h> 10#include <linux/irqreturn.h>
11#include <linux/irqnr.h>
11#include <linux/hardirq.h> 12#include <linux/hardirq.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/irqflags.h> 14#include <linux/irqflags.h>
15#include <linux/smp.h>
16#include <linux/percpu.h>
14#include <asm/atomic.h> 17#include <asm/atomic.h>
15#include <asm/ptrace.h> 18#include <asm/ptrace.h>
16#include <asm/system.h> 19#include <asm/system.h>
@@ -252,6 +255,8 @@ enum
252 HRTIMER_SOFTIRQ, 255 HRTIMER_SOFTIRQ,
253#endif 256#endif
254 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */ 257 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
258
259 NR_SOFTIRQS
255}; 260};
256 261
257/* softirq mask and active fields moved to irq_cpustat_t in 262/* softirq mask and active fields moved to irq_cpustat_t in
@@ -271,6 +276,25 @@ extern void softirq_init(void);
271extern void raise_softirq_irqoff(unsigned int nr); 276extern void raise_softirq_irqoff(unsigned int nr);
272extern void raise_softirq(unsigned int nr); 277extern void raise_softirq(unsigned int nr);
273 278
279/* This is the worklist that queues up per-cpu softirq work.
280 *
281 * send_remote_sendirq() adds work to these lists, and
282 * the softirq handler itself dequeues from them. The queues
283 * are protected by disabling local cpu interrupts and they must
284 * only be accessed by the local cpu that they are for.
285 */
286DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
287
288/* Try to send a softirq to a remote cpu. If this cannot be done, the
289 * work will be queued to the local cpu.
290 */
291extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq);
292
293/* Like send_remote_softirq(), but the caller must disable local cpu interrupts
294 * and compute the current cpu, passed in as 'this_cpu'.
295 */
296extern void __send_remote_softirq(struct call_single_data *cp, int cpu,
297 int this_cpu, int softirq);
274 298
275/* Tasklets --- multithreaded analogue of BHs. 299/* Tasklets --- multithreaded analogue of BHs.
276 300
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index c975caf75385..3b068e5b5671 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,20 @@
1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H
3
4static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset,
6 u64 dma_mask)
7{
8 if (size + offset > dma_mask)
9 return dma_mask - offset + 1;
10 else
11 return size;
12}
13
1extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, 14extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
2 unsigned long shift, 15 unsigned long shift,
3 unsigned long boundary_size); 16 unsigned long boundary_size);
17extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len);
4extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 18extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
5 unsigned long start, unsigned int nr, 19 unsigned long start, unsigned int nr,
6 unsigned long shift, 20 unsigned long shift,
@@ -8,3 +22,8 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
8 unsigned long align_mask); 22 unsigned long align_mask);
9extern void iommu_area_free(unsigned long *map, unsigned long start, 23extern void iommu_area_free(unsigned long *map, unsigned long start,
10 unsigned int nr); 24 unsigned int nr);
25
26extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len,
27 unsigned long io_page_size);
28
29#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 350033e8f4e1..041e95aac2bf 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -34,7 +34,8 @@ struct resource_list {
34 */ 34 */
35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 35#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
36 36
37#define IORESOURCE_IO 0x00000100 /* Resource type */ 37#define IORESOURCE_TYPE_BITS 0x00000f00 /* Resource type */
38#define IORESOURCE_IO 0x00000100
38#define IORESOURCE_MEM 0x00000200 39#define IORESOURCE_MEM 0x00000200
39#define IORESOURCE_IRQ 0x00000400 40#define IORESOURCE_IRQ 0x00000400
40#define IORESOURCE_DMA 0x00000800 41#define IORESOURCE_DMA 0x00000800
@@ -108,6 +109,9 @@ extern struct resource iomem_resource;
108 109
109extern int request_resource(struct resource *root, struct resource *new); 110extern int request_resource(struct resource *root, struct resource *new);
110extern int release_resource(struct resource *new); 111extern int release_resource(struct resource *new);
112extern void reserve_region_with_split(struct resource *root,
113 resource_size_t start, resource_size_t end,
114 const char *name);
111extern int insert_resource(struct resource *parent, struct resource *new); 115extern int insert_resource(struct resource *parent, struct resource *new);
112extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 116extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
113extern int allocate_resource(struct resource *root, struct resource *new, 117extern int allocate_resource(struct resource *root, struct resource *new,
@@ -123,6 +127,10 @@ static inline resource_size_t resource_size(struct resource *res)
123{ 127{
124 return res->end - res->start + 1; 128 return res->end - res->start + 1;
125} 129}
130static inline unsigned long resource_type(struct resource *res)
131{
132 return res->flags & IORESOURCE_TYPE_BITS;
133}
126 134
127/* Convenience shorthand with allocation */ 135/* Convenience shorthand with allocation */
128#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 136#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
@@ -166,6 +174,7 @@ extern struct resource * __devm_request_region(struct device *dev,
166 174
167extern void __devm_release_region(struct device *dev, struct resource *parent, 175extern void __devm_release_region(struct device *dev, struct resource *parent,
168 resource_size_t start, resource_size_t n); 176 resource_size_t start, resource_size_t n);
177extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
169 178
170#endif /* __ASSEMBLY__ */ 179#endif /* __ASSEMBLY__ */
171#endif /* _LINUX_IOPORT_H */ 180#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/iova.h b/include/linux/iova.h
new file mode 100644
index 000000000000..228f6c94b69c
--- /dev/null
+++ b/include/linux/iova.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (c) 2006, Intel Corporation.
3 *
4 * This file is released under the GPLv2.
5 *
6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
8 *
9 */
10
11#ifndef _IOVA_H_
12#define _IOVA_H_
13
14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/rbtree.h>
17#include <linux/dma-mapping.h>
18
19/* IO virtual address start page frame number */
20#define IOVA_START_PFN (1)
21
22/* iova structure */
23struct iova {
24 struct rb_node node;
25 unsigned long pfn_hi; /* IOMMU dish out addr hi */
26 unsigned long pfn_lo; /* IOMMU dish out addr lo */
27};
28
29/* holds all the iova translations for a domain */
30struct iova_domain {
31 spinlock_t iova_alloc_lock;/* Lock to protect iova allocation */
32 spinlock_t iova_rbtree_lock; /* Lock to protect update of rbtree */
33 struct rb_root rbroot; /* iova domain rbtree root */
34 struct rb_node *cached32_node; /* Save last alloced node */
35 unsigned long dma_32bit_pfn;
36};
37
38struct iova *alloc_iova_mem(void);
39void free_iova_mem(struct iova *iova);
40void free_iova(struct iova_domain *iovad, unsigned long pfn);
41void __free_iova(struct iova_domain *iovad, struct iova *iova);
42struct iova *alloc_iova(struct iova_domain *iovad, unsigned long size,
43 unsigned long limit_pfn,
44 bool size_aligned);
45struct iova *reserve_iova(struct iova_domain *iovad, unsigned long pfn_lo,
46 unsigned long pfn_hi);
47void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);
48void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit);
49struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
50void put_iova_domain(struct iova_domain *iovad);
51
52#endif
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index ec6eb49af2d8..0f434a28fb58 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -242,4 +242,164 @@ struct ip_vs_daemon_user {
242 int syncid; 242 int syncid;
243}; 243};
244 244
245/*
246 *
247 * IPVS Generic Netlink interface definitions
248 *
249 */
250
251/* Generic Netlink family info */
252
253#define IPVS_GENL_NAME "IPVS"
254#define IPVS_GENL_VERSION 0x1
255
256struct ip_vs_flags {
257 __be32 flags;
258 __be32 mask;
259};
260
261/* Generic Netlink command attributes */
262enum {
263 IPVS_CMD_UNSPEC = 0,
264
265 IPVS_CMD_NEW_SERVICE, /* add service */
266 IPVS_CMD_SET_SERVICE, /* modify service */
267 IPVS_CMD_DEL_SERVICE, /* delete service */
268 IPVS_CMD_GET_SERVICE, /* get service info */
269
270 IPVS_CMD_NEW_DEST, /* add destination */
271 IPVS_CMD_SET_DEST, /* modify destination */
272 IPVS_CMD_DEL_DEST, /* delete destination */
273 IPVS_CMD_GET_DEST, /* get destination info */
274
275 IPVS_CMD_NEW_DAEMON, /* start sync daemon */
276 IPVS_CMD_DEL_DAEMON, /* stop sync daemon */
277 IPVS_CMD_GET_DAEMON, /* get sync daemon status */
278
279 IPVS_CMD_SET_CONFIG, /* set config settings */
280 IPVS_CMD_GET_CONFIG, /* get config settings */
281
282 IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */
283 IPVS_CMD_GET_INFO, /* get general IPVS info */
284
285 IPVS_CMD_ZERO, /* zero all counters and stats */
286 IPVS_CMD_FLUSH, /* flush services and dests */
287
288 __IPVS_CMD_MAX,
289};
290
291#define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1)
292
293/* Attributes used in the first level of commands */
294enum {
295 IPVS_CMD_ATTR_UNSPEC = 0,
296 IPVS_CMD_ATTR_SERVICE, /* nested service attribute */
297 IPVS_CMD_ATTR_DEST, /* nested destination attribute */
298 IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */
299 IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */
300 IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */
301 IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */
302 __IPVS_CMD_ATTR_MAX,
303};
304
305#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
306
307/*
308 * Attributes used to describe a service
309 *
310 * Used inside nested attribute IPVS_CMD_ATTR_SERVICE
311 */
312enum {
313 IPVS_SVC_ATTR_UNSPEC = 0,
314 IPVS_SVC_ATTR_AF, /* address family */
315 IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */
316 IPVS_SVC_ATTR_ADDR, /* virtual service address */
317 IPVS_SVC_ATTR_PORT, /* virtual service port */
318 IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */
319
320 IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */
321 IPVS_SVC_ATTR_FLAGS, /* virtual service flags */
322 IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */
323 IPVS_SVC_ATTR_NETMASK, /* persistent netmask */
324
325 IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */
326 __IPVS_SVC_ATTR_MAX,
327};
328
329#define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
330
331/*
332 * Attributes used to describe a destination (real server)
333 *
334 * Used inside nested attribute IPVS_CMD_ATTR_DEST
335 */
336enum {
337 IPVS_DEST_ATTR_UNSPEC = 0,
338 IPVS_DEST_ATTR_ADDR, /* real server address */
339 IPVS_DEST_ATTR_PORT, /* real server port */
340
341 IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */
342 IPVS_DEST_ATTR_WEIGHT, /* destination weight */
343
344 IPVS_DEST_ATTR_U_THRESH, /* upper threshold */
345 IPVS_DEST_ATTR_L_THRESH, /* lower threshold */
346
347 IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */
348 IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */
349 IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */
350
351 IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */
352 __IPVS_DEST_ATTR_MAX,
353};
354
355#define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
356
357/*
358 * Attributes describing a sync daemon
359 *
360 * Used inside nested attribute IPVS_CMD_ATTR_DAEMON
361 */
362enum {
363 IPVS_DAEMON_ATTR_UNSPEC = 0,
364 IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */
365 IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */
366 IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */
367 __IPVS_DAEMON_ATTR_MAX,
368};
369
370#define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1)
371
372/*
373 * Attributes used to describe service or destination entry statistics
374 *
375 * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS
376 */
377enum {
378 IPVS_STATS_ATTR_UNSPEC = 0,
379 IPVS_STATS_ATTR_CONNS, /* connections scheduled */
380 IPVS_STATS_ATTR_INPKTS, /* incoming packets */
381 IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */
382 IPVS_STATS_ATTR_INBYTES, /* incoming bytes */
383 IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */
384
385 IPVS_STATS_ATTR_CPS, /* current connection rate */
386 IPVS_STATS_ATTR_INPPS, /* current in packet rate */
387 IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */
388 IPVS_STATS_ATTR_INBPS, /* current in byte rate */
389 IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */
390 __IPVS_STATS_ATTR_MAX,
391};
392
393#define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1)
394
395/* Attributes used in response to IPVS_CMD_GET_INFO command */
396enum {
397 IPVS_INFO_ATTR_UNSPEC = 0,
398 IPVS_INFO_ATTR_VERSION, /* IPVS version number */
399 IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */
400 __IPVS_INFO_ATTR_MAX,
401};
402
403#define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1)
404
245#endif /* _IP_VS_H */ 405#endif /* _IP_VS_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 8ccb462ea42c..d058c57be02d 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/irqnr.h>
21#include <linux/errno.h> 22#include <linux/errno.h>
22 23
23#include <asm/irq.h> 24#include <asm/irq.h>
@@ -62,6 +63,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 63#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 64#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
64#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 65#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
66#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
65 67
66#ifdef CONFIG_IRQ_PER_CPU 68#ifdef CONFIG_IRQ_PER_CPU
67# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 69# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
@@ -151,6 +153,7 @@ struct irq_chip {
151 * @name: flow handler name for /proc/interrupts output 153 * @name: flow handler name for /proc/interrupts output
152 */ 154 */
153struct irq_desc { 155struct irq_desc {
156 unsigned int irq;
154 irq_flow_handler_t handle_irq; 157 irq_flow_handler_t handle_irq;
155 struct irq_chip *chip; 158 struct irq_chip *chip;
156 struct msi_desc *msi_desc; 159 struct msi_desc *msi_desc;
@@ -169,7 +172,7 @@ struct irq_desc {
169 cpumask_t affinity; 172 cpumask_t affinity;
170 unsigned int cpu; 173 unsigned int cpu;
171#endif 174#endif
172#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 175#ifdef CONFIG_GENERIC_PENDING_IRQ
173 cpumask_t pending_mask; 176 cpumask_t pending_mask;
174#endif 177#endif
175#ifdef CONFIG_PROC_FS 178#ifdef CONFIG_PROC_FS
@@ -178,8 +181,14 @@ struct irq_desc {
178 const char *name; 181 const char *name;
179} ____cacheline_internodealigned_in_smp; 182} ____cacheline_internodealigned_in_smp;
180 183
184
181extern struct irq_desc irq_desc[NR_IRQS]; 185extern struct irq_desc irq_desc[NR_IRQS];
182 186
187static inline struct irq_desc *irq_to_desc(unsigned int irq)
188{
189 return (irq < nr_irqs) ? irq_desc + irq : NULL;
190}
191
183/* 192/*
184 * Migration helpers for obsolete names, they will go away: 193 * Migration helpers for obsolete names, they will go away:
185 */ 194 */
@@ -197,19 +206,15 @@ extern int setup_irq(unsigned int irq, struct irqaction *new);
197 206
198#ifdef CONFIG_GENERIC_HARDIRQS 207#ifdef CONFIG_GENERIC_HARDIRQS
199 208
200#ifndef handle_dynamic_tick
201# define handle_dynamic_tick(a) do { } while (0)
202#endif
203
204#ifdef CONFIG_SMP 209#ifdef CONFIG_SMP
205 210
206#if defined(CONFIG_GENERIC_PENDING_IRQ) || defined(CONFIG_IRQBALANCE) 211#ifdef CONFIG_GENERIC_PENDING_IRQ
207 212
208void set_pending_irq(unsigned int irq, cpumask_t mask); 213void set_pending_irq(unsigned int irq, cpumask_t mask);
209void move_native_irq(int irq); 214void move_native_irq(int irq);
210void move_masked_irq(int irq); 215void move_masked_irq(int irq);
211 216
212#else /* CONFIG_GENERIC_PENDING_IRQ || CONFIG_IRQBALANCE */ 217#else /* CONFIG_GENERIC_PENDING_IRQ */
213 218
214static inline void move_irq(int irq) 219static inline void move_irq(int irq)
215{ 220{
@@ -236,19 +241,14 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
236 241
237#endif /* CONFIG_SMP */ 242#endif /* CONFIG_SMP */
238 243
239#ifdef CONFIG_IRQBALANCE
240extern void set_balance_irq_affinity(unsigned int irq, cpumask_t mask);
241#else
242static inline void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
243{
244}
245#endif
246
247extern int no_irq_affinity; 244extern int no_irq_affinity;
248 245
249static inline int irq_balancing_disabled(unsigned int irq) 246static inline int irq_balancing_disabled(unsigned int irq)
250{ 247{
251 return irq_desc[irq].status & IRQ_NO_BALANCING_MASK; 248 struct irq_desc *desc;
249
250 desc = irq_to_desc(irq);
251 return desc->status & IRQ_NO_BALANCING_MASK;
252} 252}
253 253
254/* Handle irq action chains: */ 254/* Handle irq action chains: */
@@ -278,10 +278,8 @@ extern unsigned int __do_IRQ(unsigned int irq);
278 * irqchip-style controller then we call the ->handle_irq() handler, 278 * irqchip-style controller then we call the ->handle_irq() handler,
279 * and it calls __do_IRQ() if it's attached to an irqtype-style controller. 279 * and it calls __do_IRQ() if it's attached to an irqtype-style controller.
280 */ 280 */
281static inline void generic_handle_irq(unsigned int irq) 281static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
282{ 282{
283 struct irq_desc *desc = irq_desc + irq;
284
285#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ 283#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
286 desc->handle_irq(irq, desc); 284 desc->handle_irq(irq, desc);
287#else 285#else
@@ -292,6 +290,11 @@ static inline void generic_handle_irq(unsigned int irq)
292#endif 290#endif
293} 291}
294 292
293static inline void generic_handle_irq(unsigned int irq)
294{
295 generic_handle_irq_desc(irq, irq_to_desc(irq));
296}
297
295/* Handling of unhandled and spurious interrupts: */ 298/* Handling of unhandled and spurious interrupts: */
296extern void note_interrupt(unsigned int irq, struct irq_desc *desc, 299extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
297 int action_ret); 300 int action_ret);
@@ -324,7 +327,10 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
324static inline void __set_irq_handler_unlocked(int irq, 327static inline void __set_irq_handler_unlocked(int irq,
325 irq_flow_handler_t handler) 328 irq_flow_handler_t handler)
326{ 329{
327 irq_desc[irq].handle_irq = handler; 330 struct irq_desc *desc;
331
332 desc = irq_to_desc(irq);
333 desc->handle_irq = handler;
328} 334}
329 335
330/* 336/*
@@ -352,13 +358,14 @@ extern void set_irq_noprobe(unsigned int irq);
352extern void set_irq_probe(unsigned int irq); 358extern void set_irq_probe(unsigned int irq);
353 359
354/* Handle dynamic irq creation and destruction */ 360/* Handle dynamic irq creation and destruction */
361extern unsigned int create_irq_nr(unsigned int irq_want);
355extern int create_irq(void); 362extern int create_irq(void);
356extern void destroy_irq(unsigned int irq); 363extern void destroy_irq(unsigned int irq);
357 364
358/* Test to see if a driver has successfully requested an irq */ 365/* Test to see if a driver has successfully requested an irq */
359static inline int irq_has_action(unsigned int irq) 366static inline int irq_has_action(unsigned int irq)
360{ 367{
361 struct irq_desc *desc = irq_desc + irq; 368 struct irq_desc *desc = irq_to_desc(irq);
362 return desc->action != NULL; 369 return desc->action != NULL;
363} 370}
364 371
@@ -373,10 +380,10 @@ extern int set_irq_chip_data(unsigned int irq, void *data);
373extern int set_irq_type(unsigned int irq, unsigned int type); 380extern int set_irq_type(unsigned int irq, unsigned int type);
374extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); 381extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
375 382
376#define get_irq_chip(irq) (irq_desc[irq].chip) 383#define get_irq_chip(irq) (irq_to_desc(irq)->chip)
377#define get_irq_chip_data(irq) (irq_desc[irq].chip_data) 384#define get_irq_chip_data(irq) (irq_to_desc(irq)->chip_data)
378#define get_irq_data(irq) (irq_desc[irq].handler_data) 385#define get_irq_data(irq) (irq_to_desc(irq)->handler_data)
379#define get_irq_msi(irq) (irq_desc[irq].msi_desc) 386#define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc)
380 387
381#endif /* CONFIG_GENERIC_HARDIRQS */ 388#endif /* CONFIG_GENERIC_HARDIRQS */
382 389
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
new file mode 100644
index 000000000000..452c280c8115
--- /dev/null
+++ b/include/linux/irqnr.h
@@ -0,0 +1,24 @@
1#ifndef _LINUX_IRQNR_H
2#define _LINUX_IRQNR_H
3
4#ifndef CONFIG_GENERIC_HARDIRQS
5#include <asm/irq.h>
6# define nr_irqs NR_IRQS
7
8# define for_each_irq_desc(irq, desc) \
9 for (irq = 0; irq < nr_irqs; irq++)
10#else
11extern int nr_irqs;
12
13# define for_each_irq_desc(irq, desc) \
14 for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++)
15
16# define for_each_irq_desc_reverse(irq, desc) \
17 for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \
18 irq >= 0; irq--, desc--)
19#endif
20
21#define for_each_irq_nr(irq) \
22 for (irq = 0; irq < nr_irqs; irq++)
23
24#endif
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 8687a7dc0632..4c218ee7587a 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -157,7 +157,7 @@ typedef struct {
157 157
158typedef struct { 158typedef struct {
159 int mp_mrru; /* unused */ 159 int mp_mrru; /* unused */
160 struct sk_buff * frags; /* fragments sl list -- use skb->next */ 160 struct sk_buff_head frags; /* fragments sl list */
161 long frames; /* number of frames in the frame list */ 161 long frames; /* number of frames in the frame list */
162 unsigned int seq; /* last processed packet seq #: any packets 162 unsigned int seq; /* last processed packet seq #: any packets
163 * with smaller seq # will be dropped 163 * with smaller seq # will be dropped
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 17ca64b5a66c..f2720280b9ec 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/videodev2.h>
26 27
27/* ivtv knows several distinct output modes: MPEG streaming, 28/* ivtv knows several distinct output modes: MPEG streaming,
28 YUV streaming, YUV updates through user DMA and the passthrough 29 YUV streaming, YUV updates through user DMA and the passthrough
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 07a9b52a2654..346e2b80be7d 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -61,7 +61,7 @@ extern u8 journal_enable_debug;
61 do { \ 61 do { \
62 if ((n) <= journal_enable_debug) { \ 62 if ((n) <= journal_enable_debug) { \
63 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63 printk (KERN_DEBUG "(%s, %d): %s: ", \
64 __FILE__, __LINE__, __FUNCTION__); \ 64 __FILE__, __LINE__, __func__); \
65 printk (f, ## a); \ 65 printk (f, ## a); \
66 } \ 66 } \
67 } while (0) 67 } while (0)
@@ -816,6 +816,9 @@ struct journal_s
816#define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ 816#define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */
817#define JFS_LOADED 0x010 /* The journal superblock has been loaded */ 817#define JFS_LOADED 0x010 /* The journal superblock has been loaded */
818#define JFS_BARRIER 0x020 /* Use IDE barriers */ 818#define JFS_BARRIER 0x020 /* Use IDE barriers */
819#define JFS_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file
820 * data write error in ordered
821 * mode */
819 822
820/* 823/*
821 * Function declarations for the journaling transaction and buffer 824 * Function declarations for the journaling transaction and buffer
@@ -908,7 +911,7 @@ extern int journal_set_features
908 (journal_t *, unsigned long, unsigned long, unsigned long); 911 (journal_t *, unsigned long, unsigned long, unsigned long);
909extern int journal_create (journal_t *); 912extern int journal_create (journal_t *);
910extern int journal_load (journal_t *journal); 913extern int journal_load (journal_t *journal);
911extern void journal_destroy (journal_t *); 914extern int journal_destroy (journal_t *);
912extern int journal_recover (journal_t *journal); 915extern int journal_recover (journal_t *journal);
913extern int journal_wipe (journal_t *, int); 916extern int journal_wipe (journal_t *, int);
914extern int journal_skip_recovery (journal_t *); 917extern int journal_skip_recovery (journal_t *);
@@ -984,7 +987,7 @@ extern int cleanup_journal_tail(journal_t *);
984 987
985#define jbd_ENOSYS() \ 988#define jbd_ENOSYS() \
986do { \ 989do { \
987 printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ 990 printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
988 current->state = TASK_UNINTERRUPTIBLE; \ 991 current->state = TASK_UNINTERRUPTIBLE; \
989 schedule(); \ 992 schedule(); \
990} while (1) 993} while (1)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 3dd209007098..c7d106ef22e2 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -61,7 +61,7 @@ extern u8 jbd2_journal_enable_debug;
61 do { \ 61 do { \
62 if ((n) <= jbd2_journal_enable_debug) { \ 62 if ((n) <= jbd2_journal_enable_debug) { \
63 printk (KERN_DEBUG "(%s, %d): %s: ", \ 63 printk (KERN_DEBUG "(%s, %d): %s: ", \
64 __FILE__, __LINE__, __FUNCTION__); \ 64 __FILE__, __LINE__, __func__); \
65 printk (f, ## a); \ 65 printk (f, ## a); \
66 } \ 66 } \
67 } while (0) 67 } while (0)
@@ -641,6 +641,11 @@ struct transaction_s
641 */ 641 */
642 int t_handle_count; 642 int t_handle_count;
643 643
644 /*
645 * For use by the filesystem to store fs-specific data
646 * structures associated with the transaction
647 */
648 struct list_head t_private_list;
644}; 649};
645 650
646struct transaction_run_stats_s { 651struct transaction_run_stats_s {
@@ -850,7 +855,8 @@ struct journal_s
850 */ 855 */
851 struct block_device *j_dev; 856 struct block_device *j_dev;
852 int j_blocksize; 857 int j_blocksize;
853 unsigned long long j_blk_offset; 858 unsigned long long j_blk_offset;
859 char j_devname[BDEVNAME_SIZE+24];
854 860
855 /* 861 /*
856 * Device which holds the client fs. For internal journal this will be 862 * Device which holds the client fs. For internal journal this will be
@@ -934,6 +940,10 @@ struct journal_s
934 940
935 pid_t j_last_sync_writer; 941 pid_t j_last_sync_writer;
936 942
943 /* This function is called when a transaction is closed */
944 void (*j_commit_callback)(journal_t *,
945 transaction_t *);
946
937 /* 947 /*
938 * Journal statistics 948 * Journal statistics
939 */ 949 */
@@ -966,6 +976,9 @@ struct journal_s
966#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ 976#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */
967#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ 977#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */
968#define JBD2_BARRIER 0x020 /* Use IDE barriers */ 978#define JBD2_BARRIER 0x020 /* Use IDE barriers */
979#define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file
980 * data write error in ordered
981 * mode */
969 982
970/* 983/*
971 * Function declarations for the journaling transaction and buffer 984 * Function declarations for the journaling transaction and buffer
@@ -1059,7 +1072,7 @@ extern void jbd2_journal_clear_features
1059 (journal_t *, unsigned long, unsigned long, unsigned long); 1072 (journal_t *, unsigned long, unsigned long, unsigned long);
1060extern int jbd2_journal_create (journal_t *); 1073extern int jbd2_journal_create (journal_t *);
1061extern int jbd2_journal_load (journal_t *journal); 1074extern int jbd2_journal_load (journal_t *journal);
1062extern void jbd2_journal_destroy (journal_t *); 1075extern int jbd2_journal_destroy (journal_t *);
1063extern int jbd2_journal_recover (journal_t *journal); 1076extern int jbd2_journal_recover (journal_t *journal);
1064extern int jbd2_journal_wipe (journal_t *, int); 1077extern int jbd2_journal_wipe (journal_t *, int);
1065extern int jbd2_journal_skip_recovery (journal_t *); 1078extern int jbd2_journal_skip_recovery (journal_t *);
@@ -1139,7 +1152,7 @@ extern int jbd2_cleanup_journal_tail(journal_t *);
1139 1152
1140#define jbd_ENOSYS() \ 1153#define jbd_ENOSYS() \
1141do { \ 1154do { \
1142 printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \ 1155 printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
1143 current->state = TASK_UNINTERRUPTIBLE; \ 1156 current->state = TASK_UNINTERRUPTIBLE; \
1144 schedule(); \ 1157 schedule(); \
1145} while (1) 1158} while (1)
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 8a62d1e84b9b..bb70ebb6a2d5 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * buffer_head fields for JBD 4 * buffer_head fields for JBD
5 * 5 *
6 * 27 May 2001 Andrew Morton <akpm@digeo.com> 6 * 27 May 2001 Andrew Morton
7 * Created - pulled out of fs.h 7 * Created - pulled out of fs.h
8 */ 8 */
9 9
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index b96144887444..f3fe34391d8e 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -93,12 +93,10 @@ static inline void print_symbol(const char *fmt, unsigned long addr)
93} 93}
94 94
95/* 95/*
96 * Pretty-print a function pointer. 96 * Pretty-print a function pointer. This function is deprecated.
97 * 97 * Please use the "%pF" vsprintf format instead.
98 * ia64 and ppc64 function pointers are really function descriptors,
99 * which contain a pointer the real address.
100 */ 98 */
101static inline void print_fn_descriptor_symbol(const char *fmt, void *addr) 99static inline void __deprecated print_fn_descriptor_symbol(const char *fmt, void *addr)
102{ 100{
103#if defined(CONFIG_IA64) || defined(CONFIG_PPC64) 101#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
104 addr = *(void **)addr; 102 addr = *(void **)addr;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2651f805ba6d..396a350b87a6 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -16,6 +16,7 @@
16#include <linux/log2.h> 16#include <linux/log2.h>
17#include <linux/typecheck.h> 17#include <linux/typecheck.h>
18#include <linux/ratelimit.h> 18#include <linux/ratelimit.h>
19#include <linux/dynamic_printk.h>
19#include <asm/byteorder.h> 20#include <asm/byteorder.h>
20#include <asm/bug.h> 21#include <asm/bug.h>
21 22
@@ -182,7 +183,7 @@ extern int vsscanf(const char *, const char *, va_list)
182 183
183extern int get_option(char **str, int *pint); 184extern int get_option(char **str, int *pint);
184extern char *get_options(const char *str, int nints, int *ints); 185extern char *get_options(const char *str, int nints, int *ints);
185extern unsigned long long memparse(char *ptr, char **retptr); 186extern unsigned long long memparse(const char *ptr, char **retptr);
186 187
187extern int core_kernel_text(unsigned long addr); 188extern int core_kernel_text(unsigned long addr);
188extern int __kernel_text_address(unsigned long addr); 189extern int __kernel_text_address(unsigned long addr);
@@ -190,6 +191,30 @@ extern int kernel_text_address(unsigned long addr);
190struct pid; 191struct pid;
191extern struct pid *session_of_pgrp(struct pid *pgrp); 192extern struct pid *session_of_pgrp(struct pid *pgrp);
192 193
194/*
195 * FW_BUG
196 * Add this to a message where you are sure the firmware is buggy or behaves
197 * really stupid or out of spec. Be aware that the responsible BIOS developer
198 * should be able to fix this issue or at least get a concrete idea of the
199 * problem by reading your message without the need of looking at the kernel
200 * code.
201 *
202 * Use it for definite and high priority BIOS bugs.
203 *
204 * FW_WARN
205 * Use it for not that clear (e.g. could the kernel messed up things already?)
206 * and medium priority BIOS bugs.
207 *
208 * FW_INFO
209 * Use this one if you want to tell the user or vendor about something
210 * suspicious, but generally harmless related to the firmware.
211 *
212 * Use it for information or very low priority BIOS bugs.
213 */
214#define FW_BUG "[Firmware Bug]: "
215#define FW_WARN "[Firmware Warn]: "
216#define FW_INFO "[Firmware Info]: "
217
193#ifdef CONFIG_PRINTK 218#ifdef CONFIG_PRINTK
194asmlinkage int vprintk(const char *fmt, va_list args) 219asmlinkage int vprintk(const char *fmt, va_list args)
195 __attribute__ ((format (printf, 1, 0))); 220 __attribute__ ((format (printf, 1, 0)));
@@ -213,6 +238,9 @@ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
213 { return false; } 238 { return false; }
214#endif 239#endif
215 240
241extern int printk_needs_cpu(int cpu);
242extern void printk_tick(void);
243
216extern void asmlinkage __attribute__((format(printf, 1, 2))) 244extern void asmlinkage __attribute__((format(printf, 1, 2)))
217 early_printk(const char *fmt, ...); 245 early_printk(const char *fmt, ...);
218 246
@@ -235,9 +263,10 @@ extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in
235extern int panic_timeout; 263extern int panic_timeout;
236extern int panic_on_oops; 264extern int panic_on_oops;
237extern int panic_on_unrecovered_nmi; 265extern int panic_on_unrecovered_nmi;
238extern int tainted;
239extern const char *print_tainted(void); 266extern const char *print_tainted(void);
240extern void add_taint(unsigned); 267extern void add_taint(unsigned flag);
268extern int test_taint(unsigned flag);
269extern unsigned long get_taint(void);
241extern int root_mountflags; 270extern int root_mountflags;
242 271
243/* Values used for system_state */ 272/* Values used for system_state */
@@ -250,16 +279,17 @@ extern enum system_states {
250 SYSTEM_SUSPEND_DISK, 279 SYSTEM_SUSPEND_DISK,
251} system_state; 280} system_state;
252 281
253#define TAINT_PROPRIETARY_MODULE (1<<0) 282#define TAINT_PROPRIETARY_MODULE 0
254#define TAINT_FORCED_MODULE (1<<1) 283#define TAINT_FORCED_MODULE 1
255#define TAINT_UNSAFE_SMP (1<<2) 284#define TAINT_UNSAFE_SMP 2
256#define TAINT_FORCED_RMMOD (1<<3) 285#define TAINT_FORCED_RMMOD 3
257#define TAINT_MACHINE_CHECK (1<<4) 286#define TAINT_MACHINE_CHECK 4
258#define TAINT_BAD_PAGE (1<<5) 287#define TAINT_BAD_PAGE 5
259#define TAINT_USER (1<<6) 288#define TAINT_USER 6
260#define TAINT_DIE (1<<7) 289#define TAINT_DIE 7
261#define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) 290#define TAINT_OVERRIDDEN_ACPI_TABLE 8
262#define TAINT_WARN (1<<9) 291#define TAINT_WARN 9
292#define TAINT_CRAP 10
263 293
264extern void dump_stack(void) __cold; 294extern void dump_stack(void) __cold;
265 295
@@ -303,8 +333,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
303#define pr_info(fmt, arg...) \ 333#define pr_info(fmt, arg...) \
304 printk(KERN_INFO fmt, ##arg) 334 printk(KERN_INFO fmt, ##arg)
305 335
306#ifdef DEBUG
307/* If you are writing a driver, please use dev_dbg instead */ 336/* If you are writing a driver, please use dev_dbg instead */
337#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
338#define pr_debug(fmt, ...) do { \
339 dynamic_pr_debug(fmt, ##__VA_ARGS__); \
340 } while (0)
341#elif defined(DEBUG)
308#define pr_debug(fmt, arg...) \ 342#define pr_debug(fmt, arg...) \
309 printk(KERN_DEBUG fmt, ##arg) 343 printk(KERN_DEBUG fmt, ##arg)
310#else 344#else
@@ -486,4 +520,9 @@ struct sysinfo {
486#define NUMA_BUILD 0 520#define NUMA_BUILD 0
487#endif 521#endif
488 522
523/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
524#ifdef CONFIG_FTRACE_MCOUNT_RECORD
525# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
526#endif
527
489#endif 528#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index cf9f40a91c9c..4a145caeee07 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -39,19 +39,34 @@ DECLARE_PER_CPU(struct kernel_stat, kstat);
39 39
40extern unsigned long long nr_context_switches(void); 40extern unsigned long long nr_context_switches(void);
41 41
42struct irq_desc;
43
44static inline void kstat_incr_irqs_this_cpu(unsigned int irq,
45 struct irq_desc *desc)
46{
47 kstat_this_cpu.irqs[irq]++;
48}
49
50static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
51{
52 return kstat_cpu(cpu).irqs[irq];
53}
54
42/* 55/*
43 * Number of interrupts per specific IRQ source, since bootup 56 * Number of interrupts per specific IRQ source, since bootup
44 */ 57 */
45static inline int kstat_irqs(int irq) 58static inline unsigned int kstat_irqs(unsigned int irq)
46{ 59{
47 int cpu, sum = 0; 60 unsigned int sum = 0;
61 int cpu;
48 62
49 for_each_possible_cpu(cpu) 63 for_each_possible_cpu(cpu)
50 sum += kstat_cpu(cpu).irqs[irq]; 64 sum += kstat_irqs_cpu(irq, cpu);
51 65
52 return sum; 66 return sum;
53} 67}
54 68
69extern unsigned long long task_delta_exec(struct task_struct *);
55extern void account_user_time(struct task_struct *, cputime_t); 70extern void account_user_time(struct task_struct *, cputime_t);
56extern void account_user_time_scaled(struct task_struct *, cputime_t); 71extern void account_user_time_scaled(struct task_struct *, cputime_t);
57extern void account_system_time(struct task_struct *, int, cputime_t); 72extern void account_system_time(struct task_struct *, int, cputime_t);
diff --git a/include/linux/key.h b/include/linux/key.h
index c45c962d1cc5..1b70e35a71e3 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -299,6 +299,7 @@ extern void key_init(void);
299#define key_validate(k) 0 299#define key_validate(k) 0
300#define key_serial(k) 0 300#define key_serial(k) 0
301#define key_get(k) ({ NULL; }) 301#define key_get(k) ({ NULL; })
302#define key_revoke(k) do { } while(0)
302#define key_put(k) do { } while(0) 303#define key_put(k) do { } while(0)
303#define key_ref_put(k) do { } while(0) 304#define key_ref_put(k) do { } while(0)
304#define make_key_ref(k, p) ({ NULL; }) 305#define make_key_ref(k, p) ({ NULL; })
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 06c338ef7f1b..8ea98db223e5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -38,7 +38,7 @@ extern void klist_init(struct klist *k, void (*get)(struct klist_node *),
38 void (*put)(struct klist_node *)); 38 void (*put)(struct klist_node *));
39 39
40struct klist_node { 40struct klist_node {
41 struct klist *n_klist; 41 void *n_klist; /* never access directly */
42 struct list_head n_node; 42 struct list_head n_node;
43 struct kref n_ref; 43 struct kref n_ref;
44 struct completion n_removed; 44 struct completion n_removed;
@@ -57,7 +57,6 @@ extern int klist_node_attached(struct klist_node *n);
57 57
58struct klist_iter { 58struct klist_iter {
59 struct klist *i_klist; 59 struct klist *i_klist;
60 struct list_head *i_head;
61 struct klist_node *i_cur; 60 struct klist_node *i_cur;
62}; 61};
63 62
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index a1a91577813c..92213a9194e1 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -99,4 +99,7 @@ struct file;
99extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[], 99extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
100 struct file **filp); 100 struct file **filp);
101 101
102extern int usermodehelper_disable(void);
103extern void usermodehelper_enable(void);
104
102#endif /* __LINUX_KMOD_H__ */ 105#endif /* __LINUX_KMOD_H__ */
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 0be7795655fa..497b1d1f7a05 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -29,6 +29,7 @@
29 * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi 29 * <jkenisto@us.ibm.com> and Prasanna S Panchamukhi
30 * <prasanna@in.ibm.com> added function-return probes. 30 * <prasanna@in.ibm.com> added function-return probes.
31 */ 31 */
32#include <linux/linkage.h>
32#include <linux/list.h> 33#include <linux/list.h>
33#include <linux/notifier.h> 34#include <linux/notifier.h>
34#include <linux/smp.h> 35#include <linux/smp.h>
@@ -47,7 +48,7 @@
47#define KPROBE_HIT_SSDONE 0x00000008 48#define KPROBE_HIT_SSDONE 0x00000008
48 49
49/* Attach to insert probes on any functions which should be ignored*/ 50/* Attach to insert probes on any functions which should be ignored*/
50#define __kprobes __attribute__((__section__(".kprobes.text"))) 51#define __kprobes __attribute__((__section__(".kprobes.text"))) notrace
51 52
52struct kprobe; 53struct kprobe;
53struct pt_regs; 54struct pt_regs;
@@ -256,7 +257,7 @@ void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
256 257
257#else /* CONFIG_KPROBES */ 258#else /* CONFIG_KPROBES */
258 259
259#define __kprobes /**/ 260#define __kprobes notrace
260struct jprobe; 261struct jprobe;
261struct kretprobe; 262struct kretprobe;
262 263
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 70a30651cd12..797fcd781242 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -311,22 +311,33 @@ struct kvm_s390_interrupt {
311 311
312/* This structure represents a single trace buffer record. */ 312/* This structure represents a single trace buffer record. */
313struct kvm_trace_rec { 313struct kvm_trace_rec {
314 __u32 event:28; 314 /* variable rec_val
315 __u32 extra_u32:3; 315 * is split into:
316 __u32 cycle_in:1; 316 * bits 0 - 27 -> event id
317 * bits 28 -30 -> number of extra data args of size u32
318 * bits 31 -> binary indicator for if tsc is in record
319 */
320 __u32 rec_val;
317 __u32 pid; 321 __u32 pid;
318 __u32 vcpu_id; 322 __u32 vcpu_id;
319 union { 323 union {
320 struct { 324 struct {
321 __u64 cycle_u64; 325 __u64 timestamp;
322 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 326 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
323 } __attribute__((packed)) cycle; 327 } __attribute__((packed)) timestamp;
324 struct { 328 struct {
325 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 329 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
326 } nocycle; 330 } notimestamp;
327 } u; 331 } u;
328}; 332};
329 333
334#define TRACE_REC_EVENT_ID(val) \
335 (0x0fffffff & (val))
336#define TRACE_REC_NUM_DATA_ARGS(val) \
337 (0x70000000 & ((val) << 28))
338#define TRACE_REC_TCS(val) \
339 (0x80000000 & ((val) << 31))
340
330#define KVMIO 0xAE 341#define KVMIO 0xAE
331 342
332/* 343/*
@@ -372,6 +383,10 @@ struct kvm_trace_rec {
372#define KVM_CAP_MP_STATE 14 383#define KVM_CAP_MP_STATE 14
373#define KVM_CAP_COALESCED_MMIO 15 384#define KVM_CAP_COALESCED_MMIO 15
374#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 385#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
386#if defined(CONFIG_X86)||defined(CONFIG_IA64)
387#define KVM_CAP_DEVICE_ASSIGNMENT 17
388#endif
389#define KVM_CAP_IOMMU 18
375 390
376/* 391/*
377 * ioctls for VM fds 392 * ioctls for VM fds
@@ -401,6 +416,10 @@ struct kvm_trace_rec {
401 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 416 _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone)
402#define KVM_UNREGISTER_COALESCED_MMIO \ 417#define KVM_UNREGISTER_COALESCED_MMIO \
403 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 418 _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone)
419#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
420 struct kvm_assigned_pci_dev)
421#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
422 struct kvm_assigned_irq)
404 423
405/* 424/*
406 * ioctls for vcpu fds 425 * ioctls for vcpu fds
@@ -440,4 +459,45 @@ struct kvm_trace_rec {
440#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 459#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
441#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 460#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
442 461
462#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
463#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
464#define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04)
465#define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05)
466#define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06)
467#define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07)
468#define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08)
469#define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09)
470#define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A)
471#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)
472#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)
473#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)
474#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)
475#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)
476#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)
477#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)
478#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)
479#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)
480#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14)
481#define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15)
482#define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16)
483#define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17)
484#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
485#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
486
487struct kvm_assigned_pci_dev {
488 __u32 assigned_dev_id;
489 __u32 busnr;
490 __u32 devfn;
491 __u32 flags;
492};
493
494struct kvm_assigned_irq {
495 __u32 assigned_dev_id;
496 __u32 host_irq;
497 __u32 guest_irq;
498 __u32 flags;
499};
500
501#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
502
443#endif 503#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8525afc53107..3833c48fae3a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -34,6 +34,8 @@
34#define KVM_REQ_MMU_RELOAD 3 34#define KVM_REQ_MMU_RELOAD 3
35#define KVM_REQ_TRIPLE_FAULT 4 35#define KVM_REQ_TRIPLE_FAULT 4
36#define KVM_REQ_PENDING_TIMER 5 36#define KVM_REQ_PENDING_TIMER 5
37#define KVM_REQ_UNHALT 6
38#define KVM_REQ_MMU_SYNC 7
37 39
38struct kvm_vcpu; 40struct kvm_vcpu;
39extern struct kmem_cache *kvm_vcpu_cache; 41extern struct kmem_cache *kvm_vcpu_cache;
@@ -279,12 +281,68 @@ void kvm_free_physmem(struct kvm *kvm);
279 281
280struct kvm *kvm_arch_create_vm(void); 282struct kvm *kvm_arch_create_vm(void);
281void kvm_arch_destroy_vm(struct kvm *kvm); 283void kvm_arch_destroy_vm(struct kvm *kvm);
284void kvm_free_all_assigned_devices(struct kvm *kvm);
282 285
283int kvm_cpu_get_interrupt(struct kvm_vcpu *v); 286int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
284int kvm_cpu_has_interrupt(struct kvm_vcpu *v); 287int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
285int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 288int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
286void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 289void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
287 290
291int kvm_is_mmio_pfn(pfn_t pfn);
292
293struct kvm_irq_ack_notifier {
294 struct hlist_node link;
295 unsigned gsi;
296 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
297};
298
299struct kvm_assigned_dev_kernel {
300 struct kvm_irq_ack_notifier ack_notifier;
301 struct work_struct interrupt_work;
302 struct list_head list;
303 int assigned_dev_id;
304 int host_busnr;
305 int host_devfn;
306 int host_irq;
307 int guest_irq;
308 int irq_requested;
309 struct pci_dev *dev;
310 struct kvm *kvm;
311};
312void kvm_set_irq(struct kvm *kvm, int irq, int level);
313void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
314void kvm_register_irq_ack_notifier(struct kvm *kvm,
315 struct kvm_irq_ack_notifier *kian);
316void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
317 struct kvm_irq_ack_notifier *kian);
318
319#ifdef CONFIG_DMAR
320int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
321 unsigned long npages);
322int kvm_iommu_map_guest(struct kvm *kvm,
323 struct kvm_assigned_dev_kernel *assigned_dev);
324int kvm_iommu_unmap_guest(struct kvm *kvm);
325#else /* CONFIG_DMAR */
326static inline int kvm_iommu_map_pages(struct kvm *kvm,
327 gfn_t base_gfn,
328 unsigned long npages)
329{
330 return 0;
331}
332
333static inline int kvm_iommu_map_guest(struct kvm *kvm,
334 struct kvm_assigned_dev_kernel
335 *assigned_dev)
336{
337 return -ENODEV;
338}
339
340static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
341{
342 return 0;
343}
344#endif /* CONFIG_DMAR */
345
288static inline void kvm_guest_enter(void) 346static inline void kvm_guest_enter(void)
289{ 347{
290 account_system_vtime(current); 348 account_system_vtime(current);
@@ -307,6 +365,11 @@ static inline gpa_t gfn_to_gpa(gfn_t gfn)
307 return (gpa_t)gfn << PAGE_SHIFT; 365 return (gpa_t)gfn << PAGE_SHIFT;
308} 366}
309 367
368static inline hpa_t pfn_to_hpa(pfn_t pfn)
369{
370 return (hpa_t)pfn << PAGE_SHIFT;
371}
372
310static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 373static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
311{ 374{
312 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 375 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
@@ -326,6 +389,25 @@ struct kvm_stats_debugfs_item {
326extern struct kvm_stats_debugfs_item debugfs_entries[]; 389extern struct kvm_stats_debugfs_item debugfs_entries[];
327extern struct dentry *kvm_debugfs_dir; 390extern struct dentry *kvm_debugfs_dir;
328 391
392#define KVMTRACE_5D(evt, vcpu, d1, d2, d3, d4, d5, name) \
393 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
394 vcpu, 5, d1, d2, d3, d4, d5)
395#define KVMTRACE_4D(evt, vcpu, d1, d2, d3, d4, name) \
396 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
397 vcpu, 4, d1, d2, d3, d4, 0)
398#define KVMTRACE_3D(evt, vcpu, d1, d2, d3, name) \
399 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
400 vcpu, 3, d1, d2, d3, 0, 0)
401#define KVMTRACE_2D(evt, vcpu, d1, d2, name) \
402 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
403 vcpu, 2, d1, d2, 0, 0, 0)
404#define KVMTRACE_1D(evt, vcpu, d1, name) \
405 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
406 vcpu, 1, d1, 0, 0, 0, 0)
407#define KVMTRACE_0D(evt, vcpu, name) \
408 trace_mark(kvm_trace_##name, "%u %p %u %u %u %u %u %u", KVM_TRC_##evt, \
409 vcpu, 0, 0, 0, 0, 0, 0)
410
329#ifdef CONFIG_KVM_TRACE 411#ifdef CONFIG_KVM_TRACE
330int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg); 412int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg);
331void kvm_trace_cleanup(void); 413void kvm_trace_cleanup(void);
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 173febac6656..c67fecafff90 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -11,6 +11,7 @@
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <linux/notifier.h> 13#include <linux/notifier.h>
14#include <linux/fb.h>
14 15
15/* Notes on locking: 16/* Notes on locking:
16 * 17 *
@@ -45,6 +46,8 @@ struct lcd_ops {
45 int (*get_contrast)(struct lcd_device *); 46 int (*get_contrast)(struct lcd_device *);
46 /* Set LCD panel contrast */ 47 /* Set LCD panel contrast */
47 int (*set_contrast)(struct lcd_device *, int contrast); 48 int (*set_contrast)(struct lcd_device *, int contrast);
49 /* Set LCD panel mode (resolutions ...) */
50 int (*set_mode)(struct lcd_device *, struct fb_videomode *);
48 /* Check if given framebuffer device is the one LCD is bound to; 51 /* Check if given framebuffer device is the one LCD is bound to;
49 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ 52 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
50 int (*check_fb)(struct lcd_device *, struct fb_info *); 53 int (*check_fb)(struct lcd_device *, struct fb_info *);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d41ccb56146a..d3a73f5a48c3 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -123,7 +123,7 @@ extern void ledtrig_ide_activity(void);
123 */ 123 */
124struct led_info { 124struct led_info {
125 const char *name; 125 const char *name;
126 char *default_trigger; 126 const char *default_trigger;
127 int flags; 127 int flags;
128}; 128};
129 129
@@ -135,7 +135,7 @@ struct led_platform_data {
135/* For the leds-gpio driver */ 135/* For the leds-gpio driver */
136struct gpio_led { 136struct gpio_led {
137 const char *name; 137 const char *name;
138 char *default_trigger; 138 const char *default_trigger;
139 unsigned gpio; 139 unsigned gpio;
140 u8 active_low; 140 u8 active_low;
141}; 141};
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 225bfc5bd9ec..507f53ef8038 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -146,6 +146,7 @@ enum {
146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
149 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
149 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 150 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
150 151
151 ATA_DFLAG_DETACH = (1 << 24), 152 ATA_DFLAG_DETACH = (1 << 24),
@@ -244,6 +245,7 @@ enum {
244 ATA_TMOUT_BOOT = 30000, /* heuristic */ 245 ATA_TMOUT_BOOT = 30000, /* heuristic */
245 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ 246 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
246 ATA_TMOUT_INTERNAL_QUICK = 5000, 247 ATA_TMOUT_INTERNAL_QUICK = 5000,
248 ATA_TMOUT_MAX_PARK = 30000,
247 249
248 /* FIXME: GoVault needs 2s but we can't afford that without 250 /* FIXME: GoVault needs 2s but we can't afford that without
249 * parallel probing. 800ms is enough for iVDR disk 251 * parallel probing. 800ms is enough for iVDR disk
@@ -319,8 +321,11 @@ enum {
319 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 321 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
320 ATA_EH_ENABLE_LINK = (1 << 3), 322 ATA_EH_ENABLE_LINK = (1 << 3),
321 ATA_EH_LPM = (1 << 4), /* link power management action */ 323 ATA_EH_LPM = (1 << 4), /* link power management action */
324 ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */
322 325
323 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 326 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK,
327 ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET |
328 ATA_EH_ENABLE_LINK | ATA_EH_LPM,
324 329
325 /* ata_eh_info->flags */ 330 /* ata_eh_info->flags */
326 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 331 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
@@ -335,6 +340,9 @@ enum {
335 340
336 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, 341 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
337 342
343 /* mask of flags to transfer *to* the slave link */
344 ATA_EHI_TO_SLAVE_MASK = ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET,
345
338 /* max tries if error condition is still set after ->error_handler */ 346 /* max tries if error condition is still set after ->error_handler */
339 ATA_EH_MAX_TRIES = 5, 347 ATA_EH_MAX_TRIES = 5,
340 348
@@ -452,6 +460,7 @@ enum link_pm {
452 MEDIUM_POWER, 460 MEDIUM_POWER,
453}; 461};
454extern struct device_attribute dev_attr_link_power_management_policy; 462extern struct device_attribute dev_attr_link_power_management_policy;
463extern struct device_attribute dev_attr_unload_heads;
455extern struct device_attribute dev_attr_em_message_type; 464extern struct device_attribute dev_attr_em_message_type;
456extern struct device_attribute dev_attr_em_message; 465extern struct device_attribute dev_attr_em_message;
457extern struct device_attribute dev_attr_sw_activity; 466extern struct device_attribute dev_attr_sw_activity;
@@ -554,8 +563,8 @@ struct ata_ering {
554struct ata_device { 563struct ata_device {
555 struct ata_link *link; 564 struct ata_link *link;
556 unsigned int devno; /* 0 or 1 */ 565 unsigned int devno; /* 0 or 1 */
557 unsigned long flags; /* ATA_DFLAG_xxx */
558 unsigned int horkage; /* List of broken features */ 566 unsigned int horkage; /* List of broken features */
567 unsigned long flags; /* ATA_DFLAG_xxx */
559 struct scsi_device *sdev; /* attached SCSI device */ 568 struct scsi_device *sdev; /* attached SCSI device */
560#ifdef CONFIG_ATA_ACPI 569#ifdef CONFIG_ATA_ACPI
561 acpi_handle acpi_handle; 570 acpi_handle acpi_handle;
@@ -564,6 +573,7 @@ struct ata_device {
564 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 573 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
565 u64 n_sectors; /* size of device, if ATA */ 574 u64 n_sectors; /* size of device, if ATA */
566 unsigned int class; /* ATA_DEV_xxx */ 575 unsigned int class; /* ATA_DEV_xxx */
576 unsigned long unpark_deadline;
567 577
568 u8 pio_mode; 578 u8 pio_mode;
569 u8 dma_mode; 579 u8 dma_mode;
@@ -621,6 +631,7 @@ struct ata_eh_context {
621 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; 631 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
622 unsigned int classes[ATA_MAX_DEVICES]; 632 unsigned int classes[ATA_MAX_DEVICES];
623 unsigned int did_probe_mask; 633 unsigned int did_probe_mask;
634 unsigned int unloaded_mask;
624 unsigned int saved_ncq_enabled; 635 unsigned int saved_ncq_enabled;
625 u8 saved_xfer_mode[ATA_MAX_DEVICES]; 636 u8 saved_xfer_mode[ATA_MAX_DEVICES];
626 /* timestamp for the last reset attempt or success */ 637 /* timestamp for the last reset attempt or success */
@@ -684,11 +695,11 @@ struct ata_port {
684 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 695 unsigned int cbl; /* cable type; ATA_CBL_xxx */
685 696
686 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 697 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
687 unsigned long qc_allocated;
688 unsigned int qc_active; 698 unsigned int qc_active;
689 int nr_active_links; /* #links with active qcs */ 699 int nr_active_links; /* #links with active qcs */
690 700
691 struct ata_link link; /* host default link */ 701 struct ata_link link; /* host default link */
702 struct ata_link *slave_link; /* see ata_slave_link_init() */
692 703
693 int nr_pmp_links; /* nr of available PMP links */ 704 int nr_pmp_links; /* nr of available PMP links */
694 struct ata_link *pmp_link; /* array of PMP links */ 705 struct ata_link *pmp_link; /* array of PMP links */
@@ -709,6 +720,7 @@ struct ata_port {
709 struct list_head eh_done_q; 720 struct list_head eh_done_q;
710 wait_queue_head_t eh_wait_q; 721 wait_queue_head_t eh_wait_q;
711 int eh_tries; 722 int eh_tries;
723 struct completion park_req_pending;
712 724
713 pm_message_t pm_mesg; 725 pm_message_t pm_mesg;
714 int *pm_result; 726 int *pm_result;
@@ -772,8 +784,8 @@ struct ata_port_operations {
772 /* 784 /*
773 * Optional features 785 * Optional features
774 */ 786 */
775 int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); 787 int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val);
776 int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); 788 int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
777 void (*pmp_attach)(struct ata_port *ap); 789 void (*pmp_attach)(struct ata_port *ap);
778 void (*pmp_detach)(struct ata_port *ap); 790 void (*pmp_detach)(struct ata_port *ap);
779 int (*enable_pm)(struct ata_port *ap, enum link_pm policy); 791 int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
@@ -895,6 +907,7 @@ extern void ata_port_disable(struct ata_port *);
895extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 907extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
896extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 908extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
897 const struct ata_port_info * const * ppi, int n_ports); 909 const struct ata_port_info * const * ppi, int n_ports);
910extern int ata_slave_link_init(struct ata_port *ap);
898extern int ata_host_start(struct ata_host *host); 911extern int ata_host_start(struct ata_host *host);
899extern int ata_host_register(struct ata_host *host, 912extern int ata_host_register(struct ata_host *host,
900 struct scsi_host_template *sht); 913 struct scsi_host_template *sht);
@@ -920,8 +933,8 @@ extern int sata_scr_valid(struct ata_link *link);
920extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 933extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
921extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 934extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
922extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); 935extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
923extern int ata_link_online(struct ata_link *link); 936extern bool ata_link_online(struct ata_link *link);
924extern int ata_link_offline(struct ata_link *link); 937extern bool ata_link_offline(struct ata_link *link);
925#ifdef CONFIG_PM 938#ifdef CONFIG_PM
926extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 939extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
927extern void ata_host_resume(struct ata_host *host); 940extern void ata_host_resume(struct ata_host *host);
@@ -1098,6 +1111,7 @@ extern void ata_std_error_handler(struct ata_port *ap);
1098 */ 1111 */
1099extern const struct ata_port_operations ata_base_port_ops; 1112extern const struct ata_port_operations ata_base_port_ops;
1100extern const struct ata_port_operations sata_port_ops; 1113extern const struct ata_port_operations sata_port_ops;
1114extern struct device_attribute *ata_common_sdev_attrs[];
1101 1115
1102#define ATA_BASE_SHT(drv_name) \ 1116#define ATA_BASE_SHT(drv_name) \
1103 .module = THIS_MODULE, \ 1117 .module = THIS_MODULE, \
@@ -1112,7 +1126,8 @@ extern const struct ata_port_operations sata_port_ops;
1112 .proc_name = drv_name, \ 1126 .proc_name = drv_name, \
1113 .slave_configure = ata_scsi_slave_config, \ 1127 .slave_configure = ata_scsi_slave_config, \
1114 .slave_destroy = ata_scsi_slave_destroy, \ 1128 .slave_destroy = ata_scsi_slave_destroy, \
1115 .bios_param = ata_std_bios_param 1129 .bios_param = ata_std_bios_param, \
1130 .sdev_attrs = ata_common_sdev_attrs
1116 1131
1117#define ATA_NCQ_SHT(drv_name) \ 1132#define ATA_NCQ_SHT(drv_name) \
1118 ATA_BASE_SHT(drv_name), \ 1133 ATA_BASE_SHT(drv_name), \
@@ -1134,7 +1149,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap)
1134 1149
1135static inline int ata_is_host_link(const struct ata_link *link) 1150static inline int ata_is_host_link(const struct ata_link *link)
1136{ 1151{
1137 return link == &link->ap->link; 1152 return link == &link->ap->link || link == link->ap->slave_link;
1138} 1153}
1139#else /* CONFIG_SATA_PMP */ 1154#else /* CONFIG_SATA_PMP */
1140static inline bool sata_pmp_supported(struct ata_port *ap) 1155static inline bool sata_pmp_supported(struct ata_port *ap)
@@ -1167,7 +1182,7 @@ static inline int sata_srst_pmp(struct ata_link *link)
1167 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1182 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1168 1183
1169#define ata_link_printk(link, lv, fmt, args...) do { \ 1184#define ata_link_printk(link, lv, fmt, args...) do { \
1170 if (sata_pmp_attached((link)->ap)) \ 1185 if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
1171 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1186 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1172 (link)->pmp , ##args); \ 1187 (link)->pmp , ##args); \
1173 else \ 1188 else \
@@ -1265,34 +1280,17 @@ static inline int ata_link_active(struct ata_link *link)
1265 return ata_tag_valid(link->active_tag) || link->sactive; 1280 return ata_tag_valid(link->active_tag) || link->sactive;
1266} 1281}
1267 1282
1268static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1283extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
1269{ 1284 struct ata_link *link,
1270 if (sata_pmp_attached(ap)) 1285 bool dev_only);
1271 return ap->pmp_link;
1272 return &ap->link;
1273}
1274
1275static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1276{
1277 struct ata_port *ap = link->ap;
1278
1279 if (ata_is_host_link(link)) {
1280 if (!sata_pmp_attached(ap))
1281 return NULL;
1282 return ap->pmp_link;
1283 }
1284
1285 if (++link < ap->nr_pmp_links + ap->pmp_link)
1286 return link;
1287 return NULL;
1288}
1289 1286
1290#define __ata_port_for_each_link(lk, ap) \ 1287#define __ata_port_for_each_link(link, ap) \
1291 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) 1288 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
1289 (link) = __ata_port_next_link((ap), (link), false))
1292 1290
1293#define ata_port_for_each_link(link, ap) \ 1291#define ata_port_for_each_link(link, ap) \
1294 for ((link) = ata_port_first_link(ap); (link); \ 1292 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
1295 (link) = ata_port_next_link(link)) 1293 (link) = __ata_port_next_link((ap), (link), true))
1296 1294
1297#define ata_link_for_each_dev(dev, link) \ 1295#define ata_link_for_each_dev(dev, link) \
1298 for ((dev) = (link)->device; \ 1296 for ((dev) = (link)->device; \
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 56ba37394656..9fd1f859021b 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -4,8 +4,6 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <asm/linkage.h> 5#include <asm/linkage.h>
6 6
7#define notrace __attribute__((no_instrument_function))
8
9#ifdef __cplusplus 7#ifdef __cplusplus
10#define CPP_ASMLINKAGE extern "C" 8#define CPP_ASMLINKAGE extern "C"
11#else 9#else
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 3d25bcd139d1..e5872dc994c0 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -27,7 +27,6 @@ struct nlmsvc_binding {
27 struct nfs_fh *, 27 struct nfs_fh *,
28 struct file **); 28 struct file **);
29 void (*fclose)(struct file *); 29 void (*fclose)(struct file *);
30 unsigned long (*get_grace_period)(void);
31}; 30};
32 31
33extern struct nlmsvc_binding * nlmsvc_ops; 32extern struct nlmsvc_binding * nlmsvc_ops;
@@ -53,15 +52,7 @@ extern void nlmclnt_done(struct nlm_host *host);
53 52
54extern int nlmclnt_proc(struct nlm_host *host, int cmd, 53extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl); 54 struct file_lock *fl);
56extern int lockd_up(int proto); 55extern int lockd_up(void);
57extern void lockd_down(void); 56extern void lockd_down(void);
58 57
59unsigned long get_nfs_grace_period(void);
60
61#ifdef CONFIG_NFSD_V4
62unsigned long get_nfs4_grace_period(void);
63#else
64static inline unsigned long get_nfs4_grace_period(void) {return 0;}
65#endif
66
67#endif /* LINUX_LOCKD_BIND_H */ 58#endif /* LINUX_LOCKD_BIND_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index dbb87ab282e8..b56d5aa9b194 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -12,6 +12,8 @@
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/in6.h>
16#include <net/ipv6.h>
15#include <linux/fs.h> 17#include <linux/fs.h>
16#include <linux/kref.h> 18#include <linux/kref.h>
17#include <linux/utsname.h> 19#include <linux/utsname.h>
@@ -38,8 +40,9 @@
38 */ 40 */
39struct nlm_host { 41struct nlm_host {
40 struct hlist_node h_hash; /* doubly linked list */ 42 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_in h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
42 struct sockaddr_in h_saddr; /* our address (optional) */ 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
43 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 46 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
44 char * h_name; /* remote hostname */ 47 char * h_name; /* remote hostname */
45 u32 h_version; /* interface version */ 48 u32 h_version; /* interface version */
@@ -61,18 +64,56 @@ struct nlm_host {
61 struct list_head h_granted; /* Locks in GRANTED state */ 64 struct list_head h_granted; /* Locks in GRANTED state */
62 struct list_head h_reclaim; /* Locks in RECLAIM state */ 65 struct list_head h_reclaim; /* Locks in RECLAIM state */
63 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 66 struct nsm_handle * h_nsmhandle; /* NSM status handle */
67
68 char h_addrbuf[48], /* address eyecatchers */
69 h_srcaddrbuf[48];
64}; 70};
65 71
66struct nsm_handle { 72struct nsm_handle {
67 struct list_head sm_link; 73 struct list_head sm_link;
68 atomic_t sm_count; 74 atomic_t sm_count;
69 char * sm_name; 75 char * sm_name;
70 struct sockaddr_in sm_addr; 76 struct sockaddr_storage sm_addr;
77 size_t sm_addrlen;
71 unsigned int sm_monitored : 1, 78 unsigned int sm_monitored : 1,
72 sm_sticky : 1; /* don't unmonitor */ 79 sm_sticky : 1; /* don't unmonitor */
80 char sm_addrbuf[48]; /* address eyecatcher */
73}; 81};
74 82
75/* 83/*
84 * Rigorous type checking on sockaddr type conversions
85 */
86static inline struct sockaddr_in *nlm_addr_in(const struct nlm_host *host)
87{
88 return (struct sockaddr_in *)&host->h_addr;
89}
90
91static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
92{
93 return (struct sockaddr *)&host->h_addr;
94}
95
96static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host)
97{
98 return (struct sockaddr_in *)&host->h_srcaddr;
99}
100
101static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
102{
103 return (struct sockaddr *)&host->h_srcaddr;
104}
105
106static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
107{
108 return (struct sockaddr_in *)&handle->sm_addr;
109}
110
111static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
112{
113 return (struct sockaddr *)&handle->sm_addr;
114}
115
116/*
76 * Map an fl_owner_t into a unique 32-bit "pid" 117 * Map an fl_owner_t into a unique 32-bit "pid"
77 */ 118 */
78struct nlm_lockowner { 119struct nlm_lockowner {
@@ -166,7 +207,8 @@ int nlm_async_reply(struct nlm_rqst *, u32, const struct rpc_call_ops *);
166struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl); 207struct nlm_wait * nlmclnt_prepare_block(struct nlm_host *host, struct file_lock *fl);
167void nlmclnt_finish_block(struct nlm_wait *block); 208void nlmclnt_finish_block(struct nlm_wait *block);
168int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout); 209int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout);
169__be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *); 210__be32 nlmclnt_grant(const struct sockaddr *addr,
211 const struct nlm_lock *lock);
170void nlmclnt_recovery(struct nlm_host *); 212void nlmclnt_recovery(struct nlm_host *);
171int nlmclnt_reclaim(struct nlm_host *, struct file_lock *); 213int nlmclnt_reclaim(struct nlm_host *, struct file_lock *);
172void nlmclnt_next_cookie(struct nlm_cookie *); 214void nlmclnt_next_cookie(struct nlm_cookie *);
@@ -174,12 +216,14 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
174/* 216/*
175 * Host cache 217 * Host cache
176 */ 218 */
177struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, 219struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
178 int proto, u32 version, 220 const size_t salen,
221 const unsigned short protocol,
222 const u32 version,
223 const char *hostname);
224struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
179 const char *hostname, 225 const char *hostname,
180 unsigned int hostname_len); 226 const size_t hostname_len);
181struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
182 unsigned int);
183struct rpc_clnt * nlm_bind_host(struct nlm_host *); 227struct rpc_clnt * nlm_bind_host(struct nlm_host *);
184void nlm_rebind_host(struct nlm_host *); 228void nlm_rebind_host(struct nlm_host *);
185struct nlm_host * nlm_get_host(struct nlm_host *); 229struct nlm_host * nlm_get_host(struct nlm_host *);
@@ -201,7 +245,7 @@ typedef int (*nlm_host_match_fn_t)(void *cur, struct nlm_host *ref);
201 */ 245 */
202__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 246__be32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
203 struct nlm_host *, struct nlm_lock *, int, 247 struct nlm_host *, struct nlm_lock *, int,
204 struct nlm_cookie *); 248 struct nlm_cookie *, int);
205__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 249__be32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
206__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *, 250__be32 nlmsvc_testlock(struct svc_rqst *, struct nlm_file *,
207 struct nlm_host *, struct nlm_lock *, 251 struct nlm_host *, struct nlm_lock *,
@@ -233,15 +277,82 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
233 return file->f_file->f_path.dentry->d_inode; 277 return file->f_file->f_path.dentry->d_inode;
234} 278}
235 279
280static inline int __nlm_privileged_request4(const struct sockaddr *sap)
281{
282 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
283 return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
284 (ntohs(sin->sin_port) < 1024);
285}
286
287#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
288static inline int __nlm_privileged_request6(const struct sockaddr *sap)
289{
290 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
291 return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) &&
292 (ntohs(sin6->sin6_port) < 1024);
293}
294#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
295static inline int __nlm_privileged_request6(const struct sockaddr *sap)
296{
297 return 0;
298}
299#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
300
236/* 301/*
237 * Compare two host addresses (needs modifying for ipv6) 302 * Ensure incoming requests are from local privileged callers.
303 *
304 * Return TRUE if sender is local and is connecting via a privileged port;
305 * otherwise return FALSE.
238 */ 306 */
239static inline int nlm_cmp_addr(const struct sockaddr_in *sin1, 307static inline int nlm_privileged_requester(const struct svc_rqst *rqstp)
240 const struct sockaddr_in *sin2)
241{ 308{
309 const struct sockaddr *sap = svc_addr(rqstp);
310
311 switch (sap->sa_family) {
312 case AF_INET:
313 return __nlm_privileged_request4(sap);
314 case AF_INET6:
315 return __nlm_privileged_request6(sap);
316 default:
317 return 0;
318 }
319}
320
321static inline int __nlm_cmp_addr4(const struct sockaddr *sap1,
322 const struct sockaddr *sap2)
323{
324 const struct sockaddr_in *sin1 = (const struct sockaddr_in *)sap1;
325 const struct sockaddr_in *sin2 = (const struct sockaddr_in *)sap2;
242 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr; 326 return sin1->sin_addr.s_addr == sin2->sin_addr.s_addr;
243} 327}
244 328
329static inline int __nlm_cmp_addr6(const struct sockaddr *sap1,
330 const struct sockaddr *sap2)
331{
332 const struct sockaddr_in6 *sin1 = (const struct sockaddr_in6 *)sap1;
333 const struct sockaddr_in6 *sin2 = (const struct sockaddr_in6 *)sap2;
334 return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr);
335}
336
337/*
338 * Compare two host addresses
339 *
340 * Return TRUE if the addresses are the same; otherwise FALSE.
341 */
342static inline int nlm_cmp_addr(const struct sockaddr *sap1,
343 const struct sockaddr *sap2)
344{
345 if (sap1->sa_family == sap2->sa_family) {
346 switch (sap1->sa_family) {
347 case AF_INET:
348 return __nlm_cmp_addr4(sap1, sap2);
349 case AF_INET6:
350 return __nlm_cmp_addr6(sap1, sap2);
351 }
352 }
353 return 0;
354}
355
245/* 356/*
246 * Compare two NLM locks. 357 * Compare two NLM locks.
247 * When the second lock is of type F_UNLCK, this acts like a wildcard. 358 * When the second lock is of type F_UNLCK, this acts like a wildcard.
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index df18fa053bcd..d6b3a802c046 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -81,8 +81,6 @@ struct nlm_reboot {
81 unsigned int len; 81 unsigned int len;
82 u32 state; 82 u32 state;
83 __be32 addr; 83 __be32 addr;
84 __be32 vers;
85 __be32 proto;
86}; 84};
87 85
88/* 86/*
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 1fa0c2ce4dec..f7f3fdddbef0 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -6,6 +6,10 @@
6#define AFS_SUPER_MAGIC 0x5346414F 6#define AFS_SUPER_MAGIC 0x5346414F
7#define AUTOFS_SUPER_MAGIC 0x0187 7#define AUTOFS_SUPER_MAGIC 0x0187
8#define CODA_SUPER_MAGIC 0x73757245 8#define CODA_SUPER_MAGIC 0x73757245
9#define DEBUGFS_MAGIC 0x64626720
10#define SYSFS_MAGIC 0x62656572
11#define SECURITYFS_MAGIC 0x73636673
12#define TMPFS_MAGIC 0x01021994
9#define EFS_SUPER_MAGIC 0x414A53 13#define EFS_SUPER_MAGIC 0x414A53
10#define EXT2_SUPER_MAGIC 0xEF53 14#define EXT2_SUPER_MAGIC 0xEF53
11#define EXT3_SUPER_MAGIC 0xEF53 15#define EXT3_SUPER_MAGIC 0xEF53
diff --git a/include/linux/major.h b/include/linux/major.h
index 53d5fafd85c3..88249452b935 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -170,4 +170,6 @@
170 170
171#define VIOTAPE_MAJOR 230 171#define VIOTAPE_MAJOR 230
172 172
173#define BLOCK_EXT_MAJOR 259
174
173#endif 175#endif
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h
new file mode 100644
index 000000000000..7df8432c4402
--- /dev/null
+++ b/include/linux/map_to_7segment.h
@@ -0,0 +1,187 @@
1/*
2 * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>
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 as
6 * published by the Free Software Foundation; either version 2 of
7 * 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 MAP_TO_7SEGMENT_H
20#define MAP_TO_7SEGMENT_H
21
22/* This file provides translation primitives and tables for the conversion
23 * of (ASCII) characters to a 7-segments notation.
24 *
25 * The 7 segment's wikipedia notation below is used as standard.
26 * See: http://en.wikipedia.org/wiki/Seven_segment_display
27 *
28 * Notation: +-a-+
29 * f b
30 * +-g-+
31 * e c
32 * +-d-+
33 *
34 * Usage:
35 *
36 * Register a map variable, and fill it with a character set:
37 * static SEG7_DEFAULT_MAP(map_seg7);
38 *
39 *
40 * Then use for conversion:
41 * seg7 = map_to_seg7(&map_seg7, some_char);
42 * ...
43 *
44 * In device drivers it is recommended, if required, to make the char map
45 * accessible via the sysfs interface using the following scheme:
46 *
47 * static ssize_t show_map(struct device *dev, char *buf) {
48 * memcpy(buf, &map_seg7, sizeof(map_seg7));
49 * return sizeof(map_seg7);
50 * }
51 * static ssize_t store_map(struct device *dev, const char *buf, size_t cnt) {
52 * if(cnt != sizeof(map_seg7))
53 * return -EINVAL;
54 * memcpy(&map_seg7, buf, cnt);
55 * return cnt;
56 * }
57 * static DEVICE_ATTR(map_seg7, PERMS_RW, show_map, store_map);
58 *
59 * History:
60 * 2005-05-31 RFC linux-kernel@vger.kernel.org
61 */
62#include <linux/errno.h>
63
64
65#define BIT_SEG7_A 0
66#define BIT_SEG7_B 1
67#define BIT_SEG7_C 2
68#define BIT_SEG7_D 3
69#define BIT_SEG7_E 4
70#define BIT_SEG7_F 5
71#define BIT_SEG7_G 6
72#define BIT_SEG7_RESERVED 7
73
74struct seg7_conversion_map {
75 unsigned char table[128];
76};
77
78static inline int map_to_seg7(struct seg7_conversion_map *map, int c)
79{
80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
81}
82
83#define SEG7_CONVERSION_MAP(_name, _map) \
84 struct seg7_conversion_map _name = { .table = { _map } }
85
86/*
87 * It is recommended to use a facility that allows user space to redefine
88 * custom character sets for LCD devices. Please use a sysfs interface
89 * as described above.
90 */
91#define MAP_TO_SEG7_SYSFS_FILE "map_seg7"
92
93/*******************************************************************************
94 * ASCII conversion table
95 ******************************************************************************/
96
97#define _SEG7(l,a,b,c,d,e,f,g) \
98 ( a<<BIT_SEG7_A | b<<BIT_SEG7_B | c<<BIT_SEG7_C | d<<BIT_SEG7_D | \
99 e<<BIT_SEG7_E | f<<BIT_SEG7_F | g<<BIT_SEG7_G )
100
101#define _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
102 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
103
104#define _MAP_33_47_ASCII_SEG7_SYMBOL \
105 _SEG7('!',0,0,0,0,1,1,0), _SEG7('"',0,1,0,0,0,1,0), _SEG7('#',0,1,1,0,1,1,0),\
106 _SEG7('$',1,0,1,1,0,1,1), _SEG7('%',0,0,1,0,0,1,0), _SEG7('&',1,0,1,1,1,1,1),\
107 _SEG7('\'',0,0,0,0,0,1,0),_SEG7('(',1,0,0,1,1,1,0), _SEG7(')',1,1,1,1,0,0,0),\
108 _SEG7('*',0,1,1,0,1,1,1), _SEG7('+',0,1,1,0,0,0,1), _SEG7(',',0,0,0,0,1,0,0),\
109 _SEG7('-',0,0,0,0,0,0,1), _SEG7('.',0,0,0,0,1,0,0), _SEG7('/',0,1,0,0,1,0,1),
110
111#define _MAP_48_57_ASCII_SEG7_NUMERIC \
112 _SEG7('0',1,1,1,1,1,1,0), _SEG7('1',0,1,1,0,0,0,0), _SEG7('2',1,1,0,1,1,0,1),\
113 _SEG7('3',1,1,1,1,0,0,1), _SEG7('4',0,1,1,0,0,1,1), _SEG7('5',1,0,1,1,0,1,1),\
114 _SEG7('6',1,0,1,1,1,1,1), _SEG7('7',1,1,1,0,0,0,0), _SEG7('8',1,1,1,1,1,1,1),\
115 _SEG7('9',1,1,1,1,0,1,1),
116
117#define _MAP_58_64_ASCII_SEG7_SYMBOL \
118 _SEG7(':',0,0,0,1,0,0,1), _SEG7(';',0,0,0,1,0,0,1), _SEG7('<',1,0,0,0,0,1,1),\
119 _SEG7('=',0,0,0,1,0,0,1), _SEG7('>',1,1,0,0,0,0,1), _SEG7('?',1,1,1,0,0,1,0),\
120 _SEG7('@',1,1,0,1,1,1,1),
121
122#define _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
123 _SEG7('A',1,1,1,0,1,1,1), _SEG7('B',1,1,1,1,1,1,1), _SEG7('C',1,0,0,1,1,1,0),\
124 _SEG7('D',1,1,1,1,1,1,0), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
125 _SEG7('G',1,1,1,1,0,1,1), _SEG7('H',0,1,1,0,1,1,1), _SEG7('I',0,1,1,0,0,0,0),\
126 _SEG7('J',0,1,1,1,0,0,0), _SEG7('K',0,1,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
127 _SEG7('M',1,1,1,0,1,1,0), _SEG7('N',1,1,1,0,1,1,0), _SEG7('O',1,1,1,1,1,1,0),\
128 _SEG7('P',1,1,0,0,1,1,1), _SEG7('Q',1,1,1,1,1,1,0), _SEG7('R',1,1,1,0,1,1,1),\
129 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('U',0,1,1,1,1,1,0),\
130 _SEG7('V',0,1,1,1,1,1,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
131 _SEG7('Y',0,1,1,0,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
132
133#define _MAP_91_96_ASCII_SEG7_SYMBOL \
134 _SEG7('[',1,0,0,1,1,1,0), _SEG7('\\',0,0,1,0,0,1,1),_SEG7(']',1,1,1,1,0,0,0),\
135 _SEG7('^',1,1,0,0,0,1,0), _SEG7('_',0,0,0,1,0,0,0), _SEG7('`',0,1,0,0,0,0,0),
136
137#define _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
138 _SEG7('A',1,1,1,0,1,1,1), _SEG7('b',0,0,1,1,1,1,1), _SEG7('c',0,0,0,1,1,0,1),\
139 _SEG7('d',0,1,1,1,1,0,1), _SEG7('E',1,0,0,1,1,1,1), _SEG7('F',1,0,0,0,1,1,1),\
140 _SEG7('G',1,1,1,1,0,1,1), _SEG7('h',0,0,1,0,1,1,1), _SEG7('i',0,0,1,0,0,0,0),\
141 _SEG7('j',0,0,1,1,0,0,0), _SEG7('k',0,0,1,0,1,1,1), _SEG7('L',0,0,0,1,1,1,0),\
142 _SEG7('M',1,1,1,0,1,1,0), _SEG7('n',0,0,1,0,1,0,1), _SEG7('o',0,0,1,1,1,0,1),\
143 _SEG7('P',1,1,0,0,1,1,1), _SEG7('q',1,1,1,0,0,1,1), _SEG7('r',0,0,0,0,1,0,1),\
144 _SEG7('S',1,0,1,1,0,1,1), _SEG7('T',0,0,0,1,1,1,1), _SEG7('u',0,0,1,1,1,0,0),\
145 _SEG7('v',0,0,1,1,1,0,0), _SEG7('W',0,1,1,1,1,1,1), _SEG7('X',0,1,1,0,1,1,1),\
146 _SEG7('y',0,1,1,1,0,1,1), _SEG7('Z',1,1,0,1,1,0,1),
147
148#define _MAP_123_126_ASCII_SEG7_SYMBOL \
149 _SEG7('{',1,0,0,1,1,1,0), _SEG7('|',0,0,0,0,1,1,0), _SEG7('}',1,1,1,1,0,0,0),\
150 _SEG7('~',1,0,0,0,0,0,0),
151
152/* Maps */
153
154/* This set tries to map as close as possible to the visible characteristics
155 * of the ASCII symbol, lowercase and uppercase letters may differ in
156 * presentation on the display.
157 */
158#define MAP_ASCII7SEG_ALPHANUM \
159 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
160 _MAP_33_47_ASCII_SEG7_SYMBOL \
161 _MAP_48_57_ASCII_SEG7_NUMERIC \
162 _MAP_58_64_ASCII_SEG7_SYMBOL \
163 _MAP_65_90_ASCII_SEG7_ALPHA_UPPR \
164 _MAP_91_96_ASCII_SEG7_SYMBOL \
165 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
166 _MAP_123_126_ASCII_SEG7_SYMBOL
167
168/* This set tries to map as close as possible to the symbolic characteristics
169 * of the ASCII character for maximum discrimination.
170 * For now this means all alpha chars are in lower case representations.
171 * (This for example facilitates the use of hex numbers with uppercase input.)
172 */
173#define MAP_ASCII7SEG_ALPHANUM_LC \
174 _MAP_0_32_ASCII_SEG7_NON_PRINTABLE \
175 _MAP_33_47_ASCII_SEG7_SYMBOL \
176 _MAP_48_57_ASCII_SEG7_NUMERIC \
177 _MAP_58_64_ASCII_SEG7_SYMBOL \
178 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
179 _MAP_91_96_ASCII_SEG7_SYMBOL \
180 _MAP_97_122_ASCII_SEG7_ALPHA_LOWER \
181 _MAP_123_126_ASCII_SEG7_SYMBOL
182
183#define SEG7_DEFAULT_MAP(_name) \
184 SEG7_CONVERSION_MAP(_name,MAP_ASCII7SEG_ALPHANUM)
185
186#endif /* MAP_TO_7SEGMENT_H */
187
diff --git a/include/linux/marker.h b/include/linux/marker.h
index 1290653f9241..889196c7fbb1 100644
--- a/include/linux/marker.h
+++ b/include/linux/marker.h
@@ -160,4 +160,11 @@ extern int marker_probe_unregister_private_data(marker_probe_func *probe,
160extern void *marker_get_private_data(const char *name, marker_probe_func *probe, 160extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
161 int num); 161 int num);
162 162
163/*
164 * marker_synchronize_unregister must be called between the last marker probe
165 * unregistration and the end of module exit to make sure there is no caller
166 * executing a probe when it is freed.
167 */
168#define marker_synchronize_unregister() synchronize_sched()
169
163#endif 170#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index fdf3967e1397..1fbe14d39521 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -27,16 +27,13 @@ struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29 29
30#define page_reset_bad_cgroup(page) ((page)->page_cgroup = 0)
31
32extern struct page_cgroup *page_get_page_cgroup(struct page *page);
33extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, 30extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm,
34 gfp_t gfp_mask); 31 gfp_t gfp_mask);
35extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 32extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
36 gfp_t gfp_mask); 33 gfp_t gfp_mask);
34extern void mem_cgroup_move_lists(struct page *page, enum lru_list lru);
37extern void mem_cgroup_uncharge_page(struct page *page); 35extern void mem_cgroup_uncharge_page(struct page *page);
38extern void mem_cgroup_uncharge_cache_page(struct page *page); 36extern void mem_cgroup_uncharge_cache_page(struct page *page);
39extern void mem_cgroup_move_lists(struct page *page, bool active);
40extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); 37extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask);
41 38
42extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 39extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
@@ -44,7 +41,7 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
44 unsigned long *scanned, int order, 41 unsigned long *scanned, int order,
45 int mode, struct zone *z, 42 int mode, struct zone *z,
46 struct mem_cgroup *mem_cont, 43 struct mem_cgroup *mem_cont,
47 int active); 44 int active, int file);
48extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 45extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
49int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 46int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
50 47
@@ -69,21 +66,11 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
69extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 66extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
70 int priority); 67 int priority);
71 68
72extern long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem, 69extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone,
73 struct zone *zone, int priority); 70 int priority, enum lru_list lru);
74extern long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
75 struct zone *zone, int priority);
76
77#else /* CONFIG_CGROUP_MEM_RES_CTLR */
78static inline void page_reset_bad_cgroup(struct page *page)
79{
80}
81 71
82static inline struct page_cgroup *page_get_page_cgroup(struct page *page)
83{
84 return NULL;
85}
86 72
73#else /* CONFIG_CGROUP_MEM_RES_CTLR */
87static inline int mem_cgroup_charge(struct page *page, 74static inline int mem_cgroup_charge(struct page *page,
88 struct mm_struct *mm, gfp_t gfp_mask) 75 struct mm_struct *mm, gfp_t gfp_mask)
89{ 76{
@@ -159,14 +146,9 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
159{ 146{
160} 147}
161 148
162static inline long mem_cgroup_calc_reclaim_active(struct mem_cgroup *mem, 149static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem,
163 struct zone *zone, int priority) 150 struct zone *zone, int priority,
164{ 151 enum lru_list lru)
165 return 0;
166}
167
168static inline long mem_cgroup_calc_reclaim_inactive(struct mem_cgroup *mem,
169 struct zone *zone, int priority)
170{ 152{
171 return 0; 153 return 0;
172} 154}
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
new file mode 100644
index 000000000000..cad314c12439
--- /dev/null
+++ b/include/linux/mfd/da903x.h
@@ -0,0 +1,201 @@
1#ifndef __LINUX_PMIC_DA903X_H
2#define __LINUX_PMIC_DA903X_H
3
4/* Unified sub device IDs for DA9030/DA9034 */
5enum {
6 DA9030_ID_LED_1,
7 DA9030_ID_LED_2,
8 DA9030_ID_LED_3,
9 DA9030_ID_LED_4,
10 DA9030_ID_LED_PC,
11 DA9030_ID_VIBRA,
12 DA9030_ID_WLED,
13 DA9030_ID_BUCK1,
14 DA9030_ID_BUCK2,
15 DA9030_ID_LDO1,
16 DA9030_ID_LDO2,
17 DA9030_ID_LDO3,
18 DA9030_ID_LDO4,
19 DA9030_ID_LDO5,
20 DA9030_ID_LDO6,
21 DA9030_ID_LDO7,
22 DA9030_ID_LDO8,
23 DA9030_ID_LDO9,
24 DA9030_ID_LDO10,
25 DA9030_ID_LDO11,
26 DA9030_ID_LDO12,
27 DA9030_ID_LDO13,
28 DA9030_ID_LDO14,
29 DA9030_ID_LDO15,
30 DA9030_ID_LDO16,
31 DA9030_ID_LDO17,
32 DA9030_ID_LDO18,
33 DA9030_ID_LDO19,
34 DA9030_ID_LDO_INT, /* LDO Internal */
35
36 DA9034_ID_LED_1,
37 DA9034_ID_LED_2,
38 DA9034_ID_VIBRA,
39 DA9034_ID_WLED,
40 DA9034_ID_TOUCH,
41
42 DA9034_ID_BUCK1,
43 DA9034_ID_BUCK2,
44 DA9034_ID_LDO1,
45 DA9034_ID_LDO2,
46 DA9034_ID_LDO3,
47 DA9034_ID_LDO4,
48 DA9034_ID_LDO5,
49 DA9034_ID_LDO6,
50 DA9034_ID_LDO7,
51 DA9034_ID_LDO8,
52 DA9034_ID_LDO9,
53 DA9034_ID_LDO10,
54 DA9034_ID_LDO11,
55 DA9034_ID_LDO12,
56 DA9034_ID_LDO13,
57 DA9034_ID_LDO14,
58 DA9034_ID_LDO15,
59};
60
61/*
62 * DA9030/DA9034 LEDs sub-devices uses generic "struct led_info"
63 * as the platform_data
64 */
65
66/* DA9030 flags for "struct led_info"
67 */
68#define DA9030_LED_RATE_ON (0 << 5)
69#define DA9030_LED_RATE_052S (1 << 5)
70#define DA9030_LED_DUTY_1_16 (0 << 3)
71#define DA9030_LED_DUTY_1_8 (1 << 3)
72#define DA9030_LED_DUTY_1_4 (2 << 3)
73#define DA9030_LED_DUTY_1_2 (3 << 3)
74
75#define DA9030_VIBRA_MODE_1P3V (0 << 1)
76#define DA9030_VIBRA_MODE_2P7V (1 << 1)
77#define DA9030_VIBRA_FREQ_1HZ (0 << 2)
78#define DA9030_VIBRA_FREQ_2HZ (1 << 2)
79#define DA9030_VIBRA_FREQ_4HZ (2 << 2)
80#define DA9030_VIBRA_FREQ_8HZ (3 << 2)
81#define DA9030_VIBRA_DUTY_ON (0 << 4)
82#define DA9030_VIBRA_DUTY_75P (1 << 4)
83#define DA9030_VIBRA_DUTY_50P (2 << 4)
84#define DA9030_VIBRA_DUTY_25P (3 << 4)
85
86/* DA9034 flags for "struct led_info" */
87#define DA9034_LED_RAMP (1 << 7)
88
89/* DA9034 touch screen platform data */
90struct da9034_touch_pdata {
91 int interval_ms; /* sampling interval while pen down */
92 int x_inverted;
93 int y_inverted;
94};
95
96struct da903x_subdev_info {
97 int id;
98 const char *name;
99 void *platform_data;
100};
101
102struct da903x_platform_data {
103 int num_subdevs;
104 struct da903x_subdev_info *subdevs;
105};
106
107/* bit definitions for DA9030 events */
108#define DA9030_EVENT_ONKEY (1 << 0)
109#define DA9030_EVENT_PWREN (1 << 1)
110#define DA9030_EVENT_EXTON (1 << 2)
111#define DA9030_EVENT_CHDET (1 << 3)
112#define DA9030_EVENT_TBAT (1 << 4)
113#define DA9030_EVENT_VBATMON (1 << 5)
114#define DA9030_EVENT_VBATMON_TXON (1 << 6)
115#define DA9030_EVENT_CHIOVER (1 << 7)
116#define DA9030_EVENT_TCTO (1 << 8)
117#define DA9030_EVENT_CCTO (1 << 9)
118#define DA9030_EVENT_ADC_READY (1 << 10)
119#define DA9030_EVENT_VBUS_4P4 (1 << 11)
120#define DA9030_EVENT_VBUS_4P0 (1 << 12)
121#define DA9030_EVENT_SESS_VALID (1 << 13)
122#define DA9030_EVENT_SRP_DETECT (1 << 14)
123#define DA9030_EVENT_WATCHDOG (1 << 15)
124#define DA9030_EVENT_LDO15 (1 << 16)
125#define DA9030_EVENT_LDO16 (1 << 17)
126#define DA9030_EVENT_LDO17 (1 << 18)
127#define DA9030_EVENT_LDO18 (1 << 19)
128#define DA9030_EVENT_LDO19 (1 << 20)
129#define DA9030_EVENT_BUCK2 (1 << 21)
130
131/* bit definitions for DA9034 events */
132#define DA9034_EVENT_ONKEY (1 << 0)
133#define DA9034_EVENT_EXTON (1 << 2)
134#define DA9034_EVENT_CHDET (1 << 3)
135#define DA9034_EVENT_TBAT (1 << 4)
136#define DA9034_EVENT_VBATMON (1 << 5)
137#define DA9034_EVENT_REV_IOVER (1 << 6)
138#define DA9034_EVENT_CH_IOVER (1 << 7)
139#define DA9034_EVENT_CH_TCTO (1 << 8)
140#define DA9034_EVENT_CH_CCTO (1 << 9)
141#define DA9034_EVENT_USB_DEV (1 << 10)
142#define DA9034_EVENT_OTGCP_IOVER (1 << 11)
143#define DA9034_EVENT_VBUS_4P55 (1 << 12)
144#define DA9034_EVENT_VBUS_3P8 (1 << 13)
145#define DA9034_EVENT_SESS_1P8 (1 << 14)
146#define DA9034_EVENT_SRP_READY (1 << 15)
147#define DA9034_EVENT_ADC_MAN (1 << 16)
148#define DA9034_EVENT_ADC_AUTO4 (1 << 17)
149#define DA9034_EVENT_ADC_AUTO5 (1 << 18)
150#define DA9034_EVENT_ADC_AUTO6 (1 << 19)
151#define DA9034_EVENT_PEN_DOWN (1 << 20)
152#define DA9034_EVENT_TSI_READY (1 << 21)
153#define DA9034_EVENT_UART_TX (1 << 22)
154#define DA9034_EVENT_UART_RX (1 << 23)
155#define DA9034_EVENT_HEADSET (1 << 25)
156#define DA9034_EVENT_HOOKSWITCH (1 << 26)
157#define DA9034_EVENT_WATCHDOG (1 << 27)
158
159extern int da903x_register_notifier(struct device *dev,
160 struct notifier_block *nb, unsigned int events);
161extern int da903x_unregister_notifier(struct device *dev,
162 struct notifier_block *nb, unsigned int events);
163
164/* Status Query Interface */
165#define DA9030_STATUS_ONKEY (1 << 0)
166#define DA9030_STATUS_PWREN1 (1 << 1)
167#define DA9030_STATUS_EXTON (1 << 2)
168#define DA9030_STATUS_CHDET (1 << 3)
169#define DA9030_STATUS_TBAT (1 << 4)
170#define DA9030_STATUS_VBATMON (1 << 5)
171#define DA9030_STATUS_VBATMON_TXON (1 << 6)
172#define DA9030_STATUS_MCLKDET (1 << 7)
173
174#define DA9034_STATUS_ONKEY (1 << 0)
175#define DA9034_STATUS_EXTON (1 << 2)
176#define DA9034_STATUS_CHDET (1 << 3)
177#define DA9034_STATUS_TBAT (1 << 4)
178#define DA9034_STATUS_VBATMON (1 << 5)
179#define DA9034_STATUS_PEN_DOWN (1 << 6)
180#define DA9034_STATUS_MCLKDET (1 << 7)
181#define DA9034_STATUS_USB_DEV (1 << 8)
182#define DA9034_STATUS_HEADSET (1 << 9)
183#define DA9034_STATUS_HOOKSWITCH (1 << 10)
184#define DA9034_STATUS_REMCON (1 << 11)
185#define DA9034_STATUS_VBUS_VALID_4P55 (1 << 12)
186#define DA9034_STATUS_VBUS_VALID_3P8 (1 << 13)
187#define DA9034_STATUS_SESS_VALID_1P8 (1 << 14)
188#define DA9034_STATUS_SRP_READY (1 << 15)
189
190extern int da903x_query_status(struct device *dev, unsigned int status);
191
192
193/* NOTE: the two functions below are not intended for use outside
194 * of the DA9034 sub-device drivers
195 */
196extern int da903x_write(struct device *dev, int reg, uint8_t val);
197extern int da903x_read(struct device *dev, int reg, uint8_t *val);
198extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
199extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
200extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
201#endif /* __LINUX_PMIC_DA903X_H */
diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h
index e83c7f2036f9..b4629818aea5 100644
--- a/include/linux/mfd/t7l66xb.h
+++ b/include/linux/mfd/t7l66xb.h
@@ -15,8 +15,6 @@
15#include <linux/mfd/tmio.h> 15#include <linux/mfd/tmio.h>
16 16
17struct t7l66xb_platform_data { 17struct t7l66xb_platform_data {
18 int (*enable_clk32k)(struct platform_device *dev);
19 void (*disable_clk32k)(struct platform_device *dev);
20 int (*enable)(struct platform_device *dev); 18 int (*enable)(struct platform_device *dev);
21 int (*disable)(struct platform_device *dev); 19 int (*disable)(struct platform_device *dev);
22 int (*suspend)(struct platform_device *dev); 20 int (*suspend)(struct platform_device *dev);
diff --git a/include/linux/mfd/tc6387xb.h b/include/linux/mfd/tc6387xb.h
index fa06e0610b8e..b4888209494a 100644
--- a/include/linux/mfd/tc6387xb.h
+++ b/include/linux/mfd/tc6387xb.h
@@ -11,9 +11,6 @@
11#define MFD_TC6387XB_H 11#define MFD_TC6387XB_H
12 12
13struct tc6387xb_platform_data { 13struct tc6387xb_platform_data {
14 int (*enable_clk32k)(struct platform_device *dev);
15 void (*disable_clk32k)(struct platform_device *dev);
16
17 int (*enable)(struct platform_device *dev); 14 int (*enable)(struct platform_device *dev);
18 int (*disable)(struct platform_device *dev); 15 int (*disable)(struct platform_device *dev);
19 int (*suspend)(struct platform_device *dev); 16 int (*suspend)(struct platform_device *dev);
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h
index fec7b3f7a81f..626e448205c5 100644
--- a/include/linux/mfd/tc6393xb.h
+++ b/include/linux/mfd/tc6393xb.h
@@ -17,12 +17,12 @@
17#ifndef MFD_TC6393XB_H 17#ifndef MFD_TC6393XB_H
18#define MFD_TC6393XB_H 18#define MFD_TC6393XB_H
19 19
20#include <linux/fb.h>
21
20/* Also one should provide the CK3P6MI clock */ 22/* Also one should provide the CK3P6MI clock */
21struct tc6393xb_platform_data { 23struct tc6393xb_platform_data {
22 u16 scr_pll2cr; /* PLL2 Control */ 24 u16 scr_pll2cr; /* PLL2 Control */
23 u16 scr_gper; /* GP Enable */ 25 u16 scr_gper; /* GP Enable */
24 u32 scr_gpo_doecr; /* GPO Data OE Control */
25 u32 scr_gpo_dsr; /* GPO Data Set */
26 26
27 int (*enable)(struct platform_device *dev); 27 int (*enable)(struct platform_device *dev);
28 int (*disable)(struct platform_device *dev); 28 int (*disable)(struct platform_device *dev);
@@ -31,15 +31,28 @@ struct tc6393xb_platform_data {
31 31
32 int irq_base; /* base for subdevice irqs */ 32 int irq_base; /* base for subdevice irqs */
33 int gpio_base; 33 int gpio_base;
34 int (*setup)(struct platform_device *dev);
35 void (*teardown)(struct platform_device *dev);
34 36
35 struct tmio_nand_data *nand_data; 37 struct tmio_nand_data *nand_data;
38 struct tmio_fb_data *fb_data;
39
40 unsigned resume_restore : 1; /* make special actions
41 to preserve the state
42 on suspend/resume */
36}; 43};
37 44
45extern int tc6393xb_lcd_mode(struct platform_device *fb,
46 const struct fb_videomode *mode);
47extern int tc6393xb_lcd_set_power(struct platform_device *fb, bool on);
48
38/* 49/*
39 * Relative to irq_base 50 * Relative to irq_base
40 */ 51 */
41#define IRQ_TC6393_NAND 0 52#define IRQ_TC6393_NAND 0
42#define IRQ_TC6393_MMC 1 53#define IRQ_TC6393_MMC 1
54#define IRQ_TC6393_OHCI 2
55#define IRQ_TC6393_FB 4
43 56
44#define TC6393XB_NR_IRQS 8 57#define TC6393XB_NR_IRQS 8
45 58
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index ec612e66391c..516d955ab8a1 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -1,6 +1,8 @@
1#ifndef MFD_TMIO_H 1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H 2#define MFD_TMIO_H
3 3
4#include <linux/fb.h>
5
4#define tmio_ioread8(addr) readb(addr) 6#define tmio_ioread8(addr) readb(addr)
5#define tmio_ioread16(addr) readw(addr) 7#define tmio_ioread16(addr) readw(addr)
6#define tmio_ioread16_rep(r, b, l) readsw(r, b, l) 8#define tmio_ioread16_rep(r, b, l) readsw(r, b, l)
@@ -25,4 +27,21 @@ struct tmio_nand_data {
25 unsigned int num_partitions; 27 unsigned int num_partitions;
26}; 28};
27 29
30#define FBIO_TMIO_ACC_WRITE 0x7C639300
31#define FBIO_TMIO_ACC_SYNC 0x7C639301
32
33struct tmio_fb_data {
34 int (*lcd_set_power)(struct platform_device *fb_dev,
35 bool on);
36 int (*lcd_mode)(struct platform_device *fb_dev,
37 const struct fb_videomode *mode);
38 int num_modes;
39 struct fb_videomode *modes;
40
41 /* in mm: size of screen */
42 int height;
43 int width;
44};
45
46
28#endif 47#endif
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
new file mode 100644
index 000000000000..217bb22ebb8e
--- /dev/null
+++ b/include/linux/mfd/wm8350/audio.h
@@ -0,0 +1,598 @@
1/*
2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_AUDIO_H_
14#define __LINUX_MFD_WM8350_AUDIO_H_
15
16#include <linux/platform_device.h>
17
18#define WM8350_CLOCK_CONTROL_1 0x28
19#define WM8350_CLOCK_CONTROL_2 0x29
20#define WM8350_FLL_CONTROL_1 0x2A
21#define WM8350_FLL_CONTROL_2 0x2B
22#define WM8350_FLL_CONTROL_3 0x2C
23#define WM8350_FLL_CONTROL_4 0x2D
24#define WM8350_DAC_CONTROL 0x30
25#define WM8350_DAC_DIGITAL_VOLUME_L 0x32
26#define WM8350_DAC_DIGITAL_VOLUME_R 0x33
27#define WM8350_DAC_LR_RATE 0x35
28#define WM8350_DAC_CLOCK_CONTROL 0x36
29#define WM8350_DAC_MUTE 0x3A
30#define WM8350_DAC_MUTE_VOLUME 0x3B
31#define WM8350_DAC_SIDE 0x3C
32#define WM8350_ADC_CONTROL 0x40
33#define WM8350_ADC_DIGITAL_VOLUME_L 0x42
34#define WM8350_ADC_DIGITAL_VOLUME_R 0x43
35#define WM8350_ADC_DIVIDER 0x44
36#define WM8350_ADC_LR_RATE 0x46
37#define WM8350_INPUT_CONTROL 0x48
38#define WM8350_IN3_INPUT_CONTROL 0x49
39#define WM8350_MIC_BIAS_CONTROL 0x4A
40#define WM8350_OUTPUT_CONTROL 0x4C
41#define WM8350_JACK_DETECT 0x4D
42#define WM8350_ANTI_POP_CONTROL 0x4E
43#define WM8350_LEFT_INPUT_VOLUME 0x50
44#define WM8350_RIGHT_INPUT_VOLUME 0x51
45#define WM8350_LEFT_MIXER_CONTROL 0x58
46#define WM8350_RIGHT_MIXER_CONTROL 0x59
47#define WM8350_OUT3_MIXER_CONTROL 0x5C
48#define WM8350_OUT4_MIXER_CONTROL 0x5D
49#define WM8350_OUTPUT_LEFT_MIXER_VOLUME 0x60
50#define WM8350_OUTPUT_RIGHT_MIXER_VOLUME 0x61
51#define WM8350_INPUT_MIXER_VOLUME_L 0x62
52#define WM8350_INPUT_MIXER_VOLUME_R 0x63
53#define WM8350_INPUT_MIXER_VOLUME 0x64
54#define WM8350_LOUT1_VOLUME 0x68
55#define WM8350_ROUT1_VOLUME 0x69
56#define WM8350_LOUT2_VOLUME 0x6A
57#define WM8350_ROUT2_VOLUME 0x6B
58#define WM8350_BEEP_VOLUME 0x6F
59#define WM8350_AI_FORMATING 0x70
60#define WM8350_ADC_DAC_COMP 0x71
61#define WM8350_AI_ADC_CONTROL 0x72
62#define WM8350_AI_DAC_CONTROL 0x73
63#define WM8350_AIF_TEST 0x74
64#define WM8350_JACK_PIN_STATUS 0xE7
65
66/* Bit values for R08 (0x08) */
67#define WM8350_CODEC_ISEL_1_5 0 /* x1.5 */
68#define WM8350_CODEC_ISEL_1_0 1 /* x1.0 */
69#define WM8350_CODEC_ISEL_0_75 2 /* x0.75 */
70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
71
72#define WM8350_VMID_OFF 0
73#define WM8350_VMID_500K 1
74#define WM8350_VMID_100K 2
75#define WM8350_VMID_10K 3
76
77/*
78 * R40 (0x28) - Clock Control 1
79 */
80#define WM8350_TOCLK_RATE 0x4000
81#define WM8350_MCLK_SEL 0x0800
82#define WM8350_MCLK_DIV_MASK 0x0100
83#define WM8350_BCLK_DIV_MASK 0x00F0
84#define WM8350_OPCLK_DIV_MASK 0x0007
85
86/*
87 * R41 (0x29) - Clock Control 2
88 */
89#define WM8350_LRC_ADC_SEL 0x8000
90#define WM8350_MCLK_DIR 0x0001
91
92/*
93 * R42 (0x2A) - FLL Control 1
94 */
95#define WM8350_FLL_DITHER_WIDTH_MASK 0x3000
96#define WM8350_FLL_DITHER_HP 0x0800
97#define WM8350_FLL_OUTDIV_MASK 0x0700
98#define WM8350_FLL_RSP_RATE_MASK 0x00F0
99#define WM8350_FLL_RATE_MASK 0x0007
100
101/*
102 * R43 (0x2B) - FLL Control 2
103 */
104#define WM8350_FLL_RATIO_MASK 0xF800
105#define WM8350_FLL_N_MASK 0x03FF
106
107/*
108 * R44 (0x2C) - FLL Control 3
109 */
110#define WM8350_FLL_K_MASK 0xFFFF
111
112/*
113 * R45 (0x2D) - FLL Control 4
114 */
115#define WM8350_FLL_FRAC 0x0020
116#define WM8350_FLL_SLOW_LOCK_REF 0x0010
117#define WM8350_FLL_CLK_SRC_MASK 0x0003
118
119/*
120 * R48 (0x30) - DAC Control
121 */
122#define WM8350_DAC_MONO 0x2000
123#define WM8350_AIF_LRCLKRATE 0x1000
124#define WM8350_DEEMP_MASK 0x0030
125#define WM8350_DACL_DATINV 0x0002
126#define WM8350_DACR_DATINV 0x0001
127
128/*
129 * R50 (0x32) - DAC Digital Volume L
130 */
131#define WM8350_DAC_VU 0x0100
132#define WM8350_DACL_VOL_MASK 0x00FF
133
134/*
135 * R51 (0x33) - DAC Digital Volume R
136 */
137#define WM8350_DAC_VU 0x0100
138#define WM8350_DACR_VOL_MASK 0x00FF
139
140/*
141 * R53 (0x35) - DAC LR Rate
142 */
143#define WM8350_DACLRC_ENA 0x0800
144#define WM8350_DACLRC_RATE_MASK 0x07FF
145
146/*
147 * R54 (0x36) - DAC Clock Control
148 */
149#define WM8350_DACCLK_POL 0x0010
150#define WM8350_DAC_CLKDIV_MASK 0x0007
151
152/*
153 * R58 (0x3A) - DAC Mute
154 */
155#define WM8350_DAC_MUTE_ENA 0x4000
156
157/*
158 * R59 (0x3B) - DAC Mute Volume
159 */
160#define WM8350_DAC_MUTEMODE 0x4000
161#define WM8350_DAC_MUTERATE 0x2000
162#define WM8350_DAC_SB_FILT 0x1000
163
164/*
165 * R60 (0x3C) - DAC Side
166 */
167#define WM8350_ADC_TO_DACL_MASK 0x3000
168#define WM8350_ADC_TO_DACR_MASK 0x0C00
169
170/*
171 * R64 (0x40) - ADC Control
172 */
173#define WM8350_ADC_HPF_CUT_MASK 0x0300
174#define WM8350_ADCL_DATINV 0x0002
175#define WM8350_ADCR_DATINV 0x0001
176
177/*
178 * R66 (0x42) - ADC Digital Volume L
179 */
180#define WM8350_ADC_VU 0x0100
181#define WM8350_ADCL_VOL_MASK 0x00FF
182
183/*
184 * R67 (0x43) - ADC Digital Volume R
185 */
186#define WM8350_ADC_VU 0x0100
187#define WM8350_ADCR_VOL_MASK 0x00FF
188
189/*
190 * R68 (0x44) - ADC Divider
191 */
192#define WM8350_ADCL_DAC_SVOL_MASK 0x0F00
193#define WM8350_ADCR_DAC_SVOL_MASK 0x00F0
194#define WM8350_ADCCLK_POL 0x0008
195#define WM8350_ADC_CLKDIV_MASK 0x0007
196
197/*
198 * R70 (0x46) - ADC LR Rate
199 */
200#define WM8350_ADCLRC_ENA 0x0800
201#define WM8350_ADCLRC_RATE_MASK 0x07FF
202
203/*
204 * R72 (0x48) - Input Control
205 */
206#define WM8350_IN2R_ENA 0x0400
207#define WM8350_IN1RN_ENA 0x0200
208#define WM8350_IN1RP_ENA 0x0100
209#define WM8350_IN2L_ENA 0x0004
210#define WM8350_IN1LN_ENA 0x0002
211#define WM8350_IN1LP_ENA 0x0001
212
213/*
214 * R73 (0x49) - IN3 Input Control
215 */
216#define WM8350_IN3R_SHORT 0x4000
217#define WM8350_IN3L_SHORT 0x0040
218
219/*
220 * R74 (0x4A) - Mic Bias Control
221 */
222#define WM8350_MICBSEL 0x4000
223#define WM8350_MCDTHR_MASK 0x001C
224#define WM8350_MCDSCTHR_MASK 0x0003
225
226/*
227 * R76 (0x4C) - Output Control
228 */
229#define WM8350_OUT4_VROI 0x0800
230#define WM8350_OUT3_VROI 0x0400
231#define WM8350_OUT2_VROI 0x0200
232#define WM8350_OUT1_VROI 0x0100
233#define WM8350_OUT2_FB 0x0004
234#define WM8350_OUT1_FB 0x0001
235
236/*
237 * R77 (0x4D) - Jack Detect
238 */
239#define WM8350_JDL_ENA 0x8000
240#define WM8350_JDR_ENA 0x4000
241
242/*
243 * R78 (0x4E) - Anti Pop Control
244 */
245#define WM8350_ANTI_POP_MASK 0x0300
246#define WM8350_DIS_OP_LN4_MASK 0x00C0
247#define WM8350_DIS_OP_LN3_MASK 0x0030
248#define WM8350_DIS_OP_OUT2_MASK 0x000C
249#define WM8350_DIS_OP_OUT1_MASK 0x0003
250
251/*
252 * R80 (0x50) - Left Input Volume
253 */
254#define WM8350_INL_MUTE 0x4000
255#define WM8350_INL_ZC 0x2000
256#define WM8350_IN_VU 0x0100
257#define WM8350_INL_VOL_MASK 0x00FC
258
259/*
260 * R81 (0x51) - Right Input Volume
261 */
262#define WM8350_INR_MUTE 0x4000
263#define WM8350_INR_ZC 0x2000
264#define WM8350_IN_VU 0x0100
265#define WM8350_INR_VOL_MASK 0x00FC
266
267/*
268 * R88 (0x58) - Left Mixer Control
269 */
270#define WM8350_DACR_TO_MIXOUTL 0x1000
271#define WM8350_DACL_TO_MIXOUTL 0x0800
272#define WM8350_IN3L_TO_MIXOUTL 0x0004
273#define WM8350_INR_TO_MIXOUTL 0x0002
274#define WM8350_INL_TO_MIXOUTL 0x0001
275
276/*
277 * R89 (0x59) - Right Mixer Control
278 */
279#define WM8350_DACR_TO_MIXOUTR 0x1000
280#define WM8350_DACL_TO_MIXOUTR 0x0800
281#define WM8350_IN3R_TO_MIXOUTR 0x0008
282#define WM8350_INR_TO_MIXOUTR 0x0002
283#define WM8350_INL_TO_MIXOUTR 0x0001
284
285/*
286 * R92 (0x5C) - OUT3 Mixer Control
287 */
288#define WM8350_DACL_TO_OUT3 0x0800
289#define WM8350_MIXINL_TO_OUT3 0x0100
290#define WM8350_OUT4_TO_OUT3 0x0008
291#define WM8350_MIXOUTL_TO_OUT3 0x0001
292
293/*
294 * R93 (0x5D) - OUT4 Mixer Control
295 */
296#define WM8350_DACR_TO_OUT4 0x1000
297#define WM8350_DACL_TO_OUT4 0x0800
298#define WM8350_OUT4_ATTN 0x0400
299#define WM8350_MIXINR_TO_OUT4 0x0200
300#define WM8350_OUT3_TO_OUT4 0x0004
301#define WM8350_MIXOUTR_TO_OUT4 0x0002
302#define WM8350_MIXOUTL_TO_OUT4 0x0001
303
304/*
305 * R96 (0x60) - Output Left Mixer Volume
306 */
307#define WM8350_IN3L_MIXOUTL_VOL_MASK 0x0E00
308#define WM8350_IN3L_MIXOUTL_VOL_SHIFT 9
309#define WM8350_INR_MIXOUTL_VOL_MASK 0x00E0
310#define WM8350_INR_MIXOUTL_VOL_SHIFT 5
311#define WM8350_INL_MIXOUTL_VOL_MASK 0x000E
312#define WM8350_INL_MIXOUTL_VOL_SHIFT 1
313
314/* Bit values for R96 (0x60) */
315#define WM8350_IN3L_MIXOUTL_VOL_OFF 0
316#define WM8350_IN3L_MIXOUTL_VOL_M12DB 1
317#define WM8350_IN3L_MIXOUTL_VOL_M9DB 2
318#define WM8350_IN3L_MIXOUTL_VOL_M6DB 3
319#define WM8350_IN3L_MIXOUTL_VOL_M3DB 4
320#define WM8350_IN3L_MIXOUTL_VOL_0DB 5
321#define WM8350_IN3L_MIXOUTL_VOL_3DB 6
322#define WM8350_IN3L_MIXOUTL_VOL_6DB 7
323
324#define WM8350_INR_MIXOUTL_VOL_OFF 0
325#define WM8350_INR_MIXOUTL_VOL_M12DB 1
326#define WM8350_INR_MIXOUTL_VOL_M9DB 2
327#define WM8350_INR_MIXOUTL_VOL_M6DB 3
328#define WM8350_INR_MIXOUTL_VOL_M3DB 4
329#define WM8350_INR_MIXOUTL_VOL_0DB 5
330#define WM8350_INR_MIXOUTL_VOL_3DB 6
331#define WM8350_INR_MIXOUTL_VOL_6DB 7
332
333#define WM8350_INL_MIXOUTL_VOL_OFF 0
334#define WM8350_INL_MIXOUTL_VOL_M12DB 1
335#define WM8350_INL_MIXOUTL_VOL_M9DB 2
336#define WM8350_INL_MIXOUTL_VOL_M6DB 3
337#define WM8350_INL_MIXOUTL_VOL_M3DB 4
338#define WM8350_INL_MIXOUTL_VOL_0DB 5
339#define WM8350_INL_MIXOUTL_VOL_3DB 6
340#define WM8350_INL_MIXOUTL_VOL_6DB 7
341
342/*
343 * R97 (0x61) - Output Right Mixer Volume
344 */
345#define WM8350_IN3R_MIXOUTR_VOL_MASK 0xE000
346#define WM8350_IN3R_MIXOUTR_VOL_SHIFT 13
347#define WM8350_INR_MIXOUTR_VOL_MASK 0x00E0
348#define WM8350_INR_MIXOUTR_VOL_SHIFT 5
349#define WM8350_INL_MIXOUTR_VOL_MASK 0x000E
350#define WM8350_INL_MIXOUTR_VOL_SHIFT 1
351
352/* Bit values for R96 (0x60) */
353#define WM8350_IN3R_MIXOUTR_VOL_OFF 0
354#define WM8350_IN3R_MIXOUTR_VOL_M12DB 1
355#define WM8350_IN3R_MIXOUTR_VOL_M9DB 2
356#define WM8350_IN3R_MIXOUTR_VOL_M6DB 3
357#define WM8350_IN3R_MIXOUTR_VOL_M3DB 4
358#define WM8350_IN3R_MIXOUTR_VOL_0DB 5
359#define WM8350_IN3R_MIXOUTR_VOL_3DB 6
360#define WM8350_IN3R_MIXOUTR_VOL_6DB 7
361
362#define WM8350_INR_MIXOUTR_VOL_OFF 0
363#define WM8350_INR_MIXOUTR_VOL_M12DB 1
364#define WM8350_INR_MIXOUTR_VOL_M9DB 2
365#define WM8350_INR_MIXOUTR_VOL_M6DB 3
366#define WM8350_INR_MIXOUTR_VOL_M3DB 4
367#define WM8350_INR_MIXOUTR_VOL_0DB 5
368#define WM8350_INR_MIXOUTR_VOL_3DB 6
369#define WM8350_INR_MIXOUTR_VOL_6DB 7
370
371#define WM8350_INL_MIXOUTR_VOL_OFF 0
372#define WM8350_INL_MIXOUTR_VOL_M12DB 1
373#define WM8350_INL_MIXOUTR_VOL_M9DB 2
374#define WM8350_INL_MIXOUTR_VOL_M6DB 3
375#define WM8350_INL_MIXOUTR_VOL_M3DB 4
376#define WM8350_INL_MIXOUTR_VOL_0DB 5
377#define WM8350_INL_MIXOUTR_VOL_3DB 6
378#define WM8350_INL_MIXOUTR_VOL_6DB 7
379
380/*
381 * R98 (0x62) - Input Mixer Volume L
382 */
383#define WM8350_IN3L_MIXINL_VOL_MASK 0x0E00
384#define WM8350_IN2L_MIXINL_VOL_MASK 0x000E
385#define WM8350_INL_MIXINL_VOL 0x0001
386
387/*
388 * R99 (0x63) - Input Mixer Volume R
389 */
390#define WM8350_IN3R_MIXINR_VOL_MASK 0xE000
391#define WM8350_IN2R_MIXINR_VOL_MASK 0x00E0
392#define WM8350_INR_MIXINR_VOL 0x0001
393
394/*
395 * R100 (0x64) - Input Mixer Volume
396 */
397#define WM8350_OUT4_MIXIN_DST 0x8000
398#define WM8350_OUT4_MIXIN_VOL_MASK 0x000E
399
400/*
401 * R104 (0x68) - LOUT1 Volume
402 */
403#define WM8350_OUT1L_MUTE 0x4000
404#define WM8350_OUT1L_ZC 0x2000
405#define WM8350_OUT1_VU 0x0100
406#define WM8350_OUT1L_VOL_MASK 0x00FC
407#define WM8350_OUT1L_VOL_SHIFT 2
408
409/*
410 * R105 (0x69) - ROUT1 Volume
411 */
412#define WM8350_OUT1R_MUTE 0x4000
413#define WM8350_OUT1R_ZC 0x2000
414#define WM8350_OUT1_VU 0x0100
415#define WM8350_OUT1R_VOL_MASK 0x00FC
416#define WM8350_OUT1R_VOL_SHIFT 2
417
418/*
419 * R106 (0x6A) - LOUT2 Volume
420 */
421#define WM8350_OUT2L_MUTE 0x4000
422#define WM8350_OUT2L_ZC 0x2000
423#define WM8350_OUT2_VU 0x0100
424#define WM8350_OUT2L_VOL_MASK 0x00FC
425
426/*
427 * R107 (0x6B) - ROUT2 Volume
428 */
429#define WM8350_OUT2R_MUTE 0x4000
430#define WM8350_OUT2R_ZC 0x2000
431#define WM8350_OUT2R_INV 0x0400
432#define WM8350_OUT2R_INV_MUTE 0x0200
433#define WM8350_OUT2_VU 0x0100
434#define WM8350_OUT2R_VOL_MASK 0x00FC
435
436/*
437 * R111 (0x6F) - BEEP Volume
438 */
439#define WM8350_IN3R_OUT2R_VOL_MASK 0x00E0
440
441/*
442 * R112 (0x70) - AI Formating
443 */
444#define WM8350_AIF_BCLK_INV 0x8000
445#define WM8350_AIF_TRI 0x2000
446#define WM8350_AIF_LRCLK_INV 0x1000
447#define WM8350_AIF_WL_MASK 0x0C00
448#define WM8350_AIF_FMT_MASK 0x0300
449
450/*
451 * R113 (0x71) - ADC DAC COMP
452 */
453#define WM8350_DAC_COMP 0x0080
454#define WM8350_DAC_COMPMODE 0x0040
455#define WM8350_ADC_COMP 0x0020
456#define WM8350_ADC_COMPMODE 0x0010
457#define WM8350_LOOPBACK 0x0001
458
459/*
460 * R114 (0x72) - AI ADC Control
461 */
462#define WM8350_AIFADC_PD 0x0080
463#define WM8350_AIFADCL_SRC 0x0040
464#define WM8350_AIFADCR_SRC 0x0020
465#define WM8350_AIFADC_TDM_CHAN 0x0010
466#define WM8350_AIFADC_TDM 0x0008
467
468/*
469 * R115 (0x73) - AI DAC Control
470 */
471#define WM8350_BCLK_MSTR 0x4000
472#define WM8350_AIFDAC_PD 0x0080
473#define WM8350_DACL_SRC 0x0040
474#define WM8350_DACR_SRC 0x0020
475#define WM8350_AIFDAC_TDM_CHAN 0x0010
476#define WM8350_AIFDAC_TDM 0x0008
477#define WM8350_DAC_BOOST_MASK 0x0003
478
479/*
480 * R116 (0x74) - AIF Test
481 */
482#define WM8350_CODEC_BYP 0x4000
483#define WM8350_AIFADC_WR_TST 0x2000
484#define WM8350_AIFADC_RD_TST 0x1000
485#define WM8350_AIFDAC_WR_TST 0x0800
486#define WM8350_AIFDAC_RD_TST 0x0400
487#define WM8350_AIFADC_ASYN 0x0020
488#define WM8350_AIFDAC_ASYN 0x0010
489
490/*
491 * R231 (0xE7) - Jack Status
492 */
493#define WM8350_JACK_R_LVL 0x0400
494
495/*
496 * WM8350 Platform setup
497 */
498#define WM8350_S_CURVE_NONE 0x0
499#define WM8350_S_CURVE_FAST 0x1
500#define WM8350_S_CURVE_MEDIUM 0x2
501#define WM8350_S_CURVE_SLOW 0x3
502
503#define WM8350_DISCHARGE_OFF 0x0
504#define WM8350_DISCHARGE_FAST 0x1
505#define WM8350_DISCHARGE_MEDIUM 0x2
506#define WM8350_DISCHARGE_SLOW 0x3
507
508#define WM8350_TIE_OFF_500R 0x0
509#define WM8350_TIE_OFF_30K 0x1
510
511/*
512 * Clock sources & directions
513 */
514#define WM8350_SYSCLK 0
515
516#define WM8350_MCLK_SEL_PLL_MCLK 0
517#define WM8350_MCLK_SEL_PLL_DAC 1
518#define WM8350_MCLK_SEL_PLL_ADC 2
519#define WM8350_MCLK_SEL_PLL_32K 3
520#define WM8350_MCLK_SEL_MCLK 5
521
522#define WM8350_MCLK_DIR_OUT 0
523#define WM8350_MCLK_DIR_IN 1
524
525/* clock divider id's */
526#define WM8350_ADC_CLKDIV 0
527#define WM8350_DAC_CLKDIV 1
528#define WM8350_BCLK_CLKDIV 2
529#define WM8350_OPCLK_CLKDIV 3
530#define WM8350_TO_CLKDIV 4
531#define WM8350_SYS_CLKDIV 5
532#define WM8350_DACLR_CLKDIV 6
533#define WM8350_ADCLR_CLKDIV 7
534
535/* ADC clock dividers */
536#define WM8350_ADCDIV_1 0x0
537#define WM8350_ADCDIV_1_5 0x1
538#define WM8350_ADCDIV_2 0x2
539#define WM8350_ADCDIV_3 0x3
540#define WM8350_ADCDIV_4 0x4
541#define WM8350_ADCDIV_5_5 0x5
542#define WM8350_ADCDIV_6 0x6
543
544/* ADC clock dividers */
545#define WM8350_DACDIV_1 0x0
546#define WM8350_DACDIV_1_5 0x1
547#define WM8350_DACDIV_2 0x2
548#define WM8350_DACDIV_3 0x3
549#define WM8350_DACDIV_4 0x4
550#define WM8350_DACDIV_5_5 0x5
551#define WM8350_DACDIV_6 0x6
552
553/* BCLK clock dividers */
554#define WM8350_BCLK_DIV_1 (0x0 << 4)
555#define WM8350_BCLK_DIV_1_5 (0x1 << 4)
556#define WM8350_BCLK_DIV_2 (0x2 << 4)
557#define WM8350_BCLK_DIV_3 (0x3 << 4)
558#define WM8350_BCLK_DIV_4 (0x4 << 4)
559#define WM8350_BCLK_DIV_5_5 (0x5 << 4)
560#define WM8350_BCLK_DIV_6 (0x6 << 4)
561#define WM8350_BCLK_DIV_8 (0x7 << 4)
562#define WM8350_BCLK_DIV_11 (0x8 << 4)
563#define WM8350_BCLK_DIV_12 (0x9 << 4)
564#define WM8350_BCLK_DIV_16 (0xa << 4)
565#define WM8350_BCLK_DIV_22 (0xb << 4)
566#define WM8350_BCLK_DIV_24 (0xc << 4)
567#define WM8350_BCLK_DIV_32 (0xd << 4)
568#define WM8350_BCLK_DIV_44 (0xe << 4)
569#define WM8350_BCLK_DIV_48 (0xf << 4)
570
571/* Sys (MCLK) clock dividers */
572#define WM8350_MCLK_DIV_1 (0x0 << 8)
573#define WM8350_MCLK_DIV_2 (0x1 << 8)
574
575/* OP clock dividers */
576#define WM8350_OPCLK_DIV_1 0x0
577#define WM8350_OPCLK_DIV_2 0x1
578#define WM8350_OPCLK_DIV_3 0x2
579#define WM8350_OPCLK_DIV_4 0x3
580#define WM8350_OPCLK_DIV_5_5 0x4
581#define WM8350_OPCLK_DIV_6 0x5
582
583/* DAI ID */
584#define WM8350_HIFI_DAI 0
585
586/*
587 * Audio interrupts.
588 */
589#define WM8350_IRQ_CODEC_JCK_DET_L 39
590#define WM8350_IRQ_CODEC_JCK_DET_R 40
591#define WM8350_IRQ_CODEC_MICSCD 41
592#define WM8350_IRQ_CODEC_MICD 42
593
594struct wm8350_codec {
595 struct platform_device *pdev;
596};
597
598#endif
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
new file mode 100644
index 000000000000..053788649452
--- /dev/null
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -0,0 +1,167 @@
1/*
2 * comparator.h -- Comparator Aux ADC for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_COMPARATOR_H_
13#define __LINUX_MFD_WM8350_COMPARATOR_H_
14
15/*
16 * Registers
17 */
18
19#define WM8350_DIGITISER_CONTROL_1 0x90
20#define WM8350_DIGITISER_CONTROL_2 0x91
21#define WM8350_AUX1_READBACK 0x98
22#define WM8350_AUX2_READBACK 0x99
23#define WM8350_AUX3_READBACK 0x9A
24#define WM8350_AUX4_READBACK 0x9B
25#define WM8350_CHIP_TEMP_READBACK 0x9F
26#define WM8350_GENERIC_COMPARATOR_CONTROL 0xA3
27#define WM8350_GENERIC_COMPARATOR_1 0xA4
28#define WM8350_GENERIC_COMPARATOR_2 0xA5
29#define WM8350_GENERIC_COMPARATOR_3 0xA6
30#define WM8350_GENERIC_COMPARATOR_4 0xA7
31
32/*
33 * R144 (0x90) - Digitiser Control (1)
34 */
35#define WM8350_AUXADC_CTC 0x4000
36#define WM8350_AUXADC_POLL 0x2000
37#define WM8350_AUXADC_HIB_MODE 0x1000
38#define WM8350_AUXADC_SEL8 0x0080
39#define WM8350_AUXADC_SEL7 0x0040
40#define WM8350_AUXADC_SEL6 0x0020
41#define WM8350_AUXADC_SEL5 0x0010
42#define WM8350_AUXADC_SEL4 0x0008
43#define WM8350_AUXADC_SEL3 0x0004
44#define WM8350_AUXADC_SEL2 0x0002
45#define WM8350_AUXADC_SEL1 0x0001
46
47/*
48 * R145 (0x91) - Digitiser Control (2)
49 */
50#define WM8350_AUXADC_MASKMODE_MASK 0x3000
51#define WM8350_AUXADC_CRATE_MASK 0x0700
52#define WM8350_AUXADC_CAL 0x0004
53#define WM8350_AUX_RBMODE 0x0002
54#define WM8350_AUXADC_WAIT 0x0001
55
56/*
57 * R152 (0x98) - AUX1 Readback
58 */
59#define WM8350_AUXADC_SCALE1_MASK 0x6000
60#define WM8350_AUXADC_REF1 0x1000
61#define WM8350_AUXADC_DATA1_MASK 0x0FFF
62
63/*
64 * R153 (0x99) - AUX2 Readback
65 */
66#define WM8350_AUXADC_SCALE2_MASK 0x6000
67#define WM8350_AUXADC_REF2 0x1000
68#define WM8350_AUXADC_DATA2_MASK 0x0FFF
69
70/*
71 * R154 (0x9A) - AUX3 Readback
72 */
73#define WM8350_AUXADC_SCALE3_MASK 0x6000
74#define WM8350_AUXADC_REF3 0x1000
75#define WM8350_AUXADC_DATA3_MASK 0x0FFF
76
77/*
78 * R155 (0x9B) - AUX4 Readback
79 */
80#define WM8350_AUXADC_SCALE4_MASK 0x6000
81#define WM8350_AUXADC_REF4 0x1000
82#define WM8350_AUXADC_DATA4_MASK 0x0FFF
83
84/*
85 * R156 (0x9C) - USB Voltage Readback
86 */
87#define WM8350_AUXADC_DATA_USB_MASK 0x0FFF
88
89/*
90 * R157 (0x9D) - LINE Voltage Readback
91 */
92#define WM8350_AUXADC_DATA_LINE_MASK 0x0FFF
93
94/*
95 * R158 (0x9E) - BATT Voltage Readback
96 */
97#define WM8350_AUXADC_DATA_BATT_MASK 0x0FFF
98
99/*
100 * R159 (0x9F) - Chip Temp Readback
101 */
102#define WM8350_AUXADC_DATA_CHIPTEMP_MASK 0x0FFF
103
104/*
105 * R163 (0xA3) - Generic Comparator Control
106 */
107#define WM8350_DCMP4_ENA 0x0008
108#define WM8350_DCMP3_ENA 0x0004
109#define WM8350_DCMP2_ENA 0x0002
110#define WM8350_DCMP1_ENA 0x0001
111
112/*
113 * R164 (0xA4) - Generic comparator 1
114 */
115#define WM8350_DCMP1_SRCSEL_MASK 0xE000
116#define WM8350_DCMP1_GT 0x1000
117#define WM8350_DCMP1_THR_MASK 0x0FFF
118
119/*
120 * R165 (0xA5) - Generic comparator 2
121 */
122#define WM8350_DCMP2_SRCSEL_MASK 0xE000
123#define WM8350_DCMP2_GT 0x1000
124#define WM8350_DCMP2_THR_MASK 0x0FFF
125
126/*
127 * R166 (0xA6) - Generic comparator 3
128 */
129#define WM8350_DCMP3_SRCSEL_MASK 0xE000
130#define WM8350_DCMP3_GT 0x1000
131#define WM8350_DCMP3_THR_MASK 0x0FFF
132
133/*
134 * R167 (0xA7) - Generic comparator 4
135 */
136#define WM8350_DCMP4_SRCSEL_MASK 0xE000
137#define WM8350_DCMP4_GT 0x1000
138#define WM8350_DCMP4_THR_MASK 0x0FFF
139
140/*
141 * Interrupts.
142 */
143#define WM8350_IRQ_AUXADC_DATARDY 16
144#define WM8350_IRQ_AUXADC_DCOMP4 17
145#define WM8350_IRQ_AUXADC_DCOMP3 18
146#define WM8350_IRQ_AUXADC_DCOMP2 19
147#define WM8350_IRQ_AUXADC_DCOMP1 20
148#define WM8350_IRQ_SYS_HYST_COMP_FAIL 21
149#define WM8350_IRQ_SYS_CHIP_GT115 22
150#define WM8350_IRQ_SYS_CHIP_GT140 23
151
152/*
153 * USB/2, LINE & BATT = ((VRTC * 2) / 4095)) * 10e6 uV
154 * Where VRTC = 2.7 V
155 */
156#define WM8350_AUX_COEFF 1319
157
158#define WM8350_AUXADC_AUX1 0
159#define WM8350_AUXADC_AUX2 1
160#define WM8350_AUXADC_AUX3 2
161#define WM8350_AUXADC_AUX4 3
162#define WM8350_AUXADC_USB 4
163#define WM8350_AUXADC_LINE 5
164#define WM8350_AUXADC_BATT 6
165#define WM8350_AUXADC_TEMP 7
166
167#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
new file mode 100644
index 000000000000..6ebf97f2a475
--- /dev/null
+++ b/include/linux/mfd/wm8350/core.h
@@ -0,0 +1,631 @@
1/*
2 * core.h -- Core Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_CORE_H_
14#define __LINUX_MFD_WM8350_CORE_H_
15
16#include <linux/kernel.h>
17#include <linux/mutex.h>
18#include <linux/workqueue.h>
19
20#include <linux/mfd/wm8350/audio.h>
21#include <linux/mfd/wm8350/gpio.h>
22#include <linux/mfd/wm8350/pmic.h>
23#include <linux/mfd/wm8350/rtc.h>
24#include <linux/mfd/wm8350/supply.h>
25#include <linux/mfd/wm8350/wdt.h>
26
27/*
28 * Register values.
29 */
30#define WM8350_RESET_ID 0x00
31#define WM8350_ID 0x01
32#define WM8350_SYSTEM_CONTROL_1 0x03
33#define WM8350_SYSTEM_CONTROL_2 0x04
34#define WM8350_SYSTEM_HIBERNATE 0x05
35#define WM8350_INTERFACE_CONTROL 0x06
36#define WM8350_POWER_MGMT_1 0x08
37#define WM8350_POWER_MGMT_2 0x09
38#define WM8350_POWER_MGMT_3 0x0A
39#define WM8350_POWER_MGMT_4 0x0B
40#define WM8350_POWER_MGMT_5 0x0C
41#define WM8350_POWER_MGMT_6 0x0D
42#define WM8350_POWER_MGMT_7 0x0E
43
44#define WM8350_SYSTEM_INTERRUPTS 0x18
45#define WM8350_INT_STATUS_1 0x19
46#define WM8350_INT_STATUS_2 0x1A
47#define WM8350_POWER_UP_INT_STATUS 0x1B
48#define WM8350_UNDER_VOLTAGE_INT_STATUS 0x1C
49#define WM8350_OVER_CURRENT_INT_STATUS 0x1D
50#define WM8350_GPIO_INT_STATUS 0x1E
51#define WM8350_COMPARATOR_INT_STATUS 0x1F
52#define WM8350_SYSTEM_INTERRUPTS_MASK 0x20
53#define WM8350_INT_STATUS_1_MASK 0x21
54#define WM8350_INT_STATUS_2_MASK 0x22
55#define WM8350_POWER_UP_INT_STATUS_MASK 0x23
56#define WM8350_UNDER_VOLTAGE_INT_STATUS_MASK 0x24
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
60
61#define WM8350_MAX_REGISTER 0xFF
62
63/*
64 * Field Definitions.
65 */
66
67/*
68 * R0 (0x00) - Reset/ID
69 */
70#define WM8350_SW_RESET_CHIP_ID_MASK 0xFFFF
71
72/*
73 * R1 (0x01) - ID
74 */
75#define WM8350_CHIP_REV_MASK 0x7000
76#define WM8350_CONF_STS_MASK 0x0C00
77#define WM8350_CUST_ID_MASK 0x00FF
78
79/*
80 * R3 (0x03) - System Control 1
81 */
82#define WM8350_CHIP_ON 0x8000
83#define WM8350_POWERCYCLE 0x2000
84#define WM8350_VCC_FAULT_OV 0x1000
85#define WM8350_REG_RSTB_TIME_MASK 0x0C00
86#define WM8350_BG_SLEEP 0x0200
87#define WM8350_MEM_VALID 0x0020
88#define WM8350_CHIP_SET_UP 0x0010
89#define WM8350_ON_DEB_T 0x0008
90#define WM8350_ON_POL 0x0002
91#define WM8350_IRQ_POL 0x0001
92
93/*
94 * R4 (0x04) - System Control 2
95 */
96#define WM8350_USB_SUSPEND_8MA 0x8000
97#define WM8350_USB_SUSPEND 0x4000
98#define WM8350_USB_MSTR 0x2000
99#define WM8350_USB_MSTR_SRC 0x1000
100#define WM8350_USB_500MA 0x0800
101#define WM8350_USB_NOLIM 0x0400
102
103/*
104 * R5 (0x05) - System Hibernate
105 */
106#define WM8350_HIBERNATE 0x8000
107#define WM8350_WDOG_HIB_MODE 0x0080
108#define WM8350_REG_HIB_STARTUP_SEQ 0x0040
109#define WM8350_REG_RESET_HIB_MODE 0x0020
110#define WM8350_RST_HIB_MODE 0x0010
111#define WM8350_IRQ_HIB_MODE 0x0008
112#define WM8350_MEMRST_HIB_MODE 0x0004
113#define WM8350_PCCOMP_HIB_MODE 0x0002
114#define WM8350_TEMPMON_HIB_MODE 0x0001
115
116/*
117 * R6 (0x06) - Interface Control
118 */
119#define WM8350_USE_DEV_PINS 0x8000
120#define WM8350_USE_DEV_PINS_MASK 0x8000
121#define WM8350_USE_DEV_PINS_SHIFT 15
122#define WM8350_DEV_ADDR_MASK 0x6000
123#define WM8350_DEV_ADDR_SHIFT 13
124#define WM8350_CONFIG_DONE 0x1000
125#define WM8350_CONFIG_DONE_MASK 0x1000
126#define WM8350_CONFIG_DONE_SHIFT 12
127#define WM8350_RECONFIG_AT_ON 0x0800
128#define WM8350_RECONFIG_AT_ON_MASK 0x0800
129#define WM8350_RECONFIG_AT_ON_SHIFT 11
130#define WM8350_AUTOINC 0x0200
131#define WM8350_AUTOINC_MASK 0x0200
132#define WM8350_AUTOINC_SHIFT 9
133#define WM8350_ARA 0x0100
134#define WM8350_ARA_MASK 0x0100
135#define WM8350_ARA_SHIFT 8
136#define WM8350_SPI_CFG 0x0008
137#define WM8350_SPI_CFG_MASK 0x0008
138#define WM8350_SPI_CFG_SHIFT 3
139#define WM8350_SPI_4WIRE 0x0004
140#define WM8350_SPI_4WIRE_MASK 0x0004
141#define WM8350_SPI_4WIRE_SHIFT 2
142#define WM8350_SPI_3WIRE 0x0002
143#define WM8350_SPI_3WIRE_MASK 0x0002
144#define WM8350_SPI_3WIRE_SHIFT 1
145
146/* Bit values for R06 (0x06) */
147#define WM8350_USE_DEV_PINS_PRIMARY 0
148#define WM8350_USE_DEV_PINS_DEV 1
149
150#define WM8350_DEV_ADDR_34 0
151#define WM8350_DEV_ADDR_36 1
152#define WM8350_DEV_ADDR_3C 2
153#define WM8350_DEV_ADDR_3E 3
154
155#define WM8350_CONFIG_DONE_OFF 0
156#define WM8350_CONFIG_DONE_DONE 1
157
158#define WM8350_RECONFIG_AT_ON_OFF 0
159#define WM8350_RECONFIG_AT_ON_ON 1
160
161#define WM8350_AUTOINC_OFF 0
162#define WM8350_AUTOINC_ON 1
163
164#define WM8350_ARA_OFF 0
165#define WM8350_ARA_ON 1
166
167#define WM8350_SPI_CFG_CMOS 0
168#define WM8350_SPI_CFG_OD 1
169
170#define WM8350_SPI_4WIRE_3WIRE 0
171#define WM8350_SPI_4WIRE_4WIRE 1
172
173#define WM8350_SPI_3WIRE_I2C 0
174#define WM8350_SPI_3WIRE_SPI 1
175
176/*
177 * R8 (0x08) - Power mgmt (1)
178 */
179#define WM8350_CODEC_ISEL_MASK 0xC000
180#define WM8350_VBUFEN 0x2000
181#define WM8350_OUTPUT_DRAIN_EN 0x0400
182#define WM8350_MIC_DET_ENA 0x0100
183#define WM8350_BIASEN 0x0020
184#define WM8350_MICBEN 0x0010
185#define WM8350_VMIDEN 0x0004
186#define WM8350_VMID_MASK 0x0003
187#define WM8350_VMID_SHIFT 0
188
189/*
190 * R9 (0x09) - Power mgmt (2)
191 */
192#define WM8350_IN3R_ENA 0x0800
193#define WM8350_IN3L_ENA 0x0400
194#define WM8350_INR_ENA 0x0200
195#define WM8350_INL_ENA 0x0100
196#define WM8350_MIXINR_ENA 0x0080
197#define WM8350_MIXINL_ENA 0x0040
198#define WM8350_OUT4_ENA 0x0020
199#define WM8350_OUT3_ENA 0x0010
200#define WM8350_MIXOUTR_ENA 0x0002
201#define WM8350_MIXOUTL_ENA 0x0001
202
203/*
204 * R10 (0x0A) - Power mgmt (3)
205 */
206#define WM8350_IN3R_TO_OUT2R 0x0080
207#define WM8350_OUT2R_ENA 0x0008
208#define WM8350_OUT2L_ENA 0x0004
209#define WM8350_OUT1R_ENA 0x0002
210#define WM8350_OUT1L_ENA 0x0001
211
212/*
213 * R11 (0x0B) - Power mgmt (4)
214 */
215#define WM8350_SYSCLK_ENA 0x4000
216#define WM8350_ADC_HPF_ENA 0x2000
217#define WM8350_FLL_ENA 0x0800
218#define WM8350_FLL_OSC_ENA 0x0400
219#define WM8350_TOCLK_ENA 0x0100
220#define WM8350_DACR_ENA 0x0020
221#define WM8350_DACL_ENA 0x0010
222#define WM8350_ADCR_ENA 0x0008
223#define WM8350_ADCL_ENA 0x0004
224
225/*
226 * R12 (0x0C) - Power mgmt (5)
227 */
228#define WM8350_CODEC_ENA 0x1000
229#define WM8350_RTC_TICK_ENA 0x0800
230#define WM8350_OSC32K_ENA 0x0400
231#define WM8350_CHG_ENA 0x0200
232#define WM8350_ACC_DET_ENA 0x0100
233#define WM8350_AUXADC_ENA 0x0080
234#define WM8350_DCMP4_ENA 0x0008
235#define WM8350_DCMP3_ENA 0x0004
236#define WM8350_DCMP2_ENA 0x0002
237#define WM8350_DCMP1_ENA 0x0001
238
239/*
240 * R13 (0x0D) - Power mgmt (6)
241 */
242#define WM8350_LS_ENA 0x8000
243#define WM8350_LDO4_ENA 0x0800
244#define WM8350_LDO3_ENA 0x0400
245#define WM8350_LDO2_ENA 0x0200
246#define WM8350_LDO1_ENA 0x0100
247#define WM8350_DC6_ENA 0x0020
248#define WM8350_DC5_ENA 0x0010
249#define WM8350_DC4_ENA 0x0008
250#define WM8350_DC3_ENA 0x0004
251#define WM8350_DC2_ENA 0x0002
252#define WM8350_DC1_ENA 0x0001
253
254/*
255 * R14 (0x0E) - Power mgmt (7)
256 */
257#define WM8350_CS2_ENA 0x0002
258#define WM8350_CS1_ENA 0x0001
259
260/*
261 * R24 (0x18) - System Interrupts
262 */
263#define WM8350_OC_INT 0x2000
264#define WM8350_UV_INT 0x1000
265#define WM8350_PUTO_INT 0x0800
266#define WM8350_CS_INT 0x0200
267#define WM8350_EXT_INT 0x0100
268#define WM8350_CODEC_INT 0x0080
269#define WM8350_GP_INT 0x0040
270#define WM8350_AUXADC_INT 0x0020
271#define WM8350_RTC_INT 0x0010
272#define WM8350_SYS_INT 0x0008
273#define WM8350_CHG_INT 0x0004
274#define WM8350_USB_INT 0x0002
275#define WM8350_WKUP_INT 0x0001
276
277/*
278 * R25 (0x19) - Interrupt Status 1
279 */
280#define WM8350_CHG_BAT_HOT_EINT 0x8000
281#define WM8350_CHG_BAT_COLD_EINT 0x4000
282#define WM8350_CHG_BAT_FAIL_EINT 0x2000
283#define WM8350_CHG_TO_EINT 0x1000
284#define WM8350_CHG_END_EINT 0x0800
285#define WM8350_CHG_START_EINT 0x0400
286#define WM8350_CHG_FAST_RDY_EINT 0x0200
287#define WM8350_RTC_PER_EINT 0x0080
288#define WM8350_RTC_SEC_EINT 0x0040
289#define WM8350_RTC_ALM_EINT 0x0020
290#define WM8350_CHG_VBATT_LT_3P9_EINT 0x0004
291#define WM8350_CHG_VBATT_LT_3P1_EINT 0x0002
292#define WM8350_CHG_VBATT_LT_2P85_EINT 0x0001
293
294/*
295 * R26 (0x1A) - Interrupt Status 2
296 */
297#define WM8350_CS1_EINT 0x2000
298#define WM8350_CS2_EINT 0x1000
299#define WM8350_USB_LIMIT_EINT 0x0400
300#define WM8350_AUXADC_DATARDY_EINT 0x0100
301#define WM8350_AUXADC_DCOMP4_EINT 0x0080
302#define WM8350_AUXADC_DCOMP3_EINT 0x0040
303#define WM8350_AUXADC_DCOMP2_EINT 0x0020
304#define WM8350_AUXADC_DCOMP1_EINT 0x0010
305#define WM8350_SYS_HYST_COMP_FAIL_EINT 0x0008
306#define WM8350_SYS_CHIP_GT115_EINT 0x0004
307#define WM8350_SYS_CHIP_GT140_EINT 0x0002
308#define WM8350_SYS_WDOG_TO_EINT 0x0001
309
310/*
311 * R27 (0x1B) - Power Up Interrupt Status
312 */
313#define WM8350_PUTO_LDO4_EINT 0x0800
314#define WM8350_PUTO_LDO3_EINT 0x0400
315#define WM8350_PUTO_LDO2_EINT 0x0200
316#define WM8350_PUTO_LDO1_EINT 0x0100
317#define WM8350_PUTO_DC6_EINT 0x0020
318#define WM8350_PUTO_DC5_EINT 0x0010
319#define WM8350_PUTO_DC4_EINT 0x0008
320#define WM8350_PUTO_DC3_EINT 0x0004
321#define WM8350_PUTO_DC2_EINT 0x0002
322#define WM8350_PUTO_DC1_EINT 0x0001
323
324/*
325 * R28 (0x1C) - Under Voltage Interrupt status
326 */
327#define WM8350_UV_LDO4_EINT 0x0800
328#define WM8350_UV_LDO3_EINT 0x0400
329#define WM8350_UV_LDO2_EINT 0x0200
330#define WM8350_UV_LDO1_EINT 0x0100
331#define WM8350_UV_DC6_EINT 0x0020
332#define WM8350_UV_DC5_EINT 0x0010
333#define WM8350_UV_DC4_EINT 0x0008
334#define WM8350_UV_DC3_EINT 0x0004
335#define WM8350_UV_DC2_EINT 0x0002
336#define WM8350_UV_DC1_EINT 0x0001
337
338/*
339 * R29 (0x1D) - Over Current Interrupt status
340 */
341#define WM8350_OC_LS_EINT 0x8000
342
343/*
344 * R30 (0x1E) - GPIO Interrupt Status
345 */
346#define WM8350_GP12_EINT 0x1000
347#define WM8350_GP11_EINT 0x0800
348#define WM8350_GP10_EINT 0x0400
349#define WM8350_GP9_EINT 0x0200
350#define WM8350_GP8_EINT 0x0100
351#define WM8350_GP7_EINT 0x0080
352#define WM8350_GP6_EINT 0x0040
353#define WM8350_GP5_EINT 0x0020
354#define WM8350_GP4_EINT 0x0010
355#define WM8350_GP3_EINT 0x0008
356#define WM8350_GP2_EINT 0x0004
357#define WM8350_GP1_EINT 0x0002
358#define WM8350_GP0_EINT 0x0001
359
360/*
361 * R31 (0x1F) - Comparator Interrupt Status
362 */
363#define WM8350_EXT_USB_FB_EINT 0x8000
364#define WM8350_EXT_WALL_FB_EINT 0x4000
365#define WM8350_EXT_BAT_FB_EINT 0x2000
366#define WM8350_CODEC_JCK_DET_L_EINT 0x0800
367#define WM8350_CODEC_JCK_DET_R_EINT 0x0400
368#define WM8350_CODEC_MICSCD_EINT 0x0200
369#define WM8350_CODEC_MICD_EINT 0x0100
370#define WM8350_WKUP_OFF_STATE_EINT 0x0040
371#define WM8350_WKUP_HIB_STATE_EINT 0x0020
372#define WM8350_WKUP_CONV_FAULT_EINT 0x0010
373#define WM8350_WKUP_WDOG_RST_EINT 0x0008
374#define WM8350_WKUP_GP_PWR_ON_EINT 0x0004
375#define WM8350_WKUP_ONKEY_EINT 0x0002
376#define WM8350_WKUP_GP_WAKEUP_EINT 0x0001
377
378/*
379 * R32 (0x20) - System Interrupts Mask
380 */
381#define WM8350_IM_OC_INT 0x2000
382#define WM8350_IM_UV_INT 0x1000
383#define WM8350_IM_PUTO_INT 0x0800
384#define WM8350_IM_SPARE_INT 0x0400
385#define WM8350_IM_CS_INT 0x0200
386#define WM8350_IM_EXT_INT 0x0100
387#define WM8350_IM_CODEC_INT 0x0080
388#define WM8350_IM_GP_INT 0x0040
389#define WM8350_IM_AUXADC_INT 0x0020
390#define WM8350_IM_RTC_INT 0x0010
391#define WM8350_IM_SYS_INT 0x0008
392#define WM8350_IM_CHG_INT 0x0004
393#define WM8350_IM_USB_INT 0x0002
394#define WM8350_IM_WKUP_INT 0x0001
395
396/*
397 * R33 (0x21) - Interrupt Status 1 Mask
398 */
399#define WM8350_IM_CHG_BAT_HOT_EINT 0x8000
400#define WM8350_IM_CHG_BAT_COLD_EINT 0x4000
401#define WM8350_IM_CHG_BAT_FAIL_EINT 0x2000
402#define WM8350_IM_CHG_TO_EINT 0x1000
403#define WM8350_IM_CHG_END_EINT 0x0800
404#define WM8350_IM_CHG_START_EINT 0x0400
405#define WM8350_IM_CHG_FAST_RDY_EINT 0x0200
406#define WM8350_IM_RTC_PER_EINT 0x0080
407#define WM8350_IM_RTC_SEC_EINT 0x0040
408#define WM8350_IM_RTC_ALM_EINT 0x0020
409#define WM8350_IM_CHG_VBATT_LT_3P9_EINT 0x0004
410#define WM8350_IM_CHG_VBATT_LT_3P1_EINT 0x0002
411#define WM8350_IM_CHG_VBATT_LT_2P85_EINT 0x0001
412
413/*
414 * R34 (0x22) - Interrupt Status 2 Mask
415 */
416#define WM8350_IM_SPARE2_EINT 0x8000
417#define WM8350_IM_SPARE1_EINT 0x4000
418#define WM8350_IM_CS1_EINT 0x2000
419#define WM8350_IM_CS2_EINT 0x1000
420#define WM8350_IM_USB_LIMIT_EINT 0x0400
421#define WM8350_IM_AUXADC_DATARDY_EINT 0x0100
422#define WM8350_IM_AUXADC_DCOMP4_EINT 0x0080
423#define WM8350_IM_AUXADC_DCOMP3_EINT 0x0040
424#define WM8350_IM_AUXADC_DCOMP2_EINT 0x0020
425#define WM8350_IM_AUXADC_DCOMP1_EINT 0x0010
426#define WM8350_IM_SYS_HYST_COMP_FAIL_EINT 0x0008
427#define WM8350_IM_SYS_CHIP_GT115_EINT 0x0004
428#define WM8350_IM_SYS_CHIP_GT140_EINT 0x0002
429#define WM8350_IM_SYS_WDOG_TO_EINT 0x0001
430
431/*
432 * R35 (0x23) - Power Up Interrupt Status Mask
433 */
434#define WM8350_IM_PUTO_LDO4_EINT 0x0800
435#define WM8350_IM_PUTO_LDO3_EINT 0x0400
436#define WM8350_IM_PUTO_LDO2_EINT 0x0200
437#define WM8350_IM_PUTO_LDO1_EINT 0x0100
438#define WM8350_IM_PUTO_DC6_EINT 0x0020
439#define WM8350_IM_PUTO_DC5_EINT 0x0010
440#define WM8350_IM_PUTO_DC4_EINT 0x0008
441#define WM8350_IM_PUTO_DC3_EINT 0x0004
442#define WM8350_IM_PUTO_DC2_EINT 0x0002
443#define WM8350_IM_PUTO_DC1_EINT 0x0001
444
445/*
446 * R36 (0x24) - Under Voltage Interrupt status Mask
447 */
448#define WM8350_IM_UV_LDO4_EINT 0x0800
449#define WM8350_IM_UV_LDO3_EINT 0x0400
450#define WM8350_IM_UV_LDO2_EINT 0x0200
451#define WM8350_IM_UV_LDO1_EINT 0x0100
452#define WM8350_IM_UV_DC6_EINT 0x0020
453#define WM8350_IM_UV_DC5_EINT 0x0010
454#define WM8350_IM_UV_DC4_EINT 0x0008
455#define WM8350_IM_UV_DC3_EINT 0x0004
456#define WM8350_IM_UV_DC2_EINT 0x0002
457#define WM8350_IM_UV_DC1_EINT 0x0001
458
459/*
460 * R37 (0x25) - Over Current Interrupt status Mask
461 */
462#define WM8350_IM_OC_LS_EINT 0x8000
463
464/*
465 * R38 (0x26) - GPIO Interrupt Status Mask
466 */
467#define WM8350_IM_GP12_EINT 0x1000
468#define WM8350_IM_GP11_EINT 0x0800
469#define WM8350_IM_GP10_EINT 0x0400
470#define WM8350_IM_GP9_EINT 0x0200
471#define WM8350_IM_GP8_EINT 0x0100
472#define WM8350_IM_GP7_EINT 0x0080
473#define WM8350_IM_GP6_EINT 0x0040
474#define WM8350_IM_GP5_EINT 0x0020
475#define WM8350_IM_GP4_EINT 0x0010
476#define WM8350_IM_GP3_EINT 0x0008
477#define WM8350_IM_GP2_EINT 0x0004
478#define WM8350_IM_GP1_EINT 0x0002
479#define WM8350_IM_GP0_EINT 0x0001
480
481/*
482 * R39 (0x27) - Comparator Interrupt Status Mask
483 */
484#define WM8350_IM_EXT_USB_FB_EINT 0x8000
485#define WM8350_IM_EXT_WALL_FB_EINT 0x4000
486#define WM8350_IM_EXT_BAT_FB_EINT 0x2000
487#define WM8350_IM_CODEC_JCK_DET_L_EINT 0x0800
488#define WM8350_IM_CODEC_JCK_DET_R_EINT 0x0400
489#define WM8350_IM_CODEC_MICSCD_EINT 0x0200
490#define WM8350_IM_CODEC_MICD_EINT 0x0100
491#define WM8350_IM_WKUP_OFF_STATE_EINT 0x0040
492#define WM8350_IM_WKUP_HIB_STATE_EINT 0x0020
493#define WM8350_IM_WKUP_CONV_FAULT_EINT 0x0010
494#define WM8350_IM_WKUP_WDOG_RST_EINT 0x0008
495#define WM8350_IM_WKUP_GP_PWR_ON_EINT 0x0004
496#define WM8350_IM_WKUP_ONKEY_EINT 0x0002
497#define WM8350_IM_WKUP_GP_WAKEUP_EINT 0x0001
498
499/*
500 * R220 (0xDC) - RAM BIST 1
501 */
502#define WM8350_READ_STATUS 0x0800
503#define WM8350_TSTRAM_CLK 0x0100
504#define WM8350_TSTRAM_CLK_ENA 0x0080
505#define WM8350_STARTSEQ 0x0040
506#define WM8350_READ_SRC 0x0020
507#define WM8350_COUNT_DIR 0x0010
508#define WM8350_TSTRAM_MODE_MASK 0x000E
509#define WM8350_TSTRAM_ENA 0x0001
510
511/*
512 * R225 (0xE1) - DCDC/LDO status
513 */
514#define WM8350_LS_STS 0x8000
515#define WM8350_LDO4_STS 0x0800
516#define WM8350_LDO3_STS 0x0400
517#define WM8350_LDO2_STS 0x0200
518#define WM8350_LDO1_STS 0x0100
519#define WM8350_DC6_STS 0x0020
520#define WM8350_DC5_STS 0x0010
521#define WM8350_DC4_STS 0x0008
522#define WM8350_DC3_STS 0x0004
523#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001
525
526/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44
529#define WM8350_IRQ_WKUP_CONV_FAULT 45
530#define WM8350_IRQ_WKUP_WDOG_RST 46
531#define WM8350_IRQ_WKUP_GP_PWR_ON 47
532#define WM8350_IRQ_WKUP_ONKEY 48
533#define WM8350_IRQ_WKUP_GP_WAKEUP 49
534
535/* wm8350 chip revisions */
536#define WM8350_REV_E 0x4
537#define WM8350_REV_F 0x5
538#define WM8350_REV_G 0x6
539
540#define WM8350_NUM_IRQ 63
541
542struct wm8350_reg_access {
543 u16 readable; /* Mask of readable bits */
544 u16 writable; /* Mask of writable bits */
545 u16 vol; /* Mask of volatile bits */
546};
547extern const struct wm8350_reg_access wm8350_reg_io_map[];
548extern const u16 wm8350_mode0_defaults[];
549extern const u16 wm8350_mode1_defaults[];
550extern const u16 wm8350_mode2_defaults[];
551extern const u16 wm8350_mode3_defaults[];
552
553struct wm8350;
554
555struct wm8350_irq {
556 void (*handler) (struct wm8350 *, int, void *);
557 void *data;
558};
559
560struct wm8350 {
561 int rev; /* chip revision */
562
563 struct device *dev;
564
565 /* device IO */
566 union {
567 struct i2c_client *i2c_client;
568 struct spi_device *spi_device;
569 };
570 int (*read_dev)(struct wm8350 *wm8350, char reg, int size, void *dest);
571 int (*write_dev)(struct wm8350 *wm8350, char reg, int size,
572 void *src);
573 u16 *reg_cache;
574
575 /* Interrupt handling */
576 struct work_struct irq_work;
577 struct mutex irq_mutex; /* IRQ table mutex */
578 struct wm8350_irq irq[WM8350_NUM_IRQ];
579 int chip_irq;
580
581 /* Client devices */
582 struct wm8350_codec codec;
583 struct wm8350_gpio gpio;
584 struct wm8350_pmic pmic;
585 struct wm8350_power power;
586 struct wm8350_rtc rtc;
587 struct wm8350_wdt wdt;
588};
589
590/**
591 * Data to be supplied by the platform to initialise the WM8350.
592 *
593 * @init: Function called during driver initialisation. Should be
594 * used by the platform to configure GPIO functions and similar.
595 */
596struct wm8350_platform_data {
597 int (*init)(struct wm8350 *wm8350);
598};
599
600
601/*
602 * WM8350 device initialisation and exit.
603 */
604int wm8350_device_init(struct wm8350 *wm8350, int irq,
605 struct wm8350_platform_data *pdata);
606void wm8350_device_exit(struct wm8350 *wm8350);
607
608/*
609 * WM8350 device IO
610 */
611int wm8350_clear_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
612int wm8350_set_bits(struct wm8350 *wm8350, u16 reg, u16 mask);
613u16 wm8350_reg_read(struct wm8350 *wm8350, int reg);
614int wm8350_reg_write(struct wm8350 *wm8350, int reg, u16 val);
615int wm8350_reg_lock(struct wm8350 *wm8350);
616int wm8350_reg_unlock(struct wm8350 *wm8350);
617int wm8350_block_read(struct wm8350 *wm8350, int reg, int size, u16 *dest);
618int wm8350_block_write(struct wm8350 *wm8350, int reg, int size, u16 *src);
619
620/*
621 * WM8350 internal interrupts
622 */
623int wm8350_register_irq(struct wm8350 *wm8350, int irq,
624 void (*handler) (struct wm8350 *, int, void *),
625 void *data);
626int wm8350_free_irq(struct wm8350 *wm8350, int irq);
627int wm8350_mask_irq(struct wm8350 *wm8350, int irq);
628int wm8350_unmask_irq(struct wm8350 *wm8350, int irq);
629
630
631#endif
diff --git a/include/linux/mfd/wm8350/gpio.h b/include/linux/mfd/wm8350/gpio.h
new file mode 100644
index 000000000000..ed91e8f5d298
--- /dev/null
+++ b/include/linux/mfd/wm8350/gpio.h
@@ -0,0 +1,342 @@
1/*
2 * gpio.h -- GPIO Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_GPIO_H_
14#define __LINUX_MFD_WM8350_GPIO_H_
15
16#include <linux/platform_device.h>
17
18/*
19 * GPIO Registers.
20 */
21#define WM8350_GPIO_DEBOUNCE 0x80
22#define WM8350_GPIO_PIN_PULL_UP_CONTROL 0x81
23#define WM8350_GPIO_PULL_DOWN_CONTROL 0x82
24#define WM8350_GPIO_INT_MODE 0x83
25#define WM8350_GPIO_CONTROL 0x85
26#define WM8350_GPIO_CONFIGURATION_I_O 0x86
27#define WM8350_GPIO_PIN_POLARITY_TYPE 0x87
28#define WM8350_GPIO_FUNCTION_SELECT_1 0x8C
29#define WM8350_GPIO_FUNCTION_SELECT_2 0x8D
30#define WM8350_GPIO_FUNCTION_SELECT_3 0x8E
31#define WM8350_GPIO_FUNCTION_SELECT_4 0x8F
32
33/*
34 * GPIO Functions
35 */
36#define WM8350_GPIO0_GPIO_IN 0x0
37#define WM8350_GPIO0_GPIO_OUT 0x0
38#define WM8350_GPIO0_PWR_ON_IN 0x1
39#define WM8350_GPIO0_PWR_ON_OUT 0x1
40#define WM8350_GPIO0_LDO_EN_IN 0x2
41#define WM8350_GPIO0_VRTC_OUT 0x2
42#define WM8350_GPIO0_LPWR1_IN 0x3
43#define WM8350_GPIO0_POR_B_OUT 0x3
44
45#define WM8350_GPIO1_GPIO_IN 0x0
46#define WM8350_GPIO1_GPIO_OUT 0x0
47#define WM8350_GPIO1_PWR_ON_IN 0x1
48#define WM8350_GPIO1_DO_CONF_OUT 0x1
49#define WM8350_GPIO1_LDO_EN_IN 0x2
50#define WM8350_GPIO1_RESET_OUT 0x2
51#define WM8350_GPIO1_LPWR2_IN 0x3
52#define WM8350_GPIO1_MEMRST_OUT 0x3
53
54#define WM8350_GPIO2_GPIO_IN 0x0
55#define WM8350_GPIO2_GPIO_OUT 0x0
56#define WM8350_GPIO2_PWR_ON_IN 0x1
57#define WM8350_GPIO2_PWR_ON_OUT 0x1
58#define WM8350_GPIO2_WAKE_UP_IN 0x2
59#define WM8350_GPIO2_VRTC_OUT 0x2
60#define WM8350_GPIO2_32KHZ_IN 0x3
61#define WM8350_GPIO2_32KHZ_OUT 0x3
62
63#define WM8350_GPIO3_GPIO_IN 0x0
64#define WM8350_GPIO3_GPIO_OUT 0x0
65#define WM8350_GPIO3_PWR_ON_IN 0x1
66#define WM8350_GPIO3_P_CLK_OUT 0x1
67#define WM8350_GPIO3_LDO_EN_IN 0x2
68#define WM8350_GPIO3_VRTC_OUT 0x2
69#define WM8350_GPIO3_PWR_OFF_IN 0x3
70#define WM8350_GPIO3_32KHZ_OUT 0x3
71
72#define WM8350_GPIO4_GPIO_IN 0x0
73#define WM8350_GPIO4_GPIO_OUT 0x0
74#define WM8350_GPIO4_MR_IN 0x1
75#define WM8350_GPIO4_MEM_RST_OUT 0x1
76#define WM8350_GPIO4_FLASH_IN 0x2
77#define WM8350_GPIO4_ADA_OUT 0x2
78#define WM8350_GPIO4_HIBERNATE_IN 0x3
79#define WM8350_GPIO4_FLASH_OUT 0x3
80#define WM8350_GPIO4_MICDET_OUT 0x4
81#define WM8350_GPIO4_MICSHT_OUT 0x5
82
83#define WM8350_GPIO5_GPIO_IN 0x0
84#define WM8350_GPIO5_GPIO_OUT 0x0
85#define WM8350_GPIO5_LPWR1_IN 0x1
86#define WM8350_GPIO5_P_CLK_OUT 0x1
87#define WM8350_GPIO5_ADCLRCLK_IN 0x2
88#define WM8350_GPIO5_ADCLRCLK_OUT 0x2
89#define WM8350_GPIO5_HIBERNATE_IN 0x3
90#define WM8350_GPIO5_32KHZ_OUT 0x3
91#define WM8350_GPIO5_MICDET_OUT 0x4
92#define WM8350_GPIO5_MICSHT_OUT 0x5
93#define WM8350_GPIO5_ADA_OUT 0x6
94#define WM8350_GPIO5_OPCLK_OUT 0x7
95
96#define WM8350_GPIO6_GPIO_IN 0x0
97#define WM8350_GPIO6_GPIO_OUT 0x0
98#define WM8350_GPIO6_LPWR2_IN 0x1
99#define WM8350_GPIO6_MEMRST_OUT 0x1
100#define WM8350_GPIO6_FLASH_IN 0x2
101#define WM8350_GPIO6_ADA_OUT 0x2
102#define WM8350_GPIO6_HIBERNATE_IN 0x3
103#define WM8350_GPIO6_RTC_OUT 0x3
104#define WM8350_GPIO6_MICDET_OUT 0x4
105#define WM8350_GPIO6_MICSHT_OUT 0x5
106#define WM8350_GPIO6_ADCLRCLKB_OUT 0x6
107#define WM8350_GPIO6_SDOUT_OUT 0x7
108
109#define WM8350_GPIO7_GPIO_IN 0x0
110#define WM8350_GPIO7_GPIO_OUT 0x0
111#define WM8350_GPIO7_LPWR3_IN 0x1
112#define WM8350_GPIO7_P_CLK_OUT 0x1
113#define WM8350_GPIO7_MASK_IN 0x2
114#define WM8350_GPIO7_VCC_FAULT_OUT 0x2
115#define WM8350_GPIO7_HIBERNATE_IN 0x3
116#define WM8350_GPIO7_BATT_FAULT_OUT 0x3
117#define WM8350_GPIO7_MICDET_OUT 0x4
118#define WM8350_GPIO7_MICSHT_OUT 0x5
119#define WM8350_GPIO7_ADA_OUT 0x6
120#define WM8350_GPIO7_CSB_IN 0x7
121
122#define WM8350_GPIO8_GPIO_IN 0x0
123#define WM8350_GPIO8_GPIO_OUT 0x0
124#define WM8350_GPIO8_MR_IN 0x1
125#define WM8350_GPIO8_VCC_FAULT_OUT 0x1
126#define WM8350_GPIO8_ADCBCLK_IN 0x2
127#define WM8350_GPIO8_ADCBCLK_OUT 0x2
128#define WM8350_GPIO8_PWR_OFF_IN 0x3
129#define WM8350_GPIO8_BATT_FAULT_OUT 0x3
130#define WM8350_GPIO8_ALTSCL_IN 0xf
131
132#define WM8350_GPIO9_GPIO_IN 0x0
133#define WM8350_GPIO9_GPIO_OUT 0x0
134#define WM8350_GPIO9_HEARTBEAT_IN 0x1
135#define WM8350_GPIO9_VCC_FAULT_OUT 0x1
136#define WM8350_GPIO9_MASK_IN 0x2
137#define WM8350_GPIO9_LINE_GT_BATT_OUT 0x2
138#define WM8350_GPIO9_PWR_OFF_IN 0x3
139#define WM8350_GPIO9_BATT_FAULT_OUT 0x3
140#define WM8350_GPIO9_ALTSDA_OUT 0xf
141
142#define WM8350_GPIO10_GPIO_IN 0x0
143#define WM8350_GPIO10_GPIO_OUT 0x0
144#define WM8350_GPIO10_ISINKC_OUT 0x1
145#define WM8350_GPIO10_PWR_OFF_IN 0x2
146#define WM8350_GPIO10_LINE_GT_BATT_OUT 0x2
147#define WM8350_GPIO10_CHD_IND_IN 0x3
148
149#define WM8350_GPIO11_GPIO_IN 0x0
150#define WM8350_GPIO11_GPIO_OUT 0x0
151#define WM8350_GPIO11_ISINKD_OUT 0x1
152#define WM8350_GPIO11_WAKEUP_IN 0x2
153#define WM8350_GPIO11_LINE_GT_BATT_OUT 0x2
154#define WM8350_GPIO11_CHD_IND_IN 0x3
155
156#define WM8350_GPIO12_GPIO_IN 0x0
157#define WM8350_GPIO12_GPIO_OUT 0x0
158#define WM8350_GPIO12_ISINKE_OUT 0x1
159#define WM8350_GPIO12_LINE_GT_BATT_OUT 0x2
160#define WM8350_GPIO12_LINE_EN_OUT 0x3
161#define WM8350_GPIO12_32KHZ_OUT 0x4
162
163#define WM8350_GPIO_DIR_IN 0
164#define WM8350_GPIO_DIR_OUT 1
165#define WM8350_GPIO_ACTIVE_LOW 0
166#define WM8350_GPIO_ACTIVE_HIGH 1
167#define WM8350_GPIO_PULL_NONE 0
168#define WM8350_GPIO_PULL_UP 1
169#define WM8350_GPIO_PULL_DOWN 2
170#define WM8350_GPIO_INVERT_OFF 0
171#define WM8350_GPIO_INVERT_ON 1
172#define WM8350_GPIO_DEBOUNCE_OFF 0
173#define WM8350_GPIO_DEBOUNCE_ON 1
174
175/*
176 * R128 (0x80) - GPIO Debounce
177 */
178#define WM8350_GP12_DB 0x1000
179#define WM8350_GP11_DB 0x0800
180#define WM8350_GP10_DB 0x0400
181#define WM8350_GP9_DB 0x0200
182#define WM8350_GP8_DB 0x0100
183#define WM8350_GP7_DB 0x0080
184#define WM8350_GP6_DB 0x0040
185#define WM8350_GP5_DB 0x0020
186#define WM8350_GP4_DB 0x0010
187#define WM8350_GP3_DB 0x0008
188#define WM8350_GP2_DB 0x0004
189#define WM8350_GP1_DB 0x0002
190#define WM8350_GP0_DB 0x0001
191
192/*
193 * R129 (0x81) - GPIO Pin pull up Control
194 */
195#define WM8350_GP12_PU 0x1000
196#define WM8350_GP11_PU 0x0800
197#define WM8350_GP10_PU 0x0400
198#define WM8350_GP9_PU 0x0200
199#define WM8350_GP8_PU 0x0100
200#define WM8350_GP7_PU 0x0080
201#define WM8350_GP6_PU 0x0040
202#define WM8350_GP5_PU 0x0020
203#define WM8350_GP4_PU 0x0010
204#define WM8350_GP3_PU 0x0008
205#define WM8350_GP2_PU 0x0004
206#define WM8350_GP1_PU 0x0002
207#define WM8350_GP0_PU 0x0001
208
209/*
210 * R130 (0x82) - GPIO Pull down Control
211 */
212#define WM8350_GP12_PD 0x1000
213#define WM8350_GP11_PD 0x0800
214#define WM8350_GP10_PD 0x0400
215#define WM8350_GP9_PD 0x0200
216#define WM8350_GP8_PD 0x0100
217#define WM8350_GP7_PD 0x0080
218#define WM8350_GP6_PD 0x0040
219#define WM8350_GP5_PD 0x0020
220#define WM8350_GP4_PD 0x0010
221#define WM8350_GP3_PD 0x0008
222#define WM8350_GP2_PD 0x0004
223#define WM8350_GP1_PD 0x0002
224#define WM8350_GP0_PD 0x0001
225
226/*
227 * R131 (0x83) - GPIO Interrupt Mode
228 */
229#define WM8350_GP12_INTMODE 0x1000
230#define WM8350_GP11_INTMODE 0x0800
231#define WM8350_GP10_INTMODE 0x0400
232#define WM8350_GP9_INTMODE 0x0200
233#define WM8350_GP8_INTMODE 0x0100
234#define WM8350_GP7_INTMODE 0x0080
235#define WM8350_GP6_INTMODE 0x0040
236#define WM8350_GP5_INTMODE 0x0020
237#define WM8350_GP4_INTMODE 0x0010
238#define WM8350_GP3_INTMODE 0x0008
239#define WM8350_GP2_INTMODE 0x0004
240#define WM8350_GP1_INTMODE 0x0002
241#define WM8350_GP0_INTMODE 0x0001
242
243/*
244 * R133 (0x85) - GPIO Control
245 */
246#define WM8350_GP_DBTIME_MASK 0x00C0
247
248/*
249 * R134 (0x86) - GPIO Configuration (i/o)
250 */
251#define WM8350_GP12_DIR 0x1000
252#define WM8350_GP11_DIR 0x0800
253#define WM8350_GP10_DIR 0x0400
254#define WM8350_GP9_DIR 0x0200
255#define WM8350_GP8_DIR 0x0100
256#define WM8350_GP7_DIR 0x0080
257#define WM8350_GP6_DIR 0x0040
258#define WM8350_GP5_DIR 0x0020
259#define WM8350_GP4_DIR 0x0010
260#define WM8350_GP3_DIR 0x0008
261#define WM8350_GP2_DIR 0x0004
262#define WM8350_GP1_DIR 0x0002
263#define WM8350_GP0_DIR 0x0001
264
265/*
266 * R135 (0x87) - GPIO Pin Polarity / Type
267 */
268#define WM8350_GP12_CFG 0x1000
269#define WM8350_GP11_CFG 0x0800
270#define WM8350_GP10_CFG 0x0400
271#define WM8350_GP9_CFG 0x0200
272#define WM8350_GP8_CFG 0x0100
273#define WM8350_GP7_CFG 0x0080
274#define WM8350_GP6_CFG 0x0040
275#define WM8350_GP5_CFG 0x0020
276#define WM8350_GP4_CFG 0x0010
277#define WM8350_GP3_CFG 0x0008
278#define WM8350_GP2_CFG 0x0004
279#define WM8350_GP1_CFG 0x0002
280#define WM8350_GP0_CFG 0x0001
281
282/*
283 * R140 (0x8C) - GPIO Function Select 1
284 */
285#define WM8350_GP3_FN_MASK 0xF000
286#define WM8350_GP2_FN_MASK 0x0F00
287#define WM8350_GP1_FN_MASK 0x00F0
288#define WM8350_GP0_FN_MASK 0x000F
289
290/*
291 * R141 (0x8D) - GPIO Function Select 2
292 */
293#define WM8350_GP7_FN_MASK 0xF000
294#define WM8350_GP6_FN_MASK 0x0F00
295#define WM8350_GP5_FN_MASK 0x00F0
296#define WM8350_GP4_FN_MASK 0x000F
297
298/*
299 * R142 (0x8E) - GPIO Function Select 3
300 */
301#define WM8350_GP11_FN_MASK 0xF000
302#define WM8350_GP10_FN_MASK 0x0F00
303#define WM8350_GP9_FN_MASK 0x00F0
304#define WM8350_GP8_FN_MASK 0x000F
305
306/*
307 * R143 (0x8F) - GPIO Function Select 4
308 */
309#define WM8350_GP12_FN_MASK 0x000F
310
311/*
312 * R230 (0xE6) - GPIO Pin Status
313 */
314#define WM8350_GP12_LVL 0x1000
315#define WM8350_GP11_LVL 0x0800
316#define WM8350_GP10_LVL 0x0400
317#define WM8350_GP9_LVL 0x0200
318#define WM8350_GP8_LVL 0x0100
319#define WM8350_GP7_LVL 0x0080
320#define WM8350_GP6_LVL 0x0040
321#define WM8350_GP5_LVL 0x0020
322#define WM8350_GP4_LVL 0x0010
323#define WM8350_GP3_LVL 0x0008
324#define WM8350_GP2_LVL 0x0004
325#define WM8350_GP1_LVL 0x0002
326#define WM8350_GP0_LVL 0x0001
327
328struct wm8350;
329
330int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
331 int pol, int pull, int invert, int debounce);
332
333struct wm8350_gpio {
334 struct platform_device *pdev;
335};
336
337/*
338 * GPIO Interrupts
339 */
340#define WM8350_IRQ_GPIO(x) (50 + x)
341
342#endif
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
new file mode 100644
index 000000000000..69b69e07f62f
--- /dev/null
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -0,0 +1,741 @@
1/*
2 * pmic.h -- Power Managment Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_PMIC_H
14#define __LINUX_MFD_WM8350_PMIC_H
15
16/*
17 * Register values.
18 */
19
20#define WM8350_CURRENT_SINK_DRIVER_A 0xAC
21#define WM8350_CSA_FLASH_CONTROL 0xAD
22#define WM8350_CURRENT_SINK_DRIVER_B 0xAE
23#define WM8350_CSB_FLASH_CONTROL 0xAF
24#define WM8350_DCDC_LDO_REQUESTED 0xB0
25#define WM8350_DCDC_ACTIVE_OPTIONS 0xB1
26#define WM8350_DCDC_SLEEP_OPTIONS 0xB2
27#define WM8350_POWER_CHECK_COMPARATOR 0xB3
28#define WM8350_DCDC1_CONTROL 0xB4
29#define WM8350_DCDC1_TIMEOUTS 0xB5
30#define WM8350_DCDC1_LOW_POWER 0xB6
31#define WM8350_DCDC2_CONTROL 0xB7
32#define WM8350_DCDC2_TIMEOUTS 0xB8
33#define WM8350_DCDC3_CONTROL 0xBA
34#define WM8350_DCDC3_TIMEOUTS 0xBB
35#define WM8350_DCDC3_LOW_POWER 0xBC
36#define WM8350_DCDC4_CONTROL 0xBD
37#define WM8350_DCDC4_TIMEOUTS 0xBE
38#define WM8350_DCDC4_LOW_POWER 0xBF
39#define WM8350_DCDC5_CONTROL 0xC0
40#define WM8350_DCDC5_TIMEOUTS 0xC1
41#define WM8350_DCDC6_CONTROL 0xC3
42#define WM8350_DCDC6_TIMEOUTS 0xC4
43#define WM8350_DCDC6_LOW_POWER 0xC5
44#define WM8350_LIMIT_SWITCH_CONTROL 0xC7
45#define WM8350_LDO1_CONTROL 0xC8
46#define WM8350_LDO1_TIMEOUTS 0xC9
47#define WM8350_LDO1_LOW_POWER 0xCA
48#define WM8350_LDO2_CONTROL 0xCB
49#define WM8350_LDO2_TIMEOUTS 0xCC
50#define WM8350_LDO2_LOW_POWER 0xCD
51#define WM8350_LDO3_CONTROL 0xCE
52#define WM8350_LDO3_TIMEOUTS 0xCF
53#define WM8350_LDO3_LOW_POWER 0xD0
54#define WM8350_LDO4_CONTROL 0xD1
55#define WM8350_LDO4_TIMEOUTS 0xD2
56#define WM8350_LDO4_LOW_POWER 0xD3
57#define WM8350_VCC_FAULT_MASKS 0xD7
58#define WM8350_MAIN_BANDGAP_CONTROL 0xD8
59#define WM8350_OSC_CONTROL 0xD9
60#define WM8350_RTC_TICK_CONTROL 0xDA
61#define WM8350_SECURITY 0xDB
62#define WM8350_RAM_BIST_1 0xDC
63#define WM8350_DCDC_LDO_STATUS 0xE1
64#define WM8350_GPIO_PIN_STATUS 0xE6
65
66#define WM8350_DCDC1_FORCE_PWM 0xF8
67#define WM8350_DCDC3_FORCE_PWM 0xFA
68#define WM8350_DCDC4_FORCE_PWM 0xFB
69#define WM8350_DCDC6_FORCE_PWM 0xFD
70
71/*
72 * R172 (0xAC) - Current Sink Driver A
73 */
74#define WM8350_CS1_HIB_MODE 0x1000
75#define WM8350_CS1_HIB_MODE_MASK 0x1000
76#define WM8350_CS1_HIB_MODE_SHIFT 12
77#define WM8350_CS1_ISEL_MASK 0x003F
78#define WM8350_CS1_ISEL_SHIFT 0
79
80/* Bit values for R172 (0xAC) */
81#define WM8350_CS1_HIB_MODE_DISABLE 0
82#define WM8350_CS1_HIB_MODE_LEAVE 1
83
84#define WM8350_CS1_ISEL_220M 0x3F
85
86/*
87 * R173 (0xAD) - CSA Flash control
88 */
89#define WM8350_CS1_FLASH_MODE 0x8000
90#define WM8350_CS1_TRIGSRC 0x4000
91#define WM8350_CS1_DRIVE 0x2000
92#define WM8350_CS1_FLASH_DUR_MASK 0x0300
93#define WM8350_CS1_OFF_RAMP_MASK 0x0030
94#define WM8350_CS1_ON_RAMP_MASK 0x0003
95
96/*
97 * R174 (0xAE) - Current Sink Driver B
98 */
99#define WM8350_CS2_HIB_MODE 0x1000
100#define WM8350_CS2_ISEL_MASK 0x003F
101
102/*
103 * R175 (0xAF) - CSB Flash control
104 */
105#define WM8350_CS2_FLASH_MODE 0x8000
106#define WM8350_CS2_TRIGSRC 0x4000
107#define WM8350_CS2_DRIVE 0x2000
108#define WM8350_CS2_FLASH_DUR_MASK 0x0300
109#define WM8350_CS2_OFF_RAMP_MASK 0x0030
110#define WM8350_CS2_ON_RAMP_MASK 0x0003
111
112/*
113 * R176 (0xB0) - DCDC/LDO requested
114 */
115#define WM8350_LS_ENA 0x8000
116#define WM8350_LDO4_ENA 0x0800
117#define WM8350_LDO3_ENA 0x0400
118#define WM8350_LDO2_ENA 0x0200
119#define WM8350_LDO1_ENA 0x0100
120#define WM8350_DC6_ENA 0x0020
121#define WM8350_DC5_ENA 0x0010
122#define WM8350_DC4_ENA 0x0008
123#define WM8350_DC3_ENA 0x0004
124#define WM8350_DC2_ENA 0x0002
125#define WM8350_DC1_ENA 0x0001
126
127/*
128 * R177 (0xB1) - DCDC Active options
129 */
130#define WM8350_PUTO_MASK 0x3000
131#define WM8350_PWRUP_DELAY_MASK 0x0300
132#define WM8350_DC6_ACTIVE 0x0020
133#define WM8350_DC4_ACTIVE 0x0008
134#define WM8350_DC3_ACTIVE 0x0004
135#define WM8350_DC1_ACTIVE 0x0001
136
137/*
138 * R178 (0xB2) - DCDC Sleep options
139 */
140#define WM8350_DC6_SLEEP 0x0020
141#define WM8350_DC4_SLEEP 0x0008
142#define WM8350_DC3_SLEEP 0x0004
143#define WM8350_DC1_SLEEP 0x0001
144
145/*
146 * R179 (0xB3) - Power-check comparator
147 */
148#define WM8350_PCCMP_ERRACT 0x4000
149#define WM8350_PCCMP_RAIL 0x0100
150#define WM8350_PCCMP_OFF_THR_MASK 0x0070
151#define WM8350_PCCMP_ON_THR_MASK 0x0007
152
153/*
154 * R180 (0xB4) - DCDC1 Control
155 */
156#define WM8350_DC1_OPFLT 0x0400
157#define WM8350_DC1_VSEL_MASK 0x007F
158#define WM8350_DC1_VSEL_SHIFT 0
159
160/*
161 * R181 (0xB5) - DCDC1 Timeouts
162 */
163#define WM8350_DC1_ERRACT_MASK 0xC000
164#define WM8350_DC1_ERRACT_SHIFT 14
165#define WM8350_DC1_ENSLOT_MASK 0x3C00
166#define WM8350_DC1_ENSLOT_SHIFT 10
167#define WM8350_DC1_SDSLOT_MASK 0x03C0
168#define WM8350_DC1_UVTO_MASK 0x0030
169#define WM8350_DC1_SDSLOT_SHIFT 6
170
171/* Bit values for R181 (0xB5) */
172#define WM8350_DC1_ERRACT_NONE 0
173#define WM8350_DC1_ERRACT_SHUTDOWN_CONV 1
174#define WM8350_DC1_ERRACT_SHUTDOWN_SYS 2
175
176/*
177 * R182 (0xB6) - DCDC1 Low Power
178 */
179#define WM8350_DC1_HIB_MODE_MASK 0x7000
180#define WM8350_DC1_HIB_TRIG_MASK 0x0300
181#define WM8350_DC1_VIMG_MASK 0x007F
182
183/*
184 * R183 (0xB7) - DCDC2 Control
185 */
186#define WM8350_DC2_MODE 0x4000
187#define WM8350_DC2_MODE_MASK 0x4000
188#define WM8350_DC2_MODE_SHIFT 14
189#define WM8350_DC2_HIB_MODE 0x1000
190#define WM8350_DC2_HIB_MODE_MASK 0x1000
191#define WM8350_DC2_HIB_MODE_SHIFT 12
192#define WM8350_DC2_HIB_TRIG_MASK 0x0300
193#define WM8350_DC2_HIB_TRIG_SHIFT 8
194#define WM8350_DC2_ILIM 0x0040
195#define WM8350_DC2_ILIM_MASK 0x0040
196#define WM8350_DC2_ILIM_SHIFT 6
197#define WM8350_DC2_RMP_MASK 0x0018
198#define WM8350_DC2_RMP_SHIFT 3
199#define WM8350_DC2_FBSRC_MASK 0x0003
200#define WM8350_DC2_FBSRC_SHIFT 0
201
202/* Bit values for R183 (0xB7) */
203#define WM8350_DC2_MODE_BOOST 0
204#define WM8350_DC2_MODE_SWITCH 1
205
206#define WM8350_DC2_HIB_MODE_ACTIVE 1
207#define WM8350_DC2_HIB_MODE_DISABLE 0
208
209#define WM8350_DC2_HIB_TRIG_NONE 0
210#define WM8350_DC2_HIB_TRIG_LPWR1 1
211#define WM8350_DC2_HIB_TRIG_LPWR2 2
212#define WM8350_DC2_HIB_TRIG_LPWR3 3
213
214#define WM8350_DC2_ILIM_HIGH 0
215#define WM8350_DC2_ILIM_LOW 1
216
217#define WM8350_DC2_RMP_30V 0
218#define WM8350_DC2_RMP_20V 1
219#define WM8350_DC2_RMP_10V 2
220#define WM8350_DC2_RMP_5V 3
221
222#define WM8350_DC2_FBSRC_FB2 0
223#define WM8350_DC2_FBSRC_ISINKA 1
224#define WM8350_DC2_FBSRC_ISINKB 2
225#define WM8350_DC2_FBSRC_USB 3
226
227/*
228 * R184 (0xB8) - DCDC2 Timeouts
229 */
230#define WM8350_DC2_ERRACT_MASK 0xC000
231#define WM8350_DC2_ERRACT_SHIFT 14
232#define WM8350_DC2_ENSLOT_MASK 0x3C00
233#define WM8350_DC2_ENSLOT_SHIFT 10
234#define WM8350_DC2_SDSLOT_MASK 0x03C0
235#define WM8350_DC2_UVTO_MASK 0x0030
236
237/* Bit values for R184 (0xB8) */
238#define WM8350_DC2_ERRACT_NONE 0
239#define WM8350_DC2_ERRACT_SHUTDOWN_CONV 1
240#define WM8350_DC2_ERRACT_SHUTDOWN_SYS 2
241
242/*
243 * R186 (0xBA) - DCDC3 Control
244 */
245#define WM8350_DC3_OPFLT 0x0400
246#define WM8350_DC3_VSEL_MASK 0x007F
247#define WM8350_DC3_VSEL_SHIFT 0
248
249/*
250 * R187 (0xBB) - DCDC3 Timeouts
251 */
252#define WM8350_DC3_ERRACT_MASK 0xC000
253#define WM8350_DC3_ERRACT_SHIFT 14
254#define WM8350_DC3_ENSLOT_MASK 0x3C00
255#define WM8350_DC3_ENSLOT_SHIFT 10
256#define WM8350_DC3_SDSLOT_MASK 0x03C0
257#define WM8350_DC3_UVTO_MASK 0x0030
258#define WM8350_DC3_SDSLOT_SHIFT 6
259
260/* Bit values for R187 (0xBB) */
261#define WM8350_DC3_ERRACT_NONE 0
262#define WM8350_DC3_ERRACT_SHUTDOWN_CONV 1
263#define WM8350_DC3_ERRACT_SHUTDOWN_SYS 2
264/*
265 * R188 (0xBC) - DCDC3 Low Power
266 */
267#define WM8350_DC3_HIB_MODE_MASK 0x7000
268#define WM8350_DC3_HIB_TRIG_MASK 0x0300
269#define WM8350_DC3_VIMG_MASK 0x007F
270
271/*
272 * R189 (0xBD) - DCDC4 Control
273 */
274#define WM8350_DC4_OPFLT 0x0400
275#define WM8350_DC4_VSEL_MASK 0x007F
276#define WM8350_DC4_VSEL_SHIFT 0
277
278/*
279 * R190 (0xBE) - DCDC4 Timeouts
280 */
281#define WM8350_DC4_ERRACT_MASK 0xC000
282#define WM8350_DC4_ERRACT_SHIFT 14
283#define WM8350_DC4_ENSLOT_MASK 0x3C00
284#define WM8350_DC4_ENSLOT_SHIFT 10
285#define WM8350_DC4_SDSLOT_MASK 0x03C0
286#define WM8350_DC4_UVTO_MASK 0x0030
287#define WM8350_DC4_SDSLOT_SHIFT 6
288
289/* Bit values for R190 (0xBE) */
290#define WM8350_DC4_ERRACT_NONE 0
291#define WM8350_DC4_ERRACT_SHUTDOWN_CONV 1
292#define WM8350_DC4_ERRACT_SHUTDOWN_SYS 2
293
294/*
295 * R191 (0xBF) - DCDC4 Low Power
296 */
297#define WM8350_DC4_HIB_MODE_MASK 0x7000
298#define WM8350_DC4_HIB_TRIG_MASK 0x0300
299#define WM8350_DC4_VIMG_MASK 0x007F
300
301/*
302 * R192 (0xC0) - DCDC5 Control
303 */
304#define WM8350_DC5_MODE 0x4000
305#define WM8350_DC5_MODE_MASK 0x4000
306#define WM8350_DC5_MODE_SHIFT 14
307#define WM8350_DC5_HIB_MODE 0x1000
308#define WM8350_DC5_HIB_MODE_MASK 0x1000
309#define WM8350_DC5_HIB_MODE_SHIFT 12
310#define WM8350_DC5_HIB_TRIG_MASK 0x0300
311#define WM8350_DC5_HIB_TRIG_SHIFT 8
312#define WM8350_DC5_ILIM 0x0040
313#define WM8350_DC5_ILIM_MASK 0x0040
314#define WM8350_DC5_ILIM_SHIFT 6
315#define WM8350_DC5_RMP_MASK 0x0018
316#define WM8350_DC5_RMP_SHIFT 3
317#define WM8350_DC5_FBSRC_MASK 0x0003
318#define WM8350_DC5_FBSRC_SHIFT 0
319
320/* Bit values for R192 (0xC0) */
321#define WM8350_DC5_MODE_BOOST 0
322#define WM8350_DC5_MODE_SWITCH 1
323
324#define WM8350_DC5_HIB_MODE_ACTIVE 1
325#define WM8350_DC5_HIB_MODE_DISABLE 0
326
327#define WM8350_DC5_HIB_TRIG_NONE 0
328#define WM8350_DC5_HIB_TRIG_LPWR1 1
329#define WM8350_DC5_HIB_TRIG_LPWR2 2
330#define WM8350_DC5_HIB_TRIG_LPWR3 3
331
332#define WM8350_DC5_ILIM_HIGH 0
333#define WM8350_DC5_ILIM_LOW 1
334
335#define WM8350_DC5_RMP_30V 0
336#define WM8350_DC5_RMP_20V 1
337#define WM8350_DC5_RMP_10V 2
338#define WM8350_DC5_RMP_5V 3
339
340#define WM8350_DC5_FBSRC_FB2 0
341#define WM8350_DC5_FBSRC_ISINKA 1
342#define WM8350_DC5_FBSRC_ISINKB 2
343#define WM8350_DC5_FBSRC_USB 3
344
345/*
346 * R193 (0xC1) - DCDC5 Timeouts
347 */
348#define WM8350_DC5_ERRACT_MASK 0xC000
349#define WM8350_DC5_ERRACT_SHIFT 14
350#define WM8350_DC5_ENSLOT_MASK 0x3C00
351#define WM8350_DC5_ENSLOT_SHIFT 10
352#define WM8350_DC5_SDSLOT_MASK 0x03C0
353#define WM8350_DC5_UVTO_MASK 0x0030
354#define WM8350_DC5_SDSLOT_SHIFT 6
355
356/* Bit values for R193 (0xC1) */
357#define WM8350_DC5_ERRACT_NONE 0
358#define WM8350_DC5_ERRACT_SHUTDOWN_CONV 1
359#define WM8350_DC5_ERRACT_SHUTDOWN_SYS 2
360
361/*
362 * R195 (0xC3) - DCDC6 Control
363 */
364#define WM8350_DC6_OPFLT 0x0400
365#define WM8350_DC6_VSEL_MASK 0x007F
366#define WM8350_DC6_VSEL_SHIFT 0
367
368/*
369 * R196 (0xC4) - DCDC6 Timeouts
370 */
371#define WM8350_DC6_ERRACT_MASK 0xC000
372#define WM8350_DC6_ERRACT_SHIFT 14
373#define WM8350_DC6_ENSLOT_MASK 0x3C00
374#define WM8350_DC6_ENSLOT_SHIFT 10
375#define WM8350_DC6_SDSLOT_MASK 0x03C0
376#define WM8350_DC6_UVTO_MASK 0x0030
377#define WM8350_DC6_SDSLOT_SHIFT 6
378
379/* Bit values for R196 (0xC4) */
380#define WM8350_DC6_ERRACT_NONE 0
381#define WM8350_DC6_ERRACT_SHUTDOWN_CONV 1
382#define WM8350_DC6_ERRACT_SHUTDOWN_SYS 2
383
384/*
385 * R197 (0xC5) - DCDC6 Low Power
386 */
387#define WM8350_DC6_HIB_MODE_MASK 0x7000
388#define WM8350_DC6_HIB_TRIG_MASK 0x0300
389#define WM8350_DC6_VIMG_MASK 0x007F
390
391/*
392 * R199 (0xC7) - Limit Switch Control
393 */
394#define WM8350_LS_ERRACT_MASK 0xC000
395#define WM8350_LS_ERRACT_SHIFT 14
396#define WM8350_LS_ENSLOT_MASK 0x3C00
397#define WM8350_LS_ENSLOT_SHIFT 10
398#define WM8350_LS_SDSLOT_MASK 0x03C0
399#define WM8350_LS_SDSLOT_SHIFT 6
400#define WM8350_LS_HIB_MODE 0x0010
401#define WM8350_LS_HIB_MODE_MASK 0x0010
402#define WM8350_LS_HIB_MODE_SHIFT 4
403#define WM8350_LS_HIB_PROT 0x0002
404#define WM8350_LS_HIB_PROT_MASK 0x0002
405#define WM8350_LS_HIB_PROT_SHIFT 1
406#define WM8350_LS_PROT 0x0001
407#define WM8350_LS_PROT_MASK 0x0001
408#define WM8350_LS_PROT_SHIFT 0
409
410/* Bit values for R199 (0xC7) */
411#define WM8350_LS_ERRACT_NONE 0
412#define WM8350_LS_ERRACT_SHUTDOWN_CONV 1
413#define WM8350_LS_ERRACT_SHUTDOWN_SYS 2
414
415/*
416 * R200 (0xC8) - LDO1 Control
417 */
418#define WM8350_LDO1_SWI 0x4000
419#define WM8350_LDO1_OPFLT 0x0400
420#define WM8350_LDO1_VSEL_MASK 0x001F
421#define WM8350_LDO1_VSEL_SHIFT 0
422
423/*
424 * R201 (0xC9) - LDO1 Timeouts
425 */
426#define WM8350_LDO1_ERRACT_MASK 0xC000
427#define WM8350_LDO1_ERRACT_SHIFT 14
428#define WM8350_LDO1_ENSLOT_MASK 0x3C00
429#define WM8350_LDO1_ENSLOT_SHIFT 10
430#define WM8350_LDO1_SDSLOT_MASK 0x03C0
431#define WM8350_LDO1_UVTO_MASK 0x0030
432#define WM8350_LDO1_SDSLOT_SHIFT 6
433
434/* Bit values for R201 (0xC9) */
435#define WM8350_LDO1_ERRACT_NONE 0
436#define WM8350_LDO1_ERRACT_SHUTDOWN_CONV 1
437#define WM8350_LDO1_ERRACT_SHUTDOWN_SYS 2
438
439/*
440 * R202 (0xCA) - LDO1 Low Power
441 */
442#define WM8350_LDO1_HIB_MODE_MASK 0x3000
443#define WM8350_LDO1_HIB_TRIG_MASK 0x0300
444#define WM8350_LDO1_VIMG_MASK 0x001F
445#define WM8350_LDO1_HIB_MODE_DIS (0x1 << 12)
446
447
448/*
449 * R203 (0xCB) - LDO2 Control
450 */
451#define WM8350_LDO2_SWI 0x4000
452#define WM8350_LDO2_OPFLT 0x0400
453#define WM8350_LDO2_VSEL_MASK 0x001F
454#define WM8350_LDO2_VSEL_SHIFT 0
455
456/*
457 * R204 (0xCC) - LDO2 Timeouts
458 */
459#define WM8350_LDO2_ERRACT_MASK 0xC000
460#define WM8350_LDO2_ERRACT_SHIFT 14
461#define WM8350_LDO2_ENSLOT_MASK 0x3C00
462#define WM8350_LDO2_ENSLOT_SHIFT 10
463#define WM8350_LDO2_SDSLOT_MASK 0x03C0
464#define WM8350_LDO2_SDSLOT_SHIFT 6
465
466/* Bit values for R204 (0xCC) */
467#define WM8350_LDO2_ERRACT_NONE 0
468#define WM8350_LDO2_ERRACT_SHUTDOWN_CONV 1
469#define WM8350_LDO2_ERRACT_SHUTDOWN_SYS 2
470
471/*
472 * R205 (0xCD) - LDO2 Low Power
473 */
474#define WM8350_LDO2_HIB_MODE_MASK 0x3000
475#define WM8350_LDO2_HIB_TRIG_MASK 0x0300
476#define WM8350_LDO2_VIMG_MASK 0x001F
477
478/*
479 * R206 (0xCE) - LDO3 Control
480 */
481#define WM8350_LDO3_SWI 0x4000
482#define WM8350_LDO3_OPFLT 0x0400
483#define WM8350_LDO3_VSEL_MASK 0x001F
484#define WM8350_LDO3_VSEL_SHIFT 0
485
486/*
487 * R207 (0xCF) - LDO3 Timeouts
488 */
489#define WM8350_LDO3_ERRACT_MASK 0xC000
490#define WM8350_LDO3_ERRACT_SHIFT 14
491#define WM8350_LDO3_ENSLOT_MASK 0x3C00
492#define WM8350_LDO3_ENSLOT_SHIFT 10
493#define WM8350_LDO3_SDSLOT_MASK 0x03C0
494#define WM8350_LDO3_UVTO_MASK 0x0030
495#define WM8350_LDO3_SDSLOT_SHIFT 6
496
497/* Bit values for R207 (0xCF) */
498#define WM8350_LDO3_ERRACT_NONE 0
499#define WM8350_LDO3_ERRACT_SHUTDOWN_CONV 1
500#define WM8350_LDO3_ERRACT_SHUTDOWN_SYS 2
501
502/*
503 * R208 (0xD0) - LDO3 Low Power
504 */
505#define WM8350_LDO3_HIB_MODE_MASK 0x3000
506#define WM8350_LDO3_HIB_TRIG_MASK 0x0300
507#define WM8350_LDO3_VIMG_MASK 0x001F
508
509/*
510 * R209 (0xD1) - LDO4 Control
511 */
512#define WM8350_LDO4_SWI 0x4000
513#define WM8350_LDO4_OPFLT 0x0400
514#define WM8350_LDO4_VSEL_MASK 0x001F
515#define WM8350_LDO4_VSEL_SHIFT 0
516
517/*
518 * R210 (0xD2) - LDO4 Timeouts
519 */
520#define WM8350_LDO4_ERRACT_MASK 0xC000
521#define WM8350_LDO4_ERRACT_SHIFT 14
522#define WM8350_LDO4_ENSLOT_MASK 0x3C00
523#define WM8350_LDO4_ENSLOT_SHIFT 10
524#define WM8350_LDO4_SDSLOT_MASK 0x03C0
525#define WM8350_LDO4_UVTO_MASK 0x0030
526#define WM8350_LDO4_SDSLOT_SHIFT 6
527
528/* Bit values for R210 (0xD2) */
529#define WM8350_LDO4_ERRACT_NONE 0
530#define WM8350_LDO4_ERRACT_SHUTDOWN_CONV 1
531#define WM8350_LDO4_ERRACT_SHUTDOWN_SYS 2
532
533/*
534 * R211 (0xD3) - LDO4 Low Power
535 */
536#define WM8350_LDO4_HIB_MODE_MASK 0x3000
537#define WM8350_LDO4_HIB_TRIG_MASK 0x0300
538#define WM8350_LDO4_VIMG_MASK 0x001F
539
540/*
541 * R215 (0xD7) - VCC_FAULT Masks
542 */
543#define WM8350_LS_FAULT 0x8000
544#define WM8350_LDO4_FAULT 0x0800
545#define WM8350_LDO3_FAULT 0x0400
546#define WM8350_LDO2_FAULT 0x0200
547#define WM8350_LDO1_FAULT 0x0100
548#define WM8350_DC6_FAULT 0x0020
549#define WM8350_DC5_FAULT 0x0010
550#define WM8350_DC4_FAULT 0x0008
551#define WM8350_DC3_FAULT 0x0004
552#define WM8350_DC2_FAULT 0x0002
553#define WM8350_DC1_FAULT 0x0001
554
555/*
556 * R216 (0xD8) - Main Bandgap Control
557 */
558#define WM8350_MBG_LOAD_FUSES 0x8000
559#define WM8350_MBG_FUSE_WPREP 0x4000
560#define WM8350_MBG_FUSE_WRITE 0x2000
561#define WM8350_MBG_FUSE_TRIM_MASK 0x1F00
562#define WM8350_MBG_TRIM_SRC 0x0020
563#define WM8350_MBG_USER_TRIM_MASK 0x001F
564
565/*
566 * R217 (0xD9) - OSC Control
567 */
568#define WM8350_OSC_LOAD_FUSES 0x8000
569#define WM8350_OSC_FUSE_WPREP 0x4000
570#define WM8350_OSC_FUSE_WRITE 0x2000
571#define WM8350_OSC_FUSE_TRIM_MASK 0x0F00
572#define WM8350_OSC_TRIM_SRC 0x0020
573#define WM8350_OSC_USER_TRIM_MASK 0x000F
574
575/*
576 * R248 (0xF8) - DCDC1 Force PWM
577 */
578#define WM8350_DCDC1_FORCE_PWM_ENA 0x0010
579
580/*
581 * R250 (0xFA) - DCDC3 Force PWM
582 */
583#define WM8350_DCDC3_FORCE_PWM_ENA 0x0010
584
585/*
586 * R251 (0xFB) - DCDC4 Force PWM
587 */
588#define WM8350_DCDC4_FORCE_PWM_ENA 0x0010
589
590/*
591 * R253 (0xFD) - DCDC1 Force PWM
592 */
593#define WM8350_DCDC6_FORCE_PWM_ENA 0x0010
594
595/*
596 * DCDC's
597 */
598#define WM8350_DCDC_1 0
599#define WM8350_DCDC_2 1
600#define WM8350_DCDC_3 2
601#define WM8350_DCDC_4 3
602#define WM8350_DCDC_5 4
603#define WM8350_DCDC_6 5
604
605/* DCDC modes */
606#define WM8350_DCDC_ACTIVE_STANDBY 0
607#define WM8350_DCDC_ACTIVE_PULSE 1
608#define WM8350_DCDC_SLEEP_NORMAL 0
609#define WM8350_DCDC_SLEEP_LOW 1
610
611/* DCDC Low power (Hibernate) mode */
612#define WM8350_DCDC_HIB_MODE_CUR (0 << 12)
613#define WM8350_DCDC_HIB_MODE_IMAGE (1 << 12)
614#define WM8350_DCDC_HIB_MODE_STANDBY (2 << 12)
615#define WM8350_DCDC_HIB_MODE_LDO (4 << 12)
616#define WM8350_DCDC_HIB_MODE_LDO_IM (5 << 12)
617#define WM8350_DCDC_HIB_MODE_DIS (7 << 12)
618#define WM8350_DCDC_HIB_MODE_MASK (7 << 12)
619
620/* DCDC Low Power (Hibernate) signal */
621#define WM8350_DCDC_HIB_SIG_REG (0 << 8)
622#define WM8350_DCDC_HIB_SIG_LPWR1 (1 << 8)
623#define WM8350_DCDC_HIB_SIG_LPWR2 (2 << 8)
624#define WM8350_DCDC_HIB_SIG_LPWR3 (3 << 8)
625
626/* LDO Low power (Hibernate) mode */
627#define WM8350_LDO_HIB_MODE_IMAGE (0 << 0)
628#define WM8350_LDO_HIB_MODE_DIS (1 << 0)
629
630/* LDO Low Power (Hibernate) signal */
631#define WM8350_LDO_HIB_SIG_REG (0 << 8)
632#define WM8350_LDO_HIB_SIG_LPWR1 (1 << 8)
633#define WM8350_LDO_HIB_SIG_LPWR2 (2 << 8)
634#define WM8350_LDO_HIB_SIG_LPWR3 (3 << 8)
635
636/*
637 * LDOs
638 */
639#define WM8350_LDO_1 6
640#define WM8350_LDO_2 7
641#define WM8350_LDO_3 8
642#define WM8350_LDO_4 9
643
644/*
645 * ISINKs
646 */
647#define WM8350_ISINK_A 10
648#define WM8350_ISINK_B 11
649
650#define WM8350_ISINK_MODE_BOOST 0
651#define WM8350_ISINK_MODE_SWITCH 1
652#define WM8350_ISINK_ILIM_NORMAL 0
653#define WM8350_ISINK_ILIM_LOW 1
654
655#define WM8350_ISINK_FLASH_DISABLE 0
656#define WM8350_ISINK_FLASH_ENABLE 1
657#define WM8350_ISINK_FLASH_TRIG_BIT 0
658#define WM8350_ISINK_FLASH_TRIG_GPIO 1
659#define WM8350_ISINK_FLASH_MODE_EN (1 << 13)
660#define WM8350_ISINK_FLASH_MODE_DIS (0 << 13)
661#define WM8350_ISINK_FLASH_DUR_32MS (0 << 8)
662#define WM8350_ISINK_FLASH_DUR_64MS (1 << 8)
663#define WM8350_ISINK_FLASH_DUR_96MS (2 << 8)
664#define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8)
665#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4)
666#define WM8350_ISINK_FLASH_ON_0_25S (1 << 4)
667#define WM8350_ISINK_FLASH_ON_0_50S (2 << 4)
668#define WM8350_ISINK_FLASH_ON_1_00S (3 << 4)
669#define WM8350_ISINK_FLASH_ON_1_95S (1 << 4)
670#define WM8350_ISINK_FLASH_ON_3_91S (2 << 4)
671#define WM8350_ISINK_FLASH_ON_7_80S (3 << 4)
672#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0)
673#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0)
674#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0)
675#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0)
676#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0)
677#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0)
678#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0)
679
680/*
681 * Regulator Interrupts.
682 */
683#define WM8350_IRQ_CS1 13
684#define WM8350_IRQ_CS2 14
685#define WM8350_IRQ_UV_LDO4 25
686#define WM8350_IRQ_UV_LDO3 26
687#define WM8350_IRQ_UV_LDO2 27
688#define WM8350_IRQ_UV_LDO1 28
689#define WM8350_IRQ_UV_DC6 29
690#define WM8350_IRQ_UV_DC5 30
691#define WM8350_IRQ_UV_DC4 31
692#define WM8350_IRQ_UV_DC3 32
693#define WM8350_IRQ_UV_DC2 33
694#define WM8350_IRQ_UV_DC1 34
695#define WM8350_IRQ_OC_LS 35
696
697#define NUM_WM8350_REGULATORS 12
698
699struct wm8350;
700struct platform_device;
701struct regulator_init_data;
702
703struct wm8350_pmic {
704 /* ISINK to DCDC mapping */
705 int isink_A_dcdc;
706 int isink_B_dcdc;
707
708 /* hibernate configs */
709 u16 dcdc1_hib_mode;
710 u16 dcdc3_hib_mode;
711 u16 dcdc4_hib_mode;
712 u16 dcdc6_hib_mode;
713
714 /* regulator devices */
715 struct platform_device *pdev[NUM_WM8350_REGULATORS];
716};
717
718int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
719 struct regulator_init_data *initdata);
720
721/*
722 * Additional DCDC control not supported via regulator API
723 */
724int wm8350_dcdc_set_slot(struct wm8350 *wm8350, int dcdc, u16 start,
725 u16 stop, u16 fault);
726int wm8350_dcdc25_set_mode(struct wm8350 *wm8350, int dcdc, u16 mode,
727 u16 ilim, u16 ramp, u16 feedback);
728
729/*
730 * Additional LDO control not supported via regulator API
731 */
732int wm8350_ldo_set_slot(struct wm8350 *wm8350, int ldo, u16 start, u16 stop);
733
734/*
735 * Additional ISINK control not supported via regulator API
736 */
737int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode,
738 u16 trigger, u16 duration, u16 on_ramp,
739 u16 off_ramp, u16 drive);
740
741#endif
diff --git a/include/linux/mfd/wm8350/rtc.h b/include/linux/mfd/wm8350/rtc.h
new file mode 100644
index 000000000000..dfda69e9f440
--- /dev/null
+++ b/include/linux/mfd/wm8350/rtc.h
@@ -0,0 +1,266 @@
1/*
2 * rtc.h -- RTC driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_RTC_H
13#define __LINUX_MFD_WM8350_RTC_H
14
15#include <linux/platform_device.h>
16
17/*
18 * Register values.
19 */
20#define WM8350_RTC_SECONDS_MINUTES 0x10
21#define WM8350_RTC_HOURS_DAY 0x11
22#define WM8350_RTC_DATE_MONTH 0x12
23#define WM8350_RTC_YEAR 0x13
24#define WM8350_ALARM_SECONDS_MINUTES 0x14
25#define WM8350_ALARM_HOURS_DAY 0x15
26#define WM8350_ALARM_DATE_MONTH 0x16
27#define WM8350_RTC_TIME_CONTROL 0x17
28
29/*
30 * R16 (0x10) - RTC Seconds/Minutes
31 */
32#define WM8350_RTC_MINS_MASK 0x7F00
33#define WM8350_RTC_MINS_SHIFT 8
34#define WM8350_RTC_SECS_MASK 0x007F
35#define WM8350_RTC_SECS_SHIFT 0
36
37/*
38 * R17 (0x11) - RTC Hours/Day
39 */
40#define WM8350_RTC_DAY_MASK 0x0700
41#define WM8350_RTC_DAY_SHIFT 8
42#define WM8350_RTC_HPM_MASK 0x0020
43#define WM8350_RTC_HPM_SHIFT 5
44#define WM8350_RTC_HRS_MASK 0x001F
45#define WM8350_RTC_HRS_SHIFT 0
46
47/* Bit values for R21 (0x15) */
48#define WM8350_RTC_DAY_SUN 1
49#define WM8350_RTC_DAY_MON 2
50#define WM8350_RTC_DAY_TUE 3
51#define WM8350_RTC_DAY_WED 4
52#define WM8350_RTC_DAY_THU 5
53#define WM8350_RTC_DAY_FRI 6
54#define WM8350_RTC_DAY_SAT 7
55
56#define WM8350_RTC_HPM_AM 0
57#define WM8350_RTC_HPM_PM 1
58
59/*
60 * R18 (0x12) - RTC Date/Month
61 */
62#define WM8350_RTC_MTH_MASK 0x1F00
63#define WM8350_RTC_MTH_SHIFT 8
64#define WM8350_RTC_DATE_MASK 0x003F
65#define WM8350_RTC_DATE_SHIFT 0
66
67/* Bit values for R22 (0x16) */
68#define WM8350_RTC_MTH_JAN 1
69#define WM8350_RTC_MTH_FEB 2
70#define WM8350_RTC_MTH_MAR 3
71#define WM8350_RTC_MTH_APR 4
72#define WM8350_RTC_MTH_MAY 5
73#define WM8350_RTC_MTH_JUN 6
74#define WM8350_RTC_MTH_JUL 7
75#define WM8350_RTC_MTH_AUG 8
76#define WM8350_RTC_MTH_SEP 9
77#define WM8350_RTC_MTH_OCT 10
78#define WM8350_RTC_MTH_NOV 11
79#define WM8350_RTC_MTH_DEC 12
80#define WM8350_RTC_MTH_JAN_BCD 0x01
81#define WM8350_RTC_MTH_FEB_BCD 0x02
82#define WM8350_RTC_MTH_MAR_BCD 0x03
83#define WM8350_RTC_MTH_APR_BCD 0x04
84#define WM8350_RTC_MTH_MAY_BCD 0x05
85#define WM8350_RTC_MTH_JUN_BCD 0x06
86#define WM8350_RTC_MTH_JUL_BCD 0x07
87#define WM8350_RTC_MTH_AUG_BCD 0x08
88#define WM8350_RTC_MTH_SEP_BCD 0x09
89#define WM8350_RTC_MTH_OCT_BCD 0x10
90#define WM8350_RTC_MTH_NOV_BCD 0x11
91#define WM8350_RTC_MTH_DEC_BCD 0x12
92
93/*
94 * R19 (0x13) - RTC Year
95 */
96#define WM8350_RTC_YHUNDREDS_MASK 0x3F00
97#define WM8350_RTC_YHUNDREDS_SHIFT 8
98#define WM8350_RTC_YUNITS_MASK 0x00FF
99#define WM8350_RTC_YUNITS_SHIFT 0
100
101/*
102 * R20 (0x14) - Alarm Seconds/Minutes
103 */
104#define WM8350_RTC_ALMMINS_MASK 0x7F00
105#define WM8350_RTC_ALMMINS_SHIFT 8
106#define WM8350_RTC_ALMSECS_MASK 0x007F
107#define WM8350_RTC_ALMSECS_SHIFT 0
108
109/* Bit values for R20 (0x14) */
110#define WM8350_RTC_ALMMINS_DONT_CARE -1
111#define WM8350_RTC_ALMSECS_DONT_CARE -1
112
113/*
114 * R21 (0x15) - Alarm Hours/Day
115 */
116#define WM8350_RTC_ALMDAY_MASK 0x0F00
117#define WM8350_RTC_ALMDAY_SHIFT 8
118#define WM8350_RTC_ALMHPM_MASK 0x0020
119#define WM8350_RTC_ALMHPM_SHIFT 5
120#define WM8350_RTC_ALMHRS_MASK 0x001F
121#define WM8350_RTC_ALMHRS_SHIFT 0
122
123/* Bit values for R21 (0x15) */
124#define WM8350_RTC_ALMDAY_DONT_CARE -1
125#define WM8350_RTC_ALMDAY_SUN 1
126#define WM8350_RTC_ALMDAY_MON 2
127#define WM8350_RTC_ALMDAY_TUE 3
128#define WM8350_RTC_ALMDAY_WED 4
129#define WM8350_RTC_ALMDAY_THU 5
130#define WM8350_RTC_ALMDAY_FRI 6
131#define WM8350_RTC_ALMDAY_SAT 7
132
133#define WM8350_RTC_ALMHPM_AM 0
134#define WM8350_RTC_ALMHPM_PM 1
135
136#define WM8350_RTC_ALMHRS_DONT_CARE -1
137
138/*
139 * R22 (0x16) - Alarm Date/Month
140 */
141#define WM8350_RTC_ALMMTH_MASK 0x1F00
142#define WM8350_RTC_ALMMTH_SHIFT 8
143#define WM8350_RTC_ALMDATE_MASK 0x003F
144#define WM8350_RTC_ALMDATE_SHIFT 0
145
146/* Bit values for R22 (0x16) */
147#define WM8350_RTC_ALMDATE_DONT_CARE -1
148
149#define WM8350_RTC_ALMMTH_DONT_CARE -1
150#define WM8350_RTC_ALMMTH_JAN 1
151#define WM8350_RTC_ALMMTH_FEB 2
152#define WM8350_RTC_ALMMTH_MAR 3
153#define WM8350_RTC_ALMMTH_APR 4
154#define WM8350_RTC_ALMMTH_MAY 5
155#define WM8350_RTC_ALMMTH_JUN 6
156#define WM8350_RTC_ALMMTH_JUL 7
157#define WM8350_RTC_ALMMTH_AUG 8
158#define WM8350_RTC_ALMMTH_SEP 9
159#define WM8350_RTC_ALMMTH_OCT 10
160#define WM8350_RTC_ALMMTH_NOV 11
161#define WM8350_RTC_ALMMTH_DEC 12
162#define WM8350_RTC_ALMMTH_JAN_BCD 0x01
163#define WM8350_RTC_ALMMTH_FEB_BCD 0x02
164#define WM8350_RTC_ALMMTH_MAR_BCD 0x03
165#define WM8350_RTC_ALMMTH_APR_BCD 0x04
166#define WM8350_RTC_ALMMTH_MAY_BCD 0x05
167#define WM8350_RTC_ALMMTH_JUN_BCD 0x06
168#define WM8350_RTC_ALMMTH_JUL_BCD 0x07
169#define WM8350_RTC_ALMMTH_AUG_BCD 0x08
170#define WM8350_RTC_ALMMTH_SEP_BCD 0x09
171#define WM8350_RTC_ALMMTH_OCT_BCD 0x10
172#define WM8350_RTC_ALMMTH_NOV_BCD 0x11
173#define WM8350_RTC_ALMMTH_DEC_BCD 0x12
174
175/*
176 * R23 (0x17) - RTC Time Control
177 */
178#define WM8350_RTC_BCD 0x8000
179#define WM8350_RTC_BCD_MASK 0x8000
180#define WM8350_RTC_BCD_SHIFT 15
181#define WM8350_RTC_12HR 0x4000
182#define WM8350_RTC_12HR_MASK 0x4000
183#define WM8350_RTC_12HR_SHIFT 14
184#define WM8350_RTC_DST 0x2000
185#define WM8350_RTC_DST_MASK 0x2000
186#define WM8350_RTC_DST_SHIFT 13
187#define WM8350_RTC_SET 0x0800
188#define WM8350_RTC_SET_MASK 0x0800
189#define WM8350_RTC_SET_SHIFT 11
190#define WM8350_RTC_STS 0x0400
191#define WM8350_RTC_STS_MASK 0x0400
192#define WM8350_RTC_STS_SHIFT 10
193#define WM8350_RTC_ALMSET 0x0200
194#define WM8350_RTC_ALMSET_MASK 0x0200
195#define WM8350_RTC_ALMSET_SHIFT 9
196#define WM8350_RTC_ALMSTS 0x0100
197#define WM8350_RTC_ALMSTS_MASK 0x0100
198#define WM8350_RTC_ALMSTS_SHIFT 8
199#define WM8350_RTC_PINT 0x0070
200#define WM8350_RTC_PINT_MASK 0x0070
201#define WM8350_RTC_PINT_SHIFT 4
202#define WM8350_RTC_DSW 0x000F
203#define WM8350_RTC_DSW_MASK 0x000F
204#define WM8350_RTC_DSW_SHIFT 0
205
206/* Bit values for R23 (0x17) */
207#define WM8350_RTC_BCD_BINARY 0
208#define WM8350_RTC_BCD_BCD 1
209
210#define WM8350_RTC_12HR_24HR 0
211#define WM8350_RTC_12HR_12HR 1
212
213#define WM8350_RTC_DST_DISABLED 0
214#define WM8350_RTC_DST_ENABLED 1
215
216#define WM8350_RTC_SET_RUN 0
217#define WM8350_RTC_SET_SET 1
218
219#define WM8350_RTC_STS_RUNNING 0
220#define WM8350_RTC_STS_STOPPED 1
221
222#define WM8350_RTC_ALMSET_RUN 0
223#define WM8350_RTC_ALMSET_SET 1
224
225#define WM8350_RTC_ALMSTS_RUNNING 0
226#define WM8350_RTC_ALMSTS_STOPPED 1
227
228#define WM8350_RTC_PINT_DISABLED 0
229#define WM8350_RTC_PINT_SECS 1
230#define WM8350_RTC_PINT_MINS 2
231#define WM8350_RTC_PINT_HRS 3
232#define WM8350_RTC_PINT_DAYS 4
233#define WM8350_RTC_PINT_MTHS 5
234
235#define WM8350_RTC_DSW_DISABLED 0
236#define WM8350_RTC_DSW_1HZ 1
237#define WM8350_RTC_DSW_2HZ 2
238#define WM8350_RTC_DSW_4HZ 3
239#define WM8350_RTC_DSW_8HZ 4
240#define WM8350_RTC_DSW_16HZ 5
241#define WM8350_RTC_DSW_32HZ 6
242#define WM8350_RTC_DSW_64HZ 7
243#define WM8350_RTC_DSW_128HZ 8
244#define WM8350_RTC_DSW_256HZ 9
245#define WM8350_RTC_DSW_512HZ 10
246#define WM8350_RTC_DSW_1024HZ 11
247
248/*
249 * R218 (0xDA) - RTC Tick Control
250 */
251#define WM8350_RTC_TICKSTS 0x4000
252#define WM8350_RTC_CLKSRC 0x2000
253#define WM8350_RTC_TRIM_MASK 0x03FF
254
255/*
256 * RTC Interrupts.
257 */
258#define WM8350_IRQ_RTC_PER 7
259#define WM8350_IRQ_RTC_SEC 8
260#define WM8350_IRQ_RTC_ALM 9
261
262struct wm8350_rtc {
263 struct platform_device *pdev;
264};
265
266#endif
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
new file mode 100644
index 000000000000..1c8f3cde79b0
--- /dev/null
+++ b/include/linux/mfd/wm8350/supply.h
@@ -0,0 +1,111 @@
1/*
2 * supply.h -- Power Supply Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_
15
16#include <linux/platform_device.h>
17
18/*
19 * Charger registers
20 */
21#define WM8350_BATTERY_CHARGER_CONTROL_1 0xA8
22#define WM8350_BATTERY_CHARGER_CONTROL_2 0xA9
23#define WM8350_BATTERY_CHARGER_CONTROL_3 0xAA
24
25/*
26 * R168 (0xA8) - Battery Charger Control 1
27 */
28#define WM8350_CHG_ENA_R168 0x8000
29#define WM8350_CHG_THR 0x2000
30#define WM8350_CHG_EOC_SEL_MASK 0x1C00
31#define WM8350_CHG_TRICKLE_TEMP_CHOKE 0x0200
32#define WM8350_CHG_TRICKLE_USB_CHOKE 0x0100
33#define WM8350_CHG_RECOVER_T 0x0080
34#define WM8350_CHG_END_ACT 0x0040
35#define WM8350_CHG_FAST 0x0020
36#define WM8350_CHG_FAST_USB_THROTTLE 0x0010
37#define WM8350_CHG_NTC_MON 0x0008
38#define WM8350_CHG_BATT_HOT_MON 0x0004
39#define WM8350_CHG_BATT_COLD_MON 0x0002
40#define WM8350_CHG_CHIP_TEMP_MON 0x0001
41
42/*
43 * R169 (0xA9) - Battery Charger Control 2
44 */
45#define WM8350_CHG_ACTIVE 0x8000
46#define WM8350_CHG_PAUSE 0x4000
47#define WM8350_CHG_STS_MASK 0x3000
48#define WM8350_CHG_TIME_MASK 0x0F00
49#define WM8350_CHG_MASK_WALL_FB 0x0080
50#define WM8350_CHG_TRICKLE_SEL 0x0040
51#define WM8350_CHG_VSEL_MASK 0x0030
52#define WM8350_CHG_ISEL_MASK 0x000F
53#define WM8350_CHG_STS_OFF 0x0000
54#define WM8350_CHG_STS_TRICKLE 0x1000
55#define WM8350_CHG_STS_FAST 0x2000
56
57/*
58 * R170 (0xAA) - Battery Charger Control 3
59 */
60#define WM8350_CHG_THROTTLE_T_MASK 0x0060
61#define WM8350_CHG_SMART 0x0010
62#define WM8350_CHG_TIMER_ADJT_MASK 0x000F
63
64/*
65 * Charger Interrupts
66 */
67#define WM8350_IRQ_CHG_BAT_HOT 0
68#define WM8350_IRQ_CHG_BAT_COLD 1
69#define WM8350_IRQ_CHG_BAT_FAIL 2
70#define WM8350_IRQ_CHG_TO 3
71#define WM8350_IRQ_CHG_END 4
72#define WM8350_IRQ_CHG_START 5
73#define WM8350_IRQ_CHG_FAST_RDY 6
74#define WM8350_IRQ_CHG_VBATT_LT_3P9 10
75#define WM8350_IRQ_CHG_VBATT_LT_3P1 11
76#define WM8350_IRQ_CHG_VBATT_LT_2P85 12
77
78/*
79 * Charger Policy
80 */
81#define WM8350_CHG_TRICKLE_50mA (0 << 6)
82#define WM8350_CHG_TRICKLE_100mA (1 << 6)
83#define WM8350_CHG_4_05V (0 << 4)
84#define WM8350_CHG_4_10V (1 << 4)
85#define WM8350_CHG_4_15V (2 << 4)
86#define WM8350_CHG_4_20V (3 << 4)
87#define WM8350_CHG_FAST_LIMIT_mA(x) ((x / 50) & 0xf)
88#define WM8350_CHG_EOC_mA(x) (((x - 10) & 0x7) << 10)
89#define WM8350_CHG_TRICKLE_3_1V (0 << 13)
90#define WM8350_CHG_TRICKLE_3_9V (1 << 13)
91
92/*
93 * Supply Registers.
94 */
95#define WM8350_USB_VOLTAGE_READBACK 0x9C
96#define WM8350_LINE_VOLTAGE_READBACK 0x9D
97#define WM8350_BATT_VOLTAGE_READBACK 0x9E
98
99/*
100 * Supply Interrupts.
101 */
102#define WM8350_IRQ_USB_LIMIT 15
103#define WM8350_IRQ_EXT_USB_FB 36
104#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38
106
107struct wm8350_power {
108 struct platform_device *pdev;
109};
110
111#endif
diff --git a/include/linux/mfd/wm8350/wdt.h b/include/linux/mfd/wm8350/wdt.h
new file mode 100644
index 000000000000..f6135b5e5ef4
--- /dev/null
+++ b/include/linux/mfd/wm8350/wdt.h
@@ -0,0 +1,28 @@
1/*
2 * wdt.h -- Watchdog Driver for Wolfson WM8350 PMIC
3 *
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef __LINUX_MFD_WM8350_WDT_H_
13#define __LINUX_MFD_WM8350_WDT_H_
14
15#include <linux/platform_device.h>
16
17#define WM8350_WDOG_HIB_MODE 0x0080
18#define WM8350_WDOG_DEBUG 0x0040
19#define WM8350_WDOG_MODE_MASK 0x0030
20#define WM8350_WDOG_TO_MASK 0x0007
21
22#define WM8350_IRQ_SYS_WDOG_TO 24
23
24struct wm8350_wdt {
25 struct platform_device *pdev;
26};
27
28#endif
diff --git a/include/linux/mfd/wm8400-audio.h b/include/linux/mfd/wm8400-audio.h
new file mode 100644
index 000000000000..b6640e018046
--- /dev/null
+++ b/include/linux/mfd/wm8400-audio.h
@@ -0,0 +1,1186 @@
1/*
2 * wm8400 private definitions for audio
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_AUDIO_H
22#define __LINUX_MFD_WM8400_AUDIO_H
23
24#include <linux/mfd/wm8400-audio.h>
25
26/*
27 * R2 (0x02) - Power Management (1)
28 */
29#define WM8400_CODEC_ENA 0x8000 /* CODEC_ENA */
30#define WM8400_CODEC_ENA_MASK 0x8000 /* CODEC_ENA */
31#define WM8400_CODEC_ENA_SHIFT 15 /* CODEC_ENA */
32#define WM8400_CODEC_ENA_WIDTH 1 /* CODEC_ENA */
33#define WM8400_SYSCLK_ENA 0x4000 /* SYSCLK_ENA */
34#define WM8400_SYSCLK_ENA_MASK 0x4000 /* SYSCLK_ENA */
35#define WM8400_SYSCLK_ENA_SHIFT 14 /* SYSCLK_ENA */
36#define WM8400_SYSCLK_ENA_WIDTH 1 /* SYSCLK_ENA */
37#define WM8400_SPK_MIX_ENA 0x2000 /* SPK_MIX_ENA */
38#define WM8400_SPK_MIX_ENA_MASK 0x2000 /* SPK_MIX_ENA */
39#define WM8400_SPK_MIX_ENA_SHIFT 13 /* SPK_MIX_ENA */
40#define WM8400_SPK_MIX_ENA_WIDTH 1 /* SPK_MIX_ENA */
41#define WM8400_SPK_ENA 0x1000 /* SPK_ENA */
42#define WM8400_SPK_ENA_MASK 0x1000 /* SPK_ENA */
43#define WM8400_SPK_ENA_SHIFT 12 /* SPK_ENA */
44#define WM8400_SPK_ENA_WIDTH 1 /* SPK_ENA */
45#define WM8400_OUT3_ENA 0x0800 /* OUT3_ENA */
46#define WM8400_OUT3_ENA_MASK 0x0800 /* OUT3_ENA */
47#define WM8400_OUT3_ENA_SHIFT 11 /* OUT3_ENA */
48#define WM8400_OUT3_ENA_WIDTH 1 /* OUT3_ENA */
49#define WM8400_OUT4_ENA 0x0400 /* OUT4_ENA */
50#define WM8400_OUT4_ENA_MASK 0x0400 /* OUT4_ENA */
51#define WM8400_OUT4_ENA_SHIFT 10 /* OUT4_ENA */
52#define WM8400_OUT4_ENA_WIDTH 1 /* OUT4_ENA */
53#define WM8400_LOUT_ENA 0x0200 /* LOUT_ENA */
54#define WM8400_LOUT_ENA_MASK 0x0200 /* LOUT_ENA */
55#define WM8400_LOUT_ENA_SHIFT 9 /* LOUT_ENA */
56#define WM8400_LOUT_ENA_WIDTH 1 /* LOUT_ENA */
57#define WM8400_ROUT_ENA 0x0100 /* ROUT_ENA */
58#define WM8400_ROUT_ENA_MASK 0x0100 /* ROUT_ENA */
59#define WM8400_ROUT_ENA_SHIFT 8 /* ROUT_ENA */
60#define WM8400_ROUT_ENA_WIDTH 1 /* ROUT_ENA */
61#define WM8400_MIC1BIAS_ENA 0x0010 /* MIC1BIAS_ENA */
62#define WM8400_MIC1BIAS_ENA_MASK 0x0010 /* MIC1BIAS_ENA */
63#define WM8400_MIC1BIAS_ENA_SHIFT 4 /* MIC1BIAS_ENA */
64#define WM8400_MIC1BIAS_ENA_WIDTH 1 /* MIC1BIAS_ENA */
65#define WM8400_VMID_MODE_MASK 0x0006 /* VMID_MODE - [2:1] */
66#define WM8400_VMID_MODE_SHIFT 1 /* VMID_MODE - [2:1] */
67#define WM8400_VMID_MODE_WIDTH 2 /* VMID_MODE - [2:1] */
68#define WM8400_VREF_ENA 0x0001 /* VREF_ENA */
69#define WM8400_VREF_ENA_MASK 0x0001 /* VREF_ENA */
70#define WM8400_VREF_ENA_SHIFT 0 /* VREF_ENA */
71#define WM8400_VREF_ENA_WIDTH 1 /* VREF_ENA */
72
73/*
74 * R3 (0x03) - Power Management (2)
75 */
76#define WM8400_FLL_ENA 0x8000 /* FLL_ENA */
77#define WM8400_FLL_ENA_MASK 0x8000 /* FLL_ENA */
78#define WM8400_FLL_ENA_SHIFT 15 /* FLL_ENA */
79#define WM8400_FLL_ENA_WIDTH 1 /* FLL_ENA */
80#define WM8400_TSHUT_ENA 0x4000 /* TSHUT_ENA */
81#define WM8400_TSHUT_ENA_MASK 0x4000 /* TSHUT_ENA */
82#define WM8400_TSHUT_ENA_SHIFT 14 /* TSHUT_ENA */
83#define WM8400_TSHUT_ENA_WIDTH 1 /* TSHUT_ENA */
84#define WM8400_TSHUT_OPDIS 0x2000 /* TSHUT_OPDIS */
85#define WM8400_TSHUT_OPDIS_MASK 0x2000 /* TSHUT_OPDIS */
86#define WM8400_TSHUT_OPDIS_SHIFT 13 /* TSHUT_OPDIS */
87#define WM8400_TSHUT_OPDIS_WIDTH 1 /* TSHUT_OPDIS */
88#define WM8400_OPCLK_ENA 0x0800 /* OPCLK_ENA */
89#define WM8400_OPCLK_ENA_MASK 0x0800 /* OPCLK_ENA */
90#define WM8400_OPCLK_ENA_SHIFT 11 /* OPCLK_ENA */
91#define WM8400_OPCLK_ENA_WIDTH 1 /* OPCLK_ENA */
92#define WM8400_AINL_ENA 0x0200 /* AINL_ENA */
93#define WM8400_AINL_ENA_MASK 0x0200 /* AINL_ENA */
94#define WM8400_AINL_ENA_SHIFT 9 /* AINL_ENA */
95#define WM8400_AINL_ENA_WIDTH 1 /* AINL_ENA */
96#define WM8400_AINR_ENA 0x0100 /* AINR_ENA */
97#define WM8400_AINR_ENA_MASK 0x0100 /* AINR_ENA */
98#define WM8400_AINR_ENA_SHIFT 8 /* AINR_ENA */
99#define WM8400_AINR_ENA_WIDTH 1 /* AINR_ENA */
100#define WM8400_LIN34_ENA 0x0080 /* LIN34_ENA */
101#define WM8400_LIN34_ENA_MASK 0x0080 /* LIN34_ENA */
102#define WM8400_LIN34_ENA_SHIFT 7 /* LIN34_ENA */
103#define WM8400_LIN34_ENA_WIDTH 1 /* LIN34_ENA */
104#define WM8400_LIN12_ENA 0x0040 /* LIN12_ENA */
105#define WM8400_LIN12_ENA_MASK 0x0040 /* LIN12_ENA */
106#define WM8400_LIN12_ENA_SHIFT 6 /* LIN12_ENA */
107#define WM8400_LIN12_ENA_WIDTH 1 /* LIN12_ENA */
108#define WM8400_RIN34_ENA 0x0020 /* RIN34_ENA */
109#define WM8400_RIN34_ENA_MASK 0x0020 /* RIN34_ENA */
110#define WM8400_RIN34_ENA_SHIFT 5 /* RIN34_ENA */
111#define WM8400_RIN34_ENA_WIDTH 1 /* RIN34_ENA */
112#define WM8400_RIN12_ENA 0x0010 /* RIN12_ENA */
113#define WM8400_RIN12_ENA_MASK 0x0010 /* RIN12_ENA */
114#define WM8400_RIN12_ENA_SHIFT 4 /* RIN12_ENA */
115#define WM8400_RIN12_ENA_WIDTH 1 /* RIN12_ENA */
116#define WM8400_ADCL_ENA 0x0002 /* ADCL_ENA */
117#define WM8400_ADCL_ENA_MASK 0x0002 /* ADCL_ENA */
118#define WM8400_ADCL_ENA_SHIFT 1 /* ADCL_ENA */
119#define WM8400_ADCL_ENA_WIDTH 1 /* ADCL_ENA */
120#define WM8400_ADCR_ENA 0x0001 /* ADCR_ENA */
121#define WM8400_ADCR_ENA_MASK 0x0001 /* ADCR_ENA */
122#define WM8400_ADCR_ENA_SHIFT 0 /* ADCR_ENA */
123#define WM8400_ADCR_ENA_WIDTH 1 /* ADCR_ENA */
124
125/*
126 * R4 (0x04) - Power Management (3)
127 */
128#define WM8400_LON_ENA 0x2000 /* LON_ENA */
129#define WM8400_LON_ENA_MASK 0x2000 /* LON_ENA */
130#define WM8400_LON_ENA_SHIFT 13 /* LON_ENA */
131#define WM8400_LON_ENA_WIDTH 1 /* LON_ENA */
132#define WM8400_LOP_ENA 0x1000 /* LOP_ENA */
133#define WM8400_LOP_ENA_MASK 0x1000 /* LOP_ENA */
134#define WM8400_LOP_ENA_SHIFT 12 /* LOP_ENA */
135#define WM8400_LOP_ENA_WIDTH 1 /* LOP_ENA */
136#define WM8400_RON_ENA 0x0800 /* RON_ENA */
137#define WM8400_RON_ENA_MASK 0x0800 /* RON_ENA */
138#define WM8400_RON_ENA_SHIFT 11 /* RON_ENA */
139#define WM8400_RON_ENA_WIDTH 1 /* RON_ENA */
140#define WM8400_ROP_ENA 0x0400 /* ROP_ENA */
141#define WM8400_ROP_ENA_MASK 0x0400 /* ROP_ENA */
142#define WM8400_ROP_ENA_SHIFT 10 /* ROP_ENA */
143#define WM8400_ROP_ENA_WIDTH 1 /* ROP_ENA */
144#define WM8400_LOPGA_ENA 0x0080 /* LOPGA_ENA */
145#define WM8400_LOPGA_ENA_MASK 0x0080 /* LOPGA_ENA */
146#define WM8400_LOPGA_ENA_SHIFT 7 /* LOPGA_ENA */
147#define WM8400_LOPGA_ENA_WIDTH 1 /* LOPGA_ENA */
148#define WM8400_ROPGA_ENA 0x0040 /* ROPGA_ENA */
149#define WM8400_ROPGA_ENA_MASK 0x0040 /* ROPGA_ENA */
150#define WM8400_ROPGA_ENA_SHIFT 6 /* ROPGA_ENA */
151#define WM8400_ROPGA_ENA_WIDTH 1 /* ROPGA_ENA */
152#define WM8400_LOMIX_ENA 0x0020 /* LOMIX_ENA */
153#define WM8400_LOMIX_ENA_MASK 0x0020 /* LOMIX_ENA */
154#define WM8400_LOMIX_ENA_SHIFT 5 /* LOMIX_ENA */
155#define WM8400_LOMIX_ENA_WIDTH 1 /* LOMIX_ENA */
156#define WM8400_ROMIX_ENA 0x0010 /* ROMIX_ENA */
157#define WM8400_ROMIX_ENA_MASK 0x0010 /* ROMIX_ENA */
158#define WM8400_ROMIX_ENA_SHIFT 4 /* ROMIX_ENA */
159#define WM8400_ROMIX_ENA_WIDTH 1 /* ROMIX_ENA */
160#define WM8400_DACL_ENA 0x0002 /* DACL_ENA */
161#define WM8400_DACL_ENA_MASK 0x0002 /* DACL_ENA */
162#define WM8400_DACL_ENA_SHIFT 1 /* DACL_ENA */
163#define WM8400_DACL_ENA_WIDTH 1 /* DACL_ENA */
164#define WM8400_DACR_ENA 0x0001 /* DACR_ENA */
165#define WM8400_DACR_ENA_MASK 0x0001 /* DACR_ENA */
166#define WM8400_DACR_ENA_SHIFT 0 /* DACR_ENA */
167#define WM8400_DACR_ENA_WIDTH 1 /* DACR_ENA */
168
169/*
170 * R5 (0x05) - Audio Interface (1)
171 */
172#define WM8400_AIFADCL_SRC 0x8000 /* AIFADCL_SRC */
173#define WM8400_AIFADCL_SRC_MASK 0x8000 /* AIFADCL_SRC */
174#define WM8400_AIFADCL_SRC_SHIFT 15 /* AIFADCL_SRC */
175#define WM8400_AIFADCL_SRC_WIDTH 1 /* AIFADCL_SRC */
176#define WM8400_AIFADCR_SRC 0x4000 /* AIFADCR_SRC */
177#define WM8400_AIFADCR_SRC_MASK 0x4000 /* AIFADCR_SRC */
178#define WM8400_AIFADCR_SRC_SHIFT 14 /* AIFADCR_SRC */
179#define WM8400_AIFADCR_SRC_WIDTH 1 /* AIFADCR_SRC */
180#define WM8400_AIFADC_TDM 0x2000 /* AIFADC_TDM */
181#define WM8400_AIFADC_TDM_MASK 0x2000 /* AIFADC_TDM */
182#define WM8400_AIFADC_TDM_SHIFT 13 /* AIFADC_TDM */
183#define WM8400_AIFADC_TDM_WIDTH 1 /* AIFADC_TDM */
184#define WM8400_AIFADC_TDM_CHAN 0x1000 /* AIFADC_TDM_CHAN */
185#define WM8400_AIFADC_TDM_CHAN_MASK 0x1000 /* AIFADC_TDM_CHAN */
186#define WM8400_AIFADC_TDM_CHAN_SHIFT 12 /* AIFADC_TDM_CHAN */
187#define WM8400_AIFADC_TDM_CHAN_WIDTH 1 /* AIFADC_TDM_CHAN */
188#define WM8400_AIF_BCLK_INV 0x0100 /* AIF_BCLK_INV */
189#define WM8400_AIF_BCLK_INV_MASK 0x0100 /* AIF_BCLK_INV */
190#define WM8400_AIF_BCLK_INV_SHIFT 8 /* AIF_BCLK_INV */
191#define WM8400_AIF_BCLK_INV_WIDTH 1 /* AIF_BCLK_INV */
192#define WM8400_AIF_LRCLK_INV 0x0080 /* AIF_LRCLK_INV */
193#define WM8400_AIF_LRCLK_INV_MASK 0x0080 /* AIF_LRCLK_INV */
194#define WM8400_AIF_LRCLK_INV_SHIFT 7 /* AIF_LRCLK_INV */
195#define WM8400_AIF_LRCLK_INV_WIDTH 1 /* AIF_LRCLK_INV */
196#define WM8400_AIF_WL_MASK 0x0060 /* AIF_WL - [6:5] */
197#define WM8400_AIF_WL_SHIFT 5 /* AIF_WL - [6:5] */
198#define WM8400_AIF_WL_WIDTH 2 /* AIF_WL - [6:5] */
199#define WM8400_AIF_WL_16BITS (0 << 5)
200#define WM8400_AIF_WL_20BITS (1 << 5)
201#define WM8400_AIF_WL_24BITS (2 << 5)
202#define WM8400_AIF_WL_32BITS (3 << 5)
203#define WM8400_AIF_FMT_MASK 0x0018 /* AIF_FMT - [4:3] */
204#define WM8400_AIF_FMT_SHIFT 3 /* AIF_FMT - [4:3] */
205#define WM8400_AIF_FMT_WIDTH 2 /* AIF_FMT - [4:3] */
206#define WM8400_AIF_FMT_RIGHTJ (0 << 3)
207#define WM8400_AIF_FMT_LEFTJ (1 << 3)
208#define WM8400_AIF_FMT_I2S (2 << 3)
209#define WM8400_AIF_FMT_DSP (3 << 3)
210
211/*
212 * R6 (0x06) - Audio Interface (2)
213 */
214#define WM8400_DACL_SRC 0x8000 /* DACL_SRC */
215#define WM8400_DACL_SRC_MASK 0x8000 /* DACL_SRC */
216#define WM8400_DACL_SRC_SHIFT 15 /* DACL_SRC */
217#define WM8400_DACL_SRC_WIDTH 1 /* DACL_SRC */
218#define WM8400_DACR_SRC 0x4000 /* DACR_SRC */
219#define WM8400_DACR_SRC_MASK 0x4000 /* DACR_SRC */
220#define WM8400_DACR_SRC_SHIFT 14 /* DACR_SRC */
221#define WM8400_DACR_SRC_WIDTH 1 /* DACR_SRC */
222#define WM8400_AIFDAC_TDM 0x2000 /* AIFDAC_TDM */
223#define WM8400_AIFDAC_TDM_MASK 0x2000 /* AIFDAC_TDM */
224#define WM8400_AIFDAC_TDM_SHIFT 13 /* AIFDAC_TDM */
225#define WM8400_AIFDAC_TDM_WIDTH 1 /* AIFDAC_TDM */
226#define WM8400_AIFDAC_TDM_CHAN 0x1000 /* AIFDAC_TDM_CHAN */
227#define WM8400_AIFDAC_TDM_CHAN_MASK 0x1000 /* AIFDAC_TDM_CHAN */
228#define WM8400_AIFDAC_TDM_CHAN_SHIFT 12 /* AIFDAC_TDM_CHAN */
229#define WM8400_AIFDAC_TDM_CHAN_WIDTH 1 /* AIFDAC_TDM_CHAN */
230#define WM8400_DAC_BOOST_MASK 0x0C00 /* DAC_BOOST - [11:10] */
231#define WM8400_DAC_BOOST_SHIFT 10 /* DAC_BOOST - [11:10] */
232#define WM8400_DAC_BOOST_WIDTH 2 /* DAC_BOOST - [11:10] */
233#define WM8400_DAC_COMP 0x0010 /* DAC_COMP */
234#define WM8400_DAC_COMP_MASK 0x0010 /* DAC_COMP */
235#define WM8400_DAC_COMP_SHIFT 4 /* DAC_COMP */
236#define WM8400_DAC_COMP_WIDTH 1 /* DAC_COMP */
237#define WM8400_DAC_COMPMODE 0x0008 /* DAC_COMPMODE */
238#define WM8400_DAC_COMPMODE_MASK 0x0008 /* DAC_COMPMODE */
239#define WM8400_DAC_COMPMODE_SHIFT 3 /* DAC_COMPMODE */
240#define WM8400_DAC_COMPMODE_WIDTH 1 /* DAC_COMPMODE */
241#define WM8400_ADC_COMP 0x0004 /* ADC_COMP */
242#define WM8400_ADC_COMP_MASK 0x0004 /* ADC_COMP */
243#define WM8400_ADC_COMP_SHIFT 2 /* ADC_COMP */
244#define WM8400_ADC_COMP_WIDTH 1 /* ADC_COMP */
245#define WM8400_ADC_COMPMODE 0x0002 /* ADC_COMPMODE */
246#define WM8400_ADC_COMPMODE_MASK 0x0002 /* ADC_COMPMODE */
247#define WM8400_ADC_COMPMODE_SHIFT 1 /* ADC_COMPMODE */
248#define WM8400_ADC_COMPMODE_WIDTH 1 /* ADC_COMPMODE */
249#define WM8400_LOOPBACK 0x0001 /* LOOPBACK */
250#define WM8400_LOOPBACK_MASK 0x0001 /* LOOPBACK */
251#define WM8400_LOOPBACK_SHIFT 0 /* LOOPBACK */
252#define WM8400_LOOPBACK_WIDTH 1 /* LOOPBACK */
253
254/*
255 * R7 (0x07) - Clocking (1)
256 */
257#define WM8400_TOCLK_RATE 0x8000 /* TOCLK_RATE */
258#define WM8400_TOCLK_RATE_MASK 0x8000 /* TOCLK_RATE */
259#define WM8400_TOCLK_RATE_SHIFT 15 /* TOCLK_RATE */
260#define WM8400_TOCLK_RATE_WIDTH 1 /* TOCLK_RATE */
261#define WM8400_TOCLK_ENA 0x4000 /* TOCLK_ENA */
262#define WM8400_TOCLK_ENA_MASK 0x4000 /* TOCLK_ENA */
263#define WM8400_TOCLK_ENA_SHIFT 14 /* TOCLK_ENA */
264#define WM8400_TOCLK_ENA_WIDTH 1 /* TOCLK_ENA */
265#define WM8400_OPCLKDIV_MASK 0x1E00 /* OPCLKDIV - [12:9] */
266#define WM8400_OPCLKDIV_SHIFT 9 /* OPCLKDIV - [12:9] */
267#define WM8400_OPCLKDIV_WIDTH 4 /* OPCLKDIV - [12:9] */
268#define WM8400_DCLKDIV_MASK 0x01C0 /* DCLKDIV - [8:6] */
269#define WM8400_DCLKDIV_SHIFT 6 /* DCLKDIV - [8:6] */
270#define WM8400_DCLKDIV_WIDTH 3 /* DCLKDIV - [8:6] */
271#define WM8400_BCLK_DIV_MASK 0x001E /* BCLK_DIV - [4:1] */
272#define WM8400_BCLK_DIV_SHIFT 1 /* BCLK_DIV - [4:1] */
273#define WM8400_BCLK_DIV_WIDTH 4 /* BCLK_DIV - [4:1] */
274
275/*
276 * R8 (0x08) - Clocking (2)
277 */
278#define WM8400_MCLK_SRC 0x8000 /* MCLK_SRC */
279#define WM8400_MCLK_SRC_MASK 0x8000 /* MCLK_SRC */
280#define WM8400_MCLK_SRC_SHIFT 15 /* MCLK_SRC */
281#define WM8400_MCLK_SRC_WIDTH 1 /* MCLK_SRC */
282#define WM8400_SYSCLK_SRC 0x4000 /* SYSCLK_SRC */
283#define WM8400_SYSCLK_SRC_MASK 0x4000 /* SYSCLK_SRC */
284#define WM8400_SYSCLK_SRC_SHIFT 14 /* SYSCLK_SRC */
285#define WM8400_SYSCLK_SRC_WIDTH 1 /* SYSCLK_SRC */
286#define WM8400_CLK_FORCE 0x2000 /* CLK_FORCE */
287#define WM8400_CLK_FORCE_MASK 0x2000 /* CLK_FORCE */
288#define WM8400_CLK_FORCE_SHIFT 13 /* CLK_FORCE */
289#define WM8400_CLK_FORCE_WIDTH 1 /* CLK_FORCE */
290#define WM8400_MCLK_DIV_MASK 0x1800 /* MCLK_DIV - [12:11] */
291#define WM8400_MCLK_DIV_SHIFT 11 /* MCLK_DIV - [12:11] */
292#define WM8400_MCLK_DIV_WIDTH 2 /* MCLK_DIV - [12:11] */
293#define WM8400_MCLK_INV 0x0400 /* MCLK_INV */
294#define WM8400_MCLK_INV_MASK 0x0400 /* MCLK_INV */
295#define WM8400_MCLK_INV_SHIFT 10 /* MCLK_INV */
296#define WM8400_MCLK_INV_WIDTH 1 /* MCLK_INV */
297#define WM8400_ADC_CLKDIV_MASK 0x00E0 /* ADC_CLKDIV - [7:5] */
298#define WM8400_ADC_CLKDIV_SHIFT 5 /* ADC_CLKDIV - [7:5] */
299#define WM8400_ADC_CLKDIV_WIDTH 3 /* ADC_CLKDIV - [7:5] */
300#define WM8400_DAC_CLKDIV_MASK 0x001C /* DAC_CLKDIV - [4:2] */
301#define WM8400_DAC_CLKDIV_SHIFT 2 /* DAC_CLKDIV - [4:2] */
302#define WM8400_DAC_CLKDIV_WIDTH 3 /* DAC_CLKDIV - [4:2] */
303
304/*
305 * R9 (0x09) - Audio Interface (3)
306 */
307#define WM8400_AIF_MSTR1 0x8000 /* AIF_MSTR1 */
308#define WM8400_AIF_MSTR1_MASK 0x8000 /* AIF_MSTR1 */
309#define WM8400_AIF_MSTR1_SHIFT 15 /* AIF_MSTR1 */
310#define WM8400_AIF_MSTR1_WIDTH 1 /* AIF_MSTR1 */
311#define WM8400_AIF_MSTR2 0x4000 /* AIF_MSTR2 */
312#define WM8400_AIF_MSTR2_MASK 0x4000 /* AIF_MSTR2 */
313#define WM8400_AIF_MSTR2_SHIFT 14 /* AIF_MSTR2 */
314#define WM8400_AIF_MSTR2_WIDTH 1 /* AIF_MSTR2 */
315#define WM8400_AIF_SEL 0x2000 /* AIF_SEL */
316#define WM8400_AIF_SEL_MASK 0x2000 /* AIF_SEL */
317#define WM8400_AIF_SEL_SHIFT 13 /* AIF_SEL */
318#define WM8400_AIF_SEL_WIDTH 1 /* AIF_SEL */
319#define WM8400_ADCLRC_DIR 0x0800 /* ADCLRC_DIR */
320#define WM8400_ADCLRC_DIR_MASK 0x0800 /* ADCLRC_DIR */
321#define WM8400_ADCLRC_DIR_SHIFT 11 /* ADCLRC_DIR */
322#define WM8400_ADCLRC_DIR_WIDTH 1 /* ADCLRC_DIR */
323#define WM8400_ADCLRC_RATE_MASK 0x07FF /* ADCLRC_RATE - [10:0] */
324#define WM8400_ADCLRC_RATE_SHIFT 0 /* ADCLRC_RATE - [10:0] */
325#define WM8400_ADCLRC_RATE_WIDTH 11 /* ADCLRC_RATE - [10:0] */
326
327/*
328 * R10 (0x0A) - Audio Interface (4)
329 */
330#define WM8400_ALRCGPIO1 0x8000 /* ALRCGPIO1 */
331#define WM8400_ALRCGPIO1_MASK 0x8000 /* ALRCGPIO1 */
332#define WM8400_ALRCGPIO1_SHIFT 15 /* ALRCGPIO1 */
333#define WM8400_ALRCGPIO1_WIDTH 1 /* ALRCGPIO1 */
334#define WM8400_ALRCBGPIO6 0x4000 /* ALRCBGPIO6 */
335#define WM8400_ALRCBGPIO6_MASK 0x4000 /* ALRCBGPIO6 */
336#define WM8400_ALRCBGPIO6_SHIFT 14 /* ALRCBGPIO6 */
337#define WM8400_ALRCBGPIO6_WIDTH 1 /* ALRCBGPIO6 */
338#define WM8400_AIF_TRIS 0x2000 /* AIF_TRIS */
339#define WM8400_AIF_TRIS_MASK 0x2000 /* AIF_TRIS */
340#define WM8400_AIF_TRIS_SHIFT 13 /* AIF_TRIS */
341#define WM8400_AIF_TRIS_WIDTH 1 /* AIF_TRIS */
342#define WM8400_DACLRC_DIR 0x0800 /* DACLRC_DIR */
343#define WM8400_DACLRC_DIR_MASK 0x0800 /* DACLRC_DIR */
344#define WM8400_DACLRC_DIR_SHIFT 11 /* DACLRC_DIR */
345#define WM8400_DACLRC_DIR_WIDTH 1 /* DACLRC_DIR */
346#define WM8400_DACLRC_RATE_MASK 0x07FF /* DACLRC_RATE - [10:0] */
347#define WM8400_DACLRC_RATE_SHIFT 0 /* DACLRC_RATE - [10:0] */
348#define WM8400_DACLRC_RATE_WIDTH 11 /* DACLRC_RATE - [10:0] */
349
350/*
351 * R11 (0x0B) - DAC CTRL
352 */
353#define WM8400_DAC_SDMCLK_RATE 0x2000 /* DAC_SDMCLK_RATE */
354#define WM8400_DAC_SDMCLK_RATE_MASK 0x2000 /* DAC_SDMCLK_RATE */
355#define WM8400_DAC_SDMCLK_RATE_SHIFT 13 /* DAC_SDMCLK_RATE */
356#define WM8400_DAC_SDMCLK_RATE_WIDTH 1 /* DAC_SDMCLK_RATE */
357#define WM8400_AIF_LRCLKRATE 0x0400 /* AIF_LRCLKRATE */
358#define WM8400_AIF_LRCLKRATE_MASK 0x0400 /* AIF_LRCLKRATE */
359#define WM8400_AIF_LRCLKRATE_SHIFT 10 /* AIF_LRCLKRATE */
360#define WM8400_AIF_LRCLKRATE_WIDTH 1 /* AIF_LRCLKRATE */
361#define WM8400_DAC_MONO 0x0200 /* DAC_MONO */
362#define WM8400_DAC_MONO_MASK 0x0200 /* DAC_MONO */
363#define WM8400_DAC_MONO_SHIFT 9 /* DAC_MONO */
364#define WM8400_DAC_MONO_WIDTH 1 /* DAC_MONO */
365#define WM8400_DAC_SB_FILT 0x0100 /* DAC_SB_FILT */
366#define WM8400_DAC_SB_FILT_MASK 0x0100 /* DAC_SB_FILT */
367#define WM8400_DAC_SB_FILT_SHIFT 8 /* DAC_SB_FILT */
368#define WM8400_DAC_SB_FILT_WIDTH 1 /* DAC_SB_FILT */
369#define WM8400_DAC_MUTERATE 0x0080 /* DAC_MUTERATE */
370#define WM8400_DAC_MUTERATE_MASK 0x0080 /* DAC_MUTERATE */
371#define WM8400_DAC_MUTERATE_SHIFT 7 /* DAC_MUTERATE */
372#define WM8400_DAC_MUTERATE_WIDTH 1 /* DAC_MUTERATE */
373#define WM8400_DAC_MUTEMODE 0x0040 /* DAC_MUTEMODE */
374#define WM8400_DAC_MUTEMODE_MASK 0x0040 /* DAC_MUTEMODE */
375#define WM8400_DAC_MUTEMODE_SHIFT 6 /* DAC_MUTEMODE */
376#define WM8400_DAC_MUTEMODE_WIDTH 1 /* DAC_MUTEMODE */
377#define WM8400_DEEMP_MASK 0x0030 /* DEEMP - [5:4] */
378#define WM8400_DEEMP_SHIFT 4 /* DEEMP - [5:4] */
379#define WM8400_DEEMP_WIDTH 2 /* DEEMP - [5:4] */
380#define WM8400_DAC_MUTE 0x0004 /* DAC_MUTE */
381#define WM8400_DAC_MUTE_MASK 0x0004 /* DAC_MUTE */
382#define WM8400_DAC_MUTE_SHIFT 2 /* DAC_MUTE */
383#define WM8400_DAC_MUTE_WIDTH 1 /* DAC_MUTE */
384#define WM8400_DACL_DATINV 0x0002 /* DACL_DATINV */
385#define WM8400_DACL_DATINV_MASK 0x0002 /* DACL_DATINV */
386#define WM8400_DACL_DATINV_SHIFT 1 /* DACL_DATINV */
387#define WM8400_DACL_DATINV_WIDTH 1 /* DACL_DATINV */
388#define WM8400_DACR_DATINV 0x0001 /* DACR_DATINV */
389#define WM8400_DACR_DATINV_MASK 0x0001 /* DACR_DATINV */
390#define WM8400_DACR_DATINV_SHIFT 0 /* DACR_DATINV */
391#define WM8400_DACR_DATINV_WIDTH 1 /* DACR_DATINV */
392
393/*
394 * R12 (0x0C) - Left DAC Digital Volume
395 */
396#define WM8400_DAC_VU 0x0100 /* DAC_VU */
397#define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */
398#define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */
399#define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */
400#define WM8400_DACL_VOL_MASK 0x00FF /* DACL_VOL - [7:0] */
401#define WM8400_DACL_VOL_SHIFT 0 /* DACL_VOL - [7:0] */
402#define WM8400_DACL_VOL_WIDTH 8 /* DACL_VOL - [7:0] */
403
404/*
405 * R13 (0x0D) - Right DAC Digital Volume
406 */
407#define WM8400_DAC_VU 0x0100 /* DAC_VU */
408#define WM8400_DAC_VU_MASK 0x0100 /* DAC_VU */
409#define WM8400_DAC_VU_SHIFT 8 /* DAC_VU */
410#define WM8400_DAC_VU_WIDTH 1 /* DAC_VU */
411#define WM8400_DACR_VOL_MASK 0x00FF /* DACR_VOL - [7:0] */
412#define WM8400_DACR_VOL_SHIFT 0 /* DACR_VOL - [7:0] */
413#define WM8400_DACR_VOL_WIDTH 8 /* DACR_VOL - [7:0] */
414
415/*
416 * R14 (0x0E) - Digital Side Tone
417 */
418#define WM8400_ADCL_DAC_SVOL_MASK 0x1E00 /* ADCL_DAC_SVOL - [12:9] */
419#define WM8400_ADCL_DAC_SVOL_SHIFT 9 /* ADCL_DAC_SVOL - [12:9] */
420#define WM8400_ADCL_DAC_SVOL_WIDTH 4 /* ADCL_DAC_SVOL - [12:9] */
421#define WM8400_ADCR_DAC_SVOL_MASK 0x01E0 /* ADCR_DAC_SVOL - [8:5] */
422#define WM8400_ADCR_DAC_SVOL_SHIFT 5 /* ADCR_DAC_SVOL - [8:5] */
423#define WM8400_ADCR_DAC_SVOL_WIDTH 4 /* ADCR_DAC_SVOL - [8:5] */
424#define WM8400_ADC_TO_DACL_MASK 0x000C /* ADC_TO_DACL - [3:2] */
425#define WM8400_ADC_TO_DACL_SHIFT 2 /* ADC_TO_DACL - [3:2] */
426#define WM8400_ADC_TO_DACL_WIDTH 2 /* ADC_TO_DACL - [3:2] */
427#define WM8400_ADC_TO_DACR_MASK 0x0003 /* ADC_TO_DACR - [1:0] */
428#define WM8400_ADC_TO_DACR_SHIFT 0 /* ADC_TO_DACR - [1:0] */
429#define WM8400_ADC_TO_DACR_WIDTH 2 /* ADC_TO_DACR - [1:0] */
430
431/*
432 * R15 (0x0F) - ADC CTRL
433 */
434#define WM8400_ADC_HPF_ENA 0x0100 /* ADC_HPF_ENA */
435#define WM8400_ADC_HPF_ENA_MASK 0x0100 /* ADC_HPF_ENA */
436#define WM8400_ADC_HPF_ENA_SHIFT 8 /* ADC_HPF_ENA */
437#define WM8400_ADC_HPF_ENA_WIDTH 1 /* ADC_HPF_ENA */
438#define WM8400_ADC_HPF_CUT_MASK 0x0060 /* ADC_HPF_CUT - [6:5] */
439#define WM8400_ADC_HPF_CUT_SHIFT 5 /* ADC_HPF_CUT - [6:5] */
440#define WM8400_ADC_HPF_CUT_WIDTH 2 /* ADC_HPF_CUT - [6:5] */
441#define WM8400_ADCL_DATINV 0x0002 /* ADCL_DATINV */
442#define WM8400_ADCL_DATINV_MASK 0x0002 /* ADCL_DATINV */
443#define WM8400_ADCL_DATINV_SHIFT 1 /* ADCL_DATINV */
444#define WM8400_ADCL_DATINV_WIDTH 1 /* ADCL_DATINV */
445#define WM8400_ADCR_DATINV 0x0001 /* ADCR_DATINV */
446#define WM8400_ADCR_DATINV_MASK 0x0001 /* ADCR_DATINV */
447#define WM8400_ADCR_DATINV_SHIFT 0 /* ADCR_DATINV */
448#define WM8400_ADCR_DATINV_WIDTH 1 /* ADCR_DATINV */
449
450/*
451 * R16 (0x10) - Left ADC Digital Volume
452 */
453#define WM8400_ADC_VU 0x0100 /* ADC_VU */
454#define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */
455#define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */
456#define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */
457#define WM8400_ADCL_VOL_MASK 0x00FF /* ADCL_VOL - [7:0] */
458#define WM8400_ADCL_VOL_SHIFT 0 /* ADCL_VOL - [7:0] */
459#define WM8400_ADCL_VOL_WIDTH 8 /* ADCL_VOL - [7:0] */
460
461/*
462 * R17 (0x11) - Right ADC Digital Volume
463 */
464#define WM8400_ADC_VU 0x0100 /* ADC_VU */
465#define WM8400_ADC_VU_MASK 0x0100 /* ADC_VU */
466#define WM8400_ADC_VU_SHIFT 8 /* ADC_VU */
467#define WM8400_ADC_VU_WIDTH 1 /* ADC_VU */
468#define WM8400_ADCR_VOL_MASK 0x00FF /* ADCR_VOL - [7:0] */
469#define WM8400_ADCR_VOL_SHIFT 0 /* ADCR_VOL - [7:0] */
470#define WM8400_ADCR_VOL_WIDTH 8 /* ADCR_VOL - [7:0] */
471
472/*
473 * R24 (0x18) - Left Line Input 1&2 Volume
474 */
475#define WM8400_IPVU 0x0100 /* IPVU */
476#define WM8400_IPVU_MASK 0x0100 /* IPVU */
477#define WM8400_IPVU_SHIFT 8 /* IPVU */
478#define WM8400_IPVU_WIDTH 1 /* IPVU */
479#define WM8400_LI12MUTE 0x0080 /* LI12MUTE */
480#define WM8400_LI12MUTE_MASK 0x0080 /* LI12MUTE */
481#define WM8400_LI12MUTE_SHIFT 7 /* LI12MUTE */
482#define WM8400_LI12MUTE_WIDTH 1 /* LI12MUTE */
483#define WM8400_LI12ZC 0x0040 /* LI12ZC */
484#define WM8400_LI12ZC_MASK 0x0040 /* LI12ZC */
485#define WM8400_LI12ZC_SHIFT 6 /* LI12ZC */
486#define WM8400_LI12ZC_WIDTH 1 /* LI12ZC */
487#define WM8400_LIN12VOL_MASK 0x001F /* LIN12VOL - [4:0] */
488#define WM8400_LIN12VOL_SHIFT 0 /* LIN12VOL - [4:0] */
489#define WM8400_LIN12VOL_WIDTH 5 /* LIN12VOL - [4:0] */
490
491/*
492 * R25 (0x19) - Left Line Input 3&4 Volume
493 */
494#define WM8400_IPVU 0x0100 /* IPVU */
495#define WM8400_IPVU_MASK 0x0100 /* IPVU */
496#define WM8400_IPVU_SHIFT 8 /* IPVU */
497#define WM8400_IPVU_WIDTH 1 /* IPVU */
498#define WM8400_LI34MUTE 0x0080 /* LI34MUTE */
499#define WM8400_LI34MUTE_MASK 0x0080 /* LI34MUTE */
500#define WM8400_LI34MUTE_SHIFT 7 /* LI34MUTE */
501#define WM8400_LI34MUTE_WIDTH 1 /* LI34MUTE */
502#define WM8400_LI34ZC 0x0040 /* LI34ZC */
503#define WM8400_LI34ZC_MASK 0x0040 /* LI34ZC */
504#define WM8400_LI34ZC_SHIFT 6 /* LI34ZC */
505#define WM8400_LI34ZC_WIDTH 1 /* LI34ZC */
506#define WM8400_LIN34VOL_MASK 0x001F /* LIN34VOL - [4:0] */
507#define WM8400_LIN34VOL_SHIFT 0 /* LIN34VOL - [4:0] */
508#define WM8400_LIN34VOL_WIDTH 5 /* LIN34VOL - [4:0] */
509
510/*
511 * R26 (0x1A) - Right Line Input 1&2 Volume
512 */
513#define WM8400_IPVU 0x0100 /* IPVU */
514#define WM8400_IPVU_MASK 0x0100 /* IPVU */
515#define WM8400_IPVU_SHIFT 8 /* IPVU */
516#define WM8400_IPVU_WIDTH 1 /* IPVU */
517#define WM8400_RI12MUTE 0x0080 /* RI12MUTE */
518#define WM8400_RI12MUTE_MASK 0x0080 /* RI12MUTE */
519#define WM8400_RI12MUTE_SHIFT 7 /* RI12MUTE */
520#define WM8400_RI12MUTE_WIDTH 1 /* RI12MUTE */
521#define WM8400_RI12ZC 0x0040 /* RI12ZC */
522#define WM8400_RI12ZC_MASK 0x0040 /* RI12ZC */
523#define WM8400_RI12ZC_SHIFT 6 /* RI12ZC */
524#define WM8400_RI12ZC_WIDTH 1 /* RI12ZC */
525#define WM8400_RIN12VOL_MASK 0x001F /* RIN12VOL - [4:0] */
526#define WM8400_RIN12VOL_SHIFT 0 /* RIN12VOL - [4:0] */
527#define WM8400_RIN12VOL_WIDTH 5 /* RIN12VOL - [4:0] */
528
529/*
530 * R27 (0x1B) - Right Line Input 3&4 Volume
531 */
532#define WM8400_IPVU 0x0100 /* IPVU */
533#define WM8400_IPVU_MASK 0x0100 /* IPVU */
534#define WM8400_IPVU_SHIFT 8 /* IPVU */
535#define WM8400_IPVU_WIDTH 1 /* IPVU */
536#define WM8400_RI34MUTE 0x0080 /* RI34MUTE */
537#define WM8400_RI34MUTE_MASK 0x0080 /* RI34MUTE */
538#define WM8400_RI34MUTE_SHIFT 7 /* RI34MUTE */
539#define WM8400_RI34MUTE_WIDTH 1 /* RI34MUTE */
540#define WM8400_RI34ZC 0x0040 /* RI34ZC */
541#define WM8400_RI34ZC_MASK 0x0040 /* RI34ZC */
542#define WM8400_RI34ZC_SHIFT 6 /* RI34ZC */
543#define WM8400_RI34ZC_WIDTH 1 /* RI34ZC */
544#define WM8400_RIN34VOL_MASK 0x001F /* RIN34VOL - [4:0] */
545#define WM8400_RIN34VOL_SHIFT 0 /* RIN34VOL - [4:0] */
546#define WM8400_RIN34VOL_WIDTH 5 /* RIN34VOL - [4:0] */
547
548/*
549 * R28 (0x1C) - Left Output Volume
550 */
551#define WM8400_OPVU 0x0100 /* OPVU */
552#define WM8400_OPVU_MASK 0x0100 /* OPVU */
553#define WM8400_OPVU_SHIFT 8 /* OPVU */
554#define WM8400_OPVU_WIDTH 1 /* OPVU */
555#define WM8400_LOZC 0x0080 /* LOZC */
556#define WM8400_LOZC_MASK 0x0080 /* LOZC */
557#define WM8400_LOZC_SHIFT 7 /* LOZC */
558#define WM8400_LOZC_WIDTH 1 /* LOZC */
559#define WM8400_LOUTVOL_MASK 0x007F /* LOUTVOL - [6:0] */
560#define WM8400_LOUTVOL_SHIFT 0 /* LOUTVOL - [6:0] */
561#define WM8400_LOUTVOL_WIDTH 7 /* LOUTVOL - [6:0] */
562
563/*
564 * R29 (0x1D) - Right Output Volume
565 */
566#define WM8400_OPVU 0x0100 /* OPVU */
567#define WM8400_OPVU_MASK 0x0100 /* OPVU */
568#define WM8400_OPVU_SHIFT 8 /* OPVU */
569#define WM8400_OPVU_WIDTH 1 /* OPVU */
570#define WM8400_ROZC 0x0080 /* ROZC */
571#define WM8400_ROZC_MASK 0x0080 /* ROZC */
572#define WM8400_ROZC_SHIFT 7 /* ROZC */
573#define WM8400_ROZC_WIDTH 1 /* ROZC */
574#define WM8400_ROUTVOL_MASK 0x007F /* ROUTVOL - [6:0] */
575#define WM8400_ROUTVOL_SHIFT 0 /* ROUTVOL - [6:0] */
576#define WM8400_ROUTVOL_WIDTH 7 /* ROUTVOL - [6:0] */
577
578/*
579 * R30 (0x1E) - Line Outputs Volume
580 */
581#define WM8400_LONMUTE 0x0040 /* LONMUTE */
582#define WM8400_LONMUTE_MASK 0x0040 /* LONMUTE */
583#define WM8400_LONMUTE_SHIFT 6 /* LONMUTE */
584#define WM8400_LONMUTE_WIDTH 1 /* LONMUTE */
585#define WM8400_LOPMUTE 0x0020 /* LOPMUTE */
586#define WM8400_LOPMUTE_MASK 0x0020 /* LOPMUTE */
587#define WM8400_LOPMUTE_SHIFT 5 /* LOPMUTE */
588#define WM8400_LOPMUTE_WIDTH 1 /* LOPMUTE */
589#define WM8400_LOATTN 0x0010 /* LOATTN */
590#define WM8400_LOATTN_MASK 0x0010 /* LOATTN */
591#define WM8400_LOATTN_SHIFT 4 /* LOATTN */
592#define WM8400_LOATTN_WIDTH 1 /* LOATTN */
593#define WM8400_RONMUTE 0x0004 /* RONMUTE */
594#define WM8400_RONMUTE_MASK 0x0004 /* RONMUTE */
595#define WM8400_RONMUTE_SHIFT 2 /* RONMUTE */
596#define WM8400_RONMUTE_WIDTH 1 /* RONMUTE */
597#define WM8400_ROPMUTE 0x0002 /* ROPMUTE */
598#define WM8400_ROPMUTE_MASK 0x0002 /* ROPMUTE */
599#define WM8400_ROPMUTE_SHIFT 1 /* ROPMUTE */
600#define WM8400_ROPMUTE_WIDTH 1 /* ROPMUTE */
601#define WM8400_ROATTN 0x0001 /* ROATTN */
602#define WM8400_ROATTN_MASK 0x0001 /* ROATTN */
603#define WM8400_ROATTN_SHIFT 0 /* ROATTN */
604#define WM8400_ROATTN_WIDTH 1 /* ROATTN */
605
606/*
607 * R31 (0x1F) - Out3/4 Volume
608 */
609#define WM8400_OUT3MUTE 0x0020 /* OUT3MUTE */
610#define WM8400_OUT3MUTE_MASK 0x0020 /* OUT3MUTE */
611#define WM8400_OUT3MUTE_SHIFT 5 /* OUT3MUTE */
612#define WM8400_OUT3MUTE_WIDTH 1 /* OUT3MUTE */
613#define WM8400_OUT3ATTN 0x0010 /* OUT3ATTN */
614#define WM8400_OUT3ATTN_MASK 0x0010 /* OUT3ATTN */
615#define WM8400_OUT3ATTN_SHIFT 4 /* OUT3ATTN */
616#define WM8400_OUT3ATTN_WIDTH 1 /* OUT3ATTN */
617#define WM8400_OUT4MUTE 0x0002 /* OUT4MUTE */
618#define WM8400_OUT4MUTE_MASK 0x0002 /* OUT4MUTE */
619#define WM8400_OUT4MUTE_SHIFT 1 /* OUT4MUTE */
620#define WM8400_OUT4MUTE_WIDTH 1 /* OUT4MUTE */
621#define WM8400_OUT4ATTN 0x0001 /* OUT4ATTN */
622#define WM8400_OUT4ATTN_MASK 0x0001 /* OUT4ATTN */
623#define WM8400_OUT4ATTN_SHIFT 0 /* OUT4ATTN */
624#define WM8400_OUT4ATTN_WIDTH 1 /* OUT4ATTN */
625
626/*
627 * R32 (0x20) - Left OPGA Volume
628 */
629#define WM8400_OPVU 0x0100 /* OPVU */
630#define WM8400_OPVU_MASK 0x0100 /* OPVU */
631#define WM8400_OPVU_SHIFT 8 /* OPVU */
632#define WM8400_OPVU_WIDTH 1 /* OPVU */
633#define WM8400_LOPGAZC 0x0080 /* LOPGAZC */
634#define WM8400_LOPGAZC_MASK 0x0080 /* LOPGAZC */
635#define WM8400_LOPGAZC_SHIFT 7 /* LOPGAZC */
636#define WM8400_LOPGAZC_WIDTH 1 /* LOPGAZC */
637#define WM8400_LOPGAVOL_MASK 0x007F /* LOPGAVOL - [6:0] */
638#define WM8400_LOPGAVOL_SHIFT 0 /* LOPGAVOL - [6:0] */
639#define WM8400_LOPGAVOL_WIDTH 7 /* LOPGAVOL - [6:0] */
640
641/*
642 * R33 (0x21) - Right OPGA Volume
643 */
644#define WM8400_OPVU 0x0100 /* OPVU */
645#define WM8400_OPVU_MASK 0x0100 /* OPVU */
646#define WM8400_OPVU_SHIFT 8 /* OPVU */
647#define WM8400_OPVU_WIDTH 1 /* OPVU */
648#define WM8400_ROPGAZC 0x0080 /* ROPGAZC */
649#define WM8400_ROPGAZC_MASK 0x0080 /* ROPGAZC */
650#define WM8400_ROPGAZC_SHIFT 7 /* ROPGAZC */
651#define WM8400_ROPGAZC_WIDTH 1 /* ROPGAZC */
652#define WM8400_ROPGAVOL_MASK 0x007F /* ROPGAVOL - [6:0] */
653#define WM8400_ROPGAVOL_SHIFT 0 /* ROPGAVOL - [6:0] */
654#define WM8400_ROPGAVOL_WIDTH 7 /* ROPGAVOL - [6:0] */
655
656/*
657 * R34 (0x22) - Speaker Volume
658 */
659#define WM8400_SPKATTN_MASK 0x0003 /* SPKATTN - [1:0] */
660#define WM8400_SPKATTN_SHIFT 0 /* SPKATTN - [1:0] */
661#define WM8400_SPKATTN_WIDTH 2 /* SPKATTN - [1:0] */
662
663/*
664 * R35 (0x23) - ClassD1
665 */
666#define WM8400_CDMODE 0x0100 /* CDMODE */
667#define WM8400_CDMODE_MASK 0x0100 /* CDMODE */
668#define WM8400_CDMODE_SHIFT 8 /* CDMODE */
669#define WM8400_CDMODE_WIDTH 1 /* CDMODE */
670#define WM8400_CLASSD_CLK_SEL 0x0080 /* CLASSD_CLK_SEL */
671#define WM8400_CLASSD_CLK_SEL_MASK 0x0080 /* CLASSD_CLK_SEL */
672#define WM8400_CLASSD_CLK_SEL_SHIFT 7 /* CLASSD_CLK_SEL */
673#define WM8400_CLASSD_CLK_SEL_WIDTH 1 /* CLASSD_CLK_SEL */
674#define WM8400_CD_SRCTRL 0x0040 /* CD_SRCTRL */
675#define WM8400_CD_SRCTRL_MASK 0x0040 /* CD_SRCTRL */
676#define WM8400_CD_SRCTRL_SHIFT 6 /* CD_SRCTRL */
677#define WM8400_CD_SRCTRL_WIDTH 1 /* CD_SRCTRL */
678#define WM8400_SPKNOPOP 0x0020 /* SPKNOPOP */
679#define WM8400_SPKNOPOP_MASK 0x0020 /* SPKNOPOP */
680#define WM8400_SPKNOPOP_SHIFT 5 /* SPKNOPOP */
681#define WM8400_SPKNOPOP_WIDTH 1 /* SPKNOPOP */
682#define WM8400_DBLERATE 0x0010 /* DBLERATE */
683#define WM8400_DBLERATE_MASK 0x0010 /* DBLERATE */
684#define WM8400_DBLERATE_SHIFT 4 /* DBLERATE */
685#define WM8400_DBLERATE_WIDTH 1 /* DBLERATE */
686#define WM8400_LOOPTEST 0x0008 /* LOOPTEST */
687#define WM8400_LOOPTEST_MASK 0x0008 /* LOOPTEST */
688#define WM8400_LOOPTEST_SHIFT 3 /* LOOPTEST */
689#define WM8400_LOOPTEST_WIDTH 1 /* LOOPTEST */
690#define WM8400_HALFABBIAS 0x0004 /* HALFABBIAS */
691#define WM8400_HALFABBIAS_MASK 0x0004 /* HALFABBIAS */
692#define WM8400_HALFABBIAS_SHIFT 2 /* HALFABBIAS */
693#define WM8400_HALFABBIAS_WIDTH 1 /* HALFABBIAS */
694#define WM8400_TRIDEL_MASK 0x0003 /* TRIDEL - [1:0] */
695#define WM8400_TRIDEL_SHIFT 0 /* TRIDEL - [1:0] */
696#define WM8400_TRIDEL_WIDTH 2 /* TRIDEL - [1:0] */
697
698/*
699 * R37 (0x25) - ClassD3
700 */
701#define WM8400_DCGAIN_MASK 0x0038 /* DCGAIN - [5:3] */
702#define WM8400_DCGAIN_SHIFT 3 /* DCGAIN - [5:3] */
703#define WM8400_DCGAIN_WIDTH 3 /* DCGAIN - [5:3] */
704#define WM8400_ACGAIN_MASK 0x0007 /* ACGAIN - [2:0] */
705#define WM8400_ACGAIN_SHIFT 0 /* ACGAIN - [2:0] */
706#define WM8400_ACGAIN_WIDTH 3 /* ACGAIN - [2:0] */
707
708/*
709 * R39 (0x27) - Input Mixer1
710 */
711#define WM8400_AINLMODE_MASK 0x000C /* AINLMODE - [3:2] */
712#define WM8400_AINLMODE_SHIFT 2 /* AINLMODE - [3:2] */
713#define WM8400_AINLMODE_WIDTH 2 /* AINLMODE - [3:2] */
714#define WM8400_AINRMODE_MASK 0x0003 /* AINRMODE - [1:0] */
715#define WM8400_AINRMODE_SHIFT 0 /* AINRMODE - [1:0] */
716#define WM8400_AINRMODE_WIDTH 2 /* AINRMODE - [1:0] */
717
718/*
719 * R40 (0x28) - Input Mixer2
720 */
721#define WM8400_LMP4 0x0080 /* LMP4 */
722#define WM8400_LMP4_MASK 0x0080 /* LMP4 */
723#define WM8400_LMP4_SHIFT 7 /* LMP4 */
724#define WM8400_LMP4_WIDTH 1 /* LMP4 */
725#define WM8400_LMN3 0x0040 /* LMN3 */
726#define WM8400_LMN3_MASK 0x0040 /* LMN3 */
727#define WM8400_LMN3_SHIFT 6 /* LMN3 */
728#define WM8400_LMN3_WIDTH 1 /* LMN3 */
729#define WM8400_LMP2 0x0020 /* LMP2 */
730#define WM8400_LMP2_MASK 0x0020 /* LMP2 */
731#define WM8400_LMP2_SHIFT 5 /* LMP2 */
732#define WM8400_LMP2_WIDTH 1 /* LMP2 */
733#define WM8400_LMN1 0x0010 /* LMN1 */
734#define WM8400_LMN1_MASK 0x0010 /* LMN1 */
735#define WM8400_LMN1_SHIFT 4 /* LMN1 */
736#define WM8400_LMN1_WIDTH 1 /* LMN1 */
737#define WM8400_RMP4 0x0008 /* RMP4 */
738#define WM8400_RMP4_MASK 0x0008 /* RMP4 */
739#define WM8400_RMP4_SHIFT 3 /* RMP4 */
740#define WM8400_RMP4_WIDTH 1 /* RMP4 */
741#define WM8400_RMN3 0x0004 /* RMN3 */
742#define WM8400_RMN3_MASK 0x0004 /* RMN3 */
743#define WM8400_RMN3_SHIFT 2 /* RMN3 */
744#define WM8400_RMN3_WIDTH 1 /* RMN3 */
745#define WM8400_RMP2 0x0002 /* RMP2 */
746#define WM8400_RMP2_MASK 0x0002 /* RMP2 */
747#define WM8400_RMP2_SHIFT 1 /* RMP2 */
748#define WM8400_RMP2_WIDTH 1 /* RMP2 */
749#define WM8400_RMN1 0x0001 /* RMN1 */
750#define WM8400_RMN1_MASK 0x0001 /* RMN1 */
751#define WM8400_RMN1_SHIFT 0 /* RMN1 */
752#define WM8400_RMN1_WIDTH 1 /* RMN1 */
753
754/*
755 * R41 (0x29) - Input Mixer3
756 */
757#define WM8400_L34MNB 0x0100 /* L34MNB */
758#define WM8400_L34MNB_MASK 0x0100 /* L34MNB */
759#define WM8400_L34MNB_SHIFT 8 /* L34MNB */
760#define WM8400_L34MNB_WIDTH 1 /* L34MNB */
761#define WM8400_L34MNBST 0x0080 /* L34MNBST */
762#define WM8400_L34MNBST_MASK 0x0080 /* L34MNBST */
763#define WM8400_L34MNBST_SHIFT 7 /* L34MNBST */
764#define WM8400_L34MNBST_WIDTH 1 /* L34MNBST */
765#define WM8400_L12MNB 0x0020 /* L12MNB */
766#define WM8400_L12MNB_MASK 0x0020 /* L12MNB */
767#define WM8400_L12MNB_SHIFT 5 /* L12MNB */
768#define WM8400_L12MNB_WIDTH 1 /* L12MNB */
769#define WM8400_L12MNBST 0x0010 /* L12MNBST */
770#define WM8400_L12MNBST_MASK 0x0010 /* L12MNBST */
771#define WM8400_L12MNBST_SHIFT 4 /* L12MNBST */
772#define WM8400_L12MNBST_WIDTH 1 /* L12MNBST */
773#define WM8400_LDBVOL_MASK 0x0007 /* LDBVOL - [2:0] */
774#define WM8400_LDBVOL_SHIFT 0 /* LDBVOL - [2:0] */
775#define WM8400_LDBVOL_WIDTH 3 /* LDBVOL - [2:0] */
776
777/*
778 * R42 (0x2A) - Input Mixer4
779 */
780#define WM8400_R34MNB 0x0100 /* R34MNB */
781#define WM8400_R34MNB_MASK 0x0100 /* R34MNB */
782#define WM8400_R34MNB_SHIFT 8 /* R34MNB */
783#define WM8400_R34MNB_WIDTH 1 /* R34MNB */
784#define WM8400_R34MNBST 0x0080 /* R34MNBST */
785#define WM8400_R34MNBST_MASK 0x0080 /* R34MNBST */
786#define WM8400_R34MNBST_SHIFT 7 /* R34MNBST */
787#define WM8400_R34MNBST_WIDTH 1 /* R34MNBST */
788#define WM8400_R12MNB 0x0020 /* R12MNB */
789#define WM8400_R12MNB_MASK 0x0020 /* R12MNB */
790#define WM8400_R12MNB_SHIFT 5 /* R12MNB */
791#define WM8400_R12MNB_WIDTH 1 /* R12MNB */
792#define WM8400_R12MNBST 0x0010 /* R12MNBST */
793#define WM8400_R12MNBST_MASK 0x0010 /* R12MNBST */
794#define WM8400_R12MNBST_SHIFT 4 /* R12MNBST */
795#define WM8400_R12MNBST_WIDTH 1 /* R12MNBST */
796#define WM8400_RDBVOL_MASK 0x0007 /* RDBVOL - [2:0] */
797#define WM8400_RDBVOL_SHIFT 0 /* RDBVOL - [2:0] */
798#define WM8400_RDBVOL_WIDTH 3 /* RDBVOL - [2:0] */
799
800/*
801 * R43 (0x2B) - Input Mixer5
802 */
803#define WM8400_LI2BVOL_MASK 0x01C0 /* LI2BVOL - [8:6] */
804#define WM8400_LI2BVOL_SHIFT 6 /* LI2BVOL - [8:6] */
805#define WM8400_LI2BVOL_WIDTH 3 /* LI2BVOL - [8:6] */
806#define WM8400_LR4BVOL_MASK 0x0038 /* LR4BVOL - [5:3] */
807#define WM8400_LR4BVOL_SHIFT 3 /* LR4BVOL - [5:3] */
808#define WM8400_LR4BVOL_WIDTH 3 /* LR4BVOL - [5:3] */
809#define WM8400_LL4BVOL_MASK 0x0007 /* LL4BVOL - [2:0] */
810#define WM8400_LL4BVOL_SHIFT 0 /* LL4BVOL - [2:0] */
811#define WM8400_LL4BVOL_WIDTH 3 /* LL4BVOL - [2:0] */
812
813/*
814 * R44 (0x2C) - Input Mixer6
815 */
816#define WM8400_RI2BVOL_MASK 0x01C0 /* RI2BVOL - [8:6] */
817#define WM8400_RI2BVOL_SHIFT 6 /* RI2BVOL - [8:6] */
818#define WM8400_RI2BVOL_WIDTH 3 /* RI2BVOL - [8:6] */
819#define WM8400_RL4BVOL_MASK 0x0038 /* RL4BVOL - [5:3] */
820#define WM8400_RL4BVOL_SHIFT 3 /* RL4BVOL - [5:3] */
821#define WM8400_RL4BVOL_WIDTH 3 /* RL4BVOL - [5:3] */
822#define WM8400_RR4BVOL_MASK 0x0007 /* RR4BVOL - [2:0] */
823#define WM8400_RR4BVOL_SHIFT 0 /* RR4BVOL - [2:0] */
824#define WM8400_RR4BVOL_WIDTH 3 /* RR4BVOL - [2:0] */
825
826/*
827 * R45 (0x2D) - Output Mixer1
828 */
829#define WM8400_LRBLO 0x0080 /* LRBLO */
830#define WM8400_LRBLO_MASK 0x0080 /* LRBLO */
831#define WM8400_LRBLO_SHIFT 7 /* LRBLO */
832#define WM8400_LRBLO_WIDTH 1 /* LRBLO */
833#define WM8400_LLBLO 0x0040 /* LLBLO */
834#define WM8400_LLBLO_MASK 0x0040 /* LLBLO */
835#define WM8400_LLBLO_SHIFT 6 /* LLBLO */
836#define WM8400_LLBLO_WIDTH 1 /* LLBLO */
837#define WM8400_LRI3LO 0x0020 /* LRI3LO */
838#define WM8400_LRI3LO_MASK 0x0020 /* LRI3LO */
839#define WM8400_LRI3LO_SHIFT 5 /* LRI3LO */
840#define WM8400_LRI3LO_WIDTH 1 /* LRI3LO */
841#define WM8400_LLI3LO 0x0010 /* LLI3LO */
842#define WM8400_LLI3LO_MASK 0x0010 /* LLI3LO */
843#define WM8400_LLI3LO_SHIFT 4 /* LLI3LO */
844#define WM8400_LLI3LO_WIDTH 1 /* LLI3LO */
845#define WM8400_LR12LO 0x0008 /* LR12LO */
846#define WM8400_LR12LO_MASK 0x0008 /* LR12LO */
847#define WM8400_LR12LO_SHIFT 3 /* LR12LO */
848#define WM8400_LR12LO_WIDTH 1 /* LR12LO */
849#define WM8400_LL12LO 0x0004 /* LL12LO */
850#define WM8400_LL12LO_MASK 0x0004 /* LL12LO */
851#define WM8400_LL12LO_SHIFT 2 /* LL12LO */
852#define WM8400_LL12LO_WIDTH 1 /* LL12LO */
853#define WM8400_LDLO 0x0001 /* LDLO */
854#define WM8400_LDLO_MASK 0x0001 /* LDLO */
855#define WM8400_LDLO_SHIFT 0 /* LDLO */
856#define WM8400_LDLO_WIDTH 1 /* LDLO */
857
858/*
859 * R46 (0x2E) - Output Mixer2
860 */
861#define WM8400_RLBRO 0x0080 /* RLBRO */
862#define WM8400_RLBRO_MASK 0x0080 /* RLBRO */
863#define WM8400_RLBRO_SHIFT 7 /* RLBRO */
864#define WM8400_RLBRO_WIDTH 1 /* RLBRO */
865#define WM8400_RRBRO 0x0040 /* RRBRO */
866#define WM8400_RRBRO_MASK 0x0040 /* RRBRO */
867#define WM8400_RRBRO_SHIFT 6 /* RRBRO */
868#define WM8400_RRBRO_WIDTH 1 /* RRBRO */
869#define WM8400_RLI3RO 0x0020 /* RLI3RO */
870#define WM8400_RLI3RO_MASK 0x0020 /* RLI3RO */
871#define WM8400_RLI3RO_SHIFT 5 /* RLI3RO */
872#define WM8400_RLI3RO_WIDTH 1 /* RLI3RO */
873#define WM8400_RRI3RO 0x0010 /* RRI3RO */
874#define WM8400_RRI3RO_MASK 0x0010 /* RRI3RO */
875#define WM8400_RRI3RO_SHIFT 4 /* RRI3RO */
876#define WM8400_RRI3RO_WIDTH 1 /* RRI3RO */
877#define WM8400_RL12RO 0x0008 /* RL12RO */
878#define WM8400_RL12RO_MASK 0x0008 /* RL12RO */
879#define WM8400_RL12RO_SHIFT 3 /* RL12RO */
880#define WM8400_RL12RO_WIDTH 1 /* RL12RO */
881#define WM8400_RR12RO 0x0004 /* RR12RO */
882#define WM8400_RR12RO_MASK 0x0004 /* RR12RO */
883#define WM8400_RR12RO_SHIFT 2 /* RR12RO */
884#define WM8400_RR12RO_WIDTH 1 /* RR12RO */
885#define WM8400_RDRO 0x0001 /* RDRO */
886#define WM8400_RDRO_MASK 0x0001 /* RDRO */
887#define WM8400_RDRO_SHIFT 0 /* RDRO */
888#define WM8400_RDRO_WIDTH 1 /* RDRO */
889
890/*
891 * R47 (0x2F) - Output Mixer3
892 */
893#define WM8400_LLI3LOVOL_MASK 0x01C0 /* LLI3LOVOL - [8:6] */
894#define WM8400_LLI3LOVOL_SHIFT 6 /* LLI3LOVOL - [8:6] */
895#define WM8400_LLI3LOVOL_WIDTH 3 /* LLI3LOVOL - [8:6] */
896#define WM8400_LR12LOVOL_MASK 0x0038 /* LR12LOVOL - [5:3] */
897#define WM8400_LR12LOVOL_SHIFT 3 /* LR12LOVOL - [5:3] */
898#define WM8400_LR12LOVOL_WIDTH 3 /* LR12LOVOL - [5:3] */
899#define WM8400_LL12LOVOL_MASK 0x0007 /* LL12LOVOL - [2:0] */
900#define WM8400_LL12LOVOL_SHIFT 0 /* LL12LOVOL - [2:0] */
901#define WM8400_LL12LOVOL_WIDTH 3 /* LL12LOVOL - [2:0] */
902
903/*
904 * R48 (0x30) - Output Mixer4
905 */
906#define WM8400_RRI3ROVOL_MASK 0x01C0 /* RRI3ROVOL - [8:6] */
907#define WM8400_RRI3ROVOL_SHIFT 6 /* RRI3ROVOL - [8:6] */
908#define WM8400_RRI3ROVOL_WIDTH 3 /* RRI3ROVOL - [8:6] */
909#define WM8400_RL12ROVOL_MASK 0x0038 /* RL12ROVOL - [5:3] */
910#define WM8400_RL12ROVOL_SHIFT 3 /* RL12ROVOL - [5:3] */
911#define WM8400_RL12ROVOL_WIDTH 3 /* RL12ROVOL - [5:3] */
912#define WM8400_RR12ROVOL_MASK 0x0007 /* RR12ROVOL - [2:0] */
913#define WM8400_RR12ROVOL_SHIFT 0 /* RR12ROVOL - [2:0] */
914#define WM8400_RR12ROVOL_WIDTH 3 /* RR12ROVOL - [2:0] */
915
916/*
917 * R49 (0x31) - Output Mixer5
918 */
919#define WM8400_LRI3LOVOL_MASK 0x01C0 /* LRI3LOVOL - [8:6] */
920#define WM8400_LRI3LOVOL_SHIFT 6 /* LRI3LOVOL - [8:6] */
921#define WM8400_LRI3LOVOL_WIDTH 3 /* LRI3LOVOL - [8:6] */
922#define WM8400_LRBLOVOL_MASK 0x0038 /* LRBLOVOL - [5:3] */
923#define WM8400_LRBLOVOL_SHIFT 3 /* LRBLOVOL - [5:3] */
924#define WM8400_LRBLOVOL_WIDTH 3 /* LRBLOVOL - [5:3] */
925#define WM8400_LLBLOVOL_MASK 0x0007 /* LLBLOVOL - [2:0] */
926#define WM8400_LLBLOVOL_SHIFT 0 /* LLBLOVOL - [2:0] */
927#define WM8400_LLBLOVOL_WIDTH 3 /* LLBLOVOL - [2:0] */
928
929/*
930 * R50 (0x32) - Output Mixer6
931 */
932#define WM8400_RLI3ROVOL_MASK 0x01C0 /* RLI3ROVOL - [8:6] */
933#define WM8400_RLI3ROVOL_SHIFT 6 /* RLI3ROVOL - [8:6] */
934#define WM8400_RLI3ROVOL_WIDTH 3 /* RLI3ROVOL - [8:6] */
935#define WM8400_RLBROVOL_MASK 0x0038 /* RLBROVOL - [5:3] */
936#define WM8400_RLBROVOL_SHIFT 3 /* RLBROVOL - [5:3] */
937#define WM8400_RLBROVOL_WIDTH 3 /* RLBROVOL - [5:3] */
938#define WM8400_RRBROVOL_MASK 0x0007 /* RRBROVOL - [2:0] */
939#define WM8400_RRBROVOL_SHIFT 0 /* RRBROVOL - [2:0] */
940#define WM8400_RRBROVOL_WIDTH 3 /* RRBROVOL - [2:0] */
941
942/*
943 * R51 (0x33) - Out3/4 Mixer
944 */
945#define WM8400_VSEL_MASK 0x0180 /* VSEL - [8:7] */
946#define WM8400_VSEL_SHIFT 7 /* VSEL - [8:7] */
947#define WM8400_VSEL_WIDTH 2 /* VSEL - [8:7] */
948#define WM8400_LI4O3 0x0020 /* LI4O3 */
949#define WM8400_LI4O3_MASK 0x0020 /* LI4O3 */
950#define WM8400_LI4O3_SHIFT 5 /* LI4O3 */
951#define WM8400_LI4O3_WIDTH 1 /* LI4O3 */
952#define WM8400_LPGAO3 0x0010 /* LPGAO3 */
953#define WM8400_LPGAO3_MASK 0x0010 /* LPGAO3 */
954#define WM8400_LPGAO3_SHIFT 4 /* LPGAO3 */
955#define WM8400_LPGAO3_WIDTH 1 /* LPGAO3 */
956#define WM8400_RI4O4 0x0002 /* RI4O4 */
957#define WM8400_RI4O4_MASK 0x0002 /* RI4O4 */
958#define WM8400_RI4O4_SHIFT 1 /* RI4O4 */
959#define WM8400_RI4O4_WIDTH 1 /* RI4O4 */
960#define WM8400_RPGAO4 0x0001 /* RPGAO4 */
961#define WM8400_RPGAO4_MASK 0x0001 /* RPGAO4 */
962#define WM8400_RPGAO4_SHIFT 0 /* RPGAO4 */
963#define WM8400_RPGAO4_WIDTH 1 /* RPGAO4 */
964
965/*
966 * R52 (0x34) - Line Mixer1
967 */
968#define WM8400_LLOPGALON 0x0040 /* LLOPGALON */
969#define WM8400_LLOPGALON_MASK 0x0040 /* LLOPGALON */
970#define WM8400_LLOPGALON_SHIFT 6 /* LLOPGALON */
971#define WM8400_LLOPGALON_WIDTH 1 /* LLOPGALON */
972#define WM8400_LROPGALON 0x0020 /* LROPGALON */
973#define WM8400_LROPGALON_MASK 0x0020 /* LROPGALON */
974#define WM8400_LROPGALON_SHIFT 5 /* LROPGALON */
975#define WM8400_LROPGALON_WIDTH 1 /* LROPGALON */
976#define WM8400_LOPLON 0x0010 /* LOPLON */
977#define WM8400_LOPLON_MASK 0x0010 /* LOPLON */
978#define WM8400_LOPLON_SHIFT 4 /* LOPLON */
979#define WM8400_LOPLON_WIDTH 1 /* LOPLON */
980#define WM8400_LR12LOP 0x0004 /* LR12LOP */
981#define WM8400_LR12LOP_MASK 0x0004 /* LR12LOP */
982#define WM8400_LR12LOP_SHIFT 2 /* LR12LOP */
983#define WM8400_LR12LOP_WIDTH 1 /* LR12LOP */
984#define WM8400_LL12LOP 0x0002 /* LL12LOP */
985#define WM8400_LL12LOP_MASK 0x0002 /* LL12LOP */
986#define WM8400_LL12LOP_SHIFT 1 /* LL12LOP */
987#define WM8400_LL12LOP_WIDTH 1 /* LL12LOP */
988#define WM8400_LLOPGALOP 0x0001 /* LLOPGALOP */
989#define WM8400_LLOPGALOP_MASK 0x0001 /* LLOPGALOP */
990#define WM8400_LLOPGALOP_SHIFT 0 /* LLOPGALOP */
991#define WM8400_LLOPGALOP_WIDTH 1 /* LLOPGALOP */
992
993/*
994 * R53 (0x35) - Line Mixer2
995 */
996#define WM8400_RROPGARON 0x0040 /* RROPGARON */
997#define WM8400_RROPGARON_MASK 0x0040 /* RROPGARON */
998#define WM8400_RROPGARON_SHIFT 6 /* RROPGARON */
999#define WM8400_RROPGARON_WIDTH 1 /* RROPGARON */
1000#define WM8400_RLOPGARON 0x0020 /* RLOPGARON */
1001#define WM8400_RLOPGARON_MASK 0x0020 /* RLOPGARON */
1002#define WM8400_RLOPGARON_SHIFT 5 /* RLOPGARON */
1003#define WM8400_RLOPGARON_WIDTH 1 /* RLOPGARON */
1004#define WM8400_ROPRON 0x0010 /* ROPRON */
1005#define WM8400_ROPRON_MASK 0x0010 /* ROPRON */
1006#define WM8400_ROPRON_SHIFT 4 /* ROPRON */
1007#define WM8400_ROPRON_WIDTH 1 /* ROPRON */
1008#define WM8400_RL12ROP 0x0004 /* RL12ROP */
1009#define WM8400_RL12ROP_MASK 0x0004 /* RL12ROP */
1010#define WM8400_RL12ROP_SHIFT 2 /* RL12ROP */
1011#define WM8400_RL12ROP_WIDTH 1 /* RL12ROP */
1012#define WM8400_RR12ROP 0x0002 /* RR12ROP */
1013#define WM8400_RR12ROP_MASK 0x0002 /* RR12ROP */
1014#define WM8400_RR12ROP_SHIFT 1 /* RR12ROP */
1015#define WM8400_RR12ROP_WIDTH 1 /* RR12ROP */
1016#define WM8400_RROPGAROP 0x0001 /* RROPGAROP */
1017#define WM8400_RROPGAROP_MASK 0x0001 /* RROPGAROP */
1018#define WM8400_RROPGAROP_SHIFT 0 /* RROPGAROP */
1019#define WM8400_RROPGAROP_WIDTH 1 /* RROPGAROP */
1020
1021/*
1022 * R54 (0x36) - Speaker Mixer
1023 */
1024#define WM8400_LB2SPK 0x0080 /* LB2SPK */
1025#define WM8400_LB2SPK_MASK 0x0080 /* LB2SPK */
1026#define WM8400_LB2SPK_SHIFT 7 /* LB2SPK */
1027#define WM8400_LB2SPK_WIDTH 1 /* LB2SPK */
1028#define WM8400_RB2SPK 0x0040 /* RB2SPK */
1029#define WM8400_RB2SPK_MASK 0x0040 /* RB2SPK */
1030#define WM8400_RB2SPK_SHIFT 6 /* RB2SPK */
1031#define WM8400_RB2SPK_WIDTH 1 /* RB2SPK */
1032#define WM8400_LI2SPK 0x0020 /* LI2SPK */
1033#define WM8400_LI2SPK_MASK 0x0020 /* LI2SPK */
1034#define WM8400_LI2SPK_SHIFT 5 /* LI2SPK */
1035#define WM8400_LI2SPK_WIDTH 1 /* LI2SPK */
1036#define WM8400_RI2SPK 0x0010 /* RI2SPK */
1037#define WM8400_RI2SPK_MASK 0x0010 /* RI2SPK */
1038#define WM8400_RI2SPK_SHIFT 4 /* RI2SPK */
1039#define WM8400_RI2SPK_WIDTH 1 /* RI2SPK */
1040#define WM8400_LOPGASPK 0x0008 /* LOPGASPK */
1041#define WM8400_LOPGASPK_MASK 0x0008 /* LOPGASPK */
1042#define WM8400_LOPGASPK_SHIFT 3 /* LOPGASPK */
1043#define WM8400_LOPGASPK_WIDTH 1 /* LOPGASPK */
1044#define WM8400_ROPGASPK 0x0004 /* ROPGASPK */
1045#define WM8400_ROPGASPK_MASK 0x0004 /* ROPGASPK */
1046#define WM8400_ROPGASPK_SHIFT 2 /* ROPGASPK */
1047#define WM8400_ROPGASPK_WIDTH 1 /* ROPGASPK */
1048#define WM8400_LDSPK 0x0002 /* LDSPK */
1049#define WM8400_LDSPK_MASK 0x0002 /* LDSPK */
1050#define WM8400_LDSPK_SHIFT 1 /* LDSPK */
1051#define WM8400_LDSPK_WIDTH 1 /* LDSPK */
1052#define WM8400_RDSPK 0x0001 /* RDSPK */
1053#define WM8400_RDSPK_MASK 0x0001 /* RDSPK */
1054#define WM8400_RDSPK_SHIFT 0 /* RDSPK */
1055#define WM8400_RDSPK_WIDTH 1 /* RDSPK */
1056
1057/*
1058 * R55 (0x37) - Additional Control
1059 */
1060#define WM8400_VROI 0x0001 /* VROI */
1061#define WM8400_VROI_MASK 0x0001 /* VROI */
1062#define WM8400_VROI_SHIFT 0 /* VROI */
1063#define WM8400_VROI_WIDTH 1 /* VROI */
1064
1065/*
1066 * R56 (0x38) - AntiPOP1
1067 */
1068#define WM8400_DIS_LLINE 0x0020 /* DIS_LLINE */
1069#define WM8400_DIS_LLINE_MASK 0x0020 /* DIS_LLINE */
1070#define WM8400_DIS_LLINE_SHIFT 5 /* DIS_LLINE */
1071#define WM8400_DIS_LLINE_WIDTH 1 /* DIS_LLINE */
1072#define WM8400_DIS_RLINE 0x0010 /* DIS_RLINE */
1073#define WM8400_DIS_RLINE_MASK 0x0010 /* DIS_RLINE */
1074#define WM8400_DIS_RLINE_SHIFT 4 /* DIS_RLINE */
1075#define WM8400_DIS_RLINE_WIDTH 1 /* DIS_RLINE */
1076#define WM8400_DIS_OUT3 0x0008 /* DIS_OUT3 */
1077#define WM8400_DIS_OUT3_MASK 0x0008 /* DIS_OUT3 */
1078#define WM8400_DIS_OUT3_SHIFT 3 /* DIS_OUT3 */
1079#define WM8400_DIS_OUT3_WIDTH 1 /* DIS_OUT3 */
1080#define WM8400_DIS_OUT4 0x0004 /* DIS_OUT4 */
1081#define WM8400_DIS_OUT4_MASK 0x0004 /* DIS_OUT4 */
1082#define WM8400_DIS_OUT4_SHIFT 2 /* DIS_OUT4 */
1083#define WM8400_DIS_OUT4_WIDTH 1 /* DIS_OUT4 */
1084#define WM8400_DIS_LOUT 0x0002 /* DIS_LOUT */
1085#define WM8400_DIS_LOUT_MASK 0x0002 /* DIS_LOUT */
1086#define WM8400_DIS_LOUT_SHIFT 1 /* DIS_LOUT */
1087#define WM8400_DIS_LOUT_WIDTH 1 /* DIS_LOUT */
1088#define WM8400_DIS_ROUT 0x0001 /* DIS_ROUT */
1089#define WM8400_DIS_ROUT_MASK 0x0001 /* DIS_ROUT */
1090#define WM8400_DIS_ROUT_SHIFT 0 /* DIS_ROUT */
1091#define WM8400_DIS_ROUT_WIDTH 1 /* DIS_ROUT */
1092
1093/*
1094 * R57 (0x39) - AntiPOP2
1095 */
1096#define WM8400_SOFTST 0x0040 /* SOFTST */
1097#define WM8400_SOFTST_MASK 0x0040 /* SOFTST */
1098#define WM8400_SOFTST_SHIFT 6 /* SOFTST */
1099#define WM8400_SOFTST_WIDTH 1 /* SOFTST */
1100#define WM8400_BUFIOEN 0x0008 /* BUFIOEN */
1101#define WM8400_BUFIOEN_MASK 0x0008 /* BUFIOEN */
1102#define WM8400_BUFIOEN_SHIFT 3 /* BUFIOEN */
1103#define WM8400_BUFIOEN_WIDTH 1 /* BUFIOEN */
1104#define WM8400_BUFDCOPEN 0x0004 /* BUFDCOPEN */
1105#define WM8400_BUFDCOPEN_MASK 0x0004 /* BUFDCOPEN */
1106#define WM8400_BUFDCOPEN_SHIFT 2 /* BUFDCOPEN */
1107#define WM8400_BUFDCOPEN_WIDTH 1 /* BUFDCOPEN */
1108#define WM8400_POBCTRL 0x0002 /* POBCTRL */
1109#define WM8400_POBCTRL_MASK 0x0002 /* POBCTRL */
1110#define WM8400_POBCTRL_SHIFT 1 /* POBCTRL */
1111#define WM8400_POBCTRL_WIDTH 1 /* POBCTRL */
1112#define WM8400_VMIDTOG 0x0001 /* VMIDTOG */
1113#define WM8400_VMIDTOG_MASK 0x0001 /* VMIDTOG */
1114#define WM8400_VMIDTOG_SHIFT 0 /* VMIDTOG */
1115#define WM8400_VMIDTOG_WIDTH 1 /* VMIDTOG */
1116
1117/*
1118 * R58 (0x3A) - MICBIAS
1119 */
1120#define WM8400_MCDSCTH_MASK 0x00C0 /* MCDSCTH - [7:6] */
1121#define WM8400_MCDSCTH_SHIFT 6 /* MCDSCTH - [7:6] */
1122#define WM8400_MCDSCTH_WIDTH 2 /* MCDSCTH - [7:6] */
1123#define WM8400_MCDTHR_MASK 0x0038 /* MCDTHR - [5:3] */
1124#define WM8400_MCDTHR_SHIFT 3 /* MCDTHR - [5:3] */
1125#define WM8400_MCDTHR_WIDTH 3 /* MCDTHR - [5:3] */
1126#define WM8400_MCD 0x0004 /* MCD */
1127#define WM8400_MCD_MASK 0x0004 /* MCD */
1128#define WM8400_MCD_SHIFT 2 /* MCD */
1129#define WM8400_MCD_WIDTH 1 /* MCD */
1130#define WM8400_MBSEL 0x0001 /* MBSEL */
1131#define WM8400_MBSEL_MASK 0x0001 /* MBSEL */
1132#define WM8400_MBSEL_SHIFT 0 /* MBSEL */
1133#define WM8400_MBSEL_WIDTH 1 /* MBSEL */
1134
1135/*
1136 * R60 (0x3C) - FLL Control 1
1137 */
1138#define WM8400_FLL_REF_FREQ 0x1000 /* FLL_REF_FREQ */
1139#define WM8400_FLL_REF_FREQ_MASK 0x1000 /* FLL_REF_FREQ */
1140#define WM8400_FLL_REF_FREQ_SHIFT 12 /* FLL_REF_FREQ */
1141#define WM8400_FLL_REF_FREQ_WIDTH 1 /* FLL_REF_FREQ */
1142#define WM8400_FLL_CLK_SRC_MASK 0x0C00 /* FLL_CLK_SRC - [11:10] */
1143#define WM8400_FLL_CLK_SRC_SHIFT 10 /* FLL_CLK_SRC - [11:10] */
1144#define WM8400_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [11:10] */
1145#define WM8400_FLL_FRAC 0x0200 /* FLL_FRAC */
1146#define WM8400_FLL_FRAC_MASK 0x0200 /* FLL_FRAC */
1147#define WM8400_FLL_FRAC_SHIFT 9 /* FLL_FRAC */
1148#define WM8400_FLL_FRAC_WIDTH 1 /* FLL_FRAC */
1149#define WM8400_FLL_OSC_ENA 0x0100 /* FLL_OSC_ENA */
1150#define WM8400_FLL_OSC_ENA_MASK 0x0100 /* FLL_OSC_ENA */
1151#define WM8400_FLL_OSC_ENA_SHIFT 8 /* FLL_OSC_ENA */
1152#define WM8400_FLL_OSC_ENA_WIDTH 1 /* FLL_OSC_ENA */
1153#define WM8400_FLL_CTRL_RATE_MASK 0x00E0 /* FLL_CTRL_RATE - [7:5] */
1154#define WM8400_FLL_CTRL_RATE_SHIFT 5 /* FLL_CTRL_RATE - [7:5] */
1155#define WM8400_FLL_CTRL_RATE_WIDTH 3 /* FLL_CTRL_RATE - [7:5] */
1156#define WM8400_FLL_FRATIO_MASK 0x001F /* FLL_FRATIO - [4:0] */
1157#define WM8400_FLL_FRATIO_SHIFT 0 /* FLL_FRATIO - [4:0] */
1158#define WM8400_FLL_FRATIO_WIDTH 5 /* FLL_FRATIO - [4:0] */
1159
1160/*
1161 * R61 (0x3D) - FLL Control 2
1162 */
1163#define WM8400_FLL_K_MASK 0xFFFF /* FLL_K - [15:0] */
1164#define WM8400_FLL_K_SHIFT 0 /* FLL_K - [15:0] */
1165#define WM8400_FLL_K_WIDTH 16 /* FLL_K - [15:0] */
1166
1167/*
1168 * R62 (0x3E) - FLL Control 3
1169 */
1170#define WM8400_FLL_N_MASK 0x03FF /* FLL_N - [9:0] */
1171#define WM8400_FLL_N_SHIFT 0 /* FLL_N - [9:0] */
1172#define WM8400_FLL_N_WIDTH 10 /* FLL_N - [9:0] */
1173
1174/*
1175 * R63 (0x3F) - FLL Control 4
1176 */
1177#define WM8400_FLL_TRK_GAIN_MASK 0x0078 /* FLL_TRK_GAIN - [6:3] */
1178#define WM8400_FLL_TRK_GAIN_SHIFT 3 /* FLL_TRK_GAIN - [6:3] */
1179#define WM8400_FLL_TRK_GAIN_WIDTH 4 /* FLL_TRK_GAIN - [6:3] */
1180#define WM8400_FLL_OUTDIV_MASK 0x0007 /* FLL_OUTDIV - [2:0] */
1181#define WM8400_FLL_OUTDIV_SHIFT 0 /* FLL_OUTDIV - [2:0] */
1182#define WM8400_FLL_OUTDIV_WIDTH 3 /* FLL_OUTDIV - [2:0] */
1183
1184void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400);
1185
1186#endif
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h
new file mode 100644
index 000000000000..2aab4e93a5c9
--- /dev/null
+++ b/include/linux/mfd/wm8400-private.h
@@ -0,0 +1,936 @@
1/*
2 * wm8400 private definitions.
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_PRIV_H
22#define __LINUX_MFD_WM8400_PRIV_H
23
24#include <linux/mfd/wm8400.h>
25#include <linux/mutex.h>
26#include <linux/platform_device.h>
27
28#define WM8400_REGISTER_COUNT 0x55
29
30struct wm8400 {
31 struct device *dev;
32
33 int (*read_dev)(void *data, char reg, int count, u16 *dst);
34 int (*write_dev)(void *data, char reg, int count, const u16 *src);
35
36 struct mutex io_lock;
37 void *io_data;
38
39 u16 reg_cache[WM8400_REGISTER_COUNT];
40
41 struct platform_device regulators[6];
42};
43
44/*
45 * Register values.
46 */
47#define WM8400_RESET_ID 0x00
48#define WM8400_ID 0x01
49#define WM8400_POWER_MANAGEMENT_1 0x02
50#define WM8400_POWER_MANAGEMENT_2 0x03
51#define WM8400_POWER_MANAGEMENT_3 0x04
52#define WM8400_AUDIO_INTERFACE_1 0x05
53#define WM8400_AUDIO_INTERFACE_2 0x06
54#define WM8400_CLOCKING_1 0x07
55#define WM8400_CLOCKING_2 0x08
56#define WM8400_AUDIO_INTERFACE_3 0x09
57#define WM8400_AUDIO_INTERFACE_4 0x0A
58#define WM8400_DAC_CTRL 0x0B
59#define WM8400_LEFT_DAC_DIGITAL_VOLUME 0x0C
60#define WM8400_RIGHT_DAC_DIGITAL_VOLUME 0x0D
61#define WM8400_DIGITAL_SIDE_TONE 0x0E
62#define WM8400_ADC_CTRL 0x0F
63#define WM8400_LEFT_ADC_DIGITAL_VOLUME 0x10
64#define WM8400_RIGHT_ADC_DIGITAL_VOLUME 0x11
65#define WM8400_GPIO_CTRL_1 0x12
66#define WM8400_GPIO1_GPIO2 0x13
67#define WM8400_GPIO3_GPIO4 0x14
68#define WM8400_GPIO5_GPIO6 0x15
69#define WM8400_GPIOCTRL_2 0x16
70#define WM8400_GPIO_POL 0x17
71#define WM8400_LEFT_LINE_INPUT_1_2_VOLUME 0x18
72#define WM8400_LEFT_LINE_INPUT_3_4_VOLUME 0x19
73#define WM8400_RIGHT_LINE_INPUT_1_2_VOLUME 0x1A
74#define WM8400_RIGHT_LINE_INPUT_3_4_VOLUME 0x1B
75#define WM8400_LEFT_OUTPUT_VOLUME 0x1C
76#define WM8400_RIGHT_OUTPUT_VOLUME 0x1D
77#define WM8400_LINE_OUTPUTS_VOLUME 0x1E
78#define WM8400_OUT3_4_VOLUME 0x1F
79#define WM8400_LEFT_OPGA_VOLUME 0x20
80#define WM8400_RIGHT_OPGA_VOLUME 0x21
81#define WM8400_SPEAKER_VOLUME 0x22
82#define WM8400_CLASSD1 0x23
83#define WM8400_CLASSD3 0x25
84#define WM8400_INPUT_MIXER1 0x27
85#define WM8400_INPUT_MIXER2 0x28
86#define WM8400_INPUT_MIXER3 0x29
87#define WM8400_INPUT_MIXER4 0x2A
88#define WM8400_INPUT_MIXER5 0x2B
89#define WM8400_INPUT_MIXER6 0x2C
90#define WM8400_OUTPUT_MIXER1 0x2D
91#define WM8400_OUTPUT_MIXER2 0x2E
92#define WM8400_OUTPUT_MIXER3 0x2F
93#define WM8400_OUTPUT_MIXER4 0x30
94#define WM8400_OUTPUT_MIXER5 0x31
95#define WM8400_OUTPUT_MIXER6 0x32
96#define WM8400_OUT3_4_MIXER 0x33
97#define WM8400_LINE_MIXER1 0x34
98#define WM8400_LINE_MIXER2 0x35
99#define WM8400_SPEAKER_MIXER 0x36
100#define WM8400_ADDITIONAL_CONTROL 0x37
101#define WM8400_ANTIPOP1 0x38
102#define WM8400_ANTIPOP2 0x39
103#define WM8400_MICBIAS 0x3A
104#define WM8400_FLL_CONTROL_1 0x3C
105#define WM8400_FLL_CONTROL_2 0x3D
106#define WM8400_FLL_CONTROL_3 0x3E
107#define WM8400_FLL_CONTROL_4 0x3F
108#define WM8400_LDO1_CONTROL 0x41
109#define WM8400_LDO2_CONTROL 0x42
110#define WM8400_LDO3_CONTROL 0x43
111#define WM8400_LDO4_CONTROL 0x44
112#define WM8400_DCDC1_CONTROL_1 0x46
113#define WM8400_DCDC1_CONTROL_2 0x47
114#define WM8400_DCDC2_CONTROL_1 0x48
115#define WM8400_DCDC2_CONTROL_2 0x49
116#define WM8400_INTERFACE 0x4B
117#define WM8400_PM_GENERAL 0x4C
118#define WM8400_PM_SHUTDOWN_CONTROL 0x4E
119#define WM8400_INTERRUPT_STATUS_1 0x4F
120#define WM8400_INTERRUPT_STATUS_1_MASK 0x50
121#define WM8400_INTERRUPT_LEVELS 0x51
122#define WM8400_SHUTDOWN_REASON 0x52
123#define WM8400_LINE_CIRCUITS 0x54
124
125/*
126 * Field Definitions.
127 */
128
129/*
130 * R0 (0x00) - Reset/ID
131 */
132#define WM8400_SW_RESET_CHIP_ID_MASK 0xFFFF /* SW_RESET/CHIP_ID - [15:0] */
133#define WM8400_SW_RESET_CHIP_ID_SHIFT 0 /* SW_RESET/CHIP_ID - [15:0] */
134#define WM8400_SW_RESET_CHIP_ID_WIDTH 16 /* SW_RESET/CHIP_ID - [15:0] */
135
136/*
137 * R1 (0x01) - ID
138 */
139#define WM8400_CHIP_REV_MASK 0x7000 /* CHIP_REV - [14:12] */
140#define WM8400_CHIP_REV_SHIFT 12 /* CHIP_REV - [14:12] */
141#define WM8400_CHIP_REV_WIDTH 3 /* CHIP_REV - [14:12] */
142
143/*
144 * R18 (0x12) - GPIO CTRL 1
145 */
146#define WM8400_IRQ 0x1000 /* IRQ */
147#define WM8400_IRQ_MASK 0x1000 /* IRQ */
148#define WM8400_IRQ_SHIFT 12 /* IRQ */
149#define WM8400_IRQ_WIDTH 1 /* IRQ */
150#define WM8400_TEMPOK 0x0800 /* TEMPOK */
151#define WM8400_TEMPOK_MASK 0x0800 /* TEMPOK */
152#define WM8400_TEMPOK_SHIFT 11 /* TEMPOK */
153#define WM8400_TEMPOK_WIDTH 1 /* TEMPOK */
154#define WM8400_MIC1SHRT 0x0400 /* MIC1SHRT */
155#define WM8400_MIC1SHRT_MASK 0x0400 /* MIC1SHRT */
156#define WM8400_MIC1SHRT_SHIFT 10 /* MIC1SHRT */
157#define WM8400_MIC1SHRT_WIDTH 1 /* MIC1SHRT */
158#define WM8400_MIC1DET 0x0200 /* MIC1DET */
159#define WM8400_MIC1DET_MASK 0x0200 /* MIC1DET */
160#define WM8400_MIC1DET_SHIFT 9 /* MIC1DET */
161#define WM8400_MIC1DET_WIDTH 1 /* MIC1DET */
162#define WM8400_FLL_LCK 0x0100 /* FLL_LCK */
163#define WM8400_FLL_LCK_MASK 0x0100 /* FLL_LCK */
164#define WM8400_FLL_LCK_SHIFT 8 /* FLL_LCK */
165#define WM8400_FLL_LCK_WIDTH 1 /* FLL_LCK */
166#define WM8400_GPIO_STATUS_MASK 0x00FF /* GPIO_STATUS - [7:0] */
167#define WM8400_GPIO_STATUS_SHIFT 0 /* GPIO_STATUS - [7:0] */
168#define WM8400_GPIO_STATUS_WIDTH 8 /* GPIO_STATUS - [7:0] */
169
170/*
171 * R19 (0x13) - GPIO1 & GPIO2
172 */
173#define WM8400_GPIO2_DEB_ENA 0x8000 /* GPIO2_DEB_ENA */
174#define WM8400_GPIO2_DEB_ENA_MASK 0x8000 /* GPIO2_DEB_ENA */
175#define WM8400_GPIO2_DEB_ENA_SHIFT 15 /* GPIO2_DEB_ENA */
176#define WM8400_GPIO2_DEB_ENA_WIDTH 1 /* GPIO2_DEB_ENA */
177#define WM8400_GPIO2_IRQ_ENA 0x4000 /* GPIO2_IRQ_ENA */
178#define WM8400_GPIO2_IRQ_ENA_MASK 0x4000 /* GPIO2_IRQ_ENA */
179#define WM8400_GPIO2_IRQ_ENA_SHIFT 14 /* GPIO2_IRQ_ENA */
180#define WM8400_GPIO2_IRQ_ENA_WIDTH 1 /* GPIO2_IRQ_ENA */
181#define WM8400_GPIO2_PU 0x2000 /* GPIO2_PU */
182#define WM8400_GPIO2_PU_MASK 0x2000 /* GPIO2_PU */
183#define WM8400_GPIO2_PU_SHIFT 13 /* GPIO2_PU */
184#define WM8400_GPIO2_PU_WIDTH 1 /* GPIO2_PU */
185#define WM8400_GPIO2_PD 0x1000 /* GPIO2_PD */
186#define WM8400_GPIO2_PD_MASK 0x1000 /* GPIO2_PD */
187#define WM8400_GPIO2_PD_SHIFT 12 /* GPIO2_PD */
188#define WM8400_GPIO2_PD_WIDTH 1 /* GPIO2_PD */
189#define WM8400_GPIO2_SEL_MASK 0x0F00 /* GPIO2_SEL - [11:8] */
190#define WM8400_GPIO2_SEL_SHIFT 8 /* GPIO2_SEL - [11:8] */
191#define WM8400_GPIO2_SEL_WIDTH 4 /* GPIO2_SEL - [11:8] */
192#define WM8400_GPIO1_DEB_ENA 0x0080 /* GPIO1_DEB_ENA */
193#define WM8400_GPIO1_DEB_ENA_MASK 0x0080 /* GPIO1_DEB_ENA */
194#define WM8400_GPIO1_DEB_ENA_SHIFT 7 /* GPIO1_DEB_ENA */
195#define WM8400_GPIO1_DEB_ENA_WIDTH 1 /* GPIO1_DEB_ENA */
196#define WM8400_GPIO1_IRQ_ENA 0x0040 /* GPIO1_IRQ_ENA */
197#define WM8400_GPIO1_IRQ_ENA_MASK 0x0040 /* GPIO1_IRQ_ENA */
198#define WM8400_GPIO1_IRQ_ENA_SHIFT 6 /* GPIO1_IRQ_ENA */
199#define WM8400_GPIO1_IRQ_ENA_WIDTH 1 /* GPIO1_IRQ_ENA */
200#define WM8400_GPIO1_PU 0x0020 /* GPIO1_PU */
201#define WM8400_GPIO1_PU_MASK 0x0020 /* GPIO1_PU */
202#define WM8400_GPIO1_PU_SHIFT 5 /* GPIO1_PU */
203#define WM8400_GPIO1_PU_WIDTH 1 /* GPIO1_PU */
204#define WM8400_GPIO1_PD 0x0010 /* GPIO1_PD */
205#define WM8400_GPIO1_PD_MASK 0x0010 /* GPIO1_PD */
206#define WM8400_GPIO1_PD_SHIFT 4 /* GPIO1_PD */
207#define WM8400_GPIO1_PD_WIDTH 1 /* GPIO1_PD */
208#define WM8400_GPIO1_SEL_MASK 0x000F /* GPIO1_SEL - [3:0] */
209#define WM8400_GPIO1_SEL_SHIFT 0 /* GPIO1_SEL - [3:0] */
210#define WM8400_GPIO1_SEL_WIDTH 4 /* GPIO1_SEL - [3:0] */
211
212/*
213 * R20 (0x14) - GPIO3 & GPIO4
214 */
215#define WM8400_GPIO4_DEB_ENA 0x8000 /* GPIO4_DEB_ENA */
216#define WM8400_GPIO4_DEB_ENA_MASK 0x8000 /* GPIO4_DEB_ENA */
217#define WM8400_GPIO4_DEB_ENA_SHIFT 15 /* GPIO4_DEB_ENA */
218#define WM8400_GPIO4_DEB_ENA_WIDTH 1 /* GPIO4_DEB_ENA */
219#define WM8400_GPIO4_IRQ_ENA 0x4000 /* GPIO4_IRQ_ENA */
220#define WM8400_GPIO4_IRQ_ENA_MASK 0x4000 /* GPIO4_IRQ_ENA */
221#define WM8400_GPIO4_IRQ_ENA_SHIFT 14 /* GPIO4_IRQ_ENA */
222#define WM8400_GPIO4_IRQ_ENA_WIDTH 1 /* GPIO4_IRQ_ENA */
223#define WM8400_GPIO4_PU 0x2000 /* GPIO4_PU */
224#define WM8400_GPIO4_PU_MASK 0x2000 /* GPIO4_PU */
225#define WM8400_GPIO4_PU_SHIFT 13 /* GPIO4_PU */
226#define WM8400_GPIO4_PU_WIDTH 1 /* GPIO4_PU */
227#define WM8400_GPIO4_PD 0x1000 /* GPIO4_PD */
228#define WM8400_GPIO4_PD_MASK 0x1000 /* GPIO4_PD */
229#define WM8400_GPIO4_PD_SHIFT 12 /* GPIO4_PD */
230#define WM8400_GPIO4_PD_WIDTH 1 /* GPIO4_PD */
231#define WM8400_GPIO4_SEL_MASK 0x0F00 /* GPIO4_SEL - [11:8] */
232#define WM8400_GPIO4_SEL_SHIFT 8 /* GPIO4_SEL - [11:8] */
233#define WM8400_GPIO4_SEL_WIDTH 4 /* GPIO4_SEL - [11:8] */
234#define WM8400_GPIO3_DEB_ENA 0x0080 /* GPIO3_DEB_ENA */
235#define WM8400_GPIO3_DEB_ENA_MASK 0x0080 /* GPIO3_DEB_ENA */
236#define WM8400_GPIO3_DEB_ENA_SHIFT 7 /* GPIO3_DEB_ENA */
237#define WM8400_GPIO3_DEB_ENA_WIDTH 1 /* GPIO3_DEB_ENA */
238#define WM8400_GPIO3_IRQ_ENA 0x0040 /* GPIO3_IRQ_ENA */
239#define WM8400_GPIO3_IRQ_ENA_MASK 0x0040 /* GPIO3_IRQ_ENA */
240#define WM8400_GPIO3_IRQ_ENA_SHIFT 6 /* GPIO3_IRQ_ENA */
241#define WM8400_GPIO3_IRQ_ENA_WIDTH 1 /* GPIO3_IRQ_ENA */
242#define WM8400_GPIO3_PU 0x0020 /* GPIO3_PU */
243#define WM8400_GPIO3_PU_MASK 0x0020 /* GPIO3_PU */
244#define WM8400_GPIO3_PU_SHIFT 5 /* GPIO3_PU */
245#define WM8400_GPIO3_PU_WIDTH 1 /* GPIO3_PU */
246#define WM8400_GPIO3_PD 0x0010 /* GPIO3_PD */
247#define WM8400_GPIO3_PD_MASK 0x0010 /* GPIO3_PD */
248#define WM8400_GPIO3_PD_SHIFT 4 /* GPIO3_PD */
249#define WM8400_GPIO3_PD_WIDTH 1 /* GPIO3_PD */
250#define WM8400_GPIO3_SEL_MASK 0x000F /* GPIO3_SEL - [3:0] */
251#define WM8400_GPIO3_SEL_SHIFT 0 /* GPIO3_SEL - [3:0] */
252#define WM8400_GPIO3_SEL_WIDTH 4 /* GPIO3_SEL - [3:0] */
253
254/*
255 * R21 (0x15) - GPIO5 & GPIO6
256 */
257#define WM8400_GPIO6_DEB_ENA 0x8000 /* GPIO6_DEB_ENA */
258#define WM8400_GPIO6_DEB_ENA_MASK 0x8000 /* GPIO6_DEB_ENA */
259#define WM8400_GPIO6_DEB_ENA_SHIFT 15 /* GPIO6_DEB_ENA */
260#define WM8400_GPIO6_DEB_ENA_WIDTH 1 /* GPIO6_DEB_ENA */
261#define WM8400_GPIO6_IRQ_ENA 0x4000 /* GPIO6_IRQ_ENA */
262#define WM8400_GPIO6_IRQ_ENA_MASK 0x4000 /* GPIO6_IRQ_ENA */
263#define WM8400_GPIO6_IRQ_ENA_SHIFT 14 /* GPIO6_IRQ_ENA */
264#define WM8400_GPIO6_IRQ_ENA_WIDTH 1 /* GPIO6_IRQ_ENA */
265#define WM8400_GPIO6_PU 0x2000 /* GPIO6_PU */
266#define WM8400_GPIO6_PU_MASK 0x2000 /* GPIO6_PU */
267#define WM8400_GPIO6_PU_SHIFT 13 /* GPIO6_PU */
268#define WM8400_GPIO6_PU_WIDTH 1 /* GPIO6_PU */
269#define WM8400_GPIO6_PD 0x1000 /* GPIO6_PD */
270#define WM8400_GPIO6_PD_MASK 0x1000 /* GPIO6_PD */
271#define WM8400_GPIO6_PD_SHIFT 12 /* GPIO6_PD */
272#define WM8400_GPIO6_PD_WIDTH 1 /* GPIO6_PD */
273#define WM8400_GPIO6_SEL_MASK 0x0F00 /* GPIO6_SEL - [11:8] */
274#define WM8400_GPIO6_SEL_SHIFT 8 /* GPIO6_SEL - [11:8] */
275#define WM8400_GPIO6_SEL_WIDTH 4 /* GPIO6_SEL - [11:8] */
276#define WM8400_GPIO5_DEB_ENA 0x0080 /* GPIO5_DEB_ENA */
277#define WM8400_GPIO5_DEB_ENA_MASK 0x0080 /* GPIO5_DEB_ENA */
278#define WM8400_GPIO5_DEB_ENA_SHIFT 7 /* GPIO5_DEB_ENA */
279#define WM8400_GPIO5_DEB_ENA_WIDTH 1 /* GPIO5_DEB_ENA */
280#define WM8400_GPIO5_IRQ_ENA 0x0040 /* GPIO5_IRQ_ENA */
281#define WM8400_GPIO5_IRQ_ENA_MASK 0x0040 /* GPIO5_IRQ_ENA */
282#define WM8400_GPIO5_IRQ_ENA_SHIFT 6 /* GPIO5_IRQ_ENA */
283#define WM8400_GPIO5_IRQ_ENA_WIDTH 1 /* GPIO5_IRQ_ENA */
284#define WM8400_GPIO5_PU 0x0020 /* GPIO5_PU */
285#define WM8400_GPIO5_PU_MASK 0x0020 /* GPIO5_PU */
286#define WM8400_GPIO5_PU_SHIFT 5 /* GPIO5_PU */
287#define WM8400_GPIO5_PU_WIDTH 1 /* GPIO5_PU */
288#define WM8400_GPIO5_PD 0x0010 /* GPIO5_PD */
289#define WM8400_GPIO5_PD_MASK 0x0010 /* GPIO5_PD */
290#define WM8400_GPIO5_PD_SHIFT 4 /* GPIO5_PD */
291#define WM8400_GPIO5_PD_WIDTH 1 /* GPIO5_PD */
292#define WM8400_GPIO5_SEL_MASK 0x000F /* GPIO5_SEL - [3:0] */
293#define WM8400_GPIO5_SEL_SHIFT 0 /* GPIO5_SEL - [3:0] */
294#define WM8400_GPIO5_SEL_WIDTH 4 /* GPIO5_SEL - [3:0] */
295
296/*
297 * R22 (0x16) - GPIOCTRL 2
298 */
299#define WM8400_TEMPOK_IRQ_ENA 0x0800 /* TEMPOK_IRQ_ENA */
300#define WM8400_TEMPOK_IRQ_ENA_MASK 0x0800 /* TEMPOK_IRQ_ENA */
301#define WM8400_TEMPOK_IRQ_ENA_SHIFT 11 /* TEMPOK_IRQ_ENA */
302#define WM8400_TEMPOK_IRQ_ENA_WIDTH 1 /* TEMPOK_IRQ_ENA */
303#define WM8400_MIC1SHRT_IRQ_ENA 0x0400 /* MIC1SHRT_IRQ_ENA */
304#define WM8400_MIC1SHRT_IRQ_ENA_MASK 0x0400 /* MIC1SHRT_IRQ_ENA */
305#define WM8400_MIC1SHRT_IRQ_ENA_SHIFT 10 /* MIC1SHRT_IRQ_ENA */
306#define WM8400_MIC1SHRT_IRQ_ENA_WIDTH 1 /* MIC1SHRT_IRQ_ENA */
307#define WM8400_MIC1DET_IRQ_ENA 0x0200 /* MIC1DET_IRQ_ENA */
308#define WM8400_MIC1DET_IRQ_ENA_MASK 0x0200 /* MIC1DET_IRQ_ENA */
309#define WM8400_MIC1DET_IRQ_ENA_SHIFT 9 /* MIC1DET_IRQ_ENA */
310#define WM8400_MIC1DET_IRQ_ENA_WIDTH 1 /* MIC1DET_IRQ_ENA */
311#define WM8400_FLL_LCK_IRQ_ENA 0x0100 /* FLL_LCK_IRQ_ENA */
312#define WM8400_FLL_LCK_IRQ_ENA_MASK 0x0100 /* FLL_LCK_IRQ_ENA */
313#define WM8400_FLL_LCK_IRQ_ENA_SHIFT 8 /* FLL_LCK_IRQ_ENA */
314#define WM8400_FLL_LCK_IRQ_ENA_WIDTH 1 /* FLL_LCK_IRQ_ENA */
315#define WM8400_GPI8_DEB_ENA 0x0080 /* GPI8_DEB_ENA */
316#define WM8400_GPI8_DEB_ENA_MASK 0x0080 /* GPI8_DEB_ENA */
317#define WM8400_GPI8_DEB_ENA_SHIFT 7 /* GPI8_DEB_ENA */
318#define WM8400_GPI8_DEB_ENA_WIDTH 1 /* GPI8_DEB_ENA */
319#define WM8400_GPI8_IRQ_ENA 0x0040 /* GPI8_IRQ_ENA */
320#define WM8400_GPI8_IRQ_ENA_MASK 0x0040 /* GPI8_IRQ_ENA */
321#define WM8400_GPI8_IRQ_ENA_SHIFT 6 /* GPI8_IRQ_ENA */
322#define WM8400_GPI8_IRQ_ENA_WIDTH 1 /* GPI8_IRQ_ENA */
323#define WM8400_GPI8_ENA 0x0010 /* GPI8_ENA */
324#define WM8400_GPI8_ENA_MASK 0x0010 /* GPI8_ENA */
325#define WM8400_GPI8_ENA_SHIFT 4 /* GPI8_ENA */
326#define WM8400_GPI8_ENA_WIDTH 1 /* GPI8_ENA */
327#define WM8400_GPI7_DEB_ENA 0x0008 /* GPI7_DEB_ENA */
328#define WM8400_GPI7_DEB_ENA_MASK 0x0008 /* GPI7_DEB_ENA */
329#define WM8400_GPI7_DEB_ENA_SHIFT 3 /* GPI7_DEB_ENA */
330#define WM8400_GPI7_DEB_ENA_WIDTH 1 /* GPI7_DEB_ENA */
331#define WM8400_GPI7_IRQ_ENA 0x0004 /* GPI7_IRQ_ENA */
332#define WM8400_GPI7_IRQ_ENA_MASK 0x0004 /* GPI7_IRQ_ENA */
333#define WM8400_GPI7_IRQ_ENA_SHIFT 2 /* GPI7_IRQ_ENA */
334#define WM8400_GPI7_IRQ_ENA_WIDTH 1 /* GPI7_IRQ_ENA */
335#define WM8400_GPI7_ENA 0x0001 /* GPI7_ENA */
336#define WM8400_GPI7_ENA_MASK 0x0001 /* GPI7_ENA */
337#define WM8400_GPI7_ENA_SHIFT 0 /* GPI7_ENA */
338#define WM8400_GPI7_ENA_WIDTH 1 /* GPI7_ENA */
339
340/*
341 * R23 (0x17) - GPIO_POL
342 */
343#define WM8400_IRQ_INV 0x1000 /* IRQ_INV */
344#define WM8400_IRQ_INV_MASK 0x1000 /* IRQ_INV */
345#define WM8400_IRQ_INV_SHIFT 12 /* IRQ_INV */
346#define WM8400_IRQ_INV_WIDTH 1 /* IRQ_INV */
347#define WM8400_TEMPOK_POL 0x0800 /* TEMPOK_POL */
348#define WM8400_TEMPOK_POL_MASK 0x0800 /* TEMPOK_POL */
349#define WM8400_TEMPOK_POL_SHIFT 11 /* TEMPOK_POL */
350#define WM8400_TEMPOK_POL_WIDTH 1 /* TEMPOK_POL */
351#define WM8400_MIC1SHRT_POL 0x0400 /* MIC1SHRT_POL */
352#define WM8400_MIC1SHRT_POL_MASK 0x0400 /* MIC1SHRT_POL */
353#define WM8400_MIC1SHRT_POL_SHIFT 10 /* MIC1SHRT_POL */
354#define WM8400_MIC1SHRT_POL_WIDTH 1 /* MIC1SHRT_POL */
355#define WM8400_MIC1DET_POL 0x0200 /* MIC1DET_POL */
356#define WM8400_MIC1DET_POL_MASK 0x0200 /* MIC1DET_POL */
357#define WM8400_MIC1DET_POL_SHIFT 9 /* MIC1DET_POL */
358#define WM8400_MIC1DET_POL_WIDTH 1 /* MIC1DET_POL */
359#define WM8400_FLL_LCK_POL 0x0100 /* FLL_LCK_POL */
360#define WM8400_FLL_LCK_POL_MASK 0x0100 /* FLL_LCK_POL */
361#define WM8400_FLL_LCK_POL_SHIFT 8 /* FLL_LCK_POL */
362#define WM8400_FLL_LCK_POL_WIDTH 1 /* FLL_LCK_POL */
363#define WM8400_GPIO_POL_MASK 0x00FF /* GPIO_POL - [7:0] */
364#define WM8400_GPIO_POL_SHIFT 0 /* GPIO_POL - [7:0] */
365#define WM8400_GPIO_POL_WIDTH 8 /* GPIO_POL - [7:0] */
366
367/*
368 * R65 (0x41) - LDO 1 Control
369 */
370#define WM8400_LDO1_ENA 0x8000 /* LDO1_ENA */
371#define WM8400_LDO1_ENA_MASK 0x8000 /* LDO1_ENA */
372#define WM8400_LDO1_ENA_SHIFT 15 /* LDO1_ENA */
373#define WM8400_LDO1_ENA_WIDTH 1 /* LDO1_ENA */
374#define WM8400_LDO1_SWI 0x4000 /* LDO1_SWI */
375#define WM8400_LDO1_SWI_MASK 0x4000 /* LDO1_SWI */
376#define WM8400_LDO1_SWI_SHIFT 14 /* LDO1_SWI */
377#define WM8400_LDO1_SWI_WIDTH 1 /* LDO1_SWI */
378#define WM8400_LDO1_OPFLT 0x1000 /* LDO1_OPFLT */
379#define WM8400_LDO1_OPFLT_MASK 0x1000 /* LDO1_OPFLT */
380#define WM8400_LDO1_OPFLT_SHIFT 12 /* LDO1_OPFLT */
381#define WM8400_LDO1_OPFLT_WIDTH 1 /* LDO1_OPFLT */
382#define WM8400_LDO1_ERRACT 0x0800 /* LDO1_ERRACT */
383#define WM8400_LDO1_ERRACT_MASK 0x0800 /* LDO1_ERRACT */
384#define WM8400_LDO1_ERRACT_SHIFT 11 /* LDO1_ERRACT */
385#define WM8400_LDO1_ERRACT_WIDTH 1 /* LDO1_ERRACT */
386#define WM8400_LDO1_HIB_MODE 0x0400 /* LDO1_HIB_MODE */
387#define WM8400_LDO1_HIB_MODE_MASK 0x0400 /* LDO1_HIB_MODE */
388#define WM8400_LDO1_HIB_MODE_SHIFT 10 /* LDO1_HIB_MODE */
389#define WM8400_LDO1_HIB_MODE_WIDTH 1 /* LDO1_HIB_MODE */
390#define WM8400_LDO1_VIMG_MASK 0x03E0 /* LDO1_VIMG - [9:5] */
391#define WM8400_LDO1_VIMG_SHIFT 5 /* LDO1_VIMG - [9:5] */
392#define WM8400_LDO1_VIMG_WIDTH 5 /* LDO1_VIMG - [9:5] */
393#define WM8400_LDO1_VSEL_MASK 0x001F /* LDO1_VSEL - [4:0] */
394#define WM8400_LDO1_VSEL_SHIFT 0 /* LDO1_VSEL - [4:0] */
395#define WM8400_LDO1_VSEL_WIDTH 5 /* LDO1_VSEL - [4:0] */
396
397/*
398 * R66 (0x42) - LDO 2 Control
399 */
400#define WM8400_LDO2_ENA 0x8000 /* LDO2_ENA */
401#define WM8400_LDO2_ENA_MASK 0x8000 /* LDO2_ENA */
402#define WM8400_LDO2_ENA_SHIFT 15 /* LDO2_ENA */
403#define WM8400_LDO2_ENA_WIDTH 1 /* LDO2_ENA */
404#define WM8400_LDO2_SWI 0x4000 /* LDO2_SWI */
405#define WM8400_LDO2_SWI_MASK 0x4000 /* LDO2_SWI */
406#define WM8400_LDO2_SWI_SHIFT 14 /* LDO2_SWI */
407#define WM8400_LDO2_SWI_WIDTH 1 /* LDO2_SWI */
408#define WM8400_LDO2_OPFLT 0x1000 /* LDO2_OPFLT */
409#define WM8400_LDO2_OPFLT_MASK 0x1000 /* LDO2_OPFLT */
410#define WM8400_LDO2_OPFLT_SHIFT 12 /* LDO2_OPFLT */
411#define WM8400_LDO2_OPFLT_WIDTH 1 /* LDO2_OPFLT */
412#define WM8400_LDO2_ERRACT 0x0800 /* LDO2_ERRACT */
413#define WM8400_LDO2_ERRACT_MASK 0x0800 /* LDO2_ERRACT */
414#define WM8400_LDO2_ERRACT_SHIFT 11 /* LDO2_ERRACT */
415#define WM8400_LDO2_ERRACT_WIDTH 1 /* LDO2_ERRACT */
416#define WM8400_LDO2_HIB_MODE 0x0400 /* LDO2_HIB_MODE */
417#define WM8400_LDO2_HIB_MODE_MASK 0x0400 /* LDO2_HIB_MODE */
418#define WM8400_LDO2_HIB_MODE_SHIFT 10 /* LDO2_HIB_MODE */
419#define WM8400_LDO2_HIB_MODE_WIDTH 1 /* LDO2_HIB_MODE */
420#define WM8400_LDO2_VIMG_MASK 0x03E0 /* LDO2_VIMG - [9:5] */
421#define WM8400_LDO2_VIMG_SHIFT 5 /* LDO2_VIMG - [9:5] */
422#define WM8400_LDO2_VIMG_WIDTH 5 /* LDO2_VIMG - [9:5] */
423#define WM8400_LDO2_VSEL_MASK 0x001F /* LDO2_VSEL - [4:0] */
424#define WM8400_LDO2_VSEL_SHIFT 0 /* LDO2_VSEL - [4:0] */
425#define WM8400_LDO2_VSEL_WIDTH 5 /* LDO2_VSEL - [4:0] */
426
427/*
428 * R67 (0x43) - LDO 3 Control
429 */
430#define WM8400_LDO3_ENA 0x8000 /* LDO3_ENA */
431#define WM8400_LDO3_ENA_MASK 0x8000 /* LDO3_ENA */
432#define WM8400_LDO3_ENA_SHIFT 15 /* LDO3_ENA */
433#define WM8400_LDO3_ENA_WIDTH 1 /* LDO3_ENA */
434#define WM8400_LDO3_SWI 0x4000 /* LDO3_SWI */
435#define WM8400_LDO3_SWI_MASK 0x4000 /* LDO3_SWI */
436#define WM8400_LDO3_SWI_SHIFT 14 /* LDO3_SWI */
437#define WM8400_LDO3_SWI_WIDTH 1 /* LDO3_SWI */
438#define WM8400_LDO3_OPFLT 0x1000 /* LDO3_OPFLT */
439#define WM8400_LDO3_OPFLT_MASK 0x1000 /* LDO3_OPFLT */
440#define WM8400_LDO3_OPFLT_SHIFT 12 /* LDO3_OPFLT */
441#define WM8400_LDO3_OPFLT_WIDTH 1 /* LDO3_OPFLT */
442#define WM8400_LDO3_ERRACT 0x0800 /* LDO3_ERRACT */
443#define WM8400_LDO3_ERRACT_MASK 0x0800 /* LDO3_ERRACT */
444#define WM8400_LDO3_ERRACT_SHIFT 11 /* LDO3_ERRACT */
445#define WM8400_LDO3_ERRACT_WIDTH 1 /* LDO3_ERRACT */
446#define WM8400_LDO3_HIB_MODE 0x0400 /* LDO3_HIB_MODE */
447#define WM8400_LDO3_HIB_MODE_MASK 0x0400 /* LDO3_HIB_MODE */
448#define WM8400_LDO3_HIB_MODE_SHIFT 10 /* LDO3_HIB_MODE */
449#define WM8400_LDO3_HIB_MODE_WIDTH 1 /* LDO3_HIB_MODE */
450#define WM8400_LDO3_VIMG_MASK 0x03E0 /* LDO3_VIMG - [9:5] */
451#define WM8400_LDO3_VIMG_SHIFT 5 /* LDO3_VIMG - [9:5] */
452#define WM8400_LDO3_VIMG_WIDTH 5 /* LDO3_VIMG - [9:5] */
453#define WM8400_LDO3_VSEL_MASK 0x001F /* LDO3_VSEL - [4:0] */
454#define WM8400_LDO3_VSEL_SHIFT 0 /* LDO3_VSEL - [4:0] */
455#define WM8400_LDO3_VSEL_WIDTH 5 /* LDO3_VSEL - [4:0] */
456
457/*
458 * R68 (0x44) - LDO 4 Control
459 */
460#define WM8400_LDO4_ENA 0x8000 /* LDO4_ENA */
461#define WM8400_LDO4_ENA_MASK 0x8000 /* LDO4_ENA */
462#define WM8400_LDO4_ENA_SHIFT 15 /* LDO4_ENA */
463#define WM8400_LDO4_ENA_WIDTH 1 /* LDO4_ENA */
464#define WM8400_LDO4_SWI 0x4000 /* LDO4_SWI */
465#define WM8400_LDO4_SWI_MASK 0x4000 /* LDO4_SWI */
466#define WM8400_LDO4_SWI_SHIFT 14 /* LDO4_SWI */
467#define WM8400_LDO4_SWI_WIDTH 1 /* LDO4_SWI */
468#define WM8400_LDO4_OPFLT 0x1000 /* LDO4_OPFLT */
469#define WM8400_LDO4_OPFLT_MASK 0x1000 /* LDO4_OPFLT */
470#define WM8400_LDO4_OPFLT_SHIFT 12 /* LDO4_OPFLT */
471#define WM8400_LDO4_OPFLT_WIDTH 1 /* LDO4_OPFLT */
472#define WM8400_LDO4_ERRACT 0x0800 /* LDO4_ERRACT */
473#define WM8400_LDO4_ERRACT_MASK 0x0800 /* LDO4_ERRACT */
474#define WM8400_LDO4_ERRACT_SHIFT 11 /* LDO4_ERRACT */
475#define WM8400_LDO4_ERRACT_WIDTH 1 /* LDO4_ERRACT */
476#define WM8400_LDO4_HIB_MODE 0x0400 /* LDO4_HIB_MODE */
477#define WM8400_LDO4_HIB_MODE_MASK 0x0400 /* LDO4_HIB_MODE */
478#define WM8400_LDO4_HIB_MODE_SHIFT 10 /* LDO4_HIB_MODE */
479#define WM8400_LDO4_HIB_MODE_WIDTH 1 /* LDO4_HIB_MODE */
480#define WM8400_LDO4_VIMG_MASK 0x03E0 /* LDO4_VIMG - [9:5] */
481#define WM8400_LDO4_VIMG_SHIFT 5 /* LDO4_VIMG - [9:5] */
482#define WM8400_LDO4_VIMG_WIDTH 5 /* LDO4_VIMG - [9:5] */
483#define WM8400_LDO4_VSEL_MASK 0x001F /* LDO4_VSEL - [4:0] */
484#define WM8400_LDO4_VSEL_SHIFT 0 /* LDO4_VSEL - [4:0] */
485#define WM8400_LDO4_VSEL_WIDTH 5 /* LDO4_VSEL - [4:0] */
486
487/*
488 * R70 (0x46) - DCDC1 Control 1
489 */
490#define WM8400_DC1_ENA 0x8000 /* DC1_ENA */
491#define WM8400_DC1_ENA_MASK 0x8000 /* DC1_ENA */
492#define WM8400_DC1_ENA_SHIFT 15 /* DC1_ENA */
493#define WM8400_DC1_ENA_WIDTH 1 /* DC1_ENA */
494#define WM8400_DC1_ACTIVE 0x4000 /* DC1_ACTIVE */
495#define WM8400_DC1_ACTIVE_MASK 0x4000 /* DC1_ACTIVE */
496#define WM8400_DC1_ACTIVE_SHIFT 14 /* DC1_ACTIVE */
497#define WM8400_DC1_ACTIVE_WIDTH 1 /* DC1_ACTIVE */
498#define WM8400_DC1_SLEEP 0x2000 /* DC1_SLEEP */
499#define WM8400_DC1_SLEEP_MASK 0x2000 /* DC1_SLEEP */
500#define WM8400_DC1_SLEEP_SHIFT 13 /* DC1_SLEEP */
501#define WM8400_DC1_SLEEP_WIDTH 1 /* DC1_SLEEP */
502#define WM8400_DC1_OPFLT 0x1000 /* DC1_OPFLT */
503#define WM8400_DC1_OPFLT_MASK 0x1000 /* DC1_OPFLT */
504#define WM8400_DC1_OPFLT_SHIFT 12 /* DC1_OPFLT */
505#define WM8400_DC1_OPFLT_WIDTH 1 /* DC1_OPFLT */
506#define WM8400_DC1_ERRACT 0x0800 /* DC1_ERRACT */
507#define WM8400_DC1_ERRACT_MASK 0x0800 /* DC1_ERRACT */
508#define WM8400_DC1_ERRACT_SHIFT 11 /* DC1_ERRACT */
509#define WM8400_DC1_ERRACT_WIDTH 1 /* DC1_ERRACT */
510#define WM8400_DC1_HIB_MODE 0x0400 /* DC1_HIB_MODE */
511#define WM8400_DC1_HIB_MODE_MASK 0x0400 /* DC1_HIB_MODE */
512#define WM8400_DC1_HIB_MODE_SHIFT 10 /* DC1_HIB_MODE */
513#define WM8400_DC1_HIB_MODE_WIDTH 1 /* DC1_HIB_MODE */
514#define WM8400_DC1_SOFTST_MASK 0x0300 /* DC1_SOFTST - [9:8] */
515#define WM8400_DC1_SOFTST_SHIFT 8 /* DC1_SOFTST - [9:8] */
516#define WM8400_DC1_SOFTST_WIDTH 2 /* DC1_SOFTST - [9:8] */
517#define WM8400_DC1_OV_PROT 0x0080 /* DC1_OV_PROT */
518#define WM8400_DC1_OV_PROT_MASK 0x0080 /* DC1_OV_PROT */
519#define WM8400_DC1_OV_PROT_SHIFT 7 /* DC1_OV_PROT */
520#define WM8400_DC1_OV_PROT_WIDTH 1 /* DC1_OV_PROT */
521#define WM8400_DC1_VSEL_MASK 0x007F /* DC1_VSEL - [6:0] */
522#define WM8400_DC1_VSEL_SHIFT 0 /* DC1_VSEL - [6:0] */
523#define WM8400_DC1_VSEL_WIDTH 7 /* DC1_VSEL - [6:0] */
524
525/*
526 * R71 (0x47) - DCDC1 Control 2
527 */
528#define WM8400_DC1_FRC_PWM 0x2000 /* DC1_FRC_PWM */
529#define WM8400_DC1_FRC_PWM_MASK 0x2000 /* DC1_FRC_PWM */
530#define WM8400_DC1_FRC_PWM_SHIFT 13 /* DC1_FRC_PWM */
531#define WM8400_DC1_FRC_PWM_WIDTH 1 /* DC1_FRC_PWM */
532#define WM8400_DC1_STBY_LIM_MASK 0x0300 /* DC1_STBY_LIM - [9:8] */
533#define WM8400_DC1_STBY_LIM_SHIFT 8 /* DC1_STBY_LIM - [9:8] */
534#define WM8400_DC1_STBY_LIM_WIDTH 2 /* DC1_STBY_LIM - [9:8] */
535#define WM8400_DC1_ACT_LIM 0x0080 /* DC1_ACT_LIM */
536#define WM8400_DC1_ACT_LIM_MASK 0x0080 /* DC1_ACT_LIM */
537#define WM8400_DC1_ACT_LIM_SHIFT 7 /* DC1_ACT_LIM */
538#define WM8400_DC1_ACT_LIM_WIDTH 1 /* DC1_ACT_LIM */
539#define WM8400_DC1_VIMG_MASK 0x007F /* DC1_VIMG - [6:0] */
540#define WM8400_DC1_VIMG_SHIFT 0 /* DC1_VIMG - [6:0] */
541#define WM8400_DC1_VIMG_WIDTH 7 /* DC1_VIMG - [6:0] */
542
543/*
544 * R72 (0x48) - DCDC2 Control 1
545 */
546#define WM8400_DC2_ENA 0x8000 /* DC2_ENA */
547#define WM8400_DC2_ENA_MASK 0x8000 /* DC2_ENA */
548#define WM8400_DC2_ENA_SHIFT 15 /* DC2_ENA */
549#define WM8400_DC2_ENA_WIDTH 1 /* DC2_ENA */
550#define WM8400_DC2_ACTIVE 0x4000 /* DC2_ACTIVE */
551#define WM8400_DC2_ACTIVE_MASK 0x4000 /* DC2_ACTIVE */
552#define WM8400_DC2_ACTIVE_SHIFT 14 /* DC2_ACTIVE */
553#define WM8400_DC2_ACTIVE_WIDTH 1 /* DC2_ACTIVE */
554#define WM8400_DC2_SLEEP 0x2000 /* DC2_SLEEP */
555#define WM8400_DC2_SLEEP_MASK 0x2000 /* DC2_SLEEP */
556#define WM8400_DC2_SLEEP_SHIFT 13 /* DC2_SLEEP */
557#define WM8400_DC2_SLEEP_WIDTH 1 /* DC2_SLEEP */
558#define WM8400_DC2_OPFLT 0x1000 /* DC2_OPFLT */
559#define WM8400_DC2_OPFLT_MASK 0x1000 /* DC2_OPFLT */
560#define WM8400_DC2_OPFLT_SHIFT 12 /* DC2_OPFLT */
561#define WM8400_DC2_OPFLT_WIDTH 1 /* DC2_OPFLT */
562#define WM8400_DC2_ERRACT 0x0800 /* DC2_ERRACT */
563#define WM8400_DC2_ERRACT_MASK 0x0800 /* DC2_ERRACT */
564#define WM8400_DC2_ERRACT_SHIFT 11 /* DC2_ERRACT */
565#define WM8400_DC2_ERRACT_WIDTH 1 /* DC2_ERRACT */
566#define WM8400_DC2_HIB_MODE 0x0400 /* DC2_HIB_MODE */
567#define WM8400_DC2_HIB_MODE_MASK 0x0400 /* DC2_HIB_MODE */
568#define WM8400_DC2_HIB_MODE_SHIFT 10 /* DC2_HIB_MODE */
569#define WM8400_DC2_HIB_MODE_WIDTH 1 /* DC2_HIB_MODE */
570#define WM8400_DC2_SOFTST_MASK 0x0300 /* DC2_SOFTST - [9:8] */
571#define WM8400_DC2_SOFTST_SHIFT 8 /* DC2_SOFTST - [9:8] */
572#define WM8400_DC2_SOFTST_WIDTH 2 /* DC2_SOFTST - [9:8] */
573#define WM8400_DC2_OV_PROT 0x0080 /* DC2_OV_PROT */
574#define WM8400_DC2_OV_PROT_MASK 0x0080 /* DC2_OV_PROT */
575#define WM8400_DC2_OV_PROT_SHIFT 7 /* DC2_OV_PROT */
576#define WM8400_DC2_OV_PROT_WIDTH 1 /* DC2_OV_PROT */
577#define WM8400_DC2_VSEL_MASK 0x007F /* DC2_VSEL - [6:0] */
578#define WM8400_DC2_VSEL_SHIFT 0 /* DC2_VSEL - [6:0] */
579#define WM8400_DC2_VSEL_WIDTH 7 /* DC2_VSEL - [6:0] */
580
581/*
582 * R73 (0x49) - DCDC2 Control 2
583 */
584#define WM8400_DC2_FRC_PWM 0x2000 /* DC2_FRC_PWM */
585#define WM8400_DC2_FRC_PWM_MASK 0x2000 /* DC2_FRC_PWM */
586#define WM8400_DC2_FRC_PWM_SHIFT 13 /* DC2_FRC_PWM */
587#define WM8400_DC2_FRC_PWM_WIDTH 1 /* DC2_FRC_PWM */
588#define WM8400_DC2_STBY_LIM_MASK 0x0300 /* DC2_STBY_LIM - [9:8] */
589#define WM8400_DC2_STBY_LIM_SHIFT 8 /* DC2_STBY_LIM - [9:8] */
590#define WM8400_DC2_STBY_LIM_WIDTH 2 /* DC2_STBY_LIM - [9:8] */
591#define WM8400_DC2_ACT_LIM 0x0080 /* DC2_ACT_LIM */
592#define WM8400_DC2_ACT_LIM_MASK 0x0080 /* DC2_ACT_LIM */
593#define WM8400_DC2_ACT_LIM_SHIFT 7 /* DC2_ACT_LIM */
594#define WM8400_DC2_ACT_LIM_WIDTH 1 /* DC2_ACT_LIM */
595#define WM8400_DC2_VIMG_MASK 0x007F /* DC2_VIMG - [6:0] */
596#define WM8400_DC2_VIMG_SHIFT 0 /* DC2_VIMG - [6:0] */
597#define WM8400_DC2_VIMG_WIDTH 7 /* DC2_VIMG - [6:0] */
598
599/*
600 * R75 (0x4B) - Interface
601 */
602#define WM8400_AUTOINC 0x0008 /* AUTOINC */
603#define WM8400_AUTOINC_MASK 0x0008 /* AUTOINC */
604#define WM8400_AUTOINC_SHIFT 3 /* AUTOINC */
605#define WM8400_AUTOINC_WIDTH 1 /* AUTOINC */
606#define WM8400_ARA_ENA 0x0004 /* ARA_ENA */
607#define WM8400_ARA_ENA_MASK 0x0004 /* ARA_ENA */
608#define WM8400_ARA_ENA_SHIFT 2 /* ARA_ENA */
609#define WM8400_ARA_ENA_WIDTH 1 /* ARA_ENA */
610#define WM8400_SPI_CFG 0x0002 /* SPI_CFG */
611#define WM8400_SPI_CFG_MASK 0x0002 /* SPI_CFG */
612#define WM8400_SPI_CFG_SHIFT 1 /* SPI_CFG */
613#define WM8400_SPI_CFG_WIDTH 1 /* SPI_CFG */
614
615/*
616 * R76 (0x4C) - PM GENERAL
617 */
618#define WM8400_CODEC_SOFTST 0x8000 /* CODEC_SOFTST */
619#define WM8400_CODEC_SOFTST_MASK 0x8000 /* CODEC_SOFTST */
620#define WM8400_CODEC_SOFTST_SHIFT 15 /* CODEC_SOFTST */
621#define WM8400_CODEC_SOFTST_WIDTH 1 /* CODEC_SOFTST */
622#define WM8400_CODEC_SOFTSD 0x4000 /* CODEC_SOFTSD */
623#define WM8400_CODEC_SOFTSD_MASK 0x4000 /* CODEC_SOFTSD */
624#define WM8400_CODEC_SOFTSD_SHIFT 14 /* CODEC_SOFTSD */
625#define WM8400_CODEC_SOFTSD_WIDTH 1 /* CODEC_SOFTSD */
626#define WM8400_CHIP_SOFTSD 0x2000 /* CHIP_SOFTSD */
627#define WM8400_CHIP_SOFTSD_MASK 0x2000 /* CHIP_SOFTSD */
628#define WM8400_CHIP_SOFTSD_SHIFT 13 /* CHIP_SOFTSD */
629#define WM8400_CHIP_SOFTSD_WIDTH 1 /* CHIP_SOFTSD */
630#define WM8400_DSLEEP1_POL 0x0008 /* DSLEEP1_POL */
631#define WM8400_DSLEEP1_POL_MASK 0x0008 /* DSLEEP1_POL */
632#define WM8400_DSLEEP1_POL_SHIFT 3 /* DSLEEP1_POL */
633#define WM8400_DSLEEP1_POL_WIDTH 1 /* DSLEEP1_POL */
634#define WM8400_DSLEEP2_POL 0x0004 /* DSLEEP2_POL */
635#define WM8400_DSLEEP2_POL_MASK 0x0004 /* DSLEEP2_POL */
636#define WM8400_DSLEEP2_POL_SHIFT 2 /* DSLEEP2_POL */
637#define WM8400_DSLEEP2_POL_WIDTH 1 /* DSLEEP2_POL */
638#define WM8400_PWR_STATE_MASK 0x0003 /* PWR_STATE - [1:0] */
639#define WM8400_PWR_STATE_SHIFT 0 /* PWR_STATE - [1:0] */
640#define WM8400_PWR_STATE_WIDTH 2 /* PWR_STATE - [1:0] */
641
642/*
643 * R78 (0x4E) - PM Shutdown Control
644 */
645#define WM8400_CHIP_GT150_ERRACT 0x0200 /* CHIP_GT150_ERRACT */
646#define WM8400_CHIP_GT150_ERRACT_MASK 0x0200 /* CHIP_GT150_ERRACT */
647#define WM8400_CHIP_GT150_ERRACT_SHIFT 9 /* CHIP_GT150_ERRACT */
648#define WM8400_CHIP_GT150_ERRACT_WIDTH 1 /* CHIP_GT150_ERRACT */
649#define WM8400_CHIP_GT115_ERRACT 0x0100 /* CHIP_GT115_ERRACT */
650#define WM8400_CHIP_GT115_ERRACT_MASK 0x0100 /* CHIP_GT115_ERRACT */
651#define WM8400_CHIP_GT115_ERRACT_SHIFT 8 /* CHIP_GT115_ERRACT */
652#define WM8400_CHIP_GT115_ERRACT_WIDTH 1 /* CHIP_GT115_ERRACT */
653#define WM8400_LINE_CMP_ERRACT 0x0080 /* LINE_CMP_ERRACT */
654#define WM8400_LINE_CMP_ERRACT_MASK 0x0080 /* LINE_CMP_ERRACT */
655#define WM8400_LINE_CMP_ERRACT_SHIFT 7 /* LINE_CMP_ERRACT */
656#define WM8400_LINE_CMP_ERRACT_WIDTH 1 /* LINE_CMP_ERRACT */
657#define WM8400_UVLO_ERRACT 0x0040 /* UVLO_ERRACT */
658#define WM8400_UVLO_ERRACT_MASK 0x0040 /* UVLO_ERRACT */
659#define WM8400_UVLO_ERRACT_SHIFT 6 /* UVLO_ERRACT */
660#define WM8400_UVLO_ERRACT_WIDTH 1 /* UVLO_ERRACT */
661
662/*
663 * R79 (0x4F) - Interrupt Status 1
664 */
665#define WM8400_MICD_CINT 0x8000 /* MICD_CINT */
666#define WM8400_MICD_CINT_MASK 0x8000 /* MICD_CINT */
667#define WM8400_MICD_CINT_SHIFT 15 /* MICD_CINT */
668#define WM8400_MICD_CINT_WIDTH 1 /* MICD_CINT */
669#define WM8400_MICSCD_CINT 0x4000 /* MICSCD_CINT */
670#define WM8400_MICSCD_CINT_MASK 0x4000 /* MICSCD_CINT */
671#define WM8400_MICSCD_CINT_SHIFT 14 /* MICSCD_CINT */
672#define WM8400_MICSCD_CINT_WIDTH 1 /* MICSCD_CINT */
673#define WM8400_JDL_CINT 0x2000 /* JDL_CINT */
674#define WM8400_JDL_CINT_MASK 0x2000 /* JDL_CINT */
675#define WM8400_JDL_CINT_SHIFT 13 /* JDL_CINT */
676#define WM8400_JDL_CINT_WIDTH 1 /* JDL_CINT */
677#define WM8400_JDR_CINT 0x1000 /* JDR_CINT */
678#define WM8400_JDR_CINT_MASK 0x1000 /* JDR_CINT */
679#define WM8400_JDR_CINT_SHIFT 12 /* JDR_CINT */
680#define WM8400_JDR_CINT_WIDTH 1 /* JDR_CINT */
681#define WM8400_CODEC_SEQ_END_EINT 0x0800 /* CODEC_SEQ_END_EINT */
682#define WM8400_CODEC_SEQ_END_EINT_MASK 0x0800 /* CODEC_SEQ_END_EINT */
683#define WM8400_CODEC_SEQ_END_EINT_SHIFT 11 /* CODEC_SEQ_END_EINT */
684#define WM8400_CODEC_SEQ_END_EINT_WIDTH 1 /* CODEC_SEQ_END_EINT */
685#define WM8400_CDEL_TO_EINT 0x0400 /* CDEL_TO_EINT */
686#define WM8400_CDEL_TO_EINT_MASK 0x0400 /* CDEL_TO_EINT */
687#define WM8400_CDEL_TO_EINT_SHIFT 10 /* CDEL_TO_EINT */
688#define WM8400_CDEL_TO_EINT_WIDTH 1 /* CDEL_TO_EINT */
689#define WM8400_CHIP_GT150_EINT 0x0200 /* CHIP_GT150_EINT */
690#define WM8400_CHIP_GT150_EINT_MASK 0x0200 /* CHIP_GT150_EINT */
691#define WM8400_CHIP_GT150_EINT_SHIFT 9 /* CHIP_GT150_EINT */
692#define WM8400_CHIP_GT150_EINT_WIDTH 1 /* CHIP_GT150_EINT */
693#define WM8400_CHIP_GT115_EINT 0x0100 /* CHIP_GT115_EINT */
694#define WM8400_CHIP_GT115_EINT_MASK 0x0100 /* CHIP_GT115_EINT */
695#define WM8400_CHIP_GT115_EINT_SHIFT 8 /* CHIP_GT115_EINT */
696#define WM8400_CHIP_GT115_EINT_WIDTH 1 /* CHIP_GT115_EINT */
697#define WM8400_LINE_CMP_EINT 0x0080 /* LINE_CMP_EINT */
698#define WM8400_LINE_CMP_EINT_MASK 0x0080 /* LINE_CMP_EINT */
699#define WM8400_LINE_CMP_EINT_SHIFT 7 /* LINE_CMP_EINT */
700#define WM8400_LINE_CMP_EINT_WIDTH 1 /* LINE_CMP_EINT */
701#define WM8400_UVLO_EINT 0x0040 /* UVLO_EINT */
702#define WM8400_UVLO_EINT_MASK 0x0040 /* UVLO_EINT */
703#define WM8400_UVLO_EINT_SHIFT 6 /* UVLO_EINT */
704#define WM8400_UVLO_EINT_WIDTH 1 /* UVLO_EINT */
705#define WM8400_DC2_UV_EINT 0x0020 /* DC2_UV_EINT */
706#define WM8400_DC2_UV_EINT_MASK 0x0020 /* DC2_UV_EINT */
707#define WM8400_DC2_UV_EINT_SHIFT 5 /* DC2_UV_EINT */
708#define WM8400_DC2_UV_EINT_WIDTH 1 /* DC2_UV_EINT */
709#define WM8400_DC1_UV_EINT 0x0010 /* DC1_UV_EINT */
710#define WM8400_DC1_UV_EINT_MASK 0x0010 /* DC1_UV_EINT */
711#define WM8400_DC1_UV_EINT_SHIFT 4 /* DC1_UV_EINT */
712#define WM8400_DC1_UV_EINT_WIDTH 1 /* DC1_UV_EINT */
713#define WM8400_LDO4_UV_EINT 0x0008 /* LDO4_UV_EINT */
714#define WM8400_LDO4_UV_EINT_MASK 0x0008 /* LDO4_UV_EINT */
715#define WM8400_LDO4_UV_EINT_SHIFT 3 /* LDO4_UV_EINT */
716#define WM8400_LDO4_UV_EINT_WIDTH 1 /* LDO4_UV_EINT */
717#define WM8400_LDO3_UV_EINT 0x0004 /* LDO3_UV_EINT */
718#define WM8400_LDO3_UV_EINT_MASK 0x0004 /* LDO3_UV_EINT */
719#define WM8400_LDO3_UV_EINT_SHIFT 2 /* LDO3_UV_EINT */
720#define WM8400_LDO3_UV_EINT_WIDTH 1 /* LDO3_UV_EINT */
721#define WM8400_LDO2_UV_EINT 0x0002 /* LDO2_UV_EINT */
722#define WM8400_LDO2_UV_EINT_MASK 0x0002 /* LDO2_UV_EINT */
723#define WM8400_LDO2_UV_EINT_SHIFT 1 /* LDO2_UV_EINT */
724#define WM8400_LDO2_UV_EINT_WIDTH 1 /* LDO2_UV_EINT */
725#define WM8400_LDO1_UV_EINT 0x0001 /* LDO1_UV_EINT */
726#define WM8400_LDO1_UV_EINT_MASK 0x0001 /* LDO1_UV_EINT */
727#define WM8400_LDO1_UV_EINT_SHIFT 0 /* LDO1_UV_EINT */
728#define WM8400_LDO1_UV_EINT_WIDTH 1 /* LDO1_UV_EINT */
729
730/*
731 * R80 (0x50) - Interrupt Status 1 Mask
732 */
733#define WM8400_IM_MICD_CINT 0x8000 /* IM_MICD_CINT */
734#define WM8400_IM_MICD_CINT_MASK 0x8000 /* IM_MICD_CINT */
735#define WM8400_IM_MICD_CINT_SHIFT 15 /* IM_MICD_CINT */
736#define WM8400_IM_MICD_CINT_WIDTH 1 /* IM_MICD_CINT */
737#define WM8400_IM_MICSCD_CINT 0x4000 /* IM_MICSCD_CINT */
738#define WM8400_IM_MICSCD_CINT_MASK 0x4000 /* IM_MICSCD_CINT */
739#define WM8400_IM_MICSCD_CINT_SHIFT 14 /* IM_MICSCD_CINT */
740#define WM8400_IM_MICSCD_CINT_WIDTH 1 /* IM_MICSCD_CINT */
741#define WM8400_IM_JDL_CINT 0x2000 /* IM_JDL_CINT */
742#define WM8400_IM_JDL_CINT_MASK 0x2000 /* IM_JDL_CINT */
743#define WM8400_IM_JDL_CINT_SHIFT 13 /* IM_JDL_CINT */
744#define WM8400_IM_JDL_CINT_WIDTH 1 /* IM_JDL_CINT */
745#define WM8400_IM_JDR_CINT 0x1000 /* IM_JDR_CINT */
746#define WM8400_IM_JDR_CINT_MASK 0x1000 /* IM_JDR_CINT */
747#define WM8400_IM_JDR_CINT_SHIFT 12 /* IM_JDR_CINT */
748#define WM8400_IM_JDR_CINT_WIDTH 1 /* IM_JDR_CINT */
749#define WM8400_IM_CODEC_SEQ_END_EINT 0x0800 /* IM_CODEC_SEQ_END_EINT */
750#define WM8400_IM_CODEC_SEQ_END_EINT_MASK 0x0800 /* IM_CODEC_SEQ_END_EINT */
751#define WM8400_IM_CODEC_SEQ_END_EINT_SHIFT 11 /* IM_CODEC_SEQ_END_EINT */
752#define WM8400_IM_CODEC_SEQ_END_EINT_WIDTH 1 /* IM_CODEC_SEQ_END_EINT */
753#define WM8400_IM_CDEL_TO_EINT 0x0400 /* IM_CDEL_TO_EINT */
754#define WM8400_IM_CDEL_TO_EINT_MASK 0x0400 /* IM_CDEL_TO_EINT */
755#define WM8400_IM_CDEL_TO_EINT_SHIFT 10 /* IM_CDEL_TO_EINT */
756#define WM8400_IM_CDEL_TO_EINT_WIDTH 1 /* IM_CDEL_TO_EINT */
757#define WM8400_IM_CHIP_GT150_EINT 0x0200 /* IM_CHIP_GT150_EINT */
758#define WM8400_IM_CHIP_GT150_EINT_MASK 0x0200 /* IM_CHIP_GT150_EINT */
759#define WM8400_IM_CHIP_GT150_EINT_SHIFT 9 /* IM_CHIP_GT150_EINT */
760#define WM8400_IM_CHIP_GT150_EINT_WIDTH 1 /* IM_CHIP_GT150_EINT */
761#define WM8400_IM_CHIP_GT115_EINT 0x0100 /* IM_CHIP_GT115_EINT */
762#define WM8400_IM_CHIP_GT115_EINT_MASK 0x0100 /* IM_CHIP_GT115_EINT */
763#define WM8400_IM_CHIP_GT115_EINT_SHIFT 8 /* IM_CHIP_GT115_EINT */
764#define WM8400_IM_CHIP_GT115_EINT_WIDTH 1 /* IM_CHIP_GT115_EINT */
765#define WM8400_IM_LINE_CMP_EINT 0x0080 /* IM_LINE_CMP_EINT */
766#define WM8400_IM_LINE_CMP_EINT_MASK 0x0080 /* IM_LINE_CMP_EINT */
767#define WM8400_IM_LINE_CMP_EINT_SHIFT 7 /* IM_LINE_CMP_EINT */
768#define WM8400_IM_LINE_CMP_EINT_WIDTH 1 /* IM_LINE_CMP_EINT */
769#define WM8400_IM_UVLO_EINT 0x0040 /* IM_UVLO_EINT */
770#define WM8400_IM_UVLO_EINT_MASK 0x0040 /* IM_UVLO_EINT */
771#define WM8400_IM_UVLO_EINT_SHIFT 6 /* IM_UVLO_EINT */
772#define WM8400_IM_UVLO_EINT_WIDTH 1 /* IM_UVLO_EINT */
773#define WM8400_IM_DC2_UV_EINT 0x0020 /* IM_DC2_UV_EINT */
774#define WM8400_IM_DC2_UV_EINT_MASK 0x0020 /* IM_DC2_UV_EINT */
775#define WM8400_IM_DC2_UV_EINT_SHIFT 5 /* IM_DC2_UV_EINT */
776#define WM8400_IM_DC2_UV_EINT_WIDTH 1 /* IM_DC2_UV_EINT */
777#define WM8400_IM_DC1_UV_EINT 0x0010 /* IM_DC1_UV_EINT */
778#define WM8400_IM_DC1_UV_EINT_MASK 0x0010 /* IM_DC1_UV_EINT */
779#define WM8400_IM_DC1_UV_EINT_SHIFT 4 /* IM_DC1_UV_EINT */
780#define WM8400_IM_DC1_UV_EINT_WIDTH 1 /* IM_DC1_UV_EINT */
781#define WM8400_IM_LDO4_UV_EINT 0x0008 /* IM_LDO4_UV_EINT */
782#define WM8400_IM_LDO4_UV_EINT_MASK 0x0008 /* IM_LDO4_UV_EINT */
783#define WM8400_IM_LDO4_UV_EINT_SHIFT 3 /* IM_LDO4_UV_EINT */
784#define WM8400_IM_LDO4_UV_EINT_WIDTH 1 /* IM_LDO4_UV_EINT */
785#define WM8400_IM_LDO3_UV_EINT 0x0004 /* IM_LDO3_UV_EINT */
786#define WM8400_IM_LDO3_UV_EINT_MASK 0x0004 /* IM_LDO3_UV_EINT */
787#define WM8400_IM_LDO3_UV_EINT_SHIFT 2 /* IM_LDO3_UV_EINT */
788#define WM8400_IM_LDO3_UV_EINT_WIDTH 1 /* IM_LDO3_UV_EINT */
789#define WM8400_IM_LDO2_UV_EINT 0x0002 /* IM_LDO2_UV_EINT */
790#define WM8400_IM_LDO2_UV_EINT_MASK 0x0002 /* IM_LDO2_UV_EINT */
791#define WM8400_IM_LDO2_UV_EINT_SHIFT 1 /* IM_LDO2_UV_EINT */
792#define WM8400_IM_LDO2_UV_EINT_WIDTH 1 /* IM_LDO2_UV_EINT */
793#define WM8400_IM_LDO1_UV_EINT 0x0001 /* IM_LDO1_UV_EINT */
794#define WM8400_IM_LDO1_UV_EINT_MASK 0x0001 /* IM_LDO1_UV_EINT */
795#define WM8400_IM_LDO1_UV_EINT_SHIFT 0 /* IM_LDO1_UV_EINT */
796#define WM8400_IM_LDO1_UV_EINT_WIDTH 1 /* IM_LDO1_UV_EINT */
797
798/*
799 * R81 (0x51) - Interrupt Levels
800 */
801#define WM8400_MICD_LVL 0x8000 /* MICD_LVL */
802#define WM8400_MICD_LVL_MASK 0x8000 /* MICD_LVL */
803#define WM8400_MICD_LVL_SHIFT 15 /* MICD_LVL */
804#define WM8400_MICD_LVL_WIDTH 1 /* MICD_LVL */
805#define WM8400_MICSCD_LVL 0x4000 /* MICSCD_LVL */
806#define WM8400_MICSCD_LVL_MASK 0x4000 /* MICSCD_LVL */
807#define WM8400_MICSCD_LVL_SHIFT 14 /* MICSCD_LVL */
808#define WM8400_MICSCD_LVL_WIDTH 1 /* MICSCD_LVL */
809#define WM8400_JDL_LVL 0x2000 /* JDL_LVL */
810#define WM8400_JDL_LVL_MASK 0x2000 /* JDL_LVL */
811#define WM8400_JDL_LVL_SHIFT 13 /* JDL_LVL */
812#define WM8400_JDL_LVL_WIDTH 1 /* JDL_LVL */
813#define WM8400_JDR_LVL 0x1000 /* JDR_LVL */
814#define WM8400_JDR_LVL_MASK 0x1000 /* JDR_LVL */
815#define WM8400_JDR_LVL_SHIFT 12 /* JDR_LVL */
816#define WM8400_JDR_LVL_WIDTH 1 /* JDR_LVL */
817#define WM8400_CODEC_SEQ_END_LVL 0x0800 /* CODEC_SEQ_END_LVL */
818#define WM8400_CODEC_SEQ_END_LVL_MASK 0x0800 /* CODEC_SEQ_END_LVL */
819#define WM8400_CODEC_SEQ_END_LVL_SHIFT 11 /* CODEC_SEQ_END_LVL */
820#define WM8400_CODEC_SEQ_END_LVL_WIDTH 1 /* CODEC_SEQ_END_LVL */
821#define WM8400_CDEL_TO_LVL 0x0400 /* CDEL_TO_LVL */
822#define WM8400_CDEL_TO_LVL_MASK 0x0400 /* CDEL_TO_LVL */
823#define WM8400_CDEL_TO_LVL_SHIFT 10 /* CDEL_TO_LVL */
824#define WM8400_CDEL_TO_LVL_WIDTH 1 /* CDEL_TO_LVL */
825#define WM8400_CHIP_GT150_LVL 0x0200 /* CHIP_GT150_LVL */
826#define WM8400_CHIP_GT150_LVL_MASK 0x0200 /* CHIP_GT150_LVL */
827#define WM8400_CHIP_GT150_LVL_SHIFT 9 /* CHIP_GT150_LVL */
828#define WM8400_CHIP_GT150_LVL_WIDTH 1 /* CHIP_GT150_LVL */
829#define WM8400_CHIP_GT115_LVL 0x0100 /* CHIP_GT115_LVL */
830#define WM8400_CHIP_GT115_LVL_MASK 0x0100 /* CHIP_GT115_LVL */
831#define WM8400_CHIP_GT115_LVL_SHIFT 8 /* CHIP_GT115_LVL */
832#define WM8400_CHIP_GT115_LVL_WIDTH 1 /* CHIP_GT115_LVL */
833#define WM8400_LINE_CMP_LVL 0x0080 /* LINE_CMP_LVL */
834#define WM8400_LINE_CMP_LVL_MASK 0x0080 /* LINE_CMP_LVL */
835#define WM8400_LINE_CMP_LVL_SHIFT 7 /* LINE_CMP_LVL */
836#define WM8400_LINE_CMP_LVL_WIDTH 1 /* LINE_CMP_LVL */
837#define WM8400_UVLO_LVL 0x0040 /* UVLO_LVL */
838#define WM8400_UVLO_LVL_MASK 0x0040 /* UVLO_LVL */
839#define WM8400_UVLO_LVL_SHIFT 6 /* UVLO_LVL */
840#define WM8400_UVLO_LVL_WIDTH 1 /* UVLO_LVL */
841#define WM8400_DC2_UV_LVL 0x0020 /* DC2_UV_LVL */
842#define WM8400_DC2_UV_LVL_MASK 0x0020 /* DC2_UV_LVL */
843#define WM8400_DC2_UV_LVL_SHIFT 5 /* DC2_UV_LVL */
844#define WM8400_DC2_UV_LVL_WIDTH 1 /* DC2_UV_LVL */
845#define WM8400_DC1_UV_LVL 0x0010 /* DC1_UV_LVL */
846#define WM8400_DC1_UV_LVL_MASK 0x0010 /* DC1_UV_LVL */
847#define WM8400_DC1_UV_LVL_SHIFT 4 /* DC1_UV_LVL */
848#define WM8400_DC1_UV_LVL_WIDTH 1 /* DC1_UV_LVL */
849#define WM8400_LDO4_UV_LVL 0x0008 /* LDO4_UV_LVL */
850#define WM8400_LDO4_UV_LVL_MASK 0x0008 /* LDO4_UV_LVL */
851#define WM8400_LDO4_UV_LVL_SHIFT 3 /* LDO4_UV_LVL */
852#define WM8400_LDO4_UV_LVL_WIDTH 1 /* LDO4_UV_LVL */
853#define WM8400_LDO3_UV_LVL 0x0004 /* LDO3_UV_LVL */
854#define WM8400_LDO3_UV_LVL_MASK 0x0004 /* LDO3_UV_LVL */
855#define WM8400_LDO3_UV_LVL_SHIFT 2 /* LDO3_UV_LVL */
856#define WM8400_LDO3_UV_LVL_WIDTH 1 /* LDO3_UV_LVL */
857#define WM8400_LDO2_UV_LVL 0x0002 /* LDO2_UV_LVL */
858#define WM8400_LDO2_UV_LVL_MASK 0x0002 /* LDO2_UV_LVL */
859#define WM8400_LDO2_UV_LVL_SHIFT 1 /* LDO2_UV_LVL */
860#define WM8400_LDO2_UV_LVL_WIDTH 1 /* LDO2_UV_LVL */
861#define WM8400_LDO1_UV_LVL 0x0001 /* LDO1_UV_LVL */
862#define WM8400_LDO1_UV_LVL_MASK 0x0001 /* LDO1_UV_LVL */
863#define WM8400_LDO1_UV_LVL_SHIFT 0 /* LDO1_UV_LVL */
864#define WM8400_LDO1_UV_LVL_WIDTH 1 /* LDO1_UV_LVL */
865
866/*
867 * R82 (0x52) - Shutdown Reason
868 */
869#define WM8400_SDR_CHIP_SOFTSD 0x2000 /* SDR_CHIP_SOFTSD */
870#define WM8400_SDR_CHIP_SOFTSD_MASK 0x2000 /* SDR_CHIP_SOFTSD */
871#define WM8400_SDR_CHIP_SOFTSD_SHIFT 13 /* SDR_CHIP_SOFTSD */
872#define WM8400_SDR_CHIP_SOFTSD_WIDTH 1 /* SDR_CHIP_SOFTSD */
873#define WM8400_SDR_NPDN 0x0800 /* SDR_NPDN */
874#define WM8400_SDR_NPDN_MASK 0x0800 /* SDR_NPDN */
875#define WM8400_SDR_NPDN_SHIFT 11 /* SDR_NPDN */
876#define WM8400_SDR_NPDN_WIDTH 1 /* SDR_NPDN */
877#define WM8400_SDR_CHIP_GT150 0x0200 /* SDR_CHIP_GT150 */
878#define WM8400_SDR_CHIP_GT150_MASK 0x0200 /* SDR_CHIP_GT150 */
879#define WM8400_SDR_CHIP_GT150_SHIFT 9 /* SDR_CHIP_GT150 */
880#define WM8400_SDR_CHIP_GT150_WIDTH 1 /* SDR_CHIP_GT150 */
881#define WM8400_SDR_CHIP_GT115 0x0100 /* SDR_CHIP_GT115 */
882#define WM8400_SDR_CHIP_GT115_MASK 0x0100 /* SDR_CHIP_GT115 */
883#define WM8400_SDR_CHIP_GT115_SHIFT 8 /* SDR_CHIP_GT115 */
884#define WM8400_SDR_CHIP_GT115_WIDTH 1 /* SDR_CHIP_GT115 */
885#define WM8400_SDR_LINE_CMP 0x0080 /* SDR_LINE_CMP */
886#define WM8400_SDR_LINE_CMP_MASK 0x0080 /* SDR_LINE_CMP */
887#define WM8400_SDR_LINE_CMP_SHIFT 7 /* SDR_LINE_CMP */
888#define WM8400_SDR_LINE_CMP_WIDTH 1 /* SDR_LINE_CMP */
889#define WM8400_SDR_UVLO 0x0040 /* SDR_UVLO */
890#define WM8400_SDR_UVLO_MASK 0x0040 /* SDR_UVLO */
891#define WM8400_SDR_UVLO_SHIFT 6 /* SDR_UVLO */
892#define WM8400_SDR_UVLO_WIDTH 1 /* SDR_UVLO */
893#define WM8400_SDR_DC2_UV 0x0020 /* SDR_DC2_UV */
894#define WM8400_SDR_DC2_UV_MASK 0x0020 /* SDR_DC2_UV */
895#define WM8400_SDR_DC2_UV_SHIFT 5 /* SDR_DC2_UV */
896#define WM8400_SDR_DC2_UV_WIDTH 1 /* SDR_DC2_UV */
897#define WM8400_SDR_DC1_UV 0x0010 /* SDR_DC1_UV */
898#define WM8400_SDR_DC1_UV_MASK 0x0010 /* SDR_DC1_UV */
899#define WM8400_SDR_DC1_UV_SHIFT 4 /* SDR_DC1_UV */
900#define WM8400_SDR_DC1_UV_WIDTH 1 /* SDR_DC1_UV */
901#define WM8400_SDR_LDO4_UV 0x0008 /* SDR_LDO4_UV */
902#define WM8400_SDR_LDO4_UV_MASK 0x0008 /* SDR_LDO4_UV */
903#define WM8400_SDR_LDO4_UV_SHIFT 3 /* SDR_LDO4_UV */
904#define WM8400_SDR_LDO4_UV_WIDTH 1 /* SDR_LDO4_UV */
905#define WM8400_SDR_LDO3_UV 0x0004 /* SDR_LDO3_UV */
906#define WM8400_SDR_LDO3_UV_MASK 0x0004 /* SDR_LDO3_UV */
907#define WM8400_SDR_LDO3_UV_SHIFT 2 /* SDR_LDO3_UV */
908#define WM8400_SDR_LDO3_UV_WIDTH 1 /* SDR_LDO3_UV */
909#define WM8400_SDR_LDO2_UV 0x0002 /* SDR_LDO2_UV */
910#define WM8400_SDR_LDO2_UV_MASK 0x0002 /* SDR_LDO2_UV */
911#define WM8400_SDR_LDO2_UV_SHIFT 1 /* SDR_LDO2_UV */
912#define WM8400_SDR_LDO2_UV_WIDTH 1 /* SDR_LDO2_UV */
913#define WM8400_SDR_LDO1_UV 0x0001 /* SDR_LDO1_UV */
914#define WM8400_SDR_LDO1_UV_MASK 0x0001 /* SDR_LDO1_UV */
915#define WM8400_SDR_LDO1_UV_SHIFT 0 /* SDR_LDO1_UV */
916#define WM8400_SDR_LDO1_UV_WIDTH 1 /* SDR_LDO1_UV */
917
918/*
919 * R84 (0x54) - Line Circuits
920 */
921#define WM8400_BG_LINE_COMP 0x8000 /* BG_LINE_COMP */
922#define WM8400_BG_LINE_COMP_MASK 0x8000 /* BG_LINE_COMP */
923#define WM8400_BG_LINE_COMP_SHIFT 15 /* BG_LINE_COMP */
924#define WM8400_BG_LINE_COMP_WIDTH 1 /* BG_LINE_COMP */
925#define WM8400_LINE_CMP_VTHI_MASK 0x00F0 /* LINE_CMP_VTHI - [7:4] */
926#define WM8400_LINE_CMP_VTHI_SHIFT 4 /* LINE_CMP_VTHI - [7:4] */
927#define WM8400_LINE_CMP_VTHI_WIDTH 4 /* LINE_CMP_VTHI - [7:4] */
928#define WM8400_LINE_CMP_VTHD_MASK 0x000F /* LINE_CMP_VTHD - [3:0] */
929#define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */
930#define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */
931
932u16 wm8400_reg_read(struct wm8400 *wm8400, u8 reg);
933int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data);
934int wm8400_set_bits(struct wm8400 *wm8400, u8 reg, u16 mask, u16 val);
935
936#endif
diff --git a/include/linux/mfd/wm8400.h b/include/linux/mfd/wm8400.h
new file mode 100644
index 000000000000..b46b566ac1ac
--- /dev/null
+++ b/include/linux/mfd/wm8400.h
@@ -0,0 +1,40 @@
1/*
2 * wm8400 client interface
3 *
4 * Copyright 2008 Wolfson Microelectronics plc
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __LINUX_MFD_WM8400_H
22#define __LINUX_MFD_WM8400_H
23
24#include <linux/regulator/machine.h>
25
26#define WM8400_LDO1 0
27#define WM8400_LDO2 1
28#define WM8400_LDO3 2
29#define WM8400_LDO4 3
30#define WM8400_DCDC1 4
31#define WM8400_DCDC2 5
32
33struct wm8400_platform_data {
34 int (*platform_init)(struct device *dev);
35};
36
37int wm8400_register_regulator(struct device *dev, int reg,
38 struct regulator_init_data *initdata);
39
40#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 03aea612d284..3f34005068d4 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -7,7 +7,6 @@
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 8
9#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
10extern int isolate_lru_page(struct page *p, struct list_head *pagelist);
11extern int putback_lru_pages(struct list_head *l); 10extern int putback_lru_pages(struct list_head *l);
12extern int migrate_page(struct address_space *, 11extern int migrate_page(struct address_space *,
13 struct page *, struct page *); 12 struct page *, struct page *);
@@ -21,8 +20,6 @@ extern int migrate_vmas(struct mm_struct *mm,
21 const nodemask_t *from, const nodemask_t *to, 20 const nodemask_t *from, const nodemask_t *to,
22 unsigned long flags); 21 unsigned long flags);
23#else 22#else
24static inline int isolate_lru_page(struct page *p, struct list_head *list)
25 { return -ENOSYS; }
26static inline int putback_lru_pages(struct list_head *l) { return 0; } 23static inline int putback_lru_pages(struct list_head *l) { return 0; }
27static inline int migrate_pages(struct list_head *l, new_page_t x, 24static inline int migrate_pages(struct list_head *l, new_page_t x,
28 unsigned long private) { return -ENOSYS; } 25 unsigned long private) { return -ENOSYS; }
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 77323a72dd3c..cf9c679ab38b 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -132,6 +132,15 @@ enum {
132 MLX4_MAILBOX_SIZE = 4096 132 MLX4_MAILBOX_SIZE = 4096
133}; 133};
134 134
135enum {
136 /* set port opcode modifiers */
137 MLX4_SET_PORT_GENERAL = 0x0,
138 MLX4_SET_PORT_RQP_CALC = 0x1,
139 MLX4_SET_PORT_MAC_TABLE = 0x2,
140 MLX4_SET_PORT_VLAN_TABLE = 0x3,
141 MLX4_SET_PORT_PRIO_MAP = 0x4,
142};
143
135struct mlx4_dev; 144struct mlx4_dev;
136 145
137struct mlx4_cmd_mailbox { 146struct mlx4_cmd_mailbox {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index b2f944468313..bd9977b89490 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -60,6 +60,7 @@ enum {
60 MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, 60 MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7,
61 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, 61 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8,
62 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, 62 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9,
63 MLX4_DEV_CAP_FLAG_DPDP = 1 << 12,
63 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, 64 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16,
64 MLX4_DEV_CAP_FLAG_APM = 1 << 17, 65 MLX4_DEV_CAP_FLAG_APM = 1 << 17,
65 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, 66 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18,
@@ -145,6 +146,29 @@ enum {
145 MLX4_MTT_FLAG_PRESENT = 1 146 MLX4_MTT_FLAG_PRESENT = 1
146}; 147};
147 148
149enum mlx4_qp_region {
150 MLX4_QP_REGION_FW = 0,
151 MLX4_QP_REGION_ETH_ADDR,
152 MLX4_QP_REGION_FC_ADDR,
153 MLX4_QP_REGION_FC_EXCH,
154 MLX4_NUM_QP_REGION
155};
156
157enum mlx4_port_type {
158 MLX4_PORT_TYPE_IB = 1 << 0,
159 MLX4_PORT_TYPE_ETH = 1 << 1,
160};
161
162enum mlx4_special_vlan_idx {
163 MLX4_NO_VLAN_IDX = 0,
164 MLX4_VLAN_MISS_IDX,
165 MLX4_VLAN_REGULAR
166};
167
168enum {
169 MLX4_NUM_FEXCH = 64 * 1024,
170};
171
148static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 172static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
149{ 173{
150 return (major << 32) | (minor << 16) | subminor; 174 return (major << 32) | (minor << 16) | subminor;
@@ -154,7 +178,9 @@ struct mlx4_caps {
154 u64 fw_ver; 178 u64 fw_ver;
155 int num_ports; 179 int num_ports;
156 int vl_cap[MLX4_MAX_PORTS + 1]; 180 int vl_cap[MLX4_MAX_PORTS + 1];
157 int mtu_cap[MLX4_MAX_PORTS + 1]; 181 int ib_mtu_cap[MLX4_MAX_PORTS + 1];
182 u64 def_mac[MLX4_MAX_PORTS + 1];
183 int eth_mtu_cap[MLX4_MAX_PORTS + 1];
158 int gid_table_len[MLX4_MAX_PORTS + 1]; 184 int gid_table_len[MLX4_MAX_PORTS + 1];
159 int pkey_table_len[MLX4_MAX_PORTS + 1]; 185 int pkey_table_len[MLX4_MAX_PORTS + 1];
160 int local_ca_ack_delay; 186 int local_ca_ack_delay;
@@ -169,7 +195,6 @@ struct mlx4_caps {
169 int max_rq_desc_sz; 195 int max_rq_desc_sz;
170 int max_qp_init_rdma; 196 int max_qp_init_rdma;
171 int max_qp_dest_rdma; 197 int max_qp_dest_rdma;
172 int reserved_qps;
173 int sqp_start; 198 int sqp_start;
174 int num_srqs; 199 int num_srqs;
175 int max_srq_wqes; 200 int max_srq_wqes;
@@ -201,6 +226,15 @@ struct mlx4_caps {
201 u16 stat_rate_support; 226 u16 stat_rate_support;
202 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 227 u8 port_width_cap[MLX4_MAX_PORTS + 1];
203 int max_gso_sz; 228 int max_gso_sz;
229 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
230 int reserved_qps;
231 int reserved_qps_base[MLX4_NUM_QP_REGION];
232 int log_num_macs;
233 int log_num_vlans;
234 int log_num_prios;
235 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
236 u8 supported_type[MLX4_MAX_PORTS + 1];
237 u32 port_mask;
204}; 238};
205 239
206struct mlx4_buf_list { 240struct mlx4_buf_list {
@@ -355,6 +389,11 @@ struct mlx4_init_port_param {
355 u64 si_guid; 389 u64 si_guid;
356}; 390};
357 391
392#define mlx4_foreach_port(port, dev, type) \
393 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
394 if (((type) == MLX4_PORT_TYPE_IB ? (dev)->caps.port_mask : \
395 ~(dev)->caps.port_mask) & 1 << ((port) - 1))
396
358int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 397int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
359 struct mlx4_buf *buf); 398 struct mlx4_buf *buf);
360void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 399void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
@@ -400,7 +439,10 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
400 int collapsed); 439 int collapsed);
401void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 440void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
402 441
403int mlx4_qp_alloc(struct mlx4_dev *dev, int sqpn, struct mlx4_qp *qp); 442int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
443void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
444
445int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp);
404void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 446void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
405 447
406int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt, 448int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, struct mlx4_mtt *mtt,
@@ -416,6 +458,12 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
416 int block_mcast_loopback); 458 int block_mcast_loopback);
417int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]); 459int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16]);
418 460
461int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index);
462void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index);
463
464int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
465void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
466
419int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list, 467int mlx4_map_phys_fmr(struct mlx4_dev *dev, struct mlx4_fmr *fmr, u64 *page_list,
420 int npages, u64 iova, u32 *lkey, u32 *rkey); 468 int npages, u64 iova, u32 *lkey, u32 *rkey);
421int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages, 469int mlx4_fmr_alloc(struct mlx4_dev *dev, u32 pd, u32 access, int max_pages,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 72a15dc26bbf..ffee2f743418 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/mmdebug.h>
10#include <linux/mmzone.h> 11#include <linux/mmzone.h>
11#include <linux/rbtree.h> 12#include <linux/rbtree.h>
12#include <linux/prio_tree.h> 13#include <linux/prio_tree.h>
@@ -131,6 +132,11 @@ extern unsigned int kobjsize(const void *objp);
131#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ) 132#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
132 133
133/* 134/*
135 * special vmas that are non-mergable, non-mlock()able
136 */
137#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)
138
139/*
134 * mapping from the currently active vm_flags protection bits (the 140 * mapping from the currently active vm_flags protection bits (the
135 * low four bits) to a page protection mask.. 141 * low four bits) to a page protection mask..
136 */ 142 */
@@ -219,12 +225,6 @@ struct inode;
219 */ 225 */
220#include <linux/page-flags.h> 226#include <linux/page-flags.h>
221 227
222#ifdef CONFIG_DEBUG_VM
223#define VM_BUG_ON(cond) BUG_ON(cond)
224#else
225#define VM_BUG_ON(condition) do { } while(0)
226#endif
227
228/* 228/*
229 * Methods to modify the page usage count. 229 * Methods to modify the page usage count.
230 * 230 *
@@ -705,10 +705,10 @@ static inline int page_mapped(struct page *page)
705extern void show_free_areas(void); 705extern void show_free_areas(void);
706 706
707#ifdef CONFIG_SHMEM 707#ifdef CONFIG_SHMEM
708int shmem_lock(struct file *file, int lock, struct user_struct *user); 708extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
709#else 709#else
710static inline int shmem_lock(struct file *file, int lock, 710static inline int shmem_lock(struct file *file, int lock,
711 struct user_struct *user) 711 struct user_struct *user)
712{ 712{
713 return 0; 713 return 0;
714} 714}
@@ -919,7 +919,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
919} 919}
920#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ 920#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
921 921
922#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 922#if USE_SPLIT_PTLOCKS
923/* 923/*
924 * We tuck a spinlock to guard each pagetable page into its struct page, 924 * We tuck a spinlock to guard each pagetable page into its struct page,
925 * at page->private, with BUILD_BUG_ON to make sure that this will not 925 * at page->private, with BUILD_BUG_ON to make sure that this will not
@@ -932,14 +932,14 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
932} while (0) 932} while (0)
933#define pte_lock_deinit(page) ((page)->mapping = NULL) 933#define pte_lock_deinit(page) ((page)->mapping = NULL)
934#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) 934#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));})
935#else 935#else /* !USE_SPLIT_PTLOCKS */
936/* 936/*
937 * We use mm->page_table_lock to guard all pagetable pages of the mm. 937 * We use mm->page_table_lock to guard all pagetable pages of the mm.
938 */ 938 */
939#define pte_lock_init(page) do {} while (0) 939#define pte_lock_init(page) do {} while (0)
940#define pte_lock_deinit(page) do {} while (0) 940#define pte_lock_deinit(page) do {} while (0)
941#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) 941#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;})
942#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 942#endif /* USE_SPLIT_PTLOCKS */
943 943
944static inline void pgtable_page_ctor(struct page *page) 944static inline void pgtable_page_ctor(struct page *page)
945{ 945{
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 895bc4e93039..c948350c378e 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -1,40 +1,100 @@
1static inline void 1#ifndef LINUX_MM_INLINE_H
2add_page_to_active_list(struct zone *zone, struct page *page) 2#define LINUX_MM_INLINE_H
3{
4 list_add(&page->lru, &zone->active_list);
5 __inc_zone_state(zone, NR_ACTIVE);
6}
7 3
8static inline void 4/**
9add_page_to_inactive_list(struct zone *zone, struct page *page) 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test
7 *
8 * Returns LRU_FILE if @page is page cache page backed by a regular filesystem,
9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
10 * Used by functions that manipulate the LRU lists, to sort a page
11 * onto the right LRU list.
12 *
13 * We would like to get this info without a page flag, but the state
14 * needs to survive until the page is last deleted from the LRU, which
15 * could be as far down as __page_cache_release.
16 */
17static inline int page_is_file_cache(struct page *page)
10{ 18{
11 list_add(&page->lru, &zone->inactive_list); 19 if (PageSwapBacked(page))
12 __inc_zone_state(zone, NR_INACTIVE); 20 return 0;
21
22 /* The page is page cache backed by a normal filesystem. */
23 return LRU_FILE;
13} 24}
14 25
15static inline void 26static inline void
16del_page_from_active_list(struct zone *zone, struct page *page) 27add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
17{ 28{
18 list_del(&page->lru); 29 list_add(&page->lru, &zone->lru[l].list);
19 __dec_zone_state(zone, NR_ACTIVE); 30 __inc_zone_state(zone, NR_LRU_BASE + l);
20} 31}
21 32
22static inline void 33static inline void
23del_page_from_inactive_list(struct zone *zone, struct page *page) 34del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
24{ 35{
25 list_del(&page->lru); 36 list_del(&page->lru);
26 __dec_zone_state(zone, NR_INACTIVE); 37 __dec_zone_state(zone, NR_LRU_BASE + l);
27} 38}
28 39
29static inline void 40static inline void
30del_page_from_lru(struct zone *zone, struct page *page) 41del_page_from_lru(struct zone *zone, struct page *page)
31{ 42{
43 enum lru_list l = LRU_BASE;
44
32 list_del(&page->lru); 45 list_del(&page->lru);
33 if (PageActive(page)) { 46 if (PageUnevictable(page)) {
34 __ClearPageActive(page); 47 __ClearPageUnevictable(page);
35 __dec_zone_state(zone, NR_ACTIVE); 48 l = LRU_UNEVICTABLE;
36 } else { 49 } else {
37 __dec_zone_state(zone, NR_INACTIVE); 50 if (PageActive(page)) {
51 __ClearPageActive(page);
52 l += LRU_ACTIVE;
53 }
54 l += page_is_file_cache(page);
55 }
56 __dec_zone_state(zone, NR_LRU_BASE + l);
57}
58
59/**
60 * page_lru - which LRU list should a page be on?
61 * @page: the page to test
62 *
63 * Returns the LRU list a page should be on, as an index
64 * into the array of LRU lists.
65 */
66static inline enum lru_list page_lru(struct page *page)
67{
68 enum lru_list lru = LRU_BASE;
69
70 if (PageUnevictable(page))
71 lru = LRU_UNEVICTABLE;
72 else {
73 if (PageActive(page))
74 lru += LRU_ACTIVE;
75 lru += page_is_file_cache(page);
38 } 76 }
77
78 return lru;
39} 79}
40 80
81/**
82 * inactive_anon_is_low - check if anonymous pages need to be deactivated
83 * @zone: zone to check
84 *
85 * Returns true if the zone does not have enough inactive anon pages,
86 * meaning some active anon pages need to be deactivated.
87 */
88static inline int inactive_anon_is_low(struct zone *zone)
89{
90 unsigned long active, inactive;
91
92 active = zone_page_state(zone, NR_ACTIVE_ANON);
93 inactive = zone_page_state(zone, NR_INACTIVE_ANON);
94
95 if (inactive * zone->inactive_ratio < active)
96 return 1;
97
98 return 0;
99}
100#endif
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index bf334138c7c1..fe825471d5aa 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -21,11 +21,13 @@
21 21
22struct address_space; 22struct address_space;
23 23
24#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 24#define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
25
26#if USE_SPLIT_PTLOCKS
25typedef atomic_long_t mm_counter_t; 27typedef atomic_long_t mm_counter_t;
26#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 28#else /* !USE_SPLIT_PTLOCKS */
27typedef unsigned long mm_counter_t; 29typedef unsigned long mm_counter_t;
28#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 30#endif /* !USE_SPLIT_PTLOCKS */
29 31
30/* 32/*
31 * Each physical page in the system has a struct page associated with 33 * Each physical page in the system has a struct page associated with
@@ -65,7 +67,7 @@ struct page {
65 * see PAGE_MAPPING_ANON below. 67 * see PAGE_MAPPING_ANON below.
66 */ 68 */
67 }; 69 };
68#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 70#if USE_SPLIT_PTLOCKS
69 spinlock_t ptl; 71 spinlock_t ptl;
70#endif 72#endif
71 struct kmem_cache *slab; /* SLUB: Pointer to slab */ 73 struct kmem_cache *slab; /* SLUB: Pointer to slab */
@@ -92,9 +94,6 @@ struct page {
92 void *virtual; /* Kernel virtual address (NULL if 94 void *virtual; /* Kernel virtual address (NULL if
93 not kmapped, ie. highmem) */ 95 not kmapped, ie. highmem) */
94#endif /* WANT_PAGE_VIRTUAL */ 96#endif /* WANT_PAGE_VIRTUAL */
95#ifdef CONFIG_CGROUP_MEM_RES_CTLR
96 unsigned long page_cgroup;
97#endif
98}; 97};
99 98
100/* 99/*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 9c288c909878..bde891f64591 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -65,7 +65,7 @@ struct mmc_host_ops {
65 * -ENOSYS when not supported (equal to NULL callback) 65 * -ENOSYS when not supported (equal to NULL callback)
66 * or a negative errno value when something bad happened 66 * or a negative errno value when something bad happened
67 * 67 *
68 * Return values for the get_ro callback should be: 68 * Return values for the get_cd callback should be:
69 * 0 for a absent card 69 * 0 for a absent card
70 * 1 for a present card 70 * 1 for a present card
71 * -ENOSYS when not supported (equal to NULL callback) 71 * -ENOSYS when not supported (equal to NULL callback)
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
new file mode 100644
index 000000000000..8a5509877192
--- /dev/null
+++ b/include/linux/mmdebug.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1
3
4#include <linux/autoconf.h>
5
6#ifdef CONFIG_DEBUG_VM
7#define VM_BUG_ON(cond) BUG_ON(cond)
8#else
9#define VM_BUG_ON(cond) do { } while (0)
10#endif
11
12#ifdef CONFIG_DEBUG_VIRTUAL
13#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
14#else
15#define VIRTUAL_BUG_ON(cond) do { } while (0)
16#endif
17
18#endif
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index 61d19e1b7a0b..139d7c88d9c9 100644
--- a/include/linux/mmiotrace.h
+++ b/include/linux/mmiotrace.h
@@ -34,11 +34,15 @@ extern void unregister_kmmio_probe(struct kmmio_probe *p);
34/* Called from page fault handler. */ 34/* Called from page fault handler. */
35extern int kmmio_handler(struct pt_regs *regs, unsigned long addr); 35extern int kmmio_handler(struct pt_regs *regs, unsigned long addr);
36 36
37/* Called from ioremap.c */
38#ifdef CONFIG_MMIOTRACE 37#ifdef CONFIG_MMIOTRACE
38/* Called from ioremap.c */
39extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size, 39extern void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
40 void __iomem *addr); 40 void __iomem *addr);
41extern void mmiotrace_iounmap(volatile void __iomem *addr); 41extern void mmiotrace_iounmap(volatile void __iomem *addr);
42
43/* For anyone to insert markers. Remember trailing newline. */
44extern int mmiotrace_printk(const char *fmt, ...)
45 __attribute__ ((format (printf, 1, 2)));
42#else 46#else
43static inline void mmiotrace_ioremap(resource_size_t offset, 47static inline void mmiotrace_ioremap(resource_size_t offset,
44 unsigned long size, void __iomem *addr) 48 unsigned long size, void __iomem *addr)
@@ -48,15 +52,22 @@ static inline void mmiotrace_ioremap(resource_size_t offset,
48static inline void mmiotrace_iounmap(volatile void __iomem *addr) 52static inline void mmiotrace_iounmap(volatile void __iomem *addr)
49{ 53{
50} 54}
51#endif /* CONFIG_MMIOTRACE_HOOKS */ 55
56static inline int mmiotrace_printk(const char *fmt, ...)
57 __attribute__ ((format (printf, 1, 0)));
58
59static inline int mmiotrace_printk(const char *fmt, ...)
60{
61 return 0;
62}
63#endif /* CONFIG_MMIOTRACE */
52 64
53enum mm_io_opcode { 65enum mm_io_opcode {
54 MMIO_READ = 0x1, /* struct mmiotrace_rw */ 66 MMIO_READ = 0x1, /* struct mmiotrace_rw */
55 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */ 67 MMIO_WRITE = 0x2, /* struct mmiotrace_rw */
56 MMIO_PROBE = 0x3, /* struct mmiotrace_map */ 68 MMIO_PROBE = 0x3, /* struct mmiotrace_map */
57 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */ 69 MMIO_UNPROBE = 0x4, /* struct mmiotrace_map */
58 MMIO_MARKER = 0x5, /* raw char data */ 70 MMIO_UNKNOWN_OP = 0x5, /* struct mmiotrace_rw */
59 MMIO_UNKNOWN_OP = 0x6, /* struct mmiotrace_rw */
60}; 71};
61 72
62struct mmiotrace_rw { 73struct mmiotrace_rw {
@@ -81,5 +92,6 @@ extern void enable_mmiotrace(void);
81extern void disable_mmiotrace(void); 92extern void disable_mmiotrace(void);
82extern void mmio_trace_rw(struct mmiotrace_rw *rw); 93extern void mmio_trace_rw(struct mmiotrace_rw *rw);
83extern void mmio_trace_mapping(struct mmiotrace_map *map); 94extern void mmio_trace_mapping(struct mmiotrace_map *map);
95extern int mmio_trace_printk(const char *fmt, va_list args);
84 96
85#endif /* MMIOTRACE_H */ 97#endif /* MMIOTRACE_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 428328a05fa1..35a7b5e19465 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -81,21 +81,31 @@ struct zone_padding {
81enum zone_stat_item { 81enum zone_stat_item {
82 /* First 128 byte cacheline (assuming 64 bit words) */ 82 /* First 128 byte cacheline (assuming 64 bit words) */
83 NR_FREE_PAGES, 83 NR_FREE_PAGES,
84 NR_INACTIVE, 84 NR_LRU_BASE,
85 NR_ACTIVE, 85 NR_INACTIVE_ANON = NR_LRU_BASE, /* must match order of LRU_[IN]ACTIVE */
86 NR_ACTIVE_ANON, /* " " " " " */
87 NR_INACTIVE_FILE, /* " " " " " */
88 NR_ACTIVE_FILE, /* " " " " " */
89#ifdef CONFIG_UNEVICTABLE_LRU
90 NR_UNEVICTABLE, /* " " " " " */
91 NR_MLOCK, /* mlock()ed pages found and moved off LRU */
92#else
93 NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */
94 NR_MLOCK = NR_ACTIVE_FILE,
95#endif
86 NR_ANON_PAGES, /* Mapped anonymous pages */ 96 NR_ANON_PAGES, /* Mapped anonymous pages */
87 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 97 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
88 only modified from process context */ 98 only modified from process context */
89 NR_FILE_PAGES, 99 NR_FILE_PAGES,
90 NR_FILE_DIRTY, 100 NR_FILE_DIRTY,
91 NR_WRITEBACK, 101 NR_WRITEBACK,
92 /* Second 128 byte cacheline */
93 NR_SLAB_RECLAIMABLE, 102 NR_SLAB_RECLAIMABLE,
94 NR_SLAB_UNRECLAIMABLE, 103 NR_SLAB_UNRECLAIMABLE,
95 NR_PAGETABLE, /* used for pagetables */ 104 NR_PAGETABLE, /* used for pagetables */
96 NR_UNSTABLE_NFS, /* NFS unstable pages */ 105 NR_UNSTABLE_NFS, /* NFS unstable pages */
97 NR_BOUNCE, 106 NR_BOUNCE,
98 NR_VMSCAN_WRITE, 107 NR_VMSCAN_WRITE,
108 /* Second 128 byte cacheline */
99 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ 109 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
100#ifdef CONFIG_NUMA 110#ifdef CONFIG_NUMA
101 NUMA_HIT, /* allocated in intended node */ 111 NUMA_HIT, /* allocated in intended node */
@@ -107,6 +117,55 @@ enum zone_stat_item {
107#endif 117#endif
108 NR_VM_ZONE_STAT_ITEMS }; 118 NR_VM_ZONE_STAT_ITEMS };
109 119
120/*
121 * We do arithmetic on the LRU lists in various places in the code,
122 * so it is important to keep the active lists LRU_ACTIVE higher in
123 * the array than the corresponding inactive lists, and to keep
124 * the *_FILE lists LRU_FILE higher than the corresponding _ANON lists.
125 *
126 * This has to be kept in sync with the statistics in zone_stat_item
127 * above and the descriptions in vmstat_text in mm/vmstat.c
128 */
129#define LRU_BASE 0
130#define LRU_ACTIVE 1
131#define LRU_FILE 2
132
133enum lru_list {
134 LRU_INACTIVE_ANON = LRU_BASE,
135 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
136 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
137 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
138#ifdef CONFIG_UNEVICTABLE_LRU
139 LRU_UNEVICTABLE,
140#else
141 LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */
142#endif
143 NR_LRU_LISTS
144};
145
146#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++)
147
148#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++)
149
150static inline int is_file_lru(enum lru_list l)
151{
152 return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE);
153}
154
155static inline int is_active_lru(enum lru_list l)
156{
157 return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE);
158}
159
160static inline int is_unevictable_lru(enum lru_list l)
161{
162#ifdef CONFIG_UNEVICTABLE_LRU
163 return (l == LRU_UNEVICTABLE);
164#else
165 return 0;
166#endif
167}
168
110struct per_cpu_pages { 169struct per_cpu_pages {
111 int count; /* number of pages in the list */ 170 int count; /* number of pages in the list */
112 int high; /* high watermark, emptying needed */ 171 int high; /* high watermark, emptying needed */
@@ -251,10 +310,22 @@ struct zone {
251 310
252 /* Fields commonly accessed by the page reclaim scanner */ 311 /* Fields commonly accessed by the page reclaim scanner */
253 spinlock_t lru_lock; 312 spinlock_t lru_lock;
254 struct list_head active_list; 313 struct {
255 struct list_head inactive_list; 314 struct list_head list;
256 unsigned long nr_scan_active; 315 unsigned long nr_scan;
257 unsigned long nr_scan_inactive; 316 } lru[NR_LRU_LISTS];
317
318 /*
319 * The pageout code in vmscan.c keeps track of how many of the
320 * mem/swap backed and file backed pages are refeferenced.
321 * The higher the rotated/scanned ratio, the more valuable
322 * that cache is.
323 *
324 * The anon LRU stats live in [0], file LRU stats in [1]
325 */
326 unsigned long recent_rotated[2];
327 unsigned long recent_scanned[2];
328
258 unsigned long pages_scanned; /* since last reclaim */ 329 unsigned long pages_scanned; /* since last reclaim */
259 unsigned long flags; /* zone flags, see below */ 330 unsigned long flags; /* zone flags, see below */
260 331
@@ -276,6 +347,12 @@ struct zone {
276 */ 347 */
277 int prev_priority; 348 int prev_priority;
278 349
350 /*
351 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
352 * this zone's LRU. Maintained by the pageout code.
353 */
354 unsigned int inactive_ratio;
355
279 356
280 ZONE_PADDING(_pad2_) 357 ZONE_PADDING(_pad2_)
281 /* Rarely used or read-mostly fields */ 358 /* Rarely used or read-mostly fields */
@@ -524,8 +601,11 @@ typedef struct pglist_data {
524 struct zone node_zones[MAX_NR_ZONES]; 601 struct zone node_zones[MAX_NR_ZONES];
525 struct zonelist node_zonelists[MAX_ZONELISTS]; 602 struct zonelist node_zonelists[MAX_ZONELISTS];
526 int nr_zones; 603 int nr_zones;
527#ifdef CONFIG_FLAT_NODE_MEM_MAP 604#ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */
528 struct page *node_mem_map; 605 struct page *node_mem_map;
606#ifdef CONFIG_CGROUP_MEM_RES_CTLR
607 struct page_cgroup *node_page_cgroup;
608#endif
529#endif 609#endif
530 struct bootmem_data *bdata; 610 struct bootmem_data *bdata;
531#ifdef CONFIG_MEMORY_HOTPLUG 611#ifdef CONFIG_MEMORY_HOTPLUG
@@ -854,6 +934,7 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
854#endif 934#endif
855 935
856struct page; 936struct page;
937struct page_cgroup;
857struct mem_section { 938struct mem_section {
858 /* 939 /*
859 * This is, logically, a pointer to an array of struct 940 * This is, logically, a pointer to an array of struct
@@ -871,6 +952,14 @@ struct mem_section {
871 952
872 /* See declaration of similar field in struct zone */ 953 /* See declaration of similar field in struct zone */
873 unsigned long *pageblock_flags; 954 unsigned long *pageblock_flags;
955#ifdef CONFIG_CGROUP_MEM_RES_CTLR
956 /*
957 * If !SPARSEMEM, pgdat doesn't have page_cgroup pointer. We use
958 * section. (see memcontrol.h/page_cgroup.h about this.)
959 */
960 struct page_cgroup *page_cgroup;
961 unsigned long pad;
962#endif
874}; 963};
875 964
876#ifdef CONFIG_SPARSEMEM_EXTREME 965#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index c4db5827963d..eb71b45fdf5a 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0)
135
136struct hid_device_id {
137 __u16 bus;
138 __u32 vendor;
139 __u32 product;
140 kernel_ulong_t driver_data
141 __attribute__((aligned(sizeof(kernel_ulong_t))));
142};
143
134/* s390 CCW devices */ 144/* s390 CCW devices */
135struct ccw_device_id { 145struct ccw_device_id {
136 __u16 match_flags; /* which fields to match against */ 146 __u16 match_flags; /* which fields to match against */
@@ -274,7 +284,7 @@ struct pcmcia_device_id {
274/* Input */ 284/* Input */
275#define INPUT_DEVICE_ID_EV_MAX 0x1f 285#define INPUT_DEVICE_ID_EV_MAX 0x1f
276#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 286#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
277#define INPUT_DEVICE_ID_KEY_MAX 0x1ff 287#define INPUT_DEVICE_ID_KEY_MAX 0x2ff
278#define INPUT_DEVICE_ID_REL_MAX 0x0f 288#define INPUT_DEVICE_ID_REL_MAX 0x0f
279#define INPUT_DEVICE_ID_ABS_MAX 0x3f 289#define INPUT_DEVICE_ID_ABS_MAX 0x3f
280#define INPUT_DEVICE_ID_MSC_MAX 0x07 290#define INPUT_DEVICE_ID_MSC_MAX 0x07
@@ -388,5 +398,52 @@ struct i2c_device_id {
388 __attribute__((aligned(sizeof(kernel_ulong_t)))); 398 __attribute__((aligned(sizeof(kernel_ulong_t))));
389}; 399};
390 400
401/* dmi */
402enum dmi_field {
403 DMI_NONE,
404 DMI_BIOS_VENDOR,
405 DMI_BIOS_VERSION,
406 DMI_BIOS_DATE,
407 DMI_SYS_VENDOR,
408 DMI_PRODUCT_NAME,
409 DMI_PRODUCT_VERSION,
410 DMI_PRODUCT_SERIAL,
411 DMI_PRODUCT_UUID,
412 DMI_BOARD_VENDOR,
413 DMI_BOARD_NAME,
414 DMI_BOARD_VERSION,
415 DMI_BOARD_SERIAL,
416 DMI_BOARD_ASSET_TAG,
417 DMI_CHASSIS_VENDOR,
418 DMI_CHASSIS_TYPE,
419 DMI_CHASSIS_VERSION,
420 DMI_CHASSIS_SERIAL,
421 DMI_CHASSIS_ASSET_TAG,
422 DMI_STRING_MAX,
423};
424
425struct dmi_strmatch {
426 unsigned char slot;
427 char substr[79];
428};
429
430#ifndef __KERNEL__
431struct dmi_system_id {
432 kernel_ulong_t callback;
433 kernel_ulong_t ident;
434 struct dmi_strmatch matches[4];
435 kernel_ulong_t driver_data
436 __attribute__((aligned(sizeof(kernel_ulong_t))));
437};
438#else
439struct dmi_system_id {
440 int (*callback)(const struct dmi_system_id *);
441 const char *ident;
442 struct dmi_strmatch matches[4];
443 void *driver_data;
444};
445#endif
446
447#define DMI_MATCH(a, b) { a, b }
391 448
392#endif /* LINUX_MOD_DEVICETABLE_H */ 449#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 68e09557c951..3bfed013350b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/marker.h> 18#include <linux/marker.h>
19#include <linux/tracepoint.h>
19#include <asm/local.h> 20#include <asm/local.h>
20 21
21#include <asm/module.h> 22#include <asm/module.h>
@@ -28,7 +29,7 @@
28#define MODULE_SYMBOL_PREFIX "" 29#define MODULE_SYMBOL_PREFIX ""
29#endif 30#endif
30 31
31#define MODULE_NAME_LEN (64 - sizeof(unsigned long)) 32#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
32 33
33struct kernel_symbol 34struct kernel_symbol
34{ 35{
@@ -59,6 +60,7 @@ struct module_kobject
59 struct kobject kobj; 60 struct kobject kobj;
60 struct module *mod; 61 struct module *mod;
61 struct kobject *drivers_dir; 62 struct kobject *drivers_dir;
63 struct module_param_attrs *mp;
62}; 64};
63 65
64/* These are either module local, or the kernel's dummy ones. */ 66/* These are either module local, or the kernel's dummy ones. */
@@ -241,7 +243,6 @@ struct module
241 243
242 /* Sysfs stuff. */ 244 /* Sysfs stuff. */
243 struct module_kobject mkobj; 245 struct module_kobject mkobj;
244 struct module_param_attrs *param_attrs;
245 struct module_attribute *modinfo_attrs; 246 struct module_attribute *modinfo_attrs;
246 const char *version; 247 const char *version;
247 const char *srcversion; 248 const char *srcversion;
@@ -276,7 +277,7 @@ struct module
276 277
277 /* Exception table */ 278 /* Exception table */
278 unsigned int num_exentries; 279 unsigned int num_exentries;
279 const struct exception_table_entry *extable; 280 struct exception_table_entry *extable;
280 281
281 /* Startup function. */ 282 /* Startup function. */
282 int (*init)(void); 283 int (*init)(void);
@@ -331,6 +332,10 @@ struct module
331 struct marker *markers; 332 struct marker *markers;
332 unsigned int num_markers; 333 unsigned int num_markers;
333#endif 334#endif
335#ifdef CONFIG_TRACEPOINTS
336 struct tracepoint *tracepoints;
337 unsigned int num_tracepoints;
338#endif
334 339
335#ifdef CONFIG_MODULE_UNLOAD 340#ifdef CONFIG_MODULE_UNLOAD
336 /* What modules depend on me? */ 341 /* What modules depend on me? */
@@ -345,7 +350,6 @@ struct module
345 /* Reference counts */ 350 /* Reference counts */
346 struct module_ref ref[NR_CPUS]; 351 struct module_ref ref[NR_CPUS];
347#endif 352#endif
348
349}; 353};
350#ifndef MODULE_ARCH_INIT 354#ifndef MODULE_ARCH_INIT
351#define MODULE_ARCH_INIT {} 355#define MODULE_ARCH_INIT {}
@@ -454,6 +458,9 @@ extern void print_modules(void);
454 458
455extern void module_update_markers(void); 459extern void module_update_markers(void);
456 460
461extern void module_update_tracepoints(void);
462extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
463
457#else /* !CONFIG_MODULES... */ 464#else /* !CONFIG_MODULES... */
458#define EXPORT_SYMBOL(sym) 465#define EXPORT_SYMBOL(sym)
459#define EXPORT_SYMBOL_GPL(sym) 466#define EXPORT_SYMBOL_GPL(sym)
@@ -558,6 +565,15 @@ static inline void module_update_markers(void)
558{ 565{
559} 566}
560 567
568static inline void module_update_tracepoints(void)
569{
570}
571
572static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
573{
574 return 0;
575}
576
561#endif /* CONFIG_MODULES */ 577#endif /* CONFIG_MODULES */
562 578
563struct device_driver; 579struct device_driver;
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index ec624381c844..e4af3399ef48 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -13,6 +13,9 @@
13#define MODULE_PARAM_PREFIX KBUILD_MODNAME "." 13#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
14#endif 14#endif
15 15
16/* Chosen so that structs with an unsigned long line up. */
17#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
18
16#ifdef MODULE 19#ifdef MODULE
17#define ___module_cat(a,b) __mod_ ## a ## b 20#define ___module_cat(a,b) __mod_ ## a ## b
18#define __module_cat(a,b) ___module_cat(a,b) 21#define __module_cat(a,b) ___module_cat(a,b)
@@ -79,7 +82,8 @@ struct kparam_array
79#define __module_param_call(prefix, name, set, get, arg, perm) \ 82#define __module_param_call(prefix, name, set, get, arg, perm) \
80 /* Default value instead of permissions? */ \ 83 /* Default value instead of permissions? */ \
81 static int __param_perm_check_##name __attribute__((unused)) = \ 84 static int __param_perm_check_##name __attribute__((unused)) = \
82 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 85 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
86 + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
83 static const char __param_str_##name[] = prefix #name; \ 87 static const char __param_str_##name[] = prefix #name; \
84 static struct kernel_param __moduleparam_const __param_##name \ 88 static struct kernel_param __moduleparam_const __param_##name \
85 __used \ 89 __used \
@@ -100,6 +104,25 @@ struct kparam_array
100#define module_param(name, type, perm) \ 104#define module_param(name, type, perm) \
101 module_param_named(name, name, type, perm) 105 module_param_named(name, name, type, perm)
102 106
107#ifndef MODULE
108/**
109 * core_param - define a historical core kernel parameter.
110 * @name: the name of the cmdline and sysfs parameter (often the same as var)
111 * @var: the variable
112 * @type: the type (for param_set_##type and param_get_##type)
113 * @perm: visibility in sysfs
114 *
115 * core_param is just like module_param(), but cannot be modular and
116 * doesn't add a prefix (such as "printk."). This is for compatibility
117 * with __setup(), and it makes sense as truly core parameters aren't
118 * tied to the particular file they're in.
119 */
120#define core_param(name, var, type, perm) \
121 param_check_##type(name, &(var)); \
122 __module_param_call("", name, param_set_##type, param_get_##type, \
123 &var, perm)
124#endif /* !MODULE */
125
103/* Actually copy string: maxlen param is usually sizeof(string). */ 126/* Actually copy string: maxlen param is usually sizeof(string). */
104#define module_param_string(name, string, len, perm) \ 127#define module_param_string(name, string, len, perm) \
105 static const struct kparam_string __param_string_##name \ 128 static const struct kparam_string __param_string_##name \
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 30a1d63b6fb5..cab2a85e2ee8 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -5,8 +5,6 @@
5 * 5 *
6 * Author: Marco van Wieringen <mvw@planets.elm.net> 6 * Author: Marco van Wieringen <mvw@planets.elm.net>
7 * 7 *
8 * Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
9 *
10 */ 8 */
11#ifndef _LINUX_MOUNT_H 9#ifndef _LINUX_MOUNT_H
12#define _LINUX_MOUNT_H 10#define _LINUX_MOUNT_H
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 310e61606415..8b4aa0523db7 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -41,6 +41,8 @@ struct mtd_blktrans_ops {
41 unsigned long block, char *buffer); 41 unsigned long block, char *buffer);
42 int (*writesect)(struct mtd_blktrans_dev *dev, 42 int (*writesect)(struct mtd_blktrans_dev *dev,
43 unsigned long block, char *buffer); 43 unsigned long block, char *buffer);
44 int (*discard)(struct mtd_blktrans_dev *dev,
45 unsigned long block, unsigned nr_blocks);
44 46
45 /* Block layer ioctls */ 47 /* Block layer ioctls */
46 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); 48 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d6fb115f5a07..ee5124ec319e 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -12,6 +12,7 @@
12#include <linux/mtd/flashchip.h> 12#include <linux/mtd/flashchip.h>
13#include <linux/mtd/map.h> 13#include <linux/mtd/map.h>
14#include <linux/mtd/cfi_endian.h> 14#include <linux/mtd/cfi_endian.h>
15#include <linux/mtd/xip.h>
15 16
16#ifdef CONFIG_MTD_CFI_I1 17#ifdef CONFIG_MTD_CFI_I1
17#define cfi_interleave(cfi) 1 18#define cfi_interleave(cfi) 1
@@ -430,7 +431,6 @@ static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t
430{ 431{
431 map_word val; 432 map_word val;
432 uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type); 433 uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type);
433
434 val = cfi_build_cmd(cmd, map, cfi); 434 val = cfi_build_cmd(cmd, map, cfi);
435 435
436 if (prev_val) 436 if (prev_val)
@@ -483,6 +483,13 @@ static inline void cfi_udelay(int us)
483 } 483 }
484} 484}
485 485
486int __xipram cfi_qry_present(struct map_info *map, __u32 base,
487 struct cfi_private *cfi);
488int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map,
489 struct cfi_private *cfi);
490void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map,
491 struct cfi_private *cfi);
492
486struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, 493struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,
487 const char* name); 494 const char* name);
488struct cfi_fixup { 495struct cfi_fixup {
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index 08dd131301c1..d4f38c5fd44e 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -73,6 +73,10 @@ struct flchip {
73 int buffer_write_time; 73 int buffer_write_time;
74 int erase_time; 74 int erase_time;
75 75
76 int word_write_time_max;
77 int buffer_write_time_max;
78 int erase_time_max;
79
76 void *priv; 80 void *priv;
77}; 81};
78 82
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 922636548558..eae26bb6430a 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -25,8 +25,10 @@
25#define MTD_ERASE_DONE 0x08 25#define MTD_ERASE_DONE 0x08
26#define MTD_ERASE_FAILED 0x10 26#define MTD_ERASE_FAILED 0x10
27 27
28#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff
29
28/* If the erase fails, fail_addr might indicate exactly which block failed. If 30/* If the erase fails, fail_addr might indicate exactly which block failed. If
29 fail_addr = 0xffffffff, the failure was not at the device level or was not 31 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
30 specific to any particular block. */ 32 specific to any particular block. */
31struct erase_info { 33struct erase_info {
32 struct mtd_info *mtd; 34 struct mtd_info *mtd;
diff --git a/include/linux/mtd/nand-gpio.h b/include/linux/mtd/nand-gpio.h
new file mode 100644
index 000000000000..51534e50f7fc
--- /dev/null
+++ b/include/linux/mtd/nand-gpio.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_MTD_NAND_GPIO_H
2#define __LINUX_MTD_NAND_GPIO_H
3
4#include <linux/mtd/nand.h>
5
6struct gpio_nand_platdata {
7 int gpio_nce;
8 int gpio_nwp;
9 int gpio_cle;
10 int gpio_ale;
11 int gpio_rdy;
12 void (*adjust_parts)(struct gpio_nand_platdata *, size_t);
13 struct mtd_partition *parts;
14 unsigned int num_parts;
15 unsigned int options;
16 int chip_delay;
17};
18
19#endif
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 81774e5facf4..733d3f3b4eb8 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -248,6 +248,7 @@ struct nand_hw_control {
248 * @read_page_raw: function to read a raw page without ECC 248 * @read_page_raw: function to read a raw page without ECC
249 * @write_page_raw: function to write a raw page without ECC 249 * @write_page_raw: function to write a raw page without ECC
250 * @read_page: function to read a page according to the ecc generator requirements 250 * @read_page: function to read a page according to the ecc generator requirements
251 * @read_subpage: function to read parts of the page covered by ECC.
251 * @write_page: function to write a page according to the ecc generator requirements 252 * @write_page: function to write a page according to the ecc generator requirements
252 * @read_oob: function to read chip OOB data 253 * @read_oob: function to read chip OOB data
253 * @write_oob: function to write chip OOB data 254 * @write_oob: function to write chip OOB data
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index d1b310c92eb4..0c6bbe28f38c 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -152,6 +152,8 @@
152#define ONENAND_SYS_CFG1_INT (1 << 6) 152#define ONENAND_SYS_CFG1_INT (1 << 6)
153#define ONENAND_SYS_CFG1_IOBE (1 << 5) 153#define ONENAND_SYS_CFG1_IOBE (1 << 5)
154#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) 154#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4)
155#define ONENAND_SYS_CFG1_HF (1 << 2)
156#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1)
155 157
156/* 158/*
157 * Controller Status Register F240h (R) 159 * Controller Status Register F240h (R)
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 5014f7a9f5df..c92b4d439609 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -73,7 +73,6 @@ struct device;
73struct device_node; 73struct device_node;
74 74
75int __devinit of_mtd_parse_partitions(struct device *dev, 75int __devinit of_mtd_parse_partitions(struct device *dev,
76 struct mtd_info *mtd,
77 struct device_node *node, 76 struct device_node *node,
78 struct mtd_partition **pparts); 77 struct mtd_partition **pparts);
79 78
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
new file mode 100644
index 000000000000..e77c1cea404d
--- /dev/null
+++ b/include/linux/mtd/sh_flctl.h
@@ -0,0 +1,125 @@
1/*
2 * SuperH FLCTL nand controller
3 *
4 * Copyright © 2008 Renesas Solutions Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef __SH_FLCTL_H__
21#define __SH_FLCTL_H__
22
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h>
25#include <linux/mtd/partitions.h>
26
27/* FLCTL registers */
28#define FLCMNCR(f) (f->reg + 0x0)
29#define FLCMDCR(f) (f->reg + 0x4)
30#define FLCMCDR(f) (f->reg + 0x8)
31#define FLADR(f) (f->reg + 0xC)
32#define FLADR2(f) (f->reg + 0x3C)
33#define FLDATAR(f) (f->reg + 0x10)
34#define FLDTCNTR(f) (f->reg + 0x14)
35#define FLINTDMACR(f) (f->reg + 0x18)
36#define FLBSYTMR(f) (f->reg + 0x1C)
37#define FLBSYCNT(f) (f->reg + 0x20)
38#define FLDTFIFO(f) (f->reg + 0x24)
39#define FLECFIFO(f) (f->reg + 0x28)
40#define FLTRCR(f) (f->reg + 0x2C)
41#define FL4ECCRESULT0(f) (f->reg + 0x80)
42#define FL4ECCRESULT1(f) (f->reg + 0x84)
43#define FL4ECCRESULT2(f) (f->reg + 0x88)
44#define FL4ECCRESULT3(f) (f->reg + 0x8C)
45#define FL4ECCCR(f) (f->reg + 0x90)
46#define FL4ECCCNT(f) (f->reg + 0x94)
47#define FLERRADR(f) (f->reg + 0x98)
48
49/* FLCMNCR control bits */
50#define ECCPOS2 (0x1 << 25)
51#define _4ECCCNTEN (0x1 << 24)
52#define _4ECCEN (0x1 << 23)
53#define _4ECCCORRECT (0x1 << 22)
54#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/
55#define QTSEL_E (0x1 << 17)
56#define ENDIAN (0x1 << 16) /* 1 = little endian */
57#define FCKSEL_E (0x1 << 15)
58#define ECCPOS_00 (0x00 << 12)
59#define ECCPOS_01 (0x01 << 12)
60#define ECCPOS_02 (0x02 << 12)
61#define ACM_SACCES_MODE (0x01 << 10)
62#define NANWF_E (0x1 << 9)
63#define SE_D (0x1 << 8) /* Spare area disable */
64#define CE1_ENABLE (0x1 << 4) /* Chip Enable 1 */
65#define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */
66#define TYPESEL_SET (0x1 << 0)
67
68/* FLCMDCR control bits */
69#define ADRCNT2_E (0x1 << 31) /* 5byte address enable */
70#define ADRMD_E (0x1 << 26) /* Sector address access */
71#define CDSRC_E (0x1 << 25) /* Data buffer selection */
72#define DOSR_E (0x1 << 24) /* Status read check */
73#define SELRW (0x1 << 21) /* 0:read 1:write */
74#define DOADR_E (0x1 << 20) /* Address stage execute */
75#define ADRCNT_1 (0x00 << 18) /* Address data bytes: 1byte */
76#define ADRCNT_2 (0x01 << 18) /* Address data bytes: 2byte */
77#define ADRCNT_3 (0x02 << 18) /* Address data bytes: 3byte */
78#define ADRCNT_4 (0x03 << 18) /* Address data bytes: 4byte */
79#define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */
80#define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */
81
82/* FLTRCR control bits */
83#define TRSTRT (0x1 << 0) /* translation start */
84#define TREND (0x1 << 1) /* translation end */
85
86/* FL4ECCCR control bits */
87#define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */
88#define _4ECCEND (0x1 << 1) /* 4 symbols end */
89#define _4ECCEXST (0x1 << 0) /* 4 symbols exist */
90
91#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
92#define LOOP_TIMEOUT_MAX 0x00010000
93
94#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd)
95
96struct sh_flctl {
97 struct mtd_info mtd;
98 struct nand_chip chip;
99 void __iomem *reg;
100
101 uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
102 int read_bytes;
103 int index;
104 int seqin_column; /* column in SEQIN cmd */
105 int seqin_page_addr; /* page_addr in SEQIN cmd */
106 uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */
107 int erase1_page_addr; /* page_addr in ERASE1 cmd */
108 uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */
109 uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */
110
111 int hwecc_cant_correct[4];
112
113 unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */
114 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */
115};
116
117struct sh_flctl_platform_data {
118 struct mtd_partition *parts;
119 int nr_parts;
120 unsigned long flcmncr_val;
121
122 unsigned has_hwecc:1;
123};
124
125#endif /* __SH_FLCTL_H__ */
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 12078577aef6..cbbbe9bfecad 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -17,9 +17,14 @@
17 17
18struct mv643xx_eth_shared_platform_data { 18struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi;
20 unsigned int t_clk; 21 unsigned int t_clk;
21}; 22};
22 23
24#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
25#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
26#define MV643XX_ETH_PHY_NONE 0xff
27
23struct mv643xx_eth_platform_data { 28struct mv643xx_eth_platform_data {
24 /* 29 /*
25 * Pointer back to our parent instance, and our port number. 30 * Pointer back to our parent instance, and our port number.
@@ -30,8 +35,6 @@ struct mv643xx_eth_platform_data {
30 /* 35 /*
31 * Whether a PHY is present, and if yes, at which address. 36 * Whether a PHY is present, and if yes, at which address.
32 */ 37 */
33 struct platform_device *shared_smi;
34 int force_phy_addr;
35 int phy_addr; 38 int phy_addr;
36 39
37 /* 40 /*
@@ -49,10 +52,10 @@ struct mv643xx_eth_platform_data {
49 int duplex; 52 int duplex;
50 53
51 /* 54 /*
52 * Which RX/TX queues to use. 55 * How many RX/TX queues to use.
53 */ 56 */
54 int rx_queue_mask; 57 int rx_queue_count;
55 int tx_queue_mask; 58 int tx_queue_count;
56 59
57 /* 60 /*
58 * Override default RX/TX queue sizes if nonzero. 61 * Override default RX/TX queue sizes if nonzero.
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 68f8c3203c89..99eb80306dc5 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -51,8 +51,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
51/* 51/*
52 * Intent data 52 * Intent data
53 */ 53 */
54#define LOOKUP_OPEN (0x0100) 54#define LOOKUP_OPEN 0x0100
55#define LOOKUP_CREATE (0x0200) 55#define LOOKUP_CREATE 0x0200
56#define LOOKUP_EXCL 0x0400
57#define LOOKUP_RENAME_TARGET 0x0800
56 58
57extern int user_path_at(int, const char __user *, unsigned, struct path *); 59extern int user_path_at(int, const char __user *, unsigned, struct path *);
58 60
@@ -61,6 +63,8 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *);
61#define user_path_dir(name, path) \ 63#define user_path_dir(name, path) \
62 user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path) 64 user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path)
63 65
66extern int kern_path(const char *, unsigned, struct path *);
67
64extern int path_lookup(const char *, unsigned, struct nameidata *); 68extern int path_lookup(const char *, unsigned, struct nameidata *);
65extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 69extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
66 const char *, unsigned int, struct nameidata *); 70 const char *, unsigned int, struct nameidata *);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 488c56e649b5..c8bcb59adfdf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -11,7 +11,7 @@
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * Corey Minyard <wf-rch!minyard@relay.EU.net> 12 * Corey Minyard <wf-rch!minyard@relay.EU.net>
13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov> 13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
14 * Alan Cox, <Alan.Cox@linux.org> 14 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
15 * Bjorn Ekwall. <bj0rn@blox.se> 15 * Bjorn Ekwall. <bj0rn@blox.se>
16 * Pekka Riikonen <priikone@poseidon.pspt.fi> 16 * Pekka Riikonen <priikone@poseidon.pspt.fi>
17 * 17 *
@@ -42,6 +42,7 @@
42#include <linux/workqueue.h> 42#include <linux/workqueue.h>
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h>
45 46
46struct vlan_group; 47struct vlan_group;
47struct ethtool_ops; 48struct ethtool_ops;
@@ -471,6 +472,8 @@ struct net_device
471 char name[IFNAMSIZ]; 472 char name[IFNAMSIZ];
472 /* device name hash chain */ 473 /* device name hash chain */
473 struct hlist_node name_hlist; 474 struct hlist_node name_hlist;
475 /* snmp alias */
476 char *ifalias;
474 477
475 /* 478 /*
476 * I/O specific fields 479 * I/O specific fields
@@ -538,6 +541,14 @@ struct net_device
538#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 541#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
539#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 542#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
540 543
544 /*
545 * If one device supports one of these features, then enable them
546 * for all in netdev_increment_features.
547 */
548#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
549 NETIF_F_SG | NETIF_F_HIGHDMA | \
550 NETIF_F_FRAGLIST)
551
541 /* Interface index. Unique device identifier */ 552 /* Interface index. Unique device identifier */
542 int ifindex; 553 int ifindex;
543 int iflink; 554 int iflink;
@@ -605,6 +616,9 @@ struct net_device
605 616
606 /* Protocol specific pointers */ 617 /* Protocol specific pointers */
607 618
619#ifdef CONFIG_NET_DSA
620 void *dsa_ptr; /* dsa specific data */
621#endif
608 void *atalk_ptr; /* AppleTalk link */ 622 void *atalk_ptr; /* AppleTalk link */
609 void *ip_ptr; /* IPv4 specific data */ 623 void *ip_ptr; /* IPv4 specific data */
610 void *dn_ptr; /* DECnet specific data */ 624 void *dn_ptr; /* DECnet specific data */
@@ -796,6 +810,26 @@ void dev_net_set(struct net_device *dev, struct net *net)
796#endif 810#endif
797} 811}
798 812
813static inline bool netdev_uses_dsa_tags(struct net_device *dev)
814{
815#ifdef CONFIG_NET_DSA_TAG_DSA
816 if (dev->dsa_ptr != NULL)
817 return dsa_uses_dsa_tags(dev->dsa_ptr);
818#endif
819
820 return 0;
821}
822
823static inline bool netdev_uses_trailer_tags(struct net_device *dev)
824{
825#ifdef CONFIG_NET_DSA_TAG_TRAILER
826 if (dev->dsa_ptr != NULL)
827 return dsa_uses_trailer_tags(dev->dsa_ptr);
828#endif
829
830 return 0;
831}
832
799/** 833/**
800 * netdev_priv - access network device private data 834 * netdev_priv - access network device private data
801 * @dev: network device 835 * @dev: network device
@@ -1223,7 +1257,8 @@ extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
1223extern int dev_ethtool(struct net *net, struct ifreq *); 1257extern int dev_ethtool(struct net *net, struct ifreq *);
1224extern unsigned dev_get_flags(const struct net_device *); 1258extern unsigned dev_get_flags(const struct net_device *);
1225extern int dev_change_flags(struct net_device *, unsigned); 1259extern int dev_change_flags(struct net_device *, unsigned);
1226extern int dev_change_name(struct net_device *, char *); 1260extern int dev_change_name(struct net_device *, const char *);
1261extern int dev_set_alias(struct net_device *, const char *, size_t);
1227extern int dev_change_net_namespace(struct net_device *, 1262extern int dev_change_net_namespace(struct net_device *,
1228 struct net *, const char *); 1263 struct net *, const char *);
1229extern int dev_set_mtu(struct net_device *, int); 1264extern int dev_set_mtu(struct net_device *, int);
@@ -1667,11 +1702,13 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
1667extern int netdev_class_create_file(struct class_attribute *class_attr); 1702extern int netdev_class_create_file(struct class_attribute *class_attr);
1668extern void netdev_class_remove_file(struct class_attribute *class_attr); 1703extern void netdev_class_remove_file(struct class_attribute *class_attr);
1669 1704
1670extern char *netdev_drivername(struct net_device *dev, char *buffer, int len); 1705extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
1671 1706
1672extern void linkwatch_run_queue(void); 1707extern void linkwatch_run_queue(void);
1673 1708
1674extern int netdev_compute_features(unsigned long all, unsigned long one); 1709unsigned long netdev_increment_features(unsigned long all, unsigned long one,
1710 unsigned long mask);
1711unsigned long netdev_fix_features(unsigned long features, const char *name);
1675 1712
1676static inline int net_gso_ok(int features, int gso_type) 1713static inline int net_gso_ok(int features, int gso_type)
1677{ 1714{
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0c5eb7ed8b3f..48cfe51bfddc 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -5,13 +5,11 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/skbuff.h> 6#include <linux/skbuff.h>
7#include <linux/net.h> 7#include <linux/net.h>
8#include <linux/netdevice.h>
9#include <linux/if.h> 8#include <linux/if.h>
10#include <linux/in.h> 9#include <linux/in.h>
11#include <linux/in6.h> 10#include <linux/in6.h>
12#include <linux/wait.h> 11#include <linux/wait.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <net/net_namespace.h>
15#endif 13#endif
16#include <linux/types.h> 14#include <linux/types.h>
17#include <linux/compiler.h> 15#include <linux/compiler.h>
@@ -52,6 +50,16 @@ enum nf_inet_hooks {
52 NF_INET_NUMHOOKS 50 NF_INET_NUMHOOKS
53}; 51};
54 52
53enum {
54 NFPROTO_UNSPEC = 0,
55 NFPROTO_IPV4 = 2,
56 NFPROTO_ARP = 3,
57 NFPROTO_BRIDGE = 7,
58 NFPROTO_IPV6 = 10,
59 NFPROTO_DECNET = 12,
60 NFPROTO_NUMPROTO,
61};
62
55union nf_inet_addr { 63union nf_inet_addr {
56 __u32 all[4]; 64 __u32 all[4];
57 __be32 ip; 65 __be32 ip;
@@ -92,8 +100,8 @@ struct nf_hook_ops
92 /* User fills in from here down. */ 100 /* User fills in from here down. */
93 nf_hookfn *hook; 101 nf_hookfn *hook;
94 struct module *owner; 102 struct module *owner;
95 int pf; 103 u_int8_t pf;
96 int hooknum; 104 unsigned int hooknum;
97 /* Hooks are ordered in ascending priority. */ 105 /* Hooks are ordered in ascending priority. */
98 int priority; 106 int priority;
99}; 107};
@@ -102,7 +110,7 @@ struct nf_sockopt_ops
102{ 110{
103 struct list_head list; 111 struct list_head list;
104 112
105 int pf; 113 u_int8_t pf;
106 114
107 /* Non-inclusive ranges: use 0/0/NULL to never get called. */ 115 /* Non-inclusive ranges: use 0/0/NULL to never get called. */
108 int set_optmin; 116 int set_optmin;
@@ -138,9 +146,9 @@ extern struct ctl_path nf_net_netfilter_sysctl_path[];
138extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; 146extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
139#endif /* CONFIG_SYSCTL */ 147#endif /* CONFIG_SYSCTL */
140 148
141extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 149extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
142 150
143int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, 151int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
144 struct net_device *indev, struct net_device *outdev, 152 struct net_device *indev, struct net_device *outdev,
145 int (*okfn)(struct sk_buff *), int thresh); 153 int (*okfn)(struct sk_buff *), int thresh);
146 154
@@ -151,7 +159,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
151 * okfn must be invoked by the caller in this case. Any other return 159 * okfn must be invoked by the caller in this case. Any other return
152 * value indicates the packet has been consumed by the hook. 160 * value indicates the packet has been consumed by the hook.
153 */ 161 */
154static inline int nf_hook_thresh(int pf, unsigned int hook, 162static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
155 struct sk_buff *skb, 163 struct sk_buff *skb,
156 struct net_device *indev, 164 struct net_device *indev,
157 struct net_device *outdev, 165 struct net_device *outdev,
@@ -167,7 +175,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
167 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 175 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
168} 176}
169 177
170static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 178static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
171 struct net_device *indev, struct net_device *outdev, 179 struct net_device *indev, struct net_device *outdev,
172 int (*okfn)(struct sk_buff *)) 180 int (*okfn)(struct sk_buff *))
173{ 181{
@@ -212,14 +220,14 @@ __ret;})
212 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) 220 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
213 221
214/* Call setsockopt() */ 222/* Call setsockopt() */
215int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
216 int len); 224 int len);
217int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, 225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
218 int *len); 226 int *len);
219 227
220int compat_nf_setsockopt(struct sock *sk, int pf, int optval, 228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
221 char __user *opt, int len); 229 char __user *opt, int len);
222int compat_nf_getsockopt(struct sock *sk, int pf, int optval, 230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
223 char __user *opt, int *len); 231 char __user *opt, int *len);
224 232
225/* Call this before modifying an existing packet: ensures it is 233/* Call this before modifying an existing packet: ensures it is
@@ -247,7 +255,7 @@ struct nf_afinfo {
247 int route_key_size; 255 int route_key_size;
248}; 256};
249 257
250extern const struct nf_afinfo *nf_afinfo[NPROTO]; 258extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO];
251static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) 259static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
252{ 260{
253 return rcu_dereference(nf_afinfo[family]); 261 return rcu_dereference(nf_afinfo[family]);
@@ -292,7 +300,7 @@ extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
292extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 300extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
293 301
294static inline void 302static inline void
295nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 303nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
296{ 304{
297#ifdef CONFIG_NF_NAT_NEEDED 305#ifdef CONFIG_NF_NAT_NEEDED
298 void (*decodefn)(struct sk_buff *, struct flowi *); 306 void (*decodefn)(struct sk_buff *, struct flowi *);
@@ -315,7 +323,7 @@ extern struct proc_dir_entry *proc_net_netfilter;
315#else /* !CONFIG_NETFILTER */ 323#else /* !CONFIG_NETFILTER */
316#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 324#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
317#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 325#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
318static inline int nf_hook_thresh(int pf, unsigned int hook, 326static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
319 struct sk_buff *skb, 327 struct sk_buff *skb,
320 struct net_device *indev, 328 struct net_device *indev,
321 struct net_device *outdev, 329 struct net_device *outdev,
@@ -324,7 +332,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
324{ 332{
325 return okfn(skb); 333 return okfn(skb);
326} 334}
327static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 335static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
328 struct net_device *indev, struct net_device *outdev, 336 struct net_device *indev, struct net_device *outdev,
329 int (*okfn)(struct sk_buff *)) 337 int (*okfn)(struct sk_buff *))
330{ 338{
@@ -332,7 +340,9 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
332} 340}
333struct flowi; 341struct flowi;
334static inline void 342static inline void
335nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 343nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
344{
345}
336#endif /*CONFIG_NETFILTER*/ 346#endif /*CONFIG_NETFILTER*/
337 347
338#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 348#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -343,56 +353,5 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
343static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 353static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
344#endif 354#endif
345 355
346static inline struct net *nf_pre_routing_net(const struct net_device *in,
347 const struct net_device *out)
348{
349#ifdef CONFIG_NET_NS
350 return in->nd_net;
351#else
352 return &init_net;
353#endif
354}
355
356static inline struct net *nf_local_in_net(const struct net_device *in,
357 const struct net_device *out)
358{
359#ifdef CONFIG_NET_NS
360 return in->nd_net;
361#else
362 return &init_net;
363#endif
364}
365
366static inline struct net *nf_forward_net(const struct net_device *in,
367 const struct net_device *out)
368{
369#ifdef CONFIG_NET_NS
370 BUG_ON(in->nd_net != out->nd_net);
371 return in->nd_net;
372#else
373 return &init_net;
374#endif
375}
376
377static inline struct net *nf_local_out_net(const struct net_device *in,
378 const struct net_device *out)
379{
380#ifdef CONFIG_NET_NS
381 return out->nd_net;
382#else
383 return &init_net;
384#endif
385}
386
387static inline struct net *nf_post_routing_net(const struct net_device *in,
388 const struct net_device *out)
389{
390#ifdef CONFIG_NET_NS
391 return out->nd_net;
392#else
393 return &init_net;
394#endif
395}
396
397#endif /*__KERNEL__*/ 356#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 357#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 3aff513d12c8..5a8af875bce2 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -32,6 +32,7 @@ header-y += xt_owner.h
32header-y += xt_pkttype.h 32header-y += xt_pkttype.h
33header-y += xt_rateest.h 33header-y += xt_rateest.h
34header-y += xt_realm.h 34header-y += xt_realm.h
35header-y += xt_recent.h
35header-y += xt_sctp.h 36header-y += xt_sctp.h
36header-y += xt_state.h 37header-y += xt_state.h
37header-y += xt_statistic.h 38header-y += xt_statistic.h
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 535e4219d2bb..2a10efda17fb 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -87,7 +87,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
87/* delete keymap entries */ 87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct); 88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89 89
90extern void nf_ct_gre_keymap_flush(void); 90extern void nf_ct_gre_keymap_flush(struct net *net);
91extern void nf_nat_need_gre(void); 91extern void nf_nat_need_gre(void);
92 92
93#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 0d8424f76899..7d8e0455ccac 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -78,6 +78,9 @@ extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 78 int echo);
79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 79extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
80 80
81extern void nfnl_lock(void);
82extern void nfnl_unlock(void);
83
81#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 84#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
82 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 85 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
83 86
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 2326296b6f25..be41b609c88f 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -173,6 +173,98 @@ struct xt_counters_info
173 173
174#include <linux/netdevice.h> 174#include <linux/netdevice.h>
175 175
176/**
177 * struct xt_match_param - parameters for match extensions' match functions
178 *
179 * @in: input netdevice
180 * @out: output netdevice
181 * @match: struct xt_match through which this function was invoked
182 * @matchinfo: per-match data
183 * @fragoff: packet is a fragment, this is the data offset
184 * @thoff: position of transport header relative to skb->data
185 * @hotdrop: drop packet if we had inspection problems
186 * @family: Actual NFPROTO_* through which the function is invoked
187 * (helpful when match->family == NFPROTO_UNSPEC)
188 */
189struct xt_match_param {
190 const struct net_device *in, *out;
191 const struct xt_match *match;
192 const void *matchinfo;
193 int fragoff;
194 unsigned int thoff;
195 bool *hotdrop;
196 u_int8_t family;
197};
198
199/**
200 * struct xt_mtchk_param - parameters for match extensions'
201 * checkentry functions
202 *
203 * @table: table the rule is tried to be inserted into
204 * @entryinfo: the family-specific rule data
205 * (struct ipt_ip, ip6t_ip, ebt_entry)
206 * @match: struct xt_match through which this function was invoked
207 * @matchinfo: per-match data
208 * @hook_mask: via which hooks the new rule is reachable
209 */
210struct xt_mtchk_param {
211 const char *table;
212 const void *entryinfo;
213 const struct xt_match *match;
214 void *matchinfo;
215 unsigned int hook_mask;
216 u_int8_t family;
217};
218
219/* Match destructor parameters */
220struct xt_mtdtor_param {
221 const struct xt_match *match;
222 void *matchinfo;
223 u_int8_t family;
224};
225
226/**
227 * struct xt_target_param - parameters for target extensions' target functions
228 *
229 * @hooknum: hook through which this target was invoked
230 * @target: struct xt_target through which this function was invoked
231 * @targinfo: per-target data
232 *
233 * Other fields see above.
234 */
235struct xt_target_param {
236 const struct net_device *in, *out;
237 unsigned int hooknum;
238 const struct xt_target *target;
239 const void *targinfo;
240 u_int8_t family;
241};
242
243/**
244 * struct xt_tgchk_param - parameters for target extensions'
245 * checkentry functions
246 *
247 * @entryinfo: the family-specific rule data
248 * (struct ipt_entry, ip6t_entry, arpt_entry, ebt_entry)
249 *
250 * Other fields see above.
251 */
252struct xt_tgchk_param {
253 const char *table;
254 void *entryinfo;
255 const struct xt_target *target;
256 void *targinfo;
257 unsigned int hook_mask;
258 u_int8_t family;
259};
260
261/* Target destructor parameters */
262struct xt_tgdtor_param {
263 const struct xt_target *target;
264 void *targinfo;
265 u_int8_t family;
266};
267
176struct xt_match 268struct xt_match
177{ 269{
178 struct list_head list; 270 struct list_head list;
@@ -185,24 +277,13 @@ struct xt_match
185 non-linear skb, using skb_header_pointer and 277 non-linear skb, using skb_header_pointer and
186 skb_ip_make_writable. */ 278 skb_ip_make_writable. */
187 bool (*match)(const struct sk_buff *skb, 279 bool (*match)(const struct sk_buff *skb,
188 const struct net_device *in, 280 const struct xt_match_param *);
189 const struct net_device *out,
190 const struct xt_match *match,
191 const void *matchinfo,
192 int offset,
193 unsigned int protoff,
194 bool *hotdrop);
195 281
196 /* Called when user tries to insert an entry of this type. */ 282 /* Called when user tries to insert an entry of this type. */
197 /* Should return true or false. */ 283 bool (*checkentry)(const struct xt_mtchk_param *);
198 bool (*checkentry)(const char *tablename,
199 const void *ip,
200 const struct xt_match *match,
201 void *matchinfo,
202 unsigned int hook_mask);
203 284
204 /* Called when entry of this type deleted. */ 285 /* Called when entry of this type deleted. */
205 void (*destroy)(const struct xt_match *match, void *matchinfo); 286 void (*destroy)(const struct xt_mtdtor_param *);
206 287
207 /* Called when userspace align differs from kernel space one */ 288 /* Called when userspace align differs from kernel space one */
208 void (*compat_from_user)(void *dst, void *src); 289 void (*compat_from_user)(void *dst, void *src);
@@ -235,24 +316,16 @@ struct xt_target
235 must now handle non-linear skbs, using skb_copy_bits and 316 must now handle non-linear skbs, using skb_copy_bits and
236 skb_ip_make_writable. */ 317 skb_ip_make_writable. */
237 unsigned int (*target)(struct sk_buff *skb, 318 unsigned int (*target)(struct sk_buff *skb,
238 const struct net_device *in, 319 const struct xt_target_param *);
239 const struct net_device *out,
240 unsigned int hooknum,
241 const struct xt_target *target,
242 const void *targinfo);
243 320
244 /* Called when user tries to insert an entry of this type: 321 /* Called when user tries to insert an entry of this type:
245 hook_mask is a bitmask of hooks from which it can be 322 hook_mask is a bitmask of hooks from which it can be
246 called. */ 323 called. */
247 /* Should return true or false. */ 324 /* Should return true or false. */
248 bool (*checkentry)(const char *tablename, 325 bool (*checkentry)(const struct xt_tgchk_param *);
249 const void *entry,
250 const struct xt_target *target,
251 void *targinfo,
252 unsigned int hook_mask);
253 326
254 /* Called when entry of this type deleted. */ 327 /* Called when entry of this type deleted. */
255 void (*destroy)(const struct xt_target *target, void *targinfo); 328 void (*destroy)(const struct xt_tgdtor_param *);
256 329
257 /* Called when userspace align differs from kernel space one */ 330 /* Called when userspace align differs from kernel space one */
258 void (*compat_from_user)(void *dst, void *src); 331 void (*compat_from_user)(void *dst, void *src);
@@ -292,7 +365,7 @@ struct xt_table
292 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 365 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
293 struct module *me; 366 struct module *me;
294 367
295 int af; /* address/protocol family */ 368 u_int8_t af; /* address/protocol family */
296}; 369};
297 370
298#include <linux/netfilter_ipv4.h> 371#include <linux/netfilter_ipv4.h>
@@ -328,12 +401,10 @@ extern void xt_unregister_match(struct xt_match *target);
328extern int xt_register_matches(struct xt_match *match, unsigned int n); 401extern int xt_register_matches(struct xt_match *match, unsigned int n);
329extern void xt_unregister_matches(struct xt_match *match, unsigned int n); 402extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
330 403
331extern int xt_check_match(const struct xt_match *match, unsigned short family, 404extern int xt_check_match(struct xt_mtchk_param *,
332 unsigned int size, const char *table, unsigned int hook, 405 unsigned int size, u_int8_t proto, bool inv_proto);
333 unsigned short proto, int inv_proto); 406extern int xt_check_target(struct xt_tgchk_param *,
334extern int xt_check_target(const struct xt_target *target, unsigned short family, 407 unsigned int size, u_int8_t proto, bool inv_proto);
335 unsigned int size, const char *table, unsigned int hook,
336 unsigned short proto, int inv_proto);
337 408
338extern struct xt_table *xt_register_table(struct net *net, 409extern struct xt_table *xt_register_table(struct net *net,
339 struct xt_table *table, 410 struct xt_table *table,
@@ -346,19 +417,19 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
346 struct xt_table_info *newinfo, 417 struct xt_table_info *newinfo,
347 int *error); 418 int *error);
348 419
349extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); 420extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
350extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); 421extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
351extern struct xt_target *xt_request_find_target(int af, const char *name, 422extern struct xt_target *xt_request_find_target(u8 af, const char *name,
352 u8 revision); 423 u8 revision);
353extern int xt_find_revision(int af, const char *name, u8 revision, int target, 424extern int xt_find_revision(u8 af, const char *name, u8 revision,
354 int *err); 425 int target, int *err);
355 426
356extern struct xt_table *xt_find_table_lock(struct net *net, int af, 427extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
357 const char *name); 428 const char *name);
358extern void xt_table_unlock(struct xt_table *t); 429extern void xt_table_unlock(struct xt_table *t);
359 430
360extern int xt_proto_init(struct net *net, int af); 431extern int xt_proto_init(struct net *net, u_int8_t af);
361extern void xt_proto_fini(struct net *net, int af); 432extern void xt_proto_fini(struct net *net, u_int8_t af);
362 433
363extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 434extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
364extern void xt_free_table_info(struct xt_table_info *info); 435extern void xt_free_table_info(struct xt_table_info *info);
@@ -423,12 +494,12 @@ struct compat_xt_counters_info
423#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ 494#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \
424 & ~(__alignof__(struct compat_xt_counters)-1)) 495 & ~(__alignof__(struct compat_xt_counters)-1))
425 496
426extern void xt_compat_lock(int af); 497extern void xt_compat_lock(u_int8_t af);
427extern void xt_compat_unlock(int af); 498extern void xt_compat_unlock(u_int8_t af);
428 499
429extern int xt_compat_add_offset(int af, unsigned int offset, short delta); 500extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 501extern void xt_compat_flush_offsets(u_int8_t af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 502extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
432 503
433extern int xt_compat_match_offset(const struct xt_match *match); 504extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 505extern int xt_compat_match_from_user(struct xt_entry_match *m,
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h
new file mode 100644
index 000000000000..152e8f97132b
--- /dev/null
+++ b/include/linux/netfilter/xt_TPROXY.h
@@ -0,0 +1,14 @@
1#ifndef _XT_TPROXY_H_target
2#define _XT_TPROXY_H_target
3
4/* TPROXY target is capable of marking the packet to perform
5 * redirection. We can get rid of that whenever we get support for
6 * mutliple targets in the same rule. */
7struct xt_tproxy_target_info {
8 u_int32_t mark_mask;
9 u_int32_t mark_value;
10 __be32 laddr;
11 __be16 lport;
12};
13
14#endif /* _XT_TPROXY_H_target */
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
new file mode 100644
index 000000000000..5cfeb81c6794
--- /dev/null
+++ b/include/linux/netfilter/xt_recent.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_NETFILTER_XT_RECENT_H
2#define _LINUX_NETFILTER_XT_RECENT_H 1
3
4enum {
5 XT_RECENT_CHECK = 1 << 0,
6 XT_RECENT_SET = 1 << 1,
7 XT_RECENT_UPDATE = 1 << 2,
8 XT_RECENT_REMOVE = 1 << 3,
9 XT_RECENT_TTL = 1 << 4,
10
11 XT_RECENT_SOURCE = 0,
12 XT_RECENT_DEST = 1,
13
14 XT_RECENT_NAME_LEN = 200,
15};
16
17struct xt_recent_mtinfo {
18 u_int32_t seconds;
19 u_int32_t hit_count;
20 u_int8_t check_set;
21 u_int8_t invert;
22 char name[XT_RECENT_NAME_LEN];
23 u_int8_t side;
24};
25
26#endif /* _LINUX_NETFILTER_XT_RECENT_H */
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 892f5b7771c7..d45e29cd1cfb 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -31,6 +31,9 @@
31 * The 4 lsb are more than enough to store the verdict. */ 31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F 32#define EBT_VERDICT_BITS 0x0000000F
33 33
34struct xt_match;
35struct xt_target;
36
34struct ebt_counter 37struct ebt_counter
35{ 38{
36 uint64_t pcnt; 39 uint64_t pcnt;
@@ -121,7 +124,7 @@ struct ebt_entry_match
121{ 124{
122 union { 125 union {
123 char name[EBT_FUNCTION_MAXNAMELEN]; 126 char name[EBT_FUNCTION_MAXNAMELEN];
124 struct ebt_match *match; 127 struct xt_match *match;
125 } u; 128 } u;
126 /* size of data */ 129 /* size of data */
127 unsigned int match_size; 130 unsigned int match_size;
@@ -132,7 +135,7 @@ struct ebt_entry_watcher
132{ 135{
133 union { 136 union {
134 char name[EBT_FUNCTION_MAXNAMELEN]; 137 char name[EBT_FUNCTION_MAXNAMELEN];
135 struct ebt_watcher *watcher; 138 struct xt_target *watcher;
136 } u; 139 } u;
137 /* size of data */ 140 /* size of data */
138 unsigned int watcher_size; 141 unsigned int watcher_size;
@@ -143,7 +146,7 @@ struct ebt_entry_target
143{ 146{
144 union { 147 union {
145 char name[EBT_FUNCTION_MAXNAMELEN]; 148 char name[EBT_FUNCTION_MAXNAMELEN];
146 struct ebt_target *target; 149 struct xt_target *target;
147 } u; 150 } u;
148 /* size of data */ 151 /* size of data */
149 unsigned int target_size; 152 unsigned int target_size;
@@ -207,14 +210,17 @@ struct ebt_match
207{ 210{
208 struct list_head list; 211 struct list_head list;
209 const char name[EBT_FUNCTION_MAXNAMELEN]; 212 const char name[EBT_FUNCTION_MAXNAMELEN];
210 /* 0 == it matches */ 213 bool (*match)(const struct sk_buff *skb, const struct net_device *in,
211 int (*match)(const struct sk_buff *skb, const struct net_device *in, 214 const struct net_device *out, const struct xt_match *match,
212 const struct net_device *out, const void *matchdata, 215 const void *matchinfo, int offset, unsigned int protoff,
213 unsigned int datalen); 216 bool *hotdrop);
214 /* 0 == let it in */ 217 bool (*checkentry)(const char *table, const void *entry,
215 int (*check)(const char *tablename, unsigned int hookmask, 218 const struct xt_match *match, void *matchinfo,
216 const struct ebt_entry *e, void *matchdata, unsigned int datalen); 219 unsigned int hook_mask);
217 void (*destroy)(void *matchdata, unsigned int datalen); 220 void (*destroy)(const struct xt_match *match, void *matchinfo);
221 unsigned int matchsize;
222 u_int8_t revision;
223 u_int8_t family;
218 struct module *me; 224 struct module *me;
219}; 225};
220 226
@@ -222,13 +228,17 @@ struct ebt_watcher
222{ 228{
223 struct list_head list; 229 struct list_head list;
224 const char name[EBT_FUNCTION_MAXNAMELEN]; 230 const char name[EBT_FUNCTION_MAXNAMELEN];
225 void (*watcher)(const struct sk_buff *skb, unsigned int hooknr, 231 unsigned int (*target)(struct sk_buff *skb,
226 const struct net_device *in, const struct net_device *out, 232 const struct net_device *in, const struct net_device *out,
227 const void *watcherdata, unsigned int datalen); 233 unsigned int hook_num, const struct xt_target *target,
228 /* 0 == let it in */ 234 const void *targinfo);
229 int (*check)(const char *tablename, unsigned int hookmask, 235 bool (*checkentry)(const char *table, const void *entry,
230 const struct ebt_entry *e, void *watcherdata, unsigned int datalen); 236 const struct xt_target *target, void *targinfo,
231 void (*destroy)(void *watcherdata, unsigned int datalen); 237 unsigned int hook_mask);
238 void (*destroy)(const struct xt_target *target, void *targinfo);
239 unsigned int targetsize;
240 u_int8_t revision;
241 u_int8_t family;
232 struct module *me; 242 struct module *me;
233}; 243};
234 244
@@ -236,14 +246,18 @@ struct ebt_target
236{ 246{
237 struct list_head list; 247 struct list_head list;
238 const char name[EBT_FUNCTION_MAXNAMELEN]; 248 const char name[EBT_FUNCTION_MAXNAMELEN];
239 /* returns one of the standard verdicts */ 249 /* returns one of the standard EBT_* verdicts */
240 int (*target)(struct sk_buff *skb, unsigned int hooknr, 250 unsigned int (*target)(struct sk_buff *skb,
241 const struct net_device *in, const struct net_device *out, 251 const struct net_device *in, const struct net_device *out,
242 const void *targetdata, unsigned int datalen); 252 unsigned int hook_num, const struct xt_target *target,
243 /* 0 == let it in */ 253 const void *targinfo);
244 int (*check)(const char *tablename, unsigned int hookmask, 254 bool (*checkentry)(const char *table, const void *entry,
245 const struct ebt_entry *e, void *targetdata, unsigned int datalen); 255 const struct xt_target *target, void *targinfo,
246 void (*destroy)(void *targetdata, unsigned int datalen); 256 unsigned int hook_mask);
257 void (*destroy)(const struct xt_target *target, void *targinfo);
258 unsigned int targetsize;
259 u_int8_t revision;
260 u_int8_t family;
247 struct module *me; 261 struct module *me;
248}; 262};
249 263
@@ -288,12 +302,6 @@ struct ebt_table
288 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
289extern int ebt_register_table(struct ebt_table *table); 303extern int ebt_register_table(struct ebt_table *table);
290extern void ebt_unregister_table(struct ebt_table *table); 304extern void ebt_unregister_table(struct ebt_table *table);
291extern int ebt_register_match(struct ebt_match *match);
292extern void ebt_unregister_match(struct ebt_match *match);
293extern int ebt_register_watcher(struct ebt_watcher *watcher);
294extern void ebt_unregister_watcher(struct ebt_watcher *watcher);
295extern int ebt_register_target(struct ebt_target *target);
296extern void ebt_unregister_target(struct ebt_target *target);
297extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
298 const struct net_device *in, const struct net_device *out, 306 const struct net_device *in, const struct net_device *out,
299 struct ebt_table *table); 307 struct ebt_table *table);
@@ -302,9 +310,9 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
302#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) 310#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg))
303/* True if the hook mask denotes that the rule is in a base chain, 311/* True if the hook mask denotes that the rule is in a base chain,
304 * used in the check() functions */ 312 * used in the check() functions */
305#define BASE_CHAIN (hookmask & (1 << NF_BR_NUMHOOKS)) 313#define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS))
306/* Clear the bit in the hook mask that tells if the rule is on a base chain */ 314/* Clear the bit in the hook mask that tells if the rule is on a base chain */
307#define CLEAR_BASE_CHAIN_BIT (hookmask &= ~(1 << NF_BR_NUMHOOKS)) 315#define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS))
308/* True if the target is not a standard target */ 316/* True if the target is not a standard target */
309#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) 317#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
310 318
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h
index 6508a4592651..d636cca133c2 100644
--- a/include/linux/netfilter_ipv4/ipt_recent.h
+++ b/include/linux/netfilter_ipv4/ipt_recent.h
@@ -1,27 +1,21 @@
1#ifndef _IPT_RECENT_H 1#ifndef _IPT_RECENT_H
2#define _IPT_RECENT_H 2#define _IPT_RECENT_H
3 3
4#define RECENT_NAME "ipt_recent" 4#include <linux/netfilter/xt_recent.h>
5#define RECENT_VER "v0.3.1"
6 5
7#define IPT_RECENT_CHECK 1 6#define ipt_recent_info xt_recent_mtinfo
8#define IPT_RECENT_SET 2
9#define IPT_RECENT_UPDATE 4
10#define IPT_RECENT_REMOVE 8
11#define IPT_RECENT_TTL 16
12 7
13#define IPT_RECENT_SOURCE 0 8enum {
14#define IPT_RECENT_DEST 1 9 IPT_RECENT_CHECK = XT_RECENT_CHECK,
10 IPT_RECENT_SET = XT_RECENT_SET,
11 IPT_RECENT_UPDATE = XT_RECENT_UPDATE,
12 IPT_RECENT_REMOVE = XT_RECENT_REMOVE,
13 IPT_RECENT_TTL = XT_RECENT_TTL,
15 14
16#define IPT_RECENT_NAME_LEN 200 15 IPT_RECENT_SOURCE = XT_RECENT_SOURCE,
16 IPT_RECENT_DEST = XT_RECENT_DEST,
17 17
18struct ipt_recent_info { 18 IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN,
19 u_int32_t seconds;
20 u_int32_t hit_count;
21 u_int8_t check_set;
22 u_int8_t invert;
23 char name[IPT_RECENT_NAME_LEN];
24 u_int8_t side;
25}; 19};
26 20
27#endif /*_IPT_RECENT_H*/ 21#endif /*_IPT_RECENT_H*/
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 78a5922a2f11..4eaa8347a0d9 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -137,7 +137,7 @@ struct nfs_inode {
137 unsigned long attrtimeo_timestamp; 137 unsigned long attrtimeo_timestamp;
138 __u64 change_attr; /* v4 only */ 138 __u64 change_attr; /* v4 only */
139 139
140 unsigned long last_updated; 140 unsigned long attr_gencount;
141 /* "Generation counter" for the attribute cache. This is 141 /* "Generation counter" for the attribute cache. This is
142 * bumped whenever we update the metadata on the 142 * bumped whenever we update the metadata on the
143 * server. 143 * server.
@@ -200,11 +200,10 @@ struct nfs_inode {
200/* 200/*
201 * Bit offsets in flags field 201 * Bit offsets in flags field
202 */ 202 */
203#define NFS_INO_REVALIDATING (0) /* revalidating attrs */ 203#define NFS_INO_ADVISE_RDPLUS (0) /* advise readdirplus */
204#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */ 204#define NFS_INO_STALE (1) /* possible stale inode */
205#define NFS_INO_STALE (2) /* possible stale inode */ 205#define NFS_INO_ACL_LRU_SET (2) /* Inode is on the LRU list */
206#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 206#define NFS_INO_MOUNTPOINT (3) /* inode is remote mountpoint */
207#define NFS_INO_MOUNTPOINT (4) /* inode is remote mountpoint */
208 207
209static inline struct nfs_inode *NFS_I(const struct inode *inode) 208static inline struct nfs_inode *NFS_I(const struct inode *inode)
210{ 209{
@@ -345,15 +344,11 @@ extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ct
345extern void put_nfs_open_context(struct nfs_open_context *ctx); 344extern void put_nfs_open_context(struct nfs_open_context *ctx);
346extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 345extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
347extern u64 nfs_compat_user_ino64(u64 fileid); 346extern u64 nfs_compat_user_ino64(u64 fileid);
347extern void nfs_fattr_init(struct nfs_fattr *fattr);
348 348
349/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 349/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
350extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 350extern __be32 root_nfs_parse_addr(char *name); /*__init*/
351 351extern unsigned long nfs_inc_attr_generation_counter(void);
352static inline void nfs_fattr_init(struct nfs_fattr *fattr)
353{
354 fattr->valid = 0;
355 fattr->time_start = jiffies;
356}
357 352
358/* 353/*
359 * linux/fs/nfs/file.c 354 * linux/fs/nfs/file.c
@@ -372,8 +367,12 @@ static inline struct nfs_open_context *nfs_file_open_context(struct file *filp)
372 367
373static inline struct rpc_cred *nfs_file_cred(struct file *file) 368static inline struct rpc_cred *nfs_file_cred(struct file *file)
374{ 369{
375 if (file != NULL) 370 if (file != NULL) {
376 return nfs_file_open_context(file)->cred; 371 struct nfs_open_context *ctx =
372 nfs_file_open_context(file);
373 if (ctx)
374 return ctx->cred;
375 }
377 return NULL; 376 return NULL;
378} 377}
379 378
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index c9beacd16c00..4e477ae58699 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -119,7 +119,6 @@ struct nfs_server {
119 void (*destroy)(struct nfs_server *); 119 void (*destroy)(struct nfs_server *);
120 120
121 atomic_t active; /* Keep trace of any activity to this server */ 121 atomic_t active; /* Keep trace of any activity to this server */
122 wait_queue_head_t active_wq; /* Wait for any activity to stop */
123 122
124 /* mountd-related mount options */ 123 /* mountd-related mount options */
125 struct sockaddr_storage mountd_address; 124 struct sockaddr_storage mountd_address;
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index df7c6b7a7ebb..6549a06ac16e 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -65,4 +65,8 @@ struct nfs_mount_data {
65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ 65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
66#define NFS_MOUNT_FLAGMASK 0xFFFF 66#define NFS_MOUNT_FLAGMASK 0xFFFF
67 67
68/* The following are for internal use only */
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71
68#endif 72#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 8c77c11224d1..c1c31acb8a2b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -36,6 +36,7 @@ struct nfs_fattr {
36 __u32 nlink; 36 __u32 nlink;
37 __u32 uid; 37 __u32 uid;
38 __u32 gid; 38 __u32 gid;
39 dev_t rdev;
39 __u64 size; 40 __u64 size;
40 union { 41 union {
41 struct { 42 struct {
@@ -46,7 +47,6 @@ struct nfs_fattr {
46 __u64 used; 47 __u64 used;
47 } nfs3; 48 } nfs3;
48 } du; 49 } du;
49 dev_t rdev;
50 struct nfs_fsid fsid; 50 struct nfs_fsid fsid;
51 __u64 fileid; 51 __u64 fileid;
52 struct timespec atime; 52 struct timespec atime;
@@ -56,6 +56,7 @@ struct nfs_fattr {
56 __u64 change_attr; /* NFSv4 change attribute */ 56 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ 57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
58 unsigned long time_start; 58 unsigned long time_start;
59 unsigned long gencount;
59}; 60};
60 61
61#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ 62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
@@ -672,16 +673,16 @@ struct nfs4_rename_res {
672 struct nfs_fattr * new_fattr; 673 struct nfs_fattr * new_fattr;
673}; 674};
674 675
675#define NFS4_SETCLIENTID_NAMELEN (56) 676#define NFS4_SETCLIENTID_NAMELEN (127)
676struct nfs4_setclientid { 677struct nfs4_setclientid {
677 const nfs4_verifier * sc_verifier; 678 const nfs4_verifier * sc_verifier;
678 unsigned int sc_name_len; 679 unsigned int sc_name_len;
679 char sc_name[NFS4_SETCLIENTID_NAMELEN]; 680 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
680 u32 sc_prog; 681 u32 sc_prog;
681 unsigned int sc_netid_len; 682 unsigned int sc_netid_len;
682 char sc_netid[RPCBIND_MAXNETIDLEN]; 683 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
683 unsigned int sc_uaddr_len; 684 unsigned int sc_uaddr_len;
684 char sc_uaddr[RPCBIND_MAXUADDRLEN]; 685 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
685 u32 sc_cb_ident; 686 u32 sc_cb_ident;
686}; 687};
687 688
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 108f47e5fd95..21269405ffe2 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -38,6 +38,7 @@
38#define NFSD_MAY_LOCK 32 38#define NFSD_MAY_LOCK 32
39#define NFSD_MAY_OWNER_OVERRIDE 64 39#define NFSD_MAY_OWNER_OVERRIDE 64
40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/ 40#define NFSD_MAY_LOCAL_ACCESS 128 /* IRIX doing local access check on device special file*/
41#define NFSD_MAY_BYPASS_GSS_ON_ROOT 256
41 42
42#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) 43#define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE)
43#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) 44#define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC)
@@ -125,7 +126,7 @@ int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
125__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, 126__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
126 loff_t *, struct readdir_cd *, filldir_t); 127 loff_t *, struct readdir_cd *, filldir_t);
127__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, 128__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
128 struct kstatfs *); 129 struct kstatfs *, int access);
129 130
130int nfsd_notify_change(struct inode *, struct iattr *); 131int nfsd_notify_change(struct inode *, struct iattr *);
131__be32 nfsd_permission(struct svc_rqst *, struct svc_export *, 132__be32 nfsd_permission(struct svc_rqst *, struct svc_export *,
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2be7c63bc0f2..9bad65400fba 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -89,6 +89,22 @@
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC 89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified 90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX. 91 * by %NL80211_ATTR_IFINDEX.
92 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
93 * %NL80211_ATTR_IFINDEX.
94 *
95 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
96 * after being queried by the kernel. CRDA replies by sending a regulatory
97 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
98 * current alpha2 if it found a match. It also provides
99 * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each
100 * regulatory rule is a nested set of attributes given by
101 * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and
102 * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by
103 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
104 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
105 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
106 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
107 * store this as a valid request and then query userspace for it.
92 * 108 *
93 * @NL80211_CMD_MAX: highest used command number 109 * @NL80211_CMD_MAX: highest used command number
94 * @__NL80211_CMD_AFTER_LAST: internal use 110 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -127,13 +143,23 @@ enum nl80211_commands {
127 NL80211_CMD_NEW_MPATH, 143 NL80211_CMD_NEW_MPATH,
128 NL80211_CMD_DEL_MPATH, 144 NL80211_CMD_DEL_MPATH,
129 145
130 /* add commands here */ 146 NL80211_CMD_SET_BSS,
147
148 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG,
150
151 /* add new commands above here */
131 152
132 /* used to define NL80211_CMD_MAX below */ 153 /* used to define NL80211_CMD_MAX below */
133 __NL80211_CMD_AFTER_LAST, 154 __NL80211_CMD_AFTER_LAST,
134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 155 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
135}; 156};
136 157
158/*
159 * Allow user space programs to use #ifdef on new commands by defining them
160 * here
161 */
162#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
137 163
138/** 164/**
139 * enum nl80211_attrs - nl80211 netlink attributes 165 * enum nl80211_attrs - nl80211 netlink attributes
@@ -188,10 +214,34 @@ enum nl80211_commands {
188 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at 214 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
189 * &enum nl80211_mpath_info. 215 * &enum nl80211_mpath_info.
190 * 216 *
191 *
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of 217 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags. 218 * &enum nl80211_mntr_flags.
194 * 219 *
220 * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the
221 * current regulatory domain should be set to or is already set to.
222 * For example, 'CR', for Costa Rica. This attribute is used by the kernel
223 * to query the CRDA to retrieve one regulatory domain. This attribute can
224 * also be used by userspace to query the kernel for the currently set
225 * regulatory domain. We chose an alpha2 as that is also used by the
226 * IEEE-802.11d country information element to identify a country.
227 * Users can also simply ask the wireless core to set regulatory domain
228 * to a specific alpha2.
229 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
230 * rules.
231 *
232 * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1)
233 * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled
234 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1)
237 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION)
240 *
241 * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all
242 * supported interface types, each a flag attribute with the number
243 * of the interface mode.
244 *
195 * @NL80211_ATTR_MAX: highest attribute number currently defined 245 * @NL80211_ATTR_MAX: highest attribute number currently defined
196 * @__NL80211_ATTR_AFTER_LAST: internal use 246 * @__NL80211_ATTR_AFTER_LAST: internal use
197 */ 247 */
@@ -235,16 +285,35 @@ enum nl80211_attrs {
235 NL80211_ATTR_MPATH_NEXT_HOP, 285 NL80211_ATTR_MPATH_NEXT_HOP,
236 NL80211_ATTR_MPATH_INFO, 286 NL80211_ATTR_MPATH_INFO,
237 287
288 NL80211_ATTR_BSS_CTS_PROT,
289 NL80211_ATTR_BSS_SHORT_PREAMBLE,
290 NL80211_ATTR_BSS_SHORT_SLOT_TIME,
291
292 NL80211_ATTR_HT_CAPABILITY,
293
294 NL80211_ATTR_SUPPORTED_IFTYPES,
295
296 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES,
298
238 /* add attributes here, update the policy in nl80211.c */ 299 /* add attributes here, update the policy in nl80211.c */
239 300
240 __NL80211_ATTR_AFTER_LAST, 301 __NL80211_ATTR_AFTER_LAST,
241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 302 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
242}; 303};
243 304
305/*
306 * Allow user space programs to use #ifdef on new attributes by defining them
307 * here
308 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
310
244#define NL80211_MAX_SUPP_RATES 32 311#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32
245#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 313#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
246#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 314#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
247#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 315#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
316#define NL80211_HT_CAPABILITY_LEN 26
248 317
249/** 318/**
250 * enum nl80211_iftype - (virtual) interface types 319 * enum nl80211_iftype - (virtual) interface types
@@ -436,6 +505,66 @@ enum nl80211_bitrate_attr {
436}; 505};
437 506
438/** 507/**
508 * enum nl80211_reg_rule_attr - regulatory rule attributes
509 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
510 * considerations for a given frequency range. These are the
511 * &enum nl80211_reg_rule_flags.
512 * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory
513 * rule in KHz. This is not a center of frequency but an actual regulatory
514 * band edge.
515 * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule
516 * in KHz. This is not a center a frequency but an actual regulatory
517 * band edge.
518 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this
519 * frequency range, in KHz.
520 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain
521 * for a given frequency range. The value is in mBi (100 * dBi).
522 * If you don't have one then don't send this.
523 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
524 * a given frequency range. The value is in mBm (100 * dBm).
525 */
526enum nl80211_reg_rule_attr {
527 __NL80211_REG_RULE_ATTR_INVALID,
528 NL80211_ATTR_REG_RULE_FLAGS,
529
530 NL80211_ATTR_FREQ_RANGE_START,
531 NL80211_ATTR_FREQ_RANGE_END,
532 NL80211_ATTR_FREQ_RANGE_MAX_BW,
533
534 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
535 NL80211_ATTR_POWER_RULE_MAX_EIRP,
536
537 /* keep last */
538 __NL80211_REG_RULE_ATTR_AFTER_LAST,
539 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
540};
541
542/**
543 * enum nl80211_reg_rule_flags - regulatory rule flags
544 *
545 * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed
546 * @NL80211_RRF_NO_CCK: CCK modulation not allowed
547 * @NL80211_RRF_NO_INDOOR: indoor operation not allowed
548 * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed
549 * @NL80211_RRF_DFS: DFS support is required to be used
550 * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links
551 * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links
552 * @NL80211_RRF_PASSIVE_SCAN: passive scan is required
553 * @NL80211_RRF_NO_IBSS: no IBSS is allowed
554 */
555enum nl80211_reg_rule_flags {
556 NL80211_RRF_NO_OFDM = 1<<0,
557 NL80211_RRF_NO_CCK = 1<<1,
558 NL80211_RRF_NO_INDOOR = 1<<2,
559 NL80211_RRF_NO_OUTDOOR = 1<<3,
560 NL80211_RRF_DFS = 1<<4,
561 NL80211_RRF_PTP_ONLY = 1<<5,
562 NL80211_RRF_PTMP_ONLY = 1<<6,
563 NL80211_RRF_PASSIVE_SCAN = 1<<7,
564 NL80211_RRF_NO_IBSS = 1<<8,
565};
566
567/**
439 * enum nl80211_mntr_flags - monitor configuration flags 568 * enum nl80211_mntr_flags - monitor configuration flags
440 * 569 *
441 * Monitor configuration flags. 570 * Monitor configuration flags.
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index da2698b0fdd1..b86fa2ffca0c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -213,9 +213,16 @@ static inline int notifier_to_errno(int ret)
213#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ 213#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
214#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 214#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
215#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, 215#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
216 * not handling interrupts, soon dead */ 216 * not handling interrupts, soon dead.
217 * Called on the dying cpu, interrupts
218 * are already disabled. Must not
219 * sleep, must not fail */
217#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug 220#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
218 * lock is dropped */ 221 * lock is dropped */
222#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.
223 * Called on the new cpu, just before
224 * enabling interrupts. Must not sleep,
225 * must not fail */
219 226
220/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 227/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
221 * operation in progress 228 * operation in progress
@@ -229,6 +236,7 @@ static inline int notifier_to_errno(int ret)
229#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) 236#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
230#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) 237#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
231#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) 238#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
239#define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN)
232 240
233/* Hibernation and suspend events */ 241/* Hibernation and suspend events */
234#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ 242#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
diff --git a/include/linux/of.h b/include/linux/of.h
index 79886ade070f..e2488f5e7cb2 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -71,5 +71,8 @@ extern int of_n_size_cells(struct device_node *np);
71extern const struct of_device_id *of_match_node( 71extern const struct of_device_id *of_match_node(
72 const struct of_device_id *matches, const struct device_node *node); 72 const struct of_device_id *matches, const struct device_node *node);
73extern int of_modalias_node(struct device_node *node, char *modalias, int len); 73extern int of_modalias_node(struct device_node *node, char *modalias, int len);
74extern int of_parse_phandles_with_args(struct device_node *np,
75 const char *list_name, const char *cells_name, int index,
76 struct device_node **out_node, const void **out_args);
74 77
75#endif /* _LINUX_OF_H */ 78#endif /* _LINUX_OF_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 041bb31100f4..5231861f357d 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -36,6 +36,8 @@
36#define XEN_ENTER_SWITCH_CODE 10 36#define XEN_ENTER_SWITCH_CODE 10
37#define SPU_PROFILING_CODE 11 37#define SPU_PROFILING_CODE 11
38#define SPU_CTX_SWITCH_CODE 12 38#define SPU_CTX_SWITCH_CODE 12
39#define IBS_FETCH_CODE 13
40#define IBS_OP_CODE 14
39 41
40struct super_block; 42struct super_block;
41struct dentry; 43struct dentry;
@@ -84,13 +86,6 @@ int oprofile_arch_init(struct oprofile_operations * ops);
84void oprofile_arch_exit(void); 86void oprofile_arch_exit(void);
85 87
86/** 88/**
87 * Add data to the event buffer.
88 * The data passed is free-form, but typically consists of
89 * file offsets, dcookies, context information, and ESCAPE codes.
90 */
91void add_event_entry(unsigned long data);
92
93/**
94 * Add a sample. This may be called from any context. Pass 89 * Add a sample. This may be called from any context. Pass
95 * smp_processor_id() as cpu. 90 * smp_processor_id() as cpu.
96 */ 91 */
@@ -160,5 +155,14 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz
160 155
161/** lock for read/write safety */ 156/** lock for read/write safety */
162extern spinlock_t oprofilefs_lock; 157extern spinlock_t oprofilefs_lock;
158
159/**
160 * Add the contents of a circular buffer to the event buffer.
161 */
162void oprofile_put_buff(unsigned long *buf, unsigned int start,
163 unsigned int stop, unsigned int max);
164
165unsigned long oprofile_get_cpu_buffer_size(void);
166void oprofile_cpu_buffer_inc_smpl_lost(void);
163 167
164#endif /* OPROFILE_H */ 168#endif /* OPROFILE_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index c74d3e875314..b12f93a3c345 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -93,6 +93,11 @@ enum pageflags {
93 PG_mappedtodisk, /* Has blocks allocated on-disk */ 93 PG_mappedtodisk, /* Has blocks allocated on-disk */
94 PG_reclaim, /* To be reclaimed asap */ 94 PG_reclaim, /* To be reclaimed asap */
95 PG_buddy, /* Page is free, on buddy lists */ 95 PG_buddy, /* Page is free, on buddy lists */
96 PG_swapbacked, /* Page is backed by RAM/swap */
97#ifdef CONFIG_UNEVICTABLE_LRU
98 PG_unevictable, /* Page is "unevictable" */
99 PG_mlocked, /* Page is vma mlocked */
100#endif
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 101#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */ 102 PG_uncached, /* Page has been mapped as uncached */
98#endif 103#endif
@@ -161,6 +166,18 @@ static inline int Page##uname(struct page *page) \
161#define TESTSCFLAG(uname, lname) \ 166#define TESTSCFLAG(uname, lname) \
162 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname) 167 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
163 168
169#define SETPAGEFLAG_NOOP(uname) \
170static inline void SetPage##uname(struct page *page) { }
171
172#define CLEARPAGEFLAG_NOOP(uname) \
173static inline void ClearPage##uname(struct page *page) { }
174
175#define __CLEARPAGEFLAG_NOOP(uname) \
176static inline void __ClearPage##uname(struct page *page) { }
177
178#define TESTCLEARFLAG_FALSE(uname) \
179static inline int TestClearPage##uname(struct page *page) { return 0; }
180
164struct page; /* forward declaration */ 181struct page; /* forward declaration */
165 182
166TESTPAGEFLAG(Locked, locked) 183TESTPAGEFLAG(Locked, locked)
@@ -169,6 +186,7 @@ PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
169PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 186PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
170PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 187PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
171PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) 188PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
189 TESTCLEARFLAG(Active, active)
172__PAGEFLAG(Slab, slab) 190__PAGEFLAG(Slab, slab)
173PAGEFLAG(Checked, checked) /* Used by some filesystems */ 191PAGEFLAG(Checked, checked) /* Used by some filesystems */
174PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ 192PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
@@ -176,6 +194,7 @@ PAGEFLAG(SavePinned, savepinned); /* Xen */
176PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 194PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
177PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) 195PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
178 __SETPAGEFLAG(Private, private) 196 __SETPAGEFLAG(Private, private)
197PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
179 198
180__PAGEFLAG(SlobPage, slob_page) 199__PAGEFLAG(SlobPage, slob_page)
181__PAGEFLAG(SlobFree, slob_free) 200__PAGEFLAG(SlobFree, slob_free)
@@ -211,6 +230,25 @@ PAGEFLAG(SwapCache, swapcache)
211PAGEFLAG_FALSE(SwapCache) 230PAGEFLAG_FALSE(SwapCache)
212#endif 231#endif
213 232
233#ifdef CONFIG_UNEVICTABLE_LRU
234PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
235 TESTCLEARFLAG(Unevictable, unevictable)
236
237#define MLOCK_PAGES 1
238PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked)
239 TESTSCFLAG(Mlocked, mlocked)
240
241#else
242
243#define MLOCK_PAGES 0
244PAGEFLAG_FALSE(Mlocked)
245 SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked)
246
247PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
248 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
249 __CLEARPAGEFLAG_NOOP(Unevictable)
250#endif
251
214#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 252#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
215PAGEFLAG(Uncached, uncached) 253PAGEFLAG(Uncached, uncached)
216#else 254#else
@@ -326,15 +364,25 @@ static inline void __ClearPageTail(struct page *page)
326 364
327#endif /* !PAGEFLAGS_EXTENDED */ 365#endif /* !PAGEFLAGS_EXTENDED */
328 366
367#ifdef CONFIG_UNEVICTABLE_LRU
368#define __PG_UNEVICTABLE (1 << PG_unevictable)
369#define __PG_MLOCKED (1 << PG_mlocked)
370#else
371#define __PG_UNEVICTABLE 0
372#define __PG_MLOCKED 0
373#endif
374
329#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ 375#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
330 1 << PG_buddy | 1 << PG_writeback | \ 376 1 << PG_buddy | 1 << PG_writeback | \
331 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active) 377 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
378 __PG_UNEVICTABLE | __PG_MLOCKED)
332 379
333/* 380/*
334 * Flags checked in bad_page(). Pages on the free list should not have 381 * Flags checked in bad_page(). Pages on the free list should not have
335 * these flags set. It they are, there is a problem. 382 * these flags set. It they are, there is a problem.
336 */ 383 */
337#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | 1 << PG_reclaim | 1 << PG_dirty) 384#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | \
385 1 << PG_reclaim | 1 << PG_dirty | 1 << PG_swapbacked)
338 386
339/* 387/*
340 * Flags checked when a page is freed. Pages being freed should not have 388 * Flags checked when a page is freed. Pages being freed should not have
@@ -347,7 +395,8 @@ static inline void __ClearPageTail(struct page *page)
347 * Pages being prepped should not have these flags set. It they are, there 395 * Pages being prepped should not have these flags set. It they are, there
348 * is a problem. 396 * is a problem.
349 */ 397 */
350#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | 1 << PG_reserved | 1 << PG_dirty) 398#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | \
399 1 << PG_reserved | 1 << PG_dirty | 1 << PG_swapbacked)
351 400
352#endif /* !__GENERATING_BOUNDS_H */ 401#endif /* !__GENERATING_BOUNDS_H */
353#endif /* PAGE_FLAGS_H */ 402#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
new file mode 100644
index 000000000000..f546ad6fc028
--- /dev/null
+++ b/include/linux/page_cgroup.h
@@ -0,0 +1,108 @@
1#ifndef __LINUX_PAGE_CGROUP_H
2#define __LINUX_PAGE_CGROUP_H
3
4#ifdef CONFIG_CGROUP_MEM_RES_CTLR
5#include <linux/bit_spinlock.h>
6/*
7 * Page Cgroup can be considered as an extended mem_map.
8 * A page_cgroup page is associated with every page descriptor. The
9 * page_cgroup helps us identify information about the cgroup
10 * All page cgroups are allocated at boot or memory hotplug event,
11 * then the page cgroup for pfn always exists.
12 */
13struct page_cgroup {
14 unsigned long flags;
15 struct mem_cgroup *mem_cgroup;
16 struct page *page;
17 struct list_head lru; /* per cgroup LRU list */
18};
19
20void __init pgdat_page_cgroup_init(struct pglist_data *pgdat);
21void __init page_cgroup_init(void);
22struct page_cgroup *lookup_page_cgroup(struct page *page);
23
24enum {
25 /* flags for mem_cgroup */
26 PCG_LOCK, /* page cgroup is locked */
27 PCG_CACHE, /* charged as cache */
28 PCG_USED, /* this object is in use. */
29 /* flags for LRU placement */
30 PCG_ACTIVE, /* page is active in this cgroup */
31 PCG_FILE, /* page is file system backed */
32 PCG_UNEVICTABLE, /* page is unevictableable */
33};
34
35#define TESTPCGFLAG(uname, lname) \
36static inline int PageCgroup##uname(struct page_cgroup *pc) \
37 { return test_bit(PCG_##lname, &pc->flags); }
38
39#define SETPCGFLAG(uname, lname) \
40static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
41 { set_bit(PCG_##lname, &pc->flags); }
42
43#define CLEARPCGFLAG(uname, lname) \
44static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
45 { clear_bit(PCG_##lname, &pc->flags); }
46
47/* Cache flag is set only once (at allocation) */
48TESTPCGFLAG(Cache, CACHE)
49
50TESTPCGFLAG(Used, USED)
51CLEARPCGFLAG(Used, USED)
52
53/* LRU management flags (from global-lru definition) */
54TESTPCGFLAG(File, FILE)
55SETPCGFLAG(File, FILE)
56CLEARPCGFLAG(File, FILE)
57
58TESTPCGFLAG(Active, ACTIVE)
59SETPCGFLAG(Active, ACTIVE)
60CLEARPCGFLAG(Active, ACTIVE)
61
62TESTPCGFLAG(Unevictable, UNEVICTABLE)
63SETPCGFLAG(Unevictable, UNEVICTABLE)
64CLEARPCGFLAG(Unevictable, UNEVICTABLE)
65
66static inline int page_cgroup_nid(struct page_cgroup *pc)
67{
68 return page_to_nid(pc->page);
69}
70
71static inline enum zone_type page_cgroup_zid(struct page_cgroup *pc)
72{
73 return page_zonenum(pc->page);
74}
75
76static inline void lock_page_cgroup(struct page_cgroup *pc)
77{
78 bit_spin_lock(PCG_LOCK, &pc->flags);
79}
80
81static inline int trylock_page_cgroup(struct page_cgroup *pc)
82{
83 return bit_spin_trylock(PCG_LOCK, &pc->flags);
84}
85
86static inline void unlock_page_cgroup(struct page_cgroup *pc)
87{
88 bit_spin_unlock(PCG_LOCK, &pc->flags);
89}
90
91#else /* CONFIG_CGROUP_MEM_RES_CTLR */
92struct page_cgroup;
93
94static inline void pgdat_page_cgroup_init(struct pglist_data *pgdat)
95{
96}
97
98static inline struct page_cgroup *lookup_page_cgroup(struct page *page)
99{
100 return NULL;
101}
102
103static inline void page_cgroup_init(void)
104{
105}
106
107#endif
108#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 5da31c12101c..709742be02f0 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -32,6 +32,34 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
32 } 32 }
33} 33}
34 34
35#ifdef CONFIG_UNEVICTABLE_LRU
36#define AS_UNEVICTABLE (__GFP_BITS_SHIFT + 2) /* e.g., ramdisk, SHM_LOCK */
37
38static inline void mapping_set_unevictable(struct address_space *mapping)
39{
40 set_bit(AS_UNEVICTABLE, &mapping->flags);
41}
42
43static inline void mapping_clear_unevictable(struct address_space *mapping)
44{
45 clear_bit(AS_UNEVICTABLE, &mapping->flags);
46}
47
48static inline int mapping_unevictable(struct address_space *mapping)
49{
50 if (likely(mapping))
51 return test_bit(AS_UNEVICTABLE, &mapping->flags);
52 return !!mapping;
53}
54#else
55static inline void mapping_set_unevictable(struct address_space *mapping) { }
56static inline void mapping_clear_unevictable(struct address_space *mapping) { }
57static inline int mapping_unevictable(struct address_space *mapping)
58{
59 return 0;
60}
61#endif
62
35static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 63static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
36{ 64{
37 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; 65 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
@@ -271,19 +299,19 @@ extern int __lock_page_killable(struct page *page);
271extern void __lock_page_nosync(struct page *page); 299extern void __lock_page_nosync(struct page *page);
272extern void unlock_page(struct page *page); 300extern void unlock_page(struct page *page);
273 301
274static inline void set_page_locked(struct page *page) 302static inline void __set_page_locked(struct page *page)
275{ 303{
276 set_bit(PG_locked, &page->flags); 304 __set_bit(PG_locked, &page->flags);
277} 305}
278 306
279static inline void clear_page_locked(struct page *page) 307static inline void __clear_page_locked(struct page *page)
280{ 308{
281 clear_bit(PG_locked, &page->flags); 309 __clear_bit(PG_locked, &page->flags);
282} 310}
283 311
284static inline int trylock_page(struct page *page) 312static inline int trylock_page(struct page *page)
285{ 313{
286 return !test_and_set_bit(PG_locked, &page->flags); 314 return (likely(!test_and_set_bit_lock(PG_locked, &page->flags)));
287} 315}
288 316
289/* 317/*
@@ -410,17 +438,17 @@ extern void __remove_from_page_cache(struct page *page);
410 438
411/* 439/*
412 * Like add_to_page_cache_locked, but used to add newly allocated pages: 440 * Like add_to_page_cache_locked, but used to add newly allocated pages:
413 * the page is new, so we can just run set_page_locked() against it. 441 * the page is new, so we can just run __set_page_locked() against it.
414 */ 442 */
415static inline int add_to_page_cache(struct page *page, 443static inline int add_to_page_cache(struct page *page,
416 struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask) 444 struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
417{ 445{
418 int error; 446 int error;
419 447
420 set_page_locked(page); 448 __set_page_locked(page);
421 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask); 449 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
422 if (unlikely(error)) 450 if (unlikely(error))
423 clear_page_locked(page); 451 __clear_page_locked(page);
424 return error; 452 return error;
425} 453}
426 454
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index 8eb7fa76c1d0..e90a2cb02915 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -23,9 +23,9 @@ struct pagevec {
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_release_nonlru(struct pagevec *pvec); 24void __pagevec_release_nonlru(struct pagevec *pvec);
25void __pagevec_free(struct pagevec *pvec); 25void __pagevec_free(struct pagevec *pvec);
26void __pagevec_lru_add(struct pagevec *pvec); 26void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
27void __pagevec_lru_add_active(struct pagevec *pvec);
28void pagevec_strip(struct pagevec *pvec); 27void pagevec_strip(struct pagevec *pvec);
28void pagevec_swap_free(struct pagevec *pvec);
29unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 29unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
30 pgoff_t start, unsigned nr_pages); 30 pgoff_t start, unsigned nr_pages);
31unsigned pagevec_lookup_tag(struct pagevec *pvec, 31unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -81,10 +81,36 @@ static inline void pagevec_free(struct pagevec *pvec)
81 __pagevec_free(pvec); 81 __pagevec_free(pvec);
82} 82}
83 83
84static inline void pagevec_lru_add(struct pagevec *pvec) 84static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
85{
86 ____pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
87}
88
89static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
90{
91 ____pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
92}
93
94static inline void __pagevec_lru_add_file(struct pagevec *pvec)
95{
96 ____pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
97}
98
99static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
100{
101 ____pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
102}
103
104static inline void pagevec_lru_add_file(struct pagevec *pvec)
105{
106 if (pagevec_count(pvec))
107 __pagevec_lru_add_file(pvec);
108}
109
110static inline void pagevec_lru_add_anon(struct pagevec *pvec)
85{ 111{
86 if (pagevec_count(pvec)) 112 if (pagevec_count(pvec))
87 __pagevec_lru_add(pvec); 113 __pagevec_lru_add_anon(pvec);
88} 114}
89 115
90#endif /* _LINUX_PAGEVEC_H */ 116#endif /* _LINUX_PAGEVEC_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 6a0d7cdb5774..e1f83c5065c5 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -1,5 +1,3 @@
1/* $Id: parport.h,v 1.1 1998/05/17 10:57:52 andrea Exp andrea $ */
2
3/* 1/*
4 * Any part of this program may be used in documents licensed under 2 * Any part of this program may be used in documents licensed under
5 * the GNU Free Documentation License, Version 1.1 or any later version 3 * the GNU Free Documentation License, Version 1.1 or any later version
diff --git a/include/linux/parser.h b/include/linux/parser.h
index 7dcd05075756..ea2281e726f6 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -25,7 +25,7 @@ typedef struct {
25 char *to; 25 char *to;
26} substring_t; 26} substring_t;
27 27
28int match_token(char *, match_table_t table, substring_t args[]); 28int match_token(char *, const match_table_t table, substring_t args[]);
29int match_int(substring_t *, int *result); 29int match_int(substring_t *, int *result);
30int match_octal(substring_t *, int *result); 30int match_octal(substring_t *, int *result);
31int match_hex(substring_t *, int *result); 31int match_hex(substring_t *, int *result);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 98dc6243a706..c75b82bda327 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -51,6 +51,7 @@
51#include <linux/kobject.h> 51#include <linux/kobject.h>
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h>
54 55
55/* Include the ID list */ 56/* Include the ID list */
56#include <linux/pci_ids.h> 57#include <linux/pci_ids.h>
@@ -64,6 +65,11 @@ struct pci_slot {
64 struct kobject kobj; 65 struct kobject kobj;
65}; 66};
66 67
68static inline const char *pci_slot_name(const struct pci_slot *slot)
69{
70 return kobject_name(&slot->kobj);
71}
72
67/* File state for mmap()s on /proc/bus/pci/X/Y */ 73/* File state for mmap()s on /proc/bus/pci/X/Y */
68enum pci_mmap_state { 74enum pci_mmap_state {
69 pci_mmap_io, 75 pci_mmap_io,
@@ -214,6 +220,7 @@ struct pci_dev {
214 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 220 unsigned int broken_parity_status:1; /* Device generates false positive parity */
215 unsigned int msi_enabled:1; 221 unsigned int msi_enabled:1;
216 unsigned int msix_enabled:1; 222 unsigned int msix_enabled:1;
223 unsigned int ari_enabled:1; /* ARI forwarding */
217 unsigned int is_managed:1; 224 unsigned int is_managed:1;
218 unsigned int is_pcie:1; 225 unsigned int is_pcie:1;
219 pci_dev_flags_t dev_flags; 226 pci_dev_flags_t dev_flags;
@@ -347,7 +354,6 @@ struct pci_bus_region {
347struct pci_dynids { 354struct pci_dynids {
348 spinlock_t lock; /* protects list, index */ 355 spinlock_t lock; /* protects list, index */
349 struct list_head list; /* for IDs added at runtime */ 356 struct list_head list; /* for IDs added at runtime */
350 unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */
351}; 357};
352 358
353/* ---------------------------------------------------------------- */ 359/* ---------------------------------------------------------------- */
@@ -456,8 +462,8 @@ struct pci_driver {
456 462
457/** 463/**
458 * PCI_VDEVICE - macro used to describe a specific pci device in short form 464 * PCI_VDEVICE - macro used to describe a specific pci device in short form
459 * @vend: the vendor name 465 * @vendor: the vendor name
460 * @dev: the 16 bit PCI Device ID 466 * @device: the 16 bit PCI Device ID
461 * 467 *
462 * This macro is used to create a struct pci_device_id that matches a 468 * This macro is used to create a struct pci_device_id that matches a
463 * specific PCI device. The subvendor, and subdevice fields will be set 469 * specific PCI device. The subvendor, and subdevice fields will be set
@@ -509,9 +515,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
509struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 515struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
510 int busnr); 516 int busnr);
511struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, 517struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
512 const char *name); 518 const char *name,
519 struct hotplug_slot *hotplug);
513void pci_destroy_slot(struct pci_slot *slot); 520void pci_destroy_slot(struct pci_slot *slot);
514void pci_update_slot_number(struct pci_slot *slot, int slot_nr); 521void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
515int pci_scan_slot(struct pci_bus *bus, int devfn); 522int pci_scan_slot(struct pci_bus *bus, int devfn);
516struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 523struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
517void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 524void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@ -539,6 +546,13 @@ struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
539 unsigned int devfn); 546 unsigned int devfn);
540#endif /* CONFIG_PCI_LEGACY */ 547#endif /* CONFIG_PCI_LEGACY */
541 548
549enum pci_lost_interrupt_reason {
550 PCI_LOST_IRQ_NO_INFORMATION = 0,
551 PCI_LOST_IRQ_DISABLE_MSI,
552 PCI_LOST_IRQ_DISABLE_MSIX,
553 PCI_LOST_IRQ_DISABLE_ACPI,
554};
555enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
542int pci_find_capability(struct pci_dev *dev, int cap); 556int pci_find_capability(struct pci_dev *dev, int cap);
543int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 557int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
544int pci_find_ext_capability(struct pci_dev *dev, int cap); 558int pci_find_ext_capability(struct pci_dev *dev, int cap);
@@ -626,11 +640,15 @@ int pcix_get_mmrbc(struct pci_dev *dev);
626int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 640int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
627int pcie_get_readrq(struct pci_dev *dev); 641int pcie_get_readrq(struct pci_dev *dev);
628int pcie_set_readrq(struct pci_dev *dev, int rq); 642int pcie_set_readrq(struct pci_dev *dev, int rq);
643int pci_reset_function(struct pci_dev *dev);
644int pci_execute_reset_function(struct pci_dev *dev);
629void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 645void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
630int __must_check pci_assign_resource(struct pci_dev *dev, int i); 646int __must_check pci_assign_resource(struct pci_dev *dev, int i);
631int pci_select_bars(struct pci_dev *dev, unsigned long flags); 647int pci_select_bars(struct pci_dev *dev, unsigned long flags);
632 648
633/* ROM control related routines */ 649/* ROM control related routines */
650int pci_enable_rom(struct pci_dev *pdev);
651void pci_disable_rom(struct pci_dev *pdev);
634void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 652void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
635void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 653void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
636size_t pci_get_rom_size(void __iomem *rom, size_t size); 654size_t pci_get_rom_size(void __iomem *rom, size_t size);
@@ -643,6 +661,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
643bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 661bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
644void pci_pme_active(struct pci_dev *dev, bool enable); 662void pci_pme_active(struct pci_dev *dev, bool enable);
645int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 663int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
664int pci_wake_from_d3(struct pci_dev *dev, bool enable);
646pci_power_t pci_target_state(struct pci_dev *dev); 665pci_power_t pci_target_state(struct pci_dev *dev);
647int pci_prepare_to_sleep(struct pci_dev *dev); 666int pci_prepare_to_sleep(struct pci_dev *dev);
648int pci_back_from_sleep(struct pci_dev *dev); 667int pci_back_from_sleep(struct pci_dev *dev);
@@ -723,7 +742,7 @@ enum pci_dma_burst_strategy {
723}; 742};
724 743
725struct msix_entry { 744struct msix_entry {
726 u16 vector; /* kernel uses to write allocated vector */ 745 u32 vector; /* kernel uses to write allocated vector */
727 u16 entry; /* driver uses to specify entry, OS writes */ 746 u16 entry; /* driver uses to specify entry, OS writes */
728}; 747};
729 748
@@ -1116,5 +1135,20 @@ static inline void pci_mmcfg_early_init(void) { }
1116static inline void pci_mmcfg_late_init(void) { } 1135static inline void pci_mmcfg_late_init(void) { }
1117#endif 1136#endif
1118 1137
1138#ifdef CONFIG_HAS_IOMEM
1139static inline void * pci_ioremap_bar(struct pci_dev *pdev, int bar)
1140{
1141 /*
1142 * Make sure the BAR is actually a memory resource, not an IO resource
1143 */
1144 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1145 WARN_ON(1);
1146 return NULL;
1147 }
1148 return ioremap_nocache(pci_resource_start(pdev, bar),
1149 pci_resource_len(pdev, bar));
1150}
1151#endif
1152
1119#endif /* __KERNEL__ */ 1153#endif /* __KERNEL__ */
1120#endif /* LINUX_PCI_H */ 1154#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a08cd06b541a..a00bd1a0f156 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -142,8 +142,6 @@ struct hotplug_slot_info {
142 142
143/** 143/**
144 * struct hotplug_slot - used to register a physical slot with the hotplug pci core 144 * struct hotplug_slot - used to register a physical slot with the hotplug pci core
145 * @name: the name of the slot being registered. This string must
146 * be unique amoung slots registered on this system.
147 * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot 145 * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
148 * @info: pointer to the &struct hotplug_slot_info for the initial values for 146 * @info: pointer to the &struct hotplug_slot_info for the initial values for
149 * this slot. 147 * this slot.
@@ -153,7 +151,6 @@ struct hotplug_slot_info {
153 * needs. 151 * needs.
154 */ 152 */
155struct hotplug_slot { 153struct hotplug_slot {
156 char *name;
157 struct hotplug_slot_ops *ops; 154 struct hotplug_slot_ops *ops;
158 struct hotplug_slot_info *info; 155 struct hotplug_slot_info *info;
159 void (*release) (struct hotplug_slot *slot); 156 void (*release) (struct hotplug_slot *slot);
@@ -165,7 +162,13 @@ struct hotplug_slot {
165}; 162};
166#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) 163#define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
167 164
168extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr); 165static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
166{
167 return pci_slot_name(slot->pci_slot);
168}
169
170extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr,
171 const char *name);
169extern int pci_hp_deregister(struct hotplug_slot *slot); 172extern int pci_hp_deregister(struct hotplug_slot *slot);
170extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 173extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
171 struct hotplug_slot_info *info); 174 struct hotplug_slot_info *info);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f1624b396754..1800f1d6e40d 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -497,6 +497,16 @@
497#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 497#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101
498#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 498#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102
499#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 499#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
500#define PCI_DEVICE_ID_AMD_10H_NB_HT 0x1200
501#define PCI_DEVICE_ID_AMD_10H_NB_MAP 0x1201
502#define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202
503#define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203
504#define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204
505#define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300
506#define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301
507#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
508#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
509#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
500#define PCI_DEVICE_ID_AMD_LANCE 0x2000 510#define PCI_DEVICE_ID_AMD_LANCE 0x2000
501#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 511#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
502#define PCI_DEVICE_ID_AMD_SCSI 0x2020 512#define PCI_DEVICE_ID_AMD_SCSI 0x2020
@@ -577,6 +587,7 @@
577#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 587#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
578#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 588#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
579#define PCI_DEVICE_ID_MATROX_G400 0x0525 589#define PCI_DEVICE_ID_MATROX_G400 0x0525
590#define PCI_DEVICE_ID_MATROX_G200EV_PCI 0x0530
580#define PCI_DEVICE_ID_MATROX_G550 0x2527 591#define PCI_DEVICE_ID_MATROX_G550 0x2527
581#define PCI_DEVICE_ID_MATROX_VIA 0x4536 592#define PCI_DEVICE_ID_MATROX_VIA 0x4536
582 593
@@ -1411,6 +1422,8 @@
1411#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 1422#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
1412#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 1423#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014
1413 1424
1425#define PCI_VENDOR_ID_CISCO 0x1137
1426
1414#define PCI_VENDOR_ID_ZIATECH 0x1138 1427#define PCI_VENDOR_ID_ZIATECH 0x1138
1415#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 1428#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550
1416 1429
@@ -1521,7 +1534,9 @@
1521#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 1534#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430
1522#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 1535#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460
1523#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 1536#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480
1524#define PCI_DEVICE_ID_MARVELL_CAFE_SD 0x4101 1537#define PCI_DEVICE_ID_MARVELL_88ALP01_NAND 0x4100
1538#define PCI_DEVICE_ID_MARVELL_88ALP01_SD 0x4101
1539#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102
1525 1540
1526#define PCI_VENDOR_ID_V3 0x11b0 1541#define PCI_VENDOR_ID_V3 0x11b0
1527#define PCI_DEVICE_ID_V3_V960 0x0001 1542#define PCI_DEVICE_ID_V3_V960 0x0001
@@ -1929,6 +1944,14 @@
1929 1944
1930#define PCI_VENDOR_ID_OXSEMI 0x1415 1945#define PCI_VENDOR_ID_OXSEMI 0x1415
1931#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 1946#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
1947#define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000
1948#define PCI_DEVICE_ID_OXSEMI_PCIe840_G 0xC004
1949#define PCI_DEVICE_ID_OXSEMI_PCIe952_0 0xC100
1950#define PCI_DEVICE_ID_OXSEMI_PCIe952_0_G 0xC104
1951#define PCI_DEVICE_ID_OXSEMI_PCIe952_1 0xC110
1952#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_G 0xC114
1953#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118
1954#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C
1932#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 1955#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
1933#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 1956#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
1934#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 1957#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513
@@ -2213,6 +2236,7 @@
2213 2236
2214#define PCI_VENDOR_ID_ATTANSIC 0x1969 2237#define PCI_VENDOR_ID_ATTANSIC 0x1969
2215#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 2238#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048
2239#define PCI_DEVICE_ID_ATTANSIC_L2 0x2048
2216 2240
2217#define PCI_VENDOR_ID_JMICRON 0x197B 2241#define PCI_VENDOR_ID_JMICRON 0x197B
2218#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 2242#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
@@ -2244,6 +2268,16 @@
2244#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 2268#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
2245#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 2269#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009
2246 2270
2271#define PCI_VENDOR_ID_NETXEN 0x4040
2272#define PCI_DEVICE_ID_NX2031_10GXSR 0x0001
2273#define PCI_DEVICE_ID_NX2031_10GCX4 0x0002
2274#define PCI_DEVICE_ID_NX2031_4GCU 0x0003
2275#define PCI_DEVICE_ID_NX2031_IMEZ 0x0004
2276#define PCI_DEVICE_ID_NX2031_HMEZ 0x0005
2277#define PCI_DEVICE_ID_NX2031_XG_MGMT 0x0024
2278#define PCI_DEVICE_ID_NX2031_XG_MGMT2 0x0025
2279#define PCI_DEVICE_ID_NX3031 0x0100
2280
2247#define PCI_VENDOR_ID_AKS 0x416c 2281#define PCI_VENDOR_ID_AKS 0x416c
2248#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2282#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2249 2283
@@ -2422,15 +2456,16 @@
2422#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a 2456#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
2423#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2457#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2424#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2458#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2459#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c
2425#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 2460#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14
2426#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 2461#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16
2427#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 2462#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18
2428#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2463#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a
2429#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2464#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2430#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2465#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2431#define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10 2466#define PCI_DEVICE_ID_INTEL_PCH_LPC_MIN 0x3b00
2432#define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11 2467#define PCI_DEVICE_ID_INTEL_PCH_LPC_MAX 0x3b1f
2433#define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30 2468#define PCI_DEVICE_ID_INTEL_PCH_SMBUS 0x3b30
2434#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2469#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2435#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2470#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2436#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2471#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 450684f7eaac..e5effd47ed74 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -377,6 +377,7 @@
377#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */ 377#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */
378#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ 378#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
379#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ 379#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
380#define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */
380#define PCI_EXP_DEVCTL 8 /* Device Control */ 381#define PCI_EXP_DEVCTL 8 /* Device Control */
381#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ 382#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
382#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ 383#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
@@ -389,6 +390,7 @@
389#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ 390#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
390#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ 391#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */
391#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ 392#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */
393#define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */
392#define PCI_EXP_DEVSTA 10 /* Device Status */ 394#define PCI_EXP_DEVSTA 10 /* Device Status */
393#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ 395#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */
394#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ 396#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */
@@ -419,6 +421,10 @@
419#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ 421#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
420#define PCI_EXP_RTCAP 30 /* Root Capabilities */ 422#define PCI_EXP_RTCAP 30 /* Root Capabilities */
421#define PCI_EXP_RTSTA 32 /* Root Status */ 423#define PCI_EXP_RTSTA 32 /* Root Status */
424#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */
425#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
426#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
427#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */
422 428
423/* Extended Capabilities (PCI-X 2.0 and Express) */ 429/* Extended Capabilities (PCI-X 2.0 and Express) */
424#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) 430#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
@@ -429,6 +435,7 @@
429#define PCI_EXT_CAP_ID_VC 2 435#define PCI_EXT_CAP_ID_VC 2
430#define PCI_EXT_CAP_ID_DSN 3 436#define PCI_EXT_CAP_ID_DSN 3
431#define PCI_EXT_CAP_ID_PWR 4 437#define PCI_EXT_CAP_ID_PWR 4
438#define PCI_EXT_CAP_ID_ARI 14
432 439
433/* Advanced Error Reporting */ 440/* Advanced Error Reporting */
434#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 441#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -536,5 +543,14 @@
536#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ 543#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */
537#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ 544#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */
538 545
546/* Alternative Routing-ID Interpretation */
547#define PCI_ARI_CAP 0x04 /* ARI Capability Register */
548#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */
549#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */
550#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */
551#define PCI_ARI_CTRL 0x06 /* ARI Control Register */
552#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */
553#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
554#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
539 555
540#endif /* LINUX_PCI_REGS_H */ 556#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index fac3337547eb..9f2a3751873a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -23,12 +23,19 @@
23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ 23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \
24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ 24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
25 ____cacheline_aligned_in_smp 25 ____cacheline_aligned_in_smp
26
27#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
28 __attribute__((__section__(".data.percpu.page_aligned"))) \
29 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
26#else 30#else
27#define DEFINE_PER_CPU(type, name) \ 31#define DEFINE_PER_CPU(type, name) \
28 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 32 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
29 33
30#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ 34#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
31 DEFINE_PER_CPU(type, name) 35 DEFINE_PER_CPU(type, name)
36
37#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
38 DEFINE_PER_CPU(type, name)
32#endif 39#endif
33 40
34#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 41#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 208388835357..9007ccdfc112 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -35,7 +35,7 @@ int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 35void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 36void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
38s64 __percpu_counter_sum(struct percpu_counter *fbc, int set); 38s64 __percpu_counter_sum(struct percpu_counter *fbc);
39 39
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 41{
@@ -44,19 +44,13 @@ static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
44 44
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
46{ 46{
47 s64 ret = __percpu_counter_sum(fbc, 0); 47 s64 ret = __percpu_counter_sum(fbc);
48 return ret < 0 ? 0 : ret; 48 return ret < 0 ? 0 : ret;
49} 49}
50 50
51static inline s64 percpu_counter_sum_and_set(struct percpu_counter *fbc)
52{
53 return __percpu_counter_sum(fbc, 1);
54}
55
56
57static inline s64 percpu_counter_sum(struct percpu_counter *fbc) 51static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
58{ 52{
59 return __percpu_counter_sum(fbc, 0); 53 return __percpu_counter_sum(fbc);
60} 54}
61 55
62static inline s64 percpu_counter_read(struct percpu_counter *fbc) 56static inline s64 percpu_counter_read(struct percpu_counter *fbc)
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 700725ddcaae..01b262959f2e 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -226,6 +226,15 @@ struct sadb_x_sec_ctx {
226} __attribute__((packed)); 226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */ 227/* sizeof(struct sadb_sec_ctx) = 8 */
228 228
229/* Used by MIGRATE to pass addresses IKE will use to perform
230 * negotiation with the peer */
231struct sadb_x_kmaddress {
232 uint16_t sadb_x_kmaddress_len;
233 uint16_t sadb_x_kmaddress_exttype;
234 uint32_t sadb_x_kmaddress_reserved;
235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */
237
229/* Message types */ 238/* Message types */
230#define SADB_RESERVED 0 239#define SADB_RESERVED 0
231#define SADB_GETSPI 1 240#define SADB_GETSPI 1
@@ -346,7 +355,9 @@ struct sadb_x_sec_ctx {
346#define SADB_X_EXT_NAT_T_DPORT 22 355#define SADB_X_EXT_NAT_T_DPORT 22
347#define SADB_X_EXT_NAT_T_OA 23 356#define SADB_X_EXT_NAT_T_OA 23
348#define SADB_X_EXT_SEC_CTX 24 357#define SADB_X_EXT_SEC_CTX 24
349#define SADB_EXT_MAX 24 358/* Used with MIGRATE to pass @ to IKE for negotiation */
359#define SADB_X_EXT_KMADDRESS 25
360#define SADB_EXT_MAX 25
350 361
351/* Identity Extension values */ 362/* Identity Extension values */
352#define SADB_IDENTTYPE_RESERVED 0 363#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/pfn.h b/include/linux/pfn.h
index bb01f8b92b56..7646637221f3 100644
--- a/include/linux/pfn.h
+++ b/include/linux/pfn.h
@@ -1,9 +1,13 @@
1#ifndef _LINUX_PFN_H_ 1#ifndef _LINUX_PFN_H_
2#define _LINUX_PFN_H_ 2#define _LINUX_PFN_H_
3 3
4#ifndef __ASSEMBLY__
5#include <linux/types.h>
6#endif
7
4#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) 8#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
5#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 9#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
6#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) 10#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
7#define PFN_PHYS(x) ((x) << PAGE_SHIFT) 11#define PFN_PHYS(x) ((phys_addr_t)(x) << PAGE_SHIFT)
8 12
9#endif 13#endif
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
new file mode 100644
index 000000000000..4157faa857b6
--- /dev/null
+++ b/include/linux/phonet.h
@@ -0,0 +1,171 @@
1/**
2 * file phonet.h
3 *
4 * Phonet sockets kernel interface
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
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 * version 2 as published by the Free Software Foundation.
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef LINUX_PHONET_H
24#define LINUX_PHONET_H
25
26/* Automatic protocol selection */
27#define PN_PROTO_TRANSPORT 0
28/* Phonet datagram socket */
29#define PN_PROTO_PHONET 1
30/* Phonet pipe */
31#define PN_PROTO_PIPE 2
32#define PHONET_NPROTO 3
33
34/* Socket options for SOL_PNPIPE level */
35#define PNPIPE_ENCAP 1
36#define PNPIPE_IFINDEX 2
37
38#define PNADDR_ANY 0
39#define PNPORT_RESOURCE_ROUTING 0
40
41/* Values for PNPIPE_ENCAP option */
42#define PNPIPE_ENCAP_NONE 0
43#define PNPIPE_ENCAP_IP 1
44
45/* ioctls */
46#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
47
48/* Phonet protocol header */
49struct phonethdr {
50 __u8 pn_rdev;
51 __u8 pn_sdev;
52 __u8 pn_res;
53 __be16 pn_length;
54 __u8 pn_robj;
55 __u8 pn_sobj;
56} __attribute__((packed));
57
58/* Common Phonet payload header */
59struct phonetmsg {
60 __u8 pn_trans_id; /* transaction ID */
61 __u8 pn_msg_id; /* message type */
62 union {
63 struct {
64 __u8 pn_submsg_id; /* message subtype */
65 __u8 pn_data[5];
66 } base;
67 struct {
68 __u16 pn_e_res_id; /* extended resource ID */
69 __u8 pn_e_submsg_id; /* message subtype */
70 __u8 pn_e_data[3];
71 } ext;
72 } pn_msg_u;
73};
74#define PN_COMMON_MESSAGE 0xF0
75#define PN_COMMGR 0x10
76#define PN_PREFIX 0xE0 /* resource for extended messages */
77#define pn_submsg_id pn_msg_u.base.pn_submsg_id
78#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id
79#define pn_e_res_id pn_msg_u.ext.pn_e_res_id
80#define pn_data pn_msg_u.base.pn_data
81#define pn_e_data pn_msg_u.ext.pn_e_data
82
83/* data for unreachable errors */
84#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01
85#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14
86#define pn_orig_msg_id pn_data[0]
87#define pn_status pn_data[1]
88#define pn_e_orig_msg_id pn_e_data[0]
89#define pn_e_status pn_e_data[1]
90
91/* Phonet socket address structure */
92struct sockaddr_pn {
93 sa_family_t spn_family;
94 __u8 spn_obj;
95 __u8 spn_dev;
96 __u8 spn_resource;
97 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
98} __attribute__ ((packed));
99
100static inline __u16 pn_object(__u8 addr, __u16 port)
101{
102 return (addr << 8) | (port & 0x3ff);
103}
104
105static inline __u8 pn_obj(__u16 handle)
106{
107 return handle & 0xff;
108}
109
110static inline __u8 pn_dev(__u16 handle)
111{
112 return handle >> 8;
113}
114
115static inline __u16 pn_port(__u16 handle)
116{
117 return handle & 0x3ff;
118}
119
120static inline __u8 pn_addr(__u16 handle)
121{
122 return (handle >> 8) & 0xfc;
123}
124
125static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
126{
127 spn->spn_dev &= 0x03;
128 spn->spn_dev |= addr & 0xfc;
129}
130
131static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
132{
133 spn->spn_dev &= 0xfc;
134 spn->spn_dev |= (port >> 8) & 0x03;
135 spn->spn_obj = port & 0xff;
136}
137
138static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,
139 __u16 handle)
140{
141 spn->spn_dev = pn_dev(handle);
142 spn->spn_obj = pn_obj(handle);
143}
144
145static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,
146 __u8 resource)
147{
148 spn->spn_resource = resource;
149}
150
151static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)
152{
153 return spn->spn_dev & 0xfc;
154}
155
156static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)
157{
158 return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;
159}
160
161static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)
162{
163 return pn_object(spn->spn_dev, spn->spn_obj);
164}
165
166static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
167{
168 return spn->spn_resource;
169}
170
171#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 7224c4099a28..77c4ed60b982 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -99,7 +99,14 @@ struct mii_bus {
99 */ 99 */
100 struct mutex mdio_lock; 100 struct mutex mdio_lock;
101 101
102 struct device *dev; 102 struct device *parent;
103 enum {
104 MDIOBUS_ALLOCATED = 1,
105 MDIOBUS_REGISTERED,
106 MDIOBUS_UNREGISTERED,
107 MDIOBUS_RELEASED,
108 } state;
109 struct device dev;
103 110
104 /* list of all PHYs on bus */ 111 /* list of all PHYs on bus */
105 struct phy_device *phy_map[PHY_MAX_ADDR]; 112 struct phy_device *phy_map[PHY_MAX_ADDR];
@@ -113,6 +120,16 @@ struct mii_bus {
113 */ 120 */
114 int *irq; 121 int *irq;
115}; 122};
123#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
124
125struct mii_bus *mdiobus_alloc(void);
126int mdiobus_register(struct mii_bus *bus);
127void mdiobus_unregister(struct mii_bus *bus);
128void mdiobus_free(struct mii_bus *bus);
129struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
130int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum);
131int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val);
132
116 133
117#define PHY_INTERRUPT_DISABLED 0x0 134#define PHY_INTERRUPT_DISABLED 0x0
118#define PHY_INTERRUPT_ENABLED 0x80000000 135#define PHY_INTERRUPT_ENABLED 0x80000000
@@ -391,8 +408,35 @@ struct phy_fixup {
391 int (*run)(struct phy_device *phydev); 408 int (*run)(struct phy_device *phydev);
392}; 409};
393 410
394int phy_read(struct phy_device *phydev, u16 regnum); 411/**
395int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 412 * phy_read - Convenience function for reading a given PHY register
413 * @phydev: the phy_device struct
414 * @regnum: register number to read
415 *
416 * NOTE: MUST NOT be called from interrupt context,
417 * because the bus read/write functions may wait for an interrupt
418 * to conclude the operation.
419 */
420static inline int phy_read(struct phy_device *phydev, u16 regnum)
421{
422 return mdiobus_read(phydev->bus, phydev->addr, regnum);
423}
424
425/**
426 * phy_write - Convenience function for writing a given PHY register
427 * @phydev: the phy_device struct
428 * @regnum: register number to write
429 * @val: value to write to @regnum
430 *
431 * NOTE: MUST NOT be called from interrupt context,
432 * because the bus read/write functions may wait for an interrupt
433 * to conclude the operation.
434 */
435static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
436{
437 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
438}
439
396int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 440int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
397struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 441struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
398int phy_clear_interrupt(struct phy_device *phydev); 442int phy_clear_interrupt(struct phy_device *phydev);
@@ -408,8 +452,6 @@ void phy_start(struct phy_device *phydev);
408void phy_stop(struct phy_device *phydev); 452void phy_stop(struct phy_device *phydev);
409int phy_start_aneg(struct phy_device *phydev); 453int phy_start_aneg(struct phy_device *phydev);
410 454
411int mdiobus_register(struct mii_bus *bus);
412void mdiobus_unregister(struct mii_bus *bus);
413void phy_sanitize_settings(struct phy_device *phydev); 455void phy_sanitize_settings(struct phy_device *phydev);
414int phy_stop_interrupts(struct phy_device *phydev); 456int phy_stop_interrupts(struct phy_device *phydev);
415int phy_enable_interrupts(struct phy_device *phydev); 457int phy_enable_interrupts(struct phy_device *phydev);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 1af82c4e17d4..d82fe825d62f 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -84,12 +84,6 @@ static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
84 return tsk->nsproxy->pid_ns; 84 return tsk->nsproxy->pid_ns;
85} 85}
86 86
87static inline struct task_struct *task_child_reaper(struct task_struct *tsk)
88{
89 BUG_ON(tsk != current);
90 return tsk->nsproxy->pid_ns->child_reaper;
91}
92
93void pidhash_init(void); 87void pidhash_init(void);
94void pidmap_init(void); 88void pidmap_init(void);
95 89
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e5de421ac7b4..5d921fa91a5b 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -123,6 +123,13 @@ struct tc_prio_qopt
123 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ 123 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
124}; 124};
125 125
126/* MULTIQ section */
127
128struct tc_multiq_qopt {
129 __u16 bands; /* Number of bands */
130 __u16 max_bands; /* Maximum number of queues */
131};
132
126/* TBF section */ 133/* TBF section */
127 134
128struct tc_tbf_qopt 135struct tc_tbf_qopt
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 95ac21ab3a09..4b8cc6a32479 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -37,6 +37,8 @@ extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(const char *, int id, 38extern struct platform_device *platform_device_register_simple(const char *, int id,
39 struct resource *, unsigned int); 39 struct resource *, unsigned int);
40extern struct platform_device *platform_device_register_data(struct device *,
41 const char *, int, const void *, size_t);
40 42
41extern struct platform_device *platform_device_alloc(const char *name, int id); 43extern struct platform_device *platform_device_alloc(const char *name, int id);
42extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 44extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 4dcce54b6d76..42de4003c4ee 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -419,7 +419,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
419 419
420#define suspend_report_result(fn, ret) \ 420#define suspend_report_result(fn, ret) \
421 do { \ 421 do { \
422 __suspend_report_result(__FUNCTION__, fn, ret); \ 422 __suspend_report_result(__func__, fn, ret); \
423 } while (0) 423 } while (0)
424 424
425#else /* !CONFIG_PM_SLEEP */ 425#else /* !CONFIG_PM_SLEEP */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index be764e514e35..ca3c88773028 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -22,9 +22,11 @@ struct pnp_dev;
22 * Resource Management 22 * Resource Management
23 */ 23 */
24#ifdef CONFIG_PNP 24#ifdef CONFIG_PNP
25struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); 25struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned long type,
26 unsigned int num);
26#else 27#else
27static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num) 28static inline struct resource *pnp_get_resource(struct pnp_dev *dev,
29 unsigned long type, unsigned int num)
28{ 30{
29 return NULL; 31 return NULL;
30} 32}
@@ -483,14 +485,4 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
483 485
484#endif /* CONFIG_PNP */ 486#endif /* CONFIG_PNP */
485 487
486#define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
487#define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
488#define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
489
490#ifdef CONFIG_PNP_DEBUG
491#define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg)
492#else
493#define pnp_dbg(format, arg...) do {} while (0)
494#endif
495
496#endif /* _LINUX_PNP_H */ 488#endif /* _LINUX_PNP_H */
diff --git a/include/linux/poll.h b/include/linux/poll.h
index ef453828877a..badd98ab06f6 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -114,11 +114,13 @@ void zero_fd_set(unsigned long nr, unsigned long *fdset)
114 114
115#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1) 115#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
116 116
117extern int do_select(int n, fd_set_bits *fds, s64 *timeout); 117extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time);
118extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, 118extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
119 s64 *timeout); 119 struct timespec *end_time);
120extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, 120extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
121 fd_set __user *exp, s64 *timeout); 121 fd_set __user *exp, struct timespec *end_time);
122
123extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec);
122 124
123#endif /* KERNEL */ 125#endif /* KERNEL */
124 126
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index a7dd38f30ade..a7c721355549 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -45,8 +45,6 @@ struct k_itimer {
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 int it_sigev_signo; /* signo word of sigevent struct */
49 sigval_t it_sigev_value; /* value word of sigevent struct */
50 struct task_struct *it_process; /* process to send signal to */ 48 struct task_struct *it_process; /* process to send signal to */
51 struct sigqueue *sigq; /* signal queue entry. */ 49 struct sigqueue *sigq; /* signal queue entry. */
52 union { 50 union {
@@ -115,4 +113,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
115 113
116long clock_nanosleep_restart(struct restart_block *restart_block); 114long clock_nanosleep_restart(struct restart_block *restart_block);
117 115
116void update_rlimit_cpu(unsigned long rlim_new);
117
118#endif 118#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ea96ead1d39d..f9348cba6dc1 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -165,6 +165,12 @@ struct power_supply_info {
165extern void power_supply_changed(struct power_supply *psy); 165extern void power_supply_changed(struct power_supply *psy);
166extern int power_supply_am_i_supplied(struct power_supply *psy); 166extern int power_supply_am_i_supplied(struct power_supply *psy);
167 167
168#if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE)
169extern int power_supply_is_system_supplied(void);
170#else
171static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
172#endif
173
168extern int power_supply_register(struct device *parent, 174extern int power_supply_register(struct device *parent,
169 struct power_supply *psy); 175 struct power_supply *psy);
170extern void power_supply_unregister(struct power_supply *psy); 176extern void power_supply_unregister(struct power_supply *psy);
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 5ad79198d6f9..48d887e3c6e7 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -78,4 +78,11 @@
78#define PR_GET_SECUREBITS 27 78#define PR_GET_SECUREBITS 27
79#define PR_SET_SECUREBITS 28 79#define PR_SET_SECUREBITS 28
80 80
81/*
82 * Get/set the timerslack as used by poll/select/nanosleep
83 * A value of 0 means "use default"
84 */
85#define PR_SET_TIMERSLACK 29
86#define PR_GET_TIMERSLACK 30
87
81#endif /* _LINUX_PRCTL_H */ 88#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index fb61850d1cfc..b8bdb96eff78 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -97,12 +97,9 @@ struct vmcore {
97 97
98#ifdef CONFIG_PROC_FS 98#ifdef CONFIG_PROC_FS
99 99
100extern struct proc_dir_entry *proc_root_kcore;
101
102extern spinlock_t proc_subdir_lock; 100extern spinlock_t proc_subdir_lock;
103 101
104extern void proc_root_init(void); 102extern void proc_root_init(void);
105extern void proc_misc_init(void);
106 103
107void proc_flush_task(struct task_struct *task); 104void proc_flush_task(struct task_struct *task);
108struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 105struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
@@ -138,9 +135,6 @@ extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct p
138extern int proc_readdir(struct file *, void *, filldir_t); 135extern int proc_readdir(struct file *, void *, filldir_t);
139extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 136extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
140 137
141extern const struct file_operations proc_kcore_operations;
142extern const struct file_operations ppc_htab_operations;
143
144extern int pid_ns_prepare_proc(struct pid_namespace *ns); 138extern int pid_ns_prepare_proc(struct pid_namespace *ns);
145extern void pid_ns_release_proc(struct pid_namespace *ns); 139extern void pid_ns_release_proc(struct pid_namespace *ns);
146 140
diff --git a/include/linux/profile.h b/include/linux/profile.h
index 7e7087239af5..a0fc32279fc0 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -19,10 +19,16 @@ struct notifier_block;
19 19
20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) 20#if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS)
21void create_prof_cpu_mask(struct proc_dir_entry *de); 21void create_prof_cpu_mask(struct proc_dir_entry *de);
22int create_proc_profile(void);
22#else 23#else
23static inline void create_prof_cpu_mask(struct proc_dir_entry *de) 24static inline void create_prof_cpu_mask(struct proc_dir_entry *de)
24{ 25{
25} 26}
27
28static inline int create_proc_profile(void)
29{
30 return 0;
31}
26#endif 32#endif
27 33
28enum profile_type { 34enum profile_type {
@@ -35,7 +41,8 @@ enum profile_type {
35extern int prof_on __read_mostly; 41extern int prof_on __read_mostly;
36 42
37/* init basic kernel profiler */ 43/* init basic kernel profiler */
38void __init profile_init(void); 44int profile_init(void);
45int profile_setup(char *str);
39void profile_tick(int type); 46void profile_tick(int type);
40 47
41/* 48/*
@@ -84,9 +91,9 @@ struct pt_regs;
84 91
85#define prof_on 0 92#define prof_on 0
86 93
87static inline void profile_init(void) 94static inline int profile_init(void)
88{ 95{
89 return; 96 return 0;
90} 97}
91 98
92static inline void profile_tick(int type) 99static inline void profile_tick(int type)
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 5afc1b23346d..cf793bbbd05e 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -104,8 +104,8 @@ struct prop_local_single {
104 * snapshot of the last seen global state 104 * snapshot of the last seen global state
105 * and a lock protecting this state 105 * and a lock protecting this state
106 */ 106 */
107 int shift;
108 unsigned long period; 107 unsigned long period;
108 int shift;
109 spinlock_t lock; /* protect the snapshot state */ 109 spinlock_t lock; /* protect the snapshot state */
110}; 110};
111 111
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ea7416c901d1..22641d5d45df 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,7 +94,6 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_untrace(struct task_struct *child);
98#define PTRACE_MODE_READ 1 97#define PTRACE_MODE_READ 1
99#define PTRACE_MODE_ATTACH 2 98#define PTRACE_MODE_ATTACH 2
100/* Returns 0 on success, -errno on denial. */ 99/* Returns 0 on success, -errno on denial. */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 376a05048bc5..40401b554484 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -28,8 +28,6 @@
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 *
32 * Version: $Id: quota.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
33 */ 31 */
34 32
35#ifndef _LINUX_QUOTA_ 33#ifndef _LINUX_QUOTA_
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index ca6b9b5c8d52..a558a4c1d35a 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -3,9 +3,6 @@
3 * macros expand to the right source-code. 3 * macros expand to the right source-code.
4 * 4 *
5 * Author: Marco van Wieringen <mvw@planets.elm.net> 5 * Author: Marco van Wieringen <mvw@planets.elm.net>
6 *
7 * Version: $Id: quotaops.h,v 1.2 1998/01/15 16:22:26 ecd Exp $
8 *
9 */ 6 */
10#ifndef _LINUX_QUOTAOPS_ 7#ifndef _LINUX_QUOTAOPS_
11#define _LINUX_QUOTAOPS_ 8#define _LINUX_QUOTAOPS_
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h
index 7e375111d007..f38b9c586afb 100644
--- a/include/linux/raid/linear.h
+++ b/include/linux/raid/linear.h
@@ -5,8 +5,8 @@
5 5
6struct dev_info { 6struct dev_info {
7 mdk_rdev_t *rdev; 7 mdk_rdev_t *rdev;
8 sector_t size; 8 sector_t num_sectors;
9 sector_t offset; 9 sector_t start_sector;
10}; 10};
11 11
12typedef struct dev_info dev_info_t; 12typedef struct dev_info dev_info_t;
@@ -15,9 +15,11 @@ struct linear_private_data
15{ 15{
16 struct linear_private_data *prev; /* earlier version */ 16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table; 17 dev_info_t **hash_table;
18 sector_t hash_spacing; 18 sector_t spacing;
19 sector_t array_sectors; 19 sector_t array_sectors;
20 int preshift; /* shift before dividing by hash_spacing */ 20 int sector_shift; /* shift before dividing
21 * by spacing
22 */
21 dev_info_t disks[0]; 23 dev_info_t disks[0];
22}; 24};
23 25
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index dc0e3fcb9f28..82bea14cae1a 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -19,27 +19,7 @@
19#define _MD_H 19#define _MD_H
20 20
21#include <linux/blkdev.h> 21#include <linux/blkdev.h>
22#include <linux/major.h>
23#include <linux/ioctl.h>
24#include <linux/types.h>
25#include <linux/bitops.h>
26#include <linux/module.h>
27#include <linux/hdreg.h>
28#include <linux/proc_fs.h>
29#include <linux/seq_file.h> 22#include <linux/seq_file.h>
30#include <linux/smp_lock.h>
31#include <linux/delay.h>
32#include <net/checksum.h>
33#include <linux/random.h>
34#include <linux/kernel_stat.h>
35#include <asm/io.h>
36#include <linux/completion.h>
37#include <linux/mempool.h>
38#include <linux/list.h>
39#include <linux/reboot.h>
40#include <linux/vmalloc.h>
41#include <linux/blkpg.h>
42#include <linux/bio.h>
43 23
44/* 24/*
45 * 'md_p.h' holds the 'physical' layout of RAID devices 25 * 'md_p.h' holds the 'physical' layout of RAID devices
@@ -74,19 +54,17 @@
74 54
75extern int mdp_major; 55extern int mdp_major;
76 56
77extern int register_md_personality (struct mdk_personality *p); 57extern int register_md_personality(struct mdk_personality *p);
78extern int unregister_md_personality (struct mdk_personality *p); 58extern int unregister_md_personality(struct mdk_personality *p);
79extern mdk_thread_t * md_register_thread (void (*run) (mddev_t *mddev), 59extern mdk_thread_t * md_register_thread(void (*run) (mddev_t *mddev),
80 mddev_t *mddev, const char *name); 60 mddev_t *mddev, const char *name);
81extern void md_unregister_thread (mdk_thread_t *thread); 61extern void md_unregister_thread(mdk_thread_t *thread);
82extern void md_wakeup_thread(mdk_thread_t *thread); 62extern void md_wakeup_thread(mdk_thread_t *thread);
83extern void md_check_recovery(mddev_t *mddev); 63extern void md_check_recovery(mddev_t *mddev);
84extern void md_write_start(mddev_t *mddev, struct bio *bi); 64extern void md_write_start(mddev_t *mddev, struct bio *bi);
85extern void md_write_end(mddev_t *mddev); 65extern void md_write_end(mddev_t *mddev);
86extern void md_handle_safemode(mddev_t *mddev);
87extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 66extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
88extern void md_error (mddev_t *mddev, mdk_rdev_t *rdev); 67extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
89extern void md_unplug_mddev(mddev_t *mddev);
90 68
91extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 69extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
92 sector_t sector, int size, struct page *page); 70 sector_t sector, int size, struct page *page);
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index c200b9a34aff..8fc909ef6787 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -115,6 +115,9 @@ struct mdk_rdev_s
115 * in superblock. 115 * in superblock.
116 */ 116 */
117 struct work_struct del_work; /* used for delayed sysfs removal */ 117 struct work_struct del_work; /* used for delayed sysfs removal */
118
119 struct sysfs_dirent *sysfs_state; /* handle for 'state'
120 * sysfs entry */
118}; 121};
119 122
120struct mddev_s 123struct mddev_s
@@ -128,7 +131,6 @@ struct mddev_s
128#define MD_CHANGE_DEVS 0 /* Some device status has changed */ 131#define MD_CHANGE_DEVS 0 /* Some device status has changed */
129#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ 132#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
130#define MD_CHANGE_PENDING 2 /* superblock update in progress */ 133#define MD_CHANGE_PENDING 2 /* superblock update in progress */
131#define MD_NOTIFY_ARRAY_STATE 3 /* atomic context wants to notify userspace */
132 134
133 int ro; 135 int ro;
134 136
@@ -239,6 +241,10 @@ struct mddev_s
239 sector_t resync_max; /* resync should pause 241 sector_t resync_max; /* resync should pause
240 * when it gets here */ 242 * when it gets here */
241 243
244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
245 * file in sysfs.
246 */
247
242 spinlock_t write_lock; 248 spinlock_t write_lock;
243 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 249 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
244 atomic_t pending_writes; /* number of active superblock writes */ 250 atomic_t pending_writes; /* number of active superblock writes */
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 4ab843622727..5f89b62e6983 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -40,12 +40,21 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
44#define RCU_SECONDS_TILL_STALL_CHECK ( 3 * HZ) /* for rcp->jiffies_stall */
45#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */
46#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
43 47
44/* Global control variables for rcupdate callback mechanism. */ 48/* Global control variables for rcupdate callback mechanism. */
45struct rcu_ctrlblk { 49struct rcu_ctrlblk {
46 long cur; /* Current batch number. */ 50 long cur; /* Current batch number. */
47 long completed; /* Number of the last completed batch */ 51 long completed; /* Number of the last completed batch */
48 int next_pending; /* Is the next batch already waiting? */ 52 long pending; /* Number of the last pending batch */
53#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
54 unsigned long gp_start; /* Time at which GP started in jiffies. */
55 unsigned long jiffies_stall;
56 /* Time at which to check for CPU stalls. */
57#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
49 58
50 int signaled; 59 int signaled;
51 60
@@ -66,11 +75,7 @@ static inline int rcu_batch_after(long a, long b)
66 return (a - b) > 0; 75 return (a - b) > 0;
67} 76}
68 77
69/* 78/* Per-CPU data for Read-Copy UPdate. */
70 * Per-CPU data for Read-Copy UPdate.
71 * nxtlist - new callbacks are added here
72 * curlist - current batch for which quiescent cycle started if any
73 */
74struct rcu_data { 79struct rcu_data {
75 /* 1) quiescent state handling : */ 80 /* 1) quiescent state handling : */
76 long quiescbatch; /* Batch # for grace period */ 81 long quiescbatch; /* Batch # for grace period */
@@ -78,12 +83,24 @@ struct rcu_data {
78 int qs_pending; /* core waits for quiesc state */ 83 int qs_pending; /* core waits for quiesc state */
79 84
80 /* 2) batch handling */ 85 /* 2) batch handling */
81 long batch; /* Batch # for current RCU batch */ 86 /*
87 * if nxtlist is not NULL, then:
88 * batch:
89 * The batch # for the last entry of nxtlist
90 * [*nxttail[1], NULL = *nxttail[2]):
91 * Entries that batch # <= batch
92 * [*nxttail[0], *nxttail[1]):
93 * Entries that batch # <= batch - 1
94 * [nxtlist, *nxttail[0]):
95 * Entries that batch # <= batch - 2
96 * The grace period for these entries has completed, and
97 * the other grace-period-completed entries may be moved
98 * here temporarily in rcu_process_callbacks().
99 */
100 long batch;
82 struct rcu_head *nxtlist; 101 struct rcu_head *nxtlist;
83 struct rcu_head **nxttail; 102 struct rcu_head **nxttail[3];
84 long qlen; /* # of queued callbacks */ 103 long qlen; /* # of queued callbacks */
85 struct rcu_head *curlist;
86 struct rcu_head **curtail;
87 struct rcu_head *donelist; 104 struct rcu_head *donelist;
88 struct rcu_head **donetail; 105 struct rcu_head **donetail;
89 long blimit; /* Upper limit on a processed batch */ 106 long blimit; /* Upper limit on a processed batch */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index eb4443c7e05b..e649bd3f2c97 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -198,20 +198,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
198 at->prev = last; 198 at->prev = last;
199} 199}
200 200
201/**
202 * list_for_each_rcu - iterate over an rcu-protected list
203 * @pos: the &struct list_head to use as a loop cursor.
204 * @head: the head for your list.
205 *
206 * This list-traversal primitive may safely run concurrently with
207 * the _rcu list-mutation primitives such as list_add_rcu()
208 * as long as the traversal is guarded by rcu_read_lock().
209 */
210#define list_for_each_rcu(pos, head) \
211 for (pos = rcu_dereference((head)->next); \
212 prefetch(pos->next), pos != (head); \
213 pos = rcu_dereference(pos->next))
214
215#define __list_for_each_rcu(pos, head) \ 201#define __list_for_each_rcu(pos, head) \
216 for (pos = rcu_dereference((head)->next); \ 202 for (pos = rcu_dereference((head)->next); \
217 pos != (head); \ 203 pos != (head); \
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e8b4039cfb2f..86f1f5e43e33 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -133,6 +133,26 @@ struct rcu_head {
133#define rcu_read_unlock_bh() __rcu_read_unlock_bh() 133#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
134 134
135/** 135/**
136 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section
137 *
138 * Should be used with either
139 * - synchronize_sched()
140 * or
141 * - call_rcu_sched() and rcu_barrier_sched()
142 * on the write-side to insure proper synchronization.
143 */
144#define rcu_read_lock_sched() preempt_disable()
145
146/*
147 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
148 *
149 * See rcu_read_lock_sched for more information.
150 */
151#define rcu_read_unlock_sched() preempt_enable()
152
153
154
155/**
136 * rcu_dereference - fetch an RCU-protected pointer in an 156 * rcu_dereference - fetch an RCU-protected pointer in an
137 * RCU read-side critical section. This pointer may later 157 * RCU read-side critical section. This pointer may later
138 * be safely dereferenced. 158 * be safely dereferenced.
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 0967f03b0705..3e05c09b54a2 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -57,7 +57,13 @@ static inline void rcu_qsctr_inc(int cpu)
57 rdssp->sched_qs++; 57 rdssp->sched_qs++;
58} 58}
59#define rcu_bh_qsctr_inc(cpu) 59#define rcu_bh_qsctr_inc(cpu)
60#define call_rcu_bh(head, rcu) call_rcu(head, rcu) 60
61/*
62 * Someone might want to pass call_rcu_bh as a function pointer.
63 * So this needs to just be a rename and not a macro function.
64 * (no parentheses)
65 */
66#define call_rcu_bh call_rcu
61 67
62/** 68/**
63 * call_rcu_sched - Queue RCU callback for invocation after sched grace period. 69 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -111,7 +117,6 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
111struct softirq_action; 117struct softirq_action;
112 118
113#ifdef CONFIG_NO_HZ 119#ifdef CONFIG_NO_HZ
114DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
115 120
116static inline void rcu_enter_nohz(void) 121static inline void rcu_enter_nohz(void)
117{ 122{
@@ -126,8 +131,8 @@ static inline void rcu_exit_nohz(void)
126{ 131{
127 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); 132 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
128 133
129 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
130 __get_cpu_var(rcu_dyntick_sched).dynticks++; 134 __get_cpu_var(rcu_dyntick_sched).dynticks++;
135 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
131 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), 136 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
132 &rs); 137 &rs);
133} 138}
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 1d712c7172a2..e37d80561985 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -18,8 +18,8 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
20 20
21struct regulator_constraints;
22struct regulator_dev; 21struct regulator_dev;
22struct regulator_init_data;
23 23
24/** 24/**
25 * struct regulator_ops - regulator operations. 25 * struct regulator_ops - regulator operations.
@@ -51,7 +51,7 @@ struct regulator_ops {
51 int output_uV, int load_uA); 51 int output_uV, int load_uA);
52 52
53 /* the operations below are for configuration of regulator state when 53 /* the operations below are for configuration of regulator state when
54 * it's parent PMIC enters a global STANBY/HIBERNATE state */ 54 * its parent PMIC enters a global STANDBY/HIBERNATE state */
55 55
56 /* set regulator suspend voltage */ 56 /* set regulator suspend voltage */
57 int (*set_suspend_voltage) (struct regulator_dev *, int uV); 57 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
@@ -85,15 +85,17 @@ struct regulator_desc {
85 struct module *owner; 85 struct module *owner;
86}; 86};
87 87
88
89struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 88struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
90 void *reg_data); 89 struct device *dev, void *driver_data);
91void regulator_unregister(struct regulator_dev *rdev); 90void regulator_unregister(struct regulator_dev *rdev);
92 91
93int regulator_notifier_call_chain(struct regulator_dev *rdev, 92int regulator_notifier_call_chain(struct regulator_dev *rdev,
94 unsigned long event, void *data); 93 unsigned long event, void *data);
95 94
96void *rdev_get_drvdata(struct regulator_dev *rdev); 95void *rdev_get_drvdata(struct regulator_dev *rdev);
96struct device *rdev_get_dev(struct regulator_dev *rdev);
97int rdev_get_id(struct regulator_dev *rdev); 97int rdev_get_id(struct regulator_dev *rdev);
98 98
99void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
100
99#endif 101#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 11e737dbfcf2..c6d69331a81e 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -89,15 +89,33 @@ struct regulation_constraints {
89 unsigned apply_uV:1; /* apply uV constraint iff min == max */ 89 unsigned apply_uV:1; /* apply uV constraint iff min == max */
90}; 90};
91 91
92int regulator_set_supply(const char *regulator, const char *regulator_supply); 92/**
93 * struct regulator_consumer_supply - supply -> device mapping
94 *
95 * This maps a supply name to a device.
96 */
97struct regulator_consumer_supply {
98 struct device *dev; /* consumer */
99 const char *supply; /* consumer supply - e.g. "vcc" */
100};
93 101
94const char *regulator_get_supply(const char *regulator); 102/**
103 * struct regulator_init_data - regulator platform initialisation data.
104 *
105 * Initialisation constraints, our supply and consumers supplies.
106 */
107struct regulator_init_data {
108 struct device *supply_regulator_dev; /* or NULL for LINE */
95 109
96int regulator_set_machine_constraints(const char *regulator, 110 struct regulation_constraints constraints;
97 struct regulation_constraints *constraints);
98 111
99int regulator_set_device_supply(const char *regulator, struct device *dev, 112 int num_consumer_supplies;
100 const char *supply); 113 struct regulator_consumer_supply *consumer_supplies;
114
115 /* optional regulator machine specific init */
116 int (*regulator_init)(void *driver_data);
117 void *driver_data; /* core does not touch this */
118};
101 119
102int regulator_suspend_prepare(suspend_state_t state); 120int regulator_suspend_prepare(suspend_state_t state);
103 121
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index e9963af16cda..bc5114d35e99 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -87,7 +87,7 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
87if( !( cond ) ) \ 87if( !( cond ) ) \
88 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 88 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
89 __FILE__ ":%i:%s: " format "\n", \ 89 __FILE__ ":%i:%s: " format "\n", \
90 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args ) 90 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __func__ , ##args )
91 91
92#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 92#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
93 93
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 315517e8bfa1..bda6b562a1e0 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -178,6 +178,7 @@ struct reiserfs_journal {
178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */ 178 struct reiserfs_journal_cnode *j_first; /* oldest journal block. start here for traverse */
179 179
180 struct block_device *j_dev_bd; 180 struct block_device *j_dev_bd;
181 fmode_t j_dev_mode;
181 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
182 183
183 unsigned long j_state; 184 unsigned long j_state;
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 741d1a62cc3f..4cd64b0d9825 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -49,6 +49,7 @@ enum rfkill_state {
49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ 49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */
50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ 50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */
51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ 51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */
52 RFKILL_STATE_MAX, /* marker for last valid state */
52}; 53};
53 54
54/* 55/*
@@ -110,12 +111,14 @@ struct rfkill {
110}; 111};
111#define to_rfkill(d) container_of(d, struct rfkill, dev) 112#define to_rfkill(d) container_of(d, struct rfkill, dev)
112 113
113struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type); 114struct rfkill * __must_check rfkill_allocate(struct device *parent,
115 enum rfkill_type type);
114void rfkill_free(struct rfkill *rfkill); 116void rfkill_free(struct rfkill *rfkill);
115int rfkill_register(struct rfkill *rfkill); 117int __must_check rfkill_register(struct rfkill *rfkill);
116void rfkill_unregister(struct rfkill *rfkill); 118void rfkill_unregister(struct rfkill *rfkill);
117 119
118int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); 120int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state);
121int rfkill_set_default(enum rfkill_type type, enum rfkill_state state);
119 122
120/** 123/**
121 * rfkill_state_complement - return complementar state 124 * rfkill_state_complement - return complementar state
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
new file mode 100644
index 000000000000..536b0ca46a03
--- /dev/null
+++ b/include/linux/ring_buffer.h
@@ -0,0 +1,127 @@
1#ifndef _LINUX_RING_BUFFER_H
2#define _LINUX_RING_BUFFER_H
3
4#include <linux/mm.h>
5#include <linux/seq_file.h>
6
7struct ring_buffer;
8struct ring_buffer_iter;
9
10/*
11 * Don't reference this struct directly, use functions below.
12 */
13struct ring_buffer_event {
14 u32 type:2, len:3, time_delta:27;
15 u32 array[];
16};
17
18/**
19 * enum ring_buffer_type - internal ring buffer types
20 *
21 * @RINGBUF_TYPE_PADDING: Left over page padding
22 * array is ignored
23 * size is variable depending on how much
24 * padding is needed
25 *
26 * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta
27 * array[0] = time delta (28 .. 59)
28 * size = 8 bytes
29 *
30 * @RINGBUF_TYPE_TIME_STAMP: Sync time stamp with external clock
31 * array[0] = tv_nsec
32 * array[1] = tv_sec
33 * size = 16 bytes
34 *
35 * @RINGBUF_TYPE_DATA: Data record
36 * If len is zero:
37 * array[0] holds the actual length
38 * array[1..(length+3)/4-1] holds data
39 * else
40 * length = len << 2
41 * array[0..(length+3)/4] holds data
42 */
43enum ring_buffer_type {
44 RINGBUF_TYPE_PADDING,
45 RINGBUF_TYPE_TIME_EXTEND,
46 /* FIXME: RINGBUF_TYPE_TIME_STAMP not implemented */
47 RINGBUF_TYPE_TIME_STAMP,
48 RINGBUF_TYPE_DATA,
49};
50
51unsigned ring_buffer_event_length(struct ring_buffer_event *event);
52void *ring_buffer_event_data(struct ring_buffer_event *event);
53
54/**
55 * ring_buffer_event_time_delta - return the delta timestamp of the event
56 * @event: the event to get the delta timestamp of
57 *
58 * The delta timestamp is the 27 bit timestamp since the last event.
59 */
60static inline unsigned
61ring_buffer_event_time_delta(struct ring_buffer_event *event)
62{
63 return event->time_delta;
64}
65
66/*
67 * size is in bytes for each per CPU buffer.
68 */
69struct ring_buffer *
70ring_buffer_alloc(unsigned long size, unsigned flags);
71void ring_buffer_free(struct ring_buffer *buffer);
72
73int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);
74
75struct ring_buffer_event *
76ring_buffer_lock_reserve(struct ring_buffer *buffer,
77 unsigned long length,
78 unsigned long *flags);
79int ring_buffer_unlock_commit(struct ring_buffer *buffer,
80 struct ring_buffer_event *event,
81 unsigned long flags);
82int ring_buffer_write(struct ring_buffer *buffer,
83 unsigned long length, void *data);
84
85struct ring_buffer_event *
86ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts);
87struct ring_buffer_event *
88ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts);
89
90struct ring_buffer_iter *
91ring_buffer_read_start(struct ring_buffer *buffer, int cpu);
92void ring_buffer_read_finish(struct ring_buffer_iter *iter);
93
94struct ring_buffer_event *
95ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts);
96struct ring_buffer_event *
97ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
98void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
99int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
100
101unsigned long ring_buffer_size(struct ring_buffer *buffer);
102
103void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
104void ring_buffer_reset(struct ring_buffer *buffer);
105
106int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
107 struct ring_buffer *buffer_b, int cpu);
108
109int ring_buffer_empty(struct ring_buffer *buffer);
110int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);
111
112void ring_buffer_record_disable(struct ring_buffer *buffer);
113void ring_buffer_record_enable(struct ring_buffer *buffer);
114void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
115void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
116
117unsigned long ring_buffer_entries(struct ring_buffer *buffer);
118unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
119
120u64 ring_buffer_time_stamp(int cpu);
121void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
122
123enum ring_buffer_flags {
124 RB_FL_OVERWRITE = 1 << 0,
125};
126
127#endif /* _LINUX_RING_BUFFER_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index fed6f5e0b411..89f0564b10c8 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -39,18 +39,6 @@ struct anon_vma {
39 39
40#ifdef CONFIG_MMU 40#ifdef CONFIG_MMU
41 41
42extern struct kmem_cache *anon_vma_cachep;
43
44static inline struct anon_vma *anon_vma_alloc(void)
45{
46 return kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL);
47}
48
49static inline void anon_vma_free(struct anon_vma *anon_vma)
50{
51 kmem_cache_free(anon_vma_cachep, anon_vma);
52}
53
54static inline void anon_vma_lock(struct vm_area_struct *vma) 42static inline void anon_vma_lock(struct vm_area_struct *vma)
55{ 43{
56 struct anon_vma *anon_vma = vma->anon_vma; 44 struct anon_vma *anon_vma = vma->anon_vma;
@@ -75,6 +63,9 @@ void anon_vma_unlink(struct vm_area_struct *);
75void anon_vma_link(struct vm_area_struct *); 63void anon_vma_link(struct vm_area_struct *);
76void __anon_vma_link(struct vm_area_struct *); 64void __anon_vma_link(struct vm_area_struct *);
77 65
66extern struct anon_vma *page_lock_anon_vma(struct page *page);
67extern void page_unlock_anon_vma(struct anon_vma *anon_vma);
68
78/* 69/*
79 * rmap interfaces called when adding or removing pte of page 70 * rmap interfaces called when adding or removing pte of page
80 */ 71 */
@@ -117,6 +108,19 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
117 */ 108 */
118int page_mkclean(struct page *); 109int page_mkclean(struct page *);
119 110
111#ifdef CONFIG_UNEVICTABLE_LRU
112/*
113 * called in munlock()/munmap() path to check for other vmas holding
114 * the page mlocked.
115 */
116int try_to_munlock(struct page *);
117#else
118static inline int try_to_munlock(struct page *page)
119{
120 return 0; /* a.k.a. SWAP_SUCCESS */
121}
122#endif
123
120#else /* !CONFIG_MMU */ 124#else /* !CONFIG_MMU */
121 125
122#define anon_vma_init() do {} while (0) 126#define anon_vma_init() do {} while (0)
@@ -140,5 +144,6 @@ static inline int page_mkclean(struct page *page)
140#define SWAP_SUCCESS 0 144#define SWAP_SUCCESS 0
141#define SWAP_AGAIN 1 145#define SWAP_AGAIN 1
142#define SWAP_FAIL 2 146#define SWAP_FAIL 2
147#define SWAP_MLOCK 3
143 148
144#endif /* _LINUX_RMAP_H */ 149#endif /* _LINUX_RMAP_H */
diff --git a/include/linux/rtc/m48t59.h b/include/linux/rtc/m48t59.h
index e8c7c21ceb1f..6fc961459b4a 100644
--- a/include/linux/rtc/m48t59.h
+++ b/include/linux/rtc/m48t59.h
@@ -18,40 +18,47 @@
18/* 18/*
19 * M48T59 Register Offset 19 * M48T59 Register Offset
20 */ 20 */
21#define M48T59_YEAR 0x1fff 21#define M48T59_YEAR 0xf
22#define M48T59_MONTH 0x1ffe 22#define M48T59_MONTH 0xe
23#define M48T59_MDAY 0x1ffd /* Day of Month */ 23#define M48T59_MDAY 0xd /* Day of Month */
24#define M48T59_WDAY 0x1ffc /* Day of Week */ 24#define M48T59_WDAY 0xc /* Day of Week */
25#define M48T59_WDAY_CB 0x20 /* Century Bit */ 25#define M48T59_WDAY_CB 0x20 /* Century Bit */
26#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ 26#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */
27#define M48T59_HOUR 0x1ffb 27#define M48T59_HOUR 0xb
28#define M48T59_MIN 0x1ffa 28#define M48T59_MIN 0xa
29#define M48T59_SEC 0x1ff9 29#define M48T59_SEC 0x9
30#define M48T59_CNTL 0x1ff8 30#define M48T59_CNTL 0x8
31#define M48T59_CNTL_READ 0x40 31#define M48T59_CNTL_READ 0x40
32#define M48T59_CNTL_WRITE 0x80 32#define M48T59_CNTL_WRITE 0x80
33#define M48T59_WATCHDOG 0x1ff7 33#define M48T59_WATCHDOG 0x7
34#define M48T59_INTR 0x1ff6 34#define M48T59_INTR 0x6
35#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ 35#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */
36#define M48T59_INTR_ABE 0x20 36#define M48T59_INTR_ABE 0x20
37#define M48T59_ALARM_DATE 0x1ff5 37#define M48T59_ALARM_DATE 0x5
38#define M48T59_ALARM_HOUR 0x1ff4 38#define M48T59_ALARM_HOUR 0x4
39#define M48T59_ALARM_MIN 0x1ff3 39#define M48T59_ALARM_MIN 0x3
40#define M48T59_ALARM_SEC 0x1ff2 40#define M48T59_ALARM_SEC 0x2
41#define M48T59_UNUSED 0x1ff1 41#define M48T59_UNUSED 0x1
42#define M48T59_FLAGS 0x1ff0 42#define M48T59_FLAGS 0x0
43#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ 43#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */
44#define M48T59_FLAGS_AF 0x40 /* alarm */ 44#define M48T59_FLAGS_AF 0x40 /* alarm */
45#define M48T59_FLAGS_BF 0x10 /* low battery */ 45#define M48T59_FLAGS_BF 0x10 /* low battery */
46 46
47#define M48T59_NVRAM_SIZE 0x1ff0 47#define M48T59RTC_TYPE_M48T59 0 /* to keep compatibility */
48#define M48T59RTC_TYPE_M48T02 1
49#define M48T59RTC_TYPE_M48T08 2
48 50
49struct m48t59_plat_data { 51struct m48t59_plat_data {
50 /* The method to access M48T59 registers, 52 /* The method to access M48T59 registers */
51 * NOTE: The 'ofs' should be 0x00~0x1fff
52 */
53 void (*write_byte)(struct device *dev, u32 ofs, u8 val); 53 void (*write_byte)(struct device *dev, u32 ofs, u8 val);
54 unsigned char (*read_byte)(struct device *dev, u32 ofs); 54 unsigned char (*read_byte)(struct device *dev, u32 ofs);
55
56 int type; /* RTC model */
57
58 /* ioaddr mapped externally */
59 void __iomem *ioaddr;
60 /* offset to RTC registers, automatically set according to the type */
61 unsigned int offset;
55}; 62};
56 63
57#endif /* _LINUX_RTC_M48T59_H_ */ 64#endif /* _LINUX_RTC_M48T59_H_ */
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 382bb7951166..f19b00b7d530 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -54,7 +54,7 @@ struct hrtimer_sleeper;
54#ifdef CONFIG_DEBUG_RT_MUTEXES 54#ifdef CONFIG_DEBUG_RT_MUTEXES
55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \ 55# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
56 , .name = #mutexname, .file = __FILE__, .line = __LINE__ 56 , .name = #mutexname, .file = __FILE__, .line = __LINE__
57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __FUNCTION__) 57# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__)
58 extern void rt_mutex_debug_task_free(struct task_struct *tsk); 58 extern void rt_mutex_debug_task_free(struct task_struct *tsk);
59#else 59#else
60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) 60# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index ca643b13b026..2b3d51c6ec9c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -582,6 +582,10 @@ enum rtnetlink_groups {
582#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE 582#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
583 RTNLGRP_ND_USEROPT, 583 RTNLGRP_ND_USEROPT,
584#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT 584#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
585 RTNLGRP_PHONET_IFADDR,
586#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
587 RTNLGRP_PHONET_ROUTE,
588#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
585 __RTNLGRP_MAX 589 __RTNLGRP_MAX
586}; 590};
587#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 591#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3d9120c5ad15..8478f334d732 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -287,7 +287,6 @@ extern void trap_init(void);
287extern void account_process_tick(struct task_struct *task, int user); 287extern void account_process_tick(struct task_struct *task, int user);
288extern void update_process_times(int user); 288extern void update_process_times(int user);
289extern void scheduler_tick(void); 289extern void scheduler_tick(void);
290extern void hrtick_resched(void);
291 290
292extern void sched_show_task(struct task_struct *p); 291extern void sched_show_task(struct task_struct *p);
293 292
@@ -352,7 +351,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
352extern void arch_unmap_area(struct mm_struct *, unsigned long); 351extern void arch_unmap_area(struct mm_struct *, unsigned long);
353extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); 352extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
354 353
355#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 354#if USE_SPLIT_PTLOCKS
356/* 355/*
357 * The mm counters are not protected by its page_table_lock, 356 * The mm counters are not protected by its page_table_lock,
358 * so must be incremented atomically. 357 * so must be incremented atomically.
@@ -363,7 +362,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
363#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) 362#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
364#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) 363#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
365 364
366#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 365#else /* !USE_SPLIT_PTLOCKS */
367/* 366/*
368 * The mm counters are protected by its page_table_lock, 367 * The mm counters are protected by its page_table_lock,
369 * so can be incremented directly. 368 * so can be incremented directly.
@@ -374,7 +373,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
374#define inc_mm_counter(mm, member) (mm)->_##member++ 373#define inc_mm_counter(mm, member) (mm)->_##member++
375#define dec_mm_counter(mm, member) (mm)->_##member-- 374#define dec_mm_counter(mm, member) (mm)->_##member--
376 375
377#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 376#endif /* !USE_SPLIT_PTLOCKS */
378 377
379#define get_mm_rss(mm) \ 378#define get_mm_rss(mm) \
380 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) 379 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
@@ -403,12 +402,21 @@ extern int get_dumpable(struct mm_struct *mm);
403#define MMF_DUMP_MAPPED_PRIVATE 4 402#define MMF_DUMP_MAPPED_PRIVATE 4
404#define MMF_DUMP_MAPPED_SHARED 5 403#define MMF_DUMP_MAPPED_SHARED 5
405#define MMF_DUMP_ELF_HEADERS 6 404#define MMF_DUMP_ELF_HEADERS 6
405#define MMF_DUMP_HUGETLB_PRIVATE 7
406#define MMF_DUMP_HUGETLB_SHARED 8
406#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS 407#define MMF_DUMP_FILTER_SHIFT MMF_DUMPABLE_BITS
407#define MMF_DUMP_FILTER_BITS 5 408#define MMF_DUMP_FILTER_BITS 7
408#define MMF_DUMP_FILTER_MASK \ 409#define MMF_DUMP_FILTER_MASK \
409 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT) 410 (((1 << MMF_DUMP_FILTER_BITS) - 1) << MMF_DUMP_FILTER_SHIFT)
410#define MMF_DUMP_FILTER_DEFAULT \ 411#define MMF_DUMP_FILTER_DEFAULT \
411 ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED)) 412 ((1 << MMF_DUMP_ANON_PRIVATE) | (1 << MMF_DUMP_ANON_SHARED) |\
413 (1 << MMF_DUMP_HUGETLB_PRIVATE) | MMF_DUMP_MASK_DEFAULT_ELF)
414
415#ifdef CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS
416# define MMF_DUMP_MASK_DEFAULT_ELF (1 << MMF_DUMP_ELF_HEADERS)
417#else
418# define MMF_DUMP_MASK_DEFAULT_ELF 0
419#endif
412 420
413struct sighand_struct { 421struct sighand_struct {
414 atomic_t count; 422 atomic_t count;
@@ -425,6 +433,39 @@ struct pacct_struct {
425 unsigned long ac_minflt, ac_majflt; 433 unsigned long ac_minflt, ac_majflt;
426}; 434};
427 435
436/**
437 * struct task_cputime - collected CPU time counts
438 * @utime: time spent in user mode, in &cputime_t units
439 * @stime: time spent in kernel mode, in &cputime_t units
440 * @sum_exec_runtime: total time spent on the CPU, in nanoseconds
441 *
442 * This structure groups together three kinds of CPU time that are
443 * tracked for threads and thread groups. Most things considering
444 * CPU time want to group these counts together and treat all three
445 * of them in parallel.
446 */
447struct task_cputime {
448 cputime_t utime;
449 cputime_t stime;
450 unsigned long long sum_exec_runtime;
451};
452/* Alternate field names when used to cache expirations. */
453#define prof_exp stime
454#define virt_exp utime
455#define sched_exp sum_exec_runtime
456
457/**
458 * struct thread_group_cputime - thread group interval timer counts
459 * @totals: thread group interval timers; substructure for
460 * uniprocessor kernel, per-cpu for SMP kernel.
461 *
462 * This structure contains the version of task_cputime, above, that is
463 * used for thread group CPU clock calculations.
464 */
465struct thread_group_cputime {
466 struct task_cputime *totals;
467};
468
428/* 469/*
429 * NOTE! "signal_struct" does not have it's own 470 * NOTE! "signal_struct" does not have it's own
430 * locking, because a shared signal_struct always 471 * locking, because a shared signal_struct always
@@ -451,8 +492,8 @@ struct signal_struct {
451 * - everyone except group_exit_task is stopped during signal delivery 492 * - everyone except group_exit_task is stopped during signal delivery
452 * of fatal signals, group_exit_task processes the signal. 493 * of fatal signals, group_exit_task processes the signal.
453 */ 494 */
454 struct task_struct *group_exit_task;
455 int notify_count; 495 int notify_count;
496 struct task_struct *group_exit_task;
456 497
457 /* thread group stop support, overloads group_exit_code too */ 498 /* thread group stop support, overloads group_exit_code too */
458 int group_stop_count; 499 int group_stop_count;
@@ -470,6 +511,17 @@ struct signal_struct {
470 cputime_t it_prof_expires, it_virt_expires; 511 cputime_t it_prof_expires, it_virt_expires;
471 cputime_t it_prof_incr, it_virt_incr; 512 cputime_t it_prof_incr, it_virt_incr;
472 513
514 /*
515 * Thread group totals for process CPU clocks.
516 * See thread_group_cputime(), et al, for details.
517 */
518 struct thread_group_cputime cputime;
519
520 /* Earliest-expiration cache. */
521 struct task_cputime cputime_expires;
522
523 struct list_head cpu_timers[3];
524
473 /* job control IDs */ 525 /* job control IDs */
474 526
475 /* 527 /*
@@ -500,7 +552,7 @@ struct signal_struct {
500 * Live threads maintain their own counters and add to these 552 * Live threads maintain their own counters and add to these
501 * in __exit_signal, except for the group leader. 553 * in __exit_signal, except for the group leader.
502 */ 554 */
503 cputime_t utime, stime, cutime, cstime; 555 cputime_t cutime, cstime;
504 cputime_t gtime; 556 cputime_t gtime;
505 cputime_t cgtime; 557 cputime_t cgtime;
506 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 558 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
@@ -509,14 +561,6 @@ struct signal_struct {
509 struct task_io_accounting ioac; 561 struct task_io_accounting ioac;
510 562
511 /* 563 /*
512 * Cumulative ns of scheduled CPU time for dead threads in the
513 * group, not including a zombie group leader. (This only differs
514 * from jiffies_to_ns(utime + stime) if sched_clock uses something
515 * other than jiffies.)
516 */
517 unsigned long long sum_sched_runtime;
518
519 /*
520 * We don't bother to synchronize most readers of this at all, 564 * We don't bother to synchronize most readers of this at all,
521 * because there is no reader checking a limit that actually needs 565 * because there is no reader checking a limit that actually needs
522 * to get both rlim_cur and rlim_max atomically, and either one 566 * to get both rlim_cur and rlim_max atomically, and either one
@@ -527,8 +571,6 @@ struct signal_struct {
527 */ 571 */
528 struct rlimit rlim[RLIM_NLIMITS]; 572 struct rlimit rlim[RLIM_NLIMITS];
529 573
530 struct list_head cpu_timers[3];
531
532 /* keep the process-shared keyrings here so that they do the right 574 /* keep the process-shared keyrings here so that they do the right
533 * thing in threads created with CLONE_THREAD */ 575 * thing in threads created with CLONE_THREAD */
534#ifdef CONFIG_KEYS 576#ifdef CONFIG_KEYS
@@ -638,10 +680,6 @@ struct sched_info {
638}; 680};
639#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 681#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
640 682
641#ifdef CONFIG_SCHEDSTATS
642extern const struct file_operations proc_schedstat_operations;
643#endif /* CONFIG_SCHEDSTATS */
644
645#ifdef CONFIG_TASK_DELAY_ACCT 683#ifdef CONFIG_TASK_DELAY_ACCT
646struct task_delay_info { 684struct task_delay_info {
647 spinlock_t lock; 685 spinlock_t lock;
@@ -824,6 +862,9 @@ struct sched_domain {
824 unsigned int ttwu_move_affine; 862 unsigned int ttwu_move_affine;
825 unsigned int ttwu_move_balance; 863 unsigned int ttwu_move_balance;
826#endif 864#endif
865#ifdef CONFIG_SCHED_DEBUG
866 char *name;
867#endif
827}; 868};
828 869
829extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, 870extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
@@ -897,7 +938,7 @@ struct sched_class {
897 void (*yield_task) (struct rq *rq); 938 void (*yield_task) (struct rq *rq);
898 int (*select_task_rq)(struct task_struct *p, int sync); 939 int (*select_task_rq)(struct task_struct *p, int sync);
899 940
900 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 941 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
901 942
902 struct task_struct * (*pick_next_task) (struct rq *rq); 943 struct task_struct * (*pick_next_task) (struct rq *rq);
903 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 944 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
@@ -1010,8 +1051,8 @@ struct sched_entity {
1010 1051
1011struct sched_rt_entity { 1052struct sched_rt_entity {
1012 struct list_head run_list; 1053 struct list_head run_list;
1013 unsigned int time_slice;
1014 unsigned long timeout; 1054 unsigned long timeout;
1055 unsigned int time_slice;
1015 int nr_cpus_allowed; 1056 int nr_cpus_allowed;
1016 1057
1017 struct sched_rt_entity *back; 1058 struct sched_rt_entity *back;
@@ -1134,8 +1175,7 @@ struct task_struct {
1134/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ 1175/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
1135 unsigned long min_flt, maj_flt; 1176 unsigned long min_flt, maj_flt;
1136 1177
1137 cputime_t it_prof_expires, it_virt_expires; 1178 struct task_cputime cputime_expires;
1138 unsigned long long it_sched_expires;
1139 struct list_head cpu_timers[3]; 1179 struct list_head cpu_timers[3];
1140 1180
1141/* process credentials */ 1181/* process credentials */
@@ -1301,6 +1341,12 @@ struct task_struct {
1301 int latency_record_count; 1341 int latency_record_count;
1302 struct latency_record latency_record[LT_SAVECOUNT]; 1342 struct latency_record latency_record[LT_SAVECOUNT];
1303#endif 1343#endif
1344 /*
1345 * time slack values; these are used to round up poll() and
1346 * select() etc timeout values. These are in nanoseconds.
1347 */
1348 unsigned long timer_slack_ns;
1349 unsigned long default_timer_slack_ns;
1304}; 1350};
1305 1351
1306/* 1352/*
@@ -1585,6 +1631,7 @@ extern unsigned long long cpu_clock(int cpu);
1585 1631
1586extern unsigned long long 1632extern unsigned long long
1587task_sched_runtime(struct task_struct *task); 1633task_sched_runtime(struct task_struct *task);
1634extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
1588 1635
1589/* sched_exec is called by processes performing an exec */ 1636/* sched_exec is called by processes performing an exec */
1590#ifdef CONFIG_SMP 1637#ifdef CONFIG_SMP
@@ -1619,6 +1666,7 @@ extern unsigned int sysctl_sched_features;
1619extern unsigned int sysctl_sched_migration_cost; 1666extern unsigned int sysctl_sched_migration_cost;
1620extern unsigned int sysctl_sched_nr_migrate; 1667extern unsigned int sysctl_sched_nr_migrate;
1621extern unsigned int sysctl_sched_shares_ratelimit; 1668extern unsigned int sysctl_sched_shares_ratelimit;
1669extern unsigned int sysctl_sched_shares_thresh;
1622 1670
1623int sched_nr_latency_handler(struct ctl_table *table, int write, 1671int sched_nr_latency_handler(struct ctl_table *table, int write,
1624 struct file *file, void __user *buffer, size_t *length, 1672 struct file *file, void __user *buffer, size_t *length,
@@ -2082,6 +2130,30 @@ static inline int spin_needbreak(spinlock_t *lock)
2082} 2130}
2083 2131
2084/* 2132/*
2133 * Thread group CPU time accounting.
2134 */
2135
2136extern int thread_group_cputime_alloc(struct task_struct *);
2137extern void thread_group_cputime(struct task_struct *, struct task_cputime *);
2138
2139static inline void thread_group_cputime_init(struct signal_struct *sig)
2140{
2141 sig->cputime.totals = NULL;
2142}
2143
2144static inline int thread_group_cputime_clone_thread(struct task_struct *curr)
2145{
2146 if (curr->signal->cputime.totals)
2147 return 0;
2148 return thread_group_cputime_alloc(curr);
2149}
2150
2151static inline void thread_group_cputime_free(struct signal_struct *sig)
2152{
2153 free_percpu(sig->cputime.totals);
2154}
2155
2156/*
2085 * Reevaluate whether the task has signals pending delivery. 2157 * Reevaluate whether the task has signals pending delivery.
2086 * Wake the task if so. 2158 * Wake the task if so.
2087 * This is required every time the blocked sigset_t changes. 2159 * This is required every time the blocked sigset_t changes.
diff --git a/include/linux/security.h b/include/linux/security.h
index 80c4d002864c..f5c4a51eb42e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1560,11 +1560,6 @@ struct security_operations {
1560extern int security_init(void); 1560extern int security_init(void);
1561extern int security_module_enable(struct security_operations *ops); 1561extern int security_module_enable(struct security_operations *ops);
1562extern int register_security(struct security_operations *ops); 1562extern int register_security(struct security_operations *ops);
1563extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1564 struct dentry *parent, void *data,
1565 const struct file_operations *fops);
1566extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
1567extern void securityfs_remove(struct dentry *dentry);
1568 1563
1569/* Security operations */ 1564/* Security operations */
1570int security_ptrace_may_access(struct task_struct *child, unsigned int mode); 1565int security_ptrace_may_access(struct task_struct *child, unsigned int mode);
@@ -2424,25 +2419,6 @@ static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2424 return cap_netlink_recv(skb, cap); 2419 return cap_netlink_recv(skb, cap);
2425} 2420}
2426 2421
2427static inline struct dentry *securityfs_create_dir(const char *name,
2428 struct dentry *parent)
2429{
2430 return ERR_PTR(-ENODEV);
2431}
2432
2433static inline struct dentry *securityfs_create_file(const char *name,
2434 mode_t mode,
2435 struct dentry *parent,
2436 void *data,
2437 const struct file_operations *fops)
2438{
2439 return ERR_PTR(-ENODEV);
2440}
2441
2442static inline void securityfs_remove(struct dentry *dentry)
2443{
2444}
2445
2446static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2422static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2447{ 2423{
2448 return -EOPNOTSUPP; 2424 return -EOPNOTSUPP;
@@ -2806,5 +2782,35 @@ static inline void security_audit_rule_free(void *lsmrule)
2806#endif /* CONFIG_SECURITY */ 2782#endif /* CONFIG_SECURITY */
2807#endif /* CONFIG_AUDIT */ 2783#endif /* CONFIG_AUDIT */
2808 2784
2785#ifdef CONFIG_SECURITYFS
2786
2787extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
2788 struct dentry *parent, void *data,
2789 const struct file_operations *fops);
2790extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
2791extern void securityfs_remove(struct dentry *dentry);
2792
2793#else /* CONFIG_SECURITYFS */
2794
2795static inline struct dentry *securityfs_create_dir(const char *name,
2796 struct dentry *parent)
2797{
2798 return ERR_PTR(-ENODEV);
2799}
2800
2801static inline struct dentry *securityfs_create_file(const char *name,
2802 mode_t mode,
2803 struct dentry *parent,
2804 void *data,
2805 const struct file_operations *fops)
2806{
2807 return ERR_PTR(-ENODEV);
2808}
2809
2810static inline void securityfs_remove(struct dentry *dentry)
2811{}
2812
2813#endif
2814
2809#endif /* ! __LINUX_SECURITY_H */ 2815#endif /* ! __LINUX_SECURITY_H */
2810 2816
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index a1783b229ef4..dc50bcc282a8 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -60,6 +60,19 @@ static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
60 return seq_bitmap(m, mask->bits, MAX_NUMNODES); 60 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
61} 61}
62 62
63int seq_bitmap_list(struct seq_file *m, unsigned long *bits,
64 unsigned int nr_bits);
65
66static inline int seq_cpumask_list(struct seq_file *m, cpumask_t *mask)
67{
68 return seq_bitmap_list(m, mask->bits, NR_CPUS);
69}
70
71static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
72{
73 return seq_bitmap_list(m, mask->bits, MAX_NUMNODES);
74}
75
63int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 76int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
64int single_release(struct inode *, struct file *); 77int single_release(struct inode *, struct file *);
65void *__seq_open_private(struct file *, const struct seq_operations *, int); 78void *__seq_open_private(struct file *, const struct seq_operations *, int);
diff --git a/include/linux/serial.h b/include/linux/serial.h
index deb714314fb1..1ea8d9265bf6 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -173,6 +173,22 @@ struct serial_icounter_struct {
173 int reserved[9]; 173 int reserved[9];
174}; 174};
175 175
176/*
177 * Serial interface for controlling RS485 settings on chips with suitable
178 * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
179 * platform. The set function returns the new state, with any unsupported bits
180 * reverted appropriately.
181 */
182
183struct serial_rs485 {
184 __u32 flags; /* RS485 feature flags */
185#define SER_RS485_ENABLED (1 << 0)
186#define SER_RS485_RTS_ON_SEND (1 << 1)
187#define SER_RS485_RTS_AFTER_SEND (1 << 2)
188 __u32 delay_rts_before_send; /* Milliseconds */
189 __u32 padding[6]; /* Memory is cheap, new structs
190 are a royal PITA .. */
191};
176 192
177#ifdef __KERNEL__ 193#ifdef __KERNEL__
178#include <linux/compiler.h> 194#include <linux/compiler.h>
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 3b2f6c04855e..e27f216361fc 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -241,7 +241,7 @@ typedef unsigned int __bitwise__ upf_t;
241 241
242struct uart_port { 242struct uart_port {
243 spinlock_t lock; /* port lock */ 243 spinlock_t lock; /* port lock */
244 unsigned int iobase; /* in/out[bwl] */ 244 unsigned long iobase; /* in/out[bwl] */
245 unsigned char __iomem *membase; /* read/write[bwl] */ 245 unsigned char __iomem *membase; /* read/write[bwl] */
246 unsigned int irq; /* irq number */ 246 unsigned int irq; /* irq number */
247 unsigned int uartclk; /* base uart clock */ 247 unsigned int uartclk; /* base uart clock */
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
new file mode 100644
index 000000000000..68e212ff9dde
--- /dev/null
+++ b/include/linux/sh_intc.h
@@ -0,0 +1,91 @@
1#ifndef __SH_INTC_H
2#define __SH_INTC_H
3
4typedef unsigned char intc_enum;
5
6struct intc_vect {
7 intc_enum enum_id;
8 unsigned short vect;
9};
10
11#define INTC_VECT(enum_id, vect) { enum_id, vect }
12#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
13
14struct intc_group {
15 intc_enum enum_id;
16 intc_enum enum_ids[32];
17};
18
19#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
20
21struct intc_mask_reg {
22 unsigned long set_reg, clr_reg, reg_width;
23 intc_enum enum_ids[32];
24#ifdef CONFIG_SMP
25 unsigned long smp;
26#endif
27};
28
29struct intc_prio_reg {
30 unsigned long set_reg, clr_reg, reg_width, field_width;
31 intc_enum enum_ids[16];
32#ifdef CONFIG_SMP
33 unsigned long smp;
34#endif
35};
36
37struct intc_sense_reg {
38 unsigned long reg, reg_width, field_width;
39 intc_enum enum_ids[16];
40};
41
42#ifdef CONFIG_SMP
43#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
44#else
45#define INTC_SMP(stride, nr)
46#endif
47
48struct intc_desc {
49 struct intc_vect *vectors;
50 unsigned int nr_vectors;
51 struct intc_group *groups;
52 unsigned int nr_groups;
53 struct intc_mask_reg *mask_regs;
54 unsigned int nr_mask_regs;
55 struct intc_prio_reg *prio_regs;
56 unsigned int nr_prio_regs;
57 struct intc_sense_reg *sense_regs;
58 unsigned int nr_sense_regs;
59 char *name;
60#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
61 struct intc_mask_reg *ack_regs;
62 unsigned int nr_ack_regs;
63#endif
64};
65
66#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
67#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
68 mask_regs, prio_regs, sense_regs) \
69struct intc_desc symbol __initdata = { \
70 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
71 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
72 _INTC_ARRAY(sense_regs), \
73 chipname, \
74}
75
76#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
77#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
78 mask_regs, prio_regs, sense_regs, ack_regs) \
79struct intc_desc symbol __initdata = { \
80 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
81 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
82 _INTC_ARRAY(sense_regs), \
83 chipname, \
84 _INTC_ARRAY(ack_regs), \
85}
86#endif
87
88void __init register_intc_controller(struct intc_desc *desc);
89int intc_set_priority(unsigned int irq, unsigned int prio);
90
91#endif /* __SH_INTC_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 909923717830..2725f4e5a9bf 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -146,8 +146,14 @@ struct skb_shared_info {
146 unsigned short gso_segs; 146 unsigned short gso_segs;
147 unsigned short gso_type; 147 unsigned short gso_type;
148 __be32 ip6_frag_id; 148 __be32 ip6_frag_id;
149#ifdef CONFIG_HAS_DMA
150 unsigned int num_dma_maps;
151#endif
149 struct sk_buff *frag_list; 152 struct sk_buff *frag_list;
150 skb_frag_t frags[MAX_SKB_FRAGS]; 153 skb_frag_t frags[MAX_SKB_FRAGS];
154#ifdef CONFIG_HAS_DMA
155 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1];
156#endif
151}; 157};
152 158
153/* We divide dataref into two halves. The higher 16 bits hold references 159/* We divide dataref into two halves. The higher 16 bits hold references
@@ -353,6 +359,14 @@ struct sk_buff {
353 359
354#include <asm/system.h> 360#include <asm/system.h>
355 361
362#ifdef CONFIG_HAS_DMA
363#include <linux/dma-mapping.h>
364extern int skb_dma_map(struct device *dev, struct sk_buff *skb,
365 enum dma_data_direction dir);
366extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
367 enum dma_data_direction dir);
368#endif
369
356extern void kfree_skb(struct sk_buff *skb); 370extern void kfree_skb(struct sk_buff *skb);
357extern void __kfree_skb(struct sk_buff *skb); 371extern void __kfree_skb(struct sk_buff *skb);
358extern struct sk_buff *__alloc_skb(unsigned int size, 372extern struct sk_buff *__alloc_skb(unsigned int size,
@@ -369,6 +383,8 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
369 return __alloc_skb(size, priority, 1, -1); 383 return __alloc_skb(size, priority, 1, -1);
370} 384}
371 385
386extern int skb_recycle_check(struct sk_buff *skb, int skb_size);
387
372extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 388extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
373extern struct sk_buff *skb_clone(struct sk_buff *skb, 389extern struct sk_buff *skb_clone(struct sk_buff *skb,
374 gfp_t priority); 390 gfp_t priority);
@@ -459,6 +475,37 @@ static inline int skb_queue_empty(const struct sk_buff_head *list)
459} 475}
460 476
461/** 477/**
478 * skb_queue_is_last - check if skb is the last entry in the queue
479 * @list: queue head
480 * @skb: buffer
481 *
482 * Returns true if @skb is the last buffer on the list.
483 */
484static inline bool skb_queue_is_last(const struct sk_buff_head *list,
485 const struct sk_buff *skb)
486{
487 return (skb->next == (struct sk_buff *) list);
488}
489
490/**
491 * skb_queue_next - return the next packet in the queue
492 * @list: queue head
493 * @skb: current buffer
494 *
495 * Return the next packet in @list after @skb. It is only valid to
496 * call this if skb_queue_is_last() evaluates to false.
497 */
498static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
499 const struct sk_buff *skb)
500{
501 /* This BUG_ON may seem severe, but if we just return then we
502 * are going to dereference garbage.
503 */
504 BUG_ON(skb_queue_is_last(list, skb));
505 return skb->next;
506}
507
508/**
462 * skb_get - reference buffer 509 * skb_get - reference buffer
463 * @skb: buffer to reference 510 * @skb: buffer to reference
464 * 511 *
@@ -646,6 +693,22 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
646 return list_->qlen; 693 return list_->qlen;
647} 694}
648 695
696/**
697 * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
698 * @list: queue to initialize
699 *
700 * This initializes only the list and queue length aspects of
701 * an sk_buff_head object. This allows to initialize the list
702 * aspects of an sk_buff_head without reinitializing things like
703 * the spinlock. It can also be used for on-stack sk_buff_head
704 * objects where the spinlock is known to not be used.
705 */
706static inline void __skb_queue_head_init(struct sk_buff_head *list)
707{
708 list->prev = list->next = (struct sk_buff *)list;
709 list->qlen = 0;
710}
711
649/* 712/*
650 * This function creates a split out lock class for each invocation; 713 * This function creates a split out lock class for each invocation;
651 * this is needed for now since a whole lot of users of the skb-queue 714 * this is needed for now since a whole lot of users of the skb-queue
@@ -657,8 +720,7 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
657static inline void skb_queue_head_init(struct sk_buff_head *list) 720static inline void skb_queue_head_init(struct sk_buff_head *list)
658{ 721{
659 spin_lock_init(&list->lock); 722 spin_lock_init(&list->lock);
660 list->prev = list->next = (struct sk_buff *)list; 723 __skb_queue_head_init(list);
661 list->qlen = 0;
662} 724}
663 725
664static inline void skb_queue_head_init_class(struct sk_buff_head *list, 726static inline void skb_queue_head_init_class(struct sk_buff_head *list,
@@ -685,6 +747,83 @@ static inline void __skb_insert(struct sk_buff *newsk,
685 list->qlen++; 747 list->qlen++;
686} 748}
687 749
750static inline void __skb_queue_splice(const struct sk_buff_head *list,
751 struct sk_buff *prev,
752 struct sk_buff *next)
753{
754 struct sk_buff *first = list->next;
755 struct sk_buff *last = list->prev;
756
757 first->prev = prev;
758 prev->next = first;
759
760 last->next = next;
761 next->prev = last;
762}
763
764/**
765 * skb_queue_splice - join two skb lists, this is designed for stacks
766 * @list: the new list to add
767 * @head: the place to add it in the first list
768 */
769static inline void skb_queue_splice(const struct sk_buff_head *list,
770 struct sk_buff_head *head)
771{
772 if (!skb_queue_empty(list)) {
773 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
774 head->qlen += list->qlen;
775 }
776}
777
778/**
779 * skb_queue_splice - join two skb lists and reinitialise the emptied list
780 * @list: the new list to add
781 * @head: the place to add it in the first list
782 *
783 * The list at @list is reinitialised
784 */
785static inline void skb_queue_splice_init(struct sk_buff_head *list,
786 struct sk_buff_head *head)
787{
788 if (!skb_queue_empty(list)) {
789 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
790 head->qlen += list->qlen;
791 __skb_queue_head_init(list);
792 }
793}
794
795/**
796 * skb_queue_splice_tail - join two skb lists, each list being a queue
797 * @list: the new list to add
798 * @head: the place to add it in the first list
799 */
800static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
801 struct sk_buff_head *head)
802{
803 if (!skb_queue_empty(list)) {
804 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
805 head->qlen += list->qlen;
806 }
807}
808
809/**
810 * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list
811 * @list: the new list to add
812 * @head: the place to add it in the first list
813 *
814 * Each of the lists is a queue.
815 * The list at @list is reinitialised
816 */
817static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
818 struct sk_buff_head *head)
819{
820 if (!skb_queue_empty(list)) {
821 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
822 head->qlen += list->qlen;
823 __skb_queue_head_init(list);
824 }
825}
826
688/** 827/**
689 * __skb_queue_after - queue a buffer at the list head 828 * __skb_queue_after - queue a buffer at the list head
690 * @list: list to use 829 * @list: list to use
@@ -829,6 +968,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
829 skb_shinfo(skb)->nr_frags = i + 1; 968 skb_shinfo(skb)->nr_frags = i + 1;
830} 969}
831 970
971extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
972 int off, int size);
973
832#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 974#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
833#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 975#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
834#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 976#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
@@ -1243,6 +1385,26 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1243 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1385 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1244} 1386}
1245 1387
1388extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask);
1389
1390/**
1391 * netdev_alloc_page - allocate a page for ps-rx on a specific device
1392 * @dev: network device to receive on
1393 *
1394 * Allocate a new page node local to the specified device.
1395 *
1396 * %NULL is returned if there is no free memory.
1397 */
1398static inline struct page *netdev_alloc_page(struct net_device *dev)
1399{
1400 return __netdev_alloc_page(dev, GFP_ATOMIC);
1401}
1402
1403static inline void netdev_free_page(struct net_device *dev, struct page *page)
1404{
1405 __free_page(page);
1406}
1407
1246/** 1408/**
1247 * skb_clone_writable - is the header of a clone writable 1409 * skb_clone_writable - is the header of a clone writable
1248 * @skb: buffer to check 1410 * @skb: buffer to check
@@ -1434,6 +1596,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1434 skb != (struct sk_buff *)(queue); \ 1596 skb != (struct sk_buff *)(queue); \
1435 skb = tmp, tmp = skb->next) 1597 skb = tmp, tmp = skb->next)
1436 1598
1599#define skb_queue_walk_from(queue, skb) \
1600 for (; prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1601 skb = skb->next)
1602
1603#define skb_queue_walk_from_safe(queue, skb, tmp) \
1604 for (tmp = skb->next; \
1605 skb != (struct sk_buff *)(queue); \
1606 skb = tmp, tmp = skb->next)
1607
1437#define skb_queue_reverse_walk(queue, skb) \ 1608#define skb_queue_reverse_walk(queue, skb) \
1438 for (skb = (queue)->prev; \ 1609 for (skb = (queue)->prev; \
1439 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1610 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 5ff9676c1e2c..ba965c84ae06 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -288,9 +288,4 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
288 return kmalloc_node(size, flags | __GFP_ZERO, node); 288 return kmalloc_node(size, flags | __GFP_ZERO, node);
289} 289}
290 290
291#ifdef CONFIG_SLABINFO
292extern const struct seq_operations slabinfo_op;
293ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
294#endif
295
296#endif /* _LINUX_SLAB_H */ 291#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/smc911x.h b/include/linux/smc911x.h
index b58f54c24183..521f37143fae 100644
--- a/include/linux/smc911x.h
+++ b/include/linux/smc911x.h
@@ -7,6 +7,7 @@
7struct smc911x_platdata { 7struct smc911x_platdata {
8 unsigned long flags; 8 unsigned long flags;
9 unsigned long irq_flags; /* IRQF_... */ 9 unsigned long irq_flags; /* IRQF_... */
10 int irq_polarity;
10}; 11};
11 12
12#endif /* __SMC911X_H__ */ 13#endif /* __SMC911X_H__ */
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
index 3827b922ba1f..bc21db598c06 100644
--- a/include/linux/smc91x.h
+++ b/include/linux/smc91x.h
@@ -16,8 +16,19 @@
16 16
17#define SMC91X_USE_DMA (1 << 6) 17#define SMC91X_USE_DMA (1 << 6)
18 18
19#define RPC_LED_100_10 (0x00) /* LED = 100Mbps OR's with 10Mbps link detect */
20#define RPC_LED_RES (0x01) /* LED = Reserved */
21#define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */
22#define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */
23#define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */
24#define RPC_LED_100 (0x05) /* LED = 100Mbps link dectect */
25#define RPC_LED_TX (0x06) /* LED = TX packet occurred */
26#define RPC_LED_RX (0x07) /* LED = RX packet occurred */
27
19struct smc91x_platdata { 28struct smc91x_platdata {
20 unsigned long flags; 29 unsigned long flags;
30 unsigned char leda;
31 unsigned char ledb;
21}; 32};
22 33
23#endif /* __SMC91X_H__ */ 34#endif /* __SMC91X_H__ */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 66484d4a8459..2e4d58b26c06 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/types.h>
10#include <linux/list.h> 11#include <linux/list.h>
11#include <linux/cpumask.h> 12#include <linux/cpumask.h>
12 13
@@ -16,7 +17,8 @@ struct call_single_data {
16 struct list_head list; 17 struct list_head list;
17 void (*func) (void *info); 18 void (*func) (void *info);
18 void *info; 19 void *info;
19 unsigned int flags; 20 u16 flags;
21 u16 priv;
20}; 22};
21 23
22#ifdef CONFIG_SMP 24#ifdef CONFIG_SMP
diff --git a/include/linux/socket.h b/include/linux/socket.h
index dc5086fe7736..20fc4bbfca42 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -190,7 +190,8 @@ struct ucred {
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_RXRPC 33 /* RxRPC sockets */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_ISDN 34 /* mISDN sockets */ 192#define AF_ISDN 34 /* mISDN sockets */
193#define AF_MAX 35 /* For now.. */ 193#define AF_PHONET 35 /* Phonet sockets */
194#define AF_MAX 36 /* For now.. */
194 195
195/* Protocol families, same as address families. */ 196/* Protocol families, same as address families. */
196#define PF_UNSPEC AF_UNSPEC 197#define PF_UNSPEC AF_UNSPEC
@@ -227,6 +228,7 @@ struct ucred {
227#define PF_IUCV AF_IUCV 228#define PF_IUCV AF_IUCV
228#define PF_RXRPC AF_RXRPC 229#define PF_RXRPC AF_RXRPC
229#define PF_ISDN AF_ISDN 230#define PF_ISDN AF_ISDN
231#define PF_PHONET AF_PHONET
230#define PF_MAX AF_MAX 232#define PF_MAX AF_MAX
231 233
232/* Maximum queue length specifiable by listen. */ 234/* Maximum queue length specifiable by listen. */
@@ -295,6 +297,7 @@ struct ucred {
295#define SOL_RXRPC 272 297#define SOL_RXRPC 272
296#define SOL_PPPOL2TP 273 298#define SOL_PPPOL2TP 273
297#define SOL_BLUETOOTH 274 299#define SOL_BLUETOOTH 274
300#define SOL_PNPIPE 275
298 301
299/* IPX options */ 302/* IPX options */
300#define IPX_TYPE 1 303#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index daf744017a31..05eab2f11e63 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -43,6 +43,9 @@ struct ads7846_platform_data {
43 u16 debounce_tol; /* tolerance used for filtering */ 43 u16 debounce_tol; /* tolerance used for filtering */
44 u16 debounce_rep; /* additional consecutive good readings 44 u16 debounce_rep; /* additional consecutive good readings
45 * required after the first two */ 45 * required after the first two */
46 int gpio_pendown; /* the GPIO used to decide the pendown
47 * state if get_pendown_state == NULL
48 */
46 int (*get_pendown_state)(void); 49 int (*get_pendown_state)(void);
47 int (*filter_init) (struct ads7846_platform_data *pdata, 50 int (*filter_init) (struct ads7846_platform_data *pdata,
48 void **filter_data); 51 void **filter_data);
diff --git a/include/linux/spi/corgi_lcd.h b/include/linux/spi/corgi_lcd.h
new file mode 100644
index 000000000000..6692b3418ccf
--- /dev/null
+++ b/include/linux/spi/corgi_lcd.h
@@ -0,0 +1,20 @@
1#ifndef __LINUX_SPI_CORGI_LCD_H
2#define __LINUX_SPI_CORGI_LCD_H
3
4#define CORGI_LCD_MODE_QVGA 1
5#define CORGI_LCD_MODE_VGA 2
6
7struct corgi_lcd_platform_data {
8 int init_mode;
9 int max_intensity;
10 int default_intensity;
11 int limit_mask;
12
13 int gpio_backlight_on; /* -1 if n/a */
14 int gpio_backlight_cont; /* -1 if n/a */
15
16 void (*notify)(int intensity);
17 void (*kick_battery)(void);
18};
19
20#endif /* __LINUX_SPI_CORGI_LCD_H */
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
index b4d9fa6f797c..decf6d8c77b7 100644
--- a/include/linux/spi/orion_spi.h
+++ b/include/linux/spi/orion_spi.h
@@ -11,6 +11,7 @@
11 11
12struct orion_spi_info { 12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */ 13 u32 tclk; /* no <linux/clk.h> support yet */
14 u32 enable_clock_fix;
14}; 15};
15 16
16 17
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index ebad0bac9801..99a0f991e850 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -245,8 +245,6 @@
245 245
246/* SPROM Revision 3 (inherits most data from rev 2) */ 246/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ 247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
248#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */
249#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */
250#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 248#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
251#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 249#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
252#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
@@ -267,8 +265,6 @@
267 265
268/* SPROM Revision 4 */ 266/* SPROM Revision 4 */
269#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ 267#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
270#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */
271#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */
272#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ 268#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
273#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 269#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
274#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 270#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
@@ -316,6 +312,21 @@
316#define SSB_SPROM4_PA1B1 0x1090 312#define SSB_SPROM4_PA1B1 0x1090
317#define SSB_SPROM4_PA1B2 0x1092 313#define SSB_SPROM4_PA1B2 0x1092
318 314
315/* SPROM Revision 5 (inherits most data from rev 4) */
316#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */
317#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */
318#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */
319#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */
320#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */
321#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
322#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
323#define SSB_SPROM5_GPIOA_P1_SHIFT 8
324#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */
325#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328
329
319/* Values for SSB_SPROM1_BINF_CCODE */ 330/* Values for SSB_SPROM1_BINF_CCODE */
320enum { 331enum {
321 SSB_SPROM1CCODE_WORLD = 0, 332 SSB_SPROM1CCODE_WORLD = 0,
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
new file mode 100644
index 000000000000..a3eb2f65b656
--- /dev/null
+++ b/include/linux/string_helpers.h
@@ -0,0 +1,16 @@
1#ifndef _LINUX_STRING_HELPERS_H_
2#define _LINUX_STRING_HELPERS_H_
3
4#include <linux/types.h>
5
6/* Descriptions of the types of units to
7 * print in */
8enum string_size_units {
9 STRING_UNITS_10, /* use powers of 10^3 (standard SI) */
10 STRING_UNITS_2, /* use binary powers of 2^10 */
11};
12
13int string_get_size(u64 size, enum string_size_units units,
14 char *buf, int len);
15
16#endif
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index e5bfe01ee305..6f0ee1b84a4f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -104,6 +104,7 @@ struct rpc_create_args {
104 const struct rpc_timeout *timeout; 104 const struct rpc_timeout *timeout;
105 char *servername; 105 char *servername;
106 struct rpc_program *program; 106 struct rpc_program *program;
107 u32 prognumber; /* overrides program->number */
107 u32 version; 108 u32 version;
108 rpc_authflavor_t authflavor; 109 rpc_authflavor_t authflavor;
109 unsigned long flags; 110 unsigned long flags;
@@ -124,10 +125,10 @@ struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
124void rpc_shutdown_client(struct rpc_clnt *); 125void rpc_shutdown_client(struct rpc_clnt *);
125void rpc_release_client(struct rpc_clnt *); 126void rpc_release_client(struct rpc_clnt *);
126 127
127int rpcb_register(u32, u32, int, unsigned short, int *); 128int rpcb_register(u32, u32, int, unsigned short);
128int rpcb_v4_register(const u32 program, const u32 version, 129int rpcb_v4_register(const u32 program, const u32 version,
129 const struct sockaddr *address, 130 const struct sockaddr *address,
130 const char *netid, int *result); 131 const char *netid);
131int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int); 132int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
132void rpcb_getport_async(struct rpc_task *); 133void rpcb_getport_async(struct rpc_task *);
133 134
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index dc69068d94c7..3afe7fb403b2 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -66,6 +66,7 @@ struct svc_serv {
66 struct list_head sv_tempsocks; /* all temporary sockets */ 66 struct list_head sv_tempsocks; /* all temporary sockets */
67 int sv_tmpcnt; /* count of temporary sockets */ 67 int sv_tmpcnt; /* count of temporary sockets */
68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */ 68 struct timer_list sv_temptimer; /* timer for aging temporary sockets */
69 sa_family_t sv_family; /* listener's address family */
69 70
70 char * sv_name; /* service name */ 71 char * sv_name; /* service name */
71 72
@@ -265,17 +266,17 @@ struct svc_rqst {
265/* 266/*
266 * Rigorous type checking on sockaddr type conversions 267 * Rigorous type checking on sockaddr type conversions
267 */ 268 */
268static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) 269static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst)
269{ 270{
270 return (struct sockaddr_in *) &rqst->rq_addr; 271 return (struct sockaddr_in *) &rqst->rq_addr;
271} 272}
272 273
273static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) 274static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst)
274{ 275{
275 return (struct sockaddr_in6 *) &rqst->rq_addr; 276 return (struct sockaddr_in6 *) &rqst->rq_addr;
276} 277}
277 278
278static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) 279static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst)
279{ 280{
280 return (struct sockaddr *) &rqst->rq_addr; 281 return (struct sockaddr *) &rqst->rq_addr;
281} 282}
@@ -381,18 +382,20 @@ struct svc_procedure {
381/* 382/*
382 * Function prototypes. 383 * Function prototypes.
383 */ 384 */
384struct svc_serv * svc_create(struct svc_program *, unsigned int, 385struct svc_serv *svc_create(struct svc_program *, unsigned int, sa_family_t,
385 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv *));
386struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, 387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
387 struct svc_pool *pool); 388 struct svc_pool *pool);
388void svc_exit_thread(struct svc_rqst *); 389void svc_exit_thread(struct svc_rqst *);
389struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 390struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
390 void (*shutdown)(struct svc_serv*), svc_thread_fn, 391 sa_family_t, void (*shutdown)(struct svc_serv *),
391 struct module *); 392 svc_thread_fn, struct module *);
392int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); 393int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
393void svc_destroy(struct svc_serv *); 394void svc_destroy(struct svc_serv *);
394int svc_process(struct svc_rqst *); 395int svc_process(struct svc_rqst *);
395int svc_register(struct svc_serv *, int, unsigned short); 396int svc_register(const struct svc_serv *, const unsigned short,
397 const unsigned short);
398
396void svc_wake_up(struct svc_serv *); 399void svc_wake_up(struct svc_serv *);
397void svc_reserve(struct svc_rqst *rqstp, int space); 400void svc_reserve(struct svc_rqst *rqstp, int space);
398struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); 401struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu);
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index dc05b54bd3a3..c14fe86dac59 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -72,6 +72,7 @@ extern atomic_t rdma_stat_sq_prod;
72 */ 72 */
73struct svc_rdma_op_ctxt { 73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *read_hdr; 74 struct svc_rdma_op_ctxt *read_hdr;
75 struct svc_rdma_fastreg_mr *frmr;
75 int hdr_count; 76 int hdr_count;
76 struct xdr_buf arg; 77 struct xdr_buf arg;
77 struct list_head dto_q; 78 struct list_head dto_q;
@@ -103,16 +104,30 @@ struct svc_rdma_chunk_sge {
103 int start; /* sge no for this chunk */ 104 int start; /* sge no for this chunk */
104 int count; /* sge count for this chunk */ 105 int count; /* sge count for this chunk */
105}; 106};
107struct svc_rdma_fastreg_mr {
108 struct ib_mr *mr;
109 void *kva;
110 struct ib_fast_reg_page_list *page_list;
111 int page_list_len;
112 unsigned long access_flags;
113 unsigned long map_len;
114 enum dma_data_direction direction;
115 struct list_head frmr_list;
116};
106struct svc_rdma_req_map { 117struct svc_rdma_req_map {
118 struct svc_rdma_fastreg_mr *frmr;
107 unsigned long count; 119 unsigned long count;
108 union { 120 union {
109 struct kvec sge[RPCSVC_MAXPAGES]; 121 struct kvec sge[RPCSVC_MAXPAGES];
110 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; 122 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
111 }; 123 };
112}; 124};
113 125#define RDMACTXT_F_FAST_UNREG 1
114#define RDMACTXT_F_LAST_CTXT 2 126#define RDMACTXT_F_LAST_CTXT 2
115 127
128#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
129#define SVCRDMA_DEVCAP_READ_W_INV 2 /* read w/ invalidate */
130
116struct svcxprt_rdma { 131struct svcxprt_rdma {
117 struct svc_xprt sc_xprt; /* SVC transport structure */ 132 struct svc_xprt sc_xprt; /* SVC transport structure */
118 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */ 133 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
@@ -136,6 +151,11 @@ struct svcxprt_rdma {
136 struct ib_cq *sc_rq_cq; 151 struct ib_cq *sc_rq_cq;
137 struct ib_cq *sc_sq_cq; 152 struct ib_cq *sc_sq_cq;
138 struct ib_mr *sc_phys_mr; /* MR for server memory */ 153 struct ib_mr *sc_phys_mr; /* MR for server memory */
154 u32 sc_dev_caps; /* distilled device caps */
155 u32 sc_dma_lkey; /* local dma key */
156 unsigned int sc_frmr_pg_list_len;
157 struct list_head sc_frmr_q;
158 spinlock_t sc_frmr_q_lock;
139 159
140 spinlock_t sc_lock; /* transport lock */ 160 spinlock_t sc_lock; /* transport lock */
141 161
@@ -192,8 +212,13 @@ extern int svc_rdma_post_recv(struct svcxprt_rdma *);
192extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *); 212extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
193extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *); 213extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
194extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int); 214extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
215extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
195extern struct svc_rdma_req_map *svc_rdma_get_req_map(void); 216extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
196extern void svc_rdma_put_req_map(struct svc_rdma_req_map *); 217extern void svc_rdma_put_req_map(struct svc_rdma_req_map *);
218extern int svc_rdma_fastreg(struct svcxprt_rdma *, struct svc_rdma_fastreg_mr *);
219extern struct svc_rdma_fastreg_mr *svc_rdma_get_frmr(struct svcxprt_rdma *);
220extern void svc_rdma_put_frmr(struct svcxprt_rdma *,
221 struct svc_rdma_fastreg_mr *);
197extern void svc_sq_reap(struct svcxprt_rdma *); 222extern void svc_sq_reap(struct svcxprt_rdma *);
198extern void svc_rq_reap(struct svcxprt_rdma *); 223extern void svc_rq_reap(struct svcxprt_rdma *);
199extern struct svc_xprt_class svc_rdma_class; 224extern struct svc_xprt_class svc_rdma_class;
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 8cff696dedf5..483e10380aae 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -39,10 +39,7 @@ int svc_send(struct svc_rqst *);
39void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
40void svc_sock_update_bufs(struct svc_serv *serv); 40void svc_sock_update_bufs(struct svc_serv *serv);
41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); 41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose);
42int svc_addsock(struct svc_serv *serv, 42int svc_addsock(struct svc_serv *serv, int fd, char *name_return);
43 int fd,
44 char *name_return,
45 int *proto);
46void svc_init_xprt_sock(void); 43void svc_init_xprt_sock(void);
47void svc_cleanup_xprt_sock(void); 44void svc_cleanup_xprt_sock(void);
48 45
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
index 4de56b1d372b..54a379c9e8eb 100644
--- a/include/linux/sunrpc/xprtrdma.h
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -66,9 +66,6 @@
66 66
67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */ 67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
68 68
69#define RDMA_RESOLVE_TIMEOUT (5*HZ) /* TBD 5 seconds */
70#define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */
71
72/* memory registration strategies */ 69/* memory registration strategies */
73#define RPCRDMA_PERSISTENT_REGISTRATION (1) 70#define RPCRDMA_PERSISTENT_REGISTRATION (1)
74 71
@@ -78,6 +75,7 @@ enum rpcrdma_memreg {
78 RPCRDMA_MEMWINDOWS, 75 RPCRDMA_MEMWINDOWS,
79 RPCRDMA_MEMWINDOWS_ASYNC, 76 RPCRDMA_MEMWINDOWS_ASYNC,
80 RPCRDMA_MTHCAFMR, 77 RPCRDMA_MTHCAFMR,
78 RPCRDMA_FRMR,
81 RPCRDMA_ALLPHYSICAL, 79 RPCRDMA_ALLPHYSICAL,
82 RPCRDMA_LAST 80 RPCRDMA_LAST
83}; 81};
diff --git a/include/linux/swab.h b/include/linux/swab.h
index 270d5c208a89..bbed279f3b32 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -47,8 +47,6 @@ static inline __attribute_const__ __u16 ___swab16(__u16 val)
47{ 47{
48#ifdef __arch_swab16 48#ifdef __arch_swab16
49 return __arch_swab16(val); 49 return __arch_swab16(val);
50#elif defined(__arch_swab16p)
51 return __arch_swab16p(&val);
52#else 50#else
53 return __const_swab16(val); 51 return __const_swab16(val);
54#endif 52#endif
@@ -58,8 +56,6 @@ static inline __attribute_const__ __u32 ___swab32(__u32 val)
58{ 56{
59#ifdef __arch_swab32 57#ifdef __arch_swab32
60 return __arch_swab32(val); 58 return __arch_swab32(val);
61#elif defined(__arch_swab32p)
62 return __arch_swab32p(&val);
63#else 59#else
64 return __const_swab32(val); 60 return __const_swab32(val);
65#endif 61#endif
@@ -69,8 +65,6 @@ static inline __attribute_const__ __u64 ___swab64(__u64 val)
69{ 65{
70#ifdef __arch_swab64 66#ifdef __arch_swab64
71 return __arch_swab64(val); 67 return __arch_swab64(val);
72#elif defined(__arch_swab64p)
73 return __arch_swab64p(&val);
74#elif defined(__SWAB_64_THRU_32__) 68#elif defined(__SWAB_64_THRU_32__)
75 __u32 h = val >> 32; 69 __u32 h = val >> 32;
76 __u32 l = val & ((1ULL << 32) - 1); 70 __u32 l = val & ((1ULL << 32) - 1);
@@ -84,8 +78,6 @@ static inline __attribute_const__ __u32 ___swahw32(__u32 val)
84{ 78{
85#ifdef __arch_swahw32 79#ifdef __arch_swahw32
86 return __arch_swahw32(val); 80 return __arch_swahw32(val);
87#elif defined(__arch_swahw32p)
88 return __arch_swahw32p(&val);
89#else 81#else
90 return __const_swahw32(val); 82 return __const_swahw32(val);
91#endif 83#endif
@@ -95,8 +87,6 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
95{ 87{
96#ifdef __arch_swahb32 88#ifdef __arch_swahb32
97 return __arch_swahb32(val); 89 return __arch_swahb32(val);
98#elif defined(__arch_swahb32p)
99 return __arch_swahb32p(&val);
100#else 90#else
101 return __const_swahb32(val); 91 return __const_swahb32(val);
102#endif 92#endif
diff --git a/include/linux/swap.h b/include/linux/swap.h
index de40f169a4e4..a3af95b2cb6d 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -7,6 +7,7 @@
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/memcontrol.h> 8#include <linux/memcontrol.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/node.h>
10 11
11#include <asm/atomic.h> 12#include <asm/atomic.h>
12#include <asm/page.h> 13#include <asm/page.h>
@@ -171,8 +172,10 @@ extern unsigned int nr_free_pagecache_pages(void);
171 172
172 173
173/* linux/mm/swap.c */ 174/* linux/mm/swap.c */
174extern void lru_cache_add(struct page *); 175extern void __lru_cache_add(struct page *, enum lru_list lru);
175extern void lru_cache_add_active(struct page *); 176extern void lru_cache_add_lru(struct page *, enum lru_list lru);
177extern void lru_cache_add_active_or_unevictable(struct page *,
178 struct vm_area_struct *);
176extern void activate_page(struct page *); 179extern void activate_page(struct page *);
177extern void mark_page_accessed(struct page *); 180extern void mark_page_accessed(struct page *);
178extern void lru_add_drain(void); 181extern void lru_add_drain(void);
@@ -180,12 +183,38 @@ extern int lru_add_drain_all(void);
180extern void rotate_reclaimable_page(struct page *page); 183extern void rotate_reclaimable_page(struct page *page);
181extern void swap_setup(void); 184extern void swap_setup(void);
182 185
186extern void add_page_to_unevictable_list(struct page *page);
187
188/**
189 * lru_cache_add: add a page to the page lists
190 * @page: the page to add
191 */
192static inline void lru_cache_add_anon(struct page *page)
193{
194 __lru_cache_add(page, LRU_INACTIVE_ANON);
195}
196
197static inline void lru_cache_add_active_anon(struct page *page)
198{
199 __lru_cache_add(page, LRU_ACTIVE_ANON);
200}
201
202static inline void lru_cache_add_file(struct page *page)
203{
204 __lru_cache_add(page, LRU_INACTIVE_FILE);
205}
206
207static inline void lru_cache_add_active_file(struct page *page)
208{
209 __lru_cache_add(page, LRU_ACTIVE_FILE);
210}
211
183/* linux/mm/vmscan.c */ 212/* linux/mm/vmscan.c */
184extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 213extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
185 gfp_t gfp_mask); 214 gfp_t gfp_mask);
186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 215extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
187 gfp_t gfp_mask); 216 gfp_t gfp_mask);
188extern int __isolate_lru_page(struct page *page, int mode); 217extern int __isolate_lru_page(struct page *page, int mode, int file);
189extern unsigned long shrink_all_memory(unsigned long nr_pages); 218extern unsigned long shrink_all_memory(unsigned long nr_pages);
190extern int vm_swappiness; 219extern int vm_swappiness;
191extern int remove_mapping(struct address_space *mapping, struct page *page); 220extern int remove_mapping(struct address_space *mapping, struct page *page);
@@ -204,6 +233,34 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
204} 233}
205#endif 234#endif
206 235
236#ifdef CONFIG_UNEVICTABLE_LRU
237extern int page_evictable(struct page *page, struct vm_area_struct *vma);
238extern void scan_mapping_unevictable_pages(struct address_space *);
239
240extern unsigned long scan_unevictable_pages;
241extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
242 void __user *, size_t *, loff_t *);
243extern int scan_unevictable_register_node(struct node *node);
244extern void scan_unevictable_unregister_node(struct node *node);
245#else
246static inline int page_evictable(struct page *page,
247 struct vm_area_struct *vma)
248{
249 return 1;
250}
251
252static inline void scan_mapping_unevictable_pages(struct address_space *mapping)
253{
254}
255
256static inline int scan_unevictable_register_node(struct node *node)
257{
258 return 0;
259}
260
261static inline void scan_unevictable_unregister_node(struct node *node) { }
262#endif
263
207extern int kswapd_run(int nid); 264extern int kswapd_run(int nid);
208 265
209#ifdef CONFIG_MMU 266#ifdef CONFIG_MMU
@@ -251,6 +308,7 @@ extern sector_t swapdev_block(int, pgoff_t);
251extern struct swap_info_struct *get_swap_info_struct(unsigned); 308extern struct swap_info_struct *get_swap_info_struct(unsigned);
252extern int can_share_swap_page(struct page *); 309extern int can_share_swap_page(struct page *);
253extern int remove_exclusive_swap_page(struct page *); 310extern int remove_exclusive_swap_page(struct page *);
311extern int remove_exclusive_swap_page_ref(struct page *);
254struct backing_dev_info; 312struct backing_dev_info;
255 313
256/* linux/mm/thrash.c */ 314/* linux/mm/thrash.c */
@@ -339,6 +397,11 @@ static inline int remove_exclusive_swap_page(struct page *p)
339 return 0; 397 return 0;
340} 398}
341 399
400static inline int remove_exclusive_swap_page_ref(struct page *page)
401{
402 return 0;
403}
404
342static inline swp_entry_t get_swap_page(void) 405static inline swp_entry_t get_swap_page(void)
343{ 406{
344 swp_entry_t entry; 407 swp_entry_t entry;
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
new file mode 100644
index 000000000000..b18ec5533e8c
--- /dev/null
+++ b/include/linux/swiotlb.h
@@ -0,0 +1,83 @@
1#ifndef __LINUX_SWIOTLB_H
2#define __LINUX_SWIOTLB_H
3
4#include <linux/types.h>
5
6struct device;
7struct dma_attrs;
8struct scatterlist;
9
10extern void
11swiotlb_init(void);
12
13extern void
14*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
15 dma_addr_t *dma_handle, gfp_t flags);
16
17extern void
18swiotlb_free_coherent(struct device *hwdev, size_t size,
19 void *vaddr, dma_addr_t dma_handle);
20
21extern dma_addr_t
22swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir);
23
24extern void
25swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
26 size_t size, int dir);
27
28extern dma_addr_t
29swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
30 int dir, struct dma_attrs *attrs);
31
32extern void
33swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
34 size_t size, int dir, struct dma_attrs *attrs);
35
36extern int
37swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
38 int direction);
39
40extern void
41swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
42 int direction);
43
44extern int
45swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
46 int dir, struct dma_attrs *attrs);
47
48extern void
49swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
50 int nelems, int dir, struct dma_attrs *attrs);
51
52extern void
53swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
54 size_t size, int dir);
55
56extern void
57swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
58 int nelems, int dir);
59
60extern void
61swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
62 size_t size, int dir);
63
64extern void
65swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
66 int nelems, int dir);
67
68extern void
69swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
70 unsigned long offset, size_t size, int dir);
71
72extern void
73swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
74 unsigned long offset, size_t size,
75 int dir);
76
77extern int
78swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
79
80extern int
81swiotlb_dma_supported(struct device *hwdev, u64 mask);
82
83#endif /* __LINUX_SWIOTLB_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d0437f36921f..39d471d1163b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -972,7 +972,7 @@ extern int sysctl_perm(struct ctl_table_root *root,
972 972
973typedef struct ctl_table ctl_table; 973typedef struct ctl_table ctl_table;
974 974
975typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen, 975typedef int ctl_handler (struct ctl_table *table,
976 void __user *oldval, size_t __user *oldlenp, 976 void __user *oldval, size_t __user *oldlenp,
977 void __user *newval, size_t newlen); 977 void __user *newval, size_t newlen);
978 978
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 37fa24152bd8..9d68fed50f11 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -21,8 +21,9 @@ struct kobject;
21struct module; 21struct module;
22 22
23/* FIXME 23/* FIXME
24 * The *owner field is no longer used, but leave around 24 * The *owner field is no longer used.
25 * until the tree gets cleaned up fully. 25 * x86 tree has been cleaned up. The owner
26 * attribute is still left for other arches.
26 */ 27 */
27struct attribute { 28struct attribute {
28 const char *name; 29 const char *name;
@@ -78,6 +79,8 @@ struct sysfs_ops {
78 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 79 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
79}; 80};
80 81
82struct sysfs_dirent;
83
81#ifdef CONFIG_SYSFS 84#ifdef CONFIG_SYSFS
82 85
83int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 86int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
@@ -117,9 +120,14 @@ int sysfs_add_file_to_group(struct kobject *kobj,
117void sysfs_remove_file_from_group(struct kobject *kobj, 120void sysfs_remove_file_from_group(struct kobject *kobj,
118 const struct attribute *attr, const char *group); 121 const struct attribute *attr, const char *group);
119 122
120void sysfs_notify(struct kobject *kobj, char *dir, char *attr); 123void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
121 124void sysfs_notify_dirent(struct sysfs_dirent *sd);
122extern int __must_check sysfs_init(void); 125struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
126 const unsigned char *name);
127struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
128void sysfs_put(struct sysfs_dirent *sd);
129void sysfs_printk_last_file(void);
130int __must_check sysfs_init(void);
123 131
124#else /* CONFIG_SYSFS */ 132#else /* CONFIG_SYSFS */
125 133
@@ -222,7 +230,24 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj,
222{ 230{
223} 231}
224 232
225static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr) 233static inline void sysfs_notify(struct kobject *kobj, const char *dir,
234 const char *attr)
235{
236}
237static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
238{
239}
240static inline
241struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
242 const unsigned char *name)
243{
244 return NULL;
245}
246static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd)
247{
248 return NULL;
249}
250static inline void sysfs_put(struct sysfs_dirent *sd)
226{ 251{
227} 252}
228 253
@@ -231,6 +256,10 @@ static inline int __must_check sysfs_init(void)
231 return 0; 256 return 0;
232} 257}
233 258
259static inline void sysfs_printk_last_file(void)
260{
261}
262
234#endif /* CONFIG_SYSFS */ 263#endif /* CONFIG_SYSFS */
235 264
236#endif /* _SYSFS_H_ */ 265#endif /* _SYSFS_H_ */
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index 5e88afc9a2fb..bdf855c2856f 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -5,7 +5,7 @@
5 * Don't include this header file directly - it is designed to be dragged in via 5 * Don't include this header file directly - it is designed to be dragged in via
6 * sched.h. 6 * sched.h.
7 * 7 *
8 * Blame akpm@osdl.org for all this. 8 * Blame Andrew Morton for all this.
9 */ 9 */
10 10
11struct task_io_accounting { 11struct task_io_accounting {
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
index 6dac0d7365cc..76990937f4c9 100644
--- a/include/linux/tc_act/Kbuild
+++ b/include/linux/tc_act/Kbuild
@@ -3,3 +3,4 @@ header-y += tc_ipt.h
3header-y += tc_mirred.h 3header-y += tc_mirred.h
4header-y += tc_pedit.h 4header-y += tc_pedit.h
5header-y += tc_nat.h 5header-y += tc_nat.h
6header-y += tc_skbedit.h
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h
new file mode 100644
index 000000000000..a14e461a7af7
--- /dev/null
+++ b/include/linux/tc_act/tc_skbedit.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Alexander Duyck <alexander.h.duyck@intel.com>
18 */
19
20#ifndef __LINUX_TC_SKBEDIT_H
21#define __LINUX_TC_SKBEDIT_H
22
23#include <linux/pkt_cls.h>
24
25#define TCA_ACT_SKBEDIT 11
26
27#define SKBEDIT_F_PRIORITY 0x1
28#define SKBEDIT_F_QUEUE_MAPPING 0x2
29
30struct tc_skbedit {
31 tc_gen;
32};
33
34enum {
35 TCA_SKBEDIT_UNSPEC,
36 TCA_SKBEDIT_TM,
37 TCA_SKBEDIT_PARMS,
38 TCA_SKBEDIT_PRIORITY,
39 TCA_SKBEDIT_QUEUE_MAPPING,
40 __TCA_SKBEDIT_MAX
41};
42#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
43
44#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 2e2557388e36..fe77e1499ab7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -312,8 +312,11 @@ struct tcp_sock {
312 u32 retrans_out; /* Retransmitted packets out */ 312 u32 retrans_out; /* Retransmitted packets out */
313 313
314 u16 urg_data; /* Saved octet of OOB data and control flags */ 314 u16 urg_data; /* Saved octet of OOB data and control flags */
315 u8 urg_mode; /* In urgent mode */
316 u8 ecn_flags; /* ECN status bits. */ 315 u8 ecn_flags; /* ECN status bits. */
316 u8 reordering; /* Packet reordering metric. */
317 u32 snd_up; /* Urgent pointer */
318
319 u8 keepalive_probes; /* num of allowed keep alive probes */
317/* 320/*
318 * Options received (usually on last packet, some only on SYN packets). 321 * Options received (usually on last packet, some only on SYN packets).
319 */ 322 */
@@ -342,7 +345,6 @@ struct tcp_sock {
342 struct sk_buff* lost_skb_hint; 345 struct sk_buff* lost_skb_hint;
343 struct sk_buff *scoreboard_skb_hint; 346 struct sk_buff *scoreboard_skb_hint;
344 struct sk_buff *retransmit_skb_hint; 347 struct sk_buff *retransmit_skb_hint;
345 struct sk_buff *forward_skb_hint;
346 348
347 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 349 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
348 350
@@ -358,12 +360,10 @@ struct tcp_sock {
358 */ 360 */
359 361
360 int lost_cnt_hint; 362 int lost_cnt_hint;
361 int retransmit_cnt_hint; 363 u32 retransmit_high; /* L-bits may be on up to this seqno */
362 364
363 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ 365 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
364 366
365 u8 reordering; /* Packet reordering metric. */
366 u8 keepalive_probes; /* num of allowed keep alive probes */
367 u32 prior_ssthresh; /* ssthresh saved at recovery start */ 367 u32 prior_ssthresh; /* ssthresh saved at recovery start */
368 u32 high_seq; /* snd_nxt at onset of congestion */ 368 u32 high_seq; /* snd_nxt at onset of congestion */
369 369
@@ -375,8 +375,6 @@ struct tcp_sock {
375 u32 total_retrans; /* Total retransmits for entire connection */ 375 u32 total_retrans; /* Total retransmits for entire connection */
376 376
377 u32 urg_seq; /* Seq of received urgent pointer */ 377 u32 urg_seq; /* Seq of received urgent pointer */
378 u32 snd_up; /* Urgent pointer */
379
380 unsigned int keepalive_time; /* time before keep alive takes place */ 378 unsigned int keepalive_time; /* time before keep alive takes place */
381 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
382 380
diff --git a/include/linux/telephony.h b/include/linux/telephony.h
index 0d0cf2a1e7bc..5b2b6261f193 100644
--- a/include/linux/telephony.h
+++ b/include/linux/telephony.h
@@ -28,10 +28,6 @@
28 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION 28 * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
29 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 29 * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
30 * 30 *
31 * Version: $Revision: 4.2 $
32 *
33 * $Id: telephony.h,v 4.2 2001/08/06 07:09:43 craigs Exp $
34 *
35 *****************************************************************************/ 31 *****************************************************************************/
36 32
37#ifndef TELEPHONY_H 33#ifndef TELEPHONY_H
diff --git a/include/linux/termios.h b/include/linux/termios.h
index 478662889f48..2acd0c1f8a2a 100644
--- a/include/linux/termios.h
+++ b/include/linux/termios.h
@@ -4,4 +4,19 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/termios.h> 5#include <asm/termios.h>
6 6
7#define NFF 5
8
9struct termiox
10{
11 __u16 x_hflag;
12 __u16 x_cflag;
13 __u16 x_rflag[NFF];
14 __u16 x_sflag;
15};
16
17#define RTSXOFF 0x0001 /* RTS flow control on input */
18#define CTSXON 0x0002 /* CTS flow control on output */
19#define DTRXOFF 0x0004 /* DTR flow control on input */
20#define DSRXON 0x0008 /* DCD flow control on output */
21
7#endif 22#endif
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 38a56477f27a..e6b820f8b56b 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -38,6 +38,14 @@ struct restart_block {
38#endif 38#endif
39 u64 expires; 39 u64 expires;
40 } nanosleep; 40 } nanosleep;
41 /* For poll */
42 struct {
43 struct pollfd __user *ufds;
44 int nfds;
45 int has_timeout;
46 unsigned long tv_sec;
47 unsigned long tv_nsec;
48 } poll;
41 }; 49 };
42}; 50};
43 51
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 8cf8cfe2cc97..b6ec8189ac0c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -96,9 +96,11 @@ extern cpumask_t *tick_get_broadcast_oneshot_mask(void);
96extern void tick_clock_notify(void); 96extern void tick_clock_notify(void);
97extern int tick_check_oneshot_change(int allow_nohz); 97extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 98extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu);
99# else 100# else
100static inline void tick_clock_notify(void) { } 101static inline void tick_clock_notify(void) { }
101static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 102static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
103static inline void tick_check_idle(int cpu) { }
102# endif 104# endif
103 105
104#else /* CONFIG_GENERIC_CLOCKEVENTS */ 106#else /* CONFIG_GENERIC_CLOCKEVENTS */
@@ -106,27 +108,24 @@ static inline void tick_init(void) { }
106static inline void tick_cancel_sched_timer(int cpu) { } 108static inline void tick_cancel_sched_timer(int cpu) { }
107static inline void tick_clock_notify(void) { } 109static inline void tick_clock_notify(void) { }
108static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 110static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
111static inline void tick_check_idle(int cpu) { }
109#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 112#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
110 113
111# ifdef CONFIG_NO_HZ 114# ifdef CONFIG_NO_HZ
112extern void tick_nohz_stop_sched_tick(int inidle); 115extern void tick_nohz_stop_sched_tick(int inidle);
113extern void tick_nohz_restart_sched_tick(void); 116extern void tick_nohz_restart_sched_tick(void);
114extern void tick_nohz_update_jiffies(void);
115extern ktime_t tick_nohz_get_sleep_length(void); 117extern ktime_t tick_nohz_get_sleep_length(void);
116extern void tick_nohz_stop_idle(int cpu);
117extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 118extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
118# else 119# else
119static inline void tick_nohz_stop_sched_tick(int inidle) { } 120static inline void tick_nohz_stop_sched_tick(int inidle) { }
120static inline void tick_nohz_restart_sched_tick(void) { } 121static inline void tick_nohz_restart_sched_tick(void) { }
121static inline void tick_nohz_update_jiffies(void) { }
122static inline ktime_t tick_nohz_get_sleep_length(void) 122static inline ktime_t tick_nohz_get_sleep_length(void)
123{ 123{
124 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ }; 124 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
125 125
126 return len; 126 return len;
127} 127}
128static inline void tick_nohz_stop_idle(int cpu) { } 128static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
129static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; }
130# endif /* !NO_HZ */ 129# endif /* !NO_HZ */
131 130
132#endif 131#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index e15206a7e82e..ce321ac5c8f8 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -29,6 +29,8 @@ struct timezone {
29 29
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31 31
32extern struct timezone sys_tz;
33
32/* Parameters used to convert the timespec values: */ 34/* Parameters used to convert the timespec values: */
33#define MSEC_PER_SEC 1000L 35#define MSEC_PER_SEC 1000L
34#define USEC_PER_MSEC 1000L 36#define USEC_PER_MSEC 1000L
@@ -38,6 +40,8 @@ struct timezone {
38#define NSEC_PER_SEC 1000000000L 40#define NSEC_PER_SEC 1000000000L
39#define FSEC_PER_SEC 1000000000000000L 41#define FSEC_PER_SEC 1000000000000000L
40 42
43#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
44
41static inline int timespec_equal(const struct timespec *a, 45static inline int timespec_equal(const struct timespec *a,
42 const struct timespec *b) 46 const struct timespec *b)
43{ 47{
@@ -72,6 +76,8 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
72 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
73 77
74extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
79extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs);
75 81
76/* 82/*
77 * sub = lhs - rhs, in normalized form 83 * sub = lhs - rhs, in normalized form
@@ -117,6 +123,7 @@ extern int do_setitimer(int which, struct itimerval *value,
117extern unsigned int alarm_setitimer(unsigned int seconds); 123extern unsigned int alarm_setitimer(unsigned int seconds);
118extern int do_getitimer(int which, struct itimerval *value); 124extern int do_getitimer(int which, struct itimerval *value);
119extern void getnstimeofday(struct timespec *tv); 125extern void getnstimeofday(struct timespec *tv);
126extern void getrawmonotonic(struct timespec *ts);
120extern void getboottime(struct timespec *ts); 127extern void getboottime(struct timespec *ts);
121extern void monotonic_to_bootbased(struct timespec *ts); 128extern void monotonic_to_bootbased(struct timespec *ts);
122 129
@@ -125,6 +132,9 @@ extern int timekeeping_valid_for_hres(void);
125extern void update_wall_time(void); 132extern void update_wall_time(void);
126extern void update_xtime_cache(u64 nsec); 133extern void update_xtime_cache(u64 nsec);
127 134
135struct tms;
136extern void do_sys_times(struct tms *);
137
128/** 138/**
129 * timespec_to_ns - Convert timespec to nanoseconds 139 * timespec_to_ns - Convert timespec to nanoseconds
130 * @ts: pointer to the timespec variable to be converted 140 * @ts: pointer to the timespec variable to be converted
@@ -214,6 +224,7 @@ struct itimerval {
214#define CLOCK_MONOTONIC 1 224#define CLOCK_MONOTONIC 1
215#define CLOCK_PROCESS_CPUTIME_ID 2 225#define CLOCK_PROCESS_CPUTIME_ID 2
216#define CLOCK_THREAD_CPUTIME_ID 3 226#define CLOCK_THREAD_CPUTIME_ID 3
227#define CLOCK_MONOTONIC_RAW 4
217 228
218/* 229/*
219 * The IDs of various hardware clocks: 230 * The IDs of various hardware clocks:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index fc6035d29d56..9007313b5b71 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -82,7 +82,7 @@
82 */ 82 */
83#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 83#define SHIFT_USEC 16 /* frequency offset scale (shift) */
84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
85#define PPM_SCALE_INV_SHIFT 20 85#define PPM_SCALE_INV_SHIFT 19
86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
87 PPM_SCALE + 1) 87 PPM_SCALE + 1)
88 88
@@ -141,8 +141,15 @@ struct timex {
141#define ADJ_MICRO 0x1000 /* select microsecond resolution */ 141#define ADJ_MICRO 0x1000 /* select microsecond resolution */
142#define ADJ_NANO 0x2000 /* select nanosecond resolution */ 142#define ADJ_NANO 0x2000 /* select nanosecond resolution */
143#define ADJ_TICK 0x4000 /* tick value */ 143#define ADJ_TICK 0x4000 /* tick value */
144
145#ifdef __KERNEL__
146#define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */
147#define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */
148#define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */
149#else
144#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 150#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
145#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ 151#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
152#endif
146 153
147/* xntp 3.4 compatibility names */ 154/* xntp 3.4 compatibility names */
148#define MOD_OFFSET ADJ_OFFSET 155#define MOD_OFFSET ADJ_OFFSET
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
new file mode 100644
index 000000000000..c5bb39c7a770
--- /dev/null
+++ b/include/linux/tracepoint.h
@@ -0,0 +1,137 @@
1#ifndef _LINUX_TRACEPOINT_H
2#define _LINUX_TRACEPOINT_H
3
4/*
5 * Kernel Tracepoint API.
6 *
7 * See Documentation/tracepoint.txt.
8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 *
11 * Heavily inspired from the Linux Kernel Markers.
12 *
13 * This file is released under the GPLv2.
14 * See the file COPYING for more details.
15 */
16
17#include <linux/types.h>
18#include <linux/rcupdate.h>
19
20struct module;
21struct tracepoint;
22
23struct tracepoint {
24 const char *name; /* Tracepoint name */
25 int state; /* State. */
26 void **funcs;
27} __attribute__((aligned(8)));
28
29
30#define TPPROTO(args...) args
31#define TPARGS(args...) args
32
33#ifdef CONFIG_TRACEPOINTS
34
35/*
36 * it_func[0] is never NULL because there is at least one element in the array
37 * when the array itself is non NULL.
38 */
39#define __DO_TRACE(tp, proto, args) \
40 do { \
41 void **it_func; \
42 \
43 rcu_read_lock_sched(); \
44 it_func = rcu_dereference((tp)->funcs); \
45 if (it_func) { \
46 do { \
47 ((void(*)(proto))(*it_func))(args); \
48 } while (*(++it_func)); \
49 } \
50 rcu_read_unlock_sched(); \
51 } while (0)
52
53/*
54 * Make sure the alignment of the structure in the __tracepoints section will
55 * not add unwanted padding between the beginning of the section and the
56 * structure. Force alignment to the same alignment as the section start.
57 */
58#define DEFINE_TRACE(name, proto, args) \
59 static inline void trace_##name(proto) \
60 { \
61 static const char __tpstrtab_##name[] \
62 __attribute__((section("__tracepoints_strings"))) \
63 = #name ":" #proto; \
64 static struct tracepoint __tracepoint_##name \
65 __attribute__((section("__tracepoints"), aligned(8))) = \
66 { __tpstrtab_##name, 0, NULL }; \
67 if (unlikely(__tracepoint_##name.state)) \
68 __DO_TRACE(&__tracepoint_##name, \
69 TPPROTO(proto), TPARGS(args)); \
70 } \
71 static inline int register_trace_##name(void (*probe)(proto)) \
72 { \
73 return tracepoint_probe_register(#name ":" #proto, \
74 (void *)probe); \
75 } \
76 static inline void unregister_trace_##name(void (*probe)(proto))\
77 { \
78 tracepoint_probe_unregister(#name ":" #proto, \
79 (void *)probe); \
80 }
81
82extern void tracepoint_update_probe_range(struct tracepoint *begin,
83 struct tracepoint *end);
84
85#else /* !CONFIG_TRACEPOINTS */
86#define DEFINE_TRACE(name, proto, args) \
87 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
88 { } \
89 static inline void trace_##name(proto) \
90 { } \
91 static inline int register_trace_##name(void (*probe)(proto)) \
92 { \
93 return -ENOSYS; \
94 } \
95 static inline void unregister_trace_##name(void (*probe)(proto))\
96 { }
97
98static inline void tracepoint_update_probe_range(struct tracepoint *begin,
99 struct tracepoint *end)
100{ }
101#endif /* CONFIG_TRACEPOINTS */
102
103/*
104 * Connect a probe to a tracepoint.
105 * Internal API, should not be used directly.
106 */
107extern int tracepoint_probe_register(const char *name, void *probe);
108
109/*
110 * Disconnect a probe from a tracepoint.
111 * Internal API, should not be used directly.
112 */
113extern int tracepoint_probe_unregister(const char *name, void *probe);
114
115struct tracepoint_iter {
116 struct module *module;
117 struct tracepoint *tracepoint;
118};
119
120extern void tracepoint_iter_start(struct tracepoint_iter *iter);
121extern void tracepoint_iter_next(struct tracepoint_iter *iter);
122extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
123extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
124extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
125 struct tracepoint *begin, struct tracepoint *end);
126
127/*
128 * tracepoint_synchronize_unregister must be called between the last tracepoint
129 * probe unregistration and the end of module exit to make sure there is no
130 * caller executing a probe when it is freed.
131 */
132static inline void tracepoint_synchronize_unregister(void)
133{
134 synchronize_sched();
135}
136
137#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 0cbec74ec086..3b8121d4e36f 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 18 26#define NR_LDISCS 19
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -45,6 +45,7 @@
45#define N_HCI 15 /* Bluetooth HCI UART */ 45#define N_HCI 15 /* Bluetooth HCI UART */
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */
48 49
49/* 50/*
50 * This character is the same as _POSIX_VDISABLE: it cannot be used as 51 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -181,6 +182,7 @@ struct signal_struct;
181 182
182struct tty_port { 183struct tty_port {
183 struct tty_struct *tty; /* Back pointer */ 184 struct tty_struct *tty; /* Back pointer */
185 spinlock_t lock; /* Lock protecting tty field */
184 int blocked_open; /* Waiting to open */ 186 int blocked_open; /* Waiting to open */
185 int count; /* Usage count */ 187 int count; /* Usage count */
186 wait_queue_head_t open_wait; /* Open waiters */ 188 wait_queue_head_t open_wait; /* Open waiters */
@@ -208,6 +210,7 @@ struct tty_operations;
208 210
209struct tty_struct { 211struct tty_struct {
210 int magic; 212 int magic;
213 struct kref kref;
211 struct tty_driver *driver; 214 struct tty_driver *driver;
212 const struct tty_operations *ops; 215 const struct tty_operations *ops;
213 int index; 216 int index;
@@ -217,6 +220,7 @@ struct tty_struct {
217 spinlock_t ctrl_lock; 220 spinlock_t ctrl_lock;
218 /* Termios values are protected by the termios mutex */ 221 /* Termios values are protected by the termios mutex */
219 struct ktermios *termios, *termios_locked; 222 struct ktermios *termios, *termios_locked;
223 struct termiox *termiox; /* May be NULL for unsupported */
220 char name[64]; 224 char name[64];
221 struct pid *pgrp; /* Protected by ctrl lock */ 225 struct pid *pgrp; /* Protected by ctrl lock */
222 struct pid *session; 226 struct pid *session;
@@ -310,6 +314,25 @@ extern int kmsg_redirect;
310extern void console_init(void); 314extern void console_init(void);
311extern int vcs_init(void); 315extern int vcs_init(void);
312 316
317extern struct class *tty_class;
318
319/**
320 * tty_kref_get - get a tty reference
321 * @tty: tty device
322 *
323 * Return a new reference to a tty object. The caller must hold
324 * sufficient locks/counts to ensure that their existing reference cannot
325 * go away
326 */
327
328extern inline struct tty_struct *tty_kref_get(struct tty_struct *tty)
329{
330 if (tty)
331 kref_get(&tty->kref);
332 return tty;
333}
334extern void tty_kref_put(struct tty_struct *tty);
335
313extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 336extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
314 const char *routine); 337 const char *routine);
315extern char *tty_name(struct tty_struct *tty, char *buf); 338extern char *tty_name(struct tty_struct *tty, char *buf);
@@ -333,13 +356,15 @@ extern void tty_throttle(struct tty_struct *tty);
333extern void tty_unthrottle(struct tty_struct *tty); 356extern void tty_unthrottle(struct tty_struct *tty);
334extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, 357extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty,
335 struct winsize *ws); 358 struct winsize *ws);
336 359extern void tty_shutdown(struct tty_struct *tty);
360extern void tty_free_termios(struct tty_struct *tty);
337extern int is_current_pgrp_orphaned(void); 361extern int is_current_pgrp_orphaned(void);
338extern struct pid *tty_get_pgrp(struct tty_struct *tty); 362extern struct pid *tty_get_pgrp(struct tty_struct *tty);
339extern int is_ignored(int sig); 363extern int is_ignored(int sig);
340extern int tty_signal(int sig, struct tty_struct *tty); 364extern int tty_signal(int sig, struct tty_struct *tty);
341extern void tty_hangup(struct tty_struct *tty); 365extern void tty_hangup(struct tty_struct *tty);
342extern void tty_vhangup(struct tty_struct *tty); 366extern void tty_vhangup(struct tty_struct *tty);
367extern void tty_vhangup_self(void);
343extern void tty_unhangup(struct file *filp); 368extern void tty_unhangup(struct file *filp);
344extern int tty_hung_up_p(struct file *filp); 369extern int tty_hung_up_p(struct file *filp);
345extern void do_SAK(struct tty_struct *tty); 370extern void do_SAK(struct tty_struct *tty);
@@ -347,6 +372,9 @@ extern void __do_SAK(struct tty_struct *tty);
347extern void disassociate_ctty(int priv); 372extern void disassociate_ctty(int priv);
348extern void no_tty(void); 373extern void no_tty(void);
349extern void tty_flip_buffer_push(struct tty_struct *tty); 374extern void tty_flip_buffer_push(struct tty_struct *tty);
375extern void tty_buffer_free_all(struct tty_struct *tty);
376extern void tty_buffer_flush(struct tty_struct *tty);
377extern void tty_buffer_init(struct tty_struct *tty);
350extern speed_t tty_get_baud_rate(struct tty_struct *tty); 378extern speed_t tty_get_baud_rate(struct tty_struct *tty);
351extern speed_t tty_termios_baud_rate(struct ktermios *termios); 379extern speed_t tty_termios_baud_rate(struct ktermios *termios);
352extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 380extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
@@ -372,6 +400,15 @@ extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
372extern dev_t tty_devnum(struct tty_struct *tty); 400extern dev_t tty_devnum(struct tty_struct *tty);
373extern void proc_clear_tty(struct task_struct *p); 401extern void proc_clear_tty(struct task_struct *p);
374extern struct tty_struct *get_current_tty(void); 402extern struct tty_struct *get_current_tty(void);
403extern void tty_default_fops(struct file_operations *fops);
404extern struct tty_struct *alloc_tty_struct(void);
405extern void free_tty_struct(struct tty_struct *tty);
406extern void initialize_tty_struct(struct tty_struct *tty,
407 struct tty_driver *driver, int idx);
408extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
409 int first_ok);
410extern void tty_release_dev(struct file *filp);
411extern int tty_init_termios(struct tty_struct *tty);
375 412
376extern struct mutex tty_mutex; 413extern struct mutex tty_mutex;
377 414
@@ -382,6 +419,8 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
382extern void tty_port_init(struct tty_port *port); 419extern void tty_port_init(struct tty_port *port);
383extern int tty_port_alloc_xmit_buf(struct tty_port *port); 420extern int tty_port_alloc_xmit_buf(struct tty_port *port);
384extern void tty_port_free_xmit_buf(struct tty_port *port); 421extern void tty_port_free_xmit_buf(struct tty_port *port);
422extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
423extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
385 424
386extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 425extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
387extern int tty_unregister_ldisc(int disc); 426extern int tty_unregister_ldisc(int disc);
@@ -427,7 +466,7 @@ static inline void tty_audit_push_task(struct task_struct *tsk,
427#endif 466#endif
428 467
429/* tty_ioctl.c */ 468/* tty_ioctl.c */
430extern int n_tty_ioctl(struct tty_struct *tty, struct file *file, 469extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
431 unsigned int cmd, unsigned long arg); 470 unsigned int cmd, unsigned long arg);
432 471
433/* serial.c */ 472/* serial.c */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 16d27944c321..78416b901589 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -7,6 +7,28 @@
7 * defined; unless noted otherwise, they are optional, and can be 7 * defined; unless noted otherwise, they are optional, and can be
8 * filled in with a null pointer. 8 * filled in with a null pointer.
9 * 9 *
10 * struct tty_struct * (*lookup)(struct tty_driver *self, int idx)
11 *
12 * Return the tty device corresponding to idx, NULL if there is not
13 * one currently in use and an ERR_PTR value on error. Called under
14 * tty_mutex (for now!)
15 *
16 * Optional method. Default behaviour is to use the ttys array
17 *
18 * int (*install)(struct tty_driver *self, struct tty_struct *tty)
19 *
20 * Install a new tty into the tty driver internal tables. Used in
21 * conjunction with lookup and remove methods.
22 *
23 * Optional method. Default behaviour is to use the ttys array
24 *
25 * void (*remove)(struct tty_driver *self, struct tty_struct *tty)
26 *
27 * Remove a closed tty from the tty driver internal tables. Used in
28 * conjunction with lookup and remove methods.
29 *
30 * Optional method. Default behaviour is to use the ttys array
31 *
10 * int (*open)(struct tty_struct * tty, struct file * filp); 32 * int (*open)(struct tty_struct * tty, struct file * filp);
11 * 33 *
12 * This routine is called when a particular tty device is opened. 34 * This routine is called when a particular tty device is opened.
@@ -21,6 +43,11 @@
21 * 43 *
22 * Required method. 44 * Required method.
23 * 45 *
46 * void (*shutdown)(struct tty_struct * tty);
47 *
48 * This routine is called when a particular tty device is closed for
49 * the last time freeing up the resources.
50 *
24 * int (*write)(struct tty_struct * tty, 51 * int (*write)(struct tty_struct * tty,
25 * const unsigned char *buf, int count); 52 * const unsigned char *buf, int count);
26 * 53 *
@@ -180,6 +207,14 @@
180 * not force errors here if they are not resizable objects (eg a serial 207 * not force errors here if they are not resizable objects (eg a serial
181 * line). See tty_do_resize() if you need to wrap the standard method 208 * line). See tty_do_resize() if you need to wrap the standard method
182 * in your own logic - the usual case. 209 * in your own logic - the usual case.
210 *
211 * void (*set_termiox)(struct tty_struct *tty, struct termiox *new);
212 *
213 * Called when the device receives a termiox based ioctl. Passes down
214 * the requested data from user space. This method will not be invoked
215 * unless the tty also has a valid tty->termiox pointer.
216 *
217 * Optional: Called under the termios lock
183 */ 218 */
184 219
185#include <linux/fs.h> 220#include <linux/fs.h>
@@ -190,8 +225,13 @@ struct tty_struct;
190struct tty_driver; 225struct tty_driver;
191 226
192struct tty_operations { 227struct tty_operations {
228 struct tty_struct * (*lookup)(struct tty_driver *driver,
229 struct inode *inode, int idx);
230 int (*install)(struct tty_driver *driver, struct tty_struct *tty);
231 void (*remove)(struct tty_driver *driver, struct tty_struct *tty);
193 int (*open)(struct tty_struct * tty, struct file * filp); 232 int (*open)(struct tty_struct * tty, struct file * filp);
194 void (*close)(struct tty_struct * tty, struct file * filp); 233 void (*close)(struct tty_struct * tty, struct file * filp);
234 void (*shutdown)(struct tty_struct *tty);
195 int (*write)(struct tty_struct * tty, 235 int (*write)(struct tty_struct * tty,
196 const unsigned char *buf, int count); 236 const unsigned char *buf, int count);
197 int (*put_char)(struct tty_struct *tty, unsigned char ch); 237 int (*put_char)(struct tty_struct *tty, unsigned char ch);
@@ -220,6 +260,7 @@ struct tty_operations {
220 unsigned int set, unsigned int clear); 260 unsigned int set, unsigned int clear);
221 int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, 261 int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
222 struct winsize *ws); 262 struct winsize *ws);
263 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
223#ifdef CONFIG_CONSOLE_POLL 264#ifdef CONFIG_CONSOLE_POLL
224 int (*poll_init)(struct tty_driver *driver, int line, char *options); 265 int (*poll_init)(struct tty_driver *driver, int line, char *options);
225 int (*poll_get_char)(struct tty_driver *driver, int line); 266 int (*poll_get_char)(struct tty_driver *driver, int line);
@@ -229,6 +270,7 @@ struct tty_operations {
229 270
230struct tty_driver { 271struct tty_driver {
231 int magic; /* magic number for this structure */ 272 int magic; /* magic number for this structure */
273 struct kref kref; /* Reference management */
232 struct cdev cdev; 274 struct cdev cdev;
233 struct module *owner; 275 struct module *owner;
234 const char *driver_name; 276 const char *driver_name;
@@ -242,7 +284,6 @@ struct tty_driver {
242 short subtype; /* subtype of tty driver */ 284 short subtype; /* subtype of tty driver */
243 struct ktermios init_termios; /* Initial termios */ 285 struct ktermios init_termios; /* Initial termios */
244 int flags; /* tty driver flags */ 286 int flags; /* tty driver flags */
245 int refcount; /* for loadable tty drivers */
246 struct proc_dir_entry *proc_entry; /* /proc fs entry */ 287 struct proc_dir_entry *proc_entry; /* /proc fs entry */
247 struct tty_driver *other; /* only used for the PTY driver */ 288 struct tty_driver *other; /* only used for the PTY driver */
248 289
@@ -264,12 +305,19 @@ struct tty_driver {
264 305
265extern struct list_head tty_drivers; 306extern struct list_head tty_drivers;
266 307
267struct tty_driver *alloc_tty_driver(int lines); 308extern struct tty_driver *alloc_tty_driver(int lines);
268void put_tty_driver(struct tty_driver *driver); 309extern void put_tty_driver(struct tty_driver *driver);
269void tty_set_operations(struct tty_driver *driver, 310extern void tty_set_operations(struct tty_driver *driver,
270 const struct tty_operations *op); 311 const struct tty_operations *op);
271extern struct tty_driver *tty_find_polling_driver(char *name, int *line); 312extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
272 313
314extern void tty_driver_kref_put(struct tty_driver *driver);
315extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
316{
317 kref_get(&d->kref);
318 return d;
319}
320
273/* tty driver magic number */ 321/* tty driver magic number */
274#define TTY_DRIVER_MAGIC 0x5402 322#define TTY_DRIVER_MAGIC 0x5402
275 323
diff --git a/include/linux/types.h b/include/linux/types.h
index d4a9ce6e2760..1d98330b1f2c 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -190,13 +190,16 @@ typedef __u32 __bitwise __wsum;
190 190
191#ifdef __KERNEL__ 191#ifdef __KERNEL__
192typedef unsigned __bitwise__ gfp_t; 192typedef unsigned __bitwise__ gfp_t;
193typedef unsigned __bitwise__ fmode_t;
193 194
194#ifdef CONFIG_RESOURCES_64BIT 195#ifdef CONFIG_PHYS_ADDR_T_64BIT
195typedef u64 resource_size_t; 196typedef u64 phys_addr_t;
196#else 197#else
197typedef u32 resource_size_t; 198typedef u32 phys_addr_t;
198#endif 199#endif
199 200
201typedef phys_addr_t resource_size_t;
202
200struct ustat { 203struct ustat {
201 __kernel_daddr_t f_tfree; 204 __kernel_daddr_t f_tfree;
202 __kernel_ino_t f_tinode; 205 __kernel_ino_t f_tinode;
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
new file mode 100644
index 000000000000..970473bf8d5a
--- /dev/null
+++ b/include/linux/ucb1400.h
@@ -0,0 +1,161 @@
1/*
2 * Register definitions and functions for:
3 * Philips UCB1400 driver
4 *
5 * Based on ucb1400_ts:
6 * Author: Nicolas Pitre
7 * Created: September 25, 2006
8 * Copyright: MontaVista Software, Inc.
9 *
10 * Spliting done by: Marek Vasut <marek.vasut@gmail.com>
11 * If something doesnt work and it worked before spliting, e-mail me,
12 * dont bother Nicolas please ;-)
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 * This code is heavily based on ucb1x00-*.c copyrighted by Russell King
19 * covering the UCB1100, UCB1200 and UCB1300.. Support for the UCB1400 has
20 * been made separate from ucb1x00-core/ucb1x00-ts on Russell's request.
21 */
22
23#ifndef _LINUX__UCB1400_H
24#define _LINUX__UCB1400_H
25
26#include <sound/ac97_codec.h>
27#include <linux/mutex.h>
28#include <linux/platform_device.h>
29
30/*
31 * UCB1400 AC-link registers
32 */
33
34#define UCB_IO_DATA 0x5a
35#define UCB_IO_DIR 0x5c
36#define UCB_IE_RIS 0x5e
37#define UCB_IE_FAL 0x60
38#define UCB_IE_STATUS 0x62
39#define UCB_IE_CLEAR 0x62
40#define UCB_IE_ADC (1 << 11)
41#define UCB_IE_TSPX (1 << 12)
42
43#define UCB_TS_CR 0x64
44#define UCB_TS_CR_TSMX_POW (1 << 0)
45#define UCB_TS_CR_TSPX_POW (1 << 1)
46#define UCB_TS_CR_TSMY_POW (1 << 2)
47#define UCB_TS_CR_TSPY_POW (1 << 3)
48#define UCB_TS_CR_TSMX_GND (1 << 4)
49#define UCB_TS_CR_TSPX_GND (1 << 5)
50#define UCB_TS_CR_TSMY_GND (1 << 6)
51#define UCB_TS_CR_TSPY_GND (1 << 7)
52#define UCB_TS_CR_MODE_INT (0 << 8)
53#define UCB_TS_CR_MODE_PRES (1 << 8)
54#define UCB_TS_CR_MODE_POS (2 << 8)
55#define UCB_TS_CR_BIAS_ENA (1 << 11)
56#define UCB_TS_CR_TSPX_LOW (1 << 12)
57#define UCB_TS_CR_TSMX_LOW (1 << 13)
58
59#define UCB_ADC_CR 0x66
60#define UCB_ADC_SYNC_ENA (1 << 0)
61#define UCB_ADC_VREFBYP_CON (1 << 1)
62#define UCB_ADC_INP_TSPX (0 << 2)
63#define UCB_ADC_INP_TSMX (1 << 2)
64#define UCB_ADC_INP_TSPY (2 << 2)
65#define UCB_ADC_INP_TSMY (3 << 2)
66#define UCB_ADC_INP_AD0 (4 << 2)
67#define UCB_ADC_INP_AD1 (5 << 2)
68#define UCB_ADC_INP_AD2 (6 << 2)
69#define UCB_ADC_INP_AD3 (7 << 2)
70#define UCB_ADC_EXT_REF (1 << 5)
71#define UCB_ADC_START (1 << 7)
72#define UCB_ADC_ENA (1 << 15)
73
74#define UCB_ADC_DATA 0x68
75#define UCB_ADC_DAT_VALID (1 << 15)
76#define UCB_ADC_DAT_MASK 0x3ff
77
78#define UCB_ID 0x7e
79#define UCB_ID_1400 0x4304
80
81struct ucb1400_ts {
82 struct input_dev *ts_idev;
83 struct task_struct *ts_task;
84 int id;
85 wait_queue_head_t ts_wait;
86 unsigned int ts_restart:1;
87 int irq;
88 unsigned int irq_pending; /* not bit field shared */
89 struct snd_ac97 *ac97;
90};
91
92struct ucb1400 {
93 struct platform_device *ucb1400_ts;
94};
95
96static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
97{
98 return ac97->bus->ops->read(ac97, reg);
99}
100
101static inline void ucb1400_reg_write(struct snd_ac97 *ac97, u16 reg, u16 val)
102{
103 ac97->bus->ops->write(ac97, reg, val);
104}
105
106static inline u16 ucb1400_gpio_get_value(struct snd_ac97 *ac97, u16 gpio)
107{
108 return ucb1400_reg_read(ac97, UCB_IO_DATA) & (1 << gpio);
109}
110
111static inline void ucb1400_gpio_set_value(struct snd_ac97 *ac97, u16 gpio,
112 u16 val)
113{
114 ucb1400_reg_write(ac97, UCB_IO_DATA, val ?
115 ucb1400_reg_read(ac97, UCB_IO_DATA) | (1 << gpio) :
116 ucb1400_reg_read(ac97, UCB_IO_DATA) & ~(1 << gpio));
117}
118
119static inline u16 ucb1400_gpio_get_direction(struct snd_ac97 *ac97, u16 gpio)
120{
121 return ucb1400_reg_read(ac97, UCB_IO_DIR) & (1 << gpio);
122}
123
124static inline void ucb1400_gpio_set_direction(struct snd_ac97 *ac97, u16 gpio,
125 u16 dir)
126{
127 ucb1400_reg_write(ac97, UCB_IO_DIR, dir ?
128 ucb1400_reg_read(ac97, UCB_IO_DIR) | (1 << gpio) :
129 ucb1400_reg_read(ac97, UCB_IO_DIR) & ~(1 << gpio));
130}
131
132static inline void ucb1400_adc_enable(struct snd_ac97 *ac97)
133{
134 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
135}
136
137static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
138 int adcsync)
139{
140 unsigned int val;
141
142 if (adcsync)
143 adc_channel |= UCB_ADC_SYNC_ENA;
144
145 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
146 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
147 UCB_ADC_START);
148
149 while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
150 & UCB_ADC_DAT_VALID))
151 schedule_timeout_uninterruptible(1);
152
153 return val & UCB_ADC_DAT_MASK;
154}
155
156static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
157{
158 ucb1400_reg_write(ac97, UCB_ADC_CR, 0);
159}
160
161#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 94ac74aba6b6..8fa973bede5e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1135,6 +1135,7 @@ struct usb_anchor {
1135 struct list_head urb_list; 1135 struct list_head urb_list;
1136 wait_queue_head_t wait; 1136 wait_queue_head_t wait;
1137 spinlock_t lock; 1137 spinlock_t lock;
1138 unsigned int poisoned:1;
1138}; 1139};
1139 1140
1140static inline void init_usb_anchor(struct usb_anchor *anchor) 1141static inline void init_usb_anchor(struct usb_anchor *anchor)
@@ -1459,12 +1460,18 @@ extern struct urb *usb_get_urb(struct urb *urb);
1459extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags); 1460extern int usb_submit_urb(struct urb *urb, gfp_t mem_flags);
1460extern int usb_unlink_urb(struct urb *urb); 1461extern int usb_unlink_urb(struct urb *urb);
1461extern void usb_kill_urb(struct urb *urb); 1462extern void usb_kill_urb(struct urb *urb);
1463extern void usb_poison_urb(struct urb *urb);
1464extern void usb_unpoison_urb(struct urb *urb);
1462extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1465extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1466extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1463extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1467extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1464extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1468extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1465extern void usb_unanchor_urb(struct urb *urb); 1469extern void usb_unanchor_urb(struct urb *urb);
1466extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1470extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1467 unsigned int timeout); 1471 unsigned int timeout);
1472extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
1473extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
1474extern int usb_anchor_empty(struct usb_anchor *anchor);
1468 1475
1469/** 1476/**
1470 * usb_urb_dir_in - check if an URB describes an IN transfer 1477 * usb_urb_dir_in - check if an URB describes an IN transfer
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 42e84fc315e3..54c446309a2a 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -4,4 +4,5 @@ header-y += ch9.h
4header-y += gadgetfs.h 4header-y += gadgetfs.h
5header-y += midi.h 5header-y += midi.h
6header-y += g_printer.h 6header-y += g_printer.h
7 7header-y += tmc.h
8header-y += vstusb.h
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index ca228bb94218..18a729343ffa 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -160,6 +160,15 @@ struct usb_cdc_mdlm_detail_desc {
160 __u8 bDetailData[0]; 160 __u8 bDetailData[0];
161} __attribute__ ((packed)); 161} __attribute__ ((packed));
162 162
163/* "OBEX Control Model Functional Descriptor" */
164struct usb_cdc_obex_desc {
165 __u8 bLength;
166 __u8 bDescriptorType;
167 __u8 bDescriptorSubType;
168
169 __le16 bcdVersion;
170} __attribute__ ((packed));
171
163/*-------------------------------------------------------------------------*/ 172/*-------------------------------------------------------------------------*/
164 173
165/* 174/*
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index c932390c6da0..935c380ffe47 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -130,6 +130,9 @@ struct usb_function {
130 130
131int usb_add_function(struct usb_configuration *, struct usb_function *); 131int usb_add_function(struct usb_configuration *, struct usb_function *);
132 132
133int usb_function_deactivate(struct usb_function *);
134int usb_function_activate(struct usb_function *);
135
133int usb_interface_id(struct usb_configuration *, struct usb_function *); 136int usb_interface_id(struct usb_configuration *, struct usb_function *);
134 137
135/** 138/**
@@ -316,9 +319,13 @@ struct usb_composite_dev {
316 struct usb_composite_driver *driver; 319 struct usb_composite_driver *driver;
317 u8 next_string_id; 320 u8 next_string_id;
318 321
319 spinlock_t lock; 322 /* the gadget driver won't enable the data pullup
323 * while the deactivation count is nonzero.
324 */
325 unsigned deactivations;
320 326
321 /* REVISIT use and existence of lock ... */ 327 /* protects at least deactivation count */
328 spinlock_t lock;
322}; 329};
323 330
324extern int usb_string_id(struct usb_composite_dev *c); 331extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
new file mode 100644
index 000000000000..5b88e36c9103
--- /dev/null
+++ b/include/linux/usb/ehci_def.h
@@ -0,0 +1,160 @@
1/*
2 * Copyright (c) 2001-2002 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
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 MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __LINUX_USB_EHCI_DEF_H
20#define __LINUX_USB_EHCI_DEF_H
21
22/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
23
24/* Section 2.2 Host Controller Capability Registers */
25struct ehci_caps {
26 /* these fields are specified as 8 and 16 bit registers,
27 * but some hosts can't perform 8 or 16 bit PCI accesses.
28 */
29 u32 hc_capbase;
30#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
31#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
32 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
33#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
34#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
35#define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */
36#define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */
37#define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */
38#define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
48 u8 portroute [8]; /* nibbles for routing - offset 0xC */
49} __attribute__ ((packed));
50
51
52/* Section 2.3 Host Controller Operational Registers */
53struct ehci_regs {
54
55 /* USBCMD: offset 0x00 */
56 u32 command;
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
60#define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */
61#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
62#define CMD_ASE (1<<5) /* async schedule enable */
63#define CMD_PSE (1<<4) /* periodic schedule enable */
64/* 3:2 is periodic frame list size */
65#define CMD_RESET (1<<1) /* reset HC not bus */
66#define CMD_RUN (1<<0) /* start/stop HC */
67
68 /* USBSTS: offset 0x04 */
69 u32 status;
70#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */
73#define STS_HALT (1<<12) /* Not running (any reason) */
74/* some bits reserved */
75 /* these STS_* flags are also intr_enable bits (USBINTR) */
76#define STS_IAA (1<<5) /* Interrupted on async advance */
77#define STS_FATAL (1<<4) /* such as some PCI access errors */
78#define STS_FLR (1<<3) /* frame list rolled over */
79#define STS_PCD (1<<2) /* port change detect */
80#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
81#define STS_INT (1<<0) /* "normal" completion (short, ...) */
82
83 /* USBINTR: offset 0x08 */
84 u32 intr_enable;
85
86 /* FRINDEX: offset 0x0C */
87 u32 frame_index; /* current microframe number */
88 /* CTRLDSSEGMENT: offset 0x10 */
89 u32 segment; /* address bits 63:32 if needed */
90 /* PERIODICLISTBASE: offset 0x14 */
91 u32 frame_list; /* points to periodic list */
92 /* ASYNCLISTADDR: offset 0x18 */
93 u32 async_next; /* address of next async queue head */
94
95 u32 reserved [9];
96
97 /* CONFIGFLAG: offset 0x40 */
98 u32 configured_flag;
99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
100
101 /* PORTSC: offset 0x44 */
102 u32 port_status [0]; /* up to N_PORTS */
103/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */
108#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14)
111#define PORT_LED_MASK (3<<14)
112#define PORT_OWNER (1<<13) /* true: companion hc owns this port */
113#define PORT_POWER (1<<12) /* true: has power (see PPC) */
114#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
115/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
116/* 9 reserved */
117#define PORT_RESET (1<<8) /* reset port */
118#define PORT_SUSPEND (1<<7) /* suspend port */
119#define PORT_RESUME (1<<6) /* resume it */
120#define PORT_OCC (1<<5) /* over current change */
121#define PORT_OC (1<<4) /* over current active */
122#define PORT_PEC (1<<3) /* port enable change */
123#define PORT_PE (1<<2) /* port enable */
124#define PORT_CSC (1<<1) /* connect status change */
125#define PORT_CONNECT (1<<0) /* device connected */
126#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
127} __attribute__ ((packed));
128
129#define USBMODE 0x68 /* USB Device mode */
130#define USBMODE_SDIS (1<<3) /* Stream disable */
131#define USBMODE_BE (1<<2) /* BE/LE endianness select */
132#define USBMODE_CM_HC (3<<0) /* host controller mode */
133#define USBMODE_CM_IDLE (0<<0) /* idle state */
134
135/* Appendix C, Debug port ... intended for use with special "debug devices"
136 * that can help if there's no serial console. (nonstandard enumeration.)
137 */
138struct ehci_dbg_port {
139 u32 control;
140#define DBGP_OWNER (1<<30)
141#define DBGP_ENABLED (1<<28)
142#define DBGP_DONE (1<<16)
143#define DBGP_INUSE (1<<10)
144#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
145# define DBGP_ERR_BAD 1
146# define DBGP_ERR_SIGNAL 2
147#define DBGP_ERROR (1<<6)
148#define DBGP_GO (1<<5)
149#define DBGP_OUT (1<<4)
150#define DBGP_LEN(x) (((x)>>0)&0x0f)
151 u32 pids;
152#define DBGP_PID_GET(x) (((x)>>16)&0xff)
153#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
154 u32 data03;
155 u32 data47;
156 u32 address;
157#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
158} __attribute__ ((packed));
159
160#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 655341d0f534..0b8617a9176d 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -192,7 +192,7 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
192 * The driver.owner field should be set to the module owner of this driver. 192 * The driver.owner field should be set to the module owner of this driver.
193 * The driver.name field should be set to the name of this driver (remember 193 * The driver.name field should be set to the name of this driver (remember
194 * it will show up in sysfs, so it needs to be short and to the point. 194 * it will show up in sysfs, so it needs to be short and to the point.
195 * Useing the module name is a good idea.) 195 * Using the module name is a good idea.)
196 */ 196 */
197struct usb_serial_driver { 197struct usb_serial_driver {
198 const char *description; 198 const char *description;
diff --git a/include/linux/usb/tmc.h b/include/linux/usb/tmc.h
new file mode 100644
index 000000000000..c045ae12556c
--- /dev/null
+++ b/include/linux/usb/tmc.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
3 * Copyright (C) 2008 Novell, Inc.
4 * Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This file holds USB constants defined by the USB Device Class
7 * Definition for Test and Measurement devices published by the USB-IF.
8 *
9 * It also has the ioctl definitions for the usbtmc kernel driver that
10 * userspace needs to know about.
11 */
12
13#ifndef __LINUX_USB_TMC_H
14#define __LINUX_USB_TMC_H
15
16/* USB TMC status values */
17#define USBTMC_STATUS_SUCCESS 0x01
18#define USBTMC_STATUS_PENDING 0x02
19#define USBTMC_STATUS_FAILED 0x80
20#define USBTMC_STATUS_TRANSFER_NOT_IN_PROGRESS 0x81
21#define USBTMC_STATUS_SPLIT_NOT_IN_PROGRESS 0x82
22#define USBTMC_STATUS_SPLIT_IN_PROGRESS 0x83
23
24/* USB TMC requests values */
25#define USBTMC_REQUEST_INITIATE_ABORT_BULK_OUT 1
26#define USBTMC_REQUEST_CHECK_ABORT_BULK_OUT_STATUS 2
27#define USBTMC_REQUEST_INITIATE_ABORT_BULK_IN 3
28#define USBTMC_REQUEST_CHECK_ABORT_BULK_IN_STATUS 4
29#define USBTMC_REQUEST_INITIATE_CLEAR 5
30#define USBTMC_REQUEST_CHECK_CLEAR_STATUS 6
31#define USBTMC_REQUEST_GET_CAPABILITIES 7
32#define USBTMC_REQUEST_INDICATOR_PULSE 64
33
34/* Request values for USBTMC driver's ioctl entry point */
35#define USBTMC_IOC_NR 91
36#define USBTMC_IOCTL_INDICATOR_PULSE _IO(USBTMC_IOC_NR, 1)
37#define USBTMC_IOCTL_CLEAR _IO(USBTMC_IOC_NR, 2)
38#define USBTMC_IOCTL_ABORT_BULK_OUT _IO(USBTMC_IOC_NR, 3)
39#define USBTMC_IOCTL_ABORT_BULK_IN _IO(USBTMC_IOC_NR, 4)
40#define USBTMC_IOCTL_CLEAR_OUT_HALT _IO(USBTMC_IOC_NR, 6)
41#define USBTMC_IOCTL_CLEAR_IN_HALT _IO(USBTMC_IOC_NR, 7)
42
43#endif
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h
new file mode 100644
index 000000000000..1cfac67191ff
--- /dev/null
+++ b/include/linux/usb/vstusb.h
@@ -0,0 +1,71 @@
1/*****************************************************************************
2 * File: drivers/usb/misc/vstusb.h
3 *
4 * Purpose: Support for the bulk USB Vernier Spectrophotometers
5 *
6 * Author: EQware Engineering, Inc.
7 * Oregon City, OR, USA 97045
8 *
9 * Copyright: 2007, 2008
10 * Vernier Software & Technology
11 * Beaverton, OR, USA 97005
12 *
13 * Web: www.vernier.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 version 2 as
17 * published by the Free Software Foundation.
18 *
19 *****************************************************************************/
20/*****************************************************************************
21 *
22 * The vstusb module is a standard usb 'client' driver running on top of the
23 * standard usb host controller stack.
24 *
25 * In general, vstusb supports standard bulk usb pipes. It supports multiple
26 * devices and multiple pipes per device.
27 *
28 * The vstusb driver supports two interfaces:
29 * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg
30 * interface to any pipe with timeout support;
31 * 2 - standard read/write with ioctl config - offers standard read/write
32 * interface with ioctl configured pipes and timeouts.
33 *
34 * Both interfaces can be signal from other process and will abort its i/o
35 * operation.
36 *
37 * A timeout of 0 means NO timeout. The user can still terminate the read via
38 * signal.
39 *
40 * If using multiple threads with this driver, the user should ensure that
41 * any reads, writes, or ioctls are complete before closing the device.
42 * Changing read/write timeouts or pipes takes effect on next read/write.
43 *
44 *****************************************************************************/
45
46struct vstusb_args {
47 union {
48 /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, *
49 * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */
50 struct {
51 void __user *buffer;
52 size_t count;
53 unsigned int timeout_ms;
54 int pipe;
55 };
56
57 /* this one is used for IOCTL_VSTUSB_CONFIG_RW */
58 struct {
59 int rd_pipe;
60 int rd_timeout_ms;
61 int wr_pipe;
62 int wr_timeout_ms;
63 };
64 };
65};
66
67#define VST_IOC_MAGIC 'L'
68#define VST_IOC_FIRST 0x20
69#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST)
70#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1)
71#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2)
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
new file mode 100644
index 000000000000..a102561e7026
--- /dev/null
+++ b/include/linux/usb/wusb-wa.h
@@ -0,0 +1,271 @@
1/*
2 * Wireless USB Wire Adapter constants and structures.
3 *
4 * Copyright (C) 2005-2006 Intel Corporation.
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
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 version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA.
20 *
21 *
22 * FIXME: docs
23 * FIXME: organize properly, group logically
24 *
25 * All the event structures are defined in uwb/spec.h, as they are
26 * common to the WHCI and WUSB radio control interfaces.
27 *
28 * References:
29 * [WUSB] Wireless Universal Serial Bus Specification, revision 1.0, ch8
30 */
31#ifndef __LINUX_USB_WUSB_WA_H
32#define __LINUX_USB_WUSB_WA_H
33
34/**
35 * Radio Command Request for the Radio Control Interface
36 *
37 * Radio Control Interface command and event codes are the same as
38 * WHCI, and listed in include/linux/uwb.h:UWB_RC_{CMD,EVT}_*
39 */
40enum {
41 WA_EXEC_RC_CMD = 40, /* Radio Control command Request */
42};
43
44/* Wireless Adapter Requests ([WUSB] table 8-51) */
45enum {
46 WUSB_REQ_ADD_MMC_IE = 20,
47 WUSB_REQ_REMOVE_MMC_IE = 21,
48 WUSB_REQ_SET_NUM_DNTS = 22,
49 WUSB_REQ_SET_CLUSTER_ID = 23,
50 WUSB_REQ_SET_DEV_INFO = 24,
51 WUSB_REQ_GET_TIME = 25,
52 WUSB_REQ_SET_STREAM_IDX = 26,
53 WUSB_REQ_SET_WUSB_MAS = 27,
54};
55
56
57/* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */
58enum {
59 WUSB_TIME_ADJ = 0,
60 WUSB_TIME_BPST = 1,
61 WUSB_TIME_WUSB = 2,
62};
63
64enum {
65 WA_ENABLE = 0x01,
66 WA_RESET = 0x02,
67 RPIPE_PAUSE = 0x1,
68};
69
70/* Responses from Get Status request ([WUSB] section 8.3.1.6) */
71enum {
72 WA_STATUS_ENABLED = 0x01,
73 WA_STATUS_RESETTING = 0x02
74};
75
76enum rpipe_crs {
77 RPIPE_CRS_CTL = 0x01,
78 RPIPE_CRS_ISO = 0x02,
79 RPIPE_CRS_BULK = 0x04,
80 RPIPE_CRS_INTR = 0x08
81};
82
83/**
84 * RPipe descriptor ([WUSB] section 8.5.2.11)
85 *
86 * FIXME: explain rpipes
87 */
88struct usb_rpipe_descriptor {
89 u8 bLength;
90 u8 bDescriptorType;
91 __le16 wRPipeIndex;
92 __le16 wRequests;
93 __le16 wBlocks; /* rw if 0 */
94 __le16 wMaxPacketSize; /* rw? */
95 u8 bHSHubAddress; /* reserved: 0 */
96 u8 bHSHubPort; /* ??? FIXME ??? */
97 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
98 u8 bDeviceAddress; /* rw: Target device address */
99 u8 bEndpointAddress; /* rw: Target EP address */
100 u8 bDataSequence; /* ro: Current Data sequence */
101 __le32 dwCurrentWindow; /* ro */
102 u8 bMaxDataSequence; /* ro?: max supported seq */
103 u8 bInterval; /* rw: */
104 u8 bOverTheAirInterval; /* rw: */
105 u8 bmAttribute; /* ro? */
106 u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */
107 u8 bmRetryOptions; /* rw? */
108 __le16 wNumTransactionErrors; /* rw */
109} __attribute__ ((packed));
110
111/**
112 * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4)
113 *
114 * These are the notifications coming on the notification endpoint of
115 * an HWA and a DWA.
116 */
117enum wa_notif_type {
118 DWA_NOTIF_RWAKE = 0x91,
119 DWA_NOTIF_PORTSTATUS = 0x92,
120 WA_NOTIF_TRANSFER = 0x93,
121 HWA_NOTIF_BPST_ADJ = 0x94,
122 HWA_NOTIF_DN = 0x95,
123};
124
125/**
126 * Wire Adapter notification header
127 *
128 * Notifications coming from a wire adapter use a common header
129 * defined in [WUSB] sections 8.4.5 & 8.5.4.
130 */
131struct wa_notif_hdr {
132 u8 bLength;
133 u8 bNotifyType; /* enum wa_notif_type */
134} __attribute__((packed));
135
136/**
137 * HWA DN Received notification [(WUSB] section 8.5.4.2)
138 *
139 * The DNData is specified in WUSB1.0[7.6]. For each device
140 * notification we received, we just need to dispatch it.
141 *
142 * @dndata: this is really an array of notifications, but all start
143 * with the same header.
144 */
145struct hwa_notif_dn {
146 struct wa_notif_hdr hdr;
147 u8 bSourceDeviceAddr; /* from errata 2005/07 */
148 u8 bmAttributes;
149 struct wusb_dn_hdr dndata[];
150} __attribute__((packed));
151
152/* [WUSB] section 8.3.3 */
153enum wa_xfer_type {
154 WA_XFER_TYPE_CTL = 0x80,
155 WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */
156 WA_XFER_TYPE_ISO = 0x82,
157 WA_XFER_RESULT = 0x83,
158 WA_XFER_ABORT = 0x84,
159};
160
161/* [WUSB] section 8.3.3 */
162struct wa_xfer_hdr {
163 u8 bLength; /* 0x18 */
164 u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */
165 __le16 wRPipe; /* RPipe index */
166 __le32 dwTransferID; /* Host-assigned ID */
167 __le32 dwTransferLength; /* Length of data to xfer */
168 u8 bTransferSegment;
169} __attribute__((packed));
170
171struct wa_xfer_ctl {
172 struct wa_xfer_hdr hdr;
173 u8 bmAttribute;
174 __le16 wReserved;
175 struct usb_ctrlrequest baSetupData;
176} __attribute__((packed));
177
178struct wa_xfer_bi {
179 struct wa_xfer_hdr hdr;
180 u8 bReserved;
181 __le16 wReserved;
182} __attribute__((packed));
183
184struct wa_xfer_hwaiso {
185 struct wa_xfer_hdr hdr;
186 u8 bReserved;
187 __le16 wPresentationTime;
188 __le32 dwNumOfPackets;
189 /* FIXME: u8 pktdata[]? */
190} __attribute__((packed));
191
192/* [WUSB] section 8.3.3.5 */
193struct wa_xfer_abort {
194 u8 bLength;
195 u8 bRequestType;
196 __le16 wRPipe; /* RPipe index */
197 __le32 dwTransferID; /* Host-assigned ID */
198} __attribute__((packed));
199
200/**
201 * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
202 *
203 */
204struct wa_notif_xfer {
205 struct wa_notif_hdr hdr;
206 u8 bEndpoint;
207 u8 Reserved;
208} __attribute__((packed));
209
210/** Transfer result basic codes [WUSB] table 8-15 */
211enum {
212 WA_XFER_STATUS_SUCCESS,
213 WA_XFER_STATUS_HALTED,
214 WA_XFER_STATUS_DATA_BUFFER_ERROR,
215 WA_XFER_STATUS_BABBLE,
216 WA_XFER_RESERVED,
217 WA_XFER_STATUS_NOT_FOUND,
218 WA_XFER_STATUS_INSUFFICIENT_RESOURCE,
219 WA_XFER_STATUS_TRANSACTION_ERROR,
220 WA_XFER_STATUS_ABORTED,
221 WA_XFER_STATUS_RPIPE_NOT_READY,
222 WA_XFER_INVALID_FORMAT,
223 WA_XFER_UNEXPECTED_SEGMENT_NUMBER,
224 WA_XFER_STATUS_RPIPE_TYPE_MISMATCH,
225};
226
227/** [WUSB] section 8.3.3.4 */
228struct wa_xfer_result {
229 struct wa_notif_hdr hdr;
230 __le32 dwTransferID;
231 __le32 dwTransferLength;
232 u8 bTransferSegment;
233 u8 bTransferStatus;
234 __le32 dwNumOfPackets;
235} __attribute__((packed));
236
237/**
238 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
239 *
240 * NOTE: u16 fields are read Little Endian from the hardware.
241 *
242 * @bNumPorts is the original max number of devices that the host can
243 * connect; we might chop this so the stack can handle
244 * it. In case you need to access it, use wusbhc->ports_max
245 * if it is a Wireless USB WA.
246 */
247struct usb_wa_descriptor {
248 u8 bLength;
249 u8 bDescriptorType;
250 u16 bcdWAVersion;
251 u8 bNumPorts; /* don't use!! */
252 u8 bmAttributes; /* Reserved == 0 */
253 u16 wNumRPipes;
254 u16 wRPipeMaxBlock;
255 u8 bRPipeBlockSize;
256 u8 bPwrOn2PwrGood;
257 u8 bNumMMCIEs;
258 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
259} __attribute__((packed));
260
261/**
262 * HWA Device Information Buffer (WUSB1.0[T8.54])
263 */
264struct hwa_dev_info {
265 u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */
266 u8 bDeviceAddress;
267 __le16 wPHYRates;
268 u8 bmDeviceAttribute;
269} __attribute__((packed));
270
271#endif /* #ifndef __LINUX_USB_WUSB_WA_H */
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
new file mode 100644
index 000000000000..5f401b644ed5
--- /dev/null
+++ b/include/linux/usb/wusb.h
@@ -0,0 +1,376 @@
1/*
2 * Wireless USB Standard Definitions
3 * Event Size Tables
4 *
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 *
23 * FIXME: docs
24 * FIXME: organize properly, group logically
25 *
26 * All the event structures are defined in uwb/spec.h, as they are
27 * common to the WHCI and WUSB radio control interfaces.
28 */
29
30#ifndef __WUSB_H__
31#define __WUSB_H__
32
33#include <linux/types.h>
34#include <linux/kernel.h>
35#include <linux/uwb/spec.h>
36#include <linux/usb/ch9.h>
37#include <linux/param.h>
38
39/**
40 * WUSB Information Element header
41 *
42 * I don't know why, they decided to make it different to the MBOA MAC
43 * IE Header; beats me.
44 */
45struct wuie_hdr {
46 u8 bLength;
47 u8 bIEIdentifier;
48} __attribute__((packed));
49
50enum {
51 WUIE_ID_WCTA = 0x80,
52 WUIE_ID_CONNECTACK,
53 WUIE_ID_HOST_INFO,
54 WUIE_ID_CHANGE_ANNOUNCE,
55 WUIE_ID_DEVICE_DISCONNECT,
56 WUIE_ID_HOST_DISCONNECT,
57 WUIE_ID_KEEP_ALIVE = 0x89,
58 WUIE_ID_ISOCH_DISCARD,
59 WUIE_ID_RESET_DEVICE,
60};
61
62/**
63 * Maximum number of array elements in a WUSB IE.
64 *
65 * WUSB1.0[7.5 before table 7-38] says that in WUSB IEs that
66 * are "arrays" have to limited to 4 elements. So we define it
67 * like that to ease up and submit only the neeed size.
68 */
69#define WUIE_ELT_MAX 4
70
71/**
72 * Wrapper for the data that defines a CHID, a CDID or a CK
73 *
74 * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of
75 * data. In order to avoid confusion and enforce types, we wrap it.
76 *
77 * Make it packed, as we use it in some hw defintions.
78 */
79struct wusb_ckhdid {
80 u8 data[16];
81} __attribute__((packed));
82
83const static
84struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
85
86#define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1)
87
88/**
89 * WUSB IE: Host Information (WUSB1.0[7.5.2])
90 *
91 * Used to provide information about the host to the Wireless USB
92 * devices in range (CHID can be used as an ASCII string).
93 */
94struct wuie_host_info {
95 struct wuie_hdr hdr;
96 __le16 attributes;
97 struct wusb_ckhdid CHID;
98} __attribute__((packed));
99
100/**
101 * WUSB IE: Connect Ack (WUSB1.0[7.5.1])
102 *
103 * Used to acknowledge device connect requests. See note for
104 * WUIE_ELT_MAX.
105 */
106struct wuie_connect_ack {
107 struct wuie_hdr hdr;
108 struct {
109 struct wusb_ckhdid CDID;
110 u8 bDeviceAddress; /* 0 means unused */
111 u8 bReserved;
112 } blk[WUIE_ELT_MAX];
113} __attribute__((packed));
114
115/**
116 * WUSB IE Host Information Element, Connect Availability
117 *
118 * WUSB1.0[7.5.2], bmAttributes description
119 */
120enum {
121 WUIE_HI_CAP_RECONNECT = 0,
122 WUIE_HI_CAP_LIMITED,
123 WUIE_HI_CAP_RESERVED,
124 WUIE_HI_CAP_ALL,
125};
126
127/**
128 * WUSB IE: Channel Stop (WUSB1.0[7.5.8])
129 *
130 * Tells devices the host is going to stop sending MMCs and will dissapear.
131 */
132struct wuie_channel_stop {
133 struct wuie_hdr hdr;
134 u8 attributes;
135 u8 timestamp[3];
136} __attribute__((packed));
137
138/**
139 * WUSB IE: Keepalive (WUSB1.0[7.5.9])
140 *
141 * Ask device(s) to send keepalives.
142 */
143struct wuie_keep_alive {
144 struct wuie_hdr hdr;
145 u8 bDeviceAddress[WUIE_ELT_MAX];
146} __attribute__((packed));
147
148/**
149 * WUSB IE: Reset device (WUSB1.0[7.5.11])
150 *
151 * Tell device to reset; in all truth, we can fit 4 CDIDs, but we only
152 * use it for one at the time...
153 *
154 * In any case, this request is a wee bit silly: why don't they target
155 * by address??
156 */
157struct wuie_reset {
158 struct wuie_hdr hdr;
159 struct wusb_ckhdid CDID;
160} __attribute__((packed));
161
162/**
163 * WUSB IE: Disconnect device (WUSB1.0[7.5.11])
164 *
165 * Tell device to disconnect; we can fit 4 addresses, but we only use
166 * it for one at the time...
167 */
168struct wuie_disconnect {
169 struct wuie_hdr hdr;
170 u8 bDeviceAddress;
171 u8 padding;
172} __attribute__((packed));
173
174/**
175 * WUSB IE: Host disconnect ([WUSB] section 7.5.5)
176 *
177 * Tells all connected devices to disconnect.
178 */
179struct wuie_host_disconnect {
180 struct wuie_hdr hdr;
181} __attribute__((packed));
182
183/**
184 * WUSB Device Notification header (WUSB1.0[7.6])
185 */
186struct wusb_dn_hdr {
187 u8 bType;
188 u8 notifdata[];
189} __attribute__((packed));
190
191/** Device Notification codes (WUSB1.0[Table 7-54]) */
192enum WUSB_DN {
193 WUSB_DN_CONNECT = 0x01,
194 WUSB_DN_DISCONNECT = 0x02,
195 WUSB_DN_EPRDY = 0x03,
196 WUSB_DN_MASAVAILCHANGED = 0x04,
197 WUSB_DN_RWAKE = 0x05,
198 WUSB_DN_SLEEP = 0x06,
199 WUSB_DN_ALIVE = 0x07,
200};
201
202/** WUSB Device Notification Connect */
203struct wusb_dn_connect {
204 struct wusb_dn_hdr hdr;
205 __le16 attributes;
206 struct wusb_ckhdid CDID;
207} __attribute__((packed));
208
209static inline int wusb_dn_connect_prev_dev_addr(const struct wusb_dn_connect *dn)
210{
211 return le16_to_cpu(dn->attributes) & 0xff;
212}
213
214static inline int wusb_dn_connect_new_connection(const struct wusb_dn_connect *dn)
215{
216 return (le16_to_cpu(dn->attributes) >> 8) & 0x1;
217}
218
219static inline int wusb_dn_connect_beacon_behavior(const struct wusb_dn_connect *dn)
220{
221 return (le16_to_cpu(dn->attributes) >> 9) & 0x03;
222}
223
224/** Device is alive (aka: pong) (WUSB1.0[7.6.7]) */
225struct wusb_dn_alive {
226 struct wusb_dn_hdr hdr;
227} __attribute__((packed));
228
229/** Device is disconnecting (WUSB1.0[7.6.2]) */
230struct wusb_dn_disconnect {
231 struct wusb_dn_hdr hdr;
232} __attribute__((packed));
233
234/* General constants */
235enum {
236 WUSB_TRUST_TIMEOUT_MS = 4000, /* [WUSB] section 4.15.1 */
237};
238
239static inline size_t ckhdid_printf(char *pr_ckhdid, size_t size,
240 const struct wusb_ckhdid *ckhdid)
241{
242 return scnprintf(pr_ckhdid, size,
243 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx "
244 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
245 ckhdid->data[0], ckhdid->data[1],
246 ckhdid->data[2], ckhdid->data[3],
247 ckhdid->data[4], ckhdid->data[5],
248 ckhdid->data[6], ckhdid->data[7],
249 ckhdid->data[8], ckhdid->data[9],
250 ckhdid->data[10], ckhdid->data[11],
251 ckhdid->data[12], ckhdid->data[13],
252 ckhdid->data[14], ckhdid->data[15]);
253}
254
255/*
256 * WUSB Crypto stuff (WUSB1.0[6])
257 */
258
259extern const char *wusb_et_name(u8);
260
261/**
262 * WUSB key index WUSB1.0[7.3.2.4], for usage when setting keys for
263 * the host or the device.
264 */
265static inline u8 wusb_key_index(int index, int type, int originator)
266{
267 return (originator << 6) | (type << 4) | index;
268}
269
270#define WUSB_KEY_INDEX_TYPE_PTK 0 /* for HWA only */
271#define WUSB_KEY_INDEX_TYPE_ASSOC 1
272#define WUSB_KEY_INDEX_TYPE_GTK 2
273#define WUSB_KEY_INDEX_ORIGINATOR_HOST 0
274#define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1
275
276/* A CCM Nonce, defined in WUSB1.0[6.4.1] */
277struct aes_ccm_nonce {
278 u8 sfn[6]; /* Little Endian */
279 u8 tkid[3]; /* LE */
280 struct uwb_dev_addr dest_addr;
281 struct uwb_dev_addr src_addr;
282} __attribute__((packed));
283
284/* A CCM operation label, defined on WUSB1.0[6.5.x] */
285struct aes_ccm_label {
286 u8 data[14];
287} __attribute__((packed));
288
289/*
290 * Input to the key derivation sequence defined in
291 * WUSB1.0[6.5.1]. Rest of the data is in the CCM Nonce passed to the
292 * PRF function.
293 */
294struct wusb_keydvt_in {
295 u8 hnonce[16];
296 u8 dnonce[16];
297} __attribute__((packed));
298
299/*
300 * Output from the key derivation sequence defined in
301 * WUSB1.0[6.5.1].
302 */
303struct wusb_keydvt_out {
304 u8 kck[16];
305 u8 ptk[16];
306} __attribute__((packed));
307
308/* Pseudo Random Function WUSB1.0[6.5] */
309extern int wusb_crypto_init(void);
310extern void wusb_crypto_exit(void);
311extern ssize_t wusb_prf(void *out, size_t out_size,
312 const u8 key[16], const struct aes_ccm_nonce *_n,
313 const struct aes_ccm_label *a,
314 const void *b, size_t blen, size_t len);
315
316static inline int wusb_prf_64(void *out, size_t out_size, const u8 key[16],
317 const struct aes_ccm_nonce *n,
318 const struct aes_ccm_label *a,
319 const void *b, size_t blen)
320{
321 return wusb_prf(out, out_size, key, n, a, b, blen, 64);
322}
323
324static inline int wusb_prf_128(void *out, size_t out_size, const u8 key[16],
325 const struct aes_ccm_nonce *n,
326 const struct aes_ccm_label *a,
327 const void *b, size_t blen)
328{
329 return wusb_prf(out, out_size, key, n, a, b, blen, 128);
330}
331
332static inline int wusb_prf_256(void *out, size_t out_size, const u8 key[16],
333 const struct aes_ccm_nonce *n,
334 const struct aes_ccm_label *a,
335 const void *b, size_t blen)
336{
337 return wusb_prf(out, out_size, key, n, a, b, blen, 256);
338}
339
340/* Key derivation WUSB1.0[6.5.1] */
341static inline int wusb_key_derive(struct wusb_keydvt_out *keydvt_out,
342 const u8 key[16],
343 const struct aes_ccm_nonce *n,
344 const struct wusb_keydvt_in *keydvt_in)
345{
346 const struct aes_ccm_label a = { .data = "Pair-wise keys" };
347 return wusb_prf_256(keydvt_out, sizeof(*keydvt_out), key, n, &a,
348 keydvt_in, sizeof(*keydvt_in));
349}
350
351/*
352 * Out-of-band MIC Generation WUSB1.0[6.5.2]
353 *
354 * Compute the MIC over @key, @n and @hs and place it in @mic_out.
355 *
356 * @mic_out: Where to place the 8 byte MIC tag
357 * @key: KCK from the derivation process
358 * @n: CCM nonce, n->sfn == 0, TKID as established in the
359 * process.
360 * @hs: Handshake struct for phase 2 of the 4-way.
361 * hs->bStatus and hs->bReserved are zero.
362 * hs->bMessageNumber is 2 (WUSB1.0[7.3.2.5.2]
363 * hs->dest_addr is the device's USB address padded with 0
364 * hs->src_addr is the hosts's UWB device address
365 * hs->mic is ignored (as we compute that value).
366 */
367static inline int wusb_oob_mic(u8 mic_out[8], const u8 key[16],
368 const struct aes_ccm_nonce *n,
369 const struct usb_handshake *hs)
370{
371 const struct aes_ccm_label a = { .data = "out-of-bandMIC" };
372 return wusb_prf_64(mic_out, 8, key, n, &a,
373 hs, sizeof(*hs) - sizeof(hs->MIC));
374}
375
376#endif /* #ifndef __WUSB_H__ */
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
new file mode 100644
index 000000000000..f9ccbd9a2ced
--- /dev/null
+++ b/include/linux/uwb.h
@@ -0,0 +1,765 @@
1/*
2 * Ultra Wide Band
3 * UWB API
4 *
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 *
23 * FIXME: doc: overview of the API, different parts and pointers
24 */
25
26#ifndef __LINUX__UWB_H__
27#define __LINUX__UWB_H__
28
29#include <linux/limits.h>
30#include <linux/device.h>
31#include <linux/mutex.h>
32#include <linux/timer.h>
33#include <linux/workqueue.h>
34#include <linux/uwb/spec.h>
35
36struct uwb_dev;
37struct uwb_beca_e;
38struct uwb_rc;
39struct uwb_rsv;
40struct uwb_dbg;
41
42/**
43 * struct uwb_dev - a UWB Device
44 * @rc: UWB Radio Controller that discovered the device (kind of its
45 * parent).
46 * @bce: a beacon cache entry for this device; or NULL if the device
47 * is a local radio controller.
48 * @mac_addr: the EUI-48 address of this device.
49 * @dev_addr: the current DevAddr used by this device.
50 * @beacon_slot: the slot number the beacon is using.
51 * @streams: bitmap of streams allocated to reservations targeted at
52 * this device. For an RC, this is the streams allocated for
53 * reservations targeted at DevAddrs.
54 *
55 * A UWB device may either by a neighbor or part of a local radio
56 * controller.
57 */
58struct uwb_dev {
59 struct mutex mutex;
60 struct list_head list_node;
61 struct device dev;
62 struct uwb_rc *rc; /* radio controller */
63 struct uwb_beca_e *bce; /* Beacon Cache Entry */
64
65 struct uwb_mac_addr mac_addr;
66 struct uwb_dev_addr dev_addr;
67 int beacon_slot;
68 DECLARE_BITMAP(streams, UWB_NUM_STREAMS);
69};
70#define to_uwb_dev(d) container_of(d, struct uwb_dev, dev)
71
72/**
73 * UWB HWA/WHCI Radio Control {Command|Event} Block context IDs
74 *
75 * RC[CE]Bs have a 'context ID' field that matches the command with
76 * the event received to confirm it.
77 *
78 * Maximum number of context IDs
79 */
80enum { UWB_RC_CTX_MAX = 256 };
81
82
83/** Notification chain head for UWB generated events to listeners */
84struct uwb_notifs_chain {
85 struct list_head list;
86 struct mutex mutex;
87};
88
89/**
90 * struct uwb_mas_bm - a bitmap of all MAS in a superframe
91 * @bm: a bitmap of length #UWB_NUM_MAS
92 */
93struct uwb_mas_bm {
94 DECLARE_BITMAP(bm, UWB_NUM_MAS);
95};
96
97/**
98 * uwb_rsv_state - UWB Reservation state.
99 *
100 * NONE - reservation is not active (no DRP IE being transmitted).
101 *
102 * Owner reservation states:
103 *
104 * INITIATED - owner has sent an initial DRP request.
105 * PENDING - target responded with pending Reason Code.
106 * MODIFIED - reservation manager is modifying an established
107 * reservation with a different MAS allocation.
108 * ESTABLISHED - the reservation has been successfully negotiated.
109 *
110 * Target reservation states:
111 *
112 * DENIED - request is denied.
113 * ACCEPTED - request is accepted.
114 * PENDING - PAL has yet to make a decision to whether to accept or
115 * deny.
116 *
117 * FIXME: further target states TBD.
118 */
119enum uwb_rsv_state {
120 UWB_RSV_STATE_NONE,
121 UWB_RSV_STATE_O_INITIATED,
122 UWB_RSV_STATE_O_PENDING,
123 UWB_RSV_STATE_O_MODIFIED,
124 UWB_RSV_STATE_O_ESTABLISHED,
125 UWB_RSV_STATE_T_ACCEPTED,
126 UWB_RSV_STATE_T_DENIED,
127 UWB_RSV_STATE_T_PENDING,
128
129 UWB_RSV_STATE_LAST,
130};
131
132enum uwb_rsv_target_type {
133 UWB_RSV_TARGET_DEV,
134 UWB_RSV_TARGET_DEVADDR,
135};
136
137/**
138 * struct uwb_rsv_target - the target of a reservation.
139 *
140 * Reservations unicast and targeted at a single device
141 * (UWB_RSV_TARGET_DEV); or (e.g., in the case of WUSB) targeted at a
142 * specific (private) DevAddr (UWB_RSV_TARGET_DEVADDR).
143 */
144struct uwb_rsv_target {
145 enum uwb_rsv_target_type type;
146 union {
147 struct uwb_dev *dev;
148 struct uwb_dev_addr devaddr;
149 };
150};
151
152/*
153 * Number of streams reserved for reservations targeted at DevAddrs.
154 */
155#define UWB_NUM_GLOBAL_STREAMS 1
156
157typedef void (*uwb_rsv_cb_f)(struct uwb_rsv *rsv);
158
159/**
160 * struct uwb_rsv - a DRP reservation
161 *
162 * Data structure management:
163 *
164 * @rc: the radio controller this reservation is for
165 * (as target or owner)
166 * @rc_node: a list node for the RC
167 * @pal_node: a list node for the PAL
168 *
169 * Owner and target parameters:
170 *
171 * @owner: the UWB device owning this reservation
172 * @target: the target UWB device
173 * @type: reservation type
174 *
175 * Owner parameters:
176 *
177 * @max_mas: maxiumum number of MAS
178 * @min_mas: minimum number of MAS
179 * @sparsity: owner selected sparsity
180 * @is_multicast: true iff multicast
181 *
182 * @callback: callback function when the reservation completes
183 * @pal_priv: private data for the PAL making the reservation
184 *
185 * Reservation status:
186 *
187 * @status: negotiation status
188 * @stream: stream index allocated for this reservation
189 * @mas: reserved MAS
190 * @drp_ie: the DRP IE
191 * @ie_valid: true iff the DRP IE matches the reservation parameters
192 *
193 * DRP reservations are uniquely identified by the owner, target and
194 * stream index. However, when using a DevAddr as a target (e.g., for
195 * a WUSB cluster reservation) the responses may be received from
196 * devices with different DevAddrs. In this case, reservations are
197 * uniquely identified by just the stream index. A number of stream
198 * indexes (UWB_NUM_GLOBAL_STREAMS) are reserved for this.
199 */
200struct uwb_rsv {
201 struct uwb_rc *rc;
202 struct list_head rc_node;
203 struct list_head pal_node;
204
205 struct uwb_dev *owner;
206 struct uwb_rsv_target target;
207 enum uwb_drp_type type;
208 int max_mas;
209 int min_mas;
210 int sparsity;
211 bool is_multicast;
212
213 uwb_rsv_cb_f callback;
214 void *pal_priv;
215
216 enum uwb_rsv_state state;
217 u8 stream;
218 struct uwb_mas_bm mas;
219 struct uwb_ie_drp *drp_ie;
220 bool ie_valid;
221 struct timer_list timer;
222 bool expired;
223};
224
225static const
226struct uwb_mas_bm uwb_mas_bm_zero = { .bm = { 0 } };
227
228static inline void uwb_mas_bm_copy_le(void *dst, const struct uwb_mas_bm *mas)
229{
230 bitmap_copy_le(dst, mas->bm, UWB_NUM_MAS);
231}
232
233/**
234 * struct uwb_drp_avail - a radio controller's view of MAS usage
235 * @global: MAS unused by neighbors (excluding reservations targetted
236 * or owned by the local radio controller) or the beaon period
237 * @local: MAS unused by local established reservations
238 * @pending: MAS unused by local pending reservations
239 * @ie: DRP Availability IE to be included in the beacon
240 * @ie_valid: true iff @ie is valid and does not need to regenerated from
241 * @global and @local
242 *
243 * Each radio controller maintains a view of MAS usage or
244 * availability. MAS available for a new reservation are determined
245 * from the intersection of @global, @local, and @pending.
246 *
247 * The radio controller must transmit a DRP Availability IE that's the
248 * intersection of @global and @local.
249 *
250 * A set bit indicates the MAS is unused and available.
251 *
252 * rc->rsvs_mutex should be held before accessing this data structure.
253 *
254 * [ECMA-368] section 17.4.3.
255 */
256struct uwb_drp_avail {
257 DECLARE_BITMAP(global, UWB_NUM_MAS);
258 DECLARE_BITMAP(local, UWB_NUM_MAS);
259 DECLARE_BITMAP(pending, UWB_NUM_MAS);
260 struct uwb_ie_drp_avail ie;
261 bool ie_valid;
262};
263
264
265const char *uwb_rsv_state_str(enum uwb_rsv_state state);
266const char *uwb_rsv_type_str(enum uwb_drp_type type);
267
268struct uwb_rsv *uwb_rsv_create(struct uwb_rc *rc, uwb_rsv_cb_f cb,
269 void *pal_priv);
270void uwb_rsv_destroy(struct uwb_rsv *rsv);
271
272int uwb_rsv_establish(struct uwb_rsv *rsv);
273int uwb_rsv_modify(struct uwb_rsv *rsv,
274 int max_mas, int min_mas, int sparsity);
275void uwb_rsv_terminate(struct uwb_rsv *rsv);
276
277void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv);
278
279/**
280 * Radio Control Interface instance
281 *
282 *
283 * Life cycle rules: those of the UWB Device.
284 *
285 * @index: an index number for this radio controller, as used in the
286 * device name.
287 * @version: version of protocol supported by this device
288 * @priv: Backend implementation; rw with uwb_dev.dev.sem taken.
289 * @cmd: Backend implementation to execute commands; rw and call
290 * only with uwb_dev.dev.sem taken.
291 * @reset: Hardware reset of radio controller and any PAL controllers.
292 * @filter: Backend implementation to manipulate data to and from device
293 * to be compliant to specification assumed by driver (WHCI
294 * 0.95).
295 *
296 * uwb_dev.dev.mutex is used to execute commands and update
297 * the corresponding structures; can't use a spinlock
298 * because rc->cmd() can sleep.
299 * @ies: This is a dynamically allocated array cacheing the
300 * IEs (settable by the host) that the beacon of this
301 * radio controller is currently sending.
302 *
303 * In reality, we store here the full command we set to
304 * the radio controller (which is basically a command
305 * prefix followed by all the IEs the beacon currently
306 * contains). This way we don't have to realloc and
307 * memcpy when setting it.
308 *
309 * We set this up in uwb_rc_ie_setup(), where we alloc
310 * this struct, call get_ie() [so we know which IEs are
311 * currently being sent, if any].
312 *
313 * @ies_capacity:Amount of space (in bytes) allocated in @ies. The
314 * amount used is given by sizeof(*ies) plus ies->wIELength
315 * (which is a little endian quantity all the time).
316 * @ies_mutex: protect the IE cache
317 * @dbg: information for the debug interface
318 */
319struct uwb_rc {
320 struct uwb_dev uwb_dev;
321 int index;
322 u16 version;
323
324 struct module *owner;
325 void *priv;
326 int (*start)(struct uwb_rc *rc);
327 void (*stop)(struct uwb_rc *rc);
328 int (*cmd)(struct uwb_rc *, const struct uwb_rccb *, size_t);
329 int (*reset)(struct uwb_rc *rc);
330 int (*filter_cmd)(struct uwb_rc *, struct uwb_rccb **, size_t *);
331 int (*filter_event)(struct uwb_rc *, struct uwb_rceb **, const size_t,
332 size_t *, size_t *);
333
334 spinlock_t neh_lock; /* protects neh_* and ctx_* */
335 struct list_head neh_list; /* Open NE handles */
336 unsigned long ctx_bm[UWB_RC_CTX_MAX / 8 / sizeof(unsigned long)];
337 u8 ctx_roll;
338
339 int beaconing; /* Beaconing state [channel number] */
340 int scanning;
341 enum uwb_scan_type scan_type:3;
342 unsigned ready:1;
343 struct uwb_notifs_chain notifs_chain;
344
345 struct uwb_drp_avail drp_avail;
346 struct list_head reservations;
347 struct mutex rsvs_mutex;
348 struct workqueue_struct *rsv_workq;
349 struct work_struct rsv_update_work;
350
351 struct mutex ies_mutex;
352 struct uwb_rc_cmd_set_ie *ies;
353 size_t ies_capacity;
354
355 spinlock_t pal_lock;
356 struct list_head pals;
357
358 struct uwb_dbg *dbg;
359};
360
361
362/**
363 * struct uwb_pal - a UWB PAL
364 * @name: descriptive name for this PAL (wushc, wlp, etc.).
365 * @device: a device for the PAL. Used to link the PAL and the radio
366 * controller in sysfs.
367 * @new_rsv: called when a peer requests a reservation (may be NULL if
368 * the PAL cannot accept reservation requests).
369 *
370 * A Protocol Adaptation Layer (PAL) is a user of the WiMedia UWB
371 * radio platform (e.g., WUSB, WLP or Bluetooth UWB AMP).
372 *
373 * The PALs using a radio controller must register themselves to
374 * permit the UWB stack to coordinate usage of the radio between the
375 * various PALs or to allow PALs to response to certain requests from
376 * peers.
377 *
378 * A struct uwb_pal should be embedded in a containing structure
379 * belonging to the PAL and initialized with uwb_pal_init()). Fields
380 * should be set appropriately by the PAL before registering the PAL
381 * with uwb_pal_register().
382 */
383struct uwb_pal {
384 struct list_head node;
385 const char *name;
386 struct device *device;
387 void (*new_rsv)(struct uwb_rsv *rsv);
388};
389
390void uwb_pal_init(struct uwb_pal *pal);
391int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal);
392void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal);
393
394/*
395 * General public API
396 *
397 * This API can be used by UWB device drivers or by those implementing
398 * UWB Radio Controllers
399 */
400struct uwb_dev *uwb_dev_get_by_devaddr(struct uwb_rc *rc,
401 const struct uwb_dev_addr *devaddr);
402struct uwb_dev *uwb_dev_get_by_rc(struct uwb_dev *, struct uwb_rc *);
403static inline void uwb_dev_get(struct uwb_dev *uwb_dev)
404{
405 get_device(&uwb_dev->dev);
406}
407static inline void uwb_dev_put(struct uwb_dev *uwb_dev)
408{
409 put_device(&uwb_dev->dev);
410}
411struct uwb_dev *uwb_dev_try_get(struct uwb_rc *rc, struct uwb_dev *uwb_dev);
412
413/**
414 * Callback function for 'uwb_{dev,rc}_foreach()'.
415 *
416 * @dev: Linux device instance
417 * 'uwb_dev = container_of(dev, struct uwb_dev, dev)'
418 * @priv: Data passed by the caller to 'uwb_{dev,rc}_foreach()'.
419 *
420 * @returns: 0 to continue the iterations, any other val to stop
421 * iterating and return the value to the caller of
422 * _foreach().
423 */
424typedef int (*uwb_dev_for_each_f)(struct device *dev, void *priv);
425int uwb_dev_for_each(struct uwb_rc *rc, uwb_dev_for_each_f func, void *priv);
426
427struct uwb_rc *uwb_rc_alloc(void);
428struct uwb_rc *uwb_rc_get_by_dev(const struct uwb_dev_addr *);
429struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *);
430void uwb_rc_put(struct uwb_rc *rc);
431
432typedef void (*uwb_rc_cmd_cb_f)(struct uwb_rc *rc, void *arg,
433 struct uwb_rceb *reply, ssize_t reply_size);
434
435int uwb_rc_cmd_async(struct uwb_rc *rc, const char *cmd_name,
436 struct uwb_rccb *cmd, size_t cmd_size,
437 u8 expected_type, u16 expected_event,
438 uwb_rc_cmd_cb_f cb, void *arg);
439ssize_t uwb_rc_cmd(struct uwb_rc *rc, const char *cmd_name,
440 struct uwb_rccb *cmd, size_t cmd_size,
441 struct uwb_rceb *reply, size_t reply_size);
442ssize_t uwb_rc_vcmd(struct uwb_rc *rc, const char *cmd_name,
443 struct uwb_rccb *cmd, size_t cmd_size,
444 u8 expected_type, u16 expected_event,
445 struct uwb_rceb **preply);
446ssize_t uwb_rc_get_ie(struct uwb_rc *, struct uwb_rc_evt_get_ie **);
447int uwb_bg_joined(struct uwb_rc *rc);
448
449size_t __uwb_addr_print(char *, size_t, const unsigned char *, int);
450
451int uwb_rc_dev_addr_set(struct uwb_rc *, const struct uwb_dev_addr *);
452int uwb_rc_dev_addr_get(struct uwb_rc *, struct uwb_dev_addr *);
453int uwb_rc_mac_addr_set(struct uwb_rc *, const struct uwb_mac_addr *);
454int uwb_rc_mac_addr_get(struct uwb_rc *, struct uwb_mac_addr *);
455int __uwb_mac_addr_assigned_check(struct device *, void *);
456int __uwb_dev_addr_assigned_check(struct device *, void *);
457
458/* Print in @buf a pretty repr of @addr */
459static inline size_t uwb_dev_addr_print(char *buf, size_t buf_size,
460 const struct uwb_dev_addr *addr)
461{
462 return __uwb_addr_print(buf, buf_size, addr->data, 0);
463}
464
465/* Print in @buf a pretty repr of @addr */
466static inline size_t uwb_mac_addr_print(char *buf, size_t buf_size,
467 const struct uwb_mac_addr *addr)
468{
469 return __uwb_addr_print(buf, buf_size, addr->data, 1);
470}
471
472/* @returns 0 if device addresses @addr2 and @addr1 are equal */
473static inline int uwb_dev_addr_cmp(const struct uwb_dev_addr *addr1,
474 const struct uwb_dev_addr *addr2)
475{
476 return memcmp(addr1, addr2, sizeof(*addr1));
477}
478
479/* @returns 0 if MAC addresses @addr2 and @addr1 are equal */
480static inline int uwb_mac_addr_cmp(const struct uwb_mac_addr *addr1,
481 const struct uwb_mac_addr *addr2)
482{
483 return memcmp(addr1, addr2, sizeof(*addr1));
484}
485
486/* @returns !0 if a MAC @addr is a broadcast address */
487static inline int uwb_mac_addr_bcast(const struct uwb_mac_addr *addr)
488{
489 struct uwb_mac_addr bcast = {
490 .data = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
491 };
492 return !uwb_mac_addr_cmp(addr, &bcast);
493}
494
495/* @returns !0 if a MAC @addr is all zeroes*/
496static inline int uwb_mac_addr_unset(const struct uwb_mac_addr *addr)
497{
498 struct uwb_mac_addr unset = {
499 .data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
500 };
501 return !uwb_mac_addr_cmp(addr, &unset);
502}
503
504/* @returns !0 if the address is in use. */
505static inline unsigned __uwb_dev_addr_assigned(struct uwb_rc *rc,
506 struct uwb_dev_addr *addr)
507{
508 return uwb_dev_for_each(rc, __uwb_dev_addr_assigned_check, addr);
509}
510
511/*
512 * UWB Radio Controller API
513 *
514 * This API is used (in addition to the general API) to implement UWB
515 * Radio Controllers.
516 */
517void uwb_rc_init(struct uwb_rc *);
518int uwb_rc_add(struct uwb_rc *, struct device *dev, void *rc_priv);
519void uwb_rc_rm(struct uwb_rc *);
520void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t);
521void uwb_rc_neh_error(struct uwb_rc *, int);
522void uwb_rc_reset_all(struct uwb_rc *rc);
523
524/**
525 * uwb_rsv_is_owner - is the owner of this reservation the RC?
526 * @rsv: the reservation
527 */
528static inline bool uwb_rsv_is_owner(struct uwb_rsv *rsv)
529{
530 return rsv->owner == &rsv->rc->uwb_dev;
531}
532
533/**
534 * Events generated by UWB that can be passed to any listeners
535 *
536 * Higher layers can register callback functions with the radio
537 * controller using uwb_notifs_register(). The radio controller
538 * maintains a list of all registered handlers and will notify all
539 * nodes when an event occurs.
540 */
541enum uwb_notifs {
542 UWB_NOTIF_BG_JOIN = 0, /* radio controller joined a beacon group */
543 UWB_NOTIF_BG_LEAVE = 1, /* radio controller left a beacon group */
544 UWB_NOTIF_ONAIR,
545 UWB_NOTIF_OFFAIR,
546};
547
548/* Callback function registered with UWB */
549struct uwb_notifs_handler {
550 struct list_head list_node;
551 void (*cb)(void *, struct uwb_dev *, enum uwb_notifs);
552 void *data;
553};
554
555int uwb_notifs_register(struct uwb_rc *, struct uwb_notifs_handler *);
556int uwb_notifs_deregister(struct uwb_rc *, struct uwb_notifs_handler *);
557
558
559/**
560 * UWB radio controller Event Size Entry (for creating entry tables)
561 *
562 * WUSB and WHCI define events and notifications, and they might have
563 * fixed or variable size.
564 *
565 * Each event/notification has a size which is not necessarily known
566 * in advance based on the event code. As well, vendor specific
567 * events/notifications will have a size impossible to determine
568 * unless we know about the device's specific details.
569 *
570 * It was way too smart of the spec writers not to think that it would
571 * be impossible for a generic driver to skip over vendor specific
572 * events/notifications if there are no LENGTH fields in the HEADER of
573 * each message...the transaction size cannot be counted on as the
574 * spec does not forbid to pack more than one event in a single
575 * transaction.
576 *
577 * Thus, we guess sizes with tables (or for events, when you know the
578 * size ahead of time you can use uwb_rc_neh_extra_size*()). We
579 * register tables with the known events and their sizes, and then we
580 * traverse those tables. For those with variable length, we provide a
581 * way to lookup the size inside the event/notification's
582 * payload. This allows device-specific event size tables to be
583 * registered.
584 *
585 * @size: Size of the payload
586 *
587 * @offset: if != 0, at offset @offset-1 starts a field with a length
588 * that has to be added to @size. The format of the field is
589 * given by @type.
590 *
591 * @type: Type and length of the offset field. Most common is LE 16
592 * bits (that's why that is zero); others are there mostly to
593 * cover for bugs and weirdos.
594 */
595struct uwb_est_entry {
596 size_t size;
597 unsigned offset;
598 enum { UWB_EST_16 = 0, UWB_EST_8 = 1 } type;
599};
600
601int uwb_est_register(u8 type, u8 code_high, u16 vendor, u16 product,
602 const struct uwb_est_entry *, size_t entries);
603int uwb_est_unregister(u8 type, u8 code_high, u16 vendor, u16 product,
604 const struct uwb_est_entry *, size_t entries);
605ssize_t uwb_est_find_size(struct uwb_rc *rc, const struct uwb_rceb *rceb,
606 size_t len);
607
608/* -- Misc */
609
610enum {
611 EDC_MAX_ERRORS = 10,
612 EDC_ERROR_TIMEFRAME = HZ,
613};
614
615/* error density counter */
616struct edc {
617 unsigned long timestart;
618 u16 errorcount;
619};
620
621static inline
622void edc_init(struct edc *edc)
623{
624 edc->timestart = jiffies;
625}
626
627/* Called when an error occured.
628 * This is way to determine if the number of acceptable errors per time
629 * period has been exceeded. It is not accurate as there are cases in which
630 * this scheme will not work, for example if there are periodic occurences
631 * of errors that straddle updates to the start time. This scheme is
632 * sufficient for our usage.
633 *
634 * @returns 1 if maximum acceptable errors per timeframe has been exceeded.
635 */
636static inline int edc_inc(struct edc *err_hist, u16 max_err, u16 timeframe)
637{
638 unsigned long now;
639
640 now = jiffies;
641 if (now - err_hist->timestart > timeframe) {
642 err_hist->errorcount = 1;
643 err_hist->timestart = now;
644 } else if (++err_hist->errorcount > max_err) {
645 err_hist->errorcount = 0;
646 err_hist->timestart = now;
647 return 1;
648 }
649 return 0;
650}
651
652
653/* Information Element handling */
654
655/* For representing the state of writing to a buffer when iterating */
656struct uwb_buf_ctx {
657 char *buf;
658 size_t bytes, size;
659};
660
661typedef int (*uwb_ie_f)(struct uwb_dev *, const struct uwb_ie_hdr *,
662 size_t, void *);
663struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len);
664ssize_t uwb_ie_for_each(struct uwb_dev *uwb_dev, uwb_ie_f fn, void *data,
665 const void *buf, size_t size);
666int uwb_ie_dump_hex(struct uwb_dev *, const struct uwb_ie_hdr *,
667 size_t, void *);
668int uwb_rc_set_ie(struct uwb_rc *, struct uwb_rc_cmd_set_ie *);
669struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len);
670
671
672/*
673 * Transmission statistics
674 *
675 * UWB uses LQI and RSSI (one byte values) for reporting radio signal
676 * strength and line quality indication. We do quick and dirty
677 * averages of those. They are signed values, btw.
678 *
679 * For 8 bit quantities, we keep the min, the max, an accumulator
680 * (@sigma) and a # of samples. When @samples gets to 255, we compute
681 * the average (@sigma / @samples), place it in @sigma and reset
682 * @samples to 1 (so we use it as the first sample).
683 *
684 * Now, statistically speaking, probably I am kicking the kidneys of
685 * some books I have in my shelves collecting dust, but I just want to
686 * get an approx, not the Nobel.
687 *
688 * LOCKING: there is no locking per se, but we try to keep a lockless
689 * schema. Only _add_samples() modifies the values--as long as you
690 * have other locking on top that makes sure that no two calls of
691 * _add_sample() happen at the same time, then we are fine. Now, for
692 * resetting the values we just set @samples to 0 and that makes the
693 * next _add_sample() to start with defaults. Reading the values in
694 * _show() currently can race, so you need to make sure the calls are
695 * under the same lock that protects calls to _add_sample(). FIXME:
696 * currently unlocked (It is not ultraprecise but does the trick. Bite
697 * me).
698 */
699struct stats {
700 s8 min, max;
701 s16 sigma;
702 atomic_t samples;
703};
704
705static inline
706void stats_init(struct stats *stats)
707{
708 atomic_set(&stats->samples, 0);
709 wmb();
710}
711
712static inline
713void stats_add_sample(struct stats *stats, s8 sample)
714{
715 s8 min, max;
716 s16 sigma;
717 unsigned samples = atomic_read(&stats->samples);
718 if (samples == 0) { /* it was zero before, so we initialize */
719 min = 127;
720 max = -128;
721 sigma = 0;
722 } else {
723 min = stats->min;
724 max = stats->max;
725 sigma = stats->sigma;
726 }
727
728 if (sample < min) /* compute new values */
729 min = sample;
730 else if (sample > max)
731 max = sample;
732 sigma += sample;
733
734 stats->min = min; /* commit */
735 stats->max = max;
736 stats->sigma = sigma;
737 if (atomic_add_return(1, &stats->samples) > 255) {
738 /* wrapped around! reset */
739 stats->sigma = sigma / 256;
740 atomic_set(&stats->samples, 1);
741 }
742}
743
744static inline ssize_t stats_show(struct stats *stats, char *buf)
745{
746 int min, max, avg;
747 int samples = atomic_read(&stats->samples);
748 if (samples == 0)
749 min = max = avg = 0;
750 else {
751 min = stats->min;
752 max = stats->max;
753 avg = stats->sigma / samples;
754 }
755 return scnprintf(buf, PAGE_SIZE, "%d %d %d\n", min, max, avg);
756}
757
758static inline ssize_t stats_store(struct stats *stats, const char *buf,
759 size_t size)
760{
761 stats_init(stats);
762 return size;
763}
764
765#endif /* #ifndef __LINUX__UWB_H__ */
diff --git a/include/linux/uwb/debug-cmd.h b/include/linux/uwb/debug-cmd.h
new file mode 100644
index 000000000000..1141f41bab5c
--- /dev/null
+++ b/include/linux/uwb/debug-cmd.h
@@ -0,0 +1,57 @@
1/*
2 * Ultra Wide Band
3 * Debug interface commands
4 *
5 * Copyright (C) 2008 Cambridge Silicon Radio Ltd.
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 version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef __LINUX__UWB__DEBUG_CMD_H__
20#define __LINUX__UWB__DEBUG_CMD_H__
21
22#include <linux/types.h>
23
24/*
25 * Debug interface commands
26 *
27 * UWB_DBG_CMD_RSV_ESTABLISH: Establish a new unicast reservation.
28 *
29 * UWB_DBG_CMD_RSV_TERMINATE: Terminate the Nth reservation.
30 */
31
32enum uwb_dbg_cmd_type {
33 UWB_DBG_CMD_RSV_ESTABLISH = 1,
34 UWB_DBG_CMD_RSV_TERMINATE = 2,
35};
36
37struct uwb_dbg_cmd_rsv_establish {
38 __u8 target[6];
39 __u8 type;
40 __u16 max_mas;
41 __u16 min_mas;
42 __u8 sparsity;
43};
44
45struct uwb_dbg_cmd_rsv_terminate {
46 int index;
47};
48
49struct uwb_dbg_cmd {
50 __u32 type;
51 union {
52 struct uwb_dbg_cmd_rsv_establish rsv_establish;
53 struct uwb_dbg_cmd_rsv_terminate rsv_terminate;
54 };
55};
56
57#endif /* #ifndef __LINUX__UWB__DEBUG_CMD_H__ */
diff --git a/include/linux/uwb/debug.h b/include/linux/uwb/debug.h
new file mode 100644
index 000000000000..a86a73fe303f
--- /dev/null
+++ b/include/linux/uwb/debug.h
@@ -0,0 +1,82 @@
1/*
2 * Ultra Wide Band
3 * Debug Support
4 *
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 *
23 * FIXME: doc
24 * Invoke like:
25 *
26 * #define D_LOCAL 4
27 * #include <linux/uwb/debug.h>
28 *
29 * At the end of your include files.
30 */
31#include <linux/types.h>
32
33struct device;
34extern void dump_bytes(struct device *dev, const void *_buf, size_t rsize);
35
36/* Master debug switch; !0 enables, 0 disables */
37#define D_MASTER (!0)
38
39/* Local (per-file) debug switch; #define before #including */
40#ifndef D_LOCAL
41#define D_LOCAL 0
42#endif
43
44#undef __d_printf
45#undef d_fnstart
46#undef d_fnend
47#undef d_printf
48#undef d_dump
49
50#define __d_printf(l, _tag, _dev, f, a...) \
51do { \
52 struct device *__dev = (_dev); \
53 if (D_MASTER && D_LOCAL >= (l)) { \
54 char __head[64] = ""; \
55 if (_dev != NULL) { \
56 if ((unsigned long)__dev < 4096) \
57 printk(KERN_ERR "E: Corrupt dev %p\n", \
58 __dev); \
59 else \
60 snprintf(__head, sizeof(__head), \
61 "%s %s: ", \
62 dev_driver_string(__dev), \
63 __dev->bus_id); \
64 } \
65 printk(KERN_ERR "%s%s" _tag ": " f, __head, \
66 __func__, ## a); \
67 } \
68} while (0 && _dev)
69
70#define d_fnstart(l, _dev, f, a...) \
71 __d_printf(l, " FNSTART", _dev, f, ## a)
72#define d_fnend(l, _dev, f, a...) \
73 __d_printf(l, " FNEND", _dev, f, ## a)
74#define d_printf(l, _dev, f, a...) \
75 __d_printf(l, "", _dev, f, ## a)
76#define d_dump(l, _dev, ptr, size) \
77do { \
78 struct device *__dev = _dev; \
79 if (D_MASTER && D_LOCAL >= (l)) \
80 dump_bytes(__dev, ptr, size); \
81} while (0 && _dev)
82#define d_test(l) (D_MASTER && D_LOCAL >= (l))
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
new file mode 100644
index 000000000000..198c15f8e251
--- /dev/null
+++ b/include/linux/uwb/spec.h
@@ -0,0 +1,727 @@
1/*
2 * Ultra Wide Band
3 * UWB Standard definitions
4 *
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 *
23 * All these definitions are based on the ECMA-368 standard.
24 *
25 * Note all definitions are Little Endian in the wire, and we will
26 * convert them to host order before operating on the bitfields (that
27 * yes, we use extensively).
28 */
29
30#ifndef __LINUX__UWB_SPEC_H__
31#define __LINUX__UWB_SPEC_H__
32
33#include <linux/types.h>
34#include <linux/bitmap.h>
35
36#define i1480_FW 0x00000303
37/* #define i1480_FW 0x00000302 */
38
39/**
40 * Number of Medium Access Slots in a superframe.
41 *
42 * UWB divides time in SuperFrames, each one divided in 256 pieces, or
43 * Medium Access Slots. See MBOA MAC[5.4.5] for details. The MAS is the
44 * basic bandwidth allocation unit in UWB.
45 */
46enum { UWB_NUM_MAS = 256 };
47
48/**
49 * Number of Zones in superframe.
50 *
51 * UWB divides the superframe into zones with numbering starting from BPST.
52 * See MBOA MAC[16.8.6]
53 */
54enum { UWB_NUM_ZONES = 16 };
55
56/*
57 * Number of MAS in a zone.
58 */
59#define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES)
60
61/*
62 * Number of streams per DRP reservation between a pair of devices.
63 *
64 * [ECMA-368] section 16.8.6.
65 */
66enum { UWB_NUM_STREAMS = 8 };
67
68/*
69 * mMasLength
70 *
71 * The length of a MAS in microseconds.
72 *
73 * [ECMA-368] section 17.16.
74 */
75enum { UWB_MAS_LENGTH_US = 256 };
76
77/*
78 * mBeaconSlotLength
79 *
80 * The length of the beacon slot in microseconds.
81 *
82 * [ECMA-368] section 17.16
83 */
84enum { UWB_BEACON_SLOT_LENGTH_US = 85 };
85
86/*
87 * mMaxLostBeacons
88 *
89 * The number beacons missing in consecutive superframes before a
90 * device can be considered as unreachable.
91 *
92 * [ECMA-368] section 17.16
93 */
94enum { UWB_MAX_LOST_BEACONS = 3 };
95
96/*
97 * Length of a superframe in microseconds.
98 */
99#define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS)
100
101/**
102 * UWB MAC address
103 *
104 * It is *imperative* that this struct is exactly 6 packed bytes (as
105 * it is also used to define headers sent down and up the wire/radio).
106 */
107struct uwb_mac_addr {
108 u8 data[6];
109} __attribute__((packed));
110
111
112/**
113 * UWB device address
114 *
115 * It is *imperative* that this struct is exactly 6 packed bytes (as
116 * it is also used to define headers sent down and up the wire/radio).
117 */
118struct uwb_dev_addr {
119 u8 data[2];
120} __attribute__((packed));
121
122
123/**
124 * Types of UWB addresses
125 *
126 * Order matters (by size).
127 */
128enum uwb_addr_type {
129 UWB_ADDR_DEV = 0,
130 UWB_ADDR_MAC = 1,
131};
132
133
134/** Size of a char buffer for printing a MAC/device address */
135enum { UWB_ADDR_STRSIZE = 32 };
136
137
138/** UWB WiMedia protocol IDs. */
139enum uwb_prid {
140 UWB_PRID_WLP_RESERVED = 0x0000,
141 UWB_PRID_WLP = 0x0001,
142 UWB_PRID_WUSB_BOT = 0x0010,
143 UWB_PRID_WUSB = 0x0010,
144 UWB_PRID_WUSB_TOP = 0x001F,
145};
146
147
148/** PHY Rate (MBOA MAC[7.8.12, Table 61]) */
149enum uwb_phy_rate {
150 UWB_PHY_RATE_53 = 0,
151 UWB_PHY_RATE_80,
152 UWB_PHY_RATE_106,
153 UWB_PHY_RATE_160,
154 UWB_PHY_RATE_200,
155 UWB_PHY_RATE_320,
156 UWB_PHY_RATE_400,
157 UWB_PHY_RATE_480,
158 UWB_PHY_RATE_INVALID
159};
160
161
162/**
163 * Different ways to scan (MBOA MAC[6.2.2, Table 8], WUSB[Table 8-78])
164 */
165enum uwb_scan_type {
166 UWB_SCAN_ONLY = 0,
167 UWB_SCAN_OUTSIDE_BP,
168 UWB_SCAN_WHILE_INACTIVE,
169 UWB_SCAN_DISABLED,
170 UWB_SCAN_ONLY_STARTTIME,
171 UWB_SCAN_TOP
172};
173
174
175/** ACK Policy types (MBOA MAC[7.2.1.3]) */
176enum uwb_ack_pol {
177 UWB_ACK_NO = 0,
178 UWB_ACK_INM = 1,
179 UWB_ACK_B = 2,
180 UWB_ACK_B_REQ = 3,
181};
182
183
184/** DRP reservation types ([ECMA-368 table 106) */
185enum uwb_drp_type {
186 UWB_DRP_TYPE_ALIEN_BP = 0,
187 UWB_DRP_TYPE_HARD,
188 UWB_DRP_TYPE_SOFT,
189 UWB_DRP_TYPE_PRIVATE,
190 UWB_DRP_TYPE_PCA,
191};
192
193
194/** DRP Reason Codes ([ECMA-368] table 107) */
195enum uwb_drp_reason {
196 UWB_DRP_REASON_ACCEPTED = 0,
197 UWB_DRP_REASON_CONFLICT,
198 UWB_DRP_REASON_PENDING,
199 UWB_DRP_REASON_DENIED,
200 UWB_DRP_REASON_MODIFIED,
201};
202
203/**
204 * DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9])
205 */
206enum uwb_drp_notif_reason {
207 UWB_DRP_NOTIF_DRP_IE_RCVD = 0,
208 UWB_DRP_NOTIF_CONFLICT,
209 UWB_DRP_NOTIF_TERMINATE,
210};
211
212
213/** Allocation of MAS slots in a DRP request MBOA MAC[7.8.7] */
214struct uwb_drp_alloc {
215 __le16 zone_bm;
216 __le16 mas_bm;
217} __attribute__((packed));
218
219
220/** General MAC Header format (ECMA-368[16.2]) */
221struct uwb_mac_frame_hdr {
222 __le16 Frame_Control;
223 struct uwb_dev_addr DestAddr;
224 struct uwb_dev_addr SrcAddr;
225 __le16 Sequence_Control;
226 __le16 Access_Information;
227} __attribute__((packed));
228
229
230/**
231 * uwb_beacon_frame - a beacon frame including MAC headers
232 *
233 * [ECMA] section 16.3.
234 */
235struct uwb_beacon_frame {
236 struct uwb_mac_frame_hdr hdr;
237 struct uwb_mac_addr Device_Identifier; /* may be a NULL EUI-48 */
238 u8 Beacon_Slot_Number;
239 u8 Device_Control;
240 u8 IEData[];
241} __attribute__((packed));
242
243
244/** Information Element codes (MBOA MAC[T54]) */
245enum uwb_ie {
246 UWB_PCA_AVAILABILITY = 2,
247 UWB_IE_DRP_AVAILABILITY = 8,
248 UWB_IE_DRP = 9,
249 UWB_BP_SWITCH_IE = 11,
250 UWB_MAC_CAPABILITIES_IE = 12,
251 UWB_PHY_CAPABILITIES_IE = 13,
252 UWB_APP_SPEC_PROBE_IE = 15,
253 UWB_IDENTIFICATION_IE = 19,
254 UWB_MASTER_KEY_ID_IE = 20,
255 UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */
256 UWB_APP_SPEC_IE = 255,
257};
258
259
260/**
261 * Header common to all Information Elements (IEs)
262 */
263struct uwb_ie_hdr {
264 u8 element_id; /* enum uwb_ie */
265 u8 length;
266} __attribute__((packed));
267
268
269/** Dynamic Reservation Protocol IE (MBOA MAC[7.8.6]) */
270struct uwb_ie_drp {
271 struct uwb_ie_hdr hdr;
272 __le16 drp_control;
273 struct uwb_dev_addr dev_addr;
274 struct uwb_drp_alloc allocs[];
275} __attribute__((packed));
276
277static inline int uwb_ie_drp_type(struct uwb_ie_drp *ie)
278{
279 return (le16_to_cpu(ie->drp_control) >> 0) & 0x7;
280}
281
282static inline int uwb_ie_drp_stream_index(struct uwb_ie_drp *ie)
283{
284 return (le16_to_cpu(ie->drp_control) >> 3) & 0x7;
285}
286
287static inline int uwb_ie_drp_reason_code(struct uwb_ie_drp *ie)
288{
289 return (le16_to_cpu(ie->drp_control) >> 6) & 0x7;
290}
291
292static inline int uwb_ie_drp_status(struct uwb_ie_drp *ie)
293{
294 return (le16_to_cpu(ie->drp_control) >> 9) & 0x1;
295}
296
297static inline int uwb_ie_drp_owner(struct uwb_ie_drp *ie)
298{
299 return (le16_to_cpu(ie->drp_control) >> 10) & 0x1;
300}
301
302static inline int uwb_ie_drp_tiebreaker(struct uwb_ie_drp *ie)
303{
304 return (le16_to_cpu(ie->drp_control) >> 11) & 0x1;
305}
306
307static inline int uwb_ie_drp_unsafe(struct uwb_ie_drp *ie)
308{
309 return (le16_to_cpu(ie->drp_control) >> 12) & 0x1;
310}
311
312static inline void uwb_ie_drp_set_type(struct uwb_ie_drp *ie, enum uwb_drp_type type)
313{
314 u16 drp_control = le16_to_cpu(ie->drp_control);
315 drp_control = (drp_control & ~(0x7 << 0)) | (type << 0);
316 ie->drp_control = cpu_to_le16(drp_control);
317}
318
319static inline void uwb_ie_drp_set_stream_index(struct uwb_ie_drp *ie, int stream_index)
320{
321 u16 drp_control = le16_to_cpu(ie->drp_control);
322 drp_control = (drp_control & ~(0x7 << 3)) | (stream_index << 3);
323 ie->drp_control = cpu_to_le16(drp_control);
324}
325
326static inline void uwb_ie_drp_set_reason_code(struct uwb_ie_drp *ie,
327 enum uwb_drp_reason reason_code)
328{
329 u16 drp_control = le16_to_cpu(ie->drp_control);
330 drp_control = (ie->drp_control & ~(0x7 << 6)) | (reason_code << 6);
331 ie->drp_control = cpu_to_le16(drp_control);
332}
333
334static inline void uwb_ie_drp_set_status(struct uwb_ie_drp *ie, int status)
335{
336 u16 drp_control = le16_to_cpu(ie->drp_control);
337 drp_control = (drp_control & ~(0x1 << 9)) | (status << 9);
338 ie->drp_control = cpu_to_le16(drp_control);
339}
340
341static inline void uwb_ie_drp_set_owner(struct uwb_ie_drp *ie, int owner)
342{
343 u16 drp_control = le16_to_cpu(ie->drp_control);
344 drp_control = (drp_control & ~(0x1 << 10)) | (owner << 10);
345 ie->drp_control = cpu_to_le16(drp_control);
346}
347
348static inline void uwb_ie_drp_set_tiebreaker(struct uwb_ie_drp *ie, int tiebreaker)
349{
350 u16 drp_control = le16_to_cpu(ie->drp_control);
351 drp_control = (drp_control & ~(0x1 << 11)) | (tiebreaker << 11);
352 ie->drp_control = cpu_to_le16(drp_control);
353}
354
355static inline void uwb_ie_drp_set_unsafe(struct uwb_ie_drp *ie, int unsafe)
356{
357 u16 drp_control = le16_to_cpu(ie->drp_control);
358 drp_control = (drp_control & ~(0x1 << 12)) | (unsafe << 12);
359 ie->drp_control = cpu_to_le16(drp_control);
360}
361
362/** Dynamic Reservation Protocol IE (MBOA MAC[7.8.7]) */
363struct uwb_ie_drp_avail {
364 struct uwb_ie_hdr hdr;
365 DECLARE_BITMAP(bmp, UWB_NUM_MAS);
366} __attribute__((packed));
367
368/**
369 * The Vendor ID is set to an OUI that indicates the vendor of the device.
370 * ECMA-368 [16.8.10]
371 */
372struct uwb_vendor_id {
373 u8 data[3];
374} __attribute__((packed));
375
376/**
377 * The device type ID
378 * FIXME: clarify what this means
379 * ECMA-368 [16.8.10]
380 */
381struct uwb_device_type_id {
382 u8 data[3];
383} __attribute__((packed));
384
385
386/**
387 * UWB device information types
388 * ECMA-368 [16.8.10]
389 */
390enum uwb_dev_info_type {
391 UWB_DEV_INFO_VENDOR_ID = 0,
392 UWB_DEV_INFO_VENDOR_TYPE,
393 UWB_DEV_INFO_NAME,
394};
395
396/**
397 * UWB device information found in Identification IE
398 * ECMA-368 [16.8.10]
399 */
400struct uwb_dev_info {
401 u8 type; /* enum uwb_dev_info_type */
402 u8 length;
403 u8 data[];
404} __attribute__((packed));
405
406/**
407 * UWB Identification IE
408 * ECMA-368 [16.8.10]
409 */
410struct uwb_identification_ie {
411 struct uwb_ie_hdr hdr;
412 struct uwb_dev_info info[];
413} __attribute__((packed));
414
415/*
416 * UWB Radio Controller
417 *
418 * These definitions are common to the Radio Control layers as
419 * exported by the WUSB1.0 HWA and WHCI interfaces.
420 */
421
422/** Radio Control Command Block (WUSB1.0[Table 8-65] and WHCI 0.95) */
423struct uwb_rccb {
424 u8 bCommandType; /* enum hwa_cet */
425 __le16 wCommand; /* Command code */
426 u8 bCommandContext; /* Context ID */
427} __attribute__((packed));
428
429
430/** Radio Control Event Block (WUSB[table 8-66], WHCI 0.95) */
431struct uwb_rceb {
432 u8 bEventType; /* enum hwa_cet */
433 __le16 wEvent; /* Event code */
434 u8 bEventContext; /* Context ID */
435} __attribute__((packed));
436
437
438enum {
439 UWB_RC_CET_GENERAL = 0, /* General Command/Event type */
440 UWB_RC_CET_EX_TYPE_1 = 1, /* Extended Type 1 Command/Event type */
441};
442
443/* Commands to the radio controller */
444enum uwb_rc_cmd {
445 UWB_RC_CMD_CHANNEL_CHANGE = 16,
446 UWB_RC_CMD_DEV_ADDR_MGMT = 17, /* Device Address Management */
447 UWB_RC_CMD_GET_IE = 18, /* GET Information Elements */
448 UWB_RC_CMD_RESET = 19,
449 UWB_RC_CMD_SCAN = 20, /* Scan management */
450 UWB_RC_CMD_SET_BEACON_FILTER = 21,
451 UWB_RC_CMD_SET_DRP_IE = 22, /* Dynamic Reservation Protocol IEs */
452 UWB_RC_CMD_SET_IE = 23, /* Information Element management */
453 UWB_RC_CMD_SET_NOTIFICATION_FILTER = 24,
454 UWB_RC_CMD_SET_TX_POWER = 25,
455 UWB_RC_CMD_SLEEP = 26,
456 UWB_RC_CMD_START_BEACON = 27,
457 UWB_RC_CMD_STOP_BEACON = 28,
458 UWB_RC_CMD_BP_MERGE = 29,
459 UWB_RC_CMD_SEND_COMMAND_FRAME = 30,
460 UWB_RC_CMD_SET_ASIE_NOTIF = 31,
461};
462
463/* Notifications from the radio controller */
464enum uwb_rc_evt {
465 UWB_RC_EVT_IE_RCV = 0,
466 UWB_RC_EVT_BEACON = 1,
467 UWB_RC_EVT_BEACON_SIZE = 2,
468 UWB_RC_EVT_BPOIE_CHANGE = 3,
469 UWB_RC_EVT_BP_SLOT_CHANGE = 4,
470 UWB_RC_EVT_BP_SWITCH_IE_RCV = 5,
471 UWB_RC_EVT_DEV_ADDR_CONFLICT = 6,
472 UWB_RC_EVT_DRP_AVAIL = 7,
473 UWB_RC_EVT_DRP = 8,
474 UWB_RC_EVT_BP_SWITCH_STATUS = 9,
475 UWB_RC_EVT_CMD_FRAME_RCV = 10,
476 UWB_RC_EVT_CHANNEL_CHANGE_IE_RCV = 11,
477 /* Events (command responses) use the same code as the command */
478 UWB_RC_EVT_UNKNOWN_CMD_RCV = 65535,
479};
480
481enum uwb_rc_extended_type_1_cmd {
482 UWB_RC_SET_DAA_ENERGY_MASK = 32,
483 UWB_RC_SET_NOTIFICATION_FILTER_EX = 33,
484};
485
486enum uwb_rc_extended_type_1_evt {
487 UWB_RC_DAA_ENERGY_DETECTED = 0,
488};
489
490/* Radio Control Result Code. [WHCI] table 3-3. */
491enum {
492 UWB_RC_RES_SUCCESS = 0,
493 UWB_RC_RES_FAIL,
494 UWB_RC_RES_FAIL_HARDWARE,
495 UWB_RC_RES_FAIL_NO_SLOTS,
496 UWB_RC_RES_FAIL_BEACON_TOO_LARGE,
497 UWB_RC_RES_FAIL_INVALID_PARAMETER,
498 UWB_RC_RES_FAIL_UNSUPPORTED_PWR_LEVEL,
499 UWB_RC_RES_FAIL_INVALID_IE_DATA,
500 UWB_RC_RES_FAIL_BEACON_SIZE_EXCEEDED,
501 UWB_RC_RES_FAIL_CANCELLED,
502 UWB_RC_RES_FAIL_INVALID_STATE,
503 UWB_RC_RES_FAIL_INVALID_SIZE,
504 UWB_RC_RES_FAIL_ACK_NOT_RECEIVED,
505 UWB_RC_RES_FAIL_NO_MORE_ASIE_NOTIF,
506 UWB_RC_RES_FAIL_TIME_OUT = 255,
507};
508
509/* Confirm event. [WHCI] section 3.1.3.1 etc. */
510struct uwb_rc_evt_confirm {
511 struct uwb_rceb rceb;
512 u8 bResultCode;
513} __attribute__((packed));
514
515/* Device Address Management event. [WHCI] section 3.1.3.2. */
516struct uwb_rc_evt_dev_addr_mgmt {
517 struct uwb_rceb rceb;
518 u8 baAddr[6];
519 u8 bResultCode;
520} __attribute__((packed));
521
522
523/* Get IE Event. [WHCI] section 3.1.3.3. */
524struct uwb_rc_evt_get_ie {
525 struct uwb_rceb rceb;
526 __le16 wIELength;
527 u8 IEData[];
528} __attribute__((packed));
529
530/* Set DRP IE Event. [WHCI] section 3.1.3.7. */
531struct uwb_rc_evt_set_drp_ie {
532 struct uwb_rceb rceb;
533 __le16 wRemainingSpace;
534 u8 bResultCode;
535} __attribute__((packed));
536
537/* Set IE Event. [WHCI] section 3.1.3.8. */
538struct uwb_rc_evt_set_ie {
539 struct uwb_rceb rceb;
540 __le16 RemainingSpace;
541 u8 bResultCode;
542} __attribute__((packed));
543
544/* Scan command. [WHCI] 3.1.3.5. */
545struct uwb_rc_cmd_scan {
546 struct uwb_rccb rccb;
547 u8 bChannelNumber;
548 u8 bScanState;
549 __le16 wStartTime;
550} __attribute__((packed));
551
552/* Set DRP IE command. [WHCI] section 3.1.3.7. */
553struct uwb_rc_cmd_set_drp_ie {
554 struct uwb_rccb rccb;
555 __le16 wIELength;
556 struct uwb_ie_drp IEData[];
557} __attribute__((packed));
558
559/* Set IE command. [WHCI] section 3.1.3.8. */
560struct uwb_rc_cmd_set_ie {
561 struct uwb_rccb rccb;
562 __le16 wIELength;
563 u8 IEData[];
564} __attribute__((packed));
565
566/* Set DAA Energy Mask event. [WHCI 0.96] section 3.1.3.17. */
567struct uwb_rc_evt_set_daa_energy_mask {
568 struct uwb_rceb rceb;
569 __le16 wLength;
570 u8 result;
571} __attribute__((packed));
572
573/* Set Notification Filter Extended event. [WHCI 0.96] section 3.1.3.18. */
574struct uwb_rc_evt_set_notification_filter_ex {
575 struct uwb_rceb rceb;
576 __le16 wLength;
577 u8 result;
578} __attribute__((packed));
579
580/* IE Received notification. [WHCI] section 3.1.4.1. */
581struct uwb_rc_evt_ie_rcv {
582 struct uwb_rceb rceb;
583 struct uwb_dev_addr SrcAddr;
584 __le16 wIELength;
585 u8 IEData[];
586} __attribute__((packed));
587
588/* Type of the received beacon. [WHCI] section 3.1.4.2. */
589enum uwb_rc_beacon_type {
590 UWB_RC_BEACON_TYPE_SCAN = 0,
591 UWB_RC_BEACON_TYPE_NEIGHBOR,
592 UWB_RC_BEACON_TYPE_OL_ALIEN,
593 UWB_RC_BEACON_TYPE_NOL_ALIEN,
594};
595
596/* Beacon received notification. [WHCI] 3.1.4.2. */
597struct uwb_rc_evt_beacon {
598 struct uwb_rceb rceb;
599 u8 bChannelNumber;
600 u8 bBeaconType;
601 __le16 wBPSTOffset;
602 u8 bLQI;
603 u8 bRSSI;
604 __le16 wBeaconInfoLength;
605 u8 BeaconInfo[];
606} __attribute__((packed));
607
608
609/* Beacon Size Change notification. [WHCI] section 3.1.4.3 */
610struct uwb_rc_evt_beacon_size {
611 struct uwb_rceb rceb;
612 __le16 wNewBeaconSize;
613} __attribute__((packed));
614
615
616/* BPOIE Change notification. [WHCI] section 3.1.4.4. */
617struct uwb_rc_evt_bpoie_change {
618 struct uwb_rceb rceb;
619 __le16 wBPOIELength;
620 u8 BPOIE[];
621} __attribute__((packed));
622
623
624/* Beacon Slot Change notification. [WHCI] section 3.1.4.5. */
625struct uwb_rc_evt_bp_slot_change {
626 struct uwb_rceb rceb;
627 u8 slot_info;
628} __attribute__((packed));
629
630static inline int uwb_rc_evt_bp_slot_change_slot_num(
631 const struct uwb_rc_evt_bp_slot_change *evt)
632{
633 return evt->slot_info & 0x7f;
634}
635
636static inline int uwb_rc_evt_bp_slot_change_no_slot(
637 const struct uwb_rc_evt_bp_slot_change *evt)
638{
639 return (evt->slot_info & 0x80) >> 7;
640}
641
642/* BP Switch IE Received notification. [WHCI] section 3.1.4.6. */
643struct uwb_rc_evt_bp_switch_ie_rcv {
644 struct uwb_rceb rceb;
645 struct uwb_dev_addr wSrcAddr;
646 __le16 wIELength;
647 u8 IEData[];
648} __attribute__((packed));
649
650/* DevAddr Conflict notification. [WHCI] section 3.1.4.7. */
651struct uwb_rc_evt_dev_addr_conflict {
652 struct uwb_rceb rceb;
653} __attribute__((packed));
654
655/* DRP notification. [WHCI] section 3.1.4.9. */
656struct uwb_rc_evt_drp {
657 struct uwb_rceb rceb;
658 struct uwb_dev_addr src_addr;
659 u8 reason;
660 u8 beacon_slot_number;
661 __le16 ie_length;
662 u8 ie_data[];
663} __attribute__((packed));
664
665static inline enum uwb_drp_notif_reason uwb_rc_evt_drp_reason(struct uwb_rc_evt_drp *evt)
666{
667 return evt->reason & 0x0f;
668}
669
670
671/* DRP Availability Change notification. [WHCI] section 3.1.4.8. */
672struct uwb_rc_evt_drp_avail {
673 struct uwb_rceb rceb;
674 DECLARE_BITMAP(bmp, UWB_NUM_MAS);
675} __attribute__((packed));
676
677/* BP switch status notification. [WHCI] section 3.1.4.10. */
678struct uwb_rc_evt_bp_switch_status {
679 struct uwb_rceb rceb;
680 u8 status;
681 u8 slot_offset;
682 __le16 bpst_offset;
683 u8 move_countdown;
684} __attribute__((packed));
685
686/* Command Frame Received notification. [WHCI] section 3.1.4.11. */
687struct uwb_rc_evt_cmd_frame_rcv {
688 struct uwb_rceb rceb;
689 __le16 receive_time;
690 struct uwb_dev_addr wSrcAddr;
691 struct uwb_dev_addr wDstAddr;
692 __le16 control;
693 __le16 reserved;
694 __le16 dataLength;
695 u8 data[];
696} __attribute__((packed));
697
698/* Channel Change IE Received notification. [WHCI] section 3.1.4.12. */
699struct uwb_rc_evt_channel_change_ie_rcv {
700 struct uwb_rceb rceb;
701 struct uwb_dev_addr wSrcAddr;
702 __le16 wIELength;
703 u8 IEData[];
704} __attribute__((packed));
705
706/* DAA Energy Detected notification. [WHCI 0.96] section 3.1.4.14. */
707struct uwb_rc_evt_daa_energy_detected {
708 struct uwb_rceb rceb;
709 __le16 wLength;
710 u8 bandID;
711 u8 reserved;
712 u8 toneBmp[16];
713} __attribute__((packed));
714
715
716/**
717 * Radio Control Interface Class Descriptor
718 *
719 * WUSB 1.0 [8.6.1.2]
720 */
721struct uwb_rc_control_intf_class_desc {
722 u8 bLength;
723 u8 bDescriptorType;
724 __le16 bcdRCIVersion;
725} __attribute__((packed));
726
727#endif /* #ifndef __LINUX__UWB_SPEC_H__ */
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
new file mode 100644
index 000000000000..36a39e34f8d7
--- /dev/null
+++ b/include/linux/uwb/umc.h
@@ -0,0 +1,194 @@
1/*
2 * UWB Multi-interface Controller support.
3 *
4 * Copyright (C) 2007 Cambridge Silicon Radio Ltd.
5 *
6 * This file is released under the GPLv2
7 *
8 * UMC (UWB Multi-interface Controller) capabilities (e.g., radio
9 * controller, host controller) are presented as devices on the "umc"
10 * bus.
11 *
12 * The radio controller is not strictly a UMC capability but it's
13 * useful to present it as such.
14 *
15 * References:
16 *
17 * [WHCI] Wireless Host Controller Interface Specification for
18 * Certified Wireless Universal Serial Bus, revision 0.95.
19 *
20 * How this works is kind of convoluted but simple. The whci.ko driver
21 * loads when WHCI devices are detected. These WHCI devices expose
22 * many devices in the same PCI function (they couldn't have reused
23 * functions, no), so for each PCI function that exposes these many
24 * devices, whci ceates a umc_dev [whci_probe() -> whci_add_cap()]
25 * with umc_device_create() and adds it to the bus with
26 * umc_device_register().
27 *
28 * umc_device_register() calls device_register() which will push the
29 * bus management code to load your UMC driver's somehting_probe()
30 * that you have registered for that capability code.
31 *
32 * Now when the WHCI device is removed, whci_remove() will go over
33 * each umc_dev assigned to each of the PCI function's capabilities
34 * and through whci_del_cap() call umc_device_unregister() each
35 * created umc_dev. Of course, if you are bound to the device, your
36 * driver's something_remove() will be called.
37 */
38
39#ifndef _LINUX_UWB_UMC_H_
40#define _LINUX_UWB_UMC_H_
41
42#include <linux/device.h>
43#include <linux/pci.h>
44
45/*
46 * UMC capability IDs.
47 *
48 * 0x00 is reserved so use it for the radio controller device.
49 *
50 * [WHCI] table 2-8
51 */
52#define UMC_CAP_ID_WHCI_RC 0x00 /* radio controller */
53#define UMC_CAP_ID_WHCI_WUSB_HC 0x01 /* WUSB host controller */
54
55/**
56 * struct umc_dev - UMC capability device
57 *
58 * @version: version of the specification this capability conforms to.
59 * @cap_id: capability ID.
60 * @bar: PCI Bar (64 bit) where the resource lies
61 * @resource: register space resource.
62 * @irq: interrupt line.
63 */
64struct umc_dev {
65 u16 version;
66 u8 cap_id;
67 u8 bar;
68 struct resource resource;
69 unsigned irq;
70 struct device dev;
71};
72
73#define to_umc_dev(d) container_of(d, struct umc_dev, dev)
74
75/**
76 * struct umc_driver - UMC capability driver
77 * @cap_id: supported capability ID.
78 * @match: driver specific capability matching function.
79 * @match_data: driver specific data for match() (e.g., a
80 * table of pci_device_id's if umc_match_pci_id() is used).
81 */
82struct umc_driver {
83 char *name;
84 u8 cap_id;
85 int (*match)(struct umc_driver *, struct umc_dev *);
86 const void *match_data;
87
88 int (*probe)(struct umc_dev *);
89 void (*remove)(struct umc_dev *);
90 int (*suspend)(struct umc_dev *, pm_message_t state);
91 int (*resume)(struct umc_dev *);
92
93 struct device_driver driver;
94};
95
96#define to_umc_driver(d) container_of(d, struct umc_driver, driver)
97
98extern struct bus_type umc_bus_type;
99
100struct umc_dev *umc_device_create(struct device *parent, int n);
101int __must_check umc_device_register(struct umc_dev *umc);
102void umc_device_unregister(struct umc_dev *umc);
103
104int __must_check __umc_driver_register(struct umc_driver *umc_drv,
105 struct module *mod,
106 const char *mod_name);
107
108/**
109 * umc_driver_register - register a UMC capabiltity driver.
110 * @umc_drv: pointer to the driver.
111 */
112static inline int __must_check umc_driver_register(struct umc_driver *umc_drv)
113{
114 return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME);
115}
116void umc_driver_unregister(struct umc_driver *umc_drv);
117
118/*
119 * Utility function you can use to match (umc_driver->match) against a
120 * null-terminated array of 'struct pci_device_id' in
121 * umc_driver->match_data.
122 */
123int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc);
124
125/**
126 * umc_parent_pci_dev - return the UMC's parent PCI device or NULL if none
127 * @umc_dev: UMC device whose parent PCI device we are looking for
128 *
129 * DIRTY!!! DON'T RELY ON THIS
130 *
131 * FIXME: This is as dirty as it gets, but we need some way to check
132 * the correct type of umc_dev->parent (so that for example, we can
133 * cast to pci_dev). Casting to pci_dev is necesary because at some
134 * point we need to request resources from the device. Mapping is
135 * easily over come (ioremap and stuff are bus agnostic), but hooking
136 * up to some error handlers (such as pci error handlers) might need
137 * this.
138 *
139 * THIS might (probably will) be removed in the future, so don't count
140 * on it.
141 */
142static inline struct pci_dev *umc_parent_pci_dev(struct umc_dev *umc_dev)
143{
144 struct pci_dev *pci_dev = NULL;
145 if (umc_dev->dev.parent->bus == &pci_bus_type)
146 pci_dev = to_pci_dev(umc_dev->dev.parent);
147 return pci_dev;
148}
149
150/**
151 * umc_dev_get() - reference a UMC device.
152 * @umc_dev: Pointer to UMC device.
153 *
154 * NOTE: we are assuming in this whole scheme that the parent device
155 * is referenced at _probe() time and unreferenced at _remove()
156 * time by the parent's subsystem.
157 */
158static inline struct umc_dev *umc_dev_get(struct umc_dev *umc_dev)
159{
160 get_device(&umc_dev->dev);
161 return umc_dev;
162}
163
164/**
165 * umc_dev_put() - unreference a UMC device.
166 * @umc_dev: Pointer to UMC device.
167 */
168static inline void umc_dev_put(struct umc_dev *umc_dev)
169{
170 put_device(&umc_dev->dev);
171}
172
173/**
174 * umc_set_drvdata - set UMC device's driver data.
175 * @umc_dev: Pointer to UMC device.
176 * @data: Data to set.
177 */
178static inline void umc_set_drvdata(struct umc_dev *umc_dev, void *data)
179{
180 dev_set_drvdata(&umc_dev->dev, data);
181}
182
183/**
184 * umc_get_drvdata - recover UMC device's driver data.
185 * @umc_dev: Pointer to UMC device.
186 */
187static inline void *umc_get_drvdata(struct umc_dev *umc_dev)
188{
189 return dev_get_drvdata(&umc_dev->dev);
190}
191
192int umc_controller_reset(struct umc_dev *umc);
193
194#endif /* #ifndef _LINUX_UWB_UMC_H_ */
diff --git a/include/linux/uwb/whci.h b/include/linux/uwb/whci.h
new file mode 100644
index 000000000000..915ec23042d4
--- /dev/null
+++ b/include/linux/uwb/whci.h
@@ -0,0 +1,117 @@
1/*
2 * Wireless Host Controller Interface for Ultra-Wide-Band and Wireless USB
3 *
4 * Copyright (C) 2005-2006 Intel Corporation
5 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
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 version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA.
20 *
21 *
22 *
23 * References:
24 * [WHCI] Wireless Host Controller Interface Specification for
25 * Certified Wireless Universal Serial Bus, revision 0.95.
26 */
27#ifndef _LINUX_UWB_WHCI_H_
28#define _LINUX_UWB_WHCI_H_
29
30#include <linux/pci.h>
31
32/*
33 * UWB interface capability registers (offsets from UWBBASE)
34 *
35 * [WHCI] section 2.2
36 */
37#define UWBCAPINFO 0x00 /* == UWBCAPDATA(0) */
38# define UWBCAPINFO_TO_N_CAPS(c) (((c) >> 0) & 0xFull)
39#define UWBCAPDATA(n) (8*(n))
40# define UWBCAPDATA_TO_VERSION(c) (((c) >> 32) & 0xFFFFull)
41# define UWBCAPDATA_TO_OFFSET(c) (((c) >> 18) & 0x3FFFull)
42# define UWBCAPDATA_TO_BAR(c) (((c) >> 16) & 0x3ull)
43# define UWBCAPDATA_TO_SIZE(c) ((((c) >> 8) & 0xFFull) * sizeof(u32))
44# define UWBCAPDATA_TO_CAP_ID(c) (((c) >> 0) & 0xFFull)
45
46/* Size of the WHCI capability data (including the RC capability) for
47 a device with n capabilities. */
48#define UWBCAPDATA_SIZE(n) (8 + 8*(n))
49
50
51/*
52 * URC registers (offsets from URCBASE)
53 *
54 * [WHCI] section 2.3
55 */
56#define URCCMD 0x00
57# define URCCMD_RESET (1 << 31) /* UMC Hardware reset */
58# define URCCMD_RS (1 << 30) /* Run/Stop */
59# define URCCMD_EARV (1 << 29) /* Event Address Register Valid */
60# define URCCMD_ACTIVE (1 << 15) /* Command is active */
61# define URCCMD_IWR (1 << 14) /* Interrupt When Ready */
62# define URCCMD_SIZE_MASK 0x00000fff /* Command size mask */
63#define URCSTS 0x04
64# define URCSTS_EPS (1 << 17) /* Event Processing Status */
65# define URCSTS_HALTED (1 << 16) /* RC halted */
66# define URCSTS_HSE (1 << 10) /* Host System Error...fried */
67# define URCSTS_ER (1 << 9) /* Event Ready */
68# define URCSTS_RCI (1 << 8) /* Ready for Command Interrupt */
69# define URCSTS_INT_MASK 0x00000700 /* URC interrupt sources */
70# define URCSTS_ISI 0x000000ff /* Interrupt Source Identification */
71#define URCINTR 0x08
72# define URCINTR_EN_ALL 0x000007ff /* Enable all interrupt sources */
73#define URCCMDADDR 0x10
74#define URCEVTADDR 0x18
75# define URCEVTADDR_OFFSET_MASK 0xfff /* Event pointer offset mask */
76
77
78/** Write 32 bit @value to little endian register at @addr */
79static inline
80void le_writel(u32 value, void __iomem *addr)
81{
82 iowrite32(value, addr);
83}
84
85
86/** Read from 32 bit little endian register at @addr */
87static inline
88u32 le_readl(void __iomem *addr)
89{
90 return ioread32(addr);
91}
92
93
94/** Write 64 bit @value to little endian register at @addr */
95static inline
96void le_writeq(u64 value, void __iomem *addr)
97{
98 iowrite32(value, addr);
99 iowrite32(value >> 32, addr + 4);
100}
101
102
103/** Read from 64 bit little endian register at @addr */
104static inline
105u64 le_readq(void __iomem *addr)
106{
107 u64 value;
108 value = ioread32(addr);
109 value |= (u64)ioread32(addr + 4) << 32;
110 return value;
111}
112
113extern int whci_wait_for(struct device *dev, u32 __iomem *reg,
114 u32 mask, u32 result,
115 unsigned long max_ms, const char *tag);
116
117#endif /* #ifndef _LINUX_UWB_WHCI_H_ */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 303d93ffd6b2..4669d7e72e75 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -315,6 +315,13 @@ struct v4l2_pix_format {
315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
317#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 317#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
318/*
319 * 10bit raw bayer, expanded to 16 bits
320 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
321 */
322#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0')
323/* 10bit raw bayer DPCM compressed to 8 bits */
324#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
318#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ 325#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
319 326
320/* compressed formats */ 327/* compressed formats */
@@ -910,6 +917,8 @@ enum v4l2_mpeg_audio_encoding {
910 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, 917 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
911 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, 918 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
912 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, 919 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
920 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
921 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
913}; 922};
914#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) 923#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
915enum v4l2_mpeg_audio_l1_bitrate { 924enum v4l2_mpeg_audio_l1_bitrate {
@@ -988,12 +997,36 @@ enum v4l2_mpeg_audio_crc {
988 V4L2_MPEG_AUDIO_CRC_CRC16 = 1, 997 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
989}; 998};
990#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) 999#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
1000#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
1001#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
1002enum v4l2_mpeg_audio_ac3_bitrate {
1003 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
1004 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
1005 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
1006 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
1007 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
1008 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
1009 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
1010 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
1011 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
1012 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
1013 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
1014 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
1015 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
1016 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
1017 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
1018 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
1019 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
1020 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1021 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1022};
991 1023
992/* MPEG video */ 1024/* MPEG video */
993#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1025#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
994enum v4l2_mpeg_video_encoding { 1026enum v4l2_mpeg_video_encoding {
995 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, 1027 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
996 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, 1028 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
1029 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
997}; 1030};
998#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) 1031#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
999enum v4l2_mpeg_video_aspect { 1032enum v4l2_mpeg_video_aspect {
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 328eb4022727..307b88577eaa 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -2,6 +2,7 @@
2#define _LINUX_VMALLOC_H 2#define _LINUX_VMALLOC_H
3 3
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/init.h>
5#include <asm/page.h> /* pgprot_t */ 6#include <asm/page.h> /* pgprot_t */
6 7
7struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 8struct vm_area_struct; /* vma defining user mapping in mm_types.h */
@@ -23,7 +24,6 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
23#endif 24#endif
24 25
25struct vm_struct { 26struct vm_struct {
26 /* keep next,addr,size together to speedup lookups */
27 struct vm_struct *next; 27 struct vm_struct *next;
28 void *addr; 28 void *addr;
29 unsigned long size; 29 unsigned long size;
@@ -37,6 +37,19 @@ struct vm_struct {
37/* 37/*
38 * Highlevel APIs for driver use 38 * Highlevel APIs for driver use
39 */ 39 */
40extern void vm_unmap_ram(const void *mem, unsigned int count);
41extern void *vm_map_ram(struct page **pages, unsigned int count,
42 int node, pgprot_t prot);
43extern void vm_unmap_aliases(void);
44
45#ifdef CONFIG_MMU
46extern void __init vmalloc_init(void);
47#else
48static inline void vmalloc_init(void)
49{
50}
51#endif
52
40extern void *vmalloc(unsigned long size); 53extern void *vmalloc(unsigned long size);
41extern void *vmalloc_user(unsigned long size); 54extern void *vmalloc_user(unsigned long size);
42extern void *vmalloc_node(unsigned long size, int node); 55extern void *vmalloc_node(unsigned long size, int node);
@@ -90,6 +103,4 @@ extern void free_vm_area(struct vm_struct *area);
90extern rwlock_t vmlist_lock; 103extern rwlock_t vmlist_lock;
91extern struct vm_struct *vmlist; 104extern struct vm_struct *vmlist;
92 105
93extern const struct seq_operations vmalloc_op;
94
95#endif /* _LINUX_VMALLOC_H */ 106#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 58334d439516..524cd1b28ecb 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -41,13 +41,19 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
41#ifdef CONFIG_HUGETLB_PAGE 41#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif 43#endif
44#ifdef CONFIG_UNEVICTABLE_LRU
45 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */
46 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */
47 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */
48 UNEVICTABLE_PGMLOCKED,
49 UNEVICTABLE_PGMUNLOCKED,
50 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
51 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
52 UNEVICTABLE_MLOCKFREED,
53#endif
44 NR_VM_EVENT_ITEMS 54 NR_VM_EVENT_ITEMS
45}; 55};
46 56
47extern const struct seq_operations fragmentation_op;
48extern const struct seq_operations pagetypeinfo_op;
49extern const struct seq_operations zoneinfo_op;
50extern const struct seq_operations vmstat_op;
51extern int sysctl_stat_interval; 57extern int sysctl_stat_interval;
52 58
53#ifdef CONFIG_VM_EVENT_COUNTERS 59#ifdef CONFIG_VM_EVENT_COUNTERS
@@ -159,6 +165,16 @@ static inline unsigned long zone_page_state(struct zone *zone,
159 return x; 165 return x;
160} 166}
161 167
168extern unsigned long global_lru_pages(void);
169
170static inline unsigned long zone_lru_pages(struct zone *zone)
171{
172 return (zone_page_state(zone, NR_ACTIVE_ANON)
173 + zone_page_state(zone, NR_ACTIVE_FILE)
174 + zone_page_state(zone, NR_INACTIVE_ANON)
175 + zone_page_state(zone, NR_INACTIVE_FILE));
176}
177
162#ifdef CONFIG_NUMA 178#ifdef CONFIG_NUMA
163/* 179/*
164 * Determine the per node value of a stat item. This function 180 * Determine the per node value of a stat item. This function
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 1cbd0a7db4e6..2f1113467f70 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -96,7 +96,7 @@ void change_console(struct vc_data *new_vc);
96void reset_vc(struct vc_data *vc); 96void reset_vc(struct vc_data *vc);
97extern int unbind_con_driver(const struct consw *csw, int first, int last, 97extern int unbind_con_driver(const struct consw *csw, int first, int last,
98 int deflt); 98 int deflt);
99int vty_init(void); 99int vty_init(const struct file_operations *console_fops);
100 100
101/* 101/*
102 * vc_screen.c shares this temporary buffer with the console write code so that 102 * vc_screen.c shares this temporary buffer with the console write code so that
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 0081147a9fe8..ef609f842fac 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -108,15 +108,6 @@ static inline int waitqueue_active(wait_queue_head_t *q)
108 return !list_empty(&q->task_list); 108 return !list_empty(&q->task_list);
109} 109}
110 110
111/*
112 * Used to distinguish between sync and async io wait context:
113 * sync i/o typically specifies a NULL wait queue entry or a wait
114 * queue entry bound to a task (current task) to wake up.
115 * aio specifies a wait queue entry with an async notification
116 * callback routine, not associated with any task.
117 */
118#define is_sync_wait(wait) (!(wait) || ((wait)->private))
119
120extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 111extern void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
121extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait); 112extern void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait);
122extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait); 113extern void remove_wait_queue(wait_queue_head_t *q, wait_queue_t *wait);
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
new file mode 100644
index 000000000000..033545e145c7
--- /dev/null
+++ b/include/linux/wlp.h
@@ -0,0 +1,735 @@
1/*
2 * WiMedia Logical Link Control Protocol (WLP)
3 *
4 * Copyright (C) 2005-2006 Intel Corporation
5 * Reinette Chatre <reinette.chatre@intel.com>
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 version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA.
20 *
21 *
22 * FIXME: docs
23 *
24 * - Does not (yet) include support for WLP control frames
25 * WLP Draft 0.99 [6.5].
26 *
27 * A visual representation of the data structures.
28 *
29 * wssidB wssidB
30 * ^ ^
31 * | |
32 * wssidA wssidA
33 * wlp interface { ^ ^
34 * ... | |
35 * ... ... wssid wssid ...
36 * wlp --- ... | |
37 * }; neighbors --> neighbA --> neighbB
38 * ...
39 * wss
40 * ...
41 * eda cache --> neighborA --> neighborB --> neighborC ...
42 */
43
44#ifndef __LINUX__WLP_H_
45#define __LINUX__WLP_H_
46
47#include <linux/netdevice.h>
48#include <linux/skbuff.h>
49#include <linux/list.h>
50#include <linux/uwb.h>
51
52/**
53 * WLP Protocol ID
54 * WLP Draft 0.99 [6.2]
55 *
56 * The MUX header for all WLP frames
57 */
58#define WLP_PROTOCOL_ID 0x0100
59
60/**
61 * WLP Version
62 * WLP version placed in the association frames (WLP 0.99 [6.6])
63 */
64#define WLP_VERSION 0x10
65
66/**
67 * Bytes needed to print UUID as string
68 */
69#define WLP_WSS_UUID_STRSIZE 48
70
71/**
72 * Bytes needed to print nonce as string
73 */
74#define WLP_WSS_NONCE_STRSIZE 48
75
76
77/**
78 * Size used for WLP name size
79 *
80 * The WSS name is set to 65 bytes, 1 byte larger than the maximum
81 * allowed by the WLP spec. This is to have a null terminated string
82 * for display to the user. A maximum of 64 bytes will still be used
83 * when placing the WSS name field in association frames.
84 */
85#define WLP_WSS_NAME_SIZE 65
86
87/**
88 * Number of bytes added by WLP to data frame
89 *
90 * A data frame transmitted from a host will be placed in a Standard or
91 * Abbreviated WLP frame. These have an extra 4 bytes of header (struct
92 * wlp_frame_std_abbrv_hdr).
93 * When the stack sends this data frame for transmission it needs to ensure
94 * there is enough headroom for this header.
95 */
96#define WLP_DATA_HLEN 4
97
98/**
99 * State of device regarding WLP Service Set
100 *
101 * WLP_WSS_STATE_NONE: the host does not participate in any WSS
102 * WLP_WSS_STATE_PART_ENROLLED: used as part of the enrollment sequence
103 * ("Partial Enroll"). This state is used to
104 * indicate the first part of enrollment that is
105 * unsecure. If the WSS is unsecure then the
106 * state will promptly go to WLP_WSS_STATE_ENROLLED,
107 * if the WSS is not secure then the enrollment
108 * procedure is a few more steps before we are
109 * enrolled.
110 * WLP_WSS_STATE_ENROLLED: the host is enrolled in a WSS
111 * WLP_WSS_STATE_ACTIVE: WSS is activated
112 * WLP_WSS_STATE_CONNECTED: host is connected to neighbor in WSS
113 *
114 */
115enum wlp_wss_state {
116 WLP_WSS_STATE_NONE = 0,
117 WLP_WSS_STATE_PART_ENROLLED,
118 WLP_WSS_STATE_ENROLLED,
119 WLP_WSS_STATE_ACTIVE,
120 WLP_WSS_STATE_CONNECTED,
121};
122
123/**
124 * WSS Secure status
125 * WLP 0.99 Table 6
126 *
127 * Set to one if the WSS is secure, zero if it is not secure
128 */
129enum wlp_wss_sec_status {
130 WLP_WSS_UNSECURE = 0,
131 WLP_WSS_SECURE,
132};
133
134/**
135 * WLP frame type
136 * WLP Draft 0.99 [6.2 Table 1]
137 */
138enum wlp_frame_type {
139 WLP_FRAME_STANDARD = 0,
140 WLP_FRAME_ABBREVIATED,
141 WLP_FRAME_CONTROL,
142 WLP_FRAME_ASSOCIATION,
143};
144
145/**
146 * WLP Association Message Type
147 * WLP Draft 0.99 [6.6.1.2 Table 8]
148 */
149enum wlp_assoc_type {
150 WLP_ASSOC_D1 = 2,
151 WLP_ASSOC_D2 = 3,
152 WLP_ASSOC_M1 = 4,
153 WLP_ASSOC_M2 = 5,
154 WLP_ASSOC_M3 = 7,
155 WLP_ASSOC_M4 = 8,
156 WLP_ASSOC_M5 = 9,
157 WLP_ASSOC_M6 = 10,
158 WLP_ASSOC_M7 = 11,
159 WLP_ASSOC_M8 = 12,
160 WLP_ASSOC_F0 = 14,
161 WLP_ASSOC_E1 = 32,
162 WLP_ASSOC_E2 = 33,
163 WLP_ASSOC_C1 = 34,
164 WLP_ASSOC_C2 = 35,
165 WLP_ASSOC_C3 = 36,
166 WLP_ASSOC_C4 = 37,
167};
168
169/**
170 * WLP Attribute Type
171 * WLP Draft 0.99 [6.6.1 Table 6]
172 */
173enum wlp_attr_type {
174 WLP_ATTR_AUTH = 0x1005, /* Authenticator */
175 WLP_ATTR_DEV_NAME = 0x1011, /* Device Name */
176 WLP_ATTR_DEV_PWD_ID = 0x1012, /* Device Password ID */
177 WLP_ATTR_E_HASH1 = 0x1014, /* E-Hash1 */
178 WLP_ATTR_E_HASH2 = 0x1015, /* E-Hash2 */
179 WLP_ATTR_E_SNONCE1 = 0x1016, /* E-SNonce1 */
180 WLP_ATTR_E_SNONCE2 = 0x1017, /* E-SNonce2 */
181 WLP_ATTR_ENCR_SET = 0x1018, /* Encrypted Settings */
182 WLP_ATTR_ENRL_NONCE = 0x101A, /* Enrollee Nonce */
183 WLP_ATTR_KEYWRAP_AUTH = 0x101E, /* Key Wrap Authenticator */
184 WLP_ATTR_MANUF = 0x1021, /* Manufacturer */
185 WLP_ATTR_MSG_TYPE = 0x1022, /* Message Type */
186 WLP_ATTR_MODEL_NAME = 0x1023, /* Model Name */
187 WLP_ATTR_MODEL_NR = 0x1024, /* Model Number */
188 WLP_ATTR_PUB_KEY = 0x1032, /* Public Key */
189 WLP_ATTR_REG_NONCE = 0x1039, /* Registrar Nonce */
190 WLP_ATTR_R_HASH1 = 0x103D, /* R-Hash1 */
191 WLP_ATTR_R_HASH2 = 0x103E, /* R-Hash2 */
192 WLP_ATTR_R_SNONCE1 = 0x103F, /* R-SNonce1 */
193 WLP_ATTR_R_SNONCE2 = 0x1040, /* R-SNonce2 */
194 WLP_ATTR_SERIAL = 0x1042, /* Serial number */
195 WLP_ATTR_UUID_E = 0x1047, /* UUID-E */
196 WLP_ATTR_UUID_R = 0x1048, /* UUID-R */
197 WLP_ATTR_PRI_DEV_TYPE = 0x1054, /* Primary Device Type */
198 WLP_ATTR_SEC_DEV_TYPE = 0x1055, /* Secondary Device Type */
199 WLP_ATTR_PORT_DEV = 0x1056, /* Portable Device */
200 WLP_ATTR_APP_EXT = 0x1058, /* Application Extension */
201 WLP_ATTR_WLP_VER = 0x2000, /* WLP Version */
202 WLP_ATTR_WSSID = 0x2001, /* WSSID */
203 WLP_ATTR_WSS_NAME = 0x2002, /* WSS Name */
204 WLP_ATTR_WSS_SEC_STAT = 0x2003, /* WSS Secure Status */
205 WLP_ATTR_WSS_BCAST = 0x2004, /* WSS Broadcast Address */
206 WLP_ATTR_WSS_M_KEY = 0x2005, /* WSS Master Key */
207 WLP_ATTR_ACC_ENRL = 0x2006, /* Accepting Enrollment */
208 WLP_ATTR_WSS_INFO = 0x2007, /* WSS Information */
209 WLP_ATTR_WSS_SEL_MTHD = 0x2008, /* WSS Selection Method */
210 WLP_ATTR_ASSC_MTHD_LIST = 0x2009, /* Association Methods List */
211 WLP_ATTR_SEL_ASSC_MTHD = 0x200A, /* Selected Association Method */
212 WLP_ATTR_ENRL_HASH_COMM = 0x200B, /* Enrollee Hash Commitment */
213 WLP_ATTR_WSS_TAG = 0x200C, /* WSS Tag */
214 WLP_ATTR_WSS_VIRT = 0x200D, /* WSS Virtual EUI-48 */
215 WLP_ATTR_WLP_ASSC_ERR = 0x200E, /* WLP Association Error */
216 WLP_ATTR_VNDR_EXT = 0x200F, /* Vendor Extension */
217};
218
219/**
220 * WLP Category ID of primary/secondary device
221 * WLP Draft 0.99 [6.6.1.8 Table 12]
222 */
223enum wlp_dev_category_id {
224 WLP_DEV_CAT_COMPUTER = 1,
225 WLP_DEV_CAT_INPUT,
226 WLP_DEV_CAT_PRINT_SCAN_FAX_COPIER,
227 WLP_DEV_CAT_CAMERA,
228 WLP_DEV_CAT_STORAGE,
229 WLP_DEV_CAT_INFRASTRUCTURE,
230 WLP_DEV_CAT_DISPLAY,
231 WLP_DEV_CAT_MULTIM,
232 WLP_DEV_CAT_GAMING,
233 WLP_DEV_CAT_TELEPHONE,
234 WLP_DEV_CAT_OTHER = 65535,
235};
236
237/**
238 * WLP WSS selection method
239 * WLP Draft 0.99 [6.6.1.6 Table 10]
240 */
241enum wlp_wss_sel_mthd {
242 WLP_WSS_ENRL_SELECT = 1, /* Enrollee selects */
243 WLP_WSS_REG_SELECT, /* Registrar selects */
244};
245
246/**
247 * WLP association error values
248 * WLP Draft 0.99 [6.6.1.5 Table 9]
249 */
250enum wlp_assc_error {
251 WLP_ASSOC_ERROR_NONE,
252 WLP_ASSOC_ERROR_AUTH, /* Authenticator Failure */
253 WLP_ASSOC_ERROR_ROGUE, /* Rogue activity suspected */
254 WLP_ASSOC_ERROR_BUSY, /* Device busy */
255 WLP_ASSOC_ERROR_LOCK, /* Setup Locked */
256 WLP_ASSOC_ERROR_NOT_READY, /* Registrar not ready */
257 WLP_ASSOC_ERROR_INV, /* Invalid WSS selection */
258 WLP_ASSOC_ERROR_MSG_TIME, /* Message timeout */
259 WLP_ASSOC_ERROR_ENR_TIME, /* Enrollment session timeout */
260 WLP_ASSOC_ERROR_PW, /* Device password invalid */
261 WLP_ASSOC_ERROR_VER, /* Unsupported version */
262 WLP_ASSOC_ERROR_INT, /* Internal error */
263 WLP_ASSOC_ERROR_UNDEF, /* Undefined error */
264 WLP_ASSOC_ERROR_NUM, /* Numeric comparison failure */
265 WLP_ASSOC_ERROR_WAIT, /* Waiting for user input */
266};
267
268/**
269 * WLP Parameters
270 * WLP 0.99 [7.7]
271 */
272enum wlp_parameters {
273 WLP_PER_MSG_TIMEOUT = 15, /* Seconds to wait for response to
274 association message. */
275};
276
277/**
278 * WLP IE
279 *
280 * The WLP IE should be included in beacons by all devices.
281 *
282 * The driver can set only a few of the fields in this information element,
283 * most fields are managed by the device self. When the driver needs to set
284 * a field it will only provide values for the fields of interest, the rest
285 * will be filled with zeroes. The fields of interest are:
286 *
287 * Element ID
288 * Length
289 * Capabilities (only to include WSSID Hash list length)
290 * WSSID Hash List fields
291 *
292 * WLP 0.99 [6.7]
293 *
294 * Only the fields that will be used are detailed in this structure, rest
295 * are not detailed or marked as "notused".
296 */
297struct wlp_ie {
298 struct uwb_ie_hdr hdr;
299 __le16 capabilities;
300 __le16 cycle_param;
301 __le16 acw_anchor_addr;
302 u8 wssid_hash_list[];
303} __attribute__((packed));
304
305static inline int wlp_ie_hash_length(struct wlp_ie *ie)
306{
307 return (le16_to_cpu(ie->capabilities) >> 12) & 0xf;
308}
309
310static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length)
311{
312 u16 caps = le16_to_cpu(ie->capabilities);
313 caps = (caps & ~(0xf << 12)) | (hash_length << 12);
314 ie->capabilities = cpu_to_le16(caps);
315}
316
317/**
318 * WLP nonce
319 * WLP Draft 0.99 [6.6.1 Table 6]
320 *
321 * A 128-bit random number often used (E-SNonce1, E-SNonce2, Enrollee
322 * Nonce, Registrar Nonce, R-SNonce1, R-SNonce2). It is passed to HW so
323 * it is packed.
324 */
325struct wlp_nonce {
326 u8 data[16];
327} __attribute__((packed));
328
329/**
330 * WLP UUID
331 * WLP Draft 0.99 [6.6.1 Table 6]
332 *
333 * Universally Unique Identifier (UUID) encoded as an octet string in the
334 * order the octets are shown in string representation in RFC4122. A UUID
335 * is often used (UUID-E, UUID-R, WSSID). It is passed to HW so it is packed.
336 */
337struct wlp_uuid {
338 u8 data[16];
339} __attribute__((packed));
340
341
342/**
343 * Primary and secondary device type attributes
344 * WLP Draft 0.99 [6.6.1.8]
345 */
346struct wlp_dev_type {
347 enum wlp_dev_category_id category:16;
348 u8 OUI[3];
349 u8 OUIsubdiv;
350 __le16 subID;
351} __attribute__((packed));
352
353/**
354 * WLP frame header
355 * WLP Draft 0.99 [6.2]
356 */
357struct wlp_frame_hdr {
358 __le16 mux_hdr; /* WLP_PROTOCOL_ID */
359 enum wlp_frame_type type:8;
360} __attribute__((packed));
361
362/**
363 * WLP attribute field header
364 * WLP Draft 0.99 [6.6.1]
365 *
366 * Header of each attribute found in an association frame
367 */
368struct wlp_attr_hdr {
369 __le16 type;
370 __le16 length;
371} __attribute__((packed));
372
373/**
374 * Device information commonly used together
375 *
376 * Each of these device information elements has a specified range in which it
377 * should fit (WLP 0.99 [Table 6]). This range provided in the spec does not
378 * include the termination null '\0' character (when used in the
379 * association protocol the attribute fields are accompanied
380 * with a "length" field so the full range from the spec can be used for
381 * the value). We thus allocate an extra byte to be able to store a string
382 * of max length with a terminating '\0'.
383 */
384struct wlp_device_info {
385 char name[33];
386 char model_name[33];
387 char manufacturer[65];
388 char model_nr[33];
389 char serial[33];
390 struct wlp_dev_type prim_dev_type;
391};
392
393/**
394 * Macros for the WLP attributes
395 *
396 * There are quite a few attributes (total is 43). The attribute layout can be
397 * in one of three categories: one value, an array, an enum forced to 8 bits.
398 * These macros help with their definitions.
399 */
400#define wlp_attr(type, name) \
401struct wlp_attr_##name { \
402 struct wlp_attr_hdr hdr; \
403 type name; \
404} __attribute__((packed));
405
406#define wlp_attr_array(type, name) \
407struct wlp_attr_##name { \
408 struct wlp_attr_hdr hdr; \
409 type name[]; \
410} __attribute__((packed));
411
412/**
413 * WLP association attribute fields
414 * WLP Draft 0.99 [6.6.1 Table 6]
415 *
416 * Attributes appear in same order as the Table in the spec
417 * FIXME Does not define all attributes yet
418 */
419
420/* Device name: Friendly name of sending device */
421wlp_attr_array(u8, dev_name)
422
423/* Enrollee Nonce: Random number generated by enrollee for an enrollment
424 * session */
425wlp_attr(struct wlp_nonce, enonce)
426
427/* Manufacturer name: Name of manufacturer of the sending device */
428wlp_attr_array(u8, manufacturer)
429
430/* WLP Message Type */
431wlp_attr(u8, msg_type)
432
433/* WLP Model name: Model name of sending device */
434wlp_attr_array(u8, model_name)
435
436/* WLP Model number: Model number of sending device */
437wlp_attr_array(u8, model_nr)
438
439/* Registrar Nonce: Random number generated by registrar for an enrollment
440 * session */
441wlp_attr(struct wlp_nonce, rnonce)
442
443/* Serial number of device */
444wlp_attr_array(u8, serial)
445
446/* UUID of enrollee */
447wlp_attr(struct wlp_uuid, uuid_e)
448
449/* UUID of registrar */
450wlp_attr(struct wlp_uuid, uuid_r)
451
452/* WLP Primary device type */
453wlp_attr(struct wlp_dev_type, prim_dev_type)
454
455/* WLP Secondary device type */
456wlp_attr(struct wlp_dev_type, sec_dev_type)
457
458/* WLP protocol version */
459wlp_attr(u8, version)
460
461/* WLP service set identifier */
462wlp_attr(struct wlp_uuid, wssid)
463
464/* WLP WSS name */
465wlp_attr_array(u8, wss_name)
466
467/* WLP WSS Secure Status */
468wlp_attr(u8, wss_sec_status)
469
470/* WSS Broadcast Address */
471wlp_attr(struct uwb_mac_addr, wss_bcast)
472
473/* WLP Accepting Enrollment */
474wlp_attr(u8, accept_enrl)
475
476/**
477 * WSS information attributes
478 * WLP Draft 0.99 [6.6.3 Table 15]
479 */
480struct wlp_wss_info {
481 struct wlp_attr_wssid wssid;
482 struct wlp_attr_wss_name name;
483 struct wlp_attr_accept_enrl accept;
484 struct wlp_attr_wss_sec_status sec_stat;
485 struct wlp_attr_wss_bcast bcast;
486} __attribute__((packed));
487
488/* WLP WSS Information */
489wlp_attr_array(struct wlp_wss_info, wss_info)
490
491/* WLP WSS Selection method */
492wlp_attr(u8, wss_sel_mthd)
493
494/* WLP WSS tag */
495wlp_attr(u8, wss_tag)
496
497/* WSS Virtual Address */
498wlp_attr(struct uwb_mac_addr, wss_virt)
499
500/* WLP association error */
501wlp_attr(u8, wlp_assc_err)
502
503/**
504 * WLP standard and abbreviated frames
505 *
506 * WLP Draft 0.99 [6.3] and [6.4]
507 *
508 * The difference between the WLP standard frame and the WLP
509 * abbreviated frame is that the standard frame includes the src
510 * and dest addresses from the Ethernet header, the abbreviated frame does
511 * not.
512 * The src/dest (as well as the type/length and client data) are already
513 * defined as part of the Ethernet header, we do not do this here.
514 * From this perspective the standard and abbreviated frames appear the
515 * same - they will be treated differently though.
516 *
517 * The size of this header is also captured in WLP_DATA_HLEN to enable
518 * interfaces to prepare their headroom.
519 */
520struct wlp_frame_std_abbrv_hdr {
521 struct wlp_frame_hdr hdr;
522 u8 tag;
523} __attribute__((packed));
524
525/**
526 * WLP association frames
527 *
528 * WLP Draft 0.99 [6.6]
529 */
530struct wlp_frame_assoc {
531 struct wlp_frame_hdr hdr;
532 enum wlp_assoc_type type:8;
533 struct wlp_attr_version version;
534 struct wlp_attr_msg_type msg_type;
535 u8 attr[];
536} __attribute__((packed));
537
538/* Ethernet to dev address mapping */
539struct wlp_eda {
540 spinlock_t lock;
541 struct list_head cache; /* Eth<->Dev Addr cache */
542};
543
544/**
545 * WSS information temporary storage
546 *
547 * This information is only stored temporarily during discovery. It should
548 * not be stored unless the device is enrolled in the advertised WSS. This
549 * is done mainly because we follow the letter of the spec in this regard.
550 * See WLP 0.99 [7.2.3].
551 * When the device does become enrolled in a WSS the WSS information will
552 * be stored as part of the more comprehensive struct wlp_wss.
553 */
554struct wlp_wss_tmp_info {
555 char name[WLP_WSS_NAME_SIZE];
556 u8 accept_enroll;
557 u8 sec_status;
558 struct uwb_mac_addr bcast;
559};
560
561struct wlp_wssid_e {
562 struct list_head node;
563 struct wlp_uuid wssid;
564 struct wlp_wss_tmp_info *info;
565};
566
567/**
568 * A cache entry of WLP neighborhood
569 *
570 * @node: head of list is wlp->neighbors
571 * @wssid: list of wssids of this neighbor, element is wlp_wssid_e
572 * @info: temporary storage for information learned during discovery. This
573 * storage is used together with the wssid_e temporary storage
574 * during discovery.
575 */
576struct wlp_neighbor_e {
577 struct list_head node;
578 struct wlp_uuid uuid;
579 struct uwb_dev *uwb_dev;
580 struct list_head wssid; /* Elements are wlp_wssid_e */
581 struct wlp_device_info *info;
582};
583
584struct wlp;
585/**
586 * Information for an association session in progress.
587 *
588 * @exp_message: The type of the expected message. Both this message and a
589 * F0 message (which can be sent in response to any
590 * association frame) will be accepted as a valid message for
591 * this session.
592 * @cb: The function that will be called upon receipt of this
593 * message.
594 * @cb_priv: Private data of callback
595 * @data: Data used in association process (always a sk_buff?)
596 * @neighbor: Address of neighbor with which association session is in
597 * progress.
598 */
599struct wlp_session {
600 enum wlp_assoc_type exp_message;
601 void (*cb)(struct wlp *);
602 void *cb_priv;
603 void *data;
604 struct uwb_dev_addr neighbor_addr;
605};
606
607/**
608 * WLP Service Set
609 *
610 * @mutex: used to protect entire WSS structure.
611 *
612 * @name: The WSS name is set to 65 bytes, 1 byte larger than the maximum
613 * allowed by the WLP spec. This is to have a null terminated string
614 * for display to the user. A maximum of 64 bytes will still be used
615 * when placing the WSS name field in association frames.
616 *
617 * @accept_enroll: Accepting enrollment: Set to one if registrar is
618 * accepting enrollment in WSS, or zero otherwise.
619 *
620 * Global and local information for each WSS in which we are enrolled.
621 * WLP 0.99 Section 7.2.1 and Section 7.2.2
622 */
623struct wlp_wss {
624 struct mutex mutex;
625 struct kobject kobj;
626 /* Global properties. */
627 struct wlp_uuid wssid;
628 u8 hash;
629 char name[WLP_WSS_NAME_SIZE];
630 struct uwb_mac_addr bcast;
631 u8 secure_status:1;
632 u8 master_key[16];
633 /* Local properties. */
634 u8 tag;
635 struct uwb_mac_addr virtual_addr;
636 /* Extra */
637 u8 accept_enroll:1;
638 enum wlp_wss_state state;
639};
640
641/**
642 * WLP main structure
643 * @mutex: protect changes to WLP structure. We only allow changes to the
644 * uuid, so currently this mutex only protects this field.
645 */
646struct wlp {
647 struct mutex mutex;
648 struct uwb_rc *rc; /* UWB radio controller */
649 struct uwb_pal pal;
650 struct wlp_eda eda;
651 struct wlp_uuid uuid;
652 struct wlp_session *session;
653 struct wlp_wss wss;
654 struct mutex nbmutex; /* Neighbor mutex protects neighbors list */
655 struct list_head neighbors; /* Elements are wlp_neighbor_e */
656 struct uwb_notifs_handler uwb_notifs_handler;
657 struct wlp_device_info *dev_info;
658 void (*fill_device_info)(struct wlp *wlp, struct wlp_device_info *info);
659 int (*xmit_frame)(struct wlp *, struct sk_buff *,
660 struct uwb_dev_addr *);
661 void (*stop_queue)(struct wlp *);
662 void (*start_queue)(struct wlp *);
663};
664
665/* sysfs */
666
667
668struct wlp_wss_attribute {
669 struct attribute attr;
670 ssize_t (*show)(struct wlp_wss *wss, char *buf);
671 ssize_t (*store)(struct wlp_wss *wss, const char *buf, size_t count);
672};
673
674#define WSS_ATTR(_name, _mode, _show, _store) \
675static struct wlp_wss_attribute wss_attr_##_name = __ATTR(_name, _mode, \
676 _show, _store)
677
678extern int wlp_setup(struct wlp *, struct uwb_rc *);
679extern void wlp_remove(struct wlp *);
680extern ssize_t wlp_neighborhood_show(struct wlp *, char *);
681extern int wlp_wss_setup(struct net_device *, struct wlp_wss *);
682extern void wlp_wss_remove(struct wlp_wss *);
683extern ssize_t wlp_wss_activate_show(struct wlp_wss *, char *);
684extern ssize_t wlp_wss_activate_store(struct wlp_wss *, const char *, size_t);
685extern ssize_t wlp_eda_show(struct wlp *, char *);
686extern ssize_t wlp_eda_store(struct wlp *, const char *, size_t);
687extern ssize_t wlp_uuid_show(struct wlp *, char *);
688extern ssize_t wlp_uuid_store(struct wlp *, const char *, size_t);
689extern ssize_t wlp_dev_name_show(struct wlp *, char *);
690extern ssize_t wlp_dev_name_store(struct wlp *, const char *, size_t);
691extern ssize_t wlp_dev_manufacturer_show(struct wlp *, char *);
692extern ssize_t wlp_dev_manufacturer_store(struct wlp *, const char *, size_t);
693extern ssize_t wlp_dev_model_name_show(struct wlp *, char *);
694extern ssize_t wlp_dev_model_name_store(struct wlp *, const char *, size_t);
695extern ssize_t wlp_dev_model_nr_show(struct wlp *, char *);
696extern ssize_t wlp_dev_model_nr_store(struct wlp *, const char *, size_t);
697extern ssize_t wlp_dev_serial_show(struct wlp *, char *);
698extern ssize_t wlp_dev_serial_store(struct wlp *, const char *, size_t);
699extern ssize_t wlp_dev_prim_category_show(struct wlp *, char *);
700extern ssize_t wlp_dev_prim_category_store(struct wlp *, const char *,
701 size_t);
702extern ssize_t wlp_dev_prim_OUI_show(struct wlp *, char *);
703extern ssize_t wlp_dev_prim_OUI_store(struct wlp *, const char *, size_t);
704extern ssize_t wlp_dev_prim_OUI_sub_show(struct wlp *, char *);
705extern ssize_t wlp_dev_prim_OUI_sub_store(struct wlp *, const char *,
706 size_t);
707extern ssize_t wlp_dev_prim_subcat_show(struct wlp *, char *);
708extern ssize_t wlp_dev_prim_subcat_store(struct wlp *, const char *,
709 size_t);
710extern int wlp_receive_frame(struct device *, struct wlp *, struct sk_buff *,
711 struct uwb_dev_addr *);
712extern int wlp_prepare_tx_frame(struct device *, struct wlp *,
713 struct sk_buff *, struct uwb_dev_addr *);
714void wlp_reset_all(struct wlp *wlp);
715
716/**
717 * Initialize WSS
718 */
719static inline
720void wlp_wss_init(struct wlp_wss *wss)
721{
722 mutex_init(&wss->mutex);
723}
724
725static inline
726void wlp_init(struct wlp *wlp)
727{
728 INIT_LIST_HEAD(&wlp->neighbors);
729 mutex_init(&wlp->mutex);
730 mutex_init(&wlp->nbmutex);
731 wlp_wss_init(&wlp->wss);
732}
733
734
735#endif /* #ifndef __LINUX__WLP_H_ */
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
new file mode 100644
index 000000000000..9681d1ab0e4f
--- /dev/null
+++ b/include/linux/wm97xx_batt.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_WM97XX_BAT_H
2#define _LINUX_WM97XX_BAT_H
3
4#include <linux/wm97xx.h>
5
6struct wm97xx_batt_info {
7 int batt_aux;
8 int temp_aux;
9 int charge_gpio;
10 int min_voltage;
11 int max_voltage;
12 int batt_div;
13 int batt_mult;
14 int temp_div;
15 int temp_mult;
16 int batt_tech;
17 char *batt_name;
18};
19
20#ifdef CONFIG_BATTERY_WM97XX
21void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
22#else
23static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
24#endif
25
26#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 5c158c477ac7..89a5a1231ffb 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -149,11 +149,11 @@ struct execute_work {
149 149
150extern struct workqueue_struct * 150extern struct workqueue_struct *
151__create_workqueue_key(const char *name, int singlethread, 151__create_workqueue_key(const char *name, int singlethread,
152 int freezeable, struct lock_class_key *key, 152 int freezeable, int rt, struct lock_class_key *key,
153 const char *lock_name); 153 const char *lock_name);
154 154
155#ifdef CONFIG_LOCKDEP 155#ifdef CONFIG_LOCKDEP
156#define __create_workqueue(name, singlethread, freezeable) \ 156#define __create_workqueue(name, singlethread, freezeable, rt) \
157({ \ 157({ \
158 static struct lock_class_key __key; \ 158 static struct lock_class_key __key; \
159 const char *__lock_name; \ 159 const char *__lock_name; \
@@ -164,17 +164,19 @@ __create_workqueue_key(const char *name, int singlethread,
164 __lock_name = #name; \ 164 __lock_name = #name; \
165 \ 165 \
166 __create_workqueue_key((name), (singlethread), \ 166 __create_workqueue_key((name), (singlethread), \
167 (freezeable), &__key, \ 167 (freezeable), (rt), &__key, \
168 __lock_name); \ 168 __lock_name); \
169}) 169})
170#else 170#else
171#define __create_workqueue(name, singlethread, freezeable) \ 171#define __create_workqueue(name, singlethread, freezeable, rt) \
172 __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL) 172 __create_workqueue_key((name), (singlethread), (freezeable), (rt), \
173 NULL, NULL)
173#endif 174#endif
174 175
175#define create_workqueue(name) __create_workqueue((name), 0, 0) 176#define create_workqueue(name) __create_workqueue((name), 0, 0, 0)
176#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) 177#define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1)
177#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) 178#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0)
179#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0)
178 180
179extern void destroy_workqueue(struct workqueue_struct *wq); 181extern void destroy_workqueue(struct workqueue_struct *wq);
180 182
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 12b15c561a1f..e585657e9831 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -63,7 +63,15 @@ struct writeback_control {
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */ 65 unsigned more_io:1; /* more io to be dispatched */
66 unsigned range_cont:1; 66 /*
67 * write_cache_pages() won't update wbc->nr_to_write and
68 * mapping->writeback_index if no_nrwrite_index_update
69 * is set. write_cache_pages() may write more than we
70 * requested and we want to make sure nr_to_write and
71 * writeback_index are updated in a consistent manner
72 * so we use a single control to update them
73 */
74 unsigned no_nrwrite_index_update:1;
67}; 75};
68 76
69/* 77/*
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index fb0c215a3051..4bc1e6b86cb2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -279,6 +279,7 @@ enum xfrm_attr_type_t {
279 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 279 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
280 XFRMA_MIGRATE, 280 XFRMA_MIGRATE,
281 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ 281 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
282 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */
282 __XFRMA_MAX 283 __XFRMA_MAX
283 284
284#define XFRMA_MAX (__XFRMA_MAX - 1) 285#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -415,6 +416,15 @@ struct xfrm_user_report {
415 struct xfrm_selector sel; 416 struct xfrm_selector sel;
416}; 417};
417 418
419/* Used by MIGRATE to pass addresses IKE should use to perform
420 * SA negotiation with the peer */
421struct xfrm_user_kmaddress {
422 xfrm_address_t local;
423 xfrm_address_t remote;
424 __u32 reserved;
425 __u16 family;
426};
427
418struct xfrm_user_migrate { 428struct xfrm_user_migrate {
419 xfrm_address_t old_daddr; 429 xfrm_address_t old_daddr;
420 xfrm_address_t old_saddr; 430 xfrm_address_t old_saddr;
diff --git a/include/math-emu/op-2.h b/include/math-emu/op-2.h
index e193fb08fd55..4f26ecc1411b 100644
--- a/include/math-emu/op-2.h
+++ b/include/math-emu/op-2.h
@@ -25,7 +25,7 @@
25#ifndef __MATH_EMU_OP_2_H__ 25#ifndef __MATH_EMU_OP_2_H__
26#define __MATH_EMU_OP_2_H__ 26#define __MATH_EMU_OP_2_H__
27 27
28#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1 28#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0 = 0, X##_f1 = 0
29#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1) 29#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
30#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I) 30#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
31#define _FP_FRAC_HIGH_2(X) (X##_f1) 31#define _FP_FRAC_HIGH_2(X) (X##_f1)
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index bb46e7645d53..f456534dcaf9 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -73,7 +73,7 @@ do { \
73 X##_c = FP_CLS_NAN; \ 73 X##_c = FP_CLS_NAN; \
74 /* Check for signaling NaN */ \ 74 /* Check for signaling NaN */ \
75 if (!(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ 75 if (!(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \
76 FP_SET_EXCEPTION(FP_EX_INVALID); \ 76 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_SNAN); \
77 } \ 77 } \
78 break; \ 78 break; \
79 } \ 79 } \
@@ -139,18 +139,27 @@ do { \
139 if (X##_e <= _FP_WFRACBITS_##fs) \ 139 if (X##_e <= _FP_WFRACBITS_##fs) \
140 { \ 140 { \
141 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \ 141 _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
142 _FP_ROUND(wc, X); \
143 if (_FP_FRAC_HIGH_##fs(X) \ 142 if (_FP_FRAC_HIGH_##fs(X) \
144 & (_FP_OVERFLOW_##fs >> 1)) \ 143 & (_FP_OVERFLOW_##fs >> 1)) \
145 { \ 144 { \
146 X##_e = 1; \ 145 X##_e = 1; \
147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ 146 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
148 FP_SET_EXCEPTION(FP_EX_INEXACT); \
149 } \ 147 } \
150 else \ 148 else \
151 { \ 149 { \
152 X##_e = 0; \ 150 _FP_ROUND(wc, X); \
153 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ 151 if (_FP_FRAC_HIGH_##fs(X) \
152 & (_FP_OVERFLOW_##fs >> 1)) \
153 { \
154 X##_e = 1; \
155 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
156 FP_SET_EXCEPTION(FP_EX_INEXACT); \
157 } \
158 else \
159 { \
160 X##_e = 0; \
161 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
162 } \
154 } \ 163 } \
155 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \ 164 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
156 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \ 165 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
@@ -324,7 +333,7 @@ do { \
324 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 333 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
325 R##_s = _FP_NANSIGN_##fs; \ 334 R##_s = _FP_NANSIGN_##fs; \
326 R##_c = FP_CLS_NAN; \ 335 R##_c = FP_CLS_NAN; \
327 FP_SET_EXCEPTION(FP_EX_INVALID); \ 336 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ISI); \
328 break; \ 337 break; \
329 } \ 338 } \
330 /* FALLTHRU */ \ 339 /* FALLTHRU */ \
@@ -431,7 +440,7 @@ do { \
431 R##_s = _FP_NANSIGN_##fs; \ 440 R##_s = _FP_NANSIGN_##fs; \
432 R##_c = FP_CLS_NAN; \ 441 R##_c = FP_CLS_NAN; \
433 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 442 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
434 FP_SET_EXCEPTION(FP_EX_INVALID); \ 443 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IMZ);\
435 break; \ 444 break; \
436 \ 445 \
437 default: \ 446 default: \
@@ -490,11 +499,17 @@ do { \
490 break; \ 499 break; \
491 \ 500 \
492 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \ 501 case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
502 R##_s = _FP_NANSIGN_##fs; \
503 R##_c = FP_CLS_NAN; \
504 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
505 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_IDI);\
506 break; \
507 \
493 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \ 508 case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
494 R##_s = _FP_NANSIGN_##fs; \ 509 R##_s = _FP_NANSIGN_##fs; \
495 R##_c = FP_CLS_NAN; \ 510 R##_c = FP_CLS_NAN; \
496 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \ 511 _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
497 FP_SET_EXCEPTION(FP_EX_INVALID); \ 512 FP_SET_EXCEPTION(FP_EX_INVALID | FP_EX_INVALID_ZDZ);\
498 break; \ 513 break; \
499 \ 514 \
500 default: \ 515 default: \
diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h
index a6f873b45f98..3f284bc03180 100644
--- a/include/math-emu/soft-fp.h
+++ b/include/math-emu/soft-fp.h
@@ -51,6 +51,25 @@
51#ifndef FP_EX_INVALID 51#ifndef FP_EX_INVALID
52#define FP_EX_INVALID 0 52#define FP_EX_INVALID 0
53#endif 53#endif
54#ifndef FP_EX_INVALID_SNAN
55#define FP_EX_INVALID_SNAN 0
56#endif
57/* inf - inf */
58#ifndef FP_EX_INVALID_ISI
59#define FP_EX_INVALID_ISI 0
60#endif
61/* inf / inf */
62#ifndef FP_EX_INVALID_IDI
63#define FP_EX_INVALID_IDI 0
64#endif
65/* 0 / 0 */
66#ifndef FP_EX_INVALID_ZDZ
67#define FP_EX_INVALID_ZDZ 0
68#endif
69/* inf * 0 */
70#ifndef FP_EX_INVALID_IMZ
71#define FP_EX_INVALID_IMZ 0
72#endif
54#ifndef FP_EX_OVERFLOW 73#ifndef FP_EX_OVERFLOW
55#define FP_EX_OVERFLOW 0 74#define FP_EX_OVERFLOW 0
56#endif 75#endif
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index b8e8aa91905a..38f2d93c3957 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/workqueue.h> 27#include <linux/workqueue.h>
28#include <linux/interrupt.h>
28 29
29#define IR_TYPE_RC5 1 30#define IR_TYPE_RC5 1
30#define IR_TYPE_PD 2 /* Pulse distance encoded IR */ 31#define IR_TYPE_PD 2 /* Pulse distance encoded IR */
@@ -85,6 +86,10 @@ struct card_ir {
85 u32 code; /* raw code under construction */ 86 u32 code; /* raw code under construction */
86 struct timeval base_time; /* time of last seen code */ 87 struct timeval base_time; /* time of last seen code */
87 int active; /* building raw code */ 88 int active; /* building raw code */
89
90 /* NEC decoding */
91 u32 nec_gpio;
92 struct tasklet_struct tlet;
88}; 93};
89 94
90void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 95void ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
@@ -105,6 +110,7 @@ void ir_rc5_timer_keyup(unsigned long data);
105extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; 110extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
106extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE]; 111extern IR_KEYTAB_TYPE ir_codes_avermedia[IR_KEYTAB_SIZE];
107extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE]; 112extern IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE];
113extern IR_KEYTAB_TYPE ir_codes_avermedia_m135a[IR_KEYTAB_SIZE];
108extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE]; 114extern IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE];
109extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE]; 115extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];
110extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE]; 116extern IR_KEYTAB_TYPE ir_codes_pixelview_new[IR_KEYTAB_SIZE];
@@ -139,6 +145,7 @@ extern IR_KEYTAB_TYPE ir_codes_proteus_2309[IR_KEYTAB_SIZE];
139extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE]; 145extern IR_KEYTAB_TYPE ir_codes_budget_ci_old[IR_KEYTAB_SIZE];
140extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE]; 146extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
141extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; 147extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
148extern IR_KEYTAB_TYPE ir_codes_encore_enltv2[IR_KEYTAB_SIZE];
142extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; 149extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
143extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; 150extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE];
144extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE]; 151extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE];
@@ -147,7 +154,9 @@ extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
147extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE]; 154extern IR_KEYTAB_TYPE ir_codes_genius_tvgo_a11mce[IR_KEYTAB_SIZE];
148extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE]; 155extern IR_KEYTAB_TYPE ir_codes_powercolor_real_angel[IR_KEYTAB_SIZE];
149extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE]; 156extern IR_KEYTAB_TYPE ir_codes_avermedia_a16d[IR_KEYTAB_SIZE];
150 157extern IR_KEYTAB_TYPE ir_codes_encore_enltv_fm53[IR_KEYTAB_SIZE];
158extern IR_KEYTAB_TYPE ir_codes_real_audio_220_32_keys[IR_KEYTAB_SIZE];
159extern IR_KEYTAB_TYPE ir_codes_msi_tvanywhere_plus[IR_KEYTAB_SIZE];
151#endif 160#endif
152 161
153/* 162/*
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index f677dfb9d373..bab212719591 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -1,5 +1,5 @@
1/* 1/*
2 saa7115.h - definition for saa7113/4/5 inputs and frequency flags 2 saa7115.h - definition for saa7111/3/4/5 inputs and frequency flags
3 3
4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 4 Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl)
5 5
@@ -21,13 +21,13 @@
21#ifndef _SAA7115_H_ 21#ifndef _SAA7115_H_
22#define _SAA7115_H_ 22#define _SAA7115_H_
23 23
24/* SAA7113/4/5 HW inputs */ 24/* SAA7111/3/4/5 HW inputs */
25#define SAA7115_COMPOSITE0 0 25#define SAA7115_COMPOSITE0 0
26#define SAA7115_COMPOSITE1 1 26#define SAA7115_COMPOSITE1 1
27#define SAA7115_COMPOSITE2 2 27#define SAA7115_COMPOSITE2 2
28#define SAA7115_COMPOSITE3 3 28#define SAA7115_COMPOSITE3 3
29#define SAA7115_COMPOSITE4 4 /* not available for the saa7113 */ 29#define SAA7115_COMPOSITE4 4 /* not available for the saa7111/3 */
30#define SAA7115_COMPOSITE5 5 /* not available for the saa7113 */ 30#define SAA7115_COMPOSITE5 5 /* not available for the saa7111/3 */
31#define SAA7115_SVIDEO0 6 31#define SAA7115_SVIDEO0 6
32#define SAA7115_SVIDEO1 7 32#define SAA7115_SVIDEO1 7
33#define SAA7115_SVIDEO2 8 33#define SAA7115_SVIDEO2 8
@@ -42,8 +42,15 @@
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 45#define SAA7115_IPORT_ON 1
46#define SAA7115_IPORT_OFF 0 46#define SAA7115_IPORT_OFF 0
47
48/* SAA7111 specific output flags */
49#define SAA7111_VBI_BYPASS 2
50#define SAA7111_FMT_YUV422 0x00
51#define SAA7111_FMT_RGB 0x40
52#define SAA7111_FMT_CCIR 0x80
53#define SAA7111_FMT_YUV411 0xc0
47 54
48#endif 55#endif
49 56
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 2f68f4cd0037..c5a6e22a4b37 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -24,13 +24,13 @@
24 24
25extern unsigned int saa7146_debug; 25extern unsigned int saa7146_debug;
26 26
27//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__FUNCTION__) 27//#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),KBUILD_MODNAME,__func__)
28 28
29#ifndef DEBUG_VARIABLE 29#ifndef DEBUG_VARIABLE
30 #define DEBUG_VARIABLE saa7146_debug 30 #define DEBUG_VARIABLE saa7146_debug
31#endif 31#endif
32 32
33#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME,__FUNCTION__) 33#define DEBUG_PROLOG printk("%s: %s(): ",KBUILD_MODNAME, __func__)
34#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; } 34#define INFO(x) { printk("%s: ",KBUILD_MODNAME); printk x; }
35 35
36#define ERR(x) { DEBUG_PROLOG; printk x; } 36#define ERR(x) { DEBUG_PROLOG; printk x; }
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index 234a4711d2ec..b5dbefea3740 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -5,8 +5,6 @@
5 5
6struct sh_mobile_ceu_info { 6struct sh_mobile_ceu_info {
7 unsigned long flags; /* SOCAM_... */ 7 unsigned long flags; /* SOCAM_... */
8 void (*enable_camera)(void);
9 void (*disable_camera)(void);
10}; 8};
11 9
12#endif /* __ASM_SH_MOBILE_CEU_H__ */ 10#endif /* __ASM_SH_MOBILE_CEU_H__ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index d548de326722..c5de7bb19fda 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -83,6 +83,9 @@ struct soc_camera_link {
83 int bus_id; 83 int bus_id;
84 /* GPIO number to switch between 8 and 10 bit modes */ 84 /* GPIO number to switch between 8 and 10 bit modes */
85 unsigned int gpio; 85 unsigned int gpio;
86 /* Optional callbacks to power on or off and reset the sensor */
87 int (*power)(struct device *, int);
88 int (*reset)(struct device *);
86}; 89};
87 90
88static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 91static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 851f18220984..1d092b4678aa 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -1,3 +1,13 @@
1/*
2 * Generic Platform Camera Driver Header
3 *
4 * Copyright (C) 2008 Magnus Damm
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
1#ifndef __SOC_CAMERA_H__ 11#ifndef __SOC_CAMERA_H__
2#define __SOC_CAMERA_H__ 12#define __SOC_CAMERA_H__
3 13
@@ -9,6 +19,7 @@ struct soc_camera_platform_info {
9 unsigned long format_depth; 19 unsigned long format_depth;
10 struct v4l2_pix_format format; 20 struct v4l2_pix_format format;
11 unsigned long bus_param; 21 unsigned long bus_param;
22 void (*power)(int);
12 int (*set_capture)(struct soc_camera_platform_info *info, int enable); 23 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
13}; 24};
14 25
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 77068fcc86bd..7d4e2db78076 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -122,6 +122,8 @@
122#define TUNER_TDA9887 74 /* This tuner should be used only internally */ 122#define TUNER_TDA9887 74 /* This tuner should be used only internally */
123#define TUNER_TEA5761 75 /* Only FM Radio Tuner */ 123#define TUNER_TEA5761 75 /* Only FM Radio Tuner */
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */ 124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
125 127
126/* tv card specific */ 128/* tv card specific */
127#define TDA9887_PRESENT (1<<0) 129#define TDA9887_PRESENT (1<<0)
@@ -178,7 +180,7 @@ struct tuner_setup {
178 unsigned int type; /* Tuner type */ 180 unsigned int type; /* Tuner type */
179 unsigned int mode_mask; /* Allowed tuner modes */ 181 unsigned int mode_mask; /* Allowed tuner modes */
180 unsigned int config; /* configuraion for more complex tuners */ 182 unsigned int config; /* configuraion for more complex tuners */
181 int (*tuner_callback) (void *dev, int command,int arg); 183 int (*tuner_callback) (void *dev, int component, int cmd, int arg);
182}; 184};
183 185
184#endif /* __KERNEL__ */ 186#endif /* __KERNEL__ */
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 41b509babf3f..d73a8e9028a5 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -72,6 +72,10 @@ enum {
72 /* module cs5345: just ident 5345 */ 72 /* module cs5345: just ident 5345 */
73 V4L2_IDENT_CS5345 = 5345, 73 V4L2_IDENT_CS5345 = 5345,
74 74
75 /* module saa6752hs: reserved range 6750-6759 */
76 V4L2_IDENT_SAA6752HS = 6752,
77 V4L2_IDENT_SAA6752HS_AC3 = 6753,
78
75 /* module wm8739: just ident 8739 */ 79 /* module wm8739: just ident 8739 */
76 V4L2_IDENT_WM8739 = 8739, 80 V4L2_IDENT_WM8739 = 8739,
77 81
@@ -161,6 +165,7 @@ enum {
161 /* Micron CMOS sensor chips: 45000-45099 */ 165 /* Micron CMOS sensor chips: 45000-45099 */
162 V4L2_IDENT_MT9M001C12ST = 45000, 166 V4L2_IDENT_MT9M001C12ST = 45000,
163 V4L2_IDENT_MT9M001C12STM = 45005, 167 V4L2_IDENT_MT9M001C12STM = 45005,
168 V4L2_IDENT_MT9M111 = 45007,
164 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ 169 V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */
165 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ 170 V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */
166}; 171};
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 07d3a9a575d1..2f8719abf5cb 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -76,11 +76,14 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
76 76
77int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 77int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
78 const char **menu_items); 78 const char **menu_items);
79const char *v4l2_ctrl_get_name(u32 id);
79const char **v4l2_ctrl_get_menu(u32 id); 80const char **v4l2_ctrl_get_menu(u32 id);
80int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); 81int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
81int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl); 82int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl);
82int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, 83int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
83 struct v4l2_queryctrl *qctrl, const char **menu_items); 84 struct v4l2_queryctrl *qctrl, const char **menu_items);
85#define V4L2_CTRL_MENU_IDS_END (0xffffffff)
86int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
84u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); 87u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
85 88
86/* ------------------------------------------------------------------------- */ 89/* ------------------------------------------------------------------------- */
@@ -222,18 +225,22 @@ struct v4l2_crystal_freq {
222 An extra flags field allows device specific configuration regarding 225 An extra flags field allows device specific configuration regarding
223 clock frequency dividers, etc. If not used, then set flags to 0. 226 clock frequency dividers, etc. If not used, then set flags to 0.
224 If the frequency is not supported, then -EINVAL is returned. */ 227 If the frequency is not supported, then -EINVAL is returned. */
225#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW ('d', 113, struct v4l2_crystal_freq) 228#define VIDIOC_INT_S_CRYSTAL_FREQ _IOW('d', 113, struct v4l2_crystal_freq)
226 229
227/* Initialize the sensor registors to some sort of reasonable 230/* Initialize the sensor registors to some sort of reasonable
228 default values. */ 231 default values. */
229#define VIDIOC_INT_INIT _IOW ('d', 114, u32) 232#define VIDIOC_INT_INIT _IOW('d', 114, u32)
230 233
231/* Set v4l2_std_id for video OUTPUT devices. This is ignored by 234/* Set v4l2_std_id for video OUTPUT devices. This is ignored by
232 video input devices. */ 235 video input devices. */
233#define VIDIOC_INT_S_STD_OUTPUT _IOW ('d', 115, v4l2_std_id) 236#define VIDIOC_INT_S_STD_OUTPUT _IOW('d', 115, v4l2_std_id)
234 237
235/* Get v4l2_std_id for video OUTPUT devices. This is ignored by 238/* Get v4l2_std_id for video OUTPUT devices. This is ignored by
236 video input devices. */ 239 video input devices. */
237#define VIDIOC_INT_G_STD_OUTPUT _IOW ('d', 116, v4l2_std_id) 240#define VIDIOC_INT_G_STD_OUTPUT _IOW('d', 116, v4l2_std_id)
241
242/* Set GPIO pins. Very simple right now, might need to be extended with
243 a v4l2_gpio struct if a direction is also needed. */
244#define VIDIOC_INT_S_GPIO _IOW('d', 117, u32)
238 245
239#endif /* V4L2_COMMON_H_ */ 246#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 2745e1afc722..a0a6b41c5e09 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -9,30 +9,20 @@
9#ifndef _V4L2_DEV_H 9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H 10#define _V4L2_DEV_H
11 11
12#define OBSOLETE_DEVDATA 1 /* to be removed soon */
13
14#include <linux/poll.h> 12#include <linux/poll.h>
15#include <linux/fs.h> 13#include <linux/fs.h>
16#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/cdev.h>
17#include <linux/mutex.h> 16#include <linux/mutex.h>
18#include <linux/compiler.h> /* need __user */
19#include <linux/videodev2.h> 17#include <linux/videodev2.h>
20 18
21#define VIDEO_MAJOR 81 19#define VIDEO_MAJOR 81
22/* Minor device allocation */
23#define MINOR_VFL_TYPE_GRABBER_MIN 0
24#define MINOR_VFL_TYPE_GRABBER_MAX 63
25#define MINOR_VFL_TYPE_RADIO_MIN 64
26#define MINOR_VFL_TYPE_RADIO_MAX 127
27#define MINOR_VFL_TYPE_VTX_MIN 192
28#define MINOR_VFL_TYPE_VTX_MAX 223
29#define MINOR_VFL_TYPE_VBI_MIN 224
30#define MINOR_VFL_TYPE_VBI_MAX 255
31 20
32#define VFL_TYPE_GRABBER 0 21#define VFL_TYPE_GRABBER 0
33#define VFL_TYPE_VBI 1 22#define VFL_TYPE_VBI 1
34#define VFL_TYPE_RADIO 2 23#define VFL_TYPE_RADIO 2
35#define VFL_TYPE_VTX 3 24#define VFL_TYPE_VTX 3
25#define VFL_TYPE_MAX 4
36 26
37struct v4l2_ioctl_callbacks; 27struct v4l2_ioctl_callbacks;
38 28
@@ -49,12 +39,15 @@ struct video_device
49 39
50 /* sysfs */ 40 /* sysfs */
51 struct device dev; /* v4l device */ 41 struct device dev; /* v4l device */
42 struct cdev cdev; /* character device */
43 void (*cdev_release)(struct kobject *kobj);
52 struct device *parent; /* device parent */ 44 struct device *parent; /* device parent */
53 45
54 /* device info */ 46 /* device info */
55 char name[32]; 47 char name[32];
56 int vfl_type; 48 int vfl_type;
57 int minor; 49 int minor;
50 u16 num;
58 /* attribute to differentiate multiple indices on one physical device */ 51 /* attribute to differentiate multiple indices on one physical device */
59 int index; 52 int index;
60 53
@@ -69,50 +62,50 @@ struct video_device
69 62
70 /* ioctl callbacks */ 63 /* ioctl callbacks */
71 const struct v4l2_ioctl_ops *ioctl_ops; 64 const struct v4l2_ioctl_ops *ioctl_ops;
72
73#ifdef OBSOLETE_DEVDATA /* to be removed soon */
74 /* dev->driver_data will be used instead some day.
75 * Use the video_{get|set}_drvdata() helper functions,
76 * so the switch over will be transparent for you.
77 * Or use {pci|usb}_{get|set}_drvdata() directly. */
78 void *priv;
79#endif
80
81 /* for videodev.c internal usage -- please don't touch */
82 int users; /* video_exclusive_{open|close} ... */
83 struct mutex lock; /* ... helper function uses these */
84}; 65};
85 66
86/* Class-dev to video-device */ 67/* dev to video-device */
87#define to_video_device(cd) container_of(cd, struct video_device, dev) 68#define to_video_device(cd) container_of(cd, struct video_device, dev)
88 69
89/* Version 2 functions */ 70/* Register and unregister devices. Note that if video_register_device fails,
90extern int video_register_device(struct video_device *vfd, int type, int nr); 71 the release() callback of the video_device structure is *not* called, so
91int video_register_device_index(struct video_device *vfd, int type, int nr, 72 the caller is responsible for freeing any data. Usually that means that
92 int index); 73 you call video_device_release() on failure. */
93void video_unregister_device(struct video_device *); 74int __must_check video_register_device(struct video_device *vfd, int type, int nr);
75int __must_check video_register_device_index(struct video_device *vfd,
76 int type, int nr, int index);
77void video_unregister_device(struct video_device *vfd);
94 78
95/* helper functions to alloc / release struct video_device, the 79/* helper functions to alloc/release struct video_device, the
96 later can be used for video_device->release() */ 80 latter can also be used for video_device->release(). */
97struct video_device *video_device_alloc(void); 81struct video_device * __must_check video_device_alloc(void);
82
83/* this release function frees the vfd pointer */
98void video_device_release(struct video_device *vfd); 84void video_device_release(struct video_device *vfd);
99 85
100#ifdef OBSOLETE_DEVDATA /* to be removed soon */ 86/* this release function does nothing, use when the video_device is a
87 static global struct. Note that having a static video_device is
88 a dubious construction at best. */
89void video_device_release_empty(struct video_device *vfd);
90
101/* helper functions to access driver private data. */ 91/* helper functions to access driver private data. */
102static inline void *video_get_drvdata(struct video_device *dev) 92static inline void *video_get_drvdata(struct video_device *dev)
103{ 93{
104 return dev->priv; 94 return dev_get_drvdata(&dev->dev);
105} 95}
106 96
107static inline void video_set_drvdata(struct video_device *dev, void *data) 97static inline void video_set_drvdata(struct video_device *dev, void *data)
108{ 98{
109 dev->priv = data; 99 dev_set_drvdata(&dev->dev, data);
110} 100}
111 101
112/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ 102struct video_device *video_devdata(struct file *file);
113extern struct video_device* video_devdata(struct file*); 103
114extern int video_exclusive_open(struct inode *inode, struct file *file); 104/* Combine video_get_drvdata and video_devdata as this is
115extern int video_exclusive_release(struct inode *inode, struct file *file); 105 used very often. */
116#endif 106static inline void *video_drvdata(struct file *file)
107{
108 return video_get_drvdata(video_devdata(file));
109}
117 110
118#endif /* _V4L2_DEV_H */ 111#endif /* _V4L2_DEV_H */
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
index 975ffbf4e2c5..e65dd9d84e8b 100644
--- a/include/media/v4l2-i2c-drv-legacy.h
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -21,6 +21,17 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
24struct v4l2_i2c_driver_data { 35struct v4l2_i2c_driver_data {
25 const char * const name; 36 const char * const name;
26 int driverid; 37 int driverid;
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index 40ecef29801d..efdc8bf27f87 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -21,6 +21,17 @@
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23 23
24/* NOTE: the full version of this header is in the v4l-dvb repository
25 * and allows v4l i2c drivers to be compiled on older kernels as well.
26 * The version of this header as it appears in the kernel is a stripped
27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd.
29 *
30 * If you look at the full version then you will understand the reason
31 * for introducing this header since you really don't want to have all
32 * the tricky backwards compatibility code in each and every i2c driver.
33 */
34
24#ifndef __V4L2_I2C_DRV_H__ 35#ifndef __V4L2_I2C_DRV_H__
25#define __V4L2_I2C_DRV_H__ 36#define __V4L2_I2C_DRV_H__
26 37
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index c8b80e0f0651..9c2df41dbf92 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -84,6 +84,8 @@ struct v4l2_int_device {
84 void *priv; 84 void *priv;
85}; 85};
86 86
87void v4l2_int_device_try_attach_all(void);
88
87int v4l2_int_device_register(struct v4l2_int_device *d); 89int v4l2_int_device_register(struct v4l2_int_device *d);
88void v4l2_int_device_unregister(struct v4l2_int_device *d); 90void v4l2_int_device_unregister(struct v4l2_int_device *d);
89 91
@@ -96,6 +98,12 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg);
96 * 98 *
97 */ 99 */
98 100
101enum v4l2_power {
102 V4L2_POWER_OFF = 0,
103 V4L2_POWER_ON,
104 V4L2_POWER_STANDBY,
105};
106
99/* Slave interface type. */ 107/* Slave interface type. */
100enum v4l2_if_type { 108enum v4l2_if_type {
101 /* 109 /*
@@ -170,6 +178,9 @@ enum v4l2_int_ioctl_num {
170 vidioc_int_queryctrl_num, 178 vidioc_int_queryctrl_num,
171 vidioc_int_g_ctrl_num, 179 vidioc_int_g_ctrl_num,
172 vidioc_int_s_ctrl_num, 180 vidioc_int_s_ctrl_num,
181 vidioc_int_cropcap_num,
182 vidioc_int_g_crop_num,
183 vidioc_int_s_crop_num,
173 vidioc_int_g_parm_num, 184 vidioc_int_g_parm_num,
174 vidioc_int_s_parm_num, 185 vidioc_int_s_parm_num,
175 186
@@ -182,12 +193,19 @@ enum v4l2_int_ioctl_num {
182 vidioc_int_dev_init_num = 1000, 193 vidioc_int_dev_init_num = 1000,
183 /* Delinitialise the device at slave detach. */ 194 /* Delinitialise the device at slave detach. */
184 vidioc_int_dev_exit_num, 195 vidioc_int_dev_exit_num,
185 /* Set device power state: 0 is off, non-zero is on. */ 196 /* Set device power state. */
186 vidioc_int_s_power_num, 197 vidioc_int_s_power_num,
198 /*
199 * Get slave private data, e.g. platform-specific slave
200 * configuration used by the master.
201 */
202 vidioc_int_g_priv_num,
187 /* Get slave interface parameters. */ 203 /* Get slave interface parameters. */
188 vidioc_int_g_ifparm_num, 204 vidioc_int_g_ifparm_num,
189 /* Does the slave need to be reset after VIDIOC_DQBUF? */ 205 /* Does the slave need to be reset after VIDIOC_DQBUF? */
190 vidioc_int_g_needs_reset_num, 206 vidioc_int_g_needs_reset_num,
207 vidioc_int_enum_framesizes_num,
208 vidioc_int_enum_frameintervals_num,
191 209
192 /* 210 /*
193 * 211 *
@@ -261,14 +279,20 @@ V4L2_INT_WRAPPER_1(try_fmt_cap, struct v4l2_format, *);
261V4L2_INT_WRAPPER_1(queryctrl, struct v4l2_queryctrl, *); 279V4L2_INT_WRAPPER_1(queryctrl, struct v4l2_queryctrl, *);
262V4L2_INT_WRAPPER_1(g_ctrl, struct v4l2_control, *); 280V4L2_INT_WRAPPER_1(g_ctrl, struct v4l2_control, *);
263V4L2_INT_WRAPPER_1(s_ctrl, struct v4l2_control, *); 281V4L2_INT_WRAPPER_1(s_ctrl, struct v4l2_control, *);
282V4L2_INT_WRAPPER_1(cropcap, struct v4l2_cropcap, *);
283V4L2_INT_WRAPPER_1(g_crop, struct v4l2_crop, *);
284V4L2_INT_WRAPPER_1(s_crop, struct v4l2_crop, *);
264V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *); 285V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *);
265V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *); 286V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *);
266 287
267V4L2_INT_WRAPPER_0(dev_init); 288V4L2_INT_WRAPPER_0(dev_init);
268V4L2_INT_WRAPPER_0(dev_exit); 289V4L2_INT_WRAPPER_0(dev_exit);
269V4L2_INT_WRAPPER_1(s_power, int, ); 290V4L2_INT_WRAPPER_1(s_power, enum v4l2_power, );
291V4L2_INT_WRAPPER_1(g_priv, void, *);
270V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *); 292V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *);
271V4L2_INT_WRAPPER_1(g_needs_reset, void, *); 293V4L2_INT_WRAPPER_1(g_needs_reset, void, *);
294V4L2_INT_WRAPPER_1(enum_framesizes, struct v4l2_frmsizeenum, *);
295V4L2_INT_WRAPPER_1(enum_frameintervals, struct v4l2_frmivalenum, *);
272 296
273V4L2_INT_WRAPPER_0(reset); 297V4L2_INT_WRAPPER_0(reset);
274V4L2_INT_WRAPPER_0(init); 298V4L2_INT_WRAPPER_0(init);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index dc6404618555..e6ba25b3d7c8 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -39,11 +39,6 @@ struct v4l2_ioctl_ops {
39 struct v4l2_fmtdesc *f); 39 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, 40 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
41 struct v4l2_fmtdesc *f); 41 struct v4l2_fmtdesc *f);
42#if 1
43 /* deprecated, will be removed in 2.6.28 */
44 int (*vidioc_enum_fmt_vbi_cap) (struct file *file, void *fh,
45 struct v4l2_fmtdesc *f);
46#endif
47 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 42 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
48 struct v4l2_fmtdesc *f); 43 struct v4l2_fmtdesc *f);
49 44
@@ -276,26 +271,38 @@ extern const char *v4l2_field_names[];
276extern const char *v4l2_type_names[]; 271extern const char *v4l2_type_names[];
277 272
278/* Compatibility layer interface -- v4l1-compat module */ 273/* Compatibility layer interface -- v4l1-compat module */
279typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file, 274typedef int (*v4l2_kioctl)(struct file *file,
280 unsigned int cmd, void *arg); 275 unsigned int cmd, void *arg);
281#ifdef CONFIG_VIDEO_V4L1_COMPAT 276#ifdef CONFIG_VIDEO_V4L1_COMPAT
282int v4l_compat_translate_ioctl(struct inode *inode, struct file *file, 277int v4l_compat_translate_ioctl(struct file *file,
283 int cmd, void *arg, v4l2_kioctl driver_ioctl); 278 int cmd, void *arg, v4l2_kioctl driver_ioctl);
284#else 279#else
285#define v4l_compat_translate_ioctl(inode, file, cmd, arg, ioctl) (-EINVAL) 280#define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL)
286#endif 281#endif
287 282
288/* 32 Bits compatibility layer for 64 bits processors */ 283/* 32 Bits compatibility layer for 64 bits processors */
289extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, 284extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
290 unsigned long arg); 285 unsigned long arg);
291 286
292extern int video_ioctl2(struct inode *inode, struct file *file,
293 unsigned int cmd, unsigned long arg);
294
295/* Include support for obsoleted stuff */ 287/* Include support for obsoleted stuff */
296extern int video_usercopy(struct inode *inode, struct file *file, 288extern int video_usercopy(struct inode *inode, struct file *file,
297 unsigned int cmd, unsigned long arg, 289 unsigned int cmd, unsigned long arg,
298 int (*func)(struct inode *inode, struct file *file, 290 int (*func)(struct inode *inode, struct file *file,
299 unsigned int cmd, void *arg)); 291 unsigned int cmd, void *arg));
300 292
293/* Standard handlers for V4L ioctl's */
294
295/* This prototype is used on fops.unlocked_ioctl */
296extern int __video_ioctl2(struct file *file,
297 unsigned int cmd, unsigned long arg);
298
299/* This prototype is used on fops.ioctl
300 * Since fops.ioctl enables Kernel Big Lock, it is preferred
301 * to use __video_ioctl2 instead.
302 * It should be noticed that there's no lock code inside
303 * video_ioctl2().
304 */
305extern int video_ioctl2(struct inode *inode, struct file *file,
306 unsigned int cmd, unsigned long arg);
307
301#endif /* _V4L2_IOCTL_H */ 308#endif /* _V4L2_IOCTL_H */
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index b77748696329..6ba4f1271d23 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -16,7 +16,6 @@ struct videobuf_dvb {
16 int nfeeds; 16 int nfeeds;
17 17
18 /* videobuf_dvb_(un)register manges this */ 18 /* videobuf_dvb_(un)register manges this */
19 struct dvb_adapter adapter;
20 struct dvb_demux demux; 19 struct dvb_demux demux;
21 struct dmxdev dmxdev; 20 struct dmxdev dmxdev;
22 struct dmx_frontend fe_hw; 21 struct dmx_frontend fe_hw;
@@ -24,12 +23,35 @@ struct videobuf_dvb {
24 struct dvb_net net; 23 struct dvb_net net;
25}; 24};
26 25
27int videobuf_dvb_register(struct videobuf_dvb *dvb, 26struct videobuf_dvb_frontend {
27 struct list_head felist;
28 int id;
29 struct videobuf_dvb dvb;
30};
31
32struct videobuf_dvb_frontends {
33 struct list_head felist;
34 struct mutex lock;
35 struct dvb_adapter adapter;
36 int active_fe_id; /* Indicates which frontend in the felist is in use */
37 int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */
38};
39
40int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
28 struct module *module, 41 struct module *module,
29 void *adapter_priv, 42 void *adapter_priv,
30 struct device *device, 43 struct device *device,
31 short *adapter_nr); 44 short *adapter_nr,
32void videobuf_dvb_unregister(struct videobuf_dvb *dvb); 45 int mfe_shared);
46
47void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);
48
49struct videobuf_dvb_frontend * videobuf_dvb_alloc_frontend(struct videobuf_dvb_frontends *f, int id);
50void videobuf_dvb_dealloc_frontends(struct videobuf_dvb_frontends *f);
51
52struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct videobuf_dvb_frontends *f, int id);
53int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct dvb_frontend *p);
54
33 55
34/* 56/*
35 * Local variables: 57 * Local variables:
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index c3626c0ba9d3..b77c1478c99f 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -27,8 +27,6 @@
27#ifndef NET_9P_H 27#ifndef NET_9P_H
28#define NET_9P_H 28#define NET_9P_H
29 29
30#ifdef CONFIG_NET_9P_DEBUG
31
32/** 30/**
33 * enum p9_debug_flags - bits for mount time debug parameter 31 * enum p9_debug_flags - bits for mount time debug parameter
34 * @P9_DEBUG_ERROR: more verbose error messages including original error string 32 * @P9_DEBUG_ERROR: more verbose error messages including original error string
@@ -39,6 +37,7 @@
39 * @P9_DEBUG_TRANS: transport tracing 37 * @P9_DEBUG_TRANS: transport tracing
40 * @P9_DEBUG_SLABS: memory management tracing 38 * @P9_DEBUG_SLABS: memory management tracing
41 * @P9_DEBUG_FCALL: verbose dump of protocol messages 39 * @P9_DEBUG_FCALL: verbose dump of protocol messages
40 * @P9_DEBUG_FID: fid allocation/deallocation tracking
42 * 41 *
43 * These flags are passed at mount time to turn on various levels of 42 * These flags are passed at mount time to turn on various levels of
44 * verbosity and tracing which will be output to the system logs. 43 * verbosity and tracing which will be output to the system logs.
@@ -53,30 +52,33 @@ enum p9_debug_flags {
53 P9_DEBUG_TRANS = (1<<6), 52 P9_DEBUG_TRANS = (1<<6),
54 P9_DEBUG_SLABS = (1<<7), 53 P9_DEBUG_SLABS = (1<<7),
55 P9_DEBUG_FCALL = (1<<8), 54 P9_DEBUG_FCALL = (1<<8),
55 P9_DEBUG_FID = (1<<9),
56 P9_DEBUG_PKT = (1<<10),
56}; 57};
57 58
59#ifdef CONFIG_NET_9P_DEBUG
58extern unsigned int p9_debug_level; 60extern unsigned int p9_debug_level;
59 61
60#define P9_DPRINTK(level, format, arg...) \ 62#define P9_DPRINTK(level, format, arg...) \
61do { \ 63do { \
62 if ((p9_debug_level & level) == level) \ 64 if ((p9_debug_level & level) == level) {\
63 printk(KERN_NOTICE "-- %s (%d): " \ 65 if (level == P9_DEBUG_9P) \
64 format , __FUNCTION__, task_pid_nr(current) , ## arg); \ 66 printk(KERN_NOTICE "(%8.8d) " \
67 format , task_pid_nr(current) , ## arg); \
68 else \
69 printk(KERN_NOTICE "-- %s (%d): " \
70 format , __func__, task_pid_nr(current) , ## arg); \
71 } \
65} while (0) 72} while (0)
66 73
67#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \
68 "%s: %.*s\n", s, fcall?fcall->params.rerror.error.len:0, \
69 fcall?fcall->params.rerror.error.str:"");
70
71#else 74#else
72#define P9_DPRINTK(level, format, arg...) do { } while (0) 75#define P9_DPRINTK(level, format, arg...) do { } while (0)
73#define PRINT_FCALL_ERROR(s, fcall) do { } while (0)
74#endif 76#endif
75 77
76#define P9_EPRINTK(level, format, arg...) \ 78#define P9_EPRINTK(level, format, arg...) \
77do { \ 79do { \
78 printk(level "9p: %s (%d): " \ 80 printk(level "9p: %s (%d): " \
79 format , __FUNCTION__, task_pid_nr(current), ## arg); \ 81 format , __func__, task_pid_nr(current), ## arg); \
80} while (0) 82} while (0)
81 83
82/** 84/**
@@ -325,33 +327,6 @@ struct p9_qid {
325 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat 327 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
326 */ 328 */
327 329
328struct p9_stat {
329 u16 size;
330 u16 type;
331 u32 dev;
332 struct p9_qid qid;
333 u32 mode;
334 u32 atime;
335 u32 mtime;
336 u64 length;
337 struct p9_str name;
338 struct p9_str uid;
339 struct p9_str gid;
340 struct p9_str muid;
341 struct p9_str extension; /* 9p2000.u extensions */
342 u32 n_uid; /* 9p2000.u extensions */
343 u32 n_gid; /* 9p2000.u extensions */
344 u32 n_muid; /* 9p2000.u extensions */
345};
346
347/*
348 * file metadata (stat) structure used to create Twstat message
349 * The is identical to &p9_stat, but the strings don't point to
350 * the same memory block and should be freed separately
351 *
352 * See Also: http://plan9.bell-labs.com/magic/man2html/2/stat
353 */
354
355struct p9_wstat { 330struct p9_wstat {
356 u16 size; 331 u16 size;
357 u16 type; 332 u16 type;
@@ -493,12 +468,12 @@ struct p9_tstat {
493}; 468};
494 469
495struct p9_rstat { 470struct p9_rstat {
496 struct p9_stat stat; 471 struct p9_wstat stat;
497}; 472};
498 473
499struct p9_twstat { 474struct p9_twstat {
500 u32 fid; 475 u32 fid;
501 struct p9_stat stat; 476 struct p9_wstat stat;
502}; 477};
503 478
504struct p9_rwstat { 479struct p9_rwstat {
@@ -509,8 +484,9 @@ struct p9_rwstat {
509 * @size: prefixed length of the structure 484 * @size: prefixed length of the structure
510 * @id: protocol operating identifier of type &p9_msg_t 485 * @id: protocol operating identifier of type &p9_msg_t
511 * @tag: transaction id of the request 486 * @tag: transaction id of the request
487 * @offset: used by marshalling routines to track currentposition in buffer
488 * @capacity: used by marshalling routines to track total capacity
512 * @sdata: payload 489 * @sdata: payload
513 * @params: per-operation parameters
514 * 490 *
515 * &p9_fcall represents the structure for all 9P RPC 491 * &p9_fcall represents the structure for all 9P RPC
516 * transactions. Requests are packaged into fcalls, and reponses 492 * transactions. Requests are packaged into fcalls, and reponses
@@ -523,68 +499,15 @@ struct p9_fcall {
523 u32 size; 499 u32 size;
524 u8 id; 500 u8 id;
525 u16 tag; 501 u16 tag;
526 void *sdata; 502
527 503 size_t offset;
528 union { 504 size_t capacity;
529 struct p9_tversion tversion; 505
530 struct p9_rversion rversion; 506 uint8_t *sdata;
531 struct p9_tauth tauth;
532 struct p9_rauth rauth;
533 struct p9_rerror rerror;
534 struct p9_tflush tflush;
535 struct p9_rflush rflush;
536 struct p9_tattach tattach;
537 struct p9_rattach rattach;
538 struct p9_twalk twalk;
539 struct p9_rwalk rwalk;
540 struct p9_topen topen;
541 struct p9_ropen ropen;
542 struct p9_tcreate tcreate;
543 struct p9_rcreate rcreate;
544 struct p9_tread tread;
545 struct p9_rread rread;
546 struct p9_twrite twrite;
547 struct p9_rwrite rwrite;
548 struct p9_tclunk tclunk;
549 struct p9_rclunk rclunk;
550 struct p9_tremove tremove;
551 struct p9_rremove rremove;
552 struct p9_tstat tstat;
553 struct p9_rstat rstat;
554 struct p9_twstat twstat;
555 struct p9_rwstat rwstat;
556 } params;
557}; 507};
558 508
559struct p9_idpool; 509struct p9_idpool;
560 510
561int p9_deserialize_stat(void *buf, u32 buflen, struct p9_stat *stat,
562 int dotu);
563int p9_deserialize_fcall(void *buf, u32 buflen, struct p9_fcall *fc, int dotu);
564void p9_set_tag(struct p9_fcall *fc, u16 tag);
565struct p9_fcall *p9_create_tversion(u32 msize, char *version);
566struct p9_fcall *p9_create_tattach(u32 fid, u32 afid, char *uname,
567 char *aname, u32 n_uname, int dotu);
568struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname,
569 u32 n_uname, int dotu);
570struct p9_fcall *p9_create_tflush(u16 oldtag);
571struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname,
572 char **wnames);
573struct p9_fcall *p9_create_topen(u32 fid, u8 mode);
574struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
575 char *extension, int dotu);
576struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count);
577struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count,
578 const char *data);
579struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count,
580 const char __user *data);
581struct p9_fcall *p9_create_tclunk(u32 fid);
582struct p9_fcall *p9_create_tremove(u32 fid);
583struct p9_fcall *p9_create_tstat(u32 fid);
584struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat,
585 int dotu);
586
587int p9_printfcall(char *buf, int buflen, struct p9_fcall *fc, int dotu);
588int p9_errstr2errno(char *errstr, int len); 511int p9_errstr2errno(char *errstr, int len);
589 512
590struct p9_idpool *p9_idpool_create(void); 513struct p9_idpool *p9_idpool_create(void);
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index c936dd14de41..4012e07162e5 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -26,6 +26,87 @@
26#ifndef NET_9P_CLIENT_H 26#ifndef NET_9P_CLIENT_H
27#define NET_9P_CLIENT_H 27#define NET_9P_CLIENT_H
28 28
29/* Number of requests per row */
30#define P9_ROW_MAXTAG 255
31
32/**
33 * enum p9_trans_status - different states of underlying transports
34 * @Connected: transport is connected and healthy
35 * @Disconnected: transport has been disconnected
36 * @Hung: transport is connected by wedged
37 *
38 * This enumeration details the various states a transport
39 * instatiation can be in.
40 */
41
42enum p9_trans_status {
43 Connected,
44 Disconnected,
45 Hung,
46};
47
48/**
49 * enum p9_req_status_t - virtio request status
50 * @REQ_STATUS_IDLE: request slot unused
51 * @REQ_STATUS_ALLOC: request has been allocated but not sent
52 * @REQ_STATUS_UNSENT: request waiting to be sent
53 * @REQ_STATUS_SENT: request sent to server
54 * @REQ_STATUS_FLSH: a flush has been sent for this request
55 * @REQ_STATUS_RCVD: response received from server
56 * @REQ_STATUS_FLSHD: request has been flushed
57 * @REQ_STATUS_ERROR: request encountered an error on the client side
58 *
59 * The @REQ_STATUS_IDLE state is used to mark a request slot as unused
60 * but use is actually tracked by the idpool structure which handles tag
61 * id allocation.
62 *
63 */
64
65enum p9_req_status_t {
66 REQ_STATUS_IDLE,
67 REQ_STATUS_ALLOC,
68 REQ_STATUS_UNSENT,
69 REQ_STATUS_SENT,
70 REQ_STATUS_FLSH,
71 REQ_STATUS_RCVD,
72 REQ_STATUS_FLSHD,
73 REQ_STATUS_ERROR,
74};
75
76/**
77 * struct p9_req_t - request slots
78 * @status: status of this request slot
79 * @t_err: transport error
80 * @flush_tag: tag of request being flushed (for flush requests)
81 * @wq: wait_queue for the client to block on for this request
82 * @tc: the request fcall structure
83 * @rc: the response fcall structure
84 * @aux: transport specific data (provided for trans_fd migration)
85 * @req_list: link for higher level objects to chain requests
86 *
87 * Transport use an array to track outstanding requests
88 * instead of a list. While this may incurr overhead during initial
89 * allocation or expansion, it makes request lookup much easier as the
90 * tag id is a index into an array. (We use tag+1 so that we can accomodate
91 * the -1 tag for the T_VERSION request).
92 * This also has the nice effect of only having to allocate wait_queues
93 * once, instead of constantly allocating and freeing them. Its possible
94 * other resources could benefit from this scheme as well.
95 *
96 */
97
98struct p9_req_t {
99 int status;
100 int t_err;
101 u16 flush_tag;
102 wait_queue_head_t *wq;
103 struct p9_fcall *tc;
104 struct p9_fcall *rc;
105 void *aux;
106
107 struct list_head req_list;
108};
109
29/** 110/**
30 * struct p9_client - per client instance state 111 * struct p9_client - per client instance state
31 * @lock: protect @fidlist 112 * @lock: protect @fidlist
@@ -36,9 +117,20 @@
36 * @conn: connection state information used by trans_fd 117 * @conn: connection state information used by trans_fd
37 * @fidpool: fid handle accounting for session 118 * @fidpool: fid handle accounting for session
38 * @fidlist: List of active fid handles 119 * @fidlist: List of active fid handles
120 * @tagpool - transaction id accounting for session
121 * @reqs - 2D array of requests
122 * @max_tag - current maximum tag id allocated
39 * 123 *
40 * The client structure is used to keep track of various per-client 124 * The client structure is used to keep track of various per-client
41 * state that has been instantiated. 125 * state that has been instantiated.
126 * In order to minimize per-transaction overhead we use a
127 * simple array to lookup requests instead of a hash table
128 * or linked list. In order to support larger number of
129 * transactions, we make this a 2D array, allocating new rows
130 * when we need to grow the total number of the transactions.
131 *
132 * Each row is 256 requests and we'll support up to 256 rows for
133 * a total of 64k concurrent requests per session.
42 * 134 *
43 * Bugs: duplicated data and potentially unnecessary elements. 135 * Bugs: duplicated data and potentially unnecessary elements.
44 */ 136 */
@@ -48,11 +140,16 @@ struct p9_client {
48 int msize; 140 int msize;
49 unsigned char dotu; 141 unsigned char dotu;
50 struct p9_trans_module *trans_mod; 142 struct p9_trans_module *trans_mod;
51 struct p9_trans *trans; 143 enum p9_trans_status status;
144 void *trans;
52 struct p9_conn *conn; 145 struct p9_conn *conn;
53 146
54 struct p9_idpool *fidpool; 147 struct p9_idpool *fidpool;
55 struct list_head fidlist; 148 struct list_head fidlist;
149
150 struct p9_idpool *tagpool;
151 struct p9_req_t *reqs[P9_ROW_MAXTAG];
152 int max_tag;
56}; 153};
57 154
58/** 155/**
@@ -65,8 +162,6 @@ struct p9_client {
65 * @uid: the numeric uid of the local user who owns this handle 162 * @uid: the numeric uid of the local user who owns this handle
66 * @aux: transport specific information (unused?) 163 * @aux: transport specific information (unused?)
67 * @rdir_fpos: tracks offset of file position when reading directory contents 164 * @rdir_fpos: tracks offset of file position when reading directory contents
68 * @rdir_pos: (unused?)
69 * @rdir_fcall: holds response of last directory read request
70 * @flist: per-client-instance fid tracking 165 * @flist: per-client-instance fid tracking
71 * @dlist: per-dentry fid tracking 166 * @dlist: per-dentry fid tracking
72 * 167 *
@@ -83,12 +178,11 @@ struct p9_fid {
83 void *aux; 178 void *aux;
84 179
85 int rdir_fpos; 180 int rdir_fpos;
86 int rdir_pos;
87 struct p9_fcall *rdir_fcall;
88 struct list_head flist; 181 struct list_head flist;
89 struct list_head dlist; /* list of all fids attached to a dentry */ 182 struct list_head dlist; /* list of all fids attached to a dentry */
90}; 183};
91 184
185int p9_client_version(struct p9_client *);
92struct p9_client *p9_client_create(const char *dev_name, char *options); 186struct p9_client *p9_client_create(const char *dev_name, char *options);
93void p9_client_destroy(struct p9_client *clnt); 187void p9_client_destroy(struct p9_client *clnt);
94void p9_client_disconnect(struct p9_client *clnt); 188void p9_client_disconnect(struct p9_client *clnt);
@@ -103,15 +197,19 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode,
103 char *extension); 197 char *extension);
104int p9_client_clunk(struct p9_fid *fid); 198int p9_client_clunk(struct p9_fid *fid);
105int p9_client_remove(struct p9_fid *fid); 199int p9_client_remove(struct p9_fid *fid);
106int p9_client_read(struct p9_fid *fid, char *data, u64 offset, u32 count); 200int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
107int p9_client_readn(struct p9_fid *fid, char *data, u64 offset, u32 count); 201 u64 offset, u32 count);
108int p9_client_write(struct p9_fid *fid, char *data, u64 offset, u32 count); 202int p9_client_write(struct p9_fid *fid, char *data, const char __user *udata,
109int p9_client_uread(struct p9_fid *fid, char __user *data, u64 offset, 203 u64 offset, u32 count);
110 u32 count); 204struct p9_wstat *p9_client_stat(struct p9_fid *fid);
111int p9_client_uwrite(struct p9_fid *fid, const char __user *data, u64 offset,
112 u32 count);
113struct p9_stat *p9_client_stat(struct p9_fid *fid);
114int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst); 205int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst);
115struct p9_stat *p9_client_dirread(struct p9_fid *fid, u64 offset); 206
207struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
208void p9_client_cb(struct p9_client *c, struct p9_req_t *req);
209
210int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
211int p9stat_read(char *, int, struct p9_wstat *, int);
212void p9stat_free(struct p9_wstat *);
213
116 214
117#endif /* NET_9P_CLIENT_H */ 215#endif /* NET_9P_CLIENT_H */
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 3ca737120a90..6d5886efb102 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,52 +26,6 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#include <linux/module.h>
30
31/**
32 * enum p9_trans_status - different states of underlying transports
33 * @Connected: transport is connected and healthy
34 * @Disconnected: transport has been disconnected
35 * @Hung: transport is connected by wedged
36 *
37 * This enumeration details the various states a transport
38 * instatiation can be in.
39 */
40
41enum p9_trans_status {
42 Connected,
43 Disconnected,
44 Hung,
45};
46
47/**
48 * struct p9_trans - per-transport state and API
49 * @status: transport &p9_trans_status
50 * @msize: negotiated maximum packet size (duplicate from client)
51 * @extended: negotiated protocol extensions (duplicate from client)
52 * @priv: transport private data
53 * @close: member function to disconnect and close the transport
54 * @rpc: member function to issue a request to the transport
55 *
56 * This is the basic API for a transport instance. It is used as
57 * a handle by the client to issue requests. This interface is currently
58 * in flux during reorganization.
59 *
60 * Bugs: there is lots of duplicated data here and its not clear that
61 * the member functions need to be per-instance versus per transport
62 * module.
63 */
64
65struct p9_trans {
66 enum p9_trans_status status;
67 int msize;
68 unsigned char extended;
69 void *priv;
70 void (*close) (struct p9_trans *);
71 int (*rpc) (struct p9_trans *t, struct p9_fcall *tc,
72 struct p9_fcall **rc);
73};
74
75/** 29/**
76 * struct p9_trans_module - transport module interface 30 * struct p9_trans_module - transport module interface
77 * @list: used to maintain a list of currently available transports 31 * @list: used to maintain a list of currently available transports
@@ -79,12 +33,14 @@ struct p9_trans {
79 * @maxsize: transport provided maximum packet size 33 * @maxsize: transport provided maximum packet size
80 * @def: set if this transport should be considered the default 34 * @def: set if this transport should be considered the default
81 * @create: member function to create a new connection on this transport 35 * @create: member function to create a new connection on this transport
36 * @request: member function to issue a request to the transport
37 * @cancel: member function to cancel a request (if it hasn't been sent)
82 * 38 *
83 * This is the basic API for a transport module which is registered by the 39 * This is the basic API for a transport module which is registered by the
84 * transport module with the 9P core network module and used by the client 40 * transport module with the 9P core network module and used by the client
85 * to instantiate a new connection on a transport. 41 * to instantiate a new connection on a transport.
86 * 42 *
87 * Bugs: the transport module list isn't protected. 43 * BUGS: the transport module list isn't protected.
88 */ 44 */
89 45
90struct p9_trans_module { 46struct p9_trans_module {
@@ -92,8 +48,11 @@ struct p9_trans_module {
92 char *name; /* name of transport */ 48 char *name; /* name of transport */
93 int maxsize; /* max message size of transport */ 49 int maxsize; /* max message size of transport */
94 int def; /* this transport should be default */ 50 int def; /* this transport should be default */
95 struct p9_trans * (*create)(const char *, char *, int, unsigned char);
96 struct module *owner; 51 struct module *owner;
52 int (*create)(struct p9_client *, const char *, char *);
53 void (*close) (struct p9_client *);
54 int (*request) (struct p9_client *, struct p9_req_t *req);
55 int (*cancel) (struct p9_client *, struct p9_req_t *req);
97}; 56};
98 57
99void v9fs_register_trans(struct p9_trans_module *m); 58void v9fs_register_trans(struct p9_trans_module *m);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 6f8418bf4241..996d12df7594 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -54,8 +54,8 @@
54#define SOL_RFCOMM 18 54#define SOL_RFCOMM 18
55 55
56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 56#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __FUNCTION__ , ## arg) 57#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" , __func__ , ## arg)
58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __FUNCTION__ , ## arg) 58#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
59 59
60/* Connection and socket states */ 60/* Connection and socket states */
61enum { 61enum {
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e00750836ba5..0e85ec39b638 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -152,6 +152,7 @@ struct station_parameters {
152 u16 aid; 152 u16 aid;
153 u8 supported_rates_len; 153 u8 supported_rates_len;
154 u8 plink_action; 154 u8 plink_action;
155 struct ieee80211_ht_cap *ht_capa;
155}; 156};
156 157
157/** 158/**
@@ -268,6 +269,83 @@ struct mpath_info {
268 u8 flags; 269 u8 flags;
269}; 270};
270 271
272/**
273 * struct bss_parameters - BSS parameters
274 *
275 * Used to change BSS parameters (mainly for AP mode).
276 *
277 * @use_cts_prot: Whether to use CTS protection
278 * (0 = no, 1 = yes, -1 = do not change)
279 * @use_short_preamble: Whether the use of short preambles is allowed
280 * (0 = no, 1 = yes, -1 = do not change)
281 * @use_short_slot_time: Whether the use of short slot time is allowed
282 * (0 = no, 1 = yes, -1 = do not change)
283 */
284struct bss_parameters {
285 int use_cts_prot;
286 int use_short_preamble;
287 int use_short_slot_time;
288};
289
290/**
291 * enum reg_set_by - Indicates who is trying to set the regulatory domain
292 * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be
293 * using a static world regulatory domain by default.
294 * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain.
295 * @REGDOM_SET_BY_USER: User asked the wireless core to set the
296 * regulatory domain.
297 * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core
298 * it thinks its knows the regulatory domain we should be in.
299 * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country
300 * information element with regulatory information it thinks we
301 * should consider.
302 */
303enum reg_set_by {
304 REGDOM_SET_BY_INIT,
305 REGDOM_SET_BY_CORE,
306 REGDOM_SET_BY_USER,
307 REGDOM_SET_BY_DRIVER,
308 REGDOM_SET_BY_COUNTRY_IE,
309};
310
311struct ieee80211_freq_range {
312 u32 start_freq_khz;
313 u32 end_freq_khz;
314 u32 max_bandwidth_khz;
315};
316
317struct ieee80211_power_rule {
318 u32 max_antenna_gain;
319 u32 max_eirp;
320};
321
322struct ieee80211_reg_rule {
323 struct ieee80211_freq_range freq_range;
324 struct ieee80211_power_rule power_rule;
325 u32 flags;
326};
327
328struct ieee80211_regdomain {
329 u32 n_reg_rules;
330 char alpha2[2];
331 struct ieee80211_reg_rule reg_rules[];
332};
333
334#define MHZ_TO_KHZ(freq) (freq * 1000)
335#define KHZ_TO_MHZ(freq) (freq / 1000)
336#define DBI_TO_MBI(gain) (gain * 100)
337#define MBI_TO_DBI(gain) (gain / 100)
338#define DBM_TO_MBM(gain) (gain * 100)
339#define MBM_TO_DBM(gain) (gain / 100)
340
341#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
342 .freq_range.start_freq_khz = (start) * 1000, \
343 .freq_range.end_freq_khz = (end) * 1000, \
344 .freq_range.max_bandwidth_khz = (bw) * 1000, \
345 .power_rule.max_antenna_gain = (gain) * 100, \
346 .power_rule.max_eirp = (eirp) * 100, \
347 .flags = reg_flags, \
348 }
271 349
272/* from net/wireless.h */ 350/* from net/wireless.h */
273struct wiphy; 351struct wiphy;
@@ -285,11 +363,13 @@ struct wiphy;
285 * wireless extensions but this is subject to reevaluation as soon as this 363 * wireless extensions but this is subject to reevaluation as soon as this
286 * code is used more widely and we have a first user without wext. 364 * code is used more widely and we have a first user without wext.
287 * 365 *
288 * @add_virtual_intf: create a new virtual interface with the given name 366 * @add_virtual_intf: create a new virtual interface with the given name,
367 * must set the struct wireless_dev's iftype.
289 * 368 *
290 * @del_virtual_intf: remove the virtual interface determined by ifindex. 369 * @del_virtual_intf: remove the virtual interface determined by ifindex.
291 * 370 *
292 * @change_virtual_intf: change type of virtual interface 371 * @change_virtual_intf: change type/configuration of virtual interface,
372 * keep the struct wireless_dev's iftype updated.
293 * 373 *
294 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 374 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
295 * when adding a group key. 375 * when adding a group key.
@@ -318,6 +398,8 @@ struct wiphy;
318 * @change_station: Modify a given station. 398 * @change_station: Modify a given station.
319 * 399 *
320 * @set_mesh_cfg: set mesh parameters (by now, just mesh id) 400 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
401 *
402 * @change_bss: Modify parameters for a given BSS.
321 */ 403 */
322struct cfg80211_ops { 404struct cfg80211_ops {
323 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 405 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
@@ -370,6 +452,9 @@ struct cfg80211_ops {
370 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 452 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
371 int idx, u8 *dst, u8 *next_hop, 453 int idx, u8 *dst, u8 *next_hop,
372 struct mpath_info *pinfo); 454 struct mpath_info *pinfo);
455
456 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
457 struct bss_parameters *params);
373}; 458};
374 459
375#endif /* __NET_CFG80211_H */ 460#endif /* __NET_CFG80211_H */
diff --git a/include/net/cipso_ipv4.h b/include/net/cipso_ipv4.h
index a6bb94530cfd..9909774eb998 100644
--- a/include/net/cipso_ipv4.h
+++ b/include/net/cipso_ipv4.h
@@ -40,11 +40,12 @@
40#include <linux/net.h> 40#include <linux/net.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <net/netlabel.h> 42#include <net/netlabel.h>
43#include <asm/atomic.h>
43 44
44/* known doi values */ 45/* known doi values */
45#define CIPSO_V4_DOI_UNKNOWN 0x00000000 46#define CIPSO_V4_DOI_UNKNOWN 0x00000000
46 47
47/* tag types */ 48/* standard tag types */
48#define CIPSO_V4_TAG_INVALID 0 49#define CIPSO_V4_TAG_INVALID 0
49#define CIPSO_V4_TAG_RBITMAP 1 50#define CIPSO_V4_TAG_RBITMAP 1
50#define CIPSO_V4_TAG_ENUM 2 51#define CIPSO_V4_TAG_ENUM 2
@@ -52,10 +53,14 @@
52#define CIPSO_V4_TAG_PBITMAP 6 53#define CIPSO_V4_TAG_PBITMAP 6
53#define CIPSO_V4_TAG_FREEFORM 7 54#define CIPSO_V4_TAG_FREEFORM 7
54 55
56/* non-standard tag types (tags > 127) */
57#define CIPSO_V4_TAG_LOCAL 128
58
55/* doi mapping types */ 59/* doi mapping types */
56#define CIPSO_V4_MAP_UNKNOWN 0 60#define CIPSO_V4_MAP_UNKNOWN 0
57#define CIPSO_V4_MAP_STD 1 61#define CIPSO_V4_MAP_TRANS 1
58#define CIPSO_V4_MAP_PASS 2 62#define CIPSO_V4_MAP_PASS 2
63#define CIPSO_V4_MAP_LOCAL 3
59 64
60/* limits */ 65/* limits */
61#define CIPSO_V4_MAX_REM_LVLS 255 66#define CIPSO_V4_MAX_REM_LVLS 255
@@ -79,10 +84,9 @@ struct cipso_v4_doi {
79 } map; 84 } map;
80 u8 tags[CIPSO_V4_TAG_MAXCNT]; 85 u8 tags[CIPSO_V4_TAG_MAXCNT];
81 86
82 u32 valid; 87 atomic_t refcount;
83 struct list_head list; 88 struct list_head list;
84 struct rcu_head rcu; 89 struct rcu_head rcu;
85 struct list_head dom_list;
86}; 90};
87 91
88/* Standard CIPSO mapping table */ 92/* Standard CIPSO mapping table */
@@ -128,25 +132,26 @@ extern int cipso_v4_rbm_strictvalid;
128 132
129#ifdef CONFIG_NETLABEL 133#ifdef CONFIG_NETLABEL
130int cipso_v4_doi_add(struct cipso_v4_doi *doi_def); 134int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
131int cipso_v4_doi_remove(u32 doi, 135void cipso_v4_doi_free(struct cipso_v4_doi *doi_def);
132 struct netlbl_audit *audit_info, 136int cipso_v4_doi_remove(u32 doi, struct netlbl_audit *audit_info);
133 void (*callback) (struct rcu_head * head));
134struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi); 137struct cipso_v4_doi *cipso_v4_doi_getdef(u32 doi);
138void cipso_v4_doi_putdef(struct cipso_v4_doi *doi_def);
135int cipso_v4_doi_walk(u32 *skip_cnt, 139int cipso_v4_doi_walk(u32 *skip_cnt,
136 int (*callback) (struct cipso_v4_doi *doi_def, void *arg), 140 int (*callback) (struct cipso_v4_doi *doi_def, void *arg),
137 void *cb_arg); 141 void *cb_arg);
138int cipso_v4_doi_domhsh_add(struct cipso_v4_doi *doi_def, const char *domain);
139int cipso_v4_doi_domhsh_remove(struct cipso_v4_doi *doi_def,
140 const char *domain);
141#else 142#else
142static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def) 143static inline int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
143{ 144{
144 return -ENOSYS; 145 return -ENOSYS;
145} 146}
146 147
148static inline void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
149{
150 return;
151}
152
147static inline int cipso_v4_doi_remove(u32 doi, 153static inline int cipso_v4_doi_remove(u32 doi,
148 struct netlbl_audit *audit_info, 154 struct netlbl_audit *audit_info)
149 void (*callback) (struct rcu_head * head))
150{ 155{
151 return 0; 156 return 0;
152} 157}
@@ -206,10 +211,15 @@ void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway);
206int cipso_v4_sock_setattr(struct sock *sk, 211int cipso_v4_sock_setattr(struct sock *sk,
207 const struct cipso_v4_doi *doi_def, 212 const struct cipso_v4_doi *doi_def,
208 const struct netlbl_lsm_secattr *secattr); 213 const struct netlbl_lsm_secattr *secattr);
214void cipso_v4_sock_delattr(struct sock *sk);
209int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr); 215int cipso_v4_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr);
216int cipso_v4_skbuff_setattr(struct sk_buff *skb,
217 const struct cipso_v4_doi *doi_def,
218 const struct netlbl_lsm_secattr *secattr);
219int cipso_v4_skbuff_delattr(struct sk_buff *skb);
210int cipso_v4_skbuff_getattr(const struct sk_buff *skb, 220int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
211 struct netlbl_lsm_secattr *secattr); 221 struct netlbl_lsm_secattr *secattr);
212int cipso_v4_validate(unsigned char **option); 222int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option);
213#else 223#else
214static inline void cipso_v4_error(struct sk_buff *skb, 224static inline void cipso_v4_error(struct sk_buff *skb,
215 int error, 225 int error,
@@ -225,19 +235,36 @@ static inline int cipso_v4_sock_setattr(struct sock *sk,
225 return -ENOSYS; 235 return -ENOSYS;
226} 236}
227 237
238static inline void cipso_v4_sock_delattr(struct sock *sk)
239{
240}
241
228static inline int cipso_v4_sock_getattr(struct sock *sk, 242static inline int cipso_v4_sock_getattr(struct sock *sk,
229 struct netlbl_lsm_secattr *secattr) 243 struct netlbl_lsm_secattr *secattr)
230{ 244{
231 return -ENOSYS; 245 return -ENOSYS;
232} 246}
233 247
248static inline int cipso_v4_skbuff_setattr(struct sk_buff *skb,
249 const struct cipso_v4_doi *doi_def,
250 const struct netlbl_lsm_secattr *secattr)
251{
252 return -ENOSYS;
253}
254
255static inline int cipso_v4_skbuff_delattr(struct sk_buff *skb)
256{
257 return -ENOSYS;
258}
259
234static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb, 260static inline int cipso_v4_skbuff_getattr(const struct sk_buff *skb,
235 struct netlbl_lsm_secattr *secattr) 261 struct netlbl_lsm_secattr *secattr)
236{ 262{
237 return -ENOSYS; 263 return -ENOSYS;
238} 264}
239 265
240static inline int cipso_v4_validate(unsigned char **option) 266static inline int cipso_v4_validate(const struct sk_buff *skb,
267 unsigned char **option)
241{ 268{
242 return -ENOSYS; 269 return -ENOSYS;
243} 270}
diff --git a/include/net/dsa.h b/include/net/dsa.h
new file mode 100644
index 000000000000..52e97bfca5a1
--- /dev/null
+++ b/include/net/dsa.h
@@ -0,0 +1,37 @@
1/*
2 * include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
3 * Copyright (c) 2008 Marvell Semiconductor
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef __LINUX_NET_DSA_H
12#define __LINUX_NET_DSA_H
13
14#define DSA_MAX_PORTS 12
15
16struct dsa_platform_data {
17 /*
18 * Reference to a Linux network interface that connects
19 * to the switch chip.
20 */
21 struct device *netdev;
22
23 /*
24 * How to access the switch configuration registers, and
25 * the names of the switch ports (use "cpu" to designate
26 * the switch port that the cpu is connected to).
27 */
28 struct device *mii_bus;
29 int sw_addr;
30 char *port_names[DSA_MAX_PORTS];
31};
32
33extern bool dsa_uses_dsa_tags(void *dsa_ptr);
34extern bool dsa_uses_trailer_tags(void *dsa_ptr);
35
36
37#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 228b2477ceec..b45a5e4fcadd 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -47,6 +47,8 @@ struct flowi {
47#define fl4_scope nl_u.ip4_u.scope 47#define fl4_scope nl_u.ip4_u.scope
48 48
49 __u8 proto; 49 __u8 proto;
50 __u8 flags;
51#define FLOWI_FLAG_ANYSRC 0x01
50 union { 52 union {
51 struct { 53 struct {
52 __be16 sport; 54 __be16 sport;
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index b31399e1fd83..93a56de3594b 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -114,7 +114,7 @@ extern u32 ieee80211_debug_level;
114#define IEEE80211_DEBUG(level, fmt, args...) \ 114#define IEEE80211_DEBUG(level, fmt, args...) \
115do { if (ieee80211_debug_level & (level)) \ 115do { if (ieee80211_debug_level & (level)) \
116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ 116 printk(KERN_DEBUG "ieee80211: %c %s " fmt, \
117 in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) 117 in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
118static inline bool ieee80211_ratelimit_debug(u32 level) 118static inline bool ieee80211_ratelimit_debug(u32 level)
119{ 119{
120 return (ieee80211_debug_level & level) && net_ratelimit(); 120 return (ieee80211_debug_level & level) && net_ratelimit();
@@ -190,10 +190,6 @@ const char *escape_essid(const char *essid, u8 essid_len);
190#endif 190#endif
191#include <net/iw_handler.h> /* new driver API */ 191#include <net/iw_handler.h> /* new driver API */
192 192
193#ifndef ETH_P_PAE
194#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
195#endif /* ETH_P_PAE */
196
197#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ 193#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
198 194
199#ifndef ETH_P_80211_RAW 195#ifndef ETH_P_80211_RAW
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index e48989f04c24..f74665d7bea8 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -91,6 +91,21 @@ static inline struct sock *__inet6_lookup(struct net *net,
91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif); 91 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
92} 92}
93 93
94static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
95 struct sk_buff *skb,
96 const __be16 sport,
97 const __be16 dport)
98{
99 struct sock *sk;
100
101 if (unlikely(sk = skb_steal_sock(skb)))
102 return sk;
103 else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo,
104 &ipv6_hdr(skb)->saddr, sport,
105 &ipv6_hdr(skb)->daddr, ntohs(dport),
106 inet6_iif(skb));
107}
108
94extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 109extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
95 const struct in6_addr *saddr, const __be16 sport, 110 const struct in6_addr *saddr, const __be16 sport,
96 const struct in6_addr *daddr, const __be16 dport, 111 const struct in6_addr *daddr, const __be16 dport,
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 2ff545a56fb5..03cffd9f64e3 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -51,12 +51,14 @@ struct inet_connection_sock_af_ops {
51 char __user *optval, int optlen); 51 char __user *optval, int optlen);
52 int (*getsockopt)(struct sock *sk, int level, int optname, 52 int (*getsockopt)(struct sock *sk, int level, int optname,
53 char __user *optval, int __user *optlen); 53 char __user *optval, int __user *optlen);
54#ifdef CONFIG_COMPAT
54 int (*compat_setsockopt)(struct sock *sk, 55 int (*compat_setsockopt)(struct sock *sk,
55 int level, int optname, 56 int level, int optname,
56 char __user *optval, int optlen); 57 char __user *optval, int optlen);
57 int (*compat_getsockopt)(struct sock *sk, 58 int (*compat_getsockopt)(struct sock *sk,
58 int level, int optname, 59 int level, int optname,
59 char __user *optval, int __user *optlen); 60 char __user *optval, int __user *optlen);
61#endif
60 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
61 int (*bind_conflict)(const struct sock *sk, 63 int (*bind_conflict)(const struct sock *sk,
62 const struct inet_bind_bucket *tb); 64 const struct inet_bind_bucket *tb);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index bb619d80f2e2..5cc182f9ecae 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -16,6 +16,7 @@
16 16
17 17
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/ip.h>
19#include <linux/ipv6.h> 20#include <linux/ipv6.h>
20#include <linux/list.h> 21#include <linux/list.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
@@ -28,6 +29,7 @@
28#include <net/inet_connection_sock.h> 29#include <net/inet_connection_sock.h>
29#include <net/inet_sock.h> 30#include <net/inet_sock.h>
30#include <net/sock.h> 31#include <net/sock.h>
32#include <net/route.h>
31#include <net/tcp_states.h> 33#include <net/tcp_states.h>
32#include <net/netns/hash.h> 34#include <net/netns/hash.h>
33 35
@@ -371,6 +373,22 @@ static inline struct sock *inet_lookup(struct net *net,
371 return sk; 373 return sk;
372} 374}
373 375
376static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
377 struct sk_buff *skb,
378 const __be16 sport,
379 const __be16 dport)
380{
381 struct sock *sk;
382 const struct iphdr *iph = ip_hdr(skb);
383
384 if (unlikely(sk = skb_steal_sock(skb)))
385 return sk;
386 else
387 return __inet_lookup(dev_net(skb->dst->dev), hashinfo,
388 iph->saddr, sport,
389 iph->daddr, dport, inet_iif(skb));
390}
391
374extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 392extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
375 struct sock *sk, u32 port_offset, 393 struct sock *sk, u32 port_offset,
376 int (*check_established)(struct inet_timewait_death_row *, 394 int (*check_established)(struct inet_timewait_death_row *,
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 643e26be058e..de0ecc71cf03 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -24,7 +24,6 @@
24#include <net/flow.h> 24#include <net/flow.h>
25#include <net/sock.h> 25#include <net/sock.h>
26#include <net/request_sock.h> 26#include <net/request_sock.h>
27#include <net/route.h>
28#include <net/netns/hash.h> 27#include <net/netns/hash.h>
29 28
30/** struct ip_options - IP Options 29/** struct ip_options - IP Options
@@ -62,8 +61,8 @@ struct inet_request_sock {
62 struct request_sock req; 61 struct request_sock req;
63#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 62#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
64 u16 inet6_rsk_offset; 63 u16 inet6_rsk_offset;
65 /* 2 bytes hole, try to pack */
66#endif 64#endif
65 __be16 loc_port;
67 __be32 loc_addr; 66 __be32 loc_addr;
68 __be32 rmt_addr; 67 __be32 rmt_addr;
69 __be16 rmt_port; 68 __be16 rmt_port;
@@ -73,7 +72,8 @@ struct inet_request_sock {
73 sack_ok : 1, 72 sack_ok : 1,
74 wscale_ok : 1, 73 wscale_ok : 1,
75 ecn_ok : 1, 74 ecn_ok : 1,
76 acked : 1; 75 acked : 1,
76 no_srccheck: 1;
77 struct ip_options *opt; 77 struct ip_options *opt;
78}; 78};
79 79
@@ -129,7 +129,8 @@ struct inet_sock {
129 is_icsk:1, 129 is_icsk:1,
130 freebind:1, 130 freebind:1,
131 hdrincl:1, 131 hdrincl:1,
132 mc_loop:1; 132 mc_loop:1,
133 transparent:1;
133 int mc_index; 134 int mc_index;
134 __be32 mc_addr; 135 __be32 mc_addr;
135 struct ip_mc_socklist *mc_list; 136 struct ip_mc_socklist *mc_list;
@@ -194,12 +195,6 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
194 return inet_ehashfn(net, laddr, lport, faddr, fport); 195 return inet_ehashfn(net, laddr, lport, faddr, fport);
195} 196}
196 197
197
198static inline int inet_iif(const struct sk_buff *skb)
199{
200 return skb->rtable->rt_iif;
201}
202
203static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 198static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
204{ 199{
205 struct request_sock *req = reqsk_alloc(ops); 200 struct request_sock *req = reqsk_alloc(ops);
@@ -210,4 +205,9 @@ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops
210 return req; 205 return req;
211} 206}
212 207
208static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
209{
210 return inet_sk(sk)->transparent ? FLOWI_FLAG_ANYSRC : 0;
211}
212
213#endif /* _INET_SOCK_H */ 213#endif /* _INET_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 91324908fccd..80e4977631b8 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -128,7 +128,8 @@ struct inet_timewait_sock {
128 __be16 tw_dport; 128 __be16 tw_dport;
129 __u16 tw_num; 129 __u16 tw_num;
130 /* And these are ours. */ 130 /* And these are ours. */
131 __u8 tw_ipv6only:1; 131 __u8 tw_ipv6only:1,
132 tw_transparent:1;
132 /* 15 bits hole, try to pack */ 133 /* 15 bits hole, try to pack */
133 __u16 tw_ipv6_offset; 134 __u16 tw_ipv6_offset;
134 unsigned long tw_ttd; 135 unsigned long tw_ttd;
diff --git a/include/net/ip.h b/include/net/ip.h
index 250e6ef025a4..bc026ecb513f 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -29,6 +29,7 @@
29 29
30#include <net/inet_sock.h> 30#include <net/inet_sock.h>
31#include <net/snmp.h> 31#include <net/snmp.h>
32#include <net/flow.h>
32 33
33struct sock; 34struct sock;
34 35
@@ -140,12 +141,20 @@ static inline void ip_tr_mc_map(__be32 addr, char *buf)
140 141
141struct ip_reply_arg { 142struct ip_reply_arg {
142 struct kvec iov[1]; 143 struct kvec iov[1];
144 int flags;
143 __wsum csum; 145 __wsum csum;
144 int csumoffset; /* u16 offset of csum in iov[0].iov_base */ 146 int csumoffset; /* u16 offset of csum in iov[0].iov_base */
145 /* -1 if not needed */ 147 /* -1 if not needed */
146 int bound_dev_if; 148 int bound_dev_if;
147}; 149};
148 150
151#define IP_REPLY_ARG_NOSRCCHECK 1
152
153static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
154{
155 return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
156}
157
149void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, 158void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
150 unsigned int len); 159 unsigned int len);
151 160
@@ -169,6 +178,10 @@ extern unsigned long snmp_fold_field(void *mib[], int offt);
169extern int snmp_mib_init(void *ptr[2], size_t mibsize); 178extern int snmp_mib_init(void *ptr[2], size_t mibsize);
170extern void snmp_mib_free(void *ptr[2]); 179extern void snmp_mib_free(void *ptr[2]);
171 180
181extern struct local_ports {
182 seqlock_t lock;
183 int range[2];
184} sysctl_local_ports;
172extern void inet_get_local_port_range(int *low, int *high); 185extern void inet_get_local_port_range(int *low, int *high);
173 186
174extern int sysctl_ip_default_ttl; 187extern int sysctl_ip_default_ttl;
@@ -383,7 +396,7 @@ extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
383int ipv4_doint_and_flush(ctl_table *ctl, int write, 396int ipv4_doint_and_flush(ctl_table *ctl, int write,
384 struct file* filp, void __user *buffer, 397 struct file* filp, void __user *buffer,
385 size_t *lenp, loff_t *ppos); 398 size_t *lenp, loff_t *ppos);
386int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, 399int ipv4_doint_and_flush_strategy(ctl_table *table,
387 void __user *oldval, size_t __user *oldlenp, 400 void __user *oldval, size_t __user *oldlenp,
388 void __user *newval, size_t newlen); 401 void __user *newval, size_t newlen);
389#ifdef CONFIG_PROC_FS 402#ifdef CONFIG_PROC_FS
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 7312c3dd309f..fe9fcf73c85e 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -21,11 +21,104 @@
21#include <linux/timer.h> 21#include <linux/timer.h>
22 22
23#include <net/checksum.h> 23#include <net/checksum.h>
24#include <linux/netfilter.h> /* for union nf_inet_addr */
25#include <linux/ip.h>
26#include <linux/ipv6.h> /* for struct ipv6hdr */
27#include <net/ipv6.h> /* for ipv6_addr_copy */
28
29struct ip_vs_iphdr {
30 int len;
31 __u8 protocol;
32 union nf_inet_addr saddr;
33 union nf_inet_addr daddr;
34};
35
36static inline void
37ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr)
38{
39#ifdef CONFIG_IP_VS_IPV6
40 if (af == AF_INET6) {
41 const struct ipv6hdr *iph = nh;
42 iphdr->len = sizeof(struct ipv6hdr);
43 iphdr->protocol = iph->nexthdr;
44 ipv6_addr_copy(&iphdr->saddr.in6, &iph->saddr);
45 ipv6_addr_copy(&iphdr->daddr.in6, &iph->daddr);
46 } else
47#endif
48 {
49 const struct iphdr *iph = nh;
50 iphdr->len = iph->ihl * 4;
51 iphdr->protocol = iph->protocol;
52 iphdr->saddr.ip = iph->saddr;
53 iphdr->daddr.ip = iph->daddr;
54 }
55}
56
57static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
58 const union nf_inet_addr *src)
59{
60#ifdef CONFIG_IP_VS_IPV6
61 if (af == AF_INET6)
62 ipv6_addr_copy(&dst->in6, &src->in6);
63 else
64#endif
65 dst->ip = src->ip;
66}
67
68static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
69 const union nf_inet_addr *b)
70{
71#ifdef CONFIG_IP_VS_IPV6
72 if (af == AF_INET6)
73 return ipv6_addr_equal(&a->in6, &b->in6);
74#endif
75 return a->ip == b->ip;
76}
24 77
25#ifdef CONFIG_IP_VS_DEBUG 78#ifdef CONFIG_IP_VS_DEBUG
26#include <linux/net.h> 79#include <linux/net.h>
27 80
28extern int ip_vs_get_debug_level(void); 81extern int ip_vs_get_debug_level(void);
82
83static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
84 const union nf_inet_addr *addr,
85 int *idx)
86{
87 int len;
88#ifdef CONFIG_IP_VS_IPV6
89 if (af == AF_INET6)
90 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]",
91 NIP6(addr->in6)) + 1;
92 else
93#endif
94 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT,
95 NIPQUAD(addr->ip)) + 1;
96
97 *idx += len;
98 BUG_ON(*idx > buf_len + 1);
99 return &buf[*idx - len];
100}
101
102#define IP_VS_DBG_BUF(level, msg...) \
103 do { \
104 char ip_vs_dbg_buf[160]; \
105 int ip_vs_dbg_idx = 0; \
106 if (level <= ip_vs_get_debug_level()) \
107 printk(KERN_DEBUG "IPVS: " msg); \
108 } while (0)
109#define IP_VS_ERR_BUF(msg...) \
110 do { \
111 char ip_vs_dbg_buf[160]; \
112 int ip_vs_dbg_idx = 0; \
113 printk(KERN_ERR "IPVS: " msg); \
114 } while (0)
115
116/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
117#define IP_VS_DBG_ADDR(af, addr) \
118 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
119 sizeof(ip_vs_dbg_buf), addr, \
120 &ip_vs_dbg_idx)
121
29#define IP_VS_DBG(level, msg...) \ 122#define IP_VS_DBG(level, msg...) \
30 do { \ 123 do { \
31 if (level <= ip_vs_get_debug_level()) \ 124 if (level <= ip_vs_get_debug_level()) \
@@ -48,6 +141,8 @@ extern int ip_vs_get_debug_level(void);
48 pp->debug_packet(pp, skb, ofs, msg); \ 141 pp->debug_packet(pp, skb, ofs, msg); \
49 } while (0) 142 } while (0)
50#else /* NO DEBUGGING at ALL */ 143#else /* NO DEBUGGING at ALL */
144#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
145#define IP_VS_ERR_BUF(msg...) do {} while (0)
51#define IP_VS_DBG(level, msg...) do {} while (0) 146#define IP_VS_DBG(level, msg...) do {} while (0)
52#define IP_VS_DBG_RL(msg...) do {} while (0) 147#define IP_VS_DBG_RL(msg...) do {} while (0)
53#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0) 148#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0)
@@ -70,13 +165,13 @@ extern int ip_vs_get_debug_level(void);
70 do { \ 165 do { \
71 if (level <= ip_vs_get_debug_level()) \ 166 if (level <= ip_vs_get_debug_level()) \
72 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ 167 printk(KERN_DEBUG "Enter: %s, %s line %i\n", \
73 __FUNCTION__, __FILE__, __LINE__); \ 168 __func__, __FILE__, __LINE__); \
74 } while (0) 169 } while (0)
75#define LeaveFunction(level) \ 170#define LeaveFunction(level) \
76 do { \ 171 do { \
77 if (level <= ip_vs_get_debug_level()) \ 172 if (level <= ip_vs_get_debug_level()) \
78 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ 173 printk(KERN_DEBUG "Leave: %s, %s line %i\n", \
79 __FUNCTION__, __FILE__, __LINE__); \ 174 __func__, __FILE__, __LINE__); \
80 } while (0) 175 } while (0)
81#else 176#else
82#define EnterFunction(level) do {} while (0) 177#define EnterFunction(level) do {} while (0)
@@ -160,27 +255,10 @@ struct ip_vs_estimator {
160 255
161struct ip_vs_stats 256struct ip_vs_stats
162{ 257{
163 __u32 conns; /* connections scheduled */ 258 struct ip_vs_stats_user ustats; /* statistics */
164 __u32 inpkts; /* incoming packets */ 259 struct ip_vs_estimator est; /* estimator */
165 __u32 outpkts; /* outgoing packets */
166 __u64 inbytes; /* incoming bytes */
167 __u64 outbytes; /* outgoing bytes */
168
169 __u32 cps; /* current connection rate */
170 __u32 inpps; /* current in packet rate */
171 __u32 outpps; /* current out packet rate */
172 __u32 inbps; /* current in byte rate */
173 __u32 outbps; /* current out byte rate */
174
175 /*
176 * Don't add anything before the lock, because we use memcpy() to copy
177 * the members before the lock to struct ip_vs_stats_user in
178 * ip_vs_ctl.c.
179 */
180 260
181 spinlock_t lock; /* spin lock */ 261 spinlock_t lock; /* spin lock */
182
183 struct ip_vs_estimator est; /* estimator */
184}; 262};
185 263
186struct dst_entry; 264struct dst_entry;
@@ -202,21 +280,23 @@ struct ip_vs_protocol {
202 280
203 void (*exit)(struct ip_vs_protocol *pp); 281 void (*exit)(struct ip_vs_protocol *pp);
204 282
205 int (*conn_schedule)(struct sk_buff *skb, 283 int (*conn_schedule)(int af, struct sk_buff *skb,
206 struct ip_vs_protocol *pp, 284 struct ip_vs_protocol *pp,
207 int *verdict, struct ip_vs_conn **cpp); 285 int *verdict, struct ip_vs_conn **cpp);
208 286
209 struct ip_vs_conn * 287 struct ip_vs_conn *
210 (*conn_in_get)(const struct sk_buff *skb, 288 (*conn_in_get)(int af,
289 const struct sk_buff *skb,
211 struct ip_vs_protocol *pp, 290 struct ip_vs_protocol *pp,
212 const struct iphdr *iph, 291 const struct ip_vs_iphdr *iph,
213 unsigned int proto_off, 292 unsigned int proto_off,
214 int inverse); 293 int inverse);
215 294
216 struct ip_vs_conn * 295 struct ip_vs_conn *
217 (*conn_out_get)(const struct sk_buff *skb, 296 (*conn_out_get)(int af,
297 const struct sk_buff *skb,
218 struct ip_vs_protocol *pp, 298 struct ip_vs_protocol *pp,
219 const struct iphdr *iph, 299 const struct ip_vs_iphdr *iph,
220 unsigned int proto_off, 300 unsigned int proto_off,
221 int inverse); 301 int inverse);
222 302
@@ -226,7 +306,8 @@ struct ip_vs_protocol {
226 int (*dnat_handler)(struct sk_buff *skb, 306 int (*dnat_handler)(struct sk_buff *skb,
227 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 307 struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
228 308
229 int (*csum_check)(struct sk_buff *skb, struct ip_vs_protocol *pp); 309 int (*csum_check)(int af, struct sk_buff *skb,
310 struct ip_vs_protocol *pp);
230 311
231 const char *(*state_name)(int state); 312 const char *(*state_name)(int state);
232 313
@@ -259,9 +340,10 @@ struct ip_vs_conn {
259 struct list_head c_list; /* hashed list heads */ 340 struct list_head c_list; /* hashed list heads */
260 341
261 /* Protocol, addresses and port numbers */ 342 /* Protocol, addresses and port numbers */
262 __be32 caddr; /* client address */ 343 u16 af; /* address family */
263 __be32 vaddr; /* virtual address */ 344 union nf_inet_addr caddr; /* client address */
264 __be32 daddr; /* destination address */ 345 union nf_inet_addr vaddr; /* virtual address */
346 union nf_inet_addr daddr; /* destination address */
265 __be16 cport; 347 __be16 cport;
266 __be16 vport; 348 __be16 vport;
267 __be16 dport; 349 __be16 dport;
@@ -305,6 +387,45 @@ struct ip_vs_conn {
305 387
306 388
307/* 389/*
390 * Extended internal versions of struct ip_vs_service_user and
391 * ip_vs_dest_user for IPv6 support.
392 *
393 * We need these to conveniently pass around service and destination
394 * options, but unfortunately, we also need to keep the old definitions to
395 * maintain userspace backwards compatibility for the setsockopt interface.
396 */
397struct ip_vs_service_user_kern {
398 /* virtual service addresses */
399 u16 af;
400 u16 protocol;
401 union nf_inet_addr addr; /* virtual ip address */
402 u16 port;
403 u32 fwmark; /* firwall mark of service */
404
405 /* virtual service options */
406 char *sched_name;
407 unsigned flags; /* virtual service flags */
408 unsigned timeout; /* persistent timeout in sec */
409 u32 netmask; /* persistent netmask */
410};
411
412
413struct ip_vs_dest_user_kern {
414 /* destination server address */
415 union nf_inet_addr addr;
416 u16 port;
417
418 /* real server options */
419 unsigned conn_flags; /* connection flags */
420 int weight; /* destination weight */
421
422 /* thresholds for active connections */
423 u32 u_threshold; /* upper threshold */
424 u32 l_threshold; /* lower threshold */
425};
426
427
428/*
308 * The information about the virtual service offered to the net 429 * The information about the virtual service offered to the net
309 * and the forwarding entries 430 * and the forwarding entries
310 */ 431 */
@@ -314,8 +435,9 @@ struct ip_vs_service {
314 atomic_t refcnt; /* reference counter */ 435 atomic_t refcnt; /* reference counter */
315 atomic_t usecnt; /* use counter */ 436 atomic_t usecnt; /* use counter */
316 437
438 u16 af; /* address family */
317 __u16 protocol; /* which protocol (TCP/UDP) */ 439 __u16 protocol; /* which protocol (TCP/UDP) */
318 __be32 addr; /* IP address for virtual service */ 440 union nf_inet_addr addr; /* IP address for virtual service */
319 __be16 port; /* port number for the service */ 441 __be16 port; /* port number for the service */
320 __u32 fwmark; /* firewall mark of the service */ 442 __u32 fwmark; /* firewall mark of the service */
321 unsigned flags; /* service status flags */ 443 unsigned flags; /* service status flags */
@@ -342,7 +464,8 @@ struct ip_vs_dest {
342 struct list_head n_list; /* for the dests in the service */ 464 struct list_head n_list; /* for the dests in the service */
343 struct list_head d_list; /* for table with all the dests */ 465 struct list_head d_list; /* for table with all the dests */
344 466
345 __be32 addr; /* IP address of the server */ 467 u16 af; /* address family */
468 union nf_inet_addr addr; /* IP address of the server */
346 __be16 port; /* port number of the server */ 469 __be16 port; /* port number of the server */
347 volatile unsigned flags; /* dest status flags */ 470 volatile unsigned flags; /* dest status flags */
348 atomic_t conn_flags; /* flags to copy to conn */ 471 atomic_t conn_flags; /* flags to copy to conn */
@@ -366,7 +489,7 @@ struct ip_vs_dest {
366 /* for virtual service */ 489 /* for virtual service */
367 struct ip_vs_service *svc; /* service it belongs to */ 490 struct ip_vs_service *svc; /* service it belongs to */
368 __u16 protocol; /* which protocol (TCP/UDP) */ 491 __u16 protocol; /* which protocol (TCP/UDP) */
369 __be32 vaddr; /* virtual IP address */ 492 union nf_inet_addr vaddr; /* virtual IP address */
370 __be16 vport; /* virtual port number */ 493 __be16 vport; /* virtual port number */
371 __u32 vfwmark; /* firewall mark of service */ 494 __u32 vfwmark; /* firewall mark of service */
372}; 495};
@@ -380,6 +503,9 @@ struct ip_vs_scheduler {
380 char *name; /* scheduler name */ 503 char *name; /* scheduler name */
381 atomic_t refcnt; /* reference counter */ 504 atomic_t refcnt; /* reference counter */
382 struct module *module; /* THIS_MODULE/NULL */ 505 struct module *module; /* THIS_MODULE/NULL */
506#ifdef CONFIG_IP_VS_IPV6
507 int supports_ipv6; /* scheduler has IPv6 support */
508#endif
383 509
384 /* scheduler initializing service */ 510 /* scheduler initializing service */
385 int (*init_service)(struct ip_vs_service *svc); 511 int (*init_service)(struct ip_vs_service *svc);
@@ -479,16 +605,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
479#ifndef CONFIG_IP_VS_TAB_BITS 605#ifndef CONFIG_IP_VS_TAB_BITS
480#define CONFIG_IP_VS_TAB_BITS 12 606#define CONFIG_IP_VS_TAB_BITS 12
481#endif 607#endif
482/* make sure that IP_VS_CONN_TAB_BITS is located in [8, 20] */ 608
483#if CONFIG_IP_VS_TAB_BITS < 8
484#define IP_VS_CONN_TAB_BITS 8
485#endif
486#if CONFIG_IP_VS_TAB_BITS > 20
487#define IP_VS_CONN_TAB_BITS 20
488#endif
489#if 8 <= CONFIG_IP_VS_TAB_BITS && CONFIG_IP_VS_TAB_BITS <= 20
490#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS 609#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
491#endif
492#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS) 610#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
493#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1) 611#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
494 612
@@ -500,11 +618,16 @@ enum {
500}; 618};
501 619
502extern struct ip_vs_conn *ip_vs_conn_in_get 620extern struct ip_vs_conn *ip_vs_conn_in_get
503(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 621(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
622 const union nf_inet_addr *d_addr, __be16 d_port);
623
504extern struct ip_vs_conn *ip_vs_ct_in_get 624extern struct ip_vs_conn *ip_vs_ct_in_get
505(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 625(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
626 const union nf_inet_addr *d_addr, __be16 d_port);
627
506extern struct ip_vs_conn *ip_vs_conn_out_get 628extern struct ip_vs_conn *ip_vs_conn_out_get
507(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 629(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
630 const union nf_inet_addr *d_addr, __be16 d_port);
508 631
509/* put back the conn without restarting its timer */ 632/* put back the conn without restarting its timer */
510static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 633static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
@@ -515,8 +638,9 @@ extern void ip_vs_conn_put(struct ip_vs_conn *cp);
515extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 638extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
516 639
517extern struct ip_vs_conn * 640extern struct ip_vs_conn *
518ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, 641ip_vs_conn_new(int af, int proto, const union nf_inet_addr *caddr, __be16 cport,
519 __be32 daddr, __be16 dport, unsigned flags, 642 const union nf_inet_addr *vaddr, __be16 vport,
643 const union nf_inet_addr *daddr, __be16 dport, unsigned flags,
520 struct ip_vs_dest *dest); 644 struct ip_vs_dest *dest);
521extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 645extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
522 646
@@ -532,24 +656,32 @@ static inline void ip_vs_control_del(struct ip_vs_conn *cp)
532{ 656{
533 struct ip_vs_conn *ctl_cp = cp->control; 657 struct ip_vs_conn *ctl_cp = cp->control;
534 if (!ctl_cp) { 658 if (!ctl_cp) {
535 IP_VS_ERR("request control DEL for uncontrolled: " 659 IP_VS_ERR_BUF("request control DEL for uncontrolled: "
536 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 660 "%s:%d to %s:%d\n",
537 NIPQUAD(cp->caddr),ntohs(cp->cport), 661 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
538 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 662 ntohs(cp->cport),
663 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
664 ntohs(cp->vport));
665
539 return; 666 return;
540 } 667 }
541 668
542 IP_VS_DBG(7, "DELeting control for: " 669 IP_VS_DBG_BUF(7, "DELeting control for: "
543 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 670 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
544 NIPQUAD(cp->caddr),ntohs(cp->cport), 671 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
545 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 672 ntohs(cp->cport),
673 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
674 ntohs(ctl_cp->cport));
546 675
547 cp->control = NULL; 676 cp->control = NULL;
548 if (atomic_read(&ctl_cp->n_control) == 0) { 677 if (atomic_read(&ctl_cp->n_control) == 0) {
549 IP_VS_ERR("BUG control DEL with n=0 : " 678 IP_VS_ERR_BUF("BUG control DEL with n=0 : "
550 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 679 "%s:%d to %s:%d\n",
551 NIPQUAD(cp->caddr),ntohs(cp->cport), 680 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
552 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 681 ntohs(cp->cport),
682 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
683 ntohs(cp->vport));
684
553 return; 685 return;
554 } 686 }
555 atomic_dec(&ctl_cp->n_control); 687 atomic_dec(&ctl_cp->n_control);
@@ -559,17 +691,22 @@ static inline void
559ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) 691ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
560{ 692{
561 if (cp->control) { 693 if (cp->control) {
562 IP_VS_ERR("request control ADD for already controlled: " 694 IP_VS_ERR_BUF("request control ADD for already controlled: "
563 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 695 "%s:%d to %s:%d\n",
564 NIPQUAD(cp->caddr),ntohs(cp->cport), 696 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
565 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 697 ntohs(cp->cport),
698 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
699 ntohs(cp->vport));
700
566 ip_vs_control_del(cp); 701 ip_vs_control_del(cp);
567 } 702 }
568 703
569 IP_VS_DBG(7, "ADDing control for: " 704 IP_VS_DBG_BUF(7, "ADDing control for: "
570 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 705 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
571 NIPQUAD(cp->caddr),ntohs(cp->cport), 706 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
572 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 707 ntohs(cp->cport),
708 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
709 ntohs(ctl_cp->cport));
573 710
574 cp->control = ctl_cp; 711 cp->control = ctl_cp;
575 atomic_inc(&ctl_cp->n_control); 712 atomic_inc(&ctl_cp->n_control);
@@ -647,7 +784,8 @@ extern struct ip_vs_stats ip_vs_stats;
647extern const struct ctl_path net_vs_ctl_path[]; 784extern const struct ctl_path net_vs_ctl_path[];
648 785
649extern struct ip_vs_service * 786extern struct ip_vs_service *
650ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); 787ip_vs_service_get(int af, __u32 fwmark, __u16 protocol,
788 const union nf_inet_addr *vaddr, __be16 vport);
651 789
652static inline void ip_vs_service_put(struct ip_vs_service *svc) 790static inline void ip_vs_service_put(struct ip_vs_service *svc)
653{ 791{
@@ -655,14 +793,16 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
655} 793}
656 794
657extern struct ip_vs_dest * 795extern struct ip_vs_dest *
658ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport); 796ip_vs_lookup_real_service(int af, __u16 protocol,
797 const union nf_inet_addr *daddr, __be16 dport);
798
659extern int ip_vs_use_count_inc(void); 799extern int ip_vs_use_count_inc(void);
660extern void ip_vs_use_count_dec(void); 800extern void ip_vs_use_count_dec(void);
661extern int ip_vs_control_init(void); 801extern int ip_vs_control_init(void);
662extern void ip_vs_control_cleanup(void); 802extern void ip_vs_control_cleanup(void);
663extern struct ip_vs_dest * 803extern struct ip_vs_dest *
664ip_vs_find_dest(__be32 daddr, __be16 dport, 804ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport,
665 __be32 vaddr, __be16 vport, __u16 protocol); 805 const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol);
666extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 806extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
667 807
668 808
@@ -683,6 +823,8 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
683/* 823/*
684 * IPVS rate estimator prototypes (from ip_vs_est.c) 824 * IPVS rate estimator prototypes (from ip_vs_est.c)
685 */ 825 */
826extern int ip_vs_estimator_init(void);
827extern void ip_vs_estimator_cleanup(void);
686extern void ip_vs_new_estimator(struct ip_vs_stats *stats); 828extern void ip_vs_new_estimator(struct ip_vs_stats *stats);
687extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); 829extern void ip_vs_kill_estimator(struct ip_vs_stats *stats);
688extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 830extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
@@ -704,6 +846,19 @@ extern int ip_vs_icmp_xmit
704(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset); 846(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset);
705extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 847extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
706 848
849#ifdef CONFIG_IP_VS_IPV6
850extern int ip_vs_bypass_xmit_v6
851(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
852extern int ip_vs_nat_xmit_v6
853(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
854extern int ip_vs_tunnel_xmit_v6
855(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
856extern int ip_vs_dr_xmit_v6
857(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
858extern int ip_vs_icmp_xmit_v6
859(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp,
860 int offset);
861#endif
707 862
708/* 863/*
709 * This is a simple mechanism to ignore packets when 864 * This is a simple mechanism to ignore packets when
@@ -748,7 +903,12 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
748} 903}
749 904
750extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 905extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
751 struct ip_vs_conn *cp, int dir); 906 struct ip_vs_conn *cp, int dir);
907
908#ifdef CONFIG_IP_VS_IPV6
909extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,
910 struct ip_vs_conn *cp, int dir);
911#endif
752 912
753extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 913extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
754 914
@@ -759,6 +919,17 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
759 return csum_partial((char *) diff, sizeof(diff), oldsum); 919 return csum_partial((char *) diff, sizeof(diff), oldsum);
760} 920}
761 921
922#ifdef CONFIG_IP_VS_IPV6
923static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
924 __wsum oldsum)
925{
926 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
927 new[3], new[2], new[1], new[0] };
928
929 return csum_partial((char *) diff, sizeof(diff), oldsum);
930}
931#endif
932
762static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) 933static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
763{ 934{
764 __be16 diff[2] = { ~old, new }; 935 __be16 diff[2] = { ~old, new };
diff --git a/include/net/ipip.h b/include/net/ipip.h
index a85bda64b852..fdf9bd743705 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -37,7 +37,7 @@ struct ip_tunnel_prl_entry
37 37
38#define IPTUNNEL_XMIT() do { \ 38#define IPTUNNEL_XMIT() do { \
39 int err; \ 39 int err; \
40 int pkt_len = skb->len; \ 40 int pkt_len = skb->len - skb_transport_offset(skb); \
41 \ 41 \
42 skb->ip_summed = CHECKSUM_NONE; \ 42 skb->ip_summed = CHECKSUM_NONE; \
43 ip_select_ident(iph, &rt->u.dst, NULL); \ 43 ip_select_ident(iph, &rt->u.dst, NULL); \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 113028fb8f66..6d5b58a1c743 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -110,43 +110,42 @@ struct frag_hdr {
110extern int sysctl_mld_max_msf; 110extern int sysctl_mld_max_msf;
111extern struct ctl_path net_ipv6_ctl_path[]; 111extern struct ctl_path net_ipv6_ctl_path[];
112 112
113#define _DEVINC(statname, modifier, idev, field) \ 113#define _DEVINC(net, statname, modifier, idev, field) \
114({ \ 114({ \
115 struct inet6_dev *_idev = (idev); \ 115 struct inet6_dev *_idev = (idev); \
116 if (likely(_idev != NULL)) \ 116 if (likely(_idev != NULL)) \
117 SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \ 117 SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \
118 SNMP_INC_STATS##modifier(statname##_statistics, (field)); \ 118 SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
119}) 119})
120 120
121#define _DEVADD(statname, modifier, idev, field, val) \ 121#define _DEVADD(net, statname, modifier, idev, field, val) \
122({ \ 122({ \
123 struct inet6_dev *_idev = (idev); \ 123 struct inet6_dev *_idev = (idev); \
124 if (likely(_idev != NULL)) \ 124 if (likely(_idev != NULL)) \
125 SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \ 125 SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \
126 SNMP_ADD_STATS##modifier(statname##_statistics, (field), (val));\ 126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
127}) 127})
128 128
129/* MIBs */ 129/* MIBs */
130DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
131 130
132#define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field) 131#define IP6_INC_STATS(net, idev,field) \
133#define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) 132 _DEVINC(net, ipv6, , idev, field)
134#define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val) 133#define IP6_INC_STATS_BH(net, idev,field) \
135 134 _DEVINC(net, ipv6, _BH, idev, field)
136DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 135#define IP6_ADD_STATS_BH(net, idev,field,val) \
137DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 136 _DEVADD(net, ipv6, _BH, idev, field, val)
138 137
139#define ICMP6_INC_STATS(idev, field) _DEVINC(icmpv6, , idev, field) 138#define ICMP6_INC_STATS(net, idev, field) \
140#define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) 139 _DEVINC(net, icmpv6, , idev, field)
141 140#define ICMP6_INC_STATS_BH(net, idev, field) \
142#define ICMP6MSGOUT_INC_STATS(idev, field) \ 141 _DEVINC(net, icmpv6, _BH, idev, field)
143 _DEVINC(icmpv6msg, , idev, field +256) 142
144#define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ 143#define ICMP6MSGOUT_INC_STATS(net, idev, field) \
145 _DEVINC(icmpv6msg, _BH, idev, field +256) 144 _DEVINC(net, icmpv6msg, , idev, field +256)
146#define ICMP6MSGIN_INC_STATS(idev, field) \ 145#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \
147 _DEVINC(icmpv6msg, , idev, field) 146 _DEVINC(net, icmpv6msg, _BH, idev, field +256)
148#define ICMP6MSGIN_INC_STATS_BH(idev, field) \ 147#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
149 _DEVINC(icmpv6msg, _BH, idev, field) 148 _DEVINC(net, icmpv6msg, _BH, idev, field)
150 149
151struct ip6_ra_chain 150struct ip6_ra_chain
152{ 151{
@@ -576,6 +575,8 @@ extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
576extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, 575extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
577 struct group_filter __user *optval, 576 struct group_filter __user *optval,
578 int __user *optlen); 577 int __user *optlen);
578extern unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
579 const struct in6_addr *daddr, u32 rnd);
579 580
580#ifdef CONFIG_PROC_FS 581#ifdef CONFIG_PROC_FS
581extern int ac6_proc_init(struct net *net); 582extern int ac6_proc_init(struct net *net);
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 08387553b57e..7e582061b230 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -72,7 +72,7 @@ do { if (irda_debug >= (n)) \
72#define IRDA_ASSERT(expr, func) \ 72#define IRDA_ASSERT(expr, func) \
73do { if(!(expr)) { \ 73do { if(!(expr)) { \
74 printk( "Assertion failed! %s:%s:%d %s\n", \ 74 printk( "Assertion failed! %s:%s:%d %s\n", \
75 __FILE__,__FUNCTION__,__LINE__,(#expr) ); \ 75 __FILE__,__func__,__LINE__,(#expr) ); \
76 func } } while (0) 76 func } } while (0)
77#define IRDA_ASSERT_LABEL(label) label 77#define IRDA_ASSERT_LABEL(label) label
78#else 78#else
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ff137fd7714f..d861197f83c7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -158,13 +158,17 @@ struct ieee80211_low_level_stats {
158 * also implies a change in the AID. 158 * also implies a change in the AID.
159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed 159 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed 160 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
161 * @BSS_CHANGED_ERP_SLOT: slot timing changed
161 * @BSS_CHANGED_HT: 802.11n parameters changed 162 * @BSS_CHANGED_HT: 802.11n parameters changed
163 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
162 */ 164 */
163enum ieee80211_bss_change { 165enum ieee80211_bss_change {
164 BSS_CHANGED_ASSOC = 1<<0, 166 BSS_CHANGED_ASSOC = 1<<0,
165 BSS_CHANGED_ERP_CTS_PROT = 1<<1, 167 BSS_CHANGED_ERP_CTS_PROT = 1<<1,
166 BSS_CHANGED_ERP_PREAMBLE = 1<<2, 168 BSS_CHANGED_ERP_PREAMBLE = 1<<2,
169 BSS_CHANGED_ERP_SLOT = 1<<3,
167 BSS_CHANGED_HT = 1<<4, 170 BSS_CHANGED_HT = 1<<4,
171 BSS_CHANGED_BASIC_RATES = 1<<5,
168}; 172};
169 173
170/** 174/**
@@ -177,6 +181,7 @@ enum ieee80211_bss_change {
177 * @aid: association ID number, valid only when @assoc is true 181 * @aid: association ID number, valid only when @assoc is true
178 * @use_cts_prot: use CTS protection 182 * @use_cts_prot: use CTS protection
179 * @use_short_preamble: use 802.11b short preamble 183 * @use_short_preamble: use 802.11b short preamble
184 * @use_short_slot: use short slot time (only relevant for ERP)
180 * @dtim_period: num of beacons before the next DTIM, for PSM 185 * @dtim_period: num of beacons before the next DTIM, for PSM
181 * @timestamp: beacon timestamp 186 * @timestamp: beacon timestamp
182 * @beacon_int: beacon interval 187 * @beacon_int: beacon interval
@@ -184,6 +189,9 @@ enum ieee80211_bss_change {
184 * @assoc_ht: association in HT mode 189 * @assoc_ht: association in HT mode
185 * @ht_conf: ht capabilities 190 * @ht_conf: ht capabilities
186 * @ht_bss_conf: ht extended capabilities 191 * @ht_bss_conf: ht extended capabilities
192 * @basic_rates: bitmap of basic rates, each bit stands for an
193 * index into the rate table configured by the driver in
194 * the current band.
187 */ 195 */
188struct ieee80211_bss_conf { 196struct ieee80211_bss_conf {
189 /* association related data */ 197 /* association related data */
@@ -192,10 +200,12 @@ struct ieee80211_bss_conf {
192 /* erp related data */ 200 /* erp related data */
193 bool use_cts_prot; 201 bool use_cts_prot;
194 bool use_short_preamble; 202 bool use_short_preamble;
203 bool use_short_slot;
195 u8 dtim_period; 204 u8 dtim_period;
196 u16 beacon_int; 205 u16 beacon_int;
197 u16 assoc_capability; 206 u16 assoc_capability;
198 u64 timestamp; 207 u64 timestamp;
208 u64 basic_rates;
199 /* ht related data */ 209 /* ht related data */
200 bool assoc_ht; 210 bool assoc_ht;
201 struct ieee80211_ht_info *ht_conf; 211 struct ieee80211_ht_info *ht_conf;
@@ -282,6 +292,20 @@ enum mac80211_tx_control_flags {
282#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \ 292#define IEEE80211_TX_INFO_DRIVER_DATA_PTRS \
283 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)) 293 (IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *))
284 294
295/* maximum number of alternate rate retry stages */
296#define IEEE80211_TX_MAX_ALTRATE 3
297
298/**
299 * struct ieee80211_tx_altrate - alternate rate selection/status
300 *
301 * @rate_idx: rate index to attempt to send with
302 * @limit: number of retries before fallback
303 */
304struct ieee80211_tx_altrate {
305 s8 rate_idx;
306 u8 limit;
307};
308
285/** 309/**
286 * struct ieee80211_tx_info - skb transmit information 310 * struct ieee80211_tx_info - skb transmit information
287 * 311 *
@@ -290,6 +314,9 @@ enum mac80211_tx_control_flags {
290 * (2) driver internal use (if applicable) 314 * (2) driver internal use (if applicable)
291 * (3) TX status information - driver tells mac80211 what happened 315 * (3) TX status information - driver tells mac80211 what happened
292 * 316 *
317 * The TX control's sta pointer is only valid during the ->tx call,
318 * it may be NULL.
319 *
293 * @flags: transmit info flags, defined above 320 * @flags: transmit info flags, defined above
294 * @band: TBD 321 * @band: TBD
295 * @tx_rate_idx: TBD 322 * @tx_rate_idx: TBD
@@ -317,18 +344,19 @@ struct ieee80211_tx_info {
317 344
318 union { 345 union {
319 struct { 346 struct {
347 /* NB: vif can be NULL for injected frames */
320 struct ieee80211_vif *vif; 348 struct ieee80211_vif *vif;
321 struct ieee80211_key_conf *hw_key; 349 struct ieee80211_key_conf *hw_key;
350 struct ieee80211_sta *sta;
322 unsigned long jiffies; 351 unsigned long jiffies;
323 u16 aid; 352 s8 rts_cts_rate_idx;
324 s8 rts_cts_rate_idx, alt_retry_rate_idx;
325 u8 retry_limit; 353 u8 retry_limit;
326 u8 icv_len; 354 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE];
327 u8 iv_len;
328 } control; 355 } control;
329 struct { 356 struct {
330 u64 ampdu_ack_map; 357 u64 ampdu_ack_map;
331 int ack_signal; 358 int ack_signal;
359 struct ieee80211_tx_altrate retries[IEEE80211_TX_MAX_ALTRATE + 1];
332 u8 retry_count; 360 u8 retry_count;
333 bool excessive_retries; 361 bool excessive_retries;
334 u8 ampdu_ack_len; 362 u8 ampdu_ack_len;
@@ -363,6 +391,7 @@ static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
363 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) 391 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field)
364 * is valid. This is useful in monitor mode and necessary for beacon frames 392 * is valid. This is useful in monitor mode and necessary for beacon frames
365 * to enable IBSS merging. 393 * to enable IBSS merging.
394 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
366 */ 395 */
367enum mac80211_rx_flags { 396enum mac80211_rx_flags {
368 RX_FLAG_MMIC_ERROR = 1<<0, 397 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -373,6 +402,7 @@ enum mac80211_rx_flags {
373 RX_FLAG_FAILED_FCS_CRC = 1<<5, 402 RX_FLAG_FAILED_FCS_CRC = 1<<5,
374 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 403 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
375 RX_FLAG_TSFT = 1<<7, 404 RX_FLAG_TSFT = 1<<7,
405 RX_FLAG_SHORTPRE = 1<<8
376}; 406};
377 407
378/** 408/**
@@ -418,6 +448,11 @@ struct ieee80211_rx_status {
418 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 448 * @IEEE80211_CONF_PS: Enable 802.11 power save mode
419 */ 449 */
420enum ieee80211_conf_flags { 450enum ieee80211_conf_flags {
451 /*
452 * TODO: IEEE80211_CONF_SHORT_SLOT_TIME will be removed once drivers
453 * have been converted to use bss_info_changed() for slot time
454 * configuration
455 */
421 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), 456 IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0),
422 IEEE80211_CONF_RADIOTAP = (1<<1), 457 IEEE80211_CONF_RADIOTAP = (1<<1),
423 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), 458 IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2),
@@ -461,33 +496,6 @@ struct ieee80211_conf {
461}; 496};
462 497
463/** 498/**
464 * enum ieee80211_if_types - types of 802.11 network interfaces
465 *
466 * @IEEE80211_IF_TYPE_INVALID: invalid interface type, not used
467 * by mac80211 itself
468 * @IEEE80211_IF_TYPE_AP: interface in AP mode.
469 * @IEEE80211_IF_TYPE_MGMT: special interface for communication with hostap
470 * daemon. Drivers should never see this type.
471 * @IEEE80211_IF_TYPE_STA: interface in STA (client) mode.
472 * @IEEE80211_IF_TYPE_IBSS: interface in IBSS (ad-hoc) mode.
473 * @IEEE80211_IF_TYPE_MNTR: interface in monitor (rfmon) mode.
474 * @IEEE80211_IF_TYPE_WDS: interface in WDS mode.
475 * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers
476 * will never see this type.
477 * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point
478 */
479enum ieee80211_if_types {
480 IEEE80211_IF_TYPE_INVALID,
481 IEEE80211_IF_TYPE_AP,
482 IEEE80211_IF_TYPE_STA,
483 IEEE80211_IF_TYPE_IBSS,
484 IEEE80211_IF_TYPE_MESH_POINT,
485 IEEE80211_IF_TYPE_MNTR,
486 IEEE80211_IF_TYPE_WDS,
487 IEEE80211_IF_TYPE_VLAN,
488};
489
490/**
491 * struct ieee80211_vif - per-interface data 499 * struct ieee80211_vif - per-interface data
492 * 500 *
493 * Data in this structure is continually present for driver 501 * Data in this structure is continually present for driver
@@ -498,7 +506,7 @@ enum ieee80211_if_types {
498 * sizeof(void *). 506 * sizeof(void *).
499 */ 507 */
500struct ieee80211_vif { 508struct ieee80211_vif {
501 enum ieee80211_if_types type; 509 enum nl80211_iftype type;
502 /* must be last */ 510 /* must be last */
503 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 511 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
504}; 512};
@@ -506,7 +514,7 @@ struct ieee80211_vif {
506static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) 514static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
507{ 515{
508#ifdef CONFIG_MAC80211_MESH 516#ifdef CONFIG_MAC80211_MESH
509 return vif->type == IEEE80211_IF_TYPE_MESH_POINT; 517 return vif->type == NL80211_IFTYPE_MESH_POINT;
510#endif 518#endif
511 return false; 519 return false;
512} 520}
@@ -517,7 +525,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
517 * @vif: pointer to a driver-use per-interface structure. The pointer 525 * @vif: pointer to a driver-use per-interface structure. The pointer
518 * itself is also used for various functions including 526 * itself is also used for various functions including
519 * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). 527 * ieee80211_beacon_get() and ieee80211_get_buffered_bc().
520 * @type: one of &enum ieee80211_if_types constants. Determines the type of 528 * @type: one of &enum nl80211_iftype constants. Determines the type of
521 * added/removed interface. 529 * added/removed interface.
522 * @mac_addr: pointer to MAC address of the interface. This pointer is valid 530 * @mac_addr: pointer to MAC address of the interface. This pointer is valid
523 * until the interface is removed (i.e. it cannot be used after 531 * until the interface is removed (i.e. it cannot be used after
@@ -533,7 +541,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
533 * in pure monitor mode. 541 * in pure monitor mode.
534 */ 542 */
535struct ieee80211_if_init_conf { 543struct ieee80211_if_init_conf {
536 enum ieee80211_if_types type; 544 enum nl80211_iftype type;
537 struct ieee80211_vif *vif; 545 struct ieee80211_vif *vif;
538 void *mac_addr; 546 void *mac_addr;
539}; 547};
@@ -637,10 +645,13 @@ enum ieee80211_key_flags {
637 * - Temporal Encryption Key (128 bits) 645 * - Temporal Encryption Key (128 bits)
638 * - Temporal Authenticator Tx MIC Key (64 bits) 646 * - Temporal Authenticator Tx MIC Key (64 bits)
639 * - Temporal Authenticator Rx MIC Key (64 bits) 647 * - Temporal Authenticator Rx MIC Key (64 bits)
640 * 648 * @icv_len: FIXME
649 * @iv_len: FIXME
641 */ 650 */
642struct ieee80211_key_conf { 651struct ieee80211_key_conf {
643 enum ieee80211_key_alg alg; 652 enum ieee80211_key_alg alg;
653 u8 icv_len;
654 u8 iv_len;
644 u8 hw_key_idx; 655 u8 hw_key_idx;
645 u8 flags; 656 u8 flags;
646 s8 keyidx; 657 s8 keyidx;
@@ -662,6 +673,33 @@ enum set_key_cmd {
662}; 673};
663 674
664/** 675/**
676 * struct ieee80211_sta - station table entry
677 *
678 * A station table entry represents a station we are possibly
679 * communicating with. Since stations are RCU-managed in
680 * mac80211, any ieee80211_sta pointer you get access to must
681 * either be protected by rcu_read_lock() explicitly or implicitly,
682 * or you must take good care to not use such a pointer after a
683 * call to your sta_notify callback that removed it.
684 *
685 * @addr: MAC address
686 * @aid: AID we assigned to the station if we're an AP
687 * @supp_rates: Bitmap of supported rates (per band)
688 * @ht_info: HT capabilities of this STA
689 * @drv_priv: data area for driver use, will always be aligned to
690 * sizeof(void *), size is determined in hw information.
691 */
692struct ieee80211_sta {
693 u64 supp_rates[IEEE80211_NUM_BANDS];
694 u8 addr[ETH_ALEN];
695 u16 aid;
696 struct ieee80211_ht_info ht_info;
697
698 /* must be last */
699 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
700};
701
702/**
665 * enum sta_notify_cmd - sta notify command 703 * enum sta_notify_cmd - sta notify command
666 * 704 *
667 * Used with the sta_notify() callback in &struct ieee80211_ops, this 705 * Used with the sta_notify() callback in &struct ieee80211_ops, this
@@ -805,6 +843,11 @@ enum ieee80211_hw_flags {
805 * 843 *
806 * @vif_data_size: size (in bytes) of the drv_priv data area 844 * @vif_data_size: size (in bytes) of the drv_priv data area
807 * within &struct ieee80211_vif. 845 * within &struct ieee80211_vif.
846 * @sta_data_size: size (in bytes) of the drv_priv data area
847 * within &struct ieee80211_sta.
848 *
849 * @max_altrates: maximum number of alternate rate retry stages
850 * @max_altrate_tries: maximum number of tries for each stage
808 */ 851 */
809struct ieee80211_hw { 852struct ieee80211_hw {
810 struct ieee80211_conf conf; 853 struct ieee80211_conf conf;
@@ -816,12 +859,17 @@ struct ieee80211_hw {
816 unsigned int extra_tx_headroom; 859 unsigned int extra_tx_headroom;
817 int channel_change_time; 860 int channel_change_time;
818 int vif_data_size; 861 int vif_data_size;
862 int sta_data_size;
819 u16 queues; 863 u16 queues;
820 u16 ampdu_queues; 864 u16 ampdu_queues;
821 u16 max_listen_interval; 865 u16 max_listen_interval;
822 s8 max_signal; 866 s8 max_signal;
867 u8 max_altrates;
868 u8 max_altrate_tries;
823}; 869};
824 870
871struct ieee80211_hw *wiphy_to_hw(struct wiphy *wiphy);
872
825/** 873/**
826 * SET_IEEE80211_DEV - set device for 802.11 hardware 874 * SET_IEEE80211_DEV - set device for 802.11 hardware
827 * 875 *
@@ -874,11 +922,11 @@ ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
874 922
875static inline struct ieee80211_rate * 923static inline struct ieee80211_rate *
876ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, 924ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
877 const struct ieee80211_tx_info *c) 925 const struct ieee80211_tx_info *c, int idx)
878{ 926{
879 if (c->control.alt_retry_rate_idx < 0) 927 if (c->control.retries[idx].rate_idx < 0)
880 return NULL; 928 return NULL;
881 return &hw->wiphy->bands[c->band]->bitrates[c->control.alt_retry_rate_idx]; 929 return &hw->wiphy->bands[c->band]->bitrates[c->control.retries[idx].rate_idx];
882} 930}
883 931
884/** 932/**
@@ -1097,7 +1145,7 @@ enum ieee80211_ampdu_mlme_action {
1097 * This callback must be implemented and atomic. 1145 * This callback must be implemented and atomic.
1098 * 1146 *
1099 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit 1147 * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
1100 * must be set or cleared for a given AID. Must be atomic. 1148 * must be set or cleared for a given STA. Must be atomic.
1101 * 1149 *
1102 * @set_key: See the section "Hardware crypto acceleration" 1150 * @set_key: See the section "Hardware crypto acceleration"
1103 * This callback can sleep, and is only called between add_interface 1151 * This callback can sleep, and is only called between add_interface
@@ -1111,7 +1159,9 @@ enum ieee80211_ampdu_mlme_action {
1111 * @hw_scan: Ask the hardware to service the scan request, no need to start 1159 * @hw_scan: Ask the hardware to service the scan request, no need to start
1112 * the scan state machine in stack. The scan must honour the channel 1160 * the scan state machine in stack. The scan must honour the channel
1113 * configuration done by the regulatory agent in the wiphy's registered 1161 * configuration done by the regulatory agent in the wiphy's registered
1114 * bands. 1162 * bands. When the scan finishes, ieee80211_scan_completed() must be
1163 * called; note that it also must be called when the scan cannot finish
1164 * because the hardware is turned off! Anything else is a bug!
1115 * 1165 *
1116 * @get_stats: return low-level statistics 1166 * @get_stats: return low-level statistics
1117 * 1167 *
@@ -1131,7 +1181,7 @@ enum ieee80211_ampdu_mlme_action {
1131 * of assocaited station or AP. 1181 * of assocaited station or AP.
1132 * 1182 *
1133 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1183 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1134 * bursting) for a hardware TX queue. Must be atomic. 1184 * bursting) for a hardware TX queue.
1135 * 1185 *
1136 * @get_tx_stats: Get statistics of the current TX queue status. This is used 1186 * @get_tx_stats: Get statistics of the current TX queue status. This is used
1137 * to get number of currently queued packets (queue length), maximum queue 1187 * to get number of currently queued packets (queue length), maximum queue
@@ -1181,7 +1231,8 @@ struct ieee80211_ops {
1181 unsigned int changed_flags, 1231 unsigned int changed_flags,
1182 unsigned int *total_flags, 1232 unsigned int *total_flags,
1183 int mc_count, struct dev_addr_list *mc_list); 1233 int mc_count, struct dev_addr_list *mc_list);
1184 int (*set_tim)(struct ieee80211_hw *hw, int aid, int set); 1234 int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1235 bool set);
1185 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1236 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1186 const u8 *local_address, const u8 *address, 1237 const u8 *local_address, const u8 *address,
1187 struct ieee80211_key_conf *key); 1238 struct ieee80211_key_conf *key);
@@ -1198,7 +1249,7 @@ struct ieee80211_ops {
1198 int (*set_retry_limit)(struct ieee80211_hw *hw, 1249 int (*set_retry_limit)(struct ieee80211_hw *hw,
1199 u32 short_retry, u32 long_retr); 1250 u32 short_retry, u32 long_retr);
1200 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1251 void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1201 enum sta_notify_cmd, const u8 *addr); 1252 enum sta_notify_cmd, struct ieee80211_sta *sta);
1202 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue, 1253 int (*conf_tx)(struct ieee80211_hw *hw, u16 queue,
1203 const struct ieee80211_tx_queue_params *params); 1254 const struct ieee80211_tx_queue_params *params);
1204 int (*get_tx_stats)(struct ieee80211_hw *hw, 1255 int (*get_tx_stats)(struct ieee80211_hw *hw,
@@ -1208,7 +1259,7 @@ struct ieee80211_ops {
1208 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1259 int (*tx_last_beacon)(struct ieee80211_hw *hw);
1209 int (*ampdu_action)(struct ieee80211_hw *hw, 1260 int (*ampdu_action)(struct ieee80211_hw *hw,
1210 enum ieee80211_ampdu_mlme_action action, 1261 enum ieee80211_ampdu_mlme_action action,
1211 const u8 *addr, u16 tid, u16 *ssn); 1262 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1212}; 1263};
1213 1264
1214/** 1265/**
@@ -1557,16 +1608,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1557unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); 1608unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1558 1609
1559/** 1610/**
1560 * ieee80211_get_hdrlen - get header length from frame control
1561 *
1562 * This function returns the 802.11 header length in bytes (not including
1563 * encryption headers.)
1564 *
1565 * @fc: the frame control field (in CPU endianness)
1566 */
1567int ieee80211_get_hdrlen(u16 fc);
1568
1569/**
1570 * ieee80211_hdrlen - get header length in bytes from frame control 1611 * ieee80211_hdrlen - get header length in bytes from frame control
1571 * @fc: frame control field in little-endian format 1612 * @fc: frame control field in little-endian format
1572 */ 1613 */
@@ -1608,6 +1649,16 @@ void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
1608void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); 1649void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
1609 1650
1610/** 1651/**
1652 * ieee80211_queue_stopped - test status of the queue
1653 * @hw: pointer as obtained from ieee80211_alloc_hw().
1654 * @queue: queue number (counted from zero).
1655 *
1656 * Drivers should use this function instead of netif_stop_queue.
1657 */
1658
1659int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
1660
1661/**
1611 * ieee80211_stop_queues - stop all queues 1662 * ieee80211_stop_queues - stop all queues
1612 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1663 * @hw: pointer as obtained from ieee80211_alloc_hw().
1613 * 1664 *
@@ -1758,4 +1809,85 @@ void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1758 */ 1809 */
1759void ieee80211_notify_mac(struct ieee80211_hw *hw, 1810void ieee80211_notify_mac(struct ieee80211_hw *hw,
1760 enum ieee80211_notification_types notif_type); 1811 enum ieee80211_notification_types notif_type);
1812
1813/**
1814 * ieee80211_find_sta - find a station
1815 *
1816 * @hw: pointer as obtained from ieee80211_alloc_hw()
1817 * @addr: station's address
1818 *
1819 * This function must be called under RCU lock and the
1820 * resulting pointer is only valid under RCU lock as well.
1821 */
1822struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw,
1823 const u8 *addr);
1824
1825
1826/* Rate control API */
1827/**
1828 * struct rate_selection - rate information for/from rate control algorithms
1829 *
1830 * @rate_idx: selected transmission rate index
1831 * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used
1832 * @probe_idx: rate for probing (or -1)
1833 * @max_rate_idx: maximum rate index that can be used, this is
1834 * input to the algorithm and will be enforced
1835 */
1836struct rate_selection {
1837 s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx;
1838};
1839
1840struct rate_control_ops {
1841 struct module *module;
1842 const char *name;
1843 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
1844 void (*clear)(void *priv);
1845 void (*free)(void *priv);
1846
1847 void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
1848 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
1849 struct ieee80211_sta *sta, void *priv_sta);
1850 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
1851 void *priv_sta);
1852
1853 void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
1854 struct ieee80211_sta *sta, void *priv_sta,
1855 struct sk_buff *skb);
1856 void (*get_rate)(void *priv, struct ieee80211_supported_band *sband,
1857 struct ieee80211_sta *sta, void *priv_sta,
1858 struct sk_buff *skb,
1859 struct rate_selection *sel);
1860
1861 void (*add_sta_debugfs)(void *priv, void *priv_sta,
1862 struct dentry *dir);
1863 void (*remove_sta_debugfs)(void *priv, void *priv_sta);
1864};
1865
1866static inline int rate_supported(struct ieee80211_sta *sta,
1867 enum ieee80211_band band,
1868 int index)
1869{
1870 return (sta == NULL || sta->supp_rates[band] & BIT(index));
1871}
1872
1873static inline s8
1874rate_lowest_index(struct ieee80211_supported_band *sband,
1875 struct ieee80211_sta *sta)
1876{
1877 int i;
1878
1879 for (i = 0; i < sband->n_bitrates; i++)
1880 if (rate_supported(sta, sband->band, i))
1881 return i;
1882
1883 /* warn when we cannot find a rate. */
1884 WARN_ON(1);
1885
1886 return 0;
1887}
1888
1889
1890int ieee80211_rate_control_register(struct rate_control_ops *ops);
1891void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
1892
1761#endif /* MAC80211_H */ 1893#endif /* MAC80211_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index a01b7c4dc763..11dd0137c6a5 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -129,9 +129,8 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
129 void __user *buffer, 129 void __user *buffer,
130 size_t *lenp, 130 size_t *lenp,
131 loff_t *ppos); 131 loff_t *ppos);
132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, 132int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl,
133 int nlen, void __user *oldval, 133 void __user *oldval, size_t __user *oldlenp,
134 size_t __user *oldlenp,
135 void __user *newval, size_t newlen); 134 void __user *newval, size_t newlen);
136#endif 135#endif
137 136
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index a8eb43cf0c7e..708009be88b6 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -16,6 +16,9 @@
16#include <net/netns/ipv6.h> 16#include <net/netns/ipv6.h>
17#include <net/netns/dccp.h> 17#include <net/netns/dccp.h>
18#include <net/netns/x_tables.h> 18#include <net/netns/x_tables.h>
19#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
20#include <net/netns/conntrack.h>
21#endif
19 22
20struct proc_dir_entry; 23struct proc_dir_entry;
21struct net_device; 24struct net_device;
@@ -67,6 +70,9 @@ struct net {
67#endif 70#endif
68#ifdef CONFIG_NETFILTER 71#ifdef CONFIG_NETFILTER
69 struct netns_xt xt; 72 struct netns_xt xt;
73#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
74 struct netns_ct ct;
75#endif
70#endif 76#endif
71 struct net_generic *gen; 77 struct net_generic *gen;
72}; 78};
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
new file mode 100644
index 000000000000..6b00ea38546b
--- /dev/null
+++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
@@ -0,0 +1,6 @@
1#ifndef _NF_DEFRAG_IPV4_H
2#define _NF_DEFRAG_IPV4_H
3
4extern void nf_defrag_ipv4_enable(void);
5
6#endif /* _NF_DEFRAG_IPV4_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0741ad592da0..b76a8685b5b5 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -123,7 +123,9 @@ struct nf_conn
123 123
124 /* Extensions */ 124 /* Extensions */
125 struct nf_ct_ext *ext; 125 struct nf_ct_ext *ext;
126 126#ifdef CONFIG_NET_NS
127 struct net *ct_net;
128#endif
127 struct rcu_head rcu; 129 struct rcu_head rcu;
128}; 130};
129 131
@@ -147,6 +149,17 @@ static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct)
147/* get master conntrack via master expectation */ 149/* get master conntrack via master expectation */
148#define master_ct(conntr) (conntr->master) 150#define master_ct(conntr) (conntr->master)
149 151
152extern struct net init_net;
153
154static inline struct net *nf_ct_net(const struct nf_conn *ct)
155{
156#ifdef CONFIG_NET_NS
157 return ct->ct_net;
158#else
159 return &init_net;
160#endif
161}
162
150/* Alter reply tuple (maybe alter helper). */ 163/* Alter reply tuple (maybe alter helper). */
151extern void 164extern void
152nf_conntrack_alter_reply(struct nf_conn *ct, 165nf_conntrack_alter_reply(struct nf_conn *ct,
@@ -182,11 +195,11 @@ extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced,
182 unsigned int size); 195 unsigned int size);
183 196
184extern struct nf_conntrack_tuple_hash * 197extern struct nf_conntrack_tuple_hash *
185__nf_conntrack_find(const struct nf_conntrack_tuple *tuple); 198__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
186 199
187extern void nf_conntrack_hash_insert(struct nf_conn *ct); 200extern void nf_conntrack_hash_insert(struct nf_conn *ct);
188 201
189extern void nf_conntrack_flush(void); 202extern void nf_conntrack_flush(struct net *net);
190 203
191extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 204extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
192 unsigned int nhoff, u_int16_t l3num, 205 unsigned int nhoff, u_int16_t l3num,
@@ -248,10 +261,11 @@ extern struct nf_conn nf_conntrack_untracked;
248 261
249/* Iterate over all conntracks: if iter returns true, it's deleted. */ 262/* Iterate over all conntracks: if iter returns true, it's deleted. */
250extern void 263extern void
251nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); 264nf_ct_iterate_cleanup(struct net *net, int (*iter)(struct nf_conn *i, void *data), void *data);
252extern void nf_conntrack_free(struct nf_conn *ct); 265extern void nf_conntrack_free(struct nf_conn *ct);
253extern struct nf_conn * 266extern struct nf_conn *
254nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, 267nf_conntrack_alloc(struct net *net,
268 const struct nf_conntrack_tuple *orig,
255 const struct nf_conntrack_tuple *repl, 269 const struct nf_conntrack_tuple *repl,
256 gfp_t gfp); 270 gfp_t gfp);
257 271
@@ -273,16 +287,14 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
273 287
274extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 288extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
275extern unsigned int nf_conntrack_htable_size; 289extern unsigned int nf_conntrack_htable_size;
276extern int nf_conntrack_checksum;
277extern atomic_t nf_conntrack_count;
278extern int nf_conntrack_max; 290extern int nf_conntrack_max;
279 291
280DECLARE_PER_CPU(struct ip_conntrack_stat, nf_conntrack_stat); 292#define NF_CT_STAT_INC(net, count) \
281#define NF_CT_STAT_INC(count) (__get_cpu_var(nf_conntrack_stat).count++) 293 (per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++)
282#define NF_CT_STAT_INC_ATOMIC(count) \ 294#define NF_CT_STAT_INC_ATOMIC(net, count) \
283do { \ 295do { \
284 local_bh_disable(); \ 296 local_bh_disable(); \
285 __get_cpu_var(nf_conntrack_stat).count++; \ 297 per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \
286 local_bh_enable(); \ 298 local_bh_enable(); \
287} while (0) 299} while (0)
288 300
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 5d5ae55d54c4..03e218f0be43 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -8,6 +8,7 @@
8 8
9#ifndef _NF_CONNTRACK_ACCT_H 9#ifndef _NF_CONNTRACK_ACCT_H
10#define _NF_CONNTRACK_ACCT_H 10#define _NF_CONNTRACK_ACCT_H
11#include <net/net_namespace.h>
11#include <linux/netfilter/nf_conntrack_common.h> 12#include <linux/netfilter/nf_conntrack_common.h>
12#include <linux/netfilter/nf_conntrack_tuple_common.h> 13#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack.h> 14#include <net/netfilter/nf_conntrack.h>
@@ -18,8 +19,6 @@ struct nf_conn_counter {
18 u_int64_t bytes; 19 u_int64_t bytes;
19}; 20};
20 21
21extern int nf_ct_acct;
22
23static inline 22static inline
24struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) 23struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct)
25{ 24{
@@ -29,9 +28,10 @@ struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct)
29static inline 28static inline
30struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) 29struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
31{ 30{
31 struct net *net = nf_ct_net(ct);
32 struct nf_conn_counter *acct; 32 struct nf_conn_counter *acct;
33 33
34 if (!nf_ct_acct) 34 if (!net->ct.sysctl_acct)
35 return NULL; 35 return NULL;
36 36
37 acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp); 37 acct = nf_ct_ext_add(ct, NF_CT_EXT_ACCT, gfp);
@@ -45,7 +45,7 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
45extern unsigned int 45extern unsigned int
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir);
47 47
48extern int nf_conntrack_acct_init(void); 48extern int nf_conntrack_acct_init(struct net *net);
49extern void nf_conntrack_acct_fini(void); 49extern void nf_conntrack_acct_fini(struct net *net);
50 50
51#endif /* _NF_CONNTRACK_ACCT_H */ 51#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index a81771210934..e78afe7f28e3 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -20,12 +20,13 @@
20/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
21 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
22 of connection tracking. */ 22 of connection tracking. */
23extern unsigned int nf_conntrack_in(int pf, 23extern unsigned int nf_conntrack_in(struct net *net,
24 u_int8_t pf,
24 unsigned int hooknum, 25 unsigned int hooknum,
25 struct sk_buff *skb); 26 struct sk_buff *skb);
26 27
27extern int nf_conntrack_init(void); 28extern int nf_conntrack_init(struct net *net);
28extern void nf_conntrack_cleanup(void); 29extern void nf_conntrack_cleanup(struct net *net);
29 30
30extern int nf_conntrack_proto_init(void); 31extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void); 32extern void nf_conntrack_proto_fini(void);
@@ -48,7 +49,7 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
48 49
49/* Find a connection corresponding to a tuple. */ 50/* Find a connection corresponding to a tuple. */
50extern struct nf_conntrack_tuple_hash * 51extern struct nf_conntrack_tuple_hash *
51nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple); 52nf_conntrack_find_get(struct net *net, const struct nf_conntrack_tuple *tuple);
52 53
53extern int __nf_conntrack_confirm(struct sk_buff *skb); 54extern int __nf_conntrack_confirm(struct sk_buff *skb);
54 55
@@ -71,8 +72,6 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
71 const struct nf_conntrack_l3proto *l3proto, 72 const struct nf_conntrack_l3proto *l3proto,
72 const struct nf_conntrack_l4proto *proto); 73 const struct nf_conntrack_l4proto *proto);
73 74
74extern struct hlist_head *nf_conntrack_hash;
75extern spinlock_t nf_conntrack_lock ; 75extern spinlock_t nf_conntrack_lock ;
76extern struct hlist_head unconfirmed;
77 76
78#endif /* _NF_CONNTRACK_CORE_H */ 77#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index f0b9078235c9..1285ff26a014 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/notifier.h> 9#include <linux/notifier.h>
10#include <linux/interrupt.h> 10#include <linux/interrupt.h>
11#include <net/net_namespace.h>
11#include <net/netfilter/nf_conntrack_expect.h> 12#include <net/netfilter/nf_conntrack_expect.h>
12 13
13#ifdef CONFIG_NF_CONNTRACK_EVENTS 14#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -15,9 +16,6 @@ struct nf_conntrack_ecache {
15 struct nf_conn *ct; 16 struct nf_conn *ct;
16 unsigned int events; 17 unsigned int events;
17}; 18};
18DECLARE_PER_CPU(struct nf_conntrack_ecache, nf_conntrack_ecache);
19
20#define CONNTRACK_ECACHE(x) (__get_cpu_var(nf_conntrack_ecache).x)
21 19
22extern struct atomic_notifier_head nf_conntrack_chain; 20extern struct atomic_notifier_head nf_conntrack_chain;
23extern int nf_conntrack_register_notifier(struct notifier_block *nb); 21extern int nf_conntrack_register_notifier(struct notifier_block *nb);
@@ -25,17 +23,16 @@ extern int nf_conntrack_unregister_notifier(struct notifier_block *nb);
25 23
26extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 24extern void nf_ct_deliver_cached_events(const struct nf_conn *ct);
27extern void __nf_ct_event_cache_init(struct nf_conn *ct); 25extern void __nf_ct_event_cache_init(struct nf_conn *ct);
28extern void nf_ct_event_cache_flush(void); 26extern void nf_ct_event_cache_flush(struct net *net);
29 27
30static inline void 28static inline void
31nf_conntrack_event_cache(enum ip_conntrack_events event, 29nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
32 const struct sk_buff *skb)
33{ 30{
34 struct nf_conn *ct = (struct nf_conn *)skb->nfct; 31 struct net *net = nf_ct_net(ct);
35 struct nf_conntrack_ecache *ecache; 32 struct nf_conntrack_ecache *ecache;
36 33
37 local_bh_disable(); 34 local_bh_disable();
38 ecache = &__get_cpu_var(nf_conntrack_ecache); 35 ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id());
39 if (ct != ecache->ct) 36 if (ct != ecache->ct)
40 __nf_ct_event_cache_init(ct); 37 __nf_ct_event_cache_init(ct);
41 ecache->events |= event; 38 ecache->events |= event;
@@ -60,16 +57,28 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
60 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp); 57 atomic_notifier_call_chain(&nf_ct_expect_chain, event, exp);
61} 58}
62 59
60extern int nf_conntrack_ecache_init(struct net *net);
61extern void nf_conntrack_ecache_fini(struct net *net);
62
63#else /* CONFIG_NF_CONNTRACK_EVENTS */ 63#else /* CONFIG_NF_CONNTRACK_EVENTS */
64 64
65static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 65static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
66 const struct sk_buff *skb) {} 66 struct nf_conn *ct) {}
67static inline void nf_conntrack_event(enum ip_conntrack_events event, 67static inline void nf_conntrack_event(enum ip_conntrack_events event,
68 struct nf_conn *ct) {} 68 struct nf_conn *ct) {}
69static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 69static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
70static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 70static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
71 struct nf_conntrack_expect *exp) {} 71 struct nf_conntrack_expect *exp) {}
72static inline void nf_ct_event_cache_flush(void) {} 72static inline void nf_ct_event_cache_flush(struct net *net) {}
73
74static inline int nf_conntrack_ecache_init(struct net *net)
75{
76 return 0;
77}
78
79static inline void nf_conntrack_ecache_fini(struct net *net)
80{
81}
73#endif /* CONFIG_NF_CONNTRACK_EVENTS */ 82#endif /* CONFIG_NF_CONNTRACK_EVENTS */
74 83
75#endif /*_NF_CONNTRACK_ECACHE_H*/ 84#endif /*_NF_CONNTRACK_ECACHE_H*/
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index dfdf4b459475..37a7fc1164b0 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -6,7 +6,6 @@
6#define _NF_CONNTRACK_EXPECT_H 6#define _NF_CONNTRACK_EXPECT_H
7#include <net/netfilter/nf_conntrack.h> 7#include <net/netfilter/nf_conntrack.h>
8 8
9extern struct hlist_head *nf_ct_expect_hash;
10extern unsigned int nf_ct_expect_hsize; 9extern unsigned int nf_ct_expect_hsize;
11extern unsigned int nf_ct_expect_max; 10extern unsigned int nf_ct_expect_max;
12 11
@@ -56,6 +55,15 @@ struct nf_conntrack_expect
56 struct rcu_head rcu; 55 struct rcu_head rcu;
57}; 56};
58 57
58static inline struct net *nf_ct_exp_net(struct nf_conntrack_expect *exp)
59{
60#ifdef CONFIG_NET_NS
61 return exp->master->ct_net; /* by definition */
62#else
63 return &init_net;
64#endif
65}
66
59struct nf_conntrack_expect_policy 67struct nf_conntrack_expect_policy
60{ 68{
61 unsigned int max_expected; 69 unsigned int max_expected;
@@ -67,17 +75,17 @@ struct nf_conntrack_expect_policy
67#define NF_CT_EXPECT_PERMANENT 0x1 75#define NF_CT_EXPECT_PERMANENT 0x1
68#define NF_CT_EXPECT_INACTIVE 0x2 76#define NF_CT_EXPECT_INACTIVE 0x2
69 77
70int nf_conntrack_expect_init(void); 78int nf_conntrack_expect_init(struct net *net);
71void nf_conntrack_expect_fini(void); 79void nf_conntrack_expect_fini(struct net *net);
72 80
73struct nf_conntrack_expect * 81struct nf_conntrack_expect *
74__nf_ct_expect_find(const struct nf_conntrack_tuple *tuple); 82__nf_ct_expect_find(struct net *net, const struct nf_conntrack_tuple *tuple);
75 83
76struct nf_conntrack_expect * 84struct nf_conntrack_expect *
77nf_ct_expect_find_get(const struct nf_conntrack_tuple *tuple); 85nf_ct_expect_find_get(struct net *net, const struct nf_conntrack_tuple *tuple);
78 86
79struct nf_conntrack_expect * 87struct nf_conntrack_expect *
80nf_ct_find_expectation(const struct nf_conntrack_tuple *tuple); 88nf_ct_find_expectation(struct net *net, const struct nf_conntrack_tuple *tuple);
81 89
82void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); 90void nf_ct_unlink_expect(struct nf_conntrack_expect *exp);
83void nf_ct_remove_expectations(struct nf_conn *ct); 91void nf_ct_remove_expectations(struct nf_conn *ct);
@@ -86,7 +94,7 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
86/* Allocate space for an expectation: this is mandatory before calling 94/* Allocate space for an expectation: this is mandatory before calling
87 nf_ct_expect_related. You will have to call put afterwards. */ 95 nf_ct_expect_related. You will have to call put afterwards. */
88struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); 96struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
89void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int, 97void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
90 const union nf_inet_addr *, 98 const union nf_inet_addr *,
91 const union nf_inet_addr *, 99 const union nf_inet_addr *,
92 u_int8_t, const __be16 *, const __be16 *); 100 u_int8_t, const __be16 *, const __be16 *);
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index 723df9d1cc35..7f2f43c77284 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -39,7 +39,7 @@ struct nf_conntrack_l4proto
39 const struct sk_buff *skb, 39 const struct sk_buff *skb,
40 unsigned int dataoff, 40 unsigned int dataoff,
41 enum ip_conntrack_info ctinfo, 41 enum ip_conntrack_info ctinfo,
42 int pf, 42 u_int8_t pf,
43 unsigned int hooknum); 43 unsigned int hooknum);
44 44
45 /* Called when a new connection for this protocol found; 45 /* Called when a new connection for this protocol found;
@@ -50,9 +50,9 @@ struct nf_conntrack_l4proto
50 /* Called when a conntrack entry is destroyed */ 50 /* Called when a conntrack entry is destroyed */
51 void (*destroy)(struct nf_conn *ct); 51 void (*destroy)(struct nf_conn *ct);
52 52
53 int (*error)(struct sk_buff *skb, unsigned int dataoff, 53 int (*error)(struct net *net, struct sk_buff *skb, unsigned int dataoff,
54 enum ip_conntrack_info *ctinfo, 54 enum ip_conntrack_info *ctinfo,
55 int pf, unsigned int hooknum); 55 u_int8_t pf, unsigned int hooknum);
56 56
57 /* Print out the per-protocol part of the tuple. Return like seq_* */ 57 /* Print out the per-protocol part of the tuple. Return like seq_* */
58 int (*print_tuple)(struct seq_file *s, 58 int (*print_tuple)(struct seq_file *s,
@@ -117,20 +117,19 @@ extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
117 struct nf_conntrack_tuple *t); 117 struct nf_conntrack_tuple *t);
118extern const struct nla_policy nf_ct_port_nla_policy[]; 118extern const struct nla_policy nf_ct_port_nla_policy[];
119 119
120/* Log invalid packets */
121extern unsigned int nf_ct_log_invalid;
122
123#ifdef CONFIG_SYSCTL 120#ifdef CONFIG_SYSCTL
124#ifdef DEBUG_INVALID_PACKETS 121#ifdef DEBUG_INVALID_PACKETS
125#define LOG_INVALID(proto) \ 122#define LOG_INVALID(net, proto) \
126 (nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) 123 ((net)->ct.sysctl_log_invalid == (proto) || \
124 (net)->ct.sysctl_log_invalid == IPPROTO_RAW)
127#else 125#else
128#define LOG_INVALID(proto) \ 126#define LOG_INVALID(net, proto) \
129 ((nf_ct_log_invalid == (proto) || nf_ct_log_invalid == IPPROTO_RAW) \ 127 (((net)->ct.sysctl_log_invalid == (proto) || \
128 (net)->ct.sysctl_log_invalid == IPPROTO_RAW) \
130 && net_ratelimit()) 129 && net_ratelimit())
131#endif 130#endif
132#else 131#else
133#define LOG_INVALID(proto) 0 132#define LOG_INVALID(net, proto) 0
134#endif /* CONFIG_SYSCTL */ 133#endif /* CONFIG_SYSCTL */
135 134
136#endif /*_NF_CONNTRACK_PROTOCOL_H*/ 135#endif /*_NF_CONNTRACK_PROTOCOL_H*/
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 8c6b5ae45534..7182c06974f4 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -28,7 +28,7 @@ struct nf_loginfo {
28 } u; 28 } u;
29}; 29};
30 30
31typedef void nf_logfn(unsigned int pf, 31typedef void nf_logfn(u_int8_t pf,
32 unsigned int hooknum, 32 unsigned int hooknum,
33 const struct sk_buff *skb, 33 const struct sk_buff *skb,
34 const struct net_device *in, 34 const struct net_device *in,
@@ -43,12 +43,12 @@ struct nf_logger {
43}; 43};
44 44
45/* Function to register/unregister log function. */ 45/* Function to register/unregister log function. */
46int nf_log_register(int pf, const struct nf_logger *logger); 46int nf_log_register(u_int8_t pf, const struct nf_logger *logger);
47void nf_log_unregister(const struct nf_logger *logger); 47void nf_log_unregister(const struct nf_logger *logger);
48void nf_log_unregister_pf(int pf); 48void nf_log_unregister_pf(u_int8_t pf);
49 49
50/* Calls the registered backend logging function */ 50/* Calls the registered backend logging function */
51void nf_log_packet(int pf, 51void nf_log_packet(u_int8_t pf,
52 unsigned int hooknum, 52 unsigned int hooknum,
53 const struct sk_buff *skb, 53 const struct sk_buff *skb,
54 const struct net_device *in, 54 const struct net_device *in,
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index f29eeb9777e0..58684066388c 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -25,4 +25,12 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
25 else 25 else
26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); 26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status);
27} 27}
28
29struct nlattr;
30
31extern int
32(*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct,
33 enum nf_nat_manip_type manip,
34 struct nlattr *attr);
35
28#endif /* _NF_NAT_CORE_H */ 36#endif /* _NF_NAT_CORE_H */
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index d030044e9235..252fd1010b77 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -8,7 +8,7 @@ struct nf_queue_entry {
8 unsigned int id; 8 unsigned int id;
9 9
10 struct nf_hook_ops *elem; 10 struct nf_hook_ops *elem;
11 int pf; 11 u_int8_t pf;
12 unsigned int hook; 12 unsigned int hook;
13 struct net_device *indev; 13 struct net_device *indev;
14 struct net_device *outdev; 14 struct net_device *outdev;
@@ -24,9 +24,9 @@ struct nf_queue_handler {
24 char *name; 24 char *name;
25}; 25};
26 26
27extern int nf_register_queue_handler(int pf, 27extern int nf_register_queue_handler(u_int8_t pf,
28 const struct nf_queue_handler *qh); 28 const struct nf_queue_handler *qh);
29extern int nf_unregister_queue_handler(int pf, 29extern int nf_unregister_queue_handler(u_int8_t pf,
30 const struct nf_queue_handler *qh); 30 const struct nf_queue_handler *qh);
31extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); 31extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
32extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 32extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
new file mode 100644
index 000000000000..208b46f4d6d2
--- /dev/null
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -0,0 +1,32 @@
1#ifndef _NF_TPROXY_CORE_H
2#define _NF_TPROXY_CORE_H
3
4#include <linux/types.h>
5#include <linux/in.h>
6#include <linux/skbuff.h>
7#include <net/sock.h>
8#include <net/inet_sock.h>
9#include <net/tcp.h>
10
11/* look up and get a reference to a matching socket */
12extern struct sock *
13nf_tproxy_get_sock_v4(struct net *net, const u8 protocol,
14 const __be32 saddr, const __be32 daddr,
15 const __be16 sport, const __be16 dport,
16 const struct net_device *in, bool listening);
17
18static inline void
19nf_tproxy_put_sock(struct sock *sk)
20{
21 /* TIME_WAIT inet sockets have to be handled differently */
22 if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT))
23 inet_twsk_put(inet_twsk(sk));
24 else
25 sock_put(sk);
26}
27
28/* assign a socket to the skb -- consumes sk */
29int
30nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk);
31
32#endif
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index e4d2d6baa983..17c442a4514e 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -9,7 +9,7 @@
9 */ 9 */
10 10
11/* 11/*
12 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006 12 * (c) Copyright Hewlett-Packard Development Company, L.P., 2006, 2008
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -72,8 +72,10 @@ struct cipso_v4_doi;
72/* NetLabel NETLINK protocol version 72/* NetLabel NETLINK protocol version
73 * 1: initial version 73 * 1: initial version
74 * 2: added static labels for unlabeled connections 74 * 2: added static labels for unlabeled connections
75 * 3: network selectors added to the NetLabel/LSM domain mapping and the
76 * CIPSO_V4_MAP_LOCAL CIPSO mapping was added
75 */ 77 */
76#define NETLBL_PROTO_VERSION 2 78#define NETLBL_PROTO_VERSION 3
77 79
78/* NetLabel NETLINK types/families */ 80/* NetLabel NETLINK types/families */
79#define NETLBL_NLTYPE_NONE 0 81#define NETLBL_NLTYPE_NONE 0
@@ -87,6 +89,8 @@ struct cipso_v4_doi;
87#define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6" 89#define NETLBL_NLTYPE_CIPSOV6_NAME "NLBL_CIPSOv6"
88#define NETLBL_NLTYPE_UNLABELED 5 90#define NETLBL_NLTYPE_UNLABELED 5
89#define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL" 91#define NETLBL_NLTYPE_UNLABELED_NAME "NLBL_UNLBL"
92#define NETLBL_NLTYPE_ADDRSELECT 6
93#define NETLBL_NLTYPE_ADDRSELECT_NAME "NLBL_ADRSEL"
90 94
91/* 95/*
92 * NetLabel - Kernel API for accessing the network packet label mappings. 96 * NetLabel - Kernel API for accessing the network packet label mappings.
@@ -200,7 +204,7 @@ struct netlbl_lsm_secattr {
200 u32 type; 204 u32 type;
201 char *domain; 205 char *domain;
202 struct netlbl_lsm_cache *cache; 206 struct netlbl_lsm_cache *cache;
203 union { 207 struct {
204 struct { 208 struct {
205 struct netlbl_lsm_secattr_catmap *cat; 209 struct netlbl_lsm_secattr_catmap *cat;
206 u32 lvl; 210 u32 lvl;
@@ -352,12 +356,9 @@ static inline void netlbl_secattr_free(struct netlbl_lsm_secattr *secattr)
352int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info); 356int netlbl_cfg_map_del(const char *domain, struct netlbl_audit *audit_info);
353int netlbl_cfg_unlbl_add_map(const char *domain, 357int netlbl_cfg_unlbl_add_map(const char *domain,
354 struct netlbl_audit *audit_info); 358 struct netlbl_audit *audit_info);
355int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
356 struct netlbl_audit *audit_info);
357int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 359int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
358 const char *domain, 360 const char *domain,
359 struct netlbl_audit *audit_info); 361 struct netlbl_audit *audit_info);
360int netlbl_cfg_cipsov4_del(u32 doi, struct netlbl_audit *audit_info);
361 362
362/* 363/*
363 * LSM security attribute operations 364 * LSM security attribute operations
@@ -380,12 +381,19 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap,
380int netlbl_enabled(void); 381int netlbl_enabled(void);
381int netlbl_sock_setattr(struct sock *sk, 382int netlbl_sock_setattr(struct sock *sk,
382 const struct netlbl_lsm_secattr *secattr); 383 const struct netlbl_lsm_secattr *secattr);
384void netlbl_sock_delattr(struct sock *sk);
383int netlbl_sock_getattr(struct sock *sk, 385int netlbl_sock_getattr(struct sock *sk,
384 struct netlbl_lsm_secattr *secattr); 386 struct netlbl_lsm_secattr *secattr);
387int netlbl_conn_setattr(struct sock *sk,
388 struct sockaddr *addr,
389 const struct netlbl_lsm_secattr *secattr);
390int netlbl_skbuff_setattr(struct sk_buff *skb,
391 u16 family,
392 const struct netlbl_lsm_secattr *secattr);
385int netlbl_skbuff_getattr(const struct sk_buff *skb, 393int netlbl_skbuff_getattr(const struct sk_buff *skb,
386 u16 family, 394 u16 family,
387 struct netlbl_lsm_secattr *secattr); 395 struct netlbl_lsm_secattr *secattr);
388void netlbl_skbuff_err(struct sk_buff *skb, int error); 396void netlbl_skbuff_err(struct sk_buff *skb, int error, int gateway);
389 397
390/* 398/*
391 * LSM label mapping cache operations 399 * LSM label mapping cache operations
@@ -404,22 +412,12 @@ static inline int netlbl_cfg_unlbl_add_map(const char *domain,
404{ 412{
405 return -ENOSYS; 413 return -ENOSYS;
406} 414}
407static inline int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def,
408 struct netlbl_audit *audit_info)
409{
410 return -ENOSYS;
411}
412static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def, 415static inline int netlbl_cfg_cipsov4_add_map(struct cipso_v4_doi *doi_def,
413 const char *domain, 416 const char *domain,
414 struct netlbl_audit *audit_info) 417 struct netlbl_audit *audit_info)
415{ 418{
416 return -ENOSYS; 419 return -ENOSYS;
417} 420}
418static inline int netlbl_cfg_cipsov4_del(u32 doi,
419 struct netlbl_audit *audit_info)
420{
421 return -ENOSYS;
422}
423static inline int netlbl_secattr_catmap_walk( 421static inline int netlbl_secattr_catmap_walk(
424 struct netlbl_lsm_secattr_catmap *catmap, 422 struct netlbl_lsm_secattr_catmap *catmap,
425 u32 offset) 423 u32 offset)
@@ -456,18 +454,35 @@ static inline int netlbl_sock_setattr(struct sock *sk,
456{ 454{
457 return -ENOSYS; 455 return -ENOSYS;
458} 456}
457static inline void netlbl_sock_delattr(struct sock *sk)
458{
459}
459static inline int netlbl_sock_getattr(struct sock *sk, 460static inline int netlbl_sock_getattr(struct sock *sk,
460 struct netlbl_lsm_secattr *secattr) 461 struct netlbl_lsm_secattr *secattr)
461{ 462{
462 return -ENOSYS; 463 return -ENOSYS;
463} 464}
465static inline int netlbl_conn_setattr(struct sock *sk,
466 struct sockaddr *addr,
467 const struct netlbl_lsm_secattr *secattr)
468{
469 return -ENOSYS;
470}
471static inline int netlbl_skbuff_setattr(struct sk_buff *skb,
472 u16 family,
473 const struct netlbl_lsm_secattr *secattr)
474{
475 return -ENOSYS;
476}
464static inline int netlbl_skbuff_getattr(const struct sk_buff *skb, 477static inline int netlbl_skbuff_getattr(const struct sk_buff *skb,
465 u16 family, 478 u16 family,
466 struct netlbl_lsm_secattr *secattr) 479 struct netlbl_lsm_secattr *secattr)
467{ 480{
468 return -ENOSYS; 481 return -ENOSYS;
469} 482}
470static inline void netlbl_skbuff_err(struct sk_buff *skb, int error) 483static inline void netlbl_skbuff_err(struct sk_buff *skb,
484 int error,
485 int gateway)
471{ 486{
472 return; 487 return;
473} 488}
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 208fe5a38546..3643bbb8e585 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -119,9 +119,6 @@
119 * Nested Attributes Construction: 119 * Nested Attributes Construction:
120 * nla_nest_start(skb, type) start a nested attribute 120 * nla_nest_start(skb, type) start a nested attribute
121 * nla_nest_end(skb, nla) finalize a nested attribute 121 * nla_nest_end(skb, nla) finalize a nested attribute
122 * nla_nest_compat_start(skb, type, start a nested compat attribute
123 * len, data)
124 * nla_nest_compat_end(skb, type) finalize a nested compat attribute
125 * nla_nest_cancel(skb, nla) cancel nested attribute construction 122 * nla_nest_cancel(skb, nla) cancel nested attribute construction
126 * 123 *
127 * Attribute Length Calculations: 124 * Attribute Length Calculations:
@@ -156,7 +153,6 @@
156 * nla_find_nested() find attribute in nested attributes 153 * nla_find_nested() find attribute in nested attributes
157 * nla_parse() parse and validate stream of attrs 154 * nla_parse() parse and validate stream of attrs
158 * nla_parse_nested() parse nested attribuets 155 * nla_parse_nested() parse nested attribuets
159 * nla_parse_nested_compat() parse nested compat attributes
160 * nla_for_each_attr() loop over all attributes 156 * nla_for_each_attr() loop over all attributes
161 * nla_for_each_nested() loop over the nested attributes 157 * nla_for_each_nested() loop over the nested attributes
162 *========================================================================= 158 *=========================================================================
@@ -752,39 +748,6 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
752} 748}
753 749
754/** 750/**
755 * nla_parse_nested_compat - parse nested compat attributes
756 * @tb: destination array with maxtype+1 elements
757 * @maxtype: maximum attribute type to be expected
758 * @nla: attribute containing the nested attributes
759 * @data: pointer to point to contained structure
760 * @len: length of contained structure
761 * @policy: validation policy
762 *
763 * Parse a nested compat attribute. The compat attribute contains a structure
764 * and optionally a set of nested attributes. On success the data pointer
765 * points to the nested data and tb contains the parsed attributes
766 * (see nla_parse).
767 */
768static inline int __nla_parse_nested_compat(struct nlattr *tb[], int maxtype,
769 struct nlattr *nla,
770 const struct nla_policy *policy,
771 int len)
772{
773 int nested_len = nla_len(nla) - NLA_ALIGN(len);
774
775 if (nested_len < 0)
776 return -EINVAL;
777 if (nested_len >= nla_attr_size(0))
778 return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
779 nested_len, policy);
780 memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
781 return 0;
782}
783
784#define nla_parse_nested_compat(tb, maxtype, nla, policy, data, len) \
785({ data = nla_len(nla) >= len ? nla_data(nla) : NULL; \
786 __nla_parse_nested_compat(tb, maxtype, nla, policy, len); })
787/**
788 * nla_put_u8 - Add a u8 netlink attribute to a socket buffer 751 * nla_put_u8 - Add a u8 netlink attribute to a socket buffer
789 * @skb: socket buffer to add attribute to 752 * @skb: socket buffer to add attribute to
790 * @attrtype: attribute type 753 * @attrtype: attribute type
@@ -1031,51 +994,6 @@ static inline int nla_nest_end(struct sk_buff *skb, struct nlattr *start)
1031} 994}
1032 995
1033/** 996/**
1034 * nla_nest_compat_start - Start a new level of nested compat attributes
1035 * @skb: socket buffer to add attributes to
1036 * @attrtype: attribute type of container
1037 * @attrlen: length of structure
1038 * @data: pointer to structure
1039 *
1040 * Start a nested compat attribute that contains both a structure and
1041 * a set of nested attributes.
1042 *
1043 * Returns the container attribute
1044 */
1045static inline struct nlattr *nla_nest_compat_start(struct sk_buff *skb,
1046 int attrtype, int attrlen,
1047 const void *data)
1048{
1049 struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
1050
1051 if (nla_put(skb, attrtype, attrlen, data) < 0)
1052 return NULL;
1053 if (nla_nest_start(skb, attrtype) == NULL) {
1054 nlmsg_trim(skb, start);
1055 return NULL;
1056 }
1057 return start;
1058}
1059
1060/**
1061 * nla_nest_compat_end - Finalize nesting of compat attributes
1062 * @skb: socket buffer the attributes are stored in
1063 * @start: container attribute
1064 *
1065 * Corrects the container attribute header to include the all
1066 * appeneded attributes.
1067 *
1068 * Returns the total data length of the skb.
1069 */
1070static inline int nla_nest_compat_end(struct sk_buff *skb, struct nlattr *start)
1071{
1072 struct nlattr *nest = (void *)start + NLMSG_ALIGN(start->nla_len);
1073
1074 start->nla_len = skb_tail_pointer(skb) - (unsigned char *)start;
1075 return nla_nest_end(skb, nest);
1076}
1077
1078/**
1079 * nla_nest_cancel - Cancel nesting of attributes 997 * nla_nest_cancel - Cancel nesting of attributes
1080 * @skb: socket buffer the message is stored in 998 * @skb: socket buffer the message is stored in
1081 * @start: container attribute 999 * @start: container attribute
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
new file mode 100644
index 000000000000..f4498a62881b
--- /dev/null
+++ b/include/net/netns/conntrack.h
@@ -0,0 +1,30 @@
1#ifndef __NETNS_CONNTRACK_H
2#define __NETNS_CONNTRACK_H
3
4#include <linux/list.h>
5#include <asm/atomic.h>
6
7struct ctl_table_header;
8struct nf_conntrack_ecache;
9
10struct netns_ct {
11 atomic_t count;
12 unsigned int expect_count;
13 struct hlist_head *hash;
14 struct hlist_head *expect_hash;
15 struct hlist_head unconfirmed;
16 struct ip_conntrack_stat *stat;
17#ifdef CONFIG_NF_CONNTRACK_EVENTS
18 struct nf_conntrack_ecache *ecache;
19#endif
20 int sysctl_acct;
21 int sysctl_checksum;
22 unsigned int sysctl_log_invalid; /* Log invalid packets */
23#ifdef CONFIG_SYSCTL
24 struct ctl_table_header *sysctl_header;
25 struct ctl_table_header *acct_sysctl_header;
26#endif
27 int hash_vmalloc;
28 int expect_vmalloc;
29};
30#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index a6ed83853dcc..ece1c926b5d1 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -38,6 +38,9 @@ struct netns_ipv4 {
38 struct xt_table *iptable_raw; 38 struct xt_table *iptable_raw;
39 struct xt_table *arptable_filter; 39 struct xt_table *arptable_filter;
40 struct xt_table *iptable_security; 40 struct xt_table *iptable_security;
41 struct xt_table *nat_table;
42 struct hlist_head *nat_bysource;
43 int nat_vmalloced;
41#endif 44#endif
42 45
43 int sysctl_icmp_echo_ignore_all; 46 int sysctl_icmp_echo_ignore_all;
diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h
index 449147604642..10cb7c336de5 100644
--- a/include/net/netns/mib.h
+++ b/include/net/netns/mib.h
@@ -11,6 +11,15 @@ struct netns_mib {
11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics); 11 DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics);
12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics); 12 DEFINE_SNMP_STAT(struct icmp_mib, icmp_statistics);
13 DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics); 13 DEFINE_SNMP_STAT(struct icmpmsg_mib, icmpmsg_statistics);
14
15#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
16 struct proc_dir_entry *proc_net_devsnmp6;
17 DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6);
18 DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
19 DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
20 DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
21 DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
22#endif
14}; 23};
15 24
16#endif 25#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 0cb63ed2c1fc..b8093971ccb4 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -2,9 +2,9 @@
2#define __NETNS_X_TABLES_H 2#define __NETNS_X_TABLES_H
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/net.h> 5#include <linux/netfilter.h>
6 6
7struct netns_xt { 7struct netns_xt {
8 struct list_head tables[NPROTO]; 8 struct list_head tables[NFPROTO_NUMPROTO];
9}; 9};
10#endif 10#endif
diff --git a/include/net/phonet/gprs.h b/include/net/phonet/gprs.h
new file mode 100644
index 000000000000..928daf595beb
--- /dev/null
+++ b/include/net/phonet/gprs.h
@@ -0,0 +1,38 @@
1/*
2 * File: pep_gprs.h
3 *
4 * GPRS over Phonet pipe end point socket
5 *
6 * Copyright (C) 2008 Nokia Corporation.
7 *
8 * Author: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef NET_PHONET_GPRS_H
26#define NET_PHONET_GPRS_H
27
28struct sock;
29struct sk_buff;
30
31int pep_writeable(struct sock *sk);
32int pep_write(struct sock *sk, struct sk_buff *skb);
33struct sk_buff *pep_read(struct sock *sk);
34
35int gprs_attach(struct sock *sk);
36void gprs_detach(struct sock *sk);
37
38#endif
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
new file mode 100644
index 000000000000..fcd793030e4d
--- /dev/null
+++ b/include/net/phonet/pep.h
@@ -0,0 +1,160 @@
1/*
2 * File: pep.h
3 *
4 * Phonet Pipe End Point sockets definitions
5 *
6 * Copyright (C) 2008 Nokia Corporation.
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 * version 2 as published by the Free Software Foundation.
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef NET_PHONET_PEP_H
24#define NET_PHONET_PEP_H
25
26struct pep_sock {
27 struct pn_sock pn_sk;
28
29 /* XXX: union-ify listening vs connected stuff ? */
30 /* Listening socket stuff: */
31 struct hlist_head ackq;
32 struct hlist_head hlist;
33
34 /* Connected socket stuff: */
35 struct sock *listener;
36 struct sk_buff_head ctrlreq_queue;
37#define PNPIPE_CTRLREQ_MAX 10
38 int ifindex;
39 u16 peer_type; /* peer type/subtype */
40 u8 pipe_handle;
41
42 u8 rx_credits;
43 u8 tx_credits;
44 u8 rx_fc; /* RX flow control */
45 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */
47};
48
49static inline struct pep_sock *pep_sk(struct sock *sk)
50{
51 return (struct pep_sock *)sk;
52}
53
54extern const struct proto_ops phonet_stream_ops;
55
56/* Pipe protocol definitions */
57struct pnpipehdr {
58 u8 utid; /* transaction ID */
59 u8 message_id;
60 u8 pipe_handle;
61 union {
62 u8 state_after_connect; /* connect request */
63 u8 state_after_reset; /* reset request */
64 u8 error_code; /* any response */
65 u8 pep_type; /* status indication */
66 u8 data[1];
67 };
68};
69#define other_pep_type data[1]
70
71static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
72{
73 return (struct pnpipehdr *)skb_transport_header(skb);
74}
75
76#define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4)
77
78enum {
79 PNS_PIPE_DATA = 0x20,
80
81 PNS_PEP_CONNECT_REQ = 0x40,
82 PNS_PEP_CONNECT_RESP,
83 PNS_PEP_DISCONNECT_REQ,
84 PNS_PEP_DISCONNECT_RESP,
85 PNS_PEP_RESET_REQ,
86 PNS_PEP_RESET_RESP,
87 PNS_PEP_ENABLE_REQ,
88 PNS_PEP_ENABLE_RESP,
89 PNS_PEP_CTRL_REQ,
90 PNS_PEP_CTRL_RESP,
91 PNS_PEP_DISABLE_REQ = 0x4C,
92 PNS_PEP_DISABLE_RESP,
93
94 PNS_PEP_STATUS_IND = 0x60,
95 PNS_PIPE_CREATED_IND,
96 PNS_PIPE_RESET_IND = 0x63,
97 PNS_PIPE_ENABLED_IND,
98 PNS_PIPE_REDIRECTED_IND,
99 PNS_PIPE_DISABLED_IND = 0x66,
100};
101
102#define PN_PIPE_INVALID_HANDLE 0xff
103#define PN_PEP_TYPE_COMMON 0x00
104
105/* Phonet pipe status indication */
106enum {
107 PN_PEP_IND_FLOW_CONTROL,
108 PN_PEP_IND_ID_MCFC_GRANT_CREDITS,
109};
110
111/* Phonet pipe error codes */
112enum {
113 PN_PIPE_NO_ERROR,
114 PN_PIPE_ERR_INVALID_PARAM,
115 PN_PIPE_ERR_INVALID_HANDLE,
116 PN_PIPE_ERR_INVALID_CTRL_ID,
117 PN_PIPE_ERR_NOT_ALLOWED,
118 PN_PIPE_ERR_PEP_IN_USE,
119 PN_PIPE_ERR_OVERLOAD,
120 PN_PIPE_ERR_DEV_DISCONNECTED,
121 PN_PIPE_ERR_TIMEOUT,
122 PN_PIPE_ERR_ALL_PIPES_IN_USE,
123 PN_PIPE_ERR_GENERAL,
124 PN_PIPE_ERR_NOT_SUPPORTED,
125};
126
127/* Phonet pipe states */
128enum {
129 PN_PIPE_DISABLE,
130 PN_PIPE_ENABLE,
131};
132
133/* Phonet pipe sub-block types */
134enum {
135 PN_PIPE_SB_CREATE_REQ_PEP_SUB_TYPE,
136 PN_PIPE_SB_CONNECT_REQ_PEP_SUB_TYPE,
137 PN_PIPE_SB_REDIRECT_REQ_PEP_SUB_TYPE,
138 PN_PIPE_SB_NEGOTIATED_FC,
139 PN_PIPE_SB_REQUIRED_FC_TX,
140 PN_PIPE_SB_PREFERRED_FC_RX,
141};
142
143/* Phonet pipe flow control models */
144enum {
145 PN_NO_FLOW_CONTROL,
146 PN_LEGACY_FLOW_CONTROL,
147 PN_ONE_CREDIT_FLOW_CONTROL,
148 PN_MULTI_CREDIT_FLOW_CONTROL,
149};
150
151#define pn_flow_safe(fc) ((fc) >> 1)
152
153/* Phonet pipe flow control states */
154enum {
155 PEP_IND_EMPTY,
156 PEP_IND_BUSY,
157 PEP_IND_READY,
158};
159
160#endif
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
new file mode 100644
index 000000000000..c6a245184460
--- /dev/null
+++ b/include/net/phonet/phonet.h
@@ -0,0 +1,112 @@
1/*
2 * File: af_phonet.h
3 *
4 * Phonet sockets kernel definitions
5 *
6 * Copyright (C) 2008 Nokia Corporation.
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 * version 2 as published by the Free Software Foundation.
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef AF_PHONET_H
24#define AF_PHONET_H
25
26/*
27 * The lower layers may not require more space, ever. Make sure it's
28 * enough.
29 */
30#define MAX_PHONET_HEADER (8 + MAX_HEADER)
31
32/*
33 * Every Phonet* socket has this structure first in its
34 * protocol-specific structure under name c.
35 */
36struct pn_sock {
37 struct sock sk;
38 u16 sobject;
39 u8 resource;
40};
41
42static inline struct pn_sock *pn_sk(struct sock *sk)
43{
44 return (struct pn_sock *)sk;
45}
46
47extern const struct proto_ops phonet_dgram_ops;
48
49struct sock *pn_find_sock_by_sa(const struct sockaddr_pn *sa);
50void phonet_get_local_port_range(int *min, int *max);
51void pn_sock_hash(struct sock *sk);
52void pn_sock_unhash(struct sock *sk);
53int pn_sock_get_port(struct sock *sk, unsigned short sport);
54
55int pn_skb_send(struct sock *sk, struct sk_buff *skb,
56 const struct sockaddr_pn *target);
57
58static inline struct phonethdr *pn_hdr(struct sk_buff *skb)
59{
60 return (struct phonethdr *)skb_network_header(skb);
61}
62
63static inline struct phonetmsg *pn_msg(struct sk_buff *skb)
64{
65 return (struct phonetmsg *)skb_transport_header(skb);
66}
67
68/*
69 * Get the other party's sockaddr from received skb. The skb begins
70 * with a Phonet header.
71 */
72static inline
73void pn_skb_get_src_sockaddr(struct sk_buff *skb, struct sockaddr_pn *sa)
74{
75 struct phonethdr *ph = pn_hdr(skb);
76 u16 obj = pn_object(ph->pn_sdev, ph->pn_sobj);
77
78 sa->spn_family = AF_PHONET;
79 pn_sockaddr_set_object(sa, obj);
80 pn_sockaddr_set_resource(sa, ph->pn_res);
81 memset(sa->spn_zero, 0, sizeof(sa->spn_zero));
82}
83
84static inline
85void pn_skb_get_dst_sockaddr(struct sk_buff *skb, struct sockaddr_pn *sa)
86{
87 struct phonethdr *ph = pn_hdr(skb);
88 u16 obj = pn_object(ph->pn_rdev, ph->pn_robj);
89
90 sa->spn_family = AF_PHONET;
91 pn_sockaddr_set_object(sa, obj);
92 pn_sockaddr_set_resource(sa, ph->pn_res);
93 memset(sa->spn_zero, 0, sizeof(sa->spn_zero));
94}
95
96/* Protocols in Phonet protocol family. */
97struct phonet_protocol {
98 const struct proto_ops *ops;
99 struct proto *prot;
100 int sock_type;
101};
102
103int phonet_proto_register(int protocol, struct phonet_protocol *pp);
104void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
105
106int phonet_sysctl_init(void);
107void phonet_sysctl_exit(void);
108void phonet_netlink_register(void);
109int isi_register(void);
110void isi_unregister(void);
111
112#endif
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h
new file mode 100644
index 000000000000..bbd2a836e04c
--- /dev/null
+++ b/include/net/phonet/pn_dev.h
@@ -0,0 +1,50 @@
1/*
2 * File: pn_dev.h
3 *
4 * Phonet network device
5 *
6 * Copyright (C) 2008 Nokia Corporation.
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 * version 2 as published by the Free Software Foundation.
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef PN_DEV_H
24#define PN_DEV_H
25
26struct phonet_device_list {
27 struct list_head list;
28 spinlock_t lock;
29};
30
31extern struct phonet_device_list pndevs;
32
33struct phonet_device {
34 struct list_head list;
35 struct net_device *netdev;
36 DECLARE_BITMAP(addrs, 64);
37};
38
39void phonet_device_init(void);
40void phonet_device_exit(void);
41struct net_device *phonet_device_get(struct net *net);
42
43int phonet_address_add(struct net_device *dev, u8 addr);
44int phonet_address_del(struct net_device *dev, u8 addr);
45u8 phonet_address_get(struct net_device *dev, u8 addr);
46int phonet_address_lookup(u8 addr);
47
48#define PN_NO_ADDR 0xff
49
50#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index b786a5b09253..4082f39f5079 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -90,10 +90,7 @@ extern void __qdisc_run(struct Qdisc *q);
90 90
91static inline void qdisc_run(struct Qdisc *q) 91static inline void qdisc_run(struct Qdisc *q)
92{ 92{
93 struct netdev_queue *txq = q->dev_queue; 93 if (!test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
94
95 if (!netif_tx_queue_stopped(txq) &&
96 !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state))
97 __qdisc_run(q); 94 __qdisc_run(q);
98} 95}
99 96
diff --git a/include/net/route.h b/include/net/route.h
index 4f0d8c14736c..4e8cae0e5841 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -27,7 +27,7 @@
27#include <net/dst.h> 27#include <net/dst.h>
28#include <net/inetpeer.h> 28#include <net/inetpeer.h>
29#include <net/flow.h> 29#include <net/flow.h>
30#include <net/sock.h> 30#include <net/inet_sock.h>
31#include <linux/in_route.h> 31#include <linux/in_route.h>
32#include <linux/rtnetlink.h> 32#include <linux/rtnetlink.h>
33#include <linux/route.h> 33#include <linux/route.h>
@@ -161,6 +161,10 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
161 161
162 int err; 162 int err;
163 struct net *net = sock_net(sk); 163 struct net *net = sock_net(sk);
164
165 if (inet_sk(sk)->transparent)
166 fl.flags |= FLOWI_FLAG_ANYSRC;
167
164 if (!dst || !src) { 168 if (!dst || !src) {
165 err = __ip_route_output_key(net, rp, &fl); 169 err = __ip_route_output_key(net, rp, &fl);
166 if (err) 170 if (err)
@@ -204,4 +208,9 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
204 return rt->peer; 208 return rt->peer;
205} 209}
206 210
211static inline int inet_iif(const struct sk_buff *skb)
212{
213 return skb->rtable->rt_iif;
214}
215
207#endif /* _ROUTE_H */ 216#endif /* _ROUTE_H */
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index e5569625d2a5..3fe49d808957 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -53,6 +53,7 @@ struct Qdisc
53 atomic_t refcnt; 53 atomic_t refcnt;
54 unsigned long state; 54 unsigned long state;
55 struct sk_buff *gso_skb; 55 struct sk_buff *gso_skb;
56 struct sk_buff_head requeue;
56 struct sk_buff_head q; 57 struct sk_buff_head q;
57 struct netdev_queue *dev_queue; 58 struct netdev_queue *dev_queue;
58 struct Qdisc *next_sched; 59 struct Qdisc *next_sched;
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index c32ddf0279c8..b05b0557211f 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -261,7 +261,9 @@ enum { SCTP_ARBITRARY_COOKIE_ECHO_LEN = 200 };
261 * must be less than 65535 (2^16 - 1), or we will have overflow 261 * must be less than 65535 (2^16 - 1), or we will have overflow
262 * problems creating SACK's. 262 * problems creating SACK's.
263 */ 263 */
264#define SCTP_TSN_MAP_SIZE 2048 264#define SCTP_TSN_MAP_INITIAL BITS_PER_LONG
265#define SCTP_TSN_MAP_INCREMENT SCTP_TSN_MAP_INITIAL
266#define SCTP_TSN_MAP_SIZE 4096
265#define SCTP_TSN_MAX_GAP 65535 267#define SCTP_TSN_MAX_GAP 65535
266 268
267/* We will not record more than this many duplicate TSNs between two 269/* We will not record more than this many duplicate TSNs between two
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 17b932b8a55a..ed71b110edf7 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -303,7 +303,7 @@ extern int sctp_debug_flag;
303#define SCTP_ASSERT(expr, str, func) \ 303#define SCTP_ASSERT(expr, str, func) \
304 if (!(expr)) { \ 304 if (!(expr)) { \
305 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \ 305 SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \
306 str, (#expr), __FILE__, __FUNCTION__, __LINE__); \ 306 str, (#expr), __FILE__, __func__, __LINE__); \
307 func; \ 307 func; \
308 } 308 }
309 309
@@ -406,10 +406,7 @@ struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id);
406 406
407/* A macro to walk a list of skbs. */ 407/* A macro to walk a list of skbs. */
408#define sctp_skb_for_each(pos, head, tmp) \ 408#define sctp_skb_for_each(pos, head, tmp) \
409for (pos = (head)->next;\ 409 skb_queue_walk_safe(head, pos, tmp)
410 tmp = (pos)->next, pos != ((struct sk_buff *)(head));\
411 pos = tmp)
412
413 410
414/* A helper to append an entire skb list (list) to another (head). */ 411/* A helper to append an entire skb list (list) to another (head). */
415static inline void sctp_skb_list_tail(struct sk_buff_head *list, 412static inline void sctp_skb_list_tail(struct sk_buff_head *list,
@@ -420,10 +417,7 @@ static inline void sctp_skb_list_tail(struct sk_buff_head *list,
420 sctp_spin_lock_irqsave(&head->lock, flags); 417 sctp_spin_lock_irqsave(&head->lock, flags);
421 sctp_spin_lock(&list->lock); 418 sctp_spin_lock(&list->lock);
422 419
423 list_splice((struct list_head *)list, (struct list_head *)head->prev); 420 skb_queue_splice_tail_init(list, head);
424
425 head->qlen += list->qlen;
426 list->qlen = 0;
427 421
428 sctp_spin_unlock(&list->lock); 422 sctp_spin_unlock(&list->lock);
429 sctp_spin_unlock_irqrestore(&head->lock, flags); 423 sctp_spin_unlock_irqrestore(&head->lock, flags);
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 029a54a02396..c1dd89365833 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -125,6 +125,7 @@ sctp_state_fn_t sctp_sf_beat_8_3;
125sctp_state_fn_t sctp_sf_backbeat_8_3; 125sctp_state_fn_t sctp_sf_backbeat_8_3;
126sctp_state_fn_t sctp_sf_do_9_2_final; 126sctp_state_fn_t sctp_sf_do_9_2_final;
127sctp_state_fn_t sctp_sf_do_9_2_shutdown; 127sctp_state_fn_t sctp_sf_do_9_2_shutdown;
128sctp_state_fn_t sctp_sf_do_9_2_shut_ctsn;
128sctp_state_fn_t sctp_sf_do_ecn_cwr; 129sctp_state_fn_t sctp_sf_do_ecn_cwr;
129sctp_state_fn_t sctp_sf_do_ecne; 130sctp_state_fn_t sctp_sf_do_ecne;
130sctp_state_fn_t sctp_sf_ootb; 131sctp_state_fn_t sctp_sf_ootb;
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index ab1c472ea753..9661d7b765f0 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -731,20 +731,23 @@ struct sctp_chunk {
731 */ 731 */
732 struct sk_buff *auth_chunk; 732 struct sk_buff *auth_chunk;
733 733
734 __u8 rtt_in_progress; /* Is this chunk used for RTT calculation? */ 734#define SCTP_CAN_FRTX 0x0
735 __u8 resent; /* Has this chunk ever been retransmitted. */ 735#define SCTP_NEED_FRTX 0x1
736 __u8 has_tsn; /* Does this chunk have a TSN yet? */ 736#define SCTP_DONT_FRTX 0x2
737 __u8 has_ssn; /* Does this chunk have a SSN yet? */ 737 __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */
738 __u8 singleton; /* Was this the only chunk in the packet? */ 738 resent:1, /* Has this chunk ever been resent. */
739 __u8 end_of_packet; /* Was this the last chunk in the packet? */ 739 has_tsn:1, /* Does this chunk have a TSN yet? */
740 __u8 ecn_ce_done; /* Have we processed the ECN CE bit? */ 740 has_ssn:1, /* Does this chunk have a SSN yet? */
741 __u8 pdiscard; /* Discard the whole packet now? */ 741 singleton:1, /* Only chunk in the packet? */
742 __u8 tsn_gap_acked; /* Is this chunk acked by a GAP ACK? */ 742 end_of_packet:1, /* Last chunk in the packet? */
743 __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ 743 ecn_ce_done:1, /* Have we processed the ECN CE bit? */
744 __u8 tsn_missing_report; /* Data chunk missing counter. */ 744 pdiscard:1, /* Discard the whole packet now? */
745 __u8 data_accepted; /* At least 1 chunk in this packet accepted */ 745 tsn_gap_acked:1, /* Is this chunk acked by a GAP ACK? */
746 __u8 auth; /* IN: was auth'ed | OUT: needs auth */ 746 data_accepted:1, /* At least 1 chunk accepted */
747 __u8 has_asconf; /* IN: have seen an asconf before */ 747 auth:1, /* IN: was auth'ed | OUT: needs auth */
748 has_asconf:1, /* IN: have seen an asconf before */
749 tsn_missing_report:2, /* Data chunk missing counter. */
750 fast_retransmit:2; /* Is this chunk fast retransmitted? */
748}; 751};
749 752
750void sctp_chunk_hold(struct sctp_chunk *); 753void sctp_chunk_hold(struct sctp_chunk *);
@@ -1225,7 +1228,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1225 1228
1226sctp_scope_t sctp_scope(const union sctp_addr *); 1229sctp_scope_t sctp_scope(const union sctp_addr *);
1227int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1230int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope);
1228int sctp_is_any(const union sctp_addr *addr); 1231int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1229int sctp_addr_is_valid(const union sctp_addr *addr); 1232int sctp_addr_is_valid(const union sctp_addr *addr);
1230 1233
1231 1234
@@ -1542,7 +1545,6 @@ struct sctp_association {
1542 * in tsn_map--we get it by calling sctp_tsnmap_get_ctsn(). 1545 * in tsn_map--we get it by calling sctp_tsnmap_get_ctsn().
1543 */ 1546 */
1544 struct sctp_tsnmap tsn_map; 1547 struct sctp_tsnmap tsn_map;
1545 __u8 _map[sctp_tsnmap_storage_size(SCTP_TSN_MAP_SIZE)];
1546 1548
1547 /* Ack State : This flag indicates if the next received 1549 /* Ack State : This flag indicates if the next received
1548 * : packet is to be responded to with a 1550 * : packet is to be responded to with a
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h
index 099211bf998d..4aabc5a96cf6 100644
--- a/include/net/sctp/tsnmap.h
+++ b/include/net/sctp/tsnmap.h
@@ -60,18 +60,7 @@ struct sctp_tsnmap {
60 * It points at one of the two buffers with which we will 60 * It points at one of the two buffers with which we will
61 * ping-pong between. 61 * ping-pong between.
62 */ 62 */
63 __u8 *tsn_map; 63 unsigned long *tsn_map;
64
65 /* This marks the tsn which overflows the tsn_map, when the
66 * cumulative ack point reaches this point we know we can switch
67 * maps (tsn_map and overflow_map swap).
68 */
69 __u32 overflow_tsn;
70
71 /* This is the overflow array for tsn_map.
72 * It points at one of the other ping-pong buffers.
73 */
74 __u8 *overflow_map;
75 64
76 /* This is the TSN at tsn_map[0]. */ 65 /* This is the TSN at tsn_map[0]. */
77 __u32 base_tsn; 66 __u32 base_tsn;
@@ -89,15 +78,15 @@ struct sctp_tsnmap {
89 */ 78 */
90 __u32 cumulative_tsn_ack_point; 79 __u32 cumulative_tsn_ack_point;
91 80
81 /* This is the highest TSN we've marked. */
82 __u32 max_tsn_seen;
83
92 /* This is the minimum number of TSNs we can track. This corresponds 84 /* This is the minimum number of TSNs we can track. This corresponds
93 * to the size of tsn_map. Note: the overflow_map allows us to 85 * to the size of tsn_map. Note: the overflow_map allows us to
94 * potentially track more than this quantity. 86 * potentially track more than this quantity.
95 */ 87 */
96 __u16 len; 88 __u16 len;
97 89
98 /* This is the highest TSN we've marked. */
99 __u32 max_tsn_seen;
100
101 /* Data chunks pending receipt. used by SCTP_STATUS sockopt */ 90 /* Data chunks pending receipt. used by SCTP_STATUS sockopt */
102 __u16 pending_data; 91 __u16 pending_data;
103 92
@@ -105,29 +94,19 @@ struct sctp_tsnmap {
105 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of 94 * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of
106 * information. 95 * information.
107 */ 96 */
108 __be32 dup_tsns[SCTP_MAX_DUP_TSNS];
109 __u16 num_dup_tsns; 97 __u16 num_dup_tsns;
110 98 __be32 dup_tsns[SCTP_MAX_DUP_TSNS];
111 /* Record gap ack block information here. */
112 struct sctp_gap_ack_block gabs[SCTP_MAX_GABS];
113
114 int malloced;
115
116 __u8 raw_map[0];
117}; 99};
118 100
119struct sctp_tsnmap_iter { 101struct sctp_tsnmap_iter {
120 __u32 start; 102 __u32 start;
121}; 103};
122 104
123/* This macro assists in creation of external storage for variable length
124 * internal buffers. We double allocate so the overflow map works.
125 */
126#define sctp_tsnmap_storage_size(count) (sizeof(__u8) * (count) * 2)
127
128/* Initialize a block of memory as a tsnmap. */ 105/* Initialize a block of memory as a tsnmap. */
129struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len, 106struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len,
130 __u32 initial_tsn); 107 __u32 initial_tsn, gfp_t gfp);
108
109void sctp_tsnmap_free(struct sctp_tsnmap *map);
131 110
132/* Test the tracking state of this TSN. 111/* Test the tracking state of this TSN.
133 * Returns: 112 * Returns:
@@ -138,7 +117,7 @@ struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len,
138int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); 117int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn);
139 118
140/* Mark this TSN as seen. */ 119/* Mark this TSN as seen. */
141void sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); 120int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn);
142 121
143/* Mark this TSN and all lower as seen. */ 122/* Mark this TSN and all lower as seen. */
144void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); 123void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn);
@@ -169,24 +148,16 @@ static inline __be32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map)
169} 148}
170 149
171/* How many gap ack blocks do we have recorded? */ 150/* How many gap ack blocks do we have recorded? */
172__u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map); 151__u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map,
152 struct sctp_gap_ack_block *gabs);
173 153
174/* Refresh the count on pending data. */ 154/* Refresh the count on pending data. */
175__u16 sctp_tsnmap_pending(struct sctp_tsnmap *map); 155__u16 sctp_tsnmap_pending(struct sctp_tsnmap *map);
176 156
177/* Return pointer to gap ack blocks as needed by SACK. */
178static inline struct sctp_gap_ack_block *sctp_tsnmap_get_gabs(struct sctp_tsnmap *map)
179{
180 return map->gabs;
181}
182
183/* Is there a gap in the TSN map? */ 157/* Is there a gap in the TSN map? */
184static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) 158static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map)
185{ 159{
186 int has_gap; 160 return (map->cumulative_tsn_ack_point != map->max_tsn_seen);
187
188 has_gap = (map->cumulative_tsn_ack_point != map->max_tsn_seen);
189 return has_gap;
190} 161}
191 162
192/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN 163/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN
diff --git a/include/net/sock.h b/include/net/sock.h
index 06c5259aff30..ada50c04d09f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -482,6 +482,11 @@ static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb)
482 skb->next = NULL; 482 skb->next = NULL;
483} 483}
484 484
485static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
486{
487 return sk->sk_backlog_rcv(sk, skb);
488}
489
485#define sk_wait_event(__sk, __timeo, __condition) \ 490#define sk_wait_event(__sk, __timeo, __condition) \
486 ({ int __rc; \ 491 ({ int __rc; \
487 release_sock(__sk); \ 492 release_sock(__sk); \
@@ -532,6 +537,7 @@ struct proto {
532 int (*getsockopt)(struct sock *sk, int level, 537 int (*getsockopt)(struct sock *sk, int level,
533 int optname, char __user *optval, 538 int optname, char __user *optval,
534 int __user *option); 539 int __user *option);
540#ifdef CONFIG_COMPAT
535 int (*compat_setsockopt)(struct sock *sk, 541 int (*compat_setsockopt)(struct sock *sk,
536 int level, 542 int level,
537 int optname, char __user *optval, 543 int optname, char __user *optval,
@@ -540,6 +546,7 @@ struct proto {
540 int level, 546 int level,
541 int optname, char __user *optval, 547 int optname, char __user *optval,
542 int __user *option); 548 int __user *option);
549#endif
543 int (*sendmsg)(struct kiocb *iocb, struct sock *sk, 550 int (*sendmsg)(struct kiocb *iocb, struct sock *sk,
544 struct msghdr *msg, size_t len); 551 struct msghdr *msg, size_t len);
545 int (*recvmsg)(struct kiocb *iocb, struct sock *sk, 552 int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
@@ -1322,6 +1329,18 @@ static inline void sk_change_net(struct sock *sk, struct net *net)
1322 sock_net_set(sk, hold_net(net)); 1329 sock_net_set(sk, hold_net(net));
1323} 1330}
1324 1331
1332static inline struct sock *skb_steal_sock(struct sk_buff *skb)
1333{
1334 if (unlikely(skb->sk)) {
1335 struct sock *sk = skb->sk;
1336
1337 skb->destructor = NULL;
1338 skb->sk = NULL;
1339 return sk;
1340 }
1341 return NULL;
1342}
1343
1325extern void sock_enable_timestamp(struct sock *sk); 1344extern void sock_enable_timestamp(struct sock *sk);
1326extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1345extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1327extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1346extern int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
new file mode 100644
index 000000000000..6abb3ed3ebf7
--- /dev/null
+++ b/include/net/tc_act/tc_skbedit.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Alexander Duyck <alexander.h.duyck@intel.com>
18 */
19
20#ifndef __NET_TC_SKBEDIT_H
21#define __NET_TC_SKBEDIT_H
22
23#include <net/act_api.h>
24
25struct tcf_skbedit {
26 struct tcf_common common;
27 u32 flags;
28 u32 priority;
29 u16 queue_mapping;
30};
31#define to_skbedit(pc) \
32 container_of(pc, struct tcf_skbedit, common)
33
34#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 8983386356a5..438014d57610 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -472,6 +472,8 @@ extern void tcp_send_delayed_ack(struct sock *sk);
472 472
473/* tcp_input.c */ 473/* tcp_input.c */
474extern void tcp_cwnd_application_limited(struct sock *sk); 474extern void tcp_cwnd_application_limited(struct sock *sk);
475extern void tcp_skb_mark_lost_uncond_verify(struct tcp_sock *tp,
476 struct sk_buff *skb);
475 477
476/* tcp_timer.c */ 478/* tcp_timer.c */
477extern void tcp_init_xmit_timers(struct sock *); 479extern void tcp_init_xmit_timers(struct sock *);
@@ -894,7 +896,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
894 BUG_ON(sock_owned_by_user(sk)); 896 BUG_ON(sock_owned_by_user(sk));
895 897
896 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 898 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
897 sk->sk_backlog_rcv(sk, skb1); 899 sk_backlog_rcv(sk, skb1);
898 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); 900 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED);
899 } 901 }
900 902
@@ -974,6 +976,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
974 ireq->acked = 0; 976 ireq->acked = 0;
975 ireq->ecn_ok = 0; 977 ireq->ecn_ok = 0;
976 ireq->rmt_port = tcp_hdr(skb)->source; 978 ireq->rmt_port = tcp_hdr(skb)->source;
979 ireq->loc_port = tcp_hdr(skb)->dest;
977} 980}
978 981
979extern void tcp_enter_memory_pressure(struct sock *sk); 982extern void tcp_enter_memory_pressure(struct sock *sk);
@@ -1039,13 +1042,12 @@ static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp)
1039{ 1042{
1040 tp->lost_skb_hint = NULL; 1043 tp->lost_skb_hint = NULL;
1041 tp->scoreboard_skb_hint = NULL; 1044 tp->scoreboard_skb_hint = NULL;
1042 tp->retransmit_skb_hint = NULL;
1043 tp->forward_skb_hint = NULL;
1044} 1045}
1045 1046
1046static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) 1047static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
1047{ 1048{
1048 tcp_clear_retrans_hints_partial(tp); 1049 tcp_clear_retrans_hints_partial(tp);
1050 tp->retransmit_skb_hint = NULL;
1049} 1051}
1050 1052
1051/* MD5 Signature */ 1053/* MD5 Signature */
@@ -1180,49 +1182,45 @@ static inline void tcp_write_queue_purge(struct sock *sk)
1180 1182
1181static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) 1183static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
1182{ 1184{
1183 struct sk_buff *skb = sk->sk_write_queue.next; 1185 return skb_peek(&sk->sk_write_queue);
1184 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1185 return NULL;
1186 return skb;
1187} 1186}
1188 1187
1189static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk) 1188static inline struct sk_buff *tcp_write_queue_tail(struct sock *sk)
1190{ 1189{
1191 struct sk_buff *skb = sk->sk_write_queue.prev; 1190 return skb_peek_tail(&sk->sk_write_queue);
1192 if (skb == (struct sk_buff *) &sk->sk_write_queue)
1193 return NULL;
1194 return skb;
1195} 1191}
1196 1192
1197static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb) 1193static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_buff *skb)
1198{ 1194{
1199 return skb->next; 1195 return skb_queue_next(&sk->sk_write_queue, skb);
1200} 1196}
1201 1197
1202#define tcp_for_write_queue(skb, sk) \ 1198#define tcp_for_write_queue(skb, sk) \
1203 for (skb = (sk)->sk_write_queue.next; \ 1199 skb_queue_walk(&(sk)->sk_write_queue, skb)
1204 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1205 skb = skb->next)
1206 1200
1207#define tcp_for_write_queue_from(skb, sk) \ 1201#define tcp_for_write_queue_from(skb, sk) \
1208 for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ 1202 skb_queue_walk_from(&(sk)->sk_write_queue, skb)
1209 skb = skb->next)
1210 1203
1211#define tcp_for_write_queue_from_safe(skb, tmp, sk) \ 1204#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
1212 for (tmp = skb->next; \ 1205 skb_queue_walk_from_safe(&(sk)->sk_write_queue, skb, tmp)
1213 (skb != (struct sk_buff *)&(sk)->sk_write_queue); \
1214 skb = tmp, tmp = skb->next)
1215 1206
1216static inline struct sk_buff *tcp_send_head(struct sock *sk) 1207static inline struct sk_buff *tcp_send_head(struct sock *sk)
1217{ 1208{
1218 return sk->sk_send_head; 1209 return sk->sk_send_head;
1219} 1210}
1220 1211
1212static inline bool tcp_skb_is_last(const struct sock *sk,
1213 const struct sk_buff *skb)
1214{
1215 return skb_queue_is_last(&sk->sk_write_queue, skb);
1216}
1217
1221static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) 1218static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb)
1222{ 1219{
1223 sk->sk_send_head = skb->next; 1220 if (tcp_skb_is_last(sk, skb))
1224 if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
1225 sk->sk_send_head = NULL; 1221 sk->sk_send_head = NULL;
1222 else
1223 sk->sk_send_head = tcp_write_queue_next(sk, skb);
1226} 1224}
1227 1225
1228static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) 1226static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked)
@@ -1267,12 +1265,12 @@ static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1267 __skb_queue_after(&sk->sk_write_queue, skb, buff); 1265 __skb_queue_after(&sk->sk_write_queue, skb, buff);
1268} 1266}
1269 1267
1270/* Insert skb between prev and next on the write queue of sk. */ 1268/* Insert new before skb on the write queue of sk. */
1271static inline void tcp_insert_write_queue_before(struct sk_buff *new, 1269static inline void tcp_insert_write_queue_before(struct sk_buff *new,
1272 struct sk_buff *skb, 1270 struct sk_buff *skb,
1273 struct sock *sk) 1271 struct sock *sk)
1274{ 1272{
1275 __skb_insert(new, skb->prev, skb, &sk->sk_write_queue); 1273 __skb_queue_before(&sk->sk_write_queue, skb, new);
1276 1274
1277 if (sk->sk_send_head == skb) 1275 if (sk->sk_send_head == skb)
1278 sk->sk_send_head = new; 1276 sk->sk_send_head = new;
@@ -1283,12 +1281,6 @@ static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1283 __skb_unlink(skb, &sk->sk_write_queue); 1281 __skb_unlink(skb, &sk->sk_write_queue);
1284} 1282}
1285 1283
1286static inline int tcp_skb_is_last(const struct sock *sk,
1287 const struct sk_buff *skb)
1288{
1289 return skb->next == (struct sk_buff *)&sk->sk_write_queue;
1290}
1291
1292static inline int tcp_write_queue_empty(struct sock *sk) 1284static inline int tcp_write_queue_empty(struct sock *sk)
1293{ 1285{
1294 return skb_queue_empty(&sk->sk_write_queue); 1286 return skb_queue_empty(&sk->sk_write_queue);
diff --git a/include/net/udp.h b/include/net/udp.h
index addcdc67234c..1e205095ea68 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -148,10 +148,9 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname,
148 char __user *optval, int optlen, 148 char __user *optval, int optlen,
149 int (*push_pending_frames)(struct sock *)); 149 int (*push_pending_frames)(struct sock *));
150 150
151DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); 151extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
152 152 __be32 daddr, __be16 dport,
153/* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ 153 int dif);
154DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
155 154
156/* 155/*
157 * SNMP statistics for UDP and UDP-Lite 156 * SNMP statistics for UDP and UDP-Lite
@@ -163,12 +162,14 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
163 if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \ 162 if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_statistics, field); \
164 else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0) 163 else SNMP_INC_STATS_BH((net)->mib.udp_statistics, field); } while(0)
165 164
166#define UDP6_INC_STATS_BH(net, field, is_udplite) do { (void)net; \ 165#define UDP6_INC_STATS_BH(net, field, is_udplite) do { \
167 if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ 166 if (is_udplite) SNMP_INC_STATS_BH((net)->mib.udplite_stats_in6, field);\
168 else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) 167 else SNMP_INC_STATS_BH((net)->mib.udp_stats_in6, field); \
169#define UDP6_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ 168} while(0)
170 if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ 169#define UDP6_INC_STATS_USER(net, field, __lite) do { \
171 else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) 170 if (__lite) SNMP_INC_STATS_USER((net)->mib.udplite_stats_in6, field); \
171 else SNMP_INC_STATS_USER((net)->mib.udp_stats_in6, field); \
172} while(0)
172 173
173#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 174#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
174#define UDPX_INC_STATS_BH(sk, field) \ 175#define UDPX_INC_STATS_BH(sk, field) \
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 9324f8dd183e..721efb363db7 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -60,6 +60,7 @@ enum ieee80211_channel_flags {
60 * with cfg80211. 60 * with cfg80211.
61 * 61 *
62 * @center_freq: center frequency in MHz 62 * @center_freq: center frequency in MHz
63 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
63 * @hw_value: hardware-specific value for the channel 64 * @hw_value: hardware-specific value for the channel
64 * @flags: channel flags from &enum ieee80211_channel_flags. 65 * @flags: channel flags from &enum ieee80211_channel_flags.
65 * @orig_flags: channel flags at registration time, used by regulatory 66 * @orig_flags: channel flags at registration time, used by regulatory
@@ -73,6 +74,7 @@ enum ieee80211_channel_flags {
73struct ieee80211_channel { 74struct ieee80211_channel {
74 enum ieee80211_band band; 75 enum ieee80211_band band;
75 u16 center_freq; 76 u16 center_freq;
77 u8 max_bandwidth;
76 u16 hw_value; 78 u16 hw_value;
77 u32 flags; 79 u32 flags;
78 int max_antenna_gain; 80 int max_antenna_gain;
@@ -178,6 +180,7 @@ struct ieee80211_supported_band {
178 * struct wiphy - wireless hardware description 180 * struct wiphy - wireless hardware description
179 * @idx: the wiphy index assigned to this item 181 * @idx: the wiphy index assigned to this item
180 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 182 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
183 * @reg_notifier: the driver's regulatory notification callback
181 */ 184 */
182struct wiphy { 185struct wiphy {
183 /* assign these fields before you register the wiphy */ 186 /* assign these fields before you register the wiphy */
@@ -185,6 +188,9 @@ struct wiphy {
185 /* permanent MAC address */ 188 /* permanent MAC address */
186 u8 perm_addr[ETH_ALEN]; 189 u8 perm_addr[ETH_ALEN];
187 190
191 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
192 u16 interface_modes;
193
188 /* If multiple wiphys are registered and you're handed e.g. 194 /* If multiple wiphys are registered and you're handed e.g.
189 * a regular netdev with assigned ieee80211_ptr, you won't 195 * a regular netdev with assigned ieee80211_ptr, you won't
190 * know whether it points to a wiphy your driver has registered 196 * know whether it points to a wiphy your driver has registered
@@ -194,6 +200,9 @@ struct wiphy {
194 200
195 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; 201 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
196 202
203 /* Lets us get back the wiphy on the callback */
204 int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby);
205
197 /* fields below are read-only, assigned by cfg80211 */ 206 /* fields below are read-only, assigned by cfg80211 */
198 207
199 /* the item in /sys/class/ieee80211/ points to this, 208 /* the item in /sys/class/ieee80211/ points to this,
@@ -214,9 +223,11 @@ struct wiphy {
214 * the netdev.) 223 * the netdev.)
215 * 224 *
216 * @wiphy: pointer to hardware description 225 * @wiphy: pointer to hardware description
226 * @iftype: interface type
217 */ 227 */
218struct wireless_dev { 228struct wireless_dev {
219 struct wiphy *wiphy; 229 struct wiphy *wiphy;
230 enum nl80211_iftype iftype;
220 231
221 /* private to the generic wireless code */ 232 /* private to the generic wireless code */
222 struct list_head list; 233 struct list_head list;
@@ -319,7 +330,6 @@ extern int ieee80211_frequency_to_channel(int freq);
319 */ 330 */
320extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, 331extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
321 int freq); 332 int freq);
322
323/** 333/**
324 * ieee80211_get_channel - get channel struct from wiphy for specified frequency 334 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
325 */ 335 */
@@ -328,4 +338,57 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
328{ 338{
329 return __ieee80211_get_channel(wiphy, freq); 339 return __ieee80211_get_channel(wiphy, freq);
330} 340}
341
342/**
343 * __regulatory_hint - hint to the wireless core a regulatory domain
344 * @wiphy: if a driver is providing the hint this is the driver's very
345 * own &struct wiphy
346 * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
347 * should be in. If @rd is set this should be NULL
348 * @rd: a complete regulatory domain, if passed the caller need not worry
349 * about freeing it
350 *
351 * The Wireless subsystem can use this function to hint to the wireless core
352 * what it believes should be the current regulatory domain by
353 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
354 * domain should be in or by providing a completely build regulatory domain.
355 *
356 * Returns -EALREADY if *a regulatory domain* has already been set. Note that
357 * this could be by another driver. It is safe for drivers to continue if
358 * -EALREADY is returned, if drivers are not capable of world roaming they
359 * should not register more channels than they support. Right now we only
360 * support listening to the first driver hint. If the driver is capable
361 * of world roaming but wants to respect its own EEPROM mappings for
362 * specific regulatory domains it should register the @reg_notifier callback
363 * on the &struct wiphy. Returns 0 if the hint went through fine or through an
364 * intersection operation. Otherwise a standard error code is returned.
365 *
366 */
367extern int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
368 const char *alpha2, struct ieee80211_regdomain *rd);
369/**
370 * regulatory_hint - driver hint to the wireless core a regulatory domain
371 * @wiphy: the driver's very own &struct wiphy
372 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
373 * should be in. If @rd is set this should be NULL. Note that if you
374 * set this to NULL you should still set rd->alpha2 to some accepted
375 * alpha2.
376 * @rd: a complete regulatory domain provided by the driver. If passed
377 * the driver does not need to worry about freeing it.
378 *
379 * Wireless drivers can use this function to hint to the wireless core
380 * what it believes should be the current regulatory domain by
381 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
382 * domain should be in or by providing a completely build regulatory domain.
383 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
384 * for a regulatory domain structure for the respective country. If
385 * a regulatory domain is build and passed you should set the alpha2
386 * if possible, otherwise set it to the special value of "99" which tells
387 * the wireless core it is unknown. If you pass a built regulatory domain
388 * and we return non zero you are in charge of kfree()'ing the structure.
389 *
390 * See __regulatory_hint() documentation for possible return values.
391 */
392extern int regulatory_hint(struct wiphy *wiphy,
393 const char *alpha2, struct ieee80211_regdomain *rd);
331#endif /* __NET_WIRELESS_H */ 394#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 2933d7474a79..11c890ad8ebb 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -117,12 +117,23 @@ extern struct mutex xfrm_cfg_mutex;
117 metrics. Plus, it will be made via sk->sk_dst_cache. Solved. 117 metrics. Plus, it will be made via sk->sk_dst_cache. Solved.
118 */ 118 */
119 119
120struct xfrm_state_walk {
121 struct list_head all;
122 u8 state;
123 union {
124 u8 dying;
125 u8 proto;
126 };
127 u32 seq;
128};
129
120/* Full description of state of transformer. */ 130/* Full description of state of transformer. */
121struct xfrm_state 131struct xfrm_state
122{ 132{
123 /* Note: bydst is re-used during gc */ 133 union {
124 struct list_head all; 134 struct hlist_node gclist;
125 struct hlist_node bydst; 135 struct hlist_node bydst;
136 };
126 struct hlist_node bysrc; 137 struct hlist_node bysrc;
127 struct hlist_node byspi; 138 struct hlist_node byspi;
128 139
@@ -134,12 +145,8 @@ struct xfrm_state
134 145
135 u32 genid; 146 u32 genid;
136 147
137 /* Key manger bits */ 148 /* Key manager bits */
138 struct { 149 struct xfrm_state_walk km;
139 u8 state;
140 u8 dying;
141 u32 seq;
142 } km;
143 150
144 /* Parameters of this state. */ 151 /* Parameters of this state. */
145 struct { 152 struct {
@@ -447,10 +454,20 @@ struct xfrm_tmpl
447 454
448#define XFRM_MAX_DEPTH 6 455#define XFRM_MAX_DEPTH 6
449 456
457struct xfrm_policy_walk_entry {
458 struct list_head all;
459 u8 dead;
460};
461
462struct xfrm_policy_walk {
463 struct xfrm_policy_walk_entry walk;
464 u8 type;
465 u32 seq;
466};
467
450struct xfrm_policy 468struct xfrm_policy
451{ 469{
452 struct xfrm_policy *next; 470 struct xfrm_policy *next;
453 struct list_head bytype;
454 struct hlist_node bydst; 471 struct hlist_node bydst;
455 struct hlist_node byidx; 472 struct hlist_node byidx;
456 473
@@ -465,17 +482,23 @@ struct xfrm_policy
465 struct xfrm_lifetime_cfg lft; 482 struct xfrm_lifetime_cfg lft;
466 struct xfrm_lifetime_cur curlft; 483 struct xfrm_lifetime_cur curlft;
467 struct dst_entry *bundles; 484 struct dst_entry *bundles;
468 u16 family; 485 struct xfrm_policy_walk_entry walk;
469 u8 type; 486 u8 type;
470 u8 action; 487 u8 action;
471 u8 flags; 488 u8 flags;
472 u8 dead;
473 u8 xfrm_nr; 489 u8 xfrm_nr;
474 /* XXX 1 byte hole, try to pack */ 490 u16 family;
475 struct xfrm_sec_ctx *security; 491 struct xfrm_sec_ctx *security;
476 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 492 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
477}; 493};
478 494
495struct xfrm_kmaddress {
496 xfrm_address_t local;
497 xfrm_address_t remote;
498 u32 reserved;
499 u16 family;
500};
501
479struct xfrm_migrate { 502struct xfrm_migrate {
480 xfrm_address_t old_daddr; 503 xfrm_address_t old_daddr;
481 xfrm_address_t old_saddr; 504 xfrm_address_t old_saddr;
@@ -515,7 +538,7 @@ struct xfrm_mgr
515 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 538 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
516 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 539 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
517 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 540 int (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
518 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles); 541 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
519}; 542};
520 543
521extern int xfrm_register_km(struct xfrm_mgr *km); 544extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -1243,18 +1266,6 @@ struct xfrm6_tunnel {
1243 int priority; 1266 int priority;
1244}; 1267};
1245 1268
1246struct xfrm_state_walk {
1247 struct xfrm_state *state;
1248 int count;
1249 u8 proto;
1250};
1251
1252struct xfrm_policy_walk {
1253 struct xfrm_policy *policy;
1254 int count;
1255 u8 type, cur_type;
1256};
1257
1258extern void xfrm_init(void); 1269extern void xfrm_init(void);
1259extern void xfrm4_init(void); 1270extern void xfrm4_init(void);
1260extern void xfrm_state_init(void); 1271extern void xfrm_state_init(void);
@@ -1279,23 +1290,10 @@ static inline void xfrm6_fini(void)
1279extern int xfrm_proc_init(void); 1290extern int xfrm_proc_init(void);
1280#endif 1291#endif
1281 1292
1282static inline void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto) 1293extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1283{
1284 walk->proto = proto;
1285 walk->state = NULL;
1286 walk->count = 0;
1287}
1288
1289static inline void xfrm_state_walk_done(struct xfrm_state_walk *walk)
1290{
1291 if (walk->state != NULL) {
1292 xfrm_state_put(walk->state);
1293 walk->state = NULL;
1294 }
1295}
1296
1297extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1294extern int xfrm_state_walk(struct xfrm_state_walk *walk,
1298 int (*func)(struct xfrm_state *, int, void*), void *); 1295 int (*func)(struct xfrm_state *, int, void*), void *);
1296extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1299extern struct xfrm_state *xfrm_state_alloc(void); 1297extern struct xfrm_state *xfrm_state_alloc(void);
1300extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1298extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
1301 struct flowi *fl, struct xfrm_tmpl *tmpl, 1299 struct flowi *fl, struct xfrm_tmpl *tmpl,
@@ -1419,24 +1417,10 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1419 1417
1420struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1418struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
1421 1419
1422static inline void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type) 1420extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1423{
1424 walk->cur_type = XFRM_POLICY_TYPE_MAIN;
1425 walk->type = type;
1426 walk->policy = NULL;
1427 walk->count = 0;
1428}
1429
1430static inline void xfrm_policy_walk_done(struct xfrm_policy_walk *walk)
1431{
1432 if (walk->policy != NULL) {
1433 xfrm_pol_put(walk->policy);
1434 walk->policy = NULL;
1435 }
1436}
1437
1438extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, 1421extern int xfrm_policy_walk(struct xfrm_policy_walk *walk,
1439 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1422 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1423extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1440int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1424int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1441struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1425struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
1442 struct xfrm_selector *sel, 1426 struct xfrm_selector *sel,
@@ -1455,12 +1439,14 @@ extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1455 1439
1456#ifdef CONFIG_XFRM_MIGRATE 1440#ifdef CONFIG_XFRM_MIGRATE
1457extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1441extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1458 struct xfrm_migrate *m, int num_bundles); 1442 struct xfrm_migrate *m, int num_bundles,
1443 struct xfrm_kmaddress *k);
1459extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1444extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m);
1460extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1445extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x,
1461 struct xfrm_migrate *m); 1446 struct xfrm_migrate *m);
1462extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1447extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1463 struct xfrm_migrate *m, int num_bundles); 1448 struct xfrm_migrate *m, int num_bundles,
1449 struct xfrm_kmaddress *k);
1464#endif 1450#endif
1465 1451
1466extern wait_queue_head_t km_waitq; 1452extern wait_queue_head_t km_waitq;
diff --git a/include/pcmcia/ciscode.h b/include/pcmcia/ciscode.h
index ad6e278ba7f2..b417985708f2 100644
--- a/include/pcmcia/ciscode.h
+++ b/include/pcmcia/ciscode.h
@@ -119,7 +119,7 @@
119 119
120#define MANFID_TOSHIBA 0x0098 120#define MANFID_TOSHIBA 0x0098
121 121
122#define MANFID_UNGERMANN 0x02c0 122#define MANFID_UNGERMANN 0x02c0
123 123
124#define MANFID_XIRCOM 0x0105 124#define MANFID_XIRCOM 0x0105
125 125
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h
index e2e10c1e9a06..cfdd5af77dcc 100644
--- a/include/pcmcia/cistpl.h
+++ b/include/pcmcia/cistpl.h
@@ -573,44 +573,6 @@ typedef struct tuple_t {
573#define TUPLE_RETURN_LINK 0x01 573#define TUPLE_RETURN_LINK 0x01
574#define TUPLE_RETURN_COMMON 0x02 574#define TUPLE_RETURN_COMMON 0x02
575 575
576/* For ValidateCIS */
577typedef struct cisinfo_t {
578 u_int Chains;
579} cisinfo_t;
580
581#define CISTPL_MAX_CIS_SIZE 0x200 576#define CISTPL_MAX_CIS_SIZE 0x200
582 577
583/* For ReplaceCIS */
584typedef struct cisdump_t {
585 u_int Length;
586 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
587} cisdump_t;
588
589
590int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis);
591
592/* don't use outside of PCMCIA core yet */
593int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple);
594int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple);
595int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
596int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse);
597
598int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *count);
599
600/* ... but use these wrappers instead */
601#define pcmcia_get_first_tuple(p_dev, tuple) \
602 pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple)
603
604#define pcmcia_get_next_tuple(p_dev, tuple) \
605 pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple)
606
607#define pcmcia_get_tuple_data(p_dev, tuple) \
608 pccard_get_tuple_data(p_dev->socket, tuple)
609
610#define pcmcia_parse_tuple(p_dev, tuple, parse) \
611 pccard_parse_tuple(tuple, parse)
612
613#define pcmcia_validate_cis(p_dev, info) \
614 pccard_validate_cis(p_dev->socket, p_dev->func, info)
615
616#endif /* LINUX_CISTPL_H */ 578#endif /* LINUX_CISTPL_H */
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
index 45d84b275789..904468a191ef 100644
--- a/include/pcmcia/cs.h
+++ b/include/pcmcia/cs.h
@@ -28,72 +28,16 @@ typedef struct conf_reg_t {
28#define CS_WRITE 2 28#define CS_WRITE 2
29 29
30/* for AdjustResourceInfo */ 30/* for AdjustResourceInfo */
31typedef struct adjust_t {
32 u_int Action;
33 u_int Resource;
34 u_int Attributes;
35 union {
36 struct memory {
37 u_long Base;
38 u_long Size;
39 } memory;
40 struct io {
41 ioaddr_t BasePort;
42 ioaddr_t NumPorts;
43 u_int IOAddrLines;
44 } io;
45 struct irq {
46 u_int IRQ;
47 } irq;
48 } resource;
49} adjust_t;
50
51/* Action field */ 31/* Action field */
52#define REMOVE_MANAGED_RESOURCE 1 32#define REMOVE_MANAGED_RESOURCE 1
53#define ADD_MANAGED_RESOURCE 2 33#define ADD_MANAGED_RESOURCE 2
54#define GET_FIRST_MANAGED_RESOURCE 3 34
55#define GET_NEXT_MANAGED_RESOURCE 4
56/* Resource field */
57#define RES_MEMORY_RANGE 1
58#define RES_IO_RANGE 2
59#define RES_IRQ 3
60/* Attribute field */
61#define RES_IRQ_TYPE 0x03
62#define RES_IRQ_TYPE_EXCLUSIVE 0
63#define RES_IRQ_TYPE_TIME 1
64#define RES_IRQ_TYPE_DYNAMIC 2
65#define RES_IRQ_CSC 0x04
66#define RES_SHARED 0x08
67#define RES_RESERVED 0x10
68#define RES_ALLOCATED 0x20
69#define RES_REMOVED 0x40
70 35
71typedef struct event_callback_args_t { 36typedef struct event_callback_args_t {
72 struct pcmcia_device *client_handle; 37 struct pcmcia_device *client_handle;
73 void *client_data; 38 void *client_data;
74} event_callback_args_t; 39} event_callback_args_t;
75 40
76/* for GetConfigurationInfo */
77typedef struct config_info_t {
78 u_char Function;
79 u_int Attributes;
80 u_int Vcc, Vpp1, Vpp2;
81 u_int IntType;
82 u_int ConfigBase;
83 u_char Status, Pin, Copy, Option, ExtStatus;
84 u_int Present;
85 u_int CardValues;
86 u_int AssignedIRQ;
87 u_int IRQAttributes;
88 ioaddr_t BasePort1;
89 ioaddr_t NumPorts1;
90 u_int Attributes1;
91 ioaddr_t BasePort2;
92 ioaddr_t NumPorts2;
93 u_int Attributes2;
94 u_int IOAddrLines;
95} config_info_t;
96
97/* For CardValues field */ 41/* For CardValues field */
98#define CV_OPTION_VALUE 0x01 42#define CV_OPTION_VALUE 0x01
99#define CV_STATUS_VALUE 0x02 43#define CV_STATUS_VALUE 0x02
@@ -257,22 +201,6 @@ typedef struct win_req_t {
257#define WIN_BAR_MASK 0xe000 201#define WIN_BAR_MASK 0xe000
258#define WIN_BAR_SHIFT 13 202#define WIN_BAR_SHIFT 13
259 203
260/* Attributes for RegisterClient -- UNUSED -- */
261#define INFO_MASTER_CLIENT 0x01
262#define INFO_IO_CLIENT 0x02
263#define INFO_MTD_CLIENT 0x04
264#define INFO_MEM_CLIENT 0x08
265#define MAX_NUM_CLIENTS 3
266
267#define INFO_CARD_SHARE 0x10
268#define INFO_CARD_EXCL 0x20
269
270typedef struct cs_status_t {
271 u_char Function;
272 event_t CardState;
273 event_t SocketState;
274} cs_status_t;
275
276typedef struct error_info_t { 204typedef struct error_info_t {
277 int func; 205 int func;
278 int retcode; 206 int retcode;
@@ -308,95 +236,4 @@ typedef struct error_info_t {
308#define CS_EVENT_3VCARD 0x200000 236#define CS_EVENT_3VCARD 0x200000
309#define CS_EVENT_XVCARD 0x400000 237#define CS_EVENT_XVCARD 0x400000
310 238
311/* Return codes */
312#define CS_SUCCESS 0x00
313#define CS_BAD_ADAPTER 0x01
314#define CS_BAD_ATTRIBUTE 0x02
315#define CS_BAD_BASE 0x03
316#define CS_BAD_EDC 0x04
317#define CS_BAD_IRQ 0x06
318#define CS_BAD_OFFSET 0x07
319#define CS_BAD_PAGE 0x08
320#define CS_READ_FAILURE 0x09
321#define CS_BAD_SIZE 0x0a
322#define CS_BAD_SOCKET 0x0b
323#define CS_BAD_TYPE 0x0d
324#define CS_BAD_VCC 0x0e
325#define CS_BAD_VPP 0x0f
326#define CS_BAD_WINDOW 0x11
327#define CS_WRITE_FAILURE 0x12
328#define CS_NO_CARD 0x14
329#define CS_UNSUPPORTED_FUNCTION 0x15
330#define CS_UNSUPPORTED_MODE 0x16
331#define CS_BAD_SPEED 0x17
332#define CS_BUSY 0x18
333#define CS_GENERAL_FAILURE 0x19
334#define CS_WRITE_PROTECTED 0x1a
335#define CS_BAD_ARG_LENGTH 0x1b
336#define CS_BAD_ARGS 0x1c
337#define CS_CONFIGURATION_LOCKED 0x1d
338#define CS_IN_USE 0x1e
339#define CS_NO_MORE_ITEMS 0x1f
340#define CS_OUT_OF_RESOURCE 0x20
341#define CS_BAD_HANDLE 0x21
342
343#define CS_BAD_TUPLE 0x40
344
345#ifdef __KERNEL__
346
347/*
348 * The main Card Services entry point
349 */
350
351enum service {
352 AccessConfigurationRegister, AddSocketServices,
353 AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
354 DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
355 GetClientInfo, GetConfigurationInfo, GetEventMask,
356 GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
357 GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
358 GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
359 MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
360 OpenMemory, ParseTuple, ReadMemory, RegisterClient,
361 RegisterEraseQueue, RegisterMTD, RegisterTimer,
362 ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
363 ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
364 RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
365 RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
366 SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
367 WriteMemory, BindDevice, BindMTD, ReportError,
368 SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
369 GetFirstWindow, GetNextWindow, GetMemPage
370};
371
372struct pcmcia_socket;
373
374int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
375int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
376int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
377int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
378int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
379int pcmcia_release_window(window_handle_t win);
380int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req);
381int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
382int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
383int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh);
384int pcmcia_suspend_card(struct pcmcia_socket *skt);
385int pcmcia_resume_card(struct pcmcia_socket *skt);
386int pcmcia_eject_card(struct pcmcia_socket *skt);
387int pcmcia_insert_card(struct pcmcia_socket *skt);
388int pccard_reset_card(struct pcmcia_socket *skt);
389
390struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *p_dev);
391void pcmcia_disable_device(struct pcmcia_device *p_dev);
392
393struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt);
394void pcmcia_put_socket(struct pcmcia_socket *skt);
395
396/* compatibility functions */
397#define pcmcia_reset_card(p_dev, req) \
398 pccard_reset_card(p_dev->socket)
399
400#endif /* __KERNEL__ */
401
402#endif /* _LINUX_CS_H */ 239#endif /* _LINUX_CS_H */
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
index f402a0f435b4..315965a37930 100644
--- a/include/pcmcia/cs_types.h
+++ b/include/pcmcia/cs_types.h
@@ -21,14 +21,6 @@
21#include <sys/types.h> 21#include <sys/types.h>
22#endif 22#endif
23 23
24#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
25 defined(__bfin__)
26/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
27typedef u_int ioaddr_t;
28#else
29typedef u_short ioaddr_t;
30#endif
31
32typedef u_short socket_t; 24typedef u_short socket_t;
33typedef u_int event_t; 25typedef u_int event_t;
34typedef u_char cisdata_t; 26typedef u_char cisdata_t;
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h
index e04e0b0d9a25..c33ea08352b8 100644
--- a/include/pcmcia/device_id.h
+++ b/include/pcmcia/device_id.h
@@ -1,10 +1,19 @@
1/* 1/*
2 * Copyright (2003-2004) Dominik Brodowski <linux@brodo.de> 2 * device_id.h -- PCMCIA driver matching helpers
3 * David Woodhouse
4 * 3 *
5 * License: GPL v2 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 * (C) 2003 - 2004 David Woodhouse
9 * (C) 2003 - 2004 Dominik Brodowski
6 */ 10 */
7 11
12#ifndef _LINUX_PCMCIA_DEVICE_ID_H
13#define _LINUX_PCMCIA_DEVICE_ID_H
14
15#ifdef __KERNEL__
16
8#define PCMCIA_DEVICE_MANF_CARD(manf, card) { \ 17#define PCMCIA_DEVICE_MANF_CARD(manf, card) { \
9 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 18 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
10 PCMCIA_DEV_ID_MATCH_CARD_ID, \ 19 PCMCIA_DEV_ID_MATCH_CARD_ID, \
@@ -256,3 +265,6 @@
256 265
257 266
258#define PCMCIA_DEVICE_NULL { .match_flags = 0, } 267#define PCMCIA_DEVICE_NULL { .match_flags = 0, }
268
269#endif /* __KERNEL__ */
270#endif /* _LINUX_PCMCIA_DEVICE_ID_H */
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index b316027c853d..a2be80b9a095 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -10,7 +10,7 @@
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 * 11 *
12 * (C) 1999 David A. Hinds 12 * (C) 1999 David A. Hinds
13 * (C) 2003 - 2004 Dominik Brodowski 13 * (C) 2003 - 2008 Dominik Brodowski
14 */ 14 */
15 15
16#ifndef _LINUX_DS_H 16#ifndef _LINUX_DS_H
@@ -23,108 +23,21 @@
23#include <pcmcia/cs_types.h> 23#include <pcmcia/cs_types.h>
24#include <pcmcia/device_id.h> 24#include <pcmcia/device_id.h>
25 25
26typedef struct tuple_parse_t {
27 tuple_t tuple;
28 cisdata_t data[255];
29 cisparse_t parse;
30} tuple_parse_t;
31
32typedef struct win_info_t {
33 window_handle_t handle;
34 win_req_t window;
35 memreq_t map;
36} win_info_t;
37
38typedef struct bind_info_t {
39 dev_info_t dev_info;
40 u_char function;
41 struct pcmcia_device *instance;
42 char name[DEV_NAME_LEN];
43 u_short major, minor;
44 void *next;
45} bind_info_t;
46
47typedef struct mtd_info_t {
48 dev_info_t dev_info;
49 u_int Attributes;
50 u_int CardOffset;
51} mtd_info_t;
52
53typedef struct region_info_t {
54 u_int Attributes;
55 u_int CardOffset;
56 u_int RegionSize;
57 u_int AccessSpeed;
58 u_int BlockSize;
59 u_int PartMultiple;
60 u_char JedecMfr, JedecInfo;
61 memory_handle_t next;
62} region_info_t;
63#define REGION_TYPE 0x0001
64#define REGION_TYPE_CM 0x0000
65#define REGION_TYPE_AM 0x0001
66#define REGION_PREFETCH 0x0008
67#define REGION_CACHEABLE 0x0010
68#define REGION_BAR_MASK 0xe000
69#define REGION_BAR_SHIFT 13
70
71typedef union ds_ioctl_arg_t {
72 adjust_t adjust;
73 config_info_t config;
74 tuple_t tuple;
75 tuple_parse_t tuple_parse;
76 client_req_t client_req;
77 cs_status_t status;
78 conf_reg_t conf_reg;
79 cisinfo_t cisinfo;
80 region_info_t region;
81 bind_info_t bind_info;
82 mtd_info_t mtd_info;
83 win_info_t win_info;
84 cisdump_t cisdump;
85} ds_ioctl_arg_t;
86
87#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
88#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
89#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
90#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
91#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
92#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
93#define DS_RESET_CARD _IO ('d', 8)
94#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
95#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
96#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
97#define DS_SUSPEND_CARD _IO ('d', 12)
98#define DS_RESUME_CARD _IO ('d', 13)
99#define DS_EJECT_CARD _IO ('d', 14)
100#define DS_INSERT_CARD _IO ('d', 15)
101#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
102#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
103#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
104#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
105#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
106#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
107
108#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
109#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
110#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
111#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
112#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
113
114#ifdef __KERNEL__ 26#ifdef __KERNEL__
115#include <linux/device.h> 27#include <linux/device.h>
116#include <pcmcia/ss.h> 28#include <pcmcia/ss.h>
117 29
118typedef struct dev_node_t { 30/*
119 char dev_name[DEV_NAME_LEN]; 31 * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus
120 u_short major, minor; 32 * a.k.a. PCI drivers
121 struct dev_node_t *next; 33 */
122} dev_node_t;
123
124
125struct pcmcia_socket; 34struct pcmcia_socket;
35struct pcmcia_device;
126struct config_t; 36struct config_t;
127 37
38/* dynamic device IDs for PCMCIA device drivers. See
39 * Documentation/pcmcia/driver.txt for details.
40*/
128struct pcmcia_dynids { 41struct pcmcia_dynids {
129 spinlock_t lock; 42 spinlock_t lock;
130 struct list_head list; 43 struct list_head list;
@@ -147,6 +60,14 @@ struct pcmcia_driver {
147int pcmcia_register_driver(struct pcmcia_driver *driver); 60int pcmcia_register_driver(struct pcmcia_driver *driver);
148void pcmcia_unregister_driver(struct pcmcia_driver *driver); 61void pcmcia_unregister_driver(struct pcmcia_driver *driver);
149 62
63/* Some drivers use dev_node_t to store char or block device information.
64 * Don't use this in new drivers, though.
65 */
66typedef struct dev_node_t {
67 char dev_name[DEV_NAME_LEN];
68 u_short major, minor;
69 struct dev_node_t *next;
70} dev_node_t;
150 71
151struct pcmcia_device { 72struct pcmcia_device {
152 /* the socket and the device_no [for multifunction devices] 73 /* the socket and the device_no [for multifunction devices]
@@ -216,10 +137,304 @@ struct pcmcia_device {
216#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 137#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
217#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) 138#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
218 139
140/* deprecated -- don't use! */
219#define handle_to_dev(handle) (handle->dev) 141#define handle_to_dev(handle) (handle->dev)
220 142
221/* error reporting */ 143
222void cs_error(struct pcmcia_device *handle, int func, int ret); 144/* (deprecated) error reporting by PCMCIA devices. Use dev_printk()
145 * or dev_dbg() directly in the driver, without referring to pcmcia_error_func()
146 * and/or pcmcia_error_ret() for those functions will go away soon.
147 */
148enum service {
149 AccessConfigurationRegister, AddSocketServices,
150 AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
151 DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
152 GetClientInfo, GetConfigurationInfo, GetEventMask,
153 GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
154 GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
155 GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
156 MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
157 OpenMemory, ParseTuple, ReadMemory, RegisterClient,
158 RegisterEraseQueue, RegisterMTD, RegisterTimer,
159 ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
160 ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
161 RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
162 RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
163 SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
164 WriteMemory, BindDevice, BindMTD, ReportError,
165 SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
166 GetFirstWindow, GetNextWindow, GetMemPage
167};
168const char *pcmcia_error_func(int func);
169const char *pcmcia_error_ret(int ret);
170
171#define cs_error(p_dev, func, ret) \
172 { \
173 dev_printk(KERN_NOTICE, &p_dev->dev, \
174 "%s : %s\n", \
175 pcmcia_error_func(func), \
176 pcmcia_error_ret(ret)); \
177 }
178
179/* CIS access.
180 * Use the pcmcia_* versions in PCMCIA drivers
181 */
182int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse);
183
184int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,
185 tuple_t *tuple);
186#define pcmcia_get_first_tuple(p_dev, tuple) \
187 pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple)
188
189int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
190 tuple_t *tuple);
191#define pcmcia_get_next_tuple(p_dev, tuple) \
192 pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple)
193
194int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
195#define pcmcia_get_tuple_data(p_dev, tuple) \
196 pccard_get_tuple_data(p_dev->socket, tuple)
197
198
199/* loop CIS entries for valid configuration */
200int pcmcia_loop_config(struct pcmcia_device *p_dev,
201 int (*conf_check) (struct pcmcia_device *p_dev,
202 cistpl_cftable_entry_t *cf,
203 cistpl_cftable_entry_t *dflt,
204 unsigned int vcc,
205 void *priv_data),
206 void *priv_data);
207
208/* is the device still there? */
209struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev);
210
211/* low-level interface reset */
212int pcmcia_reset_card(struct pcmcia_socket *skt);
213
214/* CIS config */
215int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
216 conf_reg_t *reg);
217
218/* device configuration */
219int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
220int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
221int pcmcia_request_configuration(struct pcmcia_device *p_dev,
222 config_req_t *req);
223
224int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req,
225 window_handle_t *wh);
226int pcmcia_release_window(window_handle_t win);
227
228int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
229int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
230
231int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
232void pcmcia_disable_device(struct pcmcia_device *p_dev);
223 233
224#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
235
236
237
238/* Below, there are only definitions which are used by
239 * - the PCMCIA ioctl
240 * - deprecated PCMCIA userspace tools only
241 *
242 * here be dragons ... here be dragons ... here be dragons ... here be drag
243 */
244
245#if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__)
246
247#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
248 defined(__bfin__)
249/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
250typedef u_int ioaddr_t;
251#else
252typedef u_short ioaddr_t;
253#endif
254
255/* for AdjustResourceInfo */
256typedef struct adjust_t {
257 u_int Action;
258 u_int Resource;
259 u_int Attributes;
260 union {
261 struct memory {
262 u_long Base;
263 u_long Size;
264 } memory;
265 struct io {
266 ioaddr_t BasePort;
267 ioaddr_t NumPorts;
268 u_int IOAddrLines;
269 } io;
270 struct irq {
271 u_int IRQ;
272 } irq;
273 } resource;
274} adjust_t;
275
276/* Action field */
277#define REMOVE_MANAGED_RESOURCE 1
278#define ADD_MANAGED_RESOURCE 2
279#define GET_FIRST_MANAGED_RESOURCE 3
280#define GET_NEXT_MANAGED_RESOURCE 4
281/* Resource field */
282#define RES_MEMORY_RANGE 1
283#define RES_IO_RANGE 2
284#define RES_IRQ 3
285/* Attribute field */
286#define RES_IRQ_TYPE 0x03
287#define RES_IRQ_TYPE_EXCLUSIVE 0
288#define RES_IRQ_TYPE_TIME 1
289#define RES_IRQ_TYPE_DYNAMIC 2
290#define RES_IRQ_CSC 0x04
291#define RES_SHARED 0x08
292#define RES_RESERVED 0x10
293#define RES_ALLOCATED 0x20
294#define RES_REMOVED 0x40
295
296
297typedef struct tuple_parse_t {
298 tuple_t tuple;
299 cisdata_t data[255];
300 cisparse_t parse;
301} tuple_parse_t;
302
303typedef struct win_info_t {
304 window_handle_t handle;
305 win_req_t window;
306 memreq_t map;
307} win_info_t;
308
309typedef struct bind_info_t {
310 dev_info_t dev_info;
311 u_char function;
312 struct pcmcia_device *instance;
313 char name[DEV_NAME_LEN];
314 u_short major, minor;
315 void *next;
316} bind_info_t;
317
318typedef struct mtd_info_t {
319 dev_info_t dev_info;
320 u_int Attributes;
321 u_int CardOffset;
322} mtd_info_t;
323
324typedef struct region_info_t {
325 u_int Attributes;
326 u_int CardOffset;
327 u_int RegionSize;
328 u_int AccessSpeed;
329 u_int BlockSize;
330 u_int PartMultiple;
331 u_char JedecMfr, JedecInfo;
332 memory_handle_t next;
333} region_info_t;
334
335#define REGION_TYPE 0x0001
336#define REGION_TYPE_CM 0x0000
337#define REGION_TYPE_AM 0x0001
338#define REGION_PREFETCH 0x0008
339#define REGION_CACHEABLE 0x0010
340#define REGION_BAR_MASK 0xe000
341#define REGION_BAR_SHIFT 13
342
343/* For ReplaceCIS */
344typedef struct cisdump_t {
345 u_int Length;
346 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
347} cisdump_t;
348
349/* for GetConfigurationInfo */
350typedef struct config_info_t {
351 u_char Function;
352 u_int Attributes;
353 u_int Vcc, Vpp1, Vpp2;
354 u_int IntType;
355 u_int ConfigBase;
356 u_char Status, Pin, Copy, Option, ExtStatus;
357 u_int Present;
358 u_int CardValues;
359 u_int AssignedIRQ;
360 u_int IRQAttributes;
361 ioaddr_t BasePort1;
362 ioaddr_t NumPorts1;
363 u_int Attributes1;
364 ioaddr_t BasePort2;
365 ioaddr_t NumPorts2;
366 u_int Attributes2;
367 u_int IOAddrLines;
368} config_info_t;
369
370/* For ValidateCIS */
371typedef struct cisinfo_t {
372 u_int Chains;
373} cisinfo_t;
374
375typedef struct cs_status_t {
376 u_char Function;
377 event_t CardState;
378 event_t SocketState;
379} cs_status_t;
380
381typedef union ds_ioctl_arg_t {
382 adjust_t adjust;
383 config_info_t config;
384 tuple_t tuple;
385 tuple_parse_t tuple_parse;
386 client_req_t client_req;
387 cs_status_t status;
388 conf_reg_t conf_reg;
389 cisinfo_t cisinfo;
390 region_info_t region;
391 bind_info_t bind_info;
392 mtd_info_t mtd_info;
393 win_info_t win_info;
394 cisdump_t cisdump;
395} ds_ioctl_arg_t;
396
397#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
398#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
399#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
400#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
401#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
402#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
403#define DS_RESET_CARD _IO ('d', 8)
404#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
405#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
406#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
407#define DS_SUSPEND_CARD _IO ('d', 12)
408#define DS_RESUME_CARD _IO ('d', 13)
409#define DS_EJECT_CARD _IO ('d', 14)
410#define DS_INSERT_CARD _IO ('d', 15)
411#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
412#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
413#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
414#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
415#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
416#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
417
418#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
419#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
420#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
421#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
422#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
423
424
425/* used in userspace only */
426#define CS_IN_USE 0x1e
427
428#define INFO_MASTER_CLIENT 0x01
429#define INFO_IO_CLIENT 0x02
430#define INFO_MTD_CLIENT 0x04
431#define INFO_MEM_CLIENT 0x08
432#define MAX_NUM_CLIENTS 3
433
434#define INFO_CARD_SHARE 0x10
435#define INFO_CARD_EXCL 0x20
436
437
438#endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */
439
225#endif /* _LINUX_DS_H */ 440#endif /* _LINUX_DS_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index ed919dd9bb5c..9b4ac9385f5d 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -53,10 +53,10 @@
53 53
54/* for GetSocket, SetSocket */ 54/* for GetSocket, SetSocket */
55typedef struct socket_state_t { 55typedef struct socket_state_t {
56 u_int flags; 56 u_int flags;
57 u_int csc_mask; 57 u_int csc_mask;
58 u_char Vcc, Vpp; 58 u_char Vcc, Vpp;
59 u_char io_irq; 59 u_char io_irq;
60} socket_state_t; 60} socket_state_t;
61 61
62extern socket_state_t dead_socket; 62extern socket_state_t dead_socket;
@@ -86,79 +86,22 @@ extern socket_state_t dead_socket;
86#define HOOK_POWER_PRE 0x01 86#define HOOK_POWER_PRE 0x01
87#define HOOK_POWER_POST 0x02 87#define HOOK_POWER_POST 0x02
88 88
89
90typedef struct pccard_io_map { 89typedef struct pccard_io_map {
91 u_char map; 90 u_char map;
92 u_char flags; 91 u_char flags;
93 u_short speed; 92 u_short speed;
94 u_int start, stop; 93 u_int start, stop;
95} pccard_io_map; 94} pccard_io_map;
96 95
97typedef struct pccard_mem_map { 96typedef struct pccard_mem_map {
98 u_char map; 97 u_char map;
99 u_char flags; 98 u_char flags;
100 u_short speed; 99 u_short speed;
101 u_long static_start; 100 u_long static_start;
102 u_int card_start; 101 u_int card_start;
103 struct resource *res; 102 struct resource *res;
104} pccard_mem_map; 103} pccard_mem_map;
105 104
106typedef struct cb_bridge_map {
107 u_char map;
108 u_char flags;
109 u_int start, stop;
110} cb_bridge_map;
111
112/*
113 * Socket operations.
114 */
115struct pcmcia_socket;
116
117struct pccard_operations {
118 int (*init)(struct pcmcia_socket *sock);
119 int (*suspend)(struct pcmcia_socket *sock);
120 int (*get_status)(struct pcmcia_socket *sock, u_int *value);
121 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
122 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
123 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
124};
125
126struct pccard_resource_ops {
127 int (*validate_mem) (struct pcmcia_socket *s);
128 int (*adjust_io_region) (struct resource *res,
129 unsigned long r_start,
130 unsigned long r_end,
131 struct pcmcia_socket *s);
132 struct resource* (*find_io) (unsigned long base, int num,
133 unsigned long align,
134 struct pcmcia_socket *s);
135 struct resource* (*find_mem) (unsigned long base, unsigned long num,
136 unsigned long align, int low,
137 struct pcmcia_socket *s);
138 int (*add_io) (struct pcmcia_socket *s,
139 unsigned int action,
140 unsigned long r_start,
141 unsigned long r_end);
142 int (*add_mem) (struct pcmcia_socket *s,
143 unsigned int action,
144 unsigned long r_start,
145 unsigned long r_end);
146 int (*init) (struct pcmcia_socket *s);
147 void (*exit) (struct pcmcia_socket *s);
148};
149/* SS_CAP_STATIC_MAP */
150extern struct pccard_resource_ops pccard_static_ops;
151/* !SS_CAP_STATIC_MAP */
152extern struct pccard_resource_ops pccard_nonstatic_ops;
153
154/* static mem, dynamic IO sockets */
155extern struct pccard_resource_ops pccard_iodyn_ops;
156
157/*
158 * Calls to set up low-level "Socket Services" drivers
159 */
160struct pcmcia_socket;
161
162typedef struct io_window_t { 105typedef struct io_window_t {
163 u_int InUse, Config; 106 u_int InUse, Config;
164 struct resource *res; 107 struct resource *res;
@@ -179,10 +122,25 @@ typedef struct window_t {
179/* Maximum number of memory windows per socket */ 122/* Maximum number of memory windows per socket */
180#define MAX_WIN 4 123#define MAX_WIN 4
181 124
125
126/*
127 * Socket operations.
128 */
129struct pcmcia_socket;
130struct pccard_resource_ops;
182struct config_t; 131struct config_t;
183struct pcmcia_callback; 132struct pcmcia_callback;
184struct user_info_t; 133struct user_info_t;
185 134
135struct pccard_operations {
136 int (*init)(struct pcmcia_socket *s);
137 int (*suspend)(struct pcmcia_socket *s);
138 int (*get_status)(struct pcmcia_socket *s, u_int *value);
139 int (*set_socket)(struct pcmcia_socket *s, socket_state_t *state);
140 int (*set_io_map)(struct pcmcia_socket *s, struct pccard_io_map *io);
141 int (*set_mem_map)(struct pcmcia_socket *s, struct pccard_mem_map *mem);
142};
143
186struct pcmcia_socket { 144struct pcmcia_socket {
187 struct module *owner; 145 struct module *owner;
188 spinlock_t lock; 146 spinlock_t lock;
@@ -199,8 +157,8 @@ struct pcmcia_socket {
199 io_window_t io[MAX_IO_WIN]; 157 io_window_t io[MAX_IO_WIN];
200 window_t win[MAX_WIN]; 158 window_t win[MAX_WIN];
201 struct list_head cis_cache; 159 struct list_head cis_cache;
202 u_int fake_cis_len; 160 size_t fake_cis_len;
203 char *fake_cis; 161 u8 *fake_cis;
204 162
205 struct list_head socket_list; 163 struct list_head socket_list;
206 struct completion socket_released; 164 struct completion socket_released;
@@ -218,12 +176,12 @@ struct pcmcia_socket {
218 struct pci_dev * cb_dev; 176 struct pci_dev * cb_dev;
219 177
220 178
221 /* socket setup is done so resources should be able to be allocated. Only 179 /* socket setup is done so resources should be able to be allocated.
222 * if set to 1, calls to find_{io,mem}_region are handled, and insertion 180 * Only if set to 1, calls to find_{io,mem}_region are handled, and
223 * events are actually managed by the PCMCIA layer.*/ 181 * insertio events are actually managed by the PCMCIA layer.*/
224 u8 resource_setup_done:1; 182 u8 resource_setup_done:1;
225 183
226 /* is set to one if resource setup is done using adjust_resource_info() */ 184 /* It's old if resource setup is done using adjust_resource_info() */
227 u8 resource_setup_old:1; 185 u8 resource_setup_old:1;
228 u8 resource_setup_new:1; 186 u8 resource_setup_new:1;
229 187
@@ -236,75 +194,101 @@ struct pcmcia_socket {
236 194
237 /* Zoom video behaviour is so chip specific its not worth adding 195 /* Zoom video behaviour is so chip specific its not worth adding
238 this to _ops */ 196 this to _ops */
239 void (*zoom_video)(struct pcmcia_socket *, int); 197 void (*zoom_video)(struct pcmcia_socket *,
198 int);
240 199
241 /* so is power hook */ 200 /* so is power hook */
242 int (*power_hook)(struct pcmcia_socket *sock, int operation); 201 int (*power_hook)(struct pcmcia_socket *sock, int operation);
243#ifdef CONFIG_CARDBUS 202
244 /* allows tuning the CB bridge before loading driver for the CB card */ 203 /* allows tuning the CB bridge before loading driver for the CB card */
204#ifdef CONFIG_CARDBUS
245 void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus); 205 void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus);
246#endif 206#endif
247 207
248 /* state thread */ 208 /* state thread */
249 struct mutex skt_mutex; /* protects socket h/w state */
250
251 struct task_struct *thread; 209 struct task_struct *thread;
252 struct completion thread_done; 210 struct completion thread_done;
253 spinlock_t thread_lock; /* protects thread_events */
254 unsigned int thread_events; 211 unsigned int thread_events;
212 /* protects socket h/w state */
213 struct mutex skt_mutex;
214 /* protects thread_events */
215 spinlock_t thread_lock;
255 216
256 /* pcmcia (16-bit) */ 217 /* pcmcia (16-bit) */
257 struct pcmcia_callback *callback; 218 struct pcmcia_callback *callback;
258 219
259#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) 220#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
260 struct list_head devices_list; /* PCMCIA devices */ 221 /* The following elements refer to 16-bit PCMCIA devices inserted
261 u8 device_count; /* the number of devices, used 222 * into the socket */
262 * only internally and subject 223 struct list_head devices_list;
263 * to incorrectness and change */ 224
225 /* the number of devices, used only internally and subject to
226 * incorrectness and change */
227 u8 device_count;
264 228
229 /* 16-bit state: */
265 struct { 230 struct {
266 u8 present:1, /* PCMCIA card is present in socket */ 231 /* PCMCIA card is present in socket */
267 busy:1, /* "master" ioctl is used */ 232 u8 present:1;
268 dead:1, /* pcmcia module is being unloaded */ 233 /* "master" ioctl is used */
269 device_add_pending:1, /* a multifunction-device 234 u8 busy:1;
270 * add event is pending */ 235 /* pcmcia module is being unloaded */
271 mfc_pfc:1, /* the pending event adds a mfc (1) or pfc (0) */ 236 u8 dead:1;
272 reserved:3; 237 /* a multifunction-device add event is pending */
273 } pcmcia_state; 238 u8 device_add_pending:1;
274 239 /* the pending event adds a mfc (1) or pfc (0) */
275 struct work_struct device_add; /* for adding further pseudo-multifunction 240 u8 mfc_pfc:1;
276 * devices */ 241
242 u8 reserved:3;
243 } pcmcia_state;
244
245
246 /* for adding further pseudo-multifunction devices */
247 struct work_struct device_add;
277 248
278#ifdef CONFIG_PCMCIA_IOCTL 249#ifdef CONFIG_PCMCIA_IOCTL
279 struct user_info_t *user; 250 struct user_info_t *user;
280 wait_queue_head_t queue; 251 wait_queue_head_t queue;
281#endif 252#endif /* CONFIG_PCMCIA_IOCTL */
282#endif 253#endif /* CONFIG_PCMCIA */
283 254
284 /* cardbus (32-bit) */ 255 /* cardbus (32-bit) */
285#ifdef CONFIG_CARDBUS 256#ifdef CONFIG_CARDBUS
286 struct resource * cb_cis_res; 257 struct resource * cb_cis_res;
287 void __iomem *cb_cis_virt; 258 void __iomem *cb_cis_virt;
288#endif 259#endif /* CONFIG_CARDBUS */
289 260
290 /* socket device */ 261 /* socket device */
291 struct device dev; 262 struct device dev;
292 void *driver_data; /* data internal to the socket driver */ 263 /* data internal to the socket driver */
293 264 void *driver_data;
294}; 265};
295 266
296struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr);
297 267
268/* socket drivers must define the resource operations type they use. There
269 * are three options:
270 * - pccard_static_ops iomem and ioport areas are assigned statically
271 * - pccard_iodyn_ops iomem areas is assigned statically, ioport
272 * areas dynamically
273 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically.
274 * If this option is selected, use
275 * "select PCCARD_NONSTATIC" in Kconfig.
276 */
277extern struct pccard_resource_ops pccard_static_ops;
278extern struct pccard_resource_ops pccard_iodyn_ops;
279extern struct pccard_resource_ops pccard_nonstatic_ops;
298 280
281/* socket drivers are expected to use these callbacks in their .drv struct */
282extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
283extern int pcmcia_socket_dev_resume(struct device *dev);
284
285/* socket drivers use this callback in their IRQ handler */
286extern void pcmcia_parse_events(struct pcmcia_socket *socket,
287 unsigned int events);
299 288
300extern void pcmcia_parse_events(struct pcmcia_socket *socket, unsigned int events); 289/* to register and unregister a socket */
301extern int pcmcia_register_socket(struct pcmcia_socket *socket); 290extern int pcmcia_register_socket(struct pcmcia_socket *socket);
302extern void pcmcia_unregister_socket(struct pcmcia_socket *socket); 291extern void pcmcia_unregister_socket(struct pcmcia_socket *socket);
303 292
304extern struct class pcmcia_socket_class;
305
306/* socket drivers are expected to use these callbacks in their .drv struct */
307extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
308extern int pcmcia_socket_dev_resume(struct device *dev);
309 293
310#endif /* _LINUX_SS_H */ 294#endif /* _LINUX_SS_H */
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 16be12f1cbe8..0c9514de5df7 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -213,6 +213,8 @@ enum iscsi_err {
213 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15, 213 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
214 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16, 214 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16,
215 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17, 215 ISCSI_ERR_NO_SCSI_CMD = ISCSI_ERR_BASE + 17,
216 ISCSI_ERR_INVALID_HOST = ISCSI_ERR_BASE + 18,
217 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
216}; 218};
217 219
218/* 220/*
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 5e75bb7f311c..61e53f14f7e1 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -287,6 +287,11 @@ struct iscsi_session {
287 struct iscsi_pool cmdpool; /* PDU's pool */ 287 struct iscsi_pool cmdpool; /* PDU's pool */
288}; 288};
289 289
290enum {
291 ISCSI_HOST_SETUP,
292 ISCSI_HOST_REMOVED,
293};
294
290struct iscsi_host { 295struct iscsi_host {
291 char *initiatorname; 296 char *initiatorname;
292 /* hw address or netdev iscsi connection is bound to */ 297 /* hw address or netdev iscsi connection is bound to */
@@ -295,6 +300,12 @@ struct iscsi_host {
295 /* local address */ 300 /* local address */
296 int local_port; 301 int local_port;
297 char local_address[ISCSI_ADDRESS_BUF_LEN]; 302 char local_address[ISCSI_ADDRESS_BUF_LEN];
303
304 wait_queue_head_t session_removal_wq;
305 /* protects sessions and state */
306 spinlock_t lock;
307 int num_sessions;
308 int state;
298}; 309};
299 310
300/* 311/*
@@ -302,7 +313,7 @@ struct iscsi_host {
302 */ 313 */
303extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); 314extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
304extern int iscsi_eh_abort(struct scsi_cmnd *sc); 315extern int iscsi_eh_abort(struct scsi_cmnd *sc);
305extern int iscsi_eh_host_reset(struct scsi_cmnd *sc); 316extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
306extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 317extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
307extern int iscsi_queuecommand(struct scsi_cmnd *sc, 318extern int iscsi_queuecommand(struct scsi_cmnd *sc,
308 void (*done)(struct scsi_cmnd *)); 319 void (*done)(struct scsi_cmnd *));
@@ -351,6 +362,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
351extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, 362extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
352 int); 363 int);
353extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); 364extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
365extern void iscsi_session_failure(struct iscsi_cls_session *cls_session,
366 enum iscsi_err err);
354extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 367extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
355 enum iscsi_param param, char *buf); 368 enum iscsi_param param, char *buf);
356extern void iscsi_suspend_tx(struct iscsi_conn *conn); 369extern void iscsi_suspend_tx(struct iscsi_conn *conn);
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 192f8716aa9e..a109165714d6 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -381,6 +381,11 @@ static inline int scsi_is_wlun(unsigned int lun)
381#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */ 381#define DID_IMM_RETRY 0x0c /* Retry without decrementing retry count */
382#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also 382#define DID_REQUEUE 0x0d /* Requeue command (no immediate retry) also
383 * without decrementing the retry count */ 383 * without decrementing the retry count */
384#define DID_TRANSPORT_DISRUPTED 0x0e /* Transport error disrupted execution
385 * and the driver blocked the port to
386 * recover the link. Transport class will
387 * retry or fail IO */
388#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
384#define DRIVER_OK 0x00 /* Driver status */ 389#define DRIVER_OK 0x00 /* Driver status */
385 390
386/* 391/*
@@ -426,6 +431,7 @@ static inline int scsi_is_wlun(unsigned int lun)
426#define SCSI_MLQUEUE_HOST_BUSY 0x1055 431#define SCSI_MLQUEUE_HOST_BUSY 0x1055
427#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056 432#define SCSI_MLQUEUE_DEVICE_BUSY 0x1056
428#define SCSI_MLQUEUE_EH_RETRY 0x1057 433#define SCSI_MLQUEUE_EH_RETRY 0x1057
434#define SCSI_MLQUEUE_TARGET_BUSY 0x1058
429 435
430/* 436/*
431 * Use these to separate status msg and our bytes 437 * Use these to separate status msg and our bytes
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index f9f6e793575c..855bf95963e7 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -75,7 +75,6 @@ struct scsi_cmnd {
75 75
76 int retries; 76 int retries;
77 int allowed; 77 int allowed;
78 int timeout_per_command;
79 78
80 unsigned char prot_op; 79 unsigned char prot_op;
81 unsigned char prot_type; 80 unsigned char prot_type;
@@ -86,7 +85,6 @@ struct scsi_cmnd {
86 /* These elements define the operation we are about to perform */ 85 /* These elements define the operation we are about to perform */
87 unsigned char *cmnd; 86 unsigned char *cmnd;
88 87
89 struct timer_list eh_timeout; /* Used to time out the command. */
90 88
91 /* These elements define the operation we ultimately want to perform */ 89 /* These elements define the operation we ultimately want to perform */
92 struct scsi_data_buffer sdb; 90 struct scsi_data_buffer sdb;
@@ -139,7 +137,6 @@ extern void scsi_put_command(struct scsi_cmnd *);
139extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *, 137extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
140 struct device *); 138 struct device *);
141extern void scsi_finish_command(struct scsi_cmnd *cmd); 139extern void scsi_finish_command(struct scsi_cmnd *cmd);
142extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
143 140
144extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, 141extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
145 size_t *offset, size_t *len); 142 size_t *offset, size_t *len);
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 80b2e93c2936..a37a8148a310 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -42,9 +42,11 @@ enum scsi_device_state {
42 * originate in the mid-layer) */ 42 * originate in the mid-layer) */
43 SDEV_OFFLINE, /* Device offlined (by error handling or 43 SDEV_OFFLINE, /* Device offlined (by error handling or
44 * user request */ 44 * user request */
45 SDEV_BLOCK, /* Device blocked by scsi lld. No scsi 45 SDEV_BLOCK, /* Device blocked by scsi lld. No
46 * commands from user or midlayer should be issued 46 * scsi commands from user or midlayer
47 * to the scsi lld. */ 47 * should be issued to the scsi
48 * lld. */
49 SDEV_CREATED_BLOCK, /* same as above but for created devices */
48}; 50};
49 51
50enum scsi_device_event { 52enum scsi_device_event {
@@ -236,6 +238,16 @@ struct scsi_target {
236 * for the device at a time. */ 238 * for the device at a time. */
237 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ 239 unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */
238 /* means no lun present */ 240 /* means no lun present */
241 /* commands actually active on LLD. protected by host lock. */
242 unsigned int target_busy;
243 /*
244 * LLDs should set this in the slave_alloc host template callout.
245 * If set to zero then there is not limit.
246 */
247 unsigned int can_queue;
248 unsigned int target_blocked;
249 unsigned int max_target_blocked;
250#define SCSI_DEFAULT_TARGET_BLOCKED 3
239 251
240 char scsi_level; 252 char scsi_level;
241 struct execute_work ew; 253 struct execute_work ew;
@@ -384,10 +396,23 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
384#define scmd_id(scmd) sdev_id((scmd)->device) 396#define scmd_id(scmd) sdev_id((scmd)->device)
385#define scmd_channel(scmd) sdev_channel((scmd)->device) 397#define scmd_channel(scmd) sdev_channel((scmd)->device)
386 398
399/*
400 * checks for positions of the SCSI state machine
401 */
387static inline int scsi_device_online(struct scsi_device *sdev) 402static inline int scsi_device_online(struct scsi_device *sdev)
388{ 403{
389 return sdev->sdev_state != SDEV_OFFLINE; 404 return sdev->sdev_state != SDEV_OFFLINE;
390} 405}
406static inline int scsi_device_blocked(struct scsi_device *sdev)
407{
408 return sdev->sdev_state == SDEV_BLOCK ||
409 sdev->sdev_state == SDEV_CREATED_BLOCK;
410}
411static inline int scsi_device_created(struct scsi_device *sdev)
412{
413 return sdev->sdev_state == SDEV_CREATED ||
414 sdev->sdev_state == SDEV_CREATED_BLOCK;
415}
391 416
392/* accessor functions for the SCSI parameters */ 417/* accessor functions for the SCSI parameters */
393static inline int scsi_device_sync(struct scsi_device *sdev) 418static inline int scsi_device_sync(struct scsi_device *sdev)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 44a55d1bf530..d123ca84e732 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -43,13 +43,6 @@ struct blk_queue_tags;
43#define DISABLE_CLUSTERING 0 43#define DISABLE_CLUSTERING 0
44#define ENABLE_CLUSTERING 1 44#define ENABLE_CLUSTERING 1
45 45
46enum scsi_eh_timer_return {
47 EH_NOT_HANDLED,
48 EH_HANDLED,
49 EH_RESET_TIMER,
50};
51
52
53struct scsi_host_template { 46struct scsi_host_template {
54 struct module *module; 47 struct module *module;
55 const char *name; 48 const char *name;
@@ -347,7 +340,7 @@ struct scsi_host_template {
347 * 340 *
348 * Status: OPTIONAL 341 * Status: OPTIONAL
349 */ 342 */
350 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); 343 enum blk_eh_timer_return (*eh_timed_out)(struct scsi_cmnd *);
351 344
352 /* 345 /*
353 * Name of proc directory 346 * Name of proc directory
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index edb9525386da..b9006848b813 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -42,7 +42,7 @@ typedef struct scsi_fctargaddress {
42 42
43extern int scsi_ioctl(struct scsi_device *, int, void __user *); 43extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
45 void __user *arg, struct file *filp); 45 void __user *arg, int ndelay);
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
48#endif /* _SCSI_IOCTL_H */ 48#endif /* _SCSI_IOCTL_H */
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 8c1470cc8209..536752c40d41 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -22,6 +22,9 @@
22#ifndef SCSI_NETLINK_H 22#ifndef SCSI_NETLINK_H
23#define SCSI_NETLINK_H 23#define SCSI_NETLINK_H
24 24
25#include <linux/netlink.h>
26
27
25/* 28/*
26 * This file intended to be included by both kernel and user space 29 * This file intended to be included by both kernel and user space
27 */ 30 */
@@ -55,7 +58,41 @@ struct scsi_nl_hdr {
55#define SCSI_NL_TRANSPORT_FC 1 58#define SCSI_NL_TRANSPORT_FC 1
56#define SCSI_NL_MAX_TRANSPORTS 2 59#define SCSI_NL_MAX_TRANSPORTS 2
57 60
58/* scsi_nl_hdr->msgtype values are defined in each transport */ 61/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
62
63/*
64 * GENERIC SCSI scsi_nl_hdr->msgtype Values
65 */
66 /* kernel -> user */
67#define SCSI_NL_SHOST_VENDOR 0x0001
68 /* user -> kernel */
69/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
70
71
72/*
73 * Message Structures :
74 */
75
76/* macro to round up message lengths to 8byte boundary */
77#define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
78
79
80/*
81 * SCSI HOST Vendor Unique messages :
82 * SCSI_NL_SHOST_VENDOR
83 *
84 * Note: The Vendor Unique message payload will begin directly after
85 * this structure, with the length of the payload per vmsg_datalen.
86 *
87 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
88 * formatting requirements specified below
89 */
90struct scsi_nl_host_vendor_msg {
91 struct scsi_nl_hdr snlh; /* must be 1st element ! */
92 uint64_t vendor_id;
93 uint16_t host_no;
94 uint16_t vmsg_datalen;
95} __attribute__((aligned(sizeof(uint64_t))));
59 96
60 97
61/* 98/*
@@ -83,5 +120,28 @@ struct scsi_nl_hdr {
83 } 120 }
84 121
85 122
123#ifdef __KERNEL__
124
125#include <scsi/scsi_host.h>
126
127/* Exported Kernel Interfaces */
128int scsi_nl_add_transport(u8 tport,
129 int (*msg_handler)(struct sk_buff *),
130 void (*event_handler)(struct notifier_block *, unsigned long, void *));
131void scsi_nl_remove_transport(u8 tport);
132
133int scsi_nl_add_driver(u64 vendor_id, struct scsi_host_template *hostt,
134 int (*nlmsg_handler)(struct Scsi_Host *shost, void *payload,
135 u32 len, u32 pid),
136 void (*nlevt_handler)(struct notifier_block *nb,
137 unsigned long event, void *notify_ptr));
138void scsi_nl_remove_driver(u64 vendor_id);
139
140void scsi_nl_send_transport_msg(u32 pid, struct scsi_nl_hdr *hdr);
141int scsi_nl_send_vendor_msg(u32 pid, unsigned short host_no, u64 vendor_id,
142 char *data_buf, u32 data_len);
143
144#endif /* __KERNEL__ */
145
86#endif /* SCSI_NETLINK_H */ 146#endif /* SCSI_NETLINK_H */
87 147
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 490bd13a634c..0de32cd4e8a7 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -21,6 +21,7 @@
21#define SCSI_TRANSPORT_H 21#define SCSI_TRANSPORT_H
22 22
23#include <linux/transport_class.h> 23#include <linux/transport_class.h>
24#include <linux/blkdev.h>
24#include <scsi/scsi_host.h> 25#include <scsi/scsi_host.h>
25#include <scsi/scsi_device.h> 26#include <scsi/scsi_device.h>
26 27
@@ -64,7 +65,7 @@ struct scsi_transport_template {
64 * begin counting again 65 * begin counting again
65 * EH_NOT_HANDLED Begin normal error recovery 66 * EH_NOT_HANDLED Begin normal error recovery
66 */ 67 */
67 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); 68 enum blk_eh_timer_return (*eh_timed_out)(struct scsi_cmnd *);
68 69
69 /* 70 /*
70 * Used as callback for the completion of i_t_nexus request 71 * Used as callback for the completion of i_t_nexus request
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 878373c32ef7..49d8913c4f86 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -167,6 +167,26 @@ enum fc_tgtid_binding_type {
167struct device_attribute dev_attr_vport_##_name = \ 167struct device_attribute dev_attr_vport_##_name = \
168 __ATTR(_name,_mode,_show,_store) 168 __ATTR(_name,_mode,_show,_store)
169 169
170/*
171 * fc_vport_identifiers: This set of data contains all elements
172 * to uniquely identify and instantiate a FC virtual port.
173 *
174 * Notes:
175 * symbolic_name: The driver is to append the symbolic_name string data
176 * to the symbolic_node_name data that it generates by default.
177 * the resulting combination should then be registered with the switch.
178 * It is expected that things like Xen may stuff a VM title into
179 * this field.
180 */
181#define FC_VPORT_SYMBOLIC_NAMELEN 64
182struct fc_vport_identifiers {
183 u64 node_name;
184 u64 port_name;
185 u32 roles;
186 bool disable;
187 enum fc_port_type vport_type; /* only FC_PORTTYPE_NPIV allowed */
188 char symbolic_name[FC_VPORT_SYMBOLIC_NAMELEN];
189};
170 190
171/* 191/*
172 * FC Virtual Port Attributes 192 * FC Virtual Port Attributes
@@ -197,7 +217,6 @@ struct device_attribute dev_attr_vport_##_name = \
197 * managed by the transport w/o driver interaction. 217 * managed by the transport w/o driver interaction.
198 */ 218 */
199 219
200#define FC_VPORT_SYMBOLIC_NAMELEN 64
201struct fc_vport { 220struct fc_vport {
202 /* Fixed Attributes */ 221 /* Fixed Attributes */
203 222
@@ -338,6 +357,7 @@ struct fc_rport { /* aka fc_starget_attrs */
338/* bit field values for struct fc_rport "flags" field: */ 357/* bit field values for struct fc_rport "flags" field: */
339#define FC_RPORT_DEVLOSS_PENDING 0x01 358#define FC_RPORT_DEVLOSS_PENDING 0x01
340#define FC_RPORT_SCAN_PENDING 0x02 359#define FC_RPORT_SCAN_PENDING 0x02
360#define FC_RPORT_FAST_FAIL_TIMEDOUT 0x03
341 361
342#define dev_to_rport(d) \ 362#define dev_to_rport(d) \
343 container_of(d, struct fc_rport, dev) 363 container_of(d, struct fc_rport, dev)
@@ -659,12 +679,15 @@ fc_remote_port_chkready(struct fc_rport *rport)
659 if (rport->roles & FC_PORT_ROLE_FCP_TARGET) 679 if (rport->roles & FC_PORT_ROLE_FCP_TARGET)
660 result = 0; 680 result = 0;
661 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING) 681 else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)
662 result = DID_IMM_RETRY << 16; 682 result = DID_TRANSPORT_DISRUPTED << 16;
663 else 683 else
664 result = DID_NO_CONNECT << 16; 684 result = DID_NO_CONNECT << 16;
665 break; 685 break;
666 case FC_PORTSTATE_BLOCKED: 686 case FC_PORTSTATE_BLOCKED:
667 result = DID_IMM_RETRY << 16; 687 if (rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT)
688 result = DID_TRANSPORT_FAILFAST << 16;
689 else
690 result = DID_TRANSPORT_DISRUPTED << 16;
668 break; 691 break;
669 default: 692 default:
670 result = DID_NO_CONNECT << 16; 693 result = DID_NO_CONNECT << 16;
@@ -732,6 +755,8 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
732 * be sure to read the Vendor Type and ID formatting requirements 755 * be sure to read the Vendor Type and ID formatting requirements
733 * specified in scsi_netlink.h 756 * specified in scsi_netlink.h
734 */ 757 */
758struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
759 struct fc_vport_identifiers *);
735int fc_vport_terminate(struct fc_vport *vport); 760int fc_vport_terminate(struct fc_vport *vport);
736 761
737#endif /* SCSI_TRANSPORT_FC_H */ 762#endif /* SCSI_TRANSPORT_FC_H */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 8b6c91df4c7a..c667cc396545 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -135,7 +135,8 @@ extern int iscsi_unregister_transport(struct iscsi_transport *tt);
135/* 135/*
136 * control plane upcalls 136 * control plane upcalls
137 */ 137 */
138extern void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error); 138extern void iscsi_conn_error_event(struct iscsi_cls_conn *conn,
139 enum iscsi_err error);
139extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 140extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
140 char *data, uint32_t data_size); 141 char *data, uint32_t data_size);
141 142
@@ -207,7 +208,7 @@ extern void iscsi_host_for_each_session(struct Scsi_Host *shost,
207struct iscsi_endpoint { 208struct iscsi_endpoint {
208 void *dd_data; /* LLD private data */ 209 void *dd_data; /* LLD private data */
209 struct device dev; 210 struct device dev;
210 unsigned int id; 211 uint64_t id;
211}; 212};
212 213
213/* 214/*
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
deleted file mode 100644
index d9aebdf6db63..000000000000
--- a/include/sound/ad1848.h
+++ /dev/null
@@ -1,218 +0,0 @@
1#ifndef __SOUND_AD1848_H
2#define __SOUND_AD1848_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for AD1847/AD1848/CS4248 chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "pcm.h"
26#include <linux/interrupt.h>
27
28/* IO ports */
29
30#define AD1848P( chip, x ) ( (chip) -> port + c_d_c_AD1848##x )
31
32#define c_d_c_AD1848REGSEL 0
33#define c_d_c_AD1848REG 1
34#define c_d_c_AD1848STATUS 2
35#define c_d_c_AD1848PIO 3
36
37/* codec registers */
38
39#define AD1848_LEFT_INPUT 0x00 /* left input control */
40#define AD1848_RIGHT_INPUT 0x01 /* right input control */
41#define AD1848_AUX1_LEFT_INPUT 0x02 /* left AUX1 input control */
42#define AD1848_AUX1_RIGHT_INPUT 0x03 /* right AUX1 input control */
43#define AD1848_AUX2_LEFT_INPUT 0x04 /* left AUX2 input control */
44#define AD1848_AUX2_RIGHT_INPUT 0x05 /* right AUX2 input control */
45#define AD1848_LEFT_OUTPUT 0x06 /* left output control register */
46#define AD1848_RIGHT_OUTPUT 0x07 /* right output control register */
47#define AD1848_DATA_FORMAT 0x08 /* clock and data format - playback/capture - bits 7-0 MCE */
48#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
49#define AD1848_PIN_CTRL 0x0a /* pin control */
50#define AD1848_TEST_INIT 0x0b /* test and initialization */
51#define AD1848_MISC_INFO 0x0c /* miscellaneous information */
52#define AD1848_LOOPBACK 0x0d /* loopback control */
53#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
54#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */
55
56/* definitions for codec register select port - CODECP( REGSEL ) */
57
58#define AD1848_INIT 0x80 /* CODEC is initializing */
59#define AD1848_MCE 0x40 /* mode change enable */
60#define AD1848_TRD 0x20 /* transfer request disable */
61
62/* definitions for codec status register - CODECP( STATUS ) */
63
64#define AD1848_GLOBALIRQ 0x01 /* IRQ is active */
65
66/* definitions for AD1848_LEFT_INPUT and AD1848_RIGHT_INPUT registers */
67
68#define AD1848_ENABLE_MIC_GAIN 0x20
69
70#define AD1848_MIXS_LINE1 0x00
71#define AD1848_MIXS_AUX1 0x40
72#define AD1848_MIXS_LINE2 0x80
73#define AD1848_MIXS_ALL 0xc0
74
75/* definitions for clock and data format register - AD1848_PLAYBK_FORMAT */
76
77#define AD1848_LINEAR_8 0x00 /* 8-bit unsigned data */
78#define AD1848_ALAW_8 0x60 /* 8-bit A-law companded */
79#define AD1848_ULAW_8 0x20 /* 8-bit U-law companded */
80#define AD1848_LINEAR_16 0x40 /* 16-bit twos complement data - little endian */
81#define AD1848_STEREO 0x10 /* stereo mode */
82/* bits 3-1 define frequency divisor */
83#define AD1848_XTAL1 0x00 /* 24.576 crystal */
84#define AD1848_XTAL2 0x01 /* 16.9344 crystal */
85
86/* definitions for interface control register - AD1848_IFACE_CTRL */
87
88#define AD1848_CAPTURE_PIO 0x80 /* capture PIO enable */
89#define AD1848_PLAYBACK_PIO 0x40 /* playback PIO enable */
90#define AD1848_CALIB_MODE 0x18 /* calibration mode bits */
91#define AD1848_AUTOCALIB 0x08 /* auto calibrate */
92#define AD1848_SINGLE_DMA 0x04 /* use single DMA channel */
93#define AD1848_CAPTURE_ENABLE 0x02 /* capture enable */
94#define AD1848_PLAYBACK_ENABLE 0x01 /* playback enable */
95
96/* definitions for pin control register - AD1848_PIN_CTRL */
97
98#define AD1848_IRQ_ENABLE 0x02 /* enable IRQ */
99#define AD1848_XCTL1 0x40 /* external control #1 */
100#define AD1848_XCTL0 0x80 /* external control #0 */
101
102/* definitions for test and init register - AD1848_TEST_INIT */
103
104#define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
105#define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */
106
107/* defines for codec.mode */
108
109#define AD1848_MODE_NONE 0x0000
110#define AD1848_MODE_PLAY 0x0001
111#define AD1848_MODE_CAPTURE 0x0002
112#define AD1848_MODE_TIMER 0x0004
113#define AD1848_MODE_OPEN (AD1848_MODE_PLAY|AD1848_MODE_CAPTURE|AD1848_MODE_TIMER)
114#define AD1848_MODE_RUNNING 0x0010
115
116/* defines for codec.hardware */
117
118#define AD1848_HW_DETECT 0x0000 /* let AD1848 driver detect chip */
119#define AD1848_HW_AD1847 0x0001 /* AD1847 chip */
120#define AD1848_HW_AD1848 0x0002 /* AD1848 chip */
121#define AD1848_HW_CS4248 0x0003 /* CS4248 chip */
122#define AD1848_HW_CMI8330 0x0004 /* CMI8330 chip */
123#define AD1848_HW_THINKPAD 0x0005 /* Thinkpad 360/750/755 */
124
125/* IBM Thinkpad specific stuff */
126#define AD1848_THINKPAD_CTL_PORT1 0x15e8
127#define AD1848_THINKPAD_CTL_PORT2 0x15e9
128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
129
130struct snd_ad1848 {
131 unsigned long port; /* i/o port */
132 struct resource *res_port;
133 int irq; /* IRQ line */
134 int dma; /* data DMA */
135 unsigned short version; /* version of CODEC chip */
136 unsigned short mode; /* see to AD1848_MODE_XXXX */
137 unsigned short hardware; /* see to AD1848_HW_XXXX */
138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
139
140 struct snd_pcm *pcm;
141 struct snd_pcm_substream *playback_substream;
142 struct snd_pcm_substream *capture_substream;
143 struct snd_card *card;
144
145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */
146 int mce_bit;
147 int calibrate_mute;
148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
156 spinlock_t reg_lock;
157};
158
159/* exported functions */
160
161void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value);
162
163int snd_ad1848_create(struct snd_card *card,
164 unsigned long port,
165 int irq, int dma,
166 unsigned short hardware,
167 struct snd_ad1848 ** chip);
168
169int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm);
170const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
171int snd_ad1848_mixer(struct snd_ad1848 * chip);
172
173/* exported mixer stuffs */
174enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
175
176#define AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) \
177 ((reg) | ((shift) << 8) | ((mask) << 16) | ((invert) << 24))
178#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
179 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
180
181/* for ease of use */
182struct ad1848_mix_elem {
183 const char *name;
184 int index;
185 int type;
186 unsigned long private_value;
187 const unsigned int *tlv;
188};
189
190#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
191{ .name = xname, \
192 .index = xindex, \
193 .type = AD1848_MIX_SINGLE, \
194 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) }
195
196#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
197{ .name = xname, \
198 .index = xindex, \
199 .type = AD1848_MIX_SINGLE, \
200 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
201 .tlv = xtlv }
202
203#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
204{ .name = xname, \
205 .index = xindex, \
206 .type = AD1848_MIX_DOUBLE, \
207 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
208
209#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
210{ .name = xname, \
211 .index = xindex, \
212 .type = AD1848_MIX_DOUBLE, \
213 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
214 .tlv = xtlv }
215
216int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c);
217
218#endif /* __SOUND_AD1848_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 3eaf155b850d..2c4dc908a54a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -93,9 +93,10 @@ enum {
93 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ 93 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
94 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ 94 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
96 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
96 97
97 /* Don't forget to change the following: */ 98 /* Don't forget to change the following: */
98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_HDA 99 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
99}; 100};
100 101
101struct snd_hwdep_info { 102struct snd_hwdep_info {
@@ -296,29 +297,39 @@ struct snd_pcm_info {
296 unsigned char reserved[64]; /* reserved for future... */ 297 unsigned char reserved[64]; /* reserved for future... */
297}; 298};
298 299
299typedef int __bitwise snd_pcm_hw_param_t; 300typedef int snd_pcm_hw_param_t;
300#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */ 301#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
301#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */ 302#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
302#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */ 303#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
303#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS 304#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
304#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT 305#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
305 306
306#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */ 307#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
307#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */ 308#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
308#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */ 309#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
309#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */ 310#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
310#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */ 311#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
311#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */ 312 * interrupts in us
312#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */ 313 */
313#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */ 314#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
314#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */ 315 * interrupts
315#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */ 316 */
316#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */ 317#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
317#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */ 318 * interrupts
319 */
320#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
321 * buffer
322 */
323#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
324 * in us
325 */
326#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
327#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
328#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
318#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS 329#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
319#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME 330#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
320 331
321#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 332#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
322 333
323struct snd_interval { 334struct snd_interval {
324 unsigned int min, max; 335 unsigned int min, max;
@@ -696,7 +707,7 @@ struct snd_timer_tread {
696 * * 707 * *
697 ****************************************************************************/ 708 ****************************************************************************/
698 709
699#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 710#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
700 711
701struct snd_ctl_card_info { 712struct snd_ctl_card_info {
702 int card; /* card number */ 713 int card; /* card number */
@@ -707,8 +718,7 @@ struct snd_ctl_card_info {
707 unsigned char longname[80]; /* name + info text about soundcard */ 718 unsigned char longname[80]; /* name + info text about soundcard */
708 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ 719 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
709 unsigned char mixername[80]; /* visual mixer identification */ 720 unsigned char mixername[80]; /* visual mixer identification */
710 unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */ 721 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
711 unsigned char reserved[48]; /* reserved for future */
712}; 722};
713 723
714typedef int __bitwise snd_ctl_elem_type_t; 724typedef int __bitwise snd_ctl_elem_type_t;
diff --git a/include/sound/asoundef.h b/include/sound/asoundef.h
index a6e0facf8a37..20ebf3298eba 100644
--- a/include/sound/asoundef.h
+++ b/include/sound/asoundef.h
@@ -60,35 +60,56 @@
60#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */ 60#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */
61#define IEC958_AES1_CON_CATEGORY 0x7f 61#define IEC958_AES1_CON_CATEGORY 0x7f
62#define IEC958_AES1_CON_GENERAL 0x00 62#define IEC958_AES1_CON_GENERAL 0x00
63#define IEC958_AES1_CON_EXPERIMENTAL 0x40
64#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
65#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
66#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
67#define IEC958_AES1_CON_BROADCAST1_ID 0x04
68#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
69#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
70#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
71#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x06
72#define IEC958_AES1_CON_ADC_MASK 0x1f
73#define IEC958_AES1_CON_ADC_ID 0x16
74#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
75#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
76#define IEC958_AES1_CON_LASEROPT_MASK 0x07 63#define IEC958_AES1_CON_LASEROPT_MASK 0x07
77#define IEC958_AES1_CON_LASEROPT_ID 0x01 64#define IEC958_AES1_CON_LASEROPT_ID 0x01
78#define IEC958_AES1_CON_MUSICAL_MASK 0x07
79#define IEC958_AES1_CON_MUSICAL_ID 0x05
80#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
81#define IEC958_AES1_CON_MAGNETIC_ID 0x03
82#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) 65#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00)
83#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) 66#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08)
67#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48)
68#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18)
69#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78)
70#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
71#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
84#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) 72#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00)
85#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
86#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) 73#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10)
87#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) 74#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18)
88#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) 75#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
89#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) 76#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28)
77#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78)
78#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
79#define IEC958_AES1_CON_MAGNETIC_ID 0x03
90#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) 80#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00)
91#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) 81#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08)
82#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40)
83#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18)
84#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78)
85#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
86#define IEC958_AES1_CON_BROADCAST1_ID 0x04
87#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00)
88#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08)
89#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60)
90#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40)
91#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20)
92#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78)
93#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
94#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
95#define IEC958_AES1_CON_MUSICAL_MASK 0x07
96#define IEC958_AES1_CON_MUSICAL_ID 0x05
97#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00)
98#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08)
99#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78)
100#define IEC958_AES1_CON_ADC_MASK 0x1f
101#define IEC958_AES1_CON_ADC_ID 0x06
102#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00)
103#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60)
104#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
105#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16
106#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00)
107#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60)
108#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
109#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
110#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00)
111#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70)
112#define IEC958_AES1_CON_EXPERIMENTAL 0x40
92#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */ 113#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */
93#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */ 114#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */
94#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */ 115#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */
@@ -106,8 +127,16 @@
106#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */ 127#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */
107#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */ 128#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */
108#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */ 129#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */
130#define IEC958_AES3_CON_FS_NOTID (1<<0) /* non indicated */
109#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */ 131#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */
110#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */ 132#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */
133#define IEC958_AES3_CON_FS_22050 (4<<0) /* 22.05kHz */
134#define IEC958_AES3_CON_FS_24000 (6<<0) /* 24kHz */
135#define IEC958_AES3_CON_FS_88200 (8<<0) /* 88.2kHz */
136#define IEC958_AES3_CON_FS_768000 (9<<0) /* 768kHz */
137#define IEC958_AES3_CON_FS_96000 (10<<0) /* 96kHz */
138#define IEC958_AES3_CON_FS_176400 (12<<0) /* 176.4kHz */
139#define IEC958_AES3_CON_FS_192000 (14<<0) /* 192kHz */
111#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */ 140#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */
112#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */ 141#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */
113#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */ 142#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */
@@ -120,6 +149,26 @@
120#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /* 23-bit or 19-bit */ 149#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /* 23-bit or 19-bit */
121#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /* 24-bit or 20-bit */ 150#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /* 24-bit or 20-bit */
122#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /* 21-bit or 17-bit */ 151#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /* 21-bit or 17-bit */
152#define IEC958_AES4_CON_ORIGFS (15<<4) /* mask - original sample frequency */
153#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /* not indicated */
154#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /* 192kHz */
155#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /* 12kHz */
156#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /* 176.4kHz */
157#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /* 96kHz */
158#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /* 8kHz */
159#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /* 88.2kHz */
160#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /* 16kHz */
161#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /* 24kHz */
162#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /* 11.025kHz */
163#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /* 22.05kHz */
164#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /* 32kHz */
165#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /* 48kHz */
166#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /* 44.1kHz */
167#define IEC958_AES5_CON_CGMSA (3<<0) /* mask - CGMS-A */
168#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /* copying is permitted without restriction */
169#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /* one generation of copies may be made */
170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */
171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */
123 172
124/***************************************************************************** 173/*****************************************************************************
125 * * 174 * *
diff --git a/include/sound/core.h b/include/sound/core.h
index 558b96284bd2..35424a971b7a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,6 +28,7 @@
28#include <linux/rwsem.h> /* struct rw_semaphore */ 28#include <linux/rwsem.h> /* struct rw_semaphore */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/stringify.h>
31 32
32/* number of supported soundcards */ 33/* number of supported soundcards */
33#ifdef CONFIG_SND_DYNAMIC_MINORS 34#ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -42,9 +43,6 @@
42#ifdef CONFIG_PCI 43#ifdef CONFIG_PCI
43struct pci_dev; 44struct pci_dev;
44#endif 45#endif
45#ifdef CONFIG_SBUS
46struct sbus_dev;
47#endif
48 46
49/* device allocation stuff */ 47/* device allocation stuff */
50 48
@@ -63,6 +61,7 @@ typedef int __bitwise snd_device_type_t;
63#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 61#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
64#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
65#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
66#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 65#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
67 66
68typedef int __bitwise snd_device_state_t; 67typedef int __bitwise snd_device_state_t;
@@ -114,7 +113,7 @@ struct snd_card {
114 char shortname[32]; /* short name of this soundcard */ 113 char shortname[32]; /* short name of this soundcard */
115 char longname[80]; /* name of this soundcard */ 114 char longname[80]; /* name of this soundcard */
116 char mixername[80]; /* mixer name */ 115 char mixername[80]; /* mixer name */
117 char components[80]; /* card components delimited with 116 char components[128]; /* card components delimited with
118 space */ 117 space */
119 struct module *module; /* top-level module */ 118 struct module *module; /* top-level module */
120 119
@@ -366,8 +365,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
366 365
367#ifdef CONFIG_SND_DEBUG 366#ifdef CONFIG_SND_DEBUG
368 367
369#define __ASTRING__(x) #x
370
371#ifdef CONFIG_SND_VERBOSE_PRINTK 368#ifdef CONFIG_SND_VERBOSE_PRINTK
372/** 369/**
373 * snd_printd - debug printk 370 * snd_printd - debug printk
@@ -382,33 +379,15 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
382#define snd_printd(fmt, args...) \ 379#define snd_printd(fmt, args...) \
383 printk(fmt ,##args) 380 printk(fmt ,##args)
384#endif 381#endif
385/** 382
386 * snd_assert - run-time assertion macro 383#define snd_BUG() WARN(1, "BUG?\n")
387 * @expr: expression 384#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
388 *
389 * This macro checks the expression in run-time and invokes the commands
390 * given in the rest arguments if the assertion is failed.
391 * When CONFIG_SND_DEBUG is not set, the expression is executed but
392 * not checked.
393 */
394#define snd_assert(expr, args...) do { \
395 if (unlikely(!(expr))) { \
396 snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \
397 dump_stack(); \
398 args; \
399 } \
400} while (0)
401
402#define snd_BUG() do { \
403 snd_printk(KERN_ERR "BUG?\n"); \
404 dump_stack(); \
405} while (0)
406 385
407#else /* !CONFIG_SND_DEBUG */ 386#else /* !CONFIG_SND_DEBUG */
408 387
409#define snd_printd(fmt, args...) /* nothing */ 388#define snd_printd(fmt, args...) /* nothing */
410#define snd_assert(expr, args...) (void)(expr)
411#define snd_BUG() /* nothing */ 389#define snd_BUG() /* nothing */
390#define snd_BUG_ON(cond) ({/*(void)(cond);*/ 0;}) /* always false */
412 391
413#endif /* CONFIG_SND_DEBUG */ 392#endif /* CONFIG_SND_DEBUG */
414 393
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
deleted file mode 100644
index f0785f9f4ae4..000000000000
--- a/include/sound/cs4231.h
+++ /dev/null
@@ -1,175 +0,0 @@
1#ifndef __SOUND_CS4231_H
2#define __SOUND_CS4231_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for CS4231 & InterWave chips & compatible chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "control.h"
26#include "pcm.h"
27#include "timer.h"
28
29#include "cs4231-regs.h"
30
31/* defines for codec.mode */
32
33#define CS4231_MODE_NONE 0x0000
34#define CS4231_MODE_PLAY 0x0001
35#define CS4231_MODE_RECORD 0x0002
36#define CS4231_MODE_TIMER 0x0004
37#define CS4231_MODE_OPEN (CS4231_MODE_PLAY|CS4231_MODE_RECORD|CS4231_MODE_TIMER)
38
39/* defines for codec.hardware */
40
41#define CS4231_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
42#define CS4231_HW_DETECT3 0x0001 /* allow mode 3 */
43#define CS4231_HW_TYPE_MASK 0xff00 /* type mask */
44#define CS4231_HW_CS4231_MASK 0x0100 /* CS4231 serie */
45#define CS4231_HW_CS4231 0x0100 /* CS4231 chip */
46#define CS4231_HW_CS4231A 0x0101 /* CS4231A chip */
47#define CS4231_HW_AD1845 0x0102 /* AD1845 chip */
48#define CS4231_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
49#define CS4231_HW_CS4232 0x0200 /* CS4232 */
50#define CS4231_HW_CS4232A 0x0201 /* CS4232A */
51#define CS4231_HW_CS4236 0x0202 /* CS4236 */
52#define CS4231_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
53#define CS4231_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
54#define CS4231_HW_CS4236B 0x0401 /* CS4236B */
55#define CS4231_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
56#define CS4231_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
57#define CS4231_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
58/* compatible, but clones */
59#define CS4231_HW_INTERWAVE 0x1000 /* InterWave chip */
60#define CS4231_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
61#define CS4231_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
62
63/* defines for codec.hwshare */
64#define CS4231_HWSHARE_IRQ (1<<0)
65#define CS4231_HWSHARE_DMA1 (1<<1)
66#define CS4231_HWSHARE_DMA2 (1<<2)
67
68struct snd_cs4231 {
69 unsigned long port; /* base i/o port */
70 struct resource *res_port;
71 unsigned long cport; /* control base i/o port (CS4236) */
72 struct resource *res_cport;
73 int irq; /* IRQ line */
74 int dma1; /* playback DMA */
75 int dma2; /* record DMA */
76 unsigned short version; /* version of CODEC chip */
77 unsigned short mode; /* see to CS4231_MODE_XXXX */
78 unsigned short hardware; /* see to CS4231_HW_XXXX */
79 unsigned short hwshare; /* shared resources */
80 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
81 ebus_flag:1; /* SPARC: EBUS present */
82
83 struct snd_card *card;
84 struct snd_pcm *pcm;
85 struct snd_pcm_substream *playback_substream;
86 struct snd_pcm_substream *capture_substream;
87 struct snd_timer *timer;
88
89 unsigned char image[32]; /* registers image */
90 unsigned char eimage[32]; /* extended registers image */
91 unsigned char cimage[16]; /* control registers image */
92 int mce_bit;
93 int calibrate_mute;
94 int sw_3d_bit;
95 unsigned int p_dma_size;
96 unsigned int c_dma_size;
97
98 spinlock_t reg_lock;
99 struct mutex mce_mutex;
100 struct mutex open_mutex;
101
102 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
103 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
104 void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
105 void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
106#ifdef CONFIG_PM
107 void (*suspend) (struct snd_cs4231 *chip);
108 void (*resume) (struct snd_cs4231 *chip);
109#endif
110 void *dma_private_data;
111 int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
112 int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
113};
114
115/* exported functions */
116
117void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
118unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
119void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
120unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
121void snd_cs4231_mce_up(struct snd_cs4231 *chip);
122void snd_cs4231_mce_down(struct snd_cs4231 *chip);
123
124void snd_cs4231_overrange(struct snd_cs4231 *chip);
125
126irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id);
127
128const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
129
130int snd_cs4231_create(struct snd_card *card,
131 unsigned long port,
132 unsigned long cport,
133 int irq, int dma1, int dma2,
134 unsigned short hardware,
135 unsigned short hwshare,
136 struct snd_cs4231 ** rchip);
137int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
138int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
139int snd_cs4231_mixer(struct snd_cs4231 * chip);
140
141int snd_cs4236_create(struct snd_card *card,
142 unsigned long port,
143 unsigned long cport,
144 int irq, int dma1, int dma2,
145 unsigned short hardware,
146 unsigned short hwshare,
147 struct snd_cs4231 ** rchip);
148int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
149int snd_cs4236_mixer(struct snd_cs4231 * chip);
150
151/*
152 * mixer library
153 */
154
155#define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \
156{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
157 .info = snd_cs4231_info_single, \
158 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
159 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
160
161int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
162int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
163int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
164
165#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
166{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
167 .info = snd_cs4231_info_double, \
168 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
169 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
170
171int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
172int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
173int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
174
175#endif /* __SOUND_CS4231_H */
diff --git a/include/sound/jack.h b/include/sound/jack.h
new file mode 100644
index 000000000000..b1b2b8b59adb
--- /dev/null
+++ b/include/sound/jack.h
@@ -0,0 +1,75 @@
1#ifndef __SOUND_JACK_H
2#define __SOUND_JACK_H
3
4/*
5 * Jack abstraction layer
6 *
7 * Copyright 2008 Wolfson Microelectronics plc
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#include <sound/core.h>
27
28struct input_dev;
29
30/**
31 * Jack types which can be reported. These values are used as a
32 * bitmask.
33 */
34enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001,
36 SND_JACK_MICROPHONE = 0x0002,
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38};
39
40struct snd_jack {
41 struct input_dev *input_dev;
42 int registered;
43 int type;
44 const char *id;
45 char name[100];
46};
47
48#ifdef CONFIG_SND_JACK
49
50int snd_jack_new(struct snd_card *card, const char *id, int type,
51 struct snd_jack **jack);
52void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
53
54void snd_jack_report(struct snd_jack *jack, int status);
55
56#else
57
58static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
59 struct snd_jack **jack)
60{
61 return 0;
62}
63
64static inline void snd_jack_set_parent(struct snd_jack *jack,
65 struct device *parent)
66{
67}
68
69static inline void snd_jack_report(struct snd_jack *jack, int status)
70{
71}
72
73#endif
74
75#endif
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index ae2921d9ddcc..7ccce94a5255 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -37,7 +37,6 @@ struct snd_dma_device {
37#ifndef snd_dma_pci_data 37#ifndef snd_dma_pci_data
38#define snd_dma_pci_data(pci) (&(pci)->dev) 38#define snd_dma_pci_data(pci) (&(pci)->dev)
39#define snd_dma_isa_data() NULL 39#define snd_dma_isa_data() NULL
40#define snd_dma_sbus_data(sbus) ((struct device *)(sbus))
41#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) 40#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x))
42#endif 41#endif
43 42
@@ -49,7 +48,6 @@ struct snd_dma_device {
49#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ 48#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */
50#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ 49#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */
51#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ 50#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */
52#define SNDRV_DMA_TYPE_SBUS 4 /* SBUS continuous */
53 51
54/* 52/*
55 * info for buffer allocation 53 * info for buffer allocation
@@ -65,6 +63,11 @@ struct snd_dma_buffer {
65/* 63/*
66 * Scatter-Gather generic device pages 64 * Scatter-Gather generic device pages
67 */ 65 */
66void *snd_malloc_sgbuf_pages(struct device *device,
67 size_t size, struct snd_dma_buffer *dmab,
68 size_t *res_size);
69int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
70
68struct snd_sg_page { 71struct snd_sg_page {
69 void *buf; 72 void *buf;
70 dma_addr_t addr; 73 dma_addr_t addr;
@@ -92,9 +95,18 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
92 */ 95 */
93static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 96static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset)
94{ 97{
95 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; 98 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
99 addr &= PAGE_MASK;
100 return addr + offset % PAGE_SIZE;
96} 101}
97 102
103/*
104 * return the virtual address at the corresponding offset
105 */
106static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset)
107{
108 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
109}
98 110
99/* allocate/release a buffer */ 111/* allocate/release a buffer */
100int snd_dma_alloc_pages(int type, struct device *dev, size_t size, 112int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
diff --git a/include/sound/minors.h b/include/sound/minors.h
index 46bcd2023ed8..a81798ab73ed 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -21,6 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#define SNDRV_OS_MINORS 256
25
24#define SNDRV_MINOR_DEVICES 32 26#define SNDRV_MINOR_DEVICES 32
25#define SNDRV_MINOR_CARD(minor) ((minor) >> 5) 27#define SNDRV_MINOR_CARD(minor) ((minor) >> 5)
26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) 28#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 51d58ccda2d8..40c5a6fa6bcd 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -25,6 +25,7 @@
25 25
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <sound/memalloc.h> 27#include <sound/memalloc.h>
28#include <sound/minors.h>
28#include <linux/poll.h> 29#include <linux/poll.h>
29#include <linux/mm.h> 30#include <linux/mm.h>
30#include <linux/bitops.h> 31#include <linux/bitops.h>
@@ -84,7 +85,11 @@ struct snd_pcm_ops {
84 * 85 *
85 */ 86 */
86 87
87#define SNDRV_PCM_DEVICES 8 88#if defined(CONFIG_SND_DYNAMIC_MINORS)
89#define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2)
90#else
91#define SNDRV_PCM_DEVICES 8
92#endif
88 93
89#define SNDRV_PCM_IOCTL1_FALSE ((void *)0) 94#define SNDRV_PCM_IOCTL1_FALSE ((void *)0)
90#define SNDRV_PCM_IOCTL1_TRUE ((void *)1) 95#define SNDRV_PCM_IOCTL1_TRUE ((void *)1)
@@ -416,7 +421,7 @@ struct snd_pcm_str {
416struct snd_pcm { 421struct snd_pcm {
417 struct snd_card *card; 422 struct snd_card *card;
418 struct list_head list; 423 struct list_head list;
419 unsigned int device; /* device number */ 424 int device; /* device number */
420 unsigned int info_flags; 425 unsigned int info_flags;
421 unsigned short dev_class; 426 unsigned short dev_class;
422 unsigned short dev_subclass; 427 unsigned short dev_subclass;
@@ -969,10 +974,30 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
969int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 974int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
970int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 975int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
971 976
972#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) 977/*
973#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) 978 * SG-buffer handling
974#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) 979 */
975struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset); 980#define snd_pcm_substream_sgbuf(substream) \
981 ((substream)->runtime->dma_buffer_p->private_data)
982
983static inline dma_addr_t
984snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
985{
986 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
987 return snd_sgbuf_get_addr(sg, ofs);
988}
989
990static inline void *
991snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
992{
993 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
994 return snd_sgbuf_get_ptr(sg, ofs);
995}
996
997struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
998 unsigned long offset);
999unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1000 unsigned int ofs, unsigned int size);
976 1001
977/* handle mmap counter - PCM mmap callback should handle this counter properly */ 1002/* handle mmap counter - PCM mmap callback should handle this counter properly */
978static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1003static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1010,4 +1035,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
1010 (IEC958_AES1_CON_PCM_CODER<<8)|\ 1035 (IEC958_AES1_CON_PCM_CODER<<8)|\
1011 (IEC958_AES3_CON_FS_48000<<24)) 1036 (IEC958_AES3_CON_FS_48000<<24))
1012 1037
1038#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
1039
1013#endif /* __SOUND_PCM_H */ 1040#endif /* __SOUND_PCM_H */
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
new file mode 100644
index 000000000000..2fd3d251d9a5
--- /dev/null
+++ b/include/sound/pxa2xx-lib.h
@@ -0,0 +1,45 @@
1#ifndef PXA2XX_LIB_H
2#define PXA2XX_LIB_H
3
4#include <linux/platform_device.h>
5#include <sound/ac97_codec.h>
6
7/* PCM */
8
9struct pxa2xx_pcm_dma_params {
10 char *name; /* stream identifier */
11 u32 dcmd; /* DMA descriptor dcmd field */
12 volatile u32 *drcmr; /* the DMA request channel to use */
13 u32 dev_addr; /* device physical address for DMA */
14};
15
16extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
17 struct snd_pcm_hw_params *params);
18extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
19extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
20extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream);
21extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream);
22extern void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id);
23extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream);
24extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream);
25extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
26 struct vm_area_struct *vma);
27extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream);
28extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);
29
30/* AC97 */
31
32extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
33extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
34
35extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97);
36extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97);
37extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97);
38
39extern int pxa2xx_ac97_hw_suspend(void);
40extern int pxa2xx_ac97_hw_resume(void);
41
42extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
43extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
44
45#endif
diff --git a/include/sound/sb.h b/include/sound/sb.h
index d0c9ed3546c8..85f93c5fe1e4 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -240,11 +240,15 @@ struct snd_sb {
240#define SB_DT019X_CAP_MAIN 0x07 240#define SB_DT019X_CAP_MAIN 0x07
241 241
242#define SB_ALS4000_MONO_IO_CTRL 0x4b 242#define SB_ALS4000_MONO_IO_CTRL 0x4b
243#define SB_ALS4000_OUT_MIXER_CTRL_2 0x4c
243#define SB_ALS4000_MIC_IN_GAIN 0x4d 244#define SB_ALS4000_MIC_IN_GAIN 0x4d
245#define SB_ALS4000_ANALOG_REFRNC_VOLT_CTRL 0x4e
244#define SB_ALS4000_FMDAC 0x4f 246#define SB_ALS4000_FMDAC 0x4f
245#define SB_ALS4000_3D_SND_FX 0x50 247#define SB_ALS4000_3D_SND_FX 0x50
246#define SB_ALS4000_3D_TIME_DELAY 0x51 248#define SB_ALS4000_3D_TIME_DELAY 0x51
247#define SB_ALS4000_3D_AUTO_MUTE 0x52 249#define SB_ALS4000_3D_AUTO_MUTE 0x52
250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
248#define SB_ALS4000_QSOUND 0xdb 252#define SB_ALS4000_QSOUND 0xdb
249 253
250/* IRQ setting bitmap */ 254/* IRQ setting bitmap */
@@ -257,6 +261,7 @@ struct snd_sb {
257#define SB_IRQTYPE_8BIT 0x01 261#define SB_IRQTYPE_8BIT 0x01
258#define SB_IRQTYPE_16BIT 0x02 262#define SB_IRQTYPE_16BIT 0x02
259#define SB_IRQTYPE_MPUIN 0x04 263#define SB_IRQTYPE_MPUIN 0x04
264#define ALS4K_IRQTYPE_CR1E_DMA 0x20
260 265
261/* DMA setting bitmap */ 266/* DMA setting bitmap */
262#define SB_DMASETUP_DMA0 0x01 267#define SB_DMASETUP_DMA0 0x01
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 9688d4be918e..fa149ca77e4b 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -1,7 +1,6 @@
1#ifndef __SOUND_SND_WAVEFRONT_H__ 1#ifndef __SOUND_SND_WAVEFRONT_H__
2#define __SOUND_SND_WAVEFRONT_H__ 2#define __SOUND_SND_WAVEFRONT_H__
3 3
4#include "cs4231.h"
5#include "mpu401.h" 4#include "mpu401.h"
6#include "hwdep.h" 5#include "hwdep.h"
7#include "rawmidi.h" 6#include "rawmidi.h"
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c1b26fcc0b5c..ca699a3017f3 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -240,6 +240,7 @@ int snd_soc_dapm_sys_add(struct device *dev);
240/* dapm audio pin control and status */ 240/* dapm audio pin control and status */
241int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin); 241int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin);
242int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin); 242int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin);
243int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin);
243int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin); 244int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin);
244int snd_soc_dapm_sync(struct snd_soc_codec *codec); 245int snd_soc_dapm_sync(struct snd_soc_codec *codec);
245 246
diff --git a/include/sound/soc-of-simple.h b/include/sound/soc-of-simple.h
new file mode 100644
index 000000000000..a064e1934a56
--- /dev/null
+++ b/include/sound/soc-of-simple.h
@@ -0,0 +1,25 @@
1/*
2 * OF helpers for ALSA SoC
3 *
4 * Copyright (C) 2008, Secret Lab Technologies Ltd.
5 */
6
7#ifndef _INCLUDE_SOC_OF_H_
8#define _INCLUDE_SOC_OF_H_
9
10#if defined(CONFIG_SND_SOC_OF_SIMPLE) || defined(CONFIG_SND_SOC_OF_SIMPLE_MODULE)
11
12#include <linux/of.h>
13#include <sound/soc.h>
14
15int of_snd_soc_register_codec(struct snd_soc_codec_device *codec_dev,
16 void *codec_data, struct snd_soc_dai *dai,
17 struct device_node *node);
18
19int of_snd_soc_register_platform(struct snd_soc_platform *platform,
20 struct device_node *node,
21 struct snd_soc_dai *cpu_dai);
22
23#endif
24
25#endif /* _INCLUDE_SOC_OF_H_ */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1890d87c5204..a1e0357a84d7 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -26,10 +26,12 @@
26/* 26/*
27 * Convenience kcontrol builders 27 * Convenience kcontrol builders
28 */ 28 */
29#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\ 29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30 ((shift) << 12) | ((max) << 16) | ((invert) << 24)) 30 ((unsigned long)&(struct soc_mixer_control) \
31#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\ 31 {.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert})
32 ((invert) << 31)) 32#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
33 ((unsigned long)&(struct soc_mixer_control) \
34 {.reg = xreg, .max = xmax, .invert = xinvert})
33#define SOC_SINGLE(xname, reg, shift, max, invert) \ 35#define SOC_SINGLE(xname, reg, shift, max, invert) \
34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 36{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 37 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
@@ -43,64 +45,68 @@
43 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 45 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
44 .put = snd_soc_put_volsw, \ 46 .put = snd_soc_put_volsw, \
45 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 47 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
46#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 48#define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
47{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 49{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
48 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 50 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
49 .put = snd_soc_put_volsw, \ 51 .put = snd_soc_put_volsw, \
50 .private_value = (reg) | ((shift_left) << 8) | \ 52 .private_value = (unsigned long)&(struct soc_mixer_control) \
51 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } 53 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
52#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \ 54 .max = xmax, .invert = xinvert} }
55#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
53{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 56{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
54 .info = snd_soc_info_volsw_2r, \ 57 .info = snd_soc_info_volsw_2r, \
55 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 58 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
56 .private_value = (reg_left) | ((shift) << 8) | \ 59 .private_value = (unsigned long)&(struct soc_mixer_control) \
57 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } 60 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
58#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ 61 .max = xmax, .invert = xinvert} }
62#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 63{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 64 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
61 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 65 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
62 .tlv.p = (tlv_array), \ 66 .tlv.p = (tlv_array), \
63 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 67 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
64 .put = snd_soc_put_volsw, \ 68 .put = snd_soc_put_volsw, \
65 .private_value = (reg) | ((shift_left) << 8) | \ 69 .private_value = (unsigned long)&(struct soc_mixer_control) \
66 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } 70 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
67#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ 71 .max = xmax, .invert = xinvert} }
72#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
68{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 73{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
69 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 74 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
70 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 75 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
71 .tlv.p = (tlv_array), \ 76 .tlv.p = (tlv_array), \
72 .info = snd_soc_info_volsw_2r, \ 77 .info = snd_soc_info_volsw_2r, \
73 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 78 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
74 .private_value = (reg_left) | ((shift) << 8) | \ 79 .private_value = (unsigned long)&(struct soc_mixer_control) \
75 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } 80 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
76#define SOC_DOUBLE_S8_TLV(xname, reg, min, max, tlv_array) \ 81 .max = xmax, .invert = xinvert} }
82#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
77{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 83{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
78 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 84 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
79 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 85 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
80 .tlv.p = (tlv_array), \ 86 .tlv.p = (tlv_array), \
81 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 87 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
82 .put = snd_soc_put_volsw_s8, \ 88 .put = snd_soc_put_volsw_s8, \
83 .private_value = (reg) | (((signed char)max) << 16) | \ 89 .private_value = (unsigned long)&(struct soc_mixer_control) \
84 (((signed char)min) << 24) } 90 {.reg = xreg, .min = xmin, .max = xmax} }
85#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 91#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
86{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 92{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
87 .mask = xmask, .texts = xtexts } 93 .max = xmax, .texts = xtexts }
88#define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \ 94#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
89 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts) 95 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
90#define SOC_ENUM_SINGLE_EXT(xmask, xtexts) \ 96#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
91{ .mask = xmask, .texts = xtexts } 97{ .max = xmax, .texts = xtexts }
92#define SOC_ENUM(xname, xenum) \ 98#define SOC_ENUM(xname, xenum) \
93{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
94 .info = snd_soc_info_enum_double, \ 100 .info = snd_soc_info_enum_double, \
95 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 101 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
96 .private_value = (unsigned long)&xenum } 102 .private_value = (unsigned long)&xenum }
97#define SOC_SINGLE_EXT(xname, xreg, xshift, xmask, xinvert,\ 103#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
98 xhandler_get, xhandler_put) \ 104 xhandler_get, xhandler_put) \
99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
100 .info = snd_soc_info_volsw, \ 106 .info = snd_soc_info_volsw, \
101 .get = xhandler_get, .put = xhandler_put, \ 107 .get = xhandler_get, .put = xhandler_put, \
102 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 108 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
103#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmask, xinvert,\ 109#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
104 xhandler_get, xhandler_put, tlv_array) \ 110 xhandler_get, xhandler_put, tlv_array) \
105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 111{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
106 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 112 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -108,7 +114,7 @@
108 .tlv.p = (tlv_array), \ 114 .tlv.p = (tlv_array), \
109 .info = snd_soc_info_volsw, \ 115 .info = snd_soc_info_volsw, \
110 .get = xhandler_get, .put = xhandler_put, \ 116 .get = xhandler_get, .put = xhandler_put, \
111 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 117 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
112#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 118#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 119{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
114 .info = snd_soc_info_bool_ext, \ 120 .info = snd_soc_info_bool_ext, \
@@ -410,6 +416,8 @@ struct snd_soc_codec {
410 void *control_data; /* codec control (i2c/3wire) data */ 416 void *control_data; /* codec control (i2c/3wire) data */
411 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 417 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
412 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 418 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
419 int (*display_register)(struct snd_soc_codec *, char *,
420 size_t, unsigned int);
413 hw_write_t hw_write; 421 hw_write_t hw_write;
414 hw_read_t hw_read; 422 hw_read_t hw_read;
415 void *reg_cache; 423 void *reg_cache;
@@ -516,13 +524,19 @@ struct snd_soc_pcm_runtime {
516 struct snd_soc_device *socdev; 524 struct snd_soc_device *socdev;
517}; 525};
518 526
527/* mixer control */
528struct soc_mixer_control {
529 int min, max;
530 unsigned int reg, rreg, shift, rshift, invert;
531};
532
519/* enumerated kcontrol */ 533/* enumerated kcontrol */
520struct soc_enum { 534struct soc_enum {
521 unsigned short reg; 535 unsigned short reg;
522 unsigned short reg2; 536 unsigned short reg2;
523 unsigned char shift_l; 537 unsigned char shift_l;
524 unsigned char shift_r; 538 unsigned char shift_r;
525 unsigned int mask; 539 unsigned int max;
526 const char **texts; 540 const char **texts;
527 void *dapm; 541 void *dapm;
528}; 542};
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index b62ce3e077f9..b6870cbaf2b3 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -43,6 +43,7 @@ struct snd_tea575x {
43 unsigned int freq_fixup; /* crystal onboard */ 43 unsigned int freq_fixup; /* crystal onboard */
44 unsigned int val; /* hw value */ 44 unsigned int val; /* hw value */
45 unsigned long freq; /* frequency */ 45 unsigned long freq; /* frequency */
46 unsigned long in_use; /* set if the device is in use */
46 struct snd_tea575x_ops *ops; 47 struct snd_tea575x_ops *ops;
47 void *private_data; 48 void *private_data;
48}; 49};
diff --git a/include/sound/version.h b/include/sound/version.h
index 6b78aff273a8..4aafeda88634 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.17" 2#define CONFIG_SND_VERSION "1.0.18rc3"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 4830651cc4cf..5456343ebe4c 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -235,37 +235,31 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev);
235 */ 235 */
236static inline int vx_test_and_ack(struct vx_core *chip) 236static inline int vx_test_and_ack(struct vx_core *chip)
237{ 237{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 238 return chip->ops->test_and_ack(chip);
240} 239}
241 240
242static inline void vx_validate_irq(struct vx_core *chip, int enable) 241static inline void vx_validate_irq(struct vx_core *chip, int enable)
243{ 242{
244 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 243 chip->ops->validate_irq(chip, enable);
246} 244}
247 245
248static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg) 246static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg)
249{ 247{
250 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 248 return chip->ops->in8(chip, reg);
252} 249}
253 250
254static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg) 251static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg)
255{ 252{
256 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 253 return chip->ops->in32(chip, reg);
258} 254}
259 255
260static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val) 256static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val)
261{ 257{
262 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 258 chip->ops->out8(chip, reg, val);
264} 259}
265 260
266static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val) 261static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
267{ 262{
268 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 263 chip->ops->out32(chip, reg, val);
270} 264}
271 265
@@ -276,7 +270,6 @@ static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
276 270
277static inline void vx_reset_dsp(struct vx_core *chip) 271static inline void vx_reset_dsp(struct vx_core *chip)
278{ 272{
279 snd_assert(chip->ops->reset_dsp, return);
280 chip->ops->reset_dsp(chip); 273 chip->ops->reset_dsp(chip);
281} 274}
282 275
@@ -304,14 +297,12 @@ int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int t
304static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, 297static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
305 struct vx_pipe *pipe, int count) 298 struct vx_pipe *pipe, int count)
306{ 299{
307 snd_assert(chip->ops->dma_write, return);
308 chip->ops->dma_write(chip, runtime, pipe, count); 300 chip->ops->dma_write(chip, runtime, pipe, count);
309} 301}
310 302
311static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, 303static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
312 struct vx_pipe *pipe, int count) 304 struct vx_pipe *pipe, int count)
313{ 305{
314 snd_assert(chip->ops->dma_read, return);
315 chip->ops->dma_read(chip, runtime, pipe, count); 306 chip->ops->dma_read(chip, runtime, pipe, count);
316} 307}
317 308
diff --git a/include/sound/wss.h b/include/sound/wss.h
new file mode 100644
index 000000000000..fd01f22825cd
--- /dev/null
+++ b/include/sound/wss.h
@@ -0,0 +1,235 @@
1#ifndef __SOUND_WSS_H
2#define __SOUND_WSS_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for CS4231 & InterWave chips & compatible chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "control.h"
26#include "pcm.h"
27#include "timer.h"
28
29#include "cs4231-regs.h"
30
31/* defines for codec.mode */
32
33#define WSS_MODE_NONE 0x0000
34#define WSS_MODE_PLAY 0x0001
35#define WSS_MODE_RECORD 0x0002
36#define WSS_MODE_TIMER 0x0004
37#define WSS_MODE_OPEN (WSS_MODE_PLAY|WSS_MODE_RECORD|WSS_MODE_TIMER)
38
39/* defines for codec.hardware */
40
41#define WSS_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
42#define WSS_HW_DETECT3 0x0001 /* allow mode 3 */
43#define WSS_HW_TYPE_MASK 0xff00 /* type mask */
44#define WSS_HW_CS4231_MASK 0x0100 /* CS4231 serie */
45#define WSS_HW_CS4231 0x0100 /* CS4231 chip */
46#define WSS_HW_CS4231A 0x0101 /* CS4231A chip */
47#define WSS_HW_AD1845 0x0102 /* AD1845 chip */
48#define WSS_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
49#define WSS_HW_CS4232 0x0200 /* CS4232 */
50#define WSS_HW_CS4232A 0x0201 /* CS4232A */
51#define WSS_HW_CS4236 0x0202 /* CS4236 */
52#define WSS_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
53#define WSS_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
54#define WSS_HW_CS4236B 0x0401 /* CS4236B */
55#define WSS_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
56#define WSS_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
57#define WSS_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
58#define WSS_HW_AD1848_MASK 0x0800 /* AD1848 serie (half duplex) */
59#define WSS_HW_AD1847 0x0801 /* AD1847 chip */
60#define WSS_HW_AD1848 0x0802 /* AD1848 chip */
61#define WSS_HW_CS4248 0x0803 /* CS4248 chip */
62#define WSS_HW_CMI8330 0x0804 /* CMI8330 chip */
63#define WSS_HW_THINKPAD 0x0805 /* Thinkpad 360/750/755 */
64/* compatible, but clones */
65#define WSS_HW_INTERWAVE 0x1000 /* InterWave chip */
66#define WSS_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
67#define WSS_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
68
69/* defines for codec.hwshare */
70#define WSS_HWSHARE_IRQ (1<<0)
71#define WSS_HWSHARE_DMA1 (1<<1)
72#define WSS_HWSHARE_DMA2 (1<<2)
73
74/* IBM Thinkpad specific stuff */
75#define AD1848_THINKPAD_CTL_PORT1 0x15e8
76#define AD1848_THINKPAD_CTL_PORT2 0x15e9
77#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
78
79struct snd_wss {
80 unsigned long port; /* base i/o port */
81 struct resource *res_port;
82 unsigned long cport; /* control base i/o port (CS4236) */
83 struct resource *res_cport;
84 int irq; /* IRQ line */
85 int dma1; /* playback DMA */
86 int dma2; /* record DMA */
87 unsigned short version; /* version of CODEC chip */
88 unsigned short mode; /* see to WSS_MODE_XXXX */
89 unsigned short hardware; /* see to WSS_HW_XXXX */
90 unsigned short hwshare; /* shared resources */
91 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit */
92 /* daughter board) or dma1 == dma2 */
93 ebus_flag:1, /* SPARC: EBUS present */
94 thinkpad_flag:1; /* Thinkpad CS4248 needs extra help */
95
96 struct snd_card *card;
97 struct snd_pcm *pcm;
98 struct snd_pcm_substream *playback_substream;
99 struct snd_pcm_substream *capture_substream;
100 struct snd_timer *timer;
101
102 unsigned char image[32]; /* registers image */
103 unsigned char eimage[32]; /* extended registers image */
104 unsigned char cimage[16]; /* control registers image */
105 int mce_bit;
106 int calibrate_mute;
107 int sw_3d_bit;
108 unsigned int p_dma_size;
109 unsigned int c_dma_size;
110
111 spinlock_t reg_lock;
112 struct mutex mce_mutex;
113 struct mutex open_mutex;
114
115 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
116 void (*set_playback_format) (struct snd_wss *chip,
117 struct snd_pcm_hw_params *hw_params,
118 unsigned char pdfr);
119 void (*set_capture_format) (struct snd_wss *chip,
120 struct snd_pcm_hw_params *hw_params,
121 unsigned char cdfr);
122 void (*trigger) (struct snd_wss *chip, unsigned int what, int start);
123#ifdef CONFIG_PM
124 void (*suspend) (struct snd_wss *chip);
125 void (*resume) (struct snd_wss *chip);
126#endif
127 void *dma_private_data;
128 int (*claim_dma) (struct snd_wss *chip,
129 void *dma_private_data, int dma);
130 int (*release_dma) (struct snd_wss *chip,
131 void *dma_private_data, int dma);
132};
133
134/* exported functions */
135
136void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char val);
137unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg);
138void snd_cs4236_ext_out(struct snd_wss *chip,
139 unsigned char reg, unsigned char val);
140unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg);
141void snd_wss_mce_up(struct snd_wss *chip);
142void snd_wss_mce_down(struct snd_wss *chip);
143
144void snd_wss_overrange(struct snd_wss *chip);
145
146irqreturn_t snd_wss_interrupt(int irq, void *dev_id);
147
148const char *snd_wss_chip_id(struct snd_wss *chip);
149
150int snd_wss_create(struct snd_card *card,
151 unsigned long port,
152 unsigned long cport,
153 int irq, int dma1, int dma2,
154 unsigned short hardware,
155 unsigned short hwshare,
156 struct snd_wss **rchip);
157int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
158int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
159int snd_wss_mixer(struct snd_wss *chip);
160
161const struct snd_pcm_ops *snd_wss_get_pcm_ops(int direction);
162
163int snd_cs4236_create(struct snd_card *card,
164 unsigned long port,
165 unsigned long cport,
166 int irq, int dma1, int dma2,
167 unsigned short hardware,
168 unsigned short hwshare,
169 struct snd_wss **rchip);
170int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
171int snd_cs4236_mixer(struct snd_wss *chip);
172
173/*
174 * mixer library
175 */
176
177#define WSS_SINGLE(xname, xindex, reg, shift, mask, invert) \
178{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
179 .name = xname, \
180 .index = xindex, \
181 .info = snd_wss_info_single, \
182 .get = snd_wss_get_single, \
183 .put = snd_wss_put_single, \
184 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
185
186int snd_wss_info_single(struct snd_kcontrol *kcontrol,
187 struct snd_ctl_elem_info *uinfo);
188int snd_wss_get_single(struct snd_kcontrol *kcontrol,
189 struct snd_ctl_elem_value *ucontrol);
190int snd_wss_put_single(struct snd_kcontrol *kcontrol,
191 struct snd_ctl_elem_value *ucontrol);
192
193#define WSS_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
194{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
195 .name = xname, \
196 .index = xindex, \
197 .info = snd_wss_info_double, \
198 .get = snd_wss_get_double, \
199 .put = snd_wss_put_double, \
200 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \
201 (shift_right << 19) | (mask << 24) | (invert << 22) }
202
203#define WSS_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
204{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
205 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
206 .name = xname, \
207 .index = xindex, \
208 .info = snd_wss_info_single, \
209 .get = snd_wss_get_single, \
210 .put = snd_wss_put_single, \
211 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \
212 .tlv = { .p = (xtlv) } }
213
214#define WSS_DOUBLE_TLV(xname, xindex, left_reg, right_reg, \
215 shift_left, shift_right, mask, invert, xtlv) \
216{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
217 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
218 .name = xname, \
219 .index = xindex, \
220 .info = snd_wss_info_double, \
221 .get = snd_wss_get_double, \
222 .put = snd_wss_put_double, \
223 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \
224 (shift_right << 19) | (mask << 24) | (invert << 22), \
225 .tlv = { .p = (xtlv) } }
226
227
228int snd_wss_info_double(struct snd_kcontrol *kcontrol,
229 struct snd_ctl_elem_info *uinfo);
230int snd_wss_get_double(struct snd_kcontrol *kcontrol,
231 struct snd_ctl_elem_value *ucontrol);
232int snd_wss_put_double(struct snd_kcontrol *kcontrol,
233 struct snd_ctl_elem_value *ucontrol);
234
235#endif /* __SOUND_WSS_H */
diff --git a/include/trace/sched.h b/include/trace/sched.h
new file mode 100644
index 000000000000..ad47369d01b5
--- /dev/null
+++ b/include/trace/sched.h
@@ -0,0 +1,56 @@
1#ifndef _TRACE_SCHED_H
2#define _TRACE_SCHED_H
3
4#include <linux/sched.h>
5#include <linux/tracepoint.h>
6
7DEFINE_TRACE(sched_kthread_stop,
8 TPPROTO(struct task_struct *t),
9 TPARGS(t));
10
11DEFINE_TRACE(sched_kthread_stop_ret,
12 TPPROTO(int ret),
13 TPARGS(ret));
14
15DEFINE_TRACE(sched_wait_task,
16 TPPROTO(struct rq *rq, struct task_struct *p),
17 TPARGS(rq, p));
18
19DEFINE_TRACE(sched_wakeup,
20 TPPROTO(struct rq *rq, struct task_struct *p),
21 TPARGS(rq, p));
22
23DEFINE_TRACE(sched_wakeup_new,
24 TPPROTO(struct rq *rq, struct task_struct *p),
25 TPARGS(rq, p));
26
27DEFINE_TRACE(sched_switch,
28 TPPROTO(struct rq *rq, struct task_struct *prev,
29 struct task_struct *next),
30 TPARGS(rq, prev, next));
31
32DEFINE_TRACE(sched_migrate_task,
33 TPPROTO(struct rq *rq, struct task_struct *p, int dest_cpu),
34 TPARGS(rq, p, dest_cpu));
35
36DEFINE_TRACE(sched_process_free,
37 TPPROTO(struct task_struct *p),
38 TPARGS(p));
39
40DEFINE_TRACE(sched_process_exit,
41 TPPROTO(struct task_struct *p),
42 TPARGS(p));
43
44DEFINE_TRACE(sched_process_wait,
45 TPPROTO(struct pid *pid),
46 TPARGS(pid));
47
48DEFINE_TRACE(sched_process_fork,
49 TPPROTO(struct task_struct *parent, struct task_struct *child),
50 TPARGS(parent, child));
51
52DEFINE_TRACE(sched_signal_send,
53 TPPROTO(int sig, struct task_struct *p),
54 TPARGS(sig, p));
55
56#endif
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 920c4e9cb93d..6ad87f485992 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -30,6 +30,7 @@
30 */ 30 */
31#define ATMEL_LCDC_WIRING_BGR 0 31#define ATMEL_LCDC_WIRING_BGR 0
32#define ATMEL_LCDC_WIRING_RGB 1 32#define ATMEL_LCDC_WIRING_RGB 1
33#define ATMEL_LCDC_WIRING_RGB555 2
33 34
34 35
35 /* LCD Controller info data structure, stored in device platform_data */ 36 /* LCD Controller info data structure, stored in device platform_data */
diff --git a/include/video/cyblafb.h b/include/video/cyblafb.h
index 717440575380..d3c1d4e2c8e3 100644
--- a/include/video/cyblafb.h
+++ b/include/video/cyblafb.h
@@ -4,7 +4,7 @@
4#endif 4#endif
5 5
6#if CYBLAFB_DEBUG 6#if CYBLAFB_DEBUG
7#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a); 7#define debug(f,a...) printk("%s:" f, __func__ , ## a);
8#else 8#else
9#define debug(f,a...) 9#define debug(f,a...)
10#endif 10#endif
diff --git a/include/video/metronomefb.h b/include/video/metronomefb.h
index dab04b4fad7f..9863f4b6d418 100644
--- a/include/video/metronomefb.h
+++ b/include/video/metronomefb.h
@@ -12,14 +12,6 @@
12#ifndef _LINUX_METRONOMEFB_H_ 12#ifndef _LINUX_METRONOMEFB_H_
13#define _LINUX_METRONOMEFB_H_ 13#define _LINUX_METRONOMEFB_H_
14 14
15/* address and control descriptors used by metronome controller */
16struct metromem_desc {
17 u32 mFDADR0;
18 u32 mFSADR0;
19 u32 mFIDR0;
20 u32 mLDCMD0;
21};
22
23/* command structure used by metronome controller */ 15/* command structure used by metronome controller */
24struct metromem_cmd { 16struct metromem_cmd {
25 u16 opcode; 17 u16 opcode;
@@ -29,34 +21,37 @@ struct metromem_cmd {
29 21
30/* struct used by metronome. board specific stuff comes from *board */ 22/* struct used by metronome. board specific stuff comes from *board */
31struct metronomefb_par { 23struct metronomefb_par {
32 unsigned char *metromem;
33 struct metromem_desc *metromem_desc;
34 struct metromem_cmd *metromem_cmd; 24 struct metromem_cmd *metromem_cmd;
35 unsigned char *metromem_wfm; 25 unsigned char *metromem_wfm;
36 unsigned char *metromem_img; 26 unsigned char *metromem_img;
37 u16 *metromem_img_csum; 27 u16 *metromem_img_csum;
38 u16 *csum_table; 28 u16 *csum_table;
39 int metromemsize;
40 dma_addr_t metromem_dma; 29 dma_addr_t metromem_dma;
41 dma_addr_t metromem_desc_dma;
42 struct fb_info *info; 30 struct fb_info *info;
43 struct metronome_board *board; 31 struct metronome_board *board;
44 wait_queue_head_t waitq; 32 wait_queue_head_t waitq;
45 u8 frame_count; 33 u8 frame_count;
34 int extra_size;
35 int dt;
46}; 36};
47 37
48/* board specific routines */ 38/* board specific routines and data */
49struct metronome_board { 39struct metronome_board {
50 struct module *owner; 40 struct module *owner; /* the platform device */
51 void (*free_irq)(struct fb_info *);
52 void (*init_gpio_regs)(struct metronomefb_par *);
53 void (*init_lcdc_regs)(struct metronomefb_par *);
54 void (*post_dma_setup)(struct metronomefb_par *);
55 void (*set_rst)(struct metronomefb_par *, int); 41 void (*set_rst)(struct metronomefb_par *, int);
56 void (*set_stdby)(struct metronomefb_par *, int); 42 void (*set_stdby)(struct metronomefb_par *, int);
43 void (*cleanup)(struct metronomefb_par *);
57 int (*met_wait_event)(struct metronomefb_par *); 44 int (*met_wait_event)(struct metronomefb_par *);
58 int (*met_wait_event_intr)(struct metronomefb_par *); 45 int (*met_wait_event_intr)(struct metronomefb_par *);
59 int (*setup_irq)(struct fb_info *); 46 int (*setup_irq)(struct fb_info *);
47 int (*setup_fb)(struct metronomefb_par *);
48 int (*setup_io)(struct metronomefb_par *);
49 int (*get_panel_type)(void);
50 unsigned char *metromem;
51 int fw;
52 int fh;
53 int wfm_size;
54 struct fb_info *host_fbinfo; /* the host LCD controller's fbi */
60}; 55};
61 56
62#endif 57#endif
diff --git a/include/video/neomagic.h b/include/video/neomagic.h
index 38910da0ae59..08b663782956 100644
--- a/include/video/neomagic.h
+++ b/include/video/neomagic.h
@@ -123,7 +123,6 @@ typedef volatile struct {
123 123
124struct neofb_par { 124struct neofb_par {
125 struct vgastate state; 125 struct vgastate state;
126 struct mutex open_lock;
127 unsigned int ref_count; 126 unsigned int ref_count;
128 127
129 unsigned char MiscOutReg; /* Misc */ 128 unsigned char MiscOutReg; /* Misc */
diff --git a/include/video/radeon.h b/include/video/radeon.h
index 099ffa5e5bee..d5dcaf154ba4 100644
--- a/include/video/radeon.h
+++ b/include/video/radeon.h
@@ -386,7 +386,7 @@
386#define SC_BOTTOM_RIGHT 0x16F0 386#define SC_BOTTOM_RIGHT 0x16F0
387#define SRC_SC_BOTTOM_RIGHT 0x16F4 387#define SRC_SC_BOTTOM_RIGHT 0x16F4
388#define RB2D_DSTCACHE_MODE 0x3428 388#define RB2D_DSTCACHE_MODE 0x3428
389#define RB2D_DSTCACHE_CTLSTAT 0x342C 389#define RB2D_DSTCACHE_CTLSTAT_broken 0x342C /* do not use */
390#define LVDS_GEN_CNTL 0x02d0 390#define LVDS_GEN_CNTL 0x02d0
391#define LVDS_PLL_CNTL 0x02d4 391#define LVDS_PLL_CNTL 0x02d4
392#define FP2_GEN_CNTL 0x0288 392#define FP2_GEN_CNTL 0x0288
@@ -525,6 +525,9 @@
525#define CRTC_DISPLAY_DIS (1 << 10) 525#define CRTC_DISPLAY_DIS (1 << 10)
526#define CRTC_CRT_ON (1 << 15) 526#define CRTC_CRT_ON (1 << 15)
527 527
528/* DSTCACHE_MODE bits constants */
529#define RB2D_DC_AUTOFLUSH_ENABLE (1 << 8)
530#define RB2D_DC_DC_DISABLE_IGNORE_PE (1 << 17)
528 531
529/* DSTCACHE_CTLSTAT bit constants */ 532/* DSTCACHE_CTLSTAT bit constants */
530#define RB2D_DC_FLUSH_2D (1 << 0) 533#define RB2D_DC_FLUSH_2D (1 << 0)
@@ -532,6 +535,9 @@
532#define RB2D_DC_FLUSH_ALL (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D) 535#define RB2D_DC_FLUSH_ALL (RB2D_DC_FLUSH_2D | RB2D_DC_FREE_2D)
533#define RB2D_DC_BUSY (1 << 31) 536#define RB2D_DC_BUSY (1 << 31)
534 537
538/* DSTCACHE_MODE bits constants */
539#define RB2D_DC_AUTOFLUSH_ENABLE (1 << 8)
540#define RB2D_DC_DC_DISABLE_IGNORE_PE (1 << 17)
535 541
536/* CRTC_GEN_CNTL bit constants */ 542/* CRTC_GEN_CNTL bit constants */
537#define CRTC_DBL_SCAN_EN 0x00000001 543#define CRTC_DBL_SCAN_EN 0x00000001
@@ -863,15 +869,10 @@
863#define GMC_DST_16BPP_YVYU422 0x00000c00 869#define GMC_DST_16BPP_YVYU422 0x00000c00
864#define GMC_DST_32BPP_AYUV444 0x00000e00 870#define GMC_DST_32BPP_AYUV444 0x00000e00
865#define GMC_DST_16BPP_ARGB4444 0x00000f00 871#define GMC_DST_16BPP_ARGB4444 0x00000f00
866#define GMC_SRC_MONO 0x00000000
867#define GMC_SRC_MONO_LBKGD 0x00001000
868#define GMC_SRC_DSTCOLOR 0x00003000
869#define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000 872#define GMC_BYTE_ORDER_MSB_TO_LSB 0x00000000
870#define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000 873#define GMC_BYTE_ORDER_LSB_TO_MSB 0x00004000
871#define GMC_DP_CONVERSION_TEMP_9300 0x00008000 874#define GMC_DP_CONVERSION_TEMP_9300 0x00008000
872#define GMC_DP_CONVERSION_TEMP_6500 0x00000000 875#define GMC_DP_CONVERSION_TEMP_6500 0x00000000
873#define GMC_DP_SRC_RECT 0x02000000
874#define GMC_DP_SRC_HOST 0x03000000
875#define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000 876#define GMC_DP_SRC_HOST_BYTEALIGN 0x04000000
876#define GMC_3D_FCN_EN_CLR 0x00000000 877#define GMC_3D_FCN_EN_CLR 0x00000000
877#define GMC_3D_FCN_EN_SET 0x08000000 878#define GMC_3D_FCN_EN_SET 0x08000000
@@ -882,6 +883,9 @@
882#define GMC_WRITE_MASK_LEAVE 0x00000000 883#define GMC_WRITE_MASK_LEAVE 0x00000000
883#define GMC_WRITE_MASK_SET 0x40000000 884#define GMC_WRITE_MASK_SET 0x40000000
884#define GMC_CLR_CMP_CNTL_DIS (1 << 28) 885#define GMC_CLR_CMP_CNTL_DIS (1 << 28)
886#define GMC_SRC_DATATYPE_MASK (3 << 12)
887#define GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12)
888#define GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12)
885#define GMC_SRC_DATATYPE_COLOR (3 << 12) 889#define GMC_SRC_DATATYPE_COLOR (3 << 12)
886#define ROP3_S 0x00cc0000 890#define ROP3_S 0x00cc0000
887#define ROP3_SRCCOPY 0x00cc0000 891#define ROP3_SRCCOPY 0x00cc0000
@@ -890,6 +894,7 @@
890#define DP_SRC_SOURCE_MASK (7 << 24) 894#define DP_SRC_SOURCE_MASK (7 << 24)
891#define GMC_BRUSH_NONE (15 << 4) 895#define GMC_BRUSH_NONE (15 << 4)
892#define DP_SRC_SOURCE_MEMORY (2 << 24) 896#define DP_SRC_SOURCE_MEMORY (2 << 24)
897#define DP_SRC_SOURCE_HOST_DATA (3 << 24)
893#define GMC_BRUSH_SOLIDCOLOR 0x000000d0 898#define GMC_BRUSH_SOLIDCOLOR 0x000000d0
894 899
895/* DP_MIX bit constants */ 900/* DP_MIX bit constants */
@@ -975,6 +980,12 @@
975#define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25) 980#define DISP_PWR_MAN_TV_ENABLE_RST (1 << 25)
976#define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26) 981#define DISP_PWR_MAN_AUTO_PWRUP_EN (1 << 26)
977 982
983/* RBBM_GUICNTL constants */
984#define RBBM_GUICNTL_HOST_DATA_SWAP_NONE (0 << 0)
985#define RBBM_GUICNTL_HOST_DATA_SWAP_16BIT (1 << 0)
986#define RBBM_GUICNTL_HOST_DATA_SWAP_32BIT (2 << 0)
987#define RBBM_GUICNTL_HOST_DATA_SWAP_HDW (3 << 0)
988
978/* masks */ 989/* masks */
979 990
980#define CONFIG_MEMSIZE_MASK 0x1f000000 991#define CONFIG_MEMSIZE_MASK 0x1f000000
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index c99d261df8f7..fe41b8407946 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -14,7 +14,8 @@
14#define S1D13XXXFB_H 14#define S1D13XXXFB_H
15 15
16#define S1D_PALETTE_SIZE 256 16#define S1D_PALETTE_SIZE 256
17#define S1D_CHIP_REV 7 /* expected chip revision number for s1d13806 */ 17#define S1D13506_CHIP_REV 4 /* expected chip revision number for s1d13506 */
18#define S1D13806_CHIP_REV 7 /* expected chip revision number for s1d13806 */
18#define S1D_FBID "S1D13806" 19#define S1D_FBID "S1D13806"
19#define S1D_DEVICENAME "s1d13806fb" 20#define S1D_DEVICENAME "s1d13806fb"
20 21
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
new file mode 100644
index 000000000000..1a4bc6ada606
--- /dev/null
+++ b/include/video/sh_mobile_lcdc.h
@@ -0,0 +1,78 @@
1#ifndef __ASM_SH_MOBILE_LCDC_H__
2#define __ASM_SH_MOBILE_LCDC_H__
3
4#include <linux/fb.h>
5
6enum { RGB8, /* 24bpp, 8:8:8 */
7 RGB9, /* 18bpp, 9:9 */
8 RGB12A, /* 24bpp, 12:12 */
9 RGB12B, /* 12bpp */
10 RGB16, /* 16bpp */
11 RGB18, /* 18bpp */
12 RGB24, /* 24bpp */
13 SYS8A, /* 24bpp, 8:8:8 */
14 SYS8B, /* 18bpp, 8:8:2 */
15 SYS8C, /* 18bpp, 2:8:8 */
16 SYS8D, /* 16bpp, 8:8 */
17 SYS9, /* 18bpp, 9:9 */
18 SYS12, /* 24bpp, 12:12 */
19 SYS16A, /* 16bpp */
20 SYS16B, /* 18bpp, 16:2 */
21 SYS16C, /* 18bpp, 2:16 */
22 SYS18, /* 18bpp */
23 SYS24 };/* 24bpp */
24
25enum { LCDC_CHAN_DISABLED = 0,
26 LCDC_CHAN_MAINLCD,
27 LCDC_CHAN_SUBLCD };
28
29enum { LCDC_CLK_BUS, LCDC_CLK_PERIPHERAL, LCDC_CLK_EXTERNAL };
30
31#define LCDC_FLAGS_DWPOL (1 << 0) /* Rising edge dot clock data latch */
32#define LCDC_FLAGS_DIPOL (1 << 1) /* Active low display enable polarity */
33#define LCDC_FLAGS_DAPOL (1 << 2) /* Active low display data polarity */
34#define LCDC_FLAGS_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
35#define LCDC_FLAGS_DWCNT (1 << 4) /* Disable dotclock during blanking */
36
37struct sh_mobile_lcdc_sys_bus_cfg {
38 unsigned long ldmt2r;
39 unsigned long ldmt3r;
40};
41
42struct sh_mobile_lcdc_sys_bus_ops {
43 void (*write_index)(void *handle, unsigned long data);
44 void (*write_data)(void *handle, unsigned long data);
45 unsigned long (*read_data)(void *handle);
46};
47
48struct sh_mobile_lcdc_board_cfg {
49 void *board_data;
50 int (*setup_sys)(void *board_data, void *sys_ops_handle,
51 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
52 void (*display_on)(void *board_data);
53 void (*display_off)(void *board_data);
54};
55
56struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
57 unsigned long width;
58 unsigned long height;
59};
60
61struct sh_mobile_lcdc_chan_cfg {
62 int chan;
63 int bpp;
64 int interface_type; /* selects RGBn or SYSn I/F, see above */
65 int clock_divider;
66 unsigned long flags; /* LCDC_FLAGS_... */
67 struct fb_videomode lcd_cfg;
68 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
69 struct sh_mobile_lcdc_board_cfg board_cfg;
70 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
71};
72
73struct sh_mobile_lcdc_info {
74 int clock_source;
75 struct sh_mobile_lcdc_chan_cfg ch[2];
76};
77
78#endif /* __ASM_SH_MOBILE_LCDC_H__ */
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
deleted file mode 100644
index fe43b0f3c86a..000000000000
--- a/include/xen/balloon.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/******************************************************************************
2 * balloon.h
3 *
4 * Xen balloon driver - enables returning/claiming memory to/from Xen.
5 *
6 * Copyright (c) 2003, B Dragovic
7 * Copyright (c) 2003-2004, M Williamson, K Fraser
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation; or, when distributed
12 * separately from the Linux kernel or incorporated into other
13 * software packages, subject to the following license:
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this source file (the "Software"), to deal in the Software without
17 * restriction, including without limitation the rights to use, copy, modify,
18 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
19 * and to permit persons to whom the Software is furnished to do so, subject to
20 * the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
31 * IN THE SOFTWARE.
32 */
33
34#ifndef __XEN_BALLOON_H__
35#define __XEN_BALLOON_H__
36
37#include <linux/spinlock.h>
38
39#if 0
40/*
41 * Inform the balloon driver that it should allow some slop for device-driver
42 * memory activities.
43 */
44void balloon_update_driver_allowance(long delta);
45
46/* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */
47struct page **alloc_empty_pages_and_pagevec(int nr_pages);
48void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
49
50void balloon_release_driver_page(struct page *page);
51
52/*
53 * Prevent the balloon driver from changing the memory reservation during
54 * a driver critical region.
55 */
56extern spinlock_t balloon_lock;
57#define balloon_lock(__flags) spin_lock_irqsave(&balloon_lock, __flags)
58#define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags)
59#endif
60
61#endif /* __XEN_BALLOON_H__ */
diff --git a/include/xen/events.h b/include/xen/events.h
index 4680ff3fbc91..0d5f1adc0363 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -46,6 +46,8 @@ extern void xen_irq_resume(void);
46 46
47/* Clear an irq's pending state, in preparation for polling on it */ 47/* Clear an irq's pending state, in preparation for polling on it */
48void xen_clear_irq_pending(int irq); 48void xen_clear_irq_pending(int irq);
49void xen_set_irq_pending(int irq);
50bool xen_test_irq_pending(int irq);
49 51
50/* Poll waiting for an irq to become pending. In the usual case, the 52/* Poll waiting for an irq to become pending. In the usual case, the
51 irq will be disabled so it won't deliver an interrupt. */ 53 irq will be disabled so it won't deliver an interrupt. */